@cursor/july 0.1.109 → 0.1.111

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 (1076) hide show
  1. package/AGENTS.md +1 -1
  2. package/README.md +0 -15
  3. package/dist/bin/agent-serve.js +81 -66
  4. package/dist/channels/bitbucket/api.js +8 -8
  5. package/dist/channels/bitbucket/binding.js +4 -4
  6. package/dist/channels/bitbucket/bitbucket-channel.js +1 -1
  7. package/dist/channels/bitbucket/bitbucket-webhook.js +1 -1
  8. package/dist/channels/bitbucket/checks.d.ts.map +1 -1
  9. package/dist/channels/bitbucket/checks.js +1 -1
  10. package/dist/channels/bitbucket/cursor-account.js +1 -1
  11. package/dist/channels/bitbucket/events.js +1 -1
  12. package/dist/channels/change-monitors/change-monitors-channel.js +1 -1
  13. package/dist/channels/checks.d.ts.map +1 -1
  14. package/dist/channels/checks.js +2 -2
  15. package/dist/channels/deployments/deployments-channel.js +1 -1
  16. package/dist/channels/github/cursor-account.js +3 -3
  17. package/dist/channels/github/defaults.d.ts.map +1 -1
  18. package/dist/channels/github/defaults.js +5 -3
  19. package/dist/channels/github/events.js +1 -1
  20. package/dist/channels/github/forward.js +8 -8
  21. package/dist/channels/github/github-channel.d.ts.map +1 -1
  22. package/dist/channels/github/github-channel.js +17 -13
  23. package/dist/channels/github/progress.d.ts.map +1 -1
  24. package/dist/channels/github/progress.js +7 -2
  25. package/dist/channels/github/state.d.ts +6 -0
  26. package/dist/channels/github/state.d.ts.map +1 -1
  27. package/dist/channels/github/types.d.ts +6 -0
  28. package/dist/channels/github/types.d.ts.map +1 -1
  29. package/dist/channels/gitlab/binding.js +4 -4
  30. package/dist/channels/gitlab/checks.d.ts.map +1 -1
  31. package/dist/channels/gitlab/checks.js +1 -1
  32. package/dist/channels/gitlab/cursor-account.js +1 -1
  33. package/dist/channels/gitlab/events.js +1 -1
  34. package/dist/channels/gitlab/gitlab-channel.js +1 -1
  35. package/dist/channels/gitlab/gitlab-webhook.js +1 -1
  36. package/dist/channels/gitlab/replay.js +2 -2
  37. package/dist/channels/origin/binding.d.ts +2 -0
  38. package/dist/channels/origin/binding.d.ts.map +1 -1
  39. package/dist/channels/origin/binding.js +3 -3
  40. package/dist/channels/origin/checks.d.ts +19 -7
  41. package/dist/channels/origin/checks.d.ts.map +1 -1
  42. package/dist/channels/origin/checks.js +13 -9
  43. package/dist/channels/origin/cursor-account.js +1 -1
  44. package/dist/channels/origin/defaults.d.ts.map +1 -1
  45. package/dist/channels/origin/defaults.js +3 -1
  46. package/dist/channels/origin/events.js +1 -1
  47. package/dist/channels/origin/origin-channel.d.ts.map +1 -1
  48. package/dist/channels/origin/origin-channel.js +2 -1
  49. package/dist/channels/origin/origin-webhook.js +2 -2
  50. package/dist/channels/slack/agentic-delivery.d.ts +23 -0
  51. package/dist/channels/slack/agentic-delivery.d.ts.map +1 -0
  52. package/dist/channels/slack/agentic-delivery.js +558 -0
  53. package/dist/channels/slack/agentic-posted.d.ts +30 -0
  54. package/dist/channels/slack/agentic-posted.d.ts.map +1 -0
  55. package/dist/channels/slack/agentic-posted.js +102 -0
  56. package/dist/channels/slack/agentic-signals.d.ts +48 -0
  57. package/dist/channels/slack/agentic-signals.d.ts.map +1 -0
  58. package/dist/channels/slack/agentic-signals.js +204 -0
  59. package/dist/channels/slack/api.d.ts +20 -1
  60. package/dist/channels/slack/api.d.ts.map +1 -1
  61. package/dist/channels/slack/api.js +43 -11
  62. package/dist/channels/slack/approvals.js +1 -1
  63. package/dist/channels/slack/auth.d.ts.map +1 -1
  64. package/dist/channels/slack/auth.js +3 -1
  65. package/dist/channels/slack/blocks.js +3 -3
  66. package/dist/channels/slack/bot-mentions.d.ts.map +1 -1
  67. package/dist/channels/slack/bot-mentions.js +5 -5
  68. package/dist/channels/slack/channel-watch.js +1 -1
  69. package/dist/channels/slack/cli-project.js +3 -3
  70. package/dist/channels/slack/defaults.d.ts +3 -0
  71. package/dist/channels/slack/defaults.d.ts.map +1 -1
  72. package/dist/channels/slack/defaults.js +90 -29
  73. package/dist/channels/slack/dispatch.d.ts +34 -1
  74. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  75. package/dist/channels/slack/dispatch.js +219 -106
  76. package/dist/channels/slack/doctor.js +1 -1
  77. package/dist/channels/slack/eval-directive.js +1 -1
  78. package/dist/channels/slack/external-policy.d.ts +2 -1
  79. package/dist/channels/slack/external-policy.d.ts.map +1 -1
  80. package/dist/channels/slack/external-policy.js +13 -2
  81. package/dist/channels/slack/footer.d.ts +30 -0
  82. package/dist/channels/slack/footer.d.ts.map +1 -0
  83. package/dist/channels/slack/footer.js +88 -0
  84. package/dist/channels/slack/index.d.ts +2 -0
  85. package/dist/channels/slack/index.d.ts.map +1 -1
  86. package/dist/channels/slack/index.js +2 -0
  87. package/dist/channels/slack/interactive.d.ts.map +1 -1
  88. package/dist/channels/slack/interactive.js +5 -3
  89. package/dist/channels/slack/live-delivery.d.ts +1 -1
  90. package/dist/channels/slack/live-delivery.d.ts.map +1 -1
  91. package/dist/channels/slack/live-delivery.js +20 -6
  92. package/dist/channels/slack/log.d.ts.map +1 -1
  93. package/dist/channels/slack/log.js +1 -1
  94. package/dist/channels/slack/manifest.js +1 -1
  95. package/dist/channels/slack/nudge-carrier.js +1 -1
  96. package/dist/channels/slack/nudge-store.js +2 -2
  97. package/dist/channels/slack/paint-start.d.ts +22 -0
  98. package/dist/channels/slack/paint-start.d.ts.map +1 -0
  99. package/dist/channels/slack/paint-start.js +91 -0
  100. package/dist/channels/slack/placeholder.d.ts +36 -0
  101. package/dist/channels/slack/placeholder.d.ts.map +1 -0
  102. package/dist/channels/slack/placeholder.js +240 -0
  103. package/dist/channels/slack/progress-delivery.d.ts.map +1 -1
  104. package/dist/channels/slack/progress-delivery.js +13 -4
  105. package/dist/channels/slack/reasoning-chip.d.ts +8 -0
  106. package/dist/channels/slack/reasoning-chip.d.ts.map +1 -0
  107. package/dist/channels/slack/reasoning-chip.js +30 -0
  108. package/dist/channels/slack/recording-sink.d.ts +29 -0
  109. package/dist/channels/slack/recording-sink.d.ts.map +1 -0
  110. package/dist/channels/slack/recording-sink.js +142 -0
  111. package/dist/channels/slack/reply-options.d.ts +8 -1
  112. package/dist/channels/slack/reply-options.d.ts.map +1 -1
  113. package/dist/channels/slack/reply-options.js +59 -14
  114. package/dist/channels/slack/setup.js +1 -1
  115. package/dist/channels/slack/slack-channel.d.ts +2 -2
  116. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  117. package/dist/channels/slack/slack-channel.js +55 -20
  118. package/dist/channels/slack/socket-mode.js +2 -2
  119. package/dist/channels/slack/thread-context.js +5 -5
  120. package/dist/channels/slack/tool-approval-events.d.ts +5 -0
  121. package/dist/channels/slack/tool-approval-events.d.ts.map +1 -1
  122. package/dist/channels/slack/tool-approval-events.js +50 -38
  123. package/dist/channels/slack/tool-cards.js +1 -1
  124. package/dist/channels/slack/tool-chip.d.ts +9 -0
  125. package/dist/channels/slack/tool-chip.d.ts.map +1 -0
  126. package/dist/channels/slack/tool-chip.js +25 -0
  127. package/dist/channels/slack/types.d.ts +49 -7
  128. package/dist/channels/slack/types.d.ts.map +1 -1
  129. package/dist/channels/slack/upload.d.ts +13 -0
  130. package/dist/channels/slack/upload.d.ts.map +1 -0
  131. package/dist/channels/slack/upload.js +135 -0
  132. package/dist/channels.d.ts +10 -14
  133. package/dist/channels.d.ts.map +1 -1
  134. package/dist/channels.js +9 -21
  135. package/dist/dashboard-session-url.d.ts +15 -0
  136. package/dist/dashboard-session-url.d.ts.map +1 -0
  137. package/dist/dashboard-session-url.js +25 -0
  138. package/dist/docs/404.html +3 -3
  139. package/dist/docs/architecture.svg +59 -0
  140. package/dist/docs/assets/app.Drol6mi6.js +309 -0
  141. package/dist/docs/assets/{building-with-agents.md.D0KbSkJn.js → building-with-agents.md.CEGVXkmO.js} +2 -2
  142. package/dist/docs/assets/{building-with-agents.md.D0KbSkJn.lean.js → building-with-agents.md.CEGVXkmO.lean.js} +1 -1
  143. package/dist/docs/assets/chunks/@localSearchIndexroot.DtXk1hy-.js +1 -0
  144. package/dist/docs/assets/chunks/{VPLocalSearchBox.CVQERt56.js → VPLocalSearchBox.CdqoBZJX.js} +2 -2
  145. package/dist/docs/assets/chunks/arc.BVX3ycTn.js +1 -0
  146. package/dist/docs/assets/chunks/architectureDiagram-Q4EWVU46.CcChnMxX.js +36 -0
  147. package/dist/docs/assets/chunks/baseUniq.xwtXO-yt.js +1 -0
  148. package/dist/docs/assets/chunks/blockDiagram-DXYQGD6D.CijZ_taK.js +132 -0
  149. package/dist/docs/assets/chunks/c4Diagram-AHTNJAMY.0FBvwBvK.js +10 -0
  150. package/dist/docs/assets/chunks/channel.Bkv1N-gK.js +1 -0
  151. package/dist/docs/assets/chunks/chunk-4BX2VUAB.CELMmMDA.js +1 -0
  152. package/dist/docs/assets/chunks/chunk-4TB4RGXK.C4bhFtSm.js +206 -0
  153. package/dist/docs/assets/chunks/chunk-55IACEB6.ZnQ9gRRQ.js +1 -0
  154. package/dist/docs/assets/chunks/chunk-EDXVE4YY.DPlmglG-.js +1 -0
  155. package/dist/docs/assets/chunks/chunk-FMBD7UC4.BrUk8pff.js +15 -0
  156. package/dist/docs/assets/chunks/chunk-OYMX7WX6.CcmWIncu.js +231 -0
  157. package/dist/docs/assets/chunks/chunk-QZHKN3VN.D65-cs8I.js +1 -0
  158. package/dist/docs/assets/chunks/chunk-YZCP3GAM.qoXZpG9F.js +1 -0
  159. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.CZDco1o8.js +1 -0
  160. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.CZDco1o8.js +1 -0
  161. package/dist/docs/assets/chunks/clone.YSt_40_s.js +1 -0
  162. package/dist/docs/assets/chunks/cose-bilkent-S5V4N54A.8rYtqudO.js +1 -0
  163. package/dist/docs/assets/chunks/cytoscape.esm.BQk4lpUV.js +331 -0
  164. package/dist/docs/assets/chunks/dagre-KV5264BT.DrRP1fOh.js +4 -0
  165. package/dist/docs/assets/chunks/defaultLocale.C4B-KCzX.js +1 -0
  166. package/dist/docs/assets/chunks/diagram-5BDNPKRD.DHj_xA2_.js +10 -0
  167. package/dist/docs/assets/chunks/diagram-G4DWMVQ6.Bz_6nAKj.js +24 -0
  168. package/dist/docs/assets/chunks/diagram-MMDJMWI5.BWA0xSW9.js +43 -0
  169. package/dist/docs/assets/chunks/diagram-TYMM5635.CpTJLNJI.js +24 -0
  170. package/dist/docs/assets/chunks/erDiagram-SMLLAGMA.-7AWWSrP.js +85 -0
  171. package/dist/docs/assets/chunks/flowDiagram-DWJPFMVM.BTnQ742_.js +162 -0
  172. package/dist/docs/assets/chunks/framework.dypDpWZ3.js +19 -0
  173. package/dist/docs/assets/chunks/ganttDiagram-T4ZO3ILL.B5_HiiQ5.js +292 -0
  174. package/dist/docs/assets/chunks/gitGraphDiagram-UUTBAWPF.CZcNTFZd.js +106 -0
  175. package/dist/docs/assets/chunks/graph.V2GLaab4.js +1 -0
  176. package/dist/docs/assets/chunks/infoDiagram-42DDH7IO.7pZOkCCU.js +2 -0
  177. package/dist/docs/assets/chunks/init.Gi6I4Gst.js +1 -0
  178. package/dist/docs/assets/chunks/ishikawaDiagram-UXIWVN3A.DSMo3Qa3.js +70 -0
  179. package/dist/docs/assets/chunks/journeyDiagram-VCZTEJTY.BNEgWN1S.js +139 -0
  180. package/dist/docs/assets/chunks/kanban-definition-6JOO6SKY.B-4d4tC7.js +89 -0
  181. package/dist/docs/assets/chunks/katex.DkKDou_j.js +257 -0
  182. package/dist/docs/assets/chunks/layout.Dvbn9nSb.js +1 -0
  183. package/dist/docs/assets/chunks/linear.D2GM4p4b.js +1 -0
  184. package/dist/docs/assets/chunks/min.DVBtLK-B.js +1 -0
  185. package/dist/docs/assets/chunks/mindmap-definition-QFDTVHPH.CnJRI55x.js +96 -0
  186. package/dist/docs/assets/chunks/ordinal.DBvzRdQf.js +1 -0
  187. package/dist/docs/assets/chunks/pieDiagram-DEJITSTG.CtoaTFlA.js +30 -0
  188. package/dist/docs/assets/chunks/quadrantDiagram-34T5L4WZ.DtT24_vN.js +7 -0
  189. package/dist/docs/assets/chunks/requirementDiagram-MS252O5E.CjSO4o8f.js +84 -0
  190. package/dist/docs/assets/chunks/sankeyDiagram-XADWPNL6.-wWiIVWa.js +10 -0
  191. package/dist/docs/assets/chunks/sequenceDiagram-FGHM5R23.DSk8s4gX.js +157 -0
  192. package/dist/docs/assets/chunks/stateDiagram-FHFEXIEX.BFKAsdkN.js +1 -0
  193. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.C4CLm481.js +1 -0
  194. package/dist/docs/assets/chunks/{theme.Dnsd3XOn.js → theme.C0MctGaz.js} +2 -2
  195. package/dist/docs/assets/chunks/timeline-definition-GMOUNBTQ.TUNJbAFe.js +120 -0
  196. package/dist/docs/assets/chunks/vennDiagram-DHZGUBPP.C-RGNnk4.js +34 -0
  197. package/dist/docs/assets/chunks/virtual_mermaid-config.DDnGl6nM.js +1 -0
  198. package/dist/docs/assets/chunks/wardley-RL74JXVD.g5efOWmT.js +162 -0
  199. package/dist/docs/assets/chunks/wardleyDiagram-NUSXRM2D.DH4zt73Y.js +20 -0
  200. package/dist/docs/assets/chunks/xychartDiagram-5P7HB3ND.B-3k6bF6.js +7 -0
  201. package/dist/docs/assets/{deployment.md.JenwuCCB.js → deployment.md.Dm4Qo3hp.js} +5 -5
  202. package/dist/docs/assets/{deployment.md.JenwuCCB.lean.js → deployment.md.Dm4Qo3hp.lean.js} +1 -1
  203. package/dist/docs/assets/{evals.md.C7JLjoEP.js → evals.md.BLDRt5LH.js} +4 -4
  204. package/dist/docs/assets/{evals.md.C7JLjoEP.lean.js → evals.md.BLDRt5LH.lean.js} +1 -1
  205. package/dist/docs/assets/guides_agent-to-agent.md.BI0xclmy.js +14 -0
  206. package/dist/docs/assets/guides_agent-to-agent.md.BI0xclmy.lean.js +1 -0
  207. package/dist/docs/assets/{guides_bitbucket.md.DZPzmUjU.js → guides_bitbucket.md.CTpCl__f.js} +1 -1
  208. package/dist/docs/assets/{guides_bitbucket.md.DZPzmUjU.lean.js → guides_bitbucket.md.CTpCl__f.lean.js} +1 -1
  209. package/dist/docs/assets/{guides_cloud-agents.md.BsloyHdY.js → guides_cloud-agents.md.lSE_l7lH.js} +2 -2
  210. package/dist/docs/assets/{guides_cloud-agents.md.BsloyHdY.lean.js → guides_cloud-agents.md.lSE_l7lH.lean.js} +1 -1
  211. package/dist/docs/assets/{guides_convert-automation.md.B4sjlodG.js → guides_convert-automation.md.Ck6Cr68A.js} +1 -1
  212. package/dist/docs/assets/{guides_convert-automation.md.B4sjlodG.lean.js → guides_convert-automation.md.Ck6Cr68A.lean.js} +1 -1
  213. package/dist/docs/assets/{guides_github.md.TZaTZlfz.js → guides_github.md.D6ER29dG.js} +1 -1
  214. package/dist/docs/assets/{guides_github.md.TZaTZlfz.lean.js → guides_github.md.D6ER29dG.lean.js} +1 -1
  215. package/dist/docs/assets/{guides_gitlab.md.BmqwQfdG.js → guides_gitlab.md.P-TjBnS5.js} +1 -1
  216. package/dist/docs/assets/{guides_gitlab.md.BmqwQfdG.lean.js → guides_gitlab.md.P-TjBnS5.lean.js} +1 -1
  217. package/dist/docs/assets/guides_grokbot-agents.md.WBZIOvkz.js +9 -0
  218. package/dist/docs/assets/{guides_grokbot-agents.md.DyV-WArv.lean.js → guides_grokbot-agents.md.WBZIOvkz.lean.js} +1 -1
  219. package/dist/docs/assets/{guides_improve.md.BGVk32bK.js → guides_improve.md.BKaDuKKK.js} +1 -1
  220. package/dist/docs/assets/{guides_improve.md.BGVk32bK.lean.js → guides_improve.md.BKaDuKKK.lean.js} +1 -1
  221. package/dist/docs/assets/{guides_mcp-oauth.md.Dp6cDP7f.js → guides_mcp-oauth.md.DMNMpXtO.js} +1 -1
  222. package/dist/docs/assets/{guides_mcp-oauth.md.Dp6cDP7f.lean.js → guides_mcp-oauth.md.DMNMpXtO.lean.js} +1 -1
  223. package/dist/docs/assets/{guides_opentelemetry.md.SCRMskno.js → guides_opentelemetry.md._CRfDyzH.js} +14 -14
  224. package/dist/docs/assets/{guides_opentelemetry.md.SCRMskno.lean.js → guides_opentelemetry.md._CRfDyzH.lean.js} +1 -1
  225. package/dist/docs/assets/{guides_slack.md.D4RVMM4G.js → guides_slack.md.DdT8rmsj.js} +12 -4
  226. package/dist/docs/assets/{guides_slack.md.D4RVMM4G.lean.js → guides_slack.md.DdT8rmsj.lean.js} +1 -1
  227. package/dist/docs/assets/{guides_webhooks.md.CJK484ex.js → guides_webhooks.md.aQW10HRe.js} +2 -2
  228. package/dist/docs/assets/{guides_webhooks.md.CJK484ex.lean.js → guides_webhooks.md.aQW10HRe.lean.js} +1 -1
  229. package/dist/docs/assets/hillclimbing.md.Dq4kkVIL.js +1 -0
  230. package/dist/docs/assets/hillclimbing.md.Dq4kkVIL.lean.js +1 -0
  231. package/dist/docs/assets/index.md.BFVyY2KT.js +17 -0
  232. package/dist/docs/assets/index.md.BFVyY2KT.lean.js +1 -0
  233. package/dist/docs/assets/{quickstart.md.DdQOF7Y8.js → quickstart.md.D3MjSZN-.js} +30 -38
  234. package/dist/docs/assets/quickstart.md.D3MjSZN-.lean.js +1 -0
  235. package/dist/docs/assets/{reference_agent-config.md.CvoL6pof.js → reference_agent-config.md.CfVA-LZJ.js} +1 -1
  236. package/dist/docs/assets/{reference_agent-config.md.CvoL6pof.lean.js → reference_agent-config.md.CfVA-LZJ.lean.js} +1 -1
  237. package/dist/docs/assets/{reference_artifacts.md.Dior32Qw.js → reference_artifacts.md.Vf7qyIZ-.js} +1 -1
  238. package/dist/docs/assets/{reference_artifacts.md.Dior32Qw.lean.js → reference_artifacts.md.Vf7qyIZ-.lean.js} +1 -1
  239. package/dist/docs/assets/{reference_channels.md.CAo-iK4j.js → reference_channels.md.icqLKcTc.js} +2 -12
  240. package/dist/docs/assets/{reference_channels.md.CAo-iK4j.lean.js → reference_channels.md.icqLKcTc.lean.js} +1 -1
  241. package/dist/docs/assets/{reference_cli.md.Deg7849l.js → reference_cli.md.B2dBL6L8.js} +3 -3
  242. package/dist/docs/assets/{reference_cli.md.Deg7849l.lean.js → reference_cli.md.B2dBL6L8.lean.js} +1 -1
  243. package/dist/docs/assets/{reference_connections.md.BojkC6c5.js → reference_connections.md.Cb3U_c8n.js} +4 -4
  244. package/dist/docs/assets/{reference_connections.md.BojkC6c5.lean.js → reference_connections.md.Cb3U_c8n.lean.js} +1 -1
  245. package/dist/docs/assets/{reference_extensions.md.ZAVUyuEX.js → reference_extensions.md.wlFD3cUR.js} +2 -2
  246. package/dist/docs/assets/{reference_extensions.md.ZAVUyuEX.lean.js → reference_extensions.md.wlFD3cUR.lean.js} +1 -1
  247. package/dist/docs/assets/{reference_hooks.md.BlM_bOg6.js → reference_hooks.md.CZuynAxj.js} +3 -3
  248. package/dist/docs/assets/{reference_hooks.md.BlM_bOg6.lean.js → reference_hooks.md.CZuynAxj.lean.js} +1 -1
  249. package/dist/docs/assets/{reference_http-api.md.BwaCo-VO.js → reference_http-api.md.DTKcYE6L.js} +3 -3
  250. package/dist/docs/assets/{reference_http-api.md.BwaCo-VO.lean.js → reference_http-api.md.DTKcYE6L.lean.js} +1 -1
  251. package/dist/docs/assets/{reference_instructions.md.CR7XSsGk.js → reference_instructions.md.D7gkckK-.js} +1 -1
  252. package/dist/docs/assets/{reference_instructions.md.CR7XSsGk.lean.js → reference_instructions.md.D7gkckK-.lean.js} +1 -1
  253. package/dist/docs/assets/{reference_playground.md.DLnoaczX.js → reference_playground.md.D2YExv5K.js} +1 -1
  254. package/dist/docs/assets/{reference_playground.md.DLnoaczX.lean.js → reference_playground.md.D2YExv5K.lean.js} +1 -1
  255. package/dist/docs/assets/{reference_project-layout.md.BEU8MtQV.js → reference_project-layout.md.DPxbUJyt.js} +3 -3
  256. package/dist/docs/assets/{reference_project-layout.md.BEU8MtQV.lean.js → reference_project-layout.md.DPxbUJyt.lean.js} +1 -1
  257. package/dist/docs/assets/{reference_prompt.md.DnaD5dNK.js → reference_prompt.md.BQ5uAv1F.js} +1 -1
  258. package/dist/docs/assets/{reference_prompt.md.DnaD5dNK.lean.js → reference_prompt.md.BQ5uAv1F.lean.js} +1 -1
  259. package/dist/docs/assets/{reference_schedules.md.DI_JrHgq.js → reference_schedules.md.BasfZWO-.js} +1 -1
  260. package/dist/docs/assets/{reference_schedules.md.DI_JrHgq.lean.js → reference_schedules.md.BasfZWO-.lean.js} +1 -1
  261. package/dist/docs/assets/{reference_sessions.md.CyXV1MUw.js → reference_sessions.md.YKvIsWAx.js} +1 -1
  262. package/dist/docs/assets/{reference_sessions.md.CyXV1MUw.lean.js → reference_sessions.md.YKvIsWAx.lean.js} +1 -1
  263. package/dist/docs/assets/{reference_skills.md.l2ezAcaN.js → reference_skills.md.rNgpsGd0.js} +1 -1
  264. package/dist/docs/assets/{reference_skills.md.l2ezAcaN.lean.js → reference_skills.md.rNgpsGd0.lean.js} +1 -1
  265. package/dist/docs/assets/{reference_subagents.md.CfsIloPm.js → reference_subagents.md.e5qitjJt.js} +2 -2
  266. package/dist/docs/assets/{reference_subagents.md.CfsIloPm.lean.js → reference_subagents.md.e5qitjJt.lean.js} +1 -1
  267. package/dist/docs/assets/{reference_tools.md.aGrn99hP.js → reference_tools.md.BdCO2aHZ.js} +4 -4
  268. package/dist/docs/assets/{reference_tools.md.aGrn99hP.lean.js → reference_tools.md.BdCO2aHZ.lean.js} +1 -1
  269. package/dist/docs/assets/{style.DCD_zyg3.css → style.Cfo2vbik.css} +1 -1
  270. package/dist/docs/assets/{templates_agentic-owners.md.BZSH4N9z.js → templates_agentic-owners.md.Da_AGDlH.js} +1 -1
  271. package/dist/docs/assets/{templates_agentic-owners.md.BZSH4N9z.lean.js → templates_agentic-owners.md.Da_AGDlH.lean.js} +1 -1
  272. package/dist/docs/assets/{templates_pr-autofixer.md.Bds_XWcV.js → templates_pr-autofixer.md.DqxocIGh.js} +1 -1
  273. package/dist/docs/assets/{templates_pr-autofixer.md.Bds_XWcV.lean.js → templates_pr-autofixer.md.DqxocIGh.lean.js} +1 -1
  274. package/dist/docs/assets/{templates_security-reviewer.md.lshxbCLK.js → templates_security-reviewer.md.Bhnvd8VE.js} +1 -1
  275. package/dist/docs/assets/{templates_security-reviewer.md.lshxbCLK.lean.js → templates_security-reviewer.md.Bhnvd8VE.lean.js} +1 -1
  276. package/dist/docs/assets/{templates_triage.md.Co4UNzkZ.js → templates_triage.md.BdBWO9Ic.js} +1 -1
  277. package/dist/docs/assets/{templates_triage.md.Co4UNzkZ.lean.js → templates_triage.md.BdBWO9Ic.lean.js} +1 -1
  278. package/dist/docs/assets/{troubleshooting.md.CYEAO9bM.js → troubleshooting.md.BcgNoYtJ.js} +1 -1
  279. package/dist/docs/assets/{troubleshooting.md.CYEAO9bM.lean.js → troubleshooting.md.BcgNoYtJ.lean.js} +1 -1
  280. package/dist/docs/building-with-agents.html +41 -8
  281. package/dist/docs/building-with-agents.md +13 -15
  282. package/dist/docs/deployment.html +44 -11
  283. package/dist/docs/deployment.md +6 -7
  284. package/dist/docs/evals.html +44 -11
  285. package/dist/docs/evals.md +5 -5
  286. package/dist/docs/guides/agent-to-agent.html +48 -11
  287. package/dist/docs/guides/agent-to-agent.md +40 -83
  288. package/dist/docs/guides/bitbucket.html +41 -8
  289. package/dist/docs/guides/cloud-agents.html +41 -8
  290. package/dist/docs/guides/cloud-agents.md +24 -20
  291. package/dist/docs/guides/convert-automation.html +41 -8
  292. package/dist/docs/guides/github.html +41 -8
  293. package/dist/docs/guides/github.md +1 -1
  294. package/dist/docs/guides/gitlab.html +41 -8
  295. package/dist/docs/guides/grokbot-agents.html +41 -8
  296. package/dist/docs/guides/grokbot-agents.md +26 -19
  297. package/dist/docs/guides/improve.html +41 -8
  298. package/dist/docs/guides/mcp-oauth.html +41 -8
  299. package/dist/docs/guides/mcp-oauth.md +1 -1
  300. package/dist/docs/guides/opentelemetry.html +53 -20
  301. package/dist/docs/guides/opentelemetry.md +28 -41
  302. package/dist/docs/guides/slack.html +51 -10
  303. package/dist/docs/guides/slack.md +53 -4
  304. package/dist/docs/guides/webhooks.html +42 -9
  305. package/dist/docs/guides/webhooks.md +3 -4
  306. package/dist/docs/hashmap.json +1 -1
  307. package/dist/docs/hillclimbing.html +40 -10
  308. package/dist/docs/hillclimbing.md +5 -5
  309. package/dist/docs/index.html +57 -12
  310. package/dist/docs/index.md +81 -150
  311. package/dist/docs/llms-full.txt +5779 -10297
  312. package/dist/docs/llms.txt +3 -29
  313. package/dist/docs/quickstart.html +70 -45
  314. package/dist/docs/quickstart.md +44 -105
  315. package/dist/docs/reference/agent-config.html +41 -8
  316. package/dist/docs/reference/artifacts.html +41 -8
  317. package/dist/docs/reference/channels.html +41 -18
  318. package/dist/docs/reference/channels.md +0 -16
  319. package/dist/docs/reference/cli.html +42 -9
  320. package/dist/docs/reference/cli.md +0 -16
  321. package/dist/docs/reference/connections.html +43 -10
  322. package/dist/docs/reference/connections.md +3 -5
  323. package/dist/docs/reference/extensions.html +42 -9
  324. package/dist/docs/reference/extensions.md +2 -2
  325. package/dist/docs/reference/hooks.html +42 -9
  326. package/dist/docs/reference/hooks.md +2 -4
  327. package/dist/docs/reference/http-api.html +42 -9
  328. package/dist/docs/reference/http-api.md +5 -5
  329. package/dist/docs/reference/instructions.html +41 -8
  330. package/dist/docs/reference/playground.html +40 -7
  331. package/dist/docs/reference/playground.md +2 -2
  332. package/dist/docs/reference/project-layout.html +42 -9
  333. package/dist/docs/reference/project-layout.md +3 -4
  334. package/dist/docs/reference/prompt.html +41 -8
  335. package/dist/docs/reference/schedules.html +41 -8
  336. package/dist/docs/reference/sessions.html +40 -7
  337. package/dist/docs/reference/sessions.md +5 -4
  338. package/dist/docs/reference/skills.html +41 -8
  339. package/dist/docs/reference/subagents.html +41 -8
  340. package/dist/docs/reference/subagents.md +2 -4
  341. package/dist/docs/reference/tools.html +43 -10
  342. package/dist/docs/reference/tools.md +2 -5
  343. package/dist/docs/templates/agentic-owners.html +41 -8
  344. package/dist/docs/templates/pr-autofixer.html +41 -8
  345. package/dist/docs/templates/security-reviewer.html +41 -8
  346. package/dist/docs/templates/triage.html +41 -8
  347. package/dist/docs/troubleshooting.html +40 -7
  348. package/dist/docs/troubleshooting.md +1 -2
  349. package/dist/evals/assertions.js +19 -19
  350. package/dist/evals/expect.js +1 -1
  351. package/dist/evals/judge.js +1 -1
  352. package/dist/evals/reporters.d.ts.map +1 -1
  353. package/dist/evals/reporters.js +8 -8
  354. package/dist/evals/run-facts.js +2 -2
  355. package/dist/evals.d.ts +1 -1
  356. package/dist/evals.d.ts.map +1 -1
  357. package/dist/evals.js +7 -7
  358. package/dist/extensions/cursor-cloud-agents/extension.js +1 -1
  359. package/dist/extensions/cursor-cloud-agents/lib/backend.js +3 -3
  360. package/dist/extensions/cursor-cloud-agents/lib/fleet.js +1 -1
  361. package/dist/extensions/cursor-cloud-agents/lib/repos.js +6 -6
  362. package/dist/extensions/cursor-cloud-agents/lib/transcript.d.ts.map +1 -1
  363. package/dist/extensions/cursor-cloud-agents/lib/transcript.js +2 -2
  364. package/dist/extensions/cursor-cloud-agents/tools/list.js +1 -1
  365. package/dist/extensions/improve/skills/yourself.js +1 -1
  366. package/dist/extensions/slack-communication/extension.d.ts +28 -0
  367. package/dist/extensions/slack-communication/extension.d.ts.map +1 -0
  368. package/dist/extensions/slack-communication/extension.js +32 -0
  369. package/dist/extensions/slack-communication/skills/slack-voice.d.ts +5 -0
  370. package/dist/extensions/slack-communication/skills/slack-voice.d.ts.map +1 -0
  371. package/dist/extensions/slack-communication/skills/slack-voice.js +54 -0
  372. package/dist/extensions/slack-communication/tools/delete-message.d.ts +4 -0
  373. package/dist/extensions/slack-communication/tools/delete-message.d.ts.map +1 -0
  374. package/dist/extensions/slack-communication/tools/delete-message.js +29 -0
  375. package/dist/extensions/slack-communication/tools/edit-message.d.ts +4 -0
  376. package/dist/extensions/slack-communication/tools/edit-message.d.ts.map +1 -0
  377. package/dist/extensions/slack-communication/tools/edit-message.js +37 -0
  378. package/dist/extensions/slack-communication/tools/post-card.d.ts +4 -0
  379. package/dist/extensions/slack-communication/tools/post-card.d.ts.map +1 -0
  380. package/dist/extensions/slack-communication/tools/post-card.js +25 -0
  381. package/dist/extensions/slack-communication/tools/post-file.d.ts +4 -0
  382. package/dist/extensions/slack-communication/tools/post-file.d.ts.map +1 -0
  383. package/dist/extensions/slack-communication/tools/post-file.js +76 -0
  384. package/dist/extensions/slack-communication/tools/post-update.d.ts +4 -0
  385. package/dist/extensions/slack-communication/tools/post-update.d.ts.map +1 -0
  386. package/dist/extensions/slack-communication/tools/post-update.js +36 -0
  387. package/dist/extensions/slack-communication/tools/react.d.ts +4 -0
  388. package/dist/extensions/slack-communication/tools/react.d.ts.map +1 -0
  389. package/dist/extensions/slack-communication/tools/react.js +27 -0
  390. package/dist/extensions/slack-communication/tools/set-status.d.ts +4 -0
  391. package/dist/extensions/slack-communication/tools/set-status.d.ts.map +1 -0
  392. package/dist/extensions/slack-communication/tools/set-status.js +18 -0
  393. package/dist/files-backends/cursor-hosted.d.ts +18 -6
  394. package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
  395. package/dist/files-backends/cursor-hosted.js +357 -74
  396. package/dist/files-backends/local-fs.js +1 -1
  397. package/dist/files.d.ts +15 -0
  398. package/dist/files.d.ts.map +1 -1
  399. package/dist/filesystem.d.ts.map +1 -1
  400. package/dist/filesystem.js +15 -15
  401. package/dist/index.d.ts +5 -8
  402. package/dist/index.d.ts.map +1 -1
  403. package/dist/index.js +4 -6
  404. package/dist/internal/advertise-tools.js +6 -6
  405. package/dist/internal/approval-gate.js +1 -1
  406. package/dist/internal/artifacts-store.js +3 -3
  407. package/dist/internal/as-of.js +2 -2
  408. package/dist/internal/authored-alias-hooks.js +1 -1
  409. package/dist/internal/builtin-tools/reminders.js +2 -2
  410. package/dist/internal/chat-client.js +5 -5
  411. package/dist/internal/cli-ax.d.ts +1 -0
  412. package/dist/internal/cli-ax.d.ts.map +1 -1
  413. package/dist/internal/cli-ax.js +68 -13
  414. package/dist/internal/cli-bitbucket.js +10 -10
  415. package/dist/internal/cli-convert-automation.js +2 -2
  416. package/dist/internal/cli-cursor.d.ts +3 -11
  417. package/dist/internal/cli-cursor.d.ts.map +1 -1
  418. package/dist/internal/cli-cursor.js +5 -10
  419. package/dist/internal/cli-deploy.d.ts +12 -2
  420. package/dist/internal/cli-deploy.d.ts.map +1 -1
  421. package/dist/internal/cli-deploy.js +328 -96
  422. package/dist/internal/cli-docs.js +5 -5
  423. package/dist/internal/cli-github.js +15 -16
  424. package/dist/internal/cli-gitlab.js +10 -10
  425. package/dist/internal/cli-manifest.js +1 -1
  426. package/dist/internal/cli-mcp-oauth.d.ts.map +1 -1
  427. package/dist/internal/cli-mcp-oauth.js +5 -5
  428. package/dist/internal/cli-mcp.js +3 -3
  429. package/dist/internal/cli-skills.js +2 -2
  430. package/dist/internal/cli-slack.js +5 -5
  431. package/dist/internal/cloud-turn-cost.js +1 -1
  432. package/dist/internal/continuation-identity.d.ts.map +1 -1
  433. package/dist/internal/continuation-identity.js +14 -9
  434. package/dist/internal/conversation-mirror.d.ts.map +1 -1
  435. package/dist/internal/conversation-mirror.js +33 -2
  436. package/dist/internal/convert-automation/convert-workflow.js +25 -24
  437. package/dist/internal/convert-automation/types.d.ts +8 -0
  438. package/dist/internal/convert-automation/types.d.ts.map +1 -1
  439. package/dist/internal/cursor/account-mcp.d.ts +2 -2
  440. package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
  441. package/dist/internal/cursor/account-mcp.js +32 -27
  442. package/dist/internal/cursor/backend-client.d.ts +15 -10
  443. package/dist/internal/cursor/backend-client.d.ts.map +1 -1
  444. package/dist/internal/cursor/backend-client.js +17 -11
  445. package/dist/internal/cursor/credentials.js +1 -1
  446. package/dist/internal/cursor/hosted-store-secrets.d.ts +16 -0
  447. package/dist/internal/cursor/hosted-store-secrets.d.ts.map +1 -1
  448. package/dist/internal/cursor/hosted-store-secrets.js +25 -0
  449. package/dist/internal/cursor-account-mcp-auth.js +9 -9
  450. package/dist/internal/cursor-deployment-relay.js +9 -9
  451. package/dist/internal/cursor-event-relay.js +10 -10
  452. package/dist/internal/cursor-relay-core.js +2 -2
  453. package/dist/internal/deploy-client.d.ts +106 -9
  454. package/dist/internal/deploy-client.d.ts.map +1 -1
  455. package/dist/internal/deploy-client.js +171 -23
  456. package/dist/internal/deploy-manifest.d.ts +13 -0
  457. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  458. package/dist/internal/deploy-manifest.js +32 -16
  459. package/dist/internal/discovery/agent-config.d.ts +5 -0
  460. package/dist/internal/discovery/agent-config.d.ts.map +1 -1
  461. package/dist/internal/discovery/agent-config.js +27 -0
  462. package/dist/internal/discovery/agent.d.ts.map +1 -1
  463. package/dist/internal/discovery/agent.js +10 -8
  464. package/dist/internal/discovery/channels.js +4 -4
  465. package/dist/internal/discovery/connections.js +4 -4
  466. package/dist/internal/discovery/cursor-plugin.js +12 -12
  467. package/dist/internal/discovery/extension-overlay.js +3 -3
  468. package/dist/internal/discovery/extensions.js +6 -6
  469. package/dist/internal/discovery/info.js +9 -9
  470. package/dist/internal/discovery/instructions.js +1 -1
  471. package/dist/internal/discovery/project.d.ts.map +1 -1
  472. package/dist/internal/discovery/project.js +4 -4
  473. package/dist/internal/discovery/services.js +1 -1
  474. package/dist/internal/discovery/tools.js +1 -1
  475. package/dist/internal/docs-site.js +2 -2
  476. package/dist/internal/env-file.js +1 -1
  477. package/dist/internal/eval-run-store.d.ts.map +1 -1
  478. package/dist/internal/eval-run-store.js +7 -7
  479. package/dist/internal/eval-runner.js +14 -14
  480. package/dist/internal/evals-client.js +4 -4
  481. package/dist/internal/event-log.js +8 -8
  482. package/dist/internal/event-mapper.d.ts +18 -0
  483. package/dist/internal/event-mapper.d.ts.map +1 -1
  484. package/dist/internal/event-mapper.js +34 -2
  485. package/dist/internal/filesystem/format.d.ts.map +1 -1
  486. package/dist/internal/filesystem/format.js +6 -3
  487. package/dist/internal/filesystem/scratch.js +3 -3
  488. package/dist/internal/filesystem/tools.d.ts.map +1 -1
  489. package/dist/internal/filesystem/tools.js +6 -6
  490. package/dist/internal/filesystem/walk.js +1 -1
  491. package/dist/internal/framework-file-storage.d.ts +6 -2
  492. package/dist/internal/framework-file-storage.d.ts.map +1 -1
  493. package/dist/internal/framework-file-storage.js +91 -2
  494. package/dist/internal/framework-storage-selection.d.ts +0 -6
  495. package/dist/internal/framework-storage-selection.d.ts.map +1 -1
  496. package/dist/internal/framework-storage-selection.js +2 -11
  497. package/dist/internal/github-fanout.js +3 -3
  498. package/dist/internal/guest-network.js +4 -4
  499. package/dist/internal/host-files.js +1 -1
  500. package/dist/internal/host-kv.js +2 -2
  501. package/dist/internal/hosted-admission-adapter.d.ts +2 -0
  502. package/dist/internal/hosted-admission-adapter.d.ts.map +1 -1
  503. package/dist/internal/hosted-catch-protocol.d.ts.map +1 -1
  504. package/dist/internal/hosted-catch-protocol.js +2 -4
  505. package/dist/internal/hosted-catch.js +1 -1
  506. package/dist/internal/hosted-delivery-protocol.d.ts +29 -0
  507. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  508. package/dist/internal/hosted-delivery-protocol.js +76 -8
  509. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  510. package/dist/internal/hosted-delivery.js +201 -64
  511. package/dist/internal/hosted-execution-diag.js +3 -3
  512. package/dist/internal/hosted-execution-latency.d.ts +80 -0
  513. package/dist/internal/hosted-execution-latency.d.ts.map +1 -0
  514. package/dist/internal/hosted-execution-latency.js +220 -0
  515. package/dist/internal/hosting.d.ts +5 -5
  516. package/dist/internal/hosting.d.ts.map +1 -1
  517. package/dist/internal/hosting.js +5 -6
  518. package/dist/internal/http-channel-define.d.ts +11 -0
  519. package/dist/internal/http-channel-define.d.ts.map +1 -0
  520. package/dist/internal/http-channel-define.js +18 -0
  521. package/dist/internal/http-channel.d.ts +2 -3
  522. package/dist/internal/http-channel.d.ts.map +1 -1
  523. package/dist/internal/http-channel.js +3 -4
  524. package/dist/internal/http-control-plane-session.d.ts +7 -3
  525. package/dist/internal/http-control-plane-session.d.ts.map +1 -1
  526. package/dist/internal/http-control-plane-session.js +22 -10
  527. package/dist/internal/incoming-headers-to-fetch.d.ts +10 -0
  528. package/dist/internal/incoming-headers-to-fetch.d.ts.map +1 -0
  529. package/dist/internal/incoming-headers-to-fetch.js +41 -0
  530. package/dist/internal/init-interview.js +7 -7
  531. package/dist/internal/init-project.d.ts.map +1 -1
  532. package/dist/internal/init-project.js +14 -14
  533. package/dist/internal/init-scaffold.js +1 -1
  534. package/dist/internal/inline-stdio-mcp.js +2 -2
  535. package/dist/internal/install-cursor-skills.js +10 -10
  536. package/dist/internal/json-schema.js +1 -1
  537. package/dist/internal/local-control-plane.d.ts.map +1 -1
  538. package/dist/internal/local-control-plane.js +3 -3
  539. package/dist/internal/local-env.js +3 -3
  540. package/dist/internal/log-ring.js +1 -1
  541. package/dist/internal/logs-client.js +1 -1
  542. package/dist/internal/mcp-endpoint.js +8 -8
  543. package/dist/internal/mcp-host.js +4 -4
  544. package/dist/internal/mcp-oauth-on-demand.js +3 -3
  545. package/dist/internal/mcp-oauth.js +5 -5
  546. package/dist/internal/net.js +2 -2
  547. package/dist/internal/otel/config.js +3 -3
  548. package/dist/internal/otel/runtime.js +13 -13
  549. package/dist/internal/peer-connections.js +2 -2
  550. package/dist/internal/platform-schedule-sync.js +1 -1
  551. package/dist/internal/platform-timers.js +1 -1
  552. package/dist/internal/playground/static.js +2 -2
  553. package/dist/internal/playground/toolchain.js +2 -2
  554. package/dist/internal/playground-proxy.js +3 -3
  555. package/dist/internal/process-memory-telemetry.js +1 -1
  556. package/dist/internal/reminder-runner.d.ts.map +1 -1
  557. package/dist/internal/reminder-runner.js +7 -7
  558. package/dist/internal/reminder-store.js +1 -1
  559. package/dist/internal/request-error-status.d.ts.map +1 -1
  560. package/dist/internal/request-error-status.js +9 -0
  561. package/dist/internal/resolved-connections.js +8 -8
  562. package/dist/internal/result-output.d.ts +14 -2
  563. package/dist/internal/result-output.d.ts.map +1 -1
  564. package/dist/internal/result-output.js +45 -2
  565. package/dist/internal/router.js +4 -4
  566. package/dist/internal/run-client.js +2 -2
  567. package/dist/internal/schedule-runner.js +6 -6
  568. package/dist/internal/scm/pr-url.d.ts +3 -1
  569. package/dist/internal/scm/pr-url.d.ts.map +1 -1
  570. package/dist/internal/scm/pr-url.js +10 -2
  571. package/dist/internal/sdk-runner.d.ts.map +1 -1
  572. package/dist/internal/sdk-runner.js +14 -15
  573. package/dist/internal/serve-restart.js +1 -1
  574. package/dist/internal/server.d.ts.map +1 -1
  575. package/dist/internal/server.js +81 -87
  576. package/dist/internal/session-cost.js +3 -3
  577. package/dist/internal/session-engine.d.ts +34 -0
  578. package/dist/internal/session-engine.d.ts.map +1 -1
  579. package/dist/internal/session-engine.js +380 -184
  580. package/dist/internal/session-run-log.d.ts.map +1 -1
  581. package/dist/internal/session-run-log.js +4 -4
  582. package/dist/internal/session-store.d.ts +47 -3
  583. package/dist/internal/session-store.d.ts.map +1 -1
  584. package/dist/internal/session-store.js +198 -33
  585. package/dist/internal/sessions-client.js +3 -3
  586. package/dist/internal/slack-thread-key.d.ts +7 -0
  587. package/dist/internal/slack-thread-key.d.ts.map +1 -0
  588. package/dist/internal/slack-thread-key.js +10 -0
  589. package/dist/internal/sleep.js +1 -1
  590. package/dist/internal/storage-coordinator.d.ts +17 -0
  591. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  592. package/dist/internal/storage-coordinator.js +111 -11
  593. package/dist/internal/storage.d.ts +2 -0
  594. package/dist/internal/storage.d.ts.map +1 -0
  595. package/dist/internal/storage.js +1 -0
  596. package/dist/internal/store-mirror.js +4 -4
  597. package/dist/internal/terminal-style.js +2 -2
  598. package/dist/internal/tool-result.js +3 -3
  599. package/dist/internal/trajectory.js +7 -7
  600. package/dist/internal/turn-governor.js +2 -2
  601. package/dist/internal/turn-outbox.js +1 -1
  602. package/dist/internal/update-check.js +2 -2
  603. package/dist/internal/v2-hosting.d.ts +9 -0
  604. package/dist/internal/v2-hosting.d.ts.map +1 -1
  605. package/dist/internal/v2-hosting.js +10 -0
  606. package/dist/internal/workspace.d.ts +13 -10
  607. package/dist/internal/workspace.d.ts.map +1 -1
  608. package/dist/internal/workspace.js +17 -16
  609. package/dist/kv/memory-kv.d.ts +6 -4
  610. package/dist/kv/memory-kv.d.ts.map +1 -1
  611. package/dist/kv/memory-kv.js +9 -7
  612. package/dist/kv.d.ts +4 -7
  613. package/dist/kv.d.ts.map +1 -1
  614. package/dist/kv.js +4 -7
  615. package/dist/otel-public.d.ts +7 -0
  616. package/dist/otel-public.d.ts.map +1 -0
  617. package/dist/otel-public.js +5 -0
  618. package/dist/otel.d.ts +7 -2
  619. package/dist/otel.d.ts.map +1 -1
  620. package/dist/otel.js +7 -2
  621. package/dist/playground/assets/index-BLlKgZtI.css +1 -0
  622. package/dist/playground/assets/index-CDS5p9sR.js +67 -0
  623. package/dist/playground/index.html +2 -2
  624. package/dist/prompt.js +1 -1
  625. package/dist/result.d.ts +10 -4
  626. package/dist/result.d.ts.map +1 -1
  627. package/dist/result.js +9 -3
  628. package/dist/storage-backends/cursor-hosted-v2.js +2 -2
  629. package/dist/storage-backends/cursor-hosted.d.ts +5 -17
  630. package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
  631. package/dist/storage-backends/cursor-hosted.js +6 -20
  632. package/dist/storage-backends/file-kv.js +7 -7
  633. package/dist/storage.d.ts +20 -2
  634. package/dist/storage.d.ts.map +1 -1
  635. package/dist/storage.js +7 -6
  636. package/dist/types.d.ts +67 -11
  637. package/dist/types.d.ts.map +1 -1
  638. package/dist/types.js +12 -4
  639. package/docs/README.md +83 -152
  640. package/docs/building-with-agents.md +13 -15
  641. package/docs/deployment.md +6 -7
  642. package/docs/evals.md +5 -5
  643. package/docs/guides/agent-to-agent.md +41 -84
  644. package/docs/guides/cloud-agents.md +25 -20
  645. package/docs/guides/github.md +1 -1
  646. package/docs/guides/grokbot-agents.md +27 -19
  647. package/docs/guides/mcp-oauth.md +1 -1
  648. package/docs/guides/opentelemetry.md +28 -41
  649. package/docs/guides/slack.md +53 -4
  650. package/docs/guides/webhooks.md +3 -4
  651. package/docs/hillclimbing.md +5 -5
  652. package/docs/quickstart.md +45 -106
  653. package/docs/reference/channels.md +0 -16
  654. package/docs/reference/cli.md +0 -16
  655. package/docs/reference/connections.md +3 -5
  656. package/docs/reference/extensions.md +2 -2
  657. package/docs/reference/hooks.md +2 -4
  658. package/docs/reference/http-api.md +5 -5
  659. package/docs/reference/playground.md +2 -2
  660. package/docs/reference/project-layout.md +3 -4
  661. package/docs/reference/sessions.md +5 -4
  662. package/docs/reference/subagents.md +2 -4
  663. package/docs/reference/tools.md +2 -5
  664. package/docs/troubleshooting.md +1 -2
  665. package/package.json +55 -37
  666. package/skills/framework-map/SKILL.md +2 -2
  667. package/skills/otel/SKILL.md +8 -18
  668. package/src/bin/agent-serve.ts +93 -72
  669. package/src/channels/bitbucket/api.ts +8 -8
  670. package/src/channels/bitbucket/binding.ts +4 -4
  671. package/src/channels/bitbucket/bitbucket-channel.ts +1 -1
  672. package/src/channels/bitbucket/bitbucket-webhook.ts +1 -1
  673. package/src/channels/bitbucket/checks.ts +3 -4
  674. package/src/channels/bitbucket/cursor-account.ts +1 -1
  675. package/src/channels/bitbucket/events.ts +1 -1
  676. package/src/channels/change-monitors/change-monitors-channel.ts +2 -2
  677. package/src/channels/checks.ts +5 -4
  678. package/src/channels/deployments/deployments-channel.ts +1 -1
  679. package/src/channels/github/api.ts +1 -1
  680. package/src/channels/github/checks.ts +1 -1
  681. package/src/channels/github/cursor-account.ts +3 -3
  682. package/src/channels/github/defaults.ts +8 -4
  683. package/src/channels/github/events.ts +1 -1
  684. package/src/channels/github/forward.ts +8 -8
  685. package/src/channels/github/github-channel.ts +19 -2
  686. package/src/channels/github/progress.ts +7 -2
  687. package/src/channels/github/state.ts +6 -0
  688. package/src/channels/github/types.ts +6 -0
  689. package/src/channels/gitlab/binding.ts +4 -4
  690. package/src/channels/gitlab/checks.ts +3 -4
  691. package/src/channels/gitlab/cursor-account.ts +1 -1
  692. package/src/channels/gitlab/events.ts +1 -1
  693. package/src/channels/gitlab/gitlab-channel.ts +1 -1
  694. package/src/channels/gitlab/gitlab-webhook.ts +1 -1
  695. package/src/channels/gitlab/replay.ts +2 -2
  696. package/src/channels/origin/binding.ts +6 -3
  697. package/src/channels/origin/checks.ts +27 -17
  698. package/src/channels/origin/cursor-account.ts +1 -1
  699. package/src/channels/origin/defaults.ts +5 -1
  700. package/src/channels/origin/events.ts +1 -1
  701. package/src/channels/origin/origin-channel.ts +2 -1
  702. package/src/channels/origin/origin-webhook.ts +2 -2
  703. package/src/channels/slack/agentic-delivery.ts +659 -0
  704. package/src/channels/slack/agentic-posted.ts +148 -0
  705. package/src/channels/slack/agentic-signals.ts +248 -0
  706. package/src/channels/slack/api.ts +51 -11
  707. package/src/channels/slack/approvals.ts +1 -1
  708. package/src/channels/slack/attachments.ts +1 -1
  709. package/src/channels/slack/auth.ts +3 -1
  710. package/src/channels/slack/blocks.ts +3 -3
  711. package/src/channels/slack/bot-mentions.ts +5 -7
  712. package/src/channels/slack/channel-watch.ts +1 -1
  713. package/src/channels/slack/cli-project.ts +3 -3
  714. package/src/channels/slack/defaults.ts +109 -37
  715. package/src/channels/slack/dispatch.ts +299 -170
  716. package/src/channels/slack/doctor.ts +1 -1
  717. package/src/channels/slack/eval-directive.ts +1 -1
  718. package/src/channels/slack/external-policy.ts +15 -2
  719. package/src/channels/slack/footer.ts +108 -0
  720. package/src/channels/slack/index.ts +2 -0
  721. package/src/channels/slack/interactive.ts +4 -2
  722. package/src/channels/slack/live-delivery.ts +23 -7
  723. package/src/channels/slack/log.ts +1 -1
  724. package/src/channels/slack/manifest.ts +1 -1
  725. package/src/channels/slack/nudge-carrier.ts +1 -1
  726. package/src/channels/slack/nudge-store.ts +2 -2
  727. package/src/channels/slack/paint-start.ts +93 -0
  728. package/src/channels/slack/placeholder.ts +315 -0
  729. package/src/channels/slack/progress-delivery.ts +14 -1
  730. package/src/channels/slack/reasoning-chip.ts +48 -0
  731. package/src/channels/slack/recording-sink.ts +176 -0
  732. package/src/channels/slack/reply-options.ts +71 -15
  733. package/src/channels/slack/setup.ts +1 -1
  734. package/src/channels/slack/slack-channel.ts +73 -13
  735. package/src/channels/slack/socket-mode.ts +2 -2
  736. package/src/channels/slack/thread-context.ts +5 -5
  737. package/src/channels/slack/tool-approval-events.ts +54 -38
  738. package/src/channels/slack/tool-cards.ts +1 -1
  739. package/src/channels/slack/tool-chip.ts +36 -0
  740. package/src/channels/slack/types.ts +47 -7
  741. package/src/channels/slack/upload.ts +142 -0
  742. package/src/channels.ts +12 -30
  743. package/src/dashboard-session-url.ts +32 -0
  744. package/src/evals/assertions.ts +19 -19
  745. package/src/evals/expect.ts +1 -1
  746. package/src/evals/judge.ts +1 -1
  747. package/src/evals/reporters.ts +8 -9
  748. package/src/evals/run-facts.ts +2 -2
  749. package/src/evals.ts +7 -10
  750. package/src/extensions/cursor-cloud-agents/extension.ts +1 -1
  751. package/src/extensions/cursor-cloud-agents/lib/backend.ts +3 -3
  752. package/src/extensions/cursor-cloud-agents/lib/fleet.ts +1 -1
  753. package/src/extensions/cursor-cloud-agents/lib/repos.ts +3 -3
  754. package/src/extensions/cursor-cloud-agents/lib/transcript.ts +3 -4
  755. package/src/extensions/cursor-cloud-agents/tools/list.ts +1 -1
  756. package/src/extensions/improve/skills/yourself.ts +1 -1
  757. package/src/extensions/slack-communication/evals/harness.ts +728 -0
  758. package/src/extensions/slack-communication/evals/slack-communication.eval.ts +953 -0
  759. package/src/extensions/slack-communication/evals/slack-placeholder.eval.ts +194 -0
  760. package/src/extensions/slack-communication/extension.ts +45 -0
  761. package/src/extensions/slack-communication/skills/slack-voice.ts +59 -0
  762. package/src/extensions/slack-communication/tools/delete-message.ts +34 -0
  763. package/src/extensions/slack-communication/tools/edit-message.ts +42 -0
  764. package/src/extensions/slack-communication/tools/post-card.ts +28 -0
  765. package/src/extensions/slack-communication/tools/post-file.ts +85 -0
  766. package/src/extensions/slack-communication/tools/post-update.ts +41 -0
  767. package/src/extensions/slack-communication/tools/react.ts +33 -0
  768. package/src/extensions/slack-communication/tools/set-status.ts +21 -0
  769. package/src/files-backends/cursor-hosted.ts +502 -98
  770. package/src/files-backends/local-fs.ts +1 -1
  771. package/src/files.ts +15 -0
  772. package/src/filesystem.ts +16 -18
  773. package/src/index.ts +4 -36
  774. package/src/internal/advertise-tools.ts +6 -6
  775. package/src/internal/approval-gate.ts +1 -1
  776. package/src/internal/artifacts-store.ts +3 -3
  777. package/src/internal/as-of.ts +2 -2
  778. package/src/internal/authored-alias-hooks.ts +1 -1
  779. package/src/internal/authored-loaders.ts +2 -3
  780. package/src/internal/builtin-tools/reminders.ts +2 -2
  781. package/src/internal/chat-client.ts +5 -5
  782. package/src/internal/cli-ax.ts +84 -14
  783. package/src/internal/cli-bitbucket.ts +11 -11
  784. package/src/internal/cli-convert-automation.ts +2 -2
  785. package/src/internal/cli-cursor.ts +5 -16
  786. package/src/internal/cli-deploy.ts +389 -104
  787. package/src/internal/cli-docs.ts +5 -5
  788. package/src/internal/cli-github.ts +16 -19
  789. package/src/internal/cli-gitlab.ts +11 -11
  790. package/src/internal/cli-manifest.ts +1 -1
  791. package/src/internal/cli-mcp-oauth.ts +5 -7
  792. package/src/internal/cli-mcp.ts +3 -3
  793. package/src/internal/cli-skills.ts +2 -2
  794. package/src/internal/cli-slack.ts +5 -5
  795. package/src/internal/cloud-turn-cost.ts +1 -1
  796. package/src/internal/continuation-identity.ts +13 -9
  797. package/src/internal/conversation-mirror.ts +36 -3
  798. package/src/internal/convert-automation/convert-workflow.ts +27 -27
  799. package/src/internal/convert-automation/types.ts +9 -0
  800. package/src/internal/cursor/account-mcp.ts +48 -31
  801. package/src/internal/cursor/backend-client.ts +28 -17
  802. package/src/internal/cursor/credentials.ts +1 -1
  803. package/src/internal/cursor/hosted-store-secrets.ts +34 -0
  804. package/src/internal/cursor-account-mcp-auth.ts +9 -9
  805. package/src/internal/cursor-deployment-relay.ts +10 -10
  806. package/src/internal/cursor-event-relay.ts +10 -10
  807. package/src/internal/cursor-relay-core.ts +2 -2
  808. package/src/internal/deploy-client.ts +266 -24
  809. package/src/internal/deploy-manifest.ts +46 -8
  810. package/src/internal/discovery/agent-config.ts +34 -0
  811. package/src/internal/discovery/agent.ts +14 -6
  812. package/src/internal/discovery/channels.ts +4 -4
  813. package/src/internal/discovery/connections.ts +4 -4
  814. package/src/internal/discovery/cursor-plugin.ts +12 -12
  815. package/src/internal/discovery/extension-overlay.ts +3 -3
  816. package/src/internal/discovery/extensions.ts +6 -6
  817. package/src/internal/discovery/info.ts +9 -9
  818. package/src/internal/discovery/instructions.ts +1 -1
  819. package/src/internal/discovery/project.ts +4 -4
  820. package/src/internal/discovery/services.ts +1 -1
  821. package/src/internal/discovery/tools.ts +1 -1
  822. package/src/internal/docs-site.ts +2 -2
  823. package/src/internal/env-file.ts +2 -2
  824. package/src/internal/eval-run-store.ts +7 -9
  825. package/src/internal/eval-runner.ts +20 -20
  826. package/src/internal/evals-client.ts +6 -6
  827. package/src/internal/event-log.ts +10 -10
  828. package/src/internal/event-mapper.ts +37 -2
  829. package/src/internal/filesystem/format.ts +11 -12
  830. package/src/internal/filesystem/scratch.ts +3 -3
  831. package/src/internal/filesystem/tools.ts +6 -8
  832. package/src/internal/filesystem/walk.ts +1 -1
  833. package/src/internal/framework-file-storage.ts +104 -4
  834. package/src/internal/framework-storage-selection.ts +2 -12
  835. package/src/internal/github-fanout.ts +4 -4
  836. package/src/internal/guest-network.ts +4 -4
  837. package/src/internal/host-files.ts +1 -1
  838. package/src/internal/host-kv.ts +2 -2
  839. package/src/internal/hosted-admission-adapter.ts +2 -0
  840. package/src/internal/hosted-catch-protocol.ts +3 -5
  841. package/src/internal/hosted-catch.ts +1 -1
  842. package/src/internal/hosted-delivery-protocol.ts +111 -13
  843. package/src/internal/hosted-delivery.ts +286 -81
  844. package/src/internal/hosted-execution-diag.ts +3 -3
  845. package/src/internal/hosted-execution-latency.ts +334 -0
  846. package/src/internal/hosting.ts +5 -6
  847. package/src/internal/http-channel-define.ts +27 -0
  848. package/src/internal/http-channel.ts +3 -4
  849. package/src/internal/http-control-plane-session.ts +24 -11
  850. package/src/internal/incoming-headers-to-fetch.ts +54 -0
  851. package/src/internal/init-interview.ts +7 -7
  852. package/src/internal/init-project.ts +14 -16
  853. package/src/internal/init-scaffold.ts +1 -1
  854. package/src/internal/inline-stdio-mcp.ts +2 -2
  855. package/src/internal/install-cursor-skills.ts +11 -11
  856. package/src/internal/json-schema.ts +1 -1
  857. package/src/internal/local-control-plane.ts +4 -5
  858. package/src/internal/local-env.ts +3 -3
  859. package/src/internal/log-ring.ts +1 -1
  860. package/src/internal/logs-client.ts +1 -1
  861. package/src/internal/mcp-endpoint.ts +10 -10
  862. package/src/internal/mcp-host.ts +9 -9
  863. package/src/internal/mcp-oauth-on-demand.ts +3 -3
  864. package/src/internal/mcp-oauth.ts +5 -5
  865. package/src/internal/net.ts +2 -2
  866. package/src/internal/otel/config.ts +3 -3
  867. package/src/internal/otel/runtime.ts +14 -14
  868. package/src/internal/peer-connections.ts +2 -2
  869. package/src/internal/platform-schedule-sync.ts +1 -1
  870. package/src/internal/platform-timers.ts +1 -1
  871. package/src/internal/playground/static.ts +2 -2
  872. package/src/internal/playground/toolchain.ts +2 -2
  873. package/src/internal/playground-proxy.ts +3 -3
  874. package/src/internal/process-memory-telemetry.ts +1 -1
  875. package/src/internal/reminder-runner.ts +8 -10
  876. package/src/internal/reminder-store.ts +1 -1
  877. package/src/internal/request-error-status.ts +9 -0
  878. package/src/internal/resolved-connections.ts +8 -8
  879. package/src/internal/result-output.ts +62 -5
  880. package/src/internal/router.ts +4 -4
  881. package/src/internal/run-client.ts +2 -2
  882. package/src/internal/schedule-runner.ts +6 -6
  883. package/src/internal/scm/pr-url.ts +11 -2
  884. package/src/internal/sdk-runner.ts +14 -28
  885. package/src/internal/serve-restart.ts +1 -1
  886. package/src/internal/server.ts +97 -99
  887. package/src/internal/session-cost.ts +3 -3
  888. package/src/internal/session-engine.ts +504 -244
  889. package/src/internal/session-run-log.ts +4 -6
  890. package/src/internal/session-store.ts +213 -39
  891. package/src/internal/sessions-client.ts +3 -3
  892. package/src/internal/slack-thread-key.ts +11 -0
  893. package/src/internal/sleep.ts +1 -1
  894. package/src/internal/storage-coordinator.ts +118 -21
  895. package/src/internal/storage.ts +1 -0
  896. package/src/internal/store-mirror.ts +4 -4
  897. package/src/internal/terminal-style.ts +2 -2
  898. package/src/internal/tool-result.ts +3 -3
  899. package/src/internal/trajectory.ts +7 -7
  900. package/src/internal/turn-governor.ts +2 -2
  901. package/src/internal/turn-outbox.ts +1 -1
  902. package/src/internal/update-check.ts +2 -2
  903. package/src/internal/v2-hosting.ts +14 -0
  904. package/src/internal/workspace.ts +17 -17
  905. package/src/kv/memory-kv.ts +9 -7
  906. package/src/kv.ts +4 -7
  907. package/src/otel-public.ts +24 -0
  908. package/src/otel.ts +7 -2
  909. package/src/prompt.ts +1 -1
  910. package/src/result.ts +10 -8
  911. package/src/storage-backends/cursor-hosted-v2.ts +2 -2
  912. package/src/storage-backends/cursor-hosted.ts +6 -23
  913. package/src/storage-backends/file-kv.ts +7 -7
  914. package/src/storage.ts +22 -7
  915. package/src/types.ts +82 -17
  916. package/templates/agentic-owners/agent/channels/github.ts +3 -6
  917. package/templates/agentic-owners/agent/lib/github.ts +5 -5
  918. package/templates/agentic-owners/agent/lib/owners/decision.ts +13 -10
  919. package/templates/agentic-owners/agent/lib/owners/handles.ts +2 -2
  920. package/templates/agentic-owners/agent/lib/owners/match.ts +3 -3
  921. package/templates/agentic-owners/agent/lib/owners/matching.ts +1 -1
  922. package/templates/agentic-owners/agent/lib/owners/parse.ts +4 -9
  923. package/templates/agentic-owners/agent/lib/owners/prompt.ts +1 -1
  924. package/templates/agentic-owners/agent/lib/review.ts +37 -30
  925. package/templates/agentic-owners/evals/owners.eval.ts +2 -2
  926. package/templates/agentic-owners/package.json +1 -1
  927. package/templates/agents-md/agent/lib/collect.ts +16 -10
  928. package/templates/agents-md/agent/lib/config.ts +1 -1
  929. package/templates/agents-md/agent/tools/apply_agents.ts +10 -8
  930. package/templates/agents-md/package.json +1 -1
  931. package/templates/code-wiki/agent/channels/github.ts +4 -7
  932. package/templates/code-wiki/agent/lib/repos.ts +1 -1
  933. package/templates/code-wiki/agent/tools/apply_wiki.ts +3 -4
  934. package/templates/code-wiki/package.json +1 -1
  935. package/templates/demo/agent/lib/collect.ts +6 -2
  936. package/templates/demo/agent/lib/repos.ts +1 -1
  937. package/templates/demo/agent/tools/record_demo.ts +1 -1
  938. package/templates/demo/evals/demo.eval.ts +1 -5
  939. package/templates/demo/package.json +1 -1
  940. package/templates/grokbot-agents/package.json +1 -1
  941. package/templates/pr-autofixer/agent/channels/github.ts +16 -13
  942. package/templates/pr-autofixer/agent/lib/merge-watch.ts +2 -4
  943. package/templates/pr-autofixer/agent/lib/repos.ts +2 -2
  944. package/templates/pr-autofixer/agent/lib/webhook-routing.ts +1 -1
  945. package/templates/pr-autofixer/package.json +1 -1
  946. package/templates/security-help/agent/lib/repos.ts +1 -1
  947. package/templates/security-help/package.json +1 -1
  948. package/templates/security-reviewer/agent/lib/repos.ts +1 -1
  949. package/templates/security-reviewer/agent/tools/post_findings.ts +1 -3
  950. package/templates/security-reviewer/package.json +1 -1
  951. package/templates/triage/agent/lib/actuate.ts +26 -41
  952. package/templates/triage/agent/lib/parse-queue-event.ts +2 -1
  953. package/templates/triage/agent/lib/verify-webhook.ts +10 -5
  954. package/templates/triage/agent/tools/record_triage.ts +1 -4
  955. package/templates/triage/package.json +1 -1
  956. package/dist/client.d.ts +0 -14
  957. package/dist/client.d.ts.map +0 -1
  958. package/dist/client.js +0 -12
  959. package/dist/docs/assets/app.Cr-wVbnB.js +0 -1
  960. package/dist/docs/assets/chunks/@localSearchIndexroot.CFVQ4S17.js +0 -1
  961. package/dist/docs/assets/chunks/framework.BCISBCiQ.js +0 -19
  962. package/dist/docs/assets/concepts.md.B4o63Gul.js +0 -1
  963. package/dist/docs/assets/concepts.md.B4o63Gul.lean.js +0 -1
  964. package/dist/docs/assets/guides_agent-to-agent.md.BDb0t1QV.js +0 -10
  965. package/dist/docs/assets/guides_agent-to-agent.md.BDb0t1QV.lean.js +0 -1
  966. package/dist/docs/assets/guides_grokbot-agents.md.DyV-WArv.js +0 -9
  967. package/dist/docs/assets/guides_human-in-the-loop.md.By1G2T3_.js +0 -28
  968. package/dist/docs/assets/guides_human-in-the-loop.md.By1G2T3_.lean.js +0 -1
  969. package/dist/docs/assets/hillclimbing.md.BOiVo1tf.js +0 -4
  970. package/dist/docs/assets/hillclimbing.md.BOiVo1tf.lean.js +0 -1
  971. package/dist/docs/assets/index.md.DD9Q2XuJ.js +0 -5
  972. package/dist/docs/assets/index.md.DD9Q2XuJ.lean.js +0 -1
  973. package/dist/docs/assets/quickstart.md.DdQOF7Y8.lean.js +0 -1
  974. package/dist/docs/assets/reference_result.md.BK5SxDrf.js +0 -19
  975. package/dist/docs/assets/reference_result.md.BK5SxDrf.lean.js +0 -1
  976. package/dist/docs/assets/scaffolding-agents.md.Kctn3OVb.js +0 -1
  977. package/dist/docs/assets/scaffolding-agents.md.Kctn3OVb.lean.js +0 -1
  978. package/dist/docs/assets/skills_create-agent.md.Q3h6Je-e.js +0 -8
  979. package/dist/docs/assets/skills_create-agent.md.Q3h6Je-e.lean.js +0 -1
  980. package/dist/docs/assets/skills_debug.md.CVjCXMFF.js +0 -1
  981. package/dist/docs/assets/skills_debug.md.CVjCXMFF.lean.js +0 -1
  982. package/dist/docs/assets/skills_deploy.md.CWqi_ZxW.js +0 -35
  983. package/dist/docs/assets/skills_deploy.md.CWqi_ZxW.lean.js +0 -1
  984. package/dist/docs/assets/skills_evals.md.DFxYPErF.js +0 -25
  985. package/dist/docs/assets/skills_evals.md.DFxYPErF.lean.js +0 -1
  986. package/dist/docs/assets/skills_framework-map.md.BxLSOhSY.js +0 -1
  987. package/dist/docs/assets/skills_framework-map.md.BxLSOhSY.lean.js +0 -1
  988. package/dist/docs/assets/skills_github.md.hgFX_oKY.js +0 -16
  989. package/dist/docs/assets/skills_github.md.hgFX_oKY.lean.js +0 -1
  990. package/dist/docs/assets/skills_hillclimb.md.B_zJerxA.js +0 -7
  991. package/dist/docs/assets/skills_hillclimb.md.B_zJerxA.lean.js +0 -1
  992. package/dist/docs/assets/skills_index.md.DL7EHaQ-.js +0 -1
  993. package/dist/docs/assets/skills_index.md.DL7EHaQ-.lean.js +0 -1
  994. package/dist/docs/assets/skills_mcp-auth.md.DGvFP3HE.js +0 -18
  995. package/dist/docs/assets/skills_mcp-auth.md.DGvFP3HE.lean.js +0 -1
  996. package/dist/docs/assets/skills_otel.md.B5Ddv1xH.js +0 -8
  997. package/dist/docs/assets/skills_otel.md.B5Ddv1xH.lean.js +0 -1
  998. package/dist/docs/assets/skills_setup-slack.md.BBgx8lUz.js +0 -20
  999. package/dist/docs/assets/skills_setup-slack.md.BBgx8lUz.lean.js +0 -1
  1000. package/dist/docs/assets/storage.md.BUrhJ-Zz.js +0 -30
  1001. package/dist/docs/assets/storage.md.BUrhJ-Zz.lean.js +0 -1
  1002. package/dist/docs/assets/templates_agents-md.md.CXSMZljE.js +0 -2
  1003. package/dist/docs/assets/templates_agents-md.md.CXSMZljE.lean.js +0 -1
  1004. package/dist/docs/assets/templates_code-wiki.md.CDYZIBFN.js +0 -2
  1005. package/dist/docs/assets/templates_code-wiki.md.CDYZIBFN.lean.js +0 -1
  1006. package/dist/docs/assets/templates_demo.md.BeQX9V3H.js +0 -4
  1007. package/dist/docs/assets/templates_demo.md.BeQX9V3H.lean.js +0 -1
  1008. package/dist/docs/assets/templates_grokbot-agents.md.c1s6Flp9.js +0 -3
  1009. package/dist/docs/assets/templates_grokbot-agents.md.c1s6Flp9.lean.js +0 -1
  1010. package/dist/docs/assets/templates_security-help.md.C3Ny_Qr2.js +0 -4
  1011. package/dist/docs/assets/templates_security-help.md.C3Ny_Qr2.lean.js +0 -1
  1012. package/dist/docs/concepts.html +0 -27
  1013. package/dist/docs/concepts.md +0 -166
  1014. package/dist/docs/design/filesystem.md +0 -376
  1015. package/dist/docs/design/runtime-abstraction.md +0 -1756
  1016. package/dist/docs/guides/human-in-the-loop.html +0 -54
  1017. package/dist/docs/guides/human-in-the-loop.md +0 -126
  1018. package/dist/docs/reference/result.html +0 -45
  1019. package/dist/docs/reference/result.md +0 -89
  1020. package/dist/docs/scaffolding-agents.html +0 -27
  1021. package/dist/docs/scaffolding-agents.md +0 -130
  1022. package/dist/docs/skills/create-agent.html +0 -34
  1023. package/dist/docs/skills/create-agent.md +0 -160
  1024. package/dist/docs/skills/debug.html +0 -27
  1025. package/dist/docs/skills/debug.md +0 -36
  1026. package/dist/docs/skills/deploy.html +0 -61
  1027. package/dist/docs/skills/deploy.md +0 -161
  1028. package/dist/docs/skills/evals.html +0 -51
  1029. package/dist/docs/skills/evals.md +0 -137
  1030. package/dist/docs/skills/framework-map.html +0 -27
  1031. package/dist/docs/skills/framework-map.md +0 -99
  1032. package/dist/docs/skills/github.html +0 -42
  1033. package/dist/docs/skills/github.md +0 -93
  1034. package/dist/docs/skills/hillclimb.html +0 -33
  1035. package/dist/docs/skills/hillclimb.md +0 -55
  1036. package/dist/docs/skills/index.html +0 -27
  1037. package/dist/docs/skills/index.md +0 -21
  1038. package/dist/docs/skills/mcp-auth.html +0 -44
  1039. package/dist/docs/skills/mcp-auth.md +0 -76
  1040. package/dist/docs/skills/otel.html +0 -34
  1041. package/dist/docs/skills/otel.md +0 -53
  1042. package/dist/docs/skills/setup-slack.html +0 -46
  1043. package/dist/docs/skills/setup-slack.md +0 -141
  1044. package/dist/docs/storage.html +0 -56
  1045. package/dist/docs/storage.md +0 -167
  1046. package/dist/docs/templates/agents-md.html +0 -28
  1047. package/dist/docs/templates/agents-md.md +0 -105
  1048. package/dist/docs/templates/code-wiki.html +0 -28
  1049. package/dist/docs/templates/code-wiki.md +0 -91
  1050. package/dist/docs/templates/demo.html +0 -30
  1051. package/dist/docs/templates/demo.md +0 -80
  1052. package/dist/docs/templates/grokbot-agents.html +0 -29
  1053. package/dist/docs/templates/grokbot-agents.md +0 -48
  1054. package/dist/docs/templates/security-help.html +0 -30
  1055. package/dist/docs/templates/security-help.md +0 -65
  1056. package/dist/internal/tenant-slack/relay.d.ts +0 -75
  1057. package/dist/internal/tenant-slack/relay.d.ts.map +0 -1
  1058. package/dist/internal/tenant-slack/relay.js +0 -148
  1059. package/dist/playground/assets/index-Bhxzrcf6.css +0 -1
  1060. package/dist/playground/assets/index-CqLX5uF3.js +0 -67
  1061. package/docs/concepts.md +0 -171
  1062. package/docs/design/filesystem.md +0 -376
  1063. package/docs/design/runtime-abstraction.md +0 -1756
  1064. package/docs/guides/human-in-the-loop.md +0 -131
  1065. package/docs/reference/result.md +0 -94
  1066. package/docs/scaffolding-agents.md +0 -135
  1067. package/docs/skills/index.md +0 -26
  1068. package/docs/storage.md +0 -172
  1069. package/docs/templates/agents-md.md +0 -110
  1070. package/docs/templates/code-wiki.md +0 -96
  1071. package/docs/templates/demo.md +0 -85
  1072. package/docs/templates/grokbot-agents.md +0 -53
  1073. package/docs/templates/security-help.md +0 -70
  1074. package/src/client.ts +0 -23
  1075. package/src/internal/tenant-slack/relay.ts +0 -203
  1076. package/templates/pr-autofixer/agent/storage.ts +0 -7
