@wirecat/zoom-cli 0.73.0 → 0.75.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 (137) hide show
  1. package/contracts/wirecat.json +5 -4
  2. package/dist/bin/zm.js +2 -2
  3. package/dist/bundle/{all-profiles-V47CUJFK.js → all-profiles-WFLKFKJC.js} +19 -29
  4. package/dist/bundle/answer-policy-XCKC2LLN.js +110 -0
  5. package/dist/bundle/{anthropic-SID7Z3QN.js → anthropic-H45W4P22.js} +2 -2
  6. package/dist/bundle/{app-server-KCMUSY4A.js → app-server-I4FPLBIX.js} +49 -66
  7. package/dist/bundle/{bun-PWMM6L45.js → bun-V5QLYBZU.js} +2 -2
  8. package/dist/bundle/{bun-sqlite-3TLKUN5A.js → bun-sqlite-X2YZPHDS.js} +3 -3
  9. package/dist/bundle/{chunk-PGPHEC2X.js → chunk-2Q4CB4EI.js} +1 -1
  10. package/dist/bundle/{chunk-PACLT6IW.js → chunk-3U3W6YY5.js} +69 -68
  11. package/dist/bundle/{chunk-QVJMFZFW.js → chunk-3URYKAJP.js} +1 -1
  12. package/dist/bundle/{chunk-UYBLNGZ2.js → chunk-3YKAFLXY.js} +1 -1
  13. package/dist/bundle/{chunk-IKNOTHG2.js → chunk-3YRPDNWK.js} +544 -142
  14. package/dist/bundle/{chunk-CMWFYZ45.js → chunk-4J5GJJ2I.js} +1 -1
  15. package/dist/bundle/{chunk-Y3IH7EZC.js → chunk-4XDWV6VJ.js} +16 -16
  16. package/dist/bundle/{chunk-KHBZ4OEP.js → chunk-4YNUQGDP.js} +1 -1
  17. package/dist/bundle/{chunk-35CYSRGJ.js → chunk-532H3KT3.js} +2 -2
  18. package/dist/bundle/{chunk-TI2OANJZ.js → chunk-6XNTELM5.js} +1 -1
  19. package/dist/bundle/chunk-7ZVWV33Z.js +707 -0
  20. package/dist/bundle/{chunk-ERQRY6WZ.js → chunk-A3Q3PG54.js} +1 -1
  21. package/dist/bundle/{chunk-JQF4LM3V.js → chunk-AVCYD4WQ.js} +20 -19
  22. package/dist/bundle/{chunk-P4FU6R3Z.js → chunk-B6Q53CVA.js} +7 -7
  23. package/dist/bundle/{chunk-KSNJK4QM.js → chunk-BY2YPKZZ.js} +12 -12
  24. package/dist/bundle/{chunk-L6YSKCC3.js → chunk-C5WQ57AB.js} +1 -1
  25. package/dist/bundle/{chunk-AIEMFRBU.js → chunk-CAQ5GW3A.js} +1 -1
  26. package/dist/bundle/{chunk-G2TSDMTA.js → chunk-DQBLDZ7M.js} +3 -3
  27. package/dist/bundle/{chunk-ILDGZBZD.js → chunk-DUPFAY35.js} +6 -6
  28. package/dist/bundle/{chunk-GCZMYDKU.js → chunk-ELD5AC7Q.js} +2 -2
  29. package/dist/bundle/{chunk-CIUJEQH4.js → chunk-EOZAJGB4.js} +11 -12
  30. package/dist/bundle/{chunk-VJVYGTPM.js → chunk-F6RB5FHZ.js} +1 -1
  31. package/dist/bundle/{chunk-LVDTSCIN.js → chunk-F7K2V6OA.js} +10 -10
  32. package/dist/bundle/{chunk-4LFFDUUW.js → chunk-FBYGBR4Q.js} +3 -3
  33. package/dist/bundle/{chunk-6AO2RSYH.js → chunk-GPVSGZ4R.js} +1608 -1096
  34. package/dist/bundle/{chunk-2NQPB6MT.js → chunk-GU4FVTJV.js} +17 -1
  35. package/dist/bundle/{chunk-6NI4FE5G.js → chunk-HKPNQL52.js} +3 -3
  36. package/dist/bundle/{chunk-KUL7S5Y3.js → chunk-IDGWBKMH.js} +10 -10
  37. package/dist/bundle/{chunk-QS6DWXDB.js → chunk-IMDTC4MD.js} +34 -20
  38. package/dist/bundle/{chunk-LSVQCI6V.js → chunk-IO3BQ6JU.js} +22 -22
  39. package/dist/bundle/{chunk-V5Q2QKYM.js → chunk-IW245Q5B.js} +23 -25
  40. package/dist/bundle/{chunk-DPSTOVKC.js → chunk-JDTZCZ5K.js} +2 -2
  41. package/dist/bundle/{chunk-JIS34MLC.js → chunk-JTYWSXJG.js} +7 -7
  42. package/dist/bundle/{chunk-K5JFX5TK.js → chunk-K5E5MB4C.js} +18 -18
  43. package/dist/bundle/{chunk-VPPNYUQM.js → chunk-L5UILROP.js} +322 -11
  44. package/dist/bundle/{chunk-DYLYH7VE.js → chunk-LRCSDAYK.js} +3 -3
  45. package/dist/bundle/{chunk-PJ3FKBXG.js → chunk-MHXZ62CU.js} +1 -1
  46. package/dist/bundle/{chunk-OKOJEBHK.js → chunk-MNVT7EJS.js} +2 -2
  47. package/dist/bundle/{chunk-HAMDPWEZ.js → chunk-NE4GYKQA.js} +5 -5
  48. package/dist/bundle/{chunk-PKON63JH.js → chunk-NL6AZ6S2.js} +1 -1
  49. package/dist/bundle/{chunk-N3SOTKXC.js → chunk-NQLL4KRN.js} +5 -5
  50. package/dist/bundle/{chunk-XLY7V2LB.js → chunk-NQQVNLO6.js} +10 -10
  51. package/dist/bundle/{chunk-44YVZIA4.js → chunk-NU4FSSMN.js} +2 -2
  52. package/dist/bundle/{chunk-ZVQDOKDY.js → chunk-OUM4ZO53.js} +1 -1
  53. package/dist/bundle/{chunk-OU5OXA6Q.js → chunk-P4ZQQLZF.js} +1772 -718
  54. package/dist/bundle/{chunk-OMLVWOEF.js → chunk-P6MQ6FS4.js} +184 -16
  55. package/dist/bundle/{chunk-NBA2V6LB.js → chunk-PCJRHC5Y.js} +7 -7
  56. package/dist/bundle/{chunk-G3SIY4MQ.js → chunk-PPM7UTCT.js} +22 -21
  57. package/dist/bundle/{chunk-3ADFJ3UP.js → chunk-PX4IMYVB.js} +2 -2
  58. package/dist/bundle/{chunk-FJMRDRPN.js → chunk-QBKKTTA3.js} +1155 -484
  59. package/dist/bundle/{chunk-ZX4QWTMQ.js → chunk-QEO3XTIE.js} +37 -29
  60. package/dist/bundle/{chunk-FZLJ2G7A.js → chunk-QXQUANWE.js} +4 -4
  61. package/dist/bundle/{chunk-MG2CCAVG.js → chunk-RABCFGT3.js} +2 -2
  62. package/dist/bundle/{chunk-SYIOT45G.js → chunk-RBYVQE3S.js} +4 -4
  63. package/dist/bundle/{chunk-6WUTUCKH.js → chunk-RKI4BGWG.js} +2 -2
  64. package/dist/bundle/{chunk-EXWZCI5G.js → chunk-SEJBS7SI.js} +1 -1
  65. package/dist/bundle/{chunk-LQYMN36C.js → chunk-SR5X7YKB.js} +1 -1
  66. package/dist/bundle/{chunk-KK2IVZUQ.js → chunk-T25PR26L.js} +5 -5
  67. package/dist/bundle/{chunk-ZAIE3G5I.js → chunk-T4FMXDDV.js} +2 -2
  68. package/dist/bundle/{chunk-SO52EJ2W.js → chunk-TSHUBGN4.js} +2 -2
  69. package/dist/bundle/{chunk-OFA22L4G.js → chunk-V3UK6E5B.js} +4 -4
  70. package/dist/bundle/{chunk-Q43KX56Z.js → chunk-VLK3X53X.js} +2 -2
  71. package/dist/bundle/{chunk-Z5XCU4S7.js → chunk-VPSQZ2YR.js} +44 -52
  72. package/dist/bundle/{chunk-QWGEOQHA.js → chunk-VUPWDCYV.js} +1 -1
  73. package/dist/bundle/{chunk-K7EMVFJ7.js → chunk-W2AC2RAG.js} +13 -13
  74. package/dist/bundle/{chunk-UIKVP23D.js → chunk-WQOGHND4.js} +1 -1
  75. package/dist/bundle/{chunk-ETQNHS3A.js → chunk-WUWF4EXZ.js} +6 -6
  76. package/dist/bundle/{chunk-HO3GBTIT.js → chunk-XCJGDPMN.js} +1547 -917
  77. package/dist/bundle/{chunk-2VYEGKQ3.js → chunk-XUHQ7DVT.js} +1 -1
  78. package/dist/bundle/{chunk-IE7YBRUO.js → chunk-Y5J5CAG2.js} +1 -1
  79. package/dist/bundle/{chunk-MOKEB656.js → chunk-ZBYKCVSV.js} +1 -1
  80. package/dist/bundle/{chunk-CQBLPBZU.js → chunk-ZVVRRMLW.js} +98 -6
  81. package/dist/bundle/{cli-4ZYJ6OZE.js → cli-NPRYCWFH.js} +112 -83
  82. package/dist/bundle/command-contract-OJYRKQHR.js +41 -0
  83. package/dist/bundle/{command-server-entry-CASONRIJ.js → command-server-entry-BV4SUPUI.js} +24 -26
  84. package/dist/bundle/config-UMEV24OE.js +97 -0
  85. package/dist/bundle/{decode-KEFCVGEB.js → decode-PRMKCHHC.js} +2 -2
  86. package/dist/bundle/{dist-GCQ7KCKN.js → dist-HGLDGKUW.js} +18 -15
  87. package/dist/bundle/{echarts-SDZA2SWG.js → echarts-QIXLXS3G.js} +2 -2
  88. package/dist/bundle/{embed-43VJEPM6.js → embed-OZN2BIJY.js} +3 -3
  89. package/dist/bundle/{embedder-Q4ZHAGRP.js → embedder-RBDHO6Z6.js} +6 -6
  90. package/dist/bundle/{first-run-CPOLQVNA.js → first-run-HNCD7U3B.js} +6 -6
  91. package/dist/bundle/first-screen-374BBMO6.js +39 -0
  92. package/dist/bundle/{instructions-7T6JJIFS.js → instructions-MD2RZT5Z.js} +1 -1
  93. package/dist/bundle/{main-NA3QVPXS.js → main-FPMCCRIQ.js} +15 -15
  94. package/dist/bundle/{meetings-7CVIQJTA.js → meetings-WYCVHAIP.js} +17 -1
  95. package/dist/bundle/{node-BZDMUFTW.js → node-IEVT2FSJ.js} +2 -2
  96. package/dist/bundle/{node-sqlite-QHGB23B4.js → node-sqlite-O4C6IWSM.js} +4 -4
  97. package/dist/bundle/{oauth-BMEMCM2I.js → oauth-6VXOUXSE.js} +4 -4
  98. package/dist/bundle/{open-JGU2NRJP.js → open-AMUIWV3Y.js} +2 -2
  99. package/dist/bundle/{openai-VTXXFNCS.js → openai-MEDN6FSK.js} +10 -10
  100. package/dist/bundle/{process-756VBE7E.js → process-6Q23D3TO.js} +1 -1
  101. package/dist/bundle/{program-XM6CDIJ2.js → program-CF2NKA2A.js} +84 -87
  102. package/dist/bundle/{prompt-2IPFXJ4B.js → prompt-N3UZE4ZR.js} +2 -2
  103. package/dist/bundle/{recognize-672E2RIB.js → recognize-I5F3K3CZ.js} +1 -1
  104. package/dist/bundle/{remote-YLHRVPDS.js → remote-CJF5KMMY.js} +6 -6
  105. package/dist/bundle/{rerank-NBXQG3OS.js → rerank-6WLY6MKY.js} +4 -4
  106. package/dist/bundle/{run-log-3WITBT2F.js → run-log-FKF4ZX4M.js} +55 -57
  107. package/dist/bundle/{serve-FNLOUMYP.js → serve-FOQJ3WMX.js} +6 -6
  108. package/dist/bundle/server-BAGY5HEZ.js +74 -0
  109. package/dist/bundle/{server-7ZB5AK5H.js → server-OEEGRSQD.js} +47 -47
  110. package/dist/bundle/{services-Z4UWN64R.js → services-Q6SFESMS.js} +43 -28
  111. package/dist/bundle/{speech-XSYVCKR3.js → speech-PBVEIG4N.js} +12 -12
  112. package/dist/bundle/{sqlite-runtime-GAPXJNWU.js → sqlite-runtime-IWR65V6I.js} +3 -3
  113. package/dist/bundle/{state-QSA53EF5.js → state-G54C2N6U.js} +3 -3
  114. package/dist/bundle/{store-NOF5EYUC.js → store-7EWMPTTW.js} +20 -16
  115. package/dist/bundle/{store-EKI4OAJH.js → store-D5OLXIFW.js} +14 -14
  116. package/dist/bundle/store-connection-34747SCC.js +90 -0
  117. package/dist/bundle/store-maintenance-command-QBO67F7Z.js +65 -0
  118. package/dist/bundle/{tokens-WJQYQ3FK.js → tokens-J7TFHLEG.js} +4 -4
  119. package/dist/bundle/zm.js +2 -2
  120. package/dist/bundle/{zoom-app-Y7RMWLVU.js → zoom-app-SULPMVN4.js} +2 -2
  121. package/dist/recording-schedule-commands.d.ts.map +1 -1
  122. package/dist/recording-schedule-commands.js +2 -2
  123. package/dist/recording-schedule-commands.js.map +1 -1
  124. package/dist/version.d.ts +1 -1
  125. package/dist/version.js +1 -1
  126. package/package.json +2 -2
  127. package/dist/bundle/answer-policy-W6H72X2R.js +0 -112
  128. package/dist/bundle/chunk-2BAZRRJP.js +0 -1239
  129. package/dist/bundle/chunk-KQD4ZVNC.js +0 -153
  130. package/dist/bundle/chunk-R5FTCNLJ.js +0 -76
  131. package/dist/bundle/chunk-USIMMGWS.js +0 -997
  132. package/dist/bundle/command-contract-FJDDCHYP.js +0 -43
  133. package/dist/bundle/config-4DZHX2WX.js +0 -99
  134. package/dist/bundle/first-screen-XYESRGWW.js +0 -41
  135. package/dist/bundle/server-GGRGD4SH.js +0 -77
  136. package/dist/bundle/store-connection-2OZQGEIO.js +0 -92
  137. package/dist/bundle/store-maintenance-command-GNX3SOZ6.js +0 -67
