@cursor/july 0.1.105 → 0.1.108

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 (395) hide show
  1. package/README.md +10 -5
  2. package/dist/bin/agent-serve.js +31 -16
  3. package/dist/channels/bitbucket/types.d.ts +2 -4
  4. package/dist/channels/bitbucket/types.d.ts.map +1 -1
  5. package/dist/channels/deployments/types.d.ts +5 -8
  6. package/dist/channels/deployments/types.d.ts.map +1 -1
  7. package/dist/channels/github/github-channel.js +8 -5
  8. package/dist/channels/github/types.d.ts +7 -5
  9. package/dist/channels/github/types.d.ts.map +1 -1
  10. package/dist/channels/gitlab/types.d.ts +2 -5
  11. package/dist/channels/gitlab/types.d.ts.map +1 -1
  12. package/dist/channels/origin/origin-channel.d.ts.map +1 -1
  13. package/dist/channels/origin/origin-channel.js +27 -13
  14. package/dist/channels/origin/types.d.ts +7 -4
  15. package/dist/channels/origin/types.d.ts.map +1 -1
  16. package/dist/channels/slack/defaults.d.ts.map +1 -1
  17. package/dist/channels/slack/defaults.js +3 -0
  18. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  19. package/dist/channels/slack/dispatch.js +1 -1
  20. package/dist/channels/slack/live-delivery.d.ts.map +1 -1
  21. package/dist/channels/slack/live-delivery.js +48 -11
  22. package/dist/channels/slack/types.d.ts +4 -3
  23. package/dist/channels/slack/types.d.ts.map +1 -1
  24. package/dist/channels.d.ts +45 -0
  25. package/dist/channels.d.ts.map +1 -1
  26. package/dist/channels.js +106 -7
  27. package/dist/connections.d.ts +2 -1
  28. package/dist/connections.d.ts.map +1 -1
  29. package/dist/connections.js +2 -1
  30. package/dist/docs/404.html +3 -3
  31. package/dist/docs/ab.html +6 -6
  32. package/dist/docs/assets/{app.BVwaffdK.js → app.BASKM3M4.js} +1 -1
  33. package/dist/docs/assets/chunks/@localSearchIndexroot.BHZYsNVi.js +1 -0
  34. package/dist/docs/assets/chunks/{VPLocalSearchBox.WuWTZ1x8.js → VPLocalSearchBox.BOKxlYGP.js} +2 -2
  35. package/dist/docs/assets/chunks/{theme.BYdI_6sF.js → theme.DbDZW-zb.js} +2 -2
  36. package/dist/docs/assets/{deployment.md.MFPKqsqI.js → deployment.md.JenwuCCB.js} +4 -4
  37. package/dist/docs/assets/{deployment.md.MFPKqsqI.lean.js → deployment.md.JenwuCCB.lean.js} +1 -1
  38. package/dist/docs/assets/{evals.md.CbMoebP1.js → evals.md.C1ekS3k2.js} +1 -1
  39. package/dist/docs/assets/guides_cloud-agents.md.BsloyHdY.js +9 -0
  40. package/dist/docs/assets/{guides_cloud-agents.md.DS8RIjwx.lean.js → guides_cloud-agents.md.BsloyHdY.lean.js} +1 -1
  41. package/dist/docs/assets/{guides_github.md.c0gdGJ-D.js → guides_github.md.BH33UEBJ.js} +1 -1
  42. package/dist/docs/assets/{guides_grokbot-agents.md.DVqdhBKb.js → guides_grokbot-agents.md.DyV-WArv.js} +1 -1
  43. package/dist/docs/assets/guides_improve.md.BGVk32bK.js +14 -0
  44. package/dist/docs/assets/guides_improve.md.BGVk32bK.lean.js +1 -0
  45. package/dist/docs/assets/{guides_opentelemetry.md.COh9jFVg.js → guides_opentelemetry.md.SCRMskno.js} +3 -3
  46. package/dist/docs/assets/{guides_opentelemetry.md.COh9jFVg.lean.js → guides_opentelemetry.md.SCRMskno.lean.js} +1 -1
  47. package/dist/docs/assets/{guides_slack.md.9oHPye9o.js → guides_slack.md.D4RVMM4G.js} +3 -3
  48. package/dist/docs/assets/{guides_slack.md.9oHPye9o.lean.js → guides_slack.md.D4RVMM4G.lean.js} +1 -1
  49. package/dist/docs/assets/index.md.BjH1w2ZW.js +5 -0
  50. package/dist/docs/assets/{reference_agent-config.md.CHNpiyp4.js → reference_agent-config.md.CvoL6pof.js} +1 -1
  51. package/dist/docs/assets/{reference_channels.md.DBGcaB7m.js → reference_channels.md.D-qTqwcq.js} +2 -2
  52. package/dist/docs/assets/{reference_channels.md.DBGcaB7m.lean.js → reference_channels.md.D-qTqwcq.lean.js} +1 -1
  53. package/dist/docs/assets/{reference_cli.md.C6Lo8SEd.js → reference_cli.md.Ca26u0Es.js} +6 -6
  54. package/dist/docs/assets/{reference_cli.md.C6Lo8SEd.lean.js → reference_cli.md.Ca26u0Es.lean.js} +1 -1
  55. package/dist/docs/assets/{reference_connections.md.Di6jJAXF.js → reference_connections.md.BojkC6c5.js} +1 -1
  56. package/dist/docs/assets/{reference_extensions.md.CGmMLblt.js → reference_extensions.md.CPWt00ds.js} +1 -1
  57. package/dist/docs/assets/{scaffolding-agents.md.em43xlY1.js → scaffolding-agents.md.Kctn3OVb.js} +1 -1
  58. package/dist/docs/assets/{skills_create-agent.md.BVoWPcan.js → skills_create-agent.md.Q3h6Je-e.js} +1 -1
  59. package/dist/docs/assets/{skills_debug.md.CDbPhHfg.js → skills_debug.md.CVjCXMFF.js} +1 -1
  60. package/dist/docs/assets/{skills_debug.md.CDbPhHfg.lean.js → skills_debug.md.CVjCXMFF.lean.js} +1 -1
  61. package/dist/docs/assets/{skills_evals.md.723kpUmA.js → skills_evals.md.BhovOvrl.js} +1 -1
  62. package/dist/docs/assets/skills_framework-map.md.D-tFZhFS.js +1 -0
  63. package/dist/docs/assets/{skills_framework-map.md.haibFyoB.lean.js → skills_framework-map.md.D-tFZhFS.lean.js} +1 -1
  64. package/dist/docs/assets/{skills_github.md.D0JahM8c.js → skills_github.md.hgFX_oKY.js} +1 -1
  65. package/dist/docs/assets/{skills_otel.md.CqhobH3B.js → skills_otel.md.B5Ddv1xH.js} +1 -1
  66. package/dist/docs/assets/{style.BRuM8477.css → style.DCD_zyg3.css} +1 -1
  67. package/dist/docs/assets/troubleshooting.md.CYEAO9bM.js +1 -0
  68. package/dist/docs/building-with-agents.html +6 -6
  69. package/dist/docs/concepts.html +5 -5
  70. package/dist/docs/deployment.html +9 -9
  71. package/dist/docs/deployment.md +7 -2
  72. package/dist/docs/evals.html +8 -8
  73. package/dist/docs/evals.md +3 -2
  74. package/dist/docs/guides/agent-to-agent.html +6 -6
  75. package/dist/docs/guides/cloud-agents.html +7 -7
  76. package/dist/docs/guides/cloud-agents.md +4 -3
  77. package/dist/docs/guides/convert-automation.html +6 -6
  78. package/dist/docs/guides/github.html +7 -7
  79. package/dist/docs/guides/github.md +2 -1
  80. package/dist/docs/guides/grokbot-agents.html +7 -7
  81. package/dist/docs/guides/grokbot-agents.md +2 -2
  82. package/dist/docs/guides/human-in-the-loop.html +6 -6
  83. package/dist/docs/guides/improve.html +40 -0
  84. package/dist/docs/guides/improve.md +91 -0
  85. package/dist/docs/guides/mcp-oauth.html +6 -6
  86. package/dist/docs/guides/opentelemetry.html +8 -8
  87. package/dist/docs/guides/opentelemetry.md +3 -4
  88. package/dist/docs/guides/slack.html +8 -8
  89. package/dist/docs/guides/slack.md +2 -1
  90. package/dist/docs/guides/webhooks.html +6 -6
  91. package/dist/docs/hashmap.json +1 -1
  92. package/dist/docs/hillclimbing.html +6 -6
  93. package/dist/docs/index.html +8 -8
  94. package/dist/docs/index.md +4 -0
  95. package/dist/docs/llms-full.txt +180 -61
  96. package/dist/docs/llms.txt +1 -0
  97. package/dist/docs/quickstart.html +6 -6
  98. package/dist/docs/reference/agent-config.html +7 -7
  99. package/dist/docs/reference/agent-config.md +5 -2
  100. package/dist/docs/reference/artifacts.html +6 -6
  101. package/dist/docs/reference/channels.html +7 -7
  102. package/dist/docs/reference/channels.md +11 -19
  103. package/dist/docs/reference/cli.html +11 -11
  104. package/dist/docs/reference/cli.md +23 -13
  105. package/dist/docs/reference/connections.html +8 -8
  106. package/dist/docs/reference/connections.md +2 -1
  107. package/dist/docs/reference/extensions.html +7 -7
  108. package/dist/docs/reference/extensions.md +2 -0
  109. package/dist/docs/reference/hooks.html +6 -6
  110. package/dist/docs/reference/http-api.html +6 -6
  111. package/dist/docs/reference/instructions.html +6 -6
  112. package/dist/docs/reference/playground.html +5 -5
  113. package/dist/docs/reference/project-layout.html +6 -6
  114. package/dist/docs/reference/prompt.html +6 -6
  115. package/dist/docs/reference/result.html +6 -6
  116. package/dist/docs/reference/schedules.html +6 -6
  117. package/dist/docs/reference/sessions.html +5 -5
  118. package/dist/docs/reference/skills.html +6 -6
  119. package/dist/docs/reference/subagents.html +6 -6
  120. package/dist/docs/reference/tools.html +6 -6
  121. package/dist/docs/scaffolding-agents.html +6 -6
  122. package/dist/docs/scaffolding-agents.md +2 -1
  123. package/dist/docs/skills/ab.html +6 -6
  124. package/dist/docs/skills/create-agent.html +8 -8
  125. package/dist/docs/skills/create-agent.md +1 -1
  126. package/dist/docs/skills/debug.html +6 -6
  127. package/dist/docs/skills/debug.md +1 -1
  128. package/dist/docs/skills/evals.html +8 -8
  129. package/dist/docs/skills/evals.md +1 -1
  130. package/dist/docs/skills/framework-map.html +6 -6
  131. package/dist/docs/skills/framework-map.md +4 -2
  132. package/dist/docs/skills/github.html +8 -8
  133. package/dist/docs/skills/github.md +1 -1
  134. package/dist/docs/skills/hillclimb.html +6 -6
  135. package/dist/docs/skills/index.html +5 -5
  136. package/dist/docs/skills/mcp-auth.html +6 -6
  137. package/dist/docs/skills/otel.html +8 -8
  138. package/dist/docs/skills/otel.md +3 -3
  139. package/dist/docs/skills/setup-slack.html +6 -6
  140. package/dist/docs/storage.html +6 -6
  141. package/dist/docs/templates/agentic-owners.html +6 -6
  142. package/dist/docs/templates/agents-md.html +6 -6
  143. package/dist/docs/templates/code-wiki.html +6 -6
  144. package/dist/docs/templates/demo.html +6 -6
  145. package/dist/docs/templates/grokbot-agents.html +6 -6
  146. package/dist/docs/templates/pr-autofixer.html +6 -6
  147. package/dist/docs/templates/security-help.html +6 -6
  148. package/dist/docs/templates/security-reviewer.html +6 -6
  149. package/dist/docs/templates/triage.html +6 -6
  150. package/dist/docs/troubleshooting.html +6 -6
  151. package/dist/docs/troubleshooting.md +1 -1
  152. package/dist/extensions/improve/extension.d.ts +46 -0
  153. package/dist/extensions/improve/extension.d.ts.map +1 -0
  154. package/dist/extensions/improve/extension.js +41 -0
  155. package/dist/extensions/improve/skills/yourself.d.ts +4 -0
  156. package/dist/extensions/improve/skills/yourself.d.ts.map +1 -0
  157. package/dist/extensions/improve/skills/yourself.js +43 -0
  158. package/dist/index.d.ts +4 -5
  159. package/dist/index.d.ts.map +1 -1
  160. package/dist/index.js +3 -4
  161. package/dist/internal/builtin-tools/artifacts.d.ts.map +1 -1
  162. package/dist/internal/builtin-tools/artifacts.js +2 -3
  163. package/dist/internal/channel-route-dispatch.d.ts +13 -0
  164. package/dist/internal/channel-route-dispatch.d.ts.map +1 -0
  165. package/dist/internal/channel-route-dispatch.js +62 -0
  166. package/dist/internal/channel-state.d.ts +17 -0
  167. package/dist/internal/channel-state.d.ts.map +1 -0
  168. package/dist/internal/channel-state.js +78 -0
  169. package/dist/internal/cli-ax.d.ts +7 -0
  170. package/dist/internal/cli-ax.d.ts.map +1 -1
  171. package/dist/internal/cli-ax.js +99 -1
  172. package/dist/internal/cli-cursor.d.ts.map +1 -1
  173. package/dist/internal/cli-cursor.js +2 -0
  174. package/dist/internal/cli-deploy.d.ts.map +1 -1
  175. package/dist/internal/cli-deploy.js +61 -25
  176. package/dist/internal/cli-mcp-oauth.d.ts.map +1 -1
  177. package/dist/internal/cli-mcp-oauth.js +15 -0
  178. package/dist/internal/cli-mcp.d.ts.map +1 -1
  179. package/dist/internal/cli-mcp.js +12 -0
  180. package/dist/internal/cli-slack.d.ts.map +1 -1
  181. package/dist/internal/cli-slack.js +8 -2
  182. package/dist/internal/cursor/backend-client.d.ts +25 -0
  183. package/dist/internal/cursor/backend-client.d.ts.map +1 -1
  184. package/dist/internal/cursor/backend-client.js +57 -2
  185. package/dist/internal/cursor/credentials.d.ts +8 -2
  186. package/dist/internal/cursor/credentials.d.ts.map +1 -1
  187. package/dist/internal/cursor/credentials.js +27 -5
  188. package/dist/internal/deploy-client.d.ts +35 -0
  189. package/dist/internal/deploy-client.d.ts.map +1 -1
  190. package/dist/internal/deploy-client.js +46 -0
  191. package/dist/internal/deploy-manifest.d.ts +26 -0
  192. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  193. package/dist/internal/deploy-manifest.js +99 -13
  194. package/dist/internal/describe-error.d.ts +1 -0
  195. package/dist/internal/describe-error.d.ts.map +1 -1
  196. package/dist/internal/describe-error.js +25 -0
  197. package/dist/internal/discovery/agent.d.ts.map +1 -1
  198. package/dist/internal/discovery/agent.js +1 -0
  199. package/dist/internal/discovery/info.d.ts.map +1 -1
  200. package/dist/internal/discovery/info.js +7 -3
  201. package/dist/internal/discovery/modules.d.ts +1 -1
  202. package/dist/internal/discovery/modules.d.ts.map +1 -1
  203. package/dist/internal/discovery/modules.js +1 -0
  204. package/dist/internal/discovery/project.d.ts.map +1 -1
  205. package/dist/internal/discovery/project.js +3 -0
  206. package/dist/internal/discovery/reminders.d.ts +7 -0
  207. package/dist/internal/discovery/reminders.d.ts.map +1 -0
  208. package/dist/internal/discovery/reminders.js +65 -0
  209. package/dist/internal/discovery/subagent.js +1 -0
  210. package/dist/internal/distribution.d.ts +5 -0
  211. package/dist/internal/distribution.d.ts.map +1 -1
  212. package/dist/internal/distribution.js +17 -0
  213. package/dist/internal/framework-storage-selection.d.ts +14 -3
  214. package/dist/internal/framework-storage-selection.d.ts.map +1 -1
  215. package/dist/internal/framework-storage-selection.js +36 -6
  216. package/dist/internal/guest-network.d.ts +4 -10
  217. package/dist/internal/guest-network.d.ts.map +1 -1
  218. package/dist/internal/guest-network.js +44 -26
  219. package/dist/internal/hosted-admission-adapter.d.ts +2 -0
  220. package/dist/internal/hosted-admission-adapter.d.ts.map +1 -1
  221. package/dist/internal/hosted-catch-protocol.d.ts +51 -0
  222. package/dist/internal/hosted-catch-protocol.d.ts.map +1 -0
  223. package/dist/internal/hosted-catch-protocol.js +103 -0
  224. package/dist/internal/hosted-catch.d.ts +40 -0
  225. package/dist/internal/hosted-catch.d.ts.map +1 -0
  226. package/dist/internal/hosted-catch.js +149 -0
  227. package/dist/internal/hosted-delivery-protocol.d.ts +89 -0
  228. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  229. package/dist/internal/hosted-delivery-protocol.js +309 -0
  230. package/dist/internal/hosted-delivery.d.ts +20 -1
  231. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  232. package/dist/internal/hosted-delivery.js +179 -36
  233. package/dist/internal/hosted-execution-diag.d.ts +4 -1
  234. package/dist/internal/hosted-execution-diag.d.ts.map +1 -1
  235. package/dist/internal/hosted-execution-diag.js +13 -4
  236. package/dist/internal/hosted-execution-flush.d.ts +3 -0
  237. package/dist/internal/hosted-execution-flush.d.ts.map +1 -1
  238. package/dist/internal/hosted-execution-flush.js +2 -4
  239. package/dist/internal/http-control-plane-session.d.ts +30 -0
  240. package/dist/internal/http-control-plane-session.d.ts.map +1 -0
  241. package/dist/internal/http-control-plane-session.js +83 -0
  242. package/dist/internal/legacy-command-guard.d.ts +22 -0
  243. package/dist/internal/legacy-command-guard.d.ts.map +1 -0
  244. package/dist/internal/legacy-command-guard.js +51 -0
  245. package/dist/internal/local-control-plane.d.ts +18 -2
  246. package/dist/internal/local-control-plane.d.ts.map +1 -1
  247. package/dist/internal/local-control-plane.js +199 -17
  248. package/dist/internal/platform-timers.d.ts +7 -0
  249. package/dist/internal/platform-timers.d.ts.map +1 -1
  250. package/dist/internal/platform-timers.js +139 -0
  251. package/dist/internal/reminder-control-plane-protocol.d.ts +189 -0
  252. package/dist/internal/reminder-control-plane-protocol.d.ts.map +1 -0
  253. package/dist/internal/reminder-control-plane-protocol.js +251 -0
  254. package/dist/internal/reminder-runner.d.ts +56 -6
  255. package/dist/internal/reminder-runner.d.ts.map +1 -1
  256. package/dist/internal/reminder-runner.js +372 -57
  257. package/dist/internal/reminder-schedule.d.ts +5 -2
  258. package/dist/internal/reminder-schedule.d.ts.map +1 -1
  259. package/dist/internal/reminder-schedule.js +8 -6
  260. package/dist/internal/reminder-store.d.ts +24 -7
  261. package/dist/internal/reminder-store.d.ts.map +1 -1
  262. package/dist/internal/reminder-store.js +6 -5
  263. package/dist/internal/request-error-status.d.ts +2 -0
  264. package/dist/internal/request-error-status.d.ts.map +1 -1
  265. package/dist/internal/request-error-status.js +22 -3
  266. package/dist/internal/resolve-prod-target.d.ts +2 -0
  267. package/dist/internal/resolve-prod-target.d.ts.map +1 -1
  268. package/dist/internal/resolve-prod-target.js +13 -0
  269. package/dist/internal/scm/pr-url.d.ts +40 -0
  270. package/dist/internal/scm/pr-url.d.ts.map +1 -1
  271. package/dist/internal/scm/pr-url.js +93 -14
  272. package/dist/internal/sdk-runner.d.ts.map +1 -1
  273. package/dist/internal/sdk-runner.js +4 -3
  274. package/dist/internal/server.d.ts.map +1 -1
  275. package/dist/internal/server.js +118 -77
  276. package/dist/internal/session-engine.d.ts +6 -6
  277. package/dist/internal/session-engine.d.ts.map +1 -1
  278. package/dist/internal/session-engine.js +100 -67
  279. package/dist/playground/assets/{index-BaQzjaNK.js → index-BMDqAeXu.js} +34 -34
  280. package/dist/playground/assets/index-LUgJoWdL.css +1 -0
  281. package/dist/playground/index.html +2 -2
  282. package/dist/reminders.d.ts +24 -5
  283. package/dist/reminders.d.ts.map +1 -1
  284. package/dist/reminders.js +28 -5
  285. package/dist/storage-backends/cursor-hosted.d.ts +6 -0
  286. package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
  287. package/dist/storage-backends/cursor-hosted.js +29 -1
  288. package/dist/types.d.ts +122 -25
  289. package/dist/types.d.ts.map +1 -1
  290. package/docs/README.md +4 -0
  291. package/docs/deployment.md +7 -2
  292. package/docs/evals.md +3 -2
  293. package/docs/guides/cloud-agents.md +4 -3
  294. package/docs/guides/github.md +2 -1
  295. package/docs/guides/grokbot-agents.md +2 -2
  296. package/docs/guides/improve.md +96 -0
  297. package/docs/guides/opentelemetry.md +3 -4
  298. package/docs/guides/slack.md +2 -1
  299. package/docs/reference/agent-config.md +5 -2
  300. package/docs/reference/channels.md +11 -19
  301. package/docs/reference/cli.md +23 -13
  302. package/docs/reference/connections.md +2 -1
  303. package/docs/reference/extensions.md +2 -0
  304. package/docs/scaffolding-agents.md +2 -1
  305. package/docs/troubleshooting.md +1 -1
  306. package/package.json +10 -3
  307. package/skills/create-agent/SKILL.md +1 -1
  308. package/skills/debug/SKILL.md +1 -1
  309. package/skills/evals/SKILL.md +1 -1
  310. package/skills/framework-map/SKILL.md +4 -2
  311. package/skills/github/SKILL.md +1 -1
  312. package/skills/otel/SKILL.md +3 -3
  313. package/src/bin/agent-serve.ts +28 -11
  314. package/src/channels/bitbucket/types.ts +2 -4
  315. package/src/channels/deployments/types.ts +5 -8
  316. package/src/channels/github/github-channel.ts +8 -8
  317. package/src/channels/github/types.ts +7 -4
  318. package/src/channels/gitlab/types.ts +2 -5
  319. package/src/channels/origin/origin-channel.ts +29 -13
  320. package/src/channels/origin/types.ts +7 -3
  321. package/src/channels/slack/defaults.ts +3 -0
  322. package/src/channels/slack/dispatch.ts +1 -0
  323. package/src/channels/slack/live-delivery.ts +53 -12
  324. package/src/channels/slack/types.ts +4 -3
  325. package/src/channels.ts +157 -10
  326. package/src/connections.ts +2 -1
  327. package/src/extensions/improve/extension.ts +70 -0
  328. package/src/extensions/improve/skills/yourself.ts +50 -0
  329. package/src/index.ts +6 -3
  330. package/src/internal/builtin-tools/artifacts.ts +2 -3
  331. package/src/internal/channel-route-dispatch.ts +66 -0
  332. package/src/internal/channel-state.ts +96 -0
  333. package/src/internal/cli-ax.ts +110 -1
  334. package/src/internal/cli-cursor.ts +4 -1
  335. package/src/internal/cli-deploy.ts +80 -22
  336. package/src/internal/cli-mcp-oauth.ts +18 -0
  337. package/src/internal/cli-mcp.ts +11 -0
  338. package/src/internal/cli-slack.ts +15 -2
  339. package/src/internal/cursor/backend-client.ts +90 -2
  340. package/src/internal/cursor/credentials.ts +35 -7
  341. package/src/internal/deploy-client.ts +70 -0
  342. package/src/internal/deploy-manifest.ts +131 -12
  343. package/src/internal/describe-error.ts +28 -0
  344. package/src/internal/discovery/agent.ts +1 -0
  345. package/src/internal/discovery/info.ts +6 -0
  346. package/src/internal/discovery/modules.ts +2 -4
  347. package/src/internal/discovery/project.ts +3 -0
  348. package/src/internal/discovery/reminders.ts +65 -0
  349. package/src/internal/discovery/subagent.ts +1 -0
  350. package/src/internal/distribution.ts +20 -0
  351. package/src/internal/framework-storage-selection.ts +43 -6
  352. package/src/internal/guest-network.ts +46 -29
  353. package/src/internal/hosted-admission-adapter.ts +2 -0
  354. package/src/internal/hosted-catch-protocol.ts +130 -0
  355. package/src/internal/hosted-catch.ts +192 -0
  356. package/src/internal/hosted-delivery-protocol.ts +483 -0
  357. package/src/internal/hosted-delivery.ts +303 -43
  358. package/src/internal/hosted-execution-diag.ts +21 -3
  359. package/src/internal/hosted-execution-flush.ts +6 -3
  360. package/src/internal/http-control-plane-session.ts +104 -0
  361. package/src/internal/legacy-command-guard.ts +59 -0
  362. package/src/internal/local-control-plane.ts +281 -22
  363. package/src/internal/platform-timers.ts +191 -0
  364. package/src/internal/reminder-control-plane-protocol.ts +512 -0
  365. package/src/internal/reminder-runner.ts +481 -57
  366. package/src/internal/reminder-schedule.ts +11 -6
  367. package/src/internal/reminder-store.ts +27 -7
  368. package/src/internal/request-error-status.ts +27 -3
  369. package/src/internal/resolve-prod-target.ts +15 -0
  370. package/src/internal/scm/pr-url.ts +167 -20
  371. package/src/internal/sdk-runner.ts +2 -1
  372. package/src/internal/server.ts +151 -88
  373. package/src/internal/session-engine.ts +146 -83
  374. package/src/reminders.ts +35 -4
  375. package/src/storage-backends/cursor-hosted.ts +40 -1
  376. package/src/types.ts +134 -26
  377. package/dist/docs/assets/chunks/@localSearchIndexroot.CJxMklAy.js +0 -1
  378. package/dist/docs/assets/guides_cloud-agents.md.DS8RIjwx.js +0 -9
  379. package/dist/docs/assets/index.md.BW_6tOgR.js +0 -5
  380. package/dist/docs/assets/skills_framework-map.md.haibFyoB.js +0 -1
  381. package/dist/docs/assets/troubleshooting.md.Cus_YZga.js +0 -1
  382. package/dist/playground/assets/index-CceqnLTX.css +0 -1
  383. /package/dist/docs/assets/{evals.md.CbMoebP1.lean.js → evals.md.C1ekS3k2.lean.js} +0 -0
  384. /package/dist/docs/assets/{guides_github.md.c0gdGJ-D.lean.js → guides_github.md.BH33UEBJ.lean.js} +0 -0
  385. /package/dist/docs/assets/{guides_grokbot-agents.md.DVqdhBKb.lean.js → guides_grokbot-agents.md.DyV-WArv.lean.js} +0 -0
  386. /package/dist/docs/assets/{index.md.BW_6tOgR.lean.js → index.md.BjH1w2ZW.lean.js} +0 -0
  387. /package/dist/docs/assets/{reference_agent-config.md.CHNpiyp4.lean.js → reference_agent-config.md.CvoL6pof.lean.js} +0 -0
  388. /package/dist/docs/assets/{reference_connections.md.Di6jJAXF.lean.js → reference_connections.md.BojkC6c5.lean.js} +0 -0
  389. /package/dist/docs/assets/{reference_extensions.md.CGmMLblt.lean.js → reference_extensions.md.CPWt00ds.lean.js} +0 -0
  390. /package/dist/docs/assets/{scaffolding-agents.md.em43xlY1.lean.js → scaffolding-agents.md.Kctn3OVb.lean.js} +0 -0
  391. /package/dist/docs/assets/{skills_create-agent.md.BVoWPcan.lean.js → skills_create-agent.md.Q3h6Je-e.lean.js} +0 -0
  392. /package/dist/docs/assets/{skills_evals.md.723kpUmA.lean.js → skills_evals.md.BhovOvrl.lean.js} +0 -0
  393. /package/dist/docs/assets/{skills_github.md.D0JahM8c.lean.js → skills_github.md.hgFX_oKY.lean.js} +0 -0
  394. /package/dist/docs/assets/{skills_otel.md.CqhobH3B.lean.js → skills_otel.md.B5Ddv1xH.lean.js} +0 -0
  395. /package/dist/docs/assets/{troubleshooting.md.Cus_YZga.lean.js → troubleshooting.md.CYEAO9bM.lean.js} +0 -0
