clikcode 1.0.4 → 1.0.5

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 (323) hide show
  1. package/README.md +25 -14
  2. package/dist/chunk-23TDEBGZ.js +71 -0
  3. package/dist/chunk-25T3GVS7.js +425 -0
  4. package/dist/chunk-2BBELGHY.js +11 -0
  5. package/dist/chunk-2EOL5PZL.js +208 -0
  6. package/dist/chunk-2GAB36IE.js +26 -0
  7. package/dist/chunk-2OLS7V66.js +2440 -0
  8. package/dist/chunk-2QFO2URB.js +179 -0
  9. package/dist/chunk-2QWPQRSU.js +254 -0
  10. package/dist/chunk-2YPAPAR3.js +184 -0
  11. package/dist/chunk-2ZAG5372.js +33 -0
  12. package/dist/chunk-32IKAIZC.js +12507 -0
  13. package/dist/chunk-34AZEGYW.js +95 -0
  14. package/dist/chunk-34JQYQCA.js +175 -0
  15. package/dist/chunk-34ZISPAO.js +67 -0
  16. package/dist/chunk-3AAAARE6.js +46 -0
  17. package/dist/chunk-3AJ6Q3OY.js +510 -0
  18. package/dist/chunk-3B2CHX7M.js +884 -0
  19. package/dist/chunk-3BUFORRX.js +59 -0
  20. package/dist/chunk-3QLHYYFK.js +30 -0
  21. package/dist/chunk-3RXBMYKZ.js +140 -0
  22. package/dist/chunk-3TFNIJWS.js +52 -0
  23. package/dist/chunk-3W3IPDFP.js +119 -0
  24. package/dist/chunk-3WMS7SEE.js +417 -0
  25. package/dist/chunk-435ZNSZ3.js +23 -0
  26. package/dist/chunk-4AQ5NINV.js +39 -0
  27. package/dist/chunk-4GVEJ5FK.js +168 -0
  28. package/dist/chunk-4GXAO3UY.js +262 -0
  29. package/dist/chunk-4L2ZZM4Q.js +332 -0
  30. package/dist/chunk-4LPDG57B.js +17 -0
  31. package/dist/chunk-4NN3XQQT.js +223 -0
  32. package/dist/chunk-4QZEZME7.js +54 -0
  33. package/dist/chunk-4R6CSC3S.js +38 -0
  34. package/dist/chunk-4RHXTL3W.js +514 -0
  35. package/dist/chunk-4SJMPTVQ.js +18 -0
  36. package/dist/chunk-4VY7G6TX.js +114 -0
  37. package/dist/chunk-5642PBF7.js +124 -0
  38. package/dist/chunk-5B6TVO4A.js +33 -0
  39. package/dist/chunk-5BJLDUPL.js +62 -0
  40. package/dist/chunk-5HMFFJWU.js +19 -0
  41. package/dist/chunk-5IKLK33T.js +69 -0
  42. package/dist/chunk-5NQ5FFMX.js +44 -0
  43. package/dist/chunk-5QNNW5L6.js +176 -0
  44. package/dist/chunk-5SM5UAWN.js +239 -0
  45. package/dist/chunk-5WYJTA6O.js +74 -0
  46. package/dist/chunk-5ZSR2Y5T.js +227 -0
  47. package/dist/chunk-5ZWUM5GH.js +39 -0
  48. package/dist/chunk-64E7D4HY.js +364 -0
  49. package/dist/chunk-6CK466BC.js +99 -0
  50. package/dist/chunk-6ES45HHO.js +138 -0
  51. package/dist/chunk-6HYEZFGL.js +277 -0
  52. package/dist/chunk-6Y7HLXGW.js +29 -0
  53. package/dist/chunk-6YKK4FYR.js +258 -0
  54. package/dist/chunk-74WNMLMS.js +117 -0
  55. package/dist/chunk-7AULZ7OD.js +55 -0
  56. package/dist/chunk-7DOKGSUN.js +101 -0
  57. package/dist/chunk-7IH5LTIZ.js +195 -0
  58. package/dist/chunk-7ISTS5NS.js +21 -0
  59. package/dist/chunk-7NMUTGOW.js +527 -0
  60. package/dist/chunk-7PNHUZEL.js +153 -0
  61. package/dist/chunk-7TSQLONI.js +88 -0
  62. package/dist/chunk-AE7TOLD5.js +30 -0
  63. package/dist/chunk-AEMHSXKA.js +130 -0
  64. package/dist/chunk-AKRYTS2D.js +211 -0
  65. package/dist/chunk-AMNSE36L.js +59 -0
  66. package/dist/chunk-AZVD74ZV.js +23 -0
  67. package/dist/chunk-B35DVOTK.js +1981 -0
  68. package/dist/chunk-B4HNJRAH.js +626 -0
  69. package/dist/chunk-B5WYPPHS.js +13 -0
  70. package/dist/chunk-BBOVDXQM.js +59 -0
  71. package/dist/chunk-BD3ECZLK.js +62 -0
  72. package/dist/chunk-BDGSOT74.js +4578 -0
  73. package/dist/chunk-BF5VEOPK.js +31 -0
  74. package/dist/chunk-BFFRW4XH.js +47 -0
  75. package/dist/chunk-BFPC6PEW.js +208 -0
  76. package/dist/chunk-BGEMY2JJ.js +376 -0
  77. package/dist/chunk-BISGNHKD.js +35 -0
  78. package/dist/chunk-BMRAEBRY.js +21 -0
  79. package/dist/chunk-BNTXAZXW.js +127 -0
  80. package/dist/chunk-BOQBXGSN.js +75 -0
  81. package/dist/chunk-BTJDSTQP.js +213 -0
  82. package/dist/chunk-BUOPJQP5.js +218 -0
  83. package/dist/chunk-BXFJS65Q.js +52 -0
  84. package/dist/chunk-BXPQFSX5.js +59 -0
  85. package/dist/chunk-C57LIWNY.js +1269 -0
  86. package/dist/chunk-C6YVCCWR.js +74 -0
  87. package/dist/chunk-CAADDF6M.js +167 -0
  88. package/dist/chunk-CBANJFBO.js +69 -0
  89. package/dist/chunk-CERF3RIB.js +597 -0
  90. package/dist/chunk-COAS5ETR.js +46 -0
  91. package/dist/chunk-CQ7J6UQ7.js +78 -0
  92. package/dist/chunk-CRUVYGO2.js +26 -0
  93. package/dist/chunk-CVFVFRGN.js +58 -0
  94. package/dist/chunk-D2UK66HM.js +37 -0
  95. package/dist/chunk-D2W7SA4R.js +18 -0
  96. package/dist/chunk-DA44ZENT.js +501 -0
  97. package/dist/chunk-DAJ76TOC.js +99 -0
  98. package/dist/chunk-DCZ6CIUM.js +147 -0
  99. package/dist/chunk-DF35KMXM.js +1314 -0
  100. package/dist/chunk-DGASQT26.js +151 -0
  101. package/dist/chunk-DJT57C5P.js +55 -0
  102. package/dist/chunk-DKDPZTD3.js +44 -0
  103. package/dist/chunk-DQYVQ2N7.js +77 -0
  104. package/dist/chunk-DRTP2RTY.js +266 -0
  105. package/dist/chunk-DW2BMUKY.js +61 -0
  106. package/dist/chunk-DW5T5ZVU.js +307 -0
  107. package/dist/chunk-DXKNDNFC.js +164 -0
  108. package/dist/chunk-DZEQ7UYR.js +291 -0
  109. package/dist/chunk-E4F4OUAC.js +463 -0
  110. package/dist/chunk-EE4B6A7W.js +69 -0
  111. package/dist/chunk-EISKIYWG.js +23 -0
  112. package/dist/chunk-EKAQK7UQ.js +235 -0
  113. package/dist/chunk-EOBTJV32.js +123 -0
  114. package/dist/chunk-ESF3DIZY.js +325 -0
  115. package/dist/chunk-EVOHOZ4U.js +45 -0
  116. package/dist/chunk-EXN4KHLB.js +110 -0
  117. package/dist/chunk-F252T6Y3.js +78 -0
  118. package/dist/chunk-F3DP4ZA2.js +40 -0
  119. package/dist/chunk-F6F47QAY.js +58 -0
  120. package/dist/chunk-FA3Y23ZW.js +57 -0
  121. package/dist/chunk-FBKXE4EJ.js +640 -0
  122. package/dist/chunk-FCGEB3H6.js +23 -0
  123. package/dist/chunk-FF7ZVYJF.js +3732 -0
  124. package/dist/chunk-FFGKN6L3.js +39 -0
  125. package/dist/chunk-FFGU4GCC.js +94 -0
  126. package/dist/chunk-FSFDAOVP.js +74 -0
  127. package/dist/chunk-FT5TX7OX.js +1573 -0
  128. package/dist/chunk-G3QP67Z7.js +232 -0
  129. package/dist/chunk-G5ORJKV2.js +179 -0
  130. package/dist/chunk-GFNC62PE.js +111 -0
  131. package/dist/chunk-GGK43Q3N.js +67 -0
  132. package/dist/chunk-GGYKY4GF.js +11537 -0
  133. package/dist/chunk-GGYNHGNJ.js +55 -0
  134. package/dist/chunk-GLY7RM3C.js +354 -0
  135. package/dist/chunk-GQBZU6EO.js +20 -0
  136. package/dist/chunk-GSXENUZL.js +9 -0
  137. package/dist/chunk-GTOAT5D3.js +40 -0
  138. package/dist/chunk-GWCMDPQU.js +1007 -0
  139. package/dist/chunk-GXYSMYHJ.js +152 -0
  140. package/dist/chunk-GYMAI5NY.js +14 -0
  141. package/dist/chunk-H2VZMKPE.js +30 -0
  142. package/dist/chunk-H4THUNBM.js +2091 -0
  143. package/dist/chunk-HGRVSNUZ.js +361 -0
  144. package/dist/chunk-HI4VY473.js +27 -0
  145. package/dist/chunk-HOJRSD3Q.js +447 -0
  146. package/dist/chunk-HRX25W35.js +82 -0
  147. package/dist/chunk-HSE4AQYV.js +55 -0
  148. package/dist/chunk-HU5SSUFX.js +383 -0
  149. package/dist/chunk-I3GDBJLH.js +196 -0
  150. package/dist/chunk-I75EDU75.js +684 -0
  151. package/dist/chunk-IBA7DMIO.js +20 -0
  152. package/dist/chunk-IC6N4NZA.js +231 -0
  153. package/dist/chunk-IF43HIGV.js +284 -0
  154. package/dist/chunk-IGZ6C2MC.js +439 -0
  155. package/dist/chunk-IMLTL2MY.js +192 -0
  156. package/dist/chunk-IMZL6SGR.js +33 -0
  157. package/dist/chunk-IS4USJPY.js +516 -0
  158. package/dist/chunk-ISFSPN2F.js +82 -0
  159. package/dist/chunk-IXE7GTFI.js +55 -0
  160. package/dist/chunk-IZ77QJQG.js +36 -0
  161. package/dist/chunk-J2PACWRQ.js +34 -0
  162. package/dist/chunk-J6EGFVQX.js +180 -0
  163. package/dist/chunk-JEKOD43D.js +22 -0
  164. package/dist/chunk-JGIWATSG.js +30 -0
  165. package/dist/chunk-JYBONKD4.js +43 -0
  166. package/dist/chunk-K2NLG2HK.js +454 -0
  167. package/dist/chunk-KCQ4TBLS.js +164 -0
  168. package/dist/chunk-KD5KIVMS.js +176 -0
  169. package/dist/chunk-KHW6TX6I.js +63 -0
  170. package/dist/chunk-KI5GZFCE.js +520 -0
  171. package/dist/chunk-KN34B7NO.js +105 -0
  172. package/dist/chunk-KYUHIFP3.js +136 -0
  173. package/dist/chunk-KZL5VS4B.js +300 -0
  174. package/dist/chunk-L3VW3QIH.js +48 -0
  175. package/dist/chunk-LA6MG4ET.js +2110 -0
  176. package/dist/chunk-LAVFOA3S.js +66 -0
  177. package/dist/chunk-LB4OA77N.js +13 -0
  178. package/dist/chunk-LBFRF2K4.js +196 -0
  179. package/dist/chunk-LM6EIA4B.js +93 -0
  180. package/dist/chunk-LPCNRGJ7.js +692 -0
  181. package/dist/chunk-LSLNL5T3.js +168 -0
  182. package/dist/chunk-LVRRWP4W.js +568 -0
  183. package/dist/chunk-LWCFBRHL.js +33 -0
  184. package/dist/chunk-LXFTMGZZ.js +166 -0
  185. package/dist/chunk-M33LVA4M.js +151 -0
  186. package/dist/chunk-M3FO5UMK.js +4944 -0
  187. package/dist/chunk-M5QNDBAY.js +66 -0
  188. package/dist/chunk-M6ND6KBE.js +1291 -0
  189. package/dist/chunk-M7H3WQTE.js +76 -0
  190. package/dist/chunk-MCBRVPA7.js +191 -0
  191. package/dist/chunk-MCSDWZET.js +91 -0
  192. package/dist/chunk-MDT5XDXL.js +289 -0
  193. package/dist/chunk-MJG3IQY4.js +91 -0
  194. package/dist/chunk-MOU3N2UL.js +44 -0
  195. package/dist/chunk-MP4KZOQC.js +3451 -0
  196. package/dist/chunk-MPAJ446F.js +66 -0
  197. package/dist/chunk-MVJZZ6AL.js +16 -0
  198. package/dist/chunk-MXS6S2PY.js +253 -0
  199. package/dist/chunk-N3SFDYM7.js +291 -0
  200. package/dist/chunk-NAOX3JUB.js +13 -0
  201. package/dist/chunk-NEKKIBCX.js +283 -0
  202. package/dist/chunk-NKDATMEM.js +133 -0
  203. package/dist/chunk-NR4FMC4K.js +395 -0
  204. package/dist/chunk-NSOHOJBR.js +221 -0
  205. package/dist/chunk-NTDB6QKF.js +29 -0
  206. package/dist/chunk-NWEYRBWK.js +25 -0
  207. package/dist/chunk-O2YSNYWD.js +23 -0
  208. package/dist/chunk-O3EW7LAY.js +54 -0
  209. package/dist/chunk-O7BNJIXU.js +366 -0
  210. package/dist/chunk-OARL2NXZ.js +116 -0
  211. package/dist/chunk-OHKZUEJW.js +351 -0
  212. package/dist/chunk-OKU45BXA.js +647 -0
  213. package/dist/chunk-OL4JBD3J.js +59 -0
  214. package/dist/chunk-OLUO5DDR.js +192 -0
  215. package/dist/chunk-OQ245JLA.js +196 -0
  216. package/dist/chunk-P72UZAQI.js +289 -0
  217. package/dist/chunk-PAL2ENB6.js +20 -0
  218. package/dist/chunk-PAXYQZH7.js +53 -0
  219. package/dist/chunk-PDPEM5VW.js +51 -0
  220. package/dist/chunk-PEWCDI2C.js +668 -0
  221. package/dist/chunk-PGZ54EDX.js +27 -0
  222. package/dist/chunk-PRWVLDZF.js +73 -0
  223. package/dist/chunk-PSQQ75VJ.js +52 -0
  224. package/dist/chunk-PUOVIFHW.js +118 -0
  225. package/dist/chunk-PWBF2X3V.js +107 -0
  226. package/dist/chunk-PWXII6HF.js +43 -0
  227. package/dist/chunk-Q35VLJRT.js +80 -0
  228. package/dist/chunk-QJP7EYGL.js +128 -0
  229. package/dist/chunk-QPQKX2MK.js +8836 -0
  230. package/dist/chunk-QQRLPY25.js +1053 -0
  231. package/dist/chunk-QUS4ER2W.js +407 -0
  232. package/dist/chunk-QYHI3YET.js +29 -0
  233. package/dist/chunk-QYRU2UQI.js +32 -0
  234. package/dist/chunk-R6XVVQGC.js +13 -0
  235. package/dist/chunk-R7QN6ONS.js +483 -0
  236. package/dist/chunk-RD23MPGC.js +221 -0
  237. package/dist/chunk-RDDWQBEM.js +185 -0
  238. package/dist/chunk-RDLLDYFO.js +104 -0
  239. package/dist/chunk-RE4TGORR.js +84 -0
  240. package/dist/chunk-RJLHVYQY.js +217 -0
  241. package/dist/chunk-RJLPTWHW.js +905 -0
  242. package/dist/chunk-RKUVLRZI.js +295 -0
  243. package/dist/chunk-ROGXPGYR.js +37 -0
  244. package/dist/chunk-RSZGEL5U.js +163 -0
  245. package/dist/chunk-RVUOIJXN.js +909 -0
  246. package/dist/chunk-RW7F4JRP.js +11 -0
  247. package/dist/chunk-S4UO3AO3.js +53 -0
  248. package/dist/chunk-S5JAAF6S.js +585 -0
  249. package/dist/chunk-SNU37TQI.js +56 -0
  250. package/dist/chunk-SQVUDO2O.js +31 -0
  251. package/dist/chunk-SYVHIYQT.js +66 -0
  252. package/dist/chunk-SZBQMTG2.js +85 -0
  253. package/dist/chunk-T5VCXA3J.js +25 -0
  254. package/dist/chunk-TK6NSP56.js +30 -0
  255. package/dist/chunk-TKWVMA6L.js +22 -0
  256. package/dist/chunk-TQDKJHWX.js +59 -0
  257. package/dist/chunk-TQDM7S5N.js +127 -0
  258. package/dist/chunk-TULAXS77.js +23 -0
  259. package/dist/chunk-TVT45XNH.js +4625 -0
  260. package/dist/chunk-TWCVV2JO.js +467 -0
  261. package/dist/chunk-U4DKAD6S.js +47 -0
  262. package/dist/chunk-UA5K2BTI.js +564 -0
  263. package/dist/chunk-UAMKCMOK.js +40 -0
  264. package/dist/chunk-UBMVADBF.js +51 -0
  265. package/dist/chunk-UFQ5A5PW.js +645 -0
  266. package/dist/chunk-UOD2SOLL.js +1301 -0
  267. package/dist/chunk-UTSB4LOW.js +156 -0
  268. package/dist/chunk-UVXNIUTN.js +412 -0
  269. package/dist/chunk-UXVPXYPE.js +90 -0
  270. package/dist/chunk-UYEEMIWR.js +374 -0
  271. package/dist/chunk-VBGM5ZBW.js +54 -0
  272. package/dist/chunk-VEWPCZPG.js +762 -0
  273. package/dist/chunk-VIRDLZ5E.js +108 -0
  274. package/dist/chunk-VMPO7WKN.js +52 -0
  275. package/dist/chunk-W2NVSDO5.js +5122 -0
  276. package/dist/chunk-W3YYPBEA.js +176 -0
  277. package/dist/chunk-W5AYOICN.js +280 -0
  278. package/dist/chunk-W5GZOIUF.js +27 -0
  279. package/dist/chunk-WHKNLZ3C.js +76 -0
  280. package/dist/chunk-WKBEPPQ5.js +1409 -0
  281. package/dist/chunk-WM3Z6QKQ.js +151 -0
  282. package/dist/chunk-WMI2TPMA.js +31 -0
  283. package/dist/chunk-WNX5VD7S.js +150 -0
  284. package/dist/chunk-WOVTYST3.js +60 -0
  285. package/dist/chunk-WPB5WEZJ.js +546 -0
  286. package/dist/chunk-WUO5EOAT.js +44 -0
  287. package/dist/chunk-WWLJMP6D.js +133 -0
  288. package/dist/chunk-WZMLH3XP.js +58 -0
  289. package/dist/chunk-WZYVLUVQ.js +79 -0
  290. package/dist/chunk-X2OCPVU5.js +135 -0
  291. package/dist/chunk-X3CL6DTR.js +95 -0
  292. package/dist/chunk-X6WF7JEV.js +354 -0
  293. package/dist/chunk-XAHGBPWT.js +44 -0
  294. package/dist/chunk-XCKQ5BM2.js +228 -0
  295. package/dist/chunk-XIBYREEY.js +106 -0
  296. package/dist/chunk-XKW5NDMR.js +378 -0
  297. package/dist/chunk-XRDALAO3.js +100 -0
  298. package/dist/chunk-XUP22EAS.js +41 -0
  299. package/dist/chunk-XWAC3MKW.js +243 -0
  300. package/dist/chunk-Y3R7JMXB.js +59 -0
  301. package/dist/chunk-Y54LTP4W.js +82 -0
  302. package/dist/chunk-Y7UECI4M.js +99 -0
  303. package/dist/chunk-YACGDFHC.js +47 -0
  304. package/dist/chunk-YHNIQPKY.js +71 -0
  305. package/dist/chunk-YMBR6HYP.js +111 -0
  306. package/dist/chunk-YMCH3L2S.js +26 -0
  307. package/dist/chunk-Z4ZU6T7V.js +99 -0
  308. package/dist/chunk-ZDPF67ZZ.js +173 -0
  309. package/dist/chunk-ZFC2Q67K.js +101 -0
  310. package/dist/chunk-ZGHNNSCT.js +114 -0
  311. package/dist/chunk-ZGX3ERAT.js +173 -0
  312. package/dist/chunk-ZI3YHEBY.js +37 -0
  313. package/dist/chunk-ZN7G6JLS.js +639 -0
  314. package/dist/chunk-ZNPFQMXT.js +47 -0
  315. package/dist/chunk-ZOU3LV4U.js +63 -0
  316. package/dist/chunk-ZT7B4H2V.js +117 -0
  317. package/dist/chunk-ZZCBDNZI.js +58 -0
  318. package/dist/cli.js +494 -112923
  319. package/dist/computer-tools.js +36642 -21259
  320. package/dist/harness-catalog.cjs +88 -43
  321. package/dist/index.js +1 -1
  322. package/dist/local-model-supervisor.cjs +555 -0
  323. package/package.json +3 -4
