@wirecat/zoom-cli 0.56.0 → 0.58.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 (147) hide show
  1. package/README.md +1 -1
  2. package/dist/bin/zm.js +35 -5
  3. package/dist/bundle/all-profiles-RS5IWIGR.js +25 -0
  4. package/dist/bundle/answer-policy-R7VZMCGE.js +96 -0
  5. package/dist/bundle/anthropic-5QHQR4WF.js +70 -0
  6. package/dist/bundle/app-server-7LANSZGE.js +232 -0
  7. package/dist/bundle/bun-O6RL6LRQ.js +169 -0
  8. package/dist/bundle/bun-sqlite-PEJM6CS4.js +69 -0
  9. package/dist/bundle/chunk-24DLFGES.js +97 -0
  10. package/dist/bundle/chunk-27P22POE.js +1109 -0
  11. package/dist/bundle/chunk-3SCTDFNO.js +3398 -0
  12. package/dist/bundle/chunk-3SERIWJD.js +36139 -0
  13. package/dist/bundle/chunk-4AURKUDZ.js +60 -0
  14. package/dist/bundle/chunk-4NGLRHWO.js +24 -0
  15. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  16. package/dist/bundle/chunk-5DVW77VC.js +789 -0
  17. package/dist/bundle/chunk-6CYLVFXM.js +9 -0
  18. package/dist/bundle/chunk-6FL25KC5.js +264 -0
  19. package/dist/bundle/chunk-7D2CD3E3.js +193 -0
  20. package/dist/bundle/chunk-7GVNQOV6.js +17 -0
  21. package/dist/bundle/chunk-7H3ZRDLW.js +630 -0
  22. package/dist/bundle/chunk-7Z4ANTAK.js +1095 -0
  23. package/dist/bundle/chunk-A6323R5P.js +22 -0
  24. package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
  25. package/dist/bundle/chunk-AIXLOMH4.js +63 -0
  26. package/dist/bundle/chunk-AQDWGJZT.js +188 -0
  27. package/dist/bundle/chunk-B32SF7J3.js +18 -0
  28. package/dist/bundle/chunk-BAQLQIMI.js +1938 -0
  29. package/dist/bundle/chunk-BGILD4CI.js +1109 -0
  30. package/dist/bundle/chunk-BXZ6WSVF.js +100 -0
  31. package/dist/bundle/chunk-CTGI4ES2.js +138 -0
  32. package/dist/bundle/chunk-CVIKKIGE.js +76 -0
  33. package/dist/bundle/chunk-DDYR6DYL.js +78 -0
  34. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  35. package/dist/bundle/chunk-DP5DX45H.js +151 -0
  36. package/dist/bundle/chunk-DXKVEOSS.js +53 -0
  37. package/dist/bundle/chunk-DXZTLB24.js +120 -0
  38. package/dist/bundle/chunk-G27MRA24.js +82 -0
  39. package/dist/bundle/chunk-HTQTIKWP.js +928 -0
  40. package/dist/bundle/chunk-IYAGQXED.js +433 -0
  41. package/dist/bundle/chunk-K76WFW4I.js +124 -0
  42. package/dist/bundle/chunk-KVHRHBLY.js +884 -0
  43. package/dist/bundle/chunk-L2UIJDWB.js +31 -0
  44. package/dist/bundle/chunk-L3VS3H34.js +482 -0
  45. package/dist/bundle/chunk-MBT7GP7K.js +1970 -0
  46. package/dist/bundle/chunk-MFS52LTZ.js +570 -0
  47. package/dist/bundle/chunk-MMT46EN4.js +29 -0
  48. package/dist/bundle/chunk-MNUTWGSA.js +6094 -0
  49. package/dist/bundle/chunk-N7GAQ27N.js +82 -0
  50. package/dist/bundle/chunk-NDXAZB5Z.js +409 -0
  51. package/dist/bundle/chunk-NOKFJJPA.js +1028 -0
  52. package/dist/bundle/chunk-NW7IMGRR.js +6848 -0
  53. package/dist/bundle/chunk-O5EHUB2V.js +2 -0
  54. package/dist/bundle/chunk-OBZWUNO4.js +160 -0
  55. package/dist/bundle/chunk-PACC5N6T.js +240 -0
  56. package/dist/bundle/chunk-PF25S7L4.js +422 -0
  57. package/dist/bundle/chunk-PKTFZAXG.js +48 -0
  58. package/dist/bundle/chunk-PNBEREOU.js +35626 -0
  59. package/dist/bundle/chunk-POOGFSRA.js +385 -0
  60. package/dist/bundle/chunk-PP3JGQQE.js +3517 -0
  61. package/dist/bundle/chunk-Q2Z3VCM4.js +2 -0
  62. package/dist/bundle/chunk-QCFHL4ES.js +45 -0
  63. package/dist/bundle/chunk-QFGBMS67.js +492 -0
  64. package/dist/bundle/chunk-RUP467ZX.js +948 -0
  65. package/dist/bundle/chunk-RXDIG23Z.js +166 -0
  66. package/dist/bundle/chunk-SIA7HJE2.js +8192 -0
  67. package/dist/bundle/chunk-SL3SXQZ5.js +100 -0
  68. package/dist/bundle/chunk-SV5L36WK.js +19 -0
  69. package/dist/bundle/chunk-T6AAM7UT.js +846 -0
  70. package/dist/bundle/chunk-U6QW67SU.js +18673 -0
  71. package/dist/bundle/chunk-UKR7KH3H.js +288 -0
  72. package/dist/bundle/chunk-UOFOMU3T.js +836 -0
  73. package/dist/bundle/chunk-URO44C5T.js +3570 -0
  74. package/dist/bundle/chunk-UXM7I35J.js +281 -0
  75. package/dist/bundle/chunk-UYJUTZTT.js +73 -0
  76. package/dist/bundle/chunk-VOAVOK4I.js +1146 -0
  77. package/dist/bundle/chunk-VSUY7PDW.js +192 -0
  78. package/dist/bundle/chunk-VYUSEJE4.js +98 -0
  79. package/dist/bundle/chunk-XFCSPOLZ.js +25 -0
  80. package/dist/bundle/chunk-XT7XVPEM.js +538 -0
  81. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  82. package/dist/bundle/chunk-YIFIY7ZE.js +58 -0
  83. package/dist/bundle/chunk-YIMI6O7R.js +5292 -0
  84. package/dist/bundle/chunk-YJRMMZI5.js +275 -0
  85. package/dist/bundle/chunk-YSHSCBPM.js +2315 -0
  86. package/dist/bundle/chunk-ZC5UXEIH.js +215 -0
  87. package/dist/bundle/chunk-ZHXIXDH5.js +161 -0
  88. package/dist/bundle/chunk-ZTOAAYFV.js +122 -0
  89. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  90. package/dist/bundle/cli-IQTASP44.js +831 -0
  91. package/dist/bundle/command-contract-WHZPF7NA.js +38 -0
  92. package/dist/bundle/config-IP5SGHKN.js +79 -0
  93. package/dist/bundle/dist-WT73DF46.js +136 -0
  94. package/dist/bundle/dist-XUFQCJXW.js +7577 -0
  95. package/dist/bundle/echarts-LD3AI55P.js +42501 -0
  96. package/dist/bundle/embed-XEMH4LNX.js +35 -0
  97. package/dist/bundle/embedder-ZCYKSKAE.js +108 -0
  98. package/dist/bundle/first-run-LGYDLIUM.js +23 -0
  99. package/dist/bundle/first-screen-LYQKPNF4.js +36 -0
  100. package/dist/bundle/folders-5ZBUQHAM.js +13 -0
  101. package/dist/bundle/instructions-RZMSW3OC.js +11 -0
  102. package/dist/bundle/main-NKY3JGXY.js +130 -0
  103. package/dist/bundle/mcp-7OXUHLTO.js +189 -0
  104. package/dist/bundle/mcp-OQBZXELQ.js +165 -0
  105. package/dist/bundle/mcp-VISEXTVC.js +92 -0
  106. package/dist/bundle/meetings-XPBHVZAU.js +215 -0
  107. package/dist/bundle/node-P4E63KXA.js +2340 -0
  108. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  109. package/dist/bundle/node-ZRLYQL7J.js +176 -0
  110. package/dist/bundle/node-sqlite-BBEDYBWO.js +45 -0
  111. package/dist/bundle/oauth-UHVRGKZU.js +17 -0
  112. package/dist/bundle/open-J4FCAUAJ.js +19 -0
  113. package/dist/bundle/output-file-SXV2ANW7.js +63 -0
  114. package/dist/bundle/process-LL77573L.js +91 -0
  115. package/dist/bundle/program-EPMIJCGA.js +5845 -0
  116. package/dist/bundle/prompt-LUUMQTMY.js +12 -0
  117. package/dist/bundle/recognize-EMHQX4XF.js +190 -0
  118. package/dist/bundle/remote-ZXS6D7VB.js +26 -0
  119. package/dist/bundle/rerank-WP7RKZNB.js +49 -0
  120. package/dist/bundle/run-log-GS2L66G6.js +111 -0
  121. package/dist/bundle/serve-L6KLLXK2.js +19 -0
  122. package/dist/bundle/server-NOFYENP5.js +53 -0
  123. package/dist/bundle/server-P5TXAPBY.js +66 -0
  124. package/dist/bundle/services-SPOEWVK3.js +330 -0
  125. package/dist/bundle/speech-6OBAKMND.js +44 -0
  126. package/dist/bundle/state-HN5EJKXQ.js +33 -0
  127. package/dist/bundle/store-LEU3M6IN.js +124 -0
  128. package/dist/bundle/store-ZP2URKET.js +141 -0
  129. package/dist/bundle/store-connection-I53XZ2TS.js +76 -0
  130. package/dist/bundle/store-maintenance-command-PSCHEHHY.js +54 -0
  131. package/dist/bundle/streaming-AK6Q2ZGQ.js +15 -0
  132. package/dist/bundle/tokens-CCM3D4ZT.js +17 -0
  133. package/dist/bundle/zm.js +8 -0
  134. package/dist/contract-overrides.d.ts.map +1 -1
  135. package/dist/contract-overrides.js +29 -17
  136. package/dist/contract-overrides.js.map +1 -1
  137. package/dist/mcp-command.d.ts +3 -2
  138. package/dist/mcp-command.d.ts.map +1 -1
  139. package/dist/mcp-command.js +62 -10
  140. package/dist/mcp-command.js.map +1 -1
  141. package/dist/program-bindings.d.ts.map +1 -1
  142. package/dist/program-bindings.js +1 -0
  143. package/dist/program-bindings.js.map +1 -1
  144. package/dist/version.d.ts +1 -1
  145. package/dist/version.js +1 -1
  146. package/package.json +7 -5
  147. package/skills/zoom-cli/SKILL.md +2 -0
