@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.
Files changed (333) hide show
  1. package/dist/bin/agent-serve.js +52 -57
  2. package/dist/channels/github/github-channel.d.ts.map +1 -1
  3. package/dist/channels/github/github-channel.js +32 -8
  4. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  5. package/dist/channels/slack/dispatch.js +37 -29
  6. package/dist/channels/slack/external-policy.d.ts.map +1 -1
  7. package/dist/channels/slack/external-policy.js +6 -6
  8. package/dist/channels/slack/inbound.d.ts +5 -0
  9. package/dist/channels/slack/inbound.d.ts.map +1 -1
  10. package/dist/channels/slack/inbound.js +13 -0
  11. package/dist/channels/slack/index.d.ts +3 -0
  12. package/dist/channels/slack/index.d.ts.map +1 -1
  13. package/dist/channels/slack/index.js +3 -0
  14. package/dist/channels/slack/log.d.ts +1 -1
  15. package/dist/channels/slack/log.js +1 -1
  16. package/dist/channels/slack/self-identity.d.ts +15 -0
  17. package/dist/channels/slack/self-identity.d.ts.map +1 -0
  18. package/dist/channels/slack/self-identity.js +48 -0
  19. package/dist/channels/slack/sender-name.d.ts +17 -0
  20. package/dist/channels/slack/sender-name.d.ts.map +1 -0
  21. package/dist/channels/slack/sender-name.js +87 -0
  22. package/dist/channels/slack/setup.js +1 -1
  23. package/dist/channels/slack/user-info.d.ts +15 -0
  24. package/dist/channels/slack/user-info.d.ts.map +1 -0
  25. package/dist/channels/slack/user-info.js +57 -0
  26. package/dist/docs/404.html +2 -2
  27. package/dist/docs/assets/{app.CJLKDVza.js → app.oyjtOr3W.js} +4 -4
  28. package/dist/docs/assets/chunks/@localSearchIndexroot.C25zYVuc.js +1 -0
  29. package/dist/docs/assets/chunks/{VPLocalSearchBox.BW9mrQmq.js → VPLocalSearchBox.D0P6J_UJ.js} +1 -1
  30. package/dist/docs/assets/chunks/{arc.D8ZOvM1m.js → arc.B0LY1J1h.js} +1 -1
  31. package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.CXEKhLW-.js → architectureDiagram-Q4EWVU46.dPduLUxY.js} +1 -1
  32. package/dist/docs/assets/chunks/{baseUniq.BJkVKblr.js → baseUniq.B_Ohm21h.js} +1 -1
  33. package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.DQDbHxor.js → blockDiagram-DXYQGD6D.B4zcanaJ.js} +1 -1
  34. package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.ByMD6LYM.js → c4Diagram-AHTNJAMY.D9Iw21nx.js} +1 -1
  35. package/dist/docs/assets/chunks/channel.CRUyWDV-.js +1 -0
  36. package/dist/docs/assets/chunks/{chunk-4BX2VUAB.Dtq1aVI9.js → chunk-4BX2VUAB.DDVwRShI.js} +1 -1
  37. package/dist/docs/assets/chunks/{chunk-4TB4RGXK.BL_XrkoQ.js → chunk-4TB4RGXK.DsYcdn1i.js} +1 -1
  38. package/dist/docs/assets/chunks/{chunk-55IACEB6.BDPXu94_.js → chunk-55IACEB6.BzzQvcYp.js} +1 -1
  39. package/dist/docs/assets/chunks/{chunk-EDXVE4YY.DhGOQj4k.js → chunk-EDXVE4YY.BMiXZ7FX.js} +1 -1
  40. package/dist/docs/assets/chunks/{chunk-FMBD7UC4.DSF5nr8v.js → chunk-FMBD7UC4.D_mBcLoc.js} +1 -1
  41. package/dist/docs/assets/chunks/{chunk-OYMX7WX6.Day7wayw.js → chunk-OYMX7WX6.CMVjWVMx.js} +1 -1
  42. package/dist/docs/assets/chunks/{chunk-QZHKN3VN.CpBEC0zA.js → chunk-QZHKN3VN.BG-FrPv9.js} +1 -1
  43. package/dist/docs/assets/chunks/{chunk-YZCP3GAM.X_7rY1rx.js → chunk-YZCP3GAM.CkFE1ap3.js} +1 -1
  44. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.CG_UObcQ.js +1 -0
  45. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.CG_UObcQ.js +1 -0
  46. package/dist/docs/assets/chunks/clone.NYSZ9qZN.js +1 -0
  47. package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.BVRmi2ko.js → cose-bilkent-S5V4N54A.BVNnCTvY.js} +1 -1
  48. package/dist/docs/assets/chunks/{dagre-KV5264BT.Dei9oslB.js → dagre-KV5264BT.CDN5PR9l.js} +1 -1
  49. package/dist/docs/assets/chunks/{diagram-5BDNPKRD._M-efGt7.js → diagram-5BDNPKRD.DQRUlT-i.js} +1 -1
  50. package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.D1Vmhfsj.js → diagram-G4DWMVQ6.CoeblYQT.js} +1 -1
  51. package/dist/docs/assets/chunks/{diagram-MMDJMWI5.cE1bmvAC.js → diagram-MMDJMWI5.DW3ymjl0.js} +1 -1
  52. package/dist/docs/assets/chunks/{diagram-TYMM5635.DkXAfznP.js → diagram-TYMM5635.BP0uN4Jw.js} +1 -1
  53. package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.DH_pSwPg.js → erDiagram-SMLLAGMA.DVFUWEn4.js} +1 -1
  54. package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.kAWVN9j1.js → flowDiagram-DWJPFMVM.HU-eHspv.js} +1 -1
  55. package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.8r0w49-p.js → ganttDiagram-T4ZO3ILL.DHNhXijY.js} +1 -1
  56. package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.BDa7Bi1i.js → gitGraphDiagram-UUTBAWPF.DkISXcO3.js} +1 -1
  57. package/dist/docs/assets/chunks/{graph.BMPXHz_B.js → graph.CCV0fuRR.js} +1 -1
  58. package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.BmlcqewS.js → infoDiagram-42DDH7IO.bgILzOoc.js} +1 -1
  59. package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.CVSEQSul.js → ishikawaDiagram-UXIWVN3A.CuryXC0F.js} +1 -1
  60. package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.BpeWJ5n-.js → journeyDiagram-VCZTEJTY.BL1Pr-wu.js} +1 -1
  61. package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.DHbDXuxB.js → kanban-definition-6JOO6SKY.BbGjvk4l.js} +1 -1
  62. package/dist/docs/assets/chunks/{layout.CzrCDgkP.js → layout.C4PfdldS.js} +1 -1
  63. package/dist/docs/assets/chunks/{linear.HwBsflwN.js → linear.C3xD1T6X.js} +1 -1
  64. package/dist/docs/assets/chunks/{min.DqGHolT3.js → min.CzgRAQ9c.js} +1 -1
  65. package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.ZYGlOawh.js → mindmap-definition-QFDTVHPH.CA9rSWum.js} +1 -1
  66. package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.C2KRXlNR.js → pieDiagram-DEJITSTG.B8MprgJu.js} +1 -1
  67. package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.CHj3Qefp.js → quadrantDiagram-34T5L4WZ.DndDwbKT.js} +1 -1
  68. package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.B1L4Tf7k.js → requirementDiagram-MS252O5E.Zhfgwlnn.js} +1 -1
  69. package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.dNR2yi1B.js → sankeyDiagram-XADWPNL6.B6RRm6N5.js} +1 -1
  70. package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.BrvQ3C6m.js → sequenceDiagram-FGHM5R23.Bfmz-1PN.js} +1 -1
  71. package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.BtehEykA.js → stateDiagram-FHFEXIEX.gbrdNqgj.js} +1 -1
  72. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.DOOmulfQ.js +1 -0
  73. package/dist/docs/assets/chunks/{theme.BDHBZUkP.js → theme.gpWjytMh.js} +2 -2
  74. package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.Bn7nhqEN.js → timeline-definition-GMOUNBTQ.Bl1l7M1f.js} +1 -1
  75. package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.DKhc38sz.js → vennDiagram-DHZGUBPP.Dfle4U0d.js} +1 -1
  76. package/dist/docs/assets/chunks/{wardley-RL74JXVD.DOXQ0w8J.js → wardley-RL74JXVD.BJrCW6xc.js} +1 -1
  77. package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.Bbq5B2Ic.js → wardleyDiagram-NUSXRM2D.CM_4lmvZ.js} +1 -1
  78. package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.B77HE1K8.js → xychartDiagram-5P7HB3ND.CHT5X28R.js} +1 -1
  79. package/dist/docs/assets/{reference_cli.md.BsgDqYPh.js → reference_cli.md.GwugN3n-.js} +5 -5
  80. package/dist/docs/assets/reference_cli.md.GwugN3n-.lean.js +1 -0
  81. package/dist/docs/building-with-agents.html +35 -35
  82. package/dist/docs/deployment.html +35 -35
  83. package/dist/docs/evals.html +35 -35
  84. package/dist/docs/guides/agent-to-agent.html +35 -35
  85. package/dist/docs/guides/bitbucket.html +35 -35
  86. package/dist/docs/guides/cloud-agents.html +35 -35
  87. package/dist/docs/guides/convert-automation.html +35 -35
  88. package/dist/docs/guides/github.html +35 -35
  89. package/dist/docs/guides/gitlab.html +35 -35
  90. package/dist/docs/guides/grokbot-agents.html +35 -35
  91. package/dist/docs/guides/hooks.html +35 -35
  92. package/dist/docs/guides/improve.html +35 -35
  93. package/dist/docs/guides/jev.html +35 -35
  94. package/dist/docs/guides/mcp-oauth.html +35 -35
  95. package/dist/docs/guides/opentelemetry.html +35 -35
  96. package/dist/docs/guides/slack.html +35 -35
  97. package/dist/docs/guides/webhooks.html +35 -35
  98. package/dist/docs/hashmap.json +1 -1
  99. package/dist/docs/hillclimbing.html +35 -35
  100. package/dist/docs/index.html +35 -35
  101. package/dist/docs/llms-full.txt +20 -9
  102. package/dist/docs/quickstart.html +35 -35
  103. package/dist/docs/reference/agent-config.html +35 -35
  104. package/dist/docs/reference/artifacts.html +35 -35
  105. package/dist/docs/reference/channels.html +35 -35
  106. package/dist/docs/reference/cli.html +39 -39
  107. package/dist/docs/reference/cli.md +20 -9
  108. package/dist/docs/reference/connections.html +35 -35
  109. package/dist/docs/reference/evals.html +35 -35
  110. package/dist/docs/reference/extensions.html +35 -35
  111. package/dist/docs/reference/hooks.html +35 -35
  112. package/dist/docs/reference/http-api.html +35 -35
  113. package/dist/docs/reference/instructions.html +35 -35
  114. package/dist/docs/reference/playground.html +35 -35
  115. package/dist/docs/reference/project-layout.html +35 -35
  116. package/dist/docs/reference/prompt.html +35 -35
  117. package/dist/docs/reference/schedules.html +35 -35
  118. package/dist/docs/reference/sessions.html +35 -35
  119. package/dist/docs/reference/skills.html +35 -35
  120. package/dist/docs/reference/subagents.html +35 -35
  121. package/dist/docs/reference/tools.html +35 -35
  122. package/dist/docs/templates/agentic-owners.html +35 -35
  123. package/dist/docs/templates/grokbot-agents.html +35 -35
  124. package/dist/docs/templates/security-reviewer.html +35 -35
  125. package/dist/docs/templates/thermo-quality-review.html +35 -35
  126. package/dist/docs/templates/thermo-review.html +35 -35
  127. package/dist/docs/templates/triage.html +35 -35
  128. package/dist/docs/troubleshooting.html +35 -35
  129. package/dist/extensions/cursor-cloud-agents/extension.d.ts +14 -0
  130. package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -1
  131. package/dist/extensions/cursor-cloud-agents/extension.js +5 -0
  132. package/dist/extensions/cursor-cloud-agents/lib/watch.d.ts +17 -0
  133. package/dist/extensions/cursor-cloud-agents/lib/watch.d.ts.map +1 -0
  134. package/dist/extensions/cursor-cloud-agents/lib/watch.js +99 -0
  135. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.d.ts +19 -0
  136. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.d.ts.map +1 -0
  137. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.js +71 -0
  138. package/dist/extensions/cursor-cloud-agents/skills/handoff.md +9 -5
  139. package/dist/extensions/cursor-cloud-agents/tools/cancel.d.ts.map +1 -1
  140. package/dist/extensions/cursor-cloud-agents/tools/cancel.js +3 -1
  141. package/dist/extensions/cursor-cloud-agents/tools/launch.d.ts.map +1 -1
  142. package/dist/extensions/cursor-cloud-agents/tools/launch.js +3 -2
  143. package/dist/extensions.d.ts +1 -1
  144. package/dist/extensions.js +1 -1
  145. package/dist/files-backends/cursor-hosted.d.ts +22 -83
  146. package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
  147. package/dist/files-backends/cursor-hosted.js +46 -160
  148. package/dist/files.d.ts +9 -32
  149. package/dist/files.d.ts.map +1 -1
  150. package/dist/files.js +7 -32
  151. package/dist/internal/artifacts-store.d.ts +13 -25
  152. package/dist/internal/artifacts-store.d.ts.map +1 -1
  153. package/dist/internal/artifacts-store.js +25 -46
  154. package/dist/internal/cli-ax.d.ts +10 -17
  155. package/dist/internal/cli-ax.d.ts.map +1 -1
  156. package/dist/internal/cli-ax.js +87 -155
  157. package/dist/internal/cli-bitbucket.js +5 -5
  158. package/dist/internal/cli-deploy.d.ts +4 -1
  159. package/dist/internal/cli-deploy.d.ts.map +1 -1
  160. package/dist/internal/cli-deploy.js +117 -20
  161. package/dist/internal/cli-github.js +13 -13
  162. package/dist/internal/cli-gitlab.js +5 -5
  163. package/dist/internal/continuation-identity.d.ts +2 -0
  164. package/dist/internal/continuation-identity.d.ts.map +1 -1
  165. package/dist/internal/continuation-identity.js +4 -0
  166. package/dist/internal/conversation-mirror.d.ts +9 -38
  167. package/dist/internal/conversation-mirror.d.ts.map +1 -1
  168. package/dist/internal/conversation-mirror.js +62 -68
  169. package/dist/internal/cursor/account-mcp.d.ts +1 -1
  170. package/dist/internal/cursor/account-mcp.js +1 -1
  171. package/dist/internal/cursor/backend-client.js +1 -1
  172. package/dist/internal/cursor/github-credentials.js +3 -3
  173. package/dist/internal/cursor/hosted-bound-secrets.d.ts +6 -2
  174. package/dist/internal/cursor/hosted-bound-secrets.d.ts.map +1 -1
  175. package/dist/internal/cursor/hosted-bound-secrets.js +13 -2
  176. package/dist/internal/cursor/hosted-store-secrets.d.ts +13 -37
  177. package/dist/internal/cursor/hosted-store-secrets.d.ts.map +1 -1
  178. package/dist/internal/cursor/hosted-store-secrets.js +13 -37
  179. package/dist/internal/cursor/store-api-client.d.ts +17 -39
  180. package/dist/internal/cursor/store-api-client.d.ts.map +1 -1
  181. package/dist/internal/cursor/store-api-client.js +15 -37
  182. package/dist/internal/cursor-deployment-relay.js +3 -3
  183. package/dist/internal/cursor-event-relay.js +1 -1
  184. package/dist/internal/cursor-relay-core.d.ts +1 -1
  185. package/dist/internal/cursor-relay-core.d.ts.map +1 -1
  186. package/dist/internal/deploy-client.d.ts +55 -63
  187. package/dist/internal/deploy-client.d.ts.map +1 -1
  188. package/dist/internal/deploy-client.js +48 -28
  189. package/dist/internal/discovery/agent.d.ts +1 -1
  190. package/dist/internal/discovery/agent.d.ts.map +1 -1
  191. package/dist/internal/discovery/agent.js +4 -0
  192. package/dist/internal/discovery/extensions.d.ts +2 -1
  193. package/dist/internal/discovery/extensions.d.ts.map +1 -1
  194. package/dist/internal/discovery/extensions.js +11 -1
  195. package/dist/internal/discovery/project.d.ts.map +1 -1
  196. package/dist/internal/discovery/project.js +1 -0
  197. package/dist/internal/distribution.d.ts +2 -2
  198. package/dist/internal/distribution.d.ts.map +1 -1
  199. package/dist/internal/distribution.js +2 -2
  200. package/dist/internal/docs-site.js +3 -3
  201. package/dist/internal/eval-run-store.js +8 -8
  202. package/dist/internal/framework-file-storage.d.ts +10 -34
  203. package/dist/internal/framework-file-storage.d.ts.map +1 -1
  204. package/dist/internal/framework-file-storage.js +12 -39
  205. package/dist/internal/framework-storage-selection.d.ts +10 -46
  206. package/dist/internal/framework-storage-selection.d.ts.map +1 -1
  207. package/dist/internal/framework-storage-selection.js +15 -64
  208. package/dist/internal/github-fanout.js +2 -2
  209. package/dist/internal/handleAgentServeTrigger.d.ts +5 -8
  210. package/dist/internal/handleAgentServeTrigger.d.ts.map +1 -1
  211. package/dist/internal/handleAgentServeTrigger.js +5 -8
  212. package/dist/internal/host-files.js +6 -9
  213. package/dist/internal/host-platforms.js +5 -5
  214. package/dist/internal/hosted-catch.d.ts +3 -2
  215. package/dist/internal/hosted-catch.d.ts.map +1 -1
  216. package/dist/internal/hosted-catch.js +27 -9
  217. package/dist/internal/hosted-delivery-protocol.d.ts +31 -8
  218. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  219. package/dist/internal/hosted-delivery-protocol.js +102 -1
  220. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  221. package/dist/internal/hosted-delivery.js +32 -12
  222. package/dist/internal/hosted-execution-diag.d.ts +13 -24
  223. package/dist/internal/hosted-execution-diag.d.ts.map +1 -1
  224. package/dist/internal/hosted-execution-diag.js +11 -20
  225. package/dist/internal/hosted-execution-flush.d.ts +22 -10
  226. package/dist/internal/hosted-execution-flush.d.ts.map +1 -1
  227. package/dist/internal/hosted-execution-flush.js +45 -9
  228. package/dist/internal/hosted-managed-automation.js +5 -5
  229. package/dist/internal/hosting.d.ts +5 -10
  230. package/dist/internal/hosting.d.ts.map +1 -1
  231. package/dist/internal/hosting.js +5 -10
  232. package/dist/internal/legacy-command-guard.d.ts +1 -4
  233. package/dist/internal/legacy-command-guard.d.ts.map +1 -1
  234. package/dist/internal/legacy-command-guard.js +2 -11
  235. package/dist/internal/listen-port.js +1 -1
  236. package/dist/internal/local-control-plane.js +6 -6
  237. package/dist/internal/logs-client.d.ts +20 -1
  238. package/dist/internal/logs-client.d.ts.map +1 -1
  239. package/dist/internal/logs-client.js +89 -1
  240. package/dist/internal/mcp-endpoint.js +1 -1
  241. package/dist/internal/otel/collector.js +1 -1
  242. package/dist/internal/otel/runtime.js +13 -13
  243. package/dist/internal/platform-schedule-sync.js +2 -2
  244. package/dist/internal/playground/toolchain.js +6 -6
  245. package/dist/internal/process-memory-telemetry.js +2 -2
  246. package/dist/internal/reminder-runner.d.ts +8 -3
  247. package/dist/internal/reminder-runner.d.ts.map +1 -1
  248. package/dist/internal/reminder-runner.js +51 -52
  249. package/dist/internal/resolve-prod-target.d.ts +1 -12
  250. package/dist/internal/resolve-prod-target.d.ts.map +1 -1
  251. package/dist/internal/resolve-prod-target.js +2 -32
  252. package/dist/internal/resolved-connections.js +8 -8
  253. package/dist/internal/run-client.d.ts +4 -3
  254. package/dist/internal/run-client.d.ts.map +1 -1
  255. package/dist/internal/run-client.js +98 -61
  256. package/dist/internal/runtime-dispatch-runner.d.ts +1 -0
  257. package/dist/internal/runtime-dispatch-runner.d.ts.map +1 -1
  258. package/dist/internal/runtime-dispatch-runner.js +7 -1
  259. package/dist/internal/schedule-runner.js +1 -1
  260. package/dist/internal/sdk-runner.d.ts +4 -0
  261. package/dist/internal/sdk-runner.d.ts.map +1 -1
  262. package/dist/internal/sdk-runner.js +37 -22
  263. package/dist/internal/server.d.ts +2 -0
  264. package/dist/internal/server.d.ts.map +1 -1
  265. package/dist/internal/server.js +39 -38
  266. package/dist/internal/session-engine.d.ts +40 -44
  267. package/dist/internal/session-engine.d.ts.map +1 -1
  268. package/dist/internal/session-engine.js +108 -97
  269. package/dist/internal/session-run-log.d.ts +10 -24
  270. package/dist/internal/session-run-log.d.ts.map +1 -1
  271. package/dist/internal/session-run-log.js +13 -27
  272. package/dist/internal/sessions-client.d.ts.map +1 -1
  273. package/dist/internal/sessions-client.js +6 -3
  274. package/dist/internal/skills-sync.d.ts +3 -5
  275. package/dist/internal/skills-sync.d.ts.map +1 -1
  276. package/dist/internal/skills-sync.js +3 -5
  277. package/dist/internal/start-log-store.d.ts +7 -18
  278. package/dist/internal/start-log-store.d.ts.map +1 -1
  279. package/dist/internal/start-log-store.js +47 -24
  280. package/dist/internal/storage-coordinator.d.ts +7 -10
  281. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  282. package/dist/internal/storage-coordinator.js +18 -20
  283. package/dist/internal/storage-roles.d.ts +5 -0
  284. package/dist/internal/storage-roles.d.ts.map +1 -1
  285. package/dist/internal/store-api-protocol.d.ts +12 -33
  286. package/dist/internal/store-api-protocol.d.ts.map +1 -1
  287. package/dist/internal/store-api-protocol.js +6 -22
  288. package/dist/internal/store-mirror.d.ts +4 -5
  289. package/dist/internal/store-mirror.d.ts.map +1 -1
  290. package/dist/internal/store-mirror.js +6 -8
  291. package/dist/internal/turn-cost.d.ts.map +1 -1
  292. package/dist/internal/turn-cost.js +31 -18
  293. package/dist/internal/turn-lease-store.d.ts +12 -5
  294. package/dist/internal/turn-lease-store.d.ts.map +1 -1
  295. package/dist/internal/turn-lease-store.js +61 -8
  296. package/dist/internal/v2-hosting.d.ts +4 -7
  297. package/dist/internal/v2-hosting.d.ts.map +1 -1
  298. package/dist/internal/v2-hosting.js +4 -7
  299. package/dist/internal/workspace-sync.d.ts +3 -6
  300. package/dist/internal/workspace-sync.d.ts.map +1 -1
  301. package/dist/internal/workspace-sync.js +3 -6
  302. package/dist/internal/workspace.d.ts +10 -16
  303. package/dist/internal/workspace.d.ts.map +1 -1
  304. package/dist/internal/workspace.js +9 -14
  305. package/dist/memory.d.ts +17 -43
  306. package/dist/memory.d.ts.map +1 -1
  307. package/dist/memory.js +34 -80
  308. package/dist/playground/assets/index-DPKLl4C_.css +1 -0
  309. package/dist/playground/assets/index-MijLHTbB.js +71 -0
  310. package/dist/playground/index.html +2 -2
  311. package/dist/storage-backends/cursor-hosted-v2.d.ts +8 -36
  312. package/dist/storage-backends/cursor-hosted-v2.d.ts.map +1 -1
  313. package/dist/storage-backends/cursor-hosted-v2.js +9 -37
  314. package/dist/storage-backends/cursor-hosted.d.ts +17 -30
  315. package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
  316. package/dist/storage-backends/cursor-hosted.js +14 -27
  317. package/dist/storage-protocol.d.ts +13 -38
  318. package/dist/storage-protocol.d.ts.map +1 -1
  319. package/dist/storage-protocol.js +14 -39
  320. package/dist/types.d.ts +29 -30
  321. package/dist/types.d.ts.map +1 -1
  322. package/docs/reference/cli.md +20 -9
  323. package/package.json +1 -1
  324. package/templates/pr-autofixer/bot/instructions.md +3 -3
  325. package/dist/docs/assets/chunks/@localSearchIndexroot.Bq-pxRXm.js +0 -1
  326. package/dist/docs/assets/chunks/channel.DCU8W1RP.js +0 -1
  327. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.DwpXsM06.js +0 -1
  328. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.DwpXsM06.js +0 -1
  329. package/dist/docs/assets/chunks/clone.DH6Mx2zB.js +0 -1
  330. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.kzD0-U89.js +0 -1
  331. package/dist/docs/assets/reference_cli.md.BsgDqYPh.lean.js +0 -1
  332. package/dist/playground/assets/index-6BbTPnaT.css +0 -1
  333. package/dist/playground/assets/index-CI7FAmOP.js +0 -71
