@cursor/july 0.1.93 → 0.1.95

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 (440) hide show
  1. package/AGENTS.md +8 -20
  2. package/README.md +4 -26
  3. package/dist/channels/github/github-channel.d.ts.map +1 -1
  4. package/dist/channels/github/github-channel.js +14 -2
  5. package/dist/channels/github/types.d.ts +18 -3
  6. package/dist/channels/github/types.d.ts.map +1 -1
  7. package/dist/channels/origin/origin-channel.d.ts.map +1 -1
  8. package/dist/channels/origin/origin-channel.js +11 -3
  9. package/dist/channels/origin/origin-webhook.d.ts +11 -1
  10. package/dist/channels/origin/origin-webhook.d.ts.map +1 -1
  11. package/dist/channels/origin/origin-webhook.js +23 -3
  12. package/dist/channels/origin/types.d.ts +8 -0
  13. package/dist/channels/origin/types.d.ts.map +1 -1
  14. package/dist/channels/slack/attachments.js +2 -2
  15. package/dist/channels/slack/dispatch.d.ts +0 -7
  16. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  17. package/dist/channels/slack/dispatch.js +4 -7
  18. package/dist/channels/slack/eval-directive.d.ts +5 -12
  19. package/dist/channels/slack/eval-directive.d.ts.map +1 -1
  20. package/dist/channels/slack/eval-directive.js +8 -19
  21. package/dist/channels/slack/index.d.ts +0 -6
  22. package/dist/channels/slack/index.d.ts.map +1 -1
  23. package/dist/channels/slack/index.js +0 -6
  24. package/dist/channels/slack/pr-ref.d.ts +7 -1
  25. package/dist/channels/slack/pr-ref.d.ts.map +1 -1
  26. package/dist/channels/slack/pr-ref.js +42 -23
  27. package/dist/channels/slack/setup.d.ts +4 -4
  28. package/dist/channels/slack/setup.d.ts.map +1 -1
  29. package/dist/channels/slack/setup.js +8 -15
  30. package/dist/channels/slack/slack-channel.d.ts +6 -13
  31. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  32. package/dist/channels/slack/slack-channel.js +15 -101
  33. package/dist/channels/slack/types.d.ts +12 -79
  34. package/dist/channels/slack/types.d.ts.map +1 -1
  35. package/dist/channels/slack/types.js +1 -15
  36. package/dist/client.d.ts +14 -0
  37. package/dist/client.d.ts.map +1 -0
  38. package/dist/client.js +12 -0
  39. package/dist/connections.d.ts +18 -9
  40. package/dist/connections.d.ts.map +1 -1
  41. package/dist/connections.js +17 -8
  42. package/dist/docs/404.html +2 -2
  43. package/dist/docs/ab.html +4 -4
  44. package/dist/docs/assets/{app.CjWU-x0z.js → app.BBj0klBO.js} +1 -1
  45. package/dist/docs/assets/chunks/@localSearchIndexroot.oqPawjiD.js +1 -0
  46. package/dist/docs/assets/chunks/{VPLocalSearchBox.Cxy8ySFQ.js → VPLocalSearchBox.CUEXpL78.js} +1 -1
  47. package/dist/docs/assets/chunks/{theme.Dvq1Bktu.js → theme.DabmQnia.js} +2 -2
  48. package/dist/docs/assets/concepts.md.lwAgBIMI.js +1 -0
  49. package/dist/docs/assets/{deployment.md.DoLFAzfm.js → deployment.md.D9msOFOW.js} +3 -8
  50. package/dist/docs/assets/{deployment.md.DoLFAzfm.lean.js → deployment.md.D9msOFOW.lean.js} +1 -1
  51. package/dist/docs/assets/{guides_agent-to-agent.md.B3JIaAqz.js → guides_agent-to-agent.md.BDb0t1QV.js} +1 -1
  52. package/dist/docs/assets/guides_cloud-runtime.md.CkYbjnAX.js +9 -0
  53. package/dist/docs/assets/guides_cloud-runtime.md.CkYbjnAX.lean.js +1 -0
  54. package/dist/docs/assets/{guides_convert-automation.md.Bboisykk.js → guides_convert-automation.md.B4sjlodG.js} +1 -1
  55. package/dist/docs/assets/{guides_github.md.DqJhuaN1.js → guides_github.md.Cnh2mL4a.js} +1 -1
  56. package/dist/docs/assets/{guides_mcp-oauth.md.CJvrXtkN.js → guides_mcp-oauth.md.DPYmBCbV.js} +7 -9
  57. package/dist/docs/assets/{guides_mcp-oauth.md.CJvrXtkN.lean.js → guides_mcp-oauth.md.DPYmBCbV.lean.js} +1 -1
  58. package/dist/docs/assets/{guides_slack.md.mqeNKs84.js → guides_slack.md.C32HsdKk.js} +5 -11
  59. package/dist/docs/assets/guides_slack.md.C32HsdKk.lean.js +1 -0
  60. package/dist/docs/assets/index.md.BoHaMdeZ.js +5 -0
  61. package/dist/docs/assets/{index.md.B-lVR4wT.lean.js → index.md.BoHaMdeZ.lean.js} +1 -1
  62. package/dist/docs/assets/{quickstart.md.BrmfrrIr.js → quickstart.md.Nj_LjW_a.js} +1 -1
  63. package/dist/docs/assets/{reference_cli.md.D9KESDsD.js → reference_cli.md.BsMOxDvh.js} +4 -3
  64. package/dist/docs/assets/{reference_cli.md.D9KESDsD.lean.js → reference_cli.md.BsMOxDvh.lean.js} +1 -1
  65. package/dist/docs/assets/{reference_connections.md.DB6SsN6U.js → reference_connections.md.BH8Oc0D0.js} +5 -5
  66. package/dist/docs/assets/{reference_connections.md.DB6SsN6U.lean.js → reference_connections.md.BH8Oc0D0.lean.js} +1 -1
  67. package/dist/docs/assets/{reference_hooks.md.BxN87gCw.js → reference_hooks.md.a8BJxMR5.js} +1 -1
  68. package/dist/docs/assets/reference_http-api.md.D89k1mdm.js +11 -0
  69. package/dist/docs/assets/reference_http-api.md.D89k1mdm.lean.js +1 -0
  70. package/dist/docs/assets/reference_project-layout.md.Bv4KOtlB.js +19 -0
  71. package/dist/docs/assets/{reference_subagents.md.Xoav0AII.js → reference_subagents.md.CfsIloPm.js} +1 -1
  72. package/dist/docs/assets/{reference_tools.md.DuKvkYWG.js → reference_tools.md.BHeXn2id.js} +3 -3
  73. package/dist/docs/assets/{reference_tools.md.DuKvkYWG.lean.js → reference_tools.md.BHeXn2id.lean.js} +1 -1
  74. package/dist/docs/assets/{templates_agentic-owners.md.DqtPdm6f.js → templates_agentic-owners.md.BZSH4N9z.js} +1 -1
  75. package/dist/docs/assets/{templates_demo.md.DhFcWN6j.js → templates_demo.md.BeQX9V3H.js} +1 -1
  76. package/dist/docs/assets/{templates_pr-autofixer.md.R4K_qytS.js → templates_pr-autofixer.md.x5zl6-GT.js} +2 -2
  77. package/dist/docs/assets/{templates_pr-autofixer.md.R4K_qytS.lean.js → templates_pr-autofixer.md.x5zl6-GT.lean.js} +1 -1
  78. package/dist/docs/assets/templates_security-help.md.C3Ny_Qr2.js +4 -0
  79. package/dist/docs/assets/templates_security-help.md.C3Ny_Qr2.lean.js +1 -0
  80. package/dist/docs/assets/{templates_security-reviewer.md.ByFyRta2.js → templates_security-reviewer.md.lshxbCLK.js} +2 -2
  81. package/dist/docs/assets/{templates_security-reviewer.md.ByFyRta2.lean.js → templates_security-reviewer.md.lshxbCLK.lean.js} +1 -1
  82. package/dist/docs/assets/{templates_triage.md.CVlpctKS.js → templates_triage.md.Co4UNzkZ.js} +3 -3
  83. package/dist/docs/assets/{templates_triage.md.CVlpctKS.lean.js → templates_triage.md.Co4UNzkZ.lean.js} +1 -1
  84. package/dist/docs/assets/troubleshooting.md.Ctv3T8C2.js +1 -0
  85. package/dist/docs/building-with-agents.html +4 -4
  86. package/dist/docs/concepts.html +5 -5
  87. package/dist/docs/concepts.md +1 -0
  88. package/dist/docs/deployment.html +7 -12
  89. package/dist/docs/deployment.md +1 -20
  90. package/dist/docs/design/agsh.md +406 -0
  91. package/dist/docs/evals.html +4 -4
  92. package/dist/docs/guides/agent-to-agent.html +6 -6
  93. package/dist/docs/guides/agent-to-agent.md +2 -2
  94. package/dist/docs/guides/cloud-runtime.html +6 -6
  95. package/dist/docs/guides/cloud-runtime.md +1 -0
  96. package/dist/docs/guides/convert-automation.html +6 -6
  97. package/dist/docs/guides/convert-automation.md +1 -1
  98. package/dist/docs/guides/github.html +6 -6
  99. package/dist/docs/guides/github.md +4 -4
  100. package/dist/docs/guides/human-in-the-loop.html +4 -4
  101. package/dist/docs/guides/mcp-oauth.html +11 -13
  102. package/dist/docs/guides/mcp-oauth.md +10 -18
  103. package/dist/docs/guides/opentelemetry.html +5 -5
  104. package/dist/docs/guides/slack.html +9 -15
  105. package/dist/docs/guides/slack.md +9 -46
  106. package/dist/docs/guides/webhooks.html +4 -4
  107. package/dist/docs/hashmap.json +1 -1
  108. package/dist/docs/hillclimbing.html +4 -4
  109. package/dist/docs/index.html +6 -6
  110. package/dist/docs/index.md +3 -29
  111. package/dist/docs/llms-full.txt +756 -2810
  112. package/dist/docs/llms.txt +3 -16
  113. package/dist/docs/quickstart.html +6 -6
  114. package/dist/docs/quickstart.md +2 -3
  115. package/dist/docs/reference/agent-config.html +4 -4
  116. package/dist/docs/reference/artifacts.html +4 -4
  117. package/dist/docs/reference/channels.html +4 -4
  118. package/dist/docs/reference/cli.html +8 -7
  119. package/dist/docs/reference/cli.md +5 -2
  120. package/dist/docs/reference/connections.html +9 -9
  121. package/dist/docs/reference/connections.md +15 -11
  122. package/dist/docs/reference/hooks.html +6 -6
  123. package/dist/docs/reference/hooks.md +2 -3
  124. package/dist/docs/reference/http-api.html +6 -6
  125. package/dist/docs/reference/http-api.md +8 -0
  126. package/dist/docs/reference/instructions.html +4 -4
  127. package/dist/docs/reference/playground.html +4 -4
  128. package/dist/docs/reference/project-layout.html +8 -6
  129. package/dist/docs/reference/project-layout.md +5 -1
  130. package/dist/docs/reference/prompt.html +4 -4
  131. package/dist/docs/reference/schedules.html +4 -4
  132. package/dist/docs/reference/sessions.html +4 -4
  133. package/dist/docs/reference/skills.html +4 -4
  134. package/dist/docs/reference/subagents.html +6 -6
  135. package/dist/docs/reference/subagents.md +2 -2
  136. package/dist/docs/reference/tools.html +7 -7
  137. package/dist/docs/reference/tools.md +19 -3
  138. package/dist/docs/scaffolding-agents.html +4 -4
  139. package/dist/docs/storage.html +4 -4
  140. package/dist/docs/templates/agentic-owners.html +7 -7
  141. package/dist/docs/templates/agentic-owners.md +1 -1
  142. package/dist/docs/templates/demo.html +6 -6
  143. package/dist/docs/templates/demo.md +3 -2
  144. package/dist/docs/templates/pr-autofixer.html +6 -6
  145. package/dist/docs/templates/pr-autofixer.md +8 -13
  146. package/dist/docs/templates/security-help.html +30 -0
  147. package/dist/docs/templates/security-help.md +65 -0
  148. package/dist/docs/templates/security-reviewer.html +6 -6
  149. package/dist/docs/templates/security-reviewer.md +1 -3
  150. package/dist/docs/templates/triage.html +7 -7
  151. package/dist/docs/templates/triage.md +2 -6
  152. package/dist/docs/troubleshooting.html +5 -5
  153. package/dist/docs/troubleshooting.md +2 -2
  154. package/dist/files-backends/cursor-hosted.d.ts +6 -2
  155. package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
  156. package/dist/files-backends/cursor-hosted.js +2 -2
  157. package/dist/files.d.ts +2 -0
  158. package/dist/files.d.ts.map +1 -1
  159. package/dist/files.js +5 -0
  160. package/dist/index.d.ts +1 -1
  161. package/dist/index.d.ts.map +1 -1
  162. package/dist/index.js +1 -1
  163. package/dist/internal/advertise-tools.d.ts +11 -0
  164. package/dist/internal/advertise-tools.d.ts.map +1 -1
  165. package/dist/internal/advertise-tools.js +47 -9
  166. package/dist/internal/cli-deploy.d.ts.map +1 -1
  167. package/dist/internal/cli-deploy.js +135 -6
  168. package/dist/internal/cli-mcp-oauth.d.ts.map +1 -1
  169. package/dist/internal/cli-mcp-oauth.js +7 -4
  170. package/dist/internal/conversation-mirror.d.ts +82 -0
  171. package/dist/internal/conversation-mirror.d.ts.map +1 -0
  172. package/dist/internal/conversation-mirror.js +251 -0
  173. package/dist/internal/convert-automation/convert-workflow.d.ts.map +1 -1
  174. package/dist/internal/convert-automation/convert-workflow.js +26 -15
  175. package/dist/internal/convert-automation/slug.d.ts +0 -2
  176. package/dist/internal/convert-automation/slug.d.ts.map +1 -1
  177. package/dist/internal/convert-automation/slug.js +0 -8
  178. package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
  179. package/dist/internal/cursor/account-mcp.js +5 -1
  180. package/dist/internal/deferred-channel-session.d.ts +20 -0
  181. package/dist/internal/deferred-channel-session.d.ts.map +1 -0
  182. package/dist/internal/deferred-channel-session.js +62 -0
  183. package/dist/internal/deploy-client.d.ts +13 -1
  184. package/dist/internal/deploy-client.d.ts.map +1 -1
  185. package/dist/internal/deploy-client.js +11 -1
  186. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  187. package/dist/internal/deploy-manifest.js +11 -5
  188. package/dist/internal/discovery.d.ts.map +1 -1
  189. package/dist/internal/discovery.js +110 -15
  190. package/dist/internal/framework-storage-selection.d.ts +32 -16
  191. package/dist/internal/framework-storage-selection.d.ts.map +1 -1
  192. package/dist/internal/framework-storage-selection.js +51 -17
  193. package/dist/internal/hosted-admission-context.d.ts +20 -0
  194. package/dist/internal/hosted-admission-context.d.ts.map +1 -0
  195. package/dist/internal/hosted-admission-context.js +31 -0
  196. package/dist/internal/hosted-delivery-protocol.d.ts +5 -0
  197. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  198. package/dist/internal/hosted-delivery-protocol.js +33 -1
  199. package/dist/internal/hosted-delivery.d.ts +4 -2
  200. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  201. package/dist/internal/hosted-delivery.js +97 -44
  202. package/dist/internal/hosted-managed-automation.d.ts +30 -0
  203. package/dist/internal/hosted-managed-automation.d.ts.map +1 -0
  204. package/dist/internal/hosted-managed-automation.js +58 -0
  205. package/dist/internal/mcp-endpoint.js +3 -3
  206. package/dist/internal/mcp-host.d.ts +8 -7
  207. package/dist/internal/mcp-host.d.ts.map +1 -1
  208. package/dist/internal/mcp-host.js +8 -7
  209. package/dist/internal/peer-connections.d.ts.map +1 -1
  210. package/dist/internal/peer-connections.js +5 -1
  211. package/dist/internal/playground/static.d.ts +0 -3
  212. package/dist/internal/playground/static.d.ts.map +1 -1
  213. package/dist/internal/resolved-connections.d.ts.map +1 -1
  214. package/dist/internal/resolved-connections.js +5 -7
  215. package/dist/internal/review-comments.d.ts.map +1 -1
  216. package/dist/internal/review-comments.js +10 -98
  217. package/dist/internal/scm/pr-url.d.ts +14 -0
  218. package/dist/internal/scm/pr-url.d.ts.map +1 -0
  219. package/dist/internal/scm/pr-url.js +65 -0
  220. package/dist/internal/sdk-runner.d.ts +14 -0
  221. package/dist/internal/sdk-runner.d.ts.map +1 -1
  222. package/dist/internal/sdk-runner.js +41 -2
  223. package/dist/internal/server.d.ts.map +1 -1
  224. package/dist/internal/server.js +123 -174
  225. package/dist/internal/session-engine.d.ts +45 -10
  226. package/dist/internal/session-engine.d.ts.map +1 -1
  227. package/dist/internal/session-engine.js +217 -65
  228. package/dist/internal/tool-catalog.d.ts +31 -0
  229. package/dist/internal/tool-catalog.d.ts.map +1 -0
  230. package/dist/internal/tool-catalog.js +67 -0
  231. package/dist/playground/assets/index-CF7hUDnQ.css +1 -0
  232. package/dist/playground/assets/{index-D9MFzhNE.js → index-CZA1uEWA.js} +48 -48
  233. package/dist/playground/index.html +2 -2
  234. package/dist/storage-backends/cursor-hosted.d.ts +7 -2
  235. package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
  236. package/dist/storage-backends/cursor-hosted.js +2 -2
  237. package/dist/types.d.ts +72 -23
  238. package/dist/types.d.ts.map +1 -1
  239. package/dist/types.js +19 -0
  240. package/docs/README.md +3 -29
  241. package/docs/concepts.md +1 -0
  242. package/docs/deployment.md +1 -20
  243. package/docs/design/agsh.md +406 -0
  244. package/docs/guides/agent-to-agent.md +2 -2
  245. package/docs/guides/cloud-runtime.md +1 -0
  246. package/docs/guides/convert-automation.md +1 -1
  247. package/docs/guides/github.md +4 -4
  248. package/docs/guides/mcp-oauth.md +10 -18
  249. package/docs/guides/slack.md +10 -47
  250. package/docs/quickstart.md +2 -3
  251. package/docs/reference/cli.md +5 -2
  252. package/docs/reference/connections.md +15 -11
  253. package/docs/reference/hooks.md +2 -3
  254. package/docs/reference/http-api.md +8 -0
  255. package/docs/reference/project-layout.md +5 -1
  256. package/docs/reference/subagents.md +2 -2
  257. package/docs/reference/tools.md +19 -3
  258. package/docs/templates/agentic-owners.md +1 -1
  259. package/docs/templates/demo.md +3 -2
  260. package/docs/templates/pr-autofixer.md +8 -13
  261. package/docs/templates/security-help.md +70 -0
  262. package/docs/templates/security-reviewer.md +1 -3
  263. package/docs/templates/triage.md +2 -6
  264. package/docs/troubleshooting.md +2 -2
  265. package/package.json +9 -2
  266. package/skills/create-agent/SKILL.md +6 -13
  267. package/skills/debug/SKILL.md +2 -4
  268. package/skills/evals/SKILL.md +1 -1
  269. package/skills/framework-map/SKILL.md +3 -2
  270. package/skills/mcp-auth/SKILL.md +10 -13
  271. package/skills/setup-slack/SKILL.md +21 -137
  272. package/src/channels/github/github-channel.ts +23 -8
  273. package/src/channels/github/types.ts +19 -2
  274. package/src/channels/origin/origin-channel.ts +13 -1
  275. package/src/channels/origin/origin-webhook.ts +27 -3
  276. package/src/channels/origin/types.ts +8 -0
  277. package/src/channels/slack/attachments.ts +2 -2
  278. package/src/channels/slack/dispatch.ts +2 -16
  279. package/src/channels/slack/eval-directive.ts +8 -27
  280. package/src/channels/slack/index.ts +0 -6
  281. package/src/channels/slack/pr-ref.ts +56 -25
  282. package/src/channels/slack/setup.ts +8 -15
  283. package/src/channels/slack/slack-channel.ts +14 -125
  284. package/src/channels/slack/types.ts +12 -96
  285. package/src/client.ts +23 -0
  286. package/src/connections.ts +20 -7
  287. package/src/files-backends/cursor-hosted.ts +9 -3
  288. package/src/files.ts +11 -0
  289. package/src/index.ts +2 -0
  290. package/src/internal/advertise-tools.ts +45 -7
  291. package/src/internal/cli-deploy.ts +171 -7
  292. package/src/internal/cli-mcp-oauth.ts +6 -4
  293. package/src/internal/conversation-mirror.ts +330 -0
  294. package/src/internal/convert-automation/convert-workflow.ts +29 -17
  295. package/src/internal/convert-automation/slug.ts +0 -9
  296. package/src/internal/cursor/account-mcp.ts +4 -1
  297. package/src/internal/deferred-channel-session.ts +61 -0
  298. package/src/internal/deploy-client.ts +24 -1
  299. package/src/internal/deploy-manifest.ts +10 -5
  300. package/src/internal/discovery.ts +129 -15
  301. package/src/internal/fixtures/units-server.ts +52 -0
  302. package/src/internal/framework-storage-selection.ts +61 -19
  303. package/src/internal/hosted-admission-context.ts +37 -0
  304. package/src/internal/hosted-delivery-protocol.ts +44 -1
  305. package/src/internal/hosted-delivery.ts +155 -68
  306. package/src/internal/hosted-managed-automation.ts +72 -0
  307. package/src/internal/mcp-endpoint.ts +3 -3
  308. package/src/internal/mcp-host.ts +8 -7
  309. package/src/internal/peer-connections.ts +4 -1
  310. package/src/internal/playground/static.ts +1 -3
  311. package/src/internal/resolved-connections.ts +8 -10
  312. package/src/internal/review-comments.ts +10 -113
  313. package/src/internal/scm/pr-url.ts +95 -0
  314. package/src/internal/sdk-runner.ts +57 -2
  315. package/src/internal/server.ts +161 -251
  316. package/src/internal/session-engine.ts +266 -69
  317. package/src/internal/tool-catalog.ts +106 -0
  318. package/src/storage-backends/cursor-hosted.ts +10 -3
  319. package/src/types.ts +90 -23
  320. package/templates/agentic-owners/README.md +1 -1
  321. package/templates/agentic-owners/agent/agent.ts +0 -10
  322. package/templates/agentic-owners/agent/channels/github.ts +5 -14
  323. package/templates/agentic-owners/agent/lib/config.ts +0 -8
  324. package/templates/agentic-owners/agent/lib/review.ts +2 -15
  325. package/templates/agentic-owners/agent/tools/record_review.ts +2 -4
  326. package/templates/demo/agent/agent.ts +0 -10
  327. package/templates/pr-autofixer/README.md +0 -2
  328. package/templates/pr-autofixer/agent/agent.ts +0 -11
  329. package/templates/pr-autofixer/agent/channels/slack.ts +1 -2
  330. package/templates/pr-autofixer/agent/lib/pr-state.ts +5 -17
  331. package/templates/pr-autofixer/agent/lib/repos.ts +0 -1
  332. package/templates/security-help/README.md +2 -2
  333. package/templates/security-help/agent/agent.ts +1 -2
  334. package/templates/security-help/agent/channels/slack.ts +0 -3
  335. package/templates/security-help/agent/instructions.md +9 -10
  336. package/templates/security-help/agent/skills/access-request.md +1 -1
  337. package/templates/security-help/agent/skills/faq.md +31 -0
  338. package/templates/security-help/agent/skills/security-playbooks.md +1 -1
  339. package/templates/security-help/package.json +1 -2
  340. package/templates/security-reviewer/agent/agent.ts +0 -10
  341. package/templates/triage/README.md +2 -1
  342. package/templates/triage/agent/agent.ts +0 -10
  343. package/templates/triage/agent/channels/queue.ts +1 -1
  344. package/templates/triage/agent/channels/webhook.ts +1 -3
  345. package/templates/triage/overlays/jira/agent/mcp-connections/tracker.ts +0 -1
  346. package/templates/triage/overlays/linear/agent/mcp-connections/tracker.ts +0 -1
  347. package/dist/channels/slack/cursor-account.d.ts +0 -87
  348. package/dist/channels/slack/cursor-account.d.ts.map +0 -1
  349. package/dist/channels/slack/cursor-account.js +0 -100
  350. package/dist/docs/assets/chunks/@localSearchIndexroot.ChpIC3Zy.js +0 -1
  351. package/dist/docs/assets/concepts.md.F6AiPorA.js +0 -1
  352. package/dist/docs/assets/example-agents_approval-buddy.md.DmezILPg.js +0 -10
  353. package/dist/docs/assets/example-agents_approval-buddy.md.DmezILPg.lean.js +0 -1
  354. package/dist/docs/assets/example-agents_benny.md.B0kwY7D_.js +0 -5
  355. package/dist/docs/assets/example-agents_benny.md.B0kwY7D_.lean.js +0 -1
  356. package/dist/docs/assets/example-agents_bugbot.md.BRGMi9O2.js +0 -11
  357. package/dist/docs/assets/example-agents_bugbot.md.BRGMi9O2.lean.js +0 -1
  358. package/dist/docs/assets/example-agents_codebase-wiki.md.BBNw9Ekr.js +0 -8
  359. package/dist/docs/assets/example-agents_codebase-wiki.md.BBNw9Ekr.lean.js +0 -1
  360. package/dist/docs/assets/example-agents_codeowners-review.md.Bfta-lBU.js +0 -8
  361. package/dist/docs/assets/example-agents_codeowners-review.md.Bfta-lBU.lean.js +0 -1
  362. package/dist/docs/assets/example-agents_concierge.md.BzB2b20R.js +0 -22
  363. package/dist/docs/assets/example-agents_concierge.md.BzB2b20R.lean.js +0 -1
  364. package/dist/docs/assets/example-agents_index.md.ChBp0AX6.js +0 -2
  365. package/dist/docs/assets/example-agents_index.md.ChBp0AX6.lean.js +0 -1
  366. package/dist/docs/assets/example-agents_knowledge-base.md.CrA85ig-.js +0 -11
  367. package/dist/docs/assets/example-agents_knowledge-base.md.CrA85ig-.lean.js +0 -1
  368. package/dist/docs/assets/example-agents_oncall.md.DK4XkYTd.js +0 -10
  369. package/dist/docs/assets/example-agents_oncall.md.DK4XkYTd.lean.js +0 -1
  370. package/dist/docs/assets/example-agents_security-reviewer.md.74pPpWYj.js +0 -19
  371. package/dist/docs/assets/example-agents_security-reviewer.md.74pPpWYj.lean.js +0 -1
  372. package/dist/docs/assets/example-agents_slack-agent.md.D7Kdj5BV.js +0 -5
  373. package/dist/docs/assets/example-agents_slack-agent.md.D7Kdj5BV.lean.js +0 -1
  374. package/dist/docs/assets/example-agents_weather-agent.md.CaGpmw3Y.js +0 -25
  375. package/dist/docs/assets/example-agents_weather-agent.md.CaGpmw3Y.lean.js +0 -1
  376. package/dist/docs/assets/guides_cloud-runtime.md.BnvjPiia.js +0 -9
  377. package/dist/docs/assets/guides_cloud-runtime.md.BnvjPiia.lean.js +0 -1
  378. package/dist/docs/assets/guides_slack.md.mqeNKs84.lean.js +0 -1
  379. package/dist/docs/assets/index.md.B-lVR4wT.js +0 -5
  380. package/dist/docs/assets/reference_http-api.md.C68BERYr.js +0 -11
  381. package/dist/docs/assets/reference_http-api.md.C68BERYr.lean.js +0 -1
  382. package/dist/docs/assets/reference_project-layout.md.WN9nwJht.js +0 -17
  383. package/dist/docs/assets/troubleshooting.md.vCWwvqcJ.js +0 -1
  384. package/dist/docs/example-agents/approval-buddy.html +0 -36
  385. package/dist/docs/example-agents/approval-buddy.md +0 -266
  386. package/dist/docs/example-agents/benny.html +0 -31
  387. package/dist/docs/example-agents/benny.md +0 -173
  388. package/dist/docs/example-agents/bugbot.html +0 -37
  389. package/dist/docs/example-agents/bugbot.md +0 -229
  390. package/dist/docs/example-agents/codebase-wiki.html +0 -34
  391. package/dist/docs/example-agents/codebase-wiki.md +0 -167
  392. package/dist/docs/example-agents/codeowners-review.html +0 -34
  393. package/dist/docs/example-agents/codeowners-review.md +0 -192
  394. package/dist/docs/example-agents/concierge.html +0 -48
  395. package/dist/docs/example-agents/concierge.md +0 -200
  396. package/dist/docs/example-agents/index.html +0 -28
  397. package/dist/docs/example-agents/index.md +0 -99
  398. package/dist/docs/example-agents/knowledge-base.html +0 -37
  399. package/dist/docs/example-agents/knowledge-base.md +0 -168
  400. package/dist/docs/example-agents/oncall.html +0 -36
  401. package/dist/docs/example-agents/oncall.md +0 -212
  402. package/dist/docs/example-agents/security-reviewer.html +0 -45
  403. package/dist/docs/example-agents/security-reviewer.md +0 -265
  404. package/dist/docs/example-agents/slack-agent.html +0 -31
  405. package/dist/docs/example-agents/slack-agent.md +0 -142
  406. package/dist/docs/example-agents/weather-agent.html +0 -51
  407. package/dist/docs/example-agents/weather-agent.md +0 -297
  408. package/dist/internal/cursor-slack-relay.d.ts +0 -96
  409. package/dist/internal/cursor-slack-relay.d.ts.map +0 -1
  410. package/dist/internal/cursor-slack-relay.js +0 -176
  411. package/dist/playground/assets/index-D9N7-q97.css +0 -1
  412. package/docs/example-agents/approval-buddy.md +0 -271
  413. package/docs/example-agents/benny.md +0 -178
  414. package/docs/example-agents/bugbot.md +0 -234
  415. package/docs/example-agents/codebase-wiki.md +0 -172
  416. package/docs/example-agents/codeowners-review.md +0 -197
  417. package/docs/example-agents/concierge.md +0 -205
  418. package/docs/example-agents/index.md +0 -104
  419. package/docs/example-agents/knowledge-base.md +0 -173
  420. package/docs/example-agents/oncall.md +0 -217
  421. package/docs/example-agents/security-reviewer.md +0 -270
  422. package/docs/example-agents/slack-agent.md +0 -147
  423. package/docs/example-agents/weather-agent.md +0 -302
  424. package/src/channels/slack/cursor-account.ts +0 -202
  425. package/src/internal/cursor-slack-relay.ts +0 -249
  426. package/templates/security-help/agent/knowledge/faq/approvals.md +0 -5
  427. package/templates/security-help/agent/knowledge/faq/channels.md +0 -6
  428. package/templates/security-help/agent/knowledge/faq/phishing.md +0 -10
  429. package/templates/security-help/agent/skills/security-first-pass.md +0 -15
  430. /package/dist/docs/assets/{concepts.md.F6AiPorA.lean.js → concepts.md.lwAgBIMI.lean.js} +0 -0
  431. /package/dist/docs/assets/{guides_agent-to-agent.md.B3JIaAqz.lean.js → guides_agent-to-agent.md.BDb0t1QV.lean.js} +0 -0
  432. /package/dist/docs/assets/{guides_convert-automation.md.Bboisykk.lean.js → guides_convert-automation.md.B4sjlodG.lean.js} +0 -0
  433. /package/dist/docs/assets/{guides_github.md.DqJhuaN1.lean.js → guides_github.md.Cnh2mL4a.lean.js} +0 -0
  434. /package/dist/docs/assets/{quickstart.md.BrmfrrIr.lean.js → quickstart.md.Nj_LjW_a.lean.js} +0 -0
  435. /package/dist/docs/assets/{reference_hooks.md.BxN87gCw.lean.js → reference_hooks.md.a8BJxMR5.lean.js} +0 -0
  436. /package/dist/docs/assets/{reference_project-layout.md.WN9nwJht.lean.js → reference_project-layout.md.Bv4KOtlB.lean.js} +0 -0
  437. /package/dist/docs/assets/{reference_subagents.md.Xoav0AII.lean.js → reference_subagents.md.CfsIloPm.lean.js} +0 -0
  438. /package/dist/docs/assets/{templates_agentic-owners.md.DqtPdm6f.lean.js → templates_agentic-owners.md.BZSH4N9z.lean.js} +0 -0
  439. /package/dist/docs/assets/{templates_demo.md.DhFcWN6j.lean.js → templates_demo.md.BeQX9V3H.lean.js} +0 -0
  440. /package/dist/docs/assets/{troubleshooting.md.vCWwvqcJ.lean.js → troubleshooting.md.Ctv3T8C2.lean.js} +0 -0