@@ -16,7 +16,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
16
16
  });
17
17
  };
18
18
  import { AsyncLocalStorage } from "node:async_hooks";
19
- import { mkdir, rm, writeFile } from "node:fs/promises";
19
+ import { access, mkdir, rm, writeFile } from "node:fs/promises";
20
20
  import { dirname, join } from "node:path";
21
21
  import { SLACK_CHANNEL_ID } from "../channels/slack/constants.js";
22
22
  import { materializeSlackNudgeCarrier } from "../channels/slack/nudge-carrier.js";
@@ -57,7 +57,7 @@ import { McpOauthOnDemandHub } from "./mcp-oauth-on-demand.js";
57
57
  import { shouldStartProcessMemoryTelemetry, startProcessMemoryTelemetry, } from "./process-memory-telemetry.js";
58
58
  import { buildSessionContextBlock, SCHEDULE_CHANNEL_PREFIX, } from "./prompt-context.js";
59
59
  import { assertCloudCanHonorAccountServersFilters } from "./resolved-connections.js";
60
- import { applyAuthoredResult } from "./result-output.js";
60
+ import { addTurnUsage, applyAuthoredResult, RESULT_REPAIR_BUDGET, resultRepairPrompt, } from "./result-output.js";
61
61
  import { sessionExternalLinks } from "./session-links.js";