@@ -1,22 +1,9 @@
1
1
  /**
2
- * Durable hosted-execution run log on the framework file store. **v2 only.**
2
+ * Durable execution history for hosted architecture-v2 sessions.
3
3
  *
4
- * One JSON document per factory session (`ses_…`), with per-execution
5
- * entries inside. The later customer UI is session-scoped ("why did this
6
- * session fail?") so a single GET is the read path; continuations are FIFO
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
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
9
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -47,8 +34,8 @@ const MAX_DOCUMENT_CHARS = 512 * 1024;
47
34
  export const SESSION_RUN_FATAL_FLUSH_TIMEOUT_MS = 2000;
48
35
  let fatalFlush;
49
36
  /**
50
- * Install the crash-handler flush used by `bin/agent-serve` on
51
- * `uncaughtException`. One process, one active hosted serve.
37
+ * Install the process-level crash flush. One process has one active hosted
38
+ * server.
52
39
  */
53
40
  export function registerSessionRunFatalFlush(flush) {
54
41
  fatalFlush = flush;
@@ -249,7 +236,7 @@ export function createSessionRunLogStore(input) {
249
236
  return parseSessionRunLogDocument(JSON.parse(new TextDecoder().decode(decodeSinkBody(body))));
250
237
  }
251
238
  catch (error) {
252
- logger(`[agent-sdk] session-run log: skip unreadable ${key} (${describeError(error)})`);
239
+ logger(`[bdk] session-run log: skip unreadable ${key} (${describeError(error)})`);
253
240
  return undefined;
254
241
  }
255
242
  });
