@agent-native/core 0.155.0 → 0.157.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/templates/assets/app/components/asset/AssetPreviewDialog.tsx +3 -1
- package/corpus/templates/assets/app/i18n-data.ts +21 -1
- package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +17 -13
- package/corpus/templates/clips/app/components/player/share-dialog.tsx +102 -59
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +15 -1
- package/corpus/templates/clips/app/routes/share.$shareId.tsx +16 -2
- package/corpus/templates/slides/app/components/editor/AddSlidePopover.tsx +98 -29
- package/corpus/templates/slides/app/components/editor/EditorActionCluster.tsx +45 -91
- package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +94 -2
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +17 -29
- package/corpus/templates/slides/app/components/editor/SlideContextToolbar.tsx +1 -1
- package/corpus/templates/slides/app/context/DeckContext.tsx +42 -2
- package/corpus/templates/slides/app/global.css +7 -40
- package/corpus/templates/slides/app/i18n/en-US.ts +4 -0
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +130 -45
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/production-agent.d.ts +30 -0
- package/dist/agent/production-agent.js +100 -8
- package/dist/agent/types.d.ts +9 -0
- package/dist/client/AgentPanel.js +12 -9
- package/dist/client/AssistantChat.d.ts +15 -1
- package/dist/client/AssistantChat.js +110 -43
- package/dist/client/MultiTabAssistantChat.js +44 -27
- package/dist/client/chat/markdown-renderer.js +4 -2
- package/dist/client/chat/message-components.d.ts +2 -2
- package/dist/client/chat/message-components.js +69 -35
- package/dist/client/chat/run-recovery.d.ts +4 -1
- package/dist/client/chat/run-recovery.js +62 -30
- package/dist/client/chat/tool-call-display.d.ts +12 -3
- package/dist/client/chat/tool-call-display.js +79 -40
- package/dist/client/chat/widgets/DataChartRenderer.js +3 -1
- package/dist/client/chat/widgets/DataChartWidget.js +8 -2
- package/dist/client/chat/widgets/DataInsightsWidget.js +3 -1
- package/dist/client/chat/widgets/DataTableWidget.js +23 -9
- package/dist/client/chat/widgets/builtin-tool-renderers.js +3 -1
- package/dist/client/components/ui/message-scroller.d.ts +1 -1
- package/dist/client/components/ui/message-scroller.js +7 -3
- package/dist/client/composer/runtime-adapters.js +3 -2
- package/dist/client/context-xray/ContextMeter.js +5 -1
- package/dist/client/context-xray/ContextXRayPanel.js +5 -5
- package/dist/client/error-format.d.ts +4 -0
- package/dist/client/error-format.js +93 -5
- package/dist/client/i18n.js +83 -17
- package/dist/client/observability/ThumbsFeedback.js +10 -8
- package/dist/client/sharing/ShareButton.js +160 -54
- package/dist/coding-tools/run-code.js +2 -1
- package/dist/coding-tools/sandbox/background.d.ts +1 -0
- package/dist/coding-tools/sandbox/background.js +8 -1
- package/dist/coding-tools/sandbox/executions-store.d.ts +2 -0
- package/dist/coding-tools/sandbox/executions-store.js +41 -3
- package/dist/collab/routes.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/localization/core-messages/ar-SA.d.ts +3 -0
- package/dist/localization/core-messages/ar-SA.js +541 -0
- package/dist/localization/core-messages/de-DE.d.ts +3 -0
- package/dist/localization/core-messages/de-DE.js +513 -0
- package/dist/localization/core-messages/en-US.d.ts +513 -0
- package/dist/localization/core-messages/en-US.js +513 -0
- package/dist/localization/core-messages/es-ES.d.ts +3 -0
- package/dist/localization/core-messages/es-ES.js +520 -0
- package/dist/localization/core-messages/fr-FR.d.ts +3 -0
- package/dist/localization/core-messages/fr-FR.js +520 -0
- package/dist/localization/core-messages/hi-IN.d.ts +3 -0
- package/dist/localization/core-messages/hi-IN.js +513 -0
- package/dist/localization/core-messages/ja-JP.d.ts +3 -0
- package/dist/localization/core-messages/ja-JP.js +506 -0
- package/dist/localization/core-messages/ko-KR.d.ts +3 -0
- package/dist/localization/core-messages/ko-KR.js +506 -0
- package/dist/localization/core-messages/pt-BR.d.ts +3 -0
- package/dist/localization/core-messages/pt-BR.js +520 -0
- package/dist/localization/core-messages/zh-CN.d.ts +3 -0
- package/dist/localization/core-messages/zh-CN.js +506 -0
- package/dist/localization/core-messages/zh-TW.d.ts +3 -0
- package/dist/localization/core-messages/zh-TW.js +506 -0
- package/dist/localization/core-messages.d.ts +524 -0
- package/dist/localization/core-messages.js +124 -0
- package/dist/localization/default-messages.d.ts +2 -0
- package/dist/localization/default-messages.js +2 -0
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +5 -5
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-chat/plugin-options.d.ts +7 -2
- package/dist/server/agent-chat-plugin.d.ts +10 -0
- package/dist/server/agent-chat-plugin.js +144 -41
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/agent-run-context.d.ts +7 -1
- package/dist/server/agent-run-context.js +9 -2
- package/dist/server/agent-teams-run-queue.d.ts +3 -0
- package/dist/server/agent-teams.js +38 -9
- package/dist/server/index.d.ts +1 -1
- package/dist/server/request-context.d.ts +7 -0
- package/dist/server/request-context.js +15 -0
- package/docs/content/agent-surfaces.mdx +30 -0
- package/package.json +2 -2
|
@@ -200,6 +200,7 @@ function IconTooltip({ content, children, }) {
|
|
|
200
200
|
return (_jsx(DesignSystemTooltip, { trigger: children, content: normalizeTooltipText(content), placement: "bottom", delayMs: 250, className: "z-[300] overflow-hidden rounded-md border border-border bg-popover px-2 py-1 text-[11px] text-foreground shadow-md" }));
|
|
201
201
|
}
|
|
202
202
|
function ChatLoadingSkeleton({ renderHeader, centerComposerWhenEmpty = false, composerSlot, composerAreaClassName, composerLayoutVariant = "default", }) {
|
|
203
|
+
const t = useT();
|
|
203
204
|
// Provide empty no-op implementations so renderHeader can render the real
|
|
204
205
|
// tab/mode buttons without needing actual chat state.
|
|
205
206
|
const noop = useCallback(() => { }, []);
|
|
@@ -219,7 +220,7 @@ function ChatLoadingSkeleton({ renderHeader, centerComposerWhenEmpty = false, co
|
|
|
219
220
|
toggleHistory: noop,
|
|
220
221
|
};
|
|
221
222
|
if (centerComposerWhenEmpty) {
|
|
222
|
-
return (_jsxs("div", { className: "flex flex-col flex-1 min-h-0", children: [renderHeader ? renderHeader(stubProps) : null, _jsxs("div", { "data-agent-empty-state": "centered", className: "relative flex flex-1 flex-col h-full min-h-0 text-foreground", children: [_jsx("div", { className: "agent-chat-scroll flex-1 overflow-y-auto overflow-x-hidden min-h-0", children: _jsx("div", { className: "agent-empty-state sr-only", "aria-busy": "true", children: "
|
|
223
|
+
return (_jsxs("div", { className: "flex flex-col flex-1 min-h-0", children: [renderHeader ? renderHeader(stubProps) : null, _jsxs("div", { "data-agent-empty-state": "centered", className: "relative flex flex-1 flex-col h-full min-h-0 text-foreground", children: [_jsx("div", { className: "agent-chat-scroll flex-1 overflow-y-auto overflow-x-hidden min-h-0", children: _jsx("div", { className: "agent-empty-state sr-only", "aria-busy": "true", children: t("agentChat.empty.loadingChat") }) }), composerSlot, _jsx("div", { className: "agent-composer-stack", children: _jsx("div", { className: cn("agent-composer-area shrink-0 px-3 py-2", composerLayoutVariant !== "default" &&
|
|
223
224
|
`agent-composer-area--${composerLayoutVariant}`, composerAreaClassName), children: _jsxs("div", { className: cn("agent-composer-root flex flex-col rounded-lg border border-input bg-muted/45 transition-colors", composerLayoutVariant !== "default" &&
|
|
224
225
|
`agent-composer-root--${composerLayoutVariant}`), children: [_jsx("div", { className: "px-3 pt-3", children: _jsx("div", { className: "h-5 w-3/5 rounded bg-muted animate-pulse motion-reduce:animate-none" }) }), _jsxs("div", { className: "mt-auto flex items-center gap-2 px-3 py-2", children: [_jsx("div", { className: "h-5 w-5 rounded bg-muted animate-pulse motion-reduce:animate-none" }), _jsx("div", { className: "ml-auto h-4 w-28 rounded bg-muted animate-pulse motion-reduce:animate-none" }), _jsx("div", { className: "h-7 w-7 rounded-md bg-muted animate-pulse motion-reduce:animate-none" })] })] }) }) })] })] }));
|
|
225
226
|
}
|
|
@@ -721,7 +722,7 @@ function AgentPanelInner({ defaultMode = "chat", className, style, apiUrl, empty
|
|
|
721
722
|
(activeTabMessageCount <= 0 && activeTab.status === "idle")) {
|
|
722
723
|
return null;
|
|
723
724
|
}
|
|
724
|
-
return (_jsx(ShareButton, { resourceType: "chat_thread", resourceId: activeTab.id, allowedRoles: ["viewer", "editor", "admin"], resourceTitle: activeTab.label || "
|
|
725
|
+
return (_jsx(ShareButton, { resourceType: "chat_thread", resourceId: activeTab.id, allowedRoles: ["viewer", "editor", "admin"], resourceTitle: activeTab.label || t("agentPanel.chat"), shareUrl: getChatThreadShareUrl(activeTab.id), trigger: "icon", triggerClassName: "h-7 w-7", defaultOpen: onCollapse && shareFromMenuOpen, onOpenChange: onCollapse ? setShareFromMenuOpen : undefined }));
|
|
725
726
|
})(), feedbackEnabled ? (_jsx(FeedbackButton, { variant: "icon", side: "bottom", align: "end", chatSessionId: activeChatSessionId, chatStorageKey: storageKey, open: feedbackOpen, onOpenChange: setFeedbackOpen, trigger: _jsx("button", { type: "button", tabIndex: -1, "aria-hidden": "true", className: "pointer-events-none absolute end-0 top-full h-px w-px opacity-0" }) })) : null, mode === "chat" && (_jsx(IconTooltip, { content: t("agentPanel.newChat"), children: _jsx("button", { onClick: addTab, "aria-label": t("agentPanel.newChat"), className: "flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50", children: _jsx(IconPlus, { size: 14 }) }) })), !onCollapse && mode === "cli" && canUseCodeTools && (_jsx(IconTooltip, { content: t("agentPanel.newTerminal"), children: _jsx("button", { onClick: addCliTab, "aria-label": t("agentPanel.newTerminal"), className: "flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50", children: _jsx(IconPlus, { size: 14 }) }) })), _jsxs(DropdownMenu, { open: headerMenuOpen, onOpenChange: setHeaderMenuOpen, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { className: cn("flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50", (headerMenuOpen || mode === "settings") &&
|
|
726
727
|
"bg-accent text-foreground"), "aria-label": t("agentPanel.panelOptions"), children: _jsx(IconDotsVertical, { size: 14 }) }) }), _jsxs(DropdownMenuContent, { align: "end", sideOffset: 6, className: "w-48", onCloseAutoFocus: (event) => {
|
|
727
728
|
// A sibling overlay owns focus next; restoring it to the menu
|
|
@@ -785,7 +786,7 @@ function AgentPanelInner({ defaultMode = "chat", className, style, apiUrl, empty
|
|
|
785
786
|
? tabs.find((tab) => tab.id === activeTabId)
|
|
786
787
|
: undefined;
|
|
787
788
|
const canShareActiveTab = activeTab && (activeTabMessageCount > 0 || activeTab.status !== "idle");
|
|
788
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { "aria-hidden": "true", "data-agent-page-chat-fade": "", className: "pointer-events-none absolute inset-x-0 top-0 z-50 h-16 bg-gradient-to-b from-background via-background/90 to-transparent opacity-0 transition-opacity duration-150" }), _jsx("div", { className: "pointer-events-none absolute inset-x-0 top-3 z-[60] flex justify-end px-3 sm:top-4 sm:px-4", children: _jsxs("div", { className: "pointer-events-auto flex items-center gap-1", children: [canShareActiveTab ? (_jsx(ShareButton, { resourceType: "chat_thread", resourceId: activeTab.id, allowedRoles: ["viewer", "editor", "admin"], resourceTitle: activeTab.label || "
|
|
789
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { "aria-hidden": "true", "data-agent-page-chat-fade": "", className: "pointer-events-none absolute inset-x-0 top-0 z-50 h-16 bg-gradient-to-b from-background via-background/90 to-transparent opacity-0 transition-opacity duration-150" }), _jsx("div", { className: "pointer-events-none absolute inset-x-0 top-3 z-[60] flex justify-end px-3 sm:top-4 sm:px-4", children: _jsxs("div", { className: "pointer-events-auto flex items-center gap-1", children: [canShareActiveTab ? (_jsx(ShareButton, { resourceType: "chat_thread", resourceId: activeTab.id, allowedRoles: ["viewer", "editor", "admin"], resourceTitle: activeTab.label || t("agentPanel.chat"), shareUrl: getChatThreadShareUrl(activeTab.id), trigger: "icon", triggerClassName: "h-8 w-8 border border-border bg-background/95 shadow-sm backdrop-blur hover:bg-accent" })) : null, _jsxs("button", { type: "button", "data-agent-page-new-chat": "", "aria-label": t("agentPanel.newChat"), onClick: () => {
|
|
789
790
|
addTab();
|
|
790
791
|
}, className: "inline-flex h-8 items-center gap-1.5 rounded-md border border-border bg-background/95 px-2.5 text-xs font-medium text-foreground shadow-sm backdrop-blur transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: [_jsx(IconPlus, { size: 14 }), _jsx("span", { children: t("agentPanel.newChat") })] })] }) })] }));
|
|
791
792
|
}, [getChatThreadShareUrl, t]);
|
|
@@ -829,7 +830,7 @@ function AgentPanelInner({ defaultMode = "chat", className, style, apiUrl, empty
|
|
|
829
830
|
activeTab?.parentThreadId === tab.id);
|
|
830
831
|
return (_jsxs("div", { role: "button", tabIndex: 0, ref: isActive ? activeTabRefCb : undefined, onClick: () => setActiveTabId(tab.id), onKeyDown: activateOnKeyDown(() => setActiveTabId(tab.id)), className: cn("agent-tab relative flex shrink-0 items-center gap-1 rounded-md px-2.5 py-1.5 text-[11px] font-medium cursor-pointer max-w-[150px]", isActive
|
|
831
832
|
? "bg-accent text-foreground"
|
|
832
|
-
: "text-muted-foreground hover:bg-accent hover:text-foreground"), children: [_jsx("span", { className: "truncate pe-1", children: tab.label }), tab.status === "running" && (_jsx("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-muted-foreground/50 animate-pulse" })), _jsx("button", { type: "button", "aria-label": "
|
|
833
|
+
: "text-muted-foreground hover:bg-accent hover:text-foreground"), children: [_jsx("span", { className: "truncate pe-1", children: tab.label }), tab.status === "running" && (_jsx("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-muted-foreground/50 animate-pulse" })), _jsx("button", { type: "button", "aria-label": t("agentPanel.closeTab"), onClick: (e) => {
|
|
833
834
|
e.stopPropagation();
|
|
834
835
|
closeTab(tab.id);
|
|
835
836
|
}, className: "agent-tab-close flex items-center justify-end text-muted-foreground hover:text-foreground", style: {
|
|
@@ -872,7 +873,7 @@ function AgentPanelInner({ defaultMode = "chat", className, style, apiUrl, empty
|
|
|
872
873
|
activeTab?.parentThreadId === tab.id);
|
|
873
874
|
return (_jsxs("div", { role: "button", tabIndex: 0, ref: isActive ? activeTabRefCb : undefined, onClick: () => setActiveTabId(tab.id), onKeyDown: activateOnKeyDown(() => setActiveTabId(tab.id)), className: cn("agent-tab relative flex shrink-0 items-center gap-1 rounded-md px-2.5 py-1.5 text-[11px] font-medium cursor-pointer max-w-[150px]", isActive
|
|
874
875
|
? "bg-accent text-foreground"
|
|
875
|
-
: "text-muted-foreground hover:bg-accent hover:text-foreground"), children: [_jsx("span", { className: "truncate pe-1", children: tab.label }), tab.status === "running" && (_jsx("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-muted-foreground/50 animate-pulse" })), _jsx("button", { type: "button", "aria-label": "
|
|
876
|
+
: "text-muted-foreground hover:bg-accent hover:text-foreground"), children: [_jsx("span", { className: "truncate pe-1", children: tab.label }), tab.status === "running" && (_jsx("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-muted-foreground/50 animate-pulse" })), _jsx("button", { type: "button", "aria-label": t("agentPanel.closeTab"), onClick: (e) => {
|
|
876
877
|
e.stopPropagation();
|
|
877
878
|
closeTab(tab.id);
|
|
878
879
|
}, className: "agent-tab-close flex items-center justify-end text-muted-foreground hover:text-foreground", style: {
|
|
@@ -890,7 +891,7 @@ function AgentPanelInner({ defaultMode = "chat", className, style, apiUrl, empty
|
|
|
890
891
|
? activeTabRefCb
|
|
891
892
|
: undefined, onClick: () => setActiveCliTab(id), onKeyDown: activateOnKeyDown(() => setActiveCliTab(id)), className: cn("agent-tab relative flex shrink-0 items-center gap-1 rounded-md px-2.5 py-1.5 text-[11px] font-medium cursor-pointer", id === activeCliTab
|
|
892
893
|
? "bg-accent text-foreground"
|
|
893
|
-
: "text-muted-foreground hover:bg-accent hover:text-foreground"), children: [_jsxs("span", { children: ["Terminal ", i + 1] }), _jsx("button", { type: "button", "aria-label": "
|
|
894
|
+
: "text-muted-foreground hover:bg-accent hover:text-foreground"), children: [_jsxs("span", { children: ["Terminal ", i + 1] }), _jsx("button", { type: "button", "aria-label": t("agentPanel.closeTab"), onClick: (e) => {
|
|
894
895
|
e.stopPropagation();
|
|
895
896
|
closeCliTab(id);
|
|
896
897
|
}, className: "agent-tab-close flex items-center justify-end text-muted-foreground hover:text-foreground", style: {
|
|
@@ -908,7 +909,7 @@ function AgentPanelInner({ defaultMode = "chat", className, style, apiUrl, empty
|
|
|
908
909
|
? activeTabRefCb
|
|
909
910
|
: undefined, onClick: () => setActiveTabId(tab.id), onKeyDown: activateOnKeyDown(() => setActiveTabId(tab.id)), className: cn("agent-tab relative flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium cursor-pointer max-w-[140px]", tab.id === activeTabId
|
|
910
911
|
? "bg-accent text-foreground"
|
|
911
|
-
: "text-muted-foreground hover:bg-accent hover:text-foreground"), children: [_jsx("span", { className: "truncate pe-1", children: tab.subAgentName || tab.label }), tab.status === "running" && (_jsx("span", { className: "h-1 w-1 shrink-0 rounded-full bg-muted-foreground/50 animate-pulse" })), _jsx("button", { type: "button", "aria-label": "
|
|
912
|
+
: "text-muted-foreground hover:bg-accent hover:text-foreground"), children: [_jsx("span", { className: "truncate pe-1", children: tab.subAgentName || tab.label }), tab.status === "running" && (_jsx("span", { className: "h-1 w-1 shrink-0 rounded-full bg-muted-foreground/50 animate-pulse" })), _jsx("button", { type: "button", "aria-label": t("agentPanel.closeTab"), onClick: (e) => {
|
|
912
913
|
e.stopPropagation();
|
|
913
914
|
closeTab(tab.id);
|
|
914
915
|
}, className: "agent-tab-close flex items-center justify-end text-muted-foreground hover:text-foreground", style: {
|
|
@@ -937,6 +938,7 @@ function AgentPanelInner({ defaultMode = "chat", className, style, apiUrl, empty
|
|
|
937
938
|
activeTabRefCb,
|
|
938
939
|
activateOnKeyDown,
|
|
939
940
|
closeCliTab,
|
|
941
|
+
t,
|
|
940
942
|
]);
|
|
941
943
|
return (_jsxs("div", { className: cn("agent-panel-root flex flex-1 flex-col min-h-0 h-full text-[13px] leading-[1.2] antialiased", className), style: {
|
|
942
944
|
...AGENT_PANEL_ROOT_STYLE,
|
|
@@ -972,7 +974,7 @@ function AgentPanelInner({ defaultMode = "chat", className, style, apiUrl, empty
|
|
|
972
974
|
? mode === "cli" &&
|
|
973
975
|
cliTabs.map((id) => (_jsx("div", { className: "min-h-0 relative flex-1", style: {
|
|
974
976
|
display: id === activeCliTab ? undefined : "none",
|
|
975
|
-
}, children: _jsx(Suspense, { fallback: _jsx("div", { className: "flex items-center justify-center h-full text-muted-foreground text-sm", children: "
|
|
977
|
+
}, children: _jsx(Suspense, { fallback: _jsx("div", { className: "flex items-center justify-center h-full text-muted-foreground text-sm", children: t("agentPanel.loadingTerminal") }), children: _jsx(AgentTerminal, { command: selectedCli, hideInFrame: false, className: "h-full", style: { background: "transparent" } }) }) }, id)))
|
|
976
978
|
: mode === "cli" && (_jsx("div", { className: "flex flex-1 flex-col items-center justify-center min-h-0 px-6 gap-3", children: _jsx(CodeAccessUnavailablePanel, { title: codeAccessEnabled
|
|
977
979
|
? t("agentPanel.cliRequiresDevMode")
|
|
978
980
|
: codeUnavailableTitle, description: codeAccessEnabled
|
|
@@ -1957,6 +1959,7 @@ export function focusAgentChat() {
|
|
|
1957
1959
|
* Dispatches a custom event that AgentSidebar listens for.
|
|
1958
1960
|
*/
|
|
1959
1961
|
export function AgentToggleButton({ className }) {
|
|
1962
|
+
const t = useT();
|
|
1960
1963
|
const [open, setOpen] = useState(false);
|
|
1961
1964
|
useEffect(() => {
|
|
1962
1965
|
const handler = (event) => {
|
|
@@ -1972,5 +1975,5 @@ export function AgentToggleButton({ className }) {
|
|
|
1972
1975
|
// own close button.
|
|
1973
1976
|
if (open)
|
|
1974
1977
|
return null;
|
|
1975
|
-
return (_jsx(DesignSystemTooltip, { trigger: _jsx("button", { type: "button", "aria-label": "
|
|
1978
|
+
return (_jsx(DesignSystemTooltip, { trigger: _jsx("button", { type: "button", "aria-label": t("agentPanel.toggleAgent"), onClick: () => window.dispatchEvent(new Event("agent-panel:toggle")), className: cn("inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent/40 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className), children: _jsx(IconMessageDots, { size: 20, "aria-hidden": true }) }), content: t("agentPanel.toggleAgent"), delayMs: 200 }));
|
|
1976
1979
|
}
|
|
@@ -132,11 +132,22 @@ export declare function resolveAssistantChatRunningState({ forceStopped, isRunti
|
|
|
132
132
|
isRunning: boolean;
|
|
133
133
|
showRunningInUI: boolean;
|
|
134
134
|
};
|
|
135
|
-
export declare function resolveAssistantChatRunningStatusLabel({ runningActivityLabel, isAutoResuming, isReconnecting, hasReconnectContent, }: {
|
|
135
|
+
export declare function resolveAssistantChatRunningStatusLabel({ runningActivityLabel, isAutoResuming, isReconnecting, hasReconnectContent, labels, }: {
|
|
136
136
|
runningActivityLabel: string | null | undefined;
|
|
137
137
|
isAutoResuming: boolean;
|
|
138
138
|
isReconnecting: boolean;
|
|
139
139
|
hasReconnectContent: boolean;
|
|
140
|
+
labels?: {
|
|
141
|
+
thinking: string;
|
|
142
|
+
resuming: string;
|
|
143
|
+
stillWorking: string;
|
|
144
|
+
working?: string;
|
|
145
|
+
contactingModel?: string;
|
|
146
|
+
starting?: (activity: string) => string;
|
|
147
|
+
preparing?: (activity: string) => string;
|
|
148
|
+
writing?: (activity: string) => string;
|
|
149
|
+
stillGenerating?: (activity: string) => string;
|
|
150
|
+
};
|
|
140
151
|
}): string;
|
|
141
152
|
export declare function resolveAssistantChatComposerPlaceholder(composerPlaceholder: string | null | undefined): string;
|
|
142
153
|
export declare function shouldShowGlobalRunningStatus({ showRunningInUI, runningActivityLabel, runningActivityTool, latestMessage, reconnectContent, }: {
|
|
@@ -311,6 +322,8 @@ export interface AssistantChatProps {
|
|
|
311
322
|
composerToolbarSlot?: React.ReactNode;
|
|
312
323
|
/** Optional action rendered beside the voice/send controls. */
|
|
313
324
|
composerExtraActionButton?: React.ReactNode;
|
|
325
|
+
/** Show the framework model picker in the shared composer. Defaults to true. */
|
|
326
|
+
showModelSelector?: boolean;
|
|
314
327
|
/** Disable the composer for capability-gated surfaces while still showing history. */
|
|
315
328
|
composerDisabled?: boolean;
|
|
316
329
|
/** Placeholder to show while the composer is disabled by the host surface. */
|
|
@@ -410,6 +423,7 @@ export interface AssistantChatProps {
|
|
|
410
423
|
onAlwaysAllow?: (approvalKey: string) => void;
|
|
411
424
|
};
|
|
412
425
|
}
|
|
426
|
+
export declare function shouldShowAssistantChatModelSelector(showModelSelector: boolean | undefined): boolean;
|
|
413
427
|
export declare const CHAT_STORAGE_PREFIX = "agent-chat:";
|
|
414
428
|
/** Remove persisted chat for a given tabId (or "default"). */
|
|
415
429
|
export declare function clearChatStorage(tabId?: string): void;
|
|
@@ -32,6 +32,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "./com
|
|
|
32
32
|
import { AgentComposerFrame, TiptapComposer, } from "./composer/index.js";
|
|
33
33
|
import { useAgentDynamicSuggestionsResult, } from "./dynamic-suggestions.js";
|
|
34
34
|
import { GuidedQuestionFlow, useGuidedQuestionFlow, } from "./guided-questions.js";
|
|
35
|
+
import { useT } from "./i18n.js";
|
|
35
36
|
import { buildSignInReturnHref } from "./require-session.js";
|
|
36
37
|
import { addMcpConnectionCompleteListener, consumeMcpConnectionResume, } from "./resources/mcp-connection-resume.js";
|
|
37
38
|
import { McpConnectionSuggestion } from "./resources/McpConnectionSuggestion.js";
|
|
@@ -365,6 +366,7 @@ function getImageAttachmentSrc(attachment) {
|
|
|
365
366
|
return imagePart && "image" in imagePart ? imagePart.image : null;
|
|
366
367
|
}
|
|
367
368
|
function ComposerAttachmentPreviewCard({ attachment, onRemove, }) {
|
|
369
|
+
const t = useT();
|
|
368
370
|
const [imageSrc, setImageSrc] = useState(null);
|
|
369
371
|
useEffect(() => {
|
|
370
372
|
const nextSrc = getImageAttachmentSrc(attachment);
|
|
@@ -383,7 +385,9 @@ function ComposerAttachmentPreviewCard({ attachment, onRemove, }) {
|
|
|
383
385
|
? "h-20 w-20 rounded-xl shadow-[0_12px_30px_-18px_rgba(0,0,0,0.7)]"
|
|
384
386
|
: "inline-flex max-w-[220px] items-center gap-2 rounded-lg px-2.5 py-2 text-xs"), children: [isImage ? (_jsxs(_Fragment, { children: [_jsx("img", { src: imageSrc, alt: attachment.name, className: "h-full w-full object-cover" }), _jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/80 via-black/30 to-transparent px-2 py-1.5", children: _jsx("div", { className: "truncate text-[10px] font-medium text-white/95", children: attachment.name }) })] })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-background text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground", children: attachment.name.split(".").pop() || "file" }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate font-medium", children: attachment.name }), _jsx("div", { className: "text-[11px] text-muted-foreground", children: attachment.contentType || attachment.type })] })] })), _jsx("button", { type: "button", onClick: () => onRemove(attachment.id), className: cn("absolute flex h-6 w-6 items-center justify-center rounded-full border border-border/60 bg-background/95 text-muted-foreground shadow-sm transition hover:text-foreground", isImage
|
|
385
387
|
? "end-1.5 top-1.5 opacity-100 md:opacity-0 md:group-hover:opacity-100"
|
|
386
|
-
: "end-1.5 top-1.5"), "aria-label":
|
|
388
|
+
: "end-1.5 top-1.5"), "aria-label": t("agentChat.composer.removeAttachment", {
|
|
389
|
+
name: attachment.name,
|
|
390
|
+
}), children: _jsx(IconX, { className: "h-3 w-3" }) })] }));
|
|
387
391
|
}
|
|
388
392
|
function ComposerAttachmentPreviewStrip() {
|
|
389
393
|
const attachments = useComposer((state) => state.attachments);
|
|
@@ -980,14 +984,38 @@ export function resolveAssistantChatRunningState({ forceStopped, isRuntimeRunnin
|
|
|
980
984
|
showRunningInUI: !forceStopped && !hasTerminalRunError && (isRunning || isAutoResuming),
|
|
981
985
|
};
|
|
982
986
|
}
|
|
983
|
-
export function resolveAssistantChatRunningStatusLabel({ runningActivityLabel, isAutoResuming, isReconnecting, hasReconnectContent,
|
|
984
|
-
|
|
987
|
+
export function resolveAssistantChatRunningStatusLabel({ runningActivityLabel, isAutoResuming, isReconnecting, hasReconnectContent, labels = {
|
|
988
|
+
thinking: "Thinking",
|
|
989
|
+
resuming: "Resuming",
|
|
990
|
+
stillWorking: "Still working",
|
|
991
|
+
}, }) {
|
|
992
|
+
if (runningActivityLabel) {
|
|
993
|
+
if (runningActivityLabel === "Thinking")
|
|
994
|
+
return labels.thinking;
|
|
995
|
+
if (runningActivityLabel === "Working") {
|
|
996
|
+
return labels.working ?? "Working";
|
|
997
|
+
}
|
|
998
|
+
if (runningActivityLabel === "Contacting model") {
|
|
999
|
+
return labels.contactingModel ?? "Contacting model";
|
|
1000
|
+
}
|
|
1001
|
+
const localizedActivityPatterns = [
|
|
1002
|
+
[/^Starting (.+)\.\.\.$/, labels.starting],
|
|
1003
|
+
[/^Preparing (.+)\.\.\.$/, labels.preparing],
|
|
1004
|
+
[/^Writing (.+)\.\.\.$/, labels.writing],
|
|
1005
|
+
[/^Still generating (.+)$/, labels.stillGenerating],
|
|
1006
|
+
];
|
|
1007
|
+
for (const [pattern, translateActivity] of localizedActivityPatterns) {
|
|
1008
|
+
const match = runningActivityLabel.match(pattern);
|
|
1009
|
+
if (match?.[1] && translateActivity)
|
|
1010
|
+
return translateActivity(match[1]);
|
|
1011
|
+
}
|
|
985
1012
|
return runningActivityLabel;
|
|
1013
|
+
}
|
|
986
1014
|
if (isAutoResuming)
|
|
987
|
-
return
|
|
1015
|
+
return labels.resuming;
|
|
988
1016
|
if (isReconnecting && hasReconnectContent)
|
|
989
|
-
return
|
|
990
|
-
return
|
|
1017
|
+
return labels.stillWorking;
|
|
1018
|
+
return labels.thinking;
|
|
991
1019
|
}
|
|
992
1020
|
export function resolveAssistantChatComposerPlaceholder(composerPlaceholder) {
|
|
993
1021
|
return composerPlaceholder ?? DEFAULT_ASSISTANT_CHAT_COMPOSER_PLACEHOLDER;
|
|
@@ -1109,6 +1137,9 @@ function AssistantChatScrollerControls({ resumeFollowingRef, }) {
|
|
|
1109
1137
|
}, [resumeFollowingRef, scrollToEnd]);
|
|
1110
1138
|
return null;
|
|
1111
1139
|
}
|
|
1140
|
+
export function shouldShowAssistantChatModelSelector(showModelSelector) {
|
|
1141
|
+
return showModelSelector !== false;
|
|
1142
|
+
}
|
|
1112
1143
|
export const CHAT_STORAGE_PREFIX = "agent-chat:";
|
|
1113
1144
|
const THREAD_SNAPSHOT_CACHE_PREFIX = `${CHAT_STORAGE_PREFIX}thread-snapshot:`;
|
|
1114
1145
|
function threadSnapshotCacheKey(apiUrl, threadId) {
|
|
@@ -1344,7 +1375,8 @@ export function useAutoResumeStatus(tabId, forceStopped) {
|
|
|
1344
1375
|
function approvalResolutionIdentity(approvalKey, toolCallId) {
|
|
1345
1376
|
return `${toolCallId ?? ""}\u0000${approvalKey}`;
|
|
1346
1377
|
}
|
|
1347
|
-
const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateText, suggestions, dynamicSuggestions, threadFooterSlot, emptyStateAddon, showHeader = true, onSwitchToCli, className, apiUrl, tabId, browserTabId, threadId, contextScope, isActiveComposer = true, onMessageCountChange, onSaveThread, onGenerateTitle, composerSlot, onComposerTextChange, composerAreaClassName, composerPlaceholder, missingApiKeySetupLayout = "default", composerLayoutVariant = "default", centerComposerWhenEmpty = false, emptyStateDisplay = "default", composerToolbarSlot, composerExtraActionButton, composerDisabled = false, composerDisabledPlaceholder, isNewThread, isThreadStateLoading, onSlashCommand, execMode, onExecModeChange, approvalActions, planModeDisabled, planModeDisabledReason, selectedModel, defaultModel, selectedEngine, selectedEffort, availableModels, modelListLoading, onModelChange, onEffortChange, imageModelMenu, onForkChat, onConnectProvider, onConnectLocalRuntime, plusMenuMode = "full", providerStatusChecksEnabled = true, loadHistoryRepository, historyReloadKey, externalStreaming = false, agentChatSurface = "app", suppressInlineOpenApp = false, }, ref) {
|
|
1378
|
+
const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateText, suggestions, dynamicSuggestions, threadFooterSlot, emptyStateAddon, showHeader = true, onSwitchToCli, className, apiUrl, tabId, browserTabId, threadId, contextScope, isActiveComposer = true, onMessageCountChange, onSaveThread, onGenerateTitle, composerSlot, onComposerTextChange, composerAreaClassName, composerPlaceholder, missingApiKeySetupLayout = "default", composerLayoutVariant = "default", centerComposerWhenEmpty = false, emptyStateDisplay = "default", composerToolbarSlot, composerExtraActionButton, showModelSelector = true, composerDisabled = false, composerDisabledPlaceholder, isNewThread, isThreadStateLoading, onSlashCommand, execMode, onExecModeChange, approvalActions, planModeDisabled, planModeDisabledReason, selectedModel, defaultModel, selectedEngine, selectedEffort, availableModels, modelListLoading, onModelChange, onEffortChange, imageModelMenu, onForkChat, onConnectProvider, onConnectLocalRuntime, plusMenuMode = "full", providerStatusChecksEnabled = true, loadHistoryRepository, historyReloadKey, externalStreaming = false, agentChatSurface = "app", suppressInlineOpenApp = false, }, ref) {
|
|
1379
|
+
const t = useT();
|
|
1348
1380
|
const thread = useThread();
|
|
1349
1381
|
const threadRuntime = useThreadRuntime();
|
|
1350
1382
|
const composerRuntime = useComposerRuntime();
|
|
@@ -1441,10 +1473,10 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1441
1473
|
void Promise.all(attachments.map((file) => composerRuntime.addAttachment(file))).catch((error) => {
|
|
1442
1474
|
const msg = error instanceof Error
|
|
1443
1475
|
? error.message
|
|
1444
|
-
: "
|
|
1476
|
+
: t("agentChat.composer.droppedFileError");
|
|
1445
1477
|
setComposerError(msg);
|
|
1446
1478
|
});
|
|
1447
|
-
}, [composerRuntime, setComposerError]);
|
|
1479
|
+
}, [composerRuntime, setComposerError, t]);
|
|
1448
1480
|
// Patch the underlying assistant-ui MessageRepository so addOrUpdateMessage
|
|
1449
1481
|
// can't throw "Parent message not found" mid-run. assistant-ui calls
|
|
1450
1482
|
// `repository.clear()` from `runtime.import()` and from `resetHead(null)`,
|
|
@@ -1721,6 +1753,17 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1721
1753
|
isAutoResuming,
|
|
1722
1754
|
isReconnecting,
|
|
1723
1755
|
hasReconnectContent: reconnectContent.length > 0,
|
|
1756
|
+
labels: {
|
|
1757
|
+
thinking: t("agentChat.status.thinking"),
|
|
1758
|
+
resuming: t("agentChat.status.resuming"),
|
|
1759
|
+
stillWorking: t("agentChat.status.stillWorking"),
|
|
1760
|
+
working: t("agentChat.status.working"),
|
|
1761
|
+
contactingModel: t("agentChat.status.contactingModel"),
|
|
1762
|
+
starting: (activity) => t("agentChat.status.starting", { activity }),
|
|
1763
|
+
preparing: (activity) => t("agentChat.status.preparing", { activity }),
|
|
1764
|
+
writing: (activity) => t("agentChat.status.writing", { activity }),
|
|
1765
|
+
stillGenerating: (activity) => t("agentChat.status.stillGenerating", { activity }),
|
|
1766
|
+
},
|
|
1724
1767
|
});
|
|
1725
1768
|
const reconnectActivityContent = useMemo(() => isReconnecting || reconnectFrozen
|
|
1726
1769
|
? reconnectActivityFallbackContent(runningActivityTool)
|
|
@@ -2375,10 +2418,10 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
2375
2418
|
}
|
|
2376
2419
|
setRunErrorInfo({
|
|
2377
2420
|
message: reconnectErrorCode === "run_timeout"
|
|
2378
|
-
? "
|
|
2421
|
+
? t("agentChat.recovery.backgroundTimeout")
|
|
2379
2422
|
: reconnectErrorCode === "reconnect_stream_ended"
|
|
2380
|
-
? "
|
|
2381
|
-
: "
|
|
2423
|
+
? t("agentChat.recovery.streamEnded")
|
|
2424
|
+
: t("agentChat.recovery.noProgress"),
|
|
2382
2425
|
errorCode: reconnectErrorCode,
|
|
2383
2426
|
recoverable: true,
|
|
2384
2427
|
runId,
|
|
@@ -2453,7 +2496,14 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
2453
2496
|
};
|
|
2454
2497
|
void streamReconnect();
|
|
2455
2498
|
return true;
|
|
2456
|
-
}, [
|
|
2499
|
+
}, [
|
|
2500
|
+
apiUrl,
|
|
2501
|
+
refreshThreadFromServer,
|
|
2502
|
+
t,
|
|
2503
|
+
tabId,
|
|
2504
|
+
threadId,
|
|
2505
|
+
wasRecentlyStoppedRun,
|
|
2506
|
+
]);
|
|
2457
2507
|
const reconnectActiveRunForThread = useCallback(async () => {
|
|
2458
2508
|
if (!threadId)
|
|
2459
2509
|
return false;
|
|
@@ -2489,7 +2539,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
2489
2539
|
clearActiveRunIfMatches(threadId, storedActiveRun.runId);
|
|
2490
2540
|
window.dispatchEvent(new CustomEvent("agent-chat:run-error", {
|
|
2491
2541
|
detail: {
|
|
2492
|
-
message: "
|
|
2542
|
+
message: t("agentChat.recovery.statusCheckFailed"),
|
|
2493
2543
|
errorCode: "run_status_unavailable",
|
|
2494
2544
|
recoverable: true,
|
|
2495
2545
|
...(storedActiveRun.runId
|
|
@@ -2520,7 +2570,14 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
2520
2570
|
catch {
|
|
2521
2571
|
return false;
|
|
2522
2572
|
}
|
|
2523
|
-
}, [
|
|
2573
|
+
}, [
|
|
2574
|
+
apiUrl,
|
|
2575
|
+
refreshThreadFromServer,
|
|
2576
|
+
startReconnectToRun,
|
|
2577
|
+
t,
|
|
2578
|
+
tabId,
|
|
2579
|
+
threadId,
|
|
2580
|
+
]);
|
|
2524
2581
|
useEffect(() => {
|
|
2525
2582
|
if (!threadId || !isNewThread)
|
|
2526
2583
|
return;
|
|
@@ -3529,7 +3586,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
3529
3586
|
catch (err) {
|
|
3530
3587
|
const msg = err instanceof Error
|
|
3531
3588
|
? err.message
|
|
3532
|
-
: "
|
|
3589
|
+
: t("agentChat.composer.attachmentError");
|
|
3533
3590
|
setComposerError(msg);
|
|
3534
3591
|
reportAgentChatSubmitResult(submitMessageId, false, "attachment-error");
|
|
3535
3592
|
return;
|
|
@@ -3721,6 +3778,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
3721
3778
|
selectedEffort,
|
|
3722
3779
|
selectedEngine,
|
|
3723
3780
|
selectedModel,
|
|
3781
|
+
t,
|
|
3724
3782
|
updateComposerContextItems,
|
|
3725
3783
|
]);
|
|
3726
3784
|
const mcpResumeTimerRef = useRef(null);
|
|
@@ -4040,7 +4098,8 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
4040
4098
|
getApprovalResolution,
|
|
4041
4099
|
onApprovalResolved: recordApprovalResolution,
|
|
4042
4100
|
onApprove: (approvalKey) => {
|
|
4043
|
-
void addToQueue("Approved. Go ahead and run the requested action.",
|
|
4101
|
+
void addToQueue("Approved. Go ahead and run the requested action.", // i18n-ignore -- stable hidden agent instruction, not UI copy.
|
|
4102
|
+
undefined, undefined, undefined, undefined, "queued", undefined, false, false, false, true, // hideUserMessage: this is a protocol continuation, not a new prompt
|
|
4044
4103
|
undefined, [approvalKey]);
|
|
4045
4104
|
},
|
|
4046
4105
|
...(approvalActions?.onDeny ? { onDeny: approvalActions.onDeny } : {}),
|
|
@@ -4070,19 +4129,19 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
4070
4129
|
? "centered"
|
|
4071
4130
|
: compactMissingKeyEmptyState
|
|
4072
4131
|
? "compact-setup"
|
|
4073
|
-
: undefined, className: cn("relative flex flex-1 flex-col h-full min-h-0 text-foreground", className), onDragEnter: handleChatDragEnter, onDragOver: handleChatDragOver, onDragLeave: handleChatDragLeave, onDropCapture: handleChatDropCapture, onDrop: handleChatDrop, children: [dropActive && (_jsx("div", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 z-50 flex items-center justify-center rounded-md border-2 border-dashed border-primary/70 bg-primary/5 backdrop-blur-[1px]", children: _jsx("span", { className: "rounded-md bg-background/90 px-3 py-1.5 text-xs font-medium text-foreground shadow-sm", children: "
|
|
4074
|
-
? "
|
|
4132
|
+
: undefined, className: cn("relative flex flex-1 flex-col h-full min-h-0 text-foreground", className), onDragEnter: handleChatDragEnter, onDragOver: handleChatDragOver, onDragLeave: handleChatDragLeave, onDropCapture: handleChatDropCapture, onDrop: handleChatDrop, children: [dropActive && (_jsx("div", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 z-50 flex items-center justify-center rounded-md border-2 border-dashed border-primary/70 bg-primary/5 backdrop-blur-[1px]", children: _jsx("span", { className: "rounded-md bg-background/90 px-3 py-1.5 text-xs font-medium text-foreground shadow-sm", children: t("agentChat.composer.dropToAttach") }) })), showHeader && (_jsxs("div", { className: "flex h-11 shrink-0 items-center justify-between border-b border-border px-4", children: [_jsx("span", { className: "text-[13px] font-medium text-muted-foreground", children: "Agent" }), _jsx("div", { className: "flex items-center gap-1", children: onSwitchToCli && (_jsx(TooltipProvider, { delayDuration: 200, children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("button", { onClick: onSwitchToCli, "aria-label": t("agentChat.header.switchToCli"), className: "flex items-center gap-1 text-[12px] text-muted-foreground hover:text-foreground px-2 py-1 rounded-md hover:bg-accent", children: [_jsx(IconTerminal, { className: "h-3.5 w-3.5" }), "CLI"] }) }), _jsx(TooltipContent, { children: t("agentChat.header.switchToCli") })] }) })) })] })), _jsxs(MessageScrollerProvider, { autoScroll: true, children: [_jsx(AssistantChatScrollerControls, { resumeFollowingRef: resumeFollowingRef }), _jsxs(MessageScroller, { className: "agent-chat-scroll", children: [_jsx(MessageScrollerViewport, { children: authError ? (_jsxs("div", { className: "flex flex-col items-center justify-center h-full px-4 gap-3", children: [_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-muted", children: authSessionAvailable ? (_jsx(IconRefresh, { className: "h-5 w-5 text-muted-foreground" })) : (_jsx(IconMessage, { className: "h-5 w-5 text-muted-foreground" })) }), _jsxs("div", { className: "text-center max-w-[280px]", children: [_jsx("p", { className: "text-sm font-medium text-foreground mb-1", children: authSessionAvailable
|
|
4133
|
+
? t("agentChat.auth.refreshTitle")
|
|
4075
4134
|
: authError.sessionExpired
|
|
4076
|
-
? "
|
|
4077
|
-
: "
|
|
4078
|
-
? "
|
|
4135
|
+
? t("agentChat.auth.expiredTitle")
|
|
4136
|
+
: t("agentChat.auth.requiredTitle") }), _jsx("p", { className: "text-xs text-muted-foreground leading-relaxed", children: authSessionAvailable
|
|
4137
|
+
? t("agentChat.auth.refreshDescription")
|
|
4079
4138
|
: authError.sessionExpired
|
|
4080
|
-
? "
|
|
4081
|
-
: "
|
|
4139
|
+
? t("agentChat.auth.expiredDescription")
|
|
4140
|
+
: t("agentChat.auth.requiredDescription") })] }), _jsxs("div", { className: "flex gap-2", children: [!authError.sessionExpired &&
|
|
4082
4141
|
!authSessionAvailable && (_jsx("button", { onClick: () => {
|
|
4083
4142
|
window.location.href =
|
|
4084
4143
|
buildSignInReturnHref();
|
|
4085
|
-
}, className: "text-xs text-background bg-foreground hover:opacity-90 px-3 py-1.5 rounded-md", children: "
|
|
4144
|
+
}, className: "text-xs text-background bg-foreground hover:opacity-90 px-3 py-1.5 rounded-md", children: t("agentChat.auth.logIn") })), authError.sessionExpired &&
|
|
4086
4145
|
!authSessionAvailable && (_jsx("button", { onClick: async () => {
|
|
4087
4146
|
try {
|
|
4088
4147
|
await fetch(agentNativePath("/_agent-native/auth/logout"), {
|
|
@@ -4093,16 +4152,18 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
4093
4152
|
console.error("Failed to log out before reloading the chat", error);
|
|
4094
4153
|
}
|
|
4095
4154
|
window.location.reload();
|
|
4096
|
-
}, className: "text-xs text-destructive hover:text-destructive/80 px-3 py-1.5 rounded-md border border-destructive/30 hover:bg-destructive/10", children: "
|
|
4155
|
+
}, className: "text-xs text-destructive hover:text-destructive/80 px-3 py-1.5 rounded-md border border-destructive/30 hover:bg-destructive/10", children: t("agentChat.auth.logOut") })), _jsx("button", { onClick: () => {
|
|
4097
4156
|
setAuthError(null);
|
|
4098
4157
|
window.location.reload();
|
|
4099
4158
|
}, className: authSessionAvailable
|
|
4100
4159
|
? "text-xs text-background bg-foreground hover:opacity-90 px-3 py-1.5 rounded-md"
|
|
4101
|
-
: "text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md border border-border hover:bg-accent", children: "
|
|
4160
|
+
: "text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md border border-border hover:bg-accent", children: t("agentChat.auth.refreshChat") })] })] })) : isRestoring && centeredRestoringState ? (_jsxs("div", { className: cn("agent-empty-state", emptyStateDisplay === "hidden"
|
|
4102
4161
|
? "sr-only"
|
|
4103
|
-
: "flex h-full flex-col items-center justify-center gap-3 px-4 py-16"), "aria-busy": "true", children: [_jsx(IconMessage, { className: "h-5 w-5 text-muted-foreground/60" }), _jsx("p", { className: "sr-only", children: emptyStateText ??
|
|
4162
|
+
: "flex h-full flex-col items-center justify-center gap-3 px-4 py-16"), "aria-busy": "true", children: [_jsx(IconMessage, { className: "h-5 w-5 text-muted-foreground/60" }), _jsx("p", { className: "sr-only", children: emptyStateText ??
|
|
4163
|
+
t("agentChat.empty.loadingChat") })] })) : isRestoring ? (_jsxs("div", { className: "flex flex-col gap-3 p-4", children: [_jsx("div", { className: "flex justify-end", children: _jsx("div", { className: "h-8 w-32 rounded-lg bg-muted animate-pulse" }) }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx("div", { className: "h-4 w-48 rounded bg-muted animate-pulse" }), _jsx("div", { className: "h-4 w-64 rounded bg-muted animate-pulse" }), _jsx("div", { className: "h-4 w-40 rounded bg-muted animate-pulse" })] })] })) : showEmptyState ? (_jsxs("div", { className: cn("agent-empty-state", emptyStateDisplay === "hidden"
|
|
4104
4164
|
? "sr-only"
|
|
4105
|
-
: "flex h-full flex-col items-center justify-center gap-3 px-4 py-16"), children: [_jsx(IconMessage, { className: "h-5 w-5 text-muted-foreground/60" }), _jsx("p", { className: "sr-only", children: emptyStateText ??
|
|
4165
|
+
: "flex h-full flex-col items-center justify-center gap-3 px-4 py-16"), children: [_jsx(IconMessage, { className: "h-5 w-5 text-muted-foreground/60" }), _jsx("p", { className: "sr-only", children: emptyStateText ??
|
|
4166
|
+
t("agentChat.empty.prompt") }), emptyStateAddon, resolvedSuggestions &&
|
|
4106
4167
|
resolvedSuggestions.length > 0 ? (_jsx("div", { className: "flex w-full max-w-[280px] flex-col gap-1", children: resolvedSuggestions.map((suggestion) => (_jsx("button", { onClick: () => {
|
|
4107
4168
|
if (engineSetupRequired) {
|
|
4108
4169
|
requestMissingKeySetup();
|
|
@@ -4132,10 +4193,12 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
4132
4193
|
visibleReconnectContent.length > 0 && (_jsx(MessageScrollerItem, { children: _jsx(ReconnectStreamMessage, { content: visibleReconnectContent, allowActivitySpinner: !reconnectFrozen }) })), showReconnectOverlay &&
|
|
4133
4194
|
visibleReconnectContent.length === 0 &&
|
|
4134
4195
|
reconnectContent.length === 0 &&
|
|
4135
|
-
reconnectActivityContent.length > 0 && (_jsx(MessageScrollerItem, { children: _jsx(ReconnectStreamMessage, { content: reconnectActivityContent, allowActivitySpinner: !reconnectFrozen }) })), showGlobalRunningStatus && (_jsx(MessageScrollerItem, { children: _jsx(RunningActivityStatus, { label: runningStatusLabel }) })), visibleQueuedMessages.length > 0 && (_jsx(MessageScrollerItem, { children: _jsxs("div", { className: "flex items-center justify-end gap-1.5 pr-0.5 text-xs text-muted-foreground", children: [_jsx(IconClock, { className: "h-3 w-3" }),
|
|
4196
|
+
reconnectActivityContent.length > 0 && (_jsx(MessageScrollerItem, { children: _jsx(ReconnectStreamMessage, { content: reconnectActivityContent, allowActivitySpinner: !reconnectFrozen }) })), showGlobalRunningStatus && (_jsx(MessageScrollerItem, { children: _jsx(RunningActivityStatus, { label: runningStatusLabel }) })), visibleQueuedMessages.length > 0 && (_jsx(MessageScrollerItem, { children: _jsxs("div", { className: "flex items-center justify-end gap-1.5 pr-0.5 text-xs text-muted-foreground", children: [_jsx(IconClock, { className: "h-3 w-3" }), _jsx("span", { children: t("agentChat.queue.count", {
|
|
4197
|
+
count: visibleQueuedMessages.length,
|
|
4198
|
+
}) })] }) })), visibleQueuedMessages.map((msg) => {
|
|
4136
4199
|
const displayText = displayableUserMessageText(msg.text);
|
|
4137
4200
|
const imageSources = queuedMessageImageSources(msg);
|
|
4138
|
-
return (_jsx(MessageScrollerItem, { messageId: msg.id, children: _jsxs("div", { className: "group flex items-start justify-end gap-1.5", children: [isRunning && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", onClick: () => sendQueuedMessageNow(msg.id), "aria-label": "
|
|
4201
|
+
return (_jsx(MessageScrollerItem, { messageId: msg.id, children: _jsxs("div", { className: "group flex items-start justify-end gap-1.5", children: [isRunning && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", onClick: () => sendQueuedMessageNow(msg.id), "aria-label": t("agentChat.queue.sendNow"), className: "mt-1.5 flex h-5 w-5 cursor-pointer items-center justify-center rounded-full border border-border bg-background text-muted-foreground opacity-0 shadow-sm transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100", children: _jsx(IconArrowUp, { className: "h-3 w-3" }) }) }), _jsx(TooltipContent, { children: t("agentChat.queue.sendNowHint") })] })), _jsx("button", { type: "button", onClick: () => applyLocalQueuedMessages((prev) => prev.filter((m) => m.id !== msg.id)), "aria-label": t("agentChat.queue.remove"), className: "mt-1.5 flex h-5 w-5 cursor-pointer items-center justify-center rounded-full border border-border bg-background text-muted-foreground opacity-0 shadow-sm transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100", children: _jsx(IconX, { className: "h-3 w-3" }) }), _jsxs("div", { className: "max-w-[85%] rounded-lg bg-accent/50 px-3 py-2 text-sm leading-relaxed text-foreground/60 whitespace-pre-wrap break-words", children: [displayText, imageSources.length > 0 && (_jsx("div", { className: "flex flex-wrap gap-1.5 mt-1.5", children: imageSources.map((img, j) => (_jsx("img", { src: img, alt: "", className: "h-12 w-12 rounded object-cover border border-border/50" }, j))) }))] })] }) }, msg.id));
|
|
4139
4202
|
}), resolvedThreadFooterSlot ? (_jsx(MessageScrollerItem, { children: _jsx("div", { className: "agent-thread-footer-slot", children: resolvedThreadFooterSlot }) })) : null] })) }), !authError && !isRestoring && !showEmptyState ? (_jsx(MessageScrollerButton, {})) : null] })] }, chatScrollResetKey), showComposerSlot ? composerSlot : null, isActiveComposer && (_jsx(McpConnectionSuggestion, { text: composerText })), showCenteredEmptyThreadFooterSlot ? (_jsx("div", { className: "agent-thread-footer-slot agent-thread-footer-slot--centered-empty", children: resolvedThreadFooterSlot })) : null, guidedQuestions && guidedQuestions.length > 0 && (_jsx("div", { className: "shrink-0 px-3 pb-2", children: _jsx(GuidedQuestionFlow, { questions: guidedQuestions, onSubmit: handleGuidedQuestionsSubmit, onSkip: handleGuidedQuestionsSkip, ...(guidedQuestionsTitle
|
|
4140
4203
|
? { title: guidedQuestionsTitle }
|
|
4141
4204
|
: {}), ...(guidedQuestionsDescription
|
|
@@ -4144,7 +4207,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
4144
4207
|
? { skipLabel: guidedQuestionsSkipLabel }
|
|
4145
4208
|
: {}), ...(guidedQuestionsSubmitLabel
|
|
4146
4209
|
? { submitLabel: guidedQuestionsSubmitLabel }
|
|
4147
|
-
: {}), className: "h-auto items-stretch justify-stretch bg-transparent" }) })), composerError && (_jsxs("div", { role: "alert", className: "shrink-0 mx-3 mb-1.5 flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: [_jsx(IconAlertTriangle, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), _jsx("span", { className: "flex-1 leading-snug", children: composerError }), _jsx("button", { type: "button", "aria-label": "
|
|
4210
|
+
: {}), className: "h-auto items-stretch justify-stretch bg-transparent" }) })), composerError && (_jsxs("div", { role: "alert", className: "shrink-0 mx-3 mb-1.5 flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: [_jsx(IconAlertTriangle, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), _jsx("span", { className: "flex-1 leading-snug", children: composerError }), _jsx("button", { type: "button", "aria-label": t("agentChat.common.dismissError"), onClick: () => setComposerError(null), className: "shrink-0 opacity-70 hover:opacity-100", children: _jsx(IconX, { className: "h-3 w-3" }) })] })), _jsxs("div", { className: "agent-composer-stack", "data-agent-composer-adjacent-ui": hasComposerAccessoryAboveStack
|
|
4148
4211
|
? "true"
|
|
4149
4212
|
: undefined, children: [_jsx(SelectionAttachedPill, {}), showPlanModeCallout && (_jsx(PlanModeCallout, { canImplementPlan: canImplementPlan, onImplementPlan: handleImplementPlan, onSwitchToAct: handleSwitchToAct })), showInlineMissingKeySetup ? (_jsx(BuilderSetupCard, { fullWidth: true, layout: "sidebar", onConnected: handleBuilderConnected })) : null, _jsxs(Popover, { open: showMissingKeySetup &&
|
|
4150
4213
|
!showInlineMissingKeySetup &&
|
|
@@ -4152,24 +4215,26 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
4152
4215
|
!showMissingKeySetup &&
|
|
4153
4216
|
"opacity-70"), rootClassName: cn(showMissingKeySetup &&
|
|
4154
4217
|
"agent-composer-root--missing-key"), children: showMissingKeySetup &&
|
|
4155
|
-
!showInlineMissingKeySetup ? (_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "agent-composer-missing-key-trigger", "aria-label": "
|
|
4218
|
+
!showInlineMissingKeySetup ? (_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "agent-composer-missing-key-trigger", "aria-label": t("agentChat.setup.connectToStart"), children: _jsxs("span", { className: "agent-composer-missing-key-content", children: [_jsxs("span", { className: "agent-composer-missing-key-copy", children: [_jsx("span", { className: "agent-composer-missing-key-title", children: missingApiKeySetupLayout ===
|
|
4156
4219
|
"sidebar"
|
|
4157
|
-
? "
|
|
4158
|
-
: "
|
|
4159
|
-
"sidebar" ? (_jsx("span", { className: "agent-composer-missing-key-description", children: "
|
|
4220
|
+
? t("agentChat.setup.connectToChat")
|
|
4221
|
+
: t("agentChat.setup.connectToStart") }), missingApiKeySetupLayout !==
|
|
4222
|
+
"sidebar" ? (_jsx("span", { className: "agent-composer-missing-key-description", children: t("agentChat.setup.builderCredits") })) : null] }), _jsx("span", { className: "agent-composer-missing-key-cta", children: t("agentChat.setup.connectAi") })] }) }) })) : (_jsxs(_Fragment, { children: [_jsx(ComposerAttachmentPreviewStrip, {}), _jsx(TiptapComposer, { focusRef: tiptapRef, onTextChange: isActiveComposer
|
|
4160
4223
|
? handleComposerTextChange
|
|
4161
4224
|
: undefined, disabled: isComposerDisabled ||
|
|
4162
4225
|
showInlineMissingKeySetup, placeholder: showInlineMissingKeySetup
|
|
4163
|
-
? "
|
|
4226
|
+
? t("agentChat.setup.connectPlaceholder")
|
|
4164
4227
|
: engineSetupRequired
|
|
4165
|
-
? "
|
|
4228
|
+
? t("agentChat.setup.connectPlaceholder")
|
|
4166
4229
|
: composerDisabled
|
|
4167
4230
|
? (composerDisabledPlaceholder ??
|
|
4168
|
-
"
|
|
4231
|
+
t("agentChat.composer.openDesktop"))
|
|
4169
4232
|
: isRunning
|
|
4170
4233
|
? queuedMessages.length > 0
|
|
4171
|
-
?
|
|
4172
|
-
|
|
4234
|
+
? t("agentChat.queue.followUpWithCount", {
|
|
4235
|
+
count: queuedMessages.length,
|
|
4236
|
+
})
|
|
4237
|
+
: t("agentChat.queue.followUp")
|
|
4173
4238
|
: resolveAssistantChatComposerPlaceholder(composerPlaceholder), onSubmit: isRunning ||
|
|
4174
4239
|
composerContextItems.length > 0
|
|
4175
4240
|
? (text, references, attachments, options) => void addToQueue(text, undefined, references.length > 0
|
|
@@ -4178,9 +4243,11 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
4178
4243
|
isRunning,
|
|
4179
4244
|
requestedIntent: options?.intent,
|
|
4180
4245
|
}), undefined, true)
|
|
4181
|
-
: undefined, willQueue: engineSetupRequired || isRunning, onSlashCommand: onSlashCommand, execMode: execMode, onExecModeChange: onExecModeChange, planModeDisabled: planModeDisabled, planModeDisabledReason: planModeDisabledReason, selectedModel: selectedModel ?? defaultModel, selectedEffort: selectedEffort, availableModels: availableModels, modelListLoading: modelListLoading, onModelChange:
|
|
4246
|
+
: undefined, willQueue: engineSetupRequired || isRunning, onSlashCommand: onSlashCommand, execMode: execMode, onExecModeChange: onExecModeChange, planModeDisabled: planModeDisabled, planModeDisabledReason: planModeDisabledReason, selectedModel: selectedModel ?? defaultModel, selectedEffort: selectedEffort, availableModels: availableModels, modelListLoading: modelListLoading, onModelChange: shouldShowAssistantChatModelSelector(showModelSelector)
|
|
4247
|
+
? onModelChange
|
|
4248
|
+
: undefined, onEffortChange: onEffortChange, imageModelMenu: imageModelMenu, onConnectProvider: onConnectProvider, onConnectLocalRuntime: onConnectLocalRuntime, toolbarSlot: composerToolbarSlot, contextItems: composerContextItems, onRemoveContextItem: removeComposerContextItem, plusMenuMode: plusMenuMode, layoutVariant: composerLayoutVariant, providerConnectStatusEnabled: providerStatusChecksEnabled, voiceEnabled: true, draftScope: threadId || tabId, interceptBuildRequestsForBuilder: true, onAttachmentError: setComposerError, extraActionButton: composerExtraActionButton, stopButton: showRunningInUI ? (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", onClick: () => stopActiveRun({
|
|
4182
4249
|
preserveQueuedMessages: true,
|
|
4183
|
-
}), "aria-label": "
|
|
4250
|
+
}), "aria-label": t("agentChat.composer.stopResponse"), "data-agent-composer-slot": "stop-button", className: "shrink-0 flex h-7 w-7 cursor-pointer items-center justify-center rounded-full bg-primary text-primary-foreground shadow-sm transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", children: _jsx(IconPlayerStopFilled, { className: "h-3 w-3" }) }) }), _jsx(TooltipContent, { children: t("agentChat.composer.stopResponse") })] })) : undefined })] })) }), showMissingKeySetup &&
|
|
4184
4251
|
!showInlineMissingKeySetup ? (_jsx(PopoverContent, { side: missingApiKeySetupLayout === "sidebar"
|
|
4185
4252
|
? "top"
|
|
4186
4253
|
: "bottom", align: "center", sideOffset: 8, collisionPadding: 12, "data-agent-native-composer-popover": "true", className: "z-[260] box-border w-[min(calc(100vw-2rem),var(--radix-popover-content-available-width,26rem),26rem)] rounded-lg border-border p-3 shadow-lg", children: _jsx(BuilderSetupContent, { onConnected: handleBuilderConnected, layout: missingApiKeySetupLayout }) })) : null] })] })] }) }) }) }) }) }) }) }) }) }) }));
|