@cursor/bdk 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/agent-serve.js +9 -1
- package/dist/channels/slack/attachments.d.ts +2 -1
- package/dist/channels/slack/attachments.d.ts.map +1 -1
- package/dist/channels/slack/attachments.js +19 -9
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +26 -24
- package/dist/channels/slack/thread-context.d.ts +21 -11
- package/dist/channels/slack/thread-context.d.ts.map +1 -1
- package/dist/channels/slack/thread-context.js +75 -27
- package/dist/docs/404.html +2 -2
- package/dist/docs/assets/{app.BOIHhrKi.js → app.4kQ8Db_q.js} +4 -4
- package/dist/docs/assets/chunks/@localSearchIndexroot.CvuAJ0My.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.D49zVZqM.js → VPLocalSearchBox.DY1RwB8Q.js} +1 -1
- package/dist/docs/assets/chunks/{arc.hmjb-sc4.js → arc.CxE_fSPK.js} +1 -1
- package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.CxEI1KqM.js → architectureDiagram-Q4EWVU46.CPX426ui.js} +1 -1
- package/dist/docs/assets/chunks/{baseUniq.DHHvBWoV.js → baseUniq.CB52JrKG.js} +1 -1
- package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.DnXW-3bu.js → blockDiagram-DXYQGD6D.J0cNaQCL.js} +1 -1
- package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.e-47O2jM.js → c4Diagram-AHTNJAMY.DJn3vEGT.js} +1 -1
- package/dist/docs/assets/chunks/channel.BoNycAoN.js +1 -0
- package/dist/docs/assets/chunks/{chunk-4BX2VUAB.3ry4pYXB.js → chunk-4BX2VUAB.Dao618F6.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-4TB4RGXK.DGIZFRx6.js → chunk-4TB4RGXK.QW8Rhjai.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-55IACEB6.DKBnqg9U.js → chunk-55IACEB6.DfRLLKF_.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-EDXVE4YY.BIU8Ue5k.js → chunk-EDXVE4YY.CIV2ApKQ.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-FMBD7UC4.DP-TFhjI.js → chunk-FMBD7UC4.BEheSuxp.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-OYMX7WX6.Ux0OYj5v.js → chunk-OYMX7WX6.CUN88ENB.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-QZHKN3VN.BzHMwYox.js → chunk-QZHKN3VN.CgqCs8b_.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-YZCP3GAM.D4OGAsSP.js → chunk-YZCP3GAM.iCH0nnTJ.js} +1 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.C4x07Gkj.js +1 -0
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.C4x07Gkj.js +1 -0
- package/dist/docs/assets/chunks/clone.Db22cH_-.js +1 -0
- package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.Jq_7BUNx.js → cose-bilkent-S5V4N54A.BLcUxhWE.js} +1 -1
- package/dist/docs/assets/chunks/{dagre-KV5264BT.Di-skR2x.js → dagre-KV5264BT.Ep7LofOm.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-5BDNPKRD.DeREHIdH.js → diagram-5BDNPKRD.Bzf4GSQ4.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.C7Kcqxro.js → diagram-G4DWMVQ6.DD6Jh-eM.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-MMDJMWI5.BK3eohyo.js → diagram-MMDJMWI5.oOIl8bWd.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-TYMM5635.C6TyymXT.js → diagram-TYMM5635.DHs85Ade.js} +1 -1
- package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.DYGG-gGx.js → erDiagram-SMLLAGMA.BIb5ghCk.js} +1 -1
- package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.C9nBcSV4.js → flowDiagram-DWJPFMVM.DV4paY9k.js} +1 -1
- package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.wAg_ymsp.js → ganttDiagram-T4ZO3ILL.AyEKA6_v.js} +1 -1
- package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.B87j9Oeg.js → gitGraphDiagram-UUTBAWPF.BltiCDFo.js} +1 -1
- package/dist/docs/assets/chunks/{graph.CuFMj31w.js → graph.DzuEYGdC.js} +1 -1
- package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.P_mLGumP.js → infoDiagram-42DDH7IO.BV2l981J.js} +1 -1
- package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.DyuL_MsT.js → ishikawaDiagram-UXIWVN3A.BA4Izf-m.js} +1 -1
- package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.CtP09IoJ.js → journeyDiagram-VCZTEJTY.DjaFbFS3.js} +1 -1
- package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.BoeSYPZo.js → kanban-definition-6JOO6SKY.CfTFieDs.js} +1 -1
- package/dist/docs/assets/chunks/{layout.B0lMMtNo.js → layout.DzfWqTBV.js} +1 -1
- package/dist/docs/assets/chunks/{linear.HxRBiAFX.js → linear.BO6mpulV.js} +1 -1
- package/dist/docs/assets/chunks/{min.BGlFFHwS.js → min.BGgTadgT.js} +1 -1
- package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.JyLBD9M8.js → mindmap-definition-QFDTVHPH.DPuIXVWY.js} +1 -1
- package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.DnSmNZF8.js → pieDiagram-DEJITSTG.BOnl3bBg.js} +1 -1
- package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.CUCnbfCa.js → quadrantDiagram-34T5L4WZ.DNB6Ckdc.js} +1 -1
- package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.py0IVUn5.js → requirementDiagram-MS252O5E.D5-Qo7vb.js} +1 -1
- package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.Bkc-HWYp.js → sankeyDiagram-XADWPNL6.8t65cesf.js} +1 -1
- package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.Dqn8Mlv2.js → sequenceDiagram-FGHM5R23.CaG07BdS.js} +1 -1
- package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.JikkoQUU.js → stateDiagram-FHFEXIEX.TKOweTB6.js} +1 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.CuqmyQc4.js +1 -0
- package/dist/docs/assets/chunks/{theme.b6HQ6zG_.js → theme.Dx-JhpTB.js} +2 -2
- package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.BvpSXiBj.js → timeline-definition-GMOUNBTQ.fE53zQ2s.js} +1 -1
- package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.CU7MVnZx.js → vennDiagram-DHZGUBPP.DJsZZaJg.js} +1 -1
- package/dist/docs/assets/chunks/{wardley-RL74JXVD.BKwC4ctG.js → wardley-RL74JXVD.844kyrjl.js} +1 -1
- package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.BfaF6Uhe.js → wardleyDiagram-NUSXRM2D.CMZ-Ru_t.js} +1 -1
- package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.Bg5dcpj4.js → xychartDiagram-5P7HB3ND.XXrhBc7a.js} +1 -1
- package/dist/docs/assets/{deployment.md.BJ8i7Q6p.js → deployment.md.UhnJIMr-.js} +2 -2
- package/dist/docs/assets/{deployment.md.BJ8i7Q6p.lean.js → deployment.md.UhnJIMr-.lean.js} +1 -1
- package/dist/docs/assets/{guides_jev.md.BNDm14Gy.js → guides_jev.md.CRcgmjDb.js} +2 -2
- package/dist/docs/assets/{guides_jev.md.BNDm14Gy.lean.js → guides_jev.md.CRcgmjDb.lean.js} +1 -1
- package/dist/docs/assets/{reference_agent-config.md.DzGI777n.js → reference_agent-config.md.Cj5uBKp4.js} +1 -1
- package/dist/docs/assets/{reference_extensions.md.CPPrkWlJ.js → reference_extensions.md.pa2tN-e4.js} +4 -3
- package/dist/docs/assets/{reference_extensions.md.CPPrkWlJ.lean.js → reference_extensions.md.pa2tN-e4.lean.js} +1 -1
- package/dist/docs/building-with-agents.html +35 -35
- package/dist/docs/deployment.html +37 -37
- package/dist/docs/deployment.md +4 -1
- package/dist/docs/evals.html +35 -35
- 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 +35 -35
- 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 +35 -35
- package/dist/docs/guides/hooks.html +35 -35
- package/dist/docs/guides/improve.html +35 -35
- package/dist/docs/guides/jev.html +37 -37
- package/dist/docs/guides/jev.md +7 -0
- package/dist/docs/guides/mcp-oauth.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 +35 -35
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +35 -35
- package/dist/docs/index.html +35 -35
- package/dist/docs/llms-full.txt +25 -2
- package/dist/docs/quickstart.html +35 -35
- package/dist/docs/reference/agent-config.html +37 -37
- package/dist/docs/reference/agent-config.md +1 -1
- package/dist/docs/reference/artifacts.html +35 -35
- package/dist/docs/reference/channels.html +35 -35
- package/dist/docs/reference/cli.html +35 -35
- package/dist/docs/reference/connections.html +35 -35
- package/dist/docs/reference/evals.html +35 -35
- package/dist/docs/reference/extensions.html +39 -38
- package/dist/docs/reference/extensions.md +13 -0
- package/dist/docs/reference/hooks.html +35 -35
- package/dist/docs/reference/http-api.html +35 -35
- package/dist/docs/reference/instructions.html +35 -35
- package/dist/docs/reference/playground.html +35 -35
- package/dist/docs/reference/project-layout.html +35 -35
- package/dist/docs/reference/prompt.html +35 -35
- package/dist/docs/reference/schedules.html +35 -35
- package/dist/docs/reference/sessions.html +35 -35
- package/dist/docs/reference/skills.html +35 -35
- package/dist/docs/reference/subagents.html +35 -35
- package/dist/docs/reference/tools.html +35 -35
- package/dist/docs/templates/agentic-owners.html +35 -35
- 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 +35 -35
- package/dist/extensions/jev/extension.d.ts +3 -0
- package/dist/extensions/jev/extension.d.ts.map +1 -1
- package/dist/extensions/jev/extension.js +10 -1
- package/dist/extensions/jev/lib/evaluate.d.ts +4 -0
- package/dist/extensions/jev/lib/evaluate.d.ts.map +1 -1
- package/dist/extensions/jev/lib/evaluate.js +6 -2
- package/dist/extensions.d.ts +4 -2
- package/dist/extensions.d.ts.map +1 -1
- package/dist/extensions.js +5 -2
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +19 -5
- package/dist/internal/discovery/agent-config.d.ts +6 -5
- package/dist/internal/discovery/agent-config.d.ts.map +1 -1
- package/dist/internal/discovery/agent-config.js +29 -28
- package/dist/internal/discovery/agent.js +1 -1
- package/dist/internal/discovery/extensions.d.ts.map +1 -1
- package/dist/internal/discovery/extensions.js +12 -0
- package/dist/internal/hosting.d.ts +8 -0
- package/dist/internal/hosting.d.ts.map +1 -1
- package/dist/internal/hosting.js +24 -0
- package/dist/types.d.ts +18 -2
- package/dist/types.d.ts.map +1 -1
- package/docs/deployment.md +4 -1
- package/docs/guides/jev.md +7 -0
- package/docs/reference/agent-config.md +1 -1
- package/docs/reference/extensions.md +13 -0
- package/package.json +1 -9
- package/dist/docs/assets/chunks/@localSearchIndexroot.D5L-b34G.js +0 -1
- package/dist/docs/assets/chunks/channel.BbOGaJQP.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.Db58HCb1.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.Db58HCb1.js +0 -1
- package/dist/docs/assets/chunks/clone.Co4MBflG.js +0 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.CMsKhrW0.js +0 -1
- package/src/artifacts.ts +0 -68
- package/src/bin/agent-serve.ts +0 -1854
- package/src/channels/bitbucket/api.ts +0 -891
- package/src/channels/bitbucket/binding.ts +0 -417
- package/src/channels/bitbucket/bitbucket-channel.ts +0 -162
- package/src/channels/bitbucket/bitbucket-webhook.ts +0 -519
- package/src/channels/bitbucket/checks.ts +0 -146
- package/src/channels/bitbucket/cursor-account.ts +0 -106
- package/src/channels/bitbucket/defaults.ts +0 -100
- package/src/channels/bitbucket/events.ts +0 -74
- package/src/channels/bitbucket/index.ts +0 -51
- package/src/channels/bitbucket/replay.ts +0 -421
- package/src/channels/bitbucket/state.ts +0 -59
- package/src/channels/bitbucket/types.ts +0 -261
- package/src/channels/change-monitors/change-monitors-channel.ts +0 -63
- package/src/channels/change-monitors/index.ts +0 -8
- package/src/channels/change-monitors/types.ts +0 -42
- package/src/channels/checks.ts +0 -185
- package/src/channels/deployments/deployments-channel.ts +0 -224
- package/src/channels/deployments/index.ts +0 -25
- package/src/channels/deployments/types.ts +0 -92
- package/src/channels/github/api.ts +0 -526
- package/src/channels/github/auth.ts +0 -293
- package/src/channels/github/binding.ts +0 -233
- package/src/channels/github/checks.ts +0 -145
- package/src/channels/github/cursor-account.ts +0 -303
- package/src/channels/github/defaults.ts +0 -168
- package/src/channels/github/events.ts +0 -67
- package/src/channels/github/forward.ts +0 -359
- package/src/channels/github/github-channel.ts +0 -2334
- package/src/channels/github/index.ts +0 -54
- package/src/channels/github/progress.ts +0 -365
- package/src/channels/github/replay.ts +0 -372
- package/src/channels/github/state.ts +0 -124
- package/src/channels/github/types.ts +0 -590
- package/src/channels/gitlab/api.ts +0 -329
- package/src/channels/gitlab/binding.ts +0 -231
- package/src/channels/gitlab/checks.ts +0 -228
- package/src/channels/gitlab/cursor-account.ts +0 -105
- package/src/channels/gitlab/defaults.ts +0 -80
- package/src/channels/gitlab/events.ts +0 -37
- package/src/channels/gitlab/gitlab-channel.ts +0 -160
- package/src/channels/gitlab/gitlab-webhook.ts +0 -509
- package/src/channels/gitlab/index.ts +0 -44
- package/src/channels/gitlab/replay.ts +0 -328
- package/src/channels/gitlab/state.ts +0 -55
- package/src/channels/gitlab/types.ts +0 -247
- package/src/channels/issues/index.ts +0 -9
- package/src/channels/issues/issues-channel.ts +0 -45
- package/src/channels/issues/types.ts +0 -38
- package/src/channels/origin/api.ts +0 -507
- package/src/channels/origin/binding.ts +0 -114
- package/src/channels/origin/checks.ts +0 -250
- package/src/channels/origin/cursor-account.ts +0 -58
- package/src/channels/origin/defaults.ts +0 -140
- package/src/channels/origin/events.ts +0 -35
- package/src/channels/origin/index.ts +0 -35
- package/src/channels/origin/origin-channel.ts +0 -815
- package/src/channels/origin/origin-webhook.ts +0 -296
- package/src/channels/origin/reactions.ts +0 -72
- package/src/channels/origin/state.ts +0 -54
- package/src/channels/origin/types.ts +0 -295
- package/src/channels/slack/agentic-delivery.ts +0 -634
- package/src/channels/slack/agentic-posted.ts +0 -135
- package/src/channels/slack/agentic-signals.ts +0 -231
- package/src/channels/slack/api.ts +0 -761
- package/src/channels/slack/approvals.ts +0 -279
- package/src/channels/slack/assistant.ts +0 -76
- package/src/channels/slack/attachments.ts +0 -596
- package/src/channels/slack/auth.ts +0 -127
- package/src/channels/slack/blocks.ts +0 -131
- package/src/channels/slack/bot-mentions.ts +0 -318
- package/src/channels/slack/channel-watch.ts +0 -314
- package/src/channels/slack/cli-project.ts +0 -249
- package/src/channels/slack/code-fences.ts +0 -171
- package/src/channels/slack/constants.ts +0 -38
- package/src/channels/slack/credentials.ts +0 -88
- package/src/channels/slack/defaults.ts +0 -714
- package/src/channels/slack/dispatch.ts +0 -1060
- package/src/channels/slack/doctor.ts +0 -338
- package/src/channels/slack/eval-directive.ts +0 -306
- package/src/channels/slack/event-id-dedupe.ts +0 -30
- package/src/channels/slack/external-policy.ts +0 -75
- package/src/channels/slack/footer.ts +0 -106
- package/src/channels/slack/inbound.ts +0 -416
- package/src/channels/slack/index.ts +0 -53
- package/src/channels/slack/init.ts +0 -169
- package/src/channels/slack/interactive.ts +0 -406
- package/src/channels/slack/links.ts +0 -23
- package/src/channels/slack/live-delivery.ts +0 -489
- package/src/channels/slack/log.ts +0 -70
- package/src/channels/slack/manifest.ts +0 -240
- package/src/channels/slack/message-body.ts +0 -82
- package/src/channels/slack/nudge-carrier.ts +0 -224
- package/src/channels/slack/nudge-store.ts +0 -334
- package/src/channels/slack/paint-start.ts +0 -93
- package/src/channels/slack/placeholder.ts +0 -358
- package/src/channels/slack/pr-ref.ts +0 -74
- package/src/channels/slack/progress-delivery.ts +0 -138
- package/src/channels/slack/reasoning-card.ts +0 -125
- package/src/channels/slack/reasoning-chip.ts +0 -41
- package/src/channels/slack/recording-sink.ts +0 -167
- package/src/channels/slack/redact.ts +0 -6
- package/src/channels/slack/reply-options.ts +0 -279
- package/src/channels/slack/setup.ts +0 -125
- package/src/channels/slack/slack-channel.ts +0 -744
- package/src/channels/slack/socket-mode.ts +0 -140
- package/src/channels/slack/stop.ts +0 -25
- package/src/channels/slack/stream.ts +0 -66
- package/src/channels/slack/thread-context.ts +0 -485
- package/src/channels/slack/tool-approval-events.ts +0 -233
- package/src/channels/slack/tool-cards.ts +0 -198
- package/src/channels/slack/tool-chip.ts +0 -34
- package/src/channels/slack/types.ts +0 -787
- package/src/channels/slack/upload.ts +0 -137
- package/src/channels.ts +0 -543
- package/src/connections.ts +0 -153
- package/src/dashboard-session-url.ts +0 -30
- package/src/evals/assertions.ts +0 -688
- package/src/evals/expect.ts +0 -250
- package/src/evals/judge.ts +0 -329
- package/src/evals/loaders.ts +0 -111
- package/src/evals/matchers.ts +0 -223
- package/src/evals/reporters.ts +0 -257
- package/src/evals/results.ts +0 -130
- package/src/evals/run-facts.ts +0 -306
- package/src/evals.ts +0 -709
- package/src/extensions/cursor-cloud-agents/extension.ts +0 -131
- package/src/extensions/cursor-cloud-agents/lib/backend.ts +0 -386
- package/src/extensions/cursor-cloud-agents/lib/channels.ts +0 -11
- package/src/extensions/cursor-cloud-agents/lib/fleet.ts +0 -98
- package/src/extensions/cursor-cloud-agents/lib/inputs.ts +0 -5
- package/src/extensions/cursor-cloud-agents/lib/repos.ts +0 -80
- package/src/extensions/cursor-cloud-agents/lib/transcript.ts +0 -19
- package/src/extensions/cursor-cloud-agents/skills/handoff.md +0 -37
- package/src/extensions/cursor-cloud-agents/tools/cancel.ts +0 -21
- package/src/extensions/cursor-cloud-agents/tools/dump.ts +0 -47
- package/src/extensions/cursor-cloud-agents/tools/get.ts +0 -18
- package/src/extensions/cursor-cloud-agents/tools/launch.ts +0 -62
- package/src/extensions/cursor-cloud-agents/tools/list.ts +0 -31
- package/src/extensions/cursor-cloud-agents/tools/reply.ts +0 -36
- package/src/extensions/cursor-grokbot-agents/extension.ts +0 -132
- package/src/extensions/cursor-grokbot-agents/lib/agents.ts +0 -42
- package/src/extensions/cursor-grokbot-agents/lib/backend.ts +0 -208
- package/src/extensions/cursor-grokbot-agents/lib/contacts.ts +0 -74
- package/src/extensions/cursor-grokbot-agents/lib/conversation.ts +0 -260
- package/src/extensions/cursor-grokbot-agents/lib/inputs.ts +0 -21
- package/src/extensions/cursor-grokbot-agents/lib/lock.ts +0 -26
- package/src/extensions/cursor-grokbot-agents/skills/consult.md +0 -40
- package/src/extensions/cursor-grokbot-agents/tools/ask.ts +0 -32
- package/src/extensions/cursor-grokbot-agents/tools/check.ts +0 -25
- package/src/extensions/cursor-grokbot-agents/tools/interrupt.ts +0 -17
- package/src/extensions/cursor-grokbot-agents/tools/list.ts +0 -26
- package/src/extensions/improve/extension.ts +0 -69
- package/src/extensions/improve/skills/yourself.ts +0 -50
- package/src/extensions/jev/extension.ts +0 -95
- package/src/extensions/jev/lib/evaluate.ts +0 -266
- package/src/extensions/jev/skills/gated-write.md +0 -25
- package/src/extensions/jev/skills/questions.md +0 -33
- package/src/extensions/jev/tools/evaluate.ts +0 -82
- package/src/extensions/slack-communication/evals/harness.ts +0 -705
- package/src/extensions/slack-communication/evals/slack-communication.eval.ts +0 -830
- package/src/extensions/slack-communication/evals/slack-placeholder.eval.ts +0 -172
- package/src/extensions/slack-communication/extension.ts +0 -44
- package/src/extensions/slack-communication/skills/slack-voice.ts +0 -56
- package/src/extensions/slack-communication/tools/delete-message.ts +0 -33
- package/src/extensions/slack-communication/tools/edit-message.ts +0 -42
- package/src/extensions/slack-communication/tools/post-card.ts +0 -28
- package/src/extensions/slack-communication/tools/post-file.ts +0 -82
- package/src/extensions/slack-communication/tools/post-update.ts +0 -40
- package/src/extensions/slack-communication/tools/react.ts +0 -30
- package/src/extensions/slack-communication/tools/set-status.ts +0 -21
- package/src/extensions.ts +0 -179
- package/src/files-backends/agent-store-presigned-url.ts +0 -11
- package/src/files-backends/cursor-hosted.ts +0 -1212
- package/src/files-backends/local-fs.ts +0 -163
- package/src/files.ts +0 -293
- package/src/filesystem.ts +0 -2005
- package/src/hooks.ts +0 -30
- package/src/index.ts +0 -259
- package/src/internal/advertise-tools.ts +0 -370
- package/src/internal/approval-gate.ts +0 -103
- package/src/internal/artifacts-store.ts +0 -836
- package/src/internal/as-of.ts +0 -257
- package/src/internal/auth.ts +0 -46
- package/src/internal/authored-alias-hooks.ts +0 -138
- package/src/internal/authored-loaders.ts +0 -188
- package/src/internal/bounded-int.ts +0 -24
- package/src/internal/bounded.ts +0 -25
- package/src/internal/brand.ts +0 -28
- package/src/internal/browser-origin-guard.ts +0 -67
- package/src/internal/builtin-tools/artifacts.ts +0 -62
- package/src/internal/builtin-tools/index.ts +0 -53
- package/src/internal/builtin-tools/reminders.ts +0 -145
- package/src/internal/channel-dispatch.ts +0 -129
- package/src/internal/channel-route-dispatch.ts +0 -58
- package/src/internal/channel-state.ts +0 -83
- package/src/internal/chat-client.ts +0 -594
- package/src/internal/cli-ax.ts +0 -2318
- package/src/internal/cli-bitbucket.ts +0 -438
- package/src/internal/cli-convert-automation.ts +0 -335
- package/src/internal/cli-cursor.ts +0 -282
- package/src/internal/cli-deploy.ts +0 -2519
- package/src/internal/cli-docs.ts +0 -192
- package/src/internal/cli-github.ts +0 -806
- package/src/internal/cli-gitlab.ts +0 -452
- package/src/internal/cli-images.ts +0 -672
- package/src/internal/cli-manifest.ts +0 -56
- package/src/internal/cli-mcp-oauth.ts +0 -396
- package/src/internal/cli-mcp.ts +0 -808
- package/src/internal/cli-skills.ts +0 -98
- package/src/internal/cli-slack-manual.ts +0 -418
- package/src/internal/cli-slack.ts +0 -874
- package/src/internal/cloud-merge.ts +0 -51
- package/src/internal/cloud-turn-cost.ts +0 -159
- package/src/internal/connection-env.ts +0 -106
- package/src/internal/continuation-channel.ts +0 -233
- package/src/internal/continuation-identity.ts +0 -935
- package/src/internal/conversation-mirror.ts +0 -423
- package/src/internal/convert-automation/convert-workflow.ts +0 -1377
- package/src/internal/convert-automation/slug.ts +0 -29
- package/src/internal/convert-automation/types.ts +0 -212
- package/src/internal/cron.ts +0 -76
- package/src/internal/cursor/account-mcp.ts +0 -692
- package/src/internal/cursor/backend-client.ts +0 -984
- package/src/internal/cursor/bound-secret-file.ts +0 -101
- package/src/internal/cursor/credentials.ts +0 -560
- package/src/internal/cursor/cursor-api-transport.ts +0 -65
- package/src/internal/cursor/github-credentials.ts +0 -228
- package/src/internal/cursor/hosted-bound-secrets.ts +0 -71
- package/src/internal/cursor/hosted-deployment-secrets.ts +0 -100
- package/src/internal/cursor/hosted-store-secrets.ts +0 -152
- package/src/internal/cursor/session-token.ts +0 -111
- package/src/internal/cursor/store-api-client.ts +0 -323
- package/src/internal/cursor-account-mcp-auth.ts +0 -303
- package/src/internal/cursor-agent-template.ts +0 -50
- package/src/internal/cursor-deployment-relay.ts +0 -315
- package/src/internal/cursor-event-relay.ts +0 -675
- package/src/internal/cursor-relay-core.ts +0 -563
- package/src/internal/deferred-channel-session.ts +0 -61
- package/src/internal/deploy-client.ts +0 -1574
- package/src/internal/deploy-manifest.ts +0 -361
- package/src/internal/deploy-source.ts +0 -144
- package/src/internal/describe-error.ts +0 -32
- package/src/internal/dev-mode.ts +0 -20
- package/src/internal/discovery/agent-config.ts +0 -288
- package/src/internal/discovery/agent.ts +0 -381
- package/src/internal/discovery/channels.ts +0 -100
- package/src/internal/discovery/connections.ts +0 -516
- package/src/internal/discovery/context.ts +0 -38
- package/src/internal/discovery/cursor-plugin.ts +0 -628
- package/src/internal/discovery/extension-overlay.ts +0 -247
- package/src/internal/discovery/extensions.ts +0 -490
- package/src/internal/discovery/fs.ts +0 -103
- package/src/internal/discovery/hooks.ts +0 -63
- package/src/internal/discovery/info.ts +0 -174
- package/src/internal/discovery/instructions.ts +0 -98
- package/src/internal/discovery/modules.ts +0 -107
- package/src/internal/discovery/names.ts +0 -45
- package/src/internal/discovery/project.ts +0 -319
- package/src/internal/discovery/reminders.ts +0 -65
- package/src/internal/discovery/runtime.ts +0 -158
- package/src/internal/discovery/schedules.ts +0 -120
- package/src/internal/discovery/seed-files.ts +0 -34
- package/src/internal/discovery/services.ts +0 -151
- package/src/internal/discovery/skills.ts +0 -174
- package/src/internal/discovery/subagent.ts +0 -138
- package/src/internal/discovery/tools.ts +0 -170
- package/src/internal/discovery.ts +0 -27
- package/src/internal/distribution.ts +0 -126
- package/src/internal/docs-site.ts +0 -248
- package/src/internal/duration.ts +0 -37
- package/src/internal/env-file.ts +0 -83
- package/src/internal/eval-judge-model.ts +0 -142
- package/src/internal/eval-run-store.ts +0 -585
- package/src/internal/eval-runner.ts +0 -823
- package/src/internal/evals-client.ts +0 -475
- package/src/internal/event-log.ts +0 -342
- package/src/internal/event-mapper.ts +0 -811
- package/src/internal/expected-delivery-failure.ts +0 -34
- package/src/internal/factory-resource-channel.ts +0 -103
- package/src/internal/filesystem/errors.ts +0 -207
- package/src/internal/filesystem/format.ts +0 -253
- package/src/internal/filesystem/merge.ts +0 -192
- package/src/internal/filesystem/nearest.ts +0 -112
- package/src/internal/filesystem/scratch.ts +0 -239
- package/src/internal/filesystem/sdk-schemas.ts +0 -204
- package/src/internal/filesystem/tools.ts +0 -804
- package/src/internal/filesystem/walk.ts +0 -366
- package/src/internal/fixtures/units-server.ts +0 -52
- package/src/internal/framework-file-storage.ts +0 -357
- package/src/internal/framework-storage-selection.ts +0 -156
- package/src/internal/frontmatter.ts +0 -108
- package/src/internal/github-fanout.ts +0 -144
- package/src/internal/guest-network.ts +0 -391
- package/src/internal/handleAgentServeTrigger.ts +0 -286
- package/src/internal/host-files.ts +0 -341
- package/src/internal/host-kv.ts +0 -81
- package/src/internal/host-otel.ts +0 -231
- package/src/internal/host-platforms.ts +0 -170
- package/src/internal/hosted-admission-adapter.ts +0 -47
- package/src/internal/hosted-admission-context.ts +0 -37
- package/src/internal/hosted-catch-protocol.ts +0 -112
- package/src/internal/hosted-catch.ts +0 -179
- package/src/internal/hosted-delivery-protocol.ts +0 -824
- package/src/internal/hosted-delivery.ts +0 -1410
- package/src/internal/hosted-execution-diag.ts +0 -291
- package/src/internal/hosted-execution-flush.ts +0 -136
- package/src/internal/hosted-execution-latency.ts +0 -301
- package/src/internal/hosted-managed-automation.ts +0 -116
- package/src/internal/hosting.ts +0 -114
- package/src/internal/http-channel-define.ts +0 -25
- package/src/internal/http-channel.ts +0 -669
- package/src/internal/http-control-plane-session.ts +0 -110
- package/src/internal/ids.ts +0 -39
- package/src/internal/incoming-headers-to-fetch.ts +0 -45
- package/src/internal/init-interview.ts +0 -360
- package/src/internal/init-project.ts +0 -711
- package/src/internal/init-scaffold.ts +0 -182
- package/src/internal/inline-stdio-define-stub.ts +0 -4
- package/src/internal/inline-stdio-mcp.ts +0 -230
- package/src/internal/install-cursor-skills.ts +0 -604
- package/src/internal/is-record.ts +0 -3
- package/src/internal/json-schema.ts +0 -95
- package/src/internal/legacy-command-guard.ts +0 -66
- package/src/internal/listen-port.ts +0 -85
- package/src/internal/local-control-plane.ts +0 -442
- package/src/internal/local-env.ts +0 -59
- package/src/internal/local-ingress.ts +0 -90
- package/src/internal/log-ring.ts +0 -59
- package/src/internal/logs-client.ts +0 -477
- package/src/internal/map-pool.ts +0 -39
- package/src/internal/mcp-endpoint.ts +0 -747
- package/src/internal/mcp-host.ts +0 -509
- package/src/internal/mcp-oauth-on-demand.ts +0 -337
- package/src/internal/mcp-oauth-persist.ts +0 -118
- package/src/internal/mcp-oauth.ts +0 -549
- package/src/internal/net.ts +0 -29
- package/src/internal/open-browser.ts +0 -41
- package/src/internal/otel/attrs.ts +0 -16
- package/src/internal/otel/collector.ts +0 -937
- package/src/internal/otel/config.ts +0 -287
- package/src/internal/otel/http.ts +0 -122
- package/src/internal/otel/mcp.ts +0 -56
- package/src/internal/otel/propagation.ts +0 -17
- package/src/internal/otel/runtime.ts +0 -441
- package/src/internal/package-inline-stdio.ts +0 -114
- package/src/internal/peer-connections.ts +0 -96
- package/src/internal/platform-schedule-sync.ts +0 -75
- package/src/internal/platform-timers.ts +0 -365
- package/src/internal/playground/static.ts +0 -278
- package/src/internal/playground/toolchain.ts +0 -270
- package/src/internal/playground-proxy.ts +0 -564
- package/src/internal/process-memory-telemetry.ts +0 -334
- package/src/internal/project-layout.ts +0 -31
- package/src/internal/prompt-context.ts +0 -116
- package/src/internal/reminder-control-plane-protocol.ts +0 -482
- package/src/internal/reminder-runner.ts +0 -1559
- package/src/internal/reminder-schedule.ts +0 -104
- package/src/internal/reminder-store.ts +0 -176
- package/src/internal/request-error-status.ts +0 -95
- package/src/internal/request-headers.ts +0 -21
- package/src/internal/resolve-prod-target.ts +0 -334
- package/src/internal/resolved-connections.ts +0 -190
- package/src/internal/router.ts +0 -143
- package/src/internal/run-client.ts +0 -354
- package/src/internal/runtime-dispatch-runner.ts +0 -50
- package/src/internal/sanitize-mcp-tool-name.ts +0 -31
- package/src/internal/schedule-runner.ts +0 -154
- package/src/internal/scm/pr-url.ts +0 -245
- package/src/internal/sdk-runner.ts +0 -959
- package/src/internal/serve-restart.ts +0 -113
- package/src/internal/server.ts +0 -3147
- package/src/internal/session-cost.ts +0 -208
- package/src/internal/session-engine.ts +0 -5622
- package/src/internal/session-links.ts +0 -84
- package/src/internal/session-run-log.ts +0 -535
- package/src/internal/session-store.ts +0 -307
- package/src/internal/session-urls.ts +0 -32
- package/src/internal/sessions-client.ts +0 -239
- package/src/internal/skill-catalog.ts +0 -66
- package/src/internal/skills-sync.ts +0 -55
- package/src/internal/slack-provision-client.ts +0 -544
- package/src/internal/slack-thread-key.ts +0 -11
- package/src/internal/sleep.ts +0 -3
- package/src/internal/start-log-store.ts +0 -164
- package/src/internal/steering.ts +0 -17
- package/src/internal/storage-coordinator.ts +0 -800
- package/src/internal/storage-roles.ts +0 -86
- package/src/internal/storage.ts +0 -1
- package/src/internal/store-api-protocol.ts +0 -205
- package/src/internal/store-mirror.ts +0 -73
- package/src/internal/stream-progress.ts +0 -294
- package/src/internal/terminal-style.ts +0 -133
- package/src/internal/testing/factory-resource-fixtures.ts +0 -84
- package/src/internal/testing/scm-continuation-fixtures.ts +0 -285
- package/src/internal/tool-catalog.ts +0 -104
- package/src/internal/tool-policy.ts +0 -222
- package/src/internal/tool-result.ts +0 -50
- package/src/internal/trajectory.ts +0 -418
- package/src/internal/turn-cost.ts +0 -136
- package/src/internal/turn-governor.ts +0 -145
- package/src/internal/turn-lease-store.ts +0 -144
- package/src/internal/turn-outbox.ts +0 -77
- package/src/internal/update-check.ts +0 -517
- package/src/internal/v2-hosting.ts +0 -52
- package/src/internal/workspace-sync.ts +0 -114
- package/src/internal/workspace.ts +0 -505
- package/src/kv/memory-kv.ts +0 -94
- package/src/kv.ts +0 -18
- package/src/memory.ts +0 -487
- package/src/otel-public.ts +0 -24
- package/src/otel.ts +0 -320
- package/src/prompt.ts +0 -80
- package/src/reminders.ts +0 -65
- package/src/schedules.ts +0 -31
- package/src/skills.ts +0 -27
- package/src/storage-backends/cursor-hosted-v2.ts +0 -204
- package/src/storage-backends/cursor-hosted.ts +0 -388
- package/src/storage-backends/file-kv.ts +0 -276
- package/src/storage-protocol.ts +0 -261
- package/src/storage.ts +0 -408
- package/src/tools.ts +0 -166
- package/src/types.ts +0 -3776
- /package/dist/docs/assets/{reference_agent-config.md.DzGI777n.lean.js → reference_agent-config.md.Cj5uBKp4.lean.js} +0 -0
package/src/storage.ts
DELETED
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Durable storage plug-in for agent-serve.
|
|
3
|
-
*
|
|
4
|
-
* Author `agent/storage.ts` with {@link defineStorage} to mirror the
|
|
5
|
-
* framework's durable state into storage you own (a database, S3, a data
|
|
6
|
-
* pipeline, …). Without it, state lives under `--state-root` on local disk
|
|
7
|
-
* only, and eval history stays in process memory.
|
|
8
|
-
*
|
|
9
|
-
* The sink is a plain key-value store — put/get/delete/list, no schema —
|
|
10
|
-
* plus a conditional-write group ({@link StorageConfig.cas}; optional).
|
|
11
|
-
* Implementing that small KV core is enough for
|
|
12
|
-
* FULL functionality: eval-run history is derived over the core when the
|
|
13
|
-
* optional dedicated table ({@link StorageConfig.evals}) is not authored —
|
|
14
|
-
* that group exists as a backend-native optimization (a real table, an
|
|
15
|
-
* analytics pipeline), not as a required-or-lose-history hook:
|
|
16
|
-
*
|
|
17
|
-
* ```ts
|
|
18
|
-
* import { defineStorage } from "@cursor/bdk/internal/storage";
|
|
19
|
-
*
|
|
20
|
-
* export default defineStorage({
|
|
21
|
-
* put: (key, value) => db.upsert(key, value),
|
|
22
|
-
* get: (key) => db.get(key),
|
|
23
|
-
* delete: (key) => db.delete(key),
|
|
24
|
-
* list: (prefix) => db.listByPrefix(prefix), // [{ key, value }] in key order
|
|
25
|
-
* cas: { getWithVersion: ..., putIfAbsent: ..., putIfVersion: ..., listKeys: ... },
|
|
26
|
-
* evals: { put: ..., delete: ..., list: ... }, // eval-runs table
|
|
27
|
-
* });
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* The **framework mints every key** from a stable, versioned scheme (see
|
|
31
|
-
* {@link storageKeys}) and decides **when** to call the sink: session
|
|
32
|
-
* records and event chunks flush when a turn's handlers have settled,
|
|
33
|
-
* reads happen at serve start (bulk restore), on continuation-token misses
|
|
34
|
-
* (lazy restore), and at playground hydration. Authors do not schedule
|
|
35
|
-
* reads or writes — the only timing knobs are {@link StoragePolicy}'s
|
|
36
|
-
* `debounceMs` (event write batching) and `restore` (startup hydration).
|
|
37
|
-
*
|
|
38
|
-
* Because keys are opaque strings to the sink, new kinds of durable state
|
|
39
|
-
* (channel cursors, thread affinity, …) are new key prefixes — existing
|
|
40
|
-
* sinks store them with no code changes. Authors can also store their own
|
|
41
|
-
* JSON under `agentkit/v1/{agent}/kv/…` via {@link HostContext.kv}; the
|
|
42
|
-
* framework still mints the full key from the author-supplied segment.
|
|
43
|
-
*
|
|
44
|
-
* Delivery semantics: writes are **serialized** (one sink call in flight
|
|
45
|
-
* per agent, in order), **bounded** (a sink that falls behind sheds writes
|
|
46
|
-
* rather than growing memory), and **at-most-once** — a throwing `put` is
|
|
47
|
-
* logged and dropped, never retried, and never fails a turn. The local
|
|
48
|
-
* event log under `--state-root` remains the live source of truth; this
|
|
49
|
-
* interface is the durable mirror.
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
import type { EvalRunSnapshot } from "./evals.js";
|
|
53
|
-
import { brandDefinition } from "./internal/brand.js";
|
|
54
|
-
import { storageKeys } from "./storage-protocol.js";
|
|
55
|
-
import type { JsonValue, KvCasResult, KvVersionedEntry } from "./types.js";
|
|
56
|
-
|
|
57
|
-
export type {
|
|
58
|
-
DurableSessionRecord,
|
|
59
|
-
DurableSessionSummary,
|
|
60
|
-
StorageKeys,
|
|
61
|
-
} from "./storage-protocol.js";
|
|
62
|
-
export {
|
|
63
|
-
AGENTSDK_STORAGE_KEY_ROOT,
|
|
64
|
-
agentSdkStorageKeys,
|
|
65
|
-
frameworkStartLogId,
|
|
66
|
-
GOLDEN_DURABLE_SESSION_RECORD,
|
|
67
|
-
isDurableSessionRecordKey,
|
|
68
|
-
keySegment,
|
|
69
|
-
MAX_KEY_SEGMENT_BYTES,
|
|
70
|
-
parseDurableSessionRecord,
|
|
71
|
-
STORAGE_KEY_ROOT,
|
|
72
|
-
storageKeys,
|
|
73
|
-
storageKeysForArchitecture,
|
|
74
|
-
summarizeDurableSessionRecord,
|
|
75
|
-
} from "./storage-protocol.js";
|
|
76
|
-
|
|
77
|
-
// ============================================================================
|
|
78
|
-
// Sink interface
|
|
79
|
-
// ============================================================================
|
|
80
|
-
|
|
81
|
-
/** One `{ key, value }` pair returned by {@link StorageConfig.list}. */
|
|
82
|
-
export interface StorageEntry {
|
|
83
|
-
key: string;
|
|
84
|
-
value: JsonValue;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/** Context passed to every sink call. */
|
|
88
|
-
export interface StorageContext {
|
|
89
|
-
/** Agent name (also baked into every key; see {@link storageKeys}). */
|
|
90
|
-
agentName: string;
|
|
91
|
-
/** Absolute agent project root (directory that contains `agent/`). */
|
|
92
|
-
projectRoot: string;
|
|
93
|
-
/**
|
|
94
|
-
* Why the framework is calling:
|
|
95
|
-
* - `"policy"` — a flush trigger fired (turn end, debounce, change)
|
|
96
|
-
* - `"shutdown"` — the serve process is draining; last chance to write
|
|
97
|
-
* - `"restore"` — serve start or a lazy restore; reads rebuilding state
|
|
98
|
-
* - `"coordination"` — framework coordination driving
|
|
99
|
-
* {@link StorageCasTable} (conditional writes)
|
|
100
|
-
*/
|
|
101
|
-
reason: "policy" | "shutdown" | "restore" | "coordination";
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface StoragePolicy {
|
|
105
|
-
/**
|
|
106
|
-
* Batch event-chunk writes on a quiet-period timer instead of flushing
|
|
107
|
-
* once per turn. The debounce **spans turn boundaries** — a rapid
|
|
108
|
-
* multi-turn exchange becomes one write when the session goes quiet —
|
|
109
|
-
* so it is the right choice for chatty sessions where per-turn writes
|
|
110
|
-
* are too many. Unset (default): one event chunk per turn.
|
|
111
|
-
*/
|
|
112
|
-
debounceMs?: number;
|
|
113
|
-
/**
|
|
114
|
-
* Guardrails for the **startup bulk restore**. Whatever `list` returns
|
|
115
|
-
* is filtered to these caps before anything is written to local disk, so
|
|
116
|
-
* a large store cannot blow up `--state-root` or stall serve start.
|
|
117
|
-
* Newest sessions (by `updatedAt`) win within each cap.
|
|
118
|
-
*
|
|
119
|
-
* `"off"` disables the startup restore entirely — sessions then restore
|
|
120
|
-
* one at a time as follow-ups actually arrive (lazy-only; recommended
|
|
121
|
-
* for high-traffic deployments).
|
|
122
|
-
*/
|
|
123
|
-
restore?: StorageRestorePolicy | "off";
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/** Caps applied to the startup bulk restore. See {@link StoragePolicy.restore}. */
|
|
127
|
-
export interface StorageRestorePolicy {
|
|
128
|
-
/** Max sessions materialized (default {@link STORAGE_DEFAULT_RESTORE_MAX_SESSIONS}). */
|
|
129
|
-
maxSessions?: number;
|
|
130
|
-
/**
|
|
131
|
-
* Skip sessions whose `updatedAt` is older than this (default
|
|
132
|
-
* {@link STORAGE_DEFAULT_RESTORE_MAX_AGE_MS}). Older sessions remain
|
|
133
|
-
* reachable lazily on their next follow-up.
|
|
134
|
-
*/
|
|
135
|
-
maxAgeMs?: number;
|
|
136
|
-
/**
|
|
137
|
-
* Stop restoring once this many bytes of records + events have been
|
|
138
|
-
* written (default {@link STORAGE_DEFAULT_RESTORE_MAX_TOTAL_BYTES}).
|
|
139
|
-
* Checked before each session is written, so one oversized stream
|
|
140
|
-
* cannot blow past the budget.
|
|
141
|
-
*/
|
|
142
|
-
maxTotalBytes?: number;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Dedicated table for playground eval batches, keyed by `runId`. The
|
|
147
|
-
* framework saves a full {@link EvalRunSnapshot} as a batch starts,
|
|
148
|
-
* progresses, and finishes; prunes runs past the playground history
|
|
149
|
-
* window; and lists everything back at serve start.
|
|
150
|
-
*/
|
|
151
|
-
export interface StorageEvalsTable {
|
|
152
|
-
/** Upsert one run snapshot under `run.runId` (last write wins). */
|
|
153
|
-
put(run: EvalRunSnapshot, ctx: StorageContext): void | Promise<void>;
|
|
154
|
-
/** Remove a run pruned out of the playground history window. */
|
|
155
|
-
delete(runId: string, ctx: StorageContext): void | Promise<void>;
|
|
156
|
-
/** All saved runs (any order). Called once when the serve process hydrates. */
|
|
157
|
-
list(ctx: StorageContext): EvalRunSnapshot[] | Promise<EvalRunSnapshot[]>;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Conditional writes (CAS) — the coordination tier of the storage backend
|
|
162
|
-
* contract. Plain storage works without it, so existing backends keep
|
|
163
|
-
* working across a platform upgrade. The built-in backends all include
|
|
164
|
-
* it, so implementing this group yourself only comes up for BYO storage.
|
|
165
|
-
*
|
|
166
|
-
* Grouped under {@link StorageConfig.cas} rather than as loose methods —
|
|
167
|
-
* matching the `evals` table group — so `defineStorage` validates the
|
|
168
|
-
* whole group at once: there is no meaningful half-implementation.
|
|
169
|
-
*
|
|
170
|
-
* Version tokens are opaque per-key strings that change on every
|
|
171
|
-
* successful write (counter, UUID, content hash — whatever is cheap for
|
|
172
|
-
* the backend). See {@link KvVersionedEntry} / {@link KvCasResult}.
|
|
173
|
-
*/
|
|
174
|
-
export interface StorageCasTable {
|
|
175
|
-
/** Read one value with its version token. Miss → `undefined`. */
|
|
176
|
-
getWithVersion(
|
|
177
|
-
key: string,
|
|
178
|
-
ctx: StorageContext,
|
|
179
|
-
): Promise<KvVersionedEntry | undefined> | KvVersionedEntry | undefined;
|
|
180
|
-
/** Create the key only when absent. Conflict returns the existing entry. */
|
|
181
|
-
putIfAbsent(
|
|
182
|
-
key: string,
|
|
183
|
-
value: JsonValue,
|
|
184
|
-
ctx: StorageContext,
|
|
185
|
-
): Promise<KvCasResult> | KvCasResult;
|
|
186
|
-
/**
|
|
187
|
-
* Replace the value only when the key still carries `expectedVersion`.
|
|
188
|
-
* Conflict (version moved, or key deleted) returns the current entry.
|
|
189
|
-
*/
|
|
190
|
-
putIfVersion(
|
|
191
|
-
key: string,
|
|
192
|
-
value: JsonValue,
|
|
193
|
-
expectedVersion: string,
|
|
194
|
-
ctx: StorageContext,
|
|
195
|
-
): Promise<KvCasResult> | KvCasResult;
|
|
196
|
-
/** All keys under a prefix, in ascending key order. */
|
|
197
|
-
listKeys(prefix: string, ctx: StorageContext): Promise<string[]> | string[];
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export interface StorageConfig {
|
|
201
|
-
/** Optional label surfaced on `GET /v1/info` diagnostics. */
|
|
202
|
-
name?: string;
|
|
203
|
-
/** Timing knobs; see {@link StoragePolicy}. */
|
|
204
|
-
policy?: StoragePolicy;
|
|
205
|
-
/**
|
|
206
|
-
* Dedicated eval-runs table — a backend-native optimization, not a
|
|
207
|
-
* requirement. When omitted, `defineStorage` derives the table over the
|
|
208
|
-
* KV core (one key per run under `agentkit/v1/{agent}/eval-runs/`),
|
|
209
|
-
* which needs core `put`, `delete`, and `list`; only when the core
|
|
210
|
-
* lacks `delete` or `list` does playground eval history stay in process
|
|
211
|
-
* memory (lost on restart).
|
|
212
|
-
*/
|
|
213
|
-
evals?: StorageEvalsTable;
|
|
214
|
-
/**
|
|
215
|
-
* Conditional writes (CAS). Optional for plain storage — existing
|
|
216
|
-
* backends keep working without it. The built-in backends (`fileKv`,
|
|
217
|
-
* `cursorHostedStorage`) both include it. See {@link StorageCasTable}.
|
|
218
|
-
*/
|
|
219
|
-
cas?: StorageCasTable;
|
|
220
|
-
/**
|
|
221
|
-
* Store one value under a key (upsert, last-write-wins). Called on the
|
|
222
|
-
* framework's schedule — never concurrently, always in order. Keep it
|
|
223
|
-
* fast or buffer internally: the delivery queue is bounded, so a sink
|
|
224
|
-
* that falls behind sustained traffic sheds writes (logged) instead of
|
|
225
|
-
* growing memory; it never stalls the agent loop.
|
|
226
|
-
*/
|
|
227
|
-
put(key: string, value: JsonValue, ctx: StorageContext): void | Promise<void>;
|
|
228
|
-
/**
|
|
229
|
-
* Store several values in one call. Optional — the coordinator uses it
|
|
230
|
-
* only when present, so authored sinks keep `put`'s strict one-at-a-time
|
|
231
|
-
* ordering. Entries belong to one flush and are independent keys; the
|
|
232
|
-
* implementation may write them in a single backend round trip. Report
|
|
233
|
-
* per-entry outcomes, index-aligned with the input: one key's failure
|
|
234
|
-
* must not take down its batch siblings. A thrown rejection is treated
|
|
235
|
-
* as every entry failing (logged and dropped, at-most-once) — reserve it
|
|
236
|
-
* for faults that genuinely precede any write.
|
|
237
|
-
*/
|
|
238
|
-
putMany?(
|
|
239
|
-
entries: Array<{ key: string; value: JsonValue }>,
|
|
240
|
-
ctx: StorageContext,
|
|
241
|
-
): Promise<Array<{ key: string; error?: unknown }>>;
|
|
242
|
-
/** Remove a key. Optional — without it, deletions are skipped. */
|
|
243
|
-
delete?(key: string, ctx: StorageContext): void | Promise<void>;
|
|
244
|
-
/**
|
|
245
|
-
* Point lookup. Optional — required for **lazy restore** (resolving a
|
|
246
|
-
* continuation token on a replacement host).
|
|
247
|
-
* Return `undefined`/`null` only for a **definitive** miss: on the lazy
|
|
248
|
-
* restore path a throw propagates and fails the follow-up (retryable) —
|
|
249
|
-
* a store outage must not read as "unknown token", which would fork the
|
|
250
|
-
* conversation onto a new session.
|
|
251
|
-
*/
|
|
252
|
-
get?(
|
|
253
|
-
key: string,
|
|
254
|
-
ctx: StorageContext,
|
|
255
|
-
): JsonValue | undefined | null | Promise<JsonValue | undefined | null>;
|
|
256
|
-
/**
|
|
257
|
-
* All entries under a key prefix, in ascending key order. Optional —
|
|
258
|
-
* required for the **startup bulk restore** (sessions + event streams)
|
|
259
|
-
* and, together with `delete`, for the derived eval-runs table
|
|
260
|
-
* (playground eval history).
|
|
261
|
-
*/
|
|
262
|
-
list?(prefix: string, ctx: StorageContext): StorageEntry[] | Promise<StorageEntry[]>;
|
|
263
|
-
/**
|
|
264
|
-
* The `limit` most recently **written** entries under a prefix, newest
|
|
265
|
-
* first. Optional — a backend-native shortcut for `GET /v1/sessions?latest=1`
|
|
266
|
-
* on a replacement host, where the alternative is listing every session
|
|
267
|
-
* row. Without it the engine falls back to `list`. Write order is an
|
|
268
|
-
* approximation of the records' own `updatedAt`; callers tolerate that.
|
|
269
|
-
*/
|
|
270
|
-
listNewest?(
|
|
271
|
-
prefix: string,
|
|
272
|
-
limit: number,
|
|
273
|
-
ctx: StorageContext,
|
|
274
|
-
): StorageEntry[] | Promise<StorageEntry[]>;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
export type StorageDefinition = StorageConfig & {
|
|
278
|
-
readonly __agentServe: "storage";
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Author the project storage sink (`agent/storage.ts`, default
|
|
283
|
-
* export). Import from `@cursor/bdk/internal/storage`, not
|
|
284
|
-
* `@cursor/bdk`. See the module doc for semantics and an example.
|
|
285
|
-
*/
|
|
286
|
-
export function defineStorage(config: StorageConfig): StorageDefinition {
|
|
287
|
-
if (typeof config.put !== "function") {
|
|
288
|
-
throw new Error("defineStorage: config.put must be a function");
|
|
289
|
-
}
|
|
290
|
-
for (const hook of ["get", "list", "delete", "putMany"] as const) {
|
|
291
|
-
const value = config[hook];
|
|
292
|
-
if (value !== undefined && typeof value !== "function") {
|
|
293
|
-
throw new Error(`defineStorage: config.${hook} must be a function when set`);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
if (config.evals !== undefined) {
|
|
297
|
-
for (const hook of ["put", "delete", "list"] as const) {
|
|
298
|
-
if (typeof config.evals[hook] !== "function") {
|
|
299
|
-
throw new Error(
|
|
300
|
-
`defineStorage: evals.${hook} must be a function when the evals table is set`,
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
if (config.cas !== undefined) {
|
|
306
|
-
const casHooks = ["getWithVersion", "putIfAbsent", "putIfVersion", "listKeys"] as const;
|
|
307
|
-
const cas = config.cas;
|
|
308
|
-
// A partial group is a bug, not a legacy config: half-implemented CAS
|
|
309
|
-
// would pass the capability probe.
|
|
310
|
-
const missingCasHooks = casHooks.filter(hook => typeof cas[hook] !== "function");
|
|
311
|
-
if (missingCasHooks.length > 0) {
|
|
312
|
-
throw new Error(
|
|
313
|
-
`defineStorage: ${missingCasHooks
|
|
314
|
-
.map(hook => `cas.${hook}`)
|
|
315
|
-
.join(
|
|
316
|
-
", ",
|
|
317
|
-
)} must be ${missingCasHooks.length === 1 ? "a function" : "functions"} when the cas group is set`,
|
|
318
|
-
);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
// Validate eagerly so a bad policy fails at discovery, not first flush.
|
|
322
|
-
resolveStoragePolicy(config.policy);
|
|
323
|
-
// A backend that implements only the KV core gets full functionality:
|
|
324
|
-
// the dedicated table is a backend-native optimization, derived over
|
|
325
|
-
// the core when absent. An authored group always wins.
|
|
326
|
-
const derivedEvals = config.evals === undefined ? deriveEvalsTable(config) : undefined;
|
|
327
|
-
return brandDefinition("storage", {
|
|
328
|
-
...config,
|
|
329
|
-
...(derivedEvals === undefined ? {} : { evals: derivedEvals }),
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* Eval-runs table over the KV core: one key per run under
|
|
335
|
-
* {@link storageKeys.evalRun}, hydrate via prefix `list`, prune via
|
|
336
|
-
* `delete`. Requires core `put` + `delete` + `list`; without `delete` or
|
|
337
|
-
* `list` there is no derivation (pruning or hydration would silently not
|
|
338
|
-
* work) and eval history stays in process memory.
|
|
339
|
-
*/
|
|
340
|
-
function deriveEvalsTable(config: StorageConfig): StorageEvalsTable | undefined {
|
|
341
|
-
if (config.delete === undefined || config.list === undefined) {
|
|
342
|
-
return undefined;
|
|
343
|
-
}
|
|
344
|
-
return {
|
|
345
|
-
put: (run, ctx) =>
|
|
346
|
-
config.put(storageKeys.evalRun(ctx.agentName, run.runId), run as unknown as JsonValue, ctx),
|
|
347
|
-
delete: (runId, ctx) => config.delete?.(storageKeys.evalRun(ctx.agentName, runId), ctx),
|
|
348
|
-
list: async ctx => {
|
|
349
|
-
const entries = (await config.list?.(storageKeys.evalRunsPrefix(ctx.agentName), ctx)) ?? [];
|
|
350
|
-
return entries.map(entry => entry.value as unknown as EvalRunSnapshot);
|
|
351
|
-
},
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
// ============================================================================
|
|
356
|
-
// Policy resolution
|
|
357
|
-
// ============================================================================
|
|
358
|
-
|
|
359
|
-
export const STORAGE_DEFAULT_RESTORE_MAX_SESSIONS = 1_000;
|
|
360
|
-
export const STORAGE_DEFAULT_RESTORE_MAX_AGE_MS: number = 30 * 24 * 60 * 60_000;
|
|
361
|
-
export const STORAGE_DEFAULT_RESTORE_MAX_TOTAL_BYTES = 1_073_741_824; // 1 GiB
|
|
362
|
-
|
|
363
|
-
/** {@link StoragePolicy} with defaults applied. */
|
|
364
|
-
export interface ResolvedStoragePolicy {
|
|
365
|
-
/** Event-chunk flush trigger: per turn, or debounced across turns. */
|
|
366
|
-
events: "turnEnd" | { debounceMs: number };
|
|
367
|
-
restore: "off" | { maxSessions: number; maxAgeMs: number; maxTotalBytes: number };
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/** Apply {@link StoragePolicy} defaults (exposed for tooling/tests). */
|
|
371
|
-
export function resolveStoragePolicy(policy: StoragePolicy | undefined): ResolvedStoragePolicy {
|
|
372
|
-
return {
|
|
373
|
-
events:
|
|
374
|
-
policy?.debounceMs === undefined
|
|
375
|
-
? "turnEnd"
|
|
376
|
-
: { debounceMs: clampInt(policy.debounceMs, 2_000, 0, 60_000) },
|
|
377
|
-
restore:
|
|
378
|
-
policy?.restore === "off"
|
|
379
|
-
? "off"
|
|
380
|
-
: {
|
|
381
|
-
maxSessions: clampInt(
|
|
382
|
-
policy?.restore?.maxSessions,
|
|
383
|
-
STORAGE_DEFAULT_RESTORE_MAX_SESSIONS,
|
|
384
|
-
0,
|
|
385
|
-
1_000_000,
|
|
386
|
-
),
|
|
387
|
-
maxAgeMs: clampInt(
|
|
388
|
-
policy?.restore?.maxAgeMs,
|
|
389
|
-
STORAGE_DEFAULT_RESTORE_MAX_AGE_MS,
|
|
390
|
-
0,
|
|
391
|
-
10 * 365 * 24 * 60 * 60_000,
|
|
392
|
-
),
|
|
393
|
-
maxTotalBytes: clampInt(
|
|
394
|
-
policy?.restore?.maxTotalBytes,
|
|
395
|
-
STORAGE_DEFAULT_RESTORE_MAX_TOTAL_BYTES,
|
|
396
|
-
0,
|
|
397
|
-
1_099_511_627_776, // 1 TiB
|
|
398
|
-
),
|
|
399
|
-
},
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
function clampInt(value: number | undefined, fallback: number, min: number, max: number): number {
|
|
404
|
-
if (value === undefined || !Number.isFinite(value)) {
|
|
405
|
-
return fallback;
|
|
406
|
-
}
|
|
407
|
-
return Math.min(max, Math.max(min, Math.floor(value)));
|
|
408
|
-
}
|
package/src/tools.ts
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `defineTool` — authored at `agent/tools/<name>.ts`.
|
|
3
|
-
*
|
|
4
|
-
* Each file under `agent/tools/` is one tool; the filename becomes the tool
|
|
5
|
-
* name the model sees. Export the definition as the module's default export:
|
|
6
|
-
*
|
|
7
|
-
* ```ts
|
|
8
|
-
* import { defineTool } from "@cursor/bdk/tools";
|
|
9
|
-
* import { z } from "zod";
|
|
10
|
-
*
|
|
11
|
-
* // Runs in-process on the agent-serve host (default). Authored MCP
|
|
12
|
-
* // connections are on ctx.host.mcp (also on the Cursor agent via SDK, and
|
|
13
|
-
* // on channel handlers via args.host.mcp).
|
|
14
|
-
* export default defineTool({
|
|
15
|
-
* description: "Get the current weather for a city.",
|
|
16
|
-
* inputSchema: z.object({ city: z.string() }),
|
|
17
|
-
* async execute({ city }, ctx) {
|
|
18
|
-
* // await ctx.host.mcp.callTool("linear", "list_issues", { ... })
|
|
19
|
-
* return { city, condition: "Sunny", temperatureF: 72 };
|
|
20
|
-
* },
|
|
21
|
-
* });
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* Park the call for human approval (playground or
|
|
25
|
-
* `POST /v1/session/:id/approvals/:callId`) before `execute` runs:
|
|
26
|
-
*
|
|
27
|
-
* ```ts
|
|
28
|
-
* export default defineTool({
|
|
29
|
-
* description: "Post a weather alert to ops.",
|
|
30
|
-
* needsApproval: true,
|
|
31
|
-
* inputSchema: z.object({ city: z.string(), message: z.string() }),
|
|
32
|
-
* async execute({ city, message }) {
|
|
33
|
-
* return { posted: true, city, message };
|
|
34
|
-
* },
|
|
35
|
-
* });
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* Agent-side tools materialize a shell script the Cursor agent invokes
|
|
39
|
-
* (local harness or cloud). JSON args on stdin, result on stdout:
|
|
40
|
-
*
|
|
41
|
-
* ```ts
|
|
42
|
-
* export default defineTool({
|
|
43
|
-
* description: "Echo a message from the agent workspace.",
|
|
44
|
-
* execution: "agent",
|
|
45
|
-
* inputSchema: z.object({ message: z.string() }),
|
|
46
|
-
* script: `#!/usr/bin/env bash
|
|
47
|
-
* set -euo pipefail
|
|
48
|
-
* message=$(python3 -c 'import json,sys; print(json.load(sys.stdin)["message"])')
|
|
49
|
-
* printf '%s\\n' "$message"
|
|
50
|
-
* `,
|
|
51
|
-
* });
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
import type { z } from "zod";
|
|
56
|
-
import { forwardTimeArgument, missingTimeWindow, schemaTimeWindowKeys } from "./internal/as-of.js";
|
|
57
|
-
import { brandDefinition } from "./internal/brand.js";
|
|
58
|
-
import { classifyAnnotationsEffect } from "./internal/tool-policy.js";
|
|
59
|
-
import type {
|
|
60
|
-
JsonObject,
|
|
61
|
-
JsonSchemaObject,
|
|
62
|
-
ToolContext,
|
|
63
|
-
ToolDefinition,
|
|
64
|
-
ToolEffectDeclaration,
|
|
65
|
-
ToolExecuteResult,
|
|
66
|
-
ToolNeedsApproval,
|
|
67
|
-
} from "./types.js";
|
|
68
|
-
|
|
69
|
-
export type {
|
|
70
|
-
HostMcpCallResult,
|
|
71
|
-
HostMcpRegistry,
|
|
72
|
-
HostMcpToolInfo,
|
|
73
|
-
ToolConfig,
|
|
74
|
-
ToolContext,
|
|
75
|
-
ToolDefinition,
|
|
76
|
-
ToolEffect,
|
|
77
|
-
ToolEffectDeclaration,
|
|
78
|
-
ToolExecuteResult,
|
|
79
|
-
ToolExecution,
|
|
80
|
-
ToolNeedsApproval,
|
|
81
|
-
ToolResultContent,
|
|
82
|
-
} from "./types.js";
|
|
83
|
-
/**
|
|
84
|
-
* Time-window and effect classifiers the host applies to every tool call.
|
|
85
|
-
* Re-exported for tools that reach other tools themselves (change-monitor
|
|
86
|
-
* `script`): inner calls skip the host gate, so the sandbox applies the same
|
|
87
|
-
* forward-time, omitted-window, and read-only filters.
|
|
88
|
-
*/
|
|
89
|
-
export { classifyAnnotationsEffect, forwardTimeArgument, missingTimeWindow, schemaTimeWindowKeys };
|
|
90
|
-
|
|
91
|
-
/** Input type for `execute`: inferred from a zod schema, JSON otherwise. */
|
|
92
|
-
export type ToolInput<TSchema> = TSchema extends z.ZodTypeAny ? z.infer<TSchema> : JsonObject;
|
|
93
|
-
|
|
94
|
-
type ServerToolConfig<TSchema> = {
|
|
95
|
-
description: string;
|
|
96
|
-
execution?: "server";
|
|
97
|
-
inputSchema?: TSchema;
|
|
98
|
-
/**
|
|
99
|
-
* JSON Schema for the tool's structured output (zod converted at
|
|
100
|
-
* discovery, never validated against). Advertised when declared.
|
|
101
|
-
*/
|
|
102
|
-
outputSchema?: z.ZodTypeAny | JsonSchemaObject;
|
|
103
|
-
needsApproval?: ToolNeedsApproval<ToolInput<TSchema>>;
|
|
104
|
-
/**
|
|
105
|
-
* Whether this tool changes anything outside the session. Undeclared means
|
|
106
|
-
* write, so a dry-run session answers it instead of running it.
|
|
107
|
-
*/
|
|
108
|
-
effect?: ToolEffectDeclaration<ToolInput<TSchema>>;
|
|
109
|
-
/**
|
|
110
|
-
* Input properties carrying time bounds. In an `asOf` session each named
|
|
111
|
-
* argument must be an absolute ISO-8601 instant with a timezone, no later
|
|
112
|
-
* than the frozen instant; a call that omits one, or supplies a relative
|
|
113
|
-
* or later value, is refused so the model retries with absolute bounds.
|
|
114
|
-
* Names must exist in {@link inputSchema} or the frozen session refuses to
|
|
115
|
-
* start. Ignored without `asOf`.
|
|
116
|
-
*/
|
|
117
|
-
timeArgs?: readonly string[];
|
|
118
|
-
/** What a `"write"` tool returns in a dry-run session. */
|
|
119
|
-
dryRunResult?: ToolExecuteResult | ((input: ToolInput<TSchema>) => ToolExecuteResult);
|
|
120
|
-
execute: (
|
|
121
|
-
input: ToolInput<TSchema>,
|
|
122
|
-
ctx: ToolContext,
|
|
123
|
-
) => ToolExecuteResult | Promise<ToolExecuteResult>;
|
|
124
|
-
script?: never;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
type AgentToolConfig<TSchema> = {
|
|
128
|
-
description: string;
|
|
129
|
-
execution: "agent";
|
|
130
|
-
inputSchema?: TSchema;
|
|
131
|
-
/** Output JSON Schema; advertised when declared, never validated against. */
|
|
132
|
-
outputSchema?: z.ZodTypeAny | JsonSchemaObject;
|
|
133
|
-
/**
|
|
134
|
-
* Shell script written into the session workspace. Receives a JSON
|
|
135
|
-
* object on stdin and should print the result on stdout.
|
|
136
|
-
*/
|
|
137
|
-
script: string;
|
|
138
|
-
execute?: never;
|
|
139
|
-
/** Human-in-the-loop approvals are only supported for server tools. */
|
|
140
|
-
needsApproval?: never;
|
|
141
|
-
/**
|
|
142
|
-
* Agent tools run inside the harness, not through the host's tool path, so
|
|
143
|
-
* a dry run cannot answer them and an `asOf` session cannot bound them.
|
|
144
|
-
* Classify the work as a server tool if it needs either.
|
|
145
|
-
*/
|
|
146
|
-
effect?: never;
|
|
147
|
-
timeArgs?: never;
|
|
148
|
-
dryRunResult?: never;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Define a tool. With a zod `inputSchema` the input is validated before
|
|
153
|
-
* `execute` runs and typed via inference; with a plain JSON Schema object
|
|
154
|
-
* (or no schema) the input is the raw JSON arguments.
|
|
155
|
-
*
|
|
156
|
-
* Set `execution: "agent"` to materialize a workspace script instead of
|
|
157
|
-
* registering an in-process custom tool.
|
|
158
|
-
*
|
|
159
|
-
* Set `needsApproval: true` (or a predicate) so the host parks the
|
|
160
|
-
* in-flight call until a human approves or denies it.
|
|
161
|
-
*/
|
|
162
|
-
export function defineTool<TSchema extends z.ZodTypeAny | JsonSchemaObject | undefined = undefined>(
|
|
163
|
-
config: ServerToolConfig<TSchema> | AgentToolConfig<TSchema>,
|
|
164
|
-
): ToolDefinition {
|
|
165
|
-
return brandDefinition("tool", config as ToolDefinition);
|
|
166
|
-
}
|