@cursor/july 0.1.93 → 0.1.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (440) hide show
  1. package/AGENTS.md +8 -20
  2. package/README.md +4 -26
  3. package/dist/channels/github/github-channel.d.ts.map +1 -1
  4. package/dist/channels/github/github-channel.js +14 -2
  5. package/dist/channels/github/types.d.ts +18 -3
  6. package/dist/channels/github/types.d.ts.map +1 -1
  7. package/dist/channels/origin/origin-channel.d.ts.map +1 -1
  8. package/dist/channels/origin/origin-channel.js +11 -3
  9. package/dist/channels/origin/origin-webhook.d.ts +11 -1
  10. package/dist/channels/origin/origin-webhook.d.ts.map +1 -1
  11. package/dist/channels/origin/origin-webhook.js +23 -3
  12. package/dist/channels/origin/types.d.ts +8 -0
  13. package/dist/channels/origin/types.d.ts.map +1 -1
  14. package/dist/channels/slack/attachments.js +2 -2
  15. package/dist/channels/slack/dispatch.d.ts +0 -7
  16. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  17. package/dist/channels/slack/dispatch.js +4 -7
  18. package/dist/channels/slack/eval-directive.d.ts +5 -12
  19. package/dist/channels/slack/eval-directive.d.ts.map +1 -1
  20. package/dist/channels/slack/eval-directive.js +8 -19
  21. package/dist/channels/slack/index.d.ts +0 -6
  22. package/dist/channels/slack/index.d.ts.map +1 -1
  23. package/dist/channels/slack/index.js +0 -6
  24. package/dist/channels/slack/pr-ref.d.ts +7 -1
  25. package/dist/channels/slack/pr-ref.d.ts.map +1 -1
  26. package/dist/channels/slack/pr-ref.js +42 -23
  27. package/dist/channels/slack/setup.d.ts +4 -4
  28. package/dist/channels/slack/setup.d.ts.map +1 -1
  29. package/dist/channels/slack/setup.js +8 -15
  30. package/dist/channels/slack/slack-channel.d.ts +6 -13
  31. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  32. package/dist/channels/slack/slack-channel.js +15 -101
  33. package/dist/channels/slack/types.d.ts +12 -79
  34. package/dist/channels/slack/types.d.ts.map +1 -1
  35. package/dist/channels/slack/types.js +1 -15
  36. package/dist/client.d.ts +14 -0
  37. package/dist/client.d.ts.map +1 -0
  38. package/dist/client.js +12 -0
  39. package/dist/connections.d.ts +18 -9
  40. package/dist/connections.d.ts.map +1 -1
  41. package/dist/connections.js +17 -8
  42. package/dist/docs/404.html +2 -2
  43. package/dist/docs/ab.html +4 -4
  44. package/dist/docs/assets/{app.CjWU-x0z.js → app.BBj0klBO.js} +1 -1
  45. package/dist/docs/assets/chunks/@localSearchIndexroot.oqPawjiD.js +1 -0
  46. package/dist/docs/assets/chunks/{VPLocalSearchBox.Cxy8ySFQ.js → VPLocalSearchBox.CUEXpL78.js} +1 -1
  47. package/dist/docs/assets/chunks/{theme.Dvq1Bktu.js → theme.DabmQnia.js} +2 -2
  48. package/dist/docs/assets/concepts.md.lwAgBIMI.js +1 -0
  49. package/dist/docs/assets/{deployment.md.DoLFAzfm.js → deployment.md.D9msOFOW.js} +3 -8
  50. package/dist/docs/assets/{deployment.md.DoLFAzfm.lean.js → deployment.md.D9msOFOW.lean.js} +1 -1
  51. package/dist/docs/assets/{guides_agent-to-agent.md.B3JIaAqz.js → guides_agent-to-agent.md.BDb0t1QV.js} +1 -1
  52. package/dist/docs/assets/guides_cloud-runtime.md.CkYbjnAX.js +9 -0
  53. package/dist/docs/assets/guides_cloud-runtime.md.CkYbjnAX.lean.js +1 -0
  54. package/dist/docs/assets/{guides_convert-automation.md.Bboisykk.js → guides_convert-automation.md.B4sjlodG.js} +1 -1
  55. package/dist/docs/assets/{guides_github.md.DqJhuaN1.js → guides_github.md.Cnh2mL4a.js} +1 -1
  56. package/dist/docs/assets/{guides_mcp-oauth.md.CJvrXtkN.js → guides_mcp-oauth.md.DPYmBCbV.js} +7 -9
  57. package/dist/docs/assets/{guides_mcp-oauth.md.CJvrXtkN.lean.js → guides_mcp-oauth.md.DPYmBCbV.lean.js} +1 -1
  58. package/dist/docs/assets/{guides_slack.md.mqeNKs84.js → guides_slack.md.C32HsdKk.js} +5 -11
  59. package/dist/docs/assets/guides_slack.md.C32HsdKk.lean.js +1 -0
  60. package/dist/docs/assets/index.md.BoHaMdeZ.js +5 -0
  61. package/dist/docs/assets/{index.md.B-lVR4wT.lean.js → index.md.BoHaMdeZ.lean.js} +1 -1
  62. package/dist/docs/assets/{quickstart.md.BrmfrrIr.js → quickstart.md.Nj_LjW_a.js} +1 -1
  63. package/dist/docs/assets/{reference_cli.md.D9KESDsD.js → reference_cli.md.BsMOxDvh.js} +4 -3
  64. package/dist/docs/assets/{reference_cli.md.D9KESDsD.lean.js → reference_cli.md.BsMOxDvh.lean.js} +1 -1
  65. package/dist/docs/assets/{reference_connections.md.DB6SsN6U.js → reference_connections.md.BH8Oc0D0.js} +5 -5
  66. package/dist/docs/assets/{reference_connections.md.DB6SsN6U.lean.js → reference_connections.md.BH8Oc0D0.lean.js} +1 -1
  67. package/dist/docs/assets/{reference_hooks.md.BxN87gCw.js → reference_hooks.md.a8BJxMR5.js} +1 -1
  68. package/dist/docs/assets/reference_http-api.md.D89k1mdm.js +11 -0
  69. package/dist/docs/assets/reference_http-api.md.D89k1mdm.lean.js +1 -0
  70. package/dist/docs/assets/reference_project-layout.md.Bv4KOtlB.js +19 -0
  71. package/dist/docs/assets/{reference_subagents.md.Xoav0AII.js → reference_subagents.md.CfsIloPm.js} +1 -1
  72. package/dist/docs/assets/{reference_tools.md.DuKvkYWG.js → reference_tools.md.BHeXn2id.js} +3 -3
  73. package/dist/docs/assets/{reference_tools.md.DuKvkYWG.lean.js → reference_tools.md.BHeXn2id.lean.js} +1 -1
  74. package/dist/docs/assets/{templates_agentic-owners.md.DqtPdm6f.js → templates_agentic-owners.md.BZSH4N9z.js} +1 -1
  75. package/dist/docs/assets/{templates_demo.md.DhFcWN6j.js → templates_demo.md.BeQX9V3H.js} +1 -1
  76. package/dist/docs/assets/{templates_pr-autofixer.md.R4K_qytS.js → templates_pr-autofixer.md.x5zl6-GT.js} +2 -2
  77. package/dist/docs/assets/{templates_pr-autofixer.md.R4K_qytS.lean.js → templates_pr-autofixer.md.x5zl6-GT.lean.js} +1 -1
  78. package/dist/docs/assets/templates_security-help.md.C3Ny_Qr2.js +4 -0
  79. package/dist/docs/assets/templates_security-help.md.C3Ny_Qr2.lean.js +1 -0
  80. package/dist/docs/assets/{templates_security-reviewer.md.ByFyRta2.js → templates_security-reviewer.md.lshxbCLK.js} +2 -2
  81. package/dist/docs/assets/{templates_security-reviewer.md.ByFyRta2.lean.js → templates_security-reviewer.md.lshxbCLK.lean.js} +1 -1
  82. package/dist/docs/assets/{templates_triage.md.CVlpctKS.js → templates_triage.md.Co4UNzkZ.js} +3 -3
  83. package/dist/docs/assets/{templates_triage.md.CVlpctKS.lean.js → templates_triage.md.Co4UNzkZ.lean.js} +1 -1
  84. package/dist/docs/assets/troubleshooting.md.Ctv3T8C2.js +1 -0
  85. package/dist/docs/building-with-agents.html +4 -4
  86. package/dist/docs/concepts.html +5 -5
  87. package/dist/docs/concepts.md +1 -0
  88. package/dist/docs/deployment.html +7 -12
  89. package/dist/docs/deployment.md +1 -20
  90. package/dist/docs/design/agsh.md +406 -0
  91. package/dist/docs/evals.html +4 -4
  92. package/dist/docs/guides/agent-to-agent.html +6 -6
  93. package/dist/docs/guides/agent-to-agent.md +2 -2
  94. package/dist/docs/guides/cloud-runtime.html +6 -6
  95. package/dist/docs/guides/cloud-runtime.md +1 -0
  96. package/dist/docs/guides/convert-automation.html +6 -6
  97. package/dist/docs/guides/convert-automation.md +1 -1
  98. package/dist/docs/guides/github.html +6 -6
  99. package/dist/docs/guides/github.md +4 -4
  100. package/dist/docs/guides/human-in-the-loop.html +4 -4
  101. package/dist/docs/guides/mcp-oauth.html +11 -13
  102. package/dist/docs/guides/mcp-oauth.md +10 -18
  103. package/dist/docs/guides/opentelemetry.html +5 -5
  104. package/dist/docs/guides/slack.html +9 -15
  105. package/dist/docs/guides/slack.md +9 -46
  106. package/dist/docs/guides/webhooks.html +4 -4
  107. package/dist/docs/hashmap.json +1 -1
  108. package/dist/docs/hillclimbing.html +4 -4
  109. package/dist/docs/index.html +6 -6
  110. package/dist/docs/index.md +3 -29
  111. package/dist/docs/llms-full.txt +756 -2810
  112. package/dist/docs/llms.txt +3 -16
  113. package/dist/docs/quickstart.html +6 -6
  114. package/dist/docs/quickstart.md +2 -3
  115. package/dist/docs/reference/agent-config.html +4 -4
  116. package/dist/docs/reference/artifacts.html +4 -4
  117. package/dist/docs/reference/channels.html +4 -4
  118. package/dist/docs/reference/cli.html +8 -7
  119. package/dist/docs/reference/cli.md +5 -2
  120. package/dist/docs/reference/connections.html +9 -9
  121. package/dist/docs/reference/connections.md +15 -11
  122. package/dist/docs/reference/hooks.html +6 -6
  123. package/dist/docs/reference/hooks.md +2 -3
  124. package/dist/docs/reference/http-api.html +6 -6
  125. package/dist/docs/reference/http-api.md +8 -0
  126. package/dist/docs/reference/instructions.html +4 -4
  127. package/dist/docs/reference/playground.html +4 -4
  128. package/dist/docs/reference/project-layout.html +8 -6
  129. package/dist/docs/reference/project-layout.md +5 -1
  130. package/dist/docs/reference/prompt.html +4 -4
  131. package/dist/docs/reference/schedules.html +4 -4
  132. package/dist/docs/reference/sessions.html +4 -4
  133. package/dist/docs/reference/skills.html +4 -4
  134. package/dist/docs/reference/subagents.html +6 -6
  135. package/dist/docs/reference/subagents.md +2 -2
  136. package/dist/docs/reference/tools.html +7 -7
  137. package/dist/docs/reference/tools.md +19 -3
  138. package/dist/docs/scaffolding-agents.html +4 -4
  139. package/dist/docs/storage.html +4 -4
  140. package/dist/docs/templates/agentic-owners.html +7 -7
  141. package/dist/docs/templates/agentic-owners.md +1 -1
  142. package/dist/docs/templates/demo.html +6 -6
  143. package/dist/docs/templates/demo.md +3 -2
  144. package/dist/docs/templates/pr-autofixer.html +6 -6
  145. package/dist/docs/templates/pr-autofixer.md +8 -13
  146. package/dist/docs/templates/security-help.html +30 -0
  147. package/dist/docs/templates/security-help.md +65 -0
  148. package/dist/docs/templates/security-reviewer.html +6 -6
  149. package/dist/docs/templates/security-reviewer.md +1 -3
  150. package/dist/docs/templates/triage.html +7 -7
  151. package/dist/docs/templates/triage.md +2 -6
  152. package/dist/docs/troubleshooting.html +5 -5
  153. package/dist/docs/troubleshooting.md +2 -2
  154. package/dist/files-backends/cursor-hosted.d.ts +6 -2
  155. package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
  156. package/dist/files-backends/cursor-hosted.js +2 -2
  157. package/dist/files.d.ts +2 -0
  158. package/dist/files.d.ts.map +1 -1
  159. package/dist/files.js +5 -0
  160. package/dist/index.d.ts +1 -1
  161. package/dist/index.d.ts.map +1 -1
  162. package/dist/index.js +1 -1
  163. package/dist/internal/advertise-tools.d.ts +11 -0
  164. package/dist/internal/advertise-tools.d.ts.map +1 -1
  165. package/dist/internal/advertise-tools.js +47 -9
  166. package/dist/internal/cli-deploy.d.ts.map +1 -1
  167. package/dist/internal/cli-deploy.js +135 -6
  168. package/dist/internal/cli-mcp-oauth.d.ts.map +1 -1
  169. package/dist/internal/cli-mcp-oauth.js +7 -4
  170. package/dist/internal/conversation-mirror.d.ts +82 -0
  171. package/dist/internal/conversation-mirror.d.ts.map +1 -0
  172. package/dist/internal/conversation-mirror.js +251 -0
  173. package/dist/internal/convert-automation/convert-workflow.d.ts.map +1 -1
  174. package/dist/internal/convert-automation/convert-workflow.js +26 -15
  175. package/dist/internal/convert-automation/slug.d.ts +0 -2
  176. package/dist/internal/convert-automation/slug.d.ts.map +1 -1
  177. package/dist/internal/convert-automation/slug.js +0 -8
  178. package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
  179. package/dist/internal/cursor/account-mcp.js +5 -1
  180. package/dist/internal/deferred-channel-session.d.ts +20 -0
  181. package/dist/internal/deferred-channel-session.d.ts.map +1 -0
  182. package/dist/internal/deferred-channel-session.js +62 -0
  183. package/dist/internal/deploy-client.d.ts +13 -1
  184. package/dist/internal/deploy-client.d.ts.map +1 -1
  185. package/dist/internal/deploy-client.js +11 -1
  186. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  187. package/dist/internal/deploy-manifest.js +11 -5
  188. package/dist/internal/discovery.d.ts.map +1 -1
  189. package/dist/internal/discovery.js +110 -15
  190. package/dist/internal/framework-storage-selection.d.ts +32 -16
  191. package/dist/internal/framework-storage-selection.d.ts.map +1 -1
  192. package/dist/internal/framework-storage-selection.js +51 -17
  193. package/dist/internal/hosted-admission-context.d.ts +20 -0
  194. package/dist/internal/hosted-admission-context.d.ts.map +1 -0
  195. package/dist/internal/hosted-admission-context.js +31 -0
  196. package/dist/internal/hosted-delivery-protocol.d.ts +5 -0
  197. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  198. package/dist/internal/hosted-delivery-protocol.js +33 -1
  199. package/dist/internal/hosted-delivery.d.ts +4 -2
  200. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  201. package/dist/internal/hosted-delivery.js +97 -44
  202. package/dist/internal/hosted-managed-automation.d.ts +30 -0
  203. package/dist/internal/hosted-managed-automation.d.ts.map +1 -0
  204. package/dist/internal/hosted-managed-automation.js +58 -0
  205. package/dist/internal/mcp-endpoint.js +3 -3
  206. package/dist/internal/mcp-host.d.ts +8 -7
  207. package/dist/internal/mcp-host.d.ts.map +1 -1
  208. package/dist/internal/mcp-host.js +8 -7
  209. package/dist/internal/peer-connections.d.ts.map +1 -1
  210. package/dist/internal/peer-connections.js +5 -1
  211. package/dist/internal/playground/static.d.ts +0 -3
  212. package/dist/internal/playground/static.d.ts.map +1 -1
  213. package/dist/internal/resolved-connections.d.ts.map +1 -1
  214. package/dist/internal/resolved-connections.js +5 -7
  215. package/dist/internal/review-comments.d.ts.map +1 -1
  216. package/dist/internal/review-comments.js +10 -98
  217. package/dist/internal/scm/pr-url.d.ts +14 -0
  218. package/dist/internal/scm/pr-url.d.ts.map +1 -0
  219. package/dist/internal/scm/pr-url.js +65 -0
  220. package/dist/internal/sdk-runner.d.ts +14 -0
  221. package/dist/internal/sdk-runner.d.ts.map +1 -1
  222. package/dist/internal/sdk-runner.js +41 -2
  223. package/dist/internal/server.d.ts.map +1 -1
  224. package/dist/internal/server.js +123 -174
  225. package/dist/internal/session-engine.d.ts +45 -10
  226. package/dist/internal/session-engine.d.ts.map +1 -1
  227. package/dist/internal/session-engine.js +217 -65
  228. package/dist/internal/tool-catalog.d.ts +31 -0
  229. package/dist/internal/tool-catalog.d.ts.map +1 -0
  230. package/dist/internal/tool-catalog.js +67 -0
  231. package/dist/playground/assets/index-CF7hUDnQ.css +1 -0
  232. package/dist/playground/assets/{index-D9MFzhNE.js → index-CZA1uEWA.js} +48 -48
  233. package/dist/playground/index.html +2 -2
  234. package/dist/storage-backends/cursor-hosted.d.ts +7 -2
  235. package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
  236. package/dist/storage-backends/cursor-hosted.js +2 -2
  237. package/dist/types.d.ts +72 -23
  238. package/dist/types.d.ts.map +1 -1
  239. package/dist/types.js +19 -0
  240. package/docs/README.md +3 -29
  241. package/docs/concepts.md +1 -0
  242. package/docs/deployment.md +1 -20
  243. package/docs/design/agsh.md +406 -0
  244. package/docs/guides/agent-to-agent.md +2 -2
  245. package/docs/guides/cloud-runtime.md +1 -0
  246. package/docs/guides/convert-automation.md +1 -1
  247. package/docs/guides/github.md +4 -4
  248. package/docs/guides/mcp-oauth.md +10 -18
  249. package/docs/guides/slack.md +10 -47
  250. package/docs/quickstart.md +2 -3
  251. package/docs/reference/cli.md +5 -2
  252. package/docs/reference/connections.md +15 -11
  253. package/docs/reference/hooks.md +2 -3
  254. package/docs/reference/http-api.md +8 -0
  255. package/docs/reference/project-layout.md +5 -1
  256. package/docs/reference/subagents.md +2 -2
  257. package/docs/reference/tools.md +19 -3
  258. package/docs/templates/agentic-owners.md +1 -1
  259. package/docs/templates/demo.md +3 -2
  260. package/docs/templates/pr-autofixer.md +8 -13
  261. package/docs/templates/security-help.md +70 -0
  262. package/docs/templates/security-reviewer.md +1 -3
  263. package/docs/templates/triage.md +2 -6
  264. package/docs/troubleshooting.md +2 -2
  265. package/package.json +9 -2
  266. package/skills/create-agent/SKILL.md +6 -13
  267. package/skills/debug/SKILL.md +2 -4
  268. package/skills/evals/SKILL.md +1 -1
  269. package/skills/framework-map/SKILL.md +3 -2
  270. package/skills/mcp-auth/SKILL.md +10 -13
  271. package/skills/setup-slack/SKILL.md +21 -137
  272. package/src/channels/github/github-channel.ts +23 -8
  273. package/src/channels/github/types.ts +19 -2
  274. package/src/channels/origin/origin-channel.ts +13 -1
  275. package/src/channels/origin/origin-webhook.ts +27 -3
  276. package/src/channels/origin/types.ts +8 -0
  277. package/src/channels/slack/attachments.ts +2 -2
  278. package/src/channels/slack/dispatch.ts +2 -16
  279. package/src/channels/slack/eval-directive.ts +8 -27
  280. package/src/channels/slack/index.ts +0 -6
  281. package/src/channels/slack/pr-ref.ts +56 -25
  282. package/src/channels/slack/setup.ts +8 -15
  283. package/src/channels/slack/slack-channel.ts +14 -125
  284. package/src/channels/slack/types.ts +12 -96
  285. package/src/client.ts +23 -0
  286. package/src/connections.ts +20 -7
  287. package/src/files-backends/cursor-hosted.ts +9 -3
  288. package/src/files.ts +11 -0
  289. package/src/index.ts +2 -0
  290. package/src/internal/advertise-tools.ts +45 -7
  291. package/src/internal/cli-deploy.ts +171 -7
  292. package/src/internal/cli-mcp-oauth.ts +6 -4
  293. package/src/internal/conversation-mirror.ts +330 -0
  294. package/src/internal/convert-automation/convert-workflow.ts +29 -17
  295. package/src/internal/convert-automation/slug.ts +0 -9
  296. package/src/internal/cursor/account-mcp.ts +4 -1
  297. package/src/internal/deferred-channel-session.ts +61 -0
  298. package/src/internal/deploy-client.ts +24 -1
  299. package/src/internal/deploy-manifest.ts +10 -5
  300. package/src/internal/discovery.ts +129 -15
  301. package/src/internal/fixtures/units-server.ts +52 -0
  302. package/src/internal/framework-storage-selection.ts +61 -19
  303. package/src/internal/hosted-admission-context.ts +37 -0
  304. package/src/internal/hosted-delivery-protocol.ts +44 -1
  305. package/src/internal/hosted-delivery.ts +155 -68
  306. package/src/internal/hosted-managed-automation.ts +72 -0
  307. package/src/internal/mcp-endpoint.ts +3 -3
  308. package/src/internal/mcp-host.ts +8 -7
  309. package/src/internal/peer-connections.ts +4 -1
  310. package/src/internal/playground/static.ts +1 -3
  311. package/src/internal/resolved-connections.ts +8 -10
  312. package/src/internal/review-comments.ts +10 -113
  313. package/src/internal/scm/pr-url.ts +95 -0
  314. package/src/internal/sdk-runner.ts +57 -2
  315. package/src/internal/server.ts +161 -251
  316. package/src/internal/session-engine.ts +266 -69
  317. package/src/internal/tool-catalog.ts +106 -0
  318. package/src/storage-backends/cursor-hosted.ts +10 -3
  319. package/src/types.ts +90 -23
  320. package/templates/agentic-owners/README.md +1 -1
  321. package/templates/agentic-owners/agent/agent.ts +0 -10
  322. package/templates/agentic-owners/agent/channels/github.ts +5 -14
  323. package/templates/agentic-owners/agent/lib/config.ts +0 -8
  324. package/templates/agentic-owners/agent/lib/review.ts +2 -15
  325. package/templates/agentic-owners/agent/tools/record_review.ts +2 -4
  326. package/templates/demo/agent/agent.ts +0 -10
  327. package/templates/pr-autofixer/README.md +0 -2
  328. package/templates/pr-autofixer/agent/agent.ts +0 -11
  329. package/templates/pr-autofixer/agent/channels/slack.ts +1 -2
  330. package/templates/pr-autofixer/agent/lib/pr-state.ts +5 -17
  331. package/templates/pr-autofixer/agent/lib/repos.ts +0 -1
  332. package/templates/security-help/README.md +2 -2
  333. package/templates/security-help/agent/agent.ts +1 -2
  334. package/templates/security-help/agent/channels/slack.ts +0 -3
  335. package/templates/security-help/agent/instructions.md +9 -10
  336. package/templates/security-help/agent/skills/access-request.md +1 -1
  337. package/templates/security-help/agent/skills/faq.md +31 -0
  338. package/templates/security-help/agent/skills/security-playbooks.md +1 -1
  339. package/templates/security-help/package.json +1 -2
  340. package/templates/security-reviewer/agent/agent.ts +0 -10
  341. package/templates/triage/README.md +2 -1
  342. package/templates/triage/agent/agent.ts +0 -10
  343. package/templates/triage/agent/channels/queue.ts +1 -1
  344. package/templates/triage/agent/channels/webhook.ts +1 -3
  345. package/templates/triage/overlays/jira/agent/mcp-connections/tracker.ts +0 -1
  346. package/templates/triage/overlays/linear/agent/mcp-connections/tracker.ts +0 -1
  347. package/dist/channels/slack/cursor-account.d.ts +0 -87
  348. package/dist/channels/slack/cursor-account.d.ts.map +0 -1
  349. package/dist/channels/slack/cursor-account.js +0 -100
  350. package/dist/docs/assets/chunks/@localSearchIndexroot.ChpIC3Zy.js +0 -1
  351. package/dist/docs/assets/concepts.md.F6AiPorA.js +0 -1
  352. package/dist/docs/assets/example-agents_approval-buddy.md.DmezILPg.js +0 -10
  353. package/dist/docs/assets/example-agents_approval-buddy.md.DmezILPg.lean.js +0 -1
  354. package/dist/docs/assets/example-agents_benny.md.B0kwY7D_.js +0 -5
  355. package/dist/docs/assets/example-agents_benny.md.B0kwY7D_.lean.js +0 -1
  356. package/dist/docs/assets/example-agents_bugbot.md.BRGMi9O2.js +0 -11
  357. package/dist/docs/assets/example-agents_bugbot.md.BRGMi9O2.lean.js +0 -1
  358. package/dist/docs/assets/example-agents_codebase-wiki.md.BBNw9Ekr.js +0 -8
  359. package/dist/docs/assets/example-agents_codebase-wiki.md.BBNw9Ekr.lean.js +0 -1
  360. package/dist/docs/assets/example-agents_codeowners-review.md.Bfta-lBU.js +0 -8
  361. package/dist/docs/assets/example-agents_codeowners-review.md.Bfta-lBU.lean.js +0 -1
  362. package/dist/docs/assets/example-agents_concierge.md.BzB2b20R.js +0 -22
  363. package/dist/docs/assets/example-agents_concierge.md.BzB2b20R.lean.js +0 -1
  364. package/dist/docs/assets/example-agents_index.md.ChBp0AX6.js +0 -2
  365. package/dist/docs/assets/example-agents_index.md.ChBp0AX6.lean.js +0 -1
  366. package/dist/docs/assets/example-agents_knowledge-base.md.CrA85ig-.js +0 -11
  367. package/dist/docs/assets/example-agents_knowledge-base.md.CrA85ig-.lean.js +0 -1
  368. package/dist/docs/assets/example-agents_oncall.md.DK4XkYTd.js +0 -10
  369. package/dist/docs/assets/example-agents_oncall.md.DK4XkYTd.lean.js +0 -1
  370. package/dist/docs/assets/example-agents_security-reviewer.md.74pPpWYj.js +0 -19
  371. package/dist/docs/assets/example-agents_security-reviewer.md.74pPpWYj.lean.js +0 -1
  372. package/dist/docs/assets/example-agents_slack-agent.md.D7Kdj5BV.js +0 -5
  373. package/dist/docs/assets/example-agents_slack-agent.md.D7Kdj5BV.lean.js +0 -1
  374. package/dist/docs/assets/example-agents_weather-agent.md.CaGpmw3Y.js +0 -25
  375. package/dist/docs/assets/example-agents_weather-agent.md.CaGpmw3Y.lean.js +0 -1
  376. package/dist/docs/assets/guides_cloud-runtime.md.BnvjPiia.js +0 -9
  377. package/dist/docs/assets/guides_cloud-runtime.md.BnvjPiia.lean.js +0 -1
  378. package/dist/docs/assets/guides_slack.md.mqeNKs84.lean.js +0 -1
  379. package/dist/docs/assets/index.md.B-lVR4wT.js +0 -5
  380. package/dist/docs/assets/reference_http-api.md.C68BERYr.js +0 -11
  381. package/dist/docs/assets/reference_http-api.md.C68BERYr.lean.js +0 -1
  382. package/dist/docs/assets/reference_project-layout.md.WN9nwJht.js +0 -17
  383. package/dist/docs/assets/troubleshooting.md.vCWwvqcJ.js +0 -1
  384. package/dist/docs/example-agents/approval-buddy.html +0 -36
  385. package/dist/docs/example-agents/approval-buddy.md +0 -266
  386. package/dist/docs/example-agents/benny.html +0 -31
  387. package/dist/docs/example-agents/benny.md +0 -173
  388. package/dist/docs/example-agents/bugbot.html +0 -37
  389. package/dist/docs/example-agents/bugbot.md +0 -229
  390. package/dist/docs/example-agents/codebase-wiki.html +0 -34
  391. package/dist/docs/example-agents/codebase-wiki.md +0 -167
  392. package/dist/docs/example-agents/codeowners-review.html +0 -34
  393. package/dist/docs/example-agents/codeowners-review.md +0 -192
  394. package/dist/docs/example-agents/concierge.html +0 -48
  395. package/dist/docs/example-agents/concierge.md +0 -200
  396. package/dist/docs/example-agents/index.html +0 -28
  397. package/dist/docs/example-agents/index.md +0 -99
  398. package/dist/docs/example-agents/knowledge-base.html +0 -37
  399. package/dist/docs/example-agents/knowledge-base.md +0 -168
  400. package/dist/docs/example-agents/oncall.html +0 -36
  401. package/dist/docs/example-agents/oncall.md +0 -212
  402. package/dist/docs/example-agents/security-reviewer.html +0 -45
  403. package/dist/docs/example-agents/security-reviewer.md +0 -265
  404. package/dist/docs/example-agents/slack-agent.html +0 -31
  405. package/dist/docs/example-agents/slack-agent.md +0 -142
  406. package/dist/docs/example-agents/weather-agent.html +0 -51
  407. package/dist/docs/example-agents/weather-agent.md +0 -297
  408. package/dist/internal/cursor-slack-relay.d.ts +0 -96
  409. package/dist/internal/cursor-slack-relay.d.ts.map +0 -1
  410. package/dist/internal/cursor-slack-relay.js +0 -176
  411. package/dist/playground/assets/index-D9N7-q97.css +0 -1
  412. package/docs/example-agents/approval-buddy.md +0 -271
  413. package/docs/example-agents/benny.md +0 -178
  414. package/docs/example-agents/bugbot.md +0 -234
  415. package/docs/example-agents/codebase-wiki.md +0 -172
  416. package/docs/example-agents/codeowners-review.md +0 -197
  417. package/docs/example-agents/concierge.md +0 -205
  418. package/docs/example-agents/index.md +0 -104
  419. package/docs/example-agents/knowledge-base.md +0 -173
  420. package/docs/example-agents/oncall.md +0 -217
  421. package/docs/example-agents/security-reviewer.md +0 -270
  422. package/docs/example-agents/slack-agent.md +0 -147
  423. package/docs/example-agents/weather-agent.md +0 -302
  424. package/src/channels/slack/cursor-account.ts +0 -202
  425. package/src/internal/cursor-slack-relay.ts +0 -249
  426. package/templates/security-help/agent/knowledge/faq/approvals.md +0 -5
  427. package/templates/security-help/agent/knowledge/faq/channels.md +0 -6
  428. package/templates/security-help/agent/knowledge/faq/phishing.md +0 -10
  429. package/templates/security-help/agent/skills/security-first-pass.md +0 -15
  430. /package/dist/docs/assets/{concepts.md.F6AiPorA.lean.js → concepts.md.lwAgBIMI.lean.js} +0 -0
  431. /package/dist/docs/assets/{guides_agent-to-agent.md.B3JIaAqz.lean.js → guides_agent-to-agent.md.BDb0t1QV.lean.js} +0 -0
  432. /package/dist/docs/assets/{guides_convert-automation.md.Bboisykk.lean.js → guides_convert-automation.md.B4sjlodG.lean.js} +0 -0
  433. /package/dist/docs/assets/{guides_github.md.DqJhuaN1.lean.js → guides_github.md.Cnh2mL4a.lean.js} +0 -0
  434. /package/dist/docs/assets/{quickstart.md.BrmfrrIr.lean.js → quickstart.md.Nj_LjW_a.lean.js} +0 -0
  435. /package/dist/docs/assets/{reference_hooks.md.BxN87gCw.lean.js → reference_hooks.md.a8BJxMR5.lean.js} +0 -0
  436. /package/dist/docs/assets/{reference_project-layout.md.WN9nwJht.lean.js → reference_project-layout.md.Bv4KOtlB.lean.js} +0 -0
  437. /package/dist/docs/assets/{reference_subagents.md.Xoav0AII.lean.js → reference_subagents.md.CfsIloPm.lean.js} +0 -0
  438. /package/dist/docs/assets/{templates_agentic-owners.md.DqtPdm6f.lean.js → templates_agentic-owners.md.BZSH4N9z.lean.js} +0 -0
  439. /package/dist/docs/assets/{templates_demo.md.DhFcWN6j.lean.js → templates_demo.md.BeQX9V3H.lean.js} +0 -0
  440. /package/dist/docs/assets/{troubleshooting.md.vCWwvqcJ.lean.js → troubleshooting.md.Ctv3T8C2.lean.js} +0 -0