@@ -1,153 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- createRenderer,
5
- fieldsOf,
6
- processStreams,
7
- projectFields
8
- } from "./chunk-HNWDEDMU.js";
9
- import {
10
- COMPACT_FLAG
11
- } from "./chunk-4RJL32PF.js";
12
- import {
13
- CliError
14
- } from "./chunk-EA2OB75T.js";
15
- import {
16
- singleLine
17
- } from "./chunk-HCZYJMBP.js";
18
- import {
19
- __name
20
- } from "./chunk-ZVVMGPBJ.js";
21
-
22
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/cli/result-fields.js
23
- var named = /* @__PURE__ */ __name((work) => {
24
- try {
25
- return work();
26
- } catch (error) {
27
- if (error instanceof CliError && error.code === "validation_error")
28
- throw new CliError("validation_error", "--json takes comma-separated field paths, for example --json=id,text", {
29
- param: "--json"
30
- });
31
- throw error;
32
- }
33
- }, "named");
34
- var fieldsOf2 = /* @__PURE__ */ __name((value) => named(() => fieldsOf(value)), "fieldsOf");
35
- var projectCommands = /* @__PURE__ */ __name((commands, fields) => commands.map((command) => ({
36
- ...projectFields(command, fields),
37
- path: command.path,
38
- name: command.name,
39
- origin: command.origin,
40
- effects: command.effects,
41
- commands: projectCommands(command.commands, fields)
42
- })), "projectCommands");
43
- var projectFields2 = /* @__PURE__ */ __name((value, fields) => named(() => {
44
- if (value && typeof value === "object" && "cli" in value && typeof value.cli === "string" && "contract" in value && "commands" in value && Array.isArray(value.commands))
45
- return { ...value, commands: projectCommands(value.commands, fields) };
46
- return projectFields(value, fields);
47
- }), "projectFields");
48
-
49
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/output-detail.js
50
- var RARELY_SET = ["editedAt", "replyTo", "forwardedFrom", "reactions"];
51
- var BRIEF = ["locator", "chatTitle", "timestamp", "senderName", "excerpt", "score"];
52
- var SNAKE_BRIEF = ["ref", "chat_title", "timestamp", "sender_name", "excerpt", "score"];
53
- var isRecord = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null, "isRecord");
54
- var isSnakeHit = /* @__PURE__ */ __name((value) => isRecord(value) && typeof value.ref === "string" && typeof value.excerpt === "string", "isSnakeHit");
55
- var isHit = /* @__PURE__ */ __name((value) => isSnakeHit(value) || isRecord(value) && typeof value.locator === "string" && typeof value.text === "string", "isHit");
56
- var picked = /* @__PURE__ */ __name((hit, keys) => Object.fromEntries(keys.flatMap((key) => hit[key] === void 0 || hit[key] === null ? [] : [[key, hit[key]]])), "picked");
57
- var shaped = /* @__PURE__ */ __name((hit, detail) => {
58
- if (isSnakeHit(hit))
59
- return detail === "brief" ? picked(hit, SNAKE_BRIEF) : hit;
60
- if (detail === "brief")
61
- return picked(hit, BRIEF);
62
- const { text, providerMetadata, ...rest } = hit;
63
- for (const key of RARELY_SET)
64
- if (rest[key] === null)
65
- delete rest[key];
66
- const metadata = rest.email ? void 0 : providerMetadata;
67
- return {
68
- ...rest,
69
- ...typeof rest.excerpt === "string" ? {} : { text },
70
- ...metadata === void 0 ? {} : { providerMetadata: metadata }
71
- };
72
- }, "shaped");
73
- var atDetail = /* @__PURE__ */ __name((value, detail = "default") => {
74
- if (detail === "full")
75
- return value;
76
- if (Array.isArray(value))
77
- return value.map((item) => isHit(item) ? shaped(item, detail) : item);
78
- if (isHit(value))
79
- return shaped(value, detail);
80
- if (typeof value === "object" && value !== null && Array.isArray(value.items))
81
- return { ...value, items: atDetail(value.items, detail) };
82
- return value;
83
- }, "atDetail");
84
-
85
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/output.js
86
- var refuseCompact = /* @__PURE__ */ __name(({ json, jsonl, fields, hitDetail }) => {
87
- const other = jsonl ? "--jsonl" : fields !== void 0 ? "--json=\u2026" : json ? "--json" : hitDetail === "brief" ? "--brief" : "";
88
- if (other)
89
- throw new CliError("validation_error", `${COMPACT_FLAG} and ${other} ask for different output \u2014 pick one`, {
90
- reason: "output.conflict",
91
- param: COMPACT_FLAG
92
- });
93
- }, "refuseCompact");
94
- var resolveOutput = /* @__PURE__ */ __name(({ json, jsonl, quiet, streams = processStreams, tty, color, fields, hitDetail, env = process.env, capture, compact } = {}) => {
95
- if (compact)
96
- refuseCompact({ json, jsonl, fields, hitDetail });
97
- const interactive = tty ?? process.stdout.isTTY === true;
98
- const format = jsonl ? "jsonl" : json || compact || !interactive ? "json" : "pretty";
99
- const painted = format === "pretty" && (color ?? (env.NO_COLOR === void 0 && env.TERM !== "dumb" && !env.CI));
100
- const printing = createRenderer({ format, color: painted, streams });
101
- const rendered = capture ? { ...printing, result: capture, stream: /* @__PURE__ */ __name((items) => capture([...items]), "stream") } : printing;
102
- const level = hitDetail ?? (fields === void 0 ? "default" : "full");
103
- const standard = format === "pretty" ? rendered : {
104
- ...rendered,
105
- result: /* @__PURE__ */ __name((value) => rendered.result(atDetail(value, level)), "result"),
106
- stream: /* @__PURE__ */ __name((items) => rendered.stream(atDetail([...items], level)), "stream")
107
- };
108
- const created = standard;
109
- const paths = fields === void 0 ? void 0 : fieldsOf2(fields);
110
- const renderer = format === "pretty" ? oneLineFields(created) : paths ? {
111
- ...created,
112
- result: /* @__PURE__ */ __name((value) => created.result(projectFields2(value, paths)), "result"),
113
- stream: /* @__PURE__ */ __name((items) => created.stream([...items].map((item) => projectFields2(item, paths))), "stream")
114
- } : created;
115
- return {
116
- format,
117
- color: painted,
118
- streams,
119
- renderer: quiet ? silence(renderer) : renderer,
120
- ...compact ? { compact: true, full: hitDetail === "full" } : {}
121
- };
122
- }, "resolveOutput");
123
- var MULTI_LINE = /* @__PURE__ */ new Set(["text", "description"]);
124
- var oneLineFields = /* @__PURE__ */ __name((renderer) => ({
125
- ...renderer,
126
- result: /* @__PURE__ */ __name((value) => renderer.result(oneLine(value)), "result"),
127
- stream: /* @__PURE__ */ __name((items) => renderer.stream([...items].map((item) => oneLine(item))), "stream")
128
- }), "oneLineFields");
129
- var oneLine = /* @__PURE__ */ __name((value, key) => {
130
- if (typeof value === "string")
131
- return key !== void 0 && MULTI_LINE.has(key) ? value : singleLine(value);
132
- if (Array.isArray(value))
133
- return value.map((item) => oneLine(item, key));
134
- if (value !== null && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype) {
135
- return Object.fromEntries(Object.entries(value).map(([field, item]) => [field, oneLine(item, field)]));
136
- }
137
- return value;
138
- }, "oneLine");
139
- var silence = /* @__PURE__ */ __name((renderer) => ({
140
- ...renderer,
141
- note: /* @__PURE__ */ __name(() => {
142
- }, "note"),
143
- success: /* @__PURE__ */ __name(() => {
144
- }, "success"),
145
- warn: /* @__PURE__ */ __name(() => {
146
- }, "warn")
147
- }), "silence");
148
-
149
- export {
150
- fieldsOf2 as fieldsOf,
151
- projectFields2 as projectFields,
152
- resolveOutput
153
- };
@@ -1,76 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- __name
5
- } from "./chunk-ZVVMGPBJ.js";
6
-
7
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/mcp/stdio-wire.js
8
- import { PassThrough, Writable } from "node:stream";
9
- var lineReader = /* @__PURE__ */ __name((onMessage) => {
10
- let rest = "";
11
- return (chunk) => {
12
- const lines = (rest + chunk.toString()).split("\n");
13
- rest = lines.pop() ?? "";
14
- for (const line of lines) {
15
- try {
16
- const message = JSON.parse(line);
17
- if (message !== null && typeof message === "object")
18
- onMessage(message);
19
- } catch {
20
- }
21
- }
22
- };
23
- }, "lineReader");
24
- var answeredWire = /* @__PURE__ */ __name((source, sink) => {
25
- const asked = /* @__PURE__ */ new Set();
26
- let settle;
27
- const input = new PassThrough();
28
- const onData = lineReader(({ id, method }) => {
29
- if (id !== void 0 && typeof method === "string")
30
- asked.add(JSON.stringify(id));
31
- });
32
- const output = new Writable({
33
- write: /* @__PURE__ */ __name((chunk, _encoding, done) => {
34
- noteAnswer(chunk);
35
- sink.write(chunk, done);
36
- }, "write")
37
- });
38
- const noteAnswer = lineReader(({ id, method }) => {
39
- if (id === void 0 || method !== void 0)
40
- return;
41
- asked.delete(JSON.stringify(id));
42
- if (asked.size === 0)
43
- settle?.();
44
- });
45
- const forward = /* @__PURE__ */ __name((chunk) => {
46
- onData(chunk);
47
- input.write(chunk);
48
- }, "forward");
49
- source.on("data", forward);
50
- const ended = new Promise((resolve) => {
51
- source.once("end", resolve);
52
- source.once("close", resolve);
53
- });
54
- return {
55
- input,
56
- output,
57
- ended,
58
- answered: /* @__PURE__ */ __name(() => new Promise((resolve) => {
59
- if (asked.size === 0)
60
- resolve();
61
- else
62
- settle = resolve;
63
- }), "answered"),
64
- /** Lets go of the real stdin, so it no longer holds the process open. */
65
- release: /* @__PURE__ */ __name(() => {
66
- source.off("data", forward);
67
- if (source.listenerCount("data") === 0)
68
- source.pause();
69
- input.end();
70
- }, "release")
71
- };
72
- }, "answeredWire");
73
-
74
- export {
75
- answeredWire
76
- };