@agent-native/core 0.47.1 → 0.48.1
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.map +1 -1
- package/dist/collab/client.js +15 -9
- 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 +1 -0
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +37 -27
- 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
|
@@ -5,6 +5,18 @@ export interface PreUploadedImageAttachment {
|
|
|
5
5
|
provider: string;
|
|
6
6
|
contentType?: string;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* A file/non-image attachment that was successfully uploaded to a hosted URL.
|
|
10
|
+
* Consumers can use the URL in place of the base64 data to avoid persisting
|
|
11
|
+
* large blobs in the thread repo and SQL.
|
|
12
|
+
*/
|
|
13
|
+
export interface PreUploadedFileAttachment {
|
|
14
|
+
name?: string;
|
|
15
|
+
url: string;
|
|
16
|
+
provider: string;
|
|
17
|
+
contentType?: string;
|
|
18
|
+
sizeBytes?: number;
|
|
19
|
+
}
|
|
8
20
|
export interface PreUploadAttachmentsResult {
|
|
9
21
|
/** Same array reference. Each image attachment that was uploaded also gets a
|
|
10
22
|
* `url` property attached (non-breaking; consumers that don't read it are
|
|
@@ -13,6 +25,9 @@ export interface PreUploadAttachmentsResult {
|
|
|
13
25
|
/** Set when at least one image was uploaded. List of hosted URLs the agent
|
|
14
26
|
* can embed in HTML, slide content, documents, etc. */
|
|
15
27
|
uploaded: PreUploadedImageAttachment[];
|
|
28
|
+
/** Uploaded non-image files (PDF, generic binary). Parallel to `uploaded`
|
|
29
|
+
* but for the file/document attachment type. */
|
|
30
|
+
uploadedFiles: PreUploadedFileAttachment[];
|
|
16
31
|
/** True if at least one image attachment failed to upload because no
|
|
17
32
|
* file-upload provider is configured. Templates use this to render a
|
|
18
33
|
* "Connect Builder.io" suggestion. */
|
|
@@ -22,6 +37,11 @@ export interface PreUploadAttachmentsResult {
|
|
|
22
37
|
* is configured. */
|
|
23
38
|
injectedText: string | null;
|
|
24
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns true when a file-upload provider is currently configured.
|
|
42
|
+
* Used to decide whether to attempt upload-first or fall back to base64.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isFileUploadProviderConfigured(): boolean;
|
|
25
45
|
/**
|
|
26
46
|
* Pre-upload chat image attachments through the active file-upload provider
|
|
27
47
|
* (Builder.io by default) so the agent can embed hosted URLs in HTML, slide
|
|
@@ -36,4 +56,21 @@ export declare function preUploadImageAttachments(opts: {
|
|
|
36
56
|
attachments: AgentChatAttachment[] | undefined;
|
|
37
57
|
ownerEmail: string | null | undefined;
|
|
38
58
|
}): Promise<PreUploadAttachmentsResult>;
|
|
59
|
+
/**
|
|
60
|
+
* Pre-upload ALL chat attachments (images AND files/PDFs) through the active
|
|
61
|
+
* file-upload provider. When a provider is configured, each attachment gets a
|
|
62
|
+
* `url` property injected so downstream code can store/send URLs instead of
|
|
63
|
+
* base64. The base64 data is kept in-memory for the current turn so vision and
|
|
64
|
+
* file-reading still work; callers that persist the attachment can drop the
|
|
65
|
+
* data when a URL exists.
|
|
66
|
+
*
|
|
67
|
+
* Falls back gracefully when no provider is configured: returns untouched
|
|
68
|
+
* attachments with `providerMissing: true` for image-type failures.
|
|
69
|
+
*/
|
|
70
|
+
export declare function preUploadAttachments(opts: {
|
|
71
|
+
attachments: AgentChatAttachment[] | undefined;
|
|
72
|
+
ownerEmail: string | null | undefined;
|
|
73
|
+
/** When false, only images are uploaded (legacy behaviour). Default: true */
|
|
74
|
+
includeFiles?: boolean;
|
|
75
|
+
}): Promise<PreUploadAttachmentsResult>;
|
|
39
76
|
//# sourceMappingURL=pre-upload-attachments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pre-upload-attachments.d.ts","sourceRoot":"","sources":["../../src/file-upload/pre-upload-attachments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,MAAM,WAAW,0BAA0B;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC;;uBAEmB;IACnB,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC;4DACwD;IACxD,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IACvC;;2CAEuC;IACvC,eAAe,EAAE,OAAO,CAAC;IACzB;;yBAEqB;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;
|
|
1
|
+
{"version":3,"file":"pre-upload-attachments.d.ts","sourceRoot":"","sources":["../../src/file-upload/pre-upload-attachments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,MAAM,WAAW,0BAA0B;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC;;uBAEmB;IACnB,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC;4DACwD;IACxD,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IACvC;qDACiD;IACjD,aAAa,EAAE,yBAAyB,EAAE,CAAC;IAC3C;;2CAEuC;IACvC,eAAe,EAAE,OAAO,CAAC;IACzB;;yBAEqB;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAaD;;;GAGG;AACH,wBAAgB,8BAA8B,IAAI,OAAO,CAExD;AAED;;;;;;;;;GASG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,WAAW,EAAE,mBAAmB,EAAE,GAAG,SAAS,CAAC;IAC/C,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACvC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAEtC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,WAAW,EAAE,mBAAmB,EAAE,GAAG,SAAS,CAAC;IAC/C,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACtC,6EAA6E;IAC7E,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAgItC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { uploadFile } from "./registry.js";
|
|
2
|
-
const
|
|
1
|
+
import { getActiveFileUploadProvider, uploadFile } from "./registry.js";
|
|
2
|
+
const IMAGE_DATA_URL_RE = /^data:(image\/[^;]+);base64,(.+)$/;
|
|
3
|
+
const FILE_DATA_URL_RE = /^data:([^;]+);base64,(.+)$/;
|
|
3
4
|
function escapeXmlAttr(value) {
|
|
4
5
|
return value
|
|
5
6
|
.replace(/&/g, "&")
|
|
@@ -7,6 +8,13 @@ function escapeXmlAttr(value) {
|
|
|
7
8
|
.replace(/>/g, ">")
|
|
8
9
|
.replace(/"/g, """);
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Returns true when a file-upload provider is currently configured.
|
|
13
|
+
* Used to decide whether to attempt upload-first or fall back to base64.
|
|
14
|
+
*/
|
|
15
|
+
export function isFileUploadProviderConfigured() {
|
|
16
|
+
return getActiveFileUploadProvider() !== null;
|
|
17
|
+
}
|
|
10
18
|
/**
|
|
11
19
|
* Pre-upload chat image attachments through the active file-upload provider
|
|
12
20
|
* (Builder.io by default) so the agent can embed hosted URLs in HTML, slide
|
|
@@ -18,34 +26,62 @@ function escapeXmlAttr(value) {
|
|
|
18
26
|
* Builder.io hint to the agent.
|
|
19
27
|
*/
|
|
20
28
|
export async function preUploadImageAttachments(opts) {
|
|
29
|
+
return preUploadAttachments({ ...opts, includeFiles: false });
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Pre-upload ALL chat attachments (images AND files/PDFs) through the active
|
|
33
|
+
* file-upload provider. When a provider is configured, each attachment gets a
|
|
34
|
+
* `url` property injected so downstream code can store/send URLs instead of
|
|
35
|
+
* base64. The base64 data is kept in-memory for the current turn so vision and
|
|
36
|
+
* file-reading still work; callers that persist the attachment can drop the
|
|
37
|
+
* data when a URL exists.
|
|
38
|
+
*
|
|
39
|
+
* Falls back gracefully when no provider is configured: returns untouched
|
|
40
|
+
* attachments with `providerMissing: true` for image-type failures.
|
|
41
|
+
*/
|
|
42
|
+
export async function preUploadAttachments(opts) {
|
|
21
43
|
const list = Array.isArray(opts.attachments) ? opts.attachments : [];
|
|
44
|
+
const includeFiles = opts.includeFiles !== false;
|
|
22
45
|
const uploaded = [];
|
|
46
|
+
const uploadedFiles = [];
|
|
23
47
|
let providerMissing = false;
|
|
24
48
|
if (list.length === 0) {
|
|
25
49
|
return {
|
|
26
50
|
attachments: list,
|
|
27
51
|
uploaded,
|
|
52
|
+
uploadedFiles,
|
|
28
53
|
providerMissing: false,
|
|
29
54
|
injectedText: null,
|
|
30
55
|
};
|
|
31
56
|
}
|
|
32
57
|
for (const att of list) {
|
|
33
|
-
|
|
58
|
+
const isImage = att.type === "image";
|
|
59
|
+
const isFile = att.type === "file" || att.type === "document";
|
|
60
|
+
if (!isImage && !(includeFiles && isFile))
|
|
61
|
+
continue;
|
|
62
|
+
if (typeof att.data !== "string")
|
|
34
63
|
continue;
|
|
35
64
|
if (att.url) {
|
|
36
65
|
// Already pre-uploaded earlier in the pipeline — reuse it.
|
|
37
|
-
|
|
66
|
+
const entry = {
|
|
38
67
|
name: att.name,
|
|
39
68
|
url: att.url,
|
|
40
69
|
provider: att.uploadProvider || "unknown",
|
|
41
70
|
contentType: att.contentType,
|
|
42
|
-
}
|
|
71
|
+
};
|
|
72
|
+
if (isImage) {
|
|
73
|
+
uploaded.push(entry);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
uploadedFiles.push(entry);
|
|
77
|
+
}
|
|
43
78
|
continue;
|
|
44
79
|
}
|
|
45
|
-
const
|
|
80
|
+
const re = isImage ? IMAGE_DATA_URL_RE : FILE_DATA_URL_RE;
|
|
81
|
+
const match = att.data.match(re);
|
|
46
82
|
if (!match)
|
|
47
83
|
continue;
|
|
48
|
-
const mimeType = match[1];
|
|
84
|
+
const mimeType = att.contentType || match[1];
|
|
49
85
|
let bytes;
|
|
50
86
|
try {
|
|
51
87
|
bytes = new Uint8Array(Buffer.from(match[2], "base64"));
|
|
@@ -61,39 +97,57 @@ export async function preUploadImageAttachments(opts) {
|
|
|
61
97
|
ownerEmail: opts.ownerEmail || undefined,
|
|
62
98
|
});
|
|
63
99
|
if (!result) {
|
|
64
|
-
|
|
100
|
+
if (isImage)
|
|
101
|
+
providerMissing = true;
|
|
65
102
|
continue;
|
|
66
103
|
}
|
|
67
104
|
att.url = result.url;
|
|
68
105
|
att.uploadProvider = result.provider;
|
|
69
|
-
|
|
106
|
+
const entry = {
|
|
70
107
|
name: att.name,
|
|
71
108
|
url: result.url,
|
|
72
109
|
provider: result.provider,
|
|
73
110
|
contentType: att.contentType,
|
|
74
|
-
|
|
111
|
+
sizeBytes: bytes.byteLength,
|
|
112
|
+
};
|
|
113
|
+
if (isImage) {
|
|
114
|
+
uploaded.push(entry);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
uploadedFiles.push(entry);
|
|
118
|
+
}
|
|
75
119
|
}
|
|
76
120
|
catch (err) {
|
|
77
121
|
// Real upload failure (network, API). Keep the base64 so the model
|
|
78
|
-
// can still see the image, but don't crash the turn.
|
|
79
|
-
console.warn("[agent-native] pre-upload of chat
|
|
122
|
+
// can still see the image/file, but don't crash the turn.
|
|
123
|
+
console.warn("[agent-native] pre-upload of chat attachment failed:", err instanceof Error ? err.message : String(err));
|
|
80
124
|
}
|
|
81
125
|
}
|
|
82
126
|
let injectedText = null;
|
|
83
|
-
if (uploaded.length > 0) {
|
|
84
|
-
const lines =
|
|
127
|
+
if (uploaded.length > 0 || uploadedFiles.length > 0) {
|
|
128
|
+
const lines = [];
|
|
129
|
+
for (const u of uploaded) {
|
|
85
130
|
const attrs = [
|
|
86
131
|
u.name ? `name="${escapeXmlAttr(u.name)}"` : null,
|
|
87
132
|
`url="${escapeXmlAttr(u.url)}"`,
|
|
88
133
|
u.contentType ? `contentType="${escapeXmlAttr(u.contentType)}"` : null,
|
|
89
134
|
`provider="${escapeXmlAttr(u.provider)}"`,
|
|
90
135
|
].filter(Boolean);
|
|
91
|
-
|
|
92
|
-
}
|
|
136
|
+
lines.push(`<chat-image-attachment ${attrs.join(" ")} />`);
|
|
137
|
+
}
|
|
138
|
+
for (const f of uploadedFiles) {
|
|
139
|
+
const attrs = [
|
|
140
|
+
f.name ? `name="${escapeXmlAttr(f.name)}"` : null,
|
|
141
|
+
`url="${escapeXmlAttr(f.url)}"`,
|
|
142
|
+
f.contentType ? `contentType="${escapeXmlAttr(f.contentType)}"` : null,
|
|
143
|
+
`provider="${escapeXmlAttr(f.provider)}"`,
|
|
144
|
+
].filter(Boolean);
|
|
145
|
+
lines.push(`<chat-file-attachment ${attrs.join(" ")} />`);
|
|
146
|
+
}
|
|
93
147
|
injectedText = [
|
|
94
|
-
'<chat-
|
|
148
|
+
'<chat-attachments note="The user attached these files. They have been uploaded — use the url attribute when embedding in HTML, slide content, or any outbound message.">',
|
|
95
149
|
...lines,
|
|
96
|
-
"</chat-
|
|
150
|
+
"</chat-attachments>",
|
|
97
151
|
].join("\n");
|
|
98
152
|
}
|
|
99
153
|
else if (providerMissing) {
|
|
@@ -105,6 +159,12 @@ export async function preUploadImageAttachments(opts) {
|
|
|
105
159
|
"</chat-image-attachment-upload-error>",
|
|
106
160
|
].join("\n");
|
|
107
161
|
}
|
|
108
|
-
return {
|
|
162
|
+
return {
|
|
163
|
+
attachments: list,
|
|
164
|
+
uploaded,
|
|
165
|
+
uploadedFiles,
|
|
166
|
+
providerMissing,
|
|
167
|
+
injectedText,
|
|
168
|
+
};
|
|
109
169
|
}
|
|
110
170
|
//# sourceMappingURL=pre-upload-attachments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pre-upload-attachments.js","sourceRoot":"","sources":["../../src/file-upload/pre-upload-attachments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA2B3C,MAAM,WAAW,GAAG,mCAAmC,CAAC;AAExD,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,KAAK;SACT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAA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CAAC,CAAC,IAAI;gBACjD,QAAQ,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG;gBAC/B,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI;gBACtE,aAAa,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG;aAC1C,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAClB,OAAO,0BAA0B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;QACxD,CAAC,CAAC,CAAC;QACH,YAAY,GAAG;YACb,iLAAiL;YACjL,GAAG,KAAK;YACR,2BAA2B;SAC5B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;SAAM,IAAI,eAAe,EAAE,CAAC;QAC3B,YAAY,GAAG;YACb,sCAAsC;YACtC,+FAA+F;YAC/F,oWAAoW;YACpW,yHAAyH;YACzH,uCAAuC;SACxC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC;AACxE,CAAC","sourcesContent":["import type { AgentChatAttachment } from \"../agent/types.js\";\nimport { uploadFile } from \"./registry.js\";\n\nexport interface PreUploadedImageAttachment {\n name?: string;\n url: string;\n provider: string;\n contentType?: string;\n}\n\nexport interface PreUploadAttachmentsResult {\n /** Same array reference. Each image attachment that was uploaded also gets a\n * `url` property attached (non-breaking; consumers that don't read it are\n * unaffected). */\n attachments: AgentChatAttachment[];\n /** Set when at least one image was uploaded. List of hosted URLs the agent\n * can embed in HTML, slide content, documents, etc. */\n uploaded: PreUploadedImageAttachment[];\n /** True if at least one image attachment failed to upload because no\n * file-upload provider is configured. Templates use this to render a\n * \"Connect Builder.io\" suggestion. */\n providerMissing: boolean;\n /** A pre-formatted block to inject into the user message text so the agent\n * has each hosted URL inline. Null when nothing was uploaded or no provider\n * is configured. */\n injectedText: string | null;\n}\n\nconst DATA_URL_RE = /^data:(image\\/[^;]+);base64,(.+)$/;\n\nfunction escapeXmlAttr(value: string): string {\n return value\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\");\n}\n\n/**\n * Pre-upload chat image attachments through the active file-upload provider\n * (Builder.io by default) so the agent can embed hosted URLs in HTML, slide\n * content, and outbound messages. Keeps the original base64 data URL on the\n * attachment so multimodal vision still works — only adds a hosted `url`.\n *\n * Safe to call when no provider is configured: it returns the attachments\n * untouched with `providerMissing: true` so callers can surface a connect-\n * Builder.io hint to the agent.\n */\nexport async function preUploadImageAttachments(opts: {\n attachments: AgentChatAttachment[] | undefined;\n ownerEmail: string | null | undefined;\n}): Promise<PreUploadAttachmentsResult> {\n const list = Array.isArray(opts.attachments) ? opts.attachments : [];\n const uploaded: PreUploadedImageAttachment[] = [];\n let providerMissing = false;\n\n if (list.length === 0) {\n return {\n attachments: list,\n uploaded,\n providerMissing: false,\n injectedText: null,\n };\n }\n\n for (const att of list) {\n if (att.type !== \"image\" || typeof att.data !== \"string\") continue;\n if ((att as any).url) {\n // Already pre-uploaded earlier in the pipeline — reuse it.\n uploaded.push({\n name: att.name,\n url: (att as any).url as string,\n provider: ((att as any).uploadProvider as string) || \"unknown\",\n contentType: att.contentType,\n });\n continue;\n }\n\n const match = att.data.match(DATA_URL_RE);\n if (!match) continue;\n const mimeType = match[1];\n let bytes: Uint8Array;\n try {\n bytes = new Uint8Array(Buffer.from(match[2], \"base64\"));\n } catch {\n continue;\n }\n\n try {\n const result = await uploadFile({\n data: bytes,\n filename: att.name,\n mimeType,\n ownerEmail: opts.ownerEmail || undefined,\n });\n if (!result) {\n providerMissing = true;\n continue;\n }\n (att as any).url = result.url;\n (att as any).uploadProvider = result.provider;\n uploaded.push({\n name: att.name,\n url: result.url,\n provider: result.provider,\n contentType: att.contentType,\n });\n } catch (err) {\n // Real upload failure (network, API). Keep the base64 so the model\n // can still see the image, but don't crash the turn.\n console.warn(\n \"[agent-native] pre-upload of chat image attachment failed:\",\n err instanceof Error ? err.message : String(err),\n );\n }\n }\n\n let injectedText: string | null = null;\n if (uploaded.length > 0) {\n const lines = uploaded.map((u) => {\n const attrs = [\n u.name ? `name=\"${escapeXmlAttr(u.name)}\"` : null,\n `url=\"${escapeXmlAttr(u.url)}\"`,\n u.contentType ? `contentType=\"${escapeXmlAttr(u.contentType)}\"` : null,\n `provider=\"${escapeXmlAttr(u.provider)}\"`,\n ].filter(Boolean);\n return `<chat-image-attachment ${attrs.join(\" \")} />`;\n });\n injectedText = [\n '<chat-image-attachments note=\"The user attached these images. They have been uploaded — use the url attribute when embedding in HTML, slide content, or any outbound message.\">',\n ...lines,\n \"</chat-image-attachments>\",\n ].join(\"\\n\");\n } else if (providerMissing) {\n injectedText = [\n \"<chat-image-attachment-upload-error>\",\n \"The user attached one or more images, but no file-upload provider is configured for this app.\",\n \"Tell the user they need to configure one of: (a) Builder.io — recommended, free credits, one-click connect from Settings → File uploads, (b) BUILDER_PRIVATE_KEY environment variable, (c) a custom provider like S3 / R2 / GCS registered via registerFileUploadProvider(). Use `connect-builder` to render an inline connect card for option (a) when available.\",\n \"Until that's done, you can still SEE the image, but you do NOT have a URL to embed it in HTML or share with other apps.\",\n \"</chat-image-attachment-upload-error>\",\n ].join(\"\\n\");\n }\n\n return { attachments: list, uploaded, providerMissing, injectedText };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pre-upload-attachments.js","sourceRoot":"","sources":["../../src/file-upload/pre-upload-attachments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA2CxE,MAAM,iBAAiB,GAAG,mCAAmC,CAAC;AAC9D,MAAM,gBAAgB,GAAG,4BAA4B,CAAC;AAEtD,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,KAAK;SACT,OAAO,CAAC,IA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ACf,CAAC;IAED,OAAO;QACL,WAAW,EAAE,IAAI;QACjB,QAAQ;QACR,aAAa;QACb,eAAe;QACf,YAAY;KACb,CAAC;AACJ,CAAC","sourcesContent":["import type { AgentChatAttachment } from \"../agent/types.js\";\nimport { getActiveFileUploadProvider, uploadFile } from \"./registry.js\";\n\nexport interface PreUploadedImageAttachment {\n name?: string;\n url: string;\n provider: string;\n contentType?: string;\n}\n\n/**\n * A file/non-image attachment that was successfully uploaded to a hosted URL.\n * Consumers can use the URL in place of the base64 data to avoid persisting\n * large blobs in the thread repo and SQL.\n */\nexport interface PreUploadedFileAttachment {\n name?: string;\n url: string;\n provider: string;\n contentType?: string;\n sizeBytes?: number;\n}\n\nexport interface PreUploadAttachmentsResult {\n /** Same array reference. Each image attachment that was uploaded also gets a\n * `url` property attached (non-breaking; consumers that don't read it are\n * unaffected). */\n attachments: AgentChatAttachment[];\n /** Set when at least one image was uploaded. List of hosted URLs the agent\n * can embed in HTML, slide content, documents, etc. */\n uploaded: PreUploadedImageAttachment[];\n /** Uploaded non-image files (PDF, generic binary). Parallel to `uploaded`\n * but for the file/document attachment type. */\n uploadedFiles: PreUploadedFileAttachment[];\n /** True if at least one image attachment failed to upload because no\n * file-upload provider is configured. Templates use this to render a\n * \"Connect Builder.io\" suggestion. */\n providerMissing: boolean;\n /** A pre-formatted block to inject into the user message text so the agent\n * has each hosted URL inline. Null when nothing was uploaded or no provider\n * is configured. */\n injectedText: string | null;\n}\n\nconst IMAGE_DATA_URL_RE = /^data:(image\\/[^;]+);base64,(.+)$/;\nconst FILE_DATA_URL_RE = /^data:([^;]+);base64,(.+)$/;\n\nfunction escapeXmlAttr(value: string): string {\n return value\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\");\n}\n\n/**\n * Returns true when a file-upload provider is currently configured.\n * Used to decide whether to attempt upload-first or fall back to base64.\n */\nexport function isFileUploadProviderConfigured(): boolean {\n return getActiveFileUploadProvider() !== null;\n}\n\n/**\n * Pre-upload chat image attachments through the active file-upload provider\n * (Builder.io by default) so the agent can embed hosted URLs in HTML, slide\n * content, and outbound messages. Keeps the original base64 data URL on the\n * attachment so multimodal vision still works — only adds a hosted `url`.\n *\n * Safe to call when no provider is configured: it returns the attachments\n * untouched with `providerMissing: true` so callers can surface a connect-\n * Builder.io hint to the agent.\n */\nexport async function preUploadImageAttachments(opts: {\n attachments: AgentChatAttachment[] | undefined;\n ownerEmail: string | null | undefined;\n}): Promise<PreUploadAttachmentsResult> {\n return preUploadAttachments({ ...opts, includeFiles: false });\n}\n\n/**\n * Pre-upload ALL chat attachments (images AND files/PDFs) through the active\n * file-upload provider. When a provider is configured, each attachment gets a\n * `url` property injected so downstream code can store/send URLs instead of\n * base64. The base64 data is kept in-memory for the current turn so vision and\n * file-reading still work; callers that persist the attachment can drop the\n * data when a URL exists.\n *\n * Falls back gracefully when no provider is configured: returns untouched\n * attachments with `providerMissing: true` for image-type failures.\n */\nexport async function preUploadAttachments(opts: {\n attachments: AgentChatAttachment[] | undefined;\n ownerEmail: string | null | undefined;\n /** When false, only images are uploaded (legacy behaviour). Default: true */\n includeFiles?: boolean;\n}): Promise<PreUploadAttachmentsResult> {\n const list = Array.isArray(opts.attachments) ? opts.attachments : [];\n const includeFiles = opts.includeFiles !== false;\n const uploaded: PreUploadedImageAttachment[] = [];\n const uploadedFiles: PreUploadedFileAttachment[] = [];\n let providerMissing = false;\n\n if (list.length === 0) {\n return {\n attachments: list,\n uploaded,\n uploadedFiles,\n providerMissing: false,\n injectedText: null,\n };\n }\n\n for (const att of list) {\n const isImage = att.type === \"image\";\n const isFile = att.type === \"file\" || att.type === \"document\";\n if (!isImage && !(includeFiles && isFile)) continue;\n if (typeof att.data !== \"string\") continue;\n\n if ((att as any).url) {\n // Already pre-uploaded earlier in the pipeline — reuse it.\n const entry = {\n name: att.name,\n url: (att as any).url as string,\n provider: ((att as any).uploadProvider as string) || \"unknown\",\n contentType: att.contentType,\n };\n if (isImage) {\n uploaded.push(entry);\n } else {\n uploadedFiles.push(entry);\n }\n continue;\n }\n\n const re = isImage ? IMAGE_DATA_URL_RE : FILE_DATA_URL_RE;\n const match = att.data.match(re);\n if (!match) continue;\n const mimeType = att.contentType || match[1];\n let bytes: Uint8Array;\n try {\n bytes = new Uint8Array(Buffer.from(match[2], \"base64\"));\n } catch {\n continue;\n }\n\n try {\n const result = await uploadFile({\n data: bytes,\n filename: att.name,\n mimeType,\n ownerEmail: opts.ownerEmail || undefined,\n });\n if (!result) {\n if (isImage) providerMissing = true;\n continue;\n }\n (att as any).url = result.url;\n (att as any).uploadProvider = result.provider;\n const entry = {\n name: att.name,\n url: result.url,\n provider: result.provider,\n contentType: att.contentType,\n sizeBytes: bytes.byteLength,\n };\n if (isImage) {\n uploaded.push(entry);\n } else {\n uploadedFiles.push(entry);\n }\n } catch (err) {\n // Real upload failure (network, API). Keep the base64 so the model\n // can still see the image/file, but don't crash the turn.\n console.warn(\n \"[agent-native] pre-upload of chat attachment failed:\",\n err instanceof Error ? err.message : String(err),\n );\n }\n }\n\n let injectedText: string | null = null;\n if (uploaded.length > 0 || uploadedFiles.length > 0) {\n const lines: string[] = [];\n for (const u of uploaded) {\n const attrs = [\n u.name ? `name=\"${escapeXmlAttr(u.name)}\"` : null,\n `url=\"${escapeXmlAttr(u.url)}\"`,\n u.contentType ? `contentType=\"${escapeXmlAttr(u.contentType)}\"` : null,\n `provider=\"${escapeXmlAttr(u.provider)}\"`,\n ].filter(Boolean);\n lines.push(`<chat-image-attachment ${attrs.join(\" \")} />`);\n }\n for (const f of uploadedFiles) {\n const attrs = [\n f.name ? `name=\"${escapeXmlAttr(f.name)}\"` : null,\n `url=\"${escapeXmlAttr(f.url)}\"`,\n f.contentType ? `contentType=\"${escapeXmlAttr(f.contentType)}\"` : null,\n `provider=\"${escapeXmlAttr(f.provider)}\"`,\n ].filter(Boolean);\n lines.push(`<chat-file-attachment ${attrs.join(\" \")} />`);\n }\n injectedText = [\n '<chat-attachments note=\"The user attached these files. They have been uploaded — use the url attribute when embedding in HTML, slide content, or any outbound message.\">',\n ...lines,\n \"</chat-attachments>\",\n ].join(\"\\n\");\n } else if (providerMissing) {\n injectedText = [\n \"<chat-image-attachment-upload-error>\",\n \"The user attached one or more images, but no file-upload provider is configured for this app.\",\n \"Tell the user they need to configure one of: (a) Builder.io — recommended, free credits, one-click connect from Settings → File uploads, (b) BUILDER_PRIVATE_KEY environment variable, (c) a custom provider like S3 / R2 / GCS registered via registerFileUploadProvider(). Use `connect-builder` to render an inline connect card for option (a) when available.\",\n \"Until that's done, you can still SEE the image, but you do NOT have a URL to embed it in HTML or share with other apps.\",\n \"</chat-image-attachment-upload-error>\",\n ].join(\"\\n\");\n }\n\n return {\n attachments: list,\n uploaded,\n uploadedFiles,\n providerMissing,\n injectedText,\n };\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createProductionAgentHandler, type ActionEntry, type ScriptEntry, type ProductionAgentOptions, type ActionTool, type ScriptTool, type AgentMessage, type AgentChatRequest, type AgentChatEvent, type AgentChatAttachment, DEFAULT_MODEL, } from "./agent/index.js";
|
|
2
|
-
export { defineAction, AgentActionStopError, isAgentActionStopError, type ActionHttpConfig, type AgentActionStopOptions, type PublicAgentActionConfig, type ActionDeepLink, type ActionLinkBuilder, MCP_APP_EXTENSION_ID, MCP_APP_MIME_TYPE, MCP_APP_RESOURCE_URI_META_KEY, type ActionMcpAppConfig, type ActionMcpAppCsp, type ActionMcpAppCspBuilder, type ActionMcpAppHtmlBuilder, type ActionMcpAppPermissions, type ActionMcpAppResourceConfig, type ActionMcpAppResourceMeta, } from "./action.js";
|
|
2
|
+
export { defineAction, AgentActionStopError, isAgentActionStopError, type ActionDefinition, type ActionHttpConfig, type AgentActionStopOptions, type PublicAgentActionConfig, type ActionDeepLink, type ActionLinkBuilder, MCP_APP_EXTENSION_ID, MCP_APP_MIME_TYPE, MCP_APP_RESOURCE_URI_META_KEY, type ActionMcpAppConfig, type ActionMcpAppCsp, type ActionMcpAppCspBuilder, type ActionMcpAppHtmlBuilder, type ActionMcpAppPermissions, type ActionMcpAppResourceConfig, type ActionMcpAppResourceMeta, } from "./action.js";
|
|
3
3
|
export { embedApp, MCP_APP_REQUEST_ORIGIN_CSP_SOURCE, type EmbedAppOptions, } from "./mcp/embed-app.js";
|
|
4
4
|
export { embedRoute, type EmbedRouteContext, type EmbedRouteOptions, type EmbedRoutePathBuilder, type EmbedRouteResult, } from "./mcp/embed-route.js";
|
|
5
5
|
export { createDevScriptRegistry } from "./scripts/dev/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,4BAA4B,EAC5B,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,6BAA6B,EAC7B,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,GAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,QAAQ,EACR,iCAAiC,EACjC,KAAK,eAAe,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,UAAU,EACV,KAAK,iBAAiB,EACtB,KAAK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EACtB,mCAAmC,EACnC,KAAK,uCAAuC,EAC5C,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,mCAAmC,EACxC,KAAK,wBAAwB,EAC7B,KAAK,kCAAkC,EACvC,KAAK,uBAAuB,EAC5B,KAAK,iCAAiC,EACtC,KAAK,gCAAgC,EACrC,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,+BAA+B,EACpC,KAAK,8CAA8C,EACnD,KAAK,4BAA4B,EACjC,KAAK,+CAA+C,EACpD,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EACjC,KAAK,mCAAmC,EACxC,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,EAClC,KAAK,gCAAgC,EACrC,KAAK,2BAA2B,EAChC,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,GACpC,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,IAAI,GACL,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,SAAS,GACf,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,4BAA4B,EAC5B,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OA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5B,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,SAAS,GACf,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,+CAA+C;AAE/C,0BAA0B;AAC1B,OAAO,EACL,4BAA4B,EAU5B,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,EAMtB,oBAAoB,EACpB,iBAAiB,EACjB,6BAA6B,GAQ9B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,QAAQ,EACR,iCAAiC,GAElC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,UAAU,GAKX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAEvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,GAEzB,MAAM,sBAAsB,CAAC;AAE9B,SAAS;AACT,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,UAAU,GAKX,MAAM,mBAAmB,CAAC;AAE3B,SAAS;AACT,OAAO,EACL,qBAAqB,EACrB,+BAA+B,EAC/B,qBAAqB,EACrB,oCAAoC,EACpC,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,EACf,uBAAuB,EACvB,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EACnB,sBAAsB,EACtB,UAAU,EACV,kBAAkB,EAClB,uCAAuC,EACvC,oBAAoB,EAC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AE1C,iDAAiD;AACjD,OAAO,EACL,gBAAgB,EAChB,0BAA0B,EAC1B,8BAA8B,EAC9B,2BAA2B,EAC3B,oBAAoB,EACpB,kCAAkC,EAClC,iCAAiC,EACjC,iBAAiB,EACjB,8BAA8B,EAC9B,+BAA+B,EAC/B,mBAAmB,EACnB,gCAAgC,EAChC,6CAA6C,EAC7C,2CAA2C,EAC3C,sBAAsB,EACtB,mCAAmC,GA2BpC,MAAM,wBAAwB,CAAC;AAEhC,UAAU;AACV,OAAO,EACL,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,IAAI,GACL,MAAM,oBAAoB,CAAC;AAE5B,4EAA4E;AAC5E,wEAAwE;AACxE,mCAAmC;AACnC,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,eAAe,GAMhB,MAAM,oBAAoB,CAAC","sourcesContent":["// Framework for agent-native apps.\n// Import everything from \"@agent-native/core\".\n\n// Agent (production mode)\nexport {\n createProductionAgentHandler,\n type ActionEntry,\n type ScriptEntry,\n type ProductionAgentOptions,\n type ActionTool,\n type ScriptTool,\n type AgentMessage,\n type AgentChatRequest,\n type AgentChatEvent,\n type AgentChatAttachment,\n DEFAULT_MODEL,\n} from \"./agent/index.js\";\nexport {\n defineAction,\n AgentActionStopError,\n isAgentActionStopError,\n type ActionHttpConfig,\n type AgentActionStopOptions,\n type PublicAgentActionConfig,\n type ActionDeepLink,\n type ActionLinkBuilder,\n MCP_APP_EXTENSION_ID,\n MCP_APP_MIME_TYPE,\n MCP_APP_RESOURCE_URI_META_KEY,\n type ActionMcpAppConfig,\n type ActionMcpAppCsp,\n type ActionMcpAppCspBuilder,\n type ActionMcpAppHtmlBuilder,\n type ActionMcpAppPermissions,\n type ActionMcpAppResourceConfig,\n type ActionMcpAppResourceMeta,\n} from \"./action.js\";\nexport {\n embedApp,\n MCP_APP_REQUEST_ORIGIN_CSP_SOURCE,\n type EmbedAppOptions,\n} from \"./mcp/embed-app.js\";\nexport {\n embedRoute,\n type EmbedRouteContext,\n type EmbedRouteOptions,\n type EmbedRoutePathBuilder,\n type EmbedRouteResult,\n} from \"./mcp/embed-route.js\";\nexport { createDevScriptRegistry } from \"./scripts/dev/index.js\";\nexport {\n createAgentChatPlugin,\n defaultAgentChatPlugin,\n type AgentChatPluginOptions,\n} from \"./server/agent-chat-plugin.js\";\nexport {\n createAgentNativeEmbeddedPlugin,\n mountAgentNativeEmbedded,\n type AgentNativeEmbeddedPluginOptions,\n} from \"./server/embedded.js\";\n\n// Server\nexport {\n createServer,\n createSSEHandler,\n defineNitroPlugin,\n autoMountAuth,\n getSession,\n type CreateServerOptions,\n type SSEHandlerOptions,\n type AuthSession,\n type AuthOptions,\n} from \"./server/index.js\";\n\n// Client\nexport {\n addContextToAgentChat,\n appendAgentChatContextToMessage,\n clearAgentChatContext,\n formatAgentChatContextItemsForPrompt,\n listAgentChatContext,\n refreshAgentChatContext,\n removeAgentChatContextItem,\n sendToAgentChat,\n setAgentChatContextItem,\n setContextToAgentChat,\n isEmbedMcpChatBridgeActive,\n useAgentChatContext,\n useAgentChatGenerating,\n useDevMode,\n useSendToAgentChat,\n AGENT_NATIVE_MCP_APP_HOST_MESSAGE_TYPES,\n getMcpAppHostContext,\n openMcpAppHostLink,\n requestMcpAppDisplayMode,\n updateMcpAppModelContext,\n useMcpAppHostContext,\n CodeRequiredDialog,\n useAgentNativeEmbeddedBrowserSession,\n useDbSync,\n useFileWatcher,\n cn,\n ApiKeySettings,\n useSession,\n AgentNativeEmbedded,\n useProductionAgent,\n ProductionAgentPanel,\n type AgentChatContextItem,\n type AgentChatContextMessage,\n type AgentChatContextMutationOptions,\n type AgentChatContextRemoveOptions,\n type AgentChatContextSetOptions,\n type AgentChatContextState,\n type AgentChatMessage,\n type AgentNativeMcpAppHostMessageType,\n type McpAppDisplayMode,\n type McpAppHostCapabilities,\n type McpAppHostContext,\n type McpAppHostContextSnapshot,\n type McpAppModelContextContentPart,\n type McpAppModelContextUpdate,\n type AgentNativeEmbeddedProps,\n type UseAgentNativeEmbeddedBrowserSessionOptions,\n type CodeRequiredDialogProps,\n type ProductionAgentMessage,\n type UseProductionAgentResult,\n type ProductionAgentPanelProps,\n type UseAgentChatContextResult,\n useActionQuery,\n useActionMutation,\n} from \"./client/index.js\";\n\n// Shared (isomorphic)\nexport {\n agentChat,\n type AgentChatCallOptions,\n type AgentChatResponse,\n} from \"./shared/index.js\";\nexport {\n EMBED_MODE_QUERY_PARAM,\n EMBED_SESSION_COOKIE,\n EMBED_START_PATH,\n EMBED_TOKEN_QUERY_PARAM,\n} from \"./shared/embed-auth.js\";\n\n// Agent Web surfaces\nexport {\n AGENT_WEB_CRAWLER_CATEGORIES,\n AGENT_WEB_CRAWLER_USER_AGENTS,\n DEFAULT_AGENT_WEB_CRAWLER_POLICY,\n absoluteUrl,\n agentWebConfigFromPackageJson,\n buildAgentWebStaticFiles,\n buildBaseJsonLd,\n buildLlmsFullTxt,\n buildLlmsTxt,\n buildMarkdownResponseHeaders,\n buildPageJsonLd,\n buildRobotsTxt,\n buildSitemapXml,\n deriveAgentWebPublicRoutes,\n estimateMarkdownTokens,\n markdownFilePathForPage,\n markdownUrlForPage,\n normalizeAgentWebConfig,\n pathPatternMatches,\n resolveAgentWebCrawlerPolicy,\n type AgentWebConfig,\n type AgentWebCrawlerCategory,\n type AgentWebCrawlerDecision,\n type AgentWebCrawlerOverrides,\n type AgentWebCrawlerPolicy,\n type AgentWebInputConfig,\n type AgentWebPage,\n type AgentWebStaticFile,\n type BuildAgentWebStaticFilesOptions,\n type DeriveAgentWebPublicRoutesOptions,\n type MarkdownResponseHeadersOptions,\n} from \"./agent-web/index.js\";\n\n// Token usage tracking\nexport {\n recordUsage,\n getUsageSummary,\n getUserUsageCents,\n calculateCost,\n usageBillingForEngine,\n builderCreditsFromCostCents,\n BUILDER_AGENT_CREDIT_MARGIN_MULTIPLIER,\n BUILDER_AGENT_CREDITS_PER_USD,\n BUILDER_CREDIT_USAGE_BILLING,\n USD_USAGE_BILLING,\n type UsageRecord,\n type UsageSummary,\n type UsageBillingMode,\n type UsageBillingUnit,\n type UsageBucket,\n type DailyBucket,\n type UsageRecentEntry,\n} from \"./usage/store.js\";\n\n// Workspace-scoped third-party connection metadata\nexport {\n deleteWorkspaceConnection,\n getWorkspaceConnectionAppAccess,\n getWorkspaceConnection,\n getWorkspaceConnectionGrant,\n listWorkspaceConnectionProviderCatalogForApp,\n listWorkspaceConnectionGrants,\n listWorkspaceConnections,\n resolveWorkspaceConnectionCredentialForApp,\n resolveWorkspaceConnectionCredentialsForApp,\n revokeWorkspaceConnectionGrant,\n serializeWorkspaceConnectionGrant,\n serializeWorkspaceConnection,\n summarizeWorkspaceConnectionProviderForApp,\n summarizeWorkspaceConnectionProviderReadiness,\n upsertWorkspaceConnectionGrant,\n upsertWorkspaceConnection,\n type ListWorkspaceConnectionProviderCatalogForAppOptions,\n type ListWorkspaceConnectionGrantsOptions,\n type ListWorkspaceConnectionsOptions,\n type ResolveWorkspaceConnectionCredentialForAppOptions,\n type ResolveWorkspaceConnectionCredentialsForAppOptions,\n type SerializedWorkspaceConnectionGrant,\n type SerializedWorkspaceConnection,\n type SummarizeWorkspaceConnectionProviderForAppOptions,\n type SummarizeWorkspaceConnectionProviderReadinessOptions,\n type UpsertWorkspaceConnectionGrantInput,\n type UpsertWorkspaceConnectionInput,\n type WorkspaceConnectionAppAccess,\n type WorkspaceConnectionAppAccessMode,\n type WorkspaceConnection,\n type WorkspaceConnectionCredentialBackend,\n type WorkspaceConnectionCredentialProvenance,\n type WorkspaceConnectionCredentialRef,\n type WorkspaceConnectionCredentialResolution,\n type WorkspaceConnectionCredentialResolutionCheck,\n type WorkspaceConnectionCredentialResolutionStatus,\n type WorkspaceConnectionCredentialsResolution,\n type WorkspaceConnectionExplicitGrantSummary,\n type WorkspaceConnectionForAppSummary,\n type WorkspaceConnectionGrant,\n type WorkspaceConnectionGrantAvailability,\n type WorkspaceConnectionGrantState,\n type WorkspaceConnectionProviderAppSummary,\n type WorkspaceConnectionProviderLike,\n type WorkspaceConnectionProviderCatalogForApp,\n type WorkspaceConnectionProviderCatalogForAppItem,\n type WorkspaceConnectionProviderReadiness,\n type WorkspaceConnectionProviderReadinessStatus,\n type WorkspaceConnectionPublicCredentialRef,\n type WorkspaceConnectionStatus,\n workspaceConnectionIsAvailableToApp,\n} from \"./workspace-connections/index.js\";\n\n// Reusable workspace connection provider catalog\nexport {\n PROVIDER_READERS,\n ProviderReaderRuntimeError,\n WORKSPACE_CONNECTION_PROVIDERS,\n createProviderReaderRuntime,\n defineProviderReader,\n defineProviderReaderImplementation,\n defineWorkspaceConnectionProvider,\n getProviderReader,\n getWorkspaceConnectionProvider,\n isWorkspaceConnectionProviderId,\n listProviderReaders,\n listWorkspaceConnectionProviders,\n listWorkspaceConnectionProvidersForCapability,\n listWorkspaceConnectionProvidersForTemplate,\n providerReaderSupports,\n workspaceConnectionProviderSupports,\n type ListWorkspaceConnectionProvidersOptions,\n type ListProviderReadersOptions,\n type ProviderReaderCapability,\n type ProviderReaderCredentialRequirement,\n type ProviderReaderDefinition,\n type ProviderReaderImplementationStatus,\n type ProviderReaderOperation,\n type ProviderReaderOperationDescriptor,\n type ProviderReaderOperationParameter,\n type ProviderReaderRequest,\n type ProviderReaderRuntime,\n type ProviderReaderRuntimeConnection,\n type ProviderReaderRuntimeConnectionResolverOptions,\n type ProviderReaderRuntimeContext,\n type ProviderReaderRuntimeCredentialsResolverOptions,\n type ProviderReaderRuntimeErrorCode,\n type ProviderReaderRuntimeHandler,\n type ProviderReaderRuntimeImplementation,\n type ProviderReaderRuntimeItem,\n type ProviderReaderRuntimeOptions,\n type ProviderReaderRuntimeResponse,\n type WorkspaceConnectionCapability,\n type WorkspaceConnectionCredentialKey,\n type WorkspaceConnectionProvider,\n type WorkspaceConnectionProviderId,\n type WorkspaceConnectionTemplateUse,\n} from \"./connections/index.js\";\n\n// Scripts\nexport {\n runScript,\n loadEnv,\n parseArgs,\n camelCaseArgs,\n isValidPath,\n isValidProjectPath,\n ensureDir,\n fail,\n} from \"./scripts/index.js\";\n\n// Secrets registry — import from \"@agent-native/core/secrets\" when possible\n// (the subpath keeps the top-level entry point lean), but re-export the\n// public API here for convenience.\nexport {\n registerRequiredSecret,\n listRequiredSecrets,\n getRequiredSecret,\n readAppSecret,\n writeAppSecret,\n deleteAppSecret,\n type RegisteredSecret,\n type SecretScope,\n type SecretKind,\n type SecretValidator,\n type SecretRef,\n} from \"./secrets/index.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,+CAA+C;AAE/C,0BAA0B;AAC1B,OAAO,EACL,4BAA4B,EAU5B,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,EAOtB,oBAAoB,EACpB,iBAAiB,EACjB,6BAA6B,GAQ9B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,QAAQ,EACR,iCAAiC,GAElC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,UAAU,GAKX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAEvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,GAEzB,MAAM,sBAAsB,CAAC;AAE9B,SAAS;AACT,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,UAAU,GAKX,MAAM,mBAAmB,CAAC;AAE3B,SAAS;AACT,OAAO,EACL,qBAAqB,EACrB,+BAA+B,EAC/B,qBAAqB,EACrB,oCAAoC,EACpC,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,EACf,uBAAuB,E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BAA4B,EAC5B,0CAA0C,EAC1C,6CAA6C,EAC7C,8BAA8B,EAC9B,yBAAyB,EAmCzB,mCAAmC,GACpC,MAAM,kCAAkC,CAAC;AAE1C,iDAAiD;AACjD,OAAO,EACL,gBAAgB,EAChB,0BAA0B,EAC1B,8BAA8B,EAC9B,2BAA2B,EAC3B,oBAAoB,EACpB,kCAAkC,EAClC,iCAAiC,EACjC,iBAAiB,EACjB,8BAA8B,EAC9B,+BAA+B,EAC/B,mBAAmB,EACnB,gCAAgC,EAChC,6CAA6C,EAC7C,2CAA2C,EAC3C,sBAAsB,EACtB,mCAAmC,GA2BpC,MAAM,wBAAwB,CAAC;AAEhC,UAAU;AACV,OAAO,EACL,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,IAAI,GACL,MAAM,oBAAoB,CAAC;AAE5B,4EAA4E;AAC5E,wEAAwE;AACxE,mCAAmC;AACnC,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,eAAe,GAMhB,MAAM,oBAAoB,CAAC","sourcesContent":["// Framework for agent-native apps.\n// Import everything from \"@agent-native/core\".\n\n// Agent (production mode)\nexport {\n createProductionAgentHandler,\n type ActionEntry,\n type ScriptEntry,\n type ProductionAgentOptions,\n type ActionTool,\n type ScriptTool,\n type AgentMessage,\n type AgentChatRequest,\n type AgentChatEvent,\n type AgentChatAttachment,\n DEFAULT_MODEL,\n} from \"./agent/index.js\";\nexport {\n defineAction,\n AgentActionStopError,\n isAgentActionStopError,\n type ActionDefinition,\n type ActionHttpConfig,\n type AgentActionStopOptions,\n type PublicAgentActionConfig,\n type ActionDeepLink,\n type ActionLinkBuilder,\n MCP_APP_EXTENSION_ID,\n MCP_APP_MIME_TYPE,\n MCP_APP_RESOURCE_URI_META_KEY,\n type ActionMcpAppConfig,\n type ActionMcpAppCsp,\n type ActionMcpAppCspBuilder,\n type ActionMcpAppHtmlBuilder,\n type ActionMcpAppPermissions,\n type ActionMcpAppResourceConfig,\n type ActionMcpAppResourceMeta,\n} from \"./action.js\";\nexport {\n embedApp,\n MCP_APP_REQUEST_ORIGIN_CSP_SOURCE,\n type EmbedAppOptions,\n} from \"./mcp/embed-app.js\";\nexport {\n embedRoute,\n type EmbedRouteContext,\n type EmbedRouteOptions,\n type EmbedRoutePathBuilder,\n type EmbedRouteResult,\n} from \"./mcp/embed-route.js\";\nexport { createDevScriptRegistry } from \"./scripts/dev/index.js\";\nexport {\n createAgentChatPlugin,\n defaultAgentChatPlugin,\n type AgentChatPluginOptions,\n} from \"./server/agent-chat-plugin.js\";\nexport {\n createAgentNativeEmbeddedPlugin,\n mountAgentNativeEmbedded,\n type AgentNativeEmbeddedPluginOptions,\n} from \"./server/embedded.js\";\n\n// Server\nexport {\n createServer,\n createSSEHandler,\n defineNitroPlugin,\n autoMountAuth,\n getSession,\n type CreateServerOptions,\n type SSEHandlerOptions,\n type AuthSession,\n type AuthOptions,\n} from \"./server/index.js\";\n\n// Client\nexport {\n addContextToAgentChat,\n appendAgentChatContextToMessage,\n clearAgentChatContext,\n formatAgentChatContextItemsForPrompt,\n listAgentChatContext,\n refreshAgentChatContext,\n removeAgentChatContextItem,\n sendToAgentChat,\n setAgentChatContextItem,\n setContextToAgentChat,\n isEmbedMcpChatBridgeActive,\n useAgentChatContext,\n useAgentChatGenerating,\n useDevMode,\n useSendToAgentChat,\n AGENT_NATIVE_MCP_APP_HOST_MESSAGE_TYPES,\n getMcpAppHostContext,\n openMcpAppHostLink,\n requestMcpAppDisplayMode,\n updateMcpAppModelContext,\n useMcpAppHostContext,\n CodeRequiredDialog,\n useAgentNativeEmbeddedBrowserSession,\n useDbSync,\n useFileWatcher,\n cn,\n ApiKeySettings,\n useSession,\n AgentNativeEmbedded,\n useProductionAgent,\n ProductionAgentPanel,\n type AgentChatContextItem,\n type AgentChatContextMessage,\n type AgentChatContextMutationOptions,\n type AgentChatContextRemoveOptions,\n type AgentChatContextSetOptions,\n type AgentChatContextState,\n type AgentChatMessage,\n type AgentNativeMcpAppHostMessageType,\n type McpAppDisplayMode,\n type McpAppHostCapabilities,\n type McpAppHostContext,\n type McpAppHostContextSnapshot,\n type McpAppModelContextContentPart,\n type McpAppModelContextUpdate,\n type AgentNativeEmbeddedProps,\n type UseAgentNativeEmbeddedBrowserSessionOptions,\n type CodeRequiredDialogProps,\n type ProductionAgentMessage,\n type UseProductionAgentResult,\n type ProductionAgentPanelProps,\n type UseAgentChatContextResult,\n useActionQuery,\n useActionMutation,\n} from \"./client/index.js\";\n\n// Shared (isomorphic)\nexport {\n agentChat,\n type AgentChatCallOptions,\n type AgentChatResponse,\n} from \"./shared/index.js\";\nexport {\n EMBED_MODE_QUERY_PARAM,\n EMBED_SESSION_COOKIE,\n EMBED_START_PATH,\n EMBED_TOKEN_QUERY_PARAM,\n} from \"./shared/embed-auth.js\";\n\n// Agent Web surfaces\nexport {\n AGENT_WEB_CRAWLER_CATEGORIES,\n AGENT_WEB_CRAWLER_USER_AGENTS,\n DEFAULT_AGENT_WEB_CRAWLER_POLICY,\n absoluteUrl,\n agentWebConfigFromPackageJson,\n buildAgentWebStaticFiles,\n buildBaseJsonLd,\n buildLlmsFullTxt,\n buildLlmsTxt,\n buildMarkdownResponseHeaders,\n buildPageJsonLd,\n buildRobotsTxt,\n buildSitemapXml,\n deriveAgentWebPublicRoutes,\n estimateMarkdownTokens,\n markdownFilePathForPage,\n markdownUrlForPage,\n normalizeAgentWebConfig,\n pathPatternMatches,\n resolveAgentWebCrawlerPolicy,\n type AgentWebConfig,\n type AgentWebCrawlerCategory,\n type AgentWebCrawlerDecision,\n type AgentWebCrawlerOverrides,\n type AgentWebCrawlerPolicy,\n type AgentWebInputConfig,\n type AgentWebPage,\n type AgentWebStaticFile,\n type BuildAgentWebStaticFilesOptions,\n type DeriveAgentWebPublicRoutesOptions,\n type MarkdownResponseHeadersOptions,\n} from \"./agent-web/index.js\";\n\n// Token usage tracking\nexport {\n recordUsage,\n getUsageSummary,\n getUserUsageCents,\n calculateCost,\n usageBillingForEngine,\n builderCreditsFromCostCents,\n BUILDER_AGENT_CREDIT_MARGIN_MULTIPLIER,\n BUILDER_AGENT_CREDITS_PER_USD,\n BUILDER_CREDIT_USAGE_BILLING,\n USD_USAGE_BILLING,\n type UsageRecord,\n type UsageSummary,\n type UsageBillingMode,\n type UsageBillingUnit,\n type UsageBucket,\n type DailyBucket,\n type UsageRecentEntry,\n} from \"./usage/store.js\";\n\n// Workspace-scoped third-party connection metadata\nexport {\n deleteWorkspaceConnection,\n getWorkspaceConnectionAppAccess,\n getWorkspaceConnection,\n getWorkspaceConnectionGrant,\n listWorkspaceConnectionProviderCatalogForApp,\n listWorkspaceConnectionGrants,\n listWorkspaceConnections,\n resolveWorkspaceConnectionCredentialForApp,\n resolveWorkspaceConnectionCredentialsForApp,\n revokeWorkspaceConnectionGrant,\n serializeWorkspaceConnectionGrant,\n serializeWorkspaceConnection,\n summarizeWorkspaceConnectionProviderForApp,\n summarizeWorkspaceConnectionProviderReadiness,\n upsertWorkspaceConnectionGrant,\n upsertWorkspaceConnection,\n type ListWorkspaceConnectionProviderCatalogForAppOptions,\n type ListWorkspaceConnectionGrantsOptions,\n type ListWorkspaceConnectionsOptions,\n type ResolveWorkspaceConnectionCredentialForAppOptions,\n type ResolveWorkspaceConnectionCredentialsForAppOptions,\n type SerializedWorkspaceConnectionGrant,\n type SerializedWorkspaceConnection,\n type SummarizeWorkspaceConnectionProviderForAppOptions,\n type SummarizeWorkspaceConnectionProviderReadinessOptions,\n type UpsertWorkspaceConnectionGrantInput,\n type UpsertWorkspaceConnectionInput,\n type WorkspaceConnectionAppAccess,\n type WorkspaceConnectionAppAccessMode,\n type WorkspaceConnection,\n type WorkspaceConnectionCredentialBackend,\n type WorkspaceConnectionCredentialProvenance,\n type WorkspaceConnectionCredentialRef,\n type WorkspaceConnectionCredentialResolution,\n type WorkspaceConnectionCredentialResolutionCheck,\n type WorkspaceConnectionCredentialResolutionStatus,\n type WorkspaceConnectionCredentialsResolution,\n type WorkspaceConnectionExplicitGrantSummary,\n type WorkspaceConnectionForAppSummary,\n type WorkspaceConnectionGrant,\n type WorkspaceConnectionGrantAvailability,\n type WorkspaceConnectionGrantState,\n type WorkspaceConnectionProviderAppSummary,\n type WorkspaceConnectionProviderLike,\n type WorkspaceConnectionProviderCatalogForApp,\n type WorkspaceConnectionProviderCatalogForAppItem,\n type WorkspaceConnectionProviderReadiness,\n type WorkspaceConnectionProviderReadinessStatus,\n type WorkspaceConnectionPublicCredentialRef,\n type WorkspaceConnectionStatus,\n workspaceConnectionIsAvailableToApp,\n} from \"./workspace-connections/index.js\";\n\n// Reusable workspace connection provider catalog\nexport {\n PROVIDER_READERS,\n ProviderReaderRuntimeError,\n WORKSPACE_CONNECTION_PROVIDERS,\n createProviderReaderRuntime,\n defineProviderReader,\n defineProviderReaderImplementation,\n defineWorkspaceConnectionProvider,\n getProviderReader,\n getWorkspaceConnectionProvider,\n isWorkspaceConnectionProviderId,\n listProviderReaders,\n listWorkspaceConnectionProviders,\n listWorkspaceConnectionProvidersForCapability,\n listWorkspaceConnectionProvidersForTemplate,\n providerReaderSupports,\n workspaceConnectionProviderSupports,\n type ListWorkspaceConnectionProvidersOptions,\n type ListProviderReadersOptions,\n type ProviderReaderCapability,\n type ProviderReaderCredentialRequirement,\n type ProviderReaderDefinition,\n type ProviderReaderImplementationStatus,\n type ProviderReaderOperation,\n type ProviderReaderOperationDescriptor,\n type ProviderReaderOperationParameter,\n type ProviderReaderRequest,\n type ProviderReaderRuntime,\n type ProviderReaderRuntimeConnection,\n type ProviderReaderRuntimeConnectionResolverOptions,\n type ProviderReaderRuntimeContext,\n type ProviderReaderRuntimeCredentialsResolverOptions,\n type ProviderReaderRuntimeErrorCode,\n type ProviderReaderRuntimeHandler,\n type ProviderReaderRuntimeImplementation,\n type ProviderReaderRuntimeItem,\n type ProviderReaderRuntimeOptions,\n type ProviderReaderRuntimeResponse,\n type WorkspaceConnectionCapability,\n type WorkspaceConnectionCredentialKey,\n type WorkspaceConnectionProvider,\n type WorkspaceConnectionProviderId,\n type WorkspaceConnectionTemplateUse,\n} from \"./connections/index.js\";\n\n// Scripts\nexport {\n runScript,\n loadEnv,\n parseArgs,\n camelCaseArgs,\n isValidPath,\n isValidProjectPath,\n ensureDir,\n fail,\n} from \"./scripts/index.js\";\n\n// Secrets registry — import from \"@agent-native/core/secrets\" when possible\n// (the subpath keeps the top-level entry point lean), but re-export the\n// public API here for convenience.\nexport {\n registerRequiredSecret,\n listRequiredSecrets,\n getRequiredSecret,\n readAppSecret,\n writeAppSecret,\n deleteAppSecret,\n type RegisteredSecret,\n type SecretScope,\n type SecretKind,\n type SecretValidator,\n type SecretRef,\n} from \"./secrets/index.js\";\n"]}
|
|
@@ -289,7 +289,7 @@ export function slackAdapter() {
|
|
|
289
289
|
: {},
|
|
290
290
|
};
|
|
291
291
|
},
|
|
292
|
-
async getStatus(
|
|
292
|
+
async getStatus(_baseUrl) {
|
|
293
293
|
const hasToken = !!process.env.SLACK_BOT_TOKEN;
|
|
294
294
|
const hasSecret = !!process.env.SLACK_SIGNING_SECRET;
|
|
295
295
|
const configured = hasToken && hasSecret;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack.js","sourceRoot":"","sources":["../../../src/integrations/adapters/slack.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAUzD,iCAAiC;AACjC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAC3C,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO;QACL,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,OAAO;QAEd,kBAAkB;YAChB,OAAO;gBACL;oBACE,GAAG,EAAE,iBA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1B,GAAW,EACX,IAAiB;IAEjB,MAAM,UAAU,GACd,OAAO,eAAe,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7E,MAAM,KAAK,GAAG,UAAU;QACtB,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,oBAAoB,CAAC;QAC5D,CAAC,CAAC,SAAS,CAAC;IACd,IAAI,CAAC;QACH,OAAO,MAAM,KAAK,CAAC,GAAG,EAAE;YACtB,GAAG,IAAI;YACP,MAAM,EAAE,UAAU,EAAE,MAAM,IAAI,IAAI,CAAC,MAAM;SAC1C,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;AACH,CAAC","sourcesContent":["import type { H3Event } from \"h3\";\nimport { createError, getHeader, readRawBody } from \"h3\";\nimport type {\n PlatformAdapter,\n IncomingMessage,\n OutgoingMessage,\n IntegrationStatus,\n OutboundTarget,\n} from \"../types.js\";\nimport type { EnvKeyConfig } from \"../../server/create-server.js\";\n\n/** Slack's max message length */\nconst SLACK_MAX_LENGTH = 4000;\nconst SLACK_SECTION_TEXT_MAX_LENGTH = 3000;\nconst SLACK_API_TIMEOUT_MS = 10_000;\n\n/**\n * Create a Slack platform adapter.\n *\n * Required env vars:\n * - SLACK_BOT_TOKEN — Bot user OAuth token (xoxb-...)\n * - SLACK_SIGNING_SECRET — Used to verify webhook signatures\n *\n * Optional env vars:\n * - SLACK_ALLOWED_TEAM_IDS — Comma-separated list of Slack workspace\n * `team_id` values (e.g. \"T012ABCDEF,T034GHIJKL\") that this deployment\n * accepts events from. Required in production and strongly recommended\n * to prevent cross-workspace event injection (H1 in the webhook audit):\n * the global `SLACK_SIGNING_SECRET` is the same key for every workspace\n * the app is installed to, so without an allowlist any installed\n * workspace can drive the agent. When unset the adapter accepts events\n * from any workspace in development, but rejects events in production.\n * - SLACK_ALLOWED_API_APP_IDS — Comma-separated list of Slack app IDs\n * (`api_app_id`) to additionally pin events to. Useful when the same\n * signing secret rotation surfaces multiple app installs.\n */\nexport function slackAdapter(): PlatformAdapter {\n return {\n platform: \"slack\",\n label: \"Slack\",\n\n getRequiredEnvKeys(): EnvKeyConfig[] {\n return [\n {\n key: \"SLACK_BOT_TOKEN\",\n label: \"Slack Bot Token\",\n required: true,\n helpText:\n \"In your Slack app's left nav: OAuth & Permissions → Bot User OAuth Token (starts with `xoxb-`).\",\n },\n {\n key: \"SLACK_SIGNING_SECRET\",\n label: \"Slack Signing Secret\",\n required: true,\n helpText:\n \"In your Slack app's left nav: Basic Information → App Credentials → Signing Secret.\",\n },\n ];\n },\n\n async handleVerification(\n event: H3Event,\n ): Promise<{ handled: boolean; response?: unknown }> {\n // Slack sends url_verification when first setting up the webhook.\n // readRawBodyCached caches the raw bytes on event.context.__rawBody so\n // subsequent verifyWebhook + parseIncomingMessage calls re-use them\n // without re-stringifying a parsed body (M2 in the audit).\n const body = await readRawBodyCached(event);\n try {\n const parsed = JSON.parse(body);\n if (parsed.type === \"url_verification\") {\n // Slack's URL verifier expects the raw challenge value in the\n // response body. Returning JSON works for some clients but the app\n // settings verifier rejects it as not matching the challenge.\n return { handled: true, response: parsed.challenge };\n }\n } catch {}\n return { handled: false };\n },\n\n async verifyWebhook(event: H3Event): Promise<boolean> {\n const signingSecret = process.env.SLACK_SIGNING_SECRET;\n if (!signingSecret) return false;\n\n const signature = getHeader(event, \"x-slack-signature\");\n const timestamp = getHeader(event, \"x-slack-request-timestamp\");\n if (!signature || !timestamp) return false;\n\n // Reject requests older than 5 minutes (replay protection)\n const ts = parseInt(timestamp, 10);\n if (Math.abs(Date.now() / 1000 - ts) > 300) return false;\n\n const body = await readRawBodyCached(event);\n const crypto = await import(\"node:crypto\");\n const basestring = `v0:${timestamp}:${body}`;\n const expectedSignature =\n \"v0=\" +\n crypto\n .createHmac(\"sha256\", signingSecret)\n .update(basestring)\n .digest(\"hex\");\n\n // Timing-safe comparison\n try {\n return crypto.timingSafeEqual(\n Buffer.from(signature),\n Buffer.from(expectedSignature),\n );\n } catch {\n return false;\n }\n },\n\n async parseIncomingMessage(\n event: H3Event,\n ): Promise<IncomingMessage | null> {\n const raw = await readRawBodyCached(event);\n let payload: any;\n try {\n payload = JSON.parse(raw);\n } catch {\n return null;\n }\n\n // H1 (webhook audit): cross-workspace event injection. The global\n // SLACK_SIGNING_SECRET is the same key for every workspace this Slack\n // app is installed to — without a per-tenant allowlist any installed\n // workspace can drive the agent. We enforce SLACK_ALLOWED_TEAM_IDS\n // here AFTER the signature has already been verified by the webhook\n // handler, so this is purely a tenant-isolation gate (not a forgery\n // defense). When unset in production we surface a one-time warning\n // recommending it be configured.\n enforceWorkspaceAllowlist(payload);\n\n // Handle Events API wrapper\n if (payload.type === \"event_callback\") {\n const e = payload.event;\n if (!e) return null;\n\n // Ignore bot messages\n if (e.bot_id || e.subtype === \"bot_message\") return null;\n // Ignore message edits and deletes\n if (e.subtype === \"message_changed\" || e.subtype === \"message_deleted\")\n return null;\n\n // Handle both direct messages and app_mentions\n const text = e.text?.trim();\n if (!text) return null;\n\n // Remove bot mention from text (e.g., \"<@U123> do something\" → \"do something\")\n const cleanText = text.replace(/<@[A-Z0-9]+>/g, \"\").trim();\n if (!cleanText) return null;\n\n // Thread ID: use thread_ts if in a thread, otherwise message ts\n const threadTs = e.thread_ts || e.ts;\n const externalThreadId = `${e.channel}:${threadTs}`;\n\n return {\n platform: \"slack\",\n externalThreadId,\n text: cleanText,\n senderName: e.user,\n senderId: e.user,\n platformContext: {\n channelId: e.channel,\n threadTs: threadTs,\n messageTs: e.ts,\n teamId: payload.team_id,\n eventId: payload.event_id,\n },\n timestamp: Math.floor(parseFloat(e.ts) * 1000),\n };\n }\n\n return null;\n },\n\n async postProcessingPlaceholder(\n incoming: IncomingMessage,\n ): Promise<{ placeholderRef: string } | null> {\n // No placeholder reply in the thread — Slack's native assistant\n // status bar (\"agent-native is thinking…\", below the composer) is the\n // loading affordance. A second visible \"Working on it…\" reply was\n // redundant and added an extra chunk that we then had to overwrite.\n // We just set the native status and return null so sendResponse posts\n // the final reply as a fresh message.\n const token = process.env.SLACK_BOT_TOKEN;\n if (!token) return null;\n\n const channelId = incoming.platformContext.channelId as string;\n const threadTs = incoming.platformContext.threadTs as string;\n if (!channelId || !threadTs) return null;\n\n // Best-effort: flip the native AI-assistant \"is thinking…\" status bar\n // in the channel input area. Requires `assistant:write` scope on the\n // app — otherwise silently no-ops.\n setSlackAssistantStatus(token, channelId, threadTs, \"is thinking…\");\n return null;\n },\n\n async sendResponse(\n message: OutgoingMessage,\n context: IncomingMessage,\n opts?: { placeholderRef?: string },\n ): Promise<void> {\n const token = process.env.SLACK_BOT_TOKEN;\n if (!token) {\n console.error(\"[slack] SLACK_BOT_TOKEN not configured\");\n return;\n }\n\n const channelId = context.platformContext.channelId as string;\n const threadTs = context.platformContext.threadTs as string;\n const blocks = (message.platformContext as any)?.blocks as\n | unknown[]\n | undefined;\n const placeholderRef = opts?.placeholderRef;\n\n // Block-rich path: split text into chunks but render the FIRST chunk as\n // blocks (so we keep the in-place edit + button) and any overflow as\n // plain follow-up posts. The vast majority of replies fit in one block.\n const chunks = splitNonEmptyMessage(message.text, SLACK_MAX_LENGTH);\n const hasProvidedBlocks = Array.isArray(blocks) && blocks.length > 0;\n const firstChunk = chunks[0] ?? (hasProvidedBlocks ? \"Response\" : \"\");\n if (!firstChunk) {\n if (threadTs) {\n setSlackAssistantStatus(token, channelId, threadTs, \"\");\n }\n return;\n }\n const restChunks = chunks.slice(1);\n\n const finalBlocks =\n blocks ??\n buildResponseBlocks(firstChunk, {\n threadDeepLinkUrl: (message.platformContext as any)\n ?.threadDeepLinkUrl,\n });\n\n const baseBody: Record<string, unknown> = {\n channel: channelId,\n text: firstChunk,\n blocks: finalBlocks,\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n };\n\n try {\n if (placeholderRef) {\n // Replace the \"thinking…\" placeholder in place.\n const res = await slackApiFetch(\"https://slack.com/api/chat.update\", {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ ...baseBody, ts: placeholderRef }),\n });\n const data = (await res.json()) as {\n ok: boolean;\n error?: string;\n };\n if (!data.ok) {\n console.error(\"[slack] chat.update error:\", data.error);\n // Fall back to a fresh post so the user still sees a reply\n await postFresh(token, channelId, threadTs, baseBody);\n }\n } else {\n await postFresh(token, channelId, threadTs, baseBody);\n }\n\n // Clear the AI-assistant \"is thinking…\" status now that we've\n // delivered the final answer. Empty status clears it.\n if (threadTs) {\n setSlackAssistantStatus(token, channelId, threadTs, \"\");\n }\n\n // Overflow chunks (rare) — post as plain follow-ups in the same thread\n for (const chunk of restChunks) {\n await postFresh(token, channelId, threadTs, {\n channel: channelId,\n text: chunk,\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n });\n }\n } catch (err) {\n console.error(\"[slack] Failed to send message:\", err);\n throw err;\n }\n },\n\n async sendMessageToTarget(\n message: OutgoingMessage,\n target: OutboundTarget,\n ): Promise<void> {\n const token = process.env.SLACK_BOT_TOKEN;\n if (!token) {\n console.error(\"[slack] SLACK_BOT_TOKEN not configured\");\n return;\n }\n\n const chunks = splitNonEmptyMessage(message.text, SLACK_MAX_LENGTH);\n if (chunks.length === 0) return;\n for (const chunk of chunks) {\n const body: Record<string, unknown> = {\n channel: target.destination,\n text: chunk,\n };\n if (target.threadRef) body.thread_ts = target.threadRef;\n\n try {\n const res = await slackApiFetch(\n \"https://slack.com/api/chat.postMessage\",\n {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(body),\n },\n );\n const data = (await res.json()) as { ok: boolean; error?: string };\n if (!data.ok) {\n throw new Error(data.error || \"chat.postMessage failed\");\n }\n } catch (err) {\n console.error(\"[slack] Failed to send proactive message:\", err);\n throw err;\n }\n }\n },\n\n formatAgentResponse(\n text: string,\n opts?: { threadDeepLinkUrl?: string },\n ): OutgoingMessage {\n return {\n text: markdownToSlackMrkdwn(text),\n platformContext: opts?.threadDeepLinkUrl\n ? { threadDeepLinkUrl: opts.threadDeepLinkUrl }\n : {},\n };\n },\n\n async getStatus(baseUrl?: string): Promise<IntegrationStatus> {\n const hasToken = !!process.env.SLACK_BOT_TOKEN;\n const hasSecret = !!process.env.SLACK_SIGNING_SECRET;\n const configured = hasToken && hasSecret;\n\n return {\n platform: \"slack\",\n label: \"Slack\",\n enabled: false, // overridden by plugin\n configured,\n details: {\n hasToken,\n hasSecret,\n },\n error: !configured\n ? \"Set SLACK_BOT_TOKEN and SLACK_SIGNING_SECRET in your environment\"\n : undefined,\n };\n },\n };\n}\n\n/**\n * Parse a comma-separated env var into a Set of trimmed, non-empty values.\n * Returns null when the env var is unset or empty (so callers can\n * distinguish \"no allowlist configured\" from \"empty allowlist\").\n */\nfunction parseAllowlistEnv(name: string): Set<string> | null {\n const raw = process.env[name];\n if (!raw) return null;\n const values = raw\n .split(\",\")\n .map((v) => v.trim())\n .filter((v) => v.length > 0);\n if (values.length === 0) return null;\n return new Set(values);\n}\n\nlet _missingAllowlistWarned = false;\n\n/**\n * Enforce that an incoming Slack event comes from an allowlisted workspace.\n *\n * H1 in the webhook audit: the framework uses a SINGLE global\n * SLACK_SIGNING_SECRET for every workspace the Slack app is installed to,\n * so a valid signature alone doesn't prove the request belongs to the\n * tenant the deployment intends to serve. This helper layers a per-tenant\n * allowlist on top of signature verification.\n *\n * Behavior:\n * - If `SLACK_ALLOWED_TEAM_IDS` is set: reject any payload whose\n * `team_id` isn't in the list.\n * - If `SLACK_ALLOWED_API_APP_IDS` is set: also reject payloads whose\n * `api_app_id` isn't in the list (bot apps can be installed under the\n * same Slack app id across multiple workspaces — pinning both keeps\n * the surface tight when team_id allows multiple workspaces).\n * - If `SLACK_ALLOWED_TEAM_IDS` is unset/empty in production: reject the\n * event. Production must fail closed so any workspace with the shared\n * signing secret cannot drive the agent.\n * - If `SLACK_ALLOWED_TEAM_IDS` is unset/empty in dev / single-tenant: log a\n * one-time warning and accept (current local setup behavior).\n *\n * Throws an h3 401 error when an allowlisted-but-mismatched payload is\n * received, which the integrations plugin surfaces to the caller as\n * \"Unrecognized Slack workspace\" without enqueuing the event.\n */\nfunction enforceWorkspaceAllowlist(payload: any): void {\n const teamId =\n typeof payload?.team_id === \"string\" ? payload.team_id : undefined;\n const apiAppId =\n typeof payload?.api_app_id === \"string\" ? payload.api_app_id : undefined;\n\n const allowedTeamIds = parseAllowlistEnv(\"SLACK_ALLOWED_TEAM_IDS\");\n const allowedAppIds = parseAllowlistEnv(\"SLACK_ALLOWED_API_APP_IDS\");\n\n if (!allowedTeamIds) {\n if (process.env.NODE_ENV === \"production\") {\n throw createError({\n statusCode: 401,\n statusMessage: \"Slack workspace allowlist is not configured\",\n });\n }\n if (!_missingAllowlistWarned) {\n _missingAllowlistWarned = true;\n console.warn(\n \"[slack] SLACK_ALLOWED_TEAM_IDS not set — accepting events from any workspace whose signature matches SLACK_SIGNING_SECRET. \" +\n \"Set SLACK_ALLOWED_TEAM_IDS to a comma-separated list of allowed team_id values before deploying to production.\",\n );\n }\n }\n\n if (allowedTeamIds) {\n if (!teamId || !allowedTeamIds.has(teamId)) {\n throw createError({\n statusCode: 401,\n statusMessage: \"Unrecognized Slack workspace\",\n });\n }\n }\n\n if (allowedAppIds) {\n if (!apiAppId || !allowedAppIds.has(apiAppId)) {\n throw createError({\n statusCode: 401,\n statusMessage: \"Unrecognized Slack workspace\",\n });\n }\n }\n}\n\n/**\n * Read the raw request body as a string and cache on the event context.\n *\n * This MUST read raw bytes from the request stream — never `JSON.stringify`\n * a parsed body, because Slack's HMAC is computed over the exact bytes Slack\n * sent. Re-stringifying a parsed object loses key ordering, whitespace, and\n * Unicode-escape choices, so the signature check would silently fail for\n * legitimate requests (M2 in the webhook security audit).\n *\n * h3 v2's body stream is consume-once, so we cache the raw string on the\n * event context after the first read. All call sites (handleVerification,\n * verifyWebhook, parseIncomingMessage) MUST go through this helper.\n */\nasync function readRawBodyCached(event: H3Event): Promise<string> {\n const cached = event.context.__rawBody;\n if (typeof cached === \"string\") return cached;\n // h3's readRawBody returns the bytes Slack actually sent, defaulting to\n // utf8-decoded. Returns undefined for empty bodies — we coerce to \"\" so\n // the HMAC check can proceed deterministically.\n const raw = (await readRawBody(event)) ?? \"\";\n event.context.__rawBody = raw;\n return raw;\n}\n\nfunction utf8ByteLength(text: string): number {\n return new TextEncoder().encode(text).length;\n}\n\nfunction prefixWithinUtf8ByteLimit(text: string, maxLength: number): string {\n let bytes = 0;\n let end = 0;\n for (const char of text) {\n const nextBytes = utf8ByteLength(char);\n if (bytes + nextBytes > maxLength) break;\n bytes += nextBytes;\n end += char.length;\n }\n return text.slice(0, end || 1);\n}\n\n/** Split a message into chunks that fit within the platform's byte limit. */\nfunction splitMessage(text: string, maxLength: number): string[] {\n if (utf8ByteLength(text) <= maxLength) return [text];\n const chunks: string[] = [];\n let remaining = text;\n while (remaining.length > 0) {\n if (utf8ByteLength(remaining) <= maxLength) {\n chunks.push(remaining);\n break;\n }\n\n const prefix = prefixWithinUtf8ByteLimit(remaining, maxLength);\n\n // Try to split at a newline\n let splitIdx = prefix.lastIndexOf(\"\\n\");\n if (splitIdx <= 0) {\n // Try to split at a space\n splitIdx = prefix.lastIndexOf(\" \");\n }\n if (splitIdx <= 0) {\n splitIdx = prefix.length;\n }\n chunks.push(remaining.slice(0, splitIdx));\n remaining = remaining.slice(splitIdx).trimStart();\n }\n return chunks;\n}\n\n/** Split a message and drop chunks Slack would render as blank messages. */\nfunction splitNonEmptyMessage(text: string, maxLength: number): string[] {\n return splitMessage(text, maxLength).filter(\n (chunk) => chunk.trim().length > 0,\n );\n}\n\n/** Hard cap on input length we feed to the regex-based mrkdwn converter.\n * L2 in the webhook audit: `\\*\\*(.+?)\\*\\*` with the `s` flag on a long\n * string of asterisks can exhibit super-linear backtracking. Slack\n * itself caps message bodies at 4000 chars (SLACK_MAX_LENGTH); we cap\n * the input here at 10x that as a defensive bound for any caller that\n * passes a longer rendering source through this helper before chunking. */\nconst MRKDWN_MAX_LENGTH = 40_000;\n\n/**\n * Convert standard markdown to Slack's mrkdwn dialect.\n * - `[text](url)` → `<url|text>`\n * - `**bold**` → `*bold*` (Slack uses single asterisks for bold)\n *\n * Inputs longer than MRKDWN_MAX_LENGTH are truncated before the regex\n * pass to bound worst-case backtracking on pathological input (L2 in the\n * webhook audit).\n */\nfunction markdownToSlackMrkdwn(text: string): string {\n const bounded =\n text.length > MRKDWN_MAX_LENGTH ? text.slice(0, MRKDWN_MAX_LENGTH) : text;\n return (\n bounded\n .replace(/\\[([^\\]]+)\\]\\(([^)]+)\\)/g, \"<$2|$1>\")\n // Do not wrap bare URLs in Slack bold markers. Slack's autolinker can\n // treat the trailing `*` as part of the URL, producing a broken link.\n .replace(/\\*\\*<?(https?:\\/\\/[^\\s>*]+)>?\\*\\*/g, \"<$1>\")\n // Bounded character class instead of `.+?` with the `s` flag — caps\n // each bold span at 5000 chars so an attacker can't construct a\n // pathological \"**\" sequence that exhibits super-linear backtracking.\n // Newlines are allowed because `[^*]` excludes only the asterisk\n // itself, so multi-line bold spans still match.\n .replace(/\\*\\*([^*]{1,5000})\\*\\*/g, \"*$1*\")\n );\n}\n\n/**\n * Optionally set Slack's native AI-assistant status indicator (the small\n * \"is thinking…\" line under the message composer) for an app configured\n * with the `assistant:write` scope. Pure best-effort — fails silently for\n * apps that aren't set up as AI assistants.\n */\nfunction setSlackAssistantStatus(\n token: string,\n channelId: string,\n threadTs: string,\n status: string,\n): void {\n slackApiFetch(\"https://slack.com/api/assistant.threads.setStatus\", {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n channel_id: channelId,\n thread_ts: threadTs,\n status,\n }),\n }).catch(() => {});\n}\n\n/**\n * Block Kit payload for the final answer. We avoid auto-unfurl previews by\n * separating the deep-link out into a button instead of inlining it as a\n * `<url|text>` markdown link in the section body — that's what was producing\n * the giant \"Agent-Native Dispatch\" card in every thread reply.\n */\nfunction buildResponseBlocks(\n text: string,\n opts: { threadDeepLinkUrl?: string },\n): unknown[] {\n const sectionChunks = splitMessage(\n text || \"_(no response)_\",\n SLACK_SECTION_TEXT_MAX_LENGTH,\n );\n const blocks: any[] = sectionChunks.map((chunk) => ({\n type: \"section\",\n text: { type: \"mrkdwn\", text: chunk },\n }));\n if (opts.threadDeepLinkUrl) {\n blocks.push({\n type: \"actions\",\n elements: [\n {\n type: \"button\",\n text: { type: \"plain_text\", text: \"Open thread\", emoji: true },\n url: opts.threadDeepLinkUrl,\n action_id: \"open_dispatch_thread\",\n },\n ],\n });\n }\n return blocks;\n}\n\n/**\n * Post a fresh message to a thread. Used as the placeholder-fallback path\n * (e.g. when chat.update fails) and for follow-up overflow chunks.\n */\nasync function postFresh(\n token: string,\n channelId: string,\n threadTs: string | undefined,\n body: Record<string, unknown>,\n): Promise<void> {\n const hasBlocks =\n Array.isArray(body.blocks) && (body.blocks as unknown[]).length > 0;\n if (\n typeof body.text === \"string\" &&\n body.text.trim().length === 0 &&\n !hasBlocks\n ) {\n return;\n }\n\n const payload: Record<string, unknown> = {\n ...body,\n channel: channelId,\n };\n if (threadTs && !payload.thread_ts) payload.thread_ts = threadTs;\n const res = await slackApiFetch(\"https://slack.com/api/chat.postMessage\", {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(payload),\n });\n const data = (await res.json()) as { ok: boolean; error?: string };\n if (!data.ok) {\n console.error(\"[slack] chat.postMessage error:\", data.error);\n throw new Error(data.error || \"chat.postMessage failed\");\n }\n}\n\nasync function slackApiFetch(\n url: string,\n init: RequestInit,\n): Promise<Response> {\n const controller =\n typeof AbortController !== \"undefined\" ? new AbortController() : undefined;\n const timer = controller\n ? setTimeout(() => controller.abort(), SLACK_API_TIMEOUT_MS)\n : undefined;\n try {\n return await fetch(url, {\n ...init,\n signal: controller?.signal ?? init.signal,\n });\n } finally {\n if (timer) clearTimeout(timer);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"slack.js","sourceRoot":"","sources":["../../../src/integrations/adapters/slack.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAUzD,iCAAiC;AACjC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAC3C,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO;QACL,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,OAAO;QAEd,kBAAkB;YAChB,OAAO;gBACL;oBACE,GAAG,EAAE,iBAAiB;oBACtB,KAAK,EAAE,iBAAiB;oBACxB,QAAQ,EAAE,IAAI;oBACd,QAAQ,EACN,iGAAiG;iBACpG;gBACD;oBACE,GAAG,EAAE,sBAAsB;oBAC3B,KAAK,EAAE,sBAAsB;oBAC7B,QAAQ,EAAE,IAAI;oBACd,QAAQ,EACN,qFAAqF;iBACxF;aACF,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,kBAAkB,CACtB,KAAc;YAEd,kEAAkE;YAClE,uEAAuE;YACvE,oEAAoE;YACpE,2DAA2D;YAC3D,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAC5C,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAChC,IAAI,MAAM,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;oBACvC,8DAA8D;oBAC9D,mEAAmE;oBACnE,8DAA8D;oBAC9D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,C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S,GAAG,QAAQ,CAAC;IACjE,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,wCAAwC,EAAE;QACxE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,KAAK,EAAE;YAChC,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KAC9B,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAoC,CAAC;IACnE,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7D,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,yBAAyB,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC;AAED,KAAK,UAAU,aAAa,CAC1B,GAAW,EACX,IAAiB;IAEjB,MAAM,UAAU,GACd,OAAO,eAAe,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7E,MAAM,KAAK,GAAG,UAAU;QACtB,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,oBAAoB,CAAC;QAC5D,CAAC,CAAC,SAAS,CAAC;IACd,IAAI,CAAC;QACH,OAAO,MAAM,KAAK,CAAC,GAAG,EAAE;YACtB,GAAG,IAAI;YACP,MAAM,EAAE,UAAU,EAAE,MAAM,IAAI,IAAI,CAAC,MAAM;SAC1C,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;AACH,CAAC","sourcesContent":["import type { H3Event } from \"h3\";\nimport { createError, getHeader, readRawBody } from \"h3\";\nimport type {\n PlatformAdapter,\n IncomingMessage,\n OutgoingMessage,\n IntegrationStatus,\n OutboundTarget,\n} from \"../types.js\";\nimport type { EnvKeyConfig } from \"../../server/create-server.js\";\n\n/** Slack's max message length */\nconst SLACK_MAX_LENGTH = 4000;\nconst SLACK_SECTION_TEXT_MAX_LENGTH = 3000;\nconst SLACK_API_TIMEOUT_MS = 10_000;\n\n/**\n * Create a Slack platform adapter.\n *\n * Required env vars:\n * - SLACK_BOT_TOKEN — Bot user OAuth token (xoxb-...)\n * - SLACK_SIGNING_SECRET — Used to verify webhook signatures\n *\n * Optional env vars:\n * - SLACK_ALLOWED_TEAM_IDS — Comma-separated list of Slack workspace\n * `team_id` values (e.g. \"T012ABCDEF,T034GHIJKL\") that this deployment\n * accepts events from. Required in production and strongly recommended\n * to prevent cross-workspace event injection (H1 in the webhook audit):\n * the global `SLACK_SIGNING_SECRET` is the same key for every workspace\n * the app is installed to, so without an allowlist any installed\n * workspace can drive the agent. When unset the adapter accepts events\n * from any workspace in development, but rejects events in production.\n * - SLACK_ALLOWED_API_APP_IDS — Comma-separated list of Slack app IDs\n * (`api_app_id`) to additionally pin events to. Useful when the same\n * signing secret rotation surfaces multiple app installs.\n */\nexport function slackAdapter(): PlatformAdapter {\n return {\n platform: \"slack\",\n label: \"Slack\",\n\n getRequiredEnvKeys(): EnvKeyConfig[] {\n return [\n {\n key: \"SLACK_BOT_TOKEN\",\n label: \"Slack Bot Token\",\n required: true,\n helpText:\n \"In your Slack app's left nav: OAuth & Permissions → Bot User OAuth Token (starts with `xoxb-`).\",\n },\n {\n key: \"SLACK_SIGNING_SECRET\",\n label: \"Slack Signing Secret\",\n required: true,\n helpText:\n \"In your Slack app's left nav: Basic Information → App Credentials → Signing Secret.\",\n },\n ];\n },\n\n async handleVerification(\n event: H3Event,\n ): Promise<{ handled: boolean; response?: unknown }> {\n // Slack sends url_verification when first setting up the webhook.\n // readRawBodyCached caches the raw bytes on event.context.__rawBody so\n // subsequent verifyWebhook + parseIncomingMessage calls re-use them\n // without re-stringifying a parsed body (M2 in the audit).\n const body = await readRawBodyCached(event);\n try {\n const parsed = JSON.parse(body);\n if (parsed.type === \"url_verification\") {\n // Slack's URL verifier expects the raw challenge value in the\n // response body. Returning JSON works for some clients but the app\n // settings verifier rejects it as not matching the challenge.\n return { handled: true, response: parsed.challenge };\n }\n } catch {}\n return { handled: false };\n },\n\n async verifyWebhook(event: H3Event): Promise<boolean> {\n const signingSecret = process.env.SLACK_SIGNING_SECRET;\n if (!signingSecret) return false;\n\n const signature = getHeader(event, \"x-slack-signature\");\n const timestamp = getHeader(event, \"x-slack-request-timestamp\");\n if (!signature || !timestamp) return false;\n\n // Reject requests older than 5 minutes (replay protection)\n const ts = parseInt(timestamp, 10);\n if (Math.abs(Date.now() / 1000 - ts) > 300) return false;\n\n const body = await readRawBodyCached(event);\n const crypto = await import(\"node:crypto\");\n const basestring = `v0:${timestamp}:${body}`;\n const expectedSignature =\n \"v0=\" +\n crypto\n .createHmac(\"sha256\", signingSecret)\n .update(basestring)\n .digest(\"hex\");\n\n // Timing-safe comparison\n try {\n return crypto.timingSafeEqual(\n Buffer.from(signature),\n Buffer.from(expectedSignature),\n );\n } catch {\n return false;\n }\n },\n\n async parseIncomingMessage(\n event: H3Event,\n ): Promise<IncomingMessage | null> {\n const raw = await readRawBodyCached(event);\n let payload: any;\n try {\n payload = JSON.parse(raw);\n } catch {\n return null;\n }\n\n // H1 (webhook audit): cross-workspace event injection. The global\n // SLACK_SIGNING_SECRET is the same key for every workspace this Slack\n // app is installed to — without a per-tenant allowlist any installed\n // workspace can drive the agent. We enforce SLACK_ALLOWED_TEAM_IDS\n // here AFTER the signature has already been verified by the webhook\n // handler, so this is purely a tenant-isolation gate (not a forgery\n // defense). When unset in production we surface a one-time warning\n // recommending it be configured.\n enforceWorkspaceAllowlist(payload);\n\n // Handle Events API wrapper\n if (payload.type === \"event_callback\") {\n const e = payload.event;\n if (!e) return null;\n\n // Ignore bot messages\n if (e.bot_id || e.subtype === \"bot_message\") return null;\n // Ignore message edits and deletes\n if (e.subtype === \"message_changed\" || e.subtype === \"message_deleted\")\n return null;\n\n // Handle both direct messages and app_mentions\n const text = e.text?.trim();\n if (!text) return null;\n\n // Remove bot mention from text (e.g., \"<@U123> do something\" → \"do something\")\n const cleanText = text.replace(/<@[A-Z0-9]+>/g, \"\").trim();\n if (!cleanText) return null;\n\n // Thread ID: use thread_ts if in a thread, otherwise message ts\n const threadTs = e.thread_ts || e.ts;\n const externalThreadId = `${e.channel}:${threadTs}`;\n\n return {\n platform: \"slack\",\n externalThreadId,\n text: cleanText,\n senderName: e.user,\n senderId: e.user,\n platformContext: {\n channelId: e.channel,\n threadTs: threadTs,\n messageTs: e.ts,\n teamId: payload.team_id,\n eventId: payload.event_id,\n },\n timestamp: Math.floor(parseFloat(e.ts) * 1000),\n };\n }\n\n return null;\n },\n\n async postProcessingPlaceholder(\n incoming: IncomingMessage,\n ): Promise<{ placeholderRef: string } | null> {\n // No placeholder reply in the thread — Slack's native assistant\n // status bar (\"agent-native is thinking…\", below the composer) is the\n // loading affordance. A second visible \"Working on it…\" reply was\n // redundant and added an extra chunk that we then had to overwrite.\n // We just set the native status and return null so sendResponse posts\n // the final reply as a fresh message.\n const token = process.env.SLACK_BOT_TOKEN;\n if (!token) return null;\n\n const channelId = incoming.platformContext.channelId as string;\n const threadTs = incoming.platformContext.threadTs as string;\n if (!channelId || !threadTs) return null;\n\n // Best-effort: flip the native AI-assistant \"is thinking…\" status bar\n // in the channel input area. Requires `assistant:write` scope on the\n // app — otherwise silently no-ops.\n setSlackAssistantStatus(token, channelId, threadTs, \"is thinking…\");\n return null;\n },\n\n async sendResponse(\n message: OutgoingMessage,\n context: IncomingMessage,\n opts?: { placeholderRef?: string },\n ): Promise<void> {\n const token = process.env.SLACK_BOT_TOKEN;\n if (!token) {\n console.error(\"[slack] SLACK_BOT_TOKEN not configured\");\n return;\n }\n\n const channelId = context.platformContext.channelId as string;\n const threadTs = context.platformContext.threadTs as string;\n const blocks = (message.platformContext as any)?.blocks as\n | unknown[]\n | undefined;\n const placeholderRef = opts?.placeholderRef;\n\n // Block-rich path: split text into chunks but render the FIRST chunk as\n // blocks (so we keep the in-place edit + button) and any overflow as\n // plain follow-up posts. The vast majority of replies fit in one block.\n const chunks = splitNonEmptyMessage(message.text, SLACK_MAX_LENGTH);\n const hasProvidedBlocks = Array.isArray(blocks) && blocks.length > 0;\n const firstChunk = chunks[0] ?? (hasProvidedBlocks ? \"Response\" : \"\");\n if (!firstChunk) {\n if (threadTs) {\n setSlackAssistantStatus(token, channelId, threadTs, \"\");\n }\n return;\n }\n const restChunks = chunks.slice(1);\n\n const finalBlocks =\n blocks ??\n buildResponseBlocks(firstChunk, {\n threadDeepLinkUrl: (message.platformContext as any)\n ?.threadDeepLinkUrl,\n });\n\n const baseBody: Record<string, unknown> = {\n channel: channelId,\n text: firstChunk,\n blocks: finalBlocks,\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n };\n\n try {\n if (placeholderRef) {\n // Replace the \"thinking…\" placeholder in place.\n const res = await slackApiFetch(\"https://slack.com/api/chat.update\", {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ ...baseBody, ts: placeholderRef }),\n });\n const data = (await res.json()) as {\n ok: boolean;\n error?: string;\n };\n if (!data.ok) {\n console.error(\"[slack] chat.update error:\", data.error);\n // Fall back to a fresh post so the user still sees a reply\n await postFresh(token, channelId, threadTs, baseBody);\n }\n } else {\n await postFresh(token, channelId, threadTs, baseBody);\n }\n\n // Clear the AI-assistant \"is thinking…\" status now that we've\n // delivered the final answer. Empty status clears it.\n if (threadTs) {\n setSlackAssistantStatus(token, channelId, threadTs, \"\");\n }\n\n // Overflow chunks (rare) — post as plain follow-ups in the same thread\n for (const chunk of restChunks) {\n await postFresh(token, channelId, threadTs, {\n channel: channelId,\n text: chunk,\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n });\n }\n } catch (err) {\n console.error(\"[slack] Failed to send message:\", err);\n throw err;\n }\n },\n\n async sendMessageToTarget(\n message: OutgoingMessage,\n target: OutboundTarget,\n ): Promise<void> {\n const token = process.env.SLACK_BOT_TOKEN;\n if (!token) {\n console.error(\"[slack] SLACK_BOT_TOKEN not configured\");\n return;\n }\n\n const chunks = splitNonEmptyMessage(message.text, SLACK_MAX_LENGTH);\n if (chunks.length === 0) return;\n for (const chunk of chunks) {\n const body: Record<string, unknown> = {\n channel: target.destination,\n text: chunk,\n };\n if (target.threadRef) body.thread_ts = target.threadRef;\n\n try {\n const res = await slackApiFetch(\n \"https://slack.com/api/chat.postMessage\",\n {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(body),\n },\n );\n const data = (await res.json()) as { ok: boolean; error?: string };\n if (!data.ok) {\n throw new Error(data.error || \"chat.postMessage failed\");\n }\n } catch (err) {\n console.error(\"[slack] Failed to send proactive message:\", err);\n throw err;\n }\n }\n },\n\n formatAgentResponse(\n text: string,\n opts?: { threadDeepLinkUrl?: string },\n ): OutgoingMessage {\n return {\n text: markdownToSlackMrkdwn(text),\n platformContext: opts?.threadDeepLinkUrl\n ? { threadDeepLinkUrl: opts.threadDeepLinkUrl }\n : {},\n };\n },\n\n async getStatus(_baseUrl?: string): Promise<IntegrationStatus> {\n const hasToken = !!process.env.SLACK_BOT_TOKEN;\n const hasSecret = !!process.env.SLACK_SIGNING_SECRET;\n const configured = hasToken && hasSecret;\n\n return {\n platform: \"slack\",\n label: \"Slack\",\n enabled: false, // overridden by plugin\n configured,\n details: {\n hasToken,\n hasSecret,\n },\n error: !configured\n ? \"Set SLACK_BOT_TOKEN and SLACK_SIGNING_SECRET in your environment\"\n : undefined,\n };\n },\n };\n}\n\n/**\n * Parse a comma-separated env var into a Set of trimmed, non-empty values.\n * Returns null when the env var is unset or empty (so callers can\n * distinguish \"no allowlist configured\" from \"empty allowlist\").\n */\nfunction parseAllowlistEnv(name: string): Set<string> | null {\n const raw = process.env[name];\n if (!raw) return null;\n const values = raw\n .split(\",\")\n .map((v) => v.trim())\n .filter((v) => v.length > 0);\n if (values.length === 0) return null;\n return new Set(values);\n}\n\nlet _missingAllowlistWarned = false;\n\n/**\n * Enforce that an incoming Slack event comes from an allowlisted workspace.\n *\n * H1 in the webhook audit: the framework uses a SINGLE global\n * SLACK_SIGNING_SECRET for every workspace the Slack app is installed to,\n * so a valid signature alone doesn't prove the request belongs to the\n * tenant the deployment intends to serve. This helper layers a per-tenant\n * allowlist on top of signature verification.\n *\n * Behavior:\n * - If `SLACK_ALLOWED_TEAM_IDS` is set: reject any payload whose\n * `team_id` isn't in the list.\n * - If `SLACK_ALLOWED_API_APP_IDS` is set: also reject payloads whose\n * `api_app_id` isn't in the list (bot apps can be installed under the\n * same Slack app id across multiple workspaces — pinning both keeps\n * the surface tight when team_id allows multiple workspaces).\n * - If `SLACK_ALLOWED_TEAM_IDS` is unset/empty in production: reject the\n * event. Production must fail closed so any workspace with the shared\n * signing secret cannot drive the agent.\n * - If `SLACK_ALLOWED_TEAM_IDS` is unset/empty in dev / single-tenant: log a\n * one-time warning and accept (current local setup behavior).\n *\n * Throws an h3 401 error when an allowlisted-but-mismatched payload is\n * received, which the integrations plugin surfaces to the caller as\n * \"Unrecognized Slack workspace\" without enqueuing the event.\n */\nfunction enforceWorkspaceAllowlist(payload: any): void {\n const teamId =\n typeof payload?.team_id === \"string\" ? payload.team_id : undefined;\n const apiAppId =\n typeof payload?.api_app_id === \"string\" ? payload.api_app_id : undefined;\n\n const allowedTeamIds = parseAllowlistEnv(\"SLACK_ALLOWED_TEAM_IDS\");\n const allowedAppIds = parseAllowlistEnv(\"SLACK_ALLOWED_API_APP_IDS\");\n\n if (!allowedTeamIds) {\n if (process.env.NODE_ENV === \"production\") {\n throw createError({\n statusCode: 401,\n statusMessage: \"Slack workspace allowlist is not configured\",\n });\n }\n if (!_missingAllowlistWarned) {\n _missingAllowlistWarned = true;\n console.warn(\n \"[slack] SLACK_ALLOWED_TEAM_IDS not set — accepting events from any workspace whose signature matches SLACK_SIGNING_SECRET. \" +\n \"Set SLACK_ALLOWED_TEAM_IDS to a comma-separated list of allowed team_id values before deploying to production.\",\n );\n }\n }\n\n if (allowedTeamIds) {\n if (!teamId || !allowedTeamIds.has(teamId)) {\n throw createError({\n statusCode: 401,\n statusMessage: \"Unrecognized Slack workspace\",\n });\n }\n }\n\n if (allowedAppIds) {\n if (!apiAppId || !allowedAppIds.has(apiAppId)) {\n throw createError({\n statusCode: 401,\n statusMessage: \"Unrecognized Slack workspace\",\n });\n }\n }\n}\n\n/**\n * Read the raw request body as a string and cache on the event context.\n *\n * This MUST read raw bytes from the request stream — never `JSON.stringify`\n * a parsed body, because Slack's HMAC is computed over the exact bytes Slack\n * sent. Re-stringifying a parsed object loses key ordering, whitespace, and\n * Unicode-escape choices, so the signature check would silently fail for\n * legitimate requests (M2 in the webhook security audit).\n *\n * h3 v2's body stream is consume-once, so we cache the raw string on the\n * event context after the first read. All call sites (handleVerification,\n * verifyWebhook, parseIncomingMessage) MUST go through this helper.\n */\nasync function readRawBodyCached(event: H3Event): Promise<string> {\n const cached = event.context.__rawBody;\n if (typeof cached === \"string\") return cached;\n // h3's readRawBody returns the bytes Slack actually sent, defaulting to\n // utf8-decoded. Returns undefined for empty bodies — we coerce to \"\" so\n // the HMAC check can proceed deterministically.\n const raw = (await readRawBody(event)) ?? \"\";\n event.context.__rawBody = raw;\n return raw;\n}\n\nfunction utf8ByteLength(text: string): number {\n return new TextEncoder().encode(text).length;\n}\n\nfunction prefixWithinUtf8ByteLimit(text: string, maxLength: number): string {\n let bytes = 0;\n let end = 0;\n for (const char of text) {\n const nextBytes = utf8ByteLength(char);\n if (bytes + nextBytes > maxLength) break;\n bytes += nextBytes;\n end += char.length;\n }\n return text.slice(0, end || 1);\n}\n\n/** Split a message into chunks that fit within the platform's byte limit. */\nfunction splitMessage(text: string, maxLength: number): string[] {\n if (utf8ByteLength(text) <= maxLength) return [text];\n const chunks: string[] = [];\n let remaining = text;\n while (remaining.length > 0) {\n if (utf8ByteLength(remaining) <= maxLength) {\n chunks.push(remaining);\n break;\n }\n\n const prefix = prefixWithinUtf8ByteLimit(remaining, maxLength);\n\n // Try to split at a newline\n let splitIdx = prefix.lastIndexOf(\"\\n\");\n if (splitIdx <= 0) {\n // Try to split at a space\n splitIdx = prefix.lastIndexOf(\" \");\n }\n if (splitIdx <= 0) {\n splitIdx = prefix.length;\n }\n chunks.push(remaining.slice(0, splitIdx));\n remaining = remaining.slice(splitIdx).trimStart();\n }\n return chunks;\n}\n\n/** Split a message and drop chunks Slack would render as blank messages. */\nfunction splitNonEmptyMessage(text: string, maxLength: number): string[] {\n return splitMessage(text, maxLength).filter(\n (chunk) => chunk.trim().length > 0,\n );\n}\n\n/** Hard cap on input length we feed to the regex-based mrkdwn converter.\n * L2 in the webhook audit: `\\*\\*(.+?)\\*\\*` with the `s` flag on a long\n * string of asterisks can exhibit super-linear backtracking. Slack\n * itself caps message bodies at 4000 chars (SLACK_MAX_LENGTH); we cap\n * the input here at 10x that as a defensive bound for any caller that\n * passes a longer rendering source through this helper before chunking. */\nconst MRKDWN_MAX_LENGTH = 40_000;\n\n/**\n * Convert standard markdown to Slack's mrkdwn dialect.\n * - `[text](url)` → `<url|text>`\n * - `**bold**` → `*bold*` (Slack uses single asterisks for bold)\n *\n * Inputs longer than MRKDWN_MAX_LENGTH are truncated before the regex\n * pass to bound worst-case backtracking on pathological input (L2 in the\n * webhook audit).\n */\nfunction markdownToSlackMrkdwn(text: string): string {\n const bounded =\n text.length > MRKDWN_MAX_LENGTH ? text.slice(0, MRKDWN_MAX_LENGTH) : text;\n return (\n bounded\n .replace(/\\[([^\\]]+)\\]\\(([^)]+)\\)/g, \"<$2|$1>\")\n // Do not wrap bare URLs in Slack bold markers. Slack's autolinker can\n // treat the trailing `*` as part of the URL, producing a broken link.\n .replace(/\\*\\*<?(https?:\\/\\/[^\\s>*]+)>?\\*\\*/g, \"<$1>\")\n // Bounded character class instead of `.+?` with the `s` flag — caps\n // each bold span at 5000 chars so an attacker can't construct a\n // pathological \"**\" sequence that exhibits super-linear backtracking.\n // Newlines are allowed because `[^*]` excludes only the asterisk\n // itself, so multi-line bold spans still match.\n .replace(/\\*\\*([^*]{1,5000})\\*\\*/g, \"*$1*\")\n );\n}\n\n/**\n * Optionally set Slack's native AI-assistant status indicator (the small\n * \"is thinking…\" line under the message composer) for an app configured\n * with the `assistant:write` scope. Pure best-effort — fails silently for\n * apps that aren't set up as AI assistants.\n */\nfunction setSlackAssistantStatus(\n token: string,\n channelId: string,\n threadTs: string,\n status: string,\n): void {\n slackApiFetch(\"https://slack.com/api/assistant.threads.setStatus\", {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n channel_id: channelId,\n thread_ts: threadTs,\n status,\n }),\n }).catch(() => {});\n}\n\n/**\n * Block Kit payload for the final answer. We avoid auto-unfurl previews by\n * separating the deep-link out into a button instead of inlining it as a\n * `<url|text>` markdown link in the section body — that's what was producing\n * the giant \"Agent-Native Dispatch\" card in every thread reply.\n */\nfunction buildResponseBlocks(\n text: string,\n opts: { threadDeepLinkUrl?: string },\n): unknown[] {\n const sectionChunks = splitMessage(\n text || \"_(no response)_\",\n SLACK_SECTION_TEXT_MAX_LENGTH,\n );\n const blocks: any[] = sectionChunks.map((chunk) => ({\n type: \"section\",\n text: { type: \"mrkdwn\", text: chunk },\n }));\n if (opts.threadDeepLinkUrl) {\n blocks.push({\n type: \"actions\",\n elements: [\n {\n type: \"button\",\n text: { type: \"plain_text\", text: \"Open thread\", emoji: true },\n url: opts.threadDeepLinkUrl,\n action_id: \"open_dispatch_thread\",\n },\n ],\n });\n }\n return blocks;\n}\n\n/**\n * Post a fresh message to a thread. Used as the placeholder-fallback path\n * (e.g. when chat.update fails) and for follow-up overflow chunks.\n */\nasync function postFresh(\n token: string,\n channelId: string,\n threadTs: string | undefined,\n body: Record<string, unknown>,\n): Promise<void> {\n const hasBlocks =\n Array.isArray(body.blocks) && (body.blocks as unknown[]).length > 0;\n if (\n typeof body.text === \"string\" &&\n body.text.trim().length === 0 &&\n !hasBlocks\n ) {\n return;\n }\n\n const payload: Record<string, unknown> = {\n ...body,\n channel: channelId,\n };\n if (threadTs && !payload.thread_ts) payload.thread_ts = threadTs;\n const res = await slackApiFetch(\"https://slack.com/api/chat.postMessage\", {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(payload),\n });\n const data = (await res.json()) as { ok: boolean; error?: string };\n if (!data.ok) {\n console.error(\"[slack] chat.postMessage error:\", data.error);\n throw new Error(data.error || \"chat.postMessage failed\");\n }\n}\n\nasync function slackApiFetch(\n url: string,\n init: RequestInit,\n): Promise<Response> {\n const controller =\n typeof AbortController !== \"undefined\" ? new AbortController() : undefined;\n const timer = controller\n ? setTimeout(() => controller.abort(), SLACK_API_TIMEOUT_MS)\n : undefined;\n try {\n return await fetch(url, {\n ...init,\n signal: controller?.signal ?? init.signal,\n });\n } finally {\n if (timer) clearTimeout(timer);\n }\n}\n"]}
|
|
@@ -1357,7 +1357,7 @@ export function createIntegrationsPlugin(options) {
|
|
|
1357
1357
|
startGoogleDocsPoller({
|
|
1358
1358
|
systemPrompt: baseSystemPrompt,
|
|
1359
1359
|
actions,
|
|
1360
|
-
model,
|
|
1360
|
+
model: model ?? "",
|
|
1361
1361
|
apiKey: getApiKey(),
|
|
1362
1362
|
ownerEmail: "integration@google-docs",
|
|
1363
1363
|
webhookUrl,
|