@agent-native/core 0.111.4 → 0.113.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 +4 -2
- package/corpus/core/CHANGELOG.md +34 -0
- package/corpus/core/docs/AGENTS.md +7 -0
- package/corpus/core/docs/content/integrations.mdx +63 -2
- package/corpus/core/docs/design/provider-integration-authority.md +117 -0
- package/corpus/core/package.json +8 -1
- package/corpus/core/scripts/materialize-source-corpus.mjs +9 -2
- package/corpus/core/src/cli/atomic-json-file.ts +324 -0
- package/corpus/core/src/cli/claude-code-participant.ts +515 -0
- package/corpus/core/src/cli/code-agent-executor.ts +35 -15
- package/corpus/core/src/cli/code-agent-runs.concurrent-worker.ts +33 -0
- package/corpus/core/src/cli/code-agent-runs.ts +70 -36
- package/corpus/core/src/cli/codex-cli-participant.ts +496 -0
- package/corpus/core/src/cli/multi-frontier-runs.ts +1952 -0
- package/corpus/core/src/client/chat/ChatHistoryList.tsx +7 -404
- package/corpus/core/src/coding-tools/index.ts +27 -8
- package/corpus/core/src/embeddings/index.ts +233 -0
- package/corpus/core/src/index.ts +2 -0
- package/corpus/core/src/integrations/index.ts +10 -0
- package/corpus/core/src/integrations/slack-oauth.ts +1 -0
- package/corpus/core/src/integrations/webhook-delivery.ts +55 -0
- package/corpus/core/src/notifications/channels.ts +4 -10
- package/corpus/core/src/provider-api/actions/custom-provider-registration.ts +197 -0
- package/corpus/core/src/provider-api/actions/delete-staged-dataset.ts +3 -42
- package/corpus/core/src/provider-api/actions/list-staged-datasets.ts +3 -45
- package/corpus/core/src/provider-api/actions/provider-api-audit.ts +88 -0
- package/corpus/core/src/provider-api/actions/provider-api.ts +460 -0
- package/corpus/core/src/provider-api/actions/query-staged-dataset.ts +3 -140
- package/corpus/core/src/provider-api/actions/staged-datasets.ts +359 -0
- package/corpus/core/src/provider-api/gong.ts +108 -0
- package/corpus/core/src/scripts/docs/source-search.ts +2 -1
- package/corpus/core/src/search/index.ts +413 -0
- package/corpus/core/src/server/google-oauth-credentials.ts +80 -3
- package/corpus/core/src/server/index.ts +6 -0
- package/corpus/core/src/styles/chat-history-list.css +1 -313
- package/corpus/core/src/templates/default/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/core/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/corpus/core/src/templates/default/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/core/src/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/corpus/core/src/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
- package/corpus/core/src/templates/default/.agents/skills/secrets/SKILL.md +273 -0
- package/corpus/core/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/core/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/core/src/templates/default/AGENTS.md +25 -18
- package/corpus/core/src/templates/headless/.agents/skills/actions/SKILL.md +512 -0
- package/corpus/core/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/corpus/core/src/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/core/src/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/corpus/core/src/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
- package/corpus/core/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/core/src/templates/headless/AGENTS.md +7 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/core/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/core/src/templates/workspace-core/AGENTS.md +4 -0
- package/corpus/core/src/templates/workspace-root/AGENTS.md +4 -0
- package/corpus/templates/analytics/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/analytics/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/analytics/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/analytics/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/analytics/actions/delete-staged-dataset.ts +3 -23
- package/corpus/templates/analytics/actions/list-staged-datasets.ts +3 -27
- package/corpus/templates/analytics/actions/provider-api-catalog.ts +16 -19
- package/corpus/templates/analytics/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/analytics/actions/provider-api-request.ts +162 -185
- package/corpus/templates/analytics/actions/query-staged-dataset.ts +3 -47
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +52 -161
- package/corpus/templates/assets/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/assets/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/assets/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/assets/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +63 -160
- package/corpus/templates/brain/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/brain/.agents/skills/brain/RUNBOOK.md +48 -5
- package/corpus/templates/brain/.agents/skills/brain/SKILL.md +46 -14
- package/corpus/templates/brain/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/brain/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/brain/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/brain/README.md +34 -3
- package/corpus/templates/brain/actions/_schemas.ts +13 -7
- package/corpus/templates/brain/actions/approve-proposal.ts +2 -0
- package/corpus/templates/brain/actions/claim-distillation.ts +24 -27
- package/corpus/templates/brain/actions/create-source.ts +1 -1
- package/corpus/templates/brain/actions/delete-staged-dataset.ts +3 -24
- package/corpus/templates/brain/actions/get-knowledge.ts +6 -2
- package/corpus/templates/brain/actions/get-pilot-report.ts +44 -8
- package/corpus/templates/brain/actions/import-capture.ts +21 -9
- package/corpus/templates/brain/actions/import-transcript.ts +42 -14
- package/corpus/templates/brain/actions/list-captures.ts +10 -1
- package/corpus/templates/brain/actions/list-distillation-queue.ts +39 -14
- package/corpus/templates/brain/actions/list-projects.ts +51 -0
- package/corpus/templates/brain/actions/list-proposals.ts +80 -4
- package/corpus/templates/brain/actions/list-sources.ts +17 -3
- package/corpus/templates/brain/actions/list-staged-datasets.ts +3 -28
- package/corpus/templates/brain/actions/manage-project.ts +118 -0
- package/corpus/templates/brain/actions/mark-capture-distilled.ts +68 -20
- package/corpus/templates/brain/actions/navigate.ts +1 -0
- package/corpus/templates/brain/actions/provider-api-catalog.ts +5 -11
- package/corpus/templates/brain/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/brain/actions/provider-api-request.ts +3 -37
- package/corpus/templates/brain/actions/query-staged-dataset.ts +3 -48
- package/corpus/templates/brain/actions/reject-proposal.ts +6 -1
- package/corpus/templates/brain/actions/resanitize-captures.ts +159 -33
- package/corpus/templates/brain/actions/review-proposal.ts +2 -0
- package/corpus/templates/brain/actions/search-everything.ts +10 -1
- package/corpus/templates/brain/actions/search-knowledge.ts +1 -1
- package/corpus/templates/brain/actions/set-settings.ts +36 -1
- package/corpus/templates/brain/actions/update-proposal.ts +2 -0
- package/corpus/templates/brain/actions/update-source.ts +5 -1
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +48 -154
- package/corpus/templates/brain/app/hooks/use-distillation-bridge.ts +18 -9
- package/corpus/templates/brain/app/hooks/use-navigation-state.ts +3 -0
- package/corpus/templates/brain/app/i18n-data.ts +731 -2
- package/corpus/templates/brain/app/lib/brain.ts +88 -1
- package/corpus/templates/brain/app/lib/ingest-handoff.ts +35 -0
- package/corpus/templates/brain/app/routes/ops.tsx +47 -0
- package/corpus/templates/brain/app/routes/review.tsx +41 -2
- package/corpus/templates/brain/app/routes/search.tsx +33 -2
- package/corpus/templates/brain/app/routes/settings.tsx +158 -0
- package/corpus/templates/brain/app/routes/sources.tsx +31 -0
- package/corpus/templates/brain/changelog/2026-07-19-added-private-source-safe-semantic-search.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-can-now-join-configured-public-channels-befo.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-now-continue-across-the-configured-number-of.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-now-start-with-a-safe-four-week-window-and-r.md +6 -0
- package/corpus/templates/brain/jobs/process-ingest-queue.ts +270 -36
- package/corpus/templates/brain/package.json +1 -0
- package/corpus/templates/brain/server/db/index.ts +18 -0
- package/corpus/templates/brain/server/db/schema.ts +197 -1
- package/corpus/templates/brain/server/jobs/distillation-queue.ts +12 -5
- package/corpus/templates/brain/server/lib/audiences.ts +708 -0
- package/corpus/templates/brain/server/lib/brain-health.ts +251 -38
- package/corpus/templates/brain/server/lib/brain.ts +877 -50
- package/corpus/templates/brain/server/lib/capture-sanitization.ts +217 -53
- package/corpus/templates/brain/server/lib/connectors.ts +609 -72
- package/corpus/templates/brain/server/lib/demo.ts +17 -4
- package/corpus/templates/brain/server/lib/hybrid-search.ts +363 -0
- package/corpus/templates/brain/server/lib/ingest-queue.ts +104 -0
- package/corpus/templates/brain/server/lib/privacy-readiness.ts +24 -0
- package/corpus/templates/brain/server/lib/search-index-contracts.ts +72 -0
- package/corpus/templates/brain/server/lib/search-index.ts +714 -0
- package/corpus/templates/brain/server/lib/search.ts +120 -4
- package/corpus/templates/brain/server/lib/sensitivity-policy.ts +174 -0
- package/corpus/templates/brain/server/lib/slack-channel-membership.ts +44 -0
- package/corpus/templates/brain/server/lib/slack-events.ts +281 -0
- package/corpus/templates/brain/server/onboarding.ts +29 -0
- package/corpus/templates/brain/server/plugins/db.ts +204 -0
- package/corpus/templates/brain/server/register-secrets.ts +46 -0
- package/corpus/templates/brain/server/routes/api/_agent-native/brain/ingest.post.ts +36 -16
- package/corpus/templates/brain/server/routes/api/_agent-native/brain/slack-events.post.ts +28 -0
- package/corpus/templates/brain/shared/slack-source-config.ts +60 -0
- package/corpus/templates/brain/shared/types.ts +10 -0
- package/corpus/templates/calendar/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/calendar/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/calendar/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/calendar/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/calendar/actions/delete-staged-dataset.ts +3 -24
- package/corpus/templates/calendar/actions/list-staged-datasets.ts +3 -28
- package/corpus/templates/calendar/actions/provider-api-catalog.ts +5 -11
- package/corpus/templates/calendar/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/calendar/actions/provider-api-request.ts +3 -37
- package/corpus/templates/calendar/actions/query-staged-dataset.ts +3 -48
- package/corpus/templates/calendar/server/handlers/gong.ts +6 -61
- package/corpus/templates/calendar/server/handlers/google-auth.ts +10 -8
- package/corpus/templates/calendar/server/lib/google-calendar.ts +7 -45
- package/corpus/templates/chat/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/chat/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/corpus/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/chat/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/chat/AGENTS.md +5 -2
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +51 -157
- package/corpus/templates/clips/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/clips/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/clips/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/clips/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/clips/AGENTS.md +11 -0
- package/corpus/templates/clips/actions/export-to-brain.ts +505 -171
- package/corpus/templates/clips/changelog/2026-07-19-ready-clips-transcripts-can-be-backfilled-to-brain-for-a-bou.md +6 -0
- package/corpus/templates/clips/server/lib/calendar-event-meetings.ts +1 -1
- package/corpus/templates/clips/server/lib/google-calendar-client.ts +12 -22
- package/corpus/templates/clips/server/lib/google-calendar-oauth.ts +9 -6
- package/corpus/templates/clips/server/lib/slack-oauth.ts +12 -47
- package/corpus/templates/clips/server/routes/_agent-native/google/auth-url.get.ts +2 -6
- package/corpus/templates/clips/server/routes/api/auth/google-calendar.get.ts +4 -4
- package/corpus/templates/content/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/content/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/content/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/content/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/content/actions/delete-staged-dataset.ts +3 -24
- package/corpus/templates/content/actions/list-staged-datasets.ts +3 -28
- package/corpus/templates/content/actions/provider-api-catalog.ts +5 -11
- package/corpus/templates/content/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/content/actions/provider-api-request.ts +3 -37
- package/corpus/templates/content/actions/query-staged-dataset.ts +3 -48
- package/corpus/templates/design/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/design/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/design/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/design/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/design/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/design/actions/list-staged-datasets.ts +4 -27
- package/corpus/templates/design/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/design/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/design/actions/provider-api-request.ts +140 -164
- package/corpus/templates/design/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/dispatch/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/dispatch/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/dispatch/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/dispatch/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/dispatch/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/dispatch/actions/list-staged-datasets.ts +4 -30
- package/corpus/templates/dispatch/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/dispatch/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/dispatch/actions/provider-api-request.ts +138 -163
- package/corpus/templates/dispatch/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/forms/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/forms/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/forms/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/forms/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/forms/server/lib/integrations.ts +23 -22
- package/corpus/templates/macros/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/macros/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/mail/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/mail/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/mail/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/mail/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/mail/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/mail/actions/list-staged-datasets.ts +4 -27
- package/corpus/templates/mail/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/mail/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/mail/actions/provider-api-request.ts +146 -173
- package/corpus/templates/mail/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/mail/server/handlers/gong.ts +6 -61
- package/corpus/templates/mail/server/lib/google-auth.ts +10 -13
- package/corpus/templates/plan/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/plan/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/plan/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/plan/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +47 -156
- package/corpus/templates/slides/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/slides/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/slides/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/slides/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/slides/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/slides/actions/list-staged-datasets.ts +4 -27
- package/corpus/templates/slides/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/slides/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/slides/actions/provider-api-request.ts +145 -172
- package/corpus/templates/slides/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/slides/server/lib/google-docs-oauth.ts +11 -36
- package/corpus/templates/tasks/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/tasks/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/corpus/templates/tasks/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/tasks/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/tasks/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/toolkit/CHANGELOG.md +125 -0
- package/corpus/toolkit/README.md +60 -0
- package/corpus/toolkit/export-snapshot.json +35 -0
- package/corpus/toolkit/migration-manifest.json +4 -0
- package/corpus/toolkit/package.json +281 -0
- package/corpus/toolkit/scripts/finalize-build.mjs +55 -0
- package/corpus/toolkit/src/app-shell/header-actions.tsx +84 -0
- package/corpus/toolkit/src/app-shell/index.ts +1 -0
- package/corpus/toolkit/src/chat-history/ChatHistoryList.tsx +469 -0
- package/corpus/toolkit/src/chat-history/index.ts +7 -0
- package/corpus/toolkit/src/chat-history.css +314 -0
- package/corpus/toolkit/src/collab-ui/AgentPresenceChip.tsx +69 -0
- package/corpus/toolkit/src/collab-ui/LiveCursorOverlay.tsx +241 -0
- package/corpus/toolkit/src/collab-ui/PresenceBar.tsx +346 -0
- package/corpus/toolkit/src/collab-ui/RecentEditHighlights.tsx +225 -0
- package/corpus/toolkit/src/collab-ui/RemoteSelectionRings.tsx +227 -0
- package/corpus/toolkit/src/collab-ui/agent-identity.ts +16 -0
- package/corpus/toolkit/src/collab-ui/index.ts +39 -0
- package/corpus/toolkit/src/collab-ui/lead-client.ts +32 -0
- package/corpus/toolkit/src/collab-ui/types.ts +96 -0
- package/corpus/toolkit/src/composer/AgentComposerFrame.tsx +59 -0
- package/corpus/toolkit/src/composer/ComposerPlusMenu.tsx +983 -0
- package/corpus/toolkit/src/composer/MentionPopover.tsx +412 -0
- package/corpus/toolkit/src/composer/PastedTextChip.tsx +150 -0
- package/corpus/toolkit/src/composer/PromptComposer.tsx +718 -0
- package/corpus/toolkit/src/composer/RealtimeVoiceMode.tsx +856 -0
- package/corpus/toolkit/src/composer/TiptapComposer.tsx +2936 -0
- package/corpus/toolkit/src/composer/VoiceButton.tsx +255 -0
- package/corpus/toolkit/src/composer/asset-picker-url.ts +80 -0
- package/corpus/toolkit/src/composer/attachment-accept.ts +71 -0
- package/corpus/toolkit/src/composer/draft-key.ts +7 -0
- package/corpus/toolkit/src/composer/extensions/FileReference.tsx +55 -0
- package/corpus/toolkit/src/composer/extensions/MentionReference.tsx +93 -0
- package/corpus/toolkit/src/composer/extensions/SkillReference.tsx +56 -0
- package/corpus/toolkit/src/composer/index.ts +79 -0
- package/corpus/toolkit/src/composer/pasted-text.ts +160 -0
- package/corpus/toolkit/src/composer/prompt-attachments.ts +93 -0
- package/corpus/toolkit/src/composer/realtime-voice-audio-level.ts +64 -0
- package/corpus/toolkit/src/composer/realtime-voice-transcript.ts +134 -0
- package/corpus/toolkit/src/composer/runtime-adapters.tsx +343 -0
- package/corpus/toolkit/src/composer/types.ts +66 -0
- package/corpus/toolkit/src/composer/use-file-search.ts +64 -0
- package/corpus/toolkit/src/composer/use-mention-search.ts +90 -0
- package/corpus/toolkit/src/composer/use-skills.ts +45 -0
- package/corpus/toolkit/src/composer/useRealtimeVoiceMode.tsx +2117 -0
- package/corpus/toolkit/src/composer/useVoiceDictation.ts +1191 -0
- package/corpus/toolkit/src/context-ui/ContextMeter.tsx +101 -0
- package/corpus/toolkit/src/context-ui/ContextSegmentRow.tsx +184 -0
- package/corpus/toolkit/src/context-ui/ContextTreemap.tsx +125 -0
- package/corpus/toolkit/src/context-ui/ContextXRayPanel.tsx +377 -0
- package/corpus/toolkit/src/context-ui/format.ts +42 -0
- package/corpus/toolkit/src/context-ui/index.ts +15 -0
- package/corpus/toolkit/src/context-ui/types.ts +43 -0
- package/corpus/toolkit/src/design-tweaks/index.ts +1 -0
- package/corpus/toolkit/src/design-tweaks/visual-style-controls.tsx +1084 -0
- package/corpus/toolkit/src/editor/BubbleToolbar.tsx +253 -0
- package/corpus/toolkit/src/editor/CodeBlockNode.tsx +254 -0
- package/corpus/toolkit/src/editor/DragHandle.ts +1437 -0
- package/corpus/toolkit/src/editor/ImageExtension.ts +306 -0
- package/corpus/toolkit/src/editor/RegistryBlockContext.tsx +107 -0
- package/corpus/toolkit/src/editor/RegistryBlockNode.tsx +652 -0
- package/corpus/toolkit/src/editor/RichMarkdownEditor.tsx +81 -0
- package/corpus/toolkit/src/editor/RunId.ts +61 -0
- package/corpus/toolkit/src/editor/SharedRichEditor.tsx +321 -0
- package/corpus/toolkit/src/editor/SlashCommandMenu.tsx +310 -0
- package/corpus/toolkit/src/editor/extensions.ts +402 -0
- package/corpus/toolkit/src/editor/gfmDoc.ts +92 -0
- package/corpus/toolkit/src/editor/index.ts +93 -0
- package/corpus/toolkit/src/editor/registrySlashCommands.ts +131 -0
- package/corpus/toolkit/src/editor/surgical-apply.ts +192 -0
- package/corpus/toolkit/src/editor/useCollabReconcile.ts +589 -0
- package/corpus/toolkit/src/editor.css +510 -0
- package/corpus/toolkit/src/hooks/index.ts +2 -0
- package/corpus/toolkit/src/hooks/use-mobile.tsx +21 -0
- package/corpus/toolkit/src/hooks/use-toast.ts +188 -0
- package/corpus/toolkit/src/index.ts +8 -0
- package/corpus/toolkit/src/onboarding/index.ts +1 -0
- package/corpus/toolkit/src/provider.tsx +47 -0
- package/corpus/toolkit/src/sharing/VisibilityBadge.tsx +37 -0
- package/corpus/toolkit/src/sharing/index.ts +4 -0
- package/corpus/toolkit/src/styles.css +21 -0
- package/corpus/toolkit/src/ui/accordion.tsx +56 -0
- package/corpus/toolkit/src/ui/alert-dialog.tsx +141 -0
- package/corpus/toolkit/src/ui/alert.tsx +59 -0
- package/corpus/toolkit/src/ui/aspect-ratio.tsx +5 -0
- package/corpus/toolkit/src/ui/avatar.tsx +48 -0
- package/corpus/toolkit/src/ui/badge.tsx +37 -0
- package/corpus/toolkit/src/ui/breadcrumb.tsx +115 -0
- package/corpus/toolkit/src/ui/button.tsx +78 -0
- package/corpus/toolkit/src/ui/calendar.tsx +214 -0
- package/corpus/toolkit/src/ui/card.tsx +86 -0
- package/corpus/toolkit/src/ui/carousel.tsx +260 -0
- package/corpus/toolkit/src/ui/chart.tsx +375 -0
- package/corpus/toolkit/src/ui/checkbox.tsx +28 -0
- package/corpus/toolkit/src/ui/collapsible.tsx +9 -0
- package/corpus/toolkit/src/ui/command.tsx +174 -0
- package/corpus/toolkit/src/ui/context-menu.tsx +202 -0
- package/corpus/toolkit/src/ui/date-picker.tsx +64 -0
- package/corpus/toolkit/src/ui/dialog.tsx +146 -0
- package/corpus/toolkit/src/ui/drawer.tsx +126 -0
- package/corpus/toolkit/src/ui/dropdown-menu.tsx +218 -0
- package/corpus/toolkit/src/ui/form.tsx +177 -0
- package/corpus/toolkit/src/ui/hover-card.tsx +27 -0
- package/corpus/toolkit/src/ui/index.ts +52 -0
- package/corpus/toolkit/src/ui/input-otp.tsx +69 -0
- package/corpus/toolkit/src/ui/input.tsx +22 -0
- package/corpus/toolkit/src/ui/label.tsx +24 -0
- package/corpus/toolkit/src/ui/logo.tsx +36 -0
- package/corpus/toolkit/src/ui/menubar.tsx +235 -0
- package/corpus/toolkit/src/ui/navigation-menu.tsx +128 -0
- package/corpus/toolkit/src/ui/pagination.tsx +121 -0
- package/corpus/toolkit/src/ui/popover.tsx +44 -0
- package/corpus/toolkit/src/ui/progress.tsx +26 -0
- package/corpus/toolkit/src/ui/radio-group.tsx +42 -0
- package/corpus/toolkit/src/ui/resizable.tsx +43 -0
- package/corpus/toolkit/src/ui/scroll-area.tsx +46 -0
- package/corpus/toolkit/src/ui/select.tsx +158 -0
- package/corpus/toolkit/src/ui/separator.tsx +29 -0
- package/corpus/toolkit/src/ui/sheet.tsx +160 -0
- package/corpus/toolkit/src/ui/sidebar.tsx +777 -0
- package/corpus/toolkit/src/ui/skeleton.tsx +18 -0
- package/corpus/toolkit/src/ui/slider.tsx +26 -0
- package/corpus/toolkit/src/ui/sonner.tsx +58 -0
- package/corpus/toolkit/src/ui/spinner.tsx +17 -0
- package/corpus/toolkit/src/ui/switch.tsx +27 -0
- package/corpus/toolkit/src/ui/table.tsx +117 -0
- package/corpus/toolkit/src/ui/tabs.tsx +53 -0
- package/corpus/toolkit/src/ui/textarea.tsx +23 -0
- package/corpus/toolkit/src/ui/toast.tsx +127 -0
- package/corpus/toolkit/src/ui/toaster.tsx +33 -0
- package/corpus/toolkit/src/ui/toggle-group.tsx +59 -0
- package/corpus/toolkit/src/ui/toggle.tsx +43 -0
- package/corpus/toolkit/src/ui/tooltip.tsx +53 -0
- package/corpus/toolkit/src/ui/use-toast.ts +3 -0
- package/corpus/toolkit/src/utils.ts +8 -0
- package/corpus/toolkit/tsconfig.json +23 -0
- package/dist/cli/atomic-json-file.d.ts +30 -0
- package/dist/cli/atomic-json-file.d.ts.map +1 -0
- package/dist/cli/atomic-json-file.js +240 -0
- package/dist/cli/atomic-json-file.js.map +1 -0
- package/dist/cli/claude-code-participant.d.ts +77 -0
- package/dist/cli/claude-code-participant.d.ts.map +1 -0
- package/dist/cli/claude-code-participant.js +355 -0
- package/dist/cli/claude-code-participant.js.map +1 -0
- package/dist/cli/code-agent-executor.d.ts +8 -9
- package/dist/cli/code-agent-executor.d.ts.map +1 -1
- package/dist/cli/code-agent-executor.js +27 -13
- package/dist/cli/code-agent-executor.js.map +1 -1
- package/dist/cli/code-agent-runs.concurrent-worker.d.ts +2 -0
- package/dist/cli/code-agent-runs.concurrent-worker.d.ts.map +1 -0
- package/dist/cli/code-agent-runs.concurrent-worker.js +32 -0
- package/dist/cli/code-agent-runs.concurrent-worker.js.map +1 -0
- package/dist/cli/code-agent-runs.d.ts +5 -0
- package/dist/cli/code-agent-runs.d.ts.map +1 -1
- package/dist/cli/code-agent-runs.js +51 -33
- package/dist/cli/code-agent-runs.js.map +1 -1
- package/dist/cli/codex-cli-participant.d.ts +77 -0
- package/dist/cli/codex-cli-participant.d.ts.map +1 -0
- package/dist/cli/codex-cli-participant.js +354 -0
- package/dist/cli/codex-cli-participant.js.map +1 -0
- package/dist/cli/multi-frontier-runs.d.ts +246 -0
- package/dist/cli/multi-frontier-runs.d.ts.map +1 -0
- package/dist/cli/multi-frontier-runs.js +1247 -0
- package/dist/cli/multi-frontier-runs.js.map +1 -0
- package/dist/client/chat/ChatHistoryList.d.ts +1 -87
- package/dist/client/chat/ChatHistoryList.d.ts.map +1 -1
- package/dist/client/chat/ChatHistoryList.js +1 -82
- package/dist/client/chat/ChatHistoryList.js.map +1 -1
- package/dist/coding-tools/index.d.ts +1 -0
- package/dist/coding-tools/index.d.ts.map +1 -1
- package/dist/coding-tools/index.js +25 -7
- package/dist/coding-tools/index.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/embeddings/index.d.ts +24 -0
- package/dist/embeddings/index.d.ts.map +1 -0
- package/dist/embeddings/index.js +172 -0
- package/dist/embeddings/index.js.map +1 -0
- 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/index.d.ts +2 -1
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +2 -1
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/slack-manifest.d.ts +1 -1
- package/dist/integrations/slack-oauth.d.ts +1 -1
- package/dist/integrations/slack-oauth.d.ts.map +1 -1
- package/dist/integrations/slack-oauth.js +1 -0
- package/dist/integrations/slack-oauth.js.map +1 -1
- package/dist/integrations/webhook-delivery.d.ts +23 -0
- package/dist/integrations/webhook-delivery.d.ts.map +1 -0
- package/dist/integrations/webhook-delivery.js +32 -0
- package/dist/integrations/webhook-delivery.js.map +1 -0
- package/dist/notifications/channels.d.ts.map +1 -1
- package/dist/notifications/channels.js +4 -9
- package/dist/notifications/channels.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +136 -0
- package/dist/provider-api/actions/custom-provider-registration.d.ts.map +1 -0
- package/dist/provider-api/actions/custom-provider-registration.js +154 -0
- package/dist/provider-api/actions/custom-provider-registration.js.map +1 -0
- package/dist/provider-api/actions/delete-staged-dataset.d.ts +1 -1
- package/dist/provider-api/actions/delete-staged-dataset.d.ts.map +1 -1
- package/dist/provider-api/actions/delete-staged-dataset.js +3 -34
- package/dist/provider-api/actions/delete-staged-dataset.js.map +1 -1
- package/dist/provider-api/actions/list-staged-datasets.d.ts +2 -3
- package/dist/provider-api/actions/list-staged-datasets.d.ts.map +1 -1
- package/dist/provider-api/actions/list-staged-datasets.js +3 -40
- package/dist/provider-api/actions/list-staged-datasets.js.map +1 -1
- package/dist/provider-api/actions/provider-api-audit.d.ts +7 -0
- package/dist/provider-api/actions/provider-api-audit.d.ts.map +1 -0
- package/dist/provider-api/actions/provider-api-audit.js +74 -0
- package/dist/provider-api/actions/provider-api-audit.js.map +1 -0
- package/dist/provider-api/actions/provider-api.d.ts +370 -0
- package/dist/provider-api/actions/provider-api.d.ts.map +1 -0
- package/dist/provider-api/actions/provider-api.js +280 -0
- package/dist/provider-api/actions/provider-api.js.map +1 -0
- package/dist/provider-api/actions/query-staged-dataset.d.ts +1 -1
- package/dist/provider-api/actions/query-staged-dataset.d.ts.map +1 -1
- package/dist/provider-api/actions/query-staged-dataset.js +3 -116
- package/dist/provider-api/actions/query-staged-dataset.js.map +1 -1
- package/dist/provider-api/actions/staged-datasets.d.ts +190 -0
- package/dist/provider-api/actions/staged-datasets.d.ts.map +1 -0
- package/dist/provider-api/actions/staged-datasets.js +210 -0
- package/dist/provider-api/actions/staged-datasets.js.map +1 -0
- package/dist/provider-api/gong.d.ts +44 -0
- package/dist/provider-api/gong.d.ts.map +1 -0
- package/dist/provider-api/gong.js +56 -0
- package/dist/provider-api/gong.js.map +1 -0
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/scripts/docs/source-search.d.ts +2 -1
- package/dist/scripts/docs/source-search.d.ts.map +1 -1
- package/dist/scripts/docs/source-search.js +2 -1
- package/dist/scripts/docs/source-search.js.map +1 -1
- package/dist/search/index.d.ts +88 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +267 -0
- package/dist/search/index.js.map +1 -0
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/google-oauth-credentials.d.ts +35 -0
- package/dist/server/google-oauth-credentials.d.ts.map +1 -1
- package/dist/server/google-oauth-credentials.js +48 -2
- package/dist/server/google-oauth-credentials.js.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/styles/chat-history-list.css +1 -313
- package/dist/templates/chat/.agents/skills/actions/SKILL.md +32 -12
- package/dist/templates/chat/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/dist/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/dist/templates/chat/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/dist/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/chat/AGENTS.md +5 -2
- package/dist/templates/chat/app/components/layout/Sidebar.tsx +51 -157
- package/dist/templates/default/.agents/skills/actions/SKILL.md +32 -12
- package/dist/templates/default/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/dist/templates/default/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/dist/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/dist/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
- package/dist/templates/default/.agents/skills/secrets/SKILL.md +273 -0
- package/dist/templates/default/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/dist/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/default/AGENTS.md +25 -18
- package/dist/templates/headless/.agents/skills/actions/SKILL.md +512 -0
- package/dist/templates/headless/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/dist/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/dist/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/dist/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
- package/dist/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/headless/AGENTS.md +7 -0
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
- package/dist/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
- package/dist/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/dist/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/workspace-core/AGENTS.md +4 -0
- package/dist/templates/workspace-root/AGENTS.md +4 -0
- package/docs/AGENTS.md +7 -0
- package/docs/content/integrations.mdx +63 -2
- package/docs/design/provider-integration-authority.md +117 -0
- package/package.json +9 -2
- package/src/templates/chat/.agents/skills/actions/SKILL.md +32 -12
- package/src/templates/chat/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/src/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/src/templates/chat/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/src/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/chat/AGENTS.md +5 -2
- package/src/templates/chat/app/components/layout/Sidebar.tsx +51 -157
- package/src/templates/default/.agents/skills/actions/SKILL.md +32 -12
- package/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/src/templates/default/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/src/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/src/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
- package/src/templates/default/.agents/skills/secrets/SKILL.md +273 -0
- package/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/default/AGENTS.md +25 -18
- package/src/templates/headless/.agents/skills/actions/SKILL.md +512 -0
- package/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/src/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/src/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/src/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
- package/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/headless/AGENTS.md +7 -0
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
- package/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
- package/src/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/workspace-core/AGENTS.md +4 -0
- package/src/templates/workspace-root/AGENTS.md +4 -0
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,+CAA+C;AAE/C,0BAA0B;AAC1B,OAAO,EACL,4BAA4B,EAU5B,aAAa;AACb,6DAA6D;AAC7D,QAAQ,GAIT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,EAOtB,oBAAoB,EACpB,iBAAiB,EACjB,6BAA6B,GAQ9B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,QAAQ,EACR,iCAAiC,GAElC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,UAAU,GAKX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kCAAkC,EAClC,qCAAqC,EACrC,kCAAkC,EAClC,mCAAmC,EACnC,wCAAwC,GAEzC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,2BAA2B,EAC3B,8BAA8B,EAC9B,2BAA2B,EAC3B,2BAA2B,EAC3B,qBAAqB,EACrB,8BAA8B,EAC9B,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,GAe1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,w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AAc,EACd,eAAe,GAMhB,MAAM,oBAAoB,CAAC;AAE5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,OAAO,EACL,yCAAyC,GAE1C,MAAM,8BAA8B,CAAC","sourcesContent":["// Framework for agent-native apps.\n// Import everything from \"@agent-native/core\".\n\n// Agent (production mode)\nexport {\n createProductionAgentHandler,\n type ActionEntry,\n type ScriptEntry,\n type ProductionAgentOptions,\n type ActionTool,\n type ScriptTool,\n type AgentMessage,\n type AgentChatRequest,\n type AgentChatEvent,\n type AgentChatAttachment,\n DEFAULT_MODEL,\n // In-loop processors (observers/guardrails for runAgentLoop)\n TripWire,\n type Processor,\n type ProcessorState,\n type ProcessorAbort,\n} from \"./agent/index.js\";\nexport {\n defineAction,\n AgentActionStopError,\n isAgentActionStopError,\n type ActionDefinition,\n type ActionHttpConfig,\n type AgentActionStopOptions,\n type PublicAgentActionConfig,\n type ActionDeepLink,\n type ActionLinkBuilder,\n MCP_APP_EXTENSION_ID,\n MCP_APP_MIME_TYPE,\n MCP_APP_RESOURCE_URI_META_KEY,\n type ActionMcpAppConfig,\n type ActionMcpAppCsp,\n type ActionMcpAppCspBuilder,\n type ActionMcpAppHtmlBuilder,\n type ActionMcpAppPermissions,\n type ActionMcpAppResourceConfig,\n type ActionMcpAppResourceMeta,\n} from \"./action.js\";\nexport {\n embedApp,\n MCP_APP_REQUEST_ORIGIN_CSP_SOURCE,\n type EmbedAppOptions,\n} from \"./mcp/embed-app.js\";\nexport {\n embedRoute,\n type EmbedRouteContext,\n type EmbedRouteOptions,\n type EmbedRoutePathBuilder,\n type EmbedRouteResult,\n} from \"./mcp/embed-route.js\";\nexport {\n ACTION_CHAT_UI_DATA_CHART_RENDERER,\n ACTION_CHAT_UI_DATA_INSIGHTS_RENDERER,\n ACTION_CHAT_UI_DATA_TABLE_RENDERER,\n ACTION_CHAT_UI_DATA_WIDGET_RENDERER,\n ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER,\n type ActionChatUIConfig,\n} from \"./action-ui.js\";\nexport {\n DATA_CHART_WIDGET,\n DATA_INSIGHTS_WIDGET,\n DATA_TABLE_WIDGET,\n createDataChartWidgetResult,\n createDataInsightsWidgetResult,\n createDataTableWidgetResult,\n dataChartWidgetResultSchema,\n dataChartWidgetSchema,\n dataInsightsWidgetResultSchema,\n dataTableWidgetResultSchema,\n dataTableWidgetSchema,\n dataWidgetResultSchema,\n isDataChartWidget,\n isDataTableWidget,\n isDataWidgetResult,\n normalizeDataWidgetKind,\n normalizeDataWidgetResult,\n type DataChartSeriesDefinition,\n type DataChartWidget,\n type DataChartWidgetResult,\n type DataChartWidgetResultInput,\n type DataInsightsWidgetResult,\n type DataInsightsWidgetResultInput,\n type DataTableColumn,\n type DataTableWidget,\n type DataTableWidgetResult,\n type DataTableWidgetResultInput,\n type DataWidgetDisplay,\n type DataWidgetKind,\n type DataWidgetResult,\n type DataWidgetResultMetadata,\n} from \"./data-widgets/index.js\";\nexport { createDevScriptRegistry } from \"./scripts/dev/index.js\";\nexport {\n createAgentChatPlugin,\n defaultAgentChatPlugin,\n type AgentChatPluginOptions,\n} from \"./server/agent-chat-plugin.js\";\nexport {\n createAgentNativeEmbeddedPlugin,\n mountAgentNativeEmbedded,\n type AgentNativeEmbeddedPluginOptions,\n} from \"./server/embedded.js\";\nexport {\n BUILT_IN_INTEGRATION_CATALOG,\n INTEGRATION_CATEGORIES,\n getIntegrationCatalogEntry,\n listBuiltInChannelIntegrations,\n listIntegrationCatalog,\n type AutomationCapabilities,\n type BuiltInChannelId,\n type ChannelCapabilities,\n type IntegrationAvailability,\n type IntegrationCatalogEntry,\n type IntegrationCategory,\n type IntegrationCredentialRequirement,\n type IntegrationIconKey,\n type IntegrationSupportMaturity,\n} from \"./integrations/catalog.js\";\nexport {\n AutomationConnectorError,\n createAutomationCallbackHandler,\n createAutomationRuntime,\n createInvokeAutomationWorkflowAction,\n type AutomationCallbackAuthentication,\n type AutomationCallbackInput,\n type AutomationCallbackResult,\n type AutomationInboundDefinition,\n type AutomationInvocation,\n type AutomationInvocationResult,\n type AutomationInvocationStatus,\n type AutomationOutboundDefinition,\n type AutomationResponseMode,\n type AutomationRetryPolicy,\n type AutomationRuntime,\n type AutomationRuntimeOptions,\n type AutomationWorkflowCapabilities,\n type AutomationWorkflowDefinition,\n type JsonSchema,\n} from \"./automation/index.js\";\nexport {\n createFeatureFlagsPlugin,\n defineFeatureFlag,\n defineFeatureFlags,\n evaluateFeatureFlag,\n getFeatureFlagDefinition,\n getFeatureFlagRules,\n isFeatureFlagEnabled,\n listFeatureFlags,\n registerFeatureFlags,\n type FeatureFlagDefinition,\n type FeatureFlagMode,\n type FeatureFlagRules,\n type FeatureFlagScope,\n} from \"./feature-flags/index.js\";\n\n// Server\nexport {\n createServer,\n createSSEHandler,\n defineNitroPlugin,\n autoMountAuth,\n getSession,\n type CreateServerOptions,\n type SSEHandlerOptions,\n type AuthSession,\n type AuthOptions,\n} from \"./server/index.js\";\n\n// Client\n//\n// IMPORTANT: this top-level entry (the package `default`/Node condition) must\n// stay server-safe. It is what `import { defineAction } from \"@agent-native/core\"`\n// resolves to in a headless / Node / SSR context, where React, react-router, and\n// @tanstack/react-query are NOT installed. The React client surface therefore\n// lives behind the `@agent-native/core/client` subpath instead of being\n// re-exported here — re-exporting \"./client/index.js\" from this module would\n// eagerly pull route-state.ts → \"@tanstack/react-query\" into the load graph and\n// crash any headless app at module load.\n//\n// Browser bundlers resolve \"@agent-native/core\" to the `browser` condition\n// (./index.browser.ts), which re-exports the client surface, so UI code that\n// imports client helpers from the bare specifier keeps working in the browser.\n// Code that runs through the Node entry (SSR, scripts, headless) must import\n// client helpers explicitly:\n//\n// import { useDbSync, cn } from \"@agent-native/core/client\";\n\n// Shared (isomorphic)\nexport {\n agentChat,\n type AgentChatCallOptions,\n type AgentChatResponse,\n} from \"./shared/index.js\";\nexport {\n EMBED_MODE_QUERY_PARAM,\n EMBED_SESSION_COOKIE,\n EMBED_START_PATH,\n EMBED_TOKEN_QUERY_PARAM,\n} from \"./shared/embed-auth.js\";\n\n// Agent Web surfaces\nexport {\n AGENT_WEB_CRAWLER_CATEGORIES,\n AGENT_WEB_CRAWLER_USER_AGENTS,\n DEFAULT_AGENT_WEB_CRAWLER_POLICY,\n absoluteUrl,\n agentWebConfigFromPackageJson,\n buildAgentWebStaticFiles,\n buildBaseJsonLd,\n buildLlmsFullTxt,\n buildLlmsTxt,\n buildMarkdownResponseHeaders,\n buildPageJsonLd,\n buildRobotsTxt,\n buildSitemapXml,\n deriveAgentWebPublicRoutes,\n estimateMarkdownTokens,\n markdownFilePathForPage,\n markdownUrlForPage,\n normalizeAgentWebConfig,\n pathPatternMatches,\n resolveAgentWebCrawlerPolicy,\n type AgentWebConfig,\n type AgentWebCrawlerCategory,\n type AgentWebCrawlerDecision,\n type AgentWebCrawlerOverrides,\n type AgentWebCrawlerPolicy,\n type AgentWebInputConfig,\n type AgentWebPage,\n type AgentWebStaticFile,\n type BuildAgentWebStaticFilesOptions,\n type DeriveAgentWebPublicRoutesOptions,\n type MarkdownResponseHeadersOptions,\n} from \"./agent-web/index.js\";\n\n// Token usage tracking\nexport {\n recordUsage,\n getUsageSummary,\n getUserUsageCents,\n calculateCost,\n usageBillingForEngine,\n builderCreditsFromCostCents,\n BUILDER_AGENT_CREDIT_MARGIN_MULTIPLIER,\n BUILDER_AGENT_CREDITS_PER_USD,\n BUILDER_CREDIT_USAGE_BILLING,\n USD_USAGE_BILLING,\n type UsageRecord,\n type UsageCostSource,\n type UsageCostAggregate,\n type UsageSummary,\n type UsageBillingMode,\n type UsageBillingUnit,\n type UsageBucket,\n type DailyBucket,\n type UsageRecentEntry,\n} from \"./usage/store.js\";\n\n// Workspace-scoped third-party connection metadata\nexport {\n deleteWorkspaceConnection,\n getWorkspaceConnectionAppAccess,\n getWorkspaceConnection,\n getWorkspaceConnectionGrant,\n listWorkspaceConnectionProviderCatalogForApp,\n listWorkspaceConnectionGrants,\n listWorkspaceConnections,\n resolveWorkspaceConnectionCredentialForApp,\n resolveWorkspaceConnectionCredentialsForApp,\n revokeWorkspaceConnectionGrant,\n serializeWorkspaceConnectionGrant,\n serializeWorkspaceConnection,\n summarizeWorkspaceConnectionProviderForApp,\n summarizeWorkspaceConnectionProviderReadiness,\n upsertWorkspaceConnectionGrant,\n upsertWorkspaceConnection,\n type ListWorkspaceConnectionProviderCatalogForAppOptions,\n type ListWorkspaceConnectionGrantsOptions,\n type ListWorkspaceConnectionsOptions,\n type ResolveWorkspaceConnectionCredentialForAppOptions,\n type ResolveWorkspaceConnectionCredentialsForAppOptions,\n type SerializedWorkspaceConnectionGrant,\n type SerializedWorkspaceConnection,\n type SummarizeWorkspaceConnectionProviderForAppOptions,\n type SummarizeWorkspaceConnectionProviderReadinessOptions,\n type UpsertWorkspaceConnectionGrantInput,\n type UpsertWorkspaceConnectionInput,\n type WorkspaceConnectionAppAccess,\n type WorkspaceConnectionAppAccessMode,\n type WorkspaceConnection,\n type WorkspaceConnectionCredentialBackend,\n type WorkspaceConnectionCredentialProvenance,\n type WorkspaceConnectionCredentialRef,\n type WorkspaceConnectionCredentialResolution,\n type WorkspaceConnectionCredentialResolutionCheck,\n type WorkspaceConnectionCredentialResolutionStatus,\n type WorkspaceConnectionCredentialsResolution,\n type WorkspaceConnectionExplicitGrantSummary,\n type WorkspaceConnectionForAppSummary,\n type WorkspaceConnectionGrant,\n type WorkspaceConnectionGrantAvailability,\n type WorkspaceConnectionGrantState,\n type WorkspaceConnectionProviderAppSummary,\n type WorkspaceConnectionProviderLike,\n type WorkspaceConnectionProviderCatalogForApp,\n type WorkspaceConnectionProviderCatalogForAppItem,\n type WorkspaceConnectionProviderReadiness,\n type WorkspaceConnectionProviderReadinessStatus,\n type WorkspaceConnectionPublicCredentialRef,\n type WorkspaceConnectionStatus,\n workspaceConnectionIsAvailableToApp,\n registerWorkspaceConnectionLifecycleListener,\n type WorkspaceConnectionLifecycleEvent,\n type WorkspaceConnectionLifecycleListener,\n} from \"./workspace-connections/index.js\";\n\n// Reusable workspace connection provider catalog\nexport {\n PROVIDER_READERS,\n ProviderReaderRuntimeError,\n WORKSPACE_CONNECTION_PROVIDERS,\n createProviderReaderRuntime,\n defineProviderReader,\n defineProviderReaderImplementation,\n defineWorkspaceConnectionProvider,\n getProviderReader,\n getWorkspaceConnectionProvider,\n isWorkspaceConnectionProviderId,\n listProviderReaders,\n listWorkspaceConnectionProviders,\n listWorkspaceConnectionProvidersForCapability,\n listWorkspaceConnectionProvidersForTemplate,\n providerReaderSupports,\n workspaceConnectionProviderSupports,\n type ListWorkspaceConnectionProvidersOptions,\n type ListProviderReadersOptions,\n type ProviderReaderCapability,\n type ProviderReaderCredentialRequirement,\n type ProviderReaderDefinition,\n type ProviderReaderImplementationStatus,\n type ProviderReaderOperation,\n type ProviderReaderOperationDescriptor,\n type ProviderReaderOperationParameter,\n type ProviderReaderRequest,\n type ProviderReaderRuntime,\n type ProviderReaderRuntimeConnection,\n type ProviderReaderRuntimeConnectionResolverOptions,\n type ProviderReaderRuntimeContext,\n type ProviderReaderRuntimeCredentialsResolverOptions,\n type ProviderReaderRuntimeErrorCode,\n type ProviderReaderRuntimeHandler,\n type ProviderReaderRuntimeImplementation,\n type ProviderReaderRuntimeItem,\n type ProviderReaderRuntimeOptions,\n type ProviderReaderRuntimeResponse,\n type WorkspaceConnectionCapability,\n type WorkspaceConnectionCredentialKey,\n type WorkspaceConnectionProvider,\n type WorkspaceConnectionProviderId,\n type WorkspaceConnectionTemplateUse,\n} from \"./connections/index.js\";\n\n// Scripts\nexport {\n runScript,\n loadEnv,\n parseArgs,\n camelCaseArgs,\n isValidPath,\n isValidProjectPath,\n ensureDir,\n fail,\n} from \"./scripts/index.js\";\n\n// Secrets registry — import from \"@agent-native/core/secrets\" when possible\n// (the subpath keeps the top-level entry point lean), but re-export the\n// public API here for convenience.\nexport {\n registerRequiredSecret,\n listRequiredSecrets,\n getRequiredSecret,\n readAppSecret,\n writeAppSecret,\n deleteAppSecret,\n type RegisteredSecret,\n type SecretScope,\n type SecretKind,\n type SecretValidator,\n type SecretRef,\n} from \"./secrets/index.js\";\n\nexport * from \"./history/index.js\";\nexport * from \"./review/index.js\";\nexport * from \"./org-team/index.js\";\nexport * from \"./navigation/index.js\";\nexport * from \"./command-navigation/index.js\";\nexport {\n registerWorkspaceConnectionOnboardingStep,\n type RegisterWorkspaceConnectionOnboardingStepOptions,\n} from \"./setup-connections/index.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,+CAA+C;AAE/C,0BAA0B;AAC1B,OAAO,EACL,4BAA4B,EAU5B,aAAa;AACb,6DAA6D;AAC7D,QAAQ,GAIT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,EAOtB,oBAAoB,EACpB,iBAAiB,EACjB,6BAA6B,GAQ9B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,QAAQ,EACR,iCAAiC,GAElC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,UAAU,GAKX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kCAAkC,EAClC,qCAAqC,EACrC,kCAAkC,EAClC,mCAAmC,EACnC,wCAAwC,GAEzC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,2BAA2B,EAC3B,8BAA8B,EAC9B,2BAA2B,EAC3B,2BAA2B,EAC3B,qBAAqB,EACrB,8BAA8B,EAC9B,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,GAe1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAA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b,cAAc,EACd,eAAe,GAMhB,MAAM,oBAAoB,CAAC;AAE5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EACL,yCAAyC,GAE1C,MAAM,8BAA8B,CAAC","sourcesContent":["// Framework for agent-native apps.\n// Import everything from \"@agent-native/core\".\n\n// Agent (production mode)\nexport {\n createProductionAgentHandler,\n type ActionEntry,\n type ScriptEntry,\n type ProductionAgentOptions,\n type ActionTool,\n type ScriptTool,\n type AgentMessage,\n type AgentChatRequest,\n type AgentChatEvent,\n type AgentChatAttachment,\n DEFAULT_MODEL,\n // In-loop processors (observers/guardrails for runAgentLoop)\n TripWire,\n type Processor,\n type ProcessorState,\n type ProcessorAbort,\n} from \"./agent/index.js\";\nexport {\n defineAction,\n AgentActionStopError,\n isAgentActionStopError,\n type ActionDefinition,\n type ActionHttpConfig,\n type AgentActionStopOptions,\n type PublicAgentActionConfig,\n type ActionDeepLink,\n type ActionLinkBuilder,\n MCP_APP_EXTENSION_ID,\n MCP_APP_MIME_TYPE,\n MCP_APP_RESOURCE_URI_META_KEY,\n type ActionMcpAppConfig,\n type ActionMcpAppCsp,\n type ActionMcpAppCspBuilder,\n type ActionMcpAppHtmlBuilder,\n type ActionMcpAppPermissions,\n type ActionMcpAppResourceConfig,\n type ActionMcpAppResourceMeta,\n} from \"./action.js\";\nexport {\n embedApp,\n MCP_APP_REQUEST_ORIGIN_CSP_SOURCE,\n type EmbedAppOptions,\n} from \"./mcp/embed-app.js\";\nexport {\n embedRoute,\n type EmbedRouteContext,\n type EmbedRouteOptions,\n type EmbedRoutePathBuilder,\n type EmbedRouteResult,\n} from \"./mcp/embed-route.js\";\nexport {\n ACTION_CHAT_UI_DATA_CHART_RENDERER,\n ACTION_CHAT_UI_DATA_INSIGHTS_RENDERER,\n ACTION_CHAT_UI_DATA_TABLE_RENDERER,\n ACTION_CHAT_UI_DATA_WIDGET_RENDERER,\n ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER,\n type ActionChatUIConfig,\n} from \"./action-ui.js\";\nexport {\n DATA_CHART_WIDGET,\n DATA_INSIGHTS_WIDGET,\n DATA_TABLE_WIDGET,\n createDataChartWidgetResult,\n createDataInsightsWidgetResult,\n createDataTableWidgetResult,\n dataChartWidgetResultSchema,\n dataChartWidgetSchema,\n dataInsightsWidgetResultSchema,\n dataTableWidgetResultSchema,\n dataTableWidgetSchema,\n dataWidgetResultSchema,\n isDataChartWidget,\n isDataTableWidget,\n isDataWidgetResult,\n normalizeDataWidgetKind,\n normalizeDataWidgetResult,\n type DataChartSeriesDefinition,\n type DataChartWidget,\n type DataChartWidgetResult,\n type DataChartWidgetResultInput,\n type DataInsightsWidgetResult,\n type DataInsightsWidgetResultInput,\n type DataTableColumn,\n type DataTableWidget,\n type DataTableWidgetResult,\n type DataTableWidgetResultInput,\n type DataWidgetDisplay,\n type DataWidgetKind,\n type DataWidgetResult,\n type DataWidgetResultMetadata,\n} from \"./data-widgets/index.js\";\nexport { createDevScriptRegistry } from \"./scripts/dev/index.js\";\nexport {\n createAgentChatPlugin,\n defaultAgentChatPlugin,\n type AgentChatPluginOptions,\n} from \"./server/agent-chat-plugin.js\";\nexport {\n createAgentNativeEmbeddedPlugin,\n mountAgentNativeEmbedded,\n type AgentNativeEmbeddedPluginOptions,\n} from \"./server/embedded.js\";\nexport {\n BUILT_IN_INTEGRATION_CATALOG,\n INTEGRATION_CATEGORIES,\n getIntegrationCatalogEntry,\n listBuiltInChannelIntegrations,\n listIntegrationCatalog,\n type AutomationCapabilities,\n type BuiltInChannelId,\n type ChannelCapabilities,\n type IntegrationAvailability,\n type IntegrationCatalogEntry,\n type IntegrationCategory,\n type IntegrationCredentialRequirement,\n type IntegrationIconKey,\n type IntegrationSupportMaturity,\n} from \"./integrations/catalog.js\";\nexport {\n AutomationConnectorError,\n createAutomationCallbackHandler,\n createAutomationRuntime,\n createInvokeAutomationWorkflowAction,\n type AutomationCallbackAuthentication,\n type AutomationCallbackInput,\n type AutomationCallbackResult,\n type AutomationInboundDefinition,\n type AutomationInvocation,\n type AutomationInvocationResult,\n type AutomationInvocationStatus,\n type AutomationOutboundDefinition,\n type AutomationResponseMode,\n type AutomationRetryPolicy,\n type AutomationRuntime,\n type AutomationRuntimeOptions,\n type AutomationWorkflowCapabilities,\n type AutomationWorkflowDefinition,\n type JsonSchema,\n} from \"./automation/index.js\";\nexport {\n createFeatureFlagsPlugin,\n defineFeatureFlag,\n defineFeatureFlags,\n evaluateFeatureFlag,\n getFeatureFlagDefinition,\n getFeatureFlagRules,\n isFeatureFlagEnabled,\n listFeatureFlags,\n registerFeatureFlags,\n type FeatureFlagDefinition,\n type FeatureFlagMode,\n type FeatureFlagRules,\n type FeatureFlagScope,\n} from \"./feature-flags/index.js\";\n\n// Server\nexport {\n createServer,\n createSSEHandler,\n defineNitroPlugin,\n autoMountAuth,\n getSession,\n type CreateServerOptions,\n type SSEHandlerOptions,\n type AuthSession,\n type AuthOptions,\n} from \"./server/index.js\";\n\n// Client\n//\n// IMPORTANT: this top-level entry (the package `default`/Node condition) must\n// stay server-safe. It is what `import { defineAction } from \"@agent-native/core\"`\n// resolves to in a headless / Node / SSR context, where React, react-router, and\n// @tanstack/react-query are NOT installed. The React client surface therefore\n// lives behind the `@agent-native/core/client` subpath instead of being\n// re-exported here — re-exporting \"./client/index.js\" from this module would\n// eagerly pull route-state.ts → \"@tanstack/react-query\" into the load graph and\n// crash any headless app at module load.\n//\n// Browser bundlers resolve \"@agent-native/core\" to the `browser` condition\n// (./index.browser.ts), which re-exports the client surface, so UI code that\n// imports client helpers from the bare specifier keeps working in the browser.\n// Code that runs through the Node entry (SSR, scripts, headless) must import\n// client helpers explicitly:\n//\n// import { useDbSync, cn } from \"@agent-native/core/client\";\n\n// Shared (isomorphic)\nexport {\n agentChat,\n type AgentChatCallOptions,\n type AgentChatResponse,\n} from \"./shared/index.js\";\nexport {\n EMBED_MODE_QUERY_PARAM,\n EMBED_SESSION_COOKIE,\n EMBED_START_PATH,\n EMBED_TOKEN_QUERY_PARAM,\n} from \"./shared/embed-auth.js\";\n\n// Agent Web surfaces\nexport {\n AGENT_WEB_CRAWLER_CATEGORIES,\n AGENT_WEB_CRAWLER_USER_AGENTS,\n DEFAULT_AGENT_WEB_CRAWLER_POLICY,\n absoluteUrl,\n agentWebConfigFromPackageJson,\n buildAgentWebStaticFiles,\n buildBaseJsonLd,\n buildLlmsFullTxt,\n buildLlmsTxt,\n buildMarkdownResponseHeaders,\n buildPageJsonLd,\n buildRobotsTxt,\n buildSitemapXml,\n deriveAgentWebPublicRoutes,\n estimateMarkdownTokens,\n markdownFilePathForPage,\n markdownUrlForPage,\n normalizeAgentWebConfig,\n pathPatternMatches,\n resolveAgentWebCrawlerPolicy,\n type AgentWebConfig,\n type AgentWebCrawlerCategory,\n type AgentWebCrawlerDecision,\n type AgentWebCrawlerOverrides,\n type AgentWebCrawlerPolicy,\n type AgentWebInputConfig,\n type AgentWebPage,\n type AgentWebStaticFile,\n type BuildAgentWebStaticFilesOptions,\n type DeriveAgentWebPublicRoutesOptions,\n type MarkdownResponseHeadersOptions,\n} from \"./agent-web/index.js\";\n\n// Token usage tracking\nexport {\n recordUsage,\n getUsageSummary,\n getUserUsageCents,\n calculateCost,\n usageBillingForEngine,\n builderCreditsFromCostCents,\n BUILDER_AGENT_CREDIT_MARGIN_MULTIPLIER,\n BUILDER_AGENT_CREDITS_PER_USD,\n BUILDER_CREDIT_USAGE_BILLING,\n USD_USAGE_BILLING,\n type UsageRecord,\n type UsageCostSource,\n type UsageCostAggregate,\n type UsageSummary,\n type UsageBillingMode,\n type UsageBillingUnit,\n type UsageBucket,\n type DailyBucket,\n type UsageRecentEntry,\n} from \"./usage/store.js\";\n\n// Workspace-scoped third-party connection metadata\nexport {\n deleteWorkspaceConnection,\n getWorkspaceConnectionAppAccess,\n getWorkspaceConnection,\n getWorkspaceConnectionGrant,\n listWorkspaceConnectionProviderCatalogForApp,\n listWorkspaceConnectionGrants,\n listWorkspaceConnections,\n resolveWorkspaceConnectionCredentialForApp,\n resolveWorkspaceConnectionCredentialsForApp,\n revokeWorkspaceConnectionGrant,\n serializeWorkspaceConnectionGrant,\n serializeWorkspaceConnection,\n summarizeWorkspaceConnectionProviderForApp,\n summarizeWorkspaceConnectionProviderReadiness,\n upsertWorkspaceConnectionGrant,\n upsertWorkspaceConnection,\n type ListWorkspaceConnectionProviderCatalogForAppOptions,\n type ListWorkspaceConnectionGrantsOptions,\n type ListWorkspaceConnectionsOptions,\n type ResolveWorkspaceConnectionCredentialForAppOptions,\n type ResolveWorkspaceConnectionCredentialsForAppOptions,\n type SerializedWorkspaceConnectionGrant,\n type SerializedWorkspaceConnection,\n type SummarizeWorkspaceConnectionProviderForAppOptions,\n type SummarizeWorkspaceConnectionProviderReadinessOptions,\n type UpsertWorkspaceConnectionGrantInput,\n type UpsertWorkspaceConnectionInput,\n type WorkspaceConnectionAppAccess,\n type WorkspaceConnectionAppAccessMode,\n type WorkspaceConnection,\n type WorkspaceConnectionCredentialBackend,\n type WorkspaceConnectionCredentialProvenance,\n type WorkspaceConnectionCredentialRef,\n type WorkspaceConnectionCredentialResolution,\n type WorkspaceConnectionCredentialResolutionCheck,\n type WorkspaceConnectionCredentialResolutionStatus,\n type WorkspaceConnectionCredentialsResolution,\n type WorkspaceConnectionExplicitGrantSummary,\n type WorkspaceConnectionForAppSummary,\n type WorkspaceConnectionGrant,\n type WorkspaceConnectionGrantAvailability,\n type WorkspaceConnectionGrantState,\n type WorkspaceConnectionProviderAppSummary,\n type WorkspaceConnectionProviderLike,\n type WorkspaceConnectionProviderCatalogForApp,\n type WorkspaceConnectionProviderCatalogForAppItem,\n type WorkspaceConnectionProviderReadiness,\n type WorkspaceConnectionProviderReadinessStatus,\n type WorkspaceConnectionPublicCredentialRef,\n type WorkspaceConnectionStatus,\n workspaceConnectionIsAvailableToApp,\n registerWorkspaceConnectionLifecycleListener,\n type WorkspaceConnectionLifecycleEvent,\n type WorkspaceConnectionLifecycleListener,\n} from \"./workspace-connections/index.js\";\n\n// Reusable workspace connection provider catalog\nexport {\n PROVIDER_READERS,\n ProviderReaderRuntimeError,\n WORKSPACE_CONNECTION_PROVIDERS,\n createProviderReaderRuntime,\n defineProviderReader,\n defineProviderReaderImplementation,\n defineWorkspaceConnectionProvider,\n getProviderReader,\n getWorkspaceConnectionProvider,\n isWorkspaceConnectionProviderId,\n listProviderReaders,\n listWorkspaceConnectionProviders,\n listWorkspaceConnectionProvidersForCapability,\n listWorkspaceConnectionProvidersForTemplate,\n providerReaderSupports,\n workspaceConnectionProviderSupports,\n type ListWorkspaceConnectionProvidersOptions,\n type ListProviderReadersOptions,\n type ProviderReaderCapability,\n type ProviderReaderCredentialRequirement,\n type ProviderReaderDefinition,\n type ProviderReaderImplementationStatus,\n type ProviderReaderOperation,\n type ProviderReaderOperationDescriptor,\n type ProviderReaderOperationParameter,\n type ProviderReaderRequest,\n type ProviderReaderRuntime,\n type ProviderReaderRuntimeConnection,\n type ProviderReaderRuntimeConnectionResolverOptions,\n type ProviderReaderRuntimeContext,\n type ProviderReaderRuntimeCredentialsResolverOptions,\n type ProviderReaderRuntimeErrorCode,\n type ProviderReaderRuntimeHandler,\n type ProviderReaderRuntimeImplementation,\n type ProviderReaderRuntimeItem,\n type ProviderReaderRuntimeOptions,\n type ProviderReaderRuntimeResponse,\n type WorkspaceConnectionCapability,\n type WorkspaceConnectionCredentialKey,\n type WorkspaceConnectionProvider,\n type WorkspaceConnectionProviderId,\n type WorkspaceConnectionTemplateUse,\n} from \"./connections/index.js\";\n\n// Scripts\nexport {\n runScript,\n loadEnv,\n parseArgs,\n camelCaseArgs,\n isValidPath,\n isValidProjectPath,\n ensureDir,\n fail,\n} from \"./scripts/index.js\";\n\n// Secrets registry — import from \"@agent-native/core/secrets\" when possible\n// (the subpath keeps the top-level entry point lean), but re-export the\n// public API here for convenience.\nexport {\n registerRequiredSecret,\n listRequiredSecrets,\n getRequiredSecret,\n readAppSecret,\n writeAppSecret,\n deleteAppSecret,\n type RegisteredSecret,\n type SecretScope,\n type SecretKind,\n type SecretValidator,\n type SecretRef,\n} from \"./secrets/index.js\";\n\nexport * from \"./history/index.js\";\nexport * from \"./review/index.js\";\nexport * from \"./org-team/index.js\";\nexport * from \"./navigation/index.js\";\nexport * from \"./command-navigation/index.js\";\nexport * from \"./search/index.js\";\nexport * from \"./embeddings/index.js\";\nexport {\n registerWorkspaceConnectionOnboardingStep,\n type RegisterWorkspaceConnectionOnboardingStepOptions,\n} from \"./setup-connections/index.js\";\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { PlatformAdapter, IncomingMessage, OutgoingMessage, IntegrationStatus, IntegrationsPluginOptions, ImmediateWebhookResponse, PlatformAdapterCapabilities, UnsupportedPlatformCapabilityError, IntegrationExecutionContext, IntegrationActorTrust, IntegrationContextMessage, IntegrationFileReference, IntegrationConversationType, IntegrationTriggerKind, PlatformRunProgress, PlatformDeliveryReceipt, } from "./types.js";
|
|
2
2
|
export { assertPlatformCapability } from "./types.js";
|
|
3
|
+
export { deliverJsonWebhook, escapeSlackMrkdwn, isWebhookUrlAllowed, type DeliverJsonWebhookOptions, type JsonWebhookDeliveryResult, } from "./webhook-delivery.js";
|
|
3
4
|
export { resolveDefaultIntegrationExecutionContext } from "./identity.js";
|
|
4
5
|
export { upsertVerifiedIntegrationIdentity, type IntegrationIdentityLink, } from "./identity-links-store.js";
|
|
5
6
|
export { BUILT_IN_INTEGRATION_CATALOG, INTEGRATION_CATEGORIES, getIntegrationCatalogEntry, listBuiltInChannelIntegrations, listIntegrationCatalog, type BuiltInChannelId, type AutomationCapabilities, type ChannelCapabilities, type IntegrationAvailability, type IntegrationCatalogEntry, type IntegrationCategory, type IntegrationCredentialRequirement, type IntegrationIconKey, type IntegrationSupportMaturity, } from "./catalog.js";
|
|
@@ -23,7 +24,7 @@ export { startGoogleDocsPoller, stopGoogleDocsPoller, handlePushNotification, }
|
|
|
23
24
|
export { getIntegrationConfig, saveIntegrationConfig, deleteIntegrationConfig, listIntegrationConfigs, type IntegrationConfig, } from "./config-store.js";
|
|
24
25
|
export { disconnectIntegrationInstallation, getActiveIntegrationInstallationByKey, getActiveIntegrationInstallationForTenant, getIntegrationInstallation, listIntegrationInstallations, resolveIntegrationTokenBundle, updateIntegrationInstallation, upsertIntegrationInstallation, } from "./installations-store.js";
|
|
25
26
|
export type { InstallationActor, IntegrationInstallation, IntegrationInstallationHealth, IntegrationInstallationStatus, IntegrationTokenBundle, } from "./installations-store.js";
|
|
26
|
-
export { assertSlackInstallAccess, buildSlackAuthorizeUrl, exchangeSlackOAuthCode, refreshSlackOAuthToken, slackInstallationKey, slackOAuthResponseToInstallation, testSlackAuth, } from "./slack-oauth.js";
|
|
27
|
+
export { SLACK_AUTHORIZE_URL, SLACK_TOKEN_URL, assertSlackInstallAccess, buildSlackAuthorizeUrl, exchangeSlackOAuthCode, refreshSlackOAuthToken, slackInstallationKey, slackOAuthResponseToInstallation, testSlackAuth, type SlackOAuthAccessResponse, } from "./slack-oauth.js";
|
|
27
28
|
export { SLACK_AGENT_BOT_EVENTS, buildSlackAgentManifest, type SlackAgentManifestUrls, } from "./slack-manifest.js";
|
|
28
29
|
export { DEFAULT_INTEGRATION_SCOPE_POLICY, deleteIntegrationScope, evaluateIntegrationScopePolicy, getIntegrationScope, integrationScopeSubjectKey, listIntegrationScopes, saveIntegrationScope, } from "./scope-store.js";
|
|
29
30
|
export type { IntegrationConversationTrust, IntegrationScope, IntegrationScopeAccess, IntegrationScopePolicy, } from "./scope-store.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,eAAe,EACf,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,kCAAkC,EAClC,2BAA2B,EAC3B,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,eAAe,EACf,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,kCAAkC,EAClC,2BAA2B,EAC3B,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,GAC/B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,yCAAyC,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EACL,iCAAiC,EACjC,KAAK,uBAAuB,GAC7B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,0BAA0B,EAC1B,8BAA8B,EAC9B,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,gCAAgC,EACrC,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,GAChC,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,oBAAo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AAY,EACV,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,aAAa,GACnB,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { assertPlatformCapability } from "./types.js";
|
|
2
|
+
export { deliverJsonWebhook, escapeSlackMrkdwn, isWebhookUrlAllowed, } from "./webhook-delivery.js";
|
|
2
3
|
export { resolveDefaultIntegrationExecutionContext } from "./identity.js";
|
|
3
4
|
export { upsertVerifiedIntegrationIdentity, } from "./identity-links-store.js";
|
|
4
5
|
export { BUILT_IN_INTEGRATION_CATALOG, INTEGRATION_CATEGORIES, getIntegrationCatalogEntry, listBuiltInChannelIntegrations, listIntegrationCatalog, } from "./catalog.js";
|
|
@@ -24,7 +25,7 @@ export { startGoogleDocsPoller, stopGoogleDocsPoller, handlePushNotification, }
|
|
|
24
25
|
// Stores
|
|
25
26
|
export { getIntegrationConfig, saveIntegrationConfig, deleteIntegrationConfig, listIntegrationConfigs, } from "./config-store.js";
|
|
26
27
|
export { disconnectIntegrationInstallation, getActiveIntegrationInstallationByKey, getActiveIntegrationInstallationForTenant, getIntegrationInstallation, listIntegrationInstallations, resolveIntegrationTokenBundle, updateIntegrationInstallation, upsertIntegrationInstallation, } from "./installations-store.js";
|
|
27
|
-
export { assertSlackInstallAccess, buildSlackAuthorizeUrl, exchangeSlackOAuthCode, refreshSlackOAuthToken, slackInstallationKey, slackOAuthResponseToInstallation, testSlackAuth, } from "./slack-oauth.js";
|
|
28
|
+
export { SLACK_AUTHORIZE_URL, SLACK_TOKEN_URL, assertSlackInstallAccess, buildSlackAuthorizeUrl, exchangeSlackOAuthCode, refreshSlackOAuthToken, slackInstallationKey, slackOAuthResponseToInstallation, testSlackAuth, } from "./slack-oauth.js";
|
|
28
29
|
export { SLACK_AGENT_BOT_EVENTS, buildSlackAgentManifest, } from "./slack-manifest.js";
|
|
29
30
|
export { DEFAULT_INTEGRATION_SCOPE_POLICY, deleteIntegrationScope, evaluateIntegrationScopePolicy, getIntegrationScope, integrationScopeSubjectKey, listIntegrationScopes, saveIntegrationScope, } from "./scope-store.js";
|
|
30
31
|
export { getIntegrationBudgetSnapshot, getIntegrationUsageBudget, listIntegrationUsageBudgets, listIntegrationBudgetThresholdEvents, releaseIntegrationUsageBudget, reserveIntegrationUsageBudget, saveIntegrationUsageBudget, settleIntegrationUsageBudget, } from "./usage-budget-store.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GAGpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,yCAAyC,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EACL,iCAAiC,GAElC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,0BAA0B,EAC1B,8BAA8B,EAC9B,sBAAsB,GAUvB,MAAM,cAAc,CAAC;AAEtB,SAAS;AACT,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,kCAAkC,EAClC,yBAAyB,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AsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,gCAAgC,EAChC,aAAa,GAEd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GAExB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,gCAAgC,EAChC,sBAAsB,EACtB,8BAA8B,EAC9B,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,oCAAoC,EACpC,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,GAEnB,MAAM,2BAA2B,CAAC","sourcesContent":["// Types\nexport type {\n PlatformAdapter,\n IncomingMessage,\n OutgoingMessage,\n IntegrationStatus,\n IntegrationsPluginOptions,\n ImmediateWebhookResponse,\n PlatformAdapterCapabilities,\n UnsupportedPlatformCapabilityError,\n IntegrationExecutionContext,\n IntegrationActorTrust,\n IntegrationContextMessage,\n IntegrationFileReference,\n IntegrationConversationType,\n IntegrationTriggerKind,\n PlatformRunProgress,\n PlatformDeliveryReceipt,\n} from \"./types.js\";\nexport { assertPlatformCapability } from \"./types.js\";\nexport {\n deliverJsonWebhook,\n escapeSlackMrkdwn,\n isWebhookUrlAllowed,\n type DeliverJsonWebhookOptions,\n type JsonWebhookDeliveryResult,\n} from \"./webhook-delivery.js\";\n\nexport { resolveDefaultIntegrationExecutionContext } from \"./identity.js\";\nexport {\n upsertVerifiedIntegrationIdentity,\n type IntegrationIdentityLink,\n} from \"./identity-links-store.js\";\n\nexport {\n BUILT_IN_INTEGRATION_CATALOG,\n INTEGRATION_CATEGORIES,\n getIntegrationCatalogEntry,\n listBuiltInChannelIntegrations,\n listIntegrationCatalog,\n type BuiltInChannelId,\n type AutomationCapabilities,\n type ChannelCapabilities,\n type IntegrationAvailability,\n type IntegrationCatalogEntry,\n type IntegrationCategory,\n type IntegrationCredentialRequirement,\n type IntegrationIconKey,\n type IntegrationSupportMaturity,\n} from \"./catalog.js\";\n\n// Plugin\nexport {\n createIntegrationsPlugin,\n defaultIntegrationsPlugin,\n enqueueRemoteCommand,\n} from \"./plugin.js\";\n\nexport {\n getRemoteComputerCapabilities,\n listRemoteDevicesForOwner,\n revokeRemoteDeviceForOwner,\n unregisterRemoteDevice,\n} from \"./remote-devices-store.js\";\nexport {\n claimNextComputerCommand,\n enqueueComputerCommand,\n listRemoteCommandsForOwner,\n} from \"./remote-commands-store.js\";\nexport {\n assertValidComputerCommandEnvelope,\n computeComputerActionHash,\n computerOperationRequiresApproval,\n ComputerSupervisionError,\n} from \"./computer-supervision.js\";\nexport {\n authorizeComputerOperation,\n createComputerApprovalRequest,\n decideComputerApproval,\n getComputerApprovalForOwner,\n listComputerApprovalsForOwner,\n type ComputerApprovalRecord,\n type ComputerApprovalStatus,\n} from \"./computer-supervision-store.js\";\nexport { insertRemoteLiveViewEvents } from \"./remote-run-events-store.js\";\nexport {\n listRemotePushNotificationsForOwner,\n listRemotePushRegistrationsForOwner,\n queueRemotePushNotifications,\n toPublicRemotePushRegistration,\n unregisterRemotePushRegistrationForOwner,\n upsertRemotePushRegistration,\n} from \"./remote-push-store.js\";\nexport { deliverPendingRemotePushNotifications } from \"./remote-push-delivery.js\";\nexport type {\n ComputerApprovalScope,\n ComputerCommandAction,\n ComputerCommandEnvelope,\n ComputerOperationClass,\n PublicRemotePushRegistration,\n PublicRemoteDevice,\n RemoteComputerCapabilities,\n RemoteCommand,\n RemoteDevice,\n RemoteDeviceMetadata,\n RemoteLiveViewEvent,\n RemotePushNotification,\n RemotePushRegistration,\n RemoteRunEvent,\n} from \"./remote-types.js\";\n\n// Adapters\nexport { slackAdapter } from \"./adapters/slack.js\";\nexport { telegramAdapter } from \"./adapters/telegram.js\";\nexport { whatsappAdapter } from \"./adapters/whatsapp.js\";\nexport { discordAdapter } from \"./adapters/discord.js\";\nexport {\n clearMicrosoftTeamsAccessTokenCache,\n getMicrosoftTeamsAccessToken,\n microsoftTeamsAdapter,\n} from \"./adapters/microsoft-teams.js\";\nexport { googleDocsAdapter } from \"./adapters/google-docs.js\";\nexport { emailAdapter } from \"./adapters/email.js\";\n\n// Google Docs integration\nexport {\n startGoogleDocsPoller,\n stopGoogleDocsPoller,\n handlePushNotification,\n} from \"./google-docs-poller.js\";\n\n// Stores\nexport {\n getIntegrationConfig,\n saveIntegrationConfig,\n deleteIntegrationConfig,\n listIntegrationConfigs,\n type IntegrationConfig,\n} from \"./config-store.js\";\n\nexport {\n disconnectIntegrationInstallation,\n getActiveIntegrationInstallationByKey,\n getActiveIntegrationInstallationForTenant,\n getIntegrationInstallation,\n listIntegrationInstallations,\n resolveIntegrationTokenBundle,\n updateIntegrationInstallation,\n upsertIntegrationInstallation,\n} from \"./installations-store.js\";\nexport type {\n InstallationActor,\n IntegrationInstallation,\n IntegrationInstallationHealth,\n IntegrationInstallationStatus,\n IntegrationTokenBundle,\n} from \"./installations-store.js\";\n\nexport {\n SLACK_AUTHORIZE_URL,\n SLACK_TOKEN_URL,\n assertSlackInstallAccess,\n buildSlackAuthorizeUrl,\n exchangeSlackOAuthCode,\n refreshSlackOAuthToken,\n slackInstallationKey,\n slackOAuthResponseToInstallation,\n testSlackAuth,\n type SlackOAuthAccessResponse,\n} from \"./slack-oauth.js\";\n\nexport {\n SLACK_AGENT_BOT_EVENTS,\n buildSlackAgentManifest,\n type SlackAgentManifestUrls,\n} from \"./slack-manifest.js\";\n\nexport {\n DEFAULT_INTEGRATION_SCOPE_POLICY,\n deleteIntegrationScope,\n evaluateIntegrationScopePolicy,\n getIntegrationScope,\n integrationScopeSubjectKey,\n listIntegrationScopes,\n saveIntegrationScope,\n} from \"./scope-store.js\";\nexport type {\n IntegrationConversationTrust,\n IntegrationScope,\n IntegrationScopeAccess,\n IntegrationScopePolicy,\n} from \"./scope-store.js\";\n\nexport {\n getIntegrationBudgetSnapshot,\n getIntegrationUsageBudget,\n listIntegrationUsageBudgets,\n listIntegrationBudgetThresholdEvents,\n releaseIntegrationUsageBudget,\n reserveIntegrationUsageBudget,\n saveIntegrationUsageBudget,\n settleIntegrationUsageBudget,\n} from \"./usage-budget-store.js\";\nexport type {\n IntegrationBudgetPeriod,\n IntegrationBudgetSubject,\n IntegrationUsageBudget,\n} from \"./usage-budget-store.js\";\n\nexport {\n getThreadMapping,\n saveThreadMapping,\n deleteThreadMapping,\n listThreadMappings,\n type ThreadMapping,\n} from \"./thread-mapping-store.js\";\n"]}
|
|
@@ -46,7 +46,7 @@ export declare function buildSlackAgentManifest(urls: SlackAgentManifestUrls): {
|
|
|
46
46
|
readonly oauth_config: {
|
|
47
47
|
readonly redirect_urls: readonly [string];
|
|
48
48
|
readonly scopes: {
|
|
49
|
-
readonly bot: 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"];
|
|
49
|
+
readonly bot: readonly ["assistant:write", "app_mentions:read", "channels:join", "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"];
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
52
|
readonly settings: {
|
|
@@ -5,7 +5,7 @@ export declare const SLACK_AUTHORIZE_URL = "https://slack.com/oauth/v2/authorize
|
|
|
5
5
|
export declare const SLACK_TOKEN_URL = "https://slack.com/api/oauth.v2.access";
|
|
6
6
|
export declare const SLACK_AUTH_TEST_URL = "https://slack.com/api/auth.test";
|
|
7
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"];
|
|
8
|
+
export declare const SLACK_AGENT_BOT_SCOPES: readonly ["assistant:write", "app_mentions:read", "channels:join", "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
9
|
export interface SlackOAuthAccessResponse {
|
|
10
10
|
ok?: boolean;
|
|
11
11
|
error?: string;
|
|
@@ -1 +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,EACT,cAAc,EACd,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,CACV,CAAC;AAEX,MAAM,WAAW,wBAAwB;IACvC,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,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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
|
+
{"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,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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C,WAAW;QAC/B,aAAa,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:join\",\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"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare function escapeSlackMrkdwn(value: string): string;
|
|
2
|
+
export declare function isWebhookUrlAllowed(url: string): boolean;
|
|
3
|
+
export interface DeliverJsonWebhookOptions {
|
|
4
|
+
url: string;
|
|
5
|
+
payload: unknown;
|
|
6
|
+
headers?: Record<string, string>;
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
maxRedirects?: number;
|
|
9
|
+
}
|
|
10
|
+
export type JsonWebhookDeliveryResult = {
|
|
11
|
+
ok: true;
|
|
12
|
+
status: number;
|
|
13
|
+
} | {
|
|
14
|
+
ok: false;
|
|
15
|
+
blocked: true;
|
|
16
|
+
} | {
|
|
17
|
+
ok: false;
|
|
18
|
+
blocked: false;
|
|
19
|
+
status?: number;
|
|
20
|
+
error?: unknown;
|
|
21
|
+
};
|
|
22
|
+
export declare function deliverJsonWebhook(options: DeliverJsonWebhookOptions): Promise<JsonWebhookDeliveryResult>;
|
|
23
|
+
//# sourceMappingURL=webhook-delivery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-delivery.d.ts","sourceRoot":"","sources":["../../src/integrations/webhook-delivery.ts"],"names":[],"mappings":"AAKA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKvD;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,yBAAyB,GACjC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC5B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,GAC5B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpE,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,yBAAyB,CAAC,CAuBpC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { isBlockedExtensionUrl, ssrfSafeFetch, } from "../extensions/url-safety.js";
|
|
2
|
+
export function escapeSlackMrkdwn(value) {
|
|
3
|
+
return value
|
|
4
|
+
.replace(/&/g, "&")
|
|
5
|
+
.replace(/</g, "<")
|
|
6
|
+
.replace(/>/g, ">");
|
|
7
|
+
}
|
|
8
|
+
export function isWebhookUrlAllowed(url) {
|
|
9
|
+
return !isBlockedExtensionUrl(url);
|
|
10
|
+
}
|
|
11
|
+
export async function deliverJsonWebhook(options) {
|
|
12
|
+
if (!isWebhookUrlAllowed(options.url))
|
|
13
|
+
return { ok: false, blocked: true };
|
|
14
|
+
try {
|
|
15
|
+
const response = await ssrfSafeFetch(options.url, {
|
|
16
|
+
method: "POST",
|
|
17
|
+
headers: {
|
|
18
|
+
"Content-Type": "application/json",
|
|
19
|
+
...options.headers,
|
|
20
|
+
},
|
|
21
|
+
body: JSON.stringify(options.payload),
|
|
22
|
+
signal: AbortSignal.timeout(options.timeoutMs ?? 10_000),
|
|
23
|
+
}, { maxRedirects: options.maxRedirects ?? 3 });
|
|
24
|
+
return response.ok
|
|
25
|
+
? { ok: true, status: response.status }
|
|
26
|
+
: { ok: false, blocked: false, status: response.status };
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
return { ok: false, blocked: false, error };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=webhook-delivery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-delivery.js","sourceRoot":"","sources":["../../src/integrations/webhook-delivery.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,aAAa,GACd,MAAM,6BAA6B,CAAC;AAErC,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,KAAK;SACT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,OAAO,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC;AAeD,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,OAAkC;IAElC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAE3E,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,aAAa,CAClC,OAAO,CAAC,GAAG,EACX;YACE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,GAAG,OAAO,CAAC,OAAO;aACnB;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;YACrC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC;SACzD,EACD,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,CAAC,EAAE,CAC5C,CAAC;QACF,OAAO,QAAQ,CAAC,EAAE;YAChB,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE;YACvC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC7D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC9C,CAAC;AACH,CAAC","sourcesContent":["import {\n isBlockedExtensionUrl,\n ssrfSafeFetch,\n} from \"../extensions/url-safety.js\";\n\nexport function escapeSlackMrkdwn(value: string): string {\n return value\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\");\n}\n\nexport function isWebhookUrlAllowed(url: string): boolean {\n return !isBlockedExtensionUrl(url);\n}\n\nexport interface DeliverJsonWebhookOptions {\n url: string;\n payload: unknown;\n headers?: Record<string, string>;\n timeoutMs?: number;\n maxRedirects?: number;\n}\n\nexport type JsonWebhookDeliveryResult =\n | { ok: true; status: number }\n | { ok: false; blocked: true }\n | { ok: false; blocked: false; status?: number; error?: unknown };\n\nexport async function deliverJsonWebhook(\n options: DeliverJsonWebhookOptions,\n): Promise<JsonWebhookDeliveryResult> {\n if (!isWebhookUrlAllowed(options.url)) return { ok: false, blocked: true };\n\n try {\n const response = await ssrfSafeFetch(\n options.url,\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n body: JSON.stringify(options.payload),\n signal: AbortSignal.timeout(options.timeoutMs ?? 10_000),\n },\n { maxRedirects: options.maxRedirects ?? 3 },\n );\n return response.ok\n ? { ok: true, status: response.status }\n : { ok: false, blocked: false, status: response.status };\n } catch (error) {\n return { ok: false, blocked: false, error };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../src/notifications/channels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;
|
|
1
|
+
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../src/notifications/channels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAgBH,wBAAgB,mCAAmC,IAAI,IAAI,CAa1D"}
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
* `metadata.emailRecipients`.
|
|
28
28
|
*/
|
|
29
29
|
import { ssrfSafeFetch } from "../extensions/url-safety.js";
|
|
30
|
+
import { escapeSlackMrkdwn } from "../integrations/webhook-delivery.js";
|
|
30
31
|
import { getKeyAllowlist, getResolvedKeyAllowlist, resolveKeyReferencesWithRequestScopes, validateUrlAllowlist, } from "../secrets/substitution.js";
|
|
31
32
|
import { sendEmail } from "../server/email.js";
|
|
32
33
|
import { registerNotificationChannel } from "./registry.js";
|
|
@@ -95,7 +96,7 @@ function createSlackWebhookChannel(envUrlTemplate) {
|
|
|
95
96
|
type: "section",
|
|
96
97
|
text: {
|
|
97
98
|
type: "mrkdwn",
|
|
98
|
-
text: `*${
|
|
99
|
+
text: `*${escapeSlackMrkdwn(input.title)}*`,
|
|
99
100
|
},
|
|
100
101
|
},
|
|
101
102
|
...(input.body
|
|
@@ -104,7 +105,7 @@ function createSlackWebhookChannel(envUrlTemplate) {
|
|
|
104
105
|
type: "section",
|
|
105
106
|
text: {
|
|
106
107
|
type: "mrkdwn",
|
|
107
|
-
text:
|
|
108
|
+
text: escapeSlackMrkdwn(input.body),
|
|
108
109
|
},
|
|
109
110
|
},
|
|
110
111
|
]
|
|
@@ -114,7 +115,7 @@ function createSlackWebhookChannel(envUrlTemplate) {
|
|
|
114
115
|
elements: [
|
|
115
116
|
{
|
|
116
117
|
type: "mrkdwn",
|
|
117
|
-
text: `Severity: \`${input.severity}\` Owner: ${
|
|
118
|
+
text: `Severity: \`${input.severity}\` Owner: ${escapeSlackMrkdwn(meta.owner)}`,
|
|
118
119
|
},
|
|
119
120
|
],
|
|
120
121
|
},
|
|
@@ -261,12 +262,6 @@ function commaList(value) {
|
|
|
261
262
|
function slackText(severity, title, body) {
|
|
262
263
|
return `[${severity}] ${title}${body ? `\n${body}` : ""}`;
|
|
263
264
|
}
|
|
264
|
-
function escapeSlack(value) {
|
|
265
|
-
return value
|
|
266
|
-
.replace(/&/g, "&")
|
|
267
|
-
.replace(/</g, "<")
|
|
268
|
-
.replace(/>/g, ">");
|
|
269
|
-
}
|
|
270
265
|
function escapeHtml(value) {
|
|
271
266
|
return value
|
|
272
267
|
.replace(/&/g, "&")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channels.js","sourceRoot":"","sources":["../../src/notifications/channels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,qCAAqC,EACrC,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAG5D,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB,MAAM,UAAU,mCAAmC;IACjD,IAAI,WAAW;QAAE,OAAO;IACxB,WAAW,GAAG,IAAI,CAAC;IAEnB,2BAA2B,CACzB,oBAAoB,CAAC,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAC5D,CAAC;IACF,2BAA2B,CACzB,yBAAyB,CAAC,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CACvE,CAAC;IACF,4EAA4E;IAC5E,0EAA0E;IAC1E,2BAA2B,CAAC,kBAAkB,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,oBAAoB,CAC3B,cAAkC;IAElC,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC;IAC5D,OAAO;QACL,IAAI,EAAE,SAAS;QACf,KAAK,CAAC,O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AO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACjD,CAAC;QACD,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,OAAO,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AAClC,CAAC","sourcesContent":["/**\n * Built-in notification channels.\n *\n * Webhook and Slack are always registered. Delivery uses (in order):\n * 1. per-notification `metadata.webhookUrl` / `metadata.slackWebhookUrl`\n * 2. the matching `NOTIFICATIONS_*` env URL (workspace default)\n * If neither is set, that channel no-ops for the emission.\n *\n * Extra channels can be registered at any time via\n * `registerNotificationChannel()` from a server plugin.\n *\n * NOTIFICATIONS_WEBHOOK_URL → default POST JSON URL when metadata omits one.\n * Supports `${keys.NAME}` substitution — the raw\n * value never enters the agent context.\n * NOTIFICATIONS_WEBHOOK_AUTH → optional `Authorization` header value (also\n * supports `${keys.NAME}`).\n * NOTIFICATIONS_SLACK_WEBHOOK_URL\n * → default Slack incoming webhook when metadata\n * omits `slackWebhookUrl`.\n * Supports `${keys.NAME}` substitution.\n * NOTIFICATIONS_EMAIL_CHANNEL=1\n * → enable the built-in email channel for\n * per-notification recipients.\n * NOTIFICATIONS_EMAIL_RECIPIENTS\n * → comma-separated fallback recipients for email\n * notifications that do not pass\n * `metadata.emailRecipients`.\n */\n\nimport { ssrfSafeFetch } from \"../extensions/url-safety.js\";\nimport {\n getKeyAllowlist,\n getResolvedKeyAllowlist,\n resolveKeyReferencesWithRequestScopes,\n validateUrlAllowlist,\n} from \"../secrets/substitution.js\";\nimport { sendEmail } from \"../server/email.js\";\nimport { registerNotificationChannel } from \"./registry.js\";\nimport type { NotificationChannel, NotificationInput } from \"./types.js\";\n\nlet _registered = false;\n\nexport function registerBuiltinNotificationChannels(): void {\n if (_registered) return;\n _registered = true;\n\n registerNotificationChannel(\n createWebhookChannel(process.env.NOTIFICATIONS_WEBHOOK_URL),\n );\n registerNotificationChannel(\n createSlackWebhookChannel(process.env.NOTIFICATIONS_SLACK_WEBHOOK_URL),\n );\n // Email is always registered so per-notification `metadata.emailRecipients`\n // work without a workspace-wide env flag (same pattern as webhook/slack).\n registerNotificationChannel(createEmailChannel());\n}\n\nfunction createWebhookChannel(\n envUrlTemplate: string | undefined,\n): NotificationChannel {\n const authTemplate = process.env.NOTIFICATIONS_WEBHOOK_AUTH;\n return {\n name: \"webhook\",\n async deliver(input, meta) {\n const overrideUrlTemplate = deliveryMetadataString(\n input.metadata,\n \"webhookUrl\",\n );\n const urlTemplate =\n overrideUrlTemplate ??\n metadataString(input.metadata, \"webhookUrl\") ??\n envUrlTemplate?.trim();\n // No-op when neither a per-notification nor workspace URL is set —\n // mirrors email's empty-recipients behavior so notify-all stays quiet.\n if (!urlTemplate) return false;\n const { url, headers, assertUrlAllowed } = await resolveWebhookRequest(\n urlTemplate,\n overrideUrlTemplate ? undefined : authTemplate,\n meta.owner,\n \"webhook\",\n );\n const res = await ssrfSafeFetch(\n url,\n {\n method: \"POST\",\n headers,\n body: JSON.stringify({\n severity: input.severity,\n title: input.title,\n body: input.body,\n metadata: scrubDeliveryMetadata(input.metadata),\n owner: meta.owner,\n emittedAt: new Date().toISOString(),\n }),\n },\n { maxRedirects: 3, assertUrlAllowed },\n );\n if (!res.ok) {\n throw new Error(\n `[notifications] webhook ${new URL(url).origin} returned ${res.status}${\n (await readErrorSnippet(res)) || \"\"\n }`,\n );\n }\n },\n };\n}\n\nfunction createSlackWebhookChannel(\n envUrlTemplate: string | undefined,\n): NotificationChannel {\n const authTemplate = process.env.NOTIFICATIONS_SLACK_WEBHOOK_AUTH;\n return {\n name: \"slack\",\n async deliver(input, meta) {\n const overrideUrlTemplate = deliveryMetadataString(\n input.metadata,\n \"slackWebhookUrl\",\n );\n const urlTemplate =\n overrideUrlTemplate ??\n metadataString(input.metadata, \"slackWebhookUrl\") ??\n envUrlTemplate?.trim();\n if (!urlTemplate) return false;\n const { url, headers, assertUrlAllowed } = await resolveWebhookRequest(\n urlTemplate,\n overrideUrlTemplate ? undefined : authTemplate,\n meta.owner,\n \"Slack webhook\",\n );\n const res = await ssrfSafeFetch(\n url,\n {\n method: \"POST\",\n headers,\n body: JSON.stringify({\n text: slackText(input.severity, input.title, input.body),\n blocks: [\n {\n type: \"section\",\n text: {\n type: \"mrkdwn\",\n text: `*${escapeSlack(input.title)}*`,\n },\n },\n ...(input.body\n ? [\n {\n type: \"section\",\n text: {\n type: \"mrkdwn\",\n text: escapeSlack(input.body),\n },\n },\n ]\n : []),\n {\n type: \"context\",\n elements: [\n {\n type: \"mrkdwn\",\n text: `Severity: \\`${input.severity}\\` Owner: ${escapeSlack(meta.owner)}`,\n },\n ],\n },\n ],\n }),\n },\n { maxRedirects: 3, assertUrlAllowed },\n );\n if (!res.ok) {\n throw new Error(\n `[notifications] Slack webhook ${new URL(url).origin} returned ${res.status}${\n (await readErrorSnippet(res)) || \"\"\n }`,\n );\n }\n },\n };\n}\n\nfunction createEmailChannel(): NotificationChannel {\n return {\n name: \"email\",\n async deliver(input) {\n const recipients = notificationEmailRecipients(input.metadata);\n if (recipients.length === 0) return false;\n const subject =\n typeof input.metadata?.emailSubject === \"string\" &&\n input.metadata.emailSubject.trim()\n ? input.metadata.emailSubject.trim()\n : `[${input.severity}] ${input.title}`;\n const text = `${input.title}\\n\\n${input.body ?? \"\"}`;\n const html = [\n `<p><strong>${escapeHtml(input.title)}</strong></p>`,\n input.body ? `<p>${escapeHtml(input.body)}</p>` : \"\",\n ].join(\"\");\n\n await Promise.all(\n recipients.map((to) =>\n sendEmail({\n to,\n subject,\n text,\n html,\n }),\n ),\n );\n },\n };\n}\n\nasync function resolveWebhookRequest(\n urlTemplate: string,\n authTemplate: string | undefined,\n owner: string,\n label: string,\n): Promise<{\n url: string;\n headers: Record<string, string>;\n assertUrlAllowed: (url: string) => void;\n}> {\n // Resolve `${keys.NAME}` references through the same request-scope\n // cascade already used by extension fetches (extensions/routes.ts) and\n // automation connector headers (automation/index.ts): user scope first\n // (a personal override always wins), then the active org scope — where\n // the Dispatch vault syncs workspace secrets — then workspace scope.\n // Org/workspace vault rows are write-gated (org-admin + Dispatch vault\n // UI), so reading them here is safe by default; this is unrelated to the\n // opt-in-only user→workspace fallback in resolveKeyReferences (audit 05\n // H2 in secrets/substitution.ts), which stays off. In headless contexts\n // (e.g. a scheduled monitor check) getRequestOrgId() may be unset, in\n // which case the cascade checks user + solo-workspace scopes only — a\n // strict superset of the previous user-scope-only behavior.\n // Missing keys throw — the error surfaces in logs and the channel is marked\n // un-delivered, but other channels still run.\n const urlResult = await resolveKeyReferencesWithRequestScopes(\n urlTemplate,\n owner,\n );\n const url = urlResult.resolved;\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n };\n let authResult:\n | Awaited<ReturnType<typeof resolveKeyReferencesWithRequestScopes>>\n | undefined;\n if (authTemplate) {\n authResult = await resolveKeyReferencesWithRequestScopes(\n authTemplate,\n owner,\n );\n headers.Authorization = authResult.resolved;\n }\n\n // If the user set an allowlist on a referenced key, enforce it here —\n // origin-level check, same rule the automations fetch-tool applies.\n // Validate URL and Authorization keys independently so an allowlisted auth\n // token cannot be sent to a metadata-provided destination. Keep scope in the\n // dedupe key because the same key name can resolve at a different scope if a\n // credential changes between the two substitutions.\n type ResolvedKey = NonNullable<typeof urlResult.resolvedKeys>[number];\n const keyUsages = new Map<\n string,\n { name: string; resolvedKey?: ResolvedKey }\n >();\n for (const result of authResult ? [urlResult, authResult] : [urlResult]) {\n for (const name of result.usedKeys) {\n const resolved = (result.resolvedKeys ?? []).filter(\n (ref) => ref.name === name,\n );\n if (resolved.length === 0) {\n keyUsages.set(`user:${owner}:${name}`, { name });\n continue;\n }\n for (const resolvedKey of resolved) {\n keyUsages.set(`${resolvedKey.scope}:${resolvedKey.scopeId}:${name}`, {\n name,\n resolvedKey,\n });\n }\n }\n }\n const usages = Array.from(keyUsages.values());\n const allowlists = await Promise.all(\n usages.map(({ name, resolvedKey }) =>\n resolvedKey\n ? getResolvedKeyAllowlist(resolvedKey)\n : getKeyAllowlist(name, \"user\", owner),\n ),\n );\n const assertUrlAllowed = (candidateUrl: string): void => {\n usages.forEach(({ name }, i) => {\n if (!validateUrlAllowlist(candidateUrl, allowlists[i])) {\n throw new Error(\n `[notifications] ${label} URL ${new URL(candidateUrl).origin} is not in the allowlist for key \"${name}\"`,\n );\n }\n });\n };\n assertUrlAllowed(url);\n return { url, headers, assertUrlAllowed };\n}\n\nfunction metadataString(\n metadata: NotificationInput[\"metadata\"],\n key: string,\n): string | undefined {\n const value = metadata?.[key];\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n return trimmed || undefined;\n}\n\nfunction deliveryMetadataString(\n metadata: NotificationInput[\"metadata\"],\n key: string,\n): string | undefined {\n const delivery = metadata?.delivery;\n if (!delivery || typeof delivery !== \"object\" || Array.isArray(delivery)) {\n return undefined;\n }\n const value = (delivery as Record<string, unknown>)[key];\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n return trimmed || undefined;\n}\n\nfunction scrubDeliveryMetadata(\n metadata: Record<string, unknown> | undefined,\n): Record<string, unknown> | undefined {\n if (!metadata) return undefined;\n const entries = Object.entries(metadata).filter(\n ([key]) =>\n key !== \"delivery\" && key !== \"webhookUrl\" && key !== \"slackWebhookUrl\",\n );\n return entries.length ? Object.fromEntries(entries) : undefined;\n}\n\nfunction notificationEmailRecipients(\n metadata: Record<string, unknown> | undefined,\n): string[] {\n const fromMetadata = stringArray(metadata?.emailRecipients);\n const fromEnv = commaList(process.env.NOTIFICATIONS_EMAIL_RECIPIENTS);\n const seen = new Set<string>();\n const recipients: string[] = [];\n for (const raw of [...fromMetadata, ...fromEnv]) {\n const email = raw.trim().toLowerCase();\n if (!email || seen.has(email)) continue;\n seen.add(email);\n recipients.push(email);\n }\n return recipients;\n}\n\nfunction stringArray(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n return value.filter((item): item is string => typeof item === \"string\");\n}\n\nfunction commaList(value: string | undefined): string[] {\n return value\n ? value\n .split(\",\")\n .map((item) => item.trim())\n .filter(Boolean)\n : [];\n}\n\nfunction slackText(\n severity: string,\n title: string,\n body: string | undefined,\n): string {\n return `[${severity}] ${title}${body ? `\\n${body}` : \"\"}`;\n}\n\nfunction escapeSlack(value: string): string {\n return value\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\");\n}\n\nfunction escapeHtml(value: string): string {\n return value\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\");\n}\n\n/**\n * Read up to ~1 KB from the body for error context. Streams chunks so a\n * misbehaving endpoint returning a large error page doesn't pin that whole\n * payload in memory per failed webhook.\n */\nasync function readErrorSnippet(res: Response): Promise<string> {\n const reader = res.body?.getReader();\n if (!reader) return \"\";\n const decoder = new TextDecoder();\n const MAX = 1024;\n let buf = \"\";\n try {\n while (buf.length < MAX) {\n const { value, done } = await reader.read();\n if (done) break;\n buf += decoder.decode(value, { stream: true });\n }\n reader.cancel().catch(() => {});\n } catch {\n return \"\";\n }\n if (!buf) return \"\";\n return `: ${buf.slice(0, 200)}`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"channels.js","sourceRoot":"","sources":["../../src/notifications/channels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,qCAAqC,EACrC,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAA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,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;IACrC,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,MAAM,GAAG,GAAG,IAAI,CAAC;IACjB,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,CAAC;QACH,OAAO,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;YACxB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAC5C,IAAI,IAAI;gBAAE,MAAM;YAChB,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACjD,CAAC;QACD,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,OAAO,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AAClC,CAAC","sourcesContent":["/**\n * Built-in notification channels.\n *\n * Webhook and Slack are always registered. Delivery uses (in order):\n * 1. per-notification `metadata.webhookUrl` / `metadata.slackWebhookUrl`\n * 2. the matching `NOTIFICATIONS_*` env URL (workspace default)\n * If neither is set, that channel no-ops for the emission.\n *\n * Extra channels can be registered at any time via\n * `registerNotificationChannel()` from a server plugin.\n *\n * NOTIFICATIONS_WEBHOOK_URL → default POST JSON URL when metadata omits one.\n * Supports `${keys.NAME}` substitution — the raw\n * value never enters the agent context.\n * NOTIFICATIONS_WEBHOOK_AUTH → optional `Authorization` header value (also\n * supports `${keys.NAME}`).\n * NOTIFICATIONS_SLACK_WEBHOOK_URL\n * → default Slack incoming webhook when metadata\n * omits `slackWebhookUrl`.\n * Supports `${keys.NAME}` substitution.\n * NOTIFICATIONS_EMAIL_CHANNEL=1\n * → enable the built-in email channel for\n * per-notification recipients.\n * NOTIFICATIONS_EMAIL_RECIPIENTS\n * → comma-separated fallback recipients for email\n * notifications that do not pass\n * `metadata.emailRecipients`.\n */\n\nimport { ssrfSafeFetch } from \"../extensions/url-safety.js\";\nimport { escapeSlackMrkdwn } from \"../integrations/webhook-delivery.js\";\nimport {\n getKeyAllowlist,\n getResolvedKeyAllowlist,\n resolveKeyReferencesWithRequestScopes,\n validateUrlAllowlist,\n} from \"../secrets/substitution.js\";\nimport { sendEmail } from \"../server/email.js\";\nimport { registerNotificationChannel } from \"./registry.js\";\nimport type { NotificationChannel, NotificationInput } from \"./types.js\";\n\nlet _registered = false;\n\nexport function registerBuiltinNotificationChannels(): void {\n if (_registered) return;\n _registered = true;\n\n registerNotificationChannel(\n createWebhookChannel(process.env.NOTIFICATIONS_WEBHOOK_URL),\n );\n registerNotificationChannel(\n createSlackWebhookChannel(process.env.NOTIFICATIONS_SLACK_WEBHOOK_URL),\n );\n // Email is always registered so per-notification `metadata.emailRecipients`\n // work without a workspace-wide env flag (same pattern as webhook/slack).\n registerNotificationChannel(createEmailChannel());\n}\n\nfunction createWebhookChannel(\n envUrlTemplate: string | undefined,\n): NotificationChannel {\n const authTemplate = process.env.NOTIFICATIONS_WEBHOOK_AUTH;\n return {\n name: \"webhook\",\n async deliver(input, meta) {\n const overrideUrlTemplate = deliveryMetadataString(\n input.metadata,\n \"webhookUrl\",\n );\n const urlTemplate =\n overrideUrlTemplate ??\n metadataString(input.metadata, \"webhookUrl\") ??\n envUrlTemplate?.trim();\n // No-op when neither a per-notification nor workspace URL is set —\n // mirrors email's empty-recipients behavior so notify-all stays quiet.\n if (!urlTemplate) return false;\n const { url, headers, assertUrlAllowed } = await resolveWebhookRequest(\n urlTemplate,\n overrideUrlTemplate ? undefined : authTemplate,\n meta.owner,\n \"webhook\",\n );\n const res = await ssrfSafeFetch(\n url,\n {\n method: \"POST\",\n headers,\n body: JSON.stringify({\n severity: input.severity,\n title: input.title,\n body: input.body,\n metadata: scrubDeliveryMetadata(input.metadata),\n owner: meta.owner,\n emittedAt: new Date().toISOString(),\n }),\n },\n { maxRedirects: 3, assertUrlAllowed },\n );\n if (!res.ok) {\n throw new Error(\n `[notifications] webhook ${new URL(url).origin} returned ${res.status}${\n (await readErrorSnippet(res)) || \"\"\n }`,\n );\n }\n },\n };\n}\n\nfunction createSlackWebhookChannel(\n envUrlTemplate: string | undefined,\n): NotificationChannel {\n const authTemplate = process.env.NOTIFICATIONS_SLACK_WEBHOOK_AUTH;\n return {\n name: \"slack\",\n async deliver(input, meta) {\n const overrideUrlTemplate = deliveryMetadataString(\n input.metadata,\n \"slackWebhookUrl\",\n );\n const urlTemplate =\n overrideUrlTemplate ??\n metadataString(input.metadata, \"slackWebhookUrl\") ??\n envUrlTemplate?.trim();\n if (!urlTemplate) return false;\n const { url, headers, assertUrlAllowed } = await resolveWebhookRequest(\n urlTemplate,\n overrideUrlTemplate ? undefined : authTemplate,\n meta.owner,\n \"Slack webhook\",\n );\n const res = await ssrfSafeFetch(\n url,\n {\n method: \"POST\",\n headers,\n body: JSON.stringify({\n text: slackText(input.severity, input.title, input.body),\n blocks: [\n {\n type: \"section\",\n text: {\n type: \"mrkdwn\",\n text: `*${escapeSlackMrkdwn(input.title)}*`,\n },\n },\n ...(input.body\n ? [\n {\n type: \"section\",\n text: {\n type: \"mrkdwn\",\n text: escapeSlackMrkdwn(input.body),\n },\n },\n ]\n : []),\n {\n type: \"context\",\n elements: [\n {\n type: \"mrkdwn\",\n text: `Severity: \\`${input.severity}\\` Owner: ${escapeSlackMrkdwn(meta.owner)}`,\n },\n ],\n },\n ],\n }),\n },\n { maxRedirects: 3, assertUrlAllowed },\n );\n if (!res.ok) {\n throw new Error(\n `[notifications] Slack webhook ${new URL(url).origin} returned ${res.status}${\n (await readErrorSnippet(res)) || \"\"\n }`,\n );\n }\n },\n };\n}\n\nfunction createEmailChannel(): NotificationChannel {\n return {\n name: \"email\",\n async deliver(input) {\n const recipients = notificationEmailRecipients(input.metadata);\n if (recipients.length === 0) return false;\n const subject =\n typeof input.metadata?.emailSubject === \"string\" &&\n input.metadata.emailSubject.trim()\n ? input.metadata.emailSubject.trim()\n : `[${input.severity}] ${input.title}`;\n const text = `${input.title}\\n\\n${input.body ?? \"\"}`;\n const html = [\n `<p><strong>${escapeHtml(input.title)}</strong></p>`,\n input.body ? `<p>${escapeHtml(input.body)}</p>` : \"\",\n ].join(\"\");\n\n await Promise.all(\n recipients.map((to) =>\n sendEmail({\n to,\n subject,\n text,\n html,\n }),\n ),\n );\n },\n };\n}\n\nasync function resolveWebhookRequest(\n urlTemplate: string,\n authTemplate: string | undefined,\n owner: string,\n label: string,\n): Promise<{\n url: string;\n headers: Record<string, string>;\n assertUrlAllowed: (url: string) => void;\n}> {\n // Resolve `${keys.NAME}` references through the same request-scope\n // cascade already used by extension fetches (extensions/routes.ts) and\n // automation connector headers (automation/index.ts): user scope first\n // (a personal override always wins), then the active org scope — where\n // the Dispatch vault syncs workspace secrets — then workspace scope.\n // Org/workspace vault rows are write-gated (org-admin + Dispatch vault\n // UI), so reading them here is safe by default; this is unrelated to the\n // opt-in-only user→workspace fallback in resolveKeyReferences (audit 05\n // H2 in secrets/substitution.ts), which stays off. In headless contexts\n // (e.g. a scheduled monitor check) getRequestOrgId() may be unset, in\n // which case the cascade checks user + solo-workspace scopes only — a\n // strict superset of the previous user-scope-only behavior.\n // Missing keys throw — the error surfaces in logs and the channel is marked\n // un-delivered, but other channels still run.\n const urlResult = await resolveKeyReferencesWithRequestScopes(\n urlTemplate,\n owner,\n );\n const url = urlResult.resolved;\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n };\n let authResult:\n | Awaited<ReturnType<typeof resolveKeyReferencesWithRequestScopes>>\n | undefined;\n if (authTemplate) {\n authResult = await resolveKeyReferencesWithRequestScopes(\n authTemplate,\n owner,\n );\n headers.Authorization = authResult.resolved;\n }\n\n // If the user set an allowlist on a referenced key, enforce it here —\n // origin-level check, same rule the automations fetch-tool applies.\n // Validate URL and Authorization keys independently so an allowlisted auth\n // token cannot be sent to a metadata-provided destination. Keep scope in the\n // dedupe key because the same key name can resolve at a different scope if a\n // credential changes between the two substitutions.\n type ResolvedKey = NonNullable<typeof urlResult.resolvedKeys>[number];\n const keyUsages = new Map<\n string,\n { name: string; resolvedKey?: ResolvedKey }\n >();\n for (const result of authResult ? [urlResult, authResult] : [urlResult]) {\n for (const name of result.usedKeys) {\n const resolved = (result.resolvedKeys ?? []).filter(\n (ref) => ref.name === name,\n );\n if (resolved.length === 0) {\n keyUsages.set(`user:${owner}:${name}`, { name });\n continue;\n }\n for (const resolvedKey of resolved) {\n keyUsages.set(`${resolvedKey.scope}:${resolvedKey.scopeId}:${name}`, {\n name,\n resolvedKey,\n });\n }\n }\n }\n const usages = Array.from(keyUsages.values());\n const allowlists = await Promise.all(\n usages.map(({ name, resolvedKey }) =>\n resolvedKey\n ? getResolvedKeyAllowlist(resolvedKey)\n : getKeyAllowlist(name, \"user\", owner),\n ),\n );\n const assertUrlAllowed = (candidateUrl: string): void => {\n usages.forEach(({ name }, i) => {\n if (!validateUrlAllowlist(candidateUrl, allowlists[i])) {\n throw new Error(\n `[notifications] ${label} URL ${new URL(candidateUrl).origin} is not in the allowlist for key \"${name}\"`,\n );\n }\n });\n };\n assertUrlAllowed(url);\n return { url, headers, assertUrlAllowed };\n}\n\nfunction metadataString(\n metadata: NotificationInput[\"metadata\"],\n key: string,\n): string | undefined {\n const value = metadata?.[key];\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n return trimmed || undefined;\n}\n\nfunction deliveryMetadataString(\n metadata: NotificationInput[\"metadata\"],\n key: string,\n): string | undefined {\n const delivery = metadata?.delivery;\n if (!delivery || typeof delivery !== \"object\" || Array.isArray(delivery)) {\n return undefined;\n }\n const value = (delivery as Record<string, unknown>)[key];\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n return trimmed || undefined;\n}\n\nfunction scrubDeliveryMetadata(\n metadata: Record<string, unknown> | undefined,\n): Record<string, unknown> | undefined {\n if (!metadata) return undefined;\n const entries = Object.entries(metadata).filter(\n ([key]) =>\n key !== \"delivery\" && key !== \"webhookUrl\" && key !== \"slackWebhookUrl\",\n );\n return entries.length ? Object.fromEntries(entries) : undefined;\n}\n\nfunction notificationEmailRecipients(\n metadata: Record<string, unknown> | undefined,\n): string[] {\n const fromMetadata = stringArray(metadata?.emailRecipients);\n const fromEnv = commaList(process.env.NOTIFICATIONS_EMAIL_RECIPIENTS);\n const seen = new Set<string>();\n const recipients: string[] = [];\n for (const raw of [...fromMetadata, ...fromEnv]) {\n const email = raw.trim().toLowerCase();\n if (!email || seen.has(email)) continue;\n seen.add(email);\n recipients.push(email);\n }\n return recipients;\n}\n\nfunction stringArray(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n return value.filter((item): item is string => typeof item === \"string\");\n}\n\nfunction commaList(value: string | undefined): string[] {\n return value\n ? value\n .split(\",\")\n .map((item) => item.trim())\n .filter(Boolean)\n : [];\n}\n\nfunction slackText(\n severity: string,\n title: string,\n body: string | undefined,\n): string {\n return `[${severity}] ${title}${body ? `\\n${body}` : \"\"}`;\n}\n\nfunction escapeHtml(value: string): string {\n return value\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\");\n}\n\n/**\n * Read up to ~1 KB from the body for error context. Streams chunks so a\n * misbehaving endpoint returning a large error page doesn't pin that whole\n * payload in memory per failed webhook.\n */\nasync function readErrorSnippet(res: Response): Promise<string> {\n const reader = res.body?.getReader();\n if (!reader) return \"\";\n const decoder = new TextDecoder();\n const MAX = 1024;\n let buf = \"\";\n try {\n while (buf.length < MAX) {\n const { value, done } = await reader.read();\n if (done) break;\n buf += decoder.decode(value, { stream: true });\n }\n reader.cancel().catch(() => {});\n } catch {\n return \"\";\n }\n if (!buf) return \"\";\n return `: ${buf.slice(0, 200)}`;\n}\n"]}
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
export declare function createNotificationsHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<"" | import("./types.js").Notification[] | {
|
|
14
14
|
count: number;
|
|
15
15
|
updated?: undefined;
|
|
16
|
-
error?: undefined;
|
|
17
16
|
ok?: undefined;
|
|
17
|
+
error?: undefined;
|
|
18
18
|
} | {
|
|
19
19
|
count?: undefined;
|
|
20
20
|
updated: number;
|
|
21
|
-
error?: undefined;
|
|
22
21
|
ok?: undefined;
|
|
22
|
+
error?: undefined;
|
|
23
23
|
} | {
|
|
24
24
|
count?: undefined;
|
|
25
25
|
updated?: undefined;
|
|
@@ -28,7 +28,7 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
|
|
|
28
28
|
} | {
|
|
29
29
|
count?: undefined;
|
|
30
30
|
updated?: undefined;
|
|
31
|
-
error?: undefined;
|
|
32
31
|
ok: boolean;
|
|
32
|
+
error?: undefined;
|
|
33
33
|
}>>;
|
|
34
34
|
//# sourceMappingURL=routes.d.ts.map
|