clikcode 1.0.3 → 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 +498 -112593
  319. package/dist/computer-tools.js +36642 -21258
  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,133 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ GATEWAY_LABEL,
5
+ isClikCodeAgent
6
+ } from "./chunk-CRUVYGO2.js";
7
+ import {
8
+ canonicalRecord
9
+ } from "./chunk-FF7ZVYJF.js";
10
+ import {
11
+ localHarnessForCommand
12
+ } from "./chunk-KYUHIFP3.js";
13
+ import {
14
+ tildePath
15
+ } from "./chunk-EE4B6A7W.js";
16
+
17
+ // src/session/conversation-summary.ts
18
+ import { createHash } from "node:crypto";
19
+ function turnsHash(turns, through) {
20
+ const hash = createHash("sha256");
21
+ for (const turn of turns.slice(0, through)) hash.update(turn.user).update("\0").update(turn.assistant).update("");
22
+ return hash.digest("hex").slice(0, 32);
23
+ }
24
+ function validSummary(summary, record) {
25
+ if (!summary?.text.trim() || summary.through < 1 || summary.through > record.turns.length) return void 0;
26
+ return turnsHash(record.turns, summary.through) === summary.hash ? summary : void 0;
27
+ }
28
+ var CLAUDE_PREAMBLE = /^This session is being continued from a previous conversation[^\n]*\n(?:[^\n]*\n)*?\s*Summary:\s*\n/;
29
+ var CLAUDE_TAILS = [
30
+ "\n\nIf you need specific details from before compaction",
31
+ "\n\nPlease continue the conversation from where",
32
+ "\n\nContinue the conversation from where it left off"
33
+ ];
34
+ function claudeSummaryText(content) {
35
+ let text = content.replace(CLAUDE_PREAMBLE, "");
36
+ for (const tail of CLAUDE_TAILS) {
37
+ const at = text.indexOf(tail);
38
+ if (at > 0) text = text.slice(0, at);
39
+ }
40
+ return text.trim();
41
+ }
42
+ function jsonLines(text) {
43
+ return text.split("\n").flatMap((line) => {
44
+ if (!line.trim()) return [];
45
+ try {
46
+ const value = JSON.parse(line);
47
+ return value && typeof value === "object" ? [value] : [];
48
+ } catch {
49
+ return [];
50
+ }
51
+ });
52
+ }
53
+ var blockText = (content, kind = "type", field = "text") => typeof content === "string" ? content : Array.isArray(content) ? content.flatMap((block) => {
54
+ const entry = block;
55
+ return entry?.[kind] === "text" && typeof entry[field] === "string" ? [entry[field]] : [];
56
+ }).join("\n") : "";
57
+ function grokThreadCompaction(jsonl) {
58
+ let text;
59
+ const prompts = [];
60
+ for (const row of jsonLines(jsonl)) {
61
+ if (row.type !== "user") continue;
62
+ const content = blockText(row.content);
63
+ if (row.synthetic_reason === "compaction_meta") {
64
+ if (CLAUDE_PREAMBLE.test(content)) text = claudeSummaryText(content) || text;
65
+ } else if (row.synthetic_reason === void 0 && content.trim()) {
66
+ prompts.push(content.replace(/^\s*<user_query>\s*/, "").replace(/\s*<\/user_query>\s*$/, ""));
67
+ }
68
+ }
69
+ return text ? { text, prompts } : void 0;
70
+ }
71
+ function kiroThreadCompaction(jsonl) {
72
+ let found;
73
+ for (const row of jsonLines(jsonl)) {
74
+ const data = row.data;
75
+ if (row.kind === "Compaction" && typeof data?.summary === "string" && data.summary.trim()) found = { text: data.summary.trim(), prompts: [] };
76
+ else if (found && row.kind === "Prompt") {
77
+ const content = blockText(data?.content, "kind", "data");
78
+ if (content.trim()) found.prompts.push(content);
79
+ }
80
+ }
81
+ return found;
82
+ }
83
+ function copilotThreadCompaction(jsonl) {
84
+ let found;
85
+ for (const row of jsonLines(jsonl)) {
86
+ const data = row.data;
87
+ if (row.type === "session.compaction_complete" && data?.success !== false && typeof data?.summaryContent === "string" && data.summaryContent.trim()) {
88
+ found = { text: data.summaryContent.trim(), prompts: [] };
89
+ } else if (found && row.type === "user.message" && typeof data?.content === "string" && data.content.trim()) {
90
+ found.prompts.push(data.content);
91
+ }
92
+ }
93
+ return found;
94
+ }
95
+ var THREAD_READERS = {
96
+ grok: { read: grokThreadCompaction, file: "chat_history.jsonl" },
97
+ kiro: { read: kiroThreadCompaction },
98
+ copilot: { read: copilotThreadCompaction, file: "events.jsonl" }
99
+ };
100
+ function readsVendorCompaction(command) {
101
+ return command === "claude" || command in THREAD_READERS;
102
+ }
103
+ function summaryHeadline(summary) {
104
+ return `first ${summary.through} turn${summary.through === 1 ? "" : "s"} summarized`;
105
+ }
106
+ function shownSummary(session) {
107
+ return session.summary ? validSummary(session.summary, canonicalRecord(session)) : void 0;
108
+ }
109
+ function listedSummary(session) {
110
+ const summary = session.summary;
111
+ if (!summary?.text.trim() || summary.through < 1) return void 0;
112
+ return session.listMessageCount === void 0 || summary.through <= session.listMessageCount ? summary : void 0;
113
+ }
114
+
115
+ // src/harness/protocol/labels.ts
116
+ import { homedir } from "node:os";
117
+ function compactPath(path) {
118
+ return tildePath(path, homedir());
119
+ }
120
+ function sessionProviderLabel(session) {
121
+ if (isClikCodeAgent(session)) return GATEWAY_LABEL;
122
+ const harness = session.nativeHarness ? localHarnessForCommand(session.nativeHarness) : void 0;
123
+ return harness?.displayName ?? session.provider ?? "Not selected";
124
+ }
125
+
126
+ export {
127
+ readsVendorCompaction,
128
+ summaryHeadline,
129
+ shownSummary,
130
+ listedSummary,
131
+ compactPath,
132
+ sessionProviderLabel
133
+ };
@@ -0,0 +1,58 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ gatewayConnection
5
+ } from "./chunk-2OLS7V66.js";
6
+ import {
7
+ isGatewayService
8
+ } from "./chunk-CRUVYGO2.js";
9
+
10
+ // src/gateway/mcp.ts
11
+ var CLIKDEPLOY_MCP_SERVER = "clikdeploy";
12
+ var CLIKDEPLOY_CORE_TOOLS = [
13
+ "meta_read",
14
+ "list_apps",
15
+ "get_app",
16
+ "get_app_logs",
17
+ "list_deployments",
18
+ "get_deployment",
19
+ "deploy_app",
20
+ "restart_app",
21
+ "search_tools",
22
+ "call_tool"
23
+ ];
24
+ var CLIKDEPLOY_MCP_TURN_WAIT_MS = 3e3;
25
+ var PERMISSION_MODE_HEADER = "x-clikdeploy-permission-mode";
26
+ function clikDeployMcpServer(connection, adminMfaToken, permissionMode) {
27
+ return {
28
+ name: CLIKDEPLOY_MCP_SERVER,
29
+ transport: "http",
30
+ url: `${connection.baseUrl.replace(/\/+$/, "")}/mcp?toolmode=search`,
31
+ headers: {
32
+ authorization: `Bearer ${connection.apiKey}`,
33
+ ...adminMfaToken ? { "x-admin-mfa": adminMfaToken } : {},
34
+ ...permissionMode ? { [PERMISSION_MODE_HEADER]: permissionMode } : {}
35
+ },
36
+ core: CLIKDEPLOY_CORE_TOOLS,
37
+ // Its tools/list took the whole 30 s connect timeout in a harness
38
+ // benchmark run (bench/harness), and every Gateway turn waited for it
39
+ // before its first model step, coding turn or not. It answers in ~0.3 s
40
+ // when healthy; a slower start joins a later turn instead.
41
+ turnWaitMs: CLIKDEPLOY_MCP_TURN_WAIT_MS
42
+ };
43
+ }
44
+ function routeMcpServers(session, config, permissionMode = session.permissionMode) {
45
+ if (!isGatewayService(session)) return [];
46
+ try {
47
+ const token = typeof config.get === "function" ? config.get("adminMfaToken") : void 0;
48
+ return [clikDeployMcpServer(gatewayConnection(config), typeof token === "string" ? token : void 0, permissionMode)];
49
+ } catch {
50
+ return [];
51
+ }
52
+ }
53
+
54
+ export {
55
+ CLIKDEPLOY_CORE_TOOLS,
56
+ PERMISSION_MODE_HEADER,
57
+ routeMcpServers
58
+ };
@@ -0,0 +1,79 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ stateDirectory
5
+ } from "./chunk-MPAJ446F.js";
6
+
7
+ // src/harness/transport/native/install-locations.ts
8
+ import { homedir } from "node:os";
9
+ import { join } from "node:path";
10
+ function managedNpmPrefix() {
11
+ return join(stateDirectory(), "tools", "npm");
12
+ }
13
+ function npmPrefixBinDir(prefix, platform = process.platform) {
14
+ return platform === "win32" ? prefix : join(prefix, "bin");
15
+ }
16
+ function installStepFor(installer, platform = process.platform) {
17
+ return platform === "win32" ? installer?.windows : installer?.posix;
18
+ }
19
+ function expandInstallDir(dir, env = process.env, home = homedir()) {
20
+ let unresolved = false;
21
+ const expanded = dir.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => {
22
+ const value = env[name] ?? Object.entries(env).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
23
+ if (!value) unresolved = true;
24
+ return value ?? "";
25
+ });
26
+ if (unresolved) return void 0;
27
+ if (expanded === "~") return home;
28
+ if (expanded.startsWith("~/")) return join(home, expanded.slice(2));
29
+ return expanded;
30
+ }
31
+ function harnessInstallDirs(harnesses, options = {}) {
32
+ const platform = options.platform ?? process.platform;
33
+ const dirs = /* @__PURE__ */ new Set();
34
+ for (const harness of harnesses) {
35
+ for (const dir of installStepFor(harness.installer, platform)?.binDirs ?? []) {
36
+ const expanded = expandInstallDir(dir, options.env, options.home);
37
+ if (expanded) dirs.add(expanded);
38
+ }
39
+ }
40
+ dirs.add(npmPrefixBinDir(managedNpmPrefix(), platform));
41
+ return [...dirs];
42
+ }
43
+ function pathKey(env) {
44
+ return Object.keys(env).find((key) => key.toUpperCase() === "PATH") ?? "PATH";
45
+ }
46
+ function withPathDirs(pathValue, dirs, platform = process.platform) {
47
+ const separator = platform === "win32" ? ";" : ":";
48
+ const normalize = (dir) => {
49
+ const trimmed = dir.replace(/^"|"$/g, "").replace(/[\\/]+$/, "");
50
+ return platform === "win32" ? trimmed.toLowerCase() : trimmed;
51
+ };
52
+ const entries = pathValue ? pathValue.split(separator) : [];
53
+ const present = new Set(entries.map(normalize));
54
+ for (const dir of dirs) {
55
+ if (!dir || present.has(normalize(dir))) continue;
56
+ entries.push(dir);
57
+ present.add(normalize(dir));
58
+ }
59
+ return entries.join(separator);
60
+ }
61
+ function addToProcessPath(dirs, env = process.env, platform = process.platform) {
62
+ const key = pathKey(env);
63
+ env[key] = withPathDirs(env[key] ?? "", dirs, platform);
64
+ }
65
+ var augmented = false;
66
+ function augmentProcessPath(harnesses) {
67
+ if (augmented) return;
68
+ augmented = true;
69
+ addToProcessPath(harnessInstallDirs(harnesses));
70
+ }
71
+
72
+ export {
73
+ managedNpmPrefix,
74
+ npmPrefixBinDir,
75
+ installStepFor,
76
+ expandInstallDir,
77
+ addToProcessPath,
78
+ augmentProcessPath
79
+ };
@@ -0,0 +1,135 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ claudeProjectDirectoryNames
5
+ } from "./chunk-CERF3RIB.js";
6
+ import {
7
+ normalizeActivityEvent,
8
+ thoughtLabel,
9
+ toolCall,
10
+ toolFacts
11
+ } from "./chunk-3B2CHX7M.js";
12
+ import {
13
+ mergeActivity
14
+ } from "./chunk-XKW5NDMR.js";
15
+ import {
16
+ quiet
17
+ } from "./chunk-RDDWQBEM.js";
18
+
19
+ // src/harness/subagent-read.ts
20
+ import { readFile, readdir } from "node:fs/promises";
21
+ import { homedir } from "node:os";
22
+ import { join } from "node:path";
23
+ var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
24
+ var Rows = class {
25
+ rows = [];
26
+ at = /* @__PURE__ */ new Map();
27
+ prompt(text) {
28
+ if (text.trim() && !this.rows.some((row) => row.kind === "prompt")) this.rows.push({ kind: "prompt", text: text.trim() });
29
+ }
30
+ text(text) {
31
+ if (!text.trim()) return;
32
+ const last = this.rows[this.rows.length - 1];
33
+ if (last?.kind === "text") last.text += text;
34
+ else this.rows.push({ kind: "text", text });
35
+ }
36
+ activity(event, thought) {
37
+ const normalized = normalizeActivityEvent(event);
38
+ const index = normalized.id ? this.at.get(normalized.id) : void 0;
39
+ if (index !== void 0) {
40
+ const prior = this.rows[index];
41
+ this.rows[index] = { kind: "activity", event: mergeActivity(prior.event, normalized) };
42
+ return;
43
+ }
44
+ if (normalized.id) this.at.set(normalized.id, this.rows.length);
45
+ this.rows.push({ kind: "activity", event: normalized, ...thought ? { thought } : {} });
46
+ }
47
+ };
48
+ var textOf = (content) => {
49
+ if (typeof content === "string") return content;
50
+ if (!Array.isArray(content)) return "";
51
+ return content.map((part) => {
52
+ const block = record(part);
53
+ return block?.type === "text" && typeof block.text === "string" ? block.text : "";
54
+ }).join("");
55
+ };
56
+ function claudeTranscriptRows(jsonl) {
57
+ const rows = new Rows();
58
+ for (const line of jsonl.split("\n")) {
59
+ if (!line.trim()) continue;
60
+ let value;
61
+ try {
62
+ value = record(JSON.parse(line));
63
+ } catch {
64
+ continue;
65
+ }
66
+ const message = record(value?.message);
67
+ const content = message?.content;
68
+ if (value?.type === "user") {
69
+ if (typeof content === "string") {
70
+ rows.prompt(content);
71
+ continue;
72
+ }
73
+ if (!Array.isArray(content)) continue;
74
+ for (const part of content) {
75
+ const block = record(part);
76
+ if (block?.type === "text" && typeof block.text === "string") rows.prompt(block.text);
77
+ if (block?.type !== "tool_result") continue;
78
+ const output = textOf(block.content).split("\n").filter(Boolean);
79
+ rows.activity({
80
+ kind: block.is_error === true ? "tool-error" : "tool-done",
81
+ label: "tool",
82
+ ...typeof block.tool_use_id === "string" ? { id: block.tool_use_id } : {},
83
+ ...output.length ? { output } : {}
84
+ });
85
+ }
86
+ } else if (value?.type === "assistant" && Array.isArray(content)) {
87
+ for (const part of content) {
88
+ const block = record(part);
89
+ if (block?.type === "text" && typeof block.text === "string") rows.text(block.text);
90
+ else if (block?.type === "thinking" && typeof block.thinking === "string" && block.thinking.trim()) rows.activity({ kind: "thinking", label: thoughtLabel(block.thinking), id: `thinking:${String(message?.id ?? rows.rows.length)}:${rows.rows.length}` }, block.thinking.trim());
91
+ else if (block?.type === "tool_use") {
92
+ const name = String(block.name ?? "tool");
93
+ rows.activity({ kind: "tool-start", ...toolFacts(name, record(block.input), ""), call: toolCall(name, record(block.input)), ...typeof block.id === "string" ? { id: block.id } : {} });
94
+ }
95
+ }
96
+ }
97
+ }
98
+ return rows.rows;
99
+ }
100
+ function claudeSubagentDirs(workspace, sessionId, profile) {
101
+ const root = join(profile?.trim() || process.env.CLAUDE_CONFIG_DIR?.trim() || join(homedir(), ".claude"), "projects");
102
+ return claudeProjectDirectoryNames(workspace).map((name) => join(root, name, sessionId, "subagents"));
103
+ }
104
+ async function findClaudeSubagent(workspace, sessionId, parentCallId, profile) {
105
+ for (const dir of claudeSubagentDirs(workspace, sessionId, profile)) {
106
+ const names = await readdir(dir).catch(() => []);
107
+ for (const name of names.filter((entry) => entry.endsWith(".meta.json"))) {
108
+ const meta = record(await readFile(join(dir, name), "utf8").then(JSON.parse).catch(quiet("harness/subagent-read")));
109
+ if (meta?.toolUseId !== parentCallId) continue;
110
+ const stem = name.slice(0, -".meta.json".length);
111
+ return {
112
+ agentId: stem.replace(/^agent-/, ""),
113
+ file: join(dir, `${stem}.jsonl`),
114
+ ...typeof meta.agentType === "string" ? { agentType: meta.agentType } : {},
115
+ ...typeof meta.description === "string" ? { description: meta.description } : {}
116
+ };
117
+ }
118
+ }
119
+ return void 0;
120
+ }
121
+ async function readClaudeSubagent(workspace, sessionId, parentCallId, profile) {
122
+ const found = await findClaudeSubagent(workspace, sessionId, parentCallId, profile);
123
+ const text = found ? await readFile(found.file, "utf8").catch(quiet("harness/subagent-read")) : void 0;
124
+ return found && text !== void 0 ? { agentId: found.agentId, rows: claudeTranscriptRows(text) } : void 0;
125
+ }
126
+ function liveSubAgentRows(events, parentId) {
127
+ const rows = new Rows();
128
+ for (const event of events) if (event.parentId === parentId) rows.activity(event);
129
+ return rows.rows;
130
+ }
131
+
132
+ export {
133
+ readClaudeSubagent,
134
+ liveSubAgentRows
135
+ };
@@ -0,0 +1,95 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ gatewayConnection
5
+ } from "./chunk-2OLS7V66.js";
6
+ import {
7
+ CLIKCODE_USER_AGENT
8
+ } from "./chunk-NAOX3JUB.js";
9
+ import {
10
+ Conf
11
+ } from "./chunk-GGYKY4GF.js";
12
+ import {
13
+ quiet
14
+ } from "./chunk-RDDWQBEM.js";
15
+
16
+ // src/gateway/own-models.ts
17
+ var ALWAYS_START_OWN_MODELS = "gateway.alwaysStartOwnModels";
18
+ function alwaysStartOwnModels(config = new Conf({ projectName: "clikcode", configFileMode: 384 })) {
19
+ return config.get(ALWAYS_START_OWN_MODELS) === true;
20
+ }
21
+ function setAlwaysStartOwnModels(enabled, config = new Conf({ projectName: "clikcode", configFileMode: 384 })) {
22
+ config.set(ALWAYS_START_OWN_MODELS, enabled);
23
+ }
24
+ async function gatewayCall(path, init, options = {}) {
25
+ const config = options.config ?? new Conf({ projectName: "clikcode", configFileMode: 384 });
26
+ const { baseUrl, apiKey } = gatewayConnection(config);
27
+ const response = await (options.fetchImpl ?? fetch)(`${baseUrl}${path}`, {
28
+ method: init.method,
29
+ headers: {
30
+ authorization: `Bearer ${apiKey}`,
31
+ accept: "application/json",
32
+ "user-agent": CLIKCODE_USER_AGENT,
33
+ ...init.body !== void 0 ? { "content-type": "application/json" } : {}
34
+ },
35
+ ...init.body !== void 0 ? { body: JSON.stringify(init.body) } : {},
36
+ signal: AbortSignal.timeout(options.timeoutMs ?? 15e3)
37
+ });
38
+ const body = await response.json().catch(quiet("gateway/own-models"));
39
+ return { ok: response.ok, status: response.status, body };
40
+ }
41
+ function gatewayError(what, result) {
42
+ const error = result.body?.error;
43
+ return new Error(`ClikDeploy Gateway ${what}: ${typeof error?.message === "string" ? error.message : `HTTP ${result.status}`}`);
44
+ }
45
+ function startOf(raw) {
46
+ const value = raw;
47
+ if (value?.phase === "finding-server") return { phase: "finding-server" };
48
+ if (value?.phase !== "starting-model" || typeof value.elapsedS !== "number") return void 0;
49
+ const number = (n) => typeof n === "number" && Number.isFinite(n) && n >= 0;
50
+ return {
51
+ phase: "starting-model",
52
+ elapsedS: value.elapsedS,
53
+ ...number(value.expectedS) ? { expectedS: value.expectedS } : {},
54
+ ...number(value.remainingS) ? { remainingS: value.remainingS } : {},
55
+ ...value.overdue === true ? { overdue: true } : {}
56
+ };
57
+ }
58
+ async function ownModelStatus(model, options = {}) {
59
+ const result = await gatewayCall("/v1/models/wake", { method: "POST", body: { model } }, options);
60
+ const data = result.body?.data;
61
+ if (!result.ok || data?.state !== "running" && data?.state !== "starting") throw gatewayError("wake", result);
62
+ const start = data.state === "starting" ? startOf(data.start) : void 0;
63
+ return { state: data.state, ...start ? { start } : {} };
64
+ }
65
+ async function wakeOwnModel(model, options = {}) {
66
+ return (await ownModelStatus(model, options)).state;
67
+ }
68
+ async function ownModelIdleMinutes(options = {}) {
69
+ const result = await gatewayCall("/v1/settings", { method: "GET" }, options);
70
+ const minutes = result.body?.data?.model_idle_minutes;
71
+ if (!result.ok || typeof minutes !== "number") throw gatewayError("settings", result);
72
+ return minutes;
73
+ }
74
+ async function setOwnModelIdleMinutes(minutes, options = {}) {
75
+ const result = await gatewayCall("/v1/settings", { method: "PATCH", body: { model_idle_minutes: minutes } }, options);
76
+ const stored = result.body?.data?.model_idle_minutes;
77
+ if (!result.ok || typeof stored !== "number") throw gatewayError("settings", result);
78
+ return stored;
79
+ }
80
+ var OWN_MODEL_IDLE_CHOICES = [5, 15, 30, 60, 240, 0];
81
+ function idleWords(minutes) {
82
+ if (!minutes) return "never";
83
+ return minutes % 60 === 0 ? `${minutes / 60} hr` : `${minutes} min`;
84
+ }
85
+
86
+ export {
87
+ alwaysStartOwnModels,
88
+ setAlwaysStartOwnModels,
89
+ ownModelStatus,
90
+ wakeOwnModel,
91
+ ownModelIdleMinutes,
92
+ setOwnModelIdleMinutes,
93
+ OWN_MODEL_IDLE_CHOICES,
94
+ idleWords
95
+ };