@agent-native/core 0.47.1 → 0.48.2
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/bin/agent-native.js +41 -0
- package/dist/a2a/handlers.js +2 -2
- package/dist/a2a/handlers.js.map +1 -1
- package/dist/a2a/server.js +2 -2
- package/dist/a2a/server.js.map +1 -1
- package/dist/action.d.ts +43 -2
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js.map +1 -1
- package/dist/agent/context-xray/actions/context-evict.d.ts +7 -1
- package/dist/agent/context-xray/actions/context-evict.d.ts.map +1 -1
- package/dist/agent/context-xray/actions/context-manifest-get.d.ts +4 -1
- package/dist/agent/context-xray/actions/context-manifest-get.d.ts.map +1 -1
- package/dist/agent/context-xray/actions/context-pin.d.ts +7 -1
- package/dist/agent/context-xray/actions/context-pin.d.ts.map +1 -1
- package/dist/agent/context-xray/actions/context-report.d.ts +12 -1
- package/dist/agent/context-xray/actions/context-report.d.ts.map +1 -1
- package/dist/agent/context-xray/actions/context-restore.d.ts +7 -1
- package/dist/agent/context-xray/actions/context-restore.d.ts.map +1 -1
- package/dist/agent/context-xray/apply-directives.d.ts.map +1 -1
- package/dist/agent/context-xray/apply-directives.js.map +1 -1
- package/dist/agent/context-xray/schema.d.ts +10 -10
- package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.js +26 -3
- package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
- package/dist/agent/engine/anthropic-engine.d.ts +1 -1
- package/dist/agent/engine/anthropic-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.d.ts +1 -1
- package/dist/agent/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.js +47 -8
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/agent/engine/builtin.js +1 -1
- package/dist/agent/engine/builtin.js.map +1 -1
- package/dist/agent/engine/output-tokens.d.ts +1 -1
- package/dist/agent/engine/output-tokens.d.ts.map +1 -1
- package/dist/agent/engine/output-tokens.js +6 -2
- package/dist/agent/engine/output-tokens.js.map +1 -1
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +7 -4
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/agent/engine/types.d.ts +19 -0
- package/dist/agent/engine/types.d.ts.map +1 -1
- package/dist/agent/engine/types.js +6 -0
- package/dist/agent/engine/types.js.map +1 -1
- package/dist/agent/model-config.d.ts +22 -14
- package/dist/agent/model-config.d.ts.map +1 -1
- package/dist/agent/model-config.js +113 -8
- package/dist/agent/model-config.js.map +1 -1
- package/dist/agent/production-agent.d.ts +19 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +253 -39
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-loop-with-resume.d.ts.map +1 -1
- package/dist/agent/run-loop-with-resume.js +10 -0
- package/dist/agent/run-loop-with-resume.js.map +1 -1
- package/dist/agent/run-manager.d.ts +1 -0
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +36 -9
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/run-store.d.ts +47 -4
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +154 -4
- package/dist/agent/run-store.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +57 -2
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/agent/types.d.ts +3 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/agent-web/generator.d.ts +3 -3
- package/dist/appearance/actions/change-appearance.d.ts +6 -1
- package/dist/appearance/actions/change-appearance.d.ts.map +1 -1
- package/dist/application-state/handlers.d.ts +2 -2
- package/dist/application-state/handlers.d.ts.map +1 -1
- package/dist/application-state/store.d.ts.map +1 -1
- package/dist/application-state/store.js +17 -0
- package/dist/application-state/store.js.map +1 -1
- package/dist/catalog.json +2 -1
- package/dist/cli/code-agent-commands.d.ts.map +1 -1
- package/dist/cli/code-agent-commands.js +2 -0
- package/dist/cli/code-agent-commands.js.map +1 -1
- package/dist/cli/code-agent-connector.js +7 -13
- package/dist/cli/code-agent-connector.js.map +1 -1
- package/dist/cli/code-agent-executor.d.ts +54 -2
- package/dist/cli/code-agent-executor.d.ts.map +1 -1
- package/dist/cli/code-agent-executor.js +504 -48
- package/dist/cli/code-agent-executor.js.map +1 -1
- package/dist/cli/code-agent-runs.d.ts +13 -0
- package/dist/cli/code-agent-runs.d.ts.map +1 -1
- package/dist/cli/code-agent-runs.js +36 -0
- package/dist/cli/code-agent-runs.js.map +1 -1
- package/dist/cli/code.js +59 -5
- package/dist/cli/code.js.map +1 -1
- package/dist/cli/connect.js +141 -3
- package/dist/cli/connect.js.map +1 -1
- package/dist/cli/index.js +0 -0
- package/dist/cli/pr-visual-recap-workflow.js +1 -1
- package/dist/cli/pr-visual-recap-workflow.js.map +1 -1
- package/dist/cli/recap.js +476 -46
- package/dist/cli/recap.js.map +1 -1
- package/dist/cli/skills.js +298 -179
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +29 -2
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AgentTaskCard.d.ts.map +1 -1
- package/dist/client/AgentTaskCard.js +17 -2
- package/dist/client/AgentTaskCard.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +310 -1732
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/CommandMenu.d.ts +1 -1
- package/dist/client/CommandMenu.d.ts.map +1 -1
- package/dist/client/CommandMenu.js +1 -1
- package/dist/client/CommandMenu.js.map +1 -1
- package/dist/client/HighlightedCodeBlock.d.ts +40 -0
- package/dist/client/HighlightedCodeBlock.d.ts.map +1 -0
- package/dist/client/HighlightedCodeBlock.js +110 -0
- package/dist/client/HighlightedCodeBlock.js.map +1 -0
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +8 -1
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/PoweredByBadge.d.ts +2 -2
- package/dist/client/PoweredByBadge.d.ts.map +1 -1
- package/dist/client/RunStuckBanner.d.ts +1 -1
- package/dist/client/RunStuckBanner.d.ts.map +1 -1
- package/dist/client/StarfieldBackground.d.ts.map +1 -1
- package/dist/client/StarfieldBackground.js +10 -5
- package/dist/client/StarfieldBackground.js.map +1 -1
- package/dist/client/Turnstile.d.ts +1 -1
- package/dist/client/Turnstile.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts +3 -2
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +13 -9
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/app-providers.d.ts +99 -0
- package/dist/client/app-providers.d.ts.map +1 -0
- package/dist/client/app-providers.js +19 -0
- package/dist/client/app-providers.js.map +1 -0
- package/dist/client/assistant-ui-recovery.d.ts +1 -1
- package/dist/client/auth-redirect-url.d.ts +1 -1
- package/dist/client/auth-redirect-url.d.ts.map +1 -1
- package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts +0 -19
- package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts.map +1 -1
- package/dist/client/blocks/library/AnnotatedCodeBlock.js +141 -55
- package/dist/client/blocks/library/AnnotatedCodeBlock.js.map +1 -1
- package/dist/client/blocks/library/DiffBlock.js +1 -1
- package/dist/client/blocks/library/DiffBlock.js.map +1 -1
- package/dist/client/blocks/library/FileTreeBlock.d.ts.map +1 -1
- package/dist/client/blocks/library/FileTreeBlock.js +1 -1
- package/dist/client/blocks/library/FileTreeBlock.js.map +1 -1
- package/dist/client/blocks/library/HighlightedCode.d.ts.map +1 -1
- package/dist/client/blocks/library/HighlightedCode.js +5 -3
- package/dist/client/blocks/library/HighlightedCode.js.map +1 -1
- package/dist/client/blocks/library/annotation-rail.d.ts +5 -4
- package/dist/client/blocks/library/annotation-rail.d.ts.map +1 -1
- package/dist/client/blocks/library/annotation-rail.js +22 -3
- package/dist/client/blocks/library/annotation-rail.js.map +1 -1
- package/dist/client/blocks/library/diagram.js +1 -1
- package/dist/client/blocks/library/diagram.js.map +1 -1
- package/dist/client/blocks/library/diff.config.d.ts +3 -2
- package/dist/client/blocks/library/diff.config.d.ts.map +1 -1
- package/dist/client/blocks/library/diff.config.js +4 -3
- package/dist/client/blocks/library/diff.config.js.map +1 -1
- package/dist/client/blocks/library/question-form.d.ts.map +1 -1
- package/dist/client/blocks/library/question-form.js +2 -1
- package/dist/client/blocks/library/question-form.js.map +1 -1
- package/dist/client/blocks/library/wireframe-kit.d.ts +1 -1
- package/dist/client/blocks/library/wireframe-kit.d.ts.map +1 -1
- package/dist/client/blocks/library/wireframe.js +1 -1
- package/dist/client/blocks/library/wireframe.js.map +1 -1
- package/dist/client/chat/attachment-adapters.d.ts +58 -0
- package/dist/client/chat/attachment-adapters.d.ts.map +1 -0
- package/dist/client/chat/attachment-adapters.js +331 -0
- package/dist/client/chat/attachment-adapters.js.map +1 -0
- package/dist/client/chat/index.d.ts +13 -0
- package/dist/client/chat/index.d.ts.map +1 -0
- package/dist/client/chat/index.js +13 -0
- package/dist/client/chat/index.js.map +1 -0
- package/dist/client/chat/markdown-renderer.d.ts +49 -0
- package/dist/client/chat/markdown-renderer.d.ts.map +1 -0
- package/dist/client/chat/markdown-renderer.js +391 -0
- package/dist/client/chat/markdown-renderer.js.map +1 -0
- package/dist/client/chat/message-components.d.ts +35 -0
- package/dist/client/chat/message-components.d.ts.map +1 -0
- package/dist/client/chat/message-components.js +452 -0
- package/dist/client/chat/message-components.js.map +1 -0
- package/dist/client/chat/repo-helpers.d.ts +41 -0
- package/dist/client/chat/repo-helpers.d.ts.map +1 -0
- package/dist/client/chat/repo-helpers.js +61 -0
- package/dist/client/chat/repo-helpers.js.map +1 -0
- package/dist/client/chat/run-recovery.d.ts +41 -0
- package/dist/client/chat/run-recovery.d.ts.map +1 -0
- package/dist/client/chat/run-recovery.js +348 -0
- package/dist/client/chat/run-recovery.js.map +1 -0
- package/dist/client/chat/tool-call-display.d.ts +34 -0
- package/dist/client/chat/tool-call-display.d.ts.map +1 -0
- package/dist/client/chat/tool-call-display.js +284 -0
- package/dist/client/chat/tool-call-display.js.map +1 -0
- package/dist/client/code-agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/code-agent-chat-adapter.js +20 -0
- package/dist/client/code-agent-chat-adapter.js.map +1 -1
- package/dist/client/collab/index.d.ts +10 -0
- package/dist/client/collab/index.d.ts.map +1 -0
- package/dist/client/collab/index.js +10 -0
- package/dist/client/collab/index.js.map +1 -0
- package/dist/client/components/AgentPresenceChip.d.ts +1 -1
- package/dist/client/components/AgentPresenceChip.d.ts.map +1 -1
- package/dist/client/components/ApiKeySettings.d.ts +1 -1
- package/dist/client/components/ApiKeySettings.d.ts.map +1 -1
- package/dist/client/components/CodeAgentIndicator.d.ts +1 -1
- package/dist/client/components/CodeAgentIndicator.d.ts.map +1 -1
- package/dist/client/components/CodeRequiredDialog.d.ts +1 -1
- package/dist/client/components/CodeRequiredDialog.d.ts.map +1 -1
- package/dist/client/components/LiveCursorOverlay.d.ts.map +1 -1
- package/dist/client/components/LiveCursorOverlay.js.map +1 -1
- package/dist/client/components/PresenceBar.d.ts +1 -1
- package/dist/client/components/PresenceBar.d.ts.map +1 -1
- package/dist/client/composer/PromptComposer.d.ts.map +1 -1
- package/dist/client/composer/PromptComposer.js +6 -26
- package/dist/client/composer/PromptComposer.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts +8 -2
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +21 -9
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/composer/VoiceButton.d.ts +2 -2
- package/dist/client/composer/VoiceButton.d.ts.map +1 -1
- package/dist/client/composer/index.d.ts +1 -1
- package/dist/client/composer/index.d.ts.map +1 -1
- package/dist/client/composer/index.js +1 -1
- package/dist/client/composer/index.js.map +1 -1
- package/dist/client/composer/use-skills.d.ts +1 -1
- package/dist/client/context-xray/ContextMeter.d.ts +1 -1
- package/dist/client/context-xray/ContextMeter.d.ts.map +1 -1
- package/dist/client/context-xray/ContextMeter.js +3 -3
- package/dist/client/context-xray/ContextMeter.js.map +1 -1
- package/dist/client/context-xray/ContextXRayPanel.d.ts.map +1 -1
- package/dist/client/context-xray/ContextXRayPanel.js +4 -3
- package/dist/client/context-xray/ContextXRayPanel.js.map +1 -1
- package/dist/client/context-xray/format.d.ts +11 -0
- package/dist/client/context-xray/format.d.ts.map +1 -1
- package/dist/client/context-xray/format.js +16 -0
- package/dist/client/context-xray/format.js.map +1 -1
- package/dist/client/conversation/AgentConversation.d.ts.map +1 -1
- package/dist/client/conversation/AgentConversation.js +8 -53
- package/dist/client/conversation/AgentConversation.js.map +1 -1
- package/dist/client/conversation/use-near-bottom-autoscroll.d.ts +1 -1
- package/dist/client/conversation/use-near-bottom-autoscroll.d.ts.map +1 -1
- package/dist/client/conversation/use-near-bottom-autoscroll.js +14 -1
- package/dist/client/conversation/use-near-bottom-autoscroll.js.map +1 -1
- package/dist/client/create-query-client.d.ts +28 -0
- package/dist/client/create-query-client.d.ts.map +1 -0
- package/dist/client/create-query-client.js +78 -0
- package/dist/client/create-query-client.js.map +1 -0
- package/dist/client/db-admin/DevDatabaseLink.d.ts +1 -1
- package/dist/client/db-admin/DevDatabaseLink.d.ts.map +1 -1
- package/dist/client/db-admin/RowSidePanel.d.ts +1 -1
- package/dist/client/db-admin/RowSidePanel.d.ts.map +1 -1
- package/dist/client/db-admin/RowSidePanel.js +2 -2
- package/dist/client/db-admin/RowSidePanel.js.map +1 -1
- package/dist/client/db-admin/TableEditor.d.ts +1 -1
- package/dist/client/db-admin/TableEditor.d.ts.map +1 -1
- package/dist/client/db-admin/TableEditor.js +1 -1
- package/dist/client/db-admin/TableEditor.js.map +1 -1
- package/dist/client/db-admin/cell-format.d.ts +1 -1
- package/dist/client/db-admin/cell-format.d.ts.map +1 -1
- package/dist/client/dev-overlay/DevOverlay.d.ts +1 -1
- package/dist/client/dev-overlay/DevOverlay.d.ts.map +1 -1
- package/dist/client/editor/index.d.ts +2 -0
- package/dist/client/editor/index.d.ts.map +1 -0
- package/dist/client/editor/index.js +2 -0
- package/dist/client/editor/index.js.map +1 -0
- package/dist/client/error-format.d.ts.map +1 -1
- package/dist/client/error-format.js +4 -0
- package/dist/client/error-format.js.map +1 -1
- package/dist/client/extensions/AgentNativeExtensionFrame.d.ts +1 -1
- package/dist/client/extensions/AgentNativeExtensionFrame.d.ts.map +1 -1
- package/dist/client/extensions/EmbeddedExtension.d.ts +1 -1
- package/dist/client/extensions/EmbeddedExtension.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionSlot.d.ts +1 -1
- package/dist/client/extensions/ExtensionSlot.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionViewerPage.d.ts +1 -1
- package/dist/client/extensions/ExtensionViewerPage.d.ts.map +1 -1
- package/dist/client/guided-questions.d.ts +6 -6
- package/dist/client/host-bridge.d.ts.map +1 -1
- package/dist/client/host-bridge.js +2 -0
- package/dist/client/host-bridge.js.map +1 -1
- package/dist/client/index.d.ts +7 -6
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +5 -3
- package/dist/client/index.js.map +1 -1
- package/dist/client/onboarding/OnboardingBanner.d.ts +1 -1
- package/dist/client/onboarding/OnboardingBanner.d.ts.map +1 -1
- package/dist/client/onboarding/OnboardingPanel.d.ts +1 -1
- package/dist/client/onboarding/OnboardingPanel.d.ts.map +1 -1
- package/dist/client/onboarding/SetupButton.d.ts +1 -1
- package/dist/client/onboarding/SetupButton.d.ts.map +1 -1
- package/dist/client/org/InvitationBanner.d.ts +1 -1
- package/dist/client/org/InvitationBanner.d.ts.map +1 -1
- package/dist/client/org/OrgSwitcher.d.ts +1 -1
- package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
- package/dist/client/org/RequireActiveOrg.d.ts +1 -1
- package/dist/client/org/RequireActiveOrg.d.ts.map +1 -1
- package/dist/client/org/hooks.d.ts +3 -3
- package/dist/client/org/hooks.d.ts.map +1 -1
- package/dist/client/progress/RunsTray.d.ts +2 -2
- package/dist/client/progress/RunsTray.d.ts.map +1 -1
- package/dist/client/progress/RunsTray.js +34 -9
- package/dist/client/progress/RunsTray.js.map +1 -1
- package/dist/client/resources/ResourceEditor.d.ts.map +1 -1
- package/dist/client/resources/ResourceEditor.js +1 -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 +2 -0
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts +1 -1
- package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/CodeBlockNode.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/CodeBlockNode.js +2 -1
- package/dist/client/rich-markdown-editor/CodeBlockNode.js.map +1 -1
- package/dist/client/rich-markdown-editor/ImageExtension.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/ImageExtension.js +2 -1
- package/dist/client/rich-markdown-editor/ImageExtension.js.map +1 -1
- package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts +1 -1
- package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js +1 -1
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +1 -1
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts +1 -1
- package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/SharedRichEditor.js +2 -3
- package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +1 -1
- package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts +1 -1
- package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts.map +1 -1
- package/dist/client/route-state.d.ts +12 -2
- package/dist/client/route-state.d.ts.map +1 -1
- package/dist/client/route-state.js +1 -1
- package/dist/client/route-state.js.map +1 -1
- package/dist/client/route-warmup.d.ts +1 -1
- package/dist/client/route-warmup.d.ts.map +1 -1
- package/dist/client/settings/VoiceTranscriptionSection.js +1 -1
- package/dist/client/settings/VoiceTranscriptionSection.js.map +1 -1
- package/dist/client/settings/useBuilderStatus.d.ts +2 -2
- package/dist/client/sharing/ShareDialog.d.ts +1 -1
- package/dist/client/sharing/ShareDialog.d.ts.map +1 -1
- package/dist/client/sse-event-processor.d.ts +8 -0
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +33 -10
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/client/terminal/AgentTerminal.d.ts +1 -1
- package/dist/client/terminal/AgentTerminal.d.ts.map +1 -1
- package/dist/client/terminal/AgentTerminal.js +4 -2
- package/dist/client/terminal/AgentTerminal.js.map +1 -1
- package/dist/client/tool-cells/BashCell.d.ts +25 -0
- package/dist/client/tool-cells/BashCell.d.ts.map +1 -0
- package/dist/client/tool-cells/BashCell.js +49 -0
- package/dist/client/tool-cells/BashCell.js.map +1 -0
- package/dist/client/tool-cells/EditCell.d.ts +24 -0
- package/dist/client/tool-cells/EditCell.d.ts.map +1 -0
- package/dist/client/tool-cells/EditCell.js +126 -0
- package/dist/client/tool-cells/EditCell.js.map +1 -0
- package/dist/client/tool-cells/FilesChangedSummary.d.ts +13 -0
- package/dist/client/tool-cells/FilesChangedSummary.d.ts.map +1 -0
- package/dist/client/tool-cells/FilesChangedSummary.js +98 -0
- package/dist/client/tool-cells/FilesChangedSummary.js.map +1 -0
- package/dist/client/tool-cells/WriteCell.d.ts +17 -0
- package/dist/client/tool-cells/WriteCell.d.ts.map +1 -0
- package/dist/client/tool-cells/WriteCell.js +26 -0
- package/dist/client/tool-cells/WriteCell.js.map +1 -0
- package/dist/client/tool-cells/index.d.ts +8 -0
- package/dist/client/tool-cells/index.d.ts.map +1 -0
- package/dist/client/tool-cells/index.js +5 -0
- package/dist/client/tool-cells/index.js.map +1 -0
- package/dist/client/transcription/BuilderTranscriptionCta.d.ts +1 -1
- package/dist/client/transcription/BuilderTranscriptionCta.d.ts.map +1 -1
- package/dist/client/use-chat-threads.d.ts +1 -1
- package/dist/client/use-chat-threads.d.ts.map +1 -1
- package/dist/client/use-chat-threads.js +11 -8
- package/dist/client/use-chat-threads.js.map +1 -1
- package/dist/client/use-db-sync.d.ts +2 -0
- package/dist/client/use-db-sync.d.ts.map +1 -1
- package/dist/client/use-db-sync.js +329 -302
- package/dist/client/use-db-sync.js.map +1 -1
- package/dist/code-agents/transcript-normalizer.d.ts +15 -1
- package/dist/code-agents/transcript-normalizer.d.ts.map +1 -1
- package/dist/code-agents/transcript-normalizer.js +47 -0
- package/dist/code-agents/transcript-normalizer.js.map +1 -1
- package/dist/coding-tools/index.d.ts +75 -0
- package/dist/coding-tools/index.d.ts.map +1 -1
- package/dist/coding-tools/index.js +137 -10
- package/dist/coding-tools/index.js.map +1 -1
- package/dist/collab/client.d.ts +1 -1
- package/dist/collab/client.js +20 -14
- package/dist/collab/client.js.map +1 -1
- package/dist/collab/ydoc-manager.d.ts +1 -1
- package/dist/collab/ydoc-manager.d.ts.map +1 -1
- package/dist/collab/ydoc-manager.js +1 -1
- package/dist/collab/ydoc-manager.js.map +1 -1
- package/dist/db/client.d.ts +9 -1
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +204 -48
- package/dist/db/client.js.map +1 -1
- package/dist/db/create-get-db.d.ts +38 -0
- package/dist/db/create-get-db.d.ts.map +1 -1
- package/dist/db/create-get-db.js +204 -4
- package/dist/db/create-get-db.js.map +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +159 -67
- package/dist/db/migrations.js.map +1 -1
- package/dist/demo/actions/toggle-demo-mode.d.ts +6 -1
- package/dist/demo/actions/toggle-demo-mode.d.ts.map +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +80 -39
- package/dist/deploy/build.js.map +1 -1
- package/dist/deploy/workspace-deploy.js +20 -10
- package/dist/deploy/workspace-deploy.js.map +1 -1
- package/dist/extensions/schema.d.ts +51 -51
- package/dist/extensions/slots/schema.d.ts +13 -13
- package/dist/file-upload/actions/upload-image.d.ts +26 -1
- package/dist/file-upload/actions/upload-image.d.ts.map +1 -1
- package/dist/file-upload/index.d.ts +1 -1
- package/dist/file-upload/index.d.ts.map +1 -1
- package/dist/file-upload/index.js +1 -1
- package/dist/file-upload/index.js.map +1 -1
- package/dist/file-upload/pre-upload-attachments.d.ts +37 -0
- package/dist/file-upload/pre-upload-attachments.d.ts.map +1 -1
- package/dist/file-upload/pre-upload-attachments.js +79 -19
- package/dist/file-upload/pre-upload-attachments.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/adapters/slack.js +1 -1
- package/dist/integrations/adapters/slack.js.map +1 -1
- package/dist/integrations/plugin.js +1 -1
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/jobs/scheduler.js +70 -21
- package/dist/jobs/scheduler.js.map +1 -1
- package/dist/mcp/actions/create-org-service-token.d.ts +14 -0
- package/dist/mcp/actions/create-org-service-token.d.ts.map +1 -0
- package/dist/mcp/actions/create-org-service-token.js +74 -0
- package/dist/mcp/actions/create-org-service-token.js.map +1 -0
- package/dist/mcp/actions/list-org-service-tokens.d.ts +17 -0
- package/dist/mcp/actions/list-org-service-tokens.d.ts.map +1 -0
- package/dist/mcp/actions/list-org-service-tokens.js +42 -0
- package/dist/mcp/actions/list-org-service-tokens.js.map +1 -0
- package/dist/mcp/actions/revoke-org-service-token.d.ts +7 -0
- package/dist/mcp/actions/revoke-org-service-token.d.ts.map +1 -0
- package/dist/mcp/actions/revoke-org-service-token.js +28 -0
- package/dist/mcp/actions/revoke-org-service-token.js.map +1 -0
- package/dist/mcp/actions/service-token-access.d.ts +24 -0
- package/dist/mcp/actions/service-token-access.d.ts.map +1 -0
- package/dist/mcp/actions/service-token-access.js +63 -0
- package/dist/mcp/actions/service-token-access.js.map +1 -0
- package/dist/mcp/build-server.d.ts +42 -11
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +53 -3
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/mcp/connect-route.d.ts +35 -0
- package/dist/mcp/connect-route.d.ts.map +1 -1
- package/dist/mcp/connect-route.js +57 -2
- package/dist/mcp/connect-route.js.map +1 -1
- package/dist/mcp/connect-store.d.ts +43 -0
- package/dist/mcp/connect-store.d.ts.map +1 -1
- package/dist/mcp/connect-store.js +129 -12
- package/dist/mcp/connect-store.js.map +1 -1
- package/dist/mcp/oauth-token.d.ts +10 -0
- package/dist/mcp/oauth-token.d.ts.map +1 -1
- package/dist/mcp/oauth-token.js +2 -0
- package/dist/mcp/oauth-token.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +3 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp-client/routes.js +1 -1
- package/dist/mcp-client/routes.js.map +1 -1
- package/dist/org/context.d.ts +4 -0
- package/dist/org/context.d.ts.map +1 -1
- package/dist/org/context.js +10 -0
- package/dist/org/context.js.map +1 -1
- package/dist/org/handlers.d.ts +11 -7
- package/dist/org/handlers.d.ts.map +1 -1
- package/dist/org/handlers.js +0 -8
- package/dist/org/handlers.js.map +1 -1
- package/dist/org/migrations.d.ts.map +1 -1
- package/dist/org/migrations.js +8 -0
- package/dist/org/migrations.js.map +1 -1
- package/dist/org/schema.d.ts +15 -15
- package/dist/progress/actions.d.ts.map +1 -1
- package/dist/progress/actions.js +13 -5
- package/dist/progress/actions.js.map +1 -1
- package/dist/provider-api/actions/delete-staged-dataset.d.ts +9 -0
- package/dist/provider-api/actions/delete-staged-dataset.d.ts.map +1 -0
- package/dist/provider-api/actions/delete-staged-dataset.js +35 -0
- package/dist/provider-api/actions/delete-staged-dataset.js.map +1 -0
- package/dist/provider-api/actions/list-staged-datasets.d.ts +15 -0
- package/dist/provider-api/actions/list-staged-datasets.d.ts.map +1 -0
- package/dist/provider-api/actions/list-staged-datasets.js +41 -0
- package/dist/provider-api/actions/list-staged-datasets.js.map +1 -0
- package/dist/provider-api/actions/query-staged-dataset.d.ts +29 -0
- package/dist/provider-api/actions/query-staged-dataset.d.ts.map +1 -0
- package/dist/provider-api/actions/query-staged-dataset.js +116 -0
- package/dist/provider-api/actions/query-staged-dataset.js.map +1 -0
- package/dist/provider-api/custom-registry.d.ts.map +1 -1
- package/dist/provider-api/custom-registry.js.map +1 -1
- package/dist/provider-api/index.d.ts +10 -10
- package/dist/provider-api/index.js +0 -5
- package/dist/provider-api/index.js.map +1 -1
- package/dist/provider-api/staged-datasets-aggregate.d.ts +46 -0
- package/dist/provider-api/staged-datasets-aggregate.d.ts.map +1 -0
- package/dist/provider-api/staged-datasets-aggregate.js +209 -0
- package/dist/provider-api/staged-datasets-aggregate.js.map +1 -0
- package/dist/provider-api/staged-datasets-store.d.ts +76 -0
- package/dist/provider-api/staged-datasets-store.d.ts.map +1 -0
- package/dist/provider-api/staged-datasets-store.js +319 -0
- package/dist/provider-api/staged-datasets-store.js.map +1 -0
- package/dist/provider-api/staging.d.ts +100 -0
- package/dist/provider-api/staging.d.ts.map +1 -0
- package/dist/provider-api/staging.js +281 -0
- package/dist/provider-api/staging.js.map +1 -0
- package/dist/resources/handlers.d.ts.map +1 -1
- package/dist/resources/handlers.js +13 -1
- package/dist/resources/handlers.js.map +1 -1
- package/dist/scripts/call-agent.d.ts.map +1 -1
- package/dist/scripts/call-agent.js +1 -2
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/scripts/resources/migrate-learnings.d.ts +1 -1
- package/dist/scripts/resources/migrate-learnings.d.ts.map +1 -1
- package/dist/scripts/resources/migrate-learnings.js +1 -1
- package/dist/scripts/resources/migrate-learnings.js.map +1 -1
- package/dist/secrets/schema.d.ts +7 -7
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +14 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +3 -2
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +33 -0
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +251 -180
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-discovery.d.ts.map +1 -1
- package/dist/server/agent-discovery.js +13 -16
- package/dist/server/agent-discovery.js.map +1 -1
- package/dist/server/agent-teams-run-queue.d.ts +31 -8
- package/dist/server/agent-teams-run-queue.d.ts.map +1 -1
- package/dist/server/agent-teams-run-queue.js +61 -18
- package/dist/server/agent-teams-run-queue.js.map +1 -1
- package/dist/server/agent-teams.d.ts +27 -1
- package/dist/server/agent-teams.d.ts.map +1 -1
- package/dist/server/agent-teams.js +214 -14
- package/dist/server/agent-teams.js.map +1 -1
- package/dist/server/app-base-path.d.ts +20 -0
- package/dist/server/app-base-path.d.ts.map +1 -1
- package/dist/server/app-base-path.js +36 -0
- package/dist/server/app-base-path.js.map +1 -1
- package/dist/server/attachment-actions.d.ts +43 -0
- package/dist/server/attachment-actions.d.ts.map +1 -0
- package/dist/server/attachment-actions.js +214 -0
- package/dist/server/attachment-actions.js.map +1 -0
- package/dist/server/auth.js +1 -1
- package/dist/server/auth.js.map +1 -1
- package/dist/server/complete-text.d.ts +56 -0
- package/dist/server/complete-text.d.ts.map +1 -0
- package/dist/server/complete-text.js +147 -0
- package/dist/server/complete-text.js.map +1 -0
- package/dist/server/core-routes-plugin.d.ts +4 -0
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +49 -29
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/cors-origins.d.ts.map +1 -1
- package/dist/server/cors-origins.js +6 -1
- package/dist/server/cors-origins.js.map +1 -1
- package/dist/server/create-server.d.ts.map +1 -1
- package/dist/server/create-server.js +2 -1
- package/dist/server/create-server.js.map +1 -1
- package/dist/server/csrf.d.ts +1 -1
- package/dist/server/csrf.d.ts.map +1 -1
- package/dist/server/email-actions.d.ts +19 -0
- package/dist/server/email-actions.d.ts.map +1 -0
- package/dist/server/email-actions.js +191 -0
- package/dist/server/email-actions.js.map +1 -0
- package/dist/server/embed-route.js +1 -1
- package/dist/server/embed-route.js.map +1 -1
- package/dist/server/embed-session.d.ts.map +1 -1
- package/dist/server/embed-session.js +5 -1
- package/dist/server/embed-session.js.map +1 -1
- package/dist/server/entry-server.d.ts +24 -0
- package/dist/server/entry-server.d.ts.map +1 -0
- package/dist/server/entry-server.js +54 -0
- package/dist/server/entry-server.js.map +1 -0
- package/dist/server/framework-request-handler.d.ts.map +1 -1
- package/dist/server/framework-request-handler.js +2 -10
- package/dist/server/framework-request-handler.js.map +1 -1
- package/dist/server/google-oauth.d.ts.map +1 -1
- package/dist/server/google-oauth.js +2 -9
- package/dist/server/google-oauth.js.map +1 -1
- package/dist/server/google-realtime-session.d.ts.map +1 -1
- package/dist/server/google-realtime-session.js +6 -4
- package/dist/server/google-realtime-session.js.map +1 -1
- package/dist/server/h3-helpers.d.ts +39 -0
- package/dist/server/h3-helpers.d.ts.map +1 -1
- package/dist/server/h3-helpers.js +104 -1
- package/dist/server/h3-helpers.js.map +1 -1
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +1 -8
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/open-route.d.ts.map +1 -1
- package/dist/server/open-route.js +1 -0
- package/dist/server/open-route.js.map +1 -1
- package/dist/server/prompts/framework-core-compact.d.ts +19 -0
- package/dist/server/prompts/framework-core-compact.d.ts.map +1 -0
- package/dist/server/prompts/framework-core-compact.js +69 -0
- package/dist/server/prompts/framework-core-compact.js.map +1 -0
- package/dist/server/prompts/framework-core.d.ts +26 -0
- package/dist/server/prompts/framework-core.d.ts.map +1 -0
- package/dist/server/prompts/framework-core.js +130 -0
- package/dist/server/prompts/framework-core.js.map +1 -0
- package/dist/server/prompts/index.d.ts +9 -0
- package/dist/server/prompts/index.d.ts.map +1 -0
- package/dist/server/prompts/index.js +9 -0
- package/dist/server/prompts/index.js.map +1 -0
- package/dist/server/prompts/model-overlays.d.ts +18 -0
- package/dist/server/prompts/model-overlays.d.ts.map +1 -0
- package/dist/server/prompts/model-overlays.js +46 -0
- package/dist/server/prompts/model-overlays.js.map +1 -0
- package/dist/server/prompts/shared-rules.d.ts +29 -0
- package/dist/server/prompts/shared-rules.d.ts.map +1 -0
- package/dist/server/prompts/shared-rules.js +54 -0
- package/dist/server/prompts/shared-rules.js.map +1 -0
- package/dist/server/security-headers.d.ts +7 -1
- package/dist/server/security-headers.d.ts.map +1 -1
- package/dist/server/security-headers.js +11 -0
- package/dist/server/security-headers.js.map +1 -1
- package/dist/server/ssr-handler.d.ts.map +1 -1
- package/dist/server/ssr-handler.js +135 -46
- package/dist/server/ssr-handler.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts.map +1 -1
- package/dist/server/transcribe-voice.js +7 -4
- package/dist/server/transcribe-voice.js.map +1 -1
- package/dist/settings/store.d.ts.map +1 -1
- package/dist/settings/store.js +9 -0
- package/dist/settings/store.js.map +1 -1
- package/dist/shared/markdown-block-split.d.ts +39 -0
- package/dist/shared/markdown-block-split.d.ts.map +1 -0
- package/dist/shared/markdown-block-split.js +97 -0
- package/dist/shared/markdown-block-split.js.map +1 -0
- package/dist/shared/reasoning-effort.js +13 -1
- package/dist/shared/reasoning-effort.js.map +1 -1
- package/dist/shared/streaming-text-smoothing.d.ts +18 -0
- package/dist/shared/streaming-text-smoothing.d.ts.map +1 -1
- package/dist/shared/streaming-text-smoothing.js +70 -4
- package/dist/shared/streaming-text-smoothing.js.map +1 -1
- package/dist/sharing/actions/list-resource-shares.d.ts +24 -1
- package/dist/sharing/actions/list-resource-shares.d.ts.map +1 -1
- package/dist/sharing/actions/set-resource-visibility.d.ts +8 -1
- package/dist/sharing/actions/set-resource-visibility.d.ts.map +1 -1
- package/dist/sharing/actions/share-resource.d.ts +12 -1
- package/dist/sharing/actions/share-resource.d.ts.map +1 -1
- package/dist/sharing/actions/unshare-resource.d.ts +8 -1
- package/dist/sharing/actions/unshare-resource.d.ts.map +1 -1
- package/dist/sharing/schema.d.ts +10 -10
- package/dist/styles/agent-conversation.css +239 -0
- package/dist/templates/default/.agents/skills/delegate-to-agent/SKILL.md +50 -2
- package/dist/templates/default/AGENTS.md +1 -1
- package/dist/templates/default/DEVELOPING.md +19 -0
- package/dist/templates/default/app/entry.client.tsx +4 -1
- package/dist/templates/default/app/entry.server.tsx +4 -56
- package/dist/templates/default/app/global.css +3 -2
- package/dist/templates/default/app/root.tsx +8 -24
- package/dist/templates/default/app/routes/_index.tsx +0 -13
- package/dist/templates/default/package.json +6 -5
- package/dist/templates/default/tsconfig.json +2 -1
- package/dist/templates/starter-shell-sync.spec.ts +118 -0
- package/dist/templates/ui-primitives-sync.spec.ts +399 -0
- package/dist/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +50 -2
- package/dist/terminal/pty-server.js +1 -1
- package/dist/terminal/pty-server.js.map +1 -1
- package/dist/triggers/dispatcher.js +1 -1
- package/dist/triggers/dispatcher.js.map +1 -1
- package/dist/usage/store.d.ts.map +1 -1
- package/dist/usage/store.js +60 -7
- package/dist/usage/store.js.map +1 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +44 -12
- package/dist/vite/client.js.map +1 -1
- package/dist/workspace-files/schema.d.ts +8 -8
- package/dist/workspace-files/tool.d.ts.map +1 -1
- package/dist/workspace-files/tool.js +0 -1
- package/dist/workspace-files/tool.js.map +1 -1
- package/docs/content/a2a-protocol.md +18 -12
- package/docs/content/actions.md +42 -10
- package/docs/content/agent-mentions.md +7 -8
- package/docs/content/agent-teams.md +23 -37
- package/docs/content/agent-web-surfaces.md +18 -9
- package/docs/content/authentication.md +6 -17
- package/docs/content/automations.md +43 -15
- package/docs/content/cli-adapters.md +25 -24
- package/docs/content/client.md +66 -17
- package/docs/content/cloneable-saas.md +19 -23
- package/docs/content/code-agents-ui.md +3 -31
- package/docs/content/components.md +308 -0
- package/docs/content/context-awareness.md +4 -0
- package/docs/content/creating-templates.md +4 -2
- package/docs/content/cross-app-sso.md +45 -19
- package/docs/content/database.md +26 -1
- package/docs/content/deployment.md +3 -1
- package/docs/content/dispatch.md +9 -37
- package/docs/content/drop-in-agent.md +123 -2
- package/docs/content/embedding-sdk.md +35 -0
- package/docs/content/extensions.md +2 -2
- package/docs/content/external-agents.md +86 -171
- package/docs/content/faq.md +6 -27
- package/docs/content/frames.md +9 -12
- package/docs/content/getting-started.md +80 -77
- package/docs/content/key-concepts.md +29 -19
- package/docs/content/mcp-apps.md +103 -0
- package/docs/content/mcp-clients.md +2 -2
- package/docs/content/mcp-protocol.md +40 -17
- package/docs/content/messaging.md +11 -4
- package/docs/content/migration-workbench.md +4 -47
- package/docs/content/multi-app-workspace.md +48 -17
- package/docs/content/multi-tenancy.md +1 -1
- package/docs/content/notifications.md +8 -6
- package/docs/content/observability.md +26 -15
- package/docs/content/onboarding.md +7 -1
- package/docs/content/pr-visual-recap.md +203 -23
- package/docs/content/progress.md +5 -5
- package/docs/content/pure-agent-apps.md +3 -1
- package/docs/content/real-time-collaboration.md +106 -0
- package/docs/content/recurring-jobs.md +17 -1
- package/docs/content/security.md +17 -3
- package/docs/content/server.md +39 -3
- package/docs/content/sharing.md +20 -1
- package/docs/content/skills-guide.md +151 -125
- package/docs/content/template-analytics.md +8 -0
- package/docs/content/template-assets.md +2 -0
- package/docs/content/template-brain.md +59 -3
- package/docs/content/template-calendar.md +8 -0
- package/docs/content/template-clips.md +11 -2
- package/docs/content/template-content.md +24 -4
- package/docs/content/template-design.md +19 -17
- package/docs/content/template-dispatch.md +2 -0
- package/docs/content/template-forms.md +28 -1
- package/docs/content/template-mail.md +17 -0
- package/docs/content/template-plan.md +177 -10
- package/docs/content/template-slides.md +51 -12
- package/docs/content/template-videos.md +17 -0
- package/docs/content/tracking.md +17 -13
- package/docs/content/using-your-agent.md +15 -5
- package/docs/content/voice-input.md +1 -1
- package/docs/content/what-is-agent-native.md +5 -6
- package/docs/content/workspace-connections.md +138 -424
- package/docs/content/workspace-management.md +12 -128
- package/docs/content/workspace.md +125 -199
- package/docs/content/writing-agent-instructions.md +17 -1
- package/package.json +25 -6
- package/src/templates/default/.agents/skills/delegate-to-agent/SKILL.md +50 -2
- package/src/templates/default/AGENTS.md +1 -1
- package/src/templates/default/DEVELOPING.md +19 -0
- package/src/templates/default/app/entry.client.tsx +4 -1
- package/src/templates/default/app/entry.server.tsx +4 -56
- package/src/templates/default/app/global.css +3 -2
- package/src/templates/default/app/root.tsx +8 -24
- package/src/templates/default/app/routes/_index.tsx +0 -13
- package/src/templates/default/package.json +6 -5
- package/src/templates/default/tsconfig.json +2 -1
- package/src/templates/starter-shell-sync.spec.ts +118 -0
- package/src/templates/ui-primitives-sync.spec.ts +399 -0
- package/src/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +50 -2
- package/tsconfig.base.json +2 -10
- package/dist/cli/app-skill.d.ts +0 -157
- package/dist/cli/app-skill.d.ts.map +0 -1
- package/dist/cli/audit-agent-web.d.ts +0 -2
- package/dist/cli/audit-agent-web.d.ts.map +0 -1
- package/dist/cli/code-agent-connector.d.ts +0 -17
- package/dist/cli/code-agent-connector.d.ts.map +0 -1
- package/dist/cli/code.d.ts +0 -66
- package/dist/cli/code.d.ts.map +0 -1
- package/dist/cli/connect.d.ts +0 -140
- package/dist/cli/connect.d.ts.map +0 -1
- package/dist/cli/context-xray-local.d.ts +0 -16
- package/dist/cli/context-xray-local.d.ts.map +0 -1
- package/dist/cli/create-workspace.d.ts +0 -8
- package/dist/cli/create-workspace.d.ts.map +0 -1
- package/dist/cli/index.d.ts +0 -3
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/info.d.ts +0 -2
- package/dist/cli/info.d.ts.map +0 -1
- package/dist/cli/mcp-config-writers.d.ts +0 -82
- package/dist/cli/mcp-config-writers.d.ts.map +0 -1
- package/dist/cli/mcp.d.ts +0 -16
- package/dist/cli/mcp.d.ts.map +0 -1
- package/dist/cli/migrate.d.ts +0 -38
- package/dist/cli/migrate.d.ts.map +0 -1
- package/dist/cli/plan-local.d.ts +0 -43
- package/dist/cli/plan-local.d.ts.map +0 -1
- package/dist/cli/plan-publish-store.d.ts +0 -62
- package/dist/cli/plan-publish-store.d.ts.map +0 -1
- package/dist/cli/pr-visual-recap-workflow.d.ts +0 -11
- package/dist/cli/pr-visual-recap-workflow.d.ts.map +0 -1
- package/dist/cli/recap.d.ts +0 -297
- package/dist/cli/recap.d.ts.map +0 -1
- package/dist/cli/skills.d.ts +0 -162
- package/dist/cli/skills.d.ts.map +0 -1
- package/dist/cli/workspace-dev.d.ts +0 -96
- package/dist/cli/workspace-dev.d.ts.map +0 -1
|
@@ -1,23 +1,43 @@
|
|
|
1
1
|
import { createToolSearchEntry, TOOL_SEARCH_ACTION_NAME, } from "../agent/tool-search.js";
|
|
2
|
-
import { createCodingToolRegistry, isReadOnlyShellCommand, runCodingCommand, truncateCodingOutput, } from "../coding-tools/index.js";
|
|
2
|
+
import { createCodingToolRegistry, isReadOnlyShellCommand, runCodingCommand, truncateBashOutput, truncateCodingOutput, } from "../coding-tools/index.js";
|
|
3
3
|
import { buildMergedConfig, McpClientManager, mcpToolsToActionEntries, } from "../mcp-client/index.js";
|
|
4
4
|
import { runWithRequestContext } from "../server/request-context.js";
|
|
5
5
|
import { actionsToEngineTools, runAgentLoop, } from "../agent/production-agent.js";
|
|
6
6
|
import { resolveEngine, getStoredModelForEngine, registerBuiltinEngines, } from "../agent/engine/index.js";
|
|
7
7
|
import { PROVIDER_ENV_VARS } from "../agent/engine/provider-env-vars.js";
|
|
8
|
+
import { DEFAULT_AGENT_MAX_ITERATIONS } from "../agent/loop-settings.js";
|
|
9
|
+
import { readAgentsBundleFromFs, generateSkillsPromptBlock, } from "../server/agents-bundle.js";
|
|
8
10
|
import { isReasoningEffort, } from "../shared/reasoning-effort.js";
|
|
9
11
|
import { formatPromptWithAttachments, } from "../code-agents/prompt-attachments.js";
|
|
10
|
-
import { appendCodeAgentTranscriptEvent, dequeueCodeAgentFollowUp, getCodeAgentRunRecord, listCodeAgentTranscriptEvents, updateCodeAgentRunRecord, } from "./code-agent-runs.js";
|
|
12
|
+
import { addCodeAgentCommandToAllowlist, appendCodeAgentTranscriptEvent, dequeueCodeAgentFollowUp, getCodeAgentRunRecord, isCodeAgentCommandAllowed, listCodeAgentTranscriptEvents, updateCodeAgentRunRecord, } from "./code-agent-runs.js";
|
|
11
13
|
import { createCodeAgentOutputSmoother } from "./code-agent-output-smoother.js";
|
|
12
14
|
const DEFAULT_COMMAND_TIMEOUT_MS = 120_000;
|
|
13
15
|
const MAX_TOOL_OUTPUT_CHARS = 50_000;
|
|
14
16
|
const MAX_FILE_READ_CHARS = 120_000;
|
|
17
|
+
/**
|
|
18
|
+
* Number of most-recent transcript events reconstructed as native
|
|
19
|
+
* EngineMessage objects (with proper tool-call / tool-result pairing).
|
|
20
|
+
* Events older than this cap are summarised into a single compact text
|
|
21
|
+
* preamble so the model retains broad context without token waste.
|
|
22
|
+
*/
|
|
23
|
+
const STRUCTURED_HISTORY_RECENT_EVENTS = 40;
|
|
24
|
+
/**
|
|
25
|
+
* Per-tool-result text cap when reconstructing history. Matches the overall
|
|
26
|
+
* tool-output cap so old results don't balloon the context.
|
|
27
|
+
*/
|
|
28
|
+
const STRUCTURED_HISTORY_RESULT_CAP = MAX_TOOL_OUTPUT_CHARS;
|
|
15
29
|
export async function executeCodeAgentRun(options) {
|
|
16
30
|
const existing = getCodeAgentRunRecord(options.runId);
|
|
17
31
|
if (!existing)
|
|
18
32
|
return null;
|
|
19
33
|
const prompt = options.prompt ?? latestUserPrompt(existing.id);
|
|
20
|
-
const
|
|
34
|
+
const rawAttachments = options.attachments ?? latestUserPromptAttachments(existing.id, prompt);
|
|
35
|
+
// Split attachments: images (dataUrl) go as engine image parts; text/file
|
|
36
|
+
// attachments are still inlined into the prompt text. This prevents 2 MB
|
|
37
|
+
// images from consuming ~700 K tokens of garbage when treated as plain text.
|
|
38
|
+
const imageAttachments = rawAttachments.filter((a) => a.dataUrl);
|
|
39
|
+
const textOnlyAttachments = rawAttachments.filter((a) => !a.dataUrl);
|
|
40
|
+
const executionPrompt = formatPromptWithAttachments(prompt, textOnlyAttachments);
|
|
21
41
|
if (!prompt) {
|
|
22
42
|
appendCodeAgentTranscriptEvent({
|
|
23
43
|
runId: existing.id,
|
|
@@ -95,14 +115,23 @@ export async function executeCodeAgentRun(options) {
|
|
|
95
115
|
const reasoningEffort = options.reasoningEffort ?? metadataReasoningEffort(existing);
|
|
96
116
|
const cwd = existing.cwd || process.cwd();
|
|
97
117
|
const permissionMode = existing.permissionMode ?? "full-auto";
|
|
98
|
-
|
|
118
|
+
// Holds structured metadata emitted by the coding tools side-channel.
|
|
119
|
+
// Keyed by tool name; consumed when the matching tool_start / tool_done fires.
|
|
120
|
+
const pendingToolMeta = new Map();
|
|
121
|
+
const actions = createLocalCodeAgentActions(cwd, permissionMode, existing.id, (toolName, _phase, meta) => {
|
|
122
|
+
// Both "start" and "done" phases update the map; done has richer data.
|
|
123
|
+
pendingToolMeta.set(toolName, meta);
|
|
124
|
+
}, (chunk) => {
|
|
125
|
+
// Stream incremental bash output to stdout for the terminal smoother
|
|
126
|
+
options.stdout?.write(chunk);
|
|
127
|
+
});
|
|
99
128
|
const mcpManager = await startCodeAgentMcpManager(existing.id);
|
|
100
129
|
if (mcpManager) {
|
|
101
130
|
Object.assign(actions, mcpToolsToActionEntries(mcpManager));
|
|
102
131
|
}
|
|
103
132
|
actions[TOOL_SEARCH_ACTION_NAME] = createToolSearchEntry(() => actions);
|
|
104
133
|
const tools = actionsToEngineTools(actions);
|
|
105
|
-
const messages = buildCodeAgentMessages(existing, executionPrompt);
|
|
134
|
+
const messages = buildCodeAgentMessages(existing, executionPrompt, imageAttachments);
|
|
106
135
|
const controller = new AbortController();
|
|
107
136
|
const abortFromParent = () => controller.abort();
|
|
108
137
|
if (options.signal) {
|
|
@@ -113,12 +142,43 @@ export async function executeCodeAgentRun(options) {
|
|
|
113
142
|
}
|
|
114
143
|
let assistantText = "";
|
|
115
144
|
const outputSmoother = createCodeAgentOutputSmoother(options.stdout);
|
|
145
|
+
// Accumulate thinking text across deltas so we can persist a single event
|
|
146
|
+
// per reasoning block rather than one event per delta chunk.
|
|
147
|
+
let pendingThinkingText = "";
|
|
148
|
+
let thinkingFlushTimer;
|
|
149
|
+
const runId = existing.id;
|
|
150
|
+
function flushThinkingEvent() {
|
|
151
|
+
thinkingFlushTimer = undefined;
|
|
152
|
+
const text = pendingThinkingText.trim();
|
|
153
|
+
pendingThinkingText = "";
|
|
154
|
+
if (!text)
|
|
155
|
+
return;
|
|
156
|
+
appendCodeAgentTranscriptEvent({
|
|
157
|
+
runId,
|
|
158
|
+
kind: "status",
|
|
159
|
+
message: text,
|
|
160
|
+
metadata: { type: "thinking" },
|
|
161
|
+
});
|
|
162
|
+
}
|
|
116
163
|
const send = (event) => {
|
|
117
164
|
if (event.type === "text") {
|
|
165
|
+
// Flush any buffered thinking when real content arrives.
|
|
166
|
+
if (thinkingFlushTimer !== undefined) {
|
|
167
|
+
clearTimeout(thinkingFlushTimer);
|
|
168
|
+
flushThinkingEvent();
|
|
169
|
+
}
|
|
118
170
|
assistantText += event.text;
|
|
119
171
|
outputSmoother.write(event.text);
|
|
120
172
|
return;
|
|
121
173
|
}
|
|
174
|
+
if (event.type === "thinking") {
|
|
175
|
+
pendingThinkingText += event.text;
|
|
176
|
+
// Debounce: flush 300ms after the last delta so rapid chunks are merged.
|
|
177
|
+
if (thinkingFlushTimer !== undefined)
|
|
178
|
+
clearTimeout(thinkingFlushTimer);
|
|
179
|
+
thinkingFlushTimer = setTimeout(flushThinkingEvent, 300);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
122
182
|
if (event.type === "activity") {
|
|
123
183
|
appendCodeAgentTranscriptEvent({
|
|
124
184
|
runId: existing.id,
|
|
@@ -129,15 +189,24 @@ export async function executeCodeAgentRun(options) {
|
|
|
129
189
|
return;
|
|
130
190
|
}
|
|
131
191
|
if (event.type === "tool_start") {
|
|
192
|
+
const startMeta = pendingToolMeta.get(event.tool ?? "");
|
|
132
193
|
appendCodeAgentTranscriptEvent({
|
|
133
194
|
runId: existing.id,
|
|
134
195
|
kind: "status",
|
|
135
196
|
message: `Running ${event.tool}.`,
|
|
136
|
-
metadata: {
|
|
197
|
+
metadata: {
|
|
198
|
+
type: "tool_start",
|
|
199
|
+
tool: event.tool,
|
|
200
|
+
input: event.input,
|
|
201
|
+
...(startMeta ? { structuredMeta: startMeta } : {}),
|
|
202
|
+
},
|
|
137
203
|
});
|
|
138
204
|
return;
|
|
139
205
|
}
|
|
140
206
|
if (event.type === "tool_done") {
|
|
207
|
+
const pendingMeta = pendingToolMeta.get(event.tool ?? "");
|
|
208
|
+
if (pendingMeta)
|
|
209
|
+
pendingToolMeta.delete(event.tool ?? "");
|
|
141
210
|
appendCodeAgentTranscriptEvent({
|
|
142
211
|
runId: existing.id,
|
|
143
212
|
kind: "status",
|
|
@@ -145,8 +214,9 @@ export async function executeCodeAgentRun(options) {
|
|
|
145
214
|
metadata: {
|
|
146
215
|
type: "tool_done",
|
|
147
216
|
tool: event.tool,
|
|
148
|
-
result: truncateCodingOutput(event.result,
|
|
217
|
+
result: truncateBashOutput(truncateCodingOutput(event.result, MAX_TOOL_OUTPUT_CHARS)),
|
|
149
218
|
...(event.mcpApp ? { mcpApp: event.mcpApp } : {}),
|
|
219
|
+
...(pendingMeta ? { structuredMeta: pendingMeta } : {}),
|
|
150
220
|
},
|
|
151
221
|
});
|
|
152
222
|
return;
|
|
@@ -160,19 +230,31 @@ export async function executeCodeAgentRun(options) {
|
|
|
160
230
|
});
|
|
161
231
|
}
|
|
162
232
|
};
|
|
233
|
+
let loopUsage = null;
|
|
163
234
|
try {
|
|
164
|
-
await
|
|
235
|
+
const systemPrompt = await buildCodeAgentSystemPrompt(cwd, permissionMode);
|
|
236
|
+
const usageResult = await runWithOptionalCodeAgentRequestContext(existing, () => runAgentLoop({
|
|
165
237
|
engine,
|
|
166
238
|
model,
|
|
167
|
-
systemPrompt
|
|
239
|
+
systemPrompt,
|
|
168
240
|
tools,
|
|
169
241
|
actions,
|
|
170
242
|
messages,
|
|
171
243
|
send,
|
|
172
244
|
signal: controller.signal,
|
|
173
|
-
maxIterations:
|
|
245
|
+
maxIterations: DEFAULT_AGENT_MAX_ITERATIONS,
|
|
174
246
|
reasoningEffort,
|
|
175
247
|
}));
|
|
248
|
+
loopUsage = usageResult ?? null;
|
|
249
|
+
// Persist cumulative token totals from this turn into the run record so
|
|
250
|
+
// the UI can display per-run usage statistics.
|
|
251
|
+
if (loopUsage) {
|
|
252
|
+
updateCodeAgentRunRecord(existing.id, (record) => ({
|
|
253
|
+
metadata: {
|
|
254
|
+
tokenUsage: accumulateTokenUsage(record.metadata?.tokenUsage, loopUsage),
|
|
255
|
+
},
|
|
256
|
+
}));
|
|
257
|
+
}
|
|
176
258
|
await outputSmoother.flush();
|
|
177
259
|
if (assistantText.trim()) {
|
|
178
260
|
options.stdout?.write("\n");
|
|
@@ -296,6 +378,10 @@ export async function executeCodeAgentRun(options) {
|
|
|
296
378
|
});
|
|
297
379
|
}
|
|
298
380
|
finally {
|
|
381
|
+
if (thinkingFlushTimer !== undefined) {
|
|
382
|
+
clearTimeout(thinkingFlushTimer);
|
|
383
|
+
flushThinkingEvent();
|
|
384
|
+
}
|
|
299
385
|
outputSmoother.cancel();
|
|
300
386
|
options.signal?.removeEventListener("abort", abortFromParent);
|
|
301
387
|
await mcpManager?.stop().catch(() => undefined);
|
|
@@ -305,6 +391,24 @@ export async function executeCodeAgentRun(options) {
|
|
|
305
391
|
export async function executeExistingCodeAgentRun(runId, options = {}) {
|
|
306
392
|
return executeCodeAgentRun({ ...options, runId, appendUserEvent: false });
|
|
307
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* Add the pending approval command to the per-project allowlist, then approve
|
|
396
|
+
* and auto-resume. Future occurrences of this exact command will bypass the
|
|
397
|
+
* approval gate without prompting.
|
|
398
|
+
*/
|
|
399
|
+
export async function executeApproveAlwaysCodeAgentApproval(runId, options = {}) {
|
|
400
|
+
const approval = getPendingApproval(runId);
|
|
401
|
+
if (approval?.command) {
|
|
402
|
+
addCodeAgentCommandToAllowlist(approval.command);
|
|
403
|
+
appendCodeAgentTranscriptEvent({
|
|
404
|
+
runId,
|
|
405
|
+
kind: "status",
|
|
406
|
+
message: `Command added to allowlist: ${approval.command}`,
|
|
407
|
+
metadata: { type: "allowlist-added", command: approval.command },
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
return executePendingCodeAgentApproval(runId, options);
|
|
411
|
+
}
|
|
308
412
|
export async function executePendingCodeAgentApproval(runId, options = {}) {
|
|
309
413
|
const record = getCodeAgentRunRecord(runId);
|
|
310
414
|
if (!record)
|
|
@@ -360,24 +464,19 @@ export async function executePendingCodeAgentApproval(runId, options = {}) {
|
|
|
360
464
|
kind: "status",
|
|
361
465
|
message: summary,
|
|
362
466
|
metadata: {
|
|
363
|
-
status:
|
|
467
|
+
status: "running",
|
|
364
468
|
phase: "approval-complete",
|
|
365
469
|
approvalId: approval.id,
|
|
366
470
|
exitCode: result.code,
|
|
367
471
|
timedOut: result.timedOut,
|
|
368
472
|
},
|
|
369
473
|
});
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
474
|
+
// Clear the pending approval and immediately auto-resume so the model sees
|
|
475
|
+
// the command result and can continue — no manual "Resume" click needed.
|
|
476
|
+
updateCodeAgentRunRecord(runId, {
|
|
477
|
+
status: "running",
|
|
478
|
+
phase: "approval-resuming",
|
|
373
479
|
needsApproval: false,
|
|
374
|
-
progress: {
|
|
375
|
-
label: result.code === 0 ? "Approval complete" : "Approval failed",
|
|
376
|
-
completed: result.code === 0 ? 1 : 0,
|
|
377
|
-
total: 1,
|
|
378
|
-
failed: result.code === 0 ? 0 : 1,
|
|
379
|
-
percent: result.code === 0 ? 100 : 0,
|
|
380
|
-
},
|
|
381
480
|
metadata: {
|
|
382
481
|
pendingApproval: undefined,
|
|
383
482
|
lastApproval: {
|
|
@@ -387,6 +486,61 @@ export async function executePendingCodeAgentApproval(runId, options = {}) {
|
|
|
387
486
|
},
|
|
388
487
|
},
|
|
389
488
|
});
|
|
489
|
+
appendCodeAgentTranscriptEvent({
|
|
490
|
+
runId,
|
|
491
|
+
kind: "status",
|
|
492
|
+
message: "Resuming run after approval.",
|
|
493
|
+
metadata: { status: "running", phase: "approval-resuming" },
|
|
494
|
+
});
|
|
495
|
+
return executeExistingCodeAgentRun(runId, { stdout: options.stdout });
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Deny a pending approval: record the denial, feed it back to the model as a
|
|
499
|
+
* "command denied by user" result, and immediately resume the run so the model
|
|
500
|
+
* can adapt its plan without leaving the run dangling.
|
|
501
|
+
*/
|
|
502
|
+
export async function executeDenyCodeAgentApproval(runId, options = {}) {
|
|
503
|
+
const record = getCodeAgentRunRecord(runId);
|
|
504
|
+
if (!record)
|
|
505
|
+
return null;
|
|
506
|
+
const approval = getPendingApproval(runId);
|
|
507
|
+
if (!approval) {
|
|
508
|
+
options.stdout?.write("No pending approval was found for this run.\n");
|
|
509
|
+
return record;
|
|
510
|
+
}
|
|
511
|
+
const message = `User denied command: ${approval.command} (${approval.reason})`;
|
|
512
|
+
options.stdout?.write(`${message}\n`);
|
|
513
|
+
appendCodeAgentTranscriptEvent({
|
|
514
|
+
runId,
|
|
515
|
+
kind: "status",
|
|
516
|
+
message,
|
|
517
|
+
metadata: {
|
|
518
|
+
status: "running",
|
|
519
|
+
phase: "approval-denied",
|
|
520
|
+
approvalId: approval.id,
|
|
521
|
+
command: approval.command,
|
|
522
|
+
},
|
|
523
|
+
});
|
|
524
|
+
updateCodeAgentRunRecord(runId, {
|
|
525
|
+
status: "running",
|
|
526
|
+
phase: "approval-denied-resuming",
|
|
527
|
+
needsApproval: false,
|
|
528
|
+
metadata: {
|
|
529
|
+
pendingApproval: undefined,
|
|
530
|
+
lastApproval: {
|
|
531
|
+
...approval,
|
|
532
|
+
deniedAt: new Date().toISOString(),
|
|
533
|
+
denied: true,
|
|
534
|
+
},
|
|
535
|
+
},
|
|
536
|
+
});
|
|
537
|
+
appendCodeAgentTranscriptEvent({
|
|
538
|
+
runId,
|
|
539
|
+
kind: "status",
|
|
540
|
+
message: "Resuming run after denial — model will adapt its plan.",
|
|
541
|
+
metadata: { status: "running", phase: "approval-denied-resuming" },
|
|
542
|
+
});
|
|
543
|
+
return executeExistingCodeAgentRun(runId, { stdout: options.stdout });
|
|
390
544
|
}
|
|
391
545
|
function latestUserPrompt(runId) {
|
|
392
546
|
const events = listCodeAgentTranscriptEvents(runId);
|
|
@@ -537,35 +691,321 @@ function createFakeCodeAgentEngine(text) {
|
|
|
537
691
|
},
|
|
538
692
|
};
|
|
539
693
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
const
|
|
553
|
-
|
|
694
|
+
const SUPPORTED_IMAGE_MEDIA_TYPES = new Set([
|
|
695
|
+
"image/jpeg",
|
|
696
|
+
"image/jpg",
|
|
697
|
+
"image/png",
|
|
698
|
+
"image/gif",
|
|
699
|
+
"image/webp",
|
|
700
|
+
]);
|
|
701
|
+
function buildCodeAgentMessages(run, prompt, attachments) {
|
|
702
|
+
const allEvents = listCodeAgentTranscriptEvents(run.id);
|
|
703
|
+
// Split events into an "older" prefix (summarised) and a "recent" tail
|
|
704
|
+
// (reconstructed as native structured messages).
|
|
705
|
+
const splitAt = Math.max(0, allEvents.length - STRUCTURED_HISTORY_RECENT_EVENTS);
|
|
706
|
+
const olderEvents = allEvents.slice(0, splitAt);
|
|
707
|
+
const recentEvents = allEvents.slice(splitAt);
|
|
708
|
+
// Build a compact text preamble from any events that pre-date the recent
|
|
709
|
+
// window. Reuses the old flat-text approach so the model still has broad
|
|
710
|
+
// context without paying for full token cost on every old tool result.
|
|
711
|
+
let preamble = "";
|
|
712
|
+
if (olderEvents.length > 0) {
|
|
713
|
+
const summaryLines = olderEvents
|
|
714
|
+
.filter((e) => e.kind === "user" ||
|
|
715
|
+
(e.kind === "system" && e.metadata?.role === "assistant") ||
|
|
716
|
+
(e.kind === "status" &&
|
|
717
|
+
(e.metadata?.type === "tool_done" ||
|
|
718
|
+
e.metadata?.role === "assistant")))
|
|
719
|
+
.map((e) => {
|
|
720
|
+
if (e.kind === "user")
|
|
721
|
+
return `User: ${e.message}`;
|
|
722
|
+
if (e.metadata?.role === "assistant")
|
|
723
|
+
return `Assistant: ${e.message}`;
|
|
724
|
+
if (e.metadata?.type === "tool_done") {
|
|
725
|
+
const tool = e.metadata?.tool;
|
|
726
|
+
const result = e.metadata?.result;
|
|
727
|
+
const resultText = typeof result === "string"
|
|
728
|
+
? truncateCodingOutput(result, 500)
|
|
729
|
+
: result != null
|
|
730
|
+
? truncateCodingOutput(String(result), 500)
|
|
731
|
+
: "";
|
|
732
|
+
return tool ? `Tool[${tool}]: ${resultText}` : `Tool: ${resultText}`;
|
|
733
|
+
}
|
|
734
|
+
return null;
|
|
735
|
+
})
|
|
736
|
+
.filter((line) => line !== null);
|
|
737
|
+
if (summaryLines.length > 0) {
|
|
738
|
+
preamble = `Earlier conversation summary:\n${summaryLines.join("\n")}`;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
// Reconstruct the recent events as native EngineMessage objects.
|
|
742
|
+
// We build up a sequence of user/assistant messages, pairing tool-call
|
|
743
|
+
// events (from tool_start metadata) with their matching tool-result events
|
|
744
|
+
// (from tool_done metadata), and accumulating assistant text from system
|
|
745
|
+
// events with role=assistant.
|
|
746
|
+
const structuredMessages = buildStructuredMessagesFromEvents(recentEvents);
|
|
747
|
+
// Separate image attachments from text attachments. Images are passed as
|
|
748
|
+
// proper EngineImagePart entries rather than inlined base64 text (which
|
|
749
|
+
// would consume ~700K tokens per megabyte of image data).
|
|
750
|
+
const imageParts = [];
|
|
751
|
+
const unsupportedImageNotes = [];
|
|
752
|
+
for (const att of attachments ?? []) {
|
|
753
|
+
if (!att.dataUrl)
|
|
754
|
+
continue;
|
|
755
|
+
const match = att.dataUrl.match(/^data:(image\/[^;]+);base64,(.+)$/);
|
|
756
|
+
if (!match)
|
|
757
|
+
continue;
|
|
758
|
+
const mime = match[1].toLowerCase();
|
|
759
|
+
if (SUPPORTED_IMAGE_MEDIA_TYPES.has(mime)) {
|
|
760
|
+
imageParts.push({
|
|
761
|
+
type: "image",
|
|
762
|
+
data: match[2],
|
|
763
|
+
mediaType: mime,
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
else {
|
|
767
|
+
// Unsupported format — inject a note so the model understands what happened.
|
|
768
|
+
const label = att.name ? `"${att.name}"` : "An image";
|
|
769
|
+
unsupportedImageNotes.push(`[${label} could not be processed — unsupported image format (${mime}). ` +
|
|
770
|
+
`Only JPEG, PNG, GIF, and WebP are supported.]`);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
const notesBlock = unsupportedImageNotes.length > 0
|
|
774
|
+
? `\n\n${unsupportedImageNotes.join("\n")}`
|
|
554
775
|
: "";
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
776
|
+
// The current prompt (plus optional preamble) becomes the final user message.
|
|
777
|
+
const promptText = [preamble, prompt, notesBlock]
|
|
778
|
+
.filter(Boolean)
|
|
779
|
+
.join("\n\n");
|
|
780
|
+
const promptContent = [...imageParts, { type: "text", text: promptText }];
|
|
781
|
+
// If there are structured messages from the recent window and the last one
|
|
782
|
+
// is a user message that already contains the current prompt (happens when
|
|
783
|
+
// appendUserEvent added a "user" event that got included), de-duplicate by
|
|
784
|
+
// using the structured messages as-is but replacing the last user message's
|
|
785
|
+
// content with the enriched content (images + prompt).
|
|
786
|
+
if (structuredMessages.length > 0) {
|
|
787
|
+
const lastMsg = structuredMessages[structuredMessages.length - 1];
|
|
788
|
+
if (lastMsg.role === "user") {
|
|
789
|
+
// Replace last user message content with the enriched prompt content.
|
|
790
|
+
structuredMessages[structuredMessages.length - 1] = {
|
|
791
|
+
role: "user",
|
|
792
|
+
content: promptContent,
|
|
793
|
+
};
|
|
794
|
+
return structuredMessages;
|
|
795
|
+
}
|
|
796
|
+
// Last message is assistant — append a new user message.
|
|
797
|
+
return [...structuredMessages, { role: "user", content: promptContent }];
|
|
798
|
+
}
|
|
799
|
+
return [{ role: "user", content: promptContent }];
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Reconstruct a sequence of EngineMessage objects from transcript events,
|
|
803
|
+
* preserving the native tool-call / tool-result pair structure that models
|
|
804
|
+
* expect when replaying multi-turn conversations.
|
|
805
|
+
*
|
|
806
|
+
* Event mapping:
|
|
807
|
+
* kind=user → user message with text content
|
|
808
|
+
* kind=system, role=assistant → assistant message with text content
|
|
809
|
+
* kind=status, type=tool_start → assistant message with a tool-call part
|
|
810
|
+
* (grouped with any preceding assistant text)
|
|
811
|
+
* kind=status, type=tool_done → user message with a tool-result part
|
|
812
|
+
* kind=status, type=thinking → excluded (ephemeral reasoning)
|
|
813
|
+
* everything else → excluded from model history
|
|
814
|
+
*
|
|
815
|
+
* Each tool_start generates a synthetic toolCallId derived from the event id so
|
|
816
|
+
* that the matching tool_done can reference it. Old events that lack tool/input
|
|
817
|
+
* metadata fall back gracefully to text content.
|
|
818
|
+
*/
|
|
819
|
+
/** @internal exported for unit tests */
|
|
820
|
+
export function buildStructuredMessagesFromEvents(events) {
|
|
821
|
+
const pending = [];
|
|
822
|
+
// Track in-flight tool-call IDs keyed by event id so tool_done can
|
|
823
|
+
// reference the corresponding call.
|
|
824
|
+
const toolCallIdByEventOrder = new Map();
|
|
825
|
+
for (const event of events) {
|
|
826
|
+
// Exclude thinking — ephemeral reasoning, never replayed to model.
|
|
827
|
+
if (event.kind === "status" && event.metadata?.type === "thinking") {
|
|
828
|
+
continue;
|
|
829
|
+
}
|
|
830
|
+
if (event.kind === "user") {
|
|
831
|
+
const text = event.message.trim();
|
|
832
|
+
if (!text)
|
|
833
|
+
continue;
|
|
834
|
+
appendOrMerge(pending, "user", { type: "text", text });
|
|
835
|
+
continue;
|
|
836
|
+
}
|
|
837
|
+
// Assistant text (persisted after a turn completes).
|
|
838
|
+
if (event.kind === "system" && event.metadata?.role === "assistant") {
|
|
839
|
+
const text = event.message.trim();
|
|
840
|
+
if (!text)
|
|
841
|
+
continue;
|
|
842
|
+
appendOrMerge(pending, "assistant", { type: "text", text });
|
|
843
|
+
continue;
|
|
844
|
+
}
|
|
845
|
+
// Tool call start — emit an assistant tool-call part.
|
|
846
|
+
if (event.kind === "status" && event.metadata?.type === "tool_start") {
|
|
847
|
+
const tool = typeof event.metadata?.tool === "string" && event.metadata.tool
|
|
848
|
+
? event.metadata.tool
|
|
849
|
+
: null;
|
|
850
|
+
if (!tool)
|
|
851
|
+
continue;
|
|
852
|
+
// Generate a stable ID from the event id so tool_done can reference it.
|
|
853
|
+
const toolCallId = `tc-${event.id}`;
|
|
854
|
+
toolCallIdByEventOrder.set(event.id, toolCallId);
|
|
855
|
+
const input = event.metadata?.input != null ? event.metadata.input : {};
|
|
856
|
+
appendOrMerge(pending, "assistant", {
|
|
857
|
+
type: "tool-call",
|
|
858
|
+
id: toolCallId,
|
|
859
|
+
name: tool,
|
|
860
|
+
input,
|
|
861
|
+
});
|
|
862
|
+
continue;
|
|
863
|
+
}
|
|
864
|
+
// Tool result — emit a user tool-result part paired with the last
|
|
865
|
+
// unmatched tool_start for the same tool name.
|
|
866
|
+
if (event.kind === "status" && event.metadata?.type === "tool_done") {
|
|
867
|
+
const tool = typeof event.metadata?.tool === "string" && event.metadata.tool
|
|
868
|
+
? event.metadata.tool
|
|
869
|
+
: null;
|
|
870
|
+
if (!tool)
|
|
871
|
+
continue;
|
|
872
|
+
// Find the most recent tool_start event id for this tool.
|
|
873
|
+
const matchedCallId = findMatchingToolCallId(toolCallIdByEventOrder, events, event, tool);
|
|
874
|
+
const rawResult = event.metadata?.result;
|
|
875
|
+
const resultText = truncateCodingOutput(typeof rawResult === "string"
|
|
876
|
+
? rawResult
|
|
877
|
+
: rawResult != null
|
|
878
|
+
? String(rawResult)
|
|
879
|
+
: "(no output)", STRUCTURED_HISTORY_RESULT_CAP);
|
|
880
|
+
if (matchedCallId) {
|
|
881
|
+
const toolInput = event.metadata?.input != null
|
|
882
|
+
? safeJsonStringify(event.metadata.input)
|
|
883
|
+
: "{}";
|
|
884
|
+
appendOrMerge(pending, "user", {
|
|
885
|
+
type: "tool-result",
|
|
886
|
+
toolCallId: matchedCallId,
|
|
887
|
+
toolName: tool,
|
|
888
|
+
toolInput,
|
|
889
|
+
content: resultText,
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
else {
|
|
893
|
+
// Orphaned tool result (no matching call in the recent window) — fall
|
|
894
|
+
// back to plain text so the model still sees the output.
|
|
895
|
+
appendOrMerge(pending, "user", {
|
|
560
896
|
type: "text",
|
|
561
|
-
text:
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
897
|
+
text: `[Tool result for ${tool}]: ${resultText}`,
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
continue;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
return pending;
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* Append a content part to the last message if it has the same role, or
|
|
907
|
+
* start a new message otherwise.
|
|
908
|
+
*/
|
|
909
|
+
function appendOrMerge(pending, role, part) {
|
|
910
|
+
const last = pending[pending.length - 1];
|
|
911
|
+
if (last && last.role === role) {
|
|
912
|
+
last.content.push(part);
|
|
913
|
+
}
|
|
914
|
+
else {
|
|
915
|
+
pending.push({ role, content: [part] });
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Find the toolCallId generated for the most recent tool_start event that
|
|
920
|
+
* matches the given tool name and precedes the current tool_done event.
|
|
921
|
+
* Returns null if no match exists in the recent window.
|
|
922
|
+
*/
|
|
923
|
+
function findMatchingToolCallId(toolCallIdByEventOrder, events, doneEvent, toolName) {
|
|
924
|
+
// Walk backwards from doneEvent's position to find the nearest unmatched start.
|
|
925
|
+
const doneIndex = events.indexOf(doneEvent);
|
|
926
|
+
for (let i = doneIndex - 1; i >= 0; i--) {
|
|
927
|
+
const e = events[i];
|
|
928
|
+
if (e.kind === "status" &&
|
|
929
|
+
e.metadata?.type === "tool_start" &&
|
|
930
|
+
e.metadata?.tool === toolName) {
|
|
931
|
+
const id = toolCallIdByEventOrder.get(e.id);
|
|
932
|
+
if (id) {
|
|
933
|
+
// Consume it so a second done for the same tool gets the next start.
|
|
934
|
+
toolCallIdByEventOrder.delete(e.id);
|
|
935
|
+
return id;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
return null;
|
|
940
|
+
}
|
|
941
|
+
function safeJsonStringify(value) {
|
|
942
|
+
try {
|
|
943
|
+
return JSON.stringify(value) ?? "{}";
|
|
944
|
+
}
|
|
945
|
+
catch {
|
|
946
|
+
return "{}";
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Maximum character length for inlined AGENTS.md content in the system prompt.
|
|
951
|
+
* Content beyond this cap is truncated with a note so the model knows more exists.
|
|
952
|
+
*/
|
|
953
|
+
const AGENTS_MD_INLINE_CAP = 16_000;
|
|
954
|
+
/**
|
|
955
|
+
* Build the coding agent system prompt, inlining AGENTS.md (or CLAUDE.md as
|
|
956
|
+
* fallback) and a skills index from .agents/skills/ into the prompt so the
|
|
957
|
+
* coding agent has the same repo-context awareness that Claude Code / Codex
|
|
958
|
+
* provide when running locally.
|
|
959
|
+
*
|
|
960
|
+
* The bundle is read synchronously from the filesystem via `readAgentsBundleFromFs`
|
|
961
|
+
* (same function used by the Vite build-time plugin) so there is no async I/O
|
|
962
|
+
* on the hot path — the call is cheap and the result is used once per run leg.
|
|
963
|
+
*/
|
|
964
|
+
/** @internal exported for unit tests */
|
|
965
|
+
export async function buildCodeAgentSystemPrompt(cwd, permissionMode) {
|
|
966
|
+
const bundle = readAgentsBundleFromFs(cwd);
|
|
967
|
+
// If the bundle has no AGENTS.md, try CLAUDE.md as a fallback — many repos
|
|
968
|
+
// use that name for agent instructions (e.g. Claude Code projects).
|
|
969
|
+
let agentsMdContent = bundle.agentsMd;
|
|
970
|
+
if (!agentsMdContent.trim()) {
|
|
971
|
+
try {
|
|
972
|
+
const fs = await import("node:fs");
|
|
973
|
+
const path = await import("node:path");
|
|
974
|
+
const claudeMdPath = path.join(cwd, "CLAUDE.md");
|
|
975
|
+
if (fs.existsSync(claudeMdPath)) {
|
|
976
|
+
agentsMdContent = fs.readFileSync(claudeMdPath, "utf-8");
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
catch {
|
|
980
|
+
// Not readable — skip
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
const repoInstructionsBlock = buildRepoInstructionsBlock(agentsMdContent);
|
|
984
|
+
const skillsBlock = generateSkillsPromptBlock(bundle);
|
|
985
|
+
return codeAgentSystemPrompt(cwd, permissionMode, repoInstructionsBlock, skillsBlock);
|
|
566
986
|
}
|
|
567
|
-
|
|
987
|
+
/** @internal exported for unit tests */
|
|
988
|
+
export function buildRepoInstructionsBlock(agentsMdContent) {
|
|
989
|
+
if (!agentsMdContent.trim())
|
|
990
|
+
return "";
|
|
991
|
+
const needsTruncation = agentsMdContent.length > AGENTS_MD_INLINE_CAP;
|
|
992
|
+
const truncated = needsTruncation
|
|
993
|
+
? agentsMdContent.slice(0, AGENTS_MD_INLINE_CAP)
|
|
994
|
+
: agentsMdContent;
|
|
995
|
+
const truncationNote = needsTruncation
|
|
996
|
+
? `\n\n[Note: AGENTS.md was truncated to ${AGENTS_MD_INLINE_CAP} characters. Read the full file for complete instructions.]`
|
|
997
|
+
: "";
|
|
998
|
+
return `## Repository instructions
|
|
999
|
+
|
|
1000
|
+
${truncated}${truncationNote}`;
|
|
1001
|
+
}
|
|
1002
|
+
/** @internal exported for unit tests */
|
|
1003
|
+
export function codeAgentSystemPrompt(cwd, permissionMode, repoInstructionsBlock = "", skillsBlock = "") {
|
|
568
1004
|
const mode = permissionMode === "read-only" ? "Plan" : "Auto";
|
|
1005
|
+
const repoSection = repoInstructionsBlock
|
|
1006
|
+
? `\n\n${repoInstructionsBlock}`
|
|
1007
|
+
: "";
|
|
1008
|
+
const skillsSection = skillsBlock ? `\n\n${skillsBlock}` : "";
|
|
569
1009
|
return `You are Agent-Native Code, a coding agent running in ${cwd}. You and the user share one workspace, and your job is to collaborate with them until their goal is genuinely handled.
|
|
570
1010
|
|
|
571
1011
|
# General
|
|
@@ -619,9 +1059,9 @@ Current run mode: ${mode} mode (${permissionMode}).
|
|
|
619
1059
|
- Reference files as clickable paths (e.g. \`packages/core/src/foo.ts\`), with a line number when it helps. Do not paste large file contents back — the user shares this machine and can open them.
|
|
620
1060
|
- State what you changed, and show evidence you verified it: name the check you ran (e.g. \`pnpm typecheck\`) and its key result, not just a claim that it passed. If you could not run something, say so plainly.
|
|
621
1061
|
- No emojis or em dashes unless the user used them first.
|
|
622
|
-
-
|
|
1062
|
+
- AGENTS.md files take precedence over these defaults on conflict. More deeply nested AGENTS.md files take precedence over shallower ones — check for them in directories you work in.${repoSection}${skillsSection}`;
|
|
623
1063
|
}
|
|
624
|
-
function createLocalCodeAgentActions(cwd, permissionMode, runId) {
|
|
1064
|
+
function createLocalCodeAgentActions(cwd, permissionMode, runId, onToolMetadata, onBashOutputChunk) {
|
|
625
1065
|
const actions = createCodingToolRegistry({
|
|
626
1066
|
cwd,
|
|
627
1067
|
restrictToCwd: true,
|
|
@@ -629,6 +1069,8 @@ function createLocalCodeAgentActions(cwd, permissionMode, runId) {
|
|
|
629
1069
|
maxOutputChars: MAX_TOOL_OUTPUT_CHARS,
|
|
630
1070
|
maxFileReadChars: MAX_FILE_READ_CHARS,
|
|
631
1071
|
canWrite: (toolName) => permissionErrorForWrite(permissionMode, toolName),
|
|
1072
|
+
onToolMetadata,
|
|
1073
|
+
onBashOutputChunk,
|
|
632
1074
|
beforeBash: ({ command }) => {
|
|
633
1075
|
const permission = classifyCodeAgentCommandPermission(command);
|
|
634
1076
|
if (permission.kind === "forbidden") {
|
|
@@ -640,6 +1082,9 @@ function createLocalCodeAgentActions(cwd, permissionMode, runId) {
|
|
|
640
1082
|
return permissionError;
|
|
641
1083
|
}
|
|
642
1084
|
if (permission.kind === "approval-required") {
|
|
1085
|
+
// Skip the approval gate when the user has allowlisted this command.
|
|
1086
|
+
if (isCodeAgentCommandAllowed(command))
|
|
1087
|
+
return null;
|
|
643
1088
|
const approval = requestCodeAgentApproval(runId, {
|
|
644
1089
|
tool: "bash",
|
|
645
1090
|
command,
|
|
@@ -791,4 +1236,15 @@ function getPendingApproval(runId) {
|
|
|
791
1236
|
: "full-auto",
|
|
792
1237
|
};
|
|
793
1238
|
}
|
|
1239
|
+
function accumulateTokenUsage(existing, next) {
|
|
1240
|
+
const prev = existing && typeof existing === "object" && !Array.isArray(existing)
|
|
1241
|
+
? existing
|
|
1242
|
+
: {};
|
|
1243
|
+
return {
|
|
1244
|
+
inputTokens: (prev.inputTokens ?? 0) + next.inputTokens,
|
|
1245
|
+
outputTokens: (prev.outputTokens ?? 0) + next.outputTokens,
|
|
1246
|
+
cacheReadTokens: (prev.cacheReadTokens ?? 0) + next.cacheReadTokens,
|
|
1247
|
+
cacheWriteTokens: (prev.cacheWriteTokens ?? 0) + next.cacheWriteTokens,
|
|
1248
|
+
};
|
|
1249
|
+
}
|
|
794
1250
|
//# sourceMappingURL=code-agent-executor.js.map
|