@wirecat/zoom-cli 0.80.0 → 0.81.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 (197) hide show
  1. package/contracts/wirecat.json +71 -3
  2. package/dist/answers.d.ts +44 -0
  3. package/dist/answers.d.ts.map +1 -1
  4. package/dist/bin/zm.js +2 -2
  5. package/dist/bundle/agent-VYAJCJLE.js +45 -0
  6. package/dist/bundle/{all-profiles-5GOKWOT4.js → all-profiles-3ASMN35R.js} +64 -22
  7. package/dist/bundle/answer-policy-PTH4F2DW.js +129 -0
  8. package/dist/bundle/{anthropic-NHXMOFYS.js → anthropic-XXI53VNI.js} +6 -6
  9. package/dist/bundle/{app-server-HFW5Z5PI.js → app-server-B7WLNZNQ.js} +90 -80
  10. package/dist/bundle/{bun-M5IGY2TG.js → bun-2FLR4IV4.js} +2 -2
  11. package/dist/bundle/{bun-sqlite-MTP5JJQ2.js → bun-sqlite-3NNHTOGM.js} +7 -7
  12. package/dist/bundle/{chunk-P2JTVRGU.js → chunk-2ELGSNX3.js} +17 -17
  13. package/dist/bundle/{chunk-5RVXXDN7.js → chunk-2GNGR265.js} +1 -1
  14. package/dist/bundle/{chunk-W2QDYMAM.js → chunk-2RFWRJFK.js} +7 -7
  15. package/dist/bundle/{chunk-4OAR7BGU.js → chunk-2Z7UOXFC.js} +1 -1
  16. package/dist/bundle/chunk-337ALCXQ.js +640 -0
  17. package/dist/bundle/{chunk-4F7Q5CET.js → chunk-35FVYRH5.js} +20 -18
  18. package/dist/bundle/{chunk-HH7GR6TN.js → chunk-3M436OO2.js} +6 -6
  19. package/dist/bundle/{chunk-5QXQIZJY.js → chunk-3UX4VJWD.js} +1 -1
  20. package/dist/bundle/{chunk-NRVMK5H3.js → chunk-437DLSB3.js} +1211 -615
  21. package/dist/bundle/{chunk-L2TURFT6.js → chunk-46EF6P2J.js} +3 -3
  22. package/dist/bundle/{chunk-GVKZZT7E.js → chunk-4B335BCJ.js} +7 -78
  23. package/dist/bundle/chunk-4BU3LRTB.js +561 -0
  24. package/dist/bundle/{chunk-W32HK7KG.js → chunk-4BXLHSXY.js} +2 -2
  25. package/dist/bundle/{chunk-JGSVWLL2.js → chunk-4FSH7K6N.js} +2 -2
  26. package/dist/bundle/{chunk-GCUOZ2OA.js → chunk-4VOCXLMJ.js} +6 -6
  27. package/dist/bundle/{chunk-XL4ND7CZ.js → chunk-4ZXJ4AZW.js} +26 -26
  28. package/dist/bundle/{chunk-6CDMGT6Q.js → chunk-5EWYDHBH.js} +2 -2
  29. package/dist/bundle/{chunk-HGSBLY6M.js → chunk-5SEBLX6B.js} +12 -12
  30. package/dist/bundle/{chunk-TDBVM2SS.js → chunk-77TJ3AJH.js} +3 -3
  31. package/dist/bundle/{chunk-5XO2AY6D.js → chunk-7JWVPJIP.js} +10 -10
  32. package/dist/bundle/{chunk-FPUGMDJV.js → chunk-AV2ZJ4WX.js} +1 -1
  33. package/dist/bundle/{chunk-PCPOO5FS.js → chunk-AWJQ6FAX.js} +2 -2
  34. package/dist/bundle/{chunk-N5YUHN6S.js → chunk-B2WBWKYN.js} +12 -12
  35. package/dist/bundle/{chunk-W7M4JYEE.js → chunk-BQBC2WIG.js} +1 -1
  36. package/dist/bundle/{chunk-NXFKZFTC.js → chunk-BZXHJKKI.js} +3 -3
  37. package/dist/bundle/{chunk-BPSURRAD.js → chunk-C4BBCSGK.js} +43 -64
  38. package/dist/bundle/{chunk-CWXOXIWS.js → chunk-CFQQTDSA.js} +1 -1
  39. package/dist/bundle/{chunk-2P6MQH4V.js → chunk-D26K6756.js} +6 -6
  40. package/dist/bundle/{chunk-XKLU5KV2.js → chunk-D7CDHBDX.js} +1 -1
  41. package/dist/bundle/{chunk-6LY4LBSD.js → chunk-DMJLJVD3.js} +7 -7
  42. package/dist/bundle/{chunk-K672XJ2P.js → chunk-EEBSKMEA.js} +12 -12
  43. package/dist/bundle/{chunk-SUG6YGAF.js → chunk-EPASOAEI.js} +166 -161
  44. package/dist/bundle/{chunk-M4LAF627.js → chunk-EWEQ7AXL.js} +19 -19
  45. package/dist/bundle/{chunk-ARL2TTPZ.js → chunk-F2J2FQUB.js} +9 -9
  46. package/dist/bundle/{chunk-RT7C3SSJ.js → chunk-F5ZAN7OC.js} +1 -1
  47. package/dist/bundle/{chunk-6QCBTBDA.js → chunk-FMMYBVCH.js} +1 -1
  48. package/dist/bundle/{chunk-EI37UXDR.js → chunk-FXCR4DGU.js} +1 -1
  49. package/dist/bundle/{chunk-D4HKTC2T.js → chunk-FXZPAGHT.js} +2 -2
  50. package/dist/bundle/{chunk-CW6CPQHI.js → chunk-G3DWMG7Y.js} +4 -4
  51. package/dist/bundle/{chunk-W3GZ7JUO.js → chunk-GCAJW4SR.js} +1 -1
  52. package/dist/bundle/chunk-GDRFVBCB.js +108 -0
  53. package/dist/bundle/{chunk-A3TUG2DP.js → chunk-GPRJXJC7.js} +15 -1
  54. package/dist/bundle/chunk-GW2A2FJH.js +209 -0
  55. package/dist/bundle/{chunk-3Z7CFQTI.js → chunk-HHQROAJQ.js} +1 -1
  56. package/dist/bundle/{chunk-BRMV33MO.js → chunk-HIFPHARA.js} +4 -4
  57. package/dist/bundle/{chunk-O3DYRCIT.js → chunk-HVXOA4FO.js} +1 -1
  58. package/dist/bundle/{chunk-ONJPUFLX.js → chunk-IBYGNUO7.js} +1 -1
  59. package/dist/bundle/{chunk-GGKEQQME.js → chunk-IDUKCXL7.js} +8 -8
  60. package/dist/bundle/{chunk-5CJ6AAUI.js → chunk-IFM4G4MT.js} +4 -4
  61. package/dist/bundle/chunk-IVZACJ6X.js +52 -0
  62. package/dist/bundle/{chunk-XIHENZW6.js → chunk-IYNICUCC.js} +4 -4
  63. package/dist/bundle/chunk-J5EHZBO5.js +68 -0
  64. package/dist/bundle/{chunk-FIJREKLA.js → chunk-JK24A3RP.js} +3 -3
  65. package/dist/bundle/{chunk-TNL3YQ33.js → chunk-JKEMW6E4.js} +2 -2
  66. package/dist/bundle/{chunk-3AOESMW6.js → chunk-K7CTCDYX.js} +18 -259
  67. package/dist/bundle/{chunk-OXPHJEJ2.js → chunk-KZ3B6HW5.js} +3 -3
  68. package/dist/bundle/{chunk-E3JVLVVB.js → chunk-L2ERFXB7.js} +30 -28
  69. package/dist/bundle/{chunk-DZ6H3YJH.js → chunk-L54I45OX.js} +19 -16
  70. package/dist/bundle/{chunk-475P3LWG.js → chunk-LECMHK2F.js} +1 -1
  71. package/dist/bundle/{chunk-6PIXP5IH.js → chunk-LGESUPKO.js} +20 -20
  72. package/dist/bundle/{chunk-75JW7X2W.js → chunk-LVCCZI5A.js} +71 -61
  73. package/dist/bundle/chunk-M7OYEMLI.js +340 -0
  74. package/dist/bundle/{chunk-O4ZBFATF.js → chunk-MA4UJNUI.js} +12 -12
  75. package/dist/bundle/{chunk-RFXJLG5V.js → chunk-MBBR7QHI.js} +3377 -2720
  76. package/dist/bundle/{chunk-BNEJKGG7.js → chunk-N5ROXGY4.js} +78 -76
  77. package/dist/bundle/{chunk-BW5JEOBE.js → chunk-N62P5FY4.js} +12 -12
  78. package/dist/bundle/{chunk-5K54M6RD.js → chunk-NM5XMKWO.js} +1 -1
  79. package/dist/bundle/{chunk-EMYRUJCV.js → chunk-NQGGTO3B.js} +8 -8
  80. package/dist/bundle/{chunk-7U5X37TE.js → chunk-NS3JWBDR.js} +6 -6
  81. package/dist/bundle/{chunk-QIK2IBJ4.js → chunk-NX3BLISW.js} +23 -7
  82. package/dist/bundle/{chunk-2XZ2YKW4.js → chunk-OEQNP56V.js} +2 -100
  83. package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
  84. package/dist/bundle/{chunk-GCPO7T2X.js → chunk-PS7HQ5LQ.js} +3 -3
  85. package/dist/bundle/{chunk-MH4L5LL6.js → chunk-Q26UFIH4.js} +3 -3
  86. package/dist/bundle/{chunk-JXSEH64A.js → chunk-QFK52FG6.js} +3 -3
  87. package/dist/bundle/chunk-QNG27PGH.js +751 -0
  88. package/dist/bundle/{chunk-YR5TRWT2.js → chunk-R4CXFYQN.js} +139 -574
  89. package/dist/bundle/{chunk-YAA2D6RP.js → chunk-R6HP2XKD.js} +5 -5
  90. package/dist/bundle/{chunk-CHEHK6IW.js → chunk-RQFRXUI4.js} +77 -67
  91. package/dist/bundle/{chunk-CWCDCNXA.js → chunk-RRYHLP3A.js} +6 -6
  92. package/dist/bundle/{chunk-EPIA2UUM.js → chunk-SRUAUMBL.js} +12 -12
  93. package/dist/bundle/{chunk-TMYZKDQ7.js → chunk-T2BHIC37.js} +65 -65
  94. package/dist/bundle/{chunk-FSLR2YGR.js → chunk-T7QPZYRZ.js} +7 -7
  95. package/dist/bundle/{chunk-PKW3TPNP.js → chunk-TI4WJOEX.js} +13 -13
  96. package/dist/bundle/{chunk-ST3ZB7LS.js → chunk-UHMJSSQO.js} +1 -1
  97. package/dist/bundle/{chunk-GRYXOSN6.js → chunk-UMPUY77T.js} +10 -10
  98. package/dist/bundle/{chunk-Q5LUGY2V.js → chunk-UPR2S5IE.js} +9 -9
  99. package/dist/bundle/chunk-UUVWAVKN.js +80 -0
  100. package/dist/bundle/{chunk-DYRISFHZ.js → chunk-V3ZTAAJ6.js} +19 -9
  101. package/dist/bundle/{chunk-Q6MISDKJ.js → chunk-VAW7QGJA.js} +3 -3
  102. package/dist/bundle/{chunk-L6FM5RQY.js → chunk-VQTYJ6XH.js} +3 -3
  103. package/dist/bundle/{chunk-BIKHHFD2.js → chunk-VXD65V67.js} +1395 -1529
  104. package/dist/bundle/{chunk-XTCAWNBP.js → chunk-WHXYPLUE.js} +4 -4
  105. package/dist/bundle/chunk-WIX6BFRF.js +353 -0
  106. package/dist/bundle/{chunk-JJX4HKDV.js → chunk-WKNYNK7W.js} +4 -4
  107. package/dist/bundle/{chunk-NMETTKCV.js → chunk-XWKUGAG6.js} +14 -14
  108. package/dist/bundle/{chunk-3UONR5HW.js → chunk-XYQVVW4R.js} +1 -1
  109. package/dist/bundle/{chunk-RMX2WPWS.js → chunk-Y7XJA4EW.js} +4 -4
  110. package/dist/bundle/{chunk-Z3CPZ4I4.js → chunk-YIIGF643.js} +306 -306
  111. package/dist/bundle/{chunk-PMO2Z6DQ.js → chunk-YISJJNXT.js} +3 -3
  112. package/dist/bundle/{chunk-UX4JZMA4.js → chunk-YJKXCINQ.js} +28 -3
  113. package/dist/bundle/{chunk-U5N2PKKM.js → chunk-YNWBRDBX.js} +2 -2
  114. package/dist/bundle/{chunk-ZPZT46O6.js → chunk-YRDQ54G5.js} +33 -10
  115. package/dist/bundle/{chunk-VN7TKMOW.js → chunk-YUDVRFXN.js} +1 -1
  116. package/dist/bundle/{chunk-6I4C4ZFT.js → chunk-ZFRYFDZN.js} +2 -2
  117. package/dist/bundle/{chunk-IQWBGMCR.js → chunk-ZLYICF6A.js} +4 -4
  118. package/dist/bundle/{chunk-G5VH4WUF.js → chunk-ZMAPXIGC.js} +2 -2
  119. package/dist/bundle/{chunk-6MDL2LZA.js → chunk-ZNAX7GUV.js} +8 -8
  120. package/dist/bundle/{cli-QNBYDOKV.js → cli-WTGAGSXV.js} +142 -97
  121. package/dist/bundle/command-contract-3IKVWPDL.js +45 -0
  122. package/dist/bundle/{command-server-entry-WMA4SWJ5.js → command-server-entry-47CAYN3E.js} +35 -35
  123. package/dist/bundle/config-ZOGOKGTU.js +116 -0
  124. package/dist/bundle/{decode-7PXUXNIP.js → decode-2G7QS5IQ.js} +6 -6
  125. package/dist/bundle/{dispatch-AWDROXWN.js → dispatch-ZAP3KBVJ.js} +9 -9
  126. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  127. package/dist/bundle/{dist-TSBH4FOU.js → dist-WY6R3WH7.js} +21 -21
  128. package/dist/bundle/{echarts-WIDIUEO6.js → echarts-YRRVLEX3.js} +2 -2
  129. package/dist/bundle/{embed-EIRVQF5E.js → embed-B5H3OW2O.js} +7 -7
  130. package/dist/bundle/{embedder-MXPM6OXK.js → embedder-3O73SP6Y.js} +10 -10
  131. package/dist/bundle/{failure-JZW73RP7.js → failure-EYGW7JMC.js} +3 -3
  132. package/dist/bundle/first-run-MPKMDEMA.js +29 -0
  133. package/dist/bundle/first-screen-AIAAC3KF.js +45 -0
  134. package/dist/bundle/{folders-TGFOE7DY.js → folders-4CGFWM6H.js} +5 -5
  135. package/dist/bundle/{instructions-D5LNE6NJ.js → instructions-AG7SRWTR.js} +1 -1
  136. package/dist/bundle/{main-OHW5Z56X.js → main-DOGY6FJP.js} +24 -24
  137. package/dist/bundle/{mcp-RGNRW77S.js → mcp-YGOAUNC3.js} +2 -2
  138. package/dist/bundle/meeting-combined-YKPKTKGA.js +26 -0
  139. package/dist/bundle/meeting-model-HTXSGHNM.js +26 -0
  140. package/dist/bundle/{meeting-semantic-FYOVY4S2.js → meeting-semantic-FOEBWV3P.js} +8 -8
  141. package/dist/bundle/{meetings-WI4SXPBJ.js → meetings-PVE4C2NF.js} +7 -7
  142. package/dist/bundle/{node-UEWUFR7N.js → node-GJQYN4FT.js} +2 -2
  143. package/dist/bundle/{node-sqlite-FJWKJHYU.js → node-sqlite-MLRYKVCQ.js} +8 -8
  144. package/dist/bundle/oauth-AC55C6SG.js +20 -0
  145. package/dist/bundle/{open-EFYTWUGC.js → open-3LGTYP6M.js} +6 -6
  146. package/dist/bundle/openai-E2MSLVIX.js +28 -0
  147. package/dist/bundle/{output-file-J4SU6X4I.js → output-file-FXMTTLOI.js} +6 -6
  148. package/dist/bundle/{process-U5PLNIDC.js → process-MEKCZMX3.js} +1 -1
  149. package/dist/bundle/{program-3JICCSA6.js → program-E5BSSIGY.js} +164 -155
  150. package/dist/bundle/{prompt-YPDMSOKC.js → prompt-AIA6QSZK.js} +6 -6
  151. package/dist/bundle/{recognize-Z2SSWUKH.js → recognize-M57VNTEV.js} +5 -5
  152. package/dist/bundle/{remote-R5HMDHOG.js → remote-3OTENZ7Z.js} +11 -11
  153. package/dist/bundle/{rerank-6NGBEMQ2.js → rerank-P5WHDFDU.js} +8 -8
  154. package/dist/bundle/run-log-EOQ4EQDS.js +143 -0
  155. package/dist/bundle/{serve-CU3RMWU7.js → serve-BRLC2QVV.js} +11 -11
  156. package/dist/bundle/{server-SOQSVX2Q.js → server-25NF7DMS.js} +80 -69
  157. package/dist/bundle/server-EW2RL2EL.js +93 -0
  158. package/dist/bundle/{services-LROZ3RDT.js → services-MJE43OGD.js} +54 -52
  159. package/dist/bundle/{speech-AS77HFIF.js → speech-4AVCWTQH.js} +28 -28
  160. package/dist/bundle/{sqlite-runtime-U25NS6BK.js → sqlite-runtime-U4TQXWMC.js} +7 -7
  161. package/dist/bundle/{state-CPEVKK66.js → state-GNUGVMY7.js} +7 -7
  162. package/dist/bundle/{store-6CHRMJM7.js → store-KBFZVQWF.js} +31 -24
  163. package/dist/bundle/{store-QKHCZOYR.js → store-MHVBFUBB.js} +27 -26
  164. package/dist/bundle/store-connection-SKRUAI4L.js +109 -0
  165. package/dist/bundle/store-maintenance-command-G6EXJSHJ.js +81 -0
  166. package/dist/bundle/{streaming-VDJOYGMO.js → streaming-6F7AFEHD.js} +7 -7
  167. package/dist/bundle/surface-DWEWB5RG.js +79 -0
  168. package/dist/bundle/{tokens-JBN2OHQB.js → tokens-BB4MQBLH.js} +11 -10
  169. package/dist/bundle/zm.js +9 -9
  170. package/dist/bundle/{zoom-app-Q4IKYNG3.js → zoom-app-YTGOZ2FS.js} +8 -8
  171. package/dist/commands.d.ts +1 -0
  172. package/dist/commands.d.ts.map +1 -1
  173. package/dist/commands.js +8 -2
  174. package/dist/commands.js.map +1 -1
  175. package/dist/setup-commands.d.ts +1 -1
  176. package/dist/setup-commands.d.ts.map +1 -1
  177. package/dist/setup-commands.js +31 -5
  178. package/dist/setup-commands.js.map +1 -1
  179. package/dist/version.d.ts +1 -1
  180. package/dist/version.js +1 -1
  181. package/dist/zoom-api/types.d.ts +5 -0
  182. package/dist/zoom-api/types.d.ts.map +1 -1
  183. package/package.json +3 -3
  184. package/dist/bundle/answer-policy-7PYXHK2I.js +0 -122
  185. package/dist/bundle/chunk-3BTRJYIT.js +0 -729
  186. package/dist/bundle/command-contract-CT6MV6YG.js +0 -45
  187. package/dist/bundle/config-ZFQFDEVL.js +0 -109
  188. package/dist/bundle/first-run-K6EHRAIM.js +0 -29
  189. package/dist/bundle/first-screen-C6AF4KT4.js +0 -45
  190. package/dist/bundle/meeting-combined-3OKFXZNA.js +0 -26
  191. package/dist/bundle/meeting-model-4XNF725D.js +0 -26
  192. package/dist/bundle/oauth-KOONTGLW.js +0 -20
  193. package/dist/bundle/openai-6Y2JRDNY.js +0 -28
  194. package/dist/bundle/run-log-LG3TI3WI.js +0 -136
  195. package/dist/bundle/server-X7JYRMKX.js +0 -85
  196. package/dist/bundle/store-connection-FCDVOPWB.js +0 -102
  197. package/dist/bundle/store-maintenance-command-6HVOAHOZ.js +0 -77
