@cursor/bdk 0.2.17 → 0.2.20

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.
Files changed (254) hide show
  1. package/AGENTS.md +16 -6
  2. package/dist/bin/agent-serve.js +7 -0
  3. package/dist/channels/runs/index.d.ts +4 -0
  4. package/dist/channels/runs/index.d.ts.map +1 -0
  5. package/dist/channels/runs/index.js +2 -0
  6. package/dist/channels/runs/runs-channel.d.ts +5 -0
  7. package/dist/channels/runs/runs-channel.d.ts.map +1 -0
  8. package/dist/channels/runs/runs-channel.js +34 -0
  9. package/dist/channels/runs/types.d.ts +34 -0
  10. package/dist/channels/runs/types.d.ts.map +1 -0
  11. package/dist/channels/runs/types.js +1 -0
  12. package/dist/channels/slack/slack-channel.d.ts +3 -2
  13. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  14. package/dist/channels/slack/slack-channel.js +9 -2
  15. package/dist/docs/404.html +2 -2
  16. package/dist/docs/assets/{app.CUNuFTSm.js → app.BzgJFr_T.js} +4 -4
  17. package/dist/docs/assets/chunks/@localSearchIndexroot.gGwBYU3d.js +1 -0
  18. package/dist/docs/assets/chunks/{VPLocalSearchBox.Dez74k0W.js → VPLocalSearchBox.Bn5QyUDM.js} +1 -1
  19. package/dist/docs/assets/chunks/{arc.CJ3FhK7H.js → arc.D734Gm5d.js} +1 -1
  20. package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.CfUdbHsa.js → architectureDiagram-Q4EWVU46.NX1jj-YX.js} +1 -1
  21. package/dist/docs/assets/chunks/{baseUniq.D93LawU9.js → baseUniq.nd8dxdeO.js} +1 -1
  22. package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.Zvsd6UHP.js → blockDiagram-DXYQGD6D.DG8faTim.js} +1 -1
  23. package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.CGX5xZ9d.js → c4Diagram-AHTNJAMY.zD31AJ3b.js} +1 -1
  24. package/dist/docs/assets/chunks/channel.DQLJQMi3.js +1 -0
  25. package/dist/docs/assets/chunks/{chunk-4BX2VUAB.CCIf0QCo.js → chunk-4BX2VUAB.BHQj6Rko.js} +1 -1
  26. package/dist/docs/assets/chunks/{chunk-4TB4RGXK.D_N1RPyi.js → chunk-4TB4RGXK.Cs38Yh16.js} +1 -1
  27. package/dist/docs/assets/chunks/{chunk-55IACEB6.B1oecjzx.js → chunk-55IACEB6.CFUR21JO.js} +1 -1
  28. package/dist/docs/assets/chunks/{chunk-EDXVE4YY.BzUNVPGX.js → chunk-EDXVE4YY.C80-Sneg.js} +1 -1
  29. package/dist/docs/assets/chunks/{chunk-FMBD7UC4.DheI8WSO.js → chunk-FMBD7UC4.CdT1MGza.js} +1 -1
  30. package/dist/docs/assets/chunks/{chunk-OYMX7WX6.Bg4iL0sM.js → chunk-OYMX7WX6.BctEzab0.js} +1 -1
  31. package/dist/docs/assets/chunks/{chunk-QZHKN3VN.CSQjDhAD.js → chunk-QZHKN3VN.DTneeX3k.js} +1 -1
  32. package/dist/docs/assets/chunks/{chunk-YZCP3GAM.BDdxnPU4.js → chunk-YZCP3GAM.Cz47F_-o.js} +1 -1
  33. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.j55aerUT.js +1 -0
  34. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.j55aerUT.js +1 -0
  35. package/dist/docs/assets/chunks/clone.XimRS84I.js +1 -0
  36. package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.AT0weO8r.js → cose-bilkent-S5V4N54A.BPYgB-_O.js} +1 -1
  37. package/dist/docs/assets/chunks/{dagre-KV5264BT.CJ30TxV0.js → dagre-KV5264BT.Cu6hECod.js} +1 -1
  38. package/dist/docs/assets/chunks/{diagram-5BDNPKRD.KtE--1fW.js → diagram-5BDNPKRD.BMgp95Tz.js} +1 -1
  39. package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.BFGygSUQ.js → diagram-G4DWMVQ6.towWdhDi.js} +1 -1
  40. package/dist/docs/assets/chunks/{diagram-MMDJMWI5.BLU-79eb.js → diagram-MMDJMWI5.D9IfOvE9.js} +1 -1
  41. package/dist/docs/assets/chunks/{diagram-TYMM5635.CdjfJdVG.js → diagram-TYMM5635.NTX57RPu.js} +1 -1
  42. package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.Dj1Iwypl.js → erDiagram-SMLLAGMA.DIQLqDqu.js} +1 -1
  43. package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.BXqj_Su2.js → flowDiagram-DWJPFMVM.DhqpItRe.js} +1 -1
  44. package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.CNfgGSst.js → ganttDiagram-T4ZO3ILL.B998R3Ps.js} +1 -1
  45. package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.2tgvFDBr.js → gitGraphDiagram-UUTBAWPF.B45nTn8-.js} +1 -1
  46. package/dist/docs/assets/chunks/{graph.CWHZMxx6.js → graph.DPseWzzM.js} +1 -1
  47. package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.DhLIK8m1.js → infoDiagram-42DDH7IO._GhhBBai.js} +1 -1
  48. package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.BIN11n1G.js → ishikawaDiagram-UXIWVN3A.CTUMcaMM.js} +1 -1
  49. package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.BARmNJ0n.js → journeyDiagram-VCZTEJTY.DkJBUddC.js} +1 -1
  50. package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.BrTJYFyF.js → kanban-definition-6JOO6SKY.B5Q3uwhy.js} +1 -1
  51. package/dist/docs/assets/chunks/{layout.CPZIIywK.js → layout.CDY13IKh.js} +1 -1
  52. package/dist/docs/assets/chunks/{linear.DTpmzI5S.js → linear.BPd1ql9p.js} +1 -1
  53. package/dist/docs/assets/chunks/{min.BBLQmXwZ.js → min.dlGuqIBP.js} +1 -1
  54. package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.5qkWJvdl.js → mindmap-definition-QFDTVHPH.Cp7zCtmb.js} +1 -1
  55. package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.-4wufv_f.js → pieDiagram-DEJITSTG.CRH034nu.js} +1 -1
  56. package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.C0jrp1-8.js → quadrantDiagram-34T5L4WZ.BspgZ-pX.js} +1 -1
  57. package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.DUDpANfe.js → requirementDiagram-MS252O5E.CQZqZ0nZ.js} +1 -1
  58. package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.74Lvg6Gu.js → sankeyDiagram-XADWPNL6.DllwFU3k.js} +1 -1
  59. package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.BHDIH286.js → sequenceDiagram-FGHM5R23.B5fTXycf.js} +1 -1
  60. package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.Dr-HIuLb.js → stateDiagram-FHFEXIEX.12GQjmbD.js} +1 -1
  61. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.Ctv5WEMu.js +1 -0
  62. package/dist/docs/assets/chunks/{theme.H8zSBhlM.js → theme.BgocqONV.js} +2 -2
  63. package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.GtyCaSiL.js → timeline-definition-GMOUNBTQ.DXKUL5rH.js} +1 -1
  64. package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.DLId0rxH.js → vennDiagram-DHZGUBPP.BrsjYCjp.js} +1 -1
  65. package/dist/docs/assets/chunks/wardley-RL74JXVD.DZDndEXQ.js +162 -0
  66. package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.CI6mGYNG.js → wardleyDiagram-NUSXRM2D.C4oM69gv.js} +1 -1
  67. package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.CG1n865F.js → xychartDiagram-5P7HB3ND.qzHH9efW.js} +1 -1
  68. package/dist/docs/assets/{deployment.md.ajc3VM0m.js → deployment.md.D0uprX2p.js} +3 -3
  69. package/dist/docs/assets/{deployment.md.ajc3VM0m.lean.js → deployment.md.D0uprX2p.lean.js} +1 -1
  70. package/dist/docs/assets/{guides_agent-to-agent.md.Cps5NiCV.js → guides_agent-to-agent.md.CwL5cwuE.js} +6 -5
  71. package/dist/docs/assets/{guides_agent-to-agent.md.Cps5NiCV.lean.js → guides_agent-to-agent.md.CwL5cwuE.lean.js} +1 -1
  72. package/dist/docs/assets/guides_export-grokbot.md.qo5bxi4h.js +55 -0
  73. package/dist/docs/assets/guides_export-grokbot.md.qo5bxi4h.lean.js +1 -0
  74. package/dist/docs/assets/{guides_opentelemetry.md.jcPNrQbH.js → guides_opentelemetry.md.BHPm32OR.js} +3 -3
  75. package/dist/docs/assets/{guides_opentelemetry.md.jcPNrQbH.lean.js → guides_opentelemetry.md.BHPm32OR.lean.js} +1 -1
  76. package/dist/docs/assets/{index.md.CHAFTf6m.js → index.md.CAnsLl8D.js} +2 -2
  77. package/dist/docs/assets/{index.md.CHAFTf6m.lean.js → index.md.CAnsLl8D.lean.js} +1 -1
  78. package/dist/docs/assets/{reference_cli.md.Bt3sAfat.js → reference_cli.md.Bkrsce22.js} +7 -4
  79. package/dist/docs/assets/{reference_cli.md.Bt3sAfat.lean.js → reference_cli.md.Bkrsce22.lean.js} +1 -1
  80. package/dist/docs/assets/{reference_connections.md.CxbLpaaP.js → reference_connections.md.BJE2Zllp.js} +4 -4
  81. package/dist/docs/assets/{reference_connections.md.CxbLpaaP.lean.js → reference_connections.md.BJE2Zllp.lean.js} +1 -1
  82. package/dist/docs/assets/{reference_hooks.md.DbJC8mcZ.js → reference_hooks.md.CP3FENFJ.js} +1 -1
  83. package/dist/docs/assets/reference_memory.md.BwyJXYZe.js +4 -0
  84. package/dist/docs/assets/reference_memory.md.BwyJXYZe.lean.js +1 -0
  85. package/dist/docs/assets/{reference_skills.md.Ckddg6KX.js → reference_skills.md.C2GWh7g8.js} +3 -3
  86. package/dist/docs/building-with-agents.html +35 -35
  87. package/dist/docs/deployment.html +38 -38
  88. package/dist/docs/deployment.md +17 -0
  89. package/dist/docs/evals.html +35 -35
  90. package/dist/docs/guides/agent-to-agent.html +41 -40
  91. package/dist/docs/guides/agent-to-agent.md +34 -21
  92. package/dist/docs/guides/bitbucket.html +35 -35
  93. package/dist/docs/guides/cloud-agents.html +35 -35
  94. package/dist/docs/guides/convert-automation.html +35 -35
  95. package/dist/docs/guides/export-grokbot.html +114 -0
  96. package/dist/docs/guides/export-grokbot.md +239 -0
  97. package/dist/docs/guides/github.html +35 -35
  98. package/dist/docs/guides/gitlab.html +35 -35
  99. package/dist/docs/guides/grokbot-agents.html +35 -35
  100. package/dist/docs/guides/hooks.html +35 -35
  101. package/dist/docs/guides/improve.html +35 -35
  102. package/dist/docs/guides/jev.html +35 -35
  103. package/dist/docs/guides/mcp-oauth.html +35 -35
  104. package/dist/docs/guides/migrate.html +36 -36
  105. package/dist/docs/guides/opentelemetry.html +37 -37
  106. package/dist/docs/guides/opentelemetry.md +19 -0
  107. package/dist/docs/guides/slack.html +35 -35
  108. package/dist/docs/guides/webhooks.html +35 -35
  109. package/dist/docs/hashmap.json +1 -1
  110. package/dist/docs/hillclimbing.html +35 -35
  111. package/dist/docs/index.html +37 -37
  112. package/dist/docs/index.md +3 -0
  113. package/dist/docs/llms-full.txt +493 -29
  114. package/dist/docs/llms.txt +2 -0
  115. package/dist/docs/quickstart.html +35 -35
  116. package/dist/docs/reference/agent-config.html +35 -35
  117. package/dist/docs/reference/artifacts.html +35 -35
  118. package/dist/docs/reference/channels.html +35 -35
  119. package/dist/docs/reference/cli.html +41 -38
  120. package/dist/docs/reference/cli.md +39 -1
  121. package/dist/docs/reference/connections.html +38 -38
  122. package/dist/docs/reference/connections.md +16 -6
  123. package/dist/docs/reference/evals.html +36 -36
  124. package/dist/docs/reference/extensions.html +35 -35
  125. package/dist/docs/reference/hooks.html +38 -38
  126. package/dist/docs/reference/hooks.md +2 -1
  127. package/dist/docs/reference/http-api.html +35 -35
  128. package/dist/docs/reference/instructions.html +35 -35
  129. package/dist/docs/reference/memory.html +63 -0
  130. package/dist/docs/reference/memory.md +114 -0
  131. package/dist/docs/reference/playground.html +35 -35
  132. package/dist/docs/reference/project-layout.html +35 -35
  133. package/dist/docs/reference/prompt.html +35 -35
  134. package/dist/docs/reference/schedules.html +35 -35
  135. package/dist/docs/reference/sessions.html +35 -35
  136. package/dist/docs/reference/skills.html +38 -38
  137. package/dist/docs/reference/subagents.html +35 -35
  138. package/dist/docs/reference/tools.html +35 -35
  139. package/dist/docs/templates/agentic-owners.html +35 -35
  140. package/dist/docs/templates/grokbot-agents.html +35 -35
  141. package/dist/docs/templates/security-reviewer.html +35 -35
  142. package/dist/docs/templates/thermo-quality-review.html +35 -35
  143. package/dist/docs/templates/thermo-review.html +35 -35
  144. package/dist/docs/templates/triage.html +35 -35
  145. package/dist/docs/troubleshooting.html +35 -35
  146. package/dist/evals.d.ts +1 -1
  147. package/dist/evals.js +1 -1
  148. package/dist/extensions/cursor-cloud-agents/extension.d.ts +2 -2
  149. package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -1
  150. package/dist/extensions/cursor-cloud-agents/extension.js +1 -1
  151. package/dist/extensions/cursor-cloud-agents/lib/launch-agent.d.ts +8 -1
  152. package/dist/extensions/cursor-cloud-agents/lib/launch-agent.d.ts.map +1 -1
  153. package/dist/extensions/cursor-cloud-agents/lib/launch-agent.js +10 -1
  154. package/dist/internal/cli-ax.d.ts +7 -7
  155. package/dist/internal/cli-ax.d.ts.map +1 -1
  156. package/dist/internal/cli-ax.js +36 -15
  157. package/dist/internal/cli-deploy.d.ts.map +1 -1
  158. package/dist/internal/cli-deploy.js +0 -14
  159. package/dist/internal/cloud-turn-usage.d.ts +34 -0
  160. package/dist/internal/cloud-turn-usage.d.ts.map +1 -0
  161. package/dist/internal/cloud-turn-usage.js +94 -0
  162. package/dist/internal/continuation-channel.d.ts.map +1 -1
  163. package/dist/internal/continuation-channel.js +6 -0
  164. package/dist/internal/continuation-identity.d.ts +6 -3
  165. package/dist/internal/continuation-identity.d.ts.map +1 -1
  166. package/dist/internal/continuation-identity.js +43 -0
  167. package/dist/internal/estimate-cost.d.ts +55 -0
  168. package/dist/internal/estimate-cost.d.ts.map +1 -0
  169. package/dist/internal/{turn-cost.js → estimate-cost.js} +18 -26
  170. package/dist/internal/event-log.d.ts +2 -2
  171. package/dist/internal/event-log.js +2 -2
  172. package/dist/internal/http-channel.d.ts.map +1 -1
  173. package/dist/internal/http-channel.js +21 -2
  174. package/dist/internal/http-control-plane-session.d.ts +5 -2
  175. package/dist/internal/http-control-plane-session.d.ts.map +1 -1
  176. package/dist/internal/http-control-plane-session.js +38 -2
  177. package/dist/internal/init-scaffold.d.ts.map +1 -1
  178. package/dist/internal/init-scaffold.js +3 -4
  179. package/dist/internal/model-config.d.ts +7 -0
  180. package/dist/internal/model-config.d.ts.map +1 -0
  181. package/dist/internal/model-config.js +67 -0
  182. package/dist/internal/otel/collector.d.ts +3 -3
  183. package/dist/internal/otel/collector.d.ts.map +1 -1
  184. package/dist/internal/otel/collector.js +8 -21
  185. package/dist/internal/otel/computer-use-attrs.d.ts +13 -0
  186. package/dist/internal/otel/computer-use-attrs.d.ts.map +1 -0
  187. package/dist/internal/otel/computer-use-attrs.js +29 -0
  188. package/dist/internal/peer-connections.d.ts +17 -8
  189. package/dist/internal/peer-connections.d.ts.map +1 -1
  190. package/dist/internal/peer-connections.js +41 -10
  191. package/dist/internal/request-error-status.d.ts.map +1 -1
  192. package/dist/internal/request-error-status.js +4 -1
  193. package/dist/internal/resolved-connections.d.ts +4 -1
  194. package/dist/internal/resolved-connections.d.ts.map +1 -1
  195. package/dist/internal/resolved-connections.js +9 -4
  196. package/dist/internal/sdk-runner.d.ts.map +1 -1
  197. package/dist/internal/sdk-runner.js +16 -14
  198. package/dist/internal/server.d.ts.map +1 -1
  199. package/dist/internal/server.js +2 -1
  200. package/dist/internal/session-cost.d.ts +21 -22
  201. package/dist/internal/session-cost.d.ts.map +1 -1
  202. package/dist/internal/session-cost.js +38 -46
  203. package/dist/internal/session-engine.d.ts +25 -41
  204. package/dist/internal/session-engine.d.ts.map +1 -1
  205. package/dist/internal/session-engine.js +130 -122
  206. package/dist/internal/sessions-client.d.ts +13 -1
  207. package/dist/internal/sessions-client.d.ts.map +1 -1
  208. package/dist/internal/sessions-client.js +24 -0
  209. package/dist/internal/storage-coordinator.d.ts +9 -9
  210. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  211. package/dist/internal/storage-coordinator.js +116 -36
  212. package/dist/internal/testing/factory-resource-fixtures.d.ts +16 -0
  213. package/dist/internal/testing/factory-resource-fixtures.d.ts.map +1 -1
  214. package/dist/internal/testing/factory-resource-fixtures.js +14 -0
  215. package/dist/internal/trajectory.d.ts +5 -6
  216. package/dist/internal/trajectory.d.ts.map +1 -1
  217. package/dist/internal/trajectory.js +1 -13
  218. package/dist/memory.d.ts +5 -2
  219. package/dist/memory.d.ts.map +1 -1
  220. package/dist/memory.js +1 -1
  221. package/dist/playground/assets/cursor-icons-16-gwXtdAvu.woff2 +0 -0
  222. package/dist/playground/assets/index-C77_FdOx.css +1 -0
  223. package/dist/playground/assets/index-CvzI2lhj.js +71 -0
  224. package/dist/playground/index.html +2 -2
  225. package/dist/types.d.ts +57 -22
  226. package/dist/types.d.ts.map +1 -1
  227. package/docs/README.md +3 -0
  228. package/docs/deployment.md +17 -0
  229. package/docs/guides/agent-to-agent.md +34 -21
  230. package/docs/guides/export-grokbot.md +244 -0
  231. package/docs/guides/opentelemetry.md +19 -0
  232. package/docs/reference/cli.md +39 -1
  233. package/docs/reference/connections.md +16 -6
  234. package/docs/reference/hooks.md +2 -1
  235. package/docs/reference/memory.md +119 -0
  236. package/package.json +13 -5
  237. package/templates/agentic-owners/bot/lib/owners/matching.ts +57 -2
  238. package/dist/docs/assets/chunks/@localSearchIndexroot.3c56VHUt.js +0 -1
  239. package/dist/docs/assets/chunks/channel.S8-FFjmE.js +0 -1
  240. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.BB98tFjZ.js +0 -1
  241. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.BB98tFjZ.js +0 -1
  242. package/dist/docs/assets/chunks/clone.B98w8OEv.js +0 -1
  243. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.DW_lwpZY.js +0 -1
  244. package/dist/docs/assets/chunks/wardley-RL74JXVD.CSlECTHi.js +0 -162
  245. package/dist/internal/cloud-turn-cost.d.ts +0 -42
  246. package/dist/internal/cloud-turn-cost.d.ts.map +0 -1
  247. package/dist/internal/cloud-turn-cost.js +0 -120
  248. package/dist/internal/turn-cost.d.ts +0 -41
  249. package/dist/internal/turn-cost.d.ts.map +0 -1
  250. package/dist/playground/assets/cursor-icons-16-4RnoYH3n.woff2 +0 -0
  251. package/dist/playground/assets/index-7fVUOA5l.css +0 -1
  252. package/dist/playground/assets/index-U3TRnwAP.js +0 -71
  253. /package/dist/docs/assets/{reference_hooks.md.DbJC8mcZ.lean.js → reference_hooks.md.CP3FENFJ.lean.js} +0 -0
  254. /package/dist/docs/assets/{reference_skills.md.Ckddg6KX.lean.js → reference_skills.md.C2GWh7g8.lean.js} +0 -0
