@cursor/bdk 0.2.15 → 0.2.17
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/README.md +2 -2
- 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/agentic-delivery.js +4 -4
- package/dist/channels/slack/api.d.ts.map +1 -1
- package/dist/channels/slack/api.js +7 -4
- package/dist/channels/slack/channel-watch.d.ts +2 -0
- package/dist/channels/slack/channel-watch.d.ts.map +1 -1
- package/dist/channels/slack/channel-watch.js +7 -3
- package/dist/channels/slack/dispatch.d.ts +3 -0
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +6 -2
- package/dist/channels/slack/thread-context.d.ts.map +1 -1
- package/dist/channels/slack/thread-context.js +58 -26
- package/dist/channels/slack/types.d.ts +19 -0
- package/dist/channels/slack/types.d.ts.map +1 -1
- package/dist/docs/404.html +3 -3
- package/dist/docs/assets/{app.CRMxF0qX.js → app.CUNuFTSm.js} +4 -4
- package/dist/docs/assets/{building-with-agents.md.Bi9CQ-bR.js → building-with-agents.md.FZXrY8Nk.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.3c56VHUt.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.C4BiQe53.js → VPLocalSearchBox.Dez74k0W.js} +1 -1
- package/dist/docs/assets/chunks/{arc.D1TA2Mxn.js → arc.CJ3FhK7H.js} +1 -1
- package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.CA-hBJCN.js → architectureDiagram-Q4EWVU46.CfUdbHsa.js} +1 -1
- package/dist/docs/assets/chunks/{baseUniq.CzsSgiab.js → baseUniq.D93LawU9.js} +1 -1
- package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.sxrH_f0l.js → blockDiagram-DXYQGD6D.Zvsd6UHP.js} +1 -1
- package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.D_Z3mqAl.js → c4Diagram-AHTNJAMY.CGX5xZ9d.js} +1 -1
- package/dist/docs/assets/chunks/channel.S8-FFjmE.js +1 -0
- package/dist/docs/assets/chunks/{chunk-4BX2VUAB.BS6_uTUf.js → chunk-4BX2VUAB.CCIf0QCo.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-4TB4RGXK.D-URAeTU.js → chunk-4TB4RGXK.D_N1RPyi.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-55IACEB6.b4SZc5kO.js → chunk-55IACEB6.B1oecjzx.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-EDXVE4YY.DLKEEDkN.js → chunk-EDXVE4YY.BzUNVPGX.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-FMBD7UC4.3SyQHgpY.js → chunk-FMBD7UC4.DheI8WSO.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-OYMX7WX6.DBKKaFeS.js → chunk-OYMX7WX6.Bg4iL0sM.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-QZHKN3VN.BhCYeR7H.js → chunk-QZHKN3VN.CSQjDhAD.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-YZCP3GAM.Cpg0VgI7.js → chunk-YZCP3GAM.BDdxnPU4.js} +1 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.BB98tFjZ.js +1 -0
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.BB98tFjZ.js +1 -0
- package/dist/docs/assets/chunks/clone.B98w8OEv.js +1 -0
- package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.4q0YNZN6.js → cose-bilkent-S5V4N54A.AT0weO8r.js} +1 -1
- package/dist/docs/assets/chunks/{dagre-KV5264BT.Bk_CcQPr.js → dagre-KV5264BT.CJ30TxV0.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-5BDNPKRD.CgreoM_Z.js → diagram-5BDNPKRD.KtE--1fW.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.DlZGpm6W.js → diagram-G4DWMVQ6.BFGygSUQ.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-MMDJMWI5.BxtXxgIR.js → diagram-MMDJMWI5.BLU-79eb.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-TYMM5635.DSzlJp2D.js → diagram-TYMM5635.CdjfJdVG.js} +1 -1
- package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.BN1YUmEV.js → erDiagram-SMLLAGMA.Dj1Iwypl.js} +1 -1
- package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.B61NGNYu.js → flowDiagram-DWJPFMVM.BXqj_Su2.js} +1 -1
- package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.DR-tto3M.js → ganttDiagram-T4ZO3ILL.CNfgGSst.js} +1 -1
- package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.CBPs2W_2.js → gitGraphDiagram-UUTBAWPF.2tgvFDBr.js} +1 -1
- package/dist/docs/assets/chunks/{graph.DmlaqzCE.js → graph.CWHZMxx6.js} +1 -1
- package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.obPv-fFg.js → infoDiagram-42DDH7IO.DhLIK8m1.js} +1 -1
- package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.CXHTUcM3.js → ishikawaDiagram-UXIWVN3A.BIN11n1G.js} +1 -1
- package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.BoVHerYZ.js → journeyDiagram-VCZTEJTY.BARmNJ0n.js} +1 -1
- package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.CfYmPHZg.js → kanban-definition-6JOO6SKY.BrTJYFyF.js} +1 -1
- package/dist/docs/assets/chunks/{layout.621UdAhB.js → layout.CPZIIywK.js} +1 -1
- package/dist/docs/assets/chunks/{linear.Cz_zRKjr.js → linear.DTpmzI5S.js} +1 -1
- package/dist/docs/assets/chunks/{min.ON4GjCH7.js → min.BBLQmXwZ.js} +1 -1
- package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.DLPMLJlv.js → mindmap-definition-QFDTVHPH.5qkWJvdl.js} +1 -1
- package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.BFp11AYt.js → pieDiagram-DEJITSTG.-4wufv_f.js} +1 -1
- package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.ChX7xo6B.js → quadrantDiagram-34T5L4WZ.C0jrp1-8.js} +1 -1
- package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.DbKtHG_Q.js → requirementDiagram-MS252O5E.DUDpANfe.js} +1 -1
- package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.Spw8tv-7.js → sankeyDiagram-XADWPNL6.74Lvg6Gu.js} +1 -1
- package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.BYso9LlE.js → sequenceDiagram-FGHM5R23.BHDIH286.js} +1 -1
- package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.D8l54jqW.js → stateDiagram-FHFEXIEX.Dr-HIuLb.js} +1 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.DW_lwpZY.js +1 -0
- package/dist/docs/assets/chunks/{theme.m_Ethbkv.js → theme.H8zSBhlM.js} +2 -2
- package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.BLdhhyy9.js → timeline-definition-GMOUNBTQ.GtyCaSiL.js} +1 -1
- package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.CyGT2F_P.js → vennDiagram-DHZGUBPP.DLId0rxH.js} +1 -1
- package/dist/docs/assets/chunks/{wardley-RL74JXVD.C5JJS3bh.js → wardley-RL74JXVD.CSlECTHi.js} +1 -1
- package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.p_Sz9p1i.js → wardleyDiagram-NUSXRM2D.CI6mGYNG.js} +1 -1
- package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.DtXsNUaf.js → xychartDiagram-5P7HB3ND.CG1n865F.js} +1 -1
- package/dist/docs/assets/{deployment.md.hKKN9I4c.js → deployment.md.ajc3VM0m.js} +1 -1
- package/dist/docs/assets/{guides_migrate.md.sCAvvlC6.js → guides_migrate.md.DZBL7dqT.js} +1 -1
- package/dist/docs/assets/index.md.CHAFTf6m.js +27 -0
- package/dist/docs/assets/index.md.CHAFTf6m.lean.js +1 -0
- package/dist/docs/assets/{quickstart.md.CduLGBAB.js → quickstart.md.D8JDfkKO.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_cli.md.BYNIHwbi.js → reference_cli.md.Bt3sAfat.js} +3 -3
- package/dist/docs/assets/{reference_evals.md.if--BLd0.js → reference_evals.md.Ccwp4x3o.js} +3 -3
- package/dist/docs/assets/{reference_evals.md.if--BLd0.lean.js → reference_evals.md.Ccwp4x3o.lean.js} +1 -1
- package/dist/docs/assets/{reference_http-api.md.CrqhTv6S.js → reference_http-api.md.Dji-DD_Z.js} +1 -1
- package/dist/docs/assets/{reference_project-layout.md.C2JMRh7p.js → reference_project-layout.md.SNzIvnmC.js} +1 -1
- package/dist/docs/building-with-agents.html +37 -37
- package/dist/docs/building-with-agents.md +4 -4
- package/dist/docs/deployment.html +37 -37
- package/dist/docs/deployment.md +3 -4
- package/dist/docs/evals.html +36 -36
- package/dist/docs/guides/agent-to-agent.html +36 -36
- package/dist/docs/guides/bitbucket.html +36 -36
- package/dist/docs/guides/cloud-agents.html +36 -36
- package/dist/docs/guides/convert-automation.html +36 -36
- package/dist/docs/guides/github.html +36 -36
- package/dist/docs/guides/gitlab.html +36 -36
- package/dist/docs/guides/grokbot-agents.html +36 -36
- package/dist/docs/guides/hooks.html +36 -36
- package/dist/docs/guides/improve.html +36 -36
- package/dist/docs/guides/jev.html +36 -36
- package/dist/docs/guides/mcp-oauth.html +36 -36
- package/dist/docs/guides/migrate.html +37 -37
- package/dist/docs/guides/migrate.md +3 -3
- package/dist/docs/guides/opentelemetry.html +36 -36
- package/dist/docs/guides/slack.html +36 -36
- package/dist/docs/guides/webhooks.html +36 -36
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +36 -36
- package/dist/docs/index.html +38 -38
- package/dist/docs/index.md +2 -2
- package/dist/docs/llms-full.txt +64 -28
- package/dist/docs/llms.txt +2 -2
- package/dist/docs/quickstart.html +37 -37
- package/dist/docs/quickstart.md +3 -3
- package/dist/docs/reference/agent-config.html +42 -39
- package/dist/docs/reference/agent-config.md +26 -1
- package/dist/docs/reference/artifacts.html +36 -36
- package/dist/docs/reference/channels.html +36 -36
- package/dist/docs/reference/cli.html +39 -39
- package/dist/docs/reference/cli.md +3 -3
- package/dist/docs/reference/connections.html +36 -36
- package/dist/docs/reference/evals.html +38 -38
- package/dist/docs/reference/evals.md +13 -0
- package/dist/docs/reference/extensions.html +36 -36
- package/dist/docs/reference/hooks.html +36 -36
- package/dist/docs/reference/http-api.html +37 -37
- package/dist/docs/reference/http-api.md +4 -4
- package/dist/docs/reference/instructions.html +36 -36
- package/dist/docs/reference/playground.html +36 -36
- package/dist/docs/reference/project-layout.html +37 -37
- package/dist/docs/reference/project-layout.md +2 -3
- package/dist/docs/reference/prompt.html +36 -36
- package/dist/docs/reference/schedules.html +36 -36
- package/dist/docs/reference/sessions.html +36 -36
- package/dist/docs/reference/skills.html +36 -36
- package/dist/docs/reference/subagents.html +36 -36
- package/dist/docs/reference/tools.html +36 -36
- package/dist/docs/templates/agentic-owners.html +36 -36
- package/dist/docs/templates/grokbot-agents.html +36 -36
- package/dist/docs/templates/security-reviewer.html +36 -36
- package/dist/docs/templates/thermo-quality-review.html +36 -36
- package/dist/docs/templates/thermo-review.html +36 -36
- package/dist/docs/templates/triage.html +36 -36
- package/dist/docs/troubleshooting.html +36 -36
- 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 +4 -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/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/deploy-manifest.d.ts +6 -0
- package/dist/internal/deploy-manifest.d.ts.map +1 -1
- package/dist/internal/deploy-manifest.js +3 -0
- 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-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +24 -1
- 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 +48 -14
- 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 -0
- package/dist/internal/peer-connections.d.ts.map +1 -1
- package/dist/internal/peer-connections.js +9 -0
- 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 +38 -14
- 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/session-engine.d.ts +13 -0
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +59 -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-DCsq6f_I.js → index-U3TRnwAP.js} +43 -43
- package/dist/playground/index.html +2 -2
- package/dist/types.d.ts +10 -1
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +4 -4
- package/docs/building-with-agents.md +4 -4
- package/docs/deployment.md +3 -4
- package/docs/guides/migrate.md +3 -3
- package/docs/quickstart.md +3 -3
- package/docs/reference/agent-config.md +26 -1
- package/docs/reference/cli.md +3 -3
- package/docs/reference/evals.md +13 -0
- package/docs/reference/http-api.md +4 -4
- package/docs/reference/project-layout.md +2 -3
- package/package.json +5 -4
- package/schemas/grokbot-answers.schema.json +343 -0
- package/skills/create-agent/SKILL.md +7 -5
- package/templates/agentic-owners/bot/lib/owners/handles.ts +1 -1
- package/templates/agentic-owners/bot/lib/owners/matching.ts +20 -9
- package/dist/docs/assets/chunks/@localSearchIndexroot.BZwvb2LN.js +0 -1
- package/dist/docs/assets/chunks/channel.D7DtboxW.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.irslOV8B.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.irslOV8B.js +0 -1
- package/dist/docs/assets/chunks/clone.DosLeDYL.js +0 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.CAYMmzGj.js +0 -1
- package/dist/docs/assets/index.md.BIBHIQtU.js +0 -27
- package/dist/docs/assets/index.md.BIBHIQtU.lean.js +0 -1
- package/dist/internal/convert-automation/slug.d.ts.map +0 -1
- package/dist/playground/assets/index-BVYWBxLU.css +0 -1
- /package/dist/docs/assets/{building-with-agents.md.Bi9CQ-bR.lean.js → building-with-agents.md.FZXrY8Nk.lean.js} +0 -0
- /package/dist/docs/assets/{deployment.md.hKKN9I4c.lean.js → deployment.md.ajc3VM0m.lean.js} +0 -0
- /package/dist/docs/assets/{guides_migrate.md.sCAvvlC6.lean.js → guides_migrate.md.DZBL7dqT.lean.js} +0 -0
- /package/dist/docs/assets/{quickstart.md.CduLGBAB.lean.js → quickstart.md.D8JDfkKO.lean.js} +0 -0
- /package/dist/docs/assets/{reference_cli.md.BYNIHwbi.lean.js → reference_cli.md.Bt3sAfat.lean.js} +0 -0
- /package/dist/docs/assets/{reference_http-api.md.CrqhTv6S.lean.js → reference_http-api.md.Dji-DD_Z.lean.js} +0 -0
- /package/dist/docs/assets/{reference_project-layout.md.C2JMRh7p.lean.js → reference_project-layout.md.SNzIvnmC.lean.js} +0 -0
|
@@ -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;
|
|
@@ -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;AAsBvC,OAAO,KAAK,EAAE,YAAY,EAAE,M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AAM,CAAC;IACnB;;;;;OAKG;IACH,iBAAiB,CAAC,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,8DAA8D;IAC9D,aAAa,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,wDAAwD;IACxD,YAAY,CAAC,IAAI,YAAY,EAAE,CAAC;IAChC;;;;;OAKG;IACH,eAAe,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C;;;OAGG;IACH,mBAAmB,CAAC,IAAI,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,CAAC;IAClE;;;;OAIG;IACH,mBAAmB,CAAC,IAAI,wBAAwB,CAAC;IACjD;;;OAGG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;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";
|
|
@@ -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));
|
|
@@ -729,10 +740,12 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
729
740
|
// still be running; the marker prevents it from surfacing the
|
|
730
741
|
// previous delivery's terminal record. The store copies are
|
|
731
742
|
// dashboard history, so the turn does not wait on them.
|
|
743
|
+
const endClaim = startHostedSpan("execute.claim", spanAttributes);
|
|
732
744
|
await writeDiag({
|
|
733
745
|
sessionId: "",
|
|
734
746
|
turnStatus: HOSTED_EXECUTION_DIAG_RUNNING_STATUS,
|
|
735
747
|
}, { awaitDurable: false });
|
|
748
|
+
endClaim();
|
|
736
749
|
let sessionId = "";
|
|
737
750
|
const owner = {
|
|
738
751
|
primaryDeliveryId: admitted.deliveryId,
|
|
@@ -753,6 +766,7 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
753
766
|
key: admitted.send.mailboxContinuationKey,
|
|
754
767
|
},
|
|
755
768
|
};
|
|
769
|
+
const endSend = startHostedSpan("execute.send", spanAttributes);
|
|
756
770
|
const session = input.startSend === undefined
|
|
757
771
|
? await args.send(admitted.send.message, options)
|
|
758
772
|
: await input.startSend({
|
|
@@ -761,6 +775,7 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
761
775
|
options,
|
|
762
776
|
sessionPublicId: execution.sessionPublicId,
|
|
763
777
|
});
|
|
778
|
+
endSend();
|
|
764
779
|
sessionId = session.id;
|
|
765
780
|
// The pre-turn claim used an empty sessionId. Stamp the
|
|
766
781
|
// engine id now so a dashboard / session-view poll that
|
|
@@ -1033,6 +1048,14 @@ function hostedFailureForUnfinishedTurn(outcome) {
|
|
|
1033
1048
|
}
|
|
1034
1049
|
return { error: "turn_failed", retry: HOSTED_GUEST_RETRY_TERMINAL };
|
|
1035
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
|
+
}
|
|
1036
1059
|
async function afterHostedWork(flushOtel, work) {
|
|
1037
1060
|
try {
|
|
1038
1061
|
const result = await work();
|
|
@@ -51,6 +51,6 @@ export declare function hostingEntryErrors(declared: {
|
|
|
51
51
|
* grammar plus platform-managed names (`CURSOR_*`, hosted storage).
|
|
52
52
|
*/
|
|
53
53
|
export declare function validateSettableSecretName(name: string): string | undefined;
|
|
54
|
-
/** `owner/name`
|
|
54
|
+
/** `owner/name`, `gitlab.com/<group>/…/<project>`, or `bitbucket.org/<workspace>/<repo>`. Mirrors the backend's deploy repository grammar. */
|
|
55
55
|
export declare function isValidCursorEventRepo(repo: string): boolean;
|
|
56
56
|
//# sourceMappingURL=hosting.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosting.d.ts","sourceRoot":"","sources":["../../src/internal/hosting.ts"],"names":[],"mappings":"AAAA;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K,CAAC;AACrC,kCAAkC;AAClC,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,sCAAsC;AACtC,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAC3C,8BAA8B;AAC9B,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,mEAAmE;AACnE,eAAO,MAAM,2BAA2B,YAAY,CAAC;AACrD,oEAAoE;AACpE,eAAO,MAAM,oBAAoB,MAAM,CAAC;AACxC,sDAAsD;AACtD,eAAO,MAAM,yBAAyB,EAAE,MAA+B,CAAC;AAIxE,gFAAgF;AAChF,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAK3E;AAED;;;GAGG;AACH,eAAO,MAAM,oCAAoC,YAAI,2BAA2B,CAAU,CAAC;AAW3F,4EAA4E;AAC5E,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASvE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQnE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQ1D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE;IAC3C,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACjC,GAAG,MAAM,EAAE,CAmBX;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAS3E;AAQD,8IAA8I;AAC9I,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5D"}
|
package/dist/internal/hosting.js
CHANGED
|
@@ -110,8 +110,12 @@ export function validateSettableSecretName(name) {
|
|
|
110
110
|
}
|
|
111
111
|
return undefined;
|
|
112
112
|
}
|
|
113
|
-
const
|
|
114
|
-
|
|
113
|
+
const CURSOR_EVENT_REPO_PATTERNS = [
|
|
114
|
+
/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,
|
|
115
|
+
/^gitlab\.com\/[a-z0-9_.-]+(?:\/[a-z0-9_.-]+){1,9}$/i,
|
|
116
|
+
/^bitbucket\.org\/[a-z0-9_-]+\/[a-z0-9_.-]+$/i,
|
|
117
|
+
];
|
|
118
|
+
/** `owner/name`, `gitlab.com/<group>/…/<project>`, or `bitbucket.org/<workspace>/<repo>`. Mirrors the backend's deploy repository grammar. */
|
|
115
119
|
export function isValidCursorEventRepo(repo) {
|
|
116
|
-
return
|
|
120
|
+
return CURSOR_EVENT_REPO_PATTERNS.some((pattern) => pattern.test(repo)) && !repo.includes("..");
|
|
117
121
|
}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* Template `init.json`: questions `init` asks, and string replacements
|
|
3
3
|
* it applies while copying the scaffold.
|
|
4
4
|
*/
|
|
5
|
+
import { type InterviewQuestion } from "./interview/question.js";
|
|
5
6
|
export declare const TEMPLATE_INIT_FILE = "init.json";
|
|
7
|
+
/** The JSON-authorable subset of {@link InterviewQuestion}. */
|
|
6
8
|
export interface TemplateQuestion {
|
|
7
9
|
id: string;
|
|
8
10
|
prompt: string;
|
|
@@ -54,13 +56,9 @@ export interface CollectAnswersInput {
|
|
|
54
56
|
spec: TemplateInitSpec;
|
|
55
57
|
vars?: Record<string, string>;
|
|
56
58
|
interactive: boolean;
|
|
57
|
-
ask?: (question:
|
|
59
|
+
ask?: (question: InterviewQuestion) => Promise<string>;
|
|
58
60
|
out?: (text: string) => void;
|
|
59
61
|
}
|
|
60
62
|
export declare function collectTemplateAnswers(input: CollectAnswersInput): Promise<ParseAnswersResult>;
|
|
61
63
|
export declare function applyInitReplacements(contents: string, rel: string, spec: TemplateInitSpec, answers: Record<string, string>): string;
|
|
62
|
-
export declare function promptTemplateQuestion(question: TemplateQuestion, options?: {
|
|
63
|
-
input?: NodeJS.ReadableStream;
|
|
64
|
-
output?: NodeJS.WritableStream;
|
|
65
|
-
}): Promise<string>;
|
|
66
64
|
//# sourceMappingURL=init-interview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-interview.d.ts","sourceRoot":"","sources":["../../src/internal/init-interview.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"init-interview.d.ts","sourceRoot":"","sources":["../../src/internal/init-interview.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGjF,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAE9C,+DAA+D;AAC/D,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,iBAAiB,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOvD;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,g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AM,CAAC,CAAC;IACvD,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAOD,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,kBAAkB,CAAC,CAY7B;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,MAAM,CAiBR"}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { readFile } from "node:fs/promises";
|
|
6
6
|
import { join } from "node:path";
|
|
7
|
-
import { createInterface } from "node:readline";
|
|
8
7
|
import { parseCursorGithubRepoScope } from "../channels/github/cursor-account.js";
|
|
9
8
|
import { describeError } from "./describe-error.js";
|
|
9
|
+
import { collectAnswers } from "./interview/question.js";
|
|
10
10
|
import { isRecord } from "./is-record.js";
|
|
11
11
|
export const TEMPLATE_INIT_FILE = "init.json";
|
|
12
12
|
export function posixRel(rel) {
|
|
@@ -81,40 +81,21 @@ export async function runTemplateInit(input) {
|
|
|
81
81
|
return { ok: false, error: describeError(error) };
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
+
const PARSERS = {
|
|
85
|
+
"owner-repo-list": (value) => parseCursorGithubRepoScope(value.split(",").map((repo) => repo.trim())).repos.join(", "),
|
|
86
|
+
};
|
|
84
87
|
export async function collectTemplateAnswers(input) {
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
error: `${question.id} is required: pass --var ${question.id}=... (${question.prompt})`,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
const parsed = parseQuestionValue(question, raw);
|
|
100
|
-
if (!parsed.ok) {
|
|
101
|
-
return parsed;
|
|
102
|
-
}
|
|
103
|
-
answers[question.id] = parsed.value;
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
for (;;) {
|
|
107
|
-
const line = await ask(question);
|
|
108
|
-
const value = line.trim() === "" && question.default !== undefined ? question.default : line;
|
|
109
|
-
const parsed = parseQuestionValue(question, value);
|
|
110
|
-
if (parsed.ok) {
|
|
111
|
-
answers[question.id] = parsed.value;
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
out(`${parsed.error}\n`);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return { ok: true, answers };
|
|
88
|
+
const collected = await collectAnswers({
|
|
89
|
+
questions: input.spec.questions.map((question) => ({
|
|
90
|
+
...question,
|
|
91
|
+
parse: question.parse === undefined ? undefined : PARSERS[question.parse],
|
|
92
|
+
})),
|
|
93
|
+
given: input.vars,
|
|
94
|
+
interactive: input.interactive,
|
|
95
|
+
ask: input.ask,
|
|
96
|
+
out: input.out,
|
|
97
|
+
});
|
|
98
|
+
return collected.ok ? { ok: true, answers: collected.answers } : collected;
|
|
118
99
|
}
|
|
119
100
|
export function applyInitReplacements(contents, rel, spec, answers) {
|
|
120
101
|
const file = posixRel(rel);
|
|
@@ -134,63 +115,9 @@ export function applyInitReplacements(contents, rel, spec, answers) {
|
|
|
134
115
|
}
|
|
135
116
|
return next;
|
|
136
117
|
}
|
|
137
|
-
export async function promptTemplateQuestion(question, options = {}) {
|
|
138
|
-
const input = options.input ?? process.stdin;
|
|
139
|
-
const output = options.output ?? process.stdout;
|
|
140
|
-
const rl = createInterface({ input, output });
|
|
141
|
-
const suffix = promptSuffix(question);
|
|
142
|
-
try {
|
|
143
|
-
if (question.hint !== undefined) {
|
|
144
|
-
output.write(` ${question.hint}\n`);
|
|
145
|
-
}
|
|
146
|
-
return await new Promise((resolve) => {
|
|
147
|
-
rl.question(`${question.prompt}${suffix} `, resolve);
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
finally {
|
|
151
|
-
rl.close();
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
118
|
function replaceLiteral(haystack, find, value) {
|
|
155
119
|
return haystack.replaceAll(find, () => value);
|
|
156
120
|
}
|
|
157
|
-
function promptSuffix(question) {
|
|
158
|
-
if (question.choices !== undefined && question.choices.length > 0) {
|
|
159
|
-
return ` [${question.choices.join("/")}]`;
|
|
160
|
-
}
|
|
161
|
-
if (question.default !== undefined) {
|
|
162
|
-
return ` [${question.default}]`;
|
|
163
|
-
}
|
|
164
|
-
if (question.placeholder !== undefined) {
|
|
165
|
-
return ` (${question.placeholder})`;
|
|
166
|
-
}
|
|
167
|
-
return "";
|
|
168
|
-
}
|
|
169
|
-
function parseQuestionValue(question, raw) {
|
|
170
|
-
const trimmed = raw.trim();
|
|
171
|
-
if (trimmed === "") {
|
|
172
|
-
return { ok: false, error: `${question.id} is required.` };
|
|
173
|
-
}
|
|
174
|
-
if (question.choices !== undefined && question.choices.length > 0) {
|
|
175
|
-
if (!question.choices.includes(trimmed)) {
|
|
176
|
-
return {
|
|
177
|
-
ok: false,
|
|
178
|
-
error: `${question.id} must be one of ${question.choices.join(", ")}.`,
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
return { ok: true, value: trimmed };
|
|
182
|
-
}
|
|
183
|
-
if (question.parse === "owner-repo-list") {
|
|
184
|
-
try {
|
|
185
|
-
const scope = parseCursorGithubRepoScope(trimmed.split(",").map((repo) => repo.trim()));
|
|
186
|
-
return { ok: true, value: scope.repos.join(", ") };
|
|
187
|
-
}
|
|
188
|
-
catch (error) {
|
|
189
|
-
return { ok: false, error: describeError(error) };
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return { ok: true, value: trimmed };
|
|
193
|
-
}
|
|
194
121
|
function formatReplaceValue(rule, answers) {
|
|
195
122
|
const raw = answers[rule.answer];
|
|
196
123
|
if (raw === undefined || raw === "") {
|