@cursor/july 0.1.102 → 0.1.104

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 (789) hide show
  1. package/AGENTS.md +34 -32
  2. package/README.md +10 -12
  3. package/dist/ab.d.ts +1 -1
  4. package/dist/ab.js +1 -1
  5. package/dist/bin/agent-serve.d.ts +12 -12
  6. package/dist/bin/agent-serve.js +114 -36
  7. package/dist/channels/bitbucket/api.d.ts +176 -0
  8. package/dist/channels/bitbucket/api.d.ts.map +1 -0
  9. package/dist/channels/bitbucket/api.js +419 -0
  10. package/dist/channels/bitbucket/binding.d.ts +71 -0
  11. package/dist/channels/bitbucket/binding.d.ts.map +1 -0
  12. package/dist/channels/bitbucket/binding.js +269 -0
  13. package/dist/channels/bitbucket/bitbucket-channel.d.ts +33 -0
  14. package/dist/channels/bitbucket/bitbucket-channel.d.ts.map +1 -0
  15. package/dist/channels/bitbucket/bitbucket-channel.js +120 -0
  16. package/dist/channels/bitbucket/bitbucket-webhook.d.ts +61 -0
  17. package/dist/channels/bitbucket/bitbucket-webhook.d.ts.map +1 -0
  18. package/dist/channels/bitbucket/bitbucket-webhook.js +394 -0
  19. package/dist/channels/bitbucket/checks.d.ts +67 -0
  20. package/dist/channels/bitbucket/checks.d.ts.map +1 -0
  21. package/dist/channels/bitbucket/checks.js +102 -0
  22. package/dist/channels/bitbucket/cursor-account.d.ts +37 -0
  23. package/dist/channels/bitbucket/cursor-account.d.ts.map +1 -0
  24. package/dist/channels/bitbucket/cursor-account.js +65 -0
  25. package/dist/channels/bitbucket/defaults.d.ts +26 -0
  26. package/dist/channels/bitbucket/defaults.d.ts.map +1 -0
  27. package/dist/channels/bitbucket/defaults.js +73 -0
  28. package/dist/channels/bitbucket/events.d.ts +22 -0
  29. package/dist/channels/bitbucket/events.d.ts.map +1 -0
  30. package/dist/channels/bitbucket/events.js +64 -0
  31. package/dist/channels/bitbucket/index.d.ts +34 -0
  32. package/dist/channels/bitbucket/index.d.ts.map +1 -0
  33. package/dist/channels/bitbucket/index.js +33 -0
  34. package/dist/channels/bitbucket/replay.d.ts +63 -0
  35. package/dist/channels/bitbucket/replay.d.ts.map +1 -0
  36. package/dist/channels/bitbucket/replay.js +304 -0
  37. package/dist/channels/bitbucket/state.d.ts +35 -0
  38. package/dist/channels/bitbucket/state.d.ts.map +1 -0
  39. package/dist/channels/bitbucket/state.js +21 -0
  40. package/dist/channels/bitbucket/types.d.ts +229 -0
  41. package/dist/channels/bitbucket/types.d.ts.map +1 -0
  42. package/dist/channels/bitbucket/types.js +1 -0
  43. package/dist/channels/change-monitors/change-monitors-channel.d.ts +5 -0
  44. package/dist/channels/change-monitors/change-monitors-channel.d.ts.map +1 -0
  45. package/dist/channels/change-monitors/change-monitors-channel.js +41 -0
  46. package/dist/channels/change-monitors/index.d.ts +4 -0
  47. package/dist/channels/change-monitors/index.d.ts.map +1 -0
  48. package/dist/channels/change-monitors/index.js +2 -0
  49. package/dist/channels/change-monitors/types.d.ts +39 -0
  50. package/dist/channels/change-monitors/types.d.ts.map +1 -0
  51. package/dist/channels/change-monitors/types.js +1 -0
  52. package/dist/channels/deployments/deployments-channel.d.ts +22 -14
  53. package/dist/channels/deployments/deployments-channel.d.ts.map +1 -1
  54. package/dist/channels/deployments/deployments-channel.js +25 -27
  55. package/dist/channels/deployments/types.d.ts +12 -6
  56. package/dist/channels/deployments/types.d.ts.map +1 -1
  57. package/dist/channels/github/binding.d.ts +6 -0
  58. package/dist/channels/github/binding.d.ts.map +1 -1
  59. package/dist/channels/github/binding.js +3 -3
  60. package/dist/channels/github/cursor-account.d.ts +7 -3
  61. package/dist/channels/github/cursor-account.d.ts.map +1 -1
  62. package/dist/channels/github/cursor-account.js +10 -6
  63. package/dist/channels/github/defaults.d.ts.map +1 -1
  64. package/dist/channels/github/defaults.js +4 -0
  65. package/dist/channels/github/events.d.ts +1 -1
  66. package/dist/channels/github/events.js +1 -1
  67. package/dist/channels/github/forward.d.ts +1 -1
  68. package/dist/channels/github/forward.d.ts.map +1 -1
  69. package/dist/channels/github/forward.js +3 -2
  70. package/dist/channels/github/github-channel.d.ts +29 -39
  71. package/dist/channels/github/github-channel.d.ts.map +1 -1
  72. package/dist/channels/github/github-channel.js +68 -101
  73. package/dist/channels/github/progress.d.ts +22 -0
  74. package/dist/channels/github/progress.d.ts.map +1 -1
  75. package/dist/channels/github/progress.js +32 -5
  76. package/dist/channels/github/replay.d.ts +1 -1
  77. package/dist/channels/github/replay.js +1 -1
  78. package/dist/channels/github/state.d.ts +2 -0
  79. package/dist/channels/github/state.d.ts.map +1 -1
  80. package/dist/channels/github/state.js +14 -11
  81. package/dist/channels/github/types.d.ts +2 -4
  82. package/dist/channels/github/types.d.ts.map +1 -1
  83. package/dist/channels/gitlab/api.d.ts +91 -0
  84. package/dist/channels/gitlab/api.d.ts.map +1 -0
  85. package/dist/channels/gitlab/api.js +150 -0
  86. package/dist/channels/gitlab/binding.d.ts +58 -0
  87. package/dist/channels/gitlab/binding.d.ts.map +1 -0
  88. package/dist/channels/gitlab/binding.js +139 -0
  89. package/dist/channels/gitlab/checks.d.ts +110 -0
  90. package/dist/channels/gitlab/checks.d.ts.map +1 -0
  91. package/dist/channels/gitlab/checks.js +126 -0
  92. package/dist/channels/gitlab/cursor-account.d.ts +36 -0
  93. package/dist/channels/gitlab/cursor-account.d.ts.map +1 -0
  94. package/dist/channels/gitlab/cursor-account.js +65 -0
  95. package/dist/channels/gitlab/defaults.d.ts +25 -0
  96. package/dist/channels/gitlab/defaults.d.ts.map +1 -0
  97. package/dist/channels/gitlab/defaults.js +60 -0
  98. package/dist/channels/gitlab/events.d.ts +12 -0
  99. package/dist/channels/gitlab/events.d.ts.map +1 -0
  100. package/dist/channels/gitlab/events.js +28 -0
  101. package/dist/channels/gitlab/gitlab-channel.d.ts +33 -0
  102. package/dist/channels/gitlab/gitlab-channel.d.ts.map +1 -0
  103. package/dist/channels/gitlab/gitlab-channel.js +120 -0
  104. package/dist/channels/gitlab/gitlab-webhook.d.ts +45 -0
  105. package/dist/channels/gitlab/gitlab-webhook.d.ts.map +1 -0
  106. package/dist/channels/gitlab/gitlab-webhook.js +397 -0
  107. package/dist/channels/gitlab/index.d.ts +31 -0
  108. package/dist/channels/gitlab/index.d.ts.map +1 -0
  109. package/dist/channels/gitlab/index.js +30 -0
  110. package/dist/channels/gitlab/replay.d.ts +105 -0
  111. package/dist/channels/gitlab/replay.d.ts.map +1 -0
  112. package/dist/channels/gitlab/replay.js +206 -0
  113. package/dist/channels/gitlab/state.d.ts +33 -0
  114. package/dist/channels/gitlab/state.d.ts.map +1 -0
  115. package/dist/channels/gitlab/state.js +23 -0
  116. package/dist/channels/gitlab/types.d.ts +214 -0
  117. package/dist/channels/gitlab/types.d.ts.map +1 -0
  118. package/dist/channels/gitlab/types.js +1 -0
  119. package/dist/channels/issues/index.d.ts +4 -0
  120. package/dist/channels/issues/index.d.ts.map +1 -0
  121. package/dist/channels/issues/index.js +2 -0
  122. package/dist/channels/issues/issues-channel.d.ts +5 -0
  123. package/dist/channels/issues/issues-channel.d.ts.map +1 -0
  124. package/dist/channels/issues/issues-channel.js +37 -0
  125. package/dist/channels/issues/types.d.ts +33 -0
  126. package/dist/channels/issues/types.d.ts.map +1 -0
  127. package/dist/channels/issues/types.js +1 -0
  128. package/dist/channels/origin/api.d.ts.map +1 -1
  129. package/dist/channels/origin/api.js +4 -2
  130. package/dist/channels/origin/origin-channel.d.ts +4 -9
  131. package/dist/channels/origin/origin-channel.d.ts.map +1 -1
  132. package/dist/channels/origin/origin-channel.js +8 -48
  133. package/dist/channels/origin/types.d.ts +20 -2
  134. package/dist/channels/origin/types.d.ts.map +1 -1
  135. package/dist/channels/slack/eval-directive.d.ts.map +1 -1
  136. package/dist/channels/slack/eval-directive.js +1 -7
  137. package/dist/channels/slack/init.d.ts.map +1 -1
  138. package/dist/channels/slack/init.js +3 -3
  139. package/dist/channels/slack/setup.d.ts +1 -1
  140. package/dist/channels/slack/setup.d.ts.map +1 -1
  141. package/dist/channels/slack/setup.js +6 -13
  142. package/dist/channels/slack/types.d.ts +1 -1
  143. package/dist/channels/slack/types.d.ts.map +1 -1
  144. package/dist/channels.d.ts +1 -1
  145. package/dist/channels.d.ts.map +1 -1
  146. package/dist/client.d.ts +1 -1
  147. package/dist/client.js +1 -1
  148. package/dist/connections.d.ts +1 -1
  149. package/dist/connections.js +1 -1
  150. package/dist/docs/404.html +2 -2
  151. package/dist/docs/ab.html +4 -4
  152. package/dist/docs/assets/{app.CLA03RCz.js → app.DbMWUyGb.js} +1 -1
  153. package/dist/docs/assets/chunks/@localSearchIndexroot.Bqsulb9K.js +1 -0
  154. package/dist/docs/assets/chunks/{VPLocalSearchBox.ifxv-cJV.js → VPLocalSearchBox.DcNeTh9o.js} +1 -1
  155. package/dist/docs/assets/chunks/{theme.DWCwM6p-.js → theme.DMjhY3gl.js} +2 -2
  156. package/dist/docs/assets/concepts.md.DgEcZOfT.js +1 -0
  157. package/dist/docs/assets/{concepts.md.rPzW2HZN.lean.js → concepts.md.DgEcZOfT.lean.js} +1 -1
  158. package/dist/docs/assets/{evals.md.CPzDAwoH.js → evals.md.CbMoebP1.js} +1 -1
  159. package/dist/docs/assets/guides_cloud-agents.md.DS8RIjwx.js +9 -0
  160. package/dist/docs/assets/{guides_github.md.BtPr9GaP.js → guides_github.md.c0gdGJ-D.js} +1 -1
  161. package/dist/docs/assets/{guides_github.md.BtPr9GaP.lean.js → guides_github.md.c0gdGJ-D.lean.js} +1 -1
  162. package/dist/docs/assets/{guides_opentelemetry.md.BVTXDCRg.js → guides_opentelemetry.md.COh9jFVg.js} +7 -8
  163. package/dist/docs/assets/{guides_opentelemetry.md.BVTXDCRg.lean.js → guides_opentelemetry.md.COh9jFVg.lean.js} +1 -1
  164. package/dist/docs/assets/{index.md.Kiht7ell.js → index.md.D75GWhPl.js} +1 -1
  165. package/dist/docs/assets/{reference_agent-config.md.BHeYMgme.js → reference_agent-config.md.CHNpiyp4.js} +3 -3
  166. package/dist/docs/assets/{reference_channels.md.Cd2f2iyV.js → reference_channels.md.DBGcaB7m.js} +2 -2
  167. package/dist/docs/assets/{reference_channels.md.Cd2f2iyV.lean.js → reference_channels.md.DBGcaB7m.lean.js} +1 -1
  168. package/dist/docs/assets/{reference_cli.md.DfoeyvL0.js → reference_cli.md.CJNc_xYK.js} +1 -1
  169. package/dist/docs/assets/{reference_extensions.md.9WQMZe1l.js → reference_extensions.md.DykHW3qL.js} +11 -5
  170. package/dist/docs/assets/reference_extensions.md.DykHW3qL.lean.js +1 -0
  171. package/dist/docs/assets/reference_hooks.md.Ddt5DdgJ.js +73 -0
  172. package/dist/docs/assets/{reference_hooks.md.a8BJxMR5.lean.js → reference_hooks.md.Ddt5DdgJ.lean.js} +1 -1
  173. package/dist/docs/assets/{reference_playground.md.DnX5nL-B.js → reference_playground.md.4myJPxrf.js} +1 -1
  174. package/dist/docs/assets/{reference_project-layout.md.CA6QP6Lw.js → reference_project-layout.md.DuBu9a96.js} +2 -2
  175. package/dist/docs/assets/reference_result.md.BK5SxDrf.js +19 -0
  176. package/dist/docs/assets/reference_result.md.BK5SxDrf.lean.js +1 -0
  177. package/dist/docs/assets/{reference_sessions.md.NxFP_CAC.js → reference_sessions.md.CueyOHSL.js} +1 -1
  178. package/dist/docs/assets/{reference_sessions.md.NxFP_CAC.lean.js → reference_sessions.md.CueyOHSL.lean.js} +1 -1
  179. package/dist/docs/assets/{reference_tools.md.B1up2r9W.js → reference_tools.md.aGrn99hP.js} +1 -1
  180. package/dist/docs/assets/skills_framework-map.md.haibFyoB.js +1 -0
  181. package/dist/docs/assets/{skills_otel.md.CgiZryR3.js → skills_otel.md.CqhobH3B.js} +3 -3
  182. package/dist/docs/assets/{skills_otel.md.CgiZryR3.lean.js → skills_otel.md.CqhobH3B.lean.js} +1 -1
  183. package/dist/docs/assets/{templates_pr-autofixer.md.x5zl6-GT.js → templates_pr-autofixer.md.Bds_XWcV.js} +2 -2
  184. package/dist/docs/assets/{templates_pr-autofixer.md.x5zl6-GT.lean.js → templates_pr-autofixer.md.Bds_XWcV.lean.js} +1 -1
  185. package/dist/docs/building-with-agents.html +4 -4
  186. package/dist/docs/concepts.html +5 -5
  187. package/dist/docs/concepts.md +2 -4
  188. package/dist/docs/deployment.html +4 -4
  189. package/dist/docs/design/filesystem.md +376 -0
  190. package/dist/docs/design/runtime-abstraction.md +2 -3
  191. package/dist/docs/evals.html +6 -6
  192. package/dist/docs/evals.md +9 -7
  193. package/dist/docs/guides/agent-to-agent.html +4 -4
  194. package/dist/docs/guides/cloud-agents.html +6 -6
  195. package/dist/docs/guides/cloud-agents.md +4 -6
  196. package/dist/docs/guides/convert-automation.html +4 -4
  197. package/dist/docs/guides/github.html +6 -6
  198. package/dist/docs/guides/github.md +5 -1
  199. package/dist/docs/guides/human-in-the-loop.html +4 -4
  200. package/dist/docs/guides/mcp-oauth.html +5 -5
  201. package/dist/docs/guides/opentelemetry.html +10 -11
  202. package/dist/docs/guides/opentelemetry.md +41 -17
  203. package/dist/docs/guides/slack.html +4 -4
  204. package/dist/docs/guides/webhooks.html +4 -4
  205. package/dist/docs/hashmap.json +1 -1
  206. package/dist/docs/hillclimbing.html +4 -4
  207. package/dist/docs/index.html +6 -6
  208. package/dist/docs/index.md +2 -2
  209. package/dist/docs/llms-full.txt +907 -262
  210. package/dist/docs/llms.txt +3 -2
  211. package/dist/docs/quickstart.html +4 -4
  212. package/dist/docs/reference/agent-config.html +8 -8
  213. package/dist/docs/reference/agent-config.md +6 -10
  214. package/dist/docs/reference/artifacts.html +5 -5
  215. package/dist/docs/reference/channels.html +6 -6
  216. package/dist/docs/reference/channels.md +38 -8
  217. package/dist/docs/reference/cli.html +5 -5
  218. package/dist/docs/reference/cli.md +3 -4
  219. package/dist/docs/reference/connections.html +4 -4
  220. package/dist/docs/reference/extensions.html +16 -10
  221. package/dist/docs/reference/extensions.md +86 -22
  222. package/dist/docs/reference/hooks.html +69 -10
  223. package/dist/docs/reference/hooks.md +215 -46
  224. package/dist/docs/reference/http-api.html +4 -4
  225. package/dist/docs/reference/instructions.html +4 -4
  226. package/dist/docs/reference/playground.html +5 -5
  227. package/dist/docs/reference/playground.md +3 -0
  228. package/dist/docs/reference/project-layout.html +6 -6
  229. package/dist/docs/reference/project-layout.md +2 -1
  230. package/dist/docs/reference/prompt.html +4 -4
  231. package/dist/docs/reference/result.html +45 -0
  232. package/dist/docs/reference/result.md +89 -0
  233. package/dist/docs/reference/schedules.html +4 -4
  234. package/dist/docs/reference/sessions.html +5 -5
  235. package/dist/docs/reference/sessions.md +3 -1
  236. package/dist/docs/reference/skills.html +4 -4
  237. package/dist/docs/reference/subagents.html +4 -4
  238. package/dist/docs/reference/tools.html +5 -5
  239. package/dist/docs/reference/tools.md +1 -2
  240. package/dist/docs/scaffolding-agents.html +4 -4
  241. package/dist/docs/skills/ab.html +4 -4
  242. package/dist/docs/skills/create-agent.html +4 -4
  243. package/dist/docs/skills/debug.html +4 -4
  244. package/dist/docs/skills/evals.html +4 -4
  245. package/dist/docs/skills/framework-map.html +5 -5
  246. package/dist/docs/skills/framework-map.md +3 -1
  247. package/dist/docs/skills/github.html +4 -4
  248. package/dist/docs/skills/hillclimb.html +4 -4
  249. package/dist/docs/skills/index.html +4 -4
  250. package/dist/docs/skills/mcp-auth.html +4 -4
  251. package/dist/docs/skills/otel.html +7 -7
  252. package/dist/docs/skills/otel.md +8 -3
  253. package/dist/docs/skills/setup-slack.html +4 -4
  254. package/dist/docs/storage.html +4 -4
  255. package/dist/docs/templates/agentic-owners.html +4 -4
  256. package/dist/docs/templates/agents-md.html +4 -4
  257. package/dist/docs/templates/code-wiki.html +4 -4
  258. package/dist/docs/templates/demo.html +4 -4
  259. package/dist/docs/templates/pr-autofixer.html +6 -6
  260. package/dist/docs/templates/pr-autofixer.md +0 -3
  261. package/dist/docs/templates/security-help.html +4 -4
  262. package/dist/docs/templates/security-reviewer.html +4 -4
  263. package/dist/docs/templates/triage.html +4 -4
  264. package/dist/docs/troubleshooting.html +4 -4
  265. package/dist/evals.d.ts +1 -1
  266. package/dist/evals.d.ts.map +1 -1
  267. package/dist/extensions.d.ts +20 -7
  268. package/dist/extensions.d.ts.map +1 -1
  269. package/dist/extensions.js +36 -5
  270. package/dist/files.d.ts +16 -3
  271. package/dist/files.d.ts.map +1 -1
  272. package/dist/files.js +16 -3
  273. package/dist/filesystem.d.ts +440 -0
  274. package/dist/filesystem.d.ts.map +1 -0
  275. package/dist/filesystem.js +1694 -0
  276. package/dist/index.d.ts +6 -4
  277. package/dist/index.d.ts.map +1 -1
  278. package/dist/index.js +4 -3
  279. package/dist/internal/ab-snapshot.d.ts.map +1 -1
  280. package/dist/internal/ab-snapshot.js +0 -1
  281. package/dist/internal/advertise-tools.d.ts.map +1 -1
  282. package/dist/internal/advertise-tools.js +1 -3
  283. package/dist/internal/authored-alias-hooks.d.ts +4 -13
  284. package/dist/internal/authored-alias-hooks.d.ts.map +1 -1
  285. package/dist/internal/authored-alias-hooks.js +4 -20
  286. package/dist/internal/authored-loaders.d.ts +2 -3
  287. package/dist/internal/authored-loaders.d.ts.map +1 -1
  288. package/dist/internal/authored-loaders.js +6 -20
  289. package/dist/internal/channel-dispatch.d.ts +43 -0
  290. package/dist/internal/channel-dispatch.d.ts.map +1 -0
  291. package/dist/internal/channel-dispatch.js +77 -0
  292. package/dist/internal/chat-client.d.ts +1 -1
  293. package/dist/internal/chat-client.js +1 -1
  294. package/dist/internal/cli-ax.d.ts +5 -5
  295. package/dist/internal/cli-ax.d.ts.map +1 -1
  296. package/dist/internal/cli-ax.js +5 -5
  297. package/dist/internal/cli-bitbucket.d.ts +33 -0
  298. package/dist/internal/cli-bitbucket.d.ts.map +1 -0
  299. package/dist/internal/cli-bitbucket.js +359 -0
  300. package/dist/internal/cli-convert-automation.d.ts +1 -1
  301. package/dist/internal/cli-convert-automation.js +2 -2
  302. package/dist/internal/cli-cursor.d.ts +1 -1
  303. package/dist/internal/cli-cursor.d.ts.map +1 -1
  304. package/dist/internal/cli-cursor.js +2 -4
  305. package/dist/internal/cli-deploy.d.ts.map +1 -1
  306. package/dist/internal/cli-deploy.js +2 -6
  307. package/dist/internal/cli-github.d.ts +1 -1
  308. package/dist/internal/cli-github.js +3 -3
  309. package/dist/internal/cli-gitlab.d.ts +37 -0
  310. package/dist/internal/cli-gitlab.d.ts.map +1 -0
  311. package/dist/internal/cli-gitlab.js +380 -0
  312. package/dist/internal/cli-mcp.d.ts.map +1 -1
  313. package/dist/internal/cli-mcp.js +2 -6
  314. package/dist/internal/cli-slack.d.ts +1 -1
  315. package/dist/internal/cli-slack.d.ts.map +1 -1
  316. package/dist/internal/cli-slack.js +2 -4
  317. package/dist/internal/continuation-channel.d.ts +18 -2
  318. package/dist/internal/continuation-channel.d.ts.map +1 -1
  319. package/dist/internal/continuation-channel.js +67 -5
  320. package/dist/internal/continuation-identity.d.ts +24 -17
  321. package/dist/internal/continuation-identity.d.ts.map +1 -1
  322. package/dist/internal/continuation-identity.js +246 -32
  323. package/dist/internal/conversation-mirror.d.ts.map +1 -1
  324. package/dist/internal/conversation-mirror.js +4 -3
  325. package/dist/internal/convert-automation/types.d.ts +1 -1
  326. package/dist/internal/convert-automation/types.js +1 -1
  327. package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
  328. package/dist/internal/cursor/account-mcp.js +1 -3
  329. package/dist/internal/cursor/backend-client.d.ts +5 -4
  330. package/dist/internal/cursor/backend-client.d.ts.map +1 -1
  331. package/dist/internal/cursor/backend-client.js +5 -6
  332. package/dist/internal/cursor/bound-secret-file.d.ts +56 -0
  333. package/dist/internal/cursor/bound-secret-file.d.ts.map +1 -0
  334. package/dist/internal/cursor/bound-secret-file.js +88 -0
  335. package/dist/internal/cursor/credentials.d.ts +39 -5
  336. package/dist/internal/cursor/credentials.d.ts.map +1 -1
  337. package/dist/internal/cursor/credentials.js +58 -8
  338. package/dist/internal/cursor/hosted-bound-secrets.d.ts +41 -0
  339. package/dist/internal/cursor/hosted-bound-secrets.d.ts.map +1 -0
  340. package/dist/internal/cursor/hosted-bound-secrets.js +54 -0
  341. package/dist/internal/cursor/hosted-deployment-secrets.d.ts +19 -5
  342. package/dist/internal/cursor/hosted-deployment-secrets.d.ts.map +1 -1
  343. package/dist/internal/cursor/hosted-deployment-secrets.js +29 -9
  344. package/dist/internal/cursor/hosted-store-secrets.d.ts +1 -1
  345. package/dist/internal/cursor/hosted-store-secrets.js +1 -1
  346. package/dist/internal/cursor-account-mcp-auth.d.ts.map +1 -1
  347. package/dist/internal/cursor-account-mcp-auth.js +2 -4
  348. package/dist/internal/cursor-deployment-relay.d.ts +6 -2
  349. package/dist/internal/cursor-deployment-relay.d.ts.map +1 -1
  350. package/dist/internal/cursor-deployment-relay.js +13 -9
  351. package/dist/internal/deploy-manifest.d.ts +1 -1
  352. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  353. package/dist/internal/deploy-manifest.js +1 -1
  354. package/dist/internal/discovery/ab.d.ts +1 -1
  355. package/dist/internal/discovery/ab.d.ts.map +1 -1
  356. package/dist/internal/discovery/ab.js +21 -9
  357. package/dist/internal/discovery/agent.d.ts +6 -1
  358. package/dist/internal/discovery/agent.d.ts.map +1 -1
  359. package/dist/internal/discovery/agent.js +141 -120
  360. package/dist/internal/discovery/channels.d.ts +1 -1
  361. package/dist/internal/discovery/channels.d.ts.map +1 -1
  362. package/dist/internal/discovery/channels.js +14 -14
  363. package/dist/internal/discovery/connections.d.ts +1 -5
  364. package/dist/internal/discovery/connections.d.ts.map +1 -1
  365. package/dist/internal/discovery/connections.js +30 -44
  366. package/dist/internal/discovery/cursor-plugin.d.ts.map +1 -1
  367. package/dist/internal/discovery/cursor-plugin.js +1 -3
  368. package/dist/internal/discovery/extension-overlay.d.ts +32 -0
  369. package/dist/internal/discovery/extension-overlay.d.ts.map +1 -0
  370. package/dist/internal/discovery/extension-overlay.js +191 -0
  371. package/dist/internal/discovery/extensions.d.ts +11 -2
  372. package/dist/internal/discovery/extensions.d.ts.map +1 -1
  373. package/dist/internal/discovery/extensions.js +211 -74
  374. package/dist/internal/discovery/hooks.d.ts +1 -1
  375. package/dist/internal/discovery/hooks.d.ts.map +1 -1
  376. package/dist/internal/discovery/hooks.js +15 -2
  377. package/dist/internal/discovery/info.d.ts.map +1 -1
  378. package/dist/internal/discovery/info.js +10 -1
  379. package/dist/internal/discovery/modules.d.ts.map +1 -1
  380. package/dist/internal/discovery/modules.js +8 -2
  381. package/dist/internal/discovery/names.d.ts +1 -1
  382. package/dist/internal/discovery/names.d.ts.map +1 -1
  383. package/dist/internal/discovery/names.js +1 -0
  384. package/dist/internal/discovery/project.d.ts +0 -2
  385. package/dist/internal/discovery/project.d.ts.map +1 -1
  386. package/dist/internal/discovery/project.js +64 -10
  387. package/dist/internal/discovery/runtime.d.ts.map +1 -1
  388. package/dist/internal/discovery/runtime.js +1 -2
  389. package/dist/internal/discovery/schedules.d.ts +1 -1
  390. package/dist/internal/discovery/schedules.d.ts.map +1 -1
  391. package/dist/internal/discovery/schedules.js +23 -2
  392. package/dist/internal/discovery/services.d.ts +6 -2
  393. package/dist/internal/discovery/services.d.ts.map +1 -1
  394. package/dist/internal/discovery/services.js +31 -1
  395. package/dist/internal/discovery/skills.d.ts +1 -6
  396. package/dist/internal/discovery/skills.d.ts.map +1 -1
  397. package/dist/internal/discovery/skills.js +8 -3
  398. package/dist/internal/discovery/subagent.d.ts +3 -0
  399. package/dist/internal/discovery/subagent.d.ts.map +1 -1
  400. package/dist/internal/discovery/subagent.js +109 -0
  401. package/dist/internal/discovery.d.ts +1 -2
  402. package/dist/internal/discovery.d.ts.map +1 -1
  403. package/dist/internal/discovery.js +1 -2
  404. package/dist/internal/distribution.d.ts +10 -27
  405. package/dist/internal/distribution.d.ts.map +1 -1
  406. package/dist/internal/distribution.js +25 -73
  407. package/dist/internal/docs-site.js +1 -1
  408. package/dist/internal/eval-run-store.d.ts +0 -1
  409. package/dist/internal/eval-run-store.d.ts.map +1 -1
  410. package/dist/internal/eval-runner.d.ts.map +1 -1
  411. package/dist/internal/factory-resource-channel.d.ts +33 -0
  412. package/dist/internal/factory-resource-channel.d.ts.map +1 -0
  413. package/dist/internal/factory-resource-channel.js +77 -0
  414. package/dist/internal/filesystem/errors.d.ts +64 -0
  415. package/dist/internal/filesystem/errors.d.ts.map +1 -0
  416. package/dist/internal/filesystem/errors.js +175 -0
  417. package/dist/internal/filesystem/format.d.ts +28 -0
  418. package/dist/internal/filesystem/format.d.ts.map +1 -0
  419. package/dist/internal/filesystem/format.js +213 -0
  420. package/dist/internal/filesystem/merge.d.ts +34 -0
  421. package/dist/internal/filesystem/merge.d.ts.map +1 -0
  422. package/dist/internal/filesystem/merge.js +196 -0
  423. package/dist/internal/filesystem/scratch.d.ts +59 -0
  424. package/dist/internal/filesystem/scratch.d.ts.map +1 -0
  425. package/dist/internal/filesystem/scratch.js +212 -0
  426. package/dist/internal/filesystem/sdk-schemas.d.ts +29 -0
  427. package/dist/internal/filesystem/sdk-schemas.d.ts.map +1 -0
  428. package/dist/internal/filesystem/sdk-schemas.js +153 -0
  429. package/dist/internal/filesystem/tools.d.ts +42 -0
  430. package/dist/internal/filesystem/tools.d.ts.map +1 -0
  431. package/dist/internal/filesystem/tools.js +618 -0
  432. package/dist/internal/filesystem/walk.d.ts +74 -0
  433. package/dist/internal/filesystem/walk.d.ts.map +1 -0
  434. package/dist/internal/filesystem/walk.js +339 -0
  435. package/dist/internal/framework-file-storage.d.ts +8 -0
  436. package/dist/internal/framework-file-storage.d.ts.map +1 -1
  437. package/dist/internal/framework-file-storage.js +8 -8
  438. package/dist/internal/github-fanout.d.ts +1 -1
  439. package/dist/internal/github-fanout.js +1 -1
  440. package/dist/internal/guest-network.d.ts +104 -0
  441. package/dist/internal/guest-network.d.ts.map +1 -0
  442. package/dist/internal/guest-network.js +309 -0
  443. package/dist/internal/host-otel.d.ts +3 -3
  444. package/dist/internal/host-otel.d.ts.map +1 -1
  445. package/dist/internal/host-otel.js +8 -4
  446. package/dist/internal/hosted-admission-adapter.d.ts +8 -7
  447. package/dist/internal/hosted-admission-adapter.d.ts.map +1 -1
  448. package/dist/internal/hosted-delivery-protocol.d.ts +6 -0
  449. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  450. package/dist/internal/hosted-delivery-protocol.js +18 -5
  451. package/dist/internal/hosted-delivery.d.ts +18 -0
  452. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  453. package/dist/internal/hosted-delivery.js +258 -118
  454. package/dist/internal/http-channel.d.ts.map +1 -1
  455. package/dist/internal/http-channel.js +1 -3
  456. package/dist/internal/init-interview.d.ts.map +1 -1
  457. package/dist/internal/init-interview.js +1 -3
  458. package/dist/internal/init-project.d.ts +2 -2
  459. package/dist/internal/init-project.js +2 -2
  460. package/dist/internal/inline-stdio-define-stub.d.ts +1 -1
  461. package/dist/internal/inline-stdio-define-stub.d.ts.map +1 -1
  462. package/dist/internal/inline-stdio-define-stub.js +1 -1
  463. package/dist/internal/is-record.d.ts +2 -0
  464. package/dist/internal/is-record.d.ts.map +1 -0
  465. package/dist/internal/is-record.js +3 -0
  466. package/dist/internal/json-schema.d.ts.map +1 -1
  467. package/dist/internal/json-schema.js +18 -10
  468. package/dist/internal/local-control-plane.d.ts +1 -2
  469. package/dist/internal/local-control-plane.d.ts.map +1 -1
  470. package/dist/internal/local-control-plane.js +3 -20
  471. package/dist/internal/mcp-endpoint.d.ts.map +1 -1
  472. package/dist/internal/mcp-endpoint.js +1 -3
  473. package/dist/internal/otel/collector.d.ts +12 -3
  474. package/dist/internal/otel/collector.d.ts.map +1 -1
  475. package/dist/internal/otel/collector.js +77 -125
  476. package/dist/internal/otel/config.d.ts +0 -2
  477. package/dist/internal/otel/config.d.ts.map +1 -1
  478. package/dist/internal/otel/config.js +17 -20
  479. package/dist/internal/otel/http.d.ts +2 -0
  480. package/dist/internal/otel/http.d.ts.map +1 -1
  481. package/dist/internal/otel/http.js +7 -1
  482. package/dist/internal/otel/mcp.d.ts.map +1 -1
  483. package/dist/internal/otel/mcp.js +3 -16
  484. package/dist/internal/otel/runtime.d.ts +26 -1
  485. package/dist/internal/otel/runtime.d.ts.map +1 -1
  486. package/dist/internal/otel/runtime.js +164 -15
  487. package/dist/internal/package-inline-stdio.d.ts.map +1 -1
  488. package/dist/internal/package-inline-stdio.js +3 -11
  489. package/dist/internal/playground/toolchain.d.ts +1 -1
  490. package/dist/internal/playground/toolchain.d.ts.map +1 -1
  491. package/dist/internal/playground/toolchain.js +1 -1
  492. package/dist/internal/request-error-status.d.ts +12 -0
  493. package/dist/internal/request-error-status.d.ts.map +1 -0
  494. package/dist/internal/request-error-status.js +52 -0
  495. package/dist/internal/resolve-prod-target.d.ts +1 -1
  496. package/dist/internal/resolve-prod-target.d.ts.map +1 -1
  497. package/dist/internal/resolve-prod-target.js +3 -7
  498. package/dist/internal/result-output.d.ts +18 -0
  499. package/dist/internal/result-output.d.ts.map +1 -0
  500. package/dist/internal/result-output.js +33 -0
  501. package/dist/internal/run-client.d.ts +2 -2
  502. package/dist/internal/run-client.js +2 -2
  503. package/dist/internal/runtime-dispatch-runner.d.ts +1 -11
  504. package/dist/internal/runtime-dispatch-runner.d.ts.map +1 -1
  505. package/dist/internal/runtime-dispatch-runner.js +2 -15
  506. package/dist/internal/sdk-runner.d.ts +1 -1
  507. package/dist/internal/sdk-runner.d.ts.map +1 -1
  508. package/dist/internal/sdk-runner.js +6 -7
  509. package/dist/internal/server.d.ts.map +1 -1
  510. package/dist/internal/server.js +110 -35
  511. package/dist/internal/session-cost.d.ts +3 -3
  512. package/dist/internal/session-cost.d.ts.map +1 -1
  513. package/dist/internal/session-cost.js +3 -3
  514. package/dist/internal/session-engine.d.ts +48 -11
  515. package/dist/internal/session-engine.d.ts.map +1 -1
  516. package/dist/internal/session-engine.js +507 -115
  517. package/dist/internal/session-run-log.d.ts.map +1 -1
  518. package/dist/internal/session-run-log.js +1 -3
  519. package/dist/internal/skills-sync.d.ts +1 -4
  520. package/dist/internal/skills-sync.d.ts.map +1 -1
  521. package/dist/internal/skills-sync.js +10 -50
  522. package/dist/internal/sleep.d.ts +2 -0
  523. package/dist/internal/sleep.d.ts.map +1 -0
  524. package/dist/internal/sleep.js +3 -0
  525. package/dist/internal/store-mirror.d.ts +29 -0
  526. package/dist/internal/store-mirror.d.ts.map +1 -0
  527. package/dist/internal/store-mirror.js +70 -0
  528. package/dist/internal/tenant-slack/relay.d.ts +73 -0
  529. package/dist/internal/tenant-slack/relay.d.ts.map +1 -0
  530. package/dist/internal/tenant-slack/relay.js +138 -0
  531. package/dist/internal/testing/factory-resource-fixtures.d.ts +48 -0
  532. package/dist/internal/testing/factory-resource-fixtures.d.ts.map +1 -0
  533. package/dist/internal/testing/factory-resource-fixtures.js +41 -0
  534. package/dist/internal/testing/scm-continuation-fixtures.d.ts +33 -0
  535. package/dist/internal/testing/scm-continuation-fixtures.d.ts.map +1 -0
  536. package/dist/internal/testing/scm-continuation-fixtures.js +253 -0
  537. package/dist/internal/workspace-sync.d.ts +22 -0
  538. package/dist/internal/workspace-sync.d.ts.map +1 -0
  539. package/dist/internal/workspace-sync.js +49 -0
  540. package/dist/internal/workspace.d.ts +7 -0
  541. package/dist/internal/workspace.d.ts.map +1 -1
  542. package/dist/internal/workspace.js +13 -0
  543. package/dist/otel.d.ts +23 -1
  544. package/dist/otel.d.ts.map +1 -1
  545. package/dist/otel.js +93 -2
  546. package/dist/playground/assets/index-8YiozU89.js +67 -0
  547. package/dist/playground/assets/index-MbMxXg-y.css +1 -0
  548. package/dist/playground/index.html +2 -2
  549. package/dist/result.d.ts +24 -0
  550. package/dist/result.d.ts.map +1 -0
  551. package/dist/result.js +27 -0
  552. package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
  553. package/dist/storage-backends/cursor-hosted.js +7 -4
  554. package/dist/storage-protocol.d.ts.map +1 -1
  555. package/dist/storage-protocol.js +1 -3
  556. package/dist/types.d.ts +141 -26
  557. package/dist/types.d.ts.map +1 -1
  558. package/docs/README.md +2 -2
  559. package/docs/concepts.md +2 -4
  560. package/docs/design/filesystem.md +376 -0
  561. package/docs/design/runtime-abstraction.md +2 -3
  562. package/docs/evals.md +9 -7
  563. package/docs/guides/cloud-agents.md +4 -6
  564. package/docs/guides/github.md +5 -1
  565. package/docs/guides/opentelemetry.md +41 -17
  566. package/docs/reference/agent-config.md +6 -10
  567. package/docs/reference/channels.md +38 -8
  568. package/docs/reference/cli.md +3 -4
  569. package/docs/reference/extensions.md +87 -23
  570. package/docs/reference/hooks.md +215 -46
  571. package/docs/reference/playground.md +3 -0
  572. package/docs/reference/project-layout.md +2 -1
  573. package/docs/reference/result.md +94 -0
  574. package/docs/reference/sessions.md +3 -1
  575. package/docs/reference/tools.md +1 -2
  576. package/docs/templates/pr-autofixer.md +0 -3
  577. package/package.json +42 -9
  578. package/skills/framework-map/SKILL.md +3 -1
  579. package/skills/otel/SKILL.md +8 -3
  580. package/src/ab.ts +1 -1
  581. package/src/bin/agent-serve.ts +121 -21
  582. package/src/channels/bitbucket/api.ts +623 -0
  583. package/src/channels/bitbucket/binding.ts +414 -0
  584. package/src/channels/bitbucket/bitbucket-channel.ts +182 -0
  585. package/src/channels/bitbucket/bitbucket-webhook.ts +576 -0
  586. package/src/channels/bitbucket/checks.ts +154 -0
  587. package/src/channels/bitbucket/cursor-account.ts +117 -0
  588. package/src/channels/bitbucket/defaults.ts +110 -0
  589. package/src/channels/bitbucket/events.ts +84 -0
  590. package/src/channels/bitbucket/index.ts +49 -0
  591. package/src/channels/bitbucket/replay.ts +439 -0
  592. package/src/channels/bitbucket/state.ts +59 -0
  593. package/src/channels/bitbucket/types.ts +266 -0
  594. package/src/channels/change-monitors/change-monitors-channel.ts +62 -0
  595. package/src/channels/change-monitors/index.ts +8 -0
  596. package/src/channels/change-monitors/types.ts +44 -0
  597. package/src/channels/deployments/deployments-channel.ts +25 -43
  598. package/src/channels/deployments/types.ts +12 -6
  599. package/src/channels/github/binding.ts +8 -1
  600. package/src/channels/github/cursor-account.ts +17 -6
  601. package/src/channels/github/defaults.ts +4 -0
  602. package/src/channels/github/events.ts +1 -1
  603. package/src/channels/github/forward.ts +3 -2
  604. package/src/channels/github/github-channel.ts +74 -221
  605. package/src/channels/github/progress.ts +76 -10
  606. package/src/channels/github/replay.ts +1 -1
  607. package/src/channels/github/state.ts +6 -0
  608. package/src/channels/github/types.ts +2 -5
  609. package/src/channels/gitlab/api.ts +228 -0
  610. package/src/channels/gitlab/binding.ts +233 -0
  611. package/src/channels/gitlab/checks.ts +243 -0
  612. package/src/channels/gitlab/cursor-account.ts +114 -0
  613. package/src/channels/gitlab/defaults.ts +93 -0
  614. package/src/channels/gitlab/events.ts +44 -0
  615. package/src/channels/gitlab/gitlab-channel.ts +176 -0
  616. package/src/channels/gitlab/gitlab-webhook.ts +555 -0
  617. package/src/channels/gitlab/index.ts +43 -0
  618. package/src/channels/gitlab/replay.ts +347 -0
  619. package/src/channels/gitlab/state.ts +55 -0
  620. package/src/channels/gitlab/types.ts +263 -0
  621. package/src/channels/issues/index.ts +9 -0
  622. package/src/channels/issues/issues-channel.ts +51 -0
  623. package/src/channels/issues/types.ts +41 -0
  624. package/src/channels/origin/api.ts +4 -2
  625. package/src/channels/origin/origin-channel.ts +19 -94
  626. package/src/channels/origin/types.ts +23 -2
  627. package/src/channels/slack/eval-directive.ts +1 -6
  628. package/src/channels/slack/init.ts +6 -3
  629. package/src/channels/slack/setup.ts +7 -6
  630. package/src/channels/slack/types.ts +1 -1
  631. package/src/channels.ts +0 -1
  632. package/src/client.ts +1 -1
  633. package/src/connections.ts +1 -1
  634. package/src/evals.ts +1 -1
  635. package/src/extensions.ts +47 -5
  636. package/src/files.ts +21 -3
  637. package/src/filesystem.ts +2074 -0
  638. package/src/index.ts +48 -28
  639. package/src/internal/ab-snapshot.ts +0 -3
  640. package/src/internal/advertise-tools.ts +1 -4
  641. package/src/internal/authored-alias-hooks.ts +4 -21
  642. package/src/internal/authored-loaders.ts +6 -23
  643. package/src/internal/channel-dispatch.ts +160 -0
  644. package/src/internal/chat-client.ts +1 -1
  645. package/src/internal/cli-ax.ts +5 -5
  646. package/src/internal/cli-bitbucket.ts +477 -0
  647. package/src/internal/cli-convert-automation.ts +7 -7
  648. package/src/internal/cli-cursor.ts +2 -5
  649. package/src/internal/cli-deploy.ts +2 -8
  650. package/src/internal/cli-github.ts +3 -3
  651. package/src/internal/cli-gitlab.ts +485 -0
  652. package/src/internal/cli-mcp.ts +2 -7
  653. package/src/internal/cli-slack.ts +2 -5
  654. package/src/internal/continuation-channel.ts +102 -4
  655. package/src/internal/continuation-identity.ts +338 -35
  656. package/src/internal/conversation-mirror.ts +4 -3
  657. package/src/internal/convert-automation/types.ts +1 -1
  658. package/src/internal/cursor/account-mcp.ts +1 -4
  659. package/src/internal/cursor/backend-client.ts +9 -10
  660. package/src/internal/cursor/bound-secret-file.ts +108 -0
  661. package/src/internal/cursor/credentials.ts +75 -10
  662. package/src/internal/cursor/hosted-bound-secrets.ts +75 -0
  663. package/src/internal/cursor/hosted-deployment-secrets.ts +42 -11
  664. package/src/internal/cursor/hosted-store-secrets.ts +1 -1
  665. package/src/internal/cursor-account-mcp-auth.ts +2 -5
  666. package/src/internal/cursor-deployment-relay.ts +11 -7
  667. package/src/internal/deploy-manifest.ts +4 -2
  668. package/src/internal/discovery/ab.ts +29 -9
  669. package/src/internal/discovery/agent.ts +181 -136
  670. package/src/internal/discovery/channels.ts +15 -13
  671. package/src/internal/discovery/connections.ts +55 -50
  672. package/src/internal/discovery/cursor-plugin.ts +1 -4
  673. package/src/internal/discovery/extension-overlay.ts +274 -0
  674. package/src/internal/discovery/extensions.ts +330 -105
  675. package/src/internal/discovery/hooks.ts +20 -2
  676. package/src/internal/discovery/info.ts +10 -0
  677. package/src/internal/discovery/modules.ts +8 -2
  678. package/src/internal/discovery/names.ts +2 -1
  679. package/src/internal/discovery/project.ts +80 -9
  680. package/src/internal/discovery/runtime.ts +1 -2
  681. package/src/internal/discovery/schedules.ts +28 -2
  682. package/src/internal/discovery/services.ts +37 -1
  683. package/src/internal/discovery/skills.ts +13 -3
  684. package/src/internal/discovery/subagent.ts +107 -0
  685. package/src/internal/discovery.ts +0 -2
  686. package/src/internal/distribution.ts +35 -83
  687. package/src/internal/docs-site.ts +1 -1
  688. package/src/internal/eval-run-store.ts +0 -7
  689. package/src/internal/eval-runner.ts +0 -1
  690. package/src/internal/factory-resource-channel.ts +122 -0
  691. package/src/internal/filesystem/errors.ts +220 -0
  692. package/src/internal/filesystem/format.ts +276 -0
  693. package/src/internal/filesystem/merge.ts +195 -0
  694. package/src/internal/filesystem/scratch.ts +255 -0
  695. package/src/internal/filesystem/sdk-schemas.ts +204 -0
  696. package/src/internal/filesystem/tools.ts +821 -0
  697. package/src/internal/filesystem/walk.ts +369 -0
  698. package/src/internal/framework-file-storage.ts +8 -8
  699. package/src/internal/github-fanout.ts +1 -1
  700. package/src/internal/guest-network.ts +389 -0
  701. package/src/internal/host-otel.ts +8 -4
  702. package/src/internal/hosted-admission-adapter.ts +8 -8
  703. package/src/internal/hosted-delivery-protocol.ts +26 -1
  704. package/src/internal/hosted-delivery.ts +393 -192
  705. package/src/internal/http-channel.ts +1 -4
  706. package/src/internal/init-interview.ts +1 -4
  707. package/src/internal/init-project.ts +2 -2
  708. package/src/internal/inline-stdio-define-stub.ts +1 -1
  709. package/src/internal/is-record.ts +3 -0
  710. package/src/internal/json-schema.ts +19 -10
  711. package/src/internal/local-control-plane.ts +5 -24
  712. package/src/internal/mcp-endpoint.ts +1 -4
  713. package/src/internal/otel/collector.ts +94 -159
  714. package/src/internal/otel/config.ts +10 -14
  715. package/src/internal/otel/http.ts +14 -1
  716. package/src/internal/otel/mcp.ts +3 -16
  717. package/src/internal/otel/runtime.ts +240 -25
  718. package/src/internal/package-inline-stdio.ts +3 -12
  719. package/src/internal/playground/toolchain.ts +1 -1
  720. package/src/internal/request-error-status.ts +72 -0
  721. package/src/internal/resolve-prod-target.ts +3 -8
  722. package/src/internal/result-output.ts +34 -0
  723. package/src/internal/run-client.ts +2 -2
  724. package/src/internal/runtime-dispatch-runner.ts +3 -21
  725. package/src/internal/sdk-runner.ts +7 -7
  726. package/src/internal/server.ts +153 -44
  727. package/src/internal/session-cost.ts +3 -3
  728. package/src/internal/session-engine.ts +621 -103
  729. package/src/internal/session-run-log.ts +1 -4
  730. package/src/internal/skills-sync.ts +13 -63
  731. package/src/internal/sleep.ts +3 -0
  732. package/src/internal/store-mirror.ts +86 -0
  733. package/src/internal/tenant-slack/relay.ts +179 -0
  734. package/src/internal/testing/factory-resource-fixtures.ts +85 -0
  735. package/src/internal/testing/scm-continuation-fixtures.ts +286 -0
  736. package/src/internal/workspace-sync.ts +55 -0
  737. package/src/internal/workspace.ts +14 -0
  738. package/src/otel.ts +143 -3
  739. package/src/result.ts +36 -0
  740. package/src/storage-backends/cursor-hosted.ts +7 -4
  741. package/src/storage-protocol.ts +1 -4
  742. package/src/types.ts +154 -37
  743. package/templates/triage/agent/lib/types.ts +0 -2
  744. package/dist/continuation.d.ts +0 -20
  745. package/dist/continuation.d.ts.map +0 -1
  746. package/dist/continuation.js +0 -18
  747. package/dist/docs/assets/chunks/@localSearchIndexroot.FAqdWIXo.js +0 -1
  748. package/dist/docs/assets/concepts.md.rPzW2HZN.js +0 -1
  749. package/dist/docs/assets/guides_cloud-agents.md.DumwWXba.js +0 -9
  750. package/dist/docs/assets/guides_cloud-runtime.md.BRirbRAN.js +0 -9
  751. package/dist/docs/assets/guides_cloud-runtime.md.BRirbRAN.lean.js +0 -1
  752. package/dist/docs/assets/reference_extensions.md.9WQMZe1l.lean.js +0 -1
  753. package/dist/docs/assets/reference_hooks.md.a8BJxMR5.js +0 -14
  754. package/dist/docs/assets/skills_framework-map.md.DDa4MeEW.js +0 -1
  755. package/dist/docs/guides/cloud-runtime.html +0 -35
  756. package/dist/docs/guides/cloud-runtime.md +0 -117
  757. package/dist/internal/convert-automation/index.d.ts +0 -3
  758. package/dist/internal/convert-automation/index.d.ts.map +0 -1
  759. package/dist/internal/convert-automation/index.js +0 -1
  760. package/dist/internal/grokbot/runner.d.ts +0 -64
  761. package/dist/internal/grokbot/runner.d.ts.map +0 -1
  762. package/dist/internal/grokbot/runner.js +0 -282
  763. package/dist/internal/managed-delivery.d.ts +0 -80
  764. package/dist/internal/managed-delivery.d.ts.map +0 -1
  765. package/dist/internal/managed-delivery.js +0 -86
  766. package/dist/internal/review-comments.d.ts +0 -370
  767. package/dist/internal/review-comments.d.ts.map +0 -1
  768. package/dist/internal/review-comments.js +0 -921
  769. package/dist/internal/shallow-clone.d.ts +0 -176
  770. package/dist/internal/shallow-clone.d.ts.map +0 -1
  771. package/dist/internal/shallow-clone.js +0 -419
  772. package/dist/playground/assets/index-B6C9S9nG.css +0 -1
  773. package/dist/playground/assets/index-ZqNoT8Ie.js +0 -69
  774. package/docs/guides/cloud-runtime.md +0 -122
  775. package/src/continuation.ts +0 -49
  776. package/src/internal/convert-automation/index.ts +0 -10
  777. package/src/internal/grokbot/runner.ts +0 -370
  778. package/src/internal/managed-delivery.ts +0 -125
  779. package/src/internal/review-comments.ts +0 -1363
  780. package/src/internal/shallow-clone.ts +0 -609
  781. /package/dist/docs/assets/{evals.md.CPzDAwoH.lean.js → evals.md.CbMoebP1.lean.js} +0 -0
  782. /package/dist/docs/assets/{guides_cloud-agents.md.DumwWXba.lean.js → guides_cloud-agents.md.DS8RIjwx.lean.js} +0 -0
  783. /package/dist/docs/assets/{index.md.Kiht7ell.lean.js → index.md.D75GWhPl.lean.js} +0 -0
  784. /package/dist/docs/assets/{reference_agent-config.md.BHeYMgme.lean.js → reference_agent-config.md.CHNpiyp4.lean.js} +0 -0
  785. /package/dist/docs/assets/{reference_cli.md.DfoeyvL0.lean.js → reference_cli.md.CJNc_xYK.lean.js} +0 -0
  786. /package/dist/docs/assets/{reference_playground.md.DnX5nL-B.lean.js → reference_playground.md.4myJPxrf.lean.js} +0 -0
  787. /package/dist/docs/assets/{reference_project-layout.md.CA6QP6Lw.lean.js → reference_project-layout.md.DuBu9a96.lean.js} +0 -0
  788. /package/dist/docs/assets/{reference_tools.md.B1up2r9W.lean.js → reference_tools.md.aGrn99hP.lean.js} +0 -0
  789. /package/dist/docs/assets/{skills_framework-map.md.DDa4MeEW.lean.js → skills_framework-map.md.haibFyoB.lean.js} +0 -0
