@cursor/july 0.1.95 → 0.1.97
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 +3 -4
- package/README.md +3 -2
- package/dist/bin/agent-serve.js +14 -3
- package/dist/channels/deployments/types.d.ts +1 -1
- package/dist/channels/deployments/types.d.ts.map +1 -1
- package/dist/channels/deployments/types.js +1 -0
- package/dist/channels/origin/api.d.ts +72 -15
- package/dist/channels/origin/api.d.ts.map +1 -1
- package/dist/channels/origin/api.js +185 -28
- package/dist/channels/origin/binding.d.ts +13 -2
- package/dist/channels/origin/binding.d.ts.map +1 -1
- package/dist/channels/origin/binding.js +41 -25
- package/dist/channels/origin/checks.d.ts +6 -6
- package/dist/channels/origin/checks.js +6 -6
- package/dist/channels/origin/cursor-account.d.ts +5 -3
- package/dist/channels/origin/cursor-account.d.ts.map +1 -1
- package/dist/channels/origin/cursor-account.js +5 -3
- package/dist/channels/origin/index.d.ts +1 -0
- package/dist/channels/origin/index.d.ts.map +1 -1
- package/dist/channels/origin/index.js +1 -0
- package/dist/channels/origin/origin-channel.d.ts.map +1 -1
- package/dist/channels/origin/origin-channel.js +3 -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 +67 -0
- package/dist/channels/origin/types.d.ts +11 -0
- package/dist/channels/origin/types.d.ts.map +1 -1
- package/dist/channels/slack/api.d.ts +9 -0
- package/dist/channels/slack/api.d.ts.map +1 -1
- package/dist/channels/slack/api.js +36 -5
- package/dist/channels/slack/approvals.d.ts +16 -0
- package/dist/channels/slack/approvals.d.ts.map +1 -1
- package/dist/channels/slack/approvals.js +86 -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 +234 -0
- package/dist/channels/slack/defaults.d.ts.map +1 -1
- package/dist/channels/slack/defaults.js +110 -81
- package/dist/channels/slack/dispatch.d.ts +7 -1
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +47 -23
- package/dist/channels/slack/inbound.d.ts +8 -0
- package/dist/channels/slack/inbound.d.ts.map +1 -1
- package/dist/channels/slack/inbound.js +32 -0
- package/dist/channels/slack/init.d.ts +3 -2
- package/dist/channels/slack/init.d.ts.map +1 -1
- package/dist/channels/slack/init.js +5 -5
- package/dist/channels/slack/interactive.d.ts +2 -1
- package/dist/channels/slack/interactive.d.ts.map +1 -1
- package/dist/channels/slack/interactive.js +15 -4
- package/dist/channels/slack/live-delivery.d.ts +26 -29
- package/dist/channels/slack/live-delivery.d.ts.map +1 -1
- package/dist/channels/slack/live-delivery.js +172 -73
- package/dist/channels/slack/manifest.d.ts +1 -1
- package/dist/channels/slack/manifest.d.ts.map +1 -1
- package/dist/channels/slack/manifest.js +6 -2
- package/dist/channels/slack/nudge-carrier.d.ts +2 -0
- package/dist/channels/slack/nudge-carrier.d.ts.map +1 -1
- package/dist/channels/slack/nudge-carrier.js +48 -1
- package/dist/channels/slack/setup.d.ts +1 -1
- package/dist/channels/slack/setup.d.ts.map +1 -1
- package/dist/channels/slack/setup.js +10 -6
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +3 -2
- package/dist/channels/slack/tool-approval-events.d.ts.map +1 -1
- package/dist/channels/slack/tool-approval-events.js +91 -1
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +4 -4
- package/dist/docs/assets/{app.BBj0klBO.js → app.B3rWNYE1.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.BU9nHdnQ.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.CUEXpL78.js → VPLocalSearchBox.C1lhqJJR.js} +1 -1
- package/dist/docs/assets/chunks/{theme.DabmQnia.js → theme.B40_SXuv.js} +2 -2
- package/dist/docs/assets/{deployment.md.D9msOFOW.js → deployment.md.MFPKqsqI.js} +2 -2
- package/dist/docs/assets/{guides_mcp-oauth.md.DPYmBCbV.js → guides_mcp-oauth.md.CN-6YmTJ.js} +4 -4
- package/dist/docs/assets/{guides_mcp-oauth.md.DPYmBCbV.lean.js → guides_mcp-oauth.md.CN-6YmTJ.lean.js} +1 -1
- package/dist/docs/assets/guides_slack.md.VDXQV3ja.js +22 -0
- package/dist/docs/assets/guides_slack.md.VDXQV3ja.lean.js +1 -0
- package/dist/docs/assets/index.md.CVeRUOeZ.js +5 -0
- package/dist/docs/assets/{index.md.BoHaMdeZ.lean.js → index.md.CVeRUOeZ.lean.js} +1 -1
- package/dist/docs/assets/{reference_agent-config.md.Cp_x38Nl.js → reference_agent-config.md.BHeYMgme.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.BsMOxDvh.js → reference_cli.md.RyZf5OTE.js} +10 -6
- package/dist/docs/assets/{reference_cli.md.BsMOxDvh.lean.js → reference_cli.md.RyZf5OTE.lean.js} +1 -1
- package/dist/docs/assets/{reference_connections.md.BH8Oc0D0.js → reference_connections.md.DxldvyIB.js} +4 -3
- package/dist/docs/assets/{reference_http-api.md.D89k1mdm.js → reference_http-api.md.5zOAbV86.js} +1 -1
- package/dist/docs/assets/reference_sessions.md.NxFP_CAC.js +1 -0
- package/dist/docs/assets/{reference_tools.md.BHeXn2id.js → reference_tools.md.B84gw9Ii.js} +1 -1
- package/dist/docs/assets/templates_agents-md.md.CXSMZljE.js +2 -0
- package/dist/docs/assets/templates_agents-md.md.CXSMZljE.lean.js +1 -0
- package/dist/docs/assets/templates_code-wiki.md.CDYZIBFN.js +2 -0
- package/dist/docs/assets/templates_code-wiki.md.CDYZIBFN.lean.js +1 -0
- package/dist/docs/assets/troubleshooting.md.DCiPBhYs.js +1 -0
- package/dist/docs/building-with-agents.html +4 -4
- package/dist/docs/concepts.html +4 -4
- package/dist/docs/deployment.html +7 -7
- package/dist/docs/deployment.md +5 -4
- package/dist/docs/evals.html +4 -4
- package/dist/docs/guides/agent-to-agent.html +4 -4
- package/dist/docs/guides/cloud-runtime.html +4 -4
- package/dist/docs/guides/convert-automation.html +4 -4
- package/dist/docs/guides/github.html +4 -4
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/mcp-oauth.html +8 -8
- package/dist/docs/guides/mcp-oauth.md +26 -8
- package/dist/docs/guides/opentelemetry.html +4 -4
- package/dist/docs/guides/slack.html +17 -33
- package/dist/docs/guides/slack.md +92 -201
- package/dist/docs/guides/webhooks.html +4 -4
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +4 -4
- package/dist/docs/index.html +6 -6
- package/dist/docs/index.md +7 -3
- package/dist/docs/llms-full.txt +398 -653
- package/dist/docs/llms.txt +3 -2
- package/dist/docs/quickstart.html +4 -4
- package/dist/docs/reference/agent-config.html +6 -6
- package/dist/docs/reference/agent-config.md +2 -2
- package/dist/docs/reference/artifacts.html +4 -4
- package/dist/docs/reference/channels.html +4 -4
- package/dist/docs/reference/cli.html +14 -10
- package/dist/docs/reference/cli.md +39 -16
- package/dist/docs/reference/connections.html +9 -8
- package/dist/docs/reference/connections.md +6 -3
- package/dist/docs/reference/hooks.html +4 -4
- package/dist/docs/reference/http-api.html +6 -6
- package/dist/docs/reference/http-api.md +2 -1
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +4 -4
- package/dist/docs/reference/project-layout.html +4 -4
- package/dist/docs/reference/prompt.html +4 -4
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +5 -5
- package/dist/docs/reference/sessions.md +4 -2
- package/dist/docs/reference/skills.html +4 -4
- package/dist/docs/reference/subagents.html +4 -4
- package/dist/docs/reference/tools.html +6 -6
- package/dist/docs/reference/tools.md +9 -2
- package/dist/docs/scaffolding-agents.html +4 -4
- package/dist/docs/storage.html +4 -4
- package/dist/docs/templates/agentic-owners.html +4 -4
- package/dist/docs/templates/agents-md.html +28 -0
- package/dist/docs/templates/agents-md.md +105 -0
- package/dist/docs/templates/code-wiki.html +28 -0
- package/dist/docs/templates/code-wiki.md +91 -0
- package/dist/docs/templates/demo.html +5 -5
- package/dist/docs/templates/pr-autofixer.html +4 -4
- package/dist/docs/templates/security-help.html +4 -4
- package/dist/docs/templates/security-reviewer.html +5 -5
- package/dist/docs/templates/triage.html +4 -4
- package/dist/docs/troubleshooting.html +5 -5
- package/dist/docs/troubleshooting.md +2 -2
- package/dist/evals/run-facts.d.ts.map +1 -1
- package/dist/evals/run-facts.js +27 -0
- package/dist/files-backends/cursor-hosted.d.ts +26 -4
- package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/files-backends/cursor-hosted.js +32 -4
- package/dist/internal/advertise-tools.d.ts +2 -0
- package/dist/internal/advertise-tools.d.ts.map +1 -1
- package/dist/internal/advertise-tools.js +30 -10
- package/dist/internal/approval-gate.d.ts +12 -13
- package/dist/internal/approval-gate.d.ts.map +1 -1
- package/dist/internal/approval-gate.js +16 -21
- 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/chat-client.js +10 -0
- package/dist/internal/cli-deploy.d.ts +5 -0
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +57 -18
- package/dist/internal/cli-mcp-oauth.js +8 -18
- package/dist/internal/cli-slack-manual.d.ts +24 -2
- package/dist/internal/cli-slack-manual.d.ts.map +1 -1
- package/dist/internal/cli-slack-manual.js +251 -20
- package/dist/internal/cli-slack.d.ts +9 -2
- package/dist/internal/cli-slack.d.ts.map +1 -1
- package/dist/internal/cli-slack.js +29 -82
- package/dist/internal/conversation-mirror.d.ts +11 -8
- package/dist/internal/conversation-mirror.d.ts.map +1 -1
- package/dist/internal/conversation-mirror.js +116 -55
- package/dist/internal/cursor/account-mcp.d.ts +1 -0
- package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
- package/dist/internal/cursor/account-mcp.js +17 -0
- package/dist/internal/cursor/backend-client.d.ts.map +1 -1
- package/dist/internal/cursor/backend-client.js +22 -48
- 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 +99 -0
- package/dist/internal/cursor-agent-template.d.ts +1 -1
- package/dist/internal/cursor-agent-template.d.ts.map +1 -1
- package/dist/internal/cursor-agent-template.js +2 -0
- package/dist/internal/deploy-client.d.ts +17 -0
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +31 -10
- 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/framework-file-storage.d.ts +61 -0
- package/dist/internal/framework-file-storage.d.ts.map +1 -0
- package/dist/internal/framework-file-storage.js +210 -0
- package/dist/internal/framework-storage-selection.d.ts +11 -5
- package/dist/internal/framework-storage-selection.d.ts.map +1 -1
- package/dist/internal/framework-storage-selection.js +38 -11
- package/dist/internal/hosted-delivery-protocol.d.ts +7 -0
- package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
- package/dist/internal/hosted-delivery-protocol.js +7 -0
- package/dist/internal/hosted-delivery.d.ts +13 -0
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +64 -19
- package/dist/internal/hosted-execution-diag.d.ts +48 -0
- package/dist/internal/hosted-execution-diag.d.ts.map +1 -0
- package/dist/internal/hosted-execution-diag.js +150 -0
- package/dist/internal/http-channel.d.ts.map +1 -1
- package/dist/internal/http-channel.js +81 -1
- package/dist/internal/init-project.d.ts.map +1 -1
- package/dist/internal/init-project.js +4 -0
- package/dist/internal/install-cursor-skills.d.ts.map +1 -1
- package/dist/internal/install-cursor-skills.js +1 -3
- package/dist/internal/logs-client.d.ts +5 -0
- package/dist/internal/logs-client.d.ts.map +1 -1
- package/dist/internal/logs-client.js +5 -0
- package/dist/internal/managed-delivery.d.ts +80 -0
- package/dist/internal/managed-delivery.d.ts.map +1 -0
- package/dist/internal/managed-delivery.js +86 -0
- package/dist/internal/mcp-endpoint.js +2 -3
- package/dist/internal/mcp-host.d.ts +10 -0
- package/dist/internal/mcp-host.d.ts.map +1 -1
- package/dist/internal/mcp-host.js +57 -8
- 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 +92 -0
- package/dist/internal/mcp-oauth.d.ts +1 -0
- package/dist/internal/mcp-oauth.d.ts.map +1 -1
- package/dist/internal/mcp-oauth.js +10 -2
- package/dist/internal/otel/collector.d.ts.map +1 -1
- package/dist/internal/otel/collector.js +22 -9
- package/dist/internal/runtime-dispatch-runner.d.ts +5 -1
- package/dist/internal/runtime-dispatch-runner.d.ts.map +1 -1
- package/dist/internal/runtime-dispatch-runner.js +7 -0
- package/dist/internal/sdk-runner.d.ts +11 -0
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +39 -8
- package/dist/internal/server.d.ts +3 -0
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +49 -21
- package/dist/internal/session-engine.d.ts +101 -3
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +577 -46
- package/dist/internal/sessions-client.d.ts +9 -7
- package/dist/internal/sessions-client.d.ts.map +1 -1
- package/dist/internal/sessions-client.js +3 -1
- 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 +7 -0
- package/dist/internal/storage-coordinator.d.ts.map +1 -1
- package/dist/internal/storage-coordinator.js +28 -5
- package/dist/internal/storage-roles.d.ts +5 -0
- package/dist/internal/storage-roles.d.ts.map +1 -1
- package/dist/internal/stream-progress.d.ts.map +1 -1
- package/dist/internal/stream-progress.js +10 -0
- package/dist/internal/tool-policy.d.ts +9 -1
- package/dist/internal/tool-policy.d.ts.map +1 -1
- package/dist/internal/tool-policy.js +13 -0
- package/dist/internal/trajectory.d.ts.map +1 -1
- package/dist/internal/trajectory.js +10 -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/playground/assets/{index-CZA1uEWA.js → index-DrkI6y5O.js} +51 -51
- package/dist/playground/assets/index-DzNGwm7q.css +1 -0
- package/dist/playground/index.html +2 -2
- package/dist/storage-backends/cursor-hosted.d.ts +9 -6
- package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/storage-backends/cursor-hosted.js +16 -3
- package/dist/storage.d.ts +8 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/types.d.ts +65 -8
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +7 -3
- package/docs/deployment.md +5 -4
- package/docs/guides/mcp-oauth.md +26 -8
- package/docs/guides/slack.md +93 -202
- package/docs/reference/agent-config.md +2 -2
- package/docs/reference/cli.md +39 -16
- package/docs/reference/connections.md +6 -3
- package/docs/reference/http-api.md +2 -1
- package/docs/reference/sessions.md +4 -2
- package/docs/reference/tools.md +9 -2
- package/docs/templates/agents-md.md +110 -0
- package/docs/templates/code-wiki.md +96 -0
- package/docs/troubleshooting.md +2 -2
- package/package.json +2 -2
- package/skills/ab/SKILL.md +13 -97
- package/skills/create-agent/SKILL.md +124 -223
- package/skills/debug/SKILL.md +34 -68
- package/skills/evals/SKILL.md +55 -180
- package/skills/framework-map/SKILL.md +83 -145
- package/skills/github/SKILL.md +53 -111
- package/skills/hillclimb/SKILL.md +40 -163
- package/skills/mcp-auth/SKILL.md +51 -107
- package/skills/otel/SKILL.md +22 -68
- package/skills/setup-slack/SKILL.md +91 -212
- package/src/bin/agent-serve.ts +13 -1
- package/src/channels/deployments/types.ts +1 -0
- package/src/channels/origin/api.ts +264 -33
- package/src/channels/origin/binding.ts +57 -28
- package/src/channels/origin/checks.ts +6 -6
- package/src/channels/origin/cursor-account.ts +5 -3
- package/src/channels/origin/index.ts +1 -0
- package/src/channels/origin/origin-channel.ts +4 -0
- package/src/channels/origin/reactions.ts +82 -0
- package/src/channels/origin/types.ts +11 -0
- package/src/channels/slack/api.ts +41 -5
- package/src/channels/slack/approvals.ts +105 -0
- package/src/channels/slack/cli-project.ts +267 -0
- package/src/channels/slack/defaults.ts +122 -93
- package/src/channels/slack/dispatch.ts +56 -22
- package/src/channels/slack/inbound.ts +43 -0
- package/src/channels/slack/init.ts +10 -5
- package/src/channels/slack/interactive.ts +35 -9
- package/src/channels/slack/live-delivery.ts +235 -114
- package/src/channels/slack/manifest.ts +6 -2
- package/src/channels/slack/nudge-carrier.ts +48 -1
- package/src/channels/slack/setup.ts +10 -6
- package/src/channels/slack/slack-channel.ts +3 -0
- package/src/channels/slack/tool-approval-events.ts +93 -0
- package/src/evals/run-facts.ts +32 -0
- package/src/files-backends/cursor-hosted.ts +40 -7
- package/src/internal/advertise-tools.ts +49 -12
- package/src/internal/approval-gate.ts +20 -29
- package/src/internal/bounded.ts +28 -0
- package/src/internal/chat-client.ts +19 -0
- package/src/internal/cli-deploy.ts +91 -9
- package/src/internal/cli-mcp-oauth.ts +7 -21
- package/src/internal/cli-slack-manual.ts +350 -18
- package/src/internal/cli-slack.ts +40 -84
- package/src/internal/conversation-mirror.ts +145 -69
- package/src/internal/cursor/account-mcp.ts +21 -0
- package/src/internal/cursor/backend-client.ts +34 -58
- package/src/internal/cursor/session-token.ts +115 -0
- package/src/internal/cursor-agent-template.ts +2 -0
- package/src/internal/deploy-client.ts +43 -0
- package/src/internal/env-file.ts +84 -0
- package/src/internal/framework-file-storage.ts +228 -0
- package/src/internal/framework-storage-selection.ts +51 -11
- package/src/internal/hosted-delivery-protocol.ts +7 -0
- package/src/internal/hosted-delivery.ts +107 -24
- package/src/internal/hosted-execution-diag.ts +207 -0
- package/src/internal/http-channel.ts +99 -0
- package/src/internal/init-project.ts +4 -0
- package/src/internal/install-cursor-skills.ts +1 -4
- package/src/internal/logs-client.ts +5 -0
- package/src/internal/managed-delivery.ts +125 -0
- package/src/internal/mcp-endpoint.ts +13 -4
- package/src/internal/mcp-host.ts +77 -11
- package/src/internal/mcp-oauth-on-demand.ts +352 -0
- package/src/internal/mcp-oauth-persist.ts +127 -0
- package/src/internal/mcp-oauth.ts +17 -1
- package/src/internal/otel/collector.ts +30 -0
- package/src/internal/runtime-dispatch-runner.ts +10 -0
- package/src/internal/sdk-runner.ts +56 -8
- package/src/internal/server.ts +61 -9
- package/src/internal/session-engine.ts +723 -60
- package/src/internal/sessions-client.ts +17 -8
- package/src/internal/steering.ts +17 -0
- package/src/internal/storage-coordinator.ts +38 -8
- package/src/internal/storage-roles.ts +7 -0
- package/src/internal/stream-progress.ts +19 -0
- package/src/internal/tool-policy.ts +18 -0
- package/src/internal/trajectory.ts +10 -0
- package/src/internal/turn-outbox.ts +85 -0
- package/src/storage-backends/cursor-hosted.ts +22 -8
- package/src/storage.ts +12 -0
- package/src/types.ts +70 -9
- package/templates/agents-md/README.md +39 -0
- package/templates/agents-md/agent/agent.ts +8 -0
- package/templates/agents-md/agent/channels/github.ts +10 -0
- package/templates/agents-md/agent/channels/queue.ts +28 -0
- package/templates/agents-md/agent/channels/slack.ts +9 -0
- package/templates/agents-md/agent/instructions.md +39 -0
- package/templates/agents-md/agent/lib/collect.ts +439 -0
- package/templates/agents-md/agent/lib/config.ts +8 -0
- package/templates/agents-md/agent/lib/paths.ts +51 -0
- package/templates/agents-md/agent/schedules/weekly.ts +17 -0
- package/templates/agents-md/agent/tools/apply_agents.ts +226 -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 +34 -0
- package/templates/code-wiki/agent/agent.ts +8 -0
- package/templates/code-wiki/agent/channels/github.ts +144 -0
- package/templates/code-wiki/agent/instructions.md +39 -0
- package/templates/code-wiki/agent/lib/repos.ts +5 -0
- package/templates/code-wiki/agent/lib/wiki.ts +22 -0
- package/templates/code-wiki/agent/tools/apply_wiki.ts +219 -0
- package/templates/code-wiki/evals/evals.config.ts +5 -0
- package/templates/code-wiki/evals/wiki.eval.ts +132 -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/dist/docs/assets/chunks/@localSearchIndexroot.oqPawjiD.js +0 -1
- package/dist/docs/assets/guides_slack.md.C32HsdKk.js +0 -38
- package/dist/docs/assets/guides_slack.md.C32HsdKk.lean.js +0 -1
- package/dist/docs/assets/index.md.BoHaMdeZ.js +0 -5
- package/dist/docs/assets/reference_sessions.md.D0mIh4KK.js +0 -1
- package/dist/docs/assets/troubleshooting.md.Ctv3T8C2.js +0 -1
- package/dist/docs/design/agsh.md +0 -406
- package/dist/internal/deployment-scm-event-stream.d.ts +0 -116
- package/dist/internal/deployment-scm-event-stream.d.ts.map +0 -1
- package/dist/internal/deployment-scm-event-stream.js +0 -474
- package/dist/playground/assets/index-CF7hUDnQ.css +0 -1
- package/docs/design/agsh.md +0 -406
- package/src/internal/deployment-scm-event-stream.ts +0 -593
- /package/dist/docs/assets/{deployment.md.D9msOFOW.lean.js → deployment.md.MFPKqsqI.lean.js} +0 -0
- /package/dist/docs/assets/{reference_agent-config.md.Cp_x38Nl.lean.js → reference_agent-config.md.BHeYMgme.lean.js} +0 -0
- /package/dist/docs/assets/{reference_connections.md.BH8Oc0D0.lean.js → reference_connections.md.DxldvyIB.lean.js} +0 -0
- /package/dist/docs/assets/{reference_http-api.md.D89k1mdm.lean.js → reference_http-api.md.5zOAbV86.lean.js} +0 -0
- /package/dist/docs/assets/{reference_sessions.md.D0mIh4KK.lean.js → reference_sessions.md.NxFP_CAC.lean.js} +0 -0
- /package/dist/docs/assets/{reference_tools.md.BHeXn2id.lean.js → reference_tools.md.B84gw9Ii.lean.js} +0 -0
- /package/dist/docs/assets/{troubleshooting.md.Ctv3T8C2.lean.js → troubleshooting.md.DCiPBhYs.lean.js} +0 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
2
|
+
import { mkdir, rename, unlink, writeFile } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
import { HOSTED_EXECUTION_DIAG_FILENAME } from "./hosted-delivery-protocol.js";
|
|
6
|
+
|
|
7
|
+
export const HOSTED_EXECUTION_DIAG_VERSION = 1;
|
|
8
|
+
/** Cap so a runaway message cannot fill the guest disk or the host log. */
|
|
9
|
+
export const HOSTED_EXECUTION_DIAG_MAX_BYTES = 4096;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Correlate the on-disk record with the execution that produced it. One pod
|
|
13
|
+
* serves many deliveries of a continuation session, and the file lives at a
|
|
14
|
+
* single fixed path, so without this the host can read a *previous*
|
|
15
|
+
* delivery's terminal record whenever July never reaches its own write —
|
|
16
|
+
* the 9-minute host POST timeout, a 409 on an expired admission token, or a
|
|
17
|
+
* replayed token that short-circuits on the memoized reply.
|
|
18
|
+
*
|
|
19
|
+
* Derived from the admission token (which both sides already hold) rather
|
|
20
|
+
* than carried on the wire. The digest is one-way, so the token itself never
|
|
21
|
+
* reaches the guest disk or the host logs.
|
|
22
|
+
*/
|
|
23
|
+
export function hostedExecutionDiagId(admissionToken: string): string {
|
|
24
|
+
return createHash("sha256").update(admissionToken).digest("hex").slice(0, 16);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type HostedExecutionDiagAbortReason =
|
|
28
|
+
| "signal_abort"
|
|
29
|
+
| "runner_cancelled"
|
|
30
|
+
| "runner_error"
|
|
31
|
+
| "execute_throw";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Bounded guest-side record of one hosted-execution attempt. No prompt,
|
|
35
|
+
* tool content, or API key — the host copies known keys onto the Temporal
|
|
36
|
+
* activity span for Datadog.
|
|
37
|
+
*/
|
|
38
|
+
export type HostedExecutionDiag = {
|
|
39
|
+
v: typeof HOSTED_EXECUTION_DIAG_VERSION;
|
|
40
|
+
/** {@link hostedExecutionDiagId} of the execution that wrote this record. */
|
|
41
|
+
executionId: string;
|
|
42
|
+
writtenAt: string;
|
|
43
|
+
sessionPublicId: string;
|
|
44
|
+
sessionId: string;
|
|
45
|
+
/** Terminal {@link TurnOutcome} status, or `running` before the turn ends. */
|
|
46
|
+
turnStatus: string;
|
|
47
|
+
durationMs: number;
|
|
48
|
+
message?: string;
|
|
49
|
+
signalAborted?: boolean;
|
|
50
|
+
requestId?: string;
|
|
51
|
+
abortReason?: HostedExecutionDiagAbortReason;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** Written before the turn starts so a stalled execution still has a record. */
|
|
55
|
+
export const HOSTED_EXECUTION_DIAG_RUNNING_STATUS = "running";
|
|
56
|
+
|
|
57
|
+
const DIAG_KEYS = new Set([
|
|
58
|
+
"v",
|
|
59
|
+
"executionId",
|
|
60
|
+
"writtenAt",
|
|
61
|
+
"sessionPublicId",
|
|
62
|
+
"sessionId",
|
|
63
|
+
"turnStatus",
|
|
64
|
+
"durationMs",
|
|
65
|
+
"message",
|
|
66
|
+
"signalAborted",
|
|
67
|
+
"requestId",
|
|
68
|
+
"abortReason",
|
|
69
|
+
]);
|
|
70
|
+
|
|
71
|
+
const ABORT_REASONS = new Set<HostedExecutionDiagAbortReason>([
|
|
72
|
+
"signal_abort",
|
|
73
|
+
"runner_cancelled",
|
|
74
|
+
"runner_error",
|
|
75
|
+
"execute_throw",
|
|
76
|
+
]);
|
|
77
|
+
|
|
78
|
+
function boundedOptionalString(
|
|
79
|
+
value: unknown,
|
|
80
|
+
max: number
|
|
81
|
+
): string | undefined {
|
|
82
|
+
return typeof value === "string" && value.length > 0
|
|
83
|
+
? value.length > max
|
|
84
|
+
? `${value.slice(0, max)}…`
|
|
85
|
+
: value
|
|
86
|
+
: undefined;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function hostedExecutionDiagPath(stateRoot: string): string {
|
|
90
|
+
return join(stateRoot, HOSTED_EXECUTION_DIAG_FILENAME);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function abortReasonFromTurnStatus(
|
|
94
|
+
status: string,
|
|
95
|
+
message: string | undefined
|
|
96
|
+
): HostedExecutionDiagAbortReason | undefined {
|
|
97
|
+
if (status === "finished") {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
if (status === "cancelled") {
|
|
101
|
+
return message !== undefined && /abort/i.test(message)
|
|
102
|
+
? "signal_abort"
|
|
103
|
+
: "runner_cancelled";
|
|
104
|
+
}
|
|
105
|
+
return "runner_error";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function parseHostedExecutionDiag(
|
|
109
|
+
raw: string
|
|
110
|
+
): HostedExecutionDiag | undefined {
|
|
111
|
+
if (raw.length === 0 || raw.length > HOSTED_EXECUTION_DIAG_MAX_BYTES) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
let parsed: unknown;
|
|
115
|
+
try {
|
|
116
|
+
parsed = JSON.parse(raw);
|
|
117
|
+
} catch {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
const body = parsed as Record<string, unknown>;
|
|
124
|
+
if (Object.keys(body).some((key) => !DIAG_KEYS.has(key))) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
if (
|
|
128
|
+
body.v !== HOSTED_EXECUTION_DIAG_VERSION ||
|
|
129
|
+
typeof body.executionId !== "string" ||
|
|
130
|
+
body.executionId.length === 0 ||
|
|
131
|
+
body.executionId.length > 64 ||
|
|
132
|
+
typeof body.writtenAt !== "string" ||
|
|
133
|
+
body.writtenAt.length === 0 ||
|
|
134
|
+
body.writtenAt.length > 64 ||
|
|
135
|
+
typeof body.sessionPublicId !== "string" ||
|
|
136
|
+
body.sessionPublicId.length === 0 ||
|
|
137
|
+
body.sessionPublicId.length > 128 ||
|
|
138
|
+
typeof body.sessionId !== "string" ||
|
|
139
|
+
body.sessionId.length > 128 ||
|
|
140
|
+
typeof body.turnStatus !== "string" ||
|
|
141
|
+
body.turnStatus.length === 0 ||
|
|
142
|
+
body.turnStatus.length > 64 ||
|
|
143
|
+
typeof body.durationMs !== "number" ||
|
|
144
|
+
!Number.isFinite(body.durationMs) ||
|
|
145
|
+
body.durationMs < 0
|
|
146
|
+
) {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
const message = boundedOptionalString(body.message, 1024);
|
|
150
|
+
const requestId = boundedOptionalString(body.requestId, 128);
|
|
151
|
+
const abortReason =
|
|
152
|
+
body.abortReason === undefined
|
|
153
|
+
? undefined
|
|
154
|
+
: typeof body.abortReason === "string" &&
|
|
155
|
+
ABORT_REASONS.has(body.abortReason as HostedExecutionDiagAbortReason)
|
|
156
|
+
? (body.abortReason as HostedExecutionDiagAbortReason)
|
|
157
|
+
: undefined;
|
|
158
|
+
if (body.abortReason !== undefined && abortReason === undefined) {
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
if (
|
|
162
|
+
body.signalAborted !== undefined &&
|
|
163
|
+
typeof body.signalAborted !== "boolean"
|
|
164
|
+
) {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
v: HOSTED_EXECUTION_DIAG_VERSION,
|
|
169
|
+
executionId: body.executionId,
|
|
170
|
+
writtenAt: body.writtenAt,
|
|
171
|
+
sessionPublicId: body.sessionPublicId,
|
|
172
|
+
sessionId: body.sessionId,
|
|
173
|
+
turnStatus: body.turnStatus,
|
|
174
|
+
durationMs: body.durationMs,
|
|
175
|
+
...(message === undefined ? {} : { message }),
|
|
176
|
+
...(body.signalAborted === true ? { signalAborted: true } : {}),
|
|
177
|
+
...(requestId === undefined ? {} : { requestId }),
|
|
178
|
+
...(abortReason === undefined ? {} : { abortReason }),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Overwrite the per-execution diag file. Soft-fail: a write error must not
|
|
184
|
+
* change the hosted-execution HTTP reply.
|
|
185
|
+
*/
|
|
186
|
+
export async function writeHostedExecutionDiag(
|
|
187
|
+
stateRoot: string,
|
|
188
|
+
diag: HostedExecutionDiag
|
|
189
|
+
): Promise<void> {
|
|
190
|
+
const path = hostedExecutionDiagPath(stateRoot);
|
|
191
|
+
const tmp = `${path}.${randomBytes(8).toString("hex")}.tmp`;
|
|
192
|
+
try {
|
|
193
|
+
await mkdir(stateRoot, { recursive: true });
|
|
194
|
+
const serialized = JSON.stringify(diag);
|
|
195
|
+
const body =
|
|
196
|
+
serialized.length > HOSTED_EXECUTION_DIAG_MAX_BYTES
|
|
197
|
+
? JSON.stringify({
|
|
198
|
+
...diag,
|
|
199
|
+
message: boundedOptionalString(diag.message, 256),
|
|
200
|
+
})
|
|
201
|
+
: serialized;
|
|
202
|
+
await writeFile(tmp, body, "utf8");
|
|
203
|
+
await rename(tmp, path);
|
|
204
|
+
} catch {
|
|
205
|
+
await unlink(tmp).catch(() => undefined);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
@@ -25,6 +25,8 @@ import type { ServerRoute } from "./router.js";
|
|
|
25
25
|
import {
|
|
26
26
|
ApprovalInterruptedError,
|
|
27
27
|
ApprovalNotFoundError,
|
|
28
|
+
AuthInterruptedError,
|
|
29
|
+
AuthNotFoundError,
|
|
28
30
|
HTTP_CHANNEL_ID,
|
|
29
31
|
SessionAuthError,
|
|
30
32
|
type SessionEngine,
|
|
@@ -454,6 +456,101 @@ export function buildHttpChannelRoutes(args: {
|
|
|
454
456
|
},
|
|
455
457
|
};
|
|
456
458
|
|
|
459
|
+
const listAuths: ServerRoute = {
|
|
460
|
+
method: "GET",
|
|
461
|
+
pattern: `${base}/v1/session/:sessionId/auths`,
|
|
462
|
+
auth,
|
|
463
|
+
handler: async (_request, ctx) => {
|
|
464
|
+
const sessionId = ctx.params.sessionId ?? "";
|
|
465
|
+
const record = await engine.getOrRestoreSession(sessionId);
|
|
466
|
+
if (record === undefined) {
|
|
467
|
+
return errorResponse(
|
|
468
|
+
404,
|
|
469
|
+
"session_not_found",
|
|
470
|
+
`Unknown session ${sessionId}.`
|
|
471
|
+
);
|
|
472
|
+
}
|
|
473
|
+
const ownership = requireSessionOwner(record, ctx.auth, {
|
|
474
|
+
relax: relaxSessionReadAuth,
|
|
475
|
+
beyondLoopback: relaxSessionReadAuthBeyondLoopback,
|
|
476
|
+
requestIp: ctx.requestIp,
|
|
477
|
+
});
|
|
478
|
+
if (ownership !== undefined) {
|
|
479
|
+
return ownership;
|
|
480
|
+
}
|
|
481
|
+
const pending = await engine.listPendingAuths(sessionId);
|
|
482
|
+
return jsonResponse({ ok: true, sessionId, pending });
|
|
483
|
+
},
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
const resolveAuth: ServerRoute = {
|
|
487
|
+
method: "POST",
|
|
488
|
+
pattern: `${base}/v1/session/:sessionId/auths/:callId`,
|
|
489
|
+
auth,
|
|
490
|
+
handler: async (request, ctx) => {
|
|
491
|
+
const sessionId = ctx.params.sessionId ?? "";
|
|
492
|
+
const callId = ctx.params.callId ?? "";
|
|
493
|
+
const record = await engine.getOrRestoreSession(sessionId);
|
|
494
|
+
if (record === undefined) {
|
|
495
|
+
return errorResponse(
|
|
496
|
+
404,
|
|
497
|
+
"session_not_found",
|
|
498
|
+
`Unknown session ${sessionId}.`
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
const bridgeSlackAuth =
|
|
502
|
+
relaxSessionApprovalAuth === true &&
|
|
503
|
+
record.auth?.authenticator === "slack" &&
|
|
504
|
+
(relaxSessionReadAuthBeyondLoopback === true ||
|
|
505
|
+
(typeof ctx.requestIp === "string" &&
|
|
506
|
+
isLoopbackAddress(ctx.requestIp)));
|
|
507
|
+
const ownership = requireSessionOwner(record, ctx.auth, {
|
|
508
|
+
relax: bridgeSlackAuth,
|
|
509
|
+
beyondLoopback: relaxSessionReadAuthBeyondLoopback,
|
|
510
|
+
requestIp: ctx.requestIp,
|
|
511
|
+
});
|
|
512
|
+
if (ownership !== undefined) {
|
|
513
|
+
return ownership;
|
|
514
|
+
}
|
|
515
|
+
const body = await readJsonObject(request);
|
|
516
|
+
const decision = body?.decision;
|
|
517
|
+
if (decision !== "approve" && decision !== "deny") {
|
|
518
|
+
return errorResponse(
|
|
519
|
+
400,
|
|
520
|
+
"invalid_request",
|
|
521
|
+
'Expected a JSON body with `decision`: "approve" | "deny".'
|
|
522
|
+
);
|
|
523
|
+
}
|
|
524
|
+
try {
|
|
525
|
+
const pending = await engine.resolveAuth(
|
|
526
|
+
sessionId,
|
|
527
|
+
callId,
|
|
528
|
+
decision,
|
|
529
|
+
ctx.auth,
|
|
530
|
+
bridgeSlackAuth ? { asSessionOwner: true } : undefined
|
|
531
|
+
);
|
|
532
|
+
return jsonResponse({
|
|
533
|
+
ok: true,
|
|
534
|
+
sessionId,
|
|
535
|
+
callId,
|
|
536
|
+
decision,
|
|
537
|
+
connection: pending.connection,
|
|
538
|
+
});
|
|
539
|
+
} catch (error) {
|
|
540
|
+
if (error instanceof AuthNotFoundError) {
|
|
541
|
+
return errorResponse(404, "auth_not_found", error.message);
|
|
542
|
+
}
|
|
543
|
+
if (error instanceof AuthInterruptedError) {
|
|
544
|
+
return errorResponse(409, "auth_interrupted", error.message);
|
|
545
|
+
}
|
|
546
|
+
if (error instanceof SessionAuthError) {
|
|
547
|
+
return errorResponse(403, "forbidden", error.message);
|
|
548
|
+
}
|
|
549
|
+
throw error;
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
};
|
|
553
|
+
|
|
457
554
|
return [
|
|
458
555
|
createSession,
|
|
459
556
|
followUp,
|
|
@@ -463,6 +560,8 @@ export function buildHttpChannelRoutes(args: {
|
|
|
463
560
|
cost,
|
|
464
561
|
listApprovals,
|
|
465
562
|
resolveApproval,
|
|
563
|
+
listAuths,
|
|
564
|
+
resolveAuth,
|
|
466
565
|
];
|
|
467
566
|
}
|
|
468
567
|
|
|
@@ -74,6 +74,8 @@ type TemplateEntry = {
|
|
|
74
74
|
|
|
75
75
|
const TEMPLATES: Readonly<Record<TemplateName, TemplateEntry>> = {
|
|
76
76
|
"agentic-owners": { dir: "agentic-owners" },
|
|
77
|
+
"agents-md": { dir: "agents-md" },
|
|
78
|
+
"code-wiki": { dir: "code-wiki" },
|
|
77
79
|
demo: { dir: "demo" },
|
|
78
80
|
"pr-autofixer": { dir: "pr-autofixer" },
|
|
79
81
|
"security-help": { dir: "security-help" },
|
|
@@ -709,6 +711,8 @@ export function printInitGuide(): void {
|
|
|
709
711
|
Scaffold a project, then open the playground:
|
|
710
712
|
npx ${PACKAGE_NAME} init ./my-agent # installs deps + links agent-sdk onto PATH
|
|
711
713
|
npx ${PACKAGE_NAME} init ./my-demo --template demo # record a PR walkthrough
|
|
714
|
+
npx ${PACKAGE_NAME} init ./code-wiki --template code-wiki # keep wiki pages current after merge
|
|
715
|
+
npx ${PACKAGE_NAME} init ./agents-md --template agents-md # keep AGENTS.md current from last week's PRs and Slack
|
|
712
716
|
npx ${PACKAGE_NAME} init ./my-reviewer --template security-reviewer # review PRs for security bugs
|
|
713
717
|
npx ${PACKAGE_NAME} init ./security-help --template security-help # answer security questions in Slack
|
|
714
718
|
npx ${PACKAGE_NAME} init ./my-triage --template triage-linear # comment on Linear issues
|
|
@@ -31,9 +31,6 @@ import { CLI_COMMAND_NAME, packageRootDir } from "./distribution.js";
|
|
|
31
31
|
import { parseFrontmatter } from "./frontmatter.js";
|
|
32
32
|
import { stdoutPalette } from "./terminal-style.js";
|
|
33
33
|
|
|
34
|
-
/** Monorepo-only skill; excluded from the published package. */
|
|
35
|
-
const SKIP_SKILL_DIRS = new Set(["operate"]);
|
|
36
|
-
|
|
37
34
|
/** Category folder under ~/.cursor/skills (Cursor discovers nested skills). */
|
|
38
35
|
export const CURSOR_SKILLS_NAMESPACE = "agentsdk";
|
|
39
36
|
|
|
@@ -122,7 +119,7 @@ export async function listShippedPackageSkills(
|
|
|
122
119
|
|
|
123
120
|
const skills: PackageSkill[] = [];
|
|
124
121
|
for (const entry of entries) {
|
|
125
|
-
if (!entry.isDirectory()
|
|
122
|
+
if (!entry.isDirectory()) {
|
|
126
123
|
continue;
|
|
127
124
|
}
|
|
128
125
|
const sourceDir = join(skillsRoot, entry.name);
|
|
@@ -114,6 +114,11 @@ export function sanitizeCustomerError(message: string): string {
|
|
|
114
114
|
/**
|
|
115
115
|
* One-line label for `agent-sdk deploy` polling (TTY spinner / non-TTY
|
|
116
116
|
* transitions). Uses statusMessage → progress → raw status.
|
|
117
|
+
*
|
|
118
|
+
* Deliberately does NOT include `lastError`. The spinner redraws with
|
|
119
|
+
* `\r\x1b[2K`, which clears one physical row, so a reason long enough to
|
|
120
|
+
* soft-wrap would leave the earlier rows on screen. Callers print the
|
|
121
|
+
* reason once on the final line instead.
|
|
117
122
|
*/
|
|
118
123
|
export function deployProgressLabel(detail: {
|
|
119
124
|
status: string;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Envelope-carried installation config for managed-product deliveries
|
|
3
|
+
* (plan 0002 Stack H1; envelope shape from Stack B1).
|
|
4
|
+
*
|
|
5
|
+
* On the v2 architecture a managed product (security-reviewer, …) is many
|
|
6
|
+
* single-tenant deployments: the pre-signal trigger gate matches the
|
|
7
|
+
* customer's automation trigger before a workflow starts and stamps the
|
|
8
|
+
* matched automation uuid + an opaque installation-config reference on the
|
|
9
|
+
* attributed session envelope. The delivery activity forwards the matched
|
|
10
|
+
* installation-config document to the fork **inside the webhook payload it
|
|
11
|
+
* POSTs to the channel**, under {@link MANAGED_DELIVERY_PAYLOAD_KEY} — the
|
|
12
|
+
* same embed-in-payload pattern the legacy deployment event stream used
|
|
13
|
+
* for its source marker.
|
|
14
|
+
*
|
|
15
|
+
* This module is the one contract both sides share: the control-plane
|
|
16
|
+
* delivery path embeds with {@link withManagedDeliveryConfig}; the agent's
|
|
17
|
+
* channels detect and read with {@link parseManagedDeliveryConfig}. The
|
|
18
|
+
* document mirrors the sync layer's `ManagedAutomationConfigDoc` **policy**
|
|
19
|
+
* fields that "ride the delivery envelope to the fork" (posting mode,
|
|
20
|
+
* managed config, trigger snapshots for the channel's staleness guard);
|
|
21
|
+
* readers ignore unknown fields so a newer sync can add material without
|
|
22
|
+
* breaking older forks. The automation's MCP server refs deliberately do
|
|
23
|
+
* NOT ride here: they travel on the hosted-admission envelope's
|
|
24
|
+
* `managedAutomation` slice (plan 0002 G2, `hosted-delivery-protocol.ts` /
|
|
25
|
+
* `hosted-managed-automation.ts`) so one mechanism owns MCP attach.
|
|
26
|
+
*
|
|
27
|
+
* INTERNAL: first-party host plumbing shared by agents in `factory/*`,
|
|
28
|
+
* consumed via relative source imports. Deliberately excluded from the
|
|
29
|
+
* published `@cursor/july` npm package (see the `files` whitelist).
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Key inside the delivered webhook payload under which the delivery
|
|
34
|
+
* activity embeds the matched installation config. Chosen to never
|
|
35
|
+
* collide with a provider webhook field (GitHub and Origin payloads have
|
|
36
|
+
* no `cursor*` keys).
|
|
37
|
+
*/
|
|
38
|
+
export const MANAGED_DELIVERY_PAYLOAD_KEY = "cursorManagedDelivery" as const;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The matched installation-config document as it rides the delivery to
|
|
42
|
+
* the fork. Required: the matched automation uuid (B1 attribution).
|
|
43
|
+
* Everything else is optional; absent fields keep the channel's default
|
|
44
|
+
* posture (post, all modules enabled, no staleness guard).
|
|
45
|
+
*/
|
|
46
|
+
export interface ManagedDeliveryInstallationConfig {
|
|
47
|
+
/** Source managed automation uuid the pre-signal gate matched. */
|
|
48
|
+
matchedAutomationUuid: string;
|
|
49
|
+
/** Opaque `<installationId>@<resourceVersion>` config reference. */
|
|
50
|
+
installationConfigRef?: string;
|
|
51
|
+
managedType?: string;
|
|
52
|
+
name?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Whether product output (PR comments, …) posts for this installation,
|
|
55
|
+
* or the run stays check/shadow-only. Channels post only on `"post"`
|
|
56
|
+
* (or when the field is absent) — any other value fails closed to
|
|
57
|
+
* shadow, so a newer mode name never posts by accident.
|
|
58
|
+
*/
|
|
59
|
+
postingMode?: string;
|
|
60
|
+
managedConfig?: Record<string, unknown>;
|
|
61
|
+
/**
|
|
62
|
+
* The automation's git triggers as `GitTrigger.toJson()` snapshots.
|
|
63
|
+
* The channel re-checks the delivery against them (staleness guard:
|
|
64
|
+
* the config may have changed between admission and delivery).
|
|
65
|
+
*/
|
|
66
|
+
triggerSnapshots?: unknown[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
70
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function nonEmptyString(value: unknown): string | undefined {
|
|
74
|
+
if (typeof value !== "string") {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
const trimmed = value.trim();
|
|
78
|
+
return trimmed === "" ? undefined : trimmed;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Read the embedded installation config out of a delivered webhook
|
|
83
|
+
* payload. Returns undefined for payloads without the key (legacy
|
|
84
|
+
* deliveries, host relay, fixtures) and for documents missing the
|
|
85
|
+
* required matched automation uuid — the channel then runs its legacy
|
|
86
|
+
* path unchanged. Malformed optional fields are dropped, not fatal.
|
|
87
|
+
*/
|
|
88
|
+
export function parseManagedDeliveryConfig(
|
|
89
|
+
payload: unknown
|
|
90
|
+
): ManagedDeliveryInstallationConfig | undefined {
|
|
91
|
+
if (!isRecord(payload)) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
const doc = payload[MANAGED_DELIVERY_PAYLOAD_KEY];
|
|
95
|
+
if (!isRecord(doc)) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
const matchedAutomationUuid = nonEmptyString(doc.matchedAutomationUuid);
|
|
99
|
+
if (matchedAutomationUuid === undefined) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
matchedAutomationUuid,
|
|
104
|
+
installationConfigRef: nonEmptyString(doc.installationConfigRef),
|
|
105
|
+
managedType: nonEmptyString(doc.managedType),
|
|
106
|
+
name: nonEmptyString(doc.name),
|
|
107
|
+
postingMode: nonEmptyString(doc.postingMode),
|
|
108
|
+
managedConfig: isRecord(doc.managedConfig) ? doc.managedConfig : undefined,
|
|
109
|
+
triggerSnapshots: Array.isArray(doc.triggerSnapshots)
|
|
110
|
+
? doc.triggerSnapshots
|
|
111
|
+
: undefined,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Embed one matched installation config into the webhook payload the
|
|
117
|
+
* delivery activity POSTs to the channel. Pure; used by the control-plane
|
|
118
|
+
* delivery path and by channel tests building fixture envelopes.
|
|
119
|
+
*/
|
|
120
|
+
export function withManagedDeliveryConfig(
|
|
121
|
+
payload: Record<string, unknown>,
|
|
122
|
+
config: ManagedDeliveryInstallationConfig
|
|
123
|
+
): Record<string, unknown> {
|
|
124
|
+
return { ...payload, [MANAGED_DELIVERY_PAYLOAD_KEY]: config };
|
|
125
|
+
}
|
|
@@ -293,7 +293,11 @@ function buildConnectionBridgeMcpServer(
|
|
|
293
293
|
if (reason !== undefined) {
|
|
294
294
|
throw new Error(reason);
|
|
295
295
|
}
|
|
296
|
-
const tools = await engine.
|
|
296
|
+
const tools = await engine.runWithMcpPark(
|
|
297
|
+
sessionId ?? "",
|
|
298
|
+
"tools/list",
|
|
299
|
+
() => engine.host.mcp.listTools(connectionName)
|
|
300
|
+
);
|
|
297
301
|
return {
|
|
298
302
|
tools: tools.map((tool) => ({
|
|
299
303
|
name: tool.name,
|
|
@@ -327,10 +331,15 @@ function buildConnectionBridgeMcpServer(
|
|
|
327
331
|
return sdkResultToMcpResult(answer.result);
|
|
328
332
|
}
|
|
329
333
|
try {
|
|
330
|
-
const result = await engine.
|
|
331
|
-
|
|
334
|
+
const result = await engine.runWithMcpPark(
|
|
335
|
+
sessionId ?? "",
|
|
332
336
|
request.params.name,
|
|
333
|
-
|
|
337
|
+
() =>
|
|
338
|
+
engine.host.mcp.callTool(
|
|
339
|
+
connectionName,
|
|
340
|
+
request.params.name,
|
|
341
|
+
request.params.arguments ?? {}
|
|
342
|
+
)
|
|
334
343
|
);
|
|
335
344
|
return {
|
|
336
345
|
// The host client already speaks MCP, so the content array is valid
|