@wirecat/zoom-cli 0.56.0 → 0.57.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 (145) hide show
  1. package/README.md +1 -1
  2. package/dist/bin/zm.js +35 -5
  3. package/dist/bundle/all-profiles-EKHWTGOY.js +25 -0
  4. package/dist/bundle/answer-policy-KH2IFXPN.js +96 -0
  5. package/dist/bundle/anthropic-VL54IUGF.js +70 -0
  6. package/dist/bundle/bun-ADJVI4HY.js +169 -0
  7. package/dist/bundle/bun-sqlite-2SDA3YOT.js +69 -0
  8. package/dist/bundle/chunk-2IKY7VBH.js +9 -0
  9. package/dist/bundle/chunk-2WOGZDZG.js +431 -0
  10. package/dist/bundle/chunk-4R7HYNZS.js +73 -0
  11. package/dist/bundle/chunk-4VCA7QU3.js +538 -0
  12. package/dist/bundle/chunk-4YLS4YLS.js +29 -0
  13. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  14. package/dist/bundle/chunk-5F7IOESV.js +281 -0
  15. package/dist/bundle/chunk-5QESMCQK.js +122 -0
  16. package/dist/bundle/chunk-6M6FJV5D.js +138 -0
  17. package/dist/bundle/chunk-6MX5T6AQ.js +17 -0
  18. package/dist/bundle/chunk-6P3YHT54.js +385 -0
  19. package/dist/bundle/chunk-7A6PZUDR.js +938 -0
  20. package/dist/bundle/chunk-7GUG6UZS.js +884 -0
  21. package/dist/bundle/chunk-7JZJMHQY.js +487 -0
  22. package/dist/bundle/chunk-A4ETXPMZ.js +98 -0
  23. package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
  24. package/dist/bundle/chunk-AE4BOXH7.js +5292 -0
  25. package/dist/bundle/chunk-AN3GVZTU.js +76 -0
  26. package/dist/bundle/chunk-BAYNCCNM.js +215 -0
  27. package/dist/bundle/chunk-BW2WPOXP.js +166 -0
  28. package/dist/bundle/chunk-BW52AJ4R.js +3387 -0
  29. package/dist/bundle/chunk-CB5UTASG.js +18 -0
  30. package/dist/bundle/chunk-CLMXBW53.js +1028 -0
  31. package/dist/bundle/chunk-DCTXOMOR.js +35 -0
  32. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  33. package/dist/bundle/chunk-EOQFWJJD.js +1095 -0
  34. package/dist/bundle/chunk-G4R4ZIGD.js +3569 -0
  35. package/dist/bundle/chunk-G4VZDINN.js +161 -0
  36. package/dist/bundle/chunk-GARCOIB6.js +409 -0
  37. package/dist/bundle/chunk-GKMGS7G5.js +1938 -0
  38. package/dist/bundle/chunk-HCNMFFG3.js +82 -0
  39. package/dist/bundle/chunk-HG5KRV55.js +1970 -0
  40. package/dist/bundle/chunk-HKYLSIZ2.js +82 -0
  41. package/dist/bundle/chunk-HTQTIKWP.js +928 -0
  42. package/dist/bundle/chunk-I4VQDXFR.js +100 -0
  43. package/dist/bundle/chunk-ICSKEDPI.js +36139 -0
  44. package/dist/bundle/chunk-IP4OK7RQ.js +24 -0
  45. package/dist/bundle/chunk-IVQ6342B.js +2 -0
  46. package/dist/bundle/chunk-K72SEMYI.js +160 -0
  47. package/dist/bundle/chunk-LHRCJYFC.js +19 -0
  48. package/dist/bundle/chunk-LPTIQLDW.js +192 -0
  49. package/dist/bundle/chunk-LQ3T2ZIX.js +124 -0
  50. package/dist/bundle/chunk-LSVI3A5X.js +836 -0
  51. package/dist/bundle/chunk-LW2G4U6W.js +570 -0
  52. package/dist/bundle/chunk-LXB6ONWC.js +3517 -0
  53. package/dist/bundle/chunk-LY26NW3I.js +6848 -0
  54. package/dist/bundle/chunk-MAEFLDHG.js +6092 -0
  55. package/dist/bundle/chunk-MZH4GDR4.js +45 -0
  56. package/dist/bundle/chunk-NN5B24KP.js +1109 -0
  57. package/dist/bundle/chunk-NO7CJEYV.js +22 -0
  58. package/dist/bundle/chunk-NTDWAAGL.js +18435 -0
  59. package/dist/bundle/chunk-NW3X3G5X.js +264 -0
  60. package/dist/bundle/chunk-O66V2WHK.js +48 -0
  61. package/dist/bundle/chunk-OCGPZHXW.js +25 -0
  62. package/dist/bundle/chunk-OIHDCGV4.js +151 -0
  63. package/dist/bundle/chunk-OVSWVPXL.js +8190 -0
  64. package/dist/bundle/chunk-PIN5RZ3D.js +63 -0
  65. package/dist/bundle/chunk-QLIB3PEC.js +1146 -0
  66. package/dist/bundle/chunk-QTR6D5HT.js +58 -0
  67. package/dist/bundle/chunk-QUJPQMHJ.js +2315 -0
  68. package/dist/bundle/chunk-R3HPOCZD.js +188 -0
  69. package/dist/bundle/chunk-RMV4C2YL.js +482 -0
  70. package/dist/bundle/chunk-RRRBMQ2E.js +844 -0
  71. package/dist/bundle/chunk-S4S7E54J.js +60 -0
  72. package/dist/bundle/chunk-SB6WOSHG.js +1109 -0
  73. package/dist/bundle/chunk-SE75DPBY.js +31 -0
  74. package/dist/bundle/chunk-SQJ7EH2D.js +97 -0
  75. package/dist/bundle/chunk-TKCHUT2H.js +422 -0
  76. package/dist/bundle/chunk-TLQUKHEM.js +193 -0
  77. package/dist/bundle/chunk-TZ2MKETI.js +100 -0
  78. package/dist/bundle/chunk-UC44ZMQV.js +78 -0
  79. package/dist/bundle/chunk-UI5UTMSZ.js +275 -0
  80. package/dist/bundle/chunk-VPPYYWOH.js +630 -0
  81. package/dist/bundle/chunk-WJHK5D7Z.js +35612 -0
  82. package/dist/bundle/chunk-WQ24UC44.js +239 -0
  83. package/dist/bundle/chunk-X5DFDGWS.js +2 -0
  84. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  85. package/dist/bundle/chunk-YB4DMKYX.js +119 -0
  86. package/dist/bundle/chunk-Z4TZ6TAF.js +288 -0
  87. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  88. package/dist/bundle/cli-72EQATJF.js +825 -0
  89. package/dist/bundle/command-contract-4MHSZUN3.js +38 -0
  90. package/dist/bundle/config-GFIJK6G2.js +79 -0
  91. package/dist/bundle/dist-IBNHCQXT.js +136 -0
  92. package/dist/bundle/dist-XUFQCJXW.js +7577 -0
  93. package/dist/bundle/echarts-RFTK737T.js +42501 -0
  94. package/dist/bundle/embed-7QYA2ZZE.js +35 -0
  95. package/dist/bundle/embedder-YNN6PCHG.js +108 -0
  96. package/dist/bundle/first-run-EVSRQKZJ.js +23 -0
  97. package/dist/bundle/first-screen-RG4GUKW7.js +36 -0
  98. package/dist/bundle/folders-JEPOMYM4.js +13 -0
  99. package/dist/bundle/instructions-FHNL7CMW.js +9 -0
  100. package/dist/bundle/main-NYGJXPH7.js +130 -0
  101. package/dist/bundle/mcp-IXFC2VVR.js +165 -0
  102. package/dist/bundle/mcp-VGSZDCKK.js +189 -0
  103. package/dist/bundle/mcp-XKP2PXLS.js +92 -0
  104. package/dist/bundle/meetings-IBPI4MM4.js +215 -0
  105. package/dist/bundle/node-P4E63KXA.js +2340 -0
  106. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  107. package/dist/bundle/node-ZMCACJVS.js +176 -0
  108. package/dist/bundle/node-sqlite-ZNGOBA5Q.js +45 -0
  109. package/dist/bundle/oauth-Q6LKF7DB.js +17 -0
  110. package/dist/bundle/open-LJ332Y5O.js +19 -0
  111. package/dist/bundle/output-file-RYQZ3RTE.js +63 -0
  112. package/dist/bundle/process-ZPTLNVQS.js +91 -0
  113. package/dist/bundle/program-IBRQBQ6W.js +5845 -0
  114. package/dist/bundle/prompt-RT7GUUXH.js +12 -0
  115. package/dist/bundle/recognize-QXGE7YJH.js +190 -0
  116. package/dist/bundle/remote-FD4MZQV3.js +26 -0
  117. package/dist/bundle/rerank-V6AVV755.js +49 -0
  118. package/dist/bundle/run-log-RE2EI3UU.js +111 -0
  119. package/dist/bundle/serve-HIJTFAW7.js +19 -0
  120. package/dist/bundle/server-3QOXOYYL.js +53 -0
  121. package/dist/bundle/server-WLJCU7KK.js +812 -0
  122. package/dist/bundle/services-KC5KQFBS.js +330 -0
  123. package/dist/bundle/speech-5JOXLYDA.js +44 -0
  124. package/dist/bundle/state-PPGRB3T6.js +33 -0
  125. package/dist/bundle/store-LODVDPK3.js +141 -0
  126. package/dist/bundle/store-WB5BICTG.js +124 -0
  127. package/dist/bundle/store-connection-EG6Z5ITP.js +76 -0
  128. package/dist/bundle/store-maintenance-command-Q5WMFUZ2.js +54 -0
  129. package/dist/bundle/streaming-UGFFNOXL.js +15 -0
  130. package/dist/bundle/tokens-AF5CPY2F.js +17 -0
  131. package/dist/bundle/zm.js +8 -0
  132. package/dist/contract-overrides.d.ts.map +1 -1
  133. package/dist/contract-overrides.js +18 -16
  134. package/dist/contract-overrides.js.map +1 -1
  135. package/dist/mcp-command.d.ts +3 -2
  136. package/dist/mcp-command.d.ts.map +1 -1
  137. package/dist/mcp-command.js +62 -10
  138. package/dist/mcp-command.js.map +1 -1
  139. package/dist/program-bindings.d.ts.map +1 -1
  140. package/dist/program-bindings.js +1 -0
  141. package/dist/program-bindings.js.map +1 -1
  142. package/dist/version.d.ts +1 -1
  143. package/dist/version.js +1 -1
  144. package/package.json +7 -5
  145. package/skills/zoom-cli/SKILL.md +2 -0
