@cursor/july 0.1.101 → 0.1.103

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 (862) hide show
  1. package/AGENTS.md +34 -32
  2. package/README.md +28 -3
  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/deployments/deployments-channel.d.ts +22 -14
  44. package/dist/channels/deployments/deployments-channel.d.ts.map +1 -1
  45. package/dist/channels/deployments/deployments-channel.js +25 -27
  46. package/dist/channels/deployments/types.d.ts +12 -6
  47. package/dist/channels/deployments/types.d.ts.map +1 -1
  48. package/dist/channels/github/binding.d.ts +6 -0
  49. package/dist/channels/github/binding.d.ts.map +1 -1
  50. package/dist/channels/github/binding.js +3 -3
  51. package/dist/channels/github/cursor-account.d.ts +7 -3
  52. package/dist/channels/github/cursor-account.d.ts.map +1 -1
  53. package/dist/channels/github/cursor-account.js +10 -6
  54. package/dist/channels/github/events.d.ts +1 -1
  55. package/dist/channels/github/events.js +1 -1
  56. package/dist/channels/github/forward.d.ts +1 -1
  57. package/dist/channels/github/forward.d.ts.map +1 -1
  58. package/dist/channels/github/forward.js +3 -2
  59. package/dist/channels/github/github-channel.d.ts +29 -39
  60. package/dist/channels/github/github-channel.d.ts.map +1 -1
  61. package/dist/channels/github/github-channel.js +68 -101
  62. package/dist/channels/github/replay.d.ts +1 -1
  63. package/dist/channels/github/replay.js +1 -1
  64. package/dist/channels/github/state.d.ts +2 -0
  65. package/dist/channels/github/state.d.ts.map +1 -1
  66. package/dist/channels/github/state.js +14 -11
  67. package/dist/channels/github/types.d.ts +2 -4
  68. package/dist/channels/github/types.d.ts.map +1 -1
  69. package/dist/channels/gitlab/api.d.ts +91 -0
  70. package/dist/channels/gitlab/api.d.ts.map +1 -0
  71. package/dist/channels/gitlab/api.js +150 -0
  72. package/dist/channels/gitlab/binding.d.ts +58 -0
  73. package/dist/channels/gitlab/binding.d.ts.map +1 -0
  74. package/dist/channels/gitlab/binding.js +139 -0
  75. package/dist/channels/gitlab/checks.d.ts +110 -0
  76. package/dist/channels/gitlab/checks.d.ts.map +1 -0
  77. package/dist/channels/gitlab/checks.js +126 -0
  78. package/dist/channels/gitlab/cursor-account.d.ts +36 -0
  79. package/dist/channels/gitlab/cursor-account.d.ts.map +1 -0
  80. package/dist/channels/gitlab/cursor-account.js +65 -0
  81. package/dist/channels/gitlab/defaults.d.ts +25 -0
  82. package/dist/channels/gitlab/defaults.d.ts.map +1 -0
  83. package/dist/channels/gitlab/defaults.js +60 -0
  84. package/dist/channels/gitlab/events.d.ts +12 -0
  85. package/dist/channels/gitlab/events.d.ts.map +1 -0
  86. package/dist/channels/gitlab/events.js +28 -0
  87. package/dist/channels/gitlab/gitlab-channel.d.ts +33 -0
  88. package/dist/channels/gitlab/gitlab-channel.d.ts.map +1 -0
  89. package/dist/channels/gitlab/gitlab-channel.js +120 -0
  90. package/dist/channels/gitlab/gitlab-webhook.d.ts +45 -0
  91. package/dist/channels/gitlab/gitlab-webhook.d.ts.map +1 -0
  92. package/dist/channels/gitlab/gitlab-webhook.js +397 -0
  93. package/dist/channels/gitlab/index.d.ts +31 -0
  94. package/dist/channels/gitlab/index.d.ts.map +1 -0
  95. package/dist/channels/gitlab/index.js +30 -0
  96. package/dist/channels/gitlab/replay.d.ts +105 -0
  97. package/dist/channels/gitlab/replay.d.ts.map +1 -0
  98. package/dist/channels/gitlab/replay.js +206 -0
  99. package/dist/channels/gitlab/state.d.ts +33 -0
  100. package/dist/channels/gitlab/state.d.ts.map +1 -0
  101. package/dist/channels/gitlab/state.js +23 -0
  102. package/dist/channels/gitlab/types.d.ts +214 -0
  103. package/dist/channels/gitlab/types.d.ts.map +1 -0
  104. package/dist/channels/gitlab/types.js +1 -0
  105. package/dist/channels/origin/api.d.ts.map +1 -1
  106. package/dist/channels/origin/api.js +4 -2
  107. package/dist/channels/origin/origin-channel.d.ts +4 -9
  108. package/dist/channels/origin/origin-channel.d.ts.map +1 -1
  109. package/dist/channels/origin/origin-channel.js +8 -48
  110. package/dist/channels/origin/types.d.ts +20 -2
  111. package/dist/channels/origin/types.d.ts.map +1 -1
  112. package/dist/channels/slack/api.d.ts +1 -1
  113. package/dist/channels/slack/api.d.ts.map +1 -1
  114. package/dist/channels/slack/api.js +3 -1
  115. package/dist/channels/slack/assistant.d.ts +1 -1
  116. package/dist/channels/slack/assistant.d.ts.map +1 -1
  117. package/dist/channels/slack/dispatch.d.ts +3 -2
  118. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  119. package/dist/channels/slack/dispatch.js +28 -8
  120. package/dist/channels/slack/eval-directive.d.ts.map +1 -1
  121. package/dist/channels/slack/eval-directive.js +1 -7
  122. package/dist/channels/slack/inbound.d.ts +8 -0
  123. package/dist/channels/slack/inbound.d.ts.map +1 -1
  124. package/dist/channels/slack/inbound.js +28 -0
  125. package/dist/channels/slack/init.d.ts.map +1 -1
  126. package/dist/channels/slack/init.js +3 -3
  127. package/dist/channels/slack/manifest.d.ts.map +1 -1
  128. package/dist/channels/slack/manifest.js +2 -1
  129. package/dist/channels/slack/setup.d.ts +1 -1
  130. package/dist/channels/slack/setup.d.ts.map +1 -1
  131. package/dist/channels/slack/setup.js +6 -13
  132. package/dist/channels/slack/types.d.ts +1 -1
  133. package/dist/channels/slack/types.d.ts.map +1 -1
  134. package/dist/channels.d.ts +1 -1
  135. package/dist/channels.d.ts.map +1 -1
  136. package/dist/client.d.ts +1 -1
  137. package/dist/client.js +1 -1
  138. package/dist/connections.d.ts +1 -1
  139. package/dist/connections.js +1 -1
  140. package/dist/docs/404.html +2 -2
  141. package/dist/docs/ab.html +4 -4
  142. package/dist/docs/assets/{app.BASO9Kih.js → app.DW9pXkpL.js} +1 -1
  143. package/dist/docs/assets/chunks/@localSearchIndexroot.nrl1ifBq.js +1 -0
  144. package/dist/docs/assets/chunks/{VPLocalSearchBox.DwkqxoE0.js → VPLocalSearchBox.CdEIUwDg.js} +1 -1
  145. package/dist/docs/assets/chunks/{theme.CCil_13e.js → theme.YZMHgPgg.js} +2 -2
  146. package/dist/docs/assets/{concepts.md.lwAgBIMI.js → concepts.md.DgEcZOfT.js} +1 -1
  147. package/dist/docs/assets/{concepts.md.lwAgBIMI.lean.js → concepts.md.DgEcZOfT.lean.js} +1 -1
  148. package/dist/docs/assets/{evals.md.CPzDAwoH.js → evals.md.CbMoebP1.js} +1 -1
  149. package/dist/docs/assets/guides_cloud-agents.md.DS8RIjwx.js +9 -0
  150. package/dist/docs/assets/guides_cloud-agents.md.DS8RIjwx.lean.js +1 -0
  151. package/dist/docs/assets/{guides_github.md.BtPr9GaP.js → guides_github.md.DKYiT9do.js} +1 -1
  152. package/dist/docs/assets/{guides_opentelemetry.md.BVTXDCRg.js → guides_opentelemetry.md.COh9jFVg.js} +7 -8
  153. package/dist/docs/assets/{guides_opentelemetry.md.BVTXDCRg.lean.js → guides_opentelemetry.md.COh9jFVg.lean.js} +1 -1
  154. package/dist/docs/assets/index.md.D75GWhPl.js +5 -0
  155. package/dist/docs/assets/{index.md.Bb4k8kUm.lean.js → index.md.D75GWhPl.lean.js} +1 -1
  156. package/dist/docs/assets/{reference_agent-config.md.BHeYMgme.js → reference_agent-config.md.CHNpiyp4.js} +3 -3
  157. package/dist/docs/assets/{reference_channels.md.Cd2f2iyV.js → reference_channels.md.Dz8Cnudp.js} +2 -2
  158. package/dist/docs/assets/{reference_channels.md.Cd2f2iyV.lean.js → reference_channels.md.Dz8Cnudp.lean.js} +1 -1
  159. package/dist/docs/assets/{reference_cli.md.DfoeyvL0.js → reference_cli.md.CJNc_xYK.js} +1 -1
  160. package/dist/docs/assets/reference_extensions.md.DykHW3qL.js +62 -0
  161. package/dist/docs/assets/reference_extensions.md.DykHW3qL.lean.js +1 -0
  162. package/dist/docs/assets/reference_hooks.md.Ddt5DdgJ.js +73 -0
  163. package/dist/docs/assets/{reference_hooks.md.a8BJxMR5.lean.js → reference_hooks.md.Ddt5DdgJ.lean.js} +1 -1
  164. package/dist/docs/assets/{reference_playground.md.DnX5nL-B.js → reference_playground.md.4myJPxrf.js} +1 -1
  165. package/dist/docs/assets/{reference_project-layout.md.Bv4KOtlB.js → reference_project-layout.md.DuBu9a96.js} +2 -2
  166. package/dist/docs/assets/{reference_project-layout.md.Bv4KOtlB.lean.js → reference_project-layout.md.DuBu9a96.lean.js} +1 -1
  167. package/dist/docs/assets/reference_result.md.BK5SxDrf.js +19 -0
  168. package/dist/docs/assets/reference_result.md.BK5SxDrf.lean.js +1 -0
  169. package/dist/docs/assets/{reference_sessions.md.NxFP_CAC.js → reference_sessions.md.CueyOHSL.js} +1 -1
  170. package/dist/docs/assets/{reference_sessions.md.NxFP_CAC.lean.js → reference_sessions.md.CueyOHSL.lean.js} +1 -1
  171. package/dist/docs/assets/{reference_skills.md.BFW9retM.js → reference_skills.md.l2ezAcaN.js} +1 -1
  172. package/dist/docs/assets/{reference_tools.md.CvAHsdSp.js → reference_tools.md.aGrn99hP.js} +2 -2
  173. package/dist/docs/assets/skills_framework-map.md.haibFyoB.js +1 -0
  174. package/dist/docs/assets/{skills_framework-map.md.BTi817yv.lean.js → skills_framework-map.md.haibFyoB.lean.js} +1 -1
  175. package/dist/docs/assets/{skills_otel.md.CgiZryR3.js → skills_otel.md.CqhobH3B.js} +3 -3
  176. package/dist/docs/assets/{skills_otel.md.CgiZryR3.lean.js → skills_otel.md.CqhobH3B.lean.js} +1 -1
  177. package/dist/docs/assets/{templates_pr-autofixer.md.x5zl6-GT.js → templates_pr-autofixer.md.Bds_XWcV.js} +2 -2
  178. package/dist/docs/assets/{templates_pr-autofixer.md.x5zl6-GT.lean.js → templates_pr-autofixer.md.Bds_XWcV.lean.js} +1 -1
  179. package/dist/docs/building-with-agents.html +4 -4
  180. package/dist/docs/concepts.html +5 -5
  181. package/dist/docs/concepts.md +5 -7
  182. package/dist/docs/deployment.html +4 -4
  183. package/dist/docs/design/runtime-abstraction.md +2 -3
  184. package/dist/docs/evals.html +6 -6
  185. package/dist/docs/evals.md +9 -7
  186. package/dist/docs/guides/agent-to-agent.html +4 -4
  187. package/dist/docs/guides/cloud-agents.html +35 -0
  188. package/dist/docs/guides/cloud-agents.md +91 -0
  189. package/dist/docs/guides/convert-automation.html +4 -4
  190. package/dist/docs/guides/github.html +6 -6
  191. package/dist/docs/guides/github.md +0 -1
  192. package/dist/docs/guides/human-in-the-loop.html +4 -4
  193. package/dist/docs/guides/mcp-oauth.html +5 -5
  194. package/dist/docs/guides/opentelemetry.html +11 -12
  195. package/dist/docs/guides/opentelemetry.md +41 -17
  196. package/dist/docs/guides/slack.html +4 -4
  197. package/dist/docs/guides/webhooks.html +4 -4
  198. package/dist/docs/hashmap.json +1 -1
  199. package/dist/docs/hillclimbing.html +4 -4
  200. package/dist/docs/index.html +6 -6
  201. package/dist/docs/index.md +7 -3
  202. package/dist/docs/llms-full.txt +765 -209
  203. package/dist/docs/llms.txt +3 -1
  204. package/dist/docs/quickstart.html +4 -4
  205. package/dist/docs/reference/agent-config.html +8 -8
  206. package/dist/docs/reference/agent-config.md +6 -10
  207. package/dist/docs/reference/artifacts.html +5 -5
  208. package/dist/docs/reference/channels.html +6 -6
  209. package/dist/docs/reference/channels.md +18 -8
  210. package/dist/docs/reference/cli.html +5 -5
  211. package/dist/docs/reference/cli.md +3 -4
  212. package/dist/docs/reference/connections.html +4 -4
  213. package/dist/docs/reference/extensions.html +88 -0
  214. package/dist/docs/reference/extensions.md +264 -0
  215. package/dist/docs/reference/hooks.html +69 -10
  216. package/dist/docs/reference/hooks.md +215 -46
  217. package/dist/docs/reference/http-api.html +4 -4
  218. package/dist/docs/reference/instructions.html +4 -4
  219. package/dist/docs/reference/playground.html +5 -5
  220. package/dist/docs/reference/playground.md +3 -0
  221. package/dist/docs/reference/project-layout.html +6 -6
  222. package/dist/docs/reference/project-layout.md +4 -0
  223. package/dist/docs/reference/prompt.html +4 -4
  224. package/dist/docs/reference/result.html +45 -0
  225. package/dist/docs/reference/result.md +89 -0
  226. package/dist/docs/reference/schedules.html +4 -4
  227. package/dist/docs/reference/sessions.html +5 -5
  228. package/dist/docs/reference/sessions.md +3 -1
  229. package/dist/docs/reference/skills.html +6 -6
  230. package/dist/docs/reference/skills.md +2 -0
  231. package/dist/docs/reference/subagents.html +5 -5
  232. package/dist/docs/reference/tools.html +6 -6
  233. package/dist/docs/reference/tools.md +3 -2
  234. package/dist/docs/scaffolding-agents.html +4 -4
  235. package/dist/docs/skills/ab.html +4 -4
  236. package/dist/docs/skills/create-agent.html +4 -4
  237. package/dist/docs/skills/debug.html +4 -4
  238. package/dist/docs/skills/evals.html +4 -4
  239. package/dist/docs/skills/framework-map.html +5 -5
  240. package/dist/docs/skills/framework-map.md +3 -0
  241. package/dist/docs/skills/github.html +4 -4
  242. package/dist/docs/skills/hillclimb.html +4 -4
  243. package/dist/docs/skills/index.html +4 -4
  244. package/dist/docs/skills/mcp-auth.html +4 -4
  245. package/dist/docs/skills/otel.html +7 -7
  246. package/dist/docs/skills/otel.md +8 -3
  247. package/dist/docs/skills/setup-slack.html +4 -4
  248. package/dist/docs/storage.html +4 -4
  249. package/dist/docs/templates/agentic-owners.html +4 -4
  250. package/dist/docs/templates/agents-md.html +4 -4
  251. package/dist/docs/templates/code-wiki.html +4 -4
  252. package/dist/docs/templates/demo.html +4 -4
  253. package/dist/docs/templates/pr-autofixer.html +6 -6
  254. package/dist/docs/templates/pr-autofixer.md +0 -3
  255. package/dist/docs/templates/security-help.html +4 -4
  256. package/dist/docs/templates/security-reviewer.html +4 -4
  257. package/dist/docs/templates/triage.html +4 -4
  258. package/dist/docs/troubleshooting.html +4 -4
  259. package/dist/evals.d.ts +1 -1
  260. package/dist/evals.d.ts.map +1 -1
  261. package/dist/extensions/cursor-cloud-agents/extension.d.ts +9 -7
  262. package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -1
  263. package/dist/extensions/cursor-cloud-agents/extension.js +9 -7
  264. package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts +78 -0
  265. package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts.map +1 -0
  266. package/dist/extensions/cursor-cloud-agents/lib/backend.js +286 -0
  267. package/dist/extensions/cursor-cloud-agents/lib/inputs.d.ts +5 -0
  268. package/dist/extensions/cursor-cloud-agents/lib/inputs.d.ts.map +1 -0
  269. package/dist/extensions/cursor-cloud-agents/lib/inputs.js +4 -0
  270. package/dist/extensions/cursor-cloud-agents/lib/transcript.d.ts +8 -0
  271. package/dist/extensions/cursor-cloud-agents/lib/transcript.d.ts.map +1 -0
  272. package/dist/extensions/cursor-cloud-agents/lib/transcript.js +15 -0
  273. package/dist/extensions/cursor-cloud-agents/skills/handoff.md +21 -7
  274. package/dist/extensions/cursor-cloud-agents/tools/cancel.d.ts +4 -0
  275. package/dist/extensions/cursor-cloud-agents/tools/cancel.d.ts.map +1 -0
  276. package/dist/extensions/cursor-cloud-agents/tools/cancel.js +26 -0
  277. package/dist/extensions/cursor-cloud-agents/tools/dump.d.ts +4 -0
  278. package/dist/extensions/cursor-cloud-agents/tools/dump.d.ts.map +1 -0
  279. package/dist/extensions/cursor-cloud-agents/tools/dump.js +54 -0
  280. package/dist/extensions/cursor-cloud-agents/tools/get.d.ts +4 -0
  281. package/dist/extensions/cursor-cloud-agents/tools/get.d.ts.map +1 -0
  282. package/dist/extensions/cursor-cloud-agents/tools/get.js +25 -0
  283. package/dist/extensions/cursor-cloud-agents/tools/launch.d.ts.map +1 -1
  284. package/dist/extensions/cursor-cloud-agents/tools/launch.js +14 -38
  285. package/dist/extensions/cursor-cloud-agents/tools/list.js +1 -1
  286. package/dist/extensions/cursor-cloud-agents/tools/reply.d.ts +4 -0
  287. package/dist/extensions/cursor-cloud-agents/tools/reply.d.ts.map +1 -0
  288. package/dist/extensions/cursor-cloud-agents/tools/{follow_up.js → reply.js} +12 -14
  289. package/dist/extensions.d.ts +54 -17
  290. package/dist/extensions.d.ts.map +1 -1
  291. package/dist/extensions.js +83 -15
  292. package/dist/files-backends/cursor-hosted.d.ts +0 -8
  293. package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
  294. package/dist/files-backends/cursor-hosted.js +1 -11
  295. package/dist/files.d.ts +21 -4
  296. package/dist/files.d.ts.map +1 -1
  297. package/dist/files.js +38 -21
  298. package/dist/index.d.ts +6 -6
  299. package/dist/index.d.ts.map +1 -1
  300. package/dist/index.js +4 -4
  301. package/dist/internal/ab-snapshot.d.ts.map +1 -1
  302. package/dist/internal/ab-snapshot.js +0 -1
  303. package/dist/internal/advertise-tools.d.ts.map +1 -1
  304. package/dist/internal/advertise-tools.js +1 -3
  305. package/dist/internal/authored-alias-hooks.d.ts +4 -13
  306. package/dist/internal/authored-alias-hooks.d.ts.map +1 -1
  307. package/dist/internal/authored-alias-hooks.js +4 -20
  308. package/dist/internal/authored-loaders.d.ts +2 -3
  309. package/dist/internal/authored-loaders.d.ts.map +1 -1
  310. package/dist/internal/authored-loaders.js +6 -20
  311. package/dist/internal/channel-dispatch.d.ts +43 -0
  312. package/dist/internal/channel-dispatch.d.ts.map +1 -0
  313. package/dist/internal/channel-dispatch.js +77 -0
  314. package/dist/internal/chat-client.d.ts +1 -1
  315. package/dist/internal/chat-client.js +1 -1
  316. package/dist/internal/cli-ax.d.ts +5 -5
  317. package/dist/internal/cli-ax.d.ts.map +1 -1
  318. package/dist/internal/cli-ax.js +5 -5
  319. package/dist/internal/cli-bitbucket.d.ts +33 -0
  320. package/dist/internal/cli-bitbucket.d.ts.map +1 -0
  321. package/dist/internal/cli-bitbucket.js +359 -0
  322. package/dist/internal/cli-convert-automation.d.ts +1 -1
  323. package/dist/internal/cli-convert-automation.js +2 -2
  324. package/dist/internal/cli-cursor.d.ts +1 -1
  325. package/dist/internal/cli-cursor.d.ts.map +1 -1
  326. package/dist/internal/cli-cursor.js +2 -4
  327. package/dist/internal/cli-deploy.d.ts.map +1 -1
  328. package/dist/internal/cli-deploy.js +2 -6
  329. package/dist/internal/cli-github.d.ts +1 -1
  330. package/dist/internal/cli-github.js +3 -3
  331. package/dist/internal/cli-gitlab.d.ts +37 -0
  332. package/dist/internal/cli-gitlab.d.ts.map +1 -0
  333. package/dist/internal/cli-gitlab.js +380 -0
  334. package/dist/internal/cli-mcp.d.ts.map +1 -1
  335. package/dist/internal/cli-mcp.js +2 -6
  336. package/dist/internal/cli-slack.d.ts +1 -1
  337. package/dist/internal/cli-slack.d.ts.map +1 -1
  338. package/dist/internal/cli-slack.js +2 -4
  339. package/dist/internal/continuation-channel.d.ts +14 -0
  340. package/dist/internal/continuation-channel.d.ts.map +1 -1
  341. package/dist/internal/continuation-channel.js +56 -3
  342. package/dist/internal/continuation-identity.d.ts +14 -15
  343. package/dist/internal/continuation-identity.d.ts.map +1 -1
  344. package/dist/internal/continuation-identity.js +182 -7
  345. package/dist/internal/conversation-mirror.d.ts.map +1 -1
  346. package/dist/internal/conversation-mirror.js +17 -18
  347. package/dist/internal/convert-automation/types.d.ts +1 -1
  348. package/dist/internal/convert-automation/types.js +1 -1
  349. package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
  350. package/dist/internal/cursor/account-mcp.js +1 -3
  351. package/dist/internal/cursor/backend-client.d.ts +13 -5
  352. package/dist/internal/cursor/backend-client.d.ts.map +1 -1
  353. package/dist/internal/cursor/backend-client.js +30 -15
  354. package/dist/internal/cursor/bound-secret-file.d.ts +56 -0
  355. package/dist/internal/cursor/bound-secret-file.d.ts.map +1 -0
  356. package/dist/internal/cursor/bound-secret-file.js +88 -0
  357. package/dist/internal/cursor/credentials.d.ts +39 -5
  358. package/dist/internal/cursor/credentials.d.ts.map +1 -1
  359. package/dist/internal/cursor/credentials.js +58 -8
  360. package/dist/internal/cursor/hosted-bound-secrets.d.ts +41 -0
  361. package/dist/internal/cursor/hosted-bound-secrets.d.ts.map +1 -0
  362. package/dist/internal/cursor/hosted-bound-secrets.js +54 -0
  363. package/dist/internal/cursor/hosted-deployment-secrets.d.ts +19 -5
  364. package/dist/internal/cursor/hosted-deployment-secrets.d.ts.map +1 -1
  365. package/dist/internal/cursor/hosted-deployment-secrets.js +29 -9
  366. package/dist/internal/cursor/hosted-store-secrets.d.ts +12 -1
  367. package/dist/internal/cursor/hosted-store-secrets.d.ts.map +1 -1
  368. package/dist/internal/cursor/hosted-store-secrets.js +16 -1
  369. package/dist/internal/cursor-account-mcp-auth.d.ts.map +1 -1
  370. package/dist/internal/cursor-account-mcp-auth.js +2 -4
  371. package/dist/internal/cursor-deployment-relay.d.ts +6 -2
  372. package/dist/internal/cursor-deployment-relay.d.ts.map +1 -1
  373. package/dist/internal/cursor-deployment-relay.js +13 -9
  374. package/dist/internal/deploy-manifest.d.ts +1 -1
  375. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  376. package/dist/internal/deploy-manifest.js +1 -1
  377. package/dist/internal/discovery/ab.d.ts +9 -0
  378. package/dist/internal/discovery/ab.d.ts.map +1 -0
  379. package/dist/internal/discovery/ab.js +113 -0
  380. package/dist/internal/discovery/agent-config.d.ts +35 -0
  381. package/dist/internal/discovery/agent-config.d.ts.map +1 -0
  382. package/dist/internal/discovery/agent-config.js +173 -0
  383. package/dist/internal/discovery/agent.d.ts +16 -0
  384. package/dist/internal/discovery/agent.d.ts.map +1 -0
  385. package/dist/internal/discovery/agent.js +255 -0
  386. package/dist/internal/discovery/channels.d.ts +10 -0
  387. package/dist/internal/discovery/channels.d.ts.map +1 -0
  388. package/dist/internal/discovery/channels.js +97 -0
  389. package/dist/internal/discovery/connections.d.ts +13 -0
  390. package/dist/internal/discovery/connections.d.ts.map +1 -0
  391. package/dist/internal/discovery/connections.js +422 -0
  392. package/dist/internal/discovery/context.d.ts +20 -0
  393. package/dist/internal/discovery/context.d.ts.map +1 -0
  394. package/dist/internal/discovery/context.js +30 -0
  395. package/dist/internal/discovery/cursor-plugin.d.ts +25 -0
  396. package/dist/internal/discovery/cursor-plugin.d.ts.map +1 -0
  397. package/dist/internal/discovery/cursor-plugin.js +568 -0
  398. package/dist/internal/discovery/extension-overlay.d.ts +32 -0
  399. package/dist/internal/discovery/extension-overlay.d.ts.map +1 -0
  400. package/dist/internal/discovery/extension-overlay.js +191 -0
  401. package/dist/internal/discovery/extensions.d.ts +28 -0
  402. package/dist/internal/discovery/extensions.d.ts.map +1 -0
  403. package/dist/internal/discovery/extensions.js +375 -0
  404. package/dist/internal/discovery/fs.d.ts +15 -0
  405. package/dist/internal/discovery/fs.d.ts.map +1 -0
  406. package/dist/internal/discovery/fs.js +115 -0
  407. package/dist/internal/discovery/hooks.d.ts +7 -0
  408. package/dist/internal/discovery/hooks.d.ts.map +1 -0
  409. package/dist/internal/discovery/hooks.js +61 -0
  410. package/dist/internal/discovery/info.d.ts +6 -0
  411. package/dist/internal/discovery/info.d.ts.map +1 -0
  412. package/dist/internal/discovery/info.js +147 -0
  413. package/dist/internal/discovery/instructions.d.ts +7 -0
  414. package/dist/internal/discovery/instructions.d.ts.map +1 -0
  415. package/dist/internal/discovery/instructions.js +95 -0
  416. package/dist/internal/discovery/modules.d.ts +20 -0
  417. package/dist/internal/discovery/modules.d.ts.map +1 -0
  418. package/dist/internal/discovery/modules.js +107 -0
  419. package/dist/internal/discovery/names.d.ts +12 -0
  420. package/dist/internal/discovery/names.d.ts.map +1 -0
  421. package/dist/internal/discovery/names.js +37 -0
  422. package/dist/internal/discovery/project.d.ts +51 -0
  423. package/dist/internal/discovery/project.d.ts.map +1 -0
  424. package/dist/internal/discovery/project.js +293 -0
  425. package/dist/internal/discovery/runtime.d.ts +34 -0
  426. package/dist/internal/discovery/runtime.d.ts.map +1 -0
  427. package/dist/internal/discovery/runtime.js +97 -0
  428. package/dist/internal/discovery/schedules.d.ts +7 -0
  429. package/dist/internal/discovery/schedules.d.ts.map +1 -0
  430. package/dist/internal/discovery/schedules.js +118 -0
  431. package/dist/internal/discovery/seed-files.d.ts +7 -0
  432. package/dist/internal/discovery/seed-files.d.ts.map +1 -0
  433. package/dist/internal/discovery/seed-files.js +41 -0
  434. package/dist/internal/discovery/services.d.ts +21 -0
  435. package/dist/internal/discovery/services.d.ts.map +1 -0
  436. package/dist/internal/discovery/services.js +134 -0
  437. package/dist/internal/discovery/skills.d.ts +11 -0
  438. package/dist/internal/discovery/skills.d.ts.map +1 -0
  439. package/dist/internal/discovery/skills.js +156 -0
  440. package/dist/internal/discovery/subagent.d.ts +16 -0
  441. package/dist/internal/discovery/subagent.d.ts.map +1 -0
  442. package/dist/internal/discovery/subagent.js +128 -0
  443. package/dist/internal/discovery/tools.d.ts +18 -0
  444. package/dist/internal/discovery/tools.d.ts.map +1 -0
  445. package/dist/internal/discovery/tools.js +159 -0
  446. package/dist/internal/discovery.d.ts +8 -63
  447. package/dist/internal/discovery.d.ts.map +1 -1
  448. package/dist/internal/discovery.js +6 -2504
  449. package/dist/internal/distribution.d.ts +10 -27
  450. package/dist/internal/distribution.d.ts.map +1 -1
  451. package/dist/internal/distribution.js +25 -73
  452. package/dist/internal/docs-site.js +1 -1
  453. package/dist/internal/eval-run-store.d.ts +0 -1
  454. package/dist/internal/eval-run-store.d.ts.map +1 -1
  455. package/dist/internal/eval-runner.d.ts.map +1 -1
  456. package/dist/internal/framework-file-storage.d.ts +8 -0
  457. package/dist/internal/framework-file-storage.d.ts.map +1 -1
  458. package/dist/internal/framework-file-storage.js +14 -14
  459. package/dist/internal/framework-storage-selection.d.ts.map +1 -1
  460. package/dist/internal/framework-storage-selection.js +8 -7
  461. package/dist/internal/frontmatter.d.ts +11 -3
  462. package/dist/internal/frontmatter.d.ts.map +1 -1
  463. package/dist/internal/frontmatter.js +29 -3
  464. package/dist/internal/github-fanout.d.ts +1 -1
  465. package/dist/internal/github-fanout.js +1 -1
  466. package/dist/internal/guest-network.d.ts +101 -0
  467. package/dist/internal/guest-network.d.ts.map +1 -0
  468. package/dist/internal/guest-network.js +304 -0
  469. package/dist/internal/host-otel.d.ts +3 -3
  470. package/dist/internal/host-otel.d.ts.map +1 -1
  471. package/dist/internal/host-otel.js +8 -4
  472. package/dist/internal/hosted-admission-adapter.d.ts +8 -7
  473. package/dist/internal/hosted-admission-adapter.d.ts.map +1 -1
  474. package/dist/internal/hosted-delivery-protocol.d.ts +6 -0
  475. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  476. package/dist/internal/hosted-delivery-protocol.js +18 -5
  477. package/dist/internal/hosted-delivery.d.ts +18 -0
  478. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  479. package/dist/internal/hosted-delivery.js +248 -118
  480. package/dist/internal/http-channel.d.ts.map +1 -1
  481. package/dist/internal/http-channel.js +1 -3
  482. package/dist/internal/init-interview.d.ts.map +1 -1
  483. package/dist/internal/init-interview.js +1 -3
  484. package/dist/internal/init-project.d.ts +2 -2
  485. package/dist/internal/init-project.js +2 -2
  486. package/dist/internal/inline-stdio-define-stub.d.ts +1 -1
  487. package/dist/internal/inline-stdio-define-stub.d.ts.map +1 -1
  488. package/dist/internal/inline-stdio-define-stub.js +1 -1
  489. package/dist/internal/is-record.d.ts +2 -0
  490. package/dist/internal/is-record.d.ts.map +1 -0
  491. package/dist/internal/is-record.js +3 -0
  492. package/dist/internal/json-schema.d.ts.map +1 -1
  493. package/dist/internal/json-schema.js +18 -10
  494. package/dist/internal/local-control-plane.d.ts +1 -2
  495. package/dist/internal/local-control-plane.d.ts.map +1 -1
  496. package/dist/internal/local-control-plane.js +3 -20
  497. package/dist/internal/mcp-endpoint.d.ts.map +1 -1
  498. package/dist/internal/mcp-endpoint.js +1 -3
  499. package/dist/internal/mcp-host.d.ts.map +1 -1
  500. package/dist/internal/mcp-host.js +37 -20
  501. package/dist/internal/otel/collector.d.ts +22 -0
  502. package/dist/internal/otel/collector.d.ts.map +1 -1
  503. package/dist/internal/otel/collector.js +145 -126
  504. package/dist/internal/otel/config.d.ts +0 -2
  505. package/dist/internal/otel/config.d.ts.map +1 -1
  506. package/dist/internal/otel/config.js +17 -20
  507. package/dist/internal/otel/http.d.ts +2 -0
  508. package/dist/internal/otel/http.d.ts.map +1 -1
  509. package/dist/internal/otel/http.js +8 -10
  510. package/dist/internal/otel/mcp.d.ts +16 -0
  511. package/dist/internal/otel/mcp.d.ts.map +1 -0
  512. package/dist/internal/otel/mcp.js +55 -0
  513. package/dist/internal/otel/propagation.d.ts +6 -0
  514. package/dist/internal/otel/propagation.d.ts.map +1 -0
  515. package/dist/internal/otel/propagation.js +14 -0
  516. package/dist/internal/otel/runtime.d.ts +26 -1
  517. package/dist/internal/otel/runtime.d.ts.map +1 -1
  518. package/dist/internal/otel/runtime.js +166 -15
  519. package/dist/internal/package-inline-stdio.d.ts.map +1 -1
  520. package/dist/internal/package-inline-stdio.js +3 -11
  521. package/dist/internal/playground/toolchain.d.ts +1 -1
  522. package/dist/internal/playground/toolchain.d.ts.map +1 -1
  523. package/dist/internal/playground/toolchain.js +1 -1
  524. package/dist/internal/request-error-status.d.ts +12 -0
  525. package/dist/internal/request-error-status.d.ts.map +1 -0
  526. package/dist/internal/request-error-status.js +52 -0
  527. package/dist/internal/resolve-prod-target.d.ts +1 -1
  528. package/dist/internal/resolve-prod-target.d.ts.map +1 -1
  529. package/dist/internal/resolve-prod-target.js +3 -7
  530. package/dist/internal/result-output.d.ts +18 -0
  531. package/dist/internal/result-output.d.ts.map +1 -0
  532. package/dist/internal/result-output.js +33 -0
  533. package/dist/internal/run-client.d.ts +2 -2
  534. package/dist/internal/run-client.js +2 -2
  535. package/dist/internal/runtime-dispatch-runner.d.ts +1 -11
  536. package/dist/internal/runtime-dispatch-runner.d.ts.map +1 -1
  537. package/dist/internal/runtime-dispatch-runner.js +2 -15
  538. package/dist/internal/sdk-runner.d.ts.map +1 -1
  539. package/dist/internal/sdk-runner.js +3 -6
  540. package/dist/internal/server.d.ts.map +1 -1
  541. package/dist/internal/server.js +110 -35
  542. package/dist/internal/session-cost.d.ts +3 -3
  543. package/dist/internal/session-cost.d.ts.map +1 -1
  544. package/dist/internal/session-cost.js +3 -3
  545. package/dist/internal/session-engine.d.ts +31 -11
  546. package/dist/internal/session-engine.d.ts.map +1 -1
  547. package/dist/internal/session-engine.js +208 -102
  548. package/dist/internal/session-run-log.d.ts +2 -1
  549. package/dist/internal/session-run-log.d.ts.map +1 -1
  550. package/dist/internal/session-run-log.js +14 -17
  551. package/dist/internal/skills-sync.d.ts +1 -4
  552. package/dist/internal/skills-sync.d.ts.map +1 -1
  553. package/dist/internal/skills-sync.js +10 -50
  554. package/dist/internal/sleep.d.ts +2 -0
  555. package/dist/internal/sleep.d.ts.map +1 -0
  556. package/dist/internal/sleep.js +3 -0
  557. package/dist/internal/start-log-store.d.ts +1 -1
  558. package/dist/internal/start-log-store.d.ts.map +1 -1
  559. package/dist/internal/start-log-store.js +12 -14
  560. package/dist/internal/storage-coordinator.d.ts +4 -1
  561. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  562. package/dist/internal/storage-coordinator.js +15 -13
  563. package/dist/internal/store-mirror.d.ts +29 -0
  564. package/dist/internal/store-mirror.d.ts.map +1 -0
  565. package/dist/internal/store-mirror.js +70 -0
  566. package/dist/internal/tenant-slack/relay.d.ts +73 -0
  567. package/dist/internal/tenant-slack/relay.d.ts.map +1 -0
  568. package/dist/internal/tenant-slack/relay.js +138 -0
  569. package/dist/internal/testing/scm-continuation-fixtures.d.ts +33 -0
  570. package/dist/internal/testing/scm-continuation-fixtures.d.ts.map +1 -0
  571. package/dist/internal/testing/scm-continuation-fixtures.js +253 -0
  572. package/dist/internal/tool-catalog.d.ts.map +1 -1
  573. package/dist/internal/tool-catalog.js +9 -6
  574. package/dist/internal/turn-cost.d.ts +14 -0
  575. package/dist/internal/turn-cost.d.ts.map +1 -1
  576. package/dist/internal/turn-cost.js +41 -9
  577. package/dist/internal/v2-hosting.d.ts +22 -0
  578. package/dist/internal/v2-hosting.d.ts.map +1 -0
  579. package/dist/internal/v2-hosting.js +23 -0
  580. package/dist/internal/workspace-sync.d.ts +22 -0
  581. package/dist/internal/workspace-sync.d.ts.map +1 -0
  582. package/dist/internal/workspace-sync.js +49 -0
  583. package/dist/internal/workspace.d.ts +7 -0
  584. package/dist/internal/workspace.d.ts.map +1 -1
  585. package/dist/internal/workspace.js +13 -0
  586. package/dist/otel.d.ts +39 -1
  587. package/dist/otel.d.ts.map +1 -1
  588. package/dist/otel.js +118 -1
  589. package/dist/playground/assets/index-59KvgREd.js +67 -0
  590. package/dist/playground/assets/index-MbMxXg-y.css +1 -0
  591. package/dist/playground/index.html +2 -2
  592. package/dist/result.d.ts +24 -0
  593. package/dist/result.d.ts.map +1 -0
  594. package/dist/result.js +27 -0
  595. package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
  596. package/dist/storage-backends/cursor-hosted.js +7 -4
  597. package/dist/storage-protocol.d.ts +24 -23
  598. package/dist/storage-protocol.d.ts.map +1 -1
  599. package/dist/storage-protocol.js +69 -68
  600. package/dist/storage.d.ts +2 -2
  601. package/dist/storage.d.ts.map +1 -1
  602. package/dist/storage.js +1 -1
  603. package/dist/tools.d.ts +9 -0
  604. package/dist/tools.d.ts.map +1 -1
  605. package/dist/tools.js +9 -0
  606. package/dist/types.d.ts +126 -23
  607. package/dist/types.d.ts.map +1 -1
  608. package/docs/README.md +7 -3
  609. package/docs/concepts.md +5 -7
  610. package/docs/design/runtime-abstraction.md +2 -3
  611. package/docs/evals.md +9 -7
  612. package/docs/guides/cloud-agents.md +96 -0
  613. package/docs/guides/github.md +0 -1
  614. package/docs/guides/opentelemetry.md +41 -17
  615. package/docs/reference/agent-config.md +6 -10
  616. package/docs/reference/channels.md +18 -8
  617. package/docs/reference/cli.md +3 -4
  618. package/docs/reference/extensions.md +269 -0
  619. package/docs/reference/hooks.md +215 -46
  620. package/docs/reference/playground.md +3 -0
  621. package/docs/reference/project-layout.md +4 -0
  622. package/docs/reference/result.md +94 -0
  623. package/docs/reference/sessions.md +3 -1
  624. package/docs/reference/skills.md +2 -0
  625. package/docs/reference/tools.md +3 -2
  626. package/docs/templates/pr-autofixer.md +0 -3
  627. package/package.json +29 -10
  628. package/skills/framework-map/SKILL.md +3 -0
  629. package/skills/otel/SKILL.md +8 -3
  630. package/src/ab.ts +1 -1
  631. package/src/bin/agent-serve.ts +121 -21
  632. package/src/channels/bitbucket/api.ts +623 -0
  633. package/src/channels/bitbucket/binding.ts +414 -0
  634. package/src/channels/bitbucket/bitbucket-channel.ts +182 -0
  635. package/src/channels/bitbucket/bitbucket-webhook.ts +576 -0
  636. package/src/channels/bitbucket/checks.ts +154 -0
  637. package/src/channels/bitbucket/cursor-account.ts +117 -0
  638. package/src/channels/bitbucket/defaults.ts +110 -0
  639. package/src/channels/bitbucket/events.ts +84 -0
  640. package/src/channels/bitbucket/index.ts +49 -0
  641. package/src/channels/bitbucket/replay.ts +439 -0
  642. package/src/channels/bitbucket/state.ts +59 -0
  643. package/src/channels/bitbucket/types.ts +266 -0
  644. package/src/channels/deployments/deployments-channel.ts +25 -43
  645. package/src/channels/deployments/types.ts +12 -6
  646. package/src/channels/github/binding.ts +8 -1
  647. package/src/channels/github/cursor-account.ts +17 -6
  648. package/src/channels/github/events.ts +1 -1
  649. package/src/channels/github/forward.ts +3 -2
  650. package/src/channels/github/github-channel.ts +74 -221
  651. package/src/channels/github/replay.ts +1 -1
  652. package/src/channels/github/state.ts +6 -0
  653. package/src/channels/github/types.ts +2 -5
  654. package/src/channels/gitlab/api.ts +228 -0
  655. package/src/channels/gitlab/binding.ts +233 -0
  656. package/src/channels/gitlab/checks.ts +243 -0
  657. package/src/channels/gitlab/cursor-account.ts +114 -0
  658. package/src/channels/gitlab/defaults.ts +93 -0
  659. package/src/channels/gitlab/events.ts +44 -0
  660. package/src/channels/gitlab/gitlab-channel.ts +176 -0
  661. package/src/channels/gitlab/gitlab-webhook.ts +555 -0
  662. package/src/channels/gitlab/index.ts +43 -0
  663. package/src/channels/gitlab/replay.ts +347 -0
  664. package/src/channels/gitlab/state.ts +55 -0
  665. package/src/channels/gitlab/types.ts +263 -0
  666. package/src/channels/origin/api.ts +4 -2
  667. package/src/channels/origin/origin-channel.ts +19 -94
  668. package/src/channels/origin/types.ts +23 -2
  669. package/src/channels/slack/api.ts +4 -2
  670. package/src/channels/slack/assistant.ts +1 -1
  671. package/src/channels/slack/dispatch.ts +27 -2
  672. package/src/channels/slack/eval-directive.ts +1 -6
  673. package/src/channels/slack/inbound.ts +37 -0
  674. package/src/channels/slack/init.ts +6 -3
  675. package/src/channels/slack/manifest.ts +2 -1
  676. package/src/channels/slack/setup.ts +7 -6
  677. package/src/channels/slack/types.ts +1 -1
  678. package/src/channels.ts +0 -1
  679. package/src/client.ts +1 -1
  680. package/src/connections.ts +1 -1
  681. package/src/evals.ts +1 -1
  682. package/src/extensions/cursor-cloud-agents/extension.ts +9 -7
  683. package/src/extensions/cursor-cloud-agents/lib/backend.ts +395 -0
  684. package/src/extensions/cursor-cloud-agents/lib/inputs.ts +5 -0
  685. package/src/extensions/cursor-cloud-agents/lib/transcript.ts +23 -0
  686. package/src/extensions/cursor-cloud-agents/skills/handoff.md +21 -7
  687. package/src/extensions/cursor-cloud-agents/tools/cancel.ts +19 -0
  688. package/src/extensions/cursor-cloud-agents/tools/dump.ts +51 -0
  689. package/src/extensions/cursor-cloud-agents/tools/get.ts +18 -0
  690. package/src/extensions/cursor-cloud-agents/tools/launch.ts +22 -42
  691. package/src/extensions/cursor-cloud-agents/tools/list.ts +1 -1
  692. package/src/extensions/cursor-cloud-agents/tools/reply.ts +34 -0
  693. package/src/extensions.ts +100 -15
  694. package/src/files-backends/cursor-hosted.ts +1 -17
  695. package/src/files.ts +64 -37
  696. package/src/index.ts +27 -26
  697. package/src/internal/ab-snapshot.ts +0 -3
  698. package/src/internal/advertise-tools.ts +1 -4
  699. package/src/internal/authored-alias-hooks.ts +4 -21
  700. package/src/internal/authored-loaders.ts +6 -23
  701. package/src/internal/channel-dispatch.ts +160 -0
  702. package/src/internal/chat-client.ts +1 -1
  703. package/src/internal/cli-ax.ts +5 -5
  704. package/src/internal/cli-bitbucket.ts +477 -0
  705. package/src/internal/cli-convert-automation.ts +7 -7
  706. package/src/internal/cli-cursor.ts +2 -5
  707. package/src/internal/cli-deploy.ts +2 -8
  708. package/src/internal/cli-github.ts +3 -3
  709. package/src/internal/cli-gitlab.ts +485 -0
  710. package/src/internal/cli-mcp.ts +2 -7
  711. package/src/internal/cli-slack.ts +2 -5
  712. package/src/internal/continuation-channel.ts +82 -1
  713. package/src/internal/continuation-identity.ts +229 -11
  714. package/src/internal/conversation-mirror.ts +27 -21
  715. package/src/internal/convert-automation/types.ts +1 -1
  716. package/src/internal/cursor/account-mcp.ts +1 -4
  717. package/src/internal/cursor/backend-client.ts +41 -20
  718. package/src/internal/cursor/bound-secret-file.ts +108 -0
  719. package/src/internal/cursor/credentials.ts +75 -10
  720. package/src/internal/cursor/hosted-bound-secrets.ts +75 -0
  721. package/src/internal/cursor/hosted-deployment-secrets.ts +42 -11
  722. package/src/internal/cursor/hosted-store-secrets.ts +28 -1
  723. package/src/internal/cursor-account-mcp-auth.ts +2 -5
  724. package/src/internal/cursor-deployment-relay.ts +11 -7
  725. package/src/internal/deploy-manifest.ts +4 -2
  726. package/src/internal/discovery/ab.ts +131 -0
  727. package/src/internal/discovery/agent-config.ts +222 -0
  728. package/src/internal/discovery/agent.ts +319 -0
  729. package/src/internal/discovery/channels.ts +105 -0
  730. package/src/internal/discovery/connections.ts +545 -0
  731. package/src/internal/discovery/context.ts +46 -0
  732. package/src/internal/discovery/cursor-plugin.ts +705 -0
  733. package/src/internal/discovery/extension-overlay.ts +274 -0
  734. package/src/internal/discovery/extensions.ts +573 -0
  735. package/src/internal/discovery/fs.ts +108 -0
  736. package/src/internal/discovery/hooks.ts +63 -0
  737. package/src/internal/discovery/info.ts +186 -0
  738. package/src/internal/discovery/instructions.ts +113 -0
  739. package/src/internal/discovery/modules.ts +113 -0
  740. package/src/internal/discovery/names.ts +45 -0
  741. package/src/internal/discovery/project.ts +341 -0
  742. package/src/internal/discovery/runtime.ts +158 -0
  743. package/src/internal/discovery/schedules.ts +120 -0
  744. package/src/internal/discovery/seed-files.ts +37 -0
  745. package/src/internal/discovery/services.ts +160 -0
  746. package/src/internal/discovery/skills.ts +186 -0
  747. package/src/internal/discovery/subagent.ts +136 -0
  748. package/src/internal/discovery/tools.ts +182 -0
  749. package/src/internal/discovery.ts +18 -3081
  750. package/src/internal/distribution.ts +35 -83
  751. package/src/internal/docs-site.ts +1 -1
  752. package/src/internal/eval-run-store.ts +0 -7
  753. package/src/internal/eval-runner.ts +0 -1
  754. package/src/internal/framework-file-storage.ts +14 -14
  755. package/src/internal/framework-storage-selection.ts +9 -9
  756. package/src/internal/frontmatter.ts +36 -3
  757. package/src/internal/github-fanout.ts +1 -1
  758. package/src/internal/guest-network.ts +383 -0
  759. package/src/internal/host-otel.ts +8 -4
  760. package/src/internal/hosted-admission-adapter.ts +8 -8
  761. package/src/internal/hosted-delivery-protocol.ts +26 -1
  762. package/src/internal/hosted-delivery.ts +376 -192
  763. package/src/internal/http-channel.ts +1 -4
  764. package/src/internal/init-interview.ts +1 -4
  765. package/src/internal/init-project.ts +2 -2
  766. package/src/internal/inline-stdio-define-stub.ts +1 -1
  767. package/src/internal/is-record.ts +3 -0
  768. package/src/internal/json-schema.ts +19 -10
  769. package/src/internal/local-control-plane.ts +5 -24
  770. package/src/internal/mcp-endpoint.ts +1 -4
  771. package/src/internal/mcp-host.ts +84 -31
  772. package/src/internal/otel/collector.ts +200 -165
  773. package/src/internal/otel/config.ts +10 -14
  774. package/src/internal/otel/http.ts +16 -13
  775. package/src/internal/otel/mcp.ts +56 -0
  776. package/src/internal/otel/propagation.ts +17 -0
  777. package/src/internal/otel/runtime.ts +242 -25
  778. package/src/internal/package-inline-stdio.ts +3 -12
  779. package/src/internal/playground/toolchain.ts +1 -1
  780. package/src/internal/request-error-status.ts +72 -0
  781. package/src/internal/resolve-prod-target.ts +3 -8
  782. package/src/internal/result-output.ts +34 -0
  783. package/src/internal/run-client.ts +2 -2
  784. package/src/internal/runtime-dispatch-runner.ts +3 -21
  785. package/src/internal/sdk-runner.ts +3 -7
  786. package/src/internal/server.ts +153 -44
  787. package/src/internal/session-cost.ts +3 -3
  788. package/src/internal/session-engine.ts +274 -81
  789. package/src/internal/session-run-log.ts +18 -20
  790. package/src/internal/skills-sync.ts +13 -63
  791. package/src/internal/sleep.ts +3 -0
  792. package/src/internal/start-log-store.ts +13 -16
  793. package/src/internal/storage-coordinator.ts +19 -16
  794. package/src/internal/store-mirror.ts +86 -0
  795. package/src/internal/tenant-slack/relay.ts +179 -0
  796. package/src/internal/testing/scm-continuation-fixtures.ts +286 -0
  797. package/src/internal/tool-catalog.ts +9 -6
  798. package/src/internal/turn-cost.ts +47 -4
  799. package/src/internal/v2-hosting.ts +38 -0
  800. package/src/internal/workspace-sync.ts +55 -0
  801. package/src/internal/workspace.ts +14 -0
  802. package/src/otel.ts +180 -2
  803. package/src/result.ts +36 -0
  804. package/src/storage-backends/cursor-hosted.ts +7 -4
  805. package/src/storage-protocol.ts +102 -95
  806. package/src/storage.ts +4 -0
  807. package/src/tools.ts +18 -0
  808. package/src/types.ts +146 -34
  809. package/templates/triage/agent/lib/types.ts +0 -2
  810. package/dist/continuation.d.ts +0 -20
  811. package/dist/continuation.d.ts.map +0 -1
  812. package/dist/continuation.js +0 -18
  813. package/dist/docs/assets/chunks/@localSearchIndexroot.DbFXINq2.js +0 -1
  814. package/dist/docs/assets/guides_cloud-runtime.md.CkYbjnAX.js +0 -9
  815. package/dist/docs/assets/guides_cloud-runtime.md.CkYbjnAX.lean.js +0 -1
  816. package/dist/docs/assets/index.md.Bb4k8kUm.js +0 -5
  817. package/dist/docs/assets/reference_hooks.md.a8BJxMR5.js +0 -14
  818. package/dist/docs/assets/skills_framework-map.md.BTi817yv.js +0 -1
  819. package/dist/docs/guides/cloud-runtime.html +0 -35
  820. package/dist/docs/guides/cloud-runtime.md +0 -115
  821. package/dist/extensions/cursor-cloud-agents/lib/cloud.d.ts +0 -30
  822. package/dist/extensions/cursor-cloud-agents/lib/cloud.d.ts.map +0 -1
  823. package/dist/extensions/cursor-cloud-agents/lib/cloud.js +0 -45
  824. package/dist/extensions/cursor-cloud-agents/tools/follow_up.d.ts +0 -4
  825. package/dist/extensions/cursor-cloud-agents/tools/follow_up.d.ts.map +0 -1
  826. package/dist/extensions/cursor-cloud-agents/tools/status.d.ts +0 -4
  827. package/dist/extensions/cursor-cloud-agents/tools/status.d.ts.map +0 -1
  828. package/dist/extensions/cursor-cloud-agents/tools/status.js +0 -41
  829. package/dist/internal/convert-automation/index.d.ts +0 -3
  830. package/dist/internal/convert-automation/index.d.ts.map +0 -1
  831. package/dist/internal/convert-automation/index.js +0 -1
  832. package/dist/internal/grokbot/runner.d.ts +0 -64
  833. package/dist/internal/grokbot/runner.d.ts.map +0 -1
  834. package/dist/internal/grokbot/runner.js +0 -282
  835. package/dist/internal/managed-delivery.d.ts +0 -80
  836. package/dist/internal/managed-delivery.d.ts.map +0 -1
  837. package/dist/internal/managed-delivery.js +0 -86
  838. package/dist/internal/review-comments.d.ts +0 -370
  839. package/dist/internal/review-comments.d.ts.map +0 -1
  840. package/dist/internal/review-comments.js +0 -921
  841. package/dist/internal/shallow-clone.d.ts +0 -176
  842. package/dist/internal/shallow-clone.d.ts.map +0 -1
  843. package/dist/internal/shallow-clone.js +0 -419
  844. package/dist/playground/assets/index-BnNN1-EK.js +0 -69
  845. package/dist/playground/assets/index-DBQCwFp0.css +0 -1
  846. package/docs/guides/cloud-runtime.md +0 -120
  847. package/src/continuation.ts +0 -49
  848. package/src/extensions/cursor-cloud-agents/lib/cloud.ts +0 -79
  849. package/src/extensions/cursor-cloud-agents/tools/follow_up.ts +0 -29
  850. package/src/extensions/cursor-cloud-agents/tools/status.ts +0 -39
  851. package/src/internal/convert-automation/index.ts +0 -10
  852. package/src/internal/grokbot/runner.ts +0 -370
  853. package/src/internal/managed-delivery.ts +0 -125
  854. package/src/internal/review-comments.ts +0 -1363
  855. package/src/internal/shallow-clone.ts +0 -609
  856. /package/dist/docs/assets/{evals.md.CPzDAwoH.lean.js → evals.md.CbMoebP1.lean.js} +0 -0
  857. /package/dist/docs/assets/{guides_github.md.BtPr9GaP.lean.js → guides_github.md.DKYiT9do.lean.js} +0 -0
  858. /package/dist/docs/assets/{reference_agent-config.md.BHeYMgme.lean.js → reference_agent-config.md.CHNpiyp4.lean.js} +0 -0
  859. /package/dist/docs/assets/{reference_cli.md.DfoeyvL0.lean.js → reference_cli.md.CJNc_xYK.lean.js} +0 -0
  860. /package/dist/docs/assets/{reference_playground.md.DnX5nL-B.lean.js → reference_playground.md.4myJPxrf.lean.js} +0 -0
  861. /package/dist/docs/assets/{reference_skills.md.BFW9retM.lean.js → reference_skills.md.l2ezAcaN.lean.js} +0 -0
  862. /package/dist/docs/assets/{reference_tools.md.CvAHsdSp.lean.js → reference_tools.md.aGrn99hP.lean.js} +0 -0
