@cursor/july 0.1.93 → 0.1.94
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/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/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.CFDEas4I.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.DU3U2Ij2.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.Cxy8ySFQ.js → VPLocalSearchBox.B1IIYpYS.js} +1 -1
- package/dist/docs/assets/chunks/{theme.Dvq1Bktu.js → theme.Ct4NSiLm.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.DRakGHFe.js +5 -0
- package/dist/docs/assets/{index.md.B-lVR4wT.lean.js → index.md.DRakGHFe.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.Cw6_ICYG.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_skills.md.BFW9retM.js → reference_skills.md.8son6Hjm.js} +3 -3
- 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_pr-autofixer.md.R4K_qytS.js → templates_pr-autofixer.md.DU7dQpor.js} +2 -2
- package/dist/docs/assets/{templates_pr-autofixer.md.R4K_qytS.lean.js → templates_pr-autofixer.md.DU7dQpor.lean.js} +1 -1
- package/dist/docs/assets/{templates_security-reviewer.md.ByFyRta2.js → templates_security-reviewer.md.CTa7u_l1.js} +2 -2
- package/dist/docs/assets/{templates_security-reviewer.md.ByFyRta2.lean.js → templates_security-reviewer.md.CTa7u_l1.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 +0 -28
- package/dist/docs/llms-full.txt +712 -2830
- package/dist/docs/llms.txt +2 -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 +6 -6
- package/dist/docs/reference/cli.md +2 -1
- 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 +7 -7
- 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 +4 -4
- package/dist/docs/templates/demo.html +4 -4
- package/dist/docs/templates/pr-autofixer.html +6 -6
- package/dist/docs/templates/pr-autofixer.md +4 -3
- package/dist/docs/templates/security-reviewer.html +5 -5
- package/dist/docs/templates/security-reviewer.md +2 -3
- package/dist/docs/templates/triage.html +4 -4
- package/dist/docs/troubleshooting.html +5 -5
- package/dist/docs/troubleshooting.md +2 -2
- 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-mcp-oauth.d.ts.map +1 -1
- package/dist/internal/cli-mcp-oauth.js +7 -4
- 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/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +88 -13
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +22 -9
- 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/server.d.ts.map +1 -1
- package/dist/internal/server.js +113 -172
- 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 +208 -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-D9MFzhNE.js → index-B3JCyigB.js} +1 -1
- package/dist/playground/index.html +1 -1
- 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 +0 -28
- 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 +2 -1
- 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/pr-autofixer.md +4 -3
- package/docs/templates/security-reviewer.md +2 -3
- 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/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/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/index.ts +2 -0
- package/src/internal/advertise-tools.ts +45 -7
- package/src/internal/cli-mcp-oauth.ts +6 -4
- 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/discovery.ts +104 -13
- package/src/internal/fixtures/units-server.ts +52 -0
- package/src/internal/hosted-delivery.ts +60 -28
- 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/server.ts +151 -251
- package/src/internal/session-engine.ts +254 -69
- package/src/internal/tool-catalog.ts +106 -0
- package/src/types.ts +90 -23
- package/templates/pr-autofixer/agent/channels/slack.ts +8 -2
- package/templates/triage/README.md +2 -1
- 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/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/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_cli.md.D9KESDsD.lean.js → reference_cli.md.Cw6_ICYG.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_skills.md.BFW9retM.lean.js → reference_skills.md.8son6Hjm.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/{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,
|
|
@@ -88,12 +82,6 @@ import {
|
|
|
88
82
|
scmMetadataToOriginPayload,
|
|
89
83
|
} from "./cursor-event-relay.js";
|
|
90
84
|
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
85
|
import { buildAgentDeployManifest } from "./deploy-manifest.js";
|
|
98
86
|
import {
|
|
99
87
|
formatDiagnostics,
|
|
@@ -178,19 +166,22 @@ import {
|
|
|
178
166
|
resolveMountConnections,
|
|
179
167
|
validateMountConnectionsConfig,
|
|
180
168
|
} from "./resolved-connections.js";
|
|
181
|
-
import { Router } from "./router.js";
|
|
169
|
+
import { Router, type ServerRouteContext } from "./router.js";
|
|
182
170
|
import { RuntimeDispatchingRunner } from "./runtime-dispatch-runner.js";
|
|
183
171
|
import { ScheduleRunner, UnknownScheduleError } from "./schedule-runner.js";
|
|
184
172
|
import { type AgentRunner, CursorSdkRunner } from "./sdk-runner.js";
|
|
185
173
|
import {
|
|
174
|
+
InvalidContinuationTokenError,
|
|
186
175
|
SessionAuthError,
|
|
187
176
|
SessionBusyError,
|
|
188
177
|
SessionEngine,
|
|
189
178
|
ToolInputError,
|
|
190
179
|
ToolNotDirectlyCallableError,
|
|
191
180
|
UnknownToolError,
|
|
181
|
+
WorkspaceUnavailableError,
|
|
192
182
|
} from "./session-engine.js";
|
|
193
183
|
import { sessionUrlsForRequest } from "./session-urls.js";
|
|
184
|
+
import { catalogDetailEntry, catalogListEntry } from "./tool-catalog.js";
|
|
194
185
|
|
|
195
186
|
function memoryHealthFields(engines: readonly SessionEngine[]) {
|
|
196
187
|
return collectMemoryHealthFields({
|
|
@@ -929,22 +920,7 @@ export async function startServer(
|
|
|
929
920
|
});
|
|
930
921
|
}
|
|
931
922
|
|
|
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
|
-
}
|
|
923
|
+
await cursorGithubCredentials?.start();
|
|
948
924
|
|
|
949
925
|
// Cursor SCM events: v1 stays on the engine poll. v2 ingest is local-CP
|
|
950
926
|
// only — hosted `--no-control-plane` skips the July poll (hosted CP wakes).
|
|
@@ -1020,7 +996,6 @@ export async function startServer(
|
|
|
1020
996
|
await cursorDeploymentRelay?.stop();
|
|
1021
997
|
await cursorEventRelay?.stop();
|
|
1022
998
|
await controlPlaneScmRelay?.stop();
|
|
1023
|
-
await cursorSlackRelay?.stop();
|
|
1024
999
|
cursorGithubCredentials?.stop();
|
|
1025
1000
|
await shutdownOtelRuntime(otelRuntime);
|
|
1026
1001
|
throw error;
|
|
@@ -1187,7 +1162,6 @@ export async function startServer(
|
|
|
1187
1162
|
await cursorDeploymentRelay?.stop();
|
|
1188
1163
|
await cursorEventRelay?.stop();
|
|
1189
1164
|
await controlPlaneScmRelay?.stop();
|
|
1190
|
-
await cursorSlackRelay?.stop();
|
|
1191
1165
|
for (const runtime of runtimes) {
|
|
1192
1166
|
runtime.controlPlane?.stop();
|
|
1193
1167
|
runtime.scheduleRunner.stop();
|
|
@@ -1540,6 +1514,123 @@ function mountAgentRoutes(
|
|
|
1540
1514
|
});
|
|
1541
1515
|
}
|
|
1542
1516
|
|
|
1517
|
+
// The live tool catalog: the session's tool namespace as a turn would
|
|
1518
|
+
// assemble it — authored server tools plus advertised MCP passthroughs —
|
|
1519
|
+
// under model-facing names. `/v1/info` stays the static authored
|
|
1520
|
+
// manifest; this is the runtime view only the running deployment can
|
|
1521
|
+
// answer. `session` / `continuationToken` query parameters bind the
|
|
1522
|
+
// listing to a session identity (advertised inventories can be
|
|
1523
|
+
// tenant-scoped and resolved per session).
|
|
1524
|
+
const resolveCatalogBinding = async (
|
|
1525
|
+
request: Request,
|
|
1526
|
+
ctx: Pick<ServerRouteContext, "auth" | "requestIp">
|
|
1527
|
+
): Promise<
|
|
1528
|
+
| { sessionId?: string; continuationToken?: string }
|
|
1529
|
+
| { errorResponse: Response }
|
|
1530
|
+
> => {
|
|
1531
|
+
const url = new URL(request.url);
|
|
1532
|
+
const sessionId = url.searchParams.get("session") ?? undefined;
|
|
1533
|
+
const continuationToken =
|
|
1534
|
+
url.searchParams.get("continuationToken") ?? undefined;
|
|
1535
|
+
if (sessionId !== undefined) {
|
|
1536
|
+
const record = await engine.sessions.get(sessionId);
|
|
1537
|
+
if (record === undefined) {
|
|
1538
|
+
return {
|
|
1539
|
+
errorResponse: errorResponse(
|
|
1540
|
+
404,
|
|
1541
|
+
"session_not_found",
|
|
1542
|
+
`Unknown session ${sessionId}.`
|
|
1543
|
+
),
|
|
1544
|
+
};
|
|
1545
|
+
}
|
|
1546
|
+
const ownership = requireSessionOwner(record, ctx.auth, {
|
|
1547
|
+
relax: relaxSessionReadAuth,
|
|
1548
|
+
beyondLoopback: relaxSessionReadAuthBeyondLoopback,
|
|
1549
|
+
requestIp: ctx.requestIp,
|
|
1550
|
+
});
|
|
1551
|
+
if (ownership !== undefined) {
|
|
1552
|
+
return { errorResponse: ownership };
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
return { sessionId, continuationToken };
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
router.add({
|
|
1559
|
+
method: "GET",
|
|
1560
|
+
pattern: `${base}/v1/tools`,
|
|
1561
|
+
auth: httpAuth,
|
|
1562
|
+
handler: async (request, ctx) => {
|
|
1563
|
+
const binding = await resolveCatalogBinding(request, ctx);
|
|
1564
|
+
if ("errorResponse" in binding) {
|
|
1565
|
+
return binding.errorResponse;
|
|
1566
|
+
}
|
|
1567
|
+
try {
|
|
1568
|
+
const catalog = await engine.listCatalogTools({
|
|
1569
|
+
auth: ctx.auth,
|
|
1570
|
+
...binding,
|
|
1571
|
+
});
|
|
1572
|
+
return jsonResponse({
|
|
1573
|
+
tools: catalog.tools.map(catalogListEntry),
|
|
1574
|
+
// JSON.stringify drops the key when there is nothing to report.
|
|
1575
|
+
connectionErrors:
|
|
1576
|
+
catalog.connectionErrors.length === 0
|
|
1577
|
+
? undefined
|
|
1578
|
+
: catalog.connectionErrors,
|
|
1579
|
+
});
|
|
1580
|
+
} catch (error) {
|
|
1581
|
+
if (error instanceof InvalidContinuationTokenError) {
|
|
1582
|
+
return errorResponse(
|
|
1583
|
+
400,
|
|
1584
|
+
"invalid_continuation_token",
|
|
1585
|
+
error.message
|
|
1586
|
+
);
|
|
1587
|
+
}
|
|
1588
|
+
throw error;
|
|
1589
|
+
}
|
|
1590
|
+
},
|
|
1591
|
+
});
|
|
1592
|
+
|
|
1593
|
+
router.add({
|
|
1594
|
+
method: "GET",
|
|
1595
|
+
pattern: `${base}/v1/tools/:toolName`,
|
|
1596
|
+
auth: httpAuth,
|
|
1597
|
+
handler: async (request, ctx) => {
|
|
1598
|
+
const toolName = ctx.params.toolName ?? "";
|
|
1599
|
+
const binding = await resolveCatalogBinding(request, ctx);
|
|
1600
|
+
if ("errorResponse" in binding) {
|
|
1601
|
+
return binding.errorResponse;
|
|
1602
|
+
}
|
|
1603
|
+
try {
|
|
1604
|
+
const catalog = await engine.listCatalogTools({
|
|
1605
|
+
auth: ctx.auth,
|
|
1606
|
+
...binding,
|
|
1607
|
+
});
|
|
1608
|
+
const tool = catalog.tools.find((t) => t.name === toolName);
|
|
1609
|
+
if (tool === undefined) {
|
|
1610
|
+
return jsonResponse(
|
|
1611
|
+
{
|
|
1612
|
+
ok: false,
|
|
1613
|
+
error: "unknown_tool",
|
|
1614
|
+
message: `Unknown tool "${toolName}".`,
|
|
1615
|
+
availableTools: catalog.tools.map((t) => t.name),
|
|
1616
|
+
},
|
|
1617
|
+
{ status: 404 }
|
|
1618
|
+
);
|
|
1619
|
+
}
|
|
1620
|
+
return jsonResponse(catalogDetailEntry(tool));
|
|
1621
|
+
} catch (error) {
|
|
1622
|
+
if (error instanceof InvalidContinuationTokenError) {
|
|
1623
|
+
return errorResponse(
|
|
1624
|
+
400,
|
|
1625
|
+
"invalid_continuation_token",
|
|
1626
|
+
error.message
|
|
1627
|
+
);
|
|
1628
|
+
}
|
|
1629
|
+
throw error;
|
|
1630
|
+
}
|
|
1631
|
+
},
|
|
1632
|
+
});
|
|
1633
|
+
|
|
1543
1634
|
// Deterministic tool invocation: run an authored server tool directly,
|
|
1544
1635
|
// without a model turn deciding to call it.
|
|
1545
1636
|
router.add({
|
|
@@ -1563,6 +1654,17 @@ function mountAgentRoutes(
|
|
|
1563
1654
|
"`sessionId` must be a string when provided."
|
|
1564
1655
|
);
|
|
1565
1656
|
}
|
|
1657
|
+
if (
|
|
1658
|
+
body.continuationToken !== undefined &&
|
|
1659
|
+
typeof body.continuationToken !== "string"
|
|
1660
|
+
) {
|
|
1661
|
+
return errorResponse(
|
|
1662
|
+
400,
|
|
1663
|
+
"invalid_request",
|
|
1664
|
+
"`continuationToken` must be a string when provided."
|
|
1665
|
+
);
|
|
1666
|
+
}
|
|
1667
|
+
const continuationToken = body.continuationToken;
|
|
1566
1668
|
const sessionId = body.sessionId;
|
|
1567
1669
|
if (sessionId !== undefined) {
|
|
1568
1670
|
const record = await engine.sessions.get(sessionId);
|
|
@@ -1585,7 +1687,8 @@ function mountAgentRoutes(
|
|
|
1585
1687
|
try {
|
|
1586
1688
|
const outcome = await engine.callTool(toolName, body.input ?? {}, {
|
|
1587
1689
|
auth: ctx.auth,
|
|
1588
|
-
|
|
1690
|
+
sessionId,
|
|
1691
|
+
continuationToken,
|
|
1589
1692
|
});
|
|
1590
1693
|
return jsonResponse({ ok: !outcome.isError, ...outcome });
|
|
1591
1694
|
} catch (error) {
|
|
@@ -1606,6 +1709,16 @@ function mountAgentRoutes(
|
|
|
1606
1709
|
if (error instanceof ToolInputError) {
|
|
1607
1710
|
return errorResponse(400, "invalid_tool_input", error.message);
|
|
1608
1711
|
}
|
|
1712
|
+
if (error instanceof InvalidContinuationTokenError) {
|
|
1713
|
+
return errorResponse(
|
|
1714
|
+
400,
|
|
1715
|
+
"invalid_continuation_token",
|
|
1716
|
+
error.message
|
|
1717
|
+
);
|
|
1718
|
+
}
|
|
1719
|
+
if (error instanceof WorkspaceUnavailableError) {
|
|
1720
|
+
return errorResponse(500, "workspace_unavailable", error.message);
|
|
1721
|
+
}
|
|
1609
1722
|
throw error;
|
|
1610
1723
|
}
|
|
1611
1724
|
},
|
|
@@ -2410,54 +2523,11 @@ function resolveCursorOriginRepoScope(input: {
|
|
|
2410
2523
|
return parseCursorOriginRepoScope(repos);
|
|
2411
2524
|
}
|
|
2412
2525
|
|
|
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
2526
|
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
2527
|
return runtimes.map(({ slug, project }) => {
|
|
2446
|
-
const
|
|
2447
|
-
|
|
2448
|
-
(channel) =>
|
|
2449
|
-
channel.definition.meta?.kind === "slack" &&
|
|
2450
|
-
channel.definition.meta?.slackCursorAccount !== true
|
|
2528
|
+
const hasSlack = project.channels.some(
|
|
2529
|
+
(channel) => channel.definition.meta?.kind === "slack"
|
|
2451
2530
|
);
|
|
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
2531
|
return {
|
|
2462
2532
|
slug,
|
|
2463
2533
|
name: project.name,
|
|
@@ -2467,60 +2537,11 @@ function buildAgentIndexEntries(runtimes: MountedRuntime[]): AgentIndexEntry[] {
|
|
|
2467
2537
|
: (project.agent.model?.id ?? ""),
|
|
2468
2538
|
tools: project.agent.tools.length,
|
|
2469
2539
|
channels: project.channels.length + 1,
|
|
2470
|
-
slack,
|
|
2540
|
+
slack: hasSlack ? { kind: "socket" as const } : undefined,
|
|
2471
2541
|
};
|
|
2472
2542
|
});
|
|
2473
2543
|
}
|
|
2474
2544
|
|
|
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
2545
|
interface CursorDeploymentTarget {
|
|
2525
2546
|
runtime: MountedRuntime;
|
|
2526
2547
|
channelId: string;
|
|
@@ -2558,7 +2579,7 @@ function collectCursorDeploymentTargets(
|
|
|
2558
2579
|
* `deploymentsChannel({ ... })`. One relay per process reads
|
|
2559
2580
|
* `/v0/deployment-events` for the union of every channel's deploy sources, and
|
|
2560
2581
|
* each event is routed to the channels that asked for it — the same ownership
|
|
2561
|
-
* `
|
|
2582
|
+
* `startCursorEventRelay` has.
|
|
2562
2583
|
*/
|
|
2563
2584
|
function startCursorDeploymentRelay(input: {
|
|
2564
2585
|
options: ServeOptions;
|
|
@@ -2617,8 +2638,8 @@ function startCursorDeploymentRelay(input: {
|
|
|
2617
2638
|
];
|
|
2618
2639
|
}
|
|
2619
2640
|
}
|
|
2620
|
-
// Same host split as scm-events
|
|
2621
|
-
//
|
|
2641
|
+
// Same host split as scm-events: `/v0/deployment-events/*` is on
|
|
2642
|
+
// api.cursor.com, not api2.
|
|
2622
2643
|
const baseStateRoot =
|
|
2623
2644
|
options.stateRoot ??
|
|
2624
2645
|
join(targets[0].runtime.project.rootDir, ".agent-serve");
|
|
@@ -2654,127 +2675,6 @@ function startCursorDeploymentRelay(input: {
|
|
|
2654
2675
|
return relay;
|
|
2655
2676
|
}
|
|
2656
2677
|
|
|
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
2678
|
function buildChannelHandlerArgs(input: {
|
|
2779
2679
|
runtime: MountedRuntime;
|
|
2780
2680
|
channelId: string;
|