@@ -6,4 +6,4 @@ import{_ as e,c as a,o as s,ag as o}from"./chunks/framework.BCISBCiQ.js";const c
6
6
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { name: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Plan Keeper&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, description: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Keeps or moves outdoor plans.&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
7
7
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { name: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Chief of Staff&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, description: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Routes work and tracks priorities.&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
8
8
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ],</span></span>
9
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p><code>agents</code> is the allowlist. List every Grok Bot the model may talk to; a name outside the list is refused. Calls run under the host&#39;s signed-in account (<code>agent-sdk login</code> or <code>CURSOR_API_KEY</code>). Keep approval on when you can&#39;t.</p><p>Start from the <a href="./../templates/grokbot-agents.html">Grok Bot agents template</a> when you want a project that already mounts this.</p><h2 id="what-the-agent-can-do" tabindex="-1">What the agent can do <a class="header-anchor" href="#what-the-agent-can-do" aria-label="Permalink to &quot;What the agent can do&quot;">​</a></h2><p>With the extension mounted, the agent can consult a Grok Bot and stay in its own conversation:</p><ul><li><strong>Ask.</strong> Send a self-contained message to a Grok Bot by the name shown in the Grok Bot app. The message lands in your conversation with that bot. The tool waits for the bot&#39;s reply.</li><li><strong>Keep waiting.</strong> A long turn returns <code>status: &quot;running&quot;</code>. Call check with the same name to read what arrived since the last look.</li><li><strong>Stop a turn.</strong> Interrupt the bot&#39;s current work. The conversation stays; a later ask continues it.</li><li><strong>See who you can talk to.</strong> List the configured bots and the ones this caller has already asked. Add a name to <code>agents</code> when you want the model to reach another bot.</li></ul><p>A skill teaches the model when to bring a Grok Bot in, how to write a message the bot can act on alone, and how to wait or interrupt. The reply is what the Grok Bot sent to the person. If a turn finishes with no reply, the bot sent nothing; ask again with a clearer request, or open the bot in the Grok Bot app.</p><p>The tools reach Grok Bot agents on the signed-in account. A bot another user owns is out of reach. That separation is only as fine as your host&#39;s auth; a shared bearer token or <code>--allow-anonymous</code> makes every caller one principal, so use <a href="./../reference/channels.html#auth-policies">authored auth</a> when callers need their own.</p><h2 id="configure-it" tabindex="-1">Configure it <a class="header-anchor" href="#configure-it" aria-label="Permalink to &quot;Configure it&quot;">​</a></h2><table tabindex="0"><thead><tr><th>Option</th><th>What it controls</th></tr></thead><tbody><tr><td><code>agents</code></td><td>The Grok Bot agents the model may talk to, by the name shown in the app. A lone entry is the default when a call names none. Omit <code>agents</code> to allow any name; an unknown name creates an empty Grok Bot on the account.</td></tr><tr><td><code>needsApproval</code></td><td>Park asks for a <a href="./human-in-the-loop.html">human decision</a>. Defaults to <code>true</code> when no <code>agents</code> are configured, <code>false</code> otherwise.</td></tr><tr><td><code>apiKey</code></td><td>A Cursor API key to call with instead of the host&#39;s own.</td></tr></tbody></table><h2 id="adjust-it" tabindex="-1">Adjust it <a class="header-anchor" href="#adjust-it" aria-label="Permalink to &quot;Adjust it&quot;">​</a></h2><p>To take a capability away, such as interrupting a turn, mount as a directory and disable that tool; see <a href="./../reference/extensions.html#adjust-a-mounted-extension">overlays</a>.</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="./../templates/grokbot-agents.html">Grok Bot agents template</a>: scaffold an agent that already mounts this</li><li><a href="./../reference/extensions.html">Extensions</a>: how mounts, namespaces, and overrides work</li><li><a href="./human-in-the-loop.html">Human-in-the-loop approvals</a>: where parked asks get approved</li></ul>`,20)])])}const u=e(n,[["render",i]]);export{c as __pageData,u as default};
9
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p><code>agents</code> is the allowlist. List every Grok Bot the model may talk to; a name outside the list is refused. Calls run under the host&#39;s signed-in account (<code>agent-sdk login</code>, <code>CURSOR_API_KEY</code>, or <code>CURSOR_SERVICE_ACCOUNT_KEY</code>). Keep approval on when you can&#39;t.</p><p>Start from the <a href="./../templates/grokbot-agents.html">Grok Bot agents template</a> when you want a project that already mounts this.</p><h2 id="what-the-agent-can-do" tabindex="-1">What the agent can do <a class="header-anchor" href="#what-the-agent-can-do" aria-label="Permalink to &quot;What the agent can do&quot;">​</a></h2><p>With the extension mounted, the agent can consult a Grok Bot and stay in its own conversation:</p><ul><li><strong>Ask.</strong> Send a self-contained message to a Grok Bot by the name shown in the Grok Bot app. The message lands in your conversation with that bot. The tool waits for the bot&#39;s reply.</li><li><strong>Keep waiting.</strong> A long turn returns <code>status: &quot;running&quot;</code>. Call check with the same name to read what arrived since the last look.</li><li><strong>Stop a turn.</strong> Interrupt the bot&#39;s current work. The conversation stays; a later ask continues it.</li><li><strong>See who you can talk to.</strong> List the configured bots and the ones this caller has already asked. Add a name to <code>agents</code> when you want the model to reach another bot.</li></ul><p>A skill teaches the model when to bring a Grok Bot in, how to write a message the bot can act on alone, and how to wait or interrupt. The reply is what the Grok Bot sent to the person. If a turn finishes with no reply, the bot sent nothing; ask again with a clearer request, or open the bot in the Grok Bot app.</p><p>The tools reach Grok Bot agents on the signed-in account. A bot another user owns is out of reach. That separation is only as fine as your host&#39;s auth; a shared bearer token or <code>--allow-anonymous</code> makes every caller one principal, so use <a href="./../reference/channels.html#auth-policies">authored auth</a> when callers need their own.</p><h2 id="configure-it" tabindex="-1">Configure it <a class="header-anchor" href="#configure-it" aria-label="Permalink to &quot;Configure it&quot;">​</a></h2><table tabindex="0"><thead><tr><th>Option</th><th>What it controls</th></tr></thead><tbody><tr><td><code>agents</code></td><td>The Grok Bot agents the model may talk to, by the name shown in the app. A lone entry is the default when a call names none. Omit <code>agents</code> to allow any name; an unknown name creates an empty Grok Bot on the account.</td></tr><tr><td><code>needsApproval</code></td><td>Park asks for a <a href="./human-in-the-loop.html">human decision</a>. Defaults to <code>true</code> when no <code>agents</code> are configured, <code>false</code> otherwise.</td></tr><tr><td><code>apiKey</code></td><td>A Cursor API key to call with instead of the host&#39;s own.</td></tr></tbody></table><h2 id="adjust-it" tabindex="-1">Adjust it <a class="header-anchor" href="#adjust-it" aria-label="Permalink to &quot;Adjust it&quot;">​</a></h2><p>To take a capability away, such as interrupting a turn, mount as a directory and disable that tool; see <a href="./../reference/extensions.html#adjust-a-mounted-extension">overlays</a>.</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="./../templates/grokbot-agents.html">Grok Bot agents template</a>: scaffold an agent that already mounts this</li><li><a href="./../reference/extensions.html">Extensions</a>: how mounts, namespaces, and overrides work</li><li><a href="./human-in-the-loop.html">Human-in-the-loop approvals</a>: where parked asks get approved</li></ul>`,20)])])}const u=e(n,[["render",i]]);export{c as __pageData,u as default};
@@ -0,0 +1,14 @@
1
+ import{_ as t,c as s,o as a,ag as i}from"./chunks/framework.BCISBCiQ.js";const u=JSON.parse('{"title":"Self-improvement","description":"Mount improve so an agent can change its own instructions, skills, and tools through a pull request a one-off cloud agent opens.","frontmatter":{"title":"Self-improvement","description":"Mount improve so an agent can change its own instructions, skills, and tools through a pull request a one-off cloud agent opens."},"headers":[],"relativePath":"guides/improve.md","filePath":"guides/improve.md"}'),n={name:"guides/improve.md"};function o(h,e,r,l,p,d){return a(),s("div",null,[...e[0]||(e[0]=[i(`<h1 id="self-improvement" tabindex="-1">Self-improvement <a class="header-anchor" href="#self-improvement" aria-label="Permalink to &quot;Self-improvement&quot;">​</a></h1><p>The <code>improve</code> extension lets an agent change how it behaves by changing its own source. Someone asks it to answer more briefly, to stop reaching for a tool, or to learn a procedure. The agent writes a brief, a one-off Cursor cloud agent makes the change on a branch and opens a pull request, and the agent reports that pull request. Nothing changes until a person reviews it and deploys.</p><p>The tree the agent runs from is never edited; nothing changed there survives a deploy. The pull request is the only path.</p><h2 id="mount-it" tabindex="-1">Mount it <a class="header-anchor" href="#mount-it" aria-label="Permalink to &quot;Mount it&quot;">​</a></h2><p>The extension ships with <code>@cursor/july</code>. It relies on a <a href="./cloud-agents.html"><code>cursor-cloud-agents</code></a> mount beside it, with the agent&#39;s own repository among its <code>cloud.repos</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/extensions/cloud.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;"> cursorCloudAgents </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@cursor/july/extensions/cursor-cloud-agents&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;"> cursorCloudAgents</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
5
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> cloud: {</span></span>
6
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> repos: [{ url: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;https://github.com/acme/agents&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, startingRef: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;main&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }],</span></span>
7
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
8
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><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/improve.ts</span></span>
9
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> improve </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@cursor/july/extensions/improve&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
10
+ <span class="line"></span>
11
+ <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;"> improve</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
12
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> repo: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;https://github.com/acme/agents&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
13
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> path: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;agents/concierge&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
14
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p><code>repo</code> is the repository that holds the agent&#39;s source and <code>path</code> is the agent&#39;s directory in it, the same values <code>agent-sdk deploy --repo</code> and <code>--path</code> take. Mount it as <code>improve</code>: the skill then reads <code>improve__yourself</code>, which is what a person asks for.</p><p>An agent on the <a href="./../reference/agent-config.html#choose-a-runtime">cloud runtime</a> already runs each turn on a VM with the repository checked out. It mounts <code>improve</code> alone, and the skill has it branch in that checkout instead of launching a second agent.</p><h2 id="what-the-agent-does" tabindex="-1">What the agent does <a class="header-anchor" href="#what-the-agent-does" aria-label="Permalink to &quot;What the agent does&quot;">​</a></h2><p>With the extension mounted, &quot;change how you work&quot; becomes a procedure:</p><ul><li><strong>Locate the change.</strong> The skill maps the ask onto the Agent SDK tree: instructions for the always-on prompt, a skill for a procedure, a tool for behavior that must be right every time, <code>agent.ts</code> for the model.</li><li><strong>Brief a cloud agent.</strong> The agent writes a self-contained brief: who is asking and why, the repository, ref, and path, the files it expects to change, your notes about the tree, and the rules. Follow the repository&#39;s conventions, keep the diff to the change, run the repository&#39;s checks, open a pull request against the deployed ref, never merge.</li><li><strong>Follow up and report.</strong> It gives the person the cloud agent&#39;s URL, checks on the run, reads the pull request before repeating its claims, and reports the pull request, not the delegation. It says the change takes effect at the next deploy, never that it has changed already.</li></ul><p>Ask it directly. &quot;Improve yourself: stop opening with a summary&quot; is enough.</p><h2 id="configure-it" tabindex="-1">Configure it <a class="header-anchor" href="#configure-it" aria-label="Permalink to &quot;Configure it&quot;">​</a></h2><table tabindex="0"><thead><tr><th>Option</th><th>What it controls</th></tr></thead><tbody><tr><td><code>repo</code></td><td>The repository holding the agent&#39;s source. One of the cloud mount&#39;s <code>cloud.repos</code>.</td></tr><tr><td><code>path</code></td><td>The agent&#39;s directory in the repository, as <code>agent-sdk deploy --path</code> names it.</td></tr><tr><td><code>ref</code></td><td>The ref the deployment tracks. Branches start there and pull requests target it. Defaults to <code>main</code>.</td></tr><tr><td><code>notes</code></td><td>What a coding agent must know about this tree beyond the standard layout: a house skill format, a manifest that forces a reinstall, a pull request convention. Copied into every brief.</td></tr><tr><td><code>deploy</code></td><td>Who deploys a merged change and when it is live. Defaults to &quot;It takes effect at the next deploy.&quot;</td></tr></tbody></table><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="./cloud-agents.html">Cursor cloud agents</a>: the mount that does the coding, and how to gate its launches</li><li><a href="./../reference/extensions.html">Extensions</a>: how mounts, namespaces, and overrides work</li><li><a href="./../deployment.html">Deployment</a>: how a merged change reaches the running agent</li></ul>`,18)])])}const g=t(n,[["render",o]]);export{u as __pageData,g as default};
@@ -0,0 +1 @@
1
+ import{_ as t,c as s,o as a,ag as i}from"./chunks/framework.BCISBCiQ.js";const u=JSON.parse('{"title":"Self-improvement","description":"Mount improve so an agent can change its own instructions, skills, and tools through a pull request a one-off cloud agent opens.","frontmatter":{"title":"Self-improvement","description":"Mount improve so an agent can change its own instructions, skills, and tools through a pull request a one-off cloud agent opens."},"headers":[],"relativePath":"guides/improve.md","filePath":"guides/improve.md"}'),n={name:"guides/improve.md"};function o(h,e,r,l,p,d){return a(),s("div",null,[...e[0]||(e[0]=[i("",18)])])}const g=t(n,[["render",o]]);export{u as __pageData,g as default};
@@ -1,4 +1,4 @@
1
- import{_ as s,c as t,o as a,ag as o}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"OpenTelemetry","description":"Push session, turn, and tool traces from the serve process to an OTLP collector you run.","frontmatter":{"title":"OpenTelemetry","description":"Push session, turn, and tool traces from the serve process to an OTLP collector you run."},"headers":[],"relativePath":"guides/opentelemetry.md","filePath":"guides/opentelemetry.md"}'),n={name:"guides/opentelemetry.md"};function i(r,e,d,l,p,h){return a(),t("div",null,[...e[0]||(e[0]=[o(`<h1 id="opentelemetry" tabindex="-1">OpenTelemetry <a class="header-anchor" href="#opentelemetry" aria-label="Permalink to &quot;OpenTelemetry&quot;">​</a></h1><p>Agent SDK can push traces, metrics, and logs from the serve process to an OTLP collector you run. Point the process at the collector with standard <code>OTEL_EXPORTER_OTLP_*</code> env, or author <code>agent/otel.ts</code>. Traces cover the inbound request, each turn, and every tool call.</p><p>Export is opt-in. Nothing leaves the process until you set an endpoint or a <code>defineOtel</code> config.</p><h2 id="what-does-agent-sdk-export" tabindex="-1">What does Agent SDK export? <a class="header-anchor" href="#what-does-agent-sdk-export" aria-label="Permalink to &quot;What does Agent SDK export?&quot;">​</a></h2><table tabindex="0"><thead><tr><th>Signal</th><th>Default</th><th>What you get</th></tr></thead><tbody><tr><td>Traces</td><td>on</td><td><code>agent_sdk.http</code> (per request) and <code>agent_sdk.turn</code> → <code>agent_sdk.tool</code> / <code>agent_sdk.subagent</code></td></tr><tr><td>Metrics</td><td>on</td><td><code>cursor.token.usage</code>, <code>cursor.tool.calls</code>, <code>cursor.cost.usage</code>, plus <code>agent_sdk.*</code> session and turn counts</td></tr><tr><td>Logs</td><td>off</td><td>Session events as log records. Prompt text, tool payloads, and failure messages stay off unless you opt in</td></tr></tbody></table><p>Turn off a signal with <code>traces: false</code>, <code>metrics: false</code>, or <code>logs: false</code> on <code>defineOtel</code>. Logs also turn on when you set <code>OTEL_LOGS_EXPORTER</code> to anything other than <code>none</code>, or when you set the content flags below.</p><h2 id="how-do-i-turn-opentelemetry-export-on" tabindex="-1">How do I turn OpenTelemetry export on? <a class="header-anchor" href="#how-do-i-turn-opentelemetry-export-on" aria-label="Permalink to &quot;How do I turn OpenTelemetry export on?&quot;">​</a></h2><p>Set a collector URL in the serve process environment:</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:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> OTEL_EXPORTER_OTLP_ENDPOINT</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">https://otel.example.com</span></span>
1
+ import{_ as s,c as t,o as a,ag as o}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"OpenTelemetry","description":"Push session, turn, and tool traces from the serve process to an OTLP collector you run.","frontmatter":{"title":"OpenTelemetry","description":"Push session, turn, and tool traces from the serve process to an OTLP collector you run."},"headers":[],"relativePath":"guides/opentelemetry.md","filePath":"guides/opentelemetry.md"}'),i={name:"guides/opentelemetry.md"};function n(r,e,d,l,p,h){return a(),t("div",null,[...e[0]||(e[0]=[o(`<h1 id="opentelemetry" tabindex="-1">OpenTelemetry <a class="header-anchor" href="#opentelemetry" aria-label="Permalink to &quot;OpenTelemetry&quot;">​</a></h1><p>Agent SDK can push traces, metrics, and logs from the serve process to an OTLP collector you run. Point the process at the collector with standard <code>OTEL_EXPORTER_OTLP_*</code> env, or author <code>agent/otel.ts</code>. Traces cover the inbound request, each turn, and every tool call.</p><p>Export is opt-in. Nothing leaves the process until you set an endpoint or a <code>defineOtel</code> config.</p><h2 id="what-does-agent-sdk-export" tabindex="-1">What does Agent SDK export? <a class="header-anchor" href="#what-does-agent-sdk-export" aria-label="Permalink to &quot;What does Agent SDK export?&quot;">​</a></h2><table tabindex="0"><thead><tr><th>Signal</th><th>Default</th><th>What you get</th></tr></thead><tbody><tr><td>Traces</td><td>on</td><td><code>agent_sdk.http</code> (per request) and <code>agent_sdk.turn</code> → <code>agent_sdk.tool</code> / <code>agent_sdk.subagent</code></td></tr><tr><td>Metrics</td><td>on</td><td><code>cursor.token.usage</code>, <code>cursor.tool.calls</code>, <code>cursor.cost.usage</code>, plus <code>agent_sdk.*</code> session and turn counts</td></tr><tr><td>Logs</td><td>off</td><td>Session events as log records. Prompt text, tool payloads, and failure messages stay off unless you opt in</td></tr></tbody></table><p>Turn off a signal with <code>traces: false</code>, <code>metrics: false</code>, or <code>logs: false</code> on <code>defineOtel</code>. Logs also turn on when you set <code>OTEL_LOGS_EXPORTER</code> to anything other than <code>none</code>, or when you set the content flags below.</p><h2 id="how-do-i-turn-opentelemetry-export-on" tabindex="-1">How do I turn OpenTelemetry export on? <a class="header-anchor" href="#how-do-i-turn-opentelemetry-export-on" aria-label="Permalink to &quot;How do I turn OpenTelemetry export on?&quot;">​</a></h2><p>Set a collector URL in the serve process environment:</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:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> OTEL_EXPORTER_OTLP_ENDPOINT</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">https://otel.example.com</span></span>
2
2
  <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> OTEL_EXPORTER_OTLP_HEADERS</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Authorization=Bearer …&quot;</span></span></code></pre></div><p>The default wire format is OTLP/HTTP protobuf. That matches <a href="https://cursor.com/docs/enterprise/opentelemetry-export" target="_blank" rel="noreferrer">Cursor enterprise OpenTelemetry Export</a>. Set <code>OTEL_EXPORTER_OTLP_PROTOCOL=http/json</code> when your collector only accepts JSON. The runtime accepts <code>http/protobuf</code> and <code>http/json</code>. <code>grpc</code> falls back to protobuf and logs a warning.</p><p><code>OTEL_EXPORTER_OTLP_ENDPOINT</code> is the base URL. The runtime appends <code>/v1/traces</code>, <code>/v1/metrics</code>, and <code>/v1/logs</code>. If you pass a signal path, it is stripped back to the base first.</p><p>To send each signal to a different collector, omit the base URL and set the per-signal vars:</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:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> OTEL_EXPORTER_OTLP_TRACES_ENDPOINT</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">https://traces.example.com/v1/traces</span></span>