@@ -0,0 +1,62 @@
1
+ import{_ as t,c as e,o as a,ag as i}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Extensions","description":"Mount a package of agent contributions or a Cursor plugin under a namespace with one file, adjust what it contributes, and author your own as a directory laid out like agent/.","frontmatter":{"title":"Extensions","description":"Mount a package of agent contributions or a Cursor plugin under a namespace with one file, adjust what it contributes, and author your own as a directory laid out like agent/."},"headers":[],"relativePath":"reference/extensions.md","filePath":"reference/extensions.md"}'),n={name:"reference/extensions.md"};function o(l,s,d,h,p,r){return a(),e("div",null,[...s[0]||(s[0]=[i(`<h1 id="extensions" tabindex="-1">Extensions <a class="header-anchor" href="#extensions" aria-label="Permalink to &quot;Extensions&quot;">​</a></h1><p>An extension packages the same contributions an agent authors under <code>agent/</code> and installs them as one unit. You mount it with a single file under <code>agent/extensions/</code>, and its contributions join the agent under a namespace. The package updates like any other dependency; nothing is copied into your project. A Cursor plugin mounts the same way; see <a href="#mount-a-cursor-plugin">Mount a Cursor plugin</a>.</p><p>Extensions are native to the Agent SDK. Slot files use the <code>@cursor/july</code> helpers, so a package built on another agent framework fails <code>agent-sdk validate</code> until you rewrite it onto <code>@cursor/july</code>.</p><h2 id="mount-an-extension" tabindex="-1">Mount an extension <a class="header-anchor" href="#mount-an-extension" aria-label="Permalink to &quot;Mount an extension&quot;">​</a></h2><p>Install the package, then add one file. The filename is the namespace.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// agent/extensions/ci.ts</span></span>
2
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ci </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@acme/ci-triage&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
3
+ <span class="line"></span>
4
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> ci</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({ org: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;acme&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, token: process.env.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">BUILDKITE_TOKEN</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">!</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> });</span></span></code></pre></div><p>Every contribution is exposed as <code>&lt;namespace&gt;__&lt;name&gt;</code>. A <code>failed_jobs</code> tool from this mount runs in the agent as <code>ci__failed_jobs</code>, and a <code>triage</code> skill loads as <code>ci__triage</code>. <code>agent-sdk info</code> lists each mount with what it contributed, and <code>GET /v1/info</code> returns the same under <code>extensions</code>.</p><p>Pass the configuration the extension asks for. The extension validates it when the agent loads, so a missing or mistyped field fails <code>agent-sdk validate</code> instead of a tool call later.</p><p>Namespaces follow the tool-name rule, and <code>__</code> is reserved: an authored <code>agent/tools/ci__failed_jobs.ts</code> fails discovery, so nothing outside a mount can pose as one of its tools.</p><h2 id="what-an-extension-can-contribute" tabindex="-1">What an extension can contribute <a class="header-anchor" href="#what-an-extension-can-contribute" aria-label="Permalink to &quot;What an extension can contribute&quot;">​</a></h2><p>An extension tree uses the same slots as <a href="./project-layout.html"><code>agent/</code></a>. Each shareable contribution lands on the agent under the mount&#39;s namespace:</p><table tabindex="0"><thead><tr><th>Path</th><th>Becomes</th></tr></thead><tbody><tr><td><code>tools/&lt;name&gt;.ts</code></td><td>tool <code>&lt;ns&gt;__&lt;name&gt;</code></td></tr><tr><td><code>skills/&lt;name&gt;</code></td><td>skill <code>&lt;ns&gt;__&lt;name&gt;</code></td></tr><tr><td><code>mcp-connections/&lt;name&gt;.ts</code></td><td>connection <code>&lt;ns&gt;__&lt;name&gt;</code></td></tr><tr><td><code>host-connections/&lt;name&gt;.ts</code></td><td>host connection <code>&lt;ns&gt;__&lt;name&gt;</code></td></tr><tr><td><code>hooks/&lt;name&gt;.ts</code></td><td>hook <code>&lt;ns&gt;__&lt;name&gt;</code></td></tr><tr><td><code>channels/&lt;name&gt;.ts</code></td><td>channel <code>&lt;ns&gt;__&lt;name&gt;</code></td></tr><tr><td><code>schedules/&lt;name&gt;</code></td><td>schedule <code>&lt;ns&gt;__&lt;name&gt;</code></td></tr><tr><td><code>subagents/&lt;id&gt;/</code></td><td>subagent <code>&lt;ns&gt;__&lt;id&gt;</code></td></tr><tr><td><code>instructions.md</code> / <code>.ts</code> / dir</td><td>appended to the agent&#39;s system prompt</td></tr><tr><td><code>sandbox/workspace/**</code></td><td>seeded into each local session workspace</td></tr><tr><td><code>ab.ts</code> / <code>ab/&lt;name&gt;.ts</code></td><td>A/B experiment <code>&lt;ns&gt;__&lt;name&gt;</code></td></tr><tr><td><code>artifacts.ts</code></td><td>artifact kinds <code>&lt;ns&gt;__&lt;kind&gt;</code></td></tr></tbody></table><p>The root agent still needs its own <code>instructions.md</code>. Extension instructions are extra fragments, not a substitute.</p><p><code>httpChannel()</code> stays on the agent. An extension authors <code>defineChannel</code> only; a file named <code>http.ts</code> becomes <code>&lt;ns&gt;__http</code>.</p><p>These stay on the agent that mounts the extension. Each is a singleton or is outside discovery:</p><table tabindex="0"><thead><tr><th>Path</th><th>Why it stays on the agent</th></tr></thead><tbody><tr><td><code>agent.ts</code></td><td>One <code>defineAgent</code> runtime per agent</td></tr><tr><td><code>storage.ts</code></td><td>One <code>host.kv</code> / <code>host.files</code> backend</td></tr><tr><td><code>otel.ts</code></td><td>One OTLP exporter</td></tr><tr><td><code>ab.config.ts</code></td><td>One experiment-platform config; <code>ab.ts</code> / <code>ab/</code> still merge</td></tr><tr><td><code>playground/</code></td><td>Custom chips are a Vite glob of the agent tree, not a discovery walk</td></tr><tr><td><code>extensions/</code></td><td>Nested mounts are not loaded</td></tr><tr><td><code>sandbox.ts</code></td><td>Custom sandbox backends stay on the agent</td></tr></tbody></table><p><code>agent-sdk validate</code> warns when a tree carries those paths.</p><h2 id="adjust-a-mounted-extension" tabindex="-1">Adjust a mounted extension <a class="header-anchor" href="#adjust-a-mounted-extension" aria-label="Permalink to &quot;Adjust a mounted extension&quot;">​</a></h2><p>To replace or remove a contribution, mount the extension as a directory and overlay the slot you want to change.</p><div class="language-text vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">text</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>agent/extensions/ci/</span></span>
5
+ <span class="line"><span>├── extension.ts # the mount: export default ci({ ... })</span></span>
6
+ <span class="line"><span>├── tools/</span></span>
7
+ <span class="line"><span>│ ├── job_log.ts # replaces ci__job_log with your own defineTool</span></span>
8
+ <span class="line"><span>│ └── retry_job.ts # export default disableTool() removes ci__retry_job</span></span>
9
+ <span class="line"><span>├── hooks/</span></span>
10
+ <span class="line"><span>│ └── audit.ts # export default disableHook() removes ci__audit</span></span>
11
+ <span class="line"><span>└── skills/</span></span>
12
+ <span class="line"><span> └── triage.ts # export default disableSkill() removes ci__triage</span></span></code></pre></div><p>Use the extension&#39;s own names inside the directory, without the namespace. A file with a name the extension doesn&#39;t contribute adds a new contribution under the namespace. Each helper comes from <code>@cursor/july/extensions</code> and fails discovery when it names a contribution the extension doesn&#39;t have, so a typo can&#39;t silently keep it alive.</p><table tabindex="0"><thead><tr><th>Slot</th><th>Helper</th></tr></thead><tbody><tr><td><code>tools/&lt;name&gt;.ts</code></td><td><code>disableTool()</code></td></tr><tr><td><code>mcp-connections/&lt;name&gt;.ts</code> / <code>host-connections/&lt;name&gt;.ts</code></td><td><code>disableConnection()</code></td></tr><tr><td><code>skills/&lt;name&gt;.ts</code></td><td><code>disableSkill()</code></td></tr><tr><td><code>hooks/&lt;name&gt;.ts</code></td><td><code>disableHook()</code></td></tr><tr><td><code>channels/&lt;name&gt;.ts</code></td><td><code>disableChannel()</code></td></tr><tr><td><code>schedules/&lt;name&gt;.ts</code></td><td><code>disableSchedule()</code></td></tr><tr><td><code>subagents/&lt;id&gt;.ts</code></td><td><code>disableSubagent()</code></td></tr><tr><td><code>instructions.ts</code></td><td><code>disableInstructions()</code></td></tr><tr><td><code>ab.ts</code> / <code>ab/&lt;name&gt;.ts</code></td><td><code>disableAB()</code></td></tr><tr><td><code>artifacts.ts</code></td><td><code>disableArtifacts()</code></td></tr></tbody></table><p><code>disable()</code> is the same brand as the slot helpers above and works in any of those files.</p><p>A Cursor plugin mount overlays its MCP servers the same way; see below.</p><h2 id="mount-a-cursor-plugin" tabindex="-1">Mount a Cursor plugin <a class="header-anchor" href="#mount-a-cursor-plugin" aria-label="Permalink to &quot;Mount a Cursor plugin&quot;">​</a></h2><p>A Cursor plugin is a directory with <code>.cursor-plugin/plugin.json</code> (or <code>.claude-plugin/plugin.json</code>, or <code>plugin.json</code>) and any of <code>skills/</code>, <code>commands/</code>, <code>agents/</code>, and <code>mcp.json</code>. Copy the plugin into your project and mount it with <code>cursorPlugin</code>. The filename is the namespace, as with any extension.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// agent/extensions/notion.ts</span></span>
13
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { cursorPlugin } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@cursor/july/extensions&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
14
+ <span class="line"></span>
15
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> cursorPlugin</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
16
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> path: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;plugins/notion-workspace&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// relative to the project root</span></span>
17
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> variables: { NOTION_TOKEN: process.env.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">NOTION_TOKEN</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">!</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
18
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>The plugin joins the agent under that namespace:</p><table tabindex="0"><thead><tr><th>Plugin content</th><th>Becomes</th></tr></thead><tbody><tr><td><code>skills/&lt;name&gt;/SKILL.md</code></td><td>skill <code>notion__&lt;name&gt;</code></td></tr><tr><td><code>commands/&lt;name&gt;.md</code></td><td>skill <code>notion__&lt;name&gt;</code>, since a command is a procedure the model runs on request</td></tr><tr><td><code>agents/&lt;name&gt;.md</code></td><td>subagent <code>notion__&lt;name&gt;</code></td></tr><tr><td>MCP servers in <code>mcp.json</code> or the manifest</td><td>connection <code>notion__&lt;server&gt;</code></td></tr></tbody></table><p><code>variables</code> fills the <code>\${NAME}</code> placeholders the plugin&#39;s MCP config declares; names you leave out come from the environment by exact name. A placeholder nothing fills fails <code>agent-sdk validate</code>, so a server never attaches half configured. A server that declares an OAuth client authorizes through <a href="./../guides/mcp-oauth.html">host MCP OAuth</a> as <code>agent-sdk mcp oauth notion__&lt;server&gt;</code>; its secret names collapse the namespace separator, so <code>notion__notion</code> stores <code>MCP_OAUTH_NOTION_NOTION_*</code>. A server that lists <code>enabledTools</code> mounts as an advertised connection with that allowlist and requires the local runtime; <code>agent-sdk validate</code> fails otherwise.</p><p>Mounting a plugin trusts it like authored code: its servers run the commands and read the environment variables its config names. Review a plugin before you vendor it.</p><p>Plugin rules and hooks are not mounted; <code>agent-sdk validate</code> warns when a plugin carries them. To drop or reconfigure one of the plugin&#39;s servers, mount as a directory and overlay <code>mcp-connections/&lt;server&gt;.ts</code>. An overlaid server is never read from the plugin, so it needs no variables.</p><div class="language-text vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">text</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>agent/extensions/cloudflare/</span></span>
19
+ <span class="line"><span>├── extension.ts # export default cursorPlugin({ path: &quot;plugins/cloudflare&quot; })</span></span>
20
+ <span class="line"><span>└── mcp-connections/</span></span>
21
+ <span class="line"><span> ├── cloudflare-docs.ts # replaces cloudflare__cloudflare-docs with your defineConnection</span></span>
22
+ <span class="line"><span> └── cloudflare-bindings.ts # export default disableConnection() drops it</span></span></code></pre></div><p><code>disableConnection()</code> comes from <code>@cursor/july/extensions</code> and fails discovery when it names a server the plugin doesn&#39;t declare.</p><h2 id="build-an-extension" tabindex="-1">Build an extension <a class="header-anchor" href="#build-an-extension" aria-label="Permalink to &quot;Build an extension&quot;">​</a></h2><p>An extension is a directory laid out like <code>agent/</code>. <code>extension.ts</code> declares it; the slots in <a href="#what-an-extension-can-contribute">What an extension can contribute</a> use the same authoring forms as the rest of this reference.</p><div class="language-text vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">text</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>@acme/ci-triage/</span></span>
23
+ <span class="line"><span>├── package.json</span></span>
24
+ <span class="line"><span>├── extension.ts # defineExtension</span></span>
25
+ <span class="line"><span>├── tools/</span></span>
26
+ <span class="line"><span>│ ├── failed_jobs.ts</span></span>
27
+ <span class="line"><span>│ ├── job_log.ts</span></span>
28
+ <span class="line"><span>│ └── retry_job.ts</span></span>
29
+ <span class="line"><span>├── skills/</span></span>
30
+ <span class="line"><span>│ └── triage.md</span></span>
31
+ <span class="line"><span>├── hooks/</span></span>
32
+ <span class="line"><span>│ └── audit.ts</span></span>
33
+ <span class="line"><span>├── mcp-connections/</span></span>
34
+ <span class="line"><span>│ └── buildkite.ts</span></span>
35
+ <span class="line"><span>└── lib/</span></span>
36
+ <span class="line"><span> └── buildkite.ts # shared code, never discovered</span></span></code></pre></div><p>Declare the extension with its root and, when consumers must configure it, a schema for their settings.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// extension.ts</span></span>
37
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineExtension } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@cursor/july/extensions&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
38
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { z } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;zod&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
39
+ <span class="line"></span>
40
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineExtension</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
41
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> root: </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">meta</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.dirname,</span></span>
42
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> description: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Investigate failing CI builds on Buildkite.&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
43
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config: z.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">object</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
44
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> org: z.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">string</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(),</span></span>
45
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> token: z.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">string</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(),</span></span>
46
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logTailLines: z.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">number</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">().</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">int</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">().</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">positive</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">().</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">default</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">200</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">),</span></span>
47
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }),</span></span>
48
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>The default export is what consumers call to mount the extension, and it is also how your own modules read the consumer&#39;s settings. Import it and read <code>extension.config</code>; the value is validated and has defaults applied.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// tools/job_log.ts</span></span>
49
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineTool } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@cursor/july/tools&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
50
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { z } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;zod&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
51
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> extension </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;../extension.js&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
52
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { jobLogTail } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;../lib/buildkite.js&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
53
+ <span class="line"></span>
54
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineTool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
55
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> description: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Read the tail of a CI job&#39;s log.&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
56
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> effect: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;read&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
57
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> inputSchema: z.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">object</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({ pipeline: z.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">string</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(), build: z.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">number</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(), job: z.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">string</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">() }),</span></span>
58
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> async</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> execute</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({ </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">pipeline</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">build</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">job</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }) {</span></span>
59
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> const</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">org</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">token</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">logTailLines</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> extension.config;</span></span>
60
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> jobLogTail</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({ org, token, pipeline, build, job, lines: logTailLines });</span></span>
61
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
62
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>Because the consumer picks the namespace, have skills and tool descriptions refer to sibling tools by their short names and say they appear under the mount&#39;s namespace (<code>&lt;namespace&gt;__job_log</code>).</p><p>Publish the built <code>extension.js</code> as the package entry point with the slot directories beside it. <code>root</code> is read from the built file, so copy <code>skills/*.md</code> and <code>instructions.md</code> into the build output or author them as <code>.ts</code>.</p><h2 id="what-s-next" tabindex="-1">What&#39;s next <a class="header-anchor" href="#what-s-next" aria-label="Permalink to &quot;What&#39;s next&quot;">​</a></h2><p>Continue with these pages:</p><ul><li><a href="./../guides/cloud-agents.html">Cursor cloud agents</a>: the extension that lets an agent launch and steer cloud agents</li><li><a href="./tools.html">Tools</a>: the tool contract extensions contribute to</li><li><a href="./skills.html">Skills</a>: the skill forms an extension can carry</li><li><a href="./project-layout.html">Project layout</a>: where <code>agent/extensions/</code> sits in the tree</li></ul>`,46)])])}const g=t(n,[["render",o]]);export{k as __pageData,g as default};
@@ -0,0 +1 @@
1
+ import{_ as t,c as e,o as a,ag as i}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Extensions","description":"Mount a package of agent contributions or a Cursor plugin under a namespace with one file, adjust what it contributes, and author your own as a directory laid out like agent/.","frontmatter":{"title":"Extensions","description":"Mount a package of agent contributions or a Cursor plugin under a namespace with one file, adjust what it contributes, and author your own as a directory laid out like agent/."},"headers":[],"relativePath":"reference/extensions.md","filePath":"reference/extensions.md"}'),n={name:"reference/extensions.md"};function o(l,s,d,h,p,r){return a(),e("div",null,[...s[0]||(s[0]=[i("",46)])])}const g=t(n,[["render",o]]);export{k as __pageData,g as default};
@@ -0,0 +1,73 @@
1
+ import{_ as e,c as t,o as a,ag as i}from"./chunks/framework.BCISBCiQ.js";const c=JSON.parse('{"title":"Hooks","description":"Observe-only subscribers to the session event stream: audit logs, metrics, transcript mirrors, derived state.","frontmatter":{"title":"Hooks","description":"Observe-only subscribers to the session event stream: audit logs, metrics, transcript mirrors, derived state."},"headers":[],"relativePath":"reference/hooks.md","filePath":"reference/hooks.md"}'),n={name:"reference/hooks.md"};function h(o,s,l,d,r,p){return a(),t("div",null,[...s[0]||(s[0]=[i(`<h1 id="hooks" tabindex="-1">Hooks <a class="header-anchor" href="#hooks" aria-label="Permalink to &quot;Hooks&quot;">​</a></h1><p>A hook subscribes to the session event stream and runs a side effect after each event is recorded: an audit line, a metric, a copy of the transcript in your own store, or derived state for later turns. Hooks run in the serving process for every session of the agent, on local and cloud runtime turns alike.</p><p>Hooks observe. They can&#39;t change the turn, the prompt, or the reply, and a handler that throws is logged and skipped. Treat the event as read-only; later subscribers see the same object. That makes hooks safe to add to a production agent, and the wrong tool for anything that must happen before the model runs or must fail a turn; see <a href="#when-not-to-use-a-hook">When not to use a hook</a>.</p><p><code>defineHook</code> is unrelated to <a href="https://cursor.com/docs/agent/hooks" target="_blank" rel="noreferrer">Cursor Agent hooks</a>, the <code>.cursor/hooks.json</code> scripts that can observe, block, or modify the agent loop. Those still run inside a local session workspace.</p><h2 id="author-a-hook" tabindex="-1">Author a hook <a class="header-anchor" href="#author-a-hook" aria-label="Permalink to &quot;Author a hook&quot;">​</a></h2><p>Author <code>agent/hooks/&lt;name&gt;.ts</code> with <code>defineHook</code> from <code>@cursor/july/hooks</code>. This one meters tokens:</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// agent/hooks/usage.ts</span></span>
2
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineHook } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@cursor/july/hooks&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
3
+ <span class="line"></span>
4
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineHook</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
5
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> events: {</span></span>
6
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> async</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;turn.completed&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">event</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">ctx</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
7
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (ctx.session.purpose </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">===</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;eval&quot;</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> ||</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> event.data.usage </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">===</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> undefined</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
8
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
9
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
10
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> const</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">inputTokens</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">outputTokens</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> event.data.usage;</span></span>
11
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ctx.host.otel.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">increment</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;acme.tokens.input&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, inputTokens);</span></span>
12
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ctx.host.otel.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">increment</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;acme.tokens.output&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, outputTokens);</span></span>
13
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
14
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> async</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;turn.failed&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">_event</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">ctx</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
15
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ctx.host.otel.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">increment</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;acme.turn.failed&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, { channel: ctx.channel.id });</span></span>
16
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
17
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
18
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>Any module under <code>agent/hooks/</code>, subfolders included, is a hook named by its path without the extension: <code>agent/hooks/audit/usage.ts</code> is <code>audit/usage</code>. <code>*.test.ts</code> and <code>*.spec.ts</code> files are skipped. The default export must be <code>defineHook(...)</code>, names can&#39;t contain <code>__</code>, and an empty <code>events</code> map skips the hook with a warning; <code>agent-sdk validate</code> reports all three. An extension mounts its hooks as <code>&lt;ns&gt;__&lt;name&gt;</code>, and <code>disableHook()</code> removes one (<a href="./extensions.html#adjust-a-mounted-extension">Adjust a mounted extension</a>).</p><p><code>agent-sdk init</code> scaffolds <code>agent/hooks/memory.ts</code>, which exports <code>memoryHook()</code> from <code>@cursor/july/memory</code> and journals every turn for later sessions to read. Delete the file to opt out.</p><h2 id="events-and-payloads" tabindex="-1">Events and payloads <a class="header-anchor" href="#events-and-payloads" aria-label="Permalink to &quot;Events and payloads&quot;">​</a></h2><p>Keys are event types from the <a href="./sessions.html#which-events-can-i-stream">event vocabulary</a>, or <code>&quot;*&quot;</code> for every event. A typed key narrows <code>event.data</code>; a <code>&quot;*&quot;</code> handler receives the union, so switch on <code>event.type</code>. Every event carries the stream envelope <code>{ type, index, sessionId, turnId?, at, data }</code>, with <code>turnId</code> set on turn-scoped events.</p><p>The payloads hooks read most often:</p><table tabindex="0"><thead><tr><th>Event</th><th><code>event.data</code></th></tr></thead><tbody><tr><td><code>message.received</code></td><td><code>{ text }</code></td></tr><tr><td><code>turn.completed</code></td><td><code>{ result?, usage?, cost? }</code>. <code>usage</code> has <code>inputTokens</code>, <code>outputTokens</code>, <code>cacheReadTokens</code>, <code>cacheWriteTokens</code>, and optional <code>reasoningTokens</code>. <code>cost</code> has <code>totalUsd</code> and the <code>model</code> it was priced against</td></tr><tr><td><code>turn.failed</code></td><td><code>{ message }</code></td></tr><tr><td><code>actions.requested</code></td><td><code>{ calls: [{ callId, toolName, args? }] }</code>. A call with <code>parentCallId</code> belongs to a subagent</td></tr><tr><td><code>action.result</code></td><td><code>{ callId, toolName, output?, isError, stubbed? }</code>. <code>stubbed</code> means a dry-run session answered a write without running it</td></tr></tbody></table><p>The types are <code>SessionEvent</code>, <code>SessionEventType</code>, and <code>HookContext</code>, exported from <code>@cursor/july</code>.</p><h2 id="handler-context" tabindex="-1">Handler context <a class="header-anchor" href="#handler-context" aria-label="Permalink to &quot;Handler context&quot;">​</a></h2><table tabindex="0"><thead><tr><th>Member</th><th>What it is</th></tr></thead><tbody><tr><td><code>ctx.session</code></td><td>Read-only session info: <code>id</code>, <code>channelId</code>, <code>mode</code> (<code>chat</code> or <code>task</code>), <code>purpose</code> (<code>live</code> or <code>eval</code>), <code>auth</code>, plus <code>title</code>, <code>sdkAgentId</code>, and <code>abs</code> when set</td></tr><tr><td><code>ctx.agent</code></td><td><code>{ name }</code> of the agent the event belongs to</td></tr><tr><td><code>ctx.channel</code></td><td><code>{ id, continuationToken }</code>. The token is <code>null</code> when the session can&#39;t take follow-ups</td></tr><tr><td><code>ctx.host.kv</code></td><td>Durable JSON, shared by every session of the agent; the <a href="./../storage.html#author-kv-ctx-host-kv">storage backend</a> decides whether it survives a hosted replace. Prefix keys with <code>ctx.session.id</code> for per-session state</td></tr><tr><td><code>ctx.host.files</code></td><td>Durable files, bound to this session. Pass <code>{ scope: &quot;deployment&quot; }</code> for agent-wide files</td></tr><tr><td><code>ctx.host.otel</code></td><td>Counters, histograms, and tags, attributed to this session</td></tr><tr><td><code>ctx.host.mcp</code>, <code>ctx.host.github</code>, <code>ctx.host.slack</code></td><td>The same shared clients tools get</td></tr><tr><td><code>ctx.host.reminders</code></td><td>Per-session <a href="./schedules.html">reminders</a>, the same API tools get</td></tr><tr><td><code>ctx.artifacts</code></td><td>Session-bound <a href="./artifacts.html">artifacts</a> facade: <code>tag</code> fills in <code>sessionId</code> and <code>turnId</code></td></tr><tr><td><code>ctx.stateRoot</code></td><td>Absolute path of the local state root. It resets when a hosted deployment is replaced; keep derived state in <code>kv</code> or <code>files</code></td></tr></tbody></table><h2 id="when-hooks-run" tabindex="-1">When hooks run <a class="header-anchor" href="#when-hooks-run" aria-label="Permalink to &quot;When hooks run&quot;">​</a></h2><p>A hook runs after the event is durably recorded. It never delays the model turn and never sees an event that wasn&#39;t recorded.</p><p>Within one session, events dispatch in order, one at a time: the channel&#39;s <code>events</code> handlers first, then each hook in discovery order. Sessions don&#39;t wait on each other.</p><p>Two consequences:</p><ul><li>A slow handler holds up the next event&#39;s handlers for that session, not the model. Keep handlers short and queue anything slow.</li><li>Hooks fire for eval sessions too. Check <code>ctx.session.purpose === &quot;eval&quot;</code> before metering or paging.</li></ul><p>Each event reaches a hook at most once. A restart doesn&#39;t replay the log into hooks, so a mirror needs no dedupe, and the event log rather than the hook&#39;s copy is the source of truth.</p><h2 id="hooks-channel-events-evals-or-a-b" tabindex="-1">Hooks, channel events, evals, or A/B? <a class="header-anchor" href="#hooks-channel-events-evals-or-a-b" aria-label="Permalink to &quot;Hooks, channel events, evals, or A/B?&quot;">​</a></h2><p>All of them consume the same stream, for different jobs:</p><table tabindex="0"><thead><tr><th></th><th>Hooks</th><th>Channel <code>events</code></th><th>Evals</th><th>A/B (<code>defineAB</code>)</th></tr></thead><tbody><tr><td>Scope</td><td>every session of the agent</td><td>sessions the channel owns</td><td>one test turn</td><td>every live session; enrollment at creation, metrics on each turn</td></tr><tr><td>Job</td><td>observe: audit, metrics, mirrors, derived state</td><td>deliver: replies back to the channel&#39;s surface</td><td>assert: gates over the trajectory</td><td>compare: sticky arms, then fold the stream into <code>onSample</code> metrics</td></tr><tr><td>Context</td><td><code>ctx.host</code>, <code>ctx.artifacts</code>, session info</td><td><code>channel.state</code>, <code>setContinuationToken</code>, <code>ctx.host</code>, session info</td><td>the <code>t</code> assertion helpers</td><td>per-session samples in <code>onSample</code></td></tr><tr><td>Can affect the run</td><td>no</td><td>yes, it owns the surface</td><td>n/a</td><td>yes through arm instructions or <code>session.abs</code>; collection is observe-only</td></tr><tr><td>Authored at</td><td><code>agent/hooks/*.ts</code></td><td>channel config</td><td><code>evals/**/*.eval.ts</code></td><td><a href="./../ab.html"><code>agent/ab.ts</code> or <code>agent/ab/*.ts</code></a></td></tr></tbody></table><h2 id="when-not-to-use-a-hook" tabindex="-1">When not to use a hook <a class="header-anchor" href="#when-not-to-use-a-hook" aria-label="Permalink to &quot;When not to use a hook&quot;">​</a></h2><table tabindex="0"><thead><tr><th>You want to</th><th>Use instead</th></tr></thead><tbody><tr><td>Add context before the model runs</td><td>The channel&#39;s <code>send</code> message and <code>workspaceFiles</code>, <code>instructions.md</code>, skills, or <code>sandbox/workspace/</code> seed files</td></tr><tr><td>Reply on Slack, comment on a PR, or post any other delivery</td><td>The channel&#39;s <code>events</code> map, or the Slack and GitHub packs</td></tr><tr><td>Show PR progress (merge-box check, sticky banner)</td><td><code>githubChannel({ progress: { commitStatus, banner } })</code>; see <a href="./../guides/github.html#show-pr-progress">Show PR progress</a></td></tr><tr><td>Block, approve, or rewrite a tool call</td><td><a href="./tools.html#gate-a-tool-on-human-approval"><code>needsApproval</code></a> on the tool</td></tr><tr><td>Act on the final assistant text, or fail a bad turn</td><td><a href="./result.html"><code>defineResult</code></a></td></tr><tr><td>Gate a change on behavior</td><td><a href="./../evals.html">Evals</a></td></tr><tr><td>Compare two prompts on live traffic</td><td><a href="./../ab.html"><code>defineAB</code></a></td></tr></tbody></table><h2 id="patterns" tabindex="-1">Patterns <a class="header-anchor" href="#patterns" aria-label="Permalink to &quot;Patterns&quot;">​</a></h2><p>Usage metering is the <a href="#author-a-hook">authoring example</a>. Three more:</p><h3 id="alert-on-failure" tabindex="-1">Alert on failure <a class="header-anchor" href="#alert-on-failure" aria-label="Permalink to &quot;Alert on failure&quot;">​</a></h3><p><code>turn.failed</code> carries the message, and <code>ctx.session.id</code> points at the trace. Skip interrupted turns; those are preemptions, not failures. Read secrets inside the handler: hosted deployments bind them after the process starts, so a module-scope read stays empty. Give the call a timeout, since a stalled request holds up later handlers on that session.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// agent/hooks/page-on-failure.ts</span></span>
19
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineHook } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@cursor/july/hooks&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
20
+ <span class="line"></span>
21
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineHook</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
22
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> events: {</span></span>
23
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> async</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;turn.failed&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">event</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">ctx</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
24
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> pagerUrl</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> process.env.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">PAGER_WEBHOOK_URL</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
25
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (</span></span>
26
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> pagerUrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">===</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> undefined</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> ||</span></span>
27
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ctx.session.purpose </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">===</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;eval&quot;</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> ||</span></span>
28
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> event.data.message </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">===</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;turn interrupted&quot;</span></span>
29
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ) {</span></span>
30
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
31
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
32
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> fetch</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(pagerUrl, {</span></span>
33
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> method: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;POST&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
34
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> headers: { </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;content-type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;application/json&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
35
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> body: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">JSON</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">stringify</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
36
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> agent: ctx.agent.name,</span></span>
37
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> session: ctx.session.id,</span></span>
38
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> channel: ctx.channel.id,</span></span>
39
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> message: event.data.message,</span></span>
40
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }),</span></span>
41
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> signal: AbortSignal.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">timeout</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">5_000</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">),</span></span>
42
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> });</span></span>
43
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
44
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
45
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><h3 id="mirror-the-transcript" tabindex="-1">Mirror the transcript <a class="header-anchor" href="#mirror-the-transcript" aria-label="Permalink to &quot;Mirror the transcript&quot;">​</a></h3><p>Subscribe to <code>&quot;*&quot;</code> and write one file per event, skipping the <code>*.appended</code> deltas: they arrive per token, and <code>message.completed</code> carries the final text. Session scope keeps transcripts apart without a session id in the path. The mirror holds reasoning text and raw tool arguments and outputs, so pick the store accordingly, and write to your own store instead when you need cross-session queries.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// agent/hooks/mirror.ts</span></span>
46
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineHook } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@cursor/july/hooks&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
47
+ <span class="line"></span>
48
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineHook</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
49
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> events: {</span></span>
50
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> async</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;*&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">event</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">ctx</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
51
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (event.type.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">endsWith</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;.appended&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)) {</span></span>
52
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
53
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
54
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> name</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> String</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(event.index).</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">padStart</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">6</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;0&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
55
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ctx.host.files.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">write</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span></span>
56
+ <span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> \`transcript/\${</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">name</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">}.json\`</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
57
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> JSON</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">stringify</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(event)</span></span>
58
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> );</span></span>
59
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
60
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
61
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><h3 id="keep-derived-state-across-a-replace" tabindex="-1">Keep derived state across a replace <a class="header-anchor" href="#keep-derived-state-across-a-replace" aria-label="Permalink to &quot;Keep derived state across a replace&quot;">​</a></h3><p>Write it to <code>ctx.host.kv</code> under a session-prefixed key; a tool reads it back with <code>ctx.host.kv.get</code>.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// agent/hooks/last-result.ts</span></span>
62
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineHook } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@cursor/july/hooks&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
63
+ <span class="line"></span>
64
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineHook</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
65
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> events: {</span></span>
66
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> async</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;turn.completed&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">event</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">ctx</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
67
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ctx.host.kv.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">put</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">\`last-result/\${</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">ctx</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">.</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">session</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">.</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">id</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">}\`</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, {</span></span>
68
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> at: event.at,</span></span>
69
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> result: event.data.result </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">??</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> null</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
70
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> });</span></span>
71
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
72
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
73
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><h2 id="test-and-debug-a-hook" tabindex="-1">Test and debug a hook <a class="header-anchor" href="#test-and-debug-a-hook" aria-label="Permalink to &quot;Test and debug a hook&quot;">​</a></h2><p>A hook definition is a plain object, so a unit test calls <code>hook.events[&quot;turn.completed&quot;]</code> directly with an event and a stub <code>HookContext</code>. Discovery skips <code>*.test.ts</code>, so the test can live next to the hook.</p><p>At runtime:</p><ul><li><code>agent-sdk validate --dir .</code> reports discovery errors and the empty-handlers warning.</li><li><code>agent-sdk info --dir . --json</code> lists the loaded hooks under <code>agents[].hooks</code>.</li><li>Send a turn with <code>agent-sdk dev</code> or <code>agent-sdk run --dir . --message &quot;…&quot;</code> and watch the serve log for <code>hook &quot;&lt;name&gt;&quot; handler for &lt;event&gt; threw: …</code>. <code>run</code> prints that log on stderr. On hosting, read it with <a href="./cli.html#logs"><code>agent-sdk logs</code></a>.</li></ul><h2 id="what-s-next" tabindex="-1">What&#39;s next <a class="header-anchor" href="#what-s-next" aria-label="Permalink to &quot;What&#39;s next&quot;">​</a></h2><p>Continue with these pages:</p><ul><li><a href="./result.html">Turn result</a>: fail a turn from <code>commit</code>, not from a hook</li><li><a href="./sessions.html">Sessions and streaming</a>: the event vocabulary hooks observe</li><li><a href="./../storage.html">Storage</a>: where <code>ctx.host.kv</code> and <code>ctx.host.files</code> live</li><li><a href="./../guides/opentelemetry.html">OpenTelemetry</a>: OTLP traces and metrics from the same event stream</li><li><a href="./../deployment.html#observability">Deployment</a>: runtime logs and export paths</li><li><a href="./channels.html#events">Channels</a>: the delivery-side counterpart</li><li><a href="./../ab.html">Live A/B metrics</a>: sticky variants over the same event stream</li></ul>`,45)])])}const E=e(n,[["render",h]]);export{c as __pageData,E as default};
@@ -1 +1 @@
1
- import{_ as s,c as t,o as a,ag as i}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Hooks","description":"Observe-only subscribers to the session event stream: audit logs, metrics, transcript mirrors, derived state.","frontmatter":{"title":"Hooks","description":"Observe-only subscribers to the session event stream: audit logs, metrics, transcript mirrors, derived state."},"headers":[],"relativePath":"reference/hooks.md","filePath":"reference/hooks.md"}'),o={name:"reference/hooks.md"};function n(d,e,h,r,l,c){return a(),t("div",null,[...e[0]||(e[0]=[i("",20)])])}const u=s(o,[["render",n]]);export{k as __pageData,u as default};
1
+ import{_ as e,c as t,o as a,ag as i}from"./chunks/framework.BCISBCiQ.js";const c=JSON.parse('{"title":"Hooks","description":"Observe-only subscribers to the session event stream: audit logs, metrics, transcript mirrors, derived state.","frontmatter":{"title":"Hooks","description":"Observe-only subscribers to the session event stream: audit logs, metrics, transcript mirrors, derived state."},"headers":[],"relativePath":"reference/hooks.md","filePath":"reference/hooks.md"}'),n={name:"reference/hooks.md"};function h(o,s,l,d,r,p){return a(),t("div",null,[...s[0]||(s[0]=[i("",45)])])}const E=e(n,[["render",h]]);export{c as __pageData,E as default};
@@ -1 +1 @@
1
- import{_ as t,c as o,o as a,ag as s}from"./chunks/framework.BCISBCiQ.js";const u=JSON.parse('{"title":"Playground","description":"The built-in web UI: chat with streaming, Try buttons and slash commands, session replay, approvals, and dev-mode dispatch.","frontmatter":{"title":"Playground","description":"The built-in web UI: chat with streaming, Try buttons and slash commands, session replay, approvals, and dev-mode dispatch."},"headers":[],"relativePath":"reference/playground.md","filePath":"reference/playground.md"}'),n={name:"reference/playground.md"};function r(l,e,d,i,c,h){return a(),o("div",null,[...e[0]||(e[0]=[s('<h1 id="playground" tabindex="-1">Playground <a class="header-anchor" href="#playground" aria-label="Permalink to &quot;Playground&quot;">​</a></h1><p>Every served agent ships with a web playground at <code>http://127.0.0.1:3000/&lt;slug&gt;/playground</code> (or <code>/playground</code> in single mode). Anything you can do there you can also do with curl.</p><h2 id="what-it-does" tabindex="-1">What it does <a class="header-anchor" href="#what-it-does" aria-label="Permalink to &quot;What it does&quot;">​</a></h2><p>Use the playground to chat, try channel routes, and inspect sessions.</p><ul><li><strong>Chat</strong> with the agent. Text and reasoning stream live, and tool calls appear inline with their arguments, output, and error state.</li><li><strong>Slash commands</strong>: custom channel routes become composer commands (a <code>drive</code> route becomes <code>/drive &lt;pr-url&gt;</code>), with <code>/help</code> and autocomplete.</li><li><strong>Try</strong> any channel route from the Agent surface. The modal remembers your last body per endpoint and has Copy curl, and a successful Try opens the created session.</li><li><strong>Sessions</strong>: browse the sessions you own (chat, custom-channel, schedule tasks) and replay their event streams. In <code>--dev</code> on loopback, or with <code>--allow-anonymous</code>, the list includes every principal. Search by session ID to filter the list, or press Enter to open an ID directly. &quot;Open trace&quot; renders a saved event stream.</li><li><strong>Approvals</strong>: parked <code>needsApproval</code> tool calls render Approve / Deny buttons.</li><li><strong>Evals</strong>: list and run filesystem evals from the browser (backed by <code>/v1/dev/evals</code>). Schedule hand-dispatch still requires <code>--dev</code>.</li><li><strong>The surface</strong>: inspect the discovered tools, skills, subagents, MCP connections, channels, and hooks.</li><li><strong>Raw events pane</strong>: flip it on to inspect the event stream.</li><li><strong>Logs tab</strong>: recent server log lines, polled from <code>GET /v1/logs</code>.</li><li><strong>A/Bs tab</strong>: per-session and aggregate <a href="./../ab.html">live A/B metrics</a> from <code>GET /v1/abs</code>.</li></ul><p>In multi-agent mode each agent has its own playground at <code>/&lt;slug&gt;/playground</code>, and <code>/</code> is an index of them all.</p><h2 id="share-it-beyond-localhost" tabindex="-1">Share it beyond localhost <a class="header-anchor" href="#share-it-beyond-localhost" aria-label="Permalink to &quot;Share it beyond localhost&quot;">​</a></h2><p>The default <code>localDevStrict()</code> auth admits direct loopback calls only and rejects proxy-forwarding headers, so a tunnel or LAN address won&#39;t work until you pass <code>--bearer-token &lt;secret&gt;</code> (or <code>serve(dir, { authToken })</code>). Open the playground on the remote device and paste the token into the token field in the navbar. <code>--allow-anonymous</code> is the demo-only alternative for trusted networks.</p><h2 id="what-s-next" tabindex="-1">What&#39;s next <a class="header-anchor" href="#what-s-next" aria-label="Permalink to &quot;What&#39;s next&quot;">​</a></h2><p>Continue with these pages:</p><ul><li><a href="./http-api.html">HTTP API</a>: the HTTP surface the playground uses</li><li><a href="./sessions.html">Sessions and streaming</a>: the streams it renders</li><li><a href="./../guides/human-in-the-loop.html">Human-in-the-loop</a>: the approval buttons in context</li><li><a href="./../ab.html">Live A/B metrics</a>: the assignments and results in the A/Bs tab</li></ul>',11)])])}const g=t(n,[["render",r]]);export{u as __pageData,g as default};
1
+ import{_ as t,c as o,o as a,ag as s}from"./chunks/framework.BCISBCiQ.js";const u=JSON.parse('{"title":"Playground","description":"The built-in web UI: chat with streaming, Try buttons and slash commands, session replay, approvals, and dev-mode dispatch.","frontmatter":{"title":"Playground","description":"The built-in web UI: chat with streaming, Try buttons and slash commands, session replay, approvals, and dev-mode dispatch."},"headers":[],"relativePath":"reference/playground.md","filePath":"reference/playground.md"}'),n={name:"reference/playground.md"};function r(l,e,d,i,c,h){return a(),o("div",null,[...e[0]||(e[0]=[s('<h1 id="playground" tabindex="-1">Playground <a class="header-anchor" href="#playground" aria-label="Permalink to &quot;Playground&quot;">​</a></h1><p>Every served agent ships with a web playground at <code>http://127.0.0.1:3000/&lt;slug&gt;/playground</code> (or <code>/playground</code> in single mode). Anything you can do there you can also do with curl.</p><h2 id="what-it-does" tabindex="-1">What it does <a class="header-anchor" href="#what-it-does" aria-label="Permalink to &quot;What it does&quot;">​</a></h2><p>Use the playground to chat, try channel routes, and inspect sessions.</p><ul><li><strong>Chat</strong> with the agent. Text and reasoning stream live, and tool calls appear inline with their arguments, output, and error state.</li><li><strong>Slash commands</strong>: custom channel routes become composer commands (a <code>drive</code> route becomes <code>/drive &lt;pr-url&gt;</code>), with <code>/help</code> and autocomplete.</li><li><strong>Try</strong> any channel route from the Agent surface. The modal remembers your last body per endpoint and has Copy curl, and a successful Try opens the created session.</li><li><strong>Sessions</strong>: browse the sessions you own (chat, custom-channel, schedule tasks) and replay their event streams. In <code>--dev</code> on loopback, or with <code>--allow-anonymous</code>, the list includes every principal. Search by session ID to filter the list, or press Enter to open an ID directly. &quot;Open trace&quot; renders a saved event stream.</li><li><strong>Approvals</strong>: parked <code>needsApproval</code> tool calls render Approve / Deny buttons.</li><li><strong>Evals</strong>: list and run filesystem evals from the browser (backed by <code>/v1/dev/evals</code>). Schedule hand-dispatch still requires <code>--dev</code>.</li><li><strong>The surface</strong>: inspect the discovered tools, skills, subagents, MCP connections, channels, and hooks.</li><li><strong>Custom tool chips</strong>: drop <code>agent/playground/tools/&lt;toolName&gt;.tsx</code> to change how that tool renders. Chips compile from the agent tree; an <a href="./extensions.html">extension</a> cannot contribute them.</li><li><strong>Raw events pane</strong>: flip it on to inspect the event stream.</li><li><strong>Logs tab</strong>: recent server log lines, polled from <code>GET /v1/logs</code>.</li><li><strong>A/Bs tab</strong>: per-session and aggregate <a href="./../ab.html">live A/B metrics</a> from <code>GET /v1/abs</code>.</li></ul><p>In multi-agent mode each agent has its own playground at <code>/&lt;slug&gt;/playground</code>, and <code>/</code> is an index of them all.</p><h2 id="share-it-beyond-localhost" tabindex="-1">Share it beyond localhost <a class="header-anchor" href="#share-it-beyond-localhost" aria-label="Permalink to &quot;Share it beyond localhost&quot;">​</a></h2><p>The default <code>localDevStrict()</code> auth admits direct loopback calls only and rejects proxy-forwarding headers, so a tunnel or LAN address won&#39;t work until you pass <code>--bearer-token &lt;secret&gt;</code> (or <code>serve(dir, { authToken })</code>). Open the playground on the remote device and paste the token into the token field in the navbar. <code>--allow-anonymous</code> is the demo-only alternative for trusted networks.</p><h2 id="what-s-next" tabindex="-1">What&#39;s next <a class="header-anchor" href="#what-s-next" aria-label="Permalink to &quot;What&#39;s next&quot;">​</a></h2><p>Continue with these pages:</p><ul><li><a href="./http-api.html">HTTP API</a>: the HTTP surface the playground uses</li><li><a href="./sessions.html">Sessions and streaming</a>: the streams it renders</li><li><a href="./../guides/human-in-the-loop.html">Human-in-the-loop</a>: the approval buttons in context</li><li><a href="./../ab.html">Live A/B metrics</a>: the assignments and results in the A/Bs tab</li></ul>',11)])])}const g=t(n,[["render",r]]);export{u as __pageData,g as default};
@@ -1,4 +1,4 @@
1
- import{_ as t,c as a,o as s,ag as d}from"./chunks/framework.BCISBCiQ.js";const g=JSON.parse('{"title":"Project layout","description":"The folder structure under agent/ and the path-derived naming rule.","frontmatter":{"title":"Project layout","description":"The folder structure under agent/ and the path-derived naming rule."},"headers":[],"relativePath":"reference/project-layout.md","filePath":"reference/project-layout.md"}'),o={name:"reference/project-layout.md"};function n(r,e,i,c,l,h){return s(),a("div",null,[...e[0]||(e[0]=[d(`<h1 id="project-layout" tabindex="-1">Project layout <a class="header-anchor" href="#project-layout" aria-label="Permalink to &quot;Project layout&quot;">​</a></h1><p>The Agent SDK builds an agent by walking the filesystem under <code>agent/</code>. Each folder has a defined purpose. The path a file lands in determines how the Agent SDK loads it.</p><h2 id="folder-structure" tabindex="-1">Folder structure <a class="header-anchor" href="#folder-structure" aria-label="Permalink to &quot;Folder structure&quot;">​</a></h2><p>For the capabilities below, identity usually comes from the path. A/B experiments can override their file-derived name.</p><table tabindex="0"><thead><tr><th>Path</th><th>Resolves to</th></tr></thead><tbody><tr><td><code>agent/tools/approve_pr.ts</code></td><td>tool <code>approve_pr</code></td></tr><tr><td><code>agent/mcp-connections/linear.ts</code></td><td>MCP connection <code>linear</code> (model + host)</td></tr><tr><td><code>agent/host-connections/anytool.ts</code></td><td>Host MCP connection <code>anytool</code> (host + <code>mcp oauth</code> only)</td></tr><tr><td><code>agent/skills/pr-review.md</code></td><td>skill <code>pr-review</code></td></tr><tr><td><code>agent/subagents/reviewer/</code></td><td>subagent <code>reviewer</code></td></tr><tr><td><code>agent/channels/drive.ts</code></td><td>channel <code>drive</code>, routes under <code>/v1/channels/drive</code></td></tr><tr><td><code>agent/ab.ts</code></td><td>A/B experiment <code>ab</code> unless <code>name</code> overrides it</td></tr><tr><td><code>agent/ab/concise.ts</code></td><td>A/B experiment <code>concise</code> unless <code>name</code> overrides it</td></tr></tbody></table><p>The root agent takes its name from <code>package.json</code> <code>name</code>, falling back to the directory name. When serving multiple agents, the slug is the directory name and must match <code>[A-Za-z0-9][A-Za-z0-9_-]*</code> (and not the reserved <code>v1</code>, <code>playground</code>, or <code>docs</code> segments).</p><h2 id="project-overview" tabindex="-1">Project overview <a class="header-anchor" href="#project-overview" aria-label="Permalink to &quot;Project overview&quot;">​</a></h2><p>Most projects start with this shape.</p><div class="language-text vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">text</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>my-agent/</span></span>
1
+ import{_ as t,c as s,o as a,ag as d}from"./chunks/framework.BCISBCiQ.js";const g=JSON.parse('{"title":"Project layout","description":"The folder structure under agent/ and the path-derived naming rule.","frontmatter":{"title":"Project layout","description":"The folder structure under agent/ and the path-derived naming rule."},"headers":[],"relativePath":"reference/project-layout.md","filePath":"reference/project-layout.md"}'),o={name:"reference/project-layout.md"};function n(r,e,i,c,l,h){return a(),s("div",null,[...e[0]||(e[0]=[d(`<h1 id="project-layout" tabindex="-1">Project layout <a class="header-anchor" href="#project-layout" aria-label="Permalink to &quot;Project layout&quot;">​</a></h1><p>The Agent SDK builds an agent by walking the filesystem under <code>agent/</code>. Each folder has a defined purpose. The path a file lands in determines how the Agent SDK loads it.</p><h2 id="folder-structure" tabindex="-1">Folder structure <a class="header-anchor" href="#folder-structure" aria-label="Permalink to &quot;Folder structure&quot;">​</a></h2><p>For the capabilities below, identity usually comes from the path. A/B experiments can override their file-derived name.</p><table tabindex="0"><thead><tr><th>Path</th><th>Resolves to</th></tr></thead><tbody><tr><td><code>agent/tools/approve_pr.ts</code></td><td>tool <code>approve_pr</code></td></tr><tr><td><code>agent/mcp-connections/linear.ts</code></td><td>MCP connection <code>linear</code> (model + host)</td></tr><tr><td><code>agent/host-connections/anytool.ts</code></td><td>Host MCP connection <code>anytool</code> (host + <code>mcp oauth</code> only)</td></tr><tr><td><code>agent/skills/pr-review.md</code></td><td>skill <code>pr-review</code></td></tr><tr><td><code>agent/subagents/reviewer/</code></td><td>subagent <code>reviewer</code></td></tr><tr><td><code>agent/extensions/ci.ts</code></td><td>extension mount <code>ci</code>; its contributions become <code>ci__&lt;name&gt;</code></td></tr><tr><td><code>agent/extensions/notion.ts</code></td><td>Cursor plugin mount <code>notion</code> (<code>cursorPlugin</code>); its skills, agents, and MCP servers become <code>notion__&lt;name&gt;</code></td></tr><tr><td><code>agent/channels/drive.ts</code></td><td>channel <code>drive</code>, routes under <code>/v1/channels/drive</code></td></tr><tr><td><code>agent/ab.ts</code></td><td>A/B experiment <code>ab</code> unless <code>name</code> overrides it</td></tr><tr><td><code>agent/ab/concise.ts</code></td><td>A/B experiment <code>concise</code> unless <code>name</code> overrides it</td></tr></tbody></table><p>The root agent takes its name from <code>package.json</code> <code>name</code>, falling back to the directory name. When serving multiple agents, the slug is the directory name and must match <code>[A-Za-z0-9][A-Za-z0-9_-]*</code> (and not the reserved <code>v1</code>, <code>playground</code>, or <code>docs</code> segments).</p><h2 id="project-overview" tabindex="-1">Project overview <a class="header-anchor" href="#project-overview" aria-label="Permalink to &quot;Project overview&quot;">​</a></h2><p>Most projects start with this shape.</p><div class="language-text vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">text</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>my-agent/</span></span>
2
2
  <span class="line"><span>├── package.json</span></span>
3
3
  <span class="line"><span>├── agent/</span></span>
4
4
  <span class="line"><span>│ ├── agent.ts # runtime config (model, runtime, cloud/local)</span></span>
@@ -14,6 +14,6 @@ import{_ as t,c as a,o as s,ag as d}from"./chunks/framework.BCISBCiQ.js";const g
14
14
  <span class="line"><span>│ └── channels/</span></span>
15
15
  <span class="line"><span>│ └── github.ts # messages and external events</span></span>
16
16
  <span class="line"><span>└── evals/</span></span>
17
- <span class="line"><span> └── readiness.eval.ts # regression cases</span></span></code></pre></div><p>Evals live in <code>evals/</code> at the project root, a sibling of <code>agent/</code>, never inside it. <code>agent/evals/</code> is silently ignored. See <a href="./../evals.html">Evals</a>.</p><h2 id="folder-reference" tabindex="-1">Folder reference <a class="header-anchor" href="#folder-reference" aria-label="Permalink to &quot;Folder reference&quot;">​</a></h2><p>Each path maps to a capability and a reference page.</p><table tabindex="0"><thead><tr><th>Path</th><th>What it is</th><th>Reference</th></tr></thead><tbody><tr><td><code>agent/agent.ts</code></td><td><code>defineAgent({ model?, runtime?, cloud?, local? })</code>; the model defaults to <code>grok-4.5</code> with <code>effort=high</code>, <code>fast=true</code></td><td><a href="./agent-config.html">Agent config</a></td></tr><tr><td><code>agent/instructions.md</code></td><td>Always-on system prompt, required on the root agent (<code>.ts</code> and directory forms exist)</td><td><a href="./instructions.html">Instructions</a></td></tr><tr><td><code>agent/tools/&lt;name&gt;.ts</code></td><td>One typed tool; filename = tool name. <code>execution: &quot;server&quot;</code> (in-process, default) or <code>&quot;agent&quot;</code> (a script that runs where the agent runs)</td><td><a href="./tools.html">Tools</a></td></tr><tr><td><code>agent/skills/*</code></td><td>SKILL.md-convention procedures, loaded on demand</td><td><a href="./skills.html">Skills</a></td></tr><tr><td><code>agent/mcp-connections/&lt;name&gt;.ts</code></td><td>MCP servers, available to the model, to server tools (<code>ctx.host.mcp</code>), and to channel/schedule handlers (<code>args.host.mcp</code>)</td><td><a href="./connections.html">MCP connections</a></td></tr><tr><td><code>agent/host-connections/&lt;name&gt;.ts</code></td><td>Privileged MCP servers for <code>ctx.host.mcp</code> and <code>mcp oauth</code>. The model never sees them.</td><td><a href="./connections.html">MCP connections</a></td></tr><tr><td><code>agent/subagents/&lt;id&gt;/</code></td><td>Child agent directory; <code>description</code> required</td><td><a href="./subagents.html">Subagents</a></td></tr><tr><td><code>agent/channels/*.ts</code></td><td>HTTP surfaces beyond the built-in session API; <code>slack.ts</code> and <code>github.ts</code> use the platform packs</td><td><a href="./channels.html">Channels</a></td></tr><tr><td><code>agent/hooks/*.ts</code></td><td>Observe-only event subscribers, never fatal</td><td><a href="./hooks.html">Hooks</a></td></tr><tr><td><code>agent/otel.ts</code></td><td><code>defineOtel</code> OTLP export (traces, metrics, optional logs)</td><td><a href="./../guides/opentelemetry.html">OpenTelemetry</a></td></tr><tr><td><code>agent/ab.ts</code>, <code>agent/ab/*.ts</code></td><td><code>defineAB</code> experiments with sticky variants and live metrics</td><td><a href="./../ab.html">Live A/B metrics</a></td></tr><tr><td><code>agent/ab.config.ts</code></td><td><code>defineABConfig</code> shared A/B settings</td><td><a href="./../ab.html">Live A/B metrics</a></td></tr><tr><td><code>agent/storage.ts</code></td><td><code>defineStorage</code> backend for the durable <code>host.kv</code> / <code>host.files</code> APIs</td><td><a href="./../storage.html">Storage</a></td></tr><tr><td><code>agent/artifacts.ts</code></td><td><code>defineArtifacts</code> kinds, the <code>tag_artifact</code> opt-in, and retention</td><td><a href="./artifacts.html">Artifacts</a></td></tr><tr><td><code>agent/schedules/*</code></td><td>Cron-driven runs (UTC, 5-field; never auto-fire under <code>--dev</code>)</td><td><a href="./schedules.html">Schedules</a></td></tr><tr><td><code>agent/sandbox/workspace/**</code></td><td>Seed files copied into each local session workspace</td><td><a href="./sessions.html#what-goes-into-a-local-session-workspace">Sessions</a></td></tr><tr><td><code>agent/playground/</code></td><td>Custom playground tool chips</td><td><a href="./playground.html">Playground</a></td></tr><tr><td><code>agent/lib/</code></td><td>Import-only shared code, never discovered</td><td>None</td></tr><tr><td><code>evals/evals.config.ts</code></td><td>Shared eval settings (e.g. <code>maxConcurrency</code>); required when evals exist</td><td><a href="./../evals.html">Evals</a></td></tr><tr><td><code>evals/**/*.eval.ts</code></td><td>Filesystem evals; case id = path under <code>evals/</code></td><td><a href="./../evals.html">Evals</a></td></tr></tbody></table><p><code>agent/lib/</code> is the only place for shared code. Everything else under <code>agent/</code> is discovery surface. A stray <code>.ts</code> file in one of these folders is treated as a definition.</p><h2 id="why-didn-t-the-agent-sdk-discover-my-file" tabindex="-1">Why didn&#39;t the Agent SDK discover my file? <a class="header-anchor" href="#why-didn-t-the-agent-sdk-discover-my-file" aria-label="Permalink to &quot;Why didn&#39;t the Agent SDK discover my file?&quot;">​</a></h2><p>Run <code>agent-sdk validate --dir .</code> and <code>agent-sdk info --dir .</code>. <code>validate</code> prints diagnostics, and <code>serve</code> refuses to start on error-severity ones. Warnings, such as cloud runtime combined with local-only capabilities, print but don&#39;t block. <code>info</code> lists the discovered surface, so a missing tool or channel shows up immediately. From there, check the folder reference: the file is usually in the wrong directory or has the wrong extension.</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> validate</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> .</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # diagnostics; non-zero exit on errors</span></span>
17
+ <span class="line"><span> └── readiness.eval.ts # regression cases</span></span></code></pre></div><p>Evals live in <code>evals/</code> at the project root, a sibling of <code>agent/</code>, never inside it. <code>agent/evals/</code> is silently ignored. See <a href="./../evals.html">Evals</a>.</p><h2 id="folder-reference" tabindex="-1">Folder reference <a class="header-anchor" href="#folder-reference" aria-label="Permalink to &quot;Folder reference&quot;">​</a></h2><p>Each path maps to a capability and a reference page.</p><table tabindex="0"><thead><tr><th>Path</th><th>What it is</th><th>Reference</th></tr></thead><tbody><tr><td><code>agent/agent.ts</code></td><td><code>defineAgent({ model?, runtime?, cloud?, local? })</code>; the model defaults to <code>grok-4.5</code> with <code>effort=high</code>, <code>fast=true</code></td><td><a href="./agent-config.html">Agent config</a></td></tr><tr><td><code>agent/instructions.md</code></td><td>Always-on system prompt, required on the root agent (<code>.ts</code> and directory forms exist)</td><td><a href="./instructions.html">Instructions</a></td></tr><tr><td><code>agent/tools/&lt;name&gt;.ts</code></td><td>One typed tool; filename = tool name. <code>execution: &quot;server&quot;</code> (in-process, default) or <code>&quot;agent&quot;</code> (a script that runs where the agent runs)</td><td><a href="./tools.html">Tools</a></td></tr><tr><td><code>agent/skills/*</code></td><td>SKILL.md-convention procedures, loaded on demand</td><td><a href="./skills.html">Skills</a></td></tr><tr><td><code>agent/mcp-connections/&lt;name&gt;.ts</code></td><td>MCP servers, available to the model, to server tools (<code>ctx.host.mcp</code>), and to channel/schedule handlers (<code>args.host.mcp</code>)</td><td><a href="./connections.html">MCP connections</a></td></tr><tr><td><code>agent/host-connections/&lt;name&gt;.ts</code></td><td>Privileged MCP servers for <code>ctx.host.mcp</code> and <code>mcp oauth</code>. The model never sees them.</td><td><a href="./connections.html">MCP connections</a></td></tr><tr><td><code>agent/subagents/&lt;id&gt;/</code></td><td>Child agent directory; <code>description</code> required</td><td><a href="./subagents.html">Subagents</a></td></tr><tr><td><code>agent/extensions/&lt;ns&gt;.ts</code> or <code>agent/extensions/&lt;ns&gt;/</code></td><td>A mounted extension or Cursor plugin; its contributions become <code>&lt;ns&gt;__&lt;name&gt;</code></td><td><a href="./extensions.html">Extensions</a></td></tr><tr><td><code>agent/channels/*.ts</code></td><td>HTTP surfaces beyond the built-in session API; <code>slack.ts</code> and <code>github.ts</code> use the platform packs</td><td><a href="./channels.html">Channels</a></td></tr><tr><td><code>agent/hooks/*.ts</code></td><td>Observe-only event subscribers, never fatal</td><td><a href="./hooks.html">Hooks</a></td></tr><tr><td><code>agent/otel.ts</code></td><td><code>defineOtel</code> OTLP export (traces, metrics, optional logs)</td><td><a href="./../guides/opentelemetry.html">OpenTelemetry</a></td></tr><tr><td><code>agent/ab.ts</code>, <code>agent/ab/*.ts</code></td><td><code>defineAB</code> experiments with sticky variants and live metrics</td><td><a href="./../ab.html">Live A/B metrics</a></td></tr><tr><td><code>agent/ab.config.ts</code></td><td><code>defineABConfig</code> shared A/B settings</td><td><a href="./../ab.html">Live A/B metrics</a></td></tr><tr><td><code>agent/storage.ts</code></td><td><code>defineStorage</code> backend for the durable <code>host.kv</code> / <code>host.files</code> APIs</td><td><a href="./../storage.html">Storage</a></td></tr><tr><td><code>agent/artifacts.ts</code></td><td><code>defineArtifacts</code> kinds, the <code>tag_artifact</code> opt-in, and retention</td><td><a href="./artifacts.html">Artifacts</a></td></tr><tr><td><code>agent/result.ts</code></td><td><code>defineResult</code> host <code>commit</code> on the final assistant text</td><td><a href="./result.html">Turn result</a></td></tr><tr><td><code>agent/schedules/*</code></td><td>Cron-driven runs (UTC, 5-field; never auto-fire under <code>--dev</code>)</td><td><a href="./schedules.html">Schedules</a></td></tr><tr><td><code>agent/sandbox/workspace/**</code></td><td>Seed files copied into each local session workspace</td><td><a href="./sessions.html#what-goes-into-a-local-session-workspace">Sessions</a></td></tr><tr><td><code>agent/playground/</code></td><td>Custom playground tool chips</td><td><a href="./playground.html">Playground</a></td></tr><tr><td><code>agent/lib/</code></td><td>Import-only shared code, never discovered</td><td>None</td></tr><tr><td><code>evals/evals.config.ts</code></td><td>Shared eval settings (e.g. <code>maxConcurrency</code>); required when evals exist</td><td><a href="./../evals.html">Evals</a></td></tr><tr><td><code>evals/**/*.eval.ts</code></td><td>Filesystem evals; case id = path under <code>evals/</code></td><td><a href="./../evals.html">Evals</a></td></tr></tbody></table><p><code>agent/lib/</code> is the only place for shared code. Everything else under <code>agent/</code> is discovery surface. A stray <code>.ts</code> file in one of these folders is treated as a definition.</p><h2 id="why-didn-t-the-agent-sdk-discover-my-file" tabindex="-1">Why didn&#39;t the Agent SDK discover my file? <a class="header-anchor" href="#why-didn-t-the-agent-sdk-discover-my-file" aria-label="Permalink to &quot;Why didn&#39;t the Agent SDK discover my file?&quot;">​</a></h2><p>Run <code>agent-sdk validate --dir .</code> and <code>agent-sdk info --dir .</code>. <code>validate</code> prints diagnostics, and <code>serve</code> refuses to start on error-severity ones. Warnings, such as cloud runtime combined with local-only capabilities, print but don&#39;t block. <code>info</code> lists the discovered surface, so a missing tool or channel shows up immediately. From there, check the folder reference: the file is usually in the wrong directory or has the wrong extension.</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> validate</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> .</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # diagnostics; non-zero exit on errors</span></span>
18
18
  <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> info</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> .</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # human-readable surface</span></span>
19
19
  <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> info</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> .</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --json</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # machine-readable project info (same shape as GET /v1/info)</span></span></code></pre></div><h2 id="what-s-next" tabindex="-1">What&#39;s next <a class="header-anchor" href="#what-s-next" aria-label="Permalink to &quot;What&#39;s next&quot;">​</a></h2><p>Continue with these pages:</p><ul><li><a href="./agent-config.html">Agent config</a>: the runtime config at the root</li><li><a href="./tools.html">Tools</a>: add typed actions under <code>agent/tools/</code></li><li><a href="./../ab.html">Live A/B metrics</a>: compare variants from <code>agent/ab.ts</code> or <code>agent/ab/</code></li><li><a href="./../concepts.html">Concepts</a>: why the filesystem is the interface</li></ul>`,20)])])}const u=t(o,[["render",n]]);export{g as __pageData,u as default};
@@ -1 +1 @@
1
- import{_ as t,c as a,o as s,ag as d}from"./chunks/framework.BCISBCiQ.js";const g=JSON.parse('{"title":"Project layout","description":"The folder structure under agent/ and the path-derived naming rule.","frontmatter":{"title":"Project layout","description":"The folder structure under agent/ and the path-derived naming rule."},"headers":[],"relativePath":"reference/project-layout.md","filePath":"reference/project-layout.md"}'),o={name:"reference/project-layout.md"};function n(r,e,i,c,l,h){return s(),a("div",null,[...e[0]||(e[0]=[d("",20)])])}const u=t(o,[["render",n]]);export{g as __pageData,u as default};
1
+ import{_ as t,c as s,o as a,ag as d}from"./chunks/framework.BCISBCiQ.js";const g=JSON.parse('{"title":"Project layout","description":"The folder structure under agent/ and the path-derived naming rule.","frontmatter":{"title":"Project layout","description":"The folder structure under agent/ and the path-derived naming rule."},"headers":[],"relativePath":"reference/project-layout.md","filePath":"reference/project-layout.md"}'),o={name:"reference/project-layout.md"};function n(r,e,i,c,l,h){return a(),s("div",null,[...e[0]||(e[0]=[d("",20)])])}const u=t(o,[["render",n]]);export{g as __pageData,u as default};
@@ -0,0 +1,19 @@
1
+ import{_ as t,c as i,o as e,ag as a}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Turn result","description":"Run host code on the final assistant text when a turn finishes. Throw to fail the turn.","frontmatter":{"title":"Turn result","description":"Run host code on the final assistant text when a turn finishes. Throw to fail the turn."},"headers":[],"relativePath":"reference/result.md","filePath":"reference/result.md"}'),n={name:"reference/result.md"};function h(l,s,r,o,d,p){return e(),i("div",null,[...s[0]||(s[0]=[a(`<h1 id="turn-result" tabindex="-1">Turn result <a class="header-anchor" href="#turn-result" aria-label="Permalink to &quot;Turn result&quot;">​</a></h1><p>Judgment agents need a place to act on the model&#39;s last message: parse it, then page, comment, or close a ticket. Author <code>agent/result.ts</code> with <code>defineResult</code> from <code>@cursor/july/result</code>. When that file exists, every finished turn runs <code>commit</code> on the serving host with the full assistant text.</p><p>A thrown <code>commit</code> fails the turn. Empty assistant text fails it too. Hooks still observe only; they cannot fail a valid turn.</p><p>Use this for an end-of-turn actuation. Mid-turn actions belong in <a href="./tools.html">tools</a>. Durable records that outlive a session belong in <a href="./artifacts.html">artifacts</a>.</p><h2 id="author-agent-result-ts" tabindex="-1">Author <code>agent/result.ts</code> <a class="header-anchor" href="#author-agent-result-ts" aria-label="Permalink to &quot;Author \`agent/result.ts\`&quot;">​</a></h2><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineResult } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@cursor/july/result&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
2
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { applyDecision, parseDecision } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;./lib/actuate.js&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
3
+ <span class="line"></span>
4
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineResult</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
5
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> async</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> commit</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">ctx</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
6
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (ctx.session.purpose </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">===</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;eval&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
7
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
8
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
9
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> applyDecision</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">parseDecision</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(ctx.text), ctx.host);</span></span>
10
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
11
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p><code>commit</code> is required. Parse <code>ctx.text</code> however the agent needs. Tell the model the document shape in <code>instructions.md</code>. The Agent SDK does not inject a schema.</p><p>Put <code>result.ts</code> on the root agent only. A copy under a subagent is ignored with a warning.</p><h2 id="commit-on-the-host" tabindex="-1">Commit on the host <a class="header-anchor" href="#commit-on-the-host" aria-label="Permalink to &quot;Commit on the host&quot;">​</a></h2><p><code>commit</code> runs in the serving process after the model finishes, before the turn completes. <code>ctx</code> is the same host surface a server tool gets, plus the turn text:</p><table tabindex="0"><thead><tr><th>Member</th><th>What it is</th></tr></thead><tbody><tr><td><code>ctx.session</code></td><td>The session that produced this turn, including <code>purpose</code></td></tr><tr><td><code>ctx.host</code></td><td>Shared host services (<code>kv</code>, <code>files</code>, <code>mcp</code>)</td></tr><tr><td><code>ctx.artifacts</code></td><td>Session-bound <a href="./artifacts.html">artifacts</a> facade</td></tr><tr><td><code>ctx.stateRoot</code></td><td>The agent&#39;s durable state root</td></tr><tr><td><code>ctx.workspaceDir</code></td><td>The session workspace</td></tr><tr><td><code>ctx.text</code></td><td>The full assistant string</td></tr></tbody></table><p>A dry-run session skips <code>commit</code> and still completes. Eval sessions do run <code>commit</code>; return early when <code>ctx.session.purpose === &quot;eval&quot;</code> if the handler must not actuate.</p><p>On cloud runtime, the model still runs on the VM. <code>commit</code> runs on the serving host after the turn returns.</p><p><code>GET /v1/info</code> reports <code>result: true</code> when the file is authored.</p><h2 id="assert-in-evals" tabindex="-1">Assert in evals <a class="header-anchor" href="#assert-in-evals" aria-label="Permalink to &quot;Assert in evals&quot;">​</a></h2><p><code>t.succeeded()</code> fails when <code>commit</code> throws or the turn produced no text, because those are turn failures. Read the document on <code>t.reply</code>.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineEval, includes } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@cursor/july/evals&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
12
+ <span class="line"></span>
13
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineEval</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
14
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> async</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> test</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
15
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> t.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">send</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Triage LIN-1842. It duplicates LIN-1801.&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
16
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> t.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">succeeded</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span>
17
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> t.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">check</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(t.reply, </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">includes</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;duplicate&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">));</span></span>
18
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
19
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><h2 id="what-s-next" tabindex="-1">What&#39;s next <a class="header-anchor" href="#what-s-next" aria-label="Permalink to &quot;What&#39;s next&quot;">​</a></h2><p>Continue with these pages:</p><ul><li><a href="./../evals.html">Evals</a>: <code>t.succeeded</code> and <code>t.reply</code></li><li><a href="./sessions.html">Sessions and streaming</a>: <code>turn.completed</code> and <code>turn.failed</code></li><li><a href="./hooks.html">Hooks</a>: observe the stream after the turn has already settled</li><li><a href="./project-layout.html">Project layout</a>: where <code>agent/result.ts</code> lives</li></ul>`,20)])])}const u=t(n,[["render",h]]);export{k as __pageData,u as default};
@@ -0,0 +1 @@
1
+ import{_ as t,c as i,o as e,ag as a}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Turn result","description":"Run host code on the final assistant text when a turn finishes. Throw to fail the turn.","frontmatter":{"title":"Turn result","description":"Run host code on the final assistant text when a turn finishes. Throw to fail the turn."},"headers":[],"relativePath":"reference/result.md","filePath":"reference/result.md"}'),n={name:"reference/result.md"};function h(l,s,r,o,d,p){return e(),i("div",null,[...s[0]||(s[0]=[a("",20)])])}const u=t(n,[["render",h]]);export{k as __pageData,u as default};