@cursor/bdk 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +341 -0
- package/LICENSE.md +3 -0
- package/README.md +1190 -0
- package/dist/artifacts.d.ts +34 -0
- package/dist/artifacts.d.ts.map +1 -0
- package/dist/artifacts.js +51 -0
- package/dist/bin/agent-sdk.js +2 -0
- package/dist/bin/agent-serve.d.ts +19 -0
- package/dist/bin/agent-serve.d.ts.map +1 -0
- package/dist/bin/agent-serve.js +1578 -0
- package/dist/channels/bitbucket/api.d.ts +217 -0
- package/dist/channels/bitbucket/api.d.ts.map +1 -0
- package/dist/channels/bitbucket/api.js +664 -0
- package/dist/channels/bitbucket/binding.d.ts +75 -0
- package/dist/channels/bitbucket/binding.d.ts.map +1 -0
- package/dist/channels/bitbucket/binding.js +277 -0
- package/dist/channels/bitbucket/bitbucket-channel.d.ts +33 -0
- package/dist/channels/bitbucket/bitbucket-channel.d.ts.map +1 -0
- package/dist/channels/bitbucket/bitbucket-channel.js +120 -0
- package/dist/channels/bitbucket/bitbucket-webhook.d.ts +61 -0
- package/dist/channels/bitbucket/bitbucket-webhook.d.ts.map +1 -0
- package/dist/channels/bitbucket/bitbucket-webhook.js +384 -0
- package/dist/channels/bitbucket/checks.d.ts +67 -0
- package/dist/channels/bitbucket/checks.d.ts.map +1 -0
- package/dist/channels/bitbucket/checks.js +102 -0
- package/dist/channels/bitbucket/cursor-account.d.ts +37 -0
- package/dist/channels/bitbucket/cursor-account.d.ts.map +1 -0
- package/dist/channels/bitbucket/cursor-account.js +65 -0
- package/dist/channels/bitbucket/defaults.d.ts +26 -0
- package/dist/channels/bitbucket/defaults.d.ts.map +1 -0
- package/dist/channels/bitbucket/defaults.js +67 -0
- package/dist/channels/bitbucket/events.d.ts +22 -0
- package/dist/channels/bitbucket/events.d.ts.map +1 -0
- package/dist/channels/bitbucket/events.js +60 -0
- package/dist/channels/bitbucket/index.d.ts +34 -0
- package/dist/channels/bitbucket/index.d.ts.map +1 -0
- package/dist/channels/bitbucket/index.js +33 -0
- package/dist/channels/bitbucket/replay.d.ts +63 -0
- package/dist/channels/bitbucket/replay.d.ts.map +1 -0
- package/dist/channels/bitbucket/replay.js +302 -0
- package/dist/channels/bitbucket/state.d.ts +35 -0
- package/dist/channels/bitbucket/state.d.ts.map +1 -0
- package/dist/channels/bitbucket/state.js +21 -0
- package/dist/channels/bitbucket/types.d.ts +227 -0
- package/dist/channels/bitbucket/types.d.ts.map +1 -0
- package/dist/channels/bitbucket/types.js +1 -0
- package/dist/channels/change-monitors/change-monitors-channel.d.ts +5 -0
- package/dist/channels/change-monitors/change-monitors-channel.d.ts.map +1 -0
- package/dist/channels/change-monitors/change-monitors-channel.js +45 -0
- package/dist/channels/change-monitors/index.d.ts +4 -0
- package/dist/channels/change-monitors/index.d.ts.map +1 -0
- package/dist/channels/change-monitors/index.js +2 -0
- package/dist/channels/change-monitors/types.d.ts +42 -0
- package/dist/channels/change-monitors/types.d.ts.map +1 -0
- package/dist/channels/change-monitors/types.js +1 -0
- package/dist/channels/checks.d.ts +121 -0
- package/dist/channels/checks.d.ts.map +1 -0
- package/dist/channels/checks.js +86 -0
- package/dist/channels/deployments/deployments-channel.d.ts +95 -0
- package/dist/channels/deployments/deployments-channel.d.ts.map +1 -0
- package/dist/channels/deployments/deployments-channel.js +196 -0
- package/dist/channels/deployments/index.d.ts +25 -0
- package/dist/channels/deployments/index.d.ts.map +1 -0
- package/dist/channels/deployments/index.js +24 -0
- package/dist/channels/deployments/types.d.ts +83 -0
- package/dist/channels/deployments/types.d.ts.map +1 -0
- package/dist/channels/deployments/types.js +7 -0
- package/dist/channels/github/api.d.ts +133 -0
- package/dist/channels/github/api.d.ts.map +1 -0
- package/dist/channels/github/api.js +320 -0
- package/dist/channels/github/auth.d.ts +67 -0
- package/dist/channels/github/auth.d.ts.map +1 -0
- package/dist/channels/github/auth.js +233 -0
- package/dist/channels/github/binding.d.ts +86 -0
- package/dist/channels/github/binding.d.ts.map +1 -0
- package/dist/channels/github/binding.js +114 -0
- package/dist/channels/github/checks.d.ts +64 -0
- package/dist/channels/github/checks.d.ts.map +1 -0
- package/dist/channels/github/checks.js +98 -0
- package/dist/channels/github/cursor-account.d.ts +102 -0
- package/dist/channels/github/cursor-account.d.ts.map +1 -0
- package/dist/channels/github/cursor-account.js +194 -0
- package/dist/channels/github/defaults.d.ts +23 -0
- package/dist/channels/github/defaults.d.ts.map +1 -0
- package/dist/channels/github/defaults.js +157 -0
- package/dist/channels/github/events.d.ts +18 -0
- package/dist/channels/github/events.d.ts.map +1 -0
- package/dist/channels/github/events.js +56 -0
- package/dist/channels/github/forward.d.ts +139 -0
- package/dist/channels/github/forward.d.ts.map +1 -0
- package/dist/channels/github/forward.js +267 -0
- package/dist/channels/github/github-channel.d.ts +146 -0
- package/dist/channels/github/github-channel.d.ts.map +1 -0
- package/dist/channels/github/github-channel.js +1804 -0
- package/dist/channels/github/index.d.ts +54 -0
- package/dist/channels/github/index.d.ts.map +1 -0
- package/dist/channels/github/index.js +53 -0
- package/dist/channels/github/progress.d.ts +84 -0
- package/dist/channels/github/progress.d.ts.map +1 -0
- package/dist/channels/github/progress.js +236 -0
- package/dist/channels/github/replay.d.ts +115 -0
- package/dist/channels/github/replay.d.ts.map +1 -0
- package/dist/channels/github/replay.js +278 -0
- package/dist/channels/github/state.d.ts +47 -0
- package/dist/channels/github/state.d.ts.map +1 -0
- package/dist/channels/github/state.js +53 -0
- package/dist/channels/github/types.d.ts +491 -0
- package/dist/channels/github/types.d.ts.map +1 -0
- package/dist/channels/github/types.js +1 -0
- package/dist/channels/gitlab/api.d.ts +118 -0
- package/dist/channels/gitlab/api.d.ts.map +1 -0
- package/dist/channels/gitlab/api.js +234 -0
- package/dist/channels/gitlab/binding.d.ts +63 -0
- package/dist/channels/gitlab/binding.d.ts.map +1 -0
- package/dist/channels/gitlab/binding.js +147 -0
- package/dist/channels/gitlab/checks.d.ts +110 -0
- package/dist/channels/gitlab/checks.d.ts.map +1 -0
- package/dist/channels/gitlab/checks.js +122 -0
- package/dist/channels/gitlab/cursor-account.d.ts +36 -0
- package/dist/channels/gitlab/cursor-account.d.ts.map +1 -0
- package/dist/channels/gitlab/cursor-account.js +64 -0
- package/dist/channels/gitlab/defaults.d.ts +25 -0
- package/dist/channels/gitlab/defaults.d.ts.map +1 -0
- package/dist/channels/gitlab/defaults.js +55 -0
- package/dist/channels/gitlab/events.d.ts +12 -0
- package/dist/channels/gitlab/events.d.ts.map +1 -0
- package/dist/channels/gitlab/events.js +26 -0
- package/dist/channels/gitlab/gitlab-channel.d.ts +33 -0
- package/dist/channels/gitlab/gitlab-channel.d.ts.map +1 -0
- package/dist/channels/gitlab/gitlab-channel.js +120 -0
- package/dist/channels/gitlab/gitlab-webhook.d.ts +45 -0
- package/dist/channels/gitlab/gitlab-webhook.d.ts.map +1 -0
- package/dist/channels/gitlab/gitlab-webhook.js +388 -0
- package/dist/channels/gitlab/index.d.ts +31 -0
- package/dist/channels/gitlab/index.d.ts.map +1 -0
- package/dist/channels/gitlab/index.js +30 -0
- package/dist/channels/gitlab/replay.d.ts +105 -0
- package/dist/channels/gitlab/replay.d.ts.map +1 -0
- package/dist/channels/gitlab/replay.js +199 -0
- package/dist/channels/gitlab/state.d.ts +33 -0
- package/dist/channels/gitlab/state.d.ts.map +1 -0
- package/dist/channels/gitlab/state.js +23 -0
- package/dist/channels/gitlab/types.d.ts +211 -0
- package/dist/channels/gitlab/types.d.ts.map +1 -0
- package/dist/channels/gitlab/types.js +1 -0
- package/dist/channels/issues/index.d.ts +4 -0
- package/dist/channels/issues/index.d.ts.map +1 -0
- package/dist/channels/issues/index.js +2 -0
- package/dist/channels/issues/issues-channel.d.ts +5 -0
- package/dist/channels/issues/issues-channel.d.ts.map +1 -0
- package/dist/channels/issues/issues-channel.js +35 -0
- package/dist/channels/issues/types.d.ts +33 -0
- package/dist/channels/issues/types.d.ts.map +1 -0
- package/dist/channels/issues/types.js +1 -0
- package/dist/channels/origin/api.d.ts +157 -0
- package/dist/channels/origin/api.d.ts.map +1 -0
- package/dist/channels/origin/api.js +379 -0
- package/dist/channels/origin/binding.d.ts +57 -0
- package/dist/channels/origin/binding.d.ts.map +1 -0
- package/dist/channels/origin/binding.js +57 -0
- package/dist/channels/origin/checks.d.ts +119 -0
- package/dist/channels/origin/checks.d.ts.map +1 -0
- package/dist/channels/origin/checks.js +145 -0
- package/dist/channels/origin/cursor-account.d.ts +24 -0
- package/dist/channels/origin/cursor-account.d.ts.map +1 -0
- package/dist/channels/origin/cursor-account.js +35 -0
- package/dist/channels/origin/defaults.d.ts +43 -0
- package/dist/channels/origin/defaults.d.ts.map +1 -0
- package/dist/channels/origin/defaults.js +109 -0
- package/dist/channels/origin/events.d.ts +10 -0
- package/dist/channels/origin/events.d.ts.map +1 -0
- package/dist/channels/origin/events.js +25 -0
- package/dist/channels/origin/index.d.ts +35 -0
- package/dist/channels/origin/index.d.ts.map +1 -0
- package/dist/channels/origin/index.js +34 -0
- package/dist/channels/origin/origin-channel.d.ts +72 -0
- package/dist/channels/origin/origin-channel.d.ts.map +1 -0
- package/dist/channels/origin/origin-channel.js +634 -0
- package/dist/channels/origin/origin-webhook.d.ts +69 -0
- package/dist/channels/origin/origin-webhook.d.ts.map +1 -0
- package/dist/channels/origin/origin-webhook.js +231 -0
- package/dist/channels/origin/reactions.d.ts +56 -0
- package/dist/channels/origin/reactions.d.ts.map +1 -0
- package/dist/channels/origin/reactions.js +58 -0
- package/dist/channels/origin/state.d.ts +32 -0
- package/dist/channels/origin/state.d.ts.map +1 -0
- package/dist/channels/origin/state.js +23 -0
- package/dist/channels/origin/types.d.ts +257 -0
- package/dist/channels/origin/types.d.ts.map +1 -0
- package/dist/channels/origin/types.js +1 -0
- package/dist/channels/slack/agentic-delivery.d.ts +23 -0
- package/dist/channels/slack/agentic-delivery.d.ts.map +1 -0
- package/dist/channels/slack/agentic-delivery.js +566 -0
- package/dist/channels/slack/agentic-posted.d.ts +30 -0
- package/dist/channels/slack/agentic-posted.d.ts.map +1 -0
- package/dist/channels/slack/agentic-posted.js +102 -0
- package/dist/channels/slack/agentic-signals.d.ts +48 -0
- package/dist/channels/slack/agentic-signals.d.ts.map +1 -0
- package/dist/channels/slack/agentic-signals.js +199 -0
- package/dist/channels/slack/api.d.ts +171 -0
- package/dist/channels/slack/api.d.ts.map +1 -0
- package/dist/channels/slack/api.js +613 -0
- package/dist/channels/slack/approvals.d.ts +48 -0
- package/dist/channels/slack/approvals.d.ts.map +1 -0
- package/dist/channels/slack/approvals.js +233 -0
- package/dist/channels/slack/assistant.d.ts +23 -0
- package/dist/channels/slack/assistant.d.ts.map +1 -0
- package/dist/channels/slack/assistant.js +67 -0
- package/dist/channels/slack/attachments.d.ts +82 -0
- package/dist/channels/slack/attachments.d.ts.map +1 -0
- package/dist/channels/slack/attachments.js +503 -0
- package/dist/channels/slack/auth.d.ts +46 -0
- package/dist/channels/slack/auth.d.ts.map +1 -0
- package/dist/channels/slack/auth.js +95 -0
- package/dist/channels/slack/blocks.d.ts +61 -0
- package/dist/channels/slack/blocks.d.ts.map +1 -0
- package/dist/channels/slack/blocks.js +90 -0
- package/dist/channels/slack/bot-mentions.d.ts +108 -0
- package/dist/channels/slack/bot-mentions.d.ts.map +1 -0
- package/dist/channels/slack/bot-mentions.js +257 -0
- package/dist/channels/slack/channel-watch.d.ts +76 -0
- package/dist/channels/slack/channel-watch.d.ts.map +1 -0
- package/dist/channels/slack/channel-watch.js +264 -0
- package/dist/channels/slack/cli-project.d.ts +19 -0
- package/dist/channels/slack/cli-project.d.ts.map +1 -0
- package/dist/channels/slack/cli-project.js +228 -0
- package/dist/channels/slack/code-fences.d.ts +17 -0
- package/dist/channels/slack/code-fences.d.ts.map +1 -0
- package/dist/channels/slack/code-fences.js +166 -0
- package/dist/channels/slack/constants.d.ts +25 -0
- package/dist/channels/slack/constants.d.ts.map +1 -0
- package/dist/channels/slack/constants.js +35 -0
- package/dist/channels/slack/credentials.d.ts +35 -0
- package/dist/channels/slack/credentials.d.ts.map +1 -0
- package/dist/channels/slack/credentials.js +88 -0
- package/dist/channels/slack/defaults.d.ts +50 -0
- package/dist/channels/slack/defaults.d.ts.map +1 -0
- package/dist/channels/slack/defaults.js +630 -0
- package/dist/channels/slack/dispatch.d.ts +141 -0
- package/dist/channels/slack/dispatch.d.ts.map +1 -0
- package/dist/channels/slack/dispatch.js +730 -0
- package/dist/channels/slack/doctor.d.ts +40 -0
- package/dist/channels/slack/doctor.d.ts.map +1 -0
- package/dist/channels/slack/doctor.js +291 -0
- package/dist/channels/slack/eval-directive.d.ts +59 -0
- package/dist/channels/slack/eval-directive.d.ts.map +1 -0
- package/dist/channels/slack/eval-directive.js +269 -0
- package/dist/channels/slack/event-id-dedupe.d.ts +10 -0
- package/dist/channels/slack/event-id-dedupe.d.ts.map +1 -0
- package/dist/channels/slack/event-id-dedupe.js +23 -0
- package/dist/channels/slack/external-policy.d.ts +28 -0
- package/dist/channels/slack/external-policy.d.ts.map +1 -0
- package/dist/channels/slack/external-policy.js +64 -0
- package/dist/channels/slack/footer.d.ts +33 -0
- package/dist/channels/slack/footer.d.ts.map +1 -0
- package/dist/channels/slack/footer.js +85 -0
- package/dist/channels/slack/inbound.d.ts +98 -0
- package/dist/channels/slack/inbound.d.ts.map +1 -0
- package/dist/channels/slack/inbound.js +314 -0
- package/dist/channels/slack/index.d.ts +53 -0
- package/dist/channels/slack/index.d.ts.map +1 -0
- package/dist/channels/slack/index.js +52 -0
- package/dist/channels/slack/init.d.ts +45 -0
- package/dist/channels/slack/init.d.ts.map +1 -0
- package/dist/channels/slack/init.js +126 -0
- package/dist/channels/slack/interactive.d.ts +65 -0
- package/dist/channels/slack/interactive.d.ts.map +1 -0
- package/dist/channels/slack/interactive.js +310 -0
- package/dist/channels/slack/links.d.ts +10 -0
- package/dist/channels/slack/links.d.ts.map +1 -0
- package/dist/channels/slack/links.js +19 -0
- package/dist/channels/slack/live-delivery.d.ts +77 -0
- package/dist/channels/slack/live-delivery.d.ts.map +1 -0
- package/dist/channels/slack/live-delivery.js +399 -0
- package/dist/channels/slack/log.d.ts +25 -0
- package/dist/channels/slack/log.d.ts.map +1 -0
- package/dist/channels/slack/log.js +44 -0
- package/dist/channels/slack/manifest.d.ts +80 -0
- package/dist/channels/slack/manifest.d.ts.map +1 -0
- package/dist/channels/slack/manifest.js +159 -0
- package/dist/channels/slack/message-body.d.ts +13 -0
- package/dist/channels/slack/message-body.d.ts.map +1 -0
- package/dist/channels/slack/message-body.js +74 -0
- package/dist/channels/slack/nudge-carrier.d.ts +21 -0
- package/dist/channels/slack/nudge-carrier.d.ts.map +1 -0
- package/dist/channels/slack/nudge-carrier.js +213 -0
- package/dist/channels/slack/nudge-store.d.ts +77 -0
- package/dist/channels/slack/nudge-store.d.ts.map +1 -0
- package/dist/channels/slack/nudge-store.js +315 -0
- package/dist/channels/slack/paint-start.d.ts +22 -0
- package/dist/channels/slack/paint-start.d.ts.map +1 -0
- package/dist/channels/slack/paint-start.js +91 -0
- package/dist/channels/slack/placeholder.d.ts +62 -0
- package/dist/channels/slack/placeholder.d.ts.map +1 -0
- package/dist/channels/slack/placeholder.js +266 -0
- package/dist/channels/slack/pr-ref.d.ts +24 -0
- package/dist/channels/slack/pr-ref.d.ts.map +1 -0
- package/dist/channels/slack/pr-ref.js +55 -0
- package/dist/channels/slack/progress-delivery.d.ts +28 -0
- package/dist/channels/slack/progress-delivery.d.ts.map +1 -0
- package/dist/channels/slack/progress-delivery.js +122 -0
- package/dist/channels/slack/reasoning-card.d.ts +38 -0
- package/dist/channels/slack/reasoning-card.d.ts.map +1 -0
- package/dist/channels/slack/reasoning-card.js +103 -0
- package/dist/channels/slack/reasoning-chip.d.ts +8 -0
- package/dist/channels/slack/reasoning-chip.d.ts.map +1 -0
- package/dist/channels/slack/reasoning-chip.js +30 -0
- package/dist/channels/slack/recording-sink.d.ts +29 -0
- package/dist/channels/slack/recording-sink.d.ts.map +1 -0
- package/dist/channels/slack/recording-sink.js +140 -0
- package/dist/channels/slack/redact.d.ts +2 -0
- package/dist/channels/slack/redact.d.ts.map +1 -0
- package/dist/channels/slack/redact.js +5 -0
- package/dist/channels/slack/reply-options.d.ts +47 -0
- package/dist/channels/slack/reply-options.d.ts.map +1 -0
- package/dist/channels/slack/reply-options.js +193 -0
- package/dist/channels/slack/setup.d.ts +33 -0
- package/dist/channels/slack/setup.d.ts.map +1 -0
- package/dist/channels/slack/setup.js +101 -0
- package/dist/channels/slack/slack-channel.d.ts +43 -0
- package/dist/channels/slack/slack-channel.d.ts.map +1 -0
- package/dist/channels/slack/slack-channel.js +534 -0
- package/dist/channels/slack/socket-mode.d.ts +26 -0
- package/dist/channels/slack/socket-mode.d.ts.map +1 -0
- package/dist/channels/slack/socket-mode.js +114 -0
- package/dist/channels/slack/stop.d.ts +14 -0
- package/dist/channels/slack/stop.d.ts.map +1 -0
- package/dist/channels/slack/stop.js +22 -0
- package/dist/channels/slack/stream.d.ts +38 -0
- package/dist/channels/slack/stream.d.ts.map +1 -0
- package/dist/channels/slack/stream.js +30 -0
- package/dist/channels/slack/thread-context.d.ts +79 -0
- package/dist/channels/slack/thread-context.d.ts.map +1 -0
- package/dist/channels/slack/thread-context.js +396 -0
- package/dist/channels/slack/tool-approval-events.d.ts +38 -0
- package/dist/channels/slack/tool-approval-events.d.ts.map +1 -0
- package/dist/channels/slack/tool-approval-events.js +224 -0
- package/dist/channels/slack/tool-cards.d.ts +22 -0
- package/dist/channels/slack/tool-cards.d.ts.map +1 -0
- package/dist/channels/slack/tool-cards.js +172 -0
- package/dist/channels/slack/tool-chip.d.ts +9 -0
- package/dist/channels/slack/tool-chip.d.ts.map +1 -0
- package/dist/channels/slack/tool-chip.js +23 -0
- package/dist/channels/slack/types.d.ts +751 -0
- package/dist/channels/slack/types.d.ts.map +1 -0
- package/dist/channels/slack/types.js +4 -0
- package/dist/channels/slack/upload.d.ts +13 -0
- package/dist/channels/slack/upload.d.ts.map +1 -0
- package/dist/channels/slack/upload.js +135 -0
- package/dist/channels.d.ts +175 -0
- package/dist/channels.d.ts.map +1 -0
- package/dist/channels.js +417 -0
- package/dist/connections.d.ts +131 -0
- package/dist/connections.d.ts.map +1 -0
- package/dist/connections.js +131 -0
- package/dist/dashboard-session-url.d.ts +15 -0
- package/dist/dashboard-session-url.d.ts.map +1 -0
- package/dist/dashboard-session-url.js +25 -0
- package/dist/docs/404.html +24 -0
- package/dist/docs/architecture.svg +59 -0
- package/dist/docs/assets/app.JVQvbRO-.js +309 -0
- package/dist/docs/assets/building-with-agents.md.-fcjCmJU.js +9 -0
- package/dist/docs/assets/building-with-agents.md.-fcjCmJU.lean.js +1 -0
- package/dist/docs/assets/chunks/@localSearchIndexroot.Caw9W1pM.js +1 -0
- package/dist/docs/assets/chunks/VPLocalSearchBox.BkhY63uW.js +9 -0
- package/dist/docs/assets/chunks/arc.Cc1unYd3.js +1 -0
- package/dist/docs/assets/chunks/architectureDiagram-Q4EWVU46.CAY_TPVz.js +36 -0
- package/dist/docs/assets/chunks/baseUniq.my2VD3Xm.js +1 -0
- package/dist/docs/assets/chunks/blockDiagram-DXYQGD6D.CQXAOmqd.js +132 -0
- package/dist/docs/assets/chunks/c4Diagram-AHTNJAMY.D0AsQFSX.js +10 -0
- package/dist/docs/assets/chunks/channel.Sapo9HJZ.js +1 -0
- package/dist/docs/assets/chunks/chunk-4BX2VUAB.DZjhgNls.js +1 -0
- package/dist/docs/assets/chunks/chunk-4TB4RGXK.qdcp_qbo.js +206 -0
- package/dist/docs/assets/chunks/chunk-55IACEB6.BHXoZhJ-.js +1 -0
- package/dist/docs/assets/chunks/chunk-EDXVE4YY.Cds_Vwj3.js +1 -0
- package/dist/docs/assets/chunks/chunk-FMBD7UC4.CSl0HknT.js +15 -0
- package/dist/docs/assets/chunks/chunk-OYMX7WX6.DJMvAt5N.js +231 -0
- package/dist/docs/assets/chunks/chunk-QZHKN3VN.BYQzBK9D.js +1 -0
- package/dist/docs/assets/chunks/chunk-YZCP3GAM.BAvw7N4o.js +1 -0
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.NPiy3Hz7.js +1 -0
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.NPiy3Hz7.js +1 -0
- package/dist/docs/assets/chunks/clone.zl2qolPE.js +1 -0
- package/dist/docs/assets/chunks/cose-bilkent-S5V4N54A.Buf3seya.js +1 -0
- package/dist/docs/assets/chunks/cytoscape.esm.BQk4lpUV.js +331 -0
- package/dist/docs/assets/chunks/dagre-KV5264BT.DMGGa3uA.js +4 -0
- package/dist/docs/assets/chunks/defaultLocale.C4B-KCzX.js +1 -0
- package/dist/docs/assets/chunks/diagram-5BDNPKRD.DDjnwRmY.js +10 -0
- package/dist/docs/assets/chunks/diagram-G4DWMVQ6.RwyrIr8Q.js +24 -0
- package/dist/docs/assets/chunks/diagram-MMDJMWI5.DRvQV16Z.js +43 -0
- package/dist/docs/assets/chunks/diagram-TYMM5635.Dw8W9BTk.js +24 -0
- package/dist/docs/assets/chunks/erDiagram-SMLLAGMA.DQT1Hnwf.js +85 -0
- package/dist/docs/assets/chunks/flowDiagram-DWJPFMVM.6_Aky-ut.js +162 -0
- package/dist/docs/assets/chunks/framework.BNw1pucY.js +19 -0
- package/dist/docs/assets/chunks/ganttDiagram-T4ZO3ILL.DHIwqnqN.js +292 -0
- package/dist/docs/assets/chunks/gitGraphDiagram-UUTBAWPF.CGd_eJbn.js +106 -0
- package/dist/docs/assets/chunks/graph.ChMEylkh.js +1 -0
- package/dist/docs/assets/chunks/infoDiagram-42DDH7IO.Cd4gMyAz.js +2 -0
- package/dist/docs/assets/chunks/init.Gi6I4Gst.js +1 -0
- package/dist/docs/assets/chunks/ishikawaDiagram-UXIWVN3A.D1uw7MXq.js +70 -0
- package/dist/docs/assets/chunks/journeyDiagram-VCZTEJTY.AWLXtelc.js +139 -0
- package/dist/docs/assets/chunks/kanban-definition-6JOO6SKY.CagPhAn5.js +89 -0
- package/dist/docs/assets/chunks/katex.DkKDou_j.js +257 -0
- package/dist/docs/assets/chunks/layout.ClTBBkE_.js +1 -0
- package/dist/docs/assets/chunks/linear.SwS2rOLA.js +1 -0
- package/dist/docs/assets/chunks/min.By_x-Btb.js +1 -0
- package/dist/docs/assets/chunks/mindmap-definition-QFDTVHPH.By_RAMaP.js +96 -0
- package/dist/docs/assets/chunks/ordinal.DBvzRdQf.js +1 -0
- package/dist/docs/assets/chunks/pieDiagram-DEJITSTG.DfAl9sy4.js +30 -0
- package/dist/docs/assets/chunks/quadrantDiagram-34T5L4WZ.CNuqFRBj.js +7 -0
- package/dist/docs/assets/chunks/requirementDiagram-MS252O5E.DJ5CmTCl.js +84 -0
- package/dist/docs/assets/chunks/sankeyDiagram-XADWPNL6.D-T_AKJj.js +10 -0
- package/dist/docs/assets/chunks/sequenceDiagram-FGHM5R23.BRn9WcrR.js +157 -0
- package/dist/docs/assets/chunks/stateDiagram-FHFEXIEX.F12urmm7.js +1 -0
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2._auCa3fR.js +1 -0
- package/dist/docs/assets/chunks/theme.zK3OJa_C.js +2 -0
- package/dist/docs/assets/chunks/timeline-definition-GMOUNBTQ.B7GiQBeC.js +120 -0
- package/dist/docs/assets/chunks/vennDiagram-DHZGUBPP.D0niwuY_.js +34 -0
- package/dist/docs/assets/chunks/virtual_mermaid-config.DDnGl6nM.js +1 -0
- package/dist/docs/assets/chunks/wardley-RL74JXVD.1zhHNRsx.js +162 -0
- package/dist/docs/assets/chunks/wardleyDiagram-NUSXRM2D.DKaqpT7K.js +20 -0
- package/dist/docs/assets/chunks/xychartDiagram-5P7HB3ND.e8BPicch.js +7 -0
- package/dist/docs/assets/deployment.md.nGo1yIsa.js +32 -0
- package/dist/docs/assets/deployment.md.nGo1yIsa.lean.js +1 -0
- package/dist/docs/assets/evals.md.CCAtNcuL.js +72 -0
- package/dist/docs/assets/evals.md.CCAtNcuL.lean.js +1 -0
- package/dist/docs/assets/guides_agent-to-agent.md.CGkicXeB.js +41 -0
- package/dist/docs/assets/guides_agent-to-agent.md.CGkicXeB.lean.js +1 -0
- package/dist/docs/assets/guides_bitbucket.md.Cb3LPKt3.js +145 -0
- package/dist/docs/assets/guides_bitbucket.md.Cb3LPKt3.lean.js +1 -0
- package/dist/docs/assets/guides_cloud-agents.md.BuEkDCwo.js +10 -0
- package/dist/docs/assets/guides_cloud-agents.md.BuEkDCwo.lean.js +1 -0
- package/dist/docs/assets/guides_convert-automation.md.Ci-Y2iD5.js +43 -0
- package/dist/docs/assets/guides_convert-automation.md.Ci-Y2iD5.lean.js +1 -0
- package/dist/docs/assets/guides_github.md.C2_DSWlE.js +156 -0
- package/dist/docs/assets/guides_github.md.C2_DSWlE.lean.js +1 -0
- package/dist/docs/assets/guides_gitlab.md.BM27P43u.js +153 -0
- package/dist/docs/assets/guides_gitlab.md.BM27P43u.lean.js +1 -0
- package/dist/docs/assets/guides_grokbot-agents.md.yxVbSlKA.js +16 -0
- package/dist/docs/assets/guides_grokbot-agents.md.yxVbSlKA.lean.js +1 -0
- package/dist/docs/assets/guides_hooks.md.BWoiNaMq.js +50 -0
- package/dist/docs/assets/guides_hooks.md.BWoiNaMq.lean.js +1 -0
- package/dist/docs/assets/guides_improve.md.COtL-6ft.js +22 -0
- package/dist/docs/assets/guides_improve.md.COtL-6ft.lean.js +1 -0
- package/dist/docs/assets/guides_jev.md.BNDm14Gy.js +151 -0
- package/dist/docs/assets/guides_jev.md.BNDm14Gy.lean.js +1 -0
- package/dist/docs/assets/guides_mcp-oauth.md.Cu6mhZ_3.js +50 -0
- package/dist/docs/assets/guides_mcp-oauth.md.Cu6mhZ_3.lean.js +1 -0
- package/dist/docs/assets/guides_opentelemetry.md.DLlIB5rv.js +35 -0
- package/dist/docs/assets/guides_opentelemetry.md.DLlIB5rv.lean.js +1 -0
- package/dist/docs/assets/guides_slack.md.ZbHQETOT.js +70 -0
- package/dist/docs/assets/guides_slack.md.ZbHQETOT.lean.js +1 -0
- package/dist/docs/assets/guides_webhooks.md.D0furjw0.js +92 -0
- package/dist/docs/assets/guides_webhooks.md.D0furjw0.lean.js +1 -0
- package/dist/docs/assets/hillclimbing.md.Biy0m-Qb.js +7 -0
- package/dist/docs/assets/hillclimbing.md.Biy0m-Qb.lean.js +1 -0
- package/dist/docs/assets/index.md.CVc_oOA3.js +27 -0
- package/dist/docs/assets/index.md.CVc_oOA3.lean.js +1 -0
- package/dist/docs/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
- package/dist/docs/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
- package/dist/docs/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
- package/dist/docs/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
- package/dist/docs/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
- package/dist/docs/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
- package/dist/docs/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
- package/dist/docs/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
- package/dist/docs/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
- package/dist/docs/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
- package/dist/docs/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
- package/dist/docs/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
- package/dist/docs/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
- package/dist/docs/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
- package/dist/docs/assets/quickstart.md.wG4shE1f.js +168 -0
- package/dist/docs/assets/quickstart.md.wG4shE1f.lean.js +1 -0
- package/dist/docs/assets/reference_agent-config.md.DzGI777n.js +32 -0
- package/dist/docs/assets/reference_agent-config.md.DzGI777n.lean.js +1 -0
- package/dist/docs/assets/reference_artifacts.md.IFFC5Zln.js +18 -0
- package/dist/docs/assets/reference_artifacts.md.IFFC5Zln.lean.js +1 -0
- package/dist/docs/assets/reference_channels.md.mbNtKCiR.js +23 -0
- package/dist/docs/assets/reference_channels.md.mbNtKCiR.lean.js +1 -0
- package/dist/docs/assets/reference_cli.md.BK2QUH67.js +97 -0
- package/dist/docs/assets/reference_cli.md.BK2QUH67.lean.js +1 -0
- package/dist/docs/assets/reference_connections.md._XpKiOaF.js +63 -0
- package/dist/docs/assets/reference_connections.md._XpKiOaF.lean.js +1 -0
- package/dist/docs/assets/reference_evals.md.DqNyHMA6.js +56 -0
- package/dist/docs/assets/reference_evals.md.DqNyHMA6.lean.js +1 -0
- package/dist/docs/assets/reference_extensions.md.CPPrkWlJ.js +58 -0
- package/dist/docs/assets/reference_extensions.md.CPPrkWlJ.lean.js +1 -0
- package/dist/docs/assets/reference_hooks.md.Dg3dEugd.js +45 -0
- package/dist/docs/assets/reference_hooks.md.Dg3dEugd.lean.js +1 -0
- package/dist/docs/assets/reference_http-api.md.BZOvhCqY.js +11 -0
- package/dist/docs/assets/reference_http-api.md.BZOvhCqY.lean.js +1 -0
- package/dist/docs/assets/reference_instructions.md.Bdwscs4G.js +14 -0
- package/dist/docs/assets/reference_instructions.md.Bdwscs4G.lean.js +1 -0
- package/dist/docs/assets/reference_playground.md.BdQzRJc2.js +1 -0
- package/dist/docs/assets/reference_playground.md.BdQzRJc2.lean.js +1 -0
- package/dist/docs/assets/reference_project-layout.md.CpLQ9j4K.js +25 -0
- package/dist/docs/assets/reference_project-layout.md.CpLQ9j4K.lean.js +1 -0
- package/dist/docs/assets/reference_prompt.md.BQZB4eaV.js +9 -0
- package/dist/docs/assets/reference_prompt.md.BQZB4eaV.lean.js +1 -0
- package/dist/docs/assets/reference_schedules.md.BVU5EFbz.js +47 -0
- package/dist/docs/assets/reference_schedules.md.BVU5EFbz.lean.js +1 -0
- package/dist/docs/assets/reference_sessions.md.BtpTjZmh.js +1 -0
- package/dist/docs/assets/reference_sessions.md.BtpTjZmh.lean.js +1 -0
- package/dist/docs/assets/reference_skills.md.Cy00QMKS.js +15 -0
- package/dist/docs/assets/reference_skills.md.Cy00QMKS.lean.js +1 -0
- package/dist/docs/assets/reference_subagents.md.B8oyeXOI.js +10 -0
- package/dist/docs/assets/reference_subagents.md.B8oyeXOI.lean.js +1 -0
- package/dist/docs/assets/reference_tools.md.hg2Wi5Bq.js +90 -0
- package/dist/docs/assets/reference_tools.md.hg2Wi5Bq.lean.js +1 -0
- package/dist/docs/assets/style.C130MVnH.css +1 -0
- package/dist/docs/assets/templates_agentic-owners.md.BykUiZ8j.js +14 -0
- package/dist/docs/assets/templates_agentic-owners.md.BykUiZ8j.lean.js +1 -0
- package/dist/docs/assets/templates_security-reviewer.md.DXMmKl_o.js +2 -0
- package/dist/docs/assets/templates_security-reviewer.md.DXMmKl_o.lean.js +1 -0
- package/dist/docs/assets/templates_thermo-quality-review.md.Dg1p1MsG.js +3 -0
- package/dist/docs/assets/templates_thermo-quality-review.md.Dg1p1MsG.lean.js +1 -0
- package/dist/docs/assets/templates_thermo-review.md.Dlylkowj.js +3 -0
- package/dist/docs/assets/templates_thermo-review.md.Dlylkowj.lean.js +1 -0
- package/dist/docs/assets/templates_triage.md.CvJyx81N.js +9 -0
- package/dist/docs/assets/templates_triage.md.CvJyx81N.lean.js +1 -0
- package/dist/docs/assets/troubleshooting.md.BzZSu1Gz.js +1 -0
- package/dist/docs/assets/troubleshooting.md.BzZSu1Gz.lean.js +1 -0
- package/dist/docs/building-with-agents.html +68 -0
- package/dist/docs/building-with-agents.md +135 -0
- package/dist/docs/deployment.html +91 -0
- package/dist/docs/deployment.md +211 -0
- package/dist/docs/evals.html +131 -0
- package/dist/docs/evals.md +257 -0
- package/dist/docs/guides/agent-to-agent.html +100 -0
- package/dist/docs/guides/agent-to-agent.md +152 -0
- package/dist/docs/guides/bitbucket.html +204 -0
- package/dist/docs/guides/bitbucket.md +288 -0
- package/dist/docs/guides/cloud-agents.html +69 -0
- package/dist/docs/guides/cloud-agents.md +90 -0
- package/dist/docs/guides/convert-automation.html +102 -0
- package/dist/docs/guides/convert-automation.md +183 -0
- package/dist/docs/guides/github.html +215 -0
- package/dist/docs/guides/github.md +326 -0
- package/dist/docs/guides/gitlab.html +212 -0
- package/dist/docs/guides/gitlab.md +294 -0
- package/dist/docs/guides/grokbot-agents.html +75 -0
- package/dist/docs/guides/grokbot-agents.md +142 -0
- package/dist/docs/guides/hooks.html +109 -0
- package/dist/docs/guides/hooks.md +114 -0
- package/dist/docs/guides/improve.html +81 -0
- package/dist/docs/guides/improve.md +134 -0
- package/dist/docs/guides/jev.html +210 -0
- package/dist/docs/guides/jev.md +294 -0
- package/dist/docs/guides/mcp-oauth.html +109 -0
- package/dist/docs/guides/mcp-oauth.md +162 -0
- package/dist/docs/guides/opentelemetry.html +94 -0
- package/dist/docs/guides/opentelemetry.md +153 -0
- package/dist/docs/guides/slack.html +129 -0
- package/dist/docs/guides/slack.md +273 -0
- package/dist/docs/guides/webhooks.html +151 -0
- package/dist/docs/guides/webhooks.md +236 -0
- package/dist/docs/hashmap.json +1 -0
- package/dist/docs/hillclimbing.html +66 -0
- package/dist/docs/hillclimbing.md +137 -0
- package/dist/docs/index.html +86 -0
- package/dist/docs/index.md +114 -0
- package/dist/docs/llms-full.txt +8439 -0
- package/dist/docs/llms.txt +62 -0
- package/dist/docs/quickstart.html +227 -0
- package/dist/docs/quickstart.md +306 -0
- package/dist/docs/reference/agent-config.html +91 -0
- package/dist/docs/reference/agent-config.md +188 -0
- package/dist/docs/reference/artifacts.html +77 -0
- package/dist/docs/reference/artifacts.md +116 -0
- package/dist/docs/reference/channels.html +82 -0
- package/dist/docs/reference/channels.md +198 -0
- package/dist/docs/reference/cli.html +156 -0
- package/dist/docs/reference/cli.md +904 -0
- package/dist/docs/reference/connections.html +122 -0
- package/dist/docs/reference/connections.md +272 -0
- package/dist/docs/reference/evals.html +115 -0
- package/dist/docs/reference/evals.md +287 -0
- package/dist/docs/reference/extensions.html +117 -0
- package/dist/docs/reference/extensions.md +193 -0
- package/dist/docs/reference/hooks.html +104 -0
- package/dist/docs/reference/hooks.md +190 -0
- package/dist/docs/reference/http-api.html +70 -0
- package/dist/docs/reference/http-api.md +231 -0
- package/dist/docs/reference/instructions.html +73 -0
- package/dist/docs/reference/instructions.md +63 -0
- package/dist/docs/reference/playground.html +60 -0
- package/dist/docs/reference/playground.md +42 -0
- package/dist/docs/reference/project-layout.html +84 -0
- package/dist/docs/reference/project-layout.md +115 -0
- package/dist/docs/reference/prompt.html +68 -0
- package/dist/docs/reference/prompt.md +50 -0
- package/dist/docs/reference/schedules.html +106 -0
- package/dist/docs/reference/schedules.md +170 -0
- package/dist/docs/reference/sessions.html +60 -0
- package/dist/docs/reference/sessions.md +160 -0
- package/dist/docs/reference/skills.html +74 -0
- package/dist/docs/reference/skills.md +75 -0
- package/dist/docs/reference/subagents.html +69 -0
- package/dist/docs/reference/subagents.md +62 -0
- package/dist/docs/reference/tools.html +149 -0
- package/dist/docs/reference/tools.md +324 -0
- package/dist/docs/templates/agentic-owners.html +73 -0
- package/dist/docs/templates/agentic-owners.md +95 -0
- package/dist/docs/templates/security-reviewer.html +61 -0
- package/dist/docs/templates/security-reviewer.md +85 -0
- package/dist/docs/templates/thermo-quality-review.html +62 -0
- package/dist/docs/templates/thermo-quality-review.md +78 -0
- package/dist/docs/templates/thermo-review.html +62 -0
- package/dist/docs/templates/thermo-review.md +77 -0
- package/dist/docs/templates/triage.html +68 -0
- package/dist/docs/templates/triage.md +97 -0
- package/dist/docs/troubleshooting.html +60 -0
- package/dist/docs/troubleshooting.md +143 -0
- package/dist/docs/vp-icons.css +0 -0
- package/dist/evals/assertions.d.ts +199 -0
- package/dist/evals/assertions.d.ts.map +1 -0
- package/dist/evals/assertions.js +459 -0
- package/dist/evals/expect.d.ts +95 -0
- package/dist/evals/expect.d.ts.map +1 -0
- package/dist/evals/expect.js +187 -0
- package/dist/evals/judge.d.ts +133 -0
- package/dist/evals/judge.d.ts.map +1 -0
- package/dist/evals/judge.js +224 -0
- package/dist/evals/loaders.d.ts +51 -0
- package/dist/evals/loaders.d.ts.map +1 -0
- package/dist/evals/loaders.js +124 -0
- package/dist/evals/matchers.d.ts +95 -0
- package/dist/evals/matchers.d.ts.map +1 -0
- package/dist/evals/matchers.js +142 -0
- package/dist/evals/reporters.d.ts +70 -0
- package/dist/evals/reporters.d.ts.map +1 -0
- package/dist/evals/reporters.js +220 -0
- package/dist/evals/results.d.ts +103 -0
- package/dist/evals/results.d.ts.map +1 -0
- package/dist/evals/results.js +27 -0
- package/dist/evals/run-facts.d.ts +77 -0
- package/dist/evals/run-facts.d.ts.map +1 -0
- package/dist/evals/run-facts.js +214 -0
- package/dist/evals.d.ts +446 -0
- package/dist/evals.d.ts.map +1 -0
- package/dist/evals.js +292 -0
- package/dist/extensions/cursor-cloud-agents/extension.d.ts +57 -0
- package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/extension.js +66 -0
- package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts +78 -0
- package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/backend.js +280 -0
- package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts +25 -0
- package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/fleet.js +81 -0
- package/dist/extensions/cursor-cloud-agents/lib/inputs.d.ts +5 -0
- package/dist/extensions/cursor-cloud-agents/lib/inputs.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/inputs.js +4 -0
- package/dist/extensions/cursor-cloud-agents/lib/repos.d.ts +15 -0
- package/dist/extensions/cursor-cloud-agents/lib/repos.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/repos.js +53 -0
- package/dist/extensions/cursor-cloud-agents/lib/transcript.d.ts +8 -0
- package/dist/extensions/cursor-cloud-agents/lib/transcript.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/transcript.js +15 -0
- package/dist/extensions/cursor-cloud-agents/skills/handoff.md +37 -0
- package/dist/extensions/cursor-cloud-agents/tools/cancel.d.ts +4 -0
- package/dist/extensions/cursor-cloud-agents/tools/cancel.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/tools/cancel.js +26 -0
- package/dist/extensions/cursor-cloud-agents/tools/dump.d.ts +4 -0
- package/dist/extensions/cursor-cloud-agents/tools/dump.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/tools/dump.js +54 -0
- package/dist/extensions/cursor-cloud-agents/tools/get.d.ts +4 -0
- package/dist/extensions/cursor-cloud-agents/tools/get.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/tools/get.js +25 -0
- package/dist/extensions/cursor-cloud-agents/tools/launch.d.ts +4 -0
- package/dist/extensions/cursor-cloud-agents/tools/launch.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/tools/launch.js +59 -0
- package/dist/extensions/cursor-cloud-agents/tools/list.d.ts +4 -0
- package/dist/extensions/cursor-cloud-agents/tools/list.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/tools/list.js +36 -0
- package/dist/extensions/cursor-cloud-agents/tools/reply.d.ts +4 -0
- package/dist/extensions/cursor-cloud-agents/tools/reply.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/tools/reply.js +35 -0
- package/dist/extensions/improve/extension.d.ts +48 -0
- package/dist/extensions/improve/extension.d.ts.map +1 -0
- package/dist/extensions/improve/extension.js +43 -0
- package/dist/extensions/improve/skills/yourself.d.ts +4 -0
- package/dist/extensions/improve/skills/yourself.d.ts.map +1 -0
- package/dist/extensions/improve/skills/yourself.js +43 -0
- package/dist/extensions/jev/extension.d.ts +43 -0
- package/dist/extensions/jev/extension.d.ts.map +1 -0
- package/dist/extensions/jev/extension.js +47 -0
- package/dist/extensions/jev/lib/evaluate.d.ts +101 -0
- package/dist/extensions/jev/lib/evaluate.d.ts.map +1 -0
- package/dist/extensions/jev/lib/evaluate.js +167 -0
- package/dist/extensions/jev/skills/gated-write.md +25 -0
- package/dist/extensions/jev/skills/questions.md +33 -0
- package/dist/extensions/jev/tools/evaluate.d.ts +4 -0
- package/dist/extensions/jev/tools/evaluate.d.ts.map +1 -0
- package/dist/extensions/jev/tools/evaluate.js +83 -0
- package/dist/extensions/slack-communication/extension.d.ts +28 -0
- package/dist/extensions/slack-communication/extension.d.ts.map +1 -0
- package/dist/extensions/slack-communication/extension.js +32 -0
- package/dist/extensions/slack-communication/skills/slack-voice.d.ts +5 -0
- package/dist/extensions/slack-communication/skills/slack-voice.d.ts.map +1 -0
- package/dist/extensions/slack-communication/skills/slack-voice.js +52 -0
- package/dist/extensions/slack-communication/tools/delete-message.d.ts +4 -0
- package/dist/extensions/slack-communication/tools/delete-message.d.ts.map +1 -0
- package/dist/extensions/slack-communication/tools/delete-message.js +29 -0
- package/dist/extensions/slack-communication/tools/edit-message.d.ts +4 -0
- package/dist/extensions/slack-communication/tools/edit-message.d.ts.map +1 -0
- package/dist/extensions/slack-communication/tools/edit-message.js +37 -0
- package/dist/extensions/slack-communication/tools/post-card.d.ts +4 -0
- package/dist/extensions/slack-communication/tools/post-card.d.ts.map +1 -0
- package/dist/extensions/slack-communication/tools/post-card.js +25 -0
- package/dist/extensions/slack-communication/tools/post-file.d.ts +4 -0
- package/dist/extensions/slack-communication/tools/post-file.d.ts.map +1 -0
- package/dist/extensions/slack-communication/tools/post-file.js +75 -0
- package/dist/extensions/slack-communication/tools/post-update.d.ts +4 -0
- package/dist/extensions/slack-communication/tools/post-update.d.ts.map +1 -0
- package/dist/extensions/slack-communication/tools/post-update.js +36 -0
- package/dist/extensions/slack-communication/tools/react.d.ts +4 -0
- package/dist/extensions/slack-communication/tools/react.d.ts.map +1 -0
- package/dist/extensions/slack-communication/tools/react.js +27 -0
- package/dist/extensions/slack-communication/tools/set-status.d.ts +4 -0
- package/dist/extensions/slack-communication/tools/set-status.d.ts.map +1 -0
- package/dist/extensions/slack-communication/tools/set-status.js +18 -0
- package/dist/extensions.d.ts +85 -0
- package/dist/extensions.d.ts.map +1 -0
- package/dist/extensions.js +140 -0
- package/dist/files-backends/agent-store-presigned-url.d.ts +3 -0
- package/dist/files-backends/agent-store-presigned-url.d.ts.map +1 -0
- package/dist/files-backends/agent-store-presigned-url.js +223 -0
- package/dist/files-backends/cursor-hosted.d.ts +126 -0
- package/dist/files-backends/cursor-hosted.d.ts.map +1 -0
- package/dist/files-backends/cursor-hosted.js +978 -0
- package/dist/files-backends/local-fs.d.ts +33 -0
- package/dist/files-backends/local-fs.d.ts.map +1 -0
- package/dist/files-backends/local-fs.js +195 -0
- package/dist/files.d.ts +225 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +152 -0
- package/dist/filesystem.d.ts +484 -0
- package/dist/filesystem.d.ts.map +1 -0
- package/dist/filesystem.js +1698 -0
- package/dist/hooks.d.ts +25 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +25 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +109 -0
- package/dist/internal/advertise-tools.d.ts +95 -0
- package/dist/internal/advertise-tools.d.ts.map +1 -0
- package/dist/internal/advertise-tools.js +265 -0
- package/dist/internal/approval-gate.d.ts +33 -0
- package/dist/internal/approval-gate.d.ts.map +1 -0
- package/dist/internal/approval-gate.js +80 -0
- package/dist/internal/artifacts-store.d.ts +125 -0
- package/dist/internal/artifacts-store.d.ts.map +1 -0
- package/dist/internal/artifacts-store.js +737 -0
- package/dist/internal/as-of.d.ts +37 -0
- package/dist/internal/as-of.d.ts.map +1 -0
- package/dist/internal/as-of.js +207 -0
- package/dist/internal/auth.d.ts +12 -0
- package/dist/internal/auth.d.ts.map +1 -0
- package/dist/internal/auth.js +34 -0
- package/dist/internal/authored-alias-hooks.d.ts +42 -0
- package/dist/internal/authored-alias-hooks.d.ts.map +1 -0
- package/dist/internal/authored-alias-hooks.js +93 -0
- package/dist/internal/authored-loaders.d.ts +50 -0
- package/dist/internal/authored-loaders.d.ts.map +1 -0
- package/dist/internal/authored-loaders.js +182 -0
- package/dist/internal/bounded-int.d.ts +11 -0
- package/dist/internal/bounded-int.d.ts.map +1 -0
- package/dist/internal/bounded-int.js +13 -0
- package/dist/internal/bounded.d.ts +7 -0
- package/dist/internal/bounded.d.ts.map +1 -0
- package/dist/internal/bounded.js +32 -0
- package/dist/internal/brand.d.ts +6 -0
- package/dist/internal/brand.d.ts.map +1 -0
- package/dist/internal/brand.js +17 -0
- package/dist/internal/browser-origin-guard.d.ts +19 -0
- package/dist/internal/browser-origin-guard.d.ts.map +1 -0
- package/dist/internal/browser-origin-guard.js +51 -0
- package/dist/internal/builtin-tools/artifacts.d.ts +10 -0
- package/dist/internal/builtin-tools/artifacts.d.ts.map +1 -0
- package/dist/internal/builtin-tools/artifacts.js +66 -0
- package/dist/internal/builtin-tools/index.d.ts +17 -0
- package/dist/internal/builtin-tools/index.d.ts.map +1 -0
- package/dist/internal/builtin-tools/index.js +40 -0
- package/dist/internal/builtin-tools/reminders.d.ts +9 -0
- package/dist/internal/builtin-tools/reminders.d.ts.map +1 -0
- package/dist/internal/builtin-tools/reminders.js +134 -0
- package/dist/internal/channel-dispatch.d.ts +43 -0
- package/dist/internal/channel-dispatch.d.ts.map +1 -0
- package/dist/internal/channel-dispatch.js +75 -0
- package/dist/internal/channel-route-dispatch.d.ts +13 -0
- package/dist/internal/channel-route-dispatch.d.ts.map +1 -0
- package/dist/internal/channel-route-dispatch.js +62 -0
- package/dist/internal/channel-state.d.ts +17 -0
- package/dist/internal/channel-state.d.ts.map +1 -0
- package/dist/internal/channel-state.js +69 -0
- package/dist/internal/chat-client.d.ts +45 -0
- package/dist/internal/chat-client.d.ts.map +1 -0
- package/dist/internal/chat-client.js +478 -0
- package/dist/internal/cli-ax.d.ts +233 -0
- package/dist/internal/cli-ax.d.ts.map +1 -0
- package/dist/internal/cli-ax.js +1864 -0
- package/dist/internal/cli-bitbucket.d.ts +33 -0
- package/dist/internal/cli-bitbucket.d.ts.map +1 -0
- package/dist/internal/cli-bitbucket.js +360 -0
- package/dist/internal/cli-convert-automation.d.ts +39 -0
- package/dist/internal/cli-convert-automation.d.ts.map +1 -0
- package/dist/internal/cli-convert-automation.js +281 -0
- package/dist/internal/cli-cursor.d.ts +38 -0
- package/dist/internal/cli-cursor.d.ts.map +1 -0
- package/dist/internal/cli-cursor.js +226 -0
- package/dist/internal/cli-deploy.d.ts +164 -0
- package/dist/internal/cli-deploy.d.ts.map +1 -0
- package/dist/internal/cli-deploy.js +1930 -0
- package/dist/internal/cli-docs.d.ts +34 -0
- package/dist/internal/cli-docs.d.ts.map +1 -0
- package/dist/internal/cli-docs.js +173 -0
- package/dist/internal/cli-github.d.ts +47 -0
- package/dist/internal/cli-github.d.ts.map +1 -0
- package/dist/internal/cli-github.js +639 -0
- package/dist/internal/cli-gitlab.d.ts +37 -0
- package/dist/internal/cli-gitlab.d.ts.map +1 -0
- package/dist/internal/cli-gitlab.js +379 -0
- package/dist/internal/cli-images.d.ts +68 -0
- package/dist/internal/cli-images.d.ts.map +1 -0
- package/dist/internal/cli-images.js +604 -0
- package/dist/internal/cli-manifest.d.ts +19 -0
- package/dist/internal/cli-manifest.d.ts.map +1 -0
- package/dist/internal/cli-manifest.js +49 -0
- package/dist/internal/cli-mcp-oauth.d.ts +51 -0
- package/dist/internal/cli-mcp-oauth.d.ts.map +1 -0
- package/dist/internal/cli-mcp-oauth.js +318 -0
- package/dist/internal/cli-mcp.d.ts +75 -0
- package/dist/internal/cli-mcp.d.ts.map +1 -0
- package/dist/internal/cli-mcp.js +684 -0
- package/dist/internal/cli-skills.d.ts +21 -0
- package/dist/internal/cli-skills.d.ts.map +1 -0
- package/dist/internal/cli-skills.js +77 -0
- package/dist/internal/cli-slack-manual.d.ts +42 -0
- package/dist/internal/cli-slack-manual.d.ts.map +1 -0
- package/dist/internal/cli-slack-manual.js +325 -0
- package/dist/internal/cli-slack.d.ts +59 -0
- package/dist/internal/cli-slack.d.ts.map +1 -0
- package/dist/internal/cli-slack.js +695 -0
- package/dist/internal/cloud-merge.d.ts +25 -0
- package/dist/internal/cloud-merge.d.ts.map +1 -0
- package/dist/internal/cloud-merge.js +36 -0
- package/dist/internal/cloud-turn-cost.d.ts +42 -0
- package/dist/internal/cloud-turn-cost.d.ts.map +1 -0
- package/dist/internal/cloud-turn-cost.js +113 -0
- package/dist/internal/continuation-channel.d.ts +48 -0
- package/dist/internal/continuation-channel.d.ts.map +1 -0
- package/dist/internal/continuation-channel.js +154 -0
- package/dist/internal/continuation-identity.d.ts +113 -0
- package/dist/internal/continuation-identity.d.ts.map +1 -0
- package/dist/internal/continuation-identity.js +749 -0
- package/dist/internal/conversation-mirror.d.ts +85 -0
- package/dist/internal/conversation-mirror.d.ts.map +1 -0
- package/dist/internal/conversation-mirror.js +342 -0
- package/dist/internal/convert-automation/convert-workflow.d.ts +10 -0
- package/dist/internal/convert-automation/convert-workflow.d.ts.map +1 -0
- package/dist/internal/convert-automation/convert-workflow.js +998 -0
- package/dist/internal/convert-automation/slug.d.ts +9 -0
- package/dist/internal/convert-automation/slug.d.ts.map +1 -0
- package/dist/internal/convert-automation/slug.js +28 -0
- package/dist/internal/convert-automation/types.d.ts +202 -0
- package/dist/internal/convert-automation/types.d.ts.map +1 -0
- package/dist/internal/convert-automation/types.js +13 -0
- package/dist/internal/cron.d.ts +17 -0
- package/dist/internal/cron.d.ts.map +1 -0
- package/dist/internal/cron.js +60 -0
- package/dist/internal/cursor/account-mcp.d.ts +135 -0
- package/dist/internal/cursor/account-mcp.d.ts.map +1 -0
- package/dist/internal/cursor/account-mcp.js +510 -0
- package/dist/internal/cursor/backend-client.d.ts +224 -0
- package/dist/internal/cursor/backend-client.d.ts.map +1 -0
- package/dist/internal/cursor/backend-client.js +720 -0
- package/dist/internal/cursor/bound-secret-file.d.ts +56 -0
- package/dist/internal/cursor/bound-secret-file.d.ts.map +1 -0
- package/dist/internal/cursor/bound-secret-file.js +88 -0
- package/dist/internal/cursor/credentials.d.ts +195 -0
- package/dist/internal/cursor/credentials.d.ts.map +1 -0
- package/dist/internal/cursor/credentials.js +475 -0
- package/dist/internal/cursor/cursor-api-transport.d.ts +37 -0
- package/dist/internal/cursor/cursor-api-transport.d.ts.map +1 -0
- package/dist/internal/cursor/cursor-api-transport.js +44 -0
- package/dist/internal/cursor/github-credentials.d.ts +44 -0
- package/dist/internal/cursor/github-credentials.d.ts.map +1 -0
- package/dist/internal/cursor/github-credentials.js +191 -0
- package/dist/internal/cursor/hosted-bound-secrets.d.ts +41 -0
- package/dist/internal/cursor/hosted-bound-secrets.d.ts.map +1 -0
- package/dist/internal/cursor/hosted-bound-secrets.js +54 -0
- package/dist/internal/cursor/hosted-deployment-secrets.d.ts +30 -0
- package/dist/internal/cursor/hosted-deployment-secrets.d.ts.map +1 -0
- package/dist/internal/cursor/hosted-deployment-secrets.js +81 -0
- package/dist/internal/cursor/hosted-store-secrets.d.ts +63 -0
- package/dist/internal/cursor/hosted-store-secrets.d.ts.map +1 -0
- package/dist/internal/cursor/hosted-store-secrets.js +112 -0
- package/dist/internal/cursor/session-token.d.ts +45 -0
- package/dist/internal/cursor/session-token.d.ts.map +1 -0
- package/dist/internal/cursor/session-token.js +97 -0
- package/dist/internal/cursor/store-api-client.d.ts +82 -0
- package/dist/internal/cursor/store-api-client.d.ts.map +1 -0
- package/dist/internal/cursor/store-api-client.js +226 -0
- package/dist/internal/cursor-account-mcp-auth.d.ts +66 -0
- package/dist/internal/cursor-account-mcp-auth.d.ts.map +1 -0
- package/dist/internal/cursor-account-mcp-auth.js +241 -0
- package/dist/internal/cursor-agent-template.d.ts +9 -0
- package/dist/internal/cursor-agent-template.d.ts.map +1 -0
- package/dist/internal/cursor-agent-template.js +43 -0
- package/dist/internal/cursor-deployment-relay.d.ts +95 -0
- package/dist/internal/cursor-deployment-relay.d.ts.map +1 -0
- package/dist/internal/cursor-deployment-relay.js +233 -0
- package/dist/internal/cursor-event-relay.d.ts +243 -0
- package/dist/internal/cursor-event-relay.d.ts.map +1 -0
- package/dist/internal/cursor-event-relay.js +424 -0
- package/dist/internal/cursor-relay-core.d.ts +160 -0
- package/dist/internal/cursor-relay-core.d.ts.map +1 -0
- package/dist/internal/cursor-relay-core.js +470 -0
- package/dist/internal/deferred-channel-session.d.ts +20 -0
- package/dist/internal/deferred-channel-session.d.ts.map +1 -0
- package/dist/internal/deferred-channel-session.js +62 -0
- package/dist/internal/deploy-client.d.ts +576 -0
- package/dist/internal/deploy-client.d.ts.map +1 -0
- package/dist/internal/deploy-client.js +987 -0
- package/dist/internal/deploy-manifest.d.ts +135 -0
- package/dist/internal/deploy-manifest.d.ts.map +1 -0
- package/dist/internal/deploy-manifest.js +231 -0
- package/dist/internal/deploy-source.d.ts +38 -0
- package/dist/internal/deploy-source.d.ts.map +1 -0
- package/dist/internal/deploy-source.js +136 -0
- package/dist/internal/describe-error.d.ts +4 -0
- package/dist/internal/describe-error.d.ts.map +1 -0
- package/dist/internal/describe-error.js +29 -0
- package/dist/internal/dev-mode.d.ts +13 -0
- package/dist/internal/dev-mode.d.ts.map +1 -0
- package/dist/internal/dev-mode.js +17 -0
- package/dist/internal/discovery/agent-config.d.ts +48 -0
- package/dist/internal/discovery/agent-config.d.ts.map +1 -0
- package/dist/internal/discovery/agent-config.js +224 -0
- package/dist/internal/discovery/agent.d.ts +16 -0
- package/dist/internal/discovery/agent.d.ts.map +1 -0
- package/dist/internal/discovery/agent.js +326 -0
- package/dist/internal/discovery/channels.d.ts +10 -0
- package/dist/internal/discovery/channels.d.ts.map +1 -0
- package/dist/internal/discovery/channels.js +97 -0
- package/dist/internal/discovery/connections.d.ts +13 -0
- package/dist/internal/discovery/connections.d.ts.map +1 -0
- package/dist/internal/discovery/connections.js +429 -0
- package/dist/internal/discovery/context.d.ts +20 -0
- package/dist/internal/discovery/context.d.ts.map +1 -0
- package/dist/internal/discovery/context.js +30 -0
- package/dist/internal/discovery/cursor-plugin.d.ts +25 -0
- package/dist/internal/discovery/cursor-plugin.d.ts.map +1 -0
- package/dist/internal/discovery/cursor-plugin.js +549 -0
- package/dist/internal/discovery/extension-overlay.d.ts +31 -0
- package/dist/internal/discovery/extension-overlay.d.ts.map +1 -0
- package/dist/internal/discovery/extension-overlay.js +173 -0
- package/dist/internal/discovery/extensions.d.ts +27 -0
- package/dist/internal/discovery/extensions.d.ts.map +1 -0
- package/dist/internal/discovery/extensions.js +352 -0
- package/dist/internal/discovery/fs.d.ts +15 -0
- package/dist/internal/discovery/fs.d.ts.map +1 -0
- package/dist/internal/discovery/fs.js +115 -0
- package/dist/internal/discovery/hooks.d.ts +7 -0
- package/dist/internal/discovery/hooks.d.ts.map +1 -0
- package/dist/internal/discovery/hooks.js +61 -0
- package/dist/internal/discovery/info.d.ts +6 -0
- package/dist/internal/discovery/info.d.ts.map +1 -0
- package/dist/internal/discovery/info.js +168 -0
- package/dist/internal/discovery/instructions.d.ts +7 -0
- package/dist/internal/discovery/instructions.d.ts.map +1 -0
- package/dist/internal/discovery/instructions.js +95 -0
- package/dist/internal/discovery/modules.d.ts +20 -0
- package/dist/internal/discovery/modules.d.ts.map +1 -0
- package/dist/internal/discovery/modules.js +104 -0
- package/dist/internal/discovery/names.d.ts +12 -0
- package/dist/internal/discovery/names.d.ts.map +1 -0
- package/dist/internal/discovery/names.js +37 -0
- package/dist/internal/discovery/project.d.ts +51 -0
- package/dist/internal/discovery/project.d.ts.map +1 -0
- package/dist/internal/discovery/project.js +290 -0
- package/dist/internal/discovery/reminders.d.ts +7 -0
- package/dist/internal/discovery/reminders.d.ts.map +1 -0
- package/dist/internal/discovery/reminders.js +65 -0
- package/dist/internal/discovery/runtime.d.ts +34 -0
- package/dist/internal/discovery/runtime.d.ts.map +1 -0
- package/dist/internal/discovery/runtime.js +97 -0
- package/dist/internal/discovery/schedules.d.ts +7 -0
- package/dist/internal/discovery/schedules.d.ts.map +1 -0
- package/dist/internal/discovery/schedules.js +118 -0
- package/dist/internal/discovery/seed-files.d.ts +7 -0
- package/dist/internal/discovery/seed-files.d.ts.map +1 -0
- package/dist/internal/discovery/seed-files.js +41 -0
- package/dist/internal/discovery/services.d.ts +26 -0
- package/dist/internal/discovery/services.d.ts.map +1 -0
- package/dist/internal/discovery/services.js +138 -0
- package/dist/internal/discovery/skills.d.ts +11 -0
- package/dist/internal/discovery/skills.d.ts.map +1 -0
- package/dist/internal/discovery/skills.js +156 -0
- package/dist/internal/discovery/subagent.d.ts +16 -0
- package/dist/internal/discovery/subagent.d.ts.map +1 -0
- package/dist/internal/discovery/subagent.js +129 -0
- package/dist/internal/discovery/tools.d.ts +18 -0
- package/dist/internal/discovery/tools.d.ts.map +1 -0
- package/dist/internal/discovery/tools.js +155 -0
- package/dist/internal/discovery.d.ts +15 -0
- package/dist/internal/discovery.d.ts.map +1 -0
- package/dist/internal/discovery.js +13 -0
- package/dist/internal/distribution.d.ts +65 -0
- package/dist/internal/distribution.d.ts.map +1 -0
- package/dist/internal/distribution.js +102 -0
- package/dist/internal/docs-site.d.ts +41 -0
- package/dist/internal/docs-site.d.ts.map +1 -0
- package/dist/internal/docs-site.js +234 -0
- package/dist/internal/duration.d.ts +8 -0
- package/dist/internal/duration.d.ts.map +1 -0
- package/dist/internal/duration.js +35 -0
- package/dist/internal/env-file.d.ts +19 -0
- package/dist/internal/env-file.d.ts.map +1 -0
- package/dist/internal/env-file.js +90 -0
- package/dist/internal/eval-judge-model.d.ts +59 -0
- package/dist/internal/eval-judge-model.d.ts.map +1 -0
- package/dist/internal/eval-judge-model.js +129 -0
- package/dist/internal/eval-run-store.d.ts +119 -0
- package/dist/internal/eval-run-store.d.ts.map +1 -0
- package/dist/internal/eval-run-store.js +468 -0
- package/dist/internal/eval-runner.d.ts +98 -0
- package/dist/internal/eval-runner.d.ts.map +1 -0
- package/dist/internal/eval-runner.js +615 -0
- package/dist/internal/evals-client.d.ts +104 -0
- package/dist/internal/evals-client.d.ts.map +1 -0
- package/dist/internal/evals-client.js +303 -0
- package/dist/internal/event-log.d.ts +94 -0
- package/dist/internal/event-log.d.ts.map +1 -0
- package/dist/internal/event-log.js +347 -0
- package/dist/internal/event-mapper.d.ts +123 -0
- package/dist/internal/event-mapper.d.ts.map +1 -0
- package/dist/internal/event-mapper.js +370 -0
- package/dist/internal/expected-delivery-failure.d.ts +3 -0
- package/dist/internal/expected-delivery-failure.d.ts.map +1 -0
- package/dist/internal/expected-delivery-failure.js +28 -0
- package/dist/internal/factory-resource-channel.d.ts +33 -0
- package/dist/internal/factory-resource-channel.d.ts.map +1 -0
- package/dist/internal/factory-resource-channel.js +77 -0
- package/dist/internal/filesystem/errors.d.ts +64 -0
- package/dist/internal/filesystem/errors.d.ts.map +1 -0
- package/dist/internal/filesystem/errors.js +172 -0
- package/dist/internal/filesystem/format.d.ts +28 -0
- package/dist/internal/filesystem/format.d.ts.map +1 -0
- package/dist/internal/filesystem/format.js +212 -0
- package/dist/internal/filesystem/merge.d.ts +34 -0
- package/dist/internal/filesystem/merge.d.ts.map +1 -0
- package/dist/internal/filesystem/merge.js +196 -0
- package/dist/internal/filesystem/nearest.d.ts +14 -0
- package/dist/internal/filesystem/nearest.d.ts.map +1 -0
- package/dist/internal/filesystem/nearest.js +101 -0
- package/dist/internal/filesystem/scratch.d.ts +59 -0
- package/dist/internal/filesystem/scratch.d.ts.map +1 -0
- package/dist/internal/filesystem/scratch.js +204 -0
- package/dist/internal/filesystem/sdk-schemas.d.ts +29 -0
- package/dist/internal/filesystem/sdk-schemas.d.ts.map +1 -0
- package/dist/internal/filesystem/sdk-schemas.js +153 -0
- package/dist/internal/filesystem/tools.d.ts +42 -0
- package/dist/internal/filesystem/tools.d.ts.map +1 -0
- package/dist/internal/filesystem/tools.js +631 -0
- package/dist/internal/filesystem/walk.d.ts +77 -0
- package/dist/internal/filesystem/walk.d.ts.map +1 -0
- package/dist/internal/filesystem/walk.js +350 -0
- package/dist/internal/framework-file-storage.d.ts +75 -0
- package/dist/internal/framework-file-storage.d.ts.map +1 -0
- package/dist/internal/framework-file-storage.js +338 -0
- package/dist/internal/framework-storage-selection.d.ts +66 -0
- package/dist/internal/framework-storage-selection.d.ts.map +1 -0
- package/dist/internal/framework-storage-selection.js +123 -0
- package/dist/internal/frontmatter.d.ts +20 -0
- package/dist/internal/frontmatter.d.ts.map +1 -0
- package/dist/internal/frontmatter.js +87 -0
- package/dist/internal/github-fanout.d.ts +32 -0
- package/dist/internal/github-fanout.d.ts.map +1 -0
- package/dist/internal/github-fanout.js +120 -0
- package/dist/internal/guest-network.d.ts +98 -0
- package/dist/internal/guest-network.d.ts.map +1 -0
- package/dist/internal/guest-network.js +326 -0
- package/dist/internal/handleAgentServeTrigger.d.ts +91 -0
- package/dist/internal/handleAgentServeTrigger.d.ts.map +1 -0
- package/dist/internal/handleAgentServeTrigger.js +199 -0
- package/dist/internal/host-files.d.ts +29 -0
- package/dist/internal/host-files.d.ts.map +1 -0
- package/dist/internal/host-files.js +274 -0
- package/dist/internal/host-kv.d.ts +21 -0
- package/dist/internal/host-kv.d.ts.map +1 -0
- package/dist/internal/host-kv.js +77 -0
- package/dist/internal/host-otel.d.ts +25 -0
- package/dist/internal/host-otel.d.ts.map +1 -0
- package/dist/internal/host-otel.js +162 -0
- package/dist/internal/host-platforms.d.ts +58 -0
- package/dist/internal/host-platforms.d.ts.map +1 -0
- package/dist/internal/host-platforms.js +126 -0
- package/dist/internal/hosted-admission-adapter.d.ts +36 -0
- package/dist/internal/hosted-admission-adapter.d.ts.map +1 -0
- package/dist/internal/hosted-admission-adapter.js +7 -0
- package/dist/internal/hosted-admission-context.d.ts +20 -0
- package/dist/internal/hosted-admission-context.d.ts.map +1 -0
- package/dist/internal/hosted-admission-context.js +31 -0
- package/dist/internal/hosted-catch-protocol.d.ts +51 -0
- package/dist/internal/hosted-catch-protocol.d.ts.map +1 -0
- package/dist/internal/hosted-catch-protocol.js +87 -0
- package/dist/internal/hosted-catch.d.ts +40 -0
- package/dist/internal/hosted-catch.d.ts.map +1 -0
- package/dist/internal/hosted-catch.js +146 -0
- package/dist/internal/hosted-delivery-protocol.d.ts +199 -0
- package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -0
- package/dist/internal/hosted-delivery-protocol.js +516 -0
- package/dist/internal/hosted-delivery.d.ts +110 -0
- package/dist/internal/hosted-delivery.d.ts.map +1 -0
- package/dist/internal/hosted-delivery.js +768 -0
- package/dist/internal/hosted-execution-diag.d.ts +75 -0
- package/dist/internal/hosted-execution-diag.d.ts.map +1 -0
- package/dist/internal/hosted-execution-diag.js +220 -0
- package/dist/internal/hosted-execution-flush.d.ts +50 -0
- package/dist/internal/hosted-execution-flush.d.ts.map +1 -0
- package/dist/internal/hosted-execution-flush.js +71 -0
- package/dist/internal/hosted-execution-latency.d.ts +80 -0
- package/dist/internal/hosted-execution-latency.d.ts.map +1 -0
- package/dist/internal/hosted-execution-latency.js +218 -0
- package/dist/internal/hosted-managed-automation.d.ts +30 -0
- package/dist/internal/hosted-managed-automation.d.ts.map +1 -0
- package/dist/internal/hosted-managed-automation.js +83 -0
- package/dist/internal/hosting.d.ts +53 -0
- package/dist/internal/hosting.d.ts.map +1 -0
- package/dist/internal/hosting.js +93 -0
- package/dist/internal/http-channel-define.d.ts +11 -0
- package/dist/internal/http-channel-define.d.ts.map +1 -0
- package/dist/internal/http-channel-define.js +18 -0
- package/dist/internal/http-channel.d.ts +54 -0
- package/dist/internal/http-channel.d.ts.map +1 -0
- package/dist/internal/http-channel.js +534 -0
- package/dist/internal/http-control-plane-session.d.ts +34 -0
- package/dist/internal/http-control-plane-session.d.ts.map +1 -0
- package/dist/internal/http-control-plane-session.js +93 -0
- package/dist/internal/ids.d.ts +19 -0
- package/dist/internal/ids.d.ts.map +1 -0
- package/dist/internal/ids.js +34 -0
- package/dist/internal/incoming-headers-to-fetch.d.ts +10 -0
- package/dist/internal/incoming-headers-to-fetch.d.ts.map +1 -0
- package/dist/internal/incoming-headers-to-fetch.js +41 -0
- package/dist/internal/init-interview.d.ts +67 -0
- package/dist/internal/init-interview.d.ts.map +1 -0
- package/dist/internal/init-interview.js +295 -0
- package/dist/internal/init-project.d.ts +175 -0
- package/dist/internal/init-project.d.ts.map +1 -0
- package/dist/internal/init-project.js +531 -0
- package/dist/internal/init-scaffold.d.ts +9 -0
- package/dist/internal/init-scaffold.d.ts.map +1 -0
- package/dist/internal/init-scaffold.js +172 -0
- package/dist/internal/inline-stdio-define-stub.d.ts +3 -0
- package/dist/internal/inline-stdio-define-stub.d.ts.map +1 -0
- package/dist/internal/inline-stdio-define-stub.js +4 -0
- package/dist/internal/inline-stdio-mcp.d.ts +34 -0
- package/dist/internal/inline-stdio-mcp.d.ts.map +1 -0
- package/dist/internal/inline-stdio-mcp.js +176 -0
- package/dist/internal/install-cursor-skills.d.ts +164 -0
- package/dist/internal/install-cursor-skills.d.ts.map +1 -0
- package/dist/internal/install-cursor-skills.js +498 -0
- package/dist/internal/is-record.d.ts +2 -0
- package/dist/internal/is-record.d.ts.map +1 -0
- package/dist/internal/is-record.js +3 -0
- package/dist/internal/json-schema.d.ts +25 -0
- package/dist/internal/json-schema.d.ts.map +1 -0
- package/dist/internal/json-schema.js +76 -0
- package/dist/internal/legacy-command-guard.d.ts +22 -0
- package/dist/internal/legacy-command-guard.d.ts.map +1 -0
- package/dist/internal/legacy-command-guard.js +51 -0
- package/dist/internal/listen-port.d.ts +22 -0
- package/dist/internal/listen-port.d.ts.map +1 -0
- package/dist/internal/listen-port.js +77 -0
- package/dist/internal/local-control-plane.d.ts +59 -0
- package/dist/internal/local-control-plane.d.ts.map +1 -0
- package/dist/internal/local-control-plane.js +351 -0
- package/dist/internal/local-env.d.ts +10 -0
- package/dist/internal/local-env.d.ts.map +1 -0
- package/dist/internal/local-env.js +55 -0
- package/dist/internal/local-ingress.d.ts +35 -0
- package/dist/internal/local-ingress.d.ts.map +1 -0
- package/dist/internal/local-ingress.js +44 -0
- package/dist/internal/log-ring.d.ts +23 -0
- package/dist/internal/log-ring.d.ts.map +1 -0
- package/dist/internal/log-ring.js +42 -0
- package/dist/internal/logs-client.d.ts +79 -0
- package/dist/internal/logs-client.d.ts.map +1 -0
- package/dist/internal/logs-client.js +350 -0
- package/dist/internal/map-pool.d.ts +11 -0
- package/dist/internal/map-pool.d.ts.map +1 -0
- package/dist/internal/map-pool.js +48 -0
- package/dist/internal/mcp-endpoint.d.ts +72 -0
- package/dist/internal/mcp-endpoint.d.ts.map +1 -0
- package/dist/internal/mcp-endpoint.js +530 -0
- package/dist/internal/mcp-host.d.ts +84 -0
- package/dist/internal/mcp-host.d.ts.map +1 -0
- package/dist/internal/mcp-host.js +391 -0
- package/dist/internal/mcp-oauth-on-demand.d.ts +68 -0
- package/dist/internal/mcp-oauth-on-demand.d.ts.map +1 -0
- package/dist/internal/mcp-oauth-on-demand.js +287 -0
- package/dist/internal/mcp-oauth-persist.d.ts +42 -0
- package/dist/internal/mcp-oauth-persist.d.ts.map +1 -0
- package/dist/internal/mcp-oauth-persist.js +90 -0
- package/dist/internal/mcp-oauth.d.ts +118 -0
- package/dist/internal/mcp-oauth.d.ts.map +1 -0
- package/dist/internal/mcp-oauth.js +450 -0
- package/dist/internal/net.d.ts +5 -0
- package/dist/internal/net.d.ts.map +1 -0
- package/dist/internal/net.js +28 -0
- package/dist/internal/open-browser.d.ts +5 -0
- package/dist/internal/open-browser.d.ts.map +1 -0
- package/dist/internal/open-browser.js +34 -0
- package/dist/internal/otel/attrs.d.ts +7 -0
- package/dist/internal/otel/attrs.d.ts.map +1 -0
- package/dist/internal/otel/attrs.js +13 -0
- package/dist/internal/otel/collector.d.ts +43 -0
- package/dist/internal/otel/collector.d.ts.map +1 -0
- package/dist/internal/otel/collector.js +650 -0
- package/dist/internal/otel/config.d.ts +40 -0
- package/dist/internal/otel/config.d.ts.map +1 -0
- package/dist/internal/otel/config.js +231 -0
- package/dist/internal/otel/http.d.ts +13 -0
- package/dist/internal/otel/http.d.ts.map +1 -0
- package/dist/internal/otel/http.js +95 -0
- package/dist/internal/otel/mcp.d.ts +16 -0
- package/dist/internal/otel/mcp.d.ts.map +1 -0
- package/dist/internal/otel/mcp.js +55 -0
- package/dist/internal/otel/propagation.d.ts +6 -0
- package/dist/internal/otel/propagation.d.ts.map +1 -0
- package/dist/internal/otel/propagation.js +14 -0
- package/dist/internal/otel/runtime.d.ts +46 -0
- package/dist/internal/otel/runtime.d.ts.map +1 -0
- package/dist/internal/otel/runtime.js +333 -0
- package/dist/internal/package-inline-stdio.d.ts +12 -0
- package/dist/internal/package-inline-stdio.d.ts.map +1 -0
- package/dist/internal/package-inline-stdio.js +99 -0
- package/dist/internal/peer-connections.d.ts +44 -0
- package/dist/internal/peer-connections.d.ts.map +1 -0
- package/dist/internal/peer-connections.js +67 -0
- package/dist/internal/platform-schedule-sync.d.ts +17 -0
- package/dist/internal/platform-schedule-sync.d.ts.map +1 -0
- package/dist/internal/platform-schedule-sync.js +70 -0
- package/dist/internal/platform-timers.d.ts +35 -0
- package/dist/internal/platform-timers.d.ts.map +1 -0
- package/dist/internal/platform-timers.js +277 -0
- package/dist/internal/playground/static.d.ts +52 -0
- package/dist/internal/playground/static.d.ts.map +1 -0
- package/dist/internal/playground/static.js +231 -0
- package/dist/internal/playground/toolchain.d.ts +57 -0
- package/dist/internal/playground/toolchain.d.ts.map +1 -0
- package/dist/internal/playground/toolchain.js +229 -0
- package/dist/internal/playground-proxy.d.ts +69 -0
- package/dist/internal/playground-proxy.d.ts.map +1 -0
- package/dist/internal/playground-proxy.js +474 -0
- package/dist/internal/process-memory-telemetry.d.ts +89 -0
- package/dist/internal/process-memory-telemetry.d.ts.map +1 -0
- package/dist/internal/process-memory-telemetry.js +244 -0
- package/dist/internal/project-layout.d.ts +7 -0
- package/dist/internal/project-layout.d.ts.map +1 -0
- package/dist/internal/project-layout.js +24 -0
- package/dist/internal/prompt-context.d.ts +38 -0
- package/dist/internal/prompt-context.d.ts.map +1 -0
- package/dist/internal/prompt-context.js +89 -0
- package/dist/internal/reminder-control-plane-protocol.d.ts +189 -0
- package/dist/internal/reminder-control-plane-protocol.d.ts.map +1 -0
- package/dist/internal/reminder-control-plane-protocol.js +246 -0
- package/dist/internal/reminder-runner.d.ts +208 -0
- package/dist/internal/reminder-runner.d.ts.map +1 -0
- package/dist/internal/reminder-runner.js +1231 -0
- package/dist/internal/reminder-schedule.d.ts +25 -0
- package/dist/internal/reminder-schedule.d.ts.map +1 -0
- package/dist/internal/reminder-schedule.js +82 -0
- package/dist/internal/reminder-store.d.ts +78 -0
- package/dist/internal/reminder-store.d.ts.map +1 -0
- package/dist/internal/reminder-store.js +126 -0
- package/dist/internal/request-error-status.d.ts +14 -0
- package/dist/internal/request-error-status.d.ts.map +1 -0
- package/dist/internal/request-error-status.js +76 -0
- package/dist/internal/request-headers.d.ts +11 -0
- package/dist/internal/request-headers.d.ts.map +1 -0
- package/dist/internal/request-headers.js +14 -0
- package/dist/internal/resolve-prod-target.d.ts +84 -0
- package/dist/internal/resolve-prod-target.d.ts.map +1 -0
- package/dist/internal/resolve-prod-target.js +259 -0
- package/dist/internal/resolved-connections.d.ts +62 -0
- package/dist/internal/resolved-connections.d.ts.map +1 -0
- package/dist/internal/resolved-connections.js +93 -0
- package/dist/internal/router.d.ts +33 -0
- package/dist/internal/router.d.ts.map +1 -0
- package/dist/internal/router.js +93 -0
- package/dist/internal/run-client.d.ts +68 -0
- package/dist/internal/run-client.d.ts.map +1 -0
- package/dist/internal/run-client.js +239 -0
- package/dist/internal/runtime-dispatch-runner.d.ts +24 -0
- package/dist/internal/runtime-dispatch-runner.d.ts.map +1 -0
- package/dist/internal/runtime-dispatch-runner.js +54 -0
- package/dist/internal/sanitize-mcp-tool-name.d.ts +20 -0
- package/dist/internal/sanitize-mcp-tool-name.d.ts.map +1 -0
- package/dist/internal/sanitize-mcp-tool-name.js +28 -0
- package/dist/internal/schedule-runner.d.ts +31 -0
- package/dist/internal/schedule-runner.d.ts.map +1 -0
- package/dist/internal/schedule-runner.js +127 -0
- package/dist/internal/scm/pr-url.d.ts +56 -0
- package/dist/internal/scm/pr-url.d.ts.map +1 -0
- package/dist/internal/scm/pr-url.js +152 -0
- package/dist/internal/sdk-runner.d.ts +190 -0
- package/dist/internal/sdk-runner.d.ts.map +1 -0
- package/dist/internal/sdk-runner.js +714 -0
- package/dist/internal/serve-restart.d.ts +42 -0
- package/dist/internal/serve-restart.d.ts.map +1 -0
- package/dist/internal/serve-restart.js +85 -0
- package/dist/internal/server.d.ts +34 -0
- package/dist/internal/server.d.ts.map +1 -0
- package/dist/internal/server.js +2464 -0
- package/dist/internal/session-cost.d.ts +50 -0
- package/dist/internal/session-cost.d.ts.map +1 -0
- package/dist/internal/session-cost.js +157 -0
- package/dist/internal/session-engine.d.ts +912 -0
- package/dist/internal/session-engine.d.ts.map +1 -0
- package/dist/internal/session-engine.js +4493 -0
- package/dist/internal/session-links.d.ts +14 -0
- package/dist/internal/session-links.d.ts.map +1 -0
- package/dist/internal/session-links.js +67 -0
- package/dist/internal/session-run-log.d.ts +122 -0
- package/dist/internal/session-run-log.d.ts.map +1 -0
- package/dist/internal/session-run-log.js +345 -0
- package/dist/internal/session-store.d.ts +73 -0
- package/dist/internal/session-store.d.ts.map +1 -0
- package/dist/internal/session-store.js +310 -0
- package/dist/internal/session-urls.d.ts +10 -0
- package/dist/internal/session-urls.d.ts.map +1 -0
- package/dist/internal/session-urls.js +25 -0
- package/dist/internal/sessions-client.d.ts +50 -0
- package/dist/internal/sessions-client.d.ts.map +1 -0
- package/dist/internal/sessions-client.js +207 -0
- package/dist/internal/skill-catalog.d.ts +28 -0
- package/dist/internal/skill-catalog.d.ts.map +1 -0
- package/dist/internal/skill-catalog.js +41 -0
- package/dist/internal/skills-sync.d.ts +24 -0
- package/dist/internal/skills-sync.d.ts.map +1 -0
- package/dist/internal/skills-sync.js +56 -0
- package/dist/internal/slack-provision-client.d.ts +198 -0
- package/dist/internal/slack-provision-client.d.ts.map +1 -0
- package/dist/internal/slack-provision-client.js +346 -0
- package/dist/internal/slack-thread-key.d.ts +7 -0
- package/dist/internal/slack-thread-key.d.ts.map +1 -0
- package/dist/internal/slack-thread-key.js +10 -0
- package/dist/internal/sleep.d.ts +2 -0
- package/dist/internal/sleep.d.ts.map +1 -0
- package/dist/internal/sleep.js +3 -0
- package/dist/internal/start-log-store.d.ts +60 -0
- package/dist/internal/start-log-store.d.ts.map +1 -0
- package/dist/internal/start-log-store.js +149 -0
- package/dist/internal/steering.d.ts +15 -0
- package/dist/internal/steering.d.ts.map +1 -0
- package/dist/internal/steering.js +18 -0
- package/dist/internal/storage-coordinator.d.ts +203 -0
- package/dist/internal/storage-coordinator.d.ts.map +1 -0
- package/dist/internal/storage-coordinator.js +705 -0
- package/dist/internal/storage-roles.d.ts +78 -0
- package/dist/internal/storage-roles.d.ts.map +1 -0
- package/dist/internal/storage-roles.js +24 -0
- package/dist/internal/storage.d.ts +2 -0
- package/dist/internal/storage.d.ts.map +1 -0
- package/dist/internal/storage.js +1 -0
- package/dist/internal/store-api-protocol.d.ts +134 -0
- package/dist/internal/store-api-protocol.d.ts.map +1 -0
- package/dist/internal/store-api-protocol.js +124 -0
- package/dist/internal/store-mirror.d.ts +29 -0
- package/dist/internal/store-mirror.d.ts.map +1 -0
- package/dist/internal/store-mirror.js +70 -0
- package/dist/internal/stream-progress.d.ts +14 -0
- package/dist/internal/stream-progress.d.ts.map +1 -0
- package/dist/internal/stream-progress.js +229 -0
- package/dist/internal/terminal-style.d.ts +40 -0
- package/dist/internal/terminal-style.d.ts.map +1 -0
- package/dist/internal/terminal-style.js +94 -0
- package/dist/internal/testing/factory-resource-fixtures.d.ts +48 -0
- package/dist/internal/testing/factory-resource-fixtures.d.ts.map +1 -0
- package/dist/internal/testing/factory-resource-fixtures.js +41 -0
- package/dist/internal/testing/scm-continuation-fixtures.d.ts +33 -0
- package/dist/internal/testing/scm-continuation-fixtures.d.ts.map +1 -0
- package/dist/internal/testing/scm-continuation-fixtures.js +253 -0
- package/dist/internal/tool-catalog.d.ts +31 -0
- package/dist/internal/tool-catalog.d.ts.map +1 -0
- package/dist/internal/tool-catalog.js +70 -0
- package/dist/internal/tool-policy.d.ts +110 -0
- package/dist/internal/tool-policy.d.ts.map +1 -0
- package/dist/internal/tool-policy.js +138 -0
- package/dist/internal/tool-result.d.ts +20 -0
- package/dist/internal/tool-result.d.ts.map +1 -0
- package/dist/internal/tool-result.js +45 -0
- package/dist/internal/trajectory.d.ts +69 -0
- package/dist/internal/trajectory.d.ts.map +1 -0
- package/dist/internal/trajectory.js +351 -0
- package/dist/internal/turn-cost.d.ts +41 -0
- package/dist/internal/turn-cost.d.ts.map +1 -0
- package/dist/internal/turn-cost.js +109 -0
- package/dist/internal/turn-governor.d.ts +54 -0
- package/dist/internal/turn-governor.d.ts.map +1 -0
- package/dist/internal/turn-governor.js +111 -0
- package/dist/internal/turn-lease-store.d.ts +44 -0
- package/dist/internal/turn-lease-store.d.ts.map +1 -0
- package/dist/internal/turn-lease-store.js +139 -0
- package/dist/internal/turn-outbox.d.ts +24 -0
- package/dist/internal/turn-outbox.d.ts.map +1 -0
- package/dist/internal/turn-outbox.js +80 -0
- package/dist/internal/update-check.d.ts +93 -0
- package/dist/internal/update-check.d.ts.map +1 -0
- package/dist/internal/update-check.js +427 -0
- package/dist/internal/v2-hosting.d.ts +31 -0
- package/dist/internal/v2-hosting.d.ts.map +1 -0
- package/dist/internal/v2-hosting.js +33 -0
- package/dist/internal/workspace-sync.d.ts +47 -0
- package/dist/internal/workspace-sync.d.ts.map +1 -0
- package/dist/internal/workspace-sync.js +104 -0
- package/dist/internal/workspace.d.ts +151 -0
- package/dist/internal/workspace.d.ts.map +1 -0
- package/dist/internal/workspace.js +455 -0
- package/dist/kv/memory-kv.d.ts +24 -0
- package/dist/kv/memory-kv.d.ts.map +1 -0
- package/dist/kv/memory-kv.js +104 -0
- package/dist/kv.d.ts +18 -0
- package/dist/kv.d.ts.map +1 -0
- package/dist/kv.js +16 -0
- package/dist/memory.d.ts +138 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +401 -0
- package/dist/otel-public.d.ts +7 -0
- package/dist/otel-public.d.ts.map +1 -0
- package/dist/otel-public.js +5 -0
- package/dist/otel.d.ts +131 -0
- package/dist/otel.d.ts.map +1 -0
- package/dist/otel.js +186 -0
- package/dist/playground/assets/cursor-icons-16-4RnoYH3n.woff2 +0 -0
- package/dist/playground/assets/index-BMV_IcEE.css +1 -0
- package/dist/playground/assets/index-FFdUqTt_.js +71 -0
- package/dist/playground/index.html +17 -0
- package/dist/prompt.d.ts +39 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +70 -0
- package/dist/reminders.d.ts +42 -0
- package/dist/reminders.d.ts.map +1 -0
- package/dist/reminders.js +45 -0
- package/dist/schedules.d.ts +23 -0
- package/dist/schedules.d.ts.map +1 -0
- package/dist/schedules.js +26 -0
- package/dist/skills.d.ts +22 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +22 -0
- package/dist/storage-backends/cursor-hosted-v2.d.ts +82 -0
- package/dist/storage-backends/cursor-hosted-v2.d.ts.map +1 -0
- package/dist/storage-backends/cursor-hosted-v2.js +171 -0
- package/dist/storage-backends/cursor-hosted.d.ts +107 -0
- package/dist/storage-backends/cursor-hosted.d.ts.map +1 -0
- package/dist/storage-backends/cursor-hosted.js +278 -0
- package/dist/storage-backends/file-kv.d.ts +42 -0
- package/dist/storage-backends/file-kv.d.ts.map +1 -0
- package/dist/storage-backends/file-kv.js +254 -0
- package/dist/storage-protocol.d.ts +142 -0
- package/dist/storage-protocol.d.ts.map +1 -0
- package/dist/storage-protocol.js +201 -0
- package/dist/storage.d.ts +254 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +154 -0
- package/dist/tools.d.ts +132 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +77 -0
- package/dist/types.d.ts +3375 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +189 -0
- package/docs/README.md +119 -0
- package/docs/building-with-agents.md +140 -0
- package/docs/deployment.md +216 -0
- package/docs/evals.md +262 -0
- package/docs/guides/agent-to-agent.md +157 -0
- package/docs/guides/bitbucket.md +293 -0
- package/docs/guides/cloud-agents.md +95 -0
- package/docs/guides/convert-automation.md +188 -0
- package/docs/guides/github.md +331 -0
- package/docs/guides/gitlab.md +299 -0
- package/docs/guides/grokbot-agents.md +147 -0
- package/docs/guides/hooks.md +119 -0
- package/docs/guides/improve.md +139 -0
- package/docs/guides/jev.md +299 -0
- package/docs/guides/mcp-oauth.md +167 -0
- package/docs/guides/opentelemetry.md +158 -0
- package/docs/guides/slack.md +278 -0
- package/docs/guides/webhooks.md +241 -0
- package/docs/hillclimbing.md +142 -0
- package/docs/quickstart.md +311 -0
- package/docs/reference/agent-config.md +193 -0
- package/docs/reference/artifacts.md +121 -0
- package/docs/reference/channels.md +203 -0
- package/docs/reference/cli.md +909 -0
- package/docs/reference/connections.md +277 -0
- package/docs/reference/evals.md +292 -0
- package/docs/reference/extensions.md +198 -0
- package/docs/reference/hooks.md +195 -0
- package/docs/reference/http-api.md +236 -0
- package/docs/reference/instructions.md +68 -0
- package/docs/reference/playground.md +47 -0
- package/docs/reference/project-layout.md +120 -0
- package/docs/reference/prompt.md +55 -0
- package/docs/reference/schedules.md +175 -0
- package/docs/reference/sessions.md +165 -0
- package/docs/reference/skills.md +80 -0
- package/docs/reference/subagents.md +67 -0
- package/docs/reference/tools.md +329 -0
- package/docs/templates/agentic-owners.md +100 -0
- package/docs/templates/security-reviewer.md +90 -0
- package/docs/templates/thermo-quality-review.md +83 -0
- package/docs/templates/thermo-review.md +82 -0
- package/docs/templates/triage.md +102 -0
- package/docs/troubleshooting.md +148 -0
- package/package.json +384 -0
- package/scripts/install-cursor-skills.mjs +29 -0
- package/skills/create-agent/SKILL.md +170 -0
- package/skills/debug/SKILL.md +43 -0
- package/skills/deploy/SKILL.md +169 -0
- package/skills/evals/SKILL.md +145 -0
- package/skills/framework-map/SKILL.md +125 -0
- package/skills/github/SKILL.md +110 -0
- package/skills/hillclimb/SKILL.md +63 -0
- package/skills/mcp-auth/SKILL.md +84 -0
- package/skills/otel/SKILL.md +50 -0
- package/skills/setup-slack/SKILL.md +149 -0
- package/src/artifacts.ts +65 -0
- package/src/bin/agent-serve.ts +1833 -0
- package/src/channels/bitbucket/api.ts +891 -0
- package/src/channels/bitbucket/binding.ts +417 -0
- package/src/channels/bitbucket/bitbucket-channel.ts +162 -0
- package/src/channels/bitbucket/bitbucket-webhook.ts +519 -0
- package/src/channels/bitbucket/checks.ts +146 -0
- package/src/channels/bitbucket/cursor-account.ts +106 -0
- package/src/channels/bitbucket/defaults.ts +100 -0
- package/src/channels/bitbucket/events.ts +74 -0
- package/src/channels/bitbucket/index.ts +51 -0
- package/src/channels/bitbucket/replay.ts +421 -0
- package/src/channels/bitbucket/state.ts +59 -0
- package/src/channels/bitbucket/types.ts +261 -0
- package/src/channels/change-monitors/change-monitors-channel.ts +63 -0
- package/src/channels/change-monitors/index.ts +8 -0
- package/src/channels/change-monitors/types.ts +42 -0
- package/src/channels/checks.ts +185 -0
- package/src/channels/deployments/deployments-channel.ts +224 -0
- package/src/channels/deployments/index.ts +25 -0
- package/src/channels/deployments/types.ts +92 -0
- package/src/channels/github/api.ts +526 -0
- package/src/channels/github/auth.ts +254 -0
- package/src/channels/github/binding.ts +233 -0
- package/src/channels/github/checks.ts +145 -0
- package/src/channels/github/cursor-account.ts +303 -0
- package/src/channels/github/defaults.ts +168 -0
- package/src/channels/github/events.ts +67 -0
- package/src/channels/github/forward.ts +359 -0
- package/src/channels/github/github-channel.ts +2334 -0
- package/src/channels/github/index.ts +54 -0
- package/src/channels/github/progress.ts +365 -0
- package/src/channels/github/replay.ts +372 -0
- package/src/channels/github/state.ts +124 -0
- package/src/channels/github/types.ts +590 -0
- package/src/channels/gitlab/api.ts +329 -0
- package/src/channels/gitlab/binding.ts +231 -0
- package/src/channels/gitlab/checks.ts +228 -0
- package/src/channels/gitlab/cursor-account.ts +105 -0
- package/src/channels/gitlab/defaults.ts +80 -0
- package/src/channels/gitlab/events.ts +37 -0
- package/src/channels/gitlab/gitlab-channel.ts +160 -0
- package/src/channels/gitlab/gitlab-webhook.ts +509 -0
- package/src/channels/gitlab/index.ts +44 -0
- package/src/channels/gitlab/replay.ts +328 -0
- package/src/channels/gitlab/state.ts +55 -0
- package/src/channels/gitlab/types.ts +247 -0
- package/src/channels/issues/index.ts +9 -0
- package/src/channels/issues/issues-channel.ts +45 -0
- package/src/channels/issues/types.ts +38 -0
- package/src/channels/origin/api.ts +507 -0
- package/src/channels/origin/binding.ts +114 -0
- package/src/channels/origin/checks.ts +250 -0
- package/src/channels/origin/cursor-account.ts +58 -0
- package/src/channels/origin/defaults.ts +140 -0
- package/src/channels/origin/events.ts +35 -0
- package/src/channels/origin/index.ts +35 -0
- package/src/channels/origin/origin-channel.ts +815 -0
- package/src/channels/origin/origin-webhook.ts +296 -0
- package/src/channels/origin/reactions.ts +72 -0
- package/src/channels/origin/state.ts +54 -0
- package/src/channels/origin/types.ts +295 -0
- package/src/channels/slack/agentic-delivery.ts +634 -0
- package/src/channels/slack/agentic-posted.ts +135 -0
- package/src/channels/slack/agentic-signals.ts +231 -0
- package/src/channels/slack/api.ts +761 -0
- package/src/channels/slack/approvals.ts +279 -0
- package/src/channels/slack/assistant.ts +76 -0
- package/src/channels/slack/attachments.ts +596 -0
- package/src/channels/slack/auth.ts +127 -0
- package/src/channels/slack/blocks.ts +131 -0
- package/src/channels/slack/bot-mentions.ts +318 -0
- package/src/channels/slack/channel-watch.ts +314 -0
- package/src/channels/slack/cli-project.ts +249 -0
- package/src/channels/slack/code-fences.ts +171 -0
- package/src/channels/slack/constants.ts +38 -0
- package/src/channels/slack/credentials.ts +88 -0
- package/src/channels/slack/defaults.ts +714 -0
- package/src/channels/slack/dispatch.ts +1060 -0
- package/src/channels/slack/doctor.ts +338 -0
- package/src/channels/slack/eval-directive.ts +306 -0
- package/src/channels/slack/event-id-dedupe.ts +30 -0
- package/src/channels/slack/external-policy.ts +75 -0
- package/src/channels/slack/footer.ts +106 -0
- package/src/channels/slack/inbound.ts +416 -0
- package/src/channels/slack/index.ts +53 -0
- package/src/channels/slack/init.ts +169 -0
- package/src/channels/slack/interactive.ts +406 -0
- package/src/channels/slack/links.ts +23 -0
- package/src/channels/slack/live-delivery.ts +489 -0
- package/src/channels/slack/log.ts +70 -0
- package/src/channels/slack/manifest.ts +239 -0
- package/src/channels/slack/message-body.ts +82 -0
- package/src/channels/slack/nudge-carrier.ts +224 -0
- package/src/channels/slack/nudge-store.ts +334 -0
- package/src/channels/slack/paint-start.ts +93 -0
- package/src/channels/slack/placeholder.ts +358 -0
- package/src/channels/slack/pr-ref.ts +74 -0
- package/src/channels/slack/progress-delivery.ts +138 -0
- package/src/channels/slack/reasoning-card.ts +125 -0
- package/src/channels/slack/reasoning-chip.ts +41 -0
- package/src/channels/slack/recording-sink.ts +167 -0
- package/src/channels/slack/redact.ts +6 -0
- package/src/channels/slack/reply-options.ts +279 -0
- package/src/channels/slack/setup.ts +125 -0
- package/src/channels/slack/slack-channel.ts +744 -0
- package/src/channels/slack/socket-mode.ts +140 -0
- package/src/channels/slack/stop.ts +25 -0
- package/src/channels/slack/stream.ts +66 -0
- package/src/channels/slack/thread-context.ts +485 -0
- package/src/channels/slack/tool-approval-events.ts +233 -0
- package/src/channels/slack/tool-cards.ts +198 -0
- package/src/channels/slack/tool-chip.ts +34 -0
- package/src/channels/slack/types.ts +782 -0
- package/src/channels/slack/upload.ts +137 -0
- package/src/channels.ts +543 -0
- package/src/connections.ts +153 -0
- package/src/dashboard-session-url.ts +30 -0
- package/src/evals/assertions.ts +688 -0
- package/src/evals/expect.ts +250 -0
- package/src/evals/judge.ts +329 -0
- package/src/evals/loaders.ts +111 -0
- package/src/evals/matchers.ts +223 -0
- package/src/evals/reporters.ts +257 -0
- package/src/evals/results.ts +130 -0
- package/src/evals/run-facts.ts +306 -0
- package/src/evals.ts +709 -0
- package/src/extensions/cursor-cloud-agents/extension.ts +114 -0
- package/src/extensions/cursor-cloud-agents/lib/backend.ts +386 -0
- package/src/extensions/cursor-cloud-agents/lib/fleet.ts +98 -0
- package/src/extensions/cursor-cloud-agents/lib/inputs.ts +5 -0
- package/src/extensions/cursor-cloud-agents/lib/repos.ts +68 -0
- package/src/extensions/cursor-cloud-agents/lib/transcript.ts +19 -0
- package/src/extensions/cursor-cloud-agents/skills/handoff.md +37 -0
- package/src/extensions/cursor-cloud-agents/tools/cancel.ts +19 -0
- package/src/extensions/cursor-cloud-agents/tools/dump.ts +47 -0
- package/src/extensions/cursor-cloud-agents/tools/get.ts +18 -0
- package/src/extensions/cursor-cloud-agents/tools/launch.ts +60 -0
- package/src/extensions/cursor-cloud-agents/tools/list.ts +31 -0
- package/src/extensions/cursor-cloud-agents/tools/reply.ts +34 -0
- package/src/extensions/improve/extension.ts +69 -0
- package/src/extensions/improve/skills/yourself.ts +50 -0
- package/src/extensions/jev/extension.ts +95 -0
- package/src/extensions/jev/lib/evaluate.ts +266 -0
- package/src/extensions/jev/skills/gated-write.md +25 -0
- package/src/extensions/jev/skills/questions.md +33 -0
- package/src/extensions/jev/tools/evaluate.ts +82 -0
- package/src/extensions/slack-communication/evals/harness.ts +705 -0
- package/src/extensions/slack-communication/evals/slack-communication.eval.ts +830 -0
- package/src/extensions/slack-communication/evals/slack-placeholder.eval.ts +172 -0
- package/src/extensions/slack-communication/extension.ts +44 -0
- package/src/extensions/slack-communication/skills/slack-voice.ts +56 -0
- package/src/extensions/slack-communication/tools/delete-message.ts +33 -0
- package/src/extensions/slack-communication/tools/edit-message.ts +42 -0
- package/src/extensions/slack-communication/tools/post-card.ts +28 -0
- package/src/extensions/slack-communication/tools/post-file.ts +82 -0
- package/src/extensions/slack-communication/tools/post-update.ts +40 -0
- package/src/extensions/slack-communication/tools/react.ts +30 -0
- package/src/extensions/slack-communication/tools/set-status.ts +21 -0
- package/src/extensions.ts +179 -0
- package/src/files-backends/agent-store-presigned-url.ts +11 -0
- package/src/files-backends/cursor-hosted.ts +1212 -0
- package/src/files-backends/local-fs.ts +163 -0
- package/src/files.ts +293 -0
- package/src/filesystem.ts +2005 -0
- package/src/hooks.ts +30 -0
- package/src/index.ts +259 -0
- package/src/internal/advertise-tools.ts +370 -0
- package/src/internal/approval-gate.ts +103 -0
- package/src/internal/artifacts-store.ts +825 -0
- package/src/internal/as-of.ts +257 -0
- package/src/internal/auth.ts +46 -0
- package/src/internal/authored-alias-hooks.ts +138 -0
- package/src/internal/authored-loaders.ts +188 -0
- package/src/internal/bounded-int.ts +24 -0
- package/src/internal/bounded.ts +25 -0
- package/src/internal/brand.ts +28 -0
- package/src/internal/browser-origin-guard.ts +67 -0
- package/src/internal/builtin-tools/artifacts.ts +62 -0
- package/src/internal/builtin-tools/index.ts +53 -0
- package/src/internal/builtin-tools/reminders.ts +145 -0
- package/src/internal/channel-dispatch.ts +129 -0
- package/src/internal/channel-route-dispatch.ts +58 -0
- package/src/internal/channel-state.ts +83 -0
- package/src/internal/chat-client.ts +594 -0
- package/src/internal/cli-ax.ts +2273 -0
- package/src/internal/cli-bitbucket.ts +438 -0
- package/src/internal/cli-convert-automation.ts +335 -0
- package/src/internal/cli-cursor.ts +282 -0
- package/src/internal/cli-deploy.ts +2486 -0
- package/src/internal/cli-docs.ts +192 -0
- package/src/internal/cli-github.ts +806 -0
- package/src/internal/cli-gitlab.ts +452 -0
- package/src/internal/cli-images.ts +672 -0
- package/src/internal/cli-manifest.ts +56 -0
- package/src/internal/cli-mcp-oauth.ts +395 -0
- package/src/internal/cli-mcp.ts +808 -0
- package/src/internal/cli-skills.ts +99 -0
- package/src/internal/cli-slack-manual.ts +418 -0
- package/src/internal/cli-slack.ts +874 -0
- package/src/internal/cloud-merge.ts +51 -0
- package/src/internal/cloud-turn-cost.ts +159 -0
- package/src/internal/continuation-channel.ts +233 -0
- package/src/internal/continuation-identity.ts +935 -0
- package/src/internal/conversation-mirror.ts +423 -0
- package/src/internal/convert-automation/convert-workflow.ts +1377 -0
- package/src/internal/convert-automation/slug.ts +29 -0
- package/src/internal/convert-automation/types.ts +212 -0
- package/src/internal/cron.ts +76 -0
- package/src/internal/cursor/account-mcp.ts +692 -0
- package/src/internal/cursor/backend-client.ts +978 -0
- package/src/internal/cursor/bound-secret-file.ts +101 -0
- package/src/internal/cursor/credentials.ts +560 -0
- package/src/internal/cursor/cursor-api-transport.ts +65 -0
- package/src/internal/cursor/github-credentials.ts +228 -0
- package/src/internal/cursor/hosted-bound-secrets.ts +71 -0
- package/src/internal/cursor/hosted-deployment-secrets.ts +100 -0
- package/src/internal/cursor/hosted-store-secrets.ts +152 -0
- package/src/internal/cursor/session-token.ts +111 -0
- package/src/internal/cursor/store-api-client.ts +323 -0
- package/src/internal/cursor-account-mcp-auth.ts +303 -0
- package/src/internal/cursor-agent-template.ts +50 -0
- package/src/internal/cursor-deployment-relay.ts +315 -0
- package/src/internal/cursor-event-relay.ts +675 -0
- package/src/internal/cursor-relay-core.ts +563 -0
- package/src/internal/deferred-channel-session.ts +61 -0
- package/src/internal/deploy-client.ts +1504 -0
- package/src/internal/deploy-manifest.ts +361 -0
- package/src/internal/deploy-source.ts +144 -0
- package/src/internal/describe-error.ts +32 -0
- package/src/internal/dev-mode.ts +20 -0
- package/src/internal/discovery/agent-config.ts +288 -0
- package/src/internal/discovery/agent.ts +381 -0
- package/src/internal/discovery/channels.ts +100 -0
- package/src/internal/discovery/connections.ts +505 -0
- package/src/internal/discovery/context.ts +38 -0
- package/src/internal/discovery/cursor-plugin.ts +628 -0
- package/src/internal/discovery/extension-overlay.ts +247 -0
- package/src/internal/discovery/extensions.ts +490 -0
- package/src/internal/discovery/fs.ts +103 -0
- package/src/internal/discovery/hooks.ts +63 -0
- package/src/internal/discovery/info.ts +174 -0
- package/src/internal/discovery/instructions.ts +98 -0
- package/src/internal/discovery/modules.ts +107 -0
- package/src/internal/discovery/names.ts +45 -0
- package/src/internal/discovery/project.ts +319 -0
- package/src/internal/discovery/reminders.ts +65 -0
- package/src/internal/discovery/runtime.ts +158 -0
- package/src/internal/discovery/schedules.ts +120 -0
- package/src/internal/discovery/seed-files.ts +34 -0
- package/src/internal/discovery/services.ts +151 -0
- package/src/internal/discovery/skills.ts +174 -0
- package/src/internal/discovery/subagent.ts +138 -0
- package/src/internal/discovery/tools.ts +170 -0
- package/src/internal/discovery.ts +27 -0
- package/src/internal/distribution.ts +126 -0
- package/src/internal/docs-site.ts +248 -0
- package/src/internal/duration.ts +37 -0
- package/src/internal/env-file.ts +83 -0
- package/src/internal/eval-judge-model.ts +142 -0
- package/src/internal/eval-run-store.ts +585 -0
- package/src/internal/eval-runner.ts +823 -0
- package/src/internal/evals-client.ts +475 -0
- package/src/internal/event-log.ts +342 -0
- package/src/internal/event-mapper.ts +480 -0
- package/src/internal/expected-delivery-failure.ts +34 -0
- package/src/internal/factory-resource-channel.ts +103 -0
- package/src/internal/filesystem/errors.ts +207 -0
- package/src/internal/filesystem/format.ts +253 -0
- package/src/internal/filesystem/merge.ts +192 -0
- package/src/internal/filesystem/nearest.ts +112 -0
- package/src/internal/filesystem/scratch.ts +239 -0
- package/src/internal/filesystem/sdk-schemas.ts +204 -0
- package/src/internal/filesystem/tools.ts +804 -0
- package/src/internal/filesystem/walk.ts +366 -0
- package/src/internal/fixtures/units-server.ts +52 -0
- package/src/internal/framework-file-storage.ts +357 -0
- package/src/internal/framework-storage-selection.ts +156 -0
- package/src/internal/frontmatter.ts +108 -0
- package/src/internal/github-fanout.ts +144 -0
- package/src/internal/guest-network.ts +391 -0
- package/src/internal/handleAgentServeTrigger.ts +286 -0
- package/src/internal/host-files.ts +341 -0
- package/src/internal/host-kv.ts +81 -0
- package/src/internal/host-otel.ts +231 -0
- package/src/internal/host-platforms.ts +170 -0
- package/src/internal/hosted-admission-adapter.ts +47 -0
- package/src/internal/hosted-admission-context.ts +37 -0
- package/src/internal/hosted-catch-protocol.ts +112 -0
- package/src/internal/hosted-catch.ts +179 -0
- package/src/internal/hosted-delivery-protocol.ts +787 -0
- package/src/internal/hosted-delivery.ts +1152 -0
- package/src/internal/hosted-execution-diag.ts +291 -0
- package/src/internal/hosted-execution-flush.ts +136 -0
- package/src/internal/hosted-execution-latency.ts +301 -0
- package/src/internal/hosted-managed-automation.ts +116 -0
- package/src/internal/hosting.ts +107 -0
- package/src/internal/http-channel-define.ts +25 -0
- package/src/internal/http-channel.ts +669 -0
- package/src/internal/http-control-plane-session.ts +110 -0
- package/src/internal/ids.ts +39 -0
- package/src/internal/incoming-headers-to-fetch.ts +45 -0
- package/src/internal/init-interview.ts +360 -0
- package/src/internal/init-project.ts +711 -0
- package/src/internal/init-scaffold.ts +182 -0
- package/src/internal/inline-stdio-define-stub.ts +4 -0
- package/src/internal/inline-stdio-mcp.ts +230 -0
- package/src/internal/install-cursor-skills.ts +601 -0
- package/src/internal/is-record.ts +3 -0
- package/src/internal/json-schema.ts +95 -0
- package/src/internal/legacy-command-guard.ts +54 -0
- package/src/internal/listen-port.ts +85 -0
- package/src/internal/local-control-plane.ts +442 -0
- package/src/internal/local-env.ts +59 -0
- package/src/internal/local-ingress.ts +90 -0
- package/src/internal/log-ring.ts +59 -0
- package/src/internal/logs-client.ts +477 -0
- package/src/internal/map-pool.ts +39 -0
- package/src/internal/mcp-endpoint.ts +747 -0
- package/src/internal/mcp-host.ts +481 -0
- package/src/internal/mcp-oauth-on-demand.ts +337 -0
- package/src/internal/mcp-oauth-persist.ts +118 -0
- package/src/internal/mcp-oauth.ts +549 -0
- package/src/internal/net.ts +29 -0
- package/src/internal/open-browser.ts +41 -0
- package/src/internal/otel/attrs.ts +16 -0
- package/src/internal/otel/collector.ts +937 -0
- package/src/internal/otel/config.ts +287 -0
- package/src/internal/otel/http.ts +122 -0
- package/src/internal/otel/mcp.ts +56 -0
- package/src/internal/otel/propagation.ts +17 -0
- package/src/internal/otel/runtime.ts +441 -0
- package/src/internal/package-inline-stdio.ts +114 -0
- package/src/internal/peer-connections.ts +96 -0
- package/src/internal/platform-schedule-sync.ts +75 -0
- package/src/internal/platform-timers.ts +365 -0
- package/src/internal/playground/static.ts +278 -0
- package/src/internal/playground/toolchain.ts +270 -0
- package/src/internal/playground-proxy.ts +564 -0
- package/src/internal/process-memory-telemetry.ts +334 -0
- package/src/internal/project-layout.ts +31 -0
- package/src/internal/prompt-context.ts +116 -0
- package/src/internal/reminder-control-plane-protocol.ts +482 -0
- package/src/internal/reminder-runner.ts +1559 -0
- package/src/internal/reminder-schedule.ts +104 -0
- package/src/internal/reminder-store.ts +176 -0
- package/src/internal/request-error-status.ts +95 -0
- package/src/internal/request-headers.ts +21 -0
- package/src/internal/resolve-prod-target.ts +334 -0
- package/src/internal/resolved-connections.ts +190 -0
- package/src/internal/router.ts +143 -0
- package/src/internal/run-client.ts +354 -0
- package/src/internal/runtime-dispatch-runner.ts +50 -0
- package/src/internal/sanitize-mcp-tool-name.ts +31 -0
- package/src/internal/schedule-runner.ts +154 -0
- package/src/internal/scm/pr-url.ts +245 -0
- package/src/internal/sdk-runner.ts +948 -0
- package/src/internal/serve-restart.ts +113 -0
- package/src/internal/server.ts +3135 -0
- package/src/internal/session-cost.ts +208 -0
- package/src/internal/session-engine.ts +5602 -0
- package/src/internal/session-links.ts +84 -0
- package/src/internal/session-run-log.ts +535 -0
- package/src/internal/session-store.ts +307 -0
- package/src/internal/session-urls.ts +32 -0
- package/src/internal/sessions-client.ts +239 -0
- package/src/internal/skill-catalog.ts +66 -0
- package/src/internal/skills-sync.ts +55 -0
- package/src/internal/slack-provision-client.ts +544 -0
- package/src/internal/slack-thread-key.ts +11 -0
- package/src/internal/sleep.ts +3 -0
- package/src/internal/start-log-store.ts +164 -0
- package/src/internal/steering.ts +17 -0
- package/src/internal/storage-coordinator.ts +800 -0
- package/src/internal/storage-roles.ts +86 -0
- package/src/internal/storage.ts +1 -0
- package/src/internal/store-api-protocol.ts +205 -0
- package/src/internal/store-mirror.ts +73 -0
- package/src/internal/stream-progress.ts +294 -0
- package/src/internal/terminal-style.ts +133 -0
- package/src/internal/testing/factory-resource-fixtures.ts +84 -0
- package/src/internal/testing/scm-continuation-fixtures.ts +285 -0
- package/src/internal/tool-catalog.ts +104 -0
- package/src/internal/tool-policy.ts +222 -0
- package/src/internal/tool-result.ts +50 -0
- package/src/internal/trajectory.ts +418 -0
- package/src/internal/turn-cost.ts +136 -0
- package/src/internal/turn-governor.ts +145 -0
- package/src/internal/turn-lease-store.ts +144 -0
- package/src/internal/turn-outbox.ts +77 -0
- package/src/internal/update-check.ts +517 -0
- package/src/internal/v2-hosting.ts +52 -0
- package/src/internal/workspace-sync.ts +114 -0
- package/src/internal/workspace.ts +505 -0
- package/src/kv/memory-kv.ts +94 -0
- package/src/kv.ts +18 -0
- package/src/memory.ts +487 -0
- package/src/otel-public.ts +24 -0
- package/src/otel.ts +320 -0
- package/src/prompt.ts +80 -0
- package/src/reminders.ts +65 -0
- package/src/schedules.ts +31 -0
- package/src/skills.ts +27 -0
- package/src/storage-backends/cursor-hosted-v2.ts +204 -0
- package/src/storage-backends/cursor-hosted.ts +388 -0
- package/src/storage-backends/file-kv.ts +276 -0
- package/src/storage-protocol.ts +261 -0
- package/src/storage.ts +408 -0
- package/src/tools.ts +166 -0
- package/src/types.ts +3725 -0
- package/templates/agentic-owners/README.md +76 -0
- package/templates/agentic-owners/bot/agent.ts +8 -0
- package/templates/agentic-owners/bot/channels/github.ts +63 -0
- package/templates/agentic-owners/bot/instructions.md +34 -0
- package/templates/agentic-owners/bot/lib/config.ts +5 -0
- package/templates/agentic-owners/bot/lib/github.ts +217 -0
- package/templates/agentic-owners/bot/lib/owners/README.md +50 -0
- package/templates/agentic-owners/bot/lib/owners/constants.ts +22 -0
- package/templates/agentic-owners/bot/lib/owners/decision.ts +454 -0
- package/templates/agentic-owners/bot/lib/owners/handles.ts +54 -0
- package/templates/agentic-owners/bot/lib/owners/match.ts +219 -0
- package/templates/agentic-owners/bot/lib/owners/matching.ts +78 -0
- package/templates/agentic-owners/bot/lib/owners/parse.ts +565 -0
- package/templates/agentic-owners/bot/lib/owners/policyMode.ts +57 -0
- package/templates/agentic-owners/bot/lib/owners/prompt.ts +64 -0
- package/templates/agentic-owners/bot/lib/owners/prompts/base-review.md +105 -0
- package/templates/agentic-owners/bot/lib/owners/types.ts +50 -0
- package/templates/agentic-owners/bot/lib/review.ts +722 -0
- package/templates/agentic-owners/bot/tools/record_review.ts +62 -0
- package/templates/agentic-owners/evals/evals.config.ts +5 -0
- package/templates/agentic-owners/evals/owners.eval.ts +111 -0
- package/templates/agentic-owners/package.json +20 -0
- package/templates/agentic-owners/tsconfig.json +12 -0
- package/templates/agents-md/README.md +42 -0
- package/templates/agents-md/bot/agent.ts +8 -0
- package/templates/agents-md/bot/channels/github.ts +10 -0
- package/templates/agents-md/bot/channels/queue.ts +28 -0
- package/templates/agents-md/bot/channels/slack.ts +9 -0
- package/templates/agents-md/bot/instructions.md +39 -0
- package/templates/agents-md/bot/lib/collect.ts +415 -0
- package/templates/agents-md/bot/lib/config.ts +8 -0
- package/templates/agents-md/bot/lib/paths.ts +49 -0
- package/templates/agents-md/bot/schedules/weekly.ts +17 -0
- package/templates/agents-md/bot/tools/apply_agents.ts +218 -0
- package/templates/agents-md/evals/agents.eval.ts +135 -0
- package/templates/agents-md/evals/evals.config.ts +5 -0
- package/templates/agents-md/init.json +38 -0
- package/templates/agents-md/package.json +18 -0
- package/templates/agents-md/tsconfig.json +12 -0
- package/templates/code-wiki/README.md +37 -0
- package/templates/code-wiki/bot/agent.ts +8 -0
- package/templates/code-wiki/bot/channels/github.ts +125 -0
- package/templates/code-wiki/bot/instructions.md +39 -0
- package/templates/code-wiki/bot/lib/repos.ts +5 -0
- package/templates/code-wiki/bot/lib/wiki.ts +22 -0
- package/templates/code-wiki/bot/tools/apply_wiki.ts +210 -0
- package/templates/code-wiki/evals/evals.config.ts +5 -0
- package/templates/code-wiki/evals/wiki.eval.ts +124 -0
- package/templates/code-wiki/init.json +25 -0
- package/templates/code-wiki/package.json +18 -0
- package/templates/code-wiki/tsconfig.json +12 -0
- package/templates/demo/README.md +40 -0
- package/templates/demo/bot/agent.ts +8 -0
- package/templates/demo/bot/channels/github.ts +48 -0
- package/templates/demo/bot/channels/queue.ts +34 -0
- package/templates/demo/bot/instructions.md +8 -0
- package/templates/demo/bot/lib/collect.ts +66 -0
- package/templates/demo/bot/lib/repos.ts +5 -0
- package/templates/demo/bot/tools/record_demo.ts +37 -0
- package/templates/demo/evals/demo.eval.ts +29 -0
- package/templates/demo/evals/evals.config.ts +5 -0
- package/templates/demo/init.json +25 -0
- package/templates/demo/package.json +18 -0
- package/templates/demo/tsconfig.json +12 -0
- package/templates/grokbot-agents/README.md +29 -0
- package/templates/grokbot-agents/bot/agent.ts +6 -0
- package/templates/grokbot-agents/bot/extensions/grokbot.ts +5 -0
- package/templates/grokbot-agents/bot/instructions.md +7 -0
- package/templates/grokbot-agents/evals/evals.config.ts +5 -0
- package/templates/grokbot-agents/evals/grokbot-agents.eval.ts +18 -0
- package/templates/grokbot-agents/init.json +18 -0
- package/templates/grokbot-agents/package.json +17 -0
- package/templates/grokbot-agents/tsconfig.json +12 -0
- package/templates/pr-autofixer/bot/agent.ts +11 -0
- package/templates/pr-autofixer/bot/channels/drive.ts +37 -0
- package/templates/pr-autofixer/bot/channels/github.ts +155 -0
- package/templates/pr-autofixer/bot/channels/slack.ts +16 -0
- package/templates/pr-autofixer/bot/hooks/bind-agent.ts +19 -0
- package/templates/pr-autofixer/bot/instructions.md +83 -0
- package/templates/pr-autofixer/bot/lib/affinity.ts +24 -0
- package/templates/pr-autofixer/bot/lib/drive-schemas.ts +18 -0
- package/templates/pr-autofixer/bot/lib/drive.ts +73 -0
- package/templates/pr-autofixer/bot/lib/merge-watch.ts +116 -0
- package/templates/pr-autofixer/bot/lib/pr-state.ts +40 -0
- package/templates/pr-autofixer/bot/lib/repos.ts +18 -0
- package/templates/pr-autofixer/bot/lib/start-drive.ts +113 -0
- package/templates/pr-autofixer/bot/lib/webhook-buffer.ts +215 -0
- package/templates/pr-autofixer/bot/lib/webhook-routing.ts +231 -0
- package/templates/pr-autofixer/bot/tools/drive_pr.ts +22 -0
- package/templates/pr-autofixer/evals/coordinator.eval.ts +16 -0
- package/templates/pr-autofixer/evals/evals.config.ts +5 -0
- package/templates/pr-autofixer/init.json +25 -0
- package/templates/pr-autofixer/package.json +18 -0
- package/templates/pr-autofixer/tsconfig.json +12 -0
- package/templates/security-help/README.md +40 -0
- package/templates/security-help/bot/agent.ts +17 -0
- package/templates/security-help/bot/channels/github.ts +13 -0
- package/templates/security-help/bot/channels/slack.ts +84 -0
- package/templates/security-help/bot/instructions.md +19 -0
- package/templates/security-help/bot/lib/pr-first-pass.ts +40 -0
- package/templates/security-help/bot/lib/repos.ts +5 -0
- package/templates/security-help/bot/skills/access-request.md +10 -0
- package/templates/security-help/bot/skills/faq.md +31 -0
- package/templates/security-help/bot/skills/security-playbooks.md +12 -0
- package/templates/security-help/bot/skills/security-pr-first-pass.md +12 -0
- package/templates/security-help/evals/evals.config.ts +5 -0
- package/templates/security-help/evals/security-help.eval.ts +51 -0
- package/templates/security-help/init.json +31 -0
- package/templates/security-help/package.json +17 -0
- package/templates/security-help/tsconfig.json +12 -0
- package/templates/security-reviewer/README.md +34 -0
- package/templates/security-reviewer/bot/agent.ts +8 -0
- package/templates/security-reviewer/bot/channels/github.ts +43 -0
- package/templates/security-reviewer/bot/instructions.md +22 -0
- package/templates/security-reviewer/bot/lib/repos.ts +5 -0
- package/templates/security-reviewer/bot/tools/post_findings.ts +68 -0
- package/templates/security-reviewer/evals/evals.config.ts +5 -0
- package/templates/security-reviewer/evals/review.eval.ts +50 -0
- package/templates/security-reviewer/init.json +25 -0
- package/templates/security-reviewer/package.json +18 -0
- package/templates/security-reviewer/tsconfig.json +12 -0
- package/templates/thermo-quality-review/README.md +38 -0
- package/templates/thermo-quality-review/bot/agent.ts +8 -0
- package/templates/thermo-quality-review/bot/channels/github.ts +39 -0
- package/templates/thermo-quality-review/bot/instructions.md +43 -0
- package/templates/thermo-quality-review/bot/tools/post_findings.ts +67 -0
- package/templates/thermo-quality-review/evals/evals.config.ts +5 -0
- package/templates/thermo-quality-review/evals/review.eval.ts +59 -0
- package/templates/thermo-quality-review/package.json +18 -0
- package/templates/thermo-quality-review/tsconfig.json +12 -0
- package/templates/thermo-review/README.md +38 -0
- package/templates/thermo-review/bot/agent.ts +8 -0
- package/templates/thermo-review/bot/channels/github.ts +39 -0
- package/templates/thermo-review/bot/instructions.md +40 -0
- package/templates/thermo-review/bot/tools/post_findings.ts +67 -0
- package/templates/thermo-review/evals/evals.config.ts +5 -0
- package/templates/thermo-review/evals/review.eval.ts +50 -0
- package/templates/thermo-review/package.json +18 -0
- package/templates/thermo-review/tsconfig.json +12 -0
- package/templates/triage/README.md +50 -0
- package/templates/triage/bot/agent.ts +8 -0
- package/templates/triage/bot/channels/queue.ts +40 -0
- package/templates/triage/bot/channels/webhook.ts +44 -0
- package/templates/triage/bot/hooks/memory.ts +3 -0
- package/templates/triage/bot/instructions.md +38 -0
- package/templates/triage/bot/lib/actuate.ts +703 -0
- package/templates/triage/bot/lib/parse-queue-event.ts +166 -0
- package/templates/triage/bot/lib/tracker.ts +5 -0
- package/templates/triage/bot/lib/types.ts +48 -0
- package/templates/triage/bot/lib/verify-webhook.ts +79 -0
- package/templates/triage/bot/skills/triage-rubric.md +44 -0
- package/templates/triage/bot/tools/record_triage.ts +29 -0
- package/templates/triage/evals/evals.config.ts +5 -0
- package/templates/triage/evals/triage.eval.ts +64 -0
- package/templates/triage/overlays/jira/README.md +24 -0
- package/templates/triage/overlays/jira/bot/lib/tracker.ts +8 -0
- package/templates/triage/overlays/jira/bot/mcp-connections/tracker.ts +6 -0
- package/templates/triage/overlays/linear/README.md +24 -0
- package/templates/triage/overlays/linear/bot/lib/tracker.ts +8 -0
- package/templates/triage/overlays/linear/bot/mcp-connections/tracker.ts +6 -0
- package/templates/triage/package.json +18 -0
- package/templates/triage/tsconfig.json +12 -0
|
@@ -0,0 +1,2464 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The HTTP host: a plain node:http server that adapts requests to the Fetch
|
|
3
|
+
* API, resolves route auth, and dispatches to the built-in HTTP channel
|
|
4
|
+
* routes, custom channel routes (under `/v1/channels/<id>`), and the
|
|
5
|
+
* server-level health / info / dev-dispatch routes.
|
|
6
|
+
*/
|
|
7
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
17
|
+
var t = {};
|
|
18
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
+
t[p] = s[p];
|
|
20
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
+
t[p[i]] = s[p[i]];
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
};
|
|
27
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
28
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
29
|
+
var m = o[Symbol.asyncIterator], i;
|
|
30
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
31
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
32
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
33
|
+
};
|
|
34
|
+
import { Buffer } from "node:buffer";
|
|
35
|
+
import { once } from "node:events";
|
|
36
|
+
import { createServer } from "node:http";
|
|
37
|
+
import { join } from "node:path";
|
|
38
|
+
import { CURSOR_BITBUCKET_REPOS_HEADER, } from "../channels/bitbucket/api.js";
|
|
39
|
+
import { getBitbucketCursorAccountRuntime, resolveCursorBitbucketProxyUrl, } from "../channels/bitbucket/cursor-account.js";
|
|
40
|
+
import { dispatchDeploymentEvent, getDeploymentsChannelOptions, } from "../channels/deployments/deployments-channel.js";
|
|
41
|
+
import { createCursorAccountGithubTokenResolver, createCursorGithubProxyHostResolver, cursorGithubPermissionsForChannel, getGithubCursorAccountRuntime, resolveCursorGithubCredentialScope, resolveCursorGithubPermissions, resolveCursorGithubProxyUrl, } from "../channels/github/cursor-account.js";
|
|
42
|
+
import { findGitHubChannelTargets } from "../channels/github/forward.js";
|
|
43
|
+
import { CURSOR_GITLAB_PROJECTS_HEADER, } from "../channels/gitlab/api.js";
|
|
44
|
+
import { getGitLabCursorAccountRuntime, resolveCursorGitLabProxyUrl, } from "../channels/gitlab/cursor-account.js";
|
|
45
|
+
import { getOriginCursorAccountRuntime, parseCursorOriginRepoScope, } from "../channels/origin/cursor-account.js";
|
|
46
|
+
import { findOriginChannelTargets } from "../channels/origin/origin-channel.js";
|
|
47
|
+
import { appendSlackQuietHint } from "../channels/slack/agentic-posted.js";
|
|
48
|
+
import { allowAll, bearerAuth, localDevStrict } from "../channels.js";
|
|
49
|
+
import { ARTIFACTS_PAGE_DEFAULT_LIMIT, ARTIFACTS_PAGE_MAX_LIMIT, InvalidArtifactCursorError, } from "./artifacts-store.js";
|
|
50
|
+
import { browserOriginGuardOptionsForPublicUrl, isTrustedBrowserMutation, } from "./browser-origin-guard.js";
|
|
51
|
+
import { invokeChannelRoute } from "./channel-route-dispatch.js";
|
|
52
|
+
import { selectConversationMirror } from "./conversation-mirror.js";
|
|
53
|
+
import { CursorAccountMcpBridge, collectCursorAccountConnections, cursorAccountMcpPath, } from "./cursor/account-mcp.js";
|
|
54
|
+
import { CursorBackendClient } from "./cursor/backend-client.js";
|
|
55
|
+
import { cursorBackendUrl, cursorExternalApiUrl, resolveApiKey, resolveApiKeySync, SIGN_IN_HINT, } from "./cursor/credentials.js";
|
|
56
|
+
import { CursorGithubCredentialProvider } from "./cursor/github-credentials.js";
|
|
57
|
+
import { DeploymentEventRelay, fanOutDeploymentEvent, mergeResolvedSubscriptions, resolveDeploymentSubscriptions, } from "./cursor-deployment-relay.js";
|
|
58
|
+
import { CursorEventRelay, formatCursorScmDispatchOutcome, formatCursorScmEventLog, scmEventToGitHubPayload, scmMetadataToOriginPayload, } from "./cursor-event-relay.js";
|
|
59
|
+
import { AGENT_SERVE_GENERATION_ENV_VAR } from "./cursor-relay-core.js";
|
|
60
|
+
import { buildAgentDeployManifest } from "./deploy-manifest.js";
|
|
61
|
+
import { formatDiagnostics, hasErrorDiagnostics, projectInfo } from "./discovery.js";
|
|
62
|
+
import { packageVersion } from "./distribution.js";
|
|
63
|
+
import { docsSiteExists, ensureDocsSiteBundle, renderDocsFile } from "./docs-site.js";
|
|
64
|
+
import { EvalRunConflictError, EvalRunEmptyError, EvalRunNotRunningError, EvalRunStore, EvalRunUnknownError, } from "./eval-run-store.js";
|
|
65
|
+
import { GUEST_NETWORK_PATH, guestNetworkReadinessResponse } from "./guest-network.js";
|
|
66
|
+
import { collectGitHubTriggerTargets, collectOriginTriggerTargets, handleAgentServeTrigger, } from "./handleAgentServeTrigger.js";
|
|
67
|
+
import { createHostPlatforms, warmupHostGitHubAuth } from "./host-platforms.js";
|
|
68
|
+
import { registerHostedDeliveryRoute } from "./hosted-delivery.js";
|
|
69
|
+
import { HOSTED_DELIVERY_HEADER, HOSTED_GUEST_RETRY_TERMINAL, hostedGuestErrorResponse, } from "./hosted-delivery-protocol.js";
|
|
70
|
+
import { hostedErrorMessageOnly, hostedErrorStackSnippet } from "./hosted-execution-diag.js";
|
|
71
|
+
import { flushHostedExecutionProcessDeath } from "./hosted-execution-flush.js";
|
|
72
|
+
import { buildHttpChannelRoutes, errorResponse, jsonResponse, readJsonObject, requireSessionOwner, } from "./http-channel.js";
|
|
73
|
+
import { incomingHeadersToFetch, incomingRequestHost } from "./incoming-headers-to-fetch.js";
|
|
74
|
+
import { DEFAULT_SERVE_PORT, listenHttpServer } from "./listen-port.js";
|
|
75
|
+
import { createLocalControlPlane } from "./local-control-plane.js";
|
|
76
|
+
import { createLogRing } from "./log-ring.js";
|
|
77
|
+
import { createAgentMcpEndpoint, createToolMcpEndpoint, MCP_ENDPOINT_PATH, TOOL_MCP_ENDPOINT_PATH, } from "./mcp-endpoint.js";
|
|
78
|
+
import { mcpOauthServeCallbackPath, mcpOauthServeCallbackUrl } from "./mcp-oauth-on-demand.js";
|
|
79
|
+
import { isLoopbackAddress } from "./net.js";
|
|
80
|
+
import { createOtelCollector } from "./otel/collector.js";
|
|
81
|
+
import { pickAuthoredOtel, resolveOtelConfig } from "./otel/config.js";
|
|
82
|
+
import { instrumentHttp } from "./otel/http.js";
|
|
83
|
+
import { createOtelRuntime, forceFlushOtelRuntime, shutdownOtelRuntime } from "./otel/runtime.js";
|
|
84
|
+
import { collectPeerConnections } from "./peer-connections.js";
|
|
85
|
+
import { PLATFORM_SCHEDULE_CATALOG_FILENAME, syncHostedPlatformSchedules, } from "./platform-schedule-sync.js";
|
|
86
|
+
import { createCursorHostedPlatformTimers, createCursorHostedReminderControlPlane, } from "./platform-timers.js";
|
|
87
|
+
import { renderAgentsIndexHtml, renderPlaygroundAsset, renderPlaygroundIndexHtml, } from "./playground/static.js";
|
|
88
|
+
import { ensurePlaygroundBundle, playgroundDevBaseFromEnv, playgroundDevBasePath, startPlaygroundDevServer, } from "./playground/toolchain.js";
|
|
89
|
+
import { collectMemoryHealthFields, sumEventLogStats } from "./process-memory-telemetry.js";
|
|
90
|
+
import { claimFromDescriptor, } from "./reminder-control-plane-protocol.js";
|
|
91
|
+
import { ReminderRunner, ReminderValidationError, rejectAnonymousReminderHandlers, UnknownReminderError, } from "./reminder-runner.js";
|
|
92
|
+
import { mapThrownRequestError } from "./request-error-status.js";
|
|
93
|
+
import { assertAccountConnectionsNotAnonymous, resolveMountConnections, validateMountConnectionsConfig, } from "./resolved-connections.js";
|
|
94
|
+
import { Router } from "./router.js";
|
|
95
|
+
import { RuntimeDispatchingRunner } from "./runtime-dispatch-runner.js";
|
|
96
|
+
import { ScheduleRunner, UnknownScheduleError } from "./schedule-runner.js";
|
|
97
|
+
import { CursorSdkRunner } from "./sdk-runner.js";
|
|
98
|
+
import { HTTP_CHANNEL_ID, InvalidContinuationTokenError, SessionEngine, ToolInputError, ToolNotDirectlyCallableError, UnknownToolError, WorkspaceUnavailableError, } from "./session-engine.js";
|
|
99
|
+
import { registerSessionRunFatalFlush, selectSessionRunLogStore, unregisterSessionRunFatalFlush, } from "./session-run-log.js";
|
|
100
|
+
import { sessionUrlsForRequest } from "./session-urls.js";
|
|
101
|
+
import { readSkillDetail, skillListEntry, UnknownSkillError } from "./skill-catalog.js";
|
|
102
|
+
import { flushLocalStartLog, selectStartLogStore } from "./start-log-store.js";
|
|
103
|
+
import { catalogDetailEntry, catalogListEntry } from "./tool-catalog.js";
|
|
104
|
+
function memoryHealthFields(engines) {
|
|
105
|
+
return collectMemoryHealthFields({
|
|
106
|
+
eventLog: () => sumEventLogStats(engines.map(engine => engine.eventLogMemoryStats())),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const MAX_BODY_BYTES = 32 * 1024 * 1024;
|
|
110
|
+
function localControlPlaneRoute(runtimes) {
|
|
111
|
+
for (const runtime of runtimes) {
|
|
112
|
+
if (runtime.controlPlane !== undefined) {
|
|
113
|
+
return input => runtime.controlPlane.routeContinuation(input);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
function firstLocalControlPlane(runtimes) {
|
|
119
|
+
var _a;
|
|
120
|
+
return (_a = runtimes.find(runtime => runtime.controlPlane !== undefined)) === null || _a === void 0 ? void 0 : _a.controlPlane;
|
|
121
|
+
}
|
|
122
|
+
function isV2Project(project) {
|
|
123
|
+
return project.agent.architecture === "v2";
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Start an HTTP server hosting one or more agents. A single agent with an
|
|
127
|
+
* empty slug serves at `/v1/*` and `/playground`; multiple agents each serve
|
|
128
|
+
* under `/<slug>/v1/*` and `/<slug>/playground`, with an index at `/`.
|
|
129
|
+
*/
|
|
130
|
+
export function startServer(mounts_1) {
|
|
131
|
+
return __awaiter(this, arguments, void 0, function* (mounts, options = {}) {
|
|
132
|
+
var _a, _b, _c, _d, _e, _f;
|
|
133
|
+
var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
|
|
134
|
+
var _7;
|
|
135
|
+
if (mounts.length === 0) {
|
|
136
|
+
throw new Error("startServer requires at least one agent mount");
|
|
137
|
+
}
|
|
138
|
+
const multi = mounts.length > 1 || ((_a = mounts[0]) === null || _a === void 0 ? void 0 : _a.slug) !== "";
|
|
139
|
+
for (const { slug, project } of mounts) {
|
|
140
|
+
if (hasErrorDiagnostics(project)) {
|
|
141
|
+
const label = slug === "" ? project.name : `${slug} (${project.name})`;
|
|
142
|
+
throw new Error(`Refusing to serve agent ${label} — it has errors:\n${formatDiagnostics(project.diagnostics.filter(d => d.severity === "error"))}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const logRing = createLogRing({ capacity: 2000 });
|
|
146
|
+
const logger = logRing.wrap((_g = options.logger) !== null && _g !== void 0 ? _g : ((line) => console.log(line)));
|
|
147
|
+
const dev = (_h = options.dev) !== null && _h !== void 0 ? _h : false;
|
|
148
|
+
const playground = (_j = options.playground) !== null && _j !== void 0 ? _j : true;
|
|
149
|
+
const hosted = options;
|
|
150
|
+
const noControlPlane = hosted.noControlPlane === true;
|
|
151
|
+
const scmProxyRequested = hosted.cursorScmProxy === true;
|
|
152
|
+
const runSchedules = (_k = options.schedules) !== null && _k !== void 0 ? _k : !dev;
|
|
153
|
+
const runReminders = (_l = options.reminders) !== null && _l !== void 0 ? _l : !dev;
|
|
154
|
+
// CURSOR_AGENTKIT_VERSION is still the env the SDK reads when building
|
|
155
|
+
// its client-version header (wire prefix remains `agentkit-`). Setting it
|
|
156
|
+
// here makes the internal-only agentkit_enabled gate apply to every turn.
|
|
157
|
+
(_m = (_7 = process.env).CURSOR_AGENTKIT_VERSION) !== null && _m !== void 0 ? _m : (_7.CURSOR_AGENTKIT_VERSION = packageVersion());
|
|
158
|
+
const authoredOtel = pickAuthoredOtel(mounts.map(m => ({
|
|
159
|
+
slug: m.slug,
|
|
160
|
+
name: m.project.name,
|
|
161
|
+
otel: m.project.otel,
|
|
162
|
+
})));
|
|
163
|
+
const resolveOtelExport = () => resolveOtelConfig({
|
|
164
|
+
authored: authoredOtel,
|
|
165
|
+
serve: options.otel,
|
|
166
|
+
});
|
|
167
|
+
const otelRuntime = createOtelRuntime(resolveOtelExport(), logger, {
|
|
168
|
+
resolveExport: resolveOtelExport,
|
|
169
|
+
});
|
|
170
|
+
const cursorGithubTargets = collectCursorGithubTargets(mounts);
|
|
171
|
+
const cursorOriginTargets = collectCursorOriginTargets(mounts);
|
|
172
|
+
const cursorGithubConfig = resolveCursorGithubEventConfig({
|
|
173
|
+
configured: options.cursorEvents,
|
|
174
|
+
targets: cursorGithubTargets,
|
|
175
|
+
});
|
|
176
|
+
const cursorOriginScope = resolveCursorOriginRepoScope({
|
|
177
|
+
explicitRepos: (_o = (_b = options.cursorEvents) === null || _b === void 0 ? void 0 : _b.repos) !== null && _o !== void 0 ? _o : [],
|
|
178
|
+
targets: cursorOriginTargets,
|
|
179
|
+
});
|
|
180
|
+
const effectiveCursorEvents = (_p = cursorGithubConfig.cursorEvents) !== null && _p !== void 0 ? _p : (cursorOriginScope === undefined ? undefined : { repos: [...cursorOriginScope.repos] });
|
|
181
|
+
// One resolution for every Cursor credential consumer (SDK runner, account
|
|
182
|
+
// MCP bridge, SCM event relay, GitHub credentials): explicit option →
|
|
183
|
+
// CURSOR_API_KEY → CURSOR_API_KEY_FILE (or the hosted default path) →
|
|
184
|
+
// CURSOR_SERVICE_ACCOUNT_KEY → stored `agent-sdk login`. SDK / GitHub /
|
|
185
|
+
// account MCP re-read later; Slack and deployment-event relays capture
|
|
186
|
+
// the key at start.
|
|
187
|
+
const accountKey = yield resolveApiKey(options.apiKey === undefined ? {} : { apiKey: options.apiKey });
|
|
188
|
+
// First present source wins (we define the order): option → env → file →
|
|
189
|
+
// service account → stored login. Re-read so bind can drop env or file
|
|
190
|
+
// onto a listening process.
|
|
191
|
+
const liveCursorApiKey = () => { var _a; return (_a = resolveApiKeySync(options.apiKey === undefined ? {} : { apiKey: options.apiKey })) === null || _a === void 0 ? void 0 : _a.apiKey; };
|
|
192
|
+
// The SCM relay reads the event stream as the signed-in user, so
|
|
193
|
+
// `cursorEvents` cannot work signed out. Require the credential before any
|
|
194
|
+
// slow or stateful startup work (playground build, channel onStart, cron).
|
|
195
|
+
const cursorEventsAuth = effectiveCursorEvents === undefined
|
|
196
|
+
? undefined
|
|
197
|
+
: requireCursorEventsAuth(effectiveCursorEvents, accountKey);
|
|
198
|
+
// Two architectures + local CP + cursor-events would register two
|
|
199
|
+
// /v0/scm-events consumers (engine offset vs control-plane offset).
|
|
200
|
+
// Fail before engines or relays start. `--no-control-plane` mixed is one
|
|
201
|
+
// July consumer (v1 engine); hosted CP owns v2.
|
|
202
|
+
assertSingleCursorEventsLane({
|
|
203
|
+
noControlPlane,
|
|
204
|
+
config: effectiveCursorEvents,
|
|
205
|
+
auth: cursorEventsAuth,
|
|
206
|
+
v1Mounts: mounts.filter(mount => !isV2Project(mount.project)),
|
|
207
|
+
v2Mounts: mounts.filter(mount => isV2Project(mount.project)),
|
|
208
|
+
githubRepos: (_q = (_c = cursorGithubConfig.cursorEvents) === null || _c === void 0 ? void 0 : _c.repos) !== null && _q !== void 0 ? _q : [],
|
|
209
|
+
originRepos: (_r = cursorOriginScope === null || cursorOriginScope === void 0 ? void 0 : cursorOriginScope.repos) !== null && _r !== void 0 ? _r : [],
|
|
210
|
+
});
|
|
211
|
+
let cursorGithubCredentials;
|
|
212
|
+
// Proxy-wired GitHub token resolver for `ctx.host.github` when no startup
|
|
213
|
+
// token mint runs (empty repo scope): host Octokit calls must route
|
|
214
|
+
// through github-proxy exactly like channel Octokit calls.
|
|
215
|
+
let hostGithubProxyResolver;
|
|
216
|
+
if (cursorGithubTargets.length > 0) {
|
|
217
|
+
const githubProxyRequested = scmProxyRequested;
|
|
218
|
+
const needsGithubAuth = cursorGithubConfig.scope !== undefined || githubProxyRequested;
|
|
219
|
+
if (needsGithubAuth) {
|
|
220
|
+
const currentGithubApiKey = () => {
|
|
221
|
+
const fromEvents = cursorEventsAuth === null || cursorEventsAuth === void 0 ? void 0 : cursorEventsAuth.apiKey.trim();
|
|
222
|
+
if (fromEvents !== undefined && fromEvents !== "") {
|
|
223
|
+
return fromEvents;
|
|
224
|
+
}
|
|
225
|
+
return liveCursorApiKey();
|
|
226
|
+
};
|
|
227
|
+
const githubApiKeyNow = currentGithubApiKey();
|
|
228
|
+
if (githubApiKeyNow === undefined && options.allowAnonymous !== true) {
|
|
229
|
+
throw new Error("githubChannel({ cursorAccount: true }) could not resolve Cursor event authentication.");
|
|
230
|
+
}
|
|
231
|
+
if (options.allowAnonymous === true) {
|
|
232
|
+
if (options.allowAnonymousCursorGithub !== true) {
|
|
233
|
+
throw new Error("githubChannel({ cursorAccount: true }) cannot be served with --allow-anonymous because admitted callers could use the signed-in account's GitHub access. If every admitted caller is trusted (e.g. behind an SSO proxy), opt in with --allow-anonymous-cursor-github.");
|
|
234
|
+
}
|
|
235
|
+
logger("[agent-sdk] warning: --allow-anonymous-cursor-github — every admitted HTTP caller can drive sessions holding the signed-in account's repo-scoped GitHub credential; serve this only behind a trusted boundary (e.g. an SSO proxy)");
|
|
236
|
+
if (githubApiKeyNow === undefined) {
|
|
237
|
+
logger("[agent-sdk] GitHub auth: listening unsigned; credentials bind at task via CURSOR_API_KEY or CURSOR_API_KEY_FILE");
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (cursorGithubConfig.permissions === "contents-write") {
|
|
241
|
+
logger('[agent-sdk] warning: Cursor GitHub credentials include contents:write — the host holds a push-capable token shared with model-driven tools and untrusted webhook content; prefer permissions: "pr-write" unless this agent must push code');
|
|
242
|
+
}
|
|
243
|
+
const githubAuthBaseUrl = cursorExternalApiUrl();
|
|
244
|
+
const requireGithubApiKey = () => __awaiter(this, void 0, void 0, function* () {
|
|
245
|
+
const apiKey = currentGithubApiKey();
|
|
246
|
+
if (apiKey === undefined) {
|
|
247
|
+
throw new Error(`githubChannel({ cursorAccount: true }) has no Cursor credential yet. ${SIGN_IN_HINT}`);
|
|
248
|
+
}
|
|
249
|
+
return apiKey;
|
|
250
|
+
});
|
|
251
|
+
const githubProxyUrl = githubProxyRequested
|
|
252
|
+
? resolveCursorGithubProxyUrl(githubAuthBaseUrl)
|
|
253
|
+
: undefined;
|
|
254
|
+
if (cursorGithubConfig.scope !== undefined && githubApiKeyNow !== undefined) {
|
|
255
|
+
const provider = new CursorGithubCredentialProvider({
|
|
256
|
+
client: new CursorBackendClient({
|
|
257
|
+
backendUrl: githubAuthBaseUrl,
|
|
258
|
+
apiKey: githubApiKeyNow,
|
|
259
|
+
getApiKey: () => { var _a; return (_a = currentGithubApiKey()) !== null && _a !== void 0 ? _a : ""; },
|
|
260
|
+
logger,
|
|
261
|
+
}),
|
|
262
|
+
scope: cursorGithubConfig.scope,
|
|
263
|
+
logger,
|
|
264
|
+
});
|
|
265
|
+
cursorGithubCredentials = provider;
|
|
266
|
+
if (githubProxyUrl !== undefined) {
|
|
267
|
+
// Proxy mode: channel Octokit calls carry the Cursor API key to the
|
|
268
|
+
// backend forwarder, which swaps in the installation token server-side
|
|
269
|
+
// and logs every call with per-deployment attribution. The provider
|
|
270
|
+
// still runs so child `gh` processes get a `GH_TOKEN` lease (v1).
|
|
271
|
+
const proxyTransport = {
|
|
272
|
+
apiBaseUrl: githubProxyUrl,
|
|
273
|
+
headers: {
|
|
274
|
+
"x-cursor-github-repos": cursorGithubConfig.scope.repos.join(","),
|
|
275
|
+
"x-cursor-github-permissions": cursorGithubConfig.permissions,
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
for (const target of cursorGithubTargets) {
|
|
279
|
+
target.accountRuntime.credentials.bind(requireGithubApiKey);
|
|
280
|
+
target.accountRuntime.credentials.bindProxyTransport(proxyTransport);
|
|
281
|
+
}
|
|
282
|
+
logger(`[agent-sdk] GitHub auth: channel API calls route through ${githubProxyUrl}`);
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
for (const target of cursorGithubTargets) {
|
|
286
|
+
target.accountRuntime.credentials.bind(() => provider.getToken());
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
else if (githubProxyUrl !== undefined) {
|
|
291
|
+
// `cursorAccount: true` with no `--repo`: skip the startup token mint
|
|
292
|
+
// (it requires a repo list) and let github-proxy take the repo from
|
|
293
|
+
// each Octokit call. Hosted freeze bakes this flag into the template
|
|
294
|
+
// so restore is GitHub-ready once Bind drops the key.
|
|
295
|
+
const proxyTransport = {
|
|
296
|
+
apiBaseUrl: githubProxyUrl,
|
|
297
|
+
headers: {
|
|
298
|
+
"x-cursor-github-permissions": cursorGithubConfig.permissions,
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
for (const target of cursorGithubTargets) {
|
|
302
|
+
target.accountRuntime.credentials.bind(requireGithubApiKey);
|
|
303
|
+
target.accountRuntime.credentials.bindProxyTransport(proxyTransport);
|
|
304
|
+
}
|
|
305
|
+
// `ctx.host.github` gets the same proxy transport; without this it
|
|
306
|
+
// would fall back to ambient auth (env token / `gh`) or an
|
|
307
|
+
// unauthenticated Octokit, and every host GitHub call would 404.
|
|
308
|
+
hostGithubProxyResolver = createCursorGithubProxyHostResolver({
|
|
309
|
+
getApiKey: requireGithubApiKey,
|
|
310
|
+
transport: proxyTransport,
|
|
311
|
+
});
|
|
312
|
+
logger(`[agent-sdk] GitHub auth: channel and host API calls route through ${githubProxyUrl} (repo scope per request)`);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// GitLab `cursorAccount` channels: `ctx.gitlab` routes through the SCM
|
|
317
|
+
// proxy in proxy mode. Without `--cursor-scm-proxy` the runtime stays
|
|
318
|
+
// unbound and the handle falls back to direct `GITLAB_TOKEN` access.
|
|
319
|
+
if (scmProxyRequested) {
|
|
320
|
+
const gitlabProxyUrl = resolveCursorGitLabProxyUrl(cursorExternalApiUrl());
|
|
321
|
+
let gitlabTargets = 0;
|
|
322
|
+
for (const mount of mounts) {
|
|
323
|
+
for (const channel of mount.project.channels) {
|
|
324
|
+
const runtime = getGitLabCursorAccountRuntime(channel.definition);
|
|
325
|
+
if (runtime === undefined) {
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
gitlabTargets += 1;
|
|
329
|
+
const transport = Object.assign({ apiBaseUrl: gitlabProxyUrl }, (runtime.scope === undefined
|
|
330
|
+
? {}
|
|
331
|
+
: {
|
|
332
|
+
headers: {
|
|
333
|
+
[CURSOR_GITLAB_PROJECTS_HEADER]: runtime.scope.projects.join(","),
|
|
334
|
+
},
|
|
335
|
+
}));
|
|
336
|
+
runtime.credentials.bind(() => __awaiter(this, void 0, void 0, function* () {
|
|
337
|
+
const apiKey = liveCursorApiKey();
|
|
338
|
+
if (apiKey === undefined) {
|
|
339
|
+
throw new Error(`gitlabChannel({ cursorAccount }) has no Cursor credential yet. ${SIGN_IN_HINT}`);
|
|
340
|
+
}
|
|
341
|
+
return apiKey;
|
|
342
|
+
}));
|
|
343
|
+
runtime.credentials.bindProxyTransport(transport);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if (gitlabTargets > 0) {
|
|
347
|
+
logger(`[agent-sdk] GitLab auth: channel API calls route through ${gitlabProxyUrl}`);
|
|
348
|
+
}
|
|
349
|
+
// Bitbucket `cursorAccount` channels: same shape, `/v0/bitbucket-proxy`
|
|
350
|
+
// with `x-cursor-bitbucket-repos` scope. The proxy picks Cloud 2.0 or
|
|
351
|
+
// the DC host's 1.0 upstream per tenant; the pack picks the dialect
|
|
352
|
+
// from the delivery payload.
|
|
353
|
+
const bitbucketProxyUrl = resolveCursorBitbucketProxyUrl(cursorExternalApiUrl());
|
|
354
|
+
let bitbucketTargets = 0;
|
|
355
|
+
for (const mount of mounts) {
|
|
356
|
+
for (const channel of mount.project.channels) {
|
|
357
|
+
const runtime = getBitbucketCursorAccountRuntime(channel.definition);
|
|
358
|
+
if (runtime === undefined) {
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
bitbucketTargets += 1;
|
|
362
|
+
const transport = Object.assign({ apiBaseUrl: bitbucketProxyUrl }, (runtime.scope === undefined
|
|
363
|
+
? {}
|
|
364
|
+
: {
|
|
365
|
+
headers: {
|
|
366
|
+
[CURSOR_BITBUCKET_REPOS_HEADER]: runtime.scope.repos.join(","),
|
|
367
|
+
},
|
|
368
|
+
}));
|
|
369
|
+
runtime.credentials.bind(() => __awaiter(this, void 0, void 0, function* () {
|
|
370
|
+
const apiKey = liveCursorApiKey();
|
|
371
|
+
if (apiKey === undefined) {
|
|
372
|
+
throw new Error(`bitbucketChannel({ cursorAccount }) has no Cursor credential yet. ${SIGN_IN_HINT}`);
|
|
373
|
+
}
|
|
374
|
+
return apiKey;
|
|
375
|
+
}));
|
|
376
|
+
runtime.credentials.bindProxyTransport(transport);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
if (bitbucketTargets > 0) {
|
|
380
|
+
logger(`[agent-sdk] Bitbucket auth: channel API calls route through ${bitbucketProxyUrl}`);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
const resolvedCursorGithubCredentials = cursorGithubCredentials;
|
|
384
|
+
const hostGithubToken = hostGithubProxyResolver !== null && hostGithubProxyResolver !== void 0 ? hostGithubProxyResolver : (resolvedCursorGithubCredentials === undefined
|
|
385
|
+
? undefined
|
|
386
|
+
: createCursorAccountGithubTokenResolver(() => resolvedCursorGithubCredentials.getToken()));
|
|
387
|
+
const hostPlatforms = createHostPlatforms(hostGithubToken === undefined ? {} : { githubCredentials: { token: hostGithubToken } });
|
|
388
|
+
if (playground) {
|
|
389
|
+
// Auto-build dist/playground when missing (monorepo / source checkout).
|
|
390
|
+
// Published installs already ship the bundle; vite may be absent there.
|
|
391
|
+
yield ensurePlaygroundBundle(logger);
|
|
392
|
+
}
|
|
393
|
+
const docsSite = (_s = options.docs) !== null && _s !== void 0 ? _s : true;
|
|
394
|
+
if (docsSite) {
|
|
395
|
+
// Same pattern for the documentation site at /docs.
|
|
396
|
+
yield ensureDocsSiteBundle(logger);
|
|
397
|
+
}
|
|
398
|
+
if (options.allowAnonymous === true) {
|
|
399
|
+
logger("[agent-sdk] warning: --allow-anonymous admits every HTTP caller as the same principal; use only on a trusted network (e.g. Tailscale) and prefer --bearer-token for shared hosts");
|
|
400
|
+
}
|
|
401
|
+
// v2 hosted engines mirror the SDK conversation store to the deployment's
|
|
402
|
+
// shared file storage so a fresh pod resumes threads instead of forking
|
|
403
|
+
// them. Hosted serve is single-agent; a multi-mount serve (dev) has no
|
|
404
|
+
// single agent name to mint keys under and does not mirror.
|
|
405
|
+
const conversationMirror = mounts.length === 1 && mounts[0] !== undefined
|
|
406
|
+
? selectConversationMirror({ project: mounts[0].project, logger })
|
|
407
|
+
: undefined;
|
|
408
|
+
const sessionRunLog = (_t = options.sessionRunLog) !== null && _t !== void 0 ? _t : (mounts.length === 1 && mounts[0] !== undefined
|
|
409
|
+
? selectSessionRunLogStore({
|
|
410
|
+
project: mounts[0].project,
|
|
411
|
+
logger,
|
|
412
|
+
snapshotLogs: () => logRing.since(),
|
|
413
|
+
})
|
|
414
|
+
: undefined);
|
|
415
|
+
const startLogStore = (_u = options.startLogStore) !== null && _u !== void 0 ? _u : (mounts.length === 1 && mounts[0] !== undefined
|
|
416
|
+
? selectStartLogStore({
|
|
417
|
+
project: mounts[0].project,
|
|
418
|
+
logger,
|
|
419
|
+
})
|
|
420
|
+
: undefined);
|
|
421
|
+
// The running claim stamps this before the turn; process-death flush
|
|
422
|
+
// reuses it so the tee snapshot lands under the same ses_ key.
|
|
423
|
+
let lastStartLogId;
|
|
424
|
+
const flushStartLog = (startLogId) => __awaiter(this, void 0, void 0, function* () {
|
|
425
|
+
lastStartLogId = startLogId;
|
|
426
|
+
if (startLogStore === undefined) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
yield flushLocalStartLog({ store: startLogStore, startLogId });
|
|
430
|
+
});
|
|
431
|
+
if (sessionRunLog !== undefined) {
|
|
432
|
+
registerSessionRunFatalFlush((error) => __awaiter(this, void 0, void 0, function* () {
|
|
433
|
+
yield flushHostedExecutionProcessDeath({
|
|
434
|
+
flushProcessDeath: (reason, flushError) => sessionRunLog.flushProcessDeath(reason, flushError),
|
|
435
|
+
flushStartLog,
|
|
436
|
+
startLogId: lastStartLogId,
|
|
437
|
+
reason: "uncaught_exception",
|
|
438
|
+
error,
|
|
439
|
+
});
|
|
440
|
+
}));
|
|
441
|
+
}
|
|
442
|
+
const sdkRunner = (_v = options.runner) !== null && _v !== void 0 ? _v : new CursorSdkRunner(Object.assign(Object.assign(Object.assign({}, (options.apiKey === undefined || options.apiKey.trim() === ""
|
|
443
|
+
? {}
|
|
444
|
+
: { apiKey: options.apiKey })), (conversationMirror === undefined ? {} : { conversationMirror })), { logger }));
|
|
445
|
+
// Grok Bot turns run on Cursor's hosted Grok Bot (Sand) harness through
|
|
446
|
+
// the /v0/grokbot session API; the SDK side is a thin remote client. The
|
|
447
|
+
// dispatching runner is only interposed when a mount needs it. An
|
|
448
|
+
// injected test runner receives every turn, grokbot included.
|
|
449
|
+
const hasGrokBotMounts = mounts.some(mount => mount.project.agent.runtime === "grokbot");
|
|
450
|
+
// Fail closed like cursor-account GitHub/MCP: grokbot turns execute on the
|
|
451
|
+
// signed-in account's hosted computer, so anonymous admission needs its
|
|
452
|
+
// own opt-in.
|
|
453
|
+
if (hasGrokBotMounts && options.allowAnonymous === true) {
|
|
454
|
+
if (options.allowAnonymousGrokbot !== true) {
|
|
455
|
+
throw new Error('runtime: "grokbot" cannot be served with --allow-anonymous because admitted callers could drive the signed-in account\'s hosted Grok Bot computer. If every admitted caller is trusted (e.g. behind an SSO proxy), opt in with --allow-anonymous-grokbot.');
|
|
456
|
+
}
|
|
457
|
+
logger("[agent-sdk] warning: --allow-anonymous-grokbot — every admitted HTTP caller can drive turns on the signed-in account's hosted Grok Bot computer; serve this only behind a trusted boundary (e.g. an SSO proxy)");
|
|
458
|
+
}
|
|
459
|
+
let runner = sdkRunner;
|
|
460
|
+
if (hasGrokBotMounts && options.runner === undefined) {
|
|
461
|
+
// Cursor-internal client, left out of the npm tarball (`files`); loaded
|
|
462
|
+
// only when a mount needs it, so a published install fails here, before
|
|
463
|
+
// listen, rather than on the first turn.
|
|
464
|
+
const { GrokBotRunner } = yield import("./grokbot/runner.js").catch(() => {
|
|
465
|
+
throw new Error('runtime: "grokbot" is not available in the published @cursor/bdk package');
|
|
466
|
+
});
|
|
467
|
+
runner = new RuntimeDispatchingRunner({
|
|
468
|
+
sdkRunner,
|
|
469
|
+
grokbot: new GrokBotRunner({
|
|
470
|
+
apiKey: options.apiKey,
|
|
471
|
+
// `/v0/grokbot` lives on the external API (api.cursor.com), not
|
|
472
|
+
// api2. Prefer that default over the account key's backendUrl.
|
|
473
|
+
// Do not pass stored login as apiKey: that would pin it as an
|
|
474
|
+
// option and beat a later CURSOR_API_KEY_FILE bind.
|
|
475
|
+
backendUrl: cursorExternalApiUrl(),
|
|
476
|
+
}),
|
|
477
|
+
});
|
|
478
|
+
logger("[agent-sdk] grokbot runtime: remote client (turns run on the hosted Grok Bot harness)");
|
|
479
|
+
}
|
|
480
|
+
const router = new Router();
|
|
481
|
+
const runtimes = [];
|
|
482
|
+
const channelStopHooks = [];
|
|
483
|
+
let githubAuthWarmed = false;
|
|
484
|
+
// Validate peer MCP connections (defineConnection({ agent })) against the
|
|
485
|
+
// mount set before anything starts: unknown slugs and self-references are
|
|
486
|
+
// authoring errors. URLs resolve after listen, once the port is known.
|
|
487
|
+
const peerRefsBySlug = collectPeerConnections(mounts);
|
|
488
|
+
// Cursor account MCP connections (defineConnection({ cursorAccount: true }))
|
|
489
|
+
// need a signed-in host: their tools execute on the Cursor backend with
|
|
490
|
+
// the account's stored OAuth credentials. Fail fast at serve start instead
|
|
491
|
+
// of at the first turn.
|
|
492
|
+
const accountRefsBySlug = collectCursorAccountConnections(mounts);
|
|
493
|
+
assertAccountConnectionsNotAnonymous({
|
|
494
|
+
allowAnonymous: options.allowAnonymous,
|
|
495
|
+
allowAnonymousCursorAccountMcp: options.allowAnonymousCursorAccountMcp,
|
|
496
|
+
hasAccountConnections: accountRefsBySlug.size > 0,
|
|
497
|
+
});
|
|
498
|
+
if (options.allowAnonymous === true &&
|
|
499
|
+
options.allowAnonymousCursorAccountMcp === true &&
|
|
500
|
+
accountRefsBySlug.size > 0) {
|
|
501
|
+
logger("[agent-sdk] warning: --allow-anonymous-cursor-account-mcp — every admitted HTTP caller can drive Cursor account MCP connectors; serve this only behind a trusted boundary (e.g. an SSO proxy or hosted alias token)");
|
|
502
|
+
}
|
|
503
|
+
let accountBridge;
|
|
504
|
+
if (accountRefsBySlug.size > 0) {
|
|
505
|
+
if (accountKey === undefined && options.allowAnonymous !== true) {
|
|
506
|
+
throw new Error(`This project has Cursor account MCP connections (defineConnection({ cursorAccount: true })) but the host is not signed in to Cursor. ${SIGN_IN_HINT}`);
|
|
507
|
+
}
|
|
508
|
+
if (accountKey === undefined) {
|
|
509
|
+
logger("[agent-sdk] Cursor account MCP: listening unsigned; credentials bind at task via CURSOR_API_KEY or CURSOR_API_KEY_FILE");
|
|
510
|
+
}
|
|
511
|
+
accountBridge = new CursorAccountMcpBridge({
|
|
512
|
+
client: new CursorBackendClient({
|
|
513
|
+
backendUrl: (_w = accountKey === null || accountKey === void 0 ? void 0 : accountKey.backendUrl) !== null && _w !== void 0 ? _w : cursorBackendUrl(),
|
|
514
|
+
apiKey: (_x = accountKey === null || accountKey === void 0 ? void 0 : accountKey.apiKey) !== null && _x !== void 0 ? _x : "",
|
|
515
|
+
getApiKey: () => { var _a; return (_a = liveCursorApiKey()) !== null && _a !== void 0 ? _a : ""; },
|
|
516
|
+
logger,
|
|
517
|
+
}),
|
|
518
|
+
logger,
|
|
519
|
+
// Cloud turns reach the bridge through the serve publicUrl; without
|
|
520
|
+
// one, the bridge admits loopback callers only.
|
|
521
|
+
allowRemoteCallers: options.publicUrl !== undefined,
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
for (const { slug, project } of mounts) {
|
|
525
|
+
// Each agent gets an isolated state root so their sessions never mix.
|
|
526
|
+
const baseStateRoot = (_y = options.stateRoot) !== null && _y !== void 0 ? _y : join(project.rootDir, ".agent-serve");
|
|
527
|
+
const stateRoot = slug === "" ? baseStateRoot : join(baseStateRoot, slug);
|
|
528
|
+
const otelCollector = otelRuntime === undefined
|
|
529
|
+
? undefined
|
|
530
|
+
: createOtelCollector(otelRuntime, project.name, logger);
|
|
531
|
+
const engine = new SessionEngine({
|
|
532
|
+
project,
|
|
533
|
+
stateRoot,
|
|
534
|
+
runner,
|
|
535
|
+
logger,
|
|
536
|
+
platforms: hostPlatforms,
|
|
537
|
+
otel: otelCollector,
|
|
538
|
+
otelMeter: otelRuntime === null || otelRuntime === void 0 ? void 0 : otelRuntime.meter,
|
|
539
|
+
});
|
|
540
|
+
engine.oauthCallbackHub.secrets = options.mcpOauthSecrets;
|
|
541
|
+
engine.oauthCallbackHub.secretsBind = {
|
|
542
|
+
slug: slug === "" ? undefined : slug,
|
|
543
|
+
cloudToolsUrl: options.cloudToolsUrl,
|
|
544
|
+
};
|
|
545
|
+
engine.oauthCallbackHub.logger = logger;
|
|
546
|
+
// Rehydrate sessions from the authored storage sink before any
|
|
547
|
+
// channel or route can address them (continuation tokens must resolve).
|
|
548
|
+
yield engine.restoreStoredSessions();
|
|
549
|
+
// Resolve a shared harness workspace in the background: on a large repo
|
|
550
|
+
// that takes seconds, and a deployment coming online should absorb it
|
|
551
|
+
// rather than whoever sends the first message. No-op unless the agent
|
|
552
|
+
// pins `local.workspaceDir`.
|
|
553
|
+
void engine.prewarmSharedWorkspace();
|
|
554
|
+
if (!githubAuthWarmed) {
|
|
555
|
+
// Soft ambient GitHub auth check before channel onStart (which may call
|
|
556
|
+
// host.github). Missing auth is a warning only — serve still starts.
|
|
557
|
+
yield warmupHostGitHubAuth(Object.assign({ logger, github: engine.host.github }, (cursorGithubCredentials === undefined ? {} : { authSource: "cursor-account" })));
|
|
558
|
+
githubAuthWarmed = true;
|
|
559
|
+
}
|
|
560
|
+
const scheduleRunner = new ScheduleRunner(engine, project, logger);
|
|
561
|
+
let reminderRunner;
|
|
562
|
+
const architecture = project.agent.architecture;
|
|
563
|
+
const useReminderCpProtocol = architecture === "v2";
|
|
564
|
+
const localControlPlane = noControlPlane
|
|
565
|
+
? undefined
|
|
566
|
+
: yield createLocalControlPlane(Object.assign(Object.assign({ fireSchedule: name => scheduleRunner.dispatch(name) }, (useReminderCpProtocol
|
|
567
|
+
? {
|
|
568
|
+
executeReminder: descriptor => reminderRunner.executeFire(descriptor),
|
|
569
|
+
}
|
|
570
|
+
: {
|
|
571
|
+
fireReminder: (id, fireCount) => reminderRunner.dispatch(id, {
|
|
572
|
+
expectedFireCount: fireCount,
|
|
573
|
+
}),
|
|
574
|
+
})), { stateDir: join(stateRoot, "control-plane"), armReminderClocks: runReminders, logger }));
|
|
575
|
+
const timerClient = noControlPlane ? createCursorHostedPlatformTimers() : localControlPlane;
|
|
576
|
+
const hostedReminderControlPlane = noControlPlane && useReminderCpProtocol
|
|
577
|
+
? createCursorHostedReminderControlPlane()
|
|
578
|
+
: undefined;
|
|
579
|
+
const reminderControlPlane = useReminderCpProtocol
|
|
580
|
+
? (localControlPlane !== null && localControlPlane !== void 0 ? localControlPlane : hostedReminderControlPlane)
|
|
581
|
+
: undefined;
|
|
582
|
+
reminderRunner = new ReminderRunner(engine, logger, timerClient, {
|
|
583
|
+
namedHandlers: (_z = project.reminders) !== null && _z !== void 0 ? _z : [],
|
|
584
|
+
// Architecture v2 rejects anonymous run/until everywhere (local + hosted).
|
|
585
|
+
rejectAnonymousHandlers: rejectAnonymousReminderHandlers({
|
|
586
|
+
noControlPlane,
|
|
587
|
+
architecture,
|
|
588
|
+
}),
|
|
589
|
+
architecture,
|
|
590
|
+
controlPlane: reminderControlPlane,
|
|
591
|
+
// Hosted admissions build their channel args with no request
|
|
592
|
+
// principal (`buildChannelHandlerArgs` → `auth: null`), so a fire that
|
|
593
|
+
// opens a session on a fresh pod uses the same one and a session
|
|
594
|
+
// restored from durable storage still matches.
|
|
595
|
+
hostedGuest: hostedReminderControlPlane === undefined ? undefined : { fireAuth: () => null },
|
|
596
|
+
});
|
|
597
|
+
const evalRuns = new EvalRunStore(project.rootDir, logger,
|
|
598
|
+
// Playground eval history mirrors onto the defineStorage evals table.
|
|
599
|
+
(_d = engine.storage) === null || _d === void 0 ? void 0 : _d.evalRuns());
|
|
600
|
+
// Eval history restores with the same startup step as sessions (reads
|
|
601
|
+
// also hydrate lazily, but doing it here surfaces store problems at
|
|
602
|
+
// boot and makes /v1/dev/evals complete from the first request).
|
|
603
|
+
yield evalRuns.hydrate();
|
|
604
|
+
engine.setReminders({
|
|
605
|
+
create: input => reminderRunner.create(input),
|
|
606
|
+
list: filter => reminderRunner.list(filter),
|
|
607
|
+
cancel: (id, reason) => reminderRunner.cancel(id, reason),
|
|
608
|
+
cancelForContinuation: (token, reason) => reminderRunner.cancelForContinuation(token, reason),
|
|
609
|
+
rekeyContinuation: (channelId, oldToken, newToken) => reminderRunner.rekeyContinuation(channelId, oldToken, newToken),
|
|
610
|
+
dispatch: id => reminderRunner.dispatch(id),
|
|
611
|
+
});
|
|
612
|
+
engine.setEvals({
|
|
613
|
+
list: () => evalRuns.list(),
|
|
614
|
+
get: runId => evalRuns.get(runId),
|
|
615
|
+
listRunsWithActive: () => evalRuns.listRunsWithActive(),
|
|
616
|
+
start: input => evalRuns.start(input),
|
|
617
|
+
cancel: runId => evalRuns.cancel(runId),
|
|
618
|
+
});
|
|
619
|
+
const runtime = Object.assign(Object.assign({ slug,
|
|
620
|
+
project,
|
|
621
|
+
engine,
|
|
622
|
+
scheduleRunner,
|
|
623
|
+
reminderRunner,
|
|
624
|
+
evalRuns }, (localControlPlane === undefined ? {} : { controlPlane: localControlPlane })), (reminderControlPlane === undefined ? {} : { reminderControlPlane }));
|
|
625
|
+
runtimes.push(runtime);
|
|
626
|
+
const accountRefs = accountRefsBySlug.get(slug);
|
|
627
|
+
mountAgentRoutes(router, runtime, Object.assign(Object.assign(Object.assign(Object.assign({ dev,
|
|
628
|
+
playground,
|
|
629
|
+
noControlPlane,
|
|
630
|
+
multi,
|
|
631
|
+
logger,
|
|
632
|
+
logRing, diagStateRoot: baseStateRoot, sessionRunLog,
|
|
633
|
+
flushStartLog, flushOtel: () => forceFlushOtelRuntime(otelRuntime) }, (options.authToken === undefined ? {} : { authToken: options.authToken })), (options.allowAnonymous === true ? { allowAnonymous: true } : {})), (accountRefs !== undefined && accountBridge !== undefined
|
|
634
|
+
? { accountBridge, accountRefs }
|
|
635
|
+
: {})), (sdkRunner instanceof CursorSdkRunner
|
|
636
|
+
? {
|
|
637
|
+
evictSdkSession: (sessionId) => {
|
|
638
|
+
sdkRunner.evictSession(sessionId);
|
|
639
|
+
},
|
|
640
|
+
}
|
|
641
|
+
: {})));
|
|
642
|
+
for (const channel of project.channels) {
|
|
643
|
+
const definition = channel.definition;
|
|
644
|
+
if (definition.onStop !== undefined) {
|
|
645
|
+
channelStopHooks.push(() => { var _a; return (_a = definition.onStop) === null || _a === void 0 ? void 0 : _a.call(definition); });
|
|
646
|
+
}
|
|
647
|
+
if (definition.onStart !== undefined) {
|
|
648
|
+
const startArgs = {
|
|
649
|
+
send: (message, sendOptions) => engine.send(channel.id, message, sendOptions),
|
|
650
|
+
architecture: project.agent.architecture,
|
|
651
|
+
getSession: sessionId => engine.getChannelSession(channel.id, sessionId),
|
|
652
|
+
receive: (target, input) => engine.receive(target, input),
|
|
653
|
+
callTool: (toolName, input, callOptions) => engine.callTool(toolName, input, callOptions),
|
|
654
|
+
emitAssistantMessage: (sessionId, text) => engine.emitAssistantMessage(sessionId, text),
|
|
655
|
+
host: engine.host,
|
|
656
|
+
waitUntil: promise => {
|
|
657
|
+
engine.trackBackground(promise);
|
|
658
|
+
},
|
|
659
|
+
resolveApproval: (sessionId, callId, decision, auth) => engine.resolveApproval(sessionId, callId, decision, auth),
|
|
660
|
+
resolveAuth: (sessionId, callId, decision, auth) => engine.resolveAuth(sessionId, callId, decision, auth),
|
|
661
|
+
hasContinuationSession: continuationToken => engine.hasContinuationSession(channel.id, continuationToken),
|
|
662
|
+
isContinuationBusy: continuationToken => engine.isContinuationBusy(channel.id, continuationToken),
|
|
663
|
+
getContinuationLastBotMessageTs: continuationToken => engine.getContinuationLastBotMessageTs(channel.id, continuationToken),
|
|
664
|
+
interruptContinuation: continuationToken => engine.interruptContinuation(channel.id, continuationToken),
|
|
665
|
+
logger,
|
|
666
|
+
artifacts: engine.artifacts,
|
|
667
|
+
};
|
|
668
|
+
try {
|
|
669
|
+
yield definition.onStart(startArgs);
|
|
670
|
+
}
|
|
671
|
+
catch (error) {
|
|
672
|
+
logger(`[agent-sdk] channel "${channel.id}" onStart failed: ${error instanceof Error ? ((_0 = error.stack) !== null && _0 !== void 0 ? _0 : error.message) : String(error)}`);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
if (timerClient !== undefined && runSchedules) {
|
|
677
|
+
yield syncHostedPlatformSchedules({
|
|
678
|
+
timers: timerClient,
|
|
679
|
+
schedules: project.schedules,
|
|
680
|
+
catalogPath: join(stateRoot, PLATFORM_SCHEDULE_CATALOG_FILENAME),
|
|
681
|
+
logger,
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
if (timerClient !== undefined) {
|
|
685
|
+
yield reminderRunner.hydrate();
|
|
686
|
+
}
|
|
687
|
+
localControlPlane === null || localControlPlane === void 0 ? void 0 : localControlPlane.startClocks();
|
|
688
|
+
}
|
|
689
|
+
if (docsSite) {
|
|
690
|
+
// The framework documentation site, mounted at /docs in both layouts
|
|
691
|
+
// ("docs" is a reserved slug). Static, no secrets; unauthenticated like
|
|
692
|
+
// the playground assets.
|
|
693
|
+
router.add({
|
|
694
|
+
method: "GET",
|
|
695
|
+
pattern: "/docs",
|
|
696
|
+
auth: "none",
|
|
697
|
+
handler: () => renderDocsFile(""),
|
|
698
|
+
});
|
|
699
|
+
router.add({
|
|
700
|
+
method: "GET",
|
|
701
|
+
pattern: "/docs/*path",
|
|
702
|
+
auth: "none",
|
|
703
|
+
handler: (_request, ctx) => { var _a; return renderDocsFile((_a = ctx.params.path) !== null && _a !== void 0 ? _a : ""); },
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
if (multi) {
|
|
707
|
+
// Host-level liveness for ALB / ECS health checks. Per-agent health stays
|
|
708
|
+
// at `/<slug>/v1/health`; without this, multi-mode has no `/v1/health`.
|
|
709
|
+
router.add({
|
|
710
|
+
method: "GET",
|
|
711
|
+
pattern: "/v1/health",
|
|
712
|
+
auth: "none",
|
|
713
|
+
handler: () => jsonResponse(Object.assign({ ok: true, agents: runtimes.map(({ slug, project }) => ({
|
|
714
|
+
slug,
|
|
715
|
+
name: project.name,
|
|
716
|
+
})) }, memoryHealthFields(runtimes.map(runtime => runtime.engine)))),
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
// Orienting `/` for every layout (single empty-slug and multi).
|
|
720
|
+
// Lists playground links plus live routes (playground, health, docs).
|
|
721
|
+
if (playground) {
|
|
722
|
+
const entries = buildAgentIndexEntries(runtimes);
|
|
723
|
+
const indexHtml = renderAgentsIndexHtml(entries, {
|
|
724
|
+
docs: docsSite,
|
|
725
|
+
multi,
|
|
726
|
+
});
|
|
727
|
+
router.add({
|
|
728
|
+
method: "GET",
|
|
729
|
+
pattern: "/",
|
|
730
|
+
auth: "none",
|
|
731
|
+
handler: () => new Response(indexHtml, {
|
|
732
|
+
headers: { "content-type": "text/html; charset=utf-8" },
|
|
733
|
+
}),
|
|
734
|
+
});
|
|
735
|
+
if (multi) {
|
|
736
|
+
router.add({
|
|
737
|
+
method: "GET",
|
|
738
|
+
pattern: "/v1/agents",
|
|
739
|
+
auth: "none",
|
|
740
|
+
handler: () => jsonResponse({ agents: entries }),
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
// Shared GitHub webhook ingress: one URL fans out to every mounted agent
|
|
745
|
+
// that declared a github channel. Signature verification is the caller's
|
|
746
|
+
// job (backend `/github_webhook` already verified); we only admit loopback
|
|
747
|
+
// so this route is not a public unsigned endpoint. Agents decide whether
|
|
748
|
+
// to run via their onPullRequest / onComment / … hooks.
|
|
749
|
+
const collectGitHubTargetsFrom = (selected) => collectGitHubTriggerTargets({
|
|
750
|
+
mounts: selected.map(runtime => ({
|
|
751
|
+
slug: runtime.slug,
|
|
752
|
+
channels: runtime.project.channels,
|
|
753
|
+
buildHandlerArgs: channelId => buildChannelHandlerArgs({ runtime, channelId }),
|
|
754
|
+
})),
|
|
755
|
+
});
|
|
756
|
+
const collectOriginTargetsFrom = (selected) => collectOriginTriggerTargets({
|
|
757
|
+
mounts: selected.map(runtime => ({
|
|
758
|
+
slug: runtime.slug,
|
|
759
|
+
channels: runtime.project.channels,
|
|
760
|
+
buildHandlerArgs: channelId => buildChannelHandlerArgs({ runtime, channelId }),
|
|
761
|
+
})),
|
|
762
|
+
});
|
|
763
|
+
const collectGitHubTargets = () => collectGitHubTargetsFrom(runtimes);
|
|
764
|
+
const v1Runtimes = runtimes.filter(runtime => !isV2Project(runtime.project));
|
|
765
|
+
const v2Runtimes = runtimes.filter(runtime => isV2Project(runtime.project));
|
|
766
|
+
const v1Mounts = mounts.filter(mount => !isV2Project(mount.project));
|
|
767
|
+
const v2Mounts = mounts.filter(mount => isV2Project(mount.project));
|
|
768
|
+
router.add({
|
|
769
|
+
method: "POST",
|
|
770
|
+
pattern: "/v1/webhooks/github",
|
|
771
|
+
auth: [localDevStrict()],
|
|
772
|
+
handler: (request) => __awaiter(this, void 0, void 0, function* () {
|
|
773
|
+
var _a;
|
|
774
|
+
var _b, _c;
|
|
775
|
+
const bodyText = yield request.text();
|
|
776
|
+
const routeContinuation = localControlPlaneRoute(runtimes);
|
|
777
|
+
const result = yield handleAgentServeTrigger(Object.assign({ type: "github", bodyText, eventName: request.headers.get("x-github-event"), deliveryId: (_b = request.headers.get("x-github-delivery")) !== null && _b !== void 0 ? _b : undefined, targets: collectGitHubTargets() }, (routeContinuation === undefined ? {} : { routeContinuation })));
|
|
778
|
+
const status = result.ok ? 202 : ((_c = (_a = result.targets[0]) === null || _a === void 0 ? void 0 : _a.status) !== null && _c !== void 0 ? _c : 500);
|
|
779
|
+
return jsonResponse(result, { status });
|
|
780
|
+
}),
|
|
781
|
+
});
|
|
782
|
+
for (const { slug, project } of mounts) {
|
|
783
|
+
validateMountConnectionsConfig(Object.assign(Object.assign({ slug,
|
|
784
|
+
project, accountRefs: accountRefsBySlug.get(slug) }, (options.publicUrl === undefined ? {} : { publicUrl: options.publicUrl })), { cloudToolsBridge: options.cloudToolsUrl !== undefined }));
|
|
785
|
+
}
|
|
786
|
+
yield cursorGithubCredentials === null || cursorGithubCredentials === void 0 ? void 0 : cursorGithubCredentials.start();
|
|
787
|
+
// Cursor SCM events: v1 stays on the engine poll. v2 ingest is local-CP
|
|
788
|
+
// only — hosted `--no-control-plane` skips the July poll (hosted CP wakes).
|
|
789
|
+
const routeContinuation = localControlPlaneRoute(runtimes);
|
|
790
|
+
const cursorEventsCommon = {
|
|
791
|
+
config: effectiveCursorEvents,
|
|
792
|
+
githubRepos: (_1 = (_e = cursorGithubConfig.cursorEvents) === null || _e === void 0 ? void 0 : _e.repos) !== null && _1 !== void 0 ? _1 : [],
|
|
793
|
+
originRepos: (_2 = cursorOriginScope === null || cursorOriginScope === void 0 ? void 0 : cursorOriginScope.repos) !== null && _2 !== void 0 ? _2 : [],
|
|
794
|
+
stateRoot: options.stateRoot,
|
|
795
|
+
auth: cursorEventsAuth,
|
|
796
|
+
logger,
|
|
797
|
+
cursorAccountOnly: options.cursorEvents === undefined &&
|
|
798
|
+
(cursorGithubTargets.length > 0 || cursorOriginTargets.length > 0),
|
|
799
|
+
};
|
|
800
|
+
const cursorEventRelay = startCursorEventRelay(Object.assign(Object.assign({}, cursorEventsCommon), { mounts: v1Mounts, collectGitHubTargets: () => collectGitHubTargetsFrom(v1Runtimes), collectOriginTargets: () => collectOriginTargetsFrom(v1Runtimes), lane: "engine", skippedV2: v2Mounts.length > 0 }));
|
|
801
|
+
const controlPlaneScmRelay = startCursorEventRelay(Object.assign(Object.assign(Object.assign(Object.assign({}, cursorEventsCommon), { mounts: v2Mounts, collectGitHubTargets: () => collectGitHubTargetsFrom(v2Runtimes), collectOriginTargets: () => collectOriginTargetsFrom(v2Runtimes) }), (routeContinuation === undefined ? {} : { routeContinuation })), { lane: "control-plane", start: false, stateDirName: join("control-plane", "cursor-events") }));
|
|
802
|
+
const localCp = firstLocalControlPlane(runtimes);
|
|
803
|
+
if (controlPlaneScmRelay !== undefined) {
|
|
804
|
+
if (localCp !== undefined) {
|
|
805
|
+
localCp.attachScmEvents(controlPlaneScmRelay);
|
|
806
|
+
}
|
|
807
|
+
else {
|
|
808
|
+
logger("[agent-sdk] cursor-events: skipping v2 scm-events poll (--no-control-plane); hosted CP owns ingest");
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
// Cursor deployment-events relay: automatic when a mounted agent authored
|
|
812
|
+
// `deploymentsChannel({ ... })`.
|
|
813
|
+
const cursorDeploymentRelay = startCursorDeploymentRelay({
|
|
814
|
+
options,
|
|
815
|
+
runtimes,
|
|
816
|
+
accountKey,
|
|
817
|
+
logger,
|
|
818
|
+
});
|
|
819
|
+
// Trust --public-url's host when a reverse proxy rewrites Host.
|
|
820
|
+
const browserOriginGuard = browserOriginGuardOptionsForPublicUrl(options.publicUrl);
|
|
821
|
+
const server = createServer((req, res) => {
|
|
822
|
+
void instrumentHttp(otelRuntime, req, res, () => handleRequest(router, req, res, logger, browserOriginGuard));
|
|
823
|
+
});
|
|
824
|
+
const host = (_3 = options.host) !== null && _3 !== void 0 ? _3 : "127.0.0.1";
|
|
825
|
+
const portWasExplicit = options.port !== undefined;
|
|
826
|
+
const requestedPort = (_4 = options.port) !== null && _4 !== void 0 ? _4 : DEFAULT_SERVE_PORT;
|
|
827
|
+
let boundPort;
|
|
828
|
+
try {
|
|
829
|
+
boundPort = yield listenHttpServer({
|
|
830
|
+
server,
|
|
831
|
+
host,
|
|
832
|
+
port: requestedPort,
|
|
833
|
+
portWasExplicit,
|
|
834
|
+
logger,
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
catch (error) {
|
|
838
|
+
yield cursorDeploymentRelay === null || cursorDeploymentRelay === void 0 ? void 0 : cursorDeploymentRelay.stop();
|
|
839
|
+
yield cursorEventRelay === null || cursorEventRelay === void 0 ? void 0 : cursorEventRelay.stop();
|
|
840
|
+
yield controlPlaneScmRelay === null || controlPlaneScmRelay === void 0 ? void 0 : controlPlaneScmRelay.stop();
|
|
841
|
+
cursorGithubCredentials === null || cursorGithubCredentials === void 0 ? void 0 : cursorGithubCredentials.stop();
|
|
842
|
+
yield shutdownOtelRuntime(otelRuntime);
|
|
843
|
+
throw error;
|
|
844
|
+
}
|
|
845
|
+
const address = server.address();
|
|
846
|
+
const displayHost = host === "0.0.0.0" || host === "::" ? "127.0.0.1" : host;
|
|
847
|
+
const url = `http://${displayHost}:${boundPort}`;
|
|
848
|
+
const oauthOrigin = ((_5 = options.publicUrl) !== null && _5 !== void 0 ? _5 : url).replace(/\/$/, "");
|
|
849
|
+
// Resolve peer + Cursor account MCP connections now that the listen port is
|
|
850
|
+
// known (see resolved-connections.ts for the URL/runtime rules).
|
|
851
|
+
for (const runtime of runtimes) {
|
|
852
|
+
const peerRefs = peerRefsBySlug.get(runtime.slug);
|
|
853
|
+
const accountRefs = accountRefsBySlug.get(runtime.slug);
|
|
854
|
+
const resolved = resolveMountConnections(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ slug: runtime.slug, project: runtime.project, serverUrl: url }, (peerRefs === undefined ? {} : { peerRefs })), (accountRefs !== undefined && accountBridge !== undefined
|
|
855
|
+
? { accountRefs, accountBridge }
|
|
856
|
+
: {})), (options.publicUrl === undefined ? {} : { publicUrl: options.publicUrl })), (options.authToken === undefined ? {} : { authToken: options.authToken })), { cloudToolsBridge: options.cloudToolsUrl !== undefined, logger }));
|
|
857
|
+
if (resolved.length > 0) {
|
|
858
|
+
runtime.engine.setResolvedConnections(resolved);
|
|
859
|
+
}
|
|
860
|
+
const oauthBase = runtime.slug === "" ? "" : `/${runtime.slug}`;
|
|
861
|
+
runtime.engine.setMcpOauthCallbackUrl(mcpOauthServeCallbackUrl(oauthOrigin, oauthBase));
|
|
862
|
+
if (accountBridge !== undefined && accountRefs !== undefined) {
|
|
863
|
+
const bridge = accountBridge;
|
|
864
|
+
runtime.engine.setCursorAccountAuthProbe((connection) => __awaiter(this, void 0, void 0, function* () {
|
|
865
|
+
const ref = accountRefs.find(entry => entry.name === connection);
|
|
866
|
+
if (ref === undefined) {
|
|
867
|
+
return undefined;
|
|
868
|
+
}
|
|
869
|
+
return yield bridge.probeAuthUrl(ref);
|
|
870
|
+
}));
|
|
871
|
+
}
|
|
872
|
+
const hasServerTools = runtime.project.agent.tools.some(tool => tool.execution === "server");
|
|
873
|
+
// Host-bridged connections ride the same endpoint as server tools, so
|
|
874
|
+
// the cloud tools connection is set whenever either needs it.
|
|
875
|
+
const bridgeableNames = runtime.engine.cloudBridgeableConnectionNames();
|
|
876
|
+
const cloudCapable = runtime.project.agent.runtime === "cloud" || runtime.project.agent.cloud !== undefined;
|
|
877
|
+
if ((hasServerTools || bridgeableNames.length > 0) && cloudCapable) {
|
|
878
|
+
const basePath = runtime.slug === "" ? "" : `/${runtime.slug}`;
|
|
879
|
+
const publicToolsUrl = (_6 = options.cloudToolsUrl) !== null && _6 !== void 0 ? _6 : (options.publicUrl === undefined
|
|
880
|
+
? undefined
|
|
881
|
+
: `${options.publicUrl.replace(/\/$/, "")}${basePath}${TOOL_MCP_ENDPOINT_PATH}`);
|
|
882
|
+
if (publicToolsUrl === undefined) {
|
|
883
|
+
if (hasServerTools) {
|
|
884
|
+
logger(`[agent-sdk] warning: agent "${runtime.project.name}" has server tools but no --public-url or --cloud-tools-url; cloud turns omit those tools.`);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
else {
|
|
888
|
+
const resolveCloudToolsHeaders = options.cloudToolsUrl === undefined
|
|
889
|
+
? undefined
|
|
890
|
+
: () => {
|
|
891
|
+
const apiKey = liveCursorApiKey();
|
|
892
|
+
return apiKey === undefined ? undefined : { authorization: `Bearer ${apiKey}` };
|
|
893
|
+
};
|
|
894
|
+
const headers = options.cloudToolsUrl !== undefined
|
|
895
|
+
? resolveCloudToolsHeaders === null || resolveCloudToolsHeaders === void 0 ? void 0 : resolveCloudToolsHeaders()
|
|
896
|
+
: options.authToken === undefined
|
|
897
|
+
? undefined
|
|
898
|
+
: { authorization: `Bearer ${options.authToken}` };
|
|
899
|
+
if (options.cloudToolsUrl !== undefined && headers === undefined) {
|
|
900
|
+
if (options.allowAnonymous !== true) {
|
|
901
|
+
throw new Error(`Agent "${runtime.project.name}" needs a Cursor API key to authenticate --cloud-tools-url. ${SIGN_IN_HINT}`);
|
|
902
|
+
}
|
|
903
|
+
logger(`[agent-sdk] --cloud-tools-url: listening unsigned; Bearer resolves after task-time credential binding`);
|
|
904
|
+
}
|
|
905
|
+
runtime.engine.setCloudServerToolsConnection(Object.assign({ type: "http", url: publicToolsUrl }, (headers === undefined ? {} : { headers })), resolveCloudToolsHeaders);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
const agents = runtimes.map(({ slug, project }) => ({
|
|
910
|
+
slug,
|
|
911
|
+
project,
|
|
912
|
+
url: slug === "" ? url : `${url}/${slug}`,
|
|
913
|
+
}));
|
|
914
|
+
for (const runtime of runtimes) {
|
|
915
|
+
runtime.evalRuns.loopbackUrl = runtime.slug === "" ? url : `${url}/${runtime.slug}`;
|
|
916
|
+
}
|
|
917
|
+
const runtimeBySlug = new Map(runtimes.map(r => [r.slug, r]));
|
|
918
|
+
// --dev: spawn Vite HMR. Single-agent infers the slug base; multi-agent
|
|
919
|
+
// serves `/<slug>/playground` on the HMR origin (optional AGENT_SERVE_BASE
|
|
920
|
+
// pins one slug at the HMR root instead).
|
|
921
|
+
let playgroundDev;
|
|
922
|
+
if (playground && dev) {
|
|
923
|
+
const pinnedBase = mounts.length === 1 ? playgroundDevBasePath(mounts) : playgroundDevBaseFromEnv();
|
|
924
|
+
const multiAgent = mounts.length > 1 && pinnedBase === undefined;
|
|
925
|
+
playgroundDev = startPlaygroundDevServer({
|
|
926
|
+
targetUrl: url,
|
|
927
|
+
basePath: pinnedBase,
|
|
928
|
+
multiAgent,
|
|
929
|
+
logger,
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
const handle = {
|
|
933
|
+
url,
|
|
934
|
+
port: address.port,
|
|
935
|
+
project: (_f = runtimes[0]) === null || _f === void 0 ? void 0 : _f.project,
|
|
936
|
+
agents,
|
|
937
|
+
dispatchSchedule: (name, slug) => {
|
|
938
|
+
var _a;
|
|
939
|
+
var _b;
|
|
940
|
+
if (slug === void 0) { slug = (_b = (_a = runtimes[0]) === null || _a === void 0 ? void 0 : _a.slug) !== null && _b !== void 0 ? _b : ""; }
|
|
941
|
+
const runtime = runtimeBySlug.get(slug);
|
|
942
|
+
if (runtime === undefined) {
|
|
943
|
+
throw new Error(`Unknown agent slug "${slug}"`);
|
|
944
|
+
}
|
|
945
|
+
return runtime.scheduleRunner.dispatch(name);
|
|
946
|
+
},
|
|
947
|
+
createReminder: (input, slug) => {
|
|
948
|
+
var _a;
|
|
949
|
+
var _b;
|
|
950
|
+
if (slug === void 0) { slug = (_b = (_a = runtimes[0]) === null || _a === void 0 ? void 0 : _a.slug) !== null && _b !== void 0 ? _b : ""; }
|
|
951
|
+
const runtime = runtimeBySlug.get(slug);
|
|
952
|
+
if (runtime === undefined) {
|
|
953
|
+
throw new Error(`Unknown agent slug "${slug}"`);
|
|
954
|
+
}
|
|
955
|
+
return runtime.reminderRunner.create(input);
|
|
956
|
+
},
|
|
957
|
+
listReminders: (filter, slug) => {
|
|
958
|
+
var _a;
|
|
959
|
+
var _b;
|
|
960
|
+
if (slug === void 0) { slug = (_b = (_a = runtimes[0]) === null || _a === void 0 ? void 0 : _a.slug) !== null && _b !== void 0 ? _b : ""; }
|
|
961
|
+
const runtime = runtimeBySlug.get(slug);
|
|
962
|
+
if (runtime === undefined) {
|
|
963
|
+
throw new Error(`Unknown agent slug "${slug}"`);
|
|
964
|
+
}
|
|
965
|
+
return runtime.reminderRunner.list(filter);
|
|
966
|
+
},
|
|
967
|
+
cancelReminder: (id, options) => {
|
|
968
|
+
var _a;
|
|
969
|
+
var _b, _c;
|
|
970
|
+
const slug = (_c = (_b = options === null || options === void 0 ? void 0 : options.slug) !== null && _b !== void 0 ? _b : (_a = runtimes[0]) === null || _a === void 0 ? void 0 : _a.slug) !== null && _c !== void 0 ? _c : "";
|
|
971
|
+
const runtime = runtimeBySlug.get(slug);
|
|
972
|
+
if (runtime === undefined) {
|
|
973
|
+
throw new Error(`Unknown agent slug "${slug}"`);
|
|
974
|
+
}
|
|
975
|
+
return runtime.reminderRunner.cancel(id, options === null || options === void 0 ? void 0 : options.reason);
|
|
976
|
+
},
|
|
977
|
+
dispatchReminder: (id, slug) => {
|
|
978
|
+
var _a;
|
|
979
|
+
var _b;
|
|
980
|
+
if (slug === void 0) { slug = (_b = (_a = runtimes[0]) === null || _a === void 0 ? void 0 : _a.slug) !== null && _b !== void 0 ? _b : ""; }
|
|
981
|
+
const runtime = runtimeBySlug.get(slug);
|
|
982
|
+
if (runtime === undefined) {
|
|
983
|
+
throw new Error(`Unknown agent slug "${slug}"`);
|
|
984
|
+
}
|
|
985
|
+
return runtime.reminderRunner.dispatch(id);
|
|
986
|
+
},
|
|
987
|
+
callTool: (toolName, input, options) => {
|
|
988
|
+
var _a;
|
|
989
|
+
var _b;
|
|
990
|
+
const _c = options !== null && options !== void 0 ? options : {}, { slug } = _c, callOptions = __rest(_c, ["slug"]);
|
|
991
|
+
const runtime = runtimeBySlug.get((_b = slug !== null && slug !== void 0 ? slug : (_a = runtimes[0]) === null || _a === void 0 ? void 0 : _a.slug) !== null && _b !== void 0 ? _b : "");
|
|
992
|
+
if (runtime === undefined) {
|
|
993
|
+
throw new Error(`Unknown agent slug "${slug}"`);
|
|
994
|
+
}
|
|
995
|
+
return runtime.engine.callTool(toolName, input, callOptions);
|
|
996
|
+
},
|
|
997
|
+
close: () => __awaiter(this, void 0, void 0, function* () {
|
|
998
|
+
var _a;
|
|
999
|
+
var _b;
|
|
1000
|
+
if (sessionRunLog !== undefined) {
|
|
1001
|
+
yield flushHostedExecutionProcessDeath({
|
|
1002
|
+
flushProcessDeath: reason => sessionRunLog.flushProcessDeath(reason),
|
|
1003
|
+
flushStartLog,
|
|
1004
|
+
startLogId: lastStartLogId,
|
|
1005
|
+
reason: "process_exit",
|
|
1006
|
+
});
|
|
1007
|
+
unregisterSessionRunFatalFlush();
|
|
1008
|
+
}
|
|
1009
|
+
playgroundDev === null || playgroundDev === void 0 ? void 0 : playgroundDev.stop();
|
|
1010
|
+
yield cursorDeploymentRelay === null || cursorDeploymentRelay === void 0 ? void 0 : cursorDeploymentRelay.stop();
|
|
1011
|
+
yield cursorEventRelay === null || cursorEventRelay === void 0 ? void 0 : cursorEventRelay.stop();
|
|
1012
|
+
yield controlPlaneScmRelay === null || controlPlaneScmRelay === void 0 ? void 0 : controlPlaneScmRelay.stop();
|
|
1013
|
+
for (const runtime of runtimes) {
|
|
1014
|
+
(_a = runtime.controlPlane) === null || _a === void 0 ? void 0 : _a.stop();
|
|
1015
|
+
runtime.scheduleRunner.stop();
|
|
1016
|
+
runtime.reminderRunner.stop();
|
|
1017
|
+
// Before the engines close their storage coordinators, so the
|
|
1018
|
+
// interrupted-batch write can still reach the sink.
|
|
1019
|
+
runtime.evalRuns.close();
|
|
1020
|
+
}
|
|
1021
|
+
for (const stop of channelStopHooks) {
|
|
1022
|
+
try {
|
|
1023
|
+
yield stop();
|
|
1024
|
+
}
|
|
1025
|
+
catch (error) {
|
|
1026
|
+
logger(`[agent-sdk] channel onStop failed: ${error instanceof Error ? ((_b = error.stack) !== null && _b !== void 0 ? _b : error.message) : String(error)}`);
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
server.close();
|
|
1030
|
+
server.closeAllConnections();
|
|
1031
|
+
try {
|
|
1032
|
+
yield Promise.all(runtimes.map(runtime => runtime.engine.close()));
|
|
1033
|
+
}
|
|
1034
|
+
finally {
|
|
1035
|
+
cursorGithubCredentials === null || cursorGithubCredentials === void 0 ? void 0 : cursorGithubCredentials.stop();
|
|
1036
|
+
yield shutdownOtelRuntime(otelRuntime);
|
|
1037
|
+
}
|
|
1038
|
+
}),
|
|
1039
|
+
};
|
|
1040
|
+
if ((playgroundDev === null || playgroundDev === void 0 ? void 0 : playgroundDev.url) !== undefined) {
|
|
1041
|
+
handle.playgroundDevUrl = playgroundDev.url;
|
|
1042
|
+
}
|
|
1043
|
+
if (docsSite && docsSiteExists()) {
|
|
1044
|
+
handle.docsUrl = `${handle.url}/docs`;
|
|
1045
|
+
}
|
|
1046
|
+
return handle;
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
function mountAgentRoutes(router, runtime, args) {
|
|
1050
|
+
var _a, _b, _c;
|
|
1051
|
+
const { slug, project, engine, scheduleRunner, reminderRunner, reminderControlPlane } = runtime;
|
|
1052
|
+
const { dev, playground, noControlPlane, multi, logger, logRing, sessionRunLog, flushStartLog } = args;
|
|
1053
|
+
// "" (single) -> "/v1/..."; "my-agent" (multi) -> "/my-agent/v1/...".
|
|
1054
|
+
const base = slug === "" ? "" : `/${slug}`;
|
|
1055
|
+
// The Cursor account MCP bridge for this mount's account MCP connections:
|
|
1056
|
+
// loopback-only + per-boot bearer secret, never on the public auth chain.
|
|
1057
|
+
if (args.accountBridge !== undefined && args.accountRefs !== undefined) {
|
|
1058
|
+
const bridge = args.accountBridge;
|
|
1059
|
+
const refByName = new Map(args.accountRefs.map(ref => [ref.name, ref]));
|
|
1060
|
+
router.add({
|
|
1061
|
+
method: "POST",
|
|
1062
|
+
pattern: `${base}${cursorAccountMcpPath(":connection")}`,
|
|
1063
|
+
auth: [bridge.authPolicy()],
|
|
1064
|
+
handler: (request, ctx) => {
|
|
1065
|
+
var _a, _b;
|
|
1066
|
+
const ref = refByName.get((_a = ctx.params.connection) !== null && _a !== void 0 ? _a : "");
|
|
1067
|
+
if (ref === undefined) {
|
|
1068
|
+
return errorResponse(404, "not_found", `No Cursor account MCP connection named "${(_b = ctx.params.connection) !== null && _b !== void 0 ? _b : ""}" on this agent.`);
|
|
1069
|
+
}
|
|
1070
|
+
return bridge.handle(request, ref, appendSlackQuietHint);
|
|
1071
|
+
},
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
const defaultAuth = args.authToken !== undefined
|
|
1075
|
+
? [bearerAuth(args.authToken)]
|
|
1076
|
+
: args.allowAnonymous === true
|
|
1077
|
+
? [allowAll()]
|
|
1078
|
+
: [localDevStrict()];
|
|
1079
|
+
const httpAuth = (_a = project.httpChannel.auth) !== null && _a !== void 0 ? _a : defaultAuth;
|
|
1080
|
+
// Temporal posts this marker on a direct pod port-token fetch. The alias
|
|
1081
|
+
// proxy strips it, so webhook/playground tokens cannot present it.
|
|
1082
|
+
const platformTimerFireAuth = request => {
|
|
1083
|
+
if (request.headers.get("x-agent-serve-timed-work") === "1") {
|
|
1084
|
+
return {
|
|
1085
|
+
authenticator: "app",
|
|
1086
|
+
principalId: "agent-serve:timed-work",
|
|
1087
|
+
principalType: "runtime",
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
return null;
|
|
1091
|
+
};
|
|
1092
|
+
// A v2 mount served under `--no-control-plane` is a hosted v2 guest: the
|
|
1093
|
+
// hosted control plane drives it through the hosted delivery route below.
|
|
1094
|
+
// Session HTTP is a control-plane surface, so such a guest mounts no
|
|
1095
|
+
// `/v1/session*` or `/v1/sessions` routes — session starts arrive as hosted
|
|
1096
|
+
// admissions (`agentsdk.session` on the built-in http channel) and session
|
|
1097
|
+
// reads come from the control plane's runs surface and durable storage.
|
|
1098
|
+
// Local dev, self-hosted serve, and hosted v1 keep the engine mounts.
|
|
1099
|
+
const hostedV2Guest = noControlPlane === true && isV2Project(project);
|
|
1100
|
+
if (hostedV2Guest) {
|
|
1101
|
+
registerHostedDeliveryRoute(Object.assign(Object.assign(Object.assign(Object.assign({ router,
|
|
1102
|
+
base,
|
|
1103
|
+
// The built-in http channel is not in `project.channels`; the control
|
|
1104
|
+
// plane's session start (`agentsdk.session`) is delivered to it.
|
|
1105
|
+
channels: [...project.channels, { id: HTTP_CHANNEL_ID, definition: project.httpChannel }], buildHandlerArgs: (channelId, hostedSessionId) => buildChannelHandlerArgs({
|
|
1106
|
+
runtime,
|
|
1107
|
+
channelId,
|
|
1108
|
+
hostedSessionId,
|
|
1109
|
+
}), fireReminder: (reminderId, fireCount) => reminderRunner.dispatch(reminderId, { expectedFireCount: fireCount }), executeReminderDescriptor: (descriptor) => __awaiter(this, void 0, void 0, function* () {
|
|
1110
|
+
if (reminderControlPlane === undefined) {
|
|
1111
|
+
throw new Error("hosted reminder CP client is not configured");
|
|
1112
|
+
}
|
|
1113
|
+
const fireDescriptor = descriptor;
|
|
1114
|
+
const outcome = yield reminderRunner.executeFire(fireDescriptor);
|
|
1115
|
+
// applyReminderOutcome is idempotent and internally retries transient
|
|
1116
|
+
// CP failures. Handler execution is at-least-once across Temporal
|
|
1117
|
+
// re-admission if apply ultimately fails.
|
|
1118
|
+
const apply = yield reminderControlPlane.applyReminderOutcome(claimFromDescriptor(fireDescriptor), outcome);
|
|
1119
|
+
// Cancel/rekey winning the race is a successful no-op from the guest's
|
|
1120
|
+
// perspective (fired work may have run; lifecycle authority stayed CP).
|
|
1121
|
+
if (!apply.applied && apply.reason === "missing") {
|
|
1122
|
+
return {
|
|
1123
|
+
reminderId: descriptor.id,
|
|
1124
|
+
outcome: "noop",
|
|
1125
|
+
reason: apply.reason,
|
|
1126
|
+
};
|
|
1127
|
+
}
|
|
1128
|
+
return {
|
|
1129
|
+
reminderId: descriptor.id,
|
|
1130
|
+
outcome: "fired",
|
|
1131
|
+
};
|
|
1132
|
+
}), drainSessionDurability: sessionId => engine.drainSessionDurability(sessionId), flushOtel: args.flushOtel }, (args.diagStateRoot === undefined ? {} : { stateRoot: args.diagStateRoot })), (sessionRunLog === undefined
|
|
1133
|
+
? {}
|
|
1134
|
+
: {
|
|
1135
|
+
persistSessionRun: (document) => __awaiter(this, void 0, void 0, function* () {
|
|
1136
|
+
yield sessionRunLog.persist(document);
|
|
1137
|
+
}),
|
|
1138
|
+
flushStartLog,
|
|
1139
|
+
})), { snapshotLogs: () => logRing.since() }), (args.evictSdkSession === undefined ? {} : { evictSdkSession: args.evictSdkSession })));
|
|
1140
|
+
}
|
|
1141
|
+
// Playground lists/opens Slack (and other channel) sessions across
|
|
1142
|
+
// principals when `--dev` (loopback) or `--allow-anonymous` (trusted
|
|
1143
|
+
// shared host, e.g. corp Okta ALB). Never when bearer / custom channel
|
|
1144
|
+
// auth is set — those keep strict per-principal isolation.
|
|
1145
|
+
const relaxSessionReadAuth = args.authToken === undefined &&
|
|
1146
|
+
project.httpChannel.auth === undefined &&
|
|
1147
|
+
(dev || args.allowAnonymous === true);
|
|
1148
|
+
const relaxSessionReadAuthBeyondLoopback = args.allowAnonymous === true;
|
|
1149
|
+
// Separate from read-relax: playground Approve/Deny on Slack-owned parked
|
|
1150
|
+
// tools (Slack principals never match local/anonymous HTTP auth).
|
|
1151
|
+
const relaxSessionApprovalAuth = relaxSessionReadAuth;
|
|
1152
|
+
router.add({
|
|
1153
|
+
method: "GET",
|
|
1154
|
+
pattern: `${base}${mcpOauthServeCallbackPath()}`,
|
|
1155
|
+
auth: "none",
|
|
1156
|
+
handler: request => engine.oauthCallbackHub.handleCallback(request),
|
|
1157
|
+
});
|
|
1158
|
+
router.add({
|
|
1159
|
+
method: "GET",
|
|
1160
|
+
pattern: `${base}/v1/health`,
|
|
1161
|
+
auth: "none",
|
|
1162
|
+
// Temporal consumes this response before promoting a newly deployed pod.
|
|
1163
|
+
// Include the framework build there so deploy observability gets the
|
|
1164
|
+
// version from the process that will serve turns, with no second request.
|
|
1165
|
+
handler: () => jsonResponse(Object.assign({ ok: true, name: project.name, version: packageVersion() }, memoryHealthFields([engine]))),
|
|
1166
|
+
});
|
|
1167
|
+
// TAS polls this after `/v1/health` and before the hosted POST. Auth none
|
|
1168
|
+
// mirrors health: the engine is reachable only through the anyrun port
|
|
1169
|
+
// proxy (network token) or the alias route.
|
|
1170
|
+
router.add({
|
|
1171
|
+
method: "GET",
|
|
1172
|
+
pattern: `${base}${GUEST_NETWORK_PATH}`,
|
|
1173
|
+
auth: "none",
|
|
1174
|
+
handler: () => guestNetworkReadinessResponse(),
|
|
1175
|
+
});
|
|
1176
|
+
// Bootstrap the SPA can't derive from its own URL (agent name, dev mode, and
|
|
1177
|
+
// — in multi-agent mode — where the agents index lives).
|
|
1178
|
+
router.add({
|
|
1179
|
+
method: "GET",
|
|
1180
|
+
pattern: `${base}/v1/meta`,
|
|
1181
|
+
auth: "none",
|
|
1182
|
+
handler: () => jsonResponse(Object.assign({ name: project.name, dev, basePath: base,
|
|
1183
|
+
// Framework version, for SPA/engine skew observability now that the
|
|
1184
|
+
// hosted playground shell is served centrally (backend deploys)
|
|
1185
|
+
// while engines stay on their install-time version.
|
|
1186
|
+
version: packageVersion() }, (multi ? { indexPath: "/" } : {}))),
|
|
1187
|
+
});
|
|
1188
|
+
router.add({
|
|
1189
|
+
method: "GET",
|
|
1190
|
+
pattern: `${base}/v1/info`,
|
|
1191
|
+
auth: httpAuth,
|
|
1192
|
+
handler: () => jsonResponse(projectInfo(project)),
|
|
1193
|
+
});
|
|
1194
|
+
// Hosted-only: the control plane's provision flow reads the deploy manifest
|
|
1195
|
+
// from the running engine (same derivation as `july manifest`) right after
|
|
1196
|
+
// the health probe, so every deploy surface — CLI, UI, redeploy — gets its
|
|
1197
|
+
// declarations from the installed code without a client-side extraction
|
|
1198
|
+
// step. `auth: "none"` mirrors `/v1/health`: hosted engines are reachable
|
|
1199
|
+
// only through the anyrun port proxy (network token) or the alias route
|
|
1200
|
+
// (alias token), and the route is not registered outside hosted mode, so
|
|
1201
|
+
// self-hosted `july serve` never exposes the manifest unauthenticated.
|
|
1202
|
+
if (process.env[AGENT_SERVE_GENERATION_ENV_VAR] !== undefined) {
|
|
1203
|
+
router.add({
|
|
1204
|
+
method: "GET",
|
|
1205
|
+
pattern: `${base}/v1/manifest`,
|
|
1206
|
+
auth: "none",
|
|
1207
|
+
handler: () => jsonResponse(buildAgentDeployManifest(project)),
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
// Playground Logs tab: recent ServeOptions.logger lines (channels, sessions,
|
|
1211
|
+
// webhook capture). `after` is an exclusive index cursor for polling.
|
|
1212
|
+
router.add({
|
|
1213
|
+
method: "GET",
|
|
1214
|
+
pattern: `${base}/v1/logs`,
|
|
1215
|
+
auth: httpAuth,
|
|
1216
|
+
handler: request => {
|
|
1217
|
+
var _a;
|
|
1218
|
+
var _b;
|
|
1219
|
+
const url = new URL(request.url);
|
|
1220
|
+
const afterRaw = url.searchParams.get("after");
|
|
1221
|
+
const after = afterRaw === null || afterRaw === "" ? -1 : Number.parseInt(afterRaw, 10);
|
|
1222
|
+
const cursor = Number.isFinite(after) ? after : -1;
|
|
1223
|
+
const entries = logRing.since(cursor);
|
|
1224
|
+
return jsonResponse({
|
|
1225
|
+
entries,
|
|
1226
|
+
nextAfter: entries.length === 0 ? cursor : ((_b = (_a = entries[entries.length - 1]) === null || _a === void 0 ? void 0 : _a.index) !== null && _b !== void 0 ? _b : cursor),
|
|
1227
|
+
});
|
|
1228
|
+
},
|
|
1229
|
+
});
|
|
1230
|
+
// Session list is session surface: not mounted on a hosted v2 guest (the
|
|
1231
|
+
// control plane owns session reads there; see hostedV2Guest above).
|
|
1232
|
+
if (!hostedV2Guest) {
|
|
1233
|
+
router.add({
|
|
1234
|
+
method: "GET",
|
|
1235
|
+
pattern: `${base}/v1/sessions`,
|
|
1236
|
+
auth: httpAuth,
|
|
1237
|
+
handler: (request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1238
|
+
// Same gate as requireSessionOwner / relaxSessionReadAuth: never with
|
|
1239
|
+
// bearer or custom channel auth (strict per-principal isolation).
|
|
1240
|
+
// `--allow-anonymous` alone is a shared-principal trust boundary (corp
|
|
1241
|
+
// Okta ALB); `--dev` alone stays loopback-only.
|
|
1242
|
+
const includeAll = relaxSessionReadAuth &&
|
|
1243
|
+
(relaxSessionReadAuthBeyondLoopback ||
|
|
1244
|
+
(typeof ctx.requestIp === "string" && isLoopbackAddress(ctx.requestIp)));
|
|
1245
|
+
// `?latest=1` — only the newest visible session. Clients binding a
|
|
1246
|
+
// default session (agsh) do not need the whole list, and on hosted
|
|
1247
|
+
// storage the whole list is a database scan.
|
|
1248
|
+
const latest = new URL(request.url).searchParams.get("latest");
|
|
1249
|
+
const listed = latest === "1" || latest === "true"
|
|
1250
|
+
? yield engine.latestSessionWithSource(ctx.auth, { includeAll })
|
|
1251
|
+
: yield engine.listSessionsWithSource(ctx.auth, { includeAll });
|
|
1252
|
+
return jsonResponse({
|
|
1253
|
+
sessions: listed.sessions,
|
|
1254
|
+
source: listed.source,
|
|
1255
|
+
});
|
|
1256
|
+
}),
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
// Durable artifacts (ctx.artifacts / tag_artifact), newest-updated first.
|
|
1260
|
+
// Cursor-paginated: pass `pageToken` from the previous response's
|
|
1261
|
+
// `nextPageToken`. A page can be short (even empty) with a nextPageToken
|
|
1262
|
+
// when a sparse filter exhausted the per-call scan budget.
|
|
1263
|
+
router.add({
|
|
1264
|
+
method: "GET",
|
|
1265
|
+
pattern: `${base}/v1/artifacts`,
|
|
1266
|
+
auth: httpAuth,
|
|
1267
|
+
handler: (request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1268
|
+
var _a, _b, _c;
|
|
1269
|
+
const url = new URL(request.url);
|
|
1270
|
+
const limitRaw = url.searchParams.get("limit");
|
|
1271
|
+
let limit = ARTIFACTS_PAGE_DEFAULT_LIMIT;
|
|
1272
|
+
if (limitRaw !== null && limitRaw !== "") {
|
|
1273
|
+
const parsed = Number.parseInt(limitRaw, 10);
|
|
1274
|
+
if (!Number.isInteger(parsed) || parsed < 1) {
|
|
1275
|
+
return errorResponse(400, "invalid_request", "`limit` must be a positive integer.");
|
|
1276
|
+
}
|
|
1277
|
+
limit = Math.min(parsed, ARTIFACTS_PAGE_MAX_LIMIT);
|
|
1278
|
+
}
|
|
1279
|
+
const kind = (_a = url.searchParams.get("kind")) !== null && _a !== void 0 ? _a : undefined;
|
|
1280
|
+
const sessionId = (_b = url.searchParams.get("sessionId")) !== null && _b !== void 0 ? _b : undefined;
|
|
1281
|
+
const pageToken = (_c = url.searchParams.get("pageToken")) !== null && _c !== void 0 ? _c : undefined;
|
|
1282
|
+
// Same includeAll gate as /v1/sessions: never with bearer or custom
|
|
1283
|
+
// channel auth (strict per-principal isolation); otherwise session
|
|
1284
|
+
// ownership applies (see SessionEngine.pageArtifacts).
|
|
1285
|
+
const includeAll = relaxSessionReadAuth &&
|
|
1286
|
+
(relaxSessionReadAuthBeyondLoopback ||
|
|
1287
|
+
(typeof ctx.requestIp === "string" && isLoopbackAddress(ctx.requestIp)));
|
|
1288
|
+
let page;
|
|
1289
|
+
try {
|
|
1290
|
+
page = yield engine.pageArtifacts(ctx.auth, {
|
|
1291
|
+
includeAll,
|
|
1292
|
+
filter: { kind, sessionId },
|
|
1293
|
+
limit,
|
|
1294
|
+
cursor: pageToken,
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
catch (error) {
|
|
1298
|
+
if (error instanceof InvalidArtifactCursorError) {
|
|
1299
|
+
return errorResponse(400, "invalid_request", "`pageToken` is not a valid page token.");
|
|
1300
|
+
}
|
|
1301
|
+
throw error;
|
|
1302
|
+
}
|
|
1303
|
+
return jsonResponse({
|
|
1304
|
+
artifacts: page.records,
|
|
1305
|
+
nextPageToken: page.nextCursor,
|
|
1306
|
+
});
|
|
1307
|
+
}),
|
|
1308
|
+
});
|
|
1309
|
+
// File/blob payload of one artifact (`tag({ contents })`).
|
|
1310
|
+
router.add({
|
|
1311
|
+
method: "GET",
|
|
1312
|
+
pattern: `${base}/v1/artifacts/:id/content`,
|
|
1313
|
+
auth: httpAuth,
|
|
1314
|
+
handler: (_request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1315
|
+
var _a;
|
|
1316
|
+
var _b, _c;
|
|
1317
|
+
const includeAll = relaxSessionReadAuth &&
|
|
1318
|
+
(relaxSessionReadAuthBeyondLoopback ||
|
|
1319
|
+
(typeof ctx.requestIp === "string" && isLoopbackAddress(ctx.requestIp)));
|
|
1320
|
+
const found = yield engine.getArtifactContent(ctx.auth, (_b = ctx.params.id) !== null && _b !== void 0 ? _b : "", { includeAll });
|
|
1321
|
+
if (found === undefined) {
|
|
1322
|
+
return errorResponse(404, "not_found", "No such artifact, or it carries no content.");
|
|
1323
|
+
}
|
|
1324
|
+
// A view over bytes is a valid fetch body; the DOM lib types are
|
|
1325
|
+
// narrower than the runtime.
|
|
1326
|
+
// contentType is author/model-controlled and the playground shares
|
|
1327
|
+
// this origin: force download, never render or sniff.
|
|
1328
|
+
return new Response(found.body, {
|
|
1329
|
+
headers: {
|
|
1330
|
+
"content-type": (_c = (_a = found.record.content) === null || _a === void 0 ? void 0 : _a.contentType) !== null && _c !== void 0 ? _c : "application/octet-stream",
|
|
1331
|
+
"content-disposition": "attachment",
|
|
1332
|
+
"x-content-type-options": "nosniff",
|
|
1333
|
+
},
|
|
1334
|
+
});
|
|
1335
|
+
}),
|
|
1336
|
+
});
|
|
1337
|
+
// The agent's MCP surface: peers and external MCP clients delegate to
|
|
1338
|
+
// this agent (ask / check / call_tool) over streamable HTTP. Stateless —
|
|
1339
|
+
// POST only; GET/DELETE get a spec-compliant 405 from the endpoint.
|
|
1340
|
+
const mcpEndpoint = createAgentMcpEndpoint({ engine, logger });
|
|
1341
|
+
for (const method of ["POST", "GET", "DELETE"]) {
|
|
1342
|
+
router.add({
|
|
1343
|
+
method,
|
|
1344
|
+
pattern: `${base}${MCP_ENDPOINT_PATH}`,
|
|
1345
|
+
auth: httpAuth,
|
|
1346
|
+
handler: (request, ctx) => mcpEndpoint.handle(request, ctx.auth),
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
const toolMcpEndpoint = createToolMcpEndpoint({ engine, logger });
|
|
1350
|
+
for (const method of ["POST", "GET", "DELETE"]) {
|
|
1351
|
+
router.add({
|
|
1352
|
+
method,
|
|
1353
|
+
pattern: `${base}${TOOL_MCP_ENDPOINT_PATH}`,
|
|
1354
|
+
auth: defaultAuth,
|
|
1355
|
+
handler: (request, ctx) => toolMcpEndpoint.handle(request, ctx.auth),
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
// The live tool catalog: the session's tool namespace as a turn would
|
|
1359
|
+
// assemble it — authored server tools plus advertised MCP passthroughs —
|
|
1360
|
+
// under model-facing names. `/v1/info` stays the static authored
|
|
1361
|
+
// manifest; this is the runtime view only the running deployment can
|
|
1362
|
+
// answer. `session` / `continuationToken` query parameters bind the
|
|
1363
|
+
// listing to a session identity (advertised inventories can be
|
|
1364
|
+
// tenant-scoped and resolved per session).
|
|
1365
|
+
const resolveCatalogBinding = (request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1366
|
+
var _a, _b;
|
|
1367
|
+
const url = new URL(request.url);
|
|
1368
|
+
const sessionId = (_a = url.searchParams.get("session")) !== null && _a !== void 0 ? _a : undefined;
|
|
1369
|
+
const continuationToken = (_b = url.searchParams.get("continuationToken")) !== null && _b !== void 0 ? _b : undefined;
|
|
1370
|
+
if (sessionId !== undefined) {
|
|
1371
|
+
const record = yield engine.sessions.get(sessionId);
|
|
1372
|
+
if (record === undefined) {
|
|
1373
|
+
return {
|
|
1374
|
+
errorResponse: errorResponse(404, "session_not_found", `Unknown session ${sessionId}.`),
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
const ownership = requireSessionOwner(record, ctx.auth, {
|
|
1378
|
+
relax: relaxSessionReadAuth,
|
|
1379
|
+
beyondLoopback: relaxSessionReadAuthBeyondLoopback,
|
|
1380
|
+
requestIp: ctx.requestIp,
|
|
1381
|
+
});
|
|
1382
|
+
if (ownership !== undefined) {
|
|
1383
|
+
return { errorResponse: ownership };
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
return { sessionId, continuationToken };
|
|
1387
|
+
});
|
|
1388
|
+
router.add({
|
|
1389
|
+
method: "GET",
|
|
1390
|
+
pattern: `${base}/v1/tools`,
|
|
1391
|
+
auth: httpAuth,
|
|
1392
|
+
handler: (request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1393
|
+
const binding = yield resolveCatalogBinding(request, ctx);
|
|
1394
|
+
if ("errorResponse" in binding) {
|
|
1395
|
+
return binding.errorResponse;
|
|
1396
|
+
}
|
|
1397
|
+
try {
|
|
1398
|
+
const catalog = yield engine.listCatalogTools(Object.assign({ auth: ctx.auth }, binding));
|
|
1399
|
+
return jsonResponse({
|
|
1400
|
+
tools: catalog.tools.map(catalogListEntry),
|
|
1401
|
+
// JSON.stringify drops the key when there is nothing to report.
|
|
1402
|
+
connectionErrors: catalog.connectionErrors.length === 0 ? undefined : catalog.connectionErrors,
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
catch (error) {
|
|
1406
|
+
if (error instanceof InvalidContinuationTokenError) {
|
|
1407
|
+
return errorResponse(400, "invalid_continuation_token", error.message);
|
|
1408
|
+
}
|
|
1409
|
+
throw error;
|
|
1410
|
+
}
|
|
1411
|
+
}),
|
|
1412
|
+
});
|
|
1413
|
+
router.add({
|
|
1414
|
+
method: "GET",
|
|
1415
|
+
pattern: `${base}/v1/tools/:toolName`,
|
|
1416
|
+
auth: httpAuth,
|
|
1417
|
+
handler: (request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1418
|
+
var _a;
|
|
1419
|
+
const toolName = (_a = ctx.params.toolName) !== null && _a !== void 0 ? _a : "";
|
|
1420
|
+
const binding = yield resolveCatalogBinding(request, ctx);
|
|
1421
|
+
if ("errorResponse" in binding) {
|
|
1422
|
+
return binding.errorResponse;
|
|
1423
|
+
}
|
|
1424
|
+
try {
|
|
1425
|
+
const described = yield engine.describeCatalogTool(toolName, Object.assign({ auth: ctx.auth }, binding));
|
|
1426
|
+
if (described.tool === undefined) {
|
|
1427
|
+
return jsonResponse({
|
|
1428
|
+
ok: false,
|
|
1429
|
+
error: "unknown_tool",
|
|
1430
|
+
message: `Unknown tool "${toolName}".`,
|
|
1431
|
+
availableTools: described.availableTools,
|
|
1432
|
+
}, { status: 404 });
|
|
1433
|
+
}
|
|
1434
|
+
return jsonResponse(catalogDetailEntry(described.tool));
|
|
1435
|
+
}
|
|
1436
|
+
catch (error) {
|
|
1437
|
+
if (error instanceof InvalidContinuationTokenError) {
|
|
1438
|
+
return errorResponse(400, "invalid_continuation_token", error.message);
|
|
1439
|
+
}
|
|
1440
|
+
throw error;
|
|
1441
|
+
}
|
|
1442
|
+
}),
|
|
1443
|
+
});
|
|
1444
|
+
// Deterministic tool invocation: run an authored server tool directly,
|
|
1445
|
+
// without a model turn deciding to call it.
|
|
1446
|
+
router.add({
|
|
1447
|
+
method: "POST",
|
|
1448
|
+
pattern: `${base}/v1/tools/:toolName`,
|
|
1449
|
+
auth: httpAuth,
|
|
1450
|
+
handler: (request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1451
|
+
var _a, _b;
|
|
1452
|
+
const toolName = (_a = ctx.params.toolName) !== null && _a !== void 0 ? _a : "";
|
|
1453
|
+
const body = yield readJsonObject(request);
|
|
1454
|
+
if (body === undefined) {
|
|
1455
|
+
return errorResponse(400, "invalid_request", 'Expected a JSON object body, e.g. {"input": {...}}.');
|
|
1456
|
+
}
|
|
1457
|
+
if (body.sessionId !== undefined && typeof body.sessionId !== "string") {
|
|
1458
|
+
return errorResponse(400, "invalid_request", "`sessionId` must be a string when provided.");
|
|
1459
|
+
}
|
|
1460
|
+
if (body.continuationToken !== undefined && typeof body.continuationToken !== "string") {
|
|
1461
|
+
return errorResponse(400, "invalid_request", "`continuationToken` must be a string when provided.");
|
|
1462
|
+
}
|
|
1463
|
+
const continuationToken = body.continuationToken;
|
|
1464
|
+
const sessionId = body.sessionId;
|
|
1465
|
+
if (sessionId !== undefined) {
|
|
1466
|
+
const record = yield engine.sessions.get(sessionId);
|
|
1467
|
+
if (record === undefined) {
|
|
1468
|
+
return errorResponse(404, "session_not_found", `Unknown session ${sessionId}.`);
|
|
1469
|
+
}
|
|
1470
|
+
const ownership = requireSessionOwner(record, ctx.auth, {
|
|
1471
|
+
relax: relaxSessionReadAuth,
|
|
1472
|
+
beyondLoopback: relaxSessionReadAuthBeyondLoopback,
|
|
1473
|
+
requestIp: ctx.requestIp,
|
|
1474
|
+
});
|
|
1475
|
+
if (ownership !== undefined) {
|
|
1476
|
+
return ownership;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
try {
|
|
1480
|
+
const outcome = yield engine.callTool(toolName, (_b = body.input) !== null && _b !== void 0 ? _b : {}, {
|
|
1481
|
+
auth: ctx.auth,
|
|
1482
|
+
sessionId,
|
|
1483
|
+
continuationToken,
|
|
1484
|
+
});
|
|
1485
|
+
return jsonResponse(Object.assign({ ok: !outcome.isError }, outcome));
|
|
1486
|
+
}
|
|
1487
|
+
catch (error) {
|
|
1488
|
+
if (error instanceof UnknownToolError) {
|
|
1489
|
+
return jsonResponse({
|
|
1490
|
+
ok: false,
|
|
1491
|
+
error: "unknown_tool",
|
|
1492
|
+
message: error.message,
|
|
1493
|
+
availableTools: error.availableToolNames,
|
|
1494
|
+
}, { status: 404 });
|
|
1495
|
+
}
|
|
1496
|
+
if (error instanceof ToolNotDirectlyCallableError) {
|
|
1497
|
+
return errorResponse(400, "tool_not_callable", error.message);
|
|
1498
|
+
}
|
|
1499
|
+
if (error instanceof ToolInputError) {
|
|
1500
|
+
return errorResponse(400, "invalid_tool_input", error.message);
|
|
1501
|
+
}
|
|
1502
|
+
if (error instanceof InvalidContinuationTokenError) {
|
|
1503
|
+
return errorResponse(400, "invalid_continuation_token", error.message);
|
|
1504
|
+
}
|
|
1505
|
+
if (error instanceof WorkspaceUnavailableError) {
|
|
1506
|
+
return errorResponse(500, "workspace_unavailable", error.message);
|
|
1507
|
+
}
|
|
1508
|
+
throw error;
|
|
1509
|
+
}
|
|
1510
|
+
}),
|
|
1511
|
+
});
|
|
1512
|
+
// Deterministic skill reads: the body the harness would receive, plus
|
|
1513
|
+
// resolved sibling files. Read-only, so plain GETs with no session binding.
|
|
1514
|
+
router.add({
|
|
1515
|
+
method: "GET",
|
|
1516
|
+
pattern: `${base}/v1/skills`,
|
|
1517
|
+
auth: httpAuth,
|
|
1518
|
+
handler: () => __awaiter(this, void 0, void 0, function* () {
|
|
1519
|
+
return jsonResponse({
|
|
1520
|
+
skills: project.agent.skills.map(skillListEntry),
|
|
1521
|
+
});
|
|
1522
|
+
}),
|
|
1523
|
+
});
|
|
1524
|
+
router.add({
|
|
1525
|
+
method: "GET",
|
|
1526
|
+
pattern: `${base}/v1/skills/:skillName`,
|
|
1527
|
+
auth: httpAuth,
|
|
1528
|
+
handler: (_request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1529
|
+
var _a;
|
|
1530
|
+
const skillName = (_a = ctx.params.skillName) !== null && _a !== void 0 ? _a : "";
|
|
1531
|
+
try {
|
|
1532
|
+
return jsonResponse(yield readSkillDetail(project.agent.skills, skillName));
|
|
1533
|
+
}
|
|
1534
|
+
catch (error) {
|
|
1535
|
+
if (error instanceof UnknownSkillError) {
|
|
1536
|
+
return jsonResponse({
|
|
1537
|
+
ok: false,
|
|
1538
|
+
error: "unknown_skill",
|
|
1539
|
+
message: error.message,
|
|
1540
|
+
availableSkills: error.availableSkillNames,
|
|
1541
|
+
}, { status: 404 });
|
|
1542
|
+
}
|
|
1543
|
+
throw error;
|
|
1544
|
+
}
|
|
1545
|
+
}),
|
|
1546
|
+
});
|
|
1547
|
+
if (playground) {
|
|
1548
|
+
// Serve the built Vite SPA. `<base href>` is injected so the SPA's relative
|
|
1549
|
+
// asset URLs resolve under this mount regardless of the trailing slash the
|
|
1550
|
+
// browser lands on. Render per request so a mid-run `build:playground`
|
|
1551
|
+
// is picked up without restarting. In dev, run `pnpm run dev:playground`
|
|
1552
|
+
// (Vite + HMR) instead; it proxies `/v1` here.
|
|
1553
|
+
router.add({
|
|
1554
|
+
method: "GET",
|
|
1555
|
+
pattern: `${base}/playground`,
|
|
1556
|
+
auth: "none",
|
|
1557
|
+
handler: () => new Response(renderPlaygroundIndexHtml(`${base}/playground/`), {
|
|
1558
|
+
headers: { "content-type": "text/html; charset=utf-8" },
|
|
1559
|
+
}),
|
|
1560
|
+
});
|
|
1561
|
+
router.add({
|
|
1562
|
+
method: "GET",
|
|
1563
|
+
pattern: `${base}/playground/assets/:file`,
|
|
1564
|
+
auth: "none",
|
|
1565
|
+
handler: (_request, ctx) => { var _a; return renderPlaygroundAsset((_a = ctx.params.file) !== null && _a !== void 0 ? _a : ""); },
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
// The built-in HTTP session channel (`/v1/session*`, including the
|
|
1569
|
+
// session-scoped approvals/auths routes) is session surface: not mounted on
|
|
1570
|
+
// a hosted v2 guest (see hostedV2Guest above). The `http` channel itself
|
|
1571
|
+
// stays registered with the hosted delivery route, which is how the control
|
|
1572
|
+
// plane's session starts reach it.
|
|
1573
|
+
if (!hostedV2Guest) {
|
|
1574
|
+
for (const route of buildHttpChannelRoutes({
|
|
1575
|
+
engine,
|
|
1576
|
+
config: project.httpChannel,
|
|
1577
|
+
auth: httpAuth,
|
|
1578
|
+
basePath: base,
|
|
1579
|
+
// Dev playground lists every session (`includeAll`); allow opening them
|
|
1580
|
+
// (see relaxSessionReadAuth above).
|
|
1581
|
+
relaxSessionReadAuth,
|
|
1582
|
+
relaxSessionReadAuthBeyondLoopback,
|
|
1583
|
+
relaxSessionApprovalAuth,
|
|
1584
|
+
})) {
|
|
1585
|
+
router.add(route);
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
// Playground eval list/run — available without `--dev` (corp / allow-anonymous).
|
|
1589
|
+
// Schedule/reminder hand-dispatch stays `--dev` only below.
|
|
1590
|
+
router.add({
|
|
1591
|
+
method: "GET",
|
|
1592
|
+
pattern: `${base}/v1/dev/evals`,
|
|
1593
|
+
auth: httpAuth,
|
|
1594
|
+
handler: () => __awaiter(this, void 0, void 0, function* () { return jsonResponse(yield runtime.evalRuns.list()); }),
|
|
1595
|
+
});
|
|
1596
|
+
router.add({
|
|
1597
|
+
method: "GET",
|
|
1598
|
+
pattern: `${base}/v1/dev/evals/runs`,
|
|
1599
|
+
auth: httpAuth,
|
|
1600
|
+
handler: () => __awaiter(this, void 0, void 0, function* () {
|
|
1601
|
+
return jsonResponse(yield runtime.evalRuns.listRunsWithActive());
|
|
1602
|
+
}),
|
|
1603
|
+
});
|
|
1604
|
+
router.add({
|
|
1605
|
+
method: "POST",
|
|
1606
|
+
pattern: `${base}/v1/dev/evals/runs`,
|
|
1607
|
+
auth: httpAuth,
|
|
1608
|
+
handler: (request) => __awaiter(this, void 0, void 0, function* () {
|
|
1609
|
+
const body = yield readJsonObject(request);
|
|
1610
|
+
const filterIds = asStringArray(body === null || body === void 0 ? void 0 : body.filterIds);
|
|
1611
|
+
const tags = asStringArray(body === null || body === void 0 ? void 0 : body.tags);
|
|
1612
|
+
const timeoutMs = asPositiveInt(body === null || body === void 0 ? void 0 : body.timeoutMs);
|
|
1613
|
+
const verbose = (body === null || body === void 0 ? void 0 : body.verbose) === true;
|
|
1614
|
+
const authHeader = request.headers.get("authorization");
|
|
1615
|
+
const bearerToken = (authHeader === null || authHeader === void 0 ? void 0 : authHeader.toLowerCase().startsWith("bearer "))
|
|
1616
|
+
? authHeader.slice("bearer ".length).trim()
|
|
1617
|
+
: undefined;
|
|
1618
|
+
try {
|
|
1619
|
+
const snap = yield runtime.evalRuns.start(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (filterIds === undefined ? {} : { filterIds })), (tags === undefined ? {} : { tags })), (bearerToken === undefined || bearerToken === "" ? {} : { bearerToken })), (timeoutMs === undefined ? {} : { timeoutMs })), (verbose ? { verbose: true } : {})));
|
|
1620
|
+
return jsonResponse(snap, { status: 202 });
|
|
1621
|
+
}
|
|
1622
|
+
catch (error) {
|
|
1623
|
+
if (error instanceof EvalRunConflictError) {
|
|
1624
|
+
return jsonResponse({
|
|
1625
|
+
ok: false,
|
|
1626
|
+
error: "eval_run_in_progress",
|
|
1627
|
+
activeRunId: error.activeRunId,
|
|
1628
|
+
}, { status: 409 });
|
|
1629
|
+
}
|
|
1630
|
+
if (error instanceof EvalRunEmptyError) {
|
|
1631
|
+
return jsonResponse({ ok: false, error: "no_matching_evals" }, { status: 404 });
|
|
1632
|
+
}
|
|
1633
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1634
|
+
return jsonResponse({ ok: false, error: "eval_start_failed", message }, { status: 400 });
|
|
1635
|
+
}
|
|
1636
|
+
}),
|
|
1637
|
+
});
|
|
1638
|
+
router.add({
|
|
1639
|
+
method: "GET",
|
|
1640
|
+
pattern: `${base}/v1/dev/evals/runs/:runId`,
|
|
1641
|
+
auth: httpAuth,
|
|
1642
|
+
handler: (_request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1643
|
+
var _a;
|
|
1644
|
+
const runId = (_a = ctx.params.runId) !== null && _a !== void 0 ? _a : "";
|
|
1645
|
+
const snap = yield runtime.evalRuns.get(runId);
|
|
1646
|
+
if (snap === undefined) {
|
|
1647
|
+
return jsonResponse({ ok: false, error: "unknown_eval_run" }, { status: 404 });
|
|
1648
|
+
}
|
|
1649
|
+
return jsonResponse(snap);
|
|
1650
|
+
}),
|
|
1651
|
+
});
|
|
1652
|
+
router.add({
|
|
1653
|
+
method: "POST",
|
|
1654
|
+
pattern: `${base}/v1/dev/evals/runs/:runId/cancel`,
|
|
1655
|
+
auth: httpAuth,
|
|
1656
|
+
handler: (_request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1657
|
+
var _a;
|
|
1658
|
+
const runId = (_a = ctx.params.runId) !== null && _a !== void 0 ? _a : "";
|
|
1659
|
+
try {
|
|
1660
|
+
const snap = yield runtime.evalRuns.cancel(runId);
|
|
1661
|
+
return jsonResponse(snap);
|
|
1662
|
+
}
|
|
1663
|
+
catch (error) {
|
|
1664
|
+
if (error instanceof EvalRunUnknownError) {
|
|
1665
|
+
return jsonResponse({ ok: false, error: "unknown_eval_run" }, { status: 404 });
|
|
1666
|
+
}
|
|
1667
|
+
if (error instanceof EvalRunNotRunningError) {
|
|
1668
|
+
return jsonResponse({
|
|
1669
|
+
ok: false,
|
|
1670
|
+
error: "eval_run_not_running",
|
|
1671
|
+
runId: error.runId,
|
|
1672
|
+
status: error.status,
|
|
1673
|
+
message: error.message,
|
|
1674
|
+
}, { status: 409 });
|
|
1675
|
+
}
|
|
1676
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1677
|
+
return jsonResponse({ ok: false, error: "eval_cancel_failed", message }, { status: 400 });
|
|
1678
|
+
}
|
|
1679
|
+
}),
|
|
1680
|
+
});
|
|
1681
|
+
if (noControlPlane === true) {
|
|
1682
|
+
router.add({
|
|
1683
|
+
method: "POST",
|
|
1684
|
+
pattern: `${base}/v1/internal/schedules/:scheduleId/fire`,
|
|
1685
|
+
auth: [platformTimerFireAuth],
|
|
1686
|
+
handler: (_request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1687
|
+
var _a;
|
|
1688
|
+
const scheduleId = (_a = ctx.params.scheduleId) !== null && _a !== void 0 ? _a : "";
|
|
1689
|
+
try {
|
|
1690
|
+
const { sessionIds } = yield scheduleRunner.dispatch(scheduleId);
|
|
1691
|
+
return jsonResponse({ scheduleId, sessionIds });
|
|
1692
|
+
}
|
|
1693
|
+
catch (error) {
|
|
1694
|
+
if (error instanceof UnknownScheduleError) {
|
|
1695
|
+
return jsonResponse({
|
|
1696
|
+
ok: false,
|
|
1697
|
+
error: "unknown_schedule",
|
|
1698
|
+
availableScheduleIds: error.availableScheduleIds,
|
|
1699
|
+
}, { status: 404 });
|
|
1700
|
+
}
|
|
1701
|
+
throw error;
|
|
1702
|
+
}
|
|
1703
|
+
}),
|
|
1704
|
+
});
|
|
1705
|
+
router.add({
|
|
1706
|
+
method: "POST",
|
|
1707
|
+
pattern: `${base}/v1/internal/reminders/:reminderId/fire`,
|
|
1708
|
+
auth: [platformTimerFireAuth],
|
|
1709
|
+
handler: (request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1710
|
+
var _a;
|
|
1711
|
+
const reminderId = (_a = ctx.params.reminderId) !== null && _a !== void 0 ? _a : "";
|
|
1712
|
+
const fireCountRaw = new URL(request.url).searchParams.get("fireCount");
|
|
1713
|
+
const expectedFireCount = fireCountRaw === null ? undefined : Number(fireCountRaw);
|
|
1714
|
+
try {
|
|
1715
|
+
const result = yield reminderRunner.dispatch(reminderId, expectedFireCount !== undefined && Number.isInteger(expectedFireCount)
|
|
1716
|
+
? { expectedFireCount }
|
|
1717
|
+
: {});
|
|
1718
|
+
return jsonResponse(result);
|
|
1719
|
+
}
|
|
1720
|
+
catch (error) {
|
|
1721
|
+
if (error instanceof UnknownReminderError) {
|
|
1722
|
+
return jsonResponse({
|
|
1723
|
+
ok: false,
|
|
1724
|
+
error: "unknown_reminder",
|
|
1725
|
+
availableReminderIds: error.availableReminderIds,
|
|
1726
|
+
}, { status: 404 });
|
|
1727
|
+
}
|
|
1728
|
+
if (error instanceof ReminderValidationError) {
|
|
1729
|
+
return jsonResponse({ ok: false, error: "invalid_reminder", message: error.message }, { status: 400 });
|
|
1730
|
+
}
|
|
1731
|
+
throw error;
|
|
1732
|
+
}
|
|
1733
|
+
}),
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1736
|
+
if (dev) {
|
|
1737
|
+
router.add({
|
|
1738
|
+
method: "POST",
|
|
1739
|
+
pattern: `${base}/v1/dev/schedules/:scheduleId`,
|
|
1740
|
+
auth: httpAuth,
|
|
1741
|
+
handler: (_request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1742
|
+
var _a;
|
|
1743
|
+
const scheduleId = (_a = ctx.params.scheduleId) !== null && _a !== void 0 ? _a : "";
|
|
1744
|
+
try {
|
|
1745
|
+
const { sessionIds } = yield scheduleRunner.dispatch(scheduleId);
|
|
1746
|
+
return jsonResponse({ scheduleId, sessionIds });
|
|
1747
|
+
}
|
|
1748
|
+
catch (error) {
|
|
1749
|
+
if (error instanceof UnknownScheduleError) {
|
|
1750
|
+
return jsonResponse({
|
|
1751
|
+
ok: false,
|
|
1752
|
+
error: "unknown_schedule",
|
|
1753
|
+
availableScheduleIds: error.availableScheduleIds,
|
|
1754
|
+
}, { status: 404 });
|
|
1755
|
+
}
|
|
1756
|
+
throw error;
|
|
1757
|
+
}
|
|
1758
|
+
}),
|
|
1759
|
+
});
|
|
1760
|
+
router.add({
|
|
1761
|
+
method: "POST",
|
|
1762
|
+
pattern: `${base}/v1/dev/reminders/:reminderId`,
|
|
1763
|
+
auth: httpAuth,
|
|
1764
|
+
handler: (_request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1765
|
+
var _a;
|
|
1766
|
+
const reminderId = (_a = ctx.params.reminderId) !== null && _a !== void 0 ? _a : "";
|
|
1767
|
+
try {
|
|
1768
|
+
const listed = yield reminderRunner.list();
|
|
1769
|
+
const reminder = listed.find(r => r.id === reminderId);
|
|
1770
|
+
if (reminder === undefined) {
|
|
1771
|
+
const ids = listed.map(r => r.id);
|
|
1772
|
+
throw new UnknownReminderError(reminderId, ids);
|
|
1773
|
+
}
|
|
1774
|
+
const ownership = yield assertReminderReadable({
|
|
1775
|
+
engine,
|
|
1776
|
+
reminder,
|
|
1777
|
+
auth: ctx.auth,
|
|
1778
|
+
requestIp: ctx.requestIp,
|
|
1779
|
+
relax: relaxSessionReadAuth,
|
|
1780
|
+
beyondLoopback: relaxSessionReadAuthBeyondLoopback,
|
|
1781
|
+
});
|
|
1782
|
+
if (ownership !== undefined) {
|
|
1783
|
+
return ownership;
|
|
1784
|
+
}
|
|
1785
|
+
const result = yield reminderRunner.dispatch(reminderId);
|
|
1786
|
+
return jsonResponse(result);
|
|
1787
|
+
}
|
|
1788
|
+
catch (error) {
|
|
1789
|
+
if (error instanceof UnknownReminderError) {
|
|
1790
|
+
return jsonResponse({
|
|
1791
|
+
ok: false,
|
|
1792
|
+
error: "unknown_reminder",
|
|
1793
|
+
availableReminderIds: error.availableReminderIds,
|
|
1794
|
+
}, { status: 404 });
|
|
1795
|
+
}
|
|
1796
|
+
if (error instanceof ReminderValidationError) {
|
|
1797
|
+
return jsonResponse({ ok: false, error: "invalid_reminder", message: error.message }, { status: 400 });
|
|
1798
|
+
}
|
|
1799
|
+
throw error;
|
|
1800
|
+
}
|
|
1801
|
+
}),
|
|
1802
|
+
});
|
|
1803
|
+
router.add({
|
|
1804
|
+
method: "GET",
|
|
1805
|
+
pattern: `${base}/v1/dev/reminders`,
|
|
1806
|
+
auth: httpAuth,
|
|
1807
|
+
handler: (_request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1808
|
+
const all = yield reminderRunner.list();
|
|
1809
|
+
const reminders = [];
|
|
1810
|
+
for (const reminder of all) {
|
|
1811
|
+
const denied = yield assertReminderReadable({
|
|
1812
|
+
engine,
|
|
1813
|
+
reminder,
|
|
1814
|
+
auth: ctx.auth,
|
|
1815
|
+
requestIp: ctx.requestIp,
|
|
1816
|
+
relax: relaxSessionReadAuth,
|
|
1817
|
+
beyondLoopback: relaxSessionReadAuthBeyondLoopback,
|
|
1818
|
+
});
|
|
1819
|
+
if (denied === undefined) {
|
|
1820
|
+
reminders.push(reminder);
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
return jsonResponse({ reminders });
|
|
1824
|
+
}),
|
|
1825
|
+
});
|
|
1826
|
+
}
|
|
1827
|
+
for (const channel of project.channels) {
|
|
1828
|
+
const channelAuth = (_b = channel.definition.auth) !== null && _b !== void 0 ? _b : defaultAuth;
|
|
1829
|
+
for (const channelRoute of (_c = channel.definition.routes) !== null && _c !== void 0 ? _c : []) {
|
|
1830
|
+
router.add({
|
|
1831
|
+
method: channelRoute.method,
|
|
1832
|
+
pattern: `${base}/v1/channels/${channel.id}${channelRoute.path}`,
|
|
1833
|
+
auth: channelAuth,
|
|
1834
|
+
handler: (request, ctx) => invokeChannelRoute({
|
|
1835
|
+
route: channelRoute,
|
|
1836
|
+
request,
|
|
1837
|
+
handlerArgs: buildChannelHandlerArgs({
|
|
1838
|
+
runtime,
|
|
1839
|
+
channelId: channel.id,
|
|
1840
|
+
params: ctx.params,
|
|
1841
|
+
requestIp: ctx.requestIp,
|
|
1842
|
+
auth: ctx.auth,
|
|
1843
|
+
}),
|
|
1844
|
+
}),
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
/**
|
|
1850
|
+
* `cursorEvents` (`--cursor-events`) long-polls `/v0/scm-events` as the host's
|
|
1851
|
+
* Cursor user, so a signed-out host has no way to receive deliveries. Fail the
|
|
1852
|
+
* serve instead of starting with a relay that could never run.
|
|
1853
|
+
*/
|
|
1854
|
+
function requireCursorEventsAuth(config, accountKey) {
|
|
1855
|
+
var _a, _b, _c;
|
|
1856
|
+
const apiKey = ((_b = (_a = config.apiKey) !== null && _a !== void 0 ? _a : accountKey === null || accountKey === void 0 ? void 0 : accountKey.apiKey) !== null && _b !== void 0 ? _b : "").trim();
|
|
1857
|
+
if (apiKey === "") {
|
|
1858
|
+
throw new Error(`[agent-sdk] --cursor-events (serve({ cursorEvents })) requires a signed-in Cursor account: the SCM event stream is read as the host's user. ${SIGN_IN_HINT}`);
|
|
1859
|
+
}
|
|
1860
|
+
return {
|
|
1861
|
+
apiKey,
|
|
1862
|
+
// `/v0/scm-events/*` lives on the external API (api.cursor.com), not
|
|
1863
|
+
// api2. Prefer that default over the account key's backendUrl, which
|
|
1864
|
+
// follows cursorBackendUrl() (api2) when CURSOR_API_KEY is set.
|
|
1865
|
+
baseUrl: (_c = config.baseUrl) !== null && _c !== void 0 ? _c : cursorExternalApiUrl(),
|
|
1866
|
+
};
|
|
1867
|
+
}
|
|
1868
|
+
/**
|
|
1869
|
+
* Opt-in Cursor SCM events relay. Credentials are already required by
|
|
1870
|
+
* {@link requireCursorEventsAuth}; the remaining unusable configs (no repos,
|
|
1871
|
+
* no github/origin channel) warn and leave the relay off — serve still starts.
|
|
1872
|
+
*
|
|
1873
|
+
* GitHub and Origin subscriptions are registered independently so mirrored
|
|
1874
|
+
* `owner/name` slugs do not mix. `--cursor-events --repo` feeds GitHub
|
|
1875
|
+
* channels; Origin is subscribed only when an `originChannel({ cursorAccount })`
|
|
1876
|
+
* opted in.
|
|
1877
|
+
*/
|
|
1878
|
+
function collectCursorEventSubscriptions(input) {
|
|
1879
|
+
const githubTargets = findGitHubChannelTargets(input.mounts);
|
|
1880
|
+
const originTargets = findOriginChannelTargets(input.mounts);
|
|
1881
|
+
const githubEvents = [...new Set(githubTargets.flatMap(target => target.events))];
|
|
1882
|
+
const originEvents = [...new Set(originTargets.flatMap(target => target.events))];
|
|
1883
|
+
const githubRepos = [...new Set(input.githubRepos.map(repo => repo.trim().toLowerCase()))].filter(repo => repo.length > 0);
|
|
1884
|
+
const originRepos = [...new Set(input.originRepos.map(repo => repo.trim().toLowerCase()))].filter(repo => repo.length > 0);
|
|
1885
|
+
const subscriptions = [];
|
|
1886
|
+
if (githubEvents.length > 0 && githubRepos.length > 0) {
|
|
1887
|
+
for (const repo of githubRepos) {
|
|
1888
|
+
subscriptions.push({
|
|
1889
|
+
provider: "github",
|
|
1890
|
+
repo,
|
|
1891
|
+
events: githubEvents,
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
if (originEvents.length > 0 && originRepos.length > 0) {
|
|
1896
|
+
for (const repo of originRepos) {
|
|
1897
|
+
subscriptions.push({
|
|
1898
|
+
provider: "origin",
|
|
1899
|
+
repo,
|
|
1900
|
+
events: originEvents,
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
return subscriptions;
|
|
1905
|
+
}
|
|
1906
|
+
/**
|
|
1907
|
+
* Local CP + `--cursor-events` + both architectures would start two
|
|
1908
|
+
* consumers (different offset dirs). Refuse that at serve start.
|
|
1909
|
+
* `--no-control-plane` is one July consumer — hosted CP owns v2.
|
|
1910
|
+
*/
|
|
1911
|
+
function assertSingleCursorEventsLane(input) {
|
|
1912
|
+
if (input.noControlPlane || input.config === undefined || input.auth === undefined) {
|
|
1913
|
+
return;
|
|
1914
|
+
}
|
|
1915
|
+
const shared = {
|
|
1916
|
+
githubRepos: input.githubRepos,
|
|
1917
|
+
originRepos: input.originRepos,
|
|
1918
|
+
};
|
|
1919
|
+
if (collectCursorEventSubscriptions(Object.assign({ mounts: input.v1Mounts }, shared)).length === 0 ||
|
|
1920
|
+
collectCursorEventSubscriptions(Object.assign({ mounts: input.v2Mounts }, shared)).length === 0) {
|
|
1921
|
+
return;
|
|
1922
|
+
}
|
|
1923
|
+
throw new Error("[agent-sdk] cursor-events: refusing to serve v1 and v2 github/origin agents in one process — they would open two /v0/scm-events consumers. Serve one architecture per process.");
|
|
1924
|
+
}
|
|
1925
|
+
function startCursorEventRelay(input) {
|
|
1926
|
+
var _a;
|
|
1927
|
+
var _b, _c;
|
|
1928
|
+
const { config, stateRoot, mounts, auth, logger } = input;
|
|
1929
|
+
if (config === undefined || auth === undefined) {
|
|
1930
|
+
return undefined;
|
|
1931
|
+
}
|
|
1932
|
+
const subscriptions = collectCursorEventSubscriptions({
|
|
1933
|
+
mounts,
|
|
1934
|
+
githubRepos: input.githubRepos,
|
|
1935
|
+
originRepos: input.originRepos,
|
|
1936
|
+
});
|
|
1937
|
+
if (subscriptions.length === 0) {
|
|
1938
|
+
if (input.lane === "engine" && input.skippedV2 === true) {
|
|
1939
|
+
logger("[agent-sdk] cursor-events: no v1 github/origin targets; v2 ingest is control-plane only");
|
|
1940
|
+
}
|
|
1941
|
+
else if (input.lane === "control-plane") {
|
|
1942
|
+
return undefined;
|
|
1943
|
+
}
|
|
1944
|
+
else if (input.githubRepos.every(repo => repo.trim() === "") &&
|
|
1945
|
+
input.originRepos.every(repo => repo.trim() === "")) {
|
|
1946
|
+
logger("[agent-sdk] cursor-events: no repos configured (pass --repo owner/name); relay disabled");
|
|
1947
|
+
}
|
|
1948
|
+
else {
|
|
1949
|
+
logger("[agent-sdk] cursor-events: no mounted agent declares a github or origin channel; relay disabled");
|
|
1950
|
+
}
|
|
1951
|
+
return undefined;
|
|
1952
|
+
}
|
|
1953
|
+
const baseStateRoot = stateRoot !== null && stateRoot !== void 0 ? stateRoot : join((_b = (_a = mounts[0]) === null || _a === void 0 ? void 0 : _a.project.rootDir) !== null && _b !== void 0 ? _b : process.cwd(), ".agent-serve");
|
|
1954
|
+
const relay = new CursorEventRelay({
|
|
1955
|
+
baseUrl: auth.baseUrl,
|
|
1956
|
+
apiKey: auth.apiKey,
|
|
1957
|
+
subscriptions,
|
|
1958
|
+
stateDir: join(baseStateRoot, (_c = input.stateDirName) !== null && _c !== void 0 ? _c : "cursor-events"),
|
|
1959
|
+
logger,
|
|
1960
|
+
dispatch: (event) => __awaiter(this, void 0, void 0, function* () {
|
|
1961
|
+
if (event.provider === "origin") {
|
|
1962
|
+
const targets = input.collectOriginTargets().filter(target => {
|
|
1963
|
+
const cursorAccount = target.options.cursorAccount;
|
|
1964
|
+
if (input.cursorAccountOnly &&
|
|
1965
|
+
cursorAccount !== true &&
|
|
1966
|
+
typeof cursorAccount !== "object") {
|
|
1967
|
+
return false;
|
|
1968
|
+
}
|
|
1969
|
+
return typeof cursorAccount !== "object"
|
|
1970
|
+
? true
|
|
1971
|
+
: cursorAccount.repos.some(repo => repo.toLowerCase() === event.repo.toLowerCase());
|
|
1972
|
+
});
|
|
1973
|
+
const result = yield handleAgentServeTrigger(Object.assign({ type: "origin", bodyText: JSON.stringify(scmMetadataToOriginPayload(event)), targets }, (input.routeContinuation === undefined
|
|
1974
|
+
? {}
|
|
1975
|
+
: { routeContinuation: input.routeContinuation })));
|
|
1976
|
+
logCursorScmDispatch(logger, event, result);
|
|
1977
|
+
return;
|
|
1978
|
+
}
|
|
1979
|
+
if (event.provider !== "github")
|
|
1980
|
+
return;
|
|
1981
|
+
const targets = input.collectGitHubTargets().filter(target => {
|
|
1982
|
+
const cursorAccount = target.options.cursorAccount;
|
|
1983
|
+
if (input.cursorAccountOnly &&
|
|
1984
|
+
cursorAccount !== true &&
|
|
1985
|
+
typeof cursorAccount !== "object") {
|
|
1986
|
+
return false;
|
|
1987
|
+
}
|
|
1988
|
+
return typeof cursorAccount !== "object"
|
|
1989
|
+
? true
|
|
1990
|
+
: cursorAccount.repos.some(repo => repo.toLowerCase() === event.repo.toLowerCase());
|
|
1991
|
+
});
|
|
1992
|
+
const result = yield handleAgentServeTrigger(Object.assign({ type: "github", bodyText: JSON.stringify(scmEventToGitHubPayload(event)), eventName: event.eventName, deliveryId: event.deliveryId, targets }, (input.routeContinuation === undefined
|
|
1993
|
+
? {}
|
|
1994
|
+
: { routeContinuation: input.routeContinuation })));
|
|
1995
|
+
logCursorScmDispatch(logger, event, result);
|
|
1996
|
+
}),
|
|
1997
|
+
});
|
|
1998
|
+
if (input.start === false) {
|
|
1999
|
+
return relay;
|
|
2000
|
+
}
|
|
2001
|
+
relay.start();
|
|
2002
|
+
logger(`[agent-sdk] cursor-events: relaying ${subscriptions.length} subscription(s) from ${auth.baseUrl}`);
|
|
2003
|
+
return relay;
|
|
2004
|
+
}
|
|
2005
|
+
function logCursorScmDispatch(logger, event, result) {
|
|
2006
|
+
const outcomes = result.targets.map(target => formatCursorScmDispatchOutcome(target)).join(", ");
|
|
2007
|
+
const rejected = result.targets.filter(target => target.status >= 400);
|
|
2008
|
+
if (rejected.length > 0) {
|
|
2009
|
+
logger(`[agent-sdk] cursor-events: dropped ${formatCursorScmEventLog(event)} before hook: ${rejected.map(formatCursorScmDispatchOutcome).join(", ")}`);
|
|
2010
|
+
}
|
|
2011
|
+
logger(`[agent-sdk] cursor-events: dispatched ${formatCursorScmEventLog(event)}${outcomes === "" ? "" : ` → ${outcomes}`}`);
|
|
2012
|
+
}
|
|
2013
|
+
function collectCursorGithubTargets(mounts) {
|
|
2014
|
+
const targets = [];
|
|
2015
|
+
for (const mount of mounts) {
|
|
2016
|
+
for (const channel of mount.project.channels) {
|
|
2017
|
+
const accountRuntime = getGithubCursorAccountRuntime(channel.definition);
|
|
2018
|
+
if (accountRuntime !== undefined) {
|
|
2019
|
+
targets.push({
|
|
2020
|
+
slug: mount.slug,
|
|
2021
|
+
channelId: channel.id,
|
|
2022
|
+
accountRuntime,
|
|
2023
|
+
});
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
return targets;
|
|
2028
|
+
}
|
|
2029
|
+
function cursorGithubPermissionsForTarget(target) {
|
|
2030
|
+
var _a;
|
|
2031
|
+
var _b;
|
|
2032
|
+
const authored = typeof target.accountRuntime.options.cursorAccount === "object"
|
|
2033
|
+
? target.accountRuntime.options.cursorAccount.permissions
|
|
2034
|
+
: undefined;
|
|
2035
|
+
return ((_b = (_a = target.accountRuntime.scope) === null || _a === void 0 ? void 0 : _a.permissions) !== null && _b !== void 0 ? _b : cursorGithubPermissionsForChannel(target.accountRuntime.options, authored));
|
|
2036
|
+
}
|
|
2037
|
+
function resolveCursorGithubEventConfig(input) {
|
|
2038
|
+
var _a;
|
|
2039
|
+
var _b;
|
|
2040
|
+
if (input.targets.length === 0) {
|
|
2041
|
+
return {
|
|
2042
|
+
cursorEvents: input.configured,
|
|
2043
|
+
scope: undefined,
|
|
2044
|
+
permissions: "pr-write",
|
|
2045
|
+
};
|
|
2046
|
+
}
|
|
2047
|
+
const repos = [
|
|
2048
|
+
...((_b = (_a = input.configured) === null || _a === void 0 ? void 0 : _a.repos) !== null && _b !== void 0 ? _b : []),
|
|
2049
|
+
...input.targets.flatMap(target => { var _a; var _b; return [...((_b = (_a = target.accountRuntime.scope) === null || _a === void 0 ? void 0 : _a.repos) !== null && _b !== void 0 ? _b : [])]; }),
|
|
2050
|
+
];
|
|
2051
|
+
const permissions = resolveCursorGithubPermissions(input.targets.map(cursorGithubPermissionsForTarget));
|
|
2052
|
+
const scope = resolveCursorGithubCredentialScope(repos, permissions);
|
|
2053
|
+
if (scope === undefined) {
|
|
2054
|
+
return {
|
|
2055
|
+
cursorEvents: input.configured,
|
|
2056
|
+
scope: undefined,
|
|
2057
|
+
permissions,
|
|
2058
|
+
};
|
|
2059
|
+
}
|
|
2060
|
+
return {
|
|
2061
|
+
cursorEvents: Object.assign(Object.assign({}, input.configured), { repos: [...scope.repos] }),
|
|
2062
|
+
scope,
|
|
2063
|
+
permissions,
|
|
2064
|
+
};
|
|
2065
|
+
}
|
|
2066
|
+
function collectCursorOriginTargets(mounts) {
|
|
2067
|
+
const targets = [];
|
|
2068
|
+
for (const mount of mounts) {
|
|
2069
|
+
for (const channel of mount.project.channels) {
|
|
2070
|
+
const accountRuntime = getOriginCursorAccountRuntime(channel.definition);
|
|
2071
|
+
if (accountRuntime !== undefined) {
|
|
2072
|
+
targets.push({
|
|
2073
|
+
slug: mount.slug,
|
|
2074
|
+
channelId: channel.id,
|
|
2075
|
+
accountRuntime,
|
|
2076
|
+
});
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
return targets;
|
|
2081
|
+
}
|
|
2082
|
+
/**
|
|
2083
|
+
* Origin cursorAccount repos. `true` takes the host's explicit `--repo`
|
|
2084
|
+
* list (not GitHub channel-declared repos). `{ repos }` is self-contained.
|
|
2085
|
+
*/
|
|
2086
|
+
function resolveCursorOriginRepoScope(input) {
|
|
2087
|
+
if (input.targets.length === 0) {
|
|
2088
|
+
return undefined;
|
|
2089
|
+
}
|
|
2090
|
+
const wantsHostRepos = input.targets.some(target => target.accountRuntime.options.cursorAccount === true);
|
|
2091
|
+
const repos = [
|
|
2092
|
+
...(wantsHostRepos ? input.explicitRepos : []),
|
|
2093
|
+
...input.targets.flatMap(target => { var _a; var _b; return (_b = (_a = target.accountRuntime.scope) === null || _a === void 0 ? void 0 : _a.repos) !== null && _b !== void 0 ? _b : []; }),
|
|
2094
|
+
];
|
|
2095
|
+
if (repos.length === 0) {
|
|
2096
|
+
return undefined;
|
|
2097
|
+
}
|
|
2098
|
+
return parseCursorOriginRepoScope(repos);
|
|
2099
|
+
}
|
|
2100
|
+
function buildAgentIndexEntries(runtimes) {
|
|
2101
|
+
return runtimes.map(({ slug, project }) => {
|
|
2102
|
+
var _a;
|
|
2103
|
+
var _b;
|
|
2104
|
+
const hasSlack = project.channels.some(channel => { var _a; return ((_a = channel.definition.meta) === null || _a === void 0 ? void 0 : _a.kind) === "slack"; });
|
|
2105
|
+
return {
|
|
2106
|
+
slug,
|
|
2107
|
+
name: project.name,
|
|
2108
|
+
model: typeof project.agent.model === "string"
|
|
2109
|
+
? project.agent.model
|
|
2110
|
+
: ((_b = (_a = project.agent.model) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : ""),
|
|
2111
|
+
tools: project.agent.tools.length,
|
|
2112
|
+
channels: project.channels.length + 1,
|
|
2113
|
+
slack: hasSlack ? { kind: "socket" } : undefined,
|
|
2114
|
+
};
|
|
2115
|
+
});
|
|
2116
|
+
}
|
|
2117
|
+
/** Every mounted `deploymentsChannel`. Subscriptions are re-resolved live. */
|
|
2118
|
+
function collectCursorDeploymentTargets(runtimes) {
|
|
2119
|
+
const targets = [];
|
|
2120
|
+
for (const runtime of runtimes) {
|
|
2121
|
+
for (const channel of runtime.project.channels) {
|
|
2122
|
+
const options = getDeploymentsChannelOptions(channel.definition);
|
|
2123
|
+
if (options === undefined) {
|
|
2124
|
+
continue;
|
|
2125
|
+
}
|
|
2126
|
+
targets.push({
|
|
2127
|
+
runtime,
|
|
2128
|
+
channelId: channel.id,
|
|
2129
|
+
options,
|
|
2130
|
+
});
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
return targets;
|
|
2134
|
+
}
|
|
2135
|
+
function liveDeploymentSubscriptionUnion(targets) {
|
|
2136
|
+
return mergeResolvedSubscriptions(targets.map(target => resolveDeploymentSubscriptions(target.options)));
|
|
2137
|
+
}
|
|
2138
|
+
/**
|
|
2139
|
+
* Cursor deployment-events relay: automatic when a mounted agent authored
|
|
2140
|
+
* `deploymentsChannel({ ... })`. One relay per process reads
|
|
2141
|
+
* `/v0/deployment-events` for the union of every channel's deploy sources, and
|
|
2142
|
+
* each event is routed to the channels that asked for it — the same ownership
|
|
2143
|
+
* `startCursorEventRelay` has.
|
|
2144
|
+
*/
|
|
2145
|
+
function startCursorDeploymentRelay(input) {
|
|
2146
|
+
var _a;
|
|
2147
|
+
const { options, runtimes, accountKey, logger } = input;
|
|
2148
|
+
const targets = collectCursorDeploymentTargets(runtimes);
|
|
2149
|
+
if (targets.length === 0) {
|
|
2150
|
+
return undefined;
|
|
2151
|
+
}
|
|
2152
|
+
if (accountKey === undefined) {
|
|
2153
|
+
if (input.options.allowAnonymous === true) {
|
|
2154
|
+
logger("[agent-sdk] deployment-events: skipped while unsigned; long-poll relays need a key at start");
|
|
2155
|
+
return undefined;
|
|
2156
|
+
}
|
|
2157
|
+
throw new Error(`This project has channels subscribed to deployment events (deploymentsChannel({ ... })) but the host is not signed in to Cursor. ${SIGN_IN_HINT}`);
|
|
2158
|
+
}
|
|
2159
|
+
// Union is re-resolved on each heartbeat and fan-out so a channel that
|
|
2160
|
+
// fills `deploySourceUris` after start registers the new URIs. This wire
|
|
2161
|
+
// names every source, so a channel that omits the option registers nothing.
|
|
2162
|
+
const initial = liveDeploymentSubscriptionUnion(targets);
|
|
2163
|
+
if (initial.length === 0) {
|
|
2164
|
+
logger(`[agent-sdk] deployment-events: no deploy sources yet on ${targets
|
|
2165
|
+
.map(target => `${target.runtime.slug || target.runtime.project.name}/${target.channelId}`)
|
|
2166
|
+
.join(", ")}; the relay will register when a channel lists some`);
|
|
2167
|
+
}
|
|
2168
|
+
// Same host split as scm-events: `/v0/deployment-events/*` is on
|
|
2169
|
+
// api.cursor.com, not api2.
|
|
2170
|
+
const baseStateRoot = (_a = options.stateRoot) !== null && _a !== void 0 ? _a : join(targets[0].runtime.project.rootDir, ".agent-serve");
|
|
2171
|
+
const relay = new DeploymentEventRelay({
|
|
2172
|
+
baseUrl: cursorExternalApiUrl(),
|
|
2173
|
+
apiKey: accountKey.apiKey,
|
|
2174
|
+
stateDir: join(baseStateRoot, "deployment-events"),
|
|
2175
|
+
subscriptions: () => liveDeploymentSubscriptionUnion(targets),
|
|
2176
|
+
logger,
|
|
2177
|
+
dispatch: (event) => __awaiter(this, void 0, void 0, function* () {
|
|
2178
|
+
return fanOutDeploymentEvent({
|
|
2179
|
+
event,
|
|
2180
|
+
logger,
|
|
2181
|
+
targets: targets.map(target => ({
|
|
2182
|
+
name: `${target.runtime.slug || target.runtime.project.name}/${target.channelId}`,
|
|
2183
|
+
subscriptions: resolveDeploymentSubscriptions(target.options),
|
|
2184
|
+
deliver: delivered => dispatchDeploymentEvent({
|
|
2185
|
+
options: target.options,
|
|
2186
|
+
event: delivered,
|
|
2187
|
+
args: buildChannelHandlerArgs({
|
|
2188
|
+
runtime: target.runtime,
|
|
2189
|
+
channelId: target.channelId,
|
|
2190
|
+
}),
|
|
2191
|
+
}),
|
|
2192
|
+
})),
|
|
2193
|
+
});
|
|
2194
|
+
}),
|
|
2195
|
+
});
|
|
2196
|
+
relay.start();
|
|
2197
|
+
logger(`[agent-sdk] deployment-events: relaying ${initial.length} deploy-source subscription(s) to ${targets.length} channel(s)`);
|
|
2198
|
+
return relay;
|
|
2199
|
+
}
|
|
2200
|
+
function buildChannelHandlerArgs(input) {
|
|
2201
|
+
var _a, _b, _c;
|
|
2202
|
+
const { runtime, channelId } = input;
|
|
2203
|
+
const base = runtime.slug === "" ? "" : `/${runtime.slug}`;
|
|
2204
|
+
const auth = (_a = input.auth) !== null && _a !== void 0 ? _a : null;
|
|
2205
|
+
return {
|
|
2206
|
+
params: (_b = input.params) !== null && _b !== void 0 ? _b : {},
|
|
2207
|
+
requestIp: (_c = input.requestIp) !== null && _c !== void 0 ? _c : null,
|
|
2208
|
+
auth,
|
|
2209
|
+
host: runtime.engine.host,
|
|
2210
|
+
artifacts: runtime.engine.artifacts,
|
|
2211
|
+
send: (message, sendOptions = {}) => runtime.engine.send(channelId, message, Object.assign(Object.assign({}, sendOptions), { auth: sendOptions.auth !== undefined ? sendOptions.auth : auth, hostedSessionId: input.hostedSessionId })),
|
|
2212
|
+
getSession: sessionId => runtime.engine.getChannelSession(channelId, sessionId),
|
|
2213
|
+
receive: (target, inputReceive) => runtime.engine.receive(target, inputReceive),
|
|
2214
|
+
callTool: (toolName, toolInput, callOptions) => runtime.engine.callTool(toolName, toolInput, callOptions),
|
|
2215
|
+
waitUntil: promise => {
|
|
2216
|
+
runtime.engine.trackBackground(promise);
|
|
2217
|
+
},
|
|
2218
|
+
sessionUrls: (req, sessionId) => sessionUrlsForRequest(req, base, sessionId),
|
|
2219
|
+
hasContinuationSession: continuationToken => runtime.engine.hasContinuationSession(channelId, continuationToken),
|
|
2220
|
+
isContinuationBusy: continuationToken => runtime.engine.isContinuationBusy(channelId, continuationToken),
|
|
2221
|
+
getContinuationLastBotMessageTs: continuationToken => runtime.engine.getContinuationLastBotMessageTs(channelId, continuationToken),
|
|
2222
|
+
interruptContinuation: continuationToken => runtime.engine.interruptContinuation(channelId, continuationToken),
|
|
2223
|
+
};
|
|
2224
|
+
}
|
|
2225
|
+
function handleRequest(router, req, res, logger, browserOriginGuard) {
|
|
2226
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2227
|
+
var _a, _b, _c;
|
|
2228
|
+
let response;
|
|
2229
|
+
let hostedDeliveryRequest = false;
|
|
2230
|
+
const method = (_a = req.method) !== null && _a !== void 0 ? _a : "GET";
|
|
2231
|
+
try {
|
|
2232
|
+
const request = yield toFetchRequest(req);
|
|
2233
|
+
hostedDeliveryRequest = request.headers.get(HOSTED_DELIVERY_HEADER) === "1";
|
|
2234
|
+
const requestErrorResponse = (status, error, message) => hostedDeliveryRequest
|
|
2235
|
+
? hostedGuestErrorResponse({
|
|
2236
|
+
status,
|
|
2237
|
+
error,
|
|
2238
|
+
retry: HOSTED_GUEST_RETRY_TERMINAL,
|
|
2239
|
+
message,
|
|
2240
|
+
})
|
|
2241
|
+
: errorResponse(status, error, message);
|
|
2242
|
+
const url = new URL(request.url);
|
|
2243
|
+
const match = router.match(request.method, url.pathname);
|
|
2244
|
+
if (!isTrustedBrowserMutation(request, browserOriginGuard)) {
|
|
2245
|
+
response = requestErrorResponse(403, "forbidden_origin", "Cross-origin browser mutations are not allowed.");
|
|
2246
|
+
}
|
|
2247
|
+
else if (match === undefined) {
|
|
2248
|
+
response = router.hasPath(url.pathname)
|
|
2249
|
+
? requestErrorResponse(405, "method_not_allowed", `${request.method} is not supported on ${url.pathname}.`)
|
|
2250
|
+
: requestErrorResponse(404, "not_found", `No route for ${request.method} ${url.pathname}.`);
|
|
2251
|
+
}
|
|
2252
|
+
else {
|
|
2253
|
+
const requestIp = (_b = req.socket.remoteAddress) !== null && _b !== void 0 ? _b : null;
|
|
2254
|
+
let auth = null;
|
|
2255
|
+
let unauthorized = false;
|
|
2256
|
+
if (match.route.auth !== "none") {
|
|
2257
|
+
auth = yield resolveAuth(match.route.auth, request, requestIp);
|
|
2258
|
+
unauthorized = auth === null;
|
|
2259
|
+
}
|
|
2260
|
+
response = unauthorized
|
|
2261
|
+
? requestErrorResponse(401, "unauthorized", "No auth policy admitted this request. In production, configure channel auth (e.g. bearerAuth) — the default localDevStrict() policy only admits loopback callers with a loopback Host.")
|
|
2262
|
+
: yield match.route.handler(request, {
|
|
2263
|
+
params: match.params,
|
|
2264
|
+
requestIp,
|
|
2265
|
+
auth,
|
|
2266
|
+
});
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
catch (error) {
|
|
2270
|
+
const mapped = mapThrownRequestError(error);
|
|
2271
|
+
if (mapped !== undefined) {
|
|
2272
|
+
response = hostedDeliveryRequest
|
|
2273
|
+
? hostedGuestErrorResponse({
|
|
2274
|
+
status: mapped.status,
|
|
2275
|
+
error: mapped.code,
|
|
2276
|
+
retry: mapped.retry,
|
|
2277
|
+
message: mapped.message,
|
|
2278
|
+
})
|
|
2279
|
+
: errorResponse(mapped.status, mapped.code, mapped.message);
|
|
2280
|
+
}
|
|
2281
|
+
else {
|
|
2282
|
+
logger(`[agent-sdk] request failed: ${error instanceof Error ? ((_c = error.stack) !== null && _c !== void 0 ? _c : error.message) : String(error)}`);
|
|
2283
|
+
const snippet = hostedErrorStackSnippet(error);
|
|
2284
|
+
const message = hostedDeliveryRequest
|
|
2285
|
+
? hostedErrorMessageOnly(error)
|
|
2286
|
+
: snippet.length > 0
|
|
2287
|
+
? `Internal server error: ${snippet}`
|
|
2288
|
+
: "Internal server error.";
|
|
2289
|
+
response = hostedDeliveryRequest
|
|
2290
|
+
? hostedGuestErrorResponse({
|
|
2291
|
+
status: 500,
|
|
2292
|
+
error: "internal_error",
|
|
2293
|
+
retry: HOSTED_GUEST_RETRY_TERMINAL,
|
|
2294
|
+
message,
|
|
2295
|
+
})
|
|
2296
|
+
: errorResponse(500, "internal_error", message);
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
try {
|
|
2300
|
+
yield writeFetchResponse(response, res, method);
|
|
2301
|
+
}
|
|
2302
|
+
catch (error) {
|
|
2303
|
+
logger(`[agent-sdk] response write failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
2304
|
+
res.destroy();
|
|
2305
|
+
}
|
|
2306
|
+
});
|
|
2307
|
+
}
|
|
2308
|
+
function resolveAuth(policies, request, requestIp) {
|
|
2309
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2310
|
+
for (const policy of policies) {
|
|
2311
|
+
const result = yield policy(request, { requestIp });
|
|
2312
|
+
if (result !== null) {
|
|
2313
|
+
return result;
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
return null;
|
|
2317
|
+
});
|
|
2318
|
+
}
|
|
2319
|
+
function toFetchRequest(req) {
|
|
2320
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2321
|
+
var _a, _b;
|
|
2322
|
+
const method = (_a = req.method) !== null && _a !== void 0 ? _a : "GET";
|
|
2323
|
+
const hostHeader = incomingRequestHost(req.headers);
|
|
2324
|
+
const url = new URL((_b = req.url) !== null && _b !== void 0 ? _b : "/", `http://${hostHeader}`);
|
|
2325
|
+
// Drop HTTP/2 pseudo-headers (`:method`, …) — Fetch `Headers` rejects them.
|
|
2326
|
+
const headers = incomingHeadersToFetch(req.headers);
|
|
2327
|
+
if (method === "GET" || method === "HEAD") {
|
|
2328
|
+
return new Request(url, { method, headers });
|
|
2329
|
+
}
|
|
2330
|
+
const body = yield readBody(req);
|
|
2331
|
+
// Buffer is a Uint8Array at runtime; TS's BodyInit wants ArrayBuffer-backed
|
|
2332
|
+
// typed arrays, so re-view without copying.
|
|
2333
|
+
return new Request(url, {
|
|
2334
|
+
method,
|
|
2335
|
+
headers,
|
|
2336
|
+
body: new Uint8Array(body.buffer, body.byteOffset, body.byteLength),
|
|
2337
|
+
});
|
|
2338
|
+
});
|
|
2339
|
+
}
|
|
2340
|
+
function readBody(req) {
|
|
2341
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2342
|
+
var _a, req_1, req_1_1;
|
|
2343
|
+
var _b, e_1, _c, _d;
|
|
2344
|
+
const chunks = [];
|
|
2345
|
+
let total = 0;
|
|
2346
|
+
try {
|
|
2347
|
+
for (_a = true, req_1 = __asyncValues(req); req_1_1 = yield req_1.next(), _b = req_1_1.done, !_b; _a = true) {
|
|
2348
|
+
_d = req_1_1.value;
|
|
2349
|
+
_a = false;
|
|
2350
|
+
const chunk = _d;
|
|
2351
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
2352
|
+
total += buffer.length;
|
|
2353
|
+
if (total > MAX_BODY_BYTES) {
|
|
2354
|
+
throw new Error("Request body too large");
|
|
2355
|
+
}
|
|
2356
|
+
chunks.push(buffer);
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2360
|
+
finally {
|
|
2361
|
+
try {
|
|
2362
|
+
if (!_a && !_b && (_c = req_1.return)) yield _c.call(req_1);
|
|
2363
|
+
}
|
|
2364
|
+
finally { if (e_1) throw e_1.error; }
|
|
2365
|
+
}
|
|
2366
|
+
return Buffer.concat(chunks);
|
|
2367
|
+
});
|
|
2368
|
+
}
|
|
2369
|
+
function writeFetchResponse(response_1, res_1) {
|
|
2370
|
+
return __awaiter(this, arguments, void 0, function* (response, res, method = "GET") {
|
|
2371
|
+
const headers = {};
|
|
2372
|
+
response.headers.forEach((value, key) => {
|
|
2373
|
+
headers[key] = value;
|
|
2374
|
+
});
|
|
2375
|
+
res.writeHead(response.status, headers);
|
|
2376
|
+
// HEAD responses must not include a body (RFC 9110 §9.3.2). Cancel any
|
|
2377
|
+
// handler-produced stream so long-lived GET handlers (e.g. session SSE)
|
|
2378
|
+
// still unsubscribe when served via the HEAD→GET fallback.
|
|
2379
|
+
if (method === "HEAD" || response.body === null) {
|
|
2380
|
+
if (response.body !== null) {
|
|
2381
|
+
void response.body.cancel().catch(() => { });
|
|
2382
|
+
}
|
|
2383
|
+
res.end();
|
|
2384
|
+
return;
|
|
2385
|
+
}
|
|
2386
|
+
const reader = response.body.getReader();
|
|
2387
|
+
let clientGone = false;
|
|
2388
|
+
const closed = new Promise(resolve => {
|
|
2389
|
+
res.once("close", () => {
|
|
2390
|
+
if (!res.writableFinished) {
|
|
2391
|
+
clientGone = true;
|
|
2392
|
+
void reader.cancel().catch(() => { });
|
|
2393
|
+
}
|
|
2394
|
+
resolve();
|
|
2395
|
+
});
|
|
2396
|
+
});
|
|
2397
|
+
try {
|
|
2398
|
+
while (!clientGone) {
|
|
2399
|
+
const { done, value } = yield reader.read();
|
|
2400
|
+
if (done) {
|
|
2401
|
+
break;
|
|
2402
|
+
}
|
|
2403
|
+
if (value !== undefined && value.length > 0) {
|
|
2404
|
+
if (!res.write(value) && !clientGone) {
|
|
2405
|
+
// Race against close so a vanished client can't wedge the loop
|
|
2406
|
+
// waiting for a drain that will never come.
|
|
2407
|
+
yield Promise.race([once(res, "drain"), closed]);
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
catch (_a) {
|
|
2413
|
+
void reader.cancel().catch(() => { });
|
|
2414
|
+
}
|
|
2415
|
+
res.end();
|
|
2416
|
+
});
|
|
2417
|
+
}
|
|
2418
|
+
/**
|
|
2419
|
+
* Dev reminder routes may only inspect/fire reminders whose bound session
|
|
2420
|
+
* belongs to the caller (same principal), matching session read routes.
|
|
2421
|
+
* Loopback `--dev` (and `--allow-anonymous`) can relax ownership like
|
|
2422
|
+
* `GET /v1/sessions`.
|
|
2423
|
+
*/
|
|
2424
|
+
function asStringArray(value) {
|
|
2425
|
+
if (!Array.isArray(value)) {
|
|
2426
|
+
return undefined;
|
|
2427
|
+
}
|
|
2428
|
+
const out = [];
|
|
2429
|
+
for (const item of value) {
|
|
2430
|
+
if (typeof item === "string" && item.trim() !== "") {
|
|
2431
|
+
out.push(item);
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
return out.length === 0 ? undefined : out;
|
|
2435
|
+
}
|
|
2436
|
+
function asPositiveInt(value) {
|
|
2437
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
2438
|
+
return undefined;
|
|
2439
|
+
}
|
|
2440
|
+
const n = Math.floor(value);
|
|
2441
|
+
return n > 0 ? n : undefined;
|
|
2442
|
+
}
|
|
2443
|
+
function assertReminderReadable(input) {
|
|
2444
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2445
|
+
const existing = yield input.engine.sessions.findByContinuation(input.reminder.channelId, input.reminder.continuationToken);
|
|
2446
|
+
if (existing === undefined) {
|
|
2447
|
+
// No live session — still gate on relax/loopback so a shared-dev caller
|
|
2448
|
+
// cannot enumerate orphan reminder metadata across principals.
|
|
2449
|
+
const relaxOwnership = input.relax === true &&
|
|
2450
|
+
(input.beyondLoopback === true ||
|
|
2451
|
+
(typeof input.requestIp === "string" && isLoopbackAddress(input.requestIp)));
|
|
2452
|
+
if (relaxOwnership) {
|
|
2453
|
+
return undefined;
|
|
2454
|
+
}
|
|
2455
|
+
// Without a session principal to compare, deny non-relaxed callers.
|
|
2456
|
+
return errorResponse(403, "forbidden", "This reminder is bound to a session that is not visible to the caller.");
|
|
2457
|
+
}
|
|
2458
|
+
return requireSessionOwner(existing, input.auth, {
|
|
2459
|
+
relax: input.relax,
|
|
2460
|
+
beyondLoopback: input.beyondLoopback,
|
|
2461
|
+
requestIp: input.requestIp,
|
|
2462
|
+
});
|
|
2463
|
+
});
|
|
2464
|
+
}
|