@cursor/july 0.1.92 → 0.1.94

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 (448) hide show
  1. package/AGENTS.md +8 -20
  2. package/README.md +115 -182
  3. package/dist/channels/deployments/deployments-channel.d.ts +7 -0
  4. package/dist/channels/deployments/deployments-channel.d.ts.map +1 -1
  5. package/dist/channels/deployments/deployments-channel.js +26 -2
  6. package/dist/channels/deployments/types.d.ts +8 -0
  7. package/dist/channels/deployments/types.d.ts.map +1 -1
  8. package/dist/channels/github/github-channel.d.ts +3 -0
  9. package/dist/channels/github/github-channel.d.ts.map +1 -1
  10. package/dist/channels/github/github-channel.js +28 -56
  11. package/dist/channels/slack/attachments.js +2 -2
  12. package/dist/channels/slack/dispatch.d.ts +0 -7
  13. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  14. package/dist/channels/slack/dispatch.js +4 -7
  15. package/dist/channels/slack/eval-directive.d.ts +5 -12
  16. package/dist/channels/slack/eval-directive.d.ts.map +1 -1
  17. package/dist/channels/slack/eval-directive.js +8 -19
  18. package/dist/channels/slack/index.d.ts +0 -6
  19. package/dist/channels/slack/index.d.ts.map +1 -1
  20. package/dist/channels/slack/index.js +0 -6
  21. package/dist/channels/slack/setup.d.ts +4 -4
  22. package/dist/channels/slack/setup.d.ts.map +1 -1
  23. package/dist/channels/slack/setup.js +8 -15
  24. package/dist/channels/slack/slack-channel.d.ts +6 -13
  25. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  26. package/dist/channels/slack/slack-channel.js +15 -101
  27. package/dist/channels/slack/types.d.ts +12 -79
  28. package/dist/channels/slack/types.d.ts.map +1 -1
  29. package/dist/channels/slack/types.js +1 -15
  30. package/dist/client.d.ts +14 -0
  31. package/dist/client.d.ts.map +1 -0
  32. package/dist/client.js +12 -0
  33. package/dist/connections.d.ts +18 -9
  34. package/dist/connections.d.ts.map +1 -1
  35. package/dist/connections.js +17 -8
  36. package/dist/continuation.d.ts +1 -1
  37. package/dist/continuation.js +1 -1
  38. package/dist/docs/404.html +2 -2
  39. package/dist/docs/ab.html +8 -8
  40. package/dist/docs/ab.md +7 -13
  41. package/dist/docs/assets/{ab.md.CVzWxLoB.js → ab.md.DJo5r4R-.js} +4 -4
  42. package/dist/docs/assets/{ab.md.CVzWxLoB.lean.js → ab.md.DJo5r4R-.lean.js} +1 -1
  43. package/dist/docs/assets/{app.Bci6CM9E.js → app.CFDEas4I.js} +1 -1
  44. package/dist/docs/assets/building-with-agents.md.DI4mEzlt.js +13 -0
  45. package/dist/docs/assets/{building-with-agents.md.DH8A_cHA.lean.js → building-with-agents.md.DI4mEzlt.lean.js} +1 -1
  46. package/dist/docs/assets/chunks/@localSearchIndexroot.DU3U2Ij2.js +1 -0
  47. package/dist/docs/assets/chunks/{VPLocalSearchBox.BCPT6xA-.js → VPLocalSearchBox.B1IIYpYS.js} +1 -1
  48. package/dist/docs/assets/chunks/{theme.BEA8BF3c.js → theme.Ct4NSiLm.js} +2 -2
  49. package/dist/docs/assets/concepts.md.lwAgBIMI.js +1 -0
  50. package/dist/docs/assets/{concepts.md.CRfU3bVg.lean.js → concepts.md.lwAgBIMI.lean.js} +1 -1
  51. package/dist/docs/assets/{deployment.md.DX_hc3ze.js → deployment.md.D9msOFOW.js} +9 -14
  52. package/dist/docs/assets/{deployment.md.DX_hc3ze.lean.js → deployment.md.D9msOFOW.lean.js} +1 -1
  53. package/dist/docs/assets/{evals.md.a0SMN6r9.js → evals.md.lfJoEVc8.js} +6 -6
  54. package/dist/docs/assets/{evals.md.a0SMN6r9.lean.js → evals.md.lfJoEVc8.lean.js} +1 -1
  55. package/dist/docs/assets/{guides_agent-to-agent.md.BCeVdJRJ.js → guides_agent-to-agent.md.BDb0t1QV.js} +2 -2
  56. package/dist/docs/assets/guides_cloud-runtime.md.CkYbjnAX.js +9 -0
  57. package/dist/docs/assets/guides_cloud-runtime.md.CkYbjnAX.lean.js +1 -0
  58. package/dist/docs/assets/{guides_convert-automation.md.D06eIzea.js → guides_convert-automation.md.B4sjlodG.js} +2 -2
  59. package/dist/docs/assets/{guides_github.md.Cdt1s2QC.js → guides_github.md.Cnh2mL4a.js} +5 -5
  60. package/dist/docs/assets/{guides_github.md.Cdt1s2QC.lean.js → guides_github.md.Cnh2mL4a.lean.js} +1 -1
  61. package/dist/docs/assets/{guides_mcp-oauth.md.Du0f7pGU.js → guides_mcp-oauth.md.DPYmBCbV.js} +7 -9
  62. package/dist/docs/assets/{guides_mcp-oauth.md.Du0f7pGU.lean.js → guides_mcp-oauth.md.DPYmBCbV.lean.js} +1 -1
  63. package/dist/docs/assets/{guides_slack.md.DiUmk_Oi.js → guides_slack.md.C32HsdKk.js} +7 -13
  64. package/dist/docs/assets/guides_slack.md.C32HsdKk.lean.js +1 -0
  65. package/dist/docs/assets/{guides_webhooks.md.BpnIdO0i.js → guides_webhooks.md.DKdA43Qm.js} +2 -2
  66. package/dist/docs/assets/{hillclimbing.md.ywF3yDAd.js → hillclimbing.md.DhESf3OO.js} +1 -1
  67. package/dist/docs/assets/index.md.DRakGHFe.js +5 -0
  68. package/dist/docs/assets/{index.md.BAaMXLFd.lean.js → index.md.DRakGHFe.lean.js} +1 -1
  69. package/dist/docs/assets/{quickstart.md.DsrarzEg.js → quickstart.md.Nj_LjW_a.js} +2 -2
  70. package/dist/docs/assets/{reference_agent-config.md.Bqylgw50.js → reference_agent-config.md.Cp_x38Nl.js} +3 -3
  71. package/dist/docs/assets/{reference_channels.md.DQZjCnyh.js → reference_channels.md.Cd2f2iyV.js} +2 -2
  72. package/dist/docs/assets/{reference_channels.md.DQZjCnyh.lean.js → reference_channels.md.Cd2f2iyV.lean.js} +1 -1
  73. package/dist/docs/assets/{reference_cli.md.B7GkAJRC.js → reference_cli.md.Cw6_ICYG.js} +10 -11
  74. package/dist/docs/assets/{reference_cli.md.B7GkAJRC.lean.js → reference_cli.md.Cw6_ICYG.lean.js} +1 -1
  75. package/dist/docs/assets/{reference_connections.md.DYidrb-j.js → reference_connections.md.BH8Oc0D0.js} +7 -7
  76. package/dist/docs/assets/{reference_connections.md.DYidrb-j.lean.js → reference_connections.md.BH8Oc0D0.lean.js} +1 -1
  77. package/dist/docs/assets/reference_hooks.md.a8BJxMR5.js +14 -0
  78. package/dist/docs/assets/{reference_hooks.md.B9FSgdDe.lean.js → reference_hooks.md.a8BJxMR5.lean.js} +1 -1
  79. package/dist/docs/assets/reference_http-api.md.D89k1mdm.js +11 -0
  80. package/dist/docs/assets/reference_http-api.md.D89k1mdm.lean.js +1 -0
  81. package/dist/docs/assets/{reference_instructions.md.DhNCOl7r.js → reference_instructions.md.CR7XSsGk.js} +3 -3
  82. package/dist/docs/assets/{reference_instructions.md.DhNCOl7r.lean.js → reference_instructions.md.CR7XSsGk.lean.js} +1 -1
  83. package/dist/docs/assets/reference_playground.md.DnX5nL-B.js +1 -0
  84. package/dist/docs/assets/reference_playground.md.DnX5nL-B.lean.js +1 -0
  85. package/dist/docs/assets/reference_project-layout.md.Bv4KOtlB.js +19 -0
  86. package/dist/docs/assets/{reference_prompt.md.DZUMtLPD.js → reference_prompt.md.DnaD5dNK.js} +1 -1
  87. package/dist/docs/assets/{reference_schedules.md.DNipebiG.js → reference_schedules.md.DI_JrHgq.js} +1 -1
  88. package/dist/docs/assets/reference_sessions.md.D0mIh4KK.js +1 -0
  89. package/dist/docs/assets/{reference_sessions.md.tUFzz98S.lean.js → reference_sessions.md.D0mIh4KK.lean.js} +1 -1
  90. package/dist/docs/assets/{reference_skills.md.B5ZEuHfG.js → reference_skills.md.8son6Hjm.js} +4 -4
  91. package/dist/docs/assets/{reference_subagents.md.Xoav0AII.js → reference_subagents.md.CfsIloPm.js} +1 -1
  92. package/dist/docs/assets/{reference_tools.md.wpaJtHn6.js → reference_tools.md.BHeXn2id.js} +3 -3
  93. package/dist/docs/assets/{reference_tools.md.wpaJtHn6.lean.js → reference_tools.md.BHeXn2id.lean.js} +1 -1
  94. package/dist/docs/assets/scaffolding-agents.md.D7UUkWw0.js +1 -0
  95. package/dist/docs/assets/{scaffolding-agents.md.CRDDUtYJ.lean.js → scaffolding-agents.md.D7UUkWw0.lean.js} +1 -1
  96. package/dist/docs/assets/{storage.md.JbjlHWZ6.js → storage.md.BOHeqk2M.js} +5 -5
  97. package/dist/docs/assets/{storage.md.JbjlHWZ6.lean.js → storage.md.BOHeqk2M.lean.js} +1 -1
  98. package/dist/docs/assets/{templates_agentic-owners.md.DSJSIpWU.js → templates_agentic-owners.md.DqtPdm6f.js} +2 -2
  99. package/dist/docs/assets/{templates_pr-autofixer.md.1HAR3RXE.js → templates_pr-autofixer.md.DU7dQpor.js} +2 -2
  100. package/dist/docs/assets/{templates_pr-autofixer.md.1HAR3RXE.lean.js → templates_pr-autofixer.md.DU7dQpor.lean.js} +1 -1
  101. package/dist/docs/assets/{templates_security-reviewer.md.ByFyRta2.js → templates_security-reviewer.md.CTa7u_l1.js} +2 -2
  102. package/dist/docs/assets/{templates_security-reviewer.md.ByFyRta2.lean.js → templates_security-reviewer.md.CTa7u_l1.lean.js} +1 -1
  103. package/dist/docs/assets/troubleshooting.md.Ctv3T8C2.js +1 -0
  104. package/dist/docs/assets/{troubleshooting.md.DYECCZiJ.lean.js → troubleshooting.md.Ctv3T8C2.lean.js} +1 -1
  105. package/dist/docs/building-with-agents.html +7 -7
  106. package/dist/docs/building-with-agents.md +5 -11
  107. package/dist/docs/concepts.html +5 -8
  108. package/dist/docs/concepts.md +13 -17
  109. package/dist/docs/deployment.html +13 -18
  110. package/dist/docs/deployment.md +9 -30
  111. package/dist/docs/design/agsh.md +406 -0
  112. package/dist/docs/evals.html +10 -10
  113. package/dist/docs/evals.md +16 -37
  114. package/dist/docs/guides/agent-to-agent.html +6 -6
  115. package/dist/docs/guides/agent-to-agent.md +3 -3
  116. package/dist/docs/guides/cloud-runtime.html +6 -6
  117. package/dist/docs/guides/cloud-runtime.md +9 -25
  118. package/dist/docs/guides/convert-automation.html +7 -7
  119. package/dist/docs/guides/convert-automation.md +4 -4
  120. package/dist/docs/guides/github.html +9 -9
  121. package/dist/docs/guides/github.md +16 -28
  122. package/dist/docs/guides/human-in-the-loop.html +4 -4
  123. package/dist/docs/guides/mcp-oauth.html +11 -13
  124. package/dist/docs/guides/mcp-oauth.md +14 -22
  125. package/dist/docs/guides/opentelemetry.html +5 -5
  126. package/dist/docs/guides/slack.html +11 -17
  127. package/dist/docs/guides/slack.md +13 -50
  128. package/dist/docs/guides/webhooks.html +6 -6
  129. package/dist/docs/guides/webhooks.md +3 -3
  130. package/dist/docs/hashmap.json +1 -1
  131. package/dist/docs/hillclimbing.html +6 -6
  132. package/dist/docs/hillclimbing.md +1 -1
  133. package/dist/docs/index.html +6 -6
  134. package/dist/docs/index.md +0 -36
  135. package/dist/docs/llms-full.txt +965 -3633
  136. package/dist/docs/llms.txt +3 -18
  137. package/dist/docs/quickstart.html +6 -6
  138. package/dist/docs/quickstart.md +3 -4
  139. package/dist/docs/reference/agent-config.html +8 -8
  140. package/dist/docs/reference/agent-config.md +10 -15
  141. package/dist/docs/reference/artifacts.html +4 -4
  142. package/dist/docs/reference/channels.html +6 -6
  143. package/dist/docs/reference/channels.md +20 -31
  144. package/dist/docs/reference/cli.html +14 -15
  145. package/dist/docs/reference/cli.md +29 -38
  146. package/dist/docs/reference/connections.html +11 -11
  147. package/dist/docs/reference/connections.md +24 -25
  148. package/dist/docs/reference/hooks.html +6 -6
  149. package/dist/docs/reference/hooks.md +12 -17
  150. package/dist/docs/reference/http-api.html +7 -7
  151. package/dist/docs/reference/http-api.md +25 -37
  152. package/dist/docs/reference/instructions.html +6 -6
  153. package/dist/docs/reference/instructions.md +1 -1
  154. package/dist/docs/reference/playground.html +5 -5
  155. package/dist/docs/reference/playground.md +14 -19
  156. package/dist/docs/reference/project-layout.html +9 -7
  157. package/dist/docs/reference/project-layout.md +7 -3
  158. package/dist/docs/reference/prompt.html +6 -6
  159. package/dist/docs/reference/prompt.md +1 -1
  160. package/dist/docs/reference/schedules.html +6 -6
  161. package/dist/docs/reference/schedules.md +1 -2
  162. package/dist/docs/reference/sessions.html +5 -12
  163. package/dist/docs/reference/sessions.md +8 -19
  164. package/dist/docs/reference/skills.html +8 -8
  165. package/dist/docs/reference/skills.md +3 -3
  166. package/dist/docs/reference/subagents.html +6 -6
  167. package/dist/docs/reference/subagents.md +2 -2
  168. package/dist/docs/reference/tools.html +8 -8
  169. package/dist/docs/reference/tools.md +30 -19
  170. package/dist/docs/scaffolding-agents.html +5 -5
  171. package/dist/docs/scaffolding-agents.md +4 -5
  172. package/dist/docs/storage.html +9 -9
  173. package/dist/docs/storage.md +37 -80
  174. package/dist/docs/templates/agentic-owners.html +7 -7
  175. package/dist/docs/templates/agentic-owners.md +2 -2
  176. package/dist/docs/templates/demo.html +4 -4
  177. package/dist/docs/templates/pr-autofixer.html +6 -6
  178. package/dist/docs/templates/pr-autofixer.md +7 -9
  179. package/dist/docs/templates/security-reviewer.html +5 -5
  180. package/dist/docs/templates/security-reviewer.md +2 -3
  181. package/dist/docs/templates/triage.html +4 -4
  182. package/dist/docs/troubleshooting.html +5 -5
  183. package/dist/docs/troubleshooting.md +8 -8
  184. package/dist/index.d.ts +1 -1
  185. package/dist/index.d.ts.map +1 -1
  186. package/dist/index.js +1 -1
  187. package/dist/internal/advertise-tools.d.ts +11 -0
  188. package/dist/internal/advertise-tools.d.ts.map +1 -1
  189. package/dist/internal/advertise-tools.js +47 -9
  190. package/dist/internal/authored-alias-hooks.d.ts +14 -11
  191. package/dist/internal/authored-alias-hooks.d.ts.map +1 -1
  192. package/dist/internal/authored-alias-hooks.js +14 -11
  193. package/dist/internal/authored-loaders.d.ts +7 -6
  194. package/dist/internal/authored-loaders.d.ts.map +1 -1
  195. package/dist/internal/authored-loaders.js +14 -10
  196. package/dist/internal/cli-deploy.d.ts +1 -1
  197. package/dist/internal/cli-deploy.js +5 -5
  198. package/dist/internal/cli-mcp-oauth.d.ts.map +1 -1
  199. package/dist/internal/cli-mcp-oauth.js +7 -4
  200. package/dist/internal/continuation-channel.d.ts +6 -3
  201. package/dist/internal/continuation-channel.d.ts.map +1 -1
  202. package/dist/internal/continuation-channel.js +44 -40
  203. package/dist/internal/continuation-identity.d.ts +17 -16
  204. package/dist/internal/continuation-identity.d.ts.map +1 -1
  205. package/dist/internal/continuation-identity.js +109 -36
  206. package/dist/internal/convert-automation/convert-workflow.d.ts.map +1 -1
  207. package/dist/internal/convert-automation/convert-workflow.js +26 -15
  208. package/dist/internal/convert-automation/slug.d.ts +0 -2
  209. package/dist/internal/convert-automation/slug.d.ts.map +1 -1
  210. package/dist/internal/convert-automation/slug.js +0 -8
  211. package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
  212. package/dist/internal/cursor/account-mcp.js +5 -1
  213. package/dist/internal/deploy-manifest.d.ts +2 -2
  214. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  215. package/dist/internal/deploy-manifest.js +4 -9
  216. package/dist/internal/discovery.d.ts.map +1 -1
  217. package/dist/internal/discovery.js +91 -13
  218. package/dist/internal/distribution.d.ts +4 -3
  219. package/dist/internal/distribution.d.ts.map +1 -1
  220. package/dist/internal/distribution.js +4 -3
  221. package/dist/internal/hosted-delivery-protocol.d.ts +38 -0
  222. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -0
  223. package/dist/internal/hosted-delivery-protocol.js +70 -0
  224. package/dist/internal/hosted-delivery.d.ts +35 -0
  225. package/dist/internal/hosted-delivery.d.ts.map +1 -0
  226. package/dist/internal/hosted-delivery.js +239 -0
  227. package/dist/internal/http-channel.d.ts.map +1 -1
  228. package/dist/internal/http-channel.js +1 -1
  229. package/dist/internal/mcp-endpoint.js +3 -3
  230. package/dist/internal/mcp-host.d.ts +8 -7
  231. package/dist/internal/mcp-host.d.ts.map +1 -1
  232. package/dist/internal/mcp-host.js +8 -7
  233. package/dist/internal/peer-connections.d.ts.map +1 -1
  234. package/dist/internal/peer-connections.js +5 -1
  235. package/dist/internal/playground/static.d.ts +0 -3
  236. package/dist/internal/playground/static.d.ts.map +1 -1
  237. package/dist/internal/resolved-connections.d.ts.map +1 -1
  238. package/dist/internal/resolved-connections.js +5 -7
  239. package/dist/internal/review-comments.d.ts +186 -63
  240. package/dist/internal/review-comments.d.ts.map +1 -1
  241. package/dist/internal/review-comments.js +350 -168
  242. package/dist/internal/server.d.ts.map +1 -1
  243. package/dist/internal/server.js +134 -175
  244. package/dist/internal/session-engine.d.ts +50 -10
  245. package/dist/internal/session-engine.d.ts.map +1 -1
  246. package/dist/internal/session-engine.js +221 -68
  247. package/dist/internal/shallow-clone.d.ts +8 -2
  248. package/dist/internal/shallow-clone.d.ts.map +1 -1
  249. package/dist/internal/shallow-clone.js +17 -10
  250. package/dist/internal/tool-catalog.d.ts +31 -0
  251. package/dist/internal/tool-catalog.d.ts.map +1 -0
  252. package/dist/internal/tool-catalog.js +67 -0
  253. package/dist/playground/assets/{index-DDvyC2z6.js → index-B3JCyigB.js} +2 -2
  254. package/dist/playground/index.html +1 -1
  255. package/dist/types.d.ts +81 -40
  256. package/dist/types.d.ts.map +1 -1
  257. package/dist/types.js +19 -0
  258. package/docs/README.md +0 -36
  259. package/docs/ab.md +7 -13
  260. package/docs/building-with-agents.md +5 -11
  261. package/docs/concepts.md +13 -17
  262. package/docs/deployment.md +9 -30
  263. package/docs/design/agsh.md +406 -0
  264. package/docs/evals.md +16 -37
  265. package/docs/guides/agent-to-agent.md +3 -3
  266. package/docs/guides/cloud-runtime.md +9 -25
  267. package/docs/guides/convert-automation.md +4 -4
  268. package/docs/guides/github.md +16 -28
  269. package/docs/guides/mcp-oauth.md +14 -22
  270. package/docs/guides/slack.md +14 -51
  271. package/docs/guides/webhooks.md +3 -3
  272. package/docs/hillclimbing.md +1 -1
  273. package/docs/quickstart.md +3 -4
  274. package/docs/reference/agent-config.md +10 -15
  275. package/docs/reference/channels.md +20 -31
  276. package/docs/reference/cli.md +29 -38
  277. package/docs/reference/connections.md +24 -25
  278. package/docs/reference/hooks.md +12 -17
  279. package/docs/reference/http-api.md +26 -38
  280. package/docs/reference/instructions.md +1 -1
  281. package/docs/reference/playground.md +14 -19
  282. package/docs/reference/project-layout.md +7 -3
  283. package/docs/reference/prompt.md +1 -1
  284. package/docs/reference/schedules.md +1 -2
  285. package/docs/reference/sessions.md +8 -19
  286. package/docs/reference/skills.md +3 -3
  287. package/docs/reference/subagents.md +2 -2
  288. package/docs/reference/tools.md +30 -19
  289. package/docs/scaffolding-agents.md +4 -5
  290. package/docs/storage.md +37 -80
  291. package/docs/templates/agentic-owners.md +2 -2
  292. package/docs/templates/pr-autofixer.md +7 -9
  293. package/docs/templates/security-reviewer.md +2 -3
  294. package/docs/troubleshooting.md +8 -8
  295. package/package.json +16 -2
  296. package/skills/create-agent/SKILL.md +6 -13
  297. package/skills/debug/SKILL.md +2 -4
  298. package/skills/evals/SKILL.md +1 -1
  299. package/skills/framework-map/SKILL.md +3 -2
  300. package/skills/mcp-auth/SKILL.md +10 -13
  301. package/skills/setup-slack/SKILL.md +21 -137
  302. package/src/channels/deployments/deployments-channel.ts +32 -2
  303. package/src/channels/deployments/types.ts +8 -0
  304. package/src/channels/github/github-channel.ts +71 -21
  305. package/src/channels/slack/attachments.ts +2 -2
  306. package/src/channels/slack/dispatch.ts +2 -16
  307. package/src/channels/slack/eval-directive.ts +8 -27
  308. package/src/channels/slack/index.ts +0 -6
  309. package/src/channels/slack/setup.ts +8 -15
  310. package/src/channels/slack/slack-channel.ts +14 -125
  311. package/src/channels/slack/types.ts +12 -96
  312. package/src/client.ts +23 -0
  313. package/src/connections.ts +20 -7
  314. package/src/continuation.ts +1 -1
  315. package/src/index.ts +2 -0
  316. package/src/internal/advertise-tools.ts +45 -7
  317. package/src/internal/authored-alias-hooks.ts +14 -11
  318. package/src/internal/authored-loaders.ts +14 -10
  319. package/src/internal/cli-deploy.ts +5 -5
  320. package/src/internal/cli-mcp-oauth.ts +6 -4
  321. package/src/internal/continuation-channel.ts +62 -45
  322. package/src/internal/continuation-identity.ts +123 -38
  323. package/src/internal/convert-automation/convert-workflow.ts +29 -17
  324. package/src/internal/convert-automation/slug.ts +0 -9
  325. package/src/internal/cursor/account-mcp.ts +4 -1
  326. package/src/internal/deploy-manifest.ts +5 -9
  327. package/src/internal/discovery.ts +107 -13
  328. package/src/internal/distribution.ts +4 -3
  329. package/src/internal/fixtures/units-server.ts +52 -0
  330. package/src/internal/hosted-delivery-protocol.ts +114 -0
  331. package/src/internal/hosted-delivery.ts +359 -0
  332. package/src/internal/http-channel.ts +0 -2
  333. package/src/internal/mcp-endpoint.ts +3 -3
  334. package/src/internal/mcp-host.ts +8 -7
  335. package/src/internal/peer-connections.ts +4 -1
  336. package/src/internal/playground/static.ts +1 -3
  337. package/src/internal/resolved-connections.ts +8 -10
  338. package/src/internal/review-comments.ts +542 -229
  339. package/src/internal/server.ts +180 -253
  340. package/src/internal/session-engine.ts +279 -70
  341. package/src/internal/shallow-clone.ts +30 -16
  342. package/src/internal/tool-catalog.ts +106 -0
  343. package/src/types.ts +99 -40
  344. package/templates/pr-autofixer/agent/channels/slack.ts +8 -2
  345. package/templates/triage/README.md +2 -1
  346. package/templates/triage/overlays/jira/agent/mcp-connections/tracker.ts +0 -1
  347. package/templates/triage/overlays/linear/agent/mcp-connections/tracker.ts +0 -1
  348. package/dist/channels/slack/cursor-account.d.ts +0 -87
  349. package/dist/channels/slack/cursor-account.d.ts.map +0 -1
  350. package/dist/channels/slack/cursor-account.js +0 -100
  351. package/dist/docs/assets/building-with-agents.md.DH8A_cHA.js +0 -13
  352. package/dist/docs/assets/chunks/@localSearchIndexroot.Dv-Q0XtU.js +0 -1
  353. package/dist/docs/assets/concepts.md.CRfU3bVg.js +0 -4
  354. package/dist/docs/assets/example-agents_approval-buddy.md.DNL83puR.js +0 -10
  355. package/dist/docs/assets/example-agents_approval-buddy.md.DNL83puR.lean.js +0 -1
  356. package/dist/docs/assets/example-agents_benny.md.C40vHRLc.js +0 -7
  357. package/dist/docs/assets/example-agents_benny.md.C40vHRLc.lean.js +0 -1
  358. package/dist/docs/assets/example-agents_bugbot.md.BRGMi9O2.js +0 -11
  359. package/dist/docs/assets/example-agents_bugbot.md.BRGMi9O2.lean.js +0 -1
  360. package/dist/docs/assets/example-agents_codebase-wiki.md.Dftj_tPp.js +0 -8
  361. package/dist/docs/assets/example-agents_codebase-wiki.md.Dftj_tPp.lean.js +0 -1
  362. package/dist/docs/assets/example-agents_codeowners-review.md.Bfta-lBU.js +0 -8
  363. package/dist/docs/assets/example-agents_codeowners-review.md.Bfta-lBU.lean.js +0 -1
  364. package/dist/docs/assets/example-agents_concierge.md.MrKpQndp.js +0 -23
  365. package/dist/docs/assets/example-agents_concierge.md.MrKpQndp.lean.js +0 -1
  366. package/dist/docs/assets/example-agents_fsd.md.ZWHWWZPE.js +0 -15
  367. package/dist/docs/assets/example-agents_fsd.md.ZWHWWZPE.lean.js +0 -1
  368. package/dist/docs/assets/example-agents_index.md.QZ8mhr6n.js +0 -2
  369. package/dist/docs/assets/example-agents_index.md.QZ8mhr6n.lean.js +0 -1
  370. package/dist/docs/assets/example-agents_knowledge-base.md.DqKqHQ9u.js +0 -11
  371. package/dist/docs/assets/example-agents_knowledge-base.md.DqKqHQ9u.lean.js +0 -1
  372. package/dist/docs/assets/example-agents_oncall.md.DK4XkYTd.js +0 -10
  373. package/dist/docs/assets/example-agents_oncall.md.DK4XkYTd.lean.js +0 -1
  374. package/dist/docs/assets/example-agents_security-reviewer.md.Bai6D0Ee.js +0 -19
  375. package/dist/docs/assets/example-agents_security-reviewer.md.Bai6D0Ee.lean.js +0 -1
  376. package/dist/docs/assets/example-agents_slack-agent.md.D7Kdj5BV.js +0 -5
  377. package/dist/docs/assets/example-agents_slack-agent.md.D7Kdj5BV.lean.js +0 -1
  378. package/dist/docs/assets/example-agents_weather-agent.md.lVEAbWFf.js +0 -25
  379. package/dist/docs/assets/example-agents_weather-agent.md.lVEAbWFf.lean.js +0 -1
  380. package/dist/docs/assets/guides_cloud-runtime.md.BSMLIBHr.js +0 -9
  381. package/dist/docs/assets/guides_cloud-runtime.md.BSMLIBHr.lean.js +0 -1
  382. package/dist/docs/assets/guides_slack.md.DiUmk_Oi.lean.js +0 -1
  383. package/dist/docs/assets/index.md.BAaMXLFd.js +0 -5
  384. package/dist/docs/assets/reference_hooks.md.B9FSgdDe.js +0 -14
  385. package/dist/docs/assets/reference_http-api.md.CSHVobzG.js +0 -11
  386. package/dist/docs/assets/reference_http-api.md.CSHVobzG.lean.js +0 -1
  387. package/dist/docs/assets/reference_playground.md.Dfb92yQf.js +0 -1
  388. package/dist/docs/assets/reference_playground.md.Dfb92yQf.lean.js +0 -1
  389. package/dist/docs/assets/reference_project-layout.md.CwkSbEWT.js +0 -17
  390. package/dist/docs/assets/reference_sessions.md.tUFzz98S.js +0 -8
  391. package/dist/docs/assets/scaffolding-agents.md.CRDDUtYJ.js +0 -1
  392. package/dist/docs/assets/troubleshooting.md.DYECCZiJ.js +0 -1
  393. package/dist/docs/example-agents/approval-buddy.html +0 -36
  394. package/dist/docs/example-agents/approval-buddy.md +0 -266
  395. package/dist/docs/example-agents/benny.html +0 -33
  396. package/dist/docs/example-agents/benny.md +0 -182
  397. package/dist/docs/example-agents/bugbot.html +0 -37
  398. package/dist/docs/example-agents/bugbot.md +0 -229
  399. package/dist/docs/example-agents/codebase-wiki.html +0 -34
  400. package/dist/docs/example-agents/codebase-wiki.md +0 -170
  401. package/dist/docs/example-agents/codeowners-review.html +0 -34
  402. package/dist/docs/example-agents/codeowners-review.md +0 -192
  403. package/dist/docs/example-agents/concierge.html +0 -49
  404. package/dist/docs/example-agents/concierge.md +0 -201
  405. package/dist/docs/example-agents/fsd.html +0 -41
  406. package/dist/docs/example-agents/fsd.md +0 -329
  407. package/dist/docs/example-agents/index.html +0 -28
  408. package/dist/docs/example-agents/index.md +0 -102
  409. package/dist/docs/example-agents/knowledge-base.html +0 -37
  410. package/dist/docs/example-agents/knowledge-base.md +0 -168
  411. package/dist/docs/example-agents/oncall.html +0 -36
  412. package/dist/docs/example-agents/oncall.md +0 -212
  413. package/dist/docs/example-agents/security-reviewer.html +0 -45
  414. package/dist/docs/example-agents/security-reviewer.md +0 -265
  415. package/dist/docs/example-agents/slack-agent.html +0 -31
  416. package/dist/docs/example-agents/slack-agent.md +0 -142
  417. package/dist/docs/example-agents/weather-agent.html +0 -51
  418. package/dist/docs/example-agents/weather-agent.md +0 -296
  419. package/dist/internal/cursor-slack-relay.d.ts +0 -96
  420. package/dist/internal/cursor-slack-relay.d.ts.map +0 -1
  421. package/dist/internal/cursor-slack-relay.js +0 -176
  422. package/docs/example-agents/approval-buddy.md +0 -271
  423. package/docs/example-agents/benny.md +0 -187
  424. package/docs/example-agents/bugbot.md +0 -234
  425. package/docs/example-agents/codebase-wiki.md +0 -175
  426. package/docs/example-agents/codeowners-review.md +0 -197
  427. package/docs/example-agents/concierge.md +0 -206
  428. package/docs/example-agents/fsd.md +0 -334
  429. package/docs/example-agents/index.md +0 -107
  430. package/docs/example-agents/knowledge-base.md +0 -173
  431. package/docs/example-agents/oncall.md +0 -217
  432. package/docs/example-agents/security-reviewer.md +0 -270
  433. package/docs/example-agents/slack-agent.md +0 -147
  434. package/docs/example-agents/weather-agent.md +0 -301
  435. package/src/channels/slack/cursor-account.ts +0 -202
  436. package/src/internal/cursor-slack-relay.ts +0 -249
  437. /package/dist/docs/assets/{guides_agent-to-agent.md.BCeVdJRJ.lean.js → guides_agent-to-agent.md.BDb0t1QV.lean.js} +0 -0
  438. /package/dist/docs/assets/{guides_convert-automation.md.D06eIzea.lean.js → guides_convert-automation.md.B4sjlodG.lean.js} +0 -0
  439. /package/dist/docs/assets/{guides_webhooks.md.BpnIdO0i.lean.js → guides_webhooks.md.DKdA43Qm.lean.js} +0 -0
  440. /package/dist/docs/assets/{hillclimbing.md.ywF3yDAd.lean.js → hillclimbing.md.DhESf3OO.lean.js} +0 -0
  441. /package/dist/docs/assets/{quickstart.md.DsrarzEg.lean.js → quickstart.md.Nj_LjW_a.lean.js} +0 -0
  442. /package/dist/docs/assets/{reference_agent-config.md.Bqylgw50.lean.js → reference_agent-config.md.Cp_x38Nl.lean.js} +0 -0
  443. /package/dist/docs/assets/{reference_project-layout.md.CwkSbEWT.lean.js → reference_project-layout.md.Bv4KOtlB.lean.js} +0 -0
  444. /package/dist/docs/assets/{reference_prompt.md.DZUMtLPD.lean.js → reference_prompt.md.DnaD5dNK.lean.js} +0 -0
  445. /package/dist/docs/assets/{reference_schedules.md.DNipebiG.lean.js → reference_schedules.md.DI_JrHgq.lean.js} +0 -0
  446. /package/dist/docs/assets/{reference_skills.md.B5ZEuHfG.lean.js → reference_skills.md.8son6Hjm.lean.js} +0 -0
  447. /package/dist/docs/assets/{reference_subagents.md.Xoav0AII.lean.js → reference_subagents.md.CfsIloPm.lean.js} +0 -0
  448. /package/dist/docs/assets/{templates_agentic-owners.md.DSJSIpWU.lean.js → templates_agentic-owners.md.DqtPdm6f.lean.js} +0 -0
