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.
- 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 +498 -112593
- package/dist/computer-tools.js +36642 -21258
- 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,1269 @@
|
|
|
1
|
+
import { createRequire as __clikcodeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __clikcodeCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
browseSearch,
|
|
5
|
+
dispatchLine,
|
|
6
|
+
gatewayConversationUsageLabel,
|
|
7
|
+
gatewayCreditLabel,
|
|
8
|
+
offerResumeIn,
|
|
9
|
+
shouldWarmVendorChat,
|
|
10
|
+
walkTurns
|
|
11
|
+
} from "./chunk-WKBEPPQ5.js";
|
|
12
|
+
import {
|
|
13
|
+
queuedNext
|
|
14
|
+
} from "./chunk-PAL2ENB6.js";
|
|
15
|
+
import "./chunk-Y7UECI4M.js";
|
|
16
|
+
import {
|
|
17
|
+
BOARD_LINE,
|
|
18
|
+
DELETED_ELSEWHERE,
|
|
19
|
+
RemoteUnavailable,
|
|
20
|
+
conversationCommands,
|
|
21
|
+
joinedTurn,
|
|
22
|
+
openedChat,
|
|
23
|
+
runRemoteChat
|
|
24
|
+
} from "./chunk-UOD2SOLL.js";
|
|
25
|
+
import {
|
|
26
|
+
interactiveSessionPicker
|
|
27
|
+
} from "./chunk-LPCNRGJ7.js";
|
|
28
|
+
import "./chunk-5ZSR2Y5T.js";
|
|
29
|
+
import "./chunk-VEWPCZPG.js";
|
|
30
|
+
import "./chunk-O2YSNYWD.js";
|
|
31
|
+
import "./chunk-X6WF7JEV.js";
|
|
32
|
+
import "./chunk-IC6N4NZA.js";
|
|
33
|
+
import "./chunk-6CK466BC.js";
|
|
34
|
+
import "./chunk-Z4ZU6T7V.js";
|
|
35
|
+
import "./chunk-UFQ5A5PW.js";
|
|
36
|
+
import "./chunk-AZVD74ZV.js";
|
|
37
|
+
import {
|
|
38
|
+
closeAllWorkerClients,
|
|
39
|
+
followWorkerTurn,
|
|
40
|
+
prepareSessionWorker,
|
|
41
|
+
pushSessionSettings,
|
|
42
|
+
questionOrWorker,
|
|
43
|
+
refreshSessionWorker,
|
|
44
|
+
releaseSessionWorker,
|
|
45
|
+
runTurnThroughWorker,
|
|
46
|
+
workerQueueMark,
|
|
47
|
+
workerTurn
|
|
48
|
+
} from "./chunk-3AJ6Q3OY.js";
|
|
49
|
+
import "./chunk-KD5KIVMS.js";
|
|
50
|
+
import "./chunk-6ES45HHO.js";
|
|
51
|
+
import {
|
|
52
|
+
registerBuildReplacer,
|
|
53
|
+
shouldTellStale
|
|
54
|
+
} from "./chunk-ZGHNNSCT.js";
|
|
55
|
+
import "./chunk-S5JAAF6S.js";
|
|
56
|
+
import {
|
|
57
|
+
withSlowWait
|
|
58
|
+
} from "./chunk-COAS5ETR.js";
|
|
59
|
+
import {
|
|
60
|
+
runShellLine
|
|
61
|
+
} from "./chunk-H4THUNBM.js";
|
|
62
|
+
import "./chunk-5642PBF7.js";
|
|
63
|
+
import "./chunk-OKU45BXA.js";
|
|
64
|
+
import "./chunk-EKAQK7UQ.js";
|
|
65
|
+
import {
|
|
66
|
+
isShellCommandLine,
|
|
67
|
+
liveSettingsOf,
|
|
68
|
+
runSessionTurn,
|
|
69
|
+
shellMessageContent
|
|
70
|
+
} from "./chunk-32IKAIZC.js";
|
|
71
|
+
import "./chunk-Y3R7JMXB.js";
|
|
72
|
+
import "./chunk-E4F4OUAC.js";
|
|
73
|
+
import "./chunk-OHKZUEJW.js";
|
|
74
|
+
import "./chunk-M6ND6KBE.js";
|
|
75
|
+
import "./chunk-LM6EIA4B.js";
|
|
76
|
+
import "./chunk-WZMLH3XP.js";
|
|
77
|
+
import "./chunk-UVXNIUTN.js";
|
|
78
|
+
import "./chunk-RDLLDYFO.js";
|
|
79
|
+
import "./chunk-74WNMLMS.js";
|
|
80
|
+
import "./chunk-GLY7RM3C.js";
|
|
81
|
+
import {
|
|
82
|
+
autoSelectSessionHarness,
|
|
83
|
+
interactiveEnginePicker
|
|
84
|
+
} from "./chunk-M7H3WQTE.js";
|
|
85
|
+
import {
|
|
86
|
+
TerminalHarnessPrompter,
|
|
87
|
+
popKittyKeyboard
|
|
88
|
+
} from "./chunk-QPQKX2MK.js";
|
|
89
|
+
import "./chunk-X2OCPVU5.js";
|
|
90
|
+
import "./chunk-ROGXPGYR.js";
|
|
91
|
+
import "./chunk-T5VCXA3J.js";
|
|
92
|
+
import "./chunk-BTJDSTQP.js";
|
|
93
|
+
import "./chunk-W2NVSDO5.js";
|
|
94
|
+
import "./chunk-EXN4KHLB.js";
|
|
95
|
+
import "./chunk-BNTXAZXW.js";
|
|
96
|
+
import "./chunk-LAVFOA3S.js";
|
|
97
|
+
import "./chunk-2GAB36IE.js";
|
|
98
|
+
import "./chunk-WOVTYST3.js";
|
|
99
|
+
import "./chunk-3RXBMYKZ.js";
|
|
100
|
+
import "./chunk-34JQYQCA.js";
|
|
101
|
+
import "./chunk-JYBONKD4.js";
|
|
102
|
+
import "./chunk-MCSDWZET.js";
|
|
103
|
+
import "./chunk-BOQBXGSN.js";
|
|
104
|
+
import "./chunk-DAJ76TOC.js";
|
|
105
|
+
import "./chunk-KCQ4TBLS.js";
|
|
106
|
+
import "./chunk-FBKXE4EJ.js";
|
|
107
|
+
import "./chunk-DW2BMUKY.js";
|
|
108
|
+
import "./chunk-B4HNJRAH.js";
|
|
109
|
+
import "./chunk-OQ245JLA.js";
|
|
110
|
+
import "./chunk-25T3GVS7.js";
|
|
111
|
+
import "./chunk-4GXAO3UY.js";
|
|
112
|
+
import "./chunk-SNU37TQI.js";
|
|
113
|
+
import "./chunk-XAHGBPWT.js";
|
|
114
|
+
import "./chunk-ZOU3LV4U.js";
|
|
115
|
+
import {
|
|
116
|
+
conversationCost
|
|
117
|
+
} from "./chunk-LBFRF2K4.js";
|
|
118
|
+
import "./chunk-J6EGFVQX.js";
|
|
119
|
+
import "./chunk-FT5TX7OX.js";
|
|
120
|
+
import "./chunk-7NMUTGOW.js";
|
|
121
|
+
import "./chunk-FFGU4GCC.js";
|
|
122
|
+
import "./chunk-DXKNDNFC.js";
|
|
123
|
+
import {
|
|
124
|
+
activateSession,
|
|
125
|
+
afterTurnFailure,
|
|
126
|
+
claimConversation,
|
|
127
|
+
leaveConversation,
|
|
128
|
+
newConversation,
|
|
129
|
+
openConversation,
|
|
130
|
+
prepareTurn,
|
|
131
|
+
releaseConversationClaim,
|
|
132
|
+
resolveSessionModel,
|
|
133
|
+
stopWaitingForReset
|
|
134
|
+
} from "./chunk-RJLPTWHW.js";
|
|
135
|
+
import {
|
|
136
|
+
sessionOrProviderHarness
|
|
137
|
+
} from "./chunk-2EOL5PZL.js";
|
|
138
|
+
import {
|
|
139
|
+
signInBeforeUse
|
|
140
|
+
} from "./chunk-MDT5XDXL.js";
|
|
141
|
+
import {
|
|
142
|
+
followModelDownloads,
|
|
143
|
+
holdLocalModelAfterTurn,
|
|
144
|
+
knownVendorCommands,
|
|
145
|
+
reconcileLocalModelLeases,
|
|
146
|
+
rememberVendorCommands,
|
|
147
|
+
vendorCommandsCheckedAt
|
|
148
|
+
} from "./chunk-UYEEMIWR.js";
|
|
149
|
+
import {
|
|
150
|
+
acpAvailableCommands,
|
|
151
|
+
closePersistentTransport,
|
|
152
|
+
nativeAvailableCommands
|
|
153
|
+
} from "./chunk-TVT45XNH.js";
|
|
154
|
+
import "./chunk-K2NLG2HK.js";
|
|
155
|
+
import "./chunk-EOBTJV32.js";
|
|
156
|
+
import "./chunk-7AULZ7OD.js";
|
|
157
|
+
import "./chunk-UA5K2BTI.js";
|
|
158
|
+
import {
|
|
159
|
+
isUsageExhaustedMessage,
|
|
160
|
+
nextQuotaReset,
|
|
161
|
+
resumeWaitLabel
|
|
162
|
+
} from "./chunk-IF43HIGV.js";
|
|
163
|
+
import "./chunk-7TSQLONI.js";
|
|
164
|
+
import "./chunk-2YPAPAR3.js";
|
|
165
|
+
import "./chunk-DGASQT26.js";
|
|
166
|
+
import {
|
|
167
|
+
synchronizeNativeTranscript
|
|
168
|
+
} from "./chunk-PUOVIFHW.js";
|
|
169
|
+
import "./chunk-WNX5VD7S.js";
|
|
170
|
+
import "./chunk-34AZEGYW.js";
|
|
171
|
+
import "./chunk-UTSB4LOW.js";
|
|
172
|
+
import "./chunk-WM3Z6QKQ.js";
|
|
173
|
+
import {
|
|
174
|
+
nativeUsageReading,
|
|
175
|
+
recheckRecoveredAccounts,
|
|
176
|
+
signInOutcomeSaid
|
|
177
|
+
} from "./chunk-LA6MG4ET.js";
|
|
178
|
+
import "./chunk-N3SFDYM7.js";
|
|
179
|
+
import "./chunk-X3CL6DTR.js";
|
|
180
|
+
import {
|
|
181
|
+
emitHarnessOutput
|
|
182
|
+
} from "./chunk-4RHXTL3W.js";
|
|
183
|
+
import "./chunk-W5AYOICN.js";
|
|
184
|
+
import "./chunk-2OLS7V66.js";
|
|
185
|
+
import "./chunk-2QWPQRSU.js";
|
|
186
|
+
import "./chunk-IS4USJPY.js";
|
|
187
|
+
import "./chunk-2BBELGHY.js";
|
|
188
|
+
import "./chunk-QYHI3YET.js";
|
|
189
|
+
import "./chunk-4LPDG57B.js";
|
|
190
|
+
import "./chunk-TQDM7S5N.js";
|
|
191
|
+
import "./chunk-TQDKJHWX.js";
|
|
192
|
+
import "./chunk-GQBZU6EO.js";
|
|
193
|
+
import "./chunk-SQVUDO2O.js";
|
|
194
|
+
import "./chunk-RE4TGORR.js";
|
|
195
|
+
import "./chunk-DCZ6CIUM.js";
|
|
196
|
+
import "./chunk-M3FO5UMK.js";
|
|
197
|
+
import "./chunk-CERF3RIB.js";
|
|
198
|
+
import {
|
|
199
|
+
warmNativeModelCatalog
|
|
200
|
+
} from "./chunk-QQRLPY25.js";
|
|
201
|
+
import "./chunk-DA44ZENT.js";
|
|
202
|
+
import "./chunk-F252T6Y3.js";
|
|
203
|
+
import {
|
|
204
|
+
usageResetLabel
|
|
205
|
+
} from "./chunk-XWAC3MKW.js";
|
|
206
|
+
import {
|
|
207
|
+
heldOff,
|
|
208
|
+
markAccountNeedsSignIn,
|
|
209
|
+
recordBackgroundOutcome
|
|
210
|
+
} from "./chunk-CVFVFRGN.js";
|
|
211
|
+
import "./chunk-QJP7EYGL.js";
|
|
212
|
+
import {
|
|
213
|
+
acpDiscoverySession,
|
|
214
|
+
acpProbeArgv,
|
|
215
|
+
queryAcp
|
|
216
|
+
} from "./chunk-ESF3DIZY.js";
|
|
217
|
+
import "./chunk-R7QN6ONS.js";
|
|
218
|
+
import "./chunk-ZN7G6JLS.js";
|
|
219
|
+
import {
|
|
220
|
+
nativeProfileEnvironment
|
|
221
|
+
} from "./chunk-ZGX3ERAT.js";
|
|
222
|
+
import "./chunk-PEWCDI2C.js";
|
|
223
|
+
import "./chunk-TULAXS77.js";
|
|
224
|
+
import {
|
|
225
|
+
retireStaleWorkers,
|
|
226
|
+
warmSessionWorker
|
|
227
|
+
} from "./chunk-KI5GZFCE.js";
|
|
228
|
+
import {
|
|
229
|
+
shownSettingsKey
|
|
230
|
+
} from "./chunk-UBMVADBF.js";
|
|
231
|
+
import "./chunk-ZZCBDNZI.js";
|
|
232
|
+
import {
|
|
233
|
+
readState
|
|
234
|
+
} from "./chunk-MXS6S2PY.js";
|
|
235
|
+
import "./chunk-BISGNHKD.js";
|
|
236
|
+
import {
|
|
237
|
+
writeState
|
|
238
|
+
} from "./chunk-RKUVLRZI.js";
|
|
239
|
+
import {
|
|
240
|
+
REEXEC_DRAFT_ENV,
|
|
241
|
+
REEXEC_TYPED_ENV,
|
|
242
|
+
adoptHandedOverDraft,
|
|
243
|
+
adoptHandedOverTyped,
|
|
244
|
+
conversationWasDeleted,
|
|
245
|
+
ephemeralSession
|
|
246
|
+
} from "./chunk-BGEMY2JJ.js";
|
|
247
|
+
import "./chunk-XCKQ5BM2.js";
|
|
248
|
+
import "./chunk-NWEYRBWK.js";
|
|
249
|
+
import "./chunk-TWCVV2JO.js";
|
|
250
|
+
import "./chunk-PDPEM5VW.js";
|
|
251
|
+
import {
|
|
252
|
+
sessionProviderLabel
|
|
253
|
+
} from "./chunk-WWLJMP6D.js";
|
|
254
|
+
import {
|
|
255
|
+
isClikCodeAgent,
|
|
256
|
+
isGatewayService
|
|
257
|
+
} from "./chunk-CRUVYGO2.js";
|
|
258
|
+
import {
|
|
259
|
+
consumeSessionTurn,
|
|
260
|
+
sessionTranscriptMessages
|
|
261
|
+
} from "./chunk-FF7ZVYJF.js";
|
|
262
|
+
import "./chunk-IMLTL2MY.js";
|
|
263
|
+
import "./chunk-BUOPJQP5.js";
|
|
264
|
+
import "./chunk-3B2CHX7M.js";
|
|
265
|
+
import "./chunk-RVUOIJXN.js";
|
|
266
|
+
import {
|
|
267
|
+
currentWorkerBuild
|
|
268
|
+
} from "./chunk-QUS4ER2W.js";
|
|
269
|
+
import "./chunk-DQYVQ2N7.js";
|
|
270
|
+
import "./chunk-KYUHIFP3.js";
|
|
271
|
+
import "./chunk-RSZGEL5U.js";
|
|
272
|
+
import "./chunk-NKDATMEM.js";
|
|
273
|
+
import {
|
|
274
|
+
TERMINAL,
|
|
275
|
+
mayRunInBackground,
|
|
276
|
+
runNativeHarnessCommand,
|
|
277
|
+
terminalUiSupported
|
|
278
|
+
} from "./chunk-DF35KMXM.js";
|
|
279
|
+
import "./chunk-ZT7B4H2V.js";
|
|
280
|
+
import "./chunk-OL4JBD3J.js";
|
|
281
|
+
import "./chunk-IGZ6C2MC.js";
|
|
282
|
+
import {
|
|
283
|
+
beginTurnClock,
|
|
284
|
+
endTurnClock,
|
|
285
|
+
markTurn
|
|
286
|
+
} from "./chunk-4NN3XQQT.js";
|
|
287
|
+
import "./chunk-4AQ5NINV.js";
|
|
288
|
+
import {
|
|
289
|
+
spawnPortable
|
|
290
|
+
} from "./chunk-WPB5WEZJ.js";
|
|
291
|
+
import "./chunk-GYMAI5NY.js";
|
|
292
|
+
import {
|
|
293
|
+
failureText
|
|
294
|
+
} from "./chunk-CQ7J6UQ7.js";
|
|
295
|
+
import "./chunk-XKW5NDMR.js";
|
|
296
|
+
import "./chunk-W3YYPBEA.js";
|
|
297
|
+
import "./chunk-XIBYREEY.js";
|
|
298
|
+
import {
|
|
299
|
+
quotaResetPhrase
|
|
300
|
+
} from "./chunk-EE4B6A7W.js";
|
|
301
|
+
import "./chunk-WZYVLUVQ.js";
|
|
302
|
+
import "./chunk-O3EW7LAY.js";
|
|
303
|
+
import "./chunk-KHW6TX6I.js";
|
|
304
|
+
import "./chunk-MP4KZOQC.js";
|
|
305
|
+
import "./chunk-PWBF2X3V.js";
|
|
306
|
+
import "./chunk-HU5SSUFX.js";
|
|
307
|
+
import "./chunk-AKRYTS2D.js";
|
|
308
|
+
import "./chunk-4GVEJ5FK.js";
|
|
309
|
+
import "./chunk-O7BNJIXU.js";
|
|
310
|
+
import "./chunk-MCBRVPA7.js";
|
|
311
|
+
import "./chunk-RJLHVYQY.js";
|
|
312
|
+
import {
|
|
313
|
+
sleep
|
|
314
|
+
} from "./chunk-YMCH3L2S.js";
|
|
315
|
+
import "./chunk-I75EDU75.js";
|
|
316
|
+
import {
|
|
317
|
+
REEXEC_TERMINAL_ENV,
|
|
318
|
+
historyDump,
|
|
319
|
+
reexecHandover
|
|
320
|
+
} from "./chunk-64E7D4HY.js";
|
|
321
|
+
import "./chunk-JGIWATSG.js";
|
|
322
|
+
import "./chunk-5B6TVO4A.js";
|
|
323
|
+
import "./chunk-NAOX3JUB.js";
|
|
324
|
+
import "./chunk-4QZEZME7.js";
|
|
325
|
+
import {
|
|
326
|
+
source_default
|
|
327
|
+
} from "./chunk-LVRRWP4W.js";
|
|
328
|
+
import "./chunk-GGYKY4GF.js";
|
|
329
|
+
import "./chunk-5SM5UAWN.js";
|
|
330
|
+
import "./chunk-PAXYQZH7.js";
|
|
331
|
+
import "./chunk-CAADDF6M.js";
|
|
332
|
+
import "./chunk-G3QP67Z7.js";
|
|
333
|
+
import {
|
|
334
|
+
fileLocksHeld,
|
|
335
|
+
fileLocksIdle
|
|
336
|
+
} from "./chunk-4L2ZZM4Q.js";
|
|
337
|
+
import "./chunk-F6F47QAY.js";
|
|
338
|
+
import {
|
|
339
|
+
diagnostic,
|
|
340
|
+
lifecycle,
|
|
341
|
+
quiet,
|
|
342
|
+
setLifecycleRole,
|
|
343
|
+
swallowed
|
|
344
|
+
} from "./chunk-RDDWQBEM.js";
|
|
345
|
+
import "./chunk-MPAJ446F.js";
|
|
346
|
+
import "./chunk-CBANJFBO.js";
|
|
347
|
+
import "./chunk-PWXII6HF.js";
|
|
348
|
+
|
|
349
|
+
// src/runtime/event-loop-monitor.ts
|
|
350
|
+
import { monitorEventLoopDelay } from "node:perf_hooks";
|
|
351
|
+
var BLOCKED_THRESHOLD_MS = 100;
|
|
352
|
+
var BLOCKED_LOG_GAP_MS = 1e4;
|
|
353
|
+
var SAMPLE_MS = 1e3;
|
|
354
|
+
function blockedLogger(write, now = Date.now, thresholdMs = BLOCKED_THRESHOLD_MS, gapMs = BLOCKED_LOG_GAP_MS) {
|
|
355
|
+
let lastWritten;
|
|
356
|
+
let suppressed = 0;
|
|
357
|
+
return (worstMs) => {
|
|
358
|
+
if (worstMs <= thresholdMs) return;
|
|
359
|
+
const at = now();
|
|
360
|
+
if (lastWritten !== void 0 && at - lastWritten < gapMs) {
|
|
361
|
+
suppressed += 1;
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
lastWritten = at;
|
|
365
|
+
const skipped = suppressed;
|
|
366
|
+
suppressed = 0;
|
|
367
|
+
write({ ms: Math.round(worstMs), suppressed: skipped });
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function startEventLoopMonitor() {
|
|
371
|
+
const histogram = monitorEventLoopDelay({ resolution: 20 });
|
|
372
|
+
histogram.enable();
|
|
373
|
+
const note = blockedLogger(({ ms, suppressed }) => lifecycle("event-loop.blocked", { ms, ...suppressed ? { suppressed } : {} }));
|
|
374
|
+
const timer = setInterval(() => {
|
|
375
|
+
const worstMs = histogram.max / 1e6;
|
|
376
|
+
histogram.reset();
|
|
377
|
+
note(worstMs);
|
|
378
|
+
}, SAMPLE_MS);
|
|
379
|
+
timer.unref();
|
|
380
|
+
return () => {
|
|
381
|
+
clearInterval(timer);
|
|
382
|
+
histogram.disable();
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// src/commands/ai/interactive/window.ts
|
|
387
|
+
import { createInterface } from "node:readline/promises";
|
|
388
|
+
import { stdin as input, stdout as output } from "node:process";
|
|
389
|
+
|
|
390
|
+
// src/turn/vendor-commands-probe.ts
|
|
391
|
+
var ASK_AGAIN_MS = 7 * 24 * 36e5;
|
|
392
|
+
var ANNOUNCE_WAIT_MS = 3e3;
|
|
393
|
+
var asking = /* @__PURE__ */ new Set();
|
|
394
|
+
async function probeVendorCommands(harness, account, now = Date.now()) {
|
|
395
|
+
if (!harness?.acp || !account || account.status !== "ready" || asking.has(harness.command)) return false;
|
|
396
|
+
const checked = vendorCommandsCheckedAt(harness.command);
|
|
397
|
+
if (checked !== void 0 && (knownVendorCommands(harness.command).length || now - checked < ASK_AGAIN_MS)) return false;
|
|
398
|
+
asking.add(harness.command);
|
|
399
|
+
try {
|
|
400
|
+
let heard;
|
|
401
|
+
const environment = nativeProfileEnvironment(account.nativeProfile);
|
|
402
|
+
if (!await mayRunInBackground(harness, environment)) {
|
|
403
|
+
await markAccountNeedsSignIn(account);
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
const held = `commands:${harness.command}:${account.nativeProfile?.path ?? account.id}`;
|
|
407
|
+
if (await heldOff(held, now)) return false;
|
|
408
|
+
const answered = await queryAcp(
|
|
409
|
+
harness.acp.binary ?? harness.binary,
|
|
410
|
+
[...harness.acp.argv, ...await acpProbeArgv(harness, account)],
|
|
411
|
+
environment,
|
|
412
|
+
async (request) => {
|
|
413
|
+
await acpDiscoverySession(request);
|
|
414
|
+
for (let waited = 0; !heard && waited < ANNOUNCE_WAIT_MS; waited += 100) await sleep(100);
|
|
415
|
+
return true;
|
|
416
|
+
},
|
|
417
|
+
2e4,
|
|
418
|
+
{
|
|
419
|
+
gate: harness,
|
|
420
|
+
discovery: harness,
|
|
421
|
+
onNotification: (method, params) => {
|
|
422
|
+
if (method !== "session/update" || !params?.update) return;
|
|
423
|
+
const commands = acpAvailableCommands(params.update);
|
|
424
|
+
if (commands?.length) heard = commands;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
);
|
|
428
|
+
await recordBackgroundOutcome(held, answered ? "ok" : "failed", now);
|
|
429
|
+
if (answered) await rememberVendorCommands(harness.command, heard ?? [], { probed: true });
|
|
430
|
+
return Boolean(heard?.length);
|
|
431
|
+
} catch (error) {
|
|
432
|
+
quiet("turn/vendor-commands-probe")(error);
|
|
433
|
+
return false;
|
|
434
|
+
} finally {
|
|
435
|
+
asking.delete(harness.command);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// src/commands/ai/build-replace.ts
|
|
440
|
+
import { spawnSync } from "node:child_process";
|
|
441
|
+
import { stdout } from "node:process";
|
|
442
|
+
function relaunchArgv(entry, sessionId) {
|
|
443
|
+
return sessionId ? [entry, "sessions", "resume", sessionId] : [entry];
|
|
444
|
+
}
|
|
445
|
+
var replacing;
|
|
446
|
+
function replaceCliWithNewBuild(input2) {
|
|
447
|
+
if (replacing) return replacing;
|
|
448
|
+
const entry = input2.entry ?? process.argv[1];
|
|
449
|
+
if (!entry || fileLocksHeld()) return void 0;
|
|
450
|
+
const sessionId = input2.sessionId || void 0;
|
|
451
|
+
if (input2.draft && input2.draft.id === sessionId) process.env[REEXEC_DRAFT_ENV] = JSON.stringify(input2.draft);
|
|
452
|
+
replacing = (async () => {
|
|
453
|
+
try {
|
|
454
|
+
await input2.release();
|
|
455
|
+
} catch (error) {
|
|
456
|
+
swallowed("commands/ai/build-replace", error);
|
|
457
|
+
}
|
|
458
|
+
const handOverTyped = () => {
|
|
459
|
+
let text = "";
|
|
460
|
+
try {
|
|
461
|
+
text = input2.typed?.() ?? "";
|
|
462
|
+
} catch {
|
|
463
|
+
}
|
|
464
|
+
if (text) process.env[REEXEC_TYPED_ENV] = text;
|
|
465
|
+
else delete process.env[REEXEC_TYPED_ENV];
|
|
466
|
+
};
|
|
467
|
+
if (typeof process.execve === "function") {
|
|
468
|
+
await new Promise((resolve) => stdout.write(popKittyKeyboard(), () => resolve()));
|
|
469
|
+
await fileLocksIdle();
|
|
470
|
+
handOverTyped();
|
|
471
|
+
try {
|
|
472
|
+
process.execve(
|
|
473
|
+
process.execPath,
|
|
474
|
+
[process.execPath, ...relaunchArgv(entry, sessionId)],
|
|
475
|
+
{ ...process.env, [REEXEC_TERMINAL_ENV]: reexecHandover() }
|
|
476
|
+
);
|
|
477
|
+
} catch (error) {
|
|
478
|
+
swallowed("commands/ai/build-replace", error);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
historyDump.suppressed = true;
|
|
482
|
+
try {
|
|
483
|
+
input2.closeUi();
|
|
484
|
+
} catch (error) {
|
|
485
|
+
swallowed("commands/ai/build-replace", error);
|
|
486
|
+
}
|
|
487
|
+
await fileLocksIdle();
|
|
488
|
+
handOverTyped();
|
|
489
|
+
let status = 1;
|
|
490
|
+
try {
|
|
491
|
+
const result = spawnSync(process.execPath, relaunchArgv(entry, sessionId), { stdio: "inherit" });
|
|
492
|
+
status = result.status ?? 1;
|
|
493
|
+
} finally {
|
|
494
|
+
process.exit(status);
|
|
495
|
+
}
|
|
496
|
+
})();
|
|
497
|
+
return replacing;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// src/commands/ai/interactive/window.ts
|
|
501
|
+
async function openWindow(config, startId) {
|
|
502
|
+
let id = startId;
|
|
503
|
+
let state = await readState({ transcripts: [id] });
|
|
504
|
+
let session = state.sessions.find((item) => item.id === id);
|
|
505
|
+
if (!session) throw new Error(`AI session "${id}" was not found`);
|
|
506
|
+
const ref = { id, paletteState: state };
|
|
507
|
+
const slashCommandsFor = (target) => {
|
|
508
|
+
return conversationCommands(target, ref.paletteState);
|
|
509
|
+
};
|
|
510
|
+
const terminal = terminalUiSupported() ? new TerminalHarnessPrompter() : void 0;
|
|
511
|
+
const handedTyped = adoptHandedOverTyped();
|
|
512
|
+
if (terminal && handedTyped) terminal.restoreDraft(handedTyped);
|
|
513
|
+
const rl = terminal ?? createInterface({
|
|
514
|
+
input,
|
|
515
|
+
output,
|
|
516
|
+
terminal: false,
|
|
517
|
+
historySize: 1e3,
|
|
518
|
+
removeHistoryDuplicates: true,
|
|
519
|
+
completer: (value) => {
|
|
520
|
+
const fallbackCommands = slashCommandsFor(session).map((item) => item.value);
|
|
521
|
+
const matches = fallbackCommands.filter((command) => command.startsWith(value));
|
|
522
|
+
return [matches.length ? matches : fallbackCommands, value];
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
if (terminal) TERMINAL.active = terminal;
|
|
526
|
+
terminal?.render(session);
|
|
527
|
+
let selectionNotice;
|
|
528
|
+
if (!session.nativeHarness && !isClikCodeAgent(session)) {
|
|
529
|
+
try {
|
|
530
|
+
const auto = await autoSelectSessionHarness(id);
|
|
531
|
+
if (!auto) {
|
|
532
|
+
const selected = await interactiveEnginePicker(config, rl, id);
|
|
533
|
+
if (selected && selected !== id) {
|
|
534
|
+
id = selected;
|
|
535
|
+
ref.id = id;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
} catch (error) {
|
|
539
|
+
selectionNotice = error instanceof Error ? error.message : String(error);
|
|
540
|
+
}
|
|
541
|
+
state = await readState({ transcripts: [id] });
|
|
542
|
+
const next = state.sessions.find((item) => item.id === id);
|
|
543
|
+
if (!next) return void 0;
|
|
544
|
+
session = next;
|
|
545
|
+
}
|
|
546
|
+
if (activateSession(session)) await writeState(state);
|
|
547
|
+
await resolveSessionModel(id);
|
|
548
|
+
await claimConversation(id);
|
|
549
|
+
state = await readState({ transcripts: [id] });
|
|
550
|
+
const opened = state.sessions.find((item) => item.id === id);
|
|
551
|
+
if (!opened) return void 0;
|
|
552
|
+
session = opened;
|
|
553
|
+
const initialAccount = session.accountId ? state.accounts.find((account) => account.id === session.accountId)?.label : void 0;
|
|
554
|
+
const warmCatalogFor = createCatalogWarmer((target) => terminal?.refreshPaletteCommands(slashCommandsFor(target)));
|
|
555
|
+
warmCatalogFor(session, state);
|
|
556
|
+
if (terminal) {
|
|
557
|
+
terminal.render(session, initialAccount);
|
|
558
|
+
if (selectionNotice) terminal.activity(selectionNotice);
|
|
559
|
+
} else emitHarnessOutput({ status: "ready", session, account: initialAccount });
|
|
560
|
+
const refreshUsage = createUsageRefresher(config, terminal);
|
|
561
|
+
const stopLockNotices = terminal ? followModelDownloads(terminal) : void 0;
|
|
562
|
+
refreshUsage(session, state);
|
|
563
|
+
const { beginBuildReplace, releaseWindow } = startBuildWatch(terminal, ref, refreshUsage, stopLockNotices);
|
|
564
|
+
if (terminal) void import("./chunk-FFGKN6L3.js").then((remote) => remote.holdWindowMachines()).then((held) => held.release()).catch(quiet("commands/ai/interactive/window"));
|
|
565
|
+
return { config, terminal, rl, ref, session, slashCommandsFor, warmCatalogFor, refreshUsage, beginBuildReplace, releaseWindow };
|
|
566
|
+
}
|
|
567
|
+
function createCatalogWarmer(onCommands) {
|
|
568
|
+
let warmedCatalogKey = "";
|
|
569
|
+
return (target, targetState) => {
|
|
570
|
+
const key = `${target.nativeHarness ?? ""}\0${target.provider ?? ""}\0${target.accountId ?? ""}`;
|
|
571
|
+
if (key === warmedCatalogKey) return;
|
|
572
|
+
warmedCatalogKey = key;
|
|
573
|
+
const harness = sessionOrProviderHarness(target);
|
|
574
|
+
const account = target.accountId ? targetState.accounts.find((item) => item.id === target.accountId) : void 0;
|
|
575
|
+
warmNativeModelCatalog(harness, account);
|
|
576
|
+
void probeVendorCommands(harness, account).then((learnt) => {
|
|
577
|
+
if (learnt) onCommands?.(target);
|
|
578
|
+
});
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
function createUsageRefresher(config, terminal) {
|
|
582
|
+
return (target, targetState, afterTurn = false) => {
|
|
583
|
+
if (!terminal) return;
|
|
584
|
+
if (isGatewayService(target)) {
|
|
585
|
+
void gatewayCreditLabel(config, { fresh: afterTurn }).then((label) => {
|
|
586
|
+
const status = gatewayConversationUsageLabel(conversationCost(targetState, target.id), label);
|
|
587
|
+
if (TERMINAL.active === terminal) terminal.usage(status);
|
|
588
|
+
}).catch(quiet("commands/ai/interactive/window"));
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
void nativeUsageReading(target, targetState).then((reading) => {
|
|
592
|
+
if (TERMINAL.active === terminal) terminal.usage(reading?.label, target.resumeAt ? resumeWaitLabel(target.resumeAt) : usageResetLabel(reading?.windows));
|
|
593
|
+
}).catch(quiet("commands/ai/interactive/window"));
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
function settledBuild() {
|
|
597
|
+
const pause = new Int32Array(new SharedArrayBuffer(4));
|
|
598
|
+
for (let attempt = 0; attempt < 50; attempt += 1) {
|
|
599
|
+
const build = currentWorkerBuild();
|
|
600
|
+
if (build !== void 0) return build;
|
|
601
|
+
Atomics.wait(pause, 0, 0, 20);
|
|
602
|
+
}
|
|
603
|
+
return void 0;
|
|
604
|
+
}
|
|
605
|
+
function startBuildWatch(terminal, ref, refreshUsage, stopLockNotices) {
|
|
606
|
+
const startupBuild = settledBuild();
|
|
607
|
+
let updateSeen = false;
|
|
608
|
+
let usageInterval;
|
|
609
|
+
const releaseWindow = async () => {
|
|
610
|
+
registerBuildReplacer(void 0);
|
|
611
|
+
if (usageInterval) clearInterval(usageInterval);
|
|
612
|
+
stopLockNotices?.();
|
|
613
|
+
await closeAllWorkerClients().catch(quiet("commands/ai/interactive/window"));
|
|
614
|
+
await closePersistentTransport().catch(quiet("commands/ai/interactive/window"));
|
|
615
|
+
await import("./chunk-FFGKN6L3.js").then((remote) => remote.closeWindowMachines()).catch(quiet("commands/ai/interactive/window"));
|
|
616
|
+
await reconcileLocalModelLeases(void 0).catch(quiet("commands/ai/interactive/window"));
|
|
617
|
+
};
|
|
618
|
+
const newerBuild = () => Boolean(startupBuild && currentWorkerBuild() !== startupBuild);
|
|
619
|
+
const beginBuildReplace = (force = false) => {
|
|
620
|
+
if (!terminal || !force && !newerBuild()) return void 0;
|
|
621
|
+
const sessionId = ref.id;
|
|
622
|
+
const draft = ephemeralSession(sessionId);
|
|
623
|
+
return replaceCliWithNewBuild({
|
|
624
|
+
sessionId,
|
|
625
|
+
...draft ? { draft } : {},
|
|
626
|
+
closeUi: () => terminal.close(),
|
|
627
|
+
typed: () => terminal.composer.text,
|
|
628
|
+
release: async () => {
|
|
629
|
+
await releaseWindow();
|
|
630
|
+
await releaseConversationClaim(sessionId).catch(quiet("commands/ai/interactive/window"));
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
};
|
|
634
|
+
registerBuildReplacer(() => beginBuildReplace(startupBuild === void 0));
|
|
635
|
+
let waitingSince;
|
|
636
|
+
let toldWaiting = false;
|
|
637
|
+
const noteNewerBuild = () => {
|
|
638
|
+
if (!newerBuild()) return;
|
|
639
|
+
if (!updateSeen) {
|
|
640
|
+
updateSeen = true;
|
|
641
|
+
waitingSince = Date.now();
|
|
642
|
+
void retireStaleWorkers().catch(quiet("commands/ai/interactive/window"));
|
|
643
|
+
}
|
|
644
|
+
if (terminal?.idleForBuildReplace()) {
|
|
645
|
+
void beginBuildReplace();
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
if (terminal && shouldTellStale(waitingSince, toldWaiting, Date.now())) {
|
|
649
|
+
toldWaiting = true;
|
|
650
|
+
terminal.activity("ClikCode or its shared tool configuration changed while this window was busy. /restart reloads it; the chat stays and what is running keeps running.");
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
usageInterval = terminal ? setInterval(() => {
|
|
654
|
+
noteNewerBuild();
|
|
655
|
+
if (terminal.lookedAway()) return;
|
|
656
|
+
void readState({ transcripts: [] }).then((latestState) => {
|
|
657
|
+
const latest = latestState.sessions.find((item) => item.id === ref.id);
|
|
658
|
+
if (latest) refreshUsage(latest, latestState);
|
|
659
|
+
return recheckRecoveredAccounts(latestState);
|
|
660
|
+
}).catch(quiet("commands/ai/interactive/window"));
|
|
661
|
+
}, 15e3) : void 0;
|
|
662
|
+
return { releaseWindow, beginBuildReplace };
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// src/commands/ai/interactive/loop.ts
|
|
666
|
+
import { randomUUID } from "node:crypto";
|
|
667
|
+
|
|
668
|
+
// src/commands/ai/interactive/turn-failure.ts
|
|
669
|
+
async function turnFailureEffect({ terminal, id, guard, refreshUsage }, error, failed) {
|
|
670
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
671
|
+
lifecycle("window.turn.error", { message: message.slice(0, 8e3) });
|
|
672
|
+
if (signInOutcomeSaid(error)) return {};
|
|
673
|
+
const said = Boolean(error?.said);
|
|
674
|
+
const next = await afterTurnFailure(terminal && offerResumeIn(terminal), id, error, { ...failed, guard });
|
|
675
|
+
if (next.cancelled && terminal) return {};
|
|
676
|
+
if (!terminal) {
|
|
677
|
+
emitHarnessOutput({ panel: "error", message: failureText(message) });
|
|
678
|
+
return {};
|
|
679
|
+
}
|
|
680
|
+
if ("retry" in next) return { resend: next.retry };
|
|
681
|
+
if ("moved" in next) return { id: next.moved.id, resend: next.moved.prompt };
|
|
682
|
+
if (next.waiting) {
|
|
683
|
+
refreshSessionWorker(id);
|
|
684
|
+
const parkedState = await readState({ transcripts: [] });
|
|
685
|
+
const parked = parkedState.sessions.find((item) => item.id === id);
|
|
686
|
+
if (parked) refreshUsage(parked, parkedState);
|
|
687
|
+
return {};
|
|
688
|
+
}
|
|
689
|
+
if (next.back.length) terminal?.restoreDraft(next.back.join("\n\n"));
|
|
690
|
+
if (said) return {};
|
|
691
|
+
const notice = isUsageExhaustedMessage(message) ? `${message}${await usageBackPhrase(id)}` : source_default.red(`Error: ${failureText(message)}`);
|
|
692
|
+
return { notice };
|
|
693
|
+
}
|
|
694
|
+
async function usageBackPhrase(chat) {
|
|
695
|
+
const state = await readState({ transcripts: [] });
|
|
696
|
+
const provider = state.sessions.find((item) => item.id === chat)?.provider;
|
|
697
|
+
const reset = provider ? nextQuotaReset(state.accounts.filter((account) => account.provider === provider)) : void 0;
|
|
698
|
+
return reset ? ` \xB7 back ${quotaResetPhrase(reset)}` : "";
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
// src/commands/ai/interactive/run-turn.ts
|
|
702
|
+
import { stdout as output2 } from "node:process";
|
|
703
|
+
async function runTimedTurn({ config, terminal, lastSeen }, targetId, promptText, turn) {
|
|
704
|
+
terminal?.submitted(turn.echo ? promptText : void 0);
|
|
705
|
+
const signedIn = terminal ? await signInBeforeUse(targetId).catch((error) => {
|
|
706
|
+
if (signInOutcomeSaid(error)) {
|
|
707
|
+
terminal.submitted(void 0);
|
|
708
|
+
if (turn.echo) terminal.restoreDraft(promptText);
|
|
709
|
+
}
|
|
710
|
+
throw error;
|
|
711
|
+
}) : false;
|
|
712
|
+
if (terminal && signedIn) terminal.turnStarting();
|
|
713
|
+
const { state: activeState, active } = await prepareTurn(targetId);
|
|
714
|
+
const activeAccount = active?.accountId ? activeState.accounts.find((item) => item.id === active.accountId)?.label : void 0;
|
|
715
|
+
if (active && terminal) {
|
|
716
|
+
const pending = {
|
|
717
|
+
...active,
|
|
718
|
+
messages: sessionTranscriptMessages(active),
|
|
719
|
+
pendingTurn: void 0,
|
|
720
|
+
...turn.queuedTurnId ? { queuedTurns: active.queuedTurns?.filter((item) => item.id !== turn.queuedTurnId) } : {}
|
|
721
|
+
};
|
|
722
|
+
terminal.render(pending, activeAccount);
|
|
723
|
+
let left = false;
|
|
724
|
+
try {
|
|
725
|
+
const outcome = await runTurnThroughWorker(targetId, terminal, promptText, turn);
|
|
726
|
+
left = Boolean(outcome.left);
|
|
727
|
+
return outcome.left ? { left: true } : {};
|
|
728
|
+
} finally {
|
|
729
|
+
if (!left) await holdLocalModelAfterTurn(targetId).catch(quiet("commands/ai/interactive/run-turn"));
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
output2.write(`${source_default.dim(`${active ? sessionProviderLabel(active) : "Provider"} \xB7 working\u2026`)}
|
|
733
|
+
`);
|
|
734
|
+
await runSessionTurn(config, targetId, promptText, void 0, {
|
|
735
|
+
persistentTransports: true,
|
|
736
|
+
...turn.queuedTurnId ? { queuedTurnId: turn.queuedTurnId } : {}
|
|
737
|
+
});
|
|
738
|
+
return {};
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
// src/commands/ai/interactive/slash-host.ts
|
|
742
|
+
async function showSession(terminal, target) {
|
|
743
|
+
const shown = await readState({ transcripts: [target] });
|
|
744
|
+
const session = shown.sessions.find((item) => item.id === target);
|
|
745
|
+
if (session) terminal?.render(session, session.accountId ? shown.accounts.find((item) => item.id === session.accountId)?.label : void 0);
|
|
746
|
+
}
|
|
747
|
+
async function openConversationPicker({ rl, terminal, beginBuildReplace, dispatch }, id) {
|
|
748
|
+
let fresh;
|
|
749
|
+
for (; ; ) {
|
|
750
|
+
const state = await readState({ transcripts: [] });
|
|
751
|
+
const target = state.sessions.find((item) => item.id === (fresh ?? id));
|
|
752
|
+
if (!target) return { id };
|
|
753
|
+
const picked = await interactiveSessionPicker(rl, fresh ?? id, conversationCommands(target, state), {
|
|
754
|
+
// Running rows were on screen and have finished, and the
|
|
755
|
+
// composer is empty. Leave only when a newer build is waiting.
|
|
756
|
+
onSessionsSettled: () => Boolean(beginBuildReplace())
|
|
757
|
+
});
|
|
758
|
+
if (picked && "command" in picked) {
|
|
759
|
+
fresh ??= await newConversation(id, { sameModel: true });
|
|
760
|
+
const outcome = await dispatch(fresh, picked.command);
|
|
761
|
+
if (outcome.exit || outcome.remote || outcome.prompt !== void 0 || outcome.draft !== void 0 || outcome.id && outcome.id !== fresh) {
|
|
762
|
+
if (outcome.exit || outcome.remote || outcome.id && outcome.id !== fresh) await leaveConversation(fresh);
|
|
763
|
+
return { ...outcome, id: outcome.id ?? fresh };
|
|
764
|
+
}
|
|
765
|
+
if (outcome.notice) terminal?.activity(outcome.notice);
|
|
766
|
+
await showSession(terminal, fresh);
|
|
767
|
+
continue;
|
|
768
|
+
}
|
|
769
|
+
if (picked && "notice" in picked) {
|
|
770
|
+
if (fresh) await leaveConversation(fresh);
|
|
771
|
+
if (fresh) await showSession(terminal, id);
|
|
772
|
+
return { id, notice: picked.notice };
|
|
773
|
+
}
|
|
774
|
+
if (picked && "compose" in picked) return { id: fresh ?? await newConversation(id, { sameModel: true }), prompt: picked.compose, echo: true };
|
|
775
|
+
if (picked && "new" in picked) return { id: fresh ?? await newConversation(id, { sameModel: true }) };
|
|
776
|
+
if (picked && "remote" in picked) {
|
|
777
|
+
if (fresh) await leaveConversation(fresh);
|
|
778
|
+
return { remote: picked.remote, ...picked.draft ? { draft: picked.draft } : {} };
|
|
779
|
+
}
|
|
780
|
+
if (picked) {
|
|
781
|
+
if (fresh && picked.id !== fresh) await leaveConversation(fresh);
|
|
782
|
+
return { id: picked.id, ...picked.draft ? { draft: picked.draft } : {} };
|
|
783
|
+
}
|
|
784
|
+
if (fresh) {
|
|
785
|
+
await leaveConversation(fresh);
|
|
786
|
+
await showSession(terminal, id);
|
|
787
|
+
}
|
|
788
|
+
return { id };
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
async function runShellInChat(terminal, id, command, lastSeen) {
|
|
792
|
+
const controller = new AbortController();
|
|
793
|
+
terminal?.submitted(`!${command}`);
|
|
794
|
+
terminal?.render(lastSeen, void 0, { running: false });
|
|
795
|
+
let result;
|
|
796
|
+
try {
|
|
797
|
+
result = await withSlowWait(terminal, `! ${command}`, () => runShellLine(id, command, controller.signal), () => controller.abort());
|
|
798
|
+
} finally {
|
|
799
|
+
terminal?.submitted(void 0);
|
|
800
|
+
}
|
|
801
|
+
if (!terminal) emitHarnessOutput({ panel: "shell", text: shellMessageContent(result) });
|
|
802
|
+
}
|
|
803
|
+
function createSlashHost({ config, rl, terminal, runTurn, openConversationPicker: openPicker }) {
|
|
804
|
+
const withWaiting = (label, work) => withSlowWait(terminal, label, work);
|
|
805
|
+
return {
|
|
806
|
+
config,
|
|
807
|
+
prompter: rl,
|
|
808
|
+
canPick: Boolean(terminal),
|
|
809
|
+
panel: (kind, title, body, plain) => {
|
|
810
|
+
if (terminal) terminal.panel(title, body);
|
|
811
|
+
else emitHarnessOutput({ panel: kind, text: plain });
|
|
812
|
+
},
|
|
813
|
+
withBusy: withWaiting,
|
|
814
|
+
ask: (label) => rl.question(`${label} \u203A `, void 0, { cancellable: true }).catch((error) => {
|
|
815
|
+
if (error.code === "ERR_PROMPT_CANCELLED") return void 0;
|
|
816
|
+
throw error;
|
|
817
|
+
}),
|
|
818
|
+
redraw: (target) => showSession(terminal, target),
|
|
819
|
+
runTurn,
|
|
820
|
+
openConversationPicker: openPicker,
|
|
821
|
+
editFile: async (path, cwd) => {
|
|
822
|
+
const editor = process.env.VISUAL || process.env.EDITOR || (process.platform === "win32" ? "notepad" : "vi");
|
|
823
|
+
const [editorBinary = "vi", ...editorArgs] = editor.split(/\s+/).filter(Boolean);
|
|
824
|
+
await terminal?.suspend();
|
|
825
|
+
try {
|
|
826
|
+
await new Promise((resolveEdit, rejectEdit) => {
|
|
827
|
+
const child = spawnPortable(editorBinary, [...editorArgs, path], { stdio: "inherit", cwd });
|
|
828
|
+
child.once("error", rejectEdit);
|
|
829
|
+
child.once("exit", () => resolveEdit());
|
|
830
|
+
});
|
|
831
|
+
} finally {
|
|
832
|
+
terminal?.resume();
|
|
833
|
+
}
|
|
834
|
+
},
|
|
835
|
+
...terminal ? {
|
|
836
|
+
runManager: async (harness, _label, argv, environment) => {
|
|
837
|
+
await terminal.suspend();
|
|
838
|
+
try {
|
|
839
|
+
await runNativeHarnessCommand(harness, argv, environment);
|
|
840
|
+
} finally {
|
|
841
|
+
terminal.resume();
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
} : {
|
|
845
|
+
attached: (attachments) => emitHarnessOutput({ panel: "attachments", attachments })
|
|
846
|
+
},
|
|
847
|
+
...terminal ? {
|
|
848
|
+
// /machine: the chat moves to the machine chosen (remote/move-terminal.ts).
|
|
849
|
+
moveToMachine: async (id) => {
|
|
850
|
+
const { localMoveEnd, moveTerminalChat } = await import("./chunk-OLUO5DDR.js");
|
|
851
|
+
const { chatHasContent } = await import("./chunk-FCGEB3H6.js");
|
|
852
|
+
const session = (await readState({ transcripts: [id] })).sessions.find((item) => item.id === id);
|
|
853
|
+
if (!session) throw new Error(`AI session "${id}" was not found`);
|
|
854
|
+
const next = await moveTerminalChat(rl, { local: id }, id, chatHasContent(session), localMoveEnd());
|
|
855
|
+
if (!next) return {};
|
|
856
|
+
return "local" in next ? { id: next.local } : { remote: next.remote };
|
|
857
|
+
}
|
|
858
|
+
} : {},
|
|
859
|
+
...terminal ? {
|
|
860
|
+
browseSearch: (query) => browseSearch(terminal, query, withWaiting),
|
|
861
|
+
walkTurns: (turns, start) => walkTurns(terminal, turns, start)
|
|
862
|
+
} : {}
|
|
863
|
+
};
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
// src/commands/ai/interactive/loop.ts
|
|
867
|
+
var ChatLoop = class {
|
|
868
|
+
constructor(w) {
|
|
869
|
+
this.w = w;
|
|
870
|
+
({
|
|
871
|
+
terminal: this.terminal,
|
|
872
|
+
rl: this.rl,
|
|
873
|
+
config: this.config,
|
|
874
|
+
slashCommandsFor: this.slashCommandsFor,
|
|
875
|
+
warmCatalogFor: this.warmCatalogFor,
|
|
876
|
+
refreshUsage: this.refreshUsage,
|
|
877
|
+
beginBuildReplace: this.beginBuildReplace,
|
|
878
|
+
releaseWindow: this.releaseWindow
|
|
879
|
+
} = w);
|
|
880
|
+
this.lastSeen = w.session;
|
|
881
|
+
this.transportSessionId = w.ref.id;
|
|
882
|
+
if (this.terminal) this.terminal.pickDuringTurn = async (line) => {
|
|
883
|
+
const { terminal, rl, config, beginBuildReplace } = this;
|
|
884
|
+
const host = createSlashHost({
|
|
885
|
+
config,
|
|
886
|
+
rl,
|
|
887
|
+
terminal,
|
|
888
|
+
runTurn: (targetId, promptText) => this.runInteractiveTurn(targetId, promptText, { echo: false }),
|
|
889
|
+
openConversationPicker: () => openConversationPicker({ rl, terminal, beginBuildReplace, dispatch: (id, command) => dispatchLine(host, id, command) }, this.id)
|
|
890
|
+
});
|
|
891
|
+
const outcome = await dispatchLine(host, this.id, line);
|
|
892
|
+
if (outcome.notice) terminal?.activity(outcome.notice);
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
w;
|
|
896
|
+
/** The conversation as this window last read it: what a fresh one copies
|
|
897
|
+
* its setup from when this one is deleted under it. */
|
|
898
|
+
lastSeen;
|
|
899
|
+
/** A message to send next, without asking: the one that ran out of usage,
|
|
900
|
+
* after "Resume in" moved the chat to a harness that has some. */
|
|
901
|
+
resend;
|
|
902
|
+
/** Left was pressed during a turn: the board opens next, with the turn
|
|
903
|
+
* still running behind it (see startWaiting's onLeave). */
|
|
904
|
+
openBoard = false;
|
|
905
|
+
/** The same-provider retry after running out, at most once per
|
|
906
|
+
* interrupted turn, so a record that keeps flipping cannot loop. */
|
|
907
|
+
exhaustionGuard = {};
|
|
908
|
+
synchronizedSessionId = "";
|
|
909
|
+
transportSessionId;
|
|
910
|
+
/** `<session id> <route>` this terminal last prepared a worker for. */
|
|
911
|
+
preparedRoute;
|
|
912
|
+
/** What this terminal last read of the conversation's settings: a change
|
|
913
|
+
* between two reads (a /account, /model, sign-in) is sent to the worker so
|
|
914
|
+
* every other window attached to it re-renders. */
|
|
915
|
+
shownSettings;
|
|
916
|
+
shownLiveSettings;
|
|
917
|
+
/** One line for the transcript after the next frame: the answer to a command the user just ran. */
|
|
918
|
+
notice;
|
|
919
|
+
/** /exit was typed in a chat on another machine: this window closes. */
|
|
920
|
+
leaving = false;
|
|
921
|
+
/** What this pass's turn actually sent, when a slash command expanded
|
|
922
|
+
* the line (/review): what an interrupted turn recorded is compared to. */
|
|
923
|
+
sentPrompt;
|
|
924
|
+
terminal;
|
|
925
|
+
rl;
|
|
926
|
+
config;
|
|
927
|
+
slashCommandsFor;
|
|
928
|
+
warmCatalogFor;
|
|
929
|
+
refreshUsage;
|
|
930
|
+
beginBuildReplace;
|
|
931
|
+
releaseWindow;
|
|
932
|
+
/** The conversation this window is on: shared with the setup's timers. */
|
|
933
|
+
get id() {
|
|
934
|
+
return this.w.ref.id;
|
|
935
|
+
}
|
|
936
|
+
set id(value) {
|
|
937
|
+
this.w.ref.id = value;
|
|
938
|
+
}
|
|
939
|
+
/** A turn failed: what it changes is decided in turn-failure.ts, applied here. */
|
|
940
|
+
async handleTurnFailure(error, failed) {
|
|
941
|
+
const effect = await turnFailureEffect({ terminal: this.terminal, id: this.id, guard: this.exhaustionGuard, refreshUsage: this.refreshUsage }, error, failed);
|
|
942
|
+
if ("notice" in effect) this.notice = effect.notice;
|
|
943
|
+
if ("resend" in effect) this.resend = effect.resend;
|
|
944
|
+
if (effect.id !== void 0) this.id = effect.id;
|
|
945
|
+
}
|
|
946
|
+
async run() {
|
|
947
|
+
const { terminal, rl, releaseWindow } = this;
|
|
948
|
+
try {
|
|
949
|
+
if (terminal) await this.followMoved(terminal);
|
|
950
|
+
while (!this.leaving) {
|
|
951
|
+
this.sentPrompt = void 0;
|
|
952
|
+
if (this.transportSessionId !== this.id) {
|
|
953
|
+
const leaving = this.transportSessionId;
|
|
954
|
+
nativeAvailableCommands.delete(leaving);
|
|
955
|
+
this.transportSessionId = this.id;
|
|
956
|
+
void closePersistentTransport(leaving);
|
|
957
|
+
}
|
|
958
|
+
const next = await this.readNext();
|
|
959
|
+
if (next === "exit") break;
|
|
960
|
+
if (next === "continue") continue;
|
|
961
|
+
if (await this.handleLine(next) === "exit" || this.leaving) break;
|
|
962
|
+
}
|
|
963
|
+
} finally {
|
|
964
|
+
await releaseWindow();
|
|
965
|
+
await leaveConversation(this.id);
|
|
966
|
+
if (TERMINAL.active === terminal) TERMINAL.active = void 0;
|
|
967
|
+
rl.close();
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
async readNext() {
|
|
971
|
+
try {
|
|
972
|
+
return await this.readNextInner();
|
|
973
|
+
} catch (error) {
|
|
974
|
+
if (error.code === "ERR_USE_AFTER_CLOSE") return "exit";
|
|
975
|
+
throw error;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
async readNextInner() {
|
|
979
|
+
const { terminal, refreshUsage } = this;
|
|
980
|
+
const queueMark = terminal ? await workerQueueMark(this.id) : void 0;
|
|
981
|
+
const latestState = await readState({ transcripts: [this.id] });
|
|
982
|
+
const latest = latestState.sessions.find((item) => item.id === this.id);
|
|
983
|
+
if (!latest) {
|
|
984
|
+
if (!await conversationWasDeleted(this.id)) {
|
|
985
|
+
throw new Error(`Conversation ${this.id} is no longer listed in ClikCode's index, but was not deleted. Nothing was removed: run \`clikcode sessions audit\` and \`clikcode sessions repair ${this.id}\`.`);
|
|
986
|
+
}
|
|
987
|
+
this.id = await newConversation(this.lastSeen.id, { sameModel: true, lastSeen: this.lastSeen });
|
|
988
|
+
await claimConversation(this.id).catch(quiet("commands/ai/interactive/loop"));
|
|
989
|
+
diagnostic("window.conversation-deleted", DELETED_ELSEWHERE);
|
|
990
|
+
return "continue";
|
|
991
|
+
}
|
|
992
|
+
const account = await this.prepareRound(latest, latestState);
|
|
993
|
+
const running = terminal ? await workerTurn(latest.id) : void 0;
|
|
994
|
+
terminal?.render(latest, account, running ? { running: true, following: true, ...running } : { running: false });
|
|
995
|
+
refreshUsage(latest, latestState, true);
|
|
996
|
+
if (this.notice) terminal?.activity(this.notice);
|
|
997
|
+
this.notice = void 0;
|
|
998
|
+
if (this.synchronizedSessionId !== this.id) {
|
|
999
|
+
const syncId = this.id;
|
|
1000
|
+
this.synchronizedSessionId = syncId;
|
|
1001
|
+
void synchronizeNativeTranscript(latestState, latest).then(async (changed) => {
|
|
1002
|
+
if (!changed || syncId !== this.id) return;
|
|
1003
|
+
await writeState(latestState);
|
|
1004
|
+
if (syncId === this.id) terminal?.render(latest, account, running ? { running: true, ...running } : { running: false });
|
|
1005
|
+
}).catch(quiet("commands/ai/interactive/loop"));
|
|
1006
|
+
}
|
|
1007
|
+
return this.pickLine(latest, latestState, account, running, queueMark);
|
|
1008
|
+
}
|
|
1009
|
+
async prepareRound(latest, latestState) {
|
|
1010
|
+
const { terminal, warmCatalogFor, refreshUsage } = this;
|
|
1011
|
+
this.lastSeen = latest;
|
|
1012
|
+
warmCatalogFor(latest, latestState);
|
|
1013
|
+
await reconcileLocalModelLeases(latest);
|
|
1014
|
+
const routeKey = `${latest.id} ${latest.route} ${latest.nativeHarness ?? ""} ${latest.accountId ?? ""}`;
|
|
1015
|
+
if (routeKey !== this.preparedRoute) {
|
|
1016
|
+
const leftId = this.preparedRoute?.split(" ")[0];
|
|
1017
|
+
if (leftId && leftId !== latest.id) releaseSessionWorker(leftId);
|
|
1018
|
+
this.preparedRoute = routeKey;
|
|
1019
|
+
void prepareSessionWorker(latest.id, { spawn: isClikCodeAgent(latest) }).catch(quiet("commands/ai/interactive/loop"));
|
|
1020
|
+
if (shouldWarmVendorChat(latest)) {
|
|
1021
|
+
void warmSessionWorker(latest.id).catch(quiet("commands/ai/interactive/loop"));
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
const settingsKey = shownSettingsKey(latest);
|
|
1025
|
+
if (this.shownSettings?.startsWith(`${latest.id}|`) && this.shownSettings !== settingsKey) refreshSessionWorker(latest.id);
|
|
1026
|
+
this.shownSettings = settingsKey;
|
|
1027
|
+
const liveKey = `${latest.id}|${JSON.stringify(liveSettingsOf(latest))}`;
|
|
1028
|
+
if (this.shownLiveSettings?.startsWith(`${latest.id}|`) && this.shownLiveSettings !== liveKey) pushSessionSettings(latest);
|
|
1029
|
+
this.shownLiveSettings = liveKey;
|
|
1030
|
+
const account = latest.accountId ? latestState.accounts.find((item) => item.id === latest.accountId)?.label : void 0;
|
|
1031
|
+
this.w.ref.paletteState = latestState;
|
|
1032
|
+
if (terminal) {
|
|
1033
|
+
const parkedId = latest.id;
|
|
1034
|
+
terminal.idleEscape = latest.resumeAt ? () => {
|
|
1035
|
+
void stopWaitingForReset(parkedId).then((stopped) => {
|
|
1036
|
+
if (!stopped) return;
|
|
1037
|
+
refreshSessionWorker(parkedId);
|
|
1038
|
+
delete latest.resumeAt;
|
|
1039
|
+
terminal.render(latest, account, { running: false });
|
|
1040
|
+
refreshUsage(latest, latestState);
|
|
1041
|
+
}).catch(quiet("commands/ai/interactive/loop"));
|
|
1042
|
+
} : void 0;
|
|
1043
|
+
}
|
|
1044
|
+
return account;
|
|
1045
|
+
}
|
|
1046
|
+
/** The turn the worker is running, followed to its end and shown as
|
|
1047
|
+
* this window shows its own turns: the prompt as the pending message
|
|
1048
|
+
* over the conversation, then the answer. `resendText` is what running
|
|
1049
|
+
* out of usage offers to send again. */
|
|
1050
|
+
async followRunning(terminal, latest, account, prompt, resendText) {
|
|
1051
|
+
terminal.holdPaints();
|
|
1052
|
+
terminal.submitted(prompt);
|
|
1053
|
+
terminal.render(latest, account, { running: true, ...prompt !== void 0 ? { prompt } : {} });
|
|
1054
|
+
let left = false;
|
|
1055
|
+
try {
|
|
1056
|
+
const followed = await followWorkerTurn(latest.id, terminal, joinedTurn(latest, prompt));
|
|
1057
|
+
left = Boolean(followed.left);
|
|
1058
|
+
if (left) this.openBoard = true;
|
|
1059
|
+
} catch (error) {
|
|
1060
|
+
await this.handleTurnFailure(error, { line: resendText });
|
|
1061
|
+
} finally {
|
|
1062
|
+
if (!left) terminal.releasePaints();
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
async pickLine(latest, latestState, account, running, queueMark) {
|
|
1066
|
+
const { terminal, rl, slashCommandsFor, beginBuildReplace } = this;
|
|
1067
|
+
let line;
|
|
1068
|
+
let queuedTurnId;
|
|
1069
|
+
let fromQueuedCommand = false;
|
|
1070
|
+
let queued = latest.queuedTurns?.[0];
|
|
1071
|
+
if (terminal?.takeStopped() && !running && !this.openBoard && queued && queued.kind !== "command" && queued.kind !== "notification") {
|
|
1072
|
+
const back = [];
|
|
1073
|
+
for (const entry of [...latest.queuedTurns ?? []]) {
|
|
1074
|
+
if (entry.kind === "command" || entry.kind === "notification") continue;
|
|
1075
|
+
if (consumeSessionTurn(latest, entry.id)) back.push(entry.text);
|
|
1076
|
+
}
|
|
1077
|
+
if (back.length) {
|
|
1078
|
+
await writeState(latestState);
|
|
1079
|
+
terminal.restoreDraft(back.join("\n"));
|
|
1080
|
+
}
|
|
1081
|
+
queued = latest.queuedTurns?.[0];
|
|
1082
|
+
}
|
|
1083
|
+
if (this.openBoard) {
|
|
1084
|
+
this.openBoard = false;
|
|
1085
|
+
line = BOARD_LINE;
|
|
1086
|
+
} else {
|
|
1087
|
+
const next = queuedNext(latest);
|
|
1088
|
+
const runningTurn = next?.kind === "message" ? running : void 0;
|
|
1089
|
+
if (runningTurn && terminal) {
|
|
1090
|
+
await this.followRunning(terminal, latest, account, runningTurn.prompt, runningTurn.prompt ?? latest.pendingTurn?.prompt);
|
|
1091
|
+
return "continue";
|
|
1092
|
+
}
|
|
1093
|
+
if (this.resend) {
|
|
1094
|
+
line = this.resend;
|
|
1095
|
+
this.resend = void 0;
|
|
1096
|
+
} else if (next?.kind === "command") {
|
|
1097
|
+
fromQueuedCommand = true;
|
|
1098
|
+
line = next.entry.text;
|
|
1099
|
+
if (consumeSessionTurn(latest, next.entry.id)) await writeState(latestState);
|
|
1100
|
+
} else if (next) {
|
|
1101
|
+
line = next.entry.text;
|
|
1102
|
+
queuedTurnId = next.entry.id;
|
|
1103
|
+
} else if (terminal) {
|
|
1104
|
+
if (terminal.idleForBuildReplace()) {
|
|
1105
|
+
const leaving = beginBuildReplace();
|
|
1106
|
+
if (leaving) {
|
|
1107
|
+
await leaving;
|
|
1108
|
+
return "exit";
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
const answer = await questionOrWorker(latest.id, (signal) => terminal.question("\u203A ", slashCommandsFor(latest), { conversation: true, rightArrowPalette: true, leftArrowCommand: BOARD_LINE, ...signal ? { signal } : {} }), queueMark);
|
|
1112
|
+
if ("woke" in answer) {
|
|
1113
|
+
if (answer.woke === "turn") await this.followRunning(terminal, latest, account, answer.prompt, answer.prompt);
|
|
1114
|
+
return "continue";
|
|
1115
|
+
}
|
|
1116
|
+
line = answer.line.trim();
|
|
1117
|
+
} else line = (await rl.question("\u203A ", slashCommandsFor(latest), { rightArrowPalette: true, leftArrowCommand: BOARD_LINE })).trim();
|
|
1118
|
+
}
|
|
1119
|
+
return { line, queuedTurnId, fromQueuedCommand };
|
|
1120
|
+
}
|
|
1121
|
+
/** One turn with the normal waiting / cancel / live-input UI. `echo`
|
|
1122
|
+
* paints the submitted text as the pending user message; synthetic
|
|
1123
|
+
* prompts (/review, /init, /compact) are not shown as if typed. */
|
|
1124
|
+
async runInteractiveTurn(targetId, promptText, turn) {
|
|
1125
|
+
const { terminal, config } = this;
|
|
1126
|
+
const turnId = randomUUID();
|
|
1127
|
+
const submittedAt = Date.now();
|
|
1128
|
+
beginTurnClock({ turnId, startedAt: submittedAt, ...this.lastSeen.id === targetId ? { harness: this.lastSeen.nativeHarness ?? this.lastSeen.route } : {} });
|
|
1129
|
+
markTurn("submit");
|
|
1130
|
+
try {
|
|
1131
|
+
this.sentPrompt = promptText;
|
|
1132
|
+
const result = await runTimedTurn({ config, terminal, lastSeen: this.lastSeen }, targetId, promptText, { ...turn, turnId, submittedAt });
|
|
1133
|
+
if (result.left) this.openBoard = true;
|
|
1134
|
+
} finally {
|
|
1135
|
+
endTurnClock(turnId);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
/** A chat on another machine, in this window, until it comes back to one here. */
|
|
1139
|
+
async openRemote(terminal, selection, draft, hops = 0) {
|
|
1140
|
+
await leaveConversation(this.id);
|
|
1141
|
+
try {
|
|
1142
|
+
const end = await runRemoteChat(terminal, this.id, selection, draft);
|
|
1143
|
+
if (typeof end === "object") {
|
|
1144
|
+
this.leaving = true;
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
|
+
if (end) this.id = end;
|
|
1148
|
+
} catch (error) {
|
|
1149
|
+
if (!(error instanceof RemoteUnavailable)) throw error;
|
|
1150
|
+
this.notice = error.message;
|
|
1151
|
+
this.openBoard = true;
|
|
1152
|
+
return;
|
|
1153
|
+
} finally {
|
|
1154
|
+
await claimConversation(this.id).catch(quiet("commands/ai/interactive/loop"));
|
|
1155
|
+
}
|
|
1156
|
+
await this.followMoved(terminal, hops + 1);
|
|
1157
|
+
}
|
|
1158
|
+
/** This window's chat, when it is a copy that moved to another machine: the
|
|
1159
|
+
* live one is opened in its place, wherever it is (move-terminal.ts liveChat).
|
|
1160
|
+
* True when that was a chat on another machine, shown until it was left. */
|
|
1161
|
+
async followMoved(terminal, hops = 0) {
|
|
1162
|
+
if (hops > 8) return false;
|
|
1163
|
+
const live = await openedChat(this.id);
|
|
1164
|
+
if (!live) return false;
|
|
1165
|
+
if (live.notice) this.notice = live.notice;
|
|
1166
|
+
if ("remote" in live.here) {
|
|
1167
|
+
await this.openRemote(terminal, live.here.remote, void 0, hops);
|
|
1168
|
+
return true;
|
|
1169
|
+
}
|
|
1170
|
+
if (live.here.local === this.id) return false;
|
|
1171
|
+
await leaveConversation(this.id);
|
|
1172
|
+
this.id = live.here.local;
|
|
1173
|
+
await claimConversation(this.id).catch(quiet("commands/ai/interactive/loop"));
|
|
1174
|
+
return false;
|
|
1175
|
+
}
|
|
1176
|
+
async handleLine(next) {
|
|
1177
|
+
const { terminal, rl, config, beginBuildReplace } = this;
|
|
1178
|
+
const { queuedTurnId, fromQueuedCommand } = next;
|
|
1179
|
+
let { line } = next;
|
|
1180
|
+
if (!line) return;
|
|
1181
|
+
const viaBoard = line === BOARD_LINE;
|
|
1182
|
+
if (viaBoard) line = "/resume";
|
|
1183
|
+
try {
|
|
1184
|
+
if (queuedTurnId) {
|
|
1185
|
+
await this.runInteractiveTurn(this.id, line, { echo: true, queuedTurnId });
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1188
|
+
if (isShellCommandLine(line)) {
|
|
1189
|
+
const command = line.trim().slice(1).trim();
|
|
1190
|
+
if (!command) {
|
|
1191
|
+
this.notice = "Type `!<command>` to run it and give the model its output, e.g. `!git status`.";
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
await runShellInChat(terminal, this.id, command, this.lastSeen);
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1197
|
+
const host = createSlashHost({
|
|
1198
|
+
config,
|
|
1199
|
+
rl,
|
|
1200
|
+
terminal,
|
|
1201
|
+
runTurn: (targetId, promptText) => this.runInteractiveTurn(targetId, promptText, { echo: false }),
|
|
1202
|
+
openConversationPicker: () => openConversationPicker({ rl, terminal, beginBuildReplace, dispatch: (id, command) => dispatchLine(host, id, command) }, this.id)
|
|
1203
|
+
});
|
|
1204
|
+
const outcome = await dispatchLine(host, this.id, line, { fromQueuedCommand });
|
|
1205
|
+
if (outcome.notice) this.notice = outcome.notice;
|
|
1206
|
+
if (outcome.exit) return "exit";
|
|
1207
|
+
if (outcome.remote && terminal) {
|
|
1208
|
+
await this.openRemote(terminal, outcome.remote, outcome.draft);
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
if (outcome.id && outcome.id !== this.id) {
|
|
1212
|
+
await leaveConversation(this.id);
|
|
1213
|
+
this.id = outcome.id;
|
|
1214
|
+
await claimConversation(this.id).catch(quiet("commands/ai/interactive/loop"));
|
|
1215
|
+
if (terminal && await this.followMoved(terminal)) return;
|
|
1216
|
+
}
|
|
1217
|
+
if (outcome.draft !== void 0) terminal?.restoreDraft(outcome.draft);
|
|
1218
|
+
if (outcome.prompt) await this.runInteractiveTurn(this.id, outcome.prompt, { echo: outcome.echo !== false });
|
|
1219
|
+
} catch (error) {
|
|
1220
|
+
if (!(await readState({ transcripts: [] })).sessions.some((item) => item.id === this.id)) {
|
|
1221
|
+
terminal?.submitted(void 0);
|
|
1222
|
+
if (!viaBoard) terminal?.restoreDraft(line);
|
|
1223
|
+
return;
|
|
1224
|
+
}
|
|
1225
|
+
await this.handleTurnFailure(error, { line, sent: this.sentPrompt ?? line, ...queuedTurnId ? { queuedTurnId } : {} });
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
};
|
|
1229
|
+
|
|
1230
|
+
// src/commands/ai/interactive.ts
|
|
1231
|
+
async function aiSessionOpenDefault(config, options = {}) {
|
|
1232
|
+
await aiSessionInteractive(config, await openConversation(process.cwd(), options.continue ? "continue" : "new", void 0, { notice: sayOnOpen }));
|
|
1233
|
+
}
|
|
1234
|
+
async function aiSessionResume(config, ref) {
|
|
1235
|
+
adoptHandedOverDraft();
|
|
1236
|
+
await aiSessionInteractive(config, await openConversation(process.cwd(), "resume", ref, { notice: sayOnOpen }));
|
|
1237
|
+
}
|
|
1238
|
+
var sayOnOpen = (message) => {
|
|
1239
|
+
process.stderr.write(`${message}
|
|
1240
|
+
`);
|
|
1241
|
+
};
|
|
1242
|
+
async function aiSessionInteractive(config, id) {
|
|
1243
|
+
void import("./chunk-S4UO3AO3.js").then(({ modelsDevCache }) => modelsDevCache()).catch(quiet("commands/ai/interactive"));
|
|
1244
|
+
const ignoreInterrupt = () => {
|
|
1245
|
+
};
|
|
1246
|
+
process.on("SIGINT", ignoreInterrupt);
|
|
1247
|
+
setLifecycleRole("window", id);
|
|
1248
|
+
lifecycle("window.open", { cols: process.stdout.columns, rows: process.stdout.rows, tty: Boolean(process.stdin.isTTY) });
|
|
1249
|
+
const stopMonitor = startEventLoopMonitor();
|
|
1250
|
+
try {
|
|
1251
|
+
await aiSessionInteractiveInner(config, id);
|
|
1252
|
+
lifecycle("window.exit", { how: "left" });
|
|
1253
|
+
} catch (error) {
|
|
1254
|
+
lifecycle("window.exit", { how: "error", message: error instanceof Error ? error.message.slice(0, 300) : String(error) });
|
|
1255
|
+
throw error;
|
|
1256
|
+
} finally {
|
|
1257
|
+
stopMonitor();
|
|
1258
|
+
process.off("SIGINT", ignoreInterrupt);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
async function aiSessionInteractiveInner(config, id) {
|
|
1262
|
+
const window = await openWindow(config, id);
|
|
1263
|
+
if (!window) return;
|
|
1264
|
+
await new ChatLoop(window).run();
|
|
1265
|
+
}
|
|
1266
|
+
export {
|
|
1267
|
+
aiSessionOpenDefault,
|
|
1268
|
+
aiSessionResume
|
|
1269
|
+
};
|