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,151 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ readTurnActivities
5
+ } from "./chunk-3B2CHX7M.js";
6
+ import {
7
+ ConversationLogMissingError,
8
+ readSessionTranscript,
9
+ transcriptIdentity
10
+ } from "./chunk-RVUOIJXN.js";
11
+ import {
12
+ sessionFilePath
13
+ } from "./chunk-MPAJ446F.js";
14
+
15
+ // src/search/corpus.ts
16
+ function activityText(event, outputLines = Number.POSITIVE_INFINITY) {
17
+ const status = event.kind === "tool-error" ? " (failed)" : event.kind === "tool-start" ? " (not finished)" : "";
18
+ const output = (event.output ?? []).slice(0, outputLines).map((line) => ` ${line}`);
19
+ return [` \u23FA ${event.label}${status}`, ...output].join("\n");
20
+ }
21
+ function fingerprintOf(role, text) {
22
+ let hash = 2166136261;
23
+ for (let index = 0; index < text.length; index += 1) {
24
+ hash ^= text.charCodeAt(index);
25
+ hash = Math.imul(hash, 16777619);
26
+ }
27
+ return `${role}:${text.length}:${(hash >>> 0).toString(36)}`;
28
+ }
29
+ function messageDoc(message) {
30
+ const content = message.content ?? "";
31
+ const calls = message.role === "assistant" ? readTurnActivities(message.activities, content.length) : [];
32
+ const text = calls.length ? `${content}
33
+ ${calls.map((activity) => activityText(activity.event)).join("\n")}` : content;
34
+ return { role: message.role, text, contentLength: content.length, fingerprint: fingerprintOf(message.role, text) };
35
+ }
36
+ var escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
37
+ var wordPatterns = /* @__PURE__ */ new Map();
38
+ function indexOfWord(text, word, from = 0) {
39
+ let pattern = wordPatterns.get(word);
40
+ if (!pattern) {
41
+ if (wordPatterns.size >= 256) wordPatterns.clear();
42
+ pattern = new RegExp(escapeRegExp(word), "gi");
43
+ wordPatterns.set(word, pattern);
44
+ }
45
+ pattern.lastIndex = from;
46
+ return pattern.exec(text)?.index ?? -1;
47
+ }
48
+ var cache = /* @__PURE__ */ new Map();
49
+ var cacheChars = 32 * 1024 * 1024;
50
+ var cachedChars = 0;
51
+ var MAX_VIEWS = 32;
52
+ function uncache(path) {
53
+ const entry = cache.get(path);
54
+ if (!entry) return;
55
+ cache.delete(path);
56
+ cachedChars -= entry.chars;
57
+ }
58
+ function remember(path, entry) {
59
+ uncache(path);
60
+ cache.set(path, entry);
61
+ cachedChars += entry.chars;
62
+ for (const [oldest] of cache) {
63
+ if (cachedChars <= cacheChars || oldest === path) break;
64
+ uncache(oldest);
65
+ }
66
+ }
67
+ var STATS = { builds: 0 };
68
+ async function sessionDoc(id) {
69
+ const path = sessionFilePath(id);
70
+ const cached = cache.get(path);
71
+ const key = await transcriptIdentity(id);
72
+ if (cached && key !== void 0 && key === cached.key) {
73
+ remember(path, cached);
74
+ return cached.doc;
75
+ }
76
+ if (key === void 0) {
77
+ uncache(path);
78
+ return void 0;
79
+ }
80
+ const transcript = await readSessionTranscript(id).catch((error) => {
81
+ if (error instanceof ConversationLogMissingError) return void 0;
82
+ throw error;
83
+ });
84
+ if (!transcript) {
85
+ uncache(path);
86
+ return void 0;
87
+ }
88
+ STATS.builds += 1;
89
+ const doc = { id, messages: (transcript.messages ?? []).map(messageDoc) };
90
+ remember(path, { key, doc, chars: doc.messages.reduce((sum, message) => sum + message.text.length, 0) });
91
+ return doc;
92
+ }
93
+ var views = /* @__PURE__ */ new Map();
94
+ function sharedPrefix(left, right) {
95
+ const limit = Math.min(left.length, right.length);
96
+ let index = 0;
97
+ while (index < limit && left[index].fingerprint === right[index].fingerprint) index += 1;
98
+ return index;
99
+ }
100
+ function buildView(branches) {
101
+ const entries = [];
102
+ const positions = /* @__PURE__ */ new Map();
103
+ const placed = [];
104
+ let mainLength = 0;
105
+ for (const { id, doc } of branches) {
106
+ if (!doc) continue;
107
+ const messages = doc.messages;
108
+ let shared = 0;
109
+ let from = [];
110
+ for (const other of placed) {
111
+ const length = sharedPrefix(other.messages, messages);
112
+ if (length > shared) {
113
+ shared = length;
114
+ from = other.at;
115
+ }
116
+ }
117
+ const at = from.slice(0, shared);
118
+ for (let index = shared; index < messages.length; index += 1) {
119
+ at.push(entries.length);
120
+ entries.push({ sessionId: id, index, message: messages[index], ...placed.length && index === shared ? { forkAfter: shared ? from[shared - 1] : -1 } : {} });
121
+ }
122
+ if (!placed.length) mainLength = entries.length;
123
+ placed.push({ messages, at });
124
+ positions.set(id, at);
125
+ }
126
+ return { entries, mainLength, positions };
127
+ }
128
+ async function conversationView(group) {
129
+ const docs = await Promise.all(group.branches.map((branch) => sessionDoc(branch.id)));
130
+ const key = sessionFilePath(group.id);
131
+ const ids = group.branches.map((branch) => branch.id).join(",");
132
+ const cached = views.get(key);
133
+ views.delete(key);
134
+ if (cached?.ids === ids && cached.docs.every((doc, index) => doc === docs[index])) {
135
+ views.set(key, cached);
136
+ return cached.view;
137
+ }
138
+ const view = buildView(group.branches.map((branch, index) => ({ id: branch.id, doc: docs[index] })));
139
+ views.set(key, { ids, docs, view });
140
+ for (const [oldest] of views) {
141
+ if (views.size <= MAX_VIEWS) break;
142
+ views.delete(oldest);
143
+ }
144
+ return view;
145
+ }
146
+
147
+ export {
148
+ indexOfWord,
149
+ sessionDoc,
150
+ conversationView
151
+ };
@@ -0,0 +1,31 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ LOCK_TUNING,
5
+ breakStaleLock,
6
+ fileLocksHeld,
7
+ fileLocksIdle,
8
+ lockLooksStale,
9
+ pidIsAlive,
10
+ tryLease,
11
+ withFileLock,
12
+ withStateLock,
13
+ writeOwnerFile
14
+ } from "./chunk-4L2ZZM4Q.js";
15
+ import "./chunk-F6F47QAY.js";
16
+ import "./chunk-RDDWQBEM.js";
17
+ import "./chunk-MPAJ446F.js";
18
+ import "./chunk-CBANJFBO.js";
19
+ import "./chunk-PWXII6HF.js";
20
+ export {
21
+ LOCK_TUNING,
22
+ breakStaleLock,
23
+ fileLocksHeld,
24
+ fileLocksIdle,
25
+ lockLooksStale,
26
+ pidIsAlive,
27
+ tryLease,
28
+ withFileLock,
29
+ withStateLock,
30
+ writeOwnerFile
31
+ };
@@ -0,0 +1,150 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ conversationView,
5
+ indexOfWord
6
+ } from "./chunk-WM3Z6QKQ.js";
7
+ import {
8
+ normalizedStatus
9
+ } from "./chunk-BISGNHKD.js";
10
+ import {
11
+ loadIndex
12
+ } from "./chunk-XCKQ5BM2.js";
13
+ import {
14
+ groupByConversation
15
+ } from "./chunk-BUOPJQP5.js";
16
+
17
+ // src/search/conversations.ts
18
+ var timestamp = (value) => {
19
+ const at = Date.parse(value ?? "");
20
+ return Number.isNaN(at) ? Number.NEGATIVE_INFINITY : at;
21
+ };
22
+ function conversationTitle(session, limit = 60) {
23
+ const raw = session.name?.trim() || session.listPreview?.trim() || "";
24
+ const line = raw.replace(/\s+/g, " ");
25
+ if (!line) return "(untitled)";
26
+ return line.length > limit ? `${line.slice(0, limit - 1)}\u2026` : line;
27
+ }
28
+ async function conversationGroups() {
29
+ const index = await loadIndex();
30
+ const sessions = index?.sessions ?? [];
31
+ const groups = groupByConversation(sessions.map((session) => ({ ...session, ...normalizedStatus(session) })));
32
+ return [...groups].map(([id, branches]) => {
33
+ branches.sort((left, right) => timestamp(right.updatedAt) - timestamp(left.updatedAt));
34
+ return { id, branches, newest: branches[0], updatedAtMs: timestamp(branches[0].updatedAt) };
35
+ });
36
+ }
37
+ function findConversation(groups, id) {
38
+ const wanted = id.trim().toLowerCase();
39
+ if (wanted.length < 6) return void 0;
40
+ for (const group of groups) {
41
+ if (group.id.toLowerCase() === wanted) return { group };
42
+ const branch = group.branches.find((session) => session.id.toLowerCase() === wanted);
43
+ if (branch) return { group, branch };
44
+ }
45
+ const matches = [];
46
+ for (const group of groups) {
47
+ if (group.id.toLowerCase().startsWith(wanted)) {
48
+ matches.push({ group });
49
+ continue;
50
+ }
51
+ const branch = group.branches.find((session) => session.id.toLowerCase().startsWith(wanted));
52
+ if (branch) matches.push({ group, branch });
53
+ }
54
+ return matches.length === 1 ? matches[0] : void 0;
55
+ }
56
+
57
+ // src/search/engine.ts
58
+ var escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
59
+ function parseQuery(text) {
60
+ const cleaned = text.trim().replace(/^["']|["']$/g, "").trim();
61
+ const words = [...new Set(cleaned.toLowerCase().split(/\s+/).filter(Boolean))];
62
+ if (!words.length) return void 0;
63
+ const ordered = cleaned.toLowerCase().split(/\s+/).filter(Boolean);
64
+ return { text: cleaned, words, phrase: new RegExp(ordered.map(escapeRegExp).join("[\\s_-]+"), "gi") };
65
+ }
66
+ function parseSince(value, now = Date.now()) {
67
+ if (!value?.trim()) return void 0;
68
+ const relative = /^(\d+(?:\.\d+)?)\s*(m|min|h|hr|d|day|days|w|wk|weeks?)$/i.exec(value.trim());
69
+ if (relative) {
70
+ const unit = relative[2].toLowerCase()[0];
71
+ const ms = unit === "m" ? 6e4 : unit === "h" ? 36e5 : unit === "d" ? 864e5 : 7 * 864e5;
72
+ return now - Number(relative[1]) * ms;
73
+ }
74
+ const at = Date.parse(value);
75
+ return Number.isNaN(at) ? void 0 : at;
76
+ }
77
+ function recencyBoost(updatedAtMs, now) {
78
+ if (!Number.isFinite(updatedAtMs)) return 1;
79
+ const days = Math.max(0, now - updatedAtMs) / 864e5;
80
+ return 1 + 1.5 * 0.5 ** (days / 7);
81
+ }
82
+ function messageMentions(message, query) {
83
+ const found = [];
84
+ const phrase = query.phrase;
85
+ phrase.lastIndex = 0;
86
+ for (let match = phrase.exec(message.text); match; match = phrase.exec(message.text)) {
87
+ found.push({ offset: match.index, length: match[0].length, exact: true });
88
+ if (match[0].length === 0) phrase.lastIndex += 1;
89
+ }
90
+ if (found.length || query.words.length < 2) return found;
91
+ if (!query.words.every((word) => indexOfWord(message.text, word) >= 0)) return found;
92
+ const first = query.words[0];
93
+ return [{ offset: indexOfWord(message.text, first), length: first.length, exact: false }];
94
+ }
95
+ function titleMatch(title, query) {
96
+ const lower = title.trim().replace(/\s+/g, " ").toLowerCase();
97
+ if (!lower) return void 0;
98
+ if (new RegExp(`^${query.phrase.source}$`).test(lower)) return "exact";
99
+ return query.words.every((word) => lower.includes(word)) ? "words" : void 0;
100
+ }
101
+ var TITLE_TIER = { exact: 3e6, words: 2e6 };
102
+ async function conversationHit(group, query, now) {
103
+ const view = await conversationView(group);
104
+ let mentions = [];
105
+ for (const [position, entry] of view.entries.entries()) {
106
+ for (const mention of messageMentions(entry.message, query)) mentions.push({ sessionId: entry.sessionId, messageIndex: entry.index, position, ...mention });
107
+ }
108
+ const exactCount = mentions.filter((mention) => mention.exact).length;
109
+ if (exactCount) mentions = mentions.filter((mention) => mention.exact);
110
+ const newest = group.newest;
111
+ const named = titleMatch(conversationTitle(newest, Number.POSITIVE_INFINITY), query);
112
+ if (!mentions.length && !named) return void 0;
113
+ const score = (named ? TITLE_TIER[named] : 0) + (exactCount ? 1e6 : 0) + (exactCount ? exactCount * 3 : mentions.length) * recencyBoost(group.updatedAtMs, now);
114
+ return {
115
+ conversationId: group.id,
116
+ sessionId: newest.id,
117
+ title: conversationTitle(newest),
118
+ provider: newest.provider ?? null,
119
+ model: newest.model ?? null,
120
+ ...newest.nativeHarness ? { harness: newest.nativeHarness } : {},
121
+ updatedAt: newest.updatedAt,
122
+ updatedAtMs: group.updatedAtMs,
123
+ mentions,
124
+ exactCount,
125
+ ...named ? { titleMatch: named } : {},
126
+ score
127
+ };
128
+ }
129
+ async function searchConversations(text, options = {}) {
130
+ const query = parseQuery(text);
131
+ if (!query) return void 0;
132
+ const now = options.now ?? Date.now();
133
+ const groups = (await conversationGroups()).filter((group) => (options.conversationId === void 0 || group.id === options.conversationId) && group.id !== options.excludeConversationId && !group.branches.some((branch) => branch.id === options.excludeSessionId) && (options.sinceMs === void 0 || group.updatedAtMs >= options.sinceMs));
134
+ const hits = [];
135
+ const found = await Promise.all(groups.map((group) => conversationHit(group, query, now)));
136
+ for (const hit of found) if (hit) hits.push(hit);
137
+ hits.sort((left, right) => right.score - left.score || right.updatedAtMs - left.updatedAtMs);
138
+ return { query, hits, searched: groups.length };
139
+ }
140
+
141
+ export {
142
+ conversationTitle,
143
+ conversationGroups,
144
+ findConversation,
145
+ parseQuery,
146
+ parseSince,
147
+ recencyBoost,
148
+ titleMatch,
149
+ searchConversations
150
+ };
@@ -0,0 +1,60 @@
1
+ import { createRequire as __clikcodeCreateRequire } from 'node:module';
2
+ const require = __clikcodeCreateRequire(import.meta.url);
3
+ import {
4
+ startConsent
5
+ } from "./chunk-25T3GVS7.js";
6
+ import {
7
+ quiet
8
+ } from "./chunk-RDDWQBEM.js";
9
+
10
+ // src/agent/computer/email-consent.ts
11
+ async function stuckOn(page) {
12
+ try {
13
+ const url = new URL(page.url());
14
+ const names = await page.locator("button:visible, [role=button]:visible, a:visible, [role=link]:visible").evaluateAll((nodes) => nodes.slice(0, 40).map((n) => (n.textContent ?? "").replace(/\s+/g, " ").trim()).filter((t) => t && t.length < 60));
15
+ return `The browser is on ${url.host}${url.pathname}; it shows: ${[...new Set(names)].slice(0, 10).join(" | ") || "nothing to press"}.`;
16
+ } catch {
17
+ return "";
18
+ }
19
+ }
20
+ async function connectEmail(stateDir, page, options = {}) {
21
+ const consent = await startConsent(stateDir, { loginHint: options.email, endpoints: options.endpoints, timeoutMs: options.timeoutMs });
22
+ let finished = false;
23
+ consent.done.then(() => {
24
+ finished = true;
25
+ }, () => {
26
+ finished = true;
27
+ });
28
+ await page.goto(consent.url, { waitUntil: "domcontentloaded", timeout: 3e4 }).catch(quiet("agent/computer/email-consent"));
29
+ const click = async (locator) => {
30
+ const shown = locator.filter({ visible: true });
31
+ if (!await shown.count().catch(() => 0)) return false;
32
+ return shown.first().click({ timeout: 3e3 }).then(() => true, () => false);
33
+ };
34
+ let chosen = "";
35
+ const steps = (async () => {
36
+ for (let i = 0; i < 90 && !finished; i++) {
37
+ if (page.isClosed()) return;
38
+ const url = page.url();
39
+ if (/^http:\/\/127\.0\.0\.1:\d+\/callback/.test(url)) return;
40
+ if (options.email && chosen !== url && await click(page.locator(`[data-identifier="${options.email}"]`))) {
41
+ chosen = url;
42
+ options.progress?.("Chose the account.\n");
43
+ } else if (await click(page.getByRole("link", { name: /go to .*\(unsafe\)/i }))) options.progress?.("Continued past the unverified-app notice.\n");
44
+ else if (await click(page.getByText(/^advanced$/i))) options.progress?.("");
45
+ else if (await click(page.getByRole("button", { name: /^(continue|allow)$/i }))) options.progress?.("Allowed read access to mail.\n");
46
+ await page.waitForTimeout(1e3).catch(quiet("agent/computer/email-consent"));
47
+ }
48
+ })();
49
+ try {
50
+ return await consent.done;
51
+ } catch (error) {
52
+ throw new Error(`${error.message} ${await stuckOn(page)}`);
53
+ } finally {
54
+ await steps.catch(quiet("agent/computer/email-consent"));
55
+ }
56
+ }
57
+
58
+ export {
59
+ connectEmail
60
+ };