@agent-native/core 0.129.2 → 0.130.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/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +78 -0
- package/corpus/core/docs/content/cloneable-saas.mdx +114 -0
- package/corpus/core/docs/content/creating-templates.mdx +28 -2
- package/corpus/core/docs/content/syncing-template-changes.mdx +7 -0
- package/corpus/core/docs/content/template-clips-developers.mdx +12 -5
- package/corpus/core/docs/content/template-dispatch-developers.mdx +1 -1
- package/corpus/core/docs/content/template-dispatch.mdx +1 -1
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/action-ui.ts +1 -0
- package/corpus/core/src/action.ts +5 -1
- package/corpus/core/src/agent/engine/ai-sdk-engine.ts +15 -5
- package/corpus/core/src/agent/harness/runner.ts +5 -0
- package/corpus/core/src/agent/production-agent.ts +33 -0
- package/corpus/core/src/agent/run-loop-with-resume.ts +5 -0
- package/corpus/core/src/agent/run-manager.ts +126 -1
- package/corpus/core/src/agent/thread-data-builder.ts +47 -2
- package/corpus/core/src/agent/types.ts +2 -0
- package/corpus/core/src/chat-threads/store.ts +4 -5
- package/corpus/core/src/cli/create.ts +1139 -65
- package/corpus/core/src/cli/design-connect.ts +3 -7
- package/corpus/core/src/cli/index.ts +5 -3
- package/corpus/core/src/cli/skills-content/design-visual-edit-skill.ts +83 -47
- package/corpus/core/src/client/AssistantChat.tsx +27 -16
- package/corpus/core/src/client/agent-chat-adapter.ts +24 -0
- package/corpus/core/src/client/blocks/library/wireframe-kit.tsx +17 -2
- package/corpus/core/src/client/chat/index.ts +1 -0
- package/corpus/core/src/client/chat/message-components.tsx +104 -1
- package/corpus/core/src/client/chat/run-recovery.tsx +15 -3
- package/corpus/core/src/client/chat/widgets/DataTableWidget.tsx +10 -29
- package/corpus/core/src/client/chat/widgets/WorkspaceFileWidget.tsx +71 -0
- package/corpus/core/src/client/chat/widgets/builtin-tool-renderers.tsx +22 -0
- package/corpus/core/src/client/chat/widgets/workspace-file-result.ts +49 -0
- package/corpus/core/src/client/embed-auth.ts +2 -0
- package/corpus/core/src/client/org/InvitationBanner.tsx +14 -1
- package/corpus/core/src/client/org/OrgSwitcher.tsx +23 -0
- package/corpus/core/src/client/org/TeamPage.tsx +130 -0
- package/corpus/core/src/client/org/WorkspaceNotice.tsx +85 -0
- package/corpus/core/src/client/org/hooks.ts +14 -0
- package/corpus/core/src/client/org/index.ts +2 -0
- package/corpus/core/src/client/resources/McpIntegrationDialog.tsx +27 -40
- package/corpus/core/src/client/resources/ResourcesPanel.tsx +134 -51
- package/corpus/core/src/client/resources/mcp-integration-catalog.ts +7 -0
- package/corpus/core/src/client/resources/use-resources.ts +6 -0
- package/corpus/core/src/client/use-action.ts +3 -1
- package/corpus/core/src/client/widgets/index.ts +1 -0
- package/corpus/core/src/coding-tools/run-code.ts +2 -1
- package/corpus/core/src/db/client.ts +28 -4
- package/corpus/core/src/deploy/build.ts +31 -3
- package/corpus/core/src/eject/remote-mcp-presets.ts +1 -1
- package/corpus/core/src/index.browser.ts +1 -0
- package/corpus/core/src/index.ts +1 -0
- package/corpus/core/src/integrations/a2a-continuation-processor.ts +481 -122
- package/corpus/core/src/integrations/a2a-continuations-store.ts +345 -14
- package/corpus/core/src/integrations/adapters/slack.ts +243 -53
- package/corpus/core/src/integrations/google-docs-poller.ts +3 -0
- package/corpus/core/src/integrations/integration-campaign-recovery.ts +4 -1
- package/corpus/core/src/integrations/plugin.ts +39 -21
- package/corpus/core/src/integrations/task-queue-stats.ts +146 -0
- package/corpus/core/src/integrations/types.ts +25 -4
- package/corpus/core/src/integrations/webhook-handler.ts +46 -16
- package/corpus/core/src/jobs/scheduler.ts +4 -0
- package/corpus/core/src/localization/default-messages.ts +3 -2
- package/corpus/core/src/observability/traces.ts +48 -12
- package/corpus/core/src/org/handlers.ts +52 -1
- package/corpus/core/src/org/migrations.ts +4 -0
- package/corpus/core/src/org/plugin.ts +14 -0
- package/corpus/core/src/org/schema.ts +1 -0
- package/corpus/core/src/org/types.ts +8 -0
- package/corpus/core/src/org/workspace-url.ts +74 -0
- package/corpus/core/src/resources/handlers.ts +35 -5
- package/corpus/core/src/scripts/runner.ts +183 -5
- package/corpus/core/src/server/action-routes.ts +32 -2
- package/corpus/core/src/server/agent-chat-plugin.ts +29 -0
- package/corpus/core/src/server/agent-teams.ts +10 -1
- package/corpus/core/src/server/auth.ts +33 -7
- package/corpus/core/src/server/embed-route.ts +9 -0
- package/corpus/core/src/server/embed-session.ts +62 -3
- package/corpus/core/src/server/open-route.ts +20 -6
- package/corpus/core/src/server/prompts/framework-core-compact.ts +1 -1
- package/corpus/core/src/server/prompts/framework-core.ts +1 -0
- package/corpus/core/src/server/request-context.ts +36 -1
- package/corpus/core/src/shared/embed-auth.ts +1 -0
- package/corpus/core/src/shared/html-document.ts +115 -0
- package/corpus/core/src/shared/index.ts +1 -0
- package/corpus/core/src/sharing/access.ts +8 -1
- package/corpus/core/src/sharing/registry.ts +11 -2
- package/corpus/core/src/workspace-files/actions.ts +100 -0
- package/corpus/core/src/workspace-files/tool.ts +4 -0
- package/corpus/templates/analytics/.agents/skills/analysis-workspace/SKILL.md +4 -0
- package/corpus/templates/analytics/.agents/skills/hubspot/SKILL.md +9 -1
- package/corpus/templates/analytics/AGENTS.md +17 -24
- package/corpus/templates/analytics/actions/data-source-status.ts +11 -1
- package/corpus/templates/analytics/app/i18n-data.ts +34 -0
- package/corpus/templates/analytics/app/lib/data-source-status.ts +86 -0
- package/corpus/templates/analytics/app/lib/native-mcp-exclusions.ts +9 -0
- package/corpus/templates/analytics/app/pages/DataSources.tsx +184 -20
- package/corpus/templates/analytics/changelog/2026-07-28-native-analytics-data-sources-no-longer-show-duplicate-mc.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-exports-now-appear-in-chat-with-a-direct-download-instead-of.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-queued-chat-prompts-no-longer-resend-after-analytics-navigat.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-scheduled-dashboard-emails-load-every-panel-reliably-without.md +6 -0
- package/corpus/templates/analytics/scripts/emit-netlify-dashboard-report-cron.ts +6 -3
- package/corpus/templates/analytics/server/lib/credential-keys.ts +1 -1
- package/corpus/templates/analytics/server/lib/hubspot.ts +1 -1
- package/corpus/templates/analytics/server/lib/provider-credentials.ts +55 -1
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +123 -27
- package/corpus/templates/analytics/server/routes/[...page].get.ts +2 -7
- package/corpus/templates/analytics/vite.config.ts +7 -0
- package/corpus/templates/brain/actions/list-connection-providers.ts +100 -2
- package/corpus/templates/brain/app/lib/brain.ts +10 -0
- package/corpus/templates/brain/app/routes/sources.tsx +15 -4
- package/corpus/templates/brain/changelog/2026-07-29-brain-automatically-retries-failed-source-syncs-and-guides-y.md +6 -0
- package/corpus/templates/brain/jobs/process-ingest-queue.ts +13 -0
- package/corpus/templates/brain/server/jobs/sync-sources.ts +27 -22
- package/corpus/templates/brain/server/plugins/agent-chat.ts +2 -1
- package/corpus/templates/brain/server/routes/api/brain/queue/run.post.ts +7 -1
- package/corpus/templates/clips/AGENTS.md +1 -1
- package/corpus/templates/clips/actions/create-recording-agent-link.ts +11 -1
- package/corpus/templates/clips/actions/update-comment.ts +68 -0
- package/corpus/templates/clips/app/components/editor/editor-layout.tsx +0 -1
- package/corpus/templates/clips/app/components/player/comments-panel.tsx +221 -65
- package/corpus/templates/clips/app/components/player/video-player.tsx +101 -27
- package/corpus/templates/clips/app/i18n/en-US.ts +2 -1
- package/corpus/templates/clips/app/routes/bug-report.done.tsx +48 -27
- package/corpus/templates/clips/app/routes/bug-report.tsx +43 -4
- package/corpus/templates/clips/app/routes/record.tsx +2 -0
- package/corpus/templates/clips/changelog/2026-07-29-clip-playback-now-recovers-instead-of-getting-stuck-when-a-b.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-29-comments-can-now-be-edited-after-posting.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-29-download-actions-now-use-a-shorter-clearer-label.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-29-embedded-bug-reports-now-return-a-temporary-agent-readable.md +6 -0
- package/corpus/templates/clips/shared/bug-report.ts +99 -0
- package/corpus/templates/content/actions/_content-database-personal-view.ts +7 -1
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +5 -2
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +20 -8
- package/corpus/templates/content/changelog/2026-07-29-missing-databases-no-longer-trigger-repeated-personal-view-e.md +6 -0
- package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +83 -47
- package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +474 -55
- package/corpus/templates/design/.generated/bridge/embedded-wheel.generated.ts +3 -0
- package/corpus/templates/design/.generated/bridge/hit-test.generated.ts +18 -1
- package/corpus/templates/design/.generated/bridge/source-location.generated.ts +348 -0
- package/corpus/templates/design/actions/add-localhost-screens.ts +2 -7
- package/corpus/templates/design/actions/apply-visual-edit.ts +7 -1
- package/corpus/templates/design/actions/connect-localhost.ts +5 -9
- package/corpus/templates/design/actions/create-component.ts +16 -13
- package/corpus/templates/design/actions/grant-localhost-write-consent.ts +2 -7
- package/corpus/templates/design/actions/list-design-source-capabilities.ts +4 -7
- package/corpus/templates/design/actions/list-local-files.ts +26 -50
- package/corpus/templates/design/actions/list-localhost-connections.ts +2 -7
- package/corpus/templates/design/actions/migrate-board-objects-to-file.ts +2 -2
- package/corpus/templates/design/actions/open-visual-edit.ts +234 -135
- package/corpus/templates/design/actions/read-local-file.ts +26 -50
- package/corpus/templates/design/actions/request-localhost-write-consent.ts +2 -7
- package/corpus/templates/design/actions/write-local-file.ts +31 -73
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +307 -133
- package/corpus/templates/design/app/components/design/EditPanel.tsx +94 -22
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +137 -60
- package/corpus/templates/design/app/components/design/ResponsiveInteractBar.tsx +75 -14
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +755 -97
- package/corpus/templates/design/app/components/design/bridge/embedded-wheel.bridge.ts +8 -0
- package/corpus/templates/design/app/components/design/bridge/hit-test.bridge.ts +24 -1
- package/corpus/templates/design/app/components/design/bridge/source-location.bridge.ts +530 -0
- package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbenchLoader.tsx +278 -0
- package/corpus/templates/design/app/components/design/code-workbench/editor/MonacoHost.tsx +32 -12
- package/corpus/templates/design/app/components/design/code-workbench/editor/monaco-setup.ts +14 -3
- package/corpus/templates/design/app/components/design/code-workbench/explorer/ExplorerView.tsx +87 -24
- package/corpus/templates/design/app/components/design/code-workbench/explorer/FileTree.tsx +36 -0
- package/corpus/templates/design/app/components/design/code-workbench/store.tsx +2 -1
- package/corpus/templates/design/app/components/design/code-workbench/workspace/localhost-provider.ts +48 -8
- package/corpus/templates/design/app/components/design/design-canvas/content-size-report.ts +3 -13
- package/corpus/templates/design/app/components/design/design-canvas/embedded-frame.ts +4 -2
- package/corpus/templates/design/app/components/design/design-canvas/hit-test.ts +3 -13
- package/corpus/templates/design/app/components/design/edit-panel/element-classification.ts +3 -1
- package/corpus/templates/design/app/components/design/edit-panel/inspect-code-source.ts +93 -0
- package/corpus/templates/design/app/components/design/multi-screen/board-surface-html.ts +4 -2
- package/corpus/templates/design/app/components/design/multi-screen/cross-screen-drop.ts +35 -0
- package/corpus/templates/design/app/components/design/multi-screen/iframe-targeting.ts +24 -0
- package/corpus/templates/design/app/components/design/multi-screen/types.ts +9 -0
- package/corpus/templates/design/app/components/design/types.ts +29 -0
- package/corpus/templates/design/app/components/layout/Layout.tsx +7 -4
- package/corpus/templates/design/app/hooks/use-navigation-state.ts +3 -0
- package/corpus/templates/design/app/i18n-data.ts +153 -46
- package/corpus/templates/design/app/i18n-responsive-interact.ts +12 -12
- package/corpus/templates/design/app/lib/design-editor-route.ts +23 -0
- package/corpus/templates/design/app/pages/VisualEdit.tsx +19 -6
- package/corpus/templates/design/app/pages/design-editor/action-error.ts +19 -0
- package/corpus/templates/design/app/pages/design-editor/canvas-primitive-insert.ts +29 -0
- package/corpus/templates/design/app/pages/design-editor/clone-and-pen-edit.ts +6 -0
- package/corpus/templates/design/app/pages/design-editor/code-layer-state.ts +277 -15
- package/corpus/templates/design/app/pages/design-editor/editor-state.ts +75 -9
- package/corpus/templates/design/app/pages/design-editor/layer-state-scope.ts +28 -0
- package/corpus/templates/design/app/pages/design-editor/live-screen-layer-drop.ts +41 -0
- package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +496 -41
- package/corpus/templates/design/app/pages/design-editor/pending-live-edit-unload-guard.ts +27 -0
- package/corpus/templates/design/app/pages/design-editor/pending-structure-verification.ts +10 -0
- package/corpus/templates/design/app/pages/design-editor/react-semantic-handoff.ts +168 -9
- package/corpus/templates/design/app/pages/design-editor/responsive-interact.ts +41 -3
- package/corpus/templates/design/app/pages/design-editor/screen-command-utils.ts +5 -0
- package/corpus/templates/design/app/pages/design-editor/selection-state.ts +42 -13
- package/corpus/templates/design/app/pages/design-editor/source-location.ts +180 -0
- package/corpus/templates/design/app/pages/design-editor/tool-state.ts +17 -0
- package/corpus/templates/design/app/public-routes.ts +1 -0
- package/corpus/templates/design/app/routes/visual-edit.$id.tsx +15 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-is-easier-to-find-and-named-screens-open-dir.md +1 -1
- package/corpus/templates/design/changelog/2026-07-28-deleting-a-selected-element-now-removes-it-from-the-live-pre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-deleting-an-element-on-a-connected-localhost-screen-now-queu.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-interact-mode-now-shows-a-responsive-device-preview-with-pre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-layer-hide-and-lock-now-apply-to-the-live-preview-instead-of.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-layers-panel-selections-on-a-connected-localhost-screen-can-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-locked-layers-now-show-a-subtle-dashed-outline-in-the-live-p.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-the-apply-design-updates-button-now-counts-pending-live-text.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-the-design-canvas-no-longer-stalls-on-a-render-loop-while-a-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-visual-edit-on-a-local-dev-server-no-longer-requires-signing.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-visual-edits-on-a-react-19-app-no-longer-report-a-source-lin.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-an-edit-that-cannot-be-written-to-source-now-names-the-reaso.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-applying-a-primitive-dropped-onto-a-connected-localhost-scre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-changing-a-style-in-the-inspector-now-updates-a-connected-lo.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-choosing-edit-or-annotate-from-a-focused-screen-now-returns-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-concurrent-source-edits-now-return-a-clear-conflict-response.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-creating-a-component-from-an-element-that-repeats-in-the-sou.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-deleting-an-element-you-just-dropped-onto-a-live-screen-no-l.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-dragging-a-layer-across-screens-no-longer-dies-when-the-poin.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-dragging-an-element-from-a-stored-screen-into-a-live-localho.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-drawing-a-box-on-the-canvas-and-dragging-it-into-a-connected.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-fixed-a-loading-screen-flicker-when-reopening-designs-with-a.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-interact-mode-has-edit-and-annotate-buttons-again-so-you-can.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-layer-groups-can-be-dropped-onto-live-localhost-screens.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-localhost-source-errors-now-say-what-actually-went-wrong-whi.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-opening-or-refreshing-a-live-localhost-screen-in-single-scre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-redo-after-undoing-a-drop-onto-a-live-screen-puts-the-elemen.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-shapes-can-be-drawn-directly-onto-live-localhost-screens.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-shapes-drawn-on-the-canvas-board-now-appear-immediately-inst.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-style-edits-on-a-running-localhost-screen-now-preview-live-a.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-the-apply-design-updates-control-now-appears-as-a-clean-conn.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-visual-edits-on-a-mapped-component-instance-now-tell-the-age.md +6 -0
- package/corpus/templates/design/server/lib/design-data-access.ts +21 -7
- package/corpus/templates/design/server/lib/localhost-connection.ts +240 -0
- package/corpus/templates/design/server/routes/[...page].get.ts +2 -5
- package/corpus/templates/design/server/source-workspace.ts +2 -0
- package/corpus/templates/design/shared/code-layer.ts +43 -0
- package/corpus/templates/design/shared/html-content.ts +26 -0
- package/corpus/templates/design/shared/html-integrity.ts +21 -1
- package/corpus/templates/design/shared/local-jsx-visual-edit.ts +15 -0
- package/corpus/templates/design/shared/source-mode.ts +76 -0
- package/corpus/templates/dispatch/changelog/2026-07-26-slack-replies-recover-after-connected-app-updates.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-07-29-workspace-members-without-admin-access-now-see-a-clear-permi.md +6 -0
- package/corpus/templates/dispatch/server/lib/usage-metrics.ts +2 -1
- package/corpus/templates/plan/app/lib/plan-annotation-runtime.ts +3 -4
- package/corpus/templates/plan/server/routes/[...page].get.ts +2 -5
- package/corpus/templates/slides/.agents/skills/design-systems/SKILL.md +15 -0
- package/corpus/templates/slides/actions/delete-design-system.ts +145 -0
- package/corpus/templates/slides/actions/list-design-systems.ts +94 -2
- package/corpus/templates/slides/actions/patch-deck.ts +29 -17
- package/corpus/templates/slides/app/components/design-system/DesignSystemCard.tsx +43 -1
- package/corpus/templates/slides/app/hooks/use-design-systems.ts +2 -0
- package/corpus/templates/slides/app/i18n/en-US.ts +7 -0
- package/corpus/templates/slides/app/pages/DesignSystems.tsx +56 -1
- package/corpus/templates/slides/changelog/2026-07-28-delete-a-design-system-you-own-from-the-design-systems-page-.md +6 -0
- package/corpus/toolkit/CHANGELOG.md +6 -0
- package/corpus/toolkit/package.json +1 -1
- package/corpus/toolkit/src/composer/ComposerPlusMenu.tsx +3 -2
- package/dist/action-ui.d.ts +1 -0
- package/dist/action-ui.d.ts.map +1 -1
- package/dist/action-ui.js +1 -0
- package/dist/action-ui.js.map +1 -1
- package/dist/action.d.ts +5 -1
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.js +13 -5
- package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
- package/dist/agent/harness/runner.d.ts.map +1 -1
- package/dist/agent/harness/runner.js +5 -0
- package/dist/agent/harness/runner.js.map +1 -1
- package/dist/agent/production-agent.d.ts +16 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +18 -1
- 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 +6 -0
- package/dist/agent/run-loop-with-resume.js.map +1 -1
- package/dist/agent/run-manager.d.ts +14 -0
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +91 -1
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts +3 -0
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +35 -3
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/agent/types.d.ts +2 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/chat-threads/store.d.ts.map +1 -1
- package/dist/chat-threads/store.js +4 -6
- package/dist/chat-threads/store.js.map +1 -1
- package/dist/cli/create.d.ts +66 -6
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +765 -66
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/design-connect.d.ts.map +1 -1
- package/dist/cli/design-connect.js +2 -7
- package/dist/cli/design-connect.js.map +1 -1
- package/dist/cli/index.js +5 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/skills-content/design-visual-edit-skill.d.ts +1 -1
- package/dist/cli/skills-content/design-visual-edit-skill.d.ts.map +1 -1
- package/dist/cli/skills-content/design-visual-edit-skill.js +83 -47
- package/dist/cli/skills-content/design-visual-edit-skill.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +16 -9
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +21 -0
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/blocks/library/wireframe-kit.d.ts +2 -0
- package/dist/client/blocks/library/wireframe-kit.d.ts.map +1 -1
- package/dist/client/blocks/library/wireframe-kit.js +8 -2
- package/dist/client/blocks/library/wireframe-kit.js.map +1 -1
- package/dist/client/chat/index.d.ts +1 -1
- package/dist/client/chat/index.d.ts.map +1 -1
- package/dist/client/chat/index.js +1 -1
- package/dist/client/chat/index.js.map +1 -1
- package/dist/client/chat/message-components.d.ts +17 -0
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +24 -2
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat/run-recovery.d.ts +6 -0
- package/dist/client/chat/run-recovery.d.ts.map +1 -1
- package/dist/client/chat/run-recovery.js +13 -3
- package/dist/client/chat/run-recovery.js.map +1 -1
- package/dist/client/chat/widgets/DataTableWidget.d.ts.map +1 -1
- package/dist/client/chat/widgets/DataTableWidget.js +2 -3
- package/dist/client/chat/widgets/DataTableWidget.js.map +1 -1
- package/dist/client/chat/widgets/WorkspaceFileWidget.d.ts +5 -0
- package/dist/client/chat/widgets/WorkspaceFileWidget.d.ts.map +1 -0
- package/dist/client/chat/widgets/WorkspaceFileWidget.js +34 -0
- package/dist/client/chat/widgets/WorkspaceFileWidget.js.map +1 -0
- package/dist/client/chat/widgets/builtin-tool-renderers.d.ts.map +1 -1
- package/dist/client/chat/widgets/builtin-tool-renderers.js +13 -1
- package/dist/client/chat/widgets/builtin-tool-renderers.js.map +1 -1
- package/dist/client/chat/widgets/workspace-file-result.d.ts +12 -0
- package/dist/client/chat/widgets/workspace-file-result.d.ts.map +1 -0
- package/dist/client/chat/widgets/workspace-file-result.js +34 -0
- package/dist/client/chat/widgets/workspace-file-result.js.map +1 -0
- package/dist/client/embed-auth.d.ts.map +1 -1
- package/dist/client/embed-auth.js +2 -1
- package/dist/client/embed-auth.js.map +1 -1
- package/dist/client/org/InvitationBanner.d.ts +5 -2
- package/dist/client/org/InvitationBanner.d.ts.map +1 -1
- package/dist/client/org/InvitationBanner.js +9 -2
- package/dist/client/org/InvitationBanner.js.map +1 -1
- package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
- package/dist/client/org/OrgSwitcher.js +3 -2
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/org/TeamPage.d.ts.map +1 -1
- package/dist/client/org/TeamPage.js +27 -3
- package/dist/client/org/TeamPage.js.map +1 -1
- package/dist/client/org/WorkspaceNotice.d.ts +18 -0
- package/dist/client/org/WorkspaceNotice.d.ts.map +1 -0
- package/dist/client/org/WorkspaceNotice.js +56 -0
- package/dist/client/org/WorkspaceNotice.js.map +1 -0
- package/dist/client/org/hooks.d.ts +1 -0
- package/dist/client/org/hooks.d.ts.map +1 -1
- package/dist/client/org/hooks.js +12 -0
- package/dist/client/org/hooks.js.map +1 -1
- package/dist/client/org/index.d.ts +2 -1
- package/dist/client/org/index.d.ts.map +1 -1
- package/dist/client/org/index.js +2 -1
- package/dist/client/org/index.js.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.d.ts.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.js +8 -12
- package/dist/client/resources/McpIntegrationDialog.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.d.ts +3 -0
- package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +49 -20
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.d.ts +1 -0
- package/dist/client/resources/mcp-integration-catalog.d.ts.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.js +3 -0
- package/dist/client/resources/mcp-integration-catalog.js.map +1 -1
- package/dist/client/resources/use-resources.d.ts +1 -0
- package/dist/client/resources/use-resources.d.ts.map +1 -1
- package/dist/client/resources/use-resources.js +3 -0
- package/dist/client/resources/use-resources.js.map +1 -1
- package/dist/client/use-action.d.ts +3 -1
- package/dist/client/use-action.d.ts.map +1 -1
- package/dist/client/use-action.js +3 -1
- package/dist/client/use-action.js.map +1 -1
- package/dist/client/widgets/index.d.ts +1 -1
- package/dist/client/widgets/index.d.ts.map +1 -1
- package/dist/client/widgets/index.js +1 -1
- package/dist/client/widgets/index.js.map +1 -1
- package/dist/coding-tools/run-code.js +2 -1
- package/dist/coding-tools/run-code.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/db/client.d.ts +1 -0
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +24 -3
- package/dist/db/client.js.map +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +25 -3
- package/dist/deploy/build.js.map +1 -1
- package/dist/eject/remote-mcp-presets.js +1 -1
- package/dist/eject/remote-mcp-presets.js.map +1 -1
- package/dist/index.browser.d.ts +1 -1
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/a2a-continuation-processor.d.ts +5 -0
- package/dist/integrations/a2a-continuation-processor.d.ts.map +1 -1
- package/dist/integrations/a2a-continuation-processor.js +293 -79
- package/dist/integrations/a2a-continuation-processor.js.map +1 -1
- package/dist/integrations/a2a-continuations-store.d.ts +23 -1
- package/dist/integrations/a2a-continuations-store.d.ts.map +1 -1
- package/dist/integrations/a2a-continuations-store.js +249 -15
- package/dist/integrations/a2a-continuations-store.js.map +1 -1
- package/dist/integrations/adapters/slack.d.ts.map +1 -1
- package/dist/integrations/adapters/slack.js +155 -31
- package/dist/integrations/adapters/slack.js.map +1 -1
- package/dist/integrations/google-docs-poller.d.ts.map +1 -1
- package/dist/integrations/google-docs-poller.js +4 -1
- package/dist/integrations/google-docs-poller.js.map +1 -1
- package/dist/integrations/integration-campaign-recovery.d.ts.map +1 -1
- package/dist/integrations/integration-campaign-recovery.js +3 -1
- package/dist/integrations/integration-campaign-recovery.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +29 -12
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/task-queue-stats.d.ts +12 -0
- package/dist/integrations/task-queue-stats.d.ts.map +1 -1
- package/dist/integrations/task-queue-stats.js +106 -0
- package/dist/integrations/task-queue-stats.js.map +1 -1
- package/dist/integrations/types.d.ts +24 -6
- package/dist/integrations/types.d.ts.map +1 -1
- package/dist/integrations/types.js.map +1 -1
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +35 -14
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/jobs/scheduler.js +4 -0
- package/dist/jobs/scheduler.js.map +1 -1
- package/dist/localization/default-messages.d.ts +3 -2
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +3 -2
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/traces.d.ts.map +1 -1
- package/dist/observability/traces.js +27 -7
- package/dist/observability/traces.js.map +1 -1
- package/dist/org/handlers.d.ts +15 -0
- package/dist/org/handlers.d.ts.map +1 -1
- package/dist/org/handlers.js +45 -1
- package/dist/org/handlers.js.map +1 -1
- package/dist/org/migrations.d.ts.map +1 -1
- package/dist/org/migrations.js +4 -0
- package/dist/org/migrations.js.map +1 -1
- package/dist/org/plugin.d.ts +1 -0
- package/dist/org/plugin.d.ts.map +1 -1
- package/dist/org/plugin.js +10 -1
- package/dist/org/plugin.js.map +1 -1
- package/dist/org/schema.d.ts +19 -0
- package/dist/org/schema.d.ts.map +1 -1
- package/dist/org/schema.js +1 -0
- package/dist/org/schema.js.map +1 -1
- package/dist/org/types.d.ts +8 -0
- package/dist/org/types.d.ts.map +1 -1
- package/dist/org/types.js.map +1 -1
- package/dist/org/workspace-url.d.ts +32 -0
- package/dist/org/workspace-url.d.ts.map +1 -0
- package/dist/org/workspace-url.js +63 -0
- package/dist/org/workspace-url.js.map +1 -0
- package/dist/provider-api/actions/custom-provider-registration.d.ts +11 -11
- package/dist/provider-api/actions/provider-api.d.ts +7 -7
- package/dist/resources/handlers.d.ts +3 -4
- package/dist/resources/handlers.d.ts.map +1 -1
- package/dist/resources/handlers.js +25 -5
- package/dist/resources/handlers.js.map +1 -1
- package/dist/scripts/runner.d.ts +17 -0
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +130 -5
- package/dist/scripts/runner.js.map +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +24 -2
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +26 -1
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-teams.d.ts.map +1 -1
- package/dist/server/agent-teams.js +10 -1
- package/dist/server/agent-teams.js.map +1 -1
- package/dist/server/auth.d.ts +22 -0
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +33 -7
- package/dist/server/auth.js.map +1 -1
- package/dist/server/embed-route.d.ts.map +1 -1
- package/dist/server/embed-route.js +6 -1
- package/dist/server/embed-route.js.map +1 -1
- package/dist/server/embed-session.d.ts +7 -0
- package/dist/server/embed-session.d.ts.map +1 -1
- package/dist/server/embed-session.js +46 -4
- package/dist/server/embed-session.js.map +1 -1
- package/dist/server/open-route.d.ts.map +1 -1
- package/dist/server/open-route.js +17 -7
- package/dist/server/open-route.js.map +1 -1
- package/dist/server/prompts/framework-core-compact.js +1 -1
- package/dist/server/prompts/framework-core-compact.js.map +1 -1
- package/dist/server/prompts/framework-core.d.ts.map +1 -1
- package/dist/server/prompts/framework-core.js +1 -0
- package/dist/server/prompts/framework-core.js.map +1 -1
- package/dist/server/request-context.d.ts +26 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-context.js +18 -1
- package/dist/server/request-context.js.map +1 -1
- package/dist/shared/embed-auth.d.ts +1 -0
- package/dist/shared/embed-auth.d.ts.map +1 -1
- package/dist/shared/embed-auth.js +1 -0
- package/dist/shared/embed-auth.js.map +1 -1
- package/dist/shared/html-document.d.ts +12 -0
- package/dist/shared/html-document.d.ts.map +1 -0
- package/dist/shared/html-document.js +92 -0
- package/dist/shared/html-document.js.map +1 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +1 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/sharing/access.d.ts +1 -0
- package/dist/sharing/access.d.ts.map +1 -1
- package/dist/sharing/access.js +8 -2
- package/dist/sharing/access.js.map +1 -1
- package/dist/sharing/registry.d.ts +3 -0
- package/dist/sharing/registry.d.ts.map +1 -1
- package/dist/sharing/registry.js.map +1 -1
- package/dist/workspace-files/actions.d.ts +28 -0
- package/dist/workspace-files/actions.d.ts.map +1 -0
- package/dist/workspace-files/actions.js +75 -0
- package/dist/workspace-files/actions.js.map +1 -0
- package/dist/workspace-files/tool.d.ts.map +1 -1
- package/dist/workspace-files/tool.js +4 -0
- package/dist/workspace-files/tool.js.map +1 -1
- package/docs/content/cloneable-saas.mdx +114 -0
- package/docs/content/creating-templates.mdx +28 -2
- package/docs/content/syncing-template-changes.mdx +7 -0
- package/docs/content/template-clips-developers.mdx +12 -5
- package/docs/content/template-dispatch-developers.mdx +1 -1
- package/docs/content/template-dispatch.mdx +1 -1
- package/package.json +2 -2
- package/src/action-ui.ts +1 -0
- package/src/action.ts +5 -1
- package/src/agent/engine/ai-sdk-engine.ts +15 -5
- package/src/agent/harness/runner.ts +5 -0
- package/src/agent/production-agent.ts +33 -0
- package/src/agent/run-loop-with-resume.ts +5 -0
- package/src/agent/run-manager.ts +126 -1
- package/src/agent/thread-data-builder.ts +47 -2
- package/src/agent/types.ts +2 -0
- package/src/chat-threads/store.ts +4 -5
- package/src/cli/create.ts +1139 -65
- package/src/cli/design-connect.ts +3 -7
- package/src/cli/index.ts +5 -3
- package/src/cli/skills-content/design-visual-edit-skill.ts +83 -47
- package/src/client/AssistantChat.tsx +27 -16
- package/src/client/agent-chat-adapter.ts +24 -0
- package/src/client/blocks/library/wireframe-kit.tsx +17 -2
- package/src/client/chat/index.ts +1 -0
- package/src/client/chat/message-components.tsx +104 -1
- package/src/client/chat/run-recovery.tsx +15 -3
- package/src/client/chat/widgets/DataTableWidget.tsx +10 -29
- package/src/client/chat/widgets/WorkspaceFileWidget.tsx +71 -0
- package/src/client/chat/widgets/builtin-tool-renderers.tsx +22 -0
- package/src/client/chat/widgets/workspace-file-result.ts +49 -0
- package/src/client/embed-auth.ts +2 -0
- package/src/client/org/InvitationBanner.tsx +14 -1
- package/src/client/org/OrgSwitcher.tsx +23 -0
- package/src/client/org/TeamPage.tsx +130 -0
- package/src/client/org/WorkspaceNotice.tsx +85 -0
- package/src/client/org/hooks.ts +14 -0
- package/src/client/org/index.ts +2 -0
- package/src/client/resources/McpIntegrationDialog.tsx +27 -40
- package/src/client/resources/ResourcesPanel.tsx +134 -51
- package/src/client/resources/mcp-integration-catalog.ts +7 -0
- package/src/client/resources/use-resources.ts +6 -0
- package/src/client/use-action.ts +3 -1
- package/src/client/widgets/index.ts +1 -0
- package/src/coding-tools/run-code.ts +2 -1
- package/src/db/client.ts +28 -4
- package/src/deploy/build.ts +31 -3
- package/src/eject/remote-mcp-presets.ts +1 -1
- package/src/index.browser.ts +1 -0
- package/src/index.ts +1 -0
- package/src/integrations/a2a-continuation-processor.ts +481 -122
- package/src/integrations/a2a-continuations-store.ts +345 -14
- package/src/integrations/adapters/slack.ts +243 -53
- package/src/integrations/google-docs-poller.ts +3 -0
- package/src/integrations/integration-campaign-recovery.ts +4 -1
- package/src/integrations/plugin.ts +39 -21
- package/src/integrations/task-queue-stats.ts +146 -0
- package/src/integrations/types.ts +25 -4
- package/src/integrations/webhook-handler.ts +46 -16
- package/src/jobs/scheduler.ts +4 -0
- package/src/localization/default-messages.ts +3 -2
- package/src/observability/traces.ts +48 -12
- package/src/org/handlers.ts +52 -1
- package/src/org/migrations.ts +4 -0
- package/src/org/plugin.ts +14 -0
- package/src/org/schema.ts +1 -0
- package/src/org/types.ts +8 -0
- package/src/org/workspace-url.ts +74 -0
- package/src/resources/handlers.ts +35 -5
- package/src/scripts/runner.ts +183 -5
- package/src/server/__snapshots__/agent-chat-plugin.surface.spec.ts.snap +2 -1
- package/src/server/action-routes.ts +32 -2
- package/src/server/agent-chat-plugin.ts +29 -0
- package/src/server/agent-teams.ts +10 -1
- package/src/server/auth.ts +33 -7
- package/src/server/embed-route.ts +9 -0
- package/src/server/embed-session.ts +62 -3
- package/src/server/open-route.ts +20 -6
- package/src/server/prompts/framework-core-compact.ts +1 -1
- package/src/server/prompts/framework-core.ts +1 -0
- package/src/server/request-context.ts +36 -1
- package/src/shared/embed-auth.ts +1 -0
- package/src/shared/html-document.ts +115 -0
- package/src/shared/index.ts +1 -0
- package/src/sharing/access.ts +8 -1
- package/src/sharing/registry.ts +11 -2
- package/src/workspace-files/actions.ts +100 -0
- package/src/workspace-files/tool.ts +4 -0
- package/corpus/templates/design/changelog/2026-07-28-interact-mode-can-preview-designs-in-responsive-device-sizes.md +0 -6
- package/corpus/templates/design/changelog/2026-07-28-interact-mode-now-opens-a-full-screen-responsive-preview-wit.md +0 -6
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
|
|
1
3
|
import type { H3Event } from "h3";
|
|
2
4
|
import { createError, getHeader, readRawBody } from "h3";
|
|
3
5
|
|
|
@@ -24,6 +26,7 @@ import type {
|
|
|
24
26
|
PlatformRunProgress,
|
|
25
27
|
PlatformRunProgressRef,
|
|
26
28
|
PlatformDeliveryReceipt,
|
|
29
|
+
PlatformDeliveryOptions,
|
|
27
30
|
IntegrationContextMessage,
|
|
28
31
|
IntegrationFileReference,
|
|
29
32
|
} from "../types.js";
|
|
@@ -47,6 +50,9 @@ const SLACK_IDENTITY_NEGATIVE_CACHE_TTL_MS = 30 * 1_000;
|
|
|
47
50
|
const SLACK_IDENTITY_CACHE_MAX_ENTRIES = 1_000;
|
|
48
51
|
const SLACK_TOKEN_IDENTITY_CACHE_TTL_MS = 10 * 60 * 1_000;
|
|
49
52
|
const SLACK_TOKEN_IDENTITY_NEGATIVE_CACHE_TTL_MS = 30 * 1_000;
|
|
53
|
+
const SLACK_DELIVERY_RECONCILIATION_PAGE_LIMIT = 200;
|
|
54
|
+
const SLACK_DELIVERY_RECONCILIATION_MAX_PAGES = 3;
|
|
55
|
+
const SLACK_DELIVERY_MARKER_PREFIX = "agent_native_terminal_";
|
|
50
56
|
|
|
51
57
|
type SlackTokenIdentity = {
|
|
52
58
|
teamId: string | null;
|
|
@@ -441,7 +447,7 @@ export function slackAdapter(
|
|
|
441
447
|
async sendResponse(
|
|
442
448
|
message: OutgoingMessage,
|
|
443
449
|
context: IncomingMessage,
|
|
444
|
-
opts?:
|
|
450
|
+
opts?: PlatformDeliveryOptions,
|
|
445
451
|
): Promise<void | PlatformDeliveryReceipt> {
|
|
446
452
|
const token = await resolveBotToken(context);
|
|
447
453
|
if (!token) {
|
|
@@ -471,6 +477,22 @@ export function slackAdapter(
|
|
|
471
477
|
}
|
|
472
478
|
const restChunks = chunks.slice(1);
|
|
473
479
|
const messageRefs: string[] = [];
|
|
480
|
+
const freshChunkIndexes = [
|
|
481
|
+
...(!placeholderRef ? [0] : []),
|
|
482
|
+
...restChunks.map((_, index) => index + 1),
|
|
483
|
+
];
|
|
484
|
+
const reconciledRefs =
|
|
485
|
+
opts?.idempotencyKey && freshChunkIndexes.length > 0
|
|
486
|
+
? await reconcileSlackDeliveryChunks(
|
|
487
|
+
token,
|
|
488
|
+
channelId,
|
|
489
|
+
threadTs,
|
|
490
|
+
opts.idempotencyKey,
|
|
491
|
+
freshChunkIndexes,
|
|
492
|
+
opts.reconcileAfter,
|
|
493
|
+
opts.signal,
|
|
494
|
+
)
|
|
495
|
+
: new Map<number, string>();
|
|
474
496
|
|
|
475
497
|
const finalBlocks =
|
|
476
498
|
blocks ??
|
|
@@ -491,40 +513,57 @@ export function slackAdapter(
|
|
|
491
513
|
try {
|
|
492
514
|
if (placeholderRef) {
|
|
493
515
|
// Replace the "thinking…" placeholder in place.
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
516
|
+
const data = (await slackApiJson(
|
|
517
|
+
"https://slack.com/api/chat.update",
|
|
518
|
+
{
|
|
519
|
+
method: "POST",
|
|
520
|
+
headers: {
|
|
521
|
+
Authorization: `Bearer ${token}`,
|
|
522
|
+
"Content-Type": "application/json",
|
|
523
|
+
},
|
|
524
|
+
body: JSON.stringify({ ...baseBody, ts: placeholderRef }),
|
|
525
|
+
signal: opts?.signal,
|
|
499
526
|
},
|
|
500
|
-
|
|
501
|
-
});
|
|
502
|
-
const data = (await res.json()) as {
|
|
527
|
+
)) as {
|
|
503
528
|
ok: boolean;
|
|
504
529
|
error?: string;
|
|
505
530
|
ts?: string;
|
|
506
531
|
};
|
|
507
532
|
if (!data.ok) {
|
|
508
533
|
console.error("[slack] chat.update error:", data.error);
|
|
534
|
+
if (opts?.strictTargetRef) {
|
|
535
|
+
throw new Error(data.error || "chat.update failed");
|
|
536
|
+
}
|
|
509
537
|
// Fall back to a fresh post so the user still sees a reply
|
|
510
538
|
const postedTs = await postFresh(
|
|
511
539
|
token,
|
|
512
540
|
channelId,
|
|
513
541
|
threadTs,
|
|
514
|
-
|
|
542
|
+
opts?.idempotencyKey
|
|
543
|
+
? withSlackDeliveryMarker(baseBody, opts.idempotencyKey, 0)
|
|
544
|
+
: baseBody,
|
|
545
|
+
opts?.signal,
|
|
515
546
|
);
|
|
516
547
|
if (postedTs) messageRefs.push(postedTs);
|
|
517
548
|
} else {
|
|
518
549
|
messageRefs.push(data.ts || placeholderRef);
|
|
519
550
|
}
|
|
520
551
|
} else {
|
|
521
|
-
const
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
552
|
+
const reconciledRef = reconciledRefs.get(0);
|
|
553
|
+
if (reconciledRef) {
|
|
554
|
+
messageRefs.push(reconciledRef);
|
|
555
|
+
} else {
|
|
556
|
+
const postedTs = await postFresh(
|
|
557
|
+
token,
|
|
558
|
+
channelId,
|
|
559
|
+
threadTs,
|
|
560
|
+
opts?.idempotencyKey
|
|
561
|
+
? withSlackDeliveryMarker(baseBody, opts.idempotencyKey, 0)
|
|
562
|
+
: baseBody,
|
|
563
|
+
opts?.signal,
|
|
564
|
+
);
|
|
565
|
+
if (postedTs) messageRefs.push(postedTs);
|
|
566
|
+
}
|
|
528
567
|
}
|
|
529
568
|
|
|
530
569
|
// Clear the AI-assistant "is thinking…" status now that we've
|
|
@@ -534,14 +573,33 @@ export function slackAdapter(
|
|
|
534
573
|
}
|
|
535
574
|
|
|
536
575
|
// Overflow chunks (rare) — post as plain follow-ups in the same thread
|
|
537
|
-
for (const chunk of restChunks) {
|
|
538
|
-
const
|
|
576
|
+
for (const [index, chunk] of restChunks.entries()) {
|
|
577
|
+
const chunkIndex = index + 1;
|
|
578
|
+
const reconciledRef = reconciledRefs.get(chunkIndex);
|
|
579
|
+
if (reconciledRef) {
|
|
580
|
+
messageRefs.push(reconciledRef);
|
|
581
|
+
continue;
|
|
582
|
+
}
|
|
583
|
+
const overflowBody: Record<string, unknown> = {
|
|
539
584
|
channel: channelId,
|
|
540
585
|
text: chunk,
|
|
541
586
|
unfurl_links: false,
|
|
542
587
|
unfurl_media: false,
|
|
543
588
|
mrkdwn: true,
|
|
544
|
-
}
|
|
589
|
+
};
|
|
590
|
+
const postedTs = await postFresh(
|
|
591
|
+
token,
|
|
592
|
+
channelId,
|
|
593
|
+
threadTs,
|
|
594
|
+
opts?.idempotencyKey
|
|
595
|
+
? withSlackDeliveryMarker(
|
|
596
|
+
overflowBody,
|
|
597
|
+
opts.idempotencyKey,
|
|
598
|
+
chunkIndex,
|
|
599
|
+
)
|
|
600
|
+
: overflowBody,
|
|
601
|
+
opts?.signal,
|
|
602
|
+
);
|
|
545
603
|
if (postedTs) messageRefs.push(postedTs);
|
|
546
604
|
}
|
|
547
605
|
return {
|
|
@@ -628,7 +686,7 @@ export function slackAdapter(
|
|
|
628
686
|
if (target.threadRef) body.thread_ts = target.threadRef;
|
|
629
687
|
|
|
630
688
|
try {
|
|
631
|
-
const
|
|
689
|
+
const data = (await slackApiJson(
|
|
632
690
|
"https://slack.com/api/chat.postMessage",
|
|
633
691
|
{
|
|
634
692
|
method: "POST",
|
|
@@ -638,8 +696,7 @@ export function slackAdapter(
|
|
|
638
696
|
},
|
|
639
697
|
body: JSON.stringify(body),
|
|
640
698
|
},
|
|
641
|
-
);
|
|
642
|
-
const data = (await res.json()) as { ok: boolean; error?: string };
|
|
699
|
+
)) as { ok: boolean; error?: string };
|
|
643
700
|
if (!data.ok) {
|
|
644
701
|
throw new Error(data.error || "chat.postMessage failed");
|
|
645
702
|
}
|
|
@@ -1037,7 +1094,7 @@ function setSlackAssistantStatus(
|
|
|
1037
1094
|
threadTs: string,
|
|
1038
1095
|
status: string,
|
|
1039
1096
|
): void {
|
|
1040
|
-
|
|
1097
|
+
slackApiJson("https://slack.com/api/assistant.threads.setStatus", {
|
|
1041
1098
|
method: "POST",
|
|
1042
1099
|
headers: {
|
|
1043
1100
|
Authorization: `Bearer ${token}`,
|
|
@@ -1094,6 +1151,7 @@ async function postFresh(
|
|
|
1094
1151
|
channelId: string,
|
|
1095
1152
|
threadTs: string | undefined,
|
|
1096
1153
|
body: Record<string, unknown>,
|
|
1154
|
+
signal?: AbortSignal,
|
|
1097
1155
|
): Promise<string | undefined> {
|
|
1098
1156
|
const hasBlocks =
|
|
1099
1157
|
Array.isArray(body.blocks) && (body.blocks as unknown[]).length > 0;
|
|
@@ -1110,15 +1168,15 @@ async function postFresh(
|
|
|
1110
1168
|
channel: channelId,
|
|
1111
1169
|
};
|
|
1112
1170
|
if (threadTs && !payload.thread_ts) payload.thread_ts = threadTs;
|
|
1113
|
-
const
|
|
1171
|
+
const data = (await slackApiJson("https://slack.com/api/chat.postMessage", {
|
|
1114
1172
|
method: "POST",
|
|
1115
1173
|
headers: {
|
|
1116
1174
|
Authorization: `Bearer ${token}`,
|
|
1117
1175
|
"Content-Type": "application/json",
|
|
1118
1176
|
},
|
|
1119
1177
|
body: JSON.stringify(payload),
|
|
1120
|
-
|
|
1121
|
-
|
|
1178
|
+
signal,
|
|
1179
|
+
})) as {
|
|
1122
1180
|
ok: boolean;
|
|
1123
1181
|
error?: string;
|
|
1124
1182
|
ts?: string;
|
|
@@ -1130,23 +1188,145 @@ async function postFresh(
|
|
|
1130
1188
|
return data.ts;
|
|
1131
1189
|
}
|
|
1132
1190
|
|
|
1133
|
-
|
|
1191
|
+
function slackDeliveryMarker(key: string, chunkIndex: number): string {
|
|
1192
|
+
const digest = createHash("sha256")
|
|
1193
|
+
.update(`${key}:${chunkIndex}`)
|
|
1194
|
+
.digest("hex")
|
|
1195
|
+
.slice(0, 32);
|
|
1196
|
+
return `${SLACK_DELIVERY_MARKER_PREFIX}${digest}`;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
function withSlackDeliveryMarker(
|
|
1200
|
+
body: Record<string, unknown>,
|
|
1201
|
+
key: string,
|
|
1202
|
+
chunkIndex: number,
|
|
1203
|
+
): Record<string, unknown> {
|
|
1204
|
+
const marker = slackDeliveryMarker(key, chunkIndex);
|
|
1205
|
+
const blocks = Array.isArray(body.blocks) ? body.blocks : [];
|
|
1206
|
+
if (blocks.length > 0) {
|
|
1207
|
+
const [first, ...rest] = blocks;
|
|
1208
|
+
if (first && typeof first === "object" && !Array.isArray(first)) {
|
|
1209
|
+
return {
|
|
1210
|
+
...body,
|
|
1211
|
+
blocks: [
|
|
1212
|
+
{ ...(first as Record<string, unknown>), block_id: marker },
|
|
1213
|
+
...rest,
|
|
1214
|
+
],
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
return {
|
|
1219
|
+
...body,
|
|
1220
|
+
blocks: [
|
|
1221
|
+
{
|
|
1222
|
+
type: "section",
|
|
1223
|
+
block_id: marker,
|
|
1224
|
+
text: { type: "mrkdwn", text: String(body.text ?? "") },
|
|
1225
|
+
},
|
|
1226
|
+
],
|
|
1227
|
+
};
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
async function reconcileSlackDeliveryChunks(
|
|
1231
|
+
token: string,
|
|
1232
|
+
channelId: string,
|
|
1233
|
+
threadTs: string | undefined,
|
|
1234
|
+
key: string,
|
|
1235
|
+
chunkIndexes: number[],
|
|
1236
|
+
reconcileAfter?: number,
|
|
1237
|
+
signal?: AbortSignal,
|
|
1238
|
+
): Promise<Map<number, string>> {
|
|
1239
|
+
if (!threadTs) {
|
|
1240
|
+
throw new Error(
|
|
1241
|
+
"Cannot reconcile an idempotent Slack delivery without a thread timestamp",
|
|
1242
|
+
);
|
|
1243
|
+
}
|
|
1244
|
+
const refs = new Map<number, string>();
|
|
1245
|
+
const expectedMarkers = new Map(
|
|
1246
|
+
chunkIndexes.map((chunkIndex) => [
|
|
1247
|
+
slackDeliveryMarker(key, chunkIndex),
|
|
1248
|
+
chunkIndex,
|
|
1249
|
+
]),
|
|
1250
|
+
);
|
|
1251
|
+
let cursor = "";
|
|
1252
|
+
for (
|
|
1253
|
+
let page = 0;
|
|
1254
|
+
page < SLACK_DELIVERY_RECONCILIATION_MAX_PAGES;
|
|
1255
|
+
page += 1
|
|
1256
|
+
) {
|
|
1257
|
+
const url = new URL("https://slack.com/api/conversations.replies");
|
|
1258
|
+
url.searchParams.set("channel", channelId);
|
|
1259
|
+
url.searchParams.set("ts", threadTs);
|
|
1260
|
+
url.searchParams.set(
|
|
1261
|
+
"limit",
|
|
1262
|
+
String(SLACK_DELIVERY_RECONCILIATION_PAGE_LIMIT),
|
|
1263
|
+
);
|
|
1264
|
+
if (cursor) url.searchParams.set("cursor", cursor);
|
|
1265
|
+
if (typeof reconcileAfter === "number" && reconcileAfter > 0) {
|
|
1266
|
+
url.searchParams.set("oldest", String(Math.floor(reconcileAfter / 1000)));
|
|
1267
|
+
url.searchParams.set("inclusive", "true");
|
|
1268
|
+
}
|
|
1269
|
+
const body = (await slackApiJson(url.toString(), {
|
|
1270
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
1271
|
+
signal,
|
|
1272
|
+
})) as {
|
|
1273
|
+
ok: boolean;
|
|
1274
|
+
error?: string;
|
|
1275
|
+
messages?: Array<{
|
|
1276
|
+
ts?: string;
|
|
1277
|
+
blocks?: Array<{ block_id?: string }>;
|
|
1278
|
+
}>;
|
|
1279
|
+
response_metadata?: { next_cursor?: string };
|
|
1280
|
+
};
|
|
1281
|
+
if (!body.ok) {
|
|
1282
|
+
throw new Error(body.error || "conversations.replies failed");
|
|
1283
|
+
}
|
|
1284
|
+
for (const message of body.messages ?? []) {
|
|
1285
|
+
if (typeof message.ts !== "string") continue;
|
|
1286
|
+
for (const block of message.blocks ?? []) {
|
|
1287
|
+
if (typeof block.block_id !== "string") continue;
|
|
1288
|
+
const chunkIndex = expectedMarkers.get(block.block_id);
|
|
1289
|
+
if (chunkIndex !== undefined) refs.set(chunkIndex, message.ts);
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
if (refs.size === expectedMarkers.size) return refs;
|
|
1293
|
+
cursor = body.response_metadata?.next_cursor?.trim() ?? "";
|
|
1294
|
+
if (!cursor) return refs;
|
|
1295
|
+
}
|
|
1296
|
+
throw new Error(
|
|
1297
|
+
"Slack delivery reconciliation exceeded the bounded thread scan",
|
|
1298
|
+
);
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
async function slackApiJson(
|
|
1134
1302
|
url: string,
|
|
1135
1303
|
init: RequestInit,
|
|
1136
1304
|
timeoutMs = SLACK_API_TIMEOUT_MS,
|
|
1137
|
-
): Promise<
|
|
1305
|
+
): Promise<Record<string, any>> {
|
|
1138
1306
|
const controller =
|
|
1139
1307
|
typeof AbortController !== "undefined" ? new AbortController() : undefined;
|
|
1308
|
+
const externalSignal = init.signal;
|
|
1309
|
+
const abortFromExternal = () => controller?.abort(externalSignal?.reason);
|
|
1310
|
+
if (controller && externalSignal) {
|
|
1311
|
+
if (externalSignal.aborted) abortFromExternal();
|
|
1312
|
+
else {
|
|
1313
|
+
externalSignal.addEventListener("abort", abortFromExternal, {
|
|
1314
|
+
once: true,
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1140
1318
|
const timer = controller
|
|
1141
1319
|
? setTimeout(() => controller.abort(), timeoutMs)
|
|
1142
1320
|
: undefined;
|
|
1143
1321
|
try {
|
|
1144
|
-
|
|
1322
|
+
const response = await fetch(url, {
|
|
1145
1323
|
...init,
|
|
1146
1324
|
signal: controller?.signal ?? init.signal,
|
|
1147
1325
|
});
|
|
1326
|
+
return (await response.json()) as Record<string, any>;
|
|
1148
1327
|
} finally {
|
|
1149
1328
|
if (timer) clearTimeout(timer);
|
|
1329
|
+
externalSignal?.removeEventListener("abort", abortFromExternal);
|
|
1150
1330
|
}
|
|
1151
1331
|
}
|
|
1152
1332
|
|
|
@@ -1165,12 +1345,11 @@ async function resolveSlackThreadPermalink(
|
|
|
1165
1345
|
const url = new URL("https://slack.com/api/chat.getPermalink");
|
|
1166
1346
|
url.searchParams.set("channel", channelId);
|
|
1167
1347
|
url.searchParams.set("message_ts", threadTs);
|
|
1168
|
-
const
|
|
1348
|
+
const data = (await slackApiJson(
|
|
1169
1349
|
url.toString(),
|
|
1170
1350
|
{ headers: { Authorization: `Bearer ${token}` } },
|
|
1171
1351
|
SLACK_PERMALINK_TIMEOUT_MS,
|
|
1172
|
-
)
|
|
1173
|
-
const data = (await res.json()) as {
|
|
1352
|
+
)) as {
|
|
1174
1353
|
ok?: boolean;
|
|
1175
1354
|
permalink?: unknown;
|
|
1176
1355
|
};
|
|
@@ -1260,12 +1439,11 @@ async function slackJson(
|
|
|
1260
1439
|
for (const [key, value] of Object.entries(params)) {
|
|
1261
1440
|
url.searchParams.set(key, value);
|
|
1262
1441
|
}
|
|
1263
|
-
const
|
|
1442
|
+
const body = await slackApiJson(
|
|
1264
1443
|
url.toString(),
|
|
1265
1444
|
{ headers: { Authorization: `Bearer ${token}` } },
|
|
1266
1445
|
timeoutMs,
|
|
1267
1446
|
);
|
|
1268
|
-
const body = (await response.json()) as Record<string, any>;
|
|
1269
1447
|
return body.ok ? body : null;
|
|
1270
1448
|
} catch {
|
|
1271
1449
|
return null;
|
|
@@ -1618,16 +1796,17 @@ async function postSlackJson(
|
|
|
1618
1796
|
token: string,
|
|
1619
1797
|
method: string,
|
|
1620
1798
|
body: Record<string, unknown>,
|
|
1799
|
+
signal?: AbortSignal,
|
|
1621
1800
|
): Promise<Record<string, any>> {
|
|
1622
|
-
const
|
|
1801
|
+
const data = await slackApiJson(`https://slack.com/api/${method}`, {
|
|
1623
1802
|
method: "POST",
|
|
1624
1803
|
headers: {
|
|
1625
1804
|
Authorization: `Bearer ${token}`,
|
|
1626
1805
|
"Content-Type": "application/json",
|
|
1627
1806
|
},
|
|
1628
1807
|
body: JSON.stringify(body),
|
|
1808
|
+
signal,
|
|
1629
1809
|
});
|
|
1630
|
-
const data = (await response.json()) as Record<string, any>;
|
|
1631
1810
|
if (!data.ok) throw new Error(data.error || `${method} failed`);
|
|
1632
1811
|
return data;
|
|
1633
1812
|
}
|
|
@@ -1775,6 +1954,7 @@ function createSlackRunProgress(
|
|
|
1775
1954
|
|
|
1776
1955
|
return {
|
|
1777
1956
|
ref: { kind: "slack-stream", streamTs },
|
|
1957
|
+
responseTargetRef: streamTs,
|
|
1778
1958
|
async onEvent(event) {
|
|
1779
1959
|
if (!cancelControl) {
|
|
1780
1960
|
const context = getIntegrationRequestContext();
|
|
@@ -1933,7 +2113,7 @@ function createSlackRunProgress(
|
|
|
1933
2113
|
});
|
|
1934
2114
|
}
|
|
1935
2115
|
},
|
|
1936
|
-
async complete(message) {
|
|
2116
|
+
async complete(message, opts) {
|
|
1937
2117
|
if (pendingTimer) clearTimeout(pendingTimer);
|
|
1938
2118
|
const finalChunks = [...tasks.entries()].map(([id, task]) => ({
|
|
1939
2119
|
type: "task_update",
|
|
@@ -1968,25 +2148,35 @@ function createSlackRunProgress(
|
|
|
1968
2148
|
},
|
|
1969
2149
|
]
|
|
1970
2150
|
: [];
|
|
1971
|
-
await postSlackJson(
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
: {}),
|
|
1979
|
-
|
|
2151
|
+
await postSlackJson(
|
|
2152
|
+
token,
|
|
2153
|
+
"chat.stopStream",
|
|
2154
|
+
{
|
|
2155
|
+
channel,
|
|
2156
|
+
ts: streamTs,
|
|
2157
|
+
markdown_text: message.text || "Done.",
|
|
2158
|
+
...(finalChunks.length ? { chunks: finalChunks } : {}),
|
|
2159
|
+
...(messageBlocks.length || controlBlocks.length
|
|
2160
|
+
? { blocks: [...messageBlocks, ...controlBlocks].slice(0, 50) }
|
|
2161
|
+
: {}),
|
|
2162
|
+
},
|
|
2163
|
+
opts?.signal,
|
|
2164
|
+
);
|
|
1980
2165
|
setSlackAssistantStatus(token, channel, threadTs, "");
|
|
1981
2166
|
return { status: "delivered", messageRefs: [streamTs] };
|
|
1982
2167
|
},
|
|
1983
|
-
async fail(message) {
|
|
2168
|
+
async fail(message, opts) {
|
|
1984
2169
|
if (pendingTimer) clearTimeout(pendingTimer);
|
|
1985
|
-
await postSlackJson(
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
2170
|
+
await postSlackJson(
|
|
2171
|
+
token,
|
|
2172
|
+
"chat.stopStream",
|
|
2173
|
+
{
|
|
2174
|
+
channel,
|
|
2175
|
+
ts: streamTs,
|
|
2176
|
+
markdown_text: message.slice(0, SLACK_MAX_LENGTH),
|
|
2177
|
+
},
|
|
2178
|
+
opts?.signal,
|
|
2179
|
+
).catch(() => {});
|
|
1990
2180
|
setSlackAssistantStatus(token, channel, threadTs, "");
|
|
1991
2181
|
},
|
|
1992
2182
|
};
|
|
@@ -535,6 +535,9 @@ async function processComment(
|
|
|
535
535
|
console.error("[google-docs] Error sending response:", err);
|
|
536
536
|
}
|
|
537
537
|
},
|
|
538
|
+
// No userId here: `options.ownerEmail` is PII (email), which the
|
|
539
|
+
// terminal event must not carry.
|
|
540
|
+
{ model: options.model, engineName: engine.name },
|
|
538
541
|
);
|
|
539
542
|
}
|
|
540
543
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getA2AContinuationTaskOutcome } from "./a2a-continuations-store.js";
|
|
1
2
|
import {
|
|
2
3
|
getIntegrationCampaign,
|
|
3
4
|
failDisabledIntegrationCampaignTask,
|
|
@@ -72,7 +73,9 @@ export async function recoverDueIntegrationCampaigns(options: {
|
|
|
72
73
|
: undefined,
|
|
73
74
|
},
|
|
74
75
|
);
|
|
75
|
-
const confirmedReceipt =
|
|
76
|
+
const confirmedReceipt =
|
|
77
|
+
hasConfirmedDeliveryReceipt(task.payload) ||
|
|
78
|
+
(await getA2AContinuationTaskOutcome(task.id)) === "terminal-delivered";
|
|
76
79
|
if (!durableDispatchEnabled && !confirmedReceipt) {
|
|
77
80
|
await failDisabledIntegrationCampaignTask(task.id);
|
|
78
81
|
const nextTask = await getNextPendingTaskForThread(
|
|
@@ -36,12 +36,11 @@ import { runWithRequestContext } from "../server/request-context.js";
|
|
|
36
36
|
import {
|
|
37
37
|
processA2AContinuationById,
|
|
38
38
|
processDueA2AContinuations,
|
|
39
|
+
reconcileTerminalA2AParentIfDisabled,
|
|
40
|
+
recoverA2AContinuationAfterProcessorFailure,
|
|
39
41
|
recoverDueA2AContinuations,
|
|
40
42
|
} from "./a2a-continuation-processor.js";
|
|
41
|
-
import {
|
|
42
|
-
failA2AContinuation,
|
|
43
|
-
hasActiveA2AContinuationsForIntegrationTask,
|
|
44
|
-
} from "./a2a-continuations-store.js";
|
|
43
|
+
import { getA2AContinuationTaskOutcome } from "./a2a-continuations-store.js";
|
|
45
44
|
import { mergeIntegrationAdapters } from "./adapter-overrides.js";
|
|
46
45
|
import { discordAdapter } from "./adapters/discord.js";
|
|
47
46
|
import { emailAdapter } from "./adapters/email.js";
|
|
@@ -1908,13 +1907,18 @@ export function createIntegrationsPlugin(
|
|
|
1908
1907
|
? { channelId: task.dispatchScope }
|
|
1909
1908
|
: undefined,
|
|
1910
1909
|
});
|
|
1910
|
+
const a2aOutcome = campaignContinuation
|
|
1911
|
+
? await getA2AContinuationTaskOutcome(task.id)
|
|
1912
|
+
: null;
|
|
1911
1913
|
const confirmedDeliveryReceipt =
|
|
1912
1914
|
taskPayload.kind === "response-delivery" &&
|
|
1913
1915
|
taskPayload.deliveryReceipt?.status === "delivered";
|
|
1916
|
+
const confirmedDeliveryProof =
|
|
1917
|
+
confirmedDeliveryReceipt || a2aOutcome === "terminal-delivered";
|
|
1914
1918
|
if (
|
|
1915
1919
|
campaignContinuation &&
|
|
1916
1920
|
!durableCampaignEnabled &&
|
|
1917
|
-
!
|
|
1921
|
+
!confirmedDeliveryProof
|
|
1918
1922
|
) {
|
|
1919
1923
|
await failDisabledIntegrationCampaignTask(task.id);
|
|
1920
1924
|
const nextTask = await getNextPendingTaskForThread(
|
|
@@ -1995,6 +1999,17 @@ export function createIntegrationsPlugin(
|
|
|
1995
1999
|
return;
|
|
1996
2000
|
}
|
|
1997
2001
|
if (taskPayload.kind === "response-delivery") {
|
|
2002
|
+
if (
|
|
2003
|
+
campaignContinuation &&
|
|
2004
|
+
taskPayload.awaitingA2ACompletion &&
|
|
2005
|
+
a2aOutcome === "terminal-delivered"
|
|
2006
|
+
) {
|
|
2007
|
+
const completed =
|
|
2008
|
+
await completeIntegrationCampaignTaskAfterA2A(task.id);
|
|
2009
|
+
return completed
|
|
2010
|
+
? ("completed" as const)
|
|
2011
|
+
: ("campaign-active" as const);
|
|
2012
|
+
}
|
|
1998
2013
|
let receipt: void | PlatformDeliveryReceipt =
|
|
1999
2014
|
taskPayload.deliveryReceipt;
|
|
2000
2015
|
let deliveryLease:
|
|
@@ -2114,15 +2129,15 @@ export function createIntegrationsPlugin(
|
|
|
2114
2129
|
if (!waiting) return "campaign-active" as const;
|
|
2115
2130
|
}
|
|
2116
2131
|
if (
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
))
|
|
2132
|
+
a2aOutcome === "terminal-without-delivery" &&
|
|
2133
|
+
(await reconcileTerminalA2AParentIfDisabled(task.id))
|
|
2120
2134
|
) {
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2135
|
+
return "campaign-failed" as const;
|
|
2136
|
+
}
|
|
2137
|
+
if (a2aOutcome !== "active") {
|
|
2138
|
+
console.warn(
|
|
2139
|
+
`[integrations] Waiting campaign ${task.id} has A2A outcome ${a2aOutcome} without terminal delivery proof`,
|
|
2140
|
+
);
|
|
2126
2141
|
}
|
|
2127
2142
|
return "campaign-active" as const;
|
|
2128
2143
|
}
|
|
@@ -2387,15 +2402,18 @@ export function createIntegrationsPlugin(
|
|
|
2387
2402
|
adapters: adapterMap,
|
|
2388
2403
|
});
|
|
2389
2404
|
} catch (err: any) {
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
await
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
).catch(() => {
|
|
2405
|
+
const reason =
|
|
2406
|
+
err?.message?.slice(0, 500) || "continuation processing failed";
|
|
2407
|
+
await recoverA2AContinuationAfterProcessorFailure(continuationId, {
|
|
2408
|
+
adapters: adapterMap,
|
|
2409
|
+
reason,
|
|
2410
|
+
}).catch(() => {
|
|
2411
|
+
console.error(
|
|
2412
|
+
`[integrations] A2A continuation ${continuationId} recovery scheduling failed`,
|
|
2413
|
+
);
|
|
2414
|
+
});
|
|
2396
2415
|
console.error(
|
|
2397
|
-
|
|
2398
|
-
err,
|
|
2416
|
+
`[integrations] process-a2a-continuation failure for ${continuationId}; durable recovery requested`,
|
|
2399
2417
|
);
|
|
2400
2418
|
setResponseStatus(event, 500);
|
|
2401
2419
|
return { error: "Failed to process A2A continuation" };
|