@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
|
@@ -326,10 +326,17 @@ export class HostMcpOAuthProvider {
|
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
+
function clientForRedirect(info, redirectUrl) {
|
|
330
|
+
if (info === undefined || !info.redirect_uris.includes(redirectUrl)) {
|
|
331
|
+
return undefined;
|
|
332
|
+
}
|
|
333
|
+
return info;
|
|
334
|
+
}
|
|
329
335
|
export function createHostMcpOAuthProvider(args) {
|
|
330
336
|
return __awaiter(this, void 0, void 0, function* () {
|
|
331
|
-
var _a;
|
|
337
|
+
var _a, _b;
|
|
332
338
|
const store = (_a = args.store) !== null && _a !== void 0 ? _a : new FileMcpOAuthStore();
|
|
339
|
+
const redirectUrl = (_b = args.redirectUrl) !== null && _b !== void 0 ? _b : MCP_OAUTH_CALLBACK_URL;
|
|
333
340
|
const [fileTokens, fileClient, omitResourceIndicator] = yield Promise.all([
|
|
334
341
|
store.loadTokens(args.identifier, args.resourceUrl),
|
|
335
342
|
store.loadClientInformation(args.identifier, args.resourceUrl),
|
|
@@ -339,8 +346,9 @@ export function createHostMcpOAuthProvider(args) {
|
|
|
339
346
|
identifier: args.identifier,
|
|
340
347
|
resourceUrl: args.resourceUrl,
|
|
341
348
|
store,
|
|
349
|
+
redirectUrl,
|
|
342
350
|
tokens: fileTokens !== null && fileTokens !== void 0 ? fileTokens : tokensFromEnv(args.identifier),
|
|
343
|
-
clientInformation: fileClient !== null && fileClient !== void 0 ? fileClient : clientIdFromEnv(args.identifier),
|
|
351
|
+
clientInformation: clientForRedirect(fileClient !== null && fileClient !== void 0 ? fileClient : clientIdFromEnv(args.identifier), redirectUrl),
|
|
344
352
|
onRedirect: args.onRedirect,
|
|
345
353
|
omitResourceIndicator,
|
|
346
354
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../../src/internal/otel/collector.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,KAAK,SAAS,EAAS,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IACzD,KAAK,IAAI,IAAI,CAAC;IACd,yEAAyE;IACzE,oBAAoB,CAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GACpC,IAAI,CAAC;IACR,mEAAmE;IACnE,oBAAoB,CAClB,SAAS,EAAE,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,SAAS,CAAC;CAC1C;AAgBD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC1B,aAAa,
|
|
1
|
+
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../../src/internal/otel/collector.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,KAAK,SAAS,EAAS,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IACzD,KAAK,IAAI,IAAI,CAAC;IACd,yEAAyE;IACzE,oBAAoB,CAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GACpC,IAAI,CAAC;IACR,mEAAmE;IACnE,oBAAoB,CAClB,SAAS,EAAE,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,SAAS,CAAC;CAC1C;AAgBD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC1B,aAAa,CA8xBf"}
|
|
@@ -45,8 +45,8 @@ export function createOtelCollector(runtime, agentName, log) {
|
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
47
|
function handle(event, session) {
|
|
48
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
49
|
-
var
|
|
48
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
49
|
+
var _t, _u;
|
|
50
50
|
const at = Date.parse(event.at);
|
|
51
51
|
const startTime = Number.isFinite(at) ? at : undefined;
|
|
52
52
|
switch (event.type) {
|
|
@@ -144,7 +144,7 @@ export function createOtelCollector(runtime, agentName, log) {
|
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
146
|
for (const call of event.data.calls) {
|
|
147
|
-
const parentCtx = parentCtxFor(turn, (
|
|
147
|
+
const parentCtx = parentCtxFor(turn, (_t = event.data.parentCallId) !== null && _t !== void 0 ? _t : call.parentCallId);
|
|
148
148
|
const span = runtime.tracer.startSpan("agent_sdk.tool", {
|
|
149
149
|
kind: SpanKind.INTERNAL,
|
|
150
150
|
startTime,
|
|
@@ -177,6 +177,19 @@ export function createOtelCollector(runtime, agentName, log) {
|
|
|
177
177
|
}), startTime);
|
|
178
178
|
return;
|
|
179
179
|
}
|
|
180
|
+
case "action.auth_requested": {
|
|
181
|
+
(_k = (_j = ensureTurn(event, session, startTime)) === null || _j === void 0 ? void 0 : _j.tools.get(event.data.callId)) === null || _k === void 0 ? void 0 : _k.addEvent("auth_requested", undefined, startTime);
|
|
182
|
+
emitLog("action.auth_requested", SeverityNumber.INFO, attrs(Object.assign(Object.assign({}, baseLog(event, session)), { "cursor.tool.name": event.data.toolName, "agent_sdk.call_id": event.data.callId, "agent_sdk.mcp_connection": event.data.connection })));
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
case "action.auth_resolved": {
|
|
186
|
+
(_m = (_l = ensureTurn(event, session, startTime)) === null || _l === void 0 ? void 0 : _l.tools.get(event.data.callId)) === null || _m === void 0 ? void 0 : _m.addEvent("auth_resolved", attrs({
|
|
187
|
+
"agent_sdk.decision": event.data.decision,
|
|
188
|
+
"agent_sdk.decision_by": event.data.by,
|
|
189
|
+
"agent_sdk.mcp_connection": event.data.connection,
|
|
190
|
+
}), startTime);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
180
193
|
case "action.result": {
|
|
181
194
|
const turn = ensureTurn(event, session, startTime);
|
|
182
195
|
const span = turn === null || turn === void 0 ? void 0 : turn.tools.get(event.data.callId);
|
|
@@ -211,7 +224,7 @@ export function createOtelCollector(runtime, agentName, log) {
|
|
|
211
224
|
event.turnId !== undefined) {
|
|
212
225
|
turn.span.setStatus({ code: SpanStatusCode.OK });
|
|
213
226
|
turn.span.end(startTime);
|
|
214
|
-
(
|
|
227
|
+
(_o = sessions.get(event.sessionId)) === null || _o === void 0 ? void 0 : _o.turns.delete(event.turnId);
|
|
215
228
|
}
|
|
216
229
|
return;
|
|
217
230
|
}
|
|
@@ -238,7 +251,7 @@ export function createOtelCollector(runtime, agentName, log) {
|
|
|
238
251
|
turn.subagents.set(event.data.callId, span);
|
|
239
252
|
metrics === null || metrics === void 0 ? void 0 : metrics.subagents.add(1, join(event.sessionId, {
|
|
240
253
|
"agent_sdk.agent": agentName,
|
|
241
|
-
"agent_sdk.subagent_name": (
|
|
254
|
+
"agent_sdk.subagent_name": (_u = event.data.name) !== null && _u !== void 0 ? _u : "unknown",
|
|
242
255
|
}));
|
|
243
256
|
return;
|
|
244
257
|
}
|
|
@@ -252,7 +265,7 @@ export function createOtelCollector(runtime, agentName, log) {
|
|
|
252
265
|
return;
|
|
253
266
|
}
|
|
254
267
|
case "artifact.tagged": {
|
|
255
|
-
(
|
|
268
|
+
(_p = ensureSession(event, session, startTime)) === null || _p === void 0 ? void 0 : _p.span.addEvent("artifact.tagged", attrs({
|
|
256
269
|
"agent_sdk.artifact_id": event.data.id,
|
|
257
270
|
"agent_sdk.artifact_kind": event.data.kind,
|
|
258
271
|
"agent_sdk.artifact_key": event.data.key,
|
|
@@ -291,7 +304,7 @@ export function createOtelCollector(runtime, agentName, log) {
|
|
|
291
304
|
}
|
|
292
305
|
turn.span.setStatus({ code: SpanStatusCode.OK });
|
|
293
306
|
turn.span.end(startTime);
|
|
294
|
-
(
|
|
307
|
+
(_q = sessions.get(event.sessionId)) === null || _q === void 0 ? void 0 : _q.turns.delete(event.turnId);
|
|
295
308
|
metrics === null || metrics === void 0 ? void 0 : metrics.turns.add(1, join(event.sessionId, {
|
|
296
309
|
"agent_sdk.agent": agentName,
|
|
297
310
|
"agent_sdk.turn_status": "completed",
|
|
@@ -315,7 +328,7 @@ export function createOtelCollector(runtime, agentName, log) {
|
|
|
315
328
|
turn.span.recordException(new Error(failureText));
|
|
316
329
|
}
|
|
317
330
|
turn.span.end(startTime);
|
|
318
|
-
(
|
|
331
|
+
(_r = sessions.get(event.sessionId)) === null || _r === void 0 ? void 0 : _r.turns.delete(event.turnId);
|
|
319
332
|
metrics === null || metrics === void 0 ? void 0 : metrics.turns.add(1, join(event.sessionId, {
|
|
320
333
|
"agent_sdk.agent": agentName,
|
|
321
334
|
"agent_sdk.turn_status": "failed",
|
|
@@ -324,7 +337,7 @@ export function createOtelCollector(runtime, agentName, log) {
|
|
|
324
337
|
return;
|
|
325
338
|
}
|
|
326
339
|
case "session.waiting": {
|
|
327
|
-
(
|
|
340
|
+
(_s = ensureSession(event, session, startTime)) === null || _s === void 0 ? void 0 : _s.span.addEvent("session.waiting", undefined, startTime);
|
|
328
341
|
return;
|
|
329
342
|
}
|
|
330
343
|
case "session.completed": {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { RunnerTurnRequest, TurnOutcome } from "../types.js";
|
|
9
9
|
import type { GrokBotRunnerOptions } from "./grokbot/runner.js";
|
|
10
|
-
import type { AgentRunner, PrewarmOutcome, RunnerPrewarmRequest } from "./sdk-runner.js";
|
|
10
|
+
import type { AgentRunner, PrewarmOutcome, RunnerPrewarmRequest, SteerAckOutcome } from "./sdk-runner.js";
|
|
11
11
|
export interface RuntimeDispatchingRunnerOptions {
|
|
12
12
|
sdkRunner: AgentRunner;
|
|
13
13
|
grokbot?: GrokBotRunnerOptions;
|
|
@@ -24,6 +24,10 @@ export declare class RuntimeDispatchingRunner implements AgentRunner {
|
|
|
24
24
|
*/
|
|
25
25
|
ensureGrokBotRunner(): AgentRunner;
|
|
26
26
|
runTurn(request: RunnerTurnRequest): Promise<TurnOutcome>;
|
|
27
|
+
steer(request: {
|
|
28
|
+
sessionId: string;
|
|
29
|
+
text: string;
|
|
30
|
+
}): Promise<SteerAckOutcome>;
|
|
27
31
|
prewarm(request: RunnerPrewarmRequest): Promise<PrewarmOutcome>;
|
|
28
32
|
dispose(): Promise<void>;
|
|
29
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-dispatch-runner.d.ts","sourceRoot":"","sources":["../../src/internal/runtime-dispatch-runner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,oBAAoB,
|
|
1
|
+
{"version":3,"file":"runtime-dispatch-runner.d.ts","sourceRoot":"","sources":["../../src/internal/runtime-dispatch-runner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,WAAW,CAAC;IACvB,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,WAAW,CAAC;CACtE;AAED,qBAAa,wBAAyB,YAAW,WAAW;IAG9C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,aAAa,CAA0B;IAE/C,YAA6B,OAAO,EAAE,+BAA+B,EAAI;IAEzE;;;OAGG;IACH,mBAAmB,IAAI,WAAW,CAKjC;IAEK,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAK9D;IAEK,KAAK,CAAC,OAAO,EAAE;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,eAAe,CAAC,CAI3B;IAEK,OAAO,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CASpE;IAEK,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAG7B;CACF"}
|
|
@@ -38,6 +38,13 @@ export class RuntimeDispatchingRunner {
|
|
|
38
38
|
return this.options.sdkRunner.runTurn(request);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
+
steer(request) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
var _c;
|
|
45
|
+
return ((_c = (yield (_b = (_a = this.options.sdkRunner).steer) === null || _b === void 0 ? void 0 : _b.call(_a, request))) !== null && _c !== void 0 ? _c : "revert_to_followup");
|
|
46
|
+
});
|
|
47
|
+
}
|
|
41
48
|
prewarm(request) {
|
|
42
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
50
|
var _a, _b;
|
|
@@ -8,9 +8,15 @@
|
|
|
8
8
|
import { type LocalAgentStore, type ModelSelection, type RunResult } from "@cursor/sdk";
|
|
9
9
|
import { type ModelSetting, type RunnerTurnRequest, type TurnOutcome } from "../types.js";
|
|
10
10
|
import type { ConversationMirror } from "./conversation-mirror.js";
|
|
11
|
+
/** Mirrors @cursor/sdk's SteerAckOutcome; the published dist may predate it. */
|
|
12
|
+
export type SteerAckOutcome = "complete_delivered" | "revert_to_followup";
|
|
11
13
|
/** Internal seam between the session engine and the Cursor SDK harness. */
|
|
12
14
|
export interface AgentRunner {
|
|
13
15
|
runTurn(request: RunnerTurnRequest): Promise<TurnOutcome>;
|
|
16
|
+
steer?(request: {
|
|
17
|
+
sessionId: string;
|
|
18
|
+
text: string;
|
|
19
|
+
}): Promise<SteerAckOutcome>;
|
|
14
20
|
/**
|
|
15
21
|
* Resolve a local workspace before any session needs it, so the first turn
|
|
16
22
|
* is not the one that pays for it. Best effort, hence the reported outcome:
|
|
@@ -83,11 +89,16 @@ export declare function isAuthErrorMessage(message: string | undefined): boolean
|
|
|
83
89
|
export declare class CursorSdkRunner implements AgentRunner {
|
|
84
90
|
private readonly options;
|
|
85
91
|
private readonly agents;
|
|
92
|
+
private readonly activeRuns;
|
|
86
93
|
private readonly stores;
|
|
87
94
|
private readonly prewarmReleases;
|
|
88
95
|
constructor(options?: CursorSdkRunnerOptions);
|
|
89
96
|
runTurn(request: RunnerTurnRequest): Promise<TurnOutcome>;
|
|
90
97
|
private runTurnAttempt;
|
|
98
|
+
steer(request: {
|
|
99
|
+
sessionId: string;
|
|
100
|
+
text: string;
|
|
101
|
+
}): Promise<SteerAckOutcome>;
|
|
91
102
|
/**
|
|
92
103
|
* Build the local executor for a workspace before any session asks for it.
|
|
93
104
|
* The warmed executor is reference counted, so the lease is held until
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-runner.d.ts","sourceRoot":"","sources":["../../src/internal/sdk-runner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAOL,KAAK,eAAe,EACpB,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"sdk-runner.d.ts","sourceRoot":"","sources":["../../src/internal/sdk-runner.ts"],"names":[],"mappings":"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"}
|
|
@@ -20,6 +20,7 @@ import { SqliteLocalAgentStore } from "@cursor/sdk/sqlite";
|
|
|
20
20
|
import { DEFAULT_MODEL, } from "../types.js";
|
|
21
21
|
import { mapSdkTokenUsage, usageTokenSum } from "./cloud-turn-cost.js";
|
|
22
22
|
import { resolveApiKeySync } from "./cursor/credentials.js";
|
|
23
|
+
import { describeError } from "./describe-error.js";
|
|
23
24
|
/**
|
|
24
25
|
* How long a non-`--dev` serve holds workspace scans (rules, skills,
|
|
25
26
|
* `AGENTS.md`, ignore files). The SDK default is 20s for an editor whose
|
|
@@ -96,6 +97,7 @@ export class CursorSdkRunner {
|
|
|
96
97
|
constructor(options = {}) {
|
|
97
98
|
this.options = options;
|
|
98
99
|
this.agents = new Map();
|
|
100
|
+
this.activeRuns = new Map();
|
|
99
101
|
this.stores = new Map();
|
|
100
102
|
this.prewarmReleases = [];
|
|
101
103
|
if (options.workspaceScanCacheTtlMs !== undefined) {
|
|
@@ -199,15 +201,9 @@ export class CursorSdkRunner {
|
|
|
199
201
|
run.requestId !== "") {
|
|
200
202
|
yield request.onRequestId(run.requestId);
|
|
201
203
|
}
|
|
204
|
+
this.activeRuns.set(request.sessionId, run);
|
|
202
205
|
try {
|
|
203
206
|
const result = yield run.wait();
|
|
204
|
-
// Mirror the conversation before replying: on hosted v2 the pod can
|
|
205
|
-
// be parked as soon as the execution reply lands, so a
|
|
206
|
-
// fire-and-forget write would race VM teardown. Failed turns still
|
|
207
|
-
// checkpoint the user message, so they persist too.
|
|
208
|
-
if (request.runtime === "local") {
|
|
209
|
-
yield this.persistConversation(request, agent.agentId);
|
|
210
|
-
}
|
|
211
207
|
let outcome = toTurnOutcome(result);
|
|
212
208
|
if (outcome.status === "error") {
|
|
213
209
|
// An error result usually means the handle's transport is poisoned
|
|
@@ -230,7 +226,23 @@ export class CursorSdkRunner {
|
|
|
230
226
|
return outcome;
|
|
231
227
|
}
|
|
232
228
|
finally {
|
|
229
|
+
if (this.activeRuns.get(request.sessionId) === run) {
|
|
230
|
+
this.activeRuns.delete(request.sessionId);
|
|
231
|
+
}
|
|
233
232
|
signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
|
|
233
|
+
// Mirror the conversation before replying: on hosted v2 the pod can
|
|
234
|
+
// be parked as soon as the execution reply lands, so a
|
|
235
|
+
// fire-and-forget write would race VM teardown. In the `finally` so
|
|
236
|
+
// a `wait()` that THROWS (transport death mid-turn, an abort with
|
|
237
|
+
// no follow-up) still persists the checkpoints the turn already
|
|
238
|
+
// wrote — the store is local SQLite, safe to read on the throw
|
|
239
|
+
// path, and persistConversation swallows its own errors. Guarded
|
|
240
|
+
// here (not just inside the helper) so unmirrored turns keep their
|
|
241
|
+
// exact post-wait sequencing.
|
|
242
|
+
if (request.runtime === "local" &&
|
|
243
|
+
this.options.conversationMirror !== undefined) {
|
|
244
|
+
yield this.persistConversation(request, agent.agentId);
|
|
245
|
+
}
|
|
234
246
|
}
|
|
235
247
|
}
|
|
236
248
|
catch (error) {
|
|
@@ -241,6 +253,21 @@ export class CursorSdkRunner {
|
|
|
241
253
|
}
|
|
242
254
|
});
|
|
243
255
|
}
|
|
256
|
+
steer(request) {
|
|
257
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
258
|
+
const run = this.activeRuns.get(request.sessionId);
|
|
259
|
+
if ((run === null || run === void 0 ? void 0 : run.steer) === undefined) {
|
|
260
|
+
return "revert_to_followup";
|
|
261
|
+
}
|
|
262
|
+
try {
|
|
263
|
+
return yield run.steer(request.text);
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
this.log(`[agent-sdk] session ${request.sessionId}: steer failed: ${describeError(error)}`);
|
|
267
|
+
return "revert_to_followup";
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
244
271
|
/**
|
|
245
272
|
* Build the local executor for a workspace before any session asks for it.
|
|
246
273
|
* The warmed executor is reference counted, so the lease is held until
|
|
@@ -340,7 +367,11 @@ export class CursorSdkRunner {
|
|
|
340
367
|
*/
|
|
341
368
|
buildLocalOptions(request) {
|
|
342
369
|
return __awaiter(this, void 0, void 0, function* () {
|
|
343
|
-
|
|
370
|
+
var _a;
|
|
371
|
+
// Not resolveStore: an injected store is used synchronously (no
|
|
372
|
+
// microtask, no thenable assimilation), exactly as before the mirror
|
|
373
|
+
// existed.
|
|
374
|
+
const store = (_a = this.options.store) !== null && _a !== void 0 ? _a : (yield this.getStore(request.runnerStateDir));
|
|
344
375
|
return Object.assign(Object.assign(Object.assign({}, this.buildSharedOptions(request)), (request.tools === undefined ? {} : { tools: request.tools })), { local: Object.assign({ cwd: request.workspaceDir, settingSources: ["project"], store }, (request.sandbox === true
|
|
345
376
|
? { sandboxOptions: { enabled: true } }
|
|
346
377
|
: {})) });
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* server-level health / info / dev-dispatch routes.
|
|
6
6
|
*/
|
|
7
7
|
import type { AgentProject, AgentServeHandle, ServeOptions } from "../types.js";
|
|
8
|
+
import type { McpOauthSecretsTarget } from "./mcp-oauth-persist.js";
|
|
8
9
|
import { type AgentRunner } from "./sdk-runner.js";
|
|
9
10
|
/** One agent to serve: its slug (empty for single-agent mode) and project. */
|
|
10
11
|
export interface AgentMount {
|
|
@@ -15,6 +16,8 @@ export interface AgentMount {
|
|
|
15
16
|
export interface StartServerInternalOptions {
|
|
16
17
|
/** Test seam: replace the Cursor SDK runner (integration tests). */
|
|
17
18
|
runner?: AgentRunner;
|
|
19
|
+
/** Test seam: bind the `--store` secrets client for on-demand MCP OAuth. */
|
|
20
|
+
mcpOauthSecrets?: McpOauthSecretsTarget;
|
|
18
21
|
}
|
|
19
22
|
/**
|
|
20
23
|
* Start an HTTP server hosting one or more agents. A single agent with an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/internal/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoCH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAOhB,YAAY,EACb,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/internal/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoCH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAOhB,YAAY,EACb,MAAM,aAAa,CAAC;AAqFrB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAyCpE,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AA2BpE,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;CACvB;AAmCD,6EAA6E;AAC7E,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,qBAAqB,CAAC;CACzC;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,UAAU,EAAE,EACpB,OAAO,GAAE,YAAY,GAAG,0BAA+B,GACtD,OAAO,CAAC,gBAAgB,CAAC,CAw9B3B"}
|
package/dist/internal/server.js
CHANGED
|
@@ -64,6 +64,7 @@ import { DEFAULT_SERVE_PORT, listenHttpServer } from "./listen-port.js";
|
|
|
64
64
|
import { createLocalControlPlane, } from "./local-control-plane.js";
|
|
65
65
|
import { createLogRing } from "./log-ring.js";
|
|
66
66
|
import { createAgentMcpEndpoint, createToolMcpEndpoint, MCP_ENDPOINT_PATH, TOOL_MCP_ENDPOINT_PATH, } from "./mcp-endpoint.js";
|
|
67
|
+
import { mcpOauthServeCallbackPath, mcpOauthServeCallbackUrl, } from "./mcp-oauth-on-demand.js";
|
|
67
68
|
import { isLoopbackAddress } from "./net.js";
|
|
68
69
|
import { createOtelCollector } from "./otel/collector.js";
|
|
69
70
|
import { pickAuthoredOtel, resolveOtelConfig } from "./otel/config.js";
|
|
@@ -116,8 +117,8 @@ function isV2Project(project) {
|
|
|
116
117
|
export function startServer(mounts_1) {
|
|
117
118
|
return __awaiter(this, arguments, void 0, function* (mounts, options = {}) {
|
|
118
119
|
var _a, _b, _c, _d, _e, _f;
|
|
119
|
-
var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
120
|
-
var
|
|
120
|
+
var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
121
|
+
var _4;
|
|
121
122
|
if (mounts.length === 0) {
|
|
122
123
|
throw new Error("startServer requires at least one agent mount");
|
|
123
124
|
}
|
|
@@ -139,7 +140,7 @@ export function startServer(mounts_1) {
|
|
|
139
140
|
// CURSOR_AGENTKIT_VERSION is still the env the SDK reads when building
|
|
140
141
|
// its client-version header (wire prefix remains `agentkit-`). Setting it
|
|
141
142
|
// here makes the internal-only agentkit_enabled gate apply to every turn.
|
|
142
|
-
(_m = (
|
|
143
|
+
(_m = (_4 = process.env).CURSOR_AGENTKIT_VERSION) !== null && _m !== void 0 ? _m : (_4.CURSOR_AGENTKIT_VERSION = packageVersion());
|
|
143
144
|
const authoredOtel = pickAuthoredOtel(mounts.map((m) => ({
|
|
144
145
|
slug: m.slug,
|
|
145
146
|
name: m.project.name,
|
|
@@ -420,6 +421,12 @@ export function startServer(mounts_1) {
|
|
|
420
421
|
otel: otelCollector,
|
|
421
422
|
otelMeter: otelRuntime === null || otelRuntime === void 0 ? void 0 : otelRuntime.meter,
|
|
422
423
|
});
|
|
424
|
+
engine.oauthCallbackHub.secrets = options.mcpOauthSecrets;
|
|
425
|
+
engine.oauthCallbackHub.secretsBind = {
|
|
426
|
+
slug: slug === "" ? undefined : slug,
|
|
427
|
+
cloudToolsUrl: options.cloudToolsUrl,
|
|
428
|
+
};
|
|
429
|
+
engine.oauthCallbackHub.logger = logger;
|
|
423
430
|
// Rehydrate sessions from the authored storage sink before any
|
|
424
431
|
// channel or route can address them (continuation tokens must resolve).
|
|
425
432
|
yield engine.restoreStoredSessions();
|
|
@@ -488,7 +495,7 @@ export function startServer(mounts_1) {
|
|
|
488
495
|
noControlPlane,
|
|
489
496
|
multi,
|
|
490
497
|
logger,
|
|
491
|
-
logRing }, (options.authToken === undefined
|
|
498
|
+
logRing, diagStateRoot: baseStateRoot }, (options.authToken === undefined
|
|
492
499
|
? {}
|
|
493
500
|
: { authToken: options.authToken })), (options.allowAnonymous === true ? { allowAnonymous: true } : {})), (accountRefs !== undefined && accountBridge !== undefined
|
|
494
501
|
? { accountBridge, accountRefs }
|
|
@@ -510,6 +517,7 @@ export function startServer(mounts_1) {
|
|
|
510
517
|
engine.trackBackground(promise);
|
|
511
518
|
},
|
|
512
519
|
resolveApproval: (sessionId, callId, decision, auth) => engine.resolveApproval(sessionId, callId, decision, auth),
|
|
520
|
+
resolveAuth: (sessionId, callId, decision, auth) => engine.resolveAuth(sessionId, callId, decision, auth),
|
|
513
521
|
hasContinuationSession: (continuationToken) => engine.hasContinuationSession(channel.id, continuationToken),
|
|
514
522
|
isContinuationBusy: (continuationToken) => engine.isContinuationBusy(channel.id, continuationToken),
|
|
515
523
|
getContinuationLastBotMessageTs: (continuationToken) => engine.getContinuationLastBotMessageTs(channel.id, continuationToken),
|
|
@@ -700,6 +708,7 @@ export function startServer(mounts_1) {
|
|
|
700
708
|
const address = server.address();
|
|
701
709
|
const displayHost = host === "0.0.0.0" || host === "::" ? "127.0.0.1" : host;
|
|
702
710
|
const url = `http://${displayHost}:${boundPort}`;
|
|
711
|
+
const oauthOrigin = ((_2 = options.publicUrl) !== null && _2 !== void 0 ? _2 : url).replace(/\/$/, "");
|
|
703
712
|
// Resolve peer + Cursor account MCP connections now that the listen port is
|
|
704
713
|
// known (see resolved-connections.ts for the URL/runtime rules).
|
|
705
714
|
for (const runtime of runtimes) {
|
|
@@ -715,6 +724,18 @@ export function startServer(mounts_1) {
|
|
|
715
724
|
if (resolved.length > 0) {
|
|
716
725
|
runtime.engine.setResolvedConnections(resolved);
|
|
717
726
|
}
|
|
727
|
+
const oauthBase = runtime.slug === "" ? "" : `/${runtime.slug}`;
|
|
728
|
+
runtime.engine.setMcpOauthCallbackUrl(mcpOauthServeCallbackUrl(oauthOrigin, oauthBase));
|
|
729
|
+
if (accountBridge !== undefined && accountRefs !== undefined) {
|
|
730
|
+
const bridge = accountBridge;
|
|
731
|
+
runtime.engine.setCursorAccountAuthProbe((connection) => __awaiter(this, void 0, void 0, function* () {
|
|
732
|
+
const ref = accountRefs.find((entry) => entry.name === connection);
|
|
733
|
+
if (ref === undefined) {
|
|
734
|
+
return undefined;
|
|
735
|
+
}
|
|
736
|
+
return yield bridge.probeAuthUrl(ref);
|
|
737
|
+
}));
|
|
738
|
+
}
|
|
718
739
|
const hasServerTools = runtime.project.agent.tools.some((tool) => tool.execution === "server");
|
|
719
740
|
// Host-bridged connections ride the same endpoint as server tools, so
|
|
720
741
|
// the cloud tools connection is set whenever either needs it.
|
|
@@ -723,7 +744,7 @@ export function startServer(mounts_1) {
|
|
|
723
744
|
runtime.project.agent.cloud !== undefined;
|
|
724
745
|
if ((hasServerTools || bridgeableNames.length > 0) && cloudCapable) {
|
|
725
746
|
const basePath = runtime.slug === "" ? "" : `/${runtime.slug}`;
|
|
726
|
-
const publicToolsUrl = (
|
|
747
|
+
const publicToolsUrl = (_3 = options.cloudToolsUrl) !== null && _3 !== void 0 ? _3 : (options.publicUrl === undefined
|
|
727
748
|
? undefined
|
|
728
749
|
: `${options.publicUrl.replace(/\/$/, "")}${basePath}${TOOL_MCP_ENDPOINT_PATH}`);
|
|
729
750
|
if (publicToolsUrl === undefined) {
|
|
@@ -929,16 +950,14 @@ function mountAgentRoutes(router, runtime, args) {
|
|
|
929
950
|
return null;
|
|
930
951
|
};
|
|
931
952
|
if (noControlPlane === true && isV2Project(project)) {
|
|
932
|
-
registerHostedDeliveryRoute({
|
|
933
|
-
|
|
934
|
-
base,
|
|
935
|
-
channels: project.channels,
|
|
936
|
-
buildHandlerArgs: (channelId, hostedSessionId) => buildChannelHandlerArgs({
|
|
953
|
+
registerHostedDeliveryRoute(Object.assign({ router,
|
|
954
|
+
base, channels: project.channels, buildHandlerArgs: (channelId, hostedSessionId) => buildChannelHandlerArgs({
|
|
937
955
|
runtime,
|
|
938
956
|
channelId,
|
|
939
957
|
hostedSessionId,
|
|
940
|
-
}),
|
|
941
|
-
|
|
958
|
+
}), drainSessionDurability: (sessionId) => engine.drainSessionDurability(sessionId) }, (args.diagStateRoot === undefined
|
|
959
|
+
? {}
|
|
960
|
+
: { stateRoot: args.diagStateRoot })));
|
|
942
961
|
}
|
|
943
962
|
// Playground lists/opens Slack (and other channel) sessions across
|
|
944
963
|
// principals when `--dev` (loopback) or `--allow-anonymous` (trusted
|
|
@@ -951,6 +970,12 @@ function mountAgentRoutes(router, runtime, args) {
|
|
|
951
970
|
// Separate from read-relax: playground Approve/Deny on Slack-owned parked
|
|
952
971
|
// tools (Slack principals never match local/anonymous HTTP auth).
|
|
953
972
|
const relaxSessionApprovalAuth = relaxSessionReadAuth;
|
|
973
|
+
router.add({
|
|
974
|
+
method: "GET",
|
|
975
|
+
pattern: `${base}${mcpOauthServeCallbackPath()}`,
|
|
976
|
+
auth: "none",
|
|
977
|
+
handler: (request) => engine.oauthCallbackHub.handleCallback(request),
|
|
978
|
+
});
|
|
954
979
|
router.add({
|
|
955
980
|
method: "GET",
|
|
956
981
|
pattern: `${base}/v1/health`,
|
|
@@ -1022,7 +1047,7 @@ function mountAgentRoutes(router, runtime, args) {
|
|
|
1022
1047
|
method: "GET",
|
|
1023
1048
|
pattern: `${base}/v1/sessions`,
|
|
1024
1049
|
auth: httpAuth,
|
|
1025
|
-
handler: (
|
|
1050
|
+
handler: (request, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1026
1051
|
// Same gate as requireSessionOwner / relaxSessionReadAuth: never with
|
|
1027
1052
|
// bearer or custom channel auth (strict per-principal isolation).
|
|
1028
1053
|
// `--allow-anonymous` alone is a shared-principal trust boundary (corp
|
|
@@ -1031,9 +1056,13 @@ function mountAgentRoutes(router, runtime, args) {
|
|
|
1031
1056
|
(relaxSessionReadAuthBeyondLoopback ||
|
|
1032
1057
|
(typeof ctx.requestIp === "string" &&
|
|
1033
1058
|
isLoopbackAddress(ctx.requestIp)));
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1059
|
+
// `?latest=1` — only the newest visible session. Clients binding a
|
|
1060
|
+
// default session (agsh) do not need the whole list, and on hosted
|
|
1061
|
+
// storage the whole list is a database scan.
|
|
1062
|
+
const latest = new URL(request.url).searchParams.get("latest");
|
|
1063
|
+
const listed = latest === "1" || latest === "true"
|
|
1064
|
+
? yield engine.latestSessionWithSource(ctx.auth, { includeAll })
|
|
1065
|
+
: yield engine.listSessionsWithSource(ctx.auth, { includeAll });
|
|
1037
1066
|
return jsonResponse({
|
|
1038
1067
|
sessions: listed.sessions,
|
|
1039
1068
|
source: listed.source,
|
|
@@ -1206,17 +1235,16 @@ function mountAgentRoutes(router, runtime, args) {
|
|
|
1206
1235
|
return binding.errorResponse;
|
|
1207
1236
|
}
|
|
1208
1237
|
try {
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1211
|
-
if (tool === undefined) {
|
|
1238
|
+
const described = yield engine.describeCatalogTool(toolName, Object.assign({ auth: ctx.auth }, binding));
|
|
1239
|
+
if (described.tool === undefined) {
|
|
1212
1240
|
return jsonResponse({
|
|
1213
1241
|
ok: false,
|
|
1214
1242
|
error: "unknown_tool",
|
|
1215
1243
|
message: `Unknown tool "${toolName}".`,
|
|
1216
|
-
availableTools:
|
|
1244
|
+
availableTools: described.availableTools,
|
|
1217
1245
|
}, { status: 404 });
|
|
1218
1246
|
}
|
|
1219
|
-
return jsonResponse(catalogDetailEntry(tool));
|
|
1247
|
+
return jsonResponse(catalogDetailEntry(described.tool));
|
|
1220
1248
|
}
|
|
1221
1249
|
catch (error) {
|
|
1222
1250
|
if (error instanceof InvalidContinuationTokenError) {
|