@wirecat/tg-cli 0.119.0 → 0.120.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 (107) hide show
  1. package/contracts/wirecat.json +2 -0
  2. package/dist/bin/tg.js +2 -2
  3. package/dist/bundle/{adapter-NEQQOANM.js → adapter-OJKHXGBC.js} +49 -49
  4. package/dist/bundle/{all-profiles-QFT46FTF.js → all-profiles-URIWNL23.js} +10 -10
  5. package/dist/bundle/{anthropic-UJ4RYCWU.js → anthropic-YUKNB63B.js} +5 -5
  6. package/dist/bundle/{app-server-NE3EL5IK.js → app-server-H5QNHGH4.js} +43 -43
  7. package/dist/bundle/{bot-api-D4H5SCP5.js → bot-api-27GN4Y3D.js} +49 -49
  8. package/dist/bundle/{bot-history-KF2PUMWA.js → bot-history-VVSWLVZM.js} +18 -18
  9. package/dist/bundle/{bun-F7MH5YKA.js → bun-PAAJX3GU.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-FYDJXUHF.js → bun-sqlite-TPEBWFZH.js} +5 -5
  11. package/dist/bundle/{chunk-XM3P7LLT.js → chunk-34DSPJNN.js} +2 -2
  12. package/dist/bundle/{chunk-QD27C3BG.js → chunk-3FPFRDG2.js} +10 -8
  13. package/dist/bundle/{chunk-OG2CG2GS.js → chunk-3GLLWDM6.js} +12 -12
  14. package/dist/bundle/{chunk-FQ3C6DFV.js → chunk-3SANNNWS.js} +3 -3
  15. package/dist/bundle/{chunk-G3MQOH6Z.js → chunk-4JATS2J5.js} +3 -3
  16. package/dist/bundle/{chunk-6OE5I3PR.js → chunk-4OWY7QBE.js} +6 -6
  17. package/dist/bundle/{chunk-QG5U6HCI.js → chunk-4W4EVVL4.js} +4 -4
  18. package/dist/bundle/{chunk-JKKEMVW3.js → chunk-6XHZV7AQ.js} +4 -4
  19. package/dist/bundle/{chunk-IAGX5VFL.js → chunk-7DPWVKYS.js} +4 -4
  20. package/dist/bundle/{chunk-5EHJWIW4.js → chunk-7I6YVQHW.js} +2 -2
  21. package/dist/bundle/{chunk-TKHEVAEG.js → chunk-7N4IUEX3.js} +8 -8
  22. package/dist/bundle/{chunk-HV5YYAJX.js → chunk-7VNV426X.js} +51 -18
  23. package/dist/bundle/{chunk-YMWPRHXG.js → chunk-7WS3ULOO.js} +1185 -426
  24. package/dist/bundle/{chunk-FJKP6MMP.js → chunk-B7B65ZLU.js} +2 -2
  25. package/dist/bundle/{chunk-3EQ7USKJ.js → chunk-CGUDXNJE.js} +2 -2
  26. package/dist/bundle/{chunk-4AACB23H.js → chunk-CLTMVPGT.js} +13 -13
  27. package/dist/bundle/{chunk-FQZSS3AB.js → chunk-CLURRDNU.js} +6 -6
  28. package/dist/bundle/{chunk-RGU2G3KL.js → chunk-CYWV2RLN.js} +4 -4
  29. package/dist/bundle/{chunk-F223KYWG.js → chunk-D2WNQJUQ.js} +1 -1
  30. package/dist/bundle/{chunk-6ERQJRL2.js → chunk-DDKFAUQD.js} +2 -2
  31. package/dist/bundle/{chunk-Z4CGZAFQ.js → chunk-DE7QIEUP.js} +34 -34
  32. package/dist/bundle/{chunk-7VUNJDYU.js → chunk-DH7VKHTZ.js} +4 -4
  33. package/dist/bundle/{chunk-L33G5ARH.js → chunk-DQTQO6PB.js} +1005 -768
  34. package/dist/bundle/{chunk-TEZKCH5B.js → chunk-FATTEYZH.js} +2 -2
  35. package/dist/bundle/{chunk-23JGV5FQ.js → chunk-FPWXG53C.js} +11 -11
  36. package/dist/bundle/{chunk-MDLSI3EN.js → chunk-H5XC2WYO.js} +35 -589
  37. package/dist/bundle/{chunk-UBCLVM7C.js → chunk-HDSKBXAF.js} +3 -3
  38. package/dist/bundle/{chunk-X5PDWCG7.js → chunk-HIBYYKGO.js} +1 -1
  39. package/dist/bundle/{chunk-HPQQ76WF.js → chunk-JJY3TQTM.js} +3 -3
  40. package/dist/bundle/{chunk-D6YTBJY6.js → chunk-JQLGS3SG.js} +1 -1
  41. package/dist/bundle/{chunk-2BAJ6ORN.js → chunk-JSEIT2WO.js} +1 -1
  42. package/dist/bundle/{chunk-BXIPT2BO.js → chunk-KLHOQ6XQ.js} +1 -1
  43. package/dist/bundle/{chunk-CX2WCEQU.js → chunk-KP26Y5OA.js} +1440 -248
  44. package/dist/bundle/{chunk-3K65KTXD.js → chunk-KRCMKFUV.js} +2 -2
  45. package/dist/bundle/{chunk-HGMMRT4G.js → chunk-KTV5Y5EX.js} +2 -2
  46. package/dist/bundle/{chunk-7C6POLLO.js → chunk-KW6JZGG3.js} +1 -1
  47. package/dist/bundle/{chunk-D4Y2KL5V.js → chunk-LLCGOZ44.js} +4 -4
  48. package/dist/bundle/{chunk-FRW3CWC7.js → chunk-LS72R7DN.js} +34 -34
  49. package/dist/bundle/{chunk-NDSRND3E.js → chunk-LVGX7VTD.js} +4 -4
  50. package/dist/bundle/{chunk-5FEEFXJA.js → chunk-MCPOZNWG.js} +1 -1
  51. package/dist/bundle/{chunk-6K5R3YPN.js → chunk-MMPISXSU.js} +2 -2
  52. package/dist/bundle/{chunk-65BWMPCI.js → chunk-MTD6WZKV.js} +2 -2
  53. package/dist/bundle/{chunk-TT4CIXVH.js → chunk-PDYTNTQI.js} +6 -6
  54. package/dist/bundle/{chunk-KBHK5UGL.js → chunk-RX5CJ55S.js} +1 -1
  55. package/dist/bundle/{chunk-QTFXYR5W.js → chunk-S6OC367D.js} +4 -4
  56. package/dist/bundle/{chunk-DQELQ7BL.js → chunk-THJHYMFR.js} +1293 -1525
  57. package/dist/bundle/{chunk-RUNFFBJU.js → chunk-U2TPRUWK.js} +84 -72
  58. package/dist/bundle/{chunk-V5Z2JO6X.js → chunk-U6HEZPCR.js} +19 -19
  59. package/dist/bundle/{chunk-SMHLQEE2.js → chunk-VUBZFMGP.js} +2 -2
  60. package/dist/bundle/{chunk-W2BIBPRU.js → chunk-VUUR2SRS.js} +67 -44
  61. package/dist/bundle/{chunk-KC4MQRAB.js → chunk-WGGSFGNZ.js} +8 -8
  62. package/dist/bundle/{chunk-ZEQ7ONPZ.js → chunk-WLBPNLDF.js} +3 -3
  63. package/dist/bundle/{chunk-QQ3QZFFD.js → chunk-WQ55F4Y3.js} +8 -8
  64. package/dist/bundle/{chunk-72QLHHSO.js → chunk-YBOVL25O.js} +17 -15
  65. package/dist/bundle/{chunk-S3HAFJVC.js → chunk-YDROJG2Y.js} +86 -29
  66. package/dist/bundle/{chunk-CIDFV3IT.js → chunk-YQKEPT22.js} +1 -1
  67. package/dist/bundle/{chunk-XDMJVWWR.js → chunk-ZON7K5QE.js} +3 -3
  68. package/dist/bundle/{chunk-ROOUBFUW.js → chunk-ZRRZTPSB.js} +18152 -17010
  69. package/dist/bundle/command-contract-KW6FNOJO.js +33 -0
  70. package/dist/bundle/{decode-5N4ERCHC.js → decode-RVWSCZW4.js} +5 -5
  71. package/dist/bundle/{dispatch-TBGXBDHE.js → dispatch-U2DW6UI7.js} +8 -8
  72. package/dist/bundle/{echarts-YDEBAMXT.js → echarts-6VNUD3JF.js} +2 -2
  73. package/dist/bundle/{embed-T7H62XFR.js → embed-LWLCQKIK.js} +6 -6
  74. package/dist/bundle/{embedder-AW3O2TR3.js → embedder-CXKHLRJT.js} +9 -9
  75. package/dist/bundle/{entry-L2LJ2VPY.js → entry-HV4NSX3Z.js} +7 -7
  76. package/dist/bundle/{failure-AWHPW2HE.js → failure-HJD7S5UA.js} +2 -2
  77. package/dist/bundle/{first-run-6PBZSRZU.js → first-run-OPI6NIWQ.js} +11 -11
  78. package/dist/bundle/first-screen-BVQLF4LN.js +31 -0
  79. package/dist/bundle/{instructions-C3NJERO7.js → instructions-TK4HXL3A.js} +1 -1
  80. package/dist/bundle/{mcp-CWLASTLV.js → mcp-7KQUJNFN.js} +2 -2
  81. package/dist/bundle/{node-P3CIIYWU.js → node-WFPNBUCU.js} +2 -2
  82. package/dist/bundle/{node-sqlite-YVHMNRVA.js → node-sqlite-L5BRGJLK.js} +6 -6
  83. package/dist/bundle/{oauth-5OQYA2SV.js → oauth-CGVWL35B.js} +7 -7
  84. package/dist/bundle/{open-YGWUVSU7.js → open-HLL55C5S.js} +5 -5
  85. package/dist/bundle/{openai-U45JBQ6F.js → openai-YFCNXIJ4.js} +14 -14
  86. package/dist/bundle/{process-DCYX5EDG.js → process-4A5JP5LO.js} +1 -1
  87. package/dist/bundle/{program-UZBFH2EZ.js → program-IFGQGSUF.js} +52 -52
  88. package/dist/bundle/{prompt-HPVTPTFI.js → prompt-B5FYE2DQ.js} +5 -5
  89. package/dist/bundle/{proxy-transport-D7MCHGSV.js → proxy-transport-ENU2SJYT.js} +5 -5
  90. package/dist/bundle/{recognize-IJCPFJ76.js → recognize-ZHMHGIV3.js} +4 -4
  91. package/dist/bundle/{remote-MWDYQWFW.js → remote-A3W5HE52.js} +7 -7
  92. package/dist/bundle/{rerank-SXG64475.js → rerank-HWJAQOZM.js} +7 -7
  93. package/dist/bundle/{serve-KJQENHEH.js → serve-PP326Q2F.js} +9 -9
  94. package/dist/bundle/{server-MXVXZWN6.js → server-MV6CL63L.js} +35 -35
  95. package/dist/bundle/server-TZGGOJ26.js +60 -0
  96. package/dist/bundle/{state-CKKJWH27.js → state-Y3RJ7ZXB.js} +6 -6
  97. package/dist/bundle/{store-R3BE4V56.js → store-EVNI2MHZ.js} +13 -13
  98. package/dist/bundle/store-maintenance-command-XPQE47RE.js +49 -0
  99. package/dist/bundle/tg.js +13 -13
  100. package/dist/version.d.ts +1 -1
  101. package/dist/version.js +1 -1
  102. package/package.json +3 -3
  103. package/dist/bundle/command-contract-7TGMZRBE.js +0 -33
  104. package/dist/bundle/first-screen-UKCD7D2R.js +0 -31
  105. package/dist/bundle/server-RTMCRKQF.js +0 -60
  106. package/dist/bundle/store-maintenance-command-KDGBSBNU.js +0 -49
  107. /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-WLBPNLDF.js";
7
7
  import {
8
8
  refuseOwnerStoreInTests
9
- } from "./chunk-6K5R3YPN.js";
9
+ } from "./chunk-MMPISXSU.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,18 @@ 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.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/money.js
55
61
  var CURRENCY_SCALES = {
56
62
  AED: 2,
57
63
  AMD: 2,
@@ -145,7 +151,7 @@ var quantityOf = /* @__PURE__ */ __name((text6) => {
145
151
  }, "quantityOf");
146
152
  var lineUnits = /* @__PURE__ */ __name((thousandths, unitPrice) => Number((thousandths * BigInt(unitPrice) + 500n) / 1000n), "lineUnits");
147
153
 
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
154
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/finance.js
149
155
  var INVOICE_DIRECTIONS = ["receivable", "payable"];
150
156
  var INVOICE_STATUSES = ["draft", "issued", "partly_paid", "paid", "void"];
151
157
  var MONEY_DIRECTIONS = ["in", "out"];
@@ -174,7 +180,7 @@ var paymentLine = /* @__PURE__ */ __name((payment) => {
174
180
  var invoiceTitle = /* @__PURE__ */ __name((invoice) => `Invoice ${invoiceLine(invoice)}`, "invoiceTitle");
175
181
  var paymentEntryTitle = /* @__PURE__ */ __name((payment) => `Payment \xB7 ${paymentLine(payment)}`, "paymentEntryTitle");
176
182
 
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
183
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/business.js
178
184
  var CATALOG_KINDS = ["product", "service"];
179
185
  var BUSINESS_KINDS = ["invoice", "payment", "order", "contract", "subscription", "product", "wallet"];
180
186
  var CONTRACT_KINDS = ["sale", "purchase", "service", "lease", "employment", "nda", "license", "other"];
@@ -202,10 +208,11 @@ var subscriptionLine = /* @__PURE__ */ __name((subscription) => `${subscription.
202
208
  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
209
  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
210
 
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
211
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/store/marks.js
206
212
  import { readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
207
213
  var damageMarkPath = /* @__PURE__ */ __name((store) => `${store}.damaged.json`, "damageMarkPath");
208
214
  var healthMarkPath = /* @__PURE__ */ __name((store) => `${store}.health.json`, "healthMarkPath");
215
+ var journalMarkPath = /* @__PURE__ */ __name((store) => `${store}.journal.json`, "journalMarkPath");
209
216
  var inodeOf = /* @__PURE__ */ __name((store) => statSync(store, { throwIfNoEntry: false })?.ino, "inodeOf");
210
217
  var readJson = /* @__PURE__ */ __name((path) => {
211
218
  try {
@@ -271,6 +278,23 @@ var refuseDamagedStore = /* @__PURE__ */ __name((store, cli) => {
271
278
  return;
272
279
  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
280
  }, "refuseDamagedStore");
281
+ var markJournalLost = /* @__PURE__ */ __name((store, { seen, command, now = Date.now }) => {
282
+ if (ownerStoreInTests(store))
283
+ return;
284
+ const mark = { at: new Date(now()).toISOString(), command, seen };
285
+ try {
286
+ writeFileSync(journalMarkPath(store), `${JSON.stringify(mark, null, 2)}
287
+ `, { flag: "wx", mode: 384 });
288
+ } catch {
289
+ }
290
+ }, "markJournalLost");
291
+ var readJournalMark = /* @__PURE__ */ __name((store) => {
292
+ try {
293
+ return readJson(journalMarkPath(store));
294
+ } catch {
295
+ return null;
296
+ }
297
+ }, "readJournalMark");
274
298
  var readHealthMark = /* @__PURE__ */ __name((store) => {
275
299
  try {
276
300
  return readJson(healthMarkPath(store));
@@ -300,10 +324,12 @@ var recordDeepCheck = /* @__PURE__ */ __name((store, health, { cli, version, sch
300
324
  }
301
325
  if (cleared)
302
326
  clearDamageMark(store);
327
+ if (health.ok)
328
+ rmSync(journalMarkPath(store), { force: true });
303
329
  return { previous, cleared };
304
330
  }, "recordDeepCheck");
305
331
 
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
332
+ // 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
333
  var QUERY_LIMITS = {
308
334
  bytes: 8192,
309
335
  depth: 32,
@@ -347,7 +373,7 @@ function queryError(reason, span, alternative, context3 = {}, details = {}) {
347
373
  __name(queryError, "queryError");
348
374
  var walkQuery = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => walkQuery(node2)), "walkQuery");
349
375
 
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
376
+ // 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
377
  var timezoneOf = /* @__PURE__ */ __name((given) => {
352
378
  const zone = given ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC";
353
379
  try {
@@ -360,11 +386,11 @@ var timezoneOf = /* @__PURE__ */ __name((given) => {
360
386
  var calendar = /* @__PURE__ */ __name((value, span) => {
361
387
  if (!/^\d{4}-\d{2}-\d{2}$/u.test(value))
362
388
  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));
389
+ const year = Number(value.slice(0, 4)), month = Number(value.slice(5, 7)), day2 = Number(value.slice(8, 10));
364
390
  const date = /* @__PURE__ */ new Date(0);
365
- date.setUTCFullYear(year, month - 1, day);
391
+ date.setUTCFullYear(year, month - 1, day2);
366
392
  date.setUTCHours(0, 0, 0, 0);
367
- if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day)
393
+ if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day2)
368
394
  queryError("query.invalid-date", span);
369
395
  return date;
370
396
  }, "calendar");
@@ -381,9 +407,9 @@ var dayBoundary = /* @__PURE__ */ __name((value, zone, next, span) => {
381
407
  era: "short"
382
408
  });
383
409
  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");
410
+ const parts2 = formatter.formatToParts(time2);
411
+ const value2 = /* @__PURE__ */ __name((name) => Number(parts2.find((p) => p.type === name)?.value), "value");
412
+ const year = parts2.find((p) => p.type === "era")?.value === "BC" ? 1 - value2("year") : value2("year");
387
413
  return year * 1e4 + value2("month") * 100 + value2("day");
388
414
  }, "dayAt");
389
415
  let lo = date.getTime() - 2 * 864e5, hi = date.getTime() + 2 * 864e5;
@@ -400,12 +426,12 @@ var dayBoundary = /* @__PURE__ */ __name((value, zone, next, span) => {
400
426
  }, "dayBoundary");
401
427
  var WALL = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/u;
402
428
  var wallTime = /* @__PURE__ */ __name((value, zone, span) => {
403
- const [, year, month, day, hour, minute, second = "0", fraction = "0"] = WALL.exec(value) ?? [];
429
+ const [, year, month, day2, hour, minute, second = "0", fraction = "0"] = WALL.exec(value) ?? [];
404
430
  if (year === void 0)
405
431
  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")));
432
+ const wanted = Date.UTC(Number(year), Number(month) - 1, Number(day2), Number(hour), Number(minute), Number(second), Number(fraction.padEnd(3, "0")));
407
433
  const check = new Date(wanted);
408
- if (check.getUTCDate() !== Number(day) || check.getUTCHours() !== Number(hour) || check.getUTCMinutes() !== Number(minute) || check.getUTCSeconds() !== Number(second))
434
+ if (check.getUTCDate() !== Number(day2) || check.getUTCHours() !== Number(hour) || check.getUTCMinutes() !== Number(minute) || check.getUTCSeconds() !== Number(second))
409
435
  queryError("query.invalid-date", span);
410
436
  const formatter = new Intl.DateTimeFormat("en-CA", {
411
437
  timeZone: zone,
@@ -418,8 +444,8 @@ var wallTime = /* @__PURE__ */ __name((value, zone, span) => {
418
444
  hourCycle: "h23"
419
445
  });
420
446
  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;
447
+ const parts2 = Object.fromEntries(formatter.formatToParts(instant).map((part) => [part.type, Number(part.value)]));
448
+ return Date.UTC(parts2.year ?? 0, (parts2.month ?? 1) - 1, parts2.day, parts2.hour, parts2.minute, parts2.second) + (instant % 1e3 + 1e3) % 1e3;
423
449
  }, "shown");
424
450
  const found = /* @__PURE__ */ new Set();
425
451
  for (const probe of [wanted - 864e5, wanted, wanted + 864e5]) {
@@ -492,7 +518,7 @@ var dateRange = /* @__PURE__ */ __name((lower, upper, lowerInclusive, upperInclu
492
518
  };
493
519
  }, "dateRange");
494
520
 
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
521
+ // 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
496
522
  var FIELD_TYPES = ["kw", "txt", "enum", "num", "time", "bool", "ref"];
497
523
  var OPERATORS_BY_TYPE = {
498
524
  kw: ["term", "phrase", "wildcard"],
@@ -571,8 +597,8 @@ var queryFieldsOf = /* @__PURE__ */ __name((schema, annotations = {}) => {
571
597
  return [...own, ...relations, ...states];
572
598
  }, "queryFieldsOf");
573
599
 
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");
600
+ // 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
601
+ var shownOf = /* @__PURE__ */ __name((registry3) => registry3.backend === "native" ? registry3.fields.filter((field) => field.native) : registry3.fields, "shownOf");
576
602
  var leftOut = /* @__PURE__ */ __name((fields) => fields.filter((field) => field.negatable).map((field) => field.name), "leftOut");
577
603
  var has = /* @__PURE__ */ __name((fields, operator) => fields.some((field) => field.operators.includes(operator)), "has");
578
604
  var syntaxOf = /* @__PURE__ */ __name((shown, backend) => [
@@ -583,32 +609,32 @@ var syntaxOf = /* @__PURE__ */ __name((shown, backend) => [
583
609
  ...has(shown, "range") ? ["[a TO b] \xB7 > >= < <="] : []
584
610
  ].join(" \xB7 "), "syntaxOf");
585
611
  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);
612
+ var fieldsHelp = /* @__PURE__ */ __name((registry3, guide) => {
613
+ const shown = shownOf(registry3);
588
614
  const negatable = leftOut(shown);
589
615
  const rows = shown.map((field) => [field.name, kindOf(field), field.example]);
590
616
  const widths = [0, 1].map((at) => Math.max(...rows.map((row) => (row[at] ?? "").length)));
591
617
  return [
592
618
  "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`] : [],
619
+ ...rows.map(([name = "", kind2 = "", example = ""]) => ` ${name.padEnd(widths[0] ?? 0)} ${kind2.padEnd(widths[1] ?? 0)} ${example}`.trimEnd()),
620
+ ...registry3.defaults && registry3.defaults.length > 0 ? [`Defaults: ${registry3.defaults.join(" ")} \u2014 name the field to change it`] : [],
595
621
  ...negatable.length > 0 ? [`Leave out: -${negatable[0]}:value or NOT ${negatable[0]}:value, for ${negatable.join(", ")}`] : [],
596
- `Syntax: ${syntaxOf(shown, registry.backend)}`,
622
+ `Syntax: ${syntaxOf(shown, registry3.backend)}`,
597
623
  ...guide ? [`Guide: ${guide}`] : []
598
624
  ].join("\n");
599
625
  }, "fieldsHelp");