62
62
  import { SessionStore } from "./session-store.js";
63
63
  import { syncSkillsToStore } from "./skills-sync.js";
@@ -81,6 +81,18 @@ export class SessionBusyError extends Error {
81
81
  this.name = "SessionBusyError";
82
82
  }
83
83
  }
84
+ /**
85
+ * Hosted enqueue-only admission could not coalesce into an active turn.
86
+ * Distinct from {@link SessionBusyError}: the caller asked not to start work.
87
+ */
88
+ export class HostedEnqueueNotActiveError extends Error {
89
+ constructor(sessionId) {
90
+ super(sessionId === undefined
91
+ ? "Hosted enqueue requires an active accepting session"
92
+ : `Hosted enqueue requires an active turn on session ${sessionId}`);
93
+ this.name = "HostedEnqueueNotActiveError";
94
+ }
95
+ }
84
96
  // Defined in auth.js (HTTP/session-store callers import it without this
85
97
  // module); re-exported here because this is its historical public home.
86
98
  export { SessionAuthError } from "./auth.js";
@@ -158,6 +170,33 @@ export class AuthInterruptedError extends Error {
158
170
  }
159
171
  }
160
172
  const mcpAuthAls = new AsyncLocalStorage();
173
+ /** Marker that we `git init`'d this shared harness so scaffold is ours to write. */
174
+ const OWNED_HARNESS = join(".agent-serve", "owned-harness");
175
+ function pathExists(path) {
176
+ return access(path).then(() => true, () => false);
177
+ }
178
+ /**
179
+ * Nested dirs get their own git root so the harness does not ripwalk the
180
+ * enclosing checkout. A real `workspaceDir` checkout (already a git root)
181
+ * is left alone.
182
+ */
183
+ function ownSharedHarness(dir) {
184
+ return __awaiter(this, void 0, void 0, function* () {
185
+ if (yield pathExists(join(dir, OWNED_HARNESS))) {
186
+ return true;
187
+ }
188
+ if (!(yield isNestedInGitRepo(dir))) {
189
+ return false;
190
+ }
191
+ yield ensureOwnGitRoot(dir);
192
+ if (yield isNestedInGitRepo(dir)) {
193
+ return false;
194
+ }
195
+ yield mkdir(join(dir, ".agent-serve"), { recursive: true });
196
+ yield writeFile(join(dir, OWNED_HARNESS), "");
197
+ return true;
198
+ });
199
+ }
161
200
  export class SessionEngine {
162
201
  constructor(options) {
163
202
  var _a, _b, _c, _d, _e;
@@ -197,6 +236,8 @@ export class SessionEngine {
197
236
  this.turnAborts = new Map();
198
237
  /** Serializes turn admission per session (latest follow-up wins). */
199
238
  this.admissionChains = new Map();
239
+ /** Live turn snapshot so a coalesced Slack wake can repaint on this process. */
240
+ this.liveTurns = new Map();
200
241
  /**
201
242
  * Per-session coalesce queue for `admission: "coalesce"` (Slack). Drained
202
243
  * into one follow-up turn when the active turn finishes without interrupt.
@@ -245,7 +286,7 @@ export class SessionEngine {
245
286
  this.askDedupe = new SlackAskDedupeStore(join(options.stateRoot, "slack-asks"));
246
287
  this.turnLeases = new TurnLeaseStore(join(options.stateRoot, "turn-leases"));
247
288
  this.outbox = new TurnOutbox(join(options.stateRoot, "outbox"));
248
- this.logs = new EventLogStore((sessionId) => this.sessions.eventFilePath(sessionId), (sessionId, error) => this.logger(`[agent-sdk] failed to persist events for ${sessionId}: ${describeError(error)}`));
289
+ this.logs = new EventLogStore(sessionId => this.sessions.eventFilePath(sessionId), (sessionId, error) => this.logger(`[agent-sdk] failed to persist events for ${sessionId}: ${describeError(error)}`));
249
290
  // Framework session state (records, event chunks, continuations) is
250
291
  // mirrored to whatever this selects; see framework-storage-selection.ts
251
292
  // for why the choice does not belong to the agent author.
@@ -289,7 +330,7 @@ export class SessionEngine {
289
330
  this.mcpHost = new McpHost([
290
331
  ...options.project.agent.connections,
291
332
  ...((_d = options.project.agent.hostConnections) !== null && _d !== void 0 ? _d : []),
292
- ].filter((connection) => !isSymbolicConnectionTransport(connection.transport)));
333
+ ].filter(connection => !isSymbolicConnectionTransport(connection.transport)));
293
334
  const basePlatforms = (_e = options.platforms) !== null && _e !== void 0 ? _e : createHostPlatforms();
294
335
  const slackBinding = resolveDedicatedSlackHostBinding(options.project.channels);
295
336
  this.platforms =
@@ -333,7 +374,7 @@ export class SessionEngine {
333
374
  authoredConnection(name) {
334
375
  var _a;
335
376
  var _b;
336
- return ((_b = this.project.agent.connections.find((item) => item.name === name)) !== null && _b !== void 0 ? _b : (_a = this.project.agent.hostConnections) === null || _a === void 0 ? void 0 : _a.find((item) => item.name === name));
377
+ return ((_b = this.project.agent.connections.find(item => item.name === name)) !== null && _b !== void 0 ? _b : (_a = this.project.agent.hostConnections) === null || _a === void 0 ? void 0 : _a.find(item => item.name === name));
337
378
  }
338
379
  setCloudServerToolsConnection(connection) {
339
380
  this.cloudServerToolsConnection = connection;
@@ -398,7 +439,7 @@ export class SessionEngine {
398
439
  }
399
440
  return this.tagArtifact(Object.assign(Object.assign({}, input), { sessionId: binding.sessionId, turnId: (_a = input.turnId) !== null && _a !== void 0 ? _a : binding.turnId }));
400
441
  }),
401
- list: (filter) => this.artifactsStore.list(filter),
442
+ list: filter => this.artifactsStore.list(filter),
402
443
  };
403
444
  }
404
445
  /**
@@ -536,10 +577,10 @@ export class SessionEngine {
536
577
  }
537
578
  slackNudgeHostApi() {
538
579
  return {
539
- append: (input) => this.nudgeStore.append(input),
540
- drainFormatted: (continuationKey) => this.nudgeStore.drainFormatted(continuationKey),
541
- clear: (continuationKey) => this.nudgeStore.clear(continuationKey),
542
- hasUndelivered: (continuationKey) => this.nudgeStore.hasUndelivered(continuationKey),
580
+ append: input => this.nudgeStore.append(input),
581
+ drainFormatted: continuationKey => this.nudgeStore.drainFormatted(continuationKey),
582
+ clear: continuationKey => this.nudgeStore.clear(continuationKey),
583
+ hasUndelivered: continuationKey => this.nudgeStore.hasUndelivered(continuationKey),
543
584
  isDelivered: (continuationKey, sourceTs) => this.nudgeStore.isDelivered(continuationKey, sourceTs),
544
585
  tryClaimAsk: (channelId, messageTs) => this.askDedupe.tryClaim(channelId, messageTs),
545
586
  releaseAsk: (channelId, messageTs) => this.askDedupe.release(channelId, messageTs),
@@ -620,35 +661,49 @@ export class SessionEngine {
620
661
  // Refresh harness cwd when the caller supplies a newer worktree (e.g. PR
621
662
  // synchronize). Leave the durable continuation key unchanged.
622
663
  let record = existing;
623
- const refreshWorkspace = sendOptions.workspaceDir !== undefined &&
624
- sendOptions.workspaceDir !== existing.workspaceOverride;
625
- if (refreshWorkspace ||
626
- sendOptions.workspaceFiles !== undefined ||
627
- sendOptions.images !== undefined) {
628
- record = yield this.updateRecord(existing.sessionId, (current) => (Object.assign(Object.assign({}, current), { workspaceOverride: refreshWorkspace
629
- ? sendOptions.workspaceDir
630
- : current.workspaceOverride, pendingWorkspaceFiles: mergePendingWorkspaceFiles(current.pendingWorkspaceFiles, sendOptions.workspaceFiles), pendingImages: mergePendingImages(current.pendingImages, sendOptions.images) })));
631
- }
632
- // Refresh the cloud attach the same way: a follow-up send carries the
633
- // caller's CURRENT cloud options (e.g. a PR attach re-derived per wake),
634
- // and the first send's snapshot must not pin this session's turns to a
635
- // stale repo/prUrl for the session's lifetime.
636
- if (sendOptions.cloud !== undefined &&
637
- JSON.stringify(sendOptions.cloud) !==
638
- JSON.stringify(record.cloudOverride)) {
639
- record = yield this.updateRecord(record.sessionId, (current) => (Object.assign(Object.assign({}, current), { cloudOverride: sendOptions.cloud })));
640
- }
641
- // Refresh wake-derived channel state (GitHub headSha / refs) without
642
- // wiping sticky fields. Null patch values are skipped.
643
- if (sendOptions.refreshState !== undefined) {
644
- record = yield this.updateRecord(record.sessionId, (current) => (Object.assign(Object.assign({}, current), { channelState: mergeChannelStateSkipNull(current.channelState, sendOptions.refreshState) })));
664
+ const enqueueOnly = sendOptions.hostedEnqueueOnly === true;
665
+ if (!enqueueOnly) {
666
+ const refreshWorkspace = sendOptions.workspaceDir !== undefined &&
667
+ sendOptions.workspaceDir !== existing.workspaceOverride;
668
+ if (refreshWorkspace ||
669
+ sendOptions.workspaceFiles !== undefined ||
670
+ sendOptions.images !== undefined) {
671
+ record = yield this.updateRecord(existing.sessionId, current => (Object.assign(Object.assign({}, current), { workspaceOverride: refreshWorkspace
672
+ ? sendOptions.workspaceDir
673
+ : current.workspaceOverride, pendingWorkspaceFiles: mergePendingWorkspaceFiles(current.pendingWorkspaceFiles, sendOptions.workspaceFiles), pendingImages: mergePendingImages(current.pendingImages, sendOptions.images) })));
674
+ }
675
+ // Refresh the cloud attach the same way: a follow-up send carries the
676
+ // caller's CURRENT cloud options (e.g. a PR attach re-derived per wake),
677
+ // and the first send's snapshot must not pin this session's turns to a
678
+ // stale repo/prUrl for the session's lifetime.
679
+ if (sendOptions.cloud !== undefined &&
680
+ JSON.stringify(sendOptions.cloud) !==
681
+ JSON.stringify(record.cloudOverride)) {
682
+ record = yield this.updateRecord(record.sessionId, current => (Object.assign(Object.assign({}, current), { cloudOverride: sendOptions.cloud })));
683
+ }
684
+ // Refresh wake-derived channel state (GitHub headSha / refs) without
685
+ // wiping sticky fields. Null patch values are skipped.
686
+ if (sendOptions.refreshState !== undefined) {
687
+ record = yield this.updateRecord(record.sessionId, current => (Object.assign(Object.assign({}, current), { channelState: mergeChannelStateSkipNull(current.channelState, sendOptions.refreshState) })));
688
+ }
645
689
  }
646
690
  const since = (yield this.logs.get(record.sessionId)).count;
647
- const coalesced = yield this.startTurn(record.sessionId, message, Object.assign({ admission: (_d = sendOptions.admission) !== null && _d !== void 0 ? _d : "preempt" }, (sendOptions.coalesceSourceTs === undefined
691
+ const coalesced = yield this.startTurn(record.sessionId, message, Object.assign(Object.assign({ admission: enqueueOnly
692
+ ? "coalesce"
693
+ : ((_d = sendOptions.admission) !== null && _d !== void 0 ? _d : "preempt") }, (sendOptions.coalesceSourceTs === undefined
648
694
  ? {}
649
- : { sourceTs: sendOptions.coalesceSourceTs })));
695
+ : { sourceTs: sendOptions.coalesceSourceTs })), (enqueueOnly ? { hostedEnqueueOnly: true } : {})));
696
+ if (enqueueOnly && !coalesced) {
697
+ throw new HostedEnqueueNotActiveError(record.sessionId);
698
+ }
699
+ if (!enqueueOnly && coalesced && sendOptions.refreshState !== undefined) {
700
+ yield this.repaintOnCoalescedRefresh(record.sessionId, sendOptions.refreshState);
701
+ }
650
702
  return this.channelSession(record.sessionId, record, false, coalesced, since);
651
703
  }
704
+ if (sendOptions.hostedEnqueueOnly === true) {
705
+ throw new HostedEnqueueNotActiveError(sendOptions.hostedSessionId);
706
+ }
652
707
  if (sendOptions.hostedSessionId !== undefined) {
653
708
  const collision = yield this.getOrRestoreSession(sendOptions.hostedSessionId);
654
709
  if (collision !== undefined) {
@@ -706,7 +761,7 @@ export class SessionEngine {
706
761
  const stale = new Error("stale HTTP continuation");
707
762
  let previous;
708
763
  try {
709
- yield this.updateRecord(sessionId, (record) => {
764
+ yield this.updateRecord(sessionId, record => {
710
765
  var _a;
711
766
  const expectedChannel = record.httpContinuationKey === undefined
712
767
  ? record.channelId
@@ -730,7 +785,7 @@ export class SessionEngine {
730
785
  return next;
731
786
  }
732
787
  catch (error) {
733
- yield this.updateRecord(sessionId, (record) => record.httpContinuationKey === next
788
+ yield this.updateRecord(sessionId, record => record.httpContinuationKey === next
734
789
  ? Object.assign(Object.assign({}, record), { httpContinuationKey: previous }) : record);
735
790
  throw error;
736
791
  }
@@ -793,6 +848,45 @@ export class SessionEngine {
793
848
  // ==========================================================================
794
849
  // Turn execution
795
850
  // ==========================================================================
851
+ /**
852
+ * Repaint on the follow-up wake without retargeting the live turn.
853
+ * Persist already took the refresh; in-flight writes stay on the carrier ts.
854
+ */
855
+ repaintOnCoalescedRefresh(sessionId, patch) {
856
+ return __awaiter(this, void 0, void 0, function* () {
857
+ var _a;
858
+ var _b;
859
+ const live = this.liveTurns.get(sessionId);
860
+ if (live === undefined || patch === undefined) {
861
+ return;
862
+ }
863
+ const repaintState = (_b = mergeChannelStateSkipNull(live.channelState, patch)) !== null && _b !== void 0 ? _b : live.channelState;
864
+ const record = yield this.sessions.get(sessionId);
865
+ if (record === undefined) {
866
+ return;
867
+ }
868
+ const handler = (_a = this.channelEventHandlersFor(record.channelId)) === null || _a === void 0 ? void 0 : _a["message.received"];
869
+ if (handler === undefined) {
870
+ return;
871
+ }
872
+ yield handler({
873
+ type: "message.received",
874
+ data: { text: "" },
875
+ index: 0,
876
+ sessionId,
877
+ at: new Date().toISOString(),
878
+ }, {
879
+ channelId: record.channelId,
880
+ state: repaintState,
881
+ continuationToken: record.continuationKey,
882
+ setContinuationToken: (token) => this.setContinuationToken(sessionId, token),
883
+ }, {
884
+ session: live.session,
885
+ host: this.hostForSession(sessionId),
886
+ artifacts: this.artifactsApi({ sessionId }),
887
+ });
888
+ });
889
+ }
796
890
  /**
797
891
  * Admit a turn for `sessionId`.
798
892
  *
@@ -811,7 +905,12 @@ export class SessionEngine {
811
905
  .catch(() => { })
812
906
  .then(() => __awaiter(this, void 0, void 0, function* () {
813
907
  // Another server holds the turn: hand the message to it and coalesce.
908
+ // Enqueue-only must not report coalesced success without a local
909
+ // enqueue — the outbox drain may never run on this process.
814
910
  if (yield this.turnLeases.runningElsewhere(sessionId)) {
911
+ if (options.hostedEnqueueOnly === true) {
912
+ throw new HostedEnqueueNotActiveError(sessionId);
913
+ }
815
914
  yield this.outbox.post(sessionId, { message, options });
816
915
  return true;
817
916
  }
@@ -824,7 +923,7 @@ export class SessionEngine {
824
923
  drainOutbox(sessionId) {
825
924
  void this.outbox
826
925
  .takeAll(sessionId)
827
- .then((items) => {
926
+ .then(items => {
828
927
  for (const item of items) {
829
928
  void this.startTurn(sessionId, item.message, item.options).catch(() => { });
830
929
  }
@@ -835,7 +934,7 @@ export class SessionEngine {
835
934
  var _a;
836
935
  const queue = (_a = this.coalesceQueues.get(sessionId)) !== null && _a !== void 0 ? _a : [];
837
936
  if (item.sourceTs !== undefined &&
838
- queue.some((entry) => entry.sourceTs === item.sourceTs)) {
937
+ queue.some(entry => entry.sourceTs === item.sourceTs)) {
839
938
  return;
840
939
  }
841
940
  queue.push(item);
@@ -905,7 +1004,7 @@ export class SessionEngine {
905
1004
  }
906
1005
  const parts = [
907
1006
  "<slack_followups>",
908
- `ANSWER-EACH: ${items.length} asks arrived while you were busy. Address each in order; keep replies compact.`,
1007
+ `${items.length} asks arrived while you were busy.`,
909
1008
  "",
910
1009
  ];
911
1010
  for (let i = 0; i < items.length; i++) {
@@ -988,10 +1087,19 @@ export class SessionEngine {
988
1087
  // enqueue: `drainCoalescedFollowups` reads only this process's queue, so
989
1088
  // the shared nudge store is the carrier. Not redundant with `acquire`
990
1089
  // below — this returns before preempt's `clearCoalesced` drops the queue.
1090
+ // Enqueue-only cannot claim coalesced here: nothing joined a local turn.
991
1091
  if (yield this.turnLeases.runningElsewhere(sessionId)) {
1092
+ if (options.hostedEnqueueOnly === true) {
1093
+ throw new HostedEnqueueNotActiveError(sessionId);
1094
+ }
992
1095
  this.logger(`[session] coalesce; another server owns ${sessionId}`);
993
1096
  return true;
994
1097
  }
1098
+ // Enqueue-only must never start a turn (or preempt/interrupt). Steer and
1099
+ // coalesce above already returned true when they absorbed the message.
1100
+ if (options.hostedEnqueueOnly === true) {
1101
+ throw new HostedEnqueueNotActiveError(sessionId);
1102
+ }
995
1103
  // Interrupt any turn in flight and wait for it to settle so the SDK run is
996
1104
  // terminal before this turn's send (the follow-up also force-expires as a
997
1105
  // belt-and-suspenders — see buildTurnRequest). Drain-resume skips interrupt:
@@ -1020,7 +1128,7 @@ export class SessionEngine {
1020
1128
  this.pendingTurns.add(sessionId);
1021
1129
  let lifecycleInstalled = false;
1022
1130
  try {
1023
- const record = yield this.updateRecord(sessionId, (current) => (Object.assign(Object.assign({}, current), { turnCount: current.turnCount + 1 })));
1131
+ const record = yield this.updateRecord(sessionId, current => (Object.assign(Object.assign({}, current), { turnCount: current.turnCount + 1 })));
1024
1132
  const turnId = `turn_${record.turnCount}`;
1025
1133
  const isFirstTurn = record.turnCount === 1;
1026
1134
  yield this.appendEvent(sessionId, {
@@ -1057,6 +1165,7 @@ export class SessionEngine {
1057
1165
  }
1058
1166
  finally {
1059
1167
  clearInterval(poll);
1168
+ this.liveTurns.delete(sessionId);
1060
1169
  }
1061
1170
  this.lastOutcomes.set(sessionId, outcome);
1062
1171
  const wasCurrent = this.activeTurns.get(sessionId) === lifecycle;
@@ -1066,8 +1175,13 @@ export class SessionEngine {
1066
1175
  if (this.turnAborts.get(sessionId) === abort) {
1067
1176
  this.turnAborts.delete(sessionId);
1068
1177
  }
1069
- if (wasCurrent && !abort.signal.aborted) {
1070
- const drain = this.drainCoalescedFollowups(sessionId).catch((error) => {
1178
+ // Failed/cancelled owners must not start a coalesced successor.
1179
+ // Hosted execute would then 503 and Temporal/FIFO would re-run the
1180
+ // same follow-ups as full deliveries.
1181
+ if (wasCurrent &&
1182
+ !abort.signal.aborted &&
1183
+ outcome.status === "finished") {
1184
+ const drain = this.drainCoalescedFollowups(sessionId).catch(error => {
1071
1185
  this.logger(`[session] coalesce drain failed for ${sessionId}: ${describeError(error)}`);
1072
1186
  });
1073
1187
  this.coalesceDrains.set(sessionId, drain);
@@ -1291,7 +1405,7 @@ export class SessionEngine {
1291
1405
  if (turn === undefined) {
1292
1406
  return tools;
1293
1407
  }
1294
- return tools.map((tool) => {
1408
+ return tools.map(tool => {
1295
1409
  const execute = tool.definition.execute;
1296
1410
  if (typeof execute !== "function") {
1297
1411
  return tool;
@@ -1449,6 +1563,14 @@ export class SessionEngine {
1449
1563
  * Best effort — warming is an optimization, and a turn rebuilds on its own.
1450
1564
  */
1451
1565
  prewarmSharedWorkspace() {
1566
+ return __awaiter(this, void 0, void 0, function* () {
1567
+ if (this.sharedWarm === undefined) {
1568
+ this.sharedWarm = this.warmSharedWorkspace();
1569
+ }
1570
+ yield this.sharedWarm;
1571
+ });
1572
+ }
1573
+ warmSharedWorkspace() {
1452
1574
  return __awaiter(this, void 0, void 0, function* () {
1453
1575
  var _a, _b;
1454
1576
  const agent = this.project.agent;
@@ -1461,6 +1583,15 @@ export class SessionEngine {
1461
1583
  }
1462
1584
  const startedAt = Date.now();
1463
1585
  try {
1586
+ yield mkdir(workspaceDir, { recursive: true });
1587
+ if (yield ownSharedHarness(workspaceDir)) {
1588
+ yield materializeWorkspace({
1589
+ agent,
1590
+ workspaceDir,
1591
+ seed: true,
1592
+ stateRoot: this.stateRoot,
1593
+ });
1594
+ }
1464
1595
  const harness = resolveHostHarnessToolOptions(agent.allowedTools);
1465
1596
  const outcome = yield this.runner.prewarm(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ workspaceDir, runnerStateDir: join(this.stateRoot, "runner"), sandbox: ((_b = agent.local) === null || _b === void 0 ? void 0 : _b.sandbox) === true }, (harness.tools === undefined ? {} : { tools: harness.tools })), (harness.disallowedTools === undefined
1466
1597
  ? {}
@@ -1468,7 +1599,8 @@ export class SessionEngine {
1468
1599
  // No session yet, so auth'd connections are omitted rather than
1469
1600
  // warmed without an identity; the per-send flag still has to match
1470
1601
  // the turns' requests or the warmed executor is one no turn asks for.
1471
- mcpServers: this.buildMcpServers("local") }), (this.hasAttachedAuthedConnections()
1602
+ mcpServers: this.buildMcpServers("local") }), (this.hasAttachedAuthedConnections() ||
1603
+ this.project.agent.connections.some(connection => isCursorAccountTransport(connection.transport))
1472
1604
  ? { perSendMcpServers: true }
1473
1605
  : {})), { subagents: buildRunnerSubagents(agent) }), (agent.model === undefined ? {} : { model: agent.model })));
1474
1606
  // Report what happened rather than that the call returned: a runner
@@ -1492,15 +1624,17 @@ export class SessionEngine {
1492
1624
  }
1493
1625
  executeTurn(record, turnId, message, isFirstTurn, signal) {
1494
1626
  return __awaiter(this, void 0, void 0, function* () {
1495
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1627
+ var _a;
1628
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
1496
1629
  const sessionId = record.sessionId;
1497
1630
  const workspaceDir = this.scaffoldDir(record);
1498
1631
  const harnessCwd = this.harnessCwd(record);
1499
- const turnChannelState = structuredClone((_a = record.channelState) !== null && _a !== void 0 ? _a : null);
1632
+ const turnChannelState = structuredClone((_b = record.channelState) !== null && _b !== void 0 ? _b : null);
1500
1633
  const eventContext = {
1501
1634
  channelState: structuredClone(turnChannelState),
1502
1635
  session: this.sessionInfo(record),
1503
1636
  };
1637
+ this.liveTurns.set(sessionId, eventContext);
1504
1638
  // Hold the open log so tool events append synchronously. Fire-and-forget
1505
1639
  // `appendEvent` races parallel tool completions and delays the live stream
1506
1640
  // until the next await tick — often after *all* parallel tools finish.
@@ -1517,7 +1651,7 @@ export class SessionEngine {
1517
1651
  // Read by closure, so the mapper still sees it while draining after the
1518
1652
  // registry entry below is gone.
1519
1653
  const stubbed = new Set();
1520
- const mapper = new TurnEventMapper(emit, (callId) => stubbed.has(callId));
1654
+ const mapper = new TurnEventMapper(emit, callId => stubbed.has(callId));
1521
1655
  // Take a turn slot before any work happens. When every slot is busy the
1522
1656
  // turn waits FIFO — durable `turn.queued` marks the wait — and a
1523
1657
  // preempting follow-up (or interrupt) resolves the wait as cancelled
@@ -1525,7 +1659,7 @@ export class SessionEngine {
1525
1659
  const permit = yield this.turnGovernor.acquire({
1526
1660
  sessionId,
1527
1661
  signal,
1528
- onQueued: (position) => {
1662
+ onQueued: position => {
1529
1663
  var _a;
1530
1664
  const maxRunningTurns = (_a = this.turnGovernor.maxRunningTurns) !== null && _a !== void 0 ? _a : 0;
1531
1665
  emit({ type: "turn.queued", data: { position, maxRunningTurns } });
@@ -1540,6 +1674,10 @@ export class SessionEngine {
1540
1674
  else {
1541
1675
  emit({ type: "turn.started", data: {} });
1542
1676
  try {
1677
+ if (record.workspaceOverride === undefined &&
1678
+ ((_a = this.project.agent.local) === null || _a === void 0 ? void 0 : _a.workspaceDir) !== undefined) {
1679
+ yield this.prewarmSharedWorkspace();
1680
+ }
1543
1681
  // Scaffold agent files into the session workspace even when the harness
1544
1682
  // cwd is overridden (e.g. a PR worktree).
1545
1683
  if (!this.hasRootOverride()) {
@@ -1573,7 +1711,7 @@ export class SessionEngine {
1573
1711
  if (hasPendingFiles && runtime !== "cloud") {
1574
1712
  const root = yield this.resolveFileSystem({
1575
1713
  sessionId,
1576
- continuationKey: (_b = record.continuationKey) !== null && _b !== void 0 ? _b : undefined,
1714
+ continuationKey: (_c = record.continuationKey) !== null && _c !== void 0 ? _c : undefined,
1577
1715
  cache: true,
1578
1716
  cwd: harnessCwd,
1579
1717
  });
@@ -1581,7 +1719,7 @@ export class SessionEngine {
1581
1719
  }
1582
1720
  if ((hasPendingFiles && runtime !== "cloud") ||
1583
1721
  (pendingImages !== undefined && pendingImages.length > 0)) {
1584
- yield this.updateRecord(sessionId, (current) => (Object.assign(Object.assign({}, current), { pendingWorkspaceFiles: hasPendingFiles &&
1722
+ yield this.updateRecord(sessionId, current => (Object.assign(Object.assign({}, current), { pendingWorkspaceFiles: hasPendingFiles &&
1585
1723
  runtime !== "cloud" &&
1586
1724
  current.pendingWorkspaceFiles === pendingFiles
1587
1725
  ? undefined
@@ -1589,15 +1727,7 @@ export class SessionEngine {
1589
1727
  ? undefined
1590
1728
  : current.pendingImages })));
1591
1729
  }
1592
- // The harness only loads the scaffolded AGENTS.md when the session
1593
- // workspace is its own project root. When the harness cwd is borrowed
1594
- // (PR worktree, shared checkout) the scaffold lands elsewhere, and a
1595
- // workspace nested inside a git repo re-roots harness rules at that
1596
- // repo — in both cases deliver instructions inline on the first turn.
1597
- const instructionsInvisibleToHarness = isFirstTurn &&
1598
- (this.hasBorrowedWorkspace(record) ||
1599
- (yield isNestedInGitRepo(harnessCwd)));
1600
- const request = yield this.buildTurnRequest(record, turnId, message, isFirstTurn, instructionsInvisibleToHarness, emit, eventContext, (update) => __awaiter(this, void 0, void 0, function* () {
1730
+ const onUpdate = (update) => __awaiter(this, void 0, void 0, function* () {
1601
1731
  const turn = this.turnRoots.get(sessionId);
1602
1732
  if (turn !== undefined) {
1603
1733
  update = yield applyWebScratchUpdate({
@@ -1619,11 +1749,26 @@ export class SessionEngine {
1619
1749
  yield this.emitDeliveredNudges(record, emit);
1620
1750
  yield yieldEventLoop();
1621
1751
  }
1622
- }), signal, pendingImages);
1752
+ });
1753
+ const request = yield this.buildTurnRequest(record, turnId, message, isFirstTurn, emit, eventContext, onUpdate, signal, pendingImages);
1623
1754
  this.activeToolContexts.set(sessionId, { record, turnId, emit });
1624
1755
  this.stubbedCallIds.set(sessionId, stubbed);
1625
1756
  try {
1626
1757
  outcome = yield this.runTurnExecute(record, turnId, () => this.runner.runTurn(request));
1758
+ // Commit before dropping the turn FS so `ctx.reject` can
1759
+ // re-run the model with tools still mounted.
1760
+ outcome = yield this.settleAuthoredResult({
1761
+ record,
1762
+ turnId,
1763
+ emit,
1764
+ eventContext,
1765
+ turnChannelState,
1766
+ harnessCwd,
1767
+ signal,
1768
+ onUpdate,
1769
+ mapper,
1770
+ outcome,
1771
+ });
1627
1772
  }
1628
1773
  finally {
1629
1774
  this.activeToolContexts.delete(sessionId);
@@ -1654,47 +1799,22 @@ export class SessionEngine {
1654
1799
  mapper.finish();
1655
1800
  if (mapper.title !== undefined) {
1656
1801
  const title = mapper.title;
1657
- yield this.updateRecord(sessionId, (current) => (Object.assign(Object.assign({}, current), { title })));
1802
+ yield this.updateRecord(sessionId, current => (Object.assign(Object.assign({}, current), { title })));
1658
1803
  eventContext.session = Object.assign(Object.assign({}, eventContext.session), { title });
1659
1804
  }
1660
- const finalResult = (_c = outcome.result) !== null && _c !== void 0 ? _c : mapper.finalText;
1661
- const finalUsage = (_d = outcome.usage) !== null && _d !== void 0 ? _d : mapper.usage;
1805
+ const finalResult = (_d = outcome.result) !== null && _d !== void 0 ? _d : mapper.finalText;
1806
+ const finalUsage = (_e = outcome.usage) !== null && _e !== void 0 ? _e : mapper.usage;
1662
1807
  const finalCost = finalUsage === undefined
1663
1808
  ? undefined
1664
1809
  : yield this.estimateTurnCost({
1665
- model: (_e = this.project.agent.model) !== null && _e !== void 0 ? _e : DEFAULT_MODEL,
1810
+ model: (_f = this.project.agent.model) !== null && _f !== void 0 ? _f : DEFAULT_MODEL,
1666
1811
  usage: finalUsage,
1667
1812
  agentId: record.sdkAgentId,
1668
- conversationId: (_f = record.sdkAgentId) !== null && _f !== void 0 ? _f : sessionId,
1813
+ conversationId: (_g = record.sdkAgentId) !== null && _g !== void 0 ? _g : sessionId,
1669
1814
  });
1670
1815
  if (finalCost !== undefined) {
1671
1816
  outcome = Object.assign(Object.assign({}, outcome), { cost: finalCost });
1672
1817
  }
1673
- const authored = this.project.result;
1674
- if (outcome.status === "finished" && authored !== undefined) {
1675
- const settled = yield applyAuthoredResult({
1676
- definition: authored,
1677
- text: finalResult,
1678
- dryRun: record.dryRun === true,
1679
- ctx: {
1680
- session: eventContext.session,
1681
- channelState: turnChannelState,
1682
- host: this.hostForSession(sessionId),
1683
- artifacts: this.artifactsApi({ sessionId, turnId }),
1684
- stateRoot: this.stateRoot,
1685
- workspaceDir: harnessCwd,
1686
- },
1687
- });
1688
- if (!settled.ok) {
1689
- outcome = {
1690
- status: "error",
1691
- result: finalResult,
1692
- errorMessage: `turn output failed: ${settled.message}`,
1693
- usage: finalUsage,
1694
- cost: finalCost,
1695
- };
1696
- }
1697
- }
1698
1818
  if (outcome.status === "finished") {
1699
1819
  yield this.appendEvent(sessionId, {
1700
1820
  type: "turn.completed",
@@ -1715,21 +1835,21 @@ export class SessionEngine {
1715
1835
  status: outcome.status,
1716
1836
  message: interrupted
1717
1837
  ? "turn interrupted"
1718
- : ((_g = outcome.errorMessage) !== null && _g !== void 0 ? _g : (outcome.status === "cancelled"
1838
+ : ((_h = outcome.errorMessage) !== null && _h !== void 0 ? _h : (outcome.status === "cancelled"
1719
1839
  ? "turn cancelled"
1720
1840
  : "turn failed")),
1721
1841
  },
1722
1842
  }, eventContext);
1723
1843
  }
1724
1844
  const current = yield this.sessions.get(sessionId);
1725
- const mode = (_h = current === null || current === void 0 ? void 0 : current.mode) !== null && _h !== void 0 ? _h : record.mode;
1845
+ const mode = (_j = current === null || current === void 0 ? void 0 : current.mode) !== null && _j !== void 0 ? _j : record.mode;
1726
1846
  if (mode === "task") {
1727
1847
  yield this.appendEvent(sessionId, outcome.status === "finished"
1728
1848
  ? { type: "session.completed", turnId, data: {} }
1729
1849
  : {
1730
1850
  type: "session.failed",
1731
1851
  turnId,
1732
- data: { message: (_j = outcome.errorMessage) !== null && _j !== void 0 ? _j : "task failed" },
1852
+ data: { message: (_k = outcome.errorMessage) !== null && _k !== void 0 ? _k : "task failed" },
1733
1853
  }, eventContext);
1734
1854
  yield this.wipeCloudSessionWorkspace(sessionId);
1735
1855
  }
@@ -1743,6 +1863,65 @@ export class SessionEngine {
1743
1863
  return Object.assign(Object.assign({}, outcome), { result: finalResult, usage: finalUsage });
1744
1864
  });
1745
1865
  }
1866
+ /**
1867
+ * Run `defineResult` while the turn FS and tools are still up.
1868
+ * `ctx.reject` re-invokes `runTurn` on this turnId until commit
1869
+ * succeeds, throws, or the repair budget is gone.
1870
+ */
1871
+ settleAuthoredResult(args) {
1872
+ return __awaiter(this, void 0, void 0, function* () {
1873
+ var _a;
1874
+ const authored = this.project.result;
1875
+ if (args.outcome.status !== "finished" || authored === undefined) {
1876
+ return args.outcome;
1877
+ }
1878
+ let outcome = args.outcome;
1879
+ let usage = outcome.usage;
1880
+ let repairs = 0;
1881
+ while (true) {
1882
+ const settled = yield applyAuthoredResult({
1883
+ definition: authored,
1884
+ text: (_a = outcome.result) !== null && _a !== void 0 ? _a : args.mapper.pendingText,
1885
+ dryRun: args.record.dryRun === true,
1886
+ ctx: {
1887
+ session: args.eventContext.session,
1888
+ channelState: args.turnChannelState,
1889
+ host: this.hostForSession(args.record.sessionId),
1890
+ artifacts: this.artifactsApi({
1891
+ sessionId: args.record.sessionId,
1892
+ turnId: args.turnId,
1893
+ }),
1894
+ stateRoot: this.stateRoot,
1895
+ workspaceDir: args.harnessCwd,
1896
+ },
1897
+ });
1898
+ if (settled.ok) {
1899
+ return Object.assign(Object.assign({}, outcome), { result: settled.text, usage });
1900
+ }
1901
+ if (settled.kind === "error" || repairs >= RESULT_REPAIR_BUDGET) {
1902
+ return {
1903
+ status: "error",
1904
+ result: outcome.result,
1905
+ errorMessage: `turn output failed: ${settled.message}`,
1906
+ usage,
1907
+ };
1908
+ }
1909
+ repairs += 1;
1910
+ // Close the rejected stream without posting it (empty `stop`)
1911
+ // so Slack does not append a repair onto that block, and so an
1912
+ // empty repair cannot recommit `lastAssistantText`.
1913
+ args.mapper.abandonPendingText();
1914
+ this.logger(`[session] ${args.record.sessionId} ${args.turnId} result rejected; repairing (${repairs}/${RESULT_REPAIR_BUDGET})`);
1915
+ const repairRequest = yield this.buildTurnRequest(args.record, args.turnId, resultRepairPrompt(settled.message), false, args.emit, args.eventContext, args.onUpdate, args.signal);
1916
+ const repaired = yield this.runTurnExecute(args.record, args.turnId, () => this.runner.runTurn(repairRequest));
1917
+ usage = addTurnUsage(usage, repaired.usage);
1918
+ if (repaired.status !== "finished") {
1919
+ return Object.assign(Object.assign({}, repaired), { usage });
1920
+ }
1921
+ outcome = Object.assign(Object.assign({}, repaired), { usage });
1922
+ }
1923
+ });
1924
+ }
1746
1925
  /**
1747
1926
  * Sync authored skills onto the Agent Store at `skills/<name>/…` (hosted)
1748
1927
  * or `agent-serve/<agent>/skills/<name>/…` (personal-key local+cloud)
@@ -1821,7 +2000,7 @@ export class SessionEngine {
1821
2000
  }
1822
2001
  clearPendingWorkspaceFiles(sessionId, pending) {
1823
2002
  return __awaiter(this, void 0, void 0, function* () {
1824
- yield this.updateRecord(sessionId, (current) => (Object.assign(Object.assign({}, current), { pendingWorkspaceFiles: current.pendingWorkspaceFiles === pending
2003
+ yield this.updateRecord(sessionId, current => (Object.assign(Object.assign({}, current), { pendingWorkspaceFiles: current.pendingWorkspaceFiles === pending
1825
2004
  ? undefined
1826
2005
  : current.pendingWorkspaceFiles })));
1827
2006
  });
@@ -1843,7 +2022,7 @@ export class SessionEngine {
1843
2022
  if (inFlight !== undefined) {
1844
2023
  return inFlight;
1845
2024
  }
1846
- let sync = run().then(() => true, (error) => {
2025
+ let sync = run().then(() => true, error => {
1847
2026
  this.logger(`[${surface}] ${store.label} sync failed: ${error instanceof Error ? error.message : String(error)}`);
1848
2027
  return false;
1849
2028
  });
@@ -1858,11 +2037,17 @@ export class SessionEngine {
1858
2037
  /**
1859
2038
  * Hosted deployments own the deployment store. Local `serve`/`run` with
1860
2039
  * a personal API key writes into the USER store under `agent-serve/`.
2040
+ * A persistent deployment's version container has no cloud store at all:
2041
+ * its state directory is the durable copy, and its service-account key
2042
+ * must not be mistaken for a personal one.
1861
2043
  */
1862
2044
  cloudStore() {
1863
2045
  const v2Hosting = resolveAgentV2Hosting({
1864
2046
  architecture: this.project.agent.architecture,
1865
2047
  });
2048
+ if (v2Hosting.kind === "cursor-managed-persistent") {
2049
+ return undefined;
2050
+ }
1866
2051
  const deployment = {
1867
2052
  mountPath: DEPLOYMENT_STORE_MOUNT_PATH,
1868
2053
  skillsPrefix: agentStoreKeys.skillsPrefix(),
@@ -1892,7 +2077,7 @@ export class SessionEngine {
1892
2077
  }
1893
2078
  return undefined;
1894
2079
  }
1895
- buildTurnRequest(record, turnId, prompt, isFirstTurn, instructionsInvisibleToHarness, emit, eventContext, onUpdate, signal, images) {
2080
+ buildTurnRequest(record, turnId, prompt, isFirstTurn, emit, eventContext, onUpdate, signal, images) {
1896
2081
  return __awaiter(this, void 0, void 0, function* () {
1897
2082
  var _a, _b, _c;
1898
2083
  var _d;
@@ -1926,7 +2111,7 @@ export class SessionEngine {
1926
2111
  // per-session tools or identity is worse than a refused one. Non-local
1927
2112
  // agents already fail discovery; this guards hybrid agents' per-send
1928
2113
  // cloud sessions.
1929
- const perSessionConnection = agent.connections.find((connection) => connection.advertiseTools === true || connection.auth !== undefined);
2114
+ const perSessionConnection = agent.connections.find(connection => connection.advertiseTools === true || connection.auth !== undefined);
1930
2115
  if (runtime !== "local" && perSessionConnection !== undefined) {
1931
2116
  throw new Error(`Agent "${agent.name}" connection "${perSessionConnection.name}" uses advertiseTools/auth, which only run on local turns. Refusing the session rather than running it without the connection's tools or identity.`);
1932
2117
  }
@@ -1967,7 +2152,7 @@ export class SessionEngine {
1967
2152
  ? []
1968
2153
  : this.withTurnScratchTools(authoredRoot
1969
2154
  ? fileTools
1970
- : fileTools.filter((tool) => tool.name !== "SemanticSearch"), record.sessionId);
2155
+ : fileTools.filter(tool => tool.name !== "SemanticSearch"), record.sessionId);
1971
2156
  let turnPrompt = prompt;
1972
2157
  if (isFirstTurn) {
1973
2158
  const contextBlock = buildSessionContextBlock({
@@ -2029,6 +2214,7 @@ export class SessionEngine {
2029
2214
  }
2030
2215
  }
2031
2216
  else if (pending !== undefined && Object.keys(pending).length > 0) {
2217
+ this.logger(`[workspace] no cloud store on this hosting; dropping workspaceFiles for session ${record.sessionId}: ${Object.keys(pending).join(", ")}`);
2032
2218
  yield this.clearPendingWorkspaceFiles(record.sessionId, pending);
2033
2219
  }
2034
2220
  if (isFirstTurn && hosted) {
@@ -2036,33 +2222,23 @@ export class SessionEngine {
2036
2222
  }
2037
2223
  if (preamble !== "" || sections.length > 0) {
2038
2224
  turnPrompt = [preamble, ...sections, turnPrompt]
2039
- .filter((part) => part !== "")
2225
+ .filter(part => part !== "")
2040
2226
  .join("\n\n");
2041
2227
  }
2042
2228
  }
2043
2229
  else if (isFirstTurn && runtime === "local" && authoredRoot) {
2044
- // Virtual roots skip materialize, so AGENTS.md never lands on disk.
2045
- // Ship the same preamble the borrowed-cwd local path uses.
2046
- const preamble = buildAgentsMdContent(Object.assign(Object.assign({}, agent), { tools: [...agent.tools, ...synthesized] }), { includeScripts: true });
2047
- const workspaceInfo = `<user_info>\nWorkspace Path: /\n</user_info>`;
2048
- turnPrompt =
2049
- preamble === ""
2050
- ? `${workspaceInfo}\n\n${turnPrompt}`
2051
- : `${workspaceInfo}\n\n${preamble}\n\n${turnPrompt}`;
2052
- }
2053
- else if (isFirstTurn &&
2054
- runtime === "local" &&
2055
- instructionsInvisibleToHarness) {
2056
- // Local workspace whose AGENTS.md the harness will not load. With a
2057
- // borrowed harness cwd, agent tool scripts live only in the durable
2058
- // scaffold dir — embed bodies like cloud. Otherwise the catalog can
2059
- // reference on-disk paths under the harness cwd. Grokbot turns are
2060
- // excluded: their instructions ride the request's `instructions`
2061
- // field into the Sand system prompt instead.
2062
- const includeScripts = this.hasBorrowedWorkspace(record);
2063
- const preamble = buildAgentsMdContent(agent, { includeScripts });
2064
- turnPrompt = `${preamble}\n\n${turnPrompt}`;
2230
+ // The harness reports no path for a root it never mounted.
2231
+ turnPrompt = `<user_info>\nWorkspace Path: /\n</user_info>\n\n${turnPrompt}`;
2065
2232
  }
2233
+ // A virtual root has no scaffold dir either, so its catalog carries the
2234
+ // synthesized file tools and embedded script bodies.
2235
+ const localInstructions = runtime === "local"
2236
+ ? authoredRoot
2237
+ ? buildAgentsMdContent(Object.assign(Object.assign({}, agent), { tools: [...agent.tools, ...synthesized] }), { includeScripts: true })
2238
+ : buildAgentsMdContent(agent, {
2239
+ includeScripts: this.hasBorrowedWorkspace(record),
2240
+ })
2241
+ : undefined;
2066
2242
  return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ sessionId: record.sessionId }, (record.sdkAgentId === undefined
2067
2243
  ? {}
2068
2244
  : { sdkAgentId: record.sdkAgentId })), { workspaceDir: this.harnessCwd(record), sandbox: authoredRoot ? false : ((_c = agent.local) === null || _c === void 0 ? void 0 : _c.sandbox) === true }), (runtime === "local" && harnessTools !== undefined
@@ -2071,30 +2247,35 @@ export class SessionEngine {
2071
2247
  : { tools: harnessTools.tools })), (harnessTools.disallowedTools === undefined
2072
2248
  ? {}
2073
2249
  : { disallowedTools: harnessTools.disallowedTools })) : {})), { runnerStateDir: join(this.stateRoot, "runner"), prompt: turnPrompt, isFirstTurn }), (images !== undefined && images.length > 0 ? { images } : {})), (agent.model === undefined ? {} : { model: agent.model })), { runtime, agentName: agent.name }), (mergedCloud === undefined ? {} : { cloud: mergedCloud })), {
2074
- // The hosted Grok Bot harness reads no workspace AGENTS.md: grokbot
2075
- // turns carry the composed instructions into the hosted session,
2076
- // which surfaces them in the Sand system prompt. The box never sees
2077
- // the local session workspace, so agent-tool script bodies are
2078
- // always embedded same rule as the cloud first-prompt preamble.
2250
+ // Local turns send the composed instructions as the harness system
2251
+ // prompt; grokbot turns carry them into the hosted session, which
2252
+ // surfaces them in the Sand system prompt. Cloud turns inline them into
2253
+ // the first prompt above instead. Script bodies are embedded whenever
2254
+ // the harness cannot reach the scaffold dir: always for grokbot (the
2255
+ // box never sees the session workspace) and for a borrowed local cwd
2256
+ // (PR worktree, shared checkout); otherwise the catalog references the
2257
+ // on-disk paths under the harness cwd.
2079
2258
  instructions: runtime === "grokbot"
2080
2259
  ? buildAgentsMdContent(agent, { includeScripts: true })
2081
- : undefined }), (runtime === "cloud" && !isCursorHostedFilesAvailable()
2260
+ : localInstructions }), (runtime === "cloud" && !isCursorHostedFilesAvailable()
2082
2261
  ? { agentServeAgent: this.project.name }
2083
2262
  : {})), { customTools: runtime === "local"
2084
2263
  ? yield this.buildCustomTools(record, turnId, emit, synthesized)
2085
- : {}, mcpServers: this.buildMcpServers(runtime, record.sessionId, yield this.evaluateConnectionAuth(record)) }), (runtime === "local" && this.hasAttachedAuthedConnections()
2264
+ : {}, mcpServers: this.buildMcpServers(runtime, record.sessionId, yield this.evaluateConnectionAuth(record)) }), (runtime === "local" &&
2265
+ (this.hasAttachedAuthedConnections() ||
2266
+ this.project.agent.connections.some(connection => isCursorAccountTransport(connection.transport)))
2086
2267
  ? { perSendMcpServers: true }
2087
2268
  : {})), { subagents: buildRunnerSubagents(agent), onUpdate,
2088
2269
  signal,
2089
2270
  // Local follow-ups expire any lingering active run so a preempted turn
2090
2271
  // (or one orphaned by a crashed process) never blocks this send.
2091
- forceExpireActiveRun: runtime === "local" && !isFirstTurn, onRequestId: (requestId) => {
2272
+ forceExpireActiveRun: runtime === "local" && !isFirstTurn, onRequestId: requestId => {
2092
2273
  emit({ type: "turn.bound", data: { requestId } });
2093
2274
  }, onSdkAgentId: (sdkAgentId) => __awaiter(this, void 0, void 0, function* () {
2094
2275
  if (record.sdkAgentId === sdkAgentId) {
2095
2276
  return;
2096
2277
  }
2097
- yield this.updateRecord(record.sessionId, (current) => (Object.assign(Object.assign({}, current), { sdkAgentId })));
2278
+ yield this.updateRecord(record.sessionId, current => (Object.assign(Object.assign({}, current), { sdkAgentId })));
2098
2279
  record.sdkAgentId = sdkAgentId;
2099
2280
  eventContext.session = Object.assign(Object.assign({}, eventContext.session), { sdkAgentId });
2100
2281
  yield this.appendEvent(record.sessionId, {
@@ -2173,9 +2354,9 @@ export class SessionEngine {
2173
2354
  // Advertised connections surface as named server tools instead of an
2174
2355
  // attached MCP server (each tool appears exactly once).
2175
2356
  const advertisedNames = new Set(this.project.agent.connections
2176
- .filter((connection) => connection.advertiseTools === true)
2177
- .map((connection) => connection.name));
2178
- const hostConnectionNames = new Set(((_a = this.project.agent.hostConnections) !== null && _a !== void 0 ? _a : []).map((connection) => connection.name));
2357
+ .filter(connection => connection.advertiseTools === true)
2358
+ .map(connection => connection.name));
2359
+ const hostConnectionNames = new Set(((_a = this.project.agent.hostConnections) !== null && _a !== void 0 ? _a : []).map(connection => connection.name));
2179
2360
  const bridgedNames = new Set(runtime === "cloud" &&
2180
2361
  sessionId !== undefined &&
2181
2362
  this.cloudServerToolsConnection !== undefined &&
@@ -2184,7 +2365,7 @@ export class SessionEngine {
2184
2365
  : []);
2185
2366
  assertCloudCanHonorAccountServersFilters({
2186
2367
  runtime,
2187
- resolvedConnections: this.resolvedConnections.filter((resolved) => !advertisedNames.has(resolved.name) &&
2368
+ resolvedConnections: this.resolvedConnections.filter(resolved => !advertisedNames.has(resolved.name) &&
2188
2369
  !hostConnectionNames.has(resolved.name)),
2189
2370
  bridgedNames,
2190
2371
  });
@@ -2245,6 +2426,18 @@ export class SessionEngine {
2245
2426
  }
2246
2427
  continue;
2247
2428
  }
2429
+ const authored = this.authoredConnection(resolved.name);
2430
+ if (sessionId !== undefined &&
2431
+ authored !== undefined &&
2432
+ isCursorAccountTransport(authored.transport)) {
2433
+ const bound = new URL(url);
2434
+ bound.searchParams.set("agentkitSessionId", sessionId);
2435
+ servers[resolved.name] = {
2436
+ url: bound.toString(),
2437
+ headers: resolved.headers,
2438
+ };
2439
+ continue;
2440
+ }
2248
2441
  servers[resolved.name] = {
2249
2442
  url,
2250
2443
  headers: resolved.headers,
@@ -2253,7 +2446,7 @@ export class SessionEngine {
2253
2446
  if (runtime === "cloud" &&
2254
2447
  sessionId !== undefined &&
2255
2448
  this.cloudServerToolsConnection !== undefined &&
2256
- this.project.agent.tools.some((tool) => tool.execution === "server")) {
2449
+ this.project.agent.tools.some(tool => tool.execution === "server")) {
2257
2450
  if (servers[SERVER_TOOLS_MCP_SERVER_NAME] !== undefined) {
2258
2451
  throw new Error(`MCP connection name "${SERVER_TOOLS_MCP_SERVER_NAME}" is reserved for authored server tools on cloud turns.`);
2259
2452
  }
@@ -2273,7 +2466,7 @@ export class SessionEngine {
2273
2466
  * ride every send instead of being pinned on the cached agent handle.
2274
2467
  */
2275
2468
  hasAttachedAuthedConnections() {
2276
- return this.project.agent.connections.some((connection) => connection.auth !== undefined && connection.advertiseTools !== true);
2469
+ return this.project.agent.connections.some(connection => connection.auth !== undefined && connection.advertiseTools !== true);
2277
2470
  }
2278
2471
  /**
2279
2472
  * Evaluate per-session connection auth (`defineConnection({ auth })`)
@@ -2284,7 +2477,7 @@ export class SessionEngine {
2284
2477
  */
2285
2478
  evaluateConnectionAuth(record) {
2286
2479
  return __awaiter(this, void 0, void 0, function* () {
2287
- const authed = this.project.agent.connections.filter((connection) => connection.auth !== undefined && connection.advertiseTools !== true);
2480
+ const authed = this.project.agent.connections.filter(connection => connection.auth !== undefined && connection.advertiseTools !== true);
2288
2481
  if (authed.length === 0) {
2289
2482
  return undefined;
2290
2483
  }
@@ -2372,7 +2565,7 @@ export class SessionEngine {
2372
2565
  if (active === undefined) {
2373
2566
  return toolErrorResult(`Session ${sessionId} has no active turn for tool "${toolName}".`);
2374
2567
  }
2375
- const tool = this.project.agent.tools.find((candidate) => candidate.name === toolName && candidate.execution === "server");
2568
+ const tool = this.project.agent.tools.find(candidate => candidate.name === toolName && candidate.execution === "server");
2376
2569
  if (tool === undefined) {
2377
2570
  return toolErrorResult(`Unknown server tool "${toolName}".`);
2378
2571
  }
@@ -2526,8 +2719,8 @@ export class SessionEngine {
2526
2719
  requestedAt,
2527
2720
  };
2528
2721
  const resolutionPromise = this.approvals.wait(args.sessionId, pendingRecord);
2529
- yield this.updateRecord(args.sessionId, (current) => { var _a; return (Object.assign(Object.assign({}, current), { pendingApprovals: [
2530
- ...((_a = current.pendingApprovals) !== null && _a !== void 0 ? _a : []).filter((item) => item.callId !== args.callId),
2722
+ yield this.updateRecord(args.sessionId, current => { var _a; return (Object.assign(Object.assign({}, current), { pendingApprovals: [
2723
+ ...((_a = current.pendingApprovals) !== null && _a !== void 0 ? _a : []).filter(item => item.callId !== args.callId),
2531
2724
  pendingRecord,
2532
2725
  ] })); });
2533
2726
  args.emit({
@@ -2540,7 +2733,7 @@ export class SessionEngine {
2540
2733
  });
2541
2734
  this.logger(`[session] tool ${args.toolName} awaiting approval (${args.callId})`);
2542
2735
  const { decision, by } = yield resolutionPromise;
2543
- yield this.updateRecord(args.sessionId, (current) => { var _a; return (Object.assign(Object.assign({}, current), { pendingApprovals: ((_a = current.pendingApprovals) !== null && _a !== void 0 ? _a : []).filter((item) => item.callId !== args.callId) })); });
2736
+ yield this.updateRecord(args.sessionId, current => { var _a; return (Object.assign(Object.assign({}, current), { pendingApprovals: ((_a = current.pendingApprovals) !== null && _a !== void 0 ? _a : []).filter(item => item.callId !== args.callId) })); });
2544
2737
  args.emit({
2545
2738
  type: "action.approval_resolved",
2546
2739
  data: Object.assign({ callId: args.callId, toolName: args.toolName, decision }, (by === undefined ? {} : { by })),
@@ -2557,7 +2750,7 @@ export class SessionEngine {
2557
2750
  current.pendingApprovals.length === 0) {
2558
2751
  return;
2559
2752
  }
2560
- yield this.updateRecord(sessionId, (record) => (Object.assign(Object.assign({}, record), { pendingApprovals: [] })));
2753
+ yield this.updateRecord(sessionId, record => (Object.assign(Object.assign({}, record), { pendingApprovals: [] })));
2561
2754
  });
2562
2755
  }
2563
2756
  /** Pending tool approvals for a session (live waiters ∪ persisted). */
@@ -2594,7 +2787,7 @@ export class SessionEngine {
2594
2787
  if (!samePrincipal(record.auth, ownershipAuth)) {
2595
2788
  throw new SessionAuthError(sessionId);
2596
2789
  }
2597
- const pending = (_b = ((_a = record.pendingApprovals) !== null && _a !== void 0 ? _a : []).find((item) => item.callId === callId)) !== null && _b !== void 0 ? _b : this.approvals.list(sessionId).find((item) => item.callId === callId);
2790
+ const pending = (_b = ((_a = record.pendingApprovals) !== null && _a !== void 0 ? _a : []).find(item => item.callId === callId)) !== null && _b !== void 0 ? _b : this.approvals.list(sessionId).find(item => item.callId === callId);
2598
2791
  if (pending === undefined) {
2599
2792
  throw new ApprovalNotFoundError(sessionId, callId);
2600
2793
  }
@@ -2608,21 +2801,21 @@ export class SessionEngine {
2608
2801
  }
2609
2802
  removePendingApproval(sessionId, callId) {
2610
2803
  return __awaiter(this, void 0, void 0, function* () {
2611
- yield this.updateRecord(sessionId, (current) => { var _a; return (Object.assign(Object.assign({}, current), { pendingApprovals: ((_a = current.pendingApprovals) !== null && _a !== void 0 ? _a : []).filter((item) => item.callId !== callId) })); });
2804
+ yield this.updateRecord(sessionId, current => { var _a; return (Object.assign(Object.assign({}, current), { pendingApprovals: ((_a = current.pendingApprovals) !== null && _a !== void 0 ? _a : []).filter(item => item.callId !== callId) })); });
2612
2805
  });
2613
2806
  }
2614
2807
  wrapMcp(inner) {
2615
2808
  return {
2616
2809
  names: () => inner.names(),
2617
- listTools: (name) => this.withMcpAuth(name, () => inner.listTools(name)),
2810
+ listTools: name => this.withMcpAuth(name, () => inner.listTools(name)),
2618
2811
  callTool: (name, tool, args) => this.withMcpAuth(name, () => inner.callTool(name, tool, args)),
2619
2812
  };
2620
2813
  }
2621
2814
  advertiseMcp() {
2622
2815
  return {
2623
- listTools: (name) => this.withMcpListAuth(name, () => this.mcpHost.listTools(name)),
2816
+ listTools: name => this.withMcpListAuth(name, () => this.mcpHost.listTools(name)),
2624
2817
  callTool: (name, tool, args) => this.withMcpAuth(name, () => this.mcpHost.callTool(name, tool, args)),
2625
- oneOff: (connection) => {
2818
+ oneOff: connection => {
2626
2819
  const inner = this.mcpHost.oneOff(connection);
2627
2820
  return {
2628
2821
  listTools: () => this.withMcpListAuth(connection.name, () => inner.listTools()),
@@ -2743,8 +2936,8 @@ export class SessionEngine {
2743
2936
  requestedAt,
2744
2937
  };
2745
2938
  const resolutionPromise = this.auths.wait(args.sessionId, pendingRecord);
2746
- yield this.updateRecord(args.sessionId, (current) => { var _a; return (Object.assign(Object.assign({}, current), { pendingAuths: [
2747
- ...((_a = current.pendingAuths) !== null && _a !== void 0 ? _a : []).filter((item) => item.callId !== args.callId),
2939
+ yield this.updateRecord(args.sessionId, current => { var _a; return (Object.assign(Object.assign({}, current), { pendingAuths: [
2940
+ ...((_a = current.pendingAuths) !== null && _a !== void 0 ? _a : []).filter(item => item.callId !== args.callId),
2748
2941
  pendingRecord,
2749
2942
  ] })); });
2750
2943
  args.emit({
@@ -2758,7 +2951,7 @@ export class SessionEngine {
2758
2951
  });
2759
2952
  this.logger(`[session] tool ${args.toolName} awaiting MCP auth ${args.connection} (${args.callId})`);
2760
2953
  const { decision, by } = yield resolutionPromise;
2761
- yield this.updateRecord(args.sessionId, (current) => { var _a; return (Object.assign(Object.assign({}, current), { pendingAuths: ((_a = current.pendingAuths) !== null && _a !== void 0 ? _a : []).filter((item) => item.callId !== args.callId) })); });
2954
+ yield this.updateRecord(args.sessionId, current => { var _a; return (Object.assign(Object.assign({}, current), { pendingAuths: ((_a = current.pendingAuths) !== null && _a !== void 0 ? _a : []).filter(item => item.callId !== args.callId) })); });
2762
2955
  args.emit({
2763
2956
  type: "action.auth_resolved",
2764
2957
  data: {
@@ -2782,7 +2975,7 @@ export class SessionEngine {
2782
2975
  current.pendingAuths.length === 0) {
2783
2976
  return;
2784
2977
  }
2785
- yield this.updateRecord(sessionId, (record) => (Object.assign(Object.assign({}, record), { pendingAuths: [] })));
2978
+ yield this.updateRecord(sessionId, record => (Object.assign(Object.assign({}, record), { pendingAuths: [] })));
2786
2979
  });
2787
2980
  }
2788
2981
  listPendingAuths(sessionId) {
@@ -2810,7 +3003,7 @@ export class SessionEngine {
2810
3003
  if (!samePrincipal(record.auth, ownershipAuth)) {
2811
3004
  throw new SessionAuthError(sessionId);
2812
3005
  }
2813
- const pending = (_b = ((_a = record.pendingAuths) !== null && _a !== void 0 ? _a : []).find((item) => item.callId === callId)) !== null && _b !== void 0 ? _b : this.auths.list(sessionId).find((item) => item.callId === callId);
3006
+ const pending = (_b = ((_a = record.pendingAuths) !== null && _a !== void 0 ? _a : []).find(item => item.callId === callId)) !== null && _b !== void 0 ? _b : this.auths.list(sessionId).find(item => item.callId === callId);
2814
3007
  if (pending === undefined) {
2815
3008
  throw new AuthNotFoundError(sessionId, callId);
2816
3009
  }
@@ -2827,7 +3020,7 @@ export class SessionEngine {
2827
3020
  }
2828
3021
  removePendingAuth(sessionId, callId) {
2829
3022
  return __awaiter(this, void 0, void 0, function* () {
2830
- yield this.updateRecord(sessionId, (current) => { var _a; return (Object.assign(Object.assign({}, current), { pendingAuths: ((_a = current.pendingAuths) !== null && _a !== void 0 ? _a : []).filter((item) => item.callId !== callId) })); });
3023
+ yield this.updateRecord(sessionId, current => { var _a; return (Object.assign(Object.assign({}, current), { pendingAuths: ((_a = current.pendingAuths) !== null && _a !== void 0 ? _a : []).filter(item => item.callId !== callId) })); });
2831
3024
  });
2832
3025
  }
2833
3026
  runWithMcpPark(sessionId, toolName, fn) {
@@ -2977,16 +3170,16 @@ export class SessionEngine {
2977
3170
  */
2978
3171
  describeCatalogTool(toolName_1) {
2979
3172
  return __awaiter(this, arguments, void 0, function* (toolName, options = {}) {
2980
- const authored = this.project.agent.tools.find((tool) => tool.name === toolName);
3173
+ const authored = this.project.agent.tools.find(tool => tool.name === toolName);
2981
3174
  if (authored !== undefined) {
2982
3175
  return { tool: authored };
2983
3176
  }
2984
3177
  const catalog = yield this.listCatalogTools(options);
2985
- const tool = catalog.tools.find((entry) => entry.name === toolName);
3178
+ const tool = catalog.tools.find(entry => entry.name === toolName);
2986
3179
  if (tool === undefined) {
2987
3180
  return {
2988
3181
  tool: undefined,
2989
- availableTools: catalog.tools.map((entry) => entry.name),
3182
+ availableTools: catalog.tools.map(entry => entry.name),
2990
3183
  connectionErrors: catalog.connectionErrors,
2991
3184
  };
2992
3185
  }
@@ -3024,9 +3217,9 @@ export class SessionEngine {
3024
3217
  if (native !== undefined) {
3025
3218
  return native;
3026
3219
  }
3027
- let tool = this.project.agent.tools.find((t) => t.name === toolName);
3220
+ let tool = this.project.agent.tools.find(t => t.name === toolName);
3028
3221
  if (tool === undefined &&
3029
- this.project.agent.connections.some((c) => c.advertiseTools === true)) {
3222
+ this.project.agent.connections.some(c => c.advertiseTools === true)) {
3030
3223
  // Advertised passthroughs are ordinary server tools in the session's
3031
3224
  // namespace; resolve the live listing so direct calls address them by
3032
3225
  // the same model-facing name a turn would. A listing failure fails
@@ -3036,12 +3229,12 @@ export class SessionEngine {
3036
3229
  session,
3037
3230
  hostMcp: this.advertiseMcp(),
3038
3231
  });
3039
- tool = advertised.find((t) => t.name === toolName);
3232
+ tool = advertised.find(t => t.name === toolName);
3040
3233
  }
3041
3234
  if (tool === undefined) {
3042
3235
  throw new UnknownToolError(toolName, this.project.agent.tools
3043
- .filter((t) => t.execution === "server")
3044
- .map((t) => t.name));
3236
+ .filter(t => t.execution === "server")
3237
+ .map(t => t.name));
3045
3238
  }
3046
3239
  const execute = tool.definition.execute;
3047
3240
  if (tool.execution !== "server" || typeof execute !== "function") {
@@ -3320,7 +3513,7 @@ export class SessionEngine {
3320
3513
  return __awaiter(this, void 0, void 0, function* () {
3321
3514
  try {
3322
3515
  const listed = yield this.host.mcp.listTools(connectionName);
3323
- return listed.find((tool) => tool.name === toolName);
3516
+ return listed.find(tool => tool.name === toolName);
3324
3517
  }
3325
3518
  catch (_a) {
3326
3519
  return undefined;
@@ -3347,7 +3540,7 @@ export class SessionEngine {
3347
3540
  const chain = (_b = this.dispatchChains.get(sessionId)) !== null && _b !== void 0 ? _b : Promise.resolve();
3348
3541
  const next = chain
3349
3542
  .then(() => this.dispatchEvent(sessionId, event, context))
3350
- .catch((error) => {
3543
+ .catch(error => {
3351
3544
  this.logger(`[agent-sdk] event dispatch failed for ${sessionId}: ${describeError(error)}`);
3352
3545
  })
3353
3546
  .then(() => {
@@ -3406,12 +3599,12 @@ export class SessionEngine {
3406
3599
  }
3407
3600
  if (context === undefined || channelStateBefore === undefined) {
3408
3601
  // Handlers mutate live channel state in place; save the current record.
3409
- yield this.updateRecord(sessionId, (current) => (Object.assign({}, current)));
3602
+ yield this.updateRecord(sessionId, current => (Object.assign({}, current)));
3410
3603
  }
3411
3604
  else {
3412
3605
  const updatedState = channelCtx.state;
3413
3606
  context.channelState = updatedState;
3414
- yield this.updateRecord(sessionId, (current) => (Object.assign(Object.assign({}, current), { channelState: mergeChannelStateMutation({
3607
+ yield this.updateRecord(sessionId, current => (Object.assign(Object.assign({}, current), { channelState: mergeChannelStateMutation({
3415
3608
  current: current.channelState,
3416
3609
  before: channelStateBefore,
3417
3610
  after: updatedState,
@@ -3484,8 +3677,10 @@ export class SessionEngine {
3484
3677
  var _a;
3485
3678
  // Drain admission first so pendingTurns → activeTurns is visible before we
3486
3679
  // decide the session is idle (reminders use this for queueBehindTurn).
3487
- // The active lifecycle promise also awaits coalesce drain + the drained
3488
- // follow-up's admission, so Slack coalesced waiters see the resume turn.
3680
+ // Wait for coalesce drain and any successor turn so hosted execute does
3681
+ // not park mid-follow-up, but report the root turn's outcome: a drained
3682
+ // successor failure must not un-ACK an already-finished owner.
3683
+ let root;
3489
3684
  for (;;) {
3490
3685
  const chain = this.admissionChains.get(sessionId);
3491
3686
  if (chain !== undefined) {
@@ -3493,14 +3688,15 @@ export class SessionEngine {
3493
3688
  }
3494
3689
  const active = this.activeTurns.get(sessionId);
3495
3690
  if (active !== undefined) {
3496
- yield active;
3691
+ const outcome = yield active;
3692
+ root !== null && root !== void 0 ? root : (root = outcome);
3497
3693
  continue;
3498
3694
  }
3499
3695
  const dispatch = this.dispatchChains.get(sessionId);
3500
3696
  if (dispatch !== undefined) {
3501
3697
  yield dispatch.catch(() => { });
3502
3698
  }
3503
- return (_a = this.lastOutcomes.get(sessionId)) !== null && _a !== void 0 ? _a : { status: "finished" };
3699
+ return (_a = root !== null && root !== void 0 ? root : this.lastOutcomes.get(sessionId)) !== null && _a !== void 0 ? _a : { status: "finished" };
3504
3700
  }
3505
3701
  });
3506
3702
  }
@@ -3534,7 +3730,7 @@ export class SessionEngine {
3534
3730
  return records;
3535
3731
  }
3536
3732
  const owned = yield this.ownedSessionIds(caller);
3537
- return records.filter((record) => record.sessionId !== undefined && owned.has(record.sessionId));
3733
+ return records.filter(record => record.sessionId !== undefined && owned.has(record.sessionId));
3538
3734
  });
3539
3735
  }
3540
3736
  /**
@@ -3565,8 +3761,8 @@ export class SessionEngine {
3565
3761
  return __awaiter(this, void 0, void 0, function* () {
3566
3762
  const sessions = yield this.sessions.list();
3567
3763
  return new Set(sessions
3568
- .filter((record) => samePrincipal(record.auth, caller))
3569
- .map((record) => record.sessionId));
3764
+ .filter(record => samePrincipal(record.auth, caller))
3765
+ .map(record => record.sessionId));
3570
3766
  });
3571
3767
  }
3572
3768
  /**
@@ -3686,8 +3882,8 @@ export class SessionEngine {
3686
3882
  }
3687
3883
  summarizeSessionRecords(records, caller, includeAll) {
3688
3884
  return records
3689
- .filter((record) => includeAll || samePrincipal(record.auth, caller))
3690
- .map((record) => {
3885
+ .filter(record => includeAll || samePrincipal(record.auth, caller))
3886
+ .map(record => {
3691
3887
  var _a;
3692
3888
  const links = sessionExternalLinks(record);
3693
3889
  return {
@@ -3737,7 +3933,7 @@ export class SessionEngine {
3737
3933
  if (existing === undefined) {
3738
3934
  throw new Error(`Unknown session: ${sessionId}`);
3739
3935
  }
3740
- const record = yield this.updateRecord(sessionId, (current) => (Object.assign(Object.assign({}, current), { turnCount: current.turnCount + 1 })));
3936
+ const record = yield this.updateRecord(sessionId, current => (Object.assign(Object.assign({}, current), { turnCount: current.turnCount + 1 })));
3741
3937
  const turnId = `turn_${record.turnCount}`;
3742
3938
  yield this.appendEvent(sessionId, {
3743
3939
  type: "turn.started",
@@ -3852,7 +4048,7 @@ export class SessionEngine {
3852
4048
  return pending;
3853
4049
  }
3854
4050
  const work = this.runCloudTurnCostBackfill(sessionId)
3855
- .catch((error) => {
4051
+ .catch(error => {
3856
4052
  this.logger(`[agent-sdk] cloud cost backfill failed for ${sessionId}: ${describeError(error)}`);
3857
4053
  })
3858
4054
  .finally(() => {
@@ -3867,9 +4063,9 @@ export class SessionEngine {
3867
4063
  var _b, _c;
3868
4064
  const log = yield this.logs.get(sessionId);
3869
4065
  const events = yield log.snapshot(0);
3870
- if (!events.some((event) => isUnpricedCompletedTurn(event))) {
4066
+ if (!events.some(event => isUnpricedCompletedTurn(event))) {
3871
4067
  if (!this.isTurnRunning(sessionId) &&
3872
- events.some((event) => event.type === "turn.completed")) {
4068
+ events.some(event => event.type === "turn.completed")) {
3873
4069
  this.cloudCostBackfillDone.add(sessionId);
3874
4070
  }
3875
4071
  return;
@@ -3896,7 +4092,7 @@ export class SessionEngine {
3896
4092
  }
3897
4093
  log.replace(i, next);
3898
4094
  }
3899
- if (!(yield log.snapshot(0)).some((event) => isUnpricedCompletedTurn(event))) {
4095
+ if (!(yield log.snapshot(0)).some(event => isUnpricedCompletedTurn(event))) {
3900
4096
  this.cloudCostBackfillDone.add(sessionId);
3901
4097
  }
3902
4098
  });
@@ -3905,7 +4101,7 @@ export class SessionEngine {
3905
4101
  return __awaiter(this, void 0, void 0, function* () {
3906
4102
  var _a;
3907
4103
  const previous = yield this.sessions.get(sessionId);
3908
- yield this.updateRecord(sessionId, (current) => (Object.assign(Object.assign({}, current), { continuationKey: token })));
4104
+ yield this.updateRecord(sessionId, current => (Object.assign(Object.assign({}, current), { continuationKey: token })));
3909
4105
  // Keep armed reminders addressed at the conversation across channel
3910
4106
  // continuation rotation.
3911
4107
  if ((previous === null || previous === void 0 ? void 0 : previous.continuationKey) != null &&
@@ -4020,7 +4216,7 @@ export class SessionEngine {
4020
4216
  // the lazy continuation-lookup path.
4021
4217
  const cutoff = Date.now() - policy.maxAgeMs;
4022
4218
  const candidates = loaded
4023
- .map((record) => ({
4219
+ .map(record => ({
4024
4220
  record,
4025
4221
  // Numeric timestamp for both the age filter and the sort; a
4026
4222
  // non-string updatedAt (e.g. a raw DB Date from an untyped sink)
@@ -4256,7 +4452,7 @@ function eventsNdjson(events) {
4256
4452
  if (events.length === 0) {
4257
4453
  return undefined;
4258
4454
  }
4259
- return `${events.map((event) => JSON.stringify(event)).join("\n")}\n`;
4455
+ return `${events.map(event => JSON.stringify(event)).join("\n")}\n`;
4260
4456
  }
4261
4457
  function subagentPrompt(subagent) {
4262
4458
  var _a;
@@ -4271,7 +4467,7 @@ function subagentPrompt(subagent) {
4271
4467
  * executor that turn will run on.
4272
4468
  */
4273
4469
  function buildRunnerSubagents(agent) {
4274
- return agent.subagents.map((subagent) => { var _a; return (Object.assign({ name: subagent.name, description: (_a = subagent.description) !== null && _a !== void 0 ? _a : subagent.name, prompt: subagentPrompt(subagent) }, (subagent.model === undefined ? {} : { model: subagent.model }))); });
4470
+ return agent.subagents.map(subagent => { var _a; return (Object.assign({ name: subagent.name, description: (_a = subagent.description) !== null && _a !== void 0 ? _a : subagent.name, prompt: subagentPrompt(subagent) }, (subagent.model === undefined ? {} : { model: subagent.model }))); });
4275
4471
  }
4276
4472
  function toolErrorResult(message) {
4277
4473
  return {
@@ -4287,7 +4483,7 @@ function defaultGetCloudUsage(sdkAgentId) {
4287
4483
  return {
4288
4484
  usage: mapSdkTokenUsage(billed.usage),
4289
4485
  cost: billed.cost,
4290
- runs: billed.runs.map((run) => ({
4486
+ runs: billed.runs.map(run => ({
4291
4487
  runId: run.runId,
4292
4488
  usage: mapSdkTokenUsage(run.usage),
4293
4489
  cost: run.cost,
@@ -4333,7 +4529,7 @@ function approvalResolverLabel(auth) {
4333
4529
  }
4334
4530
  /** Let the HTTP NDJSON writer flush before the next SDK update. */
4335
4531
  function yieldEventLoop() {
4336
- return new Promise((resolve) => {
4532
+ return new Promise(resolve => {
4337
4533
  setImmediate(resolve);
4338
4534
  });
4339
4535
  }