@@ -261,7 +248,7 @@ export function createSessionRunLogStore(input) {
261
248
  existing = yield readDocument(write.sessionPublicId);
262
249
  }
263
250
  catch (error) {
264
- logger(`[agent-sdk] session-run log: persist failed for ${fitted.executionId} (${describeError(error)})`);
251
+ logger(`[bdk] session-run log: persist failed for ${fitted.executionId} (${describeError(error)})`);
265
252
  return;
266
253
  }
267
254
  const executions = upsertExecution((_a = existing === null || existing === void 0 ? void 0 : existing.executions) !== null && _a !== void 0 ? _a : [], fitted);
@@ -276,7 +263,7 @@ export function createSessionRunLogStore(input) {
276
263
  yield sink.put(key, new TextEncoder().encode(JSON.stringify(document)));
277
264
  }
278
265
  catch (error) {
279
- logger(`[agent-sdk] session-run log: persist failed for ${fitted.executionId} (${describeError(error)})`);
266
+ logger(`[bdk] session-run log: persist failed for ${fitted.executionId} (${describeError(error)})`);
280
267
  return;
281
268
  }
282
269
  if (fitted.turnStatus === "running") {
@@ -300,7 +287,7 @@ export function createSessionRunLogStore(input) {
300
287
  return yield readDocument(sessionPublicId);
301
288
  }
302
289
  catch (error) {
303
- logger(`[agent-sdk] session-run log: read failed for ${sessionPublicId} (${describeError(error)})`);
290
+ logger(`[bdk] session-run log: read failed for ${sessionPublicId} (${describeError(error)})`);
304
291
  return undefined;
305
292
  }
306
293
  });
