@wirecat/zoom-cli 0.71.0 → 0.72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/answers.d.ts +56 -0
  2. package/dist/answers.d.ts.map +1 -1
  3. package/dist/bin/zm.js +2 -2
  4. package/dist/bundle/{all-profiles-O4YNVPZX.js → all-profiles-XFIPF4GF.js} +12 -12
  5. package/dist/bundle/answer-policy-AT6CDEE5.js +110 -0
  6. package/dist/bundle/{anthropic-7GGRX3RX.js → anthropic-SSUBR3BC.js} +18 -11
  7. package/dist/bundle/{app-server-CPMKM3HI.js → app-server-7DJHHF2F.js} +68 -56
  8. package/dist/bundle/{bun-POHZKEPV.js → bun-6HBYWQIX.js} +2 -2
  9. package/dist/bundle/{bun-sqlite-PGYMBPEL.js → bun-sqlite-4L3Q55NB.js} +10 -6
  10. package/dist/bundle/{chunk-Q2SUFGSH.js → chunk-23J2ANZ7.js} +2 -2
  11. package/dist/bundle/{chunk-FSHCAWZS.js → chunk-24OFZNRC.js} +13119 -10386
  12. package/dist/bundle/{chunk-LE7MDAQG.js → chunk-2MIBRVSV.js} +2 -2
  13. package/dist/bundle/{chunk-DIQLXAAZ.js → chunk-37NF5CBJ.js} +4 -4
  14. package/dist/bundle/chunk-3KRTEX5M.js +53 -0
  15. package/dist/bundle/{chunk-IED3NS7G.js → chunk-4SY67IUA.js} +30 -30
  16. package/dist/bundle/{chunk-CKPCVEXU.js → chunk-4XQWF3U2.js} +6 -6
  17. package/dist/bundle/{chunk-CT4WVR4N.js → chunk-4YIGXTBP.js} +3 -3
  18. package/dist/bundle/{chunk-YPO2U2YB.js → chunk-5AELTC52.js} +388 -143
  19. package/dist/bundle/{chunk-USQ23X5V.js → chunk-5MGICK47.js} +750 -734
  20. package/dist/bundle/{chunk-DK6ICIGL.js → chunk-5X4IY5JH.js} +2025 -1302
  21. package/dist/bundle/{chunk-EOSVN2ER.js → chunk-63QXCE5Z.js} +242 -242
  22. package/dist/bundle/{chunk-OE7EIP5L.js → chunk-6DCLZLGX.js} +1 -1
  23. package/dist/bundle/chunk-7GLJSJ7M.js +16 -0
  24. package/dist/bundle/{chunk-X3ZDN3U7.js → chunk-7IFO43Q5.js} +2 -2
  25. package/dist/bundle/{chunk-YD2RYVMK.js → chunk-7JYMGXLI.js} +41 -39
  26. package/dist/bundle/{chunk-DSVZEXYJ.js → chunk-7OD3522V.js} +3541 -3346
  27. package/dist/bundle/{chunk-2FV5JUQU.js → chunk-7S4D5SM2.js} +41 -35
  28. package/dist/bundle/{chunk-VRH7VRTK.js → chunk-7SUWPMZG.js} +10 -15
  29. package/dist/bundle/{chunk-4QPQ7MDA.js → chunk-ADKMBXY4.js} +1 -1
  30. package/dist/bundle/{chunk-MRI6QMZ3.js → chunk-B3SILJBU.js} +18 -18
  31. package/dist/bundle/{chunk-7ROXXRGG.js → chunk-CANRIRNZ.js} +6678 -5185
  32. package/dist/bundle/{chunk-DRBQDCDU.js → chunk-CW46FWKW.js} +38 -123
  33. package/dist/bundle/{chunk-GXF5HFFP.js → chunk-D24OQAHM.js} +4 -4
  34. package/dist/bundle/{chunk-ZBKWRYRS.js → chunk-D5EUMWD5.js} +3 -3
  35. package/dist/bundle/{chunk-QVSLSWAL.js → chunk-DEPXZJ2V.js} +21 -150
  36. package/dist/bundle/{chunk-TM4JSVGQ.js → chunk-DOCVEKP2.js} +39 -44
  37. package/dist/bundle/{chunk-BBTQIVFP.js → chunk-EFF2XBHP.js} +2 -2
  38. package/dist/bundle/{chunk-XRFHQGOD.js → chunk-EG25AY4L.js} +1 -1
  39. package/dist/bundle/{chunk-FEM2JQN2.js → chunk-ELJUBPY4.js} +1 -1
  40. package/dist/bundle/{chunk-2U6SER67.js → chunk-ERJYJ36F.js} +2 -2
  41. package/dist/bundle/chunk-FSCPQQS5.js +244 -0
  42. package/dist/bundle/{chunk-P3XC6EDU.js → chunk-H53WFZBN.js} +11 -130
  43. package/dist/bundle/{chunk-RN4EHCC5.js → chunk-I7CUMZD6.js} +3 -3
  44. package/dist/bundle/{chunk-ALIT5QFT.js → chunk-IACWKZWS.js} +1 -1
  45. package/dist/bundle/{chunk-MW4EGDDV.js → chunk-IFBIXU6C.js} +2 -2
  46. package/dist/bundle/{chunk-5K7OGPGA.js → chunk-IU4DUUB3.js} +7 -7
  47. package/dist/bundle/{chunk-INVTDIF6.js → chunk-IXO4SCKE.js} +1 -1
  48. package/dist/bundle/{chunk-OHWMIUCT.js → chunk-JAEPK457.js} +244 -245
  49. package/dist/bundle/{chunk-HB6XJQ3Y.js → chunk-JFPUYQSP.js} +5 -5
  50. package/dist/bundle/{chunk-IAV5BG3I.js → chunk-JG4MNYG2.js} +1 -1
  51. package/dist/bundle/{chunk-ZBFL5JPT.js → chunk-JRCH4YZP.js} +16 -10
  52. package/dist/bundle/{chunk-M76MXMLY.js → chunk-JZ4XNNL7.js} +1 -1
  53. package/dist/bundle/chunk-K6HR6HCO.js +32 -0
  54. package/dist/bundle/{chunk-DHWBSXG3.js → chunk-KFZL67JP.js} +323 -55
  55. package/dist/bundle/{chunk-X4GWR6GO.js → chunk-KPIQXFNB.js} +375 -10
  56. package/dist/bundle/{chunk-OWEBWDHV.js → chunk-KWURWGGB.js} +80 -5
  57. package/dist/bundle/{chunk-Q5PI72CR.js → chunk-LA6QUVGQ.js} +3 -2
  58. package/dist/bundle/{chunk-5J4AMBMM.js → chunk-LLUNHAZ7.js} +4 -4
  59. package/dist/bundle/{chunk-2RUAMDVV.js → chunk-LTWJM3ED.js} +17 -17
  60. package/dist/bundle/{chunk-2U27KIKU.js → chunk-M3DMXDX6.js} +6 -6
  61. package/dist/bundle/{chunk-VW6BF6M7.js → chunk-MCPOZNWG.js} +1 -1
  62. package/dist/bundle/{chunk-CRFOGYDG.js → chunk-MSQHSW4C.js} +2 -2
  63. package/dist/bundle/chunk-N4QNYWWG.js +71 -0
  64. package/dist/bundle/chunk-NMZQTYKJ.js +18 -0
  65. package/dist/bundle/{chunk-2KESWII5.js → chunk-OHCLQJOV.js} +3 -3
  66. package/dist/bundle/{chunk-4QUFFB2U.js → chunk-OP5PGE2N.js} +4 -4
  67. package/dist/bundle/{chunk-Q3XLZIY3.js → chunk-OY6N2ABP.js} +29 -23
  68. package/dist/bundle/chunk-PJWSGXOB.js +185 -0
  69. package/dist/bundle/{chunk-633QXP57.js → chunk-QA6KIL7Q.js} +10 -8
  70. package/dist/bundle/{chunk-N2FNMION.js → chunk-QQUY4MZY.js} +1 -1
  71. package/dist/bundle/{chunk-X277FBTF.js → chunk-QW7YTRV2.js} +3 -3
  72. package/dist/bundle/chunk-RJTGENHZ.js +109 -0
  73. package/dist/bundle/{chunk-ULDXZ6LH.js → chunk-RLCVPECY.js} +63 -63
  74. package/dist/bundle/{chunk-BGTEVIW4.js → chunk-RN5SU2RN.js} +6 -6
  75. package/dist/bundle/{chunk-P3ASN72F.js → chunk-RX5CJ55S.js} +1 -1
  76. package/dist/bundle/{chunk-7QC4M4HS.js → chunk-RZUJMAMK.js} +4 -4
  77. package/dist/bundle/{chunk-OORMSM6O.js → chunk-S7SXSHRC.js} +21 -21
  78. package/dist/bundle/{chunk-GGS6D4W4.js → chunk-SXZGCD6E.js} +3 -3
  79. package/dist/bundle/{chunk-64ZHF6PJ.js → chunk-T27IMG6X.js} +3 -1
  80. package/dist/bundle/{chunk-VJXHIUFP.js → chunk-TF2WKPNW.js} +15 -15
  81. package/dist/bundle/{chunk-QTHIU7CO.js → chunk-U32VL3MA.js} +1 -1
  82. package/dist/bundle/{chunk-RQG5VOGH.js → chunk-U3NJBGLA.js} +3 -3
  83. package/dist/bundle/{chunk-WOIHSQAL.js → chunk-UVZLK3M4.js} +33 -9
  84. package/dist/bundle/{chunk-XI3VIQKW.js → chunk-VIV64MQM.js} +560 -537
  85. package/dist/bundle/{chunk-CFQF6IGY.js → chunk-W3YTVEWV.js} +69 -6
  86. package/dist/bundle/{chunk-54YDWBYG.js → chunk-WLVG4RBZ.js} +1 -1
  87. package/dist/bundle/{chunk-77TCCHMP.js → chunk-WOAYHCM2.js} +1 -1
  88. package/dist/bundle/{chunk-5LJTU4LY.js → chunk-WXTYYWZI.js} +13 -13
  89. package/dist/bundle/{chunk-MEED7YFG.js → chunk-WZGKHTA4.js} +2 -2
  90. package/dist/bundle/{chunk-I4DFFR7F.js → chunk-X2MP634F.js} +14 -5
  91. package/dist/bundle/{chunk-RGJ7OWHU.js → chunk-XPWZSW6Y.js} +61 -21
  92. package/dist/bundle/{chunk-SELXER2Q.js → chunk-YVVJ6Y5C.js} +7 -7
  93. package/dist/bundle/{chunk-4LAQDZXU.js → chunk-ZHA56THL.js} +790 -70
  94. package/dist/bundle/{chunk-ZVI6TFQR.js → chunk-ZVFYGTGJ.js} +17 -17
  95. package/dist/bundle/{chunk-GL3MYFMX.js → chunk-ZW5KHKMA.js} +5 -5
  96. package/dist/bundle/{cli-KHMEUXNG.js → cli-IYYI7GAM.js} +158 -96
  97. package/dist/bundle/command-contract-TX7NSUBM.js +42 -0
  98. package/dist/bundle/command-server-entry-FXX4LJWF.js +171 -0
  99. package/dist/bundle/config-YKNM33J7.js +96 -0
  100. package/dist/bundle/{decode-7RP4HSVE.js → decode-SRGOOGBW.js} +6 -6
  101. package/dist/bundle/{dispatch-IZCAK47P.js → dispatch-OUHRPFUL.js} +11 -11
  102. package/dist/bundle/{dist-BFT2SUBV.js → dist-UZLNLAIO.js} +52 -31
  103. package/dist/bundle/{echarts-T2BSQ2YV.js → echarts-7CM2MCMW.js} +2 -2
  104. package/dist/bundle/{embed-BAS6YPDT.js → embed-VEE56BOB.js} +7 -7
  105. package/dist/bundle/{embedder-5XD5FCAO.js → embedder-SZFYR543.js} +10 -10
  106. package/dist/bundle/{failure-R2OIHCE5.js → failure-MZBNM7M5.js} +3 -3
  107. package/dist/bundle/first-run-KWC7RKF2.js +29 -0
  108. package/dist/bundle/first-screen-DWKMNSEI.js +40 -0
  109. package/dist/bundle/{folders-ZXTOFY4T.js → folders-UQXRSDJJ.js} +5 -5
  110. package/dist/bundle/{instructions-XZPROPKY.js → instructions-R7OHVAWH.js} +1 -1
  111. package/dist/bundle/{main-TZXKGL3L.js → main-EFUN2O3K.js} +21 -20
  112. package/dist/bundle/{mcp-M4QN2E7R.js → mcp-7KQUJNFN.js} +2 -2
  113. package/dist/bundle/{meetings-JB2ISPND.js → meetings-5I2BDNTA.js} +7 -7
  114. package/dist/bundle/{node-A3B3MJWX.js → node-3N2JGZ7V.js} +2 -2
  115. package/dist/bundle/{node-sqlite-QVWDLGDX.js → node-sqlite-2UVEE2WM.js} +11 -7
  116. package/dist/bundle/{oauth-YA6IYV4O.js → oauth-AYGD7UU3.js} +8 -8
  117. package/dist/bundle/{open-SY7TXJBS.js → open-3GUVDLGD.js} +6 -6
  118. package/dist/bundle/openai-NHCDLWWY.js +28 -0
  119. package/dist/bundle/{output-file-YGQYZCBJ.js → output-file-72JFXVHQ.js} +6 -6
  120. package/dist/bundle/{process-6HNBTJIY.js → process-YAHHUFR5.js} +1 -1
  121. package/dist/bundle/{program-77BUCJ4H.js → program-OSZROCTK.js} +97 -91
  122. package/dist/bundle/{prompt-YDG73YDS.js → prompt-HMCW4XQJ.js} +6 -6
  123. package/dist/bundle/{recognize-ECXDGTB7.js → recognize-VF5CA7EM.js} +5 -5
  124. package/dist/bundle/{remote-K4JHGBVJ.js → remote-5C6VTPR2.js} +10 -8
  125. package/dist/bundle/{rerank-IU2YYD4T.js → rerank-ER7NEDOI.js} +8 -8
  126. package/dist/bundle/run-log-JKTLKXSK.js +124 -0
  127. package/dist/bundle/{serve-3XWIF3HI.js → serve-QJWXJOM7.js} +10 -10
  128. package/dist/bundle/{server-56VYOHWP.js → server-KCIK3Y2P.js} +50 -48
  129. package/dist/bundle/server-LLGFDLLJ.js +75 -0
  130. package/dist/bundle/{services-X7IPEGQ5.js → services-LQMYJQG3.js} +62 -45
  131. package/dist/bundle/{speech-E2OBQWYA.js → speech-74GJQNQH.js} +20 -17
  132. package/dist/bundle/{state-4GMJYK4H.js → state-4XDGCHDF.js} +7 -7
  133. package/dist/bundle/{store-LA4TV4DM.js → store-5Y5HK2L2.js} +22 -19
  134. package/dist/bundle/{store-KPI7GB5Y.js → store-Y56AHJ2Y.js} +42 -27
  135. package/dist/bundle/store-connection-4WI32AYU.js +89 -0
  136. package/dist/bundle/store-maintenance-command-PCXO5AH4.js +65 -0
  137. package/dist/bundle/{streaming-EJ3NM2C2.js → streaming-E5CR6HSR.js} +7 -7
  138. package/dist/bundle/{tokens-BE6CJMR5.js → tokens-E2QNVC4F.js} +7 -7
  139. package/dist/bundle/zm.js +34 -10
  140. package/dist/bundle/{zoom-app-QEJBTIJ4.js → zoom-app-NVL7HEAX.js} +8 -8
  141. package/dist/version.d.ts +1 -1
  142. package/dist/version.js +1 -1
  143. package/package.json +3 -3
  144. package/dist/bundle/answer-policy-PPSPMCLH.js +0 -104
  145. package/dist/bundle/chunk-KMV7GZB6.js +0 -35
  146. package/dist/bundle/chunk-UG447QY2.js +0 -27
  147. package/dist/bundle/command-contract-4K6XXZYE.js +0 -41
  148. package/dist/bundle/config-EEDB632I.js +0 -90
  149. package/dist/bundle/first-run-23WWZ2PW.js +0 -28
  150. package/dist/bundle/first-screen-6HFUYVFR.js +0 -39
  151. package/dist/bundle/openai-2AU24NRN.js +0 -25
  152. package/dist/bundle/run-log-LFEXNZ74.js +0 -118
  153. package/dist/bundle/server-YSTMUZ22.js +0 -72
  154. package/dist/bundle/store-connection-AZTIF6IH.js +0 -83
  155. package/dist/bundle/store-maintenance-command-LR572PS4.js +0 -61
  156. /package/dist/bundle/{chunk-VOXIGICJ.js → chunk-YVNHQFLC.js} +0 -0