3
3
  <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> OTEL_EXPORTER_OTLP_METRICS_ENDPOINT</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">https://metrics.example.com/v1/metrics</span></span>
4
4
  <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> OTEL_EXPORTER_OTLP_LOGS_ENDPOINT</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">https://logs.example.com/v1/logs</span></span></code></pre></div><p>Optional:</p><table tabindex="0"><thead><tr><th>Variable</th><th>Effect</th></tr></thead><tbody><tr><td><code>OTEL_SERVICE_NAME</code></td><td>Resource <code>service.name</code>. Default <code>cursor</code></td></tr><tr><td><code>OTEL_LOG_USER_PROMPTS=1</code></td><td>Include user prompt text on logs and span events</td></tr><tr><td><code>OTEL_LOG_TOOL_CONTENT=1</code></td><td>Include tool payloads and failure text (truncated)</td></tr></tbody></table><p><code>serve(dir, { otel: false })</code> turns export off even when env or <code>agent/otel.ts</code> is set.</p><h2 id="how-do-i-author-agent-otel-ts" tabindex="-1">How do I author <code>agent/otel.ts</code>? <a class="header-anchor" href="#how-do-i-author-agent-otel-ts" aria-label="Permalink to &quot;How do I author \`agent/otel.ts\`?&quot;">​</a></h2><p>Use <code>defineOtel</code> when you want the collector URL, headers, or sampling in the project instead of the environment:</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;"> { defineOtel } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@cursor/july/otel&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
