dispach 0.2.3 → 0.2.4

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 (209) hide show
  1. package/README.md +29 -25
  2. package/dist/APEv2Parser-x13n424p.js +5 -0
  3. package/dist/{FlacParser-drm5wq0p.js.map → APEv2Parser-x13n424p.js.map} +1 -1
  4. package/dist/{AiffParser-9hj6fpmy.js → AiffParser-ns1y9f0g.js} +3 -3
  5. package/dist/{AiffParser-9hj6fpmy.js.map → AiffParser-ns1y9f0g.js.map} +1 -1
  6. package/dist/App-wkpkwgjt.js +11 -0
  7. package/dist/{App-2f72vhjv.js.map → App-wkpkwgjt.js.map} +1 -1
  8. package/dist/AsfParser-bae2a1yf.js +5 -0
  9. package/dist/{AsfParser-7emspn04.js.map → AsfParser-bae2a1yf.js.map} +1 -1
  10. package/dist/ConfigEditor-hy9jtas3.js +6 -0
  11. package/dist/{ConfigEditor-vk7vxaa6.js.map → ConfigEditor-hy9jtas3.js.map} +1 -1
  12. package/dist/DsdiffParser-s0zvxnfa.js +5 -0
  13. package/dist/{DsdiffParser-dz88pnnr.js.map → DsdiffParser-s0zvxnfa.js.map} +1 -1
  14. package/dist/{DsfParser-qgh63tbs.js → DsfParser-90mvzt4v.js} +3 -3
  15. package/dist/{DsfParser-qgh63tbs.js.map → DsfParser-90mvzt4v.js.map} +1 -1
  16. package/dist/FlacParser-8xprykrh.js +5 -0
  17. package/dist/{APEv2Parser-ysjr6adv.js.map → FlacParser-8xprykrh.js.map} +1 -1
  18. package/dist/{KeyProbe-5anphmb7.js → KeyProbe-fk5krzks.js} +3 -3
  19. package/dist/{KeyProbe-5anphmb7.js.map → KeyProbe-fk5krzks.js.map} +1 -1
  20. package/dist/MP4Parser-nmvbkq21.js +5 -0
  21. package/dist/{MP4Parser-yr7p3z12.js.map → MP4Parser-nmvbkq21.js.map} +2 -2
  22. package/dist/{MatroskaParser-jkbsbsk3.js → MatroskaParser-tsmz2qfq.js} +3 -3
  23. package/dist/{MatroskaParser-jkbsbsk3.js.map → MatroskaParser-tsmz2qfq.js.map} +1 -1
  24. package/dist/{MpegParser-t93vwnew.js → MpegParser-y5fjpaz9.js} +3 -3
  25. package/dist/{MpegParser-t93vwnew.js.map → MpegParser-y5fjpaz9.js.map} +1 -1
  26. package/dist/MusepackParser-544q0byg.js +5 -0
  27. package/dist/{MusepackParser-6e8kbh2d.js.map → MusepackParser-544q0byg.js.map} +2 -2
  28. package/dist/OggParser-v77rbjnt.js +5 -0
  29. package/dist/{OggParser-ggcypmag.js.map → OggParser-v77rbjnt.js.map} +1 -1
  30. package/dist/Picker-32m79nmp.js +5 -0
  31. package/dist/{Picker-j7txnm7w.js.map → Picker-32m79nmp.js.map} +1 -1
  32. package/dist/SessionPicker-9p06npt5.js +5 -0
  33. package/dist/{SessionPicker-hpv2ncsb.js.map → SessionPicker-9p06npt5.js.map} +1 -1
  34. package/dist/SkillBrowser-ezdx3xsh.js +5 -0
  35. package/dist/{SkillBrowser-qc542n71.js.map → SkillBrowser-ezdx3xsh.js.map} +1 -1
  36. package/dist/WavPackParser-k623m0hk.js +5 -0
  37. package/dist/{WavPackParser-jw9stzqp.js.map → WavPackParser-k623m0hk.js.map} +1 -1
  38. package/dist/WaveParser-nj4p1vx8.js +5 -0
  39. package/dist/{WaveParser-epmncs9w.js.map → WaveParser-nj4p1vx8.js.map} +1 -1
  40. package/dist/WizardApp-p350qspw.js +5 -0
  41. package/dist/{WizardApp-pgzcz9zq.js.map → WizardApp-p350qspw.js.map} +1 -1
  42. package/dist/channels-a9zx9yba.js +31 -0
  43. package/dist/{channels-m8nambmm.js.map → channels-a9zx9yba.js.map} +1 -1
  44. package/dist/config-3mz4zwsf.js +24 -0
  45. package/dist/{config-hmgrqgf2.js.map → config-3mz4zwsf.js.map} +2 -2
  46. package/dist/credential-ja7zmd4c.js +19 -0
  47. package/dist/{credential-nkb2ya59.js.map → credential-ja7zmd4c.js.map} +1 -1
  48. package/dist/index-039ew35r.js +6 -0
  49. package/dist/index-039ew35r.js.map +10 -0
  50. package/dist/index-0dvs3a06.js +6 -0
  51. package/dist/{index-jc4kmfwa.js.map → index-0dvs3a06.js.map} +1 -1
  52. package/dist/{index-pszmnhgq.js → index-1cagdzqe.js} +9 -9
  53. package/dist/{index-pszmnhgq.js.map → index-1cagdzqe.js.map} +1 -1
  54. package/dist/index-2fw9e5gg.js +6 -0
  55. package/dist/{index-0444sh6x.js.map → index-2fw9e5gg.js.map} +1 -1
  56. package/dist/{index-hgm2gchq.js → index-2td5h856.js} +12 -12
  57. package/dist/{index-hgm2gchq.js.map → index-2td5h856.js.map} +1 -1
  58. package/dist/{index-m6fqx0ch.js → index-446exxcb.js} +7 -7
  59. package/dist/{index-m6fqx0ch.js.map → index-446exxcb.js.map} +1 -1
  60. package/dist/{index-snz49ndn.js → index-4fajxhdv.js} +4 -4
  61. package/dist/{index-snz49ndn.js.map → index-4fajxhdv.js.map} +1 -1
  62. package/dist/index-4j65jp20.js +9 -0
  63. package/dist/{index-38gs9anh.js.map → index-4j65jp20.js.map} +1 -1
  64. package/dist/index-5gn74n56.js +10 -0
  65. package/dist/{index-22fzzn7z.js.map → index-5gn74n56.js.map} +2 -2
  66. package/dist/index-5zpfz4kb.js +9 -0
  67. package/dist/{index-eztfverw.js.map → index-5zpfz4kb.js.map} +1 -1
  68. package/dist/index-60h4knj6.js +126 -0
  69. package/dist/{index-ry6a4bqh.js.map → index-60h4knj6.js.map} +2 -2
  70. package/dist/index-635wcsh1.js +5 -0
  71. package/dist/{index-2bsardvh.js.map → index-635wcsh1.js.map} +1 -1
  72. package/dist/{index-k8e9f466.js → index-67sfck4d.js} +19 -19
  73. package/dist/index-67sfck4d.js.map +13 -0
  74. package/dist/index-7p8d1gf0.js +63 -0
  75. package/dist/{index-ytxbw8py.js.map → index-7p8d1gf0.js.map} +1 -1
  76. package/dist/index-7zgjkbb0.js +5 -0
  77. package/dist/{index-qgsdgbk8.js.map → index-7zgjkbb0.js.map} +1 -1
  78. package/dist/{index-zw6wyas6.js → index-86rb86nr.js} +4 -4
  79. package/dist/{index-zw6wyas6.js.map → index-86rb86nr.js.map} +1 -1
  80. package/dist/{index-fbsrhcga.js → index-8jejze0z.js} +4 -4
  81. package/dist/{index-fbsrhcga.js.map → index-8jejze0z.js.map} +1 -1
  82. package/dist/index-8k8y7edx.js +7 -0
  83. package/dist/{index-3826kf9t.js.map → index-8k8y7edx.js.map} +1 -1
  84. package/dist/index-8mkatm20.js +6 -0
  85. package/dist/{index-42e29zs4.js.map → index-8mkatm20.js.map} +1 -1
  86. package/dist/{index-3vzf253k.js → index-9k6qa50r.js} +7 -7
  87. package/dist/{index-3vzf253k.js.map → index-9k6qa50r.js.map} +1 -1
  88. package/dist/{index-yw3fby4n.js → index-a1axc952.js} +4 -4
  89. package/dist/{index-yw3fby4n.js.map → index-a1axc952.js.map} +1 -1
  90. package/dist/index-ayhdn87b.js +6 -0
  91. package/dist/{index-dzy19wtf.js.map → index-ayhdn87b.js.map} +1 -1
  92. package/dist/index-b8bfzbfe.js +6 -0
  93. package/dist/{index-836hc2h1.js.map → index-b8bfzbfe.js.map} +2 -2
  94. package/dist/index-brh25jhq.js +6 -0
  95. package/dist/{index-hrwakb11.js.map → index-brh25jhq.js.map} +2 -2
  96. package/dist/index-c6qrcweh.js +6 -0
  97. package/dist/{index-nxhqf597.js.map → index-c6qrcweh.js.map} +1 -1
  98. package/dist/index-cb45233h.js +6 -0
  99. package/dist/{index-nvc24414.js.map → index-cb45233h.js.map} +1 -1
  100. package/dist/{index-51x0n5z0.js → index-dcy14zdn.js} +5 -5
  101. package/dist/{index-51x0n5z0.js.map → index-dcy14zdn.js.map} +1 -1
  102. package/dist/index-f6r3h2yh.js +8 -0
  103. package/dist/{index-9t4dz145.js.map → index-f6r3h2yh.js.map} +1 -1
  104. package/dist/index-gezqawvw.js +11 -0
  105. package/dist/{index-sh44ymqz.js.map → index-gezqawvw.js.map} +1 -1
  106. package/dist/{index-1mbdz3f7.js → index-h787rq0h.js} +10 -10
  107. package/dist/{index-1mbdz3f7.js.map → index-h787rq0h.js.map} +1 -1
  108. package/dist/index-hd5nkwd7.js +74 -0
  109. package/dist/{index-djeqvfms.js.map → index-hd5nkwd7.js.map} +5 -5
  110. package/dist/index-k6wq0j4q.js +6 -0
  111. package/dist/{index-mjfv7k5w.js.map → index-k6wq0j4q.js.map} +1 -1
  112. package/dist/index-kz01jz58.js +6 -0
  113. package/dist/{index-323jvr1g.js.map → index-kz01jz58.js.map} +1 -1
  114. package/dist/{index-dv9pdjy4.js → index-mgef1n4e.js} +10 -10
  115. package/dist/{index-dv9pdjy4.js.map → index-mgef1n4e.js.map} +1 -1
  116. package/dist/{index-fxpmx6cr.js → index-n197qdw1.js} +191 -191
  117. package/dist/{index-fxpmx6cr.js.map → index-n197qdw1.js.map} +3 -3
  118. package/dist/index-nndwx2wp.js +153 -0
  119. package/dist/{index-dpcm1j62.js.map → index-nndwx2wp.js.map} +2 -2
  120. package/dist/index-pz92ksp8.js +5 -0
  121. package/dist/{index-3c5jt6by.js.map → index-pz92ksp8.js.map} +1 -1
  122. package/dist/index-qj4adnfe.js +14 -0
  123. package/dist/{index-y7dxq4a4.js.map → index-qj4adnfe.js.map} +2 -2
  124. package/dist/index-r83jpct7.js +6 -0
  125. package/dist/{index-xg7s813b.js.map → index-r83jpct7.js.map} +2 -2
  126. package/dist/{index-2zjh5zd5.js → index-rqfwd7j5.js} +4 -4
  127. package/dist/{index-2zjh5zd5.js.map → index-rqfwd7j5.js.map} +1 -1
  128. package/dist/index-s0f0s6n5.js +6 -0
  129. package/dist/{index-pqw1n1pv.js.map → index-s0f0s6n5.js.map} +1 -1
  130. package/dist/index-s0t15ndj.js +6 -0
  131. package/dist/{index-8edck2pr.js.map → index-s0t15ndj.js.map} +1 -1
  132. package/dist/index-tc054tcb.js +6 -0
  133. package/dist/{index-8tmv33mr.js.map → index-tc054tcb.js.map} +1 -1
  134. package/dist/{index-095hrkyr.js → index-ts8a1sdn.js} +6 -6
  135. package/dist/{index-095hrkyr.js.map → index-ts8a1sdn.js.map} +1 -1
  136. package/dist/index-tv52jhac.js +1252 -0
  137. package/dist/{index-hpvfqq6r.js.map → index-tv52jhac.js.map} +3 -3
  138. package/dist/index-x9nn57kk.js +6 -0
  139. package/dist/{index-1x8mzvz7.js.map → index-x9nn57kk.js.map} +1 -1
  140. package/dist/{index-308y9xt0.js → index-xyh98x7p.js} +4 -4
  141. package/dist/{index-308y9xt0.js.map → index-xyh98x7p.js.map} +1 -1
  142. package/dist/{index-jff5q27j.js → index-yy4v9kca.js} +4 -4
  143. package/dist/{index-jff5q27j.js.map → index-yy4v9kca.js.map} +1 -1
  144. package/dist/{index-bqdkm3de.js → index-yz0fcxky.js} +4 -4
  145. package/dist/{index-bqdkm3de.js.map → index-yz0fcxky.js.map} +1 -1
  146. package/dist/{index-p6ya59m6.js → index-z4adxmzm.js} +5 -5
  147. package/dist/{index-p6ya59m6.js.map → index-z4adxmzm.js.map} +1 -1
  148. package/dist/{index-4fj1k64j.js → index-zzpgsbn3.js} +4 -4
  149. package/dist/{index-4fj1k64j.js.map → index-zzpgsbn3.js.map} +1 -1
  150. package/dist/index.js +345 -345
  151. package/dist/index.js.map +4 -4
  152. package/dist/web-7mdrcb8a.js +14 -0
  153. package/dist/{web-gfv0mzgs.js.map → web-7mdrcb8a.js.map} +1 -1
  154. package/dist/wrapper-4hdmdwft.js +5 -0
  155. package/dist/{wrapper-f662ny3r.js.map → wrapper-4hdmdwft.js.map} +1 -1
  156. package/package.json +1 -1
  157. package/dist/APEv2Parser-ysjr6adv.js +0 -5
  158. package/dist/App-2f72vhjv.js +0 -11
  159. package/dist/AsfParser-7emspn04.js +0 -5
  160. package/dist/ConfigEditor-vk7vxaa6.js +0 -6
  161. package/dist/DsdiffParser-dz88pnnr.js +0 -5
  162. package/dist/FlacParser-drm5wq0p.js +0 -5
  163. package/dist/MP4Parser-yr7p3z12.js +0 -5
  164. package/dist/MusepackParser-6e8kbh2d.js +0 -5
  165. package/dist/OggParser-ggcypmag.js +0 -5
  166. package/dist/Picker-j7txnm7w.js +0 -5
  167. package/dist/SessionPicker-hpv2ncsb.js +0 -5
  168. package/dist/SkillBrowser-qc542n71.js +0 -5
  169. package/dist/WavPackParser-jw9stzqp.js +0 -5
  170. package/dist/WaveParser-epmncs9w.js +0 -5
  171. package/dist/WizardApp-pgzcz9zq.js +0 -5
  172. package/dist/channels-m8nambmm.js +0 -31
  173. package/dist/config-hmgrqgf2.js +0 -24
  174. package/dist/credential-nkb2ya59.js +0 -19
  175. package/dist/index-0444sh6x.js +0 -6
  176. package/dist/index-1x8mzvz7.js +0 -6
  177. package/dist/index-22fzzn7z.js +0 -10
  178. package/dist/index-2bsardvh.js +0 -5
  179. package/dist/index-323jvr1g.js +0 -6
  180. package/dist/index-3826kf9t.js +0 -7
  181. package/dist/index-38gs9anh.js +0 -9
  182. package/dist/index-3c5jt6by.js +0 -5
  183. package/dist/index-42e29zs4.js +0 -6
  184. package/dist/index-836hc2h1.js +0 -6
  185. package/dist/index-8edck2pr.js +0 -6
  186. package/dist/index-8tmv33mr.js +0 -6
  187. package/dist/index-9t4dz145.js +0 -8
  188. package/dist/index-djeqvfms.js +0 -74
  189. package/dist/index-dpcm1j62.js +0 -153
  190. package/dist/index-dzy19wtf.js +0 -6
  191. package/dist/index-eztfverw.js +0 -9
  192. package/dist/index-hpvfqq6r.js +0 -1252
  193. package/dist/index-hrwakb11.js +0 -6
  194. package/dist/index-jc4kmfwa.js +0 -6
  195. package/dist/index-k8e9f466.js.map +0 -13
  196. package/dist/index-mjfv7k5w.js +0 -6
  197. package/dist/index-nvc24414.js +0 -6
  198. package/dist/index-nxhqf597.js +0 -6
  199. package/dist/index-pqw1n1pv.js +0 -6
  200. package/dist/index-qgsdgbk8.js +0 -5
  201. package/dist/index-qv6ktepc.js +0 -6
  202. package/dist/index-qv6ktepc.js.map +0 -10
  203. package/dist/index-ry6a4bqh.js +0 -126
  204. package/dist/index-sh44ymqz.js +0 -11
  205. package/dist/index-xg7s813b.js +0 -6
  206. package/dist/index-y7dxq4a4.js +0 -14
  207. package/dist/index-ytxbw8py.js +0 -63
  208. package/dist/web-gfv0mzgs.js +0 -14
  209. package/dist/wrapper-f662ny3r.js +0 -5
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ import{J,n,yn,Re,IA,U,wo,di,ee,re}from"./index-tv52jhac.js";import"./index-mgef1n4e.js";import"./index-hd5nkwd7.js";import"./index-n197qdw1.js";import"./index-ayhdn87b.js";import{zA,Pi,Gi,Fi,Ui,xi,ZA,Vo,Wo,yA,Mn}from"./index-5zpfz4kb.js";import{Ft}from"./index-k6wq0j4q.js";import{TA,$n}from"./index-ts8a1sdn.js";import{Xn,eo,Ve,Yr}from"./index-gezqawvw.js";import{Ke,gt}from"./index-xyh98x7p.js";import{wt,H,Ze,ht}from"./index-4j65jp20.js";import{C,w}from"./index-9k6qa50r.js";import{G,Ge}from"./index-f6r3h2yh.js";import{Ue}from"./index-0dvs3a06.js";import{_t,Me,CA,o}from"./index-tc054tcb.js";import{readFileSync as y}from"node:fs";var p=["list","get","set","env","allow","edit"];function z(e,i,r=(t)=>process.stderr.write(t)){let t=(e??"").trim();if(t==="")return{action:"edit",ref:void 0};if(!p.includes(t))return{action:"edit",ref:t};if(i!==void 0&&p.includes(i))r(`note: reading "${t}" as the action and "${i}" as the agent
3
+ `);if(i===void 0&&t!=="list")return{action:t,ref:void 0};return{action:t,ref:i}}async function Y(e){let i=e.out??((a)=>process.stdout.write(a)),r=e.action??"";if(!p.includes(r)){let a=J(r,[...p]);throw new n({code:"cli_config_action_unknown",message:`"${r}" is not something config does.`,hint:`One of: ${p.join(", ")}.${a===void 0?"":` Did you mean ${a}?`}`})}let t=Ge(e.ref??"",e.sandboxEnv);switch(r){case"list":{i(`${Pi(Wo(t),t)}
4
+ `);let a=Vo(ZA(IA(y(t,"utf8"))),Ft(t));for(let s of a)i(`
5
+ ${w(`${s.name} is not set — ${s.why}`)}
6
+ `),i(`${w(`\`config env <agent> ${s.name}\` fills it in`)}
7
+ `);return o}case"get":return E(t,e,i);case"set":return await S(t,e,i);case"env":return await O(t,e,i);case"edit":return await x(t,e,i);default:return await k(t,e,i)}}function E(e,i,r){let t=(i.name??"").trim(),a=A(t),s=Wo(e).find((d)=>d.setting.path===a.path);return r(`${Gi(a,s?.value)}
8
+ `),o}function A(e){let i=wo(e)??di(e);if(i!==void 0)return i;let r=J(e,[...xi()]);throw new n({code:"cli_config_path_unknown",message:`"${e}" is not a setting.`,hint:`\`config list <agent>\` shows every one with its current value.${r===void 0?"":` Did you mean ${r}?`}`,field:"path"})}async function S(e,i,r){let t=(i.name??"").trim(),a=A(t);if(a.via!==void 0)throw new n({code:"cli_config_needs_action",message:`${a.path} is not set by a dotted path.`,hint:`Use \`${a.via}\` — it lives inside a list entry, and it gets its value checked against the service that issues it rather than written verbatim.`,field:"path"});if(i.value===void 0)throw new n({code:"cli_config_value_missing",message:`No value given for ${t}.`,hint:`A bare word, a number, a list as ["a", "b"], or a map as {k: v}. \`config get <agent> ${t}\` shows what it is now.`,field:"value"});let s=yn(i.value),d=Fi(a,s);if(d!==void 0&&i.yes!==!0){if(r(`${w(d)}
9
+ `),!await(i.confirm??TA)(`Change ${a.path} anyway?`))return r(`${C([{label:"unchanged",value:a.path}])}
10
+ `),o}let h=Ft(e),l=Vo(ZA(IA(y(e,"utf8"))),h).map((c)=>c.name),f=await Xn(e,t,i.value),g=Vo(ZA(IA(y(e,"utf8"))),h).filter((c)=>!l.includes(c.name)),m=await b(e,i);return r(`${Ui({path:t,before:f.before,after:s,file:e,reflowed:f.reflowed,...m===void 0?{}:{running:m},pending:g,restartHint:_(m?.mode)})}
11
+ `),o}function _(e){if(e==="daemon")return"`daemon restart <agent>`";if(e==="embedded")return"`/restart` in this session";if(e==="terminal")return"that process being started again";return"it is started again"}async function b(e,i){let r;try{r=U(e).id}catch{return}if(r===void 0)return;try{let t=await re.open({path:i.store??G(i.sandboxEnv)});try{for(let a of await t.leases.all()){if(a.agentId!==r)continue;if(!ee(a.pid))continue;return{pid:a.pid,mode:a.mode}}}finally{await t.close()}}catch{return}return}async function O(e,i,r){let t=(i.name??"").trim();if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(t))throw new n({code:"cli_config_env_name_invalid",message:`"${t}" is not an environment variable name.`,hint:"Letters, digits and underscores, not starting with a digit — MODEL_API_KEY, TELEGRAM_BOT_TOKEN. `config list <agent>` shows which ones this agent names.",field:"name"});let s=await(i.secret??$n)(`value for ${t} (not echoed):`);if(s===void 0)throw new n({code:"cli_config_env_no_value",message:`Nothing was written for ${t}.`,hint:"A secret is read from a prompt, never from an argument or a pipe — an argument is visible in `ps` and in shell history. Run this at a terminal, or edit the .env beside the manifest yourself."});if(s==="")throw new n({code:"cli_config_env_empty",message:`An empty value for ${t} would not start the agent.`,hint:"A variable set to nothing fails the load exactly as a missing one does. Nothing was written."});let d=Ve(e,t,s);return r(`${C([{label:"set",value:d.note}])}
12
+ `),r(`${w("takes effect the next time the agent starts")}
13
+ `),o}async function k(e,i,r){let t=Re(y(e,"utf8"),["channels"]);if(!Array.isArray(t)||t.length===0)throw new n({code:"cli_config_no_channels",message:"This agent has no channels, so there is nobody to allow.",hint:"`config set <agent> channels '[{type: telegram, id: tg, tokenEnv: TELEGRAM_BOT_TOKEN, mode: longpoll}]'` declares one first."});let a=t.filter((u)=>typeof u==="object"&&u!==null&&!Array.isArray(u)),s=a.map((u)=>String(u.id??"")).filter((u)=>u!==""),d=i.channel?.trim();if(d===void 0&&a.length>1)throw new n({code:"cli_config_channel_ambiguous",message:`This agent has ${a.length} channels, so --channel says which.`,hint:`One of: ${s.join(", ")}.`,field:"channel"});let h=d===void 0?0:a.findIndex((u)=>String(u.id??"")===d);if(h===-1)throw new n({code:"cli_config_channel_unknown",message:`No channel with id "${d}".`,hint:`Declared: ${s.join(", ")}.${J(d??"",s)===void 0?"":` Did you mean ${J(d??"",s)}?`}`,field:"channel"});let l=a[h],f=Yr(i.name??"",String(l.type??"")),g=Array.isArray(l.allowFrom)?l.allowFrom.map(String):[],m=i.remove===!0?g.filter((u)=>u!==f):g.includes(f)?g:[...g,f];if(m.length===g.length&&i.remove===!0)return r(`${C([{label:"unchanged",value:`${f} was not on ${String(l.id)}`}])}
14
+ `),o;if(m.length===g.length)return r(`${C([{label:"already allowed",value:`${f} on ${String(l.id)}`}])}
15
+ `),o;let c=await eo(e,String(l.id??""),m),v=await b(e,i);if(r(`${C([{label:i.remove===!0?"removed":"allowed",value:f},{label:"channel",value:String(l.id)},{label:"now",value:zA(m)},{label:"file",value:e}])}
16
+ `),c.reflowed)r(`${w("the file was re-serialised — it is valid, and comments may have moved")}
17
+ `);if(v!==void 0)r(`${w(`this agent is running (pid ${v.pid}, ${v.mode}) and holds its settings for its lifetime — the change applies after ${_(v.mode)}`)}
18
+ `);return o}async function x(e,i,r){let t=gt({plain:!1,json:!1,oneShot:!1});if(t.mode!=="rich")throw new n({code:"cli_config_edit_needs_terminal",message:"The settings editor needs a terminal.",hint:`Not one here (${t.because}). \`config list\` reads them and \`config set\` changes one, both of which work on a pipe.`});let[{render:a},{createElement:s},{ConfigEditor:d}]=await Promise.all([import("ink"),import("react"),import("./ConfigEditor-hy9jtas3.js")]),h=!1,l=()=>{},f=new Promise((c)=>{l=c});wt(),process.stdout.write(_t);let g=a(s(d,{rows:yA(e),apply:(c,v)=>Mn(e,c,v),reload:()=>yA(e),columns:Ue(process.stdout.columns,Me),window:CA,onDone:(c)=>{h=c,l()}}),{exitOnCtrlC:!1,...Ke()});H(()=>g.unmount()),await f,g.unmount(),Ze(),await ht();let m=await b(e,i);if(!h)return r(`${C([{label:"unchanged",value:e}])}
19
+ `),o;return r(`${C([{label:"changed",value:e}])}
20
+ `),r(`${w(`takes effect after ${_(m?.mode)}`)}
21
+ `),o}export{Y as configCommand,z as readAction};
22
+
23
+ //# debugId=CA781DDF35DAD89E64756E2164756E21
24
+ //# sourceMappingURL=config-3mz4zwsf.js.map
@@ -4,7 +4,7 @@
4
4
  "sourcesContent": [
5
5
  "/**\n * `config` — a person changing an agent's settings without hand-editing YAML.\n *\n * ## Why this exists\n *\n * `config_read`/`config_set` shipped in Phase 3.6 and are the *agent's*. There was no equivalent for a\n * person, so the routes were editing `agent.yaml` by hand, re-running `init` into a fresh directory, or\n * asking the agent (which needs `config_set` pinned, a matching allow rule, and a restart).\n *\n * The inversion is the argument for the command. Decision 11.29 reserves `allowFrom`, `server.host`,\n * `server.tokenEnv` and `writeRoots` **for the person**, floored so the agent cannot widen its own\n * reach — and that is right. But the only editor ever built was the agent's, so the fields designated\n * as the person's had the worst ergonomics in the system: unvalidated YAML that fails at the next boot.\n * It compounds with `.env` being protected *precisely* so the agent cannot supply its own secrets,\n * which left the one actor who can fill in `MODEL_API_KEY` with no tool for doing it.\n *\n * ## What this does not own\n *\n * The write. `editManifest` places, validates against the real schema, checks that the providers still\n * resolve, and only then writes — one writer for every surface, because the three that existed made\n * the guarantee depend on which caller you happened to be.\n *\n * ## Why nothing here is floored\n *\n * The agent's floor exists because an agent that could widen its own inbound gate could be *talked\n * into* it by the message it is reading. A person at a terminal is not that threat. Two edits are\n * confirmed rather than refused — `tools.policy.deny` and `onMutate: allow` — and `lib/config-view.ts`\n * decides which, so \"what needs a confirmation\" is assertable without performing one.\n */\n\nimport { readFileSync } from \"node:fs\"\nimport {\n HarnessError,\n manifestDocument,\n manifestValueAt,\n nearest,\n parseSettingValue,\n personSetting,\n processAlive,\n readManifestHeader,\n type Setting,\n SqliteStore,\n settingByPath,\n} from \"@dispach/core\"\nimport { applyAllow, applySecret, applySet, checkedHandle } from \"#lib/config-apply\"\nimport type { EditorRow } from \"#lib/config-editor\"\nimport { agentEnv } from \"#lib/config-env\"\nimport { applyEditorRow, currentValues, editorRowsFor } from \"#lib/config-rows\"\nimport {\n confirmationFor,\n envNeeds,\n renderChange,\n renderOne,\n renderSettings,\n settablePaths,\n showValue,\n unmet,\n} from \"#lib/config-view\"\nimport { askSecret, askYesNo } from \"#lib/confirm\"\nimport {\n ENTER_ALT_SCREEN,\n EXIT_FAILURE,\n EXIT_OK,\n FALLBACK_COLUMNS,\n MAX_SCREEN_ROWS,\n} from \"#lib/const\"\nimport { flushOutput, markAltScreen, onExit, restoreTerminal } from \"#lib/exit\"\nimport { negotiateKeyboard } from \"#lib/keyboard\"\nimport { resolveModeFromProcess } from \"#lib/output\"\nimport { bullet, keyValue } from \"#lib/render\"\nimport { resolveAgentRef, storePath } from \"#lib/sandbox\"\nimport { screenColumns } from \"#lib/screen\"\n\nexport interface ConfigCommandOptions {\n /** `list` | `get` | `set` | `env` | `allow`. */\n readonly action?: string\n /** A path or a sandbox agent name. */\n readonly ref?: string\n /** A setting path, an env variable name, or a handle, depending on the action. */\n readonly name?: string\n readonly value?: string\n readonly channel?: string\n readonly remove?: boolean\n readonly yes?: boolean\n readonly store?: string\n /** Injected by tests. */\n readonly confirm?: (question: string) => Promise<boolean>\n readonly secret?: (question: string) => Promise<string | undefined>\n /**\n * The `<ENVPREFIX>HOME` override that relocates the whole sandbox. **Not** the manifest\n * environment: that one is `ambientEnv`, computed from the resolved path, and answers \"is this\n * variable set\". Two env concepts in one options object want two names — conflating them has\n * already cost a round, where `skills install` consulted a different registry from `init`.\n */\n readonly sandboxEnv?: Readonly<Record<string, string | undefined>>\n readonly out?: (text: string) => void\n}\n\nconst ACTIONS = [\"list\", \"get\", \"set\", \"env\", \"allow\", \"edit\"] as const\n\n/**\n * Read the action and the agent out of the positionals, allowing `config <agent>` with no action.\n *\n * The editor is what most people want from this command, so typing its name and an agent has to work.\n * Disambiguated the way this repo already does it twice over: a slash command takes arguments only\n * after a token that is *exactly* a known command, and `resolveAgentRef` lets the filesystem win with a\n * note on genuine ambiguity. Here the six action words win, and anything else is an agent.\n *\n * The collision is an agent literally named after an action, and it gets the note rather than silence —\n * running the wrong thing quietly is the failure worth avoiding, and it does not look wrong in output.\n */\nexport function readAction(\n first: string | undefined,\n second: string | undefined,\n warn: (line: string) => void = (line) => process.stderr.write(line),\n): { readonly action: string; readonly ref: string | undefined } {\n const given = (first ?? \"\").trim()\n if (given === \"\") return { action: \"edit\", ref: undefined }\n if (!ACTIONS.includes(given as (typeof ACTIONS)[number])) {\n return { action: \"edit\", ref: given }\n }\n if (second !== undefined && ACTIONS.includes(second as (typeof ACTIONS)[number])) {\n // Both words are action names, so one of them is an agent and only the order says which. The\n // first wins, and the note is what stops a silently-wrong run — the same choice\n // `resolveAgentRef` makes for a bare name shadowed by a directory.\n warn(`note: reading \"${given}\" as the action and \"${second}\" as the agent\\n`)\n }\n if (second === undefined && given !== \"list\") {\n // A known action word with nothing after it. `config edit` alone is the editor with no agent,\n // which fails later with the usual missing-manifest error; anything else is ambiguous only if an\n // agent has that name, and `resolveAgentRef` is what finds out.\n return { action: given, ref: undefined }\n }\n return { action: given, ref: second }\n}\n\nexport async function configCommand(options: ConfigCommandOptions): Promise<number> {\n const out = options.out ?? ((text: string) => process.stdout.write(text))\n const action = options.action ?? \"\"\n if (!ACTIONS.includes(action as (typeof ACTIONS)[number])) {\n const suggestion = nearest(action, [...ACTIONS])\n throw new HarnessError({\n code: \"cli_config_action_unknown\",\n message: `\"${action}\" is not something config does.`,\n hint: `One of: ${ACTIONS.join(\", \")}.${\n suggestion === undefined ? \"\" : ` Did you mean ${suggestion}?`\n }`,\n })\n }\n\n const manifestPath = resolveAgentRef(options.ref ?? \"\", options.sandboxEnv)\n\n switch (action) {\n case \"list\": {\n out(`${renderSettings(currentValues(manifestPath), manifestPath)}\\n`)\n // What is currently missing belongs here rather than on every `set`: this is the command\n // whose job is the overview, and a note repeated on unrelated edits is one nobody reads.\n const missing = unmet(\n envNeeds(manifestDocument(readFileSync(manifestPath, \"utf8\"))),\n agentEnv(manifestPath),\n )\n for (const need of missing) {\n out(`\\n${bullet(`${need.name} is not set — ${need.why}`)}\\n`)\n out(`${bullet(`\\`config env <agent> ${need.name}\\` fills it in`)}\\n`)\n }\n return EXIT_OK\n }\n case \"get\":\n return get(manifestPath, options, out)\n case \"set\":\n return await set(manifestPath, options, out)\n case \"env\":\n return await env(manifestPath, options, out)\n case \"edit\":\n return await edit(manifestPath, options, out)\n default:\n return await allow(manifestPath, options, out)\n }\n}\n\nfunction get(\n manifestPath: string,\n options: ConfigCommandOptions,\n out: (text: string) => void,\n): number {\n const path = (options.name ?? \"\").trim()\n const setting = requireSetting(path)\n const row = currentValues(manifestPath).find((entry) => entry.setting.path === setting.path)\n out(`${renderOne(setting, row?.value)}\\n`)\n return EXIT_OK\n}\n\nfunction requireSetting(path: string): Setting {\n // `model.fast` is the `model.<role>` row, the one placeholder a person fills in themselves.\n const found = settingByPath(path) ?? personSetting(path)\n if (found !== undefined) return found\n const suggestion = nearest(path, [...settablePaths()])\n throw new HarnessError({\n code: \"cli_config_path_unknown\",\n message: `\"${path}\" is not a setting.`,\n hint: `\\`config list <agent>\\` shows every one with its current value.${\n suggestion === undefined ? \"\" : ` Did you mean ${suggestion}?`\n }`,\n field: \"path\",\n })\n}\n\nasync function set(\n manifestPath: string,\n options: ConfigCommandOptions,\n out: (text: string) => void,\n): Promise<number> {\n const path = (options.name ?? \"\").trim()\n const setting = requireSetting(path)\n\n if (setting.via !== undefined) {\n throw new HarnessError({\n code: \"cli_config_needs_action\",\n message: `${setting.path} is not set by a dotted path.`,\n hint: `Use \\`${setting.via}\\` — it lives inside a list entry, and it gets its value checked against the service that issues it rather than written verbatim.`,\n field: \"path\",\n })\n }\n if (options.value === undefined) {\n throw new HarnessError({\n code: \"cli_config_value_missing\",\n message: `No value given for ${path}.`,\n hint: `A bare word, a number, a list as [\"a\", \"b\"], or a map as {k: v}. \\`config get <agent> ${path}\\` shows what it is now.`,\n field: \"value\",\n })\n }\n\n const value = parseSettingValue(options.value)\n\n // The confirmation, before anything is read or written. It is not a floor — these edits are the\n // person's to make — but both of them stop a check from running, and an edit whose whole effect is\n // invisible until something exploits it is worth one sentence and a keypress.\n const warning = confirmationFor(setting, value)\n if (warning !== undefined && options.yes !== true) {\n out(`${bullet(warning)}\\n`)\n const ask = options.confirm ?? askYesNo\n if (!(await ask(`Change ${setting.path} anyway?`))) {\n out(`${keyValue([{ label: \"unchanged\", value: setting.path }])}\\n`)\n return EXIT_OK\n }\n }\n\n // The agent's own layered environment, not this process's. `ambientEnv` alone does not do it: it\n // demotes a colliding cwd variable and never adds the agent's own file, so a token sitting beside\n // the manifest read as unset.\n const ambient = agentEnv(manifestPath)\n const before = unmet(\n envNeeds(manifestDocument(readFileSync(manifestPath, \"utf8\"))),\n ambient,\n ).map((need) => need.name)\n\n // `applySet` owns the write, so the editor and this command cannot validate a value differently.\n const result = await applySet(manifestPath, path, options.value)\n\n // Newly required only. Computed either side of the edit rather than guessed from the value, so\n // `server.enabled true` reports the token it has just made load-bearing and `limits.maxSteps 9`\n // reports nothing — which a live run got wrong in the other direction, warning that an agent with\n // a disabled server \"will refuse to start\".\n const pending = unmet(\n envNeeds(manifestDocument(readFileSync(manifestPath, \"utf8\"))),\n ambient,\n ).filter((need) => !before.includes(need.name))\n\n const held = await running(manifestPath, options)\n out(\n `${renderChange({\n path,\n before: result.before,\n after: value,\n file: manifestPath,\n reflowed: result.reflowed,\n ...(held === undefined ? {} : { running: held }),\n pending,\n restartHint: restartHint(held?.mode),\n })}\\n`,\n )\n return EXIT_OK\n}\n\n/**\n * How this agent comes back, phrased for how it is currently held.\n *\n * All three `RuntimeMode` values, because the generic sentence is useless for two of them. `embedded` is\n * the case that matters most and is easiest to miss: it is *this* session, so the answer is one word the\n * person can type — and a live run reported `pid 90050, embedded` under \"it is started again\", which is\n * true and gives them nothing.\n */\nfunction restartHint(mode: string | undefined): string {\n if (mode === \"daemon\") return \"`daemon restart <agent>`\"\n if (mode === \"embedded\") return \"`/restart` in this session\"\n if (mode === \"terminal\") return \"that process being started again\"\n return \"it is started again\"\n}\n\n/**\n * A live process holding this agent, or `undefined`.\n *\n * Never a refusal, only a note. Fixing a misconfiguration *while it is running and broken* is the main\n * thing this command is for, so refusing in that state would block the case it exists to serve.\n *\n * Liveness is re-checked rather than trusted: a lease row is a claim, and a boot that failed after\n * claiming leaves a row seconds old with no process under it — which once blocked every retry for\n * ninety seconds while naming a pid that no longer existed.\n */\nasync function running(\n manifestPath: string,\n options: ConfigCommandOptions,\n): Promise<{ readonly pid: number; readonly mode: string } | undefined> {\n let agentId: string | undefined\n try {\n agentId = readManifestHeader(manifestPath).id\n } catch {\n return undefined\n }\n if (agentId === undefined) return undefined\n\n try {\n const store = await SqliteStore.open({\n path: options.store ?? storePath(options.sandboxEnv),\n })\n try {\n for (const lease of await store.leases.all()) {\n if (lease.agentId !== agentId) continue\n if (!processAlive(lease.pid)) continue\n return { pid: lease.pid, mode: lease.mode }\n }\n } finally {\n await store.close()\n }\n } catch {\n // A missing or unreadable store is not a reason to refuse a manifest edit. The note is a\n // courtesy; the write is the command.\n return undefined\n }\n return undefined\n}\n\n/**\n * Put a secret in the `.env` beside the manifest.\n *\n * The value is prompted and never taken from an argument: an argument lands in shell history and in\n * `ps`, readable by every local process for the lifetime of the call. Not a TTY refuses rather than\n * reading a pipe, so a CI run is told nothing was written instead of a secret arriving from a source\n * the caller did not audit.\n *\n * Written 0600 whichever way the file arrived. Under a service manager this file is the *only* path\n * credentials take — launchd hands a job almost no environment and a plist carries none on purpose —\n * so tightening it is right even when this command did not create it.\n */\nasync function env(\n manifestPath: string,\n options: ConfigCommandOptions,\n out: (text: string) => void,\n): Promise<number> {\n const name = (options.name ?? \"\").trim()\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {\n throw new HarnessError({\n code: \"cli_config_env_name_invalid\",\n message: `\"${name}\" is not an environment variable name.`,\n hint: \"Letters, digits and underscores, not starting with a digit — MODEL_API_KEY, TELEGRAM_BOT_TOKEN. `config list <agent>` shows which ones this agent names.\",\n field: \"name\",\n })\n }\n\n // Statically imported, not `await import`. A module reached both ways makes `bun build\n // --splitting` emit its exports twice and the binary refuses to parse — and `bun test` sails\n // through it, because tests import source and the failure is in the bundle. `confirm.ts` pulls in\n // only `node:readline`, so there is nothing to defer.\n const ask = options.secret ?? askSecret\n const value = await ask(`value for ${name} (not echoed):`)\n if (value === undefined) {\n throw new HarnessError({\n code: \"cli_config_env_no_value\",\n message: `Nothing was written for ${name}.`,\n hint: \"A secret is read from a prompt, never from an argument or a pipe — an argument is visible in `ps` and in shell history. Run this at a terminal, or edit the .env beside the manifest yourself.\",\n })\n }\n if (value === \"\") {\n throw new HarnessError({\n code: \"cli_config_env_empty\",\n message: `An empty value for ${name} would not start the agent.`,\n hint: \"A variable set to nothing fails the load exactly as a missing one does. Nothing was written.\",\n })\n }\n\n // The write itself is `applySecret`, which the editor calls too — two callers deciding separately\n // whether to tighten the file's mode is the same class of split as two manifest writers.\n const applied = applySecret(manifestPath, name, value)\n out(`${keyValue([{ label: \"set\", value: applied.note }])}\\n`)\n out(`${bullet(\"takes effect the next time the agent starts\")}\\n`)\n return EXIT_OK\n}\n\n/**\n * Add or remove a handle on a channel's `allowFrom`.\n *\n * Its own action rather than a `config set` path for two reasons. The source editor matches `key:` at\n * an indent and cannot index a sequence, so the field is not addressable — and rewriting the whole\n * `channels` list to change one handle is the dead end this command exists to remove. The second is\n * better: a handle can be *checked against the service that issues it*, and an impossible one is\n * otherwise a bot that is connected, healthy and silently refusing the one person it was set up for.\n */\nasync function allow(\n manifestPath: string,\n options: ConfigCommandOptions,\n out: (text: string) => void,\n): Promise<number> {\n const channels = manifestValueAt(readFileSync(manifestPath, \"utf8\"), [\"channels\"])\n if (!Array.isArray(channels) || channels.length === 0) {\n throw new HarnessError({\n code: \"cli_config_no_channels\",\n message: \"This agent has no channels, so there is nobody to allow.\",\n hint: \"`config set <agent> channels '[{type: telegram, id: tg, tokenEnv: TELEGRAM_BOT_TOKEN, mode: longpoll}]'` declares one first.\",\n })\n }\n\n const entries = channels.filter(\n (entry): entry is Record<string, unknown> =>\n typeof entry === \"object\" && entry !== null && !Array.isArray(entry),\n )\n const ids = entries.map((entry) => String(entry.id ?? \"\")).filter((id) => id !== \"\")\n const wanted = options.channel?.trim()\n if (wanted === undefined && entries.length > 1) {\n throw new HarnessError({\n code: \"cli_config_channel_ambiguous\",\n message: `This agent has ${entries.length} channels, so --channel says which.`,\n hint: `One of: ${ids.join(\", \")}.`,\n field: \"channel\",\n })\n }\n const at =\n wanted === undefined ? 0 : entries.findIndex((entry) => String(entry.id ?? \"\") === wanted)\n if (at === -1) {\n throw new HarnessError({\n code: \"cli_config_channel_unknown\",\n message: `No channel with id \"${wanted}\".`,\n hint: `Declared: ${ids.join(\", \")}.${\n nearest(wanted ?? \"\", ids) === undefined\n ? \"\"\n : ` Did you mean ${nearest(wanted ?? \"\", ids)}?`\n }`,\n field: \"channel\",\n })\n }\n\n const target = entries[at] as Record<string, unknown>\n const handle = checkedHandle(options.name ?? \"\", String(target.type ?? \"\"))\n const current = Array.isArray(target.allowFrom) ? target.allowFrom.map(String) : []\n\n const next =\n options.remove === true\n ? current.filter((entry) => entry !== handle)\n : current.includes(handle)\n ? current\n : [...current, handle]\n\n if (next.length === current.length && options.remove === true) {\n out(\n `${keyValue([\n { label: \"unchanged\", value: `${handle} was not on ${String(target.id)}` },\n ])}\\n`,\n )\n return EXIT_OK\n }\n if (next.length === current.length) {\n // Idempotent on purpose: running it twice is what somebody does when they are not sure it\n // took, and reporting a second write they did not make would be a small lie.\n out(\n `${keyValue([{ label: \"already allowed\", value: `${handle} on ${String(target.id)}` }])}\\n`,\n )\n return EXIT_OK\n }\n\n // `applyAllow` owns the write and the handle check, so the editor cannot validate a handle\n // differently from this command. It takes the whole list, because the whole list is what gets\n // written: one entry's key is not addressable by the source editor.\n const result = await applyAllow(manifestPath, String(target.id ?? \"\"), next)\n const held = await running(manifestPath, options)\n\n out(\n `${keyValue([\n { label: options.remove === true ? \"removed\" : \"allowed\", value: handle },\n { label: \"channel\", value: String(target.id) },\n { label: \"now\", value: showValue(next) },\n { label: \"file\", value: manifestPath },\n ])}\\n`,\n )\n if (result.reflowed) {\n out(`${bullet(\"the file was re-serialised — it is valid, and comments may have moved\")}\\n`)\n }\n if (held !== undefined) {\n out(\n `${bullet(\n `this agent is running (pid ${held.pid}, ${held.mode}) and holds its settings for its lifetime — the change applies after ${restartHint(held.mode)}`,\n )}\\n`,\n )\n }\n return EXIT_OK\n}\n\nexport const CONFIG_EXIT_FAILURE = EXIT_FAILURE\n\n/**\n * The editor, standalone.\n *\n * Alternate screen, because it waits for keys: it takes the terminal and gives it back. A changed flag\n * comes back through `onDone` so the one line printed afterwards can say a restart is needed — printed\n * on the real screen after the restore, because hard rule 8 does not stop applying when a screen closes.\n */\nasync function edit(\n manifestPath: string,\n options: ConfigCommandOptions,\n out: (text: string) => void,\n): Promise<number> {\n // Refused rather than attempted without a terminal. Two things went wrong otherwise, and the second\n // is the serious one: the alternate-screen sequence was written into a *pipe*, and Ink's own \"raw\n // mode is not supported\" error left the command exiting **0** — a failure that reported success,\n // which hard rule 8 exists to prevent. `browse` and `init` already ask this question the same way.\n const decision = resolveModeFromProcess({ plain: false, json: false, oneShot: false })\n if (decision.mode !== \"rich\") {\n throw new HarnessError({\n code: \"cli_config_edit_needs_terminal\",\n message: \"The settings editor needs a terminal.\",\n hint: `Not one here (${decision.because}). \\`config list\\` reads them and \\`config set\\` changes one, both of which work on a pipe.`,\n })\n }\n\n const [{ render }, { createElement }, { ConfigEditor }] = await Promise.all([\n import(\"ink\"),\n import(\"react\"),\n import(\"#components/ConfigEditor\"),\n ])\n\n let changed = false\n let finish: () => void = () => {}\n const closed = new Promise<void>((resolve) => {\n finish = resolve\n })\n\n markAltScreen()\n process.stdout.write(ENTER_ALT_SCREEN)\n\n // No wrapper component: the editor is a *view*, so it owns its own state and its single `useInput`,\n // exactly as `SkillBrowser` and `SessionPicker` do. Holding it here needed `useState` in this file,\n // which is a shared command path — and a static React import there costs ~170-210 ms on every\n // command including `validate --json`, which a boundaries test refuses outright.\n const instance = render(\n createElement(ConfigEditor, {\n rows: editorRowsFor(manifestPath),\n apply: (row: EditorRow, raw: string) => applyEditorRow(manifestPath, row, raw),\n reload: () => editorRowsFor(manifestPath),\n // A pty can report `columns === 0`, which `?? fallback` does not cover — measured, and it\n // once laid a picker's rows out for half the terminal, uniformly, on every row.\n columns: screenColumns(process.stdout.columns, FALLBACK_COLUMNS),\n window: MAX_SCREEN_ROWS,\n onDone: (didChange: boolean) => {\n changed = didChange\n finish()\n },\n }),\n { exitOnCtrlC: false, ...negotiateKeyboard() },\n )\n onExit(() => instance.unmount())\n await closed\n instance.unmount()\n restoreTerminal()\n await flushOutput()\n\n const held = await running(manifestPath, options)\n if (!changed) {\n out(`${keyValue([{ label: \"unchanged\", value: manifestPath }])}\\n`)\n return EXIT_OK\n }\n out(`${keyValue([{ label: \"changed\", value: manifestPath }])}\\n`)\n out(`${bullet(`takes effect after ${restartHint(held?.mode)}`)}\\n`)\n return EXIT_OK\n}\n"
6
6
  ],
