@cursor/july 0.1.93 → 0.1.95
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 +8 -20
- package/README.md +4 -26
- package/dist/channels/github/github-channel.d.ts.map +1 -1
- package/dist/channels/github/github-channel.js +14 -2
- package/dist/channels/github/types.d.ts +18 -3
- package/dist/channels/github/types.d.ts.map +1 -1
- package/dist/channels/origin/origin-channel.d.ts.map +1 -1
- package/dist/channels/origin/origin-channel.js +11 -3
- package/dist/channels/origin/origin-webhook.d.ts +11 -1
- package/dist/channels/origin/origin-webhook.d.ts.map +1 -1
- package/dist/channels/origin/origin-webhook.js +23 -3
- package/dist/channels/origin/types.d.ts +8 -0
- package/dist/channels/origin/types.d.ts.map +1 -1
- package/dist/channels/slack/attachments.js +2 -2
- package/dist/channels/slack/dispatch.d.ts +0 -7
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +4 -7
- package/dist/channels/slack/eval-directive.d.ts +5 -12
- package/dist/channels/slack/eval-directive.d.ts.map +1 -1
- package/dist/channels/slack/eval-directive.js +8 -19
- package/dist/channels/slack/index.d.ts +0 -6
- package/dist/channels/slack/index.d.ts.map +1 -1
- package/dist/channels/slack/index.js +0 -6
- package/dist/channels/slack/pr-ref.d.ts +7 -1
- package/dist/channels/slack/pr-ref.d.ts.map +1 -1
- package/dist/channels/slack/pr-ref.js +42 -23
- package/dist/channels/slack/setup.d.ts +4 -4
- package/dist/channels/slack/setup.d.ts.map +1 -1
- package/dist/channels/slack/setup.js +8 -15
- package/dist/channels/slack/slack-channel.d.ts +6 -13
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +15 -101
- package/dist/channels/slack/types.d.ts +12 -79
- package/dist/channels/slack/types.d.ts.map +1 -1
- package/dist/channels/slack/types.js +1 -15
- package/dist/client.d.ts +14 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +12 -0
- package/dist/connections.d.ts +18 -9
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +17 -8
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +4 -4
- package/dist/docs/assets/{app.CjWU-x0z.js → app.BBj0klBO.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.oqPawjiD.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.Cxy8ySFQ.js → VPLocalSearchBox.CUEXpL78.js} +1 -1
- package/dist/docs/assets/chunks/{theme.Dvq1Bktu.js → theme.DabmQnia.js} +2 -2
- package/dist/docs/assets/concepts.md.lwAgBIMI.js +1 -0
- package/dist/docs/assets/{deployment.md.DoLFAzfm.js → deployment.md.D9msOFOW.js} +3 -8
- package/dist/docs/assets/{deployment.md.DoLFAzfm.lean.js → deployment.md.D9msOFOW.lean.js} +1 -1
- package/dist/docs/assets/{guides_agent-to-agent.md.B3JIaAqz.js → guides_agent-to-agent.md.BDb0t1QV.js} +1 -1
- package/dist/docs/assets/guides_cloud-runtime.md.CkYbjnAX.js +9 -0
- package/dist/docs/assets/guides_cloud-runtime.md.CkYbjnAX.lean.js +1 -0
- package/dist/docs/assets/{guides_convert-automation.md.Bboisykk.js → guides_convert-automation.md.B4sjlodG.js} +1 -1
- package/dist/docs/assets/{guides_github.md.DqJhuaN1.js → guides_github.md.Cnh2mL4a.js} +1 -1
- package/dist/docs/assets/{guides_mcp-oauth.md.CJvrXtkN.js → guides_mcp-oauth.md.DPYmBCbV.js} +7 -9
- package/dist/docs/assets/{guides_mcp-oauth.md.CJvrXtkN.lean.js → guides_mcp-oauth.md.DPYmBCbV.lean.js} +1 -1
- package/dist/docs/assets/{guides_slack.md.mqeNKs84.js → guides_slack.md.C32HsdKk.js} +5 -11
- package/dist/docs/assets/guides_slack.md.C32HsdKk.lean.js +1 -0
- package/dist/docs/assets/index.md.BoHaMdeZ.js +5 -0
- package/dist/docs/assets/{index.md.B-lVR4wT.lean.js → index.md.BoHaMdeZ.lean.js} +1 -1
- package/dist/docs/assets/{quickstart.md.BrmfrrIr.js → quickstart.md.Nj_LjW_a.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.D9KESDsD.js → reference_cli.md.BsMOxDvh.js} +4 -3
- package/dist/docs/assets/{reference_cli.md.D9KESDsD.lean.js → reference_cli.md.BsMOxDvh.lean.js} +1 -1
- package/dist/docs/assets/{reference_connections.md.DB6SsN6U.js → reference_connections.md.BH8Oc0D0.js} +5 -5
- package/dist/docs/assets/{reference_connections.md.DB6SsN6U.lean.js → reference_connections.md.BH8Oc0D0.lean.js} +1 -1
- package/dist/docs/assets/{reference_hooks.md.BxN87gCw.js → reference_hooks.md.a8BJxMR5.js} +1 -1
- package/dist/docs/assets/reference_http-api.md.D89k1mdm.js +11 -0
- package/dist/docs/assets/reference_http-api.md.D89k1mdm.lean.js +1 -0
- package/dist/docs/assets/reference_project-layout.md.Bv4KOtlB.js +19 -0
- package/dist/docs/assets/{reference_subagents.md.Xoav0AII.js → reference_subagents.md.CfsIloPm.js} +1 -1
- package/dist/docs/assets/{reference_tools.md.DuKvkYWG.js → reference_tools.md.BHeXn2id.js} +3 -3
- package/dist/docs/assets/{reference_tools.md.DuKvkYWG.lean.js → reference_tools.md.BHeXn2id.lean.js} +1 -1
- package/dist/docs/assets/{templates_agentic-owners.md.DqtPdm6f.js → templates_agentic-owners.md.BZSH4N9z.js} +1 -1
- package/dist/docs/assets/{templates_demo.md.DhFcWN6j.js → templates_demo.md.BeQX9V3H.js} +1 -1
- package/dist/docs/assets/{templates_pr-autofixer.md.R4K_qytS.js → templates_pr-autofixer.md.x5zl6-GT.js} +2 -2
- package/dist/docs/assets/{templates_pr-autofixer.md.R4K_qytS.lean.js → templates_pr-autofixer.md.x5zl6-GT.lean.js} +1 -1
- package/dist/docs/assets/templates_security-help.md.C3Ny_Qr2.js +4 -0
- package/dist/docs/assets/templates_security-help.md.C3Ny_Qr2.lean.js +1 -0
- package/dist/docs/assets/{templates_security-reviewer.md.ByFyRta2.js → templates_security-reviewer.md.lshxbCLK.js} +2 -2
- package/dist/docs/assets/{templates_security-reviewer.md.ByFyRta2.lean.js → templates_security-reviewer.md.lshxbCLK.lean.js} +1 -1
- package/dist/docs/assets/{templates_triage.md.CVlpctKS.js → templates_triage.md.Co4UNzkZ.js} +3 -3
- package/dist/docs/assets/{templates_triage.md.CVlpctKS.lean.js → templates_triage.md.Co4UNzkZ.lean.js} +1 -1
- package/dist/docs/assets/troubleshooting.md.Ctv3T8C2.js +1 -0
- package/dist/docs/building-with-agents.html +4 -4
- package/dist/docs/concepts.html +5 -5
- package/dist/docs/concepts.md +1 -0
- package/dist/docs/deployment.html +7 -12
- package/dist/docs/deployment.md +1 -20
- package/dist/docs/design/agsh.md +406 -0
- package/dist/docs/evals.html +4 -4
- package/dist/docs/guides/agent-to-agent.html +6 -6
- package/dist/docs/guides/agent-to-agent.md +2 -2
- package/dist/docs/guides/cloud-runtime.html +6 -6
- package/dist/docs/guides/cloud-runtime.md +1 -0
- package/dist/docs/guides/convert-automation.html +6 -6
- package/dist/docs/guides/convert-automation.md +1 -1
- package/dist/docs/guides/github.html +6 -6
- package/dist/docs/guides/github.md +4 -4
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/mcp-oauth.html +11 -13
- package/dist/docs/guides/mcp-oauth.md +10 -18
- package/dist/docs/guides/opentelemetry.html +5 -5
- package/dist/docs/guides/slack.html +9 -15
- package/dist/docs/guides/slack.md +9 -46
- 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 +3 -29
- package/dist/docs/llms-full.txt +756 -2810
- package/dist/docs/llms.txt +3 -16
- package/dist/docs/quickstart.html +6 -6
- package/dist/docs/quickstart.md +2 -3
- package/dist/docs/reference/agent-config.html +4 -4
- package/dist/docs/reference/artifacts.html +4 -4
- package/dist/docs/reference/channels.html +4 -4
- package/dist/docs/reference/cli.html +8 -7
- package/dist/docs/reference/cli.md +5 -2
- package/dist/docs/reference/connections.html +9 -9
- package/dist/docs/reference/connections.md +15 -11
- package/dist/docs/reference/hooks.html +6 -6
- package/dist/docs/reference/hooks.md +2 -3
- package/dist/docs/reference/http-api.html +6 -6
- package/dist/docs/reference/http-api.md +8 -0
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +4 -4
- package/dist/docs/reference/project-layout.html +8 -6
- package/dist/docs/reference/project-layout.md +5 -1
- package/dist/docs/reference/prompt.html +4 -4
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +4 -4
- package/dist/docs/reference/skills.html +4 -4
- package/dist/docs/reference/subagents.html +6 -6
- package/dist/docs/reference/subagents.md +2 -2
- package/dist/docs/reference/tools.html +7 -7
- package/dist/docs/reference/tools.md +19 -3
- package/dist/docs/scaffolding-agents.html +4 -4
- package/dist/docs/storage.html +4 -4
- package/dist/docs/templates/agentic-owners.html +7 -7
- package/dist/docs/templates/agentic-owners.md +1 -1
- package/dist/docs/templates/demo.html +6 -6
- package/dist/docs/templates/demo.md +3 -2
- package/dist/docs/templates/pr-autofixer.html +6 -6
- package/dist/docs/templates/pr-autofixer.md +8 -13
- package/dist/docs/templates/security-help.html +30 -0
- package/dist/docs/templates/security-help.md +65 -0
- package/dist/docs/templates/security-reviewer.html +6 -6
- package/dist/docs/templates/security-reviewer.md +1 -3
- package/dist/docs/templates/triage.html +7 -7
- package/dist/docs/templates/triage.md +2 -6
- package/dist/docs/troubleshooting.html +5 -5
- package/dist/docs/troubleshooting.md +2 -2
- package/dist/files-backends/cursor-hosted.d.ts +6 -2
- package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/files-backends/cursor-hosted.js +2 -2
- package/dist/files.d.ts +2 -0
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/advertise-tools.d.ts +11 -0
- package/dist/internal/advertise-tools.d.ts.map +1 -1
- package/dist/internal/advertise-tools.js +47 -9
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +135 -6
- package/dist/internal/cli-mcp-oauth.d.ts.map +1 -1
- package/dist/internal/cli-mcp-oauth.js +7 -4
- package/dist/internal/conversation-mirror.d.ts +82 -0
- package/dist/internal/conversation-mirror.d.ts.map +1 -0
- package/dist/internal/conversation-mirror.js +251 -0
- package/dist/internal/convert-automation/convert-workflow.d.ts.map +1 -1
- package/dist/internal/convert-automation/convert-workflow.js +26 -15
- package/dist/internal/convert-automation/slug.d.ts +0 -2
- package/dist/internal/convert-automation/slug.d.ts.map +1 -1
- package/dist/internal/convert-automation/slug.js +0 -8
- package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
- package/dist/internal/cursor/account-mcp.js +5 -1
- package/dist/internal/deferred-channel-session.d.ts +20 -0
- package/dist/internal/deferred-channel-session.d.ts.map +1 -0
- package/dist/internal/deferred-channel-session.js +62 -0
- package/dist/internal/deploy-client.d.ts +13 -1
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +11 -1
- package/dist/internal/deploy-manifest.d.ts.map +1 -1
- package/dist/internal/deploy-manifest.js +11 -5
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +110 -15
- package/dist/internal/framework-storage-selection.d.ts +32 -16
- package/dist/internal/framework-storage-selection.d.ts.map +1 -1
- package/dist/internal/framework-storage-selection.js +51 -17
- package/dist/internal/hosted-admission-context.d.ts +20 -0
- package/dist/internal/hosted-admission-context.d.ts.map +1 -0
- package/dist/internal/hosted-admission-context.js +31 -0
- package/dist/internal/hosted-delivery-protocol.d.ts +5 -0
- package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
- package/dist/internal/hosted-delivery-protocol.js +33 -1
- package/dist/internal/hosted-delivery.d.ts +4 -2
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +97 -44
- package/dist/internal/hosted-managed-automation.d.ts +30 -0
- package/dist/internal/hosted-managed-automation.d.ts.map +1 -0
- package/dist/internal/hosted-managed-automation.js +58 -0
- package/dist/internal/mcp-endpoint.js +3 -3
- package/dist/internal/mcp-host.d.ts +8 -7
- package/dist/internal/mcp-host.d.ts.map +1 -1
- package/dist/internal/mcp-host.js +8 -7
- package/dist/internal/peer-connections.d.ts.map +1 -1
- package/dist/internal/peer-connections.js +5 -1
- package/dist/internal/playground/static.d.ts +0 -3
- package/dist/internal/playground/static.d.ts.map +1 -1
- package/dist/internal/resolved-connections.d.ts.map +1 -1
- package/dist/internal/resolved-connections.js +5 -7
- package/dist/internal/review-comments.d.ts.map +1 -1
- package/dist/internal/review-comments.js +10 -98
- package/dist/internal/scm/pr-url.d.ts +14 -0
- package/dist/internal/scm/pr-url.d.ts.map +1 -0
- package/dist/internal/scm/pr-url.js +65 -0
- package/dist/internal/sdk-runner.d.ts +14 -0
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +41 -2
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +123 -174
- package/dist/internal/session-engine.d.ts +45 -10
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +217 -65
- package/dist/internal/tool-catalog.d.ts +31 -0
- package/dist/internal/tool-catalog.d.ts.map +1 -0
- package/dist/internal/tool-catalog.js +67 -0
- package/dist/playground/assets/index-CF7hUDnQ.css +1 -0
- package/dist/playground/assets/{index-D9MFzhNE.js → index-CZA1uEWA.js} +48 -48
- package/dist/playground/index.html +2 -2
- package/dist/storage-backends/cursor-hosted.d.ts +7 -2
- package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/storage-backends/cursor-hosted.js +2 -2
- package/dist/types.d.ts +72 -23
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +19 -0
- package/docs/README.md +3 -29
- package/docs/concepts.md +1 -0
- package/docs/deployment.md +1 -20
- package/docs/design/agsh.md +406 -0
- package/docs/guides/agent-to-agent.md +2 -2
- package/docs/guides/cloud-runtime.md +1 -0
- package/docs/guides/convert-automation.md +1 -1
- package/docs/guides/github.md +4 -4
- package/docs/guides/mcp-oauth.md +10 -18
- package/docs/guides/slack.md +10 -47
- package/docs/quickstart.md +2 -3
- package/docs/reference/cli.md +5 -2
- package/docs/reference/connections.md +15 -11
- package/docs/reference/hooks.md +2 -3
- package/docs/reference/http-api.md +8 -0
- package/docs/reference/project-layout.md +5 -1
- package/docs/reference/subagents.md +2 -2
- package/docs/reference/tools.md +19 -3
- package/docs/templates/agentic-owners.md +1 -1
- package/docs/templates/demo.md +3 -2
- package/docs/templates/pr-autofixer.md +8 -13
- package/docs/templates/security-help.md +70 -0
- package/docs/templates/security-reviewer.md +1 -3
- package/docs/templates/triage.md +2 -6
- package/docs/troubleshooting.md +2 -2
- package/package.json +9 -2
- package/skills/create-agent/SKILL.md +6 -13
- package/skills/debug/SKILL.md +2 -4
- package/skills/evals/SKILL.md +1 -1
- package/skills/framework-map/SKILL.md +3 -2
- package/skills/mcp-auth/SKILL.md +10 -13
- package/skills/setup-slack/SKILL.md +21 -137
- package/src/channels/github/github-channel.ts +23 -8
- package/src/channels/github/types.ts +19 -2
- package/src/channels/origin/origin-channel.ts +13 -1
- package/src/channels/origin/origin-webhook.ts +27 -3
- package/src/channels/origin/types.ts +8 -0
- package/src/channels/slack/attachments.ts +2 -2
- package/src/channels/slack/dispatch.ts +2 -16
- package/src/channels/slack/eval-directive.ts +8 -27
- package/src/channels/slack/index.ts +0 -6
- package/src/channels/slack/pr-ref.ts +56 -25
- package/src/channels/slack/setup.ts +8 -15
- package/src/channels/slack/slack-channel.ts +14 -125
- package/src/channels/slack/types.ts +12 -96
- package/src/client.ts +23 -0
- package/src/connections.ts +20 -7
- package/src/files-backends/cursor-hosted.ts +9 -3
- package/src/files.ts +11 -0
- package/src/index.ts +2 -0
- package/src/internal/advertise-tools.ts +45 -7
- package/src/internal/cli-deploy.ts +171 -7
- package/src/internal/cli-mcp-oauth.ts +6 -4
- package/src/internal/conversation-mirror.ts +330 -0
- package/src/internal/convert-automation/convert-workflow.ts +29 -17
- package/src/internal/convert-automation/slug.ts +0 -9
- package/src/internal/cursor/account-mcp.ts +4 -1
- package/src/internal/deferred-channel-session.ts +61 -0
- package/src/internal/deploy-client.ts +24 -1
- package/src/internal/deploy-manifest.ts +10 -5
- package/src/internal/discovery.ts +129 -15
- package/src/internal/fixtures/units-server.ts +52 -0
- package/src/internal/framework-storage-selection.ts +61 -19
- package/src/internal/hosted-admission-context.ts +37 -0
- package/src/internal/hosted-delivery-protocol.ts +44 -1
- package/src/internal/hosted-delivery.ts +155 -68
- package/src/internal/hosted-managed-automation.ts +72 -0
- package/src/internal/mcp-endpoint.ts +3 -3
- package/src/internal/mcp-host.ts +8 -7
- package/src/internal/peer-connections.ts +4 -1
- package/src/internal/playground/static.ts +1 -3
- package/src/internal/resolved-connections.ts +8 -10
- package/src/internal/review-comments.ts +10 -113
- package/src/internal/scm/pr-url.ts +95 -0
- package/src/internal/sdk-runner.ts +57 -2
- package/src/internal/server.ts +161 -251
- package/src/internal/session-engine.ts +266 -69
- package/src/internal/tool-catalog.ts +106 -0
- package/src/storage-backends/cursor-hosted.ts +10 -3
- package/src/types.ts +90 -23
- package/templates/agentic-owners/README.md +1 -1
- package/templates/agentic-owners/agent/agent.ts +0 -10
- package/templates/agentic-owners/agent/channels/github.ts +5 -14
- package/templates/agentic-owners/agent/lib/config.ts +0 -8
- package/templates/agentic-owners/agent/lib/review.ts +2 -15
- package/templates/agentic-owners/agent/tools/record_review.ts +2 -4
- package/templates/demo/agent/agent.ts +0 -10
- package/templates/pr-autofixer/README.md +0 -2
- package/templates/pr-autofixer/agent/agent.ts +0 -11
- package/templates/pr-autofixer/agent/channels/slack.ts +1 -2
- package/templates/pr-autofixer/agent/lib/pr-state.ts +5 -17
- package/templates/pr-autofixer/agent/lib/repos.ts +0 -1
- package/templates/security-help/README.md +2 -2
- package/templates/security-help/agent/agent.ts +1 -2
- package/templates/security-help/agent/channels/slack.ts +0 -3
- package/templates/security-help/agent/instructions.md +9 -10
- package/templates/security-help/agent/skills/access-request.md +1 -1
- package/templates/security-help/agent/skills/faq.md +31 -0
- package/templates/security-help/agent/skills/security-playbooks.md +1 -1
- package/templates/security-help/package.json +1 -2
- package/templates/security-reviewer/agent/agent.ts +0 -10
- package/templates/triage/README.md +2 -1
- package/templates/triage/agent/agent.ts +0 -10
- package/templates/triage/agent/channels/queue.ts +1 -1
- package/templates/triage/agent/channels/webhook.ts +1 -3
- package/templates/triage/overlays/jira/agent/mcp-connections/tracker.ts +0 -1
- package/templates/triage/overlays/linear/agent/mcp-connections/tracker.ts +0 -1
- package/dist/channels/slack/cursor-account.d.ts +0 -87
- package/dist/channels/slack/cursor-account.d.ts.map +0 -1
- package/dist/channels/slack/cursor-account.js +0 -100
- package/dist/docs/assets/chunks/@localSearchIndexroot.ChpIC3Zy.js +0 -1
- package/dist/docs/assets/concepts.md.F6AiPorA.js +0 -1
- package/dist/docs/assets/example-agents_approval-buddy.md.DmezILPg.js +0 -10
- package/dist/docs/assets/example-agents_approval-buddy.md.DmezILPg.lean.js +0 -1
- package/dist/docs/assets/example-agents_benny.md.B0kwY7D_.js +0 -5
- package/dist/docs/assets/example-agents_benny.md.B0kwY7D_.lean.js +0 -1
- package/dist/docs/assets/example-agents_bugbot.md.BRGMi9O2.js +0 -11
- package/dist/docs/assets/example-agents_bugbot.md.BRGMi9O2.lean.js +0 -1
- package/dist/docs/assets/example-agents_codebase-wiki.md.BBNw9Ekr.js +0 -8
- package/dist/docs/assets/example-agents_codebase-wiki.md.BBNw9Ekr.lean.js +0 -1
- package/dist/docs/assets/example-agents_codeowners-review.md.Bfta-lBU.js +0 -8
- package/dist/docs/assets/example-agents_codeowners-review.md.Bfta-lBU.lean.js +0 -1
- package/dist/docs/assets/example-agents_concierge.md.BzB2b20R.js +0 -22
- package/dist/docs/assets/example-agents_concierge.md.BzB2b20R.lean.js +0 -1
- package/dist/docs/assets/example-agents_index.md.ChBp0AX6.js +0 -2
- package/dist/docs/assets/example-agents_index.md.ChBp0AX6.lean.js +0 -1
- package/dist/docs/assets/example-agents_knowledge-base.md.CrA85ig-.js +0 -11
- package/dist/docs/assets/example-agents_knowledge-base.md.CrA85ig-.lean.js +0 -1
- package/dist/docs/assets/example-agents_oncall.md.DK4XkYTd.js +0 -10
- package/dist/docs/assets/example-agents_oncall.md.DK4XkYTd.lean.js +0 -1
- package/dist/docs/assets/example-agents_security-reviewer.md.74pPpWYj.js +0 -19
- package/dist/docs/assets/example-agents_security-reviewer.md.74pPpWYj.lean.js +0 -1
- package/dist/docs/assets/example-agents_slack-agent.md.D7Kdj5BV.js +0 -5
- package/dist/docs/assets/example-agents_slack-agent.md.D7Kdj5BV.lean.js +0 -1
- package/dist/docs/assets/example-agents_weather-agent.md.CaGpmw3Y.js +0 -25
- package/dist/docs/assets/example-agents_weather-agent.md.CaGpmw3Y.lean.js +0 -1
- package/dist/docs/assets/guides_cloud-runtime.md.BnvjPiia.js +0 -9
- package/dist/docs/assets/guides_cloud-runtime.md.BnvjPiia.lean.js +0 -1
- package/dist/docs/assets/guides_slack.md.mqeNKs84.lean.js +0 -1
- package/dist/docs/assets/index.md.B-lVR4wT.js +0 -5
- package/dist/docs/assets/reference_http-api.md.C68BERYr.js +0 -11
- package/dist/docs/assets/reference_http-api.md.C68BERYr.lean.js +0 -1
- package/dist/docs/assets/reference_project-layout.md.WN9nwJht.js +0 -17
- package/dist/docs/assets/troubleshooting.md.vCWwvqcJ.js +0 -1
- package/dist/docs/example-agents/approval-buddy.html +0 -36
- package/dist/docs/example-agents/approval-buddy.md +0 -266
- package/dist/docs/example-agents/benny.html +0 -31
- package/dist/docs/example-agents/benny.md +0 -173
- package/dist/docs/example-agents/bugbot.html +0 -37
- package/dist/docs/example-agents/bugbot.md +0 -229
- package/dist/docs/example-agents/codebase-wiki.html +0 -34
- package/dist/docs/example-agents/codebase-wiki.md +0 -167
- package/dist/docs/example-agents/codeowners-review.html +0 -34
- package/dist/docs/example-agents/codeowners-review.md +0 -192
- package/dist/docs/example-agents/concierge.html +0 -48
- package/dist/docs/example-agents/concierge.md +0 -200
- package/dist/docs/example-agents/index.html +0 -28
- package/dist/docs/example-agents/index.md +0 -99
- package/dist/docs/example-agents/knowledge-base.html +0 -37
- package/dist/docs/example-agents/knowledge-base.md +0 -168
- package/dist/docs/example-agents/oncall.html +0 -36
- package/dist/docs/example-agents/oncall.md +0 -212
- package/dist/docs/example-agents/security-reviewer.html +0 -45
- package/dist/docs/example-agents/security-reviewer.md +0 -265
- package/dist/docs/example-agents/slack-agent.html +0 -31
- package/dist/docs/example-agents/slack-agent.md +0 -142
- package/dist/docs/example-agents/weather-agent.html +0 -51
- package/dist/docs/example-agents/weather-agent.md +0 -297
- package/dist/internal/cursor-slack-relay.d.ts +0 -96
- package/dist/internal/cursor-slack-relay.d.ts.map +0 -1
- package/dist/internal/cursor-slack-relay.js +0 -176
- package/dist/playground/assets/index-D9N7-q97.css +0 -1
- package/docs/example-agents/approval-buddy.md +0 -271
- package/docs/example-agents/benny.md +0 -178
- package/docs/example-agents/bugbot.md +0 -234
- package/docs/example-agents/codebase-wiki.md +0 -172
- package/docs/example-agents/codeowners-review.md +0 -197
- package/docs/example-agents/concierge.md +0 -205
- package/docs/example-agents/index.md +0 -104
- package/docs/example-agents/knowledge-base.md +0 -173
- package/docs/example-agents/oncall.md +0 -217
- package/docs/example-agents/security-reviewer.md +0 -270
- package/docs/example-agents/slack-agent.md +0 -147
- package/docs/example-agents/weather-agent.md +0 -302
- package/src/channels/slack/cursor-account.ts +0 -202
- package/src/internal/cursor-slack-relay.ts +0 -249
- package/templates/security-help/agent/knowledge/faq/approvals.md +0 -5
- package/templates/security-help/agent/knowledge/faq/channels.md +0 -6
- package/templates/security-help/agent/knowledge/faq/phishing.md +0 -10
- package/templates/security-help/agent/skills/security-first-pass.md +0 -15
- /package/dist/docs/assets/{concepts.md.F6AiPorA.lean.js → concepts.md.lwAgBIMI.lean.js} +0 -0
- /package/dist/docs/assets/{guides_agent-to-agent.md.B3JIaAqz.lean.js → guides_agent-to-agent.md.BDb0t1QV.lean.js} +0 -0
- /package/dist/docs/assets/{guides_convert-automation.md.Bboisykk.lean.js → guides_convert-automation.md.B4sjlodG.lean.js} +0 -0
- /package/dist/docs/assets/{guides_github.md.DqJhuaN1.lean.js → guides_github.md.Cnh2mL4a.lean.js} +0 -0
- /package/dist/docs/assets/{quickstart.md.BrmfrrIr.lean.js → quickstart.md.Nj_LjW_a.lean.js} +0 -0
- /package/dist/docs/assets/{reference_hooks.md.BxN87gCw.lean.js → reference_hooks.md.a8BJxMR5.lean.js} +0 -0
- /package/dist/docs/assets/{reference_project-layout.md.WN9nwJht.lean.js → reference_project-layout.md.Bv4KOtlB.lean.js} +0 -0
- /package/dist/docs/assets/{reference_subagents.md.Xoav0AII.lean.js → reference_subagents.md.CfsIloPm.lean.js} +0 -0
- /package/dist/docs/assets/{templates_agentic-owners.md.DqtPdm6f.lean.js → templates_agentic-owners.md.BZSH4N9z.lean.js} +0 -0
- /package/dist/docs/assets/{templates_demo.md.DhFcWN6j.lean.js → templates_demo.md.BeQX9V3H.lean.js} +0 -0
- /package/dist/docs/assets/{troubleshooting.md.vCWwvqcJ.lean.js → troubleshooting.md.Ctv3T8C2.lean.js} +0 -0
package/src/internal/server.ts
CHANGED
|
@@ -38,12 +38,6 @@ import {
|
|
|
38
38
|
parseCursorOriginRepoScope,
|
|
39
39
|
} from "../channels/origin/cursor-account.js";
|
|
40
40
|
import { findOriginChannelTargets } from "../channels/origin/origin-channel.js";
|
|
41
|
-
import {
|
|
42
|
-
dispatchCursorSlackEnvelope,
|
|
43
|
-
getSlackCursorAccountRuntime,
|
|
44
|
-
type SlackCursorAccountRuntime,
|
|
45
|
-
} from "../channels/slack/cursor-account.js";
|
|
46
|
-
import { assertSlackCursorAgentName } from "../channels/slack/types.js";
|
|
47
41
|
import { allowAll, bearerAuth, localDevStrict } from "../channels.js";
|
|
48
42
|
import type {
|
|
49
43
|
AgentProject,
|
|
@@ -57,6 +51,7 @@ import type {
|
|
|
57
51
|
ServeOptions,
|
|
58
52
|
} from "../types.js";
|
|
59
53
|
import { V2EngineError } from "./continuation-identity.js";
|
|
54
|
+
import { selectConversationMirror } from "./conversation-mirror.js";
|
|
60
55
|
import {
|
|
61
56
|
type CursorAccountConnectionRef,
|
|
62
57
|
CursorAccountMcpBridge,
|
|
@@ -88,12 +83,6 @@ import {
|
|
|
88
83
|
scmMetadataToOriginPayload,
|
|
89
84
|
} from "./cursor-event-relay.js";
|
|
90
85
|
import { AGENT_SERVE_GENERATION_ENV_VAR } from "./cursor-relay-core.js";
|
|
91
|
-
import {
|
|
92
|
-
type CursorSlackAgentRegistration,
|
|
93
|
-
CursorSlackRelay,
|
|
94
|
-
createCursorSlackApiCaller,
|
|
95
|
-
formatCursorSlackEventLog,
|
|
96
|
-
} from "./cursor-slack-relay.js";
|
|
97
86
|
import { buildAgentDeployManifest } from "./deploy-manifest.js";
|
|
98
87
|
import {
|
|
99
88
|
formatDiagnostics,
|
|
@@ -178,19 +167,22 @@ import {
|
|
|
178
167
|
resolveMountConnections,
|
|
179
168
|
validateMountConnectionsConfig,
|
|
180
169
|
} from "./resolved-connections.js";
|
|
181
|
-
import { Router } from "./router.js";
|
|
170
|
+
import { Router, type ServerRouteContext } from "./router.js";
|
|
182
171
|
import { RuntimeDispatchingRunner } from "./runtime-dispatch-runner.js";
|
|
183
172
|
import { ScheduleRunner, UnknownScheduleError } from "./schedule-runner.js";
|
|
184
173
|
import { type AgentRunner, CursorSdkRunner } from "./sdk-runner.js";
|
|
185
174
|
import {
|
|
175
|
+
InvalidContinuationTokenError,
|
|
186
176
|
SessionAuthError,
|
|
187
177
|
SessionBusyError,
|
|
188
178
|
SessionEngine,
|
|
189
179
|
ToolInputError,
|
|
190
180
|
ToolNotDirectlyCallableError,
|
|
191
181
|
UnknownToolError,
|
|
182
|
+
WorkspaceUnavailableError,
|
|
192
183
|
} from "./session-engine.js";
|
|
193
184
|
import { sessionUrlsForRequest } from "./session-urls.js";
|
|
185
|
+
import { catalogDetailEntry, catalogListEntry } from "./tool-catalog.js";
|
|
194
186
|
|
|
195
187
|
function memoryHealthFields(engines: readonly SessionEngine[]) {
|
|
196
188
|
return collectMemoryHealthFields({
|
|
@@ -525,12 +517,21 @@ export async function startServer(
|
|
|
525
517
|
"[agent-sdk] warning: --allow-anonymous admits every HTTP caller as the same principal; use only on a trusted network (e.g. Tailscale) and prefer --bearer-token for shared hosts"
|
|
526
518
|
);
|
|
527
519
|
}
|
|
520
|
+
// v2 hosted engines mirror the SDK conversation store to the deployment's
|
|
521
|
+
// shared file storage so a fresh pod resumes threads instead of forking
|
|
522
|
+
// them. Hosted serve is single-agent; a multi-mount serve (dev) has no
|
|
523
|
+
// single agent name to mint keys under and does not mirror.
|
|
524
|
+
const conversationMirror =
|
|
525
|
+
mounts.length === 1 && mounts[0] !== undefined
|
|
526
|
+
? selectConversationMirror({ project: mounts[0].project, logger })
|
|
527
|
+
: undefined;
|
|
528
528
|
const sdkRunner =
|
|
529
529
|
options.runner ??
|
|
530
530
|
new CursorSdkRunner({
|
|
531
531
|
...(options.apiKey === undefined || options.apiKey.trim() === ""
|
|
532
532
|
? {}
|
|
533
533
|
: { apiKey: options.apiKey }),
|
|
534
|
+
...(conversationMirror === undefined ? {} : { conversationMirror }),
|
|
534
535
|
logger,
|
|
535
536
|
});
|
|
536
537
|
// Grok Bot turns run on Cursor's hosted Grok Bot (Sand) harness through
|
|
@@ -929,22 +930,7 @@ export async function startServer(
|
|
|
929
930
|
});
|
|
930
931
|
}
|
|
931
932
|
|
|
932
|
-
|
|
933
|
-
// `slackChannel({ cursorAccount: true })`. Inbound rides the account's
|
|
934
|
-
// Slack connection (`/v0/slack-events`); the classic Socket-Mode path is
|
|
935
|
-
// untouched for channels with their own Slack app tokens.
|
|
936
|
-
const cursorSlackRelay = await startCursorSlackRelay({
|
|
937
|
-
options,
|
|
938
|
-
runtimes,
|
|
939
|
-
accountKey,
|
|
940
|
-
logger,
|
|
941
|
-
});
|
|
942
|
-
try {
|
|
943
|
-
await cursorGithubCredentials?.start();
|
|
944
|
-
} catch (error) {
|
|
945
|
-
await cursorSlackRelay?.stop();
|
|
946
|
-
throw error;
|
|
947
|
-
}
|
|
933
|
+
await cursorGithubCredentials?.start();
|
|
948
934
|
|
|
949
935
|
// Cursor SCM events: v1 stays on the engine poll. v2 ingest is local-CP
|
|
950
936
|
// only — hosted `--no-control-plane` skips the July poll (hosted CP wakes).
|
|
@@ -1020,7 +1006,6 @@ export async function startServer(
|
|
|
1020
1006
|
await cursorDeploymentRelay?.stop();
|
|
1021
1007
|
await cursorEventRelay?.stop();
|
|
1022
1008
|
await controlPlaneScmRelay?.stop();
|
|
1023
|
-
await cursorSlackRelay?.stop();
|
|
1024
1009
|
cursorGithubCredentials?.stop();
|
|
1025
1010
|
await shutdownOtelRuntime(otelRuntime);
|
|
1026
1011
|
throw error;
|
|
@@ -1187,7 +1172,6 @@ export async function startServer(
|
|
|
1187
1172
|
await cursorDeploymentRelay?.stop();
|
|
1188
1173
|
await cursorEventRelay?.stop();
|
|
1189
1174
|
await controlPlaneScmRelay?.stop();
|
|
1190
|
-
await cursorSlackRelay?.stop();
|
|
1191
1175
|
for (const runtime of runtimes) {
|
|
1192
1176
|
runtime.controlPlane?.stop();
|
|
1193
1177
|
runtime.scheduleRunner.stop();
|
|
@@ -1540,6 +1524,123 @@ function mountAgentRoutes(
|
|
|
1540
1524
|
});
|
|
1541
1525
|
}
|
|
1542
1526
|
|
|
1527
|
+
// The live tool catalog: the session's tool namespace as a turn would
|
|
1528
|
+
// assemble it — authored server tools plus advertised MCP passthroughs —
|
|
1529
|
+
// under model-facing names. `/v1/info` stays the static authored
|
|
1530
|
+
// manifest; this is the runtime view only the running deployment can
|
|
1531
|
+
// answer. `session` / `continuationToken` query parameters bind the
|
|
1532
|
+
// listing to a session identity (advertised inventories can be
|
|
1533
|
+
// tenant-scoped and resolved per session).
|
|
1534
|
+
const resolveCatalogBinding = async (
|
|
1535
|
+
request: Request,
|
|
1536
|
+
ctx: Pick<ServerRouteContext, "auth" | "requestIp">
|
|
1537
|
+
): Promise<
|
|
1538
|
+
| { sessionId?: string; continuationToken?: string }
|
|
1539
|
+
| { errorResponse: Response }
|
|
1540
|
+
> => {
|
|
1541
|
+
const url = new URL(request.url);
|
|
1542
|
+
const sessionId = url.searchParams.get("session") ?? undefined;
|
|
1543
|
+
const continuationToken =
|
|
1544
|
+
url.searchParams.get("continuationToken") ?? undefined;
|
|
1545
|
+
if (sessionId !== undefined) {
|
|
1546
|
+
const record = await engine.sessions.get(sessionId);
|
|
1547
|
+
if (record === undefined) {
|
|
1548
|
+
return {
|
|
1549
|
+
errorResponse: errorResponse(
|
|
1550
|
+
404,
|
|
1551
|
+
"session_not_found",
|
|
1552
|
+
`Unknown session ${sessionId}.`
|
|
1553
|
+
),
|
|
1554
|
+
};
|
|
1555
|
+
}
|
|
1556
|
+
const ownership = requireSessionOwner(record, ctx.auth, {
|
|
1557
|
+
relax: relaxSessionReadAuth,
|
|
1558
|
+
beyondLoopback: relaxSessionReadAuthBeyondLoopback,
|
|
1559
|
+
requestIp: ctx.requestIp,
|
|
1560
|
+
});
|
|
1561
|
+
if (ownership !== undefined) {
|
|
1562
|
+
return { errorResponse: ownership };
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
return { sessionId, continuationToken };
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1568
|
+
router.add({
|
|
1569
|
+
method: "GET",
|
|
1570
|
+
pattern: `${base}/v1/tools`,
|
|
1571
|
+
auth: httpAuth,
|
|
1572
|
+
handler: async (request, ctx) => {
|
|
1573
|
+
const binding = await resolveCatalogBinding(request, ctx);
|
|
1574
|
+
if ("errorResponse" in binding) {
|
|
1575
|
+
return binding.errorResponse;
|
|
1576
|
+
}
|
|
1577
|
+
try {
|
|
1578
|
+
const catalog = await engine.listCatalogTools({
|
|
1579
|
+
auth: ctx.auth,
|
|
1580
|
+
...binding,
|
|
1581
|
+
});
|
|
1582
|
+
return jsonResponse({
|
|
1583
|
+
tools: catalog.tools.map(catalogListEntry),
|
|
1584
|
+
// JSON.stringify drops the key when there is nothing to report.
|
|
1585
|
+
connectionErrors:
|
|
1586
|
+
catalog.connectionErrors.length === 0
|
|
1587
|
+
? undefined
|
|
1588
|
+
: catalog.connectionErrors,
|
|
1589
|
+
});
|
|
1590
|
+
} catch (error) {
|
|
1591
|
+
if (error instanceof InvalidContinuationTokenError) {
|
|
1592
|
+
return errorResponse(
|
|
1593
|
+
400,
|
|
1594
|
+
"invalid_continuation_token",
|
|
1595
|
+
error.message
|
|
1596
|
+
);
|
|
1597
|
+
}
|
|
1598
|
+
throw error;
|
|
1599
|
+
}
|
|
1600
|
+
},
|
|
1601
|
+
});
|
|
1602
|
+
|
|
1603
|
+
router.add({
|
|
1604
|
+
method: "GET",
|
|
1605
|
+
pattern: `${base}/v1/tools/:toolName`,
|
|
1606
|
+
auth: httpAuth,
|
|
1607
|
+
handler: async (request, ctx) => {
|
|
1608
|
+
const toolName = ctx.params.toolName ?? "";
|
|
1609
|
+
const binding = await resolveCatalogBinding(request, ctx);
|
|
1610
|
+
if ("errorResponse" in binding) {
|
|
1611
|
+
return binding.errorResponse;
|
|
1612
|
+
}
|
|
1613
|
+
try {
|
|
1614
|
+
const catalog = await engine.listCatalogTools({
|
|
1615
|
+
auth: ctx.auth,
|
|
1616
|
+
...binding,
|
|
1617
|
+
});
|
|
1618
|
+
const tool = catalog.tools.find((t) => t.name === toolName);
|
|
1619
|
+
if (tool === undefined) {
|
|
1620
|
+
return jsonResponse(
|
|
1621
|
+
{
|
|
1622
|
+
ok: false,
|
|
1623
|
+
error: "unknown_tool",
|
|
1624
|
+
message: `Unknown tool "${toolName}".`,
|
|
1625
|
+
availableTools: catalog.tools.map((t) => t.name),
|
|
1626
|
+
},
|
|
1627
|
+
{ status: 404 }
|
|
1628
|
+
);
|
|
1629
|
+
}
|
|
1630
|
+
return jsonResponse(catalogDetailEntry(tool));
|
|
1631
|
+
} catch (error) {
|
|
1632
|
+
if (error instanceof InvalidContinuationTokenError) {
|
|
1633
|
+
return errorResponse(
|
|
1634
|
+
400,
|
|
1635
|
+
"invalid_continuation_token",
|
|
1636
|
+
error.message
|
|
1637
|
+
);
|
|
1638
|
+
}
|
|
1639
|
+
throw error;
|
|
1640
|
+
}
|
|
1641
|
+
},
|
|
1642
|
+
});
|
|
1643
|
+
|
|
1543
1644
|
// Deterministic tool invocation: run an authored server tool directly,
|
|
1544
1645
|
// without a model turn deciding to call it.
|
|
1545
1646
|
router.add({
|
|
@@ -1563,6 +1664,17 @@ function mountAgentRoutes(
|
|
|
1563
1664
|
"`sessionId` must be a string when provided."
|
|
1564
1665
|
);
|
|
1565
1666
|
}
|
|
1667
|
+
if (
|
|
1668
|
+
body.continuationToken !== undefined &&
|
|
1669
|
+
typeof body.continuationToken !== "string"
|
|
1670
|
+
) {
|
|
1671
|
+
return errorResponse(
|
|
1672
|
+
400,
|
|
1673
|
+
"invalid_request",
|
|
1674
|
+
"`continuationToken` must be a string when provided."
|
|
1675
|
+
);
|
|
1676
|
+
}
|
|
1677
|
+
const continuationToken = body.continuationToken;
|
|
1566
1678
|
const sessionId = body.sessionId;
|
|
1567
1679
|
if (sessionId !== undefined) {
|
|
1568
1680
|
const record = await engine.sessions.get(sessionId);
|
|
@@ -1585,7 +1697,8 @@ function mountAgentRoutes(
|
|
|
1585
1697
|
try {
|
|
1586
1698
|
const outcome = await engine.callTool(toolName, body.input ?? {}, {
|
|
1587
1699
|
auth: ctx.auth,
|
|
1588
|
-
|
|
1700
|
+
sessionId,
|
|
1701
|
+
continuationToken,
|
|
1589
1702
|
});
|
|
1590
1703
|
return jsonResponse({ ok: !outcome.isError, ...outcome });
|
|
1591
1704
|
} catch (error) {
|
|
@@ -1606,6 +1719,16 @@ function mountAgentRoutes(
|
|
|
1606
1719
|
if (error instanceof ToolInputError) {
|
|
1607
1720
|
return errorResponse(400, "invalid_tool_input", error.message);
|
|
1608
1721
|
}
|
|
1722
|
+
if (error instanceof InvalidContinuationTokenError) {
|
|
1723
|
+
return errorResponse(
|
|
1724
|
+
400,
|
|
1725
|
+
"invalid_continuation_token",
|
|
1726
|
+
error.message
|
|
1727
|
+
);
|
|
1728
|
+
}
|
|
1729
|
+
if (error instanceof WorkspaceUnavailableError) {
|
|
1730
|
+
return errorResponse(500, "workspace_unavailable", error.message);
|
|
1731
|
+
}
|
|
1609
1732
|
throw error;
|
|
1610
1733
|
}
|
|
1611
1734
|
},
|
|
@@ -2410,54 +2533,11 @@ function resolveCursorOriginRepoScope(input: {
|
|
|
2410
2533
|
return parseCursorOriginRepoScope(repos);
|
|
2411
2534
|
}
|
|
2412
2535
|
|
|
2413
|
-
interface CursorSlackTarget {
|
|
2414
|
-
runtime: MountedRuntime;
|
|
2415
|
-
channelId: string;
|
|
2416
|
-
agentName: string;
|
|
2417
|
-
accountRuntime: SlackCursorAccountRuntime;
|
|
2418
|
-
}
|
|
2419
|
-
|
|
2420
|
-
/**
|
|
2421
|
-
* `weather-agent` → `WeatherAgent` (single-token Cursor Slack handle).
|
|
2422
|
-
* Must not contain whitespace — see {@link assertSlackCursorAgentName}.
|
|
2423
|
-
*/
|
|
2424
|
-
function slackAgentNameFromSlug(slug: string): string {
|
|
2425
|
-
return slug
|
|
2426
|
-
.split(/[-_\s]+/)
|
|
2427
|
-
.filter((word) => word.length > 0)
|
|
2428
|
-
.map((word) => word[0].toUpperCase() + word.slice(1))
|
|
2429
|
-
.join("");
|
|
2430
|
-
}
|
|
2431
|
-
|
|
2432
|
-
/**
|
|
2433
|
-
* Mounted Slack channels riding the Cursor account connection
|
|
2434
|
-
* (`slackChannel({ cursorAccount: true })`), with their registered names
|
|
2435
|
-
* resolved. Duplicate names are a startup error — the backend routes
|
|
2436
|
-
* `@Cursor <name> …` by name, so two mounts cannot share one.
|
|
2437
|
-
*/
|
|
2438
2536
|
function buildAgentIndexEntries(runtimes: MountedRuntime[]): AgentIndexEntry[] {
|
|
2439
|
-
const cursorSlackBySlug = new Map(
|
|
2440
|
-
collectCursorSlackTargets(runtimes).map((target) => [
|
|
2441
|
-
target.runtime.slug,
|
|
2442
|
-
target.agentName,
|
|
2443
|
-
])
|
|
2444
|
-
);
|
|
2445
2537
|
return runtimes.map(({ slug, project }) => {
|
|
2446
|
-
const
|
|
2447
|
-
|
|
2448
|
-
(channel) =>
|
|
2449
|
-
channel.definition.meta?.kind === "slack" &&
|
|
2450
|
-
channel.definition.meta?.slackCursorAccount !== true
|
|
2538
|
+
const hasSlack = project.channels.some(
|
|
2539
|
+
(channel) => channel.definition.meta?.kind === "slack"
|
|
2451
2540
|
);
|
|
2452
|
-
const slack =
|
|
2453
|
-
cursorName !== undefined
|
|
2454
|
-
? {
|
|
2455
|
-
kind: "cursor-account" as const,
|
|
2456
|
-
handle: `@Cursor ${cursorName}`,
|
|
2457
|
-
}
|
|
2458
|
-
: hasSocketSlack
|
|
2459
|
-
? { kind: "socket" as const }
|
|
2460
|
-
: undefined;
|
|
2461
2541
|
return {
|
|
2462
2542
|
slug,
|
|
2463
2543
|
name: project.name,
|
|
@@ -2467,60 +2547,11 @@ function buildAgentIndexEntries(runtimes: MountedRuntime[]): AgentIndexEntry[] {
|
|
|
2467
2547
|
: (project.agent.model?.id ?? ""),
|
|
2468
2548
|
tools: project.agent.tools.length,
|
|
2469
2549
|
channels: project.channels.length + 1,
|
|
2470
|
-
slack,
|
|
2550
|
+
slack: hasSlack ? { kind: "socket" as const } : undefined,
|
|
2471
2551
|
};
|
|
2472
2552
|
});
|
|
2473
2553
|
}
|
|
2474
2554
|
|
|
2475
|
-
function collectCursorSlackTargets(
|
|
2476
|
-
runtimes: MountedRuntime[]
|
|
2477
|
-
): CursorSlackTarget[] {
|
|
2478
|
-
const targets: CursorSlackTarget[] = [];
|
|
2479
|
-
const byName = new Map<string, string>();
|
|
2480
|
-
for (const runtime of runtimes) {
|
|
2481
|
-
for (const channel of runtime.project.channels) {
|
|
2482
|
-
const accountRuntime = getSlackCursorAccountRuntime(channel.definition);
|
|
2483
|
-
if (accountRuntime === undefined) {
|
|
2484
|
-
continue;
|
|
2485
|
-
}
|
|
2486
|
-
const agentName = (
|
|
2487
|
-
accountRuntime.options.agentName ??
|
|
2488
|
-
slackAgentNameFromSlug(
|
|
2489
|
-
runtime.slug === "" ? runtime.project.name : runtime.slug
|
|
2490
|
-
)
|
|
2491
|
-
).trim();
|
|
2492
|
-
if (agentName === "") {
|
|
2493
|
-
throw new Error(
|
|
2494
|
-
`slackChannel({ cursorAccount: true }) on agent "${runtime.slug || runtime.project.name}" resolved an empty agent name; set agentName.`
|
|
2495
|
-
);
|
|
2496
|
-
}
|
|
2497
|
-
assertSlackCursorAgentName(agentName);
|
|
2498
|
-
const nameKey = agentName.toLowerCase();
|
|
2499
|
-
const existing = byName.get(nameKey);
|
|
2500
|
-
if (existing !== undefined) {
|
|
2501
|
-
throw new Error(
|
|
2502
|
-
`Two agents register the Slack name "${agentName}" (${existing} and ${runtime.slug || runtime.project.name}); set agentName to disambiguate.`
|
|
2503
|
-
);
|
|
2504
|
-
}
|
|
2505
|
-
byName.set(nameKey, runtime.slug || runtime.project.name);
|
|
2506
|
-
targets.push({
|
|
2507
|
-
runtime,
|
|
2508
|
-
channelId: channel.id,
|
|
2509
|
-
agentName,
|
|
2510
|
-
accountRuntime,
|
|
2511
|
-
});
|
|
2512
|
-
}
|
|
2513
|
-
}
|
|
2514
|
-
return targets;
|
|
2515
|
-
}
|
|
2516
|
-
|
|
2517
|
-
/**
|
|
2518
|
-
* Automatic Cursor Slack relay for cursor-account Slack channels: registers
|
|
2519
|
-
* the mounted agents with `/v0/slack-events`, binds each channel's outbound
|
|
2520
|
-
* API transport to the backend proxy, and dispatches relayed envelopes into
|
|
2521
|
-
* the pack's normal inbound path. Requires a signed-in host — fail serve
|
|
2522
|
-
* fast rather than mounting channels that can never hear or speak.
|
|
2523
|
-
*/
|
|
2524
2555
|
interface CursorDeploymentTarget {
|
|
2525
2556
|
runtime: MountedRuntime;
|
|
2526
2557
|
channelId: string;
|
|
@@ -2558,7 +2589,7 @@ function collectCursorDeploymentTargets(
|
|
|
2558
2589
|
* `deploymentsChannel({ ... })`. One relay per process reads
|
|
2559
2590
|
* `/v0/deployment-events` for the union of every channel's deploy sources, and
|
|
2560
2591
|
* each event is routed to the channels that asked for it — the same ownership
|
|
2561
|
-
* `
|
|
2592
|
+
* `startCursorEventRelay` has.
|
|
2562
2593
|
*/
|
|
2563
2594
|
function startCursorDeploymentRelay(input: {
|
|
2564
2595
|
options: ServeOptions;
|
|
@@ -2617,8 +2648,8 @@ function startCursorDeploymentRelay(input: {
|
|
|
2617
2648
|
];
|
|
2618
2649
|
}
|
|
2619
2650
|
}
|
|
2620
|
-
// Same host split as scm-events
|
|
2621
|
-
//
|
|
2651
|
+
// Same host split as scm-events: `/v0/deployment-events/*` is on
|
|
2652
|
+
// api.cursor.com, not api2.
|
|
2622
2653
|
const baseStateRoot =
|
|
2623
2654
|
options.stateRoot ??
|
|
2624
2655
|
join(targets[0].runtime.project.rootDir, ".agent-serve");
|
|
@@ -2654,127 +2685,6 @@ function startCursorDeploymentRelay(input: {
|
|
|
2654
2685
|
return relay;
|
|
2655
2686
|
}
|
|
2656
2687
|
|
|
2657
|
-
async function startCursorSlackRelay(input: {
|
|
2658
|
-
options: ServeOptions;
|
|
2659
|
-
runtimes: MountedRuntime[];
|
|
2660
|
-
accountKey: ResolvedApiKey | undefined;
|
|
2661
|
-
logger: (line: string) => void;
|
|
2662
|
-
}): Promise<CursorSlackRelay | undefined> {
|
|
2663
|
-
const { options, runtimes, accountKey, logger } = input;
|
|
2664
|
-
const targets = collectCursorSlackTargets(runtimes);
|
|
2665
|
-
if (targets.length === 0) {
|
|
2666
|
-
return undefined;
|
|
2667
|
-
}
|
|
2668
|
-
if (accountKey === undefined) {
|
|
2669
|
-
if (options.allowAnonymous === true) {
|
|
2670
|
-
logger(
|
|
2671
|
-
"[agent-sdk] cursor-slack: skipped while unsigned; long-poll relays need a key at start"
|
|
2672
|
-
);
|
|
2673
|
-
return undefined;
|
|
2674
|
-
}
|
|
2675
|
-
throw new Error(
|
|
2676
|
-
`This project has Slack channels using the Cursor account connection (slackChannel({ cursorAccount: true })) but the host is not signed in to Cursor. ${SIGN_IN_HINT}`
|
|
2677
|
-
);
|
|
2678
|
-
}
|
|
2679
|
-
// Same host split as scm-events: `/v0/slack-events/*` is on api.cursor.com,
|
|
2680
|
-
// not api2 (accountKey.backendUrl 404s these routes).
|
|
2681
|
-
const baseUrl = cursorExternalApiUrl();
|
|
2682
|
-
const baseStateRoot =
|
|
2683
|
-
options.stateRoot ??
|
|
2684
|
-
join(targets[0].runtime.project.rootDir, ".agent-serve");
|
|
2685
|
-
const stateDir = join(baseStateRoot, "cursor-slack");
|
|
2686
|
-
|
|
2687
|
-
// Optional fields may be undefined — the relay JSON-serializes the
|
|
2688
|
-
// registration body, which drops them.
|
|
2689
|
-
const agents: CursorSlackAgentRegistration[] = targets.map((target) => {
|
|
2690
|
-
const policy = target.accountRuntime.options.policy;
|
|
2691
|
-
return {
|
|
2692
|
-
name: target.agentName,
|
|
2693
|
-
iconUrl: target.accountRuntime.options.agentIcon?.url,
|
|
2694
|
-
iconEmoji: target.accountRuntime.options.agentIcon?.emoji,
|
|
2695
|
-
blockExternals: policy?.blockExternals === false ? false : undefined,
|
|
2696
|
-
};
|
|
2697
|
-
});
|
|
2698
|
-
|
|
2699
|
-
const targetByName = new Map(
|
|
2700
|
-
targets.map((target) => [target.agentName.toLowerCase(), target])
|
|
2701
|
-
);
|
|
2702
|
-
const relay = new CursorSlackRelay({
|
|
2703
|
-
baseUrl,
|
|
2704
|
-
apiKey: accountKey.apiKey,
|
|
2705
|
-
agents,
|
|
2706
|
-
stateDir,
|
|
2707
|
-
logger,
|
|
2708
|
-
dispatch: async (envelope) => {
|
|
2709
|
-
const target = targetByName.get(envelope.agentName.toLowerCase());
|
|
2710
|
-
if (target === undefined) {
|
|
2711
|
-
return;
|
|
2712
|
-
}
|
|
2713
|
-
const args = buildChannelHandlerArgs({
|
|
2714
|
-
runtime: target.runtime,
|
|
2715
|
-
channelId: target.channelId,
|
|
2716
|
-
});
|
|
2717
|
-
logger(
|
|
2718
|
-
`[agent-sdk] cursor-slack: dispatching ${formatCursorSlackEventLog(envelope)} → ${target.runtime.slug || "default"}`
|
|
2719
|
-
);
|
|
2720
|
-
await dispatchCursorSlackEnvelope({
|
|
2721
|
-
runtime: target.accountRuntime,
|
|
2722
|
-
envelope,
|
|
2723
|
-
send: args.send,
|
|
2724
|
-
host: args.host,
|
|
2725
|
-
artifacts: args.artifacts,
|
|
2726
|
-
hasContinuationSession: (continuationToken) =>
|
|
2727
|
-
target.runtime.engine.hasContinuationSession(
|
|
2728
|
-
target.channelId,
|
|
2729
|
-
continuationToken
|
|
2730
|
-
),
|
|
2731
|
-
isContinuationBusy: (continuationToken) =>
|
|
2732
|
-
target.runtime.engine.isContinuationBusy(
|
|
2733
|
-
target.channelId,
|
|
2734
|
-
continuationToken
|
|
2735
|
-
),
|
|
2736
|
-
getContinuationLastBotMessageTs: (continuationToken) =>
|
|
2737
|
-
target.runtime.engine.getContinuationLastBotMessageTs(
|
|
2738
|
-
target.channelId,
|
|
2739
|
-
continuationToken
|
|
2740
|
-
),
|
|
2741
|
-
interruptContinuation: (continuationToken) =>
|
|
2742
|
-
target.runtime.engine.interruptContinuation(
|
|
2743
|
-
target.channelId,
|
|
2744
|
-
continuationToken
|
|
2745
|
-
),
|
|
2746
|
-
});
|
|
2747
|
-
},
|
|
2748
|
-
});
|
|
2749
|
-
|
|
2750
|
-
// Bind each channel's outbound transport before consumption starts so the
|
|
2751
|
-
// first reply can post. The consumer id keys thread claims server-side.
|
|
2752
|
-
const consumerId = await relay.resolveConsumerId();
|
|
2753
|
-
for (const target of targets) {
|
|
2754
|
-
target.accountRuntime.transport.bind(
|
|
2755
|
-
createCursorSlackApiCaller({
|
|
2756
|
-
baseUrl,
|
|
2757
|
-
apiKey: accountKey.apiKey,
|
|
2758
|
-
agentName: target.agentName,
|
|
2759
|
-
consumerId,
|
|
2760
|
-
logger,
|
|
2761
|
-
})
|
|
2762
|
-
);
|
|
2763
|
-
}
|
|
2764
|
-
|
|
2765
|
-
relay.start();
|
|
2766
|
-
logger(
|
|
2767
|
-
`[agent-sdk] cursor-slack: relaying Slack for ${targets
|
|
2768
|
-
.map(
|
|
2769
|
-
(target) => `${target.agentName} (${target.runtime.slug || "default"})`
|
|
2770
|
-
)
|
|
2771
|
-
.join(
|
|
2772
|
-
", "
|
|
2773
|
-
)} from ${baseUrl} — mention "@Cursor <agent name> …" in the linked workspace`
|
|
2774
|
-
);
|
|
2775
|
-
return relay;
|
|
2776
|
-
}
|
|
2777
|
-
|
|
2778
2688
|
function buildChannelHandlerArgs(input: {
|
|
2779
2689
|
runtime: MountedRuntime;
|
|
2780
2690
|
channelId: string;
|