@@ -52,8 +52,9 @@ export declare class StorageCoordinator implements FrameworkSessionStore, Author
52
52
  /** Per-session pending state (events + coalesced record). */
53
53
  private readonly buffers;
54
54
  /**
55
- * Last continuation key written to the sink per session, so a token
56
- * change emits a delete for the stale index entry alongside the new put.
55
+ * Last continuation key this process has seen for a session. A hit
56
+ * avoids a durable read; a miss reads the stored session record so a
57
+ * fresh process still deletes the previous pointer.
57
58
  */
58
59
  private readonly continuationIndex;
59
60
  /**
@@ -103,14 +104,13 @@ export declare class StorageCoordinator implements FrameworkSessionStore, Author
103
104
  */
104
105
  private putsOp;
105
106
  /**
106
- * Index maintenance for `continuation/{channelId}/{token}` → sessionId:
107
- * put the current token, delete the previous one when it changed.
107
+ * Index maintenance for `continuation/{channelId}/{token}` → sessionId.
108
+ * Put the current token and delete the previous one. The in-process
109
+ * index is a fast path; a fresh process reads the durable session
110
+ * record (before this flush overwrites it) and deletes that key too.
111
+ * Leading ops must run before the session-record put.
108
112
  */
109
- private continuationOps;
110
- /** KV upsert op on the sink's `put`. */
111
- private putOp;
112
- /** KV delete op on the sink's `delete` (skipped when the hook is absent). */
113
- private deleteOp;
113
+ private planContinuation;
114
114
  /** Whether the sink can serve the startup bulk restore (`list`). */