@@ -0,0 +1,1095 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ count,
5
+ id,
6
+ text,
7
+ time
8
+ } from "./chunk-DXZTLB24.js";
9
+ import {
10
+ filesPresent,
11
+ sharedModelsDirectory
12
+ } from "./chunk-6FL25KC5.js";
13
+ import {
14
+ TASK_ORIGINS,
15
+ TASK_STATES,
16
+ TASK_TYPES
17
+ } from "./chunk-CTGI4ES2.js";
18
+ import {
19
+ TAG_TYPES
20
+ } from "./chunk-MMT46EN4.js";
21
+ import {
22
+ CliError,
23
+ array,
24
+ boolean,
25
+ createRecordLog,
26
+ isCliError,
27
+ nullable,
28
+ number,
29
+ optional,
30
+ picklist,
31
+ reference,
32
+ resolvePaths,
33
+ strictObject,
34
+ traceIdOf,
35
+ writeSecurely
36
+ } from "./chunk-YIMI6O7R.js";
37
+ import {
38
+ __name
39
+ } from "./chunk-ZVVMGPBJ.js";
40
+
41
+ // node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/runs/run.js
42
+ import { randomUUID } from "node:crypto";
43
+ import { appendFileSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
44
+ import { userInfo } from "node:os";
45
+ import { join, sep } from "node:path";
46
+
47
+ // node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/runs/log-keys.js
48
+ var snake = /* @__PURE__ */ __name((key) => key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "snake");
49
+ var camel = /* @__PURE__ */ __name((key) => key.replace(/_([a-z0-9])/g, (_, letter) => letter.toUpperCase()), "camel");
50
+ var renamed = /* @__PURE__ */ __name((record, name) => Object.fromEntries(Object.entries(record).map(([key, value]) => [name(key), value])), "renamed");
51
+ var logAttributes = /* @__PURE__ */ __name((event) => renamed(event, snake), "logAttributes");
52
+ var fromLogAttributes = /* @__PURE__ */ __name((attributes) => renamed(attributes, camel), "fromLogAttributes");
53
+ var snakeLogger = /* @__PURE__ */ __name((logger) => ({
54
+ debug: /* @__PURE__ */ __name((event, message) => logger.debug(logAttributes(event), message), "debug"),
55
+ info: /* @__PURE__ */ __name((event, message) => logger.info(logAttributes(event), message), "info"),
56
+ warn: /* @__PURE__ */ __name((event, message) => logger.warn(logAttributes(event), message), "warn"),
57
+ error: /* @__PURE__ */ __name((event, message) => logger.error(logAttributes(event), message), "error")
58
+ }), "snakeLogger");
59
+
60
+ // node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/runs/log-attributes.js
61
+ var diagnostic = {
62
+ event: true,
63
+ operation: true,
64
+ opcode: true,
65
+ seq: true,
66
+ status: true,
67
+ method: true,
68
+ endpointTemplate: true,
69
+ bytes: true,
70
+ ids: true,
71
+ counts: true,
72
+ durationMs: true,
73
+ outcome: true,
74
+ errorCode: true,
75
+ providerError: true,
76
+ level: true,
77
+ transport: true,
78
+ attempt: true,
79
+ waitMs: true,
80
+ code: true,
81
+ detail: true,
82
+ reason: true,
83
+ ageMs: true
84
+ };
85
+ var send = {
86
+ profile: true,
87
+ chatId: true,
88
+ outcome: true,
89
+ kind: true,
90
+ action: true,
91
+ people: true,
92
+ messageId: true,
93
+ key: true,
94
+ count: true,
95
+ forEveryone: true,
96
+ sendId: true,
97
+ operationId: true,
98
+ parentOperationId: true,
99
+ replyTo: true,
100
+ threadId: true,
101
+ sendAs: true,
102
+ resultChatId: true,
103
+ length: true,
104
+ attachments: true,
105
+ scheduledFor: true,
106
+ notify: true,
107
+ origin: true,
108
+ reservation: true,
109
+ errorCode: true
110
+ };
111
+ var background = [
112
+ "job",
113
+ "pid",
114
+ "schedule",
115
+ "exitCode",
116
+ "tool",
117
+ "tier",
118
+ "actorType",
119
+ "actorId",
120
+ "agent",
121
+ "targetType",
122
+ "targetId"
123
+ ];
124
+ var crash = ["errorClass", "frames"];
125
+ var dropped = ["dropped"];
126
+ var LOG_ATTRIBUTES = [
127
+ ...new Set([...Object.keys(diagnostic), ...Object.keys(send), ...background, ...crash, ...dropped].map((key) => Object.keys(logAttributes({ [key]: true }))[0]))
128
+ ].sort();
129
+
130
+ // node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/runs/run.js
131
+ var KEEP_RUNS_FOR_DAYS = 30;
132
+ var KEEP_SUCCESSFUL_RUNS_FOR_DAYS = 7;
133
+ var RUNS_SIZE_LIMIT_MB = 200;
134
+ var runsDirFor = /* @__PURE__ */ __name((app, env = process.env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "runs"), "runsDirFor");
135
+ var startRun = /* @__PURE__ */ __name((options) => {
136
+ const now = options.now ?? (() => /* @__PURE__ */ new Date());
137
+ const startedAt = options.startedAt ?? now();
138
+ const id2 = options.runId ?? newRunId(startedAt, options.command);
139
+ const dir = join(options.runsDir, day(startedAt), id2);
140
+ pruneRuns(options.runsDir, {
141
+ keepDays: options.keepDays ?? KEEP_RUNS_FOR_DAYS,
142
+ keepSuccessDays: options.keepSuccessDays ?? KEEP_SUCCESSFUL_RUNS_FOR_DAYS,
143
+ maxBytes: options.maxBytes ?? RUNS_SIZE_LIMIT_MB * 1024 * 1024,
144
+ now: startedAt
145
+ });
146
+ refuseRealStateInTests(dir);
147
+ const metadata = {
148
+ runId: id2,
149
+ command: options.command,
150
+ ...options.profile === void 0 ? {} : { profile: options.profile },
151
+ startedAt: startedAt.toISOString(),
152
+ status: "running",
153
+ cliVersion: options.cliVersion,
154
+ runtime: runtime(),
155
+ platform: process.platform,
156
+ arch: process.arch,
157
+ ...options.traceId === void 0 ? {} : { traceId: options.traceId },
158
+ ...options.context
159
+ };
160
+ let file;
161
+ const opened = /* @__PURE__ */ __name(() => {
162
+ if (file)
163
+ return file;
164
+ mkdirSync(dir, { recursive: true, mode: 448 });
165
+ const events = join(dir, "events.jsonl");
166
+ writeFileSync(events, "", { flag: "a", mode: 384 });
167
+ file = snakeLogger(createRecordLog({
168
+ to: events,
169
+ runId: id2,
170
+ command: options.command,
171
+ resource: { service: options.service, version: options.cliVersion },
172
+ allow: LOG_ATTRIBUTES,
173
+ ...options.traceId === void 0 ? {} : { traceId: options.traceId },
174
+ ...options.onError === void 0 ? {} : { onError: options.onError }
175
+ }));
176
+ writeRunFile(dir, metadata);
177
+ return file;
178
+ }, "opened");
179
+ if (!options.lazy)
180
+ opened();
181
+ let finished = false;
182
+ const operations = /* @__PURE__ */ new Set();
183
+ const codes = /* @__PURE__ */ new Set();
184
+ const noted = /* @__PURE__ */ __name((level) => (event, message) => {
185
+ const { operation, errorCode, error_code, code } = event;
186
+ if (typeof operation === "string")
187
+ operations.add(operation);
188
+ for (const value of [errorCode, error_code, code])
189
+ if (typeof value === "string")
190
+ codes.add(value);
191
+ if (finished)
192
+ return;
193
+ opened()[level](event, message);
194
+ }, "noted");
195
+ const logger = { debug: noted("debug"), info: noted("info"), warn: noted("warn"), error: noted("error") };
196
+ return {
197
+ id: id2,
198
+ dir,
199
+ logger,
200
+ finish: /* @__PURE__ */ __name(async (status, extra = {}) => {
201
+ if (finished)
202
+ return;
203
+ finished = true;
204
+ const completedAt = now();
205
+ const final = {
206
+ ...metadata,
207
+ ...extra,
208
+ status,
209
+ completedAt: completedAt.toISOString(),
210
+ durationMs: completedAt.getTime() - startedAt.getTime(),
211
+ operations: [...operations].sort(),
212
+ codes: [...codes].sort()
213
+ };
214
+ if (file || status !== "success") {
215
+ opened();
216
+ writeRunFile(dir, final);
217
+ return;
218
+ }
219
+ try {
220
+ mkdirSync(join(dir, ".."), { recursive: true, mode: 448 });
221
+ appendIndex(join(dir, ".."), runFileOf(final));
222
+ } catch (error) {
223
+ options.onError?.(error);
224
+ }
225
+ }, "finish")
226
+ };
227
+ }, "startRun");
228
+ var refuseRealStateInTests = /* @__PURE__ */ __name((dir, env = process.env) => {
229
+ if (env.VITEST === void 0)
230
+ return;
231
+ let home;
232
+ try {
233
+ home = userInfo().homedir;
234
+ } catch {
235
+ return;
236
+ }
237
+ if (dir.startsWith(join(home, ".local", "share") + sep))
238
+ throw new Error(`a test opened a run in the real data folder: ${dir}`);
239
+ }, "refuseRealStateInTests");
240
+ var runtime = /* @__PURE__ */ __name(() => {
241
+ const bun = process.versions.bun;
242
+ return bun ? `bun ${bun}` : `node ${process.versions.node}`;
243
+ }, "runtime");
244
+ var newRunId = /* @__PURE__ */ __name((startedAt, command) => {
245
+ const stamp = startedAt.toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
246
+ const slug = command.replace(/[^a-z0-9]+/gi, "-").toLowerCase();
247
+ return `${stamp}-${slug}-${randomUUID().slice(0, 6)}`;
248
+ }, "newRunId");
249
+ var INDEX = "index.jsonl";
250
+ var appendIndex = /* @__PURE__ */ __name((dayDir, written) => {
251
+ appendFileSync(join(dayDir, INDEX), `${JSON.stringify(written)}
252
+ `, { mode: 384 });
253
+ }, "appendIndex");
254
+ var writeRunFile = /* @__PURE__ */ __name((dir, metadata) => {
255
+ const written = runFileOf(metadata);
256
+ writeSecurely(join(dir, "run.json"), `${JSON.stringify(written, null, 2)}
257
+ `, 384);
258
+ try {
259
+ appendIndex(join(dir, ".."), written);
260
+ } catch {
261
+ }
262
+ }, "writeRunFile");
263
+ var matchesListFilter = /* @__PURE__ */ __name((run, filter) => (filter.runId === void 0 || run.runId === filter.runId) && (filter.command === void 0 || run.command === filter.command) && (filter.profile === void 0 || run.profile === filter.profile) && (filter.status === void 0 || run.status === filter.status) && (filter.errorCode === void 0 || run.errorCode === filter.errorCode), "matchesListFilter");
264
+ var listRuns = /* @__PURE__ */ __name((runsDir, { since, atLeast = Number.POSITIVE_INFINITY, filter = {} } = {}) => {
265
+ const first = since === void 0 ? void 0 : day(new Date(since));
266
+ const runs = [];
267
+ for (const date of days(runsDir).sort().reverse()) {
268
+ if (first !== void 0 && date < first || runs.length >= atLeast)
269
+ break;
270
+ for (const metadata of runsOfDay(join(runsDir, date))) {
271
+ if (matchesListFilter(metadata, filter))
272
+ runs.push(metadata);
273
+ }
274
+ }
275
+ return runs;
276
+ }, "listRuns");
277
+ var indexedRuns = /* @__PURE__ */ __name((dayDir) => {
278
+ const latest = /* @__PURE__ */ new Map();
279
+ let raw = "";
280
+ try {
281
+ raw = readFileSync(join(dayDir, INDEX), "utf8");
282
+ } catch {
283
+ }
284
+ for (const line of raw.split("\n")) {
285
+ if (line.trim() === "")
286
+ continue;
287
+ try {
288
+ const metadata = metadataOf(JSON.parse(line));
289
+ if (typeof metadata.runId === "string")
290
+ latest.set(metadata.runId, metadata);
291
+ } catch {
292
+ }
293
+ }
294
+ return latest;
295
+ }, "indexedRuns");
296
+ var runsOfDay = /* @__PURE__ */ __name((dayDir) => {
297
+ const latest = indexedRuns(dayDir);
298
+ for (const entry of safeReaddir(dayDir)) {
299
+ if (entry === INDEX || entry.startsWith(".") || latest.has(entry))
300
+ continue;
301
+ const metadata = readRun(join(dayDir, entry));
302
+ if (metadata)
303
+ latest.set(metadata.runId, metadata);
304
+ }
305
+ return [...latest.values()].sort((a, b) => a.runId < b.runId ? 1 : a.runId > b.runId ? -1 : 0);
306
+ }, "runsOfDay");
307
+ var findRun = /* @__PURE__ */ __name((runsDir, id2) => {
308
+ const stamped = /^(\d{4})(\d{2})(\d{2})T/.exec(id2);
309
+ const likely = stamped ? [`${stamped[1]}-${stamped[2]}-${stamped[3]}`] : [];
310
+ const dates = [.../* @__PURE__ */ new Set([...likely, ...days(runsDir)])];
311
+ for (const date of dates) {
312
+ const dir = join(runsDir, date, id2);
313
+ const metadata = readRun(dir);
314
+ if (metadata)
315
+ return { dir, metadata };
316
+ }
317
+ for (const date of dates) {
318
+ const metadata = indexedRuns(join(runsDir, date)).get(id2);
319
+ if (metadata)
320
+ return { dir: join(runsDir, date, id2), metadata };
321
+ }
322
+ return void 0;
323
+ }, "findRun");
324
+ var readEvents = /* @__PURE__ */ __name((dir) => {
325
+ let raw;
326
+ try {
327
+ raw = readFileSync(join(dir, "events.jsonl"), "utf8");
328
+ } catch {
329
+ return [];
330
+ }
331
+ const events = [];
332
+ for (const line of raw.split("\n")) {
333
+ if (line.trim() === "")
334
+ continue;
335
+ try {
336
+ const parsed = JSON.parse(line);
337
+ if (parsed !== null && typeof parsed === "object")
338
+ events.push(eventOf(parsed));
339
+ } catch {
340
+ }
341
+ }
342
+ return events;
343
+ }, "readEvents");
344
+ var eventOf = /* @__PURE__ */ __name((line) => {
345
+ const { attributes, time: time2, severity } = line;
346
+ if (attributes === null || typeof attributes !== "object")
347
+ return logAttributes(line);
348
+ return { time: time2, severity, ...logAttributes(attributes) };
349
+ }, "eventOf");
350
+ var pruneRuns = /* @__PURE__ */ __name((runsDir, { keepDays, keepSuccessDays = keepDays, maxBytes, now }) => {
351
+ const cutoff = day(new Date(now.getTime() - keepDays * DAY_MS));
352
+ const successCutoff = day(new Date(now.getTime() - Math.min(keepSuccessDays, keepDays) * DAY_MS));
353
+ let removed = 0;
354
+ for (const date of days(runsDir)) {
355
+ if (date >= cutoff) {
356
+ if (date < successCutoff)
357
+ dropSuccesses(join(runsDir, date));
358
+ continue;
359
+ }
360
+ try {
361
+ rmSync(join(runsDir, date), { recursive: true, force: true });
362
+ removed += 1;
363
+ } catch {
364
+ }
365
+ }
366
+ if (maxBytes !== void 0)
367
+ removed += fitSize(runsDir, maxBytes, now);
368
+ return removed;
369
+ }, "pruneRuns");
370
+ var DAY_MS = 24 * 60 * 60 * 1e3;
371
+ var SUCCESSES_DROPPED = ".successes-dropped";
372
+ var SIZE_CHECKED = ".size-checked";
373
+ var dropSuccesses = /* @__PURE__ */ __name((dayDir) => {
374
+ const marker = join(dayDir, SUCCESSES_DROPPED);
375
+ try {
376
+ statSync(marker);
377
+ return;
378
+ } catch {
379
+ }
380
+ try {
381
+ const kept = [];
382
+ for (const [id2, metadata] of indexedRuns(dayDir)) {
383
+ if (metadata.status === "success")
384
+ rmSync(join(dayDir, id2), { recursive: true, force: true });
385
+ else
386
+ kept.push(JSON.stringify(runFileOf(metadata)));
387
+ }
388
+ for (const entry of safeReaddir(dayDir)) {
389
+ if (entry === INDEX || entry.startsWith("."))
390
+ continue;
391
+ if (readRun(join(dayDir, entry))?.status === "success")
392
+ rmSync(join(dayDir, entry), { recursive: true, force: true });
393
+ }
394
+ writeSecurely(join(dayDir, INDEX), kept.map((line) => `${line}
395
+ `).join(""), 384);
396
+ writeFileSync(marker, "", { mode: 384 });
397
+ } catch {
398
+ }
399
+ }, "dropSuccesses");
400
+ var sizeOf = /* @__PURE__ */ __name((path) => {
401
+ let total = 0;
402
+ for (const entry of safeReaddir(path)) {
403
+ const full = join(path, entry);
404
+ try {
405
+ const stat = statSync(full);
406
+ total += stat.isDirectory() ? sizeOf(full) : stat.size;
407
+ } catch {
408
+ }
409
+ }
410
+ return total;
411
+ }, "sizeOf");
412
+ var fitSize = /* @__PURE__ */ __name((runsDir, maxBytes, now) => {
413
+ const stamp = join(runsDir, SIZE_CHECKED);
414
+ const today = day(now);
415
+ try {
416
+ if (readFileSync(stamp, "utf8").trim() === today)
417
+ return 0;
418
+ } catch {
419
+ }
420
+ const dates = days(runsDir).sort();
421
+ const sizes = new Map(dates.map((date) => [date, sizeOf(join(runsDir, date))]));
422
+ let total = [...sizes.values()].reduce((sum, size) => sum + size, 0);
423
+ let removed = 0;
424
+ for (const date of dates) {
425
+ if (total <= maxBytes || date === today)
426
+ break;
427
+ dropSuccesses(join(runsDir, date));
428
+ const after = sizeOf(join(runsDir, date));
429
+ total -= (sizes.get(date) ?? 0) - after;
430
+ sizes.set(date, after);
431
+ }
432
+ for (const date of dates) {
433
+ if (total <= maxBytes || date === today)
434
+ break;
435
+ try {
436
+ rmSync(join(runsDir, date), { recursive: true, force: true });
437
+ total -= sizes.get(date) ?? 0;
438
+ removed += 1;
439
+ } catch {
440
+ }
441
+ }
442
+ try {
443
+ mkdirSync(runsDir, { recursive: true, mode: 448 });
444
+ writeFileSync(stamp, today, { mode: 384 });
445
+ } catch {
446
+ }
447
+ return removed;
448
+ }, "fitSize");
449
+ var day = /* @__PURE__ */ __name((date) => date.toISOString().slice(0, 10), "day");
450
+ var days = /* @__PURE__ */ __name((runsDir) => safeReaddir(runsDir).filter((entry) => /^\d{4}-\d{2}-\d{2}$/.test(entry)), "days");
451
+ var readRun = /* @__PURE__ */ __name((dir) => {
452
+ try {
453
+ return metadataOf(JSON.parse(readFileSync(join(dir, "run.json"), "utf8")));
454
+ } catch {
455
+ return void 0;
456
+ }
457
+ }, "readRun");
458
+ var safeReaddir = /* @__PURE__ */ __name((dir) => {
459
+ try {
460
+ return readdirSync(dir);
461
+ } catch {
462
+ return [];
463
+ }
464
+ }, "safeReaddir");
465
+ var runFileOf = /* @__PURE__ */ __name(({ partial, ...metadata }) => ({
466
+ ...logAttributes(metadata),
467
+ ...partial ? { partial: { ...logAttributes(partial), failures: partial.failures.map((failure) => logAttributes(failure)) } } : {}
468
+ }), "runFileOf");
469
+ var metadataOf = /* @__PURE__ */ __name((parsed) => {
470
+ const { partial, ...metadata } = fromLogAttributes(parsed);
471
+ if (partial === null || typeof partial !== "object")
472
+ return metadata;
473
+ const { failures, ...rest } = fromLogAttributes(partial);
474
+ return {
475
+ ...metadata,
476
+ partial: {
477
+ ...rest,
478
+ failures: Array.isArray(failures) ? failures.map((failure) => fromLogAttributes(failure)) : []
479
+ }
480
+ };
481
+ }, "metadataOf");
482
+
483
+ // node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/runs/scope.js
484
+ import { AsyncLocalStorage } from "node:async_hooks";
485
+ import { randomBytes } from "node:crypto";
486
+ var scopes = new AsyncLocalStorage();
487
+ var processScope;
488
+ var currentRun = /* @__PURE__ */ __name(() => {
489
+ const scope = scopes.getStore();
490
+ if (scope)
491
+ return scope;
492
+ processScope ??= {
493
+ runId: newRunId(/* @__PURE__ */ new Date(), "process"),
494
+ command: "",
495
+ startedAt: Date.now(),
496
+ ...traceOf(process.env)
497
+ };
498
+ return processScope;
499
+ }, "currentRun");
500
+ var inRun = /* @__PURE__ */ __name((scope, body) => scopes.run(scope, body), "inRun");
501
+ var runEvent = /* @__PURE__ */ __name((event) => scopes.getStore()?.events?.(event), "runEvent");
502
+ var typedCommand = /* @__PURE__ */ __name((tool, words, profile = currentRun().profile) => [tool, profile, words].filter((part) => part !== void 0 && part !== "").join(" "), "typedCommand");
503
+ var useAsProcessRun = /* @__PURE__ */ __name((scope) => {
504
+ processScope = scope;
505
+ }, "useAsProcessRun");
506
+ var processRun = /* @__PURE__ */ __name(() => processScope, "processRun");
507
+ var enclosingTraceId = /* @__PURE__ */ __name(() => scopes.getStore()?.traceId, "enclosingTraceId");
508
+ var traceOf = /* @__PURE__ */ __name((env) => {
509
+ const traceId = traceIdOf(env.TRACEPARENT);
510
+ return traceId === void 0 ? {} : { traceId };
511
+ }, "traceOf");
512
+ var childTrace = /* @__PURE__ */ __name(() => {
513
+ const hex = /* @__PURE__ */ __name((bytes) => randomBytes(bytes).toString("hex"), "hex");
514
+ const traceId = hex(16);
515
+ return { traceId, traceparent: `00-${traceId}-${hex(8)}-01` };
516
+ }, "childTrace");
517
+ var attempts = new AsyncLocalStorage();
518
+ var withAttempt = /* @__PURE__ */ __name((attempt, work) => attempts.run(attempt, work), "withAttempt");
519
+ var currentAttempt = /* @__PURE__ */ __name(() => attempts.getStore(), "currentAttempt");
520
+
521
+ // node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/domain/duration.js
522
+ var DURATION = /^(\d+)(ms|s|m|h|d)$/;
523
+ var UNIT_MS = { ms: 1, s: 1e3, m: 6e4, h: 36e5, d: 864e5 };
524
+ var parseDuration = /* @__PURE__ */ __name((value, source) => {
525
+ const match = DURATION.exec(value.trim());
526
+ if (!match?.[1] || !match[2]) {
527
+ throw new CliError("validation_error", `${source} takes a duration with a unit \u2014 500ms, 30s, 2m, 4h or 1d \u2014 not "${value}"`);
528
+ }
529
+ const ms = Number(match[1]) * (UNIT_MS[match[2]] ?? 0);
530
+ if (ms <= 0)
531
+ throw new CliError("validation_error", `${source} has to be more than zero, and "${value}" is not`);
532
+ return ms;
533
+ }, "parseDuration");
534
+
535
+ // node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/sends/guarded.js
536
+ import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
537
+ var sentIds = /* @__PURE__ */ __name((typed, message) => ({
538
+ messageId: message.id,
539
+ ...message.chatId && message.chatId !== typed ? { resultChatId: message.chatId } : {}
540
+ }), "sentIds");
541
+ var current = new AsyncLocalStorage2();
542
+ var writesInFlight = new AsyncLocalStorage2();
543
+ var parents = /* @__PURE__ */ new WeakMap();
544
+ var stopped = /* @__PURE__ */ new WeakMap();
545
+ var scopesFor = /* @__PURE__ */ __name((scope = writesInFlight.getStore()) => {
546
+ const result = [];
547
+ for (let at = scope; at; at = parents.get(at))
548
+ result.push(at);
549
+ return result;
550
+ }, "scopesFor");
551
+ var withWriteScope = /* @__PURE__ */ __name((scope, body) => {
552
+ const parent = writesInFlight.getStore();
553
+ if (parent && parent !== scope)
554
+ parents.set(scope, parent);
555
+ return writesInFlight.run(scope, body);
556
+ }, "withWriteScope");
557
+ var stopWrites = /* @__PURE__ */ __name((scope, reason) => {
558
+ stopped.set(scope, reason);
559
+ for (const write of scope)
560
+ write.cut();
561
+ }, "stopWrites");
562
+ var refuseStopped = /* @__PURE__ */ __name((scopes2) => {
563
+ for (const scope of scopes2)
564
+ if (stopped.has(scope))
565
+ throw stopped.get(scope);
566
+ }, "refuseStopped");
567
+ var currentOperation = /* @__PURE__ */ __name(() => current.getStore(), "currentOperation");
568
+ var guardedWrite = /* @__PURE__ */ __name(async (guard, attempt, act, settled = () => ({}), prepare) => {
569
+ const scopes2 = scopesFor();
570
+ refuseStopped(scopes2);
571
+ try {
572
+ await guard.ask?.(attempt);
573
+ refuseStopped(scopes2);
574
+ if (guard.reserve) {
575
+ guard.check(attempt, { reserve: false });
576
+ await guard.reserve(attempt);
577
+ } else
578
+ guard.check(attempt);
579
+ } catch (error) {
580
+ guard.record({ ...attempt, outcome: "refused", errorCode: codeOf(error) });
581
+ throw error;
582
+ }
583
+ try {
584
+ refuseStopped(scopes2);
585
+ } catch (error) {
586
+ guard.record({ ...attempt, outcome: "failed", errorCode: codeOf(error) });
587
+ throw error;
588
+ }
589
+ let recorded = false;
590
+ const once = /* @__PURE__ */ __name((entry) => {
591
+ if (recorded)
592
+ return;
593
+ recorded = true;
594
+ guard.record(entry);
595
+ }, "once");
596
+ let cancelled = false;
597
+ const flight = {
598
+ operationId: attempt.operationId,
599
+ preparing: prepare !== void 0,
600
+ cut: /* @__PURE__ */ __name(() => {
601
+ cancelled = true;
602
+ once({
603
+ ...attempt,
604
+ outcome: flight.preparing ? "failed" : "outcome_unknown",
605
+ errorCode: flight.preparing ? "timeout" : "outcome_unknown"
606
+ });
607
+ }, "cut")
608
+ };
609
+ for (const scope of scopes2)
610
+ scope.add(flight);
611
+ try {
612
+ if (prepare !== void 0)
613
+ await prepare();
614
+ if (cancelled)
615
+ throw new CliError("timeout", "the command ended before sending; nothing was sent", { sent: false });
616
+ flight.preparing = false;
617
+ const done = await current.run(attempt.operationId, act);
618
+ if (cancelled)
619
+ throw new CliError("outcome_unknown", "the command ended with a write in flight; check its result before continuing", { operation_id: attempt.operationId });
620
+ once({ ...attempt, ...settled(done), outcome: "sent" });
621
+ return done;
622
+ } catch (error) {
623
+ const code = codeOf(error);
624
+ once({ ...attempt, outcome: code === "outcome_unknown" ? "outcome_unknown" : "failed", errorCode: code });
625
+ if (code === "outcome_unknown" && error instanceof Error)
626
+ throw new CliError("outcome_unknown", error.message, {
627
+ ...error.details,
628
+ operation_id: attempt.operationId,
629
+ retryable: false
630
+ });
631
+ if (flight.preparing && isCliError(error) && error.details.sent === void 0)
632
+ throw new CliError(error.code, error.message, { ...error.details, sent: false });
633
+ throw error;
634
+ } finally {
635
+ for (const scope of scopes2)
636
+ scope.delete(flight);
637
+ }
638
+ }, "guardedWrite");
639
+ var codeOf = /* @__PURE__ */ __name((error) => typeof error?.code === "string" ? error.code : "unknown", "codeOf");
640
+
641
+ // node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/embeddings/models.js
642
+ var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/${repository}/resolve/${commit}/${name}`, "huggingFace");
643
+ var e5 = huggingFace("Xenova/multilingual-e5-small", "761b726dd34fb83930e26aab4e9ac3899aa1fa78");
644
+ var gemma = huggingFace("onnx-community/embeddinggemma-300m-ONNX", "5090578d9565bb06545b4552f76e6bc2c93e4a66");
645
+ var TEXT_MODELS = [
646
+ {
647
+ id: "e5-small",
648
+ title: "multilingual-e5-small, 8-bit",
649
+ languages: "about 100 languages, Russian and English among them",
650
+ licence: "MIT",
651
+ dims: 384,
652
+ maxTokens: 512,
653
+ // 100k-message corpus, one 8-thread session on Ryzen AI 9 HX 470: 31–32 chunks/s.
654
+ chunksPerSecond: 31,
655
+ pooling: "mean",
656
+ prefix: { query: "query: ", passage: "passage: " },
657
+ onnx: "onnx/model_quantized.onnx",
658
+ files: [
659
+ {
660
+ name: "onnx/model_quantized.onnx",
661
+ url: e5("onnx/model_quantized.onnx"),
662
+ sha256: "f80102d3f2a1229f387d3c81909990d8945513e347b0eab049f7de3c6f98c193",
663
+ bytes: 118308185
664
+ },
665
+ {
666
+ name: "tokenizer.json",
667
+ url: e5("tokenizer.json"),
668
+ sha256: "0b44a9d7b51c3c62626640cda0e2c2f70fdacdc25bbbd68038369d14ebdf4c39",
669
+ bytes: 17082730
670
+ },
671
+ {
672
+ name: "tokenizer_config.json",
673
+ url: e5("tokenizer_config.json"),
674
+ sha256: "a1d6bc8734a6f635dc158508bef000f8e2e5a759c7d92f984b2c86e5ff53425b",
675
+ bytes: 443
676
+ }
677
+ ]
678
+ },
679
+ {
680
+ id: "embeddinggemma",
681
+ title: "EmbeddingGemma 300M, 4-bit",
682
+ languages: "over 100 languages \u2014 the best of the two on chat, about seven times slower",
683
+ licence: "Gemma Terms of Use",
684
+ terms: "https://ai.google.dev/gemma/terms",
685
+ dims: 768,
686
+ maxTokens: 2048,
687
+ chunksPerSecond: 2,
688
+ pooling: "sentence_embedding",
689
+ prefix: { query: "task: search result | query: ", passage: "title: none | text: " },
690
+ onnx: "onnx/model_q4.onnx",
691
+ externalData: "onnx/model_q4.onnx_data",
692
+ files: [
693
+ {
694
+ name: "onnx/model_q4.onnx",
695
+ url: gemma("onnx/model_q4.onnx"),
696
+ sha256: "ad1dfee81a70f7944b9b9d1cc6e48075b832881cf33fab2f2b248be78f3f0043",
697
+ bytes: 519322
698
+ },
699
+ {
700
+ name: "onnx/model_q4.onnx_data",
701
+ url: gemma("onnx/model_q4.onnx_data"),
702
+ sha256: "599962c3143b040de2dd05e5975be3e9091dd067cacc6a8f7186e3203bab9e02",
703
+ bytes: 196725760
704
+ },
705
+ {
706
+ name: "tokenizer.json",
707
+ url: gemma("tokenizer.json"),
708
+ sha256: "4dda02faaf32bc91031dc8c88457ac272b00c1016cc679757d1c441b248b9c47",
709
+ bytes: 20323312
710
+ },
711
+ {
712
+ name: "tokenizer_config.json",
713
+ url: gemma("tokenizer_config.json"),
714
+ sha256: "3ca953eea6c3c9fcda9cf3df22949ff18b216f7c74bd6459230f3f1013953f3a",
715
+ bytes: 1156830
716
+ }
717
+ ]
718
+ }
719
+ ];
720
+ var DEFAULT_TEXT_MODEL = "e5-small";
721
+ var textModel = /* @__PURE__ */ __name((id2) => {
722
+ const found = TEXT_MODELS.find((model) => model.id === id2);
723
+ if (!found) {
724
+ throw new CliError("validation_error", `no text model ${id2} \u2014 one of: ${TEXT_MODELS.map((model) => model.id).join(", ")}`);
725
+ }
726
+ return found;
727
+ }, "textModel");
728
+ var mmarco = huggingFace("cross-encoder/mmarco-mMiniLMv2-L12-H384-v1", "1427fd652930e4ba29e8149678df786c240d8825");
729
+ var bge = huggingFace("onnx-community/bge-reranker-v2-m3-ONNX", "6f5ff65298512715a1e669753bc754d2bc8f367b");
730
+ var RERANK_MODELS = [
731
+ {
732
+ id: "mmarco",
733
+ title: "mMARCO mMiniLMv2-L12 cross-encoder, 8-bit",
734
+ languages: "about 100 languages, Russian and English among them",
735
+ licence: "Apache-2.0",
736
+ maxTokens: 512,
737
+ // The x86 name is the quantizer's target; WebAssembly and native ONNX Runtime both run it on any processor.
738
+ onnx: "onnx/model_quint8_avx2.onnx",
739
+ files: [
740
+ {
741
+ name: "onnx/model_quint8_avx2.onnx",
742
+ url: mmarco("onnx/model_quint8_avx2.onnx"),
743
+ sha256: "6c2513767fb63d008a4377bef7a7a3555433d9436342bb53e35a3a72ffc52d4b",
744
+ bytes: 118620016
745
+ },
746
+ {
747
+ name: "tokenizer.json",
748
+ url: mmarco("tokenizer.json"),
749
+ sha256: "62c24cdc13d4c9952d63718d6c9fa4c287974249e16b7ade6d5a85e7bbb75626",
750
+ bytes: 17082660
751
+ },
752
+ {
753
+ name: "tokenizer_config.json",
754
+ url: mmarco("tokenizer_config.json"),
755
+ sha256: "e7fbfbfa6347b4e414c1cee50d142e2c2f9a895dad68b068ae83a8b564c3837e",
756
+ bytes: 435
757
+ }
758
+ ]
759
+ },
760
+ {
761
+ id: "bge-reranker-v2-m3",
762
+ title: "BGE reranker v2 m3, 8-bit",
763
+ languages: "over 100 languages \u2014 better than mmarco in the benchmark, about seven times slower",
764
+ licence: "Apache-2.0 (BAAI's; the ONNX export declares none)",
765
+ maxTokens: 512,
766
+ onnx: "onnx/model_quantized.onnx",
767
+ files: [
768
+ {
769
+ name: "onnx/model_quantized.onnx",
770
+ url: bge("onnx/model_quantized.onnx"),
771
+ sha256: "912fc1215c2dbff6499700534bd8d31253af01573861abbfc43afd1fab6cce5d",
772
+ bytes: 570727094
773
+ },
774
+ {
775
+ name: "tokenizer.json",
776
+ url: bge("tokenizer.json"),
777
+ sha256: "8bf8afbfd11306bd872018c53bfdf2e160a56f8edbcf49933324404791c148d3",
778
+ bytes: 17082900
779
+ },
780
+ {
781
+ name: "tokenizer_config.json",
782
+ url: bge("tokenizer_config.json"),
783
+ sha256: "b87c8703482b0300d3da30e201519aa641f6a450f5eb5bf1e624afbf70c74d80",
784
+ bytes: 1203
785
+ }
786
+ ]
787
+ }
788
+ ];
789
+ var DEFAULT_RERANK_MODEL = "mmarco";
790
+ var rerankModel = /* @__PURE__ */ __name((id2) => {
791
+ const found = RERANK_MODELS.find((model) => model.id === id2);
792
+ if (!found) {
793
+ throw new CliError("validation_error", `no reranker ${id2} \u2014 one of: ${RERANK_MODELS.map((model) => model.id).join(", ")}`);
794
+ }
795
+ return found;
796
+ }, "rerankModel");
797
+ var vectorModelKey = /* @__PURE__ */ __name((model) => `local:${model.id}:${model.dims}`, "vectorModelKey");
798
+ var meaningFloor = /* @__PURE__ */ __name((key) => key === "local:e5-small:384" ? 0.8 : 0, "meaningFloor");
799
+
800
+ // node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/images/picture/models.js
801
+ import { join as join2 } from "node:path";
802
+ var clip = /* @__PURE__ */ __name((name) => `https://huggingface.co/Xenova/clip-vit-base-patch32/resolve/d15189d7028b43f1d3e65039190477f6af591c2a/${name}`, "clip");
803
+ var IMAGE_MODELS = [
804
+ {
805
+ id: "clip-b32",
806
+ title: "CLIP ViT-B/32, 8-bit",
807
+ languages: "English only: translate a query before searching",
808
+ licence: "MIT",
809
+ dims: 512,
810
+ key: "local:clip-b32:512",
811
+ maxTokens: 77,
812
+ vision: "onnx/vision_model_quantized.onnx",
813
+ text: "onnx/text_model_quantized.onnx",
814
+ files: [
815
+ {
816
+ name: "onnx/vision_model_quantized.onnx",
817
+ url: clip("onnx/vision_model_quantized.onnx"),
818
+ sha256: "583fd1110a514667812fee7d684952aaf82a99b959760c8d7dca7e0ab9839299",
819
+ bytes: 89117001
820
+ },
821
+ {
822
+ name: "onnx/text_model_quantized.onnx",
823
+ url: clip("onnx/text_model_quantized.onnx"),
824
+ sha256: "73baab855d406190da9faa498cfedf65f15cf309f4cc7385b7b032e6d08e5c3a",
825
+ bytes: 64504507
826
+ },
827
+ {
828
+ name: "tokenizer.json",
829
+ url: clip("tokenizer.json"),
830
+ sha256: "f7f3b7af117d467b58374797691a6438d3e6b9e9cef800dfd5dced7f697a90cd",
831
+ bytes: 2224119
832
+ },
833
+ {
834
+ name: "tokenizer_config.json",
835
+ url: clip("tokenizer_config.json"),
836
+ sha256: "60ba2912bc6344c94bc16bbdec27fa1209409167b6f2fdf3cfe9e65462ea3967",
837
+ bytes: 775
838
+ }
839
+ ]
840
+ }
841
+ ];
842
+ var DEFAULT_IMAGE_MODEL = "clip-b32";
843
+ var imageModel = /* @__PURE__ */ __name((id2) => {
844
+ const found = IMAGE_MODELS.find((model) => model.id === id2);
845
+ if (!found) {
846
+ throw new CliError("validation_error", `no image model ${id2} \u2014 one of: ${IMAGE_MODELS.map((model) => model.id).join(", ")}`);
847
+ }
848
+ return found;
849
+ }, "imageModel");
850
+ var imageModelsDirectory = /* @__PURE__ */ __name((env = process.env) => sharedModelsDirectory("image", env), "imageModelsDirectory");
851
+ var placedImage = /* @__PURE__ */ __name((model, directory) => model.files.map((file) => [file, join2(directory, model.id, file.name)]), "placedImage");
852
+ var isImageModelInstalled = /* @__PURE__ */ __name((model, directory) => filesPresent(placedImage(model, directory)), "isImageModelInstalled");
853
+
854
+ // node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/entities/task.js
855
+ var closeSuggestion = strictObject({
856
+ as: picklist(["done", "dismissed"]),
857
+ /** The agent's name. */
858
+ by: text,
859
+ /** 0–1, as the agent rated it. */
860
+ certainty: number(),
861
+ reason: nullable(text),
862
+ at: time
863
+ });
864
+ var task = strictObject({
865
+ ref: reference,
866
+ id,
867
+ /** The readable key: `Q-15` for a task found in a message from now on, `IN1A2B3C4D-17` before, `HRB-12` in a project. */
868
+ key: optional(nullable(text)),
869
+ title: nullable(text),
870
+ description: optional(nullable(text)),
871
+ kind: picklist(TASK_TYPES),
872
+ state: picklist(TASK_STATES),
873
+ origin: optional(picklist(TASK_ORIGINS)),
874
+ project: optional(nullable(text)),
875
+ account: optional(text),
876
+ /** The chat it came from, as a `chat:` reference. */
877
+ chat: optional(nullable(reference)),
878
+ /** The message it came from. */
879
+ source_message: optional(nullable(reference)),
880
+ priority: optional(nullable(number())),
881
+ parent: optional(nullable(reference)),
882
+ due_at: optional(nullable(time)),
883
+ closed_at: optional(nullable(time)),
884
+ reason: optional(nullable(text)),
885
+ /** One name from the category list (`tasks categories`). */
886
+ category: optional(nullable(text)),
887
+ /** Who works on it now, and until when; null when nobody does. */
888
+ claimed_by: optional(nullable(text)),
889
+ claimed_until: optional(nullable(time)),
890
+ /** The close an agent would make, waiting on the owner: `tasks close` confirms it, `tasks reject` refuses it. */
891
+ close_suggestion: optional(nullable(closeSuggestion)),
892
+ created_at: time,
893
+ updated_at: optional(time)
894
+ });
895
+
896
+ // node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/entities/agenda.js
897
+ var agendaChat = strictObject({
898
+ chat: reference,
899
+ title: nullable(text),
900
+ kind: picklist(["dialog", "group", "channel", "saved", "unknown"]),
901
+ /** The newest message, never its text; `null` while it is not stored. */
902
+ last_message: nullable(reference),
903
+ last_message_at: time,
904
+ /** `null` when the newest message is not stored, or the messenger did not say who sent it. */
905
+ last_from_owner: nullable(boolean()),
906
+ /** Open tasks whose source is in this chat. */
907
+ open_tasks: array(id)
908
+ });
909
+ var agenda = strictObject({
910
+ at: time,
911
+ account: text,
912
+ stored_at: nullable(time),
913
+ /** The store saved nothing for a day: a chat may look quiet only because nothing was synced. */
914
+ stale: boolean(),
915
+ tasks: array(strictObject({
916
+ id,
917
+ key: text,
918
+ title: nullable(text),
919
+ kind: picklist(TASK_TYPES),
920
+ category: nullable(text),
921
+ /** The message or note it came from. */
922
+ source: nullable(reference),
923
+ due_at: nullable(time),
924
+ next_check_at: nullable(time),
925
+ /** Who works on it now; only the asker's own claims are listed unless the query names claimed:. */
926
+ claimed_by: nullable(text),
927
+ claimed_until: nullable(time),
928
+ /** An agent's close waiting on the owner: `tasks close` confirms it, `tasks reject` refuses it. */
929
+ close_suggestion: nullable(closeSuggestion),
930
+ created_at: time,
931
+ reasons: array(picklist(["overdue", "due", "check", "unplanned", "close-suggested"]))
932
+ })),
933
+ /** Someone else wrote last, and the owner has not answered. */
934
+ owed: array(agendaChat),
935
+ /** The owner wrote last, and nobody answered. */
936
+ waiting: array(agendaChat),
937
+ /** The chat list says these moved and their newest message is not stored: read them first. */
938
+ unsynced: array(agendaChat),
939
+ /** Open tasks someone else does: what they owe the owner, oldest first. */
940
+ assigned: array(strictObject({
941
+ id,
942
+ key: text,
943
+ title: nullable(text),
944
+ kind: picklist(TASK_TYPES),
945
+ category: nullable(text),
946
+ source: nullable(reference),
947
+ due_at: nullable(time),
948
+ created_at: time,
949
+ /** `person:<id>`, each one who does it. */
950
+ assignees: array(reference)
951
+ })),
952
+ /** Open tasks carry these categories, which the list no longer holds: move them, or put the category back. */
953
+ unlisted_categories: array(strictObject({ name: text, open_tasks: number() }))
954
+ });
955
+
956
+ // node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/entities/conversation.js
957
+ var conversation = strictObject({
958
+ id,
959
+ chat: reference,
960
+ /** The message it starts with. */
961
+ first_message: reference,
962
+ started_at: time,
963
+ ended_at: time,
964
+ messages_count: count,
965
+ /** How many people wrote in it. */
966
+ senders_count: count,
967
+ built_at: time,
968
+ rules_version: count
969
+ });
970
+
971
+ // node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/entities/attachment.js
972
+ var attachment = strictObject({
973
+ /** The message it came with, as a locator; absent inside that message. */
974
+ message: optional(reference),
975
+ /** Lower-cased: `photo`, `video`, `file`, `voice`… */
976
+ kind: text,
977
+ /** Its place among the message's attachments, from 1, as `attachments show --attachment` takes it. */
978
+ position: optional(count),
979
+ url: optional(text),
980
+ name: optional(text),
981
+ title: optional(text),
982
+ mime: optional(text),
983
+ size: optional(count),
984
+ width: optional(count),
985
+ height: optional(count),
986
+ /** Seconds, for audio and video. */
987
+ duration: optional(number()),
988
+ /** The text read out of it; how it was read is `extraction`. */
989
+ text: optional(text),
990
+ extraction: optional(strictObject({ origin: text, extractor: text, chars: count, error: optional(text) })),
991
+ local_path: optional(text),
992
+ /** A bot's keyboard under the message, row by row; `messages press` presses one. */
993
+ buttons: optional(array(array(strictObject({
994
+ kind: picklist(["callback", "link", "message", "chat", "contact", "location", "app", "clipboard", "other"]),
995
+ text,
996
+ url: optional(text)
997
+ }))))
998
+ });
999
+
1000
+ // node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/entities/tagging.js
1001
+ var tagging = strictObject({
1002
+ tag: text,
1003
+ type: picklist(TAG_TYPES),
1004
+ /** What carries it: a `chat:`, `contact:` or `msg:` reference. */
1005
+ target: reference,
1006
+ /** The chat's title or the person's name, as the store holds it. */
1007
+ name: nullable(text),
1008
+ /** Who claims it: `manual` the owner, `auto` the keyword rules; both when both do. */
1009
+ sources: array(picklist(["manual", "auto"])),
1010
+ created_at: time
1011
+ });
1012
+
1013
+ // node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/botcheck/reasons.js
1014
+ var WEIGHTS = {
1015
+ bot: 3,
1016
+ scam: 3,
1017
+ fake: 3,
1018
+ deleted: 1,
1019
+ no_photo: 1,
1020
+ no_username: 1,
1021
+ odd_name: 1,
1022
+ never_wrote: 1,
1023
+ link_first: 2,
1024
+ burst_join: 1,
1025
+ mass_invited: 1,
1026
+ new_account: 2,
1027
+ no_bio: 1,
1028
+ same_text: 2,
1029
+ photo_recent: 1,
1030
+ cas_banned: 3,
1031
+ lols_banned: 3,
1032
+ lols_scammer: 3
1033
+ };
1034
+ var LINK = /https?:\/\/|t\.me\/|www\./i;
1035
+ var DIGITS = /\d{5,}/;
1036
+ var oddName = /* @__PURE__ */ __name((name) => !name?.trim() || DIGITS.test(name) || LINK.test(name), "oddName");
1037
+
1038
+ export {
1039
+ logAttributes,
1040
+ fromLogAttributes,
1041
+ snakeLogger,
1042
+ LOG_ATTRIBUTES,
1043
+ KEEP_RUNS_FOR_DAYS,
1044
+ KEEP_SUCCESSFUL_RUNS_FOR_DAYS,
1045
+ RUNS_SIZE_LIMIT_MB,
1046
+ runsDirFor,
1047
+ startRun,
1048
+ runtime,
1049
+ newRunId,
1050
+ listRuns,
1051
+ findRun,
1052
+ readEvents,
1053
+ pruneRuns,
1054
+ currentRun,
1055
+ inRun,
1056
+ runEvent,
1057
+ typedCommand,
1058
+ useAsProcessRun,
1059
+ processRun,
1060
+ enclosingTraceId,
1061
+ traceOf,
1062
+ childTrace,
1063
+ withAttempt,
1064
+ currentAttempt,
1065
+ sentIds,
1066
+ withWriteScope,
1067
+ stopWrites,
1068
+ currentOperation,
1069
+ guardedWrite,
1070
+ codeOf,
1071
+ parseDuration,
1072
+ TEXT_MODELS,
1073
+ DEFAULT_TEXT_MODEL,
1074
+ textModel,
1075
+ RERANK_MODELS,
1076
+ DEFAULT_RERANK_MODEL,
1077
+ rerankModel,
1078
+ vectorModelKey,
1079
+ meaningFloor,
1080
+ IMAGE_MODELS,
1081
+ DEFAULT_IMAGE_MODEL,
1082
+ imageModel,
1083
+ imageModelsDirectory,
1084
+ placedImage,
1085
+ isImageModelInstalled,
1086
+ WEIGHTS,
1087
+ LINK,
1088
+ oddName,
1089
+ closeSuggestion,
1090
+ task,
1091
+ agenda,
1092
+ conversation,
1093
+ attachment,
1094
+ tagging
1095
+ };