@agent-native/core 0.149.1 → 0.149.3
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/README.md +1 -1
- package/corpus/templates/analytics/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/analytics/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/analytics/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/analytics/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/analytics/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/analytics/.agents/skills/creative-context/SKILL.md +4 -2
- package/corpus/templates/analytics/.agents/skills/dashboard-management/SKILL.md +2 -0
- package/corpus/templates/analytics/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/analytics/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/analytics/AGENTS.md +25 -32
- package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +150 -46
- package/corpus/templates/analytics/app/global.css +1 -1
- package/corpus/templates/analytics/app/i18n-data.ts +37 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/PanelEditorDialog.tsx +1 -1
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/SqlChartCard.tsx +32 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/types.ts +2 -0
- package/corpus/templates/analytics/changelog/2026-08-10-dashboard-tables-can-be-copied-and-sorted-by-multiple-column.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-10-full-page-chat-now-uses-the-available-width-up-to-1000px-for.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-11-full-page-chat-composers-stay-at-a-focused-750px-width.md +6 -0
- package/corpus/templates/assets/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/assets/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/assets/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/assets/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/assets/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/assets/.agents/skills/creative-context/SKILL.md +4 -2
- package/corpus/templates/assets/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/assets/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/assets/AGENTS.md +6 -9
- package/corpus/templates/assets/app/global.css +1 -1
- package/corpus/templates/assets/changelog/2026-08-10-full-page-chat-now-uses-the-available-width-up-to-1000px-for.md +6 -0
- package/corpus/templates/assets/changelog/2026-08-11-full-page-chat-composers-stay-at-a-focused-750px-width.md +6 -0
- package/corpus/templates/brain/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/brain/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/brain/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/brain/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/brain/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/brain/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/brain/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/brain/AGENTS.md +5 -12
- package/corpus/templates/brain/app/global.css +1 -1
- package/corpus/templates/brain/changelog/2026-08-10-full-page-chat-now-uses-the-available-width-up-to-1000px-for.md +6 -0
- package/corpus/templates/brain/changelog/2026-08-11-full-page-chat-composers-stay-at-a-focused-750px-width.md +6 -0
- package/corpus/templates/calendar/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/calendar/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/calendar/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/calendar/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/calendar/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/calendar/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/calendar/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/calendar/AGENTS.md +8 -9
- package/corpus/templates/chat/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/chat/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/chat/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/chat/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/chat/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/chat/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/chat/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/chat/AGENTS.md +32 -80
- package/corpus/templates/chat/changelog/2026-08-10-full-page-chat-now-uses-the-available-width-up-to-1000px-for.md +6 -0
- package/corpus/templates/clips/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/clips/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/clips/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/clips/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/clips/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/clips/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/clips/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/clips/AGENTS.md +25 -31
- package/corpus/templates/clips/changelog/2026-08-10-clips-desktop-sign-in-now-starts-with-magic-links-and-google.md +6 -0
- package/corpus/templates/clips/chrome-extension/src/overlay.css +1 -0
- package/corpus/templates/clips/desktop/src/app.tsx +274 -137
- package/corpus/templates/clips/desktop/src/styles.css +35 -0
- package/corpus/templates/content/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/content/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/content/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/content/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/content/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/content/.agents/skills/creative-context/SKILL.md +4 -2
- package/corpus/templates/content/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/content/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/content/AGENTS.md +5 -9
- package/corpus/templates/content/app/global.css +1 -0
- package/corpus/templates/crm/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/crm/AGENTS.md +7 -11
- package/corpus/templates/crm/app/global.css +1 -1
- package/corpus/templates/crm/changelog/2026-08-10-full-page-chat-now-uses-the-available-width-up-to-1000px-for.md +6 -0
- package/corpus/templates/crm/changelog/2026-08-11-full-page-chat-composers-stay-at-a-focused-750px-width.md +6 -0
- package/corpus/templates/design/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/design/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/design/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/design/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/design/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/design/.agents/skills/creative-context/SKILL.md +4 -2
- package/corpus/templates/design/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/design/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +70 -3
- package/corpus/templates/design/AGENTS.md +13 -21
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +12 -0
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +19 -2
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +115 -7
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +82 -7
- package/corpus/templates/design/app/components/design/design-trace.ts +120 -0
- package/corpus/templates/design/app/components/design/dnd-debug.ts +2 -1
- package/corpus/templates/design/app/components/design/edit-panel/position-layout-properties.tsx +40 -26
- package/corpus/templates/design/app/components/design/multi-screen/board-surface-html.ts +4 -1
- package/corpus/templates/design/app/components/design/multi-screen/frame-geometry.ts +12 -3
- package/corpus/templates/design/app/components/design/multi-screen/screen-content-cache.ts +4 -0
- package/corpus/templates/design/app/components/design/multi-screen/types.ts +7 -0
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +3 -2
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +2 -2
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +3 -0
- package/corpus/templates/design/app/i18n-data.ts +1 -0
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +5 -5
- package/corpus/templates/design/app/pages/DesignSystems.tsx +3 -2
- package/corpus/templates/design/app/pages/design-editor/canvas-primitive-insert.ts +100 -13
- package/corpus/templates/design/app/pages/design-editor/cross-screen-text-color.ts +1 -1
- package/corpus/templates/design/app/pages/design-editor/data-operations.ts +14 -0
- package/corpus/templates/design/changelog/2026-08-10-marquee-selecting-layers-far-down-a-tall-screen-now-selects-.md +6 -0
- package/corpus/templates/design/changelog/2026-08-10-the-frame-tool-draws-a-plain-frame-by-default-with-screen-av.md +6 -0
- package/corpus/templates/design/e2e/global-setup.ts +27 -32
- package/corpus/templates/design/playwright.config.ts +3 -5
- package/corpus/templates/design/shared/breakpoint-media.ts +9 -2
- package/corpus/templates/dispatch/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/dispatch/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/dispatch/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/dispatch/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/dispatch/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/dispatch/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/dispatch/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/dispatch/AGENTS.md +9 -16
- package/corpus/templates/dispatch/changelog/2026-08-10-full-page-chat-now-uses-the-available-width-up-to-1000px-for.md +6 -0
- package/corpus/templates/factory/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/factory/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/factory/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/factory/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/factory/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/factory/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/factory/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/factory/AGENTS.md +10 -24
- package/corpus/templates/factory/changelog/2026-08-10-full-page-chat-now-uses-the-available-width-up-to-1000px-for.md +6 -0
- package/corpus/templates/forms/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/forms/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/forms/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/forms/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/forms/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/forms/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/forms/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/forms/AGENTS.md +11 -17
- package/corpus/templates/forms/app/global.css +1 -0
- package/corpus/templates/forms/changelog/2026-08-10-full-page-chat-now-uses-the-available-width-up-to-1000px-for.md +6 -0
- package/corpus/templates/forms/changelog/2026-08-11-full-page-chat-composers-stay-at-a-focused-750px-width.md +6 -0
- package/corpus/templates/macros/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/macros/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/macros/AGENTS.md +8 -8
- package/corpus/templates/mail/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/mail/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/mail/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/mail/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/mail/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/mail/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/mail/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/mail/AGENTS.md +5 -6
- package/corpus/templates/plan/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/plan/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/plan/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/plan/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/plan/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/plan/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/plan/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/plan/AGENTS.md +5 -14
- package/corpus/templates/plan/app/global.css +1 -0
- package/corpus/templates/plan/changelog/2026-08-10-full-page-chat-now-uses-the-available-width-up-to-1000px-for.md +6 -0
- package/corpus/templates/plan/changelog/2026-08-11-plan-no-longer-reloads-when-runtime-state-changes.md +6 -0
- package/corpus/templates/plan/server/ui-plan-html.ts +4 -1
- package/corpus/templates/plan/vite.config.ts +5 -0
- package/corpus/templates/slides/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/slides/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/slides/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/slides/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/slides/.agents/skills/create-deck/SKILL.md +2 -2
- package/corpus/templates/slides/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/slides/.agents/skills/creative-context/SKILL.md +6 -3
- package/corpus/templates/slides/.agents/skills/deck-management/SKILL.md +6 -1
- package/corpus/templates/slides/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/slides/.agents/skills/image-generation-via-a2a/SKILL.md +3 -2
- package/corpus/templates/slides/.agents/skills/slide-editing/SKILL.md +3 -0
- package/corpus/templates/slides/.agents/skills/slide-images/SKILL.md +3 -3
- package/corpus/templates/slides/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/slides/AGENTS.md +33 -35
- package/corpus/templates/slides/actions/add-deck.ts +2 -0
- package/corpus/templates/slides/actions/add-slide.ts +15 -1
- package/corpus/templates/slides/actions/create-deck.ts +18 -6
- package/corpus/templates/slides/actions/get-deck-reference-context.ts +2 -2
- package/corpus/templates/slides/actions/get-deck.ts +83 -7
- package/corpus/templates/slides/actions/import-file.ts +2 -1
- package/corpus/templates/slides/actions/patch-deck.ts +165 -9
- package/corpus/templates/slides/actions/save-deck.ts +24 -1
- package/corpus/templates/slides/actions/update-slide.ts +1 -1
- package/corpus/templates/slides/app/components/comments/SlideCommentsPanel.tsx +2 -2
- package/corpus/templates/slides/app/components/deck/DeckCard.tsx +1 -23
- package/corpus/templates/slides/app/components/design-system/DesignSystemCard.tsx +2 -2
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +6 -6
- package/corpus/templates/slides/app/components/editor/AnimationsPanel.tsx +3 -3
- package/corpus/templates/slides/app/components/editor/DeckEditorSkeleton.tsx +4 -4
- package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +1 -1
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +432 -668
- package/corpus/templates/slides/app/components/editor/ExportMenu.tsx +296 -259
- package/corpus/templates/slides/app/components/editor/GeneratingSlidePreview.tsx +1 -1
- package/corpus/templates/slides/app/components/editor/GoogleDriveConnectionCta.tsx +13 -1
- package/corpus/templates/slides/app/components/editor/NewDeckReferenceStep.tsx +56 -174
- package/corpus/templates/slides/app/components/editor/PromptDialog.tsx +241 -116
- package/corpus/templates/slides/app/components/editor/SlideContextToolbar.tsx +1 -1
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +42 -14
- package/corpus/templates/slides/app/components/editor/SpeakerNotesPanel.tsx +6 -12
- package/corpus/templates/slides/app/components/editor/editor-command-model.ts +35 -0
- package/corpus/templates/slides/app/components/layout/AgentWorkIndicator.tsx +1 -1
- package/corpus/templates/slides/app/components/layout/Layout.tsx +34 -35
- package/corpus/templates/slides/app/components/layout/Sidebar.tsx +8 -10
- package/corpus/templates/slides/app/components/layout/layout-route-policy.ts +2 -5
- package/corpus/templates/slides/app/components/onboarding/FirstDeckOnboardingFlow.tsx +45 -40
- package/corpus/templates/slides/app/components/presentation/PresentationView.tsx +63 -16
- package/corpus/templates/slides/app/context/DeckContext.tsx +2 -1
- package/corpus/templates/slides/app/global.css +76 -1
- package/corpus/templates/slides/app/hooks/use-generating-slide-preview.ts +25 -3
- package/corpus/templates/slides/app/i18n/en-US.ts +2 -0
- package/corpus/templates/slides/app/lib/create-deck-generation.ts +52 -23
- package/corpus/templates/slides/app/lib/recent-references.ts +23 -1
- package/corpus/templates/slides/app/lib/slide-animation-elements.ts +104 -3
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +17 -33
- package/corpus/templates/slides/app/pages/DesignSystems.tsx +2 -2
- package/corpus/templates/slides/app/pages/Index.tsx +315 -151
- package/corpus/templates/slides/app/root.tsx +43 -0
- package/corpus/templates/slides/changelog/2026-08-10-ai-editing-avatar-badge.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-10-generated-decks-keep-a-clear-human-readable-title.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-10-new-deck-creation-now-shows-progress-opens-the-editor-direct.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-10-presentation-reveals-now-follow-valid-targets.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-10-slides-editing-controls-are-consolidated-into-one-focused-me.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-10-slides-now-verify-and-restyle-every-imported-slide-in-one-pa.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-10-slides-only-suggests-a-google-connection-for-relevant-reques.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-10-the-google-slides-import-option-is-now-labeled-slides.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-faster-slides-chat-deck-reads.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-slides-chat-can-read-one-slide-without-loading-the-full-deck.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-slides-clearly-indicate-when-an-ai-agent-is-editing-alongsid.md +6 -0
- package/corpus/templates/slides/package.json +1 -0
- package/corpus/templates/slides/server/lib/chat-attachments.ts +1 -1
- package/corpus/templates/slides/server/lib/validate-slide-animations.ts +163 -0
- package/corpus/templates/slides/server/plugins/agent-chat.ts +8 -5
- package/corpus/templates/slides/shared/api.ts +47 -15
- package/corpus/templates/slides/shared/deck-title.ts +135 -0
- package/corpus/templates/tasks/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/tasks/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/tasks/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/tasks/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/tasks/.agents/skills/agent-watchdog/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/tasks/.agents/skills/efficient-fable/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/efficient-frontier/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/tasks/.agents/skills/plan-arbiter/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/plow-ahead/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/quick-recap/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/read-the-damn-docs/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/stay-within-limits/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/tasks/AGENTS.md +5 -20
- package/corpus/templates/tasks/app/components/tasks/TaskListRow.tsx +4 -1
- package/dist/agent/engine/ai-sdk-engine.js +1 -1
- package/dist/agent/production-agent.d.ts +21 -1
- package/dist/agent/production-agent.js +505 -355
- package/dist/agent/run-manager.js +156 -14
- package/dist/agent/run-store.d.ts +11 -10
- package/dist/agent/run-store.js +17 -13
- package/dist/agent/tool-approval-store.d.ts +18 -0
- package/dist/agent/tool-approval-store.js +122 -0
- package/dist/agent/types.d.ts +1 -1
- package/dist/cli/code-agent-executor.js +11 -2
- package/dist/client/AgentPanel.js +31 -6
- package/dist/client/AssistantChat.d.ts +9 -4
- package/dist/client/AssistantChat.js +221 -149
- package/dist/client/active-run-state.d.ts +9 -1
- package/dist/client/active-run-state.js +34 -3
- package/dist/client/agent-chat/index.d.ts +1 -1
- package/dist/client/agent-chat-adapter.d.ts +8 -0
- package/dist/client/agent-chat-adapter.js +125 -28
- package/dist/client/agent-chat.d.ts +1 -1
- package/dist/client/chat/markdown-renderer.js +14 -2
- package/dist/client/chat/message-components.d.ts +13 -3
- package/dist/client/chat/message-components.js +57 -52
- package/dist/client/chat/run-recovery.d.ts +1 -0
- package/dist/client/chat/run-recovery.js +8 -0
- package/dist/client/chat/tool-call-display.d.ts +5 -5
- package/dist/client/chat/tool-call-display.js +9 -212
- package/dist/client/chat-first/apps-rail.js +3 -3
- package/dist/client/chat-first/browser-pane.js +4 -1
- package/dist/client/chat-first/chat-history.d.ts +3 -1
- package/dist/client/chat-first/chat-history.js +7 -4
- package/dist/client/chat-first/surface-tabs.d.ts +1 -1
- package/dist/client/chat-first/surface-tabs.js +52 -41
- package/dist/client/chat-first/types.d.ts +3 -0
- package/dist/client/chat-first.d.ts +10 -0
- package/dist/client/chat-first.js +37 -2
- package/dist/client/components/ui/message-scroller.js +4 -1
- package/dist/client/i18n.js +3 -1
- package/dist/client/resources/McpConnectionSuggestion.js +9 -1
- package/dist/client/sse-event-processor.d.ts +4 -2
- package/dist/client/sse-event-processor.js +46 -6
- package/dist/client/use-chat-models.js +156 -80
- package/dist/client/use-run-stuck-detection.d.ts +2 -0
- package/dist/client/use-run-stuck-detection.js +85 -9
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/integrations/adapters/slack.d.ts +0 -4
- package/dist/integrations/adapters/slack.js +6 -30
- package/dist/integrations/catalog.js +1 -1
- package/dist/integrations/pending-tasks-store.d.ts +0 -8
- package/dist/integrations/pending-tasks-store.js +0 -21
- package/dist/integrations/slack-manifest.d.ts +2 -2
- package/dist/integrations/slack-manifest.js +0 -3
- package/dist/integrations/webhook-handler.js +1 -1
- package/dist/mcp/screen-memory-stdio.d.ts +7 -7
- package/dist/observability/routes.d.ts +3 -3
- package/dist/provider-api/actions/custom-provider-registration.d.ts +4 -4
- package/dist/provider-api/actions/provider-api.d.ts +8 -8
- package/dist/scripts/docs/source-search.js +2 -2
- package/dist/server/agent-chat/framework-prompts.js +7 -2
- package/dist/server/agent-chat/prompt-resources.js +2 -2
- package/dist/server/agent-chat/skill-frontmatter.d.ts +31 -2
- package/dist/server/agent-chat/skill-frontmatter.js +41 -15
- package/dist/server/agent-chat-plugin.js +3 -3
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/agents-bundle.d.ts +16 -19
- package/dist/server/agents-bundle.js +19 -35
- package/dist/server/auth.js +262 -31
- package/dist/server/better-auth-instance.d.ts +1 -0
- package/dist/server/better-auth-instance.js +17 -2
- package/dist/server/onboarding-html.js +56 -9
- package/dist/server/prompts/framework-core-compact.d.ts +6 -1
- package/dist/server/prompts/framework-core-compact.js +12 -9
- package/dist/server/prompts/framework-core.d.ts +6 -1
- package/dist/server/prompts/framework-core.js +11 -9
- package/dist/server/prompts/index.d.ts +1 -1
- package/dist/server/prompts/index.js +1 -1
- package/dist/server/prompts/shared-rules.d.ts +15 -11
- package/dist/server/prompts/shared-rules.js +17 -13
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/shared/reasoning-effort.d.ts +8 -8
- package/dist/shared/reasoning-effort.js +10 -10
- package/dist/shared/streaming-text-smoothing.js +41 -11
- package/dist/styles/agent-native.css +19 -32
- package/dist/templates/chat/.agents/skills/actions/SKILL.md +54 -488
- package/dist/templates/chat/.agents/skills/actions/references/action-fields.md +136 -0
- package/dist/templates/chat/.agents/skills/actions/references/examples.md +94 -0
- package/dist/templates/chat/.agents/skills/actions/references/provider-apis.md +95 -0
- package/dist/templates/chat/.agents/skills/create-skill/SKILL.md +9 -35
- package/dist/templates/chat/.agents/skills/frontend-design/SKILL.md +4 -5
- package/dist/templates/chat/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/dist/templates/chat/AGENTS.md +32 -80
- package/dist/templates/chat/changelog/2026-08-10-full-page-chat-now-uses-the-available-width-up-to-1000px-for.md +6 -0
- package/dist/templates/default/.agents/skills/actions/SKILL.md +54 -488
- package/dist/templates/default/.agents/skills/actions/references/action-fields.md +136 -0
- package/dist/templates/default/.agents/skills/actions/references/examples.md +94 -0
- package/dist/templates/default/.agents/skills/actions/references/provider-apis.md +95 -0
- package/dist/templates/default/.agents/skills/create-skill/SKILL.md +9 -35
- package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +4 -5
- package/dist/templates/default/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/dist/templates/headless/.agents/skills/actions/SKILL.md +54 -488
- package/dist/templates/headless/.agents/skills/actions/references/action-fields.md +136 -0
- package/dist/templates/headless/.agents/skills/actions/references/examples.md +94 -0
- package/dist/templates/headless/.agents/skills/actions/references/provider-apis.md +95 -0
- package/dist/templates/headless/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +54 -488
- package/dist/templates/workspace-core/.agents/skills/actions/references/action-fields.md +136 -0
- package/dist/templates/workspace-core/.agents/skills/actions/references/examples.md +94 -0
- package/dist/templates/workspace-core/.agents/skills/actions/references/provider-apis.md +95 -0
- package/dist/templates/workspace-core/.agents/skills/adding-workspace-apps/SKILL.md +1 -0
- package/dist/templates/workspace-core/.agents/skills/agent-page/SKILL.md +1 -0
- package/dist/templates/workspace-core/.agents/skills/create-skill/SKILL.md +9 -35
- package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +4 -5
- package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +21 -29
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/dist/templates/workspace-core/.agents/skills/workspace-conventions/SKILL.md +7 -17
- package/dist/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +3 -3
- package/dist/templates/workspace-core/AGENTS.md +7 -16
- package/docs/content/messaging.mdx +6 -7
- package/docs/content/template-chat.mdx +1 -1
- package/package.json +2 -2
- package/src/templates/chat/.agents/skills/actions/SKILL.md +54 -488
- package/src/templates/chat/.agents/skills/actions/references/action-fields.md +136 -0
- package/src/templates/chat/.agents/skills/actions/references/examples.md +94 -0
- package/src/templates/chat/.agents/skills/actions/references/provider-apis.md +95 -0
- package/src/templates/chat/.agents/skills/create-skill/SKILL.md +9 -35
- package/src/templates/chat/.agents/skills/frontend-design/SKILL.md +4 -5
- package/src/templates/chat/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/src/templates/chat/AGENTS.md +32 -80
- package/src/templates/chat/changelog/2026-08-10-full-page-chat-now-uses-the-available-width-up-to-1000px-for.md +6 -0
- package/src/templates/default/.agents/skills/actions/SKILL.md +54 -488
- package/src/templates/default/.agents/skills/actions/references/action-fields.md +136 -0
- package/src/templates/default/.agents/skills/actions/references/examples.md +94 -0
- package/src/templates/default/.agents/skills/actions/references/provider-apis.md +95 -0
- package/src/templates/default/.agents/skills/create-skill/SKILL.md +9 -35
- package/src/templates/default/.agents/skills/frontend-design/SKILL.md +4 -5
- package/src/templates/default/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/src/templates/headless/.agents/skills/actions/SKILL.md +54 -488
- package/src/templates/headless/.agents/skills/actions/references/action-fields.md +136 -0
- package/src/templates/headless/.agents/skills/actions/references/examples.md +94 -0
- package/src/templates/headless/.agents/skills/actions/references/provider-apis.md +95 -0
- package/src/templates/headless/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +54 -488
- package/src/templates/workspace-core/.agents/skills/actions/references/action-fields.md +136 -0
- package/src/templates/workspace-core/.agents/skills/actions/references/examples.md +94 -0
- package/src/templates/workspace-core/.agents/skills/actions/references/provider-apis.md +95 -0
- package/src/templates/workspace-core/.agents/skills/adding-workspace-apps/SKILL.md +1 -0
- package/src/templates/workspace-core/.agents/skills/agent-page/SKILL.md +1 -0
- package/src/templates/workspace-core/.agents/skills/create-skill/SKILL.md +9 -35
- package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +4 -5
- package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +21 -29
- package/src/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/src/templates/workspace-core/.agents/skills/workspace-conventions/SKILL.md +7 -17
- package/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +3 -3
- package/src/templates/workspace-core/AGENTS.md +7 -16
|
@@ -2,7 +2,13 @@ export declare const ACTIVE_RUN_STATE_EVENT = "agent-chat:active-run-state-chang
|
|
|
2
2
|
export interface ActiveRunState {
|
|
3
3
|
threadId: string;
|
|
4
4
|
runId: string;
|
|
5
|
+
/** Stable logical-turn identity shared by continuation run IDs. */
|
|
6
|
+
turnId?: string;
|
|
5
7
|
lastSeq: number;
|
|
8
|
+
/** Last SSE sequence classified as real work progress, not keepalive. */
|
|
9
|
+
lastProgressSeq?: number;
|
|
10
|
+
/** Browser time when the last real work-progress event was received. */
|
|
11
|
+
lastProgressObservedAt?: number;
|
|
6
12
|
activityTool?: string | null;
|
|
7
13
|
}
|
|
8
14
|
export interface PendingTurnState {
|
|
@@ -11,7 +17,9 @@ export interface PendingTurnState {
|
|
|
11
17
|
}
|
|
12
18
|
export declare function setActiveRun(state: ActiveRunState): void;
|
|
13
19
|
export declare function getActiveRun(): ActiveRunState | null;
|
|
14
|
-
export declare function updateActiveRunSeq(seq: number): void;
|
|
20
|
+
export declare function updateActiveRunSeq(seq: number, isProgress?: boolean): void;
|
|
21
|
+
/** Whether this browser has received real progress for the matching run recently. */
|
|
22
|
+
export declare function hasRecentActiveRunProgress(threadId: string | null | undefined, runId: string | null | undefined, thresholdMs: number, now?: number): boolean;
|
|
15
23
|
export declare function updateActiveRunActivity(toolName: string | null | undefined): void;
|
|
16
24
|
export declare function getActiveRunActivityTool(threadId: string, runId: string): string | null;
|
|
17
25
|
export declare function clearActiveRun(): void;
|
|
@@ -16,11 +16,24 @@ function normalizeActivityTool(toolName) {
|
|
|
16
16
|
return tool || null;
|
|
17
17
|
}
|
|
18
18
|
export function setActiveRun(state) {
|
|
19
|
+
const previous = getActiveRun();
|
|
20
|
+
const sameRun = previous?.threadId === state.threadId && previous.runId === state.runId;
|
|
21
|
+
const nextState = sameRun
|
|
22
|
+
? {
|
|
23
|
+
...state,
|
|
24
|
+
turnId: state.turnId ?? previous.turnId,
|
|
25
|
+
// Reconnect/continuation writers replace the cursor object. Preserve
|
|
26
|
+
// the browser's real-progress proof across those writes so a healthy
|
|
27
|
+
// stream cannot be reclassified as stale by its own reconnect path.
|
|
28
|
+
lastProgressSeq: state.lastProgressSeq ?? previous.lastProgressSeq,
|
|
29
|
+
lastProgressObservedAt: state.lastProgressObservedAt ?? previous.lastProgressObservedAt,
|
|
30
|
+
}
|
|
31
|
+
: state;
|
|
19
32
|
try {
|
|
20
|
-
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(
|
|
33
|
+
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(nextState));
|
|
21
34
|
}
|
|
22
35
|
catch { }
|
|
23
|
-
notifyActiveRunStateChanged(
|
|
36
|
+
notifyActiveRunStateChanged(nextState);
|
|
24
37
|
}
|
|
25
38
|
export function getActiveRun() {
|
|
26
39
|
try {
|
|
@@ -33,13 +46,31 @@ export function getActiveRun() {
|
|
|
33
46
|
return null;
|
|
34
47
|
}
|
|
35
48
|
}
|
|
36
|
-
export function updateActiveRunSeq(seq) {
|
|
49
|
+
export function updateActiveRunSeq(seq, isProgress = false) {
|
|
37
50
|
const state = getActiveRun();
|
|
38
51
|
if (state) {
|
|
39
52
|
state.lastSeq = seq;
|
|
53
|
+
if (isProgress &&
|
|
54
|
+
seq >=
|
|
55
|
+
(Number.isFinite(state.lastProgressSeq) ? state.lastProgressSeq : -1)) {
|
|
56
|
+
state.lastProgressSeq = seq;
|
|
57
|
+
state.lastProgressObservedAt = Date.now();
|
|
58
|
+
}
|
|
40
59
|
setActiveRun(state);
|
|
41
60
|
}
|
|
42
61
|
}
|
|
62
|
+
/** Whether this browser has received real progress for the matching run recently. */
|
|
63
|
+
export function hasRecentActiveRunProgress(threadId, runId, thresholdMs, now = Date.now()) {
|
|
64
|
+
const state = getActiveRun();
|
|
65
|
+
if (!state ||
|
|
66
|
+
!runId ||
|
|
67
|
+
state.runId !== runId ||
|
|
68
|
+
(threadId != null && state.threadId !== threadId) ||
|
|
69
|
+
typeof state.lastProgressObservedAt !== "number") {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return now - state.lastProgressObservedAt <= thresholdMs;
|
|
73
|
+
}
|
|
43
74
|
export function updateActiveRunActivity(toolName) {
|
|
44
75
|
const state = getActiveRun();
|
|
45
76
|
if (!state)
|
|
@@ -39,4 +39,4 @@ export { AGENT_SIDEBAR_DEFAULT_MAX_WIDTH, AGENT_SIDEBAR_MIN_WIDTH, AGENT_SIDEBAR
|
|
|
39
39
|
export { clearReservedToolRenderersForTests, clearToolRenderersForTests, registerActionChatRenderer, registerFallbackToolRenderer, registerReservedActionChatRenderer, registerReservedFallbackToolRenderer, registerReservedToolRenderer, registerToolRenderer, resolveToolRenderer, type ActionChatRendererRegistration, type ToolRendererComponent, type ToolRendererContext, type ToolRendererMatch, type ToolRendererProps, type ToolRendererRegistration, } from "../chat/tool-render-registry.js";
|
|
40
40
|
export * from "../chat/connectors.js";
|
|
41
41
|
export * from "../chat/runtime.js";
|
|
42
|
-
export { CHAT_FIRST_APP_LAYOUT_STORAGE_KEY, CHAT_FIRST_DEFAULT_APP_IDS, CHAT_FIRST_SURFACE_TABS_STORAGE_KEY, CHAT_FIRST_SURFACE_PANEL_STORAGE_KEY, CHAT_FIRST_SURFACE_WIDTH_DEFAULT, CHAT_FIRST_SURFACE_WIDTH_MIN, clampChatFirstSurfaceWidth, CHAT_FIRST_MODE_STORAGE_KEY, CHAT_FIRST_MODE_CHANGED_EVENT, CHAT_FIRST_OPEN_APP_EVENT, CHAT_FIRST_OPEN_BROWSER_EVENT, CHAT_FIRST_WATCH_SESSION_EVENT, CHAT_FIRST_SURFACE_CATALOG, chatFirstSurfaceTabId, closeChatFirstSessionWatch, emitChatFirstOpenApp, emitChatFirstOpenBrowser, emitChatFirstSessionWatch, getChatFirstSessionWatchStore, getChatFirstSurfaceTabsStore, getChatFirstSurfacePanelStore, orderChatFirstAppIds, readChatFirstAppLayout, resolveChatFirstAppTarget, resolveChatFirstBrowserTarget, resolveChatFirstSessionId, normalizeChatFirstSessionReference, readChatFirstMode, readChatFirstModeState, readChatFirstSurfaceWidth, subscribeChatFirstOpenApp, subscribeChatFirstOpenBrowser, subscribeChatFirstSessionWatch, useChatFirstSessionWatch, useChatFirstSurfaceResize, useChatFirstSurfacePanel, useChatFirstSurfaceTabs, writeChatFirstAppLayout, writeChatFirstMode, writeChatFirstSurfaceWidth, type ChatFirstAppLayoutPreference, type ChatFirstModeReadResult, type ChatFirstAppRegistration, type ChatFirstAppResolution, type ChatFirstAppTarget, type ChatFirstAgentActivity, type ChatFirstAgentActivityStatus, type ChatFirstOpenAppDelivery, type ChatFirstOpenAppDetail, type ChatFirstOpenBrowserDetail, type ChatFirstBrowserResolution, type ChatFirstSessionKind, type ChatFirstSessionReference, type ChatFirstSessionWatchDelivery, type ChatFirstSessionWatchState, type ChatFirstSessionWatchStore, type ChatFirstSurfaceKind, type ChatFirstSurfaceTab, type ChatFirstSurfacePanelState, type ChatFirstSurfacePanelStore, type ChatFirstSurfaceTabsState, type ChatFirstSurfaceTabsStore, } from "../chat-first.js";
|
|
42
|
+
export { CHAT_FIRST_APP_LAYOUT_STORAGE_KEY, CHAT_FIRST_DEFAULT_APP_IDS, CHAT_FIRST_SURFACE_TABS_STORAGE_KEY, CHAT_FIRST_SURFACE_PANEL_STORAGE_KEY, CHAT_FIRST_SURFACE_WIDTH_DEFAULT, CHAT_FIRST_SURFACE_WIDTH_MIN, clampChatFirstSurfaceWidth, CHAT_FIRST_MODE_STORAGE_KEY, CHAT_FIRST_MODE_CHANGED_EVENT, CHAT_FIRST_OPEN_APP_EVENT, CHAT_FIRST_OPEN_BROWSER_EVENT, CHAT_FIRST_WATCH_SESSION_EVENT, CHAT_FIRST_SURFACE_CATALOG, chatFirstSurfaceTabId, closeChatFirstSessionWatch, emitChatFirstOpenApp, emitChatFirstOpenBrowser, emitChatFirstSessionWatch, getChatFirstSessionWatchStore, getChatFirstSurfaceTabsStore, getChatFirstSurfacePanelStore, orderChatFirstAppIds, readChatFirstAppLayout, resolveChatFirstAppTarget, resolveChatFirstBrowserTarget, resolveChatFirstSessionId, normalizeChatFirstSessionReference, readChatFirstMode, readChatFirstModeState, readChatFirstSurfaceWidth, subscribeChatFirstOpenApp, subscribeChatFirstOpenBrowser, subscribeChatFirstSessionWatch, useChatFirstSessionWatch, useChatFirstSurfaceResize, useChatFirstSurfacePanel, useChatFirstSurfaceTabs, writeChatFirstAppLayout, writeChatFirstMode, writeChatFirstSurfaceWidth, type ChatFirstAppLayoutPreference, type ChatFirstModeReadResult, type ChatFirstAppRegistration, type ChatFirstAppResolution, type ChatFirstAppTarget, type ChatFirstAppSurfacePlacement, type ChatFirstAgentActivity, type ChatFirstAgentActivityStatus, type ChatFirstOpenAppDelivery, type ChatFirstOpenAppDetail, type ChatFirstOpenBrowserDetail, type ChatFirstBrowserResolution, type ChatFirstSessionKind, type ChatFirstSessionReference, type ChatFirstSessionWatchDelivery, type ChatFirstSessionWatchState, type ChatFirstSessionWatchStore, type ChatFirstSurfaceKind, type ChatFirstSurfaceTab, type ChatFirstSurfacePanelState, type ChatFirstSurfacePanelStore, type ChatFirstSurfaceTabsState, type ChatFirstSurfaceTabsStore, } from "../chat-first.js";
|
|
@@ -17,6 +17,14 @@ export declare const BACKGROUND_FOLLOW_ATTACH_WATCHDOG_MS = 90000;
|
|
|
17
17
|
export declare const BACKGROUND_FOLLOW_IDLE_TIMEOUT_MS = 210000;
|
|
18
18
|
export declare const MAX_FOLLOWED_BACKGROUND_RUNS = 24;
|
|
19
19
|
export declare const MAX_BACKGROUND_FOLLOW_WALL_TIME_MS: number;
|
|
20
|
+
/**
|
|
21
|
+
* True when an action was streamed but never returned a result yet — i.e. a
|
|
22
|
+
* `tool_start` with no matching `tool_done`. The server is still executing it,
|
|
23
|
+
* so a run_timeout that fires in this window is NOT a stall: the agent was
|
|
24
|
+
* actively working and `foldAssistantTurn` persisted the in-flight call. We
|
|
25
|
+
* must not count this against the stalled/empty continuation budgets.
|
|
26
|
+
*/
|
|
27
|
+
export declare function hasInFlightToolCall(content: ContentPart[]): boolean;
|
|
20
28
|
/**
|
|
21
29
|
* Server truth for "does this run still look alive?", used to keep the client
|
|
22
30
|
* from aborting a run the server believes is healthy — the destructive half of
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { unwrapAttachmentEnvelope } from "@agent-native/toolkit/composer/pasted-text";
|
|
2
2
|
import { actionPreparationContinuationNote } from "../agent/action-continuation-guidance.js";
|
|
3
3
|
import { LLM_MISSING_CREDENTIALS_ERROR_CODE, LLM_MISSING_CREDENTIALS_MESSAGE, } from "../agent/engine/credential-errors.js";
|
|
4
|
-
import { clearPendingTurnIfMatches, setActiveRun, updateActiveRunSeq, clearActiveRun, setPendingTurn, } from "./active-run-state.js";
|
|
4
|
+
import { clearPendingTurnIfMatches, getActiveRun, setActiveRun, updateActiveRunSeq, clearActiveRun, clearActiveRunIfMatches, setPendingTurn, } from "./active-run-state.js";
|
|
5
5
|
import { getOrCreateAnalyticsSessionId } from "./analytics-session.js";
|
|
6
6
|
import { captureError } from "./analytics.js";
|
|
7
7
|
import { agentNativePath } from "./api-path.js";
|
|
@@ -85,6 +85,19 @@ const LARGE_INPUT_TOOL_NAMES = new Set([
|
|
|
85
85
|
]);
|
|
86
86
|
const MAX_HISTORY_LARGE_TOOL_ARGS_CHARS = 200_000;
|
|
87
87
|
const STARTUP_RESPONSE_TIMEOUT_MS = 45_000;
|
|
88
|
+
function dispatchTerminalChatUiCleanup(tabId) {
|
|
89
|
+
if (typeof window === "undefined")
|
|
90
|
+
return;
|
|
91
|
+
// Some terminal outcomes are synthesized by the adapter after recovery
|
|
92
|
+
// (for example, a completed tool whose final response timed out) and never
|
|
93
|
+
// pass through a terminal SSE frame. Clear both halves of the status UI so
|
|
94
|
+
// the wrap-up result cannot leave a preparation label or "Resuming" state.
|
|
95
|
+
window.dispatchEvent(new CustomEvent("agent-chat:activity-clear", { detail: { tabId } }));
|
|
96
|
+
window.dispatchEvent(new CustomEvent("agent-chat:stream-progress", { detail: { tabId } }));
|
|
97
|
+
}
|
|
98
|
+
function isTerminalChatModelRunResult(result) {
|
|
99
|
+
return (result.status?.type === "complete" || result.status?.type === "incomplete");
|
|
100
|
+
}
|
|
88
101
|
// ── Background follow mode ──────────────────────────────────────────────────
|
|
89
102
|
// For server-continued runs (dispatchMode starts with "background" or equals
|
|
90
103
|
// "foreground-self-chain") the SERVER normally chains continuation chunks
|
|
@@ -772,7 +785,7 @@ function continuationRepeatSignature(content) {
|
|
|
772
785
|
* actively working and `foldAssistantTurn` persisted the in-flight call. We
|
|
773
786
|
* must not count this against the stalled/empty continuation budgets.
|
|
774
787
|
*/
|
|
775
|
-
function hasInFlightToolCall(content) {
|
|
788
|
+
export function hasInFlightToolCall(content) {
|
|
776
789
|
return content.some((part) => part.type === "tool-call" &&
|
|
777
790
|
part.result === undefined &&
|
|
778
791
|
part.activity !== true);
|
|
@@ -798,7 +811,10 @@ export async function activeRunLooksAlive(args) {
|
|
|
798
811
|
if (data?.active !== true || String(data.runId ?? "") !== args.runId) {
|
|
799
812
|
return false;
|
|
800
813
|
}
|
|
801
|
-
|
|
814
|
+
// `running` only says the server row has not terminalized. It is not proof
|
|
815
|
+
// that a tool is executing, and treating it as proof skips the client
|
|
816
|
+
// rescue precisely when a stalled run has no in-flight work.
|
|
817
|
+
return data.hasInFlightWork === true;
|
|
802
818
|
}
|
|
803
819
|
catch {
|
|
804
820
|
return true;
|
|
@@ -1402,9 +1418,14 @@ export function createAgentChatAdapter(options) {
|
|
|
1402
1418
|
const engine = runConfigSelection("engine") ?? engineRef?.current;
|
|
1403
1419
|
const effort = runConfigSelection("effort") ??
|
|
1404
1420
|
effortRef?.current;
|
|
1421
|
+
const requestedTurnId = (() => {
|
|
1422
|
+
const raw = runConfig?.custom && typeof runConfig.custom === "object"
|
|
1423
|
+
? runConfig.custom.turnId
|
|
1424
|
+
: undefined;
|
|
1425
|
+
return typeof raw === "string" && raw.trim() ? raw.trim() : undefined;
|
|
1426
|
+
})();
|
|
1427
|
+
const turnId = requestedTurnId ?? generateTurnId();
|
|
1405
1428
|
const withRequestModeMetadata = (result) => {
|
|
1406
|
-
if (!requestMode)
|
|
1407
|
-
return result;
|
|
1408
1429
|
const metadata = (result.metadata ?? {});
|
|
1409
1430
|
const custom = metadata.custom && typeof metadata.custom === "object"
|
|
1410
1431
|
? metadata.custom
|
|
@@ -1413,7 +1434,11 @@ export function createAgentChatAdapter(options) {
|
|
|
1413
1434
|
...result,
|
|
1414
1435
|
metadata: {
|
|
1415
1436
|
...metadata,
|
|
1416
|
-
custom: {
|
|
1437
|
+
custom: {
|
|
1438
|
+
...custom,
|
|
1439
|
+
turnId,
|
|
1440
|
+
...(requestMode ? { requestMode } : {}),
|
|
1441
|
+
},
|
|
1417
1442
|
},
|
|
1418
1443
|
};
|
|
1419
1444
|
};
|
|
@@ -1445,11 +1470,34 @@ export function createAgentChatAdapter(options) {
|
|
|
1445
1470
|
}
|
|
1446
1471
|
const content = [];
|
|
1447
1472
|
const toolCallCounter = { value: 0 };
|
|
1448
|
-
const turnId = generateTurnId();
|
|
1449
1473
|
if (threadId)
|
|
1450
1474
|
setPendingTurn({ threadId, turnId });
|
|
1451
1475
|
let runId = null;
|
|
1452
1476
|
let lastSeq = -1;
|
|
1477
|
+
const ownsActiveRunState = () => {
|
|
1478
|
+
const activeRun = getActiveRun();
|
|
1479
|
+
return (!activeRun ||
|
|
1480
|
+
(!!threadId &&
|
|
1481
|
+
!!runId &&
|
|
1482
|
+
activeRun.threadId === threadId &&
|
|
1483
|
+
activeRun.runId === runId));
|
|
1484
|
+
};
|
|
1485
|
+
const settleTerminalChatRun = () => {
|
|
1486
|
+
if (!ownsActiveRunState())
|
|
1487
|
+
return;
|
|
1488
|
+
if (threadId && runId) {
|
|
1489
|
+
clearActiveRunIfMatches(threadId, runId);
|
|
1490
|
+
}
|
|
1491
|
+
else {
|
|
1492
|
+
clearActiveRun();
|
|
1493
|
+
}
|
|
1494
|
+
if (typeof window === "undefined")
|
|
1495
|
+
return;
|
|
1496
|
+
dispatchTerminalChatUiCleanup(tabId);
|
|
1497
|
+
window.dispatchEvent(new CustomEvent("agentNative.chatRunning", {
|
|
1498
|
+
detail: { isRunning: false, tabId },
|
|
1499
|
+
}));
|
|
1500
|
+
};
|
|
1453
1501
|
const seenRunSeqs = new Map();
|
|
1454
1502
|
const preparingActionStatesByRun = new Map();
|
|
1455
1503
|
let currentRunDispatchMode = null;
|
|
@@ -1696,6 +1744,7 @@ export function createAgentChatAdapter(options) {
|
|
|
1696
1744
|
return state;
|
|
1697
1745
|
};
|
|
1698
1746
|
const currentSSEOptions = (overrides = {}) => ({
|
|
1747
|
+
markTerminalResults: true,
|
|
1699
1748
|
durableBackgroundRun: currentRunDispatchMode?.startsWith("background") === true,
|
|
1700
1749
|
...(runId
|
|
1701
1750
|
? { preparingActionState: preparingActionStateForRun(runId) }
|
|
@@ -1806,14 +1855,20 @@ export function createAgentChatAdapter(options) {
|
|
|
1806
1855
|
break;
|
|
1807
1856
|
}
|
|
1808
1857
|
updateCurrentRunDispatchMode(reconnectRes.headers.get("X-Dispatch-Mode"));
|
|
1809
|
-
for await (const result of readSSEStream(reconnectRes.body, content, toolCallCounter, tabId, (seq) => {
|
|
1858
|
+
for await (const result of readSSEStream(reconnectRes.body, content, toolCallCounter, tabId, (seq, isProgress) => {
|
|
1810
1859
|
rememberRunSeq(seq);
|
|
1811
1860
|
if (threadId)
|
|
1812
|
-
updateActiveRunSeq(seq);
|
|
1861
|
+
updateActiveRunSeq(seq, isProgress);
|
|
1813
1862
|
}, runId, currentSSEOptions())) {
|
|
1814
|
-
|
|
1863
|
+
const nextResult = withRequestModeMetadata(result);
|
|
1864
|
+
if (isTerminalChatModelRunResult(nextResult)) {
|
|
1865
|
+
settleTerminalChatRun();
|
|
1866
|
+
}
|
|
1867
|
+
yield nextResult;
|
|
1868
|
+
}
|
|
1869
|
+
if (ownsActiveRunState()) {
|
|
1870
|
+
clearActiveRun();
|
|
1815
1871
|
}
|
|
1816
|
-
clearActiveRun();
|
|
1817
1872
|
return true;
|
|
1818
1873
|
}
|
|
1819
1874
|
catch (reconnectErr) {
|
|
@@ -1834,7 +1889,7 @@ export function createAgentChatAdapter(options) {
|
|
|
1834
1889
|
}
|
|
1835
1890
|
return false;
|
|
1836
1891
|
};
|
|
1837
|
-
const reconnectActiveRunForThread = async function* () {
|
|
1892
|
+
const reconnectActiveRunForThread = async function* (options) {
|
|
1838
1893
|
if (!threadId)
|
|
1839
1894
|
return false;
|
|
1840
1895
|
let lastActiveRunError = null;
|
|
@@ -1855,6 +1910,9 @@ export function createAgentChatAdapter(options) {
|
|
|
1855
1910
|
if (active?.active && active.runId) {
|
|
1856
1911
|
const activeRunId = String(active.runId);
|
|
1857
1912
|
const activeTurnId = typeof active.turnId === "string" ? active.turnId : "";
|
|
1913
|
+
if (options?.requireCurrentTurn && activeTurnId !== turnId) {
|
|
1914
|
+
return false;
|
|
1915
|
+
}
|
|
1858
1916
|
if (!canAttachRun(activeRunId, activeTurnId)) {
|
|
1859
1917
|
return false;
|
|
1860
1918
|
}
|
|
@@ -1865,7 +1923,12 @@ export function createAgentChatAdapter(options) {
|
|
|
1865
1923
|
attemptedRunIds.push(activeRunId);
|
|
1866
1924
|
}
|
|
1867
1925
|
reconnectCursorForRun(activeRunId, previousRunId);
|
|
1868
|
-
setActiveRun({
|
|
1926
|
+
setActiveRun({
|
|
1927
|
+
threadId,
|
|
1928
|
+
runId: activeRunId,
|
|
1929
|
+
turnId,
|
|
1930
|
+
lastSeq,
|
|
1931
|
+
});
|
|
1869
1932
|
const reconnected = yield* reconnectCurrentRun();
|
|
1870
1933
|
if (reconnected)
|
|
1871
1934
|
return true;
|
|
@@ -1935,7 +1998,12 @@ export function createAgentChatAdapter(options) {
|
|
|
1935
1998
|
attemptedRunIds.push(activeRunId);
|
|
1936
1999
|
}
|
|
1937
2000
|
reconnectCursorForRun(activeRunId, previousRunId);
|
|
1938
|
-
setActiveRun({
|
|
2001
|
+
setActiveRun({
|
|
2002
|
+
threadId,
|
|
2003
|
+
runId: activeRunId,
|
|
2004
|
+
turnId,
|
|
2005
|
+
lastSeq,
|
|
2006
|
+
});
|
|
1939
2007
|
const reconnected = yield* reconnectCurrentRun();
|
|
1940
2008
|
if (reconnected)
|
|
1941
2009
|
return true;
|
|
@@ -1985,6 +2053,7 @@ export function createAgentChatAdapter(options) {
|
|
|
1985
2053
|
type: "text",
|
|
1986
2054
|
text: formatChatErrorText(args.message, undefined, args.errorCode),
|
|
1987
2055
|
});
|
|
2056
|
+
settleTerminalChatRun();
|
|
1988
2057
|
yield {
|
|
1989
2058
|
content: [...content],
|
|
1990
2059
|
status: { type: "incomplete", reason: "error" },
|
|
@@ -2048,6 +2117,7 @@ export function createAgentChatAdapter(options) {
|
|
|
2048
2117
|
includeActivity: true,
|
|
2049
2118
|
});
|
|
2050
2119
|
const runWarning = appendMissingFinalResponseWarning(content);
|
|
2120
|
+
settleTerminalChatRun();
|
|
2051
2121
|
yield {
|
|
2052
2122
|
content: [...content],
|
|
2053
2123
|
status: { type: "complete", reason: "stop" },
|
|
@@ -2103,15 +2173,19 @@ export function createAgentChatAdapter(options) {
|
|
|
2103
2173
|
}
|
|
2104
2174
|
attached = true;
|
|
2105
2175
|
updateCurrentRunDispatchMode(eventsRes.headers.get("X-Dispatch-Mode"));
|
|
2106
|
-
for await (const result of readSSEStream(eventsRes.body, content, toolCallCounter, tabId, (seq) => {
|
|
2176
|
+
for await (const result of readSSEStream(eventsRes.body, content, toolCallCounter, tabId, (seq, isProgress) => {
|
|
2107
2177
|
rememberRunSeq(seq);
|
|
2108
2178
|
if (threadId)
|
|
2109
|
-
updateActiveRunSeq(seq);
|
|
2179
|
+
updateActiveRunSeq(seq, isProgress);
|
|
2110
2180
|
}, runId, currentSSEOptions({
|
|
2111
2181
|
noProgressTimeoutMs: BACKGROUND_FOLLOW_ATTACH_WATCHDOG_MS,
|
|
2112
2182
|
actionPreparationStallTimeoutMs: BACKGROUND_FOLLOW_ATTACH_WATCHDOG_MS,
|
|
2113
2183
|
}))) {
|
|
2114
|
-
|
|
2184
|
+
const nextResult = withRequestModeMetadata(result);
|
|
2185
|
+
if (isTerminalChatModelRunResult(nextResult)) {
|
|
2186
|
+
settleTerminalChatRun();
|
|
2187
|
+
}
|
|
2188
|
+
yield nextResult;
|
|
2115
2189
|
}
|
|
2116
2190
|
// readSSEStream returned normally: a terminal done/error was
|
|
2117
2191
|
// consumed and rendered — the turn is over.
|
|
@@ -2414,7 +2488,12 @@ export function createAgentChatAdapter(options) {
|
|
|
2414
2488
|
}
|
|
2415
2489
|
reconnectCursorForRun(activeRunId, previousRunId);
|
|
2416
2490
|
if (threadId) {
|
|
2417
|
-
setActiveRun({
|
|
2491
|
+
setActiveRun({
|
|
2492
|
+
threadId,
|
|
2493
|
+
runId: activeRunId,
|
|
2494
|
+
turnId,
|
|
2495
|
+
lastSeq,
|
|
2496
|
+
});
|
|
2418
2497
|
}
|
|
2419
2498
|
const seqBeforeAttach = lastSeq;
|
|
2420
2499
|
const attach = yield* followAttachOnce();
|
|
@@ -2928,10 +3007,10 @@ export function createAgentChatAdapter(options) {
|
|
|
2928
3007
|
// internal continuation is only adoptable after /runs/active
|
|
2929
3008
|
// proves it carries this turnId; a bare 409 run id is not
|
|
2930
3009
|
// enough ownership evidence.
|
|
2931
|
-
if (activeRunId !== null &&
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
3010
|
+
if (activeRunId !== null && internalContinuationRequest) {
|
|
3011
|
+
const reconnected = yield* reconnectActiveRunForThread({
|
|
3012
|
+
requireCurrentTurn: true,
|
|
3013
|
+
});
|
|
2935
3014
|
if (reconnected)
|
|
2936
3015
|
return;
|
|
2937
3016
|
}
|
|
@@ -2972,6 +3051,7 @@ export function createAgentChatAdapter(options) {
|
|
|
2972
3051
|
type: "text",
|
|
2973
3052
|
text: `Something went wrong: ${message}`,
|
|
2974
3053
|
});
|
|
3054
|
+
settleTerminalChatRun();
|
|
2975
3055
|
yield {
|
|
2976
3056
|
content: [...content],
|
|
2977
3057
|
status: {
|
|
@@ -2980,7 +3060,6 @@ export function createAgentChatAdapter(options) {
|
|
|
2980
3060
|
},
|
|
2981
3061
|
metadata: { custom: { runError } },
|
|
2982
3062
|
};
|
|
2983
|
-
clearActiveRun();
|
|
2984
3063
|
return;
|
|
2985
3064
|
}
|
|
2986
3065
|
}
|
|
@@ -2993,6 +3072,7 @@ export function createAgentChatAdapter(options) {
|
|
|
2993
3072
|
type: "text",
|
|
2994
3073
|
text: authErrorText("auth-required"),
|
|
2995
3074
|
});
|
|
3075
|
+
settleTerminalChatRun();
|
|
2996
3076
|
yield {
|
|
2997
3077
|
content: [...content],
|
|
2998
3078
|
status: {
|
|
@@ -3013,6 +3093,7 @@ export function createAgentChatAdapter(options) {
|
|
|
3013
3093
|
type: "text",
|
|
3014
3094
|
text: authErrorText("session-expired"),
|
|
3015
3095
|
});
|
|
3096
|
+
settleTerminalChatRun();
|
|
3016
3097
|
yield {
|
|
3017
3098
|
content: [...content],
|
|
3018
3099
|
status: {
|
|
@@ -3036,6 +3117,7 @@ export function createAgentChatAdapter(options) {
|
|
|
3036
3117
|
type: "text",
|
|
3037
3118
|
text: authErrorText(reason, body),
|
|
3038
3119
|
});
|
|
3120
|
+
settleTerminalChatRun();
|
|
3039
3121
|
yield {
|
|
3040
3122
|
content: [...content],
|
|
3041
3123
|
status: {
|
|
@@ -3054,6 +3136,7 @@ export function createAgentChatAdapter(options) {
|
|
|
3054
3136
|
}));
|
|
3055
3137
|
}
|
|
3056
3138
|
content.push({ type: "text", text: failure.text });
|
|
3139
|
+
settleTerminalChatRun();
|
|
3057
3140
|
yield {
|
|
3058
3141
|
content: [...content],
|
|
3059
3142
|
status: {
|
|
@@ -3101,15 +3184,19 @@ export function createAgentChatAdapter(options) {
|
|
|
3101
3184
|
}
|
|
3102
3185
|
if (runId && threadId) {
|
|
3103
3186
|
clearPendingTurnIfMatches(threadId, turnId);
|
|
3104
|
-
setActiveRun({ threadId, runId, lastSeq: -1 });
|
|
3187
|
+
setActiveRun({ threadId, runId, turnId, lastSeq: -1 });
|
|
3105
3188
|
}
|
|
3106
|
-
for await (const result of readSSEStream(res.body, content, toolCallCounter, tabId, (seq) => {
|
|
3189
|
+
for await (const result of readSSEStream(res.body, content, toolCallCounter, tabId, (seq, isProgress) => {
|
|
3107
3190
|
rememberRunSeq(seq);
|
|
3108
3191
|
if (runId && threadId) {
|
|
3109
|
-
updateActiveRunSeq(seq);
|
|
3192
|
+
updateActiveRunSeq(seq, isProgress);
|
|
3110
3193
|
}
|
|
3111
3194
|
}, runId, currentSSEOptions())) {
|
|
3112
|
-
|
|
3195
|
+
const nextResult = withRequestModeMetadata(result);
|
|
3196
|
+
if (isTerminalChatModelRunResult(nextResult)) {
|
|
3197
|
+
settleTerminalChatRun();
|
|
3198
|
+
}
|
|
3199
|
+
yield nextResult;
|
|
3113
3200
|
}
|
|
3114
3201
|
// Run completed normally — clear active run state
|
|
3115
3202
|
clearActiveRun();
|
|
@@ -3160,6 +3247,7 @@ export function createAgentChatAdapter(options) {
|
|
|
3160
3247
|
if (continuation.completedToolName) {
|
|
3161
3248
|
const message = completedToolTimeoutMessage(continuation.completedToolName);
|
|
3162
3249
|
content.push({ type: "text", text: message });
|
|
3250
|
+
settleTerminalChatRun();
|
|
3163
3251
|
yield {
|
|
3164
3252
|
content: [...content],
|
|
3165
3253
|
status: {
|
|
@@ -3220,6 +3308,7 @@ export function createAgentChatAdapter(options) {
|
|
|
3220
3308
|
// with the generic interruption copy.
|
|
3221
3309
|
preservedError ? errorCode : undefined),
|
|
3222
3310
|
});
|
|
3311
|
+
settleTerminalChatRun();
|
|
3223
3312
|
yield {
|
|
3224
3313
|
content: [...content],
|
|
3225
3314
|
status: {
|
|
@@ -3290,6 +3379,7 @@ export function createAgentChatAdapter(options) {
|
|
|
3290
3379
|
type: "text",
|
|
3291
3380
|
text: `Something went wrong: ${normalized.message}`,
|
|
3292
3381
|
});
|
|
3382
|
+
settleTerminalChatRun();
|
|
3293
3383
|
yield {
|
|
3294
3384
|
content: [...content],
|
|
3295
3385
|
status: {
|
|
@@ -3316,6 +3406,7 @@ export function createAgentChatAdapter(options) {
|
|
|
3316
3406
|
type: "text",
|
|
3317
3407
|
text: authErrorText(reason, errMsg),
|
|
3318
3408
|
});
|
|
3409
|
+
settleTerminalChatRun();
|
|
3319
3410
|
yield {
|
|
3320
3411
|
content: [...content],
|
|
3321
3412
|
status: {
|
|
@@ -3335,6 +3426,7 @@ export function createAgentChatAdapter(options) {
|
|
|
3335
3426
|
}));
|
|
3336
3427
|
}
|
|
3337
3428
|
content.push({ type: "text", text: failure.text });
|
|
3429
|
+
settleTerminalChatRun();
|
|
3338
3430
|
yield {
|
|
3339
3431
|
content: [...content],
|
|
3340
3432
|
status: {
|
|
@@ -3393,6 +3485,7 @@ export function createAgentChatAdapter(options) {
|
|
|
3393
3485
|
type: "text",
|
|
3394
3486
|
text: `Something went wrong: ${message}`,
|
|
3395
3487
|
});
|
|
3488
|
+
settleTerminalChatRun();
|
|
3396
3489
|
yield {
|
|
3397
3490
|
content: [...content],
|
|
3398
3491
|
status: {
|
|
@@ -3412,6 +3505,7 @@ export function createAgentChatAdapter(options) {
|
|
|
3412
3505
|
if (continuation.completedToolName) {
|
|
3413
3506
|
const message = completedToolTimeoutMessage(continuation.completedToolName);
|
|
3414
3507
|
content.push({ type: "text", text: message });
|
|
3508
|
+
settleTerminalChatRun();
|
|
3415
3509
|
yield {
|
|
3416
3510
|
content: [...content],
|
|
3417
3511
|
status: {
|
|
@@ -3453,6 +3547,7 @@ export function createAgentChatAdapter(options) {
|
|
|
3453
3547
|
type: "text",
|
|
3454
3548
|
text: `Something went wrong: ${message}`,
|
|
3455
3549
|
});
|
|
3550
|
+
settleTerminalChatRun();
|
|
3456
3551
|
yield {
|
|
3457
3552
|
content: [...content],
|
|
3458
3553
|
status: {
|
|
@@ -3512,6 +3607,7 @@ export function createAgentChatAdapter(options) {
|
|
|
3512
3607
|
? errMsg
|
|
3513
3608
|
: `Something went wrong: ${normalized.message}`,
|
|
3514
3609
|
});
|
|
3610
|
+
settleTerminalChatRun();
|
|
3515
3611
|
yield {
|
|
3516
3612
|
content: [...content],
|
|
3517
3613
|
status: {
|
|
@@ -3525,7 +3621,8 @@ export function createAgentChatAdapter(options) {
|
|
|
3525
3621
|
}
|
|
3526
3622
|
}
|
|
3527
3623
|
finally {
|
|
3528
|
-
if (typeof window !== "undefined") {
|
|
3624
|
+
if (typeof window !== "undefined" && ownsActiveRunState()) {
|
|
3625
|
+
dispatchTerminalChatUiCleanup(tabId);
|
|
3529
3626
|
window.dispatchEvent(new CustomEvent("agentNative.chatRunning", {
|
|
3530
3627
|
detail: { isRunning: false, tabId },
|
|
3531
3628
|
}));
|
|
@@ -42,7 +42,7 @@ export interface AgentChatMessage {
|
|
|
42
42
|
model?: string;
|
|
43
43
|
/** Engine preference paired with model for cross-provider switches. */
|
|
44
44
|
engine?: string;
|
|
45
|
-
/**
|
|
45
|
+
/** Effort preference paired with model. */
|
|
46
46
|
effort?: ReasoningEffort;
|
|
47
47
|
/**
|
|
48
48
|
* Execution mode for this submitted turn. When omitted, sendToAgentChat
|
|
@@ -264,6 +264,8 @@ function rememberStreamingText(resetKey, targetText, visibleText) {
|
|
|
264
264
|
if (oldestKey !== undefined)
|
|
265
265
|
smoothStreamingTextCache.delete(oldestKey);
|
|
266
266
|
}
|
|
267
|
+
/** Stable placeholder so the grapheme ref stays `string[]` before it is seeded. */
|
|
268
|
+
const EMPTY_GRAPHEMES = [];
|
|
267
269
|
export function useSmoothStreamingText(targetText, streaming, resetKey) {
|
|
268
270
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
269
271
|
const [visibleText, setVisibleText] = useState(() => {
|
|
@@ -276,9 +278,19 @@ export function useSmoothStreamingText(targetText, streaming, resetKey) {
|
|
|
276
278
|
return sliceGraphemes(targetText, graphemes, initialSmoothStreamingGraphemeCount(graphemes));
|
|
277
279
|
});
|
|
278
280
|
const visibleTextRef = useRef(visibleText);
|
|
279
|
-
const visibleCountRef = useRef(splitStreamingTextGraphemes(visibleText).length);
|
|
280
281
|
const targetTextRef = useRef(targetText);
|
|
281
|
-
|
|
282
|
+
// `useRef(expr)` evaluates `expr` on EVERY render and throws it away after
|
|
283
|
+
// mount. Segmenting here therefore ran a full Intl.Segmenter pass per commit
|
|
284
|
+
// — up to 60Hz per streaming message — and, because `visibleText` is a strict
|
|
285
|
+
// prefix of `targetText`, that pass could never hit the incremental path and
|
|
286
|
+
// evicted the shared segmenter cache for every other live stream too. Seed
|
|
287
|
+
// once; the streaming effect below keeps both refs authoritative after that.
|
|
288
|
+
const visibleCountRef = useRef(-1);
|
|
289
|
+
const targetGraphemesRef = useRef(EMPTY_GRAPHEMES);
|
|
290
|
+
if (visibleCountRef.current < 0) {
|
|
291
|
+
targetGraphemesRef.current = splitStreamingTextGraphemes(targetText);
|
|
292
|
+
visibleCountRef.current = splitStreamingTextGraphemes(visibleText).length;
|
|
293
|
+
}
|
|
282
294
|
const frameRef = useRef(null);
|
|
283
295
|
const lastCommitAtRef = useRef(0);
|
|
284
296
|
const pauseUntilRef = useRef(0);
|
|
@@ -49,15 +49,21 @@ export declare function shouldOfferRestore(args: {
|
|
|
49
49
|
* messages put it at `metadata.runId`.
|
|
50
50
|
*/
|
|
51
51
|
export declare function assistantMessageRunId(message: unknown): string | undefined;
|
|
52
|
+
/** Stable logical-turn identity shared by chained continuation run IDs. */
|
|
53
|
+
export declare function assistantMessageTurnId(message: unknown): string | undefined;
|
|
54
|
+
export declare function resolveAssistantRequestId(message: unknown, activeRun: {
|
|
55
|
+
threadId: string;
|
|
56
|
+
runId: string;
|
|
57
|
+
} | null, threadId: string): string | undefined;
|
|
52
58
|
export declare function MessageBranchPicker(): React.JSX.Element;
|
|
53
|
-
export declare function MessageActionsMenu({ showRevert, onRevert, }?: {
|
|
59
|
+
export declare function MessageActionsMenu({ showRevert, onRevert, threadId, }?: {
|
|
54
60
|
showRevert?: boolean;
|
|
55
61
|
onRevert?: () => void;
|
|
62
|
+
threadId?: string;
|
|
56
63
|
}): React.JSX.Element;
|
|
57
64
|
export declare function UserMessage(): React.JSX.Element | null;
|
|
58
65
|
export declare function messageTextFromContent(content: unknown): string;
|
|
59
66
|
export declare function isMissingFinalResponseWarningText(text: string): boolean;
|
|
60
|
-
export declare function completedAssistantToolNamesAfterLastText(content: readonly ContentPart[]): string[];
|
|
61
67
|
export declare function latestUserMessageText(messages: readonly unknown[]): string;
|
|
62
68
|
export declare function userMessageTextBeforeAssistant(messages: readonly unknown[], assistantMessageId: string): string;
|
|
63
69
|
export declare function assistantMessageHasUnresolvedTool(content: unknown): boolean;
|
|
@@ -67,9 +73,13 @@ export declare function computeActiveTailToolCallId(content: ContentPart[] | und
|
|
|
67
73
|
chatRunning: boolean;
|
|
68
74
|
isLast: boolean;
|
|
69
75
|
}): string | null;
|
|
70
|
-
export declare function shouldShowAssistantMessageFooter({ isLast, chatRunning, hasRenderableContent, statusIsTerminal, hasUnresolvedTool, }: {
|
|
76
|
+
export declare function shouldShowAssistantMessageFooter({ isLast, chatRunning, activeRunId, messageRunId, activeTurnId, messageTurnId, hasRenderableContent, statusIsTerminal, hasUnresolvedTool, }: {
|
|
71
77
|
isLast: boolean;
|
|
72
78
|
chatRunning: boolean;
|
|
79
|
+
activeRunId?: string | null;
|
|
80
|
+
messageRunId?: string;
|
|
81
|
+
activeTurnId?: string | null;
|
|
82
|
+
messageTurnId?: string;
|
|
73
83
|
hasRenderableContent: boolean;
|
|
74
84
|
statusIsTerminal: boolean;
|
|
75
85
|
hasUnresolvedTool?: boolean;
|