115
115
  get canBulkRestore(): boolean;
116
116
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"storage-coordinator.d.ts","sourceRoot":"","sources":["../../src/internal/storage-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EACL,KAAK,qBAAqB,EAE1B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAEtB,KAAK,WAAW,EAEjB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE1F,6EAA6E;AAC7E,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,CAMjE,CAAC;AAEH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,OAAO,CAEvE;AA2BD;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAoB5C,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,oDAAoD;IACpD,IAAI,CAAC,EAAE,WAAW,C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AGhB"}
@@ -71,6 +71,17 @@ export const MAX_VOLATILE_RECORD_SKIPS = 20;
71
71
  function resumeProjectionJson(record) {
72
72
  return JSON.stringify({ ...record, turnCount: 0, updatedAt: "" });
73
73
  }
74
+ /**
75
+ * Stamp written with a continuation pointer. Newer than the durable
76
+ * record's `updatedAt` means the record write lagged the pointer.
77
+ */
78
+ function continuationPointerUpdatedAt(pointer) {
79
+ if (typeof pointer !== "object" || pointer === null || Array.isArray(pointer)) {
80
+ return undefined;
81
+ }
82
+ const stamp = pointer.recordUpdatedAt;
83
+ return typeof stamp === "string" && stamp.length > 0 ? stamp : undefined;
84
+ }
74
85
  /** Session records out of raw sink entries; rows without a usable id are dropped. */
