@wirecat/tg-cli 0.119.0 → 0.121.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 (112) hide show
  1. package/contracts/wirecat.json +27 -3
  2. package/dist/bin/tg.js +2 -2
  3. package/dist/bundle/{adapter-NEQQOANM.js → adapter-GVSBFSBY.js} +62 -58
  4. package/dist/bundle/{all-profiles-QFT46FTF.js → all-profiles-CTOGU4XR.js} +10 -10
  5. package/dist/bundle/{anthropic-UJ4RYCWU.js → anthropic-7472H6ES.js} +16 -7
  6. package/dist/bundle/{app-server-NE3EL5IK.js → app-server-GZWV4NPR.js} +47 -46
  7. package/dist/bundle/{bot-api-D4H5SCP5.js → bot-api-PPVAKICN.js} +53 -50
  8. package/dist/bundle/{bot-history-KF2PUMWA.js → bot-history-7YY7MCR4.js} +18 -18
  9. package/dist/bundle/{bun-F7MH5YKA.js → bun-KCN62RMD.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-FYDJXUHF.js → bun-sqlite-2BNE56MY.js} +5 -5
  11. package/dist/bundle/{chunk-23JGV5FQ.js → chunk-24DWSW6H.js} +37 -122
  12. package/dist/bundle/{chunk-6ERQJRL2.js → chunk-3E35VJME.js} +2 -2
  13. package/dist/bundle/{chunk-CX2WCEQU.js → chunk-3EGVR7OF.js} +1795 -545
  14. package/dist/bundle/{chunk-RGU2G3KL.js → chunk-3HNI6GI7.js} +4 -4
  15. package/dist/bundle/{chunk-RUNFFBJU.js → chunk-4HJCWFPN.js} +119 -107
  16. package/dist/bundle/{chunk-7C6POLLO.js → chunk-4J34T6IQ.js} +1 -1
  17. package/dist/bundle/{chunk-QG5U6HCI.js → chunk-4W4EVVL4.js} +4 -4
  18. package/dist/bundle/{chunk-6K5R3YPN.js → chunk-54KFRAHF.js} +2 -2
  19. package/dist/bundle/{chunk-ROOUBFUW.js → chunk-5P43K3GL.js} +18950 -17132
  20. package/dist/bundle/{chunk-OG2CG2GS.js → chunk-6LRKWXCS.js} +17 -17
  21. package/dist/bundle/{chunk-QD27C3BG.js → chunk-6SQAE7NM.js} +10 -8
  22. package/dist/bundle/{chunk-IAGX5VFL.js → chunk-7DPWVKYS.js} +4 -4
  23. package/dist/bundle/{chunk-5EHJWIW4.js → chunk-7I6YVQHW.js} +2 -2
  24. package/dist/bundle/{chunk-ZEQ7ONPZ.js → chunk-7MXRFFIT.js} +3 -3
  25. package/dist/bundle/{chunk-3K65KTXD.js → chunk-7UIMMQOV.js} +2 -2
  26. package/dist/bundle/{chunk-7VUNJDYU.js → chunk-AYDLA27G.js} +4 -4
  27. package/dist/bundle/{chunk-TKHEVAEG.js → chunk-BJTJBNR7.js} +8 -8
  28. package/dist/bundle/{chunk-HPQQ76WF.js → chunk-CLMRF6XR.js} +3 -3
  29. package/dist/bundle/{chunk-D6YTBJY6.js → chunk-CMEWPXKU.js} +1 -1
  30. package/dist/bundle/{chunk-DQELQ7BL.js → chunk-CPDYPZIG.js} +4525 -4753
  31. package/dist/bundle/{chunk-QQ3QZFFD.js → chunk-DAK2J3FG.js} +8 -8
  32. package/dist/bundle/{chunk-S3HAFJVC.js → chunk-DG44ORQ3.js} +86 -29
  33. package/dist/bundle/{chunk-F223KYWG.js → chunk-ESLV57MC.js} +1 -1
  34. package/dist/bundle/{chunk-TEZKCH5B.js → chunk-FATTEYZH.js} +2 -2
  35. package/dist/bundle/{chunk-4AACB23H.js → chunk-FERGNQYA.js} +13 -13
  36. package/dist/bundle/{chunk-HGMMRT4G.js → chunk-GB55EDOF.js} +2 -2
  37. package/dist/bundle/chunk-GNGYV5NX.js +116 -0
  38. package/dist/bundle/{chunk-6OE5I3PR.js → chunk-KKD5ZPGD.js} +6 -6
  39. package/dist/bundle/{chunk-G3MQOH6Z.js → chunk-KPAUPIC3.js} +3 -3
  40. package/dist/bundle/chunk-KVW7LCZK.js +109 -0
  41. package/dist/bundle/{chunk-D4Y2KL5V.js → chunk-LTAHG7BO.js} +4 -4
  42. package/dist/bundle/{chunk-NDSRND3E.js → chunk-LVGX7VTD.js} +4 -4
  43. package/dist/bundle/{chunk-Z4CGZAFQ.js → chunk-M47CXY5J.js} +39 -58
  44. package/dist/bundle/{chunk-L33G5ARH.js → chunk-M73VM67N.js} +1920 -1325
  45. package/dist/bundle/{chunk-JKKEMVW3.js → chunk-MAPJUOTD.js} +4 -4
  46. package/dist/bundle/{chunk-5FEEFXJA.js → chunk-MCPOZNWG.js} +1 -1
  47. package/dist/bundle/{chunk-QTFXYR5W.js → chunk-MKAKM3V7.js} +4 -4
  48. package/dist/bundle/{chunk-FRW3CWC7.js → chunk-NR7PGYPO.js} +44 -42
  49. package/dist/bundle/chunk-PLBEUSZP.js +18 -0
  50. package/dist/bundle/{chunk-FJKP6MMP.js → chunk-QMNUQTA2.js} +2 -2
  51. package/dist/bundle/{chunk-FQ3C6DFV.js → chunk-QNNUNGPL.js} +3 -3
  52. package/dist/bundle/{chunk-CIDFV3IT.js → chunk-QQ264PXQ.js} +1 -1
  53. package/dist/bundle/{chunk-2BAJ6ORN.js → chunk-R6KXHBMW.js} +1 -1
  54. package/dist/bundle/{chunk-72QLHHSO.js → chunk-RPBO5XL3.js} +21 -19
  55. package/dist/bundle/{chunk-KBHK5UGL.js → chunk-RX5CJ55S.js} +1 -1
  56. package/dist/bundle/{chunk-W2BIBPRU.js → chunk-RZX7RDXY.js} +88 -48
  57. package/dist/bundle/{chunk-HV5YYAJX.js → chunk-S7P5X23R.js} +66 -29
  58. package/dist/bundle/{chunk-UBCLVM7C.js → chunk-SHIHW2YN.js} +3 -3
  59. package/dist/bundle/{chunk-YMWPRHXG.js → chunk-SQWTUENZ.js} +2063 -949
  60. package/dist/bundle/{chunk-XM3P7LLT.js → chunk-T7ONSJAA.js} +2 -2
  61. package/dist/bundle/{chunk-X5PDWCG7.js → chunk-TEMCXODM.js} +1 -1
  62. package/dist/bundle/{chunk-V5Z2JO6X.js → chunk-U6HEZPCR.js} +19 -19
  63. package/dist/bundle/{chunk-65BWMPCI.js → chunk-VAAZL6OD.js} +6 -6
  64. package/dist/bundle/{chunk-TT4CIXVH.js → chunk-VPNLTNQD.js} +6 -6
  65. package/dist/bundle/{chunk-SMHLQEE2.js → chunk-VUBZFMGP.js} +2 -2
  66. package/dist/bundle/{chunk-XDMJVWWR.js → chunk-W77WC6ZK.js} +3 -3
  67. package/dist/bundle/{chunk-KC4MQRAB.js → chunk-WGGSFGNZ.js} +8 -8
  68. package/dist/bundle/{chunk-BXIPT2BO.js → chunk-Y4CSR5RP.js} +3 -1
  69. package/dist/bundle/{chunk-3EQ7USKJ.js → chunk-YMJKHMHX.js} +2 -2
  70. package/dist/bundle/{chunk-FQZSS3AB.js → chunk-YRY752BB.js} +6 -6
  71. package/dist/bundle/{chunk-MDLSI3EN.js → chunk-ZSW7LN7T.js} +43 -597
  72. package/dist/bundle/command-contract-3W73W27G.js +33 -0
  73. package/dist/bundle/command-server-entry-37PKBJ5A.js +146 -0
  74. package/dist/bundle/{decode-5N4ERCHC.js → decode-F7KC7WT4.js} +5 -5
  75. package/dist/bundle/{dispatch-TBGXBDHE.js → dispatch-U2DW6UI7.js} +8 -8
  76. package/dist/bundle/{echarts-YDEBAMXT.js → echarts-4VYG66GX.js} +2 -2
  77. package/dist/bundle/{embed-T7H62XFR.js → embed-ENZ6R4HF.js} +6 -6
  78. package/dist/bundle/{embedder-AW3O2TR3.js → embedder-4CBICMFO.js} +9 -9
  79. package/dist/bundle/entry-XQ562EDO.js +21 -0
  80. package/dist/bundle/{failure-AWHPW2HE.js → failure-HJD7S5UA.js} +2 -2
  81. package/dist/bundle/{first-run-6PBZSRZU.js → first-run-PPXOC6ID.js} +11 -11
  82. package/dist/bundle/first-screen-JC6BYZYD.js +31 -0
  83. package/dist/bundle/{instructions-C3NJERO7.js → instructions-XLCMJ5PJ.js} +1 -1
  84. package/dist/bundle/{mcp-CWLASTLV.js → mcp-7KQUJNFN.js} +2 -2
  85. package/dist/bundle/{node-P3CIIYWU.js → node-SSAC67R5.js} +2 -2
  86. package/dist/bundle/{node-sqlite-YVHMNRVA.js → node-sqlite-SUUUSYSZ.js} +6 -6
  87. package/dist/bundle/{oauth-5OQYA2SV.js → oauth-2ZNHMPEX.js} +7 -7
  88. package/dist/bundle/{open-YGWUVSU7.js → open-EFNT7V2Q.js} +5 -5
  89. package/dist/bundle/{openai-U45JBQ6F.js → openai-7STFVJXA.js} +16 -16
  90. package/dist/bundle/{process-DCYX5EDG.js → process-63F4PNWH.js} +1 -1
  91. package/dist/bundle/{program-UZBFH2EZ.js → program-C2E3TQNK.js} +70 -67
  92. package/dist/bundle/{prompt-HPVTPTFI.js → prompt-QPO7EKD5.js} +5 -5
  93. package/dist/bundle/{proxy-transport-D7MCHGSV.js → proxy-transport-ENU2SJYT.js} +5 -5
  94. package/dist/bundle/{recognize-IJCPFJ76.js → recognize-MLXEHFYL.js} +4 -4
  95. package/dist/bundle/{remote-MWDYQWFW.js → remote-DO7FLJEF.js} +7 -7
  96. package/dist/bundle/{rerank-SXG64475.js → rerank-W3WSBDAM.js} +7 -7
  97. package/dist/bundle/{serve-KJQENHEH.js → serve-Z3TOTEMQ.js} +14 -14
  98. package/dist/bundle/{server-MXVXZWN6.js → server-BYSOJCUA.js} +36 -36
  99. package/dist/bundle/server-IRUVLXD4.js +61 -0
  100. package/dist/bundle/{state-CKKJWH27.js → state-PKRPBCMY.js} +6 -6
  101. package/dist/bundle/{store-R3BE4V56.js → store-Y4G7CNJT.js} +13 -13
  102. package/dist/bundle/store-maintenance-command-PHK43OSM.js +49 -0
  103. package/dist/bundle/tg.js +13 -13
  104. package/dist/version.d.ts +1 -1
  105. package/dist/version.js +1 -1
  106. package/package.json +3 -3
  107. package/dist/bundle/command-contract-7TGMZRBE.js +0 -33
  108. package/dist/bundle/entry-L2LJ2VPY.js +0 -18
  109. package/dist/bundle/first-screen-UKCD7D2R.js +0 -31
  110. package/dist/bundle/server-RTMCRKQF.js +0 -60
  111. package/dist/bundle/store-maintenance-command-KDGBSBNU.js +0 -49
  112. /package/dist/bundle/{chunk-DWX4DE2I.js → chunk-YVNHQFLC.js} +0 -0
@@ -3,10 +3,16 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  isCliFailure,
5
5
  isStoreDamage
6
- } from "./chunk-ZEQ7ONPZ.js";
6
+ } from "./chunk-7MXRFFIT.js";
7
7
  import {
8
8
  refuseOwnerStoreInTests
9
- } from "./chunk-6K5R3YPN.js";
9
+ } from "./chunk-54KFRAHF.js";
10
+ import {
11
+ createRecordLog,
12
+ resolvePaths,
13
+ traceIdOf,
14
+ writeSecurely
15
+ } from "./chunk-U6HEZPCR.js";
10
16
  import {
11
17
  RegistryError,
12
18
  SNAKE_CASE,
@@ -40,18 +46,518 @@ import {
40
46
  union,
41
47
  unknown,
42
48
  variant
43
- } from "./chunk-KC4MQRAB.js";
49
+ } from "./chunk-WGGSFGNZ.js";
44
50
  import {
45
51
  CliError,
46
52
  isCliError,
47
53
  singleLine,
48
54
  visibleControls
49
- } from "./chunk-SMHLQEE2.js";
55
+ } from "./chunk-VUBZFMGP.js";
50
56
  import {
51
57
  __name
52
58
  } from "./chunk-ZVVMGPBJ.js";
53
59
 