600
- var queryDescription = /* @__PURE__ */ __name((registry) => {
601
- const shown = shownOf(registry);
626
+ var queryDescription = /* @__PURE__ */ __name((registry3) => {
627
+ const shown = shownOf(registry3);
602
628
  if (shown.length === 0)
603
629
  return "field:value terms; this list filters by none yet, so any term is refused";
604
630
  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], > <" : ""})`;
631
+ 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], > <" : ""})`;
606
632
  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(" ")}` : "";
633
+ const defaults = registry3.defaults?.length ? `; unless named: ${registry3.defaults.join(" ")}` : "";
608
634
  return `${terms}; fields: ${fields.join(", ")}; e.g. ${shown[0]?.example ?? ""}${defaults}`;
609
635
  }, "queryDescription");
610
636
 
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
637
+ // 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
612
638
  var inContext = /* @__PURE__ */ __name((context3, run2) => {
613
639
  try {
614
640
  run2();
@@ -621,24 +647,24 @@ var inContext = /* @__PURE__ */ __name((context3, run2) => {
621
647
  }, "inContext");
622
648
  var bounds = /* @__PURE__ */ __name((node) => node.operator === "range" ? [node.value, node.upper ?? "*"].filter((bound) => bound !== "*") : [node.value], "bounds");
623
649
  var checkValue = /* @__PURE__ */ __name((field, node, options) => {
624
- const fail = /* @__PURE__ */ __name((reason, alternative) => queryError(reason, node.span, alternative, options), "fail");
650
+ const fail3 = /* @__PURE__ */ __name((reason, alternative) => queryError(reason, node.span, alternative, options), "fail");
625
651
  if (node.value === "" && field.type !== "txt")
626
- fail("query.missing-value");
652
+ fail3("query.missing-value");
627
653
  if (node.operator === "wildcard")
628
654
  return;
629
655
  switch (field.type) {
630
656
  case "enum":
631
657
  if (!field.values?.includes(node.value.toLowerCase()))
632
- fail("query.unknown-value", `${field.name} takes ${field.values?.join(", ")}`);
658
+ fail3("query.unknown-value", `${field.name} takes ${field.values?.join(", ")}`);
633
659
  return;
634
660
  case "bool":
635
661
  if (!["true", "false"].includes(node.value.toLowerCase()))
636
- fail("query.unknown-value", `${field.name} takes true, false`);
662
+ fail3("query.unknown-value", `${field.name} takes true, false`);
637
663
  return;
638
664
  case "num":
639
665
  for (const bound of bounds(node))
640
666
  if (!Number.isFinite(Number(bound)) || bound.trim() === "")
641
- fail("query.invalid-number", `${field.name} takes a number`);
667
+ fail3("query.invalid-number", `${field.name} takes a number`);
642
668
  return;
643
669
  case "time":
644
670
  inContext(options, () => {
@@ -650,8 +676,8 @@ var checkValue = /* @__PURE__ */ __name((field, node, options) => {
650
676
  return;
651
677
  }
652
678
  }, "checkValue");
653
- var validateQuery = /* @__PURE__ */ __name((ast, registry, options = {}) => {
654
- const byName = new Map(registry.fields.map((field) => [field.name, field]));
679
+ var validateQuery = /* @__PURE__ */ __name((ast, registry3, options = {}) => {
680
+ const byName = new Map(registry3.fields.map((field) => [field.name, field]));
655
681
  const visit = /* @__PURE__ */ __name((node, required) => {
656
682
  if (node.kind === "boolean") {
657
683
  for (const clause of node.clauses)
@@ -661,11 +687,11 @@ var validateQuery = /* @__PURE__ */ __name((ast, registry, options = {}) => {
661
687
  const field = byName.get(node.field);
662
688
  if (!field)
663
689
  queryError("query.unknown-field", node.span, `no field "${node.field}"`, options, {
664
- fields: registry.fields.map((one) => one.name)
690
+ fields: registry3.fields.map((one) => one.name)
665
691
  });
666
- if (registry.backend === "native" && !field.native)
692
+ if (registry3.backend === "native" && !field.native)
667
693
  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)
694
+ supported: registry3.fields.filter((one) => one.native).map((one) => one.name)
669
695
  });
670
696
  const presence = node.operator === "wildcard" && node.value === "*";
671
697
  if (!presence && !field.operators.includes(node.operator))
@@ -683,7 +709,7 @@ var validateQuery = /* @__PURE__ */ __name((ast, registry, options = {}) => {
683
709
  }, "validateQuery");
684
710
  var fieldsNamed = /* @__PURE__ */ __name((ast) => new Set(walkQuery(ast.root).map((node) => node.field)), "fieldsNamed");
685
711
 
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
712
+ // 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
713
  var whitespace = /* @__PURE__ */ __name((c) => /[ \t\n\r\u3000]/u.test(c), "whitespace");
688
714
  var reserved = /* @__PURE__ */ new Set([
689
715
  "+",
@@ -706,7 +732,7 @@ var reserved = /* @__PURE__ */ new Set([
706
732
  "\\",
707
733
  "/"
708
734
  ]);
709
- var decodeEscapes = /* @__PURE__ */ __name((raw, span, fail) => {
735
+ var decodeEscapes = /* @__PURE__ */ __name((raw, span, fail3) => {
710
736
  let out = "";
711
737
  for (let at = 0; at < raw.length; at++) {
712
738
  if (raw[at] !== "\\") {
@@ -714,11 +740,11 @@ var decodeEscapes = /* @__PURE__ */ __name((raw, span, fail) => {
714
740
  continue;
715
741
  }
716
742
  if (++at >= raw.length)
717
- fail("query.invalid-escape", span);
743
+ fail3("query.invalid-escape", span);
718
744
  if (raw[at] === "u") {
719
745
  const hex = raw.slice(at + 1, at + 5);
720
746
  if (!/^[0-9a-fA-F]{4}$/.test(hex))
721
- fail("query.invalid-escape", span);
747
+ fail3("query.invalid-escape", span);
722
748
  out += String.fromCharCode(Number.parseInt(hex, 16));
723
749
  at += 4;
724
750
  } else
@@ -726,7 +752,7 @@ var decodeEscapes = /* @__PURE__ */ __name((raw, span, fail) => {
726
752
  }
727
753
  return out;
728
754
  }, "decodeEscapes");
729
- var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
755
+ var tokensOf = /* @__PURE__ */ __name((text6, fail3 = queryError) => {
730
756
  const tokens = [];
731
757
  let at = 0;
732
758
  let range = false;
@@ -737,7 +763,7 @@ var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
737
763
  at++;
738
764
  continue;
739
765
  }
740
- let kind = c;
766
+ let kind2 = c;
741
767
  if (c === '"' || !range && c === "/") {
742
768
  at++;
743
769
  while (at < text6.length && text6[at] !== c) {
@@ -746,26 +772,26 @@ var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
746
772
  at++;
747
773
  }
748
774
  if (at >= text6.length)
749
- fail("query.unclosed-literal", { start, end: at }, c === "/" ? regexHint(text6, start) : void 0);
775
+ fail3("query.unclosed-literal", { start, end: at }, c === "/" ? regexHint(text6, start) : void 0);
750
776
  at++;
751
777
  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";
778
+ fail3("query.unsupported-regex-flags", { start: at, end: at + 1 }, "Lucene regex does not take JavaScript flags");
779
+ kind2 = c === '"' ? "quoted" : "regex";
754
780
  } else if (range && c !== "]" && c !== "}") {
755
781
  while (at < text6.length && !whitespace(text6[at] ?? "") && !["]", "}"].includes(text6[at] ?? ""))
756
782
  at++;
757
- kind = "rangeValue";
783
+ kind2 = "rangeValue";
758
784
  } else if (reserved.has(c)) {
759
785
  if (c === "\\") {
760
786
  at += 2;
761
787
  while (at < text6.length && !whitespace(text6[at] ?? "") && (!reserved.has(text6[at] ?? "") || ["+", "-"].includes(text6[at] ?? "")))
762
788
  at++;
763
- kind = "term";
789
+ kind2 = "term";
764
790
  } else {
765
791
  at++;
766
792
  if ((c === "<" || c === ">") && text6[at] === "=") {
767
793
  at++;
768
- kind += "=";
794
+ kind2 += "=";
769
795
  }
770
796
  if (c === "[" || c === "{")
771
797
  range = true;
@@ -778,7 +804,7 @@ var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
778
804
  const next = text6[at] ?? "";
779
805
  if (next === "\\") {
780
806
  if (at + 1 >= text6.length)
781
- fail("query.invalid-escape", { start: at, end: at + 1 });
807
+ fail3("query.invalid-escape", { start: at, end: at + 1 });
782
808
  at += 2;
783
809
  continue;
784
810
  }
@@ -795,9 +821,9 @@ var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
795
821
  while (at < text6.length && !whitespace(text6[at] ?? "") && !["(", ")", '"'].includes(text6[at] ?? ""))
796
822
  at++;
797
823
  const raw = text6.slice(start, at);
798
- kind = { AND: "AND", OR: "OR", NOT: "NOT", "&&": "AND", "||": "OR" }[raw] ?? (/^\d+(?:\.\d+)?$/u.test(raw) ? "number" : "term");
824
+ kind2 = { AND: "AND", OR: "OR", NOT: "NOT", "&&": "AND", "||": "OR" }[raw] ?? (/^\d+(?:\.\d+)?$/u.test(raw) ? "number" : "term");
799
825
  }
800
- tokens.push({ kind, raw: text6.slice(start, at), span: { start, end: at } });
826
+ tokens.push({ kind: kind2, raw: text6.slice(start, at), span: { start, end: at } });
801
827
  }
802
828
  tokens.push({ kind: "EOF", raw: "", span: { start: at, end: at } });
803
829
  return tokens;
@@ -816,30 +842,30 @@ var regexHint = /* @__PURE__ */ __name((text6, at) => {
816
842
  return quoteHint(text6, at) ?? `/ starts a regular expression; put the value in quotes: "${word}"`;
817
843
  }, "regexHint");
818
844
  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");
845
+ const fail3 = /* @__PURE__ */ __name((reason, span, alternative) => queryError(reason, span, alternative ?? quoteHint(text6, span.start), context3), "fail");
820
846
  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);
847
+ fail3("query.too-large", { start: 0, end: text6.length });
848
+ const tokens = tokensOf(text6, fail3);
823
849
  let at = 0;
824
850
  let count7 = 0;
825
851
  let depth = 0;
826
852
  const peek = /* @__PURE__ */ __name(() => tokens[at], "peek");
827
853
  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);
854
+ const expect = /* @__PURE__ */ __name((kind2) => {
855
+ if (peek().kind !== kind2)
856
+ fail3("query.invalid-syntax", peek().span);
831
857
  return take();
832
858
  }, "expect");
833
859
  const built = /* @__PURE__ */ __name((node) => {
834
860
  if (++count7 > QUERY_LIMITS.nodes)
835
- fail("query.too-large", node.span);
861
+ fail3("query.too-large", node.span);
836
862
  return node;
837
863
  }, "built");
838
864
  const combine = /* @__PURE__ */ __name((clauses, occur) => {
839
865
  const first = clauses[0];
840
866
  const last = clauses.at(-1);
841
867
  if (!first || !last)
842
- fail("query.invalid-syntax", peek().span);
868
+ fail3("query.invalid-syntax", peek().span);
843
869
  if (clauses.length === 1)
844
870
  return first;
845
871
  return {
@@ -852,7 +878,7 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
852
878
  }, "combine");
853
879
  const query = /* @__PURE__ */ __name((field, implicit = false) => {
854
880
  if (++depth > QUERY_LIMITS.depth)
855
- fail("query.too-large", peek().span);
881
+ fail3("query.too-large", peek().span);
856
882
  const clauses = [];
857
883
  do {
858
884
  clauses.push(disjunction(field, implicit));
@@ -888,7 +914,7 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
888
914
  let implicit = inheritedImplicit;
889
915
  if (peek().kind === "term" && [":", "=", "<", ">", "<=", ">="].includes(tokens[at + 1]?.kind ?? "")) {
890
916
  const token = take();
891
- field = decodeEscapes(token.raw, token.span, fail);
917
+ field = decodeEscapes(token.raw, token.span, fail3);
892
918
  start = token.span.start;
893
919
  implicit = false;
894
920
  let operator = take();
@@ -897,8 +923,8 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
897
923
  if (["<", ">", "<=", ">="].includes(operator.kind)) {
898
924
  const value = take();
899
925
  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);
926
+ fail3("query.invalid-syntax", value.span);
927
+ const decoded = decodeEscapes(value.kind === "quoted" ? value.raw.slice(1, -1) : value.raw, value.span, fail3);
902
928
  const lower = operator.kind.startsWith(">");
903
929
  const node2 = built({
904
930
  kind: "predicate",
@@ -923,17 +949,17 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
923
949
  const opening = take();
924
950
  const lower = take();
925
951
  if (!["rangeValue", "quoted"].includes(lower.kind))
926
- fail("query.invalid-syntax", lower.span);
952
+ fail3("query.invalid-syntax", lower.span);
927
953
  const separator = take();
928
954
  if (separator.raw !== "TO")
929
- fail("query.invalid-syntax", separator.span);
955
+ fail3("query.invalid-syntax", separator.span);
930
956
  const upper = take();
931
957
  if (!["rangeValue", "quoted"].includes(upper.kind))
932
- fail("query.invalid-syntax", upper.span);
958
+ fail3("query.invalid-syntax", upper.span);
933
959
  const closing = take();
934
960
  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");
961
+ fail3("query.invalid-syntax", closing.span);
962
+ const decode = /* @__PURE__ */ __name((t) => decodeEscapes(t.kind === "quoted" ? t.raw.slice(1, -1) : t.raw, t.span, fail3), "decode");
937
963
  node = built({
938
964
  kind: "predicate",
939
965
  field,
@@ -947,31 +973,31 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
947
973
  } else {
948
974
  const token = take();
949
975
  if (!["term", "number", "quoted", "regex"].includes(token.kind))
950
- fail("query.invalid-syntax", token.span);
976
+ fail3("query.invalid-syntax", token.span);
951
977
  const raw = ["term", "number"].includes(token.kind) ? token.raw : token.raw.slice(1, -1);
952
978
  if (field === "fn")
953
- fail("query.unsupported-operator", token.span, "interval functions are not supported");
979
+ fail3("query.unsupported-operator", token.span, "interval functions are not supported");
954
980
  const wildcard = ["term", "number"].includes(token.kind) && /(?<!\\)[*?]/u.test(raw);
955
981
  node = built({
956
982
  kind: "predicate",
957
983
  field,
958
984
  operator: token.kind === "regex" ? "regex" : token.kind === "quoted" ? "phrase" : wildcard ? "wildcard" : "term",
959
- value: token.kind === "regex" || wildcard ? raw : decodeEscapes(raw, token.span, fail),
985
+ value: token.kind === "regex" || wildcard ? raw : decodeEscapes(raw, token.span, fail3),
960
986
  span: { start: start ?? token.span.start, end: token.span.end },
961
987
  ...implicit ? { implicit: true } : {}
962
988
  });
963
989
  }
964
990
  if (proximity && peek().kind === "~" && node.kind === "predicate" && node.operator === "phrase") {
965
991
  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 } };
992
+ const distance2 = take();
993
+ if (distance2.kind !== "number" || !/^\d+$/u.test(distance2.raw))
994
+ fail3("query.invalid-syntax", distance2.span, 'write the distance as a whole number: "a b"~3');
995
+ node = { ...node, slop: Number(distance2.raw), span: { start: node.span.start, end: distance2.span.end } };
970
996
  }
971
997
  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");
998
+ 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
999
  if (["^", "@"].includes(peek().kind))
974
- fail("query.unsupported-operator", peek().span, "boost and minimum-should-match are not supported");
1000
+ fail3("query.unsupported-operator", peek().span, "boost and minimum-should-match are not supported");
975
1001
  return { node, ...modifier ? { modifier } : {} };
976
1002
  }, "clause");
977
1003
  const root = query(defaultField, true);
@@ -987,20 +1013,20 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
987
1013
  }, "parseLucene");
988
1014
  var implicitTextTerms = /* @__PURE__ */ __name((text6) => {
989
1015
  const tokens = tokensOf(text6);
990
- if (tokens.some(({ kind }) => ["AND", "OR", "NOT", "+", "-", "!", "(", ")"].includes(kind)))
1016
+ if (tokens.some(({ kind: kind2 }) => ["AND", "OR", "NOT", "+", "-", "!", "(", ")"].includes(kind2)))
991
1017
  return /* @__PURE__ */ new Set();
992
1018
  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
1019
  }, "implicitTextTerms");
994
1020
 
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] } : {}
1021
+ // 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
1022
+ var describeQuery = /* @__PURE__ */ __name((registry3) => ({
1023
+ entity: registry3.entity,
1024
+ backend: registry3.backend,
1025
+ fields: registry3.fields.map(({ validate: _, ...field }) => field),
1026
+ ...registry3.defaults && registry3.defaults.length > 0 ? { defaults: [...registry3.defaults] } : {}
1001
1027
  }), "describeQuery");
1002
- var exampleProblems = /* @__PURE__ */ __name((registry) => {
1003
- const syntaxOnly = { ...registry, backend: "sql" };
1028
+ var exampleProblems = /* @__PURE__ */ __name((registry3) => {
1029
+ const syntaxOnly = { ...registry3, backend: "sql" };
1004
1030
  const problem = /* @__PURE__ */ __name((text6, field) => {
1005
1031
  try {
1006
1032
  const named = walkQuery(validateQuery(parseLucene(text6, { defaultField: "none" }), syntaxOnly).root);
@@ -1011,29 +1037,29 @@ var exampleProblems = /* @__PURE__ */ __name((registry) => {
1011
1037
  return `"${text6}": ${failure.message}`;
1012
1038
  }
1013
1039
  }, "problem");
1014
- const defaults = (registry.defaults ?? []).map((term) => {
1040
+ const defaults = (registry3.defaults ?? []).map((term) => {
1015
1041
  const field = term.replace(/^-/, "").split(/[:<>=]/)[0] ?? "";
1016
1042
  return { field, problem: problem(term.replace(/^-/, ""), field) };
1017
1043
  });
1018
1044
  return [
1019
- ...registry.fields.map((field) => ({ field: field.name, problem: problem(field.example, field.name) })),
1045
+ ...registry3.fields.map((field) => ({ field: field.name, problem: problem(field.example, field.name) })),
1020
1046
  ...defaults
1021
1047
  ].filter((entry) => entry.problem !== void 0);
1022
1048
  }, "exampleProblems");
1023
1049
  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);
1050
+ var defineQuery = /* @__PURE__ */ __name((registry3) => {
1051
+ if (checked.has(registry3))
1052
+ return registry3;
1053
+ const names = registry3.fields.map((field) => field.name);
1028
1054
  const problems = [
1029
1055
  ...duplicates(names).map((name) => `"${name}" is listed twice`),
1030
1056
  ...names.filter((name) => !SNAKE_CASE.test(name)).map((name) => `"${name}" is not snake_case`),
1031
- ...exampleProblems(registry).map(({ field, problem }) => `${field}: ${problem}`)
1057
+ ...exampleProblems(registry3).map(({ field, problem }) => `${field}: ${problem}`)
1032
1058
  ];
1033
1059
  if (problems.length > 0)
1034
- throw new RegistryError(`${registry.entity} query`, problems);
1035
- checked.add(registry);
1036
- return registry;
1060
+ throw new RegistryError(`${registry3.entity} query`, problems);
1061
+ checked.add(registry3);
1062
+ return registry3;
1037
1063
  }, "defineQuery");
1038
1064
  var SPAN = ["span", "alternative", "guide"];
1039
1065
  var QUERY_REASONS = defineReasons([
@@ -1063,7 +1089,7 @@ var QUERY_REASONS = defineReasons([
1063
1089
  details: [...SPAN, ...details]
1064
1090
  })));
1065
1091
 
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
1092
+ // 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
1093
  var wordsOf = /* @__PURE__ */ __name((text6) => text6.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [], "wordsOf");
1068
1094
  var pattern = /* @__PURE__ */ __name((value) => new RegExp(`^${[...value].map((char) => char === "*" ? ".*" : char === "?" ? "." : char.replace(/[.+^${}()|[\]\\]/, "\\$&")).join("")}$`, "iu"), "pattern");
1069
1095
  var present = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "", "present");
@@ -1118,7 +1144,7 @@ var matches = /* @__PURE__ */ __name((node, item, byName, options) => {
1118
1144
  }, "matches");
1119
1145
  var evaluate = /* @__PURE__ */ __name((ast, fields, item, options = {}) => matches(ast.root, item, new Map(fields.map((field) => [field.name, field])), options), "evaluate");
1120
1146
 
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
1147
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/reference.js
1122
1148
  var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "expected meeting:<accountId>/<meetingId>[/<transcriptId>[/<cuePosition>]] with safe integer IDs"), "invalid");
1123
1149
  var integer2 = /* @__PURE__ */ __name((value, minimum = 1) => {
1124
1150
  if (!Number.isSafeInteger(value) || value < minimum)
@@ -1126,24 +1152,24 @@ var integer2 = /* @__PURE__ */ __name((value, minimum = 1) => {
1126
1152
  return value;
1127
1153
  }, "integer");
1128
1154
  var formatMeetingReference = /* @__PURE__ */ __name((reference2) => {
1129
- const parts = [integer2(reference2.accountId), integer2(reference2.meetingId)];
1155
+ const parts2 = [integer2(reference2.accountId), integer2(reference2.meetingId)];
1130
1156
  if (reference2.transcriptId !== void 0)
1131
- parts.push(integer2(reference2.transcriptId));
1157
+ parts2.push(integer2(reference2.transcriptId));
1132
1158
  if (reference2.cuePosition !== void 0) {
1133
1159
  if (reference2.transcriptId === void 0)
1134
1160
  throw invalid();
1135
- parts.push(integer2(reference2.cuePosition, 0));
1161
+ parts2.push(integer2(reference2.cuePosition, 0));
1136
1162
  }
1137
- return `meeting:${parts.join("/")}`;
1163
+ return `meeting:${parts2.join("/")}`;
1138
1164
  }, "formatMeetingReference");
1139
1165
  var parseMeetingReference = /* @__PURE__ */ __name((text6) => {
1140
1166
  const value = text6.trim();
1141
1167
  if (!value.startsWith("meeting:"))
1142
1168
  throw invalid();
1143
- const parts = value.slice(8).split("/");
1144
- if (parts.length < 2 || parts.length > 4 || parts.some((part) => !/^\d+$/.test(part)))
1169
+ const parts2 = value.slice(8).split("/");
1170
+ if (parts2.length < 2 || parts2.length > 4 || parts2.some((part) => !/^\d+$/.test(part)))
1145
1171
  throw invalid();
1146
- const ids2 = parts.map(Number);
1172
+ const ids2 = parts2.map(Number);
1147
1173
  const reference2 = {
1148
1174
  type: "meeting",
1149
1175
  accountId: integer2(ids2[0]),
@@ -1155,7 +1181,7 @@ var parseMeetingReference = /* @__PURE__ */ __name((text6) => {
1155
1181
  }, "parseMeetingReference");
1156
1182
  var canonicalMeetingReference = /* @__PURE__ */ __name((text6) => formatMeetingReference(parseMeetingReference(text6)), "canonicalMeetingReference");
1157
1183
 
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
1184
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/item.js
1159
1185
  var text = string();
1160
1186
  var count = pipe(number(), integer(), minValue(0));
1161
1187
  var MEETING_ISSUES = ["time_without_zone"];
@@ -1220,7 +1246,7 @@ var MEETING_QUERY = {
1220
1246
  })
1221
1247
  };
1222
1248
 
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
1249
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/join-key.js
1224
1250
  var joinKeyOf = /* @__PURE__ */ __name((url) => {
1225
1251
  const parsed = urlOf(url);
1226
1252
  if (!parsed)
@@ -1254,7 +1280,7 @@ var urlOf = /* @__PURE__ */ __name((url) => {
1254
1280
  }
1255
1281
  }, "urlOf");
1256
1282
 
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
1283
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/calendar-text.js
1258
1284
  var ENTITIES = { amp: "&", lt: "<", gt: ">", quot: '"', "#39": "'", apos: "'", nbsp: " " };
1259
1285
  var SECRET_LINE = /(?<![\p{L}\p{N}])(pass ?codes?|passwords?|pwd|pins?|access ?codes?|meeting ?codes?|kennwort|пароль|пин-?код|код доступа)(?![\p{L}\p{N}])|pwd=/iu;
1260
1286
  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 +1289,8 @@ var calendarText = /* @__PURE__ */ __name((text6, { dropSecretLines = true } = {
1263
1289
  if (!text6)
1264
1290
  return null;
1265
1291
  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;
1292
+ const joined2 = kept.join("\n").replace(/\n{3,}/gu, "\n\n").trim();
1293
+ return joined2 || null;
1268
1294
  }, "calendarText");
1269
1295
  var ENTRY_METADATA_KEYS = [
1270
1296
  "colorId",
@@ -1291,7 +1317,7 @@ var entryMetadata = /* @__PURE__ */ __name((metadata) => {
1291
1317
  return kept;
1292
1318
  }, "entryMetadata");
1293
1319
 
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
1320
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/cue-fingerprint.js
1295
1321
  import { createHash } from "node:crypto";
1296
1322
  var meetingCueFingerprint = /* @__PURE__ */ __name((cue2) => createHash("sha256").update(JSON.stringify({
1297
1323
  reference: cue2.reference,
@@ -1305,7 +1331,7 @@ var meetingCueFingerprint = /* @__PURE__ */ __name((cue2) => createHash("sha256"
1305
1331
  text: cue2.text
1306
1332
  })).digest("hex"), "meetingCueFingerprint");
1307
1333
 
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
1334
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/event-store.js
1309
1335
  var UNTIL = /(?:^|;)UNTIL=(\d{4})(\d{2})(\d{2})(?:T(\d{2})(\d{2})(\d{2})Z?)?(?:;|$)/iu;
1310
1336
  var seriesEnd = /* @__PURE__ */ __name((entry) => {
1311
1337
  if (entry.recurrenceEndsAt !== null)
@@ -1314,8 +1340,8 @@ var seriesEnd = /* @__PURE__ */ __name((entry) => {
1314
1340
  const until = rule === void 0 ? null : UNTIL.exec(rule.slice("RRULE:".length));
1315
1341
  if (!until)
1316
1342
  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;
1343
+ const [, year, month, day2, hour = "23", minute = "59", second = "59"] = until;
1344
+ return Date.UTC(Number(year), Number(month) - 1, Number(day2), Number(hour), Number(minute), Number(second)) + 864e5;
1319
1345
  }, "seriesEnd");
1320
1346
  var entryInWindow = /* @__PURE__ */ __name((entry, window) => {
1321
1347
  if (entry.kind === "occurrence" && !entry.exception)
@@ -1328,7 +1354,7 @@ var entryInWindow = /* @__PURE__ */ __name((entry, window) => {
1328
1354
  return Math.max(entry.endsAt ?? start, start + 1) > window.from;
1329
1355
  }, "entryInWindow");
1330
1356
 
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
1357
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/answers.js
1332
1358
  var text2 = string();
1333
1359
  var count2 = pipe(number(), integer(), minValue(0));
1334
1360
  var iso2 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
@@ -1563,7 +1589,7 @@ var meetingHitsList = /* @__PURE__ */ __name((found, limit, command = "search me
1563
1589
  };
1564
1590
  }, "meetingHitsList");
1565
1591
 
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
1592
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/participant-search.js
1567
1593
  var normalizeMeetingParticipantQuery = /* @__PURE__ */ __name((text6) => text6.normalize("NFKC").toLowerCase(), "normalizeMeetingParticipantQuery");
1568
1594
  var validateMeetingParticipantQuery = /* @__PURE__ */ __name((query) => {
1569
1595
  if (typeof query !== "string" || !query.trim() || query.length > 500 || query.includes("\0"))
@@ -1587,7 +1613,7 @@ var validateMeetingParticipantSearch = /* @__PURE__ */ __name((query, input) =>
1587
1613
  };
1588
1614
  }, "validateMeetingParticipantSearch");
1589
1615
 
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
1616
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/reads.js
1591
1617
  var MeetingError = class extends CliError {
1592
1618
  static {
1593
1619
  __name(this, "MeetingError");
@@ -1719,7 +1745,7 @@ var meetingSummaryAnswer = /* @__PURE__ */ __name(async (store, id4, accountId)
1719
1745
  return wholeList(details.summaries.map((one) => meetingSummaryItem(details.meeting.accountId, one)));
1720
1746
  }, "meetingSummaryAnswer");
1721
1747
 
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
1748
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/export.js
1723
1749
  var timestamp = /* @__PURE__ */ __name((milliseconds) => {
1724
1750
  if (!Number.isSafeInteger(milliseconds) || milliseconds < 0)
1725
1751
  throw new MeetingError("validation_error", "transcript times must be nonnegative integer milliseconds");
@@ -1781,30 +1807,30 @@ var exportMeeting = /* @__PURE__ */ __name(async (store, id4, options) => {
1781
1807
  text: row.text
1782
1808
  })));
1783
1809
  } else {
1784
- const parts = [`# ${heading(details.meeting.title ?? "Untitled meeting")}`, `Meeting ID: ${details.meeting.id}`];
1810
+ const parts2 = [`# ${heading(details.meeting.title ?? "Untitled meeting")}`, `Meeting ID: ${details.meeting.id}`];
1785
1811
  if (details.meeting.description !== null)
1786
- parts.push("## Description", quote(details.meeting.description));
1812
+ parts2.push("## Description", quote(details.meeting.description));
1787
1813
  for (const summary of details.summaries) {
1788
- parts.push(`## ${heading(summary.title ?? "Summary")}`);
1814
+ parts2.push(`## ${heading(summary.title ?? "Summary")}`);
1789
1815
  if (summary.content !== null)
1790
- parts.push(quote(summary.content));
1816
+ parts2.push(quote(summary.content));
1791
1817
  else {
1792
1818
  if (summary.overview !== null)
1793
- parts.push(quote(summary.overview));
1819
+ parts2.push(quote(summary.overview));
1794
1820
  for (const section of summary.sections)
1795
- parts.push(`### ${heading(section.label)}`, quote(section.text));
1821
+ parts2.push(`### ${heading(section.label)}`, quote(section.text));
1796
1822
  if (summary.nextSteps.length > 0)
1797
- parts.push("### Next steps", summary.nextSteps.map((step) => `- ${markdown(step)}`).join("\n"));
1823
+ parts2.push("### Next steps", summary.nextSteps.map((step) => `- ${markdown(step)}`).join("\n"));
1798
1824
  }
1799
1825
  }
1800
1826
  for (const part of transcripts) {
1801
- parts.push(`## Transcript ${part.transcript.id}`, `Source: ${heading(part.transcript.source)}`);
1827
+ parts2.push(`## Transcript ${part.transcript.id}`, `Source: ${heading(part.transcript.source)}`);
1802
1828
  if (part.transcript.supersededAt !== null)
1803
- parts.push("Version: superseded");
1829
+ parts2.push("Version: superseded");
1804
1830
  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));