@@ -0,0 +1,340 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ throughWrapper
5
+ } from "./chunk-QNG27PGH.js";
6
+ import {
7
+ environmentOf
8
+ } from "./chunk-EPASOAEI.js";
9
+ import {
10
+ readOnlyLockOf
11
+ } from "./chunk-FXZPAGHT.js";
12
+ import {
13
+ array,
14
+ boolean,
15
+ check,
16
+ pipe,
17
+ record,
18
+ safeParse,
19
+ strictObject,
20
+ string
21
+ } from "./chunk-YRDQ54G5.js";
22
+ import {
23
+ CliError
24
+ } from "./chunk-UHMJSSQO.js";
25
+ import {
26
+ __name
27
+ } from "./chunk-ZVVMGPBJ.js";
28
+
29
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/background/relay.js
30
+ import { createHash } from "node:crypto";
31
+ import { chmodSync, lstatSync, mkdirSync, rmSync } from "node:fs";
32
+ import { createConnection, createServer } from "node:net";
33
+ import { tmpdir } from "node:os";
34
+ import { dirname, isAbsolute, join } from "node:path";
35
+ import { PassThrough, Writable } from "node:stream";
36
+ var RELAY_PROTOCOL = 1;
37
+ var requestSchema = strictObject({
38
+ argv: array(string()),
39
+ env: record(string(), string()),
40
+ cwd: pipe(string(), check((path) => isAbsolute(path))),
41
+ tty: boolean(),
42
+ stdinTty: boolean()
43
+ });
44
+ var MAX_CLIENT_LINE = 1024 * 1024;
45
+ var MAX_SERVE_LINE = 64 * 1024 * 1024;
46
+ var MAX_SOCKET_PATH = 100;
47
+ var relayPath = /* @__PURE__ */ __name((lockPath) => {
48
+ const beside = lockPath.replace(/\.lock$/, ".sock");
49
+ if (beside.length <= MAX_SOCKET_PATH)
50
+ return beside;
51
+ const hash = createHash("sha256").update(beside).digest("hex").slice(0, 16);
52
+ const name = join(`wirecat-relay-${process.getuid?.() ?? "user"}`, `${hash}.sock`);
53
+ const temporary = join(tmpdir(), name);
54
+ if (temporary.length <= MAX_SOCKET_PATH || process.platform === "win32")
55
+ return temporary;
56
+ return join("/tmp", name);
57
+ }, "relayPath");
58
+ var privateDirectory = /* @__PURE__ */ __name((dir) => {
59
+ mkdirSync(dir, { recursive: true, mode: 448 });
60
+ const stat = lstatSync(dir);
61
+ const mine = process.getuid === void 0 || stat.uid === process.getuid();
62
+ if (!stat.isDirectory() || !mine || (stat.mode & 63) !== 0) {
63
+ throw new CliError("permission_error", `${dir} is not a private directory, so serve does not listen there`);
64
+ }
65
+ }, "privateDirectory");
66
+ var lines = /* @__PURE__ */ __name((socket, max, onLine, onTooLong) => {
67
+ let buffered = "";
68
+ socket.setEncoding("utf8");
69
+ socket.on("data", (chunk) => {
70
+ buffered += chunk;
71
+ for (let end = buffered.indexOf("\n"); end >= 0; end = buffered.indexOf("\n")) {
72
+ const line = buffered.slice(0, end);
73
+ buffered = buffered.slice(end + 1);
74
+ if (line)
75
+ onLine(line);
76
+ }
77
+ if (buffered.length > max)
78
+ onTooLong();
79
+ });
80
+ }, "lines");
81
+ var frame = /* @__PURE__ */ __name((socket, value) => {
82
+ if (!socket.destroyed)
83
+ socket.write(`${JSON.stringify(value)}
84
+ `);
85
+ }, "frame");
86
+ var listenRelay = /* @__PURE__ */ __name(async (path, run) => {
87
+ privateDirectory(dirname(path));
88
+ rmSync(path, { force: true });
89
+ const open = /* @__PURE__ */ new Set();
90
+ const running = /* @__PURE__ */ new Set();
91
+ const server = createServer((socket) => {
92
+ open.add(socket);
93
+ const stop = new AbortController();
94
+ const stdin = new PassThrough();
95
+ let started = false;
96
+ socket.on("error", () => {
97
+ });
98
+ socket.on("close", () => {
99
+ open.delete(socket);
100
+ stop.abort(new CliError("cancelled", "the client went away", { retryable: false }));
101
+ if (!stdin.writableEnded)
102
+ stdin.end();
103
+ });
104
+ lines(socket, MAX_CLIENT_LINE, (line) => {
105
+ let message;
106
+ try {
107
+ message = JSON.parse(line);
108
+ } catch {
109
+ socket.destroy();
110
+ return;
111
+ }
112
+ if (!started) {
113
+ started = true;
114
+ if (message.v !== RELAY_PROTOCOL) {
115
+ frame(socket, { diagnostic: `serve speaks relay protocol ${RELAY_PROTOCOL}; restart it`, exit: 1 });
116
+ socket.end();
117
+ return;
118
+ }
119
+ const parsed = safeParse(requestSchema, message.run);
120
+ if (!parsed.success) {
121
+ socket.destroy();
122
+ return;
123
+ }
124
+ stdin.isTTY = parsed.output.stdinTty;
125
+ if (parsed.output.stdinTty)
126
+ stdin.end();
127
+ const job = serve(socket, parsed.output, stdin, stop.signal, run);
128
+ running.add(job);
129
+ void job.then(() => running.delete(job), () => running.delete(job));
130
+ return;
131
+ }
132
+ if (typeof message.stdin === "string" && !stdin.writableEnded)
133
+ stdin.write(Buffer.from(message.stdin, "base64"));
134
+ if (message.stdinEnd === true && !stdin.writableEnded)
135
+ stdin.end();
136
+ }, () => socket.destroy());
137
+ });
138
+ await new Promise((resolve, reject) => {
139
+ server.once("error", reject);
140
+ server.listen(path, () => {
141
+ server.off("error", reject);
142
+ resolve();
143
+ });
144
+ });
145
+ chmodSync(path, 384);
146
+ return {
147
+ close: /* @__PURE__ */ __name(async () => {
148
+ for (const socket of open)
149
+ socket.destroy();
150
+ await new Promise((resolve) => server.close(() => resolve()));
151
+ await Promise.allSettled(running);
152
+ rmSync(path, { force: true });
153
+ }, "close")
154
+ };
155
+ }, "listenRelay");
156
+ var serve = /* @__PURE__ */ __name(async (socket, request, stdin, signal, run) => {
157
+ const streams = {
158
+ data: /* @__PURE__ */ __name((text) => frame(socket, { data: text }), "data"),
159
+ diagnostic: /* @__PURE__ */ __name((text) => frame(socket, { diagnostic: text }), "diagnostic"),
160
+ progress: /* @__PURE__ */ __name((text) => frame(socket, { progress: text }), "progress")
161
+ };
162
+ const stdout = new Writable({
163
+ write: /* @__PURE__ */ __name((chunk, _encoding, done) => {
164
+ frame(socket, { raw: Buffer.from(chunk).toString("base64") });
165
+ done();
166
+ }, "write")
167
+ });
168
+ let code = 1;
169
+ try {
170
+ code = await run(request, { streams, stdin, stdout, signal });
171
+ } finally {
172
+ frame(socket, { exit: code });
173
+ socket.end();
174
+ }
175
+ }, "serve");
176
+ var relayCommand = /* @__PURE__ */ __name((path, request, options) => new Promise((resolve, reject) => {
177
+ const { streams, stdin, stdout, signal, deadlineMs, writes, holder, listens = false } = options;
178
+ const socket = createConnection(path);
179
+ let connected = false;
180
+ let settled = false;
181
+ let timer;
182
+ const forward = /* @__PURE__ */ __name((chunk) => frame(socket, { stdin: Buffer.from(chunk).toString("base64") }), "forward");
183
+ const ended = /* @__PURE__ */ __name(() => frame(socket, { stdinEnd: true }), "ended");
184
+ const brokenPipe = /* @__PURE__ */ __name((error) => {
185
+ if (error.code === "EPIPE")
186
+ finish({ code: 0 });
187
+ }, "brokenPipe");
188
+ const finish = /* @__PURE__ */ __name((outcome) => {
189
+ if (settled)
190
+ return;
191
+ settled = true;
192
+ if (timer)
193
+ clearTimeout(timer);
194
+ stdout.off("error", brokenPipe);
195
+ signal.removeEventListener("abort", aborted);
196
+ stdin.off("data", forward).off("end", ended);
197
+ stdin.pause();
198
+ socket.destroy();
199
+ if ("code" in outcome)
200
+ resolve(outcome.code);
201
+ else
202
+ reject(outcome.error);
203
+ }, "finish");
204
+ const stopped = /* @__PURE__ */ __name(() => writes ? new CliError("outcome_unknown", `${holder} stopped before the command finished; it may have run \u2014 check before repeating it`, { retryable: false }) : new CliError("provider_unavailable", `${holder} stopped before the command finished`, { retryable: true }), "stopped");
205
+ const aborted = /* @__PURE__ */ __name(() => finish(listens ? { code: 0 } : { error: signal.reason }), "aborted");
206
+ if (signal.aborted)
207
+ return aborted();
208
+ signal.addEventListener("abort", aborted, { once: true });
209
+ stdout.on("error", brokenPipe);
210
+ if (deadlineMs !== void 0)
211
+ timer = setTimeout(() => finish({ error: stopped() }), deadlineMs);
212
+ socket.on("connect", () => {
213
+ connected = true;
214
+ frame(socket, { v: RELAY_PROTOCOL, run: request });
215
+ if (request.stdinTty)
216
+ ended();
217
+ else {
218
+ stdin.on("data", forward).once("end", ended);
219
+ stdin.resume();
220
+ }
221
+ });
222
+ socket.on("error", (error) => {
223
+ if (connected)
224
+ return finish({ error: stopped() });
225
+ finish({
226
+ error: new CliError("provider_unavailable", `${holder} holds the connection but does not answer its relay (${error.code ?? error.message}) \u2014 restart it`, { retryable: false, sent: false })
227
+ });
228
+ });
229
+ socket.on("close", () => finish({ error: stopped() }));
230
+ lines(socket, MAX_SERVE_LINE, (line) => {
231
+ let message;
232
+ try {
233
+ message = JSON.parse(line);
234
+ } catch {
235
+ return finish({ error: stopped() });
236
+ }
237
+ if (typeof message.data === "string")
238
+ streams.data(message.data);
239
+ if (typeof message.diagnostic === "string")
240
+ streams.diagnostic(message.diagnostic);
241
+ if (typeof message.progress === "string")
242
+ streams.progress?.(message.progress);
243
+ if (typeof message.raw === "string")
244
+ stdout.write(Buffer.from(message.raw, "base64"));
245
+ if (typeof message.exit === "number")
246
+ finish({ code: message.exit });
247
+ }, () => finish({ error: stopped() }));
248
+ }), "relayCommand");
249
+
250
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-relay.js
251
+ var lentConnection = /* @__PURE__ */ __name((connection, watchers) => throughWrapper(connection, {
252
+ close: /* @__PURE__ */ __name(async () => {
253
+ }, "close"),
254
+ feed: void 0,
255
+ storedChats: void 0,
256
+ listen: void 0,
257
+ listenHistory: void 0,
258
+ ...connection.watch && watchers ? {
259
+ // A watcher that throws (its output limit, a closed reader) ends its own watch, never serve's.
260
+ watch: /* @__PURE__ */ __name(async (onEvent, signal, onReady) => {
261
+ let watcher;
262
+ try {
263
+ await new Promise((resolve, reject) => {
264
+ watcher = /* @__PURE__ */ __name((event) => {
265
+ try {
266
+ onEvent(event);
267
+ } catch (error) {
268
+ reject(error);
269
+ }
270
+ }, "watcher");
271
+ watchers.add(watcher);
272
+ signal.addEventListener("abort", () => resolve(), { once: true });
273
+ onReady?.();
274
+ if (signal.aborted)
275
+ resolve();
276
+ });
277
+ } finally {
278
+ if (watcher)
279
+ watchers.delete(watcher);
280
+ }
281
+ }, "watch")
282
+ } : { watch: void 0 }
283
+ }), "lentConnection");
284
+ var serveRelay = /* @__PURE__ */ __name((command, messenger) => {
285
+ let held;
286
+ let relay;
287
+ const watchers = /* @__PURE__ */ new Set();
288
+ const borrowed = /* @__PURE__ */ __name(() => {
289
+ const connection = held;
290
+ if (!connection)
291
+ throw new CliError("provider_unavailable", "serve is not connected yet", { retryable: true });
292
+ return lentConnection(connection, watchers);
293
+ }, "borrowed");
294
+ return {
295
+ messenger: {
296
+ ...messenger,
297
+ connect: /* @__PURE__ */ __name(async (...args) => {
298
+ held = await messenger.connect(...args);
299
+ return held;
300
+ }, "connect")
301
+ },
302
+ arrived: /* @__PURE__ */ __name((event) => {
303
+ for (const watcher of watchers)
304
+ watcher(event);
305
+ }, "arrived"),
306
+ /** Listens beside the lock; the address goes into it, which is how a client finds it. */
307
+ open: /* @__PURE__ */ __name(async (lockPath, profile) => {
308
+ const environment = environmentOf(command);
309
+ const runCommand = environment.runCommand;
310
+ if (!runCommand)
311
+ return void 0;
312
+ const readOnly = readOnlyLockOf(messenger.app, environment.env ?? process.env);
313
+ const path = relayPath(lockPath);
314
+ relay = await listenRelay(path, (request, io) => runCommand(request.argv, {
315
+ env: {
316
+ ...request.env,
317
+ ...readOnly ? { [`${messenger.app.envPrefix}_READ_ONLY`]: "1" } : {}
318
+ },
319
+ streams: io.streams,
320
+ stdin: io.stdin,
321
+ stdout: io.stdout,
322
+ tty: request.tty,
323
+ signal: io.signal,
324
+ answer: /* @__PURE__ */ __name(() => null, "answer"),
325
+ relayed: { profile, cwd: request.cwd, connection: borrowed }
326
+ }));
327
+ return { path, protocol: RELAY_PROTOCOL };
328
+ }, "open"),
329
+ close: /* @__PURE__ */ __name(async () => {
330
+ await relay?.close();
331
+ }, "close")
332
+ };
333
+ }, "serveRelay");
334
+
335
+ export {
336
+ RELAY_PROTOCOL,
337
+ relayCommand,
338
+ lentConnection,
339
+ serveRelay
340
+ };
@@ -2,31 +2,31 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  validateFormattedText
5
- } from "./chunk-5XO2AY6D.js";
5
+ } from "./chunk-7JWVPJIP.js";
6
6
  import {
7
7
  inputPolicy
8
- } from "./chunk-6CDMGT6Q.js";
8
+ } from "./chunk-5EWYDHBH.js";
9
9
  import {
10
10
  RECORDS_SCHEMA_VERSION,
11
11
  RECORD_TYPES,
12
12
  pointerOf
13
- } from "./chunk-6PIXP5IH.js";
13
+ } from "./chunk-LGESUPKO.js";
14
14
  import {
15
15
  indent
16
- } from "./chunk-BNEJKGG7.js";
16
+ } from "./chunk-N5ROXGY4.js";
17
17
  import {
18
18
  CliError
19
- } from "./chunk-ST3ZB7LS.js";
19
+ } from "./chunk-UHMJSSQO.js";
20
20
  import {
21
21
  __name
22
22
  } from "./chunk-ZVVMGPBJ.js";