@@ -0,0 +1,692 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ addDiscoveredMachine,
5
+ remoteHostOf
6
+ } from "./chunk-5ZSR2Y5T.js";
7
+ import {
8
+ holdWindowMachines
9
+ } from "./chunk-VEWPCZPG.js";
10
+ import {
11
+ discoverMachines,
12
+ notYetAdded,
13
+ readMachines,
14
+ readTailscaleStatus
15
+ } from "./chunk-X6WF7JEV.js";
16
+ import {
17
+ isRemoteRowValue,
18
+ localMachineName,
19
+ mergeMachineRows,
20
+ otherMachineRows,
21
+ parseRemoteRowValue,
22
+ remoteConversationOption,
23
+ updateText
24
+ } from "./chunk-Z4ZU6T7V.js";
25
+ import {
26
+ coalescedListRefresh,
27
+ watchConversationList
28
+ } from "./chunk-ZGHNNSCT.js";
29
+ import {
30
+ slowWaitGate
31
+ } from "./chunk-COAS5ETR.js";
32
+ import {
33
+ aiSessionCommand
34
+ } from "./chunk-H4THUNBM.js";
35
+ import {
36
+ discoverNativeSessions,
37
+ lastSeenNativeSessions
38
+ } from "./chunk-32IKAIZC.js";
39
+ import {
40
+ cliThreadTransport
41
+ } from "./chunk-M6ND6KBE.js";
42
+ import {
43
+ conversationLabel,
44
+ uncoveredRows
45
+ } from "./chunk-QPQKX2MK.js";
46
+ import {
47
+ chooseOption
48
+ } from "./chunk-ROGXPGYR.js";
49
+ import {
50
+ newConversation
51
+ } from "./chunk-RJLPTWHW.js";
52
+ import {
53
+ effortChoicesFor
54
+ } from "./chunk-DGASQT26.js";
55
+ import {
56
+ sessionSandboxMode
57
+ } from "./chunk-4RHXTL3W.js";
58
+ import {
59
+ FS_SESSION_DISCOVERY,
60
+ NATIVE_SESSION_STORES,
61
+ nativeTranscriptReader
62
+ } from "./chunk-M3FO5UMK.js";
63
+ import {
64
+ saveDiscoveryCache
65
+ } from "./chunk-CERF3RIB.js";
66
+ import {
67
+ harnessModelLabel,
68
+ modelSettingsDetail,
69
+ nativeModelCatalog
70
+ } from "./chunk-QQRLPY25.js";
71
+ import {
72
+ acpDiscoveryDirectory
73
+ } from "./chunk-ESF3DIZY.js";
74
+ import {
75
+ nativeProfileEnvironment
76
+ } from "./chunk-ZGX3ERAT.js";
77
+ import {
78
+ readState
79
+ } from "./chunk-MXS6S2PY.js";
80
+ import {
81
+ resolveDefaultSettings
82
+ } from "./chunk-BISGNHKD.js";
83
+ import {
84
+ writeState
85
+ } from "./chunk-RKUVLRZI.js";
86
+ import {
87
+ VALID_PERMISSION_MODES,
88
+ conversationOption,
89
+ isBlankConversation
90
+ } from "./chunk-TWCVV2JO.js";
91
+ import {
92
+ SECTION_TITLES
93
+ } from "./chunk-PDPEM5VW.js";
94
+ import {
95
+ isClikCodeOpening
96
+ } from "./chunk-FF7ZVYJF.js";
97
+ import {
98
+ conversationIdFor,
99
+ conversationRows,
100
+ livePendingTurns,
101
+ liveWorkers
102
+ } from "./chunk-BUOPJQP5.js";
103
+ import {
104
+ allLocalHarnesses,
105
+ harnessSupportsPermissionMode,
106
+ localHarnessForCommand
107
+ } from "./chunk-KYUHIFP3.js";
108
+ import {
109
+ inspectNativeHarnessForPicker
110
+ } from "./chunk-DF35KMXM.js";
111
+ import {
112
+ relativeTime
113
+ } from "./chunk-EE4B6A7W.js";
114
+ import {
115
+ quiet
116
+ } from "./chunk-RDDWQBEM.js";
117
+
118
+ // src/ide/session-delta.ts
119
+ function sessionOf(event) {
120
+ if (event.type === "session") return event.session;
121
+ if (event.type === "worker" && event.event.type === "snapshot") return event.event.session;
122
+ return void 0;
123
+ }
124
+ function withSession(event, session, messagesFrom) {
125
+ const { messagesFrom: _dropped, ...rest } = event;
126
+ const from = messagesFrom === void 0 ? {} : { messagesFrom };
127
+ if (rest.type === "session") return { ...rest, session, ...from };
128
+ if (rest.type === "worker" && rest.event.type === "snapshot") return { ...rest, event: { ...rest.event, session }, ...from };
129
+ return event;
130
+ }
131
+ function fingerprint(message) {
132
+ if (message === void 0) return "";
133
+ const { activities, ...rest } = message;
134
+ const text = JSON.stringify(activities?.length ? { ...rest, calls: activities.length } : rest);
135
+ let h1 = 3735928559;
136
+ let h2 = 1103547991;
137
+ for (let index = 0; index < text.length; index += 1) {
138
+ const code = text.charCodeAt(index);
139
+ h1 = Math.imul(h1 ^ code, 2654435761);
140
+ h2 = Math.imul(h2 ^ code, 1597334677);
141
+ }
142
+ h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
143
+ h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
144
+ return `${text.length}:${(h2 >>> 0).toString(36)}${(h1 >>> 0).toString(36)}`;
145
+ }
146
+ function claimOf(sessionId, messages, gen) {
147
+ if (!messages.length) return void 0;
148
+ return { sessionId, count: messages.length, first: fingerprint(messages[0]), last: fingerprint(messages[messages.length - 1]), ...gen ? { gen } : {} };
149
+ }
150
+ var SessionDeltaSender = class {
151
+ constructor(shape = (message) => message, turn = {}) {
152
+ this.shape = shape;
153
+ this.turn = turn;
154
+ }
155
+ shape;
156
+ turn;
157
+ held;
158
+ /** `event` with the running turn in it cut as `turn` says. */
159
+ dressed(event) {
160
+ const session = sessionOf(event);
161
+ if (!session) return event;
162
+ const live = event.type === "worker" && event.event.type === "snapshot" ? event.event.live : void 0;
163
+ if (!(session.pendingTurn && this.turn.pendingTurn) && !(live?.activities && this.turn.liveActivities)) return event;
164
+ const pendingTurn = session.pendingTurn && this.turn.pendingTurn ? this.turn.pendingTurn(session.pendingTurn) : session.pendingTurn;
165
+ const next = pendingTurn === session.pendingTurn ? session : { ...session, pendingTurn };
166
+ const dressedSession = withSession(event, next, event.messagesFrom);
167
+ if (dressedSession.type === "worker" && dressedSession.event.type === "snapshot" && dressedSession.event.live?.activities && this.turn.liveActivities) {
168
+ const live2 = dressedSession.event.live;
169
+ return { ...dressedSession, event: { ...dressedSession.event, live: { ...live2, activities: this.turn.liveActivities(live2.activities) } } };
170
+ }
171
+ return dressedSession;
172
+ }
173
+ /** The client holds nothing (an `open`): the next event is whole. */
174
+ reset() {
175
+ this.held = void 0;
176
+ }
177
+ /** The client says it holds the start of this chat (an `open`'s `held`):
178
+ * the next event is checked against it, and is only what follows when it
179
+ * is, whole when it is not. */
180
+ adopt(held) {
181
+ this.held = held;
182
+ }
183
+ shaped(messages, from) {
184
+ return messages.slice(from).map((message, index) => this.shape(message, messages.length - 1 - (from + index)));
185
+ }
186
+ /** `event` as this client needs it: whole the first time and after any
187
+ * change that was not an append, its new messages only otherwise. Events
188
+ * that carry no conversation pass as they are. */
189
+ slim(event) {
190
+ return this.dressed(this.slimmed(event));
191
+ }
192
+ slimmed(event) {
193
+ const session = sessionOf(event);
194
+ if (!session) return event;
195
+ const messages = session.messages;
196
+ if (!messages) {
197
+ this.held = void 0;
198
+ return event;
199
+ }
200
+ const held = this.held;
201
+ const appended = held !== void 0 && held.sessionId === session.id && messages.length >= held.count && (held.count === 0 || fingerprint(messages[0]) === held.first && fingerprint(messages[held.count - 1]) === held.last);
202
+ this.held = {
203
+ sessionId: session.id,
204
+ count: messages.length,
205
+ first: fingerprint(messages[0]),
206
+ last: fingerprint(messages[messages.length - 1])
207
+ };
208
+ if (!appended) return withSession(event, { ...session, messages: this.shaped(messages, 0) }, void 0);
209
+ return withSession(event, { ...session, messages: this.shaped(messages, held.count) }, held.count);
210
+ }
211
+ };
212
+ var SessionDeltaReceiver = class {
213
+ held;
214
+ /** The conversation kept from last time: what the next `open` says it holds. */
215
+ preload(sessionId, messages, gen) {
216
+ this.held = { sessionId, messages: [...messages], ...gen ? { gen } : {} };
217
+ }
218
+ /** The log generation the machine said for the chat held (an `open`'s answer). */
219
+ generation(sessionId, gen) {
220
+ if (this.held?.sessionId === sessionId) this.held = { sessionId, messages: this.held.messages, ...gen ? { gen } : {} };
221
+ }
222
+ /** What is held now, to keep for next time. */
223
+ current() {
224
+ return this.held;
225
+ }
226
+ /** What an `open` of `sessionId` says this client holds of it. */
227
+ claim(sessionId) {
228
+ return this.held?.sessionId === sessionId ? claimOf(sessionId, this.held.messages, this.held.gen) : void 0;
229
+ }
230
+ expand(event) {
231
+ const session = sessionOf(event);
232
+ if (!session) return event;
233
+ const from = event.messagesFrom;
234
+ if (from === void 0) {
235
+ this.held = session.messages ? { sessionId: session.id, messages: [...session.messages] } : void 0;
236
+ return event;
237
+ }
238
+ const same = this.held?.sessionId === session.id ? this.held : void 0;
239
+ const messages = [...(same?.messages ?? []).slice(0, from), ...session.messages ?? []];
240
+ this.held = { sessionId: session.id, messages, ...same?.gen ? { gen: same.gen } : {} };
241
+ return withSession(event, { ...session, messages: [...messages] }, void 0);
242
+ }
243
+ };
244
+
245
+ // src/tui/slash/arg-values.ts
246
+ var loaded = /* @__PURE__ */ new Map();
247
+ function loadVendorValues(session, harness, account) {
248
+ const key = `${session.id}:${harness.command}:${account?.id ?? ""}:${session.model ?? ""}`;
249
+ const existing = loaded.get(key);
250
+ if (existing) return existing;
251
+ const slot = { models: [], efforts: [] };
252
+ loaded.set(key, slot);
253
+ if (loaded.size > 32) loaded.delete(loaded.keys().next().value);
254
+ void nativeModelCatalog(harness, account).then((catalog) => {
255
+ slot.models = catalog.models.map((model) => {
256
+ const label = harnessModelLabel(harness, model);
257
+ const name = catalog.labels?.[model];
258
+ const detail = modelSettingsDetail(model) ?? (name && name !== label ? name : void 0);
259
+ return { value: model, label, ...detail ? { detail } : {} };
260
+ });
261
+ }).catch(quiet("tui/slash/arg-values"));
262
+ void effortChoicesFor(harness, account, session.model).then((choices) => {
263
+ slot.efforts = choices.values.length ? [{ value: "default", detail: `\xB7 ${harness.displayName} decides` }, ...choices.values.map((value) => ({ value }))] : [];
264
+ }).catch(quiet("tui/slash/arg-values"));
265
+ return slot;
266
+ }
267
+ function withArgValues(entries, session, harness, state) {
268
+ const account = session.accountId ? state.accounts.find((item) => item.id === session.accountId) : void 0;
269
+ const vendor = harness ? loadVendorValues(session, harness, account) : void 0;
270
+ const permissions = harness ? VALID_PERMISSION_MODES.filter((mode) => harnessSupportsPermissionMode(harness, mode)).map((value) => ({ value })) : [];
271
+ const providerIds = new Set([harness?.provider, harness?.command, session.provider, session.nativeHarness].filter((id) => Boolean(id)));
272
+ const accounts = [
273
+ ...state.accounts.filter((item) => providerIds.has(item.provider)).map((item) => ({
274
+ value: item.label,
275
+ ...item.status === "ready" ? {} : { detail: item.status.replaceAll("_", " ") }
276
+ })),
277
+ // Same trailing row as the account picker. Choosing it runs `/account add
278
+ // <harness>`, which hands the terminal to that provider's sign-in.
279
+ ...harness && (harness.localAuth.includes("api-key") || harness.loginArgv) ? [{ value: `add ${harness.command}`, label: "+ Add account\u2026", detail: `\xB7 ${harness.displayName}` }] : []
280
+ ];
281
+ const chats = state.sessions.filter((item) => item.id !== session.id && !item.movedTo && !isBlankConversation(item) && item.name).sort((left, right) => right.updatedAt.localeCompare(left.updatedAt)).map((item) => ({ value: item.name, detail: new Date(item.updatedAt).toLocaleDateString() }));
282
+ const sandbox = sessionSandboxMode(session.sandbox) === "workspace" ? [{ value: "off", label: "Turn the sandbox off" }] : [{ value: "on", label: "Turn the sandbox on" }];
283
+ const sources = {
284
+ "/model": () => vendor?.models ?? [],
285
+ "/effort": () => vendor?.efforts ?? [],
286
+ "/permissions": () => permissions,
287
+ "/account": () => accounts,
288
+ "/resume": () => chats,
289
+ "/sandbox": () => sandbox
290
+ };
291
+ return entries.map((entry) => sources[entry.value] ? { ...entry, argValues: sources[entry.value] } : entry);
292
+ }
293
+
294
+ // src/tui/pickers/session.ts
295
+ import { randomUUID } from "node:crypto";
296
+
297
+ // src/session/discovery/owned.ts
298
+ async function adoptableNativeSessions(state, found, environmentFor = () => ({})) {
299
+ const owned = new Set(state.sessions.flatMap((session) => session.ownedThreads ?? []));
300
+ const open = found.filter(({ harness, item, accountId }) => !item.byClikCode && !(item.title && isClikCodeOpening(item.title)) && !owned.has(`${harness.command}:${item.nativeId}`) && !state.sessions.some((session) => session.nativeHarness === harness.command && session.nativeSessionId === item.nativeId && (!accountId || session.accountId === accountId)));
301
+ const stores = /* @__PURE__ */ new Map();
302
+ for (const entry of open) {
303
+ const store = NATIVE_SESSION_STORES[entry.harness.command];
304
+ const root = store?.openings ? store.root(environmentFor(entry.accountId)) : void 0;
305
+ if (!root) continue;
306
+ const key = `${entry.harness.command}\0${root}`;
307
+ stores.set(key, { root, items: [...stores.get(key)?.items ?? [], entry] });
308
+ }
309
+ const ours = /* @__PURE__ */ new Set();
310
+ await Promise.all([...stores.values()].map(async ({ root, items }) => {
311
+ const openings = await NATIVE_SESSION_STORES[items[0].harness.command].openings(root, items.map(({ item }) => item.nativeId));
312
+ for (const entry of items) {
313
+ const opening = openings.get(entry.item.nativeId);
314
+ if (opening && isClikCodeOpening(opening)) ours.add(entry);
315
+ }
316
+ }));
317
+ return open.filter((entry) => !ours.has(entry));
318
+ }
319
+
320
+ // src/tui/pickers/session.ts
321
+ async function discoverAdoptableSessions(state, workspace, early) {
322
+ const discoveryProfiles = (harness) => {
323
+ const accounts = state.accounts.filter((item) => item.provider === harness.provider && item.status === "ready");
324
+ if (!accounts.length) return [void 0];
325
+ const unique = /* @__PURE__ */ new Map();
326
+ for (const account of accounts) unique.set(account.nativeProfile?.path ?? "default", account);
327
+ return [...unique.values()];
328
+ };
329
+ const discoverable = allLocalHarnesses().filter((harness) => harness.session?.discoverArgv);
330
+ const discovery = acpDiscoveryDirectory();
331
+ const profileOf = new Map(state.accounts.map((account) => [account.id, account.nativeProfile]));
332
+ const notAdopted = (found) => adoptableNativeSessions(
333
+ state,
334
+ found.filter(({ item }) => item.workspace !== discovery),
335
+ (accountId) => nativeProfileEnvironment(accountId ? profileOf.get(accountId) : void 0)
336
+ );
337
+ const seen = (async () => (await Promise.all(discoverable.map(async (harness) => {
338
+ const profiles = discoveryProfiles(harness);
339
+ if (profiles[0] === void 0) return [];
340
+ return (await Promise.all(profiles.map(async (account) => (await lastSeenNativeSessions(harness, workspace, account?.nativeProfile?.path)).map((item) => ({ harness, item, accountId: account?.id }))))).flat();
341
+ }))).flat())().catch(() => []);
342
+ const shell = (async () => (await Promise.all(discoverable.map(async (harness) => {
343
+ const profiles = discoveryProfiles(harness);
344
+ if (profiles[0] === void 0) return [];
345
+ return (await Promise.all(profiles.map(async (account) => {
346
+ const environment = nativeProfileEnvironment(account?.nativeProfile);
347
+ const found = await discoverNativeSessions(harness, environment, workspace, account?.nativeProfile?.path, account);
348
+ return found.map((item) => ({ harness, item, accountId: account?.id }));
349
+ }))).flat();
350
+ }))).flat())();
351
+ const files = (async () => (await Promise.all(Object.entries(FS_SESSION_DISCOVERY).map(async ([command, discover]) => {
352
+ const harness = localHarnessForCommand(command);
353
+ if (!harness) return [];
354
+ const inspection = await inspectNativeHarnessForPicker(harness);
355
+ if (!inspection.installed) return [];
356
+ return (await Promise.all(discoveryProfiles(harness).map(async (account) => {
357
+ const found = await discover("", nativeProfileEnvironment(account?.nativeProfile)).catch(() => []);
358
+ return found.map((item) => ({ harness, item, accountId: account?.id }));
359
+ }))).flat();
360
+ }))).flat())();
361
+ if (early) void Promise.all([seen, files]).then(async ([seenShell, fsDiscovered2]) => early(await notAdopted([...seenShell, ...fsDiscovered2])), () => void 0);
362
+ const [shellDiscovered, fsDiscovered] = await Promise.all([shell, files]);
363
+ await saveDiscoveryCache().catch(quiet("tui/pickers/session"));
364
+ return notAdopted([...shellDiscovered, ...fsDiscovered]);
365
+ }
366
+ var NATIVE_SESSION_DISCOVERY = { run: discoverAdoptableSessions };
367
+ var nativeDiscoveryCache;
368
+ function cachedAdoptableSessions(state, workspace, early) {
369
+ const key = [workspace, ...state.accounts.map((item) => `${item.id}:${item.nativeProfile?.path ?? ""}`).sort()].join("\0");
370
+ const cached = nativeDiscoveryCache;
371
+ if (cached && cached.key === key) return cached.result;
372
+ const result = NATIVE_SESSION_DISCOVERY.run(state, workspace, early).catch(() => {
373
+ return [];
374
+ }).finally(() => {
375
+ if (nativeDiscoveryCache?.result === result) nativeDiscoveryCache = void 0;
376
+ });
377
+ nativeDiscoveryCache = { key, result };
378
+ return result;
379
+ }
380
+ function nativeValue(command, nativeId, accountId) {
381
+ return `native:${command}\0${nativeId}\0${accountId ?? ""}`;
382
+ }
383
+ var OTHER_CLIS = "From other CLIs";
384
+ var PENDING_DISCOVERY_VALUE = "__discovering__";
385
+ var NEW_CONVERSATION_VALUE = "__new__";
386
+ var MANAGE_ACTIONS = [
387
+ { label: "Rename", value: "rename" },
388
+ { label: "Fork", value: "fork" },
389
+ { label: "Archive", value: "archive" }
390
+ ];
391
+ var openOnMachine;
392
+ function takeOpenOnMachine() {
393
+ const machine = openOnMachine;
394
+ openOnMachine = void 0;
395
+ return machine;
396
+ }
397
+ async function interactiveSessionPicker(rl, currentId, boardCommands, hooks) {
398
+ const onBoard = Boolean(boardCommands && rl.board);
399
+ const state = await readState({ transcripts: [] });
400
+ const current = state.sessions.find((item) => item.id === currentId);
401
+ const sessions = state.sessions.filter((session) => session.id === currentId && !onBoard || !isBlankConversation(session)).sort((left, right) => right.updatedAt.localeCompare(left.updatedAt));
402
+ const workspace = current?.workspace ?? process.cwd();
403
+ let workers = await liveWorkers();
404
+ let workerIsLive = workers.isLive;
405
+ let pendingById = await livePendingTurns(sessions, workerIsLive, workers.background, workers.runningTurn);
406
+ let rows = [];
407
+ const fillActivity = () => {
408
+ rows = conversationRows(sessions, { workerIsLive, isOpen: workers.isOpen, runningTurn: workers.runningTurn, background: workers.background, awaitingYou: workers.awaitingYou, pending: pendingById, currentId });
409
+ };
410
+ fillActivity();
411
+ let discovered = [];
412
+ let discovering = true;
413
+ let earlyLanded;
414
+ const early = new Promise((resolveEarly) => {
415
+ earlyLanded = resolveEarly;
416
+ });
417
+ const discovery = cachedAdoptableSessions(state, workspace, (found) => {
418
+ if (discovering) discovered = found;
419
+ earlyLanded();
420
+ }).then((found) => {
421
+ discovered = found;
422
+ }).finally(() => {
423
+ discovering = false;
424
+ earlyLanded();
425
+ });
426
+ let slowDiscovery = false;
427
+ const looking = slowWaitGate(() => {
428
+ slowDiscovery = true;
429
+ }, () => {
430
+ slowDiscovery = false;
431
+ });
432
+ const lookingGone = discovery.catch(quiet("tui/pickers/session")).then(() => looking.end());
433
+ const refreshes = [early, discovery, looking.shown, lookingGone];
434
+ let listRevision = 0;
435
+ let built;
436
+ let listChanged;
437
+ let remote;
438
+ const refreshActivity = coalescedListRefresh(async () => {
439
+ workers = await liveWorkers();
440
+ workerIsLive = workers.isLive;
441
+ pendingById = await livePendingTurns(sessions, workerIsLive, workers.background, workers.runningTurn);
442
+ fillActivity();
443
+ listRevision += 1;
444
+ built = void 0;
445
+ listChanged?.();
446
+ });
447
+ const histories = /* @__PURE__ */ new Map();
448
+ const buildFresh = (machine = "local") => {
449
+ if (onBoard && machine !== "local") {
450
+ const view = remote?.views().find((item) => item.machine.id === machine);
451
+ if (!view) return [];
452
+ return view.chats.map((chat) => remoteConversationOption(view, chat, Date.now()));
453
+ }
454
+ histories.clear();
455
+ const now2 = Date.now();
456
+ const own = rows.map((row) => {
457
+ const option = conversationOption(row, void 0, now2);
458
+ option.group = SECTION_TITLES[row.section];
459
+ return option;
460
+ });
461
+ for (const option of own) {
462
+ const historyAction = option.alternates?.length ? [{ label: "Branches", value: "history" }] : [];
463
+ if (option.alternates?.length) histories.set(option.value, [...option.alternates]);
464
+ delete option.alternates;
465
+ option.actions = [...historyAction, ...MANAGE_ACTIONS];
466
+ option.deleteAction = { label: "Delete", value: "delete" };
467
+ }
468
+ const options = mergeMachineRows(
469
+ own.map((option, index) => ({ option, section: rows[index].section, needsYou: rows[index].needsYou, updatedAtMs: rows[index].updatedAtMs })),
470
+ otherMachineRows(remote?.views() ?? [], now2)
471
+ );
472
+ const others = [...discovered].sort((left, right) => (right.item.updatedAtMs ?? -Infinity) - (left.item.updatedAtMs ?? -Infinity));
473
+ for (const { harness, item, accountId } of others) {
474
+ const when = item.updatedAtMs === void 0 ? "" : relativeTime(new Date(item.updatedAtMs).toISOString(), now2);
475
+ options.push({
476
+ label: `${harness.displayName} \xB7 ${item.title ?? "Untitled chat"}`,
477
+ ...when ? { detail: `\xB7 ${when}` } : {},
478
+ // By identity, not position: the list is replaced when the CLIs
479
+ // answer, and a row chosen from the earlier one must still resolve.
480
+ value: nativeValue(harness.command, item.nativeId, accountId),
481
+ group: OTHER_CLIS
482
+ });
483
+ }
484
+ if (slowDiscovery) {
485
+ options.push({
486
+ label: discovered.length ? "Refreshing chats from other CLIs\u2026" : "Looking for chats from other CLIs\u2026",
487
+ detail: discovered.length ? "\xB7 showing what they listed last time" : "\xB7 your ClikCode conversations are listed above",
488
+ value: PENDING_DISCOVERY_VALUE,
489
+ group: OTHER_CLIS
490
+ });
491
+ }
492
+ if (!onBoard) for (const option of options) option.label = conversationLabel(option, 0);
493
+ if (!onBoard) options.unshift({ label: "+ New conversation", detail: "\xB7 same provider and model", value: NEW_CONVERSATION_VALUE });
494
+ return options;
495
+ };
496
+ const buildOptions = (machine = "local") => {
497
+ const counting = rows.some((row) => row.pending) || Boolean(remote?.views().some((view) => view.state !== "offline" && view.chats.some((chat) => chat.activity === "working")));
498
+ const second = counting ? Math.floor(Date.now() / 1e3) : 0;
499
+ if (built && built.machine === machine && built.discovering === discovering && built.slow === slowDiscovery && built.discovered === discovered && built.revision === listRevision && built.second === second) {
500
+ return built.options;
501
+ }
502
+ built = { machine, discovering, slow: slowDiscovery, discovered, revision: listRevision, second, options: buildFresh(machine) };
503
+ return built.options;
504
+ };
505
+ const listWatch = watchConversationList(() => {
506
+ void refreshActivity().catch(quiet("tui/pickers/session"));
507
+ });
508
+ void refreshActivity().catch(quiet("tui/pickers/session"));
509
+ let tailnet = [];
510
+ if (onBoard) {
511
+ void readTailscaleStatus().then(async ({ status }) => {
512
+ if (!status) return;
513
+ const added = (await readMachines()).filter((machine) => machine.ready);
514
+ tailnet = notYetAdded(discoverMachines(status), added);
515
+ if (tailnet.length) listChanged?.();
516
+ }).catch(quiet("tui/pickers/session"));
517
+ const machines = await holdWindowMachines({ autoUpdate: true }).catch(quiet("tui/pickers/session"));
518
+ if (machines?.views().length) {
519
+ remote = machines;
520
+ remote.onChange(() => {
521
+ listRevision += 1;
522
+ built = void 0;
523
+ listChanged?.();
524
+ });
525
+ } else machines?.release();
526
+ }
527
+ let replacement;
528
+ let returnToList = false;
529
+ let actedOn = false;
530
+ const manage = async (targetId, action) => {
531
+ actedOn = true;
532
+ if (action === "history") {
533
+ const selectedHistory = await chooseOption(rl, "Branches", histories.get(targetId) ?? []);
534
+ if (selectedHistory) replacement = selectedHistory;
535
+ return;
536
+ }
537
+ if (targetId === currentId && (action === "archive" || action === "delete")) {
538
+ replacement = await newConversation(currentId);
539
+ }
540
+ if (action === "rename") {
541
+ const name = (await rl.question("Conversation name \u203A ")).trim();
542
+ if (name) await aiSessionCommand(targetId, `/rename ${name}`);
543
+ } else if (action === "fork") await aiSessionCommand(targetId, "/fork");
544
+ else if (action === "archive") {
545
+ await aiSessionCommand(targetId, "/archive");
546
+ returnToList = true;
547
+ } else if (action === "delete") {
548
+ await aiSessionCommand(targetId, "/delete confirm");
549
+ returnToList = true;
550
+ }
551
+ };
552
+ let selected;
553
+ let addingMachine;
554
+ let draft;
555
+ try {
556
+ if (onBoard) {
557
+ const currentRoot = current ? conversationIdFor(current) : void 0;
558
+ const options = buildOptions();
559
+ const initial = hooks?.initial && options.some((option) => option.value === hooks.initial) ? hooks.initial : options.find((option) => {
560
+ const listed = sessions.find((session) => session.id === option.value);
561
+ return listed !== void 0 && conversationIdFor(listed) === currentRoot;
562
+ })?.value;
563
+ const result = await rl.board({
564
+ conversations: buildOptions,
565
+ commands: boardCommands,
566
+ refresh: refreshes,
567
+ onAction: manage,
568
+ machines: () => [
569
+ { label: localMachineName(), detail: "\xB7 this machine", value: "local" },
570
+ ...remote?.views().map((view) => ({
571
+ label: view.machine.name,
572
+ detail: `\xB7 ${view.state}${view.chats.length ? ` \xB7 ${view.chats.length} chats` : ""}${view.state === "offline" ? "" : updateText(view)}`,
573
+ value: view.machine.id
574
+ })) ?? [],
575
+ ...tailnet.map((machine) => ({
576
+ label: machine.name,
577
+ detail: `\xB7 ${machine.os} \xB7 ${machine.os === "windows" ? "not supported yet" : machine.online ? "add: install ClikCode" : "offline"}`,
578
+ value: `tailscale:${machine.nodeId}`,
579
+ group: "On your tailnet"
580
+ }))
581
+ ],
582
+ addable: (machineId) => machineId.startsWith("tailscale:"),
583
+ initialMachine: ((machine) => machine && remote?.views().some((view) => view.machine.id === machine) ? machine : "local")(takeOpenOnMachine()),
584
+ listChanged: (redraw) => {
585
+ listChanged = redraw;
586
+ },
587
+ ...initial ? { initial } : {},
588
+ ...hooks?.onSessionsSettled ? { onSessionsSettled: hooks.onSessionsSettled } : {}
589
+ });
590
+ if (result && "addMachine" in result) {
591
+ const found = tailnet.find((machine) => `tailscale:${machine.nodeId}` === result.addMachine);
592
+ if (!found) return void 0;
593
+ if (found.os === "windows") return { notice: `${found.name} runs Windows: ClikCode Remote does not support it yet.` };
594
+ if (!found.online) return { notice: `${found.name} is offline: turn it on, then choose it again.` };
595
+ addingMachine = found;
596
+ }
597
+ if (result && "compose" in result) return { compose: result.compose };
598
+ if (result && "command" in result) return { command: result.command };
599
+ if (result && "open" in result) {
600
+ selected = result.open;
601
+ if (result.draft) draft = result.draft;
602
+ }
603
+ } else {
604
+ selected = await chooseOption(
605
+ rl,
606
+ "Conversations",
607
+ buildOptions(),
608
+ (value, action) => manage(value, action),
609
+ {
610
+ refreshedOptions: buildOptions,
611
+ refresh: refreshes,
612
+ // Taller than a settings list -- it is the place to look over
613
+ // everything running -- but never more than a small terminal can hold.
614
+ rows: Math.max(8, Math.min(14, uncoveredRows(process.stdout.rows ?? 24) - 16))
615
+ }
616
+ );
617
+ }
618
+ } finally {
619
+ listWatch.stop();
620
+ remote?.release();
621
+ }
622
+ if (addingMachine) {
623
+ const added = await addDiscoveredMachine(remoteHostOf(rl), addingMachine);
624
+ if (!added.id) return void 0;
625
+ openOnMachine = added.id;
626
+ return interactiveSessionPicker(rl, currentId, boardCommands, hooks);
627
+ }
628
+ if (returnToList) {
629
+ const next = await interactiveSessionPicker(rl, replacement ?? currentId, boardCommands, hooks);
630
+ return next ?? (replacement ? { id: replacement } : void 0);
631
+ }
632
+ if (replacement) return { id: replacement };
633
+ if (!selected && actedOn) return interactiveSessionPicker(rl, currentId, boardCommands, hooks);
634
+ if (!selected) return void 0;
635
+ if (isRemoteRowValue(selected)) {
636
+ const remote2 = parseRemoteRowValue(selected);
637
+ return remote2?.chatId ? { remote: remote2, ...draft ? { draft } : {} } : void 0;
638
+ }
639
+ if (selected === NEW_CONVERSATION_VALUE) return { new: true };
640
+ if (selected === PENDING_DISCOVERY_VALUE) {
641
+ await discovery;
642
+ return interactiveSessionPicker(rl, currentId, boardCommands, hooks);
643
+ }
644
+ if (!selected.startsWith("native:")) return { id: selected, ...draft ? { draft } : {} };
645
+ const match = discovered.find(({ harness, item, accountId }) => nativeValue(harness.command, item.nativeId, accountId) === selected);
646
+ if (!match) return void 0;
647
+ const nativeId = match.item.nativeId;
648
+ const account = match.accountId ? state.accounts.find((item) => item.id === match.accountId) : state.accounts.find((item) => item.provider === match.harness.provider && item.status === "ready");
649
+ const defaults = resolveDefaultSettings(state, match.harness.provider);
650
+ const now = (/* @__PURE__ */ new Date()).toISOString();
651
+ const chatWorkspace = match.item.workspace ?? workspace;
652
+ const transcriptReader = nativeTranscriptReader(match.harness);
653
+ const messages = transcriptReader ? await transcriptReader(match.harness, nativeId, chatWorkspace, nativeProfileEnvironment(account?.nativeProfile)).catch(() => []) : [];
654
+ const id = randomUUID();
655
+ const pinned = cliThreadTransport(match.harness);
656
+ const adopted = {
657
+ id,
658
+ conversationId: id,
659
+ route: "local",
660
+ accountId: account?.id ?? null,
661
+ provider: match.harness.provider,
662
+ model: null,
663
+ effort: defaults.effort,
664
+ permissionMode: defaults.permissionMode,
665
+ createdAt: now,
666
+ updatedAt: now,
667
+ status: "active",
668
+ nativeHarness: match.harness.command,
669
+ nativeSessionId: nativeId,
670
+ nativeStartedAt: now,
671
+ ...pinned ? { nativeTransport: pinned } : {},
672
+ // Named only from a title the harness itself wrote. The resume list also
673
+ // shows the opening of the first message when there is no real title, and
674
+ // writing THAT into `name` is what used to leave every adopted chat called
675
+ // "we need to have scrolling but we need to not have terminal / co…" --
676
+ // a preview that looks like a name forever, because nameSession returns
677
+ // early on any name at all and can never replace it.
678
+ workspace: chatWorkspace,
679
+ ...match.item.titleIsGenerated && match.item.title ? { name: match.item.title, nameSource: "provider" } : {},
680
+ ...messages.length ? { messages } : {}
681
+ };
682
+ state.sessions.push(adopted);
683
+ await writeState(state);
684
+ return { id: adopted.id, ...draft ? { draft } : {} };
685
+ }
686
+
687
+ export {
688
+ withArgValues,
689
+ interactiveSessionPicker,
690
+ SessionDeltaSender,
691
+ SessionDeltaReceiver
692
+ };