@@ -0,0 +1,21 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ child_process,
5
+ crypto,
6
+ fs,
7
+ os,
8
+ path,
9
+ stream,
10
+ util
11
+ } from "./chunk-DFDN6AUB.js";
12
+ import "./chunk-ZVVMGPBJ.js";
13
+ export {
14
+ child_process,
15
+ crypto,
16
+ fs,
17
+ os,
18
+ path,
19
+ stream,
20
+ util
21
+ };
@@ -0,0 +1,176 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ DefaultLogger,
5
+ DrizzleQueryError,
6
+ NoopLogger,
7
+ SQLiteAsyncDatabase,
8
+ SQLiteAsyncPreparedQuery,
9
+ SQLiteAsyncSession,
10
+ SQLiteAsyncTransaction,
11
+ SQLiteDialect,
12
+ booleanFromInteger,
13
+ bufferFromBytes,
14
+ castToText,
15
+ dateFromStoredMilliseconds,
16
+ dateFromStoredSeconds,
17
+ entityKind,
18
+ jitCompatCheck,
19
+ refineSqliteCodecs,
20
+ sql
21
+ } from "./chunk-LY26NW3I.js";
22
+ import {
23
+ __name
24
+ } from "./chunk-ZVVMGPBJ.js";
25
+
26
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/node.js
27
+ import { DatabaseSync } from "node:sqlite";
28
+ var nodeSQLiteCodecs = refineSqliteCodecs({
29
+ "integer:boolean": { normalize: booleanFromInteger },
30
+ "integer:timestamp": { normalize: dateFromStoredSeconds },
31
+ "integer:timestamp_ms": { normalize: dateFromStoredMilliseconds },
32
+ "text:json": { normalize: JSON.parse },
33
+ blob: { normalize: bufferFromBytes },
34
+ "blob:json": {
35
+ cast: castToText,
36
+ normalize: JSON.parse
37
+ },
38
+ "blob:bigint": {
39
+ cast: castToText,
40
+ normalize: BigInt
41
+ },
42
+ numeric: {
43
+ cast: castToText,
44
+ normalize: String
45
+ },
46
+ "numeric:number": { normalize: Number },
47
+ "numeric:bigint": {
48
+ cast: castToText,
49
+ normalize: BigInt
50
+ }
51
+ });
52
+ var NodeSQLiteSession = class extends SQLiteAsyncSession {
53
+ static {
54
+ __name(this, "NodeSQLiteSession");
55
+ }
56
+ client;
57
+ relations;
58
+ options;
59
+ static [entityKind] = "SQLJsSession";
60
+ logger;
61
+ constructor(client, dialect, relations, options = {}) {
62
+ super(dialect, "sync");
63
+ this.client = client;
64
+ this.relations = relations;
65
+ this.options = options;
66
+ this.logger = options.logger ?? new NoopLogger();
67
+ }
68
+ prepareQuery(query, mode, _prepare, executeMethod, mapper, queryMetadata) {
69
+ let stmt;
70
+ try {
71
+ stmt = this.client.prepare(query.sql);
72
+ } catch (e) {
73
+ throw new DrizzleQueryError(query.sql, this.options.paramsInErrors ? query.params : void 0, e);
74
+ }
75
+ return new SQLiteAsyncPreparedQuery("sync", executeMethod, {
76
+ all: /* @__PURE__ */ __name((params) => {
77
+ stmt.setReturnArrays(mode === "arrays");
78
+ const res = stmt.all(...params);
79
+ if (mode === "objects") return res.map((row) => ({ ...row }));
80
+ return res;
81
+ }, "all"),
82
+ get: /* @__PURE__ */ __name((params) => {
83
+ stmt.setReturnArrays(mode === "arrays");
84
+ const res = stmt.get(...params);
85
+ if (res && mode === "objects") return { ...res };
86
+ return res;
87
+ }, "get"),
88
+ run: /* @__PURE__ */ __name((params) => {
89
+ stmt.setReturnArrays(false);
90
+ return stmt.run(...params);
91
+ }, "run")
92
+ }, query, mapper, mode, this.logger, void 0, queryMetadata, void 0, this.options.paramsInErrors);
93
+ }
94
+ transaction(transaction, config = {}) {
95
+ if (config?.behavior === "concurrent") throw new Error("Concurrent transactions are not supported by driver");
96
+ const tx = new NodeSQLiteTransaction("sync", this.dialect, this, this.relations);
97
+ this.run(sql.raw(`begin${config.behavior ? ` ${config.behavior}` : ""}`));
98
+ try {
99
+ const result = transaction(tx);
100
+ this.run(sql`commit`);
101
+ return result;
102
+ } catch (err) {
103
+ try {
104
+ this.run(sql`rollback`);
105
+ } catch {
106
+ }
107
+ throw err;
108
+ }
109
+ }
110
+ };
111
+ var NodeSQLiteTransaction = class NodeSQLiteTransaction2 extends SQLiteAsyncTransaction {
112
+ static {
113
+ __name(this, "NodeSQLiteTransaction2");
114
+ }
115
+ static [entityKind] = "SQLJsTransaction";
116
+ transaction(transaction) {
117
+ const savepointName = `sp${this.nestedIndex + 1}`;
118
+ const tx = new NodeSQLiteTransaction2("sync", this.dialect, this.session, this._.relations, this.nestedIndex + 1);
119
+ tx.run(sql.raw(`savepoint ${savepointName}`));
120
+ try {
121
+ const result = transaction(tx);
122
+ tx.run(sql.raw(`release savepoint ${savepointName}`));
123
+ return result;
124
+ } catch (err) {
125
+ try {
126
+ tx.run(sql.raw(`rollback to savepoint ${savepointName}`));
127
+ } catch {
128
+ }
129
+ throw err;
130
+ }
131
+ }
132
+ };
133
+ var NodeSQLiteDatabase = class extends SQLiteAsyncDatabase {
134
+ static {
135
+ __name(this, "NodeSQLiteDatabase");
136
+ }
137
+ static [entityKind] = "NodeSQLiteDatabase";
138
+ };
139
+ function construct(client, config = {}) {
140
+ const dialect = new SQLiteDialect({
141
+ codecs: config.codecs ?? nodeSQLiteCodecs,
142
+ useJitMappers: jitCompatCheck(config.jit)
143
+ });
144
+ let logger;
145
+ if (config.logger === true) logger = new DefaultLogger();
146
+ else if (config.logger !== false) logger = config.logger;
147
+ const relations = config.relations ?? {};
148
+ const db = new NodeSQLiteDatabase("sync", dialect, new NodeSQLiteSession(client, dialect, relations, {
149
+ logger,
150
+ paramsInErrors: config.paramsInErrors
151
+ }), relations);
152
+ db.$client = client;
153
+ return db;
154
+ }
155
+ __name(construct, "construct");
156
+ function drizzle(...params) {
157
+ if (params[0] === void 0 || typeof params[0] === "string") return construct(params[0] === void 0 ? new DatabaseSync(":memory:") : new DatabaseSync(params[0]), params[1]);
158
+ const { connection, client, ...config } = params[0];
159
+ if (client) return construct(client, config);
160
+ if (typeof connection === "object") {
161
+ const { path, ...options } = connection;
162
+ return construct(new DatabaseSync(path ?? ":memory:", options), config);
163
+ }
164
+ return construct(new DatabaseSync(connection ?? ":memory:"), config);
165
+ }
166
+ __name(drizzle, "drizzle");
167
+ (function(_drizzle) {
168
+ function mock(config) {
169
+ return construct({}, config);
170
+ }
171
+ __name(mock, "mock");
172
+ _drizzle.mock = mock;
173
+ })(drizzle || (drizzle = {}));
174
+ export {
175
+ drizzle
176
+ };
@@ -0,0 +1,45 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ loadVectorExtension,
5
+ vectorExtension
6
+ } from "./chunk-QTR6D5HT.js";
7
+ import "./chunk-AE4BOXH7.js";
8
+ import "./chunk-Y5E2WNWB.js";
9
+ import {
10
+ __name
11
+ } from "./chunk-ZVVMGPBJ.js";
12
+
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/store/drivers/node-sqlite.js
14
+ import { DatabaseSync } from "node:sqlite";
15
+ var openWithNodeSqlite = /* @__PURE__ */ __name(async (path) => cacheOverNodeSqlite(await nodeClient(path)), "openWithNodeSqlite");
16
+ var nodeClient = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
17
+ const extension = await vectorExtension();
18
+ const client = new DatabaseSync(path, { readOnly, allowExtension: true });
19
+ try {
20
+ loadVectorExtension(client, extension);
21
+ return client;
22
+ } catch (error) {
23
+ client.close();
24
+ throw error;
25
+ }
26
+ }, "nodeClient");
27
+ var cacheOverNodeSqlite = /* @__PURE__ */ __name((database) => {
28
+ return {
29
+ exec: /* @__PURE__ */ __name((sql) => database.exec(sql), "exec"),
30
+ prepare: /* @__PURE__ */ __name((sql) => {
31
+ const statement = database.prepare(sql);
32
+ return {
33
+ run: /* @__PURE__ */ __name((...parameters) => ({ changes: Number(statement.run(...parameters).changes) }), "run"),
34
+ get: /* @__PURE__ */ __name((...parameters) => statement.get(...parameters), "get"),
35
+ all: /* @__PURE__ */ __name((...parameters) => statement.all(...parameters), "all")
36
+ };
37
+ }, "prepare"),
38
+ close: /* @__PURE__ */ __name(() => database.close(), "close")
39
+ };
40
+ }, "cacheOverNodeSqlite");
41
+ export {
42
+ cacheOverNodeSqlite,
43
+ nodeClient,
44
+ openWithNodeSqlite
45
+ };
@@ -0,0 +1,17 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ ownerLogin,
5
+ revokeAll
6
+ } from "./chunk-Z4TZ6TAF.js";
7
+ import "./chunk-G4VZDINN.js";
8
+ import "./chunk-5D4AEUVA.js";
9
+ import "./chunk-4R7HYNZS.js";
10
+ import "./chunk-PIN5RZ3D.js";
11
+ import "./chunk-AE4BOXH7.js";
12
+ import "./chunk-Y5E2WNWB.js";
13
+ import "./chunk-ZVVMGPBJ.js";
14
+ export {
15
+ ownerLogin,
16
+ revokeAll
17
+ };
@@ -0,0 +1,19 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ CAPABILITY_STATEMENTS,
5
+ assertStoreCapable,
6
+ openCache,
7
+ openFile,
8
+ storeCapable
9
+ } from "./chunk-TZ2MKETI.js";
10
+ import "./chunk-AE4BOXH7.js";
11
+ import "./chunk-Y5E2WNWB.js";
12
+ import "./chunk-ZVVMGPBJ.js";
13
+ export {
14
+ CAPABILITY_STATEMENTS,
15
+ assertStoreCapable,
16
+ openCache,
17
+ openFile,
18
+ storeCapable
19
+ };
@@ -0,0 +1,63 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ checkCancelled
5
+ } from "./chunk-A4ETXPMZ.js";
6
+ import "./chunk-LSVI3A5X.js";
7
+ import {
8
+ CliError,
9
+ isCliError
10
+ } from "./chunk-AE4BOXH7.js";
11
+ import "./chunk-Y5E2WNWB.js";
12
+ import {
13
+ __name
14
+ } from "./chunk-ZVVMGPBJ.js";
15
+
16
+ // dist/output-file.js
17
+ import { randomUUID } from "node:crypto";
18
+ import { link, open, unlink } from "node:fs/promises";
19
+ var writeExportFile = /* @__PURE__ */ __name(async (path, content, options = {}) => {
20
+ checkCancelled(options.signal);
21
+ const temporary = `${path}.zm-${randomUUID()}.part`;
22
+ let handle;
23
+ let failure;
24
+ let failed = false;
25
+ try {
26
+ handle = await open(temporary, "wx", 384);
27
+ await handle.writeFile(content, "utf8");
28
+ await handle.sync();
29
+ checkCancelled(options.signal);
30
+ await link(temporary, path);
31
+ } catch (error) {
32
+ failed = true;
33
+ failure = error;
34
+ } finally {
35
+ if (handle) {
36
+ try {
37
+ await handle.close();
38
+ } catch (error) {
39
+ if (!failed) {
40
+ failed = true;
41
+ failure = error;
42
+ }
43
+ }
44
+ try {
45
+ await unlink(temporary);
46
+ } catch (error) {
47
+ if (!failed) {
48
+ failed = true;
49
+ failure = error;
50
+ }
51
+ }
52
+ }
53
+ }
54
+ if (!failed)
55
+ return;
56
+ if (isCliError(failure))
57
+ throw failure;
58
+ const code = typeof failure === "object" && failure !== null && "code" in failure ? failure.code : void 0;
59
+ throw new CliError(code === "EEXIST" ? "validation_error" : code === "EACCES" || code === "EPERM" ? "permission_error" : "configuration_error", code === "EEXIST" ? "output file already exists; choose another path" : "could not write the output file");
60
+ }, "writeExportFile");
61
+ export {
62
+ writeExportFile
63
+ };
@@ -0,0 +1,91 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import "./chunk-Y5E2WNWB.js";
4
+ import {
5
+ __name
6
+ } from "./chunk-ZVVMGPBJ.js";
7
+
8
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/embeddings/process.js
9
+ import { spawn } from "node:child_process";
10
+ import { createInterface } from "node:readline";
11
+ import { fileURLToPath } from "node:url";
12
+ var openProcess = /* @__PURE__ */ __name(async (model, directory, { threads }) => {
13
+ const child = await modelProcess({ model, directory, threads });
14
+ return {
15
+ model,
16
+ embed: /* @__PURE__ */ __name(async (texts, kind) => ((await child.ask({ texts, kind })).vectors ?? []).map((vector) => Float32Array.from(vector)), "embed"),
17
+ close: child.close
18
+ };
19
+ }, "openProcess");
20
+ var openRerankerProcess = /* @__PURE__ */ __name(async (model, directory, { threads }) => {
21
+ const child = await modelProcess({ model, directory, threads, rerank: true });
22
+ return {
23
+ model,
24
+ score: /* @__PURE__ */ __name(async (question, passages) => (await child.ask({ question, texts: passages })).scores ?? [], "score"),
25
+ close: child.close
26
+ };
27
+ }, "openRerankerProcess");
28
+ var modelProcess = /* @__PURE__ */ __name(async (setup) => {
29
+ const child = spawn(process.execPath, [fileURLToPath(new URL("./child.js", new URL("embeddings/process.js", import.meta.resolve("@wirecat/cli-core")).href)), JSON.stringify(setup)], { stdio: ["pipe", "pipe", "pipe"] });
30
+ const pending = /* @__PURE__ */ new Map();
31
+ let said = "";
32
+ child.stderr.setEncoding("utf8").on("data", (text) => {
33
+ said = (said + text).slice(-2e3);
34
+ });
35
+ let ready = /* @__PURE__ */ __name(() => {
36
+ }, "ready");
37
+ let refused = /* @__PURE__ */ __name((_error) => {
38
+ }, "refused");
39
+ const started = new Promise((resolve, reject) => {
40
+ ready = resolve;
41
+ refused = reject;
42
+ });
43
+ let gone;
44
+ const stopped = /* @__PURE__ */ __name((error) => {
45
+ gone ??= error;
46
+ refused(error);
47
+ for (const job of pending.values())
48
+ job.reject(error);
49
+ pending.clear();
50
+ }, "stopped");
51
+ const exited = new Promise((resolve) => {
52
+ child.once("exit", (code) => {
53
+ const last = said.trim().split("\n").at(-1);
54
+ stopped(new Error(`the embedding process stopped (exit ${code})${last ? `: ${last}` : ""}`));
55
+ resolve();
56
+ });
57
+ });
58
+ child.once("error", stopped);
59
+ createInterface({ input: child.stdout }).on("line", (line) => {
60
+ const answer = JSON.parse(line);
61
+ if ("ready" in answer)
62
+ return ready();
63
+ const job = pending.get(answer.id);
64
+ pending.delete(answer.id);
65
+ if (answer.error !== void 0 || !(answer.vectors ?? answer.scores))
66
+ job?.reject(new Error(answer.error ?? "no answer"));
67
+ else
68
+ job?.resolve(answer);
69
+ });
70
+ await started;
71
+ let next = 0;
72
+ return {
73
+ ask: /* @__PURE__ */ __name((request) => new Promise((resolve, reject) => {
74
+ if (gone)
75
+ return reject(gone);
76
+ const id = next++;
77
+ pending.set(id, { resolve, reject });
78
+ child.stdin.write(`${JSON.stringify({ id, ...request })}
79
+ `);
80
+ }), "ask"),
81
+ close: /* @__PURE__ */ __name(async () => {
82
+ if (child.exitCode === null && child.signalCode === null)
83
+ child.stdin.end();
84
+ await exited;
85
+ }, "close")
86
+ };
87
+ }, "modelProcess");
88
+ export {
89
+ openProcess,
90
+ openRerankerProcess
91
+ };