1831
+ parts2.push(`[${timestamp(row.startMs)} \u2013 ${timestamp(row.endMs)}]${row.speakerName === null ? "" : ` ${heading(row.speakerName)}`}`, quote(row.text));
1806
1832
  }
1807
- content = `${parts.join("\n\n")}
1833
+ content = `${parts2.join("\n\n")}
1808
1834
  `;
1809
1835
  }
1810
1836
  return {
@@ -1815,7 +1841,7 @@ var exportMeeting = /* @__PURE__ */ __name(async (store, id4, options) => {
1815
1841
  };
1816
1842
  }, "exportMeeting");
1817
1843
 
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
1844
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/payment.js
1819
1845
  var FACT_TYPES = ["fact", "statement", "question", "decision", "promise"];
1820
1846
  var PAYMENT_DIRECTIONS = ["to_us", "from_us"];
1821
1847
  var PAYMENT_STATES = ["expected", "paid", "cancelled"];
@@ -1909,10 +1935,10 @@ var paymentTitle = /* @__PURE__ */ __name((fact) => {
1909
1935
  return `${grouped(payment.amount)} ${payment.currency} ${way}${party}${item}${due} (${payment.state})`;
1910
1936
  }, "paymentTitle");
1911
1937
 
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
1938
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/findings-rules.js
1913
1939
  import { createHash as createHash2 } from "node:crypto";
1914
1940
 
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
1941
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/timestamp.js
1916
1942
  var meetingTimestamp = /* @__PURE__ */ __name((value, name) => {
1917
1943
  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
1944
  throw new CliError("validation_error", `${name} must be an ISO timestamp with a timezone, such as 2026-11-09T09:00:00Z`);
@@ -1923,7 +1949,7 @@ var meetingTimestamp = /* @__PURE__ */ __name((value, name) => {
1923
1949
  return new Date(value).toISOString();
1924
1950
  }, "meetingTimestamp");
1925
1951
 
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
1952
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/findings-rules.js
1927
1953
  var TASK_TYPES = ["bug", "feature", "chore"];
1928
1954
  var invalid3 = /* @__PURE__ */ __name((message) => {
1929
1955
  throw new CliError("validation_error", message);
@@ -1937,10 +1963,10 @@ var findingHash = /* @__PURE__ */ __name((value) => createHash2("sha256").update
1937
1963
  var snakeCase = /* @__PURE__ */ __name((key) => key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "snakeCase");
1938
1964
  var findingWhere = /* @__PURE__ */ __name((of) => {
1939
1965
  const id4 = typeof of.id === "string" ? of.id : null;
1940
- const kind = typeof of.kind === "string" ? of.kind : null;
1966
+ const kind2 = typeof of.kind === "string" ? of.kind : null;
1941
1967
  return {
1942
- where: id4 || kind ? ` in ${[id4, kind && `(${kind})`].filter(Boolean).join(" ")}` : "",
1943
- named: { ...id4 ? { finding: id4 } : {}, ...kind ? { kind } : {} }
1968
+ where: id4 || kind2 ? ` in ${[id4, kind2 && `(${kind2})`].filter(Boolean).join(" ")}` : "",
1969
+ named: { ...id4 ? { finding: id4 } : {}, ...kind2 ? { kind: kind2 } : {} }
1944
1970
  };
1945
1971
  }, "findingWhere");
1946
1972
  var findingFields = /* @__PURE__ */ __name((value, allowed, noun, of = value) => {
@@ -1968,13 +1994,15 @@ var validEvidence = /* @__PURE__ */ __name((raw, rules) => {
1968
1994
  const evidence = raw.map((item) => {
1969
1995
  if (!item || typeof item !== "object")
1970
1996
  return invalid3("finding evidence is a reference and fingerprint");
1971
- findingFields(item, ["reference", "fingerprint"], rules.singular);
1997
+ findingFields(item, rules.quotes ? ["reference", "fingerprint", "quote"] : ["reference", "fingerprint"], rules.singular);
1972
1998
  if (typeof item.reference !== "string" || typeof item.fingerprint !== "string")
1973
1999
  return invalid3("evidence requires a reference and fingerprint");
1974
2000
  const reference2 = rules.reference(item.reference);
1975
2001
  if (!/^[a-f0-9]{64}$/.test(item.fingerprint))
1976
2002
  return invalid3(`finding evidence requires exact ${rules.cited} references and fingerprints`);
1977
- return { reference: reference2, fingerprint: item.fingerprint };
2003
+ if (item.quote === void 0)
2004
+ return { reference: reference2, fingerprint: item.fingerprint };
2005
+ return { reference: reference2, fingerprint: item.fingerprint, quote: findingText(item.quote, rules.quotes ?? 0) };
1978
2006
  }).sort((a, b) => a.reference.localeCompare(b.reference));
1979
2007
  if (new Set(evidence.map((item) => item.reference)).size !== evidence.length)
1980
2008
  return invalid3(`duplicate evidence ${rules.cited}`);
@@ -2096,7 +2124,7 @@ var validateBatch = /* @__PURE__ */ __name((input, rules, most, one) => {
2096
2124
  var validateFindings = /* @__PURE__ */ __name((input, rules) => validateBatch(input, rules, 16, (finding, ids2) => validateFinding(finding, rules, ids2)), "validateFindings");
2097
2125
  var findingFingerprint = /* @__PURE__ */ __name(({ id: _id, ...finding }) => findingHash(finding), "findingFingerprint");
2098
2126
 
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
2127
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/findings.js
2100
2128
  var MEETING_FINDINGS_KIND = "meeting_findings";
2101
2129
  var cue = /* @__PURE__ */ __name((raw) => {
2102
2130
  const reference2 = canonicalMeetingReference(raw);
@@ -2107,7 +2135,7 @@ var cue = /* @__PURE__ */ __name((raw) => {
2107
2135
  var validateMeetingFindings = /* @__PURE__ */ __name((input) => validateFindings(input, { plural: "meeting findings", singular: "meeting finding", cited: "cue", reference: cue }), "validateMeetingFindings");
2108
2136
  var meetingFindingFingerprint = findingFingerprint;
2109
2137
 
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
2138
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/result-items.js
2111
2139
  var text3 = string();
2112
2140
  var identifier = pipe(text3, minLength(1));
2113
2141
  var nullableText = nullable(text3);
@@ -2149,7 +2177,8 @@ var personResult = strictObject({
2149
2177
  participant_id: identifier,
2150
2178
  person_uid: text3,
2151
2179
  previous_person_uid: nullableText,
2152
- changed: flag
2180
+ changed: flag,
2181
+ proposal: optional(text3)
2153
2182
  });
2154
2183
  var meetingChange = strictObject({
2155
2184
  scope,
@@ -2240,7 +2269,7 @@ var MEETING_RESULT_ENTITIES = {
2240
2269
  meeting_repair: repair
2241
2270
  };
2242
2271
 
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
2272
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/event-query.js
2244
2273
  var EVENT_QUERY = defineQuery({
2245
2274
  entity: "event",
2246
2275
  backend: "sql",
@@ -2256,7 +2285,7 @@ var EVENT_QUERY = defineQuery({
2256
2285
  ]
2257
2286
  });
2258
2287
 
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
2288
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/events.js
2260
2289
  var linkEvent = /* @__PURE__ */ __name(async (store, details, now = Date.now()) => {
2261
2290
  const current = await store.meeting(details.meeting.id);
2262
2291
  if (!current)
@@ -2299,7 +2328,7 @@ var linkEvent = /* @__PURE__ */ __name(async (store, details, now = Date.now())
2299
2328
  return (await store.events()).find((e) => e.id === linked?.meeting.eventId) ?? null;
2300
2329
  }, "linkEvent");
2301
2330
 
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
2331
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/hit-query.js
2303
2332
  var context = {
2304
2333
  command: "search meetings",
2305
2334
  guide: "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md#\u0432\u0441\u0442\u0440\u0435\u0447\u0438"
@@ -2363,7 +2392,7 @@ var MEETING_FIELDS = defineQuery({
2363
2392
  var MEETING_FIELD_NAMES = new Set(MEETING_FIELDS.fields.map(({ name }) => name));
2364
2393
  var parseMeetingQuery = /* @__PURE__ */ __name((query) => validateQuery(parseLucene(query, { defaultField: "text", proximity: true, ...context }), MEETING_HIT_QUERY, context), "parseMeetingQuery");
2365
2394
 
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
2395
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/language.js
2367
2396
  var LATIN_WORDS = {
2368
2397
  en: ["the", "and", "is", "that", "you", "this", "what", "have", "with", "are"],
2369
2398
  es: ["el", "los", "las", "por", "pero", "para", "est\xE1", "muy", "tambi\xE9n", "hay"],
@@ -2412,7 +2441,7 @@ var transcriptLanguage = /* @__PURE__ */ __name((texts) => {
2412
2441
  return null;
2413
2442
  }, "transcriptLanguage");
2414
2443
 
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
2444
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/ingest.js
2416
2445
  var contentHash = /* @__PURE__ */ __name(async (text6) => {
2417
2446
  const bytes = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text6));
2418
2447
  return Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, "0")).join("");
@@ -2449,7 +2478,7 @@ var timestamp2 = /* @__PURE__ */ __name((value) => {
2449
2478
  return time2;
2450
2479
  }, "timestamp");
2451
2480
 
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
2481
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/transcript-text.js
2453
2482
  var TranscriptTextError = class extends Error {
2454
2483
  static {
2455
2484
  __name(this, "TranscriptTextError");
@@ -2504,7 +2533,7 @@ var parseTranscriptText = /* @__PURE__ */ __name((input) => {
2504
2533
  return { header, lines };
2505
2534
  }, "parseTranscriptText");
2506
2535
 
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
2536
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/vtt.js
2508
2537
  var VttError = class extends Error {
2509
2538
  static {
2510
2539
  __name(this, "VttError");
@@ -2556,7 +2585,7 @@ var parseVtt = /* @__PURE__ */ __name((input) => {
2556
2585
  return cues;
2557
2586
  }, "parseVtt");
2558
2587
 
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
2588
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/import.js
2560
2589
  var importFiles = /* @__PURE__ */ __name(async (files, store, now = Date.now()) => {
2561
2590
  const report = { meetings: 0, participants: 0, transcriptRows: 0, summaries: 0, warnings: [] };
2562
2591
  for (const file of files) {
@@ -2589,10 +2618,10 @@ var importFiles = /* @__PURE__ */ __name(async (files, store, now = Date.now())
2589
2618
  return report;
2590
2619
  }, "importFiles");
2591
2620
 
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
2621
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/links.js
2593
2622
  var CHAT_MESSAGES_READ = 1e5;
2594
2623
 
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
2624
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/meeting-management.js
2596
2625
  var nonempty = /* @__PURE__ */ __name((value, name) => {
2597
2626
  if (typeof value !== "string" || !value.trim())
2598
2627
  throw new CliError("validation_error", `${name} must be nonempty`);
@@ -2643,7 +2672,7 @@ var validateMeetingChange = /* @__PURE__ */ __name((change, create) => {
2643
2672
  return Object.freeze(result);
2644
2673
  }, "validateMeetingChange");
2645
2674
 
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
2675
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/passage.js
2647
2676
  var meetingHitContextLimits = /* @__PURE__ */ __name((options = {}) => {
2648
2677
  const { before = 3, after = 3, bytes = 65536, max_read_bytes = 4194304, expected_fingerprint } = options;
2649
2678
  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 +2685,7 @@ var validateMeetingPassage = /* @__PURE__ */ __name((reference2, options) => {
2656
2685
  throw new CliError("validation_error", "choose a cue reference and json, text or markdown output");
2657
2686
  }, "validateMeetingPassage");
2658
2687
 
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
2688
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/preparation-context.js
2660
2689
  var validateMeetingPreparationContext = /* @__PURE__ */ __name((original) => {
2661
2690
  if (!original || typeof original !== "object" || Array.isArray(original))
2662
2691
  throw new CliError("validation_error", "meeting preparation context is required");
@@ -2681,7 +2710,7 @@ var validateMeetingPreparationContext = /* @__PURE__ */ __name((original) => {
2681
2710
  return { ...input, limit, maxReadBytes };
2682
2711
  }, "validateMeetingPreparationContext");
2683
2712
 
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
2713
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/project-evidence-answer.js
2685
2714
  var count4 = pipe(number(), integer(), minValue(0));
2686
2715
  var id = pipe(string(), minLength(1));
2687
2716
  var meetingProjectEvidence = strictObject({
@@ -2802,7 +2831,7 @@ var meetingProjectEvidenceAnswer = /* @__PURE__ */ __name((page, prepared, comma
2802
2831
  };
2803
2832
  }, "meetingProjectEvidenceAnswer");
2804
2833
 
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
2834
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/search-validation.js
2806
2835
  var validateMeetingHitSearch = /* @__PURE__ */ __name((query, options = {}) => {
2807
2836
  const integer3 = /* @__PURE__ */ __name((value, low, high) => Number.isSafeInteger(value) && value >= low && value <= high, "integer");
2808
2837
  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 +2851,7 @@ var validateMeetingHitSearch = /* @__PURE__ */ __name((query, options = {}) => {
2822
2851
  throw new CliError("validation_error", "choose one project selector and one tag or topic selector");
2823
2852
  }, "validateMeetingHitSearch");
2824
2853
 
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
2854
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/project-evidence-query.js
2826
2855
  var ids = {
2827
2856
  meeting_id: "meetingId",
2828
2857
  identity_id: "participantIdentityId",
@@ -2913,7 +2942,7 @@ var prepareMeetingProjectEvidence = /* @__PURE__ */ __name((project2, request =
2913
2942
  return { project: project2.trim(), options, query: frozen.join(" AND ") };
2914
2943
  }, "prepareMeetingProjectEvidence");
2915
2944
 
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
2945
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/project-evidence.js
2917
2946
  var readMeetingProjectEvidence = /* @__PURE__ */ __name(async (read, project2, request = {}, now = Date.now()) => {
2918
2947
  const prepared = prepareMeetingProjectEvidence(project2, request, now);
2919
2948
  const page = await read(prepared.project, prepared.options);
@@ -2921,7 +2950,7 @@ var readMeetingProjectEvidence = /* @__PURE__ */ __name(async (read, project2, r
2921
2950
  return meetingProjectEvidenceAnswer(page, prepared);
2922
2951
  }, "readMeetingProjectEvidence");
2923
2952
 
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
2953
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/pull.js
2925
2954
  var participantInput = /* @__PURE__ */ __name((p, provider, occurrenceId2, position, accountId) => {
2926
2955
  const { identityExternalId, ...fields } = p;
2927
2956
  const externalId = identityExternalId ?? (p.email ? `email:${p.email.toLowerCase()}` : p.externalId) ?? `name:${p.displayName ?? "unknown"}@${accountId}/${occurrenceId2}:${position}`;
@@ -3083,7 +3112,7 @@ unlinked`, format)],
3083
3112
  return report;
