@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
|
@@ -44,7 +44,7 @@ import { createHostFilesApi } from "./host-files.js";
|
|
|
44
44
|
import { createHostKvApi } from "./host-kv.js";
|
|
45
45
|
import { createHostOtelApi } from "./host-otel.js";
|
|
46
46
|
import { createHostPlatforms, createHostSlackClient, } from "./host-platforms.js";
|
|
47
|
-
import { formatContinuationToken, newContinuationKey, newSessionId, newToolCallId, } from "./ids.js";
|
|
47
|
+
import { formatContinuationToken, newContinuationKey, newSessionId, newToolCallId, parseContinuationToken, } from "./ids.js";
|
|
48
48
|
import { validateToolInput } from "./json-schema.js";
|
|
49
49
|
import { McpHost } from "./mcp-host.js";
|
|
50
50
|
import { shouldStartProcessMemoryTelemetry, startProcessMemoryTelemetry, } from "./process-memory-telemetry.js";
|
|
@@ -54,7 +54,7 @@ import { sessionExternalLinks } from "./session-links.js";
|
|
|
54
54
|
import { SessionStore } from "./session-store.js";
|
|
55
55
|
import { syncSkillsToStore } from "./skills-sync.js";
|
|
56
56
|
import { StorageCoordinator } from "./storage-coordinator.js";
|
|
57
|
-
import { decideToolCall } from "./tool-policy.js";
|
|
57
|
+
import { decideToolCall, resolveEffect } from "./tool-policy.js";
|
|
58
58
|
import { normalizeToolResult, toolCallErrorMessage } from "./tool-result.js";
|
|
59
59
|
import { estimateTurnCostFromApi, roundCostUsd, } from "./turn-cost.js";
|
|
60
60
|
import { TurnGovernor } from "./turn-governor.js";
|
|
@@ -90,6 +90,24 @@ export class ToolNotDirectlyCallableError extends Error {
|
|
|
90
90
|
this.name = "ToolNotDirectlyCallableError";
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
+
export class InvalidContinuationTokenError extends Error {
|
|
94
|
+
constructor(detail) {
|
|
95
|
+
super(`Invalid continuation token: ${detail}`);
|
|
96
|
+
this.name = "InvalidContinuationTokenError";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* A session-bound direct call whose harness cwd cannot be materialized and
|
|
101
|
+
* whose effect is not read: a write tool may rely on ctx.workspaceDir being
|
|
102
|
+
* the real session workspace, so it fails typed instead of silently running
|
|
103
|
+
* in a scratch directory.
|
|
104
|
+
*/
|
|
105
|
+
export class WorkspaceUnavailableError extends Error {
|
|
106
|
+
constructor(toolName, cause) {
|
|
107
|
+
super(`Session workspace unavailable for tool "${toolName}": ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
108
|
+
this.name = "WorkspaceUnavailableError";
|
|
109
|
+
}
|
|
110
|
+
}
|
|
93
111
|
export class ToolInputError extends Error {
|
|
94
112
|
constructor(args) {
|
|
95
113
|
super(`Invalid input for tool "${args.toolName}": ${args.detail}`);
|
|
@@ -116,7 +134,7 @@ export class ApprovalInterruptedError extends Error {
|
|
|
116
134
|
}
|
|
117
135
|
export class SessionEngine {
|
|
118
136
|
constructor(options) {
|
|
119
|
-
var _a, _b, _c, _d;
|
|
137
|
+
var _a, _b, _c, _d, _e;
|
|
120
138
|
/** In-flight lazy restores, deduped per channel + continuation key. */
|
|
121
139
|
this.restoreInFlight = new Map();
|
|
122
140
|
this.channelsById = new Map();
|
|
@@ -215,8 +233,11 @@ export class SessionEngine {
|
|
|
215
233
|
// Peer and Cursor-account transports are symbolic until the serve host
|
|
216
234
|
// resolves them; the host-side MCP registry starts with the concrete
|
|
217
235
|
// connections and gains the rest via setResolvedConnections.
|
|
218
|
-
this.mcpHost = new McpHost(
|
|
219
|
-
|
|
236
|
+
this.mcpHost = new McpHost([
|
|
237
|
+
...options.project.agent.connections,
|
|
238
|
+
...((_d = options.project.agent.hostConnections) !== null && _d !== void 0 ? _d : []),
|
|
239
|
+
].filter((connection) => !isSymbolicConnectionTransport(connection.transport)));
|
|
240
|
+
const basePlatforms = (_e = options.platforms) !== null && _e !== void 0 ? _e : createHostPlatforms();
|
|
220
241
|
const slackBinding = resolveDedicatedSlackHostBinding(options.project.channels);
|
|
221
242
|
this.platforms =
|
|
222
243
|
slackBinding === undefined
|
|
@@ -1539,23 +1560,17 @@ export class SessionEngine {
|
|
|
1539
1560
|
* Connection names a cloud turn can only reach through the host connection
|
|
1540
1561
|
* bridge on the tool MCP endpoint: filtered account connections without a
|
|
1541
1562
|
* public bridge URL, and host-OAuth connections whose tokens live on this
|
|
1542
|
-
* host.
|
|
1543
|
-
* must not see the connection at all, on any runtime.
|
|
1563
|
+
* host.
|
|
1544
1564
|
*/
|
|
1545
1565
|
cloudBridgeableConnectionNames() {
|
|
1546
|
-
const hostOnlyNames = new Set(this.project.agent.connections
|
|
1547
|
-
.filter((connection) => connection.hostOnly === true)
|
|
1548
|
-
.map((connection) => connection.name));
|
|
1549
1566
|
const names = [];
|
|
1550
1567
|
for (const connection of this.project.agent.connections) {
|
|
1551
|
-
if (
|
|
1552
|
-
isHostOauthConnectionTransport(connection.transport)) {
|
|
1568
|
+
if (isHostOauthConnectionTransport(connection.transport)) {
|
|
1553
1569
|
names.push(connection.name);
|
|
1554
1570
|
}
|
|
1555
1571
|
}
|
|
1556
1572
|
for (const resolved of this.resolvedConnections) {
|
|
1557
|
-
if (
|
|
1558
|
-
resolved.accountServersFilter !== undefined &&
|
|
1573
|
+
if (resolved.accountServersFilter !== undefined &&
|
|
1559
1574
|
resolved.cloudUrl === undefined) {
|
|
1560
1575
|
names.push(resolved.name);
|
|
1561
1576
|
}
|
|
@@ -1565,8 +1580,7 @@ export class SessionEngine {
|
|
|
1565
1580
|
/**
|
|
1566
1581
|
* True when cloud turns reach `name` through the host connection bridge —
|
|
1567
1582
|
* the gate the tool MCP endpoint applies before forwarding a bridge
|
|
1568
|
-
* request to `host.mcp`, so
|
|
1569
|
-
* stay unreachable from a VM.
|
|
1583
|
+
* request to `host.mcp`, so arbitrary names stay unreachable from a VM.
|
|
1570
1584
|
*/
|
|
1571
1585
|
isCloudBridgedConnection(name) {
|
|
1572
1586
|
if (this.cloudServerToolsConnection === undefined) {
|
|
@@ -1591,24 +1605,26 @@ export class SessionEngine {
|
|
|
1591
1605
|
return Object.assign(Object.assign({}, connection), { url: url.toString() });
|
|
1592
1606
|
}
|
|
1593
1607
|
/**
|
|
1594
|
-
* Authored + resolved MCP servers for a turn. Skips
|
|
1595
|
-
*
|
|
1596
|
-
*
|
|
1597
|
-
*
|
|
1608
|
+
* Authored + resolved MCP servers for a turn. Skips advertised
|
|
1609
|
+
* connections (those surface as named server tools). On cloud turns,
|
|
1610
|
+
* connections whose credential lives on this host — filtered account
|
|
1611
|
+
* connections without a public bridge URL, host-OAuth servers — mount
|
|
1612
|
+
* as host connection bridges over the tool MCP endpoint instead of
|
|
1598
1613
|
* being omitted or failing the turn closed.
|
|
1599
1614
|
*/
|
|
1600
1615
|
buildMcpServers(runtime, sessionId, sessionAuth) {
|
|
1616
|
+
var _a;
|
|
1601
1617
|
// The Grok Bot harness manages its own MCP surface; authored
|
|
1602
1618
|
// connections are refused at discovery, so there is nothing to mount.
|
|
1603
1619
|
if (runtime === "grokbot") {
|
|
1604
1620
|
return {};
|
|
1605
1621
|
}
|
|
1606
1622
|
// Advertised connections surface as named server tools instead of an
|
|
1607
|
-
// attached MCP server (each tool appears exactly once)
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
.filter((connection) => connection.hostOnly === true || connection.advertiseTools === true)
|
|
1623
|
+
// attached MCP server (each tool appears exactly once).
|
|
1624
|
+
const advertisedNames = new Set(this.project.agent.connections
|
|
1625
|
+
.filter((connection) => connection.advertiseTools === true)
|
|
1611
1626
|
.map((connection) => connection.name));
|
|
1627
|
+
const hostConnectionNames = new Set(((_a = this.project.agent.hostConnections) !== null && _a !== void 0 ? _a : []).map((connection) => connection.name));
|
|
1612
1628
|
const bridgedNames = new Set(runtime === "cloud" &&
|
|
1613
1629
|
sessionId !== undefined &&
|
|
1614
1630
|
this.cloudServerToolsConnection !== undefined &&
|
|
@@ -1617,7 +1633,8 @@ export class SessionEngine {
|
|
|
1617
1633
|
: []);
|
|
1618
1634
|
assertCloudCanHonorAccountServersFilters({
|
|
1619
1635
|
runtime,
|
|
1620
|
-
resolvedConnections: this.resolvedConnections.filter((resolved) => !
|
|
1636
|
+
resolvedConnections: this.resolvedConnections.filter((resolved) => !advertisedNames.has(resolved.name) &&
|
|
1637
|
+
!hostConnectionNames.has(resolved.name)),
|
|
1621
1638
|
bridgedNames,
|
|
1622
1639
|
});
|
|
1623
1640
|
const bridgeTransport = (name) => sessionId === undefined || !bridgedNames.has(name)
|
|
@@ -1625,7 +1642,8 @@ export class SessionEngine {
|
|
|
1625
1642
|
: this.cloudBridgeTransport(sessionId, name);
|
|
1626
1643
|
const servers = {};
|
|
1627
1644
|
for (const connection of this.project.agent.connections) {
|
|
1628
|
-
if (
|
|
1645
|
+
if (advertisedNames.has(connection.name) ||
|
|
1646
|
+
hostConnectionNames.has(connection.name)) {
|
|
1629
1647
|
continue;
|
|
1630
1648
|
}
|
|
1631
1649
|
if (isSymbolicConnectionTransport(connection.transport)) {
|
|
@@ -1661,7 +1679,8 @@ export class SessionEngine {
|
|
|
1661
1679
|
servers[connection.name] = connection.transport;
|
|
1662
1680
|
}
|
|
1663
1681
|
for (const resolved of this.resolvedConnections) {
|
|
1664
|
-
if (
|
|
1682
|
+
if (advertisedNames.has(resolved.name) ||
|
|
1683
|
+
hostConnectionNames.has(resolved.name)) {
|
|
1665
1684
|
continue;
|
|
1666
1685
|
}
|
|
1667
1686
|
const url = runtime === "cloud" ? resolved.cloudUrl : resolved.localUrl;
|
|
@@ -1698,14 +1717,12 @@ export class SessionEngine {
|
|
|
1698
1717
|
}
|
|
1699
1718
|
/**
|
|
1700
1719
|
* True when a connection with per-session `auth` attaches to the model
|
|
1701
|
-
* (not
|
|
1720
|
+
* (not advertised). These turns set
|
|
1702
1721
|
* {@link RunnerTurnRequest.perSendMcpServers} so the evaluated headers
|
|
1703
1722
|
* ride every send instead of being pinned on the cached agent handle.
|
|
1704
1723
|
*/
|
|
1705
1724
|
hasAttachedAuthedConnections() {
|
|
1706
|
-
return this.project.agent.connections.some((connection) => connection.auth !== undefined &&
|
|
1707
|
-
connection.hostOnly !== true &&
|
|
1708
|
-
connection.advertiseTools !== true);
|
|
1725
|
+
return this.project.agent.connections.some((connection) => connection.auth !== undefined && connection.advertiseTools !== true);
|
|
1709
1726
|
}
|
|
1710
1727
|
/**
|
|
1711
1728
|
* Evaluate per-session connection auth (`defineConnection({ auth })`)
|
|
@@ -1716,9 +1733,7 @@ export class SessionEngine {
|
|
|
1716
1733
|
*/
|
|
1717
1734
|
evaluateConnectionAuth(record) {
|
|
1718
1735
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1719
|
-
const authed = this.project.agent.connections.filter((connection) => connection.auth !== undefined &&
|
|
1720
|
-
connection.hostOnly !== true &&
|
|
1721
|
-
connection.advertiseTools !== true);
|
|
1736
|
+
const authed = this.project.agent.connections.filter((connection) => connection.auth !== undefined && connection.advertiseTools !== true);
|
|
1722
1737
|
if (authed.length === 0) {
|
|
1723
1738
|
return undefined;
|
|
1724
1739
|
}
|
|
@@ -2021,61 +2036,184 @@ export class SessionEngine {
|
|
|
2021
2036
|
* with the same `{ content, isError }` envelope the model would see, not
|
|
2022
2037
|
* an exception.
|
|
2023
2038
|
*/
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
if (!validation.ok) {
|
|
2039
|
-
throw new ToolInputError({ toolName, detail: validation.message });
|
|
2039
|
+
/**
|
|
2040
|
+
* The session identity a direct call (or catalog listing) runs under:
|
|
2041
|
+
* an explicit sessionId, a continuation token resolved to a live (or
|
|
2042
|
+
* restorable) session with the same owner/busy checks a sessionId call
|
|
2043
|
+
* gets, or — when neither maps to a session — a synthetic identity
|
|
2044
|
+
* carrying the token's channel id and continuation key so binding
|
|
2045
|
+
* resolvers (e.g. VFS mounts) can still serve the call.
|
|
2046
|
+
*/
|
|
2047
|
+
resolveDirectCallIdentity(callId, options) {
|
|
2048
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2049
|
+
var _a, _b, _c;
|
|
2050
|
+
if (options.sessionId !== undefined &&
|
|
2051
|
+
options.continuationToken !== undefined) {
|
|
2052
|
+
throw new InvalidContinuationTokenError("mutually exclusive with sessionId — a real session already carries its own continuation key");
|
|
2040
2053
|
}
|
|
2041
|
-
const callId = newToolCallId(toolName);
|
|
2042
2054
|
const auth = (_a = options.auth) !== null && _a !== void 0 ? _a : null;
|
|
2043
2055
|
let record;
|
|
2044
|
-
let
|
|
2045
|
-
let workspaceDir;
|
|
2046
|
-
let scratchDir;
|
|
2056
|
+
let continuation = null;
|
|
2047
2057
|
if (options.sessionId !== undefined) {
|
|
2048
2058
|
record = yield this.sessions.get(options.sessionId);
|
|
2049
2059
|
if (record === undefined) {
|
|
2050
2060
|
throw new UnknownSessionError(options.sessionId);
|
|
2051
2061
|
}
|
|
2062
|
+
}
|
|
2063
|
+
else if (options.continuationToken !== undefined) {
|
|
2064
|
+
continuation = parseContinuationToken(options.continuationToken);
|
|
2065
|
+
if (continuation === null) {
|
|
2066
|
+
throw new InvalidContinuationTokenError(`expected "<channelId>:<key>" (as /v1/sessions lists it), got "${options.continuationToken}"`);
|
|
2067
|
+
}
|
|
2068
|
+
// A token that maps to a live (or restorable) session takes the
|
|
2069
|
+
// session path: same owner check, same turn serialization, same
|
|
2070
|
+
// event recording as an explicit sessionId. Skipping those just
|
|
2071
|
+
// because the caller addressed the session by token would fail open.
|
|
2072
|
+
record = (_b = (yield this.sessions.findByContinuation(continuation.channelId, continuation.key))) !== null && _b !== void 0 ? _b : (yield this.restoreSessionByContinuation(continuation.channelId, continuation.key));
|
|
2073
|
+
if (record !== undefined && !samePrincipal(record.auth, auth)) {
|
|
2074
|
+
throw new SessionAuthError(record.sessionId);
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
if (record !== undefined) {
|
|
2052
2078
|
// Direct calls respect the same serialization as follow-up sends: a
|
|
2053
2079
|
// running model turn owns the session workspace and event stream.
|
|
2054
2080
|
if (this.activeTurns.has(record.sessionId) ||
|
|
2055
2081
|
this.pendingTurns.has(record.sessionId)) {
|
|
2056
2082
|
throw new SessionBusyError(record.sessionId);
|
|
2057
2083
|
}
|
|
2058
|
-
|
|
2059
|
-
|
|
2084
|
+
return {
|
|
2085
|
+
record,
|
|
2086
|
+
session: this.sessionInfo(record),
|
|
2087
|
+
workspaceDir: this.harnessCwd(record),
|
|
2088
|
+
scratchDir: undefined,
|
|
2089
|
+
};
|
|
2060
2090
|
}
|
|
2061
|
-
|
|
2062
|
-
|
|
2091
|
+
// No session behind the token (or no token at all): a synthetic
|
|
2092
|
+
// session carries the token's channel id and key, so binding resolvers
|
|
2093
|
+
// keyed on the continuation key (e.g. VFS mounts) can serve the call
|
|
2094
|
+
// with no live session. The workspace stays scratch and nothing is
|
|
2095
|
+
// recorded on a session event stream.
|
|
2096
|
+
const scratchDir = join(this.stateRoot, "tool-calls", callId);
|
|
2097
|
+
return {
|
|
2098
|
+
record: undefined,
|
|
2099
|
+
session: {
|
|
2063
2100
|
id: callId,
|
|
2064
|
-
channelId: DIRECT_TOOL_CALL_CHANNEL_ID,
|
|
2101
|
+
channelId: (_c = continuation === null || continuation === void 0 ? void 0 : continuation.channelId) !== null && _c !== void 0 ? _c : DIRECT_TOOL_CALL_CHANNEL_ID,
|
|
2065
2102
|
mode: "task",
|
|
2103
|
+
continuationKey: continuation === null || continuation === void 0 ? void 0 : continuation.key,
|
|
2066
2104
|
auth,
|
|
2067
|
-
}
|
|
2105
|
+
},
|
|
2106
|
+
workspaceDir: scratchDir,
|
|
2107
|
+
scratchDir,
|
|
2108
|
+
};
|
|
2109
|
+
});
|
|
2110
|
+
}
|
|
2111
|
+
/**
|
|
2112
|
+
* The live tool catalog for one session identity: authored server tools
|
|
2113
|
+
* plus the advertised passthroughs a turn under the same identity would
|
|
2114
|
+
* see, under their model-facing names. A connection whose listing fails
|
|
2115
|
+
* is skipped and reported in `connectionErrors` — the inspection surface
|
|
2116
|
+
* degrades legibly instead of hiding every other tool behind one broken
|
|
2117
|
+
* connector.
|
|
2118
|
+
*/
|
|
2119
|
+
listCatalogTools() {
|
|
2120
|
+
return __awaiter(this, arguments, void 0, function* (options = {}) {
|
|
2121
|
+
const { session } = yield this.resolveDirectCallIdentity(newToolCallId("catalog"), options);
|
|
2122
|
+
const connectionErrors = [];
|
|
2123
|
+
const advertised = yield resolveAdvertisedTools({
|
|
2124
|
+
agent: this.project.agent,
|
|
2125
|
+
session,
|
|
2126
|
+
hostMcp: this.mcpHost,
|
|
2127
|
+
onConnectionError: (connection, error) => {
|
|
2128
|
+
connectionErrors.push({
|
|
2129
|
+
connection,
|
|
2130
|
+
message: error instanceof Error ? error.message : String(error),
|
|
2131
|
+
});
|
|
2132
|
+
},
|
|
2133
|
+
});
|
|
2134
|
+
return {
|
|
2135
|
+
tools: [...this.project.agent.tools, ...advertised],
|
|
2136
|
+
connectionErrors,
|
|
2137
|
+
};
|
|
2138
|
+
});
|
|
2139
|
+
}
|
|
2140
|
+
callTool(toolName_1) {
|
|
2141
|
+
return __awaiter(this, arguments, void 0, function* (toolName, input = {}, options = {}) {
|
|
2142
|
+
const callId = newToolCallId(toolName);
|
|
2143
|
+
// Identity resolves before the tool lookup: advertised connection tools
|
|
2144
|
+
// only exist relative to a session (per-session auth), so finding them
|
|
2145
|
+
// needs the same identity the call runs under.
|
|
2146
|
+
const identity = yield this.resolveDirectCallIdentity(callId, options);
|
|
2147
|
+
const record = identity.record;
|
|
2148
|
+
const session = identity.session;
|
|
2149
|
+
let workspaceDir = identity.workspaceDir;
|
|
2150
|
+
let scratchDir = identity.scratchDir;
|
|
2151
|
+
let tool = this.project.agent.tools.find((t) => t.name === toolName);
|
|
2152
|
+
if (tool === undefined &&
|
|
2153
|
+
this.project.agent.connections.some((c) => c.advertiseTools === true)) {
|
|
2154
|
+
// Advertised passthroughs are ordinary server tools in the session's
|
|
2155
|
+
// namespace; resolve the live listing so direct calls address them by
|
|
2156
|
+
// the same model-facing name a turn would. A listing failure fails
|
|
2157
|
+
// the call closed, like it fails a turn.
|
|
2158
|
+
const advertised = yield resolveAdvertisedTools({
|
|
2159
|
+
agent: this.project.agent,
|
|
2160
|
+
session,
|
|
2161
|
+
hostMcp: this.mcpHost,
|
|
2162
|
+
});
|
|
2163
|
+
tool = advertised.find((t) => t.name === toolName);
|
|
2164
|
+
}
|
|
2165
|
+
if (tool === undefined) {
|
|
2166
|
+
throw new UnknownToolError(toolName, this.project.agent.tools
|
|
2167
|
+
.filter((t) => t.execution === "server")
|
|
2168
|
+
.map((t) => t.name));
|
|
2169
|
+
}
|
|
2170
|
+
const execute = tool.definition.execute;
|
|
2171
|
+
if (tool.execution !== "server" || typeof execute !== "function") {
|
|
2172
|
+
throw new ToolNotDirectlyCallableError(toolName);
|
|
2173
|
+
}
|
|
2174
|
+
const validation = validateToolInput(tool.definition.inputSchema, input);
|
|
2175
|
+
if (!validation.ok) {
|
|
2176
|
+
throw new ToolInputError({ toolName, detail: validation.message });
|
|
2177
|
+
}
|
|
2178
|
+
let workspaceUnavailable = false;
|
|
2179
|
+
try {
|
|
2180
|
+
yield mkdir(workspaceDir, { recursive: true });
|
|
2181
|
+
}
|
|
2182
|
+
catch (error) {
|
|
2183
|
+
if (record === undefined) {
|
|
2184
|
+
throw error;
|
|
2185
|
+
}
|
|
2186
|
+
// A session's harness cwd can be a path the serving process cannot
|
|
2187
|
+
// create (e.g. an absolute `local.cwd` like /repo on a hosted pod
|
|
2188
|
+
// where the sandboxed harness would have made it). Read-effect calls
|
|
2189
|
+
// fall back to a scratch workspace instead of failing: tools that
|
|
2190
|
+
// resolve their state from the session identity (VFS mounts) never
|
|
2191
|
+
// touch ctx.workspaceDir. Advertised passthroughs are relocatable by
|
|
2192
|
+
// construction: their execute body forwards to the connection and
|
|
2193
|
+
// never reads the workspace. A write (or undeclared, which resolves
|
|
2194
|
+
// to write) authored tool may rely on ctx.workspaceDir being the
|
|
2195
|
+
// real session workspace, so silently relocating it is not safe —
|
|
2196
|
+
// fail typed instead.
|
|
2197
|
+
const relocatable = tool.advertised === true ||
|
|
2198
|
+
resolveEffect(tool.definition.effect, validation.value) === "read";
|
|
2199
|
+
if (!relocatable) {
|
|
2200
|
+
throw new WorkspaceUnavailableError(toolName, error);
|
|
2201
|
+
}
|
|
2202
|
+
this.logger(`[session] tool ${toolName} workspace unavailable (direct ${callId}); using scratch: ${error instanceof Error ? error.message : String(error)}`);
|
|
2068
2203
|
scratchDir = join(this.stateRoot, "tool-calls", callId);
|
|
2069
2204
|
workspaceDir = scratchDir;
|
|
2205
|
+
workspaceUnavailable = true;
|
|
2206
|
+
yield mkdir(workspaceDir, { recursive: true });
|
|
2070
2207
|
}
|
|
2071
|
-
yield mkdir(workspaceDir, { recursive: true });
|
|
2072
2208
|
// Match what a model turn would see: session workspaces get the same
|
|
2073
2209
|
// scaffold as executeTurn (seeds only before the first turn); scratch
|
|
2074
2210
|
// workspaces are materialized fresh.
|
|
2075
2211
|
yield materializeWorkspace({
|
|
2076
2212
|
agent: this.project.agent,
|
|
2077
|
-
workspaceDir: record === undefined
|
|
2078
|
-
|
|
2213
|
+
workspaceDir: record === undefined || workspaceUnavailable
|
|
2214
|
+
? workspaceDir
|
|
2215
|
+
: this.scaffoldDir(record),
|
|
2216
|
+
seed: record === undefined || workspaceUnavailable || record.turnCount === 0,
|
|
2079
2217
|
stateRoot: this.stateRoot,
|
|
2080
2218
|
});
|
|
2081
2219
|
// A per-call turnId keeps these events visible in trajectories (which
|
|
@@ -2172,11 +2310,16 @@ export class SessionEngine {
|
|
|
2172
2310
|
});
|
|
2173
2311
|
}
|
|
2174
2312
|
const errorMessage = isError ? toolCallErrorMessage(result) : undefined;
|
|
2175
|
-
return
|
|
2313
|
+
return {
|
|
2314
|
+
toolName,
|
|
2176
2315
|
callId,
|
|
2177
2316
|
isError,
|
|
2178
2317
|
result,
|
|
2179
|
-
durationMs
|
|
2318
|
+
durationMs,
|
|
2319
|
+
errorMessage,
|
|
2320
|
+
sessionId: record === null || record === void 0 ? void 0 : record.sessionId,
|
|
2321
|
+
scratchWorkspace: workspaceUnavailable ? true : undefined,
|
|
2322
|
+
};
|
|
2180
2323
|
});
|
|
2181
2324
|
}
|
|
2182
2325
|
/**
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Projections for the live tool catalog (`GET /v1/tools` and
|
|
3
|
+
* `GET /v1/tools/:name`): the session's tool namespace exactly as a turn
|
|
4
|
+
* would assemble it — authored server tools plus advertised MCP
|
|
5
|
+
* passthroughs — under model-facing names.
|
|
6
|
+
*
|
|
7
|
+
* Titles are curated data, never derived from descriptions: advertised
|
|
8
|
+
* tools inherit the upstream server's MCP `annotations.title` (bounded at
|
|
9
|
+
* listing time), and the well-known non-MCP tool names carry a hardcoded
|
|
10
|
+
* title here so every deployment shows the same display names.
|
|
11
|
+
*/
|
|
12
|
+
import type { DiscoveredTool, JsonSchemaObject, ToolEffect, ToolExecution } from "../types.js";
|
|
13
|
+
/** Light listing entry: identifiers and curated display data only. */
|
|
14
|
+
export interface CatalogListEntry {
|
|
15
|
+
name: string;
|
|
16
|
+
title?: string;
|
|
17
|
+
/** Connection name for advertised MCP tools; absent for authored tools. */
|
|
18
|
+
source?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Full description behind `GET /v1/tools/:name`. */
|
|
21
|
+
export interface CatalogDetailEntry extends CatalogListEntry {
|
|
22
|
+
description: string;
|
|
23
|
+
execution: ToolExecution;
|
|
24
|
+
needsApproval: boolean;
|
|
25
|
+
effect?: ToolEffect | "dynamic";
|
|
26
|
+
inputSchema: JsonSchemaObject;
|
|
27
|
+
outputSchema?: JsonSchemaObject;
|
|
28
|
+
}
|
|
29
|
+
export declare function catalogListEntry(tool: DiscoveredTool): CatalogListEntry;
|
|
30
|
+
export declare function catalogDetailEntry(tool: DiscoveredTool): CatalogDetailEntry;
|
|
31
|
+
//# sourceMappingURL=tool-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-catalog.d.ts","sourceRoot":"","sources":["../../src/internal/tool-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,aAAa,EACd,MAAM,aAAa,CAAC;AAoDrB,sEAAsE;AACtE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qDAAqD;AACrD,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,aAAa,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACjC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,gBAAgB,CAMvE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,cAAc,GAAG,kBAAkB,CAU3E"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Projections for the live tool catalog (`GET /v1/tools` and
|
|
3
|
+
* `GET /v1/tools/:name`): the session's tool namespace exactly as a turn
|
|
4
|
+
* would assemble it — authored server tools plus advertised MCP
|
|
5
|
+
* passthroughs — under model-facing names.
|
|
6
|
+
*
|
|
7
|
+
* Titles are curated data, never derived from descriptions: advertised
|
|
8
|
+
* tools inherit the upstream server's MCP `annotations.title` (bounded at
|
|
9
|
+
* listing time), and the well-known non-MCP tool names carry a hardcoded
|
|
10
|
+
* title here so every deployment shows the same display names.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Display names for the well-known tool names that do not come from MCP
|
|
14
|
+
* (authored tools have no title field; adding one to `defineTool` for a
|
|
15
|
+
* presentation concern is not worth the authoring surface).
|
|
16
|
+
*/
|
|
17
|
+
const WELL_KNOWN_TOOL_TITLES = {
|
|
18
|
+
diff: "Show change diffs",
|
|
19
|
+
glob: "Find files by pattern",
|
|
20
|
+
grep: "Search file contents",
|
|
21
|
+
ls: "List a directory",
|
|
22
|
+
read: "Read a file",
|
|
23
|
+
search: "Search with a typed query",
|
|
24
|
+
write: "Write a file",
|
|
25
|
+
};
|
|
26
|
+
function catalogTitle(tool) {
|
|
27
|
+
var _a;
|
|
28
|
+
if (tool.advertised === true) {
|
|
29
|
+
return (_a = tool.annotations) === null || _a === void 0 ? void 0 : _a.title;
|
|
30
|
+
}
|
|
31
|
+
return WELL_KNOWN_TOOL_TITLES[tool.name];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Sand connector identifiers scope the connector name by owner
|
|
35
|
+
* (`dashboard-team-<id>-Buildkite`, `dashboard-<Name>`, `user-<Name>`);
|
|
36
|
+
* the suffix is the human-meaningful name.
|
|
37
|
+
*/
|
|
38
|
+
const CONNECTOR_SCOPE_PREFIX = /^(?:dashboard-team-\d+-|dashboard-|user-)/;
|
|
39
|
+
/**
|
|
40
|
+
* Where a tool comes from, for humans: the upstream connector/plugin name
|
|
41
|
+
* when the tool declares one (the reserved `__conn__` selector's values
|
|
42
|
+
* name it), the connection name otherwise. One aggregating connection
|
|
43
|
+
* (e.g. a tenant `plugins` endpoint) hosts tools from several connectors,
|
|
44
|
+
* and "plugins" tells an operator nothing — "Buildkite" does.
|
|
45
|
+
*/
|
|
46
|
+
function catalogSource(tool) {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
if (tool.advertised !== true) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
const properties = tool.inputSchema.properties;
|
|
52
|
+
const first = (_b = (_a = properties === null || properties === void 0 ? void 0 : properties.__conn__) === null || _a === void 0 ? void 0 : _a.enum) === null || _b === void 0 ? void 0 : _b[0];
|
|
53
|
+
if (typeof first === "string" && first !== "") {
|
|
54
|
+
return first.replace(CONNECTOR_SCOPE_PREFIX, "");
|
|
55
|
+
}
|
|
56
|
+
return tool.connection;
|
|
57
|
+
}
|
|
58
|
+
export function catalogListEntry(tool) {
|
|
59
|
+
return {
|
|
60
|
+
name: tool.name,
|
|
61
|
+
title: catalogTitle(tool),
|
|
62
|
+
source: catalogSource(tool),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export function catalogDetailEntry(tool) {
|
|
66
|
+
return Object.assign(Object.assign({}, catalogListEntry(tool)), { description: tool.description, execution: tool.execution, needsApproval: tool.needsApproval, effect: tool.effect, inputSchema: tool.inputSchema, outputSchema: tool.outputSchema });
|
|
67
|
+
}
|