@cursor/july 0.1.100 → 0.1.102

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 (484) hide show
  1. package/README.md +27 -0
  2. package/dist/bin/agent-serve.js +3 -2
  3. package/dist/channels/deployments/deployments-channel.d.ts +41 -5
  4. package/dist/channels/deployments/deployments-channel.d.ts.map +1 -1
  5. package/dist/channels/deployments/deployments-channel.js +88 -8
  6. package/dist/channels/deployments/types.d.ts +4 -3
  7. package/dist/channels/deployments/types.d.ts.map +1 -1
  8. package/dist/channels/origin/defaults.d.ts +43 -0
  9. package/dist/channels/origin/defaults.d.ts.map +1 -0
  10. package/dist/channels/origin/defaults.js +111 -0
  11. package/dist/channels/origin/index.d.ts +2 -0
  12. package/dist/channels/origin/index.d.ts.map +1 -1
  13. package/dist/channels/origin/index.js +2 -0
  14. package/dist/channels/origin/origin-channel.d.ts +2 -1
  15. package/dist/channels/origin/origin-channel.d.ts.map +1 -1
  16. package/dist/channels/origin/origin-channel.js +24 -3
  17. package/dist/channels/origin/state.d.ts +32 -0
  18. package/dist/channels/origin/state.d.ts.map +1 -0
  19. package/dist/channels/origin/state.js +23 -0
  20. package/dist/channels/origin/types.d.ts +23 -1
  21. package/dist/channels/origin/types.d.ts.map +1 -1
  22. package/dist/channels/slack/api.d.ts +1 -1
  23. package/dist/channels/slack/api.d.ts.map +1 -1
  24. package/dist/channels/slack/api.js +5 -2
  25. package/dist/channels/slack/assistant.d.ts +1 -1
  26. package/dist/channels/slack/assistant.d.ts.map +1 -1
  27. package/dist/channels/slack/code-fences.d.ts +17 -0
  28. package/dist/channels/slack/code-fences.d.ts.map +1 -0
  29. package/dist/channels/slack/code-fences.js +168 -0
  30. package/dist/channels/slack/dispatch.d.ts +3 -2
  31. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  32. package/dist/channels/slack/dispatch.js +28 -8
  33. package/dist/channels/slack/inbound.d.ts +8 -0
  34. package/dist/channels/slack/inbound.d.ts.map +1 -1
  35. package/dist/channels/slack/inbound.js +28 -0
  36. package/dist/channels/slack/index.d.ts +1 -0
  37. package/dist/channels/slack/index.d.ts.map +1 -1
  38. package/dist/channels/slack/index.js +1 -0
  39. package/dist/channels/slack/live-delivery.d.ts.map +1 -1
  40. package/dist/channels/slack/live-delivery.js +11 -4
  41. package/dist/channels/slack/manifest.d.ts.map +1 -1
  42. package/dist/channels/slack/manifest.js +2 -1
  43. package/dist/connections.d.ts +18 -2
  44. package/dist/connections.d.ts.map +1 -1
  45. package/dist/connections.js +18 -2
  46. package/dist/docs/404.html +2 -2
  47. package/dist/docs/ab.html +4 -4
  48. package/dist/docs/assets/{app.DZ1e0Ycq.js → app.CLA03RCz.js} +1 -1
  49. package/dist/docs/assets/chunks/@localSearchIndexroot.FAqdWIXo.js +1 -0
  50. package/dist/docs/assets/chunks/{VPLocalSearchBox.l8omwc6D.js → VPLocalSearchBox.ifxv-cJV.js} +1 -1
  51. package/dist/docs/assets/chunks/{theme.JVcD6gel.js → theme.DWCwM6p-.js} +2 -2
  52. package/dist/docs/assets/concepts.md.rPzW2HZN.js +1 -0
  53. package/dist/docs/assets/guides_cloud-agents.md.DumwWXba.js +9 -0
  54. package/dist/docs/assets/guides_cloud-agents.md.DumwWXba.lean.js +1 -0
  55. package/dist/docs/assets/{guides_cloud-runtime.md.CkYbjnAX.js → guides_cloud-runtime.md.BRirbRAN.js} +1 -1
  56. package/dist/docs/assets/index.md.Kiht7ell.js +5 -0
  57. package/dist/docs/assets/{index.md.Bb4k8kUm.lean.js → index.md.Kiht7ell.lean.js} +1 -1
  58. package/dist/docs/assets/{reference_connections.md.BiGoBAk2.js → reference_connections.md.Di6jJAXF.js} +12 -2
  59. package/dist/docs/assets/{reference_connections.md.BiGoBAk2.lean.js → reference_connections.md.Di6jJAXF.lean.js} +1 -1
  60. package/dist/docs/assets/reference_extensions.md.9WQMZe1l.js +56 -0
  61. package/dist/docs/assets/reference_extensions.md.9WQMZe1l.lean.js +1 -0
  62. package/dist/docs/assets/{reference_http-api.md.BEJx9XVj.js → reference_http-api.md.oySXBO8o.js} +1 -1
  63. package/dist/docs/assets/{reference_project-layout.md.Bv4KOtlB.js → reference_project-layout.md.CA6QP6Lw.js} +2 -2
  64. package/dist/docs/assets/{reference_project-layout.md.Bv4KOtlB.lean.js → reference_project-layout.md.CA6QP6Lw.lean.js} +1 -1
  65. package/dist/docs/assets/{reference_skills.md.BFW9retM.js → reference_skills.md.l2ezAcaN.js} +1 -1
  66. package/dist/docs/assets/{reference_tools.md.CvAHsdSp.js → reference_tools.md.B1up2r9W.js} +1 -1
  67. package/dist/docs/assets/skills_framework-map.md.DDa4MeEW.js +1 -0
  68. package/dist/docs/assets/{skills_framework-map.md.BTi817yv.lean.js → skills_framework-map.md.DDa4MeEW.lean.js} +1 -1
  69. package/dist/docs/building-with-agents.html +4 -4
  70. package/dist/docs/concepts.html +5 -5
  71. package/dist/docs/concepts.md +3 -3
  72. package/dist/docs/deployment.html +4 -4
  73. package/dist/docs/evals.html +4 -4
  74. package/dist/docs/guides/agent-to-agent.html +4 -4
  75. package/dist/docs/guides/cloud-agents.html +35 -0
  76. package/dist/docs/guides/cloud-agents.md +93 -0
  77. package/dist/docs/guides/cloud-runtime.html +6 -6
  78. package/dist/docs/guides/cloud-runtime.md +2 -0
  79. package/dist/docs/guides/convert-automation.html +4 -4
  80. package/dist/docs/guides/github.html +4 -4
  81. package/dist/docs/guides/human-in-the-loop.html +4 -4
  82. package/dist/docs/guides/mcp-oauth.html +4 -4
  83. package/dist/docs/guides/opentelemetry.html +5 -5
  84. package/dist/docs/guides/slack.html +4 -4
  85. package/dist/docs/guides/webhooks.html +4 -4
  86. package/dist/docs/hashmap.json +1 -1
  87. package/dist/docs/hillclimbing.html +4 -4
  88. package/dist/docs/index.html +6 -6
  89. package/dist/docs/index.md +5 -1
  90. package/dist/docs/llms-full.txt +353 -5
  91. package/dist/docs/llms.txt +2 -0
  92. package/dist/docs/quickstart.html +4 -4
  93. package/dist/docs/reference/agent-config.html +4 -4
  94. package/dist/docs/reference/artifacts.html +4 -4
  95. package/dist/docs/reference/channels.html +5 -5
  96. package/dist/docs/reference/cli.html +4 -4
  97. package/dist/docs/reference/connections.html +16 -6
  98. package/dist/docs/reference/connections.md +31 -0
  99. package/dist/docs/reference/extensions.html +82 -0
  100. package/dist/docs/reference/extensions.md +200 -0
  101. package/dist/docs/reference/hooks.html +4 -4
  102. package/dist/docs/reference/http-api.html +6 -6
  103. package/dist/docs/reference/http-api.md +1 -1
  104. package/dist/docs/reference/instructions.html +4 -4
  105. package/dist/docs/reference/playground.html +4 -4
  106. package/dist/docs/reference/project-layout.html +6 -6
  107. package/dist/docs/reference/project-layout.md +3 -0
  108. package/dist/docs/reference/prompt.html +4 -4
  109. package/dist/docs/reference/schedules.html +4 -4
  110. package/dist/docs/reference/sessions.html +4 -4
  111. package/dist/docs/reference/skills.html +6 -6
  112. package/dist/docs/reference/skills.md +2 -0
  113. package/dist/docs/reference/subagents.html +5 -5
  114. package/dist/docs/reference/tools.html +6 -6
  115. package/dist/docs/reference/tools.md +2 -0
  116. package/dist/docs/scaffolding-agents.html +4 -4
  117. package/dist/docs/skills/ab.html +4 -4
  118. package/dist/docs/skills/create-agent.html +4 -4
  119. package/dist/docs/skills/debug.html +4 -4
  120. package/dist/docs/skills/evals.html +4 -4
  121. package/dist/docs/skills/framework-map.html +5 -5
  122. package/dist/docs/skills/framework-map.md +1 -0
  123. package/dist/docs/skills/github.html +4 -4
  124. package/dist/docs/skills/hillclimb.html +4 -4
  125. package/dist/docs/skills/index.html +4 -4
  126. package/dist/docs/skills/mcp-auth.html +4 -4
  127. package/dist/docs/skills/otel.html +4 -4
  128. package/dist/docs/skills/setup-slack.html +4 -4
  129. package/dist/docs/storage.html +4 -4
  130. package/dist/docs/templates/agentic-owners.html +4 -4
  131. package/dist/docs/templates/agents-md.html +4 -4
  132. package/dist/docs/templates/code-wiki.html +4 -4
  133. package/dist/docs/templates/demo.html +4 -4
  134. package/dist/docs/templates/pr-autofixer.html +4 -4
  135. package/dist/docs/templates/security-help.html +4 -4
  136. package/dist/docs/templates/security-reviewer.html +4 -4
  137. package/dist/docs/templates/triage.html +4 -4
  138. package/dist/docs/troubleshooting.html +4 -4
  139. package/dist/extensions/cursor-cloud-agents/extension.d.ts +57 -0
  140. package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -0
  141. package/dist/extensions/cursor-cloud-agents/extension.js +66 -0
  142. package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts +78 -0
  143. package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts.map +1 -0
  144. package/dist/extensions/cursor-cloud-agents/lib/backend.js +286 -0
  145. package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts +25 -0
  146. package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts.map +1 -0
  147. package/dist/extensions/cursor-cloud-agents/lib/fleet.js +85 -0
  148. package/dist/extensions/cursor-cloud-agents/lib/inputs.d.ts +5 -0
  149. package/dist/extensions/cursor-cloud-agents/lib/inputs.d.ts.map +1 -0
  150. package/dist/extensions/cursor-cloud-agents/lib/inputs.js +4 -0
  151. package/dist/extensions/cursor-cloud-agents/lib/repos.d.ts +15 -0
  152. package/dist/extensions/cursor-cloud-agents/lib/repos.d.ts.map +1 -0
  153. package/dist/extensions/cursor-cloud-agents/lib/repos.js +55 -0
  154. package/dist/extensions/cursor-cloud-agents/lib/transcript.d.ts +8 -0
  155. package/dist/extensions/cursor-cloud-agents/lib/transcript.d.ts.map +1 -0
  156. package/dist/extensions/cursor-cloud-agents/lib/transcript.js +15 -0
  157. package/dist/extensions/cursor-cloud-agents/skills/handoff.md +41 -0
  158. package/dist/extensions/cursor-cloud-agents/tools/cancel.d.ts +4 -0
  159. package/dist/extensions/cursor-cloud-agents/tools/cancel.d.ts.map +1 -0
  160. package/dist/extensions/cursor-cloud-agents/tools/cancel.js +26 -0
  161. package/dist/extensions/cursor-cloud-agents/tools/dump.d.ts +4 -0
  162. package/dist/extensions/cursor-cloud-agents/tools/dump.d.ts.map +1 -0
  163. package/dist/extensions/cursor-cloud-agents/tools/dump.js +54 -0
  164. package/dist/extensions/cursor-cloud-agents/tools/get.d.ts +4 -0
  165. package/dist/extensions/cursor-cloud-agents/tools/get.d.ts.map +1 -0
  166. package/dist/extensions/cursor-cloud-agents/tools/get.js +25 -0
  167. package/dist/extensions/cursor-cloud-agents/tools/launch.d.ts +4 -0
  168. package/dist/extensions/cursor-cloud-agents/tools/launch.d.ts.map +1 -0
  169. package/dist/extensions/cursor-cloud-agents/tools/launch.js +59 -0
  170. package/dist/extensions/cursor-cloud-agents/tools/list.d.ts +4 -0
  171. package/dist/extensions/cursor-cloud-agents/tools/list.d.ts.map +1 -0
  172. package/dist/extensions/cursor-cloud-agents/tools/list.js +36 -0
  173. package/dist/extensions/cursor-cloud-agents/tools/reply.d.ts +4 -0
  174. package/dist/extensions/cursor-cloud-agents/tools/reply.d.ts.map +1 -0
  175. package/dist/extensions/cursor-cloud-agents/tools/reply.js +35 -0
  176. package/dist/extensions.d.ts +73 -0
  177. package/dist/extensions.d.ts.map +1 -0
  178. package/dist/extensions.js +112 -0
  179. package/dist/files-backends/cursor-hosted.d.ts +0 -8
  180. package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
  181. package/dist/files-backends/cursor-hosted.js +1 -11
  182. package/dist/files.d.ts +5 -1
  183. package/dist/files.d.ts.map +1 -1
  184. package/dist/files.js +22 -18
  185. package/dist/index.d.ts +4 -3
  186. package/dist/index.d.ts.map +1 -1
  187. package/dist/index.js +3 -2
  188. package/dist/internal/advertise-tools.d.ts +4 -1
  189. package/dist/internal/advertise-tools.d.ts.map +1 -1
  190. package/dist/internal/advertise-tools.js +20 -1
  191. package/dist/internal/as-of.d.ts +18 -0
  192. package/dist/internal/as-of.d.ts.map +1 -1
  193. package/dist/internal/as-of.js +131 -0
  194. package/dist/internal/cli-deploy.d.ts.map +1 -1
  195. package/dist/internal/cli-deploy.js +64 -19
  196. package/dist/internal/continuation-identity.d.ts.map +1 -1
  197. package/dist/internal/continuation-identity.js +3 -1
  198. package/dist/internal/conversation-mirror.d.ts.map +1 -1
  199. package/dist/internal/conversation-mirror.js +13 -15
  200. package/dist/internal/cursor/backend-client.d.ts +8 -1
  201. package/dist/internal/cursor/backend-client.d.ts.map +1 -1
  202. package/dist/internal/cursor/backend-client.js +25 -9
  203. package/dist/internal/cursor/hosted-deployment-secrets.d.ts +16 -0
  204. package/dist/internal/cursor/hosted-deployment-secrets.d.ts.map +1 -0
  205. package/dist/internal/cursor/hosted-deployment-secrets.js +61 -0
  206. package/dist/internal/cursor/hosted-store-secrets.d.ts +11 -0
  207. package/dist/internal/cursor/hosted-store-secrets.d.ts.map +1 -1
  208. package/dist/internal/cursor/hosted-store-secrets.js +15 -0
  209. package/dist/internal/cursor-deployment-relay.d.ts +15 -1
  210. package/dist/internal/cursor-deployment-relay.d.ts.map +1 -1
  211. package/dist/internal/cursor-deployment-relay.js +46 -7
  212. package/dist/internal/deploy-client.d.ts +23 -0
  213. package/dist/internal/deploy-client.d.ts.map +1 -1
  214. package/dist/internal/deploy-client.js +54 -12
  215. package/dist/internal/discovery/ab.d.ts +9 -0
  216. package/dist/internal/discovery/ab.d.ts.map +1 -0
  217. package/dist/internal/discovery/ab.js +101 -0
  218. package/dist/internal/discovery/agent-config.d.ts +35 -0
  219. package/dist/internal/discovery/agent-config.d.ts.map +1 -0
  220. package/dist/internal/discovery/agent-config.js +173 -0
  221. package/dist/internal/discovery/agent.d.ts +11 -0
  222. package/dist/internal/discovery/agent.d.ts.map +1 -0
  223. package/dist/internal/discovery/agent.js +306 -0
  224. package/dist/internal/discovery/channels.d.ts +10 -0
  225. package/dist/internal/discovery/channels.d.ts.map +1 -0
  226. package/dist/internal/discovery/channels.js +97 -0
  227. package/dist/internal/discovery/connections.d.ts +17 -0
  228. package/dist/internal/discovery/connections.d.ts.map +1 -0
  229. package/dist/internal/discovery/connections.js +436 -0
  230. package/dist/internal/discovery/context.d.ts +20 -0
  231. package/dist/internal/discovery/context.d.ts.map +1 -0
  232. package/dist/internal/discovery/context.js +30 -0
  233. package/dist/internal/discovery/cursor-plugin.d.ts +25 -0
  234. package/dist/internal/discovery/cursor-plugin.d.ts.map +1 -0
  235. package/dist/internal/discovery/cursor-plugin.js +570 -0
  236. package/dist/internal/discovery/extensions.d.ts +19 -0
  237. package/dist/internal/discovery/extensions.d.ts.map +1 -0
  238. package/dist/internal/discovery/extensions.js +238 -0
  239. package/dist/internal/discovery/fs.d.ts +15 -0
  240. package/dist/internal/discovery/fs.d.ts.map +1 -0
  241. package/dist/internal/discovery/fs.js +115 -0
  242. package/dist/internal/discovery/hooks.d.ts +7 -0
  243. package/dist/internal/discovery/hooks.d.ts.map +1 -0
  244. package/dist/internal/discovery/hooks.js +48 -0
  245. package/dist/internal/discovery/info.d.ts +6 -0
  246. package/dist/internal/discovery/info.d.ts.map +1 -0
  247. package/dist/internal/discovery/info.js +141 -0
  248. package/dist/internal/discovery/instructions.d.ts +7 -0
  249. package/dist/internal/discovery/instructions.d.ts.map +1 -0
  250. package/dist/internal/discovery/instructions.js +95 -0
  251. package/dist/internal/discovery/modules.d.ts +20 -0
  252. package/dist/internal/discovery/modules.d.ts.map +1 -0
  253. package/dist/internal/discovery/modules.js +101 -0
  254. package/dist/internal/discovery/names.d.ts +12 -0
  255. package/dist/internal/discovery/names.d.ts.map +1 -0
  256. package/dist/internal/discovery/names.js +36 -0
  257. package/dist/internal/discovery/project.d.ts +53 -0
  258. package/dist/internal/discovery/project.d.ts.map +1 -0
  259. package/dist/internal/discovery/project.js +239 -0
  260. package/dist/internal/discovery/runtime.d.ts +34 -0
  261. package/dist/internal/discovery/runtime.d.ts.map +1 -0
  262. package/dist/internal/discovery/runtime.js +98 -0
  263. package/dist/internal/discovery/schedules.d.ts +7 -0
  264. package/dist/internal/discovery/schedules.d.ts.map +1 -0
  265. package/dist/internal/discovery/schedules.js +97 -0
  266. package/dist/internal/discovery/seed-files.d.ts +7 -0
  267. package/dist/internal/discovery/seed-files.d.ts.map +1 -0
  268. package/dist/internal/discovery/seed-files.js +41 -0
  269. package/dist/internal/discovery/services.d.ts +17 -0
  270. package/dist/internal/discovery/services.d.ts.map +1 -0
  271. package/dist/internal/discovery/services.js +104 -0
  272. package/dist/internal/discovery/skills.d.ts +16 -0
  273. package/dist/internal/discovery/skills.d.ts.map +1 -0
  274. package/dist/internal/discovery/skills.js +151 -0
  275. package/dist/internal/discovery/subagent.d.ts +13 -0
  276. package/dist/internal/discovery/subagent.d.ts.map +1 -0
  277. package/dist/internal/discovery/subagent.js +19 -0
  278. package/dist/internal/discovery/tools.d.ts +18 -0
  279. package/dist/internal/discovery/tools.d.ts.map +1 -0
  280. package/dist/internal/discovery/tools.js +159 -0
  281. package/dist/internal/discovery.d.ts +8 -62
  282. package/dist/internal/discovery.d.ts.map +1 -1
  283. package/dist/internal/discovery.js +8 -2210
  284. package/dist/internal/distribution.d.ts.map +1 -1
  285. package/dist/internal/distribution.js +5 -0
  286. package/dist/internal/framework-file-storage.d.ts +3 -3
  287. package/dist/internal/framework-file-storage.d.ts.map +1 -1
  288. package/dist/internal/framework-file-storage.js +38 -9
  289. package/dist/internal/framework-storage-selection.d.ts.map +1 -1
  290. package/dist/internal/framework-storage-selection.js +8 -7
  291. package/dist/internal/frontmatter.d.ts +11 -3
  292. package/dist/internal/frontmatter.d.ts.map +1 -1
  293. package/dist/internal/frontmatter.js +29 -3
  294. package/dist/internal/hosted-delivery.d.ts +3 -1
  295. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  296. package/dist/internal/hosted-delivery.js +19 -32
  297. package/dist/internal/hosted-execution-diag.d.ts +5 -0
  298. package/dist/internal/hosted-execution-diag.d.ts.map +1 -1
  299. package/dist/internal/hosted-execution-diag.js +5 -0
  300. package/dist/internal/hosted-execution-flush.d.ts +46 -0
  301. package/dist/internal/hosted-execution-flush.d.ts.map +1 -0
  302. package/dist/internal/hosted-execution-flush.js +81 -0
  303. package/dist/internal/mcp-endpoint.js +1 -0
  304. package/dist/internal/mcp-host.d.ts +2 -1
  305. package/dist/internal/mcp-host.d.ts.map +1 -1
  306. package/dist/internal/mcp-host.js +66 -29
  307. package/dist/internal/otel/collector.d.ts +13 -0
  308. package/dist/internal/otel/collector.d.ts.map +1 -1
  309. package/dist/internal/otel/collector.js +84 -17
  310. package/dist/internal/otel/http.d.ts.map +1 -1
  311. package/dist/internal/otel/http.js +2 -10
  312. package/dist/internal/otel/mcp.d.ts +16 -0
  313. package/dist/internal/otel/mcp.d.ts.map +1 -0
  314. package/dist/internal/otel/mcp.js +68 -0
  315. package/dist/internal/otel/propagation.d.ts +6 -0
  316. package/dist/internal/otel/propagation.d.ts.map +1 -0
  317. package/dist/internal/otel/propagation.js +14 -0
  318. package/dist/internal/otel/runtime.d.ts.map +1 -1
  319. package/dist/internal/otel/runtime.js +2 -0
  320. package/dist/internal/review-comments.d.ts +1 -1
  321. package/dist/internal/review-comments.d.ts.map +1 -1
  322. package/dist/internal/review-comments.js +4 -4
  323. package/dist/internal/server.d.ts +3 -0
  324. package/dist/internal/server.d.ts.map +1 -1
  325. package/dist/internal/server.js +79 -104
  326. package/dist/internal/session-engine.d.ts +14 -7
  327. package/dist/internal/session-engine.d.ts.map +1 -1
  328. package/dist/internal/session-engine.js +113 -66
  329. package/dist/internal/session-run-log.d.ts +3 -1
  330. package/dist/internal/session-run-log.d.ts.map +1 -1
  331. package/dist/internal/session-run-log.js +14 -14
  332. package/dist/internal/start-log-store.d.ts +60 -0
  333. package/dist/internal/start-log-store.d.ts.map +1 -0
  334. package/dist/internal/start-log-store.js +149 -0
  335. package/dist/internal/storage-coordinator.d.ts +4 -1
  336. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  337. package/dist/internal/storage-coordinator.js +15 -13
  338. package/dist/internal/tool-catalog.d.ts.map +1 -1
  339. package/dist/internal/tool-catalog.js +9 -6
  340. package/dist/internal/tool-policy.d.ts +8 -0
  341. package/dist/internal/tool-policy.d.ts.map +1 -1
  342. package/dist/internal/tool-policy.js +19 -7
  343. package/dist/internal/turn-cost.d.ts +14 -0
  344. package/dist/internal/turn-cost.d.ts.map +1 -1
  345. package/dist/internal/turn-cost.js +41 -9
  346. package/dist/internal/v2-hosting.d.ts +22 -0
  347. package/dist/internal/v2-hosting.d.ts.map +1 -0
  348. package/dist/internal/v2-hosting.js +23 -0
  349. package/dist/otel.d.ts +16 -0
  350. package/dist/otel.d.ts.map +1 -1
  351. package/dist/otel.js +26 -0
  352. package/dist/playground/assets/index-B6C9S9nG.css +1 -0
  353. package/dist/playground/assets/{index-DVs98vPL.js → index-ZqNoT8Ie.js} +45 -45
  354. package/dist/playground/index.html +2 -2
  355. package/dist/storage-protocol.d.ts +47 -22
  356. package/dist/storage-protocol.d.ts.map +1 -1
  357. package/dist/storage-protocol.js +90 -54
  358. package/dist/storage.d.ts +2 -2
  359. package/dist/storage.d.ts.map +1 -1
  360. package/dist/storage.js +1 -1
  361. package/dist/tools.d.ts +9 -0
  362. package/dist/tools.d.ts.map +1 -1
  363. package/dist/tools.js +9 -0
  364. package/dist/types.d.ts +154 -6
  365. package/dist/types.d.ts.map +1 -1
  366. package/dist/types.js +29 -1
  367. package/docs/README.md +5 -1
  368. package/docs/concepts.md +3 -3
  369. package/docs/guides/cloud-agents.md +98 -0
  370. package/docs/guides/cloud-runtime.md +2 -0
  371. package/docs/reference/connections.md +31 -0
  372. package/docs/reference/extensions.md +205 -0
  373. package/docs/reference/http-api.md +1 -1
  374. package/docs/reference/project-layout.md +3 -0
  375. package/docs/reference/skills.md +2 -0
  376. package/docs/reference/tools.md +2 -0
  377. package/package.json +18 -4
  378. package/skills/framework-map/SKILL.md +1 -0
  379. package/src/bin/agent-serve.ts +11 -2
  380. package/src/channels/deployments/deployments-channel.ts +117 -8
  381. package/src/channels/deployments/types.ts +4 -3
  382. package/src/channels/origin/defaults.ts +143 -0
  383. package/src/channels/origin/index.ts +2 -0
  384. package/src/channels/origin/origin-channel.ts +37 -1
  385. package/src/channels/origin/state.ts +54 -0
  386. package/src/channels/origin/types.ts +24 -0
  387. package/src/channels/slack/api.ts +6 -3
  388. package/src/channels/slack/assistant.ts +1 -1
  389. package/src/channels/slack/code-fences.ts +183 -0
  390. package/src/channels/slack/dispatch.ts +27 -2
  391. package/src/channels/slack/inbound.ts +37 -0
  392. package/src/channels/slack/index.ts +1 -0
  393. package/src/channels/slack/live-delivery.ts +16 -13
  394. package/src/channels/slack/manifest.ts +2 -1
  395. package/src/connections.ts +18 -1
  396. package/src/extensions/cursor-cloud-agents/extension.ts +120 -0
  397. package/src/extensions/cursor-cloud-agents/lib/backend.ts +395 -0
  398. package/src/extensions/cursor-cloud-agents/lib/fleet.ts +109 -0
  399. package/src/extensions/cursor-cloud-agents/lib/inputs.ts +5 -0
  400. package/src/extensions/cursor-cloud-agents/lib/repos.ts +81 -0
  401. package/src/extensions/cursor-cloud-agents/lib/transcript.ts +23 -0
  402. package/src/extensions/cursor-cloud-agents/skills/handoff.md +41 -0
  403. package/src/extensions/cursor-cloud-agents/tools/cancel.ts +19 -0
  404. package/src/extensions/cursor-cloud-agents/tools/dump.ts +51 -0
  405. package/src/extensions/cursor-cloud-agents/tools/get.ts +18 -0
  406. package/src/extensions/cursor-cloud-agents/tools/launch.ts +64 -0
  407. package/src/extensions/cursor-cloud-agents/tools/list.ts +31 -0
  408. package/src/extensions/cursor-cloud-agents/tools/reply.ts +34 -0
  409. package/src/extensions.ts +141 -0
  410. package/src/files-backends/cursor-hosted.ts +1 -17
  411. package/src/files.ts +43 -34
  412. package/src/index.ts +11 -0
  413. package/src/internal/advertise-tools.ts +37 -12
  414. package/src/internal/as-of.ts +163 -0
  415. package/src/internal/cli-deploy.ts +86 -23
  416. package/src/internal/continuation-identity.ts +3 -1
  417. package/src/internal/conversation-mirror.ts +23 -18
  418. package/src/internal/cursor/backend-client.ts +32 -10
  419. package/src/internal/cursor/hosted-deployment-secrets.ts +72 -0
  420. package/src/internal/cursor/hosted-store-secrets.ts +27 -0
  421. package/src/internal/cursor-deployment-relay.ts +65 -8
  422. package/src/internal/deploy-client.ts +73 -18
  423. package/src/internal/discovery/ab.ts +111 -0
  424. package/src/internal/discovery/agent-config.ts +222 -0
  425. package/src/internal/discovery/agent.ts +360 -0
  426. package/src/internal/discovery/channels.ts +103 -0
  427. package/src/internal/discovery/connections.ts +540 -0
  428. package/src/internal/discovery/context.ts +46 -0
  429. package/src/internal/discovery/cursor-plugin.ts +708 -0
  430. package/src/internal/discovery/extensions.ts +348 -0
  431. package/src/internal/discovery/fs.ts +108 -0
  432. package/src/internal/discovery/hooks.ts +45 -0
  433. package/src/internal/discovery/info.ts +179 -0
  434. package/src/internal/discovery/instructions.ts +113 -0
  435. package/src/internal/discovery/modules.ts +107 -0
  436. package/src/internal/discovery/names.ts +44 -0
  437. package/src/internal/discovery/project.ts +270 -0
  438. package/src/internal/discovery/runtime.ts +159 -0
  439. package/src/internal/discovery/schedules.ts +94 -0
  440. package/src/internal/discovery/seed-files.ts +37 -0
  441. package/src/internal/discovery/services.ts +124 -0
  442. package/src/internal/discovery/skills.ts +176 -0
  443. package/src/internal/discovery/subagent.ts +29 -0
  444. package/src/internal/discovery/tools.ts +182 -0
  445. package/src/internal/discovery.ts +20 -2724
  446. package/src/internal/distribution.ts +5 -0
  447. package/src/internal/framework-file-storage.ts +43 -9
  448. package/src/internal/framework-storage-selection.ts +9 -9
  449. package/src/internal/frontmatter.ts +36 -3
  450. package/src/internal/hosted-delivery.ts +38 -63
  451. package/src/internal/hosted-execution-diag.ts +6 -0
  452. package/src/internal/hosted-execution-flush.ts +142 -0
  453. package/src/internal/mcp-endpoint.ts +1 -0
  454. package/src/internal/mcp-host.ts +116 -37
  455. package/src/internal/otel/collector.ts +125 -25
  456. package/src/internal/otel/http.ts +2 -12
  457. package/src/internal/otel/mcp.ts +69 -0
  458. package/src/internal/otel/propagation.ts +17 -0
  459. package/src/internal/otel/runtime.ts +2 -0
  460. package/src/internal/review-comments.ts +5 -2
  461. package/src/internal/server.ts +81 -100
  462. package/src/internal/session-engine.ts +152 -39
  463. package/src/internal/session-run-log.ts +18 -16
  464. package/src/internal/start-log-store.ts +174 -0
  465. package/src/internal/storage-coordinator.ts +19 -16
  466. package/src/internal/tool-catalog.ts +9 -6
  467. package/src/internal/tool-policy.ts +39 -9
  468. package/src/internal/turn-cost.ts +47 -4
  469. package/src/internal/v2-hosting.ts +38 -0
  470. package/src/otel.ts +38 -0
  471. package/src/storage-protocol.ts +126 -79
  472. package/src/storage.ts +5 -0
  473. package/src/tools.ts +18 -0
  474. package/src/types.ts +213 -14
  475. package/dist/docs/assets/chunks/@localSearchIndexroot.j70vvPL4.js +0 -1
  476. package/dist/docs/assets/concepts.md.lwAgBIMI.js +0 -1
  477. package/dist/docs/assets/index.md.Bb4k8kUm.js +0 -5
  478. package/dist/docs/assets/skills_framework-map.md.BTi817yv.js +0 -1
  479. package/dist/playground/assets/index-BszoQDc6.css +0 -1
  480. /package/dist/docs/assets/{concepts.md.lwAgBIMI.lean.js → concepts.md.rPzW2HZN.lean.js} +0 -0
  481. /package/dist/docs/assets/{guides_cloud-runtime.md.CkYbjnAX.lean.js → guides_cloud-runtime.md.BRirbRAN.lean.js} +0 -0
  482. /package/dist/docs/assets/{reference_http-api.md.BEJx9XVj.lean.js → reference_http-api.md.oySXBO8o.lean.js} +0 -0
  483. /package/dist/docs/assets/{reference_skills.md.BFW9retM.lean.js → reference_skills.md.l2ezAcaN.lean.js} +0 -0
  484. /package/dist/docs/assets/{reference_tools.md.CvAHsdSp.lean.js → reference_tools.md.B1up2r9W.lean.js} +0 -0