3084
3113
  }, "pull");
3085
3114
 
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
3115
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/read-answers.js
3087
3116
  var text4 = string();
3088
3117
  var count5 = pipe(number(), integer(), minValue(0));
3089
3118
  var id2 = pipe(number(), integer(), minValue(1));
@@ -3277,10 +3306,10 @@ var eventItem = /* @__PURE__ */ __name((one) => ({
3277
3306
  updated_at: new Date(one.updatedAt).toISOString()
3278
3307
  }), "eventItem");
3279
3308
 
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
3309
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/recording-transfer.js
3281
3310
  var strongRecordingValidator = /* @__PURE__ */ __name((value) => typeof value === "string" && value.length <= 1024 && /^"[\x21\x23-\x7e\x80-\xff]*"$/.test(value), "strongRecordingValidator");
3282
3311
 
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
3312
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/related-history.js
3284
3313
  var validateMeetingRelatedHistory = /* @__PURE__ */ __name((original) => {
3285
3314
  if (!original || typeof original !== "object" || Array.isArray(original))
3286
3315
  throw new CliError("validation_error", "related history request is required");
@@ -3310,14 +3339,14 @@ var validateMeetingRelatedHistory = /* @__PURE__ */ __name((original) => {
3310
3339
  return { ...input, anchorIds: [...new Set(input.anchorIds)], limit, maxReadBytes };
3311
3340
  }, "validateMeetingRelatedHistory");
3312
3341
 
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
3342
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/review.js
3314
3343
  var REVIEW_LIMIT = { default: 50, most: 200 };
3315
3344
 
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
3345
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/save-hints.js
3317
3346
  var SAVE_HELP = `Worth keeping \u2014 a decision, a promise, a preference? Record it with \`memo facts add\` or
3318
3347
  \`memo memories add\`, citing the msg: locator or meeting: reference as --evidence.`;
3319
3348
 
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
3349
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/series-history.js
3321
3350
  var validateMeetingSeriesHistory = /* @__PURE__ */ __name((input) => {
3322
3351
  input.signal?.throwIfAborted();
3323
3352
  if (!Number.isSafeInteger(input.accountId) || input.accountId <= 0)
@@ -3338,10 +3367,10 @@ var validateMeetingSeriesHistory = /* @__PURE__ */ __name((input) => {
3338
3367
  return { ...input, limit, maxReadBytes };
3339
3368
  }, "validateMeetingSeriesHistory");
3340
3369
 
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
3370
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/upcoming-validation.js
3342
3371
  var occurrenceId = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim().length > 0 && value.length <= 1e3 && !/[\0\r\n]/.test(value), "occurrenceId");
3343
3372
 
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
3373
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/series-inventory-validation.js
3345
3374
  function invalid4(field, response = false) {
3346
3375
  throw new CliError(response ? "invalid_response" : "validation_error", `invalid meeting inventory ${field}`);
3347
3376
  }
@@ -3370,7 +3399,7 @@ var validateMeetingSeriesInventoryCursor = /* @__PURE__ */ __name((value) => {
3370
3399
  cursorDetails(value);
3371
3400
  }, "validateMeetingSeriesInventoryCursor");
3372
3401
 
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
3402
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/stats.js
3374
3403
  var MEETING_COUNTS_GROUPINGS = ["day", "week", "series"];
3375
3404
  var zoneOf = /* @__PURE__ */ __name((timeZone) => {
3376
3405
  const zone = timeZone ?? "UTC";
@@ -3383,13 +3412,13 @@ var zoneOf = /* @__PURE__ */ __name((timeZone) => {
3383
3412
  }, "zoneOf");
3384
3413
  var DAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
3385
3414
  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);
3415
+ const parts2 = Object.fromEntries(format.formatToParts(new Date(at)).map((part) => [part.type, part.value]));
3416
+ const day2 = Date.UTC(Number(parts2.year), Number(parts2.month) - 1, Number(parts2.day));
3417
+ return new Date(day2 - DAYS.indexOf(parts2.weekday ?? "Mon") * 864e5).toISOString().slice(0, 10);
3389
3418
  }, "weekStart");
3390
3419
  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}`;
3420
+ const parts2 = Object.fromEntries(format.formatToParts(new Date(at)).map((part) => [part.type, part.value]));
3421
+ return `${parts2.year}-${parts2.month}-${parts2.day}`;
3393
3422
  }, "dayKey");
3394
3423
  var zoneFormat = /* @__PURE__ */ __name((zone) => new Intl.DateTimeFormat("en-US", {
3395
3424
  timeZone: zone,
@@ -3505,7 +3534,573 @@ var aggregateMeetingStats = /* @__PURE__ */ __name((rows, timeZone) => {
3505
3534
  };
3506
3535
  }, "aggregateMeetingStats");
3507
3536
 
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
3537
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/locator.js
3538
+ var SCHEME = "msg:";
3539
+ var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat, message }) => SCHEME + [provider, account, chat, message].map(encodeURIComponent).join("/"), "formatLocator");
3540
+ var isLocator = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith(SCHEME), "isLocator");
3541
+ var parseLocator = /* @__PURE__ */ __name((reference2) => {
3542
+ const trimmed = reference2.trim();
3543
+ const parts2 = trimmed.startsWith(SCHEME) ? trimmed.slice(SCHEME.length).split("/") : [];
3544
+ if (parts2.length !== 4 || parts2.some((part) => part === "")) {
3545
+ throw new CliError("validation_error", `"${singleLine(reference2)}" is not a message locator \u2014 expected msg:<provider>/<account>/<chat>/<message>`);
3546
+ }
3547
+ const [provider, account, chat, message] = parts2.map(decodeURIComponent);
3548
+ return { provider, account, chat, message };
3549
+ }, "parseLocator");
3550
+
3551
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/references.js
3552
+ var SIMPLE_REFERENCES = [
3553
+ "note",
3554
+ "document",
3555
+ "person",
3556
+ "organization",
3557
+ "project",
3558
+ "task",
3559
+ "memory",
3560
+ "fact",
3561
+ "bot",
3562
+ "event",
3563
+ "invoice",
3564
+ "payment",
3565
+ "order",
3566
+ "deal",
3567
+ "lead",
3568
+ "pipeline",
3569
+ "product",
3570
+ "contract",
3571
+ "subscription",
3572
+ "wallet",
3573
+ "transaction",
3574
+ "entity"
3575
+ ];
3576
+ var malformed = /* @__PURE__ */ __name((text6, shape) => new CliError("validation_error", `"${singleLine(text6)}" is not a reference \u2014 expected ${shape}`, {
3577
+ reason: "ref.malformed"
3578
+ }), "malformed");
3579
+ var parts = /* @__PURE__ */ __name((rest, count7, text6, shape) => {
3580
+ const split = rest.split("/");
3581
+ if (split.length !== count7 || split.some((part) => part === ""))
3582
+ throw malformed(text6, shape);
3583
+ return split.map(decodeURIComponent);
3584
+ }, "parts");
3585
+ var encoded = /* @__PURE__ */ __name((...values) => values.map(encodeURIComponent).join("/"), "encoded");
3586
+ var folderPath = /* @__PURE__ */ __name((path) => {
3587
+ const clean = path.split("/").filter((part) => part !== "" && part !== ".").join("/");
3588
+ return clean === "" ? path.trim() === "" ? "" : null : clean;
3589
+ }, "folderPath");
3590
+ var MEETING_SHAPE = "meeting:<account>/<meeting>[/<transcript>[/<cue>]] with safe integer ids";
3591
+ var kind = /* @__PURE__ */ __name((spec) => spec, "kind");
3592
+ var simple = /* @__PURE__ */ __name((prefix) => kind({
3593
+ prefix,
3594
+ type: prefix,
3595
+ shape: `${prefix}:<id>`,
3596
+ parse: /* @__PURE__ */ __name((rest, text6) => {
3597
+ if (!rest.trim())
3598
+ throw new CliError("validation_error", `"${singleLine(text6)}" names no ${prefix}`, {
3599
+ reason: "ref.malformed"
3600
+ });
3601
+ return { type: prefix, id: rest };
3602
+ }, "parse"),
3603
+ format: /* @__PURE__ */ __name((reference2) => `${reference2.type}:${reference2.id}`, "format")
3604
+ }), "simple");
3605
+ var REF_KINDS = [
3606
+ kind({
3607
+ prefix: "msg",
3608
+ type: "message",
3609
+ shape: "msg:<provider>/<account>/<chat>/<message>",
3610
+ parse: /* @__PURE__ */ __name((_, text6) => {
3611
+ try {
3612
+ return { type: "message", ...parseLocator(text6) };
3613
+ } catch {
3614
+ throw malformed(text6, "msg:<provider>/<account>/<chat>/<message>");
3615
+ }
3616
+ }, "parse"),
3617
+ format: formatLocator
3618
+ }),
3619
+ kind({
3620
+ prefix: "chat",
3621
+ type: "chat",
3622
+ shape: "chat:<provider>/<account>/<chat>",
3623
+ parse: /* @__PURE__ */ __name((rest, text6) => {
3624
+ const [provider, account, chat] = parts(rest, 3, text6, "chat:<provider>/<account>/<chat>");
3625
+ return { type: "chat", provider, account, chat };
3626
+ }, "parse"),
3627
+ format: /* @__PURE__ */ __name(({ provider, account, chat }) => `chat:${encoded(provider, account, chat)}`, "format")
3628
+ }),
3629
+ kind({
3630
+ prefix: "contact",
3631
+ type: "contact",
3632
+ shape: "contact:<provider>/<id>",
3633
+ parse: /* @__PURE__ */ __name((rest, text6) => {
3634
+ const [provider, id4] = parts(rest, 2, text6, "contact:<provider>/<id>");
3635
+ return { type: "contact", provider, id: id4 };
3636
+ }, "parse"),
3637
+ format: /* @__PURE__ */ __name(({ provider, id: id4 }) => `contact:${encoded(provider, id4)}`, "format")
3638
+ }),
3639
+ kind({
3640
+ prefix: "folder",
3641
+ type: "folder",
3642
+ shape: "folder:<id>[/<path>]",
3643
+ parse: /* @__PURE__ */ __name((rest, text6) => {
3644
+ const slash = rest.indexOf("/");
3645
+ const id4 = decodeURIComponent(slash < 0 ? rest : rest.slice(0, slash));
3646
+ const path = slash < 0 ? null : folderPath(decodeURIComponent(rest.slice(slash + 1)));
3647
+ if (!id4.trim() || path === "")
3648
+ throw malformed(text6, "folder:<id>[/<path>]");
3649
+ return { type: "folder", id: id4, path };
3650
+ }, "parse"),
3651
+ format: /* @__PURE__ */ __name(({ id: id4, path }) => path === null ? `folder:${encodeURIComponent(id4)}` : `folder:${encoded(id4, path)}`, "format")
3652
+ }),
3653
+ kind({
3654
+ prefix: "meeting",
3655
+ type: "meeting",
3656
+ shape: MEETING_SHAPE,
3657
+ parse: /* @__PURE__ */ __name((_, text6) => {
3658
+ try {
3659
+ return parseMeetingReference(text6);
3660
+ } catch {
3661
+ throw malformed(text6, MEETING_SHAPE);
3662
+ }
3663
+ }, "parse"),
3664
+ format: formatMeetingReference
3665
+ }),
3666
+ ...SIMPLE_REFERENCES.map(simple)
3667
+ ];
3668
+ var byPrefix = new Map(REF_KINDS.map((spec) => [spec.prefix, spec]));
3669
+ var byType = new Map(REF_KINDS.map((spec) => [spec.type, spec]));
3670
+ var offered = REF_KINDS.map(({ prefix }) => prefix).filter((prefix) => prefix !== "entity");
3671
+ var distance = /* @__PURE__ */ __name((a, b) => {
3672
+ let row = Array.from({ length: b.length + 1 }, (_, at) => at);
3673
+ for (const [i, x] of [...a].entries()) {
3674
+ const next = [i + 1];
3675
+ for (const [j, y] of [...b].entries())
3676
+ next.push(Math.min(row[j + 1] + 1, next[j] + 1, row[j] + (x === y ? 0 : 1)));
3677
+ row = next;
3678
+ }
3679
+ return row[b.length];
3680
+ }, "distance");
3681
+ 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");
3682
+ var unknownKind = /* @__PURE__ */ __name((text6, prefix, rest) => {
3683
+ const near2 = prefix === "" ? void 0 : nearest(prefix);
3684
+ const kinds = offered.map((one) => `${one}:`).join(", ");
3685
+ const hint = near2 === void 0 ? `; kinds: ${kinds}` : `; did you mean ${near2}:${singleLine(rest)}? Kinds: ${kinds}`;
3686
+ return new CliError("validation_error", `"${singleLine(text6)}" is no kind of reference${hint}`, {
3687
+ reason: "ref.unknown-kind"
3688
+ });
3689
+ }, "unknownKind");
3690
+ var formatReference = /* @__PURE__ */ __name((reference2) => byType.get(reference2.type).format(reference2), "formatReference");
3691
+ var parseReference = /* @__PURE__ */ __name((text6) => {
3692
+ const reference2 = text6.trim();
3693
+ const colon = reference2.indexOf(":");
3694
+ const prefix = colon < 0 ? "" : reference2.slice(0, colon);
3695
+ const rest = reference2.slice(colon + 1);
3696
+ const spec = byPrefix.get(prefix);
3697
+ if (!spec)
3698
+ throw unknownKind(reference2, prefix, rest);
3699
+ return spec.parse(rest, reference2);
3700
+ }, "parseReference");
3701
+ var canonicalReference = /* @__PURE__ */ __name((text6) => formatReference(parseReference(text6)), "canonicalReference");
3702
+ var looksLikeReference = /* @__PURE__ */ __name((text6) => {
3703
+ const match = /^([a-z]+):\S+$/.exec(text6.trim());
3704
+ return match !== null && byPrefix.has(match[1]);
3705
+ }, "looksLikeReference");
3706
+
3707
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/providers.js
3708
+ var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events", "crm"];
3709
+ var MESSENGER_OPENS = { chat: "messages list", message: "messages show", contact: "contacts show" };
3710
+ var PROVIDERS = [
3711
+ { name: "telegram", kind: "messages", aliases: ["tg"], command: "tg", opens: MESSENGER_OPENS },
3712
+ { name: "telegram-bot", kind: "messages", aliases: ["tg-bot"] },
3713
+ { name: "max", kind: "messages", aliases: [], command: "max", opens: MESSENGER_OPENS },
3714
+ { name: "max-bot", kind: "messages", aliases: [] },
3715
+ { name: "whatsapp", kind: "messages", aliases: ["wa"], command: "wa", opens: MESSENGER_OPENS },
3716
+ { name: "whatsapp-bot", kind: "messages", aliases: ["wa-bot"] },
3717
+ { name: "email", kind: "mail", aliases: [] },
3718
+ { name: "notes", kind: "notes", aliases: [] },
3719
+ { name: "local", kind: "notes", aliases: [] },
3720
+ { name: "obsidian", kind: "notes", aliases: [] },
3721
+ { name: "added", kind: "notes", aliases: [] },
3722
+ { name: "zoom", kind: "meetings", aliases: [] },
3723
+ // A phone export's records: its SMS and its calls in the one account the import names.
3724
+ { name: "phone", kind: "messages", kinds: ["messages", "events"], aliases: [], imported: true }
3725
+ ];
3726
+ var LABELS = {
3727
+ telegram: "Telegram",
3728
+ "telegram-bot": "Telegram bot",
3729
+ max: "MAX",
3730
+ "max-bot": "MAX bot",
3731
+ whatsapp: "WhatsApp",
3732
+ "whatsapp-bot": "WhatsApp bot",
3733
+ "google-drive": "Google Drive",
3734
+ added: "added by hand",
3735
+ email: "mail"
3736
+ };
3737
+ var providerLabel = /* @__PURE__ */ __name((provider) => LABELS[provider] ?? provider, "providerLabel");
3738
+ var FOLDER_PROVIDERS = ["local", "obsidian", "folder"];
3739
+ var isFolderProvider = /* @__PURE__ */ __name((provider) => FOLDER_PROVIDERS.includes(provider), "isFolderProvider");
3740
+ var folderProviderSql = /* @__PURE__ */ __name((column = "provider") => `${column} IN (${FOLDER_PROVIDERS.map((name) => `'${name}'`).join(", ")})`, "folderProviderSql");
3741
+ var folderProviderOf = /* @__PURE__ */ __name((format) => format === "markdown" ? "local" : "obsidian", "folderProviderOf");
3742
+ var DOCUMENT_ACCOUNT_PROVIDERS = ["google-drive"];
3743
+ var isDocumentAccountProvider = /* @__PURE__ */ __name((provider) => DOCUMENT_ACCOUNT_PROVIDERS.includes(provider), "isDocumentAccountProvider");
3744
+ var ADDED_PROVIDER = "added";
3745
+ var ADDED_ACCOUNT = "owner";
3746
+ var notAdded = `d.account_id NOT IN (SELECT id FROM accounts WHERE provider = '${ADDED_PROVIDER}')`;
3747
+ var filesAccountSql = /* @__PURE__ */ __name((column = "provider") => `${column} IN (${[...FOLDER_PROVIDERS, ...DOCUMENT_ACCOUNT_PROVIDERS, ADDED_PROVIDER].map((name) => `'${name}'`).join(", ")})`, "filesAccountSql");
3748
+ var INTERNAL_NOTES = "internal";
3749
+ var UNKNOWN_PROVIDER = "unknown provider \u2014 run its CLI once";
3750
+ var WORD = /^[a-z0-9][a-z0-9_-]*$/;
3751
+ var invalid5 = /* @__PURE__ */ __name((message) => {
3752
+ throw new CliError("validation_error", message);
3753
+ }, "invalid");
3754
+ 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");
3755
+ var OPEN_KINDS = new Set(REF_KINDS.map(({ type }) => type).filter((type) => type !== "entity"));
3756
+ var COMMAND_WORDS = /^[a-z0-9][a-z0-9_-]*( [a-z0-9][a-z0-9_-]*)*$/;
3757
+ var opensOf = /* @__PURE__ */ __name((value, named) => {
3758
+ if (typeof value !== "object" || value === null || Array.isArray(value))
3759
+ return invalid5(`provider ${named}'s opens maps a kind of reference to a command`);
3760
+ const known = Object.entries(value).filter(([kind2]) => OPEN_KINDS.has(kind2));
3761
+ for (const [kind2, command] of known)
3762
+ if (typeof command !== "string" || !COMMAND_WORDS.test(command))
3763
+ invalid5(`provider ${named} opens a ${kind2} with command words, not ${JSON.stringify(command)}`);
3764
+ return Object.fromEntries(known);
3765
+ }, "opensOf");
3766
+ var providerEntryOf = /* @__PURE__ */ __name((value) => {
3767
+ if (typeof value !== "object" || value === null || Array.isArray(value))
3768
+ return invalid5("a provider entry is an object");
3769
+ const { name, kind: kind2, kinds, aliases = [], command, opens, imported } = value;
3770
+ const named = wordOf(name, "a provider's name");
3771
+ const isKindWord = /* @__PURE__ */ __name((one) => typeof one === "string" && KINDS.includes(one), "isKindWord");
3772
+ const given = kinds === void 0 ? [kind2] : Array.isArray(kinds) && kinds.length > 0 ? kinds : [void 0];
3773
+ for (const one of given)
3774
+ if (!isKindWord(one))
3775
+ invalid5(`provider ${named}'s kind is one of ${KINDS.join(", ")} \u2014 not ${JSON.stringify(one)}`);
3776
+ const list = [...new Set(given)];
3777
+ if (kind2 !== void 0 && kind2 !== list[0])
3778
+ invalid5(`provider ${named}'s kind is the first of its kinds`);
3779
+ if (!Array.isArray(aliases))
3780
+ invalid5(`provider ${named}'s aliases are a list`);
3781
+ if (imported !== void 0 && typeof imported !== "boolean")
3782
+ invalid5(`provider ${named}'s imported is true or false`);
3783
+ return {
3784
+ name: named,
3785
+ kind: list[0],
3786
+ ...list.length > 1 ? { kinds: list } : {},
3787
+ ...imported === true ? { imported: true } : {},
3788
+ aliases: [...new Set(aliases.map((alias) => wordOf(alias, `an alias of ${named}`)))],
3789
+ ...command === void 0 ? {} : { command: wordOf(command, `the command of ${named}`) },
3790
+ ...opens === void 0 ? {} : { opens: opensOf(opens, named) }
3791
+ };
3792
+ }, "providerEntryOf");
3793
+ var kindsOfEntry = /* @__PURE__ */ __name((entry) => entry.kinds ?? [entry.kind], "kindsOfEntry");
3794
+ var describe = /* @__PURE__ */ __name((entry) => `${entry.name} (${kindsOfEntry(entry).join(", ")}${entry.command ? `, from ${entry.command}` : ""})`, "describe");
3795
+ var unitedKinds = /* @__PURE__ */ __name((known, entry) => [
3796
+ .../* @__PURE__ */ new Set([...known, ...entry])
3797
+ ], "unitedKinds");
3798
+ var wordsOf2 = /* @__PURE__ */ __name(({ name, aliases }) => [name, ...aliases], "wordsOf");
3799
+ var joined = /* @__PURE__ */ __name((known, entry) => {
3800
+ const same = known.find(({ name }) => name === entry.name);
3801
+ const kinds = same ? unitedKinds(kindsOfEntry(same), kindsOfEntry(entry)) : kindsOfEntry(entry);
3802
+ if (same && same.kind !== entry.kind)
3803
+ invalid5(`two provider entries disagree on the kind: ${describe(same)} and ${describe(entry)}`);
3804
+ if (same && entry.imported === true && same.imported !== true)
3805
+ invalid5(`provider ${entry.name} is synced, so an entry cannot make it import-only`);
3806
+ const merged = same ? {
3807
+ ...same,
3808
+ ...kinds.length > 1 ? { kinds } : {},
3809
+ aliases: [.../* @__PURE__ */ new Set([...same.aliases, ...entry.aliases])],
3810
+ ...entry.command ? { command: entry.command } : {},
3811
+ ...entry.opens ? { opens: { ...same.opens, ...entry.opens } } : {}
3812
+ } : entry;
3813
+ const others = known.filter((one) => one !== same);
3814
+ for (const word of wordsOf2(merged)) {
3815
+ const owner = others.find((one) => wordsOf2(one).includes(word));
3816
+ if (owner)
3817
+ invalid5(`"${word}" names two providers: ${describe(owner)} and ${describe(merged)}`);
3818
+ }
3819
+ return same ? known.map((one) => one === same ? merged : one) : [...known, merged];
3820
+ }, "joined");
3821
+ var registry = PROVIDERS;
3822
+ var providers = /* @__PURE__ */ __name(() => registry, "providers");
3823
+ var useStoredProviders = /* @__PURE__ */ __name((entries) => {
3824
+ const left = [];
3825
+ registry = entries.reduce((known, entry) => {
3826
+ try {
3827
+ return joined(known, providerEntryOf(entry));
3828
+ } catch (error) {
3829
+ if (!(error instanceof CliError))
3830
+ throw error;
3831
+ left.push(entry);
3832
+ return known;
3833
+ }
3834
+ }, PROVIDERS);
3835
+ return left;
3836
+ }, "useStoredProviders");
3837
+ var addProvider = /* @__PURE__ */ __name((entry) => {
3838
+ registry = joined(registry, providerEntryOf(entry));
3839
+ }, "addProvider");
3840
+ var isKind = /* @__PURE__ */ __name((word) => KINDS.includes(word.toLowerCase()), "isKind");
3841
+ var providerNamed = /* @__PURE__ */ __name((word) => {
3842
+ const wanted = word.toLowerCase();
3843
+ return registry.find((entry) => wordsOf2(entry).includes(wanted));
3844
+ }, "providerNamed");
3845
+ var kindIn = /* @__PURE__ */ __name((provider) => isFolderProvider(provider) ? "notes" : registry.find(({ name }) => name === provider)?.kind, "kindIn");
3846
+ var kindsIn = /* @__PURE__ */ __name((provider) => {
3847
+ if (isFolderProvider(provider))
3848
+ return ["notes"];
3849
+ const entry = registry.find(({ name }) => name === provider);
3850
+ return entry ? kindsOfEntry(entry) : [];
3851
+ }, "kindsIn");
3852
+ var importedOf = /* @__PURE__ */ __name((entry, held) => {
3853
+ const builtIn = PROVIDERS.find(({ name }) => name === entry.name);
3854
+ if (builtIn) {
3855
+ if (entry.imported === true && builtIn.imported !== true)
3856
+ invalid5(`provider ${entry.name} is synced, so an entry cannot make it import-only`);
3857
+ return builtIn.imported === true;
3858
+ }
3859
+ if (held === void 0)
3860
+ return entry.imported === true;
3861
+ if (entry.imported === true && held.imported !== true)
3862
+ invalid5(`provider ${entry.name} was registered without imported: an entry cannot make it import-only later`);
3863
+ return held.imported === true;
3864
+ }, "importedOf");
3865
+ var isImportedProvider = /* @__PURE__ */ __name((provider) => registry.find(({ name }) => name === provider)?.imported === true, "isImportedProvider");
3866
+ var holdsKind = /* @__PURE__ */ __name((provider, kind2) => kindsIn(provider).includes(kind2), "holdsKind");
3867
+ var holdsKindOf = /* @__PURE__ */ __name((provider, kind2) => kindIn(provider) === void 0 ? kind2 === "messages" : holdsKind(provider, kind2), "holdsKindOf");
3868
+ var kindOf2 = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
3869
+
3870
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/search/query.js
3871
+ var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
3872
+ 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");
3873
+ var fail = /* @__PURE__ */ __name((message) => {
3874
+ throw new CliError("validation_error", message);
3875
+ }, "fail");
3876
+ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
3877
+ const sources = [...providers2, "personal", "bots", "all"];
3878
+ const source = value.toLowerCase();
3879
+ if (sources.includes(source))
3880
+ return source;
3881
+ if (source === "mail")
3882
+ return "email";
3883
+ if (source === "messages")
3884
+ return source;
3885
+ if (isKind(source))
3886
+ fail(`${name}${source} names ${source}, which a message search does not read \u2014 search ${source === "meetings" || source === "events" ? `all --source ${source}` : "notes"} does`);
3887
+ const named = providerNamed(source);
3888
+ if (named && providers2.includes(named.name))
3889
+ return named.name;
3890
+ return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
3891
+ }, "sourceOf");
3892
+
3893
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/search/account-list.js
3894
+ var ACCOUNT_GROUPS = "accountGroups";
3895
+ var ACCOUNT_GROUPS_SETTING = "account_groups";
3896
+ var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
3897
+ var fail2 = /* @__PURE__ */ __name((message) => {
3898
+ throw new CliError("validation_error", message);
3899
+ }, "fail");
3900
+ var isAccountList = /* @__PURE__ */ __name((value) => value.includes(",") || value.includes(":"), "isAccountList");
3901
+ var itemsOf = /* @__PURE__ */ __name((value) => {
3902
+ const items = value.split(",").map((item) => item.trim());
3903
+ if (items.some((item) => item === ""))
3904
+ fail2(`"${value}" has an empty entry \u2014 separate accounts with one comma`);
3905
+ return items;
3906
+ }, "itemsOf");
3907
+ var isGroupName = /* @__PURE__ */ __name((name) => GROUP_NAME.test(name), "isGroupName");
3908
+ var groupName = /* @__PURE__ */ __name((name) => isGroupName(name) ? name : fail2(`a group name is letters, digits, - and _ \u2014 not "${name}"`), "groupName");
3909
+ 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");
3910
+ var describe2 = /* @__PURE__ */ __name((accounts) => accounts.map(({ provider, account, name }) => `${provider}:${account}${name ? ` (${name})` : ""}`).join(", "), "describe");
3911
+ var listedHolds = /* @__PURE__ */ __name((account, kind2) => (account.kinds ?? (account.kind === void 0 ? [] : [account.kind])).includes(kind2), "listedHolds");
3912
+ var kindHere = /* @__PURE__ */ __name((provider, running) => provider === running.provider ? kindOf2(provider) : kindIn(provider), "kindHere");
3913
+ var kindsOfHere = /* @__PURE__ */ __name((provider, running) => {
3914
+ const kinds = kindsIn(provider);
3915
+ return { kind: kindHere(provider, running), ...kinds.length > 1 ? { kinds } : {} };
3916
+ }, "kindsOfHere");
3917
+ var heldOf = /* @__PURE__ */ __name((stored, running) => [
3918
+ ...stored.filter(({ provider }) => kindIn(provider) !== "notes" && !isDocumentAccountProvider(provider)).map(({ provider, account, name }) => ({ provider, account, name, ...kindsOfHere(provider, running) })),
3919
+ { provider: "notes", account: INTERNAL_NOTES, name: null, kind: "notes" },
3920
+ ...stored.filter(({ provider }) => isFolderProvider(provider)).map(({ id: id4, name, provider, account }) => ({
3921
+ provider: "notes",
3922
+ account: String(id4),
3923
+ name,
3924
+ kind: "notes",
3925
+ stored: { provider, account }
3926
+ })),
3927
+ ...stored.filter(({ provider }) => isDocumentAccountProvider(provider) || provider === ADDED_PROVIDER).map(({ id: id4, provider, account, name }) => ({
3928
+ provider: "notes",
3929
+ account: String(id4),
3930
+ name,
3931
+ kind: "notes",
3932
+ stored: { provider, account }
3933
+ }))
3934
+ ], "heldOf");
3935
+ var storedAs = /* @__PURE__ */ __name((held, key) => held.filter(({ stored }) => stored?.provider === key.provider && (key.account === "" || stored.account === key.account)), "storedAs");
3936
+ var registry2 = /* @__PURE__ */ __name(() => providers().map(({ name, aliases }) => aliases.length ? `${name} (${aliases.join(", ")})` : name).join(", "), "registry");
3937
+ var providerOf = /* @__PURE__ */ __name((prefix, held, { running, profiles }) => {
3938
+ const wanted = prefix.toLowerCase();
3939
+ if (wanted === running.command?.toLowerCase())
3940
+ return running.provider;
3941
+ const providers2 = [...new Set(held.map(({ provider }) => provider))];
3942
+ if (providers2.includes(wanted) || isDocumentAccountProvider(wanted))
3943
+ return wanted;
3944
+ const named = providerNamed(wanted);
3945
+ if (named)
3946
+ return named.name;
3947
+ const recorded = Object.values(profiles[wanted] ?? {})[0];
3948
+ if (recorded)
3949
+ return recorded.provider;
3950
+ return fail2(`${prefix} is not a provider \u2014 they are ${registry2()}; the store holds ${providers2.join(", ")}`);
3951
+ }, "providerOf");
3952
+ var profilesOf = /* @__PURE__ */ __name((provider, profiles) => Object.values(profiles).flatMap((named) => Object.entries(named).filter(([, key]) => key.provider === provider)), "profilesOf");
3953
+ var accountOf = /* @__PURE__ */ __name((prefix, ref, held, context3) => {
3954
+ const provider = providerOf(prefix, held, context3);
3955
+ if (isDocumentAccountProvider(provider) && !context3.profiles[prefix.toLowerCase()]?.[ref]) {
3956
+ const stored = storedAs(held, { provider, account: ref })[0];
3957
+ if (stored)
3958
+ return stored;
3959
+ }
3960
+ const folder = isFolderProvider(provider);
3961
+ const ofProvider = folder ? storedAs(held, { provider, account: "" }) : held.filter((one) => one.provider === provider);
3962
+ const byId = ofProvider.find(({ account, stored }) => account === ref || account === ref.toLowerCase() || folder && stored?.account === ref.toUpperCase());
3963
+ if (byId)
3964
+ return byId;
3965
+ const keyed = /* @__PURE__ */ __name((key) => ofProvider.find(({ account }) => account === key.account) ?? {
3966
+ ...key,
3967
+ name: null,
3968
+ ...kindsOfHere(key.provider, context3.running)
3969
+ }, "keyed");
3970
+ const recorded = context3.profiles[prefix.toLowerCase()]?.[ref];
3971
+ if (recorded && isFolderProvider(recorded.provider)) {
3972
+ const folder2 = held.find((one) => one.provider === "notes" && one.name === recorded.account);
3973
+ if (folder2)
3974
+ return folder2;
3975
+ return fail2(`no stored folder for ${prefix}:${ref}; sync that profile first`);
3976
+ }
3977
+ if (recorded && isDocumentAccountProvider(recorded.provider)) {
3978
+ const account = storedAs(held, recorded)[0];
3979
+ if (account)
3980
+ return account;
3981
+ return fail2(`no stored documents for ${prefix}:${ref}; sync that profile first`);
3982
+ }
3983
+ if (recorded)
3984
+ return keyed(recorded);
3985
+ const byProfile = [
3986
+ ...new Map(profilesOf(provider, context3.profiles).filter(([name]) => name === ref).map(([, key]) => [key.account, key])).values()
3987
+ ];
3988
+ if (byProfile.length === 1)
3989
+ return keyed(byProfile[0]);
3990
+ const byName = ofProvider.filter(({ name }) => name?.toLowerCase() === ref.toLowerCase());
3991
+ if (byName.length === 1)
3992
+ return byName[0];
3993
+ if (byName.length > 1 || byProfile.length > 1)
3994
+ fail2(`${provider}:${ref} names more than one account \u2014 use the id: ${describe2(ofProvider)}`);
3995
+ const names = profilesOf(provider, context3.profiles).map(([name]) => name);
3996
+ return fail2(`no ${provider} account "${ref}" \u2014 the store holds ${describe2(ofProvider) || "none"}` + (names.length ? `; profiles: ${[...new Set(names)].join(", ")}` : ""));
3997
+ }, "accountOf");
3998
+ var accountsOfWord = /* @__PURE__ */ __name((word, held, context3) => {
3999
+ const wanted = word.toLowerCase();
4000
+ if (wanted === "all")
4001
+ return [...held];
4002
+ if (wanted === "personal" || wanted === "bots")
4003
+ return held.filter((one) => listedHolds(one, "messages") && isBotProvider(one.provider) === (wanted === "bots"));
4004
+ if (isKind(wanted))
4005
+ return held.filter((one) => listedHolds(one, wanted));
4006
+ const recorded = context3.profiles[wanted];
4007
+ if (recorded && Object.values(recorded).every((key) => isFolderProvider(key.provider) || isDocumentAccountProvider(key.provider)))
4008
+ return Object.keys(recorded).map((profile) => accountOf(word, profile, held, context3));
4009
+ const provider = providerOf(word, held, context3);
4010
+ if (isDocumentAccountProvider(provider) || isFolderProvider(provider))
4011
+ return storedAs(held, { provider, account: "" });
4012
+ return held.filter((one) => one.provider === provider);
4013
+ }, "accountsOfWord");
4014
+ var keyOf = /* @__PURE__ */ __name(({ provider, account }) => `${provider}\0${account}`, "keyOf");
4015
+ var sourceOf2 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}:${account}`, "sourceOf");
4016
+ var sameAs = /* @__PURE__ */ __name((key) => (one) => one.provider === key.provider && one.account === key.account, "sameAs");
4017
+ var entriesOfList = /* @__PURE__ */ __name((value, context3) => {
4018
+ const held = heldOf(context3.held, context3.running);
4019
+ const entries = [];
4020
+ const entry = /* @__PURE__ */ __name((item, group) => {
4021
+ const colon = item.indexOf(":");
4022
+ if (colon === -1) {
4023
+ try {
4024
+ entries.push({ entry: item, accounts: accountsOfWord(item, held, context3) });
4025
+ } catch (error) {
4026
+ if (!group || !(error instanceof CliError))
4027
+ throw error;
4028
+ fail2(`"${item}" in group ${group}: ${error.message}`);
4029
+ }
4030
+ return;
4031
+ }
4032
+ const prefix = item.slice(0, colon);
4033
+ const ref = item.slice(colon + 1).trim();
4034
+ if (ref === "")
4035
+ fail2(`"${item}" names no account after the colon`);
4036
+ if (prefix.toLowerCase() === "group") {
4037
+ if (group)
4038
+ fail2(`group ${group} lists another group \u2014 a group lists accounts`);
4039
+ const members = context3.groups[ref];
4040
+ if (!members) {
4041
+ const known = Object.keys(context3.groups);
4042
+ fail2(`no account group "${ref}" \u2014 ${known.length ? `there are ${known.join(", ")}` : "none saved yet"}; \`config set ${ACCOUNT_GROUPS_SETTING}.${ref} <accounts>\` saves one`);
4043
+ }
4044
+ for (const member of members)
4045
+ entry(member, ref);
4046
+ return;
4047
+ }
4048
+ entries.push({ entry: item, accounts: [accountOf(prefix, ref, held, context3)] });
4049
+ }, "entry");
4050
+ for (const item of itemsOf(value))
4051
+ entry(item);
4052
+ const { only } = context3;
4053
+ return entries.map(({ entry: entry2, accounts }) => ({
4054
+ entry: entry2,
4055
+ accounts: accounts.filter((one) => only === void 0 || only.has(keyOf(one))).map(({ provider, account, kind: kind2, kinds }) => ({
4056
+ provider,
4057
+ account,
4058
+ kind: kind2,
4059
+ ...kinds === void 0 ? {} : { kinds }
4060
+ }))
4061
+ }));
4062
+ }, "entriesOfList");
4063
+ var accountsOfList = /* @__PURE__ */ __name((value, context3) => {
4064
+ const chosen = /* @__PURE__ */ new Map();
4065
+ for (const { accounts } of entriesOfList(value, context3))
4066
+ for (const one of accounts)
4067
+ if (!chosen.has(keyOf(one)))
4068
+ chosen.set(keyOf(one), one);
4069
+ return [...chosen.values()];
4070
+ }, "accountsOfList");
4071
+ var READS = {
4072
+ messages: "messenger messages \u2014 search messages reads them",
4073
+ mail: "a mailbox \u2014 memo search mail reads it",
4074
+ notes: "notes \u2014 search notes reads them",
4075
+ documents: "documents \u2014 search notes reads them",
4076
+ meetings: "meetings \u2014 search all reads them",
4077
+ events: "calendar events \u2014 no search reads them yet",
4078
+ crm: "CRM deals and leads \u2014 search all reads them"
4079
+ };
4080
+ var fitting = /* @__PURE__ */ __name((entries, kinds, what, reasonOf = (kind2) => READS[kind2], alsoFits = () => false) => {
4081
+ const chosen = /* @__PURE__ */ new Map();
4082
+ const skipped = [];
4083
+ for (const { entry, accounts } of entries) {
4084
+ const fits = accounts.filter((one) => kinds.some((kind2) => listedHolds(one, kind2)) || alsoFits(one));
4085
+ for (const { provider, account } of fits)
4086
+ if (!chosen.has(keyOf({ provider, account })))
4087
+ chosen.set(keyOf({ provider, account }), { provider, account });
4088
+ const known = accounts.filter(({ kind: kind2 }) => kind2 !== void 0);
4089
+ const unknown2 = accounts.filter((one) => one.kind === void 0 && !alsoFits(one));
4090
+ if (known.length)
4091
+ for (const { provider, account } of unknown2)
4092
+ skipped.push({ source: `${provider}:${account}`, code: "not_found", reason: UNKNOWN_PROVIDER });
4093
+ if (fits.length)
4094
+ continue;
4095
+ const other = known[0];
4096
+ 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" });
4097
+ }
4098
+ if (chosen.size === 0)
4099
+ fail2(`--source names nothing ${what} reads: ${skipped.map(({ source, reason }) => `${source} (${reason})`).join(", ")}`);
4100
+ return { accounts: [...chosen.values()], skipped };
4101
+ }, "fitting");
4102
+
4103
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/deals.js
3509
4104
  var DEAL_KINDS = ["deal", "lead"];