23
23
 
24
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_d368e4a5540cfb6719e97dbe530c5868/node_modules/@wirecat/cli-core/dist/domain/checks.js
24
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/domain/checks.js
25
25
  var spelled = /* @__PURE__ */ __name((check, args) => `${check.replaceAll(".", " ")}${args === void 0 ? "" : ` ${args}`}`, "spelled");
26
26
  var bareCheck = /* @__PURE__ */ __name((check, args) => `\`${spelled(check, args)}\``, "bareCheck");
27
27
  var checkWords = /* @__PURE__ */ __name((command, profile) => (check, args) => `\`${command} ${profile === void 0 ? "" : `${profile} `}${spelled(check, args)}\``, "checkWords");
28
28
 
29
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_d368e4a5540cfb6719e97dbe530c5868/node_modules/@wirecat/cli-core/dist/domain/markdown.js
29
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/domain/markdown.js
30
30
  var MARKERS = [
31
31
  ["**", "bold"],
32
32
  ["~~", "strike"],
@@ -72,7 +72,7 @@ var closing = /* @__PURE__ */ __name((input, open, marker) => {
72
72
  return end;
73
73
  }, "closing");
74
74
 
75
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_d368e4a5540cfb6719e97dbe530c5868/node_modules/@wirecat/cli-core/dist/domain/markdown-spans.js
75
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/domain/markdown-spans.js
76
76
  var STYLES = [
77
77
  ["**", "bold"],
78
78
  ["__", "underline"],
@@ -232,7 +232,7 @@ var parseMarkdownSpans = /* @__PURE__ */ __name((input) => {
232
232
  return validateFormattedText(result);
233
233
  }, "parseMarkdownSpans");
234
234
 
235
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_d368e4a5540cfb6719e97dbe530c5868/node_modules/@wirecat/cli-core/dist/domain/polls.js
235
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/domain/polls.js
236
236
  var countedPoll = /* @__PURE__ */ __name((poll, votes, self) => {
237
237
  const cast = votes.filter((vote) => vote.answers.length > 0);
238
238
  const mine = self === null ? void 0 : votes.find((vote) => vote.person.id === self);
@@ -247,7 +247,7 @@ var countedPoll = /* @__PURE__ */ __name((poll, votes, self) => {
247
247
  };
248
248
  }, "countedPoll");
249
249
 
250
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_d368e4a5540cfb6719e97dbe530c5868/node_modules/@wirecat/cli-core/dist/domain/records-table.js
250
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/domain/records-table.js
251
251
  var TABLE_RECORD_TYPES = Object.keys(RECORD_TYPES).filter((type) => RECORD_TYPES[type].sheet !== false);
252
252
  var TableError = class extends Error {
253
253
  static {
@@ -2237,7 +2237,7 @@ var createDataURL = /* @__PURE__ */ __name(function(width, height, getPixel) {
2237
2237
  var qrcode_default = qrcode;
2238
2238
  var stringToBytes = qrcode.stringToBytes;
2239
2239
 
2240
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_d368e4a5540cfb6719e97dbe530c5868/node_modules/@wirecat/cli-core/dist/terminal/qr.js
2240
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/terminal/qr.js
2241
2241
  var QUIET_ZONE = 4;
2242
2242
  var BLACK_ON_WHITE = "\x1B[30;107m";
2243
2243
  var RESET = "\x1B[0m";
@@ -2284,7 +2284,7 @@ var plainQr = /* @__PURE__ */ __name((link) => {
2284
2284
  return lines.join("\n");
2285
2285
  }, "plainQr");
2286
2286
 
2287
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_d368e4a5540cfb6719e97dbe530c5868/node_modules/@wirecat/cli-core/dist/terminal/login-qr.js
2287
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/terminal/login-qr.js
2288
2288
  var MARGIN = 2;
2289
2289
  var atTerminal = /* @__PURE__ */ __name((input) => input.isTTY === true && !inputPolicy(input).noInput, "atTerminal");
2290
2290
  var PASTE_QR = "agents: paste the QR code above into the chat as a code block, exactly as printed; when a new one is printed, paste it and say the old one expired";