7
- "mappings": ";mlBA8BA,uBAAS,gBAoET,IAAM,EAAU,CAAC,OAAQ,MAAO,MAAO,MAAO,QAAS,MAAM,EAatD,SAAS,CAAU,CACtB,EACA,EACA,EAA+B,CAAC,IAAS,QAAQ,OAAO,MAAM,CAAI,EACL,CAC7D,IAAM,GAAS,GAAS,IAAI,KAAK,EACjC,GAAI,IAAU,GAAI,MAAO,CAAE,OAAQ,OAAQ,IAAK,MAAU,EAC1D,GAAI,CAAC,EAAQ,SAAS,CAAiC,EACnD,MAAO,CAAE,OAAQ,OAAQ,IAAK,CAAM,EAExC,GAAI,IAAW,QAAa,EAAQ,SAAS,CAAkC,EAI3E,EAAK,kBAAkB,yBAA6B;AAAA,CAAwB,EAEhF,GAAI,IAAW,QAAa,IAAU,OAIlC,MAAO,CAAE,OAAQ,EAAO,IAAK,MAAU,EAE3C,MAAO,CAAE,OAAQ,EAAO,IAAK,CAAO,EAGjC,eAAe,CAAa,CAAC,EAAgD,CAChF,IAAM,EAAM,EAAQ,MAAQ,CAAC,IAAiB,QAAQ,OAAO,MAAM,CAAI,GACjE,EAAS,EAAQ,QAAU,GACjC,GAAI,CAAC,EAAQ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C/D,OAAQ,GACR,OAAQ,CAAC,IAAuB,CAC5B,EAAU,EACV,EAAO,EAEf,CAAC,EACD,CAAE,YAAa,MAAU,GAAkB,CAAE,CACjD,EACA,EAAO,IAAM,EAAS,QAAQ,CAAC,EAC/B,MAAM,EACN,EAAS,QAAQ,EACjB,GAAgB,EAChB,MAAM,GAAY,EAElB,IAAM,EAAO,MAAM,EAAQ,EAAc,CAAO,EAChD,GAAI,CAAC,EAED,OADA,EAAI,GAAG,EAAS,CAAC,CAAE,MAAO,YAAa,MAAO,CAAa,CAAC,CAAC;AAAA,CAAK,EAC3D,EAIX,OAFA,EAAI,GAAG,EAAS,CAAC,CAAE,MAAO,UAAW,MAAO,CAAa,CAAC,CAAC;AAAA,CAAK,EAChE,EAAI,GAAG,EAAO,sBAAsB,EAAY,GAAM,IAAI,GAAG;AAAA,CAAK,EAC3D",
8
+ "debugId": "CA781DDF35DAD89E64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ import{A,Mr}from"./index-tv52jhac.js";import"./index-mgef1n4e.js";import"./index-039ew35r.js";import{st}from"./index-yy4v9kca.js";import{ze,Ct,In,to}from"./index-b8bfzbfe.js";import"./index-f6r3h2yh.js";function u(e){let n=/^(\d+)\s*(s|m|h|d)?$/.exec(e.trim());if(n===null)throw new st({code:"credential_usage",message:`--expires ${JSON.stringify(e)} is not a duration.`,hint:"Write it as 30s, 15m, 2h or 7d — or as a plain number of seconds."});let r=Number(n[1]);if(r===0)throw new st({code:"credential_usage",message:"--expires 0 would mint a credential that has already expired.",hint:"Leave the flag off for a key that never expires, or give it a real duration like 1h."});let t={s:1,m:60,h:3600,d:86400}[n[2]??"s"]??1;return r*t}function g(e){let n=e.split(",").map((t)=>t.trim().toLowerCase()).filter((t)=>t!==""),r=n.filter((t)=>!Mr.includes(t));if(r.length>0)throw new st({code:"credential_usage",message:`--can names ${r.map((t)=>JSON.stringify(t)).join(", ")}, which is not a capability.`,hint:`They are: ${Mr.join(", ")}. read is every GET; chat sends a message, answers an approval and stops a turn; write covers schedules, phase and clearing a session; admin covers credentials, provisioning and start/stop; peer reaches only a plugin route that asks for it (an A2A endpoint).`});return n}function y(e){return e.split(",").map((n)=>n.trim()).filter((n)=>n!=="")}function c(e){let n=[];if(n.push(e.scope?.agents===void 0?"every agent":e.scope.agents.join(", ")),e.scope?.sessions!==void 0)n.push(`sessions ${e.scope.sessions}`);if(n.push(e.scope?.can===void 0?"all capabilities":e.scope.can.join("+")),e.expiresAt!==void 0)n.push(`until ${e.expiresAt}`);return n.join(" · ")}async function o(e){let n=await ze(e);if(n===void 0)throw new st({code:"credential_usage",message:"No server is running, so there is nothing to mint a credential on.",hint:`A credential belongs to a server rather than to a file, so this command is an API client. Start one with \`${A.slug} serve\`, or use POST /v1/keys directly against a server you can already reach.`});return{lease:n,manifest:to(n.agentId)}}async function b(e){if(e.action==="create")return await f(e);if(e.action==="list")return await h(e);if(e.action==="revoke")return await p(e);throw new st({code:"credential_usage",message:`Unknown action ${JSON.stringify(e.action)}.`,hint:"The actions are create, list and revoke."})}async function f(e){let n=e.label?.trim();if(n===void 0||n==="")throw new st({code:"credential_usage",message:"--label is required.",hint:'A label is the only thing distinguishing two credentials in a listing, and "key 2" is a name nobody can act on when deciding which to revoke.'});let r={...e.agents===void 0?{}:{agents:y(e.agents)},...e.sessions===void 0?{}:{sessions:e.sessions},...e.can===void 0?{}:{can:g(e.can)},...e.expires===void 0?{}:{expiresIn:u(e.expires)}},{lease:t,manifest:a}=await o(e.store),i=await Ct(t,"/v1/keys",{label:n,...Object.keys(r).length===0?{}:{scope:r}},a);if(!i.ok)return d(i,"mint a credential");let s=i.body;if(e.json===!0)return process.stdout.write(`${JSON.stringify(s,null,2)}
3
+ `),0;return process.stdout.write(`${s.secret}
4
+ `),process.stderr.write(` ${s.label} · ${s.keyId}
5
+ `),process.stderr.write(` reaches ${c(s)}
6
+ `),process.stderr.write(` This is the only time the secret is shown. It is stored as a fingerprint and no route returns it.
7
+ `),0}async function h(e){let{lease:n,manifest:r}=await o(e.store),t=await In(n,"GET","/v1/keys",r);if(!t.ok)return d(t,"list credentials");let a=t.body,i=a.keys??[];if(e.json===!0)return process.stdout.write(`${JSON.stringify(a,null,2)}
8
+ `),0;if(i.length===0)return process.stdout.write(`No credentials. The server token is the only way in.
9
+ `),0;for(let s of i){let l=s.revokedAt===void 0?"live":"revoked";process.stdout.write(`${s.keyId} ${l.padEnd(7)} ${s.label}
10
+ `),process.stdout.write(` reaches ${c(s)}
11
+ `),process.stdout.write(` created ${s.createdAt}${s.lastUsedAt===void 0?" · never used":` · last used ${s.lastUsedAt}`}
12
+ `)}return 0}async function p(e){let n=e.keyId?.trim();if(n===void 0||n==="")throw new st({code:"credential_usage",message:"Which credential?",hint:`\`${A.slug} credential list\` prints the ids. Revoking is permanent — a revoked secret can never be re-presented.`});let{lease:r,manifest:t}=await o(e.store),a=await In(r,"DELETE",`/v1/keys/${encodeURIComponent(n)}`,t);if(!a.ok)return d(a,"revoke that credential");let i=a.body;if(e.json===!0)return process.stdout.write(`${JSON.stringify(i,null,2)}
13
+ `),0;return process.stdout.write(`revoked ${i.keyId} · ${i.label}
14
+ `),0}function d(e,n){if(process.stderr.write(`Could not ${n}${e.status===0?"":` (${e.status})`}: ${e.detail??"the host did not answer"}
15
+ `),e.hint!==void 0)process.stderr.write(` hint: ${e.hint}
16
+ `);return 1}export{b as credentialCommand};
17
+
18
+ //# debugId=1337A6E3ECB8A74864756E2164756E21
19
+ //# sourceMappingURL=credential-ja7zmd4c.js.map
@@ -5,6 +5,6 @@
5
5
  "/**\n * Operator credentials from a terminal: mint one, list them, revoke one.\n *\n * ## Why this is not called `keys`\n *\n * The `keys` command already exists and prints the bytes a terminal sends for a chord — a keyboard\n * diagnostic, nothing to do with credentials. Two unrelated meanings under one verb is the kind of\n * collision that costs somebody a confused minute every time they reach for either, so the new\n * surface takes the word the code and the spec already use for the thing: a **credential**.\n * `token` was the other candidate and loses to `server.tokenEnv`, which is a different credential\n * this command cannot mint or revoke.\n *\n * ## Why it talks to a running server rather than the store\n *\n * A key is a fingerprint in the shared store, so writing one directly would work — and would\n * bypass every check `POST /v1/keys` performs: the label rule, the scope validation, and the\n * refusal of a scope naming an agent that does not exist. That is the *\"a check only one surface\n * performs is a check the two disagree about\"* shape, on the surface where disagreeing means a\n * credential that the API would never have issued. So this is an HTTP client, and it says so when\n * there is no server to talk to.\n */\n\nimport { BRAND, CAPABILITIES, type Capability } from \"@dispach/core\"\nimport { UsageError } from \"#lib/args\"\nimport { anyLiveHost, callHost, manifestForId, postToHost } from \"#lib/lifecycle\"\n\nexport interface CredentialOptions {\n readonly action: string\n readonly keyId?: string\n readonly label?: string\n readonly agents?: string\n readonly sessions?: string\n readonly can?: string\n readonly expires?: string\n readonly json?: boolean\n readonly store?: string\n}\n\n/**\n * `1h`, `30m`, `7d`, `90s`, or plain seconds — into whole seconds.\n *\n * A suffix because \"how long should this credential live\" is a question people answer in hours and\n * days, and `3600` is a number somebody has to compute and can get wrong by a factor of sixty. Bare\n * digits stay accepted, since that is what the wire takes and a script already has the number.\n */\nexport function parseDuration(raw: string): number {\n const match = /^(\\d+)\\s*(s|m|h|d)?$/.exec(raw.trim())\n if (match === null) {\n throw new UsageError({\n code: \"credential_usage\",\n message: `--expires ${JSON.stringify(raw)} is not a duration.`,\n hint: \"Write it as 30s, 15m, 2h or 7d — or as a plain number of seconds.\",\n })\n }\n const value = Number(match[1])\n if (value === 0) {\n throw new UsageError({\n code: \"credential_usage\",\n message: \"--expires 0 would mint a credential that has already expired.\",\n hint: \"Leave the flag off for a key that never expires, or give it a real duration like 1h.\",\n })\n }\n const unit = { s: 1, m: 60, h: 3600, d: 86_400 }[match[2] ?? \"s\"] ?? 1\n return value * unit\n}\n\n/** `chat,read` → the capabilities, refusing anything that is not one rather than dropping it. */\nexport function parseCapabilities(raw: string): readonly Capability[] {\n const names = raw\n .split(\",\")\n .map((entry) => entry.trim().toLowerCase())\n .filter((entry) => entry !== \"\")\n const unknown = names.filter((name) => !(CAPABILITIES as readonly string[]).includes(name))\n if (unknown.length > 0) {\n throw new UsageError({\n code: \"credential_usage\",\n message: `--can names ${unknown.map((name) => JSON.stringify(name)).join(\", \")}, which is not a capability.`,\n hint: `They are: ${CAPABILITIES.join(\", \")}. read is every GET; chat sends a message, answers an approval and stops a turn; write covers schedules, phase and clearing a session; admin covers credentials, provisioning and start/stop; peer reaches only a plugin route that asks for it (an A2A endpoint).`,\n })\n }\n // An empty list is *not* silently promoted to \"everything\": `--can \"\"` is a key that may do\n // nothing, which is a coherent thing to ask for and a confusing thing to be given instead.\n return names as readonly Capability[]\n}\n\n/** A comma list into ids, with the empty entries dropped rather than sent as `\"\"`. */\nfunction parseList(raw: string): readonly string[] {\n return raw\n .split(\",\")\n .map((entry) => entry.trim())\n .filter((entry) => entry !== \"\")\n}\n\ninterface KeyLike {\n readonly keyId: string\n readonly label: string\n readonly createdAt: string\n readonly lastUsedAt?: string\n readonly revokedAt?: string\n readonly expiresAt?: string\n readonly scope?: {\n readonly agents?: readonly string[]\n readonly sessions?: string\n readonly can?: readonly string[]\n }\n}\n\n/**\n * One line describing what a key reaches, for a listing.\n *\n * **Printed back after minting too**, which is the half that matters: a prefix is not a namespace —\n * `team_4` also matches `team_42:x` — so showing what the scope *says* at the moment it is created\n * is the only cheap place to notice that it says something other than what was meant. The same\n * argument `telegramHandle` makes about a username that cannot exist.\n */\nexport function describeScope(key: KeyLike): string {\n const parts: string[] = []\n parts.push(key.scope?.agents === undefined ? \"every agent\" : key.scope.agents.join(\", \"))\n if (key.scope?.sessions !== undefined) parts.push(`sessions ${key.scope.sessions}`)\n parts.push(key.scope?.can === undefined ? \"all capabilities\" : key.scope.can.join(\"+\"))\n if (key.expiresAt !== undefined) parts.push(`until ${key.expiresAt}`)\n return parts.join(\" · \")\n}\n\n/** The host to ask, or a refusal naming why there is none. */\nasync function host(store?: string) {\n const lease = await anyLiveHost(store)\n if (lease === undefined) {\n throw new UsageError({\n code: \"credential_usage\",\n message: \"No server is running, so there is nothing to mint a credential on.\",\n hint: `A credential belongs to a server rather than to a file, so this command is an API client. Start one with \\`${BRAND.slug} serve\\`, or use POST /v1/keys directly against a server you can already reach.`,\n })\n }\n return { lease, manifest: manifestForId(lease.agentId) }\n}\n\nexport async function credentialCommand(options: CredentialOptions): Promise<number> {\n if (options.action === \"create\") return await create(options)\n if (options.action === \"list\") return await list(options)\n if (options.action === \"revoke\") return await revoke(options)\n throw new UsageError({\n code: \"credential_usage\",\n message: `Unknown action ${JSON.stringify(options.action)}.`,\n hint: \"The actions are create, list and revoke.\",\n })\n}\n\nasync function create(options: CredentialOptions): Promise<number> {\n const label = options.label?.trim()\n if (label === undefined || label === \"\") {\n throw new UsageError({\n code: \"credential_usage\",\n message: \"--label is required.\",\n hint: 'A label is the only thing distinguishing two credentials in a listing, and \"key 2\" is a name nobody can act on when deciding which to revoke.',\n })\n }\n const scope = {\n ...(options.agents === undefined ? {} : { agents: parseList(options.agents) }),\n ...(options.sessions === undefined ? {} : { sessions: options.sessions }),\n ...(options.can === undefined ? {} : { can: parseCapabilities(options.can) }),\n ...(options.expires === undefined ? {} : { expiresIn: parseDuration(options.expires) }),\n }\n\n const { lease, manifest } = await host(options.store)\n const reply = await postToHost(\n lease,\n \"/v1/keys\",\n { label, ...(Object.keys(scope).length === 0 ? {} : { scope }) },\n manifest,\n )\n if (!reply.ok) return refused(reply, \"mint a credential\")\n\n const key = reply.body as KeyLike & { readonly secret: string }\n if (options.json === true) {\n process.stdout.write(`${JSON.stringify(key, null, 2)}\\n`)\n return 0\n }\n /**\n * The secret, on its own line, **once**.\n *\n * It is not stored anywhere in a readable form and no route returns it again, so this is the\n * only moment it exists outside the caller's memory. Printed bare rather than inside a sentence\n * so that copying the line copies the credential and nothing else.\n */\n process.stdout.write(`${key.secret}\\n`)\n process.stderr.write(` ${key.label} · ${key.keyId}\\n`)\n process.stderr.write(` reaches ${describeScope(key)}\\n`)\n process.stderr.write(\n \" This is the only time the secret is shown. It is stored as a fingerprint and no route returns it.\\n\",\n )\n return 0\n}\n\nasync function list(options: CredentialOptions): Promise<number> {\n const { lease, manifest } = await host(options.store)\n const reply = await callHost(lease, \"GET\", \"/v1/keys\", manifest)\n if (!reply.ok) return refused(reply, \"list credentials\")\n\n const body = reply.body as { readonly keys?: readonly KeyLike[]; readonly scope?: string }\n const keys = body.keys ?? []\n if (options.json === true) {\n process.stdout.write(`${JSON.stringify(body, null, 2)}\\n`)\n return 0\n }\n if (keys.length === 0) {\n process.stdout.write(\"No credentials. The server token is the only way in.\\n\")\n return 0\n }\n for (const key of keys) {\n // Revoked ones are shown rather than hidden, the same as the API's listing: the row is the\n // only record a credential ever existed, and hiding it makes a revocation unverifiable.\n const state = key.revokedAt === undefined ? \"live\" : \"revoked\"\n process.stdout.write(`${key.keyId} ${state.padEnd(7)} ${key.label}\\n`)\n process.stdout.write(` reaches ${describeScope(key)}\\n`)\n process.stdout.write(\n ` created ${key.createdAt}${key.lastUsedAt === undefined ? \" · never used\" : ` · last used ${key.lastUsedAt}`}\\n`,\n )\n }\n return 0\n}\n\nasync function revoke(options: CredentialOptions): Promise<number> {\n const keyId = options.keyId?.trim()\n if (keyId === undefined || keyId === \"\") {\n throw new UsageError({\n code: \"credential_usage\",\n message: \"Which credential?\",\n hint: `\\`${BRAND.slug} credential list\\` prints the ids. Revoking is permanent — a revoked secret can never be re-presented.`,\n })\n }\n const { lease, manifest } = await host(options.store)\n const reply = await callHost(lease, \"DELETE\", `/v1/keys/${encodeURIComponent(keyId)}`, manifest)\n if (!reply.ok) return refused(reply, \"revoke that credential\")\n const key = reply.body as KeyLike\n if (options.json === true) {\n process.stdout.write(`${JSON.stringify(key, null, 2)}\\n`)\n return 0\n }\n process.stdout.write(`revoked ${key.keyId} · ${key.label}\\n`)\n return 0\n}\n\n/** The server's own words, not a paraphrase — it knows why far better than this command does. */\nfunction refused(reply: { status: number; detail?: string; hint?: string }, what: string): number {\n process.stderr.write(\n `Could not ${what}${reply.status === 0 ? \"\" : ` (${reply.status})`}: ${reply.detail ?? \"the host did not answer\"}\\n`,\n )\n if (reply.hint !== undefined) process.stderr.write(` hint: ${reply.hint}\\n`)\n return 1\n}\n"
