@agent-native/core 0.8.2 → 0.10.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/README.md +4 -4
- package/dist/agent/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.js +5 -4
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/agent/engine/registry.d.ts +6 -3
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +8 -17
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/agent/production-agent.d.ts +1 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +28 -11
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-manager.d.ts +10 -0
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +89 -7
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/run-store.d.ts +4 -1
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +6 -5
- package/dist/agent/run-store.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts +12 -0
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +96 -0
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/cli/create.d.ts +9 -0
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +29 -11
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/index.js +177 -22
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/workspace-dev.js +66 -5
- package/dist/cli/workspace-dev.js.map +1 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +6 -20
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +146 -107
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +143 -22
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/agent-sidebar-state.d.ts +3 -0
- package/dist/client/agent-sidebar-state.d.ts.map +1 -0
- package/dist/client/agent-sidebar-state.js +24 -0
- package/dist/client/agent-sidebar-state.js.map +1 -0
- package/dist/client/analytics.d.ts +39 -0
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +74 -0
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/components/PresenceBar.d.ts.map +1 -1
- package/dist/client/components/PresenceBar.js +21 -15
- package/dist/client/components/PresenceBar.js.map +1 -1
- package/dist/client/components/ui/tooltip.d.ts +2 -1
- package/dist/client/components/ui/tooltip.d.ts.map +1 -1
- package/dist/client/components/ui/tooltip.js +9 -2
- package/dist/client/components/ui/tooltip.js.map +1 -1
- package/dist/client/composer/ComposerPlusMenu.d.ts.map +1 -1
- package/dist/client/composer/ComposerPlusMenu.js +51 -17
- package/dist/client/composer/ComposerPlusMenu.js.map +1 -1
- package/dist/client/composer/PromptComposer.d.ts.map +1 -1
- package/dist/client/composer/PromptComposer.js +30 -0
- package/dist/client/composer/PromptComposer.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +31 -5
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/composer/VoiceButton.d.ts.map +1 -1
- package/dist/client/composer/VoiceButton.js +9 -8
- package/dist/client/composer/VoiceButton.js.map +1 -1
- package/dist/client/dev-overlay/DevOverlay.d.ts.map +1 -1
- package/dist/client/dev-overlay/DevOverlay.js +4 -3
- package/dist/client/dev-overlay/DevOverlay.js.map +1 -1
- package/dist/client/error-format.d.ts.map +1 -1
- package/dist/client/error-format.js +6 -0
- package/dist/client/error-format.js.map +1 -1
- package/dist/client/extensions/EmbeddedExtension.d.ts.map +1 -1
- package/dist/client/extensions/EmbeddedExtension.js +14 -3
- package/dist/client/extensions/EmbeddedExtension.js.map +1 -1
- package/dist/client/extensions/ExtensionEditor.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionEditor.js +6 -5
- package/dist/client/extensions/ExtensionEditor.js.map +1 -1
- package/dist/client/extensions/ExtensionSlot.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionSlot.js +2 -1
- package/dist/client/extensions/ExtensionSlot.js.map +1 -1
- package/dist/client/extensions/ExtensionViewer.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionViewer.js +40 -19
- package/dist/client/extensions/ExtensionViewer.js.map +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.js +52 -51
- package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/integrations/IntegrationCard.d.ts.map +1 -1
- package/dist/client/integrations/IntegrationCard.js +2 -1
- package/dist/client/integrations/IntegrationCard.js.map +1 -1
- package/dist/client/integrations/IntegrationsPanel.d.ts.map +1 -1
- package/dist/client/integrations/IntegrationsPanel.js +3 -2
- package/dist/client/integrations/IntegrationsPanel.js.map +1 -1
- package/dist/client/notifications/NotificationsBell.d.ts.map +1 -1
- package/dist/client/notifications/NotificationsBell.js +42 -6
- package/dist/client/notifications/NotificationsBell.js.map +1 -1
- package/dist/client/onboarding/OnboardingPanel.d.ts.map +1 -1
- package/dist/client/onboarding/OnboardingPanel.js +3 -2
- package/dist/client/onboarding/OnboardingPanel.js.map +1 -1
- package/dist/client/onboarding/SetupButton.d.ts.map +1 -1
- package/dist/client/onboarding/SetupButton.js +14 -13
- package/dist/client/onboarding/SetupButton.js.map +1 -1
- package/dist/client/org/InvitationBanner.d.ts +8 -2
- package/dist/client/org/InvitationBanner.d.ts.map +1 -1
- package/dist/client/org/InvitationBanner.js +28 -7
- package/dist/client/org/InvitationBanner.js.map +1 -1
- package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
- package/dist/client/org/OrgSwitcher.js +29 -5
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/org/TeamPage.d.ts.map +1 -1
- package/dist/client/org/TeamPage.js +9 -7
- package/dist/client/org/TeamPage.js.map +1 -1
- package/dist/client/resources/ResourceEditor.d.ts.map +1 -1
- package/dist/client/resources/ResourceEditor.js +2 -1
- package/dist/client/resources/ResourceEditor.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +48 -14
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/resources/use-mcp-servers.d.ts +2 -0
- package/dist/client/resources/use-mcp-servers.d.ts.map +1 -1
- package/dist/client/resources/use-mcp-servers.js +59 -3
- package/dist/client/resources/use-mcp-servers.js.map +1 -1
- package/dist/client/settings/AgentsSection.d.ts.map +1 -1
- package/dist/client/settings/AgentsSection.js +8 -7
- package/dist/client/settings/AgentsSection.js.map +1 -1
- package/dist/client/settings/AutomationsSection.d.ts.map +1 -1
- package/dist/client/settings/AutomationsSection.js +4 -3
- package/dist/client/settings/AutomationsSection.js.map +1 -1
- package/dist/client/settings/SecretsSection.d.ts.map +1 -1
- package/dist/client/settings/SecretsSection.js +11 -1
- package/dist/client/settings/SecretsSection.js.map +1 -1
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
- package/dist/client/settings/SettingsPanel.js +15 -12
- package/dist/client/settings/SettingsPanel.js.map +1 -1
- package/dist/client/settings/VoiceTranscriptionSection.d.ts.map +1 -1
- package/dist/client/settings/VoiceTranscriptionSection.js +13 -30
- package/dist/client/settings/VoiceTranscriptionSection.js.map +1 -1
- package/dist/client/settings/index.d.ts +1 -1
- package/dist/client/settings/index.d.ts.map +1 -1
- package/dist/client/settings/index.js.map +1 -1
- package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
- package/dist/client/settings/useBuilderStatus.js +27 -1
- package/dist/client/settings/useBuilderStatus.js.map +1 -1
- package/dist/client/sharing/ShareButton.d.ts +4 -0
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +5 -1
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/dist/client/sse-event-processor.d.ts +1 -1
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +59 -11
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/client/use-db-sync.d.ts.map +1 -1
- package/dist/client/use-db-sync.js +100 -19
- package/dist/client/use-db-sync.js.map +1 -1
- package/dist/client/use-session.d.ts.map +1 -1
- package/dist/client/use-session.js +14 -2
- package/dist/client/use-session.js.map +1 -1
- package/dist/collab/client.d.ts +1 -0
- package/dist/collab/client.d.ts.map +1 -1
- package/dist/collab/client.js +18 -1
- package/dist/collab/client.js.map +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +5 -0
- package/dist/deploy/build.js.map +1 -1
- package/dist/deploy/route-discovery.d.ts.map +1 -1
- package/dist/deploy/route-discovery.js +1 -0
- package/dist/deploy/route-discovery.js.map +1 -1
- package/dist/deploy/workspace-core.d.ts +1 -1
- package/dist/deploy/workspace-core.d.ts.map +1 -1
- package/dist/deploy/workspace-core.js +1 -0
- package/dist/deploy/workspace-core.js.map +1 -1
- package/dist/extensions/actions.d.ts.map +1 -1
- package/dist/extensions/actions.js +17 -3
- package/dist/extensions/actions.js.map +1 -1
- package/dist/extensions/routes.js +1 -1
- package/dist/extensions/routes.js.map +1 -1
- package/dist/extensions/schema.d.ts +14 -14
- package/dist/extensions/schema.d.ts.map +1 -1
- package/dist/extensions/schema.js +4 -4
- package/dist/extensions/schema.js.map +1 -1
- package/dist/extensions/store.d.ts.map +1 -1
- package/dist/extensions/store.js +23 -0
- package/dist/extensions/store.js.map +1 -1
- package/dist/extensions/theme.d.ts +8 -1
- package/dist/extensions/theme.d.ts.map +1 -1
- package/dist/extensions/theme.js +43 -34
- package/dist/extensions/theme.js.map +1 -1
- package/dist/mcp-client/routes.d.ts +1 -0
- package/dist/mcp-client/routes.d.ts.map +1 -1
- package/dist/mcp-client/routes.js +28 -1
- package/dist/mcp-client/routes.js.map +1 -1
- package/dist/org/auto-join-domain.d.ts +28 -0
- package/dist/org/auto-join-domain.d.ts.map +1 -0
- package/dist/org/auto-join-domain.js +92 -0
- package/dist/org/auto-join-domain.js.map +1 -0
- package/dist/org/index.d.ts +2 -0
- package/dist/org/index.d.ts.map +1 -1
- package/dist/org/index.js +1 -0
- package/dist/org/index.js.map +1 -1
- package/dist/scripts/db/exec.d.ts.map +1 -1
- package/dist/scripts/db/exec.js +27 -1
- package/dist/scripts/db/exec.js.map +1 -1
- package/dist/scripts/db/index.d.ts.map +1 -1
- package/dist/scripts/db/index.js +1 -0
- package/dist/scripts/db/index.js.map +1 -1
- package/dist/scripts/db/reset-dev-owner.d.ts +27 -0
- package/dist/scripts/db/reset-dev-owner.d.ts.map +1 -0
- package/dist/scripts/db/reset-dev-owner.js +225 -0
- package/dist/scripts/db/reset-dev-owner.js.map +1 -0
- package/dist/scripts/db/scoping.d.ts.map +1 -1
- package/dist/scripts/db/scoping.js +15 -30
- package/dist/scripts/db/scoping.js.map +1 -1
- package/dist/scripts/dev-session.d.ts +46 -0
- package/dist/scripts/dev-session.d.ts.map +1 -0
- package/dist/scripts/dev-session.js +81 -0
- package/dist/scripts/dev-session.js.map +1 -0
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +21 -0
- package/dist/scripts/runner.js.map +1 -1
- package/dist/secrets/register.d.ts +1 -1
- package/dist/secrets/register.d.ts.map +1 -1
- package/dist/secrets/register.js +4 -2
- package/dist/secrets/register.js.map +1 -1
- package/dist/secrets/routes.d.ts.map +1 -1
- package/dist/secrets/routes.js +32 -0
- package/dist/secrets/routes.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +77 -102
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +33 -0
- package/dist/server/auth.js.map +1 -1
- package/dist/server/better-auth-instance.d.ts.map +1 -1
- package/dist/server/better-auth-instance.js +11 -0
- package/dist/server/better-auth-instance.js.map +1 -1
- package/dist/server/builder-browser.d.ts.map +1 -1
- package/dist/server/builder-browser.js +169 -68
- package/dist/server/builder-browser.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +56 -13
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/credential-provider.d.ts +49 -6
- package/dist/server/credential-provider.d.ts.map +1 -1
- package/dist/server/credential-provider.js +133 -38
- package/dist/server/credential-provider.js.map +1 -1
- package/dist/server/design-token-utils.d.ts +13 -2
- package/dist/server/design-token-utils.d.ts.map +1 -1
- package/dist/server/design-token-utils.js +48 -16
- package/dist/server/design-token-utils.js.map +1 -1
- package/dist/server/framework-request-handler.d.ts.map +1 -1
- package/dist/server/framework-request-handler.js +31 -0
- package/dist/server/framework-request-handler.js.map +1 -1
- package/dist/server/google-realtime-session.d.ts.map +1 -1
- package/dist/server/google-realtime-session.js +19 -6
- package/dist/server/google-realtime-session.js.map +1 -1
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +142 -14
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/request-context.d.ts +17 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-context.js +40 -1
- package/dist/server/request-context.js.map +1 -1
- package/dist/server/sentry-plugin.d.ts +11 -0
- package/dist/server/sentry-plugin.d.ts.map +1 -0
- package/dist/server/sentry-plugin.js +116 -0
- package/dist/server/sentry-plugin.js.map +1 -0
- package/dist/server/sentry.d.ts +92 -0
- package/dist/server/sentry.d.ts.map +1 -0
- package/dist/server/sentry.js +287 -0
- package/dist/server/sentry.js.map +1 -0
- package/dist/server/transcribe-voice.d.ts +2 -4
- package/dist/server/transcribe-voice.d.ts.map +1 -1
- package/dist/server/transcribe-voice.js +4 -16
- package/dist/server/transcribe-voice.js.map +1 -1
- package/dist/server/voice-providers-status.d.ts.map +1 -1
- package/dist/server/voice-providers-status.js +19 -35
- package/dist/server/voice-providers-status.js.map +1 -1
- package/dist/styles/agent-native.css +15 -0
- package/docs/content/cloneable-saas.md +7 -9
- package/docs/content/deployment.md +6 -2
- package/docs/content/dispatch.md +1 -1
- package/docs/content/extensions.md +177 -142
- package/docs/content/faq.md +2 -2
- package/docs/content/getting-started.md +13 -11
- package/docs/content/multi-app-workspace.md +2 -2
- package/docs/content/observability.md +47 -0
- package/docs/content/pure-agent-apps.md +1 -1
- package/docs/content/template-clips.md +3 -3
- package/docs/content/template-design.md +3 -3
- package/docs/content/template-dispatch.md +1 -1
- package/docs/content/template-forms.md +1 -1
- package/docs/content/template-mail.md +1 -1
- package/docs/content/what-is-agent-native.md +4 -4
- package/docs/content/workspace.md +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantChat.d.ts","sourceRoot":"","sources":["../../src/client/AssistantChat.tsx"],"names":[],"mappings":"AACA,OAAO,KAQN,MAAM,OAAO,CAAC;AA6Bf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"AssistantChat.d.ts","sourceRoot":"","sources":["../../src/client/AssistantChat.tsx"],"names":[],"mappings":"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"}
|
|
@@ -13,7 +13,6 @@ import { cn } from "./utils.js";
|
|
|
13
13
|
import { AgentTaskCard } from "./AgentTaskCard.js";
|
|
14
14
|
import { ConnectBuilderCard } from "./ConnectBuilderCard.js";
|
|
15
15
|
import { useBuilderConnectFlow } from "./settings/useBuilderStatus.js";
|
|
16
|
-
import { useOnboarding } from "./onboarding/use-onboarding.js";
|
|
17
16
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "./components/ui/tooltip.js";
|
|
18
17
|
import { IframeEmbed, parseEmbedBody } from "./IframeEmbed.js";
|
|
19
18
|
import { useDevMode } from "./use-dev-mode.js";
|
|
@@ -110,6 +109,8 @@ const markdownStyles = `
|
|
|
110
109
|
* below tells the user the context is attached and lets them clear it.
|
|
111
110
|
*/
|
|
112
111
|
const PENDING_SELECTION_KEY = "pending-selection-context";
|
|
112
|
+
const ACTIVE_RUN_CLEAR_TIMEOUT_MS = 5_000;
|
|
113
|
+
const ACTIVE_RUN_POLL_INTERVAL_MS = 150;
|
|
113
114
|
function clearPendingSelection() {
|
|
114
115
|
fetch(agentNativePath(`/_agent-native/application-state/${PENDING_SELECTION_KEY}`), {
|
|
115
116
|
method: "DELETE",
|
|
@@ -120,6 +121,29 @@ function clearPendingSelection() {
|
|
|
120
121
|
window.dispatchEvent(new CustomEvent("agent-panel:selection-cleared"));
|
|
121
122
|
}
|
|
122
123
|
}
|
|
124
|
+
async function waitForThreadRunToClear(apiUrl, threadId) {
|
|
125
|
+
if (!threadId)
|
|
126
|
+
return;
|
|
127
|
+
const deadline = Date.now() + ACTIVE_RUN_CLEAR_TIMEOUT_MS;
|
|
128
|
+
while (Date.now() < deadline) {
|
|
129
|
+
try {
|
|
130
|
+
const res = await fetch(`${apiUrl}/runs/active?threadId=${encodeURIComponent(threadId)}`);
|
|
131
|
+
if (res.ok) {
|
|
132
|
+
const info = await res.json();
|
|
133
|
+
const heartbeatAt = typeof info?.heartbeatAt === "number" ? info.heartbeatAt : null;
|
|
134
|
+
const stale = info?.status === "running" &&
|
|
135
|
+
heartbeatAt != null &&
|
|
136
|
+
Date.now() - heartbeatAt > 5000;
|
|
137
|
+
if (!info?.active || info?.status !== "running" || stale)
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
// Transient poll failure — try again until the short grace period ends.
|
|
143
|
+
}
|
|
144
|
+
await new Promise((resolve) => window.setTimeout(resolve, ACTIVE_RUN_POLL_INTERVAL_MS));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
123
147
|
function SelectionAttachedPill() {
|
|
124
148
|
const [length, setLength] = useState(null);
|
|
125
149
|
useEffect(() => {
|
|
@@ -742,32 +766,17 @@ function ThinkingIndicator({ label = "Thinking" } = {}) {
|
|
|
742
766
|
// Renders a single row with left-aligned copy and a right-aligned action.
|
|
743
767
|
// Click opens the Builder CLI-auth popup via the shared
|
|
744
768
|
// `useBuilderConnectFlow` hook (which owns the synchronous window.open,
|
|
745
|
-
// the 2s status poll, and the focus-refresh). On success
|
|
746
|
-
//
|
|
769
|
+
// the 2s status poll, and the focus-refresh). On success the hook broadcasts
|
|
770
|
+
// a config-change event and this card clears its local `missingApiKey` gate
|
|
771
|
+
// so the user can start chatting without a full-page reload.
|
|
747
772
|
//
|
|
748
773
|
// Desktop note: when this component runs inside the Electron shell, the
|
|
749
774
|
// window.open call is intercepted by the main process's webview popup handler,
|
|
750
775
|
// which opens the flow in an Electron BrowserWindow that shares the webview's
|
|
751
776
|
// session. See packages/desktop-app/src/main/index.ts.
|
|
752
|
-
|
|
753
|
-
* The OnboardingPanel sidebar checklist also surfaces the Builder Connect
|
|
754
|
-
* step (id `llm`). When that's visible, dropping a duplicate "Connect Builder"
|
|
755
|
-
* button into the empty-state chat card just confuses the user — they see two
|
|
756
|
-
* primary CTAs that do the same thing. This hook returns true when we should
|
|
757
|
-
* suppress the in-chat Connect CTA in favor of the sidebar checklist.
|
|
758
|
-
*/
|
|
759
|
-
function useSuppressInChatBuilderCta() {
|
|
760
|
-
const onboarding = useOnboarding();
|
|
761
|
-
if (onboarding.loading || onboarding.dismissed)
|
|
762
|
-
return false;
|
|
763
|
-
return onboarding.steps.some((step) => step.id === "llm" && !step.complete);
|
|
764
|
-
}
|
|
765
|
-
function BuilderConnectCta({ variant = "primary", }) {
|
|
777
|
+
function BuilderConnectCta({ variant = "primary", onConnected, }) {
|
|
766
778
|
const { configured, orgName, connecting, error, start } = useBuilderConnectFlow({
|
|
767
|
-
onConnected
|
|
768
|
-
// Reload so the enclosing card re-evaluates `missingApiKey`.
|
|
769
|
-
window.setTimeout(() => window.location.reload(), 300);
|
|
770
|
-
},
|
|
779
|
+
onConnected,
|
|
771
780
|
});
|
|
772
781
|
const containerClass = variant === "compact"
|
|
773
782
|
? "rounded-md border border-border px-3 py-2.5"
|
|
@@ -777,48 +786,26 @@ function BuilderConnectCta({ variant = "primary", }) {
|
|
|
777
786
|
}
|
|
778
787
|
return (_jsxs("div", { className: containerClass, children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "text-xs font-medium text-foreground", children: "Connect Builder.io" }), _jsx("p", { className: "text-[11px] text-muted-foreground mt-0.5 max-w-[220px]", children: "Free credits for LLM, hosting, and more \u2014 no API key needed" }), error && _jsx("p", { className: "mt-1 text-[10px] text-destructive", children: error })] }), _jsx("button", { type: "button", onClick: start, disabled: connecting, className: "ml-auto inline-flex items-center gap-1 shrink-0 rounded-md bg-foreground px-3 py-1.5 text-[11px] font-medium no-underline text-background hover:opacity-90 disabled:opacity-60 disabled:cursor-wait", "aria-busy": connecting, children: connecting ? (_jsxs(_Fragment, { children: [_jsx(IconLoader2, { size: 10, className: "animate-spin" }), "Waiting\u2026"] })) : (_jsxs(_Fragment, { children: ["Connect", _jsx(IconExternalLink, { size: 10 })] })) })] }));
|
|
779
788
|
}
|
|
780
|
-
// ───
|
|
781
|
-
function
|
|
782
|
-
const
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
const
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
+
// ─── Builder Setup Card ─────────────────────────────────────────────────────
|
|
790
|
+
function BuilderSetupCard({ onConnected, bouncePulse, }) {
|
|
791
|
+
const openSettings = useCallback(() => {
|
|
792
|
+
window.dispatchEvent(new CustomEvent("agent-panel:open-settings"));
|
|
793
|
+
}, []);
|
|
794
|
+
const cardRef = useRef(null);
|
|
795
|
+
// Replay the bounce keyframe each time bouncePulse increments. Toggling the
|
|
796
|
+
// class off-then-on (with a forced reflow) restarts the animation even when
|
|
797
|
+
// the value changes back-to-back.
|
|
798
|
+
useEffect(() => {
|
|
799
|
+
if (!bouncePulse)
|
|
789
800
|
return;
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
if (!res.ok) {
|
|
799
|
-
const data = await res.json().catch(() => ({}));
|
|
800
|
-
throw new Error(data.error || "Failed to save");
|
|
801
|
-
}
|
|
802
|
-
setSaved(true);
|
|
803
|
-
setTimeout(() => window.location.reload(), 1000);
|
|
804
|
-
}
|
|
805
|
-
catch (err) {
|
|
806
|
-
setError(err instanceof Error ? err.message : "Failed to save");
|
|
807
|
-
}
|
|
808
|
-
finally {
|
|
809
|
-
setSaving(false);
|
|
810
|
-
}
|
|
811
|
-
};
|
|
812
|
-
if (saved) {
|
|
813
|
-
return (_jsx("div", { className: "mx-4 my-6 rounded-lg border border-emerald-500/30 bg-emerald-500/5 p-4", children: _jsxs("div", { className: "flex items-center gap-2 text-sm text-emerald-400", children: [_jsx(IconCheck, { className: "h-4 w-4" }), "API key saved. Reloading..."] }) }));
|
|
814
|
-
}
|
|
815
|
-
return (_jsxs("div", { className: "mx-4 my-6 rounded-lg border border-border bg-card p-5", children: [_jsxs("div", { className: "flex items-center gap-3 mb-3", children: [_jsx("div", { className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-muted", children: _jsx(IconMessage, { className: "h-4.5 w-4.5 text-muted-foreground" }) }), _jsx("h3", { className: "text-sm font-medium text-foreground", children: "Connect your AI" })] }), _jsxs("div", { className: "space-y-3", children: [suppressBuilderCta ? null : (_jsxs(_Fragment, { children: [_jsx(BuilderConnectCta, {}), _jsxs("div", { className: "relative flex items-center", children: [_jsx("div", { className: "flex-grow border-t border-border" }), _jsx("span", { className: "mx-2 text-[10px] uppercase tracking-wider text-muted-foreground/60", children: "or" }), _jsx("div", { className: "flex-grow border-t border-border" })] })] })), _jsx("input", { type: "password", value: apiKey, onChange: (e) => {
|
|
816
|
-
setApiKey(e.target.value);
|
|
817
|
-
setError(null);
|
|
818
|
-
}, onKeyDown: (e) => {
|
|
819
|
-
if (e.key === "Enter")
|
|
820
|
-
handleSave();
|
|
821
|
-
}, placeholder: "sk-ant-...", className: "w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring", autoComplete: "off" }), error && _jsx("p", { className: "text-xs text-destructive", children: error }), apiKey.trim() && (_jsx("button", { onClick: handleSave, disabled: saving, className: "w-full rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed", children: saving ? "Saving..." : "Save API key" })), _jsx("p", { className: "text-[10px] text-muted-foreground/60 text-center", children: _jsx("a", { href: "https://console.anthropic.com/settings/keys", target: "_blank", rel: "noopener noreferrer", className: "underline hover:text-foreground/80", children: "Get an Anthropic key" }) })] })] }));
|
|
801
|
+
const el = cardRef.current;
|
|
802
|
+
if (!el)
|
|
803
|
+
return;
|
|
804
|
+
el.classList.remove("animate-bounce-once");
|
|
805
|
+
void el.offsetWidth;
|
|
806
|
+
el.classList.add("animate-bounce-once");
|
|
807
|
+
}, [bouncePulse]);
|
|
808
|
+
return (_jsxs("div", { ref: cardRef, className: "mx-4 my-6 rounded-lg border border-border bg-card p-5", children: [_jsxs("div", { className: "flex items-center gap-3 mb-3", children: [_jsx("div", { className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-muted", children: _jsx(IconMessage, { className: "h-4.5 w-4.5 text-muted-foreground" }) }), _jsxs("div", { children: [_jsx("h3", { className: "text-sm font-medium text-foreground", children: "Connect an LLM" }), _jsx("p", { className: "mt-0.5 text-[11px] text-muted-foreground", children: "Use the hosted agent without adding a separate model provider key." })] })] }), _jsxs("div", { className: "space-y-3", children: [_jsx(BuilderConnectCta, { onConnected: onConnected }), _jsx("div", { className: "text-center", children: _jsx("button", { type: "button", onClick: openSettings, className: "text-[11px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline", children: "Or add your own API key" }) })] })] }));
|
|
822
809
|
}
|
|
823
810
|
function getLoopLimitMetadata(message) {
|
|
824
811
|
const meta = message?.metadata;
|
|
@@ -1002,8 +989,17 @@ function ensureMessageMetadata(repo) {
|
|
|
1002
989
|
if (!msg.metadata) {
|
|
1003
990
|
msg.metadata = {};
|
|
1004
991
|
}
|
|
1005
|
-
if (msg.role === "assistant"
|
|
1006
|
-
msg.status
|
|
992
|
+
if (msg.role === "assistant") {
|
|
993
|
+
const statusType = msg.status && typeof msg.status === "object"
|
|
994
|
+
? msg.status.type
|
|
995
|
+
: undefined;
|
|
996
|
+
const isTerminal = statusType === "complete" || statusType === "incomplete";
|
|
997
|
+
if (!isTerminal) {
|
|
998
|
+
const runError = msg.metadata?.custom?.runError ?? msg.metadata?.runError;
|
|
999
|
+
msg.status = runError
|
|
1000
|
+
? { type: "incomplete", reason: "error" }
|
|
1001
|
+
: { type: "complete", reason: "stop" };
|
|
1002
|
+
}
|
|
1007
1003
|
}
|
|
1008
1004
|
}
|
|
1009
1005
|
return repo;
|
|
@@ -1018,6 +1014,9 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1018
1014
|
const isRuntimeRunning = thread.isRunning;
|
|
1019
1015
|
const messages = thread.messages;
|
|
1020
1016
|
const [missingApiKey, setMissingApiKey] = useState(false);
|
|
1017
|
+
// Increments each time the user clicks the (disabled) composer while no LLM
|
|
1018
|
+
// is connected — `BuilderSetupCard` watches this to replay a one-shot bounce.
|
|
1019
|
+
const [missingKeyBouncePulse, setMissingKeyBouncePulse] = useState(0);
|
|
1021
1020
|
const [authError, setAuthError] = useState(null);
|
|
1022
1021
|
const [queuedMessages, setQueuedMessages] = useState([]);
|
|
1023
1022
|
// Tracks the JSON of the last queue we successfully persisted so the
|
|
@@ -1028,6 +1027,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1028
1027
|
const [loopLimitInfo, setLoopLimitInfo] = useState(null);
|
|
1029
1028
|
const [runErrorInfo, setRunErrorInfo] = useState(null);
|
|
1030
1029
|
const [dismissedRunErrorKey, setDismissedRunErrorKey] = useState(null);
|
|
1030
|
+
const userStoppedRunRef = useRef(null);
|
|
1031
1031
|
const [isReconnecting, setIsReconnecting] = useState(false);
|
|
1032
1032
|
const [reconnectContent, setReconnectContent] = useState([]);
|
|
1033
1033
|
// When stop is clicked during reconnect, keep content visible (don't wipe it)
|
|
@@ -1411,6 +1411,9 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1411
1411
|
window.addEventListener("agent-chat:missing-api-key", handler);
|
|
1412
1412
|
return () => window.removeEventListener("agent-chat:missing-api-key", handler);
|
|
1413
1413
|
}, []);
|
|
1414
|
+
const handleBuilderConnected = useCallback(() => {
|
|
1415
|
+
setMissingApiKey(false);
|
|
1416
|
+
}, []);
|
|
1414
1417
|
// Check on mount and whenever SettingsPanel dispatches
|
|
1415
1418
|
// `agent-engine:configured-changed` so the gate flips live without reload.
|
|
1416
1419
|
useEffect(() => {
|
|
@@ -1480,6 +1483,12 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1480
1483
|
return;
|
|
1481
1484
|
if (!detail?.message)
|
|
1482
1485
|
return;
|
|
1486
|
+
const stopped = userStoppedRunRef.current;
|
|
1487
|
+
if (stopped &&
|
|
1488
|
+
Date.now() - stopped.at < 10_000 &&
|
|
1489
|
+
(!stopped.runId || !detail.runId || stopped.runId === detail.runId)) {
|
|
1490
|
+
return;
|
|
1491
|
+
}
|
|
1483
1492
|
setRunErrorInfo({
|
|
1484
1493
|
message: detail.message,
|
|
1485
1494
|
...(detail.details ? { details: detail.details } : {}),
|
|
@@ -1499,23 +1508,30 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1499
1508
|
setQueuedMessages(rest);
|
|
1500
1509
|
// Small delay to let the runtime settle after completion
|
|
1501
1510
|
setTimeout(() => {
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1511
|
+
void (async () => {
|
|
1512
|
+
// In serverless/cross-isolate deployments the client can receive the
|
|
1513
|
+
// terminal SSE event a beat before SQL has marked the previous run
|
|
1514
|
+
// complete. Starting the queued turn during that window can reconnect
|
|
1515
|
+
// to the old run and replay the old answer under the new prompt.
|
|
1516
|
+
await waitForThreadRunToClear(apiUrl, threadId);
|
|
1517
|
+
const content = [{ type: "text", text: next.text }];
|
|
1518
|
+
if (next.images) {
|
|
1519
|
+
for (const img of next.images) {
|
|
1520
|
+
content.push({ type: "image", image: img });
|
|
1521
|
+
}
|
|
1506
1522
|
}
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
});
|
|
1523
|
+
threadRuntime.append({
|
|
1524
|
+
role: "user",
|
|
1525
|
+
content,
|
|
1526
|
+
...(next.references && next.references.length > 0
|
|
1527
|
+
? { runConfig: { custom: { references: next.references } } }
|
|
1528
|
+
: {}),
|
|
1529
|
+
});
|
|
1530
|
+
})();
|
|
1515
1531
|
}, 100);
|
|
1516
1532
|
}
|
|
1517
1533
|
wasRunningRef.current = isRunning;
|
|
1518
|
-
}, [isRunning, queuedMessages, threadRuntime]);
|
|
1534
|
+
}, [apiUrl, isRunning, queuedMessages, threadId, threadRuntime]);
|
|
1519
1535
|
// Clear frozen reconnect content + forceStopped only on the false→true
|
|
1520
1536
|
// transition of isRuntimeRunning (i.e. a NEW run is actually starting).
|
|
1521
1537
|
// Reacting to "isRuntimeRunning is currently true" would clear the
|
|
@@ -1550,6 +1566,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1550
1566
|
setLoopLimitInfo(null);
|
|
1551
1567
|
setRunErrorInfo(null);
|
|
1552
1568
|
setDismissedRunErrorKey(null);
|
|
1569
|
+
userStoppedRunRef.current = null;
|
|
1553
1570
|
// Selection context attached via Cmd+I is one-shot — clear it as soon
|
|
1554
1571
|
// as the user actually sends a message so it can't be re-used.
|
|
1555
1572
|
clearPendingSelection();
|
|
@@ -1679,10 +1696,22 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1679
1696
|
: null;
|
|
1680
1697
|
const shouldShowRunError = !!visibleRunError &&
|
|
1681
1698
|
!showRunningInUI &&
|
|
1682
|
-
visibleRunErrorKey !== dismissedRunErrorKey
|
|
1699
|
+
visibleRunErrorKey !== dismissedRunErrorKey &&
|
|
1700
|
+
!(userStoppedRunRef.current &&
|
|
1701
|
+
Date.now() - userStoppedRunRef.current.at < 10_000 &&
|
|
1702
|
+
(!userStoppedRunRef.current.runId ||
|
|
1703
|
+
!visibleRunError.runId ||
|
|
1704
|
+
userStoppedRunRef.current.runId === visibleRunError.runId));
|
|
1683
1705
|
return (_jsx(CheckpointContext.Provider, { value: checkpointCtx, children: _jsx(MessageActionsContext.Provider, { value: messageActionsCtx, children: _jsx(ChatRunningContext.Provider, { value: isRunning, children: _jsxs("div", { className: cn("flex flex-1 flex-col h-full min-h-0 text-foreground", className), children: [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": "Switch to CLI", 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: "Switch to CLI" })] }) })) })] })), _jsx("div", { ref: scrollRef, className: "flex-1 overflow-y-auto overflow-x-hidden min-h-0", 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-destructive/10", children: _jsx(IconLock, { className: "h-5 w-5 text-destructive" }) }), _jsxs("div", { className: "text-center max-w-[280px]", children: [_jsx("p", { className: "text-sm font-medium text-foreground mb-1", children: authError.sessionExpired
|
|
1684
1706
|
? "Session expired"
|
|
1685
|
-
: "Authentication required" }), _jsx("p", { className: "text-xs text-muted-foreground leading-relaxed", children: authError.sessionExpired
|
|
1707
|
+
: "Authentication required" }), _jsx("p", { className: "text-xs text-muted-foreground leading-relaxed", children: authError.sessionExpired
|
|
1708
|
+
? "Your session may have expired. Log out and log back in to reconnect."
|
|
1709
|
+
: "You need to log in to use the agent." })] }), _jsxs("div", { className: "flex gap-2", children: [!authError.sessionExpired && (_jsx("button", { onClick: () => {
|
|
1710
|
+
const ret = window.location.pathname + window.location.search;
|
|
1711
|
+
window.location.href =
|
|
1712
|
+
agentNativePath("/_agent-native/sign-in") +
|
|
1713
|
+
`?return=${encodeURIComponent(ret)}`;
|
|
1714
|
+
}, className: "text-xs text-background bg-foreground hover:opacity-90 px-3 py-1.5 rounded-md", children: "Log in" })), authError.sessionExpired && (_jsx("button", { onClick: async () => {
|
|
1686
1715
|
try {
|
|
1687
1716
|
await fetch(agentNativePath("/_agent-native/auth/logout"), {
|
|
1688
1717
|
method: "POST",
|
|
@@ -1693,7 +1722,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1693
1722
|
}, 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: "Log out" })), _jsx("button", { onClick: () => {
|
|
1694
1723
|
setAuthError(null);
|
|
1695
1724
|
window.location.reload();
|
|
1696
|
-
}, className: "text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md border border-border hover:bg-accent", children: "Retry" })] })] })) : missingApiKey ? (_jsx("div", { className: "flex flex-col items-center justify-center h-full px-2", children: _jsx(
|
|
1725
|
+
}, className: "text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md border border-border hover:bg-accent", children: "Retry" })] })] })) : missingApiKey && messages.length === 0 ? (_jsx("div", { className: "flex flex-col items-center justify-center h-full px-2", children: _jsx(BuilderSetupCard, { onConnected: handleBuilderConnected, bouncePulse: missingKeyBouncePulse }) })) : 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" })] })] })) : messages.length === 0 && !isReconnecting ? (_jsxs("div", { className: "flex flex-col items-center justify-center gap-4 py-16 px-4 h-full", children: [_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-muted", children: _jsx(IconMessage, { className: "h-5 w-5 text-muted-foreground" }) }), _jsx("p", { className: "text-sm text-muted-foreground text-center max-w-[240px]", children: emptyStateText ?? "How can I help you?" }), suggestions && suggestions.length > 0 && (_jsx("div", { className: "flex flex-col gap-1.5 w-full max-w-[280px]", children: suggestions.map((suggestion) => (_jsx("button", { onClick: () => {
|
|
1697
1726
|
threadRuntime.append({
|
|
1698
1727
|
role: "user",
|
|
1699
1728
|
content: [{ type: "text", text: suggestion }],
|
|
@@ -1701,7 +1730,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1701
1730
|
}, className: "w-full rounded-lg border border-border px-3 py-2 text-left text-[13px] text-muted-foreground hover:bg-accent hover:text-foreground", children: suggestion }, suggestion))) }))] })) : (_jsxs("div", { className: "agent-thread-content flex flex-col gap-4 px-4 py-4", children: [_jsx(ThreadPrimitive.Messages, { components: {
|
|
1702
1731
|
UserMessage,
|
|
1703
1732
|
AssistantMessage,
|
|
1704
|
-
} }), visibleLoopLimit && !showRunningInUI && (_jsx(LoopLimitContinueCard, { info: visibleLoopLimit, onContinue: () => {
|
|
1733
|
+
} }), missingApiKey && (_jsx(BuilderSetupCard, { onConnected: handleBuilderConnected, bouncePulse: missingKeyBouncePulse })), visibleLoopLimit && !showRunningInUI && (_jsx(LoopLimitContinueCard, { info: visibleLoopLimit, onContinue: () => {
|
|
1705
1734
|
setShowContinue(false);
|
|
1706
1735
|
setLoopLimitInfo(null);
|
|
1707
1736
|
addToQueue("Continue from where you left off.");
|
|
@@ -1724,7 +1753,9 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1724
1753
|
.replace(/<context>[\s\S]*?<\/context>\n?/g, "")
|
|
1725
1754
|
.trim();
|
|
1726
1755
|
return (_jsx("div", { className: "flex justify-end group", children: _jsxs("div", { className: "relative max-w-[85%] rounded-lg bg-accent/50 text-foreground/60 px-3 py-2 text-sm leading-relaxed whitespace-pre-wrap break-words", children: [_jsxs("div", { className: "flex items-center gap-1.5 text-[10px] text-muted-foreground mb-1 font-medium uppercase tracking-wide", children: [_jsx(IconClock, { className: "h-3 w-3" }), "Queued"] }), displayText, msg.images && msg.images.length > 0 && (_jsx("div", { className: "flex flex-wrap gap-1.5 mt-1.5", children: msg.images.map((img, j) => (_jsx("img", { src: img, alt: "", className: "h-12 w-12 rounded object-cover border border-border/50" }, j))) })), _jsx("button", { type: "button", onClick: () => setQueuedMessages((prev) => prev.filter((m) => m.id !== msg.id)), "aria-label": "Remove from queue", className: "absolute -top-2 -right-2 flex h-5 w-5 items-center justify-center rounded-full border border-border bg-background text-muted-foreground opacity-0 group-hover:opacity-100 focus-visible:opacity-100 hover:text-foreground hover:bg-accent shadow-sm", children: _jsx(IconX, { className: "h-3 w-3" }) })] }) }, msg.id));
|
|
1727
|
-
})] })) }), showScrollToBottom && (_jsx("div", { className: "shrink-0 flex justify-center -mb-1", children: _jsx("button", { type: "button", onClick: scrollToBottom, className: "flex h-7 w-7 items-center justify-center rounded-full border border-border bg-background shadow-sm hover:bg-accent", "aria-label": "Scroll to bottom", children: _jsx(IconChevronDown, { className: "h-3.5 w-3.5 text-muted-foreground" }) }) })), composerSlot, _jsx(SelectionAttachedPill, {}), _jsx("div", { className: "agent-composer-area shrink-0 px-3 py-2",
|
|
1756
|
+
})] })) }), showScrollToBottom && (_jsx("div", { className: "shrink-0 flex justify-center -mb-1", children: _jsx("button", { type: "button", onClick: scrollToBottom, className: "flex h-7 w-7 items-center justify-center rounded-full border border-border bg-background shadow-sm hover:bg-accent", "aria-label": "Scroll to bottom", children: _jsx(IconChevronDown, { className: "h-3.5 w-3.5 text-muted-foreground" }) }) })), composerSlot, _jsx(SelectionAttachedPill, {}), _jsx("div", { className: cn("agent-composer-area shrink-0 px-3 py-2", missingApiKey && "cursor-pointer opacity-70"), onClick: missingApiKey
|
|
1757
|
+
? () => setMissingKeyBouncePulse((p) => p + 1)
|
|
1758
|
+
: undefined, children: _jsxs(ComposerPrimitive.Root, { className: cn("flex flex-col rounded-lg border border-input bg-background focus-within:ring-1 focus-within:ring-ring", execMode === "plan" &&
|
|
1728
1759
|
"border-amber-500/50 bg-amber-500/[0.03] focus-within:ring-amber-500/30"), children: [_jsx(ComposerAttachmentPreviewStrip, {}), _jsx(TiptapComposer, { focusRef: tiptapRef, disabled: missingApiKey, placeholder: missingApiKey
|
|
1729
1760
|
? "Connect an AI engine above to start chatting…"
|
|
1730
1761
|
: isRunning
|
|
@@ -1733,31 +1764,39 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1733
1764
|
: "Queue a message..."
|
|
1734
1765
|
: undefined, onSubmit: isRunning
|
|
1735
1766
|
? (text, references) => addToQueue(text, undefined, references.length > 0 ? references : undefined)
|
|
1736
|
-
: undefined, onSlashCommand: onSlashCommand, execMode: execMode, onExecModeChange: onExecModeChange, selectedModel: selectedModel ?? defaultModel, selectedEffort: selectedEffort, availableModels: availableModels, onModelChange: onModelChange, onEffortChange: onEffortChange, draftScope: threadId || tabId, interceptBuildRequestsForBuilder: true, extraActionButton: showRunningInUI ? (_jsx("button", { type: "button", onClick: () => {
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1767
|
+
: undefined, onSlashCommand: onSlashCommand, execMode: execMode, onExecModeChange: onExecModeChange, selectedModel: selectedModel ?? defaultModel, selectedEffort: selectedEffort, availableModels: availableModels, onModelChange: onModelChange, onEffortChange: onEffortChange, draftScope: threadId || tabId, interceptBuildRequestsForBuilder: true, extraActionButton: showRunningInUI ? (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", onClick: () => {
|
|
1768
|
+
// Nuclear stop: flip forceStopped so isRunning is false
|
|
1769
|
+
// immediately. This unblocks submission even if the
|
|
1770
|
+
// runtime or reconnect state is stuck.
|
|
1771
|
+
setForceStopped(true);
|
|
1772
|
+
const activeRun = getActiveRun();
|
|
1773
|
+
const runIdToAbort = reconnectRunIdRef.current ?? activeRun?.runId;
|
|
1774
|
+
userStoppedRunRef.current = {
|
|
1775
|
+
at: Date.now(),
|
|
1776
|
+
...(runIdToAbort
|
|
1777
|
+
? { runId: runIdToAbort }
|
|
1778
|
+
: {}),
|
|
1779
|
+
};
|
|
1780
|
+
setRunErrorInfo(null);
|
|
1781
|
+
setDismissedRunErrorKey(null);
|
|
1782
|
+
if (runIdToAbort) {
|
|
1783
|
+
fetch(`${apiUrl}/runs/${encodeURIComponent(runIdToAbort)}/abort`, { method: "POST" }).catch(() => { });
|
|
1784
|
+
}
|
|
1785
|
+
if (isReconnecting) {
|
|
1786
|
+
reconnectAbortRef.current?.abort();
|
|
1787
|
+
reconnectAbortRef.current = null;
|
|
1788
|
+
reconnectRunIdRef.current = null;
|
|
1789
|
+
setIsReconnecting(false);
|
|
1790
|
+
setReconnectFrozen(reconnectContent.length > 0);
|
|
1791
|
+
}
|
|
1792
|
+
threadRuntime.cancelRun();
|
|
1793
|
+
window.dispatchEvent(new CustomEvent("agentNative.chatRunning", {
|
|
1794
|
+
detail: {
|
|
1795
|
+
isRunning: false,
|
|
1796
|
+
tabId: tabId || threadId,
|
|
1797
|
+
},
|
|
1798
|
+
}));
|
|
1799
|
+
}, className: "shrink-0 flex h-7 w-7 items-center justify-center rounded-md bg-muted text-foreground hover:bg-muted/80", children: _jsx(IconPlayerStop, { className: "h-3.5 w-3.5" }) }) }), _jsx(TooltipContent, { children: "Stop generating" })] })) : undefined })] }) })] }) }) }) }));
|
|
1761
1800
|
});
|
|
1762
1801
|
export const AssistantChat = forwardRef(function AssistantChat({ apiUrl = agentNativePath("/_agent-native/agent-chat"), tabId, threadId, ...props }, ref) {
|
|
1763
1802
|
const modelRef = useRef(props.selectedModel);
|