@cursor/july 0.1.107 → 0.1.109

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 (523) hide show
  1. package/AGENTS.md +2 -6
  2. package/README.md +13 -11
  3. package/dist/bin/agent-serve.js +30 -8
  4. package/dist/channels/bitbucket/api.d.ts +41 -0
  5. package/dist/channels/bitbucket/api.d.ts.map +1 -1
  6. package/dist/channels/bitbucket/api.js +260 -0
  7. package/dist/channels/bitbucket/binding.d.ts +4 -0
  8. package/dist/channels/bitbucket/binding.d.ts.map +1 -1
  9. package/dist/channels/bitbucket/binding.js +16 -0
  10. package/dist/channels/bitbucket/index.d.ts +1 -1
  11. package/dist/channels/bitbucket/index.d.ts.map +1 -1
  12. package/dist/channels/bitbucket/index.js +1 -1
  13. package/dist/channels/github/github-channel.js +8 -5
  14. package/dist/channels/github/types.d.ts +5 -1
  15. package/dist/channels/github/types.d.ts.map +1 -1
  16. package/dist/channels/gitlab/api.d.ts +27 -0
  17. package/dist/channels/gitlab/api.d.ts.map +1 -1
  18. package/dist/channels/gitlab/api.js +88 -0
  19. package/dist/channels/gitlab/binding.d.ts +5 -0
  20. package/dist/channels/gitlab/binding.d.ts.map +1 -1
  21. package/dist/channels/gitlab/binding.js +10 -0
  22. package/dist/channels/gitlab/index.d.ts +1 -1
  23. package/dist/channels/gitlab/index.d.ts.map +1 -1
  24. package/dist/channels/gitlab/index.js +1 -1
  25. package/dist/channels/origin/origin-channel.d.ts.map +1 -1
  26. package/dist/channels/origin/origin-channel.js +27 -13
  27. package/dist/channels/origin/types.d.ts +5 -1
  28. package/dist/channels/origin/types.d.ts.map +1 -1
  29. package/dist/channels/slack/dispatch.d.ts +10 -0
  30. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  31. package/dist/channels/slack/dispatch.js +20 -3
  32. package/dist/channels/slack/slack-channel.d.ts +12 -5
  33. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  34. package/dist/channels/slack/slack-channel.js +59 -8
  35. package/dist/channels.d.ts +45 -0
  36. package/dist/channels.d.ts.map +1 -1
  37. package/dist/channels.js +106 -7
  38. package/dist/connections.d.ts +2 -1
  39. package/dist/connections.d.ts.map +1 -1
  40. package/dist/connections.js +2 -1
  41. package/dist/docs/404.html +2 -2
  42. package/dist/docs/assets/{app.CtuckIiL.js → app.Cr-wVbnB.js} +1 -1
  43. package/dist/docs/assets/{building-with-agents.md.CUSWxlP_.js → building-with-agents.md.D0KbSkJn.js} +2 -2
  44. package/dist/docs/assets/{building-with-agents.md.CUSWxlP_.lean.js → building-with-agents.md.D0KbSkJn.lean.js} +1 -1
  45. package/dist/docs/assets/chunks/@localSearchIndexroot.CFVQ4S17.js +1 -0
  46. package/dist/docs/assets/chunks/{VPLocalSearchBox.Bkkhnu8K.js → VPLocalSearchBox.CVQERt56.js} +1 -1
  47. package/dist/docs/assets/chunks/{theme.DhpIe0Pa.js → theme.Dnsd3XOn.js} +2 -2
  48. package/dist/docs/assets/concepts.md.B4o63Gul.js +1 -0
  49. package/dist/docs/assets/{deployment.md.MFPKqsqI.js → deployment.md.JenwuCCB.js} +4 -4
  50. package/dist/docs/assets/{deployment.md.MFPKqsqI.lean.js → deployment.md.JenwuCCB.lean.js} +1 -1
  51. package/dist/docs/assets/evals.md.C7JLjoEP.js +211 -0
  52. package/dist/docs/assets/evals.md.C7JLjoEP.lean.js +1 -0
  53. package/dist/docs/assets/guides_bitbucket.md.DZPzmUjU.js +10 -0
  54. package/dist/docs/assets/guides_bitbucket.md.DZPzmUjU.lean.js +1 -0
  55. package/dist/docs/assets/guides_cloud-agents.md.BsloyHdY.js +9 -0
  56. package/dist/docs/assets/{guides_cloud-agents.md.DS8RIjwx.lean.js → guides_cloud-agents.md.BsloyHdY.lean.js} +1 -1
  57. package/dist/docs/assets/{guides_github.md.c0gdGJ-D.js → guides_github.md.TZaTZlfz.js} +13 -3
  58. package/dist/docs/assets/{guides_github.md.c0gdGJ-D.lean.js → guides_github.md.TZaTZlfz.lean.js} +1 -1
  59. package/dist/docs/assets/guides_gitlab.md.BmqwQfdG.js +14 -0
  60. package/dist/docs/assets/guides_gitlab.md.BmqwQfdG.lean.js +1 -0
  61. package/dist/docs/assets/{guides_grokbot-agents.md.DVqdhBKb.js → guides_grokbot-agents.md.DyV-WArv.js} +1 -1
  62. package/dist/docs/assets/guides_improve.md.BGVk32bK.js +14 -0
  63. package/dist/docs/assets/guides_improve.md.BGVk32bK.lean.js +1 -0
  64. package/dist/docs/assets/{guides_slack.md.9oHPye9o.js → guides_slack.md.D4RVMM4G.js} +3 -3
  65. package/dist/docs/assets/{guides_slack.md.9oHPye9o.lean.js → guides_slack.md.D4RVMM4G.lean.js} +1 -1
  66. package/dist/docs/assets/{guides_webhooks.md.DKdA43Qm.js → guides_webhooks.md.CJK484ex.js} +2 -2
  67. package/dist/docs/assets/{hillclimbing.md.CpTGTCle.js → hillclimbing.md.BOiVo1tf.js} +1 -1
  68. package/dist/docs/assets/index.md.DD9Q2XuJ.js +5 -0
  69. package/dist/docs/assets/{index.md.BW_6tOgR.lean.js → index.md.DD9Q2XuJ.lean.js} +1 -1
  70. package/dist/docs/assets/{reference_agent-config.md.CHNpiyp4.js → reference_agent-config.md.CvoL6pof.js} +1 -1
  71. package/dist/docs/assets/{reference_channels.md.D-qTqwcq.js → reference_channels.md.CAo-iK4j.js} +2 -2
  72. package/dist/docs/assets/{reference_channels.md.D-qTqwcq.lean.js → reference_channels.md.CAo-iK4j.lean.js} +1 -1
  73. package/dist/docs/assets/{reference_cli.md.Dm67hd2D.js → reference_cli.md.Deg7849l.js} +7 -7
  74. package/dist/docs/assets/{reference_cli.md.Dm67hd2D.lean.js → reference_cli.md.Deg7849l.lean.js} +1 -1
  75. package/dist/docs/assets/{reference_connections.md.Di6jJAXF.js → reference_connections.md.BojkC6c5.js} +1 -1
  76. package/dist/docs/assets/{reference_extensions.md.CGmMLblt.js → reference_extensions.md.ZAVUyuEX.js} +3 -3
  77. package/dist/docs/assets/{reference_hooks.md.Ddt5DdgJ.js → reference_hooks.md.BlM_bOg6.js} +3 -3
  78. package/dist/docs/assets/{reference_hooks.md.Ddt5DdgJ.lean.js → reference_hooks.md.BlM_bOg6.lean.js} +1 -1
  79. package/dist/docs/assets/{reference_http-api.md.oySXBO8o.js → reference_http-api.md.BwaCo-VO.js} +1 -1
  80. package/dist/docs/assets/{reference_playground.md.4myJPxrf.js → reference_playground.md.DLnoaczX.js} +1 -1
  81. package/dist/docs/assets/{reference_playground.md.4myJPxrf.lean.js → reference_playground.md.DLnoaczX.lean.js} +1 -1
  82. package/dist/docs/assets/{reference_project-layout.md.DuBu9a96.js → reference_project-layout.md.BEU8MtQV.js} +3 -3
  83. package/dist/docs/assets/{reference_project-layout.md.DuBu9a96.lean.js → reference_project-layout.md.BEU8MtQV.lean.js} +1 -1
  84. package/dist/docs/assets/reference_sessions.md.CyXV1MUw.js +1 -0
  85. package/dist/docs/assets/{scaffolding-agents.md.em43xlY1.js → scaffolding-agents.md.Kctn3OVb.js} +1 -1
  86. package/dist/docs/assets/{skills_create-agent.md.BVoWPcan.js → skills_create-agent.md.Q3h6Je-e.js} +1 -1
  87. package/dist/docs/assets/{skills_debug.md.CDbPhHfg.js → skills_debug.md.CVjCXMFF.js} +1 -1
  88. package/dist/docs/assets/{skills_debug.md.CDbPhHfg.lean.js → skills_debug.md.CVjCXMFF.lean.js} +1 -1
  89. package/dist/docs/assets/skills_deploy.md.CWqi_ZxW.js +35 -0
  90. package/dist/docs/assets/skills_deploy.md.CWqi_ZxW.lean.js +1 -0
  91. package/dist/docs/assets/skills_evals.md.DFxYPErF.js +25 -0
  92. package/dist/docs/assets/skills_evals.md.DFxYPErF.lean.js +1 -0
  93. package/dist/docs/assets/skills_framework-map.md.BxLSOhSY.js +1 -0
  94. package/dist/docs/assets/{skills_framework-map.md.haibFyoB.lean.js → skills_framework-map.md.BxLSOhSY.lean.js} +1 -1
  95. package/dist/docs/assets/{skills_github.md.D0JahM8c.js → skills_github.md.hgFX_oKY.js} +1 -1
  96. package/dist/docs/assets/skills_index.md.DL7EHaQ-.js +1 -0
  97. package/dist/docs/assets/skills_index.md.DL7EHaQ-.lean.js +1 -0
  98. package/dist/docs/assets/{storage.md.BOHeqk2M.js → storage.md.BUrhJ-Zz.js} +4 -4
  99. package/dist/docs/assets/{storage.md.BOHeqk2M.lean.js → storage.md.BUrhJ-Zz.lean.js} +1 -1
  100. package/dist/docs/assets/troubleshooting.md.CYEAO9bM.js +1 -0
  101. package/dist/docs/building-with-agents.html +5 -5
  102. package/dist/docs/building-with-agents.md +3 -2
  103. package/dist/docs/concepts.html +5 -5
  104. package/dist/docs/concepts.md +2 -4
  105. package/dist/docs/deployment.html +7 -7
  106. package/dist/docs/deployment.md +7 -2
  107. package/dist/docs/evals.html +161 -35
  108. package/dist/docs/evals.md +612 -296
  109. package/dist/docs/guides/agent-to-agent.html +4 -4
  110. package/dist/docs/guides/bitbucket.html +36 -0
  111. package/dist/docs/guides/bitbucket.md +84 -0
  112. package/dist/docs/guides/cloud-agents.html +6 -6
  113. package/dist/docs/guides/cloud-agents.md +4 -3
  114. package/dist/docs/guides/convert-automation.html +4 -4
  115. package/dist/docs/guides/github.html +17 -7
  116. package/dist/docs/guides/github.md +33 -1
  117. package/dist/docs/guides/gitlab.html +40 -0
  118. package/dist/docs/guides/gitlab.md +92 -0
  119. package/dist/docs/guides/grokbot-agents.html +6 -6
  120. package/dist/docs/guides/grokbot-agents.md +2 -2
  121. package/dist/docs/guides/human-in-the-loop.html +4 -4
  122. package/dist/docs/guides/improve.html +40 -0
  123. package/dist/docs/guides/improve.md +91 -0
  124. package/dist/docs/guides/mcp-oauth.html +4 -4
  125. package/dist/docs/guides/opentelemetry.html +5 -5
  126. package/dist/docs/guides/slack.html +7 -7
  127. package/dist/docs/guides/slack.md +2 -1
  128. package/dist/docs/guides/webhooks.html +6 -6
  129. package/dist/docs/guides/webhooks.md +4 -2
  130. package/dist/docs/hashmap.json +1 -1
  131. package/dist/docs/hillclimbing.html +6 -6
  132. package/dist/docs/hillclimbing.md +2 -2
  133. package/dist/docs/index.html +6 -6
  134. package/dist/docs/index.md +14 -6
  135. package/dist/docs/llms-full.txt +1274 -814
  136. package/dist/docs/llms.txt +7 -5
  137. package/dist/docs/quickstart.html +4 -4
  138. package/dist/docs/reference/agent-config.html +6 -6
  139. package/dist/docs/reference/agent-config.md +5 -2
  140. package/dist/docs/reference/artifacts.html +4 -4
  141. package/dist/docs/reference/channels.html +6 -6
  142. package/dist/docs/reference/channels.md +16 -3
  143. package/dist/docs/reference/cli.html +11 -11
  144. package/dist/docs/reference/cli.md +24 -15
  145. package/dist/docs/reference/connections.html +6 -6
  146. package/dist/docs/reference/connections.md +2 -1
  147. package/dist/docs/reference/extensions.html +8 -8
  148. package/dist/docs/reference/extensions.md +2 -3
  149. package/dist/docs/reference/hooks.html +7 -7
  150. package/dist/docs/reference/hooks.md +9 -12
  151. package/dist/docs/reference/http-api.html +6 -6
  152. package/dist/docs/reference/http-api.md +2 -3
  153. package/dist/docs/reference/instructions.html +4 -4
  154. package/dist/docs/reference/playground.html +5 -5
  155. package/dist/docs/reference/playground.md +0 -4
  156. package/dist/docs/reference/project-layout.html +7 -7
  157. package/dist/docs/reference/project-layout.md +1 -8
  158. package/dist/docs/reference/prompt.html +4 -4
  159. package/dist/docs/reference/result.html +4 -4
  160. package/dist/docs/reference/schedules.html +4 -4
  161. package/dist/docs/reference/sessions.html +5 -5
  162. package/dist/docs/reference/sessions.md +1 -2
  163. package/dist/docs/reference/skills.html +4 -4
  164. package/dist/docs/reference/subagents.html +4 -4
  165. package/dist/docs/reference/tools.html +4 -4
  166. package/dist/docs/scaffolding-agents.html +5 -5
  167. package/dist/docs/scaffolding-agents.md +2 -1
  168. package/dist/docs/skills/create-agent.html +6 -6
  169. package/dist/docs/skills/create-agent.md +1 -1
  170. package/dist/docs/skills/debug.html +5 -5
  171. package/dist/docs/skills/debug.md +1 -1
  172. package/dist/docs/skills/deploy.html +61 -0
  173. package/dist/docs/skills/deploy.md +161 -0
  174. package/dist/docs/skills/evals.html +8 -8
  175. package/dist/docs/skills/evals.md +44 -6
  176. package/dist/docs/skills/framework-map.html +5 -5
  177. package/dist/docs/skills/framework-map.md +5 -4
  178. package/dist/docs/skills/github.html +6 -6
  179. package/dist/docs/skills/github.md +1 -1
  180. package/dist/docs/skills/hillclimb.html +4 -4
  181. package/dist/docs/skills/index.html +6 -6
  182. package/dist/docs/skills/index.md +1 -1
  183. package/dist/docs/skills/mcp-auth.html +4 -4
  184. package/dist/docs/skills/otel.html +4 -4
  185. package/dist/docs/skills/setup-slack.html +4 -4
  186. package/dist/docs/storage.html +8 -8
  187. package/dist/docs/storage.md +15 -24
  188. package/dist/docs/templates/agentic-owners.html +4 -4
  189. package/dist/docs/templates/agents-md.html +4 -4
  190. package/dist/docs/templates/code-wiki.html +4 -4
  191. package/dist/docs/templates/demo.html +4 -4
  192. package/dist/docs/templates/grokbot-agents.html +4 -4
  193. package/dist/docs/templates/pr-autofixer.html +4 -4
  194. package/dist/docs/templates/security-help.html +4 -4
  195. package/dist/docs/templates/security-reviewer.html +4 -4
  196. package/dist/docs/templates/triage.html +4 -4
  197. package/dist/docs/troubleshooting.html +5 -5
  198. package/dist/docs/troubleshooting.md +1 -1
  199. package/dist/extensions/improve/extension.d.ts +46 -0
  200. package/dist/extensions/improve/extension.d.ts.map +1 -0
  201. package/dist/extensions/improve/extension.js +41 -0
  202. package/dist/extensions/improve/skills/yourself.d.ts +4 -0
  203. package/dist/extensions/improve/skills/yourself.d.ts.map +1 -0
  204. package/dist/extensions/improve/skills/yourself.js +43 -0
  205. package/dist/extensions.d.ts +2 -3
  206. package/dist/extensions.d.ts.map +1 -1
  207. package/dist/extensions.js +2 -5
  208. package/dist/index.d.ts +2 -3
  209. package/dist/index.d.ts.map +1 -1
  210. package/dist/index.js +1 -2
  211. package/dist/internal/authored-alias-hooks.d.ts +5 -0
  212. package/dist/internal/authored-alias-hooks.d.ts.map +1 -1
  213. package/dist/internal/authored-alias-hooks.js +17 -0
  214. package/dist/internal/authored-loaders.d.ts +4 -0
  215. package/dist/internal/authored-loaders.d.ts.map +1 -1
  216. package/dist/internal/authored-loaders.js +21 -2
  217. package/dist/internal/builtin-tools/artifacts.d.ts.map +1 -1
  218. package/dist/internal/builtin-tools/artifacts.js +2 -3
  219. package/dist/internal/channel-route-dispatch.d.ts +13 -0
  220. package/dist/internal/channel-route-dispatch.d.ts.map +1 -0
  221. package/dist/internal/channel-route-dispatch.js +62 -0
  222. package/dist/internal/channel-state.d.ts +17 -0
  223. package/dist/internal/channel-state.d.ts.map +1 -0
  224. package/dist/internal/channel-state.js +78 -0
  225. package/dist/internal/cli-ax.d.ts +8 -2
  226. package/dist/internal/cli-ax.d.ts.map +1 -1
  227. package/dist/internal/cli-ax.js +100 -3
  228. package/dist/internal/cli-cursor.d.ts.map +1 -1
  229. package/dist/internal/cli-cursor.js +2 -0
  230. package/dist/internal/cli-deploy.d.ts.map +1 -1
  231. package/dist/internal/cli-deploy.js +38 -14
  232. package/dist/internal/cli-mcp-oauth.d.ts.map +1 -1
  233. package/dist/internal/cli-mcp-oauth.js +15 -0
  234. package/dist/internal/cli-mcp.d.ts.map +1 -1
  235. package/dist/internal/cli-mcp.js +12 -0
  236. package/dist/internal/cli-slack.d.ts.map +1 -1
  237. package/dist/internal/cli-slack.js +8 -2
  238. package/dist/internal/continuation-channel.d.ts.map +1 -1
  239. package/dist/internal/continuation-channel.js +2 -2
  240. package/dist/internal/continuation-identity.js +8 -3
  241. package/dist/internal/cursor/credentials.d.ts +8 -2
  242. package/dist/internal/cursor/credentials.d.ts.map +1 -1
  243. package/dist/internal/cursor/credentials.js +27 -5
  244. package/dist/internal/deploy-client.d.ts +27 -0
  245. package/dist/internal/deploy-client.d.ts.map +1 -1
  246. package/dist/internal/deploy-client.js +32 -0
  247. package/dist/internal/deploy-manifest.d.ts +23 -0
  248. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  249. package/dist/internal/deploy-manifest.js +84 -1
  250. package/dist/internal/describe-error.d.ts +1 -0
  251. package/dist/internal/describe-error.d.ts.map +1 -1
  252. package/dist/internal/describe-error.js +25 -0
  253. package/dist/internal/discovery/agent.d.ts +1 -1
  254. package/dist/internal/discovery/agent.d.ts.map +1 -1
  255. package/dist/internal/discovery/agent.js +0 -5
  256. package/dist/internal/discovery/extension-overlay.d.ts +1 -2
  257. package/dist/internal/discovery/extension-overlay.d.ts.map +1 -1
  258. package/dist/internal/discovery/extension-overlay.js +0 -14
  259. package/dist/internal/discovery/extensions.d.ts +1 -2
  260. package/dist/internal/discovery/extensions.d.ts.map +1 -1
  261. package/dist/internal/discovery/extensions.js +4 -22
  262. package/dist/internal/discovery/info.d.ts.map +1 -1
  263. package/dist/internal/discovery/info.js +42 -24
  264. package/dist/internal/discovery/modules.js +0 -1
  265. package/dist/internal/discovery/project.d.ts.map +1 -1
  266. package/dist/internal/discovery/project.js +0 -16
  267. package/dist/internal/eval-runner.js +0 -1
  268. package/dist/internal/framework-file-storage.d.ts +4 -5
  269. package/dist/internal/framework-file-storage.d.ts.map +1 -1
  270. package/dist/internal/framework-file-storage.js +4 -5
  271. package/dist/internal/framework-storage-selection.d.ts +2 -2
  272. package/dist/internal/framework-storage-selection.js +2 -2
  273. package/dist/internal/guest-network.d.ts +4 -10
  274. package/dist/internal/guest-network.d.ts.map +1 -1
  275. package/dist/internal/guest-network.js +42 -26
  276. package/dist/internal/hosted-admission-adapter.d.ts +2 -0
  277. package/dist/internal/hosted-admission-adapter.d.ts.map +1 -1
  278. package/dist/internal/hosted-catch-protocol.d.ts +51 -0
  279. package/dist/internal/hosted-catch-protocol.d.ts.map +1 -0
  280. package/dist/internal/hosted-catch-protocol.js +103 -0
  281. package/dist/internal/hosted-catch.d.ts +40 -0
  282. package/dist/internal/hosted-catch.d.ts.map +1 -0
  283. package/dist/internal/hosted-catch.js +149 -0
  284. package/dist/internal/hosted-delivery-protocol.d.ts +41 -0
  285. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  286. package/dist/internal/hosted-delivery-protocol.js +249 -0
  287. package/dist/internal/hosted-delivery.d.ts +10 -1
  288. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  289. package/dist/internal/hosted-delivery.js +100 -22
  290. package/dist/internal/hosted-execution-diag.d.ts +4 -1
  291. package/dist/internal/hosted-execution-diag.d.ts.map +1 -1
  292. package/dist/internal/hosted-execution-diag.js +13 -4
  293. package/dist/internal/hosted-execution-flush.d.ts +3 -0
  294. package/dist/internal/hosted-execution-flush.d.ts.map +1 -1
  295. package/dist/internal/hosted-execution-flush.js +2 -4
  296. package/dist/internal/http-control-plane-session.d.ts +30 -0
  297. package/dist/internal/http-control-plane-session.d.ts.map +1 -0
  298. package/dist/internal/http-control-plane-session.js +83 -0
  299. package/dist/internal/init-scaffold.d.ts.map +1 -1
  300. package/dist/internal/init-scaffold.js +1 -2
  301. package/dist/internal/install-cursor-skills.d.ts +5 -2
  302. package/dist/internal/install-cursor-skills.d.ts.map +1 -1
  303. package/dist/internal/install-cursor-skills.js +25 -5
  304. package/dist/internal/legacy-command-guard.d.ts +22 -0
  305. package/dist/internal/legacy-command-guard.d.ts.map +1 -0
  306. package/dist/internal/legacy-command-guard.js +51 -0
  307. package/dist/internal/platform-timers.d.ts +7 -0
  308. package/dist/internal/platform-timers.d.ts.map +1 -1
  309. package/dist/internal/platform-timers.js +139 -0
  310. package/dist/internal/reminder-control-plane-protocol.d.ts +2 -0
  311. package/dist/internal/reminder-control-plane-protocol.d.ts.map +1 -1
  312. package/dist/internal/reminder-control-plane-protocol.js +9 -2
  313. package/dist/internal/reminder-runner.d.ts +8 -0
  314. package/dist/internal/reminder-runner.d.ts.map +1 -1
  315. package/dist/internal/reminder-runner.js +36 -9
  316. package/dist/internal/resolve-prod-target.d.ts +2 -0
  317. package/dist/internal/resolve-prod-target.d.ts.map +1 -1
  318. package/dist/internal/resolve-prod-target.js +13 -0
  319. package/dist/internal/run-client.d.ts +1 -1
  320. package/dist/internal/sdk-runner.d.ts.map +1 -1
  321. package/dist/internal/sdk-runner.js +5 -4
  322. package/dist/internal/server.d.ts.map +1 -1
  323. package/dist/internal/server.js +57 -70
  324. package/dist/internal/session-engine.d.ts +7 -41
  325. package/dist/internal/session-engine.d.ts.map +1 -1
  326. package/dist/internal/session-engine.js +110 -227
  327. package/dist/internal/storage-coordinator.d.ts +5 -19
  328. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  329. package/dist/internal/storage-coordinator.js +3 -62
  330. package/dist/internal/storage-roles.d.ts +4 -9
  331. package/dist/internal/storage-roles.d.ts.map +1 -1
  332. package/dist/internal/storage-roles.js +2 -2
  333. package/dist/playground/assets/index-Bhxzrcf6.css +1 -0
  334. package/dist/playground/assets/index-CqLX5uF3.js +67 -0
  335. package/dist/playground/index.html +2 -2
  336. package/dist/storage-backends/cursor-hosted-v2.d.ts +4 -5
  337. package/dist/storage-backends/cursor-hosted-v2.d.ts.map +1 -1
  338. package/dist/storage-backends/cursor-hosted-v2.js +4 -5
  339. package/dist/storage-backends/cursor-hosted.d.ts +7 -2
  340. package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
  341. package/dist/storage-backends/cursor-hosted.js +29 -31
  342. package/dist/storage-backends/file-kv.d.ts +9 -12
  343. package/dist/storage-backends/file-kv.d.ts.map +1 -1
  344. package/dist/storage-backends/file-kv.js +11 -47
  345. package/dist/storage-protocol.d.ts +3 -11
  346. package/dist/storage-protocol.d.ts.map +1 -1
  347. package/dist/storage-protocol.js +3 -11
  348. package/dist/storage.d.ts +8 -36
  349. package/dist/storage.d.ts.map +1 -1
  350. package/dist/storage.js +8 -44
  351. package/dist/types.d.ts +53 -62
  352. package/dist/types.d.ts.map +1 -1
  353. package/docs/README.md +14 -6
  354. package/docs/building-with-agents.md +3 -2
  355. package/docs/concepts.md +2 -4
  356. package/docs/deployment.md +7 -2
  357. package/docs/evals.md +613 -297
  358. package/docs/guides/bitbucket.md +89 -0
  359. package/docs/guides/cloud-agents.md +4 -3
  360. package/docs/guides/github.md +33 -1
  361. package/docs/guides/gitlab.md +97 -0
  362. package/docs/guides/grokbot-agents.md +2 -2
  363. package/docs/guides/improve.md +96 -0
  364. package/docs/guides/slack.md +2 -1
  365. package/docs/guides/webhooks.md +4 -2
  366. package/docs/hillclimbing.md +2 -2
  367. package/docs/reference/agent-config.md +5 -2
  368. package/docs/reference/channels.md +16 -3
  369. package/docs/reference/cli.md +24 -15
  370. package/docs/reference/connections.md +2 -1
  371. package/docs/reference/extensions.md +2 -3
  372. package/docs/reference/hooks.md +9 -12
  373. package/docs/reference/http-api.md +2 -3
  374. package/docs/reference/playground.md +0 -4
  375. package/docs/reference/project-layout.md +1 -8
  376. package/docs/reference/sessions.md +1 -2
  377. package/docs/scaffolding-agents.md +2 -1
  378. package/docs/skills/index.md +2 -2
  379. package/docs/storage.md +15 -24
  380. package/docs/troubleshooting.md +1 -1
  381. package/package.json +8 -7
  382. package/skills/create-agent/SKILL.md +1 -1
  383. package/skills/debug/SKILL.md +1 -1
  384. package/skills/deploy/SKILL.md +169 -0
  385. package/skills/evals/SKILL.md +45 -8
  386. package/skills/framework-map/SKILL.md +5 -4
  387. package/skills/github/SKILL.md +1 -1
  388. package/src/bin/agent-serve.ts +27 -2
  389. package/src/channels/bitbucket/api.ts +341 -0
  390. package/src/channels/bitbucket/binding.ts +25 -0
  391. package/src/channels/bitbucket/index.ts +2 -0
  392. package/src/channels/github/github-channel.ts +8 -8
  393. package/src/channels/github/types.ts +5 -0
  394. package/src/channels/gitlab/api.ts +123 -0
  395. package/src/channels/gitlab/binding.ts +12 -0
  396. package/src/channels/gitlab/index.ts +1 -0
  397. package/src/channels/origin/origin-channel.ts +29 -13
  398. package/src/channels/origin/types.ts +5 -0
  399. package/src/channels/slack/dispatch.ts +30 -0
  400. package/src/channels/slack/slack-channel.ts +69 -7
  401. package/src/channels.ts +157 -10
  402. package/src/connections.ts +2 -1
  403. package/src/extensions/improve/extension.ts +70 -0
  404. package/src/extensions/improve/skills/yourself.ts +50 -0
  405. package/src/extensions.ts +2 -6
  406. package/src/index.ts +0 -3
  407. package/src/internal/authored-alias-hooks.ts +32 -0
  408. package/src/internal/authored-loaders.ts +26 -2
  409. package/src/internal/builtin-tools/artifacts.ts +2 -3
  410. package/src/internal/channel-route-dispatch.ts +66 -0
  411. package/src/internal/channel-state.ts +96 -0
  412. package/src/internal/cli-ax.ts +111 -3
  413. package/src/internal/cli-cursor.ts +4 -1
  414. package/src/internal/cli-deploy.ts +50 -10
  415. package/src/internal/cli-mcp-oauth.ts +18 -0
  416. package/src/internal/cli-mcp.ts +11 -0
  417. package/src/internal/cli-slack.ts +15 -2
  418. package/src/internal/continuation-channel.ts +2 -1
  419. package/src/internal/continuation-identity.ts +10 -2
  420. package/src/internal/cursor/credentials.ts +35 -7
  421. package/src/internal/deploy-client.ts +54 -0
  422. package/src/internal/deploy-manifest.ts +115 -1
  423. package/src/internal/describe-error.ts +28 -0
  424. package/src/internal/discovery/agent.ts +1 -7
  425. package/src/internal/discovery/extension-overlay.ts +0 -18
  426. package/src/internal/discovery/extensions.ts +2 -26
  427. package/src/internal/discovery/info.ts +3 -13
  428. package/src/internal/discovery/modules.ts +0 -1
  429. package/src/internal/discovery/project.ts +0 -16
  430. package/src/internal/eval-runner.ts +0 -1
  431. package/src/internal/framework-file-storage.ts +4 -5
  432. package/src/internal/framework-storage-selection.ts +2 -2
  433. package/src/internal/guest-network.ts +43 -29
  434. package/src/internal/hosted-admission-adapter.ts +2 -0
  435. package/src/internal/hosted-catch-protocol.ts +130 -0
  436. package/src/internal/hosted-catch.ts +192 -0
  437. package/src/internal/hosted-delivery-protocol.ts +387 -0
  438. package/src/internal/hosted-delivery.ts +155 -22
  439. package/src/internal/hosted-execution-diag.ts +21 -3
  440. package/src/internal/hosted-execution-flush.ts +6 -3
  441. package/src/internal/http-control-plane-session.ts +104 -0
  442. package/src/internal/init-scaffold.ts +1 -2
  443. package/src/internal/install-cursor-skills.ts +38 -5
  444. package/src/internal/legacy-command-guard.ts +59 -0
  445. package/src/internal/platform-timers.ts +191 -0
  446. package/src/internal/reminder-control-plane-protocol.ts +15 -2
  447. package/src/internal/reminder-runner.ts +60 -9
  448. package/src/internal/resolve-prod-target.ts +15 -0
  449. package/src/internal/run-client.ts +1 -1
  450. package/src/internal/sdk-runner.ts +3 -2
  451. package/src/internal/server.ts +89 -95
  452. package/src/internal/session-engine.ts +155 -285
  453. package/src/internal/storage-coordinator.ts +5 -76
  454. package/src/internal/storage-roles.ts +4 -9
  455. package/src/storage-backends/cursor-hosted-v2.ts +4 -7
  456. package/src/storage-backends/cursor-hosted.ts +40 -38
  457. package/src/storage-backends/file-kv.ts +10 -51
  458. package/src/storage-protocol.ts +3 -17
  459. package/src/storage.ts +10 -101
  460. package/src/types.ts +58 -62
  461. package/templates/demo/README.md +10 -6
  462. package/templates/demo/agent/channels/github.ts +2 -0
  463. package/templates/demo/agent/channels/queue.ts +6 -2
  464. package/templates/demo/agent/lib/repos.ts +5 -0
  465. package/templates/demo/init.json +25 -0
  466. package/dist/ab.d.ts +0 -209
  467. package/dist/ab.d.ts.map +0 -1
  468. package/dist/ab.js +0 -246
  469. package/dist/docs/ab.html +0 -80
  470. package/dist/docs/ab.md +0 -332
  471. package/dist/docs/assets/ab.md.mlVgqvSk.js +0 -54
  472. package/dist/docs/assets/ab.md.mlVgqvSk.lean.js +0 -1
  473. package/dist/docs/assets/chunks/@localSearchIndexroot.DXXZxiMv.js +0 -1
  474. package/dist/docs/assets/concepts.md.DgEcZOfT.js +0 -1
  475. package/dist/docs/assets/evals.md.CbMoebP1.js +0 -85
  476. package/dist/docs/assets/evals.md.CbMoebP1.lean.js +0 -1
  477. package/dist/docs/assets/guides_cloud-agents.md.DS8RIjwx.js +0 -9
  478. package/dist/docs/assets/index.md.BW_6tOgR.js +0 -5
  479. package/dist/docs/assets/reference_sessions.md.CueyOHSL.js +0 -1
  480. package/dist/docs/assets/skills_ab.md.CsFNatVx.js +0 -26
  481. package/dist/docs/assets/skills_ab.md.CsFNatVx.lean.js +0 -1
  482. package/dist/docs/assets/skills_evals.md.723kpUmA.js +0 -25
  483. package/dist/docs/assets/skills_evals.md.723kpUmA.lean.js +0 -1
  484. package/dist/docs/assets/skills_framework-map.md.haibFyoB.js +0 -1
  485. package/dist/docs/assets/skills_index.md.DKwIxzGg.js +0 -1
  486. package/dist/docs/assets/skills_index.md.DKwIxzGg.lean.js +0 -1
  487. package/dist/docs/assets/troubleshooting.md.Cus_YZga.js +0 -1
  488. package/dist/docs/skills/ab.html +0 -52
  489. package/dist/docs/skills/ab.md +0 -50
  490. package/dist/internal/ab-collector.d.ts +0 -44
  491. package/dist/internal/ab-collector.d.ts.map +0 -1
  492. package/dist/internal/ab-collector.js +0 -142
  493. package/dist/internal/ab-fold.d.ts +0 -36
  494. package/dist/internal/ab-fold.d.ts.map +0 -1
  495. package/dist/internal/ab-fold.js +0 -175
  496. package/dist/internal/ab-snapshot.d.ts +0 -68
  497. package/dist/internal/ab-snapshot.d.ts.map +0 -1
  498. package/dist/internal/ab-snapshot.js +0 -208
  499. package/dist/internal/discovery/ab.d.ts +0 -9
  500. package/dist/internal/discovery/ab.d.ts.map +0 -1
  501. package/dist/internal/discovery/ab.js +0 -113
  502. package/dist/playground/assets/index-Bq2HpEQB.js +0 -67
  503. package/dist/playground/assets/index-CZKKNlmb.css +0 -1
  504. package/docs/ab.md +0 -337
  505. package/skills/ab/SKILL.md +0 -58
  506. package/src/ab.ts +0 -430
  507. package/src/internal/ab-collector.ts +0 -200
  508. package/src/internal/ab-fold.ts +0 -232
  509. package/src/internal/ab-snapshot.ts +0 -331
  510. package/src/internal/discovery/ab.ts +0 -131
  511. /package/dist/docs/assets/{concepts.md.DgEcZOfT.lean.js → concepts.md.B4o63Gul.lean.js} +0 -0
  512. /package/dist/docs/assets/{guides_grokbot-agents.md.DVqdhBKb.lean.js → guides_grokbot-agents.md.DyV-WArv.lean.js} +0 -0
  513. /package/dist/docs/assets/{guides_webhooks.md.DKdA43Qm.lean.js → guides_webhooks.md.CJK484ex.lean.js} +0 -0
  514. /package/dist/docs/assets/{hillclimbing.md.CpTGTCle.lean.js → hillclimbing.md.BOiVo1tf.lean.js} +0 -0
  515. /package/dist/docs/assets/{reference_agent-config.md.CHNpiyp4.lean.js → reference_agent-config.md.CvoL6pof.lean.js} +0 -0
  516. /package/dist/docs/assets/{reference_connections.md.Di6jJAXF.lean.js → reference_connections.md.BojkC6c5.lean.js} +0 -0
  517. /package/dist/docs/assets/{reference_extensions.md.CGmMLblt.lean.js → reference_extensions.md.ZAVUyuEX.lean.js} +0 -0
  518. /package/dist/docs/assets/{reference_http-api.md.oySXBO8o.lean.js → reference_http-api.md.BwaCo-VO.lean.js} +0 -0
  519. /package/dist/docs/assets/{reference_sessions.md.CueyOHSL.lean.js → reference_sessions.md.CyXV1MUw.lean.js} +0 -0
  520. /package/dist/docs/assets/{scaffolding-agents.md.em43xlY1.lean.js → scaffolding-agents.md.Kctn3OVb.lean.js} +0 -0
  521. /package/dist/docs/assets/{skills_create-agent.md.BVoWPcan.lean.js → skills_create-agent.md.Q3h6Je-e.lean.js} +0 -0
  522. /package/dist/docs/assets/{skills_github.md.D0JahM8c.lean.js → skills_github.md.hgFX_oKY.lean.js} +0 -0
  523. /package/dist/docs/assets/{troubleshooting.md.Cus_YZga.lean.js → troubleshooting.md.CYEAO9bM.lean.js} +0 -0
