@hearsay-tools/squawk 0.18.0-pr3722.6872 → 0.18.0-pr3725.6909

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 (315) hide show
  1. package/README.md +5 -10
  2. package/dist/agent-config/account-identity.js +0 -1
  3. package/dist/agent-config/account-identity.js.map +1 -1
  4. package/dist/agent-config/catalog.d.ts +0 -2
  5. package/dist/agent-config/catalog.js +3 -41
  6. package/dist/agent-config/catalog.js.map +1 -1
  7. package/dist/agent-config/models.js +0 -4
  8. package/dist/agent-config/models.js.map +1 -1
  9. package/dist/automations/service.d.ts +14 -14
  10. package/dist/ci-wait/controller.d.ts +57 -42
  11. package/dist/ci-wait/errors.js +2 -0
  12. package/dist/ci-wait/errors.js.map +1 -1
  13. package/dist/ci-wait/tool-catalog.js +1 -1
  14. package/dist/ci-wait/tool-catalog.js.map +1 -1
  15. package/dist/ci-wait/tools.d.ts +16 -1
  16. package/dist/config.d.ts +0 -2
  17. package/dist/config.js +0 -1
  18. package/dist/config.js.map +1 -1
  19. package/dist/contract/activity.d.ts +0 -7
  20. package/dist/contract/agent-config.d.ts +0 -2
  21. package/dist/contract/agent-profiles.d.ts +0 -15
  22. package/dist/contract/automation-requests.d.ts +0 -6
  23. package/dist/contract/automation-storage.d.ts +0 -6
  24. package/dist/contract/automations.d.ts +0 -18
  25. package/dist/contract/config-requests.d.ts +0 -2
  26. package/dist/contract/delegation.d.ts +0 -8
  27. package/dist/contract/discovery.d.ts +0 -8
  28. package/dist/contract/health.d.ts +0 -3
  29. package/dist/contract/index.d.ts +1 -0
  30. package/dist/contract/index.js +50 -42
  31. package/dist/contract/per-runner-optional-strings.d.ts +1 -2
  32. package/dist/contract/provider-requests.d.ts +0 -5
  33. package/dist/contract/query-requests.d.ts +0 -1
  34. package/dist/contract/run-predicates.d.ts +8 -2
  35. package/dist/contract/run-requests.d.ts +0 -1
  36. package/dist/contract/runner-facts.d.ts +2 -42
  37. package/dist/contract/runner.d.ts +4 -1
  38. package/dist/contract/runs.d.ts +42 -44
  39. package/dist/contract/waits.d.ts +37 -0
  40. package/dist/contract/workflow-file.d.ts +0 -1
  41. package/dist/contract/workflows.d.ts +0 -6
  42. package/dist/contract/workspace-events.d.ts +2 -4
  43. package/dist/contract/workspace.d.ts +1 -20
  44. package/dist/core/agent-env.js +0 -1
  45. package/dist/core/agent-env.js.map +1 -1
  46. package/dist/core/agent-profiles.js +0 -3
  47. package/dist/core/agent-profiles.js.map +1 -1
  48. package/dist/core/agent-runner.d.ts +22 -16
  49. package/dist/core/agent-runner.js +17 -2
  50. package/dist/core/agent-runner.js.map +1 -1
  51. package/dist/core/backend-detect.js +0 -14
  52. package/dist/core/backend-detect.js.map +1 -1
  53. package/dist/core/claude-cli-runner.js +5 -3
  54. package/dist/core/claude-cli-runner.js.map +1 -1
  55. package/dist/core/codex-app-server-runner.js +8 -5
  56. package/dist/core/codex-app-server-runner.js.map +1 -1
  57. package/dist/core/codex-app-server-transport.d.ts +4 -3
  58. package/dist/core/codex-app-server-transport.js +7 -6
  59. package/dist/core/codex-app-server-transport.js.map +1 -1
  60. package/dist/core/host-model-catalog.js +0 -2
  61. package/dist/core/host-model-catalog.js.map +1 -1
  62. package/dist/core/model-identity.js +0 -3
  63. package/dist/core/model-identity.js.map +1 -1
  64. package/dist/core/model-presets.js +0 -4
  65. package/dist/core/model-presets.js.map +1 -1
  66. package/dist/core/model-probe-spawn.d.ts +9 -0
  67. package/dist/core/model-probe-spawn.js +7 -0
  68. package/dist/core/model-probe-spawn.js.map +1 -0
  69. package/dist/core/omp-model-catalog.d.ts +3 -5
  70. package/dist/core/omp-model-catalog.js +3 -8
  71. package/dist/core/omp-model-catalog.js.map +1 -1
  72. package/dist/core/omp-runner.js +2 -2
  73. package/dist/core/omp-runner.js.map +1 -1
  74. package/dist/core/opencode-server-runner.js +5 -2
  75. package/dist/core/opencode-server-runner.js.map +1 -1
  76. package/dist/core/pi-model-catalog.d.ts +3 -5
  77. package/dist/core/pi-model-catalog.js +3 -7
  78. package/dist/core/pi-model-catalog.js.map +1 -1
  79. package/dist/core/pi-runner.js +2 -2
  80. package/dist/core/pi-runner.js.map +1 -1
  81. package/dist/core/process-usage.d.ts +1 -1
  82. package/dist/core/process-usage.js +1 -1
  83. package/dist/core/process-usage.js.map +1 -1
  84. package/dist/core/product-env.d.ts +0 -4
  85. package/dist/core/product-env.js +0 -6
  86. package/dist/core/product-env.js.map +1 -1
  87. package/dist/core/provider-auth.d.ts +1 -1
  88. package/dist/core/provider-auth.js +0 -29
  89. package/dist/core/provider-auth.js.map +1 -1
  90. package/dist/core/runner-cli.js +0 -2
  91. package/dist/core/runner-cli.js.map +1 -1
  92. package/dist/core/runner-factory.d.ts +1 -4
  93. package/dist/core/runner-factory.js +1 -4
  94. package/dist/core/runner-factory.js.map +1 -1
  95. package/dist/core/runner-facts.d.ts +5 -28
  96. package/dist/core/runner-facts.js +0 -20
  97. package/dist/core/runner-facts.js.map +1 -1
  98. package/dist/core/runner-model-catalog.d.ts +0 -3
  99. package/dist/core/runner-model-catalog.js +1 -25
  100. package/dist/core/runner-model-catalog.js.map +1 -1
  101. package/dist/core/session-process.d.ts +1 -6
  102. package/dist/core/session-process.js +2 -20
  103. package/dist/core/session-process.js.map +1 -1
  104. package/dist/core/ui-events.d.ts +1 -1
  105. package/dist/delegation/conversations.d.ts +24 -8
  106. package/dist/delegation/execution-identity.d.ts +3 -9
  107. package/dist/delegation/execution-identity.js +7 -1
  108. package/dist/delegation/execution-identity.js.map +1 -1
  109. package/dist/delegation/provision.js +2 -1
  110. package/dist/delegation/provision.js.map +1 -1
  111. package/dist/delegation/routes.d.ts +19 -19
  112. package/dist/delegation/transport.d.ts +19 -19
  113. package/dist/discovery/cli.js +2 -1
  114. package/dist/discovery/cli.js.map +1 -1
  115. package/dist/home/identity.d.ts +2 -6
  116. package/dist/home/identity.js +0 -2
  117. package/dist/home/identity.js.map +1 -1
  118. package/dist/managed-install/layout.d.ts +2 -3
  119. package/dist/managed-install/layout.js.map +1 -1
  120. package/dist/paths.js +1 -4
  121. package/dist/paths.js.map +1 -1
  122. package/dist/runs/legacy-run-rows.d.ts +13 -0
  123. package/dist/runs/legacy-run-rows.js +60 -0
  124. package/dist/runs/legacy-run-rows.js.map +1 -1
  125. package/dist/runs/outcome-commit.d.ts +24 -1
  126. package/dist/runs/outcome-commit.js +15 -0
  127. package/dist/runs/outcome-commit.js.map +1 -1
  128. package/dist/runs/run-exits.d.ts +68 -20
  129. package/dist/runs/run-summary-page.js +2 -0
  130. package/dist/runs/run-summary-page.js.map +1 -1
  131. package/dist/runs/store.d.ts +25 -19
  132. package/dist/runs/store.js +3 -3
  133. package/dist/runs/store.js.map +1 -1
  134. package/dist/serve-boot.d.ts +1 -1
  135. package/dist/serve-boot.js +1 -1
  136. package/dist/serve-command.d.ts +0 -2
  137. package/dist/serve-command.js +1 -2
  138. package/dist/serve-command.js.map +1 -1
  139. package/dist/serve-stop.d.ts +0 -1
  140. package/dist/serve-stop.js +0 -1
  141. package/dist/serve-stop.js.map +1 -1
  142. package/dist/server/activity-routes.d.ts +2 -2
  143. package/dist/server/fs-browse.js +2 -3
  144. package/dist/server/fs-browse.js.map +1 -1
  145. package/dist/server/open-in-app.js +0 -1
  146. package/dist/server/open-in-app.js.map +1 -1
  147. package/dist/server/reports-api.d.ts +2 -2
  148. package/dist/server/server.d.ts +363 -234
  149. package/dist/server/server.js +10 -37
  150. package/dist/server/server.js.map +1 -1
  151. package/dist/server-install/steps.js +0 -1
  152. package/dist/server-install/steps.js.map +1 -1
  153. package/dist/skills-remote.d.ts +1 -1
  154. package/dist/skills-remote.js +1 -1
  155. package/dist/skills-remote.js.map +1 -1
  156. package/dist/workflows/continuation-admission.d.ts +26 -13
  157. package/dist/workflows/continuation-admission.js +16 -13
  158. package/dist/workflows/continuation-admission.js.map +1 -1
  159. package/dist/workflows/run/continuation-session.d.ts +1 -2
  160. package/dist/workflows/run/continuation-session.js +1 -5
  161. package/dist/workflows/run/continuation-session.js.map +1 -1
  162. package/dist/workflows/run/done-accepted.d.ts +36 -0
  163. package/dist/workflows/run/done-accepted.js +123 -0
  164. package/dist/workflows/run/done-accepted.js.map +1 -0
  165. package/dist/workflows/run/input-delivery.d.ts +19 -9
  166. package/dist/workflows/run/input-delivery.js +55 -17
  167. package/dist/workflows/run/input-delivery.js.map +1 -1
  168. package/dist/workflows/run/launch-read-resolver.d.ts +11 -14
  169. package/dist/workflows/run/launch-read-resolver.js +8 -22
  170. package/dist/workflows/run/launch-read-resolver.js.map +1 -1
  171. package/dist/workflows/run/queued-revival.d.ts +2 -2
  172. package/dist/workflows/run/queued-revival.js +17 -6
  173. package/dist/workflows/run/queued-revival.js.map +1 -1
  174. package/dist/workflows/run/run-finish.d.ts +11 -7
  175. package/dist/workflows/run/run-finish.js +33 -10
  176. package/dist/workflows/run/run-finish.js.map +1 -1
  177. package/dist/workflows/run/run-skills.d.ts +2 -2
  178. package/dist/workflows/run/run-skills.js +3 -4
  179. package/dist/workflows/run/run-skills.js.map +1 -1
  180. package/dist/workflows/run/session-events.js +1 -2
  181. package/dist/workflows/run/session-events.js.map +1 -1
  182. package/dist/workflows/run/turn-boundary.d.ts +6 -5
  183. package/dist/workflows/run/turn-boundary.js +8 -11
  184. package/dist/workflows/run/turn-boundary.js.map +1 -1
  185. package/dist/workflows/run/turn-nudges.d.ts +1 -1
  186. package/dist/workflows/run/turn-nudges.js +2 -2
  187. package/dist/workflows/run/turn-nudges.js.map +1 -1
  188. package/dist/workflows/run/turn-settler.d.ts +45 -4
  189. package/dist/workflows/run/turn-settler.js +85 -9
  190. package/dist/workflows/run/turn-settler.js.map +1 -1
  191. package/dist/workflows/run/types.d.ts +3 -1
  192. package/dist/workflows/run/wait-engine.d.ts +12 -4
  193. package/dist/workflows/run/wait-kinds.d.ts +5 -0
  194. package/dist/workflows/run/wait-kinds.js +13 -0
  195. package/dist/workflows/run/wait-kinds.js.map +1 -1
  196. package/dist/workflows/run-scheduling.js +4 -0
  197. package/dist/workflows/run-scheduling.js.map +1 -1
  198. package/dist/workflows/run-states.js +1 -1
  199. package/dist/workflows/run-states.js.map +1 -1
  200. package/dist/workflows/run.js +12 -0
  201. package/dist/workflows/run.js.map +1 -1
  202. package/dist/workflows/turn-end.d.ts +8 -1
  203. package/dist/workflows/turn-end.js +6 -0
  204. package/dist/workflows/turn-end.js.map +1 -1
  205. package/dist/workflows/types.js +0 -1
  206. package/dist/workflows/types.js.map +1 -1
  207. package/dist/workspace/agent-accounts.d.ts +1 -5
  208. package/dist/workspace/agent-accounts.js +0 -1
  209. package/dist/workspace/agent-accounts.js.map +1 -1
  210. package/dist/workspace/config.d.ts +1 -3
  211. package/dist/workspace/config.js +0 -1
  212. package/dist/workspace/config.js.map +1 -1
  213. package/package.json +4 -4
  214. package/scripts/mock-ci-tool.mjs +2 -15
  215. package/scripts/mock-deferred-turn-start.mjs +1 -1
  216. package/scripts/mock-provider-failures.mjs +0 -9
  217. package/scripts/mock-scenario.d.mts +1 -1
  218. package/scripts/mock-scenario.mjs +2 -2
  219. package/web/dist/assets/activity-motion-DXtoOkpz.js +2 -0
  220. package/web/dist/assets/{activity-route-rhYVhpXu.js → activity-route-r-em7Y-G.js} +1 -1
  221. package/web/dist/assets/agent-accounts-DuMsyDoO.js +18 -0
  222. package/web/dist/assets/attention-CB_z05E7.js +1 -0
  223. package/web/dist/assets/{cez-idle-BqmM5iRr.js → cez-idle-D49bY6KR.js} +1 -1
  224. package/web/dist/assets/{commit-diff-panel-CZAQ_wMQ.js → commit-diff-panel-BGLQaKRb.js} +1 -1
  225. package/web/dist/assets/diff-BRFJnYsC.js +3 -0
  226. package/web/dist/assets/{diff-view-Bn7tV6S7.js → diff-view-JWqbvzMs.js} +3 -3
  227. package/web/dist/assets/{file-preview-1f8vPVsK.js → file-preview-BW__Krxm.js} +1 -1
  228. package/web/dist/assets/{git-toolbar-BbY7l1x9.js → git-toolbar-DoXf_s-G.js} +1 -1
  229. package/web/dist/assets/{github-CTdrVztq.js → github-CijmslJ6.js} +1 -1
  230. package/web/dist/assets/{global-activity-route-xvY0P60v.js → global-activity-route-B2EeYnAW.js} +1 -1
  231. package/web/dist/assets/index-BHoqo9RG.js +17 -0
  232. package/web/dist/assets/{index-DTIPJ2b8.css → index-Ci54Zqis.css} +1 -1
  233. package/web/dist/assets/{live-protocol-BmbbwF5R.js → live-protocol-DHEBTIRD.js} +1 -1
  234. package/web/dist/assets/preview-pane-connected-D6vrA6hJ.js +3 -0
  235. package/web/dist/assets/{project-router-BqAKGSaS.js → project-router-C5EZmTkk.js} +1 -1
  236. package/web/dist/assets/project-scope-context-HUq7jkZN.js +4 -0
  237. package/web/dist/assets/{prompt-template-menu-DpCrLDWG.js → prompt-template-menu-DOYsMTKv.js} +1 -1
  238. package/web/dist/assets/queries-BXHx1ZPw.js +1 -0
  239. package/web/dist/assets/{reference-chip-Dd_YU2KX.js → reference-chip-CjJnlcQb.js} +1 -1
  240. package/web/dist/assets/{repo-git-BrkR6pTH.js → repo-git-CyRoQgtr.js} +1 -1
  241. package/web/dist/assets/{report-reader-BeZdoVhf.js → report-reader-BJiEbYfZ.js} +1 -1
  242. package/web/dist/assets/reports-Ddn-WBxa.js +1 -0
  243. package/web/dist/assets/run-header-B7qHisMu.js +2 -0
  244. package/web/dist/assets/runner-facts-BpvNgJqf.js +1 -0
  245. package/web/dist/assets/skills-D2wzJWpY.js +1 -0
  246. package/web/dist/assets/{tab-link-CGzPcVvS.js → tab-link-B_gKjZgM.js} +1 -1
  247. package/web/dist/assets/{task-changes-f9ldtHuA.js → task-changes-CqKQIYHP.js} +1 -1
  248. package/web/dist/assets/{task-commits-CLjEhkFM.js → task-commits-CY7XFJBU.js} +1 -1
  249. package/web/dist/assets/{task-files-BEKlg0dR.js → task-files-CW1gWAY3.js} +1 -1
  250. package/web/dist/assets/{task-github-item-CbdPCKot.js → task-github-item-Djq-z2As.js} +1 -1
  251. package/web/dist/assets/task-thread-DyZ9WjLc.js +9 -0
  252. package/web/dist/assets/{thread-state-ZdBez7Ij.js → thread-state-Dbru_dO3.js} +1 -1
  253. package/web/dist/assets/use-desktop-BCMH-x7R.js +1 -0
  254. package/web/dist/assets/{use-hand-to-agent-state-BOD9cT6o.js → use-hand-to-agent-state-C94Si0KS.js} +1 -1
  255. package/web/dist/assets/{useInfiniteQuery-DYAQvmMU.js → useInfiniteQuery-O53uZ95W.js} +1 -1
  256. package/web/dist/assets/useQuery-C9ErlZEv.js +1 -0
  257. package/web/dist/assets/workflows-CwS6zbSa.js +7 -0
  258. package/web/dist/assets/{ws-BXpZYApG.js → ws-CRnL5yIc.js} +1 -1
  259. package/web/dist/index.html +16 -15
  260. package/web/dist/live-worker.js +1 -1
  261. package/dist/core/cursor-cli-flags.d.ts +0 -19
  262. package/dist/core/cursor-cli-flags.js +0 -47
  263. package/dist/core/cursor-cli-flags.js.map +0 -1
  264. package/dist/core/cursor-config-options.d.ts +0 -18
  265. package/dist/core/cursor-config-options.js +0 -31
  266. package/dist/core/cursor-config-options.js.map +0 -1
  267. package/dist/core/cursor-model-catalog.d.ts +0 -50
  268. package/dist/core/cursor-model-catalog.js +0 -306
  269. package/dist/core/cursor-model-catalog.js.map +0 -1
  270. package/dist/core/cursor-print-capabilities.d.ts +0 -14
  271. package/dist/core/cursor-print-capabilities.js +0 -169
  272. package/dist/core/cursor-print-capabilities.js.map +0 -1
  273. package/dist/core/cursor-print-process.d.ts +0 -36
  274. package/dist/core/cursor-print-process.js +0 -117
  275. package/dist/core/cursor-print-process.js.map +0 -1
  276. package/dist/core/cursor-print-runner.d.ts +0 -50
  277. package/dist/core/cursor-print-runner.js +0 -579
  278. package/dist/core/cursor-print-runner.js.map +0 -1
  279. package/dist/core/cursor-print-tool-catalog.d.ts +0 -3
  280. package/dist/core/cursor-print-tool-catalog.js +0 -13
  281. package/dist/core/cursor-print-tool-catalog.js.map +0 -1
  282. package/dist/core/cursor-print-ui-mapper.d.ts +0 -47
  283. package/dist/core/cursor-print-ui-mapper.js +0 -574
  284. package/dist/core/cursor-print-ui-mapper.js.map +0 -1
  285. package/dist/core/cursor-provider-error.d.ts +0 -9
  286. package/dist/core/cursor-provider-error.js +0 -15
  287. package/dist/core/cursor-provider-error.js.map +0 -1
  288. package/dist/core/cursor-runner.d.ts +0 -53
  289. package/dist/core/cursor-runner.js +0 -145
  290. package/dist/core/cursor-runner.js.map +0 -1
  291. package/dist/core/disclaim-spawn.d.ts +0 -11
  292. package/dist/core/disclaim-spawn.js +0 -60
  293. package/dist/core/disclaim-spawn.js.map +0 -1
  294. package/dist/desktop-supervisor.d.ts +0 -10
  295. package/dist/desktop-supervisor.js +0 -52
  296. package/dist/desktop-supervisor.js.map +0 -1
  297. package/scripts/mock-cursor-hang-stdin-late.mjs +0 -35
  298. package/scripts/mock-cursor-hang-stdin.mjs +0 -30
  299. package/scripts/mock-cursor-print.mjs +0 -237
  300. package/scripts/probe-cursor-print.mjs +0 -699
  301. package/web/dist/assets/activity-motion-awuRigEi.js +0 -2
  302. package/web/dist/assets/agent-accounts-D3q1WLxk.js +0 -18
  303. package/web/dist/assets/attention-CdwMIvQG.js +0 -1
  304. package/web/dist/assets/diff-BDJ4xGSd.js +0 -3
  305. package/web/dist/assets/index-MgNz22Tg.js +0 -17
  306. package/web/dist/assets/preview-pane-connected-D6TfZFTU.js +0 -3
  307. package/web/dist/assets/project-scope-context-B0yKt2yI.js +0 -4
  308. package/web/dist/assets/queries-DoYRza8s.js +0 -1
  309. package/web/dist/assets/reports-D93WfzdD.js +0 -1
  310. package/web/dist/assets/run-header-FB4j_Fjm.js +0 -2
  311. package/web/dist/assets/skills-BV3eF6mC.js +0 -1
  312. package/web/dist/assets/task-thread-BPSL3OMS.js +0 -9
  313. package/web/dist/assets/use-desktop-BwkqVHep.js +0 -1
  314. package/web/dist/assets/useQuery-CnVG8NoC.js +0 -1
  315. package/web/dist/assets/workflows-Driy32Xn.js +0 -7
