@agent-native/core 0.92.12 → 0.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +39 -0
- package/corpus/core/docs/content/automation-connectors.mdx +80 -0
- package/corpus/core/docs/content/extensions.mdx +8 -0
- package/corpus/core/docs/content/locales/ar-SA/extensions.mdx +8 -0
- package/corpus/core/docs/content/locales/ar-SA/messaging.mdx +84 -15
- package/corpus/core/docs/content/locales/ar-SA/template-clips.mdx +1 -0
- package/corpus/core/docs/content/locales/ar-SA/template-design.mdx +1 -0
- package/corpus/core/docs/content/locales/de-DE/extensions.mdx +10 -0
- package/corpus/core/docs/content/locales/de-DE/messaging.mdx +92 -15
- package/corpus/core/docs/content/locales/de-DE/template-clips.mdx +1 -0
- package/corpus/core/docs/content/locales/de-DE/template-design.mdx +1 -0
- package/corpus/core/docs/content/locales/es-ES/extensions.mdx +10 -0
- package/corpus/core/docs/content/locales/es-ES/messaging.mdx +91 -15
- package/corpus/core/docs/content/locales/es-ES/template-clips.mdx +1 -0
- package/corpus/core/docs/content/locales/es-ES/template-design.mdx +1 -0
- package/corpus/core/docs/content/locales/fr-FR/extensions.mdx +10 -0
- package/corpus/core/docs/content/locales/fr-FR/messaging.mdx +91 -15
- package/corpus/core/docs/content/locales/fr-FR/template-clips.mdx +1 -0
- package/corpus/core/docs/content/locales/fr-FR/template-design.mdx +1 -0
- package/corpus/core/docs/content/locales/hi-IN/extensions.mdx +8 -0
- package/corpus/core/docs/content/locales/hi-IN/messaging.mdx +81 -15
- package/corpus/core/docs/content/locales/hi-IN/template-clips.mdx +1 -0
- package/corpus/core/docs/content/locales/hi-IN/template-design.mdx +1 -0
- package/corpus/core/docs/content/locales/ja-JP/extensions.mdx +9 -0
- package/corpus/core/docs/content/locales/ja-JP/messaging.mdx +81 -15
- package/corpus/core/docs/content/locales/ja-JP/template-clips.mdx +1 -0
- package/corpus/core/docs/content/locales/ja-JP/template-design.mdx +1 -0
- package/corpus/core/docs/content/locales/ko-KR/extensions.mdx +8 -0
- package/corpus/core/docs/content/locales/ko-KR/messaging.mdx +80 -15
- package/corpus/core/docs/content/locales/ko-KR/template-clips.mdx +1 -0
- package/corpus/core/docs/content/locales/ko-KR/template-design.mdx +1 -0
- package/corpus/core/docs/content/locales/pt-BR/extensions.mdx +9 -0
- package/corpus/core/docs/content/locales/pt-BR/messaging.mdx +88 -15
- package/corpus/core/docs/content/locales/pt-BR/template-clips.mdx +1 -0
- package/corpus/core/docs/content/locales/pt-BR/template-design.mdx +1 -0
- package/corpus/core/docs/content/locales/zh-CN/extensions.mdx +6 -0
- package/corpus/core/docs/content/locales/zh-CN/messaging.mdx +78 -15
- package/corpus/core/docs/content/locales/zh-CN/template-clips.mdx +1 -0
- package/corpus/core/docs/content/locales/zh-CN/template-design.mdx +1 -0
- package/corpus/core/docs/content/locales/zh-TW/extensions.mdx +6 -0
- package/corpus/core/docs/content/locales/zh-TW/messaging.mdx +78 -15
- package/corpus/core/docs/content/locales/zh-TW/template-clips.mdx +1 -0
- package/corpus/core/docs/content/locales/zh-TW/template-design.mdx +1 -0
- package/corpus/core/docs/content/messaging.mdx +227 -45
- package/corpus/core/docs/content/template-clips.mdx +3 -0
- package/corpus/core/docs/content/template-design.mdx +4 -0
- package/corpus/core/package.json +5 -1
- package/corpus/core/src/a2a/artifact-response.ts +131 -2
- package/corpus/core/src/a2a/client.ts +10 -0
- package/corpus/core/src/a2a/handlers.ts +40 -76
- package/corpus/core/src/a2a/types.ts +2 -0
- package/corpus/core/src/agent/durable-background.ts +24 -0
- package/corpus/core/src/agent/production-agent.ts +15 -3
- package/corpus/core/src/agent/run-manager.ts +130 -10
- package/corpus/core/src/agent/run-store.ts +225 -15
- package/corpus/core/src/agent/types.ts +23 -0
- package/corpus/core/src/audit/record.ts +31 -0
- package/corpus/core/src/audit/store.ts +69 -3
- package/corpus/core/src/audit/types.ts +13 -0
- package/corpus/core/src/automation/index.ts +802 -0
- package/corpus/core/src/cli/create.ts +12 -5
- package/corpus/core/src/cli/design-connect.ts +596 -36
- package/corpus/core/src/client/AgentPanel.tsx +51 -6
- package/corpus/core/src/client/AssistantChat.tsx +274 -147
- package/corpus/core/src/client/MultiTabAssistantChat.tsx +3 -0
- package/corpus/core/src/client/RunStuckBanner.tsx +69 -20
- package/corpus/core/src/client/agent-chat-adapter.ts +54 -5
- package/corpus/core/src/client/automation.ts +22 -0
- package/corpus/core/src/client/chat/run-recovery.tsx +67 -50
- package/corpus/core/src/client/composer/TiptapComposer.tsx +8 -0
- package/corpus/core/src/client/index.ts +30 -0
- package/corpus/core/src/client/integrations/api.ts +295 -0
- package/corpus/core/src/client/integrations/index.ts +26 -0
- package/corpus/core/src/client/transcription/use-live-transcription.ts +68 -5
- package/corpus/core/src/client/use-run-stuck-detection.ts +41 -3
- package/corpus/core/src/deploy/build.ts +59 -3
- package/corpus/core/src/deploy/workspace-deploy.ts +37 -2
- package/corpus/core/src/file-upload/types.ts +2 -0
- package/corpus/core/src/index.ts +37 -0
- package/corpus/core/src/integrations/a2a-continuations-store.ts +6 -4
- package/corpus/core/src/integrations/adapters/discord.ts +362 -0
- package/corpus/core/src/integrations/adapters/index.ts +29 -0
- package/corpus/core/src/integrations/adapters/microsoft-teams.ts +411 -0
- package/corpus/core/src/integrations/adapters/slack.ts +861 -27
- package/corpus/core/src/integrations/adapters/telegram.ts +54 -15
- package/corpus/core/src/integrations/adapters/whatsapp.ts +41 -17
- package/corpus/core/src/integrations/catalog.ts +571 -0
- package/corpus/core/src/integrations/controls-store.ts +187 -0
- package/corpus/core/src/integrations/index.ts +100 -0
- package/corpus/core/src/integrations/installations-store.ts +677 -0
- package/corpus/core/src/integrations/integration-memory.ts +187 -0
- package/corpus/core/src/integrations/pending-tasks-retry-job.ts +6 -6
- package/corpus/core/src/integrations/pending-tasks-store.ts +83 -5
- package/corpus/core/src/integrations/plugin.ts +685 -47
- package/corpus/core/src/integrations/scope-store.ts +498 -0
- package/corpus/core/src/integrations/slack-manifest.ts +78 -0
- package/corpus/core/src/integrations/slack-oauth.ts +343 -0
- package/corpus/core/src/integrations/types.ts +179 -0
- package/corpus/core/src/integrations/usage-budget-store.ts +906 -0
- package/corpus/core/src/integrations/webhook-handler.ts +562 -51
- package/corpus/core/src/jobs/scheduler.ts +100 -2
- package/corpus/core/src/jobs/tools.ts +45 -9
- package/corpus/core/src/provider-api/index.ts +72 -1
- package/corpus/core/src/resources/handlers.ts +88 -14
- package/corpus/core/src/resources/script-helpers.ts +36 -7
- package/corpus/core/src/resources/store.ts +59 -52
- package/corpus/core/src/scripts/call-agent.ts +107 -1
- package/corpus/core/src/server/agent-chat-plugin.ts +294 -119
- package/corpus/core/src/server/auth.ts +10 -14
- package/corpus/core/src/server/builder-design-systems.ts +16 -1
- package/corpus/core/src/server/edge.ts +18 -0
- package/corpus/core/src/server/index.ts +26 -0
- package/corpus/core/src/server/request-context.ts +18 -0
- package/corpus/core/src/server/social-og-image.ts +3 -2
- package/corpus/core/src/styles/agent-native.css +62 -44
- package/corpus/core/src/templates/default/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/core/src/templates/default/AGENTS.md +7 -3
- package/corpus/core/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +1 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/core/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +6 -3
- package/corpus/core/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +25 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +15 -0
- package/corpus/core/src/templates/workspace-core/AGENTS.md +3 -2
- package/corpus/core/src/usage/store.ts +37 -2
- package/corpus/templates/analytics/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/analytics/.agents/skills/provider-api/SKILL.md +23 -0
- package/corpus/templates/analytics/.builder/skills/provider-api/SKILL.md +15 -0
- package/corpus/templates/analytics/actions/save-monitor.ts +25 -2
- package/corpus/templates/analytics/app/lib/data-sources.ts +28 -0
- package/corpus/templates/analytics/changelog/2026-07-10-agent-created-uptime-monitors-now-return-a-direct-link-to-th.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-10-dashboard-email-reports-still-arrive-when-screenshot-capture-temporarily-fails.md +6 -0
- package/corpus/templates/analytics/server/jobs/dashboard-report.ts +3 -7
- package/corpus/templates/analytics/server/lib/credential-keys.ts +12 -0
- package/corpus/templates/analytics/server/lib/dashboard-report.ts +5 -1
- package/corpus/templates/analytics/server/lib/provider-credentials.ts +2 -0
- package/corpus/templates/analytics/server/routes/api/test-connection.post.ts +16 -0
- package/corpus/templates/assets/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/brain/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/calendar/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/calendar/app/components/calendar/CommandPalette.tsx +98 -108
- package/corpus/templates/calendar/app/components/calendar/EventAttendeesSection.tsx +97 -90
- package/corpus/templates/calendar/changelog/2026-07-10-event-guest-details-and-option-menus-now-use-valid-accessibl.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-10-natural-language-event-phrases-stay-available-as-quick-creat.md +6 -0
- package/corpus/templates/chat/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/chat/changelog/2026-07-10-chat-now-makes-ai-connection-setup-clear-without-shifting-th.md +6 -0
- package/corpus/templates/clips/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/clips/.agents/skills/recording/SKILL.md +17 -1
- package/corpus/templates/clips/.agents/skills/video-sharing/SKILL.md +8 -0
- package/corpus/templates/clips/AGENTS.md +8 -3
- package/corpus/templates/clips/actions/finalize-recording.ts +63 -23
- package/corpus/templates/clips/actions/get-recording-player-data.ts +6 -2
- package/corpus/templates/clips/actions/lib/ensure-seekable-video.ts +72 -9
- package/corpus/templates/clips/actions/list-recordings.ts +19 -3
- package/corpus/templates/clips/actions/navigate.ts +2 -0
- package/corpus/templates/clips/actions/reprocess-recording.ts +20 -6
- package/corpus/templates/clips/actions/request-transcript.ts +16 -31
- package/corpus/templates/clips/actions/view-screen.ts +57 -5
- package/corpus/templates/clips/app/components/layout/Header.tsx +1 -0
- package/corpus/templates/clips/app/components/library/empty-state.tsx +2 -0
- package/corpus/templates/clips/app/components/library/library-grid.tsx +69 -42
- package/corpus/templates/clips/app/components/library/library-layout.tsx +15 -1
- package/corpus/templates/clips/app/components/library/recording-card.tsx +81 -68
- package/corpus/templates/clips/app/components/library/search-bar.tsx +4 -3
- package/corpus/templates/clips/app/components/player/delete-recording-menu.tsx +9 -3
- package/corpus/templates/clips/app/components/player/share-dialog.tsx +1 -1
- package/corpus/templates/clips/app/hooks/use-library.ts +1 -1
- package/corpus/templates/clips/app/hooks/use-navigation-state.ts +10 -2
- package/corpus/templates/clips/app/i18n/ar-SA.ts +7 -1
- package/corpus/templates/clips/app/i18n/de-DE.ts +7 -1
- package/corpus/templates/clips/app/i18n/en-US.ts +7 -1
- package/corpus/templates/clips/app/i18n/es-ES.ts +7 -1
- package/corpus/templates/clips/app/i18n/fr-FR.ts +7 -1
- package/corpus/templates/clips/app/i18n/hi-IN.ts +7 -1
- package/corpus/templates/clips/app/i18n/ja-JP.ts +7 -1
- package/corpus/templates/clips/app/i18n/ko-KR.ts +7 -1
- package/corpus/templates/clips/app/i18n/pt-BR.ts +7 -1
- package/corpus/templates/clips/app/i18n/zh-CN.ts +8 -1
- package/corpus/templates/clips/app/i18n/zh-TW.ts +8 -1
- package/corpus/templates/clips/app/lib/recording-visibility.ts +70 -0
- package/corpus/templates/clips/app/routes/_app.shared.tsx +20 -0
- package/corpus/templates/clips/app/routes/download.tsx +24 -8
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +115 -2
- package/corpus/templates/clips/app/routes/record.tsx +62 -0
- package/corpus/templates/clips/app/routes/share.$shareId.tsx +25 -16
- package/corpus/templates/clips/changelog/2026-07-10-clips-desktop-is-now-available-for-linux-with-appimage-debia.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-clips-downloads-updates-sooner-in-the-background-and-offers-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-clips-shared-with-you-now-appear-in-a-searchable-shared-with.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-clips-with-missing-mobile-video-frames-can-be-repaired-witho.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-mobile-camera-recordings-pause-while-backgrounded.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-mp4-downloads-now-show-progress-immediately-after-the-option.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-recording-pages-now-open-as-soon-as-you-stop-with-a-share-li.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-recordings-now-seek-smoothly-downloads-use-the-correct-file-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-s3-compatible-storage-now-saves-hosted-recordings-without-re.md +6 -0
- package/corpus/templates/clips/desktop/README.md +22 -6
- package/corpus/templates/clips/desktop/package.json +1 -1
- package/corpus/templates/clips/desktop/src/app.tsx +32 -19
- package/corpus/templates/clips/desktop/src/components/ReadinessPanel.tsx +15 -9
- package/corpus/templates/clips/desktop/src/lib/finalization-guard.ts +22 -0
- package/corpus/templates/clips/desktop/src/lib/permissions.ts +3 -1
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +97 -120
- package/corpus/templates/clips/desktop/src/lib/updater.ts +26 -4
- package/corpus/templates/clips/desktop/src/overlays/finalizing.tsx +4 -8
- package/corpus/templates/clips/desktop/src-tauri/Cargo.toml +1 -1
- package/corpus/templates/clips/desktop/src-tauri/src/clips/mod.rs +2 -2
- package/corpus/templates/clips/desktop/src-tauri/src/permission_status.rs +11 -7
- package/corpus/templates/clips/desktop/src-tauri/tauri.linux.conf.json +11 -0
- package/corpus/templates/clips/netlify.toml +3 -0
- package/corpus/templates/clips/server/lib/post-finalize-dispatch.ts +106 -0
- package/corpus/templates/clips/server/lib/public-agent-context.ts +9 -1
- package/corpus/templates/clips/server/lib/resumable-upload-provider.ts +52 -0
- package/corpus/templates/clips/server/lib/s3-upload-provider.ts +433 -85
- package/corpus/templates/clips/server/lib/video-remux.ts +114 -0
- package/corpus/templates/clips/server/routes/api/_agent-native-background/post-finalize-worker.post.ts +109 -0
- package/corpus/templates/clips/server/routes/api/clips-updater.json.get.ts +22 -11
- package/corpus/templates/clips/server/routes/api/public-recording.get.ts +4 -2
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/abort.post.ts +47 -5
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +10 -2
- package/corpus/templates/clips/shared/share-loader-response.ts +12 -0
- package/corpus/templates/clips/shared/transcript-status.ts +40 -0
- package/corpus/templates/content/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/content/.agents/skills/content/SKILL.md +57 -5
- package/corpus/templates/content/AGENTS.md +65 -55
- package/corpus/templates/content/actions/_builder-cms-read-client.ts +10 -16
- package/corpus/templates/content/actions/_database-source-utils.ts +58 -11
- package/corpus/templates/content/actions/_property-utils.ts +30 -2
- package/corpus/templates/content/actions/add-content-database-source-field-property.ts +312 -114
- package/corpus/templates/content/actions/submit-content-database-form.ts +497 -0
- package/corpus/templates/content/actions/update-content-database-view.ts +8 -1
- package/corpus/templates/content/actions/view-screen.ts +4 -1
- package/corpus/templates/content/agent-native.app-skill.json +1 -1
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +250 -64
- package/corpus/templates/content/app/components/editor/database/FormView.tsx +460 -0
- package/corpus/templates/content/app/components/editor/database/navigation-state.ts +3 -0
- package/corpus/templates/content/app/components/editor/database/settings.tsx +30 -37
- package/corpus/templates/content/app/components/editor/database/shared.tsx +2 -0
- package/corpus/templates/content/app/components/editor/database/view-config.ts +29 -1
- package/corpus/templates/content/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/content/app/hooks/use-content-database.ts +22 -0
- package/corpus/templates/content/app/i18n/zh-TW.ts +21 -0
- package/corpus/templates/content/app/i18n-data.ts +225 -0
- package/corpus/templates/content/changelog/2026-07-10-builder-backed-properties-now-load-current-source-values-as-.md +6 -0
- package/corpus/templates/content/changelog/2026-07-10-builder-database-refreshes-now-stay-explicit-and-accurate.md +6 -0
- package/corpus/templates/content/changelog/2026-07-10-database-form-views-now-collect-ordered-required-answers-and.md +6 -0
- package/corpus/templates/content/changelog/2026-07-10-database-tables-now-use-a-quieter-more-compact-layout-with-c.md +6 -0
- package/corpus/templates/content/changelog/2026-07-10-slack-intake-routes-to-content-database-forms.md +6 -0
- package/corpus/templates/content/parity/matrix.md +1 -0
- package/corpus/templates/content/parity/matrix.ts +18 -0
- package/corpus/templates/content/shared/api.ts +27 -1
- package/corpus/templates/content/shared/database-form.ts +53 -0
- package/corpus/templates/design/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +26 -0
- package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +85 -12
- package/corpus/templates/design/AGENTS.md +72 -18
- package/corpus/templates/design/DESIGN.md +1 -1
- package/corpus/templates/design/DEVELOPING.md +1 -1
- package/corpus/templates/design/FIGMA_INTEROPERABILITY.md +116 -0
- package/corpus/templates/design/actions/create-design-from-template.ts +220 -0
- package/corpus/templates/design/actions/create-design-system.ts +92 -16
- package/corpus/templates/design/actions/delete-design-template.ts +28 -0
- package/corpus/templates/design/actions/delete-file.ts +7 -0
- package/corpus/templates/design/actions/edit-design.ts +3 -0
- package/corpus/templates/design/actions/export-design-as-figma-svg.ts +137 -5
- package/corpus/templates/design/actions/export-pdf.ts +1 -1
- package/corpus/templates/design/actions/generate-design.ts +3 -0
- package/corpus/templates/design/actions/get-design-snapshot.ts +9 -0
- package/corpus/templates/design/actions/get-figma-connection-status.ts +26 -0
- package/corpus/templates/design/actions/get-figma-design-context.ts +138 -0
- package/corpus/templates/design/actions/get-figma-styles.ts +2 -2
- package/corpus/templates/design/actions/import-figma-clipboard.ts +112 -16
- package/corpus/templates/design/actions/import-figma-frame.ts +15 -4
- package/corpus/templates/design/actions/index-design-system-with-builder.ts +4 -0
- package/corpus/templates/design/actions/list-design-templates.ts +118 -0
- package/corpus/templates/design/actions/navigate.ts +16 -2
- package/corpus/templates/design/actions/provider-api-request.ts +11 -1
- package/corpus/templates/design/actions/save-design-as-template.ts +156 -0
- package/corpus/templates/design/actions/set-active-breakpoint.ts +13 -4
- package/corpus/templates/design/actions/take-design-screenshot.ts +73 -3
- package/corpus/templates/design/actions/update-file.ts +39 -22
- package/corpus/templates/design/actions/view-screen.ts +36 -1
- package/corpus/templates/design/actions/write-local-file.ts +50 -38
- package/corpus/templates/design/app/components/design/AutoLayoutSuggestionDialog.tsx +151 -0
- package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +20 -0
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +251 -22
- package/corpus/templates/design/app/components/design/DesignEditorSkeleton.tsx +3 -3
- package/corpus/templates/design/app/components/design/DesignImportPanel.tsx +384 -9
- package/corpus/templates/design/app/components/design/EditPanel.tsx +105 -32
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +58 -28
- package/corpus/templates/design/app/components/design/TweaksPanel.tsx +6 -0
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +539 -53
- package/corpus/templates/design/app/components/design/bridge/embedded-wheel.bridge.ts +40 -0
- package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbench.tsx +1 -0
- package/corpus/templates/design/app/components/design/code-workbench/explorer/ExplorerView.tsx +1 -0
- package/corpus/templates/design/app/components/design/code-workbench/explorer/FileTree.tsx +5 -1
- package/corpus/templates/design/app/components/design/code-workbench/workspace/create-providers.ts +2 -0
- package/corpus/templates/design/app/components/design/code-workbench/workspace/localhost-provider.ts +3 -1
- package/corpus/templates/design/app/components/design/code-workbench/workspace/types.ts +2 -0
- package/corpus/templates/design/app/components/design/edit-panel/element-identity.ts +19 -0
- package/corpus/templates/design/app/components/design/edit-panel/frame-presets-panel.tsx +1 -0
- package/corpus/templates/design/app/components/design/edit-panel/interaction-state-helpers.ts +27 -0
- package/corpus/templates/design/app/components/design/inspector/InteractionStatePanel.tsx +137 -81
- package/corpus/templates/design/app/components/design/inspector/frame-size-presets.ts +25 -5
- package/corpus/templates/design/app/components/design/multi-screen/chrome-transitions.ts +1 -1
- package/corpus/templates/design/app/components/design/multi-screen/frame-geometry.ts +220 -3
- package/corpus/templates/design/app/components/design/multi-screen/overview-layout.ts +13 -0
- package/corpus/templates/design/app/components/design/multi-screen/types.ts +22 -1
- package/corpus/templates/design/app/components/design/types.ts +4 -0
- package/corpus/templates/design/app/components/design-system/ProductionDesignSystemShowcase.tsx +208 -0
- package/corpus/templates/design/app/components/editor/FigmaLinkComposerBubble.tsx +321 -0
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +24 -4
- package/corpus/templates/design/app/components/layout/Layout.tsx +16 -2
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +2 -0
- package/corpus/templates/design/app/components/templates/TemplatePreview.tsx +72 -0
- package/corpus/templates/design/app/global.css +2 -35
- package/corpus/templates/design/app/hooks/use-navigation-state.ts +10 -0
- package/corpus/templates/design/app/i18n/zh-TW.ts +127 -5
- package/corpus/templates/design/app/i18n-breakpoints.ts +209 -0
- package/corpus/templates/design/app/i18n-data.ts +1317 -59
- package/corpus/templates/design/app/i18n-template-feature.ts +458 -0
- package/corpus/templates/design/app/lib/design-clipboard.ts +202 -0
- package/corpus/templates/design/app/lib/design-file-upload.ts +87 -0
- package/corpus/templates/design/app/lib/design-import.ts +168 -11
- package/corpus/templates/design/app/lib/desktop-design-preview.ts +423 -0
- package/corpus/templates/design/app/lib/figma-clipboard.ts +74 -8
- package/corpus/templates/design/app/lib/figma-connection.ts +161 -0
- package/corpus/templates/design/app/lib/figma-svg-copy.ts +814 -22
- package/corpus/templates/design/app/lib/figma-url.ts +77 -0
- package/corpus/templates/design/app/lib/pending-generation.ts +35 -0
- package/corpus/templates/design/app/pages/DesignSystems.tsx +236 -177
- package/corpus/templates/design/app/pages/Index.tsx +38 -0
- package/corpus/templates/design/app/pages/Templates.tsx +498 -0
- package/corpus/templates/design/app/pages/design-editor/auto-layout-suggestion.ts +328 -0
- package/corpus/templates/design/app/pages/design-editor/clone-idrefs.ts +113 -0
- package/corpus/templates/design/app/pages/design-editor/created-screen-navigation.ts +55 -0
- package/corpus/templates/design/app/pages/design-editor/editor-session.ts +32 -0
- package/corpus/templates/design/app/pages/design-editor/editor-state.ts +49 -2
- package/corpus/templates/design/app/pages/design-editor/export-capture.ts +296 -0
- package/corpus/templates/design/app/pages/design-editor/history.ts +101 -2
- package/corpus/templates/design/app/pages/design-editor/layout-operations.ts +28 -1
- package/corpus/templates/design/app/pages/design-editor/overview-camera.ts +34 -0
- package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +202 -6
- package/corpus/templates/design/app/pages/design-editor/pending-structure-verification.ts +92 -0
- package/corpus/templates/design/app/pages/design-editor/save-failure.ts +58 -0
- package/corpus/templates/design/app/routes/templates.tsx +4 -6
- package/corpus/templates/design/changelog/2026-07-10-app-workspaces-now-use-clean-borderless-main-surfaces-throug.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-ask-chat-what-s-in-a-figma-file-or-frame-structure-screensho.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-canvas-edits-now-reject-malformed-html-before-it-can-corrupt.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-complex-designs-now-export-as-valid-secure-svgs-and-crisp-ra.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-complex-figma-masks-arcs-rich-text-transformed-images-and-ad.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-copied-layers-paste-across-designs-and-browser-tabs.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-copy-and-download-editable-figma-svg.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-copying-design-text-now-pastes-readable-text-into-other-apps.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-deleted-screens-can-be-restored-with-undo-and-removed-again-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-design-changes-now-save-before-switching-apps-and-retry-when.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-design-stays-usable-on-phones-by-keeping-editor-panels-and-f.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-download-all-screens-as-one-multi-page-pdf-from-the-overview.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-duplicated-layers-now-keep-labels-aria-relationships-fragmen.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fig-import-results-stay-compact.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-figma-imports-now-load-real-fonts-fix-rotated-gradient-dashe.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-figma-links-in-chat-and-the-import-tab-now-offer-secure-one-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fixed-cmd-z-not-restoring-content-after-an-agent-driven-desi.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fixed-download-pdf-being-unreachable-from-the-export-panel-e.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fixed-dragging-a-layer-out-of-an-auto-layout-row-column-no-l.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fixed-figma-svg-export-text-wrapping-sizing-and-inner-layer.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fixed-hiding-or-locking-one-layer-no-longer-hides-or-blocks-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fixed-png-screenshots-of-tall-screens-being-cropped-to-one-v.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fixed-png-svg-exports-capturing-broken-layout-when-webfonts-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-frame-tool-now-offers-standard-ad-unit-size-presets-medium-r.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-full-view-controls-stay-within-their-frame-instead-of-coveri.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-hover-focus-focus-visible-pressed-and-disabled-states-now-pr.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-layer-drops-now-land-in-the-intended-grid-row-stay-visually-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-local-code-workspaces-now-keep-unsaved-edits-across-panel-sw.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-local-visual-editing-now-keeps-authenticated-sessions-shared.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-long-running-agent-work-no-longer-shows-a-premature-stuck-wa.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-managed-figma-connections-are-recognized-automatically.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-new-designs-can-open-directly-in-the-editor-without-a-pr.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-new-screens-are-selected-and-revealed-immediately.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-new-text-layers-undo-as-one-safe-creation.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-preview-and-apply-inferred-auto-layout-without-changing-yo.md +5 -0
- package/corpus/templates/design/changelog/2026-07-10-print-pdf-exports-and-paper-size-presets-letter-a4-now-match.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-responsive-frame-editing.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-reusable-design-templates.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-screen-overview-frames-now-use-a-clearer-interact-action-wit.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-start-designs-from-source-linked-material-3-carbon-or-primer.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-tweaks-guidance.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-uploaded-fig-files-can-now-become-editable-design-screens-wi.md +6 -0
- package/corpus/templates/design/e2e/helpers.ts +3 -3
- package/corpus/templates/design/package.json +2 -0
- package/corpus/templates/design/scripts/qa-figma-stress-import.ts +96 -0
- package/corpus/templates/design/server/db/index.ts +10 -0
- package/corpus/templates/design/server/db/schema.ts +44 -0
- package/corpus/templates/design/server/handlers/import-design-file.ts +114 -80
- package/corpus/templates/design/server/handlers/index-design-system-with-builder.ts +19 -6
- package/corpus/templates/design/server/lib/design-export.ts +240 -3
- package/corpus/templates/design/server/lib/design-template-data.ts +89 -0
- package/corpus/templates/design/server/lib/design-to-figma-svg.ts +250 -26
- package/corpus/templates/design/server/lib/fig-file-decoder.ts +839 -0
- package/corpus/templates/design/server/lib/fig-file-import.ts +287 -0
- package/corpus/templates/design/server/lib/fig-file-limits.ts +3 -0
- package/corpus/templates/design/server/lib/fig-file-to-html.ts +2568 -0
- package/corpus/templates/design/server/lib/figma-design-context.ts +359 -0
- package/corpus/templates/design/server/lib/figma-node-import.ts +478 -22
- package/corpus/templates/design/server/lib/figma-node-to-html.ts +554 -29
- package/corpus/templates/design/server/lib/local-figma-qa-upload.ts +112 -0
- package/corpus/templates/design/server/lib/verify-write-grant.ts +16 -2
- package/corpus/templates/design/server/lib/visible-clipboard-html.ts +13 -3
- package/corpus/templates/design/server/plugins/agent-chat.ts +7 -0
- package/corpus/templates/design/server/plugins/db.ts +42 -0
- package/corpus/templates/design/server/plugins/local-figma-qa-upload.ts +7 -0
- package/corpus/templates/design/server/register-secrets.ts +8 -8
- package/corpus/templates/design/server/routes/api/qa-figma-import-assets/[assetId].get.ts +46 -0
- package/corpus/templates/design/server/source-workspace.ts +104 -12
- package/corpus/templates/design/shared/code-layer.ts +105 -28
- package/corpus/templates/design/shared/design-system-templates.ts +301 -0
- package/corpus/templates/design/shared/design-template-presets.ts +195 -0
- package/corpus/templates/design/shared/figma-url.ts +8 -0
- package/corpus/templates/design/shared/html-integrity.ts +306 -0
- package/corpus/templates/design/shared/interaction-states.ts +318 -23
- package/corpus/templates/design/shared/locked-layers.ts +151 -0
- package/corpus/templates/dispatch/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/dispatch/app/i18n/zh-TW.ts +48 -0
- package/corpus/templates/dispatch/app/i18n-data.ts +536 -1
- package/corpus/templates/dispatch/changelog/2026-07-10-connect-slack-workspaces-with-oauth-and-manage-channel-ident.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-07-10-microsoft-teams-bots-and-discord-slash-commands-can-now-conn.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-07-10-slack-and-telegram-now-route-uptime-monitor-requests-to-anal.md +6 -0
- package/corpus/templates/forms/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/forms/.agents/skills/form-publishing/SKILL.md +7 -0
- package/corpus/templates/forms/AGENTS.md +4 -0
- package/corpus/templates/forms/actions/create-form.ts +44 -7
- package/corpus/templates/forms/actions/lib/assert-publishable-form.ts +38 -0
- package/corpus/templates/forms/actions/patch-form-fields.ts +4 -0
- package/corpus/templates/forms/actions/update-form.ts +2 -36
- package/corpus/templates/forms/app/i18n/ar-SA.ts +3 -0
- package/corpus/templates/forms/app/i18n/de-DE.ts +3 -0
- package/corpus/templates/forms/app/i18n/en-US.ts +3 -0
- package/corpus/templates/forms/app/i18n/es-ES.ts +3 -0
- package/corpus/templates/forms/app/i18n/fr-FR.ts +3 -0
- package/corpus/templates/forms/app/i18n/hi-IN.ts +3 -0
- package/corpus/templates/forms/app/i18n/ja-JP.ts +3 -0
- package/corpus/templates/forms/app/i18n/ko-KR.ts +3 -0
- package/corpus/templates/forms/app/i18n/pt-BR.ts +3 -0
- package/corpus/templates/forms/app/i18n/zh-CN.ts +2 -0
- package/corpus/templates/forms/app/i18n/zh-TW.ts +3 -0
- package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +17 -0
- package/corpus/templates/forms/changelog/2026-07-10-agent-created-published-forms-now-return-the-anonymous-publi.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-10-published-forms-can-no-longer-be-edited-into-an-unusable-emp.md +6 -0
- package/corpus/templates/forms/server/handlers/submissions.ts +4 -3
- package/corpus/templates/forms/server/plugins/agent-chat.ts +1 -0
- package/corpus/templates/forms/shared/types.ts +5 -0
- package/corpus/templates/mail/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +2 -2
- package/corpus/templates/mail/changelog/2026-07-10-mail-navigation-now-uses-a-clean-borderless-drawer.md +6 -0
- package/corpus/templates/plan/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/plan/app/lib/plan-local-bridge.ts +4 -1
- package/corpus/templates/plan/changelog/2026-07-10-local-plans-now-keep-valid-content-visible-when-one-generate.md +6 -0
- package/corpus/templates/plan/server/lib/local-plan-files.ts +4 -1
- package/corpus/templates/slides/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/dist/a2a/artifact-response.d.ts.map +1 -1
- package/dist/a2a/artifact-response.js +88 -2
- package/dist/a2a/artifact-response.js.map +1 -1
- package/dist/a2a/client.d.ts +9 -0
- package/dist/a2a/client.d.ts.map +1 -1
- package/dist/a2a/client.js +1 -0
- package/dist/a2a/client.js.map +1 -1
- package/dist/a2a/handlers.d.ts.map +1 -1
- package/dist/a2a/handlers.js +24 -69
- package/dist/a2a/handlers.js.map +1 -1
- package/dist/a2a/types.d.ts +2 -0
- package/dist/a2a/types.d.ts.map +1 -1
- package/dist/a2a/types.js.map +1 -1
- package/dist/agent/durable-background.d.ts +11 -0
- package/dist/agent/durable-background.d.ts.map +1 -1
- package/dist/agent/durable-background.js +17 -0
- package/dist/agent/durable-background.js.map +1 -1
- package/dist/agent/production-agent.d.ts +2 -2
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +15 -5
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-manager.d.ts +44 -2
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +90 -9
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/run-store.d.ts +109 -0
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +206 -15
- package/dist/agent/run-store.js.map +1 -1
- package/dist/agent/types.d.ts +22 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/audit/record.d.ts.map +1 -1
- package/dist/audit/record.js +29 -0
- package/dist/audit/record.js.map +1 -1
- package/dist/audit/store.d.ts.map +1 -1
- package/dist/audit/store.js +62 -3
- package/dist/audit/store.js.map +1 -1
- package/dist/audit/types.d.ts +13 -0
- package/dist/audit/types.d.ts.map +1 -1
- package/dist/audit/types.js.map +1 -1
- package/dist/automation/index.d.ts +193 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.js +464 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +10 -3
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/design-connect.d.ts.map +1 -1
- package/dist/cli/design-connect.js +492 -35
- package/dist/cli/design-connect.js.map +1 -1
- package/dist/client/AgentPanel.d.ts +7 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +32 -8
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +15 -0
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +115 -47
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +1 -1
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/RunStuckBanner.d.ts +14 -1
- package/dist/client/RunStuckBanner.d.ts.map +1 -1
- package/dist/client/RunStuckBanner.js +35 -7
- package/dist/client/RunStuckBanner.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts +4 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +49 -4
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/automation.d.ts +14 -0
- package/dist/client/automation.d.ts.map +1 -0
- package/dist/client/automation.js +9 -0
- package/dist/client/automation.js.map +1 -0
- package/dist/client/chat/run-recovery.d.ts +4 -0
- package/dist/client/chat/run-recovery.d.ts.map +1 -1
- package/dist/client/chat/run-recovery.js +12 -10
- package/dist/client/chat/run-recovery.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +8 -0
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/integrations/api.d.ts +115 -0
- package/dist/client/integrations/api.d.ts.map +1 -0
- package/dist/client/integrations/api.js +123 -0
- package/dist/client/integrations/api.js.map +1 -0
- package/dist/client/integrations/index.d.ts +1 -0
- package/dist/client/integrations/index.d.ts.map +1 -1
- package/dist/client/integrations/index.js +1 -0
- package/dist/client/integrations/index.js.map +1 -1
- package/dist/client/transcription/use-live-transcription.d.ts.map +1 -1
- package/dist/client/transcription/use-live-transcription.js +59 -5
- package/dist/client/transcription/use-live-transcription.js.map +1 -1
- package/dist/client/use-run-stuck-detection.d.ts +16 -1
- package/dist/client/use-run-stuck-detection.d.ts.map +1 -1
- package/dist/client/use-run-stuck-detection.js +23 -4
- package/dist/client/use-run-stuck-detection.js.map +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +49 -4
- package/dist/deploy/build.js.map +1 -1
- package/dist/deploy/workspace-deploy.d.ts.map +1 -1
- package/dist/deploy/workspace-deploy.js +31 -2
- package/dist/deploy/workspace-deploy.js.map +1 -1
- package/dist/file-upload/types.d.ts +2 -0
- package/dist/file-upload/types.d.ts.map +1 -1
- package/dist/file-upload/types.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/integrations/a2a-continuations-store.d.ts.map +1 -1
- package/dist/integrations/a2a-continuations-store.js +6 -4
- package/dist/integrations/a2a-continuations-store.js.map +1 -1
- package/dist/integrations/adapters/discord.d.ts +3 -0
- package/dist/integrations/adapters/discord.d.ts.map +1 -0
- package/dist/integrations/adapters/discord.js +261 -0
- package/dist/integrations/adapters/discord.js.map +1 -0
- package/dist/integrations/adapters/index.d.ts +4 -0
- package/dist/integrations/adapters/index.d.ts.map +1 -0
- package/dist/integrations/adapters/index.js +26 -0
- package/dist/integrations/adapters/index.js.map +1 -0
- package/dist/integrations/adapters/microsoft-teams.d.ts +5 -0
- package/dist/integrations/adapters/microsoft-teams.d.ts.map +1 -0
- package/dist/integrations/adapters/microsoft-teams.js +295 -0
- package/dist/integrations/adapters/microsoft-teams.js.map +1 -0
- package/dist/integrations/adapters/slack.d.ts +8 -2
- package/dist/integrations/adapters/slack.d.ts.map +1 -1
- package/dist/integrations/adapters/slack.js +736 -27
- package/dist/integrations/adapters/slack.js.map +1 -1
- package/dist/integrations/adapters/telegram.d.ts +0 -2
- package/dist/integrations/adapters/telegram.d.ts.map +1 -1
- package/dist/integrations/adapters/telegram.js +49 -15
- package/dist/integrations/adapters/telegram.js.map +1 -1
- package/dist/integrations/adapters/whatsapp.d.ts +0 -2
- package/dist/integrations/adapters/whatsapp.d.ts.map +1 -1
- package/dist/integrations/adapters/whatsapp.js +40 -17
- package/dist/integrations/adapters/whatsapp.js.map +1 -1
- package/dist/integrations/catalog.d.ts +75 -0
- package/dist/integrations/catalog.d.ts.map +1 -0
- package/dist/integrations/catalog.js +451 -0
- package/dist/integrations/catalog.js.map +1 -0
- package/dist/integrations/controls-store.d.ts +44 -0
- package/dist/integrations/controls-store.d.ts.map +1 -0
- package/dist/integrations/controls-store.js +129 -0
- package/dist/integrations/controls-store.js.map +1 -0
- package/dist/integrations/index.d.ts +13 -1
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +9 -0
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/installations-store.d.ts +112 -0
- package/dist/integrations/installations-store.d.ts.map +1 -0
- package/dist/integrations/installations-store.js +493 -0
- package/dist/integrations/installations-store.js.map +1 -0
- package/dist/integrations/integration-memory.d.ts +24 -0
- package/dist/integrations/integration-memory.d.ts.map +1 -0
- package/dist/integrations/integration-memory.js +136 -0
- package/dist/integrations/integration-memory.js.map +1 -0
- package/dist/integrations/pending-tasks-retry-job.d.ts.map +1 -1
- package/dist/integrations/pending-tasks-retry-job.js +6 -5
- package/dist/integrations/pending-tasks-retry-job.js.map +1 -1
- package/dist/integrations/pending-tasks-store.d.ts +17 -0
- package/dist/integrations/pending-tasks-store.d.ts.map +1 -1
- package/dist/integrations/pending-tasks-store.js +71 -5
- package/dist/integrations/pending-tasks-store.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +520 -35
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/scope-store.d.ts +65 -0
- package/dist/integrations/scope-store.d.ts.map +1 -0
- package/dist/integrations/scope-store.js +361 -0
- package/dist/integrations/scope-store.js.map +1 -0
- package/dist/integrations/slack-manifest.d.ts +66 -0
- package/dist/integrations/slack-manifest.d.ts.map +1 -0
- package/dist/integrations/slack-manifest.js +70 -0
- package/dist/integrations/slack-manifest.js.map +1 -0
- package/dist/integrations/slack-oauth.d.ts +99 -0
- package/dist/integrations/slack-oauth.d.ts.map +1 -0
- package/dist/integrations/slack-oauth.js +226 -0
- package/dist/integrations/slack-oauth.js.map +1 -0
- package/dist/integrations/types.d.ts +144 -0
- package/dist/integrations/types.d.ts.map +1 -1
- package/dist/integrations/types.js +16 -1
- package/dist/integrations/types.js.map +1 -1
- package/dist/integrations/usage-budget-store.d.ts +84 -0
- package/dist/integrations/usage-budget-store.d.ts.map +1 -0
- package/dist/integrations/usage-budget-store.js +650 -0
- package/dist/integrations/usage-budget-store.js.map +1 -0
- package/dist/integrations/webhook-handler.d.ts +4 -0
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +415 -47
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/jobs/scheduler.d.ts +6 -0
- package/dist/jobs/scheduler.d.ts.map +1 -1
- package/dist/jobs/scheduler.js +83 -4
- package/dist/jobs/scheduler.js.map +1 -1
- package/dist/jobs/tools.d.ts.map +1 -1
- package/dist/jobs/tools.js +43 -11
- package/dist/jobs/tools.js.map +1 -1
- package/dist/observability/routes.d.ts +5 -5
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/index.d.ts +4 -4
- package/dist/provider-api/index.d.ts.map +1 -1
- package/dist/provider-api/index.js +72 -1
- package/dist/provider-api/index.js.map +1 -1
- package/dist/resources/handlers.d.ts +3 -3
- package/dist/resources/handlers.d.ts.map +1 -1
- package/dist/resources/handlers.js +57 -15
- package/dist/resources/handlers.js.map +1 -1
- package/dist/resources/script-helpers.d.ts.map +1 -1
- package/dist/resources/script-helpers.js +34 -8
- package/dist/resources/script-helpers.js.map +1 -1
- package/dist/resources/store.d.ts +10 -0
- package/dist/resources/store.d.ts.map +1 -1
- package/dist/resources/store.js +54 -47
- package/dist/resources/store.js.map +1 -1
- package/dist/scripts/call-agent.d.ts.map +1 -1
- package/dist/scripts/call-agent.js +106 -1
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +15 -4
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +248 -113
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +10 -14
- package/dist/server/auth.js.map +1 -1
- package/dist/server/builder-design-systems.d.ts +3 -1
- package/dist/server/builder-design-systems.d.ts.map +1 -1
- package/dist/server/builder-design-systems.js +9 -2
- package/dist/server/builder-design-systems.js.map +1 -1
- package/dist/server/edge.d.ts +1 -1
- package/dist/server/edge.d.ts.map +1 -1
- package/dist/server/edge.js +1 -1
- package/dist/server/edge.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/request-context.d.ts +18 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-context.js.map +1 -1
- package/dist/server/social-og-image.d.ts.map +1 -1
- package/dist/server/social-og-image.js +3 -2
- package/dist/server/social-og-image.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/styles/agent-native.css +62 -44
- package/dist/templates/default/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/dist/templates/default/AGENTS.md +7 -3
- package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +1 -1
- package/dist/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/dist/templates/workspace-core/.agents/skills/extension-points/SKILL.md +6 -3
- package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +25 -0
- package/dist/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +15 -0
- package/dist/templates/workspace-core/AGENTS.md +3 -2
- package/dist/usage/store.d.ts +7 -0
- package/dist/usage/store.d.ts.map +1 -1
- package/dist/usage/store.js +24 -3
- package/dist/usage/store.js.map +1 -1
- package/docs/content/automation-connectors.mdx +80 -0
- package/docs/content/extensions.mdx +8 -0
- package/docs/content/locales/ar-SA/extensions.mdx +8 -0
- package/docs/content/locales/ar-SA/messaging.mdx +84 -15
- package/docs/content/locales/ar-SA/template-clips.mdx +1 -0
- package/docs/content/locales/ar-SA/template-design.mdx +1 -0
- package/docs/content/locales/de-DE/extensions.mdx +10 -0
- package/docs/content/locales/de-DE/messaging.mdx +92 -15
- package/docs/content/locales/de-DE/template-clips.mdx +1 -0
- package/docs/content/locales/de-DE/template-design.mdx +1 -0
- package/docs/content/locales/es-ES/extensions.mdx +10 -0
- package/docs/content/locales/es-ES/messaging.mdx +91 -15
- package/docs/content/locales/es-ES/template-clips.mdx +1 -0
- package/docs/content/locales/es-ES/template-design.mdx +1 -0
- package/docs/content/locales/fr-FR/extensions.mdx +10 -0
- package/docs/content/locales/fr-FR/messaging.mdx +91 -15
- package/docs/content/locales/fr-FR/template-clips.mdx +1 -0
- package/docs/content/locales/fr-FR/template-design.mdx +1 -0
- package/docs/content/locales/hi-IN/extensions.mdx +8 -0
- package/docs/content/locales/hi-IN/messaging.mdx +81 -15
- package/docs/content/locales/hi-IN/template-clips.mdx +1 -0
- package/docs/content/locales/hi-IN/template-design.mdx +1 -0
- package/docs/content/locales/ja-JP/extensions.mdx +9 -0
- package/docs/content/locales/ja-JP/messaging.mdx +81 -15
- package/docs/content/locales/ja-JP/template-clips.mdx +1 -0
- package/docs/content/locales/ja-JP/template-design.mdx +1 -0
- package/docs/content/locales/ko-KR/extensions.mdx +8 -0
- package/docs/content/locales/ko-KR/messaging.mdx +80 -15
- package/docs/content/locales/ko-KR/template-clips.mdx +1 -0
- package/docs/content/locales/ko-KR/template-design.mdx +1 -0
- package/docs/content/locales/pt-BR/extensions.mdx +9 -0
- package/docs/content/locales/pt-BR/messaging.mdx +88 -15
- package/docs/content/locales/pt-BR/template-clips.mdx +1 -0
- package/docs/content/locales/pt-BR/template-design.mdx +1 -0
- package/docs/content/locales/zh-CN/extensions.mdx +6 -0
- package/docs/content/locales/zh-CN/messaging.mdx +78 -15
- package/docs/content/locales/zh-CN/template-clips.mdx +1 -0
- package/docs/content/locales/zh-CN/template-design.mdx +1 -0
- package/docs/content/locales/zh-TW/extensions.mdx +6 -0
- package/docs/content/locales/zh-TW/messaging.mdx +78 -15
- package/docs/content/locales/zh-TW/template-clips.mdx +1 -0
- package/docs/content/locales/zh-TW/template-design.mdx +1 -0
- package/docs/content/messaging.mdx +227 -45
- package/docs/content/template-clips.mdx +3 -0
- package/docs/content/template-design.mdx +4 -0
- package/package.json +5 -1
- package/src/templates/default/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/src/templates/default/AGENTS.md +7 -3
- package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +1 -1
- package/src/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +6 -3
- package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +25 -0
- package/src/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +15 -0
- package/src/templates/workspace-core/AGENTS.md +3 -2
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/** Slack OAuth v2 helpers for managed Agent Native messaging installs. */
|
|
2
|
+
import type { SecretScope } from "../secrets/register.js";
|
|
3
|
+
import type { IntegrationInstallationHealth, UpsertIntegrationInstallationInput } from "./installations-store.js";
|
|
4
|
+
export declare const SLACK_AUTHORIZE_URL = "https://slack.com/oauth/v2/authorize";
|
|
5
|
+
export declare const SLACK_TOKEN_URL = "https://slack.com/api/oauth.v2.access";
|
|
6
|
+
export declare const SLACK_AUTH_TEST_URL = "https://slack.com/api/auth.test";
|
|
7
|
+
/** Scopes needed for contextual, file-aware Agent Native conversations. */
|
|
8
|
+
export declare const SLACK_AGENT_BOT_SCOPES: readonly ["assistant:write", "app_mentions:read", "channels:read", "channels:history", "chat:write", "files:read", "groups:history", "groups:read", "im:history", "im:read", "mpim:history", "mpim:read", "pins:read", "reactions:read", "users:read", "users:read.email"];
|
|
9
|
+
export interface SlackOAuthAccessResponse {
|
|
10
|
+
ok?: boolean;
|
|
11
|
+
error?: string;
|
|
12
|
+
access_token?: string;
|
|
13
|
+
refresh_token?: string;
|
|
14
|
+
expires_in?: number;
|
|
15
|
+
token_type?: string;
|
|
16
|
+
scope?: string;
|
|
17
|
+
bot_user_id?: string;
|
|
18
|
+
app_id?: string;
|
|
19
|
+
is_enterprise_install?: boolean;
|
|
20
|
+
authed_user?: {
|
|
21
|
+
id?: string;
|
|
22
|
+
};
|
|
23
|
+
team?: {
|
|
24
|
+
id?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
} | null;
|
|
27
|
+
enterprise?: {
|
|
28
|
+
id?: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
} | null;
|
|
31
|
+
}
|
|
32
|
+
export interface SlackAuthHealth {
|
|
33
|
+
ok: boolean;
|
|
34
|
+
health: IntegrationInstallationHealth;
|
|
35
|
+
error: string | null;
|
|
36
|
+
checkedAt: number;
|
|
37
|
+
teamId: string | null;
|
|
38
|
+
enterpriseId: string | null;
|
|
39
|
+
botId: string | null;
|
|
40
|
+
userId: string | null;
|
|
41
|
+
}
|
|
42
|
+
export interface SlackInstallSession {
|
|
43
|
+
email?: string | null;
|
|
44
|
+
orgId?: string | null;
|
|
45
|
+
orgRole?: string | null;
|
|
46
|
+
}
|
|
47
|
+
export interface SlackInstallAccess {
|
|
48
|
+
ownerEmail: string;
|
|
49
|
+
orgId: string | null;
|
|
50
|
+
secretScope: SecretScope;
|
|
51
|
+
secretScopeId: string;
|
|
52
|
+
}
|
|
53
|
+
export declare function buildSlackAuthorizeUrl(options: {
|
|
54
|
+
clientId: string;
|
|
55
|
+
redirectUri: string;
|
|
56
|
+
state: string;
|
|
57
|
+
scopes?: readonly string[];
|
|
58
|
+
userScopes?: readonly string[];
|
|
59
|
+
teamId?: string;
|
|
60
|
+
}): string;
|
|
61
|
+
/** Exchange an OAuth code using Slack's preferred HTTP Basic authentication. */
|
|
62
|
+
export declare function exchangeSlackOAuthCode(options: {
|
|
63
|
+
code: string;
|
|
64
|
+
clientId: string;
|
|
65
|
+
clientSecret: string;
|
|
66
|
+
redirectUri: string;
|
|
67
|
+
fetchImpl?: typeof fetch;
|
|
68
|
+
}): Promise<SlackOAuthAccessResponse>;
|
|
69
|
+
/**
|
|
70
|
+
* Rotate an expiring Slack token. Slack refresh tokens are one-time-use, so
|
|
71
|
+
* callers must atomically persist the returned access/refresh pair together.
|
|
72
|
+
*/
|
|
73
|
+
export declare function refreshSlackOAuthToken(options: {
|
|
74
|
+
refreshToken: string;
|
|
75
|
+
clientId: string;
|
|
76
|
+
clientSecret: string;
|
|
77
|
+
fetchImpl?: typeof fetch;
|
|
78
|
+
}): Promise<SlackOAuthAccessResponse>;
|
|
79
|
+
/** Validate a bot token without ever including it in an error or result. */
|
|
80
|
+
export declare function testSlackAuth(accessToken: string, fetchImpl?: typeof fetch): Promise<SlackAuthHealth>;
|
|
81
|
+
/** Stable team/app key used by webhook payloads and the installation store. */
|
|
82
|
+
export declare function slackInstallationKey(input: {
|
|
83
|
+
teamId?: string | null;
|
|
84
|
+
enterpriseId?: string | null;
|
|
85
|
+
apiAppId?: string | null;
|
|
86
|
+
isEnterpriseInstall?: boolean;
|
|
87
|
+
}): string;
|
|
88
|
+
/**
|
|
89
|
+
* Convert a successful Slack response to the generic managed-install input.
|
|
90
|
+
* The returned token bundle is server-only and must be passed directly to the
|
|
91
|
+
* encrypted installation store, never to a route response.
|
|
92
|
+
*/
|
|
93
|
+
export declare function slackOAuthResponseToInstallation(response: SlackOAuthAccessResponse, access: SlackInstallAccess, now?: number): UpsertIntegrationInstallationInput;
|
|
94
|
+
/**
|
|
95
|
+
* Pure session/role gate for OAuth install routes. The caller must supply a
|
|
96
|
+
* server-verified session; org membership must be the active org context.
|
|
97
|
+
*/
|
|
98
|
+
export declare function assertSlackInstallAccess(session: SlackInstallSession | null | undefined): SlackInstallAccess;
|
|
99
|
+
//# sourceMappingURL=slack-oauth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slack-oauth.d.ts","sourceRoot":"","sources":["../../src/integrations/slack-oauth.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAE1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EACV,6BAA6B,EAC7B,kCAAkC,EACnC,MAAM,0BAA0B,CAAC;AAElC,eAAO,MAAM,mBAAmB,yCAAyC,CAAC;AAC1E,eAAO,MAAM,eAAe,0CAA0C,CAAC;AACvE,eAAO,MAAM,mBAAmB,oCAAoC,CAAC;AAErE,2EAA2E;AAC3E,eAAO,MAAM,sBAAsB,YACjC,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,SAAS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E,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,GAAG,MAAM,CAQT;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,wBAAwB,EAClC,MAAM,EAAE,kBAAkB,EAC1B,GAAG,SAAa,GACf,kCAAkC,CAsCpC;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,GAC9C,kBAAkB,CAqBpB"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/** Slack OAuth v2 helpers for managed Agent Native messaging installs. */
|
|
2
|
+
export const SLACK_AUTHORIZE_URL = "https://slack.com/oauth/v2/authorize";
|
|
3
|
+
export const SLACK_TOKEN_URL = "https://slack.com/api/oauth.v2.access";
|
|
4
|
+
export const SLACK_AUTH_TEST_URL = "https://slack.com/api/auth.test";
|
|
5
|
+
/** Scopes needed for contextual, file-aware Agent Native conversations. */
|
|
6
|
+
export const SLACK_AGENT_BOT_SCOPES = [
|
|
7
|
+
"assistant:write",
|
|
8
|
+
"app_mentions:read",
|
|
9
|
+
"channels:read",
|
|
10
|
+
"channels:history",
|
|
11
|
+
"chat:write",
|
|
12
|
+
"files:read",
|
|
13
|
+
"groups:history",
|
|
14
|
+
"groups:read",
|
|
15
|
+
"im:history",
|
|
16
|
+
"im:read",
|
|
17
|
+
"mpim:history",
|
|
18
|
+
"mpim:read",
|
|
19
|
+
"pins:read",
|
|
20
|
+
"reactions:read",
|
|
21
|
+
"users:read",
|
|
22
|
+
"users:read.email",
|
|
23
|
+
];
|
|
24
|
+
function safeSlackError(value, fallback) {
|
|
25
|
+
return typeof value === "string" && /^[a-z0-9_.-]{1,100}$/i.test(value)
|
|
26
|
+
? value
|
|
27
|
+
: fallback;
|
|
28
|
+
}
|
|
29
|
+
export function buildSlackAuthorizeUrl(options) {
|
|
30
|
+
const params = new URLSearchParams({
|
|
31
|
+
client_id: options.clientId,
|
|
32
|
+
redirect_uri: options.redirectUri,
|
|
33
|
+
response_type: "code",
|
|
34
|
+
scope: (options.scopes ?? SLACK_AGENT_BOT_SCOPES).join(","),
|
|
35
|
+
state: options.state,
|
|
36
|
+
});
|
|
37
|
+
if (options.userScopes?.length) {
|
|
38
|
+
params.set("user_scope", options.userScopes.join(","));
|
|
39
|
+
}
|
|
40
|
+
if (options.teamId)
|
|
41
|
+
params.set("team", options.teamId);
|
|
42
|
+
return `${SLACK_AUTHORIZE_URL}?${params.toString()}`;
|
|
43
|
+
}
|
|
44
|
+
/** Exchange an OAuth code using Slack's preferred HTTP Basic authentication. */
|
|
45
|
+
export async function exchangeSlackOAuthCode(options) {
|
|
46
|
+
const fetchImpl = options.fetchImpl ?? fetch;
|
|
47
|
+
const authorization = Buffer.from(`${options.clientId}:${options.clientSecret}`, "utf8").toString("base64");
|
|
48
|
+
const response = await fetchImpl(SLACK_TOKEN_URL, {
|
|
49
|
+
method: "POST",
|
|
50
|
+
headers: {
|
|
51
|
+
Authorization: `Basic ${authorization}`,
|
|
52
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
53
|
+
},
|
|
54
|
+
body: new URLSearchParams({
|
|
55
|
+
code: options.code,
|
|
56
|
+
redirect_uri: options.redirectUri,
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
const data = (await response
|
|
60
|
+
.json()
|
|
61
|
+
.catch(() => null));
|
|
62
|
+
if (!response.ok || !data?.ok) {
|
|
63
|
+
throw new Error(safeSlackError(data?.error, `Slack OAuth exchange failed (${response.status})`));
|
|
64
|
+
}
|
|
65
|
+
return data;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Rotate an expiring Slack token. Slack refresh tokens are one-time-use, so
|
|
69
|
+
* callers must atomically persist the returned access/refresh pair together.
|
|
70
|
+
*/
|
|
71
|
+
export async function refreshSlackOAuthToken(options) {
|
|
72
|
+
const fetchImpl = options.fetchImpl ?? fetch;
|
|
73
|
+
const authorization = Buffer.from(`${options.clientId}:${options.clientSecret}`, "utf8").toString("base64");
|
|
74
|
+
const response = await fetchImpl(SLACK_TOKEN_URL, {
|
|
75
|
+
method: "POST",
|
|
76
|
+
headers: {
|
|
77
|
+
Authorization: `Basic ${authorization}`,
|
|
78
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
79
|
+
},
|
|
80
|
+
body: new URLSearchParams({
|
|
81
|
+
grant_type: "refresh_token",
|
|
82
|
+
refresh_token: options.refreshToken,
|
|
83
|
+
}),
|
|
84
|
+
});
|
|
85
|
+
const data = (await response
|
|
86
|
+
.json()
|
|
87
|
+
.catch(() => null));
|
|
88
|
+
if (!response.ok || !data?.ok) {
|
|
89
|
+
throw new Error(safeSlackError(data?.error, `Slack OAuth token refresh failed (${response.status})`));
|
|
90
|
+
}
|
|
91
|
+
if (!data.access_token || !data.refresh_token) {
|
|
92
|
+
throw new Error("Slack OAuth token refresh returned an incomplete bundle");
|
|
93
|
+
}
|
|
94
|
+
return data;
|
|
95
|
+
}
|
|
96
|
+
/** Validate a bot token without ever including it in an error or result. */
|
|
97
|
+
export async function testSlackAuth(accessToken, fetchImpl = fetch) {
|
|
98
|
+
const checkedAt = Date.now();
|
|
99
|
+
try {
|
|
100
|
+
const response = await fetchImpl(SLACK_AUTH_TEST_URL, {
|
|
101
|
+
method: "POST",
|
|
102
|
+
headers: { Authorization: `Bearer ${accessToken}` },
|
|
103
|
+
});
|
|
104
|
+
const data = (await response
|
|
105
|
+
.json()
|
|
106
|
+
.catch(() => null));
|
|
107
|
+
if (!response.ok || !data?.ok) {
|
|
108
|
+
const error = safeSlackError(data?.error, `Slack auth test failed (${response.status})`);
|
|
109
|
+
return {
|
|
110
|
+
ok: false,
|
|
111
|
+
health: error === "invalid_auth" || error === "token_revoked"
|
|
112
|
+
? "revoked"
|
|
113
|
+
: "degraded",
|
|
114
|
+
error,
|
|
115
|
+
checkedAt,
|
|
116
|
+
teamId: null,
|
|
117
|
+
enterpriseId: null,
|
|
118
|
+
botId: null,
|
|
119
|
+
userId: null,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
ok: true,
|
|
124
|
+
health: "healthy",
|
|
125
|
+
error: null,
|
|
126
|
+
checkedAt,
|
|
127
|
+
teamId: data.team_id ?? null,
|
|
128
|
+
enterpriseId: data.enterprise_id ?? null,
|
|
129
|
+
botId: data.bot_id ?? null,
|
|
130
|
+
userId: data.user_id ?? null,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
return {
|
|
135
|
+
ok: false,
|
|
136
|
+
health: "degraded",
|
|
137
|
+
error: "Slack auth test request failed",
|
|
138
|
+
checkedAt,
|
|
139
|
+
teamId: null,
|
|
140
|
+
enterpriseId: null,
|
|
141
|
+
botId: null,
|
|
142
|
+
userId: null,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/** Stable team/app key used by webhook payloads and the installation store. */
|
|
147
|
+
export function slackInstallationKey(input) {
|
|
148
|
+
const workspaceId = input.isEnterpriseInstall
|
|
149
|
+
? input.enterpriseId
|
|
150
|
+
: (input.teamId ?? input.enterpriseId);
|
|
151
|
+
if (!workspaceId) {
|
|
152
|
+
throw new Error("Slack OAuth did not return a team or enterprise id");
|
|
153
|
+
}
|
|
154
|
+
return `${input.isEnterpriseInstall ? "enterprise" : "team"}:${workspaceId}:app:${input.apiAppId || "default"}`;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Convert a successful Slack response to the generic managed-install input.
|
|
158
|
+
* The returned token bundle is server-only and must be passed directly to the
|
|
159
|
+
* encrypted installation store, never to a route response.
|
|
160
|
+
*/
|
|
161
|
+
export function slackOAuthResponseToInstallation(response, access, now = Date.now()) {
|
|
162
|
+
if (!response.ok || !response.access_token) {
|
|
163
|
+
throw new Error("Slack OAuth response did not include a bot access token");
|
|
164
|
+
}
|
|
165
|
+
const installationKey = slackInstallationKey({
|
|
166
|
+
teamId: response.team?.id,
|
|
167
|
+
enterpriseId: response.enterprise?.id,
|
|
168
|
+
apiAppId: response.app_id,
|
|
169
|
+
isEnterpriseInstall: response.is_enterprise_install,
|
|
170
|
+
});
|
|
171
|
+
const expiresAt = typeof response.expires_in === "number" && response.expires_in > 0
|
|
172
|
+
? now + response.expires_in * 1000
|
|
173
|
+
: undefined;
|
|
174
|
+
return {
|
|
175
|
+
platform: "slack",
|
|
176
|
+
installationKey,
|
|
177
|
+
teamId: response.team?.id ?? null,
|
|
178
|
+
teamName: response.team?.name ?? null,
|
|
179
|
+
enterpriseId: response.enterprise?.id ?? null,
|
|
180
|
+
enterpriseName: response.enterprise?.name ?? null,
|
|
181
|
+
isEnterpriseInstall: response.is_enterprise_install === true,
|
|
182
|
+
apiAppId: response.app_id ?? null,
|
|
183
|
+
botUserId: response.bot_user_id ?? null,
|
|
184
|
+
scopes: response.scope?.split(",").map((scope) => scope.trim()) ?? [],
|
|
185
|
+
installedByExternalUserId: response.authed_user?.id ?? null,
|
|
186
|
+
ownerEmail: access.ownerEmail,
|
|
187
|
+
orgId: access.orgId,
|
|
188
|
+
secretScope: access.secretScope,
|
|
189
|
+
secretScopeId: access.secretScopeId,
|
|
190
|
+
tokenBundle: {
|
|
191
|
+
accessToken: response.access_token,
|
|
192
|
+
refreshToken: response.refresh_token,
|
|
193
|
+
tokenType: response.token_type,
|
|
194
|
+
expiresAt,
|
|
195
|
+
},
|
|
196
|
+
tokenExpiresAt: expiresAt ?? null,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Pure session/role gate for OAuth install routes. The caller must supply a
|
|
201
|
+
* server-verified session; org membership must be the active org context.
|
|
202
|
+
*/
|
|
203
|
+
export function assertSlackInstallAccess(session) {
|
|
204
|
+
const ownerEmail = session?.email?.trim().toLowerCase();
|
|
205
|
+
if (!ownerEmail)
|
|
206
|
+
throw new Error("Sign in before connecting Slack.");
|
|
207
|
+
const orgId = session?.orgId?.trim() || null;
|
|
208
|
+
if (!orgId) {
|
|
209
|
+
return {
|
|
210
|
+
ownerEmail,
|
|
211
|
+
orgId: null,
|
|
212
|
+
secretScope: "user",
|
|
213
|
+
secretScopeId: ownerEmail,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
if (session?.orgRole !== "owner" && session?.orgRole !== "admin") {
|
|
217
|
+
throw new Error("Only organization owners and admins can connect Slack.");
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
ownerEmail,
|
|
221
|
+
orgId,
|
|
222
|
+
secretScope: "org",
|
|
223
|
+
secretScopeId: orgId,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=slack-oauth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slack-oauth.js","sourceRoot":"","sources":["../../src/integrations/slack-oauth.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAQ1E,MAAM,CAAC,MAAM,mBAAmB,GAAG,sCAAsC,CAAC;AAC1E,MAAM,CAAC,MAAM,eAAe,GAAG,uCAAuC,CAAC;AACvE,MAAM,CAAC,MAAM,mBAAmB,GAAG,iCAAiC,CAAC;AAErE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,iBAAiB;IACjB,mBAAmB;IACnB,eAAe;IACf,kBAAkB;IAClB,YAAY;IACZ,YAAY;IACZ,gBAAgB;IAChB,aAAa;IACb,YAAY;IACZ,SAAS;IACT,cAAc;IACd,WAAW;IACX,WAAW;IACX,gBAAgB;IAChB,YAAY;IACZ,kBAAkB;CACV,CAAC;AAsDX,SAAS,cAAc,CAAC,KAAc,EAAE,QAAgB;IACtD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC;QACrE,CAAC,CAAC,KAAK;Q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,EAAE,MAAM,CAAC,aAAa;QACnC,WAAW,EAAE;YACX,WAAW,EAAE,QAAQ,CAAC,YAAY;YAClC,YAAY,EAAE,QAAQ,CAAC,aAAa;YACpC,SAAS,EAAE,QAAQ,CAAC,UAAU;YAC9B,SAAS;SACV;QACD,cAAc,EAAE,SAAS,IAAI,IAAI;KAClC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAA+C;IAE/C,MAAM,UAAU,GAAG,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACxD,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACrE,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC;IAC7C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;YACL,UAAU;YACV,KAAK,EAAE,IAAI;YACX,WAAW,EAAE,MAAM;YACnB,aAAa,EAAE,UAAU;SAC1B,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,EAAE,OAAO,KAAK,OAAO,IAAI,OAAO,EAAE,OAAO,KAAK,OAAO,EAAE,CAAC;QACjE,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO;QACL,UAAU;QACV,KAAK;QACL,WAAW,EAAE,KAAK;QAClB,aAAa,EAAE,KAAK;KACrB,CAAC;AACJ,CAAC","sourcesContent":["/** Slack OAuth v2 helpers for managed Agent Native messaging installs. */\n\nimport type { SecretScope } from \"../secrets/register.js\";\nimport type {\n IntegrationInstallationHealth,\n UpsertIntegrationInstallationInput,\n} from \"./installations-store.js\";\n\nexport const SLACK_AUTHORIZE_URL = \"https://slack.com/oauth/v2/authorize\";\nexport const SLACK_TOKEN_URL = \"https://slack.com/api/oauth.v2.access\";\nexport const SLACK_AUTH_TEST_URL = \"https://slack.com/api/auth.test\";\n\n/** Scopes needed for contextual, file-aware Agent Native conversations. */\nexport const SLACK_AGENT_BOT_SCOPES = [\n \"assistant:write\",\n \"app_mentions:read\",\n \"channels:read\",\n \"channels:history\",\n \"chat:write\",\n \"files:read\",\n \"groups:history\",\n \"groups:read\",\n \"im:history\",\n \"im:read\",\n \"mpim:history\",\n \"mpim:read\",\n \"pins:read\",\n \"reactions:read\",\n \"users:read\",\n \"users:read.email\",\n] as const;\n\nexport interface SlackOAuthAccessResponse {\n ok?: boolean;\n error?: string;\n access_token?: string;\n refresh_token?: string;\n expires_in?: number;\n token_type?: string;\n scope?: string;\n bot_user_id?: string;\n app_id?: string;\n is_enterprise_install?: boolean;\n authed_user?: { id?: string };\n team?: { id?: string; name?: string } | null;\n enterprise?: { id?: string; name?: string } | null;\n}\n\ninterface SlackApiResponse {\n ok?: boolean;\n error?: string;\n team_id?: string;\n team?: string;\n enterprise_id?: string;\n enterprise?: string;\n user_id?: string;\n bot_id?: string;\n url?: string;\n}\n\nexport interface SlackAuthHealth {\n ok: boolean;\n health: IntegrationInstallationHealth;\n error: string | null;\n checkedAt: number;\n teamId: string | null;\n enterpriseId: string | null;\n botId: string | null;\n userId: string | null;\n}\n\nexport interface SlackInstallSession {\n email?: string | null;\n orgId?: string | null;\n orgRole?: string | null;\n}\n\nexport interface SlackInstallAccess {\n ownerEmail: string;\n orgId: string | null;\n secretScope: SecretScope;\n secretScopeId: string;\n}\n\nfunction safeSlackError(value: unknown, fallback: string): string {\n return typeof value === \"string\" && /^[a-z0-9_.-]{1,100}$/i.test(value)\n ? value\n : fallback;\n}\n\nexport function buildSlackAuthorizeUrl(options: {\n clientId: string;\n redirectUri: string;\n state: string;\n scopes?: readonly string[];\n userScopes?: readonly string[];\n teamId?: string;\n}): string {\n const params = new URLSearchParams({\n client_id: options.clientId,\n redirect_uri: options.redirectUri,\n response_type: \"code\",\n scope: (options.scopes ?? SLACK_AGENT_BOT_SCOPES).join(\",\"),\n state: options.state,\n });\n if (options.userScopes?.length) {\n params.set(\"user_scope\", options.userScopes.join(\",\"));\n }\n if (options.teamId) params.set(\"team\", options.teamId);\n return `${SLACK_AUTHORIZE_URL}?${params.toString()}`;\n}\n\n/** Exchange an OAuth code using Slack's preferred HTTP Basic authentication. */\nexport async function exchangeSlackOAuthCode(options: {\n code: string;\n clientId: string;\n clientSecret: string;\n redirectUri: string;\n fetchImpl?: typeof fetch;\n}): Promise<SlackOAuthAccessResponse> {\n const fetchImpl = options.fetchImpl ?? fetch;\n const authorization = Buffer.from(\n `${options.clientId}:${options.clientSecret}`,\n \"utf8\",\n ).toString(\"base64\");\n const response = await fetchImpl(SLACK_TOKEN_URL, {\n method: \"POST\",\n headers: {\n Authorization: `Basic ${authorization}`,\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n body: new URLSearchParams({\n code: options.code,\n redirect_uri: options.redirectUri,\n }),\n });\n const data = (await response\n .json()\n .catch(() => null)) as SlackOAuthAccessResponse | null;\n if (!response.ok || !data?.ok) {\n throw new Error(\n safeSlackError(\n data?.error,\n `Slack OAuth exchange failed (${response.status})`,\n ),\n );\n }\n return data;\n}\n\n/**\n * Rotate an expiring Slack token. Slack refresh tokens are one-time-use, so\n * callers must atomically persist the returned access/refresh pair together.\n */\nexport async function refreshSlackOAuthToken(options: {\n refreshToken: string;\n clientId: string;\n clientSecret: string;\n fetchImpl?: typeof fetch;\n}): Promise<SlackOAuthAccessResponse> {\n const fetchImpl = options.fetchImpl ?? fetch;\n const authorization = Buffer.from(\n `${options.clientId}:${options.clientSecret}`,\n \"utf8\",\n ).toString(\"base64\");\n const response = await fetchImpl(SLACK_TOKEN_URL, {\n method: \"POST\",\n headers: {\n Authorization: `Basic ${authorization}`,\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n body: new URLSearchParams({\n grant_type: \"refresh_token\",\n refresh_token: options.refreshToken,\n }),\n });\n const data = (await response\n .json()\n .catch(() => null)) as SlackOAuthAccessResponse | null;\n if (!response.ok || !data?.ok) {\n throw new Error(\n safeSlackError(\n data?.error,\n `Slack OAuth token refresh failed (${response.status})`,\n ),\n );\n }\n if (!data.access_token || !data.refresh_token) {\n throw new Error(\"Slack OAuth token refresh returned an incomplete bundle\");\n }\n return data;\n}\n\n/** Validate a bot token without ever including it in an error or result. */\nexport async function testSlackAuth(\n accessToken: string,\n fetchImpl: typeof fetch = fetch,\n): Promise<SlackAuthHealth> {\n const checkedAt = Date.now();\n try {\n const response = await fetchImpl(SLACK_AUTH_TEST_URL, {\n method: \"POST\",\n headers: { Authorization: `Bearer ${accessToken}` },\n });\n const data = (await response\n .json()\n .catch(() => null)) as SlackApiResponse | null;\n if (!response.ok || !data?.ok) {\n const error = safeSlackError(\n data?.error,\n `Slack auth test failed (${response.status})`,\n );\n return {\n ok: false,\n health:\n error === \"invalid_auth\" || error === \"token_revoked\"\n ? \"revoked\"\n : \"degraded\",\n error,\n checkedAt,\n teamId: null,\n enterpriseId: null,\n botId: null,\n userId: null,\n };\n }\n return {\n ok: true,\n health: \"healthy\",\n error: null,\n checkedAt,\n teamId: data.team_id ?? null,\n enterpriseId: data.enterprise_id ?? null,\n botId: data.bot_id ?? null,\n userId: data.user_id ?? null,\n };\n } catch {\n return {\n ok: false,\n health: \"degraded\",\n error: \"Slack auth test request failed\",\n checkedAt,\n teamId: null,\n enterpriseId: null,\n botId: null,\n userId: null,\n };\n }\n}\n\n/** Stable team/app key used by webhook payloads and the installation store. */\nexport function slackInstallationKey(input: {\n teamId?: string | null;\n enterpriseId?: string | null;\n apiAppId?: string | null;\n isEnterpriseInstall?: boolean;\n}): string {\n const workspaceId = input.isEnterpriseInstall\n ? input.enterpriseId\n : (input.teamId ?? input.enterpriseId);\n if (!workspaceId) {\n throw new Error(\"Slack OAuth did not return a team or enterprise id\");\n }\n return `${input.isEnterpriseInstall ? \"enterprise\" : \"team\"}:${workspaceId}:app:${input.apiAppId || \"default\"}`;\n}\n\n/**\n * Convert a successful Slack response to the generic managed-install input.\n * The returned token bundle is server-only and must be passed directly to the\n * encrypted installation store, never to a route response.\n */\nexport function slackOAuthResponseToInstallation(\n response: SlackOAuthAccessResponse,\n access: SlackInstallAccess,\n now = Date.now(),\n): UpsertIntegrationInstallationInput {\n if (!response.ok || !response.access_token) {\n throw new Error(\"Slack OAuth response did not include a bot access token\");\n }\n const installationKey = slackInstallationKey({\n teamId: response.team?.id,\n enterpriseId: response.enterprise?.id,\n apiAppId: response.app_id,\n isEnterpriseInstall: response.is_enterprise_install,\n });\n const expiresAt =\n typeof response.expires_in === \"number\" && response.expires_in > 0\n ? now + response.expires_in * 1000\n : undefined;\n return {\n platform: \"slack\",\n installationKey,\n teamId: response.team?.id ?? null,\n teamName: response.team?.name ?? null,\n enterpriseId: response.enterprise?.id ?? null,\n enterpriseName: response.enterprise?.name ?? null,\n isEnterpriseInstall: response.is_enterprise_install === true,\n apiAppId: response.app_id ?? null,\n botUserId: response.bot_user_id ?? null,\n scopes: response.scope?.split(\",\").map((scope) => scope.trim()) ?? [],\n installedByExternalUserId: response.authed_user?.id ?? null,\n ownerEmail: access.ownerEmail,\n orgId: access.orgId,\n secretScope: access.secretScope,\n secretScopeId: access.secretScopeId,\n tokenBundle: {\n accessToken: response.access_token,\n refreshToken: response.refresh_token,\n tokenType: response.token_type,\n expiresAt,\n },\n tokenExpiresAt: expiresAt ?? null,\n };\n}\n\n/**\n * Pure session/role gate for OAuth install routes. The caller must supply a\n * server-verified session; org membership must be the active org context.\n */\nexport function assertSlackInstallAccess(\n session: SlackInstallSession | null | undefined,\n): SlackInstallAccess {\n const ownerEmail = session?.email?.trim().toLowerCase();\n if (!ownerEmail) throw new Error(\"Sign in before connecting Slack.\");\n const orgId = session?.orgId?.trim() || null;\n if (!orgId) {\n return {\n ownerEmail,\n orgId: null,\n secretScope: \"user\",\n secretScopeId: ownerEmail,\n };\n }\n if (session?.orgRole !== \"owner\" && session?.orgRole !== \"admin\") {\n throw new Error(\"Only organization owners and admins can connect Slack.\");\n }\n return {\n ownerEmail,\n orgId,\n secretScope: \"org\",\n secretScopeId: orgId,\n };\n}\n"]}
|
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
import type { H3Event } from "h3";
|
|
2
|
+
import type { AgentChatEvent } from "../agent/types.js";
|
|
2
3
|
import type { EnvKeyConfig } from "../server/create-server.js";
|
|
4
|
+
export type IntegrationConversationType = "channel" | "private_channel" | "dm" | "group_dm" | "unknown";
|
|
5
|
+
export type IntegrationTriggerKind = "mention" | "dm" | "thread_reply";
|
|
6
|
+
export interface IntegrationActorTrust {
|
|
7
|
+
memberType: "owner" | "admin" | "member" | "guest" | "external" | "unknown";
|
|
8
|
+
verified: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface IntegrationContextMessage {
|
|
11
|
+
senderId?: string;
|
|
12
|
+
senderName?: string;
|
|
13
|
+
text: string;
|
|
14
|
+
timestamp: number;
|
|
15
|
+
sourceUrl?: string;
|
|
16
|
+
reactions?: Array<{
|
|
17
|
+
name: string;
|
|
18
|
+
count: number;
|
|
19
|
+
}>;
|
|
20
|
+
files?: IntegrationFileReference[];
|
|
21
|
+
}
|
|
22
|
+
export interface IntegrationFileReference {
|
|
23
|
+
id: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
mimetype?: string;
|
|
26
|
+
size?: number;
|
|
27
|
+
permalink?: string;
|
|
28
|
+
downloadUrl?: string;
|
|
29
|
+
}
|
|
3
30
|
/**
|
|
4
31
|
* Normalized incoming message from any messaging platform.
|
|
5
32
|
*/
|
|
@@ -16,6 +43,22 @@ export interface IncomingMessage {
|
|
|
16
43
|
senderEmail?: string;
|
|
17
44
|
/** Platform-specific sender ID */
|
|
18
45
|
senderId?: string;
|
|
46
|
+
/** How this message intentionally invoked an agent. */
|
|
47
|
+
triggerKind?: IntegrationTriggerKind;
|
|
48
|
+
/** Normalized provider conversation type for policy evaluation. */
|
|
49
|
+
conversationType?: IntegrationConversationType;
|
|
50
|
+
/** Provider tenant/workspace identifier. */
|
|
51
|
+
tenantId?: string;
|
|
52
|
+
/** Authorized integration scope resolved before execution. */
|
|
53
|
+
integrationScopeId?: string;
|
|
54
|
+
/** Normalized actor trust; unknown/unverified callers fail closed. */
|
|
55
|
+
actorTrust?: IntegrationActorTrust;
|
|
56
|
+
/** Bounded provider-native conversation context hydrated at run time. */
|
|
57
|
+
contextMessages?: IntegrationContextMessage[];
|
|
58
|
+
/** Provider file references only. Raw file bodies never belong here. */
|
|
59
|
+
files?: IntegrationFileReference[];
|
|
60
|
+
/** Server-verified approval grants carried by an interaction continuation. */
|
|
61
|
+
approvedToolCalls?: string[];
|
|
19
62
|
/**
|
|
20
63
|
* Whether the platform cryptographically authenticated that the message
|
|
21
64
|
* genuinely came from the claimed sender (e.g. inbound email that passed
|
|
@@ -29,6 +72,31 @@ export interface IncomingMessage {
|
|
|
29
72
|
senderVerified?: boolean;
|
|
30
73
|
/** Raw platform-specific context needed for routing responses */
|
|
31
74
|
platformContext: Record<string, unknown>;
|
|
75
|
+
/**
|
|
76
|
+
* Short-lived delivery context needed only while the queued task is active.
|
|
77
|
+
* Secrets such as Discord interaction tokens belong here, never in
|
|
78
|
+
* `platformContext`, thread mappings, logs, or agent-visible context.
|
|
79
|
+
*/
|
|
80
|
+
responseContext?: Record<string, unknown>;
|
|
81
|
+
/** Provider-native thread/topic reference, when one exists. */
|
|
82
|
+
threadRef?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Canonical provider URL for the originating message thread, when the
|
|
85
|
+
* provider can resolve one. This is safe agent-visible provenance (not a
|
|
86
|
+
* credential) and should be preserved across A2A delegation so created
|
|
87
|
+
* artifacts can link back to their request source.
|
|
88
|
+
*/
|
|
89
|
+
sourceUrl?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Trusted app-side routing guidance added after provider parsing. Adapters
|
|
92
|
+
* should not copy this from user-controlled webhook payload fields.
|
|
93
|
+
*/
|
|
94
|
+
routingHint?: {
|
|
95
|
+
targetAgent?: string;
|
|
96
|
+
instruction: string;
|
|
97
|
+
};
|
|
98
|
+
/** Provider-native message/activity reference for contextual replies. */
|
|
99
|
+
replyRef?: string;
|
|
32
100
|
/** Message timestamp (epoch ms) */
|
|
33
101
|
timestamp: number;
|
|
34
102
|
}
|
|
@@ -53,6 +121,10 @@ export interface OutboundTarget {
|
|
|
53
121
|
threadRef?: string | null;
|
|
54
122
|
/** Optional fallback display label */
|
|
55
123
|
label?: string;
|
|
124
|
+
/** Provider tenant/workspace used to select an installation credential. */
|
|
125
|
+
tenantId?: string;
|
|
126
|
+
/** Managed installation id when the caller already resolved it. */
|
|
127
|
+
installationId?: string;
|
|
56
128
|
}
|
|
57
129
|
/**
|
|
58
130
|
* Connection status for a platform integration.
|
|
@@ -76,6 +148,42 @@ export interface IntegrationStatus {
|
|
|
76
148
|
* frontend can render fields without hard-coding them per platform. */
|
|
77
149
|
requiredEnvKeys?: import("../server/create-server.js").EnvKeyConfig[];
|
|
78
150
|
}
|
|
151
|
+
export interface PlatformAdapterCapabilities {
|
|
152
|
+
/** The adapter can deliver a response to the current inbound event. */
|
|
153
|
+
replyText: boolean;
|
|
154
|
+
/** The adapter can send without an active inbound event. */
|
|
155
|
+
proactiveMessages: boolean;
|
|
156
|
+
/** The adapter preserves a provider-native thread or topic reference. */
|
|
157
|
+
nativeThreads: boolean;
|
|
158
|
+
/** The adapter can quote/reply to a specific inbound message. */
|
|
159
|
+
contextualReplies: boolean;
|
|
160
|
+
/** The provider requires an immediate deferred webhook acknowledgement. */
|
|
161
|
+
deferredWebhookResponse: boolean;
|
|
162
|
+
/** The adapter only receives explicit interactions, not ordinary messages. */
|
|
163
|
+
interactionOnly?: boolean;
|
|
164
|
+
/** The adapter can hydrate bounded native thread/file/reaction context. */
|
|
165
|
+
nativeContextHydration?: boolean;
|
|
166
|
+
/** The adapter can surface live agent progress in the provider UI. */
|
|
167
|
+
liveRunProgress?: boolean;
|
|
168
|
+
}
|
|
169
|
+
export interface PlatformRunProgress {
|
|
170
|
+
/** Receive normalized agent events. Implementations should throttle writes. */
|
|
171
|
+
onEvent(event: AgentChatEvent): Promise<void> | void;
|
|
172
|
+
/** Finalize the provider-native progress surface with the answer. */
|
|
173
|
+
complete(message: OutgoingMessage): Promise<void>;
|
|
174
|
+
/** Mark the provider-native surface failed and leave a retryable explanation. */
|
|
175
|
+
fail?(message: string): Promise<void>;
|
|
176
|
+
}
|
|
177
|
+
export interface ImmediateWebhookResponse {
|
|
178
|
+
status: number;
|
|
179
|
+
body: unknown;
|
|
180
|
+
}
|
|
181
|
+
export declare class UnsupportedPlatformCapabilityError extends Error {
|
|
182
|
+
readonly platform: string;
|
|
183
|
+
readonly capability: keyof PlatformAdapterCapabilities;
|
|
184
|
+
readonly code = "UNSUPPORTED_PLATFORM_CAPABILITY";
|
|
185
|
+
constructor(platform: string, capability: keyof PlatformAdapterCapabilities);
|
|
186
|
+
}
|
|
79
187
|
/**
|
|
80
188
|
* Platform adapter interface — implement this for each messaging platform.
|
|
81
189
|
*
|
|
@@ -90,6 +198,8 @@ export interface PlatformAdapter {
|
|
|
90
198
|
readonly platform: string;
|
|
91
199
|
/** Human-readable label */
|
|
92
200
|
readonly label: string;
|
|
201
|
+
/** Explicit runtime behavior. Missing fields are treated as unsupported. */
|
|
202
|
+
readonly capabilities?: Partial<PlatformAdapterCapabilities>;
|
|
93
203
|
/** Env keys this adapter needs (tokens, secrets, etc.) */
|
|
94
204
|
getRequiredEnvKeys(): EnvKeyConfig[];
|
|
95
205
|
/**
|
|
@@ -111,6 +221,24 @@ export interface PlatformAdapter {
|
|
|
111
221
|
* Return null to silently ignore the event (bot messages, edits, etc.).
|
|
112
222
|
*/
|
|
113
223
|
parseIncomingMessage(event: H3Event): Promise<IncomingMessage | null>;
|
|
224
|
+
/**
|
|
225
|
+
* Hydrate bounded provider-native context after durable enqueue, outside the
|
|
226
|
+
* provider acknowledgement budget. Implementations must return references,
|
|
227
|
+
* metadata, and text only — never persist file bodies or credentials.
|
|
228
|
+
*/
|
|
229
|
+
hydrateIncomingMessage?(incoming: IncomingMessage): Promise<IncomingMessage>;
|
|
230
|
+
/**
|
|
231
|
+
* Provider-specific response returned only after a message is verified and
|
|
232
|
+
* durably enqueued. Discord uses this to return a type-5 deferred response
|
|
233
|
+
* within its three-second interaction deadline.
|
|
234
|
+
*/
|
|
235
|
+
getImmediateWebhookResponse?(incoming: IncomingMessage): ImmediateWebhookResponse | null;
|
|
236
|
+
/**
|
|
237
|
+
* Return pre-canonical thread ids used by older adapter versions. The
|
|
238
|
+
* integration handler checks these only when the canonical mapping is
|
|
239
|
+
* missing, then aliases a match to the canonical id without forking history.
|
|
240
|
+
*/
|
|
241
|
+
getLegacyExternalThreadIds?(incoming: IncomingMessage): string[];
|
|
114
242
|
/**
|
|
115
243
|
* Send the agent's response back to the messaging platform.
|
|
116
244
|
*
|
|
@@ -135,6 +263,8 @@ export interface PlatformAdapter {
|
|
|
135
263
|
postProcessingPlaceholder?(incoming: IncomingMessage): Promise<{
|
|
136
264
|
placeholderRef: string;
|
|
137
265
|
} | null>;
|
|
266
|
+
/** Start a provider-native progress/streaming surface for an agent run. */
|
|
267
|
+
startRunProgress?(incoming: IncomingMessage): Promise<PlatformRunProgress | null>;
|
|
138
268
|
/**
|
|
139
269
|
* Send a proactive outbound message to a platform destination. Adapters that
|
|
140
270
|
* only support direct replies can omit this.
|
|
@@ -155,6 +285,7 @@ export interface PlatformAdapter {
|
|
|
155
285
|
/** Return current connection/configuration status for the settings UI. */
|
|
156
286
|
getStatus(baseUrl?: string): Promise<IntegrationStatus>;
|
|
157
287
|
}
|
|
288
|
+
export declare function assertPlatformCapability(adapter: PlatformAdapter, capability: keyof PlatformAdapterCapabilities): void;
|
|
158
289
|
/**
|
|
159
290
|
* Options for the integrations plugin.
|
|
160
291
|
*/
|
|
@@ -181,6 +312,12 @@ export interface IntegrationsPluginOptions {
|
|
|
181
312
|
* created chat thread for an incoming platform message.
|
|
182
313
|
*/
|
|
183
314
|
resolveOwner?: (incoming: IncomingMessage) => string | Promise<string>;
|
|
315
|
+
/**
|
|
316
|
+
* Resolve the durable execution principal for an inbound provider message.
|
|
317
|
+
* Shared channels should use a service principal; DMs may use a verified
|
|
318
|
+
* linked user. When present this supersedes `resolveOwner`.
|
|
319
|
+
*/
|
|
320
|
+
resolveExecutionContext?: (incoming: IncomingMessage) => IntegrationExecutionContext | Promise<IntegrationExecutionContext>;
|
|
184
321
|
/**
|
|
185
322
|
* Optional preprocessor for inbound platform messages. Can intercept special
|
|
186
323
|
* commands (such as `/link`) before the agent loop runs.
|
|
@@ -192,4 +329,11 @@ export interface IntegrationsPluginOptions {
|
|
|
192
329
|
handled: false;
|
|
193
330
|
}>;
|
|
194
331
|
}
|
|
332
|
+
export interface IntegrationExecutionContext {
|
|
333
|
+
ownerEmail: string;
|
|
334
|
+
orgId: string | null;
|
|
335
|
+
principalType: "user" | "service";
|
|
336
|
+
installationId?: string;
|
|
337
|
+
scopeId?: string;
|
|
338
|
+
}
|
|
195
339
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/integrations/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAElC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,gBAAgB,EAAE,MAAM,CAAC;IACzB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iEAAiE;IACjE,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;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CAAC;IACvE;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,CACxB,QAAQ,EAAE,eAAe,KACtB,2BAA2B,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACxE;;;OAGG;IACH,aAAa,CAAC,EAAE,CACd,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,eAAe,KACrB,OAAO,CACR;QACE,OAAO,EAAE,IAAI,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GACD;QAAE,OAAO,EAAE,KAAK,CAAA;KAAE,CACrB,CAAC;CACH;AAED,MAAM,WAAW,2BAA2B;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export class UnsupportedPlatformCapabilityError extends Error {
|
|
2
|
+
platform;
|
|
3
|
+
capability;
|
|
4
|
+
code = "UNSUPPORTED_PLATFORM_CAPABILITY";
|
|
5
|
+
constructor(platform, capability) {
|
|
6
|
+
super(`Platform ${platform} does not support ${capability}`);
|
|
7
|
+
this.platform = platform;
|
|
8
|
+
this.capability = capability;
|
|
9
|
+
this.name = "UnsupportedPlatformCapabilityError";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function assertPlatformCapability(adapter, capability) {
|
|
13
|
+
if (adapter.capabilities?.[capability] !== true) {
|
|
14
|
+
throw new UnsupportedPlatformCapabilityError(adapter.platform, capability);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
2
17
|
//# sourceMappingURL=types.js.map
|