@@ -44,7 +44,8 @@ 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 { HostedAdmissionLocalSendError, isDuringHostedAdmission, } from "./hosted-admission-context.js";
48
+ import { formatContinuationToken, newContinuationKey, newSessionId, newToolCallId, parseContinuationToken, } from "./ids.js";
48
49
  import { validateToolInput } from "./json-schema.js";
49
50
  import { McpHost } from "./mcp-host.js";
50
51
  import { shouldStartProcessMemoryTelemetry, startProcessMemoryTelemetry, } from "./process-memory-telemetry.js";
@@ -54,7 +55,7 @@ import { sessionExternalLinks } from "./session-links.js";
54
55
  import { SessionStore } from "./session-store.js";
55
56
  import { syncSkillsToStore } from "./skills-sync.js";
56
57
  import { StorageCoordinator } from "./storage-coordinator.js";
57
- import { decideToolCall } from "./tool-policy.js";
58
+ import { decideToolCall, resolveEffect } from "./tool-policy.js";
58
59
  import { normalizeToolResult, toolCallErrorMessage } from "./tool-result.js";
59
60
  import { estimateTurnCostFromApi, roundCostUsd, } from "./turn-cost.js";
60
61
  import { TurnGovernor } from "./turn-governor.js";
@@ -90,6 +91,24 @@ export class ToolNotDirectlyCallableError extends Error {
90
91
  this.name = "ToolNotDirectlyCallableError";
91
92
  }