@@ -325,10 +312,9 @@ export function createSessionRunLogStore(input) {
325
312
  };
326
313
  }
327
314
  /**
328
- * Same selection as the conversation mirror: architecture-v2 hosted
329
- * engines (generation env set). Store ids resolve lazily from env or the
330
- * task-bind files under `/run/cursor/secrets`. Self-hosted and v1 stay on
331
- * local disk / today's behavior.
315
+ * Enable durable execution history for architecture-v2 agents on
316
+ * Cursor-managed hosting. Self-hosted and architecture-v1 agents keep local
317
+ * behavior.
332
318
  */
333
319
  export function selectSessionRunLogStore(input) {
334
320
  const hosting = resolveAgentV2Hosting({
@@ -1 +1 @@
1
- {"version":3,"file":"sessions-client.d.ts","sourceRoot":"","sources":["../../src/internal/sessions-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEnF,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE7E,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,4DAA4D;IAC5D,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAEpF;AAED,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC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
  export function fetchSessionEvents(args) {
55
55
  return __awaiter(this, void 0, void 0, function* () {
56
- var _a;
56
+ var _a, _b;
57
+ var _c;
57
58
  const baseUrl = args.baseUrl.replace(/\/$/, "");
58
- const fetchImpl = (_a = args.fetchImpl) !== null && _a !== void 0 ? _a : fetch;
59
+ const fetchImpl = (_c = args.fetchImpl) !== null && _c !== void 0 ? _c : fetch;
59
60
  const path = `/v1/session/${encodeURIComponent(args.sessionId)}/events`;
60
61
  try {
61
62
  const jsonResp = yield fetchImpl(`${baseUrl}${path}?format=json`, {
@@ -76,6 +77,7 @@ export function fetchSessionEvents(args) {
76
77
  }
77
78
  }
78
79
  catch (error) {
80
+ (_a = args.signal) === null || _a === void 0 ? void 0 : _a.throwIfAborted();
79
81
  if (error instanceof Error && error.message.startsWith("Session ")) {
80
82
  throw error;
81
83
  }
@@ -104,13 +106,14 @@ export function fetchSessionEvents(args) {
104
106
  try {
105
107
  events.push(JSON.parse(line));
106
108
  }
107
- catch (_b) {
109
+ catch (_d) {
108
110
  // skip malformed lines
109
111
  }
110
112
  }
111
113
  return events;
112
114
  }
113
115
  catch (error) {
116
+ (_b = args.signal) === null || _b === void 0 ? void 0 : _b.throwIfAborted();
114
117
  if (error instanceof Error && error.message.startsWith("Session ")) {
115
118
  throw error;
116
119
  }
@@ -1,9 +1,7 @@
1
1
  /**
2
- * Sync authored skills onto an Agent Store so cloud-runtime turns discover
3
- * them natively. Hosted deployments write store-root `skills/<name>/…` (the
4
- * VM's `--agent-store-skills-dir /cursor/stores/deployment/skills`). Local
5
- * `serve`/`run` with `runtime: "cloud"` writes
6
- * `agent-serve/<agent>/skills/<name>/…` on the USER store.
2
+ * Sync authored skills to cloud-turn storage for native discovery. Managed
3
+ * deployments use deployment-scoped storage; local cloud turns use
4
+ * user-scoped storage namespaced by agent.
7
5
  */
8
6
  import { type FileSink } from "../files.js";
9
7
  import type { DiscoveredSkill } from "../types.js";
@@ -1 +1 @@
1
- {"version":3,"file":"skills-sync.d.ts","sourceRoot":"","sources":["../../src/internal/skills-sync.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,aAAa,CAAC;AASpE;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,IAAI,EAAE,QAAQ,CAAC;IACf,qFAAqF;IACrF,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IACnC,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBhB"}
1
+ {"version":3,"file":"skills-sync.d.ts","sourceRoot":"","sources":["../../src/internal/skills-sync.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,aAAa,CAAC;AASpE;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,IAAI,EAAE,QAAQ,CAAC;IACf,qFAAqF;IACrF,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IACnC,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBhB"}
@@ -1,9 +1,7 @@
1
1
  /**
2
- * Sync authored skills onto an Agent Store so cloud-runtime turns discover
3
- * them natively. Hosted deployments write store-root `skills/<name>/…` (the
4
- * VM's `--agent-store-skills-dir /cursor/stores/deployment/skills`). Local
5
- * `serve`/`run` with `runtime: "cloud"` writes
6
- * `agent-serve/<agent>/skills/<name>/…` on the USER store.
2
+ * Sync authored skills to cloud-turn storage for native discovery. Managed
3
+ * deployments use deployment-scoped storage; local cloud turns use
4
+ * user-scoped storage namespaced by agent.
7
5
  */
8
6
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
7
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -1,25 +1,14 @@
1
1
  /**
2
- * Durable hosted `start.log` on the framework file store. **v2 only.**
2
+ * Durable process output for managed architecture-v2 agents.
3
3
  *
4
- * The engine tees stdout/stderr to a local file. That file is the v2
5
- * customer log (errors, traces, debug). It is NOT written to S3 per line:
6
- * callers snapshot the local buffer and PUT once. The Temporal host does
7
- * a last catch-up at the end of the delivery so the object is complete
8
- * after park/discard.
9
- *
10
- * Same flush moments as `hosted-execution.json` and session-runs —
11
- * see `hosted-execution-flush.ts`. Keys: {@link agentSdkStorageKeys.log}.
12
- * Values are raw UTF-8, not JSON.
4
+ * The host persists a bounded snapshot of stdout and stderr after masking
5
+ * credential tokens. Writes happen at flush boundaries rather than per line.
13
6
  */
14
7
  import type { FileSink } from "../files.js";
15
8
  import type { AgentProject } from "../types.js";
16
- /**
17
- * Last N bytes flushed to the store. Matches the Temporal catch-up cap
18
- * so guest snapshots and host catch-up stay interchangeable. The store
19
- * allows 64 MiB; this keeps the dashboard snapshot bounded.
20
- */
9
+ /** Maximum bytes retained in each persisted output snapshot. */
21
10
  export declare const START_LOG_STORE_MAX_BYTES: number;
22
- /** Same path the hosted start command tees. Overridable in tests. */
11
+ /** Default local output path. */
23
12
  export declare const DEFAULT_ENGINE_START_LOG_PATH = "/workspace/.agent-serve/start.log";
24
13
  export interface StartLogStore {
25
14
  persist(startLogId: string, contents: string): Promise<void>;
@@ -49,8 +38,8 @@ export declare function selectStartLogStore(input: {
49
38
  env?: Record<string, string | undefined>;
50
39
  }): StartLogStore | undefined;
51
40
  /**
52
- * Snapshot the local tee into the store. No-op when the file is missing
53
- * or empty. Soft-fail inside {@link StartLogStore.persist}.
41
+ * Flushes on one store run one at a time, each reading the tee when its turn
42
+ * comes, so a slow earlier put cannot land over a later, longer snapshot.
54
43
  */
55
44
  export declare function flushLocalStartLog(args: {
56
45
  store: StartLogStore;
@@ -1 +1 @@
1
- {"version":3,"file":"start-log-store.d.ts","sourceRoot":"","sources":["../../src/internal/start-log-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAwB,CAAC;AAEjE,qEAAqE;AACrE,eAAO,MAAM,6BAA6B,sCAAsC,CAAC;AAEjF,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACvD;AAMD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMtE;AAED,wBAAgB,yBAAyB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAKtF;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,CAAC,EAAE;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAoB9B;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,GAAG,aAAa,CA8BhB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,OAAO,EAAE,Y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;CACnB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAoB9B;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,GAAG,aAAa,CAqChB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C,GAAG,aAAa,GAAG,SAAS,CAgB5B;AAQD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,KAAK,EAAE,aAAa,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,IAAI,CAAC,CAchB"}
@@ -1,15 +1,8 @@
1
1
  /**
2
- * Durable hosted `start.log` on the framework file store. **v2 only.**
2
+ * Durable process output for managed architecture-v2 agents.
3
3
  *
4
- * The engine tees stdout/stderr to a local file. That file is the v2
5
- * customer log (errors, traces, debug). It is NOT written to S3 per line:
6
- * callers snapshot the local buffer and PUT once. The Temporal host does
7
- * a last catch-up at the end of the delivery so the object is complete
8
- * after park/discard.
9
- *
10
- * Same flush moments as `hosted-execution.json` and session-runs —
11
- * see `hosted-execution-flush.ts`. Keys: {@link agentSdkStorageKeys.log}.
12
- * Values are raw UTF-8, not JSON.
4
+ * The host persists a bounded snapshot of stdout and stderr after masking
5
+ * credential tokens. Writes happen at flush boundaries rather than per line.
13
6
  */
14
7
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
8
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -26,13 +19,9 @@ import { agentSdkStorageKeys } from "../storage-protocol.js";
26
19
  import { resolveApiKeySync } from "./cursor/credentials.js";
27
20
  import { describeError } from "./describe-error.js";
28
21
  import { resolveAgentV2Hosting } from "./v2-hosting.js";
29
- /**
30
- * Last N bytes flushed to the store. Matches the Temporal catch-up cap
31
- * so guest snapshots and host catch-up stay interchangeable. The store
32
- * allows 64 MiB; this keeps the dashboard snapshot bounded.
33
- */
22
+ /** Maximum bytes retained in each persisted output snapshot. */
34
23
  export const START_LOG_STORE_MAX_BYTES = 2 * 1024 * 1024;
35
- /** Same path the hosted start command tees. Overridable in tests. */
24
+ /** Default local output path. */
36
25
  export const DEFAULT_ENGINE_START_LOG_PATH = "/workspace/.agent-serve/start.log";
37
26
  function decodeSinkBody(body) {
38
27
  return body instanceof Uint8Array ? body : body.body;
@@ -44,6 +33,26 @@ export function tailStartLogText(raw, maxBytes) {
44
33
  }
45
34
  return new TextDecoder().decode(encoded.subarray(encoded.byteLength - maxBytes));
46
35
  }
36
+ /** Each character literally or percent-encoded, as tokens appear in URLs. */
37
+ function encodable(text) {
38
+ return Array.from(text, char => {
39
+ const lower = char.charCodeAt(0).toString(16).padStart(2, "0");
40
+ const upper = char.toUpperCase().charCodeAt(0).toString(16).padStart(2, "0");
41
+ return lower === upper ? `(?:${char}|%${lower})` : `(?:${char}|%${lower}|%${upper})`;
42
+ }).join("");
43
+ }
44
+ const HEX = String.raw `(?:[a-f0-9]|%(?:3[0-9]|[46][1-6]))`;
45
+ const TOKEN_MASKS = [
46
+ [new RegExp(`${encodable("grok_")}${HEX}{32}${encodable("_")}${HEX}{64}`, "gi"), "grok_…"],
47
+ [new RegExp(`${encodable("crsr_")}(?:[a-z0-9_-]|%[0-9a-f]{2})+`, "gi"), "crsr_…"],
48
+ [/\bghs_[A-Za-z0-9_]+\b/g, "ghs_…"],
49
+ [/\bgho_[A-Za-z0-9_]+\b/g, "gho_…"],
50
+ [/\bxox[baprs]-[A-Za-z0-9-]+\b/g, "xox…"],
51
+ ];
52
+ /** Mask credential tokens before persisting a snapshot. */
53
+ function maskStartLogTokens(text) {
54
+ return TOKEN_MASKS.reduce((masked, [pattern, mask]) => masked.replace(pattern, mask), text);
55
+ }
47
56
  export function resolveEngineStartLogPath(env = process.env) {
48
57
  var _a;
49
58
  const configured = (_a = env.AGENT_SERVE_ENGINE_START_LOG_PATH) === null || _a === void 0 ? void 0 : _a.trim();
@@ -82,16 +91,23 @@ export function createStartLogStore(input) {
82
91
  var _a;
83
92
  const { sink, agentName } = input;
84
93
  const logger = (_a = input.logger) !== null && _a !== void 0 ? _a : (() => { });
94
+ // Flush moments often find the tee unchanged (a quiet turn, the claim then
95
+ // the stamp); skip a put that would store the same bytes again.
96
+ let stored;
85
97
  return {
86
98
  persist(startLogId, contents) {
87
99
  return __awaiter(this, void 0, void 0, function* () {
88
100
  const key = agentSdkStorageKeys.log(agentName, startLogId);
89
- const body = tailStartLogText(contents, START_LOG_STORE_MAX_BYTES);
101
+ const body = maskStartLogTokens(tailStartLogText(contents, START_LOG_STORE_MAX_BYTES));
102
+ if ((stored === null || stored === void 0 ? void 0 : stored.key) === key && stored.body === body) {
103
+ return;
104
+ }
90
105
  try {
91
106
  yield sink.put(key, new TextEncoder().encode(body));
107
+ stored = { key, body };
92
108
  }
93
109
  catch (error) {
94
- logger(`[agent-sdk] start-log: persist failed for ${startLogId} (${describeError(error)})`);
110
+ logger(`[bdk] start-log: persist failed for ${startLogId} (${describeError(error)})`);
95
111
  }
96
112
  });
97
113
  },
@@ -107,7 +123,7 @@ export function createStartLogStore(input) {
107
123
  return text.length === 0 ? undefined : text;
108
124
  }
109
125
  catch (error) {
110
- logger(`[agent-sdk] start-log: read failed for ${startLogId} (${describeError(error)})`);
126
+ logger(`[bdk] start-log: read failed for ${startLogId} (${describeError(error)})`);
111
127
  return undefined;
112
128
  }
113
129
  });
@@ -138,12 +154,19 @@ export function selectStartLogStore(input) {
138
154
  * Snapshot the local tee into the store. No-op when the file is missing
139
155
  * or empty. Soft-fail inside {@link StartLogStore.persist}.
140
156
  */
157
+ const flushing = new WeakMap();
158
+ /**
159
+ * Flushes on one store run one at a time, each reading the tee when its turn
160
+ * comes, so a slow earlier put cannot land over a later, longer snapshot.
161
+ */
141
162
  export function flushLocalStartLog(args) {
142
- return __awaiter(this, void 0, void 0, function* () {
163
+ var _a;
164
+ const run = ((_a = flushing.get(args.store)) !== null && _a !== void 0 ? _a : Promise.resolve()).then(() => __awaiter(this, void 0, void 0, function* () {
143
165
  const contents = yield readLocalStartLogText(args.path === undefined ? undefined : { path: args.path });
144
- if (contents === undefined) {
145
- return;
166
+ if (contents !== undefined) {
167
+ yield args.store.persist(args.startLogId, contents);
146
168
  }
147
- yield args.store.persist(args.startLogId, contents);
148
- });
169
+ }));
170
+ flushing.set(args.store, run.catch(() => undefined));
171
+ return run;
149
172
  }
@@ -10,9 +10,7 @@
10
10
  * failures — a throwing sink is logged and its write dropped; storage
11
11
  * must never stall or fail a turn.
12
12
  *
13
- * Scaling shape: sessions reduce to keyed puts on the KV sink; eval runs
14
- * go to their dedicated `evals` table. Reminder documents live on the
15
- * control plane. Everything shares one bounded, serialized queue.
13
+ * Session and eval writes share one bounded, serialized queue.
16
14
  *
17
15
  * It does three unrelated jobs, declared separately as
18
16
  * {@link FrameworkSessionStore}, {@link AuthorKvStore}, and
@@ -95,12 +93,12 @@ export declare class StorageCoordinator implements FrameworkSessionStore, Author
95
93
  eventDispatched(event: SessionEvent): void;
96
94
  /** Flush everything buffered for one session (ordered: events, record). */
97
95
  flushSession(sessionId: string, reason?: StorageContext["reason"]): void;
96
+ flushSessionExact(sessionId: string): void;
98
97
  private flushSessionInternal;
99
98
  /**
100
99
  * One queued op covering every put of a flush. When the sink offers
101
- * `putMany`, the whole flush is one backend round trip (on the hosted
102
- * file store: one presign call instead of one per key); otherwise the
103
- * puts run sequentially, exactly as before. Failures stay per-key —
100
+ * `putMany`, the whole flush is one backend round trip; otherwise the
101
+ * puts run sequentially. Failures stay per-key,
104
102
  * logged and dropped (at-most-once), never failing batch siblings.
105
103
  */
106
104
  private putsOp;
@@ -116,8 +114,8 @@ export declare class StorageCoordinator implements FrameworkSessionStore, Author
116
114
  /** Whether the sink can serve the startup bulk restore (`list`). */
117
115
  get canBulkRestore(): boolean;
118
116
  /**
119
- * True when the authored sink is `cursorHostedStorage` (Bugbot via the
120
- * control-plane proxy). `GET /v1/sessions` prefers this durable list.
117
+ * True when the configured sink uses Cursor-managed durable storage.
118
+ * `GET /v1/sessions` prefers this durable list.
121
119
  */
122
120
  get isCursorHosted(): boolean;
123
121
  /**
@@ -187,8 +185,7 @@ export declare class StorageCoordinator implements FrameworkSessionStore, Author
187
185
  evalRuns(): EvalRunStorage | undefined;
188
186
  /**
189
187
  * Flush all buffers and drain the queue, giving the sink at most
190
- * {@link CLOSE_DRAIN_TIMEOUT_MS} — a hung sink must not stall shutdown
191
- * past the pod grace period. Called from engine close.
188
+ * {@link CLOSE_DRAIN_TIMEOUT_MS}. Called from engine close.
192
189
  */
193
190
  close(): Promise<void>;
194
191
  /** Pending deliveries (exposed for tests and drain instrumentation). */
@@ -1 +1 @@
1
- {"version":3,"file":"storage-coordinator.d.ts","sourceRoot":"","sources":["../../src/internal/storage-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;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,oBAAo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,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9D;IAED,oEAAoE;IAC9D,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG/C;IAMD;;;;OAIG;IACH,QAAQ,IAAI,cAAc,GAAG,SAAS,CAyCrC;IAMD;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CA6B3B;IAED,wEAAwE;IACxE,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAExB;IAED,OAAO,CAAC,MAAM;IASd,OAAO,CAAC,WAAW;IAYnB,2EAA2E;YAC7D,OAAO;IAcrB,OAAO,CAAC,OAAO;IA4Bf,OAAO,CAAC,OAAO;CAGhB"}
@@ -10,9 +10,7 @@
10
10
  * failures — a throwing sink is logged and its write dropped; storage
11
11
  * must never stall or fail a turn.
12
12
  *
13
- * Scaling shape: sessions reduce to keyed puts on the KV sink; eval runs
14
- * go to their dedicated `evals` table. Reminder documents live on the
15
- * control plane. Everything shares one bounded, serialized queue.
13
+ * Session and eval writes share one bounded, serialized queue.
16
14
  *
17
15
  * It does three unrelated jobs, declared separately as
18
16
  * {@link FrameworkSessionStore}, {@link AuthorKvStore}, and
@@ -57,8 +55,7 @@ const TERMINAL_SESSION_EVENTS = new Set([
57
55
  const MAX_PENDING_OPS = 1000;
58
56
  /**
59
57
  * How long {@link StorageCoordinator.close} waits for the sink to
60
- * drain before giving up. Keeps a hung sink from stalling shutdown past
61
- * the pod grace period (where a SIGKILL would lose the flush anyway).
58
+ * drain before giving up. Keeps a hung sink within the shutdown budget.
62
59
  */
63
60
  const CLOSE_DRAIN_TIMEOUT_MS = 10000;
64
61
  /** Debounced event batching flushes early past this many buffered events. */
@@ -182,6 +179,9 @@ export class StorageCoordinator {
182
179
  // volatile-only diff.
183
180
  this.flushSessionInternal(sessionId, reason, reason !== "policy");
184
181
  }
182
+ flushSessionExact(sessionId) {
183
+ this.flushSessionInternal(sessionId, "policy", true);
184
+ }
185
185
  flushSessionInternal(sessionId, reason, exactRecord) {
186
186
  var _a, _b;
187
187
  const buffer = this.buffers.get(sessionId);
@@ -253,9 +253,8 @@ export class StorageCoordinator {
253
253
  }
254
254
  /**
255
255
  * One queued op covering every put of a flush. When the sink offers
256
- * `putMany`, the whole flush is one backend round trip (on the hosted
257
- * file store: one presign call instead of one per key); otherwise the
258
- * puts run sequentially, exactly as before. Failures stay per-key —
256
+ * `putMany`, the whole flush is one backend round trip; otherwise the
257
+ * puts run sequentially. Failures stay per-key,
259
258
  * logged and dropped (at-most-once), never failing batch siblings.
260
259
  */
261
260
  putsOp(puts, recordAck) {
@@ -295,7 +294,7 @@ export class StorageCoordinator {
295
294
  if (result.key === recordKey) {
296
295
  recordFailed = true;
297
296
  }
298
- this.logger(`[agent-sdk] storage put(${result.key}) failed: ${describeError(result.error)}`);
297
+ this.logger(`[bdk] storage put(${result.key}) failed: ${describeError(result.error)}`);
299
298
  }
300
299
  settleRecord(recordFailed);
301
300
  }),
@@ -313,7 +312,7 @@ export class StorageCoordinator {
313
312
  if (entry.key === recordKey) {
314
313
  recordFailed = true;
315
314
  }
316
- this.logger(`[agent-sdk] storage put(${entry.key}) failed: ${describeError(error)}`);
315
+ this.logger(`[bdk] storage put(${entry.key}) failed: ${describeError(error)}`);
317
316
  }
318
317
  }
319
318
  settleRecord(recordFailed);
@@ -364,8 +363,8 @@ export class StorageCoordinator {
364
363
  return this.definition.list !== undefined;
365
364
  }
366
365
  /**
367
- * True when the authored sink is `cursorHostedStorage` (Bugbot via the
368
- * control-plane proxy). `GET /v1/sessions` prefers this durable list.
366
+ * True when the configured sink uses Cursor-managed durable storage.
367
+ * `GET /v1/sessions` prefers this durable list.
369
368
  */
370
369
  get isCursorHosted() {
371
370
  return isCursorHostedStorage(this.definition);
@@ -492,7 +491,7 @@ export class StorageCoordinator {
492
491
  // Index entry without its record (e.g. the record write was shed
493
492
  // under at-most-once). The session is unrecoverable; treat as a miss
494
493
  // so the conversation can continue rather than failing forever.
495
- this.logger(`[agent-sdk] storage continuation entry points at missing session ${sessionId}; treating as a miss`);
494
+ this.logger(`[bdk] storage continuation entry points at missing session ${sessionId}; treating as a miss`);
496
495
  return undefined;
497
496
  }
498
497
  // The sink must answer for the exact key it was asked about — a
@@ -586,7 +585,7 @@ export class StorageCoordinator {
586
585
  return Array.isArray(runs) ? runs : [];
587
586
  }
588
587
  catch (error) {
589
- this.logger(`[agent-sdk] storage evals.list() failed: ${describeError(error)}`);
588
+ this.logger(`[bdk] storage evals.list() failed: ${describeError(error)}`);
590
589
  return [];
591
590
  }
592
591
  }),
@@ -597,8 +596,7 @@ export class StorageCoordinator {
597
596
  // ==========================================================================
598
597
  /**
599
598
  * Flush all buffers and drain the queue, giving the sink at most
600
- * {@link CLOSE_DRAIN_TIMEOUT_MS} — a hung sink must not stall shutdown
601
- * past the pod grace period. Called from engine close.
599
+ * {@link CLOSE_DRAIN_TIMEOUT_MS}. Called from engine close.
602
600
  */
603
601
  close() {
604
602
  return __awaiter(this, void 0, void 0, function* () {
@@ -627,7 +625,7 @@ export class StorageCoordinator {
627
625
  ]);
628
626
  clearTimeout(timer);
629
627
  if (!drained) {
630
- this.logger(`[agent-sdk] storage shutdown drain timed out after ${CLOSE_DRAIN_TIMEOUT_MS}ms with ${this.pending} write(s) undelivered`);
628
+ this.logger(`[bdk] storage shutdown drain timed out after ${CLOSE_DRAIN_TIMEOUT_MS}ms with ${this.pending} write(s) undelivered`);
631
629
  }
632
630
  });
633
631
  }
@@ -667,7 +665,7 @@ export class StorageCoordinator {
667
665
  return Array.isArray(entries) ? entries : [];
668
666
  }
669
667
  catch (error) {
670
- this.logger(`[agent-sdk] storage list(${prefix}) failed: ${describeError(error)}`);
668
+ this.logger(`[bdk] storage list(${prefix}) failed: ${describeError(error)}`);
671
669
  return [];
672
670
  }
673
671
  });
@@ -679,7 +677,7 @@ export class StorageCoordinator {
679
677
  if (this.pending + ops.length > MAX_PENDING_OPS) {
680
678
  this.dropped += ops.length;
681
679
  if (this.dropped <= ops.length || this.dropped % 1000 < ops.length) {
682
- this.logger(`[agent-sdk] storage queue full (${MAX_PENDING_OPS} pending writes); dropped ${this.dropped} write(s) so far — the sink is too slow for the traffic`);
680
+ this.logger(`[bdk] storage queue full (${MAX_PENDING_OPS} pending writes); dropped ${this.dropped} write(s) so far — the sink is too slow for the traffic`);
683
681
  }
684
682
  return;
685
683
  }
@@ -691,7 +689,7 @@ export class StorageCoordinator {
691
689
  yield op.run(ctx);
692
690
  }
693
691
  catch (error) {
694
- this.logger(`[agent-sdk] storage ${op.label} failed: ${describeError(error)}`);
692
+ this.logger(`[bdk] storage ${op.label} failed: ${describeError(error)}`);
695
693
  }
696
694
  finally {
697
695
  this.pending -= 1;
@@ -42,6 +42,11 @@ export interface FrameworkSessionStore {
42
42
  eventDispatched(event: SessionEvent): void;
43
43
  /** Flush everything buffered for one session (ordered: events, record). */
44
44
  flushSession(sessionId: string, reason?: StorageContext["reason"]): void;
45
+ /**
46
+ * {@link flushSession} that writes the exact record, repairing volatile-only
47
+ * skips. For a lifecycle edge the process may not outlive.
48
+ */
49
+ flushSessionExact(sessionId: string): void;
45
50
  /** True when the backend can list every session in one bulk read. */
46
51
  readonly canBulkRestore: boolean;
47
52
  /** True when the backend is the Cursor-hosted one rather than an authored sink. */
@@ -1 +1 @@
1
- {"version":3,"file":"storage-roles.d.ts","sourceRoot":"","sources":["../../src/internal/storage-roles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACpC,qEAAqE;IACrE,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CA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