@@ -12,7 +12,7 @@ import{_ as s,c as t,o as a,ag as o}from"./chunks/framework.BCISBCiQ.js";const k
12
12
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> headers: { Authorization: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Bearer …&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
13
13
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
14
14
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ],</span></span>
15
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>Multiple <code>exporters</code> fan out to every destination. Restrict one destination with <code>signals: [&quot;traces&quot;]</code>.</p><p>You can also pass the same object to <code>serve(dir, { otel })</code>. Precedence is <code>serve({ otel })</code> over <code>agent/otel.ts</code> over env. An empty <code>defineOtel()</code> still records traces; export starts when <code>OTEL_EXPORTER_OTLP_*</code> or a factory-returned <code>exporters</code> list appears.</p><p>Hosted v2 binds deployment secrets after bake, onto the already-listening process. Pass a factory so flush can re-read them. Spans record from bake; the hosted handler flush constructs the OTLP client and sends the queued batch.</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;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineOtel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(() </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=&gt;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> resolveMyOtelConfig</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">());</span></span></code></pre></div><p>The companion skill is <a href="./../skills/otel.html"><code>skills/otel/SKILL.md</code></a>.</p><h2 id="what-spans-does-a-session-produce" tabindex="-1">What spans does a session produce? <a class="header-anchor" href="#what-spans-does-a-session-produce" aria-label="Permalink to &quot;What spans does a session produce?&quot;">​</a></h2><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_sdk.http inbound channel request (W3C traceparent)</span></span>
15
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>Multiple <code>exporters</code> fan out to every destination. Restrict one destination with <code>signals: [&quot;traces&quot;]</code>.</p><p>You can also pass the same object to <code>serve(dir, { otel })</code>. Precedence is <code>serve({ otel })</code> over <code>agent/otel.ts</code> over env. An empty <code>defineOtel()</code> still records traces; export starts when <code>OTEL_EXPORTER_OTLP_*</code> or a factory-returned <code>exporters</code> list appears.</p><p>Hosted deployments can bind secrets after startup. Pass a factory so flush can re-read them. The hosted handler constructs the OTLP client when it flushes and sends the queued batch.</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;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineOtel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(() </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=&gt;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> resolveMyOtelConfig</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">());</span></span></code></pre></div><p>The companion skill is <a href="./../skills/otel.html"><code>skills/otel/SKILL.md</code></a>.</p><h2 id="what-spans-does-a-session-produce" tabindex="-1">What spans does a session produce? <a class="header-anchor" href="#what-spans-does-a-session-produce" aria-label="Permalink to &quot;What spans does a session produce?&quot;">​</a></h2><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_sdk.http inbound channel request (W3C traceparent)</span></span>
16
16
  <span class="line"><span>agent_sdk.turn one root per turn (\`agent_sdk.session_id\` = session id)</span></span>
17
17
  <span class="line"><span> ├─ agent_sdk.tool</span></span>
18
18
  <span class="line"><span> └─ agent_sdk.subagent</span></span>
@@ -23,4 +23,4 @@ import{_ as s,c as t,o as a,ag as o}from"./chunks/framework.BCISBCiQ.js";const k
23
23
  <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;abc.ticket.resolved&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
24
24
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">ctx.host.otel.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">record</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;abc.approval.duration_ms&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1420</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, {</span></span>
25
25
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> outcome: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;approved&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
26
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>A session-bound host (tools and hooks) adds <code>cursor.conversation.id</code> and <code>agent_sdk.agent</code> for you. Tags merge: later <code>setAttributes</code> calls paint open spans and later first-party metrics.</p><h2 id="what-stays-off-the-opentelemetry-wire" tabindex="-1">What stays off the OpenTelemetry wire? <a class="header-anchor" href="#what-stays-off-the-opentelemetry-wire" aria-label="Permalink to &quot;What stays off the OpenTelemetry wire?&quot;">​</a></h2><p>User prompts, tool arguments, tool results, and failure messages are omitted by default. Failure spans still record an error status with a generic message (<code>turn failed</code> / <code>session failed</code>).</p><p>Opt in with <code>OTEL_LOG_USER_PROMPTS=1</code> and <code>OTEL_LOG_TOOL_CONTENT=1</code>, or the matching <code>logs: { userPrompts, toolContent }</code> fields on <code>defineOtel</code>. Opted-in strings truncate at 2,048 characters.</p><p>Deployment URLs from <code>agent.bound</code> stay off spans unless <code>toolContent</code> is on.</p><h2 id="how-does-agent-sdk-export-relate-to-cursor-enterprise-export" tabindex="-1">How does Agent SDK export relate to Cursor enterprise export? <a class="header-anchor" href="#how-does-agent-sdk-export-relate-to-cursor-enterprise-export" aria-label="Permalink to &quot;How does Agent SDK export relate to Cursor enterprise export?&quot;">​</a></h2><p><a href="https://cursor.com/docs/enterprise/opentelemetry-export" target="_blank" rel="noreferrer">Cursor enterprise OpenTelemetry Export</a> is the team-admin path. Cursor servers send org-wide metrics and logs to a collector you configure in Team Settings.</p><p>Agent SDK export is the process-local path. The serve process sends per-run traces, and optional metrics and logs, to a collector you point it at.</p><p>Point both at the same collector when you want one view. Group on <code>cursor.conversation.id</code>. Resource defaults (<code>service.name=cursor</code>, <code>cursor.entrypoint=sdk_ts</code>) keep the streams next to each other. The <a href="https://cursor.com/docs/enterprise/opentelemetry-export/wire" target="_blank" rel="noreferrer">wire reference</a> lists the shared attribute names.</p><p>Evals (<code>defineEval</code>) stay the in-product regression check. OpenTelemetry is the graph in your observability stack.</p><h2 id="what-if-another-opentelemetry-sdk-is-already-running" tabindex="-1">What if another OpenTelemetry SDK is already running? <a class="header-anchor" href="#what-if-another-opentelemetry-sdk-is-already-running" aria-label="Permalink to &quot;What if another OpenTelemetry SDK is already running?&quot;">​</a></h2><p>OTel providers are process-global. If Cursor CLI, an extension host, or another library already registered a TracerProvider, MeterProvider, or LoggerProvider, Agent SDK reuses it. Run <code>serve</code> as its own process when the Agent SDK exporters should own the destination.</p><p>Two mounts with different <code>agent/otel.ts</code> files fail at serve start. Use the same <code>defineOtel</code> config on every mount, or configure once through <code>serve({ otel })</code> or env.</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><ul><li><a href="./../skills/otel.html"><code>skills/otel/SKILL.md</code></a>: compact <code>defineOtel</code> reference for coding agents</li><li><a href="./../reference/hooks.html">Hooks</a>: observe the same session event stream in-process</li><li><a href="./../deployment.html">Deployment</a>: env, secrets, and self-hosting</li><li><a href="https://cursor.com/docs/enterprise/opentelemetry-export" target="_blank" rel="noreferrer">Cursor enterprise OpenTelemetry Export</a></li></ul>`,55)])])}const u=s(n,[["render",i]]);export{k as __pageData,u as default};
26
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>A session-bound host (tools and hooks) adds <code>cursor.conversation.id</code> and <code>agent_sdk.agent</code> for you. Tags merge: later <code>setAttributes</code> calls paint open spans and later first-party metrics.</p><h2 id="what-stays-off-the-opentelemetry-wire" tabindex="-1">What stays off the OpenTelemetry wire? <a class="header-anchor" href="#what-stays-off-the-opentelemetry-wire" aria-label="Permalink to &quot;What stays off the OpenTelemetry wire?&quot;">​</a></h2><p>User prompts, tool arguments, tool results, and failure messages are omitted by default. Failure spans still record an error status with a generic message (<code>turn failed</code> / <code>session failed</code>).</p><p>Opt in with <code>OTEL_LOG_USER_PROMPTS=1</code> and <code>OTEL_LOG_TOOL_CONTENT=1</code>, or the matching <code>logs: { userPrompts, toolContent }</code> fields on <code>defineOtel</code>. Opted-in strings truncate at 2,048 characters.</p><p>Deployment URLs from <code>agent.bound</code> stay off spans unless <code>toolContent</code> is on.</p><h2 id="how-does-agent-sdk-export-relate-to-cursor-enterprise-export" tabindex="-1">How does Agent SDK export relate to Cursor enterprise export? <a class="header-anchor" href="#how-does-agent-sdk-export-relate-to-cursor-enterprise-export" aria-label="Permalink to &quot;How does Agent SDK export relate to Cursor enterprise export?&quot;">​</a></h2><p><a href="https://cursor.com/docs/enterprise/opentelemetry-export" target="_blank" rel="noreferrer">Cursor enterprise OpenTelemetry Export</a> is the team-admin path. Cursor servers send org-wide metrics and logs to a collector you configure in Team Settings.</p><p>Agent SDK export is the process-local path. The serve process sends per-run traces, and optional metrics and logs, to a collector you point it at.</p><p>Point both at the same collector when you want one view. Group on <code>cursor.conversation.id</code>. Resource defaults (<code>service.name=cursor</code>, <code>cursor.entrypoint=sdk_ts</code>) keep the streams next to each other. The <a href="https://cursor.com/docs/enterprise/opentelemetry-export/wire" target="_blank" rel="noreferrer">wire reference</a> lists the shared attribute names.</p><p>Evals (<code>defineEval</code>) stay the in-product regression check. OpenTelemetry is the graph in your observability stack.</p><h2 id="what-if-another-opentelemetry-sdk-is-already-running" tabindex="-1">What if another OpenTelemetry SDK is already running? <a class="header-anchor" href="#what-if-another-opentelemetry-sdk-is-already-running" aria-label="Permalink to &quot;What if another OpenTelemetry SDK is already running?&quot;">​</a></h2><p>OTel providers are process-global. If Cursor CLI, an extension host, or another library already registered a TracerProvider, MeterProvider, or LoggerProvider, Agent SDK reuses it. Run <code>serve</code> as its own process when the Agent SDK exporters should own the destination.</p><p>Two mounts with different <code>agent/otel.ts</code> files fail at serve start. Use the same <code>defineOtel</code> config on every mount, or configure once through <code>serve({ otel })</code> or env.</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><ul><li><a href="./../skills/otel.html"><code>skills/otel/SKILL.md</code></a>: compact <code>defineOtel</code> reference for coding agents</li><li><a href="./../reference/hooks.html">Hooks</a>: observe the same session event stream in-process</li><li><a href="./../deployment.html">Deployment</a>: env, secrets, and self-hosting</li><li><a href="https://cursor.com/docs/enterprise/opentelemetry-export" target="_blank" rel="noreferrer">Cursor enterprise OpenTelemetry Export</a></li></ul>`,55)])])}const u=s(i,[["render",n]]);export{k as __pageData,u as default};
@@ -1 +1 @@
1
- import{_ as s,c as t,o as a,ag as o}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"OpenTelemetry","description":"Push session, turn, and tool traces from the serve process to an OTLP collector you run.","frontmatter":{"title":"OpenTelemetry","description":"Push session, turn, and tool traces from the serve process to an OTLP collector you run."},"headers":[],"relativePath":"guides/opentelemetry.md","filePath":"guides/opentelemetry.md"}'),n={name:"guides/opentelemetry.md"};function i(r,e,d,l,p,h){return a(),t("div",null,[...e[0]||(e[0]=[o("",55)])])}const u=s(n,[["render",i]]);export{k as __pageData,u as default};
1
+ import{_ as s,c as t,o as a,ag as o}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"OpenTelemetry","description":"Push session, turn, and tool traces from the serve process to an OTLP collector you run.","frontmatter":{"title":"OpenTelemetry","description":"Push session, turn, and tool traces from the serve process to an OTLP collector you run."},"headers":[],"relativePath":"guides/opentelemetry.md","filePath":"guides/opentelemetry.md"}'),i={name:"guides/opentelemetry.md"};function n(r,e,d,l,p,h){return a(),t("div",null,[...e[0]||(e[0]=[o("",55)])])}const u=s(i,[["render",n]]);export{k as __pageData,u as default};
@@ -1,4 +1,4 @@
1
- import{_ as a,c as e,o as i,ag as t}from"./chunks/framework.BCISBCiQ.js";const c=JSON.parse('{"title":"Slack","description":"Run a Socket Mode Slack bot from the dashboard wizard, or import an app you own.","frontmatter":{"title":"Slack","description":"Run a Socket Mode Slack bot from the dashboard wizard, or import an app you own."},"headers":[],"relativePath":"guides/slack.md","filePath":"guides/slack.md"}'),n={name:"guides/slack.md"};function h(l,s,o,p,r,d){return i(),e("div",null,[...s[0]||(s[0]=[t(`<h1 id="slack-agents" tabindex="-1">Slack agents <a class="header-anchor" href="#slack-agents" aria-label="Permalink to &quot;Slack agents&quot;">​</a></h1><p>The Slack channel is a Socket Mode bot. The app connects out, so you don&#39;t need a public Request URL. Mentions and DMs start a thread. Replies stream there, with thinking steps and suggested prompts.</p><p>Use <code>agent-sdk slack create</code> when Cursor should own the Slack app. Use <code>agent-sdk slack init --manual</code> when you own it. Commands and flags live in the <a href="./../reference/cli.html#slack">CLI reference</a>. Coding agents should follow <a href="./../skills/setup-slack.html"><code>skills/setup-slack/SKILL.md</code></a>.</p><h2 id="define-the-channel" tabindex="-1">Define the channel <a class="header-anchor" href="#define-the-channel" aria-label="Permalink to &quot;Define the channel&quot;">​</a></h2><p>Author <code>agent/channels/slack.ts</code> with <code>slackChannel()</code> from <code>@cursor/july/channels/slack</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;"> { slackChannel } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@cursor/july/channels/slack&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
1
+ import{_ as a,c as e,o as i,ag as t}from"./chunks/framework.BCISBCiQ.js";const c=JSON.parse('{"title":"Slack","description":"Run a Socket Mode Slack bot from the dashboard wizard, or import an app you own.","frontmatter":{"title":"Slack","description":"Run a Socket Mode Slack bot from the dashboard wizard, or import an app you own."},"headers":[],"relativePath":"guides/slack.md","filePath":"guides/slack.md"}'),n={name:"guides/slack.md"};function l(h,s,o,p,r,d){return i(),e("div",null,[...s[0]||(s[0]=[t(`<h1 id="slack-agents" tabindex="-1">Slack agents <a class="header-anchor" href="#slack-agents" aria-label="Permalink to &quot;Slack agents&quot;">​</a></h1><p>The Slack channel is a Socket Mode bot. The app connects out, so you don&#39;t need a public Request URL. Mentions and DMs start a thread. Replies stream there, with thinking steps and suggested prompts.</p><p>Use <code>agent-sdk slack create</code> when Cursor should own the Slack app. Use <code>agent-sdk slack init --manual</code> when you own it. Commands and flags live in the <a href="./../reference/cli.html#slack">CLI reference</a>. Coding agents should follow <a href="./../skills/setup-slack.html"><code>skills/setup-slack/SKILL.md</code></a>.</p><h2 id="define-the-channel" tabindex="-1">Define the channel <a class="header-anchor" href="#define-the-channel" aria-label="Permalink to &quot;Define the channel&quot;">​</a></h2><p>Author <code>agent/channels/slack.ts</code> with <code>slackChannel()</code> from <code>@cursor/july/channels/slack</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;"> { slackChannel } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@cursor/july/channels/slack&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
2
2
  <span class="line"></span>
3
3
  <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;"> slackChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span></code></pre></div><p><code>slackChannel()</code> reads <code>SLACK_BOT_TOKEN</code> and <code>SLACK_APP_TOKEN</code>. Pass <code>envPrefix: &quot;WEATHER_AGENT&quot;</code> to read <code>WEATHER_AGENT_SLACK_BOT_TOKEN</code> and <code>WEATHER_AGENT_SLACK_APP_TOKEN</code> instead. Use a prefix when one host serves several Slack bots.</p><p>A thread is one conversation. The bot answers mentions and DMs. It refuses Slack Connect users, guests, and people from other workspaces. Missing tokens leave this channel idle. The rest of <code>serve</code> still starts.</p><h2 id="control-who-can-message-the-agent" tabindex="-1">Control who can message the agent <a class="header-anchor" href="#control-who-can-message-the-agent" aria-label="Permalink to &quot;Control who can message the agent&quot;">​</a></h2><p>External senders are blocked. Set <code>blockExternals: false</code> only when people outside your org should reach the agent:</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;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> slackChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
4
4
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> policy: { blockExternals: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
@@ -21,7 +21,7 @@ import{_ as a,c as e,o as i,ag as t}from"./chunks/framework.BCISBCiQ.js";const c
21
21
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
22
22
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> toolLabels: { grep: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Searching code&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, read: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Reading files&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
23
23
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>The reasoning card is one task card, titled &quot;Thinking&quot;, that receives the model&#39;s reasoning as it streams and completes when the answer text starts. <code>maxChars</code> (default 1500) caps how much it collects. Slack caps a streamed message near 12k characters including cards; when an answer outgrows that, the streamed message closes where it stands and the rest continues in a new message.</p><p>Tool cards default to one card per tool name with a call count in the title (<code>grep ×3</code>), updated in place as calls finish. <code>group: &quot;per-call&quot;</code> shows one card per call instead.</p><p>Cards are collapsible by default: each call adds one line under the title, the same summary the playground shows in a tool&#39;s header (the grep pattern, the file path, the shell command), and the group expands the same way the reasoning card does. <code>collapsible: false</code> keeps cards to their titles. On a collapsible card, <code>details(call)</code> returns the line to add when a call starts and <code>output(result)</code> the text to add when it finishes.</p><p><code>toolLabels</code> renames tools everywhere they appear: the chip, card titles, and the default <code>Running …</code> line.</p><h3 id="migrating-from-streaming-and-thinkingsteps" tabindex="-1">Migrating from <code>streaming</code> and <code>thinkingSteps</code> <a class="header-anchor" href="#migrating-from-streaming-and-thinkingsteps" aria-label="Permalink to &quot;Migrating from \`streaming\` and \`thinkingSteps\`&quot;">​</a></h3><p><code>streaming: false</code> is <code>reply: { mode: &quot;post&quot; }</code>. <code>streaming: true</code> is <code>reply: { mode: &quot;stream&quot;, toolCards: { group: &quot;per-call&quot;, collapsible: false } }</code>, the title-only cards it used to show. <code>loadingMessages</code> moves to <code>reply.status.idle</code>. The old options still work and <code>agent-sdk validate</code> prints the rewrite for each one.</p><p>A channel that set none of these used to stream. It now posts. Set <code>reply: { mode: &quot;stream&quot; }</code> to keep streaming.</p><h2 id="set-it-up" tabindex="-1">Set it up <a class="header-anchor" href="#set-it-up" aria-label="Permalink to &quot;Set it up&quot;">​</a></h2><p><code>slack create</code> opens the Cursor dashboard wizard. Finish Slack consent and the bot name there. The CLI writes tokens to <code>.env.local</code> and never prints them. Skip the wizard if those tokens are already set, unless you want a Cursor-managed app.</p><h3 id="provision-with-the-cli" tabindex="-1">Provision with the CLI <a class="header-anchor" href="#provision-with-the-cli" aria-label="Permalink to &quot;Provision with the CLI&quot;">​</a></h3><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;"> slack</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> .</span></span>
24
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> slack</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create</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;"> --prod</span></span></code></pre></div><p>Sign in first (<code>agent-sdk login</code> or <code>CURSOR_API_KEY</code>). Finish <strong>Add Slack to this agent</strong> as the same Cursor account. Then run <code>agent-sdk slack doctor --prefix MY_AGENT</code> and serve:</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;"> serve</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;"> --dev</span></span></code></pre></div><p>Invite the bot and mention it, or DM it. Expect a Thinking status, then a threaded streaming reply.</p><p>If Slack needs a workspace admin, keep the CLI running. Open the <strong>Request approval</strong> link it prints. After an admin approves, click <strong>Retry</strong> in the wizard.</p><p><code>slack destroy</code> deletes the Cursor-managed app. <code>slack icon</code> updates its icon. A second <code>slack create</code> for the same agent and environment replaces that app&#39;s manifest and tokens.</p><h3 id="provision-from-the-dashboard" tabindex="-1">Provision from the dashboard <a class="header-anchor" href="#provision-from-the-dashboard" aria-label="Permalink to &quot;Provision from the dashboard&quot;">​</a></h3><p>The same wizard is on <a href="https://cursor.com/dashboard" target="_blank" rel="noreferrer">Deployed Agents</a>. Open <strong>Integrations</strong> and click <strong>Add Slack to this agent</strong>.</p><p>Local <code>agent-sdk serve</code> reads <code>.env.local</code>. The next deploy injects the stored secrets.</p><p>If Slack needs admin approval, click <strong>Request approval</strong>, then <strong>Retry</strong> after an admin approves.</p><p>The app row&#39;s menu covers rename, icon, token rotation, removal, and workspace disconnect.</p><h3 id="create-your-own-slack-app" tabindex="-1">Create your own Slack app <a class="header-anchor" href="#create-your-own-slack-app" aria-label="Permalink to &quot;Create your own Slack app&quot;">​</a></h3><p><code>slack init --manual</code> is for an app you own. It writes the channel file and Slack manifests. When Slack CLI (<code>~/.slack/bin/slack</code>) is logged in, it installs the app. When it isn&#39;t, install the app yourself.</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;"> slack</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> init</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --manual</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;"> --name</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;My Agent&quot;</span></span></code></pre></div><p>Install Slack CLI if you need it:</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;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -fsSL</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://downloads.slack-edge.com/slack-cli/install.sh</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> |</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> bash</span></span></code></pre></div><p>Log in with <code>slack login --no-prompt</code>. In Slack, send <code>/slackauthticket &lt;ticket&gt;</code>, then <code>slack login --ticket &lt;ticket&gt; --challenge &lt;code&gt;</code>. Install the workspace app with <code>slack app install</code>. Create a separate production app the same way.</p><p>Or paste <code>.slack/manifest.dev.json</code> at <a href="https://api.slack.com/apps" target="_blank" rel="noreferrer">api.slack.com/apps</a> (<strong>Create New App</strong> → <strong>From a manifest</strong>). Repeat with <code>.slack/manifest.prod.json</code>. Dev and prod are separate Slack apps.</p><p>Then put a bot token (<code>xoxb-...</code>) and an app-level token with <code>connections:write</code> (<code>xapp-...</code>) in <code>.env.local</code>. Use the names <code>slack init --manual</code> printed. Run <code>slack doctor</code> and serve as above.</p><p>Serve this app with Agent SDK. Do not run <code>slack deploy</code>.</p><h2 id="choose-when-the-agent-engages" tabindex="-1">Choose when the agent engages <a class="header-anchor" href="#choose-when-the-agent-engages" aria-label="Permalink to &quot;Choose when the agent engages&quot;">​</a></h2><p>Mentions and DMs are on. Watching channel posts without a mention is opt-in:</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;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> slackChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
24
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> slack</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create</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;"> --prod</span></span></code></pre></div><p>Sign in first (<code>agent-sdk login</code> or <code>CURSOR_API_KEY</code>). A team service-account key cannot create Slack apps. Finish <strong>Add Slack to this agent</strong> as the same Cursor account. Then run <code>agent-sdk slack doctor --prefix MY_AGENT</code> and serve:</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;"> serve</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;"> --dev</span></span></code></pre></div><p>Invite the bot and mention it, or DM it. Expect a Thinking status, then a threaded streaming reply.</p><p>If Slack needs a workspace admin, keep the CLI running. Open the <strong>Request approval</strong> link it prints. After an admin approves, click <strong>Retry</strong> in the wizard.</p><p><code>slack destroy</code> deletes the Cursor-managed app. <code>slack icon</code> updates its icon. A second <code>slack create</code> for the same agent and environment replaces that app&#39;s manifest and tokens.</p><h3 id="provision-from-the-dashboard" tabindex="-1">Provision from the dashboard <a class="header-anchor" href="#provision-from-the-dashboard" aria-label="Permalink to &quot;Provision from the dashboard&quot;">​</a></h3><p>The same wizard is on <a href="https://cursor.com/dashboard" target="_blank" rel="noreferrer">Deployed Agents</a>. Open <strong>Integrations</strong> and click <strong>Add Slack to this agent</strong>.</p><p>Local <code>agent-sdk serve</code> reads <code>.env.local</code>. The next deploy injects the stored secrets.</p><p>If Slack needs admin approval, click <strong>Request approval</strong>, then <strong>Retry</strong> after an admin approves.</p><p>The app row&#39;s menu covers rename, icon, token rotation, removal, and workspace disconnect.</p><h3 id="create-your-own-slack-app" tabindex="-1">Create your own Slack app <a class="header-anchor" href="#create-your-own-slack-app" aria-label="Permalink to &quot;Create your own Slack app&quot;">​</a></h3><p><code>slack init --manual</code> is for an app you own. It writes the channel file and Slack manifests. When Slack CLI (<code>~/.slack/bin/slack</code>) is logged in, it installs the app. When it isn&#39;t, install the app yourself.</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;"> slack</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> init</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --manual</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;"> --name</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;My Agent&quot;</span></span></code></pre></div><p>Install Slack CLI if you need it:</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;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -fsSL</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://downloads.slack-edge.com/slack-cli/install.sh</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> |</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> bash</span></span></code></pre></div><p>Log in with <code>slack login --no-prompt</code>. In Slack, send <code>/slackauthticket &lt;ticket&gt;</code>, then <code>slack login --ticket &lt;ticket&gt; --challenge &lt;code&gt;</code>. Install the workspace app with <code>slack app install</code>. Create a separate production app the same way.</p><p>Or paste <code>.slack/manifest.dev.json</code> at <a href="https://api.slack.com/apps" target="_blank" rel="noreferrer">api.slack.com/apps</a> (<strong>Create New App</strong> → <strong>From a manifest</strong>). Repeat with <code>.slack/manifest.prod.json</code>. Dev and prod are separate Slack apps.</p><p>Then put a bot token (<code>xoxb-...</code>) and an app-level token with <code>connections:write</code> (<code>xapp-...</code>) in <code>.env.local</code>. Use the names <code>slack init --manual</code> printed. Run <code>slack doctor</code> and serve as above.</p><p>Serve this app with Agent SDK. Do not run <code>slack deploy</code>.</p><h2 id="choose-when-the-agent-engages" tabindex="-1">Choose when the agent engages <a class="header-anchor" href="#choose-when-the-agent-engages" aria-label="Permalink to &quot;Choose when the agent engages&quot;">​</a></h2><p>Mentions and DMs are on. Watching channel posts without a mention is opt-in:</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;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> slackChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
25
25
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> envPrefix: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;TRIAGE&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
26
26
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> engagement: {</span></span>
27
27
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> channelPosts: {</span></span>
@@ -35,4 +35,4 @@ import{_ as a,c as e,o as i,ag as t}from"./chunks/framework.BCISBCiQ.js";const c
35
35
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
36
36
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>Pass <code>--channel-posts</code> on <code>slack create</code> or <code>slack init --manual</code> so the Slack app receives those events. The bot must be in each watched channel. <code>allow: [&quot;*&quot;]</code> watches every joined channel.</p><p>Set <code>includeBotPosts: true</code> for alert feeds and other bots. This app never wakes on its own posts.</p><h2 id="prepare-work-on-the-host" tabindex="-1">Prepare work on the host <a class="header-anchor" href="#prepare-work-on-the-host" aria-label="Permalink to &quot;Prepare work on the host&quot;">​</a></h2><p>Mention and DM handlers may return a prepared <code>message</code>, <code>workspaceFiles</code>, or <code>cloud</code> block. Use the same host-prep pattern as <a href="./webhooks.html#prepare-on-the-host-then-hand-off">custom channels</a>.</p><p>Slack file uploads attach automatically. Images become vision input. Supported documents become workspace files for the turn.</p><h2 id="add-approval-buttons" tabindex="-1">Add approval buttons <a class="header-anchor" href="#add-approval-buttons" aria-label="Permalink to &quot;Add approval buttons&quot;">​</a></h2><p>Tools with <code>needsApproval</code> park until a person decides. Post those decisions in Slack with one flag:</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;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> slackChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
37
37
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> toolApprovals: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
38
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>The Slack app needs interactivity. Recreate it with <code>slack create</code> if clicks do nothing. Cards show redacted, truncated arguments. Execution still uses the full input, so review sensitive tools in the playground when the card may hide fields. The lifecycle is in <a href="./human-in-the-loop.html">Human-in-the-loop</a>.</p><h2 id="run-several-agents-on-one-host" tabindex="-1">Run several agents on one host <a class="header-anchor" href="#run-several-agents-on-one-host" aria-label="Permalink to &quot;Run several agents on one host&quot;">​</a></h2><p>Give each agent its own Slack app and token pair. Set <code>envPrefix</code> so the names don&#39;t collide (<code>WEATHER_AGENT_SLACK_*</code>, <code>TRIAGE_SLACK_*</code>). Agents without tokens stay idle. The others still serve.</p>`,66)])])}const g=a(n,[["render",h]]);export{c as __pageData,g as default};
38
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>The Slack app needs interactivity. Recreate it with <code>slack create</code> if clicks do nothing. Cards show redacted, truncated arguments. Execution still uses the full input, so review sensitive tools in the playground when the card may hide fields. The lifecycle is in <a href="./human-in-the-loop.html">Human-in-the-loop</a>.</p><h2 id="run-several-agents-on-one-host" tabindex="-1">Run several agents on one host <a class="header-anchor" href="#run-several-agents-on-one-host" aria-label="Permalink to &quot;Run several agents on one host&quot;">​</a></h2><p>Give each agent its own Slack app and token pair. Set <code>envPrefix</code> so the names don&#39;t collide (<code>WEATHER_AGENT_SLACK_*</code>, <code>TRIAGE_SLACK_*</code>). Agents without tokens stay idle. The others still serve.</p>`,66)])])}const g=a(n,[["render",l]]);export{c as __pageData,g as default};
@@ -1 +1 @@
1
- import{_ as a,c as e,o as i,ag as t}from"./chunks/framework.BCISBCiQ.js";const c=JSON.parse('{"title":"Slack","description":"Run a Socket Mode Slack bot from the dashboard wizard, or import an app you own.","frontmatter":{"title":"Slack","description":"Run a Socket Mode Slack bot from the dashboard wizard, or import an app you own."},"headers":[],"relativePath":"guides/slack.md","filePath":"guides/slack.md"}'),n={name:"guides/slack.md"};function h(l,s,o,p,r,d){return i(),e("div",null,[...s[0]||(s[0]=[t("",66)])])}const g=a(n,[["render",h]]);export{c as __pageData,g as default};
1
+ import{_ as a,c as e,o as i,ag as t}from"./chunks/framework.BCISBCiQ.js";const c=JSON.parse('{"title":"Slack","description":"Run a Socket Mode Slack bot from the dashboard wizard, or import an app you own.","frontmatter":{"title":"Slack","description":"Run a Socket Mode Slack bot from the dashboard wizard, or import an app you own."},"headers":[],"relativePath":"guides/slack.md","filePath":"guides/slack.md"}'),n={name:"guides/slack.md"};function l(h,s,o,p,r,d){return i(),e("div",null,[...s[0]||(s[0]=[t("",66)])])}const g=a(n,[["render",l]]);export{c as __pageData,g as default};
@@ -0,0 +1,5 @@
1
+ import{_ as t,c as a,o as s,ag as r}from"./chunks/framework.BCISBCiQ.js";const g=JSON.parse('{"title":"Agent SDK documentation","description":"Build and run Cursor agents with tools, approvals, channels, and evals.","frontmatter":{"title":"Agent SDK documentation","description":"Build and run Cursor agents with tools, approvals, channels, and evals."},"headers":[],"relativePath":"index.md","filePath":"README.md"}'),i={name:"index.md"};function n(o,e,l,h,d,c){return s(),a("div",null,[...e[0]||(e[0]=[r(`<h1 id="agent-sdk-documentation" tabindex="-1">Agent SDK documentation <a class="header-anchor" href="#agent-sdk-documentation" aria-label="Permalink to &quot;Agent SDK documentation&quot;">​</a></h1><p>Use the Agent SDK to define Cursor agents in TypeScript and Markdown. See <a href="./reference/project-layout.html">Project layout</a> for the directory structure.</p><p>Use Node 22.13 or newer. Bun isn&#39;t supported.</p><p>Create a project:</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;">npx</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> @cursor/july</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> init</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ./my-agent</span></span>
2
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> my-agent</span></span>
3
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> dev</span></span></code></pre></div><p>If <code>agent-sdk</code> isn&#39;t on <code>PATH</code>, use <code>npx @cursor/july &lt;command&gt;</code>.</p><p>Open the docs locally:</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;">npx</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> @cursor/july</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> docs</span></span></code></pre></div><h2 id="where-to-start" tabindex="-1">Where to start <a class="header-anchor" href="#where-to-start" aria-label="Permalink to &quot;Where to start&quot;">​</a></h2><table tabindex="0"><thead><tr><th>You are...</th><th>Start with</th></tr></thead><tbody><tr><td>New to the Agent SDK</td><td><a href="./quickstart.html">Quickstart</a> (PR reviewer), then <a href="./concepts.html">Concepts</a></td></tr><tr><td>Building a new agent with Cursor</td><td><a href="./scaffolding-agents.html">Scaffold an agent with Cursor</a></td></tr><tr><td>Turning a Cursor Automation into a project</td><td><a href="./guides/convert-automation.html">Convert a Cursor Automation</a></td></tr><tr><td>Wiring an agent to Slack</td><td><a href="./guides/slack.html">Slack guide</a></td></tr><tr><td>Starting from a packaged template</td><td><a href="./templates/demo.html">Demo</a>, <a href="./templates/grokbot-agents.html">Grok Bot agents</a>, <a href="./templates/code-wiki.html">Code wiki</a>, <a href="./templates/agents-md.html">Living AGENTS.md</a>, <a href="./templates/security-reviewer.html">Security reviewer</a>, <a href="./templates/security-help.html">Security help</a>, <a href="./templates/triage.html">Triage</a>, or <a href="./templates/agentic-owners.html">Agentic Owners</a></td></tr><tr><td>Wiring an agent to GitHub webhooks</td><td><a href="./guides/github.html">GitHub guide</a></td></tr><tr><td>Driving PRs from a cloud VM</td><td><a href="./templates/pr-autofixer.html">PR autofixer template</a></td></tr><tr><td>Handing coding work to Cursor cloud agents</td><td><a href="./guides/cloud-agents.html">Cursor cloud agents</a></td></tr><tr><td>Talking to your Grok Bot agents</td><td><a href="./guides/grokbot-agents.html">Cursor Grok Bot agents</a></td></tr><tr><td>Letting an agent change its own source</td><td><a href="./guides/improve.html">Self-improvement</a></td></tr><tr><td>Driving an agent from Linear (or another tracker)</td><td><a href="./guides/webhooks.html#example-linear-as-the-control-plane">Webhooks guide: Linear example</a></td></tr><tr><td>Making an existing agent measurably better</td><td><a href="./evals.html">Evals</a>, then <a href="./hillclimbing.html">Hillclimbing</a></td></tr><tr><td>Comparing variants on live traffic</td><td><a href="./ab.html">Live A/B metrics</a></td></tr><tr><td>Deploying with Cursor or on your own infrastructure</td><td><a href="./deployment.html">Deployment</a></td></tr><tr><td>Debugging something that misbehaves</td><td><a href="./troubleshooting.html">Fix common agent problems</a></td></tr></tbody></table><h2 id="documentation" tabindex="-1">Documentation <a class="header-anchor" href="#documentation" aria-label="Permalink to &quot;Documentation&quot;">​</a></h2><p><strong>Core</strong></p><ul><li><a href="./quickstart.html">Quickstart</a>: build a PR reviewer that classifies changes by complexity and handles GitHub webhook events.</li><li><a href="./scaffolding-agents.html">Scaffold an agent with Cursor</a>: use the bundled skill for a guided build.</li><li><a href="./guides/convert-automation.html">Convert a Cursor Automation</a>: export a dashboard Automation into an Agent SDK project.</li><li><a href="./concepts.html">Concepts</a>: agent discovery, sessions, channels, runtimes, and observability.</li></ul><p><strong>Templates</strong></p><ul><li><a href="./templates/demo.html">Record a walkthrough from a collected PR</a>: host collects the PR, the model records, then comments.</li><li><a href="./templates/grokbot-agents.html">Talk to your Grok Bot agents</a>: name the bots, then consult them from this agent&#39;s own conversation.</li><li><a href="./templates/code-wiki.html">Keep a code wiki current after merge</a>: update in-repo <code>wiki/</code> pages when a pull request merges.</li><li><a href="./templates/agents-md.html">Keep AGENTS.md current from last week&#39;s work</a>: pull rules out of merged PRs and Slack, then open a follow-up PR.</li><li><a href="./templates/security-reviewer.html">Security reviewer</a>: review pull requests for exploitable bugs and post one comment.</li><li><a href="./templates/security-help.html">Answer security questions in Slack</a>: answer from your skills, or take a first look at a pasted PR.</li><li><a href="./templates/triage.html">Triage Linear or Jira issues in place</a>: classify existing tickets and comment on them.</li><li><a href="./templates/agentic-owners.html">Review pull requests with owners policies</a>: request owners and approve changes allowed by repository policy.</li><li><a href="./templates/pr-autofixer.html">Fix pull requests on a Cursor cloud VM</a></li></ul><p><strong>Self-improving Agents</strong></p><ul><li><a href="./building-with-agents.html">Building agents with agents</a>: use a coding agent to scaffold, run, and iterate on your agent.</li><li><a href="./evals.html">Evals</a>: author <code>defineEval</code> cases, pick fixtures, and use evals as regression checks.</li><li><a href="./ab.html">Live A/B metrics</a>: assign sticky variants and compare cumulative metrics on live sessions.</li><li><a href="./storage.html">Storage</a>: point durable storage at a backend you own with <code>defineStorage</code>.</li><li><a href="./hillclimbing.html">Hillclimbing</a>: measure and improve an agent iteratively.</li></ul><p><strong>Guides</strong></p><ul><li><a href="./guides/webhooks.html">Webhooks and custom channels</a>: give the agent its own HTTP surface.</li><li><a href="./guides/github.html">GitHub</a>: trigger the agent from pull requests, CI, and comments.</li><li><a href="./guides/slack.html">Slack</a>: put the agent in Slack over Socket Mode.</li><li><a href="./guides/human-in-the-loop.html">Human-in-the-loop approvals</a>: park a tool call until a person signs off.</li><li><a href="./guides/mcp-oauth.html">Host MCP OAuth</a>: authorize <code>oauth: true</code> connections, store tokens locally, and persist them on hosted deployments (<code>--store</code>).</li><li><a href="./guides/agent-to-agent.html">Agent-to-agent</a>: every agent is an MCP server; agents can delegate to each other.</li><li><a href="./guides/cloud-agents.html">Cursor cloud agents</a>: let the agent launch and steer cloud agents through the <code>cursor-cloud-agents</code> extension.</li><li><a href="./guides/grokbot-agents.html">Cursor Grok Bot agents</a>: let the agent talk to Grok Bot agents through the <code>cursor-grokbot-agents</code> extension.</li><li><a href="./guides/improve.html">Self-improvement</a>: let the agent change its own source through a one-off cloud agent and a pull request with the <code>improve</code> extension.</li><li><a href="./guides/opentelemetry.html">OpenTelemetry</a>: push session, turn, and tool traces to an OTLP collector you run.</li></ul><p><strong>Operating</strong></p><ul><li><a href="./deployment.html">Deployment</a>: Cursor-managed hosting, self-hosting, auth, state, and operations.</li><li><a href="./troubleshooting.html">Fix common agent problems</a>: diagnose common failures by symptom.</li></ul><p><strong>Reference</strong></p><ul><li><a href="./reference/project-layout.html">Project layout</a>: the full folder structure.</li><li><a href="./reference/agent-config.html">Agent config</a> · <a href="./reference/instructions.html">Instructions</a> · <a href="./reference/tools.html">Tools</a> · <a href="./reference/prompt.html"><code>prompt</code></a> · <a href="./reference/skills.html">Skills</a> · <a href="./reference/connections.html">MCP connections</a> · <a href="./reference/subagents.html">Subagents</a> · <a href="./reference/extensions.html">Extensions</a></li><li><a href="./reference/channels.html">Channels</a> · <a href="./reference/schedules.html">Schedules and reminders</a> · <a href="./reference/hooks.html">Hooks</a> · <a href="./reference/artifacts.html">Artifacts</a> · <a href="./reference/result.html">Turn result</a> · <a href="./reference/sessions.html">Sessions and streaming</a> · <a href="./reference/playground.html">Playground</a></li><li><a href="./reference/cli.html">CLI</a> · <a href="./reference/http-api.html">HTTP API</a></li></ul><h2 id="run-the-cli" tabindex="-1">Run the CLI <a class="header-anchor" href="#run-the-cli" aria-label="Permalink to &quot;Run the CLI&quot;">​</a></h2><p>Docs use <code>agent-sdk &lt;command&gt;</code>. If it isn&#39;t on <code>PATH</code>, use <code>npx @cursor/july &lt;command&gt;</code>.</p><h2 id="credentials" tabindex="-1">Credentials <a class="header-anchor" href="#credentials" aria-label="Permalink to &quot;Credentials&quot;">​</a></h2><p>Sign in to Cursor or set <code>CURSOR_API_KEY</code>:</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;"> login</span></span>
4
+ <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># or: export CURSOR_API_KEY=key_...</span></span>
5
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> whoami</span></span></code></pre></div><p>Confirm <code>agent-sdk whoami</code> shows the expected account.</p><h2 id="related-documentation" tabindex="-1">Related documentation <a class="header-anchor" href="#related-documentation" aria-label="Permalink to &quot;Related documentation&quot;">​</a></h2><ul><li>Package reference: <a href="./../README.html"><code>README.md</code></a></li><li>Coding-agent workflows: <a href="./skills/"><code>skills/</code></a></li></ul>`,31)])])}const p=t(i,[["render",n]]);export{g as __pageData,p as default};
@@ -37,4 +37,4 @@ import{_ as e,c as t,o as i,ag as a}from"./chunks/framework.BCISBCiQ.js";const k
37
37
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span>
38
38
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">console.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">log</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">\`listening on \${</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">handle</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">.</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">url</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">}\`</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
39
39
  <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// handle.callTool(...), handle.dispatchSchedule(&quot;heartbeat&quot;),</span></span>
