@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/types.ts
CHANGED
|
@@ -553,8 +553,9 @@ export interface SlackNudgeHostApi {
|
|
|
553
553
|
*/
|
|
554
554
|
export interface HostContext {
|
|
555
555
|
/**
|
|
556
|
-
* Authored MCP connections (`agent/mcp-connections/*`
|
|
557
|
-
*
|
|
556
|
+
* Authored MCP connections (`agent/mcp-connections/*` and
|
|
557
|
+
* `agent/host-connections/*`). Call a specific MCP tool deterministically
|
|
558
|
+
* without going through the agent loop.
|
|
558
559
|
*/
|
|
559
560
|
mcp: HostMcpRegistry;
|
|
560
561
|
/**
|
|
@@ -921,6 +922,33 @@ export type ToolNeedsApproval<TInput> =
|
|
|
921
922
|
*/
|
|
922
923
|
export type ToolEffect = "read" | "write";
|
|
923
924
|
|
|
925
|
+
/** Authored `defineConnection({ effects })` — one effect or a set. */
|
|
926
|
+
export type ConnectionEffects = ToolEffect | readonly ToolEffect[];
|
|
927
|
+
|
|
928
|
+
const TOOL_EFFECTS: readonly ToolEffect[] = ["read", "write"];
|
|
929
|
+
|
|
930
|
+
export function isToolEffect(value: unknown): value is ToolEffect {
|
|
931
|
+
return value === "read" || value === "write";
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* Normalize authored {@link ConnectionConfig.effects} to a unique list.
|
|
936
|
+
* Invalid values are left for discovery to reject — this only collapses
|
|
937
|
+
* `"read"` / `["read"]` / duplicates.
|
|
938
|
+
*/
|
|
939
|
+
export function normalizeConnectionEffects(
|
|
940
|
+
effects: ConnectionEffects
|
|
941
|
+
): ToolEffect[] {
|
|
942
|
+
const list = typeof effects === "string" ? [effects] : [...effects];
|
|
943
|
+
const unique: ToolEffect[] = [];
|
|
944
|
+
for (const effect of TOOL_EFFECTS) {
|
|
945
|
+
if (list.includes(effect)) {
|
|
946
|
+
unique.push(effect);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
return unique;
|
|
950
|
+
}
|
|
951
|
+
|
|
924
952
|
/**
|
|
925
953
|
* A tool's declared {@link ToolEffect} — fixed, or decided per call from
|
|
926
954
|
* validated input for tools that read or write depending on their arguments
|
|
@@ -1185,12 +1213,6 @@ export type ConnectionConfig = (
|
|
|
1185
1213
|
) & {
|
|
1186
1214
|
/** Documentation only; shown in `info` output. */
|
|
1187
1215
|
description?: string;
|
|
1188
|
-
/**
|
|
1189
|
-
* Omit from SDK `mcpServers` (model never sees it). Still available on
|
|
1190
|
-
* `host.mcp` for server tools / channel handlers. Does not affect
|
|
1191
|
-
* cloud-native account connectors provisioned by the platform.
|
|
1192
|
-
*/
|
|
1193
|
-
hostOnly?: boolean;
|
|
1194
1216
|
/**
|
|
1195
1217
|
* Per-session auth: called at turn-build time with the session's
|
|
1196
1218
|
* {@link SessionInfo}, returning headers merged over the transport's
|
|
@@ -1239,12 +1261,27 @@ export type ConnectionConfig = (
|
|
|
1239
1261
|
* fails the turn — a turn never silently runs with a shrunken toolset.
|
|
1240
1262
|
* Local runtime only, like all server tools: a `runtime: "cloud"` agent
|
|
1241
1263
|
* fails discovery, and hybrid per-send cloud sessions refuse the turn.
|
|
1242
|
-
*
|
|
1243
|
-
*
|
|
1244
|
-
* the pair). The listing runs once per turn; point this at endpoints
|
|
1245
|
-
* that can answer `tools/list` cheaply.
|
|
1264
|
+
* The listing runs once per turn; point this at endpoints that can
|
|
1265
|
+
* answer `tools/list` cheaply.
|
|
1246
1266
|
*/
|
|
1247
1267
|
advertiseTools?: boolean;
|
|
1268
|
+
/**
|
|
1269
|
+
* Intended effects of tools this connection serves. When set, only
|
|
1270
|
+
* tools whose classified effect is in this set are advertised — a
|
|
1271
|
+
* connection that wants reads never puts a write, or a tool nothing
|
|
1272
|
+
* classified, in the model's toolset.
|
|
1273
|
+
*
|
|
1274
|
+
* Classification is the same fail-closed read of MCP annotations the
|
|
1275
|
+
* dry-run gate uses (`readOnlyHint` / `destructiveHint`). A tool the
|
|
1276
|
+
* server does not classify is omitted, not guessed. Servers that leave
|
|
1277
|
+
* tools unannotated stay empty here until they annotate or a trusted
|
|
1278
|
+
* listing injects a known-read hint.
|
|
1279
|
+
*
|
|
1280
|
+
* Requires {@link advertiseTools}: this filters the named passthroughs
|
|
1281
|
+
* the model sees. A single value (`"read"`) and an array (`["read"]`)
|
|
1282
|
+
* are the same.
|
|
1283
|
+
*/
|
|
1284
|
+
effects?: ConnectionEffects;
|
|
1248
1285
|
};
|
|
1249
1286
|
|
|
1250
1287
|
/**
|
|
@@ -1266,15 +1303,13 @@ export function isInlineStdioConnection(
|
|
|
1266
1303
|
connection: ConnectionConfig
|
|
1267
1304
|
): connection is InlineStdioConnectionConfig & {
|
|
1268
1305
|
description?: string;
|
|
1269
|
-
hostOnly?: boolean;
|
|
1270
1306
|
} {
|
|
1271
1307
|
return "tools" in connection && connection.tools !== undefined;
|
|
1272
1308
|
}
|
|
1273
1309
|
|
|
1274
1310
|
/**
|
|
1275
1311
|
* An MCP connection is available to the agent (SDK `mcpServers`), host
|
|
1276
|
-
* (`ctx.host.mcp`), and channel/schedule handlers
|
|
1277
|
-
* which keeps it off the model surface only.
|
|
1312
|
+
* (`ctx.host.mcp`), and channel/schedule handlers.
|
|
1278
1313
|
*/
|
|
1279
1314
|
export type ConnectionDefinition = ConnectionConfig &
|
|
1280
1315
|
BrandedDefinition<"connection">;
|
|
@@ -1847,6 +1882,19 @@ export const DIRECT_TOOL_CALL_CHANNEL_ID = "direct";
|
|
|
1847
1882
|
export interface CallToolOptions {
|
|
1848
1883
|
/** Who is calling; becomes the tool context's session auth. */
|
|
1849
1884
|
auth?: AuthContext | null;
|
|
1885
|
+
/**
|
|
1886
|
+
* Address the session by its wire continuation token
|
|
1887
|
+
* (`<channelId>:<key>`, as `/v1/sessions` lists it). A token that maps
|
|
1888
|
+
* to a live (or restorable) session behaves exactly like passing that
|
|
1889
|
+
* session's {@link sessionId} — ownership check, turn serialization, and
|
|
1890
|
+
* event recording included. A token with no session behind it runs the
|
|
1891
|
+
* call scratch-bound with the token's channel id and continuation key as
|
|
1892
|
+
* the call's session identity, so deployments whose tools resolve state
|
|
1893
|
+
* from the continuation key (e.g. VFS mounts rebuilt by a binding
|
|
1894
|
+
* resolver) can serve it with no live session. Mutually exclusive with
|
|
1895
|
+
* {@link sessionId}.
|
|
1896
|
+
*/
|
|
1897
|
+
continuationToken?: string;
|
|
1850
1898
|
/**
|
|
1851
1899
|
* Run the tool inside an existing session: the tool sees that session's
|
|
1852
1900
|
* info and materialized workspace, and the call is recorded on the
|
|
@@ -1878,6 +1926,14 @@ export interface ToolCallOutcome {
|
|
|
1878
1926
|
durationMs: number;
|
|
1879
1927
|
/** Present when the call ran inside an existing session. */
|
|
1880
1928
|
sessionId?: string;
|
|
1929
|
+
/**
|
|
1930
|
+
* Present (true) when a session-bound call could not materialize the
|
|
1931
|
+
* session's harness cwd and ran in a scratch workspace instead. The
|
|
1932
|
+
* session identity still applied (read-effect calls only get here), but
|
|
1933
|
+
* `ctx.workspaceDir` was not the session workspace — callers rendering
|
|
1934
|
+
* results as session state should surface this.
|
|
1935
|
+
*/
|
|
1936
|
+
scratchWorkspace?: true;
|
|
1881
1937
|
}
|
|
1882
1938
|
|
|
1883
1939
|
/**
|
|
@@ -2172,12 +2228,6 @@ export interface ChannelMeta {
|
|
|
2172
2228
|
* by `info` so watched channels are auditable.
|
|
2173
2229
|
*/
|
|
2174
2230
|
slackChannelPosts?: readonly string[];
|
|
2175
|
-
/**
|
|
2176
|
-
* For Slack packs riding the signed-in Cursor account's Slack connection
|
|
2177
|
-
* (`slackChannel({ cursorAccount: true })`): inbound relays from
|
|
2178
|
-
* `/v0/slack-events` instead of Socket Mode.
|
|
2179
|
-
*/
|
|
2180
|
-
slackCursorAccount?: boolean;
|
|
2181
2231
|
}
|
|
2182
2232
|
|
|
2183
2233
|
export interface ChannelConfig<TState = JsonValue> {
|
|
@@ -2648,6 +2698,8 @@ export interface DiscoveredTool {
|
|
|
2648
2698
|
* refused — see `decideToolCall`.
|
|
2649
2699
|
*/
|
|
2650
2700
|
advertised?: true;
|
|
2701
|
+
/** Name of the advertising connection an advertised tool came from. */
|
|
2702
|
+
connection?: string;
|
|
2651
2703
|
/**
|
|
2652
2704
|
* Agent tools: script body materialized under
|
|
2653
2705
|
* `.agent-serve/tools/<name>.sh`.
|
|
@@ -2672,11 +2724,15 @@ export interface DiscoveredConnection {
|
|
|
2672
2724
|
name: string;
|
|
2673
2725
|
transport: ConnectionTransport;
|
|
2674
2726
|
description?: string;
|
|
2675
|
-
hostOnly?: boolean;
|
|
2676
2727
|
/** Per-session auth from {@link ConnectionConfig.auth} (http/sse only). */
|
|
2677
2728
|
auth?: ConnectionAuthProvider;
|
|
2678
2729
|
/** Advertise-by-name from {@link ConnectionConfig.advertiseTools}. */
|
|
2679
2730
|
advertiseTools?: boolean;
|
|
2731
|
+
/**
|
|
2732
|
+
* Normalized intended effects from {@link ConnectionConfig.effects}.
|
|
2733
|
+
* Absent means every listed tool is advertised.
|
|
2734
|
+
*/
|
|
2735
|
+
effects?: readonly ToolEffect[];
|
|
2680
2736
|
}
|
|
2681
2737
|
|
|
2682
2738
|
export interface DiscoveredChannel {
|
|
@@ -2749,6 +2805,11 @@ export interface ResolvedAgent {
|
|
|
2749
2805
|
tools: DiscoveredTool[];
|
|
2750
2806
|
skills: DiscoveredSkill[];
|
|
2751
2807
|
connections: DiscoveredConnection[];
|
|
2808
|
+
/**
|
|
2809
|
+
* MCP connections from `agent/host-connections/`. Host tools and
|
|
2810
|
+
* `mcp oauth` see them; the model does not.
|
|
2811
|
+
*/
|
|
2812
|
+
hostConnections?: DiscoveredConnection[];
|
|
2752
2813
|
subagents: ResolvedAgent[];
|
|
2753
2814
|
seedFiles: SeedFile[];
|
|
2754
2815
|
}
|
|
@@ -2816,14 +2877,20 @@ export interface AgentProjectInfo {
|
|
|
2816
2877
|
description: string;
|
|
2817
2878
|
execution: ToolExecution;
|
|
2818
2879
|
needsApproval: boolean;
|
|
2880
|
+
/**
|
|
2881
|
+
* The tool's declared {@link ToolEffect} when static, `"dynamic"` when
|
|
2882
|
+
* declared as a predicate. Absent when the author declared nothing —
|
|
2883
|
+
* "unknown", not "mutates".
|
|
2884
|
+
*/
|
|
2885
|
+
effect?: ToolEffect | "dynamic";
|
|
2819
2886
|
inputSchema: JsonSchemaObject;
|
|
2820
2887
|
}>;
|
|
2821
2888
|
skills: Array<{ name: string; description: string }>;
|
|
2822
2889
|
connections: Array<{
|
|
2823
2890
|
name: string;
|
|
2824
2891
|
transport: string;
|
|
2825
|
-
hostOnly?: boolean;
|
|
2826
2892
|
advertiseTools?: boolean;
|
|
2893
|
+
effects?: readonly ToolEffect[];
|
|
2827
2894
|
/**
|
|
2828
2895
|
* Present only for `cursorAccount` connections: the connector-name
|
|
2829
2896
|
* allowlist, or `"*"` for every connected server. Structured twin of the
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { slackChannel } from "@cursor/july/channels/slack";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Slack channel (Socket Mode).
|
|
5
|
+
*
|
|
6
|
+
* Tokens: PR_AUTOFIXER_SLACK_BOT_TOKEN + PR_AUTOFIXER_SLACK_APP_TOKEN
|
|
7
|
+
*
|
|
8
|
+
* Full setup: agent-sdk slack create
|
|
9
|
+
*/
|
|
3
10
|
export default slackChannel({
|
|
4
|
-
|
|
5
|
-
agentName: "PrAutofixer",
|
|
11
|
+
envPrefix: "PR_AUTOFIXER",
|
|
6
12
|
suggestedPromptsTitle: "Try asking",
|
|
7
13
|
suggestedPrompts: [
|
|
8
14
|
{
|
|
@@ -43,4 +43,5 @@ on both issues. `agent-sdk eval` classifies and skips tracker writes.
|
|
|
43
43
|
- `agent/instructions.md`: procedure around the rubric
|
|
44
44
|
- `evals/triage.eval.ts`: three smoke cases
|
|
45
45
|
|
|
46
|
-
`agent/lib/actuate.ts` talks to the tracker.
|
|
46
|
+
`agent/lib/actuate.ts` talks to the tracker. Writes go through
|
|
47
|
+
`record_triage` so the host owns comments, priority, and duplicate links.
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cursor-account mode for the Slack channel pack: instead of a dedicated
|
|
3
|
-
* Slack app (Socket Mode + `xoxb`/`xapp` tokens), the channel rides the
|
|
4
|
-
* signed-in Cursor account's Slack connection. Inbound events are relayed
|
|
5
|
-
* by the serve host from `/v0/slack-events` (see
|
|
6
|
-
* `internal/cursor-slack-relay.ts`); outbound Web API calls run through a
|
|
7
|
-
* {@link SlackApiTransport} bound to the backend proxy.
|
|
8
|
-
*
|
|
9
|
-
* This file is the seam between the channel definition (authored at
|
|
10
|
-
* `defineChannel` time) and the serve-time relay: `slackChannel()` registers
|
|
11
|
-
* a runtime ref here, and the server discovers it, binds the transport, and
|
|
12
|
-
* dispatches relayed envelopes through the pack's normal inbound path.
|
|
13
|
-
*/
|
|
14
|
-
import type { ArtifactsApi, HostContext, SendMessageFn } from "../../types.js";
|
|
15
|
-
import type { EventIdDedupe } from "./event-id-dedupe.js";
|
|
16
|
-
import type { SlackLog } from "./log.js";
|
|
17
|
-
import type { SlackApiTransport, SlackChannelOptions, SlackCredentials, SlackMessageFile, SlackMessageHandler } from "./types.js";
|
|
18
|
-
/**
|
|
19
|
-
* Transport placeholder created at `slackChannel()` definition time and
|
|
20
|
-
* bound to the real backend proxy caller when the serve host starts its
|
|
21
|
-
* relay. Calls before binding soft-fail Slack-style.
|
|
22
|
-
*/
|
|
23
|
-
export interface PendingSlackApiTransport extends SlackApiTransport {
|
|
24
|
-
bind(impl: SlackApiTransport["call"]): void;
|
|
25
|
-
}
|
|
26
|
-
export declare function createPendingSlackApiTransport(): PendingSlackApiTransport;
|
|
27
|
-
/**
|
|
28
|
-
* One routed Slack event from `/v0/slack-events` (mirror of the backend's
|
|
29
|
-
* SlackAgentEventEnvelope, minus server-only fields).
|
|
30
|
-
*/
|
|
31
|
-
export interface CursorSlackEnvelope {
|
|
32
|
-
eventName: string;
|
|
33
|
-
slackTeamId: string;
|
|
34
|
-
channelId: string;
|
|
35
|
-
channelType?: string;
|
|
36
|
-
threadTs: string;
|
|
37
|
-
messageTs: string;
|
|
38
|
-
slackUserId?: string;
|
|
39
|
-
text: string;
|
|
40
|
-
agentName: string;
|
|
41
|
-
consumerId: string;
|
|
42
|
-
/**
|
|
43
|
-
* How the backend routed the event: leading agent name or owned thread.
|
|
44
|
-
*/
|
|
45
|
-
matchedBy: "name" | "thread";
|
|
46
|
-
eventId?: string;
|
|
47
|
-
receivedAtMs: number;
|
|
48
|
-
/**
|
|
49
|
-
* Slack file uploads on the triggering message. When `dataBase64` is set
|
|
50
|
-
* the Cursor backend already downloaded bytes (cursorAccount has no bot
|
|
51
|
-
* token for files.slack.com).
|
|
52
|
-
*/
|
|
53
|
-
files?: SlackMessageFile[];
|
|
54
|
-
}
|
|
55
|
-
/** Serve-time runtime handle for one cursor-account Slack channel. */
|
|
56
|
-
export interface SlackCursorAccountRuntime {
|
|
57
|
-
options: SlackChannelOptions;
|
|
58
|
-
/** The channel's live credentials (botToken slot holds the transport). */
|
|
59
|
-
credentials: SlackCredentials;
|
|
60
|
-
transport: PendingSlackApiTransport;
|
|
61
|
-
eventIds: EventIdDedupe;
|
|
62
|
-
onAppMention: SlackMessageHandler;
|
|
63
|
-
onDirectMessage: SlackMessageHandler;
|
|
64
|
-
getLog: () => SlackLog;
|
|
65
|
-
}
|
|
66
|
-
export declare function registerSlackCursorAccountRuntime(definition: object, runtime: SlackCursorAccountRuntime): void;
|
|
67
|
-
/**
|
|
68
|
-
* Recover the cursor-account runtime for a channel definition, if it was
|
|
69
|
-
* created via `slackChannel({ cursorAccount: true })`.
|
|
70
|
-
*/
|
|
71
|
-
export declare function getSlackCursorAccountRuntime(definition: object): SlackCursorAccountRuntime | undefined;
|
|
72
|
-
/**
|
|
73
|
-
* Dispatch one relayed envelope through the pack's normal inbound path
|
|
74
|
-
* (same handlers, session continuation, and reply delivery as Socket Mode).
|
|
75
|
-
*/
|
|
76
|
-
export declare function dispatchCursorSlackEnvelope(args: {
|
|
77
|
-
runtime: SlackCursorAccountRuntime;
|
|
78
|
-
envelope: CursorSlackEnvelope;
|
|
79
|
-
send: SendMessageFn;
|
|
80
|
-
host: HostContext;
|
|
81
|
-
artifacts: ArtifactsApi;
|
|
82
|
-
hasContinuationSession?: (continuationToken: string) => Promise<boolean>;
|
|
83
|
-
isContinuationBusy?: (continuationToken: string) => Promise<boolean>;
|
|
84
|
-
getContinuationLastBotMessageTs?: (continuationToken: string) => Promise<string | undefined>;
|
|
85
|
-
interruptContinuation?: (continuationToken: string) => Promise<boolean>;
|
|
86
|
-
}): Promise<void>;
|
|
87
|
-
//# sourceMappingURL=cursor-account.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cursor-account.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/cursor-account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAEhB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE,IAAI,CAAC,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CAC7C;AAED,wBAAgB,8BAA8B,IAAI,wBAAwB,CAezE;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AAED,sEAAsE;AACtE,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,mBAAmB,CAAC;IAC7B,0EAA0E;IAC1E,WAAW,EAAE,gBAAgB,CAAC;IAC9B,SAAS,EAAE,wBAAwB,CAAC;IACpC,QAAQ,EAAE,aAAa,CAAC;IACxB,YAAY,EAAE,mBAAmB,CAAC;IAClC,eAAe,EAAE,mBAAmB,CAAC;IACrC,MAAM,EAAE,MAAM,QAAQ,CAAC;CACxB;AAID,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,yBAAyB,GACjC,IAAI,CAEN;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,MAAM,GACjB,yBAAyB,GAAG,SAAS,CAEvC;AAED;;;GAGG;AACH,wBAAsB,2BAA2B,CAAC,IAAI,EAAE;IACtD,OAAO,EAAE,yBAAyB,CAAC;IACnC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,YAAY,CAAC;IACxB,sBAAsB,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACzE,kBAAkB,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACrE,+BAA+B,CAAC,EAAE,CAChC,iBAAiB,EAAE,MAAM,KACtB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjC,qBAAqB,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACzE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuEhB"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cursor-account mode for the Slack channel pack: instead of a dedicated
|
|
3
|
-
* Slack app (Socket Mode + `xoxb`/`xapp` tokens), the channel rides the
|
|
4
|
-
* signed-in Cursor account's Slack connection. Inbound events are relayed
|
|
5
|
-
* by the serve host from `/v0/slack-events` (see
|
|
6
|
-
* `internal/cursor-slack-relay.ts`); outbound Web API calls run through a
|
|
7
|
-
* {@link SlackApiTransport} bound to the backend proxy.
|
|
8
|
-
*
|
|
9
|
-
* This file is the seam between the channel definition (authored at
|
|
10
|
-
* `defineChannel` time) and the serve-time relay: `slackChannel()` registers
|
|
11
|
-
* a runtime ref here, and the server discovers it, binds the transport, and
|
|
12
|
-
* dispatches relayed envelopes through the pack's normal inbound path.
|
|
13
|
-
*/
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
import { dispatchInboundMessage } from "./dispatch.js";
|
|
24
|
-
import { slackTextToMarkdown } from "./inbound.js";
|
|
25
|
-
export function createPendingSlackApiTransport() {
|
|
26
|
-
let bound;
|
|
27
|
-
return {
|
|
28
|
-
kind: "api-transport",
|
|
29
|
-
label: "cursor-account",
|
|
30
|
-
bind(impl) {
|
|
31
|
-
bound = impl;
|
|
32
|
-
},
|
|
33
|
-
call(method, args) {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
if (bound === undefined) {
|
|
36
|
-
return { ok: false, error: "cursor_slack_relay_not_started" };
|
|
37
|
-
}
|
|
38
|
-
return bound(method, args);
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
const runtimeByDefinition = new WeakMap();
|
|
44
|
-
export function registerSlackCursorAccountRuntime(definition, runtime) {
|
|
45
|
-
runtimeByDefinition.set(definition, runtime);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Recover the cursor-account runtime for a channel definition, if it was
|
|
49
|
-
* created via `slackChannel({ cursorAccount: true })`.
|
|
50
|
-
*/
|
|
51
|
-
export function getSlackCursorAccountRuntime(definition) {
|
|
52
|
-
return runtimeByDefinition.get(definition);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Dispatch one relayed envelope through the pack's normal inbound path
|
|
56
|
-
* (same handlers, session continuation, and reply delivery as Socket Mode).
|
|
57
|
-
*/
|
|
58
|
-
export function dispatchCursorSlackEnvelope(args) {
|
|
59
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
const { runtime, envelope } = args;
|
|
61
|
-
const log = runtime.getLog();
|
|
62
|
-
if (envelope.eventId !== undefined &&
|
|
63
|
-
envelope.eventId.length > 0 &&
|
|
64
|
-
!runtime.eventIds.tryHandle(envelope.eventId)) {
|
|
65
|
-
log.debug("cursor-account inbound dedupe drop", {
|
|
66
|
-
event_id: envelope.eventId,
|
|
67
|
-
});
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
const message = Object.assign(Object.assign({ text: envelope.text, body: envelope.text, markdown: slackTextToMarkdown(envelope.text), ts: envelope.messageTs, threadTs: envelope.threadTs, channelId: envelope.channelId, teamId: envelope.slackTeamId }, (envelope.slackUserId === undefined
|
|
71
|
-
? {}
|
|
72
|
-
: {
|
|
73
|
-
author: { userId: envelope.slackUserId, isBot: false },
|
|
74
|
-
})), { files: envelope.files });
|
|
75
|
-
// DMs to @Cursor route as direct messages; everything else (explicit
|
|
76
|
-
// `@Cursor <agent> …` mentions and claimed-thread replies) dispatches on
|
|
77
|
-
// the mention handler — a claimed-thread reply is addressed to the agent
|
|
78
|
-
// by construction. Mentions/DM disable toggles are rejected at
|
|
79
|
-
// `slackChannel({ cursorAccount: true })` construction so the backend
|
|
80
|
-
// never consumes events the host would drop.
|
|
81
|
-
const isDm = envelope.channelType === "im" || envelope.channelId.startsWith("D");
|
|
82
|
-
const kind = isDm ? "direct_message" : "app_mention";
|
|
83
|
-
const handler = isDm ? runtime.onDirectMessage : runtime.onAppMention;
|
|
84
|
-
yield dispatchInboundMessage(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ kind,
|
|
85
|
-
message,
|
|
86
|
-
handler, send: args.send, credentials: runtime.credentials, host: args.host, artifacts: args.artifacts, log, evalCommandsEnabled: runtime.options.evalCommands !== false, cursorAgentName: envelope.agentName,
|
|
87
|
-
// Backend router already refused externals for this envelope.
|
|
88
|
-
blockExternals: false }, (args.hasContinuationSession === undefined
|
|
89
|
-
? {}
|
|
90
|
-
: { hasContinuationSession: args.hasContinuationSession })), (args.isContinuationBusy === undefined
|
|
91
|
-
? {}
|
|
92
|
-
: { isContinuationBusy: args.isContinuationBusy })), (args.getContinuationLastBotMessageTs === undefined
|
|
93
|
-
? {}
|
|
94
|
-
: {
|
|
95
|
-
getContinuationLastBotMessageTs: args.getContinuationLastBotMessageTs,
|
|
96
|
-
})), (args.interruptContinuation === undefined
|
|
97
|
-
? {}
|
|
98
|
-
: { interruptContinuation: args.interruptContinuation })), { continuation: runtime.options.continuation }), (envelope.eventId === undefined ? {} : { eventId: envelope.eventId })));
|
|
99
|
-
});
|
|
100
|
-
}
|