@agent-native/toolkit 0.198.3 → 0.198.5
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/dist/app/agentkit/react/components.d.ts +8 -3
- package/dist/app/agentkit/react/components.d.ts.map +1 -1
- package/dist/app/agentkit/react/components.js +24 -10
- package/dist/app/agentkit/react/components.js.map +1 -1
- package/dist/app/chat/AgentKitAssistantChat.d.ts.map +1 -1
- package/dist/app/chat/AgentKitAssistantChat.js +65 -33
- package/dist/app/chat/AgentKitAssistantChat.js.map +1 -1
- package/dist/app/chat/AgentSidebar.d.ts.map +1 -1
- package/dist/app/chat/AgentSidebar.js +2 -0
- package/dist/app/chat/AgentSidebar.js.map +1 -1
- package/dist/app/chat/FileStorageSetupPopover.js +2 -2
- package/dist/app/chat/FileStorageSetupPopover.js.map +1 -1
- package/dist/app/chat/MultiTabAssistantChat.js +1 -1
- package/dist/app/chat/agentkit-chat/connections.d.ts +1 -4
- package/dist/app/chat/agentkit-chat/connections.d.ts.map +1 -1
- package/dist/app/chat/agentkit-chat/connections.js +1 -26
- package/dist/app/chat/agentkit-chat/connections.js.map +1 -1
- package/dist/app/chat/agentkit-chat/history.d.ts +4 -1
- package/dist/app/chat/agentkit-chat/history.d.ts.map +1 -1
- package/dist/app/chat/agentkit-chat/history.js +17 -5
- package/dist/app/chat/agentkit-chat/history.js.map +1 -1
- package/dist/app/chat/chat/history-types.d.ts +1 -1
- package/dist/app/chat/chat/history-types.d.ts.map +1 -1
- package/dist/app/chat/chat-first/copy.d.ts +1 -2
- package/dist/app/chat/chat-first/copy.d.ts.map +1 -1
- package/dist/app/chat/chat-first/copy.js +1 -121
- package/dist/app/chat/chat-first/copy.js.map +1 -1
- package/dist/app/chat/chat-first-copy.d.ts +3 -0
- package/dist/app/chat/chat-first-copy.d.ts.map +1 -0
- package/dist/app/chat/chat-first-copy.js +122 -0
- package/dist/app/chat/chat-first-copy.js.map +1 -0
- package/dist/app/feature-flags/FeatureFlagsPanel.d.ts.map +1 -1
- package/dist/app/feature-flags/FeatureFlagsPanel.js +1 -0
- package/dist/app/feature-flags/FeatureFlagsPanel.js.map +1 -1
- package/dist/app/i18n/catalogs/ar-SA.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/ar-SA.js +2 -1
- package/dist/app/i18n/catalogs/ar-SA.js.map +1 -1
- package/dist/app/i18n/catalogs/de-DE.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/de-DE.js +2 -1
- package/dist/app/i18n/catalogs/de-DE.js.map +1 -1
- package/dist/app/i18n/catalogs/en-US.d.ts +2 -1
- package/dist/app/i18n/catalogs/en-US.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/en-US.js +2 -1
- package/dist/app/i18n/catalogs/en-US.js.map +1 -1
- package/dist/app/i18n/catalogs/es-ES.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/es-ES.js +2 -1
- package/dist/app/i18n/catalogs/es-ES.js.map +1 -1
- package/dist/app/i18n/catalogs/fr-FR.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/fr-FR.js +2 -1
- package/dist/app/i18n/catalogs/fr-FR.js.map +1 -1
- package/dist/app/i18n/catalogs/hi-IN.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/hi-IN.js +2 -1
- package/dist/app/i18n/catalogs/hi-IN.js.map +1 -1
- package/dist/app/i18n/catalogs/ja-JP.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/ja-JP.js +2 -1
- package/dist/app/i18n/catalogs/ja-JP.js.map +1 -1
- package/dist/app/i18n/catalogs/ko-KR.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/ko-KR.js +2 -1
- package/dist/app/i18n/catalogs/ko-KR.js.map +1 -1
- package/dist/app/i18n/catalogs/pt-BR.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/pt-BR.js +2 -1
- package/dist/app/i18n/catalogs/pt-BR.js.map +1 -1
- package/dist/app/i18n/catalogs/zh-CN.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/zh-CN.js +2 -1
- package/dist/app/i18n/catalogs/zh-CN.js.map +1 -1
- package/dist/app/i18n/catalogs/zh-TW.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/zh-TW.js +2 -1
- package/dist/app/i18n/catalogs/zh-TW.js.map +1 -1
- package/dist/app/labs/LabsSettings.d.ts.map +1 -1
- package/dist/app/labs/LabsSettings.js +7 -3
- package/dist/app/labs/LabsSettings.js.map +1 -1
- package/dist/app/org/OrgGeneralSection.d.ts.map +1 -1
- package/dist/app/org/OrgGeneralSection.js +21 -18
- package/dist/app/org/OrgGeneralSection.js.map +1 -1
- package/dist/app/org/OrgSwitcher.d.ts.map +1 -1
- package/dist/app/org/OrgSwitcher.js +3 -2
- package/dist/app/org/OrgSwitcher.js.map +1 -1
- package/dist/app/org/workspace-app-links.d.ts +1 -0
- package/dist/app/org/workspace-app-links.d.ts.map +1 -1
- package/dist/app/org/workspace-app-links.js +3 -0
- package/dist/app/org/workspace-app-links.js.map +1 -1
- package/dist/app/resources/McpAgentKitConnectionRequest.d.ts +7 -2
- package/dist/app/resources/McpAgentKitConnectionRequest.d.ts.map +1 -1
- package/dist/app/resources/McpAgentKitConnectionRequest.js +132 -13
- package/dist/app/resources/McpAgentKitConnectionRequest.js.map +1 -1
- package/dist/composer/PromptComposer.d.ts +3 -0
- package/dist/composer/PromptComposer.d.ts.map +1 -1
- package/dist/composer/PromptComposer.js +2 -2
- package/dist/composer/PromptComposer.js.map +1 -1
- package/dist/composer/TiptapComposer.d.ts +4 -1
- package/dist/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/composer/TiptapComposer.js +8 -4
- package/dist/composer/TiptapComposer.js.map +1 -1
- package/dist/icons/ResourceIconPicker.d.ts +6 -1
- package/dist/icons/ResourceIconPicker.d.ts.map +1 -1
- package/dist/icons/ResourceIconPicker.js +45 -6
- package/dist/icons/ResourceIconPicker.js.map +1 -1
- package/package.json +6 -4
- package/src/app/agentkit/react/components.interaction.spec.tsx +93 -0
- package/src/app/agentkit/react/components.spec.tsx +4 -5
- package/src/app/agentkit/react/components.tsx +51 -8
- package/src/app/agentkit/react/composer-context.spec.tsx +7 -0
- package/src/app/agentkit/react/lifecycle.spec.tsx +42 -0
- package/src/app/chat/AgentKitAssistantChat.spec.tsx +151 -11
- package/src/app/chat/AgentKitAssistantChat.tsx +110 -28
- package/src/app/chat/AgentPanel.header.spec.ts +59 -22
- package/src/app/chat/AgentSidebar.tsx +2 -0
- package/src/app/chat/FileStorageSetupPopover.tsx +2 -2
- package/src/app/chat/MultiTabAssistantChat.messageCount.spec.tsx +3 -1
- package/src/app/chat/MultiTabAssistantChat.spec.tsx +8 -4
- package/src/app/chat/MultiTabAssistantChat.tsx +1 -1
- package/src/app/chat/agentkit-chat/action-widget.spec.tsx +5 -17
- package/src/app/chat/agentkit-chat/connections.spec.tsx +137 -0
- package/src/app/chat/agentkit-chat/connections.ts +2 -37
- package/src/app/chat/agentkit-chat/history.tsx +23 -8
- package/src/app/chat/chat/history-types.ts +1 -1
- package/src/app/chat/chat/tool-call-display.spec.tsx +2 -2
- package/src/app/chat/chat/widgets/record-change-widget.spec.tsx +20 -29
- package/src/app/chat/chat-first/copy.ts +1 -133
- package/src/app/chat/chat-first-copy.ts +133 -0
- package/src/app/chat/composer/use-agentkit-capabilities.hardening.spec.tsx +3 -2
- package/src/app/feature-flags/FeatureFlagsPanel.tsx +1 -0
- package/src/app/i18n/catalogs/ar-SA.ts +2 -1
- package/src/app/i18n/catalogs/de-DE.ts +3 -1
- package/src/app/i18n/catalogs/en-US.ts +2 -1
- package/src/app/i18n/catalogs/es-ES.ts +2 -1
- package/src/app/i18n/catalogs/fr-FR.ts +3 -1
- package/src/app/i18n/catalogs/hi-IN.ts +2 -1
- package/src/app/i18n/catalogs/ja-JP.ts +2 -1
- package/src/app/i18n/catalogs/ko-KR.ts +2 -1
- package/src/app/i18n/catalogs/pt-BR.ts +3 -1
- package/src/app/i18n/catalogs/zh-CN.ts +2 -1
- package/src/app/i18n/catalogs/zh-TW.ts +2 -1
- package/src/app/integrations/IntegrationDetailPage.spec.tsx +1 -1
- package/src/app/labs/LabsSettings.tsx +46 -10
- package/src/app/observability/ThumbsFeedback.spec.tsx +15 -0
- package/src/app/onboarding/FirstRunOnboarding.spec.tsx +4 -0
- package/src/app/org/OrgGeneralSection.tsx +32 -22
- package/src/app/org/OrgSwitcher.tsx +3 -2
- package/src/app/org/workspace-app-links.spec.ts +4 -0
- package/src/app/org/workspace-app-links.ts +8 -1
- package/src/app/resources/McpAgentKitConnectionRequest.spec.tsx +371 -2
- package/src/app/resources/McpAgentKitConnectionRequest.tsx +171 -11
- package/src/app/settings/SettingsTabsPage.spec.tsx +4 -2
- package/src/app/settings/shell/SettingsShell.spec.tsx +14 -8
- package/src/app/settings/shell/pages/app-group-pages.spec.tsx +35 -5
- package/src/app/settings/shell/pages/resource-pages.spec.tsx +3 -0
- package/src/app/settings/usage/UsagePage.spec.tsx +3 -3
- package/src/app/shared/lazy-chunk-error-boundary.spec.tsx +2 -0
- package/src/app-shell/sidebar-overflow.spec.tsx +4 -1
- package/src/composer/PromptComposer.tsx +7 -0
- package/src/composer/TiptapComposer.spec.ts +26 -4
- package/src/composer/TiptapComposer.tsx +12 -3
- package/src/design-tweaks/visual-style-controls.spec.tsx +38 -0
- package/src/editor/useCollabReconcile.concurrent.spec.ts +2 -1
- package/src/icons/ResourceIconPicker.spec.tsx +270 -0
- package/src/icons/ResourceIconPicker.tsx +72 -4
|
@@ -187,6 +187,11 @@ function isRetryableDeferredProviderSubmissionError(error) {
|
|
|
187
187
|
}
|
|
188
188
|
return error instanceof TypeError || record?.name === "AbortError";
|
|
189
189
|
}
|
|
190
|
+
function preserveQueuedIntent(preparedOptions, originalOptions) {
|
|
191
|
+
return originalOptions.intent === "queued"
|
|
192
|
+
? { ...preparedOptions, intent: "queued" }
|
|
193
|
+
: preparedOptions;
|
|
194
|
+
}
|
|
190
195
|
function captureQueuedRunState(options, runWasActive) {
|
|
191
196
|
return {
|
|
192
197
|
...options,
|
|
@@ -239,7 +244,9 @@ export const AgentKitAssistantChat = forwardRef(function AgentKitAssistantChat(p
|
|
|
239
244
|
const handoffSnapshot = props.createTransport || props.runtime
|
|
240
245
|
? null
|
|
241
246
|
: readAgentKitThreadHandoffSnapshot(createAgentKitThreadHandoffKey(props, threadId));
|
|
242
|
-
const [
|
|
247
|
+
const [manualLoadThreadId, setManualLoadThreadId] = useState(() => (props.isNewThread ? threadId : null));
|
|
248
|
+
const hasManualLoadForCurrentThread = props.isNewThread || manualLoadThreadId === threadId;
|
|
249
|
+
const [threadRestore, setThreadRestore] = useState(() => props.isThreadStateLoading || !hasManualLoadForCurrentThread
|
|
243
250
|
? { status: "loading" }
|
|
244
251
|
: { status: "ready" });
|
|
245
252
|
const [restoreRetryLoadPhase, setRestoreRetryLoadPhase] = useState("idle");
|
|
@@ -251,12 +258,20 @@ export const AgentKitAssistantChat = forwardRef(function AgentKitAssistantChat(p
|
|
|
251
258
|
setRestoreRetryThreadId(null);
|
|
252
259
|
}, []);
|
|
253
260
|
useEffect(() => {
|
|
254
|
-
|
|
261
|
+
setManualLoadThreadId((current) => props.isNewThread ? threadId : current === threadId ? current : null);
|
|
262
|
+
}, [props.isNewThread, threadId]);
|
|
263
|
+
useEffect(() => {
|
|
264
|
+
setThreadRestore(props.isThreadStateLoading || !hasManualLoadForCurrentThread
|
|
255
265
|
? { status: "loading" }
|
|
256
266
|
: { status: "ready" });
|
|
257
267
|
setRestoreRetryLoadPhase("idle");
|
|
258
268
|
setRestoreRetryThreadId(null);
|
|
259
|
-
}, [
|
|
269
|
+
}, [
|
|
270
|
+
hasManualLoadForCurrentThread,
|
|
271
|
+
props.isNewThread,
|
|
272
|
+
props.isThreadStateLoading,
|
|
273
|
+
threadId,
|
|
274
|
+
]);
|
|
260
275
|
const onThreadRestoreLoadError = useCallback((error) => {
|
|
261
276
|
const record = asRecord(error);
|
|
262
277
|
const response = asRecord(record?.response);
|
|
@@ -594,7 +609,7 @@ export const AgentKitAssistantChat = forwardRef(function AgentKitAssistantChat(p
|
|
|
594
609
|
props.createTransport ? threadId : undefined,
|
|
595
610
|
]);
|
|
596
611
|
const agentKitLoad = props.isThreadStateLoading ||
|
|
597
|
-
|
|
612
|
+
hasManualLoadForCurrentThread ||
|
|
598
613
|
(restoreRetryThreadId === threadId && restoreRetryLoadPhase === "release")
|
|
599
614
|
? "manual"
|
|
600
615
|
: "auto";
|
|
@@ -644,6 +659,7 @@ const AgentKitAssistantChatBody = forwardRef(function AgentKitAssistantChatBody(
|
|
|
644
659
|
}, [fileUploadStatus.refetch]);
|
|
645
660
|
const isRestoring = history?.isRestoring === true || props.threadRestore.status === "loading";
|
|
646
661
|
const isSubmissionInFlight = history?.isSubmissionInFlight === true;
|
|
662
|
+
const [composerSubmissionPending, setComposerSubmissionPending] = useState(false);
|
|
647
663
|
const [authError, setAuthError] = useState(null);
|
|
648
664
|
const [authSessionAvailable, setAuthSessionAvailable] = useState(false);
|
|
649
665
|
const [composerText, setComposerText] = useState(() => readAssistantChatComposerDraft(props.tabId ?? threadId) ?? "");
|
|
@@ -753,6 +769,10 @@ const AgentKitAssistantChatBody = forwardRef(function AgentKitAssistantChatBody(
|
|
|
753
769
|
.reverse()
|
|
754
770
|
.find((message) => message.role === "assistant"), [thread.messages]);
|
|
755
771
|
const isRunning = hasActiveAgentRuns(thread);
|
|
772
|
+
const lastMessage = thread.messages.at(-1);
|
|
773
|
+
const isThinkingVisibleInTranscript = (isRunning || isSubmissionInFlight) &&
|
|
774
|
+
lastMessage?.role === "user" &&
|
|
775
|
+
lastMessage.metadata?.hideUserMessage !== true;
|
|
756
776
|
const isThreadRunning = useCallback(() => hasActiveAgentRuns(controller.getThread(threadId)), [controller, threadId]);
|
|
757
777
|
useEffect(() => {
|
|
758
778
|
if (previousPrefillRevisionRef.current === prefillRevision)
|
|
@@ -1490,7 +1510,7 @@ const AgentKitAssistantChatBody = forwardRef(function AgentKitAssistantChatBody(
|
|
|
1490
1510
|
!props.composerSubmissionDisabled) {
|
|
1491
1511
|
try {
|
|
1492
1512
|
const preparedOptions = prepare ? await prepare() : composerOptions;
|
|
1493
|
-
const submittedOptions = captureQueuedRunState(preparedOptions, runWasActiveAtSubmit);
|
|
1513
|
+
const submittedOptions = captureQueuedRunState(preserveQueuedIntent(preparedOptions, composerOptions), runWasActiveAtSubmit);
|
|
1494
1514
|
const result = await submit(text, files, references, submittedOptions);
|
|
1495
1515
|
if (result.status === "rejected") {
|
|
1496
1516
|
throw new Error(t("agentChat.recovery.deferredSubmissionFailed"));
|
|
@@ -1508,7 +1528,7 @@ const AgentKitAssistantChatBody = forwardRef(function AgentKitAssistantChatBody(
|
|
|
1508
1528
|
}
|
|
1509
1529
|
try {
|
|
1510
1530
|
const preparedOptions = prepare ? await prepare() : composerOptions;
|
|
1511
|
-
await dispatch(text, files, references, captureQueuedRunState(preparedOptions, runWasActiveAtSubmit));
|
|
1531
|
+
await dispatch(text, files, references, captureQueuedRunState(preserveQueuedIntent(preparedOptions, composerOptions), runWasActiveAtSubmit));
|
|
1512
1532
|
}
|
|
1513
1533
|
catch (error) {
|
|
1514
1534
|
dispatchSetupRequiredEvent(error, props.tabId, threadId);
|
|
@@ -1733,21 +1753,31 @@ const AgentKitAssistantChatBody = forwardRef(function AgentKitAssistantChatBody(
|
|
|
1733
1753
|
],
|
|
1734
1754
|
});
|
|
1735
1755
|
}, [isThreadRunning, submit]);
|
|
1736
|
-
const resumeIntegrationPrompt = useCallback((message) => {
|
|
1737
|
-
if (props.isActiveComposer === false)
|
|
1738
|
-
|
|
1739
|
-
|
|
1756
|
+
const resumeIntegrationPrompt = useCallback(async (message) => {
|
|
1757
|
+
if (props.isActiveComposer === false) {
|
|
1758
|
+
throw new Error("Cannot resume a request in an inactive chat.");
|
|
1759
|
+
}
|
|
1760
|
+
try {
|
|
1761
|
+
const result = await send(message);
|
|
1762
|
+
if (result.status === "rejected") {
|
|
1763
|
+
throw new Error(`Chat resume was rejected: ${result.reason}.`);
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
catch (error) {
|
|
1740
1767
|
dispatchSetupRequiredEvent(error, props.tabId, threadId);
|
|
1741
|
-
|
|
1768
|
+
throw error;
|
|
1769
|
+
}
|
|
1742
1770
|
}, [props.isActiveComposer, props.tabId, send, threadId]);
|
|
1743
1771
|
const submitSuggestion = useCallback((suggestion) => {
|
|
1772
|
+
if (composerSubmissionPending)
|
|
1773
|
+
return;
|
|
1744
1774
|
const handler = suggestionSubmitRef.current;
|
|
1745
1775
|
if (!handler || handler.threadId !== threadId)
|
|
1746
1776
|
return;
|
|
1747
1777
|
void handler.submit(suggestion).catch((error) => {
|
|
1748
1778
|
dispatchSetupRequiredEvent(error, props.tabId, threadId);
|
|
1749
1779
|
});
|
|
1750
|
-
}, [props.tabId, threadId]);
|
|
1780
|
+
}, [composerSubmissionPending, props.tabId, threadId]);
|
|
1751
1781
|
const retryDeferredSubmission = useCallback(async () => {
|
|
1752
1782
|
if (!deferredProviderSubmissionFailureId)
|
|
1753
1783
|
return;
|
|
@@ -1880,6 +1910,9 @@ const AgentKitAssistantChatBody = forwardRef(function AgentKitAssistantChatBody(
|
|
|
1880
1910
|
setupBouncePulse,
|
|
1881
1911
|
bounceSetupCard,
|
|
1882
1912
|
isSubmissionInFlight,
|
|
1913
|
+
composerSubmissionPending,
|
|
1914
|
+
onComposerSubmissionPendingChange: setComposerSubmissionPending,
|
|
1915
|
+
isThinkingVisibleInTranscript,
|
|
1883
1916
|
contextItems,
|
|
1884
1917
|
voiceTranscriptMessages,
|
|
1885
1918
|
selectionLength,
|
|
@@ -1899,16 +1932,15 @@ const AgentKitAssistantChatBody = forwardRef(function AgentKitAssistantChatBody(
|
|
|
1899
1932
|
onImplementPlan: implementPlan,
|
|
1900
1933
|
};
|
|
1901
1934
|
return (_jsxs(AgentKitSurfaceContext.Provider, { value: surfaceContext, children: [props.isActiveComposer === false ? null : (_jsx(McpAgentKitConnectionResume, { onResume: ({ threadId: targetThreadId, runId, requestId }, request) => {
|
|
1902
|
-
if (targetThreadId !== threadId)
|
|
1903
|
-
|
|
1935
|
+
if (targetThreadId !== threadId) {
|
|
1936
|
+
throw new Error("Cannot resume a connection request in another chat.");
|
|
1937
|
+
}
|
|
1904
1938
|
return control.resolveConnectionRequest(runId, requestId, {
|
|
1905
1939
|
status: "connected",
|
|
1906
1940
|
message: request.message,
|
|
1907
1941
|
});
|
|
1908
|
-
}, onMessageResume: (request) => {
|
|
1909
|
-
|
|
1910
|
-
} })), _jsx(RunStuckBanner, { threadId: threadId, enabled: props.isActiveComposer !== false, apiUrl: props.apiUrl ?? agentNativePath("/_agent-native/agent-chat"), autoRetry: true, autoRetryOwnerId: props.browserTabId, hasInFlightWork: () => Object.values(thread.tools).some((tool) => tool.status === "running") ||
|
|
1911
|
-
Object.values(thread.activities).some((activity) => activity.status === "running"), isAwaitingResponse: () => isRunning, onRetry: () => void sendRecoveryMessage(RECOVERY_CONTINUE_PROMPT, "continue") }), _jsx(AgentKitChat, { className: props.className, composerProps: { attachmentsEnabled: fileStorageConfigured }, hasRenderedMessages: hasRenderedMessages, emptyComposerPlacement: props.centerComposerWhenEmpty ? "center" : "bottom", title: props.showHeader === false ? undefined : props.emptyStateText, autoScroll: true })] }));
|
|
1942
|
+
}, onMessageResume: (request) => resumeIntegrationPrompt(request.message) })), _jsx(RunStuckBanner, { threadId: threadId, enabled: props.isActiveComposer !== false, apiUrl: props.apiUrl ?? agentNativePath("/_agent-native/agent-chat"), autoRetry: true, autoRetryOwnerId: props.browserTabId, hasInFlightWork: () => Object.values(thread.tools).some((tool) => tool.status === "running") ||
|
|
1943
|
+
Object.values(thread.activities).some((activity) => activity.status === "running"), isAwaitingResponse: () => isRunning, onRetry: () => void sendRecoveryMessage(RECOVERY_CONTINUE_PROMPT, "continue") }), history?.historyLoadFailed ? (_jsxs("div", { role: "alert", className: "mx-3 mb-2 flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2 text-xs", children: [_jsx("span", { className: "text-muted-foreground", children: t("agentChat.message.historyUnavailable") }), _jsx("button", { type: "button", onClick: history.retryHistory, disabled: history.isRetryingHistory, className: "shrink-0 font-medium text-foreground hover:underline disabled:cursor-not-allowed disabled:opacity-50", children: t("agentChat.common.retry") })] })) : null, _jsx(AgentKitChat, { className: props.className, composerProps: { attachmentsEnabled: fileStorageConfigured }, hasRenderedMessages: hasRenderedMessages, emptyComposerPlacement: props.centerComposerWhenEmpty ? "center" : "bottom", title: props.showHeader === false ? undefined : props.emptyStateText, autoScroll: true })] }));
|
|
1912
1944
|
});
|
|
1913
1945
|
function AgentKitComposerSlot({ threadId }) {
|
|
1914
1946
|
const surface = useAgentKitSurface();
|
|
@@ -1952,7 +1984,8 @@ function AgentKitEmptyState({ threadId }) {
|
|
|
1952
1984
|
const prompt = agentSuggestionPrompt(suggestion);
|
|
1953
1985
|
return (_jsx("button", { type: "button", disabled: !surface.canChat ||
|
|
1954
1986
|
surface.props.composerDisabled ||
|
|
1955
|
-
surface.props.composerSubmissionDisabled
|
|
1987
|
+
surface.props.composerSubmissionDisabled ||
|
|
1988
|
+
surface.composerSubmissionPending, onClick: () => surface.submitSuggestion(suggestion), className: "w-full rounded-xl border border-border/70 bg-card/60 px-3 py-2.5 text-left text-[13px] text-muted-foreground shadow-sm transition-colors hover:border-border hover:bg-card hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", children: typeof suggestion === "string"
|
|
1956
1989
|
? suggestion
|
|
1957
1990
|
: suggestion.label || prompt || String(index) }, typeof suggestion === "string"
|
|
1958
1991
|
? suggestion
|
|
@@ -1999,10 +2032,6 @@ function AgentKitTranscript({ children, threadId }) {
|
|
|
1999
2032
|
},
|
|
2000
2033
|
});
|
|
2001
2034
|
const threadMessageIds = new Set(thread.messages.map((message) => message.id));
|
|
2002
|
-
const lastMessage = thread.messages.at(-1);
|
|
2003
|
-
const showThinking = (surface.isRunning || surface.isSubmissionInFlight) &&
|
|
2004
|
-
lastMessage?.role === "user" &&
|
|
2005
|
-
lastMessage.metadata?.hideUserMessage !== true;
|
|
2006
2035
|
const pendingVoiceMessages = surface.voiceTranscriptMessages.filter((message) => !threadMessageIds.has(message.id));
|
|
2007
2036
|
const showHomeSuggestions = surface.props.centerComposerWhenEmpty &&
|
|
2008
2037
|
!surface.hasRenderedMessages &&
|
|
@@ -2015,7 +2044,8 @@ function AgentKitTranscript({ children, threadId }) {
|
|
|
2015
2044
|
surface.suggestions.length > 0 ? (_jsx(AgentKitSuggestedPrompts, { suggestions: surface.suggestions, disabled: !surface.canChat ||
|
|
2016
2045
|
surface.props.composerDisabled ||
|
|
2017
2046
|
surface.props.composerSubmissionDisabled ||
|
|
2018
|
-
surface.isSubmissionInFlight
|
|
2047
|
+
surface.isSubmissionInFlight ||
|
|
2048
|
+
surface.composerSubmissionPending, onSelect: surface.submitSuggestion, className: "agentkit-host-suggestions" })) : null;
|
|
2019
2049
|
if (surface.authError) {
|
|
2020
2050
|
const authTitle = surface.authSessionAvailable
|
|
2021
2051
|
? t("agentChat.auth.refreshTitle")
|
|
@@ -2046,7 +2076,7 @@ function AgentKitTranscript({ children, threadId }) {
|
|
|
2046
2076
|
}
|
|
2047
2077
|
return (_jsxs(_Fragment, { children: [thread.messages.length > 0 || surface.hasRenderedMessages ? (_jsx(AgentKitHistoryBeginningRevert, {})) : null, surface.threadRestore.status === "error" ? (_jsxs("div", { className: "mx-4 mt-3 flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2 text-xs text-muted-foreground", role: "alert", children: [_jsx("span", { children: surface.threadRestore.notFound
|
|
2048
2078
|
? t("agentChat.message.threadNotFound")
|
|
2049
|
-
: t("agentChat.message.restoreRequestFailed") }), _jsx("button", { type: "button", onClick: surface.retryThreadRestore, className: "shrink-0 rounded px-2 py-1 hover:bg-accent hover:text-foreground", children: t("agentChat.common.retry") })] })) : null, renderThreadSlot(surface.props.threadContentSlot, threadId, surface.props.tabId), children, handoffMessages.map((message) => (_jsx(AgentMessageView, { value: message, threadId: threadId }, message.id))), pendingVoiceMessages.map((message) => (_jsx(AgentMessageView, { value: message, threadId: threadId }, message.id))),
|
|
2079
|
+
: t("agentChat.message.restoreRequestFailed") }), _jsx("button", { type: "button", onClick: surface.retryThreadRestore, className: "shrink-0 rounded px-2 py-1 hover:bg-accent hover:text-foreground", children: t("agentChat.common.retry") })] })) : null, renderThreadSlot(surface.props.threadContentSlot, threadId, surface.props.tabId), children, handoffMessages.map((message) => (_jsx(AgentMessageView, { value: message, threadId: threadId }, message.id))), pendingVoiceMessages.map((message) => (_jsx(AgentMessageView, { value: message, threadId: threadId }, message.id))), surface.isThinkingVisibleInTranscript ? (_jsx("div", { role: "status", "aria-live": "polite", className: "px-3 py-2 text-sm text-muted-foreground", children: t("agentChat.status.thinking") })) : null, guided.questions?.length ? (_jsx("div", { className: "px-3 pb-3", children: _jsx(GuidedQuestionFlow, { questions: guided.questions, onSubmit: guided.handleSubmit, onSkip: guided.handleSkip, isSubmitting: guided.isSubmitting, isSubmissionBlocked: !surface.canChat, providerStatus: surface.providerStatus, onRetryProviderStatus: surface.retryProviderStatus, ...(guided.title ? { title: guided.title } : {}), ...(guided.description ? { description: guided.description } : {}), ...(guided.skipLabel ? { skipLabel: guided.skipLabel } : {}), ...(guided.submitLabel ? { submitLabel: guided.submitLabel } : {}), className: "h-auto items-stretch justify-stretch bg-transparent" }) })) : null, suggestionBar, renderThreadSlot(surface.props.threadFooterSlot, threadId, surface.props.tabId)] }));
|
|
2050
2080
|
}
|
|
2051
2081
|
function renderThreadSlot(slot, threadId, tabId) {
|
|
2052
2082
|
return typeof slot === "function"
|
|
@@ -2103,7 +2133,7 @@ class AgentKitComposerContextError extends Error {
|
|
|
2103
2133
|
this.name = "AgentKitComposerContextError";
|
|
2104
2134
|
}
|
|
2105
2135
|
}
|
|
2106
|
-
function AgentKitComposerSurface({ threadId, props, composerContext, canChat, setupMissing, providerStatus, retryProviderStatus, fileStorageConfigured, fileStorageMissing, retryFileStorageStatus, deferredSubmissionFailed, retryDeferredSubmission, dismissDeferredSubmission, isRunning, isRestoring, isSubmissionInFlight, hasRenderedMessages, threadRestore, suggestions, showSuggestions, setupBouncePulse, bounceSetupCard, contextItems, selectionLength, prefillRevision, text, onTextChange, onRemoveContextItem, onClearSelection, onBeforeSubmit, onSubmit, submitSuggestion, suggestionSubmitRef, onImplementPlan, }) {
|
|
2136
|
+
function AgentKitComposerSurface({ threadId, props, composerContext, canChat, setupMissing, providerStatus, retryProviderStatus, fileStorageConfigured, fileStorageMissing, retryFileStorageStatus, deferredSubmissionFailed, retryDeferredSubmission, dismissDeferredSubmission, isRunning, isRestoring, isSubmissionInFlight, composerSubmissionPending, onComposerSubmissionPendingChange, isThinkingVisibleInTranscript, hasRenderedMessages, threadRestore, suggestions, showSuggestions, setupBouncePulse, bounceSetupCard, contextItems, selectionLength, prefillRevision, text, onTextChange, onRemoveContextItem, onClearSelection, onBeforeSubmit, onSubmit, submitSuggestion, suggestionSubmitRef, onImplementPlan, }) {
|
|
2107
2137
|
const t = useT();
|
|
2108
2138
|
const [composerError, setComposerError] = useState(null);
|
|
2109
2139
|
const mounted = useRef(true);
|
|
@@ -2276,18 +2306,19 @@ function AgentKitComposerSurface({ threadId, props, composerContext, canChat, se
|
|
|
2276
2306
|
}) }), props.composerSlot, showHomeIntro ? (_jsx("div", { className: "agentkit-home-intro", children: props.homeIntroSlot })) : null, showHomeSuggestions ? (_jsx(AgentKitSuggestedPrompts, { suggestions: suggestions, disabled: !canChat ||
|
|
2277
2307
|
props.composerDisabled ||
|
|
2278
2308
|
props.composerSubmissionDisabled ||
|
|
2279
|
-
isSubmissionInFlight
|
|
2309
|
+
isSubmissionInFlight ||
|
|
2310
|
+
composerSubmissionPending, onSelect: submitSuggestion, className: "agentkit-home-suggestions" })) : null, showPlanCallout ? (_jsx(PlanModeCallout, { canImplementPlan: latestAssistantWasPlan, onImplementPlan: onImplementPlan, onSwitchToAct: () => props.onExecModeChange?.("build") })) : null, setupMissing && props.showMissingApiKeySetup !== false ? (_jsx(BuilderSetupCard, { fullWidth: true, attached: true, bouncePulse: setupBouncePulse, layout: props.missingApiKeySetupLayout ?? "default", onConnected: () => window.dispatchEvent(new Event("agent-engine:configured-changed")) })) : null, !canChat && !setupMissing && providerStatus !== "configured" ? (_jsx(GuidedQuestionProviderGate, { providerStatus: providerStatus, onRetry: retryProviderStatus })) : null, integration ? (_jsx(McpConnectionSuggestion, { text: text, variant: "composer", requestedByUser: true, integrationId: integration.id })) : null, selectionLength !== null && selectionLength > 0 ? (_jsx(AgentKitSelectionPill, { length: selectionLength, onClear: onClearSelection })) : null, _jsxs("div", { className: "relative", children: [_jsx(AgentKitComposer, { threadId: threadId, disabled: (!canChat && !providerSubmissionPending) ||
|
|
2280
2311
|
props.composerDisabled ||
|
|
2281
|
-
isRestoring ||
|
|
2282
|
-
|
|
2283
|
-
|
|
2312
|
+
isRestoring, submissionDisabled: (!canChat && !providerSubmissionPending) ||
|
|
2313
|
+
props.composerSubmissionDisabled === true ||
|
|
2314
|
+
isSubmissionInFlight, onDisabledClick: props.composerDisabled || !setupMissing
|
|
2284
2315
|
? undefined
|
|
2285
2316
|
: () => {
|
|
2286
2317
|
bounceSetupCard();
|
|
2287
2318
|
window.dispatchEvent(new CustomEvent("agent-chat:missing-api-key", {
|
|
2288
2319
|
detail: { tabId: props.tabId, threadId },
|
|
2289
2320
|
}));
|
|
2290
|
-
}, initialText: text, initialTextKey: `${props.tabId ?? threadId}:${prefillRevision}`, requireAgentEngine: false, onTextChange: onTextChange, onBeforeSubmit: onBeforeSubmit, contextItems: visibleContextItems, contextMenuItems: composerContext?.menuItems, onRemoveContextItem: (key) => {
|
|
2321
|
+
}, initialText: text, initialTextKey: `${props.tabId ?? threadId}:${prefillRevision}`, requireAgentEngine: false, onTextChange: onTextChange, onBeforeSubmit: onBeforeSubmit, announcePendingSubmission: !isThinkingVisibleInTranscript, onSubmissionPendingChange: onComposerSubmissionPendingChange, contextItems: visibleContextItems, contextMenuItems: composerContext?.menuItems, onRemoveContextItem: (key) => {
|
|
2291
2322
|
if (providerContextKeys.has(key))
|
|
2292
2323
|
composerContext?.onRemoveContextItem(key);
|
|
2293
2324
|
else
|
|
@@ -2313,7 +2344,8 @@ function AgentKitComposerSurface({ threadId, props, composerContext, canChat, se
|
|
|
2313
2344
|
}, "aria-label": t("agentChat.composer.stopResponse"), title: t("agentChat.composer.stopResponse"), "data-agent-composer-slot": "stop-button", className: "flex h-7 w-7 items-center justify-center rounded-full bg-primary text-primary-foreground", children: _jsx(IconPlayerStopFilled, { className: "h-3 w-3" }) })) : undefined }), deferredSubmissionFailed ? (_jsxs("div", { role: "alert", className: "mx-3 mb-1.5 flex shrink-0 items-center gap-2 rounded-md border border-border bg-muted/70 px-3 py-2 text-xs text-foreground shadow-sm", children: [_jsx(IconAlertTriangle, { className: "size-3.5 shrink-0 text-muted-foreground" }), _jsx("span", { className: "flex-1 leading-snug", children: t("agentChat.recovery.deferredSubmissionFailed") }), _jsx("button", { type: "button", disabled: !canChat || isSubmissionInFlight, onClick: () => void retryDeferredSubmission().catch(() => undefined), className: "shrink-0 rounded px-2 py-1 font-medium hover:bg-accent disabled:opacity-60", children: t("agentChat.common.retry") }), _jsx("button", { type: "button", "aria-label": t("agentChat.common.dismissError"), onClick: () => void dismissDeferredSubmission().catch(() => undefined), className: "-mr-1 flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: _jsx(IconX, { className: "size-3.5" }) })] })) : null, composerError ? (_jsxs("div", { role: "alert", className: "mx-3 mb-1.5 flex shrink-0 items-start gap-2 rounded-md border border-border bg-muted/70 px-3 py-2 text-xs text-foreground shadow-sm", children: [_jsx(IconAlertTriangle, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }), _jsx("span", { className: "flex-1 leading-snug", children: composerError }), _jsx("button", { type: "button", "aria-label": t("agentChat.common.dismissError"), onClick: () => setComposerError(null), className: "-mr-1 -mt-1 flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: _jsx(IconX, { className: "h-3.5 w-3.5" }) })] })) : null, _jsx(ExternalAgentNudge, { variant: "prompt" })] }), showAfterComposerSuggestions ? (_jsx(AgentKitSuggestedPrompts, { suggestions: suggestions, disabled: !canChat ||
|
|
2314
2345
|
props.composerDisabled ||
|
|
2315
2346
|
props.composerSubmissionDisabled ||
|
|
2316
|
-
isSubmissionInFlight
|
|
2347
|
+
isSubmissionInFlight ||
|
|
2348
|
+
composerSubmissionPending, onSelect: submitSuggestion, className: "agentkit-home-suggestions" })) : null, showAfterComposerSlot ? (_jsx("div", { className: "agentkit-after-composer-slot", children: props.afterComposerSlot })) : null, composerContext?.dialogs] }));
|
|
2317
2349
|
}
|
|
2318
2350
|
function AgentKitSuggestedPrompts({ suggestions, disabled, onSelect, className, }) {
|
|
2319
2351
|
const t = useT();
|
|
@@ -2460,7 +2492,7 @@ function AgentKitReasoning({ value, active, resetKey, }) {
|
|
|
2460
2492
|
}
|
|
2461
2493
|
function AgentKitConnectionRequest({ value, runId, threadId, }) {
|
|
2462
2494
|
const control = useAgentKitControl();
|
|
2463
|
-
return (_jsx(McpAgentKitConnectionRequestCard, { provider: value.provider, detail: value.detail, target: { threadId, runId, requestId: value.id }, onConnected: () => control.resolveConnectionRequest(runId, value.id, {
|
|
2495
|
+
return (_jsx(McpAgentKitConnectionRequestCard, { provider: value.provider, detail: value.detail, reason: value.reason, status: value.status, appId: value.appId, source: value.source, target: { threadId, runId, requestId: value.id }, onConnected: () => control.resolveConnectionRequest(runId, value.id, {
|
|
2464
2496
|
status: "connected",
|
|
2465
2497
|
}), onDeclined: () => control.resolveConnectionRequest(runId, value.id, {
|
|
2466
2498
|
status: "declined",
|