40
- <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// handle.createReminder(...), handle.project, await handle.close()</span></span></code></pre></div><p>Host settings match the documented <a href="./cli.html">CLI</a> <code>serve</code> flags. <code>serve()</code> also accepts <code>discovery</code> (project-loading options) and <code>mode: &quot;single&quot; | &quot;multi&quot;</code>. The Cursor credential resolves in one order everywhere: explicit <code>apiKey</code>, then <code>CURSOR_API_KEY</code>, then the key stored by <code>agent-sdk login</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="./instructions.html">Instructions</a>: the required half of a minimal agent</li><li><a href="./cli.html">CLI</a>: the <code>serve</code> flags <code>serve()</code> accepts</li></ul>`,50)])])}const u=e(n,[["render",o]]);export{k as __pageData,u as default};
40
+ <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// handle.createReminder(...), handle.project, await handle.close()</span></span></code></pre></div><p>Host settings match the documented <a href="./cli.html">CLI</a> <code>serve</code> flags. <code>serve()</code> also accepts <code>discovery</code> (project-loading options) and <code>mode: &quot;single&quot; | &quot;multi&quot;</code>. The Cursor credential resolves in one order everywhere: explicit <code>apiKey</code>, then <code>CURSOR_API_KEY</code>, then <code>CURSOR_API_KEY_FILE</code> (hosted default <code>/run/cursor/secrets/CURSOR_API_KEY</code> when unset), then <code>CURSOR_SERVICE_ACCOUNT_KEY</code>, then the key stored by <code>agent-sdk login</code>. On a host that has both the service-account key and a bind file, the file principal wins.</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="./instructions.html">Instructions</a>: the required half of a minimal agent</li><li><a href="./cli.html">CLI</a>: the <code>serve</code> flags <code>serve()</code> accepts</li></ul>`,50)])])}const u=e(n,[["render",o]]);export{k as __pageData,u as default};
@@ -1,4 +1,4 @@
1
- import{_ as e,c as i,o as a,ag as t}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Channels","description":"The authoring reference for defineChannel, the built-in HTTP channel, route schemas, handler args, and the auth policies.","frontmatter":{"title":"Channels","description":"The authoring reference for defineChannel, the built-in HTTP channel, route schemas, handler args, and the auth policies."},"headers":[],"relativePath":"reference/channels.md","filePath":"reference/channels.md"}'),n={name:"reference/channels.md"};function o(h,s,l,d,r,c){return a(),i("div",null,[...s[0]||(s[0]=[t(`<h1 id="channels" tabindex="-1">Channels <a class="header-anchor" href="#channels" aria-label="Permalink to &quot;Channels&quot;">​</a></h1><p>A channel is the surface an agent lives on. The built-in HTTP session channel is always mounted. Custom channels declare their own routes under <code>/v1/channels/&lt;id&gt;</code>. The Slack and GitHub packs are prebuilt channels with platform transports. This page is the authoring reference; for the walkthrough, see the <a href="./../guides/webhooks.html">Webhooks guide</a>.</p><h2 id="built-in-http-channel" tabindex="-1">Built-in HTTP channel <a class="header-anchor" href="#built-in-http-channel" aria-label="Permalink to &quot;Built-in HTTP channel&quot;">​</a></h2><p>It&#39;s always mounted, under <code>/&lt;slug&gt;</code> in the default multi-agent layout: session create, follow-up, stream, stop, the sessions list, approvals, deterministic tool calls, health, and info. For the route-by-route contract, see the <a href="./http-api.html">HTTP API reference</a>.</p><p>Author <code>agent/channels/http.ts</code> only to override its defaults:</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;"> {</span></span>
1
+ import{_ as e,c as a,o as i,ag as t}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Channels","description":"The authoring reference for defineChannel, the built-in HTTP channel, route schemas, handler args, and the auth policies.","frontmatter":{"title":"Channels","description":"The authoring reference for defineChannel, the built-in HTTP channel, route schemas, handler args, and the auth policies."},"headers":[],"relativePath":"reference/channels.md","filePath":"reference/channels.md"}'),n={name:"reference/channels.md"};function o(h,s,l,r,d,c){return i(),a("div",null,[...s[0]||(s[0]=[t(`<h1 id="channels" tabindex="-1">Channels <a class="header-anchor" href="#channels" aria-label="Permalink to &quot;Channels&quot;">​</a></h1><p>A channel is the surface an agent lives on. The built-in HTTP session channel is always mounted. Custom channels declare their own routes under <code>/v1/channels/&lt;id&gt;</code>. The Slack and GitHub packs are prebuilt channels with platform transports. This page is the authoring reference; for the walkthrough, see the <a href="./../guides/webhooks.html">Webhooks guide</a>.</p><h2 id="built-in-http-channel" tabindex="-1">Built-in HTTP channel <a class="header-anchor" href="#built-in-http-channel" aria-label="Permalink to &quot;Built-in HTTP channel&quot;">​</a></h2><p>It&#39;s always mounted, under <code>/&lt;slug&gt;</code> in the default multi-agent layout: session create, follow-up, stream, stop, the sessions list, approvals, deterministic tool calls, health, and info. For the route-by-route contract, see the <a href="./http-api.html">HTTP API reference</a>.</p><p>Author <code>agent/channels/http.ts</code> only to override its defaults:</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;"> {</span></span>
2
2
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> bearerAuth,</span></span>
3
3
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> httpChannel,</span></span>
4
4
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> localDevStrict,</span></span>
@@ -50,4 +50,4 @@ import{_ as e,c as i,o as a,ag as t}from"./chunks/framework.BCISBCiQ.js";const k
50
50
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
51
51
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
52
52
  <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // auth: [...], state: {...}, onStart(...), onStop(...)</span></span>