@@ -1,15 +0,0 @@
1
- /**
2
- * Cursor provider error text (#443). Cursor wraps a provider failure in a literal `\n\nError: `
3
- * prefix. Print sessions embed the text in a run error and transcript, so it is reduced to one
4
- * line and capped.
5
- */
6
- /** Preserved provider text is diagnosis, not transcript bulk — cap it. */
7
- export const CURSOR_PROVIDER_ERROR_MAX_CHARS = 500;
8
- const ENVELOPE_PREFIX_RE = /^\n\nError: /u;
9
- const CONTROL_RE = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/gu;
10
- /** Strip the envelope prefix, control characters and runs of whitespace, then cap for display. */
11
- export function sanitizeCursorProviderError(text) {
12
- return text.replace(ENVELOPE_PREFIX_RE, '').replace(CONTROL_RE, ' ').replace(/\s+/g, ' ').trim()
13
- .slice(0, CURSOR_PROVIDER_ERROR_MAX_CHARS);
14
- }
15
- //# sourceMappingURL=cursor-provider-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cursor-provider-error.js","sourceRoot":"","sources":["../../src/core/cursor-provider-error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAEnD,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAC3C,MAAM,UAAU,GAAG,kDAAkD,CAAC;AAEtE,kGAAkG;AAClG,MAAM,UAAU,2BAA2B,CAAC,IAAY;IACtD,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE;SAC7F,KAAK,CAAC,CAAC,EAAE,+BAA+B,CAAC,CAAC;AAC/C,CAAC"}
@@ -1,53 +0,0 @@
1
- import type { SessionTransport } from '../contract/index.js';
2
- import type { AgentEvent, AgentRunResult, AgentRunner, AgentRunSpec, AgentSession, InputDelivery, SessionOptions } from './agent-runner.ts';
3
- import type { CursorPrintCapabilityResult } from './cursor-print-capabilities.ts';
4
- import type { ModelOption } from './runner-model-catalog.ts';
5
- export interface CursorRunnerOptions {
6
- sessionTransport?: SessionTransport;
7
- bin?: string;
8
- inspect?: (bin: string, spec: AgentRunSpec, signal?: AbortSignal) => Promise<CursorPrintCapabilityResult>;
9
- makePrint?: (models?: readonly ModelOption[], resolvedModel?: string) => AgentRunner;
10
- }
11
- /** A Continue of a session that ran on the removed ACP transport (hearsay-tools/cezarion#1267). */
12
- export declare const CURSOR_ACP_RESUME_REFUSED: string;
13
- /** The step error for a Cursor build that fails print qualification (hearsay-tools/cezarion#1267). */
14
- export declare function cursorPrintUnsupportedMessage(reason: string): string;
15
- /**
16
- * Runs every Cursor session on print, after a pre-inference qualification check. ACP sessions
17
- * were removed in hearsay-tools/cezarion#1267: a resume recorded on ACP, or an untagged resume
18
- * from before print existed, fails before any session starts, and so does an unqualified build.
19
- */
20
- export declare class CursorRunner implements AgentRunner {
21
- private readonly options;
22
- readonly backend: 'cursor';
23
- readonly specSupport: Readonly<Record<keyof AgentRunSpec, import("./agent-runner.ts").SpecFieldSupport>>;
24
- readonly facts: {
25
- readonly childWork: 'none';
26
- readonly hookEvents: 'none';
27
- readonly nativePermission: 'none';
28
- readonly transport: 'stdio';
29
- readonly humanPromptHold: 'turn-end';
30
- readonly inputDelivery: {
31
- readonly mode: 'boundary';
32
- readonly consumption: 'unobservable';
33
- readonly acknowledgement: 'model-work';
34
- readonly humanInputAtTurnEnd: 'always-held';
35
- readonly via: 'next exact-resume print process';
36
- };
37
- readonly systemPromptOnResume: 'in-thread';
38
- readonly nativeAsk: 'auto-skipped';
39
- readonly nativeSubagents: 'unreported';
40
- readonly nativeTimerTool: null;
41
- readonly costReport: 'per-turn';
42
- readonly sessionIdSource: 'native';
43
- readonly claudeModelAliases: false;
44
- readonly turnStart: 'on-wire';
45
- };
46
- readonly systemPromptOnResume: "in-thread";
47
- readonly inputDelivery: InputDelivery;
48
- private lastSession?;
49
- constructor(options?: CursorRunnerOptions);
50
- startSession(spec: AgentRunSpec, onEvent?: (event: AgentEvent) => void, opts?: SessionOptions): AgentSession;
51
- interrupt(): Promise<void>;
52
- run(spec: AgentRunSpec, onEvent?: (event: AgentEvent) => void): Promise<AgentRunResult>;
53
- }
@@ -1,145 +0,0 @@
1
- import { productEnv } from './product-env.js';
2
- import { fileURLToPath } from 'node:url';
3
- import { RUNNER_FACTS } from './runner-facts.js';
4
- import { CursorPrintRunner, CURSOR_PRINT_SPEC_SUPPORT } from './cursor-print-runner.js';
5
- import { inspectCursorPrintCapabilities } from './cursor-print-capabilities.js';
6
- import { productName } from '../home/display.js';
7
- /** A Continue of a session that ran on the removed ACP transport (hearsay-tools/cezarion#1267). */
8
- export const CURSOR_ACP_RESUME_REFUSED = `This Cursor session was started on the ACP transport, which ${productName('Cezarion')} no longer `
9
- + 'supports, so it cannot resume. Start a new task to continue this work.';
10
- /** The step error for a Cursor build that fails print qualification (hearsay-tools/cezarion#1267). */
11
- export function cursorPrintUnsupportedMessage(reason) {
12
- return `Cursor CLI cannot run this task: ${reason}. Run "agent update" to install a supported Cursor CLI, `
13
- + `or update ${productName('Cezarion')} if your build is newer than this version supports.`;
14
- }
15
- /**
16
- * Runs every Cursor session on print, after a pre-inference qualification check. ACP sessions
17
- * were removed in hearsay-tools/cezarion#1267: a resume recorded on ACP, or an untagged resume
18
- * from before print existed, fails before any session starts, and so does an unqualified build.
19
- */
20
- export class CursorRunner {
21
- options;
22
- backend = 'cursor';
23
- specSupport = CURSOR_PRINT_SPEC_SUPPORT;
24
- facts = RUNNER_FACTS.cursor;
25
- systemPromptOnResume = this.facts.systemPromptOnResume;
26
- inputDelivery = this.facts.inputDelivery;
27
- lastSession;
28
- constructor(options = {}) {
29
- this.options = options;
30
- }
31
- startSession(spec, onEvent, opts = {}) {
32
- const bundledPrintMock = fileURLToPath(new URL('../../scripts/mock-cursor-print.mjs', import.meta.url));
33
- const bin = this.options.bin ?? productEnv('CURSOR_BIN') ?? (productEnv('DRY_RUN') === '1'
34
- ? bundledPrintMock : 'agent');
35
- const isBundledMock = bin === bundledPrintMock;
36
- const mockModels = [
37
- { id: 'mock-default-model', label: 'Mock default', description: 'Default model' },
38
- { id: 'mock-default-model-xhigh', label: 'Mock high effort', description: 'Mock high effort' },
39
- ];
40
- const select = async (signal) => {
41
- // An untagged resume predates print sessions, so its native ID belongs to ACP.
42
- if (spec.resume && this.options.sessionTransport !== 'cursor-print')
43
- throw new Error(CURSOR_ACP_RESUME_REFUSED);
44
- if (isBundledMock) {
45
- return { models: spec.effort ? mockModels : undefined,
46
- model: spec.effort && !spec.model ? 'mock-default-model' : undefined };
47
- }
48
- const capability = await (this.options.inspect ?? inspectCursorPrintCapabilities)(bin, spec, signal);
49
- if (!capability.supported)
50
- throw new Error(cursorPrintUnsupportedMessage(capability.reason));
51
- return { models: capability.models, model: capability.model, resolvedModel: capability.resolvedModel };
52
- };
53
- const makeRunner = (models, resolvedModel) => this.options.makePrint?.(models, resolvedModel)
54
- ?? new CursorPrintRunner({ bin: this.options.bin, models, resolvedModel });
55
- return this.lastSession = new SelectingCursorSession(select, makeRunner, spec, onEvent, opts);
56
- }
57
- async interrupt() { this.lastSession?.interrupt(); }
58
- run(spec, onEvent) {
59
- return this.startSession(spec, onEvent, { autoEndAfterFirstTurn: true }).result;
60
- }
61
- }
62
- class SelectingCursorSession {
63
- result;
64
- resolveResult;
65
- inner;
66
- controller = new AbortController();
67
- pendingHuman = [];
68
- active = true;
69
- settled = false;
70
- constructor(select, makeRunner, spec, onEvent, opts = {}) {
71
- this.result = new Promise(resolve => { this.resolveResult = resolve; });
72
- void (async () => {
73
- try {
74
- const { models, model, resolvedModel } = await select(this.controller.signal);
75
- if (!this.active)
76
- return;
77
- const runner = makeRunner(models, resolvedModel);
78
- const selectedSpec = model && !spec.model ? { ...spec, model } : spec;
79
- const inner = runner.startSession(selectedSpec, event => onEvent?.(event.type === 'session'
80
- ? { ...event, sessionTransport: 'cursor-print' } : event), opts);
81
- this.inner = inner;
82
- if (inner.pid !== undefined)
83
- opts.onPidChange?.(inner.pid);
84
- for (const message of this.pendingHuman.splice(0))
85
- inner.sendMessage(message);
86
- const result = await inner.result;
87
- this.settle(result);
88
- }
89
- catch (error) {
90
- if (!this.active)
91
- return;
92
- const message = error instanceof Error ? error.message : 'Cursor print qualification failed';
93
- onEvent?.({ type: 'error', message });
94
- opts.onUiEvent?.({ type: 'session.error', message, fatal: true });
95
- this.settle({ text: '', toolCalls: [], tokensUsed: 0 });
96
- }
97
- })();
98
- }
99
- settle(result) {
100
- if (this.settled)
101
- return;
102
- this.settled = true;
103
- this.active = false;
104
- this.resolveResult(result);
105
- }
106
- get pid() { return this.inner?.pid; }
107
- get open() { return this.active && (this.inner?.open ?? true); }
108
- sendMessage(content) {
109
- if (!this.open)
110
- return false;
111
- if (this.inner)
112
- return this.inner.sendMessage(content);
113
- this.pendingHuman.push(content);
114
- return true;
115
- }
116
- sendAgentMessage(content, ids) {
117
- return this.inner?.sendAgentMessage(content, ids) ?? false;
118
- }
119
- discardQueuedMessages() { this.pendingHuman = []; this.inner?.discardQueuedMessages(); }
120
- holdsHumanInput() { return this.inner?.holdsHumanInput() ?? this.pendingHuman.length > 0; }
121
- heldHumanInputCount() { return this.inner?.heldHumanInputCount?.() ?? this.pendingHuman.length; }
122
- end() {
123
- if (!this.active)
124
- return;
125
- if (this.inner)
126
- this.inner.end();
127
- else {
128
- this.active = false;
129
- this.controller.abort();
130
- this.settle({ text: '', toolCalls: [], tokensUsed: 0 });
131
- }
132
- }
133
- interrupt() {
134
- if (!this.active)
135
- return;
136
- if (this.inner)
137
- this.inner.interrupt();
138
- else {
139
- this.active = false;
140
- this.controller.abort();
141
- this.settle({ text: '', toolCalls: [], tokensUsed: 0 });
142
- }
143
- }
144
- }
145
- //# sourceMappingURL=cursor-runner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cursor-runner.js","sourceRoot":"","sources":["../../src/core/cursor-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,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AC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACpG,mBAAmB,KAAa,OAAO,IAAI,CAAC,KAAK,EAAE,mBAAmB,EAAE,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IACzG,GAAG;QACD,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO;QACzB,IAAI,IAAI,CAAC,KAAK;YAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;aAC5B,CAAC;YAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YAAC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;YAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;QAAC,CAAC;IACjH,CAAC;IACD,SAAS;QACP,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO;QACzB,IAAI,IAAI,CAAC,KAAK;YAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;aAClC,CAAC;YAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YAAC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;YAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;QAAC,CAAC;IACjH,CAAC;CACF"}
@@ -1,11 +0,0 @@
1
- export declare const DISCLAIM_EXEC_FLAG = "--cez-disclaim-exec";
2
- export interface DisclaimOptions {
3
- /** Defaults to `process.platform`. */
4
- platform?: NodeJS.Platform;
5
- /** Where `CEZ_DISCLAIM_EXEC` is read from; defaults to `process.env`. */
6
- hostEnv?: NodeJS.ProcessEnv;
7
- }
8
- /** `[file, args]` to spawn so `program` runs as its own responsible process when it can. */
9
- export declare function disclaimedCommand(program: string, args: readonly string[], childEnv: NodeJS.ProcessEnv | undefined, opts?: DisclaimOptions): [string, string[]];
10
- /** One process seam for every backend, including respawns and discovery. */
11
- export declare function spawnAgent(program: string, args: readonly string[], options: import('node:child_process').SpawnOptionsWithoutStdio): import('node:child_process').ChildProcessWithoutNullStreams;
@@ -1,60 +0,0 @@
1
- import { shellProductEnv } from './product-env.js';
2
- import { spawn } from 'node:child_process';
3
- /**
4
- * macOS privacy prompts name the RESPONSIBLE process, and every process the desktop app starts
5
- * inherits the app as its responsible process. Left alone, an agent that lists `~/Documents`
6
- * raises "Squawk would like to access files in your Documents folder" — and an Allow there hands
7
- * every agent, forever, what one of them asked for.
8
- *
9
- * The desktop shell exports `CEZ_DISCLAIM_EXEC`: its own executable, which, run as
10
- * `<exe> --cez-disclaim-exec <program> <args…>`, replaces itself (same pid, same stdio) with
11
- * `program` as its own responsible process. Agent backends are started through it, so the prompt
12
- * names the agent (`claude`, `codex`, …) and a grant covers that agent only. The cockpit server
13
- * itself stays the app's — the folder picker's prompts are still Squawk's, which they should be.
14
- *
15
- * Anywhere else — no desktop shell, not macOS, a program that does not resolve — the command is
16
- * returned untouched, so a missing binary still fails the spawn with the usual ENOENT and hint.
17
- */
18
- import { accessSync, constants, statSync } from 'node:fs';
19
- import { delimiter, isAbsolute, join } from 'node:path';
20
- export const DISCLAIM_EXEC_FLAG = '--cez-disclaim-exec';
21
- /** `[file, args]` to spawn so `program` runs as its own responsible process when it can. */
22
- export function disclaimedCommand(program, args, childEnv, opts = {}) {
23
- const platform = opts.platform ?? process.platform;
24
- const trampoline = shellProductEnv('DISCLAIM_EXEC', (opts.hostEnv ?? process.env));
25
- if (platform !== 'darwin' || !trampoline || !isExecutable(trampoline))
26
- return [program, [...args]];
27
- const resolved = resolveProgram(program, childEnv?.PATH ?? process.env.PATH);
28
- if (!resolved)
29
- return [program, [...args]];
30
- return [trampoline, [DISCLAIM_EXEC_FLAG, resolved, ...args]];
31
- }
32
- function resolveProgram(program, path) {
33
- if (program.includes('/'))
34
- return isAbsolute(program) && isExecutable(program) ? program : null;
35
- for (const dir of (path ?? '').split(delimiter)) {
36
- if (!dir)
37
- continue;
38
- const candidate = join(dir, program);
39
- if (isExecutable(candidate))
40
- return candidate;
41
- }
42
- return null;
43
- }
44
- function isExecutable(path) {
45
- try {
46
- if (!statSync(path).isFile())
47
- return false;
48
- accessSync(path, constants.X_OK);
49
- return true;
50
- }
51
- catch {
52
- return false;
53
- }
54
- }
55
- /** One process seam for every backend, including respawns and discovery. */
56
- export function spawnAgent(program, args, options) {
57
- const [file, argv] = disclaimedCommand(program, args, options.env);
58
- return spawn(file, argv, options);
59
- }
60
- //# sourceMappingURL=disclaim-spawn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"disclaim-spawn.js","sourceRoot":"","sources":["../../src/core/disclaim-spawn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,CAAC,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AASxD,4FAA4F;AAC5F,MAAM,UAAU,iBAAiB,CAC/B,OAAe,EACf,IAAuB,EACvB,QAAuC,EACvC,IAAI,GAAoB,EAAE;IAE1B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IACnD,MAAM,UAAU,GAAG,eAAe,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IACnF,IAAI,QAAQ,KAAK,QAAQ,IAAI,CAAC,UAAU,IAAI,CAAC,YAAY,CAAC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AAM,UAAU,UAAU,CAAC,OAAe,EAAE,IAAuB,EAAE,OAA8D;IACjI,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,iBAAiB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IACnE,OAAO,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AACpC,CAAC"}
@@ -1,10 +0,0 @@
1
- /** A desktop child follows its supervisor down, without confusing EPERM with death. */
2
- export declare function supervisorGone(pid: number, initialPpid: number, ppid: number, probe?: (pid: number, signal?: string | number) => true): boolean;
3
- /**
4
- * Follow the desktop shell. Two stop paths, each calling `shutdown` at most once between them:
5
- * the supervisor pid going away (a force-quit shell), and, when the shell opts in with
6
- * `CEZ_SUPERVISOR_STDIN=1`, the end of stdin, which is how the shell asks for a graceful stop on
7
- * quit or before a version switch. A pipe closes the same way on Windows, where no POSIX signal
8
- * reaches us. Without the opt-in, an older shell's `/dev/null` stdin must not read as a stop.
9
- */
10
- export declare function watchSupervisor(shutdown: () => void, env?: NodeJS.ProcessEnv, stdin?: NodeJS.ReadableStream): () => void;
@@ -1,52 +0,0 @@
1
- import { shellProductEnv } from './core/product-env.js';
2
- /** A desktop child follows its supervisor down, without confusing EPERM with death. */
3
- export function supervisorGone(pid, initialPpid, ppid, probe = process.kill) {
4
- if (initialPpid > 1 && ppid !== initialPpid)
5
- return true;
6
- try {
7
- probe(pid, 0);
8
- return false;
9
- }
10
- catch (error) {
11
- return error.code === 'ESRCH';
12
- }
13
- }
14
- /**
15
- * Follow the desktop shell. Two stop paths, each calling `shutdown` at most once between them:
16
- * the supervisor pid going away (a force-quit shell), and, when the shell opts in with
17
- * `CEZ_SUPERVISOR_STDIN=1`, the end of stdin, which is how the shell asks for a graceful stop on
18
- * quit or before a version switch. A pipe closes the same way on Windows, where no POSIX signal
19
- * reaches us. Without the opt-in, an older shell's `/dev/null` stdin must not read as a stop.
20
- */
21
- export function watchSupervisor(shutdown, env = process.env, stdin = process.stdin) {
22
- if (shellProductEnv('DESKTOP', env) !== '1')
23
- return () => { };
24
- let stopped = false;
25
- const stop = () => {
26
- if (stopped)
27
- return;
28
- stopped = true;
29
- cancel();
30
- shutdown();
31
- };
32
- const cancels = [];
33
- const cancel = () => { for (const fn of cancels.splice(0))
34
- fn(); };
35
- if (shellProductEnv('SUPERVISOR_STDIN', env) === '1') {
36
- stdin.once('end', stop).once('close', stop).once('error', stop);
37
- stdin.resume();
38
- cancels.push(() => { stdin.off('end', stop).off('close', stop).off('error', stop); });
39
- }
40
- const pid = Number(shellProductEnv('SUPERVISOR_PID', env));
41
- if (Number.isInteger(pid) && pid > 1) {
42
- const initialPpid = process.ppid;
43
- const timer = setInterval(() => {
44
- if (supervisorGone(pid, initialPpid, process.ppid))
45
- stop();
46
- }, 2_000);
47
- timer.unref();
48
- cancels.push(() => clearInterval(timer));
49
- }
50
- return cancel;
51
- }
52
- //# sourceMappingURL=desktop-supervisor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"desktop-supervisor.js","sourceRoot":"","sources":["../src/desktop-supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,uFAAuF;AACvF,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,WAAmB,EAAE,IAAY,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI;IACjG,IAAI,WAAW,GAAG,CAAC,IAAI,IAAI,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IACzD,IAAI,CAAC;QAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAAC,OAAO,KAAK,CAAC;IAAC,CAAC;IACpC,OAAO,KAAK,EAAE,CAAC;QAAC,OAAQ,KAA+B,CAAC,IAAI,KAAK,OAAO,CAAC;IAAC,CAAC;AAC7E,CAAC;AACD;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,QAAoB,EAAE,GAAG,GAAG,OAAO,CA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M,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;YAC7B,IAAI,cAAc,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC;gBAAE,IAAI,EAAE,CAAC;QAC7D,CAAC,EAAE,KAAK,CAAC,CAAC;QACV,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env node
2
- // #587: the bootstrap write succeeds first, then stdin dies.
3
- //
4
- // The parent writes session/new while the pipe's read end is still open, so
5
- // that write cannot fail. The child then drops the read end and never answers
6
- // session/new. The runner's next write — the bootstrap stdin probe — is what
7
- // must surface the death, not the 15s request timeout.
8
- //
9
- // The close is three steps, and the order matters. Closing fd 0 while
10
- // readline's libuv handle still owns it aborts the child on some machines
11
- // (SIGABRT — the fixture would become a process-death test); on other
12
- // machines closeSync alone throws EBADF and never closes the read end, so the
13
- // parent's write silently succeeds and only the 15s request timeout can catch
14
- // the hang (#588). destroy() disarms the handle, closeSync(0) actually closes
15
- // the pipe's read end (destroy alone leaves the fd open). The stdin 'error'
16
- // handler swallows the EBADF from the next read attempt.
17
- import { createInterface } from 'node:readline';
18
- import { closeSync } from 'node:fs';
19
- const emit = value => process.stdout.write(`${JSON.stringify({ jsonrpc: '2.0', ...value })}\n`);
20
- const rl = createInterface({ input: process.stdin });
21
- process.stdin.on('error', () => { /* the EBADF below is intentional */ });
22
- rl.on('line', line => {
23
- let msg; try { msg = JSON.parse(line); } catch { return; }
24
- if (msg.method === 'initialize') {
25
- emit({ id: msg.id, result: { protocolVersion: 1, agentCapabilities: { loadSession: true } } });
26
- } else if (msg.method === 'session/new') {
27
- // The parent's write already succeeded into the kernel buffer; only now
28
- // does the read end die, with the child staying up.
29
- rl.close();
30
- process.stdin.destroy();
31
- try { closeSync(0); } catch { /* already closed */ }
32
- }
33
- });
34
- process.on('SIGTERM', () => { /* ignore — the child must outlive its stdin */ });
35
- setInterval(() => {}, 1e6);
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env node
2
- // #587: answers initialize, then dies on stdin while the child stays up.
3
- // The parent's next write (session/new) must hit EPIPE and surface as a fast
4
- // v1 error.
5
- //
6
- // Close before replying: a fast parent sends session/new as soon as it reads
7
- // initialize, and that write must encounter the dead input pipe. The close is
8
- // three steps, and the order matters. Closing fd 0 while readline's libuv
9
- // handle still owns it aborts the child on some machines (SIGABRT — the
10
- // fixture would become a process-death test); on other machines closeSync
11
- // alone throws EBADF and never closes the read end, so the parent's write
12
- // silently succeeds and only the 15s request timeout can catch the hang
13
- // (#588). destroy() disarms the handle, closeSync(0) actually closes the
14
- // pipe's read end (destroy alone leaves the fd open).
15
- import { createInterface } from 'node:readline';
16
- import { closeSync } from 'node:fs';
17
- const emit = value => process.stdout.write(`${JSON.stringify({ jsonrpc: '2.0', ...value })}\n`);
18
- const rl = createInterface({ input: process.stdin });
19
- process.stdin.on('error', () => { /* the EBADF below is intentional */ });
20
- rl.on('line', line => {
21
- let msg; try { msg = JSON.parse(line); } catch { return; }
22
- if (msg.method === 'initialize') {
23
- rl.close();
24
- process.stdin.destroy();
25
- try { closeSync(0); } catch { /* already closed */ }
26
- emit({ id: msg.id, result: { protocolVersion: 1, agentCapabilities: { loadSession: true } } });
27
- }
28
- });
29
- process.on('SIGTERM', () => { /* ignore — the child must outlive its stdin */ });
30
- setInterval(() => {}, 1e6);