@cursor/bdk 0.2.6 → 0.2.8
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 +52 -57
- package/dist/channels/github/github-channel.d.ts.map +1 -1
- package/dist/channels/github/github-channel.js +32 -8
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +37 -29
- package/dist/channels/slack/external-policy.d.ts.map +1 -1
- package/dist/channels/slack/external-policy.js +6 -6
- package/dist/channels/slack/inbound.d.ts +5 -0
- package/dist/channels/slack/inbound.d.ts.map +1 -1
- package/dist/channels/slack/inbound.js +13 -0
- package/dist/channels/slack/index.d.ts +3 -0
- package/dist/channels/slack/index.d.ts.map +1 -1
- package/dist/channels/slack/index.js +3 -0
- package/dist/channels/slack/log.d.ts +1 -1
- package/dist/channels/slack/log.js +1 -1
- package/dist/channels/slack/self-identity.d.ts +15 -0
- package/dist/channels/slack/self-identity.d.ts.map +1 -0
- package/dist/channels/slack/self-identity.js +48 -0
- package/dist/channels/slack/sender-name.d.ts +17 -0
- package/dist/channels/slack/sender-name.d.ts.map +1 -0
- package/dist/channels/slack/sender-name.js +87 -0
- package/dist/channels/slack/setup.js +1 -1
- package/dist/channels/slack/user-info.d.ts +15 -0
- package/dist/channels/slack/user-info.d.ts.map +1 -0
- package/dist/channels/slack/user-info.js +57 -0
- package/dist/docs/404.html +2 -2
- package/dist/docs/assets/{app.CJLKDVza.js → app.oyjtOr3W.js} +4 -4
- package/dist/docs/assets/chunks/@localSearchIndexroot.C25zYVuc.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.BW9mrQmq.js → VPLocalSearchBox.D0P6J_UJ.js} +1 -1
- package/dist/docs/assets/chunks/{arc.D8ZOvM1m.js → arc.B0LY1J1h.js} +1 -1
- package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.CXEKhLW-.js → architectureDiagram-Q4EWVU46.dPduLUxY.js} +1 -1
- package/dist/docs/assets/chunks/{baseUniq.BJkVKblr.js → baseUniq.B_Ohm21h.js} +1 -1
- package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.DQDbHxor.js → blockDiagram-DXYQGD6D.B4zcanaJ.js} +1 -1
- package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.ByMD6LYM.js → c4Diagram-AHTNJAMY.D9Iw21nx.js} +1 -1
- package/dist/docs/assets/chunks/channel.CRUyWDV-.js +1 -0
- package/dist/docs/assets/chunks/{chunk-4BX2VUAB.Dtq1aVI9.js → chunk-4BX2VUAB.DDVwRShI.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-4TB4RGXK.BL_XrkoQ.js → chunk-4TB4RGXK.DsYcdn1i.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-55IACEB6.BDPXu94_.js → chunk-55IACEB6.BzzQvcYp.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-EDXVE4YY.DhGOQj4k.js → chunk-EDXVE4YY.BMiXZ7FX.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-FMBD7UC4.DSF5nr8v.js → chunk-FMBD7UC4.D_mBcLoc.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-OYMX7WX6.Day7wayw.js → chunk-OYMX7WX6.CMVjWVMx.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-QZHKN3VN.CpBEC0zA.js → chunk-QZHKN3VN.BG-FrPv9.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-YZCP3GAM.X_7rY1rx.js → chunk-YZCP3GAM.CkFE1ap3.js} +1 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.CG_UObcQ.js +1 -0
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.CG_UObcQ.js +1 -0
- package/dist/docs/assets/chunks/clone.NYSZ9qZN.js +1 -0
- package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.BVRmi2ko.js → cose-bilkent-S5V4N54A.BVNnCTvY.js} +1 -1
- package/dist/docs/assets/chunks/{dagre-KV5264BT.Dei9oslB.js → dagre-KV5264BT.CDN5PR9l.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-5BDNPKRD._M-efGt7.js → diagram-5BDNPKRD.DQRUlT-i.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.D1Vmhfsj.js → diagram-G4DWMVQ6.CoeblYQT.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-MMDJMWI5.cE1bmvAC.js → diagram-MMDJMWI5.DW3ymjl0.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-TYMM5635.DkXAfznP.js → diagram-TYMM5635.BP0uN4Jw.js} +1 -1
- package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.DH_pSwPg.js → erDiagram-SMLLAGMA.DVFUWEn4.js} +1 -1
- package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.kAWVN9j1.js → flowDiagram-DWJPFMVM.HU-eHspv.js} +1 -1
- package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.8r0w49-p.js → ganttDiagram-T4ZO3ILL.DHNhXijY.js} +1 -1
- package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.BDa7Bi1i.js → gitGraphDiagram-UUTBAWPF.DkISXcO3.js} +1 -1
- package/dist/docs/assets/chunks/{graph.BMPXHz_B.js → graph.CCV0fuRR.js} +1 -1
- package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.BmlcqewS.js → infoDiagram-42DDH7IO.bgILzOoc.js} +1 -1
- package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.CVSEQSul.js → ishikawaDiagram-UXIWVN3A.CuryXC0F.js} +1 -1
- package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.BpeWJ5n-.js → journeyDiagram-VCZTEJTY.BL1Pr-wu.js} +1 -1
- package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.DHbDXuxB.js → kanban-definition-6JOO6SKY.BbGjvk4l.js} +1 -1
- package/dist/docs/assets/chunks/{layout.CzrCDgkP.js → layout.C4PfdldS.js} +1 -1
- package/dist/docs/assets/chunks/{linear.HwBsflwN.js → linear.C3xD1T6X.js} +1 -1
- package/dist/docs/assets/chunks/{min.DqGHolT3.js → min.CzgRAQ9c.js} +1 -1
- package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.ZYGlOawh.js → mindmap-definition-QFDTVHPH.CA9rSWum.js} +1 -1
- package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.C2KRXlNR.js → pieDiagram-DEJITSTG.B8MprgJu.js} +1 -1
- package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.CHj3Qefp.js → quadrantDiagram-34T5L4WZ.DndDwbKT.js} +1 -1
- package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.B1L4Tf7k.js → requirementDiagram-MS252O5E.Zhfgwlnn.js} +1 -1
- package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.dNR2yi1B.js → sankeyDiagram-XADWPNL6.B6RRm6N5.js} +1 -1
- package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.BrvQ3C6m.js → sequenceDiagram-FGHM5R23.Bfmz-1PN.js} +1 -1
- package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.BtehEykA.js → stateDiagram-FHFEXIEX.gbrdNqgj.js} +1 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.DOOmulfQ.js +1 -0
- package/dist/docs/assets/chunks/{theme.BDHBZUkP.js → theme.gpWjytMh.js} +2 -2
- package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.Bn7nhqEN.js → timeline-definition-GMOUNBTQ.Bl1l7M1f.js} +1 -1
- package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.DKhc38sz.js → vennDiagram-DHZGUBPP.Dfle4U0d.js} +1 -1
- package/dist/docs/assets/chunks/{wardley-RL74JXVD.DOXQ0w8J.js → wardley-RL74JXVD.BJrCW6xc.js} +1 -1
- package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.Bbq5B2Ic.js → wardleyDiagram-NUSXRM2D.CM_4lmvZ.js} +1 -1
- package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.B77HE1K8.js → xychartDiagram-5P7HB3ND.CHT5X28R.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.BsgDqYPh.js → reference_cli.md.GwugN3n-.js} +5 -5
- package/dist/docs/assets/reference_cli.md.GwugN3n-.lean.js +1 -0
- package/dist/docs/building-with-agents.html +35 -35
- package/dist/docs/deployment.html +35 -35
- 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 +35 -35
- 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 +20 -9
- package/dist/docs/quickstart.html +35 -35
- package/dist/docs/reference/agent-config.html +35 -35
- package/dist/docs/reference/artifacts.html +35 -35
- package/dist/docs/reference/channels.html +35 -35
- package/dist/docs/reference/cli.html +39 -39
- package/dist/docs/reference/cli.md +20 -9
- package/dist/docs/reference/connections.html +35 -35
- package/dist/docs/reference/evals.html +35 -35
- package/dist/docs/reference/extensions.html +35 -35
- package/dist/docs/reference/hooks.html +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/grokbot-agents.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/cursor-cloud-agents/extension.d.ts +14 -0
- package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -1
- package/dist/extensions/cursor-cloud-agents/extension.js +5 -0
- package/dist/extensions/cursor-cloud-agents/lib/watch.d.ts +17 -0
- package/dist/extensions/cursor-cloud-agents/lib/watch.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/watch.js +99 -0
- package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.d.ts +19 -0
- package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.js +71 -0
- package/dist/extensions/cursor-cloud-agents/skills/handoff.md +9 -5
- package/dist/extensions/cursor-cloud-agents/tools/cancel.d.ts.map +1 -1
- package/dist/extensions/cursor-cloud-agents/tools/cancel.js +3 -1
- package/dist/extensions/cursor-cloud-agents/tools/launch.d.ts.map +1 -1
- package/dist/extensions/cursor-cloud-agents/tools/launch.js +3 -2
- package/dist/extensions.d.ts +1 -1
- package/dist/extensions.js +1 -1
- package/dist/files-backends/cursor-hosted.d.ts +22 -83
- package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/files-backends/cursor-hosted.js +46 -160
- package/dist/files.d.ts +9 -32
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +7 -32
- package/dist/internal/artifacts-store.d.ts +13 -25
- package/dist/internal/artifacts-store.d.ts.map +1 -1
- package/dist/internal/artifacts-store.js +25 -46
- package/dist/internal/cli-ax.d.ts +10 -17
- package/dist/internal/cli-ax.d.ts.map +1 -1
- package/dist/internal/cli-ax.js +87 -155
- package/dist/internal/cli-bitbucket.js +5 -5
- package/dist/internal/cli-deploy.d.ts +4 -1
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +117 -20
- package/dist/internal/cli-github.js +13 -13
- package/dist/internal/cli-gitlab.js +5 -5
- package/dist/internal/continuation-identity.d.ts +2 -0
- package/dist/internal/continuation-identity.d.ts.map +1 -1
- package/dist/internal/continuation-identity.js +4 -0
- package/dist/internal/conversation-mirror.d.ts +9 -38
- package/dist/internal/conversation-mirror.d.ts.map +1 -1
- package/dist/internal/conversation-mirror.js +62 -68
- package/dist/internal/cursor/account-mcp.d.ts +1 -1
- package/dist/internal/cursor/account-mcp.js +1 -1
- package/dist/internal/cursor/backend-client.js +1 -1
- package/dist/internal/cursor/github-credentials.js +3 -3
- package/dist/internal/cursor/hosted-bound-secrets.d.ts +6 -2
- package/dist/internal/cursor/hosted-bound-secrets.d.ts.map +1 -1
- package/dist/internal/cursor/hosted-bound-secrets.js +13 -2
- package/dist/internal/cursor/hosted-store-secrets.d.ts +13 -37
- package/dist/internal/cursor/hosted-store-secrets.d.ts.map +1 -1
- package/dist/internal/cursor/hosted-store-secrets.js +13 -37
- package/dist/internal/cursor/store-api-client.d.ts +17 -39
- package/dist/internal/cursor/store-api-client.d.ts.map +1 -1
- package/dist/internal/cursor/store-api-client.js +15 -37
- package/dist/internal/cursor-deployment-relay.js +3 -3
- package/dist/internal/cursor-event-relay.js +1 -1
- package/dist/internal/cursor-relay-core.d.ts +1 -1
- package/dist/internal/cursor-relay-core.d.ts.map +1 -1
- package/dist/internal/deploy-client.d.ts +55 -63
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +48 -28
- package/dist/internal/discovery/agent.d.ts +1 -1
- package/dist/internal/discovery/agent.d.ts.map +1 -1
- package/dist/internal/discovery/agent.js +4 -0
- package/dist/internal/discovery/extensions.d.ts +2 -1
- package/dist/internal/discovery/extensions.d.ts.map +1 -1
- package/dist/internal/discovery/extensions.js +11 -1
- package/dist/internal/discovery/project.d.ts.map +1 -1
- package/dist/internal/discovery/project.js +1 -0
- package/dist/internal/distribution.d.ts +2 -2
- package/dist/internal/distribution.d.ts.map +1 -1
- package/dist/internal/distribution.js +2 -2
- package/dist/internal/docs-site.js +3 -3
- package/dist/internal/eval-run-store.js +8 -8
- package/dist/internal/framework-file-storage.d.ts +10 -34
- package/dist/internal/framework-file-storage.d.ts.map +1 -1
- package/dist/internal/framework-file-storage.js +12 -39
- package/dist/internal/framework-storage-selection.d.ts +10 -46
- package/dist/internal/framework-storage-selection.d.ts.map +1 -1
- package/dist/internal/framework-storage-selection.js +15 -64
- package/dist/internal/github-fanout.js +2 -2
- package/dist/internal/handleAgentServeTrigger.d.ts +5 -8
- package/dist/internal/handleAgentServeTrigger.d.ts.map +1 -1
- package/dist/internal/handleAgentServeTrigger.js +5 -8
- package/dist/internal/host-files.js +6 -9
- package/dist/internal/host-platforms.js +5 -5
- package/dist/internal/hosted-catch.d.ts +3 -2
- package/dist/internal/hosted-catch.d.ts.map +1 -1
- package/dist/internal/hosted-catch.js +27 -9
- package/dist/internal/hosted-delivery-protocol.d.ts +31 -8
- package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
- package/dist/internal/hosted-delivery-protocol.js +102 -1
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +32 -12
- package/dist/internal/hosted-execution-diag.d.ts +13 -24
- package/dist/internal/hosted-execution-diag.d.ts.map +1 -1
- package/dist/internal/hosted-execution-diag.js +11 -20
- package/dist/internal/hosted-execution-flush.d.ts +22 -10
- package/dist/internal/hosted-execution-flush.d.ts.map +1 -1
- package/dist/internal/hosted-execution-flush.js +45 -9
- package/dist/internal/hosted-managed-automation.js +5 -5
- package/dist/internal/hosting.d.ts +5 -10
- package/dist/internal/hosting.d.ts.map +1 -1
- package/dist/internal/hosting.js +5 -10
- package/dist/internal/legacy-command-guard.d.ts +1 -4
- package/dist/internal/legacy-command-guard.d.ts.map +1 -1
- package/dist/internal/legacy-command-guard.js +2 -11
- package/dist/internal/listen-port.js +1 -1
- package/dist/internal/local-control-plane.js +6 -6
- package/dist/internal/logs-client.d.ts +20 -1
- package/dist/internal/logs-client.d.ts.map +1 -1
- package/dist/internal/logs-client.js +89 -1
- package/dist/internal/mcp-endpoint.js +1 -1
- package/dist/internal/otel/collector.js +1 -1
- package/dist/internal/otel/runtime.js +13 -13
- package/dist/internal/platform-schedule-sync.js +2 -2
- package/dist/internal/playground/toolchain.js +6 -6
- package/dist/internal/process-memory-telemetry.js +2 -2
- package/dist/internal/reminder-runner.d.ts +8 -3
- package/dist/internal/reminder-runner.d.ts.map +1 -1
- package/dist/internal/reminder-runner.js +51 -52
- package/dist/internal/resolve-prod-target.d.ts +1 -12
- package/dist/internal/resolve-prod-target.d.ts.map +1 -1
- package/dist/internal/resolve-prod-target.js +2 -32
- package/dist/internal/resolved-connections.js +8 -8
- package/dist/internal/run-client.d.ts +4 -3
- package/dist/internal/run-client.d.ts.map +1 -1
- package/dist/internal/run-client.js +98 -61
- package/dist/internal/runtime-dispatch-runner.d.ts +1 -0
- package/dist/internal/runtime-dispatch-runner.d.ts.map +1 -1
- package/dist/internal/runtime-dispatch-runner.js +7 -1
- package/dist/internal/schedule-runner.js +1 -1
- package/dist/internal/sdk-runner.d.ts +4 -0
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +37 -22
- package/dist/internal/server.d.ts +2 -0
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +39 -38
- package/dist/internal/session-engine.d.ts +40 -44
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +108 -97
- package/dist/internal/session-run-log.d.ts +10 -24
- package/dist/internal/session-run-log.d.ts.map +1 -1
- package/dist/internal/session-run-log.js +13 -27
- package/dist/internal/sessions-client.d.ts.map +1 -1
- package/dist/internal/sessions-client.js +6 -3
- package/dist/internal/skills-sync.d.ts +3 -5
- package/dist/internal/skills-sync.d.ts.map +1 -1
- package/dist/internal/skills-sync.js +3 -5
- package/dist/internal/start-log-store.d.ts +7 -18
- package/dist/internal/start-log-store.d.ts.map +1 -1
- package/dist/internal/start-log-store.js +47 -24
- package/dist/internal/storage-coordinator.d.ts +7 -10
- package/dist/internal/storage-coordinator.d.ts.map +1 -1
- package/dist/internal/storage-coordinator.js +18 -20
- package/dist/internal/storage-roles.d.ts +5 -0
- package/dist/internal/storage-roles.d.ts.map +1 -1
- package/dist/internal/store-api-protocol.d.ts +12 -33
- package/dist/internal/store-api-protocol.d.ts.map +1 -1
- package/dist/internal/store-api-protocol.js +6 -22
- package/dist/internal/store-mirror.d.ts +4 -5
- package/dist/internal/store-mirror.d.ts.map +1 -1
- package/dist/internal/store-mirror.js +6 -8
- package/dist/internal/turn-cost.d.ts.map +1 -1
- package/dist/internal/turn-cost.js +31 -18
- package/dist/internal/turn-lease-store.d.ts +12 -5
- package/dist/internal/turn-lease-store.d.ts.map +1 -1
- package/dist/internal/turn-lease-store.js +61 -8
- package/dist/internal/v2-hosting.d.ts +4 -7
- package/dist/internal/v2-hosting.d.ts.map +1 -1
- package/dist/internal/v2-hosting.js +4 -7
- package/dist/internal/workspace-sync.d.ts +3 -6
- package/dist/internal/workspace-sync.d.ts.map +1 -1
- package/dist/internal/workspace-sync.js +3 -6
- package/dist/internal/workspace.d.ts +10 -16
- package/dist/internal/workspace.d.ts.map +1 -1
- package/dist/internal/workspace.js +9 -14
- package/dist/memory.d.ts +17 -43
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +34 -80
- package/dist/playground/assets/index-DPKLl4C_.css +1 -0
- package/dist/playground/assets/index-MijLHTbB.js +71 -0
- package/dist/playground/index.html +2 -2
- package/dist/storage-backends/cursor-hosted-v2.d.ts +8 -36
- package/dist/storage-backends/cursor-hosted-v2.d.ts.map +1 -1
- package/dist/storage-backends/cursor-hosted-v2.js +9 -37
- package/dist/storage-backends/cursor-hosted.d.ts +17 -30
- package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/storage-backends/cursor-hosted.js +14 -27
- package/dist/storage-protocol.d.ts +13 -38
- package/dist/storage-protocol.d.ts.map +1 -1
- package/dist/storage-protocol.js +14 -39
- package/dist/types.d.ts +29 -30
- package/dist/types.d.ts.map +1 -1
- package/docs/reference/cli.md +20 -9
- package/package.json +1 -1
- package/templates/pr-autofixer/bot/instructions.md +3 -3
- package/dist/docs/assets/chunks/@localSearchIndexroot.Bq-pxRXm.js +0 -1
- package/dist/docs/assets/chunks/channel.DCU8W1RP.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.DwpXsM06.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.DwpXsM06.js +0 -1
- package/dist/docs/assets/chunks/clone.DH6Mx2zB.js +0 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.kzD0-U89.js +0 -1
- package/dist/docs/assets/reference_cli.md.BsgDqYPh.lean.js +0 -1
- package/dist/playground/assets/index-6BbTPnaT.css +0 -1
- package/dist/playground/assets/index-CI7FAmOP.js +0 -71
|
@@ -48,7 +48,7 @@ import { mergeCloudOptions, resolveSessionRuntime } from "./cloud-merge.js";
|
|
|
48
48
|
import { applyCloudUsageToEvents, cloudSdkAgentIdFromEvents, isUnpricedCompletedTurn, mapSdkTokenUsage, } from "./cloud-turn-cost.js";
|
|
49
49
|
import { resolveConnectionEnvTemplates } from "./connection-env.js";
|
|
50
50
|
import { applyAgentContinuationDefaults, channelContinuationIdentity, httpContinuationIdentity, } from "./continuation-channel.js";
|
|
51
|
-
import { continuationSource, resolveV2Key, V2EngineError } from "./continuation-identity.js";
|
|
51
|
+
import { continuationSource, isOneShotContinuationKey, resolveV2Key, V2EngineError, } from "./continuation-identity.js";
|
|
52
52
|
import { describeError, describeErrorCode } from "./describe-error.js";
|
|
53
53
|
import { isDevMode } from "./dev-mode.js";
|
|
54
54
|
import { EventLogStore } from "./event-log.js";
|
|
@@ -76,7 +76,7 @@ import { steeringEnabled } from "./steering.js";
|
|
|
76
76
|
import { StorageCoordinator, isTurnBoundaryEvent } from "./storage-coordinator.js";
|
|
77
77
|
import { decideToolCall, directCallEffect } from "./tool-policy.js";
|
|
78
78
|
import { normalizeToolResult, toolCallErrorMessage } from "./tool-result.js";
|
|
79
|
-
import { estimateTurnCostFromApi, roundCostUsd } from "./turn-cost.js";
|
|
79
|
+
import { estimateTurnCostFromApi, roundCostUsd, } from "./turn-cost.js";
|
|
80
80
|
import { TurnGovernor } from "./turn-governor.js";
|
|
81
81
|
import { TurnLeaseStore } from "./turn-lease-store.js";
|
|
82
82
|
import { TurnOutbox } from "./turn-outbox.js";
|
|
@@ -213,7 +213,7 @@ export class SessionEngine {
|
|
|
213
213
|
var _a, _b, _c, _d, _e;
|
|
214
214
|
/** In-flight lazy restores, deduped per channel + continuation key. */
|
|
215
215
|
this.restoreInFlight = new Map();
|
|
216
|
-
/** In-flight authored
|
|
216
|
+
/** In-flight authored-file syncs for cloud turns. */
|
|
217
217
|
this.cloudSyncs = new Map();
|
|
218
218
|
this.channelsById = new Map();
|
|
219
219
|
/** Sessions with a turn being admitted (before the run promise exists). */
|
|
@@ -297,7 +297,7 @@ export class SessionEngine {
|
|
|
297
297
|
this.askDedupe = new SlackAskDedupeStore(join(options.stateRoot, "slack-asks"));
|
|
298
298
|
this.turnLeases = new TurnLeaseStore(join(options.stateRoot, "turn-leases"));
|
|
299
299
|
this.outbox = new TurnOutbox(join(options.stateRoot, "outbox"));
|
|
300
|
-
this.logs = new EventLogStore(sessionId => this.sessions.eventFilePath(sessionId), (sessionId, error) => this.logger(`[
|
|
300
|
+
this.logs = new EventLogStore(sessionId => this.sessions.eventFilePath(sessionId), (sessionId, error) => this.logger(`[bdk] failed to persist events for ${sessionId}: ${describeError(error)}`));
|
|
301
301
|
// Framework session state (records, event chunks, continuations) is
|
|
302
302
|
// mirrored to whatever this selects; see framework-storage-selection.ts
|
|
303
303
|
// for why the choice does not belong to the agent author.
|
|
@@ -335,9 +335,9 @@ export class SessionEngine {
|
|
|
335
335
|
config: options.project.artifacts,
|
|
336
336
|
sink: managedV2Files === null || managedV2Files === void 0 ? void 0 : managedV2Files(),
|
|
337
337
|
// v1 and self-hosted v2 still evict oldest-updated rows past max.
|
|
338
|
-
//
|
|
339
|
-
//
|
|
340
|
-
//
|
|
338
|
+
// Managed v2 leaves retention to the platform, so tagging never scans
|
|
339
|
+
// the full artifact set. Resolve this for each tag so hosting changes
|
|
340
|
+
// take effect without recreating the store.
|
|
341
341
|
enforceCap: () => {
|
|
342
342
|
const hosting = resolveAgentV2Hosting({
|
|
343
343
|
architecture: options.project.agent.architecture,
|
|
@@ -644,8 +644,7 @@ export class SessionEngine {
|
|
|
644
644
|
if (isDuringHostedAdmission()) {
|
|
645
645
|
// Only sends that bypassed the admission capture stub (typically a
|
|
646
646
|
// startup-captured `onStart` send) reach the engine inside the
|
|
647
|
-
// admission window; running one would
|
|
648
|
-
// on a sessionless pod.
|
|
647
|
+
// admission window; running one would create an invisible local session.
|
|
649
648
|
throw new HostedAdmissionLocalSendError();
|
|
650
649
|
}
|
|
651
650
|
if (options.clearCloudOverride === true && options.cloud !== undefined) {
|
|
@@ -662,7 +661,7 @@ export class SessionEngine {
|
|
|
662
661
|
}
|
|
663
662
|
const cKey = resolveV2Key(identity, options);
|
|
664
663
|
sendOptions = Object.assign(Object.assign({}, options), { continuationToken: cKey });
|
|
665
|
-
skipContinuationLookup = cKey
|
|
664
|
+
skipContinuationLookup = isOneShotContinuationKey(cKey);
|
|
666
665
|
}
|
|
667
666
|
const auth = (_c = sendOptions.auth) !== null && _c !== void 0 ? _c : null;
|
|
668
667
|
let existing = skipContinuationLookup || sendOptions.continuationToken === undefined
|
|
@@ -678,9 +677,9 @@ export class SessionEngine {
|
|
|
678
677
|
if (existing === undefined && sendOptions.hostedSessionId !== undefined) {
|
|
679
678
|
const byId = yield this.getOrRestoreSession(sendOptions.hostedSessionId);
|
|
680
679
|
if (byId !== undefined) {
|
|
681
|
-
//
|
|
682
|
-
//
|
|
683
|
-
//
|
|
680
|
+
// The same hostedSessionId signals a delivery retry. An explicit
|
|
681
|
+
// resume keeps the original key so a PR lane remains addressable by
|
|
682
|
+
// its webhooks.
|
|
684
683
|
if (byId.continuationKey !== sendOptions.continuationToken &&
|
|
685
684
|
((_a = sendOptions.mailboxContinuation) === null || _a === void 0 ? void 0 : _a.key) !==
|
|
686
685
|
hostedSessionResumeKey(sendOptions.hostedSessionId)) {
|
|
@@ -1195,9 +1194,8 @@ export class SessionEngine {
|
|
|
1195
1194
|
if (this.turnAborts.get(sessionId) === abort) {
|
|
1196
1195
|
this.turnAborts.delete(sessionId);
|
|
1197
1196
|
}
|
|
1198
|
-
// Failed
|
|
1199
|
-
//
|
|
1200
|
-
// same follow-ups as full deliveries.
|
|
1197
|
+
// Failed or cancelled owners must not start a coalesced successor;
|
|
1198
|
+
// managed delivery retries the same follow-ups.
|
|
1201
1199
|
if (wasCurrent && !abort.signal.aborted && outcome.status === "finished") {
|
|
1202
1200
|
const drain = this.drainCoalescedFollowups(sessionId).catch(error => {
|
|
1203
1201
|
this.logger(`[session] coalesce drain failed for ${sessionId}: ${describeError(error)}`);
|
|
@@ -1629,11 +1627,11 @@ export class SessionEngine {
|
|
|
1629
1627
|
// that cannot warm resolves cleanly, and logging success there would
|
|
1630
1628
|
// tell an operator the workspace is hot when nothing touched it.
|
|
1631
1629
|
this.logger(outcome.warmed
|
|
1632
|
-
? `[
|
|
1633
|
-
: `[
|
|
1630
|
+
? `[bdk] warmed ${workspaceDir} in ${Date.now() - startedAt}ms`
|
|
1631
|
+
: `[bdk] did not warm ${workspaceDir}: ${outcome.reason}`);
|
|
1634
1632
|
}
|
|
1635
1633
|
catch (error) {
|
|
1636
|
-
this.logger(`[
|
|
1634
|
+
this.logger(`[bdk] could not warm ${workspaceDir}: ${describeError(error)}`);
|
|
1637
1635
|
}
|
|
1638
1636
|
});
|
|
1639
1637
|
}
|
|
@@ -1668,7 +1666,7 @@ export class SessionEngine {
|
|
|
1668
1666
|
this.queueDispatch(sessionId, event, eventContext);
|
|
1669
1667
|
}
|
|
1670
1668
|
catch (error) {
|
|
1671
|
-
this.logger(`[
|
|
1669
|
+
this.logger(`[bdk] failed to record event for ${sessionId}: ${describeError(error)}`);
|
|
1672
1670
|
}
|
|
1673
1671
|
};
|
|
1674
1672
|
// Read by closure, so the mapper still sees it while draining after the
|
|
@@ -1811,27 +1809,23 @@ export class SessionEngine {
|
|
|
1811
1809
|
}
|
|
1812
1810
|
const finalResult = (_d = outcome.result) !== null && _d !== void 0 ? _d : mapper.finalText;
|
|
1813
1811
|
const finalUsage = (_e = outcome.usage) !== null && _e !== void 0 ? _e : mapper.usage;
|
|
1814
|
-
const finalCost = finalUsage === undefined
|
|
1815
|
-
? undefined
|
|
1816
|
-
: yield this.estimateTurnCost({
|
|
1817
|
-
model: (_f = this.project.agent.model) !== null && _f !== void 0 ? _f : DEFAULT_MODEL,
|
|
1818
|
-
usage: finalUsage,
|
|
1819
|
-
agentId: record.sdkAgentId,
|
|
1820
|
-
conversationId: (_g = record.sdkAgentId) !== null && _g !== void 0 ? _g : sessionId,
|
|
1821
|
-
});
|
|
1822
|
-
if (finalCost !== undefined) {
|
|
1823
|
-
outcome = Object.assign(Object.assign({}, outcome), { cost: finalCost });
|
|
1824
|
-
}
|
|
1825
1812
|
if (outcome.status === "finished") {
|
|
1826
|
-
yield this.appendEvent(sessionId, {
|
|
1813
|
+
const completed = yield this.appendEvent(sessionId, {
|
|
1827
1814
|
type: "turn.completed",
|
|
1828
1815
|
turnId,
|
|
1829
1816
|
data: {
|
|
1830
1817
|
result: finalResult,
|
|
1831
1818
|
usage: finalUsage,
|
|
1832
|
-
cost: finalCost,
|
|
1833
1819
|
},
|
|
1834
1820
|
}, eventContext);
|
|
1821
|
+
if (finalUsage !== undefined) {
|
|
1822
|
+
this.stampTurnCost(sessionId, completed, {
|
|
1823
|
+
model: (_f = this.project.agent.model) !== null && _f !== void 0 ? _f : DEFAULT_MODEL,
|
|
1824
|
+
usage: finalUsage,
|
|
1825
|
+
agentId: record.sdkAgentId,
|
|
1826
|
+
conversationId: (_g = record.sdkAgentId) !== null && _g !== void 0 ? _g : sessionId,
|
|
1827
|
+
});
|
|
1828
|
+
}
|
|
1835
1829
|
}
|
|
1836
1830
|
else {
|
|
1837
1831
|
const interrupted = signal.aborted && outcome.status === "cancelled";
|
|
@@ -1878,12 +1872,8 @@ export class SessionEngine {
|
|
|
1878
1872
|
});
|
|
1879
1873
|
}
|
|
1880
1874
|
/**
|
|
1881
|
-
* Sync authored skills
|
|
1882
|
-
*
|
|
1883
|
-
* before the first cloud prompt, so `--agent-store-skills-dir` and the
|
|
1884
|
-
* first-turn S3 scan can discover them. False when the sync fails: the
|
|
1885
|
-
* turn then runs without store skills rather than pointing discovery at
|
|
1886
|
-
* paths that do not exist.
|
|
1875
|
+
* Sync authored skills to cloud-turn storage before the first prompt.
|
|
1876
|
+
* Returns false on failure so the turn runs without unavailable skills.
|
|
1887
1877
|
*/
|
|
1888
1878
|
ensureCloudSkillsSynced(store) {
|
|
1889
1879
|
const skills = this.project.agent.skills;
|
|
@@ -1895,10 +1885,7 @@ export class SessionEngine {
|
|
|
1895
1885
|
}));
|
|
1896
1886
|
}
|
|
1897
1887
|
/**
|
|
1898
|
-
* Sync
|
|
1899
|
-
* `workspace/…` (hosted) or `agent-serve/<agent>/workspace/…`
|
|
1900
|
-
* (personal-key local+cloud) before the first cloud prompt, which names
|
|
1901
|
-
* the mounted directory (see buildCloudWorkspaceSection).
|
|
1888
|
+
* Sync authored workspace seeds before the first cloud prompt.
|
|
1902
1889
|
*/
|
|
1903
1890
|
ensureCloudWorkspaceSynced(store) {
|
|
1904
1891
|
const seedFiles = this.project.agent.seedFiles;
|
|
@@ -1911,7 +1898,7 @@ export class SessionEngine {
|
|
|
1911
1898
|
/**
|
|
1912
1899
|
* Replace this session's store prefix with the pending `workspaceFiles`.
|
|
1913
1900
|
* Undefined when the write did not land; the prompt must not name the
|
|
1914
|
-
*
|
|
1901
|
+
* directory, matching ensureCloudWorkspaceSynced.
|
|
1915
1902
|
*/
|
|
1916
1903
|
syncCloudSessionWorkspaceFiles(store, sessionId, files) {
|
|
1917
1904
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1960,15 +1947,10 @@ export class SessionEngine {
|
|
|
1960
1947
|
}
|
|
1961
1948
|
/**
|
|
1962
1949
|
* With files authored, every first cloud turn re-copies the authored
|
|
1963
|
-
* bytes
|
|
1964
|
-
*
|
|
1965
|
-
*
|
|
1966
|
-
*
|
|
1967
|
-
* the same way local materialization always rewrites skills. Without
|
|
1968
|
-
* authored files the sync is best-effort stale cleanup and one attempt
|
|
1969
|
-
* per process is enough, success or not — a deployment without the files
|
|
1970
|
-
* surface must not fail and log on every new session for a feature it
|
|
1971
|
-
* does not use.
|
|
1950
|
+
* bytes; the memo only dedupes concurrent first turns. Cloud sessions can
|
|
1951
|
+
* edit their view, so re-syncing keeps later sessions true to discovery.
|
|
1952
|
+
* Without authored files, one best-effort cleanup attempt per process is
|
|
1953
|
+
* enough.
|
|
1972
1954
|
*/
|
|
1973
1955
|
syncToCloudStore(surface, store, authored, run) {
|
|
1974
1956
|
const inFlight = this.cloudSyncs.get(surface);
|
|
@@ -1988,11 +1970,9 @@ export class SessionEngine {
|
|
|
1988
1970
|
return sync;
|
|
1989
1971
|
}
|
|
1990
1972
|
/**
|
|
1991
|
-
*
|
|
1992
|
-
*
|
|
1993
|
-
*
|
|
1994
|
-
* its state directory is the durable copy, and its service-account key
|
|
1995
|
-
* must not be mistaken for a personal one.
|
|
1973
|
+
* Managed ephemeral deployments use deployment-scoped storage. Local cloud
|
|
1974
|
+
* turns use user-scoped storage. Persistent managed deployments use their
|
|
1975
|
+
* durable state directory instead.
|
|
1996
1976
|
*/
|
|
1997
1977
|
cloudStore() {
|
|
1998
1978
|
const v2Hosting = resolveAgentV2Hosting({
|
|
@@ -2116,12 +2096,10 @@ export class SessionEngine {
|
|
|
2116
2096
|
turnPrompt = `${contextBlock}\n\n${prompt}`;
|
|
2117
2097
|
}
|
|
2118
2098
|
if (runtime === "cloud") {
|
|
2119
|
-
// Cloud
|
|
2120
|
-
// including agent tool script bodies. Authored skills
|
|
2121
|
-
//
|
|
2122
|
-
//
|
|
2123
|
-
// the session prefix, and on hosted deployments the shared memory
|
|
2124
|
-
// journal is on that mount too — say where. When the turn carries
|
|
2099
|
+
// Cloud turns have no materialized workspace, so ship the full context,
|
|
2100
|
+
// including agent tool script bodies. Authored skills, workspace seeds,
|
|
2101
|
+
// per-turn workspaceFiles, and shared memory use managed paths that the
|
|
2102
|
+
// prompt names when available. When the turn carries
|
|
2125
2103
|
// the session-bound server-tool MCP endpoint, the preamble catalogs
|
|
2126
2104
|
// server tools under that MCP server name *before* the agent-tool
|
|
2127
2105
|
// "write the script if missing" recipe, so a model told to "use
|
|
@@ -2148,7 +2126,7 @@ export class SessionEngine {
|
|
|
2148
2126
|
this.ensureCloudSkillsSynced(store),
|
|
2149
2127
|
this.ensureCloudWorkspaceSynced(store),
|
|
2150
2128
|
]);
|
|
2151
|
-
// Only name the
|
|
2129
|
+
// Only name the directory when the bytes landed; a failed sync must
|
|
2152
2130
|
// not send the model looking for files that are not there.
|
|
2153
2131
|
if (seedsSynced && agent.seedFiles.length > 0) {
|
|
2154
2132
|
sections.push(buildCloudWorkspaceSection(`${store.mountPath}/${store.workspacePrefix}`));
|
|
@@ -2174,7 +2152,7 @@ export class SessionEngine {
|
|
|
2174
2152
|
}
|
|
2175
2153
|
}
|
|
2176
2154
|
else if (isFirstTurn && runtime === "local" && authoredRoot) {
|
|
2177
|
-
// The harness reports no path for a root it never
|
|
2155
|
+
// The harness reports no path for a root it never materialized.
|
|
2178
2156
|
turnPrompt = `<user_info>\nWorkspace Path: /\n</user_info>\n\n${turnPrompt}`;
|
|
2179
2157
|
}
|
|
2180
2158
|
// A virtual root has no scaffold dir either, so its catalog carries the
|
|
@@ -3197,8 +3175,7 @@ export class SessionEngine {
|
|
|
3197
3175
|
throw error;
|
|
3198
3176
|
}
|
|
3199
3177
|
// A session's harness cwd can be a path the serving process cannot
|
|
3200
|
-
// create
|
|
3201
|
-
// where the sandboxed harness would have made it). Read-effect calls
|
|
3178
|
+
// create in a managed runtime. Read-effect calls
|
|
3202
3179
|
// fall back to a scratch workspace instead of failing: tools that
|
|
3203
3180
|
// resolve their state from the session identity (VFS mounts) never
|
|
3204
3181
|
// touch ctx.workspaceDir. Advertised passthroughs are relocatable by
|
|
@@ -3478,7 +3455,7 @@ export class SessionEngine {
|
|
|
3478
3455
|
const next = chain
|
|
3479
3456
|
.then(() => this.dispatchEvent(sessionId, event, context))
|
|
3480
3457
|
.catch(error => {
|
|
3481
|
-
this.logger(`[
|
|
3458
|
+
this.logger(`[bdk] event dispatch failed for ${sessionId}: ${describeError(error)}`);
|
|
3482
3459
|
})
|
|
3483
3460
|
.then(() => {
|
|
3484
3461
|
var _a;
|
|
@@ -3528,7 +3505,7 @@ export class SessionEngine {
|
|
|
3528
3505
|
yield handler(event, channelCtx, sessionCtx);
|
|
3529
3506
|
}
|
|
3530
3507
|
catch (error) {
|
|
3531
|
-
this.logger(`[
|
|
3508
|
+
this.logger(`[bdk] channel "${record.channelId}" handler for ${event.type} threw: ${describeError(error)}`);
|
|
3532
3509
|
}
|
|
3533
3510
|
}
|
|
3534
3511
|
if (context !== undefined) {
|
|
@@ -3564,7 +3541,7 @@ export class SessionEngine {
|
|
|
3564
3541
|
}, channelState, stateRoot: this.stateRoot }));
|
|
3565
3542
|
}
|
|
3566
3543
|
catch (error) {
|
|
3567
|
-
this.logger(`[
|
|
3544
|
+
this.logger(`[bdk] hook "${hook.name}" handler for ${event.type} threw: ${describeError(error)}`);
|
|
3568
3545
|
}
|
|
3569
3546
|
}
|
|
3570
3547
|
}
|
|
@@ -3583,21 +3560,24 @@ export class SessionEngine {
|
|
|
3583
3560
|
// ==========================================================================
|
|
3584
3561
|
/**
|
|
3585
3562
|
* Wait until everything this session has already emitted is durably
|
|
3586
|
-
* mirrored:
|
|
3587
|
-
* storage flush, so the record
|
|
3588
|
-
* mutations), then the storage
|
|
3589
|
-
*
|
|
3590
|
-
*
|
|
3591
|
-
*
|
|
3592
|
-
*
|
|
3593
|
-
* storage mirror.
|
|
3563
|
+
* mirrored: the runner's conversation mirror write, then its dispatch
|
|
3564
|
+
* chain (the chain's tail runs the turn-end storage flush, so the record
|
|
3565
|
+
* carries the boundary event's handler mutations), then the storage
|
|
3566
|
+
* delivery queue. Managed hosting awaits this before the execution reply
|
|
3567
|
+
* because the process may stop as soon as the reply lands. An unflushed
|
|
3568
|
+
* record would strand an otherwise persisted conversation. The storage
|
|
3569
|
+
* steps are no-ops without a storage mirror.
|
|
3594
3570
|
*
|
|
3595
3571
|
* Under a debounced event policy the turn-end flush is a timer, not the
|
|
3596
|
-
* chain's tail, so flush explicitly before waiting on the queue
|
|
3597
|
-
*
|
|
3572
|
+
* chain's tail, so flush explicitly before waiting on the queue. The flush
|
|
3573
|
+
* is exact: turn-end flushes skip records where only `turnCount` /
|
|
3574
|
+
* `updatedAt` moved, and close() may never run to repair them, which would
|
|
3575
|
+
* leave the durable turn count stale.
|
|
3598
3576
|
*/
|
|
3599
3577
|
drainSessionDurability(sessionId) {
|
|
3600
3578
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3579
|
+
var _a, _b;
|
|
3580
|
+
yield (_b = (_a = this.runner).drainConversation) === null || _b === void 0 ? void 0 : _b.call(_a, sessionId);
|
|
3601
3581
|
if (this.storage === undefined) {
|
|
3602
3582
|
return;
|
|
3603
3583
|
}
|
|
@@ -3605,7 +3585,7 @@ export class SessionEngine {
|
|
|
3605
3585
|
if (chain !== undefined) {
|
|
3606
3586
|
yield chain.catch(() => { });
|
|
3607
3587
|
}
|
|
3608
|
-
this.storage.
|
|
3588
|
+
this.storage.flushSessionExact(sessionId);
|
|
3609
3589
|
yield this.storage.whenIdle();
|
|
3610
3590
|
});
|
|
3611
3591
|
}
|
|
@@ -3645,9 +3625,9 @@ export class SessionEngine {
|
|
|
3645
3625
|
* schedule/task sessions, other callers). The route auth chain still
|
|
3646
3626
|
* gates who may call this at all.
|
|
3647
3627
|
*
|
|
3648
|
-
* When the project uses `cursorHostedStorage`, prefers
|
|
3649
|
-
*
|
|
3650
|
-
* local `--state-root` store when the sink is unavailable.
|
|
3628
|
+
* When the project uses `cursorHostedStorage`, prefers Cursor-managed
|
|
3629
|
+
* durable records, merged with any newer local records not flushed yet.
|
|
3630
|
+
* Falls back to the local `--state-root` store when the sink is unavailable.
|
|
3651
3631
|
*/
|
|
3652
3632
|
listSessions(caller, options) {
|
|
3653
3633
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -3711,7 +3691,7 @@ export class SessionEngine {
|
|
|
3711
3691
|
}
|
|
3712
3692
|
/**
|
|
3713
3693
|
* Same as {@link listSessions}, plus which store answered
|
|
3714
|
-
* (`cursor-hosted` = durable
|
|
3694
|
+
* (`cursor-hosted` = Cursor-managed durable storage; `local` =
|
|
3715
3695
|
* `--state-root`).
|
|
3716
3696
|
*/
|
|
3717
3697
|
listSessionsWithSource(caller, options) {
|
|
@@ -3728,7 +3708,7 @@ export class SessionEngine {
|
|
|
3728
3708
|
};
|
|
3729
3709
|
}
|
|
3730
3710
|
catch (error) {
|
|
3731
|
-
this.logger(`[
|
|
3711
|
+
this.logger(`[bdk] cursor-hosted session list failed; falling back to local: ${describeError(error)}`);
|
|
3732
3712
|
}
|
|
3733
3713
|
}
|
|
3734
3714
|
const records = yield this.sessions.list();
|
|
@@ -3789,7 +3769,7 @@ export class SessionEngine {
|
|
|
3789
3769
|
}
|
|
3790
3770
|
}
|
|
3791
3771
|
catch (error) {
|
|
3792
|
-
this.logger(`[
|
|
3772
|
+
this.logger(`[bdk] cursor-hosted newest-session lookup failed; falling back to the full list: ${describeError(error)}`);
|
|
3793
3773
|
}
|
|
3794
3774
|
}
|
|
3795
3775
|
const listed = yield this.listSessionsWithSource(caller, options);
|
|
@@ -3901,6 +3881,37 @@ export class SessionEngine {
|
|
|
3901
3881
|
});
|
|
3902
3882
|
});
|
|
3903
3883
|
}
|
|
3884
|
+
/**
|
|
3885
|
+
* Cost is a display figure resolved over the network, and the session holds
|
|
3886
|
+
* its delivery lease until `turn.completed`, so it is stamped onto the
|
|
3887
|
+
* recorded event afterwards rather than delaying the event. A host that
|
|
3888
|
+
* stops before the estimate lands leaves the turn unpriced; `sessionCost`
|
|
3889
|
+
* prices the session on read.
|
|
3890
|
+
*/
|
|
3891
|
+
stampTurnCost(sessionId, completed, input) {
|
|
3892
|
+
void this.priceTurn(input)
|
|
3893
|
+
.then((cost) => __awaiter(this, void 0, void 0, function* () {
|
|
3894
|
+
if (cost === undefined || completed.type !== "turn.completed") {
|
|
3895
|
+
return;
|
|
3896
|
+
}
|
|
3897
|
+
const log = yield this.logs.get(sessionId);
|
|
3898
|
+
log.replace(completed.index, Object.assign(Object.assign({}, completed), { data: Object.assign(Object.assign({}, completed.data), { cost }) }));
|
|
3899
|
+
}))
|
|
3900
|
+
.catch(error => {
|
|
3901
|
+
this.logger(`[bdk] turn cost stamp failed for ${sessionId}: ${describeError(error)}`);
|
|
3902
|
+
});
|
|
3903
|
+
}
|
|
3904
|
+
priceTurn(input) {
|
|
3905
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3906
|
+
try {
|
|
3907
|
+
return yield this.estimateTurnCost(input);
|
|
3908
|
+
}
|
|
3909
|
+
catch (error) {
|
|
3910
|
+
this.logger(`[bdk] turn cost estimate failed: ${describeError(error)}`);
|
|
3911
|
+
return undefined;
|
|
3912
|
+
}
|
|
3913
|
+
});
|
|
3914
|
+
}
|
|
3904
3915
|
/**
|
|
3905
3916
|
* Billed/catalog cost for a session. Powers playground, traces, and
|
|
3906
3917
|
* `agent-sdk cost` via `GET /v1/session/:id/cost`.
|
|
@@ -3988,7 +3999,7 @@ export class SessionEngine {
|
|
|
3988
3999
|
}
|
|
3989
4000
|
const work = this.runCloudTurnCostBackfill(sessionId)
|
|
3990
4001
|
.catch(error => {
|
|
3991
|
-
this.logger(`[
|
|
4002
|
+
this.logger(`[bdk] cloud cost backfill failed for ${sessionId}: ${describeError(error)}`);
|
|
3992
4003
|
})
|
|
3993
4004
|
.finally(() => {
|
|
3994
4005
|
this.cloudCostBackfill.delete(sessionId);
|
|
@@ -4137,7 +4148,7 @@ export class SessionEngine {
|
|
|
4137
4148
|
yield this.runBulkRestore(storage, policy);
|
|
4138
4149
|
}
|
|
4139
4150
|
catch (error) {
|
|
4140
|
-
this.logger(`[
|
|
4151
|
+
this.logger(`[bdk] session restore failed: ${describeError(error)}`);
|
|
4141
4152
|
}
|
|
4142
4153
|
});
|
|
4143
4154
|
}
|
|
@@ -4178,7 +4189,7 @@ export class SessionEngine {
|
|
|
4178
4189
|
return { record, events };
|
|
4179
4190
|
}
|
|
4180
4191
|
catch (error) {
|
|
4181
|
-
this.logger(`[
|
|
4192
|
+
this.logger(`[bdk] failed to restore session ${record.sessionId}: ${describeError(error)}`);
|
|
4182
4193
|
return undefined;
|
|
4183
4194
|
}
|
|
4184
4195
|
})));
|
|
@@ -4193,7 +4204,7 @@ export class SessionEngine {
|
|
|
4193
4204
|
const bytes = Buffer.byteLength(JSON.stringify(item.record), "utf8") +
|
|
4194
4205
|
(ndjson === undefined ? 0 : Buffer.byteLength(ndjson, "utf8"));
|
|
4195
4206
|
if (bytes > budget) {
|
|
4196
|
-
this.logger(`[
|
|
4207
|
+
this.logger(`[bdk] session restore stopped at the ${policy.maxTotalBytes}-byte budget after ${restored} session(s); remaining sessions restore lazily on resume`);
|
|
4197
4208
|
break outer;
|
|
4198
4209
|
}
|
|
4199
4210
|
try {
|
|
@@ -4202,19 +4213,19 @@ export class SessionEngine {
|
|
|
4202
4213
|
restored += 1;
|
|
4203
4214
|
}
|
|
4204
4215
|
catch (error) {
|
|
4205
|
-
this.logger(`[
|
|
4216
|
+
this.logger(`[bdk] failed to restore session ${item.record.sessionId}: ${describeError(error)}`);
|
|
4206
4217
|
}
|
|
4207
4218
|
}
|
|
4208
4219
|
}
|
|
4209
4220
|
if (restored > 0) {
|
|
4210
|
-
this.logger(`[
|
|
4221
|
+
this.logger(`[bdk] restored ${restored} session(s) from storage`);
|
|
4211
4222
|
}
|
|
4212
4223
|
});
|
|
4213
4224
|
}
|
|
4214
4225
|
/**
|
|
4215
4226
|
* Local session lookup with lazy restore by session id.
|
|
4216
4227
|
*
|
|
4217
|
-
* `GET /v1/sessions` (cursor-hosted) can list durable
|
|
4228
|
+
* `GET /v1/sessions` (cursor-hosted) can list durable records that were not
|
|
4218
4229
|
* bulk-restored into `--state-root` (restore caps, `restore: "off"`, or
|
|
4219
4230
|
* eval Open-trace by id). Events/stream/follow-up must materialize that
|
|
4220
4231
|
* one session before answering, or the playground shows an empty timeline
|
|
@@ -4299,11 +4310,11 @@ export class SessionEngine {
|
|
|
4299
4310
|
// The durable record's bookkeeping may lag the event stream (the
|
|
4300
4311
|
// storage coordinator skips volatile-only record rewrites, bounded).
|
|
4301
4312
|
// New turnIds mint from turnCount, so clamp it to the highest turn the
|
|
4302
|
-
// stream already used
|
|
4313
|
+
// stream already used; otherwise a replacement process re-mints turn_N ids
|
|
4303
4314
|
// and trajectory/cost grouping merges unrelated turns.
|
|
4304
4315
|
const restored = withTurnCountClampedToEvents(record, events);
|
|
4305
4316
|
yield this.materializeSession(restored, eventsNdjson(events));
|
|
4306
|
-
this.logger(`[
|
|
4317
|
+
this.logger(`[bdk] lazily restored session ${restored.sessionId} from storage`);
|
|
4307
4318
|
return restored;
|
|
4308
4319
|
});
|
|
4309
4320
|
}
|
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Durable
|
|
2
|
+
* Durable execution history for hosted architecture-v2 sessions.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* so last-write-wins merge is safe. Guest-local `hosted-execution.json` and
|
|
8
|
-
* factorydb `last_error` are lossy: the on-disk diag dies with the pod, and
|
|
9
|
-
* the session row only keeps the first 1024 characters of a generic HTTP
|
|
10
|
-
* 500.
|
|
11
|
-
*
|
|
12
|
-
* Process death: persist `running` at turn start so SIGKILL / OOM still
|
|
13
|
-
* leaves a durable leftover. `uncaughtException` / SIGTERM flush the same
|
|
14
|
-
* session key with `processDeath: true` and the real throw. Soft-fail on
|
|
15
|
-
* persist so a store outage never changes the hosted-execution HTTP reply.
|
|
16
|
-
*
|
|
17
|
-
* Same flush moments as `hosted-execution.json` and the start.log tee —
|
|
18
|
-
* see `hosted-execution-flush.ts`. Keys:
|
|
19
|
-
* {@link agentSdkStorageKeys.sessionRun}.
|
|
4
|
+
* Entries are session-scoped and bounded. The host writes a running entry at
|
|
5
|
+
* turn start, then records completion or process failure. Persistence errors
|
|
6
|
+
* never change the hosted execution response.
|
|
20
7
|
*/
|
|
21
8
|
import type { FileSink } from "../files.js";
|
|
22
9
|
import type { AgentProject } from "../types.js";
|
|
@@ -64,7 +51,7 @@ export type SessionRunLastFailure = {
|
|
|
64
51
|
error?: SessionRunLogError;
|
|
65
52
|
processDeath?: boolean;
|
|
66
53
|
};
|
|
67
|
-
/** One document per
|
|
54
|
+
/** One document per hosted session, read by the session history UI. */
|
|
68
55
|
export type SessionRunLogDocument = {
|
|
69
56
|
v: typeof SESSION_RUN_LOG_VERSION;
|
|
70
57
|
sessionPublicId: string;
|
|
@@ -87,8 +74,8 @@ export interface SessionRunLogStore {
|
|
|
87
74
|
flushProcessDeath(reason: Extract<SessionRunAbortReason, "process_exit" | "uncaught_exception" | "unhandled_rejection">, error?: unknown): Promise<void>;
|
|
88
75
|
}
|
|
89
76
|
/**
|
|
90
|
-
* Install the
|
|
91
|
-
*
|
|
77
|
+
* Install the process-level crash flush. One process has one active hosted
|
|
78
|
+
* server.
|
|
92
79
|
*/
|
|
93
80
|
export declare function registerSessionRunFatalFlush(flush: (error: unknown) => Promise<void>): void;
|
|
94
81
|
export declare function unregisterSessionRunFatalFlush(): void;
|
|
@@ -108,10 +95,9 @@ export declare function createSessionRunLogStore(input: {
|
|
|
108
95
|
snapshotLogs?: () => readonly LogRingEntry[];
|
|
109
96
|
}): SessionRunLogStore;
|
|
110
97
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* local disk / today's behavior.
|
|
98
|
+
* Enable durable execution history for architecture-v2 agents on
|
|
99
|
+
* Cursor-managed hosting. Self-hosted and architecture-v1 agents keep local
|
|
100
|
+
* behavior.
|
|
115
101
|
*/
|
|
116
102
|
export declare function selectSessionRunLogStore(input: {
|
|
117
103
|
project: AgentProject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-run-log.d.ts","sourceRoot":"","sources":["../../src/internal/session-run-log.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"session-run-log.d.ts","sourceRoot":"","sources":["../../src/internal/session-run-log.ts"],"names":[],"mappings":"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"}
|