@@ -44,7 +44,7 @@ import { createHostFilesApi } from "./host-files.js";
44
44
  import { createHostKvApi } from "./host-kv.js";
45
45
  import { createHostOtelApi } from "./host-otel.js";
46
46
  import { createHostPlatforms, createHostSlackClient, } from "./host-platforms.js";
47
- import { formatContinuationToken, newContinuationKey, newSessionId, newToolCallId, } from "./ids.js";
47
+ import { formatContinuationToken, newContinuationKey, newSessionId, newToolCallId, parseContinuationToken, } from "./ids.js";
48
48
  import { validateToolInput } from "./json-schema.js";
49
49
  import { McpHost } from "./mcp-host.js";
50
50
  import { shouldStartProcessMemoryTelemetry, startProcessMemoryTelemetry, } from "./process-memory-telemetry.js";
@@ -54,7 +54,7 @@ import { sessionExternalLinks } from "./session-links.js";
54
54
  import { SessionStore } from "./session-store.js";
55
55
  import { syncSkillsToStore } from "./skills-sync.js";
56
56
  import { StorageCoordinator } from "./storage-coordinator.js";
57
- import { decideToolCall } from "./tool-policy.js";
57
+ import { decideToolCall, resolveEffect } from "./tool-policy.js";
58
58
  import { normalizeToolResult, toolCallErrorMessage } from "./tool-result.js";