3510
4105
  var DEAL_STATUSES = ["open", "won", "lost"];
3511
4106
  var STAGE_OUTCOMES = DEAL_STATUSES;
@@ -3515,24 +4110,521 @@ var dealLine = /* @__PURE__ */ __name((deal) => {
3515
4110
  return `${deal.title} \xB7 ${deal.stage}${money}${deal.status === "open" ? "" : ` (${deal.status})`}`;
3516
4111
  }, "dealLine");
3517
4112
 
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
4113
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/orders.js
3519
4114
  var ORDER_STATUSES = ["placed", "shipped", "delivered", "cancelled", "returned"];
3520
4115
  var ORDER_PURPOSES = ["personal", "business", "client", "other"];
3521
4116
  var orderLine = /* @__PURE__ */ __name((order) => {
4117
+ const party = order.direction === "sale" && order.customerName !== null ? `to ${order.customerName}` : order.supplierName;
3522
4118
  const money = order.total === null || order.currency === null ? "" : `, ${moneyLabel(order.total, order.currency)}`;
3523
4119
  const notes2 = [order.status, order.review === "confirmed" ? null : order.review].filter(Boolean).join(", ");
3524
- return `${order.number ?? `#${order.id}`} \xB7 ${order.supplierName}${money} (${notes2})`;
4120
+ return `${order.number ?? `#${order.id}`} \xB7 ${party}${money} (${notes2})`;
3525
4121
  }, "orderLine");