@@ -0,0 +1,185 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ isCommandServer
5
+ } from "./chunk-RJTGENHZ.js";
6
+ import {
7
+ stdinFieldOf
8
+ } from "./chunk-NMZQTYKJ.js";
9
+ import {
10
+ commandPathOf
11
+ } from "./chunk-ZW5KHKMA.js";
12
+ import {
13
+ commandServerRequest,
14
+ metaOf
15
+ } from "./chunk-7OD3522V.js";
16
+ import {
17
+ errorObjectOf,
18
+ renderError
19
+ } from "./chunk-UVZLK3M4.js";
20
+ import {
21
+ CliError
22
+ } from "./chunk-ELJUBPY4.js";
23
+ import {
24
+ __name
25
+ } from "./chunk-ZVVMGPBJ.js";
26
+
27
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/command-server.js
28
+ import { createInterface } from "node:readline";
29
+ var COMMAND_SERVER_PROTOCOL = 1;
30
+ var COMMAND_SERVER_IDLE_MS = 10 * 6e4;
31
+ var COMMAND_SERVER_CONCURRENT = 8;
32
+ var runsAlone = /* @__PURE__ */ __name((command) => commandPathOf(command)[0] === "store", "runsAlone");
33
+ var enterCommandServer = /* @__PURE__ */ __name(async (command, cli) => {
34
+ const request = commandServerRequest();
35
+ if (!request)
36
+ return;
37
+ refuseInCommandServer(command, cli);
38
+ if (runsAlone(command))
39
+ await request.alone();
40
+ }, "enterCommandServer");
41
+ var refuseInCommandServer = /* @__PURE__ */ __name((command, cli) => {
42
+ if (!commandServerRequest())
43
+ return;
44
+ const typed = [cli, ...commandPathOf(command)].join(" ");
45
+ const { lifetime } = metaOf(command);
46
+ if (lifetime)
47
+ throw new CliError("validation_error", `\`${typed}\` ${lifetime === "persistent" ? "runs until it is stopped" : "waits on a person"}; the command server runs only commands that return \u2014 start it as a process of its own`);
48
+ if (stdinFieldOf(command))
49
+ throw new CliError("validation_error", `\`${typed}\` reads its input on stdin, which the command server does not pass on \u2014 start it as a process of its own`);
50
+ }, "refuseInCommandServer");
51
+ var refusal = /* @__PURE__ */ __name((cli, message) => `${renderError(errorObjectOf(new CliError("validation_error", message)), { cli, interactive: false })}
52
+ `, "refusal");
53
+ var requestOf = /* @__PURE__ */ __name((line, cli) => {
54
+ let parsed;
55
+ try {
56
+ parsed = JSON.parse(line);
57
+ } catch {
58
+ return { id: null, error: "a request is one JSON object per line" };
59
+ }
60
+ const { id, argv } = parsed ?? {};
61
+ const known = typeof id === "number" && Number.isFinite(id) ? id : null;
62
+ if (known === null)
63
+ return { id: null, error: 'a request needs a numeric "id"' };
64
+ if (!Array.isArray(argv) || !argv.every((word) => typeof word === "string"))
65
+ return { id: known, error: '"argv" is a list of strings' };
66
+ if (isCommandServer(argv))
67
+ return { id: known, error: `\`${cli} commands --serve\` cannot run inside itself` };
68
+ return { id: known, argv };
69
+ }, "requestOf");
70
+ var serveCommands = /* @__PURE__ */ __name(async ({ input, write, run, cli, version, idleMs = COMMAND_SERVER_IDLE_MS, concurrent = COMMAND_SERVER_CONCURRENT, signal }) => {
71
+ const send = /* @__PURE__ */ __name((value) => write(`${JSON.stringify(value)}
72
+ `), "send");
73
+ await send({ ready: true, protocol: COMMAND_SERVER_PROTOCOL, version, concurrent });
74
+ const lines = createInterface({ input, crlfDelay: Number.POSITIVE_INFINITY });
75
+ return new Promise((resolve) => {
76
+ const waiting = [];
77
+ let active = 0;
78
+ let running = 0;
79
+ let gated = false;
80
+ let drained;
81
+ let turns = Promise.resolve();
82
+ let timer;
83
+ let ending = false;
84
+ let done = false;
85
+ const finish = /* @__PURE__ */ __name(() => {
86
+ if (done)
87
+ return;
88
+ done = true;
89
+ clearTimeout(timer);
90
+ lines.close();
91
+ resolve(0);
92
+ }, "finish");
93
+ const settle = /* @__PURE__ */ __name(() => {
94
+ if (running === 0 && drained) {
95
+ const go = drained;
96
+ drained = void 0;
97
+ go();
98
+ }
99
+ pump();
100
+ if (active > 0 || waiting.length > 0 || done)
101
+ return;
102
+ if (ending)
103
+ finish();
104
+ else {
105
+ clearTimeout(timer);
106
+ timer = setTimeout(finish, idleMs);
107
+ }
108
+ }, "settle");
109
+ const start = /* @__PURE__ */ __name((line) => {
110
+ active += 1;
111
+ running += 1;
112
+ let holdsPlace = true;
113
+ let ended = false;
114
+ let turn;
115
+ let release;
116
+ const alone = /* @__PURE__ */ __name(() => {
117
+ if (turn)
118
+ return turn;
119
+ holdsPlace = false;
120
+ running -= 1;
121
+ turn = turns.then(() => new Promise((go) => {
122
+ if (ended)
123
+ return go();
124
+ gated = true;
125
+ drained = /* @__PURE__ */ __name(() => {
126
+ if (ended)
127
+ gated = false;
128
+ else {
129
+ holdsPlace = true;
130
+ running += 1;
131
+ }
132
+ go();
133
+ }, "drained");
134
+ settle();
135
+ }));
136
+ turns = turn.then(() => ended && !holdsPlace ? void 0 : new Promise((free) => release = free));
137
+ return turn;
138
+ }, "alone");
139
+ const answer = /* @__PURE__ */ __name(async () => {
140
+ const request = requestOf(line, cli);
141
+ if ("error" in request)
142
+ return send({ id: request.id, code: 2, stdout: "", stderr: refusal(cli, request.error) });
143
+ const answered = await run(request.argv, alone);
144
+ return send({ id: request.id, ...answered });
145
+ }, "answer");
146
+ answer().catch(finish).finally(() => {
147
+ ended = true;
148
+ active -= 1;
149
+ if (holdsPlace)
150
+ running -= 1;
151
+ if (release) {
152
+ gated = false;
153
+ release();
154
+ }
155
+ settle();
156
+ });
157
+ }, "start");
158
+ const pump = /* @__PURE__ */ __name(() => {
159
+ while (!done && !gated && running < concurrent && waiting.length > 0)
160
+ start(waiting.shift());
161
+ }, "pump");
162
+ lines.on("line", (line) => {
163
+ if (done || ending || line.trim() === "")
164
+ return;
165
+ clearTimeout(timer);
166
+ waiting.push(line);
167
+ pump();
168
+ });
169
+ const end = /* @__PURE__ */ __name(() => {
170
+ ending = true;
171
+ settle();
172
+ }, "end");
173
+ lines.on("close", end);
174
+ if (signal?.aborted)
175
+ end();
176
+ signal?.addEventListener("abort", end, { once: true });
177
+ settle();
178
+ });
179
+ }, "serveCommands");
180
+
181
+ export {
182
+ COMMAND_SERVER_CONCURRENT,
183
+ enterCommandServer,
184
+ serveCommands
185
+ };
@@ -2,23 +2,25 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  isCliFailure
5
- } from "./chunk-MEED7YFG.js";
5
+ } from "./chunk-WZGKHTA4.js";
6
6
  import {
7
7
  secretNamed,
8
8
  withoutSecrets
9
- } from "./chunk-QTHIU7CO.js";
9
+ } from "./chunk-U32VL3MA.js";
10
10
  import {
11
11
  isContentKey
12
- } from "./chunk-OORMSM6O.js";
12
+ } from "./chunk-S7SXSHRC.js";
13
13
  import {
14
14
  __name
15
15
  } from "./chunk-ZVVMGPBJ.js";