@@ -65,7 +65,8 @@
65
65
  * executes **on the Cursor backend** with the account's stored OAuth
66
66
  * credentials, so the agent gets Linear / Notion / Slack / … tools with
67
67
  * zero token plumbing and no OAuth secrets on this host. Requires the host
68
- * to be signed in (`agent-sdk login` or `CURSOR_API_KEY`):
68
+ * to be signed in (`agent-sdk login`, `CURSOR_API_KEY`, or
69
+ * `CURSOR_SERVICE_ACCOUNT_KEY`):
69
70
  *
70
71
  * ```ts
71
72
  * // agent/mcp-connections/account.ts — every connected server (no allowlist)
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Self-improvement as an extension. An agent's behaviour is source in a
3
+ * repository, so changing how it behaves is a change to that source: a
4
+ * one-off Cursor cloud agent does the coding on a branch and opens a pull
5
+ * request, the agent that mounted this writes the brief and reports the
6
+ * pull request, and the tree it runs from is never edited.
7
+ *
8
+ * ```ts
9
+ * // agent/extensions/improve.ts
10
+ * import improve from "@cursor/july/extensions/improve";
11
+ *
12
+ * export default improve({
13
+ * repo: "https://github.com/acme/agents",
14
+ * path: "agents/concierge",
15
+ * });
16
+ * ```
17
+ *
18
+ * Contributes the `<namespace>__yourself` skill; mount it as `improve` so
19
+ * the skill reads `improve__yourself`. The coding goes through the
20
+ * cursor-cloud-agents extension, so mount that too, with `repo` among its
21
+ * `cloud.repos`. An agent whose own turns run on a cloud VM with the
22
+ * repository checked out needs no second mount: the skill has it work in
23
+ * that checkout.
24
+ */
25
+
26
+ import { z } from "zod";
27
+ import { defineExtension } from "../../extensions.js";
28
+ import type { Extension } from "../../types.js";
29
+
30
+ export interface ImproveOptions {
31
+ /** Repository that holds the agent's source. One of the cloud agents mount's `cloud.repos`. */
32
+ repo: string;
33
+ /** The agent's directory in the repository, as `agent-sdk deploy --path` names it. */
34
+ path: string;
35
+ /** Ref the deployment tracks: branches start there and pull requests target it. Defaults to `main`. */
36
+ ref?: string;
37
+ /** What a coding agent must know about this tree beyond the Agent SDK layout, one line each. */
38
+ notes?: string[];
39
+ /** Who deploys a merged change and when it is live. Defaults to "It takes effect at the next deploy." */
40
+ deploy?: string;
41
+ }
42
+
43
+ /** {@link ImproveOptions} with defaults applied. */
44
+ export interface ImproveConfig extends ImproveOptions {
45
+ ref: string;
46
+ notes: string[];
47
+ deploy: string;
48
+ }
49
+
50
+ const line = z.string().trim().min(1);
51
+
52
+ const improve: Extension<ImproveConfig, ImproveOptions> = defineExtension({
53
+ root: import.meta.dirname,
54
+ description:
55
+ "Change your own source through a one-off cloud agent and a pull request, never the running tree.",
56
+ config: z.object({
57
+ repo: z.string().url(),
58
+ path: z
59
+ .string()
60
+ .regex(
61
+ /^[^\s/]+(\/[^\s/]+)*$/,
62
+ "Expected a repository-relative path like agents/concierge"
63
+ ),
64
+ ref: line.default("main"),
65
+ notes: z.array(line).default([]),
66
+ deploy: line.default("It takes effect at the next deploy."),
67
+ }),
68
+ });
69
+
70
+ export default improve;
@@ -0,0 +1,50 @@
1
+ import { defineSkill } from "../../../skills.js";
2
+ import type { SkillDefinition } from "../../../types.js";
3
+ import extension from "../extension.js";
4
+
5
+ const { repo, path, ref, notes, deploy } = extension.config;
6
+
7
+ const treeNotes =
8
+ notes.length === 0
9
+ ? ""
10
+ : `\nAbout this tree in particular; copy these into the brief verbatim:\n\n${notes.map((note) => `- ${note}`).join("\n")}\n`;
11
+
12
+ const yourself: SkillDefinition = defineSkill({
13
+ description:
14
+ "Change your own source (instructions, skills, tools, channels, connections, model, deployment) through a one-off Cursor cloud agent and a pull request. Use whenever the ask is about how you yourself behave, including adding or editing a skill, so the change lands in the repository instead of the tree you happen to be running from.",
15
+ markdown: `# Improve yourself
16
+
17
+ You are the Agent SDK agent at \`${path}\` in ${repo}, deployed from \`${ref}\`. A change to how you behave is a change to that source, and it goes through the repository like any other change: a branch, a pull request, review, a deploy. Nothing about it is special except that people describe it in the second person.
18
+
19
+ ## What changes where
20
+
21
+ Under \`${path}/agent/\`:
22
+
23
+ - \`instructions.md\` is the always-on system prompt: identity, tool-choice rules, the output contract.
24
+ - \`skills/<name>.md\` is a procedure loaded on demand; a \`<name>/SKILL.md\` directory carries sibling files. The \`description\` frontmatter is the routing rule the model sees.
25
+ - \`tools/<name>.ts\` is typed, executable behaviour: anything that must be right every time.
26
+ - \`channels/\`, \`mcp-connections/\`, and \`host-connections/\` are the surfaces and connectors.
27
+ - \`agent.ts\` is the model, its parameters, and the runtime.
28
+ - \`extensions/<ns>.ts\` mounts an extension. This skill arrives through one.
29
+ ${treeNotes}
30
+ ## The change is made on a clean checkout
31
+
32
+ Never edit the tree you run from: it is a deployed copy of \`${path}\`, and nothing changed there lasts. The change is made on a clean checkout of ${repo} at \`${ref}\`. When your own turn runs on a cloud VM with that repository checked out, that VM is the checkout: branch there. Otherwise hand the coding to a one-off Cursor cloud agent through the cloud agents extension, with \`launch\` under its mount namespace, \`repo\` set to ${repo}, and \`starting_ref\` to \`${ref}\`. One agent per change; steer it with \`reply\` rather than launching another.
33
+
34
+ ## The brief
35
+
36
+ Whoever makes the change works from the same brief. For a cloud agent it is the whole handoff, because it cannot see this conversation:
37
+
38
+ - Who and why. A change to the source of the Agent SDK agent at \`${path}\`, asked for by the person in front of you: the change in their words, and what you know about why they want it.
39
+ - Where. Repository ${repo}, ref \`${ref}\`, directory \`${path}\`, the layout above, and the files you expect to change.
40
+ - How. Follow the repository's own conventions (its \`AGENTS.md\` files and rules along the paths touched). Keep the diff to the change. Run the checks the repository defines for \`${path}\`. Open a pull request against \`${ref}\`; never merge it.
41
+ - Report. The pull request URL, what changed, what was verified and how, and anything left unverified.
42
+
43
+ ## Report
44
+
45
+ If you launched a cloud agent, give the person its URL with the full id, read its report with \`dump\` (\`get\` for status), and read the pull request before repeating its claims. Report the pull request, not that you delegated.
46
+
47
+ A merged pull request changes nothing by itself. ${deploy} Never say you have already changed yourself. Editing your own source is still an edit: do it when asked, and stop at the pull request. Deploying is a separate authorization.`,
48
+ });
49
+
50
+ export default yourself;
package/src/extensions.ts CHANGED
@@ -4,8 +4,8 @@
4
4
  * An extension is a directory laid out like `agent/`: `extension.ts`