@@ -50,8 +50,10 @@ import {
50
50
  type InlineStdioConnectionConfig,
51
51
  type InstructionsDefinition,
52
52
  isInlineStdioConnection,
53
+ isToolEffect,
53
54
  MAX_RUNNING_TURNS_LIMIT,
54
55
  type ModelSetting,
56
+ normalizeConnectionEffects,
55
57
  normalizeCursorAccountServers,
56
58
  type ResolvedAgent,
57
59
  type ScheduleDefinition,
@@ -305,7 +307,7 @@ export async function loadAgentProject(
305
307
  const hooks = await loadHooks(ctx, join(agentDir, "hooks"));
306
308
  const abs = await loadABs(ctx, agentDir);
307
309
  const abConfig = await loadABConfig(ctx, agentDir);
308
- const storage = await loadStorage(ctx, agentDir);
310
+ const storage = await loadStorage(ctx, agentDir, agent.architecture);
309
311
  const artifacts = await loadArtifacts(ctx, agentDir);
310
312
  const otel = await loadOtel(ctx, agentDir);
311
313
  await appendArtifactTool(ctx, agentDir, agent, artifacts);
@@ -423,6 +425,7 @@ async function loadAgent(
423
425
  tools: [],
424
426
  skills: [],
425
427
  connections: [],
428
+ hostConnections: [],
426
429
  subagents: [],
427
430
  seedFiles: [],
428
431
  };
@@ -434,6 +437,7 @@ async function loadAgent(
434
437
  ctx,
435
438
  await resolveMcpConnectionsDir(ctx, agentDir)
436
439
  );
440
+ const hostConnections = await loadHostConnections(ctx, agentDir, connections);
437
441
  const seedFiles = await loadSeedFiles(ctx, agentDir);
438
442
  const subagents = await loadSubagents(ctx, join(agentDir, "subagents"));
439
443
  const runtime = resolveRuntime(ctx, agentDir, config?.runtime);
@@ -553,7 +557,7 @@ async function loadAgent(
553
557
  agentTools: tools.filter((tool) => tool.execution === "agent").length,
554
558
  skills: skills.length,
555
559
  seedFiles: seedFiles.length,
556
- connections: connections.length,
560
+ connections: connections.length + hostConnections.length,
557
561
  subagents: subagents.length,
558
562
  hasCloudOptions: cloud !== undefined,
559
563
  hasLocalSandbox: localSandbox,
@@ -576,6 +580,7 @@ async function loadAgent(
576
580
  tools,
577
581
  skills,
578
582
  connections,
583
+ hostConnections,
579
584
  subagents,
580
585
  seedFiles,
581
586
  };
@@ -1143,6 +1148,26 @@ function hasAuthorizationHeader(
1143
1148
  );
1144
1149
  }
1145
1150
 
1151
+ function parseConnectionEffects(
1152
+ effects: unknown
1153
+ ): { ok: true; value: ToolEffect[] | undefined } | { ok: false } {
1154
+ if (effects === undefined) {
1155
+ return { ok: true, value: undefined };
1156
+ }
1157
+ const raw = typeof effects === "string" ? [effects] : effects;
1158
+ if (!Array.isArray(raw) || raw.length === 0) {
1159
+ return { ok: false };
1160
+ }
1161
+ const parsed: ToolEffect[] = [];
1162
+ for (const value of raw) {
1163
+ if (!isToolEffect(value)) {
1164
+ return { ok: false };
1165
+ }
1166
+ parsed.push(value);
1167
+ }
1168
+ return { ok: true, value: normalizeConnectionEffects(parsed) };
1169
+ }
1170
+
1146
1171
  function connectionHasSpawnOrRemote(connection: ConnectionDefinition): boolean {
1147
1172
  if ("cursorAccount" in connection && connection.cursorAccount === true) {
1148
1173
  return true;
@@ -1265,6 +1290,49 @@ async function resolveMcpConnectionsDir(
1265
1290
  return preferred;
1266
1291
  }
1267
1292
 
1293
+ async function loadHostConnections(
1294
+ ctx: DiscoveryContext,
1295
+ agentDir: string,
1296
+ modelConnections: readonly DiscoveredConnection[]
1297
+ ): Promise<DiscoveredConnection[]> {
1298
+ const hostDir = join(agentDir, "host-connections");
1299
+ const loaded = await loadConnections(ctx, hostDir);
1300
+ const modelNames = new Set(
1301
+ modelConnections.map((connection) => connection.name)
1302
+ );
1303
+ const hostConnections: DiscoveredConnection[] = [];
1304
+ for (const connection of loaded) {
1305
+ if (modelNames.has(connection.name)) {
1306
+ ctx.diagnostics.push({
1307
+ severity: "error",
1308
+ path: displayPath(ctx, join(hostDir, `${connection.name}.ts`)),
1309
+ message: `Host connection "${connection.name}" collides with agent/mcp-connections/${connection.name}. Rename one of them.`,
1310
+ });
1311
+ continue;
1312
+ }
1313
+ if (connection.advertiseTools === true) {
1314
+ ctx.diagnostics.push({
1315
+ severity: "error",
1316
+ path: displayPath(ctx, join(hostDir, `${connection.name}.ts`)),
1317
+ message:
1318
+ "Host connections are off the model. `advertiseTools` cannot apply. Drop it.",
1319
+ });
1320
+ continue;
1321
+ }
1322
+ if (connection.auth !== undefined) {
1323
+ ctx.diagnostics.push({
1324
+ severity: "error",
1325
+ path: displayPath(ctx, join(hostDir, `${connection.name}.ts`)),
1326
+ message:
1327
+ "Host connections are off the model. `auth` cannot apply. Use static headers or `oauth: true`.",
1328
+ });
1329
+ continue;
1330
+ }
1331
+ hostConnections.push(connection);
1332
+ }
1333
+ return hostConnections;
1334
+ }
1335
+
1268
1336
  async function loadConnections(
1269
1337
  ctx: DiscoveryContext,
1270
1338
  connectionsDir: string
@@ -1292,6 +1360,15 @@ async function loadConnections(
1292
1360
  continue;
1293
1361
  }
1294
1362
  const connection = definition as ConnectionDefinition;
1363
+ if (Object.hasOwn(connection, "hostOnly")) {
1364
+ ctx.diagnostics.push({
1365
+ severity: "error",
1366
+ path: displayPath(ctx, entryPath),
1367
+ message:
1368
+ "MCP connection `hostOnly` was removed. Files under `agent/mcp-connections/` are always visible to the model. Put privileged servers in `agent/host-connections/` so only host tools can call them.",
1369
+ });
1370
+ continue;
1371
+ }
1295
1372
  if (
1296
1373
  isInlineStdioConnection(connection) &&
1297
1374
  connectionHasSpawnOrRemote(connection)
@@ -1336,24 +1413,37 @@ async function loadConnections(
1336
1413
  });
1337
1414
  continue;
1338
1415
  }
1416
+ const parsedEffects = parseConnectionEffects(connection.effects);
1417
+ if (!parsedEffects.ok) {
1418
+ ctx.diagnostics.push({
1419
+ severity: "error",
1420
+ path: displayPath(ctx, entryPath),
1421
+ message:
1422
+ 'MCP connection `effects` must be "read", "write", or a non-empty array of those.',
1423
+ });
1424
+ continue;
1425
+ }
1339
1426
  if (
1340
- connection.advertiseTools === true &&
1341
- isInlineStdioConnection(connection)
1427
+ parsedEffects.value !== undefined &&
1428
+ connection.advertiseTools !== true
1342
1429
  ) {
1343
1430
  ctx.diagnostics.push({
1344
1431
  severity: "error",
1345
1432
  path: displayPath(ctx, entryPath),
1346
1433
  message:
1347
- "MCP connection `advertiseTools` is not supported on inline `tools` connections author those as agent/tools/ server tools instead.",
1434
+ "MCP connection `effects` filters advertised tools; set `advertiseTools: true` or drop `effects`.",
1348
1435
  });
1349
1436
  continue;
1350
1437
  }
1351
- if (connection.advertiseTools === true && connection.hostOnly === true) {
1438
+ if (
1439
+ connection.advertiseTools === true &&
1440
+ isInlineStdioConnection(connection)
1441
+ ) {
1352
1442
  ctx.diagnostics.push({
1353
1443
  severity: "error",
1354
1444
  path: displayPath(ctx, entryPath),
1355
1445
  message:
1356
- "MCP connection `advertiseTools` puts the connection's tools in the model's toolset, which contradicts `hostOnly` (off the model entirely). Drop one of them.",
1446
+ "MCP connection `advertiseTools` is not supported on inline `tools` connections author those as agent/tools/ server tools instead.",
1357
1447
  });
1358
1448
  continue;
1359
1449
  }
@@ -1445,9 +1535,9 @@ async function loadConnections(
1445
1535
  name,
1446
1536
  transport,
1447
1537
  description: connection.description,
1448
- hostOnly: connection.hostOnly,
1449
1538
  auth: connection.auth,
1450
1539
  advertiseTools: connection.advertiseTools,
1540
+ effects: parsedEffects.value,
1451
1541
  });
1452
1542
  }
1453
1543
  return connections;
@@ -1459,7 +1549,6 @@ async function loadInlineStdioConnection(
1459
1549
  entryPath: string,
1460
1550
  connection: InlineStdioConnectionConfig & {
1461
1551
  description?: string;
1462
- hostOnly?: boolean;
1463
1552
  }
1464
1553
  ): Promise<DiscoveredConnection | undefined> {
1465
1554
  const tools = connection.tools;
@@ -1510,7 +1599,6 @@ async function loadInlineStdioConnection(
1510
1599
  name,
1511
1600
  transport,
1512
1601
  description: connection.description,
1513
- hostOnly: connection.hostOnly,
1514
1602
  };
1515
1603
  } catch (error) {
1516
1604
  ctx.diagnostics.push({
@@ -1562,6 +1650,7 @@ async function warnUnsupportedSubagentSlots(
1562
1650
  ["tools", "tools"],
1563
1651
  ["skills", "skills"],
1564
1652
  ["mcp-connections", "MCP connections"],
1653
+ ["host-connections", "host MCP connections"],
1565
1654
  ["connections", "MCP connections"],
1566
1655
  ["subagents", "nested subagents"],
1567
1656
  ["channels", "channels"],
@@ -1670,8 +1759,8 @@ function checkGrokBotRuntimeLimitations(
1670
1759
  }
1671
1760
  if (counts.connections > 0) {
1672
1761
  error(
1673
- displayPath(ctx, join(agentDir, "mcp-connections")),
1674
- "MCP connections are not wired into grokbot turns yet. Remove them or run the agent on the local runtime."
1762
+ displayPath(ctx, agentDir),
1763
+ "MCP connections (agent/mcp-connections/ or agent/host-connections/) are not wired into grokbot turns yet. Remove them or run the agent on the local runtime."
1675
1764
  );
1676
1765
  }
1677
1766
  if (counts.subagents > 0) {
@@ -2062,12 +2151,35 @@ async function loadABConfig(
2062
2151
 
2063
2152
  async function loadStorage(
2064
2153
  ctx: DiscoveryContext,
2065
- agentDir: string
2154
+ agentDir: string,
2155
+ architecture: AgentArchitecture | undefined
2066
2156
  ): Promise<StorageDefinition | undefined> {
2067
2157
  const path = await findModuleFile(agentDir, "storage");
2068
2158
  if (path === undefined) {
2069
2159
  return undefined;
2070
2160
  }
2161
+ if (architecture === "v2") {
2162
+ // Storage is a hosting-mode decision on v2, made by
2163
+ // framework-storage-selection.ts: the state root when self-hosted,
2164
+ // Cursor-managed storage on Cursor hosting. Fail early (error
2165
+ // diagnostics refuse serve and deploy) rather than silently running
2166
+ // with storage the author believes they configured. Not imported.
2167
+ ctx.diagnostics.push({
2168
+ severity: "error",
2169
+ path: displayPath(ctx, path),
2170
+ message:
2171
+ 'agent/storage.ts is not supported on architecture "v2": the platform selects storage (the local state root when self-hosted; Cursor-managed storage on Cursor hosting). Delete the file.',
2172
+ });
2173
+ return undefined;
2174
+ }
2175
+ // v1 keeps loading the authored sink, with notice: defineStorage is going
2176
+ // away with the v1 control plane.
2177
+ ctx.diagnostics.push({
2178
+ severity: "warning",
2179
+ path: displayPath(ctx, path),
2180
+ message:
2181
+ 'agent/storage.ts (defineStorage) is deprecated and going away: architecture "v2" selects storage automatically (the local state root when self-hosted; Cursor-managed storage on Cursor hosting). Still honored on v1.',
2182
+ });
2071
2183
  const definition = await importDefault(ctx, path, "storage");
2072
2184
  return definition as StorageDefinition | undefined;
2073
2185
  }
@@ -2256,6 +2368,7 @@ export function projectInfo(project: AgentProject): AgentProjectInfo {
2256
2368
  description: tool.description,
2257
2369
  execution: tool.execution,
2258
2370
  needsApproval: tool.needsApproval,
2371
+ effect: tool.effect,
2259
2372
  inputSchema: tool.inputSchema,
2260
2373
  })),
2261
2374
  skills: agent.skills.map((skill) => ({
@@ -2265,8 +2378,8 @@ export function projectInfo(project: AgentProject): AgentProjectInfo {
2265
2378
  connections: agent.connections.map((connection) => ({
2266
2379
  name: connection.name,
2267
2380
  transport: connectionTransportLabel(connection.transport),
2268
- hostOnly: connection.hostOnly,
2269
2381
  advertiseTools: connection.advertiseTools,
2382
+ effects: connection.effects,
2270
2383
  cursorAccountServers:
2271
2384
  "cursorAccount" in connection.transport
2272
2385
  ? (connection.transport.servers ?? "*")
@@ -2448,6 +2561,7 @@ async function warnUnknownSlots(
2448
2561
  "tools",
2449
2562
  "skills",
2450
2563
  "mcp-connections",
2564
+ "host-connections",
2451
2565
  // Legacy slot name; resolveMcpConnectionsDir warns and still loads it.
2452
2566
  "connections",
2453
2567
  "subagents",
@@ -2457,7 +2571,7 @@ async function warnUnknownSlots(
2457
2571
  "ab",
2458
2572
  "sandbox",
2459
2573
  "lib",
2460
- // Vite playground custom tool chips (examples/*/agent/playground/tools).
2574
+ // Vite playground custom tool chips (agent/playground/tools).
2461
2575
  "playground",
2462
2576
  ]);
2463
2577
  for (const entry of await sortedEntries(agentDir)) {
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Tiny stdio MCP server used by mcp-host tests.
3
+ *
4
+ * Exposed as the `units` connection so the host can list and call tools
5
+ * over a real stdio transport.
6
+ */
7
+
8
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
9
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
10
+ import { z } from "zod";
11
+
12
+ const server = new McpServer({
13
+ name: "weather-units",
14
+ version: "0.1.0",
15
+ });
16
+
17
+ server.tool(
18
+ "celsius_to_fahrenheit",
19
+ "Convert a temperature from Celsius to Fahrenheit.",
20
+ { value: z.number().describe("Temperature in °C") },
21
+ async ({ value }) => {
22
+ const fahrenheit = Math.round((value * 9) / 5 + 32);
23
+ return {
24
+ content: [
25
+ {
26
+ type: "text",
27
+ text: JSON.stringify({ celsius: value, fahrenheit }),
28
+ },
29
+ ],
30
+ };
31
+ }
32
+ );
33
+
34
+ server.tool(
35
+ "fahrenheit_to_celsius",
36
+ "Convert a temperature from Fahrenheit to Celsius.",
37
+ { value: z.number().describe("Temperature in Fahrenheit") },
38
+ async ({ value }) => {
39
+ const celsius = Math.round(((value - 32) * 5) / 9);
40
+ return {
41
+ content: [
42
+ {
43
+ type: "text",
44
+ text: JSON.stringify({ fahrenheit: value, celsius }),
45
+ },
46
+ ],
47
+ };
48
+ }
49
+ );
50
+
51
+ const transport = new StdioServerTransport();
52
+ await server.connect(transport);
@@ -2,19 +2,31 @@
2
2
  * Which backend framework session state is mirrored to.
3
3
  *
4
4
  * Framework state — session records, event chunks, the continuation index —
5
- * is how a session outlives the process that served it. Today that mirror
6
- * exists only when the agent author wrote `agent/storage.ts`, which makes
7
- * platform durability an agent-level decision: of the first-party agents,
8
- * some choose `cursorHostedStorage()` and some choose `fileKv()` (pod-local
9
- * disk, lost on pod replacement), and one selects between them at runtime by
10
- * reading the deployment-id environment variable itself.
5
+ * is how a session outlives the process that served it. On architecture v1
6
+ * that mirror exists only when the agent author wrote `agent/storage.ts`,
7
+ * which makes platform durability an agent-level decision: of the
8
+ * first-party agents, some choose `cursorHostedStorage()` and some choose
9
+ * `fileKv()` (pod-local disk, lost on pod replacement), and one selects
10
+ * between them at runtime by reading the deployment-id environment variable
11
+ * itself.
11
12
  *
12
- * That selection is a hosting-mode question, not an authoring question, and
13
- * this module is where it will move. It deliberately reproduces today's
14
- * behavior exactly for now authored definition or nothing so the change
15
- * that makes framework durability automatic is a change to
16
- * {@link selectFrameworkStorageDefinition} alone, reviewable on its own and
17
- * revertable without touching the engine.
13
+ * That selection is a hosting-mode question, not an authoring question.
14
+ * Architecture v2 moves it here: `agent/storage.ts` is rejected at
15
+ * discovery (error diagnostic, so serve and deploy fail early), and the
16
+ * platform picks the default
17
+ *
18
+ * - **Cursor-managed hosting** (the deployment-generation environment
19
+ * variable is set, same signal that registers `GET /v1/manifest`):
20
+ * the Cursor-hosted backend, so session records, event chunks, `host.kv`,
21
+ * eval runs, and A/B samples land in the control plane and survive pod
22
+ * replacement. The API key resolves through the full credential chain on
23
+ * every call because hosted freeze snapshots listen unsigned and the
24
+ * binder drops the key file after restore.
25
+ * - **Self-hosted**: no mirror. `--state-root` is the durable copy, which
26
+ * is correct when the operator owns the disk.
27
+ *
28
+ * v1 keeps the authored definition (or nothing) so existing deployments are
29
+ * untouched while they run.
18
30
  *
19
31
  * Local disk is not part of this decision. `<stateRoot>/sessions/<id>/`
20
32
  * already holds `session.json` and `events.ndjson` unconditionally, through
@@ -22,24 +34,54 @@
22
34
  * pod's filesystem.
23
35
  */
24
36
 
25
- import type { StorageDefinition } from "../storage.js";
37
+ import { defineStorage, type StorageDefinition } from "../storage.js";
38
+ import { cursorHostedStorage } from "../storage-backends/cursor-hosted.js";
39
+ import type { AgentArchitecture } from "../types.js";
40
+ import { resolveApiKeySync } from "./cursor/credentials.js";
41
+ import { AGENT_SERVE_GENERATION_ENV_VAR } from "./cursor-relay-core.js";
26
42
 
27
43
  export interface FrameworkStorageSelectionInput {
28
- /** `agent/storage.ts`, when the author wrote one. */
44
+ /** `agent/storage.ts`, when the author wrote one (v1 only: discovery rejects it on v2). */
29
45
  readonly authored: StorageDefinition | undefined;
46
+ /** {@link AgentConfig.architecture}; omitted means v1. */
47
+ readonly architecture?: AgentArchitecture | undefined;
48
+ /** Environment override for tests; defaults to `process.env`. */
49
+ readonly env?: Record<string, string | undefined>;
30
50
  }
31
51
 
32
52
  /**
33
53
  * Pick the backend for framework session state.
34
54
  *
35
55
  * Returns `undefined` when there is no mirror, in which case the pod's local
36
- * disk is the only copy — the condition F0 exists to remove for hosted
37
- * deployments.
56
+ * disk is the only copy.
38
57
  */
39
58
  export function selectFrameworkStorageDefinition(
40
59
  input: FrameworkStorageSelectionInput
41
60
  ): StorageDefinition | undefined {
42
- // Today: the author decides, or there is no mirror. Hosting-mode selection
43
- // replaces this body; every caller already routes through here.
44
- return input.authored;
61
+ if (input.architecture !== "v2") {
62
+ // v1: the author decides, or there is no mirror.
63
+ return input.authored;
64
+ }
65
+ if (input.authored !== undefined) {
66
+ // Discovery rejects agent/storage.ts on v2 before an engine is built;
67
+ // an authored definition reaching this point is a wiring bug. Raise
68
+ // rather than silently discard what the author believes is configured.
69
+ throw new Error(
70
+ 'defineStorage (agent/storage.ts) is not supported on architecture "v2": storage is platform-selected. Delete the file.'
71
+ );
72
+ }
73
+ const env = input.env ?? process.env;
74
+ if (env[AGENT_SERVE_GENERATION_ENV_VAR] === undefined) {
75
+ // Self-hosted v2: the state root is the durable copy.
76
+ return undefined;
77
+ }
78
+ return defineStorage({
79
+ name: "cursor-hosted",
80
+ ...cursorHostedStorage({
81
+ // Full chain (env → key file → stored login): frozen engines listen
82
+ // unsigned and bind CURSOR_API_KEY_FILE at task time, after this
83
+ // definition is constructed.
84
+ apiKey: () => resolveApiKeySync()?.apiKey,
85
+ }),
86
+ });
45
87
  }
@@ -0,0 +1,37 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+
3
+ /**
4
+ * A `send()` captured outside the delivery (typically at channel `onStart`,
5
+ * which binds directly to the engine) reached the engine during a hosted
6
+ * admission window. Running it would start a local July session on a
7
+ * sessionless pod — invisible to the control plane, destroyed with the pod —
8
+ * so it fails loudly instead. This is a deterministic authored bug and is
9
+ * surfaced as a non-retryable 422 by the admission route.
10
+ */
11
+ export class HostedAdmissionLocalSendError extends Error {
12
+ constructor() {
13
+ super(
14
+ "send() reached the local engine during hosted admission. A send " +
15
+ "captured at channel startup (onStart) bypasses hosted capture and " +
16
+ "would run an invisible local session on a sessionless pod. Use the " +
17
+ "per-delivery send passed to the task callback " +
18
+ "(task: (args) => args.send(…)) instead."
19
+ );
20
+ }
21
+ }
22
+
23
+ const admissionWindow = new AsyncLocalStorage<true>();
24
+
25
+ /**
26
+ * Run `work` inside the hosted admission window. The context follows the
27
+ * async graph, including `waitUntil` task bodies scheduled during dispatch,
28
+ * so the engine can refuse local sends that bypass the capture stub.
29
+ */
30
+ export function runDuringHostedAdmission<T>(work: () => T): T {
31
+ return admissionWindow.run(true, work);
32
+ }
33
+
34
+ /** True while executing inside a hosted admission window. */
35
+ export function isDuringHostedAdmission(): boolean {
36
+ return admissionWindow.getStore() === true;
37
+ }
@@ -3,6 +3,11 @@ export const HOSTED_DELIVERY_HEADER = "x-agent-sdk-hosted-delivery";
3
3
  export const HOSTED_ADMISSION_PATH = "/v1/internal/hosted-admission";
4
4
  export const HOSTED_EXECUTION_PATH = "/v1/internal/hosted-execution";
5
5
 
6
+ export type HostedAdmissionManagedAutomation = {
7
+ automationUuid: string;
8
+ mcpServerNames: string[];
9
+ };
10
+
6
11
  export type HostedAdmission = {
7
12
  v: 2;
8
13
  channelId: string;
@@ -12,6 +17,7 @@ export type HostedAdmission = {
12
17
  sessionMode: "event" | "continuation";
13
18
  mailboxContinuationKey: string;
14
19
  payload: unknown;
20
+ managedAutomation?: HostedAdmissionManagedAutomation;
15
21
  };
16
22
 
17
23
  export type HostedAdmissionOutcome =
@@ -39,13 +45,49 @@ const DELIVERY_KEYS = new Set([
39
45
  "sessionMode",
40
46
  "mailboxContinuationKey",
41
47
  "payload",
48
+ "managedAutomation",
42
49
  ]);
50
+ const MANAGED_AUTOMATION_KEYS = new Set(["automationUuid", "mcpServerNames"]);
51
+ /** More names than any real automation configures is a malformed envelope. */
52
+ const MANAGED_AUTOMATION_MAX_SERVERS = 64;
43
53
  const EXECUTION_KEYS = new Set(["v", "admissionToken", "sessionPublicId"]);
44
54
 
45
55
  function boundedString(value: unknown, max: number): value is string {
46
56
  return typeof value === "string" && value.length > 0 && value.length <= max;
47
57
  }
48
58
 
59
+ /**
60
+ * Parse the optional managed-automation slice. Absent → valid (undefined);
61
+ * present-but-malformed → invalid (the whole admission fails closed, the
62
+ * strict posture the rest of the envelope already takes).
63
+ */
64
+ function parseManagedAutomation(
65
+ value: unknown
66
+ ): { managedAutomation?: HostedAdmissionManagedAutomation } | undefined {
67
+ if (value === undefined) {
68
+ return {};
69
+ }
70
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
71
+ return undefined;
72
+ }
73
+ const body = value as Record<string, unknown>;
74
+ if (
75
+ Object.keys(body).some((key) => !MANAGED_AUTOMATION_KEYS.has(key)) ||
76
+ !boundedString(body.automationUuid, 128) ||
77
+ !Array.isArray(body.mcpServerNames) ||
78
+ body.mcpServerNames.length > MANAGED_AUTOMATION_MAX_SERVERS ||
79
+ !body.mcpServerNames.every((name) => boundedString(name, 256))
80
+ ) {
81
+ return undefined;
82
+ }
83
+ return {
84
+ managedAutomation: {
85
+ automationUuid: body.automationUuid,
86
+ mcpServerNames: body.mcpServerNames,
87
+ },
88
+ };
89
+ }
90
+
49
91
  export function parseHostedAdmission(
50
92
  value: unknown
51
93
  ): HostedAdmission | undefined {
@@ -62,7 +104,8 @@ export function parseHostedAdmission(
62
104
  !boundedString(body.eventType, 128) ||
63
105
  !boundedString(body.deliveryId, 256) ||
64
106
  (body.sessionMode !== "event" && body.sessionMode !== "continuation") ||
65
- !boundedString(body.mailboxContinuationKey, 512)
107
+ !boundedString(body.mailboxContinuationKey, 512) ||
108
+ parseManagedAutomation(body.managedAutomation) === undefined
66
109
  ) {
67
110
  return undefined;
68
111
  }