54
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/money.js
60
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/runs/scope.js
61
+ import { AsyncLocalStorage } from "node:async_hooks";
62
+ import { randomBytes } from "node:crypto";
63
+
64
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/runs/run.js
65
+ import { randomUUID } from "node:crypto";
66
+ import { appendFileSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
67
+ import { userInfo } from "node:os";
68
+ import { join, sep } from "node:path";
69
+
70
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/runs/log-keys.js
71
+ var snake = /* @__PURE__ */ __name((key) => key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "snake");
72
+ var camel = /* @__PURE__ */ __name((key) => key.replace(/_([a-z0-9])/g, (_, letter) => letter.toUpperCase()), "camel");
73
+ var renamed = /* @__PURE__ */ __name((record2, name) => Object.fromEntries(Object.entries(record2).map(([key, value]) => [name(key), value])), "renamed");
74
+ var logAttributes = /* @__PURE__ */ __name((event2) => renamed(event2, snake), "logAttributes");
75
+ var fromLogAttributes = /* @__PURE__ */ __name((attributes) => renamed(attributes, camel), "fromLogAttributes");
76
+ var snakeLogger = /* @__PURE__ */ __name((logger) => ({
77
+ debug: /* @__PURE__ */ __name((event2, message) => logger.debug(logAttributes(event2), message), "debug"),
78
+ info: /* @__PURE__ */ __name((event2, message) => logger.info(logAttributes(event2), message), "info"),
79
+ warn: /* @__PURE__ */ __name((event2, message) => logger.warn(logAttributes(event2), message), "warn"),
80
+ error: /* @__PURE__ */ __name((event2, message) => logger.error(logAttributes(event2), message), "error")
81
+ }), "snakeLogger");
82
+
83
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/runs/log-attributes.js
84
+ var diagnostic = {
85
+ event: true,
86
+ operation: true,
87
+ opcode: true,
88
+ seq: true,
89
+ status: true,
90
+ method: true,
91
+ endpointTemplate: true,
92
+ bytes: true,
93
+ ids: true,
94
+ counts: true,
95
+ durationMs: true,
96
+ outcome: true,
97
+ errorCode: true,
98
+ providerError: true,
99
+ level: true,
100
+ transport: true,
101
+ attempt: true,
102
+ waitMs: true,
103
+ code: true,
104
+ detail: true,
105
+ reason: true,
106
+ ageMs: true,
107
+ kind: true,
108
+ table: true,
109
+ op: true,
110
+ n: true
111
+ };
112
+ var send = {
113
+ profile: true,
114
+ chatId: true,
115
+ outcome: true,
116
+ kind: true,
117
+ action: true,
118
+ people: true,
119
+ messageId: true,
120
+ key: true,
121
+ count: true,
122
+ forEveryone: true,
123
+ sendId: true,
124
+ operationId: true,
125
+ parentOperationId: true,
126
+ replyTo: true,
127
+ threadId: true,
128
+ sendAs: true,
129
+ resultChatId: true,
130
+ length: true,
131
+ attachments: true,
132
+ scheduledFor: true,
133
+ notify: true,
134
+ origin: true,
135
+ reservation: true,
136
+ errorCode: true
137
+ };
138
+ var background = [
139
+ "job",
140
+ "pid",
141
+ "schedule",
142
+ "exitCode",
143
+ "tool",
144
+ "tier",
145
+ "actorType",
146
+ "actorId",
147
+ "agent",
148
+ "targetType",
149
+ "targetId"
150
+ ];
151
+ var crash = ["errorClass", "frames"];
152
+ var dropped = ["dropped"];
153
+ var LOG_ATTRIBUTES = [
154
+ ...new Set([...Object.keys(diagnostic), ...Object.keys(send), ...background, ...crash, ...dropped].map((key) => Object.keys(logAttributes({ [key]: true }))[0]))
155
+ ].sort();
156
+
157
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/runs/run.js
158
+ var KEEP_RUNS_FOR_DAYS = 30;
159
+ var KEEP_SUCCESSFUL_RUNS_FOR_DAYS = 7;
160
+ var KEEP_STORE_RUNS_FOR_DAYS = 3;
161
+ var RUNS_SIZE_LIMIT_MB = 200;
162
+ var runsDirFor = /* @__PURE__ */ __name((app, env = process.env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "runs"), "runsDirFor");
163
+ var startRun = /* @__PURE__ */ __name((options) => {
164
+ const now = options.now ?? (() => /* @__PURE__ */ new Date());
165
+ const startedAt = options.startedAt ?? now();
166
+ const id4 = options.runId ?? newRunId(startedAt, options.command);
167
+ const dir = join(options.runsDir, day(startedAt), id4);
168
+ pruneRuns(options.runsDir, {
169
+ keepDays: options.keepDays ?? KEEP_RUNS_FOR_DAYS,
170
+ keepSuccessDays: options.keepSuccessDays ?? KEEP_SUCCESSFUL_RUNS_FOR_DAYS,
171
+ keepStoreDays: options.keepStoreDays ?? KEEP_STORE_RUNS_FOR_DAYS,
172
+ maxBytes: options.maxBytes ?? RUNS_SIZE_LIMIT_MB * 1024 * 1024,
173
+ now: startedAt
174
+ });
175
+ refuseRealStateInTests(dir);
176
+ const metadata = {
177
+ runId: id4,
178
+ command: options.command,
179
+ ...options.profile === void 0 ? {} : { profile: options.profile },
180
+ startedAt: startedAt.toISOString(),
181
+ status: "running",
182
+ cliVersion: options.cliVersion,
183
+ runtime: runtime(),
184
+ platform: process.platform,
185
+ arch: process.arch,
186
+ ...options.traceId === void 0 ? {} : { traceId: options.traceId },
187
+ ...options.context
188
+ };
189
+ let file;
190
+ const opened = /* @__PURE__ */ __name(() => {
191
+ if (file)
192
+ return file;
193
+ mkdirSync(dir, { recursive: true, mode: 448 });
194
+ const events = join(dir, "events.jsonl");
195
+ writeFileSync(events, "", { flag: "a", mode: 384 });
196
+ file = snakeLogger(createRecordLog({
197
+ to: events,
198
+ runId: id4,
199
+ command: options.command,
200
+ resource: { service: options.service, version: options.cliVersion },
201
+ allow: LOG_ATTRIBUTES,
202
+ ...options.traceId === void 0 ? {} : { traceId: options.traceId },
203
+ ...options.onError === void 0 ? {} : { onError: options.onError }
204
+ }));
205
+ writeRunFile(dir, metadata);
206
+ return file;
207
+ }, "opened");
208
+ if (!options.lazy)
209
+ opened();
210
+ let finished = false;
211
+ const operations = /* @__PURE__ */ new Set();
212
+ const codes = /* @__PURE__ */ new Set();
213
+ const tables = /* @__PURE__ */ new Set();
214
+ const noted = /* @__PURE__ */ __name((level) => (event2, message) => {
215
+ const { operation, errorCode, error_code, code, kind: kind2, table } = event2;
216
+ if (typeof operation === "string")
217
+ operations.add(operation);
218
+ if (kind2 === "store" && typeof table === "string")
219
+ tables.add(table);
220
+ for (const value of [errorCode, error_code, code])
221
+ if (typeof value === "string")
222
+ codes.add(value);
223
+ if (finished)
224
+ return;
225
+ opened()[level](event2, message);
226
+ }, "noted");
227
+ const logger = { debug: noted("debug"), info: noted("info"), warn: noted("warn"), error: noted("error") };
228
+ return {
229
+ id: id4,
230
+ dir,
231
+ logger,
232
+ finish: /* @__PURE__ */ __name(async (status, extra = {}) => {
233
+ if (finished)
234
+ return;
235
+ finished = true;
236
+ const completedAt = now();
237
+ const final = {
238
+ ...metadata,
239
+ ...extra,
240
+ status,
241
+ completedAt: completedAt.toISOString(),
242
+ durationMs: completedAt.getTime() - startedAt.getTime(),
243
+ operations: [...operations].sort(),
244
+ codes: [...codes].sort(),
245
+ ...tables.size > 0 ? { tables: [...tables].sort() } : {}
246
+ };
247
+ if (file || status !== "success") {
248
+ opened();
249
+ writeRunFile(dir, final);
250
+ return;
251
+ }
252
+ try {
253
+ mkdirSync(join(dir, ".."), { recursive: true, mode: 448 });
254
+ appendIndex(join(dir, ".."), runFileOf(final));
255
+ } catch (error) {
256
+ options.onError?.(error);
257
+ }
258
+ }, "finish")
259
+ };
260
+ }, "startRun");
261
+ var refuseRealStateInTests = /* @__PURE__ */ __name((dir, env = process.env) => {
262
+ if (env.VITEST === void 0)
263
+ return;
264
+ let home;
265
+ try {
266
+ home = userInfo().homedir;
267
+ } catch {
268
+ return;
269
+ }
270
+ if (dir.startsWith(join(home, ".local", "share") + sep))
271
+ throw new Error(`a test opened a run in the real data folder: ${dir}`);
272
+ }, "refuseRealStateInTests");
273
+ var runtime = /* @__PURE__ */ __name(() => {
274
+ const bun = process.versions.bun;
275
+ return bun ? `bun ${bun}` : `node ${process.versions.node}`;
276
+ }, "runtime");
277
+ var newRunId = /* @__PURE__ */ __name((startedAt, command) => {
278
+ const stamp = startedAt.toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
279
+ const slug = command.replace(/[^a-z0-9]+/gi, "-").toLowerCase();
280
+ return `${stamp}-${slug}-${randomUUID().slice(0, 6)}`;
281
+ }, "newRunId");
282
+ var INDEX = "index.jsonl";
283
+ var appendIndex = /* @__PURE__ */ __name((dayDir, written) => {
284
+ appendFileSync(join(dayDir, INDEX), `${JSON.stringify(written)}
285
+ `, { mode: 384 });
286
+ }, "appendIndex");
287
+ var writeRunFile = /* @__PURE__ */ __name((dir, metadata) => {
288
+ const written = runFileOf(metadata);
289
+ writeSecurely(join(dir, "run.json"), `${JSON.stringify(written, null, 2)}
290
+ `, 384);
291
+ try {
292
+ appendIndex(join(dir, ".."), written);
293
+ } catch {
294
+ }
295
+ }, "writeRunFile");
296
+ var matchesListFilter = /* @__PURE__ */ __name((run2, filter) => (filter.runId === void 0 || run2.runId === filter.runId) && (filter.command === void 0 || run2.command === filter.command) && (filter.profile === void 0 || run2.profile === filter.profile) && (filter.status === void 0 || run2.status === filter.status) && (filter.errorCode === void 0 || run2.errorCode === filter.errorCode), "matchesListFilter");
297
+ var listRuns = /* @__PURE__ */ __name((runsDir, { since, atLeast = Number.POSITIVE_INFINITY, filter = {} } = {}) => {
298
+ const first = since === void 0 ? void 0 : day(new Date(since));
299
+ const runs = [];
300
+ for (const date of days(runsDir).sort().reverse()) {
301
+ if (first !== void 0 && date < first || runs.length >= atLeast)
302
+ break;
303
+ for (const metadata of runsOfDay(join(runsDir, date))) {
304
+ if (matchesListFilter(metadata, filter))
305
+ runs.push(metadata);
306
+ }
307
+ }
308
+ return runs;
309
+ }, "listRuns");
310
+ var indexedRuns = /* @__PURE__ */ __name((dayDir) => {
311
+ const latest = /* @__PURE__ */ new Map();
312
+ let raw = "";
313
+ try {
314
+ raw = readFileSync(join(dayDir, INDEX), "utf8");
315
+ } catch {
316
+ }
317
+ for (const line2 of raw.split("\n")) {
318
+ if (line2.trim() === "")
319
+ continue;
320
+ try {
321
+ const metadata = metadataOf(JSON.parse(line2));
322
+ if (typeof metadata.runId === "string")
323
+ latest.set(metadata.runId, metadata);
324
+ } catch {
325
+ }
326
+ }
327
+ return latest;
328
+ }, "indexedRuns");
329
+ var runsOfDay = /* @__PURE__ */ __name((dayDir) => {
330
+ const latest = indexedRuns(dayDir);
331
+ for (const entry of safeReaddir(dayDir)) {
332
+ if (entry === INDEX || entry.startsWith(".") || latest.has(entry))
333
+ continue;
334
+ const metadata = readRun(join(dayDir, entry));
335
+ if (metadata)
336
+ latest.set(metadata.runId, metadata);
337
+ }
338
+ return [...latest.values()].sort((a, b) => a.runId < b.runId ? 1 : a.runId > b.runId ? -1 : 0);
339
+ }, "runsOfDay");
340
+ var findRun = /* @__PURE__ */ __name((runsDir, id4) => {
341
+ const stamped = /^(\d{4})(\d{2})(\d{2})T/.exec(id4);
342
+ const likely = stamped ? [`${stamped[1]}-${stamped[2]}-${stamped[3]}`] : [];
343
+ const dates = [.../* @__PURE__ */ new Set([...likely, ...days(runsDir)])];
344
+ for (const date of dates) {
345
+ const dir = join(runsDir, date, id4);
346
+ const metadata = readRun(dir);
347
+ if (metadata)
348
+ return { dir, metadata };
349
+ }
350
+ for (const date of dates) {
351
+ const metadata = indexedRuns(join(runsDir, date)).get(id4);
352
+ if (metadata)
353
+ return { dir: join(runsDir, date, id4), metadata };
354
+ }
355
+ return void 0;
356
+ }, "findRun");
357
+ var readEvents = /* @__PURE__ */ __name((dir) => {
358
+ let raw;
359
+ try {
360
+ raw = readFileSync(join(dir, "events.jsonl"), "utf8");
361
+ } catch {
362
+ return [];
363
+ }
364
+ const events = [];
365
+ for (const line2 of raw.split("\n")) {
366
+ if (line2.trim() === "")
367
+ continue;
368
+ try {
369
+ const parsed = JSON.parse(line2);
370
+ if (parsed !== null && typeof parsed === "object")
371
+ events.push(eventOf(parsed));
372
+ } catch {
373
+ }
374
+ }
375
+ return events;
376
+ }, "readEvents");
377
+ var eventOf = /* @__PURE__ */ __name((line2) => {
378
+ const { attributes, time: time2, severity: severity2 } = line2;
379
+ if (attributes === null || typeof attributes !== "object")
380
+ return logAttributes(line2);
381
+ return { time: time2, severity: severity2, ...logAttributes(attributes) };
382
+ }, "eventOf");
383
+ var pruneRuns = /* @__PURE__ */ __name((runsDir, { keepDays, keepSuccessDays = keepDays, keepStoreDays = KEEP_STORE_RUNS_FOR_DAYS, maxBytes, now }) => {
384
+ const cutoff = day(new Date(now.getTime() - keepDays * DAY_MS));
385
+ const before = /* @__PURE__ */ __name((days2) => day(new Date(now.getTime() - Math.min(days2, keepDays) * DAY_MS)), "before");
386
+ const successCutoff = before(keepSuccessDays);
387
+ const storeCutoff = before(keepStoreDays);
388
+ const keptFor = /* @__PURE__ */ __name((metadata) => metadata.keptBecauseStore ? keepStoreDays : metadata.operations?.includes(STORE_WRITE) ? Math.max(keepSuccessDays, keepStoreDays) : keepSuccessDays, "keptFor");
389
+ let removed = 0;
390
+ for (const date of days(runsDir)) {
391
+ if (date >= cutoff) {
392
+ if (date < storeCutoff)
393
+ dropSuccesses(join(runsDir, date), STORE_RUNS_DROPPED, (metadata) => keptFor(metadata) <= keepStoreDays);
394
+ if (date < successCutoff)
395
+ dropSuccesses(join(runsDir, date), SUCCESSES_DROPPED, (metadata) => keptFor(metadata) <= keepSuccessDays);
396
+ continue;
397
+ }
398
+ try {
399
+ rmSync(join(runsDir, date), { recursive: true, force: true });
400
+ removed += 1;
401
+ } catch {
402
+ }
403
+ }
404
+ if (maxBytes !== void 0)
405
+ removed += fitSize(runsDir, maxBytes, now);
406
+ return removed;
407
+ }, "pruneRuns");
408
+ var DAY_MS = 24 * 60 * 60 * 1e3;
409
+ var STORE_WRITE = "store.write";
410
+ var SUCCESSES_DROPPED = ".successes-dropped";
411
+ var STORE_RUNS_DROPPED = ".store-runs-dropped";
412
+ var SIZE_CHECKED = ".size-checked";
413
+ var dropSuccesses = /* @__PURE__ */ __name((dayDir, marker = SUCCESSES_DROPPED, drops = () => true) => {
414
+ const done = join(dayDir, marker);
415
+ try {
416
+ statSync(done);
417
+ return;
418
+ } catch {
419
+ }
420
+ const dropped2 = /* @__PURE__ */ __name((metadata) => metadata?.status === "success" && drops(metadata), "dropped");
421
+ try {
422
+ const kept = [];
423
+ for (const [id4, metadata] of indexedRuns(dayDir)) {
424
+ if (dropped2(metadata))
425
+ rmSync(join(dayDir, id4), { recursive: true, force: true });
426
+ else
427
+ kept.push(JSON.stringify(runFileOf(metadata)));
428
+ }
429
+ for (const entry of safeReaddir(dayDir)) {
430
+ if (entry === INDEX || entry.startsWith("."))
431
+ continue;
432
+ if (dropped2(readRun(join(dayDir, entry))))
433
+ rmSync(join(dayDir, entry), { recursive: true, force: true });
434
+ }
435
+ writeSecurely(join(dayDir, INDEX), kept.map((line2) => `${line2}
436
+ `).join(""), 384);
437
+ writeFileSync(done, "", { mode: 384 });
438
+ } catch {
439
+ }
440
+ }, "dropSuccesses");
441
+ var sizeOf = /* @__PURE__ */ __name((path) => {
442
+ let total = 0;
443
+ for (const entry of safeReaddir(path)) {
444
+ const full = join(path, entry);
445
+ try {
446
+ const stat = statSync(full);
447
+ total += stat.isDirectory() ? sizeOf(full) : stat.size;
448
+ } catch {
449
+ }
450
+ }
451
+ return total;
452
+ }, "sizeOf");
453
+ var fitSize = /* @__PURE__ */ __name((runsDir, maxBytes, now) => {
454
+ const stamp = join(runsDir, SIZE_CHECKED);
455
+ const today = day(now);
456
+ try {
457
+ if (readFileSync(stamp, "utf8").trim() === today)
458
+ return 0;
459
+ } catch {
460
+ }
461
+ const dates = days(runsDir).sort();
462
+ const sizes = new Map(dates.map((date) => [date, sizeOf(join(runsDir, date))]));
463
+ let total = [...sizes.values()].reduce((sum, size) => sum + size, 0);
464
+ let removed = 0;
465
+ for (const date of dates) {
466
+ if (total <= maxBytes || date === today)
467
+ break;
468
+ dropSuccesses(join(runsDir, date));
469
+ const after = sizeOf(join(runsDir, date));
470
+ total -= (sizes.get(date) ?? 0) - after;
471
+ sizes.set(date, after);
472
+ }
473
+ for (const date of dates) {
474
+ if (total <= maxBytes || date === today)
475
+ break;
476
+ try {
477
+ rmSync(join(runsDir, date), { recursive: true, force: true });
478
+ total -= sizes.get(date) ?? 0;
479
+ removed += 1;
480
+ } catch {
481
+ }
482
+ }
483
+ try {
484
+ mkdirSync(runsDir, { recursive: true, mode: 448 });
485
+ writeFileSync(stamp, today, { mode: 384 });
486
+ } catch {
487
+ }
488
+ return removed;
489
+ }, "fitSize");
490
+ var day = /* @__PURE__ */ __name((date) => date.toISOString().slice(0, 10), "day");
491
+ var days = /* @__PURE__ */ __name((runsDir) => safeReaddir(runsDir).filter((entry) => /^\d{4}-\d{2}-\d{2}$/.test(entry)), "days");
492
+ var readRun = /* @__PURE__ */ __name((dir) => {
493
+ try {
494
+ return metadataOf(JSON.parse(readFileSync(join(dir, "run.json"), "utf8")));
495
+ } catch {
496
+ return void 0;
497
+ }
498
+ }, "readRun");
499
+ var safeReaddir = /* @__PURE__ */ __name((dir) => {
500
+ try {
501
+ return readdirSync(dir);
502
+ } catch {
503
+ return [];
504
+ }
505
+ }, "safeReaddir");
506
+ var runFileOf = /* @__PURE__ */ __name(({ partial, ...metadata }) => ({
507
+ ...logAttributes(metadata),
508
+ ...partial ? { partial: { ...logAttributes(partial), failures: partial.failures.map((failure) => logAttributes(failure)) } } : {}
509
+ }), "runFileOf");
510
+ var metadataOf = /* @__PURE__ */ __name((parsed) => {
511
+ const { partial, ...metadata } = fromLogAttributes(parsed);
512
+ if (partial === null || typeof partial !== "object")
513
+ return metadata;
514
+ const { failures, ...rest } = fromLogAttributes(partial);
515
+ return {
516
+ ...metadata,
517
+ partial: {
518
+ ...rest,
519
+ failures: Array.isArray(failures) ? failures.map((failure) => fromLogAttributes(failure)) : []
520
+ }
521
+ };
522
+ }, "metadataOf");
523
+
524
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/runs/scope.js
525
+ var scopes = new AsyncLocalStorage();
526
+ var processScope;
527
+ var currentRun = /* @__PURE__ */ __name(() => {
528
+ const scope2 = scopes.getStore();
529
+ if (scope2)
530
+ return scope2;
531
+ processScope ??= {
532
+ runId: newRunId(/* @__PURE__ */ new Date(), "process"),
533
+ command: "",
534
+ startedAt: Date.now(),
535
+ ...traceOf(process.env)
536
+ };
537
+ return processScope;
538
+ }, "currentRun");
539
+ var inRun = /* @__PURE__ */ __name((scope2, body) => scopes.run(scope2, body), "inRun");
540
+ var runEvent = /* @__PURE__ */ __name((event2) => scopes.getStore()?.events?.(event2), "runEvent");
541
+ var typedCommand = /* @__PURE__ */ __name((tool, words2, profile = currentRun().profile) => [tool, profile, words2].filter((part) => part !== void 0 && part !== "").join(" "), "typedCommand");
542
+ var useAsProcessRun = /* @__PURE__ */ __name((scope2) => {
543
+ processScope = scope2;
544
+ }, "useAsProcessRun");
545
+ var processRun = /* @__PURE__ */ __name(() => processScope, "processRun");
546
+ var enclosingTraceId = /* @__PURE__ */ __name(() => scopes.getStore()?.traceId, "enclosingTraceId");
547
+ var traceOf = /* @__PURE__ */ __name((env) => {
548
+ const traceId = traceIdOf(env.TRACEPARENT);
549
+ return traceId === void 0 ? {} : { traceId };
550
+ }, "traceOf");
551
+ var childTrace = /* @__PURE__ */ __name(() => {
552
+ const hex = /* @__PURE__ */ __name((bytes) => randomBytes(bytes).toString("hex"), "hex");
553
+ const traceId = hex(16);
554
+ return { traceId, traceparent: `00-${traceId}-${hex(8)}-01` };
555
+ }, "childTrace");
556
+ var attempts = new AsyncLocalStorage();
557
+ var withAttempt = /* @__PURE__ */ __name((attempt, work) => attempts.run(attempt, work), "withAttempt");
558
+ var currentAttempt = /* @__PURE__ */ __name(() => attempts.getStore(), "currentAttempt");
559
+
560
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/domain/money.js
55
561
  var CURRENCY_SCALES = {
56
562
  AED: 2,
57
563
  AMD: 2,
@@ -145,7 +651,7 @@ var quantityOf = /* @__PURE__ */ __name((text6) => {
145
651
  }, "quantityOf");
146
652
  var lineUnits = /* @__PURE__ */ __name((thousandths, unitPrice) => Number((thousandths * BigInt(unitPrice) + 500n) / 1000n), "lineUnits");
147
653
 
148
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/finance.js
654
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/domain/finance.js
149
655
  var INVOICE_DIRECTIONS = ["receivable", "payable"];
150
656
  var INVOICE_STATUSES = ["draft", "issued", "partly_paid", "paid", "void"];
151
657
  var MONEY_DIRECTIONS = ["in", "out"];
@@ -174,7 +680,7 @@ var paymentLine = /* @__PURE__ */ __name((payment) => {
174
680
  var invoiceTitle = /* @__PURE__ */ __name((invoice) => `Invoice ${invoiceLine(invoice)}`, "invoiceTitle");
175
681
  var paymentEntryTitle = /* @__PURE__ */ __name((payment) => `Payment \xB7 ${paymentLine(payment)}`, "paymentEntryTitle");
176
682
 
177
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/business.js
683
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/domain/business.js
178
684
  var CATALOG_KINDS = ["product", "service"];
179
685
  var BUSINESS_KINDS = ["invoice", "payment", "order", "contract", "subscription", "product", "wallet"];
180
686
  var CONTRACT_KINDS = ["sale", "purchase", "service", "lease", "employment", "nda", "license", "other"];
@@ -202,14 +708,15 @@ var subscriptionLine = /* @__PURE__ */ __name((subscription) => `${subscription.
202
708
  var walletLine = /* @__PURE__ */ __name((wallet) => `${wallet.name} \xB7 ${wallet.kind}, ${wallet.currency}${wallet.numberHint === null ? "" : `, \u2026${wallet.numberHint}`}` + notes(wallet.closed ? "closed" : null), "walletLine");
203
709
  var transactionLine = /* @__PURE__ */ __name((transaction) => `${moneyLabel(transaction.amount, transaction.currency)} ${transaction.direction}${transaction.label === null ? "" : ` \xB7 ${transaction.label}`}, ${dayMonth(transaction.date)}` + notes(transaction.status === "pending" ? "pending" : null, pending(transaction.review)), "transactionLine");
204
710
 
205
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/store/marks.js
206
- import { readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
711
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/store/marks.js
712
+ import { readFileSync as readFileSync2, rmSync as rmSync2, statSync as statSync2, writeFileSync as writeFileSync2 } from "node:fs";
207
713
  var damageMarkPath = /* @__PURE__ */ __name((store) => `${store}.damaged.json`, "damageMarkPath");
208
714
  var healthMarkPath = /* @__PURE__ */ __name((store) => `${store}.health.json`, "healthMarkPath");
209
- var inodeOf = /* @__PURE__ */ __name((store) => statSync(store, { throwIfNoEntry: false })?.ino, "inodeOf");
715
+ var journalMarkPath = /* @__PURE__ */ __name((store) => `${store}.journal.json`, "journalMarkPath");
716
+ var inodeOf = /* @__PURE__ */ __name((store) => statSync2(store, { throwIfNoEntry: false })?.ino, "inodeOf");
210
717
  var readJson = /* @__PURE__ */ __name((path) => {
211
718
  try {
212
- return JSON.parse(readFileSync(path, "utf8"));
719
+ return JSON.parse(readFileSync2(path, "utf8"));
213
720
  } catch (error) {
214
721
  if (error.code === "ENOENT")
215
722
  return null;
@@ -241,7 +748,7 @@ var markStoreDamaged = /* @__PURE__ */ __name((error, { store, command, version,
241
748
  inode
242
749
  };
243
750
  try {
244
- writeFileSync(damageMarkPath(store), `${JSON.stringify(mark, null, 2)}
751
+ writeFileSync2(damageMarkPath(store), `${JSON.stringify(mark, null, 2)}
245
752
  `, { flag: "wx", mode: 384 });
246
753
  return true;
247
754
  } catch {
@@ -264,13 +771,30 @@ var readDamageMark = /* @__PURE__ */ __name((store) => {
264
771
  }
265
772
  return mark;
266
773
  }, "readDamageMark");
267
- var clearDamageMark = /* @__PURE__ */ __name((store) => rmSync(damageMarkPath(store), { force: true }), "clearDamageMark");
774
+ var clearDamageMark = /* @__PURE__ */ __name((store) => rmSync2(damageMarkPath(store), { force: true }), "clearDamageMark");
268
775
  var refuseDamagedStore = /* @__PURE__ */ __name((store, cli) => {
269
776
  const mark = readDamageMark(store);
270
777
  if (!mark)
271
778
  return;
272
779
  throw new CliError("configuration_error", `the store was found damaged at ${mark.at} by \`${mark.command}\` (${mark.error}), so nothing writes to it until it is recovered; \`${cli ?? "<cli>"} store recover\` says what is damaged and what to do`, { reason: "store.damaged" });
273
780
  }, "refuseDamagedStore");
781
+ var markJournalLost = /* @__PURE__ */ __name((store, { seen, command, now = Date.now }) => {
782
+ if (ownerStoreInTests(store))
783
+ return;
784
+ const mark = { at: new Date(now()).toISOString(), command, seen };
785
+ try {
786
+ writeFileSync2(journalMarkPath(store), `${JSON.stringify(mark, null, 2)}
787
+ `, { flag: "wx", mode: 384 });
788
+ } catch {
789
+ }
790
+ }, "markJournalLost");
791
+ var readJournalMark = /* @__PURE__ */ __name((store) => {
792
+ try {
793
+ return readJson(journalMarkPath(store));
794
+ } catch {
795
+ return null;
796
+ }
797
+ }, "readJournalMark");
274
798
  var readHealthMark = /* @__PURE__ */ __name((store) => {
275
799
  try {
276
800
  return readJson(healthMarkPath(store));
@@ -294,16 +818,97 @@ var recordDeepCheck = /* @__PURE__ */ __name((store, health, { cli, version, sch
294
818
  };
295
819
  const cleared = health.ok ? readDamageMark(store) : null;
296
820
  try {
297
- writeFileSync(healthMarkPath(store), `${JSON.stringify(mark, null, 2)}
821
+ writeFileSync2(healthMarkPath(store), `${JSON.stringify(mark, null, 2)}
298
822
  `, { mode: 384 });
299
823
  } catch {
300
824
  }
301
825
  if (cleared)
302
826
  clearDamageMark(store);
827
+ if (health.ok)
828
+ rmSync2(journalMarkPath(store), { force: true });
303
829
  return { previous, cleared };
304
830
  }, "recordDeepCheck");
305
831
 
306
- // node_modules/.pnpm/@wirecat+cli-base@0.87.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/types.js
832
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/fields.js
833
+ var FIELD_TYPES = ["kw", "txt", "enum", "num", "time", "bool", "ref"];
834
+ var OPERATORS_BY_TYPE = {
835
+ kw: ["term", "phrase", "wildcard"],
836
+ txt: ["term", "phrase", "wildcard"],
837
+ enum: ["term"],
838
+ num: ["term", "range"],
839
+ time: ["term", "range"],
840
+ bool: ["term"],
841
+ ref: ["term", "phrase"]
842
+ };
843
+ var QUERY_BACKENDS = ["sql", "native"];
844
+ var unwrap = /* @__PURE__ */ __name((schema) => schema.wrapped ? unwrap(schema.wrapped) : schema, "unwrap");
845
+ var REFERENCE_SOURCE = reference.pipe[1].requirement.source;
846
+ var typeOf = /* @__PURE__ */ __name((schema) => {
847
+ const plain = unwrap(schema);
848
+ const actions = plain.pipe ?? [];
849
+ switch (plain.type) {
850
+ case "picklist":
851
+ return { type: "enum", values: (plain.options ?? []).map(String) };
852
+ case "number":
853
+ return { type: "num" };
854
+ case "boolean":
855
+ return { type: "bool" };
856
+ case "string":
857
+ if (actions.some((action) => action.type === "iso_timestamp"))
858
+ return { type: "time" };
859
+ if (actions.some((action) => action.requirement instanceof RegExp && action.requirement.source === REFERENCE_SOURCE))
860
+ return { type: "ref" };
861
+ return { type: "kw" };
862
+ case "array":
863
+ return plain.item ? typeOf(plain.item) : void 0;
864
+ default:
865
+ return void 0;
866
+ }
867
+ }, "typeOf");
868
+ var exampleOf = /* @__PURE__ */ __name((name, type, values) => ({
869
+ kw: `${name}:abc`,
870
+ txt: `${name}:word*`,
871
+ enum: `${name}:${values?.[0] ?? "x"}`,
872
+ num: `${name}>0`,
873
+ time: `${name}>=7d`,
874
+ bool: `${name}:true`,
875
+ ref: `${name}:"note:42"`
876
+ })[type], "exampleOf");
877
+ var queryFieldsOf = /* @__PURE__ */ __name((schema, annotations = {}) => {
878
+ const entries = unwrap(schema).entries ?? {};
879
+ const excluded = new Set(annotations.exclude ?? []);
880
+ const words2 = new Set(annotations.text ?? []);
881
+ const native = new Set(annotations.native ?? []);
882
+ const negatable = new Set(annotations.negatable ?? []);
883
+ const finish = /* @__PURE__ */ __name((field) => ({
884
+ ...field,
885
+ operators: OPERATORS_BY_TYPE[field.type],
886
+ example: annotations.examples?.[field.name] ?? field.example ?? exampleOf(field.name, field.type, field.values),
887
+ ...native.has(field.name) ? { native: true } : {},
888
+ ...negatable.has(field.name) ? { negatable: true } : {},
889
+ ...annotations.validate?.[field.name] ? { validate: annotations.validate[field.name] } : {}
890
+ }), "finish");
891
+ const own = Object.entries(entries).flatMap(([name, entry]) => {
892
+ if (excluded.has(name))
893
+ return [];
894
+ const found = typeOf(entry);
895
+ if (!found)
896
+ return [];
897
+ return [finish({ name, ...found, ...words2.has(name) && found.type === "kw" ? { type: "txt" } : {} })];
898
+ });
899
+ const relations = Object.entries(annotations.relations ?? {}).map(([name, relation]) => finish({ name, ...relation }));
900
+ const states = annotations.states ? [
901
+ finish({
902
+ name: "is",
903
+ type: "enum",
904
+ values: Object.keys(annotations.states),
905
+ relation: Object.entries(annotations.states).map(([state, meaning]) => `${state}: ${meaning}`).join("; ")
906
+ })
907
+ ] : [];
908
+ return [...own, ...relations, ...states];
909
+ }, "queryFieldsOf");
910
+
911
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/types.js
307
912
  var QUERY_LIMITS = {
308
913
  bytes: 8192,
309
914
  depth: 32,
@@ -347,7 +952,7 @@ function queryError(reason, span, alternative, context3 = {}, details = {}) {
347
952
  __name(queryError, "queryError");
348
953
  var walkQuery = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => walkQuery(node2)), "walkQuery");
349
954
 
350
- // node_modules/.pnpm/@wirecat+cli-base@0.87.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/dates.js
955
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/dates.js
351
956
  var timezoneOf = /* @__PURE__ */ __name((given) => {
352
957
  const zone = given ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC";
353
958
  try {
@@ -360,11 +965,11 @@ var timezoneOf = /* @__PURE__ */ __name((given) => {
360
965
  var calendar = /* @__PURE__ */ __name((value, span) => {
361
966
  if (!/^\d{4}-\d{2}-\d{2}$/u.test(value))
362
967
  queryError("query.invalid-date", span, "use an ISO date or a quoted timestamp with offset");
363
- const year = Number(value.slice(0, 4)), month = Number(value.slice(5, 7)), day = Number(value.slice(8, 10));
968
+ const year = Number(value.slice(0, 4)), month = Number(value.slice(5, 7)), day2 = Number(value.slice(8, 10));
364
969
  const date = /* @__PURE__ */ new Date(0);
365
- date.setUTCFullYear(year, month - 1, day);
970
+ date.setUTCFullYear(year, month - 1, day2);
366
971
  date.setUTCHours(0, 0, 0, 0);
367
- if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day)
972
+ if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day2)
368
973
  queryError("query.invalid-date", span);
369
974
  return date;
370
975
  }, "calendar");
@@ -381,9 +986,9 @@ var dayBoundary = /* @__PURE__ */ __name((value, zone, next, span) => {
381
986
  era: "short"
382
987
  });
383
988
  const dayAt = /* @__PURE__ */ __name((time2) => {
384
- const parts = formatter.formatToParts(time2);
385
- const value2 = /* @__PURE__ */ __name((name) => Number(parts.find((p) => p.type === name)?.value), "value");
386
- const year = parts.find((p) => p.type === "era")?.value === "BC" ? 1 - value2("year") : value2("year");
989
+ const parts2 = formatter.formatToParts(time2);
990
+ const value2 = /* @__PURE__ */ __name((name) => Number(parts2.find((p) => p.type === name)?.value), "value");
991
+ const year = parts2.find((p) => p.type === "era")?.value === "BC" ? 1 - value2("year") : value2("year");
387
992
  return year * 1e4 + value2("month") * 100 + value2("day");
388
993
  }, "dayAt");
389
994
  let lo = date.getTime() - 2 * 864e5, hi = date.getTime() + 2 * 864e5;
@@ -400,12 +1005,12 @@ var dayBoundary = /* @__PURE__ */ __name((value, zone, next, span) => {
400
1005
  }, "dayBoundary");
401
1006
  var WALL = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/u;
402
1007
  var wallTime = /* @__PURE__ */ __name((value, zone, span) => {
403
- const [, year, month, day, hour, minute, second = "0", fraction = "0"] = WALL.exec(value) ?? [];
1008
+ const [, year, month, day2, hour, minute, second = "0", fraction = "0"] = WALL.exec(value) ?? [];
404
1009
  if (year === void 0)
405
1010
  queryError("query.invalid-date", span, "use YYYY-MM-DDTHH:mm, with optional seconds");
406
- const wanted = Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second), Number(fraction.padEnd(3, "0")));
1011
+ const wanted = Date.UTC(Number(year), Number(month) - 1, Number(day2), Number(hour), Number(minute), Number(second), Number(fraction.padEnd(3, "0")));
407
1012
  const check = new Date(wanted);
408
- if (check.getUTCDate() !== Number(day) || check.getUTCHours() !== Number(hour) || check.getUTCMinutes() !== Number(minute) || check.getUTCSeconds() !== Number(second))
1013
+ if (check.getUTCDate() !== Number(day2) || check.getUTCHours() !== Number(hour) || check.getUTCMinutes() !== Number(minute) || check.getUTCSeconds() !== Number(second))
409
1014
  queryError("query.invalid-date", span);
410
1015
  const formatter = new Intl.DateTimeFormat("en-CA", {
411
1016
  timeZone: zone,
@@ -418,8 +1023,8 @@ var wallTime = /* @__PURE__ */ __name((value, zone, span) => {
418
1023
  hourCycle: "h23"
419
1024
  });
420
1025
  const shown = /* @__PURE__ */ __name((instant) => {
421
- const parts = Object.fromEntries(formatter.formatToParts(instant).map((part) => [part.type, Number(part.value)]));
422
- return Date.UTC(parts.year ?? 0, (parts.month ?? 1) - 1, parts.day, parts.hour, parts.minute, parts.second) + (instant % 1e3 + 1e3) % 1e3;
1026
+ const parts2 = Object.fromEntries(formatter.formatToParts(instant).map((part) => [part.type, Number(part.value)]));
1027
+ return Date.UTC(parts2.year ?? 0, (parts2.month ?? 1) - 1, parts2.day, parts2.hour, parts2.minute, parts2.second) + (instant % 1e3 + 1e3) % 1e3;
423
1028
  }, "shown");
424
1029
  const found = /* @__PURE__ */ new Set();
425
1030
  for (const probe of [wanted - 864e5, wanted, wanted + 864e5]) {
@@ -492,166 +1097,50 @@ var dateRange = /* @__PURE__ */ __name((lower, upper, lowerInclusive, upperInclu
492
1097
  };
493
1098
  }, "dateRange");
494
1099
 
495
- // node_modules/.pnpm/@wirecat+cli-base@0.87.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/fields.js
496
- var FIELD_TYPES = ["kw", "txt", "enum", "num", "time", "bool", "ref"];
497
- var OPERATORS_BY_TYPE = {
498
- kw: ["term", "phrase", "wildcard"],
499
- txt: ["term", "phrase", "wildcard"],
500
- enum: ["term"],
501
- num: ["term", "range"],
502
- time: ["term", "range"],
503
- bool: ["term"],
504
- ref: ["term", "phrase"]
505
- };
506
- var QUERY_BACKENDS = ["sql", "native"];
507
- var unwrap = /* @__PURE__ */ __name((schema) => schema.wrapped ? unwrap(schema.wrapped) : schema, "unwrap");
508
- var REFERENCE_SOURCE = reference.pipe[1].requirement.source;
509
- var typeOf = /* @__PURE__ */ __name((schema) => {
510
- const plain = unwrap(schema);
511
- const actions = plain.pipe ?? [];
512
- switch (plain.type) {
513
- case "picklist":
514
- return { type: "enum", values: (plain.options ?? []).map(String) };
515
- case "number":
516
- return { type: "num" };
517
- case "boolean":
518
- return { type: "bool" };
519
- case "string":
520
- if (actions.some((action) => action.type === "iso_timestamp"))
521
- return { type: "time" };
522
- if (actions.some((action) => action.requirement instanceof RegExp && action.requirement.source === REFERENCE_SOURCE))
523
- return { type: "ref" };
524
- return { type: "kw" };
525
- case "array":
526
- return plain.item ? typeOf(plain.item) : void 0;
1100
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/validate.js
1101
+ var inContext = /* @__PURE__ */ __name((context3, run2) => {
1102
+ try {
1103
+ run2();
1104
+ } catch (failure) {
1105
+ if (!isCliError(failure) || typeof failure.details.reason !== "string" || failure.details.span === void 0)
1106
+ throw failure;
1107
+ const { reason, span, alternative } = failure.details;
1108
+ queryError(reason, span, alternative, context3);
1109
+ }
1110
+ }, "inContext");
1111
+ var bounds = /* @__PURE__ */ __name((node) => node.operator === "range" ? [node.value, node.upper ?? "*"].filter((bound) => bound !== "*") : [node.value], "bounds");
1112
+ var checkValue = /* @__PURE__ */ __name((field, node, options) => {
1113
+ const fail3 = /* @__PURE__ */ __name((reason, alternative) => queryError(reason, node.span, alternative, options), "fail");
1114
+ if (node.value === "" && field.type !== "txt")
1115
+ fail3("query.missing-value");
1116
+ if (node.operator === "wildcard")
1117
+ return;
1118
+ switch (field.type) {
1119
+ case "enum":
1120
+ if (!field.values?.includes(node.value.toLowerCase()))
1121
+ fail3("query.unknown-value", `${field.name} takes ${field.values?.join(", ")}`);
1122
+ return;
1123
+ case "bool":
1124
+ if (!["true", "false"].includes(node.value.toLowerCase()))
1125
+ fail3("query.unknown-value", `${field.name} takes true, false`);
1126
+ return;
1127
+ case "num":
1128
+ for (const bound of bounds(node))
1129
+ if (!Number.isFinite(Number(bound)) || bound.trim() === "")
1130
+ fail3("query.invalid-number", `${field.name} takes a number`);
1131
+ return;
1132
+ case "time":
1133
+ inContext(options, () => {
1134
+ for (const bound of bounds(node))
1135
+ dateEndpoint(bound, options.zone ?? "UTC", "lower", true, node.span);
1136
+ });
1137
+ return;
527
1138
  default:
528
- return void 0;
529
- }
530
- }, "typeOf");
531
- var exampleOf = /* @__PURE__ */ __name((name, type, values) => ({
532
- kw: `${name}:abc`,
533
- txt: `${name}:word*`,
534
- enum: `${name}:${values?.[0] ?? "x"}`,
535
- num: `${name}>0`,
536
- time: `${name}>=7d`,
537
- bool: `${name}:true`,
538
- ref: `${name}:"note:42"`
539
- })[type], "exampleOf");
540
- var queryFieldsOf = /* @__PURE__ */ __name((schema, annotations = {}) => {
541
- const entries = unwrap(schema).entries ?? {};
542
- const excluded = new Set(annotations.exclude ?? []);
543
- const words2 = new Set(annotations.text ?? []);
544
- const native = new Set(annotations.native ?? []);
545
- const negatable = new Set(annotations.negatable ?? []);
546
- const finish = /* @__PURE__ */ __name((field) => ({
547
- ...field,
548
- operators: OPERATORS_BY_TYPE[field.type],
549
- example: annotations.examples?.[field.name] ?? field.example ?? exampleOf(field.name, field.type, field.values),
550
- ...native.has(field.name) ? { native: true } : {},
551
- ...negatable.has(field.name) ? { negatable: true } : {},
552
- ...annotations.validate?.[field.name] ? { validate: annotations.validate[field.name] } : {}
553
- }), "finish");
554
- const own = Object.entries(entries).flatMap(([name, entry]) => {
555
- if (excluded.has(name))
556
- return [];
557
- const found = typeOf(entry);
558
- if (!found)
559
- return [];
560
- return [finish({ name, ...found, ...words2.has(name) && found.type === "kw" ? { type: "txt" } : {} })];
561
- });
562
- const relations = Object.entries(annotations.relations ?? {}).map(([name, relation]) => finish({ name, ...relation }));
563
- const states = annotations.states ? [
564
- finish({
565
- name: "is",
566
- type: "enum",
567
- values: Object.keys(annotations.states),
568
- relation: Object.entries(annotations.states).map(([state, meaning]) => `${state}: ${meaning}`).join("; ")
569
- })
570
- ] : [];
571
- return [...own, ...relations, ...states];
572
- }, "queryFieldsOf");
573
-
574
- // node_modules/.pnpm/@wirecat+cli-base@0.87.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/help.js
575
- var shownOf = /* @__PURE__ */ __name((registry) => registry.backend === "native" ? registry.fields.filter((field) => field.native) : registry.fields, "shownOf");
576
- var leftOut = /* @__PURE__ */ __name((fields) => fields.filter((field) => field.negatable).map((field) => field.name), "leftOut");
577
- var has = /* @__PURE__ */ __name((fields, operator) => fields.some((field) => field.operators.includes(operator)), "has");
578
- var syntaxOf = /* @__PURE__ */ __name((shown, backend) => [
579
- "field:value",
580
- ...has(shown, "phrase") ? ['"a phrase"'] : [],
581
- ...has(shown, "wildcard") ? ["word*"] : [],
582
- ...backend === "native" ? ["terms joined by AND"] : ["AND OR NOT", "( )"],
583
- ...has(shown, "range") ? ["[a TO b] \xB7 > >= < <="] : []
584
- ].join(" \xB7 "), "syntaxOf");
585
- var kindOf = /* @__PURE__ */ __name((field) => field.values ? `${field.type}: ${field.values.join("|")}` : `${field.type}: ${field.operators.join(", ")}`, "kindOf");
586
- var fieldsHelp = /* @__PURE__ */ __name((registry, guide) => {
587
- const shown = shownOf(registry);
588
- const negatable = leftOut(shown);
589
- const rows = shown.map((field) => [field.name, kindOf(field), field.example]);
590
- const widths = [0, 1].map((at) => Math.max(...rows.map((row) => (row[at] ?? "").length)));
591
- return [
592
- "Fields:",
593
- ...rows.map(([name = "", kind = "", example = ""]) => ` ${name.padEnd(widths[0] ?? 0)} ${kind.padEnd(widths[1] ?? 0)} ${example}`.trimEnd()),
594
- ...registry.defaults && registry.defaults.length > 0 ? [`Defaults: ${registry.defaults.join(" ")} \u2014 name the field to change it`] : [],
595
- ...negatable.length > 0 ? [`Leave out: -${negatable[0]}:value or NOT ${negatable[0]}:value, for ${negatable.join(", ")}`] : [],
596
- `Syntax: ${syntaxOf(shown, registry.backend)}`,
597
- ...guide ? [`Guide: ${guide}`] : []
598
- ].join("\n");
599
- }, "fieldsHelp");
600
- var queryDescription = /* @__PURE__ */ __name((registry) => {
601
- const shown = shownOf(registry);
602
- if (shown.length === 0)
603
- return "field:value terms; this list filters by none yet, so any term is refused";
604
- const negatable = leftOut(shown);
605
- const terms = registry.backend === "native" ? `field:value terms joined by AND that narrow the list${negatable.length > 0 ? `; -field:value or NOT field:value leaves out what matches, for ${negatable.join(", ")} only` : ""}` : `field:value terms that narrow the list (Lucene: AND OR NOT, -field:value${has(shown, "range") ? ", [a TO b], > <" : ""})`;
606
- const fields = shown.map((field) => field.values ? `${field.name} (${field.values.join("|")})` : field.name);
607
- const defaults = registry.defaults?.length ? `; unless named: ${registry.defaults.join(" ")}` : "";
608
- return `${terms}; fields: ${fields.join(", ")}; e.g. ${shown[0]?.example ?? ""}${defaults}`;
609
- }, "queryDescription");
610
-
611
- // node_modules/.pnpm/@wirecat+cli-base@0.87.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/validate.js
612
- var inContext = /* @__PURE__ */ __name((context3, run2) => {
613
- try {
614
- run2();
615
- } catch (failure) {
616
- if (!isCliError(failure) || typeof failure.details.reason !== "string" || failure.details.span === void 0)
617
- throw failure;
618
- const { reason, span, alternative } = failure.details;
619
- queryError(reason, span, alternative, context3);
620
- }
621
- }, "inContext");
622
- var bounds = /* @__PURE__ */ __name((node) => node.operator === "range" ? [node.value, node.upper ?? "*"].filter((bound) => bound !== "*") : [node.value], "bounds");
623
- var checkValue = /* @__PURE__ */ __name((field, node, options) => {
624
- const fail = /* @__PURE__ */ __name((reason, alternative) => queryError(reason, node.span, alternative, options), "fail");
625
- if (node.value === "" && field.type !== "txt")
626
- fail("query.missing-value");
627
- if (node.operator === "wildcard")
628
- return;
629
- switch (field.type) {
630
- case "enum":
631
- if (!field.values?.includes(node.value.toLowerCase()))
632
- fail("query.unknown-value", `${field.name} takes ${field.values?.join(", ")}`);
633
- return;
634
- case "bool":
635
- if (!["true", "false"].includes(node.value.toLowerCase()))
636
- fail("query.unknown-value", `${field.name} takes true, false`);
637
- return;
638
- case "num":
639
- for (const bound of bounds(node))
640
- if (!Number.isFinite(Number(bound)) || bound.trim() === "")
641
- fail("query.invalid-number", `${field.name} takes a number`);
642
- return;
643
- case "time":
644
- inContext(options, () => {
645
- for (const bound of bounds(node))
646
- dateEndpoint(bound, options.zone ?? "UTC", "lower", true, node.span);
647
- });
648
- return;
649
- default:
650
- return;
1139
+ return;
651
1140
  }
652
1141
  }, "checkValue");
653
- var validateQuery = /* @__PURE__ */ __name((ast, registry, options = {}) => {
654
- const byName = new Map(registry.fields.map((field) => [field.name, field]));
1142
+ var validateQuery = /* @__PURE__ */ __name((ast, registry3, options = {}) => {
1143
+ const byName = new Map(registry3.fields.map((field) => [field.name, field]));
655
1144
  const visit = /* @__PURE__ */ __name((node, required) => {
656
1145
  if (node.kind === "boolean") {
657
1146
  for (const clause of node.clauses)
@@ -661,11 +1150,11 @@ var validateQuery = /* @__PURE__ */ __name((ast, registry, options = {}) => {
661
1150
  const field = byName.get(node.field);
662
1151
  if (!field)
663
1152
  queryError("query.unknown-field", node.span, `no field "${node.field}"`, options, {
664
- fields: registry.fields.map((one) => one.name)
1153
+ fields: registry3.fields.map((one) => one.name)
665
1154
  });
666
- if (registry.backend === "native" && !field.native)
1155
+ if (registry3.backend === "native" && !field.native)
667
1156
  queryError("query.unsupported-field", node.span, `the source cannot filter by ${field.name}`, options, {
668
- supported: registry.fields.filter((one) => one.native).map((one) => one.name)
1157
+ supported: registry3.fields.filter((one) => one.native).map((one) => one.name)
669
1158
  });
670
1159
  const presence = node.operator === "wildcard" && node.value === "*";
671
1160
  if (!presence && !field.operators.includes(node.operator))
@@ -683,7 +1172,7 @@ var validateQuery = /* @__PURE__ */ __name((ast, registry, options = {}) => {
683
1172
  }, "validateQuery");
684
1173
  var fieldsNamed = /* @__PURE__ */ __name((ast) => new Set(walkQuery(ast.root).map((node) => node.field)), "fieldsNamed");
685
1174
 
686
- // node_modules/.pnpm/@wirecat+cli-base@0.87.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/parser.js
1175
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/parser.js
687
1176
  var whitespace = /* @__PURE__ */ __name((c) => /[ \t\n\r\u3000]/u.test(c), "whitespace");
688
1177
  var reserved = /* @__PURE__ */ new Set([
689
1178
  "+",
@@ -706,7 +1195,7 @@ var reserved = /* @__PURE__ */ new Set([
706
1195
  "\\",
707
1196
  "/"
708
1197
  ]);
709
- var decodeEscapes = /* @__PURE__ */ __name((raw, span, fail) => {
1198
+ var decodeEscapes = /* @__PURE__ */ __name((raw, span, fail3) => {
710
1199
  let out = "";
711
1200
  for (let at = 0; at < raw.length; at++) {
712
1201
  if (raw[at] !== "\\") {
@@ -714,11 +1203,11 @@ var decodeEscapes = /* @__PURE__ */ __name((raw, span, fail) => {
714
1203
  continue;
715
1204
  }
716
1205
  if (++at >= raw.length)
717
- fail("query.invalid-escape", span);
1206
+ fail3("query.invalid-escape", span);
718
1207
  if (raw[at] === "u") {
719
1208
  const hex = raw.slice(at + 1, at + 5);
720
1209
  if (!/^[0-9a-fA-F]{4}$/.test(hex))
721
- fail("query.invalid-escape", span);
1210
+ fail3("query.invalid-escape", span);
722
1211
  out += String.fromCharCode(Number.parseInt(hex, 16));
723
1212
  at += 4;
724
1213
  } else
@@ -726,7 +1215,7 @@ var decodeEscapes = /* @__PURE__ */ __name((raw, span, fail) => {
726
1215
  }
727
1216
  return out;
728
1217
  }, "decodeEscapes");
729
- var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
1218
+ var tokensOf = /* @__PURE__ */ __name((text6, fail3 = queryError) => {
730
1219
  const tokens = [];
731
1220
  let at = 0;
732
1221
  let range = false;
@@ -737,7 +1226,7 @@ var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
737
1226
  at++;
738
1227
  continue;
739
1228
  }
740
- let kind = c;
1229
+ let kind2 = c;
741
1230
  if (c === '"' || !range && c === "/") {
742
1231
  at++;
743
1232
  while (at < text6.length && text6[at] !== c) {
@@ -746,26 +1235,26 @@ var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
746
1235
  at++;
747
1236
  }
748
1237
  if (at >= text6.length)
749
- fail("query.unclosed-literal", { start, end: at }, c === "/" ? regexHint(text6, start) : void 0);
1238
+ fail3("query.unclosed-literal", { start, end: at }, c === "/" ? regexHint(text6, start) : void 0);
750
1239
  at++;
751
1240
  if (c === "/" && /^[dgimsuvy]+(?:$|[ \t\n\r)])/.test(text6.slice(at)))
752
- fail("query.unsupported-regex-flags", { start: at, end: at + 1 }, "Lucene regex does not take JavaScript flags");
753
- kind = c === '"' ? "quoted" : "regex";
1241
+ fail3("query.unsupported-regex-flags", { start: at, end: at + 1 }, "Lucene regex does not take JavaScript flags");
1242
+ kind2 = c === '"' ? "quoted" : "regex";
754
1243
  } else if (range && c !== "]" && c !== "}") {
755
1244
  while (at < text6.length && !whitespace(text6[at] ?? "") && !["]", "}"].includes(text6[at] ?? ""))
756
1245
  at++;
757
- kind = "rangeValue";
1246
+ kind2 = "rangeValue";
758
1247
  } else if (reserved.has(c)) {
759
1248
  if (c === "\\") {
760
1249
  at += 2;
761
1250
  while (at < text6.length && !whitespace(text6[at] ?? "") && (!reserved.has(text6[at] ?? "") || ["+", "-"].includes(text6[at] ?? "")))
762
1251
  at++;
763
- kind = "term";
1252
+ kind2 = "term";
764
1253
  } else {
765
1254
  at++;
766
1255
  if ((c === "<" || c === ">") && text6[at] === "=") {
767
1256
  at++;
768
- kind += "=";
1257
+ kind2 += "=";
769
1258
  }
770
1259
  if (c === "[" || c === "{")
771
1260
  range = true;
@@ -778,7 +1267,7 @@ var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
778
1267
  const next = text6[at] ?? "";
779
1268
  if (next === "\\") {
780
1269
  if (at + 1 >= text6.length)
781
- fail("query.invalid-escape", { start: at, end: at + 1 });
1270
+ fail3("query.invalid-escape", { start: at, end: at + 1 });
782
1271
  at += 2;
783
1272
  continue;
784
1273
  }
@@ -795,9 +1284,9 @@ var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
795
1284
  while (at < text6.length && !whitespace(text6[at] ?? "") && !["(", ")", '"'].includes(text6[at] ?? ""))
796
1285
  at++;
797
1286
  const raw = text6.slice(start, at);
798
- kind = { AND: "AND", OR: "OR", NOT: "NOT", "&&": "AND", "||": "OR" }[raw] ?? (/^\d+(?:\.\d+)?$/u.test(raw) ? "number" : "term");
1287
+ kind2 = { AND: "AND", OR: "OR", NOT: "NOT", "&&": "AND", "||": "OR" }[raw] ?? (/^\d+(?:\.\d+)?$/u.test(raw) ? "number" : "term");
799
1288
  }
800
- tokens.push({ kind, raw: text6.slice(start, at), span: { start, end: at } });
1289
+ tokens.push({ kind: kind2, raw: text6.slice(start, at), span: { start, end: at } });
801
1290
  }
802
1291
  tokens.push({ kind: "EOF", raw: "", span: { start: at, end: at } });
803
1292
  return tokens;
@@ -816,30 +1305,30 @@ var regexHint = /* @__PURE__ */ __name((text6, at) => {
816
1305
  return quoteHint(text6, at) ?? `/ starts a regular expression; put the value in quotes: "${word}"`;
817
1306
  }, "regexHint");
818
1307
  var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proximity = false, ...context3 } = {}) => {
819
- const fail = /* @__PURE__ */ __name((reason, span, alternative) => queryError(reason, span, alternative ?? quoteHint(text6, span.start), context3), "fail");
1308
+ const fail3 = /* @__PURE__ */ __name((reason, span, alternative) => queryError(reason, span, alternative ?? quoteHint(text6, span.start), context3), "fail");
820
1309
  if (text6.length > QUERY_LIMITS.bytes || new TextEncoder().encode(text6).length > QUERY_LIMITS.bytes)
821
- fail("query.too-large", { start: 0, end: text6.length });
822
- const tokens = tokensOf(text6, fail);
1310
+ fail3("query.too-large", { start: 0, end: text6.length });
1311
+ const tokens = tokensOf(text6, fail3);
823
1312
  let at = 0;
824
1313
  let count7 = 0;
825
1314
  let depth = 0;
826
1315
  const peek = /* @__PURE__ */ __name(() => tokens[at], "peek");
827
1316
  const take = /* @__PURE__ */ __name(() => tokens[at++], "take");
828
- const expect = /* @__PURE__ */ __name((kind) => {
829
- if (peek().kind !== kind)
830
- fail("query.invalid-syntax", peek().span);
1317
+ const expect = /* @__PURE__ */ __name((kind2) => {
1318
+ if (peek().kind !== kind2)
1319
+ fail3("query.invalid-syntax", peek().span);
831
1320
  return take();
832
1321
  }, "expect");
833
1322
  const built = /* @__PURE__ */ __name((node) => {
834
1323
  if (++count7 > QUERY_LIMITS.nodes)
835
- fail("query.too-large", node.span);
1324
+ fail3("query.too-large", node.span);
836
1325
  return node;
837
1326
  }, "built");
838
1327
  const combine = /* @__PURE__ */ __name((clauses, occur) => {
839
1328
  const first = clauses[0];
840
1329
  const last = clauses.at(-1);
841
1330
  if (!first || !last)
842
- fail("query.invalid-syntax", peek().span);
1331
+ fail3("query.invalid-syntax", peek().span);
843
1332
  if (clauses.length === 1)
844
1333
  return first;
845
1334
  return {
@@ -852,7 +1341,7 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
852
1341
  }, "combine");
853
1342
  const query = /* @__PURE__ */ __name((field, implicit = false) => {
854
1343
  if (++depth > QUERY_LIMITS.depth)
855
- fail("query.too-large", peek().span);
1344
+ fail3("query.too-large", peek().span);
856
1345
  const clauses = [];
857
1346
  do {
858
1347
  clauses.push(disjunction(field, implicit));
@@ -888,7 +1377,7 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
888
1377
  let implicit = inheritedImplicit;
889
1378
  if (peek().kind === "term" && [":", "=", "<", ">", "<=", ">="].includes(tokens[at + 1]?.kind ?? "")) {
890
1379
  const token = take();
891
- field = decodeEscapes(token.raw, token.span, fail);
1380
+ field = decodeEscapes(token.raw, token.span, fail3);
892
1381
  start = token.span.start;
893
1382
  implicit = false;
894
1383
  let operator = take();
@@ -897,8 +1386,8 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
897
1386
  if (["<", ">", "<=", ">="].includes(operator.kind)) {
898
1387
  const value = take();
899
1388
  if (!["term", "number", "quoted"].includes(value.kind))
900
- fail("query.invalid-syntax", value.span);
901
- const decoded = decodeEscapes(value.kind === "quoted" ? value.raw.slice(1, -1) : value.raw, value.span, fail);
1389
+ fail3("query.invalid-syntax", value.span);
1390
+ const decoded = decodeEscapes(value.kind === "quoted" ? value.raw.slice(1, -1) : value.raw, value.span, fail3);
902
1391
  const lower = operator.kind.startsWith(">");
903
1392
  const node2 = built({
904
1393
  kind: "predicate",
@@ -923,17 +1412,17 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
923
1412
  const opening = take();
924
1413
  const lower = take();
925
1414
  if (!["rangeValue", "quoted"].includes(lower.kind))
926
- fail("query.invalid-syntax", lower.span);
1415
+ fail3("query.invalid-syntax", lower.span);
927
1416
  const separator = take();
928
1417
  if (separator.raw !== "TO")
929
- fail("query.invalid-syntax", separator.span);
1418
+ fail3("query.invalid-syntax", separator.span);
930
1419
  const upper = take();
931
1420
  if (!["rangeValue", "quoted"].includes(upper.kind))
932
- fail("query.invalid-syntax", upper.span);
1421
+ fail3("query.invalid-syntax", upper.span);
933
1422
  const closing = take();
934
1423
  if (!["]", "}"].includes(closing.kind))
935
- fail("query.invalid-syntax", closing.span);
936
- const decode = /* @__PURE__ */ __name((t) => decodeEscapes(t.kind === "quoted" ? t.raw.slice(1, -1) : t.raw, t.span, fail), "decode");
1424
+ fail3("query.invalid-syntax", closing.span);
1425
+ const decode = /* @__PURE__ */ __name((t) => decodeEscapes(t.kind === "quoted" ? t.raw.slice(1, -1) : t.raw, t.span, fail3), "decode");
937
1426
  node = built({
938
1427
  kind: "predicate",
939
1428
  field,
@@ -947,31 +1436,31 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
947
1436
  } else {
948
1437
  const token = take();
949
1438
  if (!["term", "number", "quoted", "regex"].includes(token.kind))
950
- fail("query.invalid-syntax", token.span);
1439
+ fail3("query.invalid-syntax", token.span);
951
1440
  const raw = ["term", "number"].includes(token.kind) ? token.raw : token.raw.slice(1, -1);
952
1441
  if (field === "fn")
953
- fail("query.unsupported-operator", token.span, "interval functions are not supported");
1442
+ fail3("query.unsupported-operator", token.span, "interval functions are not supported");
954
1443
  const wildcard = ["term", "number"].includes(token.kind) && /(?<!\\)[*?]/u.test(raw);
955
1444
  node = built({
956
1445
  kind: "predicate",
957
1446
  field,
958
1447
  operator: token.kind === "regex" ? "regex" : token.kind === "quoted" ? "phrase" : wildcard ? "wildcard" : "term",
959
- value: token.kind === "regex" || wildcard ? raw : decodeEscapes(raw, token.span, fail),
1448
+ value: token.kind === "regex" || wildcard ? raw : decodeEscapes(raw, token.span, fail3),
960
1449
  span: { start: start ?? token.span.start, end: token.span.end },
961
1450
  ...implicit ? { implicit: true } : {}
962
1451
  });
963
1452
  }
964
1453
  if (proximity && peek().kind === "~" && node.kind === "predicate" && node.operator === "phrase") {
965
1454
  take();
966
- const distance = take();
967
- if (distance.kind !== "number" || !/^\d+$/u.test(distance.raw))
968
- fail("query.invalid-syntax", distance.span, 'write the distance as a whole number: "a b"~3');
969
- node = { ...node, slop: Number(distance.raw), span: { start: node.span.start, end: distance.span.end } };
1455
+ const distance2 = take();
1456
+ if (distance2.kind !== "number" || !/^\d+$/u.test(distance2.raw))
1457
+ fail3("query.invalid-syntax", distance2.span, 'write the distance as a whole number: "a b"~3');
1458
+ node = { ...node, slop: Number(distance2.raw), span: { start: node.span.start, end: distance2.span.end } };
970
1459
  }
971
1460
  if (peek().kind === "~")
972
- fail("query.unsupported-operator", peek().span, node.kind === "predicate" && node.operator === "phrase" ? "proximity (~) is not supported \u2014 drop the ~ for the exact phrase, or join the words with AND" : "fuzzy matching (~) is not supported \u2014 use a prefix such as word* to catch word forms");
1461
+ fail3("query.unsupported-operator", peek().span, node.kind === "predicate" && node.operator === "phrase" ? "proximity (~) is not supported \u2014 drop the ~ for the exact phrase, or join the words with AND" : "fuzzy matching (~) is not supported \u2014 use a prefix such as word* to catch word forms");
973
1462
  if (["^", "@"].includes(peek().kind))
974
- fail("query.unsupported-operator", peek().span, "boost and minimum-should-match are not supported");
1463
+ fail3("query.unsupported-operator", peek().span, "boost and minimum-should-match are not supported");
975
1464
  return { node, ...modifier ? { modifier } : {} };
976
1465
  }, "clause");
977
1466
  const root = query(defaultField, true);
@@ -987,20 +1476,20 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
987
1476
  }, "parseLucene");
988
1477
  var implicitTextTerms = /* @__PURE__ */ __name((text6) => {
989
1478
  const tokens = tokensOf(text6);
990
- if (tokens.some(({ kind }) => ["AND", "OR", "NOT", "+", "-", "!", "(", ")"].includes(kind)))
1479
+ if (tokens.some(({ kind: kind2 }) => ["AND", "OR", "NOT", "+", "-", "!", "(", ")"].includes(kind2)))
991
1480
  return /* @__PURE__ */ new Set();
992
1481
  return new Set(tokens.flatMap((token, index) => (token.kind === "term" || token.kind === "number") && ![":", "=", "<", ">", "<=", ">="].includes(tokens[index - 1]?.kind ?? "") && ![":", "=", "<", ">", "<=", ">="].includes(tokens[index + 1]?.kind ?? "") ? [token.span.start] : []));
993
1482
  }, "implicitTextTerms");
994
1483
 
995
- // node_modules/.pnpm/@wirecat+cli-base@0.87.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/registry.js
996
- var describeQuery = /* @__PURE__ */ __name((registry) => ({
997
- entity: registry.entity,
998
- backend: registry.backend,
999
- fields: registry.fields.map(({ validate: _, ...field }) => field),
1000
- ...registry.defaults && registry.defaults.length > 0 ? { defaults: [...registry.defaults] } : {}
1484
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/registry.js
1485
+ var describeQuery = /* @__PURE__ */ __name((registry3) => ({
1486
+ entity: registry3.entity,
1487
+ backend: registry3.backend,
1488
+ fields: registry3.fields.map(({ validate: _, ...field }) => field),
1489
+ ...registry3.defaults && registry3.defaults.length > 0 ? { defaults: [...registry3.defaults] } : {}
1001
1490
  }), "describeQuery");
1002
- var exampleProblems = /* @__PURE__ */ __name((registry) => {
1003
- const syntaxOnly = { ...registry, backend: "sql" };
1491
+ var exampleProblems = /* @__PURE__ */ __name((registry3) => {
1492
+ const syntaxOnly = { ...registry3, backend: "sql" };
1004
1493
  const problem = /* @__PURE__ */ __name((text6, field) => {
1005
1494
  try {
1006
1495
  const named = walkQuery(validateQuery(parseLucene(text6, { defaultField: "none" }), syntaxOnly).root);
@@ -1011,29 +1500,29 @@ var exampleProblems = /* @__PURE__ */ __name((registry) => {
1011
1500
  return `"${text6}": ${failure.message}`;
1012
1501
  }
1013
1502
  }, "problem");
1014
- const defaults = (registry.defaults ?? []).map((term) => {
1503
+ const defaults = (registry3.defaults ?? []).map((term) => {
1015
1504
  const field = term.replace(/^-/, "").split(/[:<>=]/)[0] ?? "";
1016
1505
  return { field, problem: problem(term.replace(/^-/, ""), field) };
1017
1506
  });
1018
1507
  return [
1019
- ...registry.fields.map((field) => ({ field: field.name, problem: problem(field.example, field.name) })),
1508
+ ...registry3.fields.map((field) => ({ field: field.name, problem: problem(field.example, field.name) })),
1020
1509
  ...defaults
1021
1510
  ].filter((entry) => entry.problem !== void 0);
1022
1511
  }, "exampleProblems");
1023
1512
  var checked = /* @__PURE__ */ new WeakSet();
1024
- var defineQuery = /* @__PURE__ */ __name((registry) => {
1025
- if (checked.has(registry))
1026
- return registry;
1027
- const names = registry.fields.map((field) => field.name);
1513
+ var defineQuery = /* @__PURE__ */ __name((registry3) => {
1514
+ if (checked.has(registry3))
1515
+ return registry3;
1516
+ const names = registry3.fields.map((field) => field.name);
1028
1517
  const problems = [
1029
1518
  ...duplicates(names).map((name) => `"${name}" is listed twice`),
1030
1519
  ...names.filter((name) => !SNAKE_CASE.test(name)).map((name) => `"${name}" is not snake_case`),
1031
- ...exampleProblems(registry).map(({ field, problem }) => `${field}: ${problem}`)
1520
+ ...exampleProblems(registry3).map(({ field, problem }) => `${field}: ${problem}`)
1032
1521
  ];
1033
1522
  if (problems.length > 0)
1034
- throw new RegistryError(`${registry.entity} query`, problems);
1035
- checked.add(registry);
1036
- return registry;
1523
+ throw new RegistryError(`${registry3.entity} query`, problems);
1524
+ checked.add(registry3);
1525
+ return registry3;
1037
1526
  }, "defineQuery");
1038
1527
  var SPAN = ["span", "alternative", "guide"];
1039
1528
  var QUERY_REASONS = defineReasons([
@@ -1063,7 +1552,44 @@ var QUERY_REASONS = defineReasons([
1063
1552
  details: [...SPAN, ...details]
1064
1553
  })));
1065
1554
 
1066
- // node_modules/.pnpm/@wirecat+cli-base@0.87.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/evaluate.js
1555
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/help.js
1556
+ var shownOf = /* @__PURE__ */ __name((registry3) => registry3.backend === "native" ? registry3.fields.filter((field) => field.native) : registry3.fields, "shownOf");
1557
+ var leftOut = /* @__PURE__ */ __name((fields) => fields.filter((field) => field.negatable).map((field) => field.name), "leftOut");
1558
+ var has = /* @__PURE__ */ __name((fields, operator) => fields.some((field) => field.operators.includes(operator)), "has");
1559
+ var syntaxOf = /* @__PURE__ */ __name((shown, backend) => [
1560
+ "field:value",
1561
+ ...has(shown, "phrase") ? ['"a phrase"'] : [],
1562
+ ...has(shown, "wildcard") ? ["word*"] : [],
1563
+ ...backend === "native" ? ["terms joined by AND"] : ["AND OR NOT", "( )"],
1564
+ ...has(shown, "range") ? ["[a TO b] \xB7 > >= < <="] : []
1565
+ ].join(" \xB7 "), "syntaxOf");
1566
+ var kindOf = /* @__PURE__ */ __name((field) => field.values ? `${field.type}: ${field.values.join("|")}` : `${field.type}: ${field.operators.join(", ")}`, "kindOf");
1567
+ var fieldsHelp = /* @__PURE__ */ __name((registry3, guide) => {
1568
+ const shown = shownOf(registry3);
1569
+ const negatable = leftOut(shown);
1570
+ const rows = shown.map((field) => [field.name, kindOf(field), field.example]);
1571
+ const widths = [0, 1].map((at) => Math.max(...rows.map((row) => (row[at] ?? "").length)));
1572
+ return [
1573
+ "Fields:",
1574
+ ...rows.map(([name = "", kind2 = "", example = ""]) => ` ${name.padEnd(widths[0] ?? 0)} ${kind2.padEnd(widths[1] ?? 0)} ${example}`.trimEnd()),
1575
+ ...registry3.defaults && registry3.defaults.length > 0 ? [`Defaults: ${registry3.defaults.join(" ")} \u2014 name the field to change it`] : [],
1576
+ ...negatable.length > 0 ? [`Leave out: -${negatable[0]}:value or NOT ${negatable[0]}:value, for ${negatable.join(", ")}`] : [],
1577
+ `Syntax: ${syntaxOf(shown, registry3.backend)}`,
1578
+ ...guide ? [`Guide: ${guide}`] : []
1579
+ ].join("\n");
1580
+ }, "fieldsHelp");
1581
+ var queryDescription = /* @__PURE__ */ __name((registry3) => {
1582
+ const shown = shownOf(registry3);
1583
+ if (shown.length === 0)
1584
+ return "field:value terms; this list filters by none yet, so any term is refused";
1585
+ const negatable = leftOut(shown);
1586
+ const terms = registry3.backend === "native" ? `field:value terms joined by AND that narrow the list${negatable.length > 0 ? `; -field:value or NOT field:value leaves out what matches, for ${negatable.join(", ")} only` : ""}` : `field:value terms that narrow the list (Lucene: AND OR NOT, -field:value${has(shown, "range") ? ", [a TO b], > <" : ""})`;
1587
+ const fields = shown.map((field) => field.values ? `${field.name} (${field.values.join("|")})` : field.name);
1588
+ const defaults = registry3.defaults?.length ? `; unless named: ${registry3.defaults.join(" ")}` : "";
1589
+ return `${terms}; fields: ${fields.join(", ")}; e.g. ${shown[0]?.example ?? ""}${defaults}`;
1590
+ }, "queryDescription");
1591
+
1592
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/evaluate.js
1067
1593
  var wordsOf = /* @__PURE__ */ __name((text6) => text6.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [], "wordsOf");
1068
1594
  var pattern = /* @__PURE__ */ __name((value) => new RegExp(`^${[...value].map((char) => char === "*" ? ".*" : char === "?" ? "." : char.replace(/[.+^${}()|[\]\\]/, "\\$&")).join("")}$`, "iu"), "pattern");
1069
1595
  var present = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "", "present");
@@ -1118,7 +1644,7 @@ var matches = /* @__PURE__ */ __name((node, item, byName, options) => {
1118
1644
  }, "matches");
1119
1645
  var evaluate = /* @__PURE__ */ __name((ast, fields, item, options = {}) => matches(ast.root, item, new Map(fields.map((field) => [field.name, field])), options), "evaluate");
1120
1646
 
1121
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/reference.js
1647
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/reference.js
1122
1648
  var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "expected meeting:<accountId>/<meetingId>[/<transcriptId>[/<cuePosition>]] with safe integer IDs"), "invalid");
1123
1649
  var integer2 = /* @__PURE__ */ __name((value, minimum = 1) => {
1124
1650
  if (!Number.isSafeInteger(value) || value < minimum)
@@ -1126,24 +1652,24 @@ var integer2 = /* @__PURE__ */ __name((value, minimum = 1) => {
1126
1652
  return value;
1127
1653
  }, "integer");
1128
1654
  var formatMeetingReference = /* @__PURE__ */ __name((reference2) => {
1129
- const parts = [integer2(reference2.accountId), integer2(reference2.meetingId)];
1655
+ const parts2 = [integer2(reference2.accountId), integer2(reference2.meetingId)];
1130
1656
  if (reference2.transcriptId !== void 0)
1131
- parts.push(integer2(reference2.transcriptId));
1657
+ parts2.push(integer2(reference2.transcriptId));
1132
1658
  if (reference2.cuePosition !== void 0) {
1133
1659
  if (reference2.transcriptId === void 0)
1134
1660
  throw invalid();
1135
- parts.push(integer2(reference2.cuePosition, 0));
1661
+ parts2.push(integer2(reference2.cuePosition, 0));
1136
1662
  }
1137
- return `meeting:${parts.join("/")}`;
1663
+ return `meeting:${parts2.join("/")}`;
1138
1664
  }, "formatMeetingReference");
1139
1665
  var parseMeetingReference = /* @__PURE__ */ __name((text6) => {
1140
1666
  const value = text6.trim();
1141
1667
  if (!value.startsWith("meeting:"))
1142
1668
  throw invalid();
1143
- const parts = value.slice(8).split("/");
1144
- if (parts.length < 2 || parts.length > 4 || parts.some((part) => !/^\d+$/.test(part)))
1669
+ const parts2 = value.slice(8).split("/");
1670
+ if (parts2.length < 2 || parts2.length > 4 || parts2.some((part) => !/^\d+$/.test(part)))
1145
1671
  throw invalid();
1146
- const ids2 = parts.map(Number);
1672
+ const ids2 = parts2.map(Number);
1147
1673
  const reference2 = {
1148
1674
  type: "meeting",
1149
1675
  accountId: integer2(ids2[0]),
@@ -1155,7 +1681,7 @@ var parseMeetingReference = /* @__PURE__ */ __name((text6) => {
1155
1681
  }, "parseMeetingReference");
1156
1682
  var canonicalMeetingReference = /* @__PURE__ */ __name((text6) => formatMeetingReference(parseMeetingReference(text6)), "canonicalMeetingReference");
1157
1683
 
1158
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/item.js
1684
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/item.js
1159
1685
  var text = string();
1160
1686
  var count = pipe(number(), integer(), minValue(0));
1161
1687
  var MEETING_ISSUES = ["time_without_zone"];
@@ -1220,7 +1746,7 @@ var MEETING_QUERY = {
1220
1746
  })
1221
1747
  };
1222
1748
 
1223
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/join-key.js
1749
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/join-key.js
1224
1750
  var joinKeyOf = /* @__PURE__ */ __name((url) => {
1225
1751
  const parsed = urlOf(url);
1226
1752
  if (!parsed)
@@ -1254,7 +1780,7 @@ var urlOf = /* @__PURE__ */ __name((url) => {
1254
1780
  }
1255
1781
  }, "urlOf");
1256
1782
 
1257
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/calendar-text.js
1783
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/calendar-text.js
1258
1784
  var ENTITIES = { amp: "&", lt: "<", gt: ">", quot: '"', "#39": "'", apos: "'", nbsp: " " };
1259
1785
  var SECRET_LINE = /(?<![\p{L}\p{N}])(pass ?codes?|passwords?|pwd|pins?|access ?codes?|meeting ?codes?|kennwort|пароль|пин-?код|код доступа)(?![\p{L}\p{N}])|pwd=/iu;
1260
1786
  var htmlToText = /* @__PURE__ */ __name((html) => html.replace(/<\s*br\s*\/?>/giu, "\n").replace(/<\/\s*(p|div|li|tr|h[1-6])\s*>/giu, "\n").replace(/<a\s[^>]*href\s*=\s*"([^"]*)"[^>]*>/giu, " $1 ").replace(/<[^>]+>/gu, "").replace(/&(amp|lt|gt|quot|#39|apos|nbsp);/gu, (_, name) => ENTITIES[name] ?? ""), "htmlToText");
@@ -1263,8 +1789,8 @@ var calendarText = /* @__PURE__ */ __name((text6, { dropSecretLines = true } = {
1263
1789
  if (!text6)
1264
1790
  return null;
1265
1791
  const kept = htmlToText(text6).split(/\r?\n/u).map((line2) => withoutLinkQueries(line2).replace(/[ \t]+/gu, " ").trim()).filter((line2) => !dropSecretLines || !SECRET_LINE.test(line2));
1266
- const joined = kept.join("\n").replace(/\n{3,}/gu, "\n\n").trim();
1267
- return joined || null;
1792
+ const joined2 = kept.join("\n").replace(/\n{3,}/gu, "\n\n").trim();
1793
+ return joined2 || null;
1268
1794
  }, "calendarText");
1269
1795
  var ENTRY_METADATA_KEYS = [
1270
1796
  "colorId",
@@ -1291,7 +1817,7 @@ var entryMetadata = /* @__PURE__ */ __name((metadata) => {
1291
1817
  return kept;
1292
1818
  }, "entryMetadata");
1293
1819
 
1294
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/cue-fingerprint.js
1820
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/cue-fingerprint.js
1295
1821
  import { createHash } from "node:crypto";
1296
1822
  var meetingCueFingerprint = /* @__PURE__ */ __name((cue2) => createHash("sha256").update(JSON.stringify({
1297
1823
  reference: cue2.reference,
@@ -1305,7 +1831,7 @@ var meetingCueFingerprint = /* @__PURE__ */ __name((cue2) => createHash("sha256"
1305
1831
  text: cue2.text
1306
1832
  })).digest("hex"), "meetingCueFingerprint");
1307
1833
 
1308
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/event-store.js
1834
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/event-store.js
1309
1835
  var UNTIL = /(?:^|;)UNTIL=(\d{4})(\d{2})(\d{2})(?:T(\d{2})(\d{2})(\d{2})Z?)?(?:;|$)/iu;
1310
1836
  var seriesEnd = /* @__PURE__ */ __name((entry) => {
1311
1837
  if (entry.recurrenceEndsAt !== null)
@@ -1314,8 +1840,8 @@ var seriesEnd = /* @__PURE__ */ __name((entry) => {
1314
1840
  const until = rule === void 0 ? null : UNTIL.exec(rule.slice("RRULE:".length));
1315
1841
  if (!until)
1316
1842
  return Number.POSITIVE_INFINITY;
1317
- const [, year, month, day, hour = "23", minute = "59", second = "59"] = until;
1318
- return Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second)) + 864e5;
1843
+ const [, year, month, day2, hour = "23", minute = "59", second = "59"] = until;
1844
+ return Date.UTC(Number(year), Number(month) - 1, Number(day2), Number(hour), Number(minute), Number(second)) + 864e5;
1319
1845
  }, "seriesEnd");
1320
1846
  var entryInWindow = /* @__PURE__ */ __name((entry, window) => {
1321
1847
  if (entry.kind === "occurrence" && !entry.exception)
@@ -1328,7 +1854,7 @@ var entryInWindow = /* @__PURE__ */ __name((entry, window) => {
1328
1854
  return Math.max(entry.endsAt ?? start, start + 1) > window.from;
1329
1855
  }, "entryInWindow");
1330
1856
 
1331
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/answers.js
1857
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/answers.js
1332
1858
  var text2 = string();
1333
1859
  var count2 = pipe(number(), integer(), minValue(0));
1334
1860
  var iso2 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
@@ -1563,7 +2089,7 @@ var meetingHitsList = /* @__PURE__ */ __name((found, limit, command = "search me
1563
2089
  };
1564
2090
  }, "meetingHitsList");
1565
2091
 
1566
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/participant-search.js
2092
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/participant-search.js
1567
2093
  var normalizeMeetingParticipantQuery = /* @__PURE__ */ __name((text6) => text6.normalize("NFKC").toLowerCase(), "normalizeMeetingParticipantQuery");
1568
2094
  var validateMeetingParticipantQuery = /* @__PURE__ */ __name((query) => {
1569
2095
  if (typeof query !== "string" || !query.trim() || query.length > 500 || query.includes("\0"))
@@ -1587,7 +2113,7 @@ var validateMeetingParticipantSearch = /* @__PURE__ */ __name((query, input) =>
1587
2113
  };
1588
2114
  }, "validateMeetingParticipantSearch");
1589
2115
 
1590
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/reads.js
2116
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/reads.js
1591
2117
  var MeetingError = class extends CliError {
1592
2118
  static {
1593
2119
  __name(this, "MeetingError");
@@ -1719,7 +2245,7 @@ var meetingSummaryAnswer = /* @__PURE__ */ __name(async (store, id4, accountId)
1719
2245
  return wholeList(details.summaries.map((one) => meetingSummaryItem(details.meeting.accountId, one)));
1720
2246
  }, "meetingSummaryAnswer");
1721
2247
 
1722
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/export.js
2248
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/export.js
1723
2249
  var timestamp = /* @__PURE__ */ __name((milliseconds) => {
1724
2250
  if (!Number.isSafeInteger(milliseconds) || milliseconds < 0)
1725
2251
  throw new MeetingError("validation_error", "transcript times must be nonnegative integer milliseconds");
@@ -1781,30 +2307,30 @@ var exportMeeting = /* @__PURE__ */ __name(async (store, id4, options) => {
1781
2307
  text: row.text
1782
2308
  })));
1783
2309
  } else {
1784
- const parts = [`# ${heading(details.meeting.title ?? "Untitled meeting")}`, `Meeting ID: ${details.meeting.id}`];
2310
+ const parts2 = [`# ${heading(details.meeting.title ?? "Untitled meeting")}`, `Meeting ID: ${details.meeting.id}`];
1785
2311
  if (details.meeting.description !== null)
1786
- parts.push("## Description", quote(details.meeting.description));
2312
+ parts2.push("## Description", quote(details.meeting.description));
1787
2313
  for (const summary of details.summaries) {
1788
- parts.push(`## ${heading(summary.title ?? "Summary")}`);
2314
+ parts2.push(`## ${heading(summary.title ?? "Summary")}`);
1789
2315
  if (summary.content !== null)
1790
- parts.push(quote(summary.content));
2316
+ parts2.push(quote(summary.content));
1791
2317
  else {
1792
2318
  if (summary.overview !== null)
1793
- parts.push(quote(summary.overview));
2319
+ parts2.push(quote(summary.overview));
1794
2320
  for (const section of summary.sections)
1795
- parts.push(`### ${heading(section.label)}`, quote(section.text));
2321
+ parts2.push(`### ${heading(section.label)}`, quote(section.text));
1796
2322
  if (summary.nextSteps.length > 0)
1797
- parts.push("### Next steps", summary.nextSteps.map((step) => `- ${markdown(step)}`).join("\n"));
2323
+ parts2.push("### Next steps", summary.nextSteps.map((step) => `- ${markdown(step)}`).join("\n"));
1798
2324
  }
1799
2325
  }
1800
2326
  for (const part of transcripts) {
1801
- parts.push(`## Transcript ${part.transcript.id}`, `Source: ${heading(part.transcript.source)}`);
2327
+ parts2.push(`## Transcript ${part.transcript.id}`, `Source: ${heading(part.transcript.source)}`);
1802
2328
  if (part.transcript.supersededAt !== null)
1803
- parts.push("Version: superseded");
2329
+ parts2.push("Version: superseded");
1804
2330
  for (const row of [...part.rows].sort((a, b) => a.position - b.position))
1805
- parts.push(`[${timestamp(row.startMs)} \u2013 ${timestamp(row.endMs)}]${row.speakerName === null ? "" : ` ${heading(row.speakerName)}`}`, quote(row.text));
2331
+ parts2.push(`[${timestamp(row.startMs)} \u2013 ${timestamp(row.endMs)}]${row.speakerName === null ? "" : ` ${heading(row.speakerName)}`}`, quote(row.text));
1806
2332
  }
1807
- content = `${parts.join("\n\n")}
2333
+ content = `${parts2.join("\n\n")}
1808
2334
  `;
1809
2335
  }
1810
2336
  return {
@@ -1815,7 +2341,7 @@ var exportMeeting = /* @__PURE__ */ __name(async (store, id4, options) => {
1815
2341
  };
1816
2342
  }, "exportMeeting");
1817
2343
 
1818
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/payment.js
2344
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/payment.js
1819
2345
  var FACT_TYPES = ["fact", "statement", "question", "decision", "promise"];
1820
2346
  var PAYMENT_DIRECTIONS = ["to_us", "from_us"];
1821
2347
  var PAYMENT_STATES = ["expected", "paid", "cancelled"];
@@ -1909,10 +2435,10 @@ var paymentTitle = /* @__PURE__ */ __name((fact) => {
1909
2435
  return `${grouped(payment.amount)} ${payment.currency} ${way}${party}${item}${due} (${payment.state})`;
1910
2436
  }, "paymentTitle");
1911
2437
 
1912
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/findings-rules.js
2438
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/findings-rules.js
1913
2439
  import { createHash as createHash2 } from "node:crypto";
1914
2440
 
1915
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/timestamp.js
2441
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/timestamp.js
1916
2442
  var meetingTimestamp = /* @__PURE__ */ __name((value, name) => {
1917
2443
  if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T.+(?:Z|[+-]\d{2}:\d{2})$/i.test(value) || !Number.isFinite(Date.parse(value)))
1918
2444
  throw new CliError("validation_error", `${name} must be an ISO timestamp with a timezone, such as 2026-11-09T09:00:00Z`);
@@ -1923,7 +2449,7 @@ var meetingTimestamp = /* @__PURE__ */ __name((value, name) => {
1923
2449
  return new Date(value).toISOString();
1924
2450
  }, "meetingTimestamp");
1925
2451
 
1926
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/findings-rules.js
2452
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/findings-rules.js
1927
2453
  var TASK_TYPES = ["bug", "feature", "chore"];
1928
2454
  var invalid3 = /* @__PURE__ */ __name((message) => {
1929
2455
  throw new CliError("validation_error", message);
@@ -1937,10 +2463,10 @@ var findingHash = /* @__PURE__ */ __name((value) => createHash2("sha256").update
1937
2463
  var snakeCase = /* @__PURE__ */ __name((key) => key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "snakeCase");
1938
2464
  var findingWhere = /* @__PURE__ */ __name((of) => {
1939
2465
  const id4 = typeof of.id === "string" ? of.id : null;
1940
- const kind = typeof of.kind === "string" ? of.kind : null;
2466
+ const kind2 = typeof of.kind === "string" ? of.kind : null;
1941
2467
  return {
1942
- where: id4 || kind ? ` in ${[id4, kind && `(${kind})`].filter(Boolean).join(" ")}` : "",
1943
- named: { ...id4 ? { finding: id4 } : {}, ...kind ? { kind } : {} }
2468
+ where: id4 || kind2 ? ` in ${[id4, kind2 && `(${kind2})`].filter(Boolean).join(" ")}` : "",
2469
+ named: { ...id4 ? { finding: id4 } : {}, ...kind2 ? { kind: kind2 } : {} }
1944
2470
  };
1945
2471
  }, "findingWhere");
1946
2472
  var findingFields = /* @__PURE__ */ __name((value, allowed, noun, of = value) => {
@@ -1968,13 +2494,15 @@ var validEvidence = /* @__PURE__ */ __name((raw, rules) => {
1968
2494
  const evidence = raw.map((item) => {
1969
2495
  if (!item || typeof item !== "object")
1970
2496
  return invalid3("finding evidence is a reference and fingerprint");
1971
- findingFields(item, ["reference", "fingerprint"], rules.singular);
2497
+ findingFields(item, rules.quotes ? ["reference", "fingerprint", "quote"] : ["reference", "fingerprint"], rules.singular);
1972
2498
  if (typeof item.reference !== "string" || typeof item.fingerprint !== "string")
1973
2499
  return invalid3("evidence requires a reference and fingerprint");
1974
2500
  const reference2 = rules.reference(item.reference);
1975
2501
  if (!/^[a-f0-9]{64}$/.test(item.fingerprint))
1976
2502
  return invalid3(`finding evidence requires exact ${rules.cited} references and fingerprints`);
1977
- return { reference: reference2, fingerprint: item.fingerprint };
2503
+ if (item.quote === void 0)
2504
+ return { reference: reference2, fingerprint: item.fingerprint };
2505
+ return { reference: reference2, fingerprint: item.fingerprint, quote: findingText(item.quote, rules.quotes ?? 0) };
1978
2506
  }).sort((a, b) => a.reference.localeCompare(b.reference));
1979
2507
  if (new Set(evidence.map((item) => item.reference)).size !== evidence.length)
1980
2508
  return invalid3(`duplicate evidence ${rules.cited}`);
@@ -2096,7 +2624,7 @@ var validateBatch = /* @__PURE__ */ __name((input, rules, most, one) => {
2096
2624
  var validateFindings = /* @__PURE__ */ __name((input, rules) => validateBatch(input, rules, 16, (finding, ids2) => validateFinding(finding, rules, ids2)), "validateFindings");
2097
2625
  var findingFingerprint = /* @__PURE__ */ __name(({ id: _id, ...finding }) => findingHash(finding), "findingFingerprint");
2098
2626
 
2099
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/findings.js
2627
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/findings.js
2100
2628
  var MEETING_FINDINGS_KIND = "meeting_findings";
2101
2629
  var cue = /* @__PURE__ */ __name((raw) => {
2102
2630
  const reference2 = canonicalMeetingReference(raw);
@@ -2107,7 +2635,7 @@ var cue = /* @__PURE__ */ __name((raw) => {
2107
2635
  var validateMeetingFindings = /* @__PURE__ */ __name((input) => validateFindings(input, { plural: "meeting findings", singular: "meeting finding", cited: "cue", reference: cue }), "validateMeetingFindings");
2108
2636
  var meetingFindingFingerprint = findingFingerprint;
2109
2637
 
2110
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/result-items.js
2638
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/result-items.js
2111
2639
  var text3 = string();
2112
2640
  var identifier = pipe(text3, minLength(1));
2113
2641
  var nullableText = nullable(text3);
@@ -2149,7 +2677,8 @@ var personResult = strictObject({
2149
2677
  participant_id: identifier,
2150
2678
  person_uid: text3,
2151
2679
  previous_person_uid: nullableText,
2152
- changed: flag
2680
+ changed: flag,
2681
+ proposal: optional(text3)
2153
2682
  });
2154
2683
  var meetingChange = strictObject({
2155
2684
  scope,
@@ -2240,7 +2769,7 @@ var MEETING_RESULT_ENTITIES = {
2240
2769
  meeting_repair: repair
2241
2770
  };
2242
2771
 
2243
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/event-query.js
2772
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/event-query.js
2244
2773
  var EVENT_QUERY = defineQuery({
2245
2774
  entity: "event",
2246
2775
  backend: "sql",
@@ -2256,7 +2785,7 @@ var EVENT_QUERY = defineQuery({
2256
2785
  ]
2257
2786
  });
2258
2787
 
2259
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/events.js
2788
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/events.js
2260
2789
  var linkEvent = /* @__PURE__ */ __name(async (store, details, now = Date.now()) => {
2261
2790
  const current = await store.meeting(details.meeting.id);
2262
2791
  if (!current)
@@ -2299,7 +2828,7 @@ var linkEvent = /* @__PURE__ */ __name(async (store, details, now = Date.now())
2299
2828
  return (await store.events()).find((e) => e.id === linked?.meeting.eventId) ?? null;
2300
2829
  }, "linkEvent");
2301
2830
 
2302
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/hit-query.js
2831
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/hit-query.js
2303
2832
  var context = {
2304
2833
  command: "search meetings",
2305
2834
  guide: "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md#\u0432\u0441\u0442\u0440\u0435\u0447\u0438"
@@ -2360,10 +2889,56 @@ var MEETING_FIELDS = defineQuery({
2360
2889
  }))
2361
2890
  ]
2362
2891
  });
2892
+ var LIFTED = /* @__PURE__ */ new Set(["date", "project", "tag", "topic"]);
2363
2893
  var MEETING_FIELD_NAMES = new Set(MEETING_FIELDS.fields.map(({ name }) => name));
2894
+ var liftMeetingFields = /* @__PURE__ */ __name((query, request, now, timezone) => {
2895
+ let ast;
2896
+ try {
2897
+ ast = validateQuery(parseLucene(query, { defaultField: "text", proximity: true, ...context }), MEETING_FIELDS, context);
2898
+ } catch (error) {
2899
+ if (error instanceof CliError)
2900
+ return { query, request };
2901
+ throw error;
2902
+ }
2903
+ const top = ast.root.kind === "boolean" ? ast.root.clauses : [{ occur: "must", node: ast.root }];
2904
+ const lifted = top.filter((clause) => clause.node.kind === "predicate" && LIFTED.has(clause.node.field));
2905
+ const misplaced = /* @__PURE__ */ __name((node, nested) => node.kind === "predicate" ? nested && LIFTED.has(node.field) ? node : void 0 : node.clauses.map((clause) => misplaced(clause.node, true)).find(Boolean), "misplaced");
2906
+ const wrong = lifted.find((clause) => clause.occur !== "must")?.node ?? top.map((clause) => clause.node.kind === "boolean" ? misplaced(clause.node, true) : void 0).find(Boolean);
2907
+ if (wrong)
2908
+ queryError("query.unsupported-field", wrong.span, `${wrong.field}: chooses meetings; join it to the words with AND, outside OR, NOT and groups`, context);
2909
+ if (!lifted.length)
2910
+ return { query, request };
2911
+ const next = { ...request };
2912
+ const once = /* @__PURE__ */ __name((name, flag2) => {
2913
+ if (next[name] !== void 0)
2914
+ throw new CliError("validation_error", `give ${flag2.replace(/^--/, "")} once: as ${flag2} or in the query`);
2915
+ }, "once");
2916
+ for (const { node } of lifted) {
2917
+ if (node.field === "date") {
2918
+ once("since", "--since-time");
2919
+ once("until", "--until-time");
2920
+ const range = dateRange(node.value, node.operator === "range" ? node.upper ?? "*" : node.value, node.lower_inclusive !== false, node.upper_inclusive !== false, timezoneOf(timezone), node.span, now);
2921
+ if (range.lower !== void 0)
2922
+ next.since = range.lower + (range.lower_inclusive ? 0 : 1);
2923
+ if (range.upper !== void 0)
2924
+ next.until = range.upper - (range.upper_inclusive ? 0 : 1);
2925
+ } else {
2926
+ const field = node.field;
2927
+ once(field, `--${field}`);
2928
+ next[field] = node.value;
2929
+ }
2930
+ }
2931
+ let rest = query;
2932
+ for (const { node } of [...lifted].sort((a, b) => b.node.span.start - a.node.span.start))
2933
+ rest = `${rest.slice(0, node.span.start)}${rest.slice(node.span.end)}`;
2934
+ rest = rest.replace(/^(?:\s*AND\b)+|(?:\bAND\s*)+$/g, "").replace(/\bAND(\s+AND\b)+/g, "AND").trim();
2935
+ if (!rest)
2936
+ throw new CliError("validation_error", "give words to find besides date:, project:, tag: and topic:");
2937
+ return { query: rest, request: next };
2938
+ }, "liftMeetingFields");
2364
2939
  var parseMeetingQuery = /* @__PURE__ */ __name((query) => validateQuery(parseLucene(query, { defaultField: "text", proximity: true, ...context }), MEETING_HIT_QUERY, context), "parseMeetingQuery");
2365
2940
 
2366
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/language.js
2941
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/language.js
2367
2942
  var LATIN_WORDS = {
2368
2943
  en: ["the", "and", "is", "that", "you", "this", "what", "have", "with", "are"],
2369
2944
  es: ["el", "los", "las", "por", "pero", "para", "est\xE1", "muy", "tambi\xE9n", "hay"],
@@ -2412,7 +2987,7 @@ var transcriptLanguage = /* @__PURE__ */ __name((texts) => {
2412
2987
  return null;
2413
2988
  }, "transcriptLanguage");
2414
2989
 
2415
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/ingest.js
2990
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/ingest.js
2416
2991
  var contentHash = /* @__PURE__ */ __name(async (text6) => {
2417
2992
  const bytes = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text6));
2418
2993
  return Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, "0")).join("");
@@ -2449,7 +3024,7 @@ var timestamp2 = /* @__PURE__ */ __name((value) => {
2449
3024
  return time2;
2450
3025
  }, "timestamp");
2451
3026
 
2452
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/transcript-text.js
3027
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/transcript-text.js
2453
3028
  var TranscriptTextError = class extends Error {
2454
3029
  static {
2455
3030
  __name(this, "TranscriptTextError");
@@ -2504,7 +3079,7 @@ var parseTranscriptText = /* @__PURE__ */ __name((input) => {
2504
3079
  return { header, lines };
2505
3080
  }, "parseTranscriptText");
2506
3081
 
2507
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/vtt.js
3082
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/vtt.js
2508
3083
  var VttError = class extends Error {
2509
3084
  static {
2510
3085
  __name(this, "VttError");
@@ -2556,7 +3131,7 @@ var parseVtt = /* @__PURE__ */ __name((input) => {
2556
3131
  return cues;
2557
3132
  }, "parseVtt");
2558
3133
 
2559
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/import.js
3134
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/import.js
2560
3135
  var importFiles = /* @__PURE__ */ __name(async (files, store, now = Date.now()) => {
2561
3136
  const report = { meetings: 0, participants: 0, transcriptRows: 0, summaries: 0, warnings: [] };
2562
3137
  for (const file of files) {
@@ -2589,10 +3164,10 @@ var importFiles = /* @__PURE__ */ __name(async (files, store, now = Date.now())
2589
3164
  return report;
2590
3165
  }, "importFiles");
2591
3166
 
2592
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/links.js
3167
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/links.js
2593
3168
  var CHAT_MESSAGES_READ = 1e5;
2594
3169
 
2595
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/meeting-management.js
3170
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/meeting-management.js
2596
3171
  var nonempty = /* @__PURE__ */ __name((value, name) => {
2597
3172
  if (typeof value !== "string" || !value.trim())
2598
3173
  throw new CliError("validation_error", `${name} must be nonempty`);
@@ -2643,7 +3218,7 @@ var validateMeetingChange = /* @__PURE__ */ __name((change, create) => {
2643
3218
  return Object.freeze(result);
2644
3219
  }, "validateMeetingChange");
2645
3220
 
2646
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/passage.js
3221
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/passage.js
2647
3222
  var meetingHitContextLimits = /* @__PURE__ */ __name((options = {}) => {
2648
3223
  const { before = 3, after = 3, bytes = 65536, max_read_bytes = 4194304, expected_fingerprint } = options;
2649
3224
  if (![before, after].every((value) => Number.isSafeInteger(value) && value >= 0) || before + after > 999 || !Number.isSafeInteger(bytes) || bytes < 2 || bytes > 4194304 || !Number.isSafeInteger(max_read_bytes) || max_read_bytes < 1 || max_read_bytes > 67108864 || expected_fingerprint !== void 0 && (typeof expected_fingerprint !== "string" || !/^[a-f0-9]{64}$/.test(expected_fingerprint)))
@@ -2656,7 +3231,7 @@ var validateMeetingPassage = /* @__PURE__ */ __name((reference2, options) => {
2656
3231
  throw new CliError("validation_error", "choose a cue reference and json, text or markdown output");
2657
3232
  }, "validateMeetingPassage");
2658
3233
 
2659
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/preparation-context.js
3234
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/preparation-context.js
2660
3235
  var validateMeetingPreparationContext = /* @__PURE__ */ __name((original) => {
2661
3236
  if (!original || typeof original !== "object" || Array.isArray(original))
2662
3237
  throw new CliError("validation_error", "meeting preparation context is required");
@@ -2681,7 +3256,7 @@ var validateMeetingPreparationContext = /* @__PURE__ */ __name((original) => {
2681
3256
  return { ...input, limit, maxReadBytes };
2682
3257
  }, "validateMeetingPreparationContext");
2683
3258
 
2684
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/project-evidence-answer.js
3259
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/project-evidence-answer.js
2685
3260
  var count4 = pipe(number(), integer(), minValue(0));
2686
3261
  var id = pipe(string(), minLength(1));
2687
3262
  var meetingProjectEvidence = strictObject({
@@ -2802,7 +3377,7 @@ var meetingProjectEvidenceAnswer = /* @__PURE__ */ __name((page, prepared, comma
2802
3377
  };
2803
3378
  }, "meetingProjectEvidenceAnswer");
2804
3379
 
2805
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/search-validation.js
3380
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/search-validation.js
2806
3381
  var validateMeetingHitSearch = /* @__PURE__ */ __name((query, options = {}) => {
2807
3382
  const integer3 = /* @__PURE__ */ __name((value, low, high) => Number.isSafeInteger(value) && value >= low && value <= high, "integer");
2808
3383
  if (typeof query !== "string" || !query.trim() || query.includes("\0") || new TextEncoder().encode(query).byteLength > 65536 || !integer3(options.limit ?? 100, 1, 1e3) || !integer3(options.maxReadBytes ?? 4194304, 1, 67108864) || [
@@ -2822,7 +3397,7 @@ var validateMeetingHitSearch = /* @__PURE__ */ __name((query, options = {}) => {
2822
3397
  throw new CliError("validation_error", "choose one project selector and one tag or topic selector");
2823
3398
  }, "validateMeetingHitSearch");
2824
3399
 
2825
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/project-evidence-query.js
3400
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/project-evidence-query.js
2826
3401
  var ids = {
2827
3402
  meeting_id: "meetingId",
2828
3403
  identity_id: "participantIdentityId",
@@ -2913,7 +3488,7 @@ var prepareMeetingProjectEvidence = /* @__PURE__ */ __name((project2, request =
2913
3488
  return { project: project2.trim(), options, query: frozen.join(" AND ") };
2914
3489
  }, "prepareMeetingProjectEvidence");
2915
3490
 
2916
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/project-evidence.js
3491
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/project-evidence.js
2917
3492
  var readMeetingProjectEvidence = /* @__PURE__ */ __name(async (read, project2, request = {}, now = Date.now()) => {
2918
3493
  const prepared = prepareMeetingProjectEvidence(project2, request, now);
2919
3494
  const page = await read(prepared.project, prepared.options);
@@ -2921,7 +3496,7 @@ var readMeetingProjectEvidence = /* @__PURE__ */ __name(async (read, project2, r
2921
3496
  return meetingProjectEvidenceAnswer(page, prepared);
2922
3497
  }, "readMeetingProjectEvidence");
2923
3498
 
2924
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/pull.js
3499
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/pull.js
2925
3500
  var participantInput = /* @__PURE__ */ __name((p, provider, occurrenceId2, position, accountId) => {
2926
3501
  const { identityExternalId, ...fields } = p;
2927
3502
  const externalId = identityExternalId ?? (p.email ? `email:${p.email.toLowerCase()}` : p.externalId) ?? `name:${p.displayName ?? "unknown"}@${accountId}/${occurrenceId2}:${position}`;
@@ -3083,7 +3658,7 @@ unlinked`, format)],
3083
3658
  return report;
3084
3659
  }, "pull");
3085
3660
 
3086
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/read-answers.js
3661
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/read-answers.js
3087
3662
  var text4 = string();
3088
3663
  var count5 = pipe(number(), integer(), minValue(0));
3089
3664
  var id2 = pipe(number(), integer(), minValue(1));
@@ -3277,10 +3852,10 @@ var eventItem = /* @__PURE__ */ __name((one) => ({
3277
3852
  updated_at: new Date(one.updatedAt).toISOString()
3278
3853
  }), "eventItem");
3279
3854
 
3280
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/recording-transfer.js
3855
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/recording-transfer.js
3281
3856
  var strongRecordingValidator = /* @__PURE__ */ __name((value) => typeof value === "string" && value.length <= 1024 && /^"[\x21\x23-\x7e\x80-\xff]*"$/.test(value), "strongRecordingValidator");
3282
3857
 
3283
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/related-history.js
3858
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/related-history.js
3284
3859
  var validateMeetingRelatedHistory = /* @__PURE__ */ __name((original) => {
3285
3860
  if (!original || typeof original !== "object" || Array.isArray(original))
3286
3861
  throw new CliError("validation_error", "related history request is required");
@@ -3310,14 +3885,14 @@ var validateMeetingRelatedHistory = /* @__PURE__ */ __name((original) => {
3310
3885
  return { ...input, anchorIds: [...new Set(input.anchorIds)], limit, maxReadBytes };
3311
3886
  }, "validateMeetingRelatedHistory");
3312
3887
 
3313
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/review.js
3888
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/review.js
3314
3889
  var REVIEW_LIMIT = { default: 50, most: 200 };
3315
3890
 
3316
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/save-hints.js
3891
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/save-hints.js
3317
3892
  var SAVE_HELP = `Worth keeping \u2014 a decision, a promise, a preference? Record it with \`memo facts add\` or
3318
3893
  \`memo memories add\`, citing the msg: locator or meeting: reference as --evidence.`;
3319
3894
 
3320
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/series-history.js
3895
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/series-history.js
3321
3896
  var validateMeetingSeriesHistory = /* @__PURE__ */ __name((input) => {
3322
3897
  input.signal?.throwIfAborted();
3323
3898
  if (!Number.isSafeInteger(input.accountId) || input.accountId <= 0)
@@ -3338,10 +3913,10 @@ var validateMeetingSeriesHistory = /* @__PURE__ */ __name((input) => {
3338
3913
  return { ...input, limit, maxReadBytes };
3339
3914
  }, "validateMeetingSeriesHistory");
3340
3915
 
3341
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/upcoming-validation.js
3916
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/upcoming-validation.js
3342
3917
  var occurrenceId = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim().length > 0 && value.length <= 1e3 && !/[\0\r\n]/.test(value), "occurrenceId");
3343
3918
 
3344
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/series-inventory-validation.js
3919
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/series-inventory-validation.js
3345
3920
  function invalid4(field, response = false) {
3346
3921
  throw new CliError(response ? "invalid_response" : "validation_error", `invalid meeting inventory ${field}`);
3347
3922
  }
@@ -3370,7 +3945,7 @@ var validateMeetingSeriesInventoryCursor = /* @__PURE__ */ __name((value) => {
3370
3945
  cursorDetails(value);
3371
3946
  }, "validateMeetingSeriesInventoryCursor");
3372
3947
 
3373
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/stats.js
3948
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/stats.js
3374
3949
  var MEETING_COUNTS_GROUPINGS = ["day", "week", "series"];
3375
3950
  var zoneOf = /* @__PURE__ */ __name((timeZone) => {
3376
3951
  const zone = timeZone ?? "UTC";
@@ -3383,13 +3958,13 @@ var zoneOf = /* @__PURE__ */ __name((timeZone) => {
3383
3958
  }, "zoneOf");
3384
3959
  var DAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
3385
3960
  var weekStart = /* @__PURE__ */ __name((at, format) => {
3386
- const parts = Object.fromEntries(format.formatToParts(new Date(at)).map((part) => [part.type, part.value]));
3387
- const day = Date.UTC(Number(parts.year), Number(parts.month) - 1, Number(parts.day));
3388
- return new Date(day - DAYS.indexOf(parts.weekday ?? "Mon") * 864e5).toISOString().slice(0, 10);
3961
+ const parts2 = Object.fromEntries(format.formatToParts(new Date(at)).map((part) => [part.type, part.value]));
3962
+ const day2 = Date.UTC(Number(parts2.year), Number(parts2.month) - 1, Number(parts2.day));
3963
+ return new Date(day2 - DAYS.indexOf(parts2.weekday ?? "Mon") * 864e5).toISOString().slice(0, 10);
3389
3964
  }, "weekStart");
3390
3965
  var dayKey = /* @__PURE__ */ __name((at, format) => {
3391
- const parts = Object.fromEntries(format.formatToParts(new Date(at)).map((part) => [part.type, part.value]));
3392
- return `${parts.year}-${parts.month}-${parts.day}`;
3966
+ const parts2 = Object.fromEntries(format.formatToParts(new Date(at)).map((part) => [part.type, part.value]));
3967
+ return `${parts2.year}-${parts2.month}-${parts2.day}`;
3393
3968
  }, "dayKey");
3394
3969
  var zoneFormat = /* @__PURE__ */ __name((zone) => new Intl.DateTimeFormat("en-US", {
3395
3970
  timeZone: zone,
@@ -3505,160 +4080,17 @@ var aggregateMeetingStats = /* @__PURE__ */ __name((rows, timeZone) => {
3505
4080
  };
3506
4081
  }, "aggregateMeetingStats");
3507
4082
 
3508
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/deals.js
3509
- var DEAL_KINDS = ["deal", "lead"];
3510
- var DEAL_STATUSES = ["open", "won", "lost"];
3511
- var STAGE_OUTCOMES = DEAL_STATUSES;
3512
- var DEAL_ROLES = ["owner", "contact", "decision-maker", "influencer"];
3513
- var dealLine = /* @__PURE__ */ __name((deal) => {
3514
- const money = deal.amount === null || deal.currency === null ? "" : `, ${moneyLabel(deal.amount, deal.currency)}`;
3515
- return `${deal.title} \xB7 ${deal.stage}${money}${deal.status === "open" ? "" : ` (${deal.status})`}`;
3516
- }, "dealLine");
3517
-
3518
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/orders.js
3519
- var ORDER_STATUSES = ["placed", "shipped", "delivered", "cancelled", "returned"];
3520
- var ORDER_PURPOSES = ["personal", "business", "client", "other"];
3521
- var orderLine = /* @__PURE__ */ __name((order) => {
3522
- const money = order.total === null || order.currency === null ? "" : `, ${moneyLabel(order.total, order.currency)}`;
3523
- const notes2 = [order.status, order.review === "confirmed" ? null : order.review].filter(Boolean).join(", ");
3524
- return `${order.number ?? `#${order.id}`} \xB7 ${order.supplierName}${money} (${notes2})`;
3525
- }, "orderLine");
3526
- var orderTitle = /* @__PURE__ */ __name((order) => `Order ${orderLine(order)}`, "orderTitle");
4083
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/meetings/store.js
4084
+ var READ_BUDGET_EXCEEDED = "Meeting search exceeds its stored text byte budget";
3527
4085
 
3528
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/store/source-review.js
4086
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/store/source-review.js
3529
4087
  var SOURCE_REVIEW_KIND = "memory_source_review";
3530
4088
  var SOURCE_REVIEW_CAUSES = ["changed", "outdated", "deleted", "contradicted"];
3531
4089
  var ERASED_TEXT = "[source erased]";
3532
4090
  var severity = /* @__PURE__ */ __name((cause) => SOURCE_REVIEW_CAUSES.indexOf(cause), "severity");
3533
4091
  var graver = /* @__PURE__ */ __name((a, b) => severity(b) > severity(a) ? b : a, "graver");
3534
4092
 
3535
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/relations.js
3536
- var ORGANIZATION_ROLES = [
3537
- "employee",
3538
- "contractor",
3539
- "founder",
3540
- "owner",
3541
- "manager",
3542
- "adviser",
3543
- "contact"
3544
- ];
3545
- var PROJECT_ROLES = ["owner", "manager", "contributor", "client-contact", "approver"];
3546
- var ENGAGEMENT_LEVELS = ["none", "low", "medium", "high"];
3547
- var isEngagement = /* @__PURE__ */ __name((value) => typeof value === "string" && ENGAGEMENT_LEVELS.includes(value), "isEngagement");
3548
- var checkEngagement = /* @__PURE__ */ __name((kind, from, to, level) => {
3549
- if (kind !== "member-of" || from !== "person" || to !== "project")
3550
- throw new CliError("validation_error", "an engagement level is set only on a person's member-of a project", {
3551
- reason: "relationship.engagement-ends"
3552
- });
3553
- if (!isEngagement(level))
3554
- throw new CliError("validation_error", `an engagement level is one of ${ENGAGEMENT_LEVELS.join(", ")}`, {
3555
- reason: "relationship.engagement-unknown"
3556
- });
3557
- return level;
3558
- }, "checkEngagement");
3559
- var RELATIONS = {
3560
- "member-of": {
3561
- from: ["person", "organization", "project", "chat", "email_thread"],
3562
- to: ["organization", "project"],
3563
- roles: { to: { organization: ORGANIZATION_ROLES, project: PROJECT_ROLES } }
3564
- },
3565
- "reports-to": { from: ["person"], to: ["person"], inverse: "manages" },
3566
- "customer-of": { from: ["person", "organization"], to: ["organization"], inverse: "supplier of" },
3567
- "partner-of": { from: ["organization"], to: ["organization"], symmetric: true },
3568
- "related-to": {
3569
- from: ["person", "organization", "project", "task", "deal", "lead"],
3570
- to: ["person", "organization", "project", "task"],
3571
- roles: { from: { deal: DEAL_ROLES, lead: DEAL_ROLES } }
3572
- }
3573
- };
3574
- var RELATION_KINDS = Object.keys(RELATIONS);
3575
- var specOf = /* @__PURE__ */ __name((kind) => Object.hasOwn(RELATIONS, kind) ? RELATIONS[kind] : void 0, "specOf");
3576
- var isRelationKind = /* @__PURE__ */ __name((kind) => specOf(kind) !== void 0, "isRelationKind");
3577
- var memberOnly = /* @__PURE__ */ __name((type) => type === "chat" || type === "email_thread", "memberOnly");
3578
- var checkEnds = /* @__PURE__ */ __name((kind, from, to) => {
3579
- const spec = specOf(kind);
3580
- if (!spec)
3581
- throw new CliError("validation_error", `a relationship's kind is one of ${RELATION_KINDS.join(", ")}`);
3582
- if (memberOnly(from) && (kind !== "member-of" || to !== "project"))
3583
- throw new CliError("validation_error", `a ${from === "chat" ? "chat" : "mail thread"} is related only as member-of a project`);
3584
- if (!spec.from.includes(from) || !spec.to.includes(to))
3585
- throw new CliError("validation_error", `${kind} joins ${spec.from.join(", ")} to ${spec.to.join(", ")}, not ${from} to ${to}`);
3586
- return spec;
3587
- }, "checkEnds");
3588
- var rolesOf = /* @__PURE__ */ __name((kind, from, to) => {
3589
- const spec = specOf(kind);
3590
- if (kind === "member-of" && from !== "person")
3591
- return void 0;
3592
- return spec?.roles?.from?.[from] ?? spec?.roles?.to?.[to];
3593
- }, "rolesOf");
3594
- var ROLE_LISTS = { organization: ORGANIZATION_ROLES, project: PROJECT_ROLES, deal: DEAL_ROLES };
3595
- var roleListOf = /* @__PURE__ */ __name((kind, from, to) => {
3596
- const roles = rolesOf(kind, from, to);
3597
- return Object.keys(ROLE_LISTS).find((list) => ROLE_LISTS[list] === roles);
3598
- }, "roleListOf");
3599
- var checkRole = /* @__PURE__ */ __name((kind, from, to, role, extra = []) => {
3600
- const roles = rolesOf(kind, from, to)?.concat(extra);
3601
- if (roles && !roles.includes(role))
3602
- throw new CliError("validation_error", `a ${from}'s role on ${kind} ${to} is one of ${roles.join(", ")}`, {
3603
- reason: "relationship.role-unknown"
3604
- });
3605
- return role;
3606
- }, "checkRole");
3607
- var isSymmetric = /* @__PURE__ */ __name((kind) => specOf(kind)?.symmetric === true, "isSymmetric");
3608
- var inverseOf = /* @__PURE__ */ __name((kind) => specOf(kind)?.symmetric ? kind : specOf(kind)?.inverse ?? null, "inverseOf");
3609
- var STANDINGS = ["confirmed", "reported", "proposed", "ended"];
3610
- var standingOf = /* @__PURE__ */ __name((link, now) => {
3611
- if (link.endsAt != null && link.endsAt <= now)
3612
- return "ended";
3613
- if (link.confirmed)
3614
- return "confirmed";
3615
- if (link.deletedAt != null)
3616
- return "ended";
3617
- return link.accountId != null ? "reported" : "proposed";
3618
- }, "standingOf");
3619
- var isUsable = /* @__PURE__ */ __name((standing) => standing === "confirmed" || standing === "reported", "isUsable");
3620
- var notOverriddenSql = /* @__PURE__ */ __name((alias) => `NOT EXISTS (SELECT 1 FROM links override WHERE override.kind = ${alias}.kind AND override.from_type = ${alias}.from_type AND override.from_id = ${alias}.from_id AND override.to_type = ${alias}.to_type AND override.to_id = ${alias}.to_id AND json_extract(override.metadata, '$.overrides') = ${alias}.id)`, "notOverriddenSql");
3621
- var usableLinkSql = /* @__PURE__ */ __name((alias, now) => `(${alias}.confirmed = 1 OR (${alias}.account_id IS NOT NULL AND ${alias}.deleted_at IS NULL))` + (now === void 0 ? "" : ` AND (${alias}.ends_at IS NULL OR ${alias}.ends_at > ${Math.trunc(now)})`), "usableLinkSql");
3622
-
3623
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/tags.js
3624
- var TAG_TYPES = ["chat", "contact", "message", "task"];
3625
- var TAG = /^[a-z0-9-]{1,32}$/;
3626
- var tagOf = /* @__PURE__ */ __name((value) => {
3627
- const tag = value.trim().toLowerCase();
3628
- return TAG.test(tag) ? tag : void 0;
3629
- }, "tagOf");
3630
- var normalizeTag = /* @__PURE__ */ __name((value) => {
3631
- const tag = tagOf(value);
3632
- if (tag === void 0)
3633
- throw new CliError("validation_error", `"${singleLine(value)}" is not a tag \u2014 use 1\u201332 letters a\u2013z, digits and hyphens`, { reason: "tag.invalid" });
3634
- return tag;
3635
- }, "normalizeTag");
3636
-
3637
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/store/sqlite/link-kinds.js
3638
- var LINK_KINDS = [
3639
- "links-to",
3640
- "blocked-by",
3641
- "follow-up-of",
3642
- "about",
3643
- "member-of",
3644
- "labelled",
3645
- "answered-by",
3646
- "evidence",
3647
- "created-from",
3648
- "duplicate-of",
3649
- "related-to",
3650
- "reports-to",
3651
- "customer-of",
3652
- "partner-of",
3653
- "assigned-to",
3654
- "attached"
3655
- ];
3656
- var LINK_ORIGINS = ["file", "owner", "suggested", "message"];
3657
- var LINK_SOURCES = [...LINK_ORIGINS, "calendar"];
3658
- var linkKind = /* @__PURE__ */ __name((kind) => `'${kind}'`, "linkKind");
3659
- var COUNTERPART_ROLE = "counterpart";
3660
-
3661
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/tasks/model.js
4093
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/tasks/model.js
3662
4094
  var TASK_KINDS = ["question", "request", "mention", "promise"];
3663
4095
  var TASK_STATES = ["open", "todo", "in_progress", "done", "dismissed"];
3664
4096
  var CLOSED_STATES = ["done", "dismissed"];
@@ -3673,13 +4105,13 @@ function closeTask(task, state, by, at, reason) {
3673
4105
  }
3674
4106
  __name(closeTask, "closeTask");
3675
4107
 
3676
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/tasks/store.js
4108
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/tasks/store.js
3677
4109
  function matches2(task, filter) {
3678
4110
  return (filter.account === void 0 || task.account === filter.account) && (filter.state === void 0 || task.state === filter.state) && (filter.group === void 0 || task.group === filter.group) && (filter.kind === void 0 || task.kind === filter.kind) && (filter.createdBefore === void 0 || task.createdAt < filter.createdBefore);
3679
4111
  }
3680
4112
  __name(matches2, "matches");
3681
4113
 
3682
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/tasks/priority.js
4114
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/tasks/priority.js
3683
4115
  var PRIORITY_LABELS = ["low", "medium", "high", "critical"];
3684
4116
  var MIDDLE = { low: 0.125, medium: 0.375, high: 0.625, critical: 0.875 };
3685
4117
  var LEGACY_PRIORITY_SCORES = [0.875, 0.625, 0.375, 0.1875, 0.0625];
@@ -3708,7 +4140,7 @@ var priorityOf = /* @__PURE__ */ __name((value) => {
3708
4140
  }, "priorityOf");
3709
4141
  var priorityOption = /* @__PURE__ */ __name((value) => priorityOf(value) ?? "none", "priorityOption");
3710
4142
 
3711
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/tasks/service.js
4143
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/tasks/service.js
3712
4144
  function createTaskService({ store, now = /* @__PURE__ */ __name(() => /* @__PURE__ */ new Date(), "now"), newId = /* @__PURE__ */ __name(() => crypto.randomUUID(), "newId") }) {
3713
4145
  async function find(id4) {
3714
4146
  const task = await store.get(id4);
@@ -3768,7 +4200,7 @@ function median(values) {
3768
4200
  }
3769
4201
  __name(median, "median");
3770
4202
 
3771
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/knowledge.js
4203
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/domain/knowledge.js
3772
4204
  var FACT_STATUSES = ["proposed", "accepted", "superseded", "reversed", "rejected"];
3773
4205
  var MEMORY_KINDS = ["summary", "digest", "preference"];
3774
4206
  var MEMORY_STATUSES = ["proposed", "confirmed", "stale", "superseded"];
@@ -3776,10 +4208,743 @@ var MEMORY_SCOPES = ["personal", "work"];
3776
4208
  var WORK_TASK_TYPES = ["bug", "feature", "chore"];
3777
4209
  var TASK_TYPES2 = [...WORK_TASK_TYPES, ...TASK_KINDS];
3778
4210
 
3779
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/entities/fields.js
3780
- var text5 = string();
3781
- var id3 = pipe(string(), minLength(1));
3782
- var time = isoTime;
4211
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/domain/deals.js
4212
+ var DEAL_KINDS = ["deal", "lead"];
4213
+ var DEAL_STATUSES = ["open", "won", "lost"];
4214
+ var STAGE_OUTCOMES = DEAL_STATUSES;
4215
+ var DEAL_ROLES = ["owner", "contact", "decision-maker", "influencer"];
4216
+ var dealLine = /* @__PURE__ */ __name((deal) => {
4217
+ const money = deal.amount === null || deal.currency === null ? "" : `, ${moneyLabel(deal.amount, deal.currency)}`;
4218
+ return `${deal.title} \xB7 ${deal.stage}${money}${deal.status === "open" ? "" : ` (${deal.status})`}`;
4219
+ }, "dealLine");
4220
+
4221
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/domain/orders.js
4222
+ var ORDER_STATUSES = ["placed", "shipped", "delivered", "cancelled", "returned"];
4223
+ var ORDER_PURPOSES = ["personal", "business", "client", "other"];
4224
+ var orderLine = /* @__PURE__ */ __name((order) => {
4225
+ const party = order.direction === "sale" && order.customerName !== null ? `to ${order.customerName}` : order.supplierName;
4226
+ const money = order.total === null || order.currency === null ? "" : `, ${moneyLabel(order.total, order.currency)}`;
4227
+ const notes2 = [order.status, order.review === "confirmed" ? null : order.review].filter(Boolean).join(", ");
4228
+ return `${order.number ?? `#${order.id}`} \xB7 ${party}${money} (${notes2})`;
4229
+ }, "orderLine");
4230
+ var orderTitle = /* @__PURE__ */ __name((order) => `Order ${orderLine(order)}`, "orderTitle");
4231
+
4232
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/domain/relations.js
4233
+ var ORGANIZATION_ROLES = [
4234
+ "employee",
4235
+ "contractor",
4236
+ "founder",
4237
+ "owner",
4238
+ "manager",
4239
+ "adviser",
4240
+ "contact"
4241
+ ];
4242
+ var PROJECT_ROLES = ["owner", "manager", "contributor", "client-contact", "approver"];
4243
+ var CONTRACT_ROLES = ["customer", "supplier", "signatory", "guarantor"];
4244
+ var ENGAGEMENT_LEVELS = ["none", "low", "medium", "high"];
4245
+ var isEngagement = /* @__PURE__ */ __name((value) => typeof value === "string" && ENGAGEMENT_LEVELS.includes(value), "isEngagement");
4246
+ var checkEngagement = /* @__PURE__ */ __name((kind2, from, to, level) => {
4247
+ if (kind2 !== "member-of" || from !== "person" || to !== "project")
4248
+ throw new CliError("validation_error", "an engagement level is set only on a person's member-of a project", {
4249
+ reason: "relationship.engagement-ends"
4250
+ });
4251
+ if (!isEngagement(level))
4252
+ throw new CliError("validation_error", `an engagement level is one of ${ENGAGEMENT_LEVELS.join(", ")}`, {
4253
+ reason: "relationship.engagement-unknown"
4254
+ });
4255
+ return level;
4256
+ }, "checkEngagement");
4257
+ var RELATIONS = {
4258
+ "member-of": {
4259
+ from: ["person", "organization", "project", "chat", "email_thread"],
4260
+ to: ["organization", "project"],
4261
+ roles: { to: { organization: ORGANIZATION_ROLES, project: PROJECT_ROLES } }
4262
+ },
4263
+ "reports-to": { from: ["person"], to: ["person"], inverse: "manages" },
4264
+ "customer-of": { from: ["person", "organization"], to: ["organization"], inverse: "supplier of" },
4265
+ "partner-of": { from: ["organization"], to: ["organization"], symmetric: true },
4266
+ "related-to": {
4267
+ from: ["person", "organization", "project", "task", "deal", "lead", "contract"],
4268
+ to: ["person", "organization", "project", "task"],
4269
+ roles: { from: { deal: DEAL_ROLES, lead: DEAL_ROLES, contract: CONTRACT_ROLES } }
4270
+ }
4271
+ };
4272
+ var RELATION_KINDS = Object.keys(RELATIONS);
4273
+ var specOf = /* @__PURE__ */ __name((kind2) => Object.hasOwn(RELATIONS, kind2) ? RELATIONS[kind2] : void 0, "specOf");
4274
+ var isRelationKind = /* @__PURE__ */ __name((kind2) => specOf(kind2) !== void 0, "isRelationKind");
4275
+ var memberOnly = /* @__PURE__ */ __name((type) => type === "chat" || type === "email_thread", "memberOnly");
4276
+ var partyOnly = /* @__PURE__ */ __name((from, to) => from === "contract" && to !== "person" && to !== "organization", "partyOnly");
4277
+ var checkEnds = /* @__PURE__ */ __name((kind2, from, to) => {
4278
+ const spec = specOf(kind2);
4279
+ if (!spec)
4280
+ throw new CliError("validation_error", `a relationship's kind is one of ${RELATION_KINDS.join(", ")}`);
4281
+ if (memberOnly(from) && (kind2 !== "member-of" || to !== "project"))
4282
+ throw new CliError("validation_error", `a ${from === "chat" ? "chat" : "mail thread"} is related only as member-of a project`);
4283
+ if (partyOnly(from, to))
4284
+ throw new CliError("validation_error", "a contract is related only to a person or an organization");
4285
+ if (!spec.from.includes(from) || !spec.to.includes(to))
4286
+ throw new CliError("validation_error", `${kind2} joins ${spec.from.join(", ")} to ${spec.to.join(", ")}, not ${from} to ${to}`);
4287
+ return spec;
4288
+ }, "checkEnds");
4289
+ var rolesOf = /* @__PURE__ */ __name((kind2, from, to) => {
4290
+ const spec = specOf(kind2);
4291
+ if (kind2 === "member-of" && from !== "person")
4292
+ return void 0;
4293
+ return spec?.roles?.from?.[from] ?? spec?.roles?.to?.[to];
4294
+ }, "rolesOf");
4295
+ var ROLE_LISTS = {
4296
+ organization: ORGANIZATION_ROLES,
4297
+ project: PROJECT_ROLES,
4298
+ deal: DEAL_ROLES,
4299
+ contract: CONTRACT_ROLES
4300
+ };
4301
+ var roleListOf = /* @__PURE__ */ __name((kind2, from, to) => {
4302
+ const roles = rolesOf(kind2, from, to);
4303
+ return Object.keys(ROLE_LISTS).find((list) => ROLE_LISTS[list] === roles);
4304
+ }, "roleListOf");
4305
+ var checkRole = /* @__PURE__ */ __name((kind2, from, to, role, extra = []) => {
4306
+ const roles = rolesOf(kind2, from, to)?.concat(extra);
4307
+ if (roles && !roles.includes(role))
4308
+ throw new CliError("validation_error", `a ${from}'s role on ${kind2} ${to} is one of ${roles.join(", ")}`, {
4309
+ reason: "relationship.role-unknown"
4310
+ });
4311
+ return role;
4312
+ }, "checkRole");
4313
+ var isSymmetric = /* @__PURE__ */ __name((kind2) => specOf(kind2)?.symmetric === true, "isSymmetric");
4314
+ var inverseOf = /* @__PURE__ */ __name((kind2) => specOf(kind2)?.symmetric ? kind2 : specOf(kind2)?.inverse ?? null, "inverseOf");
4315
+ var STANDINGS = ["confirmed", "reported", "proposed", "ended"];
4316
+ var standingOf = /* @__PURE__ */ __name((link, now) => {
4317
+ if (link.endsAt != null && link.endsAt <= now)
4318
+ return "ended";
4319
+ if (link.confirmed)
4320
+ return "confirmed";
4321
+ if (link.deletedAt != null)
4322
+ return "ended";
4323
+ return link.accountId != null ? "reported" : "proposed";
4324
+ }, "standingOf");
4325
+ var isUsable = /* @__PURE__ */ __name((standing) => standing === "confirmed" || standing === "reported", "isUsable");
4326
+ var KEYED = "kind IN ('member-of', 'related-to', 'reports-to', 'customer-of', 'partner-of') AND to_id IS NOT NULL";
4327
+ var notOverriddenSql = /* @__PURE__ */ __name((alias) => `NOT EXISTS (SELECT 1 FROM links override WHERE ${KEYED} AND override.kind = ${alias}.kind AND override.from_type = ${alias}.from_type AND override.from_id = ${alias}.from_id AND override.to_type = ${alias}.to_type AND override.to_id = ${alias}.to_id AND json_extract(override.metadata, '$.overrides') = ${alias}.id)`, "notOverriddenSql");
4328
+ var usableLinkSql = /* @__PURE__ */ __name((alias, now) => `(${alias}.confirmed = 1 OR (${alias}.account_id IS NOT NULL AND ${alias}.deleted_at IS NULL))` + (now === void 0 ? "" : ` AND (${alias}.ends_at IS NULL OR ${alias}.ends_at > ${Math.trunc(now)})`), "usableLinkSql");
4329
+
4330
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/domain/tags.js
4331
+ var TAG_TYPES = ["chat", "contact", "message", "task"];
4332
+ var TAG = /^[a-z0-9-]{1,32}$/;
4333
+ var tagOf = /* @__PURE__ */ __name((value) => {
4334
+ const tag = value.trim().toLowerCase();
4335
+ return TAG.test(tag) ? tag : void 0;
4336
+ }, "tagOf");
4337
+ var normalizeTag = /* @__PURE__ */ __name((value) => {
4338
+ const tag = tagOf(value);
4339
+ if (tag === void 0)
4340
+ throw new CliError("validation_error", `"${singleLine(value)}" is not a tag \u2014 use 1\u201332 letters a\u2013z, digits and hyphens`, { reason: "tag.invalid" });
4341
+ return tag;
4342
+ }, "normalizeTag");
4343
+
4344
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/store/sqlite/link-source.js
4345
+ var REPORTER_SQL = "(SELECT provider || ':' || external_id FROM accounts r WHERE r.id = links.account_id) AS reporter";
4346
+ var sourceOf = /* @__PURE__ */ __name((database, row, metadata) => {
4347
+ const reporter = row.account_id == null ? void 0 : "reporter" in row ? row.reporter : database.prepare("SELECT provider || ':' || external_id AS key FROM accounts WHERE id = ?").get(Number(row.account_id))?.key;
4348
+ return {
4349
+ ...typeof reporter === "string" ? { account: reporter } : {},
4350
+ ...typeof metadata.derived === "string" ? { derived: metadata.derived } : {}
4351
+ };
4352
+ }, "sourceOf");
4353
+
4354
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/store/sqlite/link-kinds.js
4355
+ var LINK_KINDS = [
4356
+ "links-to",
4357
+ "blocked-by",
4358
+ "follow-up-of",
4359
+ "about",
4360
+ "member-of",
4361
+ "labelled",
4362
+ "answered-by",
4363
+ "evidence",
4364
+ "created-from",
4365
+ "duplicate-of",
4366
+ "related-to",
4367
+ "reports-to",
4368
+ "customer-of",
4369
+ "partner-of",
4370
+ "assigned-to",
4371
+ "attached"
4372
+ ];
4373
+ var LINK_ORIGINS = ["file", "owner", "suggested", "message"];
4374
+ var LINK_SOURCES = [...LINK_ORIGINS, "calendar"];
4375
+ var linkKind = /* @__PURE__ */ __name((kind2) => `'${kind2}'`, "linkKind");
4376
+ var COUNTERPART_ROLE = "counterpart";
4377
+
4378
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/domain/locator.js
4379
+ var SCHEME = "msg:";
4380
+ var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat, message }) => SCHEME + [provider, account, chat, message].map(encodeURIComponent).join("/"), "formatLocator");
4381
+ var isLocator = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith(SCHEME), "isLocator");
4382
+ var parseLocator = /* @__PURE__ */ __name((reference2) => {
4383
+ const trimmed = reference2.trim();
4384
+ const parts2 = trimmed.startsWith(SCHEME) ? trimmed.slice(SCHEME.length).split("/") : [];
4385
+ if (parts2.length !== 4 || parts2.some((part) => part === "")) {
4386
+ throw new CliError("validation_error", `"${singleLine(reference2)}" is not a message locator \u2014 expected msg:<provider>/<account>/<chat>/<message>`);
4387
+ }
4388
+ const [provider, account, chat, message] = parts2.map(decodeURIComponent);
4389
+ return { provider, account, chat, message };
4390
+ }, "parseLocator");
4391
+
4392
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/domain/references.js
4393
+ var SIMPLE_REFERENCES = [
4394
+ "note",
4395
+ "document",
4396
+ "person",
4397
+ "organization",
4398
+ "project",
4399
+ "task",
4400
+ "memory",
4401
+ "fact",
4402
+ "bot",
4403
+ "event",
4404
+ "invoice",
4405
+ "payment",
4406
+ "order",
4407
+ "deal",
4408
+ "lead",
4409
+ "pipeline",
4410
+ "product",
4411
+ "contract",
4412
+ "subscription",
4413
+ "wallet",
4414
+ "transaction",
4415
+ "entity"
4416
+ ];
4417
+ var malformed = /* @__PURE__ */ __name((text6, shape) => new CliError("validation_error", `"${singleLine(text6)}" is not a reference \u2014 expected ${shape}`, {
4418
+ reason: "ref.malformed"
4419
+ }), "malformed");
4420
+ var parts = /* @__PURE__ */ __name((rest, count7, text6, shape) => {
4421
+ const split = rest.split("/");
4422
+ if (split.length !== count7 || split.some((part) => part === ""))
4423
+ throw malformed(text6, shape);
4424
+ return split.map(decodeURIComponent);
4425
+ }, "parts");
4426
+ var encoded = /* @__PURE__ */ __name((...values) => values.map(encodeURIComponent).join("/"), "encoded");
4427
+ var folderPath = /* @__PURE__ */ __name((path) => {
4428
+ const clean = path.split("/").filter((part) => part !== "" && part !== ".").join("/");
4429
+ return clean === "" ? path.trim() === "" ? "" : null : clean;
4430
+ }, "folderPath");
4431
+ var MEETING_SHAPE = "meeting:<account>/<meeting>[/<transcript>[/<cue>]] with safe integer ids";
4432
+ var kind = /* @__PURE__ */ __name((spec) => spec, "kind");
4433
+ var simple = /* @__PURE__ */ __name((prefix) => kind({
4434
+ prefix,
4435
+ type: prefix,
4436
+ shape: `${prefix}:<id>`,
4437
+ parse: /* @__PURE__ */ __name((rest, text6) => {
4438
+ if (!rest.trim())
4439
+ throw new CliError("validation_error", `"${singleLine(text6)}" names no ${prefix}`, {
4440
+ reason: "ref.malformed"
4441
+ });
4442
+ return { type: prefix, id: rest };
4443
+ }, "parse"),
4444
+ format: /* @__PURE__ */ __name((reference2) => `${reference2.type}:${reference2.id}`, "format")
4445
+ }), "simple");
4446
+ var REF_KINDS = [
4447
+ kind({
4448
+ prefix: "msg",
4449
+ type: "message",
4450
+ shape: "msg:<provider>/<account>/<chat>/<message>",
4451
+ parse: /* @__PURE__ */ __name((_, text6) => {
4452
+ try {
4453
+ return { type: "message", ...parseLocator(text6) };
4454
+ } catch {
4455
+ throw malformed(text6, "msg:<provider>/<account>/<chat>/<message>");
4456
+ }
4457
+ }, "parse"),
4458
+ format: formatLocator
4459
+ }),
4460
+ kind({
4461
+ prefix: "chat",
4462
+ type: "chat",
4463
+ shape: "chat:<provider>/<account>/<chat>",
4464
+ parse: /* @__PURE__ */ __name((rest, text6) => {
4465
+ const [provider, account, chat] = parts(rest, 3, text6, "chat:<provider>/<account>/<chat>");
4466
+ return { type: "chat", provider, account, chat };
4467
+ }, "parse"),
4468
+ format: /* @__PURE__ */ __name(({ provider, account, chat }) => `chat:${encoded(provider, account, chat)}`, "format")
4469
+ }),
4470
+ kind({
4471
+ prefix: "contact",
4472
+ type: "contact",
4473
+ shape: "contact:<provider>/<id>",
4474
+ parse: /* @__PURE__ */ __name((rest, text6) => {
4475
+ const [provider, id4] = parts(rest, 2, text6, "contact:<provider>/<id>");
4476
+ return { type: "contact", provider, id: id4 };
4477
+ }, "parse"),
4478
+ format: /* @__PURE__ */ __name(({ provider, id: id4 }) => `contact:${encoded(provider, id4)}`, "format")
4479
+ }),
4480
+ kind({
4481
+ prefix: "folder",
4482
+ type: "folder",
4483
+ shape: "folder:<id>[/<path>]",
4484
+ parse: /* @__PURE__ */ __name((rest, text6) => {
4485
+ const slash = rest.indexOf("/");
4486
+ const id4 = decodeURIComponent(slash < 0 ? rest : rest.slice(0, slash));
4487
+ const path = slash < 0 ? null : folderPath(decodeURIComponent(rest.slice(slash + 1)));
4488
+ if (!id4.trim() || path === "")
4489
+ throw malformed(text6, "folder:<id>[/<path>]");
4490
+ return { type: "folder", id: id4, path };
4491
+ }, "parse"),
4492
+ format: /* @__PURE__ */ __name(({ id: id4, path }) => path === null ? `folder:${encodeURIComponent(id4)}` : `folder:${encoded(id4, path)}`, "format")
4493
+ }),
4494
+ kind({
4495
+ prefix: "meeting",
4496
+ type: "meeting",
4497
+ shape: MEETING_SHAPE,
4498
+ parse: /* @__PURE__ */ __name((_, text6) => {
4499
+ try {
4500
+ return parseMeetingReference(text6);
4501
+ } catch {
4502
+ throw malformed(text6, MEETING_SHAPE);
4503
+ }
4504
+ }, "parse"),
4505
+ format: formatMeetingReference
4506
+ }),
4507
+ ...SIMPLE_REFERENCES.map(simple)
4508
+ ];
4509
+ var byPrefix = new Map(REF_KINDS.map((spec) => [spec.prefix, spec]));
4510
+ var byType = new Map(REF_KINDS.map((spec) => [spec.type, spec]));
4511
+ var offered = REF_KINDS.map(({ prefix }) => prefix).filter((prefix) => prefix !== "entity");
4512
+ var distance = /* @__PURE__ */ __name((a, b) => {
4513
+ let row = Array.from({ length: b.length + 1 }, (_, at) => at);
4514
+ for (const [i, x] of [...a].entries()) {
4515
+ const next = [i + 1];
4516
+ for (const [j, y] of [...b].entries())
4517
+ next.push(Math.min(row[j + 1] + 1, next[j] + 1, row[j] + (x === y ? 0 : 1)));
4518
+ row = next;
4519
+ }
4520
+ return row[b.length];
4521
+ }, "distance");
4522
+ var nearest = /* @__PURE__ */ __name((typed) => offered.find((prefix) => typed.length >= 2 && prefix.startsWith(typed)) ?? offered.map((prefix) => ({ prefix, far: distance(typed, prefix) })).filter(({ far }) => far <= 2).sort((a, b) => a.far - b.far)[0]?.prefix, "nearest");
4523
+ var unknownKind = /* @__PURE__ */ __name((text6, prefix, rest) => {
4524
+ const near2 = prefix === "" ? void 0 : nearest(prefix);
4525
+ const kinds = offered.map((one) => `${one}:`).join(", ");
4526
+ const hint = near2 === void 0 ? `; kinds: ${kinds}` : `; did you mean ${near2}:${singleLine(rest)}? Kinds: ${kinds}`;
4527
+ return new CliError("validation_error", `"${singleLine(text6)}" is no kind of reference${hint}`, {
4528
+ reason: "ref.unknown-kind"
4529
+ });
4530
+ }, "unknownKind");
4531
+ var formatReference = /* @__PURE__ */ __name((reference2) => byType.get(reference2.type).format(reference2), "formatReference");
4532
+ var parseReference = /* @__PURE__ */ __name((text6) => {
4533
+ const reference2 = text6.trim();
4534
+ const colon = reference2.indexOf(":");
4535
+ const prefix = colon < 0 ? "" : reference2.slice(0, colon);
4536
+ const rest = reference2.slice(colon + 1);
4537
+ const spec = byPrefix.get(prefix);
4538
+ if (!spec)
4539
+ throw unknownKind(reference2, prefix, rest);
4540
+ return spec.parse(rest, reference2);
4541
+ }, "parseReference");
4542
+ var canonicalReference = /* @__PURE__ */ __name((text6) => formatReference(parseReference(text6)), "canonicalReference");
4543
+ var looksLikeReference = /* @__PURE__ */ __name((text6) => {
4544
+ const match = /^([a-z]+):\S+$/.exec(text6.trim());
4545
+ return match !== null && byPrefix.has(match[1]);
4546
+ }, "looksLikeReference");
4547
+
4548
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/domain/providers.js
4549
+ var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events", "crm"];
4550
+ var MESSENGER_OPENS = { chat: "messages list", message: "messages show", contact: "contacts show" };
4551
+ var PROVIDERS = [
4552
+ { name: "telegram", kind: "messages", aliases: ["tg"], command: "tg", opens: MESSENGER_OPENS },
4553
+ { name: "telegram-bot", kind: "messages", aliases: ["tg-bot"] },
4554
+ { name: "max", kind: "messages", aliases: [], command: "max", opens: MESSENGER_OPENS },
4555
+ { name: "max-bot", kind: "messages", aliases: [] },
4556
+ { name: "whatsapp", kind: "messages", aliases: ["wa"], command: "wa", opens: MESSENGER_OPENS },
4557
+ { name: "whatsapp-bot", kind: "messages", aliases: ["wa-bot"] },
4558
+ { name: "email", kind: "mail", aliases: [] },
4559
+ { name: "notes", kind: "notes", aliases: [] },
4560
+ { name: "local", kind: "notes", aliases: [] },
4561
+ { name: "obsidian", kind: "notes", aliases: [] },
4562
+ { name: "added", kind: "notes", aliases: [] },
4563
+ { name: "zoom", kind: "meetings", aliases: [] },
4564
+ // A phone export's records: its SMS and its calls in the one account the import names.
4565
+ { name: "phone", kind: "messages", kinds: ["messages", "events"], aliases: [], imported: true }
4566
+ ];
4567
+ var LABELS = {
4568
+ telegram: "Telegram",
4569
+ "telegram-bot": "Telegram bot",
4570
+ max: "MAX",
4571
+ "max-bot": "MAX bot",
4572
+ whatsapp: "WhatsApp",
4573
+ "whatsapp-bot": "WhatsApp bot",
4574
+ "google-drive": "Google Drive",
4575
+ added: "added by hand",
4576
+ email: "mail"
4577
+ };
4578
+ var providerLabel = /* @__PURE__ */ __name((provider) => LABELS[provider] ?? provider, "providerLabel");
4579
+ var FOLDER_PROVIDERS = ["local", "obsidian", "folder"];
4580
+ var isFolderProvider = /* @__PURE__ */ __name((provider) => FOLDER_PROVIDERS.includes(provider), "isFolderProvider");
4581
+ var folderProviderSql = /* @__PURE__ */ __name((column = "provider") => `${column} IN (${FOLDER_PROVIDERS.map((name) => `'${name}'`).join(", ")})`, "folderProviderSql");
4582
+ var folderProviderOf = /* @__PURE__ */ __name((format) => format === "markdown" ? "local" : "obsidian", "folderProviderOf");
4583
+ var DOCUMENT_ACCOUNT_PROVIDERS = ["google-drive"];
4584
+ var isDocumentAccountProvider = /* @__PURE__ */ __name((provider) => DOCUMENT_ACCOUNT_PROVIDERS.includes(provider), "isDocumentAccountProvider");
4585
+ var ADDED_PROVIDER = "added";
4586
+ var ADDED_ACCOUNT = "owner";
4587
+ var notAdded = `d.account_id NOT IN (SELECT id FROM accounts WHERE provider = '${ADDED_PROVIDER}')`;
4588
+ var filesAccountSql = /* @__PURE__ */ __name((column = "provider") => `${column} IN (${[...FOLDER_PROVIDERS, ...DOCUMENT_ACCOUNT_PROVIDERS, ADDED_PROVIDER].map((name) => `'${name}'`).join(", ")})`, "filesAccountSql");
4589
+ var INTERNAL_NOTES = "internal";
4590
+ var UNKNOWN_PROVIDER = "unknown provider \u2014 run its CLI once";
4591
+ var WORD = /^[a-z0-9][a-z0-9_-]*$/;
4592
+ var invalid5 = /* @__PURE__ */ __name((message) => {
4593
+ throw new CliError("validation_error", message);
4594
+ }, "invalid");
4595
+ var wordOf = /* @__PURE__ */ __name((value, what) => typeof value === "string" && WORD.test(value) ? value : invalid5(`${what} is lowercase letters, digits, - and _ \u2014 not ${JSON.stringify(value)}`), "wordOf");
4596
+ var OPEN_KINDS = new Set(REF_KINDS.map(({ type }) => type).filter((type) => type !== "entity"));
4597
+ var COMMAND_WORDS = /^[a-z0-9][a-z0-9_-]*( [a-z0-9][a-z0-9_-]*)*$/;
4598
+ var opensOf = /* @__PURE__ */ __name((value, named) => {
4599
+ if (typeof value !== "object" || value === null || Array.isArray(value))
4600
+ return invalid5(`provider ${named}'s opens maps a kind of reference to a command`);
4601
+ const known = Object.entries(value).filter(([kind2]) => OPEN_KINDS.has(kind2));
4602
+ for (const [kind2, command] of known)
4603
+ if (typeof command !== "string" || !COMMAND_WORDS.test(command))
4604
+ invalid5(`provider ${named} opens a ${kind2} with command words, not ${JSON.stringify(command)}`);
4605
+ return Object.fromEntries(known);
4606
+ }, "opensOf");
4607
+ var providerEntryOf = /* @__PURE__ */ __name((value) => {
4608
+ if (typeof value !== "object" || value === null || Array.isArray(value))
4609
+ return invalid5("a provider entry is an object");
4610
+ const { name, kind: kind2, kinds, aliases = [], command, opens, imported } = value;
4611
+ const named = wordOf(name, "a provider's name");
4612
+ const isKindWord = /* @__PURE__ */ __name((one) => typeof one === "string" && KINDS.includes(one), "isKindWord");
4613
+ const given = kinds === void 0 ? [kind2] : Array.isArray(kinds) && kinds.length > 0 ? kinds : [void 0];
4614
+ for (const one of given)
4615
+ if (!isKindWord(one))
4616
+ invalid5(`provider ${named}'s kind is one of ${KINDS.join(", ")} \u2014 not ${JSON.stringify(one)}`);
4617
+ const list = [...new Set(given)];
4618
+ if (kind2 !== void 0 && kind2 !== list[0])
4619
+ invalid5(`provider ${named}'s kind is the first of its kinds`);
4620
+ if (!Array.isArray(aliases))
4621
+ invalid5(`provider ${named}'s aliases are a list`);
4622
+ if (imported !== void 0 && typeof imported !== "boolean")
4623
+ invalid5(`provider ${named}'s imported is true or false`);
4624
+ return {
4625
+ name: named,
4626
+ kind: list[0],
4627
+ ...list.length > 1 ? { kinds: list } : {},
4628
+ ...imported === true ? { imported: true } : {},
4629
+ aliases: [...new Set(aliases.map((alias) => wordOf(alias, `an alias of ${named}`)))],
4630
+ ...command === void 0 ? {} : { command: wordOf(command, `the command of ${named}`) },
4631
+ ...opens === void 0 ? {} : { opens: opensOf(opens, named) }
4632
+ };
4633
+ }, "providerEntryOf");
4634
+ var kindsOfEntry = /* @__PURE__ */ __name((entry) => entry.kinds ?? [entry.kind], "kindsOfEntry");
4635
+ var describe = /* @__PURE__ */ __name((entry) => `${entry.name} (${kindsOfEntry(entry).join(", ")}${entry.command ? `, from ${entry.command}` : ""})`, "describe");
4636
+ var unitedKinds = /* @__PURE__ */ __name((known, entry) => [
4637
+ .../* @__PURE__ */ new Set([...known, ...entry])
4638
+ ], "unitedKinds");
4639
+ var wordsOf2 = /* @__PURE__ */ __name(({ name, aliases }) => [name, ...aliases], "wordsOf");
4640
+ var joined = /* @__PURE__ */ __name((known, entry) => {
4641
+ const same = known.find(({ name }) => name === entry.name);
4642
+ const kinds = same ? unitedKinds(kindsOfEntry(same), kindsOfEntry(entry)) : kindsOfEntry(entry);
4643
+ if (same && same.kind !== entry.kind)
4644
+ invalid5(`two provider entries disagree on the kind: ${describe(same)} and ${describe(entry)}`);
4645
+ if (same && entry.imported === true && same.imported !== true)
4646
+ invalid5(`provider ${entry.name} is synced, so an entry cannot make it import-only`);
4647
+ const merged = same ? {
4648
+ ...same,
4649
+ ...kinds.length > 1 ? { kinds } : {},
4650
+ aliases: [.../* @__PURE__ */ new Set([...same.aliases, ...entry.aliases])],
4651
+ ...entry.command ? { command: entry.command } : {},
4652
+ ...entry.opens ? { opens: { ...same.opens, ...entry.opens } } : {}
4653
+ } : entry;
4654
+ const others = known.filter((one) => one !== same);
4655
+ for (const word of wordsOf2(merged)) {
4656
+ const owner = others.find((one) => wordsOf2(one).includes(word));
4657
+ if (owner)
4658
+ invalid5(`"${word}" names two providers: ${describe(owner)} and ${describe(merged)}`);
4659
+ }
4660
+ return same ? known.map((one) => one === same ? merged : one) : [...known, merged];
4661
+ }, "joined");
4662
+ var registry = PROVIDERS;
4663
+ var providers = /* @__PURE__ */ __name(() => registry, "providers");
4664
+ var useStoredProviders = /* @__PURE__ */ __name((entries) => {
4665
+ const left = [];
4666
+ registry = entries.reduce((known, entry) => {
4667
+ try {
4668
+ return joined(known, providerEntryOf(entry));
4669
+ } catch (error) {
4670
+ if (!(error instanceof CliError))
4671
+ throw error;
4672
+ left.push(entry);
4673
+ return known;
4674
+ }
4675
+ }, PROVIDERS);
4676
+ return left;
4677
+ }, "useStoredProviders");
4678
+ var addProvider = /* @__PURE__ */ __name((entry) => {
4679
+ registry = joined(registry, providerEntryOf(entry));
4680
+ }, "addProvider");
4681
+ var isKind = /* @__PURE__ */ __name((word) => KINDS.includes(word.toLowerCase()), "isKind");
4682
+ var providerNamed = /* @__PURE__ */ __name((word) => {
4683
+ const wanted = word.toLowerCase();
4684
+ return registry.find((entry) => wordsOf2(entry).includes(wanted));
4685
+ }, "providerNamed");
4686
+ var kindIn = /* @__PURE__ */ __name((provider) => isFolderProvider(provider) ? "notes" : registry.find(({ name }) => name === provider)?.kind, "kindIn");
4687
+ var kindsIn = /* @__PURE__ */ __name((provider) => {
4688
+ if (isFolderProvider(provider))
4689
+ return ["notes"];
4690
+ const entry = registry.find(({ name }) => name === provider);
4691
+ return entry ? kindsOfEntry(entry) : [];
4692
+ }, "kindsIn");
4693
+ var importedOf = /* @__PURE__ */ __name((entry, held) => {
4694
+ const builtIn = PROVIDERS.find(({ name }) => name === entry.name);
4695
+ if (builtIn) {
4696
+ if (entry.imported === true && builtIn.imported !== true)
4697
+ invalid5(`provider ${entry.name} is synced, so an entry cannot make it import-only`);
4698
+ return builtIn.imported === true;
4699
+ }
4700
+ if (held === void 0)
4701
+ return entry.imported === true;
4702
+ if (entry.imported === true && held.imported !== true)
4703
+ invalid5(`provider ${entry.name} was registered without imported: an entry cannot make it import-only later`);
4704
+ return held.imported === true;
4705
+ }, "importedOf");
4706
+ var isImportedProvider = /* @__PURE__ */ __name((provider) => registry.find(({ name }) => name === provider)?.imported === true, "isImportedProvider");
4707
+ var holdsKind = /* @__PURE__ */ __name((provider, kind2) => kindsIn(provider).includes(kind2), "holdsKind");
4708
+ var holdsKindOf = /* @__PURE__ */ __name((provider, kind2) => kindIn(provider) === void 0 ? kind2 === "messages" : holdsKind(provider, kind2), "holdsKindOf");
4709
+ var kindOf2 = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
4710
+
4711
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/search/query.js
4712
+ var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
4713
+ var inSource = /* @__PURE__ */ __name((source, provider) => source === "all" || source === "bots" && isBotProvider(provider) || source === "personal" && !isBotProvider(provider) || source === provider || providerNamed(source)?.name === provider || isKind(source) && holdsKindOf(provider, source), "inSource");
4714
+ var fail = /* @__PURE__ */ __name((message) => {
4715
+ throw new CliError("validation_error", message);
4716
+ }, "fail");
4717
+ var sourceOf2 = /* @__PURE__ */ __name((name, value, providers2) => {
4718
+ const sources = [...providers2, "personal", "bots", "all"];
4719
+ const source = value.toLowerCase();
4720
+ if (sources.includes(source))
4721
+ return source;
4722
+ if (source === "mail")
4723
+ return "email";
4724
+ if (source === "messages")
4725
+ return source;
4726
+ if (isKind(source))
4727
+ fail(`${name}${source} names ${source}, which a message search does not read \u2014 search ${source === "meetings" || source === "events" ? `all --source ${source}` : "notes"} does`);
4728
+ const named = providerNamed(source);
4729
+ if (named && providers2.includes(named.name))
4730
+ return named.name;
4731
+ return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
4732
+ }, "sourceOf");
4733
+
4734
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/search/account-list.js
4735
+ var ACCOUNT_GROUPS = "accountGroups";
4736
+ var ACCOUNT_GROUPS_SETTING = "account_groups";
4737
+ var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
4738
+ var fail2 = /* @__PURE__ */ __name((message) => {
4739
+ throw new CliError("validation_error", message);
4740
+ }, "fail");
4741
+ var isAccountList = /* @__PURE__ */ __name((value) => value.includes(",") || value.includes(":"), "isAccountList");
4742
+ var itemsOf = /* @__PURE__ */ __name((value) => {
4743
+ const items = value.split(",").map((item) => item.trim());
4744
+ if (items.some((item) => item === ""))
4745
+ fail2(`"${value}" has an empty entry \u2014 separate accounts with one comma`);
4746
+ return items;
4747
+ }, "itemsOf");
4748
+ var isGroupName = /* @__PURE__ */ __name((name) => GROUP_NAME.test(name), "isGroupName");
4749
+ var groupName = /* @__PURE__ */ __name((name) => isGroupName(name) ? name : fail2(`a group name is letters, digits, - and _ \u2014 not "${name}"`), "groupName");
4750
+ var groupMembers = /* @__PURE__ */ __name((value) => itemsOf(value).map((item) => item.toLowerCase().startsWith("group:") ? fail2(`a group lists accounts, not other groups \u2014 "${item}"`) : item.includes(":") && item.split(":")[1] === "" ? fail2(`"${item}" names no account after the colon`) : item), "groupMembers");
4751
+ var describe2 = /* @__PURE__ */ __name((accounts) => accounts.map(({ provider, account, name }) => `${provider}:${account}${name ? ` (${name})` : ""}`).join(", "), "describe");
4752
+ var listedHolds = /* @__PURE__ */ __name((account, kind2) => (account.kinds ?? (account.kind === void 0 ? [] : [account.kind])).includes(kind2), "listedHolds");
4753
+ var kindHere = /* @__PURE__ */ __name((provider, running) => provider === running.provider ? kindOf2(provider) : kindIn(provider), "kindHere");
4754
+ var kindsOfHere = /* @__PURE__ */ __name((provider, running) => {
4755
+ const kinds = kindsIn(provider);
4756
+ return { kind: kindHere(provider, running), ...kinds.length > 1 ? { kinds } : {} };
4757
+ }, "kindsOfHere");
4758
+ var heldOf = /* @__PURE__ */ __name((stored, running) => [
4759
+ ...stored.filter(({ provider }) => kindIn(provider) !== "notes" && !isDocumentAccountProvider(provider)).map(({ provider, account, name }) => ({ provider, account, name, ...kindsOfHere(provider, running) })),
4760
+ { provider: "notes", account: INTERNAL_NOTES, name: null, kind: "notes" },
4761
+ ...stored.filter(({ provider }) => isFolderProvider(provider)).map(({ id: id4, name, provider, account }) => ({
4762
+ provider: "notes",
4763
+ account: String(id4),
4764
+ name,
4765
+ kind: "notes",
4766
+ stored: { provider, account }
4767
+ })),
4768
+ ...stored.filter(({ provider }) => isDocumentAccountProvider(provider) || provider === ADDED_PROVIDER).map(({ id: id4, provider, account, name }) => ({
4769
+ provider: "notes",
4770
+ account: String(id4),
4771
+ name,
4772
+ kind: "notes",
4773
+ stored: { provider, account }
4774
+ }))
4775
+ ], "heldOf");
4776
+ var storedAs = /* @__PURE__ */ __name((held, key) => held.filter(({ stored }) => stored?.provider === key.provider && (key.account === "" || stored.account === key.account)), "storedAs");
4777
+ var registry2 = /* @__PURE__ */ __name(() => providers().map(({ name, aliases }) => aliases.length ? `${name} (${aliases.join(", ")})` : name).join(", "), "registry");
4778
+ var providerOf = /* @__PURE__ */ __name((prefix, held, { running, profiles }) => {
4779
+ const wanted = prefix.toLowerCase();
4780
+ if (wanted === running.command?.toLowerCase())
4781
+ return running.provider;
4782
+ const providers2 = [...new Set(held.map(({ provider }) => provider))];
4783
+ if (providers2.includes(wanted) || isDocumentAccountProvider(wanted))
4784
+ return wanted;
4785
+ const named = providerNamed(wanted);
4786
+ if (named)
4787
+ return named.name;
4788
+ const recorded = Object.values(profiles[wanted] ?? {})[0];
4789
+ if (recorded)
4790
+ return recorded.provider;
4791
+ return fail2(`${prefix} is not a provider \u2014 they are ${registry2()}; the store holds ${providers2.join(", ")}`);
4792
+ }, "providerOf");
4793
+ var profilesOf = /* @__PURE__ */ __name((provider, profiles) => Object.values(profiles).flatMap((named) => Object.entries(named).filter(([, key]) => key.provider === provider)), "profilesOf");
4794
+ var accountOf = /* @__PURE__ */ __name((prefix, ref, held, context3) => {
4795
+ const provider = providerOf(prefix, held, context3);
4796
+ if (isDocumentAccountProvider(provider) && !context3.profiles[prefix.toLowerCase()]?.[ref]) {
4797
+ const stored = storedAs(held, { provider, account: ref })[0];
4798
+ if (stored)
4799
+ return stored;
4800
+ }
4801
+ const folder = isFolderProvider(provider);
4802
+ const ofProvider = folder ? storedAs(held, { provider, account: "" }) : held.filter((one) => one.provider === provider);
4803
+ const byId = ofProvider.find(({ account, stored }) => account === ref || account === ref.toLowerCase() || folder && stored?.account === ref.toUpperCase());
4804
+ if (byId)
4805
+ return byId;
4806
+ const keyed = /* @__PURE__ */ __name((key) => ofProvider.find(({ account }) => account === key.account) ?? {
4807
+ ...key,
4808
+ name: null,
4809
+ ...kindsOfHere(key.provider, context3.running)
4810
+ }, "keyed");
4811
+ const recorded = context3.profiles[prefix.toLowerCase()]?.[ref];
4812
+ if (recorded && isFolderProvider(recorded.provider)) {
4813
+ const folder2 = held.find((one) => one.provider === "notes" && one.name === recorded.account);
4814
+ if (folder2)
4815
+ return folder2;
4816
+ return fail2(`no stored folder for ${prefix}:${ref}; sync that profile first`);
4817
+ }
4818
+ if (recorded && isDocumentAccountProvider(recorded.provider)) {
4819
+ const account = storedAs(held, recorded)[0];
4820
+ if (account)
4821
+ return account;
4822
+ return fail2(`no stored documents for ${prefix}:${ref}; sync that profile first`);
4823
+ }
4824
+ if (recorded)
4825
+ return keyed(recorded);
4826
+ const byProfile = [
4827
+ ...new Map(profilesOf(provider, context3.profiles).filter(([name]) => name === ref).map(([, key]) => [key.account, key])).values()
4828
+ ];
4829
+ if (byProfile.length === 1)
4830
+ return keyed(byProfile[0]);
4831
+ const byName = ofProvider.filter(({ name }) => name?.toLowerCase() === ref.toLowerCase());
4832
+ if (byName.length === 1)
4833
+ return byName[0];
4834
+ if (byName.length > 1 || byProfile.length > 1)
4835
+ fail2(`${provider}:${ref} names more than one account \u2014 use the id: ${describe2(ofProvider)}`);
4836
+ const names = profilesOf(provider, context3.profiles).map(([name]) => name);
4837
+ return fail2(`no ${provider} account "${ref}" \u2014 the store holds ${describe2(ofProvider) || "none"}` + (names.length ? `; profiles: ${[...new Set(names)].join(", ")}` : ""));
4838
+ }, "accountOf");
4839
+ var accountsOfWord = /* @__PURE__ */ __name((word, held, context3) => {
4840
+ const wanted = word.toLowerCase();
4841
+ if (wanted === "all")
4842
+ return [...held];
4843
+ if (wanted === "personal" || wanted === "bots")
4844
+ return held.filter((one) => listedHolds(one, "messages") && isBotProvider(one.provider) === (wanted === "bots"));
4845
+ if (isKind(wanted))
4846
+ return held.filter((one) => listedHolds(one, wanted));
4847
+ const recorded = context3.profiles[wanted];
4848
+ if (recorded && Object.values(recorded).every((key) => isFolderProvider(key.provider) || isDocumentAccountProvider(key.provider)))
4849
+ return Object.keys(recorded).map((profile) => accountOf(word, profile, held, context3));
4850
+ const provider = providerOf(word, held, context3);
4851
+ if (isDocumentAccountProvider(provider) || isFolderProvider(provider))
4852
+ return storedAs(held, { provider, account: "" });
4853
+ return held.filter((one) => one.provider === provider);
4854
+ }, "accountsOfWord");
4855
+ var keyOf = /* @__PURE__ */ __name(({ provider, account }) => `${provider}\0${account}`, "keyOf");
4856
+ var sourceOf3 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}:${account}`, "sourceOf");
4857
+ var sameAs = /* @__PURE__ */ __name((key) => (one) => one.provider === key.provider && one.account === key.account, "sameAs");
4858
+ var entriesOfList = /* @__PURE__ */ __name((value, context3) => {
4859
+ const held = heldOf(context3.held, context3.running);
4860
+ const entries = [];
4861
+ const entry = /* @__PURE__ */ __name((item, group) => {
4862
+ const colon = item.indexOf(":");
4863
+ if (colon === -1) {
4864
+ try {
4865
+ entries.push({ entry: item, accounts: accountsOfWord(item, held, context3) });
4866
+ } catch (error) {
4867
+ if (!group || !(error instanceof CliError))
4868
+ throw error;
4869
+ fail2(`"${item}" in group ${group}: ${error.message}`);
4870
+ }
4871
+ return;
4872
+ }
4873
+ const prefix = item.slice(0, colon);
4874
+ const ref = item.slice(colon + 1).trim();
4875
+ if (ref === "")
4876
+ fail2(`"${item}" names no account after the colon`);
4877
+ if (prefix.toLowerCase() === "group") {
4878
+ if (group)
4879
+ fail2(`group ${group} lists another group \u2014 a group lists accounts`);
4880
+ const members = context3.groups[ref];
4881
+ if (!members) {
4882
+ const known = Object.keys(context3.groups);
4883
+ fail2(`no account group "${ref}" \u2014 ${known.length ? `there are ${known.join(", ")}` : "none saved yet"}; \`config set ${ACCOUNT_GROUPS_SETTING}.${ref} <accounts>\` saves one`);
4884
+ }
4885
+ for (const member of members)
4886
+ entry(member, ref);
4887
+ return;
4888
+ }
4889
+ entries.push({ entry: item, accounts: [accountOf(prefix, ref, held, context3)] });
4890
+ }, "entry");
4891
+ for (const item of itemsOf(value))
4892
+ entry(item);
4893
+ const { only } = context3;
4894
+ return entries.map(({ entry: entry2, accounts }) => ({
4895
+ entry: entry2,
4896
+ accounts: accounts.filter((one) => only === void 0 || only.has(keyOf(one))).map(({ provider, account, kind: kind2, kinds }) => ({
4897
+ provider,
4898
+ account,
4899
+ kind: kind2,
4900
+ ...kinds === void 0 ? {} : { kinds }
4901
+ }))
4902
+ }));
4903
+ }, "entriesOfList");
4904
+ var accountsOfList = /* @__PURE__ */ __name((value, context3) => {
4905
+ const chosen = /* @__PURE__ */ new Map();
4906
+ for (const { accounts } of entriesOfList(value, context3))
4907
+ for (const one of accounts)
4908
+ if (!chosen.has(keyOf(one)))
4909
+ chosen.set(keyOf(one), one);
4910
+ return [...chosen.values()];
4911
+ }, "accountsOfList");
4912
+ var READS = {
4913
+ messages: "messenger messages \u2014 search messages reads them",
4914
+ mail: "a mailbox \u2014 memo search mail reads it",
4915
+ notes: "notes \u2014 search notes reads them",
4916
+ documents: "documents \u2014 search notes reads them",
4917
+ meetings: "meetings \u2014 search all reads them",
4918
+ events: "calendar events \u2014 no search reads them yet",
4919
+ crm: "CRM deals and leads \u2014 search all reads them"
4920
+ };
4921
+ var fitting = /* @__PURE__ */ __name((entries, kinds, what, reasonOf = (kind2) => READS[kind2], alsoFits = () => false) => {
4922
+ const chosen = /* @__PURE__ */ new Map();
4923
+ const skipped = [];
4924
+ for (const { entry, accounts } of entries) {
4925
+ const fits = accounts.filter((one) => kinds.some((kind2) => listedHolds(one, kind2)) || alsoFits(one));
4926
+ for (const { provider, account } of fits)
4927
+ if (!chosen.has(keyOf({ provider, account })))
4928
+ chosen.set(keyOf({ provider, account }), { provider, account });
4929
+ const known = accounts.filter(({ kind: kind2 }) => kind2 !== void 0);
4930
+ const unknown2 = accounts.filter((one) => one.kind === void 0 && !alsoFits(one));
4931
+ if (known.length)
4932
+ for (const { provider, account } of unknown2)
4933
+ skipped.push({ source: `${provider}:${account}`, code: "not_found", reason: UNKNOWN_PROVIDER });
4934
+ if (fits.length)
4935
+ continue;
4936
+ const other = known[0];
4937
+ skipped.push(other?.kind ? { source: entry, code: "validation_error", reason: reasonOf(other.kind) } : unknown2.length ? { source: entry, code: "not_found", reason: UNKNOWN_PROVIDER } : { source: entry, code: "not_found", reason: "no account in the store" });
4938
+ }
4939
+ if (chosen.size === 0)
4940
+ fail2(`--source names nothing ${what} reads: ${skipped.map(({ source, reason }) => `${source} (${reason})`).join(", ")}`);
4941
+ return { accounts: [...chosen.values()], skipped };
4942
+ }, "fitting");
4943
+
4944
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/entities/fields.js
4945
+ var text5 = string();
4946
+ var id3 = pipe(string(), minLength(1));
4947
+ var time = isoTime;
3783
4948
  var zonedTime = pipe(string(), isoTimestamp("an ISO 8601 time with a zone"));
3784
4949
  var count6 = pipe(number(), integer(), minValue(0));
3785
4950
  var untrusted = optional(array(text5));
@@ -3801,7 +4966,10 @@ var author = strictObject({
3801
4966
  name: nullable(text5)
3802
4967
  });
3803
4968
 
3804
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/entities/knowledge-lists.js
4969
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/domain/categories.js
4970
+ var CATEGORIES = ["client", "supplier", "partner", "employer"];
4971
+
4972
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._325ff8c9daf4b8769887d5253d3c1255/node_modules/@wirecat/cli-core/dist/entities/knowledge-lists.js
3805
4973
  var organization = strictObject({
3806
4974
  id: id3,
3807
4975
  ref: reference,
@@ -3832,28 +5000,53 @@ var reminder = strictObject({
3832
5000
  });
3833
5001
 
3834
5002
  export {
5003
+ logAttributes,
5004
+ fromLogAttributes,
5005
+ snakeLogger,
5006
+ LOG_ATTRIBUTES,
5007
+ KEEP_SUCCESSFUL_RUNS_FOR_DAYS,
5008
+ KEEP_STORE_RUNS_FOR_DAYS,
5009
+ RUNS_SIZE_LIMIT_MB,
5010
+ runsDirFor,
5011
+ startRun,
5012
+ runtime,
5013
+ newRunId,
5014
+ listRuns,
5015
+ findRun,
5016
+ readEvents,
5017
+ currentRun,
5018
+ inRun,
5019
+ runEvent,
5020
+ typedCommand,
5021
+ useAsProcessRun,
5022
+ processRun,
5023
+ enclosingTraceId,
5024
+ traceOf,
5025
+ childTrace,
5026
+ withAttempt,
5027
+ currentAttempt,
5028
+ FIELD_TYPES,
5029
+ OPERATORS_BY_TYPE,
5030
+ QUERY_BACKENDS,
5031
+ queryFieldsOf,
3835
5032
  QUERY_LIMITS,
3836
5033
  queryAstSchema,
3837
5034
  queryError,
3838
5035
  walkQuery,
5036
+ parseLucene,
5037
+ implicitTextTerms,
3839
5038
  timezoneOf,
3840
5039
  dayBoundary,
3841
5040
  zonedMoment,
3842
5041
  dateRange,
3843
- evaluate,
3844
- FIELD_TYPES,
3845
- OPERATORS_BY_TYPE,
3846
- QUERY_BACKENDS,
3847
- queryFieldsOf,
3848
- fieldsHelp,
3849
- queryDescription,
3850
- parseLucene,
3851
- implicitTextTerms,
3852
5042
  validateQuery,
3853
5043
  fieldsNamed,
3854
5044
  describeQuery,
3855
5045
  defineQuery,
3856
5046
  QUERY_REASONS,
5047
+ evaluate,
5048
+ fieldsHelp,
5049
+ queryDescription,
3857
5050
  formatMeetingReference,
3858
5051
  parseMeetingReference,
3859
5052
  canonicalMeetingReference,
@@ -3901,6 +5094,7 @@ export {
3901
5094
  validateMeetingFindings,
3902
5095
  meetingFindingFingerprint,
3903
5096
  MEETING_FIELD_NAMES,
5097
+ liftMeetingFields,
3904
5098
  parseMeetingQuery,
3905
5099
  transcriptLanguage,
3906
5100
  importFiles,
@@ -3933,6 +5127,42 @@ export {
3933
5127
  validateMeetingSeriesInventoryCursor,
3934
5128
  aggregateMeetingCounts,
3935
5129
  aggregateMeetingStats,
5130
+ READ_BUDGET_EXCEEDED,
5131
+ SOURCE_REVIEW_KIND,
5132
+ SOURCE_REVIEW_CAUSES,
5133
+ ERASED_TEXT,
5134
+ severity,
5135
+ graver,
5136
+ text5 as text,
5137
+ id3 as id,
5138
+ time,
5139
+ zonedTime,
5140
+ count6 as count,
5141
+ untrusted,
5142
+ providerMetadata,
5143
+ evidenceSource,
5144
+ sourceReview,
5145
+ author,
5146
+ TASK_KINDS,
5147
+ TASK_STATES,
5148
+ TASK_ORIGINS,
5149
+ TASK_VERDICTS,
5150
+ isClosedState,
5151
+ PRIORITY_LABELS,
5152
+ priorityLabel,
5153
+ priorityBand,
5154
+ legacyPriority,
5155
+ checkedScore,
5156
+ priorityOption,
5157
+ createTaskService,
5158
+ matches2 as matches,
5159
+ FACT_STATUSES,
5160
+ MEMORY_KINDS,
5161
+ MEMORY_STATUSES,
5162
+ MEMORY_SCOPES,
5163
+ WORK_TASK_TYPES,
5164
+ TASK_TYPES2 as TASK_TYPES,
5165
+ CATEGORIES,
3936
5166
  parseDecimal,
3937
5167
  formatDecimal,
3938
5168
  currencyOf,
@@ -3943,6 +5173,11 @@ export {
3943
5173
  moneyLabel,
3944
5174
  quantityOf,
3945
5175
  lineUnits,
5176
+ DEAL_KINDS,
5177
+ DEAL_STATUSES,
5178
+ STAGE_OUTCOMES,
5179
+ DEAL_ROLES,
5180
+ dealLine,
3946
5181
  INVOICE_DIRECTIONS,
3947
5182
  INVOICE_STATUSES,
3948
5183
  MONEY_DIRECTIONS,
@@ -3952,34 +5187,10 @@ export {
3952
5187
  paymentLine,
3953
5188
  invoiceTitle,
3954
5189
  paymentEntryTitle,
3955
- CATALOG_KINDS,
3956
- BUSINESS_KINDS,
3957
- CONTRACT_KINDS,
3958
- CONTRACT_STATUSES,
3959
- SUBSCRIPTION_STATUSES,
3960
- WALLET_KINDS,
3961
- TRANSACTION_STATUSES,
3962
- ORDER_DIRECTIONS,
3963
- intervalOf,
3964
- productLine,
3965
- contractLine,
3966
- subscriptionLine,
3967
- walletLine,
3968
- transactionLine,
3969
- DEAL_KINDS,
3970
- DEAL_STATUSES,
3971
- STAGE_OUTCOMES,
3972
- DEAL_ROLES,
3973
- dealLine,
3974
5190
  ORDER_STATUSES,
3975
5191
  ORDER_PURPOSES,
3976
5192
  orderLine,
3977
5193
  orderTitle,
3978
- SOURCE_REVIEW_KIND,
3979
- SOURCE_REVIEW_CAUSES,
3980
- ERASED_TEXT,
3981
- severity,
3982
- graver,
3983
5194
  isEngagement,
3984
5195
  checkEngagement,
3985
5196
  RELATION_KINDS,
@@ -3994,51 +5205,90 @@ export {
3994
5205
  STANDINGS,
3995
5206
  standingOf,
3996
5207
  isUsable,
5208
+ KEYED,
3997
5209
  notOverriddenSql,
3998
5210
  usableLinkSql,
5211
+ organization,
5212
+ project,
5213
+ reminder,
5214
+ CATALOG_KINDS,
5215
+ BUSINESS_KINDS,
5216
+ CONTRACT_KINDS,
5217
+ CONTRACT_STATUSES,
5218
+ SUBSCRIPTION_STATUSES,
5219
+ WALLET_KINDS,
5220
+ TRANSACTION_STATUSES,
5221
+ ORDER_DIRECTIONS,
5222
+ intervalOf,
5223
+ productLine,
5224
+ contractLine,
5225
+ subscriptionLine,
5226
+ walletLine,
5227
+ transactionLine,
3999
5228
  TAG_TYPES,
4000
5229
  tagOf,
4001
5230
  normalizeTag,
5231
+ REPORTER_SQL,
5232
+ sourceOf,
4002
5233
  LINK_KINDS,
4003
5234
  LINK_ORIGINS,
4004
5235
  LINK_SOURCES,
4005
5236
  linkKind,
4006
5237
  COUNTERPART_ROLE,
4007
- TASK_KINDS,
4008
- TASK_STATES,
4009
- TASK_ORIGINS,
4010
- TASK_VERDICTS,
4011
- isClosedState,
4012
- PRIORITY_LABELS,
4013
- priorityLabel,
4014
- priorityBand,
4015
- legacyPriority,
4016
- checkedScore,
4017
- priorityOption,
4018
- createTaskService,
4019
- matches2 as matches,
4020
- FACT_STATUSES,
4021
- MEMORY_KINDS,
4022
- MEMORY_STATUSES,
4023
- MEMORY_SCOPES,
4024
- WORK_TASK_TYPES,
4025
- TASK_TYPES2 as TASK_TYPES,
4026
- text5 as text,
4027
- id3 as id,
4028
- time,
4029
- zonedTime,
4030
- count6 as count,
4031
- untrusted,
4032
- providerMetadata,
4033
- evidenceSource,
4034
- sourceReview,
4035
- author,
4036
- organization,
4037
- project,
4038
- reminder,
4039
5238
  markStoreDamaged,
4040
5239
  readDamageMark,
4041
5240
  refuseDamagedStore,
5241
+ markJournalLost,
5242
+ readJournalMark,
4042
5243
  readHealthMark,
4043
- recordDeepCheck
5244
+ recordDeepCheck,
5245
+ formatLocator,
5246
+ isLocator,
5247
+ parseLocator,
5248
+ SIMPLE_REFERENCES,
5249
+ formatReference,
5250
+ parseReference,
5251
+ canonicalReference,
5252
+ looksLikeReference,
5253
+ providerLabel,
5254
+ isFolderProvider,
5255
+ folderProviderSql,
5256
+ folderProviderOf,
5257
+ DOCUMENT_ACCOUNT_PROVIDERS,
5258
+ isDocumentAccountProvider,
5259
+ ADDED_PROVIDER,
5260
+ ADDED_ACCOUNT,
5261
+ notAdded,
5262
+ filesAccountSql,
5263
+ INTERNAL_NOTES,
5264
+ UNKNOWN_PROVIDER,
5265
+ providerEntryOf,
5266
+ kindsOfEntry,
5267
+ unitedKinds,
5268
+ providers,
5269
+ useStoredProviders,
5270
+ addProvider,
5271
+ isKind,
5272
+ providerNamed,
5273
+ kindIn,
5274
+ importedOf,
5275
+ isImportedProvider,
5276
+ holdsKind,
5277
+ holdsKindOf,
5278
+ isBotProvider,
5279
+ inSource,
5280
+ sourceOf2,
5281
+ ACCOUNT_GROUPS,
5282
+ ACCOUNT_GROUPS_SETTING,
5283
+ isAccountList,
5284
+ isGroupName,
5285
+ groupName,
5286
+ groupMembers,
5287
+ listedHolds,
5288
+ keyOf,
5289
+ sourceOf3,
5290
+ sameAs,
5291
+ entriesOfList,
5292
+ accountsOfList,
5293
+ fitting
4044
5294
  };