59
59
  import { estimateTurnCostFromApi, roundCostUsd, } from "./turn-cost.js";
60
60
  import { TurnGovernor } from "./turn-governor.js";
@@ -90,6 +90,24 @@ export class ToolNotDirectlyCallableError extends Error {
90
90
  this.name = "ToolNotDirectlyCallableError";
91
91
  }
92
92
  }
93
+ export class InvalidContinuationTokenError extends Error {
94
+ constructor(detail) {
95
+ super(`Invalid continuation token: ${detail}`);
96
+ this.name = "InvalidContinuationTokenError";
97
+ }
98
+ }
99
+ /**
100
+ * A session-bound direct call whose harness cwd cannot be materialized and
101
+ * whose effect is not read: a write tool may rely on ctx.workspaceDir being
102
+ * the real session workspace, so it fails typed instead of silently running
103
+ * in a scratch directory.
104
+ */
105
+ export class WorkspaceUnavailableError extends Error {
106
+ constructor(toolName, cause) {
107
+ super(`Session workspace unavailable for tool "${toolName}": ${cause instanceof Error ? cause.message : String(cause)}`);
108
+ this.name = "WorkspaceUnavailableError";
109
+ }
110
+ }
93
111
  export class ToolInputError extends Error {
94
112
  constructor(args) {
95
113
  super(`Invalid input for tool "${args.toolName}": ${args.detail}`);
@@ -116,7 +134,7 @@ export class ApprovalInterruptedError extends Error {
116
134
  }
117
135
  export class SessionEngine {
118
136
  constructor(options) {
119
- var _a, _b, _c, _d;
137
+ var _a, _b, _c, _d, _e;
120
138
  /** In-flight lazy restores, deduped per channel + continuation key. */
121
139
  this.restoreInFlight = new Map();
122
140
  this.channelsById = new Map();
@@ -215,8 +233,11 @@ export class SessionEngine {
215
233
  // Peer and Cursor-account transports are symbolic until the serve host
216
234
  // resolves them; the host-side MCP registry starts with the concrete
217
235
  // connections and gains the rest via setResolvedConnections.
218
- this.mcpHost = new McpHost(options.project.agent.connections.filter((connection) => !isSymbolicConnectionTransport(connection.transport)));
219
- const basePlatforms = (_d = options.platforms) !== null && _d !== void 0 ? _d : createHostPlatforms();
236
+ this.mcpHost = new McpHost([
237
+ ...options.project.agent.connections,
238
+ ...((_d = options.project.agent.hostConnections) !== null && _d !== void 0 ? _d : []),
239
+ ].filter((connection) => !isSymbolicConnectionTransport(connection.transport)));
240
+ const basePlatforms = (_e = options.platforms) !== null && _e !== void 0 ? _e : createHostPlatforms();
220
241
  const slackBinding = resolveDedicatedSlackHostBinding(options.project.channels);
221
242
  this.platforms =
222
243
  slackBinding === undefined
@@ -476,7 +497,7 @@ export class SessionEngine {
476
497
  send(channelId_1, message_1) {
477
498
  return __awaiter(this, arguments, void 0, function* (channelId, message, options = {}) {
478
499
  var _a;
479
- var _b, _c, _d, _e, _f;
500
+ var _b, _c, _d, _e, _f, _g;
480
501
  const identity = channelId === HTTP_CHANNEL_ID
481
502
  ? httpContinuationIdentity(this.project.httpChannel)
482
503
  : channelContinuationIdentity(this.channelsById.get(channelId));
@@ -502,6 +523,10 @@ export class SessionEngine {
502
523
  existing = yield this.restoreSessionByContinuation(channelId, sendOptions.continuationToken);
503
524
  }
504
525
  if (existing !== undefined) {
526
+ if (sendOptions.hostedSessionId !== undefined &&
527
+ existing.sessionId !== sendOptions.hostedSessionId) {
528
+ throw new V2EngineError(`v2: continuation belongs to session ${existing.sessionId}, not ${sendOptions.hostedSessionId}`);
529
+ }
505
530
  if (!samePrincipal(existing.auth, auth)) {
506
531
  throw new SessionAuthError(existing.sessionId);
507
532
  }
@@ -537,10 +562,16 @@ export class SessionEngine {
537
562
  : { sourceTs: sendOptions.coalesceSourceTs })));
538
563
  return this.channelSession(record.sessionId, record, false, coalesced, since);
539
564
  }
565
+ if (sendOptions.hostedSessionId !== undefined) {
566
+ const collision = yield this.getOrRestoreSession(sendOptions.hostedSessionId);
567
+ if (collision !== undefined) {
568
+ throw new V2EngineError(`v2: hosted session id ${sendOptions.hostedSessionId} already belongs to another mailbox`);
569
+ }
570
+ }
540
571
  const now = new Date().toISOString();
541
572
  const channelState = this.initialChannelState(channelId, sendOptions.state);
542
573
  const purpose = sendOptions.purpose === "eval" ? "eval" : "live";
543
- let record = Object.assign(Object.assign({ sessionId: newSessionId(), channelId, mode: (_d = sendOptions.mode) !== null && _d !== void 0 ? _d : "chat", purpose }, (sendOptions.dryRun === true ? { dryRun: true } : {})), { continuationKey: (_e = sendOptions.continuationToken) !== null && _e !== void 0 ? _e : newContinuationKey(), auth, title: sendOptions.title, channelState, workspaceOverride: sendOptions.workspaceDir, pendingWorkspaceFiles: sendOptions.workspaceFiles, pendingImages: sendOptions.images, cloudOverride: sendOptions.cloud, sdkAgentId: sendOptions.sdkAgentId, turnCount: 0, createdAt: now, updatedAt: now });
574
+ let record = Object.assign(Object.assign({ sessionId: (_d = sendOptions.hostedSessionId) !== null && _d !== void 0 ? _d : newSessionId(), channelId, mode: (_e = sendOptions.mode) !== null && _e !== void 0 ? _e : "chat", purpose }, (sendOptions.dryRun === true ? { dryRun: true } : {})), { continuationKey: (_f = sendOptions.continuationToken) !== null && _f !== void 0 ? _f : newContinuationKey(), auth, title: sendOptions.title, channelState, workspaceOverride: sendOptions.workspaceDir, pendingWorkspaceFiles: sendOptions.workspaceFiles, pendingImages: sendOptions.images, cloudOverride: sendOptions.cloud, sdkAgentId: sendOptions.sdkAgentId, turnCount: 0, createdAt: now, updatedAt: now });
544
575
  yield this.sessions.save(record);
545
576
  (_a = this.storage) === null || _a === void 0 ? void 0 : _a.sessionRecord(record);
546
577
  yield this.appendEvent(record.sessionId, {
@@ -549,7 +580,7 @@ export class SessionEngine {
549
580
  });
550
581
  record = yield this.enrollABs(record);
551
582
  const since = (yield this.logs.get(record.sessionId)).count;
552
- yield this.startTurn(record.sessionId, message, Object.assign({ admission: (_f = sendOptions.admission) !== null && _f !== void 0 ? _f : "preempt" }, (sendOptions.coalesceSourceTs === undefined
583
+ yield this.startTurn(record.sessionId, message, Object.assign({ admission: (_g = sendOptions.admission) !== null && _g !== void 0 ? _g : "preempt" }, (sendOptions.coalesceSourceTs === undefined
553
584
  ? {}
554
585
  : { sourceTs: sendOptions.coalesceSourceTs })));
555
586
  return this.channelSession(record.sessionId, record, true, false, since);
@@ -1529,23 +1560,17 @@ export class SessionEngine {
1529
1560
  * Connection names a cloud turn can only reach through the host connection
1530
1561
  * bridge on the tool MCP endpoint: filtered account connections without a
1531
1562
  * public bridge URL, and host-OAuth connections whose tokens live on this
1532
- * host. `hostOnly` names are never bridged — that flag means the model
1533
- * must not see the connection at all, on any runtime.
1563
+ * host.
1534
1564
  */
1535
1565
  cloudBridgeableConnectionNames() {
1536
- const hostOnlyNames = new Set(this.project.agent.connections
1537
- .filter((connection) => connection.hostOnly === true)
1538
- .map((connection) => connection.name));
1539
1566
  const names = [];
1540
1567
  for (const connection of this.project.agent.connections) {
1541
- if (!hostOnlyNames.has(connection.name) &&
1542
- isHostOauthConnectionTransport(connection.transport)) {
1568
+ if (isHostOauthConnectionTransport(connection.transport)) {
1543
1569
  names.push(connection.name);
1544
1570
  }
1545
1571
  }
1546
1572
  for (const resolved of this.resolvedConnections) {
1547
- if (!hostOnlyNames.has(resolved.name) &&
1548
- resolved.accountServersFilter !== undefined &&
1573
+ if (resolved.accountServersFilter !== undefined &&
1549
1574
  resolved.cloudUrl === undefined) {
1550
1575
  names.push(resolved.name);
1551
1576
  }
@@ -1555,8 +1580,7 @@ export class SessionEngine {
1555
1580
  /**
1556
1581
  * True when cloud turns reach `name` through the host connection bridge —
1557
1582
  * the gate the tool MCP endpoint applies before forwarding a bridge
1558
- * request to `host.mcp`, so `hostOnly` connections (and arbitrary names)
1559
- * stay unreachable from a VM.
1583
+ * request to `host.mcp`, so arbitrary names stay unreachable from a VM.
1560
1584
  */
1561
1585
  isCloudBridgedConnection(name) {
1562
1586
  if (this.cloudServerToolsConnection === undefined) {
@@ -1581,24 +1605,26 @@ export class SessionEngine {
1581
1605
  return Object.assign(Object.assign({}, connection), { url: url.toString() });
1582
1606
  }
1583
1607
  /**
1584
- * Authored + resolved MCP servers for a turn. Skips `hostOnly`. On cloud
1585
- * turns, connections whose credential lives on this host filtered
1586
- * account connections without a public bridge URL, host-OAuth servers
1587
- * mount as host connection bridges over the tool MCP endpoint instead of
1608
+ * Authored + resolved MCP servers for a turn. Skips advertised
1609
+ * connections (those surface as named server tools). On cloud turns,
1610
+ * connections whose credential lives on this host filtered account
1611
+ * connections without a public bridge URL, host-OAuth servers mount
1612
+ * as host connection bridges over the tool MCP endpoint instead of
1588
1613
  * being omitted or failing the turn closed.
1589
1614
  */
1590
1615
  buildMcpServers(runtime, sessionId, sessionAuth) {
1616
+ var _a;
1591
1617
  // The Grok Bot harness manages its own MCP surface; authored
1592
1618
  // connections are refused at discovery, so there is nothing to mount.
1593
1619
  if (runtime === "grokbot") {
1594
1620
  return {};
1595
1621
  }
1596
1622
  // Advertised connections surface as named server tools instead of an
1597
- // attached MCP server (each tool appears exactly once), so they are
1598
- // excluded here alongside hostOnly.
1599
- const hostOnlyNames = new Set(this.project.agent.connections
1600
- .filter((connection) => connection.hostOnly === true || connection.advertiseTools === true)
1623
+ // attached MCP server (each tool appears exactly once).
1624
+ const advertisedNames = new Set(this.project.agent.connections
1625
+ .filter((connection) => connection.advertiseTools === true)
1601
1626
  .map((connection) => connection.name));
1627
+ const hostConnectionNames = new Set(((_a = this.project.agent.hostConnections) !== null && _a !== void 0 ? _a : []).map((connection) => connection.name));
1602
1628
  const bridgedNames = new Set(runtime === "cloud" &&
1603
1629
  sessionId !== undefined &&
1604
1630
  this.cloudServerToolsConnection !== undefined &&
@@ -1607,7 +1633,8 @@ export class SessionEngine {
1607
1633
  : []);
1608
1634
  assertCloudCanHonorAccountServersFilters({
1609
1635
  runtime,
1610
- resolvedConnections: this.resolvedConnections.filter((resolved) => !hostOnlyNames.has(resolved.name)),
1636
+ resolvedConnections: this.resolvedConnections.filter((resolved) => !advertisedNames.has(resolved.name) &&
1637
+ !hostConnectionNames.has(resolved.name)),
1611
1638
  bridgedNames,
1612
1639
  });
1613
1640
  const bridgeTransport = (name) => sessionId === undefined || !bridgedNames.has(name)
@@ -1615,7 +1642,8 @@ export class SessionEngine {
1615
1642
  : this.cloudBridgeTransport(sessionId, name);
1616
1643
  const servers = {};
1617
1644
  for (const connection of this.project.agent.connections) {
1618
- if (hostOnlyNames.has(connection.name)) {
1645
+ if (advertisedNames.has(connection.name) ||
1646
+ hostConnectionNames.has(connection.name)) {
1619
1647
  continue;
1620
1648
  }
1621
1649
  if (isSymbolicConnectionTransport(connection.transport)) {
@@ -1651,7 +1679,8 @@ export class SessionEngine {
1651
1679
  servers[connection.name] = connection.transport;
1652
1680
  }
1653
1681
  for (const resolved of this.resolvedConnections) {
1654
- if (hostOnlyNames.has(resolved.name)) {
1682
+ if (advertisedNames.has(resolved.name) ||
1683
+ hostConnectionNames.has(resolved.name)) {
1655
1684
  continue;
1656
1685
  }
1657
1686
  const url = runtime === "cloud" ? resolved.cloudUrl : resolved.localUrl;
@@ -1688,14 +1717,12 @@ export class SessionEngine {
1688
1717
  }
1689
1718
  /**
1690
1719
  * True when a connection with per-session `auth` attaches to the model
1691
- * (not `hostOnly`, not advertised). These turns set
1720
+ * (not advertised). These turns set
1692
1721
  * {@link RunnerTurnRequest.perSendMcpServers} so the evaluated headers
1693
1722
  * ride every send instead of being pinned on the cached agent handle.
1694
1723
  */
1695
1724
  hasAttachedAuthedConnections() {
1696
- return this.project.agent.connections.some((connection) => connection.auth !== undefined &&
1697
- connection.hostOnly !== true &&
1698
- connection.advertiseTools !== true);
1725
+ return this.project.agent.connections.some((connection) => connection.auth !== undefined && connection.advertiseTools !== true);
1699
1726
  }
1700
1727
  /**
1701
1728
  * Evaluate per-session connection auth (`defineConnection({ auth })`)
@@ -1706,9 +1733,7 @@ export class SessionEngine {
1706
1733
  */
1707
1734
  evaluateConnectionAuth(record) {
1708
1735
  return __awaiter(this, void 0, void 0, function* () {
1709
- const authed = this.project.agent.connections.filter((connection) => connection.auth !== undefined &&
1710
- connection.hostOnly !== true &&
1711
- connection.advertiseTools !== true);
1736
+ const authed = this.project.agent.connections.filter((connection) => connection.auth !== undefined && connection.advertiseTools !== true);
1712
1737
  if (authed.length === 0) {
1713
1738
  return undefined;
1714
1739
  }
@@ -2011,61 +2036,184 @@ export class SessionEngine {
2011
2036
  * with the same `{ content, isError }` envelope the model would see, not
2012
2037
  * an exception.
2013
2038
  */
2014
- callTool(toolName_1) {
2015
- return __awaiter(this, arguments, void 0, function* (toolName, input = {}, options = {}) {
2016
- var _a;
2017
- const tool = this.project.agent.tools.find((t) => t.name === toolName);
2018
- if (tool === undefined) {
2019
- throw new UnknownToolError(toolName, this.project.agent.tools
2020
- .filter((t) => t.execution === "server")
2021
- .map((t) => t.name));
2022
- }
2023
- const execute = tool.definition.execute;
2024
- if (tool.execution !== "server" || typeof execute !== "function") {
2025
- throw new ToolNotDirectlyCallableError(toolName);
2026
- }
2027
- const validation = validateToolInput(tool.definition.inputSchema, input);
2028
- if (!validation.ok) {
2029
- throw new ToolInputError({ toolName, detail: validation.message });
2039
+ /**
2040
+ * The session identity a direct call (or catalog listing) runs under:
2041
+ * an explicit sessionId, a continuation token resolved to a live (or
2042
+ * restorable) session with the same owner/busy checks a sessionId call
2043
+ * gets, or when neither maps to a session — a synthetic identity
2044
+ * carrying the token's channel id and continuation key so binding
2045
+ * resolvers (e.g. VFS mounts) can still serve the call.
2046
+ */
2047
+ resolveDirectCallIdentity(callId, options) {
2048
+ return __awaiter(this, void 0, void 0, function* () {
2049
+ var _a, _b, _c;
2050
+ if (options.sessionId !== undefined &&
2051
+ options.continuationToken !== undefined) {
2052
+ throw new InvalidContinuationTokenError("mutually exclusive with sessionId — a real session already carries its own continuation key");
2030
2053
  }
2031
- const callId = newToolCallId(toolName);
2032
2054
  const auth = (_a = options.auth) !== null && _a !== void 0 ? _a : null;
2033
2055
  let record;
2034
- let session;
2035
- let workspaceDir;
2036
- let scratchDir;
2056
+ let continuation = null;
2037
2057
  if (options.sessionId !== undefined) {
2038
2058
  record = yield this.sessions.get(options.sessionId);
2039
2059
  if (record === undefined) {
2040
2060
  throw new UnknownSessionError(options.sessionId);
2041
2061
  }
2062
+ }
2063
+ else if (options.continuationToken !== undefined) {
2064
+ continuation = parseContinuationToken(options.continuationToken);
2065
+ if (continuation === null) {
2066
+ throw new InvalidContinuationTokenError(`expected "<channelId>:<key>" (as /v1/sessions lists it), got "${options.continuationToken}"`);
2067
+ }
2068
+ // A token that maps to a live (or restorable) session takes the
2069
+ // session path: same owner check, same turn serialization, same
2070
+ // event recording as an explicit sessionId. Skipping those just
2071
+ // because the caller addressed the session by token would fail open.
2072
+ record = (_b = (yield this.sessions.findByContinuation(continuation.channelId, continuation.key))) !== null && _b !== void 0 ? _b : (yield this.restoreSessionByContinuation(continuation.channelId, continuation.key));
2073
+ if (record !== undefined && !samePrincipal(record.auth, auth)) {
2074
+ throw new SessionAuthError(record.sessionId);
2075
+ }
2076
+ }
2077
+ if (record !== undefined) {
2042
2078
  // Direct calls respect the same serialization as follow-up sends: a
2043
2079
  // running model turn owns the session workspace and event stream.
2044
2080
  if (this.activeTurns.has(record.sessionId) ||
2045
2081
  this.pendingTurns.has(record.sessionId)) {
2046
2082
  throw new SessionBusyError(record.sessionId);
2047
2083
  }
2048
- session = this.sessionInfo(record);
2049
- workspaceDir = this.harnessCwd(record);
2084
+ return {
2085
+ record,
2086
+ session: this.sessionInfo(record),
2087
+ workspaceDir: this.harnessCwd(record),
2088
+ scratchDir: undefined,
2089
+ };
2050
2090
  }
2051
- else {
2052
- session = {
2091
+ // No session behind the token (or no token at all): a synthetic
2092
+ // session carries the token's channel id and key, so binding resolvers
2093
+ // keyed on the continuation key (e.g. VFS mounts) can serve the call
2094
+ // with no live session. The workspace stays scratch and nothing is
2095
+ // recorded on a session event stream.
2096
+ const scratchDir = join(this.stateRoot, "tool-calls", callId);
2097
+ return {
2098
+ record: undefined,
2099
+ session: {
2053
2100
  id: callId,
2054
- channelId: DIRECT_TOOL_CALL_CHANNEL_ID,
2101
+ channelId: (_c = continuation === null || continuation === void 0 ? void 0 : continuation.channelId) !== null && _c !== void 0 ? _c : DIRECT_TOOL_CALL_CHANNEL_ID,
2055
2102
  mode: "task",
2103
+ continuationKey: continuation === null || continuation === void 0 ? void 0 : continuation.key,
2056
2104
  auth,
2057
- };
2105
+ },
2106
+ workspaceDir: scratchDir,
2107
+ scratchDir,
2108
+ };
2109
+ });
2110
+ }
2111
+ /**
2112
+ * The live tool catalog for one session identity: authored server tools
2113
+ * plus the advertised passthroughs a turn under the same identity would
2114
+ * see, under their model-facing names. A connection whose listing fails
2115
+ * is skipped and reported in `connectionErrors` — the inspection surface
2116
+ * degrades legibly instead of hiding every other tool behind one broken
2117
+ * connector.
2118
+ */
2119
+ listCatalogTools() {
2120
+ return __awaiter(this, arguments, void 0, function* (options = {}) {
2121
+ const { session } = yield this.resolveDirectCallIdentity(newToolCallId("catalog"), options);
2122
+ const connectionErrors = [];
2123
+ const advertised = yield resolveAdvertisedTools({
2124
+ agent: this.project.agent,
2125
+ session,
2126
+ hostMcp: this.mcpHost,
2127
+ onConnectionError: (connection, error) => {
2128
+ connectionErrors.push({
2129
+ connection,
2130
+ message: error instanceof Error ? error.message : String(error),
2131
+ });
2132
+ },
2133
+ });
2134
+ return {
2135
+ tools: [...this.project.agent.tools, ...advertised],
2136
+ connectionErrors,
2137
+ };
2138
+ });
2139
+ }
2140
+ callTool(toolName_1) {
2141
+ return __awaiter(this, arguments, void 0, function* (toolName, input = {}, options = {}) {
2142
+ const callId = newToolCallId(toolName);
2143
+ // Identity resolves before the tool lookup: advertised connection tools
2144
+ // only exist relative to a session (per-session auth), so finding them
2145
+ // needs the same identity the call runs under.
2146
+ const identity = yield this.resolveDirectCallIdentity(callId, options);
2147
+ const record = identity.record;
2148
+ const session = identity.session;
2149
+ let workspaceDir = identity.workspaceDir;
2150
+ let scratchDir = identity.scratchDir;
2151
+ let tool = this.project.agent.tools.find((t) => t.name === toolName);
2152
+ if (tool === undefined &&
2153
+ this.project.agent.connections.some((c) => c.advertiseTools === true)) {
2154
+ // Advertised passthroughs are ordinary server tools in the session's
2155
+ // namespace; resolve the live listing so direct calls address them by
2156
+ // the same model-facing name a turn would. A listing failure fails
2157
+ // the call closed, like it fails a turn.
2158
+ const advertised = yield resolveAdvertisedTools({
2159
+ agent: this.project.agent,
2160
+ session,
2161
+ hostMcp: this.mcpHost,
2162
+ });
2163
+ tool = advertised.find((t) => t.name === toolName);
2164
+ }
2165
+ if (tool === undefined) {
2166
+ throw new UnknownToolError(toolName, this.project.agent.tools
2167
+ .filter((t) => t.execution === "server")
2168
+ .map((t) => t.name));
2169
+ }
2170
+ const execute = tool.definition.execute;
2171
+ if (tool.execution !== "server" || typeof execute !== "function") {
2172
+ throw new ToolNotDirectlyCallableError(toolName);
2173
+ }
2174
+ const validation = validateToolInput(tool.definition.inputSchema, input);
2175
+ if (!validation.ok) {
2176
+ throw new ToolInputError({ toolName, detail: validation.message });
2177
+ }
2178
+ let workspaceUnavailable = false;
2179
+ try {
2180
+ yield mkdir(workspaceDir, { recursive: true });
2181
+ }
2182
+ catch (error) {
2183
+ if (record === undefined) {
2184
+ throw error;
2185
+ }
2186
+ // A session's harness cwd can be a path the serving process cannot
2187
+ // create (e.g. an absolute `local.cwd` like /repo on a hosted pod
2188
+ // where the sandboxed harness would have made it). Read-effect calls
2189
+ // fall back to a scratch workspace instead of failing: tools that
2190
+ // resolve their state from the session identity (VFS mounts) never
2191
+ // touch ctx.workspaceDir. Advertised passthroughs are relocatable by
2192
+ // construction: their execute body forwards to the connection and
2193
+ // never reads the workspace. A write (or undeclared, which resolves
2194
+ // to write) authored tool may rely on ctx.workspaceDir being the
2195
+ // real session workspace, so silently relocating it is not safe —
2196
+ // fail typed instead.
2197
+ const relocatable = tool.advertised === true ||
2198
+ resolveEffect(tool.definition.effect, validation.value) === "read";
2199
+ if (!relocatable) {
2200
+ throw new WorkspaceUnavailableError(toolName, error);
2201
+ }
2202
+ this.logger(`[session] tool ${toolName} workspace unavailable (direct ${callId}); using scratch: ${error instanceof Error ? error.message : String(error)}`);
2058
2203
  scratchDir = join(this.stateRoot, "tool-calls", callId);
2059
2204
  workspaceDir = scratchDir;
2205
+ workspaceUnavailable = true;
2206
+ yield mkdir(workspaceDir, { recursive: true });
2060
2207
  }
2061
- yield mkdir(workspaceDir, { recursive: true });
2062
2208
  // Match what a model turn would see: session workspaces get the same
2063
2209
  // scaffold as executeTurn (seeds only before the first turn); scratch
2064
2210
  // workspaces are materialized fresh.
2065
2211
  yield materializeWorkspace({
2066
2212
  agent: this.project.agent,
2067
- workspaceDir: record === undefined ? workspaceDir : this.scaffoldDir(record),
2068
- seed: record === undefined || record.turnCount === 0,
2213
+ workspaceDir: record === undefined || workspaceUnavailable
2214
+ ? workspaceDir
2215
+ : this.scaffoldDir(record),
2216
+ seed: record === undefined || workspaceUnavailable || record.turnCount === 0,
2069
2217
  stateRoot: this.stateRoot,
2070
2218
  });
2071
2219
  // A per-call turnId keeps these events visible in trajectories (which
@@ -2162,11 +2310,16 @@ export class SessionEngine {
2162
2310
  });
2163
2311
  }
2164
2312
  const errorMessage = isError ? toolCallErrorMessage(result) : undefined;
2165
- return Object.assign(Object.assign({ toolName,
2313
+ return {
2314
+ toolName,
2166
2315
  callId,
2167
2316
  isError,
2168
2317
  result,
2169
- durationMs }, (errorMessage === undefined ? {} : { errorMessage })), (record === undefined ? {} : { sessionId: record.sessionId }));
2318
+ durationMs,
2319
+ errorMessage,
2320
+ sessionId: record === null || record === void 0 ? void 0 : record.sessionId,
2321
+ scratchWorkspace: workspaceUnavailable ? true : undefined,
2322
+ };
2170
2323
  });
2171
2324
  }
2172
2325
  /**
@@ -90,8 +90,14 @@ export type CommitRangeDiff = {
90
90
  export declare function tryDiffCommitRange(args: {
91
91
  /** Existing checkout to run git in (see {@link createShallowPrCheckout}). */
92
92
  checkoutDir: string;
93
- /** The checkout's clone target; supplies the remote's ref + auth conventions. */
94
- target: ScmCloneTarget;
93
+ /**
94
+ * The checkout's clone target; supplies the remote's ref + auth
95
+ * conventions. Omit for SCMs without a clone target (e.g. Origin, where
96
+ * the host checkout is the reviewed repo): the diff then relies on
97
+ * commits already present locally, plus one uncredentialed fetch-by-SHA
98
+ * through the checkout's own remote.
99
+ */
100
+ target?: ScmCloneTarget | undefined;
95
101
  from: string;
96
102
  to: string;
97
103
  /** Restrict the diff to one path when set. */
@@ -1 +1 @@
1
- {"version":3,"file":"shallow-clone.d.ts","sourceRoot":"","sources":["../../src/internal/shallow-clone.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"shallow-clone.d.ts","sourceRoot":"","sources":["../../src/internal/shallow-clone.ts"],"names":[],"mappings":"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"}
@@ -86,7 +86,9 @@ export function tryDiffCommitRange(args) {
86
86
  reason: "Could not compute a reliable diff because a commit SHA was not a full 40-character SHA.",
87
87
  };
88
88
  }
89
- const credential = cloneCredential(args.target, (_a = args.auth) !== null && _a !== void 0 ? _a : defaultCloneAuth(args.target));
89
+ const credential = args.target === undefined
90
+ ? undefined
91
+ : cloneCredential(args.target, (_a = args.auth) !== null && _a !== void 0 ? _a : defaultCloneAuth(args.target));
90
92
  for (const sha of [args.from, args.to]) {
91
93
  if (!(yield ensureCommitFetched(args.checkoutDir, sha, args.target, credential))) {
92
94
  return {
@@ -130,15 +132,20 @@ function ensureCommitFetched(checkoutDir, sha, target, credential) {
130
132
  const attempts = [
131
133
  [...FETCH_ARGS, sha],
132
134
  // Deeper history on the PR head ref: the older end of an inter-run range
133
- // is usually an ancestor of the tip rather than the tip itself.
134
- [
135
- "fetch",
136
- "--depth=200",
137
- "--no-tags",
138
- "--quiet",
139
- "origin",
140
- target.prHeadRef,
141
- ],
135
+ // is usually an ancestor of the tip rather than the tip itself. Only
136
+ // possible when the clone target (and so the PR head ref) is known.
137
+ ...(target === undefined
138
+ ? []
139
+ : [
140
+ [
141
+ "fetch",
142
+ "--depth=200",
143
+ "--no-tags",
144
+ "--quiet",
145
+ "origin",
146
+ target.prHeadRef,
147
+ ],
148
+ ]),
142
149
  ];
143
150
  for (const attempt of attempts) {
144
151
  try {
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Projections for the live tool catalog (`GET /v1/tools` and
3
+ * `GET /v1/tools/:name`): the session's tool namespace exactly as a turn
4
+ * would assemble it — authored server tools plus advertised MCP
5
+ * passthroughs — under model-facing names.
6
+ *
7
+ * Titles are curated data, never derived from descriptions: advertised
8
+ * tools inherit the upstream server's MCP `annotations.title` (bounded at
9
+ * listing time), and the well-known non-MCP tool names carry a hardcoded
10
+ * title here so every deployment shows the same display names.
11
+ */
12
+ import type { DiscoveredTool, JsonSchemaObject, ToolEffect, ToolExecution } from "../types.js";
13
+ /** Light listing entry: identifiers and curated display data only. */
14
+ export interface CatalogListEntry {
15
+ name: string;
16
+ title?: string;
17
+ /** Connection name for advertised MCP tools; absent for authored tools. */
18
+ source?: string;
19
+ }
20
+ /** Full description behind `GET /v1/tools/:name`. */
21
+ export interface CatalogDetailEntry extends CatalogListEntry {
22
+ description: string;
23
+ execution: ToolExecution;
24
+ needsApproval: boolean;
25
+ effect?: ToolEffect | "dynamic";
26
+ inputSchema: JsonSchemaObject;
27
+ outputSchema?: JsonSchemaObject;
28
+ }
29
+ export declare function catalogListEntry(tool: DiscoveredTool): CatalogListEntry;
30
+ export declare function catalogDetailEntry(tool: DiscoveredTool): CatalogDetailEntry;
31
+ //# sourceMappingURL=tool-catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-catalog.d.ts","sourceRoot":"","sources":["../../src/internal/tool-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,aAAa,EACd,MAAM,aAAa,CAAC;AAoDrB,sEAAsE;AACtE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qDAAqD;AACrD,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,aAAa,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACjC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,gBAAgB,CAMvE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,cAAc,GAAG,kBAAkB,CAU3E"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Projections for the live tool catalog (`GET /v1/tools` and
3
+ * `GET /v1/tools/:name`): the session's tool namespace exactly as a turn
4
+ * would assemble it — authored server tools plus advertised MCP
5
+ * passthroughs — under model-facing names.
6
+ *
7
+ * Titles are curated data, never derived from descriptions: advertised
8
+ * tools inherit the upstream server's MCP `annotations.title` (bounded at
9
+ * listing time), and the well-known non-MCP tool names carry a hardcoded
10
+ * title here so every deployment shows the same display names.
11
+ */
12
+ /**
13
+ * Display names for the well-known tool names that do not come from MCP
14
+ * (authored tools have no title field; adding one to `defineTool` for a
15
+ * presentation concern is not worth the authoring surface).
16
+ */
17
+ const WELL_KNOWN_TOOL_TITLES = {
18
+ diff: "Show change diffs",
19
+ glob: "Find files by pattern",
20
+ grep: "Search file contents",
21
+ ls: "List a directory",
22
+ read: "Read a file",
23
+ search: "Search with a typed query",
24
+ write: "Write a file",
25
+ };
26
+ function catalogTitle(tool) {
27
+ var _a;
28
+ if (tool.advertised === true) {
29
+ return (_a = tool.annotations) === null || _a === void 0 ? void 0 : _a.title;
30
+ }
31
+ return WELL_KNOWN_TOOL_TITLES[tool.name];
32
+ }
33
+ /**
34
+ * Sand connector identifiers scope the connector name by owner
35
+ * (`dashboard-team-<id>-Buildkite`, `dashboard-<Name>`, `user-<Name>`);
36
+ * the suffix is the human-meaningful name.
37
+ */
38
+ const CONNECTOR_SCOPE_PREFIX = /^(?:dashboard-team-\d+-|dashboard-|user-)/;
39
+ /**
40
+ * Where a tool comes from, for humans: the upstream connector/plugin name
41
+ * when the tool declares one (the reserved `__conn__` selector's values
42
+ * name it), the connection name otherwise. One aggregating connection
43
+ * (e.g. a tenant `plugins` endpoint) hosts tools from several connectors,
44
+ * and "plugins" tells an operator nothing — "Buildkite" does.
45
+ */
46
+ function catalogSource(tool) {
47
+ var _a, _b;
48
+ if (tool.advertised !== true) {
49
+ return undefined;
50
+ }
51
+ const properties = tool.inputSchema.properties;
52
+ const first = (_b = (_a = properties === null || properties === void 0 ? void 0 : properties.__conn__) === null || _a === void 0 ? void 0 : _a.enum) === null || _b === void 0 ? void 0 : _b[0];
53
+ if (typeof first === "string" && first !== "") {
54
+ return first.replace(CONNECTOR_SCOPE_PREFIX, "");
55
+ }
56
+ return tool.connection;
57
+ }
58
+ export function catalogListEntry(tool) {
59
+ return {
60
+ name: tool.name,
61
+ title: catalogTitle(tool),
62
+ source: catalogSource(tool),
63
+ };
64
+ }
65
+ export function catalogDetailEntry(tool) {
66
+ return Object.assign(Object.assign({}, catalogListEntry(tool)), { description: tool.description, execution: tool.execution, needsApproval: tool.needsApproval, effect: tool.effect, inputSchema: tool.inputSchema, outputSchema: tool.outputSchema });
67
+ }