@cursor/july 0.1.92 → 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 +115 -182
- package/dist/channels/deployments/deployments-channel.d.ts +7 -0
- package/dist/channels/deployments/deployments-channel.d.ts.map +1 -1
- package/dist/channels/deployments/deployments-channel.js +26 -2
- package/dist/channels/deployments/types.d.ts +8 -0
- package/dist/channels/deployments/types.d.ts.map +1 -1
- package/dist/channels/github/github-channel.d.ts +3 -0
- package/dist/channels/github/github-channel.d.ts.map +1 -1
- package/dist/channels/github/github-channel.js +28 -56
- 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/continuation.d.ts +1 -1
- package/dist/continuation.js +1 -1
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +8 -8
- package/dist/docs/ab.md +7 -13
- package/dist/docs/assets/{ab.md.CVzWxLoB.js → ab.md.DJo5r4R-.js} +4 -4
- package/dist/docs/assets/{ab.md.CVzWxLoB.lean.js → ab.md.DJo5r4R-.lean.js} +1 -1
- package/dist/docs/assets/{app.Bci6CM9E.js → app.CFDEas4I.js} +1 -1
- package/dist/docs/assets/building-with-agents.md.DI4mEzlt.js +13 -0
- package/dist/docs/assets/{building-with-agents.md.DH8A_cHA.lean.js → building-with-agents.md.DI4mEzlt.lean.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.DU3U2Ij2.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.BCPT6xA-.js → VPLocalSearchBox.B1IIYpYS.js} +1 -1
- package/dist/docs/assets/chunks/{theme.BEA8BF3c.js → theme.Ct4NSiLm.js} +2 -2
- package/dist/docs/assets/concepts.md.lwAgBIMI.js +1 -0
- package/dist/docs/assets/{concepts.md.CRfU3bVg.lean.js → concepts.md.lwAgBIMI.lean.js} +1 -1
- package/dist/docs/assets/{deployment.md.DX_hc3ze.js → deployment.md.D9msOFOW.js} +9 -14
- package/dist/docs/assets/{deployment.md.DX_hc3ze.lean.js → deployment.md.D9msOFOW.lean.js} +1 -1
- package/dist/docs/assets/{evals.md.a0SMN6r9.js → evals.md.lfJoEVc8.js} +6 -6
- package/dist/docs/assets/{evals.md.a0SMN6r9.lean.js → evals.md.lfJoEVc8.lean.js} +1 -1
- package/dist/docs/assets/{guides_agent-to-agent.md.BCeVdJRJ.js → guides_agent-to-agent.md.BDb0t1QV.js} +2 -2
- 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.D06eIzea.js → guides_convert-automation.md.B4sjlodG.js} +2 -2
- package/dist/docs/assets/{guides_github.md.Cdt1s2QC.js → guides_github.md.Cnh2mL4a.js} +5 -5
- package/dist/docs/assets/{guides_github.md.Cdt1s2QC.lean.js → guides_github.md.Cnh2mL4a.lean.js} +1 -1
- package/dist/docs/assets/{guides_mcp-oauth.md.Du0f7pGU.js → guides_mcp-oauth.md.DPYmBCbV.js} +7 -9
- package/dist/docs/assets/{guides_mcp-oauth.md.Du0f7pGU.lean.js → guides_mcp-oauth.md.DPYmBCbV.lean.js} +1 -1
- package/dist/docs/assets/{guides_slack.md.DiUmk_Oi.js → guides_slack.md.C32HsdKk.js} +7 -13
- package/dist/docs/assets/guides_slack.md.C32HsdKk.lean.js +1 -0
- package/dist/docs/assets/{guides_webhooks.md.BpnIdO0i.js → guides_webhooks.md.DKdA43Qm.js} +2 -2
- package/dist/docs/assets/{hillclimbing.md.ywF3yDAd.js → hillclimbing.md.DhESf3OO.js} +1 -1
- package/dist/docs/assets/index.md.DRakGHFe.js +5 -0
- package/dist/docs/assets/{index.md.BAaMXLFd.lean.js → index.md.DRakGHFe.lean.js} +1 -1
- package/dist/docs/assets/{quickstart.md.DsrarzEg.js → quickstart.md.Nj_LjW_a.js} +2 -2
- package/dist/docs/assets/{reference_agent-config.md.Bqylgw50.js → reference_agent-config.md.Cp_x38Nl.js} +3 -3
- package/dist/docs/assets/{reference_channels.md.DQZjCnyh.js → reference_channels.md.Cd2f2iyV.js} +2 -2
- package/dist/docs/assets/{reference_channels.md.DQZjCnyh.lean.js → reference_channels.md.Cd2f2iyV.lean.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.B7GkAJRC.js → reference_cli.md.Cw6_ICYG.js} +10 -11
- package/dist/docs/assets/{reference_cli.md.B7GkAJRC.lean.js → reference_cli.md.Cw6_ICYG.lean.js} +1 -1
- package/dist/docs/assets/{reference_connections.md.DYidrb-j.js → reference_connections.md.BH8Oc0D0.js} +7 -7
- package/dist/docs/assets/{reference_connections.md.DYidrb-j.lean.js → reference_connections.md.BH8Oc0D0.lean.js} +1 -1
- package/dist/docs/assets/reference_hooks.md.a8BJxMR5.js +14 -0
- package/dist/docs/assets/{reference_hooks.md.B9FSgdDe.lean.js → reference_hooks.md.a8BJxMR5.lean.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_instructions.md.DhNCOl7r.js → reference_instructions.md.CR7XSsGk.js} +3 -3
- package/dist/docs/assets/{reference_instructions.md.DhNCOl7r.lean.js → reference_instructions.md.CR7XSsGk.lean.js} +1 -1
- package/dist/docs/assets/reference_playground.md.DnX5nL-B.js +1 -0
- package/dist/docs/assets/reference_playground.md.DnX5nL-B.lean.js +1 -0
- package/dist/docs/assets/reference_project-layout.md.Bv4KOtlB.js +19 -0
- package/dist/docs/assets/{reference_prompt.md.DZUMtLPD.js → reference_prompt.md.DnaD5dNK.js} +1 -1
- package/dist/docs/assets/{reference_schedules.md.DNipebiG.js → reference_schedules.md.DI_JrHgq.js} +1 -1
- package/dist/docs/assets/reference_sessions.md.D0mIh4KK.js +1 -0
- package/dist/docs/assets/{reference_sessions.md.tUFzz98S.lean.js → reference_sessions.md.D0mIh4KK.lean.js} +1 -1
- package/dist/docs/assets/{reference_skills.md.B5ZEuHfG.js → reference_skills.md.8son6Hjm.js} +4 -4
- package/dist/docs/assets/{reference_subagents.md.Xoav0AII.js → reference_subagents.md.CfsIloPm.js} +1 -1
- package/dist/docs/assets/{reference_tools.md.wpaJtHn6.js → reference_tools.md.BHeXn2id.js} +3 -3
- package/dist/docs/assets/{reference_tools.md.wpaJtHn6.lean.js → reference_tools.md.BHeXn2id.lean.js} +1 -1
- package/dist/docs/assets/scaffolding-agents.md.D7UUkWw0.js +1 -0
- package/dist/docs/assets/{scaffolding-agents.md.CRDDUtYJ.lean.js → scaffolding-agents.md.D7UUkWw0.lean.js} +1 -1
- package/dist/docs/assets/{storage.md.JbjlHWZ6.js → storage.md.BOHeqk2M.js} +5 -5
- package/dist/docs/assets/{storage.md.JbjlHWZ6.lean.js → storage.md.BOHeqk2M.lean.js} +1 -1
- package/dist/docs/assets/{templates_agentic-owners.md.DSJSIpWU.js → templates_agentic-owners.md.DqtPdm6f.js} +2 -2
- package/dist/docs/assets/{templates_pr-autofixer.md.1HAR3RXE.js → templates_pr-autofixer.md.DU7dQpor.js} +2 -2
- package/dist/docs/assets/{templates_pr-autofixer.md.1HAR3RXE.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/assets/{troubleshooting.md.DYECCZiJ.lean.js → troubleshooting.md.Ctv3T8C2.lean.js} +1 -1
- package/dist/docs/building-with-agents.html +7 -7
- package/dist/docs/building-with-agents.md +5 -11
- package/dist/docs/concepts.html +5 -8
- package/dist/docs/concepts.md +13 -17
- package/dist/docs/deployment.html +13 -18
- package/dist/docs/deployment.md +9 -30
- package/dist/docs/design/agsh.md +406 -0
- package/dist/docs/evals.html +10 -10
- package/dist/docs/evals.md +16 -37
- package/dist/docs/guides/agent-to-agent.html +6 -6
- package/dist/docs/guides/agent-to-agent.md +3 -3
- package/dist/docs/guides/cloud-runtime.html +6 -6
- package/dist/docs/guides/cloud-runtime.md +9 -25
- package/dist/docs/guides/convert-automation.html +7 -7
- package/dist/docs/guides/convert-automation.md +4 -4
- package/dist/docs/guides/github.html +9 -9
- package/dist/docs/guides/github.md +16 -28
- 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 +14 -22
- package/dist/docs/guides/opentelemetry.html +5 -5
- package/dist/docs/guides/slack.html +11 -17
- package/dist/docs/guides/slack.md +13 -50
- package/dist/docs/guides/webhooks.html +6 -6
- package/dist/docs/guides/webhooks.md +3 -3
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +6 -6
- package/dist/docs/hillclimbing.md +1 -1
- package/dist/docs/index.html +6 -6
- package/dist/docs/index.md +0 -36
- package/dist/docs/llms-full.txt +965 -3633
- package/dist/docs/llms.txt +3 -18
- package/dist/docs/quickstart.html +6 -6
- package/dist/docs/quickstart.md +3 -4
- package/dist/docs/reference/agent-config.html +8 -8
- package/dist/docs/reference/agent-config.md +10 -15
- package/dist/docs/reference/artifacts.html +4 -4
- package/dist/docs/reference/channels.html +6 -6
- package/dist/docs/reference/channels.md +20 -31
- package/dist/docs/reference/cli.html +14 -15
- package/dist/docs/reference/cli.md +29 -38
- package/dist/docs/reference/connections.html +11 -11
- package/dist/docs/reference/connections.md +24 -25
- package/dist/docs/reference/hooks.html +6 -6
- package/dist/docs/reference/hooks.md +12 -17
- package/dist/docs/reference/http-api.html +7 -7
- package/dist/docs/reference/http-api.md +25 -37
- package/dist/docs/reference/instructions.html +6 -6
- package/dist/docs/reference/instructions.md +1 -1
- package/dist/docs/reference/playground.html +5 -5
- package/dist/docs/reference/playground.md +14 -19
- package/dist/docs/reference/project-layout.html +9 -7
- package/dist/docs/reference/project-layout.md +7 -3
- package/dist/docs/reference/prompt.html +6 -6
- package/dist/docs/reference/prompt.md +1 -1
- package/dist/docs/reference/schedules.html +6 -6
- package/dist/docs/reference/schedules.md +1 -2
- package/dist/docs/reference/sessions.html +5 -12
- package/dist/docs/reference/sessions.md +8 -19
- package/dist/docs/reference/skills.html +8 -8
- package/dist/docs/reference/skills.md +3 -3
- package/dist/docs/reference/subagents.html +6 -6
- package/dist/docs/reference/subagents.md +2 -2
- package/dist/docs/reference/tools.html +8 -8
- package/dist/docs/reference/tools.md +30 -19
- package/dist/docs/scaffolding-agents.html +5 -5
- package/dist/docs/scaffolding-agents.md +4 -5
- package/dist/docs/storage.html +9 -9
- package/dist/docs/storage.md +37 -80
- package/dist/docs/templates/agentic-owners.html +7 -7
- package/dist/docs/templates/agentic-owners.md +2 -2
- package/dist/docs/templates/demo.html +4 -4
- package/dist/docs/templates/pr-autofixer.html +6 -6
- package/dist/docs/templates/pr-autofixer.md +7 -9
- 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 +8 -8
- 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/authored-alias-hooks.d.ts +14 -11
- package/dist/internal/authored-alias-hooks.d.ts.map +1 -1
- package/dist/internal/authored-alias-hooks.js +14 -11
- package/dist/internal/authored-loaders.d.ts +7 -6
- package/dist/internal/authored-loaders.d.ts.map +1 -1
- package/dist/internal/authored-loaders.js +14 -10
- package/dist/internal/cli-deploy.d.ts +1 -1
- package/dist/internal/cli-deploy.js +5 -5
- package/dist/internal/cli-mcp-oauth.d.ts.map +1 -1
- package/dist/internal/cli-mcp-oauth.js +7 -4
- package/dist/internal/continuation-channel.d.ts +6 -3
- package/dist/internal/continuation-channel.d.ts.map +1 -1
- package/dist/internal/continuation-channel.js +44 -40
- package/dist/internal/continuation-identity.d.ts +17 -16
- package/dist/internal/continuation-identity.d.ts.map +1 -1
- package/dist/internal/continuation-identity.js +109 -36
- 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/deploy-manifest.d.ts +2 -2
- package/dist/internal/deploy-manifest.d.ts.map +1 -1
- package/dist/internal/deploy-manifest.js +4 -9
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +91 -13
- package/dist/internal/distribution.d.ts +4 -3
- package/dist/internal/distribution.d.ts.map +1 -1
- package/dist/internal/distribution.js +4 -3
- package/dist/internal/hosted-delivery-protocol.d.ts +38 -0
- package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -0
- package/dist/internal/hosted-delivery-protocol.js +70 -0
- package/dist/internal/hosted-delivery.d.ts +35 -0
- package/dist/internal/hosted-delivery.d.ts.map +1 -0
- package/dist/internal/hosted-delivery.js +239 -0
- package/dist/internal/http-channel.d.ts.map +1 -1
- package/dist/internal/http-channel.js +1 -1
- package/dist/internal/mcp-endpoint.js +3 -3
- package/dist/internal/mcp-host.d.ts +8 -7
- package/dist/internal/mcp-host.d.ts.map +1 -1
- package/dist/internal/mcp-host.js +8 -7
- package/dist/internal/peer-connections.d.ts.map +1 -1
- package/dist/internal/peer-connections.js +5 -1
- package/dist/internal/playground/static.d.ts +0 -3
- package/dist/internal/playground/static.d.ts.map +1 -1
- package/dist/internal/resolved-connections.d.ts.map +1 -1
- package/dist/internal/resolved-connections.js +5 -7
- package/dist/internal/review-comments.d.ts +186 -63
- package/dist/internal/review-comments.d.ts.map +1 -1
- package/dist/internal/review-comments.js +350 -168
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +134 -175
- package/dist/internal/session-engine.d.ts +50 -10
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +221 -68
- package/dist/internal/shallow-clone.d.ts +8 -2
- package/dist/internal/shallow-clone.d.ts.map +1 -1
- package/dist/internal/shallow-clone.js +17 -10
- 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-DDvyC2z6.js → index-B3JCyigB.js} +2 -2
- package/dist/playground/index.html +1 -1
- package/dist/types.d.ts +81 -40
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +19 -0
- package/docs/README.md +0 -36
- package/docs/ab.md +7 -13
- package/docs/building-with-agents.md +5 -11
- package/docs/concepts.md +13 -17
- package/docs/deployment.md +9 -30
- package/docs/design/agsh.md +406 -0
- package/docs/evals.md +16 -37
- package/docs/guides/agent-to-agent.md +3 -3
- package/docs/guides/cloud-runtime.md +9 -25
- package/docs/guides/convert-automation.md +4 -4
- package/docs/guides/github.md +16 -28
- package/docs/guides/mcp-oauth.md +14 -22
- package/docs/guides/slack.md +14 -51
- package/docs/guides/webhooks.md +3 -3
- package/docs/hillclimbing.md +1 -1
- package/docs/quickstart.md +3 -4
- package/docs/reference/agent-config.md +10 -15
- package/docs/reference/channels.md +20 -31
- package/docs/reference/cli.md +29 -38
- package/docs/reference/connections.md +24 -25
- package/docs/reference/hooks.md +12 -17
- package/docs/reference/http-api.md +26 -38
- package/docs/reference/instructions.md +1 -1
- package/docs/reference/playground.md +14 -19
- package/docs/reference/project-layout.md +7 -3
- package/docs/reference/prompt.md +1 -1
- package/docs/reference/schedules.md +1 -2
- package/docs/reference/sessions.md +8 -19
- package/docs/reference/skills.md +3 -3
- package/docs/reference/subagents.md +2 -2
- package/docs/reference/tools.md +30 -19
- package/docs/scaffolding-agents.md +4 -5
- package/docs/storage.md +37 -80
- package/docs/templates/agentic-owners.md +2 -2
- package/docs/templates/pr-autofixer.md +7 -9
- package/docs/templates/security-reviewer.md +2 -3
- package/docs/troubleshooting.md +8 -8
- package/package.json +16 -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/deployments/deployments-channel.ts +32 -2
- package/src/channels/deployments/types.ts +8 -0
- package/src/channels/github/github-channel.ts +71 -21
- 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/continuation.ts +1 -1
- package/src/index.ts +2 -0
- package/src/internal/advertise-tools.ts +45 -7
- package/src/internal/authored-alias-hooks.ts +14 -11
- package/src/internal/authored-loaders.ts +14 -10
- package/src/internal/cli-deploy.ts +5 -5
- package/src/internal/cli-mcp-oauth.ts +6 -4
- package/src/internal/continuation-channel.ts +62 -45
- package/src/internal/continuation-identity.ts +123 -38
- 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/deploy-manifest.ts +5 -9
- package/src/internal/discovery.ts +107 -13
- package/src/internal/distribution.ts +4 -3
- package/src/internal/fixtures/units-server.ts +52 -0
- package/src/internal/hosted-delivery-protocol.ts +114 -0
- package/src/internal/hosted-delivery.ts +359 -0
- package/src/internal/http-channel.ts +0 -2
- package/src/internal/mcp-endpoint.ts +3 -3
- package/src/internal/mcp-host.ts +8 -7
- package/src/internal/peer-connections.ts +4 -1
- package/src/internal/playground/static.ts +1 -3
- package/src/internal/resolved-connections.ts +8 -10
- package/src/internal/review-comments.ts +542 -229
- package/src/internal/server.ts +180 -253
- package/src/internal/session-engine.ts +279 -70
- package/src/internal/shallow-clone.ts +30 -16
- package/src/internal/tool-catalog.ts +106 -0
- package/src/types.ts +99 -40
- 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/building-with-agents.md.DH8A_cHA.js +0 -13
- package/dist/docs/assets/chunks/@localSearchIndexroot.Dv-Q0XtU.js +0 -1
- package/dist/docs/assets/concepts.md.CRfU3bVg.js +0 -4
- package/dist/docs/assets/example-agents_approval-buddy.md.DNL83puR.js +0 -10
- package/dist/docs/assets/example-agents_approval-buddy.md.DNL83puR.lean.js +0 -1
- package/dist/docs/assets/example-agents_benny.md.C40vHRLc.js +0 -7
- package/dist/docs/assets/example-agents_benny.md.C40vHRLc.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.Dftj_tPp.js +0 -8
- package/dist/docs/assets/example-agents_codebase-wiki.md.Dftj_tPp.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.MrKpQndp.js +0 -23
- package/dist/docs/assets/example-agents_concierge.md.MrKpQndp.lean.js +0 -1
- package/dist/docs/assets/example-agents_fsd.md.ZWHWWZPE.js +0 -15
- package/dist/docs/assets/example-agents_fsd.md.ZWHWWZPE.lean.js +0 -1
- package/dist/docs/assets/example-agents_index.md.QZ8mhr6n.js +0 -2
- package/dist/docs/assets/example-agents_index.md.QZ8mhr6n.lean.js +0 -1
- package/dist/docs/assets/example-agents_knowledge-base.md.DqKqHQ9u.js +0 -11
- package/dist/docs/assets/example-agents_knowledge-base.md.DqKqHQ9u.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.Bai6D0Ee.js +0 -19
- package/dist/docs/assets/example-agents_security-reviewer.md.Bai6D0Ee.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.lVEAbWFf.js +0 -25
- package/dist/docs/assets/example-agents_weather-agent.md.lVEAbWFf.lean.js +0 -1
- package/dist/docs/assets/guides_cloud-runtime.md.BSMLIBHr.js +0 -9
- package/dist/docs/assets/guides_cloud-runtime.md.BSMLIBHr.lean.js +0 -1
- package/dist/docs/assets/guides_slack.md.DiUmk_Oi.lean.js +0 -1
- package/dist/docs/assets/index.md.BAaMXLFd.js +0 -5
- package/dist/docs/assets/reference_hooks.md.B9FSgdDe.js +0 -14
- package/dist/docs/assets/reference_http-api.md.CSHVobzG.js +0 -11
- package/dist/docs/assets/reference_http-api.md.CSHVobzG.lean.js +0 -1
- package/dist/docs/assets/reference_playground.md.Dfb92yQf.js +0 -1
- package/dist/docs/assets/reference_playground.md.Dfb92yQf.lean.js +0 -1
- package/dist/docs/assets/reference_project-layout.md.CwkSbEWT.js +0 -17
- package/dist/docs/assets/reference_sessions.md.tUFzz98S.js +0 -8
- package/dist/docs/assets/scaffolding-agents.md.CRDDUtYJ.js +0 -1
- package/dist/docs/assets/troubleshooting.md.DYECCZiJ.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 -33
- package/dist/docs/example-agents/benny.md +0 -182
- 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 -170
- 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 -49
- package/dist/docs/example-agents/concierge.md +0 -201
- package/dist/docs/example-agents/fsd.html +0 -41
- package/dist/docs/example-agents/fsd.md +0 -329
- package/dist/docs/example-agents/index.html +0 -28
- package/dist/docs/example-agents/index.md +0 -102
- 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 -296
- 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 -187
- package/docs/example-agents/bugbot.md +0 -234
- package/docs/example-agents/codebase-wiki.md +0 -175
- package/docs/example-agents/codeowners-review.md +0 -197
- package/docs/example-agents/concierge.md +0 -206
- package/docs/example-agents/fsd.md +0 -334
- package/docs/example-agents/index.md +0 -107
- 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 -301
- package/src/channels/slack/cursor-account.ts +0 -202
- package/src/internal/cursor-slack-relay.ts +0 -249
- /package/dist/docs/assets/{guides_agent-to-agent.md.BCeVdJRJ.lean.js → guides_agent-to-agent.md.BDb0t1QV.lean.js} +0 -0
- /package/dist/docs/assets/{guides_convert-automation.md.D06eIzea.lean.js → guides_convert-automation.md.B4sjlodG.lean.js} +0 -0
- /package/dist/docs/assets/{guides_webhooks.md.BpnIdO0i.lean.js → guides_webhooks.md.DKdA43Qm.lean.js} +0 -0
- /package/dist/docs/assets/{hillclimbing.md.ywF3yDAd.lean.js → hillclimbing.md.DhESf3OO.lean.js} +0 -0
- /package/dist/docs/assets/{quickstart.md.DsrarzEg.lean.js → quickstart.md.Nj_LjW_a.lean.js} +0 -0
- /package/dist/docs/assets/{reference_agent-config.md.Bqylgw50.lean.js → reference_agent-config.md.Cp_x38Nl.lean.js} +0 -0
- /package/dist/docs/assets/{reference_project-layout.md.CwkSbEWT.lean.js → reference_project-layout.md.Bv4KOtlB.lean.js} +0 -0
- /package/dist/docs/assets/{reference_prompt.md.DZUMtLPD.lean.js → reference_prompt.md.DnaD5dNK.lean.js} +0 -0
- /package/dist/docs/assets/{reference_schedules.md.DNipebiG.lean.js → reference_schedules.md.DI_JrHgq.lean.js} +0 -0
- /package/dist/docs/assets/{reference_skills.md.B5ZEuHfG.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/{templates_agentic-owners.md.DSJSIpWU.lean.js → templates_agentic-owners.md.DqtPdm6f.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
|
|
@@ -476,7 +497,7 @@ export class SessionEngine {
|
|
|
476
497
|
send(channelId_1, message_1) {
|
|
477
498
|
return __awaiter(this, arguments, void 0, function* (channelId, message, options = {}) {
|
|
478
499
|
var _a;
|
|
479
|
-
var _b, _c, _d, _e, _f;
|
|
500
|
+
var _b, _c, _d, _e, _f, _g;
|
|
480
501
|
const identity = channelId === HTTP_CHANNEL_ID
|
|
481
502
|
? httpContinuationIdentity(this.project.httpChannel)
|
|
482
503
|
: channelContinuationIdentity(this.channelsById.get(channelId));
|
|
@@ -502,6 +523,10 @@ export class SessionEngine {
|
|
|
502
523
|
existing = yield this.restoreSessionByContinuation(channelId, sendOptions.continuationToken);
|
|
503
524
|
}
|
|
504
525
|
if (existing !== undefined) {
|
|
526
|
+
if (sendOptions.hostedSessionId !== undefined &&
|
|
527
|
+
existing.sessionId !== sendOptions.hostedSessionId) {
|
|
528
|
+
throw new V2EngineError(`v2: continuation belongs to session ${existing.sessionId}, not ${sendOptions.hostedSessionId}`);
|
|
529
|
+
}
|
|
505
530
|
if (!samePrincipal(existing.auth, auth)) {
|
|
506
531
|
throw new SessionAuthError(existing.sessionId);
|
|
507
532
|
}
|
|
@@ -537,10 +562,16 @@ export class SessionEngine {
|
|
|
537
562
|
: { sourceTs: sendOptions.coalesceSourceTs })));
|
|
538
563
|
return this.channelSession(record.sessionId, record, false, coalesced, since);
|
|
539
564
|
}
|
|
565
|
+
if (sendOptions.hostedSessionId !== undefined) {
|
|
566
|
+
const collision = yield this.getOrRestoreSession(sendOptions.hostedSessionId);
|
|
567
|
+
if (collision !== undefined) {
|
|
568
|
+
throw new V2EngineError(`v2: hosted session id ${sendOptions.hostedSessionId} already belongs to another mailbox`);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
540
571
|
const now = new Date().toISOString();
|
|
541
572
|
const channelState = this.initialChannelState(channelId, sendOptions.state);
|
|
542
573
|
const purpose = sendOptions.purpose === "eval" ? "eval" : "live";
|
|
543
|
-
let record = Object.assign(Object.assign({ sessionId: newSessionId(), channelId, mode: (
|
|
574
|
+
let record = Object.assign(Object.assign({ sessionId: (_d = sendOptions.hostedSessionId) !== null && _d !== void 0 ? _d : newSessionId(), channelId, mode: (_e = sendOptions.mode) !== null && _e !== void 0 ? _e : "chat", purpose }, (sendOptions.dryRun === true ? { dryRun: true } : {})), { continuationKey: (_f = sendOptions.continuationToken) !== null && _f !== void 0 ? _f : newContinuationKey(), auth, title: sendOptions.title, channelState, workspaceOverride: sendOptions.workspaceDir, pendingWorkspaceFiles: sendOptions.workspaceFiles, pendingImages: sendOptions.images, cloudOverride: sendOptions.cloud, sdkAgentId: sendOptions.sdkAgentId, turnCount: 0, createdAt: now, updatedAt: now });
|
|
544
575
|
yield this.sessions.save(record);
|
|
545
576
|
(_a = this.storage) === null || _a === void 0 ? void 0 : _a.sessionRecord(record);
|
|
546
577
|
yield this.appendEvent(record.sessionId, {
|
|
@@ -549,7 +580,7 @@ export class SessionEngine {
|
|
|
549
580
|
});
|
|
550
581
|
record = yield this.enrollABs(record);
|
|
551
582
|
const since = (yield this.logs.get(record.sessionId)).count;
|
|
552
|
-
yield this.startTurn(record.sessionId, message, Object.assign({ admission: (
|
|
583
|
+
yield this.startTurn(record.sessionId, message, Object.assign({ admission: (_g = sendOptions.admission) !== null && _g !== void 0 ? _g : "preempt" }, (sendOptions.coalesceSourceTs === undefined
|
|
553
584
|
? {}
|
|
554
585
|
: { sourceTs: sendOptions.coalesceSourceTs })));
|
|
555
586
|
return this.channelSession(record.sessionId, record, true, false, since);
|
|
@@ -1529,23 +1560,17 @@ export class SessionEngine {
|
|
|
1529
1560
|
* Connection names a cloud turn can only reach through the host connection
|
|
1530
1561
|
* bridge on the tool MCP endpoint: filtered account connections without a
|
|
1531
1562
|
* public bridge URL, and host-OAuth connections whose tokens live on this
|
|
1532
|
-
* host.
|
|
1533
|
-
* must not see the connection at all, on any runtime.
|
|
1563
|
+
* host.
|
|
1534
1564
|
*/
|
|
1535
1565
|
cloudBridgeableConnectionNames() {
|
|
1536
|
-
const hostOnlyNames = new Set(this.project.agent.connections
|
|
1537
|
-
.filter((connection) => connection.hostOnly === true)
|
|
1538
|
-
.map((connection) => connection.name));
|
|
1539
1566
|
const names = [];
|
|
1540
1567
|
for (const connection of this.project.agent.connections) {
|
|
1541
|
-
if (
|
|
1542
|
-
isHostOauthConnectionTransport(connection.transport)) {
|
|
1568
|
+
if (isHostOauthConnectionTransport(connection.transport)) {
|
|
1543
1569
|
names.push(connection.name);
|
|
1544
1570
|
}
|
|
1545
1571
|
}
|
|
1546
1572
|
for (const resolved of this.resolvedConnections) {
|
|
1547
|
-
if (
|
|
1548
|
-
resolved.accountServersFilter !== undefined &&
|
|
1573
|
+
if (resolved.accountServersFilter !== undefined &&
|
|
1549
1574
|
resolved.cloudUrl === undefined) {
|
|
1550
1575
|
names.push(resolved.name);
|
|
1551
1576
|
}
|
|
@@ -1555,8 +1580,7 @@ export class SessionEngine {
|
|
|
1555
1580
|
/**
|
|
1556
1581
|
* True when cloud turns reach `name` through the host connection bridge —
|
|
1557
1582
|
* the gate the tool MCP endpoint applies before forwarding a bridge
|
|
1558
|
-
* request to `host.mcp`, so
|
|
1559
|
-
* stay unreachable from a VM.
|
|
1583
|
+
* request to `host.mcp`, so arbitrary names stay unreachable from a VM.
|
|
1560
1584
|
*/
|
|
1561
1585
|
isCloudBridgedConnection(name) {
|
|
1562
1586
|
if (this.cloudServerToolsConnection === undefined) {
|
|
@@ -1581,24 +1605,26 @@ export class SessionEngine {
|
|
|
1581
1605
|
return Object.assign(Object.assign({}, connection), { url: url.toString() });
|
|
1582
1606
|
}
|
|
1583
1607
|
/**
|
|
1584
|
-
* Authored + resolved MCP servers for a turn. Skips
|
|
1585
|
-
*
|
|
1586
|
-
*
|
|
1587
|
-
*
|
|
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
|
|
1588
1613
|
* being omitted or failing the turn closed.
|
|
1589
1614
|
*/
|
|
1590
1615
|
buildMcpServers(runtime, sessionId, sessionAuth) {
|
|
1616
|
+
var _a;
|
|
1591
1617
|
// The Grok Bot harness manages its own MCP surface; authored
|
|
1592
1618
|
// connections are refused at discovery, so there is nothing to mount.
|
|
1593
1619
|
if (runtime === "grokbot") {
|
|
1594
1620
|
return {};
|
|
1595
1621
|
}
|
|
1596
1622
|
// Advertised connections surface as named server tools instead of an
|
|
1597
|
-
// attached MCP server (each tool appears exactly once)
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
.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)
|
|
1601
1626
|
.map((connection) => connection.name));
|
|
1627
|
+
const hostConnectionNames = new Set(((_a = this.project.agent.hostConnections) !== null && _a !== void 0 ? _a : []).map((connection) => connection.name));
|
|
1602
1628
|
const bridgedNames = new Set(runtime === "cloud" &&
|
|
1603
1629
|
sessionId !== undefined &&
|
|
1604
1630
|
this.cloudServerToolsConnection !== undefined &&
|
|
@@ -1607,7 +1633,8 @@ export class SessionEngine {
|
|
|
1607
1633
|
: []);
|
|
1608
1634
|
assertCloudCanHonorAccountServersFilters({
|
|
1609
1635
|
runtime,
|
|
1610
|
-
resolvedConnections: this.resolvedConnections.filter((resolved) => !
|
|
1636
|
+
resolvedConnections: this.resolvedConnections.filter((resolved) => !advertisedNames.has(resolved.name) &&
|
|
1637
|
+
!hostConnectionNames.has(resolved.name)),
|
|
1611
1638
|
bridgedNames,
|
|
1612
1639
|
});
|
|
1613
1640
|
const bridgeTransport = (name) => sessionId === undefined || !bridgedNames.has(name)
|
|
@@ -1615,7 +1642,8 @@ export class SessionEngine {
|
|
|
1615
1642
|
: this.cloudBridgeTransport(sessionId, name);
|
|
1616
1643
|
const servers = {};
|
|
1617
1644
|
for (const connection of this.project.agent.connections) {
|
|
1618
|
-
if (
|
|
1645
|
+
if (advertisedNames.has(connection.name) ||
|
|
1646
|
+
hostConnectionNames.has(connection.name)) {
|
|
1619
1647
|
continue;
|
|
1620
1648
|
}
|
|
1621
1649
|
if (isSymbolicConnectionTransport(connection.transport)) {
|
|
@@ -1651,7 +1679,8 @@ export class SessionEngine {
|
|
|
1651
1679
|
servers[connection.name] = connection.transport;
|
|
1652
1680
|
}
|
|
1653
1681
|
for (const resolved of this.resolvedConnections) {
|
|
1654
|
-
if (
|
|
1682
|
+
if (advertisedNames.has(resolved.name) ||
|
|
1683
|
+
hostConnectionNames.has(resolved.name)) {
|
|
1655
1684
|
continue;
|
|
1656
1685
|
}
|
|
1657
1686
|
const url = runtime === "cloud" ? resolved.cloudUrl : resolved.localUrl;
|
|
@@ -1688,14 +1717,12 @@ export class SessionEngine {
|
|
|
1688
1717
|
}
|
|
1689
1718
|
/**
|
|
1690
1719
|
* True when a connection with per-session `auth` attaches to the model
|
|
1691
|
-
* (not
|
|
1720
|
+
* (not advertised). These turns set
|
|
1692
1721
|
* {@link RunnerTurnRequest.perSendMcpServers} so the evaluated headers
|
|
1693
1722
|
* ride every send instead of being pinned on the cached agent handle.
|
|
1694
1723
|
*/
|
|
1695
1724
|
hasAttachedAuthedConnections() {
|
|
1696
|
-
return this.project.agent.connections.some((connection) => connection.auth !== undefined &&
|
|
1697
|
-
connection.hostOnly !== true &&
|
|
1698
|
-
connection.advertiseTools !== true);
|
|
1725
|
+
return this.project.agent.connections.some((connection) => connection.auth !== undefined && connection.advertiseTools !== true);
|
|
1699
1726
|
}
|
|
1700
1727
|
/**
|
|
1701
1728
|
* Evaluate per-session connection auth (`defineConnection({ auth })`)
|
|
@@ -1706,9 +1733,7 @@ export class SessionEngine {
|
|
|
1706
1733
|
*/
|
|
1707
1734
|
evaluateConnectionAuth(record) {
|
|
1708
1735
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1709
|
-
const authed = this.project.agent.connections.filter((connection) => connection.auth !== undefined &&
|
|
1710
|
-
connection.hostOnly !== true &&
|
|
1711
|
-
connection.advertiseTools !== true);
|
|
1736
|
+
const authed = this.project.agent.connections.filter((connection) => connection.auth !== undefined && connection.advertiseTools !== true);
|
|
1712
1737
|
if (authed.length === 0) {
|
|
1713
1738
|
return undefined;
|
|
1714
1739
|
}
|
|
@@ -2011,61 +2036,184 @@ export class SessionEngine {
|
|
|
2011
2036
|
* with the same `{ content, isError }` envelope the model would see, not
|
|
2012
2037
|
* an exception.
|
|
2013
2038
|
*/
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
if (!validation.ok) {
|
|
2029
|
-
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");
|
|
2030
2053
|
}
|
|
2031
|
-
const callId = newToolCallId(toolName);
|
|
2032
2054
|
const auth = (_a = options.auth) !== null && _a !== void 0 ? _a : null;
|
|
2033
2055
|
let record;
|
|
2034
|
-
let
|
|
2035
|
-
let workspaceDir;
|
|
2036
|
-
let scratchDir;
|
|
2056
|
+
let continuation = null;
|
|
2037
2057
|
if (options.sessionId !== undefined) {
|
|
2038
2058
|
record = yield this.sessions.get(options.sessionId);
|
|
2039
2059
|
if (record === undefined) {
|
|
2040
2060
|
throw new UnknownSessionError(options.sessionId);
|
|
2041
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) {
|
|
2042
2078
|
// Direct calls respect the same serialization as follow-up sends: a
|
|
2043
2079
|
// running model turn owns the session workspace and event stream.
|
|
2044
2080
|
if (this.activeTurns.has(record.sessionId) ||
|
|
2045
2081
|
this.pendingTurns.has(record.sessionId)) {
|
|
2046
2082
|
throw new SessionBusyError(record.sessionId);
|
|
2047
2083
|
}
|
|
2048
|
-
|
|
2049
|
-
|
|
2084
|
+
return {
|
|
2085
|
+
record,
|
|
2086
|
+
session: this.sessionInfo(record),
|
|
2087
|
+
workspaceDir: this.harnessCwd(record),
|
|
2088
|
+
scratchDir: undefined,
|
|
2089
|
+
};
|
|
2050
2090
|
}
|
|
2051
|
-
|
|
2052
|
-
|
|
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: {
|
|
2053
2100
|
id: callId,
|
|
2054
|
-
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,
|
|
2055
2102
|
mode: "task",
|
|
2103
|
+
continuationKey: continuation === null || continuation === void 0 ? void 0 : continuation.key,
|
|
2056
2104
|
auth,
|
|
2057
|
-
}
|
|
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)}`);
|
|
2058
2203
|
scratchDir = join(this.stateRoot, "tool-calls", callId);
|
|
2059
2204
|
workspaceDir = scratchDir;
|
|
2205
|
+
workspaceUnavailable = true;
|
|
2206
|
+
yield mkdir(workspaceDir, { recursive: true });
|
|
2060
2207
|
}
|
|
2061
|
-
yield mkdir(workspaceDir, { recursive: true });
|
|
2062
2208
|
// Match what a model turn would see: session workspaces get the same
|
|
2063
2209
|
// scaffold as executeTurn (seeds only before the first turn); scratch
|
|
2064
2210
|
// workspaces are materialized fresh.
|
|
2065
2211
|
yield materializeWorkspace({
|
|
2066
2212
|
agent: this.project.agent,
|
|
2067
|
-
workspaceDir: record === undefined
|
|
2068
|
-
|
|
2213
|
+
workspaceDir: record === undefined || workspaceUnavailable
|
|
2214
|
+
? workspaceDir
|
|
2215
|
+
: this.scaffoldDir(record),
|
|
2216
|
+
seed: record === undefined || workspaceUnavailable || record.turnCount === 0,
|
|
2069
2217
|
stateRoot: this.stateRoot,
|
|
2070
2218
|
});
|
|
2071
2219
|
// A per-call turnId keeps these events visible in trajectories (which
|
|
@@ -2162,11 +2310,16 @@ export class SessionEngine {
|
|
|
2162
2310
|
});
|
|
2163
2311
|
}
|
|
2164
2312
|
const errorMessage = isError ? toolCallErrorMessage(result) : undefined;
|
|
2165
|
-
return
|
|
2313
|
+
return {
|
|
2314
|
+
toolName,
|
|
2166
2315
|
callId,
|
|
2167
2316
|
isError,
|
|
2168
2317
|
result,
|
|
2169
|
-
durationMs
|
|
2318
|
+
durationMs,
|
|
2319
|
+
errorMessage,
|
|
2320
|
+
sessionId: record === null || record === void 0 ? void 0 : record.sessionId,
|
|
2321
|
+
scratchWorkspace: workspaceUnavailable ? true : undefined,
|
|
2322
|
+
};
|
|
2170
2323
|
});
|
|
2171
2324
|
}
|
|
2172
2325
|
/**
|
|
@@ -90,8 +90,14 @@ export type CommitRangeDiff = {
|
|
|
90
90
|
export declare function tryDiffCommitRange(args: {
|
|
91
91
|
/** Existing checkout to run git in (see {@link createShallowPrCheckout}). */
|
|
92
92
|
checkoutDir: string;
|
|
93
|
-
/**
|
|
94
|
-
|
|
93
|
+
/**
|
|
94
|
+
* The checkout's clone target; supplies the remote's ref + auth
|
|
95
|
+
* conventions. Omit for SCMs without a clone target (e.g. Origin, where
|
|
96
|
+
* the host checkout is the reviewed repo): the diff then relies on
|
|
97
|
+
* commits already present locally, plus one uncredentialed fetch-by-SHA
|
|
98
|
+
* through the checkout's own remote.
|
|
99
|
+
*/
|
|
100
|
+
target?: ScmCloneTarget | undefined;
|
|
95
101
|
from: string;
|
|
96
102
|
to: string;
|
|
97
103
|
/** Restrict the diff to one path when set. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shallow-clone.d.ts","sourceRoot":"","sources":["../../src/internal/shallow-clone.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,uCAAuC;AACvC,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEnC;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,WAAW,CAAC;IACtB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,GACZ,cAAc,GAAG,SAAS,CA0B5B;AAED,6CAA6C;AAC7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,gBAAgB,GAAG,SAAS,CAG9B;AAyBD,MAAM,MAAM,eAAe,GACvB;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9C;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAC;IACpB
|
|
1
|
+
{"version":3,"file":"shallow-clone.d.ts","sourceRoot":"","sources":["../../src/internal/shallow-clone.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,uCAAuC;AACvC,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEnC;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,WAAW,CAAC;IACtB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,GACZ,cAAc,GAAG,SAAS,CA0B5B;AAED,6CAA6C;AAC7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,gBAAgB,GAAG,SAAS,CAG9B;AAyBD,MAAM,MAAM,eAAe,GACvB;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9C;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,6EAA6E;IAC7E,IAAI,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;CACrC,GAAG,OAAO,CAAC,eAAe,CAAC,CAoD3B;AA+CD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,WAAW,EAAE,OAAO,CAAC;IACrB,wCAAwC;IACxC,UAAU,EAAE,WAAW,GAAG,cAAc,CAAC;CAC1C,CAAC;AAqHF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;CACrC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAuG7B;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACpC,iEAAiE;IACjE,MAAM,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,0BAA0B,CAAC,CA+CrC"}
|
|
@@ -86,7 +86,9 @@ export function tryDiffCommitRange(args) {
|
|
|
86
86
|
reason: "Could not compute a reliable diff because a commit SHA was not a full 40-character SHA.",
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
const credential =
|
|
89
|
+
const credential = args.target === undefined
|
|
90
|
+
? undefined
|
|
91
|
+
: cloneCredential(args.target, (_a = args.auth) !== null && _a !== void 0 ? _a : defaultCloneAuth(args.target));
|
|
90
92
|
for (const sha of [args.from, args.to]) {
|
|
91
93
|
if (!(yield ensureCommitFetched(args.checkoutDir, sha, args.target, credential))) {
|
|
92
94
|
return {
|
|
@@ -130,15 +132,20 @@ function ensureCommitFetched(checkoutDir, sha, target, credential) {
|
|
|
130
132
|
const attempts = [
|
|
131
133
|
[...FETCH_ARGS, sha],
|
|
132
134
|
// Deeper history on the PR head ref: the older end of an inter-run range
|
|
133
|
-
// is usually an ancestor of the tip rather than the tip itself.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
135
|
+
// is usually an ancestor of the tip rather than the tip itself. Only
|
|
136
|
+
// possible when the clone target (and so the PR head ref) is known.
|
|
137
|
+
...(target === undefined
|
|
138
|
+
? []
|
|
139
|
+
: [
|
|
140
|
+
[
|
|
141
|
+
"fetch",
|
|
142
|
+
"--depth=200",
|
|
143
|
+
"--no-tags",
|
|
144
|
+
"--quiet",
|
|
145
|
+
"origin",
|
|
146
|
+
target.prHeadRef,
|
|
147
|
+
],
|
|
148
|
+
]),
|
|
142
149
|
];
|
|
143
150
|
for (const attempt of attempts) {
|
|
144
151
|
try {
|
|
@@ -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
|
+
}
|