feat(runtime): add user-controlled turn recovery
This commit is contained in:
1 parent
ffa58aa5ef
commit
12029f8812
60 files changed
+4027
-169
No files matched your search
@@ -11,6 +11,7 @@ import type { CSSProperties, MouseEvent as ReactMouseEvent, ReactElement } from
|
||||
import {
|
||||
Archive,
|
||||
ArchiveRestore,
|
||||
AlertTriangle,
|
||||
ChevronDown,
|
||||
Folder,
|
||||
FolderTree,
|
||||
@@ -260,6 +261,7 @@ interface ChatListProps {
|
||||
collapsedGroups?: Record<string, boolean>;
|
||||
runningChatIds?: string[];
|
||||
updatedChatIds?: string[];
|
||||
recoveryChatIds?: string[];
|
||||
density?: SidebarDensity;
|
||||
showPreviews?: boolean;
|
||||
showTimestamps?: boolean;
|
||||
@@ -302,6 +304,7 @@ export const ChatList = memo(function ChatList({
|
||||
collapsedGroups = {},
|
||||
runningChatIds = [],
|
||||
updatedChatIds = [],
|
||||
recoveryChatIds = [],
|
||||
density = "comfortable",
|
||||
showPreviews = false,
|
||||
showTimestamps = false,
|
||||
@@ -558,6 +561,7 @@ export const ChatList = memo(function ChatList({
|
||||
|
||||
const running = new Set(runningChatIds);
|
||||
const updated = new Set(updatedChatIds);
|
||||
const recovery = new Set(recoveryChatIds);
|
||||
const compact = density === "compact";
|
||||
const firstProjectGroupIndex = limitedGroups.findIndex((group) => group.kind === "project");
|
||||
const selectableDeleteKeys = Array.from(new Set(limitedGroups.flatMap((group) => (
|
||||
@@ -881,6 +885,7 @@ export const ChatList = memo(function ChatList({
|
||||
compact={compact}
|
||||
running={running}
|
||||
updated={updated}
|
||||
recovery={recovery}
|
||||
onSelectPane={onSelectPane}
|
||||
onRequestDelete={onRequestDelete}
|
||||
onRequestRename={onRequestRename}
|
||||
@@ -915,9 +920,11 @@ export const ChatList = memo(function ChatList({
|
||||
: "";
|
||||
const activityState = running.has(s.chatId)
|
||||
? "running"
|
||||
: updated.has(s.chatId) && !topicActive
|
||||
? "updated"
|
||||
: null;
|
||||
: recovery.has(s.chatId)
|
||||
? "recovery"
|
||||
: updated.has(s.chatId) && !topicActive
|
||||
? "updated"
|
||||
: null;
|
||||
const hasPaneMoveTarget = Boolean(onAttachPane)
|
||||
&& paneGroupTargets.some((target) => (
|
||||
target.key !== paneGroup?.tabKey && !target.atCapacity
|
||||
@@ -1330,6 +1337,7 @@ function ActivePaneRows({
|
||||
compact,
|
||||
running,
|
||||
updated,
|
||||
recovery,
|
||||
onSelectPane,
|
||||
onRequestDelete,
|
||||
onRequestRename,
|
||||
@@ -1354,6 +1362,7 @@ function ActivePaneRows({
|
||||
compact: boolean;
|
||||
running: ReadonlySet<string>;
|
||||
updated: ReadonlySet<string>;
|
||||
recovery: ReadonlySet<string>;
|
||||
onSelectPane?: (tabKey: string, paneKey: string) => void;
|
||||
onRequestDelete: (key: string, label: string) => void;
|
||||
onRequestRename: (key: string, label: string) => void;
|
||||
@@ -1390,9 +1399,11 @@ function ActivePaneRows({
|
||||
const active = tabActive && pane.key === group.activePaneKey;
|
||||
const activityState = running.has(pane.chatId)
|
||||
? "running"
|
||||
: updated.has(pane.chatId) && !active
|
||||
? "updated"
|
||||
: null;
|
||||
: recovery.has(pane.chatId)
|
||||
? "recovery"
|
||||
: updated.has(pane.chatId) && !active
|
||||
? "updated"
|
||||
: null;
|
||||
const paneActionsLabel = t("workbench.paneActions", { title: pane.title });
|
||||
const selected = selectedDeleteKeys.has(pane.key);
|
||||
const isPinned = pinned.has(pane.key);
|
||||
@@ -1852,10 +1863,27 @@ function ChatsFoldFooter({
|
||||
function SessionActivityIndicator({
|
||||
state,
|
||||
}: {
|
||||
state: "running" | "updated" | null;
|
||||
state: "running" | "updated" | "recovery" | null;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (state === "recovery") {
|
||||
const label = t("chat.activity.recovery", {
|
||||
defaultValue: "This conversation needs your attention",
|
||||
});
|
||||
return (
|
||||
<SidebarItemTooltip label={label}>
|
||||
<span
|
||||
role="img"
|
||||
aria-label={label}
|
||||
className="grid h-4 w-4 shrink-0 place-items-center text-[#ff8a3d]"
|
||||
>
|
||||
<AlertTriangle className="h-3.5 w-3.5" strokeWidth={2} aria-hidden />
|
||||
</span>
|
||||
</SidebarItemTooltip>
|
||||
);
|
||||
}
|
||||
|
||||
if (state === "running") {
|
||||
const label = t("chat.activity.running");
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user