6
6
  ],
7
7
  "mappings": ";2MA6CO,SAAS,CAAa,CAAC,EAAqB,CAC/C,IAAM,EAAQ,uBAAuB,KAAK,EAAI,KAAK,CAAC,EACpD,GAAI,IAAU,KACV,MAAM,IAAI,GAAW,CACjB,KAAM,mBACN,QAAS,aAAa,KAAK,UAAU,CAAG,uBACxC,KAAM,mEACV,CAAC,EAEL,IAAM,EAAQ,OAAO,EAAM,EAAE,EAC7B,GAAI,IAAU,EACV,MAAM,IAAI,GAAW,CACjB,KAAM,mBACN,QAAS,gEACT,KAAM,sFACV,CAAC,EAEL,IAAM,EAAO,CAAE,EAAG,EAAG,EAAG,GAAI,EAAG,KAAM,EAAG,KAAO,EAAE,EAAM,IAAM,MAAQ,EACrE,OAAO,EAAQ,EAIZ,SAAS,CAAiB,CAAC,EAAoC,CAClE,IAAM,EAAQ,EACT,MAAM,GAAG,EACT,IAAI,CAAC,IAAU,EAAM,KAAK,EAAE,YAAY,CAAC,EACzC,OAAO,CAAC,IAAU,IAAU,EAAE,EAC7B,EAAU,EAAM,OAAO,CAAC,IAAS,CAAE,GAAmC,SAAS,CAAI,CAAC,EAC1F,GAAI,EAAQ,OAAS,EACjB,MAAM,IAAI,GAAW,CACjB,KAAM,mBACN,QAAS,eAAe,EAAQ,IAAI,CAAC,IAAS,KAAK,UAAU,CAAI,CAAC,EAAE,KAAK,IAAI,gCAC7E,KAAM,aAAa,GAAa,KAAK,IAAI,qQAC7C,CAAC,EAIL,OAAO,EAIX,SAAS,CAAS,CAAC,EAAgC,CAC/C,OAAO,EACF,MAAM,GAAG,EACT,IAAI,CAAC,IAAU,EAAM,KAAK,CAAC,EAC3B,OAAO,CAAC,IAAU,IAAU,EAAE,EAyBhC,SAAS,CAAa,CAAC,EAAsB,CAChD,IAAM,EAAk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ko,Ba}from"./index-tc054tcb.js";var cn=[{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"}],n={name:"manifest",required:!0,help:"path to an agent.yaml, or the name of a sandbox agent"},a={name:"store",kind:"string",placeholder:"path",help:"session database",defaultHelp:`~/${A.stateDir}/store.db`},l={name:"session",kind:"string",placeholder:"key",help:"session key",bare:""},e={name:"json",kind:"boolean",help:"machine-readable output"},at=[{name:"init",inSession:"hidden",needsServer:!1,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: ${$e.map((t)=>t.id).join(" | ")}`,defaultHelp:"openai"},{name:"model",kind:"string",placeholder:"id",help:"model id"},{name:"base-url",kind:"string",placeholder:"url",help:"endpoint base URL"},{name:"region",kind:"string",placeholder:"aws-region",help:"AWS region, with --preset bedrock (credentials come from the AWS chain)"},{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:"whatsapp",kind:"string",placeholder:"level",help:"reachable on WhatsApp: none | connected — unofficial, bundled with the binary",defaultHelp:"none"},{name:"whatsapp-number",kind:"string",placeholder:"digits",help:"the account's own number to pair with (pairWith) — digits with no +; empty pairs by QR"},{name:"server",kind:"string",placeholder:"level",help:"serve the HTTP API: none | local",defaultHelp:"local"},{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:"service"},{name:"dir",kind:"string",placeholder:"path",help:"write the agent here instead of the sandbox",defaultHelp:`~/${A.stateDir}/agents/<agent-name-slug>`},{name:"yes",kind:"boolean",help:"take every default; never ask, even at a terminal"},{name:"measure-window",kind:"boolean",help:"ask the endpoint for the model's window and write it (the wizard always asks)"}]},{name:"run",inSession:"hidden",needsServer:!0,summary:"start an interactive session — bare `run` picks from the sandbox",args:[{...n,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"},a,{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:[n],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"},a,e]},{name:"sessions",inSession:"view",needsServer:!1,summary:"list stored sessions, or inspect one",args:[n],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(Ko),min:Ba,integer:!0},a,e]},{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"}]},{...n,required:!0},{name:"query",required:!1,help:"the words to search for (search only); quote a phrase"}],flags:[a,{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"},e]},{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"}]},{...n,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:[a,{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:"owner",inSession:"hidden",needsServer:!1,summary:"show who owns this machine's agents, or make an existing agent yours",args:[{name:"action",required:!0,help:"what to do",choices:[{value:"show",help:"print the owner id init minted for this sandbox"},{value:"adopt",help:"make an agent yours: assign it, recognise you on its channels, one conversation everywhere"}]},{...n,required:!1}],flags:[a,e]},{name:"validate",inSession:"output",needsServer:!1,summary:"load and validate a manifest, then exit",args:[n],flags:[e]},{name:"workspace",inSession:"output",needsServer:!1,summary:"check the workspace files against the authoring rules",args:[n],flags:[{name:"strict",kind:"boolean",help:"exit non-zero when any authoring warning is reported"},e]},{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"}]},{...n,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"},e]},{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"},e]},{name:"channels",inSession:"output",needsServer:!1,summary:"what an agent is reachable on: connect, disconnect, set a credential, unpair",args:[{name:"action",required:!1,help:"what to do — omit for the listing",choices:[{value:"list",help:"every channel, whether it is on, and whether its credential is filled in"},{value:"connect",help:"switch a channel on; it starts at the agent's next start"},{value:"disconnect",help:"switch it off — a disabled channel is never constructed"},{value:"credential",help:"set the channel's token in the .env, prompted and not echoed"},{value:"pair",help:"connect it the way that channel needs — a code for WhatsApp, a token for Telegram"},{value:"unpair",help:"forget a scanned pairing, so the next start offers a new code"}]},{...n,required:!1,help:"path or sandbox agent name"},{name:"channel",required:!1,help:"which channel — its id, not its type. Optional when the agent has exactly one"}],flags:[e]},{name:"plugins",inSession:"output",needsServer:!1,summary:"install a plugin, list what an agent loaded, or remove one",args:[{name:"action",required:!0,help:"what to do",choices:[{value:"list",help:"what this agent loaded, from where, and what it asked for"},{value:"add",help:"fetch a plugin from git and name it in this agent"},{value:"remove",help:"drop the entry, and the directory when no agent needs it"}]},n,{name:"rest",required:!1,variadic:!0,help:"a repository for add — owner/repo, a clone URL, or a page URL — or a name for remove"}],flags:[{name:"ref",kind:"string",placeholder:"tag",help:"branch, tag or commit to fetch (add) — the only thing that pins the code",defaultHelp:"the remote's default branch"},{name:"name",kind:"string",placeholder:"name",help:"install under this name (add), which is what the `plugins:` entry will say",defaultHelp:"the repository or subdirectory name"},e]},{name:"agents",inSession:"output",needsServer:!1,summary:"the agents in the sandbox, and whether anything is serving them",args:[{...n,required:!1,variadic:!0,help:"paths or sandbox names to describe in full — bare, lists the sandbox"}],flags:[a,e]},{name:"restart",inSession:"hidden",needsServer:!1,summary:"reload one agent on the running host, or restart the whole service",args:[{...n,required:!1,help:"path or sandbox agent name — bare, restarts the background service"}],flags:[a,e]},{name:"status",inSession:"output",needsServer:!1,summary:"the service, the hosts, every agent and its channels — one screen",args:[],flags:[a,e]},{name:"logs",inSession:"hidden",needsServer:!1,summary:"the server's stderr tail — the same as `daemon logs`",args:[{...n,required:!1,help:"path or sandbox agent name — bare, the server's own log"}],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 new lines until interrupted"},{name:"truncate",kind:"boolean",help:"empty the log first, in place"},a,e]},{name:"tools",inSession:"output",needsServer:!1,summary:"show the resolved tool catalogue, or fetch a remote provider's schemas into the cache",args:[n],flags:[{name:"warm",kind:"boolean",help:"fetch every pinned slug from the provider and write the resolution cache"},e]},{name:"serve",inSession:"hidden",needsServer:!1,summary:"run the HTTP API and connect the agents' channels",args:[{...n,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"},a,e]},{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 of them"},{name:"expires",kind:"string",placeholder:"dur",help:"how long it lives: 30s, 15m, 2h, 7d, or seconds",defaultHelp:"never"},a,e]},{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"},e]},{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)"},a,e]},{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"},a,e]},{name:"start",inSession:"hidden",needsServer:!0,summary:"switch an agent back on, and have a running host adopt it now",args:[n],flags:[a,e]},{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"},a,e]},{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"},a,e]}];function RA(t){return at.find((r)=>r.name===t)}function ln(t){return[...t.flags,...cn]}function as(t,r){return at.filter((s)=>s.name!==r&&s.flags.some((i)=>i.name===t)).map((s)=>s.name)}function gs(t,r){let s=(r??"").trim();if(s==="")return{action:void 0,ref:void 0};return(RA(t)?.args??[]).find((o)=>o.name==="action")?.choices?.map((o)=>o.value)?.includes(s)===!0?{action:s,ref:void 0}:{action:void 0,ref:s}}
3
+ export{cn,at,RA,ln,as,gs};
4
+
5
+ //# debugId=A514C57A0FD6B95D64756E2164756E21
6
+ //# sourceMappingURL=index-039ew35r.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 { PRESETS } from \"#lib/init-flow\"\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 // Not the bootstrap's: `init` asks whether to keep a server running, and a bootstrap that\n // installed one before the question was asked made the answer decorative. `init` starts\n // the host itself, after the files exist, when the answer is `service`.\n needsServer: false,\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 // Derived, not written down. This list said \"openai | anthropic | deepseek |\n // ollama | custom\" while `PRESETS` had grown to nine — a hand-kept copy beside a\n // real table, which is the drift this repo keeps paying for and which `--help`\n // exists to be the authority on.\n help: `model endpoint: ${PRESETS.map((preset) => preset.id).join(\" | \")}`,\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: \"region\",\n kind: \"string\",\n placeholder: \"aws-region\",\n help: \"AWS region, with --preset bedrock (credentials come from the AWS chain)\",\n },\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: \"whatsapp\",\n kind: \"string\",\n placeholder: \"level\",\n help: \"reachable on WhatsApp: none | connected — unofficial, bundled with the binary\",\n defaultHelp: \"none\",\n },\n {\n // A number, not a secret: unlike a bot token there is nothing here worth keeping out\n // of shell history, so this one gets a flag and `--telegram-allow`'s twin does not\n // need explaining twice.\n name: \"whatsapp-number\",\n kind: \"string\",\n placeholder: \"digits\",\n help: \"the account's own number to pair with (pairWith) — digits with no +; empty pairs by QR\",\n },\n {\n name: \"server\",\n kind: \"string\",\n placeholder: \"level\",\n // No wizard step since 0.1.2 — flag-only, like `--schedules`. An always-on server is\n // the product, so `local` is the default and `none` is the deliberate opt-out.\n help: \"serve the HTTP API: none | local\",\n defaultHelp: \"local\",\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: \"service\",\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 name: \"measure-window\",\n kind: \"boolean\",\n help: \"ask the endpoint for the model's window and write it (the wizard always asks)\",\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 // Who owns the agents on this machine (decisions 15.7, 15.14). `init` makes you the owner of\n // what it creates; `adopt` does it for an agent that already existed. `hidden` for the reason\n // `stop` is: adopting reloads the agent, which would be the one a session is attached to.\n name: \"owner\",\n\n inSession: \"hidden\",\n needsServer: false,\n summary: \"show who owns this machine's agents, or make an existing agent yours\",\n args: [\n {\n name: \"action\",\n required: true,\n help: \"what to do\",\n choices: [\n { value: \"show\", help: \"print the owner id init minted for this sandbox\" },\n {\n value: \"adopt\",\n help: \"make an agent yours: assign it, recognise you on its channels, one conversation everywhere\",\n },\n ],\n },\n { ...MANIFEST, required: false },\n ],\n flags: [STORE, JSON_FLAG],\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 // Action first, manifest second, like `config`, `memory` and `plugins`. The action is\n // *optional* here because bare `channels <agent>` is the question people actually have —\n // \"what is this reachable on, and is it set up\" — and making them type `list` for it would\n // be ceremony. That is `skills`'s shape rather than `plugins`'s, and the difference is real:\n // `plugins` has no useful bare form, since a plugin is named in one place.\n name: \"channels\",\n\n inSession: \"output\",\n needsServer: false,\n summary: \"what an agent is reachable on: connect, disconnect, set a credential, unpair\",\n args: [\n {\n name: \"action\",\n required: false,\n help: \"what to do — omit for the listing\",\n choices: [\n {\n value: \"list\",\n help: \"every channel, whether it is on, and whether its credential is filled in\",\n },\n {\n value: \"connect\",\n help: \"switch a channel on; it starts at the agent's next start\",\n },\n {\n value: \"disconnect\",\n help: \"switch it off — a disabled channel is never constructed\",\n },\n {\n value: \"credential\",\n help: \"set the channel's token in the .env, prompted and not echoed\",\n },\n {\n value: \"pair\",\n help: \"connect it the way that channel needs — a code for WhatsApp, a token for Telegram\",\n },\n {\n value: \"unpair\",\n help: \"forget a scanned pairing, so the next start offers a new code\",\n },\n ],\n },\n { ...MANIFEST, required: false, help: \"path or sandbox agent name\" },\n {\n name: \"channel\",\n required: false,\n help: \"which channel — its id, not its type. Optional when the agent has exactly one\",\n },\n ],\n flags: [JSON_FLAG],\n },\n {\n // Action first, manifest second — the shape `config` and `memory` already use. `plugins <agent>`\n // was the whole command until there was something to install, and a bare positional cannot stay\n // the agent once `add` and `remove` exist: an agent may legitimately be named `add`.\n name: \"plugins\",\n\n inSession: \"output\",\n needsServer: false,\n summary: \"install a plugin, list what an agent loaded, or remove one\",\n args: [\n {\n name: \"action\",\n required: true,\n help: \"what to do\",\n choices: [\n {\n value: \"list\",\n help: \"what this agent loaded, from where, and what it asked for\",\n },\n { value: \"add\", help: \"fetch a plugin from git and name it in this agent\" },\n {\n value: \"remove\",\n help: \"drop the entry, and the directory when no agent needs it\",\n },\n ],\n },\n MANIFEST,\n {\n name: \"rest\",\n required: false,\n variadic: true,\n help: \"a repository for add — owner/repo, a clone URL, or a page URL — or a name for remove\",\n },\n ],\n flags: [\n {\n name: \"ref\",\n kind: \"string\",\n placeholder: \"tag\",\n help: \"branch, tag or commit to fetch (add) — the only thing that pins the code\",\n defaultHelp: \"the remote's default branch\",\n },\n {\n name: \"name\",\n kind: \"string\",\n placeholder: \"name\",\n help: \"install under this name (add), which is what the `plugins:` entry will say\",\n defaultHelp: \"the repository or subdirectory name\",\n },\n JSON_FLAG,\n ],\n },\n {\n name: \"agents\",\n\n inSession: \"output\",\n needsServer: false,\n summary: \"the agents in the sandbox, and whether anything is serving them\",\n args: [\n {\n ...MANIFEST,\n required: false,\n variadic: true,\n help: \"paths or sandbox names to describe in full — bare, lists the sandbox\",\n },\n ],\n flags: [STORE, JSON_FLAG],\n },\n {\n // `daemon restart` restarts the *service* — every agent it hosts. This reloads one agent in\n // place, which is what a person wants after pairing a channel or editing agent.yaml, and it\n // was reachable only as `/restart` inside a session or as `POST /v1/agents/:id/reload`.\n name: \"restart\",\n\n inSession: \"hidden\",\n needsServer: false,\n summary: \"reload one agent on the running host, or restart the whole service\",\n args: [\n {\n ...MANIFEST,\n required: false,\n help: \"path or sandbox agent name — bare, restarts the background service\",\n },\n ],\n flags: [STORE, JSON_FLAG],\n },\n {\n // One screen for the question people actually have — \"is it running and is it working?\" —\n // which `daemon status`, `agents` and `/status` each answered a third of.\n name: \"status\",\n\n inSession: \"output\",\n needsServer: false,\n summary: \"the service, the hosts, every agent and its channels — one screen\",\n args: [],\n flags: [STORE, JSON_FLAG],\n },\n {\n name: \"logs\",\n\n // Hidden from the session palette, where `/daemon logs` already is: two rows for one log\n // would spend a landing row on a duplicate.\n inSession: \"hidden\",\n needsServer: false,\n summary: \"the server's stderr tail — the same as `daemon logs`\",\n args: [\n {\n ...MANIFEST,\n required: false,\n help: \"path or sandbox agent name — bare, the server's own log\",\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 new lines until interrupted\",\n },\n { name: \"truncate\", kind: \"boolean\", help: \"empty the log first, in place\" },\n STORE,\n JSON_FLAG,\n ],\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 of them\",\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\n/**\n * Split \"an action word, or an agent\" for a command whose action is optional.\n *\n * `channels <agent>` and `channels list <agent>` are both meant, so the first positional is one or\n * the other and only its *value* says which. The action words win, exactly as a slash command\n * resolves and as `config`'s own reader does — the difference being that this one reads the\n * **command's spec** for the words rather than holding a second copy of them, so an action added to\n * the table is covered with nothing to remember.\n */\nexport function actionOrRef(\n command: string,\n first: string | undefined,\n): { readonly action: string | undefined; readonly ref: string | undefined } {\n const given = (first ?? \"\").trim()\n if (given === \"\") return { action: undefined, ref: undefined }\n const actions = (findCommand(command)?.args ?? [])\n .find((arg) => arg.name === \"action\")\n ?.choices?.map((choice) => choice.value)\n return actions?.includes(given) === true\n ? { action: given, ref: undefined }\n : { action: undefined, ref: given }\n}\n"
6
+ ],
7
+ "mappings": ";8GAkBO,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,SAIX,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,KAKb,KAAM,mBAAmB,GAAQ,IAAI,CAAC,IAAW,EAAO,EAAE,EAAE,KAAK,KAAK,IACtE,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,SACN,KAAM,SACN,YAAa,aACb,KAAM,yEACV,EACA,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,WACN,KAAM,SACN,YAAa,QACb,KAAM,gFACN,YAAa,MACjB,EACA,CAII,KAAM,kBACN,KAAM,SACN,YAAa,SACb,KAAM,wFACV,EACA,CACI,KAAM,SACN,KAAM,SACN,YAAa,QAGb,KAAM,mCACN,YAAa,OACjB,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,SACjB,EACA,CACI,KAAM,MACN,KAAM,SACN,YAAa,OACb,KAAM,8CACN,YAAa,KAAK,EAAM,mCAC5B,EACA,CACI,KAAM,MACN,KAAM,UACN,KAAM,mDACV,EACA,CACI,KAAM,iBACN,KAAM,UACN,KAAM,+EACV,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,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AAM,6CAA8C,EACvE,CAAE,MAAO,SAAU,KAAM,0CAA2C,EACpE,CACI,MAAO,SACP,KAAM,wDACV,CACJ,CACJ,EACA,CACI,KAAM,OACN,SAAU,GACV,SAAU,GACV,KAAM,uEACV,CACJ,EACA,MAAO,CACH,CACI,KAAM,OACN,KAAM,SACN,YAAa,MACb,KAAM,wCACN,YAAa,sBACjB,EACA,CACI,KAAM,MACN,KAAM,SACN,YAAa,SACb,KAAM,+BACN,YAAa,6BACjB,EACA,CACJ,CACJ,EACA,CAMI,KAAM,WAEN,UAAW,SACX,YAAa,GACb,QAAS,+EACT,KAAM,CACF,CACI,KAAM,SACN,SAAU,GACV,KAAM,oCACN,QAAS,CACL,CACI,MAAO,OACP,KAAM,0EACV,EACA,CACI,MAAO,UACP,KAAM,0DACV,EACA,CACI,MAAO,aACP,KAAM,yDACV,EACA,CACI,MAAO,aACP,KAAM,8DACV,EACA,CACI,MAAO,OACP,KAAM,mFACV,EACA,CACI,MAAO,SACP,KAAM,+DACV,CACJ,CACJ,EACA,IAAK,EAAU,SAAU,GAAO,KAAM,4BAA6B,EACnE,CACI,KAAM,UACN,SAAU,GACV,KAAM,+EACV,CACJ,EACA,MAAO,CAAC,CAAS,CACrB,EACA,CAII,KAAM,UAEN,UAAW,SACX,YAAa,GACb,QAAS,6DACT,KAAM,CACF,CACI,KAAM,SACN,SAAU,GACV,KAAM,aACN,QAAS,CACL,CACI,MAAO,OACP,KAAM,2DACV,EACA,CAAE,MAAO,MAAO,KAAM,mDAAoD,EAC1E,CACI,MAAO,SACP,KAAM,0DACV,CACJ,CACJ,EACA,EACA,CACI,KAAM,OACN,SAAU,GACV,SAAU,GACV,KAAM,sFACV,CACJ,EACA,MAAO,CACH,CACI,KAAM,MACN,KAAM,SACN,YAAa,MACb,KAAM,2EACN,YAAa,6BACjB,EACA,CACI,KAAM,OACN,KAAM,SACN,YAAa,OACb,KAAM,6EACN,YAAa,qCACjB,EACA,CACJ,CACJ,EACA,CACI,KAAM,S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Q,CAAC,GAC3C,KAAK,CAAC,IAAQ,EAAI,OAAS,QAAQ,GAClC,SAAS,IAAI,CAAC,IAAW,EAAO,KAAK,GAC3B,SAAS,CAAK,IAAM,GAC9B,CAAE,OAAQ,EAAO,IAAK,MAAU,EAChC,CAAE,OAAQ,OAAW,IAAK,CAAM",
8
+ "debugId": "A514C57A0FD6B95D64756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{j}from"./index-2fw9e5gg.js";import{Fo,Uo,pA,CA,fA}from"./index-tc054tcb.js";var s=" · ",l=3;function zs(n,e){let t=[{kind:"title",text:j(n.title,e)}],r=n.agent===void 0?n.summary:[`${n.agent.name}${s}${n.agent.model}`,n.summary].filter((a)=>a!=="").join(s);if(r!=="")t.push({kind:"summary",text:j(r,e)});let i=n.state??[];if(i.length>0)t.push({kind:"state",text:j(i.map((a)=>a.label).join(s),e)});let o=n.warnings??[];for(let a of o.slice(0,l))t.push({kind:"warning",text:j(`⚠ ${a}`,e)});if(o.length>l)t.push({kind:"warning",text:j(`⚠ and ${o.length-l} more`,e)});return t}function Zs(n,e){let t=n.map((i)=>`${i.key} ${i.does}`),r="";for(let i of t){let o=r===""?i:`${r}${s}${i}`;if([...o].length>e)break;r=o}return r===""?j(t[0]??"",e):r}function Tr(n,e){let t=[n.title];if(n.summary!=="")t.push(n.summary);if(n.agent!==void 0)t.push(n.agent.name,n.agent.model);let r=n.warnings??[];if(r.length>0)t.push(`⚠ ${r.length} note${r.length===1?"":"s"} at the top`);return j(t.join(s),e)}var $s={key:"q",does:"back"};function u(n,e){return n===void 0||n<=0?e:n}function Ue(n,e){return Math.max(Fo,Math.min(Uo,u(n,e)))}function Xs(n,e){return Math.max(pA,Math.min(CA,u(n,e)-fA))}
3
+ export{zs,Zs,Tr,$s,Ue,Xs};
4
+
5
+ //# debugId=2E7F57DFB488992A64756E2164756E21
6
+ //# sourceMappingURL=index-0dvs3a06.js.map
@@ -5,6 +5,6 @@
5
5
  "/**\n * What every screen has in common, as data: the header block and the footer's key hints.\n *\n * ## Why this is a module and not a component\n *\n * Three surfaces had a banner before this existed — chat, the wizard, the agent picker — and each\n * decided its own title, its own context lines and its own key hints, in JSX. So the *content* of a\n * header was only observable by mounting a renderer, and the one thing worth asserting about it is\n * exactly that content: whether the agent in scope is named, whether a session-wide warning is still\n * visible after the screen scrolls, whether the footer fits.\n *\n * Everything here is text in, text out. `Screen.tsx` is one consumer; a test asserting a header names\n * the right agent is another, and neither can drift from the other because there is one derivation.\n *\n * ## The rule the header exists to enforce\n *\n * CLAUDE.md: anything true for the whole session belongs where a person still sees it after\n * scrolling. On an inline surface that could be a line printed at the top; on the alternate screen\n * there *is* no scrolling past, so it has to be the header or nowhere. `warnings` is therefore part\n * of the header's shape rather than something each screen remembers to render.\n *\n * Colour is not decided here, for `render.ts`'s reason: this module has no idea whether it is being\n * read from a terminal or a log file, and that is `resolveMode`'s question.\n */\n\nimport {\n MAX_SCREEN_COLUMNS,\n MAX_SCREEN_ROWS,\n MIN_SCREEN_COLUMNS,\n MIN_SCREEN_ROWS,\n SCREEN_CHROME_ROWS,\n} from \"#lib/const\"\nimport { clip } from \"#lib/rows\"\n\n/**\n * A live fact about the runtime, shown as a word rather than a sentence.\n *\n * `tone` is a role, never a colour — the component maps it. A literal colour name here would put\n * appearance in a pure module and break the one-home rule `theme.ts` exists for.\n */\nexport interface StateChip {\n readonly label: string\n readonly tone: \"ok\" | \"warn\" | \"off\"\n}\n\nexport interface ScreenHeader {\n /** Product identity — `BRAND.name` and the version. The one line that is the same everywhere. */\n readonly title: string\n /** What this screen is, and the counts that make it worth looking at. */\n readonly summary: string\n /**\n * The agent this screen acts on, when it acts on one.\n *\n * Present so it is impossible to install a skill into, or stop, an agent you did not mean.\n * Absent — not blank — on the machine-level screens: `sources` is a registry shared by every\n * agent on the machine, and naming one there would be a lie about the scope of what you are\n * changing.\n */\n readonly agent?: { readonly name: string; readonly model: string }\n readonly state?: readonly StateChip[]\n /** True for the whole session, so it stays in the frame rather than scrolling away. */\n readonly warnings?: readonly string[]\n}\n\nexport interface KeyHint {\n /** As a reader sees it: `↑↓`, `enter`, `^C`, `⌥⏎`. */\n readonly key: string\n readonly does: string\n}\n\nconst SEPARATOR = \" · \"\n/** Warnings past this many are counted rather than listed — a header is not a log. */\nconst WARNINGS_SHOWN = 3\n\n/**\n * One rendered line, tagged with what it is.\n *\n * Tagged rather than returned as plain strings because the component styles each kind differently and\n * the alternative is worse in both directions: a flat list of strings forces the renderer to guess by\n * index (which broke the first time a header had no state row), and having the renderer rebuild the\n * summary from `header.agent` itself would be a second derivation of the one thing this module exists\n * to derive once. The kind travels with the text; appearance stays in `theme.ts`.\n */\nexport interface HeaderLine {\n readonly kind: \"title\" | \"summary\" | \"state\" | \"warning\"\n readonly text: string\n}\n\n/** The header, as tagged lines, each already clipped to the width. */\nexport function headerLines(header: ScreenHeader, width: number): readonly HeaderLine[] {\n const lines: HeaderLine[] = [{ kind: \"title\", text: clip(header.title, width) }]\n\n // The agent rides on the summary line rather than taking one of its own. It is the same fact —\n // \"what am I looking at, and whose\" — and a separate line for it pushes the body down on every\n // screen to say something the summary was already the place for.\n const scope =\n header.agent === undefined\n ? header.summary\n : [`${header.agent.name}${SEPARATOR}${header.agent.model}`, header.summary]\n .filter((part) => part !== \"\")\n .join(SEPARATOR)\n if (scope !== \"\") lines.push({ kind: \"summary\", text: clip(scope, width) })\n\n const chips = header.state ?? []\n if (chips.length > 0) {\n lines.push({\n kind: \"state\",\n text: clip(chips.map((chip) => chip.label).join(SEPARATOR), width),\n })\n }\n\n const warnings = header.warnings ?? []\n for (const warning of warnings.slice(0, WARNINGS_SHOWN)) {\n lines.push({ kind: \"warning\", text: clip(`⚠ ${warning}`, width) })\n }\n // Counted, not dropped. A header that silently showed three of five warnings would be the\n // trimmed-catalogue failure again: true of what is on screen, false of what is the case.\n if (warnings.length > WARNINGS_SHOWN) {\n lines.push({\n kind: \"warning\",\n text: clip(`⚠ and ${warnings.length - WARNINGS_SHOWN} more`, width),\n })\n }\n\n return lines\n}\n\n/**\n * The footer: what the keys do, on one line, clipped.\n *\n * One line and never two. A footer that wraps moves the body every time the hints change, and the\n * hints change per screen state — so a two-line footer means the list jumps as you use it. Hints are\n * dropped from the end when they do not fit, which is why the caller orders them by how likely\n * somebody is to need reminding: movement first, the destructive one last.\n */\nexport function hintLine(hints: readonly KeyHint[], width: number): string {\n const rendered = hints.map((hint) => `${hint.key} ${hint.does}`)\n // Longest prefix that fits. Built up rather than clipped down, so the line never ends in half a\n // hint — `enter inst…` reads as a different key than the one it is.\n let line = \"\"\n for (const hint of rendered) {\n const next = line === \"\" ? hint : `${line}${SEPARATOR}${hint}`\n if ([...next].length > width) break\n line = next\n }\n // Nothing fit: one clipped hint beats an empty footer, because a screen with no visible way out\n // is the worst thing a full-screen surface can be.\n return line === \"\" ? clip(rendered[0] ?? \"\", width) : line\n}\n\n/**\n * The whole header on one line, for a surface that cannot spare three.\n *\n * The chat is that surface. Its opening banner already says the version, the store, the session and every\n * load warning — and on the alternate screen that banner scrolls out of the window, taking the\n * session-wide facts with it. `headerLines`' three-to-six rows would fix that and cost a fifth of a short\n * terminal permanently, so this is the compromise the rule actually asks for: identity and scope always\n * visible, warnings reduced to a count that says where the detail is.\n *\n * A count rather than the text, deliberately. One warning wrapped over two lines is a header that changes\n * height, which is the one thing a fixed-height frame cannot have.\n */\nexport function titleLine(header: ScreenHeader, width: number): string {\n const parts = [header.title]\n // The summary was dropped here while `Screen` renders it on its own dim line, so a surface using the\n // one-line variant silently lost its label: the conversation switcher passed \"pick a conversation\"\n // and the settings editor \"settings\", and neither ever appeared. Empty adds nothing, which is what\n // the chat header passes.\n if (header.summary !== \"\") parts.push(header.summary)\n if (header.agent !== undefined) parts.push(header.agent.name, header.agent.model)\n const warnings = header.warnings ?? []\n if (warnings.length > 0) {\n parts.push(`\\u26a0 ${warnings.length} note${warnings.length === 1 ? \"\" : \"s\"} at the top`)\n }\n return clip(parts.join(SEPARATOR), width)\n}\n\n/** The hint every alternate-screen surface carries, so no screen invents its own word for leaving. */\nexport const QUIT_HINT: KeyHint = { key: \"q\", does: \"back\" }\n\n/**\n * Terminal columns and rows a screen may use, clamped.\n *\n * Here rather than beside the one command that first needed them. They were exported from `browse.ts`,\n * which is imported both statically (by the wizard) and dynamically (by the command) — and the bundler\n * emitted the export twice, producing a `Duplicate export of 'windowFor'` that every test passed straight\n * through because tests import source, not the bundle. Screen arithmetic belongs with the screen.\n */\n/**\n * Zero means unknown, not zero.\n *\n * A pty genuinely reports a width of 0 — recorded in `lib/const.ts` beside `FALLBACK_COLUMNS`, measured\n * under `script -q`, and handled correctly in `useTerminalSize` since it was written. It was *not* handled\n * here, so a caller passing the stream's own measurement clamped to the 40-column floor and laid its rows\n * out for half the terminal. Found in a real capture: the session picker's rows came out 43 characters wide\n * on an 80-column screen, uniformly — which reads as a design choice rather than as a bug.\n *\n * `?? fallback` alone does not cover it, because 0 is not nullish. The same trap, one operator away.\n */\nfunction known(measured: number | undefined, fallback: number): number {\n return measured === undefined || measured <= 0 ? fallback : measured\n}\n\nexport function screenColumns(columns: number | undefined, fallback: number): number {\n return Math.max(MIN_SCREEN_COLUMNS, Math.min(MAX_SCREEN_COLUMNS, known(columns, fallback)))\n}\n\nexport function screenRows(rows: number | undefined, fallback: number): number {\n return Math.max(\n MIN_SCREEN_ROWS,\n Math.min(MAX_SCREEN_ROWS, known(rows, fallback) - SCREEN_CHROME_ROWS),\n )\n}\n"
6
6
  ],
7
7
  "mappings": ";mFAsEA,IAAM,EAAY,MAEZ,EAAiB,EAiBhB,SAAS,EAAW,CAAC,EAAsB,EAAsC,CACpF,IAAM,EAAsB,CAAC,CAAE,KAAM,QAAS,KAAM,EAAK,EAAO,MAAO,CAAK,CAAE,CAAC,EAKzE,EACF,EAAO,QAAU,OACX,EAAO,QACP,CAAC,GAAG,EAAO,MAAM,OAAO,IAAY,EAAO,MAAM,QAAS,EAAO,OAAO,EACnE,OAAO,CAAC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