@grok/agent-sdk 0.3.0 → 0.5.0
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/dist/channels/match-ready/index.d.ts +4 -0
- package/dist/channels/match-ready/index.d.ts.map +1 -0
- package/dist/channels/match-ready/index.js +2 -0
- package/dist/channels/match-ready/match-ready-channel.d.ts +5 -0
- package/dist/channels/match-ready/match-ready-channel.d.ts.map +1 -0
- package/dist/channels/match-ready/match-ready-channel.js +42 -0
- package/dist/channels/match-ready/types.d.ts +25 -0
- package/dist/channels/match-ready/types.d.ts.map +1 -0
- package/dist/channels/match-ready/types.js +1 -0
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +27 -14
- package/dist/docs/404.html +2 -2
- package/dist/docs/assets/{app.BzTUBOAD.js → app.CYdjweqP.js} +4 -4
- package/dist/docs/assets/{building-with-agents.md.BqJ7AAjG.js → building-with-agents.md.Bo3ct-rf.js} +1 -1
- package/dist/docs/assets/changelog.md.BMrJ5WxW.js +1 -0
- package/dist/docs/assets/changelog.md.BMrJ5WxW.lean.js +1 -0
- package/dist/docs/assets/chunks/@localSearchIndexroot.dUaE1f8e.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.DsnRlUT5.js → VPLocalSearchBox.CRATKS9J.js} +1 -1
- package/dist/docs/assets/chunks/{arc.DH8GOhiv.js → arc.BxM78ISR.js} +1 -1
- package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.9m9ObyuE.js → architectureDiagram-Q4EWVU46.Bi6MuKaU.js} +1 -1
- package/dist/docs/assets/chunks/{baseUniq.BXHpx1lE.js → baseUniq.L47qqpDG.js} +1 -1
- package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.xY3EX59q.js → blockDiagram-DXYQGD6D.kHFF2FK5.js} +1 -1
- package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.DnqgMVgc.js → c4Diagram-AHTNJAMY.BTW85ll3.js} +1 -1
- package/dist/docs/assets/chunks/channel.ljJtQtBi.js +1 -0
- package/dist/docs/assets/chunks/{chunk-4BX2VUAB.BjFxK2A3.js → chunk-4BX2VUAB.Bbh3_48g.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-4TB4RGXK.BujS_Spt.js → chunk-4TB4RGXK.WeAmK3fK.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-55IACEB6.YbTjhdaM.js → chunk-55IACEB6.DTdUiVHf.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-EDXVE4YY.DnQ8t4GC.js → chunk-EDXVE4YY.n5XzANDz.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-FMBD7UC4.B67AwAmj.js → chunk-FMBD7UC4.D51eewCb.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-OYMX7WX6.DrZIAFOm.js → chunk-OYMX7WX6.BrY0U7ZV.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-QZHKN3VN.BLmmydkn.js → chunk-QZHKN3VN.B0OA4aFV.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-YZCP3GAM.DaoOfw0O.js → chunk-YZCP3GAM.Djt3Mjft.js} +1 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.BZ3Uc-XU.js +1 -0
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.BZ3Uc-XU.js +1 -0
- package/dist/docs/assets/chunks/clone.BDtbEo69.js +1 -0
- package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.DMQuNhM5.js → cose-bilkent-S5V4N54A.DiMcA6Q8.js} +1 -1
- package/dist/docs/assets/chunks/{dagre-KV5264BT.CZoGVuUf.js → dagre-KV5264BT.BGqI4vrS.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-5BDNPKRD.CLt9uOyL.js → diagram-5BDNPKRD.bDqFuMoH.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.DpczEm1G.js → diagram-G4DWMVQ6.Y0sxaXRU.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-MMDJMWI5.D4r13DvJ.js → diagram-MMDJMWI5.Bg43b0yi.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-TYMM5635.CYU9eGFu.js → diagram-TYMM5635.DCfVasEC.js} +1 -1
- package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.QA9naWEw.js → erDiagram-SMLLAGMA.C72GaD16.js} +1 -1
- package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.BbNoVZYd.js → flowDiagram-DWJPFMVM.DxRQj7pP.js} +1 -1
- package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.IHjDoG7r.js → ganttDiagram-T4ZO3ILL.DiLZy5Q4.js} +1 -1
- package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.B21VMdf5.js → gitGraphDiagram-UUTBAWPF.DL8XkRvh.js} +1 -1
- package/dist/docs/assets/chunks/{graph.DgJ4L-8V.js → graph.3Xub80xJ.js} +1 -1
- package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.CQjrcthc.js → infoDiagram-42DDH7IO.O3lGaspu.js} +1 -1
- package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.D4tPGtVo.js → ishikawaDiagram-UXIWVN3A.w-pCiQzn.js} +1 -1
- package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.BD3WaNbQ.js → journeyDiagram-VCZTEJTY.Cg_oBs9j.js} +1 -1
- package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.Ca0o4Tqz.js → kanban-definition-6JOO6SKY.BpfMGPwn.js} +1 -1
- package/dist/docs/assets/chunks/{layout.DXXqX4MQ.js → layout.CtwXs__p.js} +1 -1
- package/dist/docs/assets/chunks/{linear.5c61gNw4.js → linear.NmCskOrP.js} +1 -1
- package/dist/docs/assets/chunks/{min.B1-NAjHX.js → min.DpQtsLKs.js} +1 -1
- package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.BELznv3-.js → mindmap-definition-QFDTVHPH.B-P-aKVp.js} +1 -1
- package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.qPzO1mq5.js → pieDiagram-DEJITSTG.BfjjqK7j.js} +1 -1
- package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.CxIvzbjX.js → quadrantDiagram-34T5L4WZ.BTzHo53F.js} +1 -1
- package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.CqA0iJx8.js → requirementDiagram-MS252O5E.DIT2FIKr.js} +1 -1
- package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.XRTutBnb.js → sankeyDiagram-XADWPNL6.NK1wCsgt.js} +1 -1
- package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.E--7bRLQ.js → sequenceDiagram-FGHM5R23.D9oElkvo.js} +1 -1
- package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.C4vGu8zq.js → stateDiagram-FHFEXIEX.IPksnixH.js} +1 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.CbhzVsQE.js +1 -0
- package/dist/docs/assets/chunks/{theme.DMj_7q3B.js → theme.CgKu7tr3.js} +2 -2
- package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.C7LgNVAL.js → timeline-definition-GMOUNBTQ.CuAtJapY.js} +1 -1
- package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.HUwoZcy_.js → vennDiagram-DHZGUBPP.B87nNW9E.js} +1 -1
- package/dist/docs/assets/chunks/wardley-RL74JXVD.BFIVMaoi.js +162 -0
- package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.B2pSo5rB.js → wardleyDiagram-NUSXRM2D.BELjSq8w.js} +1 -1
- package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.NQhMiOOL.js → xychartDiagram-5P7HB3ND.5zN5ZGsz.js} +1 -1
- package/dist/docs/assets/{deployment.md.BtqJrHhp.js → deployment.md.DJtuDVLh.js} +3 -3
- package/dist/docs/assets/{deployment.md.BtqJrHhp.lean.js → deployment.md.DJtuDVLh.lean.js} +1 -1
- package/dist/docs/assets/{guides_agent-to-agent.md.BcmSqL2z.js → guides_agent-to-agent.md.DcB3nhOz.js} +1 -1
- package/dist/docs/assets/{guides_github.md.6jiEH7dg.js → guides_github.md.CcuZ7keS.js} +1 -1
- package/dist/docs/assets/{guides_mcp-oauth.md.C-Sx_IPa.js → guides_mcp-oauth.md.GVPMKcYl.js} +1 -1
- package/dist/docs/assets/{guides_migrate.md.BbhHYeCr.js → guides_migrate.md.B8CZxnnX.js} +1 -1
- package/dist/docs/assets/{guides_slack.md.BgIGG9ur.js → guides_slack.md.D7Rwyva4.js} +1 -1
- package/dist/docs/assets/{hillclimbing.md.3TkdF79A.js → hillclimbing.md.M51bF-oT.js} +1 -1
- package/dist/docs/assets/index.md.DnJPj_B6.js +14 -0
- package/dist/docs/assets/index.md.DnJPj_B6.lean.js +1 -0
- package/dist/docs/assets/{reference_agent-config.md.C0Tp_Fk9.js → reference_agent-config.md.Bbqf0lgS.js} +13 -5
- package/dist/docs/assets/{reference_agent-config.md.C0Tp_Fk9.lean.js → reference_agent-config.md.Bbqf0lgS.lean.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.B8GdpaRj.js → reference_cli.md.DHm6DmYk.js} +2 -2
- package/dist/docs/assets/{reference_hooks.md.CSWmOwMM.js → reference_hooks.md.vbIM394-.js} +2 -2
- package/dist/docs/assets/{reference_hooks.md.CSWmOwMM.lean.js → reference_hooks.md.vbIM394-.lean.js} +1 -1
- package/dist/docs/assets/{reference_tools.md.B2OaR1Nb.js → reference_tools.md.BhqW6neF.js} +4 -2
- package/dist/docs/assets/{reference_tools.md.B2OaR1Nb.lean.js → reference_tools.md.BhqW6neF.lean.js} +1 -1
- package/dist/docs/building-with-agents.html +36 -36
- package/dist/docs/building-with-agents.md +3 -3
- package/dist/docs/changelog.html +36 -36
- package/dist/docs/changelog.md +44 -1
- package/dist/docs/deployment.html +37 -37
- package/dist/docs/deployment.md +22 -16
- package/dist/docs/evals.html +35 -35
- package/dist/docs/guides/agent-to-agent.html +37 -37
- package/dist/docs/guides/agent-to-agent.md +4 -2
- package/dist/docs/guides/bitbucket.html +35 -35
- package/dist/docs/guides/cloud-agents.html +35 -35
- package/dist/docs/guides/convert-automation.html +35 -35
- package/dist/docs/guides/github.html +37 -37
- package/dist/docs/guides/github.md +1 -1
- package/dist/docs/guides/gitlab.html +35 -35
- package/dist/docs/guides/improve.html +35 -35
- package/dist/docs/guides/jev.html +35 -35
- package/dist/docs/guides/mcp-oauth.html +37 -37
- package/dist/docs/guides/mcp-oauth.md +1 -1
- package/dist/docs/guides/migrate.html +37 -37
- package/dist/docs/guides/migrate.md +1 -1
- package/dist/docs/guides/opentelemetry.html +35 -35
- package/dist/docs/guides/pagerduty.html +35 -35
- package/dist/docs/guides/slack.html +37 -37
- package/dist/docs/guides/slack.md +1 -1
- package/dist/docs/guides/webhooks.html +35 -35
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +36 -36
- package/dist/docs/hillclimbing.md +1 -1
- package/dist/docs/index.html +42 -48
- package/dist/docs/index.md +8 -14
- package/dist/docs/llms-full.txt +176 -54
- package/dist/docs/quickstart.html +35 -35
- package/dist/docs/reference/access.html +35 -35
- package/dist/docs/reference/agent-config.html +47 -39
- package/dist/docs/reference/agent-config.md +75 -10
- package/dist/docs/reference/artifacts.html +35 -35
- package/dist/docs/reference/channels.html +35 -35
- package/dist/docs/reference/cli.html +38 -38
- package/dist/docs/reference/cli.md +2 -2
- package/dist/docs/reference/connections.html +35 -35
- package/dist/docs/reference/evals.html +35 -35
- package/dist/docs/reference/extensions.html +35 -35
- package/dist/docs/reference/hooks.html +37 -37
- package/dist/docs/reference/hooks.md +1 -1
- package/dist/docs/reference/http-api.html +35 -35
- package/dist/docs/reference/instructions.html +35 -35
- package/dist/docs/reference/limits.html +35 -35
- package/dist/docs/reference/memory.html +35 -35
- package/dist/docs/reference/playground.html +35 -35
- package/dist/docs/reference/project-layout.html +35 -35
- package/dist/docs/reference/schedules.html +35 -35
- package/dist/docs/reference/sessions.html +35 -35
- package/dist/docs/reference/skills.html +35 -35
- package/dist/docs/reference/subagents.html +35 -35
- package/dist/docs/reference/tools.html +39 -37
- package/dist/docs/reference/tools.md +12 -0
- package/dist/docs/templates/agentic-owners.html +35 -35
- package/dist/docs/templates/reviews.html +35 -35
- package/dist/docs/troubleshooting.html +35 -35
- package/dist/filesystem.d.ts +12 -412
- package/dist/filesystem.d.ts.map +1 -1
- package/dist/filesystem.js +37 -980
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/internal/authored-alias-hooks.d.ts +6 -0
- package/dist/internal/authored-alias-hooks.d.ts.map +1 -1
- package/dist/internal/authored-alias-hooks.js +12 -0
- package/dist/internal/authored-loaders.js +10 -1
- package/dist/internal/cli/commands/scaffold.js +1 -1
- package/dist/internal/continuation-channel.d.ts +3 -3
- package/dist/internal/continuation-channel.js +3 -3
- package/dist/internal/continuation-identity.d.ts +6 -5
- package/dist/internal/continuation-identity.d.ts.map +1 -1
- package/dist/internal/continuation-identity.js +17 -2
- package/dist/internal/continuation-session-ids.d.ts +15 -0
- package/dist/internal/continuation-session-ids.d.ts.map +1 -0
- package/dist/internal/continuation-session-ids.js +43 -0
- package/dist/internal/direct-file-tools.d.ts +21 -0
- package/dist/internal/direct-file-tools.d.ts.map +1 -0
- package/dist/internal/direct-file-tools.js +60 -0
- package/dist/internal/discovery/agent.d.ts.map +1 -1
- package/dist/internal/discovery/agent.js +71 -66
- package/dist/internal/filesystem/walk.d.ts +4 -56
- package/dist/internal/filesystem/walk.d.ts.map +1 -1
- package/dist/internal/filesystem/walk.js +4 -198
- package/dist/internal/hosted-catch-protocol.d.ts +3 -3
- package/dist/internal/hosted-catch-protocol.js +3 -3
- package/dist/internal/hosted-fetch.d.ts +7 -0
- package/dist/internal/hosted-fetch.d.ts.map +1 -0
- package/dist/internal/hosted-fetch.js +26 -0
- package/dist/internal/hosted-managed-automation.js +1 -1
- package/dist/internal/install-cursor-skills.d.ts +5 -6
- package/dist/internal/install-cursor-skills.d.ts.map +1 -1
- package/dist/internal/install-cursor-skills.js +19 -4
- package/dist/internal/mcp-endpoint.js +4 -4
- package/dist/internal/model-config.d.ts.map +1 -1
- package/dist/internal/model-config.js +11 -4
- package/dist/internal/otel/http.d.ts +2 -1
- package/dist/internal/otel/http.d.ts.map +1 -1
- package/dist/internal/otel/http.js +2 -3
- package/dist/internal/platform-timers.d.ts +3 -7
- package/dist/internal/platform-timers.d.ts.map +1 -1
- package/dist/internal/platform-timers.js +10 -51
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +22 -40
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +6 -1
- package/dist/internal/session-engine.d.ts +36 -19
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +182 -254
- package/dist/internal/tool-paths.d.ts +8 -0
- package/dist/internal/tool-paths.d.ts.map +1 -0
- package/dist/internal/tool-paths.js +12 -0
- package/dist/internal/workspace-tree.d.ts +27 -0
- package/dist/internal/workspace-tree.d.ts.map +1 -0
- package/dist/internal/workspace-tree.js +106 -0
- package/dist/playground/assets/index-D0-FHg1x.css +1 -0
- package/dist/playground/assets/index-D5SLKUy6.js +62 -0
- package/dist/playground/index.html +2 -2
- package/dist/types.d.ts +43 -23
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -2
- package/docs/README.md +8 -14
- package/docs/building-with-agents.md +3 -3
- package/docs/changelog.md +44 -1
- package/docs/deployment.md +22 -16
- package/docs/guides/agent-to-agent.md +4 -2
- package/docs/guides/github.md +1 -1
- package/docs/guides/mcp-oauth.md +1 -1
- package/docs/guides/migrate.md +1 -1
- package/docs/guides/slack.md +1 -1
- package/docs/hillclimbing.md +1 -1
- package/docs/reference/agent-config.md +75 -10
- package/docs/reference/cli.md +2 -2
- package/docs/reference/hooks.md +1 -1
- package/docs/reference/tools.md +12 -0
- package/package.json +10 -15
- package/skills/cli/SKILL.md +1 -1
- package/skills/create-agent/SKILL.md +61 -7
- package/skills/debug/SKILL.md +1 -1
- package/skills/deploy/SKILL.md +3 -3
- package/skills/evals/SKILL.md +1 -1
- package/skills/framework-map/SKILL.md +2 -2
- package/skills/github/SKILL.md +1 -1
- package/skills/hillclimb/SKILL.md +1 -1
- package/skills/mcp-auth/SKILL.md +1 -1
- package/skills/migrate-v2/SKILL.md +2 -2
- package/skills/otel/SKILL.md +1 -1
- package/skills/setup-slack/SKILL.md +2 -2
- package/dist/docs/assets/changelog.md.BWhC6DET.js +0 -1
- package/dist/docs/assets/changelog.md.BWhC6DET.lean.js +0 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.CWxwVoCG.js +0 -1
- package/dist/docs/assets/chunks/channel.Cctv0f7X.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.DU5sqchW.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.DU5sqchW.js +0 -1
- package/dist/docs/assets/chunks/clone.B9rdNt6j.js +0 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.ECMu2BdJ.js +0 -1
- package/dist/docs/assets/chunks/wardley-RL74JXVD.BxFEFYZS.js +0 -162
- package/dist/docs/assets/index.md.DRfaoRCZ.js +0 -20
- package/dist/docs/assets/index.md.DRfaoRCZ.lean.js +0 -1
- package/dist/executors.d.ts +0 -11
- package/dist/executors.d.ts.map +0 -1
- package/dist/executors.js +0 -21
- package/dist/internal/filesystem/errors.d.ts +0 -64
- package/dist/internal/filesystem/errors.d.ts.map +0 -1
- package/dist/internal/filesystem/errors.js +0 -180
- package/dist/internal/filesystem/format.d.ts +0 -28
- package/dist/internal/filesystem/format.d.ts.map +0 -1
- package/dist/internal/filesystem/format.js +0 -209
- package/dist/internal/filesystem/merge.d.ts +0 -34
- package/dist/internal/filesystem/merge.d.ts.map +0 -1
- package/dist/internal/filesystem/merge.js +0 -154
- package/dist/internal/filesystem/nearest.d.ts +0 -15
- package/dist/internal/filesystem/nearest.d.ts.map +0 -1
- package/dist/internal/filesystem/nearest.js +0 -90
- package/dist/internal/filesystem/scratch.d.ts +0 -60
- package/dist/internal/filesystem/scratch.d.ts.map +0 -1
- package/dist/internal/filesystem/scratch.js +0 -187
- package/dist/internal/filesystem/sdk-schemas.d.ts +0 -29
- package/dist/internal/filesystem/sdk-schemas.d.ts.map +0 -1
- package/dist/internal/filesystem/sdk-schemas.js +0 -148
- package/dist/internal/filesystem/subagent-inherit.d.ts +0 -39
- package/dist/internal/filesystem/subagent-inherit.d.ts.map +0 -1
- package/dist/internal/filesystem/subagent-inherit.js +0 -96
- package/dist/internal/filesystem/tools.d.ts +0 -59
- package/dist/internal/filesystem/tools.d.ts.map +0 -1
- package/dist/internal/filesystem/tools.js +0 -634
- package/dist/internal/otel/propagation.d.ts +0 -7
- package/dist/internal/otel/propagation.d.ts.map +0 -1
- package/dist/internal/otel/propagation.js +0 -15
- package/dist/internal/sdk-subagent-inherit-support.d.ts +0 -9
- package/dist/internal/sdk-subagent-inherit-support.d.ts.map +0 -1
- package/dist/internal/sdk-subagent-inherit-support.js +0 -90
- package/dist/playground/assets/index-D6mVn9og.js +0 -62
- package/dist/playground/assets/index-DlALM6gr.css +0 -1
- /package/dist/docs/assets/{building-with-agents.md.BqJ7AAjG.lean.js → building-with-agents.md.Bo3ct-rf.lean.js} +0 -0
- /package/dist/docs/assets/{guides_agent-to-agent.md.BcmSqL2z.lean.js → guides_agent-to-agent.md.DcB3nhOz.lean.js} +0 -0
- /package/dist/docs/assets/{guides_github.md.6jiEH7dg.lean.js → guides_github.md.CcuZ7keS.lean.js} +0 -0
- /package/dist/docs/assets/{guides_mcp-oauth.md.C-Sx_IPa.lean.js → guides_mcp-oauth.md.GVPMKcYl.lean.js} +0 -0
- /package/dist/docs/assets/{guides_migrate.md.BbhHYeCr.lean.js → guides_migrate.md.B8CZxnnX.lean.js} +0 -0
- /package/dist/docs/assets/{guides_slack.md.BgIGG9ur.lean.js → guides_slack.md.D7Rwyva4.lean.js} +0 -0
- /package/dist/docs/assets/{hillclimbing.md.3TkdF79A.lean.js → hillclimbing.md.M51bF-oT.lean.js} +0 -0
- /package/dist/docs/assets/{reference_cli.md.B8GdpaRj.lean.js → reference_cli.md.DHm6DmYk.lean.js} +0 -0
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10
10
|
import { access, mkdir, rm, writeFile } from "node:fs/promises";
|
|
11
|
-
import { dirname, join } from "node:path";
|
|
11
|
+
import { dirname, join, posix } from "node:path";
|
|
12
12
|
import { isRecord } from "./is-record.js";
|
|
13
|
+
import { createFileSystemTools } from "@cursor/sdk";
|
|
13
14
|
import { SLACK_CHANNEL_ID } from "../channels/slack/constants.js";
|
|
14
15
|
import { telemetry } from "../telemetry.js";
|
|
15
16
|
import { materializeSlackNudgeCarrier } from "../channels/slack/nudge-carrier.js";
|
|
@@ -17,7 +18,7 @@ import { SlackAskDedupeStore, SlackNudgeStore } from "../channels/slack/nudge-st
|
|
|
17
18
|
import { resolveDedicatedSlackHostBinding } from "../channels/slack/slack-channel.js";
|
|
18
19
|
import { AGENT_SERVE_USER_STORE_FILES_SOURCE_ID, agentStoreKeys, DEPLOYMENT_STORE_MOUNT_PATH, USER_STORE_MOUNT_PATH, } from "../files.js";
|
|
19
20
|
import { cursorHostedFiles, isCursorHostedFilesAvailable, isCursorUserStoreFilesAvailable, } from "../files-backends/cursor-hosted.js";
|
|
20
|
-
import { isFileNotFoundError,
|
|
21
|
+
import { isFileNotFoundError, localFileSystem, readOnlyFs, resolveHostHarnessToolOptions, sessionFileSystem, tempFs, unionFs, writeWorkspaceFilesToRoot, } from "../filesystem.js";
|
|
21
22
|
import { storageKeysForArchitecture } from "../storage.js";
|
|
22
23
|
import { DEFAULT_MODEL, DIRECT_TOOL_CALL_CHANNEL_ID, isCursorAccountTransport, isHostOauthConnectionTransport, isSymbolicConnectionTransport, } from "../types.js";
|
|
23
24
|
import { resolveAdvertisedTools } from "./advertise-tools.js";
|
|
@@ -36,17 +37,16 @@ import { describeError, describeErrorCode } from "./describe-error.js";
|
|
|
36
37
|
import { isDevMode } from "./dev-mode.js";
|
|
37
38
|
import { EventLogStore } from "./event-log.js";
|
|
38
39
|
import { TurnEventMapper } from "./event-mapper.js";
|
|
39
|
-
import {
|
|
40
|
-
import { applyWebScratchUpdate, hostAgentToolsDir, ingestHostAgentToolsScratch, remapScratchPaths, } from "./filesystem/scratch.js";
|
|
41
|
-
import { fileSystemTool, hostFileToolsFromAuthored, isDirectFileToolAdmitted, isSynthesizedFileSystemToolName, rootFileToolsFromAuthored, runWithFileSystem, synthesizeFileSystemTools, } from "./filesystem/tools.js";
|
|
40
|
+
import { directFileToolAllowed, directFileToolName, hostAgentToolsDir, } from "./direct-file-tools.js";
|
|
42
41
|
import { selectFrameworkStorageDefinition } from "./framework-storage-selection.js";
|
|
43
42
|
import { createHostFilesApi } from "./host-files.js";
|
|
44
43
|
import { createHostKvApi } from "./host-kv.js";
|
|
45
44
|
import { createHostOtelApi } from "./host-otel.js";
|
|
46
45
|
import { createHostPlatforms, createHostSlackClient, } from "./host-platforms.js";
|
|
47
46
|
import { HostedAdmissionLocalSendError, isDuringHostedAdmission, } from "./hosted-admission-context.js";
|
|
47
|
+
import { localSessionIds } from "./continuation-session-ids.js";
|
|
48
48
|
import { hostedSessionResumeKey } from "./hosted-catch-protocol.js";
|
|
49
|
-
import { formatContinuationToken, newContinuationKey,
|
|
49
|
+
import { formatContinuationToken, newContinuationKey, newToolCallId, parseContinuationToken, resolveDeliveryId, } from "./ids.js";
|
|
50
50
|
import { validateToolInput } from "./json-schema.js";
|
|
51
51
|
import { isMcpNeedsAuthError, McpHost, McpReconnectError } from "./mcp-host.js";
|
|
52
52
|
import { McpOauthOnDemandHub } from "./mcp-oauth-on-demand.js";
|
|
@@ -55,7 +55,9 @@ import { buildSessionContextBlock, SCHEDULE_CHANNEL_PREFIX } from "./prompt-cont
|
|
|
55
55
|
import { assertCloudCanHonorAccountServersFilters } from "./resolved-connections.js";
|
|
56
56
|
import { sessionExternalLinks } from "./session-links.js";
|
|
57
57
|
import { SessionStore } from "./session-store.js";
|
|
58
|
+
import { MEMORY_DIR_NAME } from "./memory-dir.js";
|
|
58
59
|
import { syncSkillsToStore } from "./skills-sync.js";
|
|
60
|
+
import { confinesWorkspaceReads, DEFAULT_TREE_WORKSPACE, hostDirectoryTree, } from "./workspace-tree.js";
|
|
59
61
|
import { steeringEnabled } from "./steering.js";
|
|
60
62
|
import { resolveApiKeySync } from "./cursor/credentials.js";
|
|
61
63
|
import { CLI_COMMAND_NAME } from "./distribution.js";
|
|
@@ -294,12 +296,11 @@ export class SessionEngine {
|
|
|
294
296
|
this.sessionRoots = new Map();
|
|
295
297
|
/** In-flight factory resolves, so the first turn and a racing callTool share one handle. */
|
|
296
298
|
this.sessionRootInflight = new Map();
|
|
297
|
-
/** Per-turn union of the authored tree, `/agent/skills`, and `/tmp`. Dropped at end of turn. */
|
|
298
|
-
this.turnRoots = new Map();
|
|
299
299
|
this.project = options.project;
|
|
300
300
|
applyAgentContinuationDefaults(this.project);
|
|
301
301
|
this.stateRoot = options.stateRoot;
|
|
302
302
|
this.runner = options.runner;
|
|
303
|
+
this.sessionIds = options.sessionIds ?? localSessionIds;
|
|
303
304
|
this.logger = options.logger ?? (() => { });
|
|
304
305
|
this.readFrameworkMeter = options.otelMeter ?? (() => undefined);
|
|
305
306
|
this.getCloudUsage = options.getCloudUsage ?? defaultGetCloudUsage;
|
|
@@ -586,7 +587,9 @@ export class SessionEngine {
|
|
|
586
587
|
// inject one thread's follow-ups into another thread's turn. Nothing is
|
|
587
588
|
// lost: a borrowed checkout is its own git root, so the harness reads its
|
|
588
589
|
// hooks rather than these, and follow-ups drain at the turn boundary.
|
|
589
|
-
this.hasBorrowedWorkspace(record)
|
|
590
|
+
this.hasBorrowedWorkspace(record) ||
|
|
591
|
+
// No Cursor hook runs on a tree.
|
|
592
|
+
this.confinesWorkspaceReads("local")) {
|
|
590
593
|
return;
|
|
591
594
|
}
|
|
592
595
|
if (steeringEnabled()) {
|
|
@@ -820,8 +823,14 @@ export class SessionEngine {
|
|
|
820
823
|
const purpose = sendOptions.purpose === "eval" ? "eval" : "live";
|
|
821
824
|
const frozenAsOf = normalizeAsOf(sendOptions.asOf);
|
|
822
825
|
assertTimeArgs(this.project.agent.tools, frozenAsOf);
|
|
826
|
+
const continuationKey = sendOptions.continuationToken ?? newContinuationKey();
|
|
827
|
+
const sessionId = sendOptions.hostedSessionId ??
|
|
828
|
+
(await this.sessionIds.allocate({
|
|
829
|
+
channelId,
|
|
830
|
+
continuationKey,
|
|
831
|
+
}));
|
|
823
832
|
const record = {
|
|
824
|
-
sessionId
|
|
833
|
+
sessionId,
|
|
825
834
|
channelId,
|
|
826
835
|
mode: sendOptions.mode ?? "chat",
|
|
827
836
|
purpose,
|
|
@@ -829,7 +838,7 @@ export class SessionEngine {
|
|
|
829
838
|
asOf: frozenAsOf,
|
|
830
839
|
modelConfig: modelConfigForDryRun(sendOptions.modelConfig, sendOptions.dryRun),
|
|
831
840
|
instructions,
|
|
832
|
-
continuationKey
|
|
841
|
+
continuationKey,
|
|
833
842
|
auth,
|
|
834
843
|
title: sendOptions.title,
|
|
835
844
|
channelState,
|
|
@@ -1414,47 +1423,62 @@ export class SessionEngine {
|
|
|
1414
1423
|
hasRootOverride() {
|
|
1415
1424
|
return this.project.agent.fs !== undefined || this.project.agent.root !== undefined;
|
|
1416
1425
|
}
|
|
1426
|
+
/**
|
|
1427
|
+
* A sandboxed host-disk agent whose `tools` grant file tools and no shell
|
|
1428
|
+
* runs on its session workspace as a tree, mounted at its `workspace`.
|
|
1429
|
+
*/
|
|
1430
|
+
confinesWorkspaceReads(runtime) {
|
|
1431
|
+
const agent = this.project.agent;
|
|
1432
|
+
return (runtime === "local" &&
|
|
1433
|
+
!this.hasRootOverride() &&
|
|
1434
|
+
confinesWorkspaceReads({ local: agent.local, tools: agent.allowedTools }));
|
|
1435
|
+
}
|
|
1436
|
+
treeWorkspace() {
|
|
1437
|
+
return this.project.agent.workspace ?? DEFAULT_TREE_WORKSPACE;
|
|
1438
|
+
}
|
|
1439
|
+
/**
|
|
1440
|
+
* The session workspace at {@link treeWorkspace}, with the skills mount over
|
|
1441
|
+
* it. Shared memory is a symlink out of the workspace, so it is mounted
|
|
1442
|
+
* read-only in its place, as a sandboxed host agent can read it but not
|
|
1443
|
+
* write through the link.
|
|
1444
|
+
*/
|
|
1445
|
+
async workspaceTree(cwd, options) {
|
|
1446
|
+
const skills = this.project.agent.skills;
|
|
1447
|
+
const workspace = this.treeWorkspace();
|
|
1448
|
+
return sessionFileSystem({
|
|
1449
|
+
authored: unionFs({
|
|
1450
|
+
[workspace]: hostDirectoryTree(cwd),
|
|
1451
|
+
[posix.join(workspace, MEMORY_DIR_NAME)]: readOnlyFs(hostDirectoryTree(join(this.stateRoot, MEMORY_DIR_NAME))),
|
|
1452
|
+
}),
|
|
1453
|
+
skills: skills.length === 0
|
|
1454
|
+
? undefined
|
|
1455
|
+
: { path: SKILLS_MOUNT_PATH, fs: await this.baseSkillsFileSystem() },
|
|
1456
|
+
scratch: options.scratch ? tempFs() : undefined,
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1417
1459
|
/** The field the author set, for messages. Discovery copies a lone `root` onto `fs`. */
|
|
1418
1460
|
authoredFsField() {
|
|
1419
1461
|
return this.project.agent.root === undefined ? "fs" : "root";
|
|
1420
1462
|
}
|
|
1421
1463
|
/**
|
|
1422
|
-
*
|
|
1423
|
-
*
|
|
1424
|
-
*
|
|
1425
|
-
*
|
|
1426
|
-
*
|
|
1427
|
-
*
|
|
1428
|
-
*
|
|
1429
|
-
*
|
|
1430
|
-
* cwd. The read verbs can still reach the Cursor SDK's scratch dir for
|
|
1431
|
-
* that cwd, where native WebFetch and WebSearch write large output.
|
|
1464
|
+
* The tree an `fs` agent runs on: the authored `fs` at `/` with the
|
|
1465
|
+
* skills mount over it. A turn passes it to the SDK as `local.fs`, and
|
|
1466
|
+
* the SDK mounts a fresh `/tmp` over it for each run. A direct call
|
|
1467
|
+
* gets its own empty `/tmp` (`scratch`), so it sees what a run sees.
|
|
1468
|
+
* Authored `fs` (static or factory) is cached per session when `cache`
|
|
1469
|
+
* is set; unscoped `callTool` passes the invocation id and does not
|
|
1470
|
+
* cache, so factories cannot share one tree across callers. A static
|
|
1471
|
+
* handle is used as authored — every session sees that same object.
|
|
1432
1472
|
*/
|
|
1433
|
-
async
|
|
1434
|
-
if (!this.hasRootOverride()) {
|
|
1435
|
-
return localFileSystem({
|
|
1436
|
-
cwd: options.cwd,
|
|
1437
|
-
confineToWorkspace: options.confineToWorkspace === true,
|
|
1438
|
-
readOnlyRoots: [hostAgentToolsDir(options.cwd)],
|
|
1439
|
-
});
|
|
1440
|
-
}
|
|
1473
|
+
async resolveSessionTree(options) {
|
|
1441
1474
|
const authored = await this.resolveAuthoredFileSystem(options);
|
|
1442
|
-
|
|
1443
|
-
const existing = this.turnRoots.get(options.sessionId);
|
|
1444
|
-
if (existing !== undefined) {
|
|
1445
|
-
return existing.root;
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
const root = sessionFileSystem({
|
|
1475
|
+
return sessionFileSystem({
|
|
1449
1476
|
authored: authored.fs,
|
|
1450
1477
|
skills: authored.skills === undefined
|
|
1451
1478
|
? undefined
|
|
1452
1479
|
: { path: SKILLS_MOUNT_PATH, fs: authored.skills },
|
|
1480
|
+
scratch: options.scratch === true ? tempFs() : undefined,
|
|
1453
1481
|
});
|
|
1454
|
-
if (options.cache && this.isTurnRunning(options.sessionId)) {
|
|
1455
|
-
this.turnRoots.set(options.sessionId, { root, cwd: options.cwd });
|
|
1456
|
-
}
|
|
1457
|
-
return root;
|
|
1458
1482
|
}
|
|
1459
1483
|
async resolveAuthoredFileSystem(options) {
|
|
1460
1484
|
const agent = this.project.agent;
|
|
@@ -1539,60 +1563,42 @@ export class SessionEngine {
|
|
|
1539
1563
|
});
|
|
1540
1564
|
return this.baseSkills;
|
|
1541
1565
|
}
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
...tool.definition,
|
|
1573
|
-
execute: async (input, ctx) => {
|
|
1574
|
-
const remapped = await this.prepareScratchToolInput({
|
|
1575
|
-
sessionId,
|
|
1576
|
-
input: input !== null && typeof input === "object" && !Array.isArray(input) ? input : {},
|
|
1577
|
-
});
|
|
1578
|
-
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- tool execute erases its input to never so an authored handler stays assignable
|
|
1579
|
-
return execute(remapped, ctx);
|
|
1580
|
-
},
|
|
1581
|
-
},
|
|
1582
|
-
};
|
|
1583
|
-
});
|
|
1584
|
-
}
|
|
1585
|
-
async nativeFileSystemOutcome(options) {
|
|
1586
|
-
const { toolName, input, callId } = options;
|
|
1587
|
-
if (!isFileSystemToolAlias(toolName)) {
|
|
1588
|
-
return undefined;
|
|
1566
|
+
/**
|
|
1567
|
+
* A native file tool run outside a turn, on the tree a turn of this
|
|
1568
|
+
* session would use. Host-disk agents run it on the harness cwd,
|
|
1569
|
+
* confined to that cwd, with the workspace set to the cwd as a turn's
|
|
1570
|
+
* native tools report it. The read verbs can also reach the SDK's spill
|
|
1571
|
+
* directory for that cwd, where native WebFetch and WebSearch write
|
|
1572
|
+
* large output.
|
|
1573
|
+
*/
|
|
1574
|
+
async directFileToolOutcome(options) {
|
|
1575
|
+
const { toolName, input, callId, sessionId } = options;
|
|
1576
|
+
const tools = this.hasRootOverride()
|
|
1577
|
+
? createFileSystemTools(await this.resolveSessionTree({
|
|
1578
|
+
sessionId: sessionId ?? callId,
|
|
1579
|
+
continuationKey: options.continuationKey,
|
|
1580
|
+
cache: sessionId !== undefined,
|
|
1581
|
+
scratch: true,
|
|
1582
|
+
}), { workspace: this.project.agent.workspace })
|
|
1583
|
+
: this.confinesWorkspaceReads("local")
|
|
1584
|
+
? createFileSystemTools(await this.workspaceTree(options.cwd, { scratch: true }), {
|
|
1585
|
+
workspace: this.treeWorkspace(),
|
|
1586
|
+
})
|
|
1587
|
+
: createFileSystemTools(localFileSystem({
|
|
1588
|
+
cwd: options.cwd,
|
|
1589
|
+
confineToWorkspace: true,
|
|
1590
|
+
readOnlyRoots: [hostAgentToolsDir(options.cwd)],
|
|
1591
|
+
}), { workspace: options.cwd });
|
|
1592
|
+
const tool = tools[options.name];
|
|
1593
|
+
const mutates = tool.annotations.readOnlyHint === false;
|
|
1594
|
+
if (mutates && options.busy && sessionId !== undefined) {
|
|
1595
|
+
throw new SessionBusyError(sessionId);
|
|
1589
1596
|
}
|
|
1590
1597
|
// Same policy the authored callTool path asks: a dry-run write is
|
|
1591
|
-
// answered by the host
|
|
1592
|
-
// decideToolCall and persist through the FileSystem.
|
|
1598
|
+
// answered by the host and never reaches the tree.
|
|
1593
1599
|
const decision = decideToolCall({
|
|
1594
|
-
dryRun: options.dryRun
|
|
1595
|
-
effect:
|
|
1600
|
+
dryRun: options.dryRun,
|
|
1601
|
+
effect: mutates ? "write" : "read",
|
|
1596
1602
|
input,
|
|
1597
1603
|
});
|
|
1598
1604
|
if (decision.kind === "answer") {
|
|
@@ -1602,82 +1608,34 @@ export class SessionEngine {
|
|
|
1602
1608
|
isError: false,
|
|
1603
1609
|
result: decision.result,
|
|
1604
1610
|
durationMs: 0,
|
|
1605
|
-
sessionId
|
|
1611
|
+
sessionId,
|
|
1606
1612
|
};
|
|
1607
1613
|
}
|
|
1608
|
-
const
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
const args = await this.prepareScratchToolInput({
|
|
1617
|
-
sessionId: options.sessionId,
|
|
1618
|
-
input: rawArgs,
|
|
1614
|
+
const failed = (message) => ({
|
|
1615
|
+
callId,
|
|
1616
|
+
toolName,
|
|
1617
|
+
isError: true,
|
|
1618
|
+
result: { status: "error", error: { message } },
|
|
1619
|
+
durationMs: 0,
|
|
1620
|
+
sessionId,
|
|
1621
|
+
errorMessage: message,
|
|
1619
1622
|
});
|
|
1620
|
-
|
|
1621
|
-
const execute = tool?.definition.execute;
|
|
1622
|
-
if (tool === undefined || typeof execute !== "function") {
|
|
1623
|
-
// A resolved root owns this native name. Falling through would let
|
|
1624
|
-
// an authored lookalike run, or surface UnknownToolError after we
|
|
1625
|
-
// already advertised the FileSystem tool.
|
|
1626
|
-
return {
|
|
1627
|
-
callId,
|
|
1628
|
-
toolName,
|
|
1629
|
-
isError: true,
|
|
1630
|
-
result: {
|
|
1631
|
-
status: "error",
|
|
1632
|
-
error: { message: `FileSystem cannot handle ${toolName}` },
|
|
1633
|
-
},
|
|
1634
|
-
durationMs: 0,
|
|
1635
|
-
sessionId: options.sessionId,
|
|
1636
|
-
errorMessage: `FileSystem cannot handle ${toolName}`,
|
|
1637
|
-
};
|
|
1638
|
-
}
|
|
1639
|
-
const validation = validateToolInput(tool.definition.inputSchema, args);
|
|
1640
|
-
if (!validation.ok) {
|
|
1641
|
-
return {
|
|
1642
|
-
callId,
|
|
1643
|
-
toolName,
|
|
1644
|
-
isError: true,
|
|
1645
|
-
result: {
|
|
1646
|
-
status: "error",
|
|
1647
|
-
error: { message: validation.message },
|
|
1648
|
-
},
|
|
1649
|
-
durationMs: 0,
|
|
1650
|
-
sessionId: options.sessionId,
|
|
1651
|
-
errorMessage: validation.message,
|
|
1652
|
-
};
|
|
1653
|
-
}
|
|
1623
|
+
let call;
|
|
1654
1624
|
try {
|
|
1655
|
-
|
|
1656
|
-
const toolInput = validation.value;
|
|
1657
|
-
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- this execute erases ToolContext to never
|
|
1658
|
-
const toolCtx = { toolCallId: callId, workspaceDir: options.cwd };
|
|
1659
|
-
const value = await execute(toolInput, toolCtx);
|
|
1660
|
-
return {
|
|
1661
|
-
callId,
|
|
1662
|
-
toolName,
|
|
1663
|
-
isError: false,
|
|
1664
|
-
result: normalizeToolResult(value),
|
|
1665
|
-
durationMs: 0,
|
|
1666
|
-
sessionId: options.sessionId,
|
|
1667
|
-
};
|
|
1625
|
+
call = await tool.execute(isRecord(input) ? input : {});
|
|
1668
1626
|
}
|
|
1669
1627
|
catch (error) {
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
result: { status: "error", error: { message } },
|
|
1676
|
-
durationMs: 0,
|
|
1677
|
-
sessionId: options.sessionId,
|
|
1678
|
-
errorMessage: message,
|
|
1679
|
-
};
|
|
1628
|
+
return failed(error instanceof Error ? error.message : String(error));
|
|
1629
|
+
}
|
|
1630
|
+
const result = call.result;
|
|
1631
|
+
if (result === undefined) {
|
|
1632
|
+
return failed(`${options.name} returned no result`);
|
|
1680
1633
|
}
|
|
1634
|
+
if (result.status === "error") {
|
|
1635
|
+
const message = describeToolCallError(result.error);
|
|
1636
|
+
return { ...failed(message), result };
|
|
1637
|
+
}
|
|
1638
|
+
return { callId, toolName, isError: false, result, durationMs: 0, sessionId };
|
|
1681
1639
|
}
|
|
1682
1640
|
/**
|
|
1683
1641
|
* Local harness cwd for a session: per-send override, else the shared
|
|
@@ -1869,12 +1827,13 @@ export class SessionEngine {
|
|
|
1869
1827
|
});
|
|
1870
1828
|
const hasPendingFiles = pendingFiles !== undefined && Object.keys(pendingFiles).length > 0;
|
|
1871
1829
|
if (hasPendingFiles && runtime !== "cloud") {
|
|
1872
|
-
const root =
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1830
|
+
const root = this.hasRootOverride()
|
|
1831
|
+
? await this.resolveSessionTree({
|
|
1832
|
+
sessionId,
|
|
1833
|
+
continuationKey: record.continuationKey ?? undefined,
|
|
1834
|
+
cache: true,
|
|
1835
|
+
})
|
|
1836
|
+
: localFileSystem({ cwd: harnessCwd });
|
|
1878
1837
|
await writeWorkspaceFilesToRoot(root, pendingFiles);
|
|
1879
1838
|
}
|
|
1880
1839
|
if ((hasPendingFiles && runtime !== "cloud") ||
|
|
@@ -1893,14 +1852,6 @@ export class SessionEngine {
|
|
|
1893
1852
|
const onUpdate = async (update) => {
|
|
1894
1853
|
endFirstUpdate?.();
|
|
1895
1854
|
endFirstUpdate = undefined;
|
|
1896
|
-
const turn = this.turnRoots.get(sessionId);
|
|
1897
|
-
if (turn !== undefined) {
|
|
1898
|
-
update = await applyWebScratchUpdate({
|
|
1899
|
-
cwd: turn.cwd,
|
|
1900
|
-
root: turn.root,
|
|
1901
|
-
update,
|
|
1902
|
-
});
|
|
1903
|
-
}
|
|
1904
1855
|
mapper.handleUpdate(update);
|
|
1905
1856
|
// Yield so the HTTP NDJSON writer can flush tool start/result
|
|
1906
1857
|
// events while sibling parallel tools are still executing.
|
|
@@ -1944,7 +1895,6 @@ export class SessionEngine {
|
|
|
1944
1895
|
}
|
|
1945
1896
|
finally {
|
|
1946
1897
|
permit.release();
|
|
1947
|
-
this.dropTurnFileSystem(sessionId);
|
|
1948
1898
|
this.approvals.cancelSession(sessionId, "deny");
|
|
1949
1899
|
this.auths.cancelSession(sessionId, "deny");
|
|
1950
1900
|
await this.clearPendingApprovals(sessionId);
|
|
@@ -1980,6 +1930,7 @@ export class SessionEngine {
|
|
|
1980
1930
|
turnId,
|
|
1981
1931
|
data: {
|
|
1982
1932
|
status: outcome.status,
|
|
1933
|
+
code: outcome.errorCode,
|
|
1983
1934
|
message: interrupted
|
|
1984
1935
|
? "turn interrupted"
|
|
1985
1936
|
: (outcome.errorMessage ??
|
|
@@ -2223,34 +2174,24 @@ export class SessionEngine {
|
|
|
2223
2174
|
})
|
|
2224
2175
|
: undefined;
|
|
2225
2176
|
const authoredRoot = this.hasRootOverride();
|
|
2226
|
-
const
|
|
2227
|
-
|
|
2177
|
+
const workspaceConfined = this.confinesWorkspaceReads(runtime);
|
|
2178
|
+
const fileSystem = runtime === "local" && authoredRoot
|
|
2179
|
+
? await this.resolveSessionTree({
|
|
2228
2180
|
sessionId: record.sessionId,
|
|
2229
2181
|
continuationKey: record.continuationKey ?? undefined,
|
|
2230
2182
|
cache: true,
|
|
2231
|
-
cwd: this.harnessCwd(record),
|
|
2232
|
-
// The synthesized file tools run in this process, outside the
|
|
2233
|
-
// harness sandbox. Without this, a sandboxed turn's Read or
|
|
2234
|
-
// Write reaches any path the serve process can.
|
|
2235
|
-
confineToWorkspace: agent.local?.sandbox === true,
|
|
2236
2183
|
})
|
|
2237
|
-
:
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
:
|
|
2247
|
-
|
|
2248
|
-
const fileTools = root === undefined
|
|
2249
|
-
? []
|
|
2250
|
-
: synthesizeFileSystemTools(root, authoredRoot
|
|
2251
|
-
? rootFileToolsFromAuthored(agent.allowedTools)
|
|
2252
|
-
: hostFileToolsFromAuthored(agent.allowedTools));
|
|
2253
|
-
const synthesized = root === undefined ? [] : this.withTurnScratchTools(fileTools, record.sessionId);
|
|
2184
|
+
: workspaceConfined
|
|
2185
|
+
? await this.workspaceTree(this.harnessCwd(record), { scratch: false })
|
|
2186
|
+
: undefined;
|
|
2187
|
+
// An agent on a tree passes its allowlist through: the SDK backs file
|
|
2188
|
+
// tools with the tree and refuses tools it cannot. Host-disk agents keep
|
|
2189
|
+
// the SDK's host natives.
|
|
2190
|
+
const harnessTools = runtime !== "local"
|
|
2191
|
+
? undefined
|
|
2192
|
+
: fileSystem !== undefined
|
|
2193
|
+
? { tools: agent.allowedTools }
|
|
2194
|
+
: resolveHostHarnessToolOptions(agent.allowedTools);
|
|
2254
2195
|
let turnPrompt = prompt;
|
|
2255
2196
|
if (isFirstTurn) {
|
|
2256
2197
|
const contextBlock = buildSessionContextBlock({
|
|
@@ -2318,27 +2259,34 @@ export class SessionEngine {
|
|
|
2318
2259
|
turnPrompt = [preamble, ...sections, turnPrompt].filter((part) => part !== "").join("\n\n");
|
|
2319
2260
|
}
|
|
2320
2261
|
}
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
turnPrompt = `<user_info>\nWorkspace Path: /\n</user_info>\n\n${turnPrompt}`;
|
|
2324
|
-
}
|
|
2325
|
-
// A virtual root has no scaffold dir either, so its catalog carries the
|
|
2326
|
-
// synthesized file tools and embedded script bodies.
|
|
2262
|
+
// An `fs` agent has no scaffold dir, so its catalog embeds script
|
|
2263
|
+
// bodies and indexes the skills mounted in the tree.
|
|
2327
2264
|
const localInstructions = runtime === "local"
|
|
2328
2265
|
? authoredRoot
|
|
2329
|
-
? buildAgentsMdContent(
|
|
2266
|
+
? buildAgentsMdContent(instructionsAgent, {
|
|
2267
|
+
includeScripts: true,
|
|
2268
|
+
skillsIndex: agent.skillsMount !== false,
|
|
2269
|
+
})
|
|
2330
2270
|
: buildAgentsMdContent(instructionsAgent, {
|
|
2331
2271
|
includeScripts: this.hasBorrowedWorkspace(record),
|
|
2272
|
+
skillsIndex: workspaceConfined && agent.skills.length > 0,
|
|
2332
2273
|
})
|
|
2333
2274
|
: undefined;
|
|
2334
|
-
const childFiles = authoredRoot && root !== undefined ? createRootSubagentInherit(root) : undefined;
|
|
2335
2275
|
const selection = this.turnModel(record);
|
|
2336
2276
|
return {
|
|
2337
2277
|
sessionId: record.sessionId,
|
|
2338
2278
|
...(record.sdkAgentId === undefined ? {} : { sdkAgentId: record.sdkAgentId }),
|
|
2339
2279
|
workspaceDir: this.harnessCwd(record),
|
|
2340
|
-
sandbox:
|
|
2341
|
-
|
|
2280
|
+
sandbox: agent.local?.sandbox === true,
|
|
2281
|
+
fs: fileSystem,
|
|
2282
|
+
reportedWorkspacePath: authoredRoot
|
|
2283
|
+
? agent.workspace
|
|
2284
|
+
: workspaceConfined
|
|
2285
|
+
? this.treeWorkspace()
|
|
2286
|
+
: undefined,
|
|
2287
|
+
// As on the host, project rules load from the workspace: the tree's
|
|
2288
|
+
// `<workspace>/AGENTS.md` and `<workspace>/.cursor/rules/`.
|
|
2289
|
+
settingSources: fileSystem === undefined ? undefined : ["project"],
|
|
2342
2290
|
...(runtime === "local" && harnessTools !== undefined
|
|
2343
2291
|
? {
|
|
2344
2292
|
...(harnessTools.tools === undefined ? {} : { tools: harnessTools.tools }),
|
|
@@ -2371,9 +2319,7 @@ export class SessionEngine {
|
|
|
2371
2319
|
...(runtime === "cloud" && !isCursorHostedFilesAvailable()
|
|
2372
2320
|
? { agentServeAgent: this.project.name }
|
|
2373
2321
|
: {}),
|
|
2374
|
-
customTools: runtime === "local"
|
|
2375
|
-
? await this.buildCustomTools(record, turnId, emit, synthesized, signal, childFiles)
|
|
2376
|
-
: {},
|
|
2322
|
+
customTools: runtime === "local" ? await this.buildCustomTools(record, turnId, emit, signal) : {},
|
|
2377
2323
|
mcpServers: this.buildMcpServers(runtime, record.sessionId, await this.evaluateConnectionAuth(record)),
|
|
2378
2324
|
...(runtime === "local" &&
|
|
2379
2325
|
(this.hasAttachedAuthedConnections() ||
|
|
@@ -2619,7 +2565,7 @@ export class SessionEngine {
|
|
|
2619
2565
|
}
|
|
2620
2566
|
return evaluated;
|
|
2621
2567
|
}
|
|
2622
|
-
async buildCustomTools(record, turnId, emit,
|
|
2568
|
+
async buildCustomTools(record, turnId, emit, signal) {
|
|
2623
2569
|
const agent = this.project.agent;
|
|
2624
2570
|
const tools = {};
|
|
2625
2571
|
const register = (tool) => {
|
|
@@ -2633,31 +2579,19 @@ export class SessionEngine {
|
|
|
2633
2579
|
// MCP passthrough's server-declared hints (bounded at listing time)
|
|
2634
2580
|
// ride into the harness listing once the dependency bumps.
|
|
2635
2581
|
...(tool.annotations === undefined ? {} : { annotations: tool.annotations }),
|
|
2636
|
-
execute: async (args, context) => {
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
});
|
|
2647
|
-
const sessionId = context.sessionId;
|
|
2648
|
-
if (childFiles === undefined ||
|
|
2649
|
-
sessionId === undefined ||
|
|
2650
|
-
sessionId === "" ||
|
|
2651
|
-
sessionId === record.sessionId ||
|
|
2652
|
-
sessionId === record.sdkAgentId ||
|
|
2653
|
-
!isSynthesizedFileSystemToolName(tool.name)) {
|
|
2654
|
-
return run();
|
|
2655
|
-
}
|
|
2656
|
-
return runWithFileSystem(childFiles.fileSystemForSession(sessionId), run);
|
|
2657
|
-
},
|
|
2582
|
+
execute: async (args, context) => this.executeServerTool({
|
|
2583
|
+
tool,
|
|
2584
|
+
input: args,
|
|
2585
|
+
toolCallId: context.toolCallId,
|
|
2586
|
+
record,
|
|
2587
|
+
turnId,
|
|
2588
|
+
emit,
|
|
2589
|
+
signal,
|
|
2590
|
+
fromModel: true,
|
|
2591
|
+
}),
|
|
2658
2592
|
};
|
|
2659
2593
|
};
|
|
2660
|
-
for (const tool of
|
|
2594
|
+
for (const tool of agent.tools) {
|
|
2661
2595
|
if (tool.execution !== "server") {
|
|
2662
2596
|
continue;
|
|
2663
2597
|
}
|
|
@@ -3510,33 +3444,23 @@ export class SessionEngine {
|
|
|
3510
3444
|
const session = identity.session;
|
|
3511
3445
|
let workspaceDir = identity.workspaceDir;
|
|
3512
3446
|
let scratchDir = identity.scratchDir;
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
identity.busy &&
|
|
3521
|
-
record !== undefined &&
|
|
3522
|
-
isMutatingFileSystemTool(toolName)) {
|
|
3523
|
-
throw new SessionBusyError(record.sessionId);
|
|
3524
|
-
}
|
|
3525
|
-
if (fileToolAdmitted) {
|
|
3526
|
-
const native = await this.nativeFileSystemOutcome({
|
|
3447
|
+
let tool = this.project.agent.tools.find((t) => t.name === toolName);
|
|
3448
|
+
// An authored tool owns its exact name; the natives stay reachable by their other names.
|
|
3449
|
+
const fileTool = tool === undefined ? directFileToolName(toolName, input) : undefined;
|
|
3450
|
+
if (fileTool !== undefined &&
|
|
3451
|
+
directFileToolAllowed(fileTool, this.project.agent.allowedTools)) {
|
|
3452
|
+
return this.directFileToolOutcome({
|
|
3453
|
+
name: fileTool,
|
|
3527
3454
|
toolName,
|
|
3528
3455
|
input,
|
|
3529
3456
|
callId,
|
|
3530
3457
|
sessionId: record?.sessionId,
|
|
3531
3458
|
continuationKey: record?.continuationKey ?? session.continuationKey ?? undefined,
|
|
3532
3459
|
cwd: workspaceDir,
|
|
3460
|
+
busy: identity.busy,
|
|
3533
3461
|
dryRun: record?.dryRun === true,
|
|
3534
3462
|
});
|
|
3535
|
-
if (native !== undefined) {
|
|
3536
|
-
return native;
|
|
3537
|
-
}
|
|
3538
3463
|
}
|
|
3539
|
-
let tool = this.project.agent.tools.find((t) => t.name === toolName);
|
|
3540
3464
|
if (tool === undefined &&
|
|
3541
3465
|
this.project.agent.connections.some((c) => c.advertiseTools === true)) {
|
|
3542
3466
|
// Advertised passthroughs are ordinary server tools in the session's
|
|
@@ -4873,6 +4797,10 @@ function buildRunnerSubagents(agent) {
|
|
|
4873
4797
|
...(subagent.model === undefined ? {} : { model: subagent.model }),
|
|
4874
4798
|
}));
|
|
4875
4799
|
}
|
|
4800
|
+
/** The message of a native tool call's error result. */
|
|
4801
|
+
function describeToolCallError(error) {
|
|
4802
|
+
return isRecord(error) && typeof error.message === "string" ? error.message : "tool call failed";
|
|
4803
|
+
}
|
|
4876
4804
|
function toolErrorResult(message) {
|
|
4877
4805
|
return {
|
|
4878
4806
|
content: [{ type: "text", text: message }],
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SDK's file tools normalize every path to POSIX form with a leading
|
|
3
|
+
* `/`, so a Windows path such as `C:\Users\me\a.txt` reaches a FileSystem
|
|
4
|
+
* as `/C:/Users/me/a.txt`. Strip that leading `/` on Windows so the host
|
|
5
|
+
* path module sees a drive path.
|
|
6
|
+
*/
|
|
7
|
+
export declare function hostPathFromToolPath(input: string, platform?: NodeJS.Platform): string;
|
|
8
|
+
//# sourceMappingURL=tool-paths.d.ts.map
|