@@ -72,6 +72,7 @@ import { CursorGithubCredentialProvider } from "./cursor/github-credentials.js";
72
72
  import {
73
73
  DeploymentEventRelay,
74
74
  fanOutDeploymentEvent,
75
+ mergeResolvedSubscriptions,
75
76
  type ResolvedSubscription,
76
77
  resolveDeploymentSubscriptions,
77
78
  } from "./cursor-deployment-relay.js";
@@ -111,6 +112,7 @@ import {
111
112
  import { createHostPlatforms, warmupHostGitHubAuth } from "./host-platforms.js";
112
113
  import { registerHostedDeliveryRoute } from "./hosted-delivery.js";
113
114
  import { hostedErrorStackSnippet } from "./hosted-execution-diag.js";
115
+ import { flushHostedExecutionProcessDeath } from "./hosted-execution-flush.js";
114
116
  import {
115
117
  buildHttpChannelRoutes,
116
118
  errorResponse,
@@ -194,6 +196,7 @@ import {
194
196
  unregisterSessionRunFatalFlush,
195
197
  } from "./session-run-log.js";
196
198
  import { sessionUrlsForRequest } from "./session-urls.js";
199
+ import { flushLocalStartLog, selectStartLogStore } from "./start-log-store.js";
197
200
  import { catalogDetailEntry, catalogListEntry } from "./tool-catalog.js";
198
201
 
199
202
  function memoryHealthFields(engines: readonly SessionEngine[]) {
@@ -256,6 +259,8 @@ export interface StartServerInternalOptions {
256
259
  mcpOauthSecrets?: McpOauthSecretsTarget;
257
260
  /** Test seam: persist hosted-execution run logs without a live store. */
258
261
  sessionRunLog?: ReturnType<typeof selectSessionRunLogStore>;
262
+ /** Test seam: persist the engine start.log tee without a live store. */
263
+ startLogStore?: ReturnType<typeof selectStartLogStore>;
259
264
  }
260
265
 
261
266
  /**
@@ -550,10 +555,35 @@ export async function startServer(
550
555
  snapshotLogs: () => logRing.since(),
551
556
  })
552
557
  : undefined);
558
+ const startLogStore =
559
+ options.startLogStore ??
560
+ (mounts.length === 1 && mounts[0] !== undefined
561
+ ? selectStartLogStore({
562
+ project: mounts[0].project,
563
+ logger,
564
+ })
565
+ : undefined);
566
+ // The running claim stamps this before the turn; process-death flush
567
+ // reuses it so the tee snapshot lands under the same ses_ key.
568
+ let lastStartLogId: string | undefined;
569
+ const flushStartLog = async (startLogId: string): Promise<void> => {
570
+ lastStartLogId = startLogId;
571
+ if (startLogStore === undefined) {
572
+ return;
573
+ }
574
+ await flushLocalStartLog({ store: startLogStore, startLogId });
575
+ };
553
576
  if (sessionRunLog !== undefined) {
554
- registerSessionRunFatalFlush((error) =>
555
- sessionRunLog.flushProcessDeath("uncaught_exception", error)
556
- );
577
+ registerSessionRunFatalFlush(async (error) => {
578
+ await flushHostedExecutionProcessDeath({
579
+ flushProcessDeath: (reason, flushError) =>
580
+ sessionRunLog.flushProcessDeath(reason, flushError),
581
+ flushStartLog,
582
+ startLogId: lastStartLogId,
583
+ reason: "uncaught_exception",
584
+ error,
585
+ });
586
+ });
557
587
  }
558
588
  const sdkRunner =
559
589
  options.runner ??
@@ -770,6 +800,7 @@ export async function startServer(
770
800
  logRing,
771
801
  diagStateRoot: baseStateRoot,
772
802
  sessionRunLog,
803
+ flushStartLog,
773
804
  ...(options.authToken === undefined
774
805
  ? {}
775
806
  : { authToken: options.authToken }),
@@ -1224,7 +1255,13 @@ export async function startServer(
1224
1255
  },
1225
1256
  close: async () => {
1226
1257
  if (sessionRunLog !== undefined) {
1227
- await sessionRunLog.flushProcessDeath("process_exit");
1258
+ await flushHostedExecutionProcessDeath({
1259
+ flushProcessDeath: (reason) =>
1260
+ sessionRunLog.flushProcessDeath(reason),
1261
+ flushStartLog,
1262
+ startLogId: lastStartLogId,
1263
+ reason: "process_exit",
1264
+ });
1228
1265
  unregisterSessionRunFatalFlush();
1229
1266
  }
1230
1267
  playgroundDev?.stop();
@@ -1282,6 +1319,7 @@ function mountAgentRoutes(
1282
1319
  logger: (line: string) => void;
1283
1320
  logRing: LogRing;
1284
1321
  sessionRunLog?: ReturnType<typeof selectSessionRunLogStore>;
1322
+ flushStartLog?: (startLogId: string) => Promise<void>;
1285
1323
  authToken?: string;
1286
1324
  allowAnonymous?: boolean;
1287
1325
  /** Cursor account bridge + this mount's account MCP connections, when authored. */
@@ -1303,6 +1341,7 @@ function mountAgentRoutes(
1303
1341
  logger,
1304
1342
  logRing,
1305
1343
  sessionRunLog,
1344
+ flushStartLog,
1306
1345
  } = args;
1307
1346
  // "" (single) -> "/v1/..."; "my-agent" (multi) -> "/my-agent/v1/...".
1308
1347
  const base = slug === "" ? "" : `/${slug}`;
@@ -1366,7 +1405,12 @@ function mountAgentRoutes(
1366
1405
  : { stateRoot: args.diagStateRoot }),
1367
1406
  ...(sessionRunLog === undefined
1368
1407
  ? {}
1369
- : { persistSessionRun: (document) => sessionRunLog.persist(document) }),
1408
+ : {
1409
+ persistSessionRun: async (document) => {
1410
+ await sessionRunLog.persist(document);
1411
+ },
1412
+ flushStartLog,
1413
+ }),
1370
1414
  snapshotLogs: () => logRing.since(),
1371
1415
  });