@@ -506,6 +506,7 @@ name. For example, `agent/tools/get_weather.ts` creates a tool named
506
506
  | `agent/host-connections/<name>.ts` | Privileged MCP servers for host tools only |
507
507
  | `agent/channels/*.ts` | HTTP, Slack, and GitHub entry points |
508
508
  | `agent/ab.ts` or `agent/ab/*.ts` | Sticky variants and live performance metrics |
509
+ | `agent/result.ts` | Optional host `commit` on the final assistant text |
509
510
  | `evals/**/*.eval.ts` | Repeatable checks at the project root |
510
511
 
511
512
  Other folders add subagents, extensions, hooks, schedules, and workspace
@@ -581,7 +582,7 @@ Choose a runtime in `agent/agent.ts`:
581
582
  | Approvals (`needsApproval`) | Supported | Not supported (local runtime only) |
582
583
  | Agent tool scripts | Supported | Supported |
583
584
  | Skills | Added to the session workspace | Available automatically |
584
- | Seeded files | Added to the session workspace | Ignored |
585
+ | Seeded files | Added to the session workspace | Available in a shared directory the first prompt names |
585
586
  | Repository | You provide it | The cloud agent checks it out |
586
587
 
587
588
  Use the local runtime when the host has the tools and files the agent
@@ -589,8 +590,6 @@ needs. Use the cloud runtime when each turn needs an isolated repository
589
590
  checkout. `agent-sdk validate` warns when a cloud agent uses a
