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.
- package/README.md +25 -14
- package/dist/chunk-23TDEBGZ.js +71 -0
- package/dist/chunk-25T3GVS7.js +425 -0
- package/dist/chunk-2BBELGHY.js +11 -0
- package/dist/chunk-2EOL5PZL.js +208 -0
- package/dist/chunk-2GAB36IE.js +26 -0
- package/dist/chunk-2OLS7V66.js +2440 -0
- package/dist/chunk-2QFO2URB.js +179 -0
- package/dist/chunk-2QWPQRSU.js +254 -0
- package/dist/chunk-2YPAPAR3.js +184 -0
- package/dist/chunk-2ZAG5372.js +33 -0
- package/dist/chunk-32IKAIZC.js +12507 -0
- package/dist/chunk-34AZEGYW.js +95 -0
- package/dist/chunk-34JQYQCA.js +175 -0
- package/dist/chunk-34ZISPAO.js +67 -0
- package/dist/chunk-3AAAARE6.js +46 -0
- package/dist/chunk-3AJ6Q3OY.js +510 -0
- package/dist/chunk-3B2CHX7M.js +884 -0
- package/dist/chunk-3BUFORRX.js +59 -0
- package/dist/chunk-3QLHYYFK.js +30 -0
- package/dist/chunk-3RXBMYKZ.js +140 -0
- package/dist/chunk-3TFNIJWS.js +52 -0
- package/dist/chunk-3W3IPDFP.js +119 -0
- package/dist/chunk-3WMS7SEE.js +417 -0
- package/dist/chunk-435ZNSZ3.js +23 -0
- package/dist/chunk-4AQ5NINV.js +39 -0
- package/dist/chunk-4GVEJ5FK.js +168 -0
- package/dist/chunk-4GXAO3UY.js +262 -0
- package/dist/chunk-4L2ZZM4Q.js +332 -0
- package/dist/chunk-4LPDG57B.js +17 -0
- package/dist/chunk-4NN3XQQT.js +223 -0
- package/dist/chunk-4QZEZME7.js +54 -0
- package/dist/chunk-4R6CSC3S.js +38 -0
- package/dist/chunk-4RHXTL3W.js +514 -0
- package/dist/chunk-4SJMPTVQ.js +18 -0
- package/dist/chunk-4VY7G6TX.js +114 -0
- package/dist/chunk-5642PBF7.js +124 -0
- package/dist/chunk-5B6TVO4A.js +33 -0
- package/dist/chunk-5BJLDUPL.js +62 -0
- package/dist/chunk-5HMFFJWU.js +19 -0
- package/dist/chunk-5IKLK33T.js +69 -0
- package/dist/chunk-5NQ5FFMX.js +44 -0
- package/dist/chunk-5QNNW5L6.js +176 -0
- package/dist/chunk-5SM5UAWN.js +239 -0
- package/dist/chunk-5WYJTA6O.js +74 -0
- package/dist/chunk-5ZSR2Y5T.js +227 -0
- package/dist/chunk-5ZWUM5GH.js +39 -0
- package/dist/chunk-64E7D4HY.js +364 -0
- package/dist/chunk-6CK466BC.js +99 -0
- package/dist/chunk-6ES45HHO.js +138 -0
- package/dist/chunk-6HYEZFGL.js +277 -0
- package/dist/chunk-6Y7HLXGW.js +29 -0
- package/dist/chunk-6YKK4FYR.js +258 -0
- package/dist/chunk-74WNMLMS.js +117 -0
- package/dist/chunk-7AULZ7OD.js +55 -0
- package/dist/chunk-7DOKGSUN.js +101 -0
- package/dist/chunk-7IH5LTIZ.js +195 -0
- package/dist/chunk-7ISTS5NS.js +21 -0
- package/dist/chunk-7NMUTGOW.js +527 -0
- package/dist/chunk-7PNHUZEL.js +153 -0
- package/dist/chunk-7TSQLONI.js +88 -0
- package/dist/chunk-AE7TOLD5.js +30 -0
- package/dist/chunk-AEMHSXKA.js +130 -0
- package/dist/chunk-AKRYTS2D.js +211 -0
- package/dist/chunk-AMNSE36L.js +59 -0
- package/dist/chunk-AZVD74ZV.js +23 -0
- package/dist/chunk-B35DVOTK.js +1981 -0
- package/dist/chunk-B4HNJRAH.js +626 -0
- package/dist/chunk-B5WYPPHS.js +13 -0
- package/dist/chunk-BBOVDXQM.js +59 -0
- package/dist/chunk-BD3ECZLK.js +62 -0
- package/dist/chunk-BDGSOT74.js +4578 -0
- package/dist/chunk-BF5VEOPK.js +31 -0
- package/dist/chunk-BFFRW4XH.js +47 -0
- package/dist/chunk-BFPC6PEW.js +208 -0
- package/dist/chunk-BGEMY2JJ.js +376 -0
- package/dist/chunk-BISGNHKD.js +35 -0
- package/dist/chunk-BMRAEBRY.js +21 -0
- package/dist/chunk-BNTXAZXW.js +127 -0
- package/dist/chunk-BOQBXGSN.js +75 -0
- package/dist/chunk-BTJDSTQP.js +213 -0
- package/dist/chunk-BUOPJQP5.js +218 -0
- package/dist/chunk-BXFJS65Q.js +52 -0
- package/dist/chunk-BXPQFSX5.js +59 -0
- package/dist/chunk-C57LIWNY.js +1269 -0
- package/dist/chunk-C6YVCCWR.js +74 -0
- package/dist/chunk-CAADDF6M.js +167 -0
- package/dist/chunk-CBANJFBO.js +69 -0
- package/dist/chunk-CERF3RIB.js +597 -0
- package/dist/chunk-COAS5ETR.js +46 -0
- package/dist/chunk-CQ7J6UQ7.js +78 -0
- package/dist/chunk-CRUVYGO2.js +26 -0
- package/dist/chunk-CVFVFRGN.js +58 -0
- package/dist/chunk-D2UK66HM.js +37 -0
- package/dist/chunk-D2W7SA4R.js +18 -0
- package/dist/chunk-DA44ZENT.js +501 -0
- package/dist/chunk-DAJ76TOC.js +99 -0
- package/dist/chunk-DCZ6CIUM.js +147 -0
- package/dist/chunk-DF35KMXM.js +1314 -0
- package/dist/chunk-DGASQT26.js +151 -0
- package/dist/chunk-DJT57C5P.js +55 -0
- package/dist/chunk-DKDPZTD3.js +44 -0
- package/dist/chunk-DQYVQ2N7.js +77 -0
- package/dist/chunk-DRTP2RTY.js +266 -0
- package/dist/chunk-DW2BMUKY.js +61 -0
- package/dist/chunk-DW5T5ZVU.js +307 -0
- package/dist/chunk-DXKNDNFC.js +164 -0
- package/dist/chunk-DZEQ7UYR.js +291 -0
- package/dist/chunk-E4F4OUAC.js +463 -0
- package/dist/chunk-EE4B6A7W.js +69 -0
- package/dist/chunk-EISKIYWG.js +23 -0
- package/dist/chunk-EKAQK7UQ.js +235 -0
- package/dist/chunk-EOBTJV32.js +123 -0
- package/dist/chunk-ESF3DIZY.js +325 -0
- package/dist/chunk-EVOHOZ4U.js +45 -0
- package/dist/chunk-EXN4KHLB.js +110 -0
- package/dist/chunk-F252T6Y3.js +78 -0
- package/dist/chunk-F3DP4ZA2.js +40 -0
- package/dist/chunk-F6F47QAY.js +58 -0
- package/dist/chunk-FA3Y23ZW.js +57 -0
- package/dist/chunk-FBKXE4EJ.js +640 -0
- package/dist/chunk-FCGEB3H6.js +23 -0
- package/dist/chunk-FF7ZVYJF.js +3732 -0
- package/dist/chunk-FFGKN6L3.js +39 -0
- package/dist/chunk-FFGU4GCC.js +94 -0
- package/dist/chunk-FSFDAOVP.js +74 -0
- package/dist/chunk-FT5TX7OX.js +1573 -0
- package/dist/chunk-G3QP67Z7.js +232 -0
- package/dist/chunk-G5ORJKV2.js +179 -0
- package/dist/chunk-GFNC62PE.js +111 -0
- package/dist/chunk-GGK43Q3N.js +67 -0
- package/dist/chunk-GGYKY4GF.js +11537 -0
- package/dist/chunk-GGYNHGNJ.js +55 -0
- package/dist/chunk-GLY7RM3C.js +354 -0
- package/dist/chunk-GQBZU6EO.js +20 -0
- package/dist/chunk-GSXENUZL.js +9 -0
- package/dist/chunk-GTOAT5D3.js +40 -0
- package/dist/chunk-GWCMDPQU.js +1007 -0
- package/dist/chunk-GXYSMYHJ.js +152 -0
- package/dist/chunk-GYMAI5NY.js +14 -0
- package/dist/chunk-H2VZMKPE.js +30 -0
- package/dist/chunk-H4THUNBM.js +2091 -0
- package/dist/chunk-HGRVSNUZ.js +361 -0
- package/dist/chunk-HI4VY473.js +27 -0
- package/dist/chunk-HOJRSD3Q.js +447 -0
- package/dist/chunk-HRX25W35.js +82 -0
- package/dist/chunk-HSE4AQYV.js +55 -0
- package/dist/chunk-HU5SSUFX.js +383 -0
- package/dist/chunk-I3GDBJLH.js +196 -0
- package/dist/chunk-I75EDU75.js +684 -0
- package/dist/chunk-IBA7DMIO.js +20 -0
- package/dist/chunk-IC6N4NZA.js +231 -0
- package/dist/chunk-IF43HIGV.js +284 -0
- package/dist/chunk-IGZ6C2MC.js +439 -0
- package/dist/chunk-IMLTL2MY.js +192 -0
- package/dist/chunk-IMZL6SGR.js +33 -0
- package/dist/chunk-IS4USJPY.js +516 -0
- package/dist/chunk-ISFSPN2F.js +82 -0
- package/dist/chunk-IXE7GTFI.js +55 -0
- package/dist/chunk-IZ77QJQG.js +36 -0
- package/dist/chunk-J2PACWRQ.js +34 -0
- package/dist/chunk-J6EGFVQX.js +180 -0
- package/dist/chunk-JEKOD43D.js +22 -0
- package/dist/chunk-JGIWATSG.js +30 -0
- package/dist/chunk-JYBONKD4.js +43 -0
- package/dist/chunk-K2NLG2HK.js +454 -0
- package/dist/chunk-KCQ4TBLS.js +164 -0
- package/dist/chunk-KD5KIVMS.js +176 -0
- package/dist/chunk-KHW6TX6I.js +63 -0
- package/dist/chunk-KI5GZFCE.js +520 -0
- package/dist/chunk-KN34B7NO.js +105 -0
- package/dist/chunk-KYUHIFP3.js +136 -0
- package/dist/chunk-KZL5VS4B.js +300 -0
- package/dist/chunk-L3VW3QIH.js +48 -0
- package/dist/chunk-LA6MG4ET.js +2110 -0
- package/dist/chunk-LAVFOA3S.js +66 -0
- package/dist/chunk-LB4OA77N.js +13 -0
- package/dist/chunk-LBFRF2K4.js +196 -0
- package/dist/chunk-LM6EIA4B.js +93 -0
- package/dist/chunk-LPCNRGJ7.js +692 -0
- package/dist/chunk-LSLNL5T3.js +168 -0
- package/dist/chunk-LVRRWP4W.js +568 -0
- package/dist/chunk-LWCFBRHL.js +33 -0
- package/dist/chunk-LXFTMGZZ.js +166 -0
- package/dist/chunk-M33LVA4M.js +151 -0
- package/dist/chunk-M3FO5UMK.js +4944 -0
- package/dist/chunk-M5QNDBAY.js +66 -0
- package/dist/chunk-M6ND6KBE.js +1291 -0
- package/dist/chunk-M7H3WQTE.js +76 -0
- package/dist/chunk-MCBRVPA7.js +191 -0
- package/dist/chunk-MCSDWZET.js +91 -0
- package/dist/chunk-MDT5XDXL.js +289 -0
- package/dist/chunk-MJG3IQY4.js +91 -0
- package/dist/chunk-MOU3N2UL.js +44 -0
- package/dist/chunk-MP4KZOQC.js +3451 -0
- package/dist/chunk-MPAJ446F.js +66 -0
- package/dist/chunk-MVJZZ6AL.js +16 -0
- package/dist/chunk-MXS6S2PY.js +253 -0
- package/dist/chunk-N3SFDYM7.js +291 -0
- package/dist/chunk-NAOX3JUB.js +13 -0
- package/dist/chunk-NEKKIBCX.js +283 -0
- package/dist/chunk-NKDATMEM.js +133 -0
- package/dist/chunk-NR4FMC4K.js +395 -0
- package/dist/chunk-NSOHOJBR.js +221 -0
- package/dist/chunk-NTDB6QKF.js +29 -0
- package/dist/chunk-NWEYRBWK.js +25 -0
- package/dist/chunk-O2YSNYWD.js +23 -0
- package/dist/chunk-O3EW7LAY.js +54 -0
- package/dist/chunk-O7BNJIXU.js +366 -0
- package/dist/chunk-OARL2NXZ.js +116 -0
- package/dist/chunk-OHKZUEJW.js +351 -0
- package/dist/chunk-OKU45BXA.js +647 -0
- package/dist/chunk-OL4JBD3J.js +59 -0
- package/dist/chunk-OLUO5DDR.js +192 -0
- package/dist/chunk-OQ245JLA.js +196 -0
- package/dist/chunk-P72UZAQI.js +289 -0
- package/dist/chunk-PAL2ENB6.js +20 -0
- package/dist/chunk-PAXYQZH7.js +53 -0
- package/dist/chunk-PDPEM5VW.js +51 -0
- package/dist/chunk-PEWCDI2C.js +668 -0
- package/dist/chunk-PGZ54EDX.js +27 -0
- package/dist/chunk-PRWVLDZF.js +73 -0
- package/dist/chunk-PSQQ75VJ.js +52 -0
- package/dist/chunk-PUOVIFHW.js +118 -0
- package/dist/chunk-PWBF2X3V.js +107 -0
- package/dist/chunk-PWXII6HF.js +43 -0
- package/dist/chunk-Q35VLJRT.js +80 -0
- package/dist/chunk-QJP7EYGL.js +128 -0
- package/dist/chunk-QPQKX2MK.js +8836 -0
- package/dist/chunk-QQRLPY25.js +1053 -0
- package/dist/chunk-QUS4ER2W.js +407 -0
- package/dist/chunk-QYHI3YET.js +29 -0
- package/dist/chunk-QYRU2UQI.js +32 -0
- package/dist/chunk-R6XVVQGC.js +13 -0
- package/dist/chunk-R7QN6ONS.js +483 -0
- package/dist/chunk-RD23MPGC.js +221 -0
- package/dist/chunk-RDDWQBEM.js +185 -0
- package/dist/chunk-RDLLDYFO.js +104 -0
- package/dist/chunk-RE4TGORR.js +84 -0
- package/dist/chunk-RJLHVYQY.js +217 -0
- package/dist/chunk-RJLPTWHW.js +905 -0
- package/dist/chunk-RKUVLRZI.js +295 -0
- package/dist/chunk-ROGXPGYR.js +37 -0
- package/dist/chunk-RSZGEL5U.js +163 -0
- package/dist/chunk-RVUOIJXN.js +909 -0
- package/dist/chunk-RW7F4JRP.js +11 -0
- package/dist/chunk-S4UO3AO3.js +53 -0
- package/dist/chunk-S5JAAF6S.js +585 -0
- package/dist/chunk-SNU37TQI.js +56 -0
- package/dist/chunk-SQVUDO2O.js +31 -0
- package/dist/chunk-SYVHIYQT.js +66 -0
- package/dist/chunk-SZBQMTG2.js +85 -0
- package/dist/chunk-T5VCXA3J.js +25 -0
- package/dist/chunk-TK6NSP56.js +30 -0
- package/dist/chunk-TKWVMA6L.js +22 -0
- package/dist/chunk-TQDKJHWX.js +59 -0
- package/dist/chunk-TQDM7S5N.js +127 -0
- package/dist/chunk-TULAXS77.js +23 -0
- package/dist/chunk-TVT45XNH.js +4625 -0
- package/dist/chunk-TWCVV2JO.js +467 -0
- package/dist/chunk-U4DKAD6S.js +47 -0
- package/dist/chunk-UA5K2BTI.js +564 -0
- package/dist/chunk-UAMKCMOK.js +40 -0
- package/dist/chunk-UBMVADBF.js +51 -0
- package/dist/chunk-UFQ5A5PW.js +645 -0
- package/dist/chunk-UOD2SOLL.js +1301 -0
- package/dist/chunk-UTSB4LOW.js +156 -0
- package/dist/chunk-UVXNIUTN.js +412 -0
- package/dist/chunk-UXVPXYPE.js +90 -0
- package/dist/chunk-UYEEMIWR.js +374 -0
- package/dist/chunk-VBGM5ZBW.js +54 -0
- package/dist/chunk-VEWPCZPG.js +762 -0
- package/dist/chunk-VIRDLZ5E.js +108 -0
- package/dist/chunk-VMPO7WKN.js +52 -0
- package/dist/chunk-W2NVSDO5.js +5122 -0
- package/dist/chunk-W3YYPBEA.js +176 -0
- package/dist/chunk-W5AYOICN.js +280 -0
- package/dist/chunk-W5GZOIUF.js +27 -0
- package/dist/chunk-WHKNLZ3C.js +76 -0
- package/dist/chunk-WKBEPPQ5.js +1409 -0
- package/dist/chunk-WM3Z6QKQ.js +151 -0
- package/dist/chunk-WMI2TPMA.js +31 -0
- package/dist/chunk-WNX5VD7S.js +150 -0
- package/dist/chunk-WOVTYST3.js +60 -0
- package/dist/chunk-WPB5WEZJ.js +546 -0
- package/dist/chunk-WUO5EOAT.js +44 -0
- package/dist/chunk-WWLJMP6D.js +133 -0
- package/dist/chunk-WZMLH3XP.js +58 -0
- package/dist/chunk-WZYVLUVQ.js +79 -0
- package/dist/chunk-X2OCPVU5.js +135 -0
- package/dist/chunk-X3CL6DTR.js +95 -0
- package/dist/chunk-X6WF7JEV.js +354 -0
- package/dist/chunk-XAHGBPWT.js +44 -0
- package/dist/chunk-XCKQ5BM2.js +228 -0
- package/dist/chunk-XIBYREEY.js +106 -0
- package/dist/chunk-XKW5NDMR.js +378 -0
- package/dist/chunk-XRDALAO3.js +100 -0
- package/dist/chunk-XUP22EAS.js +41 -0
- package/dist/chunk-XWAC3MKW.js +243 -0
- package/dist/chunk-Y3R7JMXB.js +59 -0
- package/dist/chunk-Y54LTP4W.js +82 -0
- package/dist/chunk-Y7UECI4M.js +99 -0
- package/dist/chunk-YACGDFHC.js +47 -0
- package/dist/chunk-YHNIQPKY.js +71 -0
- package/dist/chunk-YMBR6HYP.js +111 -0
- package/dist/chunk-YMCH3L2S.js +26 -0
- package/dist/chunk-Z4ZU6T7V.js +99 -0
- package/dist/chunk-ZDPF67ZZ.js +173 -0
- package/dist/chunk-ZFC2Q67K.js +101 -0
- package/dist/chunk-ZGHNNSCT.js +114 -0
- package/dist/chunk-ZGX3ERAT.js +173 -0
- package/dist/chunk-ZI3YHEBY.js +37 -0
- package/dist/chunk-ZN7G6JLS.js +639 -0
- package/dist/chunk-ZNPFQMXT.js +47 -0
- package/dist/chunk-ZOU3LV4U.js +63 -0
- package/dist/chunk-ZT7B4H2V.js +117 -0
- package/dist/chunk-ZZCBDNZI.js +58 -0
- package/dist/cli.js +494 -112923
- package/dist/computer-tools.js +36642 -21259
- package/dist/harness-catalog.cjs +88 -43
- package/dist/index.js +1 -1
- package/dist/local-model-supervisor.cjs +555 -0
- package/package.json +3 -4
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
DRAFT_BASELINE,
|
|
5
|
+
STATE_BASELINE,
|
|
6
|
+
baselineOf,
|
|
7
|
+
baselineSession,
|
|
8
|
+
clearDeletions,
|
|
9
|
+
draftPinned,
|
|
10
|
+
dropEphemeral,
|
|
11
|
+
ephemeralSessions,
|
|
12
|
+
holdEphemeral,
|
|
13
|
+
indexFromWorking,
|
|
14
|
+
mergedIndex,
|
|
15
|
+
pendingDeletions,
|
|
16
|
+
readSecretsFile,
|
|
17
|
+
rememberBaseline,
|
|
18
|
+
sameSecret,
|
|
19
|
+
sessionForceStored,
|
|
20
|
+
writeSecretsFile
|
|
21
|
+
} from "./chunk-BGEMY2JJ.js";
|
|
22
|
+
import {
|
|
23
|
+
HarnessStateVersionError,
|
|
24
|
+
indexStructureChanged,
|
|
25
|
+
loadIndex,
|
|
26
|
+
storeIndex
|
|
27
|
+
} from "./chunk-XCKQ5BM2.js";
|
|
28
|
+
import {
|
|
29
|
+
HARNESS_STATE_VERSION
|
|
30
|
+
} from "./chunk-NWEYRBWK.js";
|
|
31
|
+
import {
|
|
32
|
+
isBlankConversation,
|
|
33
|
+
stampListFacts
|
|
34
|
+
} from "./chunk-TWCVV2JO.js";
|
|
35
|
+
import {
|
|
36
|
+
deleteSessionTranscript,
|
|
37
|
+
readSessionTranscript,
|
|
38
|
+
writeOwnTranscript,
|
|
39
|
+
writeSessionTranscript
|
|
40
|
+
} from "./chunk-RVUOIJXN.js";
|
|
41
|
+
import {
|
|
42
|
+
capInvocations
|
|
43
|
+
} from "./chunk-NKDATMEM.js";
|
|
44
|
+
import {
|
|
45
|
+
sameData
|
|
46
|
+
} from "./chunk-KHW6TX6I.js";
|
|
47
|
+
import {
|
|
48
|
+
withStateLock
|
|
49
|
+
} from "./chunk-4L2ZZM4Q.js";
|
|
50
|
+
import {
|
|
51
|
+
lifecycle,
|
|
52
|
+
quiet
|
|
53
|
+
} from "./chunk-RDDWQBEM.js";
|
|
54
|
+
import {
|
|
55
|
+
safeRecordFileName,
|
|
56
|
+
sessionsDirectory,
|
|
57
|
+
stateDirectory
|
|
58
|
+
} from "./chunk-MPAJ446F.js";
|
|
59
|
+
|
|
60
|
+
// src/session/store/forget.ts
|
|
61
|
+
import { readdir, rm, stat } from "node:fs/promises";
|
|
62
|
+
import { join } from "node:path";
|
|
63
|
+
function artifactPaths(id) {
|
|
64
|
+
const root = stateDirectory();
|
|
65
|
+
const record = safeRecordFileName(id);
|
|
66
|
+
const segment = id.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
67
|
+
const paths = [
|
|
68
|
+
join(root, "turn-changes", `${record}.json`),
|
|
69
|
+
join(root, "turn-changes", `${record}.json.lock`),
|
|
70
|
+
join(sessionsDirectory(), `${record}.resume-in.lock`),
|
|
71
|
+
// Normally removed with the transcript; one a build that predates it
|
|
72
|
+
// left behind when it deleted the transcript goes here.
|
|
73
|
+
join(sessionsDirectory(), `${record}.turn`)
|
|
74
|
+
];
|
|
75
|
+
if (segment && segment !== "." && segment !== "..") paths.push(join(root, "checkpoints", segment));
|
|
76
|
+
if (/^[A-Za-z0-9._-]{1,128}$/.test(id) && id !== "." && id !== "..") paths.push(join(sessionsDirectory(), id));
|
|
77
|
+
return paths;
|
|
78
|
+
}
|
|
79
|
+
async function forgetSessionArtifacts(id) {
|
|
80
|
+
await Promise.all(artifactPaths(id).map((path) => rm(path, { recursive: true, force: true }).catch(quiet("session/store/forget"))));
|
|
81
|
+
}
|
|
82
|
+
async function sessionIdsWithArtifacts() {
|
|
83
|
+
const root = stateDirectory();
|
|
84
|
+
const ids = /* @__PURE__ */ new Set();
|
|
85
|
+
const names = async (directory) => readdir(directory, { withFileTypes: true }).catch(() => []);
|
|
86
|
+
for (const entry of await names(sessionsDirectory())) if (entry.isDirectory()) ids.add(entry.name);
|
|
87
|
+
for (const entry of await names(join(root, "checkpoints"))) if (entry.isDirectory()) ids.add(entry.name);
|
|
88
|
+
for (const entry of await names(join(root, "turn-changes"))) if (entry.isFile() && entry.name.endsWith(".json")) ids.add(entry.name.slice(0, -".json".length));
|
|
89
|
+
return ids;
|
|
90
|
+
}
|
|
91
|
+
async function removeStrandedFiles(olderThanMs, now = Date.now()) {
|
|
92
|
+
const root = stateDirectory();
|
|
93
|
+
let removed = 0;
|
|
94
|
+
for (const directory of [root, sessionsDirectory(), join(root, "turn-changes"), join(root, "cache")]) {
|
|
95
|
+
for (const name of await readdir(directory).catch(() => [])) {
|
|
96
|
+
if (!/\.(tmp|new)$/.test(name)) continue;
|
|
97
|
+
const path = join(directory, name);
|
|
98
|
+
const info = await stat(path).catch(quiet("session/store/forget"));
|
|
99
|
+
if (!info?.isFile() || now - info.mtimeMs < olderThanMs) continue;
|
|
100
|
+
await rm(path, { force: true }).then(() => {
|
|
101
|
+
removed += 1;
|
|
102
|
+
}, () => void 0);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return removed;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// src/session/state/write.ts
|
|
109
|
+
async function writeState(state) {
|
|
110
|
+
const ownable = /* @__PURE__ */ new Set();
|
|
111
|
+
if (state[STATE_BASELINE]) {
|
|
112
|
+
for (const session of state.sessions ?? []) {
|
|
113
|
+
if (session.messages === void 0 && session.pendingTurn === void 0) continue;
|
|
114
|
+
if (await writeTranscriptCheckpoint(state, session.id, { journalOnly: false })) ownable.add(session.id);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const baseline = state[STATE_BASELINE];
|
|
118
|
+
let written;
|
|
119
|
+
const deleted = [];
|
|
120
|
+
const pending = new Set(pendingDeletions(state));
|
|
121
|
+
const deferred = [];
|
|
122
|
+
await withStateLock(async (held) => {
|
|
123
|
+
const clock = { start: Date.now(), index: 0, snapshot: 0, transcripts: 0, store: 0, wrote: 0, loaded: 0 };
|
|
124
|
+
const disk = await loadIndex();
|
|
125
|
+
if (disk && disk.version > HARNESS_STATE_VERSION) throw new HarnessStateVersionError(disk.version);
|
|
126
|
+
clock.index = Date.now() - clock.start;
|
|
127
|
+
for (const session of state.sessions ?? []) stampListFacts(session);
|
|
128
|
+
const taken = baselineOf(state, baseline);
|
|
129
|
+
clock.snapshot = Date.now() - clock.start - clock.index;
|
|
130
|
+
const sessions = [...state.sessions ?? []];
|
|
131
|
+
const diskIds = new Set((disk?.sessions ?? []).map((session) => session.id));
|
|
132
|
+
const removed = new Set([...pending].filter((id) => baseline?.sessions.has(id) || diskIds.has(id)));
|
|
133
|
+
const writing = new Set(sessions.map((session) => session.id));
|
|
134
|
+
for (const session of ephemeralSessions()) {
|
|
135
|
+
if (!writing.has(session.id) && !draftPinned(session.id)) dropEphemeral(session.id);
|
|
136
|
+
}
|
|
137
|
+
for (const session of sessions) {
|
|
138
|
+
if (isBlankConversation(session) && !diskIds.has(session.id) && !sessionForceStored(session.id)) holdEphemeral(session);
|
|
139
|
+
else dropEphemeral(session.id);
|
|
140
|
+
}
|
|
141
|
+
const persisted = sessions.filter((session) => !isBlankConversation(session) || diskIds.has(session.id) || sessionForceStored(session.id));
|
|
142
|
+
const persistedState = { ...state, sessions: persisted };
|
|
143
|
+
const drafts = state[DRAFT_BASELINE];
|
|
144
|
+
const next = baseline && disk ? mergedIndex(baseline, persistedState, disk, drafts, removed) : indexFromWorking(persistedState, disk, removed);
|
|
145
|
+
const tombstoned = new Set(Object.keys(disk?.deletedSessions ?? {}));
|
|
146
|
+
next.version = HARNESS_STATE_VERSION;
|
|
147
|
+
capInvocations(next);
|
|
148
|
+
for (const session of persisted) {
|
|
149
|
+
const transcript = taken.sessions.get(session.id).transcript;
|
|
150
|
+
const before = baseline?.sessions.get(session.id);
|
|
151
|
+
if (before && tombstoned.has(session.id)) continue;
|
|
152
|
+
const draft = diskIds.has(session.id) ? drafts?.get(session.id) : void 0;
|
|
153
|
+
let changed;
|
|
154
|
+
if (before && diskIds.has(session.id)) changed = before.transcript !== transcript;
|
|
155
|
+
else if (draft) changed = !sameData(draft.transcript, transcript);
|
|
156
|
+
else if (transcript.messages === void 0 && transcript.pendingTurn === void 0) changed = false;
|
|
157
|
+
else changed = !sameData(await readSessionTranscript(session.id), transcript);
|
|
158
|
+
if (!changed) continue;
|
|
159
|
+
if (ownable.has(session.id) && before) {
|
|
160
|
+
const entry = taken.sessions.get(session.id);
|
|
161
|
+
if (entry) {
|
|
162
|
+
const { messagesFrom: _from, ...rest } = entry;
|
|
163
|
+
taken.sessions.set(session.id, { ...rest, transcript: before.transcript, ...before.messagesFrom ? { messagesFrom: before.messagesFrom } : {} });
|
|
164
|
+
}
|
|
165
|
+
deferred.push(session.id);
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
const base = before && diskIds.has(session.id) ? before.transcript : draft?.transcript;
|
|
169
|
+
await writeSessionTranscript(held, session.id, transcript, base ? { base } : {});
|
|
170
|
+
clock.wrote += 1;
|
|
171
|
+
}
|
|
172
|
+
clock.transcripts = Date.now() - clock.start - clock.index - clock.snapshot;
|
|
173
|
+
clock.loaded = persisted.filter((session) => session.messages !== void 0).length;
|
|
174
|
+
const cache = Boolean(disk && indexWriteIsCache(disk, next));
|
|
175
|
+
if (!disk || !sameData(next, disk)) await storeIndex(next, { backup: indexStructureChanged(disk, next), durable: !cache });
|
|
176
|
+
clock.store = Date.now() - clock.start - clock.index - clock.snapshot - clock.transcripts;
|
|
177
|
+
const total = Date.now() - clock.start;
|
|
178
|
+
if (total >= 300) lifecycle("state.write.slow", { ms: total, indexMs: clock.index, snapshotMs: clock.snapshot, transcriptsMs: clock.transcripts, storeMs: clock.store, wrote: clock.wrote, loaded: clock.loaded, sessions: persisted.length, ...clock.store > 100 && disk ? { changed: indexChanges(disk, next) } : {} });
|
|
179
|
+
for (const id of removed) {
|
|
180
|
+
await deleteSessionTranscript(held, id);
|
|
181
|
+
deleted.push(id);
|
|
182
|
+
}
|
|
183
|
+
const tokenChanged = baseline ? !sameSecret(taken.localApiToken, baseline.localApiToken) : !!taken.localApiToken;
|
|
184
|
+
const keyChanged = baseline ? !sameSecret(taken.devicePrivateKeyPem, baseline.devicePrivateKeyPem) : !!taken.devicePrivateKeyPem;
|
|
185
|
+
if (tokenChanged || keyChanged) {
|
|
186
|
+
const secrets = await readSecretsFile();
|
|
187
|
+
const updated = {
|
|
188
|
+
localApiToken: tokenChanged ? taken.localApiToken || void 0 : secrets.localApiToken,
|
|
189
|
+
devicePrivateKeyPem: keyChanged ? taken.devicePrivateKeyPem || void 0 : secrets.devicePrivateKeyPem
|
|
190
|
+
};
|
|
191
|
+
if (!sameData(secrets, updated)) await writeSecretsFile(updated);
|
|
192
|
+
}
|
|
193
|
+
const kept = new Set(persisted.map((session) => session.id));
|
|
194
|
+
for (const id of [...taken.sessions.keys()]) if (!kept.has(id)) taken.sessions.delete(id);
|
|
195
|
+
written = taken;
|
|
196
|
+
});
|
|
197
|
+
rememberBaseline(state, written);
|
|
198
|
+
clearDeletions(state, pending);
|
|
199
|
+
for (const id of deferred) await writeDeferredTranscript(state, id);
|
|
200
|
+
for (const id of deleted) await forgetSessionArtifacts(id);
|
|
201
|
+
}
|
|
202
|
+
async function writeDeferredTranscript(state, sessionId) {
|
|
203
|
+
if (await writeTranscriptCheckpoint(state, sessionId, { journalOnly: true })) return;
|
|
204
|
+
const session = state.sessions?.find((item) => item.id === sessionId);
|
|
205
|
+
const baseline = state[STATE_BASELINE];
|
|
206
|
+
const before = baseline?.sessions.get(sessionId);
|
|
207
|
+
if (!session || !baseline || !before) return;
|
|
208
|
+
const now = baselineSession(session, before);
|
|
209
|
+
if (now.transcript === before.transcript) return;
|
|
210
|
+
await withStateLock(async (held) => {
|
|
211
|
+
await writeSessionTranscript(held, sessionId, now.transcript, { base: before.transcript });
|
|
212
|
+
});
|
|
213
|
+
const current = state[STATE_BASELINE];
|
|
214
|
+
const entry = current?.sessions.get(sessionId);
|
|
215
|
+
if (entry && current === baseline) {
|
|
216
|
+
const { messagesFrom: _from, ...rest } = entry;
|
|
217
|
+
current.sessions.set(sessionId, { ...rest, transcript: now.transcript, ...now.messagesFrom ? { messagesFrom: now.messagesFrom } : {} });
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
async function writeTranscriptCheckpoint(state, sessionId, options = { journalOnly: true }) {
|
|
221
|
+
const baseline = state[STATE_BASELINE];
|
|
222
|
+
const before = baseline?.sessions.get(sessionId);
|
|
223
|
+
const session = state.sessions?.find((item) => item.id === sessionId);
|
|
224
|
+
if (!baseline || !before || !session) return false;
|
|
225
|
+
const now = baselineSession(session, before);
|
|
226
|
+
if (now.transcript !== before.transcript) {
|
|
227
|
+
const listed = async () => {
|
|
228
|
+
const disk = await loadIndex();
|
|
229
|
+
if (disk && disk.version > HARNESS_STATE_VERSION) throw new HarnessStateVersionError(disk.version);
|
|
230
|
+
return Boolean(disk?.sessions.some((item) => item.id === sessionId));
|
|
231
|
+
};
|
|
232
|
+
if (!await writeOwnTranscript(sessionId, now.transcript, before.transcript, listed, options)) return false;
|
|
233
|
+
}
|
|
234
|
+
{
|
|
235
|
+
const current = state[STATE_BASELINE]?.sessions;
|
|
236
|
+
const entry = current?.get(sessionId);
|
|
237
|
+
if (entry) {
|
|
238
|
+
const { messagesFrom: _from, ...rest } = entry;
|
|
239
|
+
current.set(sessionId, { ...rest, transcript: now.transcript, ...now.messagesFrom ? { messagesFrom: now.messagesFrom } : {} });
|
|
240
|
+
}
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
var CACHE_SESSION_FIELDS = /* @__PURE__ */ new Set(["updatedAt", "lastUsage"]);
|
|
245
|
+
function indexWriteIsCache(disk, next) {
|
|
246
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(disk), ...Object.keys(next)]);
|
|
247
|
+
for (const key of keys) {
|
|
248
|
+
if (key === "sessions") {
|
|
249
|
+
if (!sessionRowsAreCache(disk.sessions ?? [], next.sessions ?? [])) return false;
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
if (!sameData(disk[key], next[key])) return false;
|
|
253
|
+
}
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
function sessionRowsAreCache(before, after) {
|
|
257
|
+
if (before.length !== after.length) return false;
|
|
258
|
+
for (let index = 0; index < before.length; index += 1) {
|
|
259
|
+
const left = before[index];
|
|
260
|
+
const right = after[index];
|
|
261
|
+
if (left.id !== right.id) return false;
|
|
262
|
+
const fields = /* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)]);
|
|
263
|
+
for (const field of fields) {
|
|
264
|
+
if (sameData(left[field], right[field])) continue;
|
|
265
|
+
if (!CACHE_SESSION_FIELDS.has(field)) return false;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
function indexChanges(disk, next) {
|
|
271
|
+
const out = [];
|
|
272
|
+
for (const key of Object.keys(next)) {
|
|
273
|
+
if (key === "accounts" || key === "sessions") {
|
|
274
|
+
const before = new Map((disk[key] ?? []).map((item) => [item.id, item]));
|
|
275
|
+
for (const item of next[key]) {
|
|
276
|
+
const old = before.get(item.id);
|
|
277
|
+
if (!old) {
|
|
278
|
+
out.push(`${key}:${item.id.slice(0, 8)}+`);
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
for (const field of Object.keys(item)) if (!sameData(old[field], item[field])) out.push(`${key}:${item.id.slice(0, 8)}.${field}`);
|
|
282
|
+
}
|
|
283
|
+
} else if (!sameData(disk[key], next[key])) out.push(String(key));
|
|
284
|
+
}
|
|
285
|
+
return out.slice(0, 12);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export {
|
|
289
|
+
forgetSessionArtifacts,
|
|
290
|
+
sessionIdsWithArtifacts,
|
|
291
|
+
removeStrandedFiles,
|
|
292
|
+
writeState,
|
|
293
|
+
writeTranscriptCheckpoint,
|
|
294
|
+
indexWriteIsCache
|
|
295
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
emitHarnessOutput
|
|
5
|
+
} from "./chunk-4RHXTL3W.js";
|
|
6
|
+
import {
|
|
7
|
+
source_default
|
|
8
|
+
} from "./chunk-LVRRWP4W.js";
|
|
9
|
+
|
|
10
|
+
// src/tui/pickers/choose.ts
|
|
11
|
+
import { stdout as output } from "node:process";
|
|
12
|
+
async function chooseOption(rl, title, options, onAction, settings) {
|
|
13
|
+
if (options.length === 0) return void 0;
|
|
14
|
+
if (rl.select) return rl.select(title, options, onAction, settings);
|
|
15
|
+
output.write(`
|
|
16
|
+
${source_default.bold(title)}
|
|
17
|
+
`);
|
|
18
|
+
options.forEach((option, index2) => {
|
|
19
|
+
output.write(` ${source_default.cyan(String(index2 + 1).padStart(2))} ${option.label}${option.detail ? ` ${source_default.dim(option.detail)}` : ""}
|
|
20
|
+
`);
|
|
21
|
+
});
|
|
22
|
+
output.write(` ${source_default.dim("0 Cancel")}
|
|
23
|
+
|
|
24
|
+
`);
|
|
25
|
+
const answer = (await rl.question(source_default.bold("Choose \u203A "))).trim();
|
|
26
|
+
if (!answer || answer === "0") return void 0;
|
|
27
|
+
const index = Number(answer) - 1;
|
|
28
|
+
if (!Number.isInteger(index) || index < 0 || index >= options.length) {
|
|
29
|
+
emitHarnessOutput({ panel: "error", message: `Choose a number from 1 to ${options.length}.` });
|
|
30
|
+
return void 0;
|
|
31
|
+
}
|
|
32
|
+
return options[index].value;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
chooseOption
|
|
37
|
+
};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
atomicWriteFile
|
|
5
|
+
} from "./chunk-F6F47QAY.js";
|
|
6
|
+
import {
|
|
7
|
+
stateDirectory
|
|
8
|
+
} from "./chunk-MPAJ446F.js";
|
|
9
|
+
|
|
10
|
+
// src/harness/custom-acp.ts
|
|
11
|
+
import { createRequire } from "node:module";
|
|
12
|
+
import { readFileSync, statSync } from "node:fs";
|
|
13
|
+
import { join } from "node:path";
|
|
14
|
+
function catalogBundle() {
|
|
15
|
+
const require2 = createRequire(import.meta.url);
|
|
16
|
+
try {
|
|
17
|
+
return require2("../../dist/harness-catalog.cjs");
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
return require2("./harness-catalog.cjs");
|
|
21
|
+
}
|
|
22
|
+
function customAcpConfigPath() {
|
|
23
|
+
return join(stateDirectory(), "custom-acp.json");
|
|
24
|
+
}
|
|
25
|
+
function parseCustomAcpConfig(text) {
|
|
26
|
+
let parsed;
|
|
27
|
+
try {
|
|
28
|
+
parsed = JSON.parse(text);
|
|
29
|
+
} catch {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
if (!parsed || typeof parsed !== "object" || !Array.isArray(parsed.harnesses)) return [];
|
|
33
|
+
const records = [];
|
|
34
|
+
for (const entry of parsed.harnesses) {
|
|
35
|
+
if (!entry || typeof entry !== "object") continue;
|
|
36
|
+
const record = entry;
|
|
37
|
+
if (typeof record.command !== "string" || typeof record.binary !== "string") continue;
|
|
38
|
+
const argv = Array.isArray(record.argv) ? record.argv.filter((arg) => typeof arg === "string") : [];
|
|
39
|
+
records.push({
|
|
40
|
+
command: record.command,
|
|
41
|
+
binary: record.binary,
|
|
42
|
+
argv,
|
|
43
|
+
...typeof record.displayName === "string" ? { displayName: record.displayName } : {},
|
|
44
|
+
...typeof record.provider === "string" ? { provider: record.provider } : {}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return records;
|
|
48
|
+
}
|
|
49
|
+
function storedShape(records) {
|
|
50
|
+
return `${JSON.stringify({ harnesses: records }, null, 2)}
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
function assertCustomAcpAvailable(definition) {
|
|
54
|
+
const catalog = catalogBundle();
|
|
55
|
+
const built = catalog.customAcpHarness(definition);
|
|
56
|
+
const taken = catalog.AI_LOCAL_HARNESSES.some((item) => item.command === built.command || item.provider === built.provider);
|
|
57
|
+
if (taken) throw new Error(`"${built.command}" is already a built-in harness`);
|
|
58
|
+
return built;
|
|
59
|
+
}
|
|
60
|
+
async function writeCustomAcpConfig(records) {
|
|
61
|
+
await atomicWriteFile(customAcpConfigPath(), storedShape(records));
|
|
62
|
+
loadedSignature = void 0;
|
|
63
|
+
lastCheck = void 0;
|
|
64
|
+
}
|
|
65
|
+
async function readCustomAcpConfig() {
|
|
66
|
+
try {
|
|
67
|
+
return parseCustomAcpConfig(readFileSync(customAcpConfigPath(), "utf8"));
|
|
68
|
+
} catch (error) {
|
|
69
|
+
if (error.code === "ENOENT") return [];
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function addCustomAcpHarness(definition) {
|
|
74
|
+
const built = assertCustomAcpAvailable(definition);
|
|
75
|
+
const records = await readCustomAcpConfig();
|
|
76
|
+
for (const item of records) {
|
|
77
|
+
let existing;
|
|
78
|
+
try {
|
|
79
|
+
existing = catalogBundle().customAcpHarness(item);
|
|
80
|
+
} catch {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (existing.command !== built.command && existing.provider === built.provider) {
|
|
84
|
+
throw new Error(`provider "${built.provider}" is already used by custom ACP harness "${existing.command}"`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const next = records.filter((item) => {
|
|
88
|
+
try {
|
|
89
|
+
return catalogBundle().customAcpHarness(item).command !== built.command;
|
|
90
|
+
} catch {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
next.push({
|
|
95
|
+
command: built.command,
|
|
96
|
+
binary: built.binary,
|
|
97
|
+
argv: [...built.acp?.argv ?? []],
|
|
98
|
+
displayName: built.displayName,
|
|
99
|
+
provider: built.provider
|
|
100
|
+
});
|
|
101
|
+
await writeCustomAcpConfig(next);
|
|
102
|
+
return built;
|
|
103
|
+
}
|
|
104
|
+
async function removeCustomAcpHarness(command) {
|
|
105
|
+
const wanted = command.trim().replace(/^\//, "").toLowerCase();
|
|
106
|
+
const records = await readCustomAcpConfig();
|
|
107
|
+
const next = records.filter((item) => {
|
|
108
|
+
try {
|
|
109
|
+
return catalogBundle().customAcpHarness(item).command !== wanted;
|
|
110
|
+
} catch {
|
|
111
|
+
return item.command.trim().replace(/^\//, "").toLowerCase() !== wanted;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
if (next.length === records.length) return false;
|
|
115
|
+
await writeCustomAcpConfig(next);
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
var loadedSignature;
|
|
119
|
+
var CHECK_MS = 1e3;
|
|
120
|
+
var lastCheck;
|
|
121
|
+
function reloadCustomAcpHarnesses(catalog) {
|
|
122
|
+
const path = customAcpConfigPath();
|
|
123
|
+
const now = Date.now();
|
|
124
|
+
if (lastCheck?.path === path && now - lastCheck.at < CHECK_MS) return;
|
|
125
|
+
lastCheck = { path, at: now };
|
|
126
|
+
let signature;
|
|
127
|
+
let text;
|
|
128
|
+
try {
|
|
129
|
+
const stat = statSync(path, { throwIfNoEntry: false });
|
|
130
|
+
if (!stat) {
|
|
131
|
+
if (loadedSignature !== void 0 && loadedSignature !== "missing") catalog.registerCustomHarnesses([]);
|
|
132
|
+
loadedSignature = "missing";
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
signature = `${stat.mtimeMs}:${stat.size}`;
|
|
136
|
+
if (signature === loadedSignature) return;
|
|
137
|
+
text = readFileSync(path, "utf8");
|
|
138
|
+
} catch {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
let records;
|
|
142
|
+
try {
|
|
143
|
+
records = parseCustomAcpConfig(text);
|
|
144
|
+
} catch {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const definitions = [];
|
|
148
|
+
for (const record of records) {
|
|
149
|
+
try {
|
|
150
|
+
definitions.push(catalog.customAcpHarness(record));
|
|
151
|
+
} catch {
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catalog.registerCustomHarnesses(definitions);
|
|
155
|
+
loadedSignature = signature;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export {
|
|
159
|
+
readCustomAcpConfig,
|
|
160
|
+
addCustomAcpHarness,
|
|
161
|
+
removeCustomAcpHarness,
|
|
162
|
+
reloadCustomAcpHarnesses
|
|
163
|
+
};
|