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,243 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ quotaResetPhrase
5
+ } from "./chunk-EE4B6A7W.js";
6
+
7
+ // src/harness/accounts/usage-reading.ts
8
+ function windowSpent(window) {
9
+ return window.usedPct >= 100 && !window.advisory;
10
+ }
11
+ var nativeUsageCache = /* @__PURE__ */ new Map();
12
+ function usageCacheKey(harnessCommand, accountId, nativeSessionId) {
13
+ return accountId ? `${harnessCommand}:account:${accountId}` : `${harnessCommand}:session:${nativeSessionId ?? "default"}`;
14
+ }
15
+ function resetTime(value) {
16
+ if (typeof value === "string" && value.trim()) {
17
+ const parsed = Date.parse(value);
18
+ return Number.isNaN(parsed) ? void 0 : new Date(parsed).toISOString();
19
+ }
20
+ if (typeof value === "number" && Number.isFinite(value) && value > 0) {
21
+ return new Date(value < 1e12 ? value * 1e3 : value).toISOString();
22
+ }
23
+ return void 0;
24
+ }
25
+ function usageWindow(name, usedPct, resetsAt) {
26
+ if (typeof usedPct !== "number" || !Number.isFinite(usedPct)) return void 0;
27
+ const reset = resetTime(resetsAt);
28
+ return { name, usedPct, ...reset ? { resetsAt: reset } : {} };
29
+ }
30
+ function usageWindowTitle(name) {
31
+ return name ? name[0].toUpperCase() + name.slice(1) : name;
32
+ }
33
+ function usageReadingLabel(windows) {
34
+ const parts = windows.map((window) => `${usageWindowTitle(window.name)} ${Math.max(0, Math.min(100, Math.round(100 - window.usedPct)))}% left`);
35
+ return parts.length ? parts.join(" \xB7 ") : void 0;
36
+ }
37
+ function accountUsageText(usage) {
38
+ return usageReadingLabel(usage.windows) ?? usage.label;
39
+ }
40
+ function accountDisplayUsage(account, reading, now = Date.now()) {
41
+ if (!reading || !account || account.status !== "ready" || quotaRefusalHolds(account, now)) return reading;
42
+ const windows = reading.windows.map((window) => !window.advisory && Math.round(100 - window.usedPct) <= 0 ? { ...window, usedPct: 99 } : window);
43
+ if (windows.every((window, index) => window === reading.windows[index])) return reading;
44
+ return { ...reading, windows, label: usageReadingLabel(windows) ?? reading.label };
45
+ }
46
+ function usageResetLabel(windows, now = Date.now()) {
47
+ const exhausted = (windows ?? []).filter((window) => windowSpent(window) && window.resetsAt !== void 0 && Date.parse(window.resetsAt) > now).sort((a, b) => Date.parse(b.resetsAt) - Date.parse(a.resetsAt));
48
+ const next = exhausted[0];
49
+ if (!next) return void 0;
50
+ return `Resets ${quotaResetPhrase(new Date(next.resetsAt), now)}`;
51
+ }
52
+ function usageNextReset(windows, now = Date.now()) {
53
+ const next = (windows ?? []).filter((window) => !window.advisory && window.resetsAt !== void 0 && Date.parse(window.resetsAt) > now).sort((a, b) => windowSpent(a) && windowSpent(b) ? Date.parse(b.resetsAt) - Date.parse(a.resetsAt) : b.usedPct - a.usedPct)[0];
54
+ return next ? `${usageWindowTitle(next.name)} resets ${quotaResetPhrase(new Date(next.resetsAt), now)}` : void 0;
55
+ }
56
+ function usageWindowsDetail(windows, now = Date.now()) {
57
+ const lines = (windows ?? []).map((window) => {
58
+ const left = `${usageWindowTitle(window.name)} ${Math.max(0, Math.min(100, Math.round(100 - window.usedPct)))}% left`;
59
+ const at = window.resetsAt ? Date.parse(window.resetsAt) : Number.NaN;
60
+ return Number.isFinite(at) && at > now ? `${left} \xB7 resets ${quotaResetPhrase(new Date(at), now)}` : left;
61
+ });
62
+ return lines.length ? lines.join("\n") : void 0;
63
+ }
64
+ function accountBackAt(account, now = Date.now()) {
65
+ const resets = vendorWindows(account).filter((window) => windowSpent(window) && window.resetsAt !== void 0 && Date.parse(window.resetsAt) > now).map((window) => Date.parse(window.resetsAt));
66
+ const retry = Date.parse(account.quotaRetryAt ?? "");
67
+ if (quotaRefusalHolds(account, now) && Number.isFinite(retry) && retry > now) resets.push(retry);
68
+ return resets.length ? new Date(Math.max(...resets)).toISOString() : void 0;
69
+ }
70
+ function outOfUsageText(backAt, now = Date.now()) {
71
+ return backAt ? `Resets ${quotaResetPhrase(new Date(backAt), now)}` : "out of usage";
72
+ }
73
+ function usageReading(windows) {
74
+ const known = windows.filter((window) => Boolean(window));
75
+ return known.length ? { windows: known, label: usageReadingLabel(known) } : void 0;
76
+ }
77
+ function usageReadingIsCurrent(reading, now = Date.now()) {
78
+ return !(reading?.windows ?? []).some((window) => window.resetsAt !== void 0 && Date.parse(window.resetsAt) <= now);
79
+ }
80
+ var QUOTA_MARK_DEFAULT_MS = 5 * 60 * 60 * 1e3;
81
+ function vendorWindows(account) {
82
+ const reading = account.usage;
83
+ const windows = reading && !reading.failed ? reading.windows ?? [] : [];
84
+ const disproven = account.disprovenWindows;
85
+ return disproven?.length ? windows.filter((window) => !disproven.includes(windowKey(window))) : windows;
86
+ }
87
+ function windowKey(window) {
88
+ return `${window.name}@${window.resetsAt ?? ""}`;
89
+ }
90
+ function quotaMarkExpiresAt(account) {
91
+ if (account.quotaState !== "exhausted") return void 0;
92
+ const retry = Date.parse(account.quotaRetryAt ?? "");
93
+ if (Number.isFinite(retry)) return retry;
94
+ const marked = Date.parse(account.quotaExhaustedAt ?? "");
95
+ return Number.isFinite(marked) ? marked + QUOTA_MARK_DEFAULT_MS : void 0;
96
+ }
97
+ function accountQuotaSpent(account, now = Date.now(), scope) {
98
+ return vendorWindows(account).some((window) => windowSpent(window) && (window.resetsAt === void 0 || Date.parse(window.resetsAt) > now)) || quotaRefusalHolds(account, now, scope);
99
+ }
100
+ function scopedQuotaHolds(account, scope, now) {
101
+ const mark = account.quotaScopes?.[scope];
102
+ if (!mark) return false;
103
+ const until = Date.parse(mark.retryAt ?? "");
104
+ return !Number.isFinite(until) || until > now;
105
+ }
106
+ function modelQuotaRefusalHolds(account, now, scope) {
107
+ return Boolean(scope && scopedQuotaHolds(account, scope, now));
108
+ }
109
+ function quotaRefusalHolds(account, now = Date.now(), scope) {
110
+ if (scope && scopedQuotaHolds(account, scope, now)) return true;
111
+ const expires = quotaMarkExpiresAt(account);
112
+ if (expires === void 0 || expires <= now) return false;
113
+ const readAt = Date.parse(account.usage?.at ?? "");
114
+ const markedAt = Date.parse(account.quotaExhaustedAt ?? "");
115
+ if (!(readAt > markedAt)) return true;
116
+ const windows = vendorWindows(account).filter((window) => !window.advisory);
117
+ return !windows.length || windows.some((window) => windowSpent(window) && (window.resetsAt === void 0 || Date.parse(window.resetsAt) > now));
118
+ }
119
+ function accountCanTakeTurn(account, now = Date.now(), scope) {
120
+ return account.status === "ready" && !account.verification && !(scope ? scopedQuotaHolds(account, scope, now) : false) && !accountQuotaSpent(account, now);
121
+ }
122
+ function markQuotaExhausted(account, now = Date.now(), retryAt) {
123
+ account.quotaState = "exhausted";
124
+ account.quotaExhaustedAt = new Date(now).toISOString();
125
+ account.quotaRetryAt = retryAt;
126
+ }
127
+ function clearQuotaMark(account) {
128
+ if (account.quotaState === "exhausted") account.quotaState = "available";
129
+ account.quotaExhaustedAt = void 0;
130
+ account.quotaRetryAt = void 0;
131
+ }
132
+ function settleQuotaMark(account, now = Date.now()) {
133
+ if (account.quotaState !== "exhausted" || accountQuotaSpent(account, now)) return false;
134
+ clearQuotaMark(account);
135
+ return true;
136
+ }
137
+ var USAGE_RECHECK_MS = 6e4;
138
+ function usageAskedAt(account) {
139
+ return Math.max(Number.NEGATIVE_INFINITY, ...[account.usage?.at, account.usageCheckedAt].map((at) => Date.parse(at ?? "")).filter(Number.isFinite));
140
+ }
141
+ function usageWindowName(minutes) {
142
+ if (minutes >= 40320 && minutes <= 44640) return "monthly";
143
+ if (minutes === 10080) return "weekly";
144
+ if (minutes === 1440) return "daily";
145
+ if (minutes % 60 === 0) return `${minutes / 60}h`;
146
+ return `${minutes}m`;
147
+ }
148
+ function usageWindowMinutes(name) {
149
+ if (name === "weekly") return 10080;
150
+ if (name === "daily") return 1440;
151
+ if (name === "monthly") return 43200;
152
+ const found = /^(\d+)(h|m)$/.exec(name);
153
+ return found ? Number(found[1]) * (found[2] === "h" ? 60 : 1) : void 0;
154
+ }
155
+ function claudeRateLimitReading(info) {
156
+ const windows = info?.unifiedWindows;
157
+ if (!windows) return void 0;
158
+ const window = (name, value) => usageWindow(name, typeof value?.utilization === "number" ? value.utilization * 100 : void 0, value?.resetsAt ?? value?.resets_at);
159
+ return usageReading([window("5h", windows.five_hour), window("weekly", windows.seven_day)]);
160
+ }
161
+ function zoneOffsetMs(at, timeZone) {
162
+ const parts = new Intl.DateTimeFormat("en-US", {
163
+ timeZone,
164
+ hourCycle: "h23",
165
+ year: "numeric",
166
+ month: "numeric",
167
+ day: "numeric",
168
+ hour: "numeric",
169
+ minute: "numeric",
170
+ second: "numeric"
171
+ }).formatToParts(at);
172
+ const part = (type) => Number(parts.find((item) => item.type === type)?.value);
173
+ return Date.UTC(part("year"), part("month") - 1, part("day"), part("hour"), part("minute"), part("second")) - at;
174
+ }
175
+ var MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
176
+ function zonedResetTime(text, timeZone, now = Date.now()) {
177
+ const match = /^(?:([a-z]{3})[a-z]*\.? (\d{1,2}),?\s+(?:at\s+)?)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)$/i.exec(text.trim());
178
+ const month = match?.[1] ? MONTHS.indexOf(match[1].toLowerCase()) : void 0;
179
+ if (!match || month === -1) return void 0;
180
+ const hour = Number(match[3]) % 12 + (match[5].toLowerCase() === "pm" ? 12 : 0);
181
+ const minute = Number(match[4] ?? 0);
182
+ try {
183
+ const instant = (year2, monthIndex, day) => {
184
+ const wall = Date.UTC(year2, monthIndex, day, hour, minute);
185
+ const first = wall - zoneOffsetMs(wall, timeZone);
186
+ return wall - zoneOffsetMs(first, timeZone);
187
+ };
188
+ const today = new Date(now + zoneOffsetMs(now, timeZone));
189
+ const year = today.getUTCFullYear();
190
+ let at;
191
+ if (month === void 0) {
192
+ at = instant(year, today.getUTCMonth(), today.getUTCDate());
193
+ if (at <= now) at = instant(year, today.getUTCMonth(), today.getUTCDate() + 1);
194
+ } else {
195
+ at = instant(year, month, Number(match[2]));
196
+ if (at < now - 864e5) at = instant(year + 1, month, Number(match[2]));
197
+ }
198
+ return Number.isFinite(at) ? new Date(at).toISOString() : void 0;
199
+ } catch {
200
+ return void 0;
201
+ }
202
+ }
203
+ function claudeUsageCommandReading(text, now = Date.now()) {
204
+ const line = (label, name) => {
205
+ const found = new RegExp(`${label}:\\s*(\\d+(?:\\.\\d+)?)% used(?:\\s*\xB7\\s*resets ([^(\\n]+?)\\s*\\(([^)\\n]+)\\))?`, "i").exec(text);
206
+ if (!found) return void 0;
207
+ return usageWindow(name, Number(found[1]), found[2] && found[3] ? zonedResetTime(found[2], found[3], now) : void 0);
208
+ };
209
+ return usageReading([line("Current session", "5h"), line("Current week \\(all models\\)", "weekly")]);
210
+ }
211
+
212
+ export {
213
+ windowSpent,
214
+ nativeUsageCache,
215
+ usageCacheKey,
216
+ usageWindow,
217
+ accountUsageText,
218
+ accountDisplayUsage,
219
+ usageResetLabel,
220
+ usageNextReset,
221
+ usageWindowsDetail,
222
+ accountBackAt,
223
+ outOfUsageText,
224
+ usageReading,
225
+ usageReadingIsCurrent,
226
+ vendorWindows,
227
+ windowKey,
228
+ accountQuotaSpent,
229
+ modelQuotaRefusalHolds,
230
+ quotaRefusalHolds,
231
+ accountCanTakeTurn,
232
+ markQuotaExhausted,
233
+ clearQuotaMark,
234
+ settleQuotaMark,
235
+ USAGE_RECHECK_MS,
236
+ usageAskedAt,
237
+ usageWindowName,
238
+ usageWindowMinutes,
239
+ claudeRateLimitReading,
240
+ MONTHS,
241
+ zonedResetTime,
242
+ claudeUsageCommandReading
243
+ };
@@ -0,0 +1,59 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ stripResourceNotes
5
+ } from "./chunk-FF7ZVYJF.js";
6
+
7
+ // src/session/store-evidence.ts
8
+ var StoreBehindError = class extends Error {
9
+ constructor(sessionId, detail) {
10
+ super(`The stored history of conversation ${sessionId} is behind: ${detail}. ClikCode will not continue from it, and rebuilds nothing from older copies. Run \`clikcode sessions audit\` to see what survives, then \`clikcode sessions repair ${sessionId}\`.`);
11
+ this.sessionId = sessionId;
12
+ this.name = "StoreBehindError";
13
+ }
14
+ sessionId;
15
+ };
16
+ function checkStoreAgainstIndex(session) {
17
+ const counted = session.listMessageCount;
18
+ const have = session.messages?.length;
19
+ if (counted === void 0 || have === void 0 || have >= counted) return;
20
+ throw new StoreBehindError(session.id, `the index last recorded ${counted} messages and the log holds ${have}`);
21
+ }
22
+ function requestKey(text) {
23
+ return stripResourceNotes(text).replace(/\s+/g, " ").trim();
24
+ }
25
+ function isInjectedRequest(text) {
26
+ const request = stripResourceNotes(text);
27
+ if (!request.trim()) return true;
28
+ return /^\s*(<(command-|local-command|system-reminder|task-notification|subagent_notification|clikcode_)|\[(Request interrupted|ClikCode[:\]]))/.test(request);
29
+ }
30
+ var MIN_ALIGNED = 24;
31
+ var HEAD = 80;
32
+ function threadCoverage(request, messages, updatedAt) {
33
+ if (!request) return { kind: "unknown" };
34
+ if (isInjectedRequest(request.text)) return { kind: "unknown" };
35
+ const asked = requestKey(request.text);
36
+ if (asked.length < MIN_ALIGNED) return { kind: "unknown" };
37
+ const users = [];
38
+ for (const message of messages) if (message.role === "user" && !message.automatic) users.push(requestKey(message.content));
39
+ for (let index = users.length - 1; index >= 0; index -= 1) {
40
+ const mine = users[index];
41
+ if (mine.length < MIN_ALIGNED) continue;
42
+ if (asked.includes(mine.slice(0, HEAD)) || mine.includes(asked.slice(0, HEAD))) {
43
+ const missed = users.length - 1 - index;
44
+ return missed ? { kind: "behind", missed } : { kind: "current" };
45
+ }
46
+ }
47
+ const at = Date.parse(request.at ?? "");
48
+ const written = Date.parse(updatedAt ?? "");
49
+ if (Number.isFinite(at) && Number.isFinite(written) && at > written + 6e4) return { kind: "ahead", request: asked.slice(0, 200) };
50
+ return { kind: "unknown" };
51
+ }
52
+
53
+ export {
54
+ StoreBehindError,
55
+ checkStoreAgainstIndex,
56
+ requestKey,
57
+ isInjectedRequest,
58
+ threadCoverage
59
+ };
@@ -0,0 +1,82 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ DEFAULT_TAB,
5
+ liveKeygrab,
6
+ liveKeygrabPort
7
+ } from "./chunk-KZL5VS4B.js";
8
+ import {
9
+ loadParked,
10
+ markerFor
11
+ } from "./chunk-SZBQMTG2.js";
12
+ import "./chunk-DW2BMUKY.js";
13
+ import {
14
+ quiet
15
+ } from "./chunk-RDDWQBEM.js";
16
+ import "./chunk-MPAJ446F.js";
17
+ import "./chunk-CBANJFBO.js";
18
+ import "./chunk-PWXII6HF.js";
19
+
20
+ // src/agent/computer/keygrab-resume.ts
21
+ async function resumeKeygrab(options) {
22
+ const record = await loadParked(options.stateDir, options.id);
23
+ if (!record) throw new Error(`Nothing is parked for ${options.id}: run \`clikcode computer keygrab ${options.id} <url>\` first (a run that cannot finish leaves its tab parked).`);
24
+ if (options.goto && !/^https:\/\/[^\s]+$/.test(options.goto)) throw new Error("--goto is an https address.");
25
+ const browser = await import("./chunk-ZFC2Q67K.js");
26
+ const tab = record.tab ?? DEFAULT_TAB;
27
+ const delivery = options.delivery ?? record.delivery;
28
+ let reattached = "tab";
29
+ const found = await browser.reattachParkedPage(options.stateDir, tab, markerFor(options.id));
30
+ if (!found) {
31
+ reattached = "reopened";
32
+ await browser.openComputerPage(options.stateDir, tab);
33
+ const port = await liveKeygrabPort({ stateDir: options.stateDir, id: options.id, tab, ...delivery ? { delivery } : {}, ...options.signal ? { signal: options.signal } : {} });
34
+ const err = await port.open(record.url.startsWith("https://") ? record.url : record.vendorUrl);
35
+ if (err) throw new Error(`The parked tab is gone and its last page could not be reopened: ${err}`);
36
+ }
37
+ if (record.journal) (await import("./chunk-AE7TOLD5.js")).importJournal(`${options.stateDir}#${tab}`, record.journal);
38
+ let pressed;
39
+ if (options.click || options.goto) {
40
+ const port = await liveKeygrabPort({ stateDir: options.stateDir, id: options.id, tab, ...delivery ? { delivery } : {}, ...options.signal ? { signal: options.signal } : {} });
41
+ const err = options.goto ? await port.open(options.goto) : await port.click(options.click);
42
+ pressed = options.goto ? `goto ${options.goto}` : `click ${options.click}`;
43
+ if (err) {
44
+ await browser.parkComputerPage(options.stateDir, tab, markerFor(options.id));
45
+ await browser.releaseComputerBrowser(options.stateDir).catch(quiet("agent/computer/keygrab-resume"));
46
+ return { id: options.id, reattached, pressed, record, outcome: { ok: false, stop: { kind: "unknown", message: `${pressed} failed: ${err}`.slice(0, 300), url: record.url, pageText: "", controls: record.controls, trail: record.trail, parked: true, vendorUrl: record.vendorUrl, visited: record.visited, menus: record.menus } } };
47
+ }
48
+ record.trail = [...record.trail, pressed].slice(-40);
49
+ }
50
+ if (options.only) {
51
+ const port = await liveKeygrabPort({ stateDir: options.stateDir, id: options.id, tab, ...delivery ? { delivery } : {}, ...options.signal ? { signal: options.signal } : {} });
52
+ const seen = await port.look();
53
+ const { pageExcerpt } = await import("./chunk-M5QNDBAY.js");
54
+ const { safeControlNames } = await import("./chunk-GWCMDPQU.js");
55
+ const { hideKeyLikeText } = await import("./chunk-TKWVMA6L.js");
56
+ const { exportJournal } = await import("./chunk-AE7TOLD5.js");
57
+ const { saveParked } = await import("./chunk-H2VZMKPE.js");
58
+ const trail = [...record.trail, ...pressed ? [pressed] : []].slice(-40);
59
+ let url = seen.url;
60
+ try {
61
+ const u = new URL(seen.url);
62
+ url = `${u.origin}${u.pathname}`;
63
+ } catch {
64
+ }
65
+ const journal = exportJournal(`${options.stateDir}#${tab}`);
66
+ const next = { ...record, tab, ...delivery ? { delivery } : {}, parkedAt: (/* @__PURE__ */ new Date()).toISOString(), url, trail, controls: safeControlNames(seen.controls.filter((c) => !c.leaf), 40), ...journal ? { journal } : {} };
67
+ await browser.parkComputerPage(options.stateDir, tab, markerFor(options.id));
68
+ await saveParked(options.stateDir, next);
69
+ await browser.releaseComputerBrowser(options.stateDir).catch(quiet("agent/computer/keygrab-resume"));
70
+ return { id: options.id, reattached, ...pressed ? { pressed } : {}, record: next, outcome: { ok: false, stop: { kind: "unknown", message: `${pressed ?? "nothing"} pressed; keygrab was not run (--only)`, url, pageText: pageExcerpt(hideKeyLikeText(seen.text).text), controls: safeControlNames(seen.controls, 60), trail, parked: true, vendorUrl: record.vendorUrl, visited: record.visited, menus: record.menus } } };
71
+ }
72
+ const outcome = await liveKeygrab(
73
+ { stateDir: options.stateDir, tab, ...delivery ? { delivery } : {}, ...options.signal ? { signal: options.signal } : {}, ...options.screenshotDir ? { screenshotDir: options.screenshotDir } : {} },
74
+ options.id,
75
+ record.vendorUrl,
76
+ { maxMs: options.maxMs ?? 24e4, ...options.maxSteps ? { maxSteps: options.maxSteps } : {}, ...record.alternates?.length ? { alternates: record.alternates } : {}, resume: record }
77
+ );
78
+ return { id: options.id, reattached, ...pressed ? { pressed } : {}, outcome, record };
79
+ }
80
+ export {
81
+ resumeKeygrab
82
+ };
@@ -0,0 +1,99 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ aiSessionCommand,
5
+ aiSettingsSetGlobal
6
+ } from "./chunk-H4THUNBM.js";
7
+ import {
8
+ TerminalHarnessPrompter
9
+ } from "./chunk-QPQKX2MK.js";
10
+ import {
11
+ chooseOption
12
+ } from "./chunk-ROGXPGYR.js";
13
+ import {
14
+ readState
15
+ } from "./chunk-MXS6S2PY.js";
16
+ import {
17
+ VALID_PERMISSION_MODES,
18
+ sessionPermissionModes
19
+ } from "./chunk-TWCVV2JO.js";
20
+ import {
21
+ isClikCodeAgent
22
+ } from "./chunk-CRUVYGO2.js";
23
+ import {
24
+ localHarnessForCommand
25
+ } from "./chunk-KYUHIFP3.js";
26
+ import {
27
+ TERMINAL,
28
+ terminalUiSupported
29
+ } from "./chunk-DF35KMXM.js";
30
+
31
+ // src/tui/pickers/setting-scope.ts
32
+ async function applyToChat(id, key, value) {
33
+ await aiSessionCommand(id, `/${key} ${value}`);
34
+ }
35
+ function settingLabel(value) {
36
+ return value ? value[0].toUpperCase() + value.slice(1) : "Default";
37
+ }
38
+
39
+ // src/tui/pickers/permissions.ts
40
+ async function aiPermissions(mode, options = {}) {
41
+ const normalizedMode = mode?.trim().toLowerCase();
42
+ if (normalizedMode && !VALID_PERMISSION_MODES.includes(normalizedMode)) {
43
+ throw new Error("permissions must be ask, bypass, or auto");
44
+ }
45
+ const chatId = options.chat ? await (await import("./chunk-XRDALAO3.js")).resolveChat(options.chat) : void 0;
46
+ if (normalizedMode) {
47
+ if (chatId) await aiSessionCommand(chatId, `/permissions ${normalizedMode}`);
48
+ else await aiSettingsSetGlobal("permissions", normalizedMode);
49
+ return;
50
+ }
51
+ if (!terminalUiSupported()) throw new Error("an ANSI-capable interactive terminal is required; use `clikcode permissions ask|bypass|auto`");
52
+ const rl = new TerminalHarnessPrompter();
53
+ TERMINAL.active = rl;
54
+ try {
55
+ if (chatId) {
56
+ const state = await readState({ transcripts: [chatId] });
57
+ const session = state.sessions.find((item) => item.id === chatId);
58
+ const account = session.accountId ? state.accounts.find((item) => item.id === session.accountId)?.label : void 0;
59
+ rl.render?.(session, account);
60
+ await interactivePermissionPicker(rl, session.id);
61
+ } else {
62
+ const selected = await chooseOption(rl, "Choose permissions", VALID_PERMISSION_MODES.map((value) => ({
63
+ label: value[0].toUpperCase() + value.slice(1),
64
+ value
65
+ })));
66
+ if (selected) await aiSettingsSetGlobal("permissions", selected);
67
+ }
68
+ } finally {
69
+ TERMINAL.active = void 0;
70
+ rl.close();
71
+ }
72
+ }
73
+ async function interactivePermissionPicker(rl, id) {
74
+ const state = await readState({ transcripts: [id] });
75
+ const session = state.sessions.find((item) => item.id === id);
76
+ if (!session) throw new Error(`AI session "${id}" was not found`);
77
+ const harness = !isClikCodeAgent(session) && session.nativeHarness ? localHarnessForCommand(session.nativeHarness) : void 0;
78
+ const current = session.permissionMode ?? "ask";
79
+ const descriptions = {
80
+ ask: "require approval; unanswered headless prompts are denied",
81
+ bypass: "run without approval prompts",
82
+ auto: "provider reviews approval requests automatically"
83
+ };
84
+ const supported = harness || isClikCodeAgent(session) ? sessionPermissionModes(session, harness) : VALID_PERMISSION_MODES;
85
+ if (!supported.length) throw new Error(`${harness?.displayName ?? "This provider"} does not map ClikCode's permission modes to a real flag.`);
86
+ const selected = await chooseOption(rl, "Choose permissions", supported.map((value) => ({
87
+ label: value[0].toUpperCase() + value.slice(1),
88
+ detail: `${value === current ? "\xB7 current " : ""}\xB7 ${descriptions[value]}`,
89
+ value
90
+ })));
91
+ if (selected) await applyToChat(id, "permissions", selected);
92
+ }
93
+
94
+ export {
95
+ applyToChat,
96
+ settingLabel,
97
+ aiPermissions,
98
+ interactivePermissionPicker
99
+ };
@@ -0,0 +1,47 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ tunedModelId
5
+ } from "./chunk-7DOKGSUN.js";
6
+ import "./chunk-IS4USJPY.js";
7
+ import "./chunk-TQDKJHWX.js";
8
+ import "./chunk-PEWCDI2C.js";
9
+ import "./chunk-TULAXS77.js";
10
+ import {
11
+ emitResult
12
+ } from "./chunk-JGIWATSG.js";
13
+ import "./chunk-5B6TVO4A.js";
14
+ import "./chunk-F6F47QAY.js";
15
+ import "./chunk-RDDWQBEM.js";
16
+ import "./chunk-MPAJ446F.js";
17
+ import "./chunk-CBANJFBO.js";
18
+ import "./chunk-PWXII6HF.js";
19
+
20
+ // src/commands/ai/finetune-local.ts
21
+ async function aiLocalFineTune(datasetPath, options = {}, deps = {}) {
22
+ if (!options.base) throw new Error("Name the base model with --base, a Hugging Face repo such as Qwen/Qwen2.5-0.5B-Instruct (the original weights, not a GGUF).");
23
+ if (!options.name) throw new Error("Name the new model with --name, e.g. --name support-bot. You will choose it as tuned:support-bot.");
24
+ const epochs = options.epochs === void 0 ? void 0 : Number(options.epochs);
25
+ const rank = options.rank === void 0 ? void 0 : Number(options.rank);
26
+ if (rank !== void 0 && (!Number.isInteger(rank) || rank < 4 || rank > 128)) throw new Error("--rank must be a whole number from 4 to 128");
27
+ if (options.license !== void 0 && options.license !== "apache-2.0" && options.license !== "mit") throw new Error("--license must be apache-2.0 or mit: ClikCode Local runs only models under those licenses.");
28
+ const fineTune = deps.fineTune ?? (await import("./chunk-6HYEZFGL.js")).fineTuneLocalModel;
29
+ const { model, seconds } = await fineTune({
30
+ dataset: datasetPath,
31
+ base: options.base,
32
+ name: options.name,
33
+ ...epochs !== void 0 ? { epochs } : {},
34
+ ...rank !== void 0 ? { loraRank: rank } : {},
35
+ ...options.license ? { license: options.license } : {}
36
+ }, { ...deps.progress ? { progress: deps.progress } : {} });
37
+ emitResult({
38
+ model: tunedModelId(options.name),
39
+ label: model.label,
40
+ sizeBytes: model.weights.sizeBytes,
41
+ minutes: Math.round(seconds / 60),
42
+ use: `Choose it with /model ${tunedModelId(options.name)}, or: clikcode send --harness clikcode-local --model ${tunedModelId(options.name)} "\u2026"`
43
+ });
44
+ }
45
+ export {
46
+ aiLocalFineTune
47
+ };
@@ -0,0 +1,71 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ COMPUTER_OFF,
5
+ COMPUTER_TUNABLES,
6
+ HOME_EGRESS,
7
+ addEgress,
8
+ browserDisplay,
9
+ browserProvider,
10
+ captchaSolvingAllowed,
11
+ computerEnabled,
12
+ computerEnabledSync,
13
+ computerSettingsPath,
14
+ computerTunable,
15
+ computerTunableList,
16
+ egressList,
17
+ egressProblem,
18
+ egressSetting,
19
+ generatedPasswordsAllowed,
20
+ headlessSetting,
21
+ parseBrowserDisplay,
22
+ parseEgress,
23
+ removeEgress,
24
+ setBrowserDisplay,
25
+ setBrowserProvider,
26
+ setCaptchaSolving,
27
+ setComputerEnabled,
28
+ setComputerTunable,
29
+ setGeneratedPasswords,
30
+ setHeadless,
31
+ setUnattended,
32
+ unattendedEnabled
33
+ } from "./chunk-5SM5UAWN.js";
34
+ import "./chunk-PAXYQZH7.js";
35
+ import "./chunk-4L2ZZM4Q.js";
36
+ import "./chunk-F6F47QAY.js";
37
+ import "./chunk-RDDWQBEM.js";
38
+ import "./chunk-MPAJ446F.js";
39
+ import "./chunk-CBANJFBO.js";
40
+ import "./chunk-PWXII6HF.js";
41
+ export {
42
+ COMPUTER_OFF,
43
+ COMPUTER_TUNABLES,
44
+ HOME_EGRESS,
45
+ addEgress,
46
+ browserDisplay,
47
+ browserProvider,
48
+ captchaSolvingAllowed,
49
+ computerEnabled,
50
+ computerEnabledSync,
51
+ computerSettingsPath,
52
+ computerTunable,
53
+ computerTunableList,
54
+ egressList,
55
+ egressProblem,
56
+ egressSetting,
57
+ generatedPasswordsAllowed,
58
+ headlessSetting,
59
+ parseBrowserDisplay,
60
+ parseEgress,
61
+ removeEgress,
62
+ setBrowserDisplay,
63
+ setBrowserProvider,
64
+ setCaptchaSolving,
65
+ setComputerEnabled,
66
+ setComputerTunable,
67
+ setGeneratedPasswords,
68
+ setHeadless,
69
+ setUnattended,
70
+ unattendedEnabled
71
+ };