590
591
  local-only capability.
591
592
 
592
- See [Cloud runtime](/docs/guides/cloud-runtime.md) for setup and trade-offs.
593
-
594
593
  ## What files can a local session access?
595
594
 
596
595
  Each local session gets its own workspace. The Agent SDK writes the
@@ -638,7 +637,6 @@ See [Agent-to-agent](/docs/guides/agent-to-agent.md) for a complete example.
638
637
  - [Sessions and streaming](/docs/reference/sessions.md)
639
638
  - [Channels](/docs/reference/channels.md)
640
639
  - [Live A/B metrics](/docs/ab.md)
641
- - [Cloud runtime](/docs/guides/cloud-runtime.md)
642
640
 
643
641
  ---
644
642
 
@@ -1091,6 +1089,387 @@ Continue with these pages:
1091
1089
 
1092
1090
  ---
1093
1091
 
1092
+ Source: /docs/design/filesystem.md
1093
+
1094
+ # One FileSystem for every Agent SDK agent
1095
+
1096
+ > **Status:** first implementation, this PR. `@cursor/july` only.
1097
+ > No Cursor SDK change.
1098
+ > **Audience:** Agent SDK maintainers.
1099
+
1100
+ Every local turn binds a **FileSystem** and synthesizes native file
1101
+ tools from it. There is no "is there an override?" branch on the
1102
+ tool path. Authors pick the tree with `root`. Omit `root` and the
1103
+ tree is the host disk, through internal `localFileSystem`.
1104
+
1105
+ ```ts
1106
+ // Host disk. Relative paths resolve against the harness cwd.
1107
+ export default defineAgent({
1108
+ name: "reviewer",
1109
+ });
1110
+
1111
+ // Override. The model sees only this tree. Paths are posix `/`.
1112
+ export default defineAgent({
1113
+ name: "notes",
1114
+ root: tempFs({ "/notes.md": "hello" }),
1115
+ });
1116
+ ```
1117
+
1118
+ ---
1119
+
1120
+ ## Names
1121
+
1122
+ | Name | Kind | Meaning |
1123
+ | --- | --- | --- |
1124
+ | `FileSystem` | Type on `@cursor/july` | Path verbs. Authors provide this. |
1125
+ | `root` | Field on `defineAgent` | The FileSystem the agent runs on. Omit it and the root is the host disk. |
1126
+
1127
+ No `root()` method and no public `Workspace` type.
1128
+ `local.workspaceDir` stays the harness cwd. `workspaceFiles` stays
1129
+ per-send seed files. Those names are not the path namespace.
1130
+
1131
+ Do not pass `local.root` into `Agent.create`. The published SDK
1132
+ does not have that field.
1133
+
1134
+ ---
1135
+
1136
+ ## FileSystem
1137
+
1138
+ ```ts
1139
+ interface FileSystem {
1140
+ list(prefix?: string): AsyncIterable<DirEntry>;
1141
+ stat(path: string): Promise<FileInfo>;
1142
+ glob(pattern: string, dir?: string): AsyncIterable<DirEntry>;
1143
+ read(path: string): Promise<string | Uint8Array>;
1144
+ grep(query: GrepQuery): AsyncIterable<GrepResult>;
1145
+ write(path: string, contents: string): Promise<void>;
1146
+ delete(path: string): Promise<void>;
1147
+ search(query: SearchQuery): AsyncIterable<SearchResult>;
1148
+ }
1149
+ ```
1150
+
1151
+ Every method is required. A tree without an index yields nothing
1152
+ from `search`. Methods do not fall back to the host tree.
1153
+ Diagnostics are not a FileSystem verb.
1154
+
1155
+ Path verbs take a path (and contents for `write`). Bags with two
1156
+ or more independent options (`grep`, `search`) take a
1157
+ named query object.
1158
+
1159
+ `read` returns text as a string, or image bytes as a
1160
+ `Uint8Array` (`jpeg` / `png` / `gif` / `webp`). Native Read
1161
+ applies `offset` / `limit` and numbers lines on text. Images
1162
+ become a base64 image content part, the same shape the Cursor
1163
+ harness sends the model.
1164
+
1165
+ FileSystem methods throw; they do not return a status envelope.
1166
+ `@cursor/july` does not export `FileSystemResult`.
1167
+
1168
+ ### Paths
1169
+
1170
+ Authored `root` (`tempFs`, `unionFs`, `overlayFs`, `hostFs`, a custom tree) is one posix
1171
+ namespace rooted at `/`. Query paths and yielded paths are
1172
+ absolute (`/src/a.ts`). No trailing slash except `/`. `""`, `"/"`,
1173
+ and an omitted optional scope mean the root. Prefix tests are
1174
+ path-segment: `/agent` matches `/agent/skills`, not
1175
+ `/agent-tools`. `normalizeFsPath` resolves `..`. `/tmp` is
1176
+ reserved for turn-local scratch. See `/tmp` scratch.
1177
+
1178
+ Host-default `localFileSystem` follows Cursor SDK natives:
1179
+ relative paths resolve against the harness cwd; absolute paths
1180
+ are used as-is. Yielded paths are host paths, not rewritten to
1181
+ `/`. `search` is empty (no host index).
1182
+
1183
+ ### Iterators
1184
+
1185
+ Async iterators are already sorted. `unionFs` k-way merges them
1186
+ and does not re-sort a source.
1187
+
1188
+ - `list` / `glob`: lexicographic by `path`. Paths are unique.
1189
+ - `grep`: by `path`, then `lineNumber` ascending. Keep every hit.
1190
+ - `search`: by `score` descending, then `path` ascending.
1191
+
1192
+ A file is not under itself, so listing a file path is empty.
1193
+ Empty `list` is not "missing"; `stat` answers that.
1194
+
1195
+ `glob(pattern, dir?)` matches relative to `dir`, not
1196
+ basename-anywhere (`*.ts` under `/src` is `/src/a.ts`, not
1197
+ `/src/nested/c.ts`).
1198
+
1199
+ `grep` has no `output_mode` or `offset`. A slash-free `glob`
1200
+ (`*.ts`) matches the basename at any depth under `path`.
1201
+ `grep` / `search` take optional `maxResults` as predicate
1202
+ pushdown; implementations should stop after that many hits.
1203
+ Composers push the same cap to children and apply it again
1204
+ after the merge.
1205
+
1206
+ Native-tool pagination (`head_limit`, `offset`, `output_mode`,
1207
+ `numResults`) stays on synthesized tools. Native `LS` is built
1208
+ from `list` + `stat`; there is no `ls` method.
1209
+
1210
+ ### Errors
1211
+
1212
+ FileSystem methods throw `PathError`. `path` is the absolute
1213
+ posix path the error is about. Messages stay these contract
1214
+ strings so synthesized tools can show them as-is.
1215
+
1216
+ - `list` / `stat` / `glob` must not throw for a missing path.
1217
+ Missing is an empty iterator or `{ kind: "missing" }`.
1218
+ - `read` / `delete` missing file: `FileNotFoundError`
1219
+ (`not found: ${path}`).
1220
+ - `write` has no `not found`. I/O uses the OS message or
1221
+ `WriteFailedError` (`write failed: ${path}`). A read-only
1222
+ mount uses `ReadOnlyMountError` (`read-only mount: ${path}`).
1223
+ - Synthesized StrReplace is `read` + exact replace + `write`.
1224
+ Uniqueness failures throw `EditError` (`oldText is empty`,
1225
+ `oldText and newText are exactly the same`, `The string to
1226
+ replace was not found in the file`, and `The string to replace
1227
+ was found multiple times in the file. Use replace_all to replace
1228
+ all occurrences, or include more context to only edit one
1229
+ occurrence.`). Write-back failures are `WriteFailedError`.
1230
+ - `grep` throws `InvalidGrepPatternError`
1231
+ (`invalid grep pattern: ${pattern}`). A missing host search
1232
+ root throws. A missing virtual path yields nothing.
1233
+ - `search` without an index is empty success.
1234
+ - `unionFs` with no mount throws `NoMountError`
1235
+ (`no mount for path: ${path}`) on `read` / `write` /
1236
+ `delete`. Walk verbs stay empty or missing.
1237
+ - `unionFs` catches `PathError` from a child and rethrows
1238
+ `error.withPath(mountPrefix + childPath)`. Untyped `Error` still
1239
+ gets a best-effort message rewrite.
1240
+
1241
+ Invoke wraps FileSystem throws into the executor success / error
1242
+ envelope.
1243
+
1244
+ ### Write and StrReplace
1245
+
1246
+ `write(path, contents)` creates or overwrites a file. Success is
1247
+ empty. Native Write maps `fileText` onto `contents` and prints
1248
+ `Wrote contents to ${path}`.
1249
+
1250
+ StrReplace is not a FileSystem verb. The synthesized tool reads
1251
+ the file, applies an exact non-overlapping replace, and writes
1252
+ the result. It fails when `oldText` is empty, equals `newText`,
1253
+ is missing, or occurs more than once without `replaceAll`.
1254
+ Success is `{ occurrencesModified }`. Splice is literal; do not
1255
+ use `String.prototype.replace`. Native aliases (`old_string`,
1256
+ `new_string`, `replace_all`) map onto those fields at invoke
1257
+ time.
1258
+
1259
+ ---
1260
+
1261
+ ## Helpers
1262
+
1263
+ | Helper | Role |
1264
+ | --- | --- |
1265
+ | `emptyFs()` | No files. Overlay leaf or missing catalog. Reads miss; writes are read-only. |
1266
+ | `tempFs(files)` | In-memory snapshot. Tests and fixtures. |
1267
+ | `unionFs({ "/repo": a, "/plans": b })` | Longest-prefix compose, path-segment match. Children are FileSystems rooted at `/`; `unionFs` strips the mount prefix on the way in and re-prefixes yields. List and glob use `unique` so an earlier mount shadows a later one. Grep and search keep every hit. Grep and search at `/` fan out to every child. |
1268
+ | `overlayFs([upper, lower])` | Same-root overlay. Earlier layers win. Read-only. A downed layer costs its own files, not the overlay — `stat` / `grep` / `search` only fail when no layer served. |
1269
+ | `hostFs(files, scope)` | `HostFilesApi` as a FileSystem rooted at `/`. Mount with `unionFs({ "/host": hostFs(files, scope) })`. `search` is empty (no index). Write without a cached etag is unconditional; after a successful read or write, write is CAS on that etag. |
1270
+
1271
+ `localFileSystem({ cwd })` is the host-default handle. It is not
1272
+ exported from `@cursor/july`. Name helpers and `mergeSorted`
1273
+ stay private. `emptyFs`, `tempFs`, `unionFs`, `overlayFs`, `hostFs`, and
1274
+ the `PathError` classes (`FileNotFoundError`,
1275
+ `ReadOnlyMountError`, `NoMountError`, `InvalidGrepPatternError`,
1276
+ `WriteFailedError`, `EditError`,
1277
+ `DeleteNotSupportedError`) are the public helpers.
1278
+
1279
+ ---
1280
+
1281
+ ## Tool synthesis
1282
+
1283
+ Local turns synthesize these natives from the bound FileSystem:
1284
+ `Read`, `LS`, `Grep`, `Glob`, `Write`, `StrReplace`, `Delete`,
1285
+ `SemanticSearch`. `list` + `stat` synthesize `LS`. `search`
1286
+ synthesizes `SemanticSearch`. `StrReplace` is `read` + exact
1287
+ replace + `write`. Other execute bodies call the matching
1288
+ FileSystem method.
1289
+
1290
+ Authored `tools` can filter that set. `tools: ["read", "shell"]`
1291
+ on a host-default agent synthesizes `Read` only.
1292
+ `tools: ["edit"]` synthesizes `Write` and `StrReplace`.
1293
+ `tools: ["semSearch"]` synthesizes `SemanticSearch`.
1294
+ `tools: []` synthesizes nothing.
1295
+
1296
+ Host-default does not synthesize `SemanticSearch`. Native
1297
+ `semSearch` stays on so the host index can run;
1298
+ `localFileSystem.search` is empty. Authored `root` synthesizes
1299
+ `SemanticSearch` from `FileSystem.search` and does not advertise
1300
+ native `semSearch`. `search` is not an allowlist alias, so an
1301
+ authored `search` tool is not treated as SemanticSearch.
1302
+ `ReadLints` is not a FileSystem verb. Authored
1303
+ `tools: ["readLints"]` fails closed so the host language service
1304
+ cannot run.
1305
+
1306
+ Do not also ship `agent/tools/Read.ts` (and the other synthesized
1307
+ names). Discovery fails closed on that clash for host-default and
1308
+ authored `root`.
1309
+
1310
+ A factory root re-resolves the handle before a turn. The session
1311
+ cache is the handle, not a tree snapshot. Unscoped `callTool`
1312
+ uses the invocation id and does not cache, so factories cannot
1313
+ share one tree across callers. A static `root` is the authored
1314
+ object on every session — Write / StrReplace / Delete /
1315
+ `workspaceFiles` are shared. Return a new handle from
1316
+ `(ctx) => …` when a session should have its own tree. A factory
1317
+ that returns the same object still shares.
1318
+
1319
+ Per-send `workspaceFiles` write through the FileSystem.
1320
+ `memory/` is reserved (same as the host-default workspace
1321
+ symlink into durable agent memory) and is refused after
1322
+ normalize, including `./memory/x` and `foo/../memory/x`.
1323
+ Host-default `list` / `glob` / `grep` do not follow directory
1324
+ symlinks, including `memory/` — same as native LS/Glob/Grep.
1325
+ Exact-path `read` / `stat` still follow.
1326
+
1327
+ Authored `root` skips session-directory materialize, git init,
1328
+ and host-cwd checks. First turns prepend `buildAgentsMdContent`
1329
+ and print `Workspace Path: /`. Host-default agents keep today's
1330
+ materialize path.
1331
+
1332
+ ---
1333
+
1334
+ ## Allowlist
1335
+
1336
+ | `root` | `tools` | Model-facing harness |
1337
+ | --- | --- | --- |
1338
+ | omitted | omitted | The seven host-disk file tools (no synthesized `SemanticSearch`). Host shell / webSearch / sandbox / native `semSearch` stay. Host file natives are hidden with `disallowedTools: ["read","ls","grep","glob","edit","delete"]`. |
1339
+ | omitted | `["read", "shell"]` | Synthesized `Read` + SDK `shell` + `mcp`. |
1340
+ | omitted | `[]` | No synthesized file tools. |
1341
+ | set | omitted | All eight synthesized file tools (including `SemanticSearch`) + webSearch + webFetch + updateTodos + readTodos + `mcp`. Bind `/tmp` scratch. Not the host-default full catalog (no shell / sandbox / task / native semSearch). |
1342
+ | set | `["updateTodos"]` | All eight synthesized file tools + `updateTodos` + `mcp`. |
1343
+ | set | `["semSearch"]` | Synthesized `SemanticSearch` + `mcp`. Native host index stays off. |
1344
+ | set | `[]` | No synthesized file tools. Legal and empty. |
1345
+ | set | `["shell"]` / `["task"]` / `["readLints"]` | Fail closed. |
1346
+ | set | `["webSearch"]` / `["webFetch"]` | All eight synthesized file tools + the listed web tool + `mcp`. Bind `/tmp` scratch. |
1347
+
1348
+ `mcp` is granted when any tools ride that path. File-family
1349
+ allowlist names are omitted from the SDK allowlist; the
1350
+ synthesized tools replace them.
1351
+
1352
+ `local.sandbox` is Cursor's process sandbox around child
1353
+ processes on the host-default path. It is not a FileSystem.
1354
+
1355
+ ---
1356
+
1357
+ ## Fail closed
1358
+
1359
+ | Combination | Result |
1360
+ | --- | --- |
1361
+ | `root` + `local.cwd` / `workspaceDir` / `sandbox` | Fail closed |
1362
+ | `root` + `runtime: "cloud"` or `"grokbot"` | Fail closed |
1363
+ | `root` + `tools` containing `"shell"` | Fail closed |
1364
+ | `root` + `tools` containing `"task"` | Fail closed. A child keeps the host toolset. Sharing `root` needs a Cursor SDK inherit, not an overridden Task. |
1365
+ | `root` + `tools` containing `"readLints"` | Fail closed. Diagnostics are not a FileSystem verb. |
1366
+ | `agent/tools/Read.ts` (etc.) | Fail closed on host-default and authored `root`. |
1367
+
1368
+ ---
1369
+
1370
+ ## `/tmp` scratch for webSearch and webFetch
1371
+
1372
+ Native `WebSearch` and `WebFetch` stay native. They still scratch
1373
+ large output to `{harnessCwd}/agent-tools/{uuid}.txt` on the host
1374
+ disk. Under `root`, the turn composes
1375
+ `unionFs({ "/": authored, "/tmp": tempFs() })`, copies only the file
1376
+ the native tool wrote this turn, and drops that composed root at
1377
+ end of turn.
1378
+
1379
+ ### Why `/tmp`
1380
+
1381
+ The FileSystem is the model's disk. Host `{cwd}/agent-tools/` is a
1382
+ harness path. Under `root`, the model never sees it.
1383
+
1384
+ `/tmp` is the reserved scratch prefix. An authored `/tmp` is
1385
+ shadowed. Do not put durable files there. `{cwd}/agent-tools/` and
1386
+ `/tmp` are different namespaces.
1387
+
1388
+ `/agent-tools` is not reserved. Prefix `/agent` does not cover
1389
+ `/agent-tools`. Those notes are path-prefix tests, not a mount.
1390
+
1391
+ Process or VM death also loses `/tmp`. Same as POSIX `/tmp`. That
1392
+ is acceptable. Do not persist scratch across turns or process
1393
+ restarts.
1394
+
1395
+ ### Overlay
1396
+
1397
+ | Piece | Rule |
1398
+ | --- | --- |
1399
+ | Native tool | Still searches and fetches. |
1400
+ | Bind | Per turn: `unionFs({ "/": authored, "/tmp": tempFs() })`. `/tmp` is a mount, not a FileSystem type. |
1401
+ | Session cache | Authored handle may stay cached. The composed root does not. |
1402
+ | Drop | End of turn. Next turn gets a new empty `/tmp`. |
1403
+ | Small results | Stay inline. No disk, no rewrite. |
1404
+ | Copy | Only a file the native tool wrote this turn under `{cwd}/agent-tools/`. |
1405
+ | Dest | `/tmp/{uuid}.txt`. Same uuid as the host file. |
1406
+ | Host file | Delete after copy. |
1407
+ | Other paths | Ignore. Do not copy from the result text at large. |
1408
+
1409
+ Do not put that composed root on the session handle. A later turn
1410
+ must not read another turn's `/tmp`.
1411
+
1412
+ ### Result rewrite
1413
+
1414
+ Keep the native tool descriptions. They do not mention spill.
1415
+
1416
+ This package does not change the Cursor SDK. Native WebSearch /
1417
+ WebFetch results land in the AgentService conversation inside
1418
+ the local executor. That transcript is not rewritten here.
1419
+
1420
+ What this package rewrites:
1421
+
1422
+ | Surface | Overlay (`root` set) |
1423
+ | --- | --- |
1424
+ | `webSearch` / `webFetch` result | Host path and follow-up, in strings or structured fields (`output_location`). Other tools are untouched. |
1425
+ | Synthesized Read / Grep input | `{cwd}/agent-tools/{uuid}.txt` → `/tmp/{uuid}.txt` |
1426
+
1427
+ | Field | Host path (`root` unset) | Overlay (`root` set) |
1428
+ | --- | --- | --- |
1429
+ | Path | `{cwd}/agent-tools/{uuid}.txt` | `/tmp/{uuid}.txt` |
1430
+ | Follow-up | Native text (today: shell / grep / `read_file`) | Read / Grep |
1431
+
1432
+ Two modes, two paths. Do not invent a third.
1433
+
1434
+ WebFetch proto has `output_location`. WebSearch only embeds the
1435
+ path in the chunk string. Rewrite whichever form the native tool
1436
+ used.
1437
+
1438
+ The model follow path is Read / Grep on `/tmp/{uuid}.txt`,
1439
+ including when the model still holds the host path.
1440
+
1441
+ ### Out of scope here
1442
+
1443
+ MCP `spillLargeMcpTextOutput` uses the same host `agent-tools`
1444
+ directory. The same overlay can cover it later. This section is
1445
+ webSearch and webFetch only.
1446
+
1447
+ ---
1448
+
1449
+ ## Live `root`
1450
+
1451
+ When the tree depends on the conversation, pass a factory. The
1452
+ factory returns a handle. Agent SDK may reuse the object for the
1453
+ session. Reuse is not a snapshot of mount contents.
1454
+
1455
+ ```ts
1456
+ export default defineAgent({
1457
+ name: "notes",
1458
+ root: (ctx) => notesForSession(ctx.sessionId),
1459
+ });
1460
+ ```
1461
+
1462
+ ```ts
1463
+ interface RootContext {
1464
+ sessionId: string;
1465
+ agentName?: string;
1466
+ continuationKey?: string;
1467
+ host?: { files: HostFilesApi; reminders?: ReminderHostApi };
1468
+ }
1469
+ ```
1470
+
1471
+ ---
1472
+
1094
1473
  Source: /docs/design/runtime-abstraction.md