5
5
  * declares it; `tools/`, `skills/`, `mcp-connections/`,
6
6
  * `host-connections/`, `hooks/`, `channels/`, `schedules/`,
7
- * `subagents/`, `instructions`, `ab.ts` / `ab/`, `artifacts.ts`,
8
- * and `sandbox/workspace/` are its contributions. `lib/` holds
7
+ * `subagents/`, `instructions`, `artifacts.ts`, and
8
+ * `sandbox/workspace/` are its contributions. `lib/` holds
9
9
  * shared code.
10
10
  *
11
11
  * ```ts
@@ -162,10 +162,6 @@ export function disableInstructions(): DisabledDefinition {
162
162
  return disable();
163
163
  }
164
164
 
165
- export function disableAB(): DisabledDefinition {
166
- return disable();
167
- }
168
-
169
165
  export function disableArtifacts(): DisabledDefinition {
170
166
  return disable();
171
167
  }
package/src/index.ts CHANGED
@@ -31,7 +31,6 @@ import type {
31
31
  ServeOptions,
32
32
  } from "./types.js";
33
33
 
34
- export { defineAB } from "./ab.js";
35
34
  export { defineArtifacts } from "./artifacts.js";
36
35
  // Authoring helpers (also available on their focused subpath exports).
37
36
  export {
@@ -55,7 +54,6 @@ export {
55
54
  cursorPlugin,
56
55
  defineExtension,
57
56
  disable,
58
- disableAB,
59
57
  disableArtifacts,
60
58
  disableChannel,
61
59
  disableConnection,
@@ -190,7 +188,6 @@ export { defineSkill } from "./skills.js";
190
188
  export type {
191
189
  DurableSessionRecord,
192
190
  DurableSessionSummary,
193
- StorageABTable,
194
191
  StorageCasTable,
195
192
  StorageConfig,
196
193
  StorageContext,
@@ -20,10 +20,16 @@
20
20
  // Null-prototype copies so specifiers like "constructor" or "__proto__"
21
21
  // can never resolve to inherited Object.prototype members.
22
22
  let directAliases = toNullProtoMap({});
23
+ let sourceFallbackAliases = toNullProtoMap({});
23
24
  let sourceTreeFallbackParentURL: string | undefined;
24
25
 
25
26
  export interface AuthoredAliasHookData {
26
27
  directAliases: Record<string, string>;
28
+ /**
29
+ * Framework exports omitted from the running distribution. Resolve these
30
+ * against an authored project's `anysphere-source` package condition.
31
+ */
32
+ sourceFallbackAliases?: string[];
27
33
  /**
28
34
  * `file:` URL of the running `@cursor/july` package.json. Bare imports
29
35
  * from monorepo `packages/agent-serve/` source retry against this parent
@@ -40,6 +46,11 @@ function toNullProtoMap(
40
46
 
41
47
  export function initialize(data: AuthoredAliasHookData): void {
42
48
  directAliases = toNullProtoMap(data.directAliases);
49
+ sourceFallbackAliases = toNullProtoMap(
50
+ Object.fromEntries(
51
+ (data.sourceFallbackAliases ?? []).map((specifier) => [specifier, "1"])
52
+ )
53
+ );
43
54
  const parent = data.sourceTreeFallbackParentURL;
44
55
  sourceTreeFallbackParentURL =
45
56
  typeof parent === "string" && parent !== "" ? parent : undefined;
@@ -65,6 +76,9 @@ export function resolve(
65
76
  if (direct !== undefined) {
66
77
  return { url: direct, shortCircuit: true };
67
78
  }
79
+ if (sourceFallbackAliases[specifier] !== undefined) {
80
+ return nextResolve(specifier, withCondition(context, "anysphere-source"));
81
+ }
68
82
  if (
69
83
  sourceTreeFallbackParentURL !== undefined &&
70
84
  isBarePackageSpecifier(specifier) &&
@@ -95,6 +109,24 @@ function withParentURL(context: unknown, parentURL: string): unknown {
95
109
  return { parentURL };
96
110
  }
97
111
 
112
+ function withCondition(context: unknown, condition: string): unknown {
113
+ const record =
114
+ context !== null && typeof context === "object"
115
+ ? (context as Record<string, unknown>)
116
+ : {};
117
+ const conditions = Array.isArray(record["conditions"])
118
+ ? record["conditions"].filter(
119
+ (value): value is string => typeof value === "string"
120
+ )
121
+ : [];
122
+ return {
123
+ ...record,
124
+ conditions: conditions.includes(condition)
125
+ ? conditions
126
+ : [...conditions, condition],
127
+ };
128
+ }
129
+
98
130
  function isBarePackageSpecifier(specifier: string): boolean {
99
131
  if (specifier.length === 0) {
100
132
  return false;
@@ -18,10 +18,11 @@
18
18
  * tsconfig paths already cover them.
19
19
  */
20
20
 
21
+ import { existsSync } from "node:fs";
21
22
  import { stat } from "node:fs/promises";
22
23
  import { register as registerModuleHooks } from "node:module";
23
24
  import { join } from "node:path";
24
- import { pathToFileURL } from "node:url";
25
+ import { fileURLToPath, pathToFileURL } from "node:url";
25
26
  import type { AuthoredAliasHookData } from "./authored-alias-hooks.js";
26
27
  import {
27
28
  CLI_COMMAND_NAME,
@@ -61,6 +62,22 @@ export function authoredModuleSpecifier(
61
62
  return url.href;
62
63
  }
63
64
 
65
+ export function partitionFrameworkAliases(aliases: Record<string, string>): {
66
+ directAliases: Record<string, string>;
67
+ sourceFallbackAliases: string[];
68
+ } {
69
+ const directAliases: Record<string, string> = {};
70
+ const sourceFallbackAliases: string[] = [];
71
+ for (const [specifier, url] of Object.entries(aliases)) {
72
+ if (existsSync(fileURLToPath(url))) {
73
+ directAliases[specifier] = url;
74
+ } else {
75
+ sourceFallbackAliases.push(specifier);
76
+ }
77
+ }
78
+ return { directAliases, sourceFallbackAliases };
79
+ }
80
+
64
81
  /**
65
82
  * Dynamically import an authored TypeScript/JavaScript module, re-reading it
66
83
  * from disk when the file's mtime has changed since the last import.
@@ -165,8 +182,15 @@ function registerFrameworkAliases(): void {
165
182
  return;
166
183
  }
167
184
  const hooksUrl = new URL("./authored-alias-hooks.js", import.meta.url);
185
+ const { directAliases, sourceFallbackAliases } = partitionFrameworkAliases(
186
+ frameworkAliases()
187
+ );
168
188
  const data: AuthoredAliasHookData = {
169
- directAliases: frameworkAliases(),
189
+ directAliases,
190
+ // Internal-only exports stay out of the public package. When one is
191
+ // mounted by an agent in this source checkout, resolve that one import
192
+ // through the checkout's `anysphere-source` export instead.
193
+ sourceFallbackAliases,
170
194
  // Hosted factory agents relative-import this package's src/ from a
171
195
  // monorepo checkout while npm install ran only in the agent directory.
172
196
  // Bare specifiers from that tree retry against this package.json.
@@ -30,7 +30,7 @@ function kindVariant(name: string, schema: z.ZodType | undefined) {
30
30
  .min(1)
31
31
  .optional()
32
32
  .describe(
33
- "Stable upsert key: tagging the same key again updates the existing record instead of creating a new one."
33
+ "Stable key, unique across kinds. Reusing it replaces that record instead of adding a new one."
34
34
  ),
35
35
  });
36
36
  }
@@ -47,10 +47,9 @@ export function tagArtifactTool(config: ArtifactsConfig): ToolDefinition {
47
47
  );
48
48
  }
49
49
  const description = [
50
- "Tag a durable artifact: a record of a notable output you produced, kept across sessions and listed for the people supervising this agent. Tag one whenever you finish something worth surfacing durably.",
50
+ "Tag a finished output as an artifact. Artifacts persist across sessions and are listed for the people supervising this agent.",
51
51
  "Kinds:",
52
52
  ...kinds.map(([name, kind]) => `- ${name}: ${kind.description}`),
53
- "Same `key` upserts: tagging it again updates that record — use a stable key when re-tagging the same underlying thing (e.g. the same PR URL).",
54
53
  ].join("\n");
55
54
  return defineTool({
56
55
  description,
@@ -0,0 +1,66 @@
1
+ import type { ChannelHandlerArgs, ChannelRoute } from "../types.js";
2
+ import { jsonResponse } from "./http-channel.js";
3
+ import { validateToolInput } from "./json-schema.js";
4
+
5
+ /**
6
+ * Run one authored channel route: validate the declared Zod query / body
7
+ * schemas onto `handlerArgs`, then call the handler. Shared by the local
8
+ * router mount and hosted catch replay so a caught request meets exactly
9
+ * the same schema gate as a direct one.
10
+ */
11
+ export async function invokeChannelRoute(input: {
12
+ route: ChannelRoute;
13
+ request: Request;
14
+ handlerArgs: ChannelHandlerArgs;
15
+ }): Promise<Response> {
16
+ const { route, handlerArgs } = input;
17
+ let request = input.request;
18
+
19
+ if (route.querySchema !== undefined) {
20
+ const rawQuery = Object.fromEntries(
21
+ new URL(request.url).searchParams.entries()
22
+ );
23
+ const queryValidation = validateToolInput(route.querySchema, rawQuery);
24
+ if (!queryValidation.ok) {
25
+ return jsonResponse({ error: queryValidation.message }, { status: 400 });
26
+ }
27
+ handlerArgs.query = queryValidation.value;
28
+ }
29
+
30
+ if (route.bodySchema !== undefined) {
31
+ // Buffer once so handlers that need the raw body (e.g. GitHub HMAC) can
32
+ // still read `request.text()` / `request.json()`.
33
+ let bodyText: string;
34
+ try {
35
+ bodyText = await request.text();
36
+ } catch {
37
+ return jsonResponse(
38
+ { error: "Failed to read request body" },
39
+ { status: 400 }
40
+ );
41
+ }
42
+ let rawBody: unknown;
43
+ try {
44
+ rawBody = bodyText === "" ? {} : JSON.parse(bodyText);
45
+ } catch {
46
+ return jsonResponse(
47
+ { error: "Request body must be valid JSON" },
48
+ { status: 400 }
49
+ );
50
+ }
51
+ const bodyValidation = validateToolInput(route.bodySchema, rawBody);
52
+ if (!bodyValidation.ok) {
53
+ return jsonResponse({ error: bodyValidation.message }, { status: 400 });
54
+ }
55
+ handlerArgs.body = bodyValidation.value;
56
+ request = new Request(request.url, {
57
+ method: request.method,
58
+ headers: request.headers,
59
+ body: bodyText === "" ? undefined : bodyText,
60
+ // node: undici / fetch may require duplex for streamed bodies;
61
+ // a string body does not.
62
+ });
63
+ }
64
+
65
+ return route.handler(request, handlerArgs);
66
+ }
@@ -0,0 +1,96 @@
1
+ import { isDeepStrictEqual } from "node:util";
2
+ import type { JsonValue } from "../types.js";
3
+
4
+ type JsonRecord = Record<string, JsonValue>;
5
+
6
+ function asRecord(value: JsonValue | undefined): JsonRecord | undefined {
7
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
8
+ return undefined;
9
+ }
10
+ return value as JsonRecord;
11
+ }
12
+
13
+ /**
14
+ * Shallow-merge a wake patch into durable channel state. Null / undefined
15
+ * patch values leave the existing key alone so sticky fields survive.
16
+ */
17
+ export function mergeChannelStateSkipNull(
18
+ current: JsonValue | undefined,
19
+ patch: JsonValue | undefined
20
+ ): JsonValue | undefined {
21
+ if (patch === undefined) {
22
+ return current;
23
+ }
24
+ const currentRecord = asRecord(current);
25
+ const patchRecord = asRecord(patch);
26
+ if (currentRecord === undefined || patchRecord === undefined) {
27
+ return structuredClone(patch);
28
+ }
29
+ const merged = { ...currentRecord };
30
+ for (const [key, value] of Object.entries(patchRecord)) {
31
+ if (value !== null && value !== undefined) {
32
+ merged[key] = value;
33
+ }
34
+ }
35
+ return merged;
36
+ }
37
+
38
+ /**
39
+ * Apply handler mutations made against a turn snapshot without reverting
40
+ * unchanged fields refreshed by a later delivery. At a changed path, objects
41
+ * merge recursively, arrays and scalars replace, and deletions win.
42
+ */
43
+ export function mergeChannelStateMutation(args: {
44
+ current: JsonValue | undefined;
45
+ before: JsonValue;
46
+ after: JsonValue;
47
+ }): JsonValue | undefined {
48
+ const { current, before, after } = args;
49
+ if (isDeepStrictEqual(before, after)) {
50
+ return current;
51
+ }
52
+ const currentRecord = asRecord(current);
53
+ const beforeRecord = asRecord(before);
54
+ const afterRecord = asRecord(after);
55
+ if (
56
+ currentRecord === undefined ||
57
+ beforeRecord === undefined ||
58
+ afterRecord === undefined
59
+ ) {
60
+ return structuredClone(after);
61
+ }
62
+
63
+ const merged = structuredClone(currentRecord);
64
+ const keys = new Set([
65
+ ...Object.keys(beforeRecord),
66
+ ...Object.keys(afterRecord),
67
+ ]);
68
+ for (const key of keys) {
69
+ const hadBefore = Object.hasOwn(beforeRecord, key);
70
+ const hasAfter = Object.hasOwn(afterRecord, key);
71
+ if (
72
+ hadBefore &&
73
+ hasAfter &&
74
+ isDeepStrictEqual(beforeRecord[key], afterRecord[key])
75
+ ) {
76
+ continue;
77
+ }
78
+ if (!hasAfter) {
79
+ delete merged[key];
80
+ continue;
81
+ }
82
+ const currentValue = merged[key];
83
+ const afterValue = afterRecord[key]!;
84
+ merged[key] =
85
+ hadBefore ||
86
+ (asRecord(currentValue) !== undefined &&
87
+ asRecord(afterValue) !== undefined)
88
+ ? (mergeChannelStateMutation({
89
+ current: currentValue,
90
+ before: hadBefore ? beforeRecord[key]! : {},
91
+ after: afterValue,
92
+ }) as JsonValue)
93
+ : structuredClone(afterValue);
94
+ }
95
+ return merged;
96
+ }
@@ -3,8 +3,7 @@
3
3
  * init / run / trajectory / eval
4
4
  *
5
5
  * Coding agents get JSON-first output, ephemeral local servers, and
6
- * filesystem-first evals under evals/ (*.eval.ts). Live A/B metrics
7
- * (`defineAB` under `agent/ab`) plug into serve — there is no `ab` CLI.
6
+ * filesystem-first evals under evals/ (*.eval.ts).
8
7
  */
9
8
 
10
9
  import { mkdir, mkdtemp, writeFile } from "node:fs/promises";
@@ -23,6 +22,7 @@ import { lookupSessionContinuation, runChat } from "./chat-client.js";
23
22
  import { ensureCursorLogin } from "./cli-cursor.js";
24
23
  import { resolveDeployAuth } from "./cli-deploy.js";
25
24
  import { resolveApiKey } from "./cursor/credentials.js";
25
+ import { DeployApiError } from "./deploy-client.js";
26
26
  import { CLI_COMMAND_NAME, PACKAGE_NAME } from "./distribution.js";
27
27
  import {
28
28
  discoverEvals,
@@ -53,6 +53,7 @@ import {
53
53
  resolveTemplate,
54
54
  } from "./init-project.js";
55
55
  import { offerInstallCursorSkills } from "./install-cursor-skills.js";
56
+ import { rejectV2ForLegacyCommand } from "./legacy-command-guard.js";
56
57
  import { runLogsTail, sanitizeCustomerError } from "./logs-client.js";
57
58
  import { mapPool } from "./map-pool.js";
58
59
  import { openBrowser } from "./open-browser.js";
@@ -189,6 +190,13 @@ export interface AxCliOptions {
189
190
  resume?: boolean;
190
191
  /** Abort signal (tests / programmatic stop of `playground` proxy). */
191
192
  signal?: AbortSignal;
193
+ /**
194
+ * `run --prod` / `session --prod --message`: hosted v2 session start on
195
+ * the agentsdk control plane. `--dry-run` marks the turn non-mutating;
196
+ * `--as-of` freezes the session clock at a timezone-bearing instant.
197
+ */
198
+ dryRun?: boolean;
199
+ asOf?: string;
192
200
  }
193
201
 
194
202
  export interface ResolvedAgentTarget {
@@ -594,6 +602,15 @@ export async function cmdChat(options: AxCliOptions): Promise<number> {
594
602
  }
595
603
 
596
604
  export async function cmdRun(options: AxCliOptions): Promise<number> {
605
+ // Only a v2-shaped request tries the control plane; every v1 `run --prod`
606
+ // form (multi-turn, continuation token, local session id, --url) keeps its
607
+ // engine-alias path untouched.
608
+ if (options.prod === true && hostedSessionRejection(options) === undefined) {
609
+ const started = await cmdHostedSession(options);
610
+ if (started !== "fallback") {
611
+ return started;
612
+ }
613
+ }
597
614
  const messages = options.messages ?? [];
598
615
  if (messages.length === 0) {
599
616
  die("Provide --message (repeatable) or --messages-file");
@@ -703,6 +720,74 @@ export async function cmdRun(options: AxCliOptions): Promise<number> {
703
720
  }
704
721
  }
705
722
 
723
+ const HOSTED_SESSION_ID_RE = /^ses_[a-f0-9]{24}$/;
724
+
725
+ /**
726
+ * Hosted v2 session start: POST the agentsdk control plane, which hands the
727
+ * wake to Temporal (no resident engine, no `/engine/*` alias). `--session
728
+ * ses_…` resumes that exact session; there is no continuation token on
729
+ * this path. A 404 means the slug is not a v2 control-plane deployment, so
730
+ * `run --prod` falls back to the v1 engine alias.
731
+ */
732
+ /** Why these options cannot be a hosted v2 session start, if they cannot. */
733
+ function hostedSessionRejection(options: AxCliOptions): string | undefined {
734
+ if (options.url !== undefined) {
735
+ return "--prod session start talks to the agentsdk control plane; do not pass --url";
736
+ }
737
+ const messages = options.messages ?? [];
738
+ if (messages.length !== 1 || messages[0]?.trim() === "") {
739
+ return "Provide exactly one --message (the wake). Multi-turn runs are local-only.";
740
+ }
741
+ if (trimNonEmpty(options.continuationToken) !== undefined) {
742
+ return "--continuation-token is not a hosted v2 identity; pass --session ses_… to resume a session";
743
+ }
744
+ const sessionId = trimNonEmpty(options.sessionId);
745
+ if (sessionId !== undefined && !HOSTED_SESSION_ID_RE.test(sessionId)) {
746
+ return `--session must be a hosted session id (ses_…), got ${sessionId}`;
747
+ }
748
+ return undefined;
749
+ }
750
+
751
+ async function cmdHostedSession(
752
+ options: AxCliOptions
753
+ ): Promise<number | "fallback"> {
754
+ const rejection = hostedSessionRejection(options);
755
+ if (rejection !== undefined) {
756
+ die(rejection);
757
+ }
758
+ const messages = options.messages ?? [];
759
+ const sessionId = trimNonEmpty(options.sessionId);
760
+ const auth = await resolveDeployAuth({
761
+ team: options.team,
762
+ apiKey: options.apiKey,
763
+ fetchImpl: options.fetchImpl,
764
+ });
765
+ if (typeof auth === "number") {
766
+ return auth;
767
+ }
768
+ const slug = resolveProdSlug(options);
769
+ try {
770
+ const accepted = await auth.client.startSession({
771
+ teamId: auth.teamId,
772
+ slug,
773
+ message: messages[0]!.trim(),
774
+ sessionId,
775
+ dryRun: options.dryRun,
776
+ asOf: options.asOf,
777
+ });
778
+ console.log(JSON.stringify(accepted, null, 2));
779
+ return 0;
780
+ } catch (error) {
781
+ if (error instanceof DeployApiError && error.status === 404) {
782
+ return "fallback";
783
+ }
784
+ process.stderr.write(
785
+ `${error instanceof Error ? error.message : String(error)}\n`
786
+ );
787
+ return 1;
788
+ }
789
+ }
790
+
706
791
  /**
707
792
  * `agent-sdk call <tool>` — deterministic tool invocation over
708
793
  * `POST /v1/tools/:toolName` (ephemeral local server unless --url).
@@ -1727,6 +1812,11 @@ export async function cmdLogs(options: AxCliOptions): Promise<number> {
1727
1812
  if (typeof auth === "number") {
1728
1813
  return auth;
1729
1814
  }
1815
+ await rejectV2ForLegacyCommand({
1816
+ client: auth.client,
1817
+ teamId: auth.teamId,
1818
+ slug,
1819
+ });
1730
1820
  await runLogsTail({
1731
1821
  prod: true,
1732
1822
  dir: options.dir,
@@ -1750,6 +1840,7 @@ export async function cmdLogs(options: AxCliOptions): Promise<number> {
1750
1840
  apiKey: options.apiKey,
1751
1841
  fetchImpl: options.fetchImpl,
1752
1842
  err: () => {},
1843
+ skipLegacyArchitectureCheck: true,
1753
1844
  });
1754
1845
  return { agentUrl: target.agentUrl, headers: target.headers };
1755
1846
  },
@@ -1864,9 +1955,26 @@ export async function cmdSession(
1864
1955
  sessionId: string | undefined,
1865
1956
  options: AxCliOptions
1866
1957
  ): Promise<number> {
1958
+ if (options.prod === true && (options.messages?.length ?? 0) > 0) {
1959
+ // `session --prod [ses_…] --message` is the same hosted start as
1960
+ // `run --prod`, with the positional id as the session to resume. Unlike
1961
+ // `run`, a 404 is an error here: this form is explicitly v2.
1962
+ const started = await cmdHostedSession({
1963
+ ...options,
1964
+ sessionId: trimNonEmpty(sessionId) ?? options.sessionId,
1965
+ });
1966
+ if (started === "fallback") {
1967
+ process.stderr.write(
1968
+ `Hosted session start returned 404 for slug ${resolveProdSlug(options)}: deploy a running AgentSDK v2 agent, or use \`${CLI_COMMAND_NAME} run --prod\` (falls back to the v1 engine).\n`
1969
+ );
1970
+ return 1;
1971
+ }
1972
+ return started;
1973
+ }
1867
1974
  if (sessionId === undefined || sessionId.trim() === "") {
1868
1975
  process.stderr.write(
1869
- `Usage: ${CLI_COMMAND_NAME} session <sessionId> [--url | --prod] [--json | --text | --events] [--out <file.ndjson>]\n`
1976
+ `Usage: ${CLI_COMMAND_NAME} session <sessionId> [--url | --prod] [--json | --text | --events] [--out <file.ndjson>]\n` +
1977
+ ` or: ${CLI_COMMAND_NAME} session --prod [<sessionId>] --slug <slug> --message "…" [--dry-run] [--as-of <instant>]\n`
1870
1978
  );
1871
1979
  return 2;
1872
1980
  }
@@ -17,6 +17,7 @@ import {
17
17
  revokeMintedUserApiKey,
18
18
  } from "./cursor/backend-client.js";
19
19
  import {
20
+ type ApiKeySource,
20
21
  clearStoredCredentials,
21
22
  credentialsFilePath,
22
23
  cursorBackendUrl,
@@ -255,7 +256,7 @@ function formatIdentity(identity: CursorIdentity): string {
255
256
  return name === "" ? `${email}${team}` : `${name} <${email}>${team}`;
256
257
  }
257
258
 
258
- function describeSource(source: "option" | "env" | "file" | "login"): string {
259
+ function describeSource(source: ApiKeySource): string {
259
260
  switch (source) {
260
261
  case "option":
261
262
  return "explicit --api-key / serve({ apiKey })";
@@ -263,6 +264,8 @@ function describeSource(source: "option" | "env" | "file" | "login"): string {
263
264
  return "CURSOR_API_KEY environment variable";
264
265
  case "file":
265
266
  return "CURSOR_API_KEY_FILE (task bind)";
267
+ case "service-account":
268
+ return "CURSOR_SERVICE_ACCOUNT_KEY environment variable";
266
269
  case "login":
267
270
  return `stored login (${credentialsFilePath()})`;
268
271
  }