dispach 0.1.0

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 (346) hide show
  1. package/README.md +596 -0
  2. package/dist/App-dxqm39zx.js +11 -0
  3. package/dist/App-dxqm39zx.js.map +25 -0
  4. package/dist/ConfigEditor-7v5nebvy.js +6 -0
  5. package/dist/ConfigEditor-7v5nebvy.js.map +11 -0
  6. package/dist/KeyProbe-vjhmdpx6.js +5 -0
  7. package/dist/KeyProbe-vjhmdpx6.js.map +11 -0
  8. package/dist/Picker-jxaesaxy.js +5 -0
  9. package/dist/Picker-jxaesaxy.js.map +10 -0
  10. package/dist/SessionPicker-z2t0p4b5.js +5 -0
  11. package/dist/SessionPicker-z2t0p4b5.js.map +11 -0
  12. package/dist/SkillBrowser-yyf2gy0q.js +5 -0
  13. package/dist/SkillBrowser-yyf2gy0q.js.map +11 -0
  14. package/dist/WizardApp-12ndxgqv.js +5 -0
  15. package/dist/WizardApp-12ndxgqv.js.map +13 -0
  16. package/dist/agents.d.ts +9 -0
  17. package/dist/agents.d.ts.map +1 -0
  18. package/dist/browse.d.ts +63 -0
  19. package/dist/browse.d.ts.map +1 -0
  20. package/dist/client.d.ts +25 -0
  21. package/dist/client.d.ts.map +1 -0
  22. package/dist/client.js +34 -0
  23. package/dist/client.js.map +11 -0
  24. package/dist/components/App.d.ts +28 -0
  25. package/dist/components/App.d.ts.map +1 -0
  26. package/dist/components/Banner.d.ts +16 -0
  27. package/dist/components/Banner.d.ts.map +1 -0
  28. package/dist/components/Brandmark.d.ts +31 -0
  29. package/dist/components/Brandmark.d.ts.map +1 -0
  30. package/dist/components/CheckList.d.ts +38 -0
  31. package/dist/components/CheckList.d.ts.map +1 -0
  32. package/dist/components/CommandOutput.d.ts +29 -0
  33. package/dist/components/CommandOutput.d.ts.map +1 -0
  34. package/dist/components/ConfigEditor.d.ts +64 -0
  35. package/dist/components/ConfigEditor.d.ts.map +1 -0
  36. package/dist/components/HistorySearch.d.ts +23 -0
  37. package/dist/components/HistorySearch.d.ts.map +1 -0
  38. package/dist/components/KeyProbe.d.ts +36 -0
  39. package/dist/components/KeyProbe.d.ts.map +1 -0
  40. package/dist/components/LineCursor.d.ts +55 -0
  41. package/dist/components/LineCursor.d.ts.map +1 -0
  42. package/dist/components/Live.d.ts +17 -0
  43. package/dist/components/Live.d.ts.map +1 -0
  44. package/dist/components/Palette.d.ts +21 -0
  45. package/dist/components/Palette.d.ts.map +1 -0
  46. package/dist/components/Picker.d.ts +23 -0
  47. package/dist/components/Picker.d.ts.map +1 -0
  48. package/dist/components/Prompt.d.ts +20 -0
  49. package/dist/components/Prompt.d.ts.map +1 -0
  50. package/dist/components/Screen.d.ts +39 -0
  51. package/dist/components/Screen.d.ts.map +1 -0
  52. package/dist/components/SelectList.d.ts +34 -0
  53. package/dist/components/SelectList.d.ts.map +1 -0
  54. package/dist/components/SessionPicker.d.ts +26 -0
  55. package/dist/components/SessionPicker.d.ts.map +1 -0
  56. package/dist/components/SkillBrowser.d.ts +39 -0
  57. package/dist/components/SkillBrowser.d.ts.map +1 -0
  58. package/dist/components/Spinner.d.ts +13 -0
  59. package/dist/components/Spinner.d.ts.map +1 -0
  60. package/dist/components/StatusBar.d.ts +11 -0
  61. package/dist/components/StatusBar.d.ts.map +1 -0
  62. package/dist/components/SummaryCard.d.ts +11 -0
  63. package/dist/components/SummaryCard.d.ts.map +1 -0
  64. package/dist/components/TextField.d.ts +39 -0
  65. package/dist/components/TextField.d.ts.map +1 -0
  66. package/dist/components/Transcript.d.ts +23 -0
  67. package/dist/components/Transcript.d.ts.map +1 -0
  68. package/dist/components/WizardApp.d.ts +18 -0
  69. package/dist/components/WizardApp.d.ts.map +1 -0
  70. package/dist/components/WizardFrame.d.ts +19 -0
  71. package/dist/components/WizardFrame.d.ts.map +1 -0
  72. package/dist/config-yz0nz51b.js +24 -0
  73. package/dist/config-yz0nz51b.js.map +10 -0
  74. package/dist/config.d.ts +71 -0
  75. package/dist/config.d.ts.map +1 -0
  76. package/dist/credential-wgt4gvcz.js +19 -0
  77. package/dist/credential-wgt4gvcz.js.map +10 -0
  78. package/dist/credential.d.ts +68 -0
  79. package/dist/credential.d.ts.map +1 -0
  80. package/dist/daemon.d.ts +47 -0
  81. package/dist/daemon.d.ts.map +1 -0
  82. package/dist/editor.d.ts +81 -0
  83. package/dist/editor.d.ts.map +1 -0
  84. package/dist/hooks/useElapsed.d.ts +10 -0
  85. package/dist/hooks/useElapsed.d.ts.map +1 -0
  86. package/dist/hooks/useTerminalSize.d.ts +14 -0
  87. package/dist/hooks/useTerminalSize.d.ts.map +1 -0
  88. package/dist/hooks/useTurn.d.ts +41 -0
  89. package/dist/hooks/useTurn.d.ts.map +1 -0
  90. package/dist/index-2cvtz0fy.js +903 -0
  91. package/dist/index-2cvtz0fy.js.map +194 -0
  92. package/dist/index-3nwfz9jq.js +12 -0
  93. package/dist/index-3nwfz9jq.js.map +11 -0
  94. package/dist/index-6b7qvh1x.js +6 -0
  95. package/dist/index-6b7qvh1x.js.map +10 -0
  96. package/dist/index-6z0yr17z.js +12 -0
  97. package/dist/index-6z0yr17z.js.map +11 -0
  98. package/dist/index-7da4fqcr.js +7 -0
  99. package/dist/index-7da4fqcr.js.map +11 -0
  100. package/dist/index-8bmhd2hj.js +6 -0
  101. package/dist/index-8bmhd2hj.js.map +10 -0
  102. package/dist/index-9d011p3q.js +6 -0
  103. package/dist/index-9d011p3q.js.map +10 -0
  104. package/dist/index-9f9pp2ef.js +6 -0
  105. package/dist/index-9f9pp2ef.js.map +10 -0
  106. package/dist/index-9nsfs0vy.js +6 -0
  107. package/dist/index-9nsfs0vy.js.map +10 -0
  108. package/dist/index-9pj1ws0p.js +77 -0
  109. package/dist/index-9pj1ws0p.js.map +12 -0
  110. package/dist/index-b5wwtxzk.js +66 -0
  111. package/dist/index-b5wwtxzk.js.map +12 -0
  112. package/dist/index-b8zwg8a3.js +6 -0
  113. package/dist/index-b8zwg8a3.js.map +10 -0
  114. package/dist/index-bry9bzt3.js +427 -0
  115. package/dist/index-bry9bzt3.js.map +11 -0
  116. package/dist/index-bwckzbf8.js +6 -0
  117. package/dist/index-bwckzbf8.js.map +10 -0
  118. package/dist/index-cx3vz7sf.js +6 -0
  119. package/dist/index-cx3vz7sf.js.map +11 -0
  120. package/dist/index-e8n70sgj.js +6 -0
  121. package/dist/index-e8n70sgj.js.map +11 -0
  122. package/dist/index-fvhg0xyd.js +167 -0
  123. package/dist/index-fvhg0xyd.js.map +19 -0
  124. package/dist/index-gbnc99j8.js +14 -0
  125. package/dist/index-gbnc99j8.js.map +13 -0
  126. package/dist/index-h2yds678.js +7 -0
  127. package/dist/index-h2yds678.js.map +11 -0
  128. package/dist/index-j97vttdt.js +10 -0
  129. package/dist/index-j97vttdt.js.map +10 -0
  130. package/dist/index-jk0def33.js +6 -0
  131. package/dist/index-jk0def33.js.map +12 -0
  132. package/dist/index-jym27m75.js +6 -0
  133. package/dist/index-jym27m75.js.map +10 -0
  134. package/dist/index-mgdgx22q.js +10 -0
  135. package/dist/index-mgdgx22q.js.map +10 -0
  136. package/dist/index-mrtb5y08.js +6 -0
  137. package/dist/index-mrtb5y08.js.map +11 -0
  138. package/dist/index-my5cjx00.js +6 -0
  139. package/dist/index-my5cjx00.js.map +10 -0
  140. package/dist/index-qc2vrq9z.js +7 -0
  141. package/dist/index-qc2vrq9z.js.map +11 -0
  142. package/dist/index-rqbtm761.js +6 -0
  143. package/dist/index-rqbtm761.js.map +10 -0
  144. package/dist/index-rqzg861g.js +6 -0
  145. package/dist/index-rqzg861g.js.map +10 -0
  146. package/dist/index-t1xvacym.js +6 -0
  147. package/dist/index-t1xvacym.js.map +11 -0
  148. package/dist/index-xgqzk5cq.js +9 -0
  149. package/dist/index-xgqzk5cq.js.map +12 -0
  150. package/dist/index-xqyms08r.js +6 -0
  151. package/dist/index-xqyms08r.js.map +10 -0
  152. package/dist/index-yr25dnf5.js +6 -0
  153. package/dist/index-yr25dnf5.js.map +10 -0
  154. package/dist/index.d.ts +23 -0
  155. package/dist/index.d.ts.map +1 -0
  156. package/dist/index.js +527 -0
  157. package/dist/index.js.map +48 -0
  158. package/dist/init.d.ts +34 -0
  159. package/dist/init.d.ts.map +1 -0
  160. package/dist/keymap.d.ts +126 -0
  161. package/dist/keymap.d.ts.map +1 -0
  162. package/dist/keys.d.ts +17 -0
  163. package/dist/keys.d.ts.map +1 -0
  164. package/dist/lib/ambient.d.ts +69 -0
  165. package/dist/lib/ambient.d.ts.map +1 -0
  166. package/dist/lib/args.d.ts +33 -0
  167. package/dist/lib/args.d.ts.map +1 -0
  168. package/dist/lib/bootstrap.d.ts +84 -0
  169. package/dist/lib/bootstrap.d.ts.map +1 -0
  170. package/dist/lib/browse.d.ts +89 -0
  171. package/dist/lib/browse.d.ts.map +1 -0
  172. package/dist/lib/browser.d.ts +55 -0
  173. package/dist/lib/browser.d.ts.map +1 -0
  174. package/dist/lib/chat-frame.d.ts +156 -0
  175. package/dist/lib/chat-frame.d.ts.map +1 -0
  176. package/dist/lib/clipboard.d.ts +32 -0
  177. package/dist/lib/clipboard.d.ts.map +1 -0
  178. package/dist/lib/commands.d.ts +26 -0
  179. package/dist/lib/commands.d.ts.map +1 -0
  180. package/dist/lib/composer.d.ts +85 -0
  181. package/dist/lib/composer.d.ts.map +1 -0
  182. package/dist/lib/config-apply.d.ts +51 -0
  183. package/dist/lib/config-apply.d.ts.map +1 -0
  184. package/dist/lib/config-editor.d.ts +113 -0
  185. package/dist/lib/config-editor.d.ts.map +1 -0
  186. package/dist/lib/config-env.d.ts +110 -0
  187. package/dist/lib/config-env.d.ts.map +1 -0
  188. package/dist/lib/config-rows.d.ts +37 -0
  189. package/dist/lib/config-rows.d.ts.map +1 -0
  190. package/dist/lib/config-view.d.ts +133 -0
  191. package/dist/lib/config-view.d.ts.map +1 -0
  192. package/dist/lib/confirm.d.ts +86 -0
  193. package/dist/lib/confirm.d.ts.map +1 -0
  194. package/dist/lib/const.d.ts +213 -0
  195. package/dist/lib/const.d.ts.map +1 -0
  196. package/dist/lib/csi.d.ts +70 -0
  197. package/dist/lib/csi.d.ts.map +1 -0
  198. package/dist/lib/curated.d.ts +44 -0
  199. package/dist/lib/curated.d.ts.map +1 -0
  200. package/dist/lib/daemon-plan.d.ts +151 -0
  201. package/dist/lib/daemon-plan.d.ts.map +1 -0
  202. package/dist/lib/dotenv-edit.d.ts +30 -0
  203. package/dist/lib/dotenv-edit.d.ts.map +1 -0
  204. package/dist/lib/env.d.ts +10 -0
  205. package/dist/lib/env.d.ts.map +1 -0
  206. package/dist/lib/exit.d.ts +170 -0
  207. package/dist/lib/exit.d.ts.map +1 -0
  208. package/dist/lib/help.d.ts +10 -0
  209. package/dist/lib/help.d.ts.map +1 -0
  210. package/dist/lib/init-flow.d.ts +539 -0
  211. package/dist/lib/init-flow.d.ts.map +1 -0
  212. package/dist/lib/init-skills.d.ts +46 -0
  213. package/dist/lib/init-skills.d.ts.map +1 -0
  214. package/dist/lib/keyboard.d.ts +76 -0
  215. package/dist/lib/keyboard.d.ts.map +1 -0
  216. package/dist/lib/keys-view.d.ts +57 -0
  217. package/dist/lib/keys-view.d.ts.map +1 -0
  218. package/dist/lib/launchd.d.ts +151 -0
  219. package/dist/lib/launchd.d.ts.map +1 -0
  220. package/dist/lib/lifecycle.d.ts +126 -0
  221. package/dist/lib/lifecycle.d.ts.map +1 -0
  222. package/dist/lib/log-follow.d.ts +71 -0
  223. package/dist/lib/log-follow.d.ts.map +1 -0
  224. package/dist/lib/mouse.d.ts +84 -0
  225. package/dist/lib/mouse.d.ts.map +1 -0
  226. package/dist/lib/multiselect.d.ts +37 -0
  227. package/dist/lib/multiselect.d.ts.map +1 -0
  228. package/dist/lib/origins.d.ts +40 -0
  229. package/dist/lib/origins.d.ts.map +1 -0
  230. package/dist/lib/output.d.ts +29 -0
  231. package/dist/lib/output.d.ts.map +1 -0
  232. package/dist/lib/palette.d.ts +69 -0
  233. package/dist/lib/palette.d.ts.map +1 -0
  234. package/dist/lib/probe.d.ts +158 -0
  235. package/dist/lib/probe.d.ts.map +1 -0
  236. package/dist/lib/providers.d.ts +63 -0
  237. package/dist/lib/providers.d.ts.map +1 -0
  238. package/dist/lib/provision.d.ts +163 -0
  239. package/dist/lib/provision.d.ts.map +1 -0
  240. package/dist/lib/remove-plan.d.ts +120 -0
  241. package/dist/lib/remove-plan.d.ts.map +1 -0
  242. package/dist/lib/render.d.ts +78 -0
  243. package/dist/lib/render.d.ts.map +1 -0
  244. package/dist/lib/resume.d.ts +69 -0
  245. package/dist/lib/resume.d.ts.map +1 -0
  246. package/dist/lib/rows.d.ts +69 -0
  247. package/dist/lib/rows.d.ts.map +1 -0
  248. package/dist/lib/sandbox.d.ts +101 -0
  249. package/dist/lib/sandbox.d.ts.map +1 -0
  250. package/dist/lib/schema.d.ts +491 -0
  251. package/dist/lib/schema.d.ts.map +1 -0
  252. package/dist/lib/screen.d.ts +102 -0
  253. package/dist/lib/screen.d.ts.map +1 -0
  254. package/dist/lib/scroll.d.ts +64 -0
  255. package/dist/lib/scroll.d.ts.map +1 -0
  256. package/dist/lib/select.d.ts +23 -0
  257. package/dist/lib/select.d.ts.map +1 -0
  258. package/dist/lib/service-env.d.ts +38 -0
  259. package/dist/lib/service-env.d.ts.map +1 -0
  260. package/dist/lib/service.d.ts +102 -0
  261. package/dist/lib/service.d.ts.map +1 -0
  262. package/dist/lib/session-commands.d.ts +229 -0
  263. package/dist/lib/session-commands.d.ts.map +1 -0
  264. package/dist/lib/session-key.d.ts +55 -0
  265. package/dist/lib/session-key.d.ts.map +1 -0
  266. package/dist/lib/sessions-view.d.ts +31 -0
  267. package/dist/lib/sessions-view.d.ts.map +1 -0
  268. package/dist/lib/source-cache.d.ts +105 -0
  269. package/dist/lib/source-cache.d.ts.map +1 -0
  270. package/dist/lib/source.d.ts +281 -0
  271. package/dist/lib/source.d.ts.map +1 -0
  272. package/dist/lib/sources.d.ts +107 -0
  273. package/dist/lib/sources.d.ts.map +1 -0
  274. package/dist/lib/spawn.d.ts +56 -0
  275. package/dist/lib/spawn.d.ts.map +1 -0
  276. package/dist/lib/stdin-tap.d.ts +41 -0
  277. package/dist/lib/stdin-tap.d.ts.map +1 -0
  278. package/dist/lib/subcommand.d.ts +57 -0
  279. package/dist/lib/subcommand.d.ts.map +1 -0
  280. package/dist/lib/systemd.d.ts +60 -0
  281. package/dist/lib/systemd.d.ts.map +1 -0
  282. package/dist/lib/templates.d.ts +35 -0
  283. package/dist/lib/templates.d.ts.map +1 -0
  284. package/dist/lib/terminal.d.ts +98 -0
  285. package/dist/lib/terminal.d.ts.map +1 -0
  286. package/dist/lib/text-selection.d.ts +75 -0
  287. package/dist/lib/text-selection.d.ts.map +1 -0
  288. package/dist/lib/theme.d.ts +90 -0
  289. package/dist/lib/theme.d.ts.map +1 -0
  290. package/dist/lib/types.d.ts +467 -0
  291. package/dist/lib/types.d.ts.map +1 -0
  292. package/dist/lib/warnings.d.ts +79 -0
  293. package/dist/lib/warnings.d.ts.map +1 -0
  294. package/dist/lib/width.d.ts +39 -0
  295. package/dist/lib/width.d.ts.map +1 -0
  296. package/dist/lib/wizard.d.ts +95 -0
  297. package/dist/lib/wizard.d.ts.map +1 -0
  298. package/dist/lib/wordmark.d.ts +60 -0
  299. package/dist/lib/wordmark.d.ts.map +1 -0
  300. package/dist/lib/wrap.d.ts +74 -0
  301. package/dist/lib/wrap.d.ts.map +1 -0
  302. package/dist/memory.d.ts +25 -0
  303. package/dist/memory.d.ts.map +1 -0
  304. package/dist/model.d.ts +47 -0
  305. package/dist/model.d.ts.map +1 -0
  306. package/dist/plugins.d.ts +15 -0
  307. package/dist/plugins.d.ts.map +1 -0
  308. package/dist/remove.d.ts +52 -0
  309. package/dist/remove.d.ts.map +1 -0
  310. package/dist/run.d.ts +42 -0
  311. package/dist/run.d.ts.map +1 -0
  312. package/dist/schedules.d.ts +41 -0
  313. package/dist/schedules.d.ts.map +1 -0
  314. package/dist/serve.d.ts +41 -0
  315. package/dist/serve.d.ts.map +1 -0
  316. package/dist/sessions.d.ts +13 -0
  317. package/dist/sessions.d.ts.map +1 -0
  318. package/dist/skills.d.ts +80 -0
  319. package/dist/skills.d.ts.map +1 -0
  320. package/dist/soul.d.ts +19 -0
  321. package/dist/soul.d.ts.map +1 -0
  322. package/dist/sources.d.ts +32 -0
  323. package/dist/sources.d.ts.map +1 -0
  324. package/dist/start.d.ts +26 -0
  325. package/dist/start.d.ts.map +1 -0
  326. package/dist/stop.d.ts +58 -0
  327. package/dist/stop.d.ts.map +1 -0
  328. package/dist/terminal-setup.d.ts +31 -0
  329. package/dist/terminal-setup.d.ts.map +1 -0
  330. package/dist/tools.d.ts +22 -0
  331. package/dist/tools.d.ts.map +1 -0
  332. package/dist/transcript.d.ts +124 -0
  333. package/dist/transcript.d.ts.map +1 -0
  334. package/dist/validate.d.ts +36 -0
  335. package/dist/validate.d.ts.map +1 -0
  336. package/dist/web-w7r68df1.js +14 -0
  337. package/dist/web-w7r68df1.js.map +11 -0
  338. package/dist/web.d.ts +36 -0
  339. package/dist/web.d.ts.map +1 -0
  340. package/dist/wire.d.ts +10 -0
  341. package/dist/wire.d.ts.map +1 -0
  342. package/dist/wire.js +33 -0
  343. package/dist/wire.js.map +10 -0
  344. package/dist/workspace.d.ts +19 -0
  345. package/dist/workspace.d.ts.map +1 -0
  346. package/package.json +78 -0
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{U,kn}from"./index-my5cjx00.js";import{useStdout as u}from"ink";import{useEffect as i,useState as t}from"react";function s(e){let n=e?.columns,o=e?.rows;return{columns:n===void 0||n<=0?U:n,rows:o===void 0||o<=0?kn:o}}function re(){let{stdout:e}=u(),[n,o]=t(()=>s(e));return i(()=>{if(e===void 0)return;let r=()=>o(s(e));return e.on("resize",r),()=>void e.off("resize",r)},[e]),n}
3
+ export{re};
4
+
5
+ //# debugId=42494795255B09DC64756E2164756E21
6
+ //# sourceMappingURL=index-rqbtm761.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/hooks/useTerminalSize.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * Terminal width, kept current across resizes.\n *\n * `columns` can genuinely be 0 — measured, under a pty allocated by `script -q`, which is how a real\n * TTY gets driven in a test harness. Anything dividing by the width has to survive that, so the\n * fallback is applied here rather than at each call site.\n */\n\nimport { useStdout } from \"ink\"\nimport { useEffect, useState } from \"react\"\nimport { FALLBACK_COLUMNS, FALLBACK_ROWS } from \"#lib/const\"\n\ninterface Size {\n readonly columns: number\n readonly rows: number\n}\n\n/**\n * Module-level and pure, so the resize listener has a stable identity. A reader defined inside the\n * hook would be a new function every render, which means either a stale listener or re-subscribing\n * on every frame.\n */\nfunction readSize(stdout: { columns?: number; rows?: number } | undefined): Size {\n const columns = stdout?.columns\n const rows = stdout?.rows\n return {\n columns: columns === undefined || columns <= 0 ? FALLBACK_COLUMNS : columns,\n rows: rows === undefined || rows <= 0 ? FALLBACK_ROWS : rows,\n }\n}\n\nexport function useTerminalSize(): Size {\n const { stdout } = useStdout()\n const [size, setSize] = useState(() => readSize(stdout))\n\n useEffect(() => {\n if (stdout === undefined) return\n const onResize = () => setSize(readSize(stdout))\n stdout.on(\"resize\", onResize)\n return () => void stdout.off(\"resize\", onResize)\n }, [stdout])\n\n return size\n}\n"
6
+ ],
7
+ "mappings": ";sCAQA,oBAAS,YACT,oBAAS,cAAW,cAapB,SAAS,CAAQ,CAAC,EAA+D,CAC7E,IAAM,EAAU,GAAQ,QAClB,EAAO,GAAQ,KACrB,MAAO,CACH,QAAS,IAAY,QAAa,GAAW,EAAI,EAAmB,EACpE,KAAM,IAAS,QAAa,GAAQ,EAAI,GAAgB,CAC5D,EAGG,SAAS,EAAe,EAAS,CACpC,IAAQ,UAAW,EAAU,GACtB,EAAM,GAAW,EAAS,IAAM,EAAS,CAAM,CAAC,EASvD,OAPA,EAAU,IAAM,CACZ,GAAI,IAAW,OAAW,OAC1B,IAAM,EAAW,IAAM,EAAQ,EAAS,CAAM,CAAC,EAE/C,OADA,EAAO,GAAG,SAAU,CAAQ,EACrB,IAAM,KAAK,EAAO,IAAI,SAAU,CAAQ,GAChD,CAAC,CAAM,CAAC,EAEJ",
8
+ "debugId": "42494795255B09DC64756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{e,T,x,_,M,p}from"./index-2cvtz0fy.js";import{w,B}from"./index-7da4fqcr.js";async function Lr(t,i,n){let s=[];if(t.length===0)for(let a of B(i)){if(a.problem!==void 0||a.id===void 0)continue;s.push({agentId:a.id,manifestPath:a.manifestPath})}else for(let a of t){let r=T(a);s.push({agentId:r.id??"",manifestPath:a})}let o=await f(async(a)=>new Map((await a.agentState.list()).filter((r)=>!r.enabled).map((r)=>[r.agentId,r.reason])),n);return s.map((a)=>{let r=o?.get(a.agentId),d=o?.has(a.agentId)===!0;return{...a,enabled:!d,...r===void 0?{}:{reason:r}}})}async function f(t,i){let n;try{return n=await M.open({path:i??w()}),await t(n)}catch{return}finally{await n?.close()}}async function Rn(t,i,n,s){await f(async(o)=>{if(i)await o.agentState.enable(t);else await o.agentState.disable(t,new Date().toISOString(),n===void 0?void 0:n)},s)}async function Dr(t,i){return await f(async(n)=>{let s=await n.agentState.get(t);if(s===void 0)return{enabled:!0};return{enabled:s.enabled,...s.reason===void 0?{}:{reason:s.reason}}},i)}async function Oe(t,i){return await f(async(n)=>{let s=await n.leases.get(t);if(s===void 0)return;if(s.pid===process.pid||!_(s.pid))return;return s},i)}async function Ne(t){return[...(await yt(t)).filter((n)=>n.baseUrl!==void 0)].sort((n,s)=>n.agentId.localeCompare(s.agentId))[0]}async function yt(t){return await f(async(i)=>(await i.leases.all()).filter((n)=>n.pid!==process.pid&&_(n.pid)),t)??[]}function wt(t){return t===void 0||t===""?"":T(t).id??""}function Ye(t){let i=process.env[`${e.envPrefix}API_TOKEN`];try{let n=x(t,{env:p([t])}),s=n.env[n.manifest.server.tokenEnv];return s===void 0||s===""?i:s}catch{return i===""?void 0:i}}async function Xe(t,i,n,s){let o=t.baseUrl;if(o===void 0)return{ok:!1,status:0,detail:"this host serves no HTTP"};let a=s===void 0?void 0:Ye(s);try{let r=await fetch(`${o}${i}`,{method:"POST",headers:{"content-type":"application/json",...a===void 0?{}:{authorization:`Bearer ${a}`}},body:JSON.stringify(n),signal:AbortSignal.timeout(c)});if(r.ok){let u=await r.json().catch(()=>{return});return{ok:!0,status:r.status,...u===void 0?{}:{body:u}}}let d=await r.json().catch(()=>{return});return{ok:!1,status:r.status,...d?.error?.message===void 0?{}:{detail:d.error.message},...d?.error?.hint===void 0?{}:{hint:d.error.hint}}}catch(r){return{ok:!1,status:0,detail:r instanceof Error?r.message:String(r)}}}async function ir(t,i,n,s){let o=t.baseUrl;if(o===void 0)return{ok:!1,status:0,detail:"this host serves no HTTP"};let a=s===void 0?void 0:Ye(s);try{let r=await fetch(`${o}${n}`,{method:i,headers:a===void 0?{}:{authorization:`Bearer ${a}`},signal:AbortSignal.timeout(c)}),d=await r.json().catch(()=>{return});if(r.ok)return{ok:!0,status:r.status,...d===void 0?{}:{body:d}};let u=d;return{ok:!1,status:r.status,...u?.error?.message===void 0?{}:{detail:u.error.message},...u?.error?.hint===void 0?{}:{hint:u.error.hint}}}catch(r){return{ok:!1,status:0,detail:r instanceof Error?r.message:String(r)}}}var c=1e4;function Ut(t,i){for(let n of B(i))if(n.id===t)return n.manifestPath;return}
3
+ export{Lr,Rn,Dr,Oe,Ne,yt,wt,Ye,Xe,ir,Ut};
4
+
5
+ //# debugId=BBFC0DC70ABE0BDF64756E2164756E21
6
+ //# sourceMappingURL=index-rqzg861g.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/lib/lifecycle.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * Reaching a running host, and reading the durable on/off switch.\n *\n * Shared by `serve`, `stop` and `start`, because all three ask the same two questions and a second\n * answer to either is a disagreement waiting to happen: *which agents is this sandbox supposed to\n * run*, and *where is the process already running them*.\n *\n * **Why an HTTP request rather than a signal.** Since one process hosts several agents, stopping\n * one by signalling the lease holder takes every other agent in that process down with it. A signal\n * also cannot name an agent. So `stop` posts to the host, which disposes exactly one — and the\n * address comes off the lease row rather than from a manifest, because `--port` overrides the file,\n * `--port 0` picks one at random and a container republishes it. Guessing 7420 is how a second host\n * on 7421 becomes invisible to the one command that must never miss it.\n *\n * **The fallback is the old behaviour, not an error.** A lease with no address is a `run` REPL or an\n * embedded runtime — real states, serving no HTTP — and those are still stopped by signalling the\n * process, which is what `stop` did for every lease before any of this existed.\n */\n\nimport { dirname } from \"node:path\"\nimport {\n BRAND,\n type LeaseRecord,\n loadManifest,\n processAlive,\n readManifestHeader,\n SqliteStore,\n} from \"@dispach/core\"\nimport { ambientEnv } from \"#lib/ambient\"\nimport { listAgents, storePath } from \"#lib/sandbox\"\n\n/** An agent the sandbox holds, with the durable switch resolved. */\nexport interface HostableAgent {\n readonly agentId: string\n readonly manifestPath: string\n readonly enabled: boolean\n /** Why it was switched off, when somebody said. */\n readonly reason?: string\n}\n\n/**\n * The manifests a bare `serve` should host, and the ones it should not.\n *\n * A listing rather than a filter, because the caller has to *report* what it is skipping: an agent\n * missing from a banner with no line explaining it is the \"I set this up and it is not running\"\n * failure the switch exists to make explicable.\n *\n * Broken entries are dropped here rather than surfaced, and that is the one thing this hides: a\n * directory whose header will not parse has no id, so there is nothing to look the state up by and\n * nothing to serve. the agents listing is what shows those, and it shows them already.\n */\nexport async function hostableAgents(\n paths: readonly string[],\n env: Readonly<Record<string, string | undefined>>,\n store?: string,\n): Promise<readonly HostableAgent[]> {\n const found: { agentId: string; manifestPath: string }[] = []\n\n if (paths.length === 0) {\n // The bare form: whatever the sandbox holds. This is what the service unit runs, and it is\n // why `agent_state` exists — \"every agent here\" needs an answer to \"except which\".\n for (const agent of listAgents(env)) {\n if (agent.problem !== undefined || agent.id === undefined) continue\n found.push({ agentId: agent.id, manifestPath: agent.manifestPath })\n }\n } else {\n for (const manifestPath of paths) {\n // The header, not a full load: reading a manifest to learn its id must not depend on\n // the agent's credentials being present, which is the whole reason\n // `readManifestHeader` exists and why the picker is built on it.\n const header = readManifestHeader(manifestPath)\n found.push({ agentId: header.id ?? \"\", manifestPath })\n }\n }\n\n const disabled = await withStore(\n async (db) =>\n new Map(\n (await db.agentState.list())\n .filter((row) => !row.enabled)\n .map((row) => [row.agentId, row.reason]),\n ),\n store,\n )\n\n return found.map((entry) => {\n const reason = disabled?.get(entry.agentId)\n const off = disabled?.has(entry.agentId) === true\n return {\n ...entry,\n enabled: !off,\n ...(reason === undefined ? {} : { reason }),\n }\n })\n}\n\n/**\n * Open the store, ask one question, close it.\n *\n * Deliberately a second, short-lived connection rather than the one `Runtime.create` opens: the\n * answer is needed *before* the runtime exists, because it decides which agents the runtime is\n * asked for. Handing the runtime a caller-owned store would work and would move shutdown ownership\n * into the command, which is a larger change than one sequential read deserves — the migrations are\n * already applied, so this costs a couple of milliseconds.\n *\n * `undefined` on any failure, and the callers treat that as \"nothing is disabled\". A missing store\n * is the ordinary first-run state, and a `serve` that refused to start because it could not read an\n * on/off table would be a worse failure than the one it was guarding against.\n *\n * **The path is threaded rather than defaulted at each call site**, because `serve` honours\n * `--store` and these helpers did not — so a host serving out of one database would have read its\n * on/off switch from another. Invisible in normal use, where both resolve to the sandbox, and\n * wrong in exactly the configuration the tests use.\n */\nasync function withStore<T>(\n work: (store: SqliteStore) => Promise<T>,\n path?: string,\n): Promise<T | undefined> {\n let store: SqliteStore | undefined\n try {\n store = await SqliteStore.open({ path: path ?? storePath() })\n return await work(store)\n } catch {\n return undefined\n } finally {\n await store?.close()\n }\n}\n\n/** The durable switch, written from a command rather than through a host. */\nexport async function writeAgentState(\n agentId: string,\n enabled: boolean,\n reason?: string,\n store?: string,\n): Promise<void> {\n await withStore(async (db) => {\n if (enabled) await db.agentState.enable(agentId)\n else\n await db.agentState.disable(\n agentId,\n new Date().toISOString(),\n reason === undefined ? undefined : reason,\n )\n }, store)\n}\n\n/** Whether this agent is switched off, and why. */\nexport async function agentStateOf(\n agentId: string,\n store?: string,\n): Promise<{ enabled: boolean; reason?: string } | undefined> {\n return await withStore(async (db) => {\n const row = await db.agentState.get(agentId)\n if (row === undefined) return { enabled: true }\n return { enabled: row.enabled, ...(row.reason === undefined ? {} : { reason: row.reason }) }\n }, store)\n}\n\n/**\n * The live process serving this agent, if there is one.\n *\n * Liveness is re-checked here rather than trusted from the row, for the recorded reason: a boot\n * that fails *after* claiming leaves a lease seconds old with no process under it, and anything\n * reading a lease to decide what to do has to probe rather than believe the heartbeat.\n */\nexport async function liveHostOf(\n agentId: string,\n store?: string,\n): Promise<LeaseRecord | undefined> {\n return await withStore(async (db) => {\n const lease = await db.leases.get(agentId)\n if (lease === undefined) return undefined\n if (lease.pid === process.pid || !processAlive(lease.pid)) return undefined\n return lease\n }, store)\n}\n\n/**\n * Any live host with an HTTP address, for `start`.\n *\n * **Not `liveHostOf(agentId)`, and that is the whole reason this exists.** A stopped agent has no\n * lease — `dispose` released it — so looking for \"the host holding this agent\" finds nothing and\n * `start` would report that nothing was running while a host sat there ready to adopt it. Found by\n * running the pair in order rather than by reading either one.\n *\n * With several hosts this asks the first by agent id. Nondeterministic and harmless: any host can\n * serve any agent in the sandbox, and one that cannot look the manifest up answers `501` rather\n * than failing quietly.\n */\nexport async function anyLiveHost(store?: string): Promise<LeaseRecord | undefined> {\n const hosts = (await liveHosts(store)).filter((lease) => lease.baseUrl !== undefined)\n return [...hosts].sort((a, b) => a.agentId.localeCompare(b.agentId))[0]\n}\n\n/** Every live lease, for the commands that report on the whole sandbox. */\nexport async function liveHosts(store?: string): Promise<readonly LeaseRecord[]> {\n return (\n (await withStore(\n async (db) =>\n (\n await db.leases.all()\n ).filter((lease) => lease.pid !== process.pid && processAlive(lease.pid)),\n store,\n )) ?? []\n )\n}\n\n/**\n * The credential a running host will want, best effort.\n *\n * The manifest's live env is the authority — that is where `serve` itself read the token from — so\n * this loads it. When the load fails it falls back to the process environment under the brand's\n * default variable, because the common reason for a failed load is a missing *model* key and\n * refusing to stop an agent over that would be absurd. A wrong or absent token is not silent: the\n * request comes back `401` and the caller says which variable to set.\n */\n/**\n * The agent id a manifest declares, without loading it.\n *\n * `readManifestHeader` rather than `loadManifest` for the reason `lib/sandbox.ts` already records:\n * loading checks that the key variables are set, so a *lookup* built on it fails exactly when the\n * agent is misconfigured — which is when you most need to name it. Here that would mean `run` and\n * `web` refusing to find a host for an agent whose `.env` is incomplete.\n */\nexport function agentIdFor(manifestPath: string | undefined): string {\n return manifestPath === undefined || manifestPath === \"\"\n ? \"\"\n : (readManifestHeader(manifestPath).id ?? \"\")\n}\n\nexport function hostToken(manifestPath: string): string | undefined {\n const fallback = process.env[`${BRAND.envPrefix}API_TOKEN`]\n try {\n const loaded = loadManifest(manifestPath, { env: ambientEnv([manifestPath]) })\n const configured = loaded.env[loaded.manifest.server.tokenEnv]\n return configured === undefined || configured === \"\" ? fallback : configured\n } catch {\n return fallback === \"\" ? undefined : fallback\n }\n}\n\nexport interface HostReply {\n readonly ok: boolean\n readonly status: number\n /** The server's own `error.message`, when it sent one. */\n readonly detail?: string\n /**\n * The parsed success body, for the callers that need one.\n *\n * `stop` and `start` only ever asked whether it worked, so this was discarded. Minting a\n * credential is the first caller that needs what came back — the secret is printed **once** and\n * exists nowhere else, so throwing the body away would make the command useless.\n */\n readonly body?: unknown\n /** The server's `error.hint`, which is the half a person acts on. */\n readonly hint?: string\n}\n\n/**\n * POST to a running host, with a bounded wait.\n *\n * Bounded because the alternative is a stop command that hangs on a wedged host, and the whole\n * brief for `stop` is that a person reaching for it is not in a position to go investigating. A\n * timeout falls through to the process-level stop, which is the thing that works on a host that has\n * stopped answering.\n */\nexport async function postToHost(\n lease: LeaseRecord,\n path: string,\n body: Readonly<Record<string, unknown>>,\n manifestPath?: string,\n): Promise<HostReply> {\n const base = lease.baseUrl\n if (base === undefined) return { ok: false, status: 0, detail: \"this host serves no HTTP\" }\n const token = manifestPath === undefined ? undefined : hostToken(manifestPath)\n\n try {\n const response = await fetch(`${base}${path}`, {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n ...(token === undefined ? {} : { authorization: `Bearer ${token}` }),\n },\n body: JSON.stringify(body),\n signal: AbortSignal.timeout(HOST_TIMEOUT_MS),\n })\n if (response.ok) {\n const body: unknown = await response.json().catch(() => undefined)\n return {\n ok: true,\n status: response.status,\n ...(body === undefined ? {} : { body }),\n }\n }\n const parsed = (await response.json().catch(() => undefined)) as\n | { error?: { message?: string; hint?: string } }\n | undefined\n return {\n ok: false,\n status: response.status,\n ...(parsed?.error?.message === undefined ? {} : { detail: parsed.error.message }),\n ...(parsed?.error?.hint === undefined ? {} : { hint: parsed.error.hint }),\n }\n } catch (error) {\n return {\n ok: false,\n status: 0,\n detail: error instanceof Error ? error.message : String(error),\n }\n }\n}\n\n/**\n * Any method against a running host, with the same bound and the same error shape.\n *\n * `postToHost` is this with `POST` and a body; both exist because a `GET` with a `content-type` and\n * an empty body is a request some proxies mangle, and because the one-method version read better at\n * the four call sites that had it. This is what `credential list` and `credential revoke` need.\n */\nexport async function callHost(\n lease: LeaseRecord,\n method: string,\n path: string,\n manifestPath?: string,\n): Promise<HostReply> {\n const base = lease.baseUrl\n if (base === undefined) return { ok: false, status: 0, detail: \"this host serves no HTTP\" }\n const token = manifestPath === undefined ? undefined : hostToken(manifestPath)\n try {\n const response = await fetch(`${base}${path}`, {\n method,\n headers: token === undefined ? {} : { authorization: `Bearer ${token}` },\n signal: AbortSignal.timeout(HOST_TIMEOUT_MS),\n })\n const body: unknown = await response.json().catch(() => undefined)\n if (response.ok) {\n return { ok: true, status: response.status, ...(body === undefined ? {} : { body }) }\n }\n const parsed = body as { error?: { message?: string; hint?: string } } | undefined\n return {\n ok: false,\n status: response.status,\n ...(parsed?.error?.message === undefined ? {} : { detail: parsed.error.message }),\n ...(parsed?.error?.hint === undefined ? {} : { hint: parsed.error.hint }),\n }\n } catch (error) {\n return {\n ok: false,\n status: 0,\n detail: error instanceof Error ? error.message : String(error),\n }\n }\n}\n\n/** Long enough for a dispose that waits on a channel to stop, short enough not to read as a hang. */\nconst HOST_TIMEOUT_MS = 10_000\n\n/** The sandbox manifest declaring this id, for the host's `resolveAgent` lookup. */\nexport function manifestForId(\n agentId: string,\n env?: Readonly<Record<string, string | undefined>>,\n): string | undefined {\n for (const agent of listAgents(env)) {\n if (agent.id === agentId) return agent.manifestPath\n }\n return undefined\n}\n\n/** The directory an agent's manifest sits in, for messages that name a `.env`. */\nexport function agentDirOf(manifestPath: string): string {\n return dirname(manifestPath)\n}\n"
6
+ ],
7
+ "mappings": ";kFAmDA,eAAsB,EAAc,CAChC,EACA,EACA,EACiC,CACjC,IAAM,EAAqD,CAAC,EAE5D,GAAI,EAAM,SAAW,EAGjB,QAAW,KAAS,EAAW,CAAG,EAAG,CACjC,GAAI,EAAM,UAAY,QAAa,EAAM,KAAO,OAAW,SAC3D,EAAM,KAAK,CAAE,QAAS,EAAM,GAAI,aAAc,EAAM,YAAa,CAAC,EAGtE,aAAW,KAAgB,EAAO,CAI9B,IAAM,EAAS,EAAmB,CAAY,EAC9C,EAAM,KAAK,CAAE,QAAS,EAAO,IAAM,GAAI,cAAa,CAAC,EAI7D,IAAM,EAAW,MAAM,EACnB,MAAO,IACH,IAAI,KACC,MAAM,EAAG,WAAW,KAAK,GACrB,OAAO,CAAC,IAAQ,CAAC,EAAI,OAAO,EAC5B,IAAI,CAAC,IAAQ,CAAC,EAAI,QAAS,EAAI,MAAM,CAAC,CAC/C,EACJ,CACJ,EAEA,OAAO,EAAM,IAAI,CAAC,IAAU,CACxB,IAAM,EAAS,GAAU,IAAI,EAAM,OAAO,EACpC,EAAM,GAAU,IAAI,EAAM,OAAO,IAAM,GAC7C,MAAO,IACA,EACH,QAAS,CAAC,KACN,IAAW,OAAY,CAAC,EAAI,CAAE,QAAO,CAC7C,EACH,EAqBL,eAAe,CAAY,CACvB,EACA,EACsB,CACtB,IAAI,EACJ,GAAI,CAEA,OADA,EAAQ,MAA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",
9
+ "names": []
10
+ }
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{Wo}from"./index-jk0def33.js";var c=[{title:"Specs and planning",skills:["prd","breakdown-feature-prd","breakdown-epic-pm","breakdown-feature-implementation","breakdown-plan","create-implementation-plan","create-specification","create-architectural-decision-record","create-technical-spike"]},{title:"Documents",skills:["create-readme","create-tldr-page","documentation-writer","convert-plaintext-to-md","markdown-to-html"]},{title:"Communications",skills:["meeting-minutes","email-drafter","linkedin-post-formatter","daily-prep"]},{title:"Go to market",skills:["gtm-0-to-1-launch","gtm-board-and-investor-communication","gtm-enterprise-account-planning","gtm-enterprise-onboarding","gtm-operating-cadence","gtm-partnership-architecture","gtm-positioning-strategy","gtm-product-led-growth","gtm-technical-product-pricing","gtm-developer-ecosystem"]},{title:"Team and process",skills:["mentoring-juniors","impediment-prioritization","quality-playbook"]},{title:"Diagrams",skills:["napkin","excalidraw-diagram-generator","draw-io-diagram-generator","plantuml-ascii"]},{title:"Prompt craft and research",skills:["boost-prompt","autoresearch"]}],ro=c.flatMap((e)=>e.skills);function u(e){return c.find((n)=>n.skills.includes(e))?.title}function m(e,n){let t=n.filter((a)=>a.problem===void 0);if(e.curated===void 0)return t;let r=new Set(e.curated);return t.filter((a)=>r.has(a.skill)||r.has(g(a.repoPath)))}function g(e){let n=e.lastIndexOf("/");return n===-1?e:e.slice(n+1)}function oo(e){let n=[];for(let t of e){let r=m(t.spec,t.entries);if(r.length===0)continue;let a=new Set(t.installed??[]);n.push({kind:"source",label:`${t.spec.name} ${r.length} skill${r.length===1?"":"s"}`});let s=new Map,d=[];for(let o of r){let i=t.spec.curated===void 0?void 0:u(o.skill);if(i===void 0)d.push(o);else{let l=s.get(i);if(l===void 0)s.set(i,[o]);else l.push(o)}}for(let o of d)n.push(p(o,a));for(let[o,i]of s){n.push({kind:"group",label:o});for(let l of i)n.push(p(l,a))}}return n}function p(e,n){return{kind:"item",label:e.skill,meta:Wo(e.tokens,e.scripts.length,n.has(e.skill)),description:f(e.description),entry:e}}function f(e){let n=e.replace(/\s+/g," ").trim(),t=n.search(/\.\s/);return t===-1?n:n.slice(0,t+1)}function nt(e){return e.map((n)=>n.kind==="item")}function Zt(e,n){return n.map((t)=>e[t]?.entry).filter((t)=>t!==void 0)}function vt(e){let n=e.filter((t)=>t.ok);return{installed:n.map((t)=>t.name),failed:e.filter((t)=>!t.ok).map((t)=>({name:t.name,reason:t.reason??"not installed"})),runnable:n.reduce((t,r)=>t+r.runnable.length,0),withCode:n.filter((t)=>t.runnable.length>0).length,total:e.length}}
3
+ export{ro,oo,nt,Zt,vt};
4
+
5
+ //# debugId=EA611634A87ED1D664756E2164756E21
6
+ //# sourceMappingURL=index-t1xvacym.js.map
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/lib/curated.ts", "../src/lib/browse.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * The curated list: what `skills` shows before anybody types a query.\n *\n * ## Why a catalogue needs curating at all\n *\n * `anthropics/skills` is 17 skills and every one of them is broadly useful, so it ships whole.\n * `github/awesome-copilot` is **425**, and the great majority are developer tooling — Azure resource\n * naming, language-specific refactorings, IDE plugin scaffolds. Showing all 442 as a browsable list is\n * not a catalogue, it is a directory listing, and the person who opens it has to already know what they\n * are looking for. Which was the original problem.\n *\n * So the community source has an allowlist and the anthropic source does not. The entries below are the\n * subset that is useful to somebody running an agent rather than writing one: specs and planning,\n * documents, communications, go-to-market, diagrams, prompt craft, research.\n *\n * ## Verified against upstream, and one name removed\n *\n * Every folder here was checked against `github/awesome-copilot`'s tree on 2026-08-17. Of the 38 first\n * drafted, **37 exist and `prompt-builder` does not** — and that is the failure mode this comment is here\n * to prevent, because a name that matches no folder is silently absent from the list rather than an error.\n * `npm run check:curated`-style verification is `sources search --json` plus a diff; the test in\n * `curated.test.ts` asserts the shape, not the remote, so it cannot start failing when upstream renames\n * something. **Re-check by hand when adding entries.**\n *\n * Curation applies to *browsing*, never to searching. `sources search` reaches all 442 on purpose: a\n * curated list is a recommendation, and refusing to find a skill somebody knows the name of would make\n * curation a restriction. Two different questions — \"what should I look at\" and \"is this thing here\".\n */\n\n/** One group in the browse list. Order is the order on screen. */\nexport interface CuratedGroup {\n readonly title: string\n readonly skills: readonly string[]\n}\n\nexport const CURATED_COMMUNITY: readonly CuratedGroup[] = [\n {\n title: \"Specs and planning\",\n skills: [\n \"prd\",\n \"breakdown-feature-prd\",\n \"breakdown-epic-pm\",\n \"breakdown-feature-implementation\",\n \"breakdown-plan\",\n \"create-implementation-plan\",\n \"create-specification\",\n \"create-architectural-decision-record\",\n \"create-technical-spike\",\n ],\n },\n {\n title: \"Documents\",\n skills: [\n \"create-readme\",\n \"create-tldr-page\",\n \"documentation-writer\",\n \"convert-plaintext-to-md\",\n \"markdown-to-html\",\n ],\n },\n {\n title: \"Communications\",\n skills: [\"meeting-minutes\", \"email-drafter\", \"linkedin-post-formatter\", \"daily-prep\"],\n },\n {\n title: \"Go to market\",\n skills: [\n \"gtm-0-to-1-launch\",\n \"gtm-board-and-investor-communication\",\n \"gtm-enterprise-account-planning\",\n \"gtm-enterprise-onboarding\",\n \"gtm-operating-cadence\",\n \"gtm-partnership-architecture\",\n \"gtm-positioning-strategy\",\n \"gtm-product-led-growth\",\n \"gtm-technical-product-pricing\",\n \"gtm-developer-ecosystem\",\n ],\n },\n {\n title: \"Team and process\",\n skills: [\"mentoring-juniors\", \"impediment-prioritization\", \"quality-playbook\"],\n },\n {\n title: \"Diagrams\",\n skills: [\n \"napkin\",\n \"excalidraw-diagram-generator\",\n \"draw-io-diagram-generator\",\n \"plantuml-ascii\",\n ],\n },\n {\n // `prompt-builder` was drafted here and does not exist upstream. Left as a comment rather than\n // deleted, so the next person to add it checks first.\n title: \"Prompt craft and research\",\n skills: [\"boost-prompt\", \"autoresearch\"],\n },\n]\n\n/** Flat allowlist, for the catalogue filter. */\nexport const CURATED_COMMUNITY_SKILLS: readonly string[] = CURATED_COMMUNITY.flatMap(\n (group) => group.skills,\n)\n\n/**\n * Which group a curated skill belongs to, for the browse list's headers.\n *\n * Anything not in the map — every anthropic skill, and anything reached by search — falls into the\n * source's own heading rather than being hidden.\n */\nexport function curatedGroupOf(skill: string): string | undefined {\n return CURATED_COMMUNITY.find((group) => group.skills.includes(skill))?.title\n}\n",
6
+ "/**\n * The browse list: a curated catalogue turned into rows, and rows turned back into skills.\n *\n * Pure and PURE-listed. The screen root renders it and the plain path prints it, so the *shape* of the\n * list — which sources appear, in what order, under which headings, with what shown beside each entry —\n * is decided once here and asserted without mounting Ink or reaching a network.\n *\n * Keeping this separate from the component is what makes `--plain` honest: a terminal and a pipe print\n * the same list because both read the same rows, rather than the plain path reimplementing the ordering\n * and drifting the first time a group is added.\n */\n\nimport { curatedGroupOf } from \"#lib/curated\"\nimport { metaOf } from \"#lib/rows\"\nimport type { CatalogueEntry } from \"#lib/source-cache\"\nimport type { SourceSpec } from \"#lib/sources\"\n\nexport interface BrowseRow {\n /** `source` is a top-level heading, `group` a subheading; neither is selectable. */\n readonly kind: \"source\" | \"group\" | \"item\"\n readonly label: string\n /** Its own column, not appended to the label — the row is laid out, not concatenated. */\n readonly meta?: string\n readonly description?: string\n /** The skill this row installs. Absent on a heading. */\n readonly entry?: CatalogueEntry\n}\n\n/**\n * A source's entries, filtered by its curation and grouped for display.\n *\n * Curation is applied *here* rather than in `readCatalogue`, so `sources search` keeps seeing everything.\n * A curated list is a recommendation; a search that could not find a named skill would be a restriction.\n */\nexport function curatedEntries(\n spec: SourceSpec,\n entries: readonly CatalogueEntry[],\n): readonly CatalogueEntry[] {\n const usable = entries.filter((entry) => entry.problem === undefined)\n if (spec.curated === undefined) return usable\n const allowed = new Set(spec.curated)\n // Matched on the *folder* name, which is what a curated list is written in terms of — and which the\n // spec requires to equal the frontmatter name, so either would work today and the folder is the one\n // that stays true if upstream renames the skill inside the file.\n return usable.filter(\n (entry) => allowed.has(entry.skill) || allowed.has(basename(entry.repoPath)),\n )\n}\n\nfunction basename(path: string): string {\n const cut = path.lastIndexOf(\"/\")\n return cut === -1 ? path : path.slice(cut + 1)\n}\n\nexport interface BrowseInput {\n readonly spec: SourceSpec\n readonly entries: readonly CatalogueEntry[]\n /** Already installed in the target agent, shown as such rather than offered twice. */\n readonly installed?: readonly string[]\n}\n\n/**\n * Every row, in display order: one heading per source, then per curated group where the source has them.\n *\n * An installed skill is listed with a note rather than removed, because a list whose contents change\n * depending on which agent you picked is one you cannot learn.\n */\nexport function browseRows(inputs: readonly BrowseInput[]): readonly BrowseRow[] {\n const rows: BrowseRow[] = []\n for (const input of inputs) {\n const entries = curatedEntries(input.spec, input.entries)\n if (entries.length === 0) continue\n const installed = new Set(input.installed ?? [])\n\n rows.push({\n kind: \"source\",\n label: `${input.spec.name} ${entries.length} skill${entries.length === 1 ? \"\" : \"s\"}`,\n })\n\n // Grouped where the curation defines groups, flat otherwise. `anthropics/skills` is 17 broadly\n // useful entries and inventing categories for it would be editorialising about somebody else's\n // catalogue; `awesome-copilot` is 425 and the groups are why it is legible at all.\n const grouped = new Map<string, CatalogueEntry[]>()\n const ungrouped: CatalogueEntry[] = []\n for (const entry of entries) {\n const group = input.spec.curated === undefined ? undefined : curatedGroupOf(entry.skill)\n if (group === undefined) ungrouped.push(entry)\n else {\n const bucket = grouped.get(group)\n if (bucket === undefined) grouped.set(group, [entry])\n else bucket.push(entry)\n }\n }\n\n for (const entry of ungrouped) rows.push(itemRow(entry, installed))\n for (const [title, bucket] of grouped) {\n rows.push({ kind: \"group\", label: title })\n for (const entry of bucket) rows.push(itemRow(entry, installed))\n }\n }\n return rows\n}\n\nfunction itemRow(entry: CatalogueEntry, installed: ReadonlySet<string>): BrowseRow {\n return {\n kind: \"item\",\n label: entry.skill,\n // The script count is on the row because it is the one fact that should change somebody's mind\n // before ticking a box: a skill with runnable files is code that will run on this machine.\n meta: metaOf(entry.tokens, entry.scripts.length, installed.has(entry.skill)),\n description: summarise(entry.description),\n entry,\n }\n}\n\n/**\n * First sentence, uncapped.\n *\n * The *column* decides the visible width now, in `lib/rows.ts`, so capping here as well would truncate\n * twice — once at 96 characters and again at whatever the terminal has left, which is how a wide terminal\n * ends up showing a short description with an ellipsis and empty space after it.\n */\nexport function summarise(description: string): string {\n const flat = description.replace(/\\s+/g, \" \").trim()\n const stop = flat.search(/\\.\\s/)\n return stop === -1 ? flat : flat.slice(0, stop + 1)\n}\n\n/** Which rows the cursor may land on, for the multi-select reducer. */\nexport function selectableOf(rows: readonly BrowseRow[]): readonly boolean[] {\n return rows.map((row) => row.kind === \"item\")\n}\n\n/** The skills behind a set of chosen row indices, in the order they appear on screen. */\nexport function chosenEntries(\n rows: readonly BrowseRow[],\n chosen: readonly number[],\n): readonly CatalogueEntry[] {\n return chosen\n .map((index) => rows[index]?.entry)\n .filter((entry): entry is CatalogueEntry => entry !== undefined)\n}\n\n// ─── what an install did ─────────────────────────────────────────────────────────────────\n\n/**\n * The structural half of `skills.ts`'s `InstallOutcome`.\n *\n * Declared here rather than imported so this module stays free of the command that produces it —\n * `skills.ts` reaches the filesystem, and importing it would drag that into every consumer of the row\n * layout, including the pure tests.\n */\nexport interface InstallOutcomeLike {\n readonly name: string\n readonly ok: boolean\n readonly reason?: string\n readonly runnable: readonly string[]\n}\n\nexport interface InstallReport {\n readonly installed: readonly string[]\n readonly failed: readonly { readonly name: string; readonly reason: string }[]\n /** Runnable files across every successful install, and how many skills brought them. */\n readonly runnable: number\n readonly withCode: number\n readonly total: number\n}\n\n/**\n * One report for a batch, as data.\n *\n * Both renderings read this — the text one the pipe and `init` print, and the card the browser shows\n * inside its own frame. The alternative was each composing its own summary from the outcomes, and a\n * terminal and a pipe disagreeing about what happened is exactly the class of failure the shared\n * `browseRows` was introduced to end.\n */\nexport function installReport(outcomes: readonly InstallOutcomeLike[]): InstallReport {\n const ok = outcomes.filter((outcome) => outcome.ok)\n return {\n installed: ok.map((outcome) => outcome.name),\n failed: outcomes\n .filter((outcome) => !outcome.ok)\n .map((outcome) => ({ name: outcome.name, reason: outcome.reason ?? \"not installed\" })),\n runnable: ok.reduce((count, outcome) => count + outcome.runnable.length, 0),\n withCode: ok.filter((outcome) => outcome.runnable.length > 0).length,\n total: outcomes.length,\n }\n}\n"
7
+ ],
8
+ "mappings": ";oCAmCO,IAAM,EAA6C,CACtD,CACI,MAAO,qBACP,OAAQ,CACJ,MACA,wBACA,oBACA,mCACA,iBACA,6BACA,uBACA,uCACA,wBACJ,CACJ,EACA,CACI,MAAO,YACP,OAAQ,CACJ,gBACA,mBACA,uBACA,0BACA,kBACJ,CACJ,EACA,CACI,MAAO,iBACP,OAAQ,CAAC,kBAAmB,gBAAiB,0BAA2B,YAAY,CACxF,EACA,CACI,MAAO,eACP,OAAQ,CACJ,oBACA,uCACA,kCACA,4BACA,wBACA,+BACA,2BACA,yBACA,gCACA,yBACJ,CACJ,EACA,CACI,MAAO,mBACP,OAAQ,CAAC,oBAAqB,4BAA6B,kBAAkB,CACjF,EACA,CACI,MAAO,WACP,OAAQ,CACJ,SACA,+BACA,4BACA,gBACJ,CACJ,EACA,CAGI,MAAO,4BACP,OAAQ,CAAC,eAAgB,cAAc,CAC3C,CACJ,EAGa,GAA8C,EAAkB,QACzE,CAAC,IAAU,EAAM,MACrB,EAQO,SAAS,CAAc,CAAC,EAAmC,CAC9D,OAAO,EAAkB,KAAK,CAAC,IAAU,EAAM,OAAO,SAAS,CAAK,CAAC,GAAG,MC9ErE,SAAS,CAAc,CAC1B,EACA,EACyB,CACzB,IAAM,EAAS,EAAQ,OAAO,CAAC,IAAU,EAAM,UAAY,MAAS,EACpE,GAAI,EAAK,UAAY,OAAW,OAAO,EACvC,IAAM,EAAU,IAAI,IAAI,EAAK,OAAO,EAIpC,OAAO,EAAO,OACV,CAAC,IAAU,EAAQ,IAAI,EAAM,KAAK,GAAK,EAAQ,IAAI,EAAS,EAAM,QAAQ,CAAC,CAC/E,EAGJ,SAAS,CAAQ,CAAC,EAAsB,CACpC,IAAM,EAAM,EAAK,YAAY,GAAG,EAChC,OAAO,IAAQ,GAAK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IAAS,GAAK,EAAO,EAAK,MAAM,EAAG,EAAO,CAAC,EAI/C,SAAS,EAAY,CAAC,EAAgD,CACzE,OAAO,EAAK,IAAI,CAAC,IAAQ,EAAI,OAAS,MAAM,EAIzC,SAAS,EAAa,CACzB,EACA,EACyB,CACzB,OAAO,EACF,IAAI,CAAC,IAAU,EAAK,IAAQ,KAAK,EACjC,OAAO,CAAC,IAAmC,IAAU,MAAS,EAoChE,SAAS,EAAa,CAAC,EAAwD,CAClF,IAAM,EAAK,EAAS,OAAO,CAAC,IAAY,EAAQ,EAAE,EAClD,MAAO,CACH,UAAW,EAAG,IAAI,CAAC,IAAY,EAAQ,IAAI,EAC3C,OAAQ,EACH,OAAO,CAAC,IAAY,CAAC,EAAQ,EAAE,EAC/B,IAAI,CAAC,KAAa,CAAE,KAAM,EAAQ,KAAM,OAAQ,EAAQ,QAAU,eAAgB,EAAE,EACzF,SAAU,EAAG,OAAO,CAAC,EAAO,IAAY,EAAQ,EAAQ,SAAS,OAAQ,CAAC,EAC1E,SAAU,EAAG,OAAO,CAAC,IAAY,EAAQ,SAAS,OAAS,CAAC,EAAE,OAC9D,MAAO,EAAS,MACpB",
9
+ "debugId": "EA611634A87ED1D664756E2164756E21",
10
+ "names": []
11
+ }
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import{xe}from"./index-7da4fqcr.js";import{Uo}from"./index-jk0def33.js";import{qo,vn,Zo,Vo,s,ts}from"./index-my5cjx00.js";function p(){return{out:process.stdout,in:process.stdin}}var t=[],i=!1,a=!1,n=!1,d=!1,u=!1,l=!1,c=!1;function zt(){n=!0}function he(){n=!0,d=!0}function Kr(){n=!0,u=!0}function f(){n=!0,l=!0}function b(e){t.push(e)}function Hr(){c=!0}function J(e=p()){if(a||!n)return;if(a=!0,e.in.isTTY===!0&&e.in.setRawMode!==void 0)e.in.setRawMode(!1);if(e.out.isTTY!==!0)return;if(e.out.write(`${vn}${qo}`),u)e.out.write(Uo);if(l)e.out.write(Vo);if(d)e.out.write(Zo)}async function ue(e=process.stdout){if(e.writableEnded===!0||e.destroyed===!0)return;await new Promise((o)=>{e.write("",()=>o())})}async function y(){for(let e of[...t].reverse())try{await e()}catch(o){process.stderr.write(`warning: cleanup failed: ${o instanceof Error?o.message:String(o)}
3
+ `)}t.length=0}async function T(e){await y(),J(),process.exitCode=e,await ue()}async function Nn(e){await T(e),process.exit(e)}function Wr(){if(i)return;i=!0,process.on("exit",()=>J()),process.on("SIGTERM",()=>{if(c)return;Nn(ts)});let e=(o)=>(r)=>{J();let m=r instanceof Error?r.stack??r.message:String(r);process.stderr.write(`
4
+ ${o}: ${m}
5
+ `),Nn(s)};process.on("uncaughtException",e("uncaught exception")),process.on("unhandledRejection",e("unhandled rejection"))}function Y(e){if(e??xe().noEnhancedKeys)return{};return f(),{kittyKeyboard:{mode:"enabled",flags:["disambiguateEscapeCodes","reportEventTypes"]}}}function E(e){if(e.json)return{mode:"json",because:"--json was passed"};if(e.plain)return{mode:"plain",because:"--plain was passed"};if(e.oneShot)return{mode:"plain",because:"--input is always plain"};if(!e.stdoutIsTTY)return{mode:"plain",because:"stdout is not a terminal"};if(!e.stdinIsTTY)return{mode:"plain",because:"stdin is not a terminal"};if(e.env.noColor)return{mode:"plain",because:"NO_COLOR is set"};if(e.env.dumbTerminal)return{mode:"plain",because:"TERM is dumb"};if(e.env.ci)return{mode:"plain",because:"CI is set"};return{mode:"rich",because:"stdout and stdin are both terminals"}}function ie(e){return E({...e,stdinIsTTY:process.stdin.isTTY===!0,stdoutIsTTY:process.stdout.isTTY===!0,env:xe()})}
6
+ export{zt,he,Kr,b,Hr,J,ue,Nn,Wr,Y,ie};
7
+
8
+ //# debugId=F4708A40865BC74364756E2164756E21
9
+ //# sourceMappingURL=index-xgqzk5cq.js.map
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/lib/exit.ts", "../src/lib/keyboard.ts", "../src/lib/output.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * One way out of the process.\n *\n * Two failure modes this exists to prevent, both of which the previous CLI had:\n *\n * **A hidden cursor and a terminal left in raw mode.** Ink hides the cursor and puts stdin in raw\n * mode. `process.exit()` from anywhere else — an error path, a signal, an uncaught rejection —\n * skips React's cleanup, and the shell you get back does not echo what you type. Recovering needs\n * `stty sane`, and nothing tells you that. So the restore is registered on `process.on(\"exit\")`\n * as well as run explicitly: whatever route the process takes out, the terminal is handed back.\n *\n * **Truncated output.** `process.stdout.write` to a *pipe* is asynchronous, and `process.exit()`\n * discards whatever has not flushed — so a `sessions … | head` invocation could lose its last lines,\n * intermittently and only when piped. Measured: 10 MB written and then exited immediately arrives as\n * **65,536 bytes**, one pipe buffer.\n *\n * The rule used to be \"set `process.exitCode` and let the event loop drain\", and that rule assumed the\n * loop *can* drain. It cannot. A command that boots a runtime leaves a keep-alive TLS socket to the\n * tool provider in Node's global `fetch` pool — `backend.composio.dev:443`, opened by the\n * post-readiness refresh — and that socket is ref'd, with no public API to close it. Measured: the\n * process was still alive **180 seconds** after `/exit`, and the `tools` command had to be killed at 30 s.\n * `^C` appeared to work only because SIGINT is deliberately unhandled here, so the default action kills\n * the process. a `tools --json | jq` invocation would have waited forever.\n *\n * So the rule is now: run the teardowns, drain the output *properly*, then leave. Both halves are\n * load-bearing — draining without leaving is the hang above, and leaving without draining is the\n * truncation above.\n */\n\nimport {\n DISABLE_ENHANCED_KEYS,\n EXIT_FAILURE,\n EXIT_SIGTERM,\n LEAVE_ALT_SCREEN,\n RESET_STYLE,\n SHOW_CURSOR,\n} from \"#lib/const\"\nimport { DISABLE_MOUSE } from \"#lib/mouse\"\nimport type { TerminalHandles } from \"#lib/schema\"\n\n/**\n * The real streams. Spelled out rather than passing `process` itself, which has no `in`/`out` —\n * that mistake typechecked against the structural type and threw only at runtime, inside the one\n * function whose entire job is to run when things have already gone wrong.\n */\nfunction processHandles(): TerminalHandles {\n return { out: process.stdout, in: process.stdin }\n}\n\ntype Teardown = () => void | Promise<void>\n\nconst teardowns: Teardown[] = []\nlet guardsInstalled = false\nlet restored = false\nlet dirty = false\nlet altScreen = false\nlet mouse = false\nlet enhancedKeys = false\nlet signalsClaimed = false\n\n/**\n * Declare that the terminal has been put into a state that needs undoing — raw mode, a hidden\n * cursor, alternate styling. Only the rich path does this.\n *\n * Without the flag, the restore would fire on *every* exit, including the plain path, which puts a\n * cursor-and-style reset at the end of output that is otherwise pure text. That breaks the property\n * plain mode exists for: `--plain` at a terminal has to produce exactly what a pipe produces.\n */\nexport function markTerminalDirty(): void {\n dirty = true\n}\n\n/**\n * Declare that the alternate screen buffer has been entered, so the restore swaps back out of it.\n *\n * Separate from `markTerminalDirty` rather than folded into it, because the two are not the same\n * claim: every rich surface dirties the terminal, and only the ones that *take* it need swapping\n * back. Folding them together would write the leave sequence after every wizard and every chat\n * session, and a `1049l` sent to a terminal that never entered the buffer clears the screen the\n * output was just written to — the plain path's parity rule, broken in the least debuggable way.\n *\n * Setting this and never entering is therefore worse than the reverse. The host that writes\n * `ENTER_ALT_SCREEN` calls this in the same statement.\n */\nexport function markAltScreen(): void {\n dirty = true\n altScreen = true\n}\n\n/**\n * The session asked the terminal to report the mouse, so the terminal has to be told to stop.\n *\n * Separate from `markAltScreen` because only the chat reads mouse reports. A surface that enabled\n * tracking without claiming every report would have them typed into it as text, which is what Ink does\n * with one — so the flag follows whoever handles them rather than whoever took the screen.\n *\n * Left on, the shell that gets the terminal back emits a report on every click and scroll, into a prompt\n * that has no idea what they are. That is the failure worth being loud about: it outlives the process.\n */\nexport function markMouse(): void {\n dirty = true\n mouse = true\n}\n\n/**\n * Ink negotiated the kitty keyboard protocol, so the terminal has to be told to stop reporting that way.\n *\n * Ink pops it itself on unmount and around a suspend — this exists for the path it cannot cover, which is\n * the same one `markMouse` exists for: a signal. `SIGTERM` is the only route a service manager uses, and\n * a terminal left in the protocol hands the next shell `CSI u` for every Ctrl chord, which reads as a\n * broken keyboard and outlives the process.\n *\n * Set by the render sites rather than derived, because whether the protocol was actually *pushed* depends\n * on the terminal answering a query 200 ms after mount — so the honest flag is \"we asked\", and popping a\n * protocol that was never pushed is a no-op on every terminal.\n */\nexport function markEnhancedKeys(): void {\n dirty = true\n enhancedKeys = true\n}\n\n/**\n * Run before the process ends. Registration order is preserved and reversed on the way out, so a\n * later-registered resource is released before the thing it depends on.\n */\nexport function onExit(teardown: Teardown): void {\n teardowns.push(teardown)\n}\n\n/**\n * Take ownership of SIGTERM, for a command whose shutdown *is* the point.\n *\n * The default guard answers SIGTERM with `finishNow(EXIT_SIGTERM)`, which is right for a command\n * that was interrupted: 143 is the shell convention and the work was not finished. It is wrong for\n * `serve`, where a signal is the ordinary and expected way to stop — the work was to stay up, and\n * being asked to stop is the successful end of it, not a failure.\n *\n * That distinction is not cosmetic once a service manager is involved. The generated service\n * definition restarts only on a crash, precisely so a misconfiguration stops once instead of\n * looping forever; a graceful stop reported as 143 is indistinguishable from that misconfiguration,\n * so the supervisor would refuse to bring the agent back.\n *\n * The caller must resolve its own wait on the signal and return an exit code normally. Everything\n * registered with `onExit` still runs, because `finish` awaits the teardowns either way.\n */\nexport function claimSignals(): void {\n signalsClaimed = true\n}\n\n/**\n * Synchronous by necessity — `process.on(\"exit\")` cannot await. Idempotent, because it runs both\n * explicitly and from the exit hook.\n */\nexport function restoreTerminal(handles: TerminalHandles = processHandles()): void {\n if (restored || !dirty) return\n restored = true\n if (handles.in.isTTY === true && handles.in.setRawMode !== undefined) {\n handles.in.setRawMode(false)\n }\n if (handles.out.isTTY !== true) return\n // Style and cursor first, buffer swap second. A reset applies to the buffer that is current when\n // it arrives, so resetting after the swap leaves the app's last colour on the shell's screen and\n // dutifully resets the one being thrown away.\n handles.out.write(`${RESET_STYLE}${SHOW_CURSOR}`)\n // Before the buffer swap, for the same reason the style reset is: the request was made against this\n // buffer and the shell must not be left with a terminal that reports clicks at it.\n if (mouse) handles.out.write(DISABLE_MOUSE)\n // Before the buffer swap for the same reason, and after the mouse for no reason but stable ordering\n // — a test asserts the sequence, and an order nothing pins is an order that drifts.\n //\n // This is usually the *second* pop: Ink pops on unmount, and on both the normal and the signal path\n // the unmount teardown has already run by the time this fires. Kept anyway, because the path it exists\n // for is the one where teardowns do not run at all — a hard crash — and a terminal left reporting\n // `CSI u` for every Ctrl chord outlives the process. Seen in a capture as `[<u[<u`.\n //\n // The cost is stated rather than hidden. A pop on an empty stack is ignored, so standalone this is\n // harmless; nested inside *another* application that pushed its own flags, the extra pop takes that\n // application's entry instead. That trade is accepted for a top-level CLI and would be the wrong one\n // for a library.\n if (enhancedKeys) handles.out.write(DISABLE_ENHANCED_KEYS)\n if (altScreen) handles.out.write(LEAVE_ALT_SCREEN)\n}\n\n/** Test seam. Nothing in `src/` outside this module calls it. */\nexport function resetForTests(\n options: {\n readonly dirty?: boolean\n readonly altScreen?: boolean\n readonly mouse?: boolean\n readonly enhancedKeys?: boolean\n } = {},\n): void {\n teardowns.length = 0\n restored = false\n dirty = options.dirty ?? true\n altScreen = options.altScreen ?? false\n mouse = options.mouse ?? false\n enhancedKeys = options.enhancedKeys ?? false\n signalsClaimed = false\n}\n\n/** Enough of a stream to wait on. Spelled out so a test can supply one without a pipe. */\ninterface Drainable {\n write(chunk: string, callback: () => void): unknown\n readonly writableEnded?: boolean\n readonly destroyed?: boolean\n}\n\n/**\n * Wait until everything written to stdout has actually reached the operating system.\n *\n * This used to test `writableNeedDrain` and await a `drain` event, which is a weaker claim than it\n * reads as: the flag is only true once the buffer is *over* the high-water mark, so a modest pending\n * write to a pipe reported nothing to wait for and the function named \"flush\" returned immediately.\n * That was survivable while the process went on to idle until the loop emptied, and is not survivable\n * now that it exits on purpose.\n *\n * A zero-length write is the receipt. `Writable` invokes callbacks in write order once the underlying\n * write completes, so a chunk queued behind everything else calls back only after everything else has\n * gone out. Measured against a pipe with a sleeping reader: 10 MB exits complete, where an immediate\n * `process.exit` delivered 65,536 bytes.\n *\n * **The wait is deliberately unbounded.** A timeout would trade a silent truncation for a bounded exit,\n * and with a slow reader — `| less`, a terminal being scrolled — truncation is the worse of the two. A\n * closed reader is not the hazard it looks like: the callback still fires, carrying `EPIPE`.\n *\n * Also awaited between turns, where the point is different: a long session feeding a slow reader\n * accumulates unwritten output in memory, and this bounds that to one turn's worth.\n */\nexport async function flushOutput(stream: Drainable = process.stdout): Promise<void> {\n // Nothing to wait for, and writing would throw. Checked rather than caught, because a throw here\n // lands inside the function whose whole job is to run when things are already ending.\n if (stream.writableEnded === true || stream.destroyed === true) return\n await new Promise<void>((resolve) => {\n stream.write(\"\", () => resolve())\n })\n}\n\nasync function runTeardowns(): Promise<void> {\n for (const teardown of [...teardowns].reverse()) {\n try {\n await teardown()\n } catch (error) {\n // A failing teardown must not mask the exit code that brought us here, and must not\n // stop the remaining teardowns — the terminal restore is one of them.\n process.stderr.write(\n `warning: cleanup failed: ${error instanceof Error ? error.message : String(error)}\\n`,\n )\n }\n }\n teardowns.length = 0\n}\n\n/**\n * Everything that has to happen before the process ends: teardowns, the terminal, the exit code, and\n * the output.\n *\n * Sets `process.exitCode` rather than exiting, so a caller that has its own reason to stay alive can.\n * Nothing in `src/` is such a caller any more — the entry point uses `finishNow` — but the split is\n * what makes this testable: a `finish` that exited would take the test runner with it.\n */\nexport async function finish(code: number): Promise<void> {\n await runTeardowns()\n restoreTerminal()\n process.exitCode = code\n await flushOutput()\n}\n\n/**\n * Finish, and then actually leave.\n *\n * The ordinary way out, not the exceptional one. It was written for a signal or a crash — \"where\n * waiting for the loop to drain would mean hanging\" — on the assumption that the ordinary path could\n * wait. It cannot: the module docstring records the measurement, a keep-alive socket in the global\n * `fetch` pool that outlived the process by three minutes.\n *\n * Safe to call here and nowhere earlier, because `finish` has already awaited the teardowns and the\n * output. Anything still holding the loop open at this point is a resource with no owner, and waiting\n * on one is what the hang was.\n */\nexport async function finishNow(code: number): Promise<never> {\n await finish(code)\n process.exit(code)\n}\n\n/**\n * Guards for the ways a process dies without being asked to.\n *\n * `SIGINT` is deliberately **not** handled here. During a turn it means \"cancel this turn\", not\n * \"exit\" — the chat path owns it, and a guard that exited would break the contract Phase 1\n * established and measured.\n */\nexport function installGuards(): void {\n if (guardsInstalled) return\n guardsInstalled = true\n\n // Last line of defence. Runs even when something calls process.exit directly.\n process.on(\"exit\", () => restoreTerminal())\n\n process.on(\"SIGTERM\", () => {\n // Yield to a command that owns its own shutdown. Without this the two handlers raced and\n // the hard exit won: `serve`'s graceful path started, `process.exit(143)` landed first, and\n // `runtime.stop()` never completed — so the outbox was not flushed, the database was not\n // closed, and the child processes `exec` backgrounds were never reaped. Invisible at a\n // terminal, because ctrl-C sends SIGINT and this guard deliberately ignores that one.\n if (signalsClaimed) return\n void finishNow(EXIT_SIGTERM)\n })\n\n const crash = (label: string) => (error: unknown) => {\n restoreTerminal()\n const message = error instanceof Error ? (error.stack ?? error.message) : String(error)\n // Loud and non-zero. An unexpected failure that exits 0 is the thing hard rule 8 forbids.\n process.stderr.write(`\\n${label}: ${message}\\n`)\n void finishNow(EXIT_FAILURE)\n }\n process.on(\"uncaughtException\", crash(\"uncaught exception\"))\n process.on(\"unhandledRejection\", crash(\"unhandled rejection\"))\n}\n",
6
+ "/**\n * Whether this process asks the terminal for enhanced keys, and what it asks for.\n *\n * ## Why there is anything to ask for\n *\n * Ink 7.1 ships a complete kitty-keyboard-protocol parser — `parse-keypress.js` decodes `CSI u`, and\n * `Key` carries `super`, `hyper`, `home` and `end` — and **none of it runs unless a caller opts in**:\n *\n * initKittyKeyboard() {\n * // Protocol is opt-in: if kittyKeyboard is not specified, do nothing\n * if (!this.options.kittyKeyboard) return\n *\n * That single `return` is why `⌥r` typed `®` into the message instead of unfolding the reasoning block,\n * and why `cmd+←` word-moved instead of jumping to the start of the line: without the protocol, `⌥`\n * depends on a terminal setting that is off by default in Warp, and `super` cannot be expressed by any\n * legacy escape sequence at all — Ink's legacy branch folds it into `meta` (`modifier & 10`, bit 8 being\n * super and bit 2 alt), so the two chords become the same keystroke.\n *\n * ## Why both flags\n *\n * `disambiguateEscapeCodes` alone fixes the letter chords: `⌥r` arrives as `CSI 114;3u`, which Ink reports\n * as `input \"r\"` with `meta` set — exactly the shape `keymap.ts` already matched, which is why turning\n * this on required no change to a single binding. It is **not** enough for `cmd+←`: an arrow with a\n * modifier comes back as `CSI 1;9D`, and Ink's kitty branch for special keys (`kittySpecialKeyRe`)\n * *requires* the `:eventType` field, so without `reportEventTypes` the sequence falls through to the\n * legacy path and the super bit is folded away again.\n *\n * The cost of that second flag is stated where it is paid: Ink passes `eventType` through untouched and\n * filters nothing, so `keymap.ts` drops `release` or every enhanced chord fires twice.\n *\n * ## Why `enabled` rather than `auto`, measured\n *\n * `auto` is the careful-looking option: Ink writes `CSI ? u`, waits **200 ms**, and enables only if the\n * terminal answers. It was the first choice here and it loses the race. In a real Warp session the reply\n * arrived *after* the window closed — visible in `keys` as `bytes 1b 5b 3f 30 75` resolving to an insert,\n * because Ink strips the answer only while it is still listening. So the protocol stayed **off** on a\n * terminal that plainly supports it, and every option-letter chord went on depending on Warp's\n * *Left/Right Option Key is Meta* setting, which is off by default. That is the reported bug, one layer\n * down from where it looked like it was.\n *\n * `enabled` pushes `CSI > flags u` without asking. The cost is bounded by how terminals treat private-mode\n * sequences they do not know — they discard them — and the pop on the way out is the same shape. It is\n * also no longer load-bearing: `lib/csi.ts` reads modifiers off the bytes, so a terminal that ignores the\n * push still gets working cmd chords. The protocol now buys the *letter* chords, and losing it silently\n * costs those rather than everything.\n *\n * The override stays for the case neither argument covers: a terminal that accepts the push and then\n * implements it badly. The reference CLI carries the same hatch (`CLAUDE_CODE_DISABLE_MOUSE`), and a\n * switch nobody can reach is not a hatch.\n */\n\nimport { readEnv } from \"#lib/env\"\n/**\n * The render options fragment, shaped structurally rather than imported from Ink.\n *\n * Declared here for the same reason `KeyState` is declared in `lib/types.ts` rather than imported: this\n * module sits on a path every command touches, and Ink costs ~170-210 ms to load under Node — more than\n * the entire runtime of `validate --json`. TypeScript checks it structurally against `RenderOptions` at\n * each call site, so a drift in Ink's own type is still a compile error.\n */\nimport { markEnhancedKeys } from \"#lib/exit\"\n\nexport interface KeyboardOptions {\n readonly kittyKeyboard?: {\n readonly mode: \"auto\" | \"enabled\" | \"disabled\"\n /**\n * The property is readonly; the array is not, because Ink's own `flags` is a mutable\n * `KittyFlagName[]` and under `exactOptionalPropertyTypes` a `readonly` array does not satisfy\n * it. Nothing is shared as a result — `keyboardOptions` builds a fresh array on every call, which\n * is what makes the mutable type harmless rather than a hole.\n */\n readonly flags: (\"disambiguateEscapeCodes\" | \"reportEventTypes\")[]\n }\n}\n\n/**\n * One answer for every surface that mounts Ink, and the teardown registered with it.\n *\n * Every one of them reads keys, so a per-surface decision would mean the chat honoured `cmd+←` and the\n * settings editor did not — and the *next* surface would forget entirely. `inSession` on `CommandSpec` is\n * the same shape: derived once so a new caller cannot drift.\n *\n * It marks rather than merely returning, which is why it is not called `keyboardOptions`: asking for the\n * protocol and arranging to withdraw it are one decision, and six call sites each remembering to do the\n * second is six chances to leave a terminal reporting `CSI u` at somebody's shell. Ink withdraws it on\n * unmount by itself; the mark covers the signal path, which is the one Ink cannot see.\n */\nexport function negotiateKeyboard(disabled?: boolean): KeyboardOptions {\n // `??` rather than a default parameter: a default fires on an explicitly passed `undefined` too, and\n // this repo has already lost a debugging round to that (`load(dir, undefined)` used the runner it was\n // meant to omit). Written this way, \"no opinion\" and \"not passed\" are deliberately the same case.\n if (disabled ?? readEnv().noEnhancedKeys) return {}\n markEnhancedKeys()\n return {\n kittyKeyboard: {\n // Not \"auto\" — see above. Ink's 200 ms detection window loses the race in Warp, measured.\n mode: \"enabled\",\n flags: [\"disambiguateEscapeCodes\", \"reportEventTypes\"],\n },\n }\n}\n",
7
+ "/**\n * How output is rendered, resolved once per process.\n *\n * This mirrors the reasoning behind decision 3.5, which forbids the tool dialect from changing with\n * the model: behaviour that shifts silently with the environment cannot be reasoned about. So the\n * resolution is total and ordered, and it returns *why* it chose — the reason is printable, which is\n * what turns \"it wasn't interactive and I don't know why\" into a question with an answer.\n *\n * Measured, not assumed: importing Ink and React costs ~65 ms under Bun and ~170-210 ms under Node,\n * against a ~70 ms total runtime for `validate --json`. Nothing on a non-rich path may import them,\n * which is why this returns a mode rather than a renderer.\n */\n\nimport { readEnv } from \"#lib/env\"\nimport type { ModeDecision, ModeInputs } from \"#lib/schema\"\n\n/**\n * Total and ordered. Every branch is reachable and every input is consulted, so no combination of\n * flags and environment lands somewhere undocumented.\n */\nexport function resolveMode(inputs: ModeInputs): ModeDecision {\n if (inputs.json) return { mode: \"json\", because: \"--json was passed\" }\n if (inputs.plain) return { mode: \"plain\", because: \"--plain was passed\" }\n\n // A one-shot is a scripting affordance. Its output must not depend on whether a human happened\n // to be at a terminal, or `--input` would mean two different things in a shell script and in a\n // shell.\n if (inputs.oneShot) return { mode: \"plain\", because: \"--input is always plain\" }\n\n if (!inputs.stdoutIsTTY) return { mode: \"plain\", because: \"stdout is not a terminal\" }\n // A live transcript with no way to type into it is a worse plain renderer, not a better one.\n if (!inputs.stdinIsTTY) return { mode: \"plain\", because: \"stdin is not a terminal\" }\n\n if (inputs.env.noColor) return { mode: \"plain\", because: \"NO_COLOR is set\" }\n if (inputs.env.dumbTerminal) return { mode: \"plain\", because: \"TERM is dumb\" }\n // CI logs are files that happen to scroll. Cursor movement in one is noise forever.\n if (inputs.env.ci) return { mode: \"plain\", because: \"CI is set\" }\n\n return { mode: \"rich\", because: \"stdout and stdin are both terminals\" }\n}\n\n/**\n * Deliberately not consulted: `FORCE_COLOR`. It says how much colour a stream can carry, not\n * whether a human is watching, and honouring it here would turn a CI job that wanted coloured logs\n * into one driving a cursor around a file. Ink's own colour depth still respects it.\n */\nexport function resolveModeFromProcess(flags: {\n readonly json: boolean\n readonly plain: boolean\n readonly oneShot: boolean\n}): ModeDecision {\n return resolveMode({\n ...flags,\n stdinIsTTY: process.stdin.isTTY === true,\n stdoutIsTTY: process.stdout.isTTY === true,\n env: readEnv(),\n })\n}\n"
8
+ ],
9
+ "mappings": ";0HA6CA,SAAS,CAAc,EAAoB,CACvC,MAAO,CA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AO,IAAI,QAAS,MAAO,CAAE,KAAM,QAAS,QAAS,iBAAkB,EAC3E,GAAI,EAAO,IAAI,aAAc,MAAO,CAAE,KAAM,QAAS,QAAS,cAAe,EAE7E,GAAI,EAAO,IAAI,GAAI,MAAO,CAAE,KAAM,QAAS,QAAS,WAAY,EAEhE,MAAO,CAAE,KAAM,OAAQ,QAAS,qCAAsC,EAQnE,SAAS,EAAsB,CAAC,EAItB,CACb,OAAO,EAAY,IACZ,EACH,WAAY,QAAQ,MAAM,QAAU,GACpC,YAAa,QAAQ,OAAO,QAAU,GACtC,IAAK,GAAQ,CACjB,CAAC",
10
+ "debugId": "F4708A40865BC74364756E2164756E21",
11
+ "names": []
12
+ }
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{spawn as s,spawnSync as f}from"node:child_process";function Eo(n){let e=f(n.command,[...n.args],{encoding:"utf8",...n.input===void 0?{}:{input:n.input},...n.cwd===void 0?{}:{cwd:n.cwd},...n.env===void 0?{}:{env:n.env},...n.timeoutMs===void 0?{}:{timeout:n.timeoutMs},...n.maxBuffer===void 0?{}:{maxBuffer:n.maxBuffer}}),d=e.error?.code;return{code:e.status??1,stdout:e.stdout??"",stderr:e.stderr??"",signalled:e.signal!==null,notFound:d==="ENOENT"}}function pe(n){return new Promise((e)=>{let d=s(n.command,[...n.args],{...n.cwd===void 0?{}:{cwd:n.cwd},...n.env===void 0?{}:{env:n.env},stdio:[n.input===void 0?"ignore":"pipe","pipe","pipe"]});if(n.input!==void 0)d.stdin?.end(n.input);let t="",a="",r=!1,u=n.maxBuffer??33554432;d.stdout?.on("data",(o)=>{if(t.length<u)t+=o.toString("utf8")}),d.stderr?.on("data",(o)=>{if(a.length<u)a+=o.toString("utf8")});let i=n.timeoutMs===void 0?void 0:setTimeout(()=>{r=!0,d.kill("SIGTERM")},n.timeoutMs);d.on("error",(o)=>{if(i!==void 0)clearTimeout(i);e({code:1,stdout:t,stderr:o.message,signalled:r,notFound:o.code==="ENOENT"})}),d.on("close",(o,l)=>{if(i!==void 0)clearTimeout(i);e({code:o??1,stdout:t,stderr:a,signalled:r||l!==null,notFound:!1})})})}
3
+ export{Eo,pe};
4
+
5
+ //# debugId=6E4FB3FE2044B09364756E2164756E21
6
+ //# sourceMappingURL=index-xqyms08r.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/lib/spawn.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * The one place in this package that starts a process.\n *\n * There were two callers before this file existed and the second one is what created it: `lib/service.ts`\n * ran `launchctl`, and fetching a skill source needs `git`. The rule the boundaries test enforces is\n * \"exactly one module imports `node:child_process`\", and its stated reason is that a second call site is a\n * second place a test has to intercept — the first one that forgets reaches somebody's real machine. Two\n * callers of one seam keeps that property; an allowlist with two entries in it loses it, and would go on\n * losing it once per phase.\n *\n * Deliberately thin, and deliberately not clever. Everything specific to a tool — git's four ways of\n * being told not to prompt, launchd's exit-status decoding — belongs to the caller that knows about it.\n * What lives here is \"run this, capture what it said, and tell me honestly how it ended\".\n *\n * `notFound` is a field rather than an exception because the two callers want different sentences for it:\n * a missing `git` has a remedy the person can act on, and a missing `launchctl` means this is not the\n * operating system the caller thought it was. A shared error message would be wrong for both.\n */\n\nimport { spawn, spawnSync } from \"node:child_process\"\n\nexport interface SpawnRequest {\n readonly command: string\n readonly args: readonly string[]\n readonly cwd?: string\n /** Replaces the environment entirely when given. Callers spread `process.env` themselves. */\n readonly env?: Readonly<Record<string, string | undefined>>\n readonly timeoutMs?: number\n readonly maxBuffer?: number\n /**\n * Text to write to the child's stdin, which is then closed.\n *\n * Added for the clipboard: `pbcopy` reads what it copies from stdin and there is no argument form. The\n * alternative was a temporary file, which puts whatever was selected on disk — and a selection is\n * routinely the most sensitive thing on the screen. The seam grows rather than the caller working\n * around it, per the rule about first-party code not getting private escape hatches.\n */\n readonly input?: string\n}\n\nexport interface SpawnResult {\n readonly code: number\n readonly stdout: string\n readonly stderr: string\n /** True when a timeout or a signal ended it, rather than the process choosing to exit. */\n readonly signalled: boolean\n /** True when the command is not on PATH at all. */\n readonly notFound: boolean\n}\n\nexport function spawnCapture(request: SpawnRequest): SpawnResult {\n const result = spawnSync(request.command, [...request.args], {\n encoding: \"utf8\",\n ...(request.input === undefined ? {} : { input: request.input }),\n ...(request.cwd === undefined ? {} : { cwd: request.cwd }),\n ...(request.env === undefined ? {} : { env: request.env as NodeJS.ProcessEnv }),\n ...(request.timeoutMs === undefined ? {} : { timeout: request.timeoutMs }),\n ...(request.maxBuffer === undefined ? {} : { maxBuffer: request.maxBuffer }),\n })\n const code = (result.error as NodeJS.ErrnoException | undefined)?.code\n return {\n code: result.status ?? 1,\n stdout: result.stdout ?? \"\",\n stderr: result.stderr ?? \"\",\n signalled: result.signal !== null,\n notFound: code === \"ENOENT\",\n }\n}\n\n/**\n * The same thing, without blocking the event loop.\n *\n * Exists because `spawnSync` inside an Ink app freezes the whole terminal: no spinner frame advances, and\n * the keypresses that arrive during a twenty-second `git clone` are echoed by the tty instead of being\n * consumed by the app — which is how `^[[B^[[A` ended up printed in the middle of a fetch progress line.\n * Anything a rendered screen waits on has to be awaited, not blocked on.\n */\nexport function spawnCaptureAsync(request: SpawnRequest): Promise<SpawnResult> {\n return new Promise((resolve) => {\n const child = spawn(request.command, [...request.args], {\n ...(request.cwd === undefined ? {} : { cwd: request.cwd }),\n ...(request.env === undefined ? {} : { env: request.env as NodeJS.ProcessEnv }),\n // Never inherit: a child that writes to the terminal would paint over the rendered frame, and\n // one that reads from it would steal the keys the app is listening for.\n // A pipe only when there is something to write. `ignore` otherwise, for the reason below.\n stdio: [request.input === undefined ? \"ignore\" : \"pipe\", \"pipe\", \"pipe\"],\n })\n if (request.input !== undefined) {\n // Ended immediately: a child reading stdin waits for EOF, so a pipe left open is a process\n // that never exits and a promise that never settles.\n child.stdin?.end(request.input)\n }\n let stdout = \"\"\n let stderr = \"\"\n let signalled = false\n const cap = request.maxBuffer ?? 32 * 1024 * 1024\n child.stdout?.on(\"data\", (chunk: Buffer) => {\n if (stdout.length < cap) stdout += chunk.toString(\"utf8\")\n })\n child.stderr?.on(\"data\", (chunk: Buffer) => {\n if (stderr.length < cap) stderr += chunk.toString(\"utf8\")\n })\n const timer =\n request.timeoutMs === undefined\n ? undefined\n : setTimeout(() => {\n signalled = true\n // The group, not the pid: `git clone` spawns helpers, and killing only the parent\n // leaves them running with nothing referencing them.\n child.kill(\"SIGTERM\")\n }, request.timeoutMs)\n child.on(\"error\", (error: NodeJS.ErrnoException) => {\n if (timer !== undefined) clearTimeout(timer)\n resolve({\n code: 1,\n stdout,\n stderr: error.message,\n signalled,\n notFound: error.code === \"ENOENT\",\n })\n })\n child.on(\"close\", (code, signal) => {\n if (timer !== undefined) clearTimeout(timer)\n resolve({\n code: code ?? 1,\n stdout,\n stderr,\n signalled: signalled || signal !== null,\n notFound: false,\n })\n })\n })\n}\n"
6
+ ],
7
+ "mappings": ";AAmBA,gBAAS,eAAO,2BA+BT,SAAS,EAAY,CAAC,EAAoC,CAC7D,IAAM,EAAS,EAAU,EAAQ,QAAS,CAAC,GAAG,EAAQ,IAAI,EAAG,CACzD,SAAU,UACN,EAAQ,QAAU,OAAY,CAAC,EAAI,CAAE,MAAO,EAAQ,KAAM,KAC1D,EAAQ,MAAQ,OAAY,CAAC,EAAI,CAAE,IAAK,EAAQ,GAAI,KACpD,EAAQ,MAAQ,OAAY,CAAC,EAAI,CAAE,IAAK,EAAQ,GAAyB,KACzE,EAAQ,YAAc,OAAY,CAAC,EAAI,CAAE,QAAS,EAAQ,SAAU,KACpE,EAAQ,YAAc,OAAY,CAAC,EAAI,CAAE,UAAW,EAAQ,SAAU,CAC9E,CAAC,EACK,EAAQ,EAAO,OAA6C,KAClE,MAAO,CACH,KAAM,EAAO,QAAU,EACvB,OAAQ,EAAO,QAAU,GACzB,OAAQ,EAAO,QAAU,GACzB,UAAW,EAAO,SAAW,KAC7B,SAAU,IAAS,QACvB,EAWG,SAAS,EAAiB,CAAC,EAA6C,CAC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";import{$n,es}from"./index-my5cjx00.js";var Tt=[{name:"plain",kind:"boolean",help:"force plain text — no interactive rendering, no colour"},{name:"help",short:"h",kind:"boolean",help:"show this help and exit"},{name:"version",short:"v",kind:"boolean",help:"print the version and exit"},{name:"no-bootstrap",kind:"boolean",help:"never start a background server on this run"}],a={name:"manifest",required:!0,help:"path to an agent.yaml, or the name of a sandbox agent"},t={name:"store",kind:"string",placeholder:"path",help:"session database",defaultHelp:`~/${e.stateDir}/store.db`},l={name:"session",kind:"string",placeholder:"key",help:"session key",bare:""},n={name:"json",kind:"boolean",help:"machine-readable output"},le=[{name:"init",inSession:"hidden",needsServer:!0,summary:"create a new agent: manifest, workspace, and env files",args:[],unexpectedArgHint:"init takes no positional argument. To name the agent, --name <name>; to place it somewhere other than the sandbox, --dir <path>.",flags:[{name:"user",kind:"string",placeholder:"name",help:"your name"},{name:"name",kind:"string",placeholder:"name",help:"the agent's name"},{name:"purpose",kind:"string",placeholder:"text",help:"one line: what the agent is for"},{name:"preset",kind:"string",placeholder:"id",help:"model endpoint: openai | anthropic | deepseek | ollama | custom",defaultHelp:"openai"},{name:"model",kind:"string",placeholder:"id",help:"model id"},{name:"base-url",kind:"string",placeholder:"url",help:"endpoint base URL"},{name:"api-key-env",kind:"string",placeholder:"VAR",help:"env var that will hold the key; omitted for ollama",defaultHelp:"MODEL_API_KEY"},{name:"system",kind:"string",placeholder:"level",help:"what it may touch on this machine: none | read | write | full",defaultHelp:"none"},{name:"web",kind:"string",placeholder:"level",help:"internet access: none | fetch | search",defaultHelp:"none"},{name:"web-backend",kind:"string",placeholder:"id",help:"search backend when --web search: tavily | brave | exa",defaultHelp:"tavily"},{name:"composio",kind:"string",placeholder:"level",help:"your other apps via Composio: none | connected",defaultHelp:"none"},{name:"telegram",kind:"string",placeholder:"level",help:"reachable on Telegram: none | connected",defaultHelp:"none"},{name:"telegram-allow",kind:"string",placeholder:"@handle",help:"who may message it — empty permits nobody, which is the safe default"},{name:"server",kind:"string",placeholder:"level",help:"serve the HTTP API: none | local",defaultHelp:"none"},{name:"schedules",kind:"string",placeholder:"what",help:"run something on a schedule: none | daily | hourly",defaultHelp:"none"},{name:"skills",kind:"string",placeholder:"level",help:'none | starter, or words to search the catalogues for — --skills "pdf tables"',defaultHelp:"starter"},{name:"daemon",kind:"string",placeholder:"level",help:"keep it running in the background: none | service",defaultHelp:"none"},{name:"dir",kind:"string",placeholder:"path",help:"write the agent here instead of the sandbox",defaultHelp:`~/${e.stateDir}/agents/<agent-name-slug>`},{name:"yes",kind:"boolean",help:"take every default; never ask, even at a terminal"}]},{name:"run",inSession:"hidden",needsServer:!0,summary:"start an interactive session — bare `run` picks from the sandbox",args:[{...a,required:!1,help:"path or sandbox agent name (omit to pick from the sandbox)"}],flags:[{...l,defaultHelp:"a new one each run; bare --session picks from the list"},{name:"continue",short:"c",kind:"boolean",help:"pick up the most recent conversation with this agent"},{name:"input",kind:"string",placeholder:"text",help:"run one turn, print the reply, exit"},t,{name:"ephemeral",kind:"boolean",help:"keep this session in memory only; nothing is written"},{name:"quiet",kind:"boolean",help:"suppress the banner and per-turn stats"},{name:"no-enhanced-keys",kind:"boolean",help:"do not negotiate the kitty keyboard protocol (cmd chords stop arriving)"},{name:"no-reasoning",kind:"boolean",help:"hide the thinking a reasoning model streams (shown by default)"},{name:"show-reasoning",kind:"boolean",help:"no-op: reasoning is shown by default when the model has any"}]},{name:"schedules",inSession:"view",needsServer:!0,summary:"list schedules, when they next fire, and how the last run went",args:[a],flags:[{name:"id",kind:"string",placeholder:"schedule",help:"show one schedule in full instead of the list"},{name:"enable",kind:"string",placeholder:"schedule",help:"switch an API-created schedule on; a manifest one is enabled in agent.yaml"},{name:"disable",kind:"string",placeholder:"schedule",help:"switch an API-created schedule off; a manifest one is disabled in agent.yaml"},{name:"recipients",kind:"boolean",help:"list the addresses this agent can deliver to — what deliver.to takes"},t,n]},{name:"sessions",inSession:"view",needsServer:!1,summary:"list stored sessions, or inspect one",args:[a],flags:[{...l,help:"show one session instead of the list"},{name:"turns",kind:"boolean",help:"show turn records instead of messages"},{name:"clear",kind:"boolean",help:"delete the named session's history; memory files are untouched"},{name:"limit",kind:"number",placeholder:"n",help:"rows to show",defaultHelp:String($n),min:es,integer:!0},t,n]},{name:"memory",inSession:"view",needsServer:!1,summary:"search what the agent remembers, or rebuild the index from the files",args:[{name:"action",required:!0,help:"what to do",choices:[{value:"search",help:"rank the corpus against a query, exactly as a turn would"},{value:"rebuild",help:"forget the index and re-read every file — for an edit that kept the mtime"}]},{...a,required:!0},{name:"query",required:!1,help:"the words to search for (search only); quote a phrase"}],flags:[t,{name:"limit",kind:"number",placeholder:"n",help:"passages to show",defaultHelp:"10",min:1,integer:!0},{name:"all",kind:"boolean",help:"show passages below the manifest's threshold too, marked"},n]},{name:"config",inSession:"view",needsServer:!1,summary:"read and change an agent's settings, and fill in its secrets",args:[{name:"action",required:!1,help:"what to do (default: edit)",choices:[{value:"edit",help:"the full-screen editor — also what bare `config <agent>` opens"},{value:"list",help:"every setting, its current value, and who may set it"},{value:"get",help:"one setting"},{value:"set",help:"change one setting"},{value:"env",help:"put a secret in the .env beside the manifest, prompted and not echoed"},{value:"allow",help:"add or remove a handle a channel accepts messages from"}]},{...a,required:!1},{name:"name",required:!1,help:"the setting's dotted path, an env variable name, or a handle"},{name:"value",required:!1,help:"the new value (set only)"}],flags:[t,{name:"channel",kind:"string",placeholder:"id",help:"which channel to allow on, when there is more than one"},{name:"remove",kind:"boolean",help:"take the handle off instead of adding it (allow only)"},{name:"yes",kind:"boolean",help:"skip the confirmation on an edit that weakens a check"}]},{name:"validate",inSession:"output",needsServer:!1,summary:"load and validate a manifest, then exit",args:[a],flags:[n]},{name:"workspace",inSession:"output",needsServer:!1,summary:"check the workspace files against the authoring rules",args:[a],flags:[{name:"strict",kind:"boolean",help:"exit non-zero when any authoring warning is reported"},n]},{name:"soul",inSession:"output",needsServer:!1,summary:"scaffold a hand-edited compact identity from a long-form document",args:[{name:"action",required:!0,help:"what to do",choices:[{value:"distill",help:"scaffold a compact identity beside the source"}]},{name:"file",required:!0,help:"path to the long-form identity document"}],flags:[{name:"out",kind:"string",placeholder:"path",help:"where to write the scaffold",defaultHelp:"<file>.compact.md beside the source"}]},{name:"skills",inSession:"view",needsServer:!1,summary:"browse the catalogue and install — or list, scaffold, check one agent's skills",args:[{name:"action",required:!1,help:"what to do — omit to browse the catalogue and tick what you want",choices:[{value:"list",help:"every skill, its size, and whether it ships scripts"},{value:"show",help:"one skill in full, including what the model never sees"},{value:"new",help:"scaffold a skill, turning skills on for this agent if they are not"},{value:"install",help:"install one by name — anthropic/pdf — or copy from a local path (see `sources`)"},{value:"remove",help:"delete a skill's directory and everything in it"},{value:"validate",help:"authoring warnings — never a refusal"}]},{...a,required:!1,help:"path or sandbox agent name (not used when browsing)"},{name:"name",required:!1,help:"the skill for show, new and remove — for install, <source>/<skill> or a local path"}],flags:[{name:"strict",kind:"boolean",help:"exit non-zero when any authoring warning is reported"},n]},{name:"sources",inSession:"view",needsServer:!1,summary:"the repositories skills come from: list, add, search",args:[{name:"action",required:!0,help:"what to do",choices:[{value:"list",help:"every source, and whether it has been fetched"},{value:"add",help:"add a repository — a URL, or a name and a URL"},{value:"remove",help:"stop searching a source; built-ins included"},{value:"update",help:"re-fetch every source, or the ones named"},{value:"search",help:"find a skill across every source; fetches on first use"}]},{name:"rest",required:!1,variadic:!0,help:"a name and URL for add, a name for remove or update, words for search"}],flags:[{name:"path",kind:"string",placeholder:"dir",help:"subdirectory holding the skills (add)",defaultHelp:"the whole repository"},{name:"ref",kind:"string",placeholder:"branch",help:"branch or tag to track (add)",defaultHelp:"the remote's default branch"},n]},{name:"plugins",inSession:"output",needsServer:!1,summary:"list the plugins this agent loaded, and what each one registered",args:[a],flags:[n]},{name:"agents",inSession:"output",needsServer:!0,summary:"list the agents one or more manifests produce",args:[{...a,variadic:!0,help:"one or more paths to an agent.yaml"}],flags:[n]},{name:"tools",inSession:"output",needsServer:!1,summary:"show the resolved tool catalogue, or fetch a remote provider's schemas into the cache",args:[a],flags:[{name:"warm",kind:"boolean",help:"fetch every pinned slug from the provider and write the resolution cache"},n]},{name:"serve",inSession:"hidden",needsServer:!1,summary:"run the HTTP API and connect the agents' channels",args:[{...a,required:!1,variadic:!0,help:"paths to an agent.yaml, or sandbox agent names (omit for every enabled agent)"}],flags:[{name:"port",kind:"number",placeholder:"n",help:"port to bind",defaultHelp:"server.port, or 7420"},{name:"host",kind:"string",placeholder:"addr",help:"address to bind — a non-loopback host requires an API token",defaultHelp:"server.host, or 127.0.0.1"},{name:"claim",kind:"boolean",help:"print a one-time claim even when a key already exists"},t,n]},{name:"credential",inSession:"hidden",needsServer:!0,summary:"mint, list and revoke operator credentials, optionally scoped",args:[{name:"action",required:!0,help:"what to do",choices:[{value:"create",help:"mint one and print the secret, once"},{value:"list",help:"every credential, live and revoked, with its scope"},{value:"revoke",help:"kill one permanently"}]},{name:"keyId",required:!1,help:"which credential, for revoke (`credential list` prints the ids)"}],flags:[{name:"label",kind:"string",placeholder:"text",help:"how it is shown in a listing — required for create"},{name:"agents",kind:"string",placeholder:"a,b",help:"narrow it to these agents",defaultHelp:"every agent"},{name:"sessions",kind:"string",placeholder:"prefix",help:"narrow it to session keys starting with this",defaultHelp:"every session"},{name:"can",kind:"string",placeholder:"list",help:"narrow it to these capabilities: read | chat | write | admin",defaultHelp:"all four"},{name:"expires",kind:"string",placeholder:"dur",help:"how long it lives: 30s, 15m, 2h, 7d, or seconds",defaultHelp:"never"},t,n]},{name:"keys",inSession:"hidden",needsServer:!1,summary:"press a chord and see the bytes, Ink's reading of them, and the intent",args:[],flags:[{name:"no-enhanced-keys",kind:"boolean",help:"do not negotiate the kitty keyboard protocol"}]},{name:"terminal-setup",inSession:"hidden",needsServer:!1,summary:"teach this terminal to send shift+enter as a new line",args:[],flags:[{name:"dry-run",kind:"boolean",help:"print the change and write nothing"},{name:"yes",kind:"boolean",help:"write it without asking"},n]},{name:"remove",inSession:"hidden",needsServer:!1,summary:"delete a sandbox agent: its directory, sessions, memory, logs and service",args:[{name:"agent",required:!1,help:"sandbox agent name (a path is refused — remove only manages agents `init` made)"}],flags:[{name:"dry-run",kind:"boolean",help:"show exactly what would go; delete nothing"},{name:"files-only",kind:"boolean",help:"delete the directory and keep the sessions, memory and logs"},{name:"prune",kind:"boolean",help:"delete sessions, memory and logs that no sandbox agent claims any more"},{name:"all",kind:"boolean",help:"remove every agent in the sandbox"},{name:"yes",kind:"boolean",help:"skip the typed confirmation (required to delete anything non-interactively)"},t,n]},{name:"stop",inSession:"hidden",needsServer:!1,summary:"stop one agent for good, or everything — named, it stays stopped across restarts",args:[{name:"agent",required:!1,help:"path or sandbox agent name (omit to stop the whole host)"}],flags:[{name:"dry-run",kind:"boolean",help:"list what would be stopped; stop nothing"},{name:"reason",kind:"string",help:"why — recorded, and shown wherever the agent is reported as off"},t,n]},{name:"start",inSession:"hidden",needsServer:!0,summary:"switch an agent back on, and have a running host adopt it now",args:[a],flags:[t,n]},{name:"model",inSession:"output",needsServer:!1,summary:"ask the endpoint what it can actually do — window, output cap, prompt caching",args:[{name:"action",required:!0,help:"what to do",choices:[{value:"probe",help:"measure every configured role against its own endpoint"}]},{name:"agent",required:!0,help:"path or sandbox agent name"}],flags:[{name:"window",kind:"boolean",help:"search for the window by growing a prompt until it is refused — costs real tokens, and prints the estimate first"},{name:"price",kind:"number",placeholder:"usd",help:"dollars per million input tokens, if you want --window's estimate in money"},{name:"write",kind:"boolean",help:"record a measured ceiling in the manifest; a floor is refused, because a floor is not a window"},{name:"yes",kind:"boolean",help:"answer the --window spend prompt; nothing else is affected"},{name:"json",kind:"boolean",help:"machine-readable findings"}]},{name:"web",inSession:"output",needsServer:!0,summary:"open the browser view of a running agent",args:[{name:"action",required:!0,help:"what to do",choices:[{value:"run",help:"start a server if needed, then open the page"},{value:"open",help:"open the page of a server already running"},{value:"url",help:"print the address and open nothing — the form a pipe reads"}]},{name:"agent",required:!1,help:"path or sandbox agent name (omit to open the page itself)"}],flags:[{name:"no-open",kind:"boolean",help:"print the URL instead of opening it"},t,n]},{name:"daemon",inSession:"output",needsServer:!1,summary:"keep an agent serving in the background — starts at login, restarts on crash",args:[{name:"action",required:!0,help:"what to do",choices:[{value:"install",help:"check it will boot, write the service, load it, and watch it start"},{value:"uninstall",help:"unload it and remove the service definition"},{value:"start",help:"load it again after a stop"},{value:"stop",help:"unload it, and keep it stopped across a login"},{value:"restart",help:"what you run after editing agent.yaml or .env"},{value:"status",help:"running? how many restarts? why did it stop? — bare, reports every agent"},{value:"logs",help:"the tail of stderr; --lines, --follow, --truncate"}]},{name:"agent",required:!1,help:"path or sandbox agent name (omit only for status)"}],flags:[{name:"lines",kind:"number",placeholder:"n",integer:!0,min:1,help:"how much of the log to show",defaultHelp:"40"},{name:"follow",short:"f",kind:"boolean",help:"keep printing as the service writes — both streams; ctrl-C stops (logs)"},{name:"truncate",kind:"boolean",help:"empty the log files (logs)"},{name:"dry-run",kind:"boolean",help:"print the service definition and the checks; write nothing"},t,n]}];function _t(s){return le.find((r)=>r.name===s)}function $t(s){return[...s.flags,...Tt]}function xo(s,r){return le.filter((o)=>o.name!==r&&o.flags.some((i)=>i.name===s)).map((o)=>o.name)}
3
+ export{Tt,le,_t,$t,xo};
4
+
5
+ //# debugId=4BFDAB1FF3147B2764756E2164756E21
6
+ //# sourceMappingURL=index-yr25dnf5.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/lib/commands.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * The command table — data only, no rendering and no parsing.\n *\n * One source of truth for three consumers: `args.ts` parses against it, `help.ts` renders from it,\n * and error messages look flags up in it to say which command *does* accept a flag. Before this\n * existed the usage text was a hand-maintained string with no link to the parser, and it had\n * already drifted — `agents` accepted flags it never documented.\n *\n * Nothing here contains the product name. Command names come from `BRAND.slug`, so a rename stays\n * the one-commit operation hard rule 3 requires.\n */\n\nimport { BRAND } from \"@dispach/core\"\nimport { DEFAULT_ROW_LIMIT, MIN_ROW_LIMIT } from \"#lib/const\"\nimport type { ArgSpec, CommandSpec, FlagSpec } from \"#lib/schema\"\n\n/** Accepted by every command, so the render mode is answered the same way everywhere. */\nexport const GLOBAL_FLAGS: readonly FlagSpec[] = [\n {\n name: \"plain\",\n kind: \"boolean\",\n help: \"force plain text — no interactive rendering, no colour\",\n },\n { name: \"help\", short: \"h\", kind: \"boolean\", help: \"show this help and exit\" },\n { name: \"version\", short: \"v\", kind: \"boolean\", help: \"print the version and exit\" },\n {\n // Global rather than per command, because the first-run bootstrap is checked before any\n // `case` block runs — and because somebody who does not want it does not want it once.\n // `<PREFIX>NO_BOOTSTRAP` is the same switch for a script that cannot add a flag.\n name: \"no-bootstrap\",\n kind: \"boolean\",\n help: \"never start a background server on this run\",\n },\n]\n\nconst MANIFEST: ArgSpec = {\n name: \"manifest\",\n required: true,\n help: \"path to an agent.yaml, or the name of a sandbox agent\",\n}\n\nconst STORE: FlagSpec = {\n name: \"store\",\n kind: \"string\",\n placeholder: \"path\",\n help: \"session database\",\n defaultHelp: `~/${BRAND.stateDir}/store.db`,\n}\n\nconst SESSION: FlagSpec = {\n name: \"session\",\n kind: \"string\",\n placeholder: \"key\",\n help: \"session key\",\n // Written on its own, it means \"ask me which one\" — the interactive twin of `--continue`. Safe as a\n // bare form because a session key cannot start with a dash, which is the condition `FlagSpec.bare`\n // documents; `run` opens the picker and every other command reports that it needs a key.\n bare: \"\",\n}\n\nconst JSON_FLAG: FlagSpec = { name: \"json\", kind: \"boolean\", help: \"machine-readable output\" }\n\nexport const COMMANDS: readonly CommandSpec[] = [\n {\n // Interactive at a terminal; every question also has a flag so scripts and CI can run it.\n // It never asks for the API key itself — a prompt invites shoulder-surfing and a flag\n // writes the secret into shell history — so the generated .env has an empty line to fill.\n name: \"init\",\n\n inSession: \"hidden\",\n needsServer: true,\n summary: \"create a new agent: manifest, workspace, and env files\",\n // No positional. It used to be the target *directory*, which read as the agent's name and\n // was not — `init milo` silently wrote ./milo into whatever checkout you were standing in,\n // and an agent outside the sandbox has no bare name, so every later command needed a path.\n args: [],\n unexpectedArgHint:\n \"init takes no positional argument. To name the agent, --name <name>; to place it somewhere other than the sandbox, --dir <path>.\",\n flags: [\n { name: \"user\", kind: \"string\", placeholder: \"name\", help: \"your name\" },\n { name: \"name\", kind: \"string\", placeholder: \"name\", help: \"the agent's name\" },\n {\n name: \"purpose\",\n kind: \"string\",\n placeholder: \"text\",\n help: \"one line: what the agent is for\",\n },\n {\n name: \"preset\",\n kind: \"string\",\n placeholder: \"id\",\n help: \"model endpoint: openai | anthropic | deepseek | ollama | custom\",\n defaultHelp: \"openai\",\n },\n { name: \"model\", kind: \"string\", placeholder: \"id\", help: \"model id\" },\n { name: \"base-url\", kind: \"string\", placeholder: \"url\", help: \"endpoint base URL\" },\n {\n name: \"api-key-env\",\n kind: \"string\",\n placeholder: \"VAR\",\n help: \"env var that will hold the key; omitted for ollama\",\n defaultHelp: \"MODEL_API_KEY\",\n },\n {\n name: \"system\",\n kind: \"string\",\n placeholder: \"level\",\n help: \"what it may touch on this machine: none | read | write | full\",\n defaultHelp: \"none\",\n },\n {\n name: \"web\",\n kind: \"string\",\n placeholder: \"level\",\n help: \"internet access: none | fetch | search\",\n defaultHelp: \"none\",\n },\n {\n name: \"web-backend\",\n kind: \"string\",\n placeholder: \"id\",\n help: \"search backend when --web search: tavily | brave | exa\",\n defaultHelp: \"tavily\",\n },\n {\n name: \"composio\",\n kind: \"string\",\n placeholder: \"level\",\n help: \"your other apps via Composio: none | connected\",\n defaultHelp: \"none\",\n },\n {\n name: \"telegram\",\n kind: \"string\",\n placeholder: \"level\",\n help: \"reachable on Telegram: none | connected\",\n defaultHelp: \"none\",\n },\n {\n name: \"telegram-allow\",\n kind: \"string\",\n placeholder: \"@handle\",\n help: \"who may message it — empty permits nobody, which is the safe default\",\n },\n {\n name: \"server\",\n kind: \"string\",\n placeholder: \"level\",\n help: \"serve the HTTP API: none | local\",\n defaultHelp: \"none\",\n },\n {\n name: \"schedules\",\n kind: \"string\",\n placeholder: \"what\",\n help: \"run something on a schedule: none | daily | hourly\",\n defaultHelp: \"none\",\n },\n {\n name: \"skills\",\n kind: \"string\",\n placeholder: \"level\",\n // A phrase as well as a level, because the interesting answer is \"find me one\". The\n // default stays `starter` so a scripted run reaches no network.\n help: 'none | starter, or words to search the catalogues for — --skills \"pdf tables\"',\n defaultHelp: \"starter\",\n },\n {\n name: \"daemon\",\n kind: \"string\",\n placeholder: \"level\",\n help: \"keep it running in the background: none | service\",\n defaultHelp: \"none\",\n },\n {\n name: \"dir\",\n kind: \"string\",\n placeholder: \"path\",\n help: \"write the agent here instead of the sandbox\",\n defaultHelp: `~/${BRAND.stateDir}/agents/<agent-name-slug>`,\n },\n {\n name: \"yes\",\n kind: \"boolean\",\n help: \"take every default; never ask, even at a terminal\",\n },\n ],\n },\n {\n name: \"run\",\n\n inSession: \"hidden\",\n needsServer: true,\n summary: \"start an interactive session — bare `run` picks from the sandbox\",\n args: [\n {\n ...MANIFEST,\n required: false,\n help: \"path or sandbox agent name (omit to pick from the sandbox)\",\n },\n ],\n flags: [\n { ...SESSION, defaultHelp: \"a new one each run; bare --session picks from the list\" },\n {\n name: \"continue\",\n short: \"c\",\n kind: \"boolean\",\n help: \"pick up the most recent conversation with this agent\",\n },\n {\n name: \"input\",\n kind: \"string\",\n placeholder: \"text\",\n help: \"run one turn, print the reply, exit\",\n },\n STORE,\n {\n name: \"ephemeral\",\n kind: \"boolean\",\n help: \"keep this session in memory only; nothing is written\",\n },\n { name: \"quiet\", kind: \"boolean\", help: \"suppress the banner and per-turn stats\" },\n {\n // The same override `keys` carries, on the command that actually holds a session. The env\n // form works everywhere; a flag exists because the case this covers is \"try it without,\n // once\" and reaching for a variable to answer a one-off question is friction.\n name: \"no-enhanced-keys\",\n kind: \"boolean\",\n help: \"do not negotiate the kitty keyboard protocol (cmd chords stop arriving)\",\n },\n {\n name: \"no-reasoning\",\n kind: \"boolean\",\n help: \"hide the thinking a reasoning model streams (shown by default)\",\n },\n {\n // Kept so existing scripts keep working. Reasoning is on by default now, so this\n // asks for what already happens — harmless, and cheaper than breaking a flag people\n // have in their shell history.\n name: \"show-reasoning\",\n kind: \"boolean\",\n help: \"no-op: reasoning is shown by default when the model has any\",\n },\n ],\n },\n {\n // Reading, enabling and disabling — but never *writing* a schedule.\n //\n // Creating one from the CLI would be a third writer beside the manifest and the API, each\n // with its own idea of what a valid expression is; the manifest is where a schedule belongs,\n // because it is the thing that survives a rebuild and shows up in a diff. What the CLI adds\n // is the two questions a file cannot answer: when does this actually fire next, and did the\n // last run work.\n name: \"schedules\",\n\n // A view: a list somebody reads and then acts on, like `sessions`.\n inSession: \"view\",\n needsServer: true,\n summary: \"list schedules, when they next fire, and how the last run went\",\n args: [MANIFEST],\n flags: [\n {\n name: \"id\",\n kind: \"string\",\n placeholder: \"schedule\",\n help: \"show one schedule in full instead of the list\",\n },\n {\n name: \"enable\",\n kind: \"string\",\n placeholder: \"schedule\",\n help: \"switch an API-created schedule on; a manifest one is enabled in agent.yaml\",\n },\n {\n name: \"disable\",\n kind: \"string\",\n placeholder: \"schedule\",\n help: \"switch an API-created schedule off; a manifest one is disabled in agent.yaml\",\n },\n {\n name: \"recipients\",\n kind: \"boolean\",\n // The question a manifest cannot answer and this command is already holding the\n // store to answer: what do I put in `deliver.to`. A handle is the form a person\n // knows and the form that fails.\n help: \"list the addresses this agent can deliver to — what deliver.to takes\",\n },\n STORE,\n JSON_FLAG,\n ],\n },\n {\n name: \"sessions\",\n\n // A view rather than an output pane: the list is a *choice*, and reading it read-only was the one\n // thing you could already do by exiting and passing `--session`. Enter switches.\n inSession: \"view\",\n needsServer: false,\n summary: \"list stored sessions, or inspect one\",\n args: [MANIFEST],\n flags: [\n { ...SESSION, help: \"show one session instead of the list\" },\n { name: \"turns\", kind: \"boolean\", help: \"show turn records instead of messages\" },\n {\n name: \"clear\",\n kind: \"boolean\",\n help: \"delete the named session's history; memory files are untouched\",\n },\n {\n name: \"limit\",\n kind: \"number\",\n placeholder: \"n\",\n help: \"rows to show\",\n defaultHelp: String(DEFAULT_ROW_LIMIT),\n min: MIN_ROW_LIMIT,\n integer: true,\n },\n STORE,\n JSON_FLAG,\n ],\n },\n {\n // Two questions, and they are asked of the *index* rather than of the files. `search` is what\n // makes a ranking explicable — it prints the lexical score beside the boosted one, so \"retrieved\n // because it is about your question\" and \"retrieved because it is recent\" are distinguishable\n // without reading the code. `rebuild` exists because staleness detection is mtime plus size, and\n // an edit that preserves both is a real blind spot rather than a hypothetical one.\n name: \"memory\",\n\n // A view: the result is a list somebody reads and then wants to act on. Read-only for now —\n // deleting a memory means editing the file, which is the point of files being canonical.\n inSession: \"view\",\n needsServer: false,\n summary: \"search what the agent remembers, or rebuild the index from the files\",\n args: [\n {\n name: \"action\",\n required: true,\n help: \"what to do\",\n choices: [\n {\n value: \"search\",\n help: \"rank the corpus against a query, exactly as a turn would\",\n },\n {\n value: \"rebuild\",\n help: \"forget the index and re-read every file — for an edit that kept the mtime\",\n },\n ],\n },\n { ...MANIFEST, required: true },\n {\n name: \"query\",\n required: false,\n help: \"the words to search for (search only); quote a phrase\",\n },\n ],\n flags: [\n STORE,\n {\n name: \"limit\",\n kind: \"number\",\n placeholder: \"n\",\n help: \"passages to show\",\n defaultHelp: \"10\",\n min: 1,\n integer: true,\n },\n {\n // The manifest's `memory.threshold` is what a *turn* applies. A search is a person\n // asking what is in there, and a floor that hid the near-misses would make the command\n // useless for the question it exists to answer — \"why did it not recall that?\"\n name: \"all\",\n kind: \"boolean\",\n help: \"show passages below the manifest's threshold too, marked\",\n },\n JSON_FLAG,\n ],\n },\n {\n // A person's editor for the manifest. `config_read`/`config_set` are the *agent's*, and they\n // are deliberately floored on the fields decision 11.29 reserves for a person — which left\n // those fields with no editor at all until this existed.\n //\n // `view`, because bare `/config` opens the editor — a surface somebody navigates — while every\n // other action is a listing or a one-line report and falls through to an output pane. That\n // fallthrough is the existing contract for a view: \"a view named in the table with nothing built\n // yet falls back to its own output\".\n name: \"config\",\n\n inSession: \"view\",\n needsServer: false,\n summary: \"read and change an agent's settings, and fill in its secrets\",\n args: [\n {\n name: \"action\",\n // Optional, because `config <agent>` with no action opens the editor. `readAction`\n // decides which of the two the first positional is; the six action words win.\n required: false,\n help: \"what to do (default: edit)\",\n choices: [\n {\n value: \"edit\",\n help: \"the full-screen editor — also what bare `config <agent>` opens\",\n },\n { value: \"list\", help: \"every setting, its current value, and who may set it\" },\n { value: \"get\", help: \"one setting\" },\n { value: \"set\", help: \"change one setting\" },\n {\n value: \"env\",\n help: \"put a secret in the .env beside the manifest, prompted and not echoed\",\n },\n {\n value: \"allow\",\n help: \"add or remove a handle a channel accepts messages from\",\n },\n ],\n },\n // Not required: `config <agent>` puts the agent in positional 0, and `readAction` moves it.\n // Declaring it required would fail on arity before that ever ran.\n { ...MANIFEST, required: false },\n {\n name: \"name\",\n required: false,\n help: \"the setting's dotted path, an env variable name, or a handle\",\n },\n { name: \"value\", required: false, help: \"the new value (set only)\" },\n ],\n flags: [\n STORE,\n {\n name: \"channel\",\n kind: \"string\",\n placeholder: \"id\",\n help: \"which channel to allow on, when there is more than one\",\n },\n {\n name: \"remove\",\n kind: \"boolean\",\n help: \"take the handle off instead of adding it (allow only)\",\n },\n {\n // Only reaches the two edits that stop a check running. Everything else applies\n // without asking, so this is not the flag people learn to type by reflex.\n name: \"yes\",\n kind: \"boolean\",\n help: \"skip the confirmation on an edit that weakens a check\",\n },\n ],\n },\n {\n name: \"validate\",\n\n inSession: \"output\",\n needsServer: false,\n summary: \"load and validate a manifest, then exit\",\n args: [MANIFEST],\n flags: [JSON_FLAG],\n },\n {\n // Distinct from `validate`, which asks whether the manifest loads. This asks whether the\n // *writing* is any good — the authoring rules of 07-SPEC-WORKSPACE.md, which are judgements\n // rather than facts and are therefore warnings that never fail the command.\n name: \"workspace\",\n\n inSession: \"output\",\n needsServer: false,\n summary: \"check the workspace files against the authoring rules\",\n args: [MANIFEST],\n flags: [\n {\n name: \"strict\",\n kind: \"boolean\",\n help: \"exit non-zero when any authoring warning is reported\",\n },\n JSON_FLAG,\n ],\n },\n {\n // A scaffold, never a summary: headings and <rules> blocks survive verbatim, prose becomes\n // placeholders a person fills. Automatic distillation of an identity document drops exactly\n // the parts that produce voice, which is why this is a command and not something load does.\n name: \"soul\",\n\n inSession: \"output\",\n needsServer: false,\n summary: \"scaffold a hand-edited compact identity from a long-form document\",\n args: [\n {\n name: \"action\",\n required: true,\n help: \"what to do\",\n choices: [\n { value: \"distill\", help: \"scaffold a compact identity beside the source\" },\n ],\n },\n { name: \"file\", required: true, help: \"path to the long-form identity document\" },\n ],\n flags: [\n {\n name: \"out\",\n kind: \"string\",\n placeholder: \"path\",\n help: \"where to write the scaffold\",\n defaultHelp: \"<file>.compact.md beside the source\",\n },\n ],\n },\n {\n // Three questions rather than one. `validate` warns and exits 0 like `workspace` does, because\n // everything it reports is a judgement — a skill that does not load has already failed by then.\n name: \"skills\",\n\n inSession: \"view\",\n needsServer: false,\n summary: \"browse the catalogue and install — or list, scaffold, check one agent's skills\",\n args: [\n {\n name: \"action\",\n // Optional, so bare `skills` is the browse screen. That is the entry point somebody who\n // wants a skill actually has: every other form needs an agent, a query or a slug they\n // have not seen yet.\n required: false,\n help: \"what to do — omit to browse the catalogue and tick what you want\",\n choices: [\n { value: \"list\", help: \"every skill, its size, and whether it ships scripts\" },\n {\n value: \"show\",\n help: \"one skill in full, including what the model never sees\",\n },\n {\n value: \"new\",\n help: \"scaffold a skill, turning skills on for this agent if they are not\",\n },\n {\n value: \"install\",\n help: \"install one by name — anthropic/pdf — or copy from a local path (see `sources`)\",\n },\n { value: \"remove\", help: \"delete a skill's directory and everything in it\" },\n { value: \"validate\", help: \"authoring warnings — never a refusal\" },\n ],\n },\n {\n ...MANIFEST,\n required: false,\n help: \"path or sandbox agent name (not used when browsing)\",\n },\n {\n name: \"name\",\n required: false,\n help: \"the skill for show, new and remove — for install, <source>/<skill> or a local path\",\n },\n ],\n flags: [\n {\n name: \"strict\",\n kind: \"boolean\",\n help: \"exit non-zero when any authoring warning is reported\",\n },\n JSON_FLAG,\n ],\n },\n {\n // Machine-level, so it takes no manifest — the split from `skills` that keeps every positional\n // here meaning one thing. A source is a place the person trusts; a skill is one agent's.\n name: \"sources\",\n\n inSession: \"view\",\n needsServer: false,\n summary: \"the repositories skills come from: list, add, search\",\n args: [\n {\n name: \"action\",\n required: true,\n help: \"what to do\",\n choices: [\n { value: \"list\", help: \"every source, and whether it has been fetched\" },\n { value: \"add\", help: \"add a repository — a URL, or a name and a URL\" },\n { value: \"remove\", help: \"stop searching a source; built-ins included\" },\n { value: \"update\", help: \"re-fetch every source, or the ones named\" },\n {\n value: \"search\",\n help: \"find a skill across every source; fetches on first use\",\n },\n ],\n },\n {\n name: \"rest\",\n required: false,\n variadic: true,\n help: \"a name and URL for add, a name for remove or update, words for search\",\n },\n ],\n flags: [\n {\n name: \"path\",\n kind: \"string\",\n placeholder: \"dir\",\n help: \"subdirectory holding the skills (add)\",\n defaultHelp: \"the whole repository\",\n },\n {\n name: \"ref\",\n kind: \"string\",\n placeholder: \"branch\",\n help: \"branch or tag to track (add)\",\n defaultHelp: \"the remote's default branch\",\n },\n JSON_FLAG,\n ],\n },\n {\n name: \"plugins\",\n\n inSession: \"output\",\n needsServer: false,\n summary: \"list the plugins this agent loaded, and what each one registered\",\n args: [MANIFEST],\n flags: [JSON_FLAG],\n },\n {\n name: \"agents\",\n\n inSession: \"output\",\n needsServer: true,\n summary: \"list the agents one or more manifests produce\",\n args: [{ ...MANIFEST, variadic: true, help: \"one or more paths to an agent.yaml\" }],\n flags: [JSON_FLAG],\n },\n {\n // The one command whose whole purpose is to make a network call, which is why it is a command\n // rather than something boot does: boot resolves a remote catalogue from disk so that nothing\n // touches the network before readiness, and an empty cache would otherwise deadlock — the load\n // fails on unresolved slugs, so the post-readiness refresh that would have filled it never runs.\n name: \"tools\",\n\n inSession: \"output\",\n needsServer: false,\n summary:\n \"show the resolved tool catalogue, or fetch a remote provider's schemas into the cache\",\n args: [MANIFEST],\n flags: [\n {\n name: \"warm\",\n kind: \"boolean\",\n help: \"fetch every pinned slug from the provider and write the resolution cache\",\n },\n JSON_FLAG,\n ],\n },\n {\n // The only command that opens a listening socket, and the only one that starts channels.\n // `run` builds the same runtime without them: a REPL that quietly began answering Telegram\n // while you typed at it would be a surprise.\n name: \"serve\",\n\n inSession: \"hidden\",\n needsServer: false,\n summary: \"run the HTTP API and connect the agents' channels\",\n // Variadic since 16.2a. One process hosts N agents — decision 8.5 has said so since the\n // beginning, and only this line pinned the product to one. The bind is process-level, so a\n // second manifest declaring a *different* `server.port`, `host` or `tokenEnv` is refused\n // rather than silently ignored.\n //\n // **Optional since 16.3**, which is what makes the product always-on: naming nothing hosts\n // the sandbox's enabled agents, so a host does not have to be told which agents to serve —\n // and one that did could never serve an agent provisioned after it started. Naming\n // manifests is the container's shape, where the agent arrives on a mount.\n args: [\n {\n ...MANIFEST,\n required: false,\n variadic: true,\n help: \"paths to an agent.yaml, or sandbox agent names (omit for every enabled agent)\",\n },\n ],\n flags: [\n {\n name: \"port\",\n kind: \"number\",\n placeholder: \"n\",\n help: \"port to bind\",\n defaultHelp: \"server.port, or 7420\",\n },\n {\n name: \"host\",\n kind: \"string\",\n placeholder: \"addr\",\n help: \"address to bind — a non-loopback host requires an API token\",\n defaultHelp: \"server.host, or 127.0.0.1\",\n },\n {\n // The escape from a lockout, and the reason it needs to exist: a claim is printed\n // only while no operator key is live, so an operator who loses the only key on a\n // server with no configured token has no route back in. A person able to run\n // `serve` on that machine already holds the store file, so the flag confers nothing\n // they could not get with sqlite3 — it just makes the recovery nameable.\n name: \"claim\",\n kind: \"boolean\",\n help: \"print a one-time claim even when a key already exists\",\n },\n STORE,\n JSON_FLAG,\n ],\n },\n {\n /**\n * Operator credentials, from a terminal.\n *\n * **Not `keys`**, which is taken by the keyboard diagnostic below — two unrelated meanings\n * under one verb costs somebody a confused minute every time they reach for either. `token`\n * loses to `server.tokenEnv`, a different credential this command can neither mint nor\n * revoke. `credential` is the word the spec and the store already use.\n *\n * `needsServer` is **true**: a credential belongs to a server rather than to a file, and\n * this is an HTTP client. Writing the store directly would bypass the label rule, the scope\n * validation and the refusal of a scope naming an agent that does not exist — the two\n * surfaces would then disagree about what a valid credential is.\n */\n name: \"credential\",\n // Minting a credential from inside a chat would print a secret into a transcript that is\n // then stored, indexed and retrievable. The one place it must not appear.\n inSession: \"hidden\",\n needsServer: true,\n summary: \"mint, list and revoke operator credentials, optionally scoped\",\n args: [\n {\n name: \"action\",\n required: true,\n help: \"what to do\",\n choices: [\n { value: \"create\", help: \"mint one and print the secret, once\" },\n { value: \"list\", help: \"every credential, live and revoked, with its scope\" },\n { value: \"revoke\", help: \"kill one permanently\" },\n ],\n },\n {\n name: \"keyId\",\n required: false,\n help: \"which credential, for revoke (`credential list` prints the ids)\",\n },\n ],\n flags: [\n {\n name: \"label\",\n kind: \"string\",\n placeholder: \"text\",\n help: \"how it is shown in a listing — required for create\",\n },\n {\n name: \"agents\",\n kind: \"string\",\n placeholder: \"a,b\",\n help: \"narrow it to these agents\",\n defaultHelp: \"every agent\",\n },\n {\n name: \"sessions\",\n kind: \"string\",\n placeholder: \"prefix\",\n help: \"narrow it to session keys starting with this\",\n defaultHelp: \"every session\",\n },\n {\n name: \"can\",\n kind: \"string\",\n placeholder: \"list\",\n help: \"narrow it to these capabilities: read | chat | write | admin\",\n defaultHelp: \"all four\",\n },\n {\n name: \"expires\",\n kind: \"string\",\n placeholder: \"dur\",\n help: \"how long it lives: 30s, 15m, 2h, 7d, or seconds\",\n defaultHelp: \"never\",\n },\n STORE,\n JSON_FLAG,\n ],\n },\n {\n // The instrument, not a setting. `terminal-setup` below changes a terminal's configuration; this\n // one only reports what the current terminal already does, which is the question that has to be\n // answered first and could not be until now.\n name: \"keys\",\n inSession: \"hidden\",\n needsServer: false,\n summary: \"press a chord and see the bytes, Ink's reading of them, and the intent\",\n args: [],\n flags: [\n {\n name: \"no-enhanced-keys\",\n kind: \"boolean\",\n help: \"do not negotiate the kitty keyboard protocol\",\n },\n ],\n },\n {\n // The only command that edits a file outside the workspace, which is why it prints the change\n // first and asks. ⌥⏎ needs none of it — this is for people who want shift+⏎ as well.\n name: \"terminal-setup\",\n\n inSession: \"hidden\",\n needsServer: false,\n summary: \"teach this terminal to send shift+enter as a new line\",\n args: [],\n flags: [\n { name: \"dry-run\", kind: \"boolean\", help: \"print the change and write nothing\" },\n { name: \"yes\", kind: \"boolean\", help: \"write it without asking\" },\n JSON_FLAG,\n ],\n },\n {\n // The switch that turns everything off. Separate from `daemon stop`, which needs you to\n // know the agent: this one finds the services *and* a `serve` left in a forgotten tab.\n // The mirror of `init`: it created a directory, a manifest and a workspace, and everything since\n // has scattered into a shared store keyed by manifest id, a log pair, and possibly a LaunchAgent.\n // `hidden` for the same reason `stop` is — removing the agent you are talking to is worse than\n // stopping it.\n name: \"remove\",\n\n inSession: \"hidden\",\n needsServer: false,\n summary: \"delete a sandbox agent: its directory, sessions, memory, logs and service\",\n args: [\n {\n name: \"agent\",\n required: false,\n help: \"sandbox agent name (a path is refused — remove only manages agents `init` made)\",\n },\n ],\n flags: [\n {\n name: \"dry-run\",\n kind: \"boolean\",\n help: \"show exactly what would go; delete nothing\",\n },\n {\n name: \"files-only\",\n kind: \"boolean\",\n help: \"delete the directory and keep the sessions, memory and logs\",\n },\n {\n name: \"prune\",\n kind: \"boolean\",\n help: \"delete sessions, memory and logs that no sandbox agent claims any more\",\n },\n { name: \"all\", kind: \"boolean\", help: \"remove every agent in the sandbox\" },\n {\n name: \"yes\",\n kind: \"boolean\",\n help: \"skip the typed confirmation (required to delete anything non-interactively)\",\n },\n STORE,\n JSON_FLAG,\n ],\n },\n {\n name: \"stop\",\n\n inSession: \"hidden\",\n needsServer: false,\n summary: \"stop one agent for good, or everything — named, it stays stopped across restarts\",\n args: [\n {\n name: \"agent\",\n required: false,\n help: \"path or sandbox agent name (omit to stop the whole host)\",\n },\n ],\n flags: [\n {\n name: \"dry-run\",\n kind: \"boolean\",\n help: \"list what would be stopped; stop nothing\",\n },\n {\n name: \"reason\",\n kind: \"string\",\n help: \"why — recorded, and shown wherever the agent is reported as off\",\n },\n STORE,\n JSON_FLAG,\n ],\n },\n {\n // The other half of `stop <agent>`. Not `daemon start`, which starts a *process*: this\n // decides what a running process holds, which since 16.2a is a different question.\n name: \"start\",\n\n inSession: \"hidden\",\n needsServer: true,\n summary: \"switch an agent back on, and have a running host adopt it now\",\n args: [MANIFEST],\n flags: [STORE, JSON_FLAG],\n },\n {\n // `serve` stays up only as long as its terminal, which makes an agent configured for a\n // channel answer only while a window is open. This installs it as a supervised service.\n //\n name: \"model\",\n\n inSession: \"output\",\n needsServer: false,\n summary: \"ask the endpoint what it can actually do — window, output cap, prompt caching\",\n args: [\n {\n name: \"action\",\n required: true,\n help: \"what to do\",\n choices: [\n {\n value: \"probe\",\n help: \"measure every configured role against its own endpoint\",\n },\n ],\n },\n { name: \"agent\", required: true, help: \"path or sandbox agent name\" },\n ],\n flags: [\n {\n name: \"window\",\n kind: \"boolean\",\n help: \"search for the window by growing a prompt until it is refused — costs real tokens, and prints the estimate first\",\n },\n {\n name: \"price\",\n kind: \"number\",\n placeholder: \"usd\",\n help: \"dollars per million input tokens, if you want --window's estimate in money\",\n },\n {\n name: \"write\",\n kind: \"boolean\",\n help: \"record a measured ceiling in the manifest; a floor is refused, because a floor is not a window\",\n },\n {\n name: \"yes\",\n kind: \"boolean\",\n help: \"answer the --window spend prompt; nothing else is affected\",\n },\n { name: \"json\", kind: \"boolean\", help: \"machine-readable findings\" },\n ],\n },\n {\n name: \"web\",\n\n // A pane runs a command as a child and shows its output, which is right here: the effect is\n // a browser window, and one line saying where it went is all a session needs to report.\n inSession: \"output\",\n // `run` needs a host to point a browser at, and the first-run bootstrap is what makes\n // \"install, then open the page\" one step. `open` and `url` are read-only and say so when\n // nothing is running, rather than starting something on a machine that did not ask for it.\n needsServer: true,\n summary: \"open the browser view of a running agent\",\n args: [\n {\n name: \"action\",\n required: true,\n help: \"what to do\",\n choices: [\n { value: \"run\", help: \"start a server if needed, then open the page\" },\n { value: \"open\", help: \"open the page of a server already running\" },\n {\n value: \"url\",\n help: \"print the address and open nothing — the form a pipe reads\",\n },\n ],\n },\n {\n name: \"agent\",\n // Optional: a bare `web open` points at the page, which lists what the host has.\n // Naming an agent is what puts `?agent=` in the URL for the page to read.\n required: false,\n help: \"path or sandbox agent name (omit to open the page itself)\",\n },\n ],\n flags: [\n {\n name: \"no-open\",\n kind: \"boolean\",\n help: \"print the URL instead of opening it\",\n },\n STORE,\n JSON_FLAG,\n ],\n },\n {\n // Second action-as-positional command after `soul` — and the reason `ArgSpec.choices`\n // exists, since seven verbs hidden inside a prose help string is a set nothing can check.\n name: \"daemon\",\n\n inSession: \"output\",\n needsServer: false,\n summary: \"keep an agent serving in the background — starts at login, restarts on crash\",\n args: [\n {\n name: \"action\",\n required: true,\n help: \"what to do\",\n choices: [\n {\n value: \"install\",\n help: \"check it will boot, write the service, load it, and watch it start\",\n },\n { value: \"uninstall\", help: \"unload it and remove the service definition\" },\n { value: \"start\", help: \"load it again after a stop\" },\n { value: \"stop\", help: \"unload it, and keep it stopped across a login\" },\n { value: \"restart\", help: \"what you run after editing agent.yaml or .env\" },\n {\n value: \"status\",\n help: \"running? how many restarts? why did it stop? — bare, reports every agent\",\n },\n {\n value: \"logs\",\n help: \"the tail of stderr; --lines, --follow, --truncate\",\n },\n ],\n },\n {\n name: \"agent\",\n // Optional so a bare `daemon status` can answer \"is anything running?\" — the\n // question people actually have, and one that should not require naming an agent.\n required: false,\n help: \"path or sandbox agent name (omit only for status)\",\n },\n ],\n flags: [\n {\n name: \"lines\",\n kind: \"number\",\n placeholder: \"n\",\n integer: true,\n min: 1,\n help: \"how much of the log to show\",\n defaultHelp: \"40\",\n },\n {\n name: \"follow\",\n short: \"f\",\n kind: \"boolean\",\n help: \"keep printing as the service writes — both streams; ctrl-C stops (logs)\",\n },\n { name: \"truncate\", kind: \"boolean\", help: \"empty the log files (logs)\" },\n {\n name: \"dry-run\",\n kind: \"boolean\",\n help: \"print the service definition and the checks; write nothing\",\n },\n // The server preflight reads the lease table to report agents another process holds,\n // so this command has a store to point at like the others do.\n STORE,\n JSON_FLAG,\n ],\n },\n]\n\nexport function findCommand(name: string): CommandSpec | undefined {\n return COMMANDS.find((command) => command.name === name)\n}\n\n/** Every flag a command accepts: its own plus the global ones. */\nexport function flagsFor(command: CommandSpec): readonly FlagSpec[] {\n return [...command.flags, ...GLOBAL_FLAGS]\n}\n\n/**\n * Commands other than `exclude` that declare `flag`.\n *\n * Turns \"unknown flag --json\" — true but useless, since `--json` plainly exists — into a message\n * that names where it does work.\n */\nexport function commandsAccepting(flag: string, exclude: string): readonly string[] {\n return COMMANDS.filter(\n (command) => command.name !== exclude && command.flags.some((f) => f.name === flag),\n ).map((command) => command.name)\n}\n"
6
+ ],
7
+ "mappings": ";0EAiBO,IAAM,GAAoC,CAC7C,CACI,KAAM,QACN,KAAM,UACN,KAAM,wDACV,EACA,CAAE,KAAM,OAAQ,MAAO,IAAK,KAAM,UAAW,KAAM,yBAA0B,EAC7E,CAAE,KAAM,UAAW,MAAO,IAAK,KAAM,UAAW,KAAM,4BAA6B,EACnF,CAII,KAAM,eACN,KAAM,UACN,KAAM,6CACV,CACJ,EAEM,EAAoB,CACtB,KAAM,WACN,SAAU,GACV,KAAM,uDACV,EAEM,EAAkB,CACpB,KAAM,QACN,KAAM,SACN,YAAa,OACb,KAAM,mBACN,YAAa,KAAK,EAAM,mBAC5B,EAEM,EAAoB,CACtB,KAAM,UACN,KAAM,SACN,YAAa,MACb,KAAM,cAIN,KAAM,EACV,EAEM,EAAsB,CAAE,KAAM,OAAQ,KAAM,UAAW,KAAM,yBAA0B,EAEhF,GAAmC,CAC5C,CAII,KAAM,OAEN,UAAW,SACX,YAAa,GACb,QAAS,yDAIT,KAAM,CAAC,EACP,kBACI,mIACJ,MAAO,CACH,CAAE,KAAM,OAAQ,KAAM,SAAU,YAAa,OAAQ,KAAM,WAAY,EACvE,CAAE,KAAM,OAAQ,KAAM,SAAU,YAAa,OAAQ,KAAM,kBAAmB,EAC9E,CACI,KAAM,UACN,KAAM,SACN,YAAa,OACb,KAAM,iCACV,EACA,CACI,KAAM,SACN,KAAM,SACN,YAAa,KACb,KAAM,kEACN,YAAa,QACjB,EACA,CAAE,KAAM,QAAS,KAAM,SAAU,YAAa,KAAM,KAAM,UAAW,EACrE,CAAE,KAAM,WAAY,KAAM,SAAU,YAAa,MAAO,KAAM,mBAAoB,EAClF,CACI,KAAM,cACN,KAAM,SACN,YAAa,MACb,KAAM,qDACN,YAAa,eACjB,EACA,CACI,KAAM,SACN,KAAM,SACN,YAAa,QACb,KAAM,gEACN,YAAa,MACjB,EACA,CACI,KAAM,MACN,KAAM,SACN,YAAa,QACb,KAAM,yCACN,YAAa,MACjB,EACA,CACI,KAAM,cACN,KAAM,SACN,YAAa,KACb,KAAM,yDACN,YAAa,QACjB,EACA,CACI,KAAM,WACN,KAAM,SACN,YAAa,QACb,KAAM,iDACN,YAAa,MACjB,EACA,CACI,KAAM,WACN,KAAM,SACN,YAAa,QACb,KAAM,0CACN,YAAa,MACjB,EACA,CACI,KAAM,iBACN,KAAM,SACN,YAAa,UACb,KAAM,sEACV,EACA,CACI,KAAM,SACN,KAAM,SACN,YAAa,QACb,KAAM,mCACN,YAAa,MACjB,EACA,CACI,KAAM,YACN,KAAM,SACN,YAAa,OACb,KAAM,qDACN,YAAa,MACjB,EACA,CACI,KAAM,SACN,KAAM,SACN,YAAa,QAGb,KAAM,gFACN,YAAa,SACjB,EACA,CACI,KAAM,SACN,KAAM,SACN,YAAa,QACb,KAAM,oDACN,YAAa,MACjB,EACA,CACI,KAAM,MACN,KAAM,SACN,YAAa,OACb,KAAM,8CACN,YAAa,KAAK,EAAM,mCAC5B,EACA,CACI,KAAM,MACN,KAAM,UACN,KAAM,mDACV,CACJ,CACJ,EACA,CACI,KAAM,MAEN,UAAW,SACX,YAAa,GACb,QAAS,mEACT,KAAM,CACF,IACO,EACH,SAAU,GACV,KAAM,4DACV,CACJ,EACA,MAAO,CACH,IAAK,EAAS,YAAa,wDAAyD,EACpF,CACI,KAAM,WACN,MAAO,IACP,KAAM,UACN,KAAM,sDACV,EACA,CACI,KAAM,QACN,KAAM,SACN,YAAa,OACb,KAAM,qCACV,EACA,EACA,CACI,KAAM,YACN,KAAM,UACN,KAAM,sDACV,EACA,CAAE,KAAM,QAAS,KAAM,UAAW,KAAM,wCAAyC,EACjF,CAII,KAAM,mBACN,KAAM,UACN,KAAM,yEACV,EACA,CACI,KAAM,eACN,KAAM,UACN,KAAM,gEACV,EACA,CAII,KAAM,iBACN,KAAM,UACN,KAAM,6DACV,CACJ,CACJ,EACA,CAQI,KAAM,YAGN,UAAW,OACX,YAAa,GACb,QAAS,iEACT,KAAM,CAAC,CAAQ,EACf,MAAO,CACH,CACI,KAAM,KACN,KAAM,SACN,YAAa,WACb,KAAM,+CACV,EACA,CACI,KAAM,SACN,KAAM,SACN,YAAa,WACb,KAAM,4EACV,EACA,CACI,KAAM,UACN,KAAM,SACN,YAAa,WACb,KAAM,8EACV,EACA,CACI,KAAM,aACN,KAAM,UAIN,KAAM,sEACV,EACA,EACA,CACJ,CACJ,EACA,CACI,KAAM,WAIN,UAAW,OACX,YAAa,GACb,QAAS,uCACT,KAAM,CAAC,CAAQ,EACf,MAAO,CACH,IAAK,EAAS,KAAM,sCAAuC,EAC3D,CAAE,KAAM,QAAS,KAAM,UAAW,KAAM,uCAAwC,EAChF,CACI,KAAM,QACN,KAAM,UACN,KAAM,gEACV,EACA,CACI,KAAM,QACN,KAAM,SACN,YAAa,IACb,KAAM,eACN,YAAa,OAAO,EAAiB,EACrC,IAAK,GACL,QAAS,EACb,EACA,EACA,CACJ,CACJ,EACA,CAMI,KAAM,SAIN,UAAW,OACX,YAAa,GACb,QAAS,uEACT,KAAM,CACF,CACI,KAAM,SACN,SAAU,GACV,KAAM,aACN,QAAS,CACL,CACI,MAAO,SACP,KAAM,0DACV,EACA,CACI,MAAO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ACA,MAAO,CACH,CACI,KAAM,QACN,KAAM,SACN,YAAa,IACb,QAAS,GACT,IAAK,EACL,KAAM,8BACN,YAAa,IACjB,EACA,CACI,KAAM,SACN,MAAO,IACP,KAAM,UACN,KAAM,yEACV,EACA,CAAE,KAAM,WAAY,KAAM,UAAW,KAAM,4BAA6B,EACxE,CACI,KAAM,UACN,KAAM,UACN,KAAM,4DACV,EAGA,EACA,CACJ,CACJ,CACJ,EAEO,SAAS,EAAW,CAAC,EAAuC,CAC/D,OAAO,GAAS,KAAK,CAAC,IAAY,EAAQ,OAAS,CAAI,EAIpD,SAAS,EAAQ,CAAC,EAA2C,CAChE,MAAO,CAAC,GAAG,EAAQ,MAAO,GAAG,EAAY,EAStC,SAAS,EAAiB,CAAC,EAAc,EAAoC,CAChF,OAAO,GAAS,OACZ,CAAC,IAAY,EAAQ,OAAS,GAAW,EAAQ,MAAM,KAAK,CAAC,IAAM,EAAE,OAAS,CAAI,CACtF,EAAE,IAAI,CAAC,IAAY,EAAQ,IAAI",
8
+ "debugId": "4BFDAB1FF3147B2764756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The entry point: parse, dispatch, exit.
3
+ *
4
+ * No shebang here — the build prepends one via `--banner`. Two would be a syntax error, and the
5
+ * source is never executed directly: `bun run src/index.ts` and `node dist/index.js` are the two
6
+ * supported ways in.
7
+ *
8
+ * Three rules hold here and nowhere else.
9
+ *
10
+ * **It imports no Ink and no React.** The rich renderer is reached through a dynamic `import()` in
11
+ * `run.ts`, because loading it costs ~170-210 ms under Node — more than the entire runtime of
12
+ * `validate --json`. A static import anywhere on this path would be paid by every command.
13
+ *
14
+ * **Commands return exit codes; they never call `process.exit`.** Exiting mid-write discards buffered
15
+ * stdout when the output is a pipe, which is how `--json` gets read. This file is the one exception,
16
+ * on the last line, and only after `finish` has drained the output — a command that exits by itself
17
+ * skips the teardowns and the drain both.
18
+ *
19
+ * **Asking for help is a success.** The previous entry point set exit code 1 for `--help` given
20
+ * without a command, reporting failure for the one thing that had worked.
21
+ */
22
+ export {};
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG"}