1095
1474
 
1096
1475
  # Replacing `runtime: "local" | "cloud"` with a code interface
@@ -1100,8 +1479,8 @@ Source: /docs/design/runtime-abstraction.md
1100
1479
  > until this document has been reviewed.
1101
1480
  > **Audience:** Agent SDK and cursor-sdk maintainers; change-monitor as the
1102
1481
  > first consumer that is already faking a third runtime.
1103
- > **Companions:** [cloud-runtime.md](/docs/guides/cloud-runtime.md) (today's
1104
- > user-facing contract),
1482
+ > **Companions:** [agent-config.md](/docs/reference/agent-config.md#choose-a-runtime)
1483
+ > (today's user-facing contract),
1105
1484
  > [factory/change-monitor/docs/tools.md](https://github.com/cursor/cursor/blob/main/factory/change-monitor/docs/tools.md)
1106
1485
  > (why change-monitor is pinned to local),
1107
1486
  > [factory/change-monitor/docs/computer-use.md](https://github.com/cursor/cursor/blob/main/factory/change-monitor/docs/computer-use.md)
@@ -2699,7 +3078,6 @@ sandbox })`, next to `cloudRuntime({ repos })`. Sibling
2699
3078
  | Page | Change |
2700
3079
  |---|---|
2701
3080
  | [reference/agent-config.md](/docs/reference/agent-config.md) | `runtime` type becomes constructors **or** the deprecated string. Table + "Choose a runtime" show `localRuntime(opts)` / `cloudRuntime(opts)` / `virtualRuntime(fs)` first. Move cwd / sandbox / workspaceDir onto the `localRuntime` section. Mark sibling `local` / `cloud` and string `runtime` deprecated. |
2702
- | [guides/cloud-runtime.md](/docs/guides/cloud-runtime.md) | Open with `cloudRuntime({ repos })`. Keep `runtime: "cloud"` as the still-supported form. Cloud is a turn host, not a filesystem. Hybrid is `send({ runtime: cloudRuntime(opts) })`; local overlay is `send({ runtime: localRuntime(opts) })`. `send({ cloud })` / `send({ workspaceDir })` deprecated. |
2703
3081
  | [concepts.md](/docs/concepts.md) | Local vs cloud table: same facts, constructor names. Add one line that `virtualRuntime` is local-with-your-files, not a third host. |
2704
3082
 
2705
3083
  **New page**
@@ -3009,17 +3387,19 @@ Drive the agent with `t.send(message, options?)`. It runs one turn and
3009
3387
  waits for the session to park or fail. Multiple sends in one case share
3010
3388
  the session, which is how you write multi-turn evals.
3011
3389
 
3012
- Each `t.send` resolves to a turn result with `message`, `sessionId`,
3013
- `events`, `toolCalls`, `ok`, and `index`. The turn carries the same
3014
- assertion vocabulary as `t`, scoped to that turn, so you can grade an
3015
- intermediate turn before the next send overwrites `t.reply`.
3016
- `turn.expectOk()` throws when the turn failed, for later steps that
3017
- depend on it.
3390
+ Each `t.send` resolves to a turn result with `message`,
3391
+ `sessionId`, `events`, `toolCalls`, `ok`, and `index`. The turn carries
3392
+ the same assertion vocabulary as `t`, scoped to that turn, so you can
3393
+ grade an intermediate turn before the next send overwrites `t.reply`.
3394
+ `turn.expectOk()` throws when the turn failed, for later
3395
+ steps that depend on it.
3018
3396
 
3019
3397
  Read the full case state with `t.reply` (the last assistant text),
3020
3398
  `t.events` (session events captured so far), `t.turns` (settled
3021
3399
  turns, oldest first), and `t.sessionId`. `t.signal` aborts when the
3022
- case hits its timeout; pass it to your own async work.
3400
+ case hits its timeout; pass it to your own async work. A thrown
3401
+ [turn result](/docs/reference/result.md) `commit` fails the turn, so
3402
+ `t.succeeded()` fails too.
3023
3403
 
3024
3404
  Assert with the gates:
3025
3405
 
@@ -3448,7 +3828,8 @@ questions in the meantime. A Slack triage agent turns a bug report into
3448
3828
  a PR, a planner fans a refactor out across repositories, a reviewer asks
3449
3829
  a cloud agent to address its own comments.
3450
3830
 
3451
- This is different from the [cloud runtime](/docs/guides/cloud-runtime.md). The
3831
+ This is different from
3832
+ [`runtime: "cloud"`](/docs/reference/agent-config.md#choose-a-runtime). The
3452
3833
  runtime moves *this* agent's turns onto a cloud VM. The extension keeps
3453
3834
  the agent where it is and lets it start *other* cloud agents.
3454
3835
 
@@ -3473,9 +3854,8 @@ Launches run under the host's signed-in account (`agent-sdk login` or
3473
3854
  repositories the agent may target, and keep approval on when you can't.
3474
3855
 
3475
3856
  Mount it on an agent that runs on the local runtime; that is where
3476
- launches park for approval. On the
3477
- [cloud runtime](/docs/guides/cloud-runtime.md#what-changes-on-cloud) approvals
3478
- don't resolve.
3857
+ launches park for approval. On the cloud runtime approvals don't
3858
+ resolve.
3479
3859
 
3480
3860
  ## What the agent can do
3481
3861
 
@@ -3529,130 +3909,6 @@ Continue with these pages:
3529
3909
  overrides work
3530
3910
  - [Human-in-the-loop approvals](/docs/guides/human-in-the-loop.md): where parked
3531
3911
  launches get approved
3532
- - [Cloud runtime](/docs/guides/cloud-runtime.md): run the agent's own turns on
3533
- cloud agents instead
3534
-
3535
- ---
3536
-
3537
- Source: /docs/guides/cloud-runtime.md
3538
-
3539
- # Cloud runtime
3540
-
3541
- By default, turns execute on the Cursor SDK's local harness, on the same
3542
- machine as the server. Set `runtime: "cloud"` and turns execute on
3543
- Cursor cloud agents instead. They're ephemeral VMs that carry a repo
3544
- checkout, run `gh`, `git`, and tests for real, and scale past what one
3545
- host's disk and CPU can do. The serve host keeps handling routing, host
3546
- preparation, sessions, and bookkeeping.
3547
-
3548
- A canonical use is a PR driver whose triage runs on cloud VMs. The
3549
- patterns in this guide come from running one against real PR traffic.
3550
-
3551
- ## When to switch
3552
-
3553
- A guideline from running PR agents at scale: per-PR worktrees on the serve host
3554
- don't scale to hundreds of engineers opening PRs. When the job needs a
3555
- repo checkout at scale, use cloud. The signals:
3556
-
3557
- - The agent must run repo commands (tests, builds, `git`) against many
3558
- different refs concurrently.
3559
- - Turns are long and heavy, and you don't want them competing with the
3560
- server for resources.
3561
- - The work product is a PR or branch the VM can push, not a local file.
3562
-
3563
- Stay local when the agent is conversational, tool-driven against APIs,
3564
- or works over host-prepared evidence. Local turns are cheaper, start
3565
- faster, and support the full authored surface.
3566
-
3567
- ## Configure it
3568
-
3569
- Cloud runtime is two fields on the agent config.
3570
-
3571
- ```ts
3572
- import { defineAgent } from "@cursor/july";
3573
-
3574
- export default defineAgent({
3575
- runtime: "cloud",
3576
- cloud: {
3577
- repos: [{ url: "https://github.com/org/repo", startingRef: "main" }],
3578
- // env / envVars / … forwarded to the Cursor SDK
3579
- },
3580
- });
3581
- ```
3582
-
3583
- The host must be signed in (`agent-sdk login` or `CURSOR_API_KEY`).
3584
-
3585
- > [!IMPORTANT]
3586
- > Cloud agents run against the Cursor backend under the signed-in
3587
- > account, and every wake spends real cloud-agent budget. Decide
3588
- > explicitly what may trigger one.
3589
-
3590
- ## What changes on cloud
3591
-
3592
- Cloud turns run on a VM without your authored files, so the runtime
3593
- mapping shifts:
3594
-
3595
- | Folder or file | Local runtime | Cloud runtime |
3596
- | --- | --- | --- |
3597
- | `instructions.*` | `AGENTS.md` in the session workspace | prepended to the first prompt |
3598
- | Server tools (`execution: "server"`) | in-process SDK custom tools | authenticated HTTP MCP back to the AgentSDK host, when `--public-url` or `--cloud-tools-url` is set |
3599
- | Agent tools (`execution: "agent"`) | scripts in the session workspace | catalog + script bodies on the first prompt |
3600
- | `skills/*` | `.cursor/skills/` in the workspace | native discovery after the first turn, from the hosted store or the signed-in account |
3601
- | `mcp-connections/*.ts` | SDK `mcpServers` | SDK `mcpServers` (peers need `--public-url`) |
3602
- | `host-connections/*.ts` | `ctx.host.mcp` only | `ctx.host.mcp` only |
3603
- | `sandbox/workspace/**` | seeded into the session workspace | ignored |
3604
- | Tool approvals (`needsApproval`) | supported | not supported; keep approval-gated tools on local turns |
3605
-
3606
- Authored skills are discovered natively after the first cloud turn,
3607
- using the hosted store or the signed-in account.
3608
-
3609
- Approvals are a local-runtime contract. On cloud, a `needsApproval` tool
3610
- call rides one HTTP MCP request from the VM, and a parked call would
3611
- hold that request open until it times out; there is no durable approval
3612
- flow for cloud turns.
3613
-
3614
- Peer MCP connections need `--public-url` for cloud turns. Without one,
3615
- peers are omitted and the server warns at startup.
3616
-
3617
- ## Hybrid: local agent, cloud sessions
3618
-
3619
- A local-runtime agent can still open cloud-attached sessions per send.
3620
- Channel handlers may pass a `cloud` block (repos pinned to a PR ref, say)
3621
- in `send` options, and Slack handlers may return `cloud` from a mention
3622
- hook. A PR driver works this way: chat stays local, and the `drive`
3623
- flow attaches the PR to a cloud VM. The agent-level `cloud` config is the
3624
- base that per-session options merge over.
3625
-
3626
- ## Patterns that hold up
3627
-
3628
- These come from running a PR driver against real PR traffic:
3629
-
3630
- - One cloud session per unit of work, keyed with a stable continuation
3631
- token (`pr:owner/repo#N`) so every wake lands on the same conversation.
3632
- - Keep the host deterministic: fetch briefs and metadata on the host,
3633
- send the VM a compact prompt, and let the VM re-read source of truth
3634
- with its own `gh` and `git` instead of trusting payload snapshots.
3635
- - Limit exposure: add repository allowlists on webhook channels,
3636
- because every wake spends the account's budget.
3637
-
3638
- ## Verify cloud agents
3639
-
3640
- `agent-sdk run` and `eval` work unchanged. The trajectory records the
3641
- same event vocabulary plus `agent.bound` with the cloud URL, so you can
3642
- open the cloud conversation for any session. Cloud turns take minutes.
3643
- Pass generous `--timeout-ms` values, and keep curl timeouts long when
3644
- driving channels directly.
3645
-
3646
- ## What's next
3647
-
3648
- Continue with these pages:
3649
-
3650
- - [Agent config](/docs/reference/agent-config.md): the `runtime` and
3651
- `cloud` fields
3652
- - [GitHub guide](/docs/guides/github.md): the webhook patterns that pair with
3653
- cloud triage
3654
- - [Cursor cloud agents](/docs/guides/cloud-agents.md): keep the agent local and
3655
- let it launch cloud agents instead
3656
3912
 
3657
3913
  ---
3658
3914
 
@@ -4091,6 +4347,11 @@ behavior. Reactions still default on; set `reactions: false` when the
4091
4347
  eyes emoji is noise. Descriptions are optional; defaults derive from
4092
4348
  `botName` or the check `context`.
4093
4349
 
4350
+ To match dashboard automations, set `detailsUrl(sessionId)`,
4351
+ `summaryLinkText: "View agent"`, and `outputTitle: "context"` so the
4352
+ check title is the check name, the summary includes `[View agent](…)`,
4353
+ and Details opens the session.
4354
+
4094
4355
  A comment-only first wake has no head SHA, so the check waits for a
4095
4356
  PR or CI event. The banner still posts. A later turn on the same SHA
4096
4357
  creates a new check run; GitHub cannot reopen a completed run.
@@ -4106,7 +4367,6 @@ key. Handlers you author replace the matching defaults (same as
4106
4367
  - [Webhooks and custom channels](/docs/guides/webhooks.md): the HTTP mechanism under
4107
4368
  this pack
4108
4369
  - [Evals](/docs/evals.md): turn replay snapshots into regression fixtures
4109
- - [Cloud runtime](/docs/guides/cloud-runtime.md): attach PRs to cloud VMs
4110
4370
  - [Hooks](/docs/reference/hooks.md): observe-only; use channel `progress` for
4111
4371
  GitHub surfaces
4112
4372
 
@@ -4424,7 +4684,7 @@ Source: /docs/guides/opentelemetry.md
4424
4684
  Agent SDK can push traces, metrics, and logs from the serve process to
4425
4685
  an OTLP collector you run. Point the process at the collector with
4426
4686
  standard `OTEL_EXPORTER_OTLP_*` env, or author `agent/otel.ts`. Traces
4427
- cover the inbound request, the session, each turn, and every tool call.
4687
+ cover the inbound request, each turn, and every tool call.
4428
4688
 
4429
4689
  Export is opt-in. Nothing leaves the process until you set an endpoint
4430
4690
  or a `defineOtel` config.
@@ -4433,7 +4693,7 @@ or a `defineOtel` config.
4433
4693
 
4434
4694
  | Signal | Default | What you get |
4435
4695
  | --- | --- | --- |
4436
- | Traces | on | `agent_sdk.http` `agent_sdk.session` `agent_sdk.turn` → `agent_sdk.tool` / `agent_sdk.subagent` |
4696
+ | Traces | on | `agent_sdk.http` (per request) and `agent_sdk.turn` → `agent_sdk.tool` / `agent_sdk.subagent` |
4437
4697
  | Metrics | on | `cursor.token.usage`, `cursor.tool.calls`, `cursor.cost.usage`, plus `agent_sdk.*` session and turn counts |
4438
4698
  | Logs | off | Session events as log records. Prompt text, tool payloads, and failure messages stay off unless you opt in |
4439
4699
 
@@ -4505,7 +4765,17 @@ destination with `signals: ["traces"]`.
4505
4765
 
4506
4766
  You can also pass the same object to `serve(dir, { otel })`. Precedence
4507
4767
  is `serve({ otel })` over `agent/otel.ts` over env. An empty
4508
- `defineOtel()` still enables export when `OTEL_EXPORTER_OTLP_*` is set.
4768
+ `defineOtel()` still records traces; export starts when
4769
+ `OTEL_EXPORTER_OTLP_*` or a factory-returned `exporters` list appears.
4770
+
4771
+ Hosted v2 binds deployment secrets after bake, onto the already-listening
4772
+ process. Pass a factory so flush can re-read them. Spans record from
4773
+ bake; the hosted handler flush constructs the OTLP client and sends the
4774
+ queued batch.
4775
+
4776
+ ```ts
4777
+ export default defineOtel(() => resolveMyOtelConfig());
4778
+ ```
4509
4779
 
4510
4780
  The companion skill is [`skills/otel/SKILL.md`](/docs/skills/otel.md).
4511
4781
 
@@ -4513,17 +4783,23 @@ The companion skill is [`skills/otel/SKILL.md`](/docs/skills/otel.md).
4513
4783
 
4514
4784
  ```text
4515
4785
  agent_sdk.http inbound channel request (W3C traceparent)
4516
- └─ agent_sdk.session cursor.conversation.id = session id
4517
- └─ agent_sdk.turn
4518
- ├─ agent_sdk.tool
4519
- └─ agent_sdk.subagent
4520
- └─ agent_sdk.tool
4786
+ agent_sdk.turn one root per turn (`agent_sdk.session_id` = session id)
4787
+ ├─ agent_sdk.tool
4788
+ └─ agent_sdk.subagent
4789
+ └─ agent_sdk.tool
4521
4790
  ```
4522
4791
 
4523
- Inbound HTTP extracts W3C `traceparent`, so a channel request parents
4524
- the session span when the turn starts in that request. Turns that
4525
- resume after restore, or a direct `callTool` with no `turn.started` in
4526
- this process, open a synthetic turn span so tool calls still nest.
4792
+ Conversational sessions stay on `session.waiting` and can take more
4793
+ turns, so there is no `agent_sdk.session` span it would never end
4794
+ and OTel only exports ended spans. Each turn is its own root. Inbound
4795
+ HTTP is a separate SERVER span (it extracts W3C `traceparent`) and
4796
+ does not parent the turn, so the turn tree can export when the turn
4797
+ ends. Hosted flush ends that SERVER span before the one-shot export so
4798
+ `agent_sdk.http` is in the same batch.
4799
+
4800
+ Turns that resume after restore, or a direct `callTool` with no
4801
+ `turn.started` in this process, open a synthetic turn span so tool
4802
+ calls still nest.
4527
4803
 
4528
4804
  ## Which attributes land on the wire?
4529
4805
 
@@ -4534,6 +4810,12 @@ Every signal carries these resource attributes:
4534
4810
  - `cursor.surface=unspecified`
4535
4811
  - `agent_sdk.framework=@cursor/july`
4536
4812
 
4813
+ Span attributes (not process resource attributes — one serve process
4814
+ handles many sessions):
4815
+
4816
+ - `agent_sdk.session_id` / `cursor.conversation.id`: the session id.
4817
+ Search all turns for one conversation with `@agent_sdk.session_id`.
4818
+
4537
4819
  Shared names (same keys as enterprise export):
4538
4820
 
4539
4821
  - `cursor.conversation.id`: the session id
@@ -4544,22 +4826,24 @@ Shared names (same keys as enterprise export):
4544
4826
  `cursor.tool.status`
4545
4827
  - `cursor.cost.usage` (USD)
4546
4828
 
4547
- Agent SDK only (`agent_sdk.*`): agent name, turn id, channel, call id,
4548
- subagent name, session mode, and HTTP duration (`agent_sdk.http.duration`).
4829
+ Agent SDK only (`agent_sdk.*`): session id, agent name, turn id, channel,
4830
+ call id, subagent name, session mode, and HTTP duration
4831
+ (`agent_sdk.http.duration`).
4549
4832
 
4550
4833
  ## How do I emit my own metrics?
4551
4834
 
4552
4835
  `ctx.host.otel` is always present on tools, hooks, and channel
4553
4836
  handlers. Counters and histograms no-op when no meter is running.
4554
- `setAttributes` still tags the open session when a collector is
4837
+ `setAttributes` still tags open turn/tool spans when a collector is
4555
4838
  attached.
4556
4839
 
4557
4840
  Prefix metric names with your team or agent. First-party names
4558
4841
  (`cursor.token.usage`, `cursor.tool.calls`, `cursor.cost.usage`,
4559
4842
  `agent_sdk.session.count`, `agent_sdk.turn.count`,
4560
4843
  `agent_sdk.subagent.count`, `agent_sdk.http.duration`) and join keys
4561
- (`cursor.conversation.id`, `agent_sdk.agent`, `agent_sdk.turn_id`,
4562
- `agent_sdk.framework`) are reserved. Custom spans are not on this
4844
+ (`cursor.conversation.id`, `agent_sdk.session_id`, `agent_sdk.agent`,
4845
+ `agent_sdk.turn_id`, `agent_sdk.framework`) are reserved. Custom spans
4846
+ are not on this
4563
4847
  surface.
4564
4848
 
4565
4849
  ```ts
@@ -5569,8 +5853,6 @@ npx @cursor/july docs
5569
5853
  on hosted deployments (`--store`).
5570
5854
  - [Agent-to-agent](/docs/guides/agent-to-agent.md): every agent is an MCP
5571
5855
  server; agents can delegate to each other.
5572
- - [Cloud runtime](/docs/guides/cloud-runtime.md): run turns on Cursor cloud
5573
- agents instead of the local harness.
5574
5856
  - [Cursor cloud agents](/docs/guides/cloud-agents.md): let the agent launch
5575
5857
  and steer cloud agents through the `cursor-cloud-agents` extension.
5576
5858
  - [OpenTelemetry](/docs/guides/opentelemetry.md): push session, turn, and
@@ -5597,6 +5879,8 @@ npx @cursor/july docs
5597
5879
  - [Channels](/docs/reference/channels.md) ·
5598
5880
  [Schedules and reminders](/docs/reference/schedules.md) ·
5599
5881
  [Hooks](/docs/reference/hooks.md) ·
5882
+ [Artifacts](/docs/reference/artifacts.md) ·
5883
+ [Turn result](/docs/reference/result.md) ·
5600
5884
  [Sessions and streaming](/docs/reference/sessions.md) ·
5601
5885
  [Playground](/docs/reference/playground.md)
5602
5886
  - [CLI](/docs/reference/cli.md) · [HTTP API](/docs/reference/http-api.md)
@@ -6074,11 +6358,10 @@ the first prompt, because the local session workspace is not the cloud
6074
6358
  VM.
6075
6359
 
6076
6360
  `validate` warns when `runtime: "cloud"` is combined with agent tools
6077
- or sandbox seeds (they only materialize into local session workspaces),
6078
- when skills are present (they sync onto an Agent Store for native
6079
- discovery rather than the session workspace), and when the `cloud`
6080
- block is missing. The full capability matrix and the patterns that hold
6081
- up are in the [Cloud runtime guide](/docs/guides/cloud-runtime.md).
6361
+ (they are described on the first prompt instead of written to the VM),
6362
+ when skills or sandbox seeds are present (they sync onto an Agent Store
6363
+ rather than the session workspace), and when the `cloud` block is
6364
+ missing.
6082
6365
 
6083
6366
  ## Local options
6084
6367
 
@@ -6164,9 +6447,8 @@ set `local: { sandbox: true }`.
6164
6447
  Cloud agent defaults forwarded to the Cursor SDK: `repos` (each
6165
6448
  `{ url, startingRef? }`), environment selection, `envVars`, and the
6166
6449
  rest. A local agent uses the same block as the base config when a
6167
- channel opens a cloud-attached session per send. That hybrid pattern is
6168
- covered in
6169
- [Cloud runtime](/docs/guides/cloud-runtime.md#hybrid-local-agent-cloud-sessions).
6450
+ channel opens a cloud-attached session per send (the `cloud` option on
6451
+ [`send`](/docs/reference/channels.md#handler-arguments)).
6170
6452
 
6171
6453
  ## Concurrency
6172
6454
 
@@ -6243,8 +6525,6 @@ Continue with these pages:
6243
6525
 
6244
6526
  - [Instructions](/docs/reference/instructions.md): the required half of a minimal
6245
6527
  agent
6246
- - [Cloud runtime](/docs/guides/cloud-runtime.md): when and how to leave
6247
- the host
6248
6528
  - [CLI](/docs/reference/cli.md): the `serve` flags `serve()` accepts
6249
6529
 
6250
6530
  ---
@@ -6507,8 +6787,10 @@ The `events` map subscribes the channel to stream events for the
6507
6787
  sessions it owns. Keys are event types from the
6508
6788
  [event vocabulary](/docs/reference/sessions.md#which-events-can-i-stream), or `"*"`.
6509
6789
  Handlers receive `(event, channel, ctx)`, where `channel.state` is the
6510
- per-session adapter state and `ctx` exposes session info and host
6511
- services. This is where a channel delivers replies back to its surface.
6790
+ per-session adapter state, `ctx.session` is the session info, and
6791
+ `ctx.host` is the shared host services, bound to that session as in a
6792
+ [hook](/docs/reference/hooks.md#handler-context). This is where a channel delivers
6793
+ replies back to its surface.
6512
6794
 
6513
6795
  ## State and lifecycle
6514
6796
 
@@ -6581,17 +6863,45 @@ converge a merge-box check and sticky PR comment from default stream
6581
6863
  events. Guide: [GitHub](/docs/guides/github.md).
6582
6864
 
6583
6865
  **Deployments** (`@cursor/july/channels/deployments`): pull deploy
6584
- events. Subscribe per deploy source with `deploySourceUris`, narrow
6585
- with `environments` / `events`, and handle each event in `onEvent`.
6586
- `deploySourceUris` must match `Deployment.deploy_source_uri` as your
6866
+ events. Declare `events` and handle each one in `onEvent`. Each event
6867
+ carries `deploySourceUri` and `deployVersion`. Author
6868
+ `agent/channels/deployments.ts` with `deploymentsChannel()`.
6869
+
6870
+ Omit `deploySourceUris` on hosted v2. The control plane binds
6871
+ `deploy_source` edges from the deploy's watched `repositories` and the
6872
+ channel admits what it is sent, which is what makes it multi-tenant
6873
+ safe.
6874
+
6875
+ Name sources to narrow below that scope, or to drive the self-hosted
6876
+ pull relay, which has no deploy scope to inherit. There, subscribe per
6877
+ deploy source with `deploySourceUris` and narrow with `environments` /
6878
+ `events`. Each entry must match `Deployment.deploy_source_uri` as your
6587
6879
  deployment writer records it; matching is case-insensitive but
6588
- otherwise literal. Each event carries `deploySourceUri` and
6589
- `deployVersion`. Author `agent/channels/deployments.ts` with
6590
- `deploymentsChannel()`. It uses the host credential. A restart resumes
6880
+ otherwise literal. It uses the host credential. A restart resumes
6591
6881
  rather than dropping events. An empty `deploySourceUris` list mounts
6592
6882
  the channel but starts no pull, so an env-configured agent stays inert
6593
6883
  until its deploy sources are set.
6594
6884
 
6885
+ **Change Monitors** (`@cursor/july/channels/change-monitors`): Change
6886
+ Monitor Checkpoint events. The channel publishes Factory
6887
+ `checkpoint.created` for every Checkpoint create. The agent filters the
6888
+ result (for example to the `issues` arm). The payload contains the
6889
+ full Checkpoint resource. This channel is scoped to Change Monitors,
6890
+ not generic Factory Checkpoints. There is no repository filter or
6891
+ resource filter. Author `agent/channels/change-monitors.ts` with
6892
+ `changeMonitorsChannel()`. It uses the host credential. The v1 omitted
6893
+ continuation is `none/v1`. A v2 agent defaults to
6894
+ `change_monitors.checkpoint/v2`, which keys the session as
6895
+ `cont:change_monitors:{checkpointName}`.
6896
+
6897
+ **Issues** (`@cursor/july/channels/issues`): Factory issue events.
6898
+ The channel publishes `issue.created` for every Issue create. The
6899
+ agent filters if it needs a subset. The payload contains the full
6900
+ Issue resource. There is no repository filter or resource filter.
6901
+ Author `agent/channels/issues.ts` with `issuesChannel()`. It uses the
6902
+ host credential. The v1 omitted continuation is `none/v1`. A v2 agent
6903
+ defaults to `issues.issue/v2`, which keys the session by issue name.
6904
+
6595
6905
  For other platforms like Discord or Teams, use the authored
6596
6906
  `defineChannel` webhook form.
6597
6907
 
@@ -6619,10 +6929,9 @@ Source: /docs/reference/cli.md
6619
6929
 
6620
6930
  # CLI reference
6621
6931
 
6622
- `@cursor/july` installs `july` (so `npx @cursor/july docs` works) and
6623
- `agent-sdk`. The examples on this page use `agent-sdk`. Run the CLI with
6624
- Node 22.13 or newer. Don't run it with Bun; Bun corrupts tool-result
6625
- streams from the Cursor SDK.
6932
+ `@cursor/july` installs one command, `agent-sdk`; `npx @cursor/july <cmd>`
6933
+ runs it. Run the CLI with Node 22.13 or newer. Don't run it with Bun; Bun
6934
+ corrupts tool-result streams from the Cursor SDK.
6626
6935
 
6627
6936
  `agent-sdk help` prints the built-in summary. The Slack and GitHub packs
6628
6937
  also provide `agent-sdk slack help` and `agent-sdk github help`.
@@ -7897,11 +8206,16 @@ Source: /docs/reference/extensions.md
7897
8206
 
7898
8207
  # Extensions
7899
8208
 
7900
- An extension packages tools and skills an agent installs as one unit. You
7901
- mount it with a single file under `agent/extensions/`, and its
7902
- contributions join the agent under a namespace. The package updates
7903
- like any other dependency; nothing is copied into your project. A Cursor
7904
- plugin mounts the same way; see [Mount a Cursor plugin](#mount-a-cursor-plugin).
8209
+ An extension packages the same contributions an agent authors under
8210
+ `agent/` and installs them as one unit. You mount it with a single file
8211
+ under `agent/extensions/`, and its contributions join the agent under a
8212
+ namespace. The package updates like any other dependency; nothing is
8213
+ copied into your project. A Cursor plugin mounts the same way; see
8214
+ [Mount a Cursor plugin](#mount-a-cursor-plugin).
8215
+
8216
+ Extensions are native to the Agent SDK. Slot files use the `@cursor/july`
8217
+ helpers, so a package built on another agent framework fails
8218
+ `agent-sdk validate` until you rewrite it onto `@cursor/july`.
7905
8219
 
7906
8220
  ## Mount an extension
7907
8221
 
@@ -7928,6 +8242,48 @@ Namespaces follow the tool-name rule, and `__` is reserved: an authored
7928
8242
  `agent/tools/ci__failed_jobs.ts` fails discovery, so nothing outside a
7929
8243
  mount can pose as one of its tools.
7930
8244
 
8245
+ ## What an extension can contribute
8246
+
8247
+ An extension tree uses the same slots as [`agent/`](/docs/reference/project-layout.md).
8248
+ Each shareable contribution lands on the agent under the mount's
8249
+ namespace:
8250
+
8251
+ | Path | Becomes |
8252
+ | --- | --- |
8253
+ | `tools/<name>.ts` | tool `<ns>__<name>` |
8254
+ | `skills/<name>` | skill `<ns>__<name>` |
8255
+ | `mcp-connections/<name>.ts` | connection `<ns>__<name>` |
8256
+ | `host-connections/<name>.ts` | host connection `<ns>__<name>` |
8257
+ | `hooks/<name>.ts` | hook `<ns>__<name>` |
8258
+ | `channels/<name>.ts` | channel `<ns>__<name>` |
8259
+ | `schedules/<name>` | schedule `<ns>__<name>` |
8260
+ | `subagents/<id>/` | subagent `<ns>__<id>` |
8261
+ | `instructions.md` / `.ts` / dir | appended to the agent's system prompt |
8262
+ | `sandbox/workspace/**` | seeded into each local session workspace |
8263
+ | `ab.ts` / `ab/<name>.ts` | A/B experiment `<ns>__<name>` |
8264
+ | `artifacts.ts` | artifact kinds `<ns>__<kind>` |
8265
+
8266
+ The root agent still needs its own `instructions.md`. Extension
8267
+ instructions are extra fragments, not a substitute.
8268
+
8269
+ `httpChannel()` stays on the agent. An extension authors
8270
+ `defineChannel` only; a file named `http.ts` becomes `<ns>__http`.
8271
+
8272
+ These stay on the agent that mounts the extension. Each is a singleton
8273
+ or is outside discovery:
8274
+
8275
+ | Path | Why it stays on the agent |
8276
+ | --- | --- |
8277
+ | `agent.ts` | One `defineAgent` runtime per agent |
8278
+ | `storage.ts` | One `host.kv` / `host.files` backend |
8279
+ | `otel.ts` | One OTLP exporter |
8280
+ | `ab.config.ts` | One experiment-platform config; `ab.ts` / `ab/` still merge |
8281
+ | `playground/` | Custom chips are a Vite glob of the agent tree, not a discovery walk |
8282
+ | `extensions/` | Nested mounts are not loaded |
8283
+ | `sandbox.ts` | Custom sandbox backends stay on the agent |
8284
+
8285
+ `agent-sdk validate` warns when a tree carries those paths.
8286
+
7931
8287
  ## Adjust a mounted extension
7932
8288
 
7933
8289
  To replace or remove a contribution, mount the extension as a directory
@@ -7939,15 +8295,35 @@ agent/extensions/ci/
7939
8295
  ├── tools/
7940
8296
  │ ├── job_log.ts # replaces ci__job_log with your own defineTool
7941
8297
  │ └── retry_job.ts # export default disableTool() removes ci__retry_job
8298
+ ├── hooks/
8299
+ │ └── audit.ts # export default disableHook() removes ci__audit
7942
8300
  └── skills/
7943
- └── triage.md # replaces ci__triage
8301
+ └── triage.ts # export default disableSkill() removes ci__triage
7944
8302
  ```
7945
8303
 
7946
8304
  Use the extension's own names inside the directory, without the
7947
8305
  namespace. A file with a name the extension doesn't contribute adds a
7948
- new tool or skill under the namespace. `disableTool()` comes from
7949
- `@cursor/july/extensions` and fails discovery when it names a tool the
7950
- extension doesn't have, so a typo can't silently keep a tool alive.
8306
+ new contribution under the namespace. Each helper comes from
8307
+ `@cursor/july/extensions` and fails discovery when it names a
8308
+ contribution the extension doesn't have, so a typo can't silently keep
8309
+ it alive.
8310
+
8311
+ | Slot | Helper |
8312
+ | --- | --- |
8313
+ | `tools/<name>.ts` | `disableTool()` |
8314
+ | `mcp-connections/<name>.ts` / `host-connections/<name>.ts` | `disableConnection()` |
8315
+ | `skills/<name>.ts` | `disableSkill()` |
8316
+ | `hooks/<name>.ts` | `disableHook()` |
8317
+ | `channels/<name>.ts` | `disableChannel()` |
8318
+ | `schedules/<name>.ts` | `disableSchedule()` |
8319
+ | `subagents/<id>.ts` | `disableSubagent()` |
8320
+ | `instructions.ts` | `disableInstructions()` |
8321
+ | `ab.ts` / `ab/<name>.ts` | `disableAB()` |
8322
+ | `artifacts.ts` | `disableArtifacts()` |
8323
+
8324
+ `disable()` is the same brand as the slot helpers above and works in
8325
+ any of those files.
8326
+
7951
8327
  A Cursor plugin mount overlays its MCP servers the same way; see below.
7952
8328
 
7953
8329
  ## Mount a Cursor plugin
@@ -8011,8 +8387,8 @@ discovery when it names a server the plugin doesn't declare.
8011
8387
  ## Build an extension
8012
8388
 
8013
8389
  An extension is a directory laid out like `agent/`. `extension.ts`
8014
- declares it; `tools/` and `skills/` hold the contributions in the same
8015
- authoring forms as [Tools](/docs/reference/tools.md) and [Skills](/docs/reference/skills.md).
8390
+ declares it; the slots in [What an extension can contribute](#what-an-extension-can-contribute)
8391
+ use the same authoring forms as the rest of this reference.
8016
8392
 
8017
8393
  ```text
8018
8394
  @acme/ci-triage/
@@ -8024,6 +8400,10 @@ authoring forms as [Tools](/docs/reference/tools.md) and [Skills](/docs/referenc
8024
8400
  │ └── retry_job.ts
8025
8401
  ├── skills/
8026
8402
  │ └── triage.md
8403
+ ├── hooks/
8404
+ │ └── audit.ts
8405
+ ├── mcp-connections/
8406
+ │ └── buildkite.ts
8027
8407
  └── lib/
8028
8408
  └── buildkite.ts # shared code, never discovered
8029
8409
  ```
@@ -8073,17 +8453,10 @@ Because the consumer picks the namespace, have skills and tool
8073
8453
  descriptions refer to sibling tools by their short names and say they
8074
8454
  appear under the mount's namespace (`<namespace>__job_log`).
8075
8455
 
8076
- Publish the built `extension.js` as the package entry point with
8077
- `tools/` and `skills/` beside it. `root` is read from the built file, so
8078
- copy `skills/*.md` into the build output or author skills as `.ts` with
8079
- `defineSkill`.
8080
-
8081
- Only `tools/` and `skills/` are mounted from an extension tree.
8082
- Instructions, connections, hooks, channels, and the runtime
8083
- configuration belong to the agent that mounts the extension;
8084
- `agent-sdk validate` warns when a tree carries agent slots such as
8085
- `instructions.md`, `connections/`, `hooks/`, `channels/`, or
8086
- `schedules/`.
8456
+ Publish the built `extension.js` as the package entry point with the
8457
+ slot directories beside it. `root` is read from the built file, so copy
8458
+ `skills/*.md` and `instructions.md` into the build output or author them
8459
+ as `.ts`.
8087
8460
 
8088
8461
  ## What's next
8089
8462
 
@@ -8102,56 +8475,119 @@ Source: /docs/reference/hooks.md
8102
8475
 
8103
8476
  # Hooks
8104
8477
 
8105
- A hook is an observe-only subscriber to the session event stream. Hooks
8106
- run after each event is recorded. They cannot change the event or the
8107
- turn. That makes them the home for audit logging, metrics, mirroring
8108
- transcripts into your own store, and maintaining derived state. Handler
8109
- errors are logged and never fatal. A hook can't inject context into the
8110
- next turn or block a turn.
8478
+ A hook subscribes to the session event stream and runs a side effect
8479
+ after each event is recorded: an audit line, a metric, a copy of the
8480
+ transcript in your own store, or derived state for later turns. Hooks
8481
+ run in the serving process for every session of the agent, on local and
8482
+ cloud runtime turns alike.
8483
+
8484
+ Hooks observe. They can't change the turn, the prompt, or the reply, and
8485
+ a handler that throws is logged and skipped. Treat the event as
8486
+ read-only; later subscribers see the same object. That makes hooks safe
8487
+ to add to a production agent, and the wrong tool for anything that must
8488
+ happen before the model runs or must fail a turn; see
8489
+ [When not to use a hook](#when-not-to-use-a-hook).
8111
8490
 
8112
- For deterministic context composition before the model runs, use the
8113
- host path that already owns the wake: channel handlers (fetch, `callTool`,
8114
- `workspaceFiles`, and the message you pass to `send`), plus
8115
- `instructions.md`, skills, and `sandbox/workspace/` seed files. Hooks
8116
- observe what happened; they do not assemble the prompt.
8491
+ `defineHook` is unrelated to
8492
+ [Cursor Agent hooks](https://cursor.com/docs/agent/hooks), the
8493
+ `.cursor/hooks.json` scripts that can observe, block, or modify the
8494
+ agent loop. Those still run inside a local session workspace.
8495
+
8496
+ ## Author a hook
8117
8497
 
8118
8498
  Author `agent/hooks/<name>.ts` with `defineHook` from
8119
- `@cursor/july/hooks`:
8499
+ `@cursor/july/hooks`. This one meters tokens:
8120
8500
 
8121
8501
  ```ts
8502
+ // agent/hooks/usage.ts
8122
8503
  import { defineHook } from "@cursor/july/hooks";
8123
8504
 
8124
8505
  export default defineHook({
8125
8506
  events: {
8126
8507
  async "turn.completed"(event, ctx) {
8127
- const prior = await ctx.host.kv.get("last-result");
8128
- const notes = await ctx.host.files.read("notes.md");
8129
- console.log("turn done", ctx.session.id, event.data.usage, prior, notes);
8508
+ if (ctx.session.purpose === "eval" || event.data.usage === undefined) {
8509
+ return;
8510
+ }
8511
+ const { inputTokens, outputTokens } = event.data.usage;
8512
+ ctx.host.otel.increment("acme.tokens.input", inputTokens);
8513
+ ctx.host.otel.increment("acme.tokens.output", outputTokens);
8130
8514
  },
8131
- async "turn.failed"(event, ctx) {
8132
- // page, count, or record
8515
+ async "turn.failed"(_event, ctx) {
8516
+ ctx.host.otel.increment("acme.turn.failed", { channel: ctx.channel.id });
8133
8517
  },
8134
8518
  },
8135
8519
  });
8136
8520
  ```
8137
8521
 
8138
- Keys are event types (see the
8139
- [event vocabulary](/docs/reference/sessions.md#which-events-can-i-stream)), or `"*"`
8140
- for everything. Handlers receive the event with its envelope (`index`,
8141
- `sessionId`, `turnId?`, `at`) and a `HookContext`:
8522
+ Any module under `agent/hooks/`, subfolders included, is a hook named by
8523
+ its path without the extension: `agent/hooks/audit/usage.ts` is
8524
+ `audit/usage`. `*.test.ts` and `*.spec.ts` files are skipped. The
8525
+ default export must be `defineHook(...)`, names can't contain `__`, and
8526
+ an empty `events` map skips the hook with a warning; `agent-sdk validate`
8527
+ reports all three. An extension mounts its hooks as `<ns>__<name>`, and
8528
+ `disableHook()` removes one
8529
+ ([Adjust a mounted extension](/docs/reference/extensions.md#adjust-a-mounted-extension)).
8530
+
8531
+ `agent-sdk init` scaffolds `agent/hooks/memory.ts`, which exports
8532
+ `memoryHook()` from `@cursor/july/memory` and journals every turn for
8533
+ later sessions to read. Delete the file to opt out.
8534
+
8535
+ ## Events and payloads
8536
+
8537
+ Keys are event types from the
8538
+ [event vocabulary](/docs/reference/sessions.md#which-events-can-i-stream), or `"*"`
8539
+ for every event. A typed key narrows `event.data`; a `"*"` handler
8540
+ receives the union, so switch on `event.type`. Every event carries the
8541
+ stream envelope `{ type, index, sessionId, turnId?, at, data }`, with
8542
+ `turnId` set on turn-scoped events.
8543
+
8544
+ The payloads hooks read most often:
8545
+
8546
+ | Event | `event.data` |
8547
+ | --- | --- |
8548
+ | `message.received` | `{ text }` |
8549
+ | `turn.completed` | `{ result?, usage?, cost? }`. `usage` has `inputTokens`, `outputTokens`, `cacheReadTokens`, `cacheWriteTokens`, and optional `reasoningTokens`. `cost` has `totalUsd` and the `model` it was priced against |
8550
+ | `turn.failed` | `{ message }` |
8551
+ | `actions.requested` | `{ calls: [{ callId, toolName, args? }] }`. A call with `parentCallId` belongs to a subagent |
8552
+ | `action.result` | `{ callId, toolName, output?, isError, stubbed? }`. `stubbed` means a dry-run session answered a write without running it |
8553
+
8554
+ The types are `SessionEvent`, `SessionEventType`, and `HookContext`,
8555
+ exported from `@cursor/july`.
8556
+
8557
+ ## Handler context
8142
8558
 
8143
8559
  | Member | What it is |
8144
8560
  | --- | --- |
8145
- | `ctx.session` | Read-only session info: id, channel, mode, auth |
8561
+ | `ctx.session` | Read-only session info: `id`, `channelId`, `mode` (`chat` or `task`), `purpose` (`live` or `eval`), `auth`, plus `title`, `sdkAgentId`, and `abs` when set |
8146
8562
  | `ctx.agent` | `{ name }` of the agent the event belongs to |
8147
- | `ctx.channel` | `{ id, continuationToken }` for the owning channel |
8148
- | `ctx.stateRoot` | The agent's durable state root. Prefer `ctx.host.kv` / `ctx.host.files` for derived state; this tree resets on hosted replace |
8149
- | `ctx.host` | Shared host services; same as a tool's `ctx.host`. Pull JSON with `ctx.host.kv` and file-shaped state with `ctx.host.files` (session-bound by default; pass `{ scope: "deployment" }` for agent-wide files) |
8150
- | `ctx.artifacts` | Session-bound [artifacts](/docs/reference/artifacts.md) facade: `tag` auto-fills the session |
8563
+ | `ctx.channel` | `{ id, continuationToken }`. The token is `null` when the session can't take follow-ups |
8564
+ | `ctx.host.kv` | Durable JSON, shared by every session of the agent; the [storage backend](/docs/storage.md#author-kv-ctx-host-kv) decides whether it survives a hosted replace. Prefix keys with `ctx.session.id` for per-session state |
8565
+ | `ctx.host.files` | Durable files, bound to this session. Pass `{ scope: "deployment" }` for agent-wide files |
8566
+ | `ctx.host.otel` | Counters, histograms, and tags, attributed to this session |
8567
+ | `ctx.host.mcp`, `ctx.host.github`, `ctx.host.slack` | The same shared clients tools get |
8568
+ | `ctx.host.reminders` | Per-session [reminders](/docs/reference/schedules.md), the same API tools get |
8569
+ | `ctx.artifacts` | Session-bound [artifacts](/docs/reference/artifacts.md) facade: `tag` fills in `sessionId` and `turnId` |
8570
+ | `ctx.stateRoot` | Absolute path of the local state root. It resets when a hosted deployment is replaced; keep derived state in `kv` or `files` |
8571
+
8572
+ ## When hooks run
8573
+
8574
+ A hook runs after the event is durably recorded. It never delays the
8575
+ model turn and never sees an event that wasn't recorded.
8151
8576
 
8152
- Hook context includes `ctx.host`, the same shared services a tool
8153
- gets. Persist JSON with `ctx.host.kv` and file-shaped state with
8154
- `ctx.host.files`. Hooks observe; they do not own delivery surfaces.
8577
+ Within one session, events dispatch in order, one at a time: the
8578
+ channel's `events` handlers first, then each hook in discovery order.
8579
+ Sessions don't wait on each other.
8580
+
8581
+ Two consequences:
8582
+
8583
+ - A slow handler holds up the next event's handlers for that session,
8584
+ not the model. Keep handlers short and queue anything slow.
8585
+ - Hooks fire for eval sessions too. Check
8586
+ `ctx.session.purpose === "eval"` before metering or paging.
8587
+
8588
+ Each event reaches a hook at most once. A restart doesn't replay the log
8589
+ into hooks, so a mirror needs no dedupe, and the event log rather than
8590
+ the hook's copy is the source of truth.
8155
8591
 
8156
8592
  ## Hooks, channel events, evals, or A/B?
8157
8593
 
@@ -8159,37 +8595,143 @@ All of them consume the same stream, for different jobs:
8159
8595
 
8160
8596
  | | Hooks | Channel `events` | Evals | A/B (`defineAB`) |
8161
8597
  | --- | --- | --- | --- | --- |
8162
- | Scope | every session on the agent | sessions the channel owns | one test turn | every live session; enrollment at creation, metrics on each turn |
8163
- | Job | observe: audit, metrics, mirrors, derived state | deliver: replies back to the channel's surface | assert: gates over the trajectory | `ab.assigned` + fold stream `onSample` |
8598
+ | Scope | every session of the agent | sessions the channel owns | one test turn | every live session; enrollment at creation, metrics on each turn |
8599
+ | Job | observe: audit, metrics, mirrors, derived state | deliver: replies back to the channel's surface | assert: gates over the trajectory | compare: sticky arms, then fold the stream into `onSample` metrics |
8600
+ | Context | `ctx.host`, `ctx.artifacts`, session info | `channel.state`, `setContinuationToken`, `ctx.host`, session info | the `t` assertion helpers | per-session samples in `onSample` |
8164
8601
  | Can affect the run | no | yes, it owns the surface | n/a | yes through arm instructions or `session.abs`; collection is observe-only |
8165
8602
  | Authored at | `agent/hooks/*.ts` | channel config | `evals/**/*.eval.ts` | [`agent/ab.ts` or `agent/ab/*.ts`](/docs/ab.md) |
8166
8603
 
8167
- For GitHub merge-box checks and sticky PR banners, use
8168
- `githubChannel({ progress: { commitStatus, banner } })` from
8169
- `@cursor/july/channels/github`. That is the supported Autofix-style
8170
- path. See [GitHub: Show PR progress](/docs/guides/github.md#show-pr-progress).
8171
- Override channel `events` only when the lifecycle is custom, such as
8172
- never-red status from tool output. Do not use `defineHook` for those
8173
- writes.
8604
+ ## When not to use a hook
8605
+
8606
+ | You want to | Use instead |
8607
+ | --- | --- |
8608
+ | Add context before the model runs | The channel's `send` message and `workspaceFiles`, `instructions.md`, skills, or `sandbox/workspace/` seed files |
8609
+ | Reply on Slack, comment on a PR, or post any other delivery | The channel's `events` map, or the Slack and GitHub packs |
8610
+ | Show PR progress (merge-box check, sticky banner) | `githubChannel({ progress: { commitStatus, banner } })`; see [Show PR progress](/docs/guides/github.md#show-pr-progress) |
8611
+ | Block, approve, or rewrite a tool call | [`needsApproval`](/docs/reference/tools.md#gate-a-tool-on-human-approval) on the tool |
8612
+ | Act on the final assistant text, or fail a bad turn | [`defineResult`](/docs/reference/result.md) |
8613
+ | Gate a change on behavior | [Evals](/docs/evals.md) |
8614
+ | Compare two prompts on live traffic | [`defineAB`](/docs/ab.md) |
8174
8615
 
8175
8616
  ## Patterns
8176
8617
 
8177
- Usage metering: subscribe to `turn.completed` and forward
8178
- `event.data.usage` (token counts) to your metrics system.
8618
+ Usage metering is the [authoring example](#author-a-hook). Three more:
8619
+
8620
+ ### Alert on failure
8621
+
8622
+ `turn.failed` carries the message, and `ctx.session.id` points at the
8623
+ trace. Skip interrupted turns; those are preemptions, not failures. Read
8624
+ secrets inside the handler: hosted deployments bind them after the
8625
+ process starts, so a module-scope read stays empty. Give the call a
8626
+ timeout, since a stalled request holds up later handlers on that
8627
+ session.
8628
+
8629
+ ```ts
8630
+ // agent/hooks/page-on-failure.ts
8631
+ import { defineHook } from "@cursor/july/hooks";
8632
+
8633
+ export default defineHook({
8634
+ events: {
8635
+ async "turn.failed"(event, ctx) {
8636
+ const pagerUrl = process.env.PAGER_WEBHOOK_URL;
8637
+ if (
8638
+ pagerUrl === undefined ||
8639
+ ctx.session.purpose === "eval" ||
8640
+ event.data.message === "turn interrupted"
8641
+ ) {
8642
+ return;
8643
+ }
8644
+ await fetch(pagerUrl, {
8645
+ method: "POST",
8646
+ headers: { "content-type": "application/json" },
8647
+ body: JSON.stringify({
8648
+ agent: ctx.agent.name,
8649
+ session: ctx.session.id,
8650
+ channel: ctx.channel.id,
8651
+ message: event.data.message,
8652
+ }),
8653
+ signal: AbortSignal.timeout(5_000),
8654
+ });
8655
+ },
8656
+ },
8657
+ });
8658
+ ```
8179
8659
 
8180
- Failure alerting: `turn.failed` carries the message, and
8181
- `ctx.session.id` points at the trace.
8660
+ ### Mirror the transcript
8182
8661
 
8183
- Derived state: persist ids that must survive hosted replace with
8184
- `ctx.host.kv` or `ctx.host.files`. `stateRoot` resets on replace.
8662
+ Subscribe to `"*"` and write one file per event, skipping the
8663
+ `*.appended` deltas: they arrive per token, and `message.completed`
8664
+ carries the final text. Session scope keeps transcripts apart without a
8665
+ session id in the path. The mirror holds reasoning text and raw tool
8666
+ arguments and outputs, so pick the store accordingly, and write to your
8667
+ own store instead when you need cross-session queries.
8185
8668
 
8186
- Transcript export: subscribe to `"*"` and append to your own store.
8669
+ ```ts
8670
+ // agent/hooks/mirror.ts
8671
+ import { defineHook } from "@cursor/july/hooks";
8672
+
8673
+ export default defineHook({
8674
+ events: {
8675
+ async "*"(event, ctx) {
8676
+ if (event.type.endsWith(".appended")) {
8677
+ return;
8678
+ }
8679
+ const name = String(event.index).padStart(6, "0");
8680
+ await ctx.host.files.write(
8681
+ `transcript/${name}.json`,
8682
+ JSON.stringify(event)
8683
+ );
8684
+ },
8685
+ },
8686
+ });
8687
+ ```
8688
+
8689
+ ### Keep derived state across a replace
8690
+
8691
+ Write it to `ctx.host.kv` under a session-prefixed key; a tool reads it
8692
+ back with `ctx.host.kv.get`.
8693
+
8694
+ ```ts
8695
+ // agent/hooks/last-result.ts
8696
+ import { defineHook } from "@cursor/july/hooks";
8697
+
8698
+ export default defineHook({
8699
+ events: {
8700
+ async "turn.completed"(event, ctx) {
8701
+ await ctx.host.kv.put(`last-result/${ctx.session.id}`, {
8702
+ at: event.at,
8703
+ result: event.data.result ?? null,
8704
+ });
8705
+ },
8706
+ },
8707
+ });
8708
+ ```
8709
+
8710
+ ## Test and debug a hook
8711
+
8712
+ A hook definition is a plain object, so a unit test calls
8713
+ `hook.events["turn.completed"]` directly with an event and a stub
8714
+ `HookContext`. Discovery skips `*.test.ts`, so the test can live next to
8715
+ the hook.
8716
+
8717
+ At runtime:
8718
+
8719
+ - `agent-sdk validate --dir .` reports discovery errors and the
8720
+ empty-handlers warning.
8721
+ - `agent-sdk info --dir . --json` lists the loaded hooks under
8722
+ `agents[].hooks`.
8723
+ - Send a turn with `agent-sdk dev` or `agent-sdk run --dir . --message "…"`
8724
+ and watch the serve log for
8725
+ `hook "<name>" handler for <event> threw: …`. `run` prints that log on
8726
+ stderr. On hosting, read it with [`agent-sdk logs`](/docs/reference/cli.md#logs).
8187
8727
 
8188
8728
  ## What's next
8189
8729
 
8190
8730
  Continue with these pages:
8191
8731
 
8732
+ - [Turn result](/docs/reference/result.md): fail a turn from `commit`, not from a hook
8192
8733
  - [Sessions and streaming](/docs/reference/sessions.md): the event vocabulary hooks observe
8734
+ - [Storage](/docs/storage.md): where `ctx.host.kv` and `ctx.host.files` live
8193
8735
  - [OpenTelemetry](/docs/guides/opentelemetry.md): OTLP traces and metrics
8194
8736
  from the same event stream
8195
8737
  - [Deployment](/docs/deployment.md#observability): runtime logs and export
@@ -8572,6 +9114,9 @@ Use the playground to chat, try channel routes, and inspect sessions.
8572
9114
  `/v1/dev/evals`). Schedule hand-dispatch still requires `--dev`.
8573
9115
  - **The surface**: inspect the discovered tools, skills, subagents, MCP
8574
9116
  connections, channels, and hooks.
9117
+ - **Custom tool chips**: drop `agent/playground/tools/<toolName>.tsx` to
9118
+ change how that tool renders. Chips compile from the agent tree;
9119
+ an [extension](/docs/reference/extensions.md) cannot contribute them.
8575
9120
  - **Raw events pane**: flip it on to inspect the event stream.
8576
9121
  - **Logs tab**: recent server log lines, polled from `GET /v1/logs`.
8577
9122
  - **A/Bs tab**: per-session and aggregate
@@ -8623,7 +9168,7 @@ experiments can override their file-derived name.
8623
9168
  | `agent/host-connections/anytool.ts` | Host MCP connection `anytool` (host + `mcp oauth` only) |
8624
9169
  | `agent/skills/pr-review.md` | skill `pr-review` |
8625
9170
  | `agent/subagents/reviewer/` | subagent `reviewer` |
8626
- | `agent/extensions/ci.ts` | extension mount `ci`; its tools and skills become `ci__<name>` |
9171
+ | `agent/extensions/ci.ts` | extension mount `ci`; its contributions become `ci__<name>` |
8627
9172
  | `agent/extensions/notion.ts` | Cursor plugin mount `notion` (`cursorPlugin`); its skills, agents, and MCP servers become `notion__<name>` |
8628
9173
  | `agent/channels/drive.ts` | channel `drive`, routes under `/v1/channels/drive` |
8629
9174
  | `agent/ab.ts` | A/B experiment `ab` unless `name` overrides it |
@@ -8683,6 +9228,7 @@ Each path maps to a capability and a reference page.
8683
9228
  | `agent/ab.config.ts` | `defineABConfig` shared A/B settings | [Live A/B metrics](/docs/ab.md) |
8684
9229
  | `agent/storage.ts` | `defineStorage` backend for the durable `host.kv` / `host.files` APIs | [Storage](/docs/storage.md) |
8685
9230
  | `agent/artifacts.ts` | `defineArtifacts` kinds, the `tag_artifact` opt-in, and retention | [Artifacts](/docs/reference/artifacts.md) |
9231
+ | `agent/result.ts` | `defineResult` host `commit` on the final assistant text | [Turn result](/docs/reference/result.md) |
8686
9232
  | `agent/schedules/*` | Cron-driven runs (UTC, 5-field; never auto-fire under `--dev`) | [Schedules](/docs/reference/schedules.md) |
8687
9233
  | `agent/sandbox/workspace/**` | Seed files copied into each local session workspace | [Sessions](/docs/reference/sessions.md#what-goes-into-a-local-session-workspace) |
8688
9234
  | `agent/playground/` | Custom playground tool chips | [Playground](/docs/reference/playground.md) |
@@ -8769,6 +9315,100 @@ context: prompt.lines`
8769
9315
 
8770
9316
  ---
8771
9317
 
9318
+ Source: /docs/reference/result.md
9319
+
9320
+ # Turn result
9321
+
9322
+ Judgment agents need a place to act on the model's last message: parse
9323
+ it, then page, comment, or close a ticket. Author `agent/result.ts`
9324
+ with `defineResult` from `@cursor/july/result`. When that file exists,
9325
+ every finished turn runs `commit` on the serving host with the full
9326
+ assistant text.
9327
+
9328
+ A thrown `commit` fails the turn. Empty assistant text fails it too.
9329
+ Hooks still observe only; they cannot fail a valid turn.
9330
+
9331
+ Use this for an end-of-turn actuation. Mid-turn actions belong in
9332
+ [tools](/docs/reference/tools.md). Durable records that outlive a session belong in
9333
+ [artifacts](/docs/reference/artifacts.md).
9334
+
9335
+ ## Author `agent/result.ts`
9336
+
9337
+ ```ts
9338
+ import { defineResult } from "@cursor/july/result";
9339
+ import { applyDecision, parseDecision } from "./lib/actuate.js";
9340
+
9341
+ export default defineResult({
9342
+ async commit(ctx) {
9343
+ if (ctx.session.purpose === "eval") {
9344
+ return;
9345
+ }
9346
+ await applyDecision(parseDecision(ctx.text), ctx.host);
9347
+ },
9348
+ });
9349
+ ```
9350
+
9351
+ `commit` is required. Parse `ctx.text` however the agent needs. Tell
9352
+ the model the document shape in `instructions.md`. The Agent SDK does
9353
+ not inject a schema.
9354
+
9355
+ Put `result.ts` on the root agent only. A copy under a subagent is
9356
+ ignored with a warning.
9357
+
9358
+ ## Commit on the host
9359
+
9360
+ `commit` runs in the serving process after the model finishes, before
9361
+ the turn completes. `ctx` is the same host surface a server tool gets,
9362
+ plus the turn text:
9363
+
9364
+ | Member | What it is |
9365
+ | --- | --- |
9366
+ | `ctx.session` | The session that produced this turn, including `purpose` |
9367
+ | `ctx.host` | Shared host services (`kv`, `files`, `mcp`) |
9368
+ | `ctx.artifacts` | Session-bound [artifacts](/docs/reference/artifacts.md) facade |
9369
+ | `ctx.stateRoot` | The agent's durable state root |
9370
+ | `ctx.workspaceDir` | The session workspace |
9371
+ | `ctx.text` | The full assistant string |
9372
+
9373
+ A dry-run session skips `commit` and still completes. Eval sessions do
9374
+ run `commit`; return early when `ctx.session.purpose === "eval"` if the
9375
+ handler must not actuate.
9376
+
9377
+ On cloud runtime, the model still runs on the VM. `commit` runs on the
9378
+ serving host after the turn returns.
9379
+
9380
+ `GET /v1/info` reports `result: true` when the file is authored.
9381
+
9382
+ ## Assert in evals
9383
+
9384
+ `t.succeeded()` fails when `commit` throws or the turn produced no
9385
+ text, because those are turn failures. Read the document on `t.reply`.
9386
+
9387
+ ```ts
9388
+ import { defineEval, includes } from "@cursor/july/evals";
9389
+
9390
+ export default defineEval({
9391
+ async test(t) {
9392
+ await t.send("Triage LIN-1842. It duplicates LIN-1801.");
9393
+ t.succeeded();
9394
+ t.check(t.reply, includes("duplicate"));
9395
+ },
9396
+ });
9397
+ ```
9398
+
9399
+ ## What's next
9400
+
9401
+ Continue with these pages:
9402
+
9403
+ - [Evals](/docs/evals.md): `t.succeeded` and `t.reply`
9404
+ - [Sessions and streaming](/docs/reference/sessions.md): `turn.completed` and
9405
+ `turn.failed`
9406
+ - [Hooks](/docs/reference/hooks.md): observe the stream after the turn has already
9407
+ settled
9408
+ - [Project layout](/docs/reference/project-layout.md): where `agent/result.ts` lives
9409
+
9410
+ ---
9411
+
8772
9412
  Source: /docs/reference/schedules.md
8773
9413
 
8774
9414
  # Schedules and reminders
@@ -9081,7 +9721,9 @@ within one session. The `at` field is an ISO-8601 timestamp.
9081
9721
 
9082
9722
  Pair `actions.requested` with `action.result` to reconstruct the tool
9083
9723
  trajectory. Read `turn.completed.data.usage` for input, output, and
9084
- cache token counts.
9724
+ cache token counts. When `agent/result.ts` is authored, a thrown
9725
+ `commit` or empty assistant text emits `turn.failed` instead of
9726
+ `turn.completed`. See [Turn result](/docs/reference/result.md).
9085
9727
 
9086
9728
  ## How do I stream or replay session events?
9087
9729
 
@@ -9338,8 +9980,7 @@ access to `process.env` and your `agent/lib/` code. Local turns call
9338
9980
  server tools as SDK custom tools. Cloud turns reach them over
9339
9981
  authenticated HTTP MCP back to the serve host when `--public-url` or
9340
9982
  `--cloud-tools-url` is set; without either, the server warns at startup
9341
- and cloud turns omit them (see
9342
- [Cloud runtime](/docs/guides/cloud-runtime.md#what-changes-on-cloud)).
9983
+ and cloud turns omit them.
9343
9984
 
9344
9985
  ```ts
9345
9986
  // agent/tools/inspect_pr.ts
@@ -10207,9 +10848,11 @@ Path is identity. Full list: README "Folder structure".
10207
10848
  | `agent/mcp-connections/<name>.ts` | MCP. Never name an account file `cursor.ts`. `advertiseTools: true` for named local tools |
10208
10849
  | `agent/host-connections/<name>.ts` | Privileged MCP for `ctx.host.mcp` / `mcp oauth` |
10209
10850
  | `agent/subagents/<id>/` | Child agent (`description` required) |
10210
- | `agent/extensions/<ns>.ts` | Mounted extension or Cursor plugin (`cursorPlugin({ path })`); contributions are `<ns>__<name>` |
10851
+ | `agent/extensions/<ns>.ts` | Mounted extension or Cursor plugin (`cursorPlugin`); contributions are `<ns>__<name>` |
10211
10852
  | `agent/channels/*.ts` | Slack / GitHub / custom HTTP |
10212
10853
  | `agent/hooks/*.ts` | Observe-only |
10854
+ | `agent/artifacts.ts` | Durable tagged outputs (`defineArtifacts`) |
10855
+ | `agent/result.ts` | Host `commit` on the final assistant text (`defineResult`) |
10213
10856
  | `agent/ab.ts` or `agent/ab/*.ts` | Live A/B (`defineAB`) |
10214
10857
  | `agent/otel.ts` | OpenTelemetry (`defineOtel`) |
10215
10858
  | `agent/schedules/*` | Cron. Never auto-fire under `--dev` |
@@ -10563,9 +11206,13 @@ export default defineOtel({
10563
11206
  3. `serve(dir, { otel: { … } })`. `otel: false` disables env and
10564
11207
  authored config.
10565
11208
 
11209
+ Hosted v2 secrets arrive after bake. Use `defineOtel(() => …)` so flush
11210
+ re-resolves exporters. Authored `agent/otel.ts` records from process
11211
+ start even when the factory returns no exporters yet.
11212
+
10566
11213
  | Signal | Default |
10567
11214
  | --- | --- |
10568
- | Traces | on (`agent_sdk.http` → session → turn → tool / subagent) |
11215
+ | Traces | on (`agent_sdk.http`; `agent_sdk.turn` → tool / subagent) |
10569
11216
  | Metrics | on (`cursor.token.usage`, `cursor.tool.calls`, `cursor.cost.usage`) |
10570
11217
  | Logs | off (`logs: true` or `OTEL_LOGS_EXPORTER=otlp`) |
10571
11218
 
@@ -10581,8 +11228,9 @@ ctx.host.otel.record("abc.approval.duration_ms", 1420);
10581
11228
  ```
10582
11229
 
10583
11230
  Prefix names with team or agent. No custom spans. Join on
10584
- `cursor.conversation.id` and `agent_sdk.agent`. Run `serve` as its
10585
- own process when Agent SDK should own the destination.
11231
+ `agent_sdk.session_id` / `cursor.conversation.id` and
11232
+ `agent_sdk.agent`. Run `serve` as its own process when Agent SDK
11233
+ should own the destination.
10586
11234
 
10587
11235
  ---
10588
11236
 
@@ -11424,9 +12072,6 @@ Run it from the agent's git checkout. It infers repository, ref, path,
11424
12072
  and slug, builds on Cursor-managed hosting, and prints the URL.
11425
12073
  `agent-sdk deployments` shows status.
11426
12074
 
11427
- See [Cloud runtime](/docs/guides/cloud-runtime.md) for what changes on
11428
- the VM.
11429
-
11430
12075
  ---
11431
12076
 
11432
12077
  Source: /docs/templates/security-help.md