92
93
  }
94
+ export class InvalidContinuationTokenError extends Error {
95
+ constructor(detail) {
96
+ super(`Invalid continuation token: ${detail}`);
97
+ this.name = "InvalidContinuationTokenError";
98
+ }
99
+ }
100
+ /**
101
+ * A session-bound direct call whose harness cwd cannot be materialized and
102
+ * whose effect is not read: a write tool may rely on ctx.workspaceDir being
103
+ * the real session workspace, so it fails typed instead of silently running
104
+ * in a scratch directory.
105
+ */
106
+ export class WorkspaceUnavailableError extends Error {
107
+ constructor(toolName, cause) {
108
+ super(`Session workspace unavailable for tool "${toolName}": ${cause instanceof Error ? cause.message : String(cause)}`);
109
+ this.name = "WorkspaceUnavailableError";
110
+ }
111
+ }
93
112
  export class ToolInputError extends Error {
94
113
  constructor(args) {
95
114
  super(`Invalid input for tool "${args.toolName}": ${args.detail}`);
@@ -116,7 +135,7 @@ export class ApprovalInterruptedError extends Error {
116
135
  }
117
136
  export class SessionEngine {
118
137
  constructor(options) {
119
- var _a, _b, _c, _d;
138
+ var _a, _b, _c, _d, _e;
120
139
  /** In-flight lazy restores, deduped per channel + continuation key. */
121
140
  this.restoreInFlight = new Map();
122
141
  this.channelsById = new Map();
@@ -189,6 +208,7 @@ export class SessionEngine {
189
208
  // for why the choice does not belong to the agent author.
190
209
  const frameworkStorage = selectFrameworkStorageDefinition({
191
210
  authored: options.project.storage,
211
+ architecture: options.project.agent.architecture,
192
212
  });
193
213
  this.storage =
194
214
  frameworkStorage === undefined
@@ -215,8 +235,11 @@ export class SessionEngine {
215
235
  // Peer and Cursor-account transports are symbolic until the serve host
216
236
  // resolves them; the host-side MCP registry starts with the concrete
217
237
  // 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();
238
+ this.mcpHost = new McpHost([
239
+ ...options.project.agent.connections,
240
+ ...((_d = options.project.agent.hostConnections) !== null && _d !== void 0 ? _d : []),
241
+ ].filter((connection) => !isSymbolicConnectionTransport(connection.transport)));
242
+ const basePlatforms = (_e = options.platforms) !== null && _e !== void 0 ? _e : createHostPlatforms();
220
243
  const slackBinding = resolveDedicatedSlackHostBinding(options.project.channels);
221
244
  this.platforms =
222
245
  slackBinding === undefined
@@ -477,6 +500,13 @@ export class SessionEngine {
477
500
  return __awaiter(this, arguments, void 0, function* (channelId, message, options = {}) {
478
501
  var _a;
479
502
  var _b, _c, _d, _e, _f, _g;
503
+ if (isDuringHostedAdmission()) {
504
+ // Only sends that bypassed the admission capture stub (typically a
505
+ // startup-captured `onStart` send) reach the engine inside the
506
+ // admission window; running one would leak an invisible local session
507
+ // on a sessionless pod.
508
+ throw new HostedAdmissionLocalSendError();
509
+ }
480
510
  const identity = channelId === HTTP_CHANNEL_ID
481
511
  ? httpContinuationIdentity(this.project.httpChannel)
482
512
  : channelContinuationIdentity(this.channelsById.get(channelId));
@@ -1539,23 +1569,17 @@ export class SessionEngine {
1539
1569
  * Connection names a cloud turn can only reach through the host connection
1540
1570
  * bridge on the tool MCP endpoint: filtered account connections without a
1541
1571
  * public bridge URL, and host-OAuth connections whose tokens live on this
1542
- * host. `hostOnly` names are never bridged — that flag means the model
1543
- * must not see the connection at all, on any runtime.
1572
+ * host.
1544
1573
  */
1545
1574
  cloudBridgeableConnectionNames() {
1546
- const hostOnlyNames = new Set(this.project.agent.connections
1547
- .filter((connection) => connection.hostOnly === true)
1548
- .map((connection) => connection.name));
1549
1575
  const names = [];
1550
1576
  for (const connection of this.project.agent.connections) {
1551
- if (!hostOnlyNames.has(connection.name) &&
1552
- isHostOauthConnectionTransport(connection.transport)) {
1577
+ if (isHostOauthConnectionTransport(connection.transport)) {
1553
1578
  names.push(connection.name);
1554
1579
  }
1555
1580
  }
1556
1581
  for (const resolved of this.resolvedConnections) {
1557
- if (!hostOnlyNames.has(resolved.name) &&
1558
- resolved.accountServersFilter !== undefined &&
1582
+ if (resolved.accountServersFilter !== undefined &&
1559
1583
  resolved.cloudUrl === undefined) {
1560
1584
  names.push(resolved.name);
1561
1585
  }
@@ -1565,8 +1589,7 @@ export class SessionEngine {
1565
1589
  /**
1566
1590
  * True when cloud turns reach `name` through the host connection bridge —
1567
1591
  * the gate the tool MCP endpoint applies before forwarding a bridge
1568
- * request to `host.mcp`, so `hostOnly` connections (and arbitrary names)
1569
- * stay unreachable from a VM.
1592
+ * request to `host.mcp`, so arbitrary names stay unreachable from a VM.
1570
1593
  */
1571
1594
  isCloudBridgedConnection(name) {
1572
1595
  if (this.cloudServerToolsConnection === undefined) {
@@ -1591,24 +1614,26 @@ export class SessionEngine {
1591
1614
  return Object.assign(Object.assign({}, connection), { url: url.toString() });
1592
1615
  }
1593
1616
  /**
1594
- * Authored + resolved MCP servers for a turn. Skips `hostOnly`. On cloud
1595
- * turns, connections whose credential lives on this host filtered
1596
- * account connections without a public bridge URL, host-OAuth servers
1597
- * mount as host connection bridges over the tool MCP endpoint instead of
1617
+ * Authored + resolved MCP servers for a turn. Skips advertised
1618
+ * connections (those surface as named server tools). On cloud turns,
1619
+ * connections whose credential lives on this host filtered account
1620
+ * connections without a public bridge URL, host-OAuth servers mount
1621
+ * as host connection bridges over the tool MCP endpoint instead of
1598
1622
  * being omitted or failing the turn closed.
1599
1623
  */
1600
1624
  buildMcpServers(runtime, sessionId, sessionAuth) {
1625
+ var _a;
1601
1626
  // The Grok Bot harness manages its own MCP surface; authored
1602
1627
  // connections are refused at discovery, so there is nothing to mount.
1603
1628
  if (runtime === "grokbot") {
1604
1629
  return {};
1605
1630
  }
1606
1631
  // Advertised connections surface as named server tools instead of an
1607
- // attached MCP server (each tool appears exactly once), so they are
1608
- // excluded here alongside hostOnly.
1609
- const hostOnlyNames = new Set(this.project.agent.connections
1610
- .filter((connection) => connection.hostOnly === true || connection.advertiseTools === true)
1632
+ // attached MCP server (each tool appears exactly once).
1633
+ const advertisedNames = new Set(this.project.agent.connections
1634
+ .filter((connection) => connection.advertiseTools === true)
1611
1635
  .map((connection) => connection.name));
1636
+ const hostConnectionNames = new Set(((_a = this.project.agent.hostConnections) !== null && _a !== void 0 ? _a : []).map((connection) => connection.name));
1612
1637
  const bridgedNames = new Set(runtime === "cloud" &&
1613
1638
  sessionId !== undefined &&
1614
1639
  this.cloudServerToolsConnection !== undefined &&
@@ -1617,7 +1642,8 @@ export class SessionEngine {
1617
1642
  : []);
1618
1643
  assertCloudCanHonorAccountServersFilters({
1619
1644
  runtime,
1620
- resolvedConnections: this.resolvedConnections.filter((resolved) => !hostOnlyNames.has(resolved.name)),
1645
+ resolvedConnections: this.resolvedConnections.filter((resolved) => !advertisedNames.has(resolved.name) &&
1646
+ !hostConnectionNames.has(resolved.name)),
1621
1647
  bridgedNames,
1622
1648
  });
1623
1649
  const bridgeTransport = (name) => sessionId === undefined || !bridgedNames.has(name)
@@ -1625,7 +1651,8 @@ export class SessionEngine {
1625
1651
  : this.cloudBridgeTransport(sessionId, name);
1626
1652
  const servers = {};
1627
1653
  for (const connection of this.project.agent.connections) {
1628
- if (hostOnlyNames.has(connection.name)) {
1654
+ if (advertisedNames.has(connection.name) ||
1655
+ hostConnectionNames.has(connection.name)) {
1629
1656
  continue;
1630
1657
  }
1631
1658
  if (isSymbolicConnectionTransport(connection.transport)) {
@@ -1661,7 +1688,8 @@ export class SessionEngine {
1661
1688
  servers[connection.name] = connection.transport;
1662
1689
  }
1663
1690
  for (const resolved of this.resolvedConnections) {
1664
- if (hostOnlyNames.has(resolved.name)) {
1691
+ if (advertisedNames.has(resolved.name) ||
1692
+ hostConnectionNames.has(resolved.name)) {
1665
1693
  continue;
1666
1694
  }
1667
1695
  const url = runtime === "cloud" ? resolved.cloudUrl : resolved.localUrl;
@@ -1698,14 +1726,12 @@ export class SessionEngine {
1698
1726
  }
1699
1727
  /**
1700
1728
  * True when a connection with per-session `auth` attaches to the model
1701
- * (not `hostOnly`, not advertised). These turns set
1729
+ * (not advertised). These turns set
1702
1730
  * {@link RunnerTurnRequest.perSendMcpServers} so the evaluated headers
1703
1731
  * ride every send instead of being pinned on the cached agent handle.
1704
1732
  */
1705
1733
  hasAttachedAuthedConnections() {
1706
- return this.project.agent.connections.some((connection) => connection.auth !== undefined &&
1707
- connection.hostOnly !== true &&
1708
- connection.advertiseTools !== true);
1734
+ return this.project.agent.connections.some((connection) => connection.auth !== undefined && connection.advertiseTools !== true);
1709
1735
  }
1710
1736
  /**
1711
1737
  * Evaluate per-session connection auth (`defineConnection({ auth })`)
@@ -1716,9 +1742,7 @@ export class SessionEngine {
1716
1742
  */
1717
1743
  evaluateConnectionAuth(record) {
1718
1744
  return __awaiter(this, void 0, void 0, function* () {
1719
- const authed = this.project.agent.connections.filter((connection) => connection.auth !== undefined &&
1720
- connection.hostOnly !== true &&
1721
- connection.advertiseTools !== true);
1745
+ const authed = this.project.agent.connections.filter((connection) => connection.auth !== undefined && connection.advertiseTools !== true);
1722
1746
  if (authed.length === 0) {
1723
1747
  return undefined;
1724
1748
  }
@@ -2021,61 +2045,184 @@ export class SessionEngine {
2021
2045
  * with the same `{ content, isError }` envelope the model would see, not
2022
2046
  * an exception.
2023
2047
  */
2024
- callTool(toolName_1) {
2025
- return __awaiter(this, arguments, void 0, function* (toolName, input = {}, options = {}) {
2026
- var _a;
2027
- const tool = this.project.agent.tools.find((t) => t.name === toolName);
2028
- if (tool === undefined) {
2029
- throw new UnknownToolError(toolName, this.project.agent.tools
2030
- .filter((t) => t.execution === "server")
2031
- .map((t) => t.name));
2032
- }
2033
- const execute = tool.definition.execute;
2034
- if (tool.execution !== "server" || typeof execute !== "function") {
2035
- throw new ToolNotDirectlyCallableError(toolName);
2036
- }
2037
- const validation = validateToolInput(tool.definition.inputSchema, input);
2038
- if (!validation.ok) {
2039
- throw new ToolInputError({ toolName, detail: validation.message });
2048
+ /**
2049
+ * The session identity a direct call (or catalog listing) runs under:
2050
+ * an explicit sessionId, a continuation token resolved to a live (or
2051
+ * restorable) session with the same owner/busy checks a sessionId call
2052
+ * gets, or when neither maps to a session — a synthetic identity
2053
+ * carrying the token's channel id and continuation key so binding
2054
+ * resolvers (e.g. VFS mounts) can still serve the call.
2055
+ */
2056
+ resolveDirectCallIdentity(callId, options) {
2057
+ return __awaiter(this, void 0, void 0, function* () {
2058
+ var _a, _b, _c;
2059
+ if (options.sessionId !== undefined &&
2060
+ options.continuationToken !== undefined) {
2061
+ throw new InvalidContinuationTokenError("mutually exclusive with sessionId — a real session already carries its own continuation key");
2040
2062
  }
2041
- const callId = newToolCallId(toolName);
2042
2063
  const auth = (_a = options.auth) !== null && _a !== void 0 ? _a : null;
2043
2064
  let record;
2044
- let session;
2045
- let workspaceDir;
2046
- let scratchDir;
2065
+ let continuation = null;
2047
2066
  if (options.sessionId !== undefined) {
2048
2067
  record = yield this.sessions.get(options.sessionId);
2049
2068
  if (record === undefined) {
2050
2069
  throw new UnknownSessionError(options.sessionId);
2051
2070
  }
2071
+ }
2072
+ else if (options.continuationToken !== undefined) {
2073
+ continuation = parseContinuationToken(options.continuationToken);
2074
+ if (continuation === null) {
2075
+ throw new InvalidContinuationTokenError(`expected "<channelId>:<key>" (as /v1/sessions lists it), got "${options.continuationToken}"`);
2076
+ }
2077
+ // A token that maps to a live (or restorable) session takes the
2078
+ // session path: same owner check, same turn serialization, same
2079
+ // event recording as an explicit sessionId. Skipping those just
2080
+ // because the caller addressed the session by token would fail open.
2081
+ record = (_b = (yield this.sessions.findByContinuation(continuation.channelId, continuation.key))) !== null && _b !== void 0 ? _b : (yield this.restoreSessionByContinuation(continuation.channelId, continuation.key));
2082
+ if (record !== undefined && !samePrincipal(record.auth, auth)) {
2083
+ throw new SessionAuthError(record.sessionId);
2084
+ }
2085
+ }
2086
+ if (record !== undefined) {
2052
2087
  // Direct calls respect the same serialization as follow-up sends: a
2053
2088
  // running model turn owns the session workspace and event stream.
2054
2089
  if (this.activeTurns.has(record.sessionId) ||
2055
2090
  this.pendingTurns.has(record.sessionId)) {
2056
2091
  throw new SessionBusyError(record.sessionId);
2057
2092
  }
2058
- session = this.sessionInfo(record);
2059
- workspaceDir = this.harnessCwd(record);
2093
+ return {
2094
+ record,
2095
+ session: this.sessionInfo(record),
2096
+ workspaceDir: this.harnessCwd(record),
2097
+ scratchDir: undefined,
2098
+ };
2060
2099
  }
2061
- else {
2062
- session = {
2100
+ // No session behind the token (or no token at all): a synthetic
2101
+ // session carries the token's channel id and key, so binding resolvers
2102
+ // keyed on the continuation key (e.g. VFS mounts) can serve the call
2103
+ // with no live session. The workspace stays scratch and nothing is
2104
+ // recorded on a session event stream.
2105
+ const scratchDir = join(this.stateRoot, "tool-calls", callId);
2106
+ return {
2107
+ record: undefined,
2108
+ session: {
2063
2109
  id: callId,
2064
- channelId: DIRECT_TOOL_CALL_CHANNEL_ID,
2110
+ channelId: (_c = continuation === null || continuation === void 0 ? void 0 : continuation.channelId) !== null && _c !== void 0 ? _c : DIRECT_TOOL_CALL_CHANNEL_ID,
2065
2111
  mode: "task",
2112
+ continuationKey: continuation === null || continuation === void 0 ? void 0 : continuation.key,
2066
2113
  auth,
2067
- };
2114
+ },
2115
+ workspaceDir: scratchDir,
2116
+ scratchDir,
2117
+ };
2118
+ });
2119
+ }
2120
+ /**
2121
+ * The live tool catalog for one session identity: authored server tools
2122
+ * plus the advertised passthroughs a turn under the same identity would
2123
+ * see, under their model-facing names. A connection whose listing fails
2124
+ * is skipped and reported in `connectionErrors` — the inspection surface
2125
+ * degrades legibly instead of hiding every other tool behind one broken
2126
+ * connector.
2127
+ */
2128
+ listCatalogTools() {
2129
+ return __awaiter(this, arguments, void 0, function* (options = {}) {
2130
+ const { session } = yield this.resolveDirectCallIdentity(newToolCallId("catalog"), options);
2131
+ const connectionErrors = [];
2132
+ const advertised = yield resolveAdvertisedTools({
2133
+ agent: this.project.agent,
2134
+ session,
2135
+ hostMcp: this.mcpHost,
2136
+ onConnectionError: (connection, error) => {
2137
+ connectionErrors.push({
2138
+ connection,
2139
+ message: error instanceof Error ? error.message : String(error),
2140
+ });
2141
+ },
2142
+ });
2143
+ return {
2144
+ tools: [...this.project.agent.tools, ...advertised],
2145
+ connectionErrors,
2146
+ };
2147
+ });
2148
+ }
2149
+ callTool(toolName_1) {
2150
+ return __awaiter(this, arguments, void 0, function* (toolName, input = {}, options = {}) {
2151
+ const callId = newToolCallId(toolName);
2152
+ // Identity resolves before the tool lookup: advertised connection tools
2153
+ // only exist relative to a session (per-session auth), so finding them
2154
+ // needs the same identity the call runs under.
2155
+ const identity = yield this.resolveDirectCallIdentity(callId, options);
2156
+ const record = identity.record;
2157
+ const session = identity.session;
2158
+ let workspaceDir = identity.workspaceDir;
2159
+ let scratchDir = identity.scratchDir;
2160
+ let tool = this.project.agent.tools.find((t) => t.name === toolName);
2161
+ if (tool === undefined &&
2162
+ this.project.agent.connections.some((c) => c.advertiseTools === true)) {
2163
+ // Advertised passthroughs are ordinary server tools in the session's
2164
+ // namespace; resolve the live listing so direct calls address them by
2165
+ // the same model-facing name a turn would. A listing failure fails
2166
+ // the call closed, like it fails a turn.
2167
+ const advertised = yield resolveAdvertisedTools({
2168
+ agent: this.project.agent,
2169
+ session,
2170
+ hostMcp: this.mcpHost,
2171
+ });
2172
+ tool = advertised.find((t) => t.name === toolName);
2173
+ }
2174
+ if (tool === undefined) {
2175
+ throw new UnknownToolError(toolName, this.project.agent.tools
2176
+ .filter((t) => t.execution === "server")
2177
+ .map((t) => t.name));
2178
+ }
2179
+ const execute = tool.definition.execute;
2180
+ if (tool.execution !== "server" || typeof execute !== "function") {
2181
+ throw new ToolNotDirectlyCallableError(toolName);
2182
+ }
2183
+ const validation = validateToolInput(tool.definition.inputSchema, input);
2184
+ if (!validation.ok) {
2185
+ throw new ToolInputError({ toolName, detail: validation.message });
2186
+ }
2187
+ let workspaceUnavailable = false;
2188
+ try {
2189
+ yield mkdir(workspaceDir, { recursive: true });
2190
+ }
2191
+ catch (error) {
2192
+ if (record === undefined) {
2193
+ throw error;
2194
+ }
2195
+ // A session's harness cwd can be a path the serving process cannot
2196
+ // create (e.g. an absolute `local.cwd` like /repo on a hosted pod
2197
+ // where the sandboxed harness would have made it). Read-effect calls
2198
+ // fall back to a scratch workspace instead of failing: tools that
2199
+ // resolve their state from the session identity (VFS mounts) never
2200
+ // touch ctx.workspaceDir. Advertised passthroughs are relocatable by
2201
+ // construction: their execute body forwards to the connection and
2202
+ // never reads the workspace. A write (or undeclared, which resolves
2203
+ // to write) authored tool may rely on ctx.workspaceDir being the
2204
+ // real session workspace, so silently relocating it is not safe —
2205
+ // fail typed instead.
2206
+ const relocatable = tool.advertised === true ||
2207
+ resolveEffect(tool.definition.effect, validation.value) === "read";
2208
+ if (!relocatable) {
2209
+ throw new WorkspaceUnavailableError(toolName, error);
2210
+ }
2211
+ this.logger(`[session] tool ${toolName} workspace unavailable (direct ${callId}); using scratch: ${error instanceof Error ? error.message : String(error)}`);
2068
2212
  scratchDir = join(this.stateRoot, "tool-calls", callId);
2069
2213
  workspaceDir = scratchDir;
2214
+ workspaceUnavailable = true;
2215
+ yield mkdir(workspaceDir, { recursive: true });
2070
2216
  }
2071
- yield mkdir(workspaceDir, { recursive: true });
2072
2217
  // Match what a model turn would see: session workspaces get the same
2073
2218
  // scaffold as executeTurn (seeds only before the first turn); scratch
2074
2219
  // workspaces are materialized fresh.
2075
2220
  yield materializeWorkspace({
2076
2221
  agent: this.project.agent,
2077
- workspaceDir: record === undefined ? workspaceDir : this.scaffoldDir(record),
2078
- seed: record === undefined || record.turnCount === 0,
2222
+ workspaceDir: record === undefined || workspaceUnavailable
2223
+ ? workspaceDir
2224
+ : this.scaffoldDir(record),
2225
+ seed: record === undefined || workspaceUnavailable || record.turnCount === 0,
2079
2226
  stateRoot: this.stateRoot,
2080
2227
  });
2081
2228
  // A per-call turnId keeps these events visible in trajectories (which
@@ -2172,11 +2319,16 @@ export class SessionEngine {
2172
2319
  });
2173
2320
  }
2174
2321
  const errorMessage = isError ? toolCallErrorMessage(result) : undefined;
2175
- return Object.assign(Object.assign({ toolName,
2322
+ return {
2323
+ toolName,
2176
2324
  callId,
2177
2325
  isError,
2178
2326
  result,
2179
- durationMs }, (errorMessage === undefined ? {} : { errorMessage })), (record === undefined ? {} : { sessionId: record.sessionId }));
2327
+ durationMs,
2328
+ errorMessage,
2329
+ sessionId: record === null || record === void 0 ? void 0 : record.sessionId,
2330
+ scratchWorkspace: workspaceUnavailable ? true : undefined,
2331
+ };
2180
2332
  });
2181
2333
  }
2182
2334
  /**
@@ -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
+ }