3526
4122
  var orderTitle = /* @__PURE__ */ __name((order) => `Order ${orderLine(order)}`, "orderTitle");
3527
4123
 
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
4124
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/store/source-review.js
3529
4125
  var SOURCE_REVIEW_KIND = "memory_source_review";
3530
4126
  var SOURCE_REVIEW_CAUSES = ["changed", "outdated", "deleted", "contradicted"];
3531
4127
  var ERASED_TEXT = "[source erased]";
3532
4128
  var severity = /* @__PURE__ */ __name((cause) => SOURCE_REVIEW_CAUSES.indexOf(cause), "severity");
3533
4129
  var graver = /* @__PURE__ */ __name((a, b) => severity(b) > severity(a) ? b : a, "graver");
3534
4130
 
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
4131
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/runs/log-keys.js
4132
+ var snake = /* @__PURE__ */ __name((key) => key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "snake");
4133
+ var camel = /* @__PURE__ */ __name((key) => key.replace(/_([a-z0-9])/g, (_, letter) => letter.toUpperCase()), "camel");
4134
+ var renamed = /* @__PURE__ */ __name((record2, name) => Object.fromEntries(Object.entries(record2).map(([key, value]) => [name(key), value])), "renamed");
4135
+ var logAttributes = /* @__PURE__ */ __name((event2) => renamed(event2, snake), "logAttributes");
4136
+ var fromLogAttributes = /* @__PURE__ */ __name((attributes) => renamed(attributes, camel), "fromLogAttributes");
4137
+ var snakeLogger = /* @__PURE__ */ __name((logger) => ({
4138
+ debug: /* @__PURE__ */ __name((event2, message) => logger.debug(logAttributes(event2), message), "debug"),
4139
+ info: /* @__PURE__ */ __name((event2, message) => logger.info(logAttributes(event2), message), "info"),
4140
+ warn: /* @__PURE__ */ __name((event2, message) => logger.warn(logAttributes(event2), message), "warn"),
4141
+ error: /* @__PURE__ */ __name((event2, message) => logger.error(logAttributes(event2), message), "error")
4142
+ }), "snakeLogger");
4143
+
4144
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/runs/log-attributes.js
4145
+ var diagnostic = {
4146
+ event: true,
4147
+ operation: true,
4148
+ opcode: true,
4149
+ seq: true,
4150
+ status: true,
4151
+ method: true,
4152
+ endpointTemplate: true,
4153
+ bytes: true,
4154
+ ids: true,
4155
+ counts: true,
4156
+ durationMs: true,
4157
+ outcome: true,
4158
+ errorCode: true,
4159
+ providerError: true,
4160
+ level: true,
4161
+ transport: true,
4162
+ attempt: true,
4163
+ waitMs: true,
4164
+ code: true,
4165
+ detail: true,
4166
+ reason: true,
4167
+ ageMs: true,
4168
+ kind: true,
4169
+ table: true,
4170
+ op: true,
4171
+ n: true
4172
+ };
4173
+ var send = {
4174
+ profile: true,
4175
+ chatId: true,
4176
+ outcome: true,
4177
+ kind: true,
4178
+ action: true,
4179
+ people: true,
4180
+ messageId: true,
4181
+ key: true,
4182
+ count: true,
4183
+ forEveryone: true,
4184
+ sendId: true,
4185
+ operationId: true,
4186
+ parentOperationId: true,
4187
+ replyTo: true,
4188
+ threadId: true,
4189
+ sendAs: true,
4190
+ resultChatId: true,
4191
+ length: true,
4192
+ attachments: true,
4193
+ scheduledFor: true,
4194
+ notify: true,
4195
+ origin: true,
4196
+ reservation: true,
4197
+ errorCode: true
4198
+ };
4199
+ var background = [
4200
+ "job",
4201
+ "pid",
4202
+ "schedule",
4203
+ "exitCode",
4204
+ "tool",
4205
+ "tier",
4206
+ "actorType",
4207
+ "actorId",
4208
+ "agent",
4209
+ "targetType",
4210
+ "targetId"
4211
+ ];
4212
+ var crash = ["errorClass", "frames"];
4213
+ var dropped = ["dropped"];
4214
+ var LOG_ATTRIBUTES = [
4215
+ ...new Set([...Object.keys(diagnostic), ...Object.keys(send), ...background, ...crash, ...dropped].map((key) => Object.keys(logAttributes({ [key]: true }))[0]))
4216
+ ].sort();
4217
+
4218
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/runs/run.js
4219
+ import { randomUUID } from "node:crypto";
4220
+ import { appendFileSync, mkdirSync, readdirSync, readFileSync as readFileSync2, rmSync as rmSync2, statSync as statSync2, writeFileSync as writeFileSync2 } from "node:fs";
4221
+ import { userInfo } from "node:os";
4222
+ import { join, sep } from "node:path";
4223
+ var KEEP_RUNS_FOR_DAYS = 30;
4224
+ var KEEP_SUCCESSFUL_RUNS_FOR_DAYS = 7;
4225
+ var KEEP_STORE_RUNS_FOR_DAYS = 3;
4226
+ var RUNS_SIZE_LIMIT_MB = 200;
4227
+ var runsDirFor = /* @__PURE__ */ __name((app, env = process.env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "runs"), "runsDirFor");
4228
+ var startRun = /* @__PURE__ */ __name((options) => {
4229
+ const now = options.now ?? (() => /* @__PURE__ */ new Date());
4230
+ const startedAt = options.startedAt ?? now();
4231
+ const id4 = options.runId ?? newRunId(startedAt, options.command);
4232
+ const dir = join(options.runsDir, day(startedAt), id4);
4233
+ pruneRuns(options.runsDir, {
4234
+ keepDays: options.keepDays ?? KEEP_RUNS_FOR_DAYS,
4235
+ keepSuccessDays: options.keepSuccessDays ?? KEEP_SUCCESSFUL_RUNS_FOR_DAYS,
4236
+ keepStoreDays: options.keepStoreDays ?? KEEP_STORE_RUNS_FOR_DAYS,
4237
+ maxBytes: options.maxBytes ?? RUNS_SIZE_LIMIT_MB * 1024 * 1024,
4238
+ now: startedAt
4239
+ });
4240
+ refuseRealStateInTests(dir);
4241
+ const metadata = {
4242
+ runId: id4,
4243
+ command: options.command,
4244
+ ...options.profile === void 0 ? {} : { profile: options.profile },
4245
+ startedAt: startedAt.toISOString(),
4246
+ status: "running",
4247
+ cliVersion: options.cliVersion,
4248
+ runtime: runtime(),
4249
+ platform: process.platform,
4250
+ arch: process.arch,
4251
+ ...options.traceId === void 0 ? {} : { traceId: options.traceId },
4252
+ ...options.context
4253
+ };
4254
+ let file;
4255
+ const opened = /* @__PURE__ */ __name(() => {
4256
+ if (file)
4257
+ return file;
4258
+ mkdirSync(dir, { recursive: true, mode: 448 });
4259
+ const events = join(dir, "events.jsonl");
4260
+ writeFileSync2(events, "", { flag: "a", mode: 384 });
4261
+ file = snakeLogger(createRecordLog({
4262
+ to: events,
4263
+ runId: id4,
4264
+ command: options.command,
4265
+ resource: { service: options.service, version: options.cliVersion },
4266
+ allow: LOG_ATTRIBUTES,
4267
+ ...options.traceId === void 0 ? {} : { traceId: options.traceId },
4268
+ ...options.onError === void 0 ? {} : { onError: options.onError }
4269
+ }));
4270
+ writeRunFile(dir, metadata);
4271
+ return file;
4272
+ }, "opened");
4273
+ if (!options.lazy)
4274
+ opened();
4275
+ let finished = false;
4276
+ const operations = /* @__PURE__ */ new Set();
4277
+ const codes = /* @__PURE__ */ new Set();
4278
+ const tables = /* @__PURE__ */ new Set();
4279
+ const noted = /* @__PURE__ */ __name((level) => (event2, message) => {
4280
+ const { operation, errorCode, error_code, code, kind: kind2, table } = event2;
4281
+ if (typeof operation === "string")
4282
+ operations.add(operation);
4283
+ if (kind2 === "store" && typeof table === "string")
4284
+ tables.add(table);
4285
+ for (const value of [errorCode, error_code, code])
4286
+ if (typeof value === "string")
4287
+ codes.add(value);
4288
+ if (finished)
4289
+ return;
4290
+ opened()[level](event2, message);
4291
+ }, "noted");
4292
+ const logger = { debug: noted("debug"), info: noted("info"), warn: noted("warn"), error: noted("error") };
4293
+ return {
4294
+ id: id4,
4295
+ dir,
4296
+ logger,
4297
+ finish: /* @__PURE__ */ __name(async (status, extra = {}) => {
4298
+ if (finished)
4299
+ return;
4300
+ finished = true;
4301
+ const completedAt = now();
4302
+ const final = {
4303
+ ...metadata,
4304
+ ...extra,
4305
+ status,
4306
+ completedAt: completedAt.toISOString(),
4307
+ durationMs: completedAt.getTime() - startedAt.getTime(),
4308
+ operations: [...operations].sort(),
4309
+ codes: [...codes].sort(),
4310
+ ...tables.size > 0 ? { tables: [...tables].sort() } : {}
4311
+ };
4312
+ if (file || status !== "success") {
4313
+ opened();
4314
+ writeRunFile(dir, final);
4315
+ return;
4316
+ }
4317
+ try {
4318
+ mkdirSync(join(dir, ".."), { recursive: true, mode: 448 });
4319
+ appendIndex(join(dir, ".."), runFileOf(final));
4320
+ } catch (error) {
4321
+ options.onError?.(error);
4322
+ }
4323
+ }, "finish")
4324
+ };
4325
+ }, "startRun");
4326
+ var refuseRealStateInTests = /* @__PURE__ */ __name((dir, env = process.env) => {
4327
+ if (env.VITEST === void 0)
4328
+ return;
4329
+ let home;
4330
+ try {
4331
+ home = userInfo().homedir;
4332
+ } catch {
4333
+ return;
4334
+ }
4335
+ if (dir.startsWith(join(home, ".local", "share") + sep))
4336
+ throw new Error(`a test opened a run in the real data folder: ${dir}`);
4337
+ }, "refuseRealStateInTests");
4338
+ var runtime = /* @__PURE__ */ __name(() => {
4339
+ const bun = process.versions.bun;
4340
+ return bun ? `bun ${bun}` : `node ${process.versions.node}`;
4341
+ }, "runtime");
4342
+ var newRunId = /* @__PURE__ */ __name((startedAt, command) => {
4343
+ const stamp = startedAt.toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
4344
+ const slug = command.replace(/[^a-z0-9]+/gi, "-").toLowerCase();
4345
+ return `${stamp}-${slug}-${randomUUID().slice(0, 6)}`;
4346
+ }, "newRunId");
4347
+ var INDEX = "index.jsonl";
4348
+ var appendIndex = /* @__PURE__ */ __name((dayDir, written) => {
4349
+ appendFileSync(join(dayDir, INDEX), `${JSON.stringify(written)}
4350
+ `, { mode: 384 });
4351
+ }, "appendIndex");
4352
+ var writeRunFile = /* @__PURE__ */ __name((dir, metadata) => {
4353
+ const written = runFileOf(metadata);
4354
+ writeSecurely(join(dir, "run.json"), `${JSON.stringify(written, null, 2)}
4355
+ `, 384);
4356
+ try {
4357
+ appendIndex(join(dir, ".."), written);
4358
+ } catch {
4359
+ }
4360
+ }, "writeRunFile");
4361
+ 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");
4362
+ var listRuns = /* @__PURE__ */ __name((runsDir, { since, atLeast = Number.POSITIVE_INFINITY, filter = {} } = {}) => {
4363
+ const first = since === void 0 ? void 0 : day(new Date(since));
4364
+ const runs = [];
4365
+ for (const date of days(runsDir).sort().reverse()) {
4366
+ if (first !== void 0 && date < first || runs.length >= atLeast)
4367
+ break;
4368
+ for (const metadata of runsOfDay(join(runsDir, date))) {
4369
+ if (matchesListFilter(metadata, filter))
4370
+ runs.push(metadata);
4371
+ }
4372
+ }
4373
+ return runs;
4374
+ }, "listRuns");
4375
+ var indexedRuns = /* @__PURE__ */ __name((dayDir) => {
4376
+ const latest = /* @__PURE__ */ new Map();
4377
+ let raw = "";
4378
+ try {
4379
+ raw = readFileSync2(join(dayDir, INDEX), "utf8");
4380
+ } catch {
4381
+ }
4382
+ for (const line2 of raw.split("\n")) {
4383
+ if (line2.trim() === "")
4384
+ continue;
4385
+ try {
4386
+ const metadata = metadataOf(JSON.parse(line2));
4387
+ if (typeof metadata.runId === "string")
4388
+ latest.set(metadata.runId, metadata);
4389
+ } catch {
4390
+ }
4391
+ }
4392
+ return latest;
4393
+ }, "indexedRuns");
4394
+ var runsOfDay = /* @__PURE__ */ __name((dayDir) => {
4395
+ const latest = indexedRuns(dayDir);
4396
+ for (const entry of safeReaddir(dayDir)) {
4397
+ if (entry === INDEX || entry.startsWith(".") || latest.has(entry))
4398
+ continue;
4399
+ const metadata = readRun(join(dayDir, entry));
4400
+ if (metadata)
4401
+ latest.set(metadata.runId, metadata);
4402
+ }
4403
+ return [...latest.values()].sort((a, b) => a.runId < b.runId ? 1 : a.runId > b.runId ? -1 : 0);
4404
+ }, "runsOfDay");
4405
+ var findRun = /* @__PURE__ */ __name((runsDir, id4) => {
4406
+ const stamped = /^(\d{4})(\d{2})(\d{2})T/.exec(id4);
4407
+ const likely = stamped ? [`${stamped[1]}-${stamped[2]}-${stamped[3]}`] : [];
4408
+ const dates = [.../* @__PURE__ */ new Set([...likely, ...days(runsDir)])];
4409
+ for (const date of dates) {
4410
+ const dir = join(runsDir, date, id4);
4411
+ const metadata = readRun(dir);
4412
+ if (metadata)
4413
+ return { dir, metadata };
4414
+ }
4415
+ for (const date of dates) {
4416
+ const metadata = indexedRuns(join(runsDir, date)).get(id4);
4417
+ if (metadata)
4418
+ return { dir: join(runsDir, date, id4), metadata };
4419
+ }
4420
+ return void 0;
4421
+ }, "findRun");
4422
+ var readEvents = /* @__PURE__ */ __name((dir) => {
4423
+ let raw;
4424
+ try {
4425
+ raw = readFileSync2(join(dir, "events.jsonl"), "utf8");
4426
+ } catch {
4427
+ return [];
4428
+ }
4429
+ const events = [];
4430
+ for (const line2 of raw.split("\n")) {
4431
+ if (line2.trim() === "")
4432
+ continue;
4433
+ try {
4434
+ const parsed = JSON.parse(line2);
4435
+ if (parsed !== null && typeof parsed === "object")
4436
+ events.push(eventOf(parsed));
4437
+ } catch {
4438
+ }
4439
+ }
4440
+ return events;
4441
+ }, "readEvents");
4442
+ var eventOf = /* @__PURE__ */ __name((line2) => {
4443
+ const { attributes, time: time2, severity: severity2 } = line2;
4444
+ if (attributes === null || typeof attributes !== "object")
4445
+ return logAttributes(line2);
4446
+ return { time: time2, severity: severity2, ...logAttributes(attributes) };
4447
+ }, "eventOf");
4448
+ var pruneRuns = /* @__PURE__ */ __name((runsDir, { keepDays, keepSuccessDays = keepDays, keepStoreDays = KEEP_STORE_RUNS_FOR_DAYS, maxBytes, now }) => {
4449
+ const cutoff = day(new Date(now.getTime() - keepDays * DAY_MS));
4450
+ const before = /* @__PURE__ */ __name((days2) => day(new Date(now.getTime() - Math.min(days2, keepDays) * DAY_MS)), "before");
4451
+ const successCutoff = before(keepSuccessDays);
4452
+ const storeCutoff = before(keepStoreDays);
4453
+ const keptFor = /* @__PURE__ */ __name((metadata) => metadata.keptBecauseStore ? keepStoreDays : metadata.operations?.includes(STORE_WRITE) ? Math.max(keepSuccessDays, keepStoreDays) : keepSuccessDays, "keptFor");
4454
+ let removed = 0;
4455
+ for (const date of days(runsDir)) {
4456
+ if (date >= cutoff) {
4457
+ if (date < storeCutoff)
4458
+ dropSuccesses(join(runsDir, date), STORE_RUNS_DROPPED, (metadata) => keptFor(metadata) <= keepStoreDays);
4459
+ if (date < successCutoff)
4460
+ dropSuccesses(join(runsDir, date), SUCCESSES_DROPPED, (metadata) => keptFor(metadata) <= keepSuccessDays);
4461
+ continue;
4462
+ }
4463
+ try {
4464
+ rmSync2(join(runsDir, date), { recursive: true, force: true });
4465
+ removed += 1;
4466
+ } catch {
4467
+ }
4468
+ }
4469
+ if (maxBytes !== void 0)
4470
+ removed += fitSize(runsDir, maxBytes, now);
4471
+ return removed;
4472
+ }, "pruneRuns");
4473
+ var DAY_MS = 24 * 60 * 60 * 1e3;
4474
+ var STORE_WRITE = "store.write";
4475
+ var SUCCESSES_DROPPED = ".successes-dropped";
4476
+ var STORE_RUNS_DROPPED = ".store-runs-dropped";
4477
+ var SIZE_CHECKED = ".size-checked";
4478
+ var dropSuccesses = /* @__PURE__ */ __name((dayDir, marker = SUCCESSES_DROPPED, drops = () => true) => {
4479
+ const done = join(dayDir, marker);
4480
+ try {
4481
+ statSync2(done);
4482
+ return;
4483
+ } catch {
4484
+ }
4485
+ const dropped2 = /* @__PURE__ */ __name((metadata) => metadata?.status === "success" && drops(metadata), "dropped");
4486
+ try {
4487
+ const kept = [];
4488
+ for (const [id4, metadata] of indexedRuns(dayDir)) {
4489
+ if (dropped2(metadata))
4490
+ rmSync2(join(dayDir, id4), { recursive: true, force: true });
4491
+ else
4492
+ kept.push(JSON.stringify(runFileOf(metadata)));
4493
+ }
4494
+ for (const entry of safeReaddir(dayDir)) {
4495
+ if (entry === INDEX || entry.startsWith("."))
4496
+ continue;
4497
+ if (dropped2(readRun(join(dayDir, entry))))
4498
+ rmSync2(join(dayDir, entry), { recursive: true, force: true });
4499
+ }
4500
+ writeSecurely(join(dayDir, INDEX), kept.map((line2) => `${line2}
4501
+ `).join(""), 384);
4502
+ writeFileSync2(done, "", { mode: 384 });
4503
+ } catch {
4504
+ }
4505
+ }, "dropSuccesses");
4506
+ var sizeOf = /* @__PURE__ */ __name((path) => {
4507
+ let total = 0;
4508
+ for (const entry of safeReaddir(path)) {
4509
+ const full = join(path, entry);
4510
+ try {
4511
+ const stat = statSync2(full);
4512
+ total += stat.isDirectory() ? sizeOf(full) : stat.size;
4513
+ } catch {
4514
+ }
4515
+ }
4516
+ return total;
4517
+ }, "sizeOf");
4518
+ var fitSize = /* @__PURE__ */ __name((runsDir, maxBytes, now) => {
4519
+ const stamp = join(runsDir, SIZE_CHECKED);
4520
+ const today = day(now);
4521
+ try {
4522
+ if (readFileSync2(stamp, "utf8").trim() === today)
4523
+ return 0;
4524
+ } catch {
4525
+ }
4526
+ const dates = days(runsDir).sort();
4527
+ const sizes = new Map(dates.map((date) => [date, sizeOf(join(runsDir, date))]));
4528
+ let total = [...sizes.values()].reduce((sum, size) => sum + size, 0);
4529
+ let removed = 0;
4530
+ for (const date of dates) {
4531
+ if (total <= maxBytes || date === today)
4532
+ break;
4533
+ dropSuccesses(join(runsDir, date));
4534
+ const after = sizeOf(join(runsDir, date));
4535
+ total -= (sizes.get(date) ?? 0) - after;
4536
+ sizes.set(date, after);
4537
+ }
4538
+ for (const date of dates) {
4539
+ if (total <= maxBytes || date === today)
4540
+ break;
4541
+ try {
4542
+ rmSync2(join(runsDir, date), { recursive: true, force: true });
4543
+ total -= sizes.get(date) ?? 0;
4544
+ removed += 1;
4545
+ } catch {
4546
+ }
4547
+ }
4548
+ try {
4549
+ mkdirSync(runsDir, { recursive: true, mode: 448 });
4550
+ writeFileSync2(stamp, today, { mode: 384 });
4551
+ } catch {
4552
+ }
4553
+ return removed;
4554
+ }, "fitSize");
4555
+ var day = /* @__PURE__ */ __name((date) => date.toISOString().slice(0, 10), "day");
4556
+ var days = /* @__PURE__ */ __name((runsDir) => safeReaddir(runsDir).filter((entry) => /^\d{4}-\d{2}-\d{2}$/.test(entry)), "days");
4557
+ var readRun = /* @__PURE__ */ __name((dir) => {
4558
+ try {
4559
+ return metadataOf(JSON.parse(readFileSync2(join(dir, "run.json"), "utf8")));
4560
+ } catch {
4561
+ return void 0;
4562
+ }
4563
+ }, "readRun");
4564
+ var safeReaddir = /* @__PURE__ */ __name((dir) => {
4565
+ try {
4566
+ return readdirSync(dir);
4567
+ } catch {
4568
+ return [];
4569
+ }
4570
+ }, "safeReaddir");
4571
+ var runFileOf = /* @__PURE__ */ __name(({ partial, ...metadata }) => ({
4572
+ ...logAttributes(metadata),
4573
+ ...partial ? { partial: { ...logAttributes(partial), failures: partial.failures.map((failure) => logAttributes(failure)) } } : {}
4574
+ }), "runFileOf");
4575
+ var metadataOf = /* @__PURE__ */ __name((parsed) => {
4576
+ const { partial, ...metadata } = fromLogAttributes(parsed);
4577
+ if (partial === null || typeof partial !== "object")
4578
+ return metadata;
4579
+ const { failures, ...rest } = fromLogAttributes(partial);
4580
+ return {
4581
+ ...metadata,
4582
+ partial: {
4583
+ ...rest,
4584
+ failures: Array.isArray(failures) ? failures.map((failure) => fromLogAttributes(failure)) : []
4585
+ }
4586
+ };
4587
+ }, "metadataOf");
4588
+
4589
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/runs/scope.js
4590
+ import { AsyncLocalStorage } from "node:async_hooks";
4591
+ import { randomBytes } from "node:crypto";
4592
+ var scopes = new AsyncLocalStorage();
4593
+ var processScope;
4594
+ var currentRun = /* @__PURE__ */ __name(() => {
4595
+ const scope2 = scopes.getStore();
4596
+ if (scope2)
4597
+ return scope2;
4598
+ processScope ??= {
4599
+ runId: newRunId(/* @__PURE__ */ new Date(), "process"),
4600
+ command: "",
4601
+ startedAt: Date.now(),
4602
+ ...traceOf(process.env)
4603
+ };
4604
+ return processScope;
4605
+ }, "currentRun");
4606
+ var inRun = /* @__PURE__ */ __name((scope2, body) => scopes.run(scope2, body), "inRun");
4607
+ var runEvent = /* @__PURE__ */ __name((event2) => scopes.getStore()?.events?.(event2), "runEvent");
4608
+ var typedCommand = /* @__PURE__ */ __name((tool, words2, profile = currentRun().profile) => [tool, profile, words2].filter((part) => part !== void 0 && part !== "").join(" "), "typedCommand");
4609
+ var useAsProcessRun = /* @__PURE__ */ __name((scope2) => {
4610
+ processScope = scope2;
4611
+ }, "useAsProcessRun");
4612
+ var processRun = /* @__PURE__ */ __name(() => processScope, "processRun");
4613
+ var enclosingTraceId = /* @__PURE__ */ __name(() => scopes.getStore()?.traceId, "enclosingTraceId");
4614
+ var traceOf = /* @__PURE__ */ __name((env) => {
4615
+ const traceId = traceIdOf(env.TRACEPARENT);
4616
+ return traceId === void 0 ? {} : { traceId };
4617
+ }, "traceOf");
4618
+ var childTrace = /* @__PURE__ */ __name(() => {
4619
+ const hex = /* @__PURE__ */ __name((bytes) => randomBytes(bytes).toString("hex"), "hex");
4620
+ const traceId = hex(16);
4621
+ return { traceId, traceparent: `00-${traceId}-${hex(8)}-01` };
4622
+ }, "childTrace");
4623
+ var attempts = new AsyncLocalStorage();
4624
+ var withAttempt = /* @__PURE__ */ __name((attempt, work) => attempts.run(attempt, work), "withAttempt");
4625
+ var currentAttempt = /* @__PURE__ */ __name(() => attempts.getStore(), "currentAttempt");
4626
+
4627
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/relations.js
3536
4628
  var ORGANIZATION_ROLES = [
3537
4629
  "employee",
3538
4630
  "contractor",
@@ -3543,10 +4635,11 @@ var ORGANIZATION_ROLES = [
3543
4635
  "contact"
3544
4636
  ];
3545
4637
  var PROJECT_ROLES = ["owner", "manager", "contributor", "client-contact", "approver"];
4638
+ var CONTRACT_ROLES = ["customer", "supplier", "signatory", "guarantor"];
3546
4639
  var ENGAGEMENT_LEVELS = ["none", "low", "medium", "high"];
3547
4640
  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")
4641
+ var checkEngagement = /* @__PURE__ */ __name((kind2, from, to, level) => {
4642
+ if (kind2 !== "member-of" || from !== "person" || to !== "project")
3550
4643
  throw new CliError("validation_error", "an engagement level is set only on a person's member-of a project", {
3551
4644
  reason: "relationship.engagement-ends"
3552
4645
  });
@@ -3566,46 +4659,54 @@ var RELATIONS = {
3566
4659
  "customer-of": { from: ["person", "organization"], to: ["organization"], inverse: "supplier of" },
3567
4660
  "partner-of": { from: ["organization"], to: ["organization"], symmetric: true },
3568
4661
  "related-to": {
3569
- from: ["person", "organization", "project", "task", "deal", "lead"],
4662
+ from: ["person", "organization", "project", "task", "deal", "lead", "contract"],
3570
4663
  to: ["person", "organization", "project", "task"],
3571
- roles: { from: { deal: DEAL_ROLES, lead: DEAL_ROLES } }
4664
+ roles: { from: { deal: DEAL_ROLES, lead: DEAL_ROLES, contract: CONTRACT_ROLES } }
3572
4665
  }
3573
4666
  };
3574
4667
  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");
4668
+ var specOf = /* @__PURE__ */ __name((kind2) => Object.hasOwn(RELATIONS, kind2) ? RELATIONS[kind2] : void 0, "specOf");
4669
+ var isRelationKind = /* @__PURE__ */ __name((kind2) => specOf(kind2) !== void 0, "isRelationKind");
3577
4670
  var memberOnly = /* @__PURE__ */ __name((type) => type === "chat" || type === "email_thread", "memberOnly");
3578
- var checkEnds = /* @__PURE__ */ __name((kind, from, to) => {
3579
- const spec = specOf(kind);
4671
+ var partyOnly = /* @__PURE__ */ __name((from, to) => from === "contract" && to !== "person" && to !== "organization", "partyOnly");
4672
+ var checkEnds = /* @__PURE__ */ __name((kind2, from, to) => {
4673
+ const spec = specOf(kind2);
3580
4674
  if (!spec)
3581
4675
  throw new CliError("validation_error", `a relationship's kind is one of ${RELATION_KINDS.join(", ")}`);
3582
- if (memberOnly(from) && (kind !== "member-of" || to !== "project"))
4676
+ if (memberOnly(from) && (kind2 !== "member-of" || to !== "project"))
3583
4677
  throw new CliError("validation_error", `a ${from === "chat" ? "chat" : "mail thread"} is related only as member-of a project`);
4678
+ if (partyOnly(from, to))
4679
+ throw new CliError("validation_error", "a contract is related only to a person or an organization");
3584
4680
  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}`);
4681
+ throw new CliError("validation_error", `${kind2} joins ${spec.from.join(", ")} to ${spec.to.join(", ")}, not ${from} to ${to}`);
3586
4682
  return spec;
3587
4683
  }, "checkEnds");
3588
- var rolesOf = /* @__PURE__ */ __name((kind, from, to) => {
3589
- const spec = specOf(kind);
3590
- if (kind === "member-of" && from !== "person")
4684
+ var rolesOf = /* @__PURE__ */ __name((kind2, from, to) => {
4685
+ const spec = specOf(kind2);
4686
+ if (kind2 === "member-of" && from !== "person")
3591
4687
  return void 0;
3592
4688
  return spec?.roles?.from?.[from] ?? spec?.roles?.to?.[to];
3593
4689
  }, "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);
4690
+ var ROLE_LISTS = {
4691
+ organization: ORGANIZATION_ROLES,
4692
+ project: PROJECT_ROLES,
4693
+ deal: DEAL_ROLES,
4694
+ contract: CONTRACT_ROLES
4695
+ };
4696
+ var roleListOf = /* @__PURE__ */ __name((kind2, from, to) => {
4697
+ const roles = rolesOf(kind2, from, to);
3597
4698
  return Object.keys(ROLE_LISTS).find((list) => ROLE_LISTS[list] === roles);
3598
4699
  }, "roleListOf");
3599
- var checkRole = /* @__PURE__ */ __name((kind, from, to, role, extra = []) => {
3600
- const roles = rolesOf(kind, from, to)?.concat(extra);
4700
+ var checkRole = /* @__PURE__ */ __name((kind2, from, to, role, extra = []) => {
4701
+ const roles = rolesOf(kind2, from, to)?.concat(extra);
3601
4702
  if (roles && !roles.includes(role))
3602
- throw new CliError("validation_error", `a ${from}'s role on ${kind} ${to} is one of ${roles.join(", ")}`, {
4703
+ throw new CliError("validation_error", `a ${from}'s role on ${kind2} ${to} is one of ${roles.join(", ")}`, {
3603
4704
  reason: "relationship.role-unknown"
3604
4705
  });
3605
4706
  return role;
3606
4707
  }, "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");
4708
+ var isSymmetric = /* @__PURE__ */ __name((kind2) => specOf(kind2)?.symmetric === true, "isSymmetric");
4709
+ var inverseOf = /* @__PURE__ */ __name((kind2) => specOf(kind2)?.symmetric ? kind2 : specOf(kind2)?.inverse ?? null, "inverseOf");
3609
4710
  var STANDINGS = ["confirmed", "reported", "proposed", "ended"];
3610
4711
  var standingOf = /* @__PURE__ */ __name((link, now) => {
3611
4712
  if (link.endsAt != null && link.endsAt <= now)
@@ -3620,7 +4721,7 @@ var isUsable = /* @__PURE__ */ __name((standing) => standing === "confirmed" ||
3620
4721
  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
4722
  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
4723
 
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
4724
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/tags.js
3624
4725
  var TAG_TYPES = ["chat", "contact", "message", "task"];
3625
4726
  var TAG = /^[a-z0-9-]{1,32}$/;
3626
4727
  var tagOf = /* @__PURE__ */ __name((value) => {
@@ -3634,31 +4735,7 @@ var normalizeTag = /* @__PURE__ */ __name((value) => {
3634
4735
  return tag;
3635
4736
  }, "normalizeTag");
3636
4737
 
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
4738
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/tasks/model.js
3662
4739
  var TASK_KINDS = ["question", "request", "mention", "promise"];
3663
4740
  var TASK_STATES = ["open", "todo", "in_progress", "done", "dismissed"];
3664
4741
  var CLOSED_STATES = ["done", "dismissed"];
@@ -3673,13 +4750,13 @@ function closeTask(task, state, by, at, reason) {
3673
4750
  }
3674
4751
  __name(closeTask, "closeTask");
3675
4752
 
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
4753
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/tasks/store.js
3677
4754
  function matches2(task, filter) {
3678
4755
  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
4756
  }
3680
4757
  __name(matches2, "matches");
3681
4758
 
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
4759
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/tasks/priority.js
3683
4760
  var PRIORITY_LABELS = ["low", "medium", "high", "critical"];
3684
4761
  var MIDDLE = { low: 0.125, medium: 0.375, high: 0.625, critical: 0.875 };
3685
4762
  var LEGACY_PRIORITY_SCORES = [0.875, 0.625, 0.375, 0.1875, 0.0625];
@@ -3708,7 +4785,7 @@ var priorityOf = /* @__PURE__ */ __name((value) => {
3708
4785
  }, "priorityOf");
3709
4786
  var priorityOption = /* @__PURE__ */ __name((value) => priorityOf(value) ?? "none", "priorityOption");
3710
4787
 
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
4788
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/tasks/service.js
3712
4789
  function createTaskService({ store, now = /* @__PURE__ */ __name(() => /* @__PURE__ */ new Date(), "now"), newId = /* @__PURE__ */ __name(() => crypto.randomUUID(), "newId") }) {
3713
4790
  async function find(id4) {
3714
4791
  const task = await store.get(id4);
@@ -3768,7 +4845,7 @@ function median(values) {
3768
4845
  }
3769
4846
  __name(median, "median");
3770
4847
 
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
4848
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/knowledge.js
3772
4849
  var FACT_STATUSES = ["proposed", "accepted", "superseded", "reversed", "rejected"];
3773
4850
  var MEMORY_KINDS = ["summary", "digest", "preference"];
3774
4851
  var MEMORY_STATUSES = ["proposed", "confirmed", "stale", "superseded"];
@@ -3776,7 +4853,41 @@ var MEMORY_SCOPES = ["personal", "work"];
3776
4853
  var WORK_TASK_TYPES = ["bug", "feature", "chore"];
3777
4854
  var TASK_TYPES2 = [...WORK_TASK_TYPES, ...TASK_KINDS];
3778
4855
 
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
4856
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/store/sqlite/link-source.js
4857
+ var REPORTER_SQL = "(SELECT provider || ':' || external_id FROM accounts r WHERE r.id = links.account_id) AS reporter";
4858
+ var sourceOf3 = /* @__PURE__ */ __name((database, row, metadata) => {
4859
+ 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;
4860
+ return {
4861
+ ...typeof reporter === "string" ? { account: reporter } : {},
4862
+ ...typeof metadata.derived === "string" ? { derived: metadata.derived } : {}
4863
+ };
4864
+ }, "sourceOf");
4865
+
4866
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/store/sqlite/link-kinds.js
4867
+ var LINK_KINDS = [
4868
+ "links-to",
4869
+ "blocked-by",
4870
+ "follow-up-of",
4871
+ "about",
4872
+ "member-of",
4873
+ "labelled",
4874
+ "answered-by",
4875
+ "evidence",
4876
+ "created-from",
4877
+ "duplicate-of",
4878
+ "related-to",
4879
+ "reports-to",
4880
+ "customer-of",
4881
+ "partner-of",
4882
+ "assigned-to",
4883
+ "attached"
4884
+ ];
4885
+ var LINK_ORIGINS = ["file", "owner", "suggested", "message"];
4886
+ var LINK_SOURCES = [...LINK_ORIGINS, "calendar"];
4887
+ var linkKind = /* @__PURE__ */ __name((kind2) => `'${kind2}'`, "linkKind");
4888
+ var COUNTERPART_ROLE = "counterpart";
4889
+
4890
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/entities/fields.js
3780
4891
  var text5 = string();
3781
4892
  var id3 = pipe(string(), minLength(1));
3782
4893
  var time = isoTime;
@@ -3801,7 +4912,7 @@ var author = strictObject({
3801
4912
  name: nullable(text5)
3802
4913
  });
3803
4914
 
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
4915
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/entities/knowledge-lists.js
3805
4916
  var organization = strictObject({
3806
4917
  id: id3,
3807
4918
  ref: reference,
@@ -3831,6 +4942,9 @@ var reminder = strictObject({
3831
4942
  receipt: nullable(text5)
3832
4943
  });
3833
4944
 
4945
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/categories.js
4946
+ var CATEGORIES = ["client", "supplier", "partner", "employer"];
4947
+
3834
4948
  export {
3835
4949
  QUERY_LIMITS,
3836
4950
  queryAstSchema,
@@ -3933,6 +5047,54 @@ export {
3933
5047
  validateMeetingSeriesInventoryCursor,
3934
5048
  aggregateMeetingCounts,
3935
5049
  aggregateMeetingStats,
5050
+ formatLocator,
5051
+ isLocator,
5052
+ parseLocator,
5053
+ SIMPLE_REFERENCES,
5054
+ formatReference,
5055
+ parseReference,
5056
+ canonicalReference,
5057
+ looksLikeReference,
5058
+ providerLabel,
5059
+ isFolderProvider,
5060
+ folderProviderSql,
5061
+ folderProviderOf,
5062
+ DOCUMENT_ACCOUNT_PROVIDERS,
5063
+ isDocumentAccountProvider,
5064
+ ADDED_PROVIDER,
5065
+ ADDED_ACCOUNT,
5066
+ notAdded,
5067
+ filesAccountSql,
5068
+ INTERNAL_NOTES,
5069
+ UNKNOWN_PROVIDER,
5070
+ providerEntryOf,
5071
+ kindsOfEntry,
5072
+ unitedKinds,
5073
+ useStoredProviders,
5074
+ addProvider,
5075
+ isKind,
5076
+ providerNamed,
5077
+ kindIn,
5078
+ importedOf,
5079
+ isImportedProvider,
5080
+ holdsKind,
5081
+ holdsKindOf,
5082
+ isBotProvider,
5083
+ inSource,
5084
+ sourceOf,
5085
+ ACCOUNT_GROUPS,
5086
+ ACCOUNT_GROUPS_SETTING,
5087
+ isAccountList,
5088
+ isGroupName,
5089
+ groupName,
5090
+ groupMembers,
5091
+ listedHolds,
5092
+ keyOf,
5093
+ sourceOf2,
5094
+ sameAs,
5095
+ entriesOfList,
5096
+ accountsOfList,
5097
+ fitting,
3936
5098
  parseDecimal,
3937
5099
  formatDecimal,
3938
5100
  currencyOf,
@@ -3980,6 +5142,38 @@ export {
3980
5142
  ERASED_TEXT,
3981
5143
  severity,
3982
5144
  graver,
5145
+ markStoreDamaged,
5146
+ readDamageMark,
5147
+ refuseDamagedStore,
5148
+ markJournalLost,
5149
+ readJournalMark,
5150
+ readHealthMark,
5151
+ recordDeepCheck,
5152
+ logAttributes,
5153
+ fromLogAttributes,
5154
+ snakeLogger,
5155
+ LOG_ATTRIBUTES,
5156
+ KEEP_SUCCESSFUL_RUNS_FOR_DAYS,
5157
+ KEEP_STORE_RUNS_FOR_DAYS,
5158
+ RUNS_SIZE_LIMIT_MB,
5159
+ runsDirFor,
5160
+ startRun,
5161
+ runtime,
5162
+ newRunId,
5163
+ listRuns,
5164
+ findRun,
5165
+ readEvents,
5166
+ currentRun,
5167
+ inRun,
5168
+ runEvent,
5169
+ typedCommand,
5170
+ useAsProcessRun,
5171
+ processRun,
5172
+ enclosingTraceId,
5173
+ traceOf,
5174
+ childTrace,
5175
+ withAttempt,
5176
+ currentAttempt,
3983
5177
  isEngagement,
3984
5178
  checkEngagement,
3985
5179
  RELATION_KINDS,
@@ -3999,11 +5193,6 @@ export {
3999
5193
  TAG_TYPES,
4000
5194
  tagOf,
4001
5195
  normalizeTag,
4002
- LINK_KINDS,
4003
- LINK_ORIGINS,
4004
- LINK_SOURCES,
4005
- linkKind,
4006
- COUNTERPART_ROLE,
4007
5196
  TASK_KINDS,
4008
5197
  TASK_STATES,
4009
5198
  TASK_ORIGINS,
@@ -4023,6 +5212,13 @@ export {
4023
5212
  MEMORY_SCOPES,
4024
5213
  WORK_TASK_TYPES,
4025
5214
  TASK_TYPES2 as TASK_TYPES,
5215
+ REPORTER_SQL,
5216
+ sourceOf3,
5217
+ LINK_KINDS,
5218
+ LINK_ORIGINS,
5219
+ LINK_SOURCES,
5220
+ linkKind,
5221
+ COUNTERPART_ROLE,
4026
5222
  text5 as text,
4027
5223
  id3 as id,
4028
5224
  time,
@@ -4036,9 +5232,5 @@ export {
4036
5232
  organization,
4037
5233
  project,
4038
5234
  reminder,
4039
- markStoreDamaged,
4040
- readDamageMark,
4041
- refuseDamagedStore,
4042
- readHealthMark,
4043
- recordDeepCheck
5235
+ CATEGORIES
4044
5236
  };