16
16
 
17
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/runs/events.js
17
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/runs/events.js
18
18
  var providerErrorKey = /* @__PURE__ */ __name((value) => typeof value === "string" && /^[A-Za-z][A-Za-z0-9._-]{0,63}$/.test(value) ? value : void 0, "providerErrorKey");
19
19
  var renderEvent = /* @__PURE__ */ __name((event) => {
20
20
  if (event.event === "store")
21
21
  return `${MARK.store} ${event.operation.padEnd(16)} ${event.table} ${event.op} ${event.n}`;
22
+ if (event.event === "progress")
23
+ return `${MARK.progress} ${event.operation.padEnd(16)} ${Object.entries(event.counts).map(([field, count]) => `${count} ${field}`).join(" ")}`;
22
24
  if (event.event === "warning") {
23
25
  const counts = Object.entries(event.counts ?? {}).map(([field, count]) => `${count} ${field}`);
24
26
  return [`${MARK.warning} ${(event.operation ?? "").padEnd(16)} ${event.code}`, ...counts, event.detail].filter(Boolean).join(" ");
@@ -60,15 +62,15 @@ var renderEvent = /* @__PURE__ */ __name((event) => {
60
62
  }
61
63
  return `${MARK[event.event]} ${event.operation.padEnd(16)} ${parts.join(" ")}`.trimEnd();
62
64
  }, "renderEvent");
63
- var MARK = { request: "\u2192", response: "\u2190", cache: "\u2022", warning: "!", store: "+" };
65
+ var MARK = { request: "\u2192", response: "\u2190", cache: "\u2022", warning: "!", store: "+", progress: "\u2026" };
64
66
  var age = /* @__PURE__ */ __name((ms) => ms < 1e3 ? `${ms}ms` : `${Math.round(ms / 1e3)}s`, "age");
65
67
  var size = /* @__PURE__ */ __name((bytes) => bytes < 1e3 ? `${bytes} B` : `${(bytes / 1e3).toFixed(1)} kB`, "size");
66
68
 
67
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/runs/run-context.js
69
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/runs/run-context.js
68
70
  import { AsyncLocalStorage } from "node:async_hooks";
69
71
  import { createHash } from "node:crypto";
70
72
 
71
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
73
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
72
74
  import { homedir } from "node:os";
73
75
  var MESSAGE_AT_MOST = 500;
74
76
  var CAUSES_AT_MOST = 5;
@@ -178,7 +180,7 @@ var redactText = /* @__PURE__ */ __name((text) => {
178
180
  return out.length > MESSAGE_AT_MOST ? `${out.slice(0, MESSAGE_AT_MOST)}\u2026` : out;
179
181
  }, "redactText");
180
182
 
181
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/runs/run-context.js
183
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/runs/run-context.js
182
184
  var REDACTED = "[redacted]";
183
185
  var keepsSuccess = /* @__PURE__ */ __name(({ record, fromFlag, env, caller, persistent = false }) => {
184
186
  if (!record)
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/mcp/stdio-wire.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/mcp/stdio-wire.js
8
8
  import { PassThrough, Writable } from "node:stream";
9
9
  var lineReader = /* @__PURE__ */ __name((onMessage) => {
10
10
  let rest = "";
@@ -5,7 +5,7 @@ import {
5
5
  id,
6
6
  text,
7
7
  time
8
- } from "./chunk-USQ23X5V.js";
8
+ } from "./chunk-5MGICK47.js";
9
9
  import {
10
10
  array,
11
11
  nullable,
@@ -16,9 +16,9 @@ import {
16
16
  strictObject,
17
17
  string,
18
18
  unknown
19
- } from "./chunk-WOIHSQAL.js";
19
+ } from "./chunk-UVZLK3M4.js";
20
20
 
21
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/entities/note.js
21
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/entities/note.js
22
22
  var link = {
23
23
  target_text: nullable(text),
24
24
  kind: text,
@@ -0,0 +1,109 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ CAPABILITY_STATEMENTS,
5
+ storeCapable
6
+ } from "./chunk-RN5SU2RN.js";
7
+ import {
8
+ importFrom
9
+ } from "./chunk-Y5E2WNWB.js";
10
+ import {
11
+ __name
12
+ } from "./chunk-ZVVMGPBJ.js";
13
+
14
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/sqlite-runtime.js
15
+ import { spawn, spawnSync } from "node:child_process";
16
+ import { readFileSync } from "node:fs";
17
+ import { dirname } from "node:path";
18
+ var RESTARTED = "CLI_MESSAGING_SQLITE_RESTARTED";
19
+ var USER_LIBRARY_PATH = "CLI_MESSAGING_USER_LD_LIBRARY_PATH";
20
+ var FORWARDED = ["SIGTERM", "SIGHUP", "SIGQUIT"];
21
+ var ensureSqlite = /* @__PURE__ */ __name(async (runtime = nodeRuntime()) => {
22
+ const { env } = runtime;
23
+ if (env[RESTARTED]) {
24
+ if (env[USER_LIBRARY_PATH] === void 0)
25
+ delete env.LD_LIBRARY_PATH;
26
+ else
27
+ env.LD_LIBRARY_PATH = env[USER_LIBRARY_PATH];
28
+ delete env[USER_LIBRARY_PATH];
29
+ delete env[RESTARTED];
30
+ return;
31
+ }
32
+ if (runtime.bun || runtime.platform !== "linux")
33
+ return;
34
+ const maps = runtime.maps();
35
+ if (!maps.includes("libsqlite3"))
36
+ return;
37
+ if (await runtime.capable())
38
+ return;
39
+ const library = await runtime.library(maps.includes("ld-musl"));
40
+ if (!library)
41
+ return;
42
+ const restarted = {
43
+ ...env,
44
+ LD_LIBRARY_PATH: [dirname(library.path), env.LD_LIBRARY_PATH].filter(Boolean).join(":"),
45
+ [RESTARTED]: "1"
46
+ };
47
+ if (env.LD_LIBRARY_PATH !== void 0)
48
+ restarted[USER_LIBRARY_PATH] = env.LD_LIBRARY_PATH;
49
+ if (!runtime.works(restarted, library.version))
50
+ return;
51
+ await runtime.restart(restarted);
52
+ }, "ensureSqlite");
53
+ var trialScript = /* @__PURE__ */ __name((version) => `
54
+ const { DatabaseSync } = await import("node:sqlite")
55
+ const database = new DatabaseSync(":memory:")
56
+ if (database.prepare("SELECT sqlite_version() AS v").get().v !== ${JSON.stringify(version)}) process.exit(1)
57
+ for (const statement of ${JSON.stringify(CAPABILITY_STATEMENTS)}) database.exec(statement)
58
+ `, "trialScript");
59
+ var nodeRuntime = /* @__PURE__ */ __name(() => ({
60
+ env: process.env,
61
+ platform: process.platform,
62
+ bun: "Bun" in globalThis,
63
+ maps: /* @__PURE__ */ __name(() => {
64
+ try {
65
+ return readFileSync("/proc/self/maps", "utf8");
66
+ } catch {
67
+ return "";
68
+ }
69
+ }, "maps"),
70
+ capable: /* @__PURE__ */ __name(() => storeCapable().then(() => true, () => false), "capable"),
71
+ library: /* @__PURE__ */ __name(async (musl) => {
72
+ try {
73
+ const { libraryFor, SQLITE_VERSION } = await importFrom(new URL("sqlite-runtime.js", import.meta.resolve("@wirecat/cli-core")).href, "@wirecat/cli-core-sqlite");
74
+ const path = libraryFor({ musl });
75
+ return path === void 0 ? void 0 : { path, version: SQLITE_VERSION };
76
+ } catch {
77
+ return void 0;
78
+ }
79
+ }, "library"),
80
+ works: /* @__PURE__ */ __name((env, version) => spawnSync(process.execPath, ["--no-warnings", "--input-type=module", "-e", trialScript(version)], {
81
+ env,
82
+ stdio: "ignore",
83
+ timeout: 1e4
84
+ }).status === 0, "works"),
85
+ restart: /* @__PURE__ */ __name((env) => relay(spawn(process.execPath, [...process.execArgv, ...process.argv.slice(1)], { env, stdio: "inherit" })), "restart")
86
+ }), "nodeRuntime");
87
+ var relay = /* @__PURE__ */ __name((child, host = process) => new Promise(() => {
88
+ for (const signal of FORWARDED)
89
+ host.on(signal, () => child.kill(signal));
90
+ host.on("SIGINT", () => {
91
+ });
92
+ child.on("error", () => host.exit(1));
93
+ child.on("exit", (code, signal) => {
94
+ if (signal) {
95
+ host.removeAllListeners(signal);
96
+ host.kill(host.pid, signal);
97
+ } else
98
+ host.exit(code ?? 1);
99
+ });
100
+ }), "relay");
101
+
102
+ // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/cli/command-server-argv.js
103
+ var COMMAND_SERVER_ARGV = ["commands", "--serve"];
104
+ var isCommandServer = /* @__PURE__ */ __name((args) => args.length === COMMAND_SERVER_ARGV.length && COMMAND_SERVER_ARGV.every((word, at) => args[at] === word), "isCommandServer");
105
+
106
+ export {
107
+ ensureSqlite,
108
+ isCommandServer
109
+ };