1372
1416
  }
@@ -1474,51 +1518,6 @@ function mountAgentRoutes(
1474
1518
  },
1475
1519
  });
1476
1520
 
1477
- // v2 only: one session-level hosted-execution log on the framework
1478
- // store. Distinct from GET /v1/logs (process-wide ring). Keyed by the
1479
- // factory session public id so an execute_throw that never minted a
1480
- // July session is still readable after the pod parks.
1481
- if (isV2Project(project) && sessionRunLog !== undefined) {
1482
- router.add({
1483
- method: "GET",
1484
- pattern: `${base}/v1/session/:sessionId/runs`,
1485
- auth: httpAuth,
1486
- handler: async (_request, ctx) => {
1487
- const sessionId = ctx.params.sessionId ?? "";
1488
- if (sessionId.length === 0 || sessionId.includes("/")) {
1489
- return errorResponse(
1490
- 400,
1491
- "invalid_request",
1492
- "Expected a session id."
1493
- );
1494
- }
1495
- const record = await engine.getOrRestoreSession(sessionId);
1496
- if (record === undefined) {
1497
- return errorResponse(
1498
- 404,
1499
- "session_not_found",
1500
- `Unknown session ${sessionId}.`
1501
- );
1502
- }
1503
- const ownership = requireSessionOwner(record, ctx.auth, {
1504
- relax: relaxSessionReadAuth,
1505
- beyondLoopback: relaxSessionReadAuthBeyondLoopback,
1506
- requestIp: ctx.requestIp,
1507
- });
1508
- if (ownership !== undefined) {
1509
- return ownership;
1510
- }
1511
- const document = await sessionRunLog.read(sessionId);
1512
- return jsonResponse({
1513
- sessionId,
1514
- updatedAt: document?.updatedAt,
1515
- lastFailure: document?.lastFailure ?? null,
1516
- executions: document?.executions ?? [],
1517
- });
1518
- },
1519
- });
1520
- }
1521
-
1522
1521
  router.add({
1523
1522
  method: "GET",
1524
1523
  pattern: `${base}/v1/sessions`,
@@ -2694,13 +2693,11 @@ interface CursorDeploymentTarget {
2694
2693
  runtime: MountedRuntime;
2695
2694
  channelId: string;
2696
2695
  options: DeploymentsChannelOptions;
2697
- subscriptions: ResolvedSubscription[];
2698
2696
  }
2699
2697
 
2700
- /** Every mounted `deploymentsChannel`, with its resolved subscriptions. */
2698
+ /** Every mounted `deploymentsChannel`. Subscriptions are re-resolved live. */
2701
2699
  function collectCursorDeploymentTargets(
2702
- runtimes: MountedRuntime[],
2703
- skipped: string[]
2700
+ runtimes: MountedRuntime[]
2704
2701
  ): CursorDeploymentTarget[] {
2705
2702
  const targets: CursorDeploymentTarget[] = [];
2706
2703
  for (const runtime of runtimes) {
@@ -2709,19 +2706,24 @@ function collectCursorDeploymentTargets(
2709
2706
  if (options === undefined) {
2710
2707
  continue;
2711
2708
  }
2712
- const subscriptions = resolveDeploymentSubscriptions(options);
2713
- if (subscriptions.length === 0) {
2714
- // Declared the channel but named no deploy sources — usually an unset
2715
- // env var. Say so rather than starting a relay that receives nothing.
2716
- skipped.push(`${runtime.slug || runtime.project.name}/${channel.id}`);
2717
- continue;
2718
- }
2719
- targets.push({ runtime, channelId: channel.id, options, subscriptions });
2709
+ targets.push({
2710
+ runtime,
2711
+ channelId: channel.id,
2712
+ options,
2713
+ });
2720
2714
  }
2721
2715
  }
2722
2716
  return targets;
2723
2717
  }
2724
2718
 
2719
+ function liveDeploymentSubscriptionUnion(
2720
+ targets: readonly CursorDeploymentTarget[]
2721
+ ): ResolvedSubscription[] {
2722
+ return mergeResolvedSubscriptions(
2723
+ targets.map((target) => resolveDeploymentSubscriptions(target.options))
2724
+ );
2725
+ }
2726
+
2725
2727
  /**
2726
2728
  * Cursor deployment-events relay: automatic when a mounted agent authored
2727
2729
  * `deploymentsChannel({ ... })`. One relay per process reads
@@ -2736,13 +2738,7 @@ function startCursorDeploymentRelay(input: {
2736
2738
  logger: (line: string) => void;
2737
2739
  }): DeploymentEventRelay | undefined {
2738
2740
  const { options, runtimes, accountKey, logger } = input;
2739
- const skipped: string[] = [];
2740
- const targets = collectCursorDeploymentTargets(runtimes, skipped);
2741
- if (skipped.length > 0) {
2742
- logger(
2743
- `[agent-sdk] deployment-events: no deploy sources declared on ${skipped.join(", ")}; those channels receive nothing`
2744
- );
2745
- }
2741
+ const targets = collectCursorDeploymentTargets(runtimes);
2746
2742
  if (targets.length === 0) {
2747
2743
  return undefined;
2748
2744
  }
@@ -2757,34 +2753,19 @@ function startCursorDeploymentRelay(input: {
2757
2753
  `This project has channels subscribed to deployment events (deploymentsChannel({ deploySourceUris })) but the host is not signed in to Cursor. ${SIGN_IN_HINT}`
2758
2754
  );
2759
2755
  }
2760
- // Union across channels: one registration per deploy source for the whole
2761
- // process, however many channels named it. Per-channel environment and
2762
- // event-type filtering happens at dispatch.
2763
- const bySource = new Map<string, ResolvedSubscription>();
2764
- for (const target of targets) {
2765
- for (const subscription of target.subscriptions) {
2766
- const existing = bySource.get(subscription.deploySourceUri);
2767
- if (existing === undefined) {
2768
- bySource.set(subscription.deploySourceUri, {
2769
- deploySourceUri: subscription.deploySourceUri,
2770
- environments: [...subscription.environments],
2771
- events: new Set(subscription.events),
2772
- });
2773
- continue;
2774
- }
2775
- for (const event of subscription.events) existing.events.add(event);
2776
- // An empty environment list means "every environment", so it absorbs.
2777
- existing.environments =
2778
- existing.environments.length === 0 ||
2779
- subscription.environments.length === 0
2780
- ? []
2781
- : [
2782
- ...new Set([
2783
- ...existing.environments,
2784
- ...subscription.environments,
2785
- ]),
2786
- ];
2787
- }
2756
+ // Union is re-resolved on each heartbeat and fan-out so a channel that
2757
+ // refreshes `deploySourceUris` after start (Change Monitor lists the
2758
+ // team's sources every 10 minutes) registers the new URIs.
2759
+ const initial = liveDeploymentSubscriptionUnion(targets);
2760
+ if (initial.length === 0) {
2761
+ logger(
2762
+ `[agent-sdk] deployment-events: no deploy sources yet on ${targets
2763
+ .map(
2764
+ (target) =>
2765
+ `${target.runtime.slug || target.runtime.project.name}/${target.channelId}`
2766
+ )
2767
+ .join(", ")}; the relay will register when a channel lists some`
2768
+ );
2788
2769
  }
2789
2770
  // Same host split as scm-events: `/v0/deployment-events/*` is on
2790
2771
  // api.cursor.com, not api2.
@@ -2795,7 +2776,7 @@ function startCursorDeploymentRelay(input: {
2795
2776
  baseUrl: cursorExternalApiUrl(),
2796
2777
  apiKey: accountKey.apiKey,
2797
2778
  stateDir: join(baseStateRoot, "deployment-events"),
2798
- subscriptions: [...bySource.values()],
2779
+ subscriptions: () => liveDeploymentSubscriptionUnion(targets),
2799
2780
  logger,
2800
2781
  dispatch: async (event) =>
2801
2782
  fanOutDeploymentEvent({
@@ -2803,7 +2784,7 @@ function startCursorDeploymentRelay(input: {
2803
2784
  logger,
2804
2785
  targets: targets.map((target) => ({
2805
2786
  name: `${target.runtime.slug || target.runtime.project.name}/${target.channelId}`,
2806
- subscriptions: target.subscriptions,
2787
+ subscriptions: resolveDeploymentSubscriptions(target.options),
2807
2788
  deliver: (delivered) =>
2808
2789
  dispatchDeploymentEvent({
2809
2790
  options: target.options,
@@ -2818,7 +2799,7 @@ function startCursorDeploymentRelay(input: {
2818
2799
  });
2819
2800
  relay.start();
2820
2801
  logger(
2821
- `[agent-sdk] deployment-events: relaying ${bySource.size} deploy-source subscription(s) to ${targets.length} channel(s)`
2802
+ `[agent-sdk] deployment-events: relaying ${initial.length} deploy-source subscription(s) to ${targets.length} channel(s)`
2822
2803
  );
2823
2804
  return relay;
2824
2805
  }
@@ -34,6 +34,7 @@ import {
34
34
  isCursorHostedFilesAvailable,
35
35
  isCursorUserStoreFilesAvailable,
36
36
  } from "../files-backends/cursor-hosted.js";
37
+ import { storageKeysForArchitecture } from "../storage.js";
37
38
  import {
38
39
  type AgentProject,
39
40
  type AgentRuntime,
@@ -50,16 +51,17 @@ import {
50
51
  type ConnectionTransport,
51
52
  DEFAULT_MODEL,
52
53
  DIRECT_TOOL_CALL_CHANNEL_ID,
54
+ type DiscoveredConnection,
53
55
  type DiscoveredTool,
54
56
  type HookHandler,
55
57
  type HostContext,
56
58
  type HostMcpRegistry,
59
+ type HostMcpToolInfo,
57
60
  type HttpChannelDefinition,
58
61
  isCursorAccountTransport,
59
62
  isHostOauthConnectionTransport,
60
63
  isSymbolicConnectionTransport,
61
64
  type JsonValue,
62
- type McpToolAnnotations,
63
65
  type PendingApproval,
64
66
  type PendingAuth,
65
67
  type ReceiveInput,
@@ -89,7 +91,12 @@ import {
89
91
  } from "./advertise-tools.js";
90
92
  import { ApprovalGate } from "./approval-gate.js";
91
93
  import { ArtifactsStore } from "./artifacts-store.js";
92
- import { assertTimeArgs, normalizeAsOf, sessionClock } from "./as-of.js";
94
+ import {
95
+ assertTimeArgs,
96
+ normalizeAsOf,
97
+ schemaTimeWindowKeys,
98
+ sessionClock,
99
+ } from "./as-of.js";
93
100
  import { SessionAuthError, samePrincipal } from "./auth.js";
94
101
  import { mergeCloudOptions, resolveSessionRuntime } from "./cloud-merge.js";
95
102
  import {
@@ -162,6 +169,7 @@ import {
162
169
  import { TurnGovernor } from "./turn-governor.js";
163
170
  import { TurnLeaseStore } from "./turn-lease-store.js";
164
171
  import { TurnOutbox } from "./turn-outbox.js";
172
+ import { resolveAgentV2Hosting } from "./v2-hosting.js";
165
173
  import {
166
174
  buildAgentsMdContent,
167
175
  buildCloudMemorySection,
@@ -531,20 +539,36 @@ export class SessionEngine {
531
539
  agentName: options.project.name,
532
540
  projectRoot: options.project.rootDir,
533
541
  logger: this.logger,
542
+ keys: storageKeysForArchitecture(
543
+ options.project.agent.architecture
544
+ ),
534
545
  });
535
546
  this.kvApi = createHostKvApi({
536
547
  agentName: options.project.name,
537
548
  stateRoot: options.stateRoot,
538
549
  ...(this.storage === undefined ? {} : { storage: this.storage }),
539
550
  });
551
+ const v2Hosting = resolveAgentV2Hosting({
552
+ architecture: options.project.agent.architecture,
553
+ });
554
+ const managedV2Files =
555
+ v2Hosting.kind === "cursor-managed"
556
+ ? () =>
557
+ cursorHostedFiles({
558
+ resolveStoreSourceId: () =>
559
+ v2Hosting.resolveStoreIds().deploymentStoreSourceId,
560
+ })
561
+ : undefined;
540
562
  this.filesApi = createHostFilesApi({
541
563
  agentName: options.project.name,
542
564
  stateRoot: options.stateRoot,
565
+ sink: managedV2Files?.(),
543
566
  });
544
567
  this.artifactsStore = new ArtifactsStore({
545
568
  stateRoot: options.stateRoot,
546
569
  agentName: options.project.name,
547
570
  config: options.project.artifacts,
571
+ sink: managedV2Files?.(),
548
572
  });
549
573
  this.abCollector = new ABCollector(
550
574
  options.project.abs,
@@ -600,18 +624,25 @@ export class SessionEngine {
600
624
  setResolvedConnections(connections: EngineResolvedConnection[]): void {
601
625
  this.resolvedConnections = connections;
602
626
  for (const connection of connections) {
627
+ const authored = this.authoredConnection(connection.name);
603
628
  this.mcpHost.addConnection({
629
+ ...(authored ?? { name: connection.name }),
604
630
  name: connection.name,
605
631
  transport: {
606
632
  url: connection.localUrl,
607
- ...(connection.headers === undefined
608
- ? {}
609
- : { headers: connection.headers }),
633
+ headers: connection.headers,
610
634
  },
611
635
  });
612
636
  }
613
637
  }
614
638
 
639
+ private authoredConnection(name: string): DiscoveredConnection | undefined {
640
+ return (
641
+ this.project.agent.connections.find((item) => item.name === name) ??
642
+ this.project.agent.hostConnections?.find((item) => item.name === name)
643
+ );
644
+ }
645
+
615
646
  setCloudServerToolsConnection(connection: ConnectionTransport): void {
616
647
  this.cloudServerToolsConnection = connection;
617
648
  }
@@ -2135,7 +2166,20 @@ export class SessionEngine {
2135
2166
  label: string;
2136
2167
  }
2137
2168
  | undefined {
2138
- if (isCursorHostedFilesAvailable()) {
2169
+ const v2Hosting = resolveAgentV2Hosting({
2170
+ architecture: this.project.agent.architecture,
2171
+ });
2172
+ if (v2Hosting.kind === "cursor-managed") {
2173
+ return {
2174
+ sink: cursorHostedFiles({
2175
+ resolveStoreSourceId: () =>
2176
+ v2Hosting.resolveStoreIds().deploymentStoreSourceId,
2177
+ }),
2178
+ skillsPrefix: agentStoreKeys.skillsPrefix(),
2179
+ label: "deployment store",
2180
+ };
2181
+ }
2182
+ if (v2Hosting.kind === "not-v2" && isCursorHostedFilesAvailable()) {
2139
2183
  return {
2140
2184
  sink: cursorHostedFiles(),
2141
2185
  skillsPrefix: agentStoreKeys.skillsPrefix(),
@@ -2734,6 +2778,7 @@ export class SessionEngine {
2734
2778
  this.getChannelSession(channelId, sessionId),
2735
2779
  emit: args.emit,
2736
2780
  now: sessionClock(args.record.asOf),
2781
+ ...(args.record.asOf === undefined ? {} : { asOf: args.record.asOf }),
2737
2782
  };
2738
2783
  try {
2739
2784
  // Before the approval gate: a dry run is unattended, so parking a write
@@ -2753,6 +2798,9 @@ export class SessionEngine {
2753
2798
  input: validation.value,
2754
2799
  asOf: args.record.asOf,
2755
2800
  timeArgs: args.tool.definition.timeArgs,
2801
+ ...(args.tool.advertised === true && args.record.asOf !== undefined
2802
+ ? { timeWindow: schemaTimeWindowKeys(args.tool.inputSchema) }
2803
+ : {}),
2756
2804
  });
2757
2805
  if (decision.kind === "answer") {
2758
2806
  this.stubbedCallIds.get(args.record.sessionId)?.add(toolCallId);
@@ -2799,15 +2847,24 @@ export class SessionEngine {
2799
2847
  }
2800
2848
  const started = Date.now();
2801
2849
  this.logger(`[session] tool ${args.tool.name} start`);
2802
- const result = await mcpAuthAls.run(
2850
+ const result = await this.runToolExecute(
2803
2851
  {
2804
- sessionId: args.record.sessionId,
2852
+ record: args.record,
2805
2853
  turnId: args.turnId,
2806
2854
  callId: toolCallId,
2807
2855
  toolName: args.tool.name,
2808
- emit: args.emit,
2809
2856
  },
2810
- () => execute(validation.value as never, toolCtx)
2857
+ () =>
2858
+ mcpAuthAls.run(
2859
+ {
2860
+ sessionId: args.record.sessionId,
2861
+ turnId: args.turnId,
2862
+ callId: toolCallId,
2863
+ toolName: args.tool.name,
2864
+ emit: args.emit,
2865
+ },
2866
+ () => execute(validation.value as never, toolCtx)
2867
+ )
2811
2868
  );
2812
2869
  this.logger(
2813
2870
  `[session] tool ${args.tool.name} done (${Date.now() - started}ms)`
@@ -2823,6 +2880,36 @@ export class SessionEngine {
2823
2880
  }
2824
2881
  }
2825
2882
 
2883
+ /**
2884
+ * Bind outbound inject (Factory / Cursor API `traceparent`) to the
2885
+ * tool span. No-op when OTel is off.
2886
+ */
2887
+ private runToolExecute<T>(
2888
+ args: {
2889
+ record: SessionRecord;
2890
+ turnId: string;
2891
+ callId: string;
2892
+ toolName: string;
2893
+ },
2894
+ fn: () => T | Promise<T>
2895
+ ): Promise<T> {
2896
+ const otel = this.otel;
2897
+ const run = (): Promise<T> => Promise.resolve(fn());
2898
+ if (otel === undefined) {
2899
+ return run();
2900
+ }
2901
+ return otel.runInCall(
2902
+ {
2903
+ sessionId: args.record.sessionId,
2904
+ session: this.sessionInfo(args.record),
2905
+ turnId: args.turnId,
2906
+ callId: args.callId,
2907
+ toolName: args.toolName,
2908
+ },
2909
+ run
2910
+ );
2911
+ }
2912
+
2826
2913
  /**
2827
2914
  * Park a server-tool call until a human approves or denies. Emits
2828
2915
  * `action.approval_requested` / `action.approval_resolved` on the
@@ -3083,13 +3170,6 @@ export class SessionEngine {
3083
3170
  await this.oauthHub.persistFor(connection, authored.transport.url);
3084
3171
  }
3085
3172
 
3086
- private authoredConnection(name: string) {
3087
- return (
3088
- this.project.agent.connections.find((entry) => entry.name === name) ??
3089
- this.project.agent.hostConnections?.find((entry) => entry.name === name)
3090
- );
3091
- }
3092
-
3093
3173
  private async mintAuthUrl(
3094
3174
  connection: string,
3095
3175
  sessionId: string
@@ -3632,6 +3712,9 @@ export class SessionEngine {
3632
3712
  input: validation.value,
3633
3713
  asOf: record?.asOf,
3634
3714
  timeArgs: tool.definition.timeArgs,
3715
+ ...(tool.advertised === true && record?.asOf !== undefined
3716
+ ? { timeWindow: schemaTimeWindowKeys(tool.inputSchema) }
3717
+ : {}),
3635
3718
  });
3636
3719
 
3637
3720
  const started = Date.now();
@@ -3700,20 +3783,34 @@ export class SessionEngine {
3700
3783
  this.getChannelSession(channelId, sessionId),
3701
3784
  emit,
3702
3785
  now: sessionClock(record?.asOf),
3786
+ ...(record?.asOf === undefined ? {} : { asOf: record.asOf }),
3703
3787
  });
3704
- result = normalizeToolResult(
3788
+ const executeBody =
3705
3789
  record !== undefined && emit !== undefined
3706
- ? await mcpAuthAls.run(
3790
+ ? () =>
3791
+ mcpAuthAls.run(
3792
+ {
3793
+ sessionId: record.sessionId,
3794
+ turnId: callId,
3795
+ callId,
3796
+ toolName,
3797
+ emit,
3798
+ },
3799
+ run
3800
+ )
3801
+ : run;
3802
+ result = normalizeToolResult(
3803
+ record !== undefined
3804
+ ? await this.runToolExecute(
3707
3805
  {
3708
- sessionId: record.sessionId,
3806
+ record,
3709
3807
  turnId: callId,
3710
3808
  callId,
3711
3809
  toolName,
3712
- emit,
3713
3810
  },
3714
- run
3811
+ executeBody
3715
3812
  )
3716
- : await run()
3813
+ : await executeBody()
3717
3814
  );
3718
3815
  isError = isErrorEnvelope(result);
3719
3816
  }
@@ -3770,28 +3867,42 @@ export class SessionEngine {
3770
3867
  }
3771
3868
 
3772
3869
  /**
3773
- * Whether a dry run answers a bridged MCP call, for the cloud host bridge —
3870
+ * Whether the host answers a bridged MCP call, for the cloud host bridge —
3774
3871
  * the one tool path that does not reach {@link executeServerTool}, because
3775
3872
  * it forwards to `host.mcp` instead of invoking a tool body.
3776
3873
  *
3777
- * A bridged tool carries no `defineTool`, so it declares no effect, and the
3778
- * policy reads an undeclared tool as a write. In a dry run that answers
3779
- * bridged reads too; resolving effects from a server's own listing is the
3780
- * next unit's work.
3874
+ * A frozen session refuses forward-looking time args here even when it is
3875
+ * not a dry run. A bridged tool carries no `defineTool`, so it declares no
3876
+ * effect, and the policy reads an undeclared tool as a write. In a dry run
3877
+ * that answers bridged reads too; resolving effects from a server's own
3878
+ * listing is the next unit's work.
3781
3879
  */
3782
3880
  async bridgedCallAnswer(args: {
3783
3881
  sessionId: string;
3784
3882
  connectionName: string;
3785
3883
  toolName: string;
3884
+ input?: unknown;
3786
3885
  }): Promise<
3787
3886
  { answered: true; result: SDKCustomToolResult } | { answered: false }
3788
3887
  > {
3789
3888
  // Read off the in-flight turn's context rather than the session store:
3790
3889
  // the bridge already refuses a call with no active turn, so the record is
3791
- // in memory. That keeps this free for the sessions that are not dry runs,
3792
- // which is every session today — the listing below is only paid inside a
3793
- // dry run.
3890
+ // in memory. The listing below is only paid inside a dry run.
3794
3891
  const context = this.activeToolContexts.get(args.sessionId);
3892
+ if (context?.record.asOf !== undefined) {
3893
+ const decision = decideToolCall({
3894
+ dryRun: false,
3895
+ effect: undefined,
3896
+ input: args.input,
3897
+ asOf: context.record.asOf,
3898
+ });
3899
+ if (decision.kind === "unbounded") {
3900
+ this.logger(
3901
+ `[session] bridged tool ${args.toolName} refused, unbounded_time (${args.sessionId})`
3902
+ );
3903
+ return { answered: true, result: toolErrorResult(decision.message) };
3904
+ }
3905
+ }
3795
3906
  if (context?.record.dryRun !== true) {
3796
3907
  return { answered: false };
3797
3908
  }
@@ -3799,14 +3910,16 @@ export class SessionEngine {
3799
3910
  // server's own listing annotations; a tool the listing cannot classify
3800
3911
  // refuses rather than being stubbed. A failed listing classifies nothing,
3801
3912
  // which lands on the same refusal — never on a run.
3802
- const annotations = await this.bridgedToolAnnotations(
3803
- args.connectionName,
3804
- args.toolName
3805
- );
3913
+ const info = await this.bridgedToolInfo(args.connectionName, args.toolName);
3806
3914
  const decision = decideToolCall({
3807
3915
  dryRun: true,
3808
3916
  effect: undefined,
3809
- mcpTool: { name: args.toolName, annotations },
3917
+ mcpTool: { name: args.toolName, annotations: info?.annotations },
3918
+ input: args.input,
3919
+ asOf: context.record.asOf,
3920
+ ...(context.record.asOf !== undefined
3921
+ ? { timeWindow: schemaTimeWindowKeys(info?.inputSchema) }
3922
+ : {}),
3810
3923
  });
3811
3924
  if (decision.kind === "run") {
3812
3925
  return { answered: false };
@@ -3842,13 +3955,13 @@ export class SessionEngine {
3842
3955
  * undefined when the tool is unlisted, unannotated, or the listing fails —
3843
3956
  * all of which the policy reads as unclassified, the refusing state.
3844
3957
  */
3845
- private async bridgedToolAnnotations(
3958
+ private async bridgedToolInfo(
3846
3959
  connectionName: string,
3847
3960
  toolName: string
3848
- ): Promise<McpToolAnnotations | undefined> {
3961
+ ): Promise<HostMcpToolInfo | undefined> {
3849
3962
  try {
3850
3963
  const listed = await this.host.mcp.listTools(connectionName);
3851
- return listed.find((tool) => tool.name === toolName)?.annotations;
3964
+ return listed.find((tool) => tool.name === toolName);
3852
3965
  } catch {
3853
3966
  return undefined;
3854
3967
  }