75
86
  function sessionRecordsOf(entries) {
76
87
  return entries
@@ -82,8 +93,9 @@ export class StorageCoordinator {
82
93
  /** Per-session pending state (events + coalesced record). */
83
94
  this.buffers = new Map();
84
95
  /**
85
- * Last continuation key written to the sink per session, so a token
86
- * change emits a delete for the stale index entry alongside the new put.
96
+ * Last continuation key this process has seen for a session. A hit
97
+ * avoids a durable read; a miss reads the stored session record so a
98
+ * fresh process still deletes the previous pointer.
87
99
  */
88
100
  this.continuationIndex = new Map();
89
101
  /**
@@ -231,11 +243,15 @@ export class StorageCoordinator {
231
243
  recordAck = { sessionId, json: recordJson, projection };
232
244
  }
233
245
  }
246
+ const continuation = record === undefined ? undefined : this.planContinuation(record);
247
+ if (continuation !== undefined) {
248
+ ops.push(...continuation.leading);
249
+ }
234
250
  if (puts.length > 0) {
235
251
  ops.push(this.putsOp(puts, recordAck));
236
252
  }
237
- if (record !== undefined) {
238
- ops.push(...this.continuationOps(record));
253
+ if (continuation !== undefined) {
254
+ ops.push(...continuation.trailing);
239
255
  }
240
256
  if (ops.length > 0) {
241
257
  this.enqueue(ops, reason);
@@ -309,39 +325,76 @@ export class StorageCoordinator {
309
325
  };
310
326
  }
311
327
  /**
312
- * Index maintenance for `continuation/{channelId}/{token}` → sessionId:
313
- * put the current token, delete the previous one when it changed.
328
+ * Index maintenance for `continuation/{channelId}/{token}` → sessionId.
329
+ * Put the current token and delete the previous one. The in-process
330
+ * index is a fast path; a fresh process reads the durable session
331
+ * record (before this flush overwrites it) and deletes that key too.
332
+ * Leading ops must run before the session-record put.
314
333
  */
315
- continuationOps(record) {
316
- const previous = this.continuationIndex.get(record.sessionId);
334
+ planContinuation(record) {
317
335
  const next = record.continuationKey;
318
- if (previous === next) {
319
- return [];
336
+ const indexKnows = this.continuationIndex.has(record.sessionId);
337
+ const known = indexKnows ? this.continuationIndex.get(record.sessionId) : undefined;
338
+ if (indexKnows && known === next) {
339
+ return undefined;
320
340
  }
321
- this.continuationIndex.set(record.sessionId, next);
322
- const ops = [];
323
- if (previous != null) {
324
- ops.push(this.deleteOp(this.keys.continuation(this.agentName, record.channelId, previous)));
341
+ const staleKeys = [];
342
+ if (indexKnows && typeof known === "string" && known !== next) {
343
+ staleKeys.push(this.keys.continuation(this.agentName, record.channelId, known));
325
344
  }
326
- if (next != null) {
327
- ops.push(this.putOp(this.keys.continuation(this.agentName, record.channelId, next), {
328
- sessionId: record.sessionId,
329
- }));
345
+ this.continuationIndex.set(record.sessionId, next);
346
+ const leading = [];
347
+ const get = this.definition.get;
348
+ if (!indexKnows && get !== undefined) {
349
+ leading.push({
350
+ label: `continuation-previous(${record.sessionId})`,
351
+ run: async (ctx) => {
352
+ const stored = (await get(this.keys.session(this.agentName, record.sessionId), ctx));
353
+ const previous = stored?.continuationKey;
354
+ if (typeof previous !== "string" || previous.length === 0 || previous === next) {
355
+ return;
356
+ }
357
+ const channelId = stored != null && typeof stored.channelId === "string" && stored.channelId.length > 0
358
+ ? stored.channelId
359
+ : record.channelId;
360
+ staleKeys.push(this.keys.continuation(this.agentName, channelId, previous));
361
+ },
362
+ });
330
363
  }
331
- return ops;
332
- }
333
- /** KV upsert op on the sink's `put`. */
334
- putOp(key, value) {
335
- return {
336
- label: `put(${key})`,
337
- run: (ctx) => this.definition.put(key, value, ctx),
338
- };
339
- }
340
- /** KV delete op on the sink's `delete` (skipped when the hook is absent). */
341
- deleteOp(key) {
342
364
  return {
343
- label: `delete(${key})`,
344
- run: (ctx) => this.definition.delete?.(key, ctx),
365
+ leading,
366
+ trailing: [
367
+ {
368
+ label: `continuation(${record.sessionId})`,
369
+ run: async (ctx) => {
370
+ // A delete failure must not skip the new pointer. These used to
371
+ // be separate queue ops, so a thrown delete still reached the put.
372
+ for (const key of staleKeys) {
373
+ try {
374
+ await this.definition.delete?.(key, ctx);
375
+ }
376
+ catch (error) {
377
+ this.logger(`[bdk] storage delete(${key}) failed: ${describeError(error)}`);
378
+ }
379
+ }
380
+ if (next == null) {
381
+ return;
382
+ }
383
+ try {
384
+ await this.definition.put(this.keys.continuation(this.agentName, record.channelId, next), {
385
+ sessionId: record.sessionId,
386
+ recordUpdatedAt: record.updatedAt,
387
+ }, ctx);
388
+ }
389
+ catch (error) {
390
+ // Plan time already advanced the in-process index. Drop it so
391
+ // a later flush retries this pointer instead of treating it as current.
392
+ this.continuationIndex.delete(record.sessionId);
393
+ throw error;
394
+ }
395
+ },
396
+ },
397
+ ],
345
398
  };
346
399
  }
347
400
  // ==========================================================================
@@ -472,11 +525,38 @@ export class StorageCoordinator {
472
525
  this.logger(`[bdk] storage continuation entry points at missing session ${sessionId}; treating as a miss`);
473
526
  return undefined;
474
527
  }
475
- // The sink must answer for the exact key it was asked about — a
476
- // mismatched row is a broken store, not a miss; treating it as a miss
477
- // would fork the continuation token onto a new session.
478
- if (record.channelId !== channelId || record.continuationKey !== continuationKey) {
479
- throw new Error(`storage returned a session that does not match the requested continuation (channel ${channelId})`);
528
+ // A different channel is a broken store. Same channel with a different
529
+ // key is a leftover pointer when the durable record is newer, and the
530
+ // live token when that record write lagged the pointer.
531
+ if (record.channelId !== channelId) {
532
+ throw new Error(`storage returned a session that does not match the requested continuation (channel ${channelId}, requestedContinuationKey=${continuationKey}, recordChannelId=${record.channelId}, recordContinuationKey=${String(record.continuationKey)})`);
533
+ }
534
+ if (record.continuationKey !== continuationKey) {
535
+ const pointerUpdatedAt = continuationPointerUpdatedAt(pointer);
536
+ const recordUpdatedAt = typeof record.updatedAt === "string" ? record.updatedAt : undefined;
537
+ // The pointer was written for a newer record than the one that landed.
538
+ // Deleting it would drop the live token; the record is the one that lagged.
539
+ if (pointerUpdatedAt !== undefined &&
540
+ recordUpdatedAt !== undefined &&
541
+ pointerUpdatedAt > recordUpdatedAt) {
542
+ this.logger(`[bdk] storage continuation record lags the pointer for channel ${channelId}; keeping the pointer`);
543
+ // The caller persists this record. Leaving the old token on it makes
544
+ // the next flush advance `updatedAt` past the pointer stamp, and the
545
+ // following lookup of the live key then deletes that pointer.
546
+ return {
547
+ ...record,
548
+ continuationKey,
549
+ updatedAt: pointerUpdatedAt,
550
+ };
551
+ }
552
+ this.logger(`[bdk] storage continuation pointer is stale for channel ${channelId}; treating as a miss`);
553
+ try {
554
+ await this.definition.delete?.(this.keys.continuation(this.agentName, channelId, continuationKey), ctx);
555
+ }
556
+ catch (error) {
557
+ this.logger(`[bdk] storage delete of stale continuation pointer failed: ${describeError(error)}`);
558
+ }
559
+ return undefined;
480
560
  }
481
561
  return record;
482
562
  }
@@ -5,6 +5,7 @@
5
5
  */
6
6
  export declare const FACTORY_CHECKPOINT_NAME: string;
7
7
  export declare const FACTORY_ISSUE_NAME: string;
8
+ export declare const FACTORY_RUN_NAME: string;
8
9
  export interface FactoryCheckpointResourceFixture {
9
10
  name: string;
10
11
  deployment: string;
@@ -27,6 +28,13 @@ export interface FactoryIssueResourceFixture {
27
28
  path: string;
28
29
  etag: string;
29
30
  }
31
+ export interface FactoryRunResourceFixture {
32
+ name: string;
33
+ environment: string;
34
+ services: string[];
35
+ deployVersion: string;
36
+ createTime: string;
37
+ }
30
38
  export interface CheckpointCreatedPayloadFixture {
31
39
  eventId: string;
32
40
  eventType: "checkpoint.created";
@@ -41,8 +49,16 @@ export interface IssueCreatedPayloadFixture {
41
49
  occurredAtMs: number;
42
50
  issue: FactoryIssueResourceFixture;
43
51
  }
52
+ export interface RunCreatedPayloadFixture {
53
+ eventId: string;
54
+ eventType: "run.created";
55
+ teamId: string;
56
+ occurredAtMs: number;
57
+ run: FactoryRunResourceFixture;
58
+ }
44
59
  export declare const FACTORY_CHECKPOINT_RESOURCE: FactoryCheckpointResourceFixture;
45
60
  export declare const FACTORY_ISSUE_RESOURCE: FactoryIssueResourceFixture;
46
61
  export declare const CHECKPOINT_CREATED_PAYLOAD: CheckpointCreatedPayloadFixture;
47
62
  export declare const ISSUE_CREATED_PAYLOAD: IssueCreatedPayloadFixture;
63
+ export declare const RUN_CREATED_PAYLOAD: RunCreatedPayloadFixture;
48
64
  //# sourceMappingURL=factory-resource-fixtures.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"factory-resource-fixtures.d.ts","sourceRoot":"","sources":["../../../src/internal/testing/factory-resource-fixtures.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB,EAAE,MAA+C,CAAC;AACtF,eAAO,MAAM,kBAAkB,EAAE,MAAuB,CAAC;AAEzD,MAAM,WAAW,gCAAgC;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,YAAY,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,oBAAoB,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,gCAAgC,CAAC;CAC9C;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,eAAe,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,2BAA2B,CAAC;CACpC;AAED,eAAO,MAAM,2BAA2B,EAAE,gCASzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,2BASpC,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,+BAMxC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,0BAMnC,CAAC"}
1
+ {"version":3,"file":"factory-resource-fixtures.d.ts","sourceRoot":"","sources":["../../../src/internal/testing/factory-resource-fixtures.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB,EAAE,MAA+C,CAAC;AACtF,eAAO,MAAM,kBAAkB,EAAE,MAAuB,CAAC;AACzD,eAAO,MAAM,gBAAgB,EAAE,MAAyC,CAAC;AAEzE,MAAM,WAAW,gCAAgC;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK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AME = "issues/iss-1";
8
+ export const FACTORY_RUN_NAME = "changeMonitors/cm-1/runs/run-1";
8
9
  export const FACTORY_CHECKPOINT_RESOURCE = {
9
10
  name: FACTORY_CHECKPOINT_NAME,
10
11
  deployment: "deployments/11111111-1111-4111-8111-111111111111",
@@ -39,3 +40,16 @@ export const ISSUE_CREATED_PAYLOAD = {
39
40
  occurredAtMs: 1,
40
41
  issue: FACTORY_ISSUE_RESOURCE,
41
42
  };
43
+ export const RUN_CREATED_PAYLOAD = {
44
+ eventId: "evt-mr-1",
45
+ eventType: "run.created",
46
+ teamId: "team-1",
47
+ occurredAtMs: 1,
48
+ run: {
49
+ name: FACTORY_RUN_NAME,
50
+ environment: "environments/production",
51
+ services: ["services/portal-website"],
52
+ deployVersion: "3e165785dd2cfecb24b032176d758933a343726e",
53
+ createTime: "2026-09-08T21:00:00Z",
54
+ },
55
+ };
@@ -5,7 +5,7 @@
5
5
  * messages, assistant text, tool calls with args/results, and
6
6
  * success/failure — not a firehose of streaming deltas.
7
7
  */
8
- import type { SessionEvent, TurnCost, TurnUsage } from "../types.js";
8
+ import type { SessionEvent, TurnUsage } from "../types.js";
9
9
  export interface TrajectoryToolCall {
10
10
  callId: string;
11
11
  toolName: string;
@@ -32,8 +32,6 @@ export interface TrajectoryTurn {
32
32
  toolCalls: TrajectoryToolCall[];
33
33
  subagents: TrajectorySubagent[];
34
34
  usage?: TurnUsage;
35
- /** Estimated dollar cost of this turn (from the `turn.completed` event). */
36
- cost?: TurnCost;
37
35
  result?: string;
38
36
  failed: boolean;
39
37
  error?: string;
@@ -47,7 +45,10 @@ export interface Trajectory {
47
45
  finalText: string;
48
46
  turnsFailed: number;
49
47
  toolCallCount: number;
50
- /** Sum of per-turn estimated costs; present when any turn reported cost. */
48
+ /**
49
+ * The session's cost from `GET /v1/session/:id/cost`, priced once after the
50
+ * last turn. Never derived from events; absent when nobody priced it.
51
+ */
51
52
  totalCostUsd?: number;
52
53
  turns: TrajectoryTurn[];
53
54
  }
@@ -56,8 +57,6 @@ export interface Trajectory {
56
57
  * folded into final assistant / reasoning text per turn.
57
58
  */
58
59
  export declare function buildTrajectory(events: SessionEvent[]): Trajectory;
59
- /** Micro-dollar precision so summed floats stay readable in JSON. */
60
- export declare function roundCostUsd(usd: number): number;
61
60
  /** Compact dollar display for estimated costs (`$0.0132`, `$1.25`). */
62
61
  export declare function formatCostUsd(usd: number): string;
63
62
  /** Parse an `events.ndjson` file (or any NDJSON blob of SessionEvents). */
@@ -1 +1 @@
1
- {"version":3,"file":"trajectory.d.ts","sourceRoot":"","sources":["../../src/internal/trajectory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAErE,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACtC,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,SAAS,EAAE,kBAAkB,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC,KAAK,CAAC,EAA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AED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,UAAU,CA+NlE;AAED,uEAAuE;AACvE,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAWjD;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAc9D;AAED,sDAAsD;AACtD,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAGpF;AAED,uEAAuE;AACvE,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAoDnE"}
@@ -188,9 +188,6 @@ export function buildTrajectory(events) {
188
188
  if (event.data.usage !== undefined) {
189
189
  turn.usage = event.data.usage;
190
190
  }
191
- if (event.data.cost !== undefined) {
192
- turn.cost = event.data.cost;
193
- }
194
191
  if (event.data.result !== undefined) {
195
192
  turn.result = event.data.result;
196
193
  if (turn.assistantText === "") {
@@ -223,10 +220,6 @@ export function buildTrajectory(events) {
223
220
  const turnsFailed = turns.filter((t) => t.failed).length;
224
221
  const toolCallCount = turns.reduce((n, t) => n + t.toolCalls.length + t.subagents.reduce((m, s) => m + s.toolCalls.length, 0), 0);
225
222
  const lastGood = [...turns].reverse().find((t) => t.assistantText !== "");
226
- const costedTurns = turns.filter((t) => t.cost !== undefined);
227
- const totalCostUsd = costedTurns.length === 0
228
- ? undefined
229
- : roundCostUsd(costedTurns.reduce((sum, t) => sum + (t.cost?.totalUsd ?? 0), 0));
230
223
  return {
231
224
  sessionId,
232
225
  ...(sdkAgentId === undefined ? {} : { sdkAgentId }),
@@ -236,14 +229,9 @@ export function buildTrajectory(events) {
236
229
  finalText: lastGood?.assistantText ?? "",
237
230
  turnsFailed,
238
231
  toolCallCount,
239
- ...(totalCostUsd === undefined ? {} : { totalCostUsd }),
240
232
  turns,
241
233
  };
242
234
  }
243
- /** Micro-dollar precision so summed floats stay readable in JSON. */
244
- export function roundCostUsd(usd) {
245
- return Math.round(usd * 1e6) / 1e6;
246
- }
247
235
  /** Compact dollar display for estimated costs (`$0.0132`, `$1.25`). */
248
236
  export function formatCostUsd(usd) {
249
237
  if (!Number.isFinite(usd)) {
@@ -324,7 +312,7 @@ export function formatTrajectoryText(trajectory) {
324
312
  lines.push(` error: ${turn.error}`);
325
313
  }
326
314
  if (turn.usage !== undefined) {
327
- lines.push(` usage: in ${turn.usage.inputTokens} out ${turn.usage.outputTokens}${turn.cost === undefined ? "" : ` cost: ${formatCostUsd(turn.cost.totalUsd)}`}`);
315
+ lines.push(` usage: in ${turn.usage.inputTokens} out ${turn.usage.outputTokens}`);
328
316
  }
329
317
  }
330
318
  return `${lines.join("\n")}\n`;
package/dist/memory.d.ts CHANGED
@@ -90,14 +90,17 @@ export interface AgentStoreMemoryBackendOptions {
90
90
  */
91
91
  export declare function agentStoreMemoryBackend(options?: AgentStoreMemoryBackendOptions): MemoryBackend;
92
92
  export interface MemoryHookOptions {
93
- /** Where records go. Defaults to {@link fileMemoryBackend}. */
93
+ /**
94
+ * Where records go. Defaults to {@link agentStoreMemoryBackend} on
95
+ * Cursor-managed hosting and {@link fileMemoryBackend} elsewhere.
96
+ */
94
97
  backend?: MemoryBackend;
95
98
  /** Truncation cap for stored userMessage / result text. Default 2000. */
96
99
  maxTextLength?: number;
97
100
  }
98
101
  /**
99
102
  * Observe-only hook that journals every turn. Author it as
100
- * `agent/hooks/memory.ts`:
103
+ * `bot/hooks/memory.ts`:
101
104
  *
102
105
  * ```ts
103
106
  * import { memoryHook } from "@cursor/bdk/memory";
@@ -1 +1 @@
1
- {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EACL,KAAK,wBAAwB,EAE9B,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,uCAAuC,CAAC;A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,GAAG,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAC5C,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB;;;;;OAKG;IACH,cAAc,CAAC,CAAC,GAAG,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/E;AAED,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B,GAAG,aAAa,CA6BvF;AAED,MAAM,WAAW,8BAA8B;IAC7C;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wCAAwC;IACxC,MAAM,CAAC,EAAE,wBAAwB,CAAC;IAClC,uCAAuC;IACvC,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,GAAE,8BAAmC,GAC3C,aAAa,CA6Jf;AAgBD,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,yEAAyE;IACzE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,cAAc,CAgG1E"}
package/dist/memory.js CHANGED
@@ -219,7 +219,7 @@ function truncate(text, max) {
219
219
  }
220
220
  /**
221
221
  * Observe-only hook that journals every turn. Author it as
222
- * `agent/hooks/memory.ts`:
222
+ * `bot/hooks/memory.ts`:
223
223
  *
224
224
  * ```ts
225
225
  * import { memoryHook } from "@cursor/bdk/memory";