53
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>This example assumes <code>agent/tools/inspect_pr.ts</code> exists. The handler calls it before the model turn, so every review starts with validated PR data. It also derives a stable conversation key from the PR URL and writes the tool result to <code>pr.json</code>. Instructions can ask the model to inspect a PR, but host code guarantees it.</p><h2 id="route-verbs-and-schemas" tabindex="-1">Route verbs and schemas <a class="header-anchor" href="#route-verbs-and-schemas" aria-label="Permalink to &quot;Route verbs and schemas&quot;">​</a></h2><p><code>GET</code>, <code>POST</code>, <code>PUT</code>, <code>PATCH</code>, and <code>DELETE</code> helpers build routes. Their schemas are Zod, enforced at compile time:</p><table tabindex="0"><thead><tr><th>Verb</th><th>Required schema</th></tr></thead><tbody><tr><td><code>GET</code></td><td><code>querySchema</code></td></tr><tr><td><code>POST</code> / <code>PUT</code> / <code>PATCH</code></td><td><code>bodySchema</code> (optional <code>querySchema</code>)</td></tr><tr><td><code>DELETE</code></td><td>both optional</td></tr></tbody></table><p>Plain JSON Schema objects won&#39;t type-check; use <code>z.object({})</code> or <code>z.unknown()</code> for intentionally open surfaces. The host validates before the handler runs. Handlers receive typed <code>args.body</code> and <code>args.query</code>, and empty POST bodies are coerced to <code>{}</code> first. Declared schemas are projected on <code>GET /v1/info</code>, which powers the playground&#39;s <strong>Try</strong> buttons and composer <strong>slash commands</strong>.</p><h2 id="handler-arguments" tabindex="-1">Handler arguments <a class="header-anchor" href="#handler-arguments" aria-label="Permalink to &quot;Handler arguments&quot;">​</a></h2><p>Handlers receive the Fetch <code>Request</code> and an args object:</p><table tabindex="0"><thead><tr><th>Member</th><th>What it is</th></tr></thead><tbody><tr><td><code>send(message, options?)</code></td><td>Run a model turn on this channel; returns the session handle (options below)</td></tr><tr><td><code>getSession(sessionId)</code></td><td>Look up an existing session on this channel</td></tr><tr><td><code>receive(channelDefinition, input)</code></td><td>Hand off to another channel (schedules use this)</td></tr><tr><td><code>callTool(name, input, options?)</code></td><td>Deterministic server-tool call (<a href="./tools.html#call-a-tool-without-a-model-turn">Tools</a>)</td></tr><tr><td><code>body</code>, <code>query</code>, <code>params</code></td><td>Validated payloads and <code>:param</code> path segments</td></tr><tr><td><code>auth</code></td><td>The <code>AuthContext</code> resolved by this route&#39;s auth chain</td></tr><tr><td><code>requestIp</code></td><td>The TCP peer address</td></tr><tr><td><code>host</code></td><td>Shared services: <code>host.mcp</code>, <code>host.github</code>, <code>host.slack</code>, <code>host.kv</code>, <code>host.files</code>, <code>host.reminders</code></td></tr><tr><td><code>waitUntil(promise)</code></td><td>Background work that outlives the response</td></tr><tr><td><code>sessionUrls(request, sessionId)</code></td><td>Absolute playground + trace URLs for a session on this mount</td></tr><tr><td><code>artifacts</code></td><td>Unbound <a href="./artifacts.html">artifacts</a> facade; pass <code>sessionId</code> in <code>tag</code> input to attribute one</td></tr></tbody></table><p><code>send</code> options: <code>continuationToken</code> (the conversation key), <code>admission</code> (<code>&quot;preempt&quot;</code> interrupts a busy session, the default; <code>&quot;coalesce&quot;</code> enqueues behind the running turn, the <a href="./sessions.html#what-happens-when-i-send-a-follow-up">Slack policy</a>), <code>workspaceFiles</code>, <code>workspaceDir</code>, <code>cloud</code> (attach cloud repos for this session), <code>auth</code> (defaults to the request principal), <code>state</code> (starting channel state for new sessions), <code>title</code> (session display title), and <code>purpose</code> (<code>&quot;eval&quot;</code> skips sticky A/B enrollment).</p><h2 id="events" tabindex="-1">Events <a class="header-anchor" href="#events" aria-label="Permalink to &quot;Events&quot;">​</a></h2><p>The <code>events</code> map subscribes the channel to stream events for the sessions it owns. Keys are event types from the <a href="./sessions.html#which-events-can-i-stream">event vocabulary</a>, or <code>&quot;*&quot;</code>. Handlers receive <code>(event, channel, ctx)</code>, where <code>channel.state</code> is the per-session adapter state, <code>ctx.session</code> is the session info, and <code>ctx.host</code> is the shared host services, bound to that session as in a <a href="./hooks.html#handler-context">hook</a>. This is where a channel delivers replies back to its surface.</p><h2 id="state-and-lifecycle" tabindex="-1">State and lifecycle <a class="header-anchor" href="#state-and-lifecycle" aria-label="Permalink to &quot;State and lifecycle&quot;">​</a></h2><p><code>state</code> declares the starting per-session adapter state (JSON), persisted on the session record. Routes and event handlers read and mutate it through <code>channel.state</code>. <code>onStart(args)</code> runs when the channel mounts. <code>onStop()</code> runs when the server stops.</p><p><code>onStart</code> receives the route helpers (<code>send</code>, <code>getSession</code>, <code>receive</code>, <code>callTool</code>, <code>host</code>, <code>waitUntil</code>, <code>artifacts</code>, <code>logger</code>) plus helpers for long-lived transports:</p><ul><li><code>emitAssistantMessage(sessionId, text)</code> appends an assistant message without a model turn, for host tasks that already produced the final text.</li><li><code>hasContinuationSession(token)</code> and <code>isContinuationBusy(token)</code> report whether a continuation token has a live session and whether a turn is in flight on it.</li><li><code>interruptContinuation(token)</code> stops the in-flight turn and clears coalesced follow-ups queued behind it.</li><li><code>resolveApproval(sessionId, callId, decision, auth, options?)</code> approves or denies a parked tool call, how Slack Block Kit buttons unblock a turn without the HTTP approvals route.</li></ul><h2 id="auth-policies" tabindex="-1">Auth policies <a class="header-anchor" href="#auth-policies" aria-label="Permalink to &quot;Auth policies&quot;">​</a></h2><p>Every route runs an auth-policy chain: the channel&#39;s <code>auth</code> array, or <code>[localDevStrict()]</code> when unset. A policy is a function <code>(request, info) =&gt; AuthContext | null</code> (async allowed); the first non-null wins, and a request no policy admits gets <code>401</code>.</p><table tabindex="0"><thead><tr><th>Policy</th><th>Admits</th></tr></thead><tbody><tr><td><code>localDevStrict()</code></td><td>Direct loopback callers with no proxy-forwarding headers (<code>X-Forwarded-For</code>, <code>X-Real-IP</code>, <code>Forwarded</code>, and <code>X-Forwarded-Host</code> are all rejected, so tunnels and same-host reverse proxies don&#39;t silently re-expose the route), plus a loopback <code>Host</code> header, which rejects DNS-rebinding callers that reach 127.0.0.1 with a remote hostname.</td></tr><tr><td><code>localDev()</code></td><td>Like <code>localDevStrict()</code> but without the <code>Host</code> check. An explicit, weaker opt-in.</td></tr><tr><td><code>loopbackOnly()</code></td><td>A loopback TCP peer, ignoring forwarding headers; for dev relays that legitimately carry them, like <code>gh webhook forward</code>.</td></tr><tr><td><code>bearerAuth(token)</code></td><td><code>Authorization: Bearer &lt;token&gt;</code>, compared in constant time. Also accepts a verifier function mapping a presented token to an <code>AuthContext</code>.</td></tr><tr><td><code>allowAll()</code></td><td>Everyone, as an <code>anonymous</code> principal. Only for surfaces protected upstream (an HMAC-verified webhook) or intentionally public.</td></tr><tr><td><code>publicEndpoint()</code></td><td>Everyone on this custom channel. Managed hosting also serves the channel without an alias token. Use it only when the handler verifies the provider signature.</td></tr></tbody></table><p><code>publicEndpoint()</code> applies only to custom channel routes. It does not open the built-in session or tool API.</p><p>The resolved <code>AuthContext</code> (<code>{ authenticator, principalId, principalType, attributes? }</code>) becomes the request principal. Sessions bind to the principal that created them, and follow-up, stream, and list routes enforce ownership (<code>403</code> otherwise).</p><p>Server flags interact with authored auth: <code>--bearer-token</code> swaps the default <code>localDevStrict()</code> for <code>bearerAuth(...)</code> on channels that don&#39;t author their own chain, and <code>--allow-anonymous</code> swaps it for <code>allowAll()</code>. Authored <code>auth</code> arrays always win over both. A channel that declares <code>[localDevStrict()]</code> stays loopback-only even on an <code>--allow-anonymous</code> host.</p><h2 id="first-class-channels" tabindex="-1">First class channels <a class="header-anchor" href="#first-class-channels" aria-label="Permalink to &quot;First class channels&quot;">​</a></h2><p><strong>Slack</strong> (<code>@cursor/july/channels/slack</code>): Socket Mode transport, streaming replies, engagement rules, approval cards, and a default block on Slack Connect / guest / other-workspace senders. Author <code>agent/channels/slack.ts</code> with <code>slackChannel()</code>. Guide: <a href="./../guides/slack.html">Slack</a>.</p><p><strong>GitHub</strong> (<code>@cursor/july/channels/github</code>): webhook dispatch with signature verification, per-event hooks returning <code>{ auth }</code> (a model turn), <code>{ task }</code> (host work), or <code>null</code>, and CLI tooling for replay and live forwarding. Author <code>agent/channels/github.ts</code> with <code>githubChannel()</code>. Opt-in <code>progress.commitStatus</code> and <code>progress.banner</code> converge a merge-box check and sticky PR comment from default stream events. Guide: <a href="./../guides/github.html">GitHub</a>.</p><p><strong>Deployments</strong> (<code>@cursor/july/channels/deployments</code>): pull deploy events. Declare <code>events</code> and handle each one in <code>onEvent</code>. Each event carries <code>deploySourceUri</code> and <code>deployVersion</code>. Author <code>agent/channels/deployments.ts</code> with <code>deploymentsChannel()</code>.</p><p>Omit <code>deploySourceUris</code> on hosted v2. The control plane binds <code>deploy_source</code> edges from the deploy&#39;s watched <code>repositories</code> and the channel admits what it is sent, which is what makes it multi-tenant safe.</p><p>Name sources to narrow below that scope, or to drive the self-hosted pull relay, which has no deploy scope to inherit. There, subscribe per deploy source with <code>deploySourceUris</code> and narrow with <code>environments</code> / <code>events</code>. Each entry must match <code>Deployment.deploy_source_uri</code> as your deployment writer records it; matching is case-insensitive but otherwise literal. It uses the host credential. A restart resumes rather than dropping events. An empty <code>deploySourceUris</code> list mounts the channel but starts no pull, so an env-configured agent stays inert until its deploy sources are set.</p><p><strong>Change Monitors</strong> (<code>@cursor/july/channels/change-monitors</code>): Change Monitor Checkpoint events. The channel publishes Factory <code>checkpoint.created</code> for every Checkpoint create. The agent filters the result (for example to the <code>issues</code> arm). The payload contains the full Checkpoint resource. This channel is scoped to Change Monitors, not generic Factory Checkpoints. There is no repository filter or resource filter. Author <code>agent/channels/change-monitors.ts</code> with <code>changeMonitorsChannel()</code>. It uses the host credential. The v1 omitted continuation is <code>none/v1</code>. A v2 agent defaults to <code>change_monitors.checkpoint/v2</code>, which keys the session as <code>cont:change_monitors:{checkpointName}</code>.</p><p><strong>Issues</strong> (<code>@cursor/july/channels/issues</code>): Factory issue events. The channel publishes <code>issue.created</code> for every Issue create. The agent filters if it needs a subset. The payload contains the full Issue resource. There is no repository filter or resource filter. Author <code>agent/channels/issues.ts</code> with <code>issuesChannel()</code>. It uses the host credential. The v1 omitted continuation is <code>none/v1</code>. A v2 agent defaults to <code>issues.issue/v2</code>, which keys the session by issue name.</p><p>For other platforms like Discord or Teams, use the authored <code>defineChannel</code> webhook form.</p><h2 id="continuation-semantics" tabindex="-1">Continuation semantics <a class="header-anchor" href="#continuation-semantics" aria-label="Permalink to &quot;Continuation semantics&quot;">​</a></h2><p>Channels own their continuation-token format. The built-in HTTP channel mints opaque rotating tokens, Slack uses <code>channelId:threadTs</code>, and PR automations use keys like <code>pr:owner/repo#N</code>. Same token, same durable session; one active continuation per session; the HTTP channel returns <code>409</code> for stale tokens. For the full session model, see <a href="./sessions.html">Sessions</a>.</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/webhooks.html">Webhooks guide</a>: the same API, walked through</li><li><a href="./http-api.html">HTTP API</a>: session, discovery, and channel routes</li><li><a href="./sessions.html">Sessions and streaming</a>: the events channels subscribe to</li></ul>`,44)])])}const E=e(n,[["render",o]]);export{k as __pageData,E as default};
53
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>This example assumes <code>agent/tools/inspect_pr.ts</code> exists. The handler calls it before the model turn, so every review starts with validated PR data. It also derives a stable conversation key from the PR URL and writes the tool result to <code>pr.json</code>. Instructions can ask the model to inspect a PR, but host code guarantees it.</p><h2 id="route-verbs-and-schemas" tabindex="-1">Route verbs and schemas <a class="header-anchor" href="#route-verbs-and-schemas" aria-label="Permalink to &quot;Route verbs and schemas&quot;">​</a></h2><p><code>GET</code>, <code>POST</code>, <code>PUT</code>, <code>PATCH</code>, and <code>DELETE</code> helpers build routes. Their schemas are Zod, enforced at compile time:</p><table tabindex="0"><thead><tr><th>Verb</th><th>Required schema</th></tr></thead><tbody><tr><td><code>GET</code></td><td><code>querySchema</code></td></tr><tr><td><code>POST</code> / <code>PUT</code> / <code>PATCH</code></td><td><code>bodySchema</code> (optional <code>querySchema</code>)</td></tr><tr><td><code>DELETE</code></td><td>both optional</td></tr></tbody></table><p>Plain JSON Schema objects won&#39;t type-check; use <code>z.object({})</code> or <code>z.unknown()</code> for intentionally open surfaces. The host validates before the handler runs. Handlers receive typed <code>args.body</code> and <code>args.query</code>, and empty POST bodies are coerced to <code>{}</code> first. Declared schemas are projected on <code>GET /v1/info</code>, which powers the playground&#39;s <strong>Try</strong> buttons and composer <strong>slash commands</strong>.</p><h2 id="handler-arguments" tabindex="-1">Handler arguments <a class="header-anchor" href="#handler-arguments" aria-label="Permalink to &quot;Handler arguments&quot;">​</a></h2><p>Handlers receive the Fetch <code>Request</code> and an args object:</p><table tabindex="0"><thead><tr><th>Member</th><th>What it is</th></tr></thead><tbody><tr><td><code>send(message, options?)</code></td><td>Run a model turn on this channel; returns the session handle (options below)</td></tr><tr><td><code>getSession(sessionId)</code></td><td>Look up an existing session on this channel</td></tr><tr><td><code>receive(channelDefinition, input)</code></td><td>Hand off to another channel (schedules use this)</td></tr><tr><td><code>callTool(name, input, options?)</code></td><td>Deterministic server-tool call (<a href="./tools.html#call-a-tool-without-a-model-turn">Tools</a>)</td></tr><tr><td><code>body</code>, <code>query</code>, <code>params</code></td><td>Validated payloads and <code>:param</code> path segments</td></tr><tr><td><code>auth</code></td><td>The <code>AuthContext</code> resolved by this route&#39;s auth chain</td></tr><tr><td><code>requestIp</code></td><td>The TCP peer address</td></tr><tr><td><code>host</code></td><td>Shared services: <code>host.mcp</code>, <code>host.github</code>, <code>host.slack</code>, <code>host.kv</code>, <code>host.files</code>, <code>host.reminders</code></td></tr><tr><td><code>waitUntil(promise)</code></td><td>Background work that outlives the response</td></tr><tr><td><code>sessionUrls(request, sessionId)</code></td><td>Absolute playground + trace URLs for a session on this mount</td></tr><tr><td><code>artifacts</code></td><td>Unbound <a href="./artifacts.html">artifacts</a> facade; pass <code>sessionId</code> in <code>tag</code> input to attribute one</td></tr></tbody></table><p><code>send</code> options: <code>continuationToken</code> (the conversation key), <code>admission</code> (<code>&quot;preempt&quot;</code> interrupts a busy session, the default; <code>&quot;coalesce&quot;</code> enqueues behind the running turn, the <a href="./sessions.html#what-happens-when-i-send-a-follow-up">Slack policy</a>), <code>workspaceFiles</code>, <code>workspaceDir</code>, <code>cloud</code> (attach cloud repos for this session), <code>auth</code> (defaults to the request principal), <code>state</code> (starting channel state for new sessions), <code>title</code> (session display title), and <code>purpose</code> (<code>&quot;eval&quot;</code> skips sticky A/B enrollment).</p><h2 id="events" tabindex="-1">Events <a class="header-anchor" href="#events" aria-label="Permalink to &quot;Events&quot;">​</a></h2><p>The <code>events</code> map subscribes the channel to stream events for the sessions it owns. Keys are event types from the <a href="./sessions.html#which-events-can-i-stream">event vocabulary</a>, or <code>&quot;*&quot;</code>. Handlers receive <code>(event, channel, ctx)</code>, where <code>channel.state</code> is the per-session adapter state, <code>ctx.session</code> is the session info, and <code>ctx.host</code> is the shared host services, bound to that session as in a <a href="./hooks.html#handler-context">hook</a>. This is where a channel delivers replies back to its surface.</p><h2 id="state-and-lifecycle" tabindex="-1">State and lifecycle <a class="header-anchor" href="#state-and-lifecycle" aria-label="Permalink to &quot;State and lifecycle&quot;">​</a></h2><p><code>state</code> declares the starting per-session adapter state (JSON), persisted on the session record. Routes and event handlers read and mutate it through <code>channel.state</code>. <code>onStart(args)</code> runs when the channel mounts. <code>onStop()</code> runs when the server stops.</p><p><code>onStart</code> receives the route helpers (<code>send</code>, <code>getSession</code>, <code>receive</code>, <code>callTool</code>, <code>host</code>, <code>waitUntil</code>, <code>artifacts</code>, <code>logger</code>) plus helpers for long-lived transports:</p><ul><li><code>emitAssistantMessage(sessionId, text)</code> appends an assistant message without a model turn, for host tasks that already produced the final text.</li><li><code>hasContinuationSession(token)</code> and <code>isContinuationBusy(token)</code> report whether a continuation token has a live session and whether a turn is in flight on it.</li><li><code>interruptContinuation(token)</code> stops the in-flight turn and clears coalesced follow-ups queued behind it.</li><li><code>resolveApproval(sessionId, callId, decision, auth, options?)</code> approves or denies a parked tool call, how Slack Block Kit buttons unblock a turn without the HTTP approvals route.</li></ul><h2 id="auth-policies" tabindex="-1">Auth policies <a class="header-anchor" href="#auth-policies" aria-label="Permalink to &quot;Auth policies&quot;">​</a></h2><p>Every route runs an auth-policy chain: the channel&#39;s <code>auth</code> array, or <code>[localDevStrict()]</code> when unset. A policy is a function <code>(request, info) =&gt; AuthContext | null</code> (async allowed); the first non-null wins, and a request no policy admits gets <code>401</code>.</p><table tabindex="0"><thead><tr><th>Policy</th><th>Admits</th></tr></thead><tbody><tr><td><code>localDevStrict()</code></td><td>Direct loopback callers with no proxy-forwarding headers (<code>X-Forwarded-For</code>, <code>X-Real-IP</code>, <code>Forwarded</code>, and <code>X-Forwarded-Host</code> are all rejected, so tunnels and same-host reverse proxies don&#39;t silently re-expose the route), plus a loopback <code>Host</code> header, which rejects DNS-rebinding callers that reach 127.0.0.1 with a remote hostname.</td></tr><tr><td><code>localDev()</code></td><td>Like <code>localDevStrict()</code> but without the <code>Host</code> check. An explicit, weaker opt-in.</td></tr><tr><td><code>loopbackOnly()</code></td><td>A loopback TCP peer, ignoring forwarding headers; for dev relays that legitimately carry them, like <code>gh webhook forward</code>.</td></tr><tr><td><code>bearerAuth(token)</code></td><td><code>Authorization: Bearer &lt;token&gt;</code>, compared in constant time. Also accepts a verifier function mapping a presented token to an <code>AuthContext</code>.</td></tr><tr><td><code>allowAll()</code></td><td>Everyone, as an <code>anonymous</code> principal. Only for surfaces protected upstream (an HMAC-verified webhook) or intentionally public.</td></tr><tr><td><code>publicEndpoint()</code></td><td>Everyone on this custom channel. Managed hosting also serves the channel without an alias token. Use it only when the handler verifies the provider signature.</td></tr></tbody></table><p><code>publicEndpoint()</code> applies only to custom channel routes. It does not open the built-in session or tool API.</p><p>The resolved <code>AuthContext</code> (<code>{ authenticator, principalId, principalType, attributes? }</code>) becomes the request principal. Sessions bind to the principal that created them, and follow-up, stream, and list routes enforce ownership (<code>403</code> otherwise).</p><p>Server flags interact with authored auth: <code>--bearer-token</code> swaps the default <code>localDevStrict()</code> for <code>bearerAuth(...)</code> on channels that don&#39;t author their own chain, and <code>--allow-anonymous</code> swaps it for <code>allowAll()</code>. Authored <code>auth</code> arrays always win over both. A channel that declares <code>[localDevStrict()]</code> stays loopback-only even on an <code>--allow-anonymous</code> host.</p><h2 id="first-class-channels" tabindex="-1">First class channels <a class="header-anchor" href="#first-class-channels" aria-label="Permalink to &quot;First class channels&quot;">​</a></h2><p><strong>Slack</strong> (<code>@cursor/july/channels/slack</code>): Socket Mode transport, streaming replies, engagement rules, approval cards, and a default block on Slack Connect / guest / other-workspace senders. Author <code>agent/channels/slack.ts</code> with <code>slackChannel()</code>. Guide: <a href="./../guides/slack.html">Slack</a>.</p><p><strong>GitHub</strong> (<code>@cursor/july/channels/github</code>): webhook dispatch with signature verification, per-event hooks returning <code>{ auth }</code> (a model turn), <code>{ task }</code> (host work), or <code>null</code>, and CLI tooling for replay and live forwarding. Author <code>agent/channels/github.ts</code> with <code>githubChannel()</code>. Opt-in <code>progress.commitStatus</code> and <code>progress.banner</code> converge a merge-box check and sticky PR comment from default stream events. Guide: <a href="./../guides/github.html">GitHub</a>.</p><p><strong>Deployments</strong> (<code>@cursor/july/channels/deployments</code>): pull deploy events. Declare <code>events</code> and handle each one in <code>onEvent</code>. Each event carries <code>deploySourceUri</code> and <code>deployVersion</code>. Author <code>agent/channels/deployments.ts</code> with <code>deploymentsChannel()</code>.</p><p>On Cursor-managed hosting, omit <code>deploySourceUris</code>. The deployment&#39;s watched repositories bind the event scope automatically. Name sources to narrow the scope or to drive the self-hosted pull relay. Subscribe per deploy source with <code>deploySourceUris</code> and narrow with <code>environments</code> or <code>events</code>. Each entry must match <code>Deployment.deploy_source_uri</code> as your deployment writer records it. Matching is case-insensitive but otherwise literal. It uses the host credential. A restart resumes rather than dropping events. An empty <code>deploySourceUris</code> list mounts the channel but starts no pull, so an env-configured agent stays inert until its deploy sources are set.</p><p><strong>Change Monitors</strong> (<code>@cursor/july/channels/change-monitors</code>): Change Monitor Checkpoint events. The channel publishes Factory <code>checkpoint.created</code> for every Checkpoint create. The agent filters the result (for example to the <code>issues</code> arm). The payload contains the full Checkpoint resource. This channel is scoped to Change Monitors, not generic Factory Checkpoints. There is no repository filter or resource filter. Author <code>agent/channels/change-monitors.ts</code> with <code>changeMonitorsChannel()</code>. It uses the host credential.</p><p><strong>Issues</strong> (<code>@cursor/july/channels/issues</code>): Factory issue events. The channel publishes <code>issue.created</code> for every Issue create. The agent filters if it needs a subset. The payload contains the full Issue resource. There is no repository filter or resource filter. Author <code>agent/channels/issues.ts</code> with <code>issuesChannel()</code>. It uses the host credential.</p><p>For other platforms like Discord or Teams, use the authored <code>defineChannel</code> webhook form.</p><h2 id="continuation-semantics" tabindex="-1">Continuation semantics <a class="header-anchor" href="#continuation-semantics" aria-label="Permalink to &quot;Continuation semantics&quot;">​</a></h2><p>Channels own their continuation-token format. The built-in HTTP channel mints opaque rotating tokens, Slack uses <code>channelId:threadTs</code>, and PR automations use keys like <code>pr:owner/repo#N</code>. Same token, same durable session; one active continuation per session; the HTTP channel returns <code>409</code> for stale tokens. For the full session model, see <a href="./sessions.html">Sessions</a>.</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/webhooks.html">Webhooks guide</a>: the same API, walked through</li><li><a href="./http-api.html">HTTP API</a>: session, discovery, and channel routes</li><li><a href="./sessions.html">Sessions and streaming</a>: the events channels subscribe to</li></ul>`,43)])])}const E=e(n,[["render",o]]);export{k as __pageData,E as default};
@@ -1 +1 @@
1
- import{_ as e,c as i,o as a,ag as t}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Channels","description":"The authoring reference for defineChannel, the built-in HTTP channel, route schemas, handler args, and the auth policies.","frontmatter":{"title":"Channels","description":"The authoring reference for defineChannel, the built-in HTTP channel, route schemas, handler args, and the auth policies."},"headers":[],"relativePath":"reference/channels.md","filePath":"reference/channels.md"}'),n={name:"reference/channels.md"};function o(h,s,l,d,r,c){return a(),i("div",null,[...s[0]||(s[0]=[t("",44)])])}const E=e(n,[["render",o]]);export{k as __pageData,E as default};
1
+ import{_ as e,c as a,o as i,ag as t}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Channels","description":"The authoring reference for defineChannel, the built-in HTTP channel, route schemas, handler args, and the auth policies.","frontmatter":{"title":"Channels","description":"The authoring reference for defineChannel, the built-in HTTP channel, route schemas, handler args, and the auth policies."},"headers":[],"relativePath":"reference/channels.md","filePath":"reference/channels.md"}'),n={name:"reference/channels.md"};function o(h,s,l,r,d,c){return i(),a("div",null,[...s[0]||(s[0]=[t("",43)])])}const E=e(n,[["render",o]]);export{k as __pageData,E as default};