@cursor/bdk 0.2.14 → 0.2.16
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 +51 -52
- package/README.md +1 -1
- package/dist/bin/agent-sdk.js +0 -0
- package/dist/bin/agent-serve.js +41 -3
- package/dist/channels/github/index.d.ts +1 -1
- package/dist/channels/github/index.d.ts.map +1 -1
- package/dist/channels/github/index.js +1 -1
- package/dist/channels/slack/attachments.d.ts +2 -0
- package/dist/channels/slack/attachments.d.ts.map +1 -1
- package/dist/channels/slack/attachments.js +17 -5
- package/dist/channels/slack/channel-watch.d.ts +4 -2
- package/dist/channels/slack/channel-watch.d.ts.map +1 -1
- package/dist/channels/slack/channel-watch.js +4 -2
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +4 -2
- package/dist/channels/slack/types.d.ts +6 -4
- package/dist/channels/slack/types.d.ts.map +1 -1
- package/dist/connections.d.ts +29 -0
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +54 -0
- package/dist/docs/404.html +2 -2
- package/dist/docs/assets/{app.BN3sgOOo.js → app.BSrZkTHD.js} +4 -4
- package/dist/docs/assets/{building-with-agents.md.Df87rAe1.js → building-with-agents.md.Bi9CQ-bR.js} +3 -3
- package/dist/docs/assets/{building-with-agents.md.Df87rAe1.lean.js → building-with-agents.md.Bi9CQ-bR.lean.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.JUnN1Be1.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.CbA00dML.js → VPLocalSearchBox.BxmgcwIX.js} +1 -1
- package/dist/docs/assets/chunks/{arc.Byug8CZM.js → arc.CAid9y9R.js} +1 -1
- package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.D1_qmnQy.js → architectureDiagram-Q4EWVU46.kLxg-1A5.js} +1 -1
- package/dist/docs/assets/chunks/{baseUniq.Dj-Nurf-.js → baseUniq.BWvpjFlO.js} +1 -1
- package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.BZwq3EIg.js → blockDiagram-DXYQGD6D.DyjX8R7M.js} +1 -1
- package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.dx75urO7.js → c4Diagram-AHTNJAMY.DBdWlnqr.js} +1 -1
- package/dist/docs/assets/chunks/channel.CWc3NN9g.js +1 -0
- package/dist/docs/assets/chunks/{chunk-4BX2VUAB.CIoddsDQ.js → chunk-4BX2VUAB.T5enPS2D.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-4TB4RGXK.O3VsVBES.js → chunk-4TB4RGXK.D6zswRAS.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-55IACEB6.WNNWh0Pe.js → chunk-55IACEB6.Bh05N-a3.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-EDXVE4YY.BKVQwEME.js → chunk-EDXVE4YY.DZv_O-d9.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-FMBD7UC4.Cv5iBz7A.js → chunk-FMBD7UC4.BY53CZaL.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-OYMX7WX6.wCDCToee.js → chunk-OYMX7WX6.CO5lI2PE.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-QZHKN3VN.D3IGXhXA.js → chunk-QZHKN3VN.DMfpW0s4.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-YZCP3GAM.CAPPh-E7.js → chunk-YZCP3GAM.COPT56Nr.js} +1 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.D5a745iS.js +1 -0
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.D5a745iS.js +1 -0
- package/dist/docs/assets/chunks/clone.CCGVqN_B.js +1 -0
- package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.BQCFH3M5.js → cose-bilkent-S5V4N54A.BJSj7zzd.js} +1 -1
- package/dist/docs/assets/chunks/{dagre-KV5264BT.lHmdrh7L.js → dagre-KV5264BT.DDv7IQZT.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-5BDNPKRD.EtSPnHgD.js → diagram-5BDNPKRD.BUoE9HFH.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.DCyUnQT8.js → diagram-G4DWMVQ6.BF3JtrnJ.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-MMDJMWI5._E0Qqblb.js → diagram-MMDJMWI5.BvuCWc4e.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-TYMM5635.BDj4oyy_.js → diagram-TYMM5635._EqUGqFN.js} +1 -1
- package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.CrvnO6a3.js → erDiagram-SMLLAGMA.DxNvSdzj.js} +1 -1
- package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.DIhYc-2F.js → flowDiagram-DWJPFMVM.DVtRP546.js} +1 -1
- package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.hFqm_vio.js → ganttDiagram-T4ZO3ILL.Bn9vb7xI.js} +1 -1
- package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.N3GDaVDD.js → gitGraphDiagram-UUTBAWPF.45r6n737.js} +1 -1
- package/dist/docs/assets/chunks/{graph.DK28rMBx.js → graph.BOkX3Ws_.js} +1 -1
- package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.DHmE6W9M.js → infoDiagram-42DDH7IO.DyBCcxOm.js} +1 -1
- package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.ByUJuOYm.js → ishikawaDiagram-UXIWVN3A.kg0ywDlx.js} +1 -1
- package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.BIUChFMh.js → journeyDiagram-VCZTEJTY.BUfrLnXA.js} +1 -1
- package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.CNgFXwo-.js → kanban-definition-6JOO6SKY.Bn7X35b2.js} +1 -1
- package/dist/docs/assets/chunks/{layout.BDnwE4ET.js → layout.B0QW6d8M.js} +1 -1
- package/dist/docs/assets/chunks/{linear.DmrYLXFs.js → linear.C59eCF0D.js} +1 -1
- package/dist/docs/assets/chunks/{min.BbYcWakN.js → min.BnDl0p08.js} +1 -1
- package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.C9x-klkv.js → mindmap-definition-QFDTVHPH.u2HYLooo.js} +1 -1
- package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.iufpEbi0.js → pieDiagram-DEJITSTG.CbnIrr9l.js} +1 -1
- package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.DdoXbWL9.js → quadrantDiagram-34T5L4WZ.D2zWIixq.js} +1 -1
- package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.XL1-_pNk.js → requirementDiagram-MS252O5E.DvOFa3oO.js} +1 -1
- package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.DySXofNs.js → sankeyDiagram-XADWPNL6.BfKCkH3x.js} +1 -1
- package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.Cp0GZoOU.js → sequenceDiagram-FGHM5R23.CUPKdYN0.js} +1 -1
- package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.DvK-sXUX.js → stateDiagram-FHFEXIEX.CimDCRiK.js} +1 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.ClNUVSTQ.js +1 -0
- package/dist/docs/assets/chunks/{theme.Clup4iIo.js → theme.CKht7z82.js} +2 -2
- package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.gHI9ZLm6.js → timeline-definition-GMOUNBTQ.BFTd5qKs.js} +1 -1
- package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.G2N2zXYe.js → vennDiagram-DHZGUBPP.N6t5MmCb.js} +1 -1
- package/dist/docs/assets/chunks/wardley-RL74JXVD.D2G6Zyds.js +162 -0
- package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.BgUKEagd.js → wardleyDiagram-NUSXRM2D.BqScALbL.js} +1 -1
- package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.CwH7oege.js → xychartDiagram-5P7HB3ND.Br0WiDkT.js} +1 -1
- package/dist/docs/assets/deployment.md.hKKN9I4c.js +31 -0
- package/dist/docs/assets/{deployment.md.BYuEcDBv.lean.js → deployment.md.hKKN9I4c.lean.js} +1 -1
- package/dist/docs/assets/{evals.md.C851kViu.js → evals.md.CHR34K1Y.js} +3 -7
- package/dist/docs/assets/{evals.md.C851kViu.lean.js → evals.md.CHR34K1Y.lean.js} +1 -1
- package/dist/docs/assets/guides_cloud-agents.md.CBK7W0-O.js +9 -0
- package/dist/docs/assets/guides_cloud-agents.md.CBK7W0-O.lean.js +1 -0
- package/dist/docs/assets/guides_grokbot-agents.md.BwAykJ7U.js +15 -0
- package/dist/docs/assets/{guides_grokbot-agents.md.tD1smFhU.lean.js → guides_grokbot-agents.md.BwAykJ7U.lean.js} +1 -1
- package/dist/docs/assets/{guides_hooks.md.5Ce3NXxZ.js → guides_hooks.md.B_bKG1oA.js} +1 -1
- package/dist/docs/assets/{guides_improve.md.CRrYq22s.js → guides_improve.md.CZKVt1cT.js} +2 -3
- package/dist/docs/assets/{guides_improve.md.CRrYq22s.lean.js → guides_improve.md.CZKVt1cT.lean.js} +1 -1
- package/dist/docs/assets/{guides_mcp-oauth.md.DR3zhC9r.js → guides_mcp-oauth.md.BM_eFC0L.js} +3 -15
- package/dist/docs/assets/guides_mcp-oauth.md.BM_eFC0L.lean.js +1 -0
- package/dist/docs/assets/{guides_webhooks.md.BBvAm_VF.js → guides_webhooks.md.Cpdc3BDX.js} +13 -12
- package/dist/docs/assets/{guides_webhooks.md.BBvAm_VF.lean.js → guides_webhooks.md.Cpdc3BDX.lean.js} +1 -1
- package/dist/docs/assets/{index.md.Dxxr7pFa.js → index.md.BIBHIQtU.js} +1 -1
- package/dist/docs/assets/{quickstart.md.BK5gjHM2.js → quickstart.md.CduLGBAB.js} +1 -1
- package/dist/docs/assets/{reference_agent-config.md.DrtLxWgR.js → reference_agent-config.md.DYA6ge6t.js} +7 -4
- package/dist/docs/assets/{reference_agent-config.md.DrtLxWgR.lean.js → reference_agent-config.md.DYA6ge6t.lean.js} +1 -1
- package/dist/docs/assets/reference_channels.md.DYg0CLud.js +22 -0
- package/dist/docs/assets/{reference_channels.md.LbNIJBwd.lean.js → reference_channels.md.DYg0CLud.lean.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.dYCAL2lB.js → reference_cli.md.2d2Y0O-d.js} +16 -13
- package/dist/docs/assets/{reference_cli.md.dYCAL2lB.lean.js → reference_cli.md.2d2Y0O-d.lean.js} +1 -1
- package/dist/docs/assets/{reference_connections.md.DLrgAd5f.js → reference_connections.md.CxbLpaaP.js} +4 -5
- package/dist/docs/assets/{reference_connections.md.DLrgAd5f.lean.js → reference_connections.md.CxbLpaaP.lean.js} +1 -1
- package/dist/docs/assets/{reference_evals.md.D5i8PuXJ.js → reference_evals.md.Ccwp4x3o.js} +4 -4
- package/dist/docs/assets/{reference_evals.md.D5i8PuXJ.lean.js → reference_evals.md.Ccwp4x3o.lean.js} +1 -1
- package/dist/docs/assets/{reference_hooks.md.B-eGa2km.js → reference_hooks.md.DbJC8mcZ.js} +1 -1
- package/dist/docs/assets/reference_http-api.md.CrqhTv6S.js +11 -0
- package/dist/docs/assets/{reference_http-api.md.DbFNOubV.lean.js → reference_http-api.md.CrqhTv6S.lean.js} +1 -1
- package/dist/docs/assets/reference_playground.md.q4MI-0td.js +1 -0
- package/dist/docs/assets/reference_playground.md.q4MI-0td.lean.js +1 -0
- package/dist/docs/assets/{reference_schedules.md.BuJ8fgMa.js → reference_schedules.md.03Ryy9ca.js} +5 -5
- package/dist/docs/assets/{reference_schedules.md.BuJ8fgMa.lean.js → reference_schedules.md.03Ryy9ca.lean.js} +1 -1
- package/dist/docs/assets/reference_sessions.md.C_uzIWuy.js +1 -0
- package/dist/docs/assets/{reference_skills.md.ClkMoQsV.js → reference_skills.md.C2GWh7g8.js} +4 -4
- package/dist/docs/assets/{reference_tools.md.DzIY9JzY.js → reference_tools.md.08XR7lIl.js} +3 -14
- package/dist/docs/assets/reference_tools.md.08XR7lIl.lean.js +1 -0
- package/dist/docs/assets/{templates_grokbot-agents.md.2sydjFiO.js → templates_grokbot-agents.md.DgpPEs7B.js} +1 -1
- package/dist/docs/assets/troubleshooting.md.PCafNCb5.js +1 -0
- package/dist/docs/assets/{troubleshooting.md.x-GBa7wN.lean.js → troubleshooting.md.PCafNCb5.lean.js} +1 -1
- package/dist/docs/building-with-agents.html +37 -37
- package/dist/docs/building-with-agents.md +5 -5
- package/dist/docs/deployment.html +43 -41
- package/dist/docs/deployment.md +70 -33
- package/dist/docs/evals.html +38 -42
- package/dist/docs/evals.md +1 -16
- package/dist/docs/guides/agent-to-agent.html +35 -35
- package/dist/docs/guides/bitbucket.html +35 -35
- package/dist/docs/guides/cloud-agents.html +38 -39
- package/dist/docs/guides/cloud-agents.md +2 -8
- package/dist/docs/guides/convert-automation.html +35 -35
- package/dist/docs/guides/github.html +35 -35
- package/dist/docs/guides/gitlab.html +35 -35
- package/dist/docs/guides/grokbot-agents.html +37 -38
- package/dist/docs/guides/grokbot-agents.md +9 -13
- package/dist/docs/guides/hooks.html +37 -37
- package/dist/docs/guides/hooks.md +0 -1
- package/dist/docs/guides/improve.html +37 -38
- package/dist/docs/guides/improve.md +4 -6
- package/dist/docs/guides/jev.html +35 -35
- package/dist/docs/guides/mcp-oauth.html +39 -51
- package/dist/docs/guides/mcp-oauth.md +17 -40
- package/dist/docs/guides/migrate.html +35 -35
- package/dist/docs/guides/opentelemetry.html +35 -35
- package/dist/docs/guides/slack.html +35 -35
- package/dist/docs/guides/webhooks.html +47 -46
- package/dist/docs/guides/webhooks.md +35 -18
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +35 -35
- package/dist/docs/index.html +36 -36
- package/dist/docs/index.md +1 -1
- package/dist/docs/llms-full.txt +388 -272
- package/dist/docs/llms.txt +4 -4
- package/dist/docs/quickstart.html +37 -37
- package/dist/docs/quickstart.md +2 -2
- package/dist/docs/reference/agent-config.html +41 -38
- package/dist/docs/reference/agent-config.md +26 -1
- package/dist/docs/reference/artifacts.html +35 -35
- package/dist/docs/reference/channels.html +42 -43
- package/dist/docs/reference/channels.md +29 -13
- package/dist/docs/reference/cli.html +50 -47
- package/dist/docs/reference/cli.md +115 -42
- package/dist/docs/reference/connections.html +39 -40
- package/dist/docs/reference/connections.md +6 -5
- package/dist/docs/reference/evals.html +38 -38
- package/dist/docs/reference/evals.md +15 -4
- package/dist/docs/reference/extensions.html +35 -35
- package/dist/docs/reference/hooks.html +37 -37
- package/dist/docs/reference/hooks.md +0 -1
- package/dist/docs/reference/http-api.html +38 -38
- package/dist/docs/reference/http-api.md +7 -17
- package/dist/docs/reference/instructions.html +35 -35
- package/dist/docs/reference/playground.html +37 -37
- package/dist/docs/reference/playground.md +1 -4
- package/dist/docs/reference/project-layout.html +35 -35
- package/dist/docs/reference/prompt.html +35 -35
- package/dist/docs/reference/schedules.html +39 -39
- package/dist/docs/reference/schedules.md +26 -3
- package/dist/docs/reference/sessions.html +36 -36
- package/dist/docs/reference/sessions.md +1 -2
- package/dist/docs/reference/skills.html +39 -39
- package/dist/docs/reference/skills.md +1 -1
- package/dist/docs/reference/subagents.html +35 -35
- package/dist/docs/reference/tools.html +39 -50
- package/dist/docs/reference/tools.md +2 -28
- package/dist/docs/templates/agentic-owners.html +35 -35
- package/dist/docs/templates/grokbot-agents.html +37 -37
- package/dist/docs/templates/grokbot-agents.md +1 -1
- package/dist/docs/templates/security-reviewer.html +35 -35
- package/dist/docs/templates/thermo-quality-review.html +35 -35
- package/dist/docs/templates/thermo-review.html +35 -35
- package/dist/docs/templates/triage.html +35 -35
- package/dist/docs/troubleshooting.html +36 -36
- package/dist/docs/troubleshooting.md +12 -7
- package/dist/extensions/cursor-cloud-agents/extension.d.ts +5 -1
- package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -1
- package/dist/extensions/cursor-cloud-agents/extension.js +4 -0
- package/dist/extensions/cursor-cloud-agents/lib/channels.d.ts.map +1 -1
- package/dist/extensions/cursor-cloud-agents/lib/channels.js +5 -1
- package/dist/filesystem.d.ts.map +1 -1
- package/dist/filesystem.js +4 -8
- package/dist/internal/cli-convert-automation.js +9 -19
- package/dist/internal/cli-deploy.d.ts +1 -1
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +18 -3
- package/dist/internal/cli-init-grokbot.d.ts +29 -0
- package/dist/internal/cli-init-grokbot.d.ts.map +1 -0
- package/dist/internal/cli-init-grokbot.js +181 -0
- package/dist/internal/cli-slack.js +1 -1
- package/dist/internal/comment-safe.d.ts +8 -0
- package/dist/internal/comment-safe.d.ts.map +1 -0
- package/dist/internal/comment-safe.js +12 -0
- package/dist/internal/continuation-identity.js +1 -1
- package/dist/internal/convert-automation/convert-workflow.d.ts.map +1 -1
- package/dist/internal/convert-automation/convert-workflow.js +2 -14
- package/dist/internal/convert-grokbot/answers.d.ts +127 -0
- package/dist/internal/convert-grokbot/answers.d.ts.map +1 -0
- package/dist/internal/convert-grokbot/answers.js +443 -0
- package/dist/internal/convert-grokbot/bot.d.ts +50 -0
- package/dist/internal/convert-grokbot/bot.d.ts.map +1 -0
- package/dist/internal/convert-grokbot/bot.js +72 -0
- package/dist/internal/convert-grokbot/checks.d.ts +26 -0
- package/dist/internal/convert-grokbot/checks.d.ts.map +1 -0
- package/dist/internal/convert-grokbot/checks.js +170 -0
- package/dist/internal/convert-grokbot/convert.d.ts +60 -0
- package/dist/internal/convert-grokbot/convert.d.ts.map +1 -0
- package/dist/internal/convert-grokbot/convert.js +470 -0
- package/dist/internal/convert-grokbot/handoff.d.ts +44 -0
- package/dist/internal/convert-grokbot/handoff.d.ts.map +1 -0
- package/dist/internal/convert-grokbot/handoff.js +160 -0
- package/dist/internal/convert-grokbot/recipe.d.ts +61 -0
- package/dist/internal/convert-grokbot/recipe.d.ts.map +1 -0
- package/dist/internal/convert-grokbot/recipe.js +94 -0
- package/dist/internal/convert-grokbot/routine.d.ts +51 -0
- package/dist/internal/convert-grokbot/routine.d.ts.map +1 -0
- package/dist/internal/convert-grokbot/routine.js +128 -0
- package/dist/internal/convert-grokbot/slack.d.ts +28 -0
- package/dist/internal/convert-grokbot/slack.d.ts.map +1 -0
- package/dist/internal/convert-grokbot/slack.js +50 -0
- package/dist/internal/deploy-client.d.ts +0 -2
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +2 -11
- package/dist/internal/discovery/agent-config.d.ts +6 -0
- package/dist/internal/discovery/agent-config.d.ts.map +1 -1
- package/dist/internal/discovery/agent-config.js +19 -0
- package/dist/internal/discovery/agent.d.ts.map +1 -1
- package/dist/internal/discovery/agent.js +2 -1
- package/dist/internal/discovery/names.d.ts +2 -0
- package/dist/internal/discovery/names.d.ts.map +1 -1
- package/dist/internal/discovery/names.js +2 -0
- package/dist/internal/discovery/project.d.ts.map +1 -1
- package/dist/internal/discovery/project.js +1 -3
- package/dist/internal/eval-judge-model.d.ts +10 -5
- package/dist/internal/eval-judge-model.d.ts.map +1 -1
- package/dist/internal/eval-judge-model.js +36 -25
- package/dist/internal/filesystem/subagent-inherit.d.ts +39 -0
- package/dist/internal/filesystem/subagent-inherit.d.ts.map +1 -0
- package/dist/internal/filesystem/subagent-inherit.js +96 -0
- package/dist/internal/filesystem/tools.d.ts +6 -0
- package/dist/internal/filesystem/tools.d.ts.map +1 -1
- package/dist/internal/filesystem/tools.js +38 -1
- package/dist/internal/hosted-catch-protocol.d.ts +2 -0
- package/dist/internal/hosted-catch-protocol.d.ts.map +1 -1
- package/dist/internal/hosted-catch-protocol.js +2 -0
- package/dist/internal/hosted-catch.d.ts +2 -3
- package/dist/internal/hosted-catch.d.ts.map +1 -1
- package/dist/internal/hosted-catch.js +2 -3
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +46 -13
- package/dist/internal/hosted-execution-flush.d.ts +6 -3
- package/dist/internal/hosted-execution-flush.d.ts.map +1 -1
- package/dist/internal/hosted-execution-flush.js +28 -31
- package/dist/internal/hosting.d.ts +1 -1
- package/dist/internal/hosting.d.ts.map +1 -1
- package/dist/internal/hosting.js +7 -3
- package/dist/internal/init-interview.d.ts +3 -5
- package/dist/internal/init-interview.d.ts.map +1 -1
- package/dist/internal/init-interview.js +15 -88
- package/dist/internal/init-project.d.ts +13 -0
- package/dist/internal/init-project.d.ts.map +1 -1
- package/dist/internal/init-project.js +30 -37
- package/dist/internal/init-scaffold.d.ts +11 -0
- package/dist/internal/init-scaffold.d.ts.map +1 -1
- package/dist/internal/init-scaffold.js +47 -13
- package/dist/internal/interview/agent-questions.d.ts +19 -0
- package/dist/internal/interview/agent-questions.d.ts.map +1 -0
- package/dist/internal/interview/agent-questions.js +120 -0
- package/dist/internal/interview/question.d.ts +82 -0
- package/dist/internal/interview/question.d.ts.map +1 -0
- package/dist/internal/interview/question.js +198 -0
- package/dist/internal/local-control-plane.d.ts.map +1 -1
- package/dist/internal/local-control-plane.js +5 -1
- package/dist/internal/otel/collector.d.ts +2 -0
- package/dist/internal/otel/collector.d.ts.map +1 -1
- package/dist/internal/otel/collector.js +4 -0
- package/dist/internal/peer-connections.d.ts +6 -2
- package/dist/internal/peer-connections.d.ts.map +1 -1
- package/dist/internal/peer-connections.js +23 -19
- package/dist/internal/resolve-prod-target.d.ts.map +1 -1
- package/dist/internal/resolve-prod-target.js +2 -1
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +43 -16
- package/dist/internal/sdk-subagent-inherit-support.d.ts +9 -0
- package/dist/internal/sdk-subagent-inherit-support.d.ts.map +1 -0
- package/dist/internal/sdk-subagent-inherit-support.js +89 -0
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +6 -5
- package/dist/internal/session-engine.d.ts +13 -0
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +62 -11
- package/dist/internal/session-run-log.d.ts.map +1 -1
- package/dist/internal/session-run-log.js +26 -11
- package/dist/internal/{convert-automation/slug.d.ts → slug.d.ts} +4 -1
- package/dist/internal/slug.d.ts.map +1 -0
- package/dist/internal/{convert-automation/slug.js → slug.js} +11 -1
- package/dist/playground/assets/index-7fVUOA5l.css +1 -0
- package/dist/playground/assets/{index-ClxRl2Cw.js → index-U3TRnwAP.js} +43 -43
- package/dist/playground/index.html +2 -2
- package/dist/types.d.ts +26 -1
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +1 -1
- package/docs/building-with-agents.md +5 -5
- package/docs/deployment.md +70 -33
- package/docs/evals.md +1 -16
- package/docs/guides/cloud-agents.md +3 -9
- package/docs/guides/grokbot-agents.md +10 -14
- package/docs/guides/hooks.md +0 -1
- package/docs/guides/improve.md +4 -6
- package/docs/guides/mcp-oauth.md +18 -41
- package/docs/guides/webhooks.md +35 -18
- package/docs/quickstart.md +2 -2
- package/docs/reference/agent-config.md +26 -1
- package/docs/reference/channels.md +29 -13
- package/docs/reference/cli.md +115 -42
- package/docs/reference/connections.md +6 -5
- package/docs/reference/evals.md +15 -4
- package/docs/reference/hooks.md +0 -1
- package/docs/reference/http-api.md +7 -17
- package/docs/reference/playground.md +2 -5
- package/docs/reference/schedules.md +26 -3
- package/docs/reference/sessions.md +1 -2
- package/docs/reference/skills.md +1 -1
- package/docs/reference/tools.md +3 -29
- package/docs/templates/grokbot-agents.md +1 -1
- package/docs/troubleshooting.md +12 -7
- package/package.json +36 -35
- package/schemas/grokbot-answers.schema.json +343 -0
- package/skills/create-agent/SKILL.md +16 -11
- package/skills/debug/SKILL.md +3 -4
- package/skills/evals/SKILL.md +2 -2
- package/skills/framework-map/SKILL.md +10 -10
- package/skills/mcp-auth/SKILL.md +10 -34
- package/skills/migrate-v2/SKILL.md +13 -9
- package/skills/setup-slack/SKILL.md +0 -13
- package/templates/agentic-owners/bot/lib/owners/handles.ts +1 -1
- package/templates/agentic-owners/bot/lib/owners/matching.ts +20 -9
- package/templates/agents-md/README.md +3 -3
- package/templates/agents-md/bot/channels/queue.ts +3 -8
- package/templates/agents-md/bot/instructions.md +1 -2
- package/templates/agents-md/bot/tools/apply_agents.ts +0 -1
- package/templates/agents-md/evals/agents.eval.ts +2 -2
- package/templates/demo/bot/channels/queue.ts +5 -15
- package/templates/grokbot-agents/.gitignore +4 -0
- package/templates/pr-autofixer/bot/channels/drive.ts +3 -16
- package/templates/security-help/.gitignore +4 -0
- package/templates/triage/bot/channels/queue.ts +11 -22
- package/templates/triage/bot/channels/webhook.ts +3 -6
- package/templates/triage/bot/lib/parse-queue-event.ts +0 -6
- package/dist/docs/assets/chunks/@localSearchIndexroot.CzrtdJ8s.js +0 -1
- package/dist/docs/assets/chunks/channel.6ebHhoF9.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.BJ-CwKwu.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.BJ-CwKwu.js +0 -1
- package/dist/docs/assets/chunks/clone.DfV2fkWH.js +0 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.DNdUCJyd.js +0 -1
- package/dist/docs/assets/chunks/wardley-RL74JXVD.C46G0P5a.js +0 -162
- package/dist/docs/assets/deployment.md.BYuEcDBv.js +0 -29
- package/dist/docs/assets/guides_cloud-agents.md.CWJjS9No.js +0 -10
- package/dist/docs/assets/guides_cloud-agents.md.CWJjS9No.lean.js +0 -1
- package/dist/docs/assets/guides_grokbot-agents.md.tD1smFhU.js +0 -16
- package/dist/docs/assets/guides_mcp-oauth.md.DR3zhC9r.lean.js +0 -1
- package/dist/docs/assets/reference_channels.md.LbNIJBwd.js +0 -23
- package/dist/docs/assets/reference_http-api.md.DbFNOubV.js +0 -11
- package/dist/docs/assets/reference_playground.md.1hx0gcIu.js +0 -1
- package/dist/docs/assets/reference_playground.md.1hx0gcIu.lean.js +0 -1
- package/dist/docs/assets/reference_sessions.md.CyM7ARz1.js +0 -1
- package/dist/docs/assets/reference_tools.md.DzIY9JzY.lean.js +0 -1
- package/dist/docs/assets/troubleshooting.md.x-GBa7wN.js +0 -1
- package/dist/internal/convert-automation/slug.d.ts.map +0 -1
- package/dist/playground/assets/index-BKSsuEMw.css +0 -1
- /package/dist/docs/assets/{guides_hooks.md.5Ce3NXxZ.lean.js → guides_hooks.md.B_bKG1oA.lean.js} +0 -0
- /package/dist/docs/assets/{index.md.Dxxr7pFa.lean.js → index.md.BIBHIQtU.lean.js} +0 -0
- /package/dist/docs/assets/{quickstart.md.BK5gjHM2.lean.js → quickstart.md.CduLGBAB.lean.js} +0 -0
- /package/dist/docs/assets/{reference_hooks.md.B-eGa2km.lean.js → reference_hooks.md.DbJC8mcZ.lean.js} +0 -0
- /package/dist/docs/assets/{reference_sessions.md.CyM7ARz1.lean.js → reference_sessions.md.C_uzIWuy.lean.js} +0 -0
- /package/dist/docs/assets/{reference_skills.md.ClkMoQsV.lean.js → reference_skills.md.C2GWh7g8.lean.js} +0 -0
- /package/dist/docs/assets/{templates_grokbot-agents.md.2sydjFiO.lean.js → templates_grokbot-agents.md.DgpPEs7B.lean.js} +0 -0
|
@@ -11,7 +11,7 @@ import { loadChannels } from "./channels.js";
|
|
|
11
11
|
import { defaultImportModule, displayPath, } from "./context.js";
|
|
12
12
|
import { hasFlatLayoutMarkers, isDirectory, readPackageName, sortedEntries } from "./fs.js";
|
|
13
13
|
import { loadHooks } from "./hooks.js";
|
|
14
|
-
import { NAME_PATTERN } from "./names.js";
|
|
14
|
+
import { NAME_PATTERN, RESERVED_SLUGS } from "./names.js";
|
|
15
15
|
import { loadReminders } from "./reminders.js";
|
|
16
16
|
import { loadSchedules } from "./schedules.js";
|
|
17
17
|
import { appendArtifactTool, loadArtifacts, loadOtel, loadStorage, mergeArtifacts, rejectLegacyResult, } from "./services.js";
|
|
@@ -133,8 +133,6 @@ function assertSlug(name, parentDir) {
|
|
|
133
133
|
}
|
|
134
134
|
return name;
|
|
135
135
|
}
|
|
136
|
-
/** URL path segments reserved by the server; agents cannot use them as slugs. */
|
|
137
|
-
const RESERVED_SLUGS = new Set(["v1", "playground", "docs"]);
|
|
138
136
|
export async function loadAgentProject(dir, options = {}) {
|
|
139
137
|
// Public API: embedders can call discovery directly (without `serve()` or
|
|
140
138
|
// the CLI), and it dynamically imports authored TypeScript.
|
|
@@ -7,17 +7,22 @@
|
|
|
7
7
|
* prompt injection needs. A reply that talks the judge into running a tool would
|
|
8
8
|
* do so on the machine running the eval CLI, under the runner's credentials.
|
|
9
9
|
*
|
|
10
|
-
* The session is therefore
|
|
10
|
+
* The session is therefore given nothing to act with:
|
|
11
11
|
*
|
|
12
|
-
* - `
|
|
13
|
-
*
|
|
12
|
+
* - `tools: []` so the model is offered no built-in tools and can only reply
|
|
13
|
+
* with text. An injected reply has no shell, file, or MCP call to invoke.
|
|
14
|
+
* Omitting `tools` leaves the default toolset in place.
|
|
14
15
|
* - `mcpServers: {}` so no MCP surface is reachable.
|
|
15
16
|
* - `settingSources: []` plus an empty temp `cwd`, so there is no repo to act on
|
|
16
17
|
* and no ambient `AGENTS.md` / `.cursor` rule can steer a verdict.
|
|
18
|
+
* - `sandboxOptions: { enabled: false }` so grading never requests a local
|
|
19
|
+
* sandbox. Omitting the field is not the same: a `~/.cursor/sandbox.json`
|
|
20
|
+
* policy still counts as a sandbox request and throws on hosts that cannot
|
|
21
|
+
* sandbox. With no tools left, there is nothing for a sandbox to confine.
|
|
17
22
|
*
|
|
18
23
|
* The prompt side is hardened separately: `evals/judge.ts` fences untrusted
|
|
19
|
-
* content behind a per-call boundary. Both halves matter — this one
|
|
20
|
-
*
|
|
24
|
+
* content behind a per-call boundary. Both halves matter — this one removes
|
|
25
|
+
* the tool channel, that one removes the instruction channel.
|
|
21
26
|
*
|
|
22
27
|
* Grading also declines outright when the credential's backend and the SDK's
|
|
23
28
|
* backend disagree, rather than sending a key somewhere it was not minted for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eval-judge-model.d.ts","sourceRoot":"","sources":["../../src/internal/eval-judge-model.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"eval-judge-model.d.ts","sourceRoot":"","sources":["../../src/internal/eval-judge-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,8BAA8B,CAAC;AAoBhE;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,oBAAoB,EAAE,MAAM,EAC5B,UAAU,GAAE,MAAwB,GACnC,IAAI,CASN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B,GAAG,YAAY,GAAG,SAAS,CAQ3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,eAyC5B,CAAC"}
|
|
@@ -7,17 +7,22 @@
|
|
|
7
7
|
* prompt injection needs. A reply that talks the judge into running a tool would
|
|
8
8
|
* do so on the machine running the eval CLI, under the runner's credentials.
|
|
9
9
|
*
|
|
10
|
-
* The session is therefore
|
|
10
|
+
* The session is therefore given nothing to act with:
|
|
11
11
|
*
|
|
12
|
-
* - `
|
|
13
|
-
*
|
|
12
|
+
* - `tools: []` so the model is offered no built-in tools and can only reply
|
|
13
|
+
* with text. An injected reply has no shell, file, or MCP call to invoke.
|
|
14
|
+
* Omitting `tools` leaves the default toolset in place.
|
|
14
15
|
* - `mcpServers: {}` so no MCP surface is reachable.
|
|
15
16
|
* - `settingSources: []` plus an empty temp `cwd`, so there is no repo to act on
|
|
16
17
|
* and no ambient `AGENTS.md` / `.cursor` rule can steer a verdict.
|
|
18
|
+
* - `sandboxOptions: { enabled: false }` so grading never requests a local
|
|
19
|
+
* sandbox. Omitting the field is not the same: a `~/.cursor/sandbox.json`
|
|
20
|
+
* policy still counts as a sandbox request and throws on hosts that cannot
|
|
21
|
+
* sandbox. With no tools left, there is nothing for a sandbox to confine.
|
|
17
22
|
*
|
|
18
23
|
* The prompt side is hardened separately: `evals/judge.ts` fences untrusted
|
|
19
|
-
* content behind a per-call boundary. Both halves matter — this one
|
|
20
|
-
*
|
|
24
|
+
* content behind a per-call boundary. Both halves matter — this one removes
|
|
25
|
+
* the tool channel, that one removes the instruction channel.
|
|
21
26
|
*
|
|
22
27
|
* Grading also declines outright when the credential's backend and the SDK's
|
|
23
28
|
* backend disagree, rather than sending a key somewhere it was not minted for
|
|
@@ -89,30 +94,36 @@ export const callJudgeModel = async ({ prompt, model }) => {
|
|
|
89
94
|
// Imported lazily so a tree of fully deterministic evals never loads the SDK.
|
|
90
95
|
const { Agent } = await import("@cursor/sdk");
|
|
91
96
|
const cwd = await mkdtemp(join(tmpdir(), "agentkit-eval-judge-"));
|
|
92
|
-
const agent = await Agent.create({
|
|
93
|
-
apiKey: resolved.apiKey,
|
|
94
|
-
model: typeof model === "string" ? { id: model } : model,
|
|
95
|
-
// See the module comment: grading embeds untrusted agent output, so the
|
|
96
|
-
// session gets no MCP surface, no ambient settings, an empty working
|
|
97
|
-
// directory, and a sandbox around anything it does attempt.
|
|
98
|
-
mcpServers: {},
|
|
99
|
-
local: {
|
|
100
|
-
cwd,
|
|
101
|
-
settingSources: [],
|
|
102
|
-
sandboxOptions: { enabled: true },
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
97
|
try {
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
98
|
+
const agent = await Agent.create({
|
|
99
|
+
apiKey: resolved.apiKey,
|
|
100
|
+
model: typeof model === "string" ? { id: model } : model,
|
|
101
|
+
// See the module comment: grading embeds untrusted agent output, so the
|
|
102
|
+
// session gets no tools, no MCP surface, no ambient settings, and an
|
|
103
|
+
// empty working directory. Sandbox is explicitly off so a per-user
|
|
104
|
+
// sandbox config cannot re-request one.
|
|
105
|
+
tools: [],
|
|
106
|
+
mcpServers: {},
|
|
107
|
+
local: {
|
|
108
|
+
cwd,
|
|
109
|
+
settingSources: [],
|
|
110
|
+
sandboxOptions: { enabled: false },
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
try {
|
|
114
|
+
const run = await agent.send(prompt);
|
|
115
|
+
const result = await run.wait();
|
|
116
|
+
if (result.status === "error" || result.status === "cancelled") {
|
|
117
|
+
const detail = result.error?.message ?? result.result ?? result.status;
|
|
118
|
+
throw new Error(`eval judge run failed: ${detail}`);
|
|
119
|
+
}
|
|
120
|
+
return result.result ?? "";
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
agent.close();
|
|
111
124
|
}
|
|
112
|
-
return result.result ?? "";
|
|
113
125
|
}
|
|
114
126
|
finally {
|
|
115
|
-
agent.close();
|
|
116
127
|
await rm(cwd, { recursive: true, force: true }).catch(() => undefined);
|
|
117
128
|
}
|
|
118
129
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task-child inherit for an authored virtual root.
|
|
3
|
+
*
|
|
4
|
+
* The SDK calls `resourceProviderOptions` once per child session id,
|
|
5
|
+
* including nested `Task` grandchildren, and reuses that result for the
|
|
6
|
+
* child runtime. Each id gets its own {@link childOverlayFs} over the
|
|
7
|
+
* session union (authored tree plus `/tmp` scratch), so a child write
|
|
8
|
+
* cannot clobber the parent or a sibling. The FileSystem handle is not
|
|
9
|
+
* placed on the SDK request.
|
|
10
|
+
*
|
|
11
|
+
* Native executor overrides load on the first child. A static import
|
|
12
|
+
* would pull workspace-only packages into every CLI start. The published
|
|
13
|
+
* package omits that module; children then keep shell suppressed and
|
|
14
|
+
* reach the same overlay through synthesized file tools.
|
|
15
|
+
*/
|
|
16
|
+
import type { LocalSubagentInherit, LocalSubagentResourceProviderFields } from "@cursor/sdk";
|
|
17
|
+
import { type FileSystem } from "../../filesystem.js";
|
|
18
|
+
/**
|
|
19
|
+
* Structural view of the checkout-only executor module. Naming that module
|
|
20
|
+
* in a type query would pull it into `tsc -p tsconfig.build.json` even
|
|
21
|
+
* though the build config excludes it, and the published program cannot
|
|
22
|
+
* see its workspace-only imports.
|
|
23
|
+
*/
|
|
24
|
+
type ChildToolExecutor = NonNullable<LocalSubagentResourceProviderFields["overrideReadExecutor"]>;
|
|
25
|
+
interface FileSystemExecutorModule {
|
|
26
|
+
createFileSystemReadExecutor(root: FileSystem): ChildToolExecutor;
|
|
27
|
+
createFileSystemWriteExecutor(root: FileSystem): ChildToolExecutor;
|
|
28
|
+
createFileSystemGrepExecutor(root: FileSystem): ChildToolExecutor;
|
|
29
|
+
createFileSystemLsExecutor(root: FileSystem): ChildToolExecutor;
|
|
30
|
+
}
|
|
31
|
+
export interface RootSubagentBinding {
|
|
32
|
+
readonly inherit: LocalSubagentInherit;
|
|
33
|
+
/** Overlay for a Task child. Do not pass the parent session id. */
|
|
34
|
+
fileSystemForSession(sessionId: string): FileSystem;
|
|
35
|
+
}
|
|
36
|
+
export declare function createRootSubagentInherit(parent: FileSystem): RootSubagentBinding;
|
|
37
|
+
export declare function resourceFieldsForChild(overlay: FileSystem, executors: FileSystemExecutorModule | undefined): LocalSubagentResourceProviderFields;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=subagent-inherit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent-inherit.d.ts","sourceRoot":"","sources":["../../../src/internal/filesystem/subagent-inherit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mCAAmC,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtE;;;;;GAKG;AACH,KAAK,iBAAiB,GAAG,WAAW,CAAC,mCAAmC,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAElG,UAAU,wBAAwB;IAChC,4BAA4B,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAAC;IAClE,6BAA6B,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAAC;IACnE,4BAA4B,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAAC;IAClE,0BAA0B,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAAC;CACjE;AAUD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC;IACvC,mEAAmE;IACnE,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAAC;CACrD;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,UAAU,GAAG,mBAAmB,CAcjF;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,wBAAwB,GAAG,SAAS,GAC9C,mCAAmC,CAWrC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task-child inherit for an authored virtual root.
|
|
3
|
+
*
|
|
4
|
+
* The SDK calls `resourceProviderOptions` once per child session id,
|
|
5
|
+
* including nested `Task` grandchildren, and reuses that result for the
|
|
6
|
+
* child runtime. Each id gets its own {@link childOverlayFs} over the
|
|
7
|
+
* session union (authored tree plus `/tmp` scratch), so a child write
|
|
8
|
+
* cannot clobber the parent or a sibling. The FileSystem handle is not
|
|
9
|
+
* placed on the SDK request.
|
|
10
|
+
*
|
|
11
|
+
* Native executor overrides load on the first child. A static import
|
|
12
|
+
* would pull workspace-only packages into every CLI start. The published
|
|
13
|
+
* package omits that module; children then keep shell suppressed and
|
|
14
|
+
* reach the same overlay through synthesized file tools.
|
|
15
|
+
*/
|
|
16
|
+
import { childOverlayFs } from "../../filesystem.js";
|
|
17
|
+
/**
|
|
18
|
+
* Widened to `string` on purpose. A string-literal dynamic import is still
|
|
19
|
+
* a static dependency, so the published declaration build would compile the
|
|
20
|
+
* excluded executor module. Node and the test runner resolve this relative
|
|
21
|
+
* to this file.
|
|
22
|
+
*/
|
|
23
|
+
const FILE_SYSTEM_EXECUTORS_SPECIFIER = "../../filesystem-executors.js";
|
|
24
|
+
export function createRootSubagentInherit(parent) {
|
|
25
|
+
const overlays = new Map();
|
|
26
|
+
return {
|
|
27
|
+
inherit: {
|
|
28
|
+
reportedWorkspacePath: "/",
|
|
29
|
+
resourceProviderOptions: async (context) => {
|
|
30
|
+
const overlay = childOverlayFor(overlays, parent, context.sessionId);
|
|
31
|
+
return resourceFieldsForChild(overlay, await loadFileSystemExecutors());
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
fileSystemForSession(sessionId) {
|
|
35
|
+
return childOverlayFor(overlays, parent, sessionId);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function resourceFieldsForChild(overlay, executors) {
|
|
40
|
+
if (executors === undefined) {
|
|
41
|
+
return { suppressDefaultShellExecutor: true };
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
overrideReadExecutor: executors.createFileSystemReadExecutor(overlay),
|
|
45
|
+
overrideWriteExecutor: executors.createFileSystemWriteExecutor(overlay),
|
|
46
|
+
overrideGrepExecutor: executors.createFileSystemGrepExecutor(overlay),
|
|
47
|
+
overrideLsExecutor: executors.createFileSystemLsExecutor(overlay),
|
|
48
|
+
suppressDefaultShellExecutor: true,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
async function loadFileSystemExecutors() {
|
|
52
|
+
try {
|
|
53
|
+
const loaded = await import(FILE_SYSTEM_EXECUTORS_SPECIFIER);
|
|
54
|
+
if (!isFileSystemExecutorModule(loaded)) {
|
|
55
|
+
throw new Error("filesystem executors module is missing its factories");
|
|
56
|
+
}
|
|
57
|
+
return loaded;
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
if (isMissingModule(error)) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function isFileSystemExecutorModule(value) {
|
|
67
|
+
if (typeof value !== "object" || value === null) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
const candidate = value;
|
|
71
|
+
return (typeof candidate.createFileSystemReadExecutor === "function" &&
|
|
72
|
+
typeof candidate.createFileSystemWriteExecutor === "function" &&
|
|
73
|
+
typeof candidate.createFileSystemGrepExecutor === "function" &&
|
|
74
|
+
typeof candidate.createFileSystemLsExecutor === "function");
|
|
75
|
+
}
|
|
76
|
+
function isMissingModule(error) {
|
|
77
|
+
if (typeof error !== "object" || error === null) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
if ("code" in error && error.code === "ERR_MODULE_NOT_FOUND") {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
return "cause" in error && isMissingModule(error.cause);
|
|
84
|
+
}
|
|
85
|
+
function childOverlayFor(overlays, parent, sessionId) {
|
|
86
|
+
if (sessionId === undefined || sessionId === "") {
|
|
87
|
+
return childOverlayFs(parent);
|
|
88
|
+
}
|
|
89
|
+
const existing = overlays.get(sessionId);
|
|
90
|
+
if (existing !== undefined) {
|
|
91
|
+
return existing;
|
|
92
|
+
}
|
|
93
|
+
const created = childOverlayFs(parent);
|
|
94
|
+
overlays.set(sessionId, created);
|
|
95
|
+
return created;
|
|
96
|
+
}
|
|
@@ -38,5 +38,11 @@ export declare function synthesizedFileSystemToolNames(options: {
|
|
|
38
38
|
export declare function fileSystemTool(root: FileSystem, name: string, input?: Record<string, unknown>): DiscoveredTool | undefined;
|
|
39
39
|
/** Validate and run the same tool a turn or `callTool` would. */
|
|
40
40
|
export declare function runFileSystemTool(root: FileSystem, name: string, input?: Record<string, unknown>): Promise<unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* Run `fn` with synthesized file tools bound to `root`. Task children use
|
|
43
|
+
* this so Read/Write/Delete hit their overlay instead of the parent tree
|
|
44
|
+
* the tools were built against.
|
|
45
|
+
*/
|
|
46
|
+
export declare function runWithFileSystem<T>(root: FileSystem, fn: () => Promise<T>): Promise<T>;
|
|
41
47
|
export declare function synthesizeFileSystemTools(root: FileSystem, filter?: readonly FileSystemToolName[]): DiscoveredTool[];
|
|
42
48
|
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/internal/filesystem/tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/internal/filesystem/tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,kBAAkB,EAYxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,gBAAgB,CAAC;AAgCrE,eAAO,MAAM,kCAAkC,YAC7C,MAAM,EACN,IAAI,EACJ,MAAM,EACN,MAAM,EACN,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,gBAAgB,CACR,CAAC;AAEX,MAAM,MAAM,6BAA6B,GAAG,CAAC,OAAO,kCAAkC,CAAC,CAAC,MAAM,CAAC,CAAC;AAIhG,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMrE;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACnC,kBAAkB,EAAE,GAAG,SAAS,CAmBlC;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACnC,kBAAkB,EAAE,GAAG,SAAS,CAKlC;AAKD;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE;IACtD,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B,GAAG,SAAS,6BAA6B,EAAE,CAW3C;AA2lBD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAClC,cAAc,GAAG,SAAS,CAS5B;AAED,iEAAiE;AACjE,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAClC,OAAO,CAAC,OAAO,CAAC,CAclB;AAID;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEvF;AA8BD,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,UAAU,EAChB,MAAM,CAAC,EAAE,SAAS,kBAAkB,EAAE,GACrC,cAAc,EAAE,CAQlB"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Each tool is a `defineTool` whose runtime `inputSchema` accepts those
|
|
6
6
|
* fields plus the native aliases the harness still sends.
|
|
7
7
|
*/
|
|
8
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
8
9
|
import { Buffer } from "node:buffer";
|
|
9
10
|
import { minimatch } from "minimatch";
|
|
10
11
|
import { z } from "zod";
|
|
@@ -600,11 +601,47 @@ export async function runFileSystemTool(root, name, input = {}) {
|
|
|
600
601
|
}
|
|
601
602
|
return execute(validation.value, {});
|
|
602
603
|
}
|
|
604
|
+
const fileSystemStorage = new AsyncLocalStorage();
|
|
605
|
+
/**
|
|
606
|
+
* Run `fn` with synthesized file tools bound to `root`. Task children use
|
|
607
|
+
* this so Read/Write/Delete hit their overlay instead of the parent tree
|
|
608
|
+
* the tools were built against.
|
|
609
|
+
*/
|
|
610
|
+
export function runWithFileSystem(root, fn) {
|
|
611
|
+
return fileSystemStorage.run(root, fn);
|
|
612
|
+
}
|
|
613
|
+
function bindActiveFileSystem(root, tool) {
|
|
614
|
+
const execute = tool.definition.execute;
|
|
615
|
+
if (execute === undefined) {
|
|
616
|
+
return tool;
|
|
617
|
+
}
|
|
618
|
+
return {
|
|
619
|
+
...tool,
|
|
620
|
+
definition: {
|
|
621
|
+
...tool.definition,
|
|
622
|
+
execute: (input, ctx) => {
|
|
623
|
+
const active = fileSystemStorage.getStore();
|
|
624
|
+
if (active === undefined || active === root) {
|
|
625
|
+
return execute(input, ctx);
|
|
626
|
+
}
|
|
627
|
+
const canonical = canonicalizeFileSystemToolName(tool.name);
|
|
628
|
+
if (canonical === undefined) {
|
|
629
|
+
return execute(input, ctx);
|
|
630
|
+
}
|
|
631
|
+
const reboundExecute = FILE_SYSTEM_TOOL_FACTORIES[canonical](active).definition.execute;
|
|
632
|
+
if (reboundExecute === undefined) {
|
|
633
|
+
return execute(input, ctx);
|
|
634
|
+
}
|
|
635
|
+
return reboundExecute(input, ctx);
|
|
636
|
+
},
|
|
637
|
+
},
|
|
638
|
+
};
|
|
639
|
+
}
|
|
603
640
|
export function synthesizeFileSystemTools(root, filter) {
|
|
604
641
|
const tools = [];
|
|
605
642
|
for (const name of SYNTHESIZED_FILE_SYSTEM_TOOL_NAMES) {
|
|
606
643
|
if (wantsTool(filter, name)) {
|
|
607
|
-
tools.push(FILE_SYSTEM_TOOL_FACTORIES[name](root));
|
|
644
|
+
tools.push(bindActiveFileSystem(root, FILE_SYSTEM_TOOL_FACTORIES[name](root)));
|
|
608
645
|
}
|
|
609
646
|
}
|
|
610
647
|
return tools;
|
|
@@ -21,6 +21,8 @@ export declare const AGENT_SDK_HTTP_CHANNEL_ID = "http";
|
|
|
21
21
|
export declare const AGENT_SDK_HTTP_CHANNEL_KIND = "http";
|
|
22
22
|
export declare const AGENT_SDK_SESSION_RESUME_KEY_PREFIX = "cont:session:";
|
|
23
23
|
export declare const AGENT_SDK_CATCH_MAX_BODY_BYTES: number;
|
|
24
|
+
/** Header a replayed request carries so handlers can dedupe on delivery. */
|
|
25
|
+
export declare const CATCH_DELIVERY_ID_HEADER = "x-agent-sdk-delivery-id";
|
|
24
26
|
export declare const AGENT_SDK_CATCH_ROUTE_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
25
27
|
export type CatchRouteMethod = (typeof AGENT_SDK_CATCH_ROUTE_METHODS)[number];
|
|
26
28
|
export type CatchRequestEnvelope = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-catch-protocol.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-catch-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAClD,eAAO,MAAM,0BAA0B,iBAAiB,CAAC;AACzD,eAAO,MAAM,6BAA6B,WAAW,CAAC;AACtD,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAC/D,eAAO,MAAM,8BAA8B,uBAAuB,CAAC;AACnE,eAAO,MAAM,yBAAyB,SAAS,CAAC;AAChD,eAAO,MAAM,2BAA2B,SAAS,CAAC;AAClD,eAAO,MAAM,mCAAmC,kBAAkB,CAAC;AACnE,eAAO,MAAM,8BAA8B,EAAE,MAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"hosted-catch-protocol.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-catch-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAClD,eAAO,MAAM,0BAA0B,iBAAiB,CAAC;AACzD,eAAO,MAAM,6BAA6B,WAAW,CAAC;AACtD,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAC/D,eAAO,MAAM,8BAA8B,uBAAuB,CAAC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SDK_SESSION_RESUME_KEY_PREFIX = "cont:session:";
|
|
24
24
|
export const AGENT_SDK_CATCH_MAX_BODY_BYTES = 256 * 1024;
|
|
25
|
+
/** Header a replayed request carries so handlers can dedupe on delivery. */
|
|
26
|
+
export const CATCH_DELIVERY_ID_HEADER = "x-agent-sdk-delivery-id";
|
|
25
27
|
export const AGENT_SDK_CATCH_ROUTE_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
26
28
|
/**
|
|
27
29
|
* Mailbox key the control plane stamps on an explicit `ses_…` resume. The
|
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
* a handler that answers without sending is a `skip`.
|
|
11
11
|
*/
|
|
12
12
|
import type { AuthContext, ChannelDefinition, ChannelHandlerArgs, ChannelRoute } from "../types.js";
|
|
13
|
-
import { type CatchRequestEnvelope } from "./hosted-catch-protocol.js";
|
|
14
|
-
|
|
15
|
-
export declare const CATCH_DELIVERY_ID_HEADER = "x-agent-sdk-delivery-id";
|
|
13
|
+
import { CATCH_DELIVERY_ID_HEADER, type CatchRequestEnvelope } from "./hosted-catch-protocol.js";
|
|
14
|
+
export { CATCH_DELIVERY_ID_HEADER };
|
|
16
15
|
/**
|
|
17
16
|
* Principal for a replayed request. The deployment secret was checked by
|
|
18
17
|
* the control plane before compute existed; the channel's own auth chain
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-catch.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-catch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMpG,OAAO,EAGL,KAAK,oBAAoB,EAG1B,MAAM,4BAA4B,CAAC;AAIpC,
|
|
1
|
+
{"version":3,"file":"hosted-catch.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-catch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMpG,OAAO,EAGL,wBAAwB,EACxB,KAAK,oBAAoB,EAG1B,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,wBAAwB,EAAE,CAAC;AAIpC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAIhC,CAAC;AAIF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,oBAAoB,CAAC;CAChC,GAAG,OAAO,CAcV;AAED,wBAAsB,kBAAkB,CAAC,KAAK,EAAE;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,kBAAkB,CAAC;CAC1B,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiFpB;AAgBD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,iBAAiB,CAAC,OAAO,CAAC,EACtC,MAAM,EAAE,SAAS,YAAY,EAAE,GAC9B,IAAI,CAgBN"}
|
|
@@ -14,11 +14,10 @@ import { classifyHostedAdmissionRejection } from "./hosted-delivery-protocol.js"
|
|
|
14
14
|
import { invokeChannelRoute } from "./channel-route-dispatch.js";
|
|
15
15
|
import { DeferredChannelSessionError } from "./deferred-channel-session.js";
|
|
16
16
|
import { attachHostedAdmissionAdapter } from "./hosted-admission-adapter.js";
|
|
17
|
-
import { AGENT_SDK_CATCH_EVENT_TYPE, AGENT_SDK_CUSTOM_CHANNEL_KIND, decodeCatchBody, parseCatchRequestEnvelope, } from "./hosted-catch-protocol.js";
|
|
17
|
+
import { AGENT_SDK_CATCH_EVENT_TYPE, AGENT_SDK_CUSTOM_CHANNEL_KIND, CATCH_DELIVERY_ID_HEADER, decodeCatchBody, parseCatchRequestEnvelope, } from "./hosted-catch-protocol.js";
|
|
18
18
|
import { errorResponse } from "./http-channel.js";
|
|
19
19
|
import { Router } from "./router.js";
|
|
20
|
-
|
|
21
|
-
export const CATCH_DELIVERY_ID_HEADER = "x-agent-sdk-delivery-id";
|
|
20
|
+
export { CATCH_DELIVERY_ID_HEADER };
|
|
22
21
|
/** Placeholder origin for replayed requests; handlers see a well-formed URL. */
|
|
23
22
|
const CATCH_REQUEST_ORIGIN = "http://agent-sdk.hosted";
|
|
24
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-delivery.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-delivery.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAEnB,MAAM,aAAa,CAAC;AAErB,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAO1C,OAAO,EAKL,KAAK,sBAAsB,EAG5B,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EAQL,KAAK,oBAAoB,EAIzB,KAAK,mCAAmC,EAWzC,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"hosted-delivery.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-delivery.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAEnB,MAAM,aAAa,CAAC;AAErB,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAO1C,OAAO,EAKL,KAAK,sBAAsB,EAG5B,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EAQL,KAAK,oBAAoB,EAIzB,KAAK,mCAAmC,EAWzC,MAAM,+BAA+B,CAAC;AAsBvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD,OAAO,KAAK,EAAE,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;CAC7B,GAAG,IAAI,CAurBP"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
|
-
import { metrics } from "@opentelemetry/api";
|
|
2
|
+
import { metrics, trace } from "@opentelemetry/api";
|
|
3
3
|
import { packageVersion } from "./distribution.js";
|
|
4
4
|
import { dispatchOutcome } from "./channel-dispatch.js";
|
|
5
5
|
import { consumeHostedBoundSecrets, } from "./cursor/hosted-bound-secrets.js";
|
|
@@ -11,7 +11,7 @@ import { getHostedAdmissionAdapter, } from "./hosted-admission-adapter.js";
|
|
|
11
11
|
import { HostedAdmissionLocalSendError, runDuringHostedAdmission, } from "./hosted-admission-context.js";
|
|
12
12
|
import { HOSTED_ADMISSION_PATH, HOSTED_DELIVERY_HEADER, HOSTED_DELIVERY_PROTOCOL_VERSION, HOSTED_EXECUTION_PATH, HOSTED_GUEST_RETRY_TERMINAL, HOSTED_GUEST_RETRY_TRANSIENT, HOSTED_MAX_CONSUMED_DELIVERY_IDS, hostedFailureClassification, hostedGuestErrorResponse, isHostedReminderAdmission, isHostedScheduleAdmission, parseHostedAdmissionHandlerRejection, parseHostedAdmission, parseHostedExecution, parseHostedReminderFireDescriptorPayload, parseHostedReminderFirePayload, parseHostedScheduleFirePayload, } from "./hosted-delivery-protocol.js";
|
|
13
13
|
import { abortReasonFromTurnStatus, HOSTED_EXECUTION_DIAG_RUNNING_STATUS, hostedExecutionDiagId, } from "./hosted-execution-diag.js";
|
|
14
|
-
import {
|
|
14
|
+
import { flushDurableHostedExecutionRecord, refreshStartLogWhile, writeLocalHostedExecutionRecord, } from "./hosted-execution-flush.js";
|
|
15
15
|
import { finalizeHostedExecutionLatency, formatHostedExecutionLatencyServerTiming, hostedExecutionNow, runWithHostedExecutionLatency, } from "./hosted-execution-latency.js";
|
|
16
16
|
import { recordHostedManagedAutomation } from "./hosted-managed-automation.js";
|
|
17
17
|
import { readJsonObject } from "./http-channel.js";
|
|
@@ -482,11 +482,16 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
482
482
|
if (definition === undefined) {
|
|
483
483
|
return await responseToReply(finish(terminalHostedError(404, "channel_not_found", `No channel named "${delivery.channelId}" is mounted.`)));
|
|
484
484
|
}
|
|
485
|
+
const endHandler = startHostedSpan("admission.handler", {
|
|
486
|
+
"agent_sdk.channel_kind": delivery.channelKind,
|
|
487
|
+
"agent_sdk.delivery_id": delivery.deliveryId,
|
|
488
|
+
});
|
|
485
489
|
const admitted = await dispatchHostedAdmission({
|
|
486
490
|
delivery,
|
|
487
491
|
definition,
|
|
488
492
|
args: input.buildHandlerArgs(delivery.channelId),
|
|
489
493
|
});
|
|
494
|
+
endHandler();
|
|
490
495
|
if (admitted.pendingSend === undefined) {
|
|
491
496
|
return await responseToReply(finish(admitted.response));
|
|
492
497
|
}
|
|
@@ -682,7 +687,13 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
682
687
|
admitted.expiresAt = Date.now() + ownerTurnPendingTtlMs;
|
|
683
688
|
}
|
|
684
689
|
admitted.execution ??= afterHostedWork(input.flushOtel, async () => {
|
|
690
|
+
const spanAttributes = {
|
|
691
|
+
"agent_sdk.channel_kind": admitted.channelKind,
|
|
692
|
+
"agent_sdk.session_public_id": execution.sessionPublicId,
|
|
693
|
+
};
|
|
694
|
+
const endNetworkWait = startHostedSpan("execute.network_wait", spanAttributes);
|
|
685
695
|
const network = await finishNetworkWait("execution");
|
|
696
|
+
endNetworkWait();
|
|
686
697
|
guestNetwork = network.timing;
|
|
687
698
|
if (network.response !== undefined) {
|
|
688
699
|
return await responseToReply(finish(network.response));
|
|
@@ -697,11 +708,14 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
697
708
|
...(input.flushStartLog === undefined ? {} : { flushStartLog: input.flushStartLog }),
|
|
698
709
|
...(input.snapshotLogs === undefined ? {} : { snapshotLogs: input.snapshotLogs }),
|
|
699
710
|
};
|
|
700
|
-
|
|
711
|
+
// Store writes are chained so a slow `running` write cannot land
|
|
712
|
+
// after the terminal one.
|
|
713
|
+
let durableWrites = Promise.resolve();
|
|
714
|
+
const writeDiag = async (fields, options) => {
|
|
701
715
|
const classification = fields.failureCode === undefined
|
|
702
716
|
? undefined
|
|
703
717
|
: hostedFailureClassification(fields.failureCode);
|
|
704
|
-
|
|
718
|
+
const record = {
|
|
705
719
|
executionId,
|
|
706
720
|
sessionPublicId: execution.sessionPublicId,
|
|
707
721
|
sessionId: fields.sessionId,
|
|
@@ -713,16 +727,25 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
713
727
|
...(fields.errorCode === undefined ? {} : { errorCode: fields.errorCode }),
|
|
714
728
|
classification,
|
|
715
729
|
...(fields.error === undefined ? {} : { error: fields.error }),
|
|
716
|
-
}
|
|
730
|
+
};
|
|
731
|
+
const writtenAt = new Date().toISOString();
|
|
732
|
+
await writeLocalHostedExecutionRecord(sinks, record, writtenAt);
|
|
733
|
+
durableWrites = durableWrites.then(() => flushDurableHostedExecutionRecord(sinks, record, writtenAt));
|
|
734
|
+
if (options.awaitDurable) {
|
|
735
|
+
await durableWrites;
|
|
736
|
+
}
|
|
717
737
|
};
|
|
718
|
-
// Claim the file before the turn runs. If a later status
|
|
719
|
-
// fails, the host reads this record while the turn may
|
|
720
|
-
// running; the marker prevents it from surfacing the
|
|
721
|
-
// delivery's terminal record.
|
|
738
|
+
// Claim the local file before the turn runs. If a later status
|
|
739
|
+
// request fails, the host reads this record while the turn may
|
|
740
|
+
// still be running; the marker prevents it from surfacing the
|
|
741
|
+
// previous delivery's terminal record. The store copies are
|
|
742
|
+
// dashboard history, so the turn does not wait on them.
|
|
743
|
+
const endClaim = startHostedSpan("execute.claim", spanAttributes);
|
|
722
744
|
await writeDiag({
|
|
723
745
|
sessionId: "",
|
|
724
746
|
turnStatus: HOSTED_EXECUTION_DIAG_RUNNING_STATUS,
|
|
725
|
-
});
|
|
747
|
+
}, { awaitDurable: false });
|
|
748
|
+
endClaim();
|
|
726
749
|
let sessionId = "";
|
|
727
750
|
const owner = {
|
|
728
751
|
primaryDeliveryId: admitted.deliveryId,
|
|
@@ -743,6 +766,7 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
743
766
|
key: admitted.send.mailboxContinuationKey,
|
|
744
767
|
},
|
|
745
768
|
};
|
|
769
|
+
const endSend = startHostedSpan("execute.send", spanAttributes);
|
|
746
770
|
const session = input.startSend === undefined
|
|
747
771
|
? await args.send(admitted.send.message, options)
|
|
748
772
|
: await input.startSend({
|
|
@@ -751,6 +775,7 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
751
775
|
options,
|
|
752
776
|
sessionPublicId: execution.sessionPublicId,
|
|
753
777
|
});
|
|
778
|
+
endSend();
|
|
754
779
|
sessionId = session.id;
|
|
755
780
|
// The pre-turn claim used an empty sessionId. Stamp the
|
|
756
781
|
// engine id now so a dashboard / session-view poll that
|
|
@@ -758,7 +783,7 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
758
783
|
await writeDiag({
|
|
759
784
|
sessionId,
|
|
760
785
|
turnStatus: HOSTED_EXECUTION_DIAG_RUNNING_STATUS,
|
|
761
|
-
});
|
|
786
|
+
}, { awaitDurable: false });
|
|
762
787
|
const outcome = await refreshStartLogWhile(sinks, execution.sessionPublicId, () => session.waitForCompletion());
|
|
763
788
|
completionAt = hostedExecutionNow();
|
|
764
789
|
// Status is the owner turn. waitForCompletion still waited
|
|
@@ -796,7 +821,7 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
796
821
|
abortReason: abortReasonFromTurnStatus(outcome.status, outcome.cancellationReason),
|
|
797
822
|
failureCode: hostedFailure?.error,
|
|
798
823
|
...(outcome.errorCode === undefined ? {} : { errorCode: outcome.errorCode }),
|
|
799
|
-
});
|
|
824
|
+
}, { awaitDurable: true });
|
|
800
825
|
const reply = hostedFailure !== undefined
|
|
801
826
|
? {
|
|
802
827
|
status: 503,
|
|
@@ -845,7 +870,7 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
845
870
|
failureCode: "internal_error",
|
|
846
871
|
error,
|
|
847
872
|
...(thrownErrorCode === undefined ? {} : { errorCode: thrownErrorCode }),
|
|
848
|
-
});
|
|
873
|
+
}, { awaitDurable: true });
|
|
849
874
|
const endedAt = hostedExecutionNow();
|
|
850
875
|
// Preserve completion/drain marks when the failure happened
|
|
851
876
|
// during post-drain work; otherwise collapse to endedAt.
|
|
@@ -1023,6 +1048,14 @@ function hostedFailureForUnfinishedTurn(outcome) {
|
|
|
1023
1048
|
}
|
|
1024
1049
|
return { error: "turn_failed", retry: HOSTED_GUEST_RETRY_TERMINAL };
|
|
1025
1050
|
}
|
|
1051
|
+
/**
|
|
1052
|
+
* `agent_sdk.hosted.<step>` span; call the result to end it. The delivery
|
|
1053
|
+
* replies before this work finishes, so the inbound HTTP span never covers it.
|
|
1054
|
+
*/
|
|
1055
|
+
function startHostedSpan(step, attributes) {
|
|
1056
|
+
const span = trace.getTracer("agent_sdk").startSpan(`agent_sdk.hosted.${step}`, { attributes });
|
|
1057
|
+
return () => span.end();
|
|
1058
|
+
}
|
|
1026
1059
|
async function afterHostedWork(flushOtel, work) {
|
|
1027
1060
|
try {
|
|
1028
1061
|
const result = await work();
|
|
@@ -32,11 +32,14 @@ export type HostedExecutionFlushFields = {
|
|
|
32
32
|
classification?: HostedFailureClassification;
|
|
33
33
|
error?: unknown;
|
|
34
34
|
};
|
|
35
|
+
/** The guest-disk diagnostic the host reads after a failed execute. */
|
|
36
|
+
export declare function writeLocalHostedExecutionRecord(sinks: HostedExecutionFlushSinks, fields: HostedExecutionFlushFields, writtenAt: string): Promise<void>;
|
|
35
37
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
+
* Store-backed execution history and process output. Never rejects. Both
|
|
39
|
+
* sinks start synchronously, so their crash-flush state is stamped before
|
|
40
|
+
* either store round trip.
|
|
38
41
|
*/
|
|
39
|
-
export declare function
|
|
42
|
+
export declare function flushDurableHostedExecutionRecord(sinks: HostedExecutionFlushSinks, fields: HostedExecutionFlushFields, writtenAt: string): Promise<void>;
|
|
40
43
|
/**
|
|
41
44
|
* Each refresh is a store write on the deployment's shared write budget, so
|
|
42
45
|
* keep it coarse. An unchanged tee costs nothing (the store skips the put).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-execution-flush.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-execution-flush.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EACL,KAAK,8BAA8B,EAGpC,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAG9B,MAAM,sBAAsB,CAAC;AAU9B,MAAM,MAAM,yBAAyB,GAAG;IACtC,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,aAAa,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,YAAY,CAAC,IAAI,YAAY,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,8BAA8B,CAAC;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,2BAA2B,CAAC;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF
|
|
1
|
+
{"version":3,"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