@wirecat/cli-memo 0.131.29 → 0.131.31

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 (140) hide show
  1. package/dist/bin/memo.js +2 -2
  2. package/dist/bundle/{all-profiles-HXT2KPB6.js → all-profiles-PFCNICOF.js} +5 -5
  3. package/dist/bundle/{anthropic-C6H35WZP.js → anthropic-QLGMYWVZ.js} +3 -3
  4. package/dist/bundle/{app-server-Y6JGICRB.js → app-server-QD67I7V2.js} +35 -35
  5. package/dist/bundle/auto-MCSKUSPU.js +86 -0
  6. package/dist/bundle/{bun-K5H33WQK.js → bun-JRTUGKIJ.js} +2 -2
  7. package/dist/bundle/{bun-sqlite-2NGQT7HH.js → bun-sqlite-HCZP2CNO.js} +2 -2
  8. package/dist/bundle/{chunk-P5FETWRW.js → chunk-2N74ZVI6.js} +1 -1
  9. package/dist/bundle/{chunk-NIEWG4OY.js → chunk-2XBDA3XF.js} +1 -1
  10. package/dist/bundle/{chunk-6BS3FHTC.js → chunk-3G44GDIZ.js} +5 -5
  11. package/dist/bundle/{chunk-W7T2JSKY.js → chunk-3OH5DJ6X.js} +1 -1
  12. package/dist/bundle/{chunk-SZUYOU6U.js → chunk-42I4XE3O.js} +20 -20
  13. package/dist/bundle/{chunk-IIM3FF5L.js → chunk-4D6BG353.js} +6 -6
  14. package/dist/bundle/{chunk-XHHSQ4FN.js → chunk-54DA525P.js} +14 -9
  15. package/dist/bundle/{chunk-7OYQFT5N.js → chunk-5BVGJBZX.js} +1 -1
  16. package/dist/bundle/{chunk-WFQPCCM2.js → chunk-5JTW3LNF.js} +1 -1
  17. package/dist/bundle/{chunk-KCQPEY6C.js → chunk-5YVU6PXP.js} +4 -4
  18. package/dist/bundle/{chunk-6IJ7XNK5.js → chunk-63JF4E76.js} +487 -257
  19. package/dist/bundle/{chunk-S67KFN67.js → chunk-7AMJFTJM.js} +1 -1
  20. package/dist/bundle/{chunk-2WGR73KL.js → chunk-7JWW4YEK.js} +8 -8
  21. package/dist/bundle/{chunk-KCAELZXB.js → chunk-7MKROF5R.js} +1 -1
  22. package/dist/bundle/{chunk-ZW44VJNY.js → chunk-A56GDMFH.js} +3 -3
  23. package/dist/bundle/{chunk-MJF6VGW4.js → chunk-ARVXP2UJ.js} +421 -360
  24. package/dist/bundle/{chunk-KIJ7UJHD.js → chunk-AZGQ7ABE.js} +215 -151
  25. package/dist/bundle/{chunk-SQ6OFUHW.js → chunk-CGI5EIIA.js} +20 -20
  26. package/dist/bundle/{chunk-RGPCN63U.js → chunk-CWHGN6HC.js} +4 -4
  27. package/dist/bundle/{chunk-QVFB2MVU.js → chunk-FE2SLKUO.js} +2 -2
  28. package/dist/bundle/{chunk-FUMGREBO.js → chunk-FGJKBQCP.js} +3 -3
  29. package/dist/bundle/{chunk-H3NMOWPB.js → chunk-GKZ65EOY.js} +198 -52
  30. package/dist/bundle/{chunk-M3VBB37S.js → chunk-GNY5YLNY.js} +2 -2
  31. package/dist/bundle/{chunk-46ACMQUU.js → chunk-H24AL555.js} +27 -27
  32. package/dist/bundle/{program-6E2SWPCU.js → chunk-HGXTDMKN.js} +1499 -9957
  33. package/dist/bundle/{chunk-7PH33JE4.js → chunk-HLJ6IUVF.js} +2 -2
  34. package/dist/bundle/{chunk-ERZLVE54.js → chunk-JTSYAO5V.js} +1038 -670
  35. package/dist/bundle/{chunk-HVD2CTPH.js → chunk-K3CJHSLS.js} +1 -1
  36. package/dist/bundle/{chunk-IQEEOXBV.js → chunk-K3TUIQZ4.js} +51 -50
  37. package/dist/bundle/{chunk-ERRC42BB.js → chunk-K6ZWFP2X.js} +1 -1
  38. package/dist/bundle/{chunk-PUQYCAEP.js → chunk-L34KLQIU.js} +9 -9
  39. package/dist/bundle/{chunk-GVYOICNB.js → chunk-MVFINUJS.js} +5 -5
  40. package/dist/bundle/{chunk-XNV2JTJ4.js → chunk-NDJUEFV2.js} +1 -1
  41. package/dist/bundle/{chunk-H6JNEHUC.js → chunk-NG26I3JV.js} +1 -1
  42. package/dist/bundle/{chunk-YLVSSQJP.js → chunk-OS55OQ74.js} +5 -5
  43. package/dist/bundle/{chunk-UZUNSDGN.js → chunk-PG4KORTB.js} +1 -1
  44. package/dist/bundle/{chunk-65YDJ3Z4.js → chunk-Q2ZIIXA2.js} +2 -2
  45. package/dist/bundle/{chunk-G62DN6QY.js → chunk-Q3ZB4JGL.js} +2 -2
  46. package/dist/bundle/{chunk-DXCBZT4T.js → chunk-QUQOKNAX.js} +12 -12
  47. package/dist/bundle/{chunk-MPNDEGMC.js → chunk-QWA3MTHH.js} +7 -7
  48. package/dist/bundle/{chunk-KJEJOWJY.js → chunk-REUXOW2O.js} +2 -2
  49. package/dist/bundle/{chunk-2O2RWKUT.js → chunk-RO4YPDGF.js} +1 -1
  50. package/dist/bundle/{chunk-Q63L5WS2.js → chunk-ROT4V3ZT.js} +3 -3
  51. package/dist/bundle/{chunk-R7XIZMM5.js → chunk-RRDXT63A.js} +1 -1
  52. package/dist/bundle/{chunk-6NGLATFQ.js → chunk-S3FQQRUM.js} +4 -4
  53. package/dist/bundle/{chunk-5ZWRS2JY.js → chunk-TFEXCHMC.js} +5 -5
  54. package/dist/bundle/{chunk-7ACGYEGV.js → chunk-URPBRYVA.js} +4 -4
  55. package/dist/bundle/{chunk-HBKYPSX3.js → chunk-USMKR34T.js} +11 -11
  56. package/dist/bundle/{chunk-BWQMZNDC.js → chunk-UXA37BVT.js} +4 -4
  57. package/dist/bundle/{chunk-FJXFU7NN.js → chunk-W4GV42D5.js} +2 -2
  58. package/dist/bundle/{chunk-5FEJKSQJ.js → chunk-WGX6AEUP.js} +3 -3
  59. package/dist/bundle/{chunk-XUHVJGIL.js → chunk-WP3J2FNH.js} +10 -10
  60. package/dist/bundle/{chunk-WI7KTIMF.js → chunk-X6HXGL5E.js} +7 -7
  61. package/dist/bundle/{chunk-6YDPWVDH.js → chunk-XUMYVRBZ.js} +1 -1
  62. package/dist/bundle/{chunk-FBSY3DVN.js → chunk-XWIRWBB5.js} +1 -1
  63. package/dist/bundle/{chunk-YZKHWANJ.js → chunk-ZB5ZZWFR.js} +4 -4
  64. package/dist/bundle/{chunk-HAC3CWPB.js → chunk-ZHDOELM7.js} +7 -7
  65. package/dist/bundle/{command-contract-AFUDV7JM.js → command-contract-DFXPO5Q7.js} +11 -11
  66. package/dist/bundle/{decode-P5SEK56D.js → decode-7NGILAKQ.js} +2 -2
  67. package/dist/bundle/{echarts-CLHJYMDK.js → echarts-JERQI2HW.js} +2 -2
  68. package/dist/bundle/{embed-X6H74LGP.js → embed-3AO7KZXC.js} +3 -3
  69. package/dist/bundle/{embedder-H5SWOSEL.js → embedder-WRQ7TDDB.js} +6 -6
  70. package/dist/bundle/{entry-66SEZMKI.js → entry-IBRPU7NO.js} +4 -4
  71. package/dist/bundle/failure-QBQMSEYX.js +66 -0
  72. package/dist/bundle/{first-run-S7EW77F6.js → first-run-IJOREEQM.js} +5 -5
  73. package/dist/bundle/{first-screen-6GA36WQT.js → first-screen-KYNY6ELY.js} +12 -12
  74. package/dist/bundle/{instructions-IUUSY6DO.js → instructions-BET2PLGV.js} +1 -1
  75. package/dist/bundle/{mcp-7SDVTKCE.js → mcp-NUBFFPGF.js} +35 -35
  76. package/dist/bundle/memo.js +6 -6
  77. package/dist/bundle/{node-6T5LUBAE.js → node-NCSG7QX5.js} +2 -2
  78. package/dist/bundle/{node-sqlite-ZTDWPRJU.js → node-sqlite-QL4M5RIK.js} +3 -3
  79. package/dist/bundle/{oauth-G4TCULLQ.js → oauth-BGMMED35.js} +4 -4
  80. package/dist/bundle/{open-DRJ24C7U.js → open-YN3KJMMQ.js} +2 -2
  81. package/dist/bundle/{openai-3DSR7Z4Z.js → openai-CTZUSKUS.js} +7 -7
  82. package/dist/bundle/{process-IPM3OJDN.js → process-DW237TK4.js} +1 -1
  83. package/dist/bundle/program-Q7VXEIJ7.js +9171 -0
  84. package/dist/bundle/{prompt-XKR6EQAT.js → prompt-EZCCUYCS.js} +2 -2
  85. package/dist/bundle/{recognize-GZXAXTEH.js → recognize-XP3LHQD6.js} +1 -1
  86. package/dist/bundle/{remote-Y5ML6KR4.js → remote-RLR5ZKKT.js} +4 -4
  87. package/dist/bundle/{rerank-FNNXUTMN.js → rerank-P7LE52AC.js} +4 -4
  88. package/dist/bundle/{serve-BGU5ERNX.js → serve-UA7RQDNK.js} +6 -6
  89. package/dist/bundle/server-N6L3LGQO.js +48 -0
  90. package/dist/bundle/{server-3L4FHYFM.js → server-NWCYWOPZ.js} +50 -50
  91. package/dist/bundle/server-XU362INX.js +61 -0
  92. package/dist/bundle/{state-WAMVO34N.js → state-72Y55LBR.js} +3 -3
  93. package/dist/bundle/{store-PVY4UTTR.js → store-PED4JCBB.js} +9 -9
  94. package/dist/bundle/store-maintenance-command-B364Q2O4.js +48 -0
  95. package/dist/bundle/update-X2A5CW5A.js +69 -0
  96. package/dist/config.d.ts +11 -0
  97. package/dist/config.d.ts.map +1 -1
  98. package/dist/config.js +19 -0
  99. package/dist/config.js.map +1 -1
  100. package/dist/discovery/command.d.ts.map +1 -1
  101. package/dist/discovery/command.js +1 -0
  102. package/dist/discovery/command.js.map +1 -1
  103. package/dist/examples.d.ts.map +1 -1
  104. package/dist/examples.js +6 -0
  105. package/dist/examples.js.map +1 -1
  106. package/dist/finance/orders-command.d.ts +12 -0
  107. package/dist/finance/orders-command.d.ts.map +1 -0
  108. package/dist/finance/orders-command.js +92 -0
  109. package/dist/finance/orders-command.js.map +1 -0
  110. package/dist/mail/findings-command.d.ts.map +1 -1
  111. package/dist/mail/findings-command.js +7 -2
  112. package/dist/mail/findings-command.js.map +1 -1
  113. package/dist/mail/review-command.d.ts.map +1 -1
  114. package/dist/mail/review-command.js +2 -0
  115. package/dist/mail/review-command.js.map +1 -1
  116. package/dist/program.d.ts.map +1 -1
  117. package/dist/program.js +30 -0
  118. package/dist/program.js.map +1 -1
  119. package/dist/review/kinds.d.ts +1 -1
  120. package/dist/review/kinds.d.ts.map +1 -1
  121. package/dist/review/kinds.js +1 -0
  122. package/dist/review/kinds.js.map +1 -1
  123. package/dist/review/review.d.ts.map +1 -1
  124. package/dist/review/review.js +1 -0
  125. package/dist/review/review.js.map +1 -1
  126. package/dist/schedule/command.d.ts.map +1 -1
  127. package/dist/schedule/command.js +4 -3
  128. package/dist/schedule/command.js.map +1 -1
  129. package/dist/version.d.ts +1 -1
  130. package/dist/version.js +1 -1
  131. package/package.json +2 -2
  132. package/skills/mail-triage/SKILL.md +40 -6
  133. package/dist/bundle/auto-A2Y225YZ.js +0 -86
  134. package/dist/bundle/chunk-KFSZAV5L.js +0 -452
  135. package/dist/bundle/failure-PNTFMNKK.js +0 -66
  136. package/dist/bundle/server-5F3GJPG3.js +0 -48
  137. package/dist/bundle/server-JX5TWAAW.js +0 -61
  138. package/dist/bundle/store-maintenance-command-RGZJWNE2.js +0 -48
  139. package/dist/bundle/update-VJLZT6ER.js +0 -69
  140. /package/dist/bundle/{chunk-XGTIABPY.js → chunk-QPPNLE7G.js} +0 -0
@@ -4,13 +4,19 @@ import {
4
4
  CHAT_MESSAGES_READ,
5
5
  FACT_STATUSES,
6
6
  FACT_TYPES,
7
+ FINANCE_REVIEWS,
8
+ INVOICE_DIRECTIONS,
9
+ INVOICE_STATUSES,
7
10
  LINK_KINDS,
8
11
  LINK_ORIGINS,
9
12
  MEETING_FINDINGS_KIND,
10
13
  MEMORY_KINDS,
11
14
  MEMORY_SCOPES,
15
+ MONEY_DIRECTIONS,
12
16
  MeetingError,
13
17
  OPERATORS_BY_TYPE,
18
+ ORDER_PURPOSES,
19
+ ORDER_STATUSES,
14
20
  PRIORITY_LABELS,
15
21
  QUERY_LIMITS,
16
22
  RELATION_KINDS,
@@ -26,6 +32,7 @@ import {
26
32
  calendarText,
27
33
  canonicalMeetingReference,
28
34
  checkedScore,
35
+ currencyOf,
29
36
  dateRange,
30
37
  dayBoundary,
31
38
  defineQuery,
@@ -36,25 +43,40 @@ import {
36
43
  findingHash,
37
44
  findingId,
38
45
  findingText,
46
+ formatDecimal,
39
47
  formatMeetingReference,
48
+ invoiceLine,
49
+ invoiceTitle,
40
50
  isClosedState,
41
51
  joinKeyOf,
42
52
  joinUrlWithoutQuery,
43
53
  legacyPriority,
54
+ lineUnits,
44
55
  linkKind,
45
56
  matches,
46
57
  meetingCueFingerprint,
47
58
  meetingFindingFingerprint,
48
59
  meetingTimestamp,
60
+ minorUnits,
61
+ moneyLabel,
62
+ moneyOf,
49
63
  normalizeMeetingParticipantQuery,
50
64
  normalizeTag,
65
+ orderLine,
66
+ orderTitle,
67
+ parseDecimal,
51
68
  parseMeetingQuery,
52
69
  parseMeetingReference,
70
+ paymentEntryTitle,
71
+ paymentLine,
53
72
  paymentTitle,
54
73
  priorityBand,
55
74
  priorityLabel,
75
+ quantityOf,
56
76
  queryAstSchema,
57
77
  queryError,
78
+ scaleOf,
79
+ settledStatus,
58
80
  tagOf,
59
81
  timezoneOf,
60
82
  transcriptLanguage,
@@ -71,11 +93,11 @@ import {
71
93
  validateQuery,
72
94
  walkQuery,
73
95
  zonedMoment
74
- } from "./chunk-H3NMOWPB.js";
96
+ } from "./chunk-GKZ65EOY.js";
75
97
  import {
76
98
  holdsCredential,
77
99
  secretNamed
78
- } from "./chunk-NIEWG4OY.js";
100
+ } from "./chunk-2XBDA3XF.js";
79
101
  import {
80
102
  DEFAULT_STEMMERS,
81
103
  DEFAULT_STEMMERS_VERSION,
@@ -88,26 +110,26 @@ import {
88
110
  fold,
89
111
  normalize,
90
112
  parseStemmers
91
- } from "./chunk-HAC3CWPB.js";
113
+ } from "./chunk-ZHDOELM7.js";
92
114
  import {
93
115
  DEFAULT_TASK_CATEGORIES,
94
116
  sharedConfigPath,
95
117
  storedTaskCategories,
96
118
  taskCategoriesReader
97
- } from "./chunk-7ACGYEGV.js";
119
+ } from "./chunk-URPBRYVA.js";
98
120
  import {
99
121
  refuseOwnerStoreInTests,
100
122
  storePath
101
- } from "./chunk-R7XIZMM5.js";
123
+ } from "./chunk-RRDXT63A.js";
102
124
  import {
103
125
  quietSqliteWarning,
104
126
  storeCapable
105
- } from "./chunk-6BS3FHTC.js";
127
+ } from "./chunk-3G44GDIZ.js";
106
128
  import {
107
129
  PRAGMAS,
108
130
  TIME_LIMIT_FUNCTION,
109
131
  TimeLimitReached
110
- } from "./chunk-H6JNEHUC.js";
132
+ } from "./chunk-NG26I3JV.js";
111
133
  import {
112
134
  array,
113
135
  boolean,
@@ -157,12 +179,12 @@ import {
157
179
  sql,
158
180
  sqliteTable,
159
181
  text
160
- } from "./chunk-ERRC42BB.js";
182
+ } from "./chunk-K6ZWFP2X.js";
161
183
  import {
162
184
  __name
163
185
  } from "./chunk-ZVVMGPBJ.js";
164
186
 
165
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/account-store.js
187
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/account-store.js
166
188
  var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
167
189
  const methods = whole;
168
190
  return Object.fromEntries(Object.keys(keyed).map((name) => [
@@ -290,7 +312,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
290
312
  };
291
313
  }, "bindAccount");
292
314
 
293
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/locator.js
315
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/locator.js
294
316
  var SCHEME = "msg:";
295
317
  var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat: chat2, message: message2 }) => SCHEME + [provider, account, chat2, message2].map(encodeURIComponent).join("/"), "formatLocator");
296
318
  var isLocator = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith(SCHEME), "isLocator");
@@ -304,7 +326,7 @@ var parseLocator = /* @__PURE__ */ __name((reference2) => {
304
326
  return { provider, account, chat: chat2, message: message2 };
305
327
  }, "parseLocator");
306
328
 
307
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/references.js
329
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/references.js
308
330
  var SIMPLE_REFERENCES = [
309
331
  "note",
310
332
  "document",
@@ -318,6 +340,7 @@ var SIMPLE_REFERENCES = [
318
340
  "event",
319
341
  "invoice",
320
342
  "payment",
343
+ "order",
321
344
  "entity"
322
345
  ];
323
346
  var malformed = /* @__PURE__ */ __name((text6, shape) => new CliError("validation_error", `"${singleLine(text6)}" is not a reference \u2014 expected ${shape}`, {
@@ -451,7 +474,7 @@ var looksLikeReference = /* @__PURE__ */ __name((text6) => {
451
474
  return match !== null && byPrefix.has(match[1]);
452
475
  }, "looksLikeReference");
453
476
 
454
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/providers.js
477
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/providers.js
455
478
  var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events"];
456
479
  var MESSENGER_OPENS = { chat: "messages list", message: "messages show", contact: "contacts show" };
457
480
  var PROVIDERS = [
@@ -533,10 +556,10 @@ var joined = /* @__PURE__ */ __name((known2, entry2) => {
533
556
  ...entry2.opens ? { opens: { ...same.opens, ...entry2.opens } } : {}
534
557
  } : entry2;
535
558
  const others = known2.filter((one2) => one2 !== same);
536
- for (const word of wordsOf(merged)) {
537
- const owner = others.find((one2) => wordsOf(one2).includes(word));
559
+ for (const word2 of wordsOf(merged)) {
560
+ const owner = others.find((one2) => wordsOf(one2).includes(word2));
538
561
  if (owner)
539
- invalid(`"${word}" names two providers: ${describe(owner)} and ${describe(merged)}`);
562
+ invalid(`"${word2}" names two providers: ${describe(owner)} and ${describe(merged)}`);
540
563
  }
541
564
  return same ? known2.map((one2) => one2 === same ? merged : one2) : [...known2, merged];
542
565
  }, "joined");
@@ -559,15 +582,15 @@ var useStoredProviders = /* @__PURE__ */ __name((entries) => {
559
582
  var addProvider = /* @__PURE__ */ __name((entry2) => {
560
583
  registry = joined(registry, providerEntryOf(entry2));
561
584
  }, "addProvider");
562
- var isKind = /* @__PURE__ */ __name((word) => KINDS.includes(word.toLowerCase()), "isKind");
563
- var providerNamed = /* @__PURE__ */ __name((word) => {
564
- const wanted = word.toLowerCase();
585
+ var isKind = /* @__PURE__ */ __name((word2) => KINDS.includes(word2.toLowerCase()), "isKind");
586
+ var providerNamed = /* @__PURE__ */ __name((word2) => {
587
+ const wanted = word2.toLowerCase();
565
588
  return registry.find((entry2) => wordsOf(entry2).includes(wanted));
566
589
  }, "providerNamed");
567
590
  var kindIn = /* @__PURE__ */ __name((provider) => isFolderProvider(provider) ? "notes" : registry.find(({ name }) => name === provider)?.kind, "kindIn");
568
591
  var kindOf = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
569
592
 
570
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/search/query.js
593
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/search/query.js
571
594
  var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
572
595
  var inSource = /* @__PURE__ */ __name((source2, provider) => source2 === "all" || source2 === "bots" && isBotProvider(provider) || source2 === "personal" && !isBotProvider(provider) || source2 === provider || providerNamed(source2)?.name === provider || isKind(source2) && kindOf(provider) === source2, "inSource");
573
596
  var fail = /* @__PURE__ */ __name((message2) => {
@@ -590,7 +613,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
590
613
  return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
591
614
  }, "sourceOf");
592
615
 
593
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/search/account-list.js
616
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/search/account-list.js
594
617
  var ACCOUNT_GROUPS = "accountGroups";
595
618
  var ACCOUNT_GROUPS_SETTING = "account_groups";
596
619
  var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
@@ -689,8 +712,8 @@ var accountOf = /* @__PURE__ */ __name((prefix, ref3, held, context) => {
689
712
  const names = profilesOf(provider, context.profiles).map(([name]) => name);
690
713
  return fail2(`no ${provider} account "${ref3}" \u2014 the store holds ${describe2(ofProvider) || "none"}` + (names.length ? `; profiles: ${[...new Set(names)].join(", ")}` : ""));
691
714
  }, "accountOf");
692
- var accountsOfWord = /* @__PURE__ */ __name((word, held, context) => {
693
- const wanted = word.toLowerCase();
715
+ var accountsOfWord = /* @__PURE__ */ __name((word2, held, context) => {
716
+ const wanted = word2.toLowerCase();
694
717
  if (wanted === "all")
695
718
  return [...held];
696
719
  if (wanted === "personal" || wanted === "bots")
@@ -699,8 +722,8 @@ var accountsOfWord = /* @__PURE__ */ __name((word, held, context) => {
699
722
  return held.filter(({ kind: kind4 }) => kind4 === wanted);
700
723
  const recorded = context.profiles[wanted];
701
724
  if (recorded && Object.values(recorded).every((key2) => isFolderProvider(key2.provider) || isDocumentAccountProvider(key2.provider)))
702
- return Object.keys(recorded).map((profile) => accountOf(word, profile, held, context));
703
- const provider = providerOf(word, held, context);
725
+ return Object.keys(recorded).map((profile) => accountOf(word2, profile, held, context));
726
+ const provider = providerOf(word2, held, context);
704
727
  if (isDocumentAccountProvider(provider) || isFolderProvider(provider))
705
728
  return storedAs(held, { provider, account: "" });
706
729
  return held.filter((one2) => one2.provider === provider);
@@ -777,7 +800,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind4)
777
800
  return { accounts: [...chosen.values()], skipped };
778
801
  }, "fitting");
779
802
 
780
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
803
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
781
804
  var IndexBuilderOn = class {
782
805
  static {
783
806
  __name(this, "IndexBuilderOn");
@@ -972,7 +995,7 @@ function alias(table, alias2) {
972
995
  }
973
996
  __name(alias, "alias");
974
997
 
975
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
998
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
976
999
  var ENTITY_TABLES = {
977
1000
  account: "accounts",
978
1001
  attachment: "attachments",
@@ -997,6 +1020,7 @@ var ENTITY_TABLES = {
997
1020
  memory: "memories",
998
1021
  message: "messages",
999
1022
  note: "notes",
1023
+ order: "orders",
1000
1024
  organization: "organizations",
1001
1025
  payment: "payments",
1002
1026
  person: "persons",
@@ -1014,7 +1038,7 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
1014
1038
  return { table, pointer, type, count, known: known2 };
1015
1039
  }).filter(({ count }) => count > 0)), "orphanPointers");
1016
1040
 
1017
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
1041
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
1018
1042
  var canonicalTags = sqliteTable("canonical_tags", {
1019
1043
  id: integer("id").primaryKey(),
1020
1044
  name: text("name").notNull().unique(),
@@ -1023,7 +1047,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
1023
1047
  updatedAt: integer("updated_at").notNull()
1024
1048
  });
1025
1049
 
1026
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
1050
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
1027
1051
  var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
1028
1052
  sourceKey: text("source_key").notNull(),
1029
1053
  collection: text("collection").notNull(),
@@ -1033,13 +1057,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
1033
1057
  createdAt: integer("created_at").notNull()
1034
1058
  }, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
1035
1059
 
1036
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
1060
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
1037
1061
  var documentIndexPending = sqliteTable("document_index_pending", {
1038
1062
  id: integer("id").notNull(),
1039
1063
  indexableType: text("indexable_type").notNull()
1040
1064
  }, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
1041
1065
 
1042
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
1066
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
1043
1067
  var tagRedirects = sqliteTable("tag_redirects", {
1044
1068
  sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
1045
1069
  survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
@@ -1065,7 +1089,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
1065
1089
  index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
1066
1090
  ]);
1067
1091
 
1068
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
1092
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
1069
1093
  var accounts = sqliteTable("accounts", {
1070
1094
  id: integer("id").primaryKey(),
1071
1095
  provider: text("provider").notNull(),
@@ -2348,6 +2372,44 @@ var paymentAllocations = sqliteTable("payment_allocations", {
2348
2372
  index("payment_allocations_by_invoice_id").on(table.invoiceId),
2349
2373
  index("payment_allocations_by_author_type_author_id").on(table.authorType, table.authorId)
2350
2374
  ]);
2375
+ var orders = sqliteTable("orders", {
2376
+ id: integer("id").primaryKey(),
2377
+ customerType: text("customer_type").notNull(),
2378
+ customerId: integer("customer_id").notNull(),
2379
+ purpose: text("purpose").notNull(),
2380
+ supplierType: text("supplier_type"),
2381
+ supplierId: integer("supplier_id"),
2382
+ supplierName: text("supplier_name").notNull(),
2383
+ number: text("number"),
2384
+ currency: text("currency"),
2385
+ /** Minor units of `currency`. */
2386
+ total: integer("total"),
2387
+ status: text("status").notNull(),
2388
+ orderDate: text("order_date"),
2389
+ fulfilledDate: text("fulfilled_date"),
2390
+ invoiceId: integer("invoice_id").references(() => invoices.id),
2391
+ paymentId: integer("payment_id").references(() => payments.id),
2392
+ projectId: integer("project_id").references(() => projects.id),
2393
+ review: text("review").notNull(),
2394
+ authorType: text("author_type").notNull(),
2395
+ authorId: integer("author_id").notNull(),
2396
+ model: text("model"),
2397
+ confirmedByType: text("confirmed_by_type"),
2398
+ confirmedById: integer("confirmed_by_id"),
2399
+ source: text("source").notNull(),
2400
+ metadata: text("metadata"),
2401
+ createdAt: integer("created_at").notNull(),
2402
+ updatedAt: integer("updated_at").notNull(),
2403
+ deletedAt: integer("deleted_at")
2404
+ }, (table) => [
2405
+ index("orders_by_customer_type_customer_id").on(table.customerType, table.customerId),
2406
+ index("orders_by_supplier_type_supplier_id").on(table.supplierType, table.supplierId),
2407
+ index("orders_by_invoice_id").on(table.invoiceId),
2408
+ index("orders_by_payment_id").on(table.paymentId),
2409
+ index("orders_by_project_id").on(table.projectId),
2410
+ index("orders_by_author_type_author_id").on(table.authorType, table.authorId),
2411
+ index("orders_by_confirmed_by_type_confirmed_by_id").on(table.confirmedByType, table.confirmedById)
2412
+ ]);
2351
2413
  var records = sqliteTable("records", {
2352
2414
  id: integer("id").primaryKey(),
2353
2415
  accountId: integer("account_id").notNull().references(() => accounts.id),
@@ -2689,7 +2751,7 @@ var storeSettings = sqliteTable("store_settings", {
2689
2751
  at: integer("at").notNull()
2690
2752
  });
2691
2753
 
2692
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
2754
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
2693
2755
  var ARMS = [
2694
2756
  [
2695
2757
  "message",
@@ -2816,7 +2878,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
2816
2878
  return recomputed;
2817
2879
  }, "drainInvolvementQueue");
2818
2880
 
2819
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/mentions.js
2881
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/mentions.js
2820
2882
  import { domainToUnicode } from "node:url";
2821
2883
 
2822
2884
  // node_modules/.pnpm/psl@1.15.0/node_modules/psl/dist/psl.mjs
@@ -12838,7 +12900,7 @@ var oa = /* @__PURE__ */ __name((e) => {
12838
12900
  }, "oa");
12839
12901
  var na = { parse: O, get: aa, isValid: oa };
12840
12902
 
12841
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
12903
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
12842
12904
  var LINK = /https?:\/\/(?:(?:docs|drive|sheets|slides)\.google\.com|forms\.gle)(?:[/?#][^\s<>"'`]*)?/gi;
12843
12905
  var ID = /^[\w-]{10,}$/;
12844
12906
  var trimUrl = /* @__PURE__ */ __name((url) => {
@@ -12879,7 +12941,7 @@ var googleDocumentLinks = /* @__PURE__ */ __name((text6) => [...text6.matchAll(L
12879
12941
  return { url, documentId: googleDocumentId(url) };
12880
12942
  }), "googleDocumentLinks");
12881
12943
 
12882
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
12944
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
12883
12945
  var PHONE_PLANS = [
12884
12946
  {
12885
12947
  country: "us",
@@ -13259,7 +13321,7 @@ var PHONE_PLANS = [
13259
13321
  }
13260
13322
  ];
13261
13323
 
13262
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/phones.js
13324
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/phones.js
13263
13325
  var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
13264
13326
  var DEFAULT_PHONE_COUNTRIES = ["ru"];
13265
13327
  var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
@@ -13300,7 +13362,7 @@ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
13300
13362
  return void 0;
13301
13363
  }, "nationalPhone");
13302
13364
 
13303
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/places.js
13365
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/places.js
13304
13366
  var BEFORE = [
13305
13367
  [/^(?:ул\.?|улиц[аеыу]|улицей)$/iu, "\u0443\u043B\u0438\u0446\u0430"],
13306
13368
  [/^(?:пр-т|просп\.?|проспект[аеу]?)$/iu, "\u043F\u0440\u043E\u0441\u043F\u0435\u043A\u0442"],
@@ -13375,13 +13437,13 @@ var POSTCODES = [
13375
13437
  ];
13376
13438
  var tokensOf = /* @__PURE__ */ __name((text6) => [...text6.matchAll(TOKEN)].map((match) => {
13377
13439
  const trimmed = match[0].replace(/-+$/, "");
13378
- const word = new RegExp("^(?:\\d+|\\p{L}{5,})\\.$", "u").test(trimmed) ? trimmed.slice(0, -1) : trimmed;
13379
- return { text: word, start: match.index, end: match.index + word.length };
13440
+ const word2 = new RegExp("^(?:\\d+|\\p{L}{5,})\\.$", "u").test(trimmed) ? trimmed.slice(0, -1) : trimmed;
13441
+ return { text: word2, start: match.index, end: match.index + word2.length };
13380
13442
  }), "tokensOf");
13381
- var typeOf = /* @__PURE__ */ __name((table, word) => {
13443
+ var typeOf = /* @__PURE__ */ __name((table, word2) => {
13382
13444
  for (const [pattern, full] of table)
13383
- if (pattern.test(word))
13384
- return full || word.toLowerCase();
13445
+ if (pattern.test(word2))
13446
+ return full || word2.toLowerCase();
13385
13447
  return void 0;
13386
13448
  }, "typeOf");
13387
13449
  var nameRun = /* @__PURE__ */ __name((tokens, from2, text6, step, most = 5) => {
@@ -13408,17 +13470,17 @@ var numberAfter = /* @__PURE__ */ __name((tokens, at, text6) => {
13408
13470
  let next = at + 1;
13409
13471
  const gapOk = /* @__PURE__ */ __name((from2, to) => /^[ ,]{1,2}$/.test(text6.slice(from2.end, to.start)), "gapOk");
13410
13472
  const previous = tokens[at];
13411
- let word = tokens[next];
13412
- if (!previous || !word || !gapOk(previous, word))
13473
+ let word2 = tokens[next];
13474
+ if (!previous || !word2 || !gapOk(previous, word2))
13413
13475
  return void 0;
13414
- if (NUMBER_WORD.test(word.text)) {
13476
+ if (NUMBER_WORD.test(word2.text)) {
13415
13477
  const number3 = tokens[next + 1];
13416
- if (!number3 || !/^ ?$/.test(text6.slice(word.end, number3.start)))
13478
+ if (!number3 || !/^ ?$/.test(text6.slice(word2.end, number3.start)))
13417
13479
  return void 0;
13418
13480
  next += 1;
13419
- word = number3;
13481
+ word2 = number3;
13420
13482
  }
13421
- if (!NUMBER.test(word.text))
13483
+ if (!NUMBER.test(word2.text))
13422
13484
  return void 0;
13423
13485
  let last = next;
13424
13486
  for (let more = next + 1; more + 1 < tokens.length; more += 2) {
@@ -13428,7 +13490,7 @@ var numberAfter = /* @__PURE__ */ __name((tokens, at, text6) => {
13428
13490
  break;
13429
13491
  last = more + 1;
13430
13492
  }
13431
- return { number: word.text.toLowerCase(), last };
13493
+ return { number: word2.text.toLowerCase(), last };
13432
13494
  }, "numberAfter");
13433
13495
  var UNIT = /^(?:(?:квартира|кв\.?|корпус|корп\.?|к\.|строение|стр\.?|офис|оф\.?|лит\.?|этаж|эт\.?|помещение|помещ\.?|пом\.?|комната|комн\.?|ком\.?|piso|puerta|planta|esc\.?|apt\.?|apartment|suite|ste\.?|unit|flat|floor|pmb)(?<=\.)\s?[\p{L}\d]{1,5}(?![\p{L}\d])|(?:квартира|кв|корпус|корп|строение|стр|офис|оф|лит|этаж|эт|помещение|помещ|пом|комната|комн|ком|piso|puerta|planta|esc|apt|apartment|suite|ste|unit|flat|floor|pmb)(?:\s|(?=\d))[\p{L}\d]{1,5}(?![\p{L}\d])|\d{1,2}(?:st|nd|rd|th) floor|#\d{1,6}(?:-\d{1,4})?|\d{1,2}\s?[ºª°](?:\s?(?:[A-Za-z]|\d{1,2}\s?[ºª]))?(?![\p{L}\d])|\d{1,2}-\d{1,2}(?![\d-])|\d{1,2}[A-Za-z](?![\p{L}\d])|(?:izq(?:da)?|dcha|izquierda|derecha)\.?(?![\p{L}]))/iu;
13434
13496
  var DIRECTION = /^(?:N|S|E|W|NE|NW|SE|SW)\.?(?![\p{L}\d])/u;
@@ -13439,7 +13501,7 @@ var COUNTRY = /^(?:USA|US|UK|RU|United[ \t\u00a0]+(?:States|Kingdom)|España|Spa
13439
13501
  var PLACE_PART = new RegExp("(?:\u0420\u0435\u0433\u0438\u043E\u043D \\d{1,3}|(?:\u0433\\.|\u0433\u043E\u0440\u043E\u0434)\\s?\\p{Lu}[\\p{L}-]*(?:[ -]\\p{Lu}[\\p{L}-]*)?|\\p{Lu}\\p{Ll}+(?:[ -]\\p{Lu}\\p{Ll}+)? (?:\u043E\u0431\u043B\\.|\u043E\u0431\u043B\u0430\u0441\u0442\u044C|\u043A\u0440\u0430\u0439)|\\p{Lu}\\p{Ll}+(?:-\\p{Lu}\\p{Ll}+)*)", "u").source;
13440
13502
  var BEFORE_STREET = new RegExp(`(?:(?:\\d{6}|\u0420\u043E\u0441\u0441\u0438\u044F|\u0420\u0424),[ ]?|(?:\u0433\\.|\u0433\u043E\u0440\u043E\u0434)\\s?\\p{Lu}[\\p{L}-]*,[ ]?)(?:${PLACE_PART},[ ]?)*$`, "u");
13441
13503
  var MOST_TAIL = 100;
13442
- var isStreetWord = /* @__PURE__ */ __name((word) => typeOf(BEFORE, word) !== void 0 || typeOf(AFTER, word) !== void 0 || typeOf(ENGLISH, word) !== void 0, "isStreetWord");
13504
+ var isStreetWord = /* @__PURE__ */ __name((word2) => typeOf(BEFORE, word2) !== void 0 || typeOf(AFTER, word2) !== void 0 || typeOf(ENGLISH, word2) !== void 0, "isStreetWord");
13443
13505
  var REGION = /(?:обл\.|область|край|р-н|район)\)?$/u;
13444
13506
  var cityOf = /* @__PURE__ */ __name((words3) => {
13445
13507
  const city = words3.replace(/^(?:г\.|город)\s?/u, "").replace(/[()]/g, "").trim();
@@ -13560,7 +13622,7 @@ var findPlaces = /* @__PURE__ */ __name((text6) => {
13560
13622
  return found2.sort((a, b) => a.start - b.start);
13561
13623
  }, "findPlaces");
13562
13624
 
13563
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/mentions.js
13625
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/mentions.js
13564
13626
  var MENTION_KINDS = ["phone", "email", "url", "document", "person-name", "place"];
13565
13627
  var MENTION_VERSIONS = {
13566
13628
  phone: 1,
@@ -13750,7 +13812,7 @@ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE
13750
13812
  };
13751
13813
  }, "typedPhone");
13752
13814
 
13753
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/first-names.js
13815
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/first-names.js
13754
13816
  var RUSSIAN = "\u0410\u043B\u0435\u043A\u0441\u0430\u043D\u0434\u0440 \u0410\u043B\u0435\u043A\u0441\u0435\u0439 \u0410\u043D\u0430\u0442\u043E\u043B\u0438\u0439 \u0410\u043D\u0434\u0440\u0435\u0439 \u0410\u043D\u0442\u043E\u043D \u0410\u0440\u043A\u0430\u0434\u0438\u0439 \u0410\u0440\u0441\u0435\u043D\u0438\u0439 \u0410\u0440\u0442\u0451\u043C \u0410\u0440\u0442\u0435\u043C \u0410\u0440\u0442\u0443\u0440 \u0411\u043E\u0440\u0438\u0441 \u0412\u0430\u0434\u0438\u043C \u0412\u0430\u043B\u0435\u043D\u0442\u0438\u043D \u0412\u0430\u043B\u0435\u0440\u0438\u0439 \u0412\u0430\u0441\u0438\u043B\u0438\u0439 \u0412\u0438\u043A\u0442\u043E\u0440 \u0412\u0438\u0442\u0430\u043B\u0438\u0439 \u0412\u043B\u0430\u0434\u0438\u043C\u0438\u0440 \u0412\u043B\u0430\u0434\u0438\u0441\u043B\u0430\u0432 \u0412\u0441\u0435\u0432\u043E\u043B\u043E\u0434 \u0412\u044F\u0447\u0435\u0441\u043B\u0430\u0432 \u0413\u0435\u043D\u043D\u0430\u0434\u0438\u0439 \u0413\u0435\u043E\u0440\u0433\u0438\u0439 \u0413\u043B\u0435\u0431 \u0413\u0440\u0438\u0433\u043E\u0440\u0438\u0439 \u0414\u0430\u043D\u0438\u0438\u043B \u0414\u0430\u043D\u0438\u043B\u0430 \u0414\u0435\u043D\u0438\u0441 \u0414\u043C\u0438\u0442\u0440\u0438\u0439 \u0415\u0432\u0433\u0435\u043D\u0438\u0439 \u0415\u0433\u043E\u0440 \u0418\u0432\u0430\u043D \u0418\u0433\u043E\u0440\u044C \u0418\u043B\u044C\u044F \u041A\u0438\u0440\u0438\u043B\u043B \u041A\u043E\u043D\u0441\u0442\u0430\u043D\u0442\u0438\u043D \u041B\u0435\u043E\u043D\u0438\u0434 \u041C\u0430\u043A\u0441\u0438\u043C \u041C\u0430\u0440\u0430\u0442 \u041C\u0430\u0442\u0432\u0435\u0439 \u041C\u0438\u0445\u0430\u0438\u043B \u041D\u0438\u043A\u0438\u0442\u0430 \u041D\u0438\u043A\u043E\u043B\u0430\u0439 \u041E\u043B\u0435\u0433 \u041F\u0430\u0432\u0435\u043B \u041F\u0451\u0442\u0440 \u041F\u0435\u0442\u0440 \u0420\u043E\u0434\u0438\u043E\u043D \u0420\u043E\u0441\u0442\u0438\u0441\u043B\u0430\u0432 \u0420\u0443\u0441\u043B\u0430\u043D \u0420\u0443\u0441\u0442\u0430\u043C \u0421\u0435\u043C\u0451\u043D \u0421\u0435\u043C\u0435\u043D \u0421\u0435\u0440\u0433\u0435\u0439 \u0421\u0442\u0430\u043D\u0438\u0441\u043B\u0430\u0432 \u0421\u0442\u0435\u043F\u0430\u043D \u0422\u0438\u043C\u043E\u0444\u0435\u0439 \u0422\u0438\u043C\u0443\u0440 \u0424\u0451\u0434\u043E\u0440 \u0424\u0435\u0434\u043E\u0440 \u0424\u0438\u043B\u0438\u043F\u043F \u042D\u0434\u0443\u0430\u0440\u0434 \u042E\u0440\u0438\u0439 \u042F\u0440\u043E\u0441\u043B\u0430\u0432 \u042F\u043A\u043E\u0432 \u042D\u043B\u044C\u0434\u0430\u0440 \u0414\u0430\u0432\u0438\u0434 \u0417\u0430\u0445\u0430\u0440 \u0421\u0430\u0432\u0435\u043B\u0438\u0439 \u041C\u0438\u0440\u043E\u043D \u041F\u043B\u0430\u0442\u043E\u043D \u0414\u0435\u043C\u0438\u0434 \u0410\u0440\u0441\u0435\u043D \u041D\u0443\u0440\u043B\u0430\u043D \u0410\u043D\u0437\u043E\u0440 \u0410\u043B\u0435\u043A\u0441\u0430\u043D\u0434\u0440\u0430 \u0410\u043B\u0438\u043D\u0430 \u0410\u043B\u0438\u0441\u0430 \u0410\u043B\u043B\u0430 \u0410\u043D\u0430\u0441\u0442\u0430\u0441\u0438\u044F \u0410\u043D\u0433\u0435\u043B\u0438\u043D\u0430 \u0410\u043D\u043D\u0430 \u0410\u043D\u0442\u043E\u043D\u0438\u043D\u0430 \u0412\u0430\u043B\u0435\u043D\u0442\u0438\u043D\u0430 \u0412\u0430\u043B\u0435\u0440\u0438\u044F \u0412\u0430\u0440\u0432\u0430\u0440\u0430 \u0412\u0435\u0440\u043E\u043D\u0438\u043A\u0430 \u0412\u0438\u043A\u0442\u043E\u0440\u0438\u044F \u0413\u0430\u043B\u0438\u043D\u0430 \u0414\u0430\u0440\u044C\u044F \u0414\u0438\u0430\u043D\u0430 \u0415\u0432\u0433\u0435\u043D\u0438\u044F \u0415\u043A\u0430\u0442\u0435\u0440\u0438\u043D\u0430 \u0415\u043B\u0435\u043D\u0430 \u0415\u043B\u0438\u0437\u0430\u0432\u0435\u0442\u0430 \u0416\u0430\u043D\u043D\u0430 \u0417\u0438\u043D\u0430\u0438\u0434\u0430 \u041A\u0430\u0440\u0438\u043D\u0430 \u041A\u0438\u0440\u0430 \u041A\u043B\u0430\u0432\u0434\u0438\u044F \u041A\u0440\u0438\u0441\u0442\u0438\u043D\u0430 \u041A\u0441\u0435\u043D\u0438\u044F \u041B\u0430\u0440\u0438\u0441\u0430 \u041B\u0438\u0434\u0438\u044F \u041B\u044E\u0434\u043C\u0438\u043B\u0430 \u041C\u0430\u0440\u0433\u0430\u0440\u0438\u0442\u0430 \u041C\u0430\u0440\u0438\u043D\u0430 \u041C\u0430\u0440\u0438\u044F \u041C\u0438\u043B\u0430\u043D\u0430 \u041D\u0430\u0442\u0430\u043B\u044C\u044F \u041D\u0430\u0442\u0430\u043B\u0438\u044F \u041D\u0438\u043D\u0430 \u041E\u043A\u0441\u0430\u043D\u0430 \u041E\u043B\u0435\u0441\u044F \u041E\u043B\u044C\u0433\u0430 \u041F\u043E\u043B\u0438\u043D\u0430 \u0420\u0430\u0438\u0441\u0430 \u0421\u0432\u0435\u0442\u043B\u0430\u043D\u0430 \u0421\u043E\u0444\u0438\u044F \u0421\u043E\u0444\u044C\u044F \u0422\u0430\u0438\u0441\u0438\u044F \u0422\u0430\u043C\u0430\u0440\u0430 \u0422\u0430\u0442\u044C\u044F\u043D\u0430 \u0423\u043B\u044C\u044F\u043D\u0430 \u042E\u043B\u0438\u044F \u042D\u043B\u044C\u0432\u0438\u0440\u0430 \u0420\u0435\u0433\u0438\u043D\u0430 \u0421\u043D\u0435\u0436\u0430\u043D\u0430 \u0410\u043B\u0451\u043D\u0430 \u0410\u043B\u0435\u043D\u0430 \u0412\u0430\u0441\u0438\u043B\u0438\u0441\u0430 \u0410\u0440\u0438\u043D\u0430 \u0415\u0441\u0435\u043D\u0438\u044F \u042D\u0432\u0435\u043B\u0438\u043D\u0430 \u0421\u0430\u0448\u0430 \u0416\u0435\u043D\u044F \u0412\u0430\u043B\u044F \u0414\u0438\u043C\u0430 \u041C\u0438\u0448\u0430 \u041A\u043E\u043B\u044F \u041F\u0435\u0442\u044F \u0412\u0430\u0441\u044F \u0421\u0435\u0440\u0451\u0436\u0430 \u0421\u0435\u0440\u0435\u0436\u0430 \u041F\u0430\u0448\u0430 \u041B\u0451\u0448\u0430 \u041B\u0435\u0448\u0430 \u0412\u0438\u0442\u044F \u041A\u043E\u0441\u0442\u044F \u0412\u043E\u0432\u0430 \u0412\u043E\u043B\u043E\u0434\u044F \u0412\u0430\u043D\u044F \u0413\u043E\u0448\u0430 \u0413\u0440\u0438\u0448\u0430 \u0422\u043E\u043B\u044F \u0411\u043E\u0440\u044F \u0421\u0442\u0430\u0441 \u0422\u0451\u043C\u0430 \u0422\u0430\u043D\u044F \u041A\u0430\u0442\u044F \u041B\u0435\u043D\u0430 \u041D\u0430\u0442\u0430\u0448\u0430 \u0421\u0432\u0435\u0442\u0430 \u042E\u043B\u044F \u041D\u0430\u0441\u0442\u044F \u0414\u0430\u0448\u0430 \u041C\u0430\u0448\u0430 \u041B\u044E\u0434\u0430 \u0413\u0430\u043B\u044F \u0412\u0438\u043A\u0430 \u041A\u0441\u044E\u0448\u0430 \u041B\u0438\u0437\u0430 \u0421\u043E\u043D\u044F \u041D\u0430\u0434\u044F \u041B\u0435\u0440\u0430 \u0410\u043B\u0451\u0448\u0430 \u0410\u043B\u0435\u0448\u0430 \u041C\u0438\u0442\u044F \u0421\u0435\u043D\u044F \u0424\u0435\u0434\u044F \u0416\u0435\u043D\u0435\u0447\u043A\u0430 \u041E\u043B\u0435\u043D\u044C\u043A\u0430 \u0422\u0430\u043D\u0435\u0447\u043A\u0430";
13755
13817
  var EUROPEAN = "James John Robert Michael William David Richard Joseph Thomas Charles Christopher Daniel Matthew Anthony Donald Steven Paul Andrew Joshua Kenneth Kevin Brian George Timothy Ronald Edward Jason Jeffrey Ryan Jacob Gary Nicholas Eric Jonathan Stephen Larry Justin Scott Brandon Benjamin Samuel Gregory Alexander Patrick Raymond Dennis Jerry Tyler Aaron Nathan Henry Peter Zachary Douglas Harold Kyle Noah Ethan Oliver Harry Lucas Liam Mary Patricia Jennifer Linda Elizabeth Barbara Susan Jessica Sarah Karen Lisa Nancy Betty Margaret Sandra Ashley Kimberly Emily Donna Michelle Carol Amanda Dorothy Melissa Deborah Stephanie Rebecca Sharon Laura Cynthia Kathleen Angela Shirley Anna Brenda Pamela Emma Nicole Helen Samantha Katherine Christine Rachel Carolyn Janet Catherine Maria Heather Diane Ruth Julie Olivia Joyce Kelly Lauren Christina Joan Evelyn Judith Megan Andrea Cheryl Hannah Jacqueline Martha Teresa Sara Madison Frances Kathryn Janice Abigail Alice Julia Judy Sophia Denise Doris Marilyn Danielle Beverly Isabella Theresa Diana Natalie Charlotte Marie Kayla Alexis Javier Carlos Antonio Manuel Francisco Juan Pedro Alejandro Miguel Rafael Pablo Sergio Fernando Jorge Luis Alberto \xC1lvaro Diego Adri\xE1n Rub\xE9n Iv\xE1n \xD3scar Andr\xE9s Ra\xFAl Enrique Vicente Joaqu\xEDn Ignacio Gonzalo Marcos V\xEDctor Jaime Alfonso Guillermo Tom\xE1s Emilio Gabriel Nicol\xE1s Mart\xEDn Jordi Josep Xavier Luc\xEDa Carmen Isabel Cristina Marta Elena Raquel Silvia Beatriz Paula Nuria N\xFAria Sonia Alicia Irene Montserrat Inmaculada Noelia Lorena Sof\xEDa Valeria Claudia Natalia Sandra Ver\xF3nica Esther Yolanda Vanesa Laia Klaus J\xFCrgen Wolfgang Stefan Andreas Matthias Markus Tobias Florian Lukas Jonas Maximilian Sebastian Dirk Sabine Ursula Petra Monika Katrin Anja Pierre Michel Philippe Alain Fran\xE7ois Christophe Laurent Olivier Julien Mathieu S\xE9bastien Guillaume Antoine Camille Nathalie Isabelle Sylvie Sophie C\xE9line Aur\xE9lie Chlo\xE9 Manon Giuseppe Giovanni Marco Luca Francesco Alessandro Matteo Lorenzo Stefano Paolo Roberto Davide Simone Federico Giulia Francesca Chiara Valentina Alessia Martina Elisa Jo\xE3o Pedro Tiago Beatriz In\xEAs Mariana Piotr Krzysztof Tomasz Marcin Agnieszka Katarzyna Ma\u0142gorzata Magdalena";
13756
13818
  var WORDS = "\u0412\u0435\u0440\u0430 \u041D\u0430\u0434\u0435\u0436\u0434\u0430 \u041B\u044E\u0431\u043E\u0432\u044C \u0421\u043B\u0430\u0432\u0430 \u0420\u043E\u043C\u0430\u043D \u0420\u043E\u0437\u0430 \u041C\u0430\u0439\u044F \u041B\u0438\u043B\u0438\u044F \u0417\u043B\u0430\u0442\u0430 \u041C\u0438\u043B\u0430 \u041D\u0438\u043A\u0430 \u041B\u0435\u0432 \u0413\u043B\u043E\u0440\u0438\u044F Will Mark Rose Grace Hope Faith Bill Frank Jack June April Summer Amber Ruby Lily Daisy Victoria Virginia Georgia Florence Sydney Chelsea Jordan Austin Dallas Mercedes Dolores Rosa Pilar Marina Esperanza Gloria Amparo Consuelo Roc\xEDo Salvador Santiago Jes\xFAs \xC1ngeles Hugo Ram\xF3n Christian Felix F\xE9lix Mario Martin Victor Pierre Paz Merc\xE8 Estrella Aurora Concepci\xF3n Remedios Soledad Milagros Angel \xC1ngel Dawn Joy Holly Ivy Iris Violet Pearl";
@@ -13758,7 +13820,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
13758
13820
  var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
13759
13821
  var NAME_WORDS = WORDS.split(" ");
13760
13822
 
13761
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/person-names.js
13823
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/person-names.js
13762
13824
  var LATIN_TO_CYRILLIC = {
13763
13825
  shch: "\u0449",
13764
13826
  sch: "\u0449",
@@ -13804,7 +13866,7 @@ var MIN_WORD = 4;
13804
13866
  var WORD2 = new RegExp("(?<![\\p{L}\\p{N}])\\p{Lu}\\p{Ll}{3,}(?![\\p{L}\\p{N}])", "gu");
13805
13867
  var NAME_WORD = new RegExp("^\\p{L}{3,}$", "u");
13806
13868
  var MAX_ENDING = 3;
13807
- var keyOf2 = /* @__PURE__ */ __name((stem, word) => `s:${stem.stemToken(word)}`, "keyOf");
13869
+ var keyOf2 = /* @__PURE__ */ __name((stem, word2) => `s:${stem.stemToken(word2)}`, "keyOf");
13808
13870
  var nameIndex = /* @__PURE__ */ __name((known2, stem) => {
13809
13871
  const people2 = /* @__PURE__ */ new Map();
13810
13872
  const own = /* @__PURE__ */ new Map();
@@ -13813,17 +13875,17 @@ var nameIndex = /* @__PURE__ */ __name((known2, stem) => {
13813
13875
  bearers.add(person2);
13814
13876
  map.set(key2, bearers);
13815
13877
  }, "add");
13816
- const addWord = /* @__PURE__ */ __name((map, word, person2) => {
13817
- if (stem.stemToken(word).length >= MIN_STEM)
13818
- add(map, keyOf2(stem, word), person2);
13819
- add(map, `w:${word.toLowerCase()}`, person2);
13878
+ const addWord = /* @__PURE__ */ __name((map, word2, person2) => {
13879
+ if (stem.stemToken(word2).length >= MIN_STEM)
13880
+ add(map, keyOf2(stem, word2), person2);
13881
+ add(map, `w:${word2.toLowerCase()}`, person2);
13820
13882
  }, "addWord");
13821
13883
  const addName = /* @__PURE__ */ __name((maps, name, id2) => {
13822
- for (const word of name.split(/[\s.,()"«»-]+/u).filter((one2) => NAME_WORD.test(one2)))
13884
+ for (const word2 of name.split(/[\s.,()"«»-]+/u).filter((one2) => NAME_WORD.test(one2)))
13823
13885
  for (const map of maps) {
13824
- addWord(map, word, id2);
13825
- if (/^[a-z]+$/i.test(word))
13826
- addWord(map, cyrillicOf(word), id2);
13886
+ addWord(map, word2, id2);
13887
+ if (/^[a-z]+$/i.test(word2))
13888
+ addWord(map, cyrillicOf(word2), id2);
13827
13889
  }
13828
13890
  }, "addName");
13829
13891
  for (const { id: id2, names, aliases: aliases2 = [] } of known2) {
@@ -13834,9 +13896,9 @@ var nameIndex = /* @__PURE__ */ __name((known2, stem) => {
13834
13896
  }
13835
13897
  return { people: people2, own, stem };
13836
13898
  }, "nameIndex");
13837
- var bearersOf = /* @__PURE__ */ __name(({ people: people2, stem }, word) => {
13838
- const byStem = people2.get(keyOf2(stem, word));
13839
- const lower = word.toLowerCase();
13899
+ var bearersOf = /* @__PURE__ */ __name(({ people: people2, stem }, word2) => {
13900
+ const byStem = people2.get(keyOf2(stem, word2));
13901
+ const lower = word2.toLowerCase();
13840
13902
  for (let cut2 = 0; cut2 <= MAX_ENDING && lower.length - cut2 >= MIN_WORD - 1; cut2++) {
13841
13903
  const written2 = people2.get(`w:${lower.slice(0, lower.length - cut2)}`);
13842
13904
  if (written2)
@@ -13876,10 +13938,10 @@ var findNames = /* @__PURE__ */ __name((text6, index2) => {
13876
13938
  return false;
13877
13939
  if (confidence > 0.6)
13878
13940
  return true;
13879
- const word = text6.slice(start, end);
13880
- if (CYRILLIC_WORD.test(word) && /е$/u.test(word) && IN_CITY.test(before2))
13941
+ const word2 = text6.slice(start, end);
13942
+ if (CYRILLIC_WORD.test(word2) && /е$/u.test(word2) && IN_CITY.test(before2))
13881
13943
  return false;
13882
- return roleOf(word) === "first" || SURNAME.test(word) || LATIN_SURNAME.test(word) || bearersOf({ people: index2.own, stem: index2.stem }, word) !== void 0;
13944
+ return roleOf(word2) === "first" || SURNAME.test(word2) || LATIN_SURNAME.test(word2) || bearersOf({ people: index2.own, stem: index2.stem }, word2) !== void 0;
13883
13945
  });
13884
13946
  }, "findNames");
13885
13947
  var ENDINGS = ["\u0430", "\u044F", "\u0443", "\u044E", "\u0435", "\u0438", "\u044B", "\u043E\u0439", "\u0435\u0439", "\u043E\u043C", "\u0435\u043C", "\u043E\u044E", "\u0435\u044E", "\u044C\u044E", "\u0438\u0439", "\u0438\u044F", "\u0438\u044E", "\u0438\u0435\u043C"];
@@ -13909,13 +13971,13 @@ var nameForms = /* @__PURE__ */ __name(() => {
13909
13971
  for (const name of NAME_WORDS)
13910
13972
  for (const form of formsOf(name))
13911
13973
  forms.set(form, "word");
13912
- for (const word of NOT_NAMES)
13913
- forms.delete(word);
13974
+ for (const word2 of NOT_NAMES)
13975
+ forms.delete(word2);
13914
13976
  return forms;
13915
13977
  }, "nameForms");
13916
- var roleOf = /* @__PURE__ */ __name((word) => PATRONYMIC.test(word) ? "patronymic" : nameForms().get(word.toLowerCase()), "roleOf");
13978
+ var roleOf = /* @__PURE__ */ __name((word2) => PATRONYMIC.test(word2) ? "patronymic" : nameForms().get(word2.toLowerCase()), "roleOf");
13917
13979
  var findUnknownNames = /* @__PURE__ */ __name((text6, stem, taken) => {
13918
- const words3 = [...text6.matchAll(WORD2)].map((match) => ({ text: match[0], start: match.index, end: match.index + match[0].length })).filter((word) => !taken.some((one2) => word.start < one2.end && word.end > one2.start));
13980
+ const words3 = [...text6.matchAll(WORD2)].map((match) => ({ text: match[0], start: match.index, end: match.index + match[0].length })).filter((word2) => !taken.some((one2) => word2.start < one2.end && word2.end > one2.start));
13919
13981
  const adjacent = /* @__PURE__ */ __name((a, b) => {
13920
13982
  const left = words3[a];
13921
13983
  const right = words3[b];
@@ -13957,7 +14019,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text6, stem, taken) => {
13957
14019
  found2.push({
13958
14020
  start: span[0].start,
13959
14021
  end: span.at(-1).end,
13960
- value: span.map((word) => stem.stemToken(word.text)).join(" "),
14022
+ value: span.map((word2) => stem.stemToken(word2.text)).join(" "),
13961
14023
  people: [],
13962
14024
  confidence: first === last ? 0.4 : 0.5
13963
14025
  });
@@ -13966,7 +14028,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text6, stem, taken) => {
13966
14028
  return found2;
13967
14029
  }, "findUnknownNames");
13968
14030
 
13969
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/attachments.js
14031
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/attachments.js
13970
14032
  var NOT_FILES = /* @__PURE__ */ new Set([
13971
14033
  "webpage",
13972
14034
  "share",
@@ -14006,7 +14068,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored3, files2) => {
14006
14068
  });
14007
14069
  }, "matchDownloads");
14008
14070
 
14009
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
14071
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
14010
14072
  var QUERY_VERSION = 1;
14011
14073
  var QUERY_LIMITS2 = {
14012
14074
  ...QUERY_LIMITS,
@@ -14042,7 +14104,7 @@ function exhausted(budget) {
14042
14104
  }
14043
14105
  __name(exhausted, "exhausted");
14044
14106
 
14045
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
14107
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
14046
14108
  var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
14047
14109
  var literal2 = /* @__PURE__ */ __name((c) => ({
14048
14110
  kind: "char",
@@ -14442,7 +14504,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
14442
14504
  return out;
14443
14505
  }, "foldRegex");
14444
14506
 
14445
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
14507
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
14446
14508
  var PRESET_VERSION = 1;
14447
14509
  var PRESETS = {
14448
14510
  password: {
@@ -14496,7 +14558,7 @@ var PRESETS = {
14496
14558
  }
14497
14559
  };
14498
14560
 
14499
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
14561
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
14500
14562
  var FIELD_VERSION = 2;
14501
14563
  var UNITS = {
14502
14564
  "": 1,
@@ -14957,12 +15019,12 @@ var validateAst = /* @__PURE__ */ __name((input) => {
14957
15019
  return validateFields(parsed3.output);
14958
15020
  }, "validateAst");
14959
15021
 
14960
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
15022
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
14961
15023
  var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
14962
15024
  var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
14963
15025
  var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
14964
15026
 
14965
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
15027
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
14966
15028
  var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
14967
15029
  var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
14968
15030
  var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
@@ -14986,7 +15048,7 @@ var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
14986
15048
  };
14987
15049
  }, "linkMatch");
14988
15050
 
14989
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
15051
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
14990
15052
  var SETTING = "phoneCountries";
14991
15053
  var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
14992
15054
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
@@ -15017,7 +15079,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
15017
15079
  return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
15018
15080
  }, "valueMatch");
15019
15081
 
15020
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
15082
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
15021
15083
  var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
15022
15084
  if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
15023
15085
  throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
@@ -15045,7 +15107,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
15045
15107
  return 2 * intersection2 / (aa2.size + bb.size);
15046
15108
  }, "vocabularySimilarity");
15047
15109
 
15048
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
15110
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
15049
15111
  import { createHash } from "node:crypto";
15050
15112
  var folded2 = /* @__PURE__ */ __name((name) => {
15051
15113
  try {
@@ -15111,7 +15173,7 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind4, by, options
15111
15173
  });
15112
15174
  }, "guardTagCreation");
15113
15175
 
15114
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
15176
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
15115
15177
  var invalid2 = /* @__PURE__ */ __name((message2) => {
15116
15178
  throw new CliError("validation_error", message2);
15117
15179
  }, "invalid");
@@ -15188,7 +15250,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
15188
15250
  };
15189
15251
  }, "createTagRedirectIndex");
15190
15252
 
15191
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
15253
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
15192
15254
  var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
15193
15255
  const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
15194
15256
  if (!row2)
@@ -15216,7 +15278,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
15216
15278
  return snapshot2;
15217
15279
  }, "tagRedirectSnapshot");
15218
15280
 
15219
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
15281
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
15220
15282
  import { createHash as createHash2 } from "node:crypto";
15221
15283
  var TASK_KEY_PREFIXES = {
15222
15284
  question: "Q",
@@ -15244,7 +15306,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
15244
15306
  return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
15245
15307
  }, "taskAccountOf");
15246
15308
 
15247
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
15309
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
15248
15310
  var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
15249
15311
  var REFERABLE = {
15250
15312
  note: { tombstone: true },
@@ -15259,6 +15321,7 @@ var REFERABLE = {
15259
15321
  event: { tombstone: true },
15260
15322
  invoice: { tombstone: true },
15261
15323
  payment: { tombstone: true },
15324
+ order: { tombstone: true },
15262
15325
  message: { tombstone: true },
15263
15326
  email: { tombstone: true },
15264
15327
  email_thread: { tombstone: true },
@@ -15408,7 +15471,7 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
15408
15471
  return row2 ? String(row2.id ?? row2.key) : void 0;
15409
15472
  }, "taskIdOf");
15410
15473
 
15411
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
15474
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
15412
15475
  var toMs = /* @__PURE__ */ __name((iso13) => {
15413
15476
  if (iso13 === null || iso13 === void 0)
15414
15477
  return null;
@@ -15422,7 +15485,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
15422
15485
  var DELIVERY = { delivered: 1, read: 2 };
15423
15486
  var deliveryOf = /* @__PURE__ */ __name((stored3) => stored3 === DELIVERY.read ? "read" : stored3 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
15424
15487
 
15425
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
15488
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
15426
15489
  var TAG_KINDS = ["tag", "topic"];
15427
15490
  var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
15428
15491
  var TAG_TYPE = {
@@ -15625,7 +15688,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
15625
15688
  return result;
15626
15689
  }, "tagsOf");
15627
15690
 
15628
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
15691
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
15629
15692
  var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
15630
15693
  var SPEECH = speech("att");
15631
15694
  var mentionText = /* @__PURE__ */ __name((alias2) => `CASE WHEN coalesce(json_extract(${alias2}.contact, '$.phone'), '') <> '' THEN 'phone: ' || json_extract(${alias2}.contact, '$.phone') ELSE ${alias2}.text END`, "mentionText");
@@ -15945,7 +16008,7 @@ var subject = /* @__PURE__ */ __name(({ operator, value }, { corpus, mail }) =>
15945
16008
  fragment: { ...wordMatch(corpus, parts2.map(quoted).join(" AND ")), exact: false },
15946
16009
  test: /* @__PURE__ */ __name((text6) => {
15947
16010
  const heading = normalize(text6.slice(0, Math.max(0, text6.indexOf("\n\n"))));
15948
- return operator === "phrase" ? heading.includes(wanted) : parts2.every((word) => new RegExp(`(^|[^\\p{L}\\p{N}])${word}`, "u").test(heading));
16011
+ return operator === "phrase" ? heading.includes(wanted) : parts2.every((word2) => new RegExp(`(^|[^\\p{L}\\p{N}])${word2}`, "u").test(heading));
15949
16012
  }, "test")
15950
16013
  };
15951
16014
  }, "subject");
@@ -15989,7 +16052,7 @@ var FIELD_COMPILERS = {
15989
16052
  subject
15990
16053
  };
15991
16054
 
15992
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
16055
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
15993
16056
  var placeOf = /* @__PURE__ */ __name((database) => {
15994
16057
  const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
15995
16058
  const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
@@ -16005,7 +16068,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
16005
16068
  };
16006
16069
  }, "placeOf");
16007
16070
 
16008
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
16071
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
16009
16072
  var DRAIN_ON_WRITE = 500;
16010
16073
  var METHOD = "rules";
16011
16074
  var telegramLink = /* @__PURE__ */ __name((database) => {
@@ -16168,7 +16231,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
16168
16231
  return queued.length;
16169
16232
  }, "drainMentions");
16170
16233
 
16171
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
16234
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
16172
16235
  var indexRow = /* @__PURE__ */ __name((database, name) => {
16173
16236
  const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
16174
16237
  if (!exists2)
@@ -16176,7 +16239,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
16176
16239
  return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
16177
16240
  }, "indexRow");
16178
16241
 
16179
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
16242
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
16180
16243
  var INDEX = "message_stems";
16181
16244
  var SETTING2 = "searchStemmers";
16182
16245
  var DRAIN_ON_WRITE2 = 500;
@@ -16298,7 +16361,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
16298
16361
  };
16299
16362
  }, "stemmerCache");
16300
16363
 
16301
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
16364
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
16302
16365
  var SQLITE_BUSY = 5;
16303
16366
  var pause = new Int32Array(new SharedArrayBuffer(4));
16304
16367
  var isBusy = /* @__PURE__ */ __name((error) => {
@@ -16393,7 +16456,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
16393
16456
  }
16394
16457
  }, "read");
16395
16458
 
16396
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
16459
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
16397
16460
  var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
16398
16461
  coalesce(CASE k.chunkable_type
16399
16462
  WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
@@ -16535,7 +16598,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
16535
16598
  }, "dropUnusedVectors");
16536
16599
  var dropAllUnusedVectors = /* @__PURE__ */ __name((database) => database.prepare("DELETE FROM embeddings WHERE NOT EXISTS (SELECT 1 FROM chunks k WHERE k.content_hash = embeddings.content_hash) RETURNING 1").all().length, "dropAllUnusedVectors");
16537
16600
 
16538
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
16601
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
16539
16602
  var accountPk = /* @__PURE__ */ __name(({ orm, now: now2 }, { provider, account, scope: scope3 }, name = null) => Number(orm.insert(accounts).values({ provider, externalId: account, name, scope: scope3 ?? "personal", createdAt: now2(), updatedAt: now2() }).onConflictDoUpdate({
16540
16603
  target: [accounts.provider, accounts.externalId],
16541
16604
  set: {
@@ -16644,7 +16707,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
16644
16707
  AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
16645
16708
  }, "dropOrphanPeople");
16646
16709
 
16647
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
16710
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
16648
16711
  var FOLDED = [
16649
16712
  { table: "tasks", column: "title" },
16650
16713
  { table: "tasks", column: "close_reason" },
@@ -16681,7 +16744,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
16681
16744
  return filled2;
16682
16745
  }, "fillFolded");
16683
16746
 
16684
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/history-skips.js
16747
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/history-skips.js
16685
16748
  var HISTORY_KEY = "$history";
16686
16749
  var objectOf = /* @__PURE__ */ __name((text6) => {
16687
16750
  if (typeof text6 !== "string")
@@ -16757,7 +16820,7 @@ var withoutHistory = /* @__PURE__ */ __name((metadata3) => {
16757
16820
  return rest;
16758
16821
  }, "withoutHistory");
16759
16822
 
16760
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
16823
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
16761
16824
  import { createHash as createHash3 } from "node:crypto";
16762
16825
  var CHUNK_CHARS = 1200;
16763
16826
  var CHUNK_OVERLAP = 150;
@@ -16784,8 +16847,8 @@ var splitText = /* @__PURE__ */ __name((text6, room, overlap3 = CHUNK_OVERLAP, c
16784
16847
  if (end >= text6.length)
16785
16848
  break;
16786
16849
  const back = Math.max(start + 1, end - overlap3);
16787
- const word = text6.slice(back, end).search(/\s\S/);
16788
- start = word === -1 ? back : back + word + 1;
16850
+ const word2 = text6.slice(back, end).search(/\s\S/);
16851
+ start = word2 === -1 ? back : back + word2 + 1;
16789
16852
  }
16790
16853
  return ranges2;
16791
16854
  }, "splitText");
@@ -16814,8 +16877,8 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
16814
16877
  if (carry === 0)
16815
16878
  return;
16816
16879
  const from2 = Math.max(0, member.text.length - carry);
16817
- const word = from2 === 0 ? 0 : member.text.slice(from2).search(/\s\S/) + 1;
16818
- const text6 = member.text.slice(from2 + Math.max(0, word)).trim();
16880
+ const word2 = from2 === 0 ? 0 : member.text.slice(from2).search(/\s\S/) + 1;
16881
+ const text6 = member.text.slice(from2 + Math.max(0, word2)).trim();
16819
16882
  if (!text6)
16820
16883
  return;
16821
16884
  open = [{ ...member, text: text6 }];
@@ -16862,14 +16925,14 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
16862
16925
  return chunks2;
16863
16926
  }, "cutChunks");
16864
16927
 
16865
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/search/task-signature.js
16928
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/search/task-signature.js
16866
16929
  var DAY = 864e5;
16867
16930
  var CURRENCY = [
16868
16931
  [/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
16869
16932
  [/^(€|eur|евро|euros?)$/u, "EUR"],
16870
16933
  [/^(\$|usd|долл.*|dollars?)$/u, "USD"]
16871
16934
  ];
16872
- var currencyOf = /* @__PURE__ */ __name((word) => word ? CURRENCY.find(([pattern]) => pattern.test(word))?.[1] ?? null : null, "currencyOf");
16935
+ var currencyOf2 = /* @__PURE__ */ __name((word2) => word2 ? CURRENCY.find(([pattern]) => pattern.test(word2))?.[1] ?? null : null, "currencyOf");
16873
16936
  var SEPARATORS2 = String.raw`[ \u00a0\u2009\u202f.,]`;
16874
16937
  var NUMBER2 = String.raw`\d{1,3}(?:${SEPARATORS2}\d{3})+(?:[.,]\d{1,2})?|\d+(?:[.,]\d+)?`;
16875
16938
  var AMOUNT = new RegExp(String.raw`(?<![\p{L}\p{N}])([$€₽])?\s?(${NUMBER2})(?:([кk])(?![\p{L}])|\s?(тыс\.?|тысяч\p{L}*))?(?![\p{N}])\s?(₽|руб\p{L}*\.?|р\.|р(?![\p{L}])|rub|eur|евро|€|\$|usd|долл\p{L}*|dollars?|euros?)?(?![\p{L}])`, "gu");
@@ -16885,7 +16948,7 @@ var amountsOf = /* @__PURE__ */ __name((text6) => {
16885
16948
  const thousands = (short ?? long) !== void 0;
16886
16949
  if (!before2 && !after2 && !thousands)
16887
16950
  continue;
16888
- found2.push({ value: amountValue(number3, thousands), currency: currencyOf(before2 ?? after2?.replace(/\.$/u, "")) });
16951
+ found2.push({ value: amountValue(number3, thousands), currency: currencyOf2(before2 ?? after2?.replace(/\.$/u, "")) });
16889
16952
  }
16890
16953
  return found2;
16891
16954
  }, "amountsOf");
@@ -16922,15 +16985,15 @@ var MONTHS = [
16922
16985
  /^(ноябр[ьяею]|nov(ember)?)$/u,
16923
16986
  /^(декабр[ьяею]|dec(ember)?)$/u
16924
16987
  ];
16925
- var monthIndex = /* @__PURE__ */ __name((word) => MONTHS.findIndex((month) => month.test(word)), "monthIndex");
16926
- var esMonth = /* @__PURE__ */ __name((word = "") => ES_MONTHS.findIndex((month) => new RegExp(`^${month}$`, "u").test(word)), "esMonth");
16988
+ var monthIndex = /* @__PURE__ */ __name((word2) => MONTHS.findIndex((month) => month.test(word2)), "monthIndex");
16989
+ var esMonth = /* @__PURE__ */ __name((word2 = "") => ES_MONTHS.findIndex((month) => new RegExp(`^${month}$`, "u").test(word2)), "esMonth");
16927
16990
  var dayOf = /* @__PURE__ */ __name((ms) => {
16928
16991
  const date3 = new Date(ms);
16929
16992
  return Math.floor(Date.UTC(date3.getFullYear(), date3.getMonth(), date3.getDate()) / DAY);
16930
16993
  }, "dayOf");
16931
16994
  var dateDay = /* @__PURE__ */ __name((year, month, day) => Math.floor(Date.UTC(year, month, day) / DAY), "dateDay");
16932
- var monthDate = /* @__PURE__ */ __name((year, word = "", day = "") => {
16933
- const month = monthIndex(word);
16995
+ var monthDate = /* @__PURE__ */ __name((year, word2 = "", day = "") => {
16996
+ const month = monthIndex(word2);
16934
16997
  return month < 0 || Number(day) > 31 ? void 0 : dateDay(year, month, Number(day));
16935
16998
  }, "monthDate");
16936
16999
  var nthDay = /* @__PURE__ */ __name((day, now2) => {
@@ -16942,8 +17005,8 @@ var monthEnd = /* @__PURE__ */ __name((now2) => {
16942
17005
  const date3 = new Date(now2 * DAY);
16943
17006
  return dateDay(date3.getUTCFullYear(), date3.getUTCMonth() + 1, 0);
16944
17007
  }, "monthEnd");
16945
- var nextWeekday = /* @__PURE__ */ __name((word, now2) => {
16946
- const target = Math.max(RU_WEEKDAYS.findIndex((stem) => word.startsWith(stem)), EN_WEEKDAYS.indexOf(word), ES_WEEKDAYS.indexOf(word));
17008
+ var nextWeekday = /* @__PURE__ */ __name((word2, now2) => {
17009
+ const target = Math.max(RU_WEEKDAYS.findIndex((stem) => word2.startsWith(stem)), EN_WEEKDAYS.indexOf(word2), ES_WEEKDAYS.indexOf(word2));
16947
17010
  let day = now2 + 1;
16948
17011
  while (new Date(day * DAY).getUTCDay() !== target)
16949
17012
  day++;
@@ -16988,7 +17051,7 @@ var dueDayOf = /* @__PURE__ */ __name((text6, createdMs) => {
16988
17051
  return best?.day ?? null;
16989
17052
  }, "dueDayOf");
16990
17053
 
16991
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
17054
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
16992
17055
  var DAY2 = 864e5;
16993
17056
  var STOP_WORDS = new Set([
16994
17057
  // Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
@@ -17011,7 +17074,7 @@ var STOP_WORDS = new Set([
17011
17074
  var joinDigitGroups = /* @__PURE__ */ __name((text6) => text6.replace(/(\d)[ \u00a0\u202f,](?=\d{3}(?!\d))/gu, "$1"), "joinDigitGroups");
17012
17075
  var taskWordsOf = /* @__PURE__ */ __name((text6) => normalize(joinDigitGroups(text6)), "taskWordsOf");
17013
17076
  var defaultStemmer = createStemmer(DEFAULT_STEMMERS);
17014
- var taskStemsOf = /* @__PURE__ */ __name((text6, stemmer) => new Set(stemmer.explain(joinDigitGroups(text6)).filter(({ word }) => !STOP_WORDS.has(normalize(word))).map(({ stem }) => stem)), "taskStemsOf");
17077
+ var taskStemsOf = /* @__PURE__ */ __name((text6, stemmer) => new Set(stemmer.explain(joinDigitGroups(text6)).filter(({ word: word2 }) => !STOP_WORDS.has(normalize(word2))).map(({ stem }) => stem)), "taskStemsOf");
17015
17078
  var trigramsOf = /* @__PURE__ */ __name((text6) => {
17016
17079
  const grams = /* @__PURE__ */ new Set();
17017
17080
  for (let at = 0; at + 3 <= text6.length; at++)
@@ -17092,7 +17155,7 @@ var LEVEL_REASONS = {
17092
17155
  amount: { equal: "same amount", different: "different amount" }
17093
17156
  };
17094
17157
  var weightOf = /* @__PURE__ */ __name((field4, level) => TASK_SIMILARITY_WEIGHTS[field4][level].weight, "weightOf");
17095
- var plural = /* @__PURE__ */ __name((count, word) => `${count} ${word}${count === 1 ? "" : "s"}`, "plural");
17158
+ var plural = /* @__PURE__ */ __name((count, word2) => `${count} ${word2}${count === 1 ? "" : "s"}`, "plural");
17096
17159
  var bandOf = /* @__PURE__ */ __name((score) => score >= TASK_SIMILARITY_BANDS.likely ? "likely" : score >= TASK_SIMILARITY_BANDS.maybe ? "maybe" : "different", "bandOf");
17097
17160
  var compareTasks = /* @__PURE__ */ __name((a, b, { replyChain = false } = {}) => {
17098
17161
  const stems = overlap(a.stems, b.stems);
@@ -17143,7 +17206,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
17143
17206
  ...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
17144
17207
  })).sort((a, b) => b.score - a.score), "rankCandidates");
17145
17208
 
17146
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
17209
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
17147
17210
  var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
17148
17211
  r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
17149
17212
  JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
@@ -17414,7 +17477,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
17414
17477
  };
17415
17478
  }, "readiness");
17416
17479
 
17417
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
17480
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
17418
17481
  var DOCUMENT_PICTURE = "document_picture";
17419
17482
  var SCAN_PAGE2 = 5e3;
17420
17483
  var idOf = /* @__PURE__ */ __name((ref3) => {
@@ -17477,7 +17540,7 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
17477
17540
  }, "nearestPictures")
17478
17541
  }), "documentPicturesOver");
17479
17542
 
17480
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
17543
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
17481
17544
  var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
17482
17545
  const literal4 = escaped2 ?? plain2 ?? "";
17483
17546
  return wildcard ?? (/[*?[]/u.test(literal4) ? `[${literal4}]` : literal4);
@@ -17542,7 +17605,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
17542
17605
  var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
17543
17606
  var bound2 = /* @__PURE__ */ __name(({ sql: text6, params }) => sql.join(text6.split("?").map((part, at) => at < params.length ? sql`${sql.raw(part)}${params[at]}` : sql.raw(part)), sql``), "bound");
17544
17607
 
17545
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
17608
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
17546
17609
  var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
17547
17610
  var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
17548
17611
  var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
@@ -17632,7 +17695,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
17632
17695
  });
17633
17696
  }, "linkMeeting");
17634
17697
 
17635
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
17698
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
17636
17699
  var EVENT_TEXT = "trim(coalesce(e.description, '') || ' ' || coalesce(e.location, '') || ' ' || coalesce((SELECT group_concat(p.name, ' ') FROM calendar_entries ce JOIN calendar_entry_participants p ON p.entry_id = ce.id WHERE ce.event_id = e.id AND ce.deleted_at IS NULL AND p.resource = 0 AND p.name IS NOT NULL), ''))";
17637
17700
  var UNSEARCHED_EVENT_TYPES = [
17638
17701
  "working-location",
@@ -17752,12 +17815,12 @@ var corpusIndexState = /* @__PURE__ */ __name((database, corpus) => {
17752
17815
  }, "corpusIndexState");
17753
17816
  var noteIndexState = /* @__PURE__ */ __name((database) => {
17754
17817
  const documents2 = corpusIndexState(database, CORPORA.document);
17755
- const notes3 = corpusIndexState(database, CORPORA.note);
17818
+ const notes2 = corpusIndexState(database, CORPORA.note);
17756
17819
  return {
17757
- pending: documents2.pending + notes3.pending,
17758
- built: notes3.built ?? documents2.built,
17759
- wanted: notes3.wanted,
17760
- ready: documents2.ready && notes3.ready
17820
+ pending: documents2.pending + notes2.pending,
17821
+ built: notes2.built ?? documents2.built,
17822
+ wanted: notes2.wanted,
17823
+ ready: documents2.ready && notes2.ready
17761
17824
  };
17762
17825
  }, "noteIndexState");
17763
17826
  var storedSections = /* @__PURE__ */ __name((metadata3) => {
@@ -17862,7 +17925,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
17862
17925
  return true;
17863
17926
  }, "resetNoteIndex");
17864
17927
 
17865
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
17928
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
17866
17929
  var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
17867
17930
  var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
17868
17931
  for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
@@ -17881,7 +17944,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
17881
17944
  }
17882
17945
  }, "resolvePersonLinks");
17883
17946
 
17884
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
17947
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
17885
17948
  var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
17886
17949
  var prepare = /* @__PURE__ */ __name((orm) => ({
17887
17950
  find: orm.select({
@@ -18023,14 +18086,14 @@ var people = /* @__PURE__ */ __name(({ orm, database }, provider, { account, acc
18023
18086
  const byId2 = new Map(everyone.map((person2) => [person2.id, person2]));
18024
18087
  return { provider, get: /* @__PURE__ */ __name((id2) => byId2.get(id2), "get"), all: /* @__PURE__ */ __name(() => everyone, "all") };
18025
18088
  }, "people");
18026
- var contactsWhere = /* @__PURE__ */ __name((accountKey, key2, { query, notes: notes3 }) => {
18089
+ var contactsWhere = /* @__PURE__ */ __name((accountKey, key2, { query, notes: notes2 }) => {
18027
18090
  if (query !== void 0 && query.trim().length < 3) {
18028
18091
  throw new CliError("validation_error", `a contact search takes at least 3 characters, got "${query}"`);
18029
18092
  }
18030
- const noted = notes3 === void 0 ? void 0 : holdingText("note", "n.id", notes3);
18093
+ const noted = notes2 === void 0 ? void 0 : holdingText("note", "n.id", notes2);
18031
18094
  return and(eq(accountIdentities.accountId, accountKey), ne(identities.externalId, key2.account), sql`EXISTS (SELECT 1 FROM ${chatMembers} JOIN ${chats} ON ${chats.id} = ${chatMembers.chatId}
18032
18095
  WHERE ${chatMembers.identityId} = ${identities.id} AND ${chats.accountId} = ${accountIdentities.accountId}
18033
- AND ${chats.kind} = 'dialog')`, query === void 0 ? void 0 : sql`(${identities.id} IN (SELECT rowid FROM identities_fts WHERE identities_fts MATCH ${`"${query.trim().replaceAll('"', '""')}"`}) OR EXISTS (SELECT 1 FROM aliases ca WHERE ca.aliasable_type='identity' AND ca.display=1 AND ca.account_id=${accountKey} AND ca.aliasable_id=${identities.id} AND instr(ca.name_folded, ${fold(query.trim())}) > 0))`, notes3 === void 0 ? void 0 : sql`EXISTS (SELECT 1 FROM notes n WHERE n.notable_type='identity' AND n.notable_id=${identities.id} AND n.deleted_at IS NULL${noted ? sql` AND ${bound2(noted)}` : sql``})`);
18096
+ AND ${chats.kind} = 'dialog')`, query === void 0 ? void 0 : sql`(${identities.id} IN (SELECT rowid FROM identities_fts WHERE identities_fts MATCH ${`"${query.trim().replaceAll('"', '""')}"`}) OR EXISTS (SELECT 1 FROM aliases ca WHERE ca.aliasable_type='identity' AND ca.display=1 AND ca.account_id=${accountKey} AND ca.aliasable_id=${identities.id} AND instr(ca.name_folded, ${fold(query.trim())}) > 0))`, notes2 === void 0 ? void 0 : sql`EXISTS (SELECT 1 FROM notes n WHERE n.notable_type='identity' AND n.notable_id=${identities.id} AND n.deleted_at IS NULL${noted ? sql` AND ${bound2(noted)}` : sql``})`);
18034
18097
  }, "contactsWhere");
18035
18098
  var contacts = /* @__PURE__ */ __name(({ orm }, accountKey, key2, { order, limit, offset = 0, ...filter }) => {
18036
18099
  const byName = [
@@ -18106,7 +18169,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
18106
18169
  }, "meetingIdentityPk");
18107
18170
  var phoneOf = /* @__PURE__ */ __name(({ orm }, provider, nativeId) => orm.select({ phone: identities.phone }).from(identities).where(and(eq(identities.provider, provider), eq(identities.externalId, nativeId))).get()?.phone ?? null, "phoneOf");
18108
18171
 
18109
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
18172
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
18110
18173
  var chatOf = /* @__PURE__ */ __name(({ orm }, accountKey, chatKey) => orm.select({ id: chats.externalId }).from(chats).where(and(eq(chats.id, chatKey), eq(chats.accountId, accountKey))).get()?.id, "chatOf");
18111
18174
  var findChatPk = /* @__PURE__ */ __name(({ orm }, accountKey, chatId) => orm.select({ pk: chats.id }).from(chats).where(and(eq(chats.accountId, accountKey), eq(chats.externalId, chatId))).get()?.pk, "findChatPk");
18112
18175
  var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
@@ -18386,7 +18449,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
18386
18449
  }
18387
18450
  }, "replaceAutoTags");
18388
18451
 
18389
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/counters.js
18452
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/counters.js
18390
18453
  var COUNTER_FIELDS = ["views", "reactions", "comments"];
18391
18454
  var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
18392
18455
  var counterObservationTime = /* @__PURE__ */ __name((observation, now2) => {
@@ -18405,7 +18468,7 @@ var counterFreshness = /* @__PURE__ */ __name((states) => {
18405
18468
  return states.some((one2) => one2.freshness === "stale") ? "stale" : "fresh";
18406
18469
  }, "counterFreshness");
18407
18470
 
18408
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/context/evidence.js
18471
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/context/evidence.js
18409
18472
  import { createHash as createHash4 } from "node:crypto";
18410
18473
  var CONTEXT_MAX_READ_BYTES = 262144;
18411
18474
  var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
@@ -18503,7 +18566,7 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
18503
18566
  return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
18504
18567
  }, "contextEvidenceRequest");
18505
18568
 
18506
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/email-activity.js
18569
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/email-activity.js
18507
18570
  var MAIL_AGENDA_COLUMNS = { chat_kind: { type: "enum", sql: "'dialog'" } };
18508
18571
  var ACTIVITY = `
18509
18572
  SELECT t.external_id AS thread, t.subject, t.last_email_at, t.emails_count,
@@ -18619,7 +18682,7 @@ var mailActivity = /* @__PURE__ */ __name((database) => ({
18619
18682
  threadActivity: /* @__PURE__ */ __name(async (accountId, since, where) => threadActivity(database, accountId, since, where), "threadActivity")
18620
18683
  }), "mailActivity");
18621
18684
 
18622
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
18685
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
18623
18686
  var GREETING = new RegExp("^(hi|hello|hey|dear|greetings|good (morning|afternoon|evening)|\u043F\u0440\u0438\u0432\u0435\u0442|\u0437\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439(\u0442\u0435)?|\u0434\u043E\u0431\u0440(\u044B\u0439|\u043E\u0435|\u043E\u0433\u043E) (\u0434\u0435\u043D\u044C|\u0432\u0435\u0447\u0435\u0440|\u0443\u0442\u0440\u043E|\u0443\u0442\u0440\u0430|\u0434\u043D\u044F)|hola|buen(os|as) (d\xEDas|dias|tardes|noches)|estimad[oa]s?|querid[oa]s?)(?![\\p{L}\\p{N}])([\\s,]+\\p{L}[\\p{L}.'\u2019-]*){0,3}\\s*[,!.:]?$", "iu");
18624
18687
  var SIGN_OFF = /^(best|best regards|best wishes|kind regards|warm regards|regards|thanks|thanks again|thanks a lot|thank you|many thanks|cheers|sincerely|yours|yours truly|yours sincerely|br|с уважением|спасибо|заранее спасибо|всего доброго|всего хорошего|un saludo|saludos|saludos cordiales|atentamente|gracias|muchas gracias)[\s,.!]*$/iu;
18625
18688
  var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
@@ -18760,7 +18823,7 @@ var mailOwnText = /* @__PURE__ */ __name((body2) => {
18760
18823
  return text6 || body2.trim();
18761
18824
  }, "mailOwnText");
18762
18825
 
18763
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
18826
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
18764
18827
  var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
18765
18828
  var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
18766
18829
  k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
@@ -18870,7 +18933,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
18870
18933
  return emails3 + threads;
18871
18934
  }, "drainEmailIndex");
18872
18935
 
18873
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
18936
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
18874
18937
  var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
18875
18938
  SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
18876
18939
  var folderEmails = /* @__PURE__ */ __name((database, accountId, folder, uidvalidity) => database.prepare(`SELECT l.uid, e.external_id, coalesce(e.received_at, e.sent_at) AS at, e.read, e.flagged,
@@ -18968,7 +19031,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
18968
19031
  var backfillSentAt = /* @__PURE__ */ __name((database, accountId, limit) => Number(database.prepare(`UPDATE emails SET sent_at = received_at WHERE id IN (
18969
19032
  SELECT id FROM emails WHERE account_id = ? AND sent_at IS NULL AND received_at IS NOT NULL LIMIT ?)`).run(accountId, limit).changes), "backfillSentAt");
18970
19033
 
18971
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
19034
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
18972
19035
  var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
18973
19036
  emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
18974
19037
  last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
@@ -19018,7 +19081,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
19018
19081
  return threads.length;
19019
19082
  }, "markEmailsRestored");
19020
19083
 
19021
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
19084
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
19022
19085
  var sorted = /* @__PURE__ */ __name((value) => Array.isArray(value) ? value.map(sorted) : value !== null && typeof value === "object" ? Object.fromEntries(Object.keys(value).sort().map((key2) => [key2, sorted(value[key2])])) : value, "sorted");
19023
19086
  var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
19024
19087
  var ruleOf = /* @__PURE__ */ __name((row2) => ({
@@ -19085,7 +19148,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
19085
19148
  }
19086
19149
  }), "mailRulesOver");
19087
19150
 
19088
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
19151
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
19089
19152
  var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
19090
19153
  database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
19091
19154
  VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
@@ -19093,7 +19156,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
19093
19156
  reason = excluded.reason, updated_at = excluded.updated_at WHERE link_reviews.status = 'open'`).run(linkable.type, linkable.id, entity, JSON.stringify([...candidates].sort((a, b) => a - b)), reason, now2, now2);
19094
19157
  }, "reviewLink");
19095
19158
 
19096
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
19159
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
19097
19160
  function checkMeetingCancelled(signal) {
19098
19161
  if (!signal?.aborted)
19099
19162
  return;
@@ -19104,7 +19167,7 @@ function checkMeetingCancelled(signal) {
19104
19167
  }
19105
19168
  __name(checkMeetingCancelled, "checkMeetingCancelled");
19106
19169
 
19107
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
19170
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
19108
19171
  var meetingOf = /* @__PURE__ */ __name((row2) => ({
19109
19172
  id: Number(row2.id),
19110
19173
  accountId: Number(row2.account_id),
@@ -19154,7 +19217,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
19154
19217
  createdAt: Number(row2.created_at)
19155
19218
  }), "transcriptRowOf");
19156
19219
 
19157
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
19220
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
19158
19221
  var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
19159
19222
  var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
19160
19223
  var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
@@ -19321,7 +19384,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
19321
19384
  }
19322
19385
  }), "meetingReadsOver");
19323
19386
 
19324
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
19387
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
19325
19388
  var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
19326
19389
  const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
19327
19390
  const params = [input.accountId];
@@ -19364,7 +19427,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
19364
19427
  return { clauses, params };
19365
19428
  }, "meetingSelectionSql");
19366
19429
 
19367
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
19430
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
19368
19431
  var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
19369
19432
  async meetingChatLines(input) {
19370
19433
  checkMeetingCancelled(input.signal);
@@ -19392,7 +19455,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
19392
19455
  }
19393
19456
  }), "meetingChatLinesOver");
19394
19457
 
19395
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
19458
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
19396
19459
  var MESSAGE_FIELDS = {
19397
19460
  pk: messages.id,
19398
19461
  nativeId: messages.externalId,
@@ -19563,7 +19626,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
19563
19626
  storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
19564
19627
  }), "chatActivity");
19565
19628
 
19566
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
19629
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
19567
19630
  var HIT_FIELDS = {
19568
19631
  ...MESSAGE_FIELDS,
19569
19632
  chatTitle: sql`${chats.title}`.as("chat_title"),
@@ -19571,10 +19634,10 @@ var HIT_FIELDS = {
19571
19634
  accountNativeId: sql`${accounts.externalId}`.as("account_native_id")
19572
19635
  };
19573
19636
  var wordsOf2 = /* @__PURE__ */ __name((text6) => {
19574
- const words3 = (text6.match(/[\p{L}\p{N}]+/gu) ?? []).filter((word) => [...word].length >= 3);
19637
+ const words3 = (text6.match(/[\p{L}\p{N}]+/gu) ?? []).filter((word2) => [...word2].length >= 3);
19575
19638
  if (words3.length === 0)
19576
19639
  throw new CliError("validation_error", "search needs a word of three letters or more");
19577
- return words3.map((word) => `"${word}"`).join(" ");
19640
+ return words3.map((word2) => `"${word2}"`).join(" ");
19578
19641
  }, "wordsOf");
19579
19642
  var matching = /* @__PURE__ */ __name((context, { provider, account, accounts: within, senders, together = false, text: text6, chatId }) => {
19580
19643
  const trimmed = text6?.trim();
@@ -19662,7 +19725,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
19662
19725
  };
19663
19726
  }, "directReplies");
19664
19727
 
19665
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
19728
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
19666
19729
  var identityRow = /* @__PURE__ */ __name(({ orm }, { provider, id: id2 }) => orm.select({ pk: identities.id, personPk: identityLinks.personId }).from(identities).innerJoin(identityLinks, eq(identityLinks.identityId, identities.id)).where(and(eq(identities.provider, provider), eq(identities.externalId, id2))).get(), "identityRow");
19667
19730
  var required = /* @__PURE__ */ __name((context, ref3) => {
19668
19731
  const found2 = identityRow(context, ref3);
@@ -19793,7 +19856,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
19793
19856
  }, "mentioning");
19794
19857
  var escaped = /* @__PURE__ */ __name((text6) => text6.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
19795
19858
 
19796
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
19859
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
19797
19860
  var missing2 = /* @__PURE__ */ __name(() => {
19798
19861
  throw new CliError("not_found", "Meeting, participant or selected target not found");
19799
19862
  }, "missing");
@@ -19915,7 +19978,7 @@ function meetingContextLinksOver(context) {
19915
19978
  }
19916
19979
  __name(meetingContextLinksOver, "meetingContextLinksOver");
19917
19980
 
19918
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
19981
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
19919
19982
  var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
19920
19983
  var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
19921
19984
  var summaryOf = /* @__PURE__ */ __name((row2) => ({
@@ -19944,7 +20007,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
19944
20007
  return row2 ? summaryText(summaryOf(row2)) : null;
19945
20008
  }, "indexedText");
19946
20009
 
19947
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
20010
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
19948
20011
  var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
19949
20012
  var meetingCurrentIndexRows = `
19950
20013
  SELECT 'meeting_transcript_row' AS indexable_type,r.id,r.id*4+1 AS rid,1 AS live,coalesce(length(CAST(r.text AS BLOB)),0) AS bytes FROM meeting_transcript_rows r JOIN meeting_transcripts t ON t.id=r.meeting_transcript_id JOIN meetings m ON m.id=t.meeting_id WHERE m.account_id=? AND m.deleted_at IS NULL AND t.deleted_at IS NULL AND t.superseded_at IS NULL
@@ -19975,7 +20038,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
19975
20038
  }, "invalidateMeetingStems");
19976
20039
  var meetingStemmableText = /* @__PURE__ */ __name((text6) => text6.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
19977
20040
 
19978
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
20041
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
19979
20042
  function meetingHitIndexOver({ database, now: now2 }) {
19980
20043
  return {
19981
20044
  async indexSearch(original) {
@@ -20043,10 +20106,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
20043
20106
  }
20044
20107
  __name(meetingHitIndexOver, "meetingHitIndexOver");
20045
20108
 
20046
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
20109
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
20047
20110
  import { createHash as createHash5 } from "node:crypto";
20048
20111
 
20049
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/search/trigrams.js
20112
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/search/trigrams.js
20050
20113
  var trigrams = /* @__PURE__ */ __name((term) => {
20051
20114
  const padded = ` ${term} `;
20052
20115
  const pieces = /* @__PURE__ */ new Set();
@@ -20055,9 +20118,9 @@ var trigrams = /* @__PURE__ */ __name((term) => {
20055
20118
  return [...pieces];
20056
20119
  }, "trigrams");
20057
20120
 
20058
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/search/correct.js
20121
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/search/correct.js
20059
20122
  var SHORTEST_CORRECTION = 3;
20060
- var maxEdits = /* @__PURE__ */ __name((word) => word.length <= 4 ? 1 : 2, "maxEdits");
20123
+ var maxEdits = /* @__PURE__ */ __name((word2) => word2.length <= 4 ? 1 : 2, "maxEdits");
20061
20124
  var editDistance = /* @__PURE__ */ __name((a, b, max) => {
20062
20125
  if (Math.abs(a.length - b.length) > max)
20063
20126
  return max + 1;
@@ -20086,14 +20149,14 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
20086
20149
  const corrections = /* @__PURE__ */ new Map();
20087
20150
  const known2 = await vocabulary.knownTerms(words3);
20088
20151
  for (const typed of words3) {
20089
- const word = normalize(typed);
20090
- if (known2.has(typed) || /^\d*$/.test(word))
20152
+ const word2 = normalize(typed);
20153
+ if (known2.has(typed) || /^\d*$/.test(word2))
20091
20154
  continue;
20092
- const max = maxEdits(word);
20093
- const near2 = (await vocabulary.termCandidates(trigrams(word), {
20094
- shortest: Math.max(SHORTEST_CORRECTION, word.length - max),
20095
- longest: word.length + max
20096
- })).map((candidate) => ({ ...candidate, distance: editDistance(word, candidate.term, max) })).filter((candidate) => candidate.distance <= max);
20155
+ const max = maxEdits(word2);
20156
+ const near2 = (await vocabulary.termCandidates(trigrams(word2), {
20157
+ shortest: Math.max(SHORTEST_CORRECTION, word2.length - max),
20158
+ longest: word2.length + max
20159
+ })).map((candidate) => ({ ...candidate, distance: editDistance(word2, candidate.term, max) })).filter((candidate) => candidate.distance <= max);
20097
20160
  if (near2.length === 0)
20098
20161
  continue;
20099
20162
  const nearest2 = Math.min(...near2.map((candidate) => candidate.distance));
@@ -20102,10 +20165,10 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
20102
20165
  return corrections;
20103
20166
  }, "correctWords");
20104
20167
 
20105
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/search/garbled.js
20168
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/search/garbled.js
20106
20169
  var SHORTEST_GARBLED = 4;
20107
20170
  var MOST_WIDENED = 64;
20108
- var plain = /* @__PURE__ */ __name((word) => word.replaceAll("\u044D", "\u0435"), "plain");
20171
+ var plain = /* @__PURE__ */ __name((word2) => word2.replaceAll("\u044D", "\u0435"), "plain");
20109
20172
  var russian = createStemmer({ cyrillic: "russian", latin: "none" }, { cacheLimit: 1e4 });
20110
20173
  var NUMBER_STEMS = new Set(`\u043D\u043E\u043B\u044C \u043D\u0443\u043B\u044C \u043E\u0434\u0438\u043D \u043E\u0434\u043D\u0430 \u043E\u0434\u043D\u043E \u043E\u0434\u043D\u043E\u0433\u043E \u043E\u0434\u043D\u043E\u0439 \u043E\u0434\u043D\u043E\u043C\u0443 \u043E\u0434\u043D\u0438\u043C \u043E\u0434\u043D\u043E\u043C \u043E\u0434\u043D\u0443 \u0434\u0432\u0430 \u0434\u0432\u0435 \u0434\u0432\u0443\u0445 \u0434\u0432\u0443\u043C \u0434\u0432\u0443\u043C\u044F \u0442\u0440\u0438 \u0442\u0440\u0435\u0445 \u0442\u0440\u0435\u043C \u0442\u0440\u0435\u043C\u044F
20111
20174
  \u0447\u0435\u0442\u044B\u0440\u0435 \u0447\u0435\u0442\u044B\u0440\u0435\u0445 \u0447\u0435\u0442\u044B\u0440\u0435\u043C \u0447\u0435\u0442\u044B\u0440\u044C\u043C\u044F \u043F\u044F\u0442\u044C \u043F\u044F\u0442\u0438 \u043F\u044F\u0442\u044C\u044E \u0448\u0435\u0441\u0442\u044C \u0448\u0435\u0441\u0442\u0438 \u0448\u0435\u0441\u0442\u044C\u044E \u0441\u0435\u043C\u044C \u0441\u0435\u043C\u0438 \u0441\u0435\u043C\u044C\u044E \u0432\u043E\u0441\u0435\u043C\u044C \u0432\u043E\u0441\u044C\u043C\u0438 \u0432\u043E\u0441\u0435\u043C\u044C\u044E
@@ -20114,17 +20177,17 @@ var NUMBER_STEMS = new Set(`\u043D\u043E\u043B\u044C \u043D\u0443\u043B\u044C \u
20114
20177
  \u043F\u044F\u0442\u0438\u0434\u0435\u0441\u044F\u0442\u0438 \u0448\u0435\u0441\u0442\u044C\u0434\u0435\u0441\u044F\u0442 \u0448\u0435\u0441\u0442\u0438\u0434\u0435\u0441\u044F\u0442\u0438 \u0441\u0435\u043C\u044C\u0434\u0435\u0441\u044F\u0442 \u0441\u0435\u043C\u0438\u0434\u0435\u0441\u044F\u0442\u0438 \u0432\u043E\u0441\u0435\u043C\u044C\u0434\u0435\u0441\u044F\u0442 \u0432\u043E\u0441\u044C\u043C\u0438\u0434\u0435\u0441\u044F\u0442\u0438 \u0434\u0435\u0432\u044F\u043D\u043E\u0441\u0442\u043E \u0434\u0435\u0432\u044F\u043D\u043E\u0441\u0442\u0430 \u0441\u0442\u043E \u0441\u0442\u0430
20115
20178
  \u0434\u0432\u0435\u0441\u0442\u0438 \u0434\u0432\u0443\u0445\u0441\u043E\u0442 \u0442\u0440\u0438\u0441\u0442\u0430 \u0442\u0440\u0435\u0445\u0441\u043E\u0442 \u0447\u0435\u0442\u044B\u0440\u0435\u0441\u0442\u0430 \u0447\u0435\u0442\u044B\u0440\u0435\u0445\u0441\u043E\u0442 \u043F\u044F\u0442\u044C\u0441\u043E\u0442 \u043F\u044F\u0442\u0438\u0441\u043E\u0442 \u0448\u0435\u0441\u0442\u044C\u0441\u043E\u0442 \u0441\u0435\u043C\u044C\u0441\u043E\u0442 \u0432\u043E\u0441\u0435\u043C\u044C\u0441\u043E\u0442 \u0434\u0435\u0432\u044F\u0442\u044C\u0441\u043E\u0442
20116
20179
  \u0442\u044B\u0441\u044F\u0447\u0430 \u0442\u044B\u0441\u044F\u0447\u0438 \u0442\u044B\u0441\u044F\u0447 \u043C\u0438\u043B\u043B\u0438\u043E\u043D \u043C\u0438\u043B\u043B\u0438\u043E\u043D\u0430 \u043C\u0438\u043B\u043B\u0438\u043E\u043D\u043E\u0432 \u043C\u0438\u043B\u043B\u0438\u0430\u0440\u0434 \u043F\u0435\u0440\u0432\u044B\u0439 \u0432\u0442\u043E\u0440\u043E\u0439 \u0442\u0440\u0435\u0442\u0438\u0439 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044B\u0439 \u043F\u044F\u0442\u044B\u0439 \u0448\u0435\u0441\u0442\u043E\u0439 \u0441\u0435\u0434\u044C\u043C\u043E\u0439
20117
- \u0432\u043E\u0441\u044C\u043C\u043E\u0439 \u0434\u0435\u0432\u044F\u0442\u044B\u0439 \u0434\u0435\u0441\u044F\u0442\u044B\u0439 \u0441\u043E\u0442\u044B\u0439 \u0442\u044B\u0441\u044F\u0447\u043D\u044B\u0439 \u043F\u043E\u043B\u043E\u0432\u0438\u043D\u0430 \u0442\u0440\u0435\u0442\u044C \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044C`.split(/\s+/).map((word) => russian.stemToken(word)));
20118
- var isNumberWord = /* @__PURE__ */ __name((word) => /\d/.test(word) || NUMBER_STEMS.has(russian.stemToken(word)), "isNumberWord");
20180
+ \u0432\u043E\u0441\u044C\u043C\u043E\u0439 \u0434\u0435\u0432\u044F\u0442\u044B\u0439 \u0434\u0435\u0441\u044F\u0442\u044B\u0439 \u0441\u043E\u0442\u044B\u0439 \u0442\u044B\u0441\u044F\u0447\u043D\u044B\u0439 \u043F\u043E\u043B\u043E\u0432\u0438\u043D\u0430 \u0442\u0440\u0435\u0442\u044C \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044C`.split(/\s+/).map((word2) => russian.stemToken(word2)));
20181
+ var isNumberWord = /* @__PURE__ */ __name((word2) => /\d/.test(word2) || NUMBER_STEMS.has(russian.stemToken(word2)), "isNumberWord");
20119
20182
  var LOOSE_START = 7;
20120
- var plainMatch = /* @__PURE__ */ __name((probe, word, stems) => word.startsWith(probe.literal) || stems.some((stem) => probe.stems.includes(stem)), "plainMatch");
20121
- var garbledDistance = /* @__PURE__ */ __name((probe, word, stems) => {
20122
- if (probe.literal.length < SHORTEST_GARBLED || plainMatch(probe, word, stems))
20183
+ var plainMatch = /* @__PURE__ */ __name((probe, word2, stems) => word2.startsWith(probe.literal) || stems.some((stem) => probe.stems.includes(stem)), "plainMatch");
20184
+ var garbledDistance = /* @__PURE__ */ __name((probe, word2, stems) => {
20185
+ if (probe.literal.length < SHORTEST_GARBLED || plainMatch(probe, word2, stems))
20123
20186
  return null;
20124
- if (isNumberWord(probe.literal) || isNumberWord(word))
20187
+ if (isNumberWord(probe.literal) || isNumberWord(word2))
20125
20188
  return null;
20126
20189
  const literal4 = plain(probe.literal);
20127
- const stored3 = plain(word);
20190
+ const stored3 = plain(word2);
20128
20191
  let best = null;
20129
20192
  for (const queryStem of probe.stems.map(plain))
20130
20193
  for (const wordStem of stems.map(plain)) {
@@ -20144,16 +20207,16 @@ var garbledDistance = /* @__PURE__ */ __name((probe, word, stems) => {
20144
20207
  return 1;
20145
20208
  return best;
20146
20209
  }, "garbledDistance");
20147
- var prefixDistance = /* @__PURE__ */ __name((stem, word, max) => {
20148
- let before2 = new Int32Array(word.length + 1);
20149
- let previous = new Int32Array(word.length + 1);
20150
- let current = new Int32Array(word.length + 1);
20210
+ var prefixDistance = /* @__PURE__ */ __name((stem, word2, max) => {
20211
+ let before2 = new Int32Array(word2.length + 1);
20212
+ let previous = new Int32Array(word2.length + 1);
20213
+ let current = new Int32Array(word2.length + 1);
20151
20214
  for (let i = 1; i <= stem.length; i++) {
20152
20215
  current[0] = i;
20153
20216
  let lowest = i;
20154
- for (let j = 1; j <= word.length; j++) {
20155
- let value = Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + (stem[i - 1] === word[j - 1] ? 0 : 1));
20156
- if (i > 1 && j > 1 && stem[i - 1] === word[j - 2] && stem[i - 2] === word[j - 1])
20217
+ for (let j = 1; j <= word2.length; j++) {
20218
+ let value = Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + (stem[i - 1] === word2[j - 1] ? 0 : 1));
20219
+ if (i > 1 && j > 1 && stem[i - 1] === word2[j - 2] && stem[i - 2] === word2[j - 1])
20157
20220
  value = Math.min(value, before2[j - 2] + 1);
20158
20221
  current[j] = value;
20159
20222
  lowest = Math.min(lowest, value);
@@ -20164,8 +20227,8 @@ var prefixDistance = /* @__PURE__ */ __name((stem, word, max) => {
20164
20227
  }
20165
20228
  return previous.reduce((lowest, value) => Math.min(lowest, value), max + 1);
20166
20229
  }, "prefixDistance");
20167
- var worthStemming = /* @__PURE__ */ __name((probe, word) => {
20168
- const stored3 = plain(word);
20230
+ var worthStemming = /* @__PURE__ */ __name((probe, word2) => {
20231
+ const stored3 = plain(word2);
20169
20232
  if (stored3.length >= SHORTEST_GARBLED && plain(probe.literal).startsWith(stored3))
20170
20233
  return true;
20171
20234
  return probe.stems.some((raw) => {
@@ -20180,21 +20243,21 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
20180
20243
  const live2 = probes.map((probe) => probe.literal.length >= SHORTEST_GARBLED);
20181
20244
  if (!live2.some(Boolean))
20182
20245
  return probes.map(() => []);
20183
- for (const { term: word, docs } of vocabulary) {
20246
+ for (const { term: word2, docs } of vocabulary) {
20184
20247
  let stems;
20185
20248
  probes.forEach((probe, at) => {
20186
- if (!live2[at] || !worthStemming(probe, word))
20249
+ if (!live2[at] || !worthStemming(probe, word2))
20187
20250
  return;
20188
- stems ??= stem(word);
20189
- const distance2 = garbledDistance(probe, word, stems);
20190
- if (distance2 === 0 || distance2 === 1 && !known2(word))
20191
- found2[at]?.push({ term: word, docs, distance: distance2 });
20251
+ stems ??= stem(word2);
20252
+ const distance2 = garbledDistance(probe, word2, stems);
20253
+ if (distance2 === 0 || distance2 === 1 && !known2(word2))
20254
+ found2[at]?.push({ term: word2, docs, distance: distance2 });
20192
20255
  });
20193
20256
  }
20194
- return found2.map((words3) => words3.sort((a, b) => a.distance - b.distance || b.docs - a.docs || a.term.localeCompare(b.term)).slice(0, MOST_WIDENED).map((word) => word.term));
20257
+ return found2.map((words3) => words3.sort((a, b) => a.distance - b.distance || b.docs - a.docs || a.term.localeCompare(b.term)).slice(0, MOST_WIDENED).map((word2) => word2.term));
20195
20258
  }, "widenWords");
20196
20259
 
20197
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
20260
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
20198
20261
  import { readFileSync } from "node:fs";
20199
20262
  var loaded;
20200
20263
  var dictionary = /* @__PURE__ */ __name(() => {
@@ -20206,8 +20269,8 @@ var dictionary = /* @__PURE__ */ __name(() => {
20206
20269
  const [entry2, flags = ""] = line.trim().split("/");
20207
20270
  if (!entry2)
20208
20271
  continue;
20209
- const word = entry2.toLowerCase();
20210
- stems.set(word, (stems.get(word) ?? "") + flags);
20272
+ const word2 = entry2.toLowerCase();
20273
+ stems.set(word2, (stems.get(word2) ?? "") + flags);
20211
20274
  }
20212
20275
  const suffixes = /* @__PURE__ */ new Map();
20213
20276
  let longest = 0;
@@ -20228,35 +20291,35 @@ var dictionary = /* @__PURE__ */ __name(() => {
20228
20291
  loaded = { stems, suffixes, longest };
20229
20292
  return loaded;
20230
20293
  }, "dictionary");
20231
- var spelled = /* @__PURE__ */ __name((word) => {
20294
+ var spelled = /* @__PURE__ */ __name((word2) => {
20232
20295
  const { stems, suffixes, longest } = dictionary();
20233
- if (stems.has(word))
20296
+ if (stems.has(word2))
20234
20297
  return true;
20235
- for (let cut2 = 0; cut2 <= Math.min(word.length - 1, longest); cut2++)
20236
- for (const rule of suffixes.get(word.slice(word.length - cut2)) ?? []) {
20237
- const stem = word.slice(0, word.length - cut2) + rule.strip;
20298
+ for (let cut2 = 0; cut2 <= Math.min(word2.length - 1, longest); cut2++)
20299
+ for (const rule of suffixes.get(word2.slice(word2.length - cut2)) ?? []) {
20300
+ const stem = word2.slice(0, word2.length - cut2) + rule.strip;
20238
20301
  if (stems.get(stem)?.includes(rule.flag) && rule.condition.test(stem))
20239
20302
  return true;
20240
20303
  }
20241
20304
  return false;
20242
20305
  }, "spelled");
20243
- var knownRussianWord = /* @__PURE__ */ __name((word) => {
20244
- if (spelled(word))
20306
+ var knownRussianWord = /* @__PURE__ */ __name((word2) => {
20307
+ if (spelled(word2))
20245
20308
  return true;
20246
20309
  for (const [folded5, original] of [
20247
20310
  ["\u0438", "\u0439"],
20248
20311
  ["\u0435", "\u0451"]
20249
20312
  ])
20250
- for (let at = word.indexOf(folded5); at >= 0; at = word.indexOf(folded5, at + 1))
20251
- if (spelled(word.slice(0, at) + original + word.slice(at + 1)))
20313
+ for (let at = word2.indexOf(folded5); at >= 0; at = word2.indexOf(folded5, at + 1))
20314
+ if (spelled(word2.slice(0, at) + original + word2.slice(at + 1)))
20252
20315
  return true;
20253
20316
  return false;
20254
20317
  }, "knownRussianWord");
20255
20318
 
20256
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
20319
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
20257
20320
  var WORD3 = /[\p{L}\p{N}\p{M}]+/gu;
20258
20321
  var MOST_WORDS = 128;
20259
- var quote = /* @__PURE__ */ __name((word) => `"${word.replaceAll('"', '""')}"`, "quote");
20322
+ var quote = /* @__PURE__ */ __name((word2) => `"${word2.replaceAll('"', '""')}"`, "quote");
20260
20323
  var speakers = /* @__PURE__ */ __name((database, accountId) => {
20261
20324
  const found2 = /* @__PURE__ */ new Map();
20262
20325
  const add = /* @__PURE__ */ __name((key2, label, names, participant, raw) => {
@@ -20336,7 +20399,7 @@ var resolveMeetingQuery = /* @__PURE__ */ __name((database, accountId, ast, stat
20336
20399
  raw,
20337
20400
  literal: literal4,
20338
20401
  whole: exact || isNumberWord(literal4),
20339
- stems: state.stemmer && raw.length <= 1024 && !exact ? [...new Set(state.stemmer.explain(raw).map((word) => word.stem))] : [],
20402
+ stems: state.stemmer && raw.length <= 1024 && !exact ? [...new Set(state.stemmer.explain(raw).map((word2) => word2.stem))] : [],
20340
20403
  widened: []
20341
20404
  };
20342
20405
  });
@@ -20374,9 +20437,9 @@ var resolveMeetingQuery = /* @__PURE__ */ __name((database, accountId, ast, stat
20374
20437
  }, "collect");
20375
20438
  collect(tree);
20376
20439
  if (stemmer && state.through > 0 && widening.length) {
20377
- const widened = widenWords(widening, database.prepare("SELECT term,doc FROM meeting_words_vocab WHERE col='normalized_text'").all().map((row2) => ({ term: String(row2.term), docs: Number(row2.doc) })), (word) => [...new Set(stemmer.explain(word).map((part) => part.stem))], knownRussianWord);
20378
- widening.forEach((word, at) => {
20379
- word.widened = widened[at] ?? [];
20440
+ const widened = widenWords(widening, database.prepare("SELECT term,doc FROM meeting_words_vocab WHERE col='normalized_text'").all().map((row2) => ({ term: String(row2.term), docs: Number(row2.doc) })), (word2) => [...new Set(stemmer.explain(word2).map((part) => part.stem))], knownRussianWord);
20441
+ widening.forEach((word2, at) => {
20442
+ word2.widened = widened[at] ?? [];
20380
20443
  });
20381
20444
  }
20382
20445
  return tree;
@@ -20384,7 +20447,7 @@ var resolveMeetingQuery = /* @__PURE__ */ __name((database, accountId, ast, stat
20384
20447
  var meetingQuerySql = /* @__PURE__ */ __name((tree, state) => {
20385
20448
  const params = [];
20386
20449
  const stems = state.stemmer !== null && state.through > 0;
20387
- const word = /* @__PURE__ */ __name((term) => {
20450
+ const word2 = /* @__PURE__ */ __name((term) => {
20388
20451
  params.push(`normalized_text : (${quote(term.literal)}${term.whole ? "" : "*"})`);
20389
20452
  let select3 = "SELECT rowid AS rid,0 AS tier FROM meeting_words WHERE meeting_words MATCH ?";
20390
20453
  if (stems && term.stems.length) {
@@ -20402,9 +20465,9 @@ var meetingQuerySql = /* @__PURE__ */ __name((tree, state) => {
20402
20465
  const nothing = "SELECT NULL AS rid,0 AS tier WHERE 0";
20403
20466
  const compile2 = /* @__PURE__ */ __name((node) => {
20404
20467
  if (node.kind === "words")
20405
- return node.words.length ? all2(node.words.map(word)) : nothing;
20468
+ return node.words.length ? all2(node.words.map(word2)) : nothing;
20406
20469
  if (node.kind === "near") {
20407
- const lines = node.words.map((term, i) => `w${i} AS MATERIALIZED (SELECT r.meeting_transcript_id AS t,r.position AS p,r.id,h.tier FROM (${word(term)}) h JOIN meeting_transcript_rows r ON h.rid%4=1 AND r.id=h.rid/4)`);
20470
+ const lines = node.words.map((term, i) => `w${i} AS MATERIALIZED (SELECT r.meeting_transcript_id AS t,r.position AS p,r.id,h.tier FROM (${word2(term)}) h JOIN meeting_transcript_rows r ON h.rid%4=1 AND r.id=h.rid/4)`);
20408
20471
  const nearest2 = node.words.map((_, i) => `(SELECT min(x.tier) FROM w${i} x WHERE x.t=c.t AND x.p BETWEEN c.p-${node.lines} AND c.p+${node.lines})`);
20409
20472
  return `SELECT rid,tier FROM (WITH ${lines.join(",")}, c AS (${node.words.map((_, i) => `SELECT t,p,id FROM w${i}`).join(" UNION ")}) SELECT c.id*4+1 AS rid,max(${nearest2.join(",")}) AS tier FROM c) WHERE tier IS NOT NULL`;
20410
20473
  }
@@ -20436,8 +20499,8 @@ var meetingQuerySql = /* @__PURE__ */ __name((tree, state) => {
20436
20499
  var matchMeetingText = /* @__PURE__ */ __name((tree, text6, stemmer) => {
20437
20500
  const tokens = normalize(text6).match(/[\p{L}\p{N}]+/gu) ?? [];
20438
20501
  let stemTokens;
20439
- const stemsOf2 = /* @__PURE__ */ __name(() => stemTokens ??= stemmer ? new Set(stemmer.explain(meetingStemmableText(text6)).map((word2) => word2.stem)) : /* @__PURE__ */ new Set(), "stemsOf");
20440
- const word = /* @__PURE__ */ __name((term) => {
20502
+ const stemsOf2 = /* @__PURE__ */ __name(() => stemTokens ??= stemmer ? new Set(stemmer.explain(meetingStemmableText(text6)).map((word3) => word3.stem)) : /* @__PURE__ */ new Set(), "stemsOf");
20503
+ const word2 = /* @__PURE__ */ __name((term) => {
20441
20504
  if (term.whole ? tokens.includes(term.literal) : tokens.some((token) => token.startsWith(term.literal)))
20442
20505
  return [];
20443
20506
  if (term.stems.some((stem) => stemsOf2().has(stem)))
@@ -20449,11 +20512,11 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text6, stemmer) => {
20449
20512
  if (node.kind === "speaker")
20450
20513
  return [];
20451
20514
  if (node.kind === "near")
20452
- return node.words.flatMap((term) => word(term) ?? []);
20515
+ return node.words.flatMap((term) => word2(term) ?? []);
20453
20516
  if (node.kind === "words" || node.kind === "phrase") {
20454
20517
  const found2 = [];
20455
20518
  for (const term of node.words) {
20456
- const one2 = word(term);
20519
+ const one2 = word2(term);
20457
20520
  if (!one2)
20458
20521
  return null;
20459
20522
  for (const fix of one2)
@@ -20480,7 +20543,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text6, stemmer) => {
20480
20543
  return check3(tree);
20481
20544
  }, "matchMeetingText");
20482
20545
 
20483
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
20546
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
20484
20547
  var fail3 = /* @__PURE__ */ __name((message2) => {
20485
20548
  throw new CliError("validation_error", message2);
20486
20549
  }, "fail");
@@ -20662,7 +20725,7 @@ function meetingHitSearchOver({ database }) {
20662
20725
  }
20663
20726
  __name(meetingHitSearchOver, "meetingHitSearchOver");
20664
20727
 
20665
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-languages.js
20728
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-languages.js
20666
20729
  var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
20667
20730
  async fillTranscriptLanguages({ accountId, apply, now: now2 }) {
20668
20731
  positiveReadInteger(accountId, "accountId");
@@ -20694,7 +20757,7 @@ var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
20694
20757
  }
20695
20758
  }), "meetingLanguagesOver");
20696
20759
 
20697
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
20760
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
20698
20761
  import { createHash as createHash6 } from "node:crypto";
20699
20762
  var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
20700
20763
  if (value === void 0)
@@ -20784,7 +20847,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
20784
20847
  }
20785
20848
  }), "meetingParticipantSearchOver");
20786
20849
 
20787
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
20850
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
20788
20851
  var preparationQueries = {
20789
20852
  participants: {
20790
20853
  fields: "p.id, p.identity_id, p.display_name, l.person_id",
@@ -20834,7 +20897,7 @@ var preparationQueries = {
20834
20897
  }
20835
20898
  };
20836
20899
 
20837
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
20900
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
20838
20901
  var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
20839
20902
  async preparationContext(original) {
20840
20903
  const input = validateMeetingPreparationContext(original);
@@ -20875,7 +20938,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
20875
20938
  }
20876
20939
  }), "meetingPreparationContextOver");
20877
20940
 
20878
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
20941
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
20879
20942
  var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
20880
20943
  SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
20881
20944
  WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
@@ -20889,7 +20952,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
20889
20952
  JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
20890
20953
  )`, "preparationSubjects");
20891
20954
 
20892
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
20955
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
20893
20956
  var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
20894
20957
  async preparationKnowledge(original) {
20895
20958
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -20934,7 +20997,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
20934
20997
  }
20935
20998
  }), "meetingPreparationKnowledgeOver");
20936
20999
 
20937
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
21000
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
20938
21001
  var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
20939
21002
  async preparationNotes(original) {
20940
21003
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -20987,7 +21050,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
20987
21050
  }
20988
21051
  }), "meetingPreparationNotesOver");
20989
21052
 
20990
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
21053
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
20991
21054
  var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20992
21055
  async relatedHistory(original) {
20993
21056
  const input = validateMeetingRelatedHistory(original);
@@ -21058,7 +21121,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
21058
21121
  }
21059
21122
  }), "meetingRelatedHistoryOver");
21060
21123
 
21061
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
21124
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
21062
21125
  var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
21063
21126
  var text2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
21064
21127
  var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
@@ -21139,7 +21202,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
21139
21202
  }
21140
21203
  }), "meetingReviewOver");
21141
21204
 
21142
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
21205
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
21143
21206
  var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
21144
21207
  var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
21145
21208
  if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
@@ -21193,7 +21256,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
21193
21256
  }
21194
21257
  }), "meetingSeriesHistoryOver");
21195
21258
 
21196
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
21259
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
21197
21260
  var MOST_ROWS = 5e5;
21198
21261
  var meetingCountsSql = /* @__PURE__ */ __name((where) => `SELECT m.started_at, coalesce(m.duration_ms, m.ended_at - m.started_at) AS duration_ms,
21199
21262
  EXISTS (SELECT 1 FROM meeting_transcripts t WHERE t.meeting_id = m.id AND t.deleted_at IS NULL
@@ -21262,7 +21325,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
21262
21325
  }
21263
21326
  }), "meetingStatsOver");
21264
21327
 
21265
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
21328
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
21266
21329
  var CURSOR_KEY = "meetings";
21267
21330
  var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
21268
21331
  id: Number(row2.id),
@@ -21680,7 +21743,7 @@ var drainMeetingIndex = /* @__PURE__ */ __name((database, batch = 500) => {
21680
21743
  }, "drainMeetingIndex");
21681
21744
  var wordsQuery = /* @__PURE__ */ __name((query) => {
21682
21745
  const words3 = normalize(query).split(/[^\p{L}\p{N}]+/u).filter(Boolean);
21683
- return words3.length ? words3.map((word) => `"${word}"*`).join(" AND ") : null;
21746
+ return words3.length ? words3.map((word2) => `"${word2}"*`).join(" AND ") : null;
21684
21747
  }, "wordsQuery");
21685
21748
  var search = /* @__PURE__ */ __name((database, query, filter) => {
21686
21749
  const match = wordsQuery(query);
@@ -21831,7 +21894,7 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
21831
21894
  };
21832
21895
  }, "meetingStoreOver");
21833
21896
 
21834
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
21897
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
21835
21898
  var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
21836
21899
  const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
21837
21900
  return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
@@ -21857,7 +21920,7 @@ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
21857
21920
  orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
21858
21921
  }, "release");
21859
21922
 
21860
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
21923
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
21861
21924
  var THREAD_COLUMNS = {
21862
21925
  subject: {
21863
21926
  where: /* @__PURE__ */ __name(({ value }) => ({
@@ -21874,7 +21937,7 @@ var threadRows = /* @__PURE__ */ __name((database, filter) => {
21874
21937
  AND (${filter.where?.sql ?? "1"}) ORDER BY coalesce(last_email_at, 0) DESC, id DESC LIMIT ? OFFSET ?`).all(filter.accountId ?? null, filter.accountId ?? null, filter.includeDeleted ? 1 : 0, ...filter.where?.params ?? [], limit, offset);
21875
21938
  }, "threadRows");
21876
21939
 
21877
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
21940
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
21878
21941
  var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
21879
21942
  id: `email:${place.emailId}`,
21880
21943
  chatId: place.threadExternalId,
@@ -22012,7 +22075,7 @@ var saveEmail = /* @__PURE__ */ __name((database, orm, accountId, threadId, mail
22012
22075
  ["sent_at", mail.sentAt],
22013
22076
  ["body_text", mail.bodyText]
22014
22077
  ];
22015
- const optional = [
22078
+ const optional2 = [
22016
22079
  ["receivedAt", "received_at", (v) => v],
22017
22080
  ["inReplyTo", "in_reply_to", (v) => v],
22018
22081
  ["references", '"references"', toJson],
@@ -22027,7 +22090,7 @@ var saveEmail = /* @__PURE__ */ __name((database, orm, accountId, threadId, mail
22027
22090
  ["metadata", "metadata", toJson],
22028
22091
  ["mailRuleId", "mail_rule_id", (v) => v]
22029
22092
  ];
22030
- for (const [field4, column2, encode] of optional)
22093
+ for (const [field4, column2, encode] of optional2)
22031
22094
  if (mail[field4] !== void 0)
22032
22095
  values.push([column2, encode(mail[field4])]);
22033
22096
  const found2 = database.prepare("SELECT id, email_thread_id FROM emails WHERE account_id = ? AND external_id = ?").get(accountId, mail.externalId);
@@ -22430,10 +22493,10 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
22430
22493
  }
22431
22494
  }), "mailStoreOver");
22432
22495
 
22433
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/search/dictionary.js
22496
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/search/dictionary.js
22434
22497
  import { readFileSync as readFileSync2 } from "node:fs";
22435
22498
  var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
22436
- var folded4 = /* @__PURE__ */ __name((word) => /^[а-яё'-]*$/.test(word) ? word.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word), "folded");
22499
+ var folded4 = /* @__PURE__ */ __name((word2) => /^[а-яё'-]*$/.test(word2) ? word2.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word2), "folded");
22437
22500
  var loaded2 = /* @__PURE__ */ new Map();
22438
22501
  var dictionary2 = /* @__PURE__ */ __name((language) => {
22439
22502
  const cached = loaded2.get(language);
@@ -22483,20 +22546,20 @@ var entry = /* @__PURE__ */ __name(({ words: words3 }, key2, rule, also) => {
22483
22546
  const flags = words3.get(key2) ?? "";
22484
22547
  return flags.includes(rule.flag) && (also === void 0 || flags.includes(also)) && rule.condition.test(key2);
22485
22548
  }, "entry");
22486
- var suffixed = /* @__PURE__ */ __name((found2, word, prefix) => {
22487
- for (let cut2 = 0; cut2 <= Math.min(word.length - 1, found2.longest); cut2++)
22488
- for (const rule of found2.suffixes.get(word.slice(word.length - cut2)) ?? [])
22489
- if ((prefix === void 0 || rule.cross) && entry(found2, word.slice(0, word.length - cut2) + rule.strip, rule, prefix))
22549
+ var suffixed = /* @__PURE__ */ __name((found2, word2, prefix) => {
22550
+ for (let cut2 = 0; cut2 <= Math.min(word2.length - 1, found2.longest); cut2++)
22551
+ for (const rule of found2.suffixes.get(word2.slice(word2.length - cut2)) ?? [])
22552
+ if ((prefix === void 0 || rule.cross) && entry(found2, word2.slice(0, word2.length - cut2) + rule.strip, rule, prefix))
22490
22553
  return true;
22491
22554
  return false;
22492
22555
  }, "suffixed");
22493
- var spelled2 = /* @__PURE__ */ __name((language, word) => {
22556
+ var spelled2 = /* @__PURE__ */ __name((language, word2) => {
22494
22557
  const found2 = dictionary2(language);
22495
- if (found2.words.has(word) || suffixed(found2, word))
22558
+ if (found2.words.has(word2) || suffixed(found2, word2))
22496
22559
  return true;
22497
- for (let cut2 = 1; cut2 <= Math.min(word.length - 1, found2.longest); cut2++)
22498
- for (const rule of found2.prefixes.get(word.slice(0, cut2)) ?? []) {
22499
- const rest = rule.strip + word.slice(cut2);
22560
+ for (let cut2 = 1; cut2 <= Math.min(word2.length - 1, found2.longest); cut2++)
22561
+ for (const rule of found2.prefixes.get(word2.slice(0, cut2)) ?? []) {
22562
+ const rest = rule.strip + word2.slice(cut2);
22500
22563
  if (entry(found2, rest, rule) || rule.cross && suffixed(found2, rest, rule.flag))
22501
22564
  return true;
22502
22565
  }
@@ -22509,25 +22572,25 @@ var SCRIPT_OF = {
22509
22572
  spanish: "latin"
22510
22573
  };
22511
22574
  var knownWord = /* @__PURE__ */ __name((languages) => {
22512
- const byScript = /* @__PURE__ */ __name((word) => {
22513
- const script = CYRILLIC.test(word) ? "cyrillic" : "latin";
22575
+ const byScript = /* @__PURE__ */ __name((word2) => {
22576
+ const script = CYRILLIC.test(word2) ? "cyrillic" : "latin";
22514
22577
  return languages.filter((language) => SCRIPT_OF[language] === script);
22515
22578
  }, "byScript");
22516
22579
  return {
22517
- covers: /* @__PURE__ */ __name((word) => byScript(word).length > 0, "covers"),
22518
- known: /* @__PURE__ */ __name((word) => byScript(word).some((language) => spelled2(language, word)), "known")
22580
+ covers: /* @__PURE__ */ __name((word2) => byScript(word2).length > 0, "covers"),
22581
+ known: /* @__PURE__ */ __name((word2) => byScript(word2).some((language) => spelled2(language, word2)), "known")
22519
22582
  };
22520
22583
  }, "knownWord");
22521
22584
  var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
22522
22585
 
22523
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
22586
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
22524
22587
  var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
22525
22588
  var readsTranscripts = /* @__PURE__ */ __name((node) => (node.operator === "term" || node.operator === "phrase") && /[\p{L}\p{N}]/u.test(normalize(node.value)) && (node.field === "transcript" || node.implicit === true && (node.field === "text" || node.field === "exact")), "readsTranscripts");
22526
22589
  var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
22527
22590
  eighty ninety hundred thousand million billion first second third fourth fifth sixth seventh eighth ninth tenth
22528
22591
  half quarter cero uno una dos tres cuatro cinco seis siete ocho nueve diez once doce veinte treinta cuarenta
22529
22592
  cincuenta sesenta setenta ochenta noventa cien ciento mil millon primero segundo tercero cuarto quinto medio`.split(/\s+/));
22530
- var widens = /* @__PURE__ */ __name((word, covered) => covered(word) && !isNumberWord(word) && !LATIN_NUMBERS.has(word), "widens");
22593
+ var widens = /* @__PURE__ */ __name((word2, covered) => covered(word2) && !isNumberWord(word2) && !LATIN_NUMBERS.has(word2), "widens");
22531
22594
  var transcriptTerms = /* @__PURE__ */ __name((database, root, item) => {
22532
22595
  const leaves = predicates(root).filter(readsTranscripts);
22533
22596
  const terms2 = new Map(leaves.map((node) => [node, { match: ftsMatch(node), widened: [], from: node.value }]));
@@ -22537,7 +22600,7 @@ var transcriptTerms = /* @__PURE__ */ __name((database, root, item) => {
22537
22600
  const stemmers = saved ?? DEFAULT_STEMMERS;
22538
22601
  const stemmer = createStemmer(stemmers);
22539
22602
  const dictionary3 = knownWord(dictionaryLanguages(stemmers));
22540
- const stemsOf2 = /* @__PURE__ */ __name((word) => [...new Set(stemmer.explain(word).map((part) => part.stem))], "stemsOf");
22603
+ const stemsOf2 = /* @__PURE__ */ __name((word2) => [...new Set(stemmer.explain(word2).map((part) => part.stem))], "stemsOf");
22541
22604
  const widening = [];
22542
22605
  for (const [node, one2] of terms2) {
22543
22606
  if (node.field === "exact")
@@ -22546,9 +22609,9 @@ var transcriptTerms = /* @__PURE__ */ __name((database, root, item) => {
22546
22609
  if (stems)
22547
22610
  Object.assign(one2, { stems: node.slop === void 0 ? stems : `(${stems}) NOT ${quoted(STEM_SEPARATOR)}` });
22548
22611
  const words3 = normalize(node.value).match(/[\p{L}\p{N}]+/gu) ?? [];
22549
- const [word] = words3;
22550
- if (node.operator === "term" && word !== void 0 && words3.length === 1 && widens(word, dictionary3.covers))
22551
- widening.push({ node, literal: word, stems: stemsOf2(node.value) });
22612
+ const [word2] = words3;
22613
+ if (node.operator === "term" && word2 !== void 0 && words3.length === 1 && widens(word2, dictionary3.covers))
22614
+ widening.push({ node, literal: word2, stems: stemsOf2(node.value) });
22552
22615
  }
22553
22616
  if (!widening.length)
22554
22617
  return terms2;
@@ -22598,7 +22661,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
22598
22661
  const text6 = String(row2.text);
22599
22662
  const tokens = new Set(normalize(text6).match(/[\p{L}\p{N}]+/gu) ?? []);
22600
22663
  const corrections = Number(row2.plain) === 1 ? [] : speaking.flatMap(({ from: from2, widened }) => {
22601
- const to = widened.filter((word) => tokens.has(word));
22664
+ const to = widened.filter((word2) => tokens.has(word2));
22602
22665
  return to.length ? [{ from: from2, to }] : [];
22603
22666
  });
22604
22667
  found2.set(id2, { text: text6, corrections });
@@ -22606,7 +22669,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
22606
22669
  return found2;
22607
22670
  }, "spokenTranscripts");
22608
22671
 
22609
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
22672
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
22610
22673
  var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
22611
22674
  const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
22612
22675
  if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
@@ -22636,8 +22699,8 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
22636
22699
  return wordy.some(({ node }) => {
22637
22700
  const phrase = normalize(node.value).match(/[\p{L}\p{N}]+/gu) ?? [];
22638
22701
  if (node.slop !== void 0)
22639
- return phrase.every((word) => words3.includes(word));
22640
- return words3.some((_, at) => phrase.every((word, offset) => words3[at + offset] === word));
22702
+ return phrase.every((word2) => words3.includes(word2));
22703
+ return words3.some((_, at) => phrase.every((word2, offset) => words3[at + offset] === word2));
22641
22704
  });
22642
22705
  });
22643
22706
  const place = inText.has(pk) ? ["text", hit.text] : transcript2 && fileFields.has("transcript") ? ["transcript", String(transcript2.text)] : name ? ["filename", String(name.name)] : file && fileFields.has("content") ? ["file", String(file.text)] : void 0;
@@ -22653,7 +22716,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
22653
22716
  });
22654
22717
  }, "placeHits");
22655
22718
 
22656
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-groups.js
22719
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-groups.js
22657
22720
  var GROUPS = {
22658
22721
  chat: {
22659
22722
  key: "m.chat_id",
@@ -22675,7 +22738,7 @@ var GROUPS = {
22675
22738
  }
22676
22739
  };
22677
22740
 
22678
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
22741
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
22679
22742
  var MESSAGES2 = {
22680
22743
  rows: "messages",
22681
22744
  threads: "chats",
@@ -22814,9 +22877,9 @@ var compileQuery = /* @__PURE__ */ __name((context, execution, boundedAttachment
22814
22877
  }
22815
22878
  const clauses = node.clauses.map(({ occur, node: node2 }) => ({ occur, part: compile2(node2) }));
22816
22879
  const required3 = clauses.filter(({ occur }) => occur === "must");
22817
- const optional = clauses.filter(({ occur }) => occur === "should");
22880
+ const optional2 = clauses.filter(({ occur }) => occur === "should");
22818
22881
  const prohibited = clauses.filter(({ occur }) => occur === "must_not");
22819
- const positive2 = required3.length ? combine(required3.map(({ part }) => part), "AND") : combine(optional.map(({ part }) => part), "OR");
22882
+ const positive2 = required3.length ? combine(required3.map(({ part }) => part), "AND") : combine(optional2.map(({ part }) => part), "OR");
22820
22883
  const negatives = prohibited.map(({ part }) => part.exact ? { ...part, sql: `NOT coalesce(${part.sql},0)` } : { sql: "1", params: [], exact: false });
22821
22884
  const result = combine([positive2, ...negatives], "AND");
22822
22885
  return { ...result, exact: clauses.every(({ part }) => part.exact) };
@@ -22887,12 +22950,12 @@ var compileQuery = /* @__PURE__ */ __name((context, execution, boundedAttachment
22887
22950
  if (node.kind === "predicate")
22888
22951
  return fragments.get(node)?.fragment[index2];
22889
22952
  const required3 = node.clauses.filter(({ occur }) => occur === "must");
22890
- const optional = node.clauses.filter(({ occur }) => occur === "should");
22953
+ const optional2 = node.clauses.filter(({ occur }) => occur === "should");
22891
22954
  if (required3.length) {
22892
22955
  const parts3 = required3.flatMap(({ node: node2 }) => requiredText(node2, index2) ?? []);
22893
22956
  return parts3.length ? parts3.map((part) => `(${part})`).join(" AND ") : void 0;
22894
22957
  }
22895
- const parts2 = optional.map(({ node: node2 }) => requiredText(node2, index2));
22958
+ const parts2 = optional2.map(({ node: node2 }) => requiredText(node2, index2));
22896
22959
  return parts2.length && parts2.every((part) => part !== void 0) ? parts2.map((part) => `(${part})`).join(" OR ") : void 0;
22897
22960
  }, "requiredText");
22898
22961
  const stemmed = [...fragments.keys()].some(isStemmed);
@@ -22915,8 +22978,8 @@ var compileQuery = /* @__PURE__ */ __name((context, execution, boundedAttachment
22915
22978
  return other ? { sql: `${own.sql} UNION ${other.sql}`, params: [...own.params, ...other.params] } : own;
22916
22979
  }
22917
22980
  const required3 = node.clauses.filter(({ occur }) => occur === "must");
22918
- const optional = node.clauses.filter(({ occur }) => occur === "should");
22919
- const parts2 = required3.length ? required3.flatMap(({ node: node2 }) => driverOf(node2) ?? []) : optional.map(({ node: node2 }) => driverOf(node2));
22981
+ const optional2 = node.clauses.filter(({ occur }) => occur === "should");
22982
+ const parts2 = required3.length ? required3.flatMap(({ node: node2 }) => driverOf(node2) ?? []) : optional2.map(({ node: node2 }) => driverOf(node2));
22920
22983
  if (!parts2.length || parts2.some((part) => part === void 0))
22921
22984
  return void 0;
22922
22985
  const sets = parts2;
@@ -23158,7 +23221,7 @@ var runCompiled = /* @__PURE__ */ __name(async (context, execution, by) => {
23158
23221
  };
23159
23222
  }, "runCompiled");
23160
23223
 
23161
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
23224
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
23162
23225
  function invalidMetadata() {
23163
23226
  throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
23164
23227
  }
@@ -23260,7 +23323,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
23260
23323
  };
23261
23324
  }), "counterTargets");
23262
23325
 
23263
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
23326
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
23264
23327
  var NOT_FILE_LIST = [...NOT_FILES].map((kind4) => `'${kind4}'`).join(",");
23265
23328
  var fileAttachments = /* @__PURE__ */ __name(({ database }, accountKey, { chatKey, messageId, beforePk, limit }) => database.prepare(`SELECT att.id AS pk, c.external_id AS chat_id, m.external_id AS message_id, att.position, att.kind, att.name, att.mime,
23266
23329
  att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
@@ -23379,7 +23442,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
23379
23442
  }));
23380
23443
  }, "attachmentViews");
23381
23444
 
23382
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
23445
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
23383
23446
  var transcript = /* @__PURE__ */ __name(({ orm }, chatKey, messageId) => orm.select({ text: messageTranscripts.text, source: messageTranscripts.source }).from(messageTranscripts).where(and(eq(messageTranscripts.chatId, chatKey), eq(messageTranscripts.messageExternalId, messageId))).get(), "transcript");
23384
23447
  var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text6, source2) => {
23385
23448
  const { orm, database, now: now2 } = context;
@@ -23417,7 +23480,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
23417
23480
  keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
23418
23481
  }, "intoVoiceAttachment");
23419
23482
 
23420
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
23483
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
23421
23484
  var FIELDS = [
23422
23485
  "threadExternalId",
23423
23486
  "senderIdentityId",
@@ -23734,7 +23797,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
23734
23797
  reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
23735
23798
  }, "writeDerivedReactions");
23736
23799
 
23737
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/keys.js
23800
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/keys.js
23738
23801
  var keysOver = /* @__PURE__ */ __name((context) => {
23739
23802
  const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
23740
23803
  const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
@@ -23755,7 +23818,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
23755
23818
  };
23756
23819
  }, "keysOver");
23757
23820
 
23758
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
23821
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
23759
23822
  var accountGroupsOf = /* @__PURE__ */ __name((database) => {
23760
23823
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
23761
23824
  if (!row2)
@@ -23790,7 +23853,7 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
23790
23853
  database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
23791
23854
  }, "saveProfile");
23792
23855
 
23793
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
23856
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
23794
23857
  var BOT_KINDS = ["agent", "rule", "script", "integration"];
23795
23858
  var ownerPerson = /* @__PURE__ */ __name((database) => {
23796
23859
  const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
@@ -23847,7 +23910,7 @@ var proposedBySql = /* @__PURE__ */ __name((type, id2, by) => {
23847
23910
  return { sql: bot("pb.name = ?"), params: [by.bot] };
23848
23911
  }, "proposedBySql");
23849
23912
 
23850
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
23913
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
23851
23914
  var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
23852
23915
  const owner = ownerPerson(context.database).id;
23853
23916
  const strays = context.database.prepare("SELECT DISTINCT l.person_id AS person FROM identity_links l JOIN identities i ON i.id = l.identity_id JOIN accounts a ON a.provider = i.provider AND a.external_id = i.external_id WHERE l.person_id <> ?").all(owner);
@@ -23868,7 +23931,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
23868
23931
  return personOf(context, ref3);
23869
23932
  }, "linkToOwner");
23870
23933
 
23871
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
23934
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
23872
23935
  var PROVIDERS_SETTING = "providers";
23873
23936
  var storedProvidersOf = /* @__PURE__ */ __name((database) => {
23874
23937
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
@@ -23903,7 +23966,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
23903
23966
  });
23904
23967
  }, "registerProvider");
23905
23968
 
23906
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
23969
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
23907
23970
  var DAY3 = 864e5;
23908
23971
  var RECENTLY_CLOSED_MS = 14 * DAY3;
23909
23972
  var TEXT_LIMIT = 20;
@@ -24102,7 +24165,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
24102
24165
  };
24103
24166
  }, "taskSimilarityOver");
24104
24167
 
24105
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
24168
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
24106
24169
  var SETTING3 = "taskCategories";
24107
24170
  var savedTaskCategories = /* @__PURE__ */ __name((database) => {
24108
24171
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
@@ -24121,7 +24184,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
24121
24184
  database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(SETTING3, JSON.stringify(categories), now2);
24122
24185
  }, "saveTaskCategories");
24123
24186
 
24124
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
24187
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
24125
24188
  var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
24126
24189
  var ALLOWED = "taskAgentClose";
24127
24190
  var MIN = "taskAgentCloseMin";
@@ -24177,37 +24240,37 @@ var SUGGESTION_COLUMNS = [
24177
24240
  ];
24178
24241
  var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
24179
24242
 
24180
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/mail-findings.js
24243
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/mail-findings.js
24181
24244
  var MAIL_FINDINGS_KIND = "mail_findings";
24182
24245
 
24183
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/decisions.js
24246
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/decisions.js
24184
24247
  var TASK_CLOSE_KIND = "task_close";
24185
24248
  var DEFAULT_DECISION_POLICY = { agentDecisions: false, ruleProposalsOwnerOnly: true };
24186
24249
  var isOwnerOnlyKind = /* @__PURE__ */ __name((kind4) => kind4 === MAIL_FINDINGS_KIND || kind4 === MEETING_FINDINGS_KIND || kind4 === TASK_CLOSE_KIND, "isOwnerOnlyKind");
24187
24250
  var mayDecide = /* @__PURE__ */ __name((row2, by, policy = DEFAULT_DECISION_POLICY) => {
24188
24251
  if (by === "owner")
24189
24252
  return null;
24190
- const refuse4 = /* @__PURE__ */ __name((code, reason, message2) => ({
24253
+ const refuse3 = /* @__PURE__ */ __name((code, reason, message2) => ({
24191
24254
  id: row2.id,
24192
24255
  code,
24193
24256
  reason,
24194
24257
  message: message2
24195
24258
  }), "refuse");
24196
24259
  if (row2.ownerOnly || isOwnerOnlyKind(row2.kind))
24197
- return refuse4("permission_error", "proposal.owner-only", `only the owner decides ${row2.id}`);
24260
+ return refuse3("permission_error", "proposal.owner-only", `only the owner decides ${row2.id}`);
24198
24261
  if (!policy.agentDecisions)
24199
- return refuse4("permission_error", "proposals.agent-decisions-off", "agent decisions are turned off; the owner decides");
24262
+ return refuse3("permission_error", "proposals.agent-decisions-off", "agent decisions are turned off; the owner decides");
24200
24263
  if (typeof by.reason !== "string" || !by.reason.trim() || by.reason.length > 2e3)
24201
- return refuse4("validation_error", "proposal.reason-required", "an agent deciding for the owner gives a reason");
24264
+ return refuse3("validation_error", "proposal.reason-required", "an agent deciding for the owner gives a reason");
24202
24265
  const proposer = row2.proposedBy;
24203
24266
  if (proposer.type === "unknown")
24204
- return refuse4("permission_error", "proposal.owner-only", "this proposal names no author; only the owner decides it");
24267
+ return refuse3("permission_error", "proposal.owner-only", "this proposal names no author; only the owner decides it");
24205
24268
  if (proposer.type === "bot" && proposer.verified === false)
24206
- return refuse4("permission_error", "proposal.owner-only", `${proposer.name} is named only by an old link's provenance; only the owner decides it`);
24269
+ return refuse3("permission_error", "proposal.owner-only", `${proposer.name} is named only by an old link's provenance; only the owner decides it`);
24207
24270
  if (proposer.type === "bot" && proposer.kind === "rule" && policy.ruleProposalsOwnerOnly)
24208
- return refuse4("permission_error", "proposal.owner-only", `proposed by ${proposer.name}: only the owner decides it`);
24271
+ return refuse3("permission_error", "proposal.owner-only", `proposed by ${proposer.name}: only the owner decides it`);
24209
24272
  if (proposer.type === "bot" && proposer.kind === "agent" && botKey(proposer.name) === botKey(by.bot))
24210
- return refuse4("permission_error", "proposal.own", `${by.bot} proposed this; another decider must decide it`);
24273
+ return refuse3("permission_error", "proposal.own", `${by.bot} proposed this; another decider must decide it`);
24211
24274
  return null;
24212
24275
  }, "mayDecide");
24213
24276
  var botKey = /* @__PURE__ */ __name((name) => name.trim().toLowerCase().replace(/[\s_]+/g, "-"), "botKey");
@@ -24228,121 +24291,7 @@ var assertMayDecide = /* @__PURE__ */ __name((row2, by, policy = DEFAULT_DECISIO
24228
24291
  }, "assertMayDecide");
24229
24292
  var deciderAuthor = /* @__PURE__ */ __name((by) => by === "owner" ? "owner" : { bot: by.bot, ...by.model === void 0 ? {} : { model: by.model } }, "deciderAuthor");
24230
24293
 
24231
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/money.js
24232
- var CURRENCY_SCALES = {
24233
- AED: 2,
24234
- AMD: 2,
24235
- AUD: 2,
24236
- BHD: 3,
24237
- BYN: 2,
24238
- CAD: 2,
24239
- CHF: 2,
24240
- CLP: 0,
24241
- CNY: 2,
24242
- CZK: 2,
24243
- DKK: 2,
24244
- EUR: 2,
24245
- GBP: 2,
24246
- GEL: 2,
24247
- HUF: 2,
24248
- ILS: 2,
24249
- INR: 2,
24250
- ISK: 0,
24251
- JPY: 0,
24252
- KGS: 2,
24253
- KRW: 0,
24254
- KWD: 3,
24255
- KZT: 2,
24256
- NOK: 2,
24257
- PLN: 2,
24258
- RSD: 2,
24259
- RUB: 2,
24260
- SEK: 2,
24261
- THB: 2,
24262
- TRY: 2,
24263
- UAH: 2,
24264
- USD: 2,
24265
- UZS: 2,
24266
- VND: 0
24267
- };
24268
- var refuse = /* @__PURE__ */ __name((message2, reason) => {
24269
- throw new CliError("validation_error", message2, { reason });
24270
- }, "refuse");
24271
- var DECIMAL = /^(\d{1,15})(?:\.(\d+))?$/;
24272
- var parseDecimal = /* @__PURE__ */ __name((text6, scale) => {
24273
- const match = DECIMAL.exec(text6.trim());
24274
- if (!match || (match[2] ?? "").length > scale)
24275
- return void 0;
24276
- return BigInt(`${match[1]}${(match[2] ?? "").padEnd(scale, "0")}`);
24277
- }, "parseDecimal");
24278
- var formatDecimal = /* @__PURE__ */ __name((units, scale) => {
24279
- const digits = BigInt(units).toString().padStart(scale + 1, "0");
24280
- return scale === 0 ? digits : `${digits.slice(0, -scale)}.${digits.slice(-scale)}`;
24281
- }, "formatDecimal");
24282
- var groupDigits = /* @__PURE__ */ __name((decimal) => {
24283
- const [whole = "0", fraction] = decimal.split(".");
24284
- const grouped = whole.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
24285
- return fraction === void 0 ? grouped : `${grouped}.${fraction}`;
24286
- }, "groupDigits");
24287
- var currencyOf2 = /* @__PURE__ */ __name((text6) => {
24288
- const code = typeof text6 === "string" ? text6.trim().toUpperCase() : "";
24289
- if (CURRENCY_SCALES[code] === void 0)
24290
- return refuse(`${typeof text6 === "string" && text6.trim() ? text6.trim() : "an empty currency"} is not a currency the store keeps; use one of ${Object.keys(CURRENCY_SCALES).join(", ")}`, "money.currency");
24291
- return code;
24292
- }, "currencyOf");
24293
- var scaleOf = /* @__PURE__ */ __name((currency) => CURRENCY_SCALES[currencyOf2(currency)], "scaleOf");
24294
- var minorUnits = /* @__PURE__ */ __name((amount, currency, what = "an amount") => {
24295
- const scale = scaleOf(currency);
24296
- const units = typeof amount === "string" ? parseDecimal(amount, scale) : void 0;
24297
- if (units === void 0 || units > BigInt(Number.MAX_SAFE_INTEGER))
24298
- return refuse(`${what} is a decimal string with at most ${scale} decimal${scale === 1 ? "" : "s"} for ${currency}, such as "${formatDecimal(5e3 * 10 ** scale, scale)}"`, "money.amount");
24299
- return Number(units);
24300
- }, "minorUnits");
24301
- var moneyOf = /* @__PURE__ */ __name((units, currency) => ({
24302
- amount: formatDecimal(units, scaleOf(currency)),
24303
- currency
24304
- }), "moneyOf");
24305
- var moneyLabel = /* @__PURE__ */ __name((units, currency) => `${groupDigits(formatDecimal(units, scaleOf(currency)))} ${currency}`, "moneyLabel");
24306
- var QUANTITY_SCALE = 3;
24307
- var quantityOf = /* @__PURE__ */ __name((text6) => {
24308
- const thousandths = typeof text6 === "string" ? parseDecimal(text6, QUANTITY_SCALE) : void 0;
24309
- if (thousandths === void 0 || thousandths === 0n)
24310
- return refuse('a quantity is a decimal string above 0 with at most 3 decimals, such as "1.5"', "money.quantity");
24311
- const plain2 = formatDecimal(thousandths, QUANTITY_SCALE).replace(/\.?0+$/, "");
24312
- return { text: plain2, thousandths };
24313
- }, "quantityOf");
24314
- var lineUnits = /* @__PURE__ */ __name((thousandths, unitPrice) => Number((thousandths * BigInt(unitPrice) + 500n) / 1000n), "lineUnits");
24315
-
24316
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/finance.js
24317
- var INVOICE_DIRECTIONS = ["receivable", "payable"];
24318
- var INVOICE_STATUSES = ["draft", "issued", "partly_paid", "paid", "void"];
24319
- var MONEY_DIRECTIONS = ["in", "out"];
24320
- var FINANCE_REVIEWS = ["proposed", "confirmed", "rejected"];
24321
- var settledStatus = /* @__PURE__ */ __name((current, total, paid) => {
24322
- if (current === "draft" || current === "void")
24323
- return current;
24324
- if (paid <= 0)
24325
- return "issued";
24326
- return paid < total ? "partly_paid" : "paid";
24327
- }, "settledStatus");
24328
- var dayMonth = /* @__PURE__ */ __name((date3) => date3 === null ? null : `${date3.slice(8, 10)}.${date3.slice(5, 7)}`, "dayMonth");
24329
- var notes2 = /* @__PURE__ */ __name((...words3) => {
24330
- const kept = words3.filter((word) => word !== null);
24331
- return kept.length === 0 ? "" : ` (${kept.join(", ")})`;
24332
- }, "notes");
24333
- var invoiceLine = /* @__PURE__ */ __name((invoice) => {
24334
- const party2 = invoice.counterpartyName === null ? "" : `${invoice.direction === "receivable" ? " to" : " from"} ${invoice.counterpartyName}`;
24335
- const due = invoice.dueDate === null ? "" : `, due ${dayMonth(invoice.dueDate)}`;
24336
- return `${invoice.number ?? `#${invoice.id}`} \xB7 ${moneyLabel(invoice.total, invoice.currency)}${party2}${due}` + notes2(invoice.status.replace("_", " "), invoice.review === "confirmed" ? null : invoice.review);
24337
- }, "invoiceLine");
24338
- var paymentLine = /* @__PURE__ */ __name((payment) => {
24339
- const party2 = payment.partyName === null ? "" : `${payment.direction === "in" ? " from" : " to"} ${payment.partyName}`;
24340
- return `${moneyLabel(payment.amount, payment.currency)}${party2}, ${dayMonth(payment.date)}` + notes2(payment.review === "confirmed" ? null : payment.review);
24341
- }, "paymentLine");
24342
- var invoiceTitle = /* @__PURE__ */ __name((invoice) => `Invoice ${invoiceLine(invoice)}`, "invoiceTitle");
24343
- var paymentEntryTitle = /* @__PURE__ */ __name((payment) => `Payment \xB7 ${paymentLine(payment)}`, "paymentEntryTitle");
24344
-
24345
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/ref-summaries.js
24294
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/ref-summaries.js
24346
24295
  var PROFILE_PLACEHOLDER = "<profile>";
24347
24296
  var oneLine = /* @__PURE__ */ __name((text6) => singleLine(text6.replace(/\s+/g, " ").trim()), "oneLine");
24348
24297
  var openKind = /* @__PURE__ */ __name((kind4) => kind4 === "email" ? "message" : kind4 === "email_thread" ? "chat" : kind4 === "unknown" ? void 0 : kind4, "openKind");
@@ -24384,17 +24333,18 @@ var WORDS2 = {
24384
24333
  bot: "Bot",
24385
24334
  invoice: "Invoice",
24386
24335
  payment: "Payment",
24336
+ order: "Order",
24387
24337
  email: "Email",
24388
24338
  email_thread: "Email thread",
24389
24339
  unknown: "Unknown"
24390
24340
  };
24391
24341
  var refLabel = /* @__PURE__ */ __name((summary) => {
24392
24342
  const named2 = summary.title === null ? summary.ref : `\xAB${oneLine(summary.title)}\xBB`;
24393
- const notes3 = [summary.in === null ? null : oneLine(summary.in), summary.state === "available" ? null : summary.state].filter((one2) => one2 !== null).join(", ");
24394
- return `${WORDS2[summary.kind]} ${named2}${notes3 === "" ? "" : ` (${notes3})`}`;
24343
+ const notes2 = [summary.in === null ? null : oneLine(summary.in), summary.state === "available" ? null : summary.state].filter((one2) => one2 !== null).join(", ");
24344
+ return `${WORDS2[summary.kind]} ${named2}${notes2 === "" ? "" : ` (${notes2})`}`;
24395
24345
  }, "refLabel");
24396
24346
 
24397
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/ref-summaries.js
24347
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/ref-summaries.js
24398
24348
  var EXCERPT_CHARS = 280;
24399
24349
  var TITLE_CHARS = 120;
24400
24350
  var MEMORY_TITLE_CHARS = 80;
@@ -24562,6 +24512,12 @@ var READERS = {
24562
24512
  holder: "(SELECT name FROM projects WHERE id = x.project_id)",
24563
24513
  at: "x.created_at",
24564
24514
  deleted: "x.deleted_at"
24515
+ })),
24516
+ order: byId("order", "orders", () => ({
24517
+ title: "json_object('id', x.id, 'number', x.number, 'supplierName', x.supplier_name, 'total', x.total, 'currency', x.currency, 'status', x.status, 'review', x.review)",
24518
+ holder: "(SELECT name FROM projects WHERE id = x.project_id)",
24519
+ at: "x.created_at",
24520
+ deleted: "x.deleted_at"
24565
24521
  }))
24566
24522
  };
24567
24523
  var FALLBACK = { email: "message", email_thread: "chat" };
@@ -24651,6 +24607,8 @@ var titleOf2 = /* @__PURE__ */ __name((kind4, reference2, found2) => {
24651
24607
  return fieldsOf2(found2.title, invoiceLine);
24652
24608
  case "payment":
24653
24609
  return fieldsOf2(found2.title, paymentLine);
24610
+ case "order":
24611
+ return fieldsOf2(found2.title, orderLine);
24654
24612
  case "folder":
24655
24613
  return reference2.type === "folder" && reference2.path !== null && found2.title !== null ? `${found2.title}/${reference2.path}` : found2.title;
24656
24614
  default:
@@ -24747,7 +24705,7 @@ var refReadsOf = /* @__PURE__ */ __name((database, texts2, { excerpt = false } =
24747
24705
  var summaryOf2 = /* @__PURE__ */ __name(({ sender, excerpt, ...summary }, withExcerpt) => withExcerpt ? { ...summary, excerpt } : summary, "summaryOf");
24748
24706
  var refSummariesOf = /* @__PURE__ */ __name((database, texts2, options = {}) => new Map([...refReadsOf(database, texts2, options)].map(([text6, read2]) => [text6, summaryOf2(read2, options.excerpt === true)])), "refSummariesOf");
24749
24707
 
24750
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
24708
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
24751
24709
  var sourceOf3 = /* @__PURE__ */ __name((read2, ref3) => ({
24752
24710
  ref: ref3,
24753
24711
  kind: read2.kind,
@@ -24783,7 +24741,7 @@ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => {
24783
24741
  });
24784
24742
  }, "evidenceSourcesOf");
24785
24743
 
24786
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/attachments/limits.js
24744
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/attachments/limits.js
24787
24745
  var MAX_FILE_BYTES = 50 * 1024 * 1024;
24788
24746
  var MAX_TEXT_CHARS = 2e6;
24789
24747
  var ATTACHMENT_LIMIT_ENV = [
@@ -24809,7 +24767,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
24809
24767
  return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
24810
24768
  }, "pdfPreviewLimits");
24811
24769
 
24812
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/ulid.js
24770
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/ulid.js
24813
24771
  import { randomBytes } from "node:crypto";
24814
24772
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
24815
24773
  var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
@@ -24822,7 +24780,7 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
24822
24780
  return time3 + random;
24823
24781
  }, "ulid");
24824
24782
 
24825
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
24783
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
24826
24784
  var FOLDED_FIELDS = ["title", "site", "language", "author"];
24827
24785
  var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
24828
24786
  if (!meta && !sections?.length)
@@ -24843,7 +24801,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
24843
24801
  return typeof language === "string" && language !== "" ? language : null;
24844
24802
  }, "languageOf");
24845
24803
 
24846
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
24804
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
24847
24805
  var isObject = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
24848
24806
  var objectOf2 = /* @__PURE__ */ __name((value) => {
24849
24807
  if (isObject(value))
@@ -25086,7 +25044,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
25086
25044
  };
25087
25045
  }, "filesStoreOver");
25088
25046
 
25089
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
25047
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
25090
25048
  var IMPORTED_DOCUMENT_QUERY = defineQuery({
25091
25049
  entity: "document",
25092
25050
  backend: "sql",
@@ -25132,7 +25090,7 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
25132
25090
  return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
25133
25091
  }, "importedDocumentWhere");
25134
25092
 
25135
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
25093
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
25136
25094
  var NOTE_FORMATS = ["obsidian", "markdown"];
25137
25095
  var iso2 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
25138
25096
  var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso2(value), "optionalIso");
@@ -25658,7 +25616,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
25658
25616
  };
25659
25617
  }, "notesStoreOver");
25660
25618
 
25661
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
25619
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
25662
25620
  var NAMED = "SELECT m.*, b.name AS author_name, b.kind AS author_kind FROM memories m LEFT JOIN bots b ON m.author_type = 'bot' AND b.id = m.author_id";
25663
25621
  var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
25664
25622
  var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -25870,17 +25828,17 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
25870
25828
  search: /* @__PURE__ */ __name(async (text6, { subject: subjectRef, scope: scope3, limit = 20 } = {}) => {
25871
25829
  const subject2 = subjectRef === void 0 ? void 0 : requiredThing(database, subjectRef);
25872
25830
  drainCorpus(database, CORPORA.memory, stemmerFor2);
25873
- const words3 = normalize(text6).split(/\s+/).filter((word) => /[\p{L}\p{N}]/u.test(word));
25831
+ const words3 = normalize(text6).split(/\s+/).filter((word2) => /[\p{L}\p{N}]/u.test(word2));
25874
25832
  if (words3.length === 0)
25875
25833
  throw new CliError("validation_error", "say what to find in the memories");
25876
- const match = `normalized_text : (${words3.map((word) => `"${word.replaceAll('"', '""')}"*`).join(" AND ")})`;
25834
+ const match = `normalized_text : (${words3.map((word2) => `"${word2.replaceAll('"', '""')}"*`).join(" AND ")})`;
25877
25835
  return database.prepare("SELECT m.*, b.name AS author_name, b.kind AS author_kind FROM memory_words w JOIN memories m ON m.id = w.rowid LEFT JOIN bots b ON m.author_type = 'bot' AND b.id = m.author_id WHERE memory_words MATCH ? AND m.deleted_at IS NULL AND (? IS NULL OR (m.subject_type = ? AND m.subject_id = ?)) AND (? IS NULL OR m.scope = ?) ORDER BY bm25(memory_words), m.id LIMIT ?").all(match, subject2?.type ?? null, subject2?.type ?? null, subject2?.id ?? null, scope3 ?? null, scope3 ?? null, Math.min(Math.max(limit, 1), 200)).map(memoryOf);
25878
25836
  }, "search"),
25879
25837
  indexState: /* @__PURE__ */ __name(async () => corpusIndexState(database, CORPORA.memory), "indexState")
25880
25838
  };
25881
25839
  }, "memoriesStoreOver");
25882
25840
 
25883
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
25841
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
25884
25842
  var DEFAULT_FIRST_PASS_PER_CHAT = 0;
25885
25843
  var KEY = "taskFirstPassPerChat";
25886
25844
  var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
@@ -25900,7 +25858,7 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
25900
25858
  database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(KEY, String(value), now2);
25901
25859
  }, "saveFirstPassPerChat");
25902
25860
 
25903
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
25861
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
25904
25862
  var TASK_SORTS = ["priority", "due", "created", "updated", "key", "state"];
25905
25863
  var field = /* @__PURE__ */ __name((name, type, example, more = {}) => ({
25906
25864
  name,
@@ -25942,11 +25900,11 @@ var OWNER_PROJECTS = `SELECT id FROM projects WHERE deleted_at IS NULL AND lengt
25942
25900
  var ASSIGNED = "SELECT 1 FROM task_assignments a WHERE a.task_id = t.id AND a.assignee_type = 'person' AND a.role = 'assignee'";
25943
25901
  var UNFINISHED_BLOCKER = "SELECT 1 FROM links l LEFT JOIN tasks b ON b.id = l.to_id LEFT JOIN projects bp ON bp.id = b.project_id WHERE l.from_type = 'task' AND l.to_type = 'task' AND l.kind = 'blocked-by' AND l.from_id = t.id AND l.confirmed = 1 AND l.anchor IS NULL AND (b.id IS NULL OR b.deleted_at IS NOT NULL OR bp.deleted_at IS NOT NULL OR b.status <> 'done')";
25944
25902
  var wordsMatch = /* @__PURE__ */ __name((node) => {
25945
- const words3 = taskWordsOf(node.value.replaceAll("*", " ")).split(/\s+/).filter((word) => /[\p{L}\p{N}]/u.test(word));
25903
+ const words3 = taskWordsOf(node.value.replaceAll("*", " ")).split(/\s+/).filter((word2) => /[\p{L}\p{N}]/u.test(word2));
25946
25904
  if (words3.length === 0)
25947
25905
  return void 0;
25948
25906
  const quoted3 = /* @__PURE__ */ __name((text6) => `"${text6.replaceAll('"', '""')}"`, "quoted");
25949
- return `normalized_text : (${node.operator === "phrase" ? quoted3(words3.join(" ")) : words3.map((word) => `${quoted3(word)}*`).join(" AND ")})`;
25907
+ return `normalized_text : (${node.operator === "phrase" ? quoted3(words3.join(" ")) : words3.map((word2) => `${quoted3(word2)}*`).join(" AND ")})`;
25950
25908
  }, "wordsMatch");
25951
25909
  var projectWhere = /* @__PURE__ */ __name((node) => {
25952
25910
  if (node.operator === "wildcard" && node.value === "*")
@@ -25972,13 +25930,13 @@ var assigneeWhere = /* @__PURE__ */ __name((node) => {
25972
25930
  return { sql: `EXISTS (${ASSIGNED} AND a.assignee_id = ?)`, params: [Number(id2)] };
25973
25931
  }, "assigneeWhere");
25974
25932
  var bound3 = /* @__PURE__ */ __name((value, side, node) => {
25975
- const word = value.trim().toLowerCase();
25976
- if (word === "*")
25933
+ const word2 = value.trim().toLowerCase();
25934
+ if (word2 === "*")
25977
25935
  return void 0;
25978
- if (PRIORITY_LABELS.includes(word))
25979
- return priorityBand(word)[side];
25980
- const number3 = Number(word);
25981
- if (word === "" || !Number.isFinite(number3) || number3 < 0 || number3 > 1)
25936
+ if (PRIORITY_LABELS.includes(word2))
25937
+ return priorityBand(word2)[side];
25938
+ const number3 = Number(word2);
25939
+ if (word2 === "" || !Number.isFinite(number3) || number3 < 0 || number3 > 1)
25982
25940
  throw new CliError("validation_error", `priority: takes ${PRIORITY_LABELS.join(", ")}, none, or 0 to 1, not "${node.value}"`);
25983
25941
  return number3;
25984
25942
  }, "bound");
@@ -25990,12 +25948,12 @@ var priorityWhere = /* @__PURE__ */ __name((node) => {
25990
25948
  throw new CliError("validation_error", "priority: takes a label, none, or a range");
25991
25949
  }
25992
25950
  if (node.operator !== "range") {
25993
- const word = node.value.trim().toLowerCase();
25994
- if (word === "none")
25951
+ const word2 = node.value.trim().toLowerCase();
25952
+ if (word2 === "none")
25995
25953
  return { sql: `${score} IS NULL`, params: [] };
25996
- if (!PRIORITY_LABELS.includes(word))
25954
+ if (!PRIORITY_LABELS.includes(word2))
25997
25955
  throw new CliError("validation_error", `priority: takes ${PRIORITY_LABELS.join(", ")} or none; a number goes in a range`);
25998
- const { from: from2, to } = priorityBand(word);
25956
+ const { from: from2, to } = priorityBand(word2);
25999
25957
  return { sql: `${score} >= ? AND ${score} ${to === 1 ? "<=" : "<"} ?`, params: [from2, to] };
26000
25958
  }
26001
25959
  const lower = bound3(node.value, "from", node);
@@ -26123,7 +26081,7 @@ var withoutField = /* @__PURE__ */ __name((query, name) => {
26123
26081
  return root === void 0 ? void 0 : { ...query, root };
26124
26082
  }, "withoutField");
26125
26083
 
26126
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
26084
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
26127
26085
  var authorNamed = /* @__PURE__ */ __name((database, row2) => {
26128
26086
  if (row2.author_type == null)
26129
26087
  return null;
@@ -26151,7 +26109,7 @@ var addComment = /* @__PURE__ */ __name((context, task, body2, by) => {
26151
26109
  return commentsOf(database, task).find((one2) => one2.ref === `note:${made}`);
26152
26110
  }, "addComment");
26153
26111
 
26154
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
26112
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
26155
26113
  var TASK_RELATION_KINDS = [
26156
26114
  "blocked-by",
26157
26115
  "follow-up-of",
@@ -26281,7 +26239,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
26281
26239
  };
26282
26240
  }, "taskRelationsStoreOver");
26283
26241
 
26284
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
26242
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
26285
26243
  var TASK_ROLES = ["assignee", "reviewer", "watcher"];
26286
26244
  var iso4 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
26287
26245
  var recordTaskEvent = /* @__PURE__ */ __name((database, task, actor, kind4, changes, at) => {
@@ -26801,7 +26759,7 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
26801
26759
  };
26802
26760
  }, "workTasksOver");
26803
26761
 
26804
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
26762
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
26805
26763
  var taskCloseOver = /* @__PURE__ */ __name((context) => {
26806
26764
  const { database, now: now2 } = context;
26807
26765
  const liveRow = /* @__PURE__ */ __name((id2) => {
@@ -26850,7 +26808,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
26850
26808
  };
26851
26809
  }, "taskCloseOver");
26852
26810
 
26853
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
26811
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
26854
26812
  var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
26855
26813
  const { database, now: now2 } = context;
26856
26814
  const required3 = /* @__PURE__ */ __name((id2) => {
@@ -27068,7 +27026,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
27068
27026
  };
27069
27027
  }, "taskPairsOver");
27070
27028
 
27071
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/task-stats.js
27029
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/task-stats.js
27072
27030
  var ACCOUNT_SCOPE = "t.package_id IS NOT NULL AND t.deleted_at IS NULL AND t.project_id = ?";
27073
27031
  var TASK_STATS_SQL = {
27074
27032
  rows: /* @__PURE__ */ __name((board, filter) => `SELECT t.source_group, t.source_kind, t.project_id, t.status, t.created_at, t.closed_at FROM tasks t WHERE ${board ? BOARD_SCOPE : ACCOUNT_SCOPE}${filter} ORDER BY t.created_at, t.id`, "rows"),
@@ -27107,7 +27065,7 @@ var taskStatsOver = /* @__PURE__ */ __name(({ database }, inbox) => ({
27107
27065
  }, "statNames")
27108
27066
  }), "taskStatsOver");
27109
27067
 
27110
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
27068
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
27111
27069
  var COLUMNS3 = "t.id AS row_id, t.package_id, t.source_locator, t.source_kind, t.source_group, t.type, t.status, t.close_reason, t.source, t.created_at, t.due_at, t.closed_at, t.closed_by_type, t.closed_by_id, t.key, t.category, t.claimed_by, t.claimed_until, p.name AS account";
27112
27070
  var inboxProject = /* @__PURE__ */ __name(({ database, now: now2 }, account, create) => {
27113
27071
  const key2 = inboxKey(account);
@@ -27314,7 +27272,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
27314
27272
  throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
27315
27273
  }, "oneOf");
27316
27274
 
27317
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/accounts.js
27275
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/accounts.js
27318
27276
  var accountAccountsOver = /* @__PURE__ */ __name((context) => {
27319
27277
  const { database } = context;
27320
27278
  const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
@@ -27359,7 +27317,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
27359
27317
  };
27360
27318
  }, "accountsStoreOver");
27361
27319
 
27362
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
27320
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
27363
27321
  var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
27364
27322
  var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
27365
27323
  const message2 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
@@ -27383,7 +27341,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
27383
27341
  })), "keepDownloads");
27384
27342
  var keepProviderRefs = /* @__PURE__ */ __name((context, chatKey, messageId, files2) => updatePlaced(context, chatKey, messageId, files2.filter((file) => Object.keys(file.providerRef).length > 0), (file) => refColumn(file.providerRef)), "keepProviderRefs");
27385
27343
 
27386
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/attachments.js
27344
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/attachments.js
27387
27345
  var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
27388
27346
  const { database } = context;
27389
27347
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -27440,7 +27398,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
27440
27398
  }, "keepAttachmentText")
27441
27399
  }), "attachmentsStoreOver");
27442
27400
 
27443
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
27401
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
27444
27402
  var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
27445
27403
  var pointerMover = /* @__PURE__ */ __name((context, type) => {
27446
27404
  const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
@@ -27620,7 +27578,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
27620
27578
  return done;
27621
27579
  }, "rekeyChats");
27622
27580
 
27623
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
27581
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
27624
27582
  var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
27625
27583
  var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
27626
27584
  var CHAT_LIST_KEY = "chat_list_complete";
@@ -27678,7 +27636,7 @@ var chatCoverage = /* @__PURE__ */ __name(({ database }, accountKey) => {
27678
27636
  return { ...coverage, oldestMessageAt: toIso(oldest) };
27679
27637
  }, "chatCoverage");
27680
27638
 
27681
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/chats.js
27639
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/chats.js
27682
27640
  var chatsStoreOver = /* @__PURE__ */ __name((context) => {
27683
27641
  const { database } = context;
27684
27642
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
@@ -27813,7 +27771,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
27813
27771
  };
27814
27772
  }, "chatsStoreOver");
27815
27773
 
27816
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
27774
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
27817
27775
  import { createHash as createHash7 } from "node:crypto";
27818
27776
  var BATCH_CONTEXT = 50;
27819
27777
  var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
@@ -27951,7 +27909,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
27951
27909
  var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
27952
27910
  ${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
27953
27911
 
27954
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
27912
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
27955
27913
  import { setTimeout } from "node:timers/promises";
27956
27914
  var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
27957
27915
  var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
@@ -28263,7 +28221,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
28263
28221
  AND NOT EXISTS (SELECT 1 FROM messages d
28264
28222
  WHERE d.id IN (l.message_id, l.parent_id) AND d.deleted_at > l.created_at)`).map(({ id: id2, parent: parent2 }) => [id2, parent2])), "agentAnswers");
28265
28223
 
28266
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/conversations.js
28224
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/conversations.js
28267
28225
  var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
28268
28226
  const { database } = context;
28269
28227
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -28370,7 +28328,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
28370
28328
  };
28371
28329
  }, "conversationsStoreOver");
28372
28330
 
28373
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/counters.js
28331
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/counters.js
28374
28332
  var LIVE_MESSAGE = "SELECT m.id AS pk FROM messages m JOIN chats c ON c.id=m.chat_id JOIN accounts ac ON ac.id=m.account_id WHERE ac.provider=? AND ac.external_id=? AND c.external_id=? AND m.external_id=? AND m.deleted_at IS NULL";
28375
28333
  var accountCountersOver = /* @__PURE__ */ __name((context) => {
28376
28334
  const { database } = context;
@@ -28395,7 +28353,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
28395
28353
  counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
28396
28354
  }), "countersStoreOver");
28397
28355
 
28398
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
28356
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
28399
28357
  var MENTION_STATUSES = ["found", "linked", "dismissed"];
28400
28358
  var MENTION_QUERY = defineQuery({
28401
28359
  entity: "mention",
@@ -28611,7 +28569,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
28611
28569
  return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
28612
28570
  }, "listPlaces");
28613
28571
 
28614
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/mentions.js
28572
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/mentions.js
28615
28573
  var accountMentionsOver = /* @__PURE__ */ __name((context) => {
28616
28574
  const { database } = context;
28617
28575
  const { findAccountPk: findAccountPk2 } = keysOver(context);
@@ -28646,7 +28604,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
28646
28604
  places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
28647
28605
  }), "mentionsStoreOver");
28648
28606
 
28649
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
28607
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
28650
28608
  var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
28651
28609
  const read2 = database.prepare("SELECT m.id, m.external_id, m.text, m.sent_at, m.sender_name, coalesce(m.sender_chat_external_id, i.external_id) AS sender_id FROM messages m LEFT JOIN identities i ON i.id = m.sender_identity_id WHERE m.chat_id = ? AND m.deleted_at IS NULL AND (m.text LIKE '%google.com%' OR m.text LIKE '%forms.gle%') " + (messageId === void 0 ? "" : "AND m.external_id = ? ") + "ORDER BY m.sent_at DESC, m.id DESC");
28652
28610
  const rows = messageId === void 0 ? read2.all(chatKey) : read2.all(chatKey, messageId);
@@ -28661,7 +28619,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
28661
28619
  }));
28662
28620
  }, "documentLinkMessages");
28663
28621
 
28664
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
28622
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
28665
28623
  var stemmerFor = stemmerCache();
28666
28624
  var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
28667
28625
  if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
@@ -28696,7 +28654,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
28696
28654
  const row2 = message2.get(chatId, id2, account.provider, account.account);
28697
28655
  if (!row2)
28698
28656
  return [];
28699
- const stems = new Set(stemmer.explain(String(row2.text)).filter(({ word }) => new RegExp("^\\p{L}{3,}$", "u").test(word)).map(({ word }) => stemmer.stemToken(word)).filter(Boolean));
28657
+ const stems = new Set(stemmer.explain(String(row2.text)).filter(({ word: word2 }) => new RegExp("^\\p{L}{3,}$", "u").test(word2)).map(({ word: word2 }) => stemmer.stemToken(word2)).filter(Boolean));
28700
28658
  const rare = [...stems].filter((stem) => countOf(stem) <= rareAt);
28701
28659
  if (!rare.length)
28702
28660
  return [];
@@ -28705,7 +28663,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
28705
28663
  });
28706
28664
  }, "laterSharingRare");
28707
28665
 
28708
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/messages.js
28666
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/messages.js
28709
28667
  var accountMessagesOver = /* @__PURE__ */ __name((context) => {
28710
28668
  const { database } = context;
28711
28669
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
@@ -28840,7 +28798,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
28840
28798
  laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
28841
28799
  }), "messagesStoreOver");
28842
28800
 
28843
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
28801
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
28844
28802
  var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
28845
28803
  var iso5 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
28846
28804
  var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: accounts2, limit }) => {
@@ -28865,7 +28823,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
28865
28823
  project: row2.project_id == null ? null : `project:${row2.project_id}`,
28866
28824
  updatedAt: iso5(row2.updated_at)
28867
28825
  }));
28868
- const notes3 = database.prepare(`SELECT n.id,n.title,n.body,n.revision,n.updated_at FROM notes n
28826
+ const notes2 = database.prepare(`SELECT n.id,n.title,n.body,n.revision,n.updated_at FROM notes n
28869
28827
  JOIN persons owner ON n.author_type='person' AND n.author_id=owner.id AND owner.owner=1
28870
28828
  WHERE n.deleted_at IS NULL
28871
28829
  AND ((n.notable_type='person' AND n.notable_id=?) OR EXISTS(SELECT 1 FROM links l WHERE l.from_type='note'
@@ -28893,11 +28851,11 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
28893
28851
  source: row2.source_locator == null ? null : String(row2.source_locator),
28894
28852
  createdAt: iso5(row2.created_at)
28895
28853
  }));
28896
- return { facts: page3(facts2), notes: page3(notes3), tasks: page3(tasks2) };
28854
+ return { facts: page3(facts2), notes: page3(notes2), tasks: page3(tasks2) };
28897
28855
  });
28898
28856
  }, "personPreparation");
28899
28857
 
28900
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
28858
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
28901
28859
  var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
28902
28860
  const id2 = Number(uid);
28903
28861
  if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
@@ -28905,7 +28863,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
28905
28863
  return Boolean(database.prepare("SELECT 1 FROM persons p JOIN identity_links l ON l.person_id=p.id JOIN account_identities a ON a.identity_id=l.identity_id WHERE p.id=? AND a.account_id IN (SELECT value FROM json_each(?)) LIMIT 1").get(id2, JSON.stringify(accountIds)));
28906
28864
  }, "personSeenInAccounts");
28907
28865
 
28908
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
28866
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
28909
28867
  var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
28910
28868
  const row2 = database.prepare("SELECT a.id AS account_id, i.id AS identity_id FROM accounts a JOIN account_identities ai ON ai.account_id=a.id JOIN identities i ON i.id=ai.identity_id WHERE a.provider=? AND a.external_id=? AND i.provider=? AND i.external_id=?").get(key2.provider, key2.account, key2.provider, personId);
28911
28869
  if (!row2)
@@ -28924,8 +28882,8 @@ var NOTES_ABOUT = "SELECT n.* FROM notes n WHERE notable_type='identity' AND not
28924
28882
  var privateContact = /* @__PURE__ */ __name((context, key2, personId) => {
28925
28883
  const { account, identity } = required2(context, key2, personId);
28926
28884
  const alias2 = context.database.prepare("SELECT name AS alias FROM aliases WHERE account_id=? AND aliasable_type='identity' AND aliasable_id=? AND display=1").get(account, identity)?.alias;
28927
- const notes3 = context.database.prepare(`${NOTES_ABOUT} ORDER BY n.created_at, n.id`).all(identity).map((row2) => noteOf2(row2, personId));
28928
- return { personId, alias: alias2 == null ? null : String(alias2), notes: notes3 };
28885
+ const notes2 = context.database.prepare(`${NOTES_ABOUT} ORDER BY n.created_at, n.id`).all(identity).map((row2) => noteOf2(row2, personId));
28886
+ return { personId, alias: alias2 == null ? null : String(alias2), notes: notes2 };
28929
28887
  }, "privateContact");
28930
28888
  var setAlias = /* @__PURE__ */ __name((context, key2, personId, alias2) => {
28931
28889
  const { account, identity } = required2(context, key2, personId);
@@ -28971,7 +28929,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
28971
28929
  return { id: id2, personId, removed: true };
28972
28930
  }, "removeNote");
28973
28931
 
28974
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/people.js
28932
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/people.js
28975
28933
  var accountPeopleOver = /* @__PURE__ */ __name((context) => {
28976
28934
  const { database } = context;
28977
28935
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
@@ -29056,13 +29014,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
29056
29014
  };
29057
29015
  }, "peopleStoreOver");
29058
29016
 
29059
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
29017
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
29060
29018
  import { createHash as createHash9 } from "node:crypto";
29061
29019
 
29062
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
29020
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
29063
29021
  import { createHash as createHash8 } from "node:crypto";
29064
29022
 
29065
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
29023
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
29066
29024
  var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
29067
29025
  var AUTHOR_MEASURES = [
29068
29026
  "messages",
@@ -29202,7 +29160,7 @@ var withoutUrls = /* @__PURE__ */ __name((text6) => text6.replace(/\S+/gu, (toke
29202
29160
  var rankingWords = /* @__PURE__ */ __name((text6) => withoutUrls(text6).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
29203
29161
  var rankingQuestion = /* @__PURE__ */ __name((text6) => withoutUrls(text6).includes("?"), "rankingQuestion");
29204
29162
 
29205
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
29163
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
29206
29164
  var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
29207
29165
  var exhausted2 = /* @__PURE__ */ __name((budget) => {
29208
29166
  throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
@@ -29424,7 +29382,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
29424
29382
  };
29425
29383
  }, "rankReplyGraph");
29426
29384
 
29427
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
29385
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
29428
29386
  var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
29429
29387
  var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
29430
29388
  var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
@@ -29598,7 +29556,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
29598
29556
  return { items, evidence, summary, graph: graph.quality };
29599
29557
  }, "calculateAdminStatistics");
29600
29558
 
29601
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
29559
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
29602
29560
  var rankingContextRange = /* @__PURE__ */ __name((root) => {
29603
29561
  const dates = [];
29604
29562
  const visit = /* @__PURE__ */ __name((node, required3) => {
@@ -29620,7 +29578,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
29620
29578
  return dates[0].node.resolution.date;
29621
29579
  }, "rankingContextRange");
29622
29580
 
29623
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
29581
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
29624
29582
  var reactionCounts = /* @__PURE__ */ __name((stored3) => {
29625
29583
  let counts;
29626
29584
  try {
@@ -29915,7 +29873,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
29915
29873
  });
29916
29874
  }, "rankQuery");
29917
29875
 
29918
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
29876
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
29919
29877
  function fail4(message2, reason = "query.too-large") {
29920
29878
  throw new CliError("validation_error", message2, { reason, complete: false });
29921
29879
  }
@@ -30092,7 +30050,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
30092
30050
  return result;
30093
30051
  }), "adminStatisticsQuery");
30094
30052
 
30095
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
30053
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
30096
30054
  var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
30097
30055
  if (!execution.accounts.length)
30098
30056
  return { conversations: [], chats: [] };
@@ -30110,7 +30068,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
30110
30068
  return { conversations: conversations2, chats: chats2 };
30111
30069
  }, "conversationEligibility");
30112
30070
 
30113
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
30071
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
30114
30072
  import { createHash as createHash10 } from "node:crypto";
30115
30073
  var EVIDENCE_BYTES = 64 * 1024;
30116
30074
  var FINGERPRINT_BYTES = 8 * 1024 * 1024;
@@ -30260,7 +30218,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
30260
30218
  return result;
30261
30219
  }, "rankingEvidence");
30262
30220
 
30263
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/reply-times.js
30221
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/reply-times.js
30264
30222
  var FAR = Number.MAX_SAFE_INTEGER;
30265
30223
  var chatsIn = /* @__PURE__ */ __name((scope3, kinds2) => {
30266
30224
  const params = [...scope3.accounts.flatMap(({ provider, account }) => [provider, account]), ...kinds2];
@@ -30354,7 +30312,7 @@ var waitingChats = /* @__PURE__ */ __name((context, scope3, waits, cap) => {
30354
30312
  });
30355
30313
  }, "waitingChats");
30356
30314
 
30357
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/queries.js
30315
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/queries.js
30358
30316
  var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
30359
30317
  const mailIndexed = /* @__PURE__ */ __name((execution) => {
30360
30318
  if (execution.corpus === "mail")
@@ -30375,7 +30333,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
30375
30333
  };
30376
30334
  }, "queriesStoreOver");
30377
30335
 
30378
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
30336
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
30379
30337
  var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
30380
30338
  const { database, now: now2 } = context;
30381
30339
  const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
@@ -30414,10 +30372,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
30414
30372
  }));
30415
30373
  }, "chatEventsOf");
30416
30374
 
30417
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
30375
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
30418
30376
  import { createHash as createHash11 } from "node:crypto";
30419
30377
 
30420
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/calendar.js
30378
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/calendar.js
30421
30379
  var calendarKey = /* @__PURE__ */ __name((zone, by) => {
30422
30380
  const format = new Intl.DateTimeFormat("en-CA", {
30423
30381
  timeZone: zone,
@@ -30437,7 +30395,7 @@ var weekKey = /* @__PURE__ */ __name((day) => {
30437
30395
  return date3.toISOString().slice(0, 10);
30438
30396
  }, "weekKey");
30439
30397
 
30440
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/retention.js
30398
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/retention.js
30441
30399
  var RETENTION_TOLERANCE = 864e5;
30442
30400
  var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
30443
30401
  const { since, until, cutoff, checkpoints, within, limit, by } = options;
@@ -30491,7 +30449,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
30491
30449
  return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
30492
30450
  }, "retentionCohorts");
30493
30451
 
30494
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
30452
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
30495
30453
  var iso6 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
30496
30454
  var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId, options, evidence) => {
30497
30455
  validateRetentionOptions(options);
@@ -30622,7 +30580,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
30622
30580
  };
30623
30581
  }, "retentionQuery");
30624
30582
 
30625
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
30583
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
30626
30584
  var iso7 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
30627
30585
  var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
30628
30586
  ...isBot === void 0 ? {} : { bot: isBot },
@@ -30753,7 +30711,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
30753
30711
  lastCount: memberCountsOf(context, pk).at(-1) ?? null
30754
30712
  })), "trackedChats");
30755
30713
 
30756
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/roster.js
30714
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/roster.js
30757
30715
  var rosterStoreOver = /* @__PURE__ */ __name((context) => {
30758
30716
  const { database } = context;
30759
30717
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
@@ -30809,7 +30767,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
30809
30767
  };
30810
30768
  }, "rosterStoreOver");
30811
30769
 
30812
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
30770
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
30813
30771
  var pendingNormalization = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM messages WHERE normalized_text IS NULL AND deleted_at IS NULL").get()?.n), "pendingNormalization");
30814
30772
  var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
30815
30773
  const next = database.prepare(`SELECT id AS pk, text FROM messages WHERE normalized_text IS NULL AND deleted_at IS NULL AND id > ? ORDER BY id LIMIT ?`);
@@ -30833,7 +30791,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
30833
30791
  }
30834
30792
  }, "backfillNormalized");
30835
30793
 
30836
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
30794
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
30837
30795
  var INDEX2 = "message_words";
30838
30796
  var searchIndexState2 = /* @__PURE__ */ __name((database) => {
30839
30797
  const row2 = indexRow(database, INDEX2);
@@ -30897,11 +30855,11 @@ var newestMessage = /* @__PURE__ */ __name((database) => Number(database.prepare
30897
30855
  var termWriters = /* @__PURE__ */ __name((database) => {
30898
30856
  const term = database.prepare("INSERT OR IGNORE INTO search_terms (term, length) VALUES (?, ?)");
30899
30857
  const trigram = database.prepare("INSERT OR IGNORE INTO search_term_trigrams (trigram, length, term) VALUES (?, ?, ?)");
30900
- return (word) => {
30901
- term.run(word, word.length);
30902
- if (!/^\d+$/.test(word))
30903
- for (const piece of trigrams(word))
30904
- trigram.run(piece, word.length, word);
30858
+ return (word2) => {
30859
+ term.run(word2, word2.length);
30860
+ if (!/^\d+$/.test(word2))
30861
+ for (const piece of trigrams(word2))
30862
+ trigram.run(piece, word2.length, word2);
30905
30863
  };
30906
30864
  }, "termWriters");
30907
30865
  var refreshTerms = /* @__PURE__ */ __name((database, { batch, until, onBatch }) => {
@@ -30917,8 +30875,8 @@ var refreshTerms = /* @__PURE__ */ __name((database, { batch, until, onBatch })
30917
30875
  const to = Math.min(through + batch, newest);
30918
30876
  writeBatch(database, () => {
30919
30877
  const words3 = new Set(texts2.all(through, to).flatMap((row2) => String(row2.text).split(/[^\p{L}\p{N}]+/u).filter(Boolean)));
30920
- for (const word of words3)
30921
- addTerm(word);
30878
+ for (const word2 of words3)
30879
+ addTerm(word2);
30922
30880
  advance.run(to, INDEX2);
30923
30881
  added += words3.size;
30924
30882
  });
@@ -30938,8 +30896,8 @@ var buildTerms = /* @__PURE__ */ __name((database, { batch, until, onBatch }) =>
30938
30896
  if (terms2.length === 0)
30939
30897
  break;
30940
30898
  writeBatch(database, () => {
30941
- for (const word of terms2)
30942
- addTerm(word);
30899
+ for (const word2 of terms2)
30900
+ addTerm(word2);
30943
30901
  });
30944
30902
  written2 += terms2.length;
30945
30903
  after2 = terms2.at(-1) ?? after2;
@@ -30960,7 +30918,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
30960
30918
  });
30961
30919
  }, "resetSearchIndex");
30962
30920
 
30963
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
30921
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
30964
30922
  var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
30965
30923
  const filled2 = { stemmed: 0, drained: 0 };
30966
30924
  const before2 = stemsState(database);
@@ -31055,13 +31013,13 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
31055
31013
  return resetStems(database, { now: now2 });
31056
31014
  }, "followDefaultStemmers");
31057
31015
 
31058
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
31016
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
31059
31017
  var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
31060
31018
  var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
31061
31019
  const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
31062
31020
  return new Set(terms2.filter((term) => {
31063
- const word = normalize(term);
31064
- return lookup.get(word, `${word}\u{10FFFF}`) !== void 0;
31021
+ const word2 = normalize(term);
31022
+ return lookup.get(word2, `${word2}\u{10FFFF}`) !== void 0;
31065
31023
  }));
31066
31024
  }, "knownTerms");
31067
31025
  var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, longest }) => {
@@ -31077,7 +31035,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
31077
31035
  });
31078
31036
  }, "termCandidates");
31079
31037
 
31080
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/search-index.js
31038
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/search-index.js
31081
31039
  var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
31082
31040
  const { database } = context;
31083
31041
  const stemmerFor2 = stemmerCache();
@@ -31099,7 +31057,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
31099
31057
  };
31100
31058
  }, "searchIndexStoreOver");
31101
31059
 
31102
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
31060
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
31103
31061
  var HISTORY_KEPT = 1e3;
31104
31062
  var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
31105
31063
  var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
@@ -31168,7 +31126,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
31168
31126
  return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
31169
31127
  }, "clearHistory");
31170
31128
 
31171
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/searches.js
31129
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/searches.js
31172
31130
  var searchesStoreOver = /* @__PURE__ */ __name((context) => {
31173
31131
  const { database } = context;
31174
31132
  return {
@@ -31192,7 +31150,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
31192
31150
  };
31193
31151
  }, "searchesStoreOver");
31194
31152
 
31195
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
31153
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
31196
31154
  var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
31197
31155
  var ACTION_OUTCOMES = ["ok", "refused", "failed"];
31198
31156
  var CODE = /^[a-z][a-z0-9_]{0,63}$/;
@@ -31235,7 +31193,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
31235
31193
  };
31236
31194
  }, "agentActionsStoreOver");
31237
31195
 
31238
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
31196
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
31239
31197
  var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
31240
31198
  }) => {
31241
31199
  const { database, now: now2 } = context;
@@ -31294,7 +31252,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
31294
31252
  };
31295
31253
  }, "botUpdateStoreOver");
31296
31254
 
31297
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
31255
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
31298
31256
  var DAY4 = 864e5;
31299
31257
  var accountsOf = /* @__PURE__ */ __name((filter) => {
31300
31258
  if (filter.accountIds !== void 0 && filter.accountId !== void 0)
@@ -31403,7 +31361,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
31403
31361
  return database.prepare(`SELECT e.* FROM events e WHERE ${clauses.join(" AND ")} ORDER BY ${filter.newest ? "e.starts_at DESC, e.id DESC" : "e.starts_at, e.id"} LIMIT ? OFFSET ?`).all(...params, limit, offset).map(eventOf);
31404
31362
  }, "listEvents");
31405
31363
 
31406
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-forget.js
31364
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-forget.js
31407
31365
  var distinctIds = /* @__PURE__ */ __name((rows) => [...new Set(rows.map((row2) => Number(row2.id)))], "distinctIds");
31408
31366
  var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, accountId, cursorKey: cursorKey2, now: now2 }, refresh) => {
31409
31367
  const unseenBefore = unreferenced(database, "identities");
@@ -31458,7 +31416,7 @@ var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, account
31458
31416
  return { entries: entryIds.length, events: goneEvents.length };
31459
31417
  }, "forgetCalendarRows");
31460
31418
 
31461
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
31419
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
31462
31420
  var calendarOf = /* @__PURE__ */ __name((row2) => ({
31463
31421
  id: Number(row2.id),
31464
31422
  accountId: Number(row2.account_id),
@@ -32045,7 +32003,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
32045
32003
  };
32046
32004
  }, "eventStoreOver");
32047
32005
 
32048
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
32006
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
32049
32007
  var CATALOG_QUERY = defineQuery({
32050
32008
  entity: "document",
32051
32009
  backend: "sql",
@@ -32287,7 +32245,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
32287
32245
  };
32288
32246
  }, "catalogStoreOver");
32289
32247
 
32290
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
32248
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
32291
32249
  var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
32292
32250
  var field3 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
32293
32251
  CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
@@ -32300,7 +32258,7 @@ var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
32300
32258
  THEN 'source-modified' ELSE 'stored-update' END`;
32301
32259
  var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field3("sourceUrl")})`;
32302
32260
 
32303
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
32261
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
32304
32262
  var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
32305
32263
  const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
32306
32264
  signal?.throwIfAborted();
@@ -32346,7 +32304,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
32346
32304
  ...scope3,
32347
32305
  after2,
32348
32306
  before2,
32349
- words3.map((word) => `normalized_text:"${normalize(word)}"`).join(" AND ")
32307
+ words3.map((word2) => `normalized_text:"${normalize(word2)}"`).join(" AND ")
32350
32308
  ];
32351
32309
  if (cursor)
32352
32310
  params.push(cursor.at, cursor.at, cursor.id);
@@ -32399,7 +32357,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
32399
32357
  });
32400
32358
  }, "readMeetingContextEvidence");
32401
32359
 
32402
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
32360
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
32403
32361
  var corpora = {
32404
32362
  message: {
32405
32363
  table: "messages",
@@ -32638,7 +32596,7 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
32638
32596
  }
32639
32597
  }), "contextRecordsOver");
32640
32598
 
32641
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
32599
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
32642
32600
  var NOTE_FIELDS = [
32643
32601
  "text",
32644
32602
  "exact",
@@ -33068,7 +33026,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
33068
33026
  };
33069
33027
  }, "noteSearchOver");
33070
33028
 
33071
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
33029
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
33072
33030
  var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
33073
33031
  var inEventAccounts = /* @__PURE__ */ __name((event) => searchableCopy(event, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
33074
33032
  var EVENT_CORPUS = {
@@ -33200,20 +33158,20 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
33200
33158
  };
33201
33159
  }, "eventSearchOver");
33202
33160
 
33203
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/finance.js
33204
- var refuse2 = /* @__PURE__ */ __name((message2, reason, code = "validation_error") => {
33161
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/finance.js
33162
+ var refuse = /* @__PURE__ */ __name((message2, reason, code = "validation_error") => {
33205
33163
  throw new CliError(code, message2, { reason });
33206
33164
  }, "refuse");
33207
33165
  var oneOf4 = /* @__PURE__ */ __name((value, allowed, what) => {
33208
33166
  if (typeof value !== "string" || !allowed.includes(value))
33209
- return refuse2(`${what} is one of ${allowed.join(", ")}`, "finance.field");
33167
+ return refuse(`${what} is one of ${allowed.join(", ")}`, "finance.field");
33210
33168
  return value;
33211
33169
  }, "oneOf");
33212
33170
  var text3 = /* @__PURE__ */ __name((value, what, limit) => {
33213
33171
  if (value === void 0 || value === null)
33214
33172
  return null;
33215
33173
  if (typeof value !== "string" || !value.trim() || value.length > limit || value.includes("\0"))
33216
- return refuse2(`${what} takes 1\u2013${limit} characters`, "finance.field");
33174
+ return refuse(`${what} takes 1\u2013${limit} characters`, "finance.field");
33217
33175
  return value.trim();
33218
33176
  }, "text");
33219
33177
  var isoDate = /* @__PURE__ */ __name((value, what) => {
@@ -33221,7 +33179,7 @@ var isoDate = /* @__PURE__ */ __name((value, what) => {
33221
33179
  return null;
33222
33180
  const date3 = typeof value === "string" ? value.trim() : "";
33223
33181
  if (!/^\d{4}-\d{2}-\d{2}$/.test(date3) || (/* @__PURE__ */ new Date(`${date3}T00:00:00Z`)).toISOString().slice(0, 10) !== date3)
33224
- return refuse2(`${what} is a date such as 2026-11-15`, "finance.field");
33182
+ return refuse(`${what} is a date such as 2026-11-15`, "finance.field");
33225
33183
  return date3;
33226
33184
  }, "isoDate");
33227
33185
  var iso8 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
@@ -33229,7 +33187,7 @@ var evidenceList = /* @__PURE__ */ __name((value) => {
33229
33187
  if (value === void 0)
33230
33188
  return [];
33231
33189
  if (!Array.isArray(value) || value.length > 8 || value.some((one2) => typeof one2 !== "string" || !one2.trim()))
33232
- return refuse2("evidence is a list of at most 8 references", "finance.field");
33190
+ return refuse("evidence is a list of at most 8 references", "finance.field");
33233
33191
  return [...new Set(value.map((one2) => one2.trim()))];
33234
33192
  }, "evidenceList");
33235
33193
  var MAX_LINES = 500;
@@ -33246,8 +33204,8 @@ var reasonOf = /* @__PURE__ */ __name((metadata3) => {
33246
33204
  var PAID = "(SELECT coalesce(sum(a.amount), 0) FROM payment_allocations a JOIN payments p ON p.id = a.payment_id WHERE a.invoice_id = i.id AND p.review = 'confirmed' AND p.deleted_at IS NULL)";
33247
33205
  var INVOICES = `SELECT i.*, ${PAID} AS paid, b.name AS author_name, b.kind AS author_kind FROM invoices i LEFT JOIN bots b ON i.author_type = 'bot' AND b.id = i.author_id`;
33248
33206
  var PAYMENTS = "SELECT p.*, (SELECT coalesce(sum(amount), 0) FROM payment_allocations WHERE payment_id = p.id) AS allocated, b.name AS author_name, b.kind AS author_kind FROM payments p LEFT JOIN bots b ON p.author_type = 'bot' AND b.id = p.author_id";
33249
- var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33250
- const { database, now: now2 } = context;
33207
+ var reviewedRowsOver = /* @__PURE__ */ __name((context) => {
33208
+ const { database } = context;
33251
33209
  const partyOf = /* @__PURE__ */ __name((type, id2) => {
33252
33210
  if (type == null)
33253
33211
  return null;
@@ -33259,7 +33217,7 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33259
33217
  return void 0;
33260
33218
  const thing = requiredThing(database, reference2, what);
33261
33219
  if (thing.type !== "person" && thing.type !== "organization")
33262
- return refuse2(`${what} is a person: or organization: reference, not ${reference2}`, "finance.party");
33220
+ return refuse(`${what} is a person: or organization: reference, not ${reference2}`, "finance.party");
33263
33221
  return thing;
33264
33222
  }, "partyThing");
33265
33223
  const reviewedOf = /* @__PURE__ */ __name((row2, type) => ({
@@ -33274,6 +33232,44 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33274
33232
  createdAt: iso8(row2.created_at),
33275
33233
  updatedAt: iso8(row2.updated_at)
33276
33234
  }), "reviewedOf");
33235
+ const written2 = /* @__PURE__ */ __name((input) => {
33236
+ const owner = input.by === "owner";
33237
+ const { actor, model } = authorActor(context, input.by);
33238
+ const source2 = owner ? "owner" : text3(input.source, "a source", 80) ?? "agent";
33239
+ const reason = owner ? null : text3(input.reason, "a reason", 2e3);
33240
+ return {
33241
+ owner,
33242
+ actor,
33243
+ model,
33244
+ source: source2,
33245
+ review: owner ? "confirmed" : "proposed",
33246
+ confirmedType: owner ? actor.type : null,
33247
+ confirmedId: owner ? actor.id : null,
33248
+ metadata: reason === null ? null : JSON.stringify({ reason }),
33249
+ project: input.project === void 0 ? null : projectId(database, input.project),
33250
+ evidence: evidenceList(input.evidence)
33251
+ };
33252
+ }, "written");
33253
+ const keepEvidence = /* @__PURE__ */ __name((type, id2, by) => {
33254
+ if (by.evidence.length)
33255
+ linkEvidence(context, { type, id: id2 }, by.evidence, by.owner ? "owner" : "agent");
33256
+ }, "keepEvidence");
33257
+ const ownerOnly = /* @__PURE__ */ __name((by, what) => {
33258
+ if (by !== "owner")
33259
+ refuse(`only the owner ${what}`, "finance.owner-only", "permission_error");
33260
+ }, "ownerOnly");
33261
+ const keepDecision = /* @__PURE__ */ __name((table, id2, by, reason) => {
33262
+ const why = [by === "owner" ? void 0 : by.reason.trim(), reason?.trim() || void 0].filter(Boolean).join(": ");
33263
+ if (by === "owner" && !why)
33264
+ return;
33265
+ const decision = by === "owner" ? { by: "owner", reason: why } : { by: "agent", bot: by.bot, reason: why };
33266
+ database.prepare(`UPDATE ${table} SET metadata = json_set(coalesce(metadata, '{}'), '$.decision', json(?)) WHERE id = ?`).run(JSON.stringify(decision), id2);
33267
+ }, "keepDecision");
33268
+ return { partyOf, partyThing, reviewedOf, written: written2, keepEvidence, ownerOnly, keepDecision };
33269
+ }, "reviewedRowsOver");
33270
+ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33271
+ const { database, now: now2 } = context;
33272
+ const { partyOf, partyThing, reviewedOf, written: written2, keepEvidence, ownerOnly, keepDecision } = reviewedRowsOver(context);
33277
33273
  const invoiceOf2 = /* @__PURE__ */ __name((row2) => {
33278
33274
  const currency = String(row2.currency);
33279
33275
  const scale = scaleOf(currency);
@@ -33349,7 +33345,7 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33349
33345
  const rowOf2 = /* @__PURE__ */ __name((reference2, type) => {
33350
33346
  const thing = requiredThing(database, reference2.includes(":") ? reference2 : `${type}:${reference2}`, `the ${type}`);
33351
33347
  if (thing.type !== type)
33352
- return refuse2(`${reference2} is not an ${type}`, "finance.ref");
33348
+ return refuse(`${reference2} is not an ${type}`, "finance.ref");
33353
33349
  return database.prepare(`${type === "invoice" ? INVOICES : PAYMENTS} WHERE ${type[0]}.id = ?`).get(thing.id);
33354
33350
  }, "rowOf");
33355
33351
  const invoiceDetail = /* @__PURE__ */ __name((reference2) => {
@@ -33379,73 +33375,40 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33379
33375
  const invoice = rowOf2(reference2, "invoice");
33380
33376
  const [paymentRef, invoiceRef] = [`payment:${payment.id}`, `invoice:${invoice.id}`];
33381
33377
  if (invoice.deleted_at != null || invoice.review === "rejected")
33382
- refuse2(`${invoiceRef} is ${invoice.review === "rejected" ? "rejected" : "deleted"}`, "finance.allocate");
33378
+ refuse(`${invoiceRef} is ${invoice.review === "rejected" ? "rejected" : "deleted"}`, "finance.allocate");
33383
33379
  if (invoice.status === "draft" || invoice.status === "void")
33384
- refuse2(`${invoiceRef} is ${invoice.status}; only an issued invoice is paid`, "finance.allocate");
33380
+ refuse(`${invoiceRef} is ${invoice.status}; only an issued invoice is paid`, "finance.allocate");
33385
33381
  const currency = String(payment.currency);
33386
33382
  if (invoice.currency !== currency)
33387
- refuse2(`${paymentRef} is in ${currency} and ${invoiceRef} in ${String(invoice.currency)}; the store converts nothing`, "finance.currency");
33383
+ refuse(`${paymentRef} is in ${currency} and ${invoiceRef} in ${String(invoice.currency)}; the store converts nothing`, "finance.currency");
33388
33384
  const fromPayment = Number(database.prepare("SELECT coalesce(sum(amount), 0) AS n FROM payment_allocations WHERE payment_id = ?").get(Number(payment.id))?.n);
33389
33385
  if (fromPayment + units > Number(payment.amount))
33390
- refuse2(`${paymentRef} is ${moneyLabel(Number(payment.amount), currency)} and ${moneyLabel(fromPayment, currency)} of it is already allocated; ${moneyLabel(units, currency)} more is too much`, "finance.over-payment");
33386
+ refuse(`${paymentRef} is ${moneyLabel(Number(payment.amount), currency)} and ${moneyLabel(fromPayment, currency)} of it is already allocated; ${moneyLabel(units, currency)} more is too much`, "finance.over-payment");
33391
33387
  const toInvoice = Number(database.prepare("SELECT coalesce(sum(a.amount), 0) AS n FROM payment_allocations a JOIN payments p ON p.id = a.payment_id WHERE a.invoice_id = ? AND ((p.review = 'confirmed' AND p.deleted_at IS NULL) OR a.payment_id = ?)").get(Number(invoice.id), Number(payment.id))?.n);
33392
33388
  if (toInvoice + units > Number(invoice.total))
33393
- refuse2(`${invoiceRef} totals ${moneyLabel(Number(invoice.total), currency)} and ${moneyLabel(toInvoice, currency)} is already allocated to it; ${moneyLabel(units, currency)} more is too much`, "finance.over-invoice");
33389
+ refuse(`${invoiceRef} totals ${moneyLabel(Number(invoice.total), currency)} and ${moneyLabel(toInvoice, currency)} is already allocated to it; ${moneyLabel(units, currency)} more is too much`, "finance.over-invoice");
33394
33390
  const at = now2();
33395
33391
  database.prepare("INSERT INTO payment_allocations (payment_id, invoice_id, amount, author_type, author_id, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?) ON CONFLICT (payment_id, invoice_id) DO UPDATE SET amount = amount + excluded.amount, updated_at = excluded.updated_at").run(Number(payment.id), Number(invoice.id), units, actor.type, actor.id, at, at);
33396
33392
  return Number(invoice.id);
33397
33393
  }, "allocateRow");
33398
- const written2 = /* @__PURE__ */ __name((input) => {
33399
- const owner = input.by === "owner";
33400
- const { actor, model } = authorActor(context, input.by);
33401
- const source2 = owner ? "owner" : text3(input.source, "a source", 80) ?? "agent";
33402
- const reason = owner ? null : text3(input.reason, "a reason", 2e3);
33403
- return {
33404
- owner,
33405
- actor,
33406
- model,
33407
- source: source2,
33408
- review: owner ? "confirmed" : "proposed",
33409
- confirmedType: owner ? actor.type : null,
33410
- confirmedId: owner ? actor.id : null,
33411
- metadata: reason === null ? null : JSON.stringify({ reason }),
33412
- project: input.project === void 0 ? null : projectId(database, input.project),
33413
- evidence: evidenceList(input.evidence)
33414
- };
33415
- }, "written");
33416
- const keepEvidence = /* @__PURE__ */ __name((type, id2, by) => {
33417
- if (by.evidence.length)
33418
- linkEvidence(context, { type, id: id2 }, by.evidence, by.owner ? "owner" : "agent");
33419
- }, "keepEvidence");
33420
- const ownerOnly = /* @__PURE__ */ __name((by, what) => {
33421
- if (by !== "owner")
33422
- refuse2(`only the owner ${what}`, "finance.owner-only", "permission_error");
33423
- }, "ownerOnly");
33424
- const keepDecision = /* @__PURE__ */ __name((table, id2, by, reason) => {
33425
- const why = [by === "owner" ? void 0 : by.reason.trim(), reason?.trim() || void 0].filter(Boolean).join(": ");
33426
- if (by === "owner" && !why)
33427
- return;
33428
- const decision = by === "owner" ? { by: "owner", reason: why } : { by: "agent", bot: by.bot, reason: why };
33429
- database.prepare(`UPDATE ${table} SET metadata = json_set(coalesce(metadata, '{}'), '$.decision', json(?)) WHERE id = ?`).run(JSON.stringify(decision), id2);
33430
- }, "keepDecision");
33431
33394
  const coveredElsewhere = /* @__PURE__ */ __name((paymentId) => {
33432
33395
  const over = database.prepare("SELECT a.invoice_id, a.amount, i.total, i.currency, (SELECT coalesce(sum(o.amount), 0) FROM payment_allocations o JOIN payments p ON p.id = o.payment_id WHERE o.invoice_id = a.invoice_id AND o.payment_id <> a.payment_id AND p.review = 'confirmed' AND p.deleted_at IS NULL) AS others FROM payment_allocations a JOIN invoices i ON i.id = a.invoice_id WHERE a.payment_id = ? AND a.amount + others > i.total LIMIT 1").get(paymentId);
33433
33396
  if (!over)
33434
33397
  return;
33435
33398
  const currency = String(over.currency);
33436
- refuse2(`invoice:${over.invoice_id} is already covered by other payments: ${moneyLabel(Number(over.others), currency)} of ${moneyLabel(Number(over.total), currency)}; payment:${paymentId} would add ${moneyLabel(Number(over.amount), currency)}, so it stays proposed`, "finance.over-invoice");
33399
+ refuse(`invoice:${over.invoice_id} is already covered by other payments: ${moneyLabel(Number(over.others), currency)} of ${moneyLabel(Number(over.total), currency)}; payment:${paymentId} would add ${moneyLabel(Number(over.amount), currency)}, so it stays proposed`, "finance.over-invoice");
33437
33400
  }, "coveredElsewhere");
33438
33401
  const decide2 = /* @__PURE__ */ __name((reference2, by, reason, confirm) => {
33439
33402
  const thing = requiredThing(database, reference2, "the proposal");
33440
33403
  if (thing.type !== "invoice" && thing.type !== "payment")
33441
- return refuse2(`${reference2} is not an invoice: or payment:`, "finance.ref");
33404
+ return refuse(`${reference2} is not an invoice: or payment:`, "finance.ref");
33442
33405
  const type = thing.type;
33443
33406
  const table = type === "invoice" ? "invoices" : "payments";
33444
33407
  const row2 = rowOf2(reference2, type);
33445
33408
  const ref3 = `${type}:${row2.id}`;
33446
33409
  assertMayDecide({ id: ref3, proposedBy: proposerOf(database, row2.author_type, row2.author_id), ownerOnly: true }, by, context.decisions);
33447
33410
  if (row2.review !== "proposed")
33448
- refuse2(`${ref3} is already ${String(row2.review)}`, "proposal.wrong-state");
33411
+ refuse(`${ref3} is already ${String(row2.review)}`, "proposal.wrong-state");
33449
33412
  const id2 = Number(row2.id);
33450
33413
  write(database, () => {
33451
33414
  const at = now2();
@@ -33470,15 +33433,15 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33470
33433
  return;
33471
33434
  const own = row2.author_type === "bot" && row2.author_name != null && botKey(String(row2.author_name)) === botKey(by.bot);
33472
33435
  if (row2.review !== "proposed" || !own)
33473
- refuse2(`only the owner allocates payment:${row2.id}; a bot allocates only from a payment it proposed that is still proposed`, "finance.owner-only", "permission_error");
33436
+ refuse(`only the owner allocates payment:${row2.id}; a bot allocates only from a payment it proposed that is still proposed`, "finance.owner-only", "permission_error");
33474
33437
  }, "mayAllocate");
33475
33438
  const limitOf2 = /* @__PURE__ */ __name((limit) => Math.min(Math.max(limit ?? 100, 1), 500), "limitOf");
33476
33439
  return {
33477
33440
  addInvoice: /* @__PURE__ */ __name((input) => {
33478
33441
  const direction = oneOf4(input.direction, INVOICE_DIRECTIONS, "an invoice's direction");
33479
- const currency = currencyOf2(input.currency);
33442
+ const currency = currencyOf(input.currency);
33480
33443
  if (!Array.isArray(input.lines) || input.lines.length === 0 || input.lines.length > MAX_LINES)
33481
- refuse2(`an invoice has 1\u2013${MAX_LINES} lines`, "finance.lines");
33444
+ refuse(`an invoice has 1\u2013${MAX_LINES} lines`, "finance.lines");
33482
33445
  const lines = input.lines.map((line, at) => {
33483
33446
  const what = `line ${at + 1}`;
33484
33447
  const quantity = quantityOf(line.quantity ?? "1");
@@ -33486,11 +33449,11 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33486
33449
  const computed = unitPrice === null ? null : lineUnits(quantity.thousandths, unitPrice);
33487
33450
  const amount = line.amount === void 0 ? computed : minorUnits(line.amount, currency, `${what}'s amount`);
33488
33451
  if (amount === null)
33489
- return refuse2(`${what} takes a unit price, an amount or both`, "finance.lines");
33452
+ return refuse(`${what} takes a unit price, an amount or both`, "finance.lines");
33490
33453
  if (computed !== null && computed !== amount)
33491
- refuse2(`${what}: ${quantity.text} \xD7 ${moneyLabel(unitPrice, currency)} is ${moneyLabel(computed, currency)}, not ${moneyLabel(amount, currency)}`, "finance.line-amount");
33454
+ refuse(`${what}: ${quantity.text} \xD7 ${moneyLabel(unitPrice, currency)} is ${moneyLabel(computed, currency)}, not ${moneyLabel(amount, currency)}`, "finance.line-amount");
33492
33455
  return {
33493
- description: text3(line.description, `${what}'s description`, 500) ?? refuse2(`${what} needs a description`, "finance.lines"),
33456
+ description: text3(line.description, `${what}'s description`, 500) ?? refuse(`${what} needs a description`, "finance.lines"),
33494
33457
  quantity: quantity.text,
33495
33458
  unitPrice: unitPrice ?? (quantity.thousandths === 1000n ? amount : null),
33496
33459
  amount
@@ -33498,20 +33461,20 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33498
33461
  });
33499
33462
  const total = lines.reduce((sum, line) => sum + line.amount, 0);
33500
33463
  if (!Number.isSafeInteger(total))
33501
- refuse2("an invoice's total is too large", "finance.total");
33464
+ refuse("an invoice's total is too large", "finance.total");
33502
33465
  if (total <= 0)
33503
- refuse2("an invoice totals more than 0", "finance.total");
33466
+ refuse("an invoice totals more than 0", "finance.total");
33504
33467
  if (input.total !== void 0) {
33505
33468
  const printed = minorUnits(input.total, currency, "an invoice's total");
33506
33469
  if (printed !== total)
33507
- refuse2(`the invoice's total ${moneyLabel(printed, currency)} is not the sum of its lines, ${moneyLabel(total, currency)}`, "finance.total");
33470
+ refuse(`the invoice's total ${moneyLabel(printed, currency)} is not the sum of its lines, ${moneyLabel(total, currency)}`, "finance.total");
33508
33471
  }
33509
33472
  const number3 = text3(input.number, "an invoice's number", 80);
33510
33473
  const issueDate = isoDate(input.issueDate, "an invoice's issue date");
33511
33474
  const dueDate = isoDate(input.dueDate, "an invoice's due date");
33512
33475
  const id2 = write(database, () => {
33513
33476
  const issuer = partyThing(input.issuer, "the issuer");
33514
- const counterparty = partyThing(input.counterparty, "the counterparty") ?? refuse2("an invoice names its counterparty, a person: or organization:", "finance.party");
33477
+ const counterparty = partyThing(input.counterparty, "the counterparty") ?? refuse("an invoice names its counterparty, a person: or organization:", "finance.party");
33515
33478
  const by = written2(input);
33516
33479
  const at = now2();
33517
33480
  const made = Number(database.prepare("INSERT INTO invoices (direction, number, issuer_type, issuer_id, counterparty_type, counterparty_id, project_id, currency, total, issue_date, due_date, status, review, author_type, author_id, model, confirmed_by_type, confirmed_by_id, source, metadata, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(direction, number3, issuer?.type ?? null, issuer?.id ?? null, counterparty.type, counterparty.id, by.project, currency, total, issueDate, dueDate, input.draft ? "draft" : "issued", by.review, by.actor.type, by.actor.id, by.model, by.confirmedType, by.confirmedId, by.source, by.metadata, at, at)?.id);
@@ -33536,7 +33499,7 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33536
33499
  ownerOnly(by, "issues an invoice");
33537
33500
  const row2 = rowOf2(reference2, "invoice");
33538
33501
  if (row2.status !== "draft")
33539
- refuse2(`invoice:${row2.id} is ${String(row2.status)}, not a draft`, "finance.status");
33502
+ refuse(`invoice:${row2.id} is ${String(row2.status)}, not a draft`, "finance.status");
33540
33503
  write(database, () => {
33541
33504
  database.prepare("UPDATE invoices SET status = 'issued', updated_at = ? WHERE id = ?").run(now2(), Number(row2.id));
33542
33505
  settle(Number(row2.id));
@@ -33547,10 +33510,10 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33547
33510
  ownerOnly(by, "voids an invoice");
33548
33511
  const row2 = rowOf2(reference2, "invoice");
33549
33512
  if (row2.status === "void")
33550
- refuse2(`invoice:${row2.id} is already void`, "finance.status");
33513
+ refuse(`invoice:${row2.id} is already void`, "finance.status");
33551
33514
  const allocated = database.prepare("SELECT 1 FROM payment_allocations a JOIN payments p ON p.id = a.payment_id WHERE a.invoice_id = ? AND p.review = 'confirmed' AND p.deleted_at IS NULL LIMIT 1").get(Number(row2.id));
33552
33515
  if (allocated)
33553
- refuse2(`payments are allocated to invoice:${row2.id}; a paid invoice is not voided`, "finance.status");
33516
+ refuse(`payments are allocated to invoice:${row2.id}; a paid invoice is not voided`, "finance.status");
33554
33517
  write(database, () => {
33555
33518
  database.prepare("DELETE FROM payment_allocations WHERE invoice_id = ? AND payment_id IN (SELECT id FROM payments WHERE review = 'proposed')").run(Number(row2.id));
33556
33519
  database.prepare("UPDATE invoices SET status = 'void', updated_at = ? WHERE id = ?").run(now2(), Number(row2.id));
@@ -33559,11 +33522,11 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33559
33522
  }, "voidInvoice"),
33560
33523
  addPayment: /* @__PURE__ */ __name((input) => {
33561
33524
  const direction = oneOf4(input.direction, MONEY_DIRECTIONS, "a payment's direction");
33562
- const currency = currencyOf2(input.currency);
33525
+ const currency = currencyOf(input.currency);
33563
33526
  const amount = minorUnits(input.amount, currency, "a payment's amount");
33564
33527
  if (amount <= 0)
33565
- refuse2("a payment's amount is more than 0", "money.amount");
33566
- const date3 = isoDate(input.date, "a payment's date") ?? refuse2("a payment has a date", "finance.field");
33528
+ refuse("a payment's amount is more than 0", "money.amount");
33529
+ const date3 = isoDate(input.date, "a payment's date") ?? refuse("a payment has a date", "finance.field");
33567
33530
  const reference2 = text3(input.reference, "a payment's reference", 500);
33568
33531
  const allocations = (input.allocations ?? []).map(({ invoice, amount: share }) => ({
33569
33532
  invoice,
@@ -33596,11 +33559,11 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33596
33559
  const ref3 = `payment:${row2.id}`;
33597
33560
  mayAllocate(row2, by);
33598
33561
  if (row2.review === "rejected" || row2.deleted_at != null)
33599
- refuse2(`${ref3} is ${String(row2.review)}`, "finance.allocate");
33562
+ refuse(`${ref3} is ${String(row2.review)}`, "finance.allocate");
33600
33563
  const currency = String(row2.currency);
33601
33564
  const units = minorUnits(amount, currency, "an allocation");
33602
33565
  if (units <= 0)
33603
- refuse2("an allocation is more than 0", "money.amount");
33566
+ refuse("an allocation is more than 0", "money.amount");
33604
33567
  const invoiceId = write(database, () => {
33605
33568
  const { actor } = authorActor(context, by);
33606
33569
  const made = allocateRow(row2, invoice, units, actor);
@@ -33615,7 +33578,7 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33615
33578
  const ref3 = `payment:${row2.id}`;
33616
33579
  mayAllocate(row2, by);
33617
33580
  if (row2.review === "rejected" || row2.deleted_at != null)
33618
- refuse2(`${ref3} is ${row2.deleted_at != null ? "deleted" : "rejected"}; only a proposed or confirmed payment's allocations are taken back`, "finance.unallocate");
33581
+ refuse(`${ref3} is ${row2.deleted_at != null ? "deleted" : "rejected"}; only a proposed or confirmed payment's allocations are taken back`, "finance.unallocate");
33619
33582
  const target = rowOf2(invoice, "invoice");
33620
33583
  write(database, () => {
33621
33584
  const gone = database.prepare("DELETE FROM payment_allocations WHERE payment_id = ? AND invoice_id = ?").run(Number(row2.id), Number(target.id));
@@ -33656,20 +33619,20 @@ var financeStoreOver = /* @__PURE__ */ __name((context) => {
33656
33619
  };
33657
33620
  }, "financeStoreOver");
33658
33621
 
33659
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-entries.js
33660
- var refuse3 = /* @__PURE__ */ __name((message2, reason) => {
33622
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-entries.js
33623
+ var refuse2 = /* @__PURE__ */ __name((message2, reason) => {
33661
33624
  throw new CliError("validation_error", message2, { reason });
33662
33625
  }, "refuse");
33663
33626
  var entryAmount = /* @__PURE__ */ __name((payment) => {
33664
33627
  const scale = scaleOf(payment.currency);
33665
33628
  const cents = parseDecimal(payment.amount, 2);
33666
33629
  if (cents === void 0)
33667
- return refuse3(`${payment.amount} is not an amount`, "money.amount");
33630
+ return refuse2(`${payment.amount} is not an amount`, "money.amount");
33668
33631
  const shift = 10n ** BigInt(Math.abs(scale - 2));
33669
33632
  if (scale >= 2)
33670
33633
  return formatDecimal(cents * shift, scale);
33671
33634
  if (cents % shift !== 0n)
33672
- return refuse3(`${payment.currency} has ${scale} decimals; ${payment.amount} does not fit`, "money.amount");
33635
+ return refuse2(`${payment.currency} has ${scale} decimals; ${payment.amount} does not fit`, "money.amount");
33673
33636
  return formatDecimal(cents / shift, scale);
33674
33637
  }, "entryAmount");
33675
33638
  var party = /* @__PURE__ */ __name((payment) => /^(person|organization):/.test(payment.counterparty ?? "") ? payment.counterparty : null, "party");
@@ -33699,7 +33662,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
33699
33662
  const counterparty = party(payment);
33700
33663
  if (payment.state === "cancelled") {
33701
33664
  if (entry2.supersedes === void 0)
33702
- return refuse3("a cancelled payment names the invoice it cancels", "finance.ref");
33665
+ return refuse2("a cancelled payment names the invoice it cancels", "finance.ref");
33703
33666
  if (outcome === "proposed" || !outcome.confirm)
33704
33667
  return entry2.supersedes;
33705
33668
  if (outcome.by !== "owner")
@@ -33708,7 +33671,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
33708
33671
  }
33709
33672
  if (payment.state === "expected") {
33710
33673
  if (counterparty === null)
33711
- return refuse3("an expected payment is an invoice, which names a person: or organization:", "finance.party");
33674
+ return refuse2("an expected payment is an invoice, which names a person: or organization:", "finance.party");
33712
33675
  const invoice = finance.addInvoice({
33713
33676
  ...written2,
33714
33677
  direction: payment.direction === "to_us" ? "receivable" : "payable",
@@ -33734,7 +33697,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
33734
33697
  };
33735
33698
  }, "paymentEntriesOver");
33736
33699
 
33737
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
33700
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
33738
33701
  var EVIDENCE_FINDINGS_KIND = "evidence_findings";
33739
33702
  var reference = /* @__PURE__ */ __name((raw) => {
33740
33703
  if (/^(document|note):[1-9]\d*$/.test(raw))
@@ -33760,7 +33723,7 @@ var validateEvidenceFindings = /* @__PURE__ */ __name((input) => {
33760
33723
  return valid;
33761
33724
  }, "validateEvidenceFindings");
33762
33725
 
33763
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/moment.js
33726
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/moment.js
33764
33727
  var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
33765
33728
  try {
33766
33729
  return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
@@ -33772,7 +33735,7 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
33772
33735
  }
33773
33736
  }, "calendarMoment");
33774
33737
 
33775
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
33738
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
33776
33739
  var NAMED3 = "SELECT f.*, b.name AS author_name, b.kind AS author_kind FROM facts f LEFT JOIN bots b ON f.author_type = 'bot' AND b.id = f.author_id";
33777
33740
  var iso9 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
33778
33741
  var oneOf5 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -33981,7 +33944,7 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
33981
33944
  };
33982
33945
  }, "factsStoreOver");
33983
33946
 
33984
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
33947
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
33985
33948
  var invalid4 = /* @__PURE__ */ __name((message2) => {
33986
33949
  throw new CliError("validation_error", message2);
33987
33950
  }, "invalid");
@@ -34083,7 +34046,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind4) => {
34083
34046
  return { snapshot: snapshot2, snapshotParts, previous, outcomes, create };
34084
34047
  }, "findingsCoreOver");
34085
34048
 
34086
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
34049
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
34087
34050
  var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
34088
34051
  var PROPOSAL_VERDICTS = ["useful", "not_useful"];
34089
34052
  var iso10 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
@@ -34248,7 +34211,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
34248
34211
  };
34249
34212
  }, "proposedActionsStoreOver");
34250
34213
 
34251
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
34214
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
34252
34215
  var stale = /* @__PURE__ */ __name(() => {
34253
34216
  throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
34254
34217
  reason: "evidence-findings.stale"
@@ -34429,7 +34392,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
34429
34392
  };
34430
34393
  }, "evidenceFindingsStoreOver");
34431
34394
 
34432
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
34395
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
34433
34396
  var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
34434
34397
  var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
34435
34398
  rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
@@ -34482,7 +34445,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
34482
34445
  }, "forPerson")
34483
34446
  }), "involvementStoreOver");
34484
34447
 
34485
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
34448
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
34486
34449
  import { createHash as createHash12 } from "node:crypto";
34487
34450
  var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
34488
34451
  var id = /* @__PURE__ */ __name((value) => {
@@ -34568,7 +34531,7 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
34568
34531
  };
34569
34532
  }, "meetingProjectsStoreOver");
34570
34533
 
34571
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-proposals.js
34534
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-proposals.js
34572
34535
  var relationOf = /* @__PURE__ */ __name((link3) => ({
34573
34536
  id: link3.id,
34574
34537
  from: link3.from,
@@ -34794,16 +34757,16 @@ var decidedOrigin = /* @__PURE__ */ __name((by) => by === "owner" ? { origin: "o
34794
34757
  provenance: `agent:${by.bot} for the owner: ${by.reason.trim()}`
34795
34758
  }, "decidedOrigin");
34796
34759
 
34797
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
34760
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
34798
34761
  import { createHash as createHash15 } from "node:crypto";
34799
34762
 
34800
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
34763
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
34801
34764
  import { createHash as createHash14 } from "node:crypto";
34802
34765
 
34803
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
34766
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
34804
34767
  import { createHash as createHash13 } from "node:crypto";
34805
34768
 
34806
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
34769
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
34807
34770
  var consolidationId = /* @__PURE__ */ __name((value, field4) => {
34808
34771
  if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
34809
34772
  throw new CliError("validation_error", `${field4} must be a positive canonical tag id`);
@@ -34854,7 +34817,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
34854
34817
  return input;
34855
34818
  }, "consolidationApplyInput");
34856
34819
 
34857
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
34820
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
34858
34821
  var receiptOf = /* @__PURE__ */ __name((row2) => ({
34859
34822
  id: String(row2.id),
34860
34823
  sourceId: String(row2.source_id),
@@ -34929,7 +34892,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
34929
34892
  }, { beforeCommit: check3 });
34930
34893
  }, "applyTagConsolidation");
34931
34894
 
34932
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
34895
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
34933
34896
  var selections = [
34934
34897
  ["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
34935
34898
  ["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
@@ -35073,7 +35036,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
35073
35036
  };
35074
35037
  }, "previewRows");
35075
35038
 
35076
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
35039
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
35077
35040
  var kinds = ["project", "tag", "topic"];
35078
35041
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
35079
35042
  if (signal?.aborted)
@@ -35337,7 +35300,7 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
35337
35300
  };
35338
35301
  }, "vocabularyStoreOver");
35339
35302
 
35340
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
35303
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
35341
35304
  var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
35342
35305
  var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
35343
35306
  var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
@@ -35445,7 +35408,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
35445
35408
  return { type: "chat", id: parsed3.chat };
35446
35409
  if (parsed3.type === "folder")
35447
35410
  return { type: "folder", id: parsed3.id, path: parsed3.path };
35448
- if (parsed3.type === "entity" || parsed3.type === "memory" || parsed3.type === "fact" || parsed3.type === "bot" || parsed3.type === "event" || parsed3.type === "meeting" || parsed3.type === "invoice" || parsed3.type === "payment")
35411
+ if (parsed3.type === "entity" || parsed3.type === "memory" || parsed3.type === "fact" || parsed3.type === "bot" || parsed3.type === "event" || parsed3.type === "meeting" || parsed3.type === "invoice" || parsed3.type === "payment" || parsed3.type === "order")
35449
35412
  return void 0;
35450
35413
  return { type: parsed3.type, id: parsed3.id };
35451
35414
  }, "targetOfThing");
@@ -35894,7 +35857,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
35894
35857
  return key2.padEnd(3, "X");
35895
35858
  }, "projectKey");
35896
35859
 
35897
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
35860
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
35898
35861
  var DAY5 = 864e5;
35899
35862
  var SETTING4 = "logs_pruned_at";
35900
35863
  var LOG_RETENTION = { agentActionsMs: 90 * DAY5, botUpdatePayloadsMs: 30 * DAY5 };
@@ -35921,7 +35884,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
35921
35884
  };
35922
35885
  }, "logPruner");
35923
35886
 
35924
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/mail/findings.js
35887
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/mail/findings.js
35925
35888
  var MAIL_FINDINGS_PER_RUN = 30;
35926
35889
  var MAIL_FINDINGS_PER_SENDER = 5;
35927
35890
  var invalid6 = /* @__PURE__ */ __name((message2) => {
@@ -35958,6 +35921,17 @@ var LINKS = {
35958
35921
  "chat:email": "project"
35959
35922
  };
35960
35923
  var ADDRESS = /^[^\s@<>]+@[^\s@<>]+$/;
35924
+ var PARTY = /^(person|organization):[1-9]\d*$/;
35925
+ var INVOICE = /^invoice:[1-9]\d*$/;
35926
+ var PAYMENT = /^payment:[1-9]\d*$/;
35927
+ var PROJECT = /^project:[1-9]\d*$/;
35928
+ var oneOf7 = /* @__PURE__ */ __name((value, allowed, what) => {
35929
+ if (typeof value !== "string" || !allowed.includes(value))
35930
+ return invalid6(`${what} is ${allowed.join(", ")}`);
35931
+ return value;
35932
+ }, "oneOf");
35933
+ var word = /* @__PURE__ */ __name((value, limit) => findingText(value, limit), "word");
35934
+ var optional = /* @__PURE__ */ __name((key2, value, read2) => value === void 0 ? {} : { [key2]: read2(value) }, "optional");
35961
35935
  var one = /* @__PURE__ */ __name((raw, ids) => {
35962
35936
  if (!raw || typeof raw !== "object")
35963
35937
  return invalid6("a finding is an object");
@@ -36035,8 +36009,157 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
36035
36009
  evidence
36036
36010
  };
36037
36011
  }
36012
+ case "invoice": {
36013
+ findingFields(raw, [
36014
+ "id",
36015
+ "kind",
36016
+ "direction",
36017
+ "counterparty",
36018
+ "currency",
36019
+ "lines",
36020
+ "total",
36021
+ "number",
36022
+ "issueDate",
36023
+ "dueDate",
36024
+ "project",
36025
+ "reason",
36026
+ "evidence"
36027
+ ], RULES.singular);
36028
+ if (!Array.isArray(raw.lines) || raw.lines.length < 1 || raw.lines.length > 50)
36029
+ return invalid6("an invoice finding has 1\u201350 lines");
36030
+ const lines = raw.lines.map((line) => {
36031
+ if (!line || typeof line !== "object")
36032
+ return invalid6("an invoice line is an object");
36033
+ const fields4 = line;
36034
+ findingFields(fields4, ["description", "quantity", "unitPrice", "amount"], "invoice line");
36035
+ return {
36036
+ description: word(fields4.description, 500),
36037
+ ...optional("quantity", fields4.quantity, (value) => word(value, 20)),
36038
+ ...optional("unitPrice", fields4.unitPrice, (value) => word(value, 30)),
36039
+ ...optional("amount", fields4.amount, (value) => word(value, 30))
36040
+ };
36041
+ });
36042
+ return {
36043
+ id: id2,
36044
+ kind: "invoice",
36045
+ direction: oneOf7(raw.direction, INVOICE_DIRECTIONS, "an invoice's direction"),
36046
+ counterparty: reference2(raw.counterparty, PARTY, "an invoice's counterparty"),
36047
+ currency: word(raw.currency, 3),
36048
+ lines,
36049
+ ...optional("total", raw.total, (value) => word(value, 30)),
36050
+ ...optional("number", raw.number, (value) => word(value, 80)),
36051
+ ...optional("issueDate", raw.issueDate, (value) => word(value, 10)),
36052
+ ...optional("dueDate", raw.dueDate, (value) => word(value, 10)),
36053
+ ...optional("project", raw.project, (value) => reference2(value, PROJECT, "a project")),
36054
+ reason: findingText(raw.reason, 2e3),
36055
+ evidence
36056
+ };
36057
+ }
36058
+ case "payment": {
36059
+ findingFields(raw, [
36060
+ "id",
36061
+ "kind",
36062
+ "direction",
36063
+ "payer",
36064
+ "payee",
36065
+ "amount",
36066
+ "currency",
36067
+ "date",
36068
+ "reference",
36069
+ "allocations",
36070
+ "project",
36071
+ "reason",
36072
+ "evidence"
36073
+ ], RULES.singular);
36074
+ let allocations;
36075
+ if (raw.allocations !== void 0) {
36076
+ if (!Array.isArray(raw.allocations) || raw.allocations.length < 1 || raw.allocations.length > 8)
36077
+ return invalid6("a payment finding's allocations are 1\u20138 invoices it settles");
36078
+ allocations = raw.allocations.map((share) => {
36079
+ if (!share || typeof share !== "object")
36080
+ return invalid6("an allocation is an invoice and an amount");
36081
+ const fields4 = share;
36082
+ findingFields(fields4, ["invoice", "amount"], "allocation");
36083
+ return {
36084
+ invoice: reference2(fields4.invoice, INVOICE, "an allocation's invoice"),
36085
+ amount: word(fields4.amount, 30)
36086
+ };
36087
+ });
36088
+ }
36089
+ return {
36090
+ id: id2,
36091
+ kind: "payment",
36092
+ direction: oneOf7(raw.direction, MONEY_DIRECTIONS, "a payment's direction"),
36093
+ ...optional("payer", raw.payer, (value) => reference2(value, PARTY, "a payment's payer")),
36094
+ ...optional("payee", raw.payee, (value) => reference2(value, PARTY, "a payment's payee")),
36095
+ amount: word(raw.amount, 30),
36096
+ currency: word(raw.currency, 3),
36097
+ date: word(raw.date, 10),
36098
+ ...optional("reference", raw.reference, (value) => word(value, 500)),
36099
+ ...allocations === void 0 ? {} : { allocations },
36100
+ ...optional("project", raw.project, (value) => reference2(value, PROJECT, "a project")),
36101
+ reason: findingText(raw.reason, 2e3),
36102
+ evidence
36103
+ };
36104
+ }
36105
+ case "order": {
36106
+ findingFields(raw, [
36107
+ "id",
36108
+ "kind",
36109
+ "purpose",
36110
+ "customer",
36111
+ "supplier",
36112
+ "supplierName",
36113
+ "number",
36114
+ "total",
36115
+ "currency",
36116
+ "status",
36117
+ "orderDate",
36118
+ "fulfilledDate",
36119
+ "invoice",
36120
+ "payment",
36121
+ "project",
36122
+ "reason",
36123
+ "evidence"
36124
+ ], RULES.singular);
36125
+ return {
36126
+ id: id2,
36127
+ kind: "order",
36128
+ purpose: oneOf7(raw.purpose, ORDER_PURPOSES, "an order's purpose"),
36129
+ ...optional("customer", raw.customer, (value) => reference2(value, PARTY, "an order's customer")),
36130
+ ...optional("supplier", raw.supplier, (value) => reference2(value, PARTY, "an order's supplier")),
36131
+ supplierName: word(raw.supplierName, 200),
36132
+ ...optional("number", raw.number, (value) => word(value, 80)),
36133
+ ...optional("total", raw.total, (value) => word(value, 30)),
36134
+ ...optional("currency", raw.currency, (value) => word(value, 3)),
36135
+ ...optional("status", raw.status, (value) => oneOf7(value, ORDER_STATUSES, "an order's status")),
36136
+ ...optional("orderDate", raw.orderDate, (value) => word(value, 10)),
36137
+ ...optional("fulfilledDate", raw.fulfilledDate, (value) => word(value, 10)),
36138
+ ...optional("invoice", raw.invoice, (value) => reference2(value, INVOICE, "an order's invoice")),
36139
+ ...optional("payment", raw.payment, (value) => reference2(value, PAYMENT, "an order's payment")),
36140
+ ...optional("project", raw.project, (value) => reference2(value, PROJECT, "a project")),
36141
+ reason: findingText(raw.reason, 2e3),
36142
+ evidence
36143
+ };
36144
+ }
36145
+ case "order_update": {
36146
+ findingFields(raw, ["id", "kind", "supplierName", "number", "status", "date", "reason", "evidence"], RULES.singular);
36147
+ const status = oneOf7(raw.status, ORDER_STATUSES, "an order update's status");
36148
+ if (raw.date !== void 0 && status !== "delivered")
36149
+ return invalid6("only a delivered order update gives date");
36150
+ return {
36151
+ id: id2,
36152
+ kind: "order_update",
36153
+ supplierName: word(raw.supplierName, 200),
36154
+ number: word(raw.number, 80),
36155
+ status,
36156
+ ...optional("date", raw.date, (value) => word(value, 10)),
36157
+ reason: findingText(raw.reason, 2e3),
36158
+ evidence
36159
+ };
36160
+ }
36038
36161
  default:
36039
- return invalid6("a mail finding is a task, task_update, fact, memory, link or new_contact");
36162
+ return invalid6("a mail finding is a task, task_update, fact, memory, link, new_contact, invoice, payment, order or order_update");
36040
36163
  }
36041
36164
  }, "one");
36042
36165
  var validateMailFindings = /* @__PURE__ */ __name((input) => {
@@ -36047,7 +36170,157 @@ var validateMailFindings = /* @__PURE__ */ __name((input) => {
36047
36170
  }, "validateMailFindings");
36048
36171
  var mailFindingFingerprint = /* @__PURE__ */ __name(({ id: _id, ...finding }) => findingHash(finding), "mailFindingFingerprint");
36049
36172
 
36050
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-findings.js
36173
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/orders.js
36174
+ var ORDERS = "SELECT o.*, b.name AS author_name, b.kind AS author_kind FROM orders o LEFT JOIN bots b ON o.author_type = 'bot' AND b.id = o.author_id";
36175
+ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
36176
+ const { database, now: now2 } = context;
36177
+ const { partyOf, partyThing, reviewedOf, written: written2, keepEvidence, ownerOnly, keepDecision } = reviewedRowsOver(context);
36178
+ const orderOf = /* @__PURE__ */ __name((row2) => {
36179
+ const currency = row2.currency == null ? null : String(row2.currency);
36180
+ const total = row2.total == null || currency === null ? null : Number(row2.total);
36181
+ const fields4 = {
36182
+ id: Number(row2.id),
36183
+ number: row2.number == null ? null : String(row2.number),
36184
+ supplierName: String(row2.supplier_name),
36185
+ total,
36186
+ currency,
36187
+ status: row2.status,
36188
+ review: row2.review
36189
+ };
36190
+ return {
36191
+ id: String(row2.id),
36192
+ ref: `order:${row2.id}`,
36193
+ title: orderTitle(fields4),
36194
+ customer: partyOf(row2.customer_type, row2.customer_id),
36195
+ purpose: row2.purpose,
36196
+ supplier: partyOf(row2.supplier_type, row2.supplier_id),
36197
+ supplierName: fields4.supplierName,
36198
+ number: fields4.number,
36199
+ currency,
36200
+ total: total === null || currency === null ? null : formatDecimal(total, scaleOf(currency)),
36201
+ status: fields4.status,
36202
+ orderDate: row2.order_date == null ? null : String(row2.order_date),
36203
+ fulfilledDate: row2.fulfilled_date == null ? null : String(row2.fulfilled_date),
36204
+ invoice: row2.invoice_id == null ? null : `invoice:${row2.invoice_id}`,
36205
+ payment: row2.payment_id == null ? null : `payment:${row2.payment_id}`,
36206
+ ...reviewedOf(row2, "order")
36207
+ };
36208
+ }, "orderOf");
36209
+ const rowOf2 = /* @__PURE__ */ __name((reference2) => {
36210
+ const thing = requiredThing(database, reference2.includes(":") ? reference2 : `order:${reference2}`, "the order");
36211
+ if (thing.type !== "order")
36212
+ return refuse(`${reference2} is not an order`, "order.ref");
36213
+ return database.prepare(`${ORDERS} WHERE o.id = ?`).get(thing.id);
36214
+ }, "rowOf");
36215
+ const linked = /* @__PURE__ */ __name((reference2, type) => {
36216
+ if (reference2 === void 0)
36217
+ return null;
36218
+ const thing = requiredThing(database, reference2, `the ${type}`);
36219
+ if (thing.type !== type)
36220
+ return refuse(`${reference2} is not an ${type}: reference`, "order.ref");
36221
+ return thing.id;
36222
+ }, "linked");
36223
+ const statusOf = /* @__PURE__ */ __name((value) => oneOf4(value, ORDER_STATUSES, "an order's status"), "statusOf");
36224
+ const decide2 = /* @__PURE__ */ __name((reference2, by, reason, confirm) => {
36225
+ const row2 = rowOf2(reference2);
36226
+ const ref3 = `order:${row2.id}`;
36227
+ assertMayDecide({ id: ref3, proposedBy: proposerOf(database, row2.author_type, row2.author_id), ownerOnly: true }, by, context.decisions);
36228
+ if (row2.review !== "proposed")
36229
+ refuse(`${ref3} is already ${String(row2.review)}`, "proposal.wrong-state");
36230
+ write(database, () => {
36231
+ if (confirm) {
36232
+ const { actor } = authorActor(context, deciderAuthor(by));
36233
+ database.prepare("UPDATE orders SET review = 'confirmed', confirmed_by_type = ?, confirmed_by_id = ?, updated_at = ? WHERE id = ?").run(actor.type, actor.id, now2(), Number(row2.id));
36234
+ } else
36235
+ database.prepare("UPDATE orders SET review = 'rejected', updated_at = ? WHERE id = ?").run(now2(), Number(row2.id));
36236
+ keepDecision("orders", Number(row2.id), by, reason);
36237
+ });
36238
+ return orderOf(rowOf2(ref3));
36239
+ }, "decide");
36240
+ return {
36241
+ add: /* @__PURE__ */ __name((input) => {
36242
+ const purpose = oneOf4(input.purpose, ORDER_PURPOSES, "an order's purpose");
36243
+ const status = input.status === void 0 ? "placed" : statusOf(input.status);
36244
+ const supplierName = text3(input.supplierName, "an order's supplier name", 200) ?? refuse("an order names its shop or supplier", "order.field");
36245
+ const number3 = text3(input.number, "an order's number", 80);
36246
+ if (input.total === void 0 !== (input.currency === void 0))
36247
+ refuse("an order's amount and currency come together", "order.field");
36248
+ const currency = input.currency === void 0 ? null : currencyOf(input.currency);
36249
+ const total = currency === null ? null : minorUnits(input.total, currency, "an order's amount");
36250
+ if (total !== null && total < 0)
36251
+ refuse("an order's amount is 0 or more", "money.amount");
36252
+ const orderDate = isoDate(input.orderDate, "an order's date");
36253
+ const fulfilledDate = isoDate(input.fulfilledDate, "an order's delivery date");
36254
+ const id2 = write(database, () => {
36255
+ if (number3 !== null && ordersOfShop(database, supplierName, number3).length)
36256
+ refuse(`order ${number3} from ${supplierName} is already stored; change its status instead`, "order.duplicate");
36257
+ const customer = partyThing(input.customer, "the customer") ?? ownerPerson(database);
36258
+ const supplier = partyThing(input.supplier, "the supplier");
36259
+ const invoice = linked(input.invoice, "invoice");
36260
+ const payment = linked(input.payment, "payment");
36261
+ const by = written2(input);
36262
+ const at = now2();
36263
+ const made = Number(database.prepare("INSERT INTO orders (customer_type, customer_id, purpose, supplier_type, supplier_id, supplier_name, number, currency, total, status, order_date, fulfilled_date, invoice_id, payment_id, project_id, review, author_type, author_id, model, confirmed_by_type, confirmed_by_id, source, metadata, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(customer.type, customer.id, purpose, supplier?.type ?? null, supplier?.id ?? null, supplierName, number3, currency, total, status, orderDate, fulfilledDate, invoice, payment, by.project, by.review, by.actor.type, by.actor.id, by.model, by.confirmedType, by.confirmedId, by.source, by.metadata, at, at)?.id);
36264
+ keepEvidence("order", made, by);
36265
+ return made;
36266
+ });
36267
+ return orderOf(rowOf2(`order:${id2}`));
36268
+ }, "add"),
36269
+ get: /* @__PURE__ */ __name((reference2) => orderOf(rowOf2(reference2)), "get"),
36270
+ list: /* @__PURE__ */ __name((filter = {}) => {
36271
+ const project = filter.project === void 0 ? null : projectId(database, filter.project);
36272
+ const customer = partyThing(filter.customer, "the customer");
36273
+ const by = proposedBySql("o.author_type", "o.author_id", filter.proposedBy);
36274
+ const status = filter.status === void 0 ? null : statusOf(filter.status);
36275
+ const purpose = filter.purpose === void 0 ? null : oneOf4(filter.purpose, ORDER_PURPOSES, "a purpose");
36276
+ const review = filter.review === void 0 ? null : oneOf4(filter.review, FINANCE_REVIEWS, "a review");
36277
+ const number3 = filter.number === void 0 ? null : filter.number.trim();
36278
+ const shop = filter.supplierName === void 0 ? null : fold(filter.supplierName);
36279
+ const limit = Math.min(Math.max(filter.limit ?? 100, 1), 500);
36280
+ const rows = database.prepare(`${ORDERS} WHERE o.deleted_at IS NULL AND (? IS NULL OR o.status = ?) AND (? IS NULL OR o.purpose = ?) AND (? IS NULL OR o.review = ?) AND (? IS NULL OR o.project_id = ?) AND (? IS NULL OR o.number = ?) AND (? IS NULL OR (o.customer_type = ? AND o.customer_id = ?)) AND ${by.sql} ORDER BY o.created_at DESC, o.id DESC`).all(status, status, purpose, purpose, review, review, project, project, number3, number3, customer?.type ?? null, customer?.type ?? null, customer?.id ?? null, ...by.params);
36281
+ return rows.filter((row2) => shop === null || fold(String(row2.supplier_name)) === shop).slice(0, limit).map(orderOf);
36282
+ }, "list"),
36283
+ setStatus: /* @__PURE__ */ __name((reference2, { status, date: date3, by }) => {
36284
+ ownerOnly(by, "moves an order on");
36285
+ const next = statusOf(status);
36286
+ const day = isoDate(date3, "an order's delivery date");
36287
+ const row2 = rowOf2(reference2);
36288
+ if (row2.review === "rejected" || row2.deleted_at != null)
36289
+ refuse(`order:${row2.id} is ${row2.deleted_at != null ? "deleted" : "rejected"}`, "order.status");
36290
+ write(database, () => {
36291
+ database.prepare("UPDATE orders SET status = ?, fulfilled_date = coalesce(?, fulfilled_date), updated_at = ? WHERE id = ?").run(next, next === "delivered" ? day : null, now2(), Number(row2.id));
36292
+ });
36293
+ return orderOf(rowOf2(`order:${row2.id}`));
36294
+ }, "setStatus"),
36295
+ confirm: /* @__PURE__ */ __name((reference2, by, reason) => decide2(reference2, by, reason, true), "confirm"),
36296
+ reject: /* @__PURE__ */ __name((reference2, by, reason) => decide2(reference2, by, reason, false), "reject")
36297
+ };
36298
+ }, "orderOperationsOver");
36299
+ var ordersOfShop = /* @__PURE__ */ __name((database, supplierName, number3) => {
36300
+ const name = fold(supplierName);
36301
+ return database.prepare("SELECT id, supplier_name FROM orders WHERE number = ? AND deleted_at IS NULL AND review <> 'rejected'").all(number3.trim()).filter((row2) => fold(String(row2.supplier_name)) === name);
36302
+ }, "ordersOfShop");
36303
+ var orderOfShop = /* @__PURE__ */ __name((context, supplierName, number3) => {
36304
+ const rows = ordersOfShop(context.database, supplierName, number3);
36305
+ if (rows.length === 0)
36306
+ throw new CliError("not_found", `no stored order ${number3} from ${supplierName}`, { reason: "order.not-found" });
36307
+ if (rows.length > 1)
36308
+ return refuse(`more than one order ${number3} from ${supplierName}`, "order.ref");
36309
+ return `order:${rows[0]?.id}`;
36310
+ }, "orderOfShop");
36311
+ var ordersStoreOver = /* @__PURE__ */ __name((context) => {
36312
+ const operations = orderOperationsOver(context);
36313
+ return {
36314
+ add: /* @__PURE__ */ __name(async (input) => operations.add(input), "add"),
36315
+ get: /* @__PURE__ */ __name(async (reference2) => operations.get(reference2), "get"),
36316
+ list: /* @__PURE__ */ __name(async (filter) => operations.list(filter), "list"),
36317
+ setStatus: /* @__PURE__ */ __name(async (reference2, input) => operations.setStatus(reference2, input), "setStatus"),
36318
+ confirm: /* @__PURE__ */ __name(async (reference2, by, reason) => operations.confirm(reference2, by, reason), "confirm"),
36319
+ reject: /* @__PURE__ */ __name(async (reference2, by, reason) => operations.reject(reference2, by, reason), "reject")
36320
+ };
36321
+ }, "ordersStoreOver");
36322
+
36323
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-findings.js
36051
36324
  var stale2 = /* @__PURE__ */ __name(() => {
36052
36325
  throw new CliError("validation_error", "mail findings cite mail that changed since it was read; stage a new batch", {
36053
36326
  reason: "mail-findings.stale"
@@ -36068,6 +36341,8 @@ var mailFindingsStoreOver = /* @__PURE__ */ __name((context) => {
36068
36341
  const core = findingsCoreOver(context, MAIL_FINDINGS_KIND);
36069
36342
  const memories2 = memoriesStoreOver(context);
36070
36343
  const tasks2 = workTaskOperationsOver(context);
36344
+ const finance = financeOperationsOver(context);
36345
+ const orders2 = orderOperationsOver(context);
36071
36346
  const mailbox2 = /* @__PURE__ */ __name((key2) => {
36072
36347
  if (key2?.provider !== "email" || typeof key2.account !== "string" || !key2.account.trim())
36073
36348
  return invalid7("mail findings belong to one email account");
@@ -36157,6 +36432,57 @@ var mailFindingsStoreOver = /* @__PURE__ */ __name((context) => {
36157
36432
  }
36158
36433
  return read2;
36159
36434
  }, "cite");
36435
+ const entry2 = /* @__PURE__ */ __name((finding, evidence) => {
36436
+ const by = "owner";
36437
+ switch (finding.kind) {
36438
+ case "invoice":
36439
+ return () => finance.addInvoice({
36440
+ by,
36441
+ evidence,
36442
+ direction: finding.direction,
36443
+ counterparty: finding.counterparty,
36444
+ currency: finding.currency,
36445
+ lines: finding.lines,
36446
+ ...finding.total === void 0 ? {} : { total: finding.total },
36447
+ ...finding.number === void 0 ? {} : { number: finding.number },
36448
+ ...finding.issueDate === void 0 ? {} : { issueDate: finding.issueDate },
36449
+ ...finding.dueDate === void 0 ? {} : { dueDate: finding.dueDate },
36450
+ ...finding.project === void 0 ? {} : { project: finding.project }
36451
+ });
36452
+ case "payment":
36453
+ return () => finance.addPayment({
36454
+ by,
36455
+ evidence,
36456
+ direction: finding.direction,
36457
+ amount: finding.amount,
36458
+ currency: finding.currency,
36459
+ date: finding.date,
36460
+ ...finding.payer === void 0 ? {} : { payer: finding.payer },
36461
+ ...finding.payee === void 0 ? {} : { payee: finding.payee },
36462
+ ...finding.reference === void 0 ? {} : { reference: finding.reference },
36463
+ ...finding.allocations === void 0 ? {} : { allocations: finding.allocations },
36464
+ ...finding.project === void 0 ? {} : { project: finding.project }
36465
+ });
36466
+ case "order": {
36467
+ const { id: _id, kind: _kind, evidence: _cited, reason: _reason, ...fields4 } = finding;
36468
+ return () => orders2.add({ ...fields4, by, evidence });
36469
+ }
36470
+ default:
36471
+ return void 0;
36472
+ }
36473
+ }, "entry");
36474
+ const ROLLBACK = /* @__PURE__ */ Symbol("rollback");
36475
+ const wouldWrite = /* @__PURE__ */ __name((make) => {
36476
+ try {
36477
+ write(database, () => {
36478
+ make();
36479
+ throw ROLLBACK;
36480
+ });
36481
+ } catch (error) {
36482
+ if (error !== ROLLBACK)
36483
+ throw error;
36484
+ }
36485
+ }, "wouldWrite");
36160
36486
  const identityOfAddress = /* @__PURE__ */ __name((address) => database.prepare("SELECT i.id, l.person_id FROM identities i LEFT JOIN identity_links l ON l.identity_id = i.id WHERE i.provider = 'email' AND lower(i.external_id) = ?").get(address.toLowerCase()), "identityOfAddress");
36161
36487
  const targets = /* @__PURE__ */ __name((finding, read2) => {
36162
36488
  const thing = /* @__PURE__ */ __name((reference2, what) => {
@@ -36181,6 +36507,14 @@ var mailFindingsStoreOver = /* @__PURE__ */ __name((context) => {
36181
36507
  thing(finding.from, "the link's source");
36182
36508
  thing(finding.to, "the link's target");
36183
36509
  return;
36510
+ case "invoice":
36511
+ case "payment":
36512
+ case "order":
36513
+ wouldWrite(entry2(finding, finding.evidence.map((one2) => one2.reference)));
36514
+ return;
36515
+ case "order_update":
36516
+ orderOfShop(context, finding.supplierName, finding.number);
36517
+ return;
36184
36518
  case "new_contact": {
36185
36519
  const ids = finding.evidence.map(({ reference: reference2 }) => Number(read2.get(reference2)?.id));
36186
36520
  const marks = ids.map(() => "?").join(",");
@@ -36246,6 +36580,20 @@ ${evidence.join("\n")}`, agent);
36246
36580
  database.prepare("UPDATE links SET confirmed = 1, updated_at = ? WHERE id = ?").run(now2(), Number(link3.id));
36247
36581
  return `link:${link3.id}`;
36248
36582
  }
36583
+ case "invoice":
36584
+ case "payment":
36585
+ case "order":
36586
+ return entry2(finding, evidence)().ref;
36587
+ case "order_update": {
36588
+ const order = orderOfShop(context, finding.supplierName, finding.number);
36589
+ orders2.setStatus(order, {
36590
+ status: finding.status,
36591
+ by: "owner",
36592
+ ...finding.date === void 0 ? {} : { date: finding.date }
36593
+ });
36594
+ linkEvidence(context, { type: "order", id: Number(order.slice("order:".length)) }, evidence, "owner");
36595
+ return order;
36596
+ }
36249
36597
  case "new_contact": {
36250
36598
  const person2 = Number(identityOfAddress(finding.address)?.person_id);
36251
36599
  database.prepare("UPDATE persons SET name = ?, updated_at = ? WHERE id = ?").run(finding.name, now2(), person2);
@@ -36341,7 +36689,7 @@ ${evidence.join("\n")}`, agent);
36341
36689
  };
36342
36690
  }, "mailFindingsStoreOver");
36343
36691
 
36344
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
36692
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
36345
36693
  var stale3 = /* @__PURE__ */ __name(() => {
36346
36694
  throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
36347
36695
  reason: "meeting-findings.stale"
@@ -36509,7 +36857,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
36509
36857
  };
36510
36858
  }, "meetingFindingsStoreOver");
36511
36859
 
36512
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
36860
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
36513
36861
  var RANK_BATCH = 512;
36514
36862
  var LIVE3 = "FROM chunks k JOIN meeting_transcripts t ON k.chunkable_type = 'meeting_transcript' AND t.id = k.chunkable_id JOIN meetings m ON m.id = t.meeting_id WHERE m.account_id = ? AND m.deleted_at IS NULL AND t.deleted_at IS NULL AND t.superseded_at IS NULL";
36515
36863
  var limitOf = /* @__PURE__ */ __name((value, name, max = 1e3) => {
@@ -36780,7 +37128,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
36780
37128
  }
36781
37129
  }), "meetingVectorsOver");
36782
37130
 
36783
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
37131
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
36784
37132
  var OTHER_SOURCES = ["document", "note", "email"];
36785
37133
  var TEXTS = {
36786
37134
  document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
@@ -36881,11 +37229,11 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
36881
37229
  };
36882
37230
  }, "sourceMentionStoreOver");
36883
37231
 
36884
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
37232
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
36885
37233
  import { mkdirSync, statSync, writeFileSync } from "node:fs";
36886
37234
  import { dirname } from "node:path";
36887
37235
 
36888
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
37236
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
36889
37237
  import { readFileSync as readFileSync3 } from "node:fs";
36890
37238
  var CLIENTS_SETTING = "clients";
36891
37239
  var coreVersion = (() => {
@@ -36943,7 +37291,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
36943
37291
  return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
36944
37292
  }, "refusalAdvice");
36945
37293
 
36946
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
37294
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
36947
37295
  var GENERATED = [
36948
37296
  {
36949
37297
  "name": "20261010184427_initial",
@@ -37913,10 +38261,30 @@ WHERE json_type(params, '$.selection') = 'object';`
37913
38261
  "statements": [
37914
38262
  "ALTER TABLE `record_relations` ADD `amount` text;"
37915
38263
  ]
38264
+ },
38265
+ {
38266
+ "name": "20261105125314_version-50-orders",
38267
+ "statements": [
38268
+ "CREATE TABLE `orders` (\n `id` integer PRIMARY KEY,\n `customer_type` text NOT NULL,\n `customer_id` integer NOT NULL,\n `purpose` text NOT NULL,\n `supplier_type` text,\n `supplier_id` integer,\n `supplier_name` text NOT NULL,\n `number` text,\n `currency` text,\n `total` integer,\n `status` text NOT NULL,\n `order_date` text,\n `fulfilled_date` text,\n `invoice_id` integer,\n `payment_id` integer,\n `project_id` integer,\n `review` text NOT NULL,\n `author_type` text NOT NULL,\n `author_id` integer NOT NULL,\n `model` text,\n `confirmed_by_type` text,\n `confirmed_by_id` integer,\n `source` text NOT NULL,\n `metadata` text,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n `deleted_at` integer,\n CONSTRAINT `fk_orders_invoice_id_invoices_id_fk` FOREIGN KEY (`invoice_id`) REFERENCES `invoices`(`id`),\n CONSTRAINT `fk_orders_payment_id_payments_id_fk` FOREIGN KEY (`payment_id`) REFERENCES `payments`(`id`),\n CONSTRAINT `fk_orders_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`)\n);",
38269
+ "CREATE INDEX `orders_by_customer_type_customer_id` ON `orders` (`customer_type`,`customer_id`);",
38270
+ "CREATE INDEX `orders_by_supplier_type_supplier_id` ON `orders` (`supplier_type`,`supplier_id`);",
38271
+ "CREATE INDEX `orders_by_invoice_id` ON `orders` (`invoice_id`);",
38272
+ "CREATE INDEX `orders_by_payment_id` ON `orders` (`payment_id`);",
38273
+ "CREATE INDEX `orders_by_project_id` ON `orders` (`project_id`);",
38274
+ "CREATE INDEX `orders_by_author_type_author_id` ON `orders` (`author_type`,`author_id`);",
38275
+ "CREATE INDEX `orders_by_confirmed_by_type_confirmed_by_id` ON `orders` (`confirmed_by_type`,`confirmed_by_id`);"
38276
+ ]
38277
+ },
38278
+ {
38279
+ "name": "20261105125315_version-50-orders-rules",
38280
+ "statements": [
38281
+ "-- The store's code checks these first and says why; the triggers keep a stray write from another build or a hand\n-- edit from storing an order with an unknown status or purpose, or an amount without its currency.\nCREATE TRIGGER orders_valid_bi BEFORE INSERT ON orders\n WHEN new.customer_type NOT IN ('person', 'organization')\n OR new.purpose NOT IN ('personal', 'business', 'client', 'other')\n OR new.status NOT IN ('placed', 'shipped', 'delivered', 'cancelled', 'returned')\n OR new.review NOT IN ('proposed', 'confirmed', 'rejected')\n OR (new.total IS NULL) <> (new.currency IS NULL) OR new.total < 0 BEGIN\n SELECT RAISE(ABORT, 'orders: a person or organization customer, a known purpose, status and review, an amount with its currency');\nEND;",
38282
+ "CREATE TRIGGER orders_valid_bu BEFORE UPDATE ON orders\n WHEN new.customer_type NOT IN ('person', 'organization')\n OR new.purpose NOT IN ('personal', 'business', 'client', 'other')\n OR new.status NOT IN ('placed', 'shipped', 'delivered', 'cancelled', 'returned')\n OR new.review NOT IN ('proposed', 'confirmed', 'rejected')\n OR (new.total IS NULL) <> (new.currency IS NULL) OR new.total < 0 BEGIN\n SELECT RAISE(ABORT, 'orders: a person or organization customer, a known purpose, status and review, an amount with its currency');\nEND;"
38283
+ ]
37916
38284
  }
37917
38285
  ];
37918
38286
 
37919
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
38287
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
37920
38288
  var MANIFEST = [
37921
38289
  { name: "20261010184427_initial", version: 1, minCompatible: 1 },
37922
38290
  { name: "20261011035353_version-2-facts", version: 2, minCompatible: 1 },
@@ -37981,7 +38349,9 @@ var MANIFEST = [
37981
38349
  { name: "20261102185954_version-46-payment-facts", version: 46, minCompatible: 34 },
37982
38350
  { name: "20261102192959_version-47-records", version: 47, minCompatible: 34 },
37983
38351
  { name: "20261102222340_version-48-test-accounts", version: 48, minCompatible: 34 },
37984
- { name: "20261104232153_version-49-relation-amounts", version: 49, minCompatible: 34 }
38352
+ { name: "20261104232153_version-49-relation-amounts", version: 49, minCompatible: 34 },
38353
+ { name: "20261105125314_version-50-orders", version: 50, minCompatible: 34 },
38354
+ { name: "20261105125315_version-50-orders-rules", version: 50, minCompatible: 34 }
37985
38355
  ];
37986
38356
  var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated = GENERATED) => {
37987
38357
  const migrations = [];
@@ -38005,7 +38375,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
38005
38375
  return migrations;
38006
38376
  }, "generatedMigrations");
38007
38377
 
38008
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/migrations.js
38378
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/migrations.js
38009
38379
  var MIGRATIONS = generatedMigrations();
38010
38380
  var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
38011
38381
  version INTEGER PRIMARY KEY,
@@ -38058,7 +38428,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
38058
38428
  }
38059
38429
  }, "migrate");
38060
38430
 
38061
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
38431
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
38062
38432
  var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
38063
38433
  const pending = database.prepare("SELECT id, join_url FROM meetings WHERE join_url IS NOT NULL AND join_key IS NULL AND id > ? ORDER BY id LIMIT ?");
38064
38434
  if (pending.get(0, 1) === void 0)
@@ -38080,7 +38450,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
38080
38450
  }
38081
38451
  }, "fillJoinKeys");
38082
38452
 
38083
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
38453
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
38084
38454
  var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
38085
38455
  refuseOwnerStoreInTests(path);
38086
38456
  const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
@@ -38094,8 +38464,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
38094
38464
  }, "openSqlite");
38095
38465
  var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
38096
38466
  quietSqliteWarning();
38097
- const { drizzle } = await import("./node-6T5LUBAE.js");
38098
- const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-ZTDWPRJU.js");
38467
+ const { drizzle } = await import("./node-NCSG7QX5.js");
38468
+ const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-QL4M5RIK.js");
38099
38469
  const client = await nodeClient(path, { readOnly });
38100
38470
  try {
38101
38471
  return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
@@ -38105,8 +38475,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
38105
38475
  }
38106
38476
  }, "openUnderNode");
38107
38477
  var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
38108
- const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-2NGQT7HH.js");
38109
- const { drizzle } = await import("./bun-K5H33WQK.js");
38478
+ const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-HCZP2CNO.js");
38479
+ const { drizzle } = await import("./bun-JRTUGKIJ.js");
38110
38480
  const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
38111
38481
  try {
38112
38482
  return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
@@ -38116,7 +38486,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
38116
38486
  }
38117
38487
  }, "openUnderBun");
38118
38488
 
38119
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-facts.js
38489
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-facts.js
38120
38490
  var PAYMENT_FACTS_TO_MOVE = "payment_facts_to_move";
38121
38491
  var paymentOf = /* @__PURE__ */ __name((metadata3) => {
38122
38492
  try {
@@ -38184,7 +38554,7 @@ var movePaymentFacts = /* @__PURE__ */ __name((context) => {
38184
38554
  });
38185
38555
  }, "movePaymentFacts");
38186
38556
 
38187
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
38557
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
38188
38558
  var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
38189
38559
  const ours = MIGRATIONS.at(-1)?.version ?? 0;
38190
38560
  if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
@@ -38199,7 +38569,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
38199
38569
  throw new CliError("configuration_error", `The store requires schema ${minCompatible}, but this tool supports ${ours}; ${refusalAdvice(storeClients(database), command, version)}`);
38200
38570
  }, "assertReadCompatible");
38201
38571
 
38202
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/suggested-links.js
38572
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/suggested-links.js
38203
38573
  var SUGGESTED_LINKS_TO_MOVE = "suggested_links_to_move";
38204
38574
  var proposerOf2 = /* @__PURE__ */ __name((provenance2) => {
38205
38575
  if (provenance2?.startsWith("rule:"))
@@ -38245,7 +38615,7 @@ var moveSuggestedLinks = /* @__PURE__ */ __name((database, now2) => {
38245
38615
  });
38246
38616
  }, "moveSuggestedLinks");
38247
38617
 
38248
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/test-accounts.js
38618
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/test-accounts.js
38249
38619
  var TEST_ACCOUNTS_TO_PURGE = "test_accounts_to_purge";
38250
38620
  var TEST_PROVIDER = "chat";
38251
38621
  var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
@@ -38266,7 +38636,7 @@ var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
38266
38636
  }
38267
38637
  }, "purgeTestAccounts");
38268
38638
 
38269
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
38639
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
38270
38640
  var BACKFILL_ON_OPEN = 5e3;
38271
38641
  var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
38272
38642
  var createWritable = /* @__PURE__ */ __name((file) => {
@@ -38331,10 +38701,10 @@ var openStoreContext = /* @__PURE__ */ __name(async ({ path, env, now: now2 = Da
38331
38701
  }
38332
38702
  }, "openStoreContext");
38333
38703
 
38334
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
38704
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
38335
38705
  import { createHash as createHash16 } from "node:crypto";
38336
38706
 
38337
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
38707
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
38338
38708
  var text4 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
38339
38709
  var ref = text4(2048);
38340
38710
  var timestamp2 = pipe(number(), safeInteger(), minValue(0));
@@ -38400,7 +38770,7 @@ var projectAnnotationsSchema = strictObject({
38400
38770
  }))
38401
38771
  });
38402
38772
 
38403
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
38773
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
38404
38774
  var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
38405
38775
  var invalid9 = /* @__PURE__ */ __name((field4) => {
38406
38776
  throw new CliError("validation_error", `invalid project annotations.${field4}`);
@@ -38504,7 +38874,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
38504
38874
  invalid9("external.unused");
38505
38875
  }, "validateProjectAnnotationsGraph");
38506
38876
 
38507
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
38877
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
38508
38878
  var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
38509
38879
  var ref2 = pipe(string(), minLength(1), maxLength(2048));
38510
38880
  var targetSchema = strictObject({
@@ -38610,7 +38980,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
38610
38980
  };
38611
38981
  }, "planBoundProjectAnnotations");
38612
38982
 
38613
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
38983
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
38614
38984
  import { createHash as createHash17 } from "node:crypto";
38615
38985
  var text5 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
38616
38986
  var timestamp3 = pipe(number(), safeInteger(), minValue(0));
@@ -38704,7 +39074,7 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
38704
39074
  })).digest("hex");
38705
39075
  }, "projectAnnotationSnapshotFingerprint");
38706
39076
 
38707
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
39077
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
38708
39078
  var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
38709
39079
  if (!request || typeof request !== "object" || Array.isArray(request))
38710
39080
  throw new CliError("validation_error", "project annotation request is required");
@@ -38721,7 +39091,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
38721
39091
  return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
38722
39092
  }, "projectAnnotationRequest");
38723
39093
 
38724
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
39094
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
38725
39095
  var SnapshotBudget = class {
38726
39096
  static {
38727
39097
  __name(this, "SnapshotBudget");
@@ -38747,13 +39117,13 @@ var SnapshotBudget = class {
38747
39117
  }
38748
39118
  };
38749
39119
 
38750
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
39120
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
38751
39121
  import { createHash as createHash19 } from "node:crypto";
38752
39122
 
38753
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
39123
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
38754
39124
  var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
38755
39125
 
38756
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
39126
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
38757
39127
  import { createHash as createHash18 } from "node:crypto";
38758
39128
  var invalid11 = /* @__PURE__ */ __name(() => {
38759
39129
  throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
@@ -38896,7 +39266,7 @@ var ProjectSnapshotSources = class {
38896
39266
  }
38897
39267
  };
38898
39268
 
38899
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
39269
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
38900
39270
  var unsupported = /* @__PURE__ */ __name(() => {
38901
39271
  throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
38902
39272
  }, "unsupported");
@@ -39067,7 +39437,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, bu
39067
39437
  return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
39068
39438
  }), "projectAnnotationSnapshot");
39069
39439
 
39070
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
39440
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
39071
39441
  var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, manifest, bindings, budget) => read(database, () => {
39072
39442
  const current = projectAnnotationSnapshot(database, projectId2, budget).snapshot;
39073
39443
  const sources = new ProjectSnapshotSources(database, budget);
@@ -39129,7 +39499,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, ma
39129
39499
  };
39130
39500
  }), "previewAnnotationSnapshot");
39131
39501
 
39132
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
39502
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
39133
39503
  var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, snapshot2, bindings) => {
39134
39504
  const mappings = { ...bindings };
39135
39505
  const resolve = /* @__PURE__ */ __name((ref3) => {
@@ -39171,7 +39541,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, sna
39171
39541
  return mappings;
39172
39542
  }, "restoreAnnotationRecords");
39173
39543
 
39174
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
39544
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
39175
39545
  var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
39176
39546
  async preview(request) {
39177
39547
  const { snapshot: snapshot2, projectId: projectId2 } = projectAnnotationRequest(request);
@@ -39201,7 +39571,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
39201
39571
  }
39202
39572
  }), "projectAnnotationStoreOver");
39203
39573
 
39204
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/domain/records.js
39574
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/domain/records.js
39205
39575
  import { createHash as createHash20 } from "node:crypto";
39206
39576
  var RECORDS_SCHEMA_VERSION = 1;
39207
39577
  var RECORD_OPERATIONS = ["upsert", "delete"];
@@ -39211,7 +39581,7 @@ var TYPE = "^(invoice|payment|person|organization|project|custom:[a-z0-9][a-z0-9
39211
39581
  var MAX_ID = 512;
39212
39582
  var MAX_FIELDS_BYTES = 65536;
39213
39583
  var MAX_RELATIONS = 100;
39214
- var DECIMAL2 = "^[0-9]{1,16}(\\.[0-9]{1,6})?$";
39584
+ var DECIMAL = "^[0-9]{1,16}(\\.[0-9]{1,6})?$";
39215
39585
  var RECORDS_ENVELOPE_SCHEMA = {
39216
39586
  $schema: "https://json-schema.org/draft/2020-12/schema",
39217
39587
  title: "WireCat records envelope, version 1",
@@ -39262,7 +39632,7 @@ var RECORDS_ENVELOPE_SCHEMA = {
39262
39632
  external_id: { type: "string", minLength: 1, maxLength: MAX_ID },
39263
39633
  amount: {
39264
39634
  type: "string",
39265
- pattern: DECIMAL2,
39635
+ pattern: DECIMAL,
39266
39636
  description: "A settles relation's share of the payment, a decimal in its currency"
39267
39637
  }
39268
39638
  }
@@ -39271,7 +39641,7 @@ var RECORDS_ENVELOPE_SCHEMA = {
39271
39641
  };
39272
39642
  var wordPattern = new RegExp(WORD4);
39273
39643
  var typePattern = new RegExp(TYPE);
39274
- var decimalPattern = new RegExp(DECIMAL2);
39644
+ var decimalPattern = new RegExp(DECIMAL);
39275
39645
  var isObject2 = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isObject");
39276
39646
  var escapePointer = /* @__PURE__ */ __name((segment) => String(segment).replaceAll("~", "~0").replaceAll("/", "~1"), "escapePointer");
39277
39647
  var pointerOf = /* @__PURE__ */ __name((...segments) => segments.map((s) => `/${escapePointer(s)}`).join(""), "pointerOf");
@@ -39433,7 +39803,7 @@ var envelopeOfJsonl = /* @__PURE__ */ __name((text6) => {
39433
39803
  return isObject2(header) ? { ...header, records: records2 } : header;
39434
39804
  }, "envelopeOfJsonl");
39435
39805
 
39436
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
39806
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
39437
39807
  var PROJECTED = {
39438
39808
  invoice: { roles: ["issuer", "counterparty", "project"], many: [] },
39439
39809
  payment: { roles: ["payer", "payee", "project", "settles"], many: ["settles"] }
@@ -39846,7 +40216,7 @@ var recordStoreOver = /* @__PURE__ */ __name((context) => {
39846
40216
  };
39847
40217
  }, "recordStoreOver");
39848
40218
 
39849
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
40219
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
39850
40220
  var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
39851
40221
  const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
39852
40222
  let merged = { from: from2, to };
@@ -39859,7 +40229,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
39859
40229
  }, "markRange");
39860
40230
  var ranges = /* @__PURE__ */ __name(({ orm }, chatKey) => orm.select({ from: syncRanges.fromKey, to: syncRanges.toKey }).from(syncRanges).where(eq(syncRanges.chatId, chatKey)).orderBy(syncRanges.fromKey).all(), "ranges");
39861
40231
 
39862
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/task-analysis-marks.js
40232
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/task-analysis-marks.js
39863
40233
  var prefixOf2 = /* @__PURE__ */ __name(({ provider, account }) => `task_analysis:${provider}:${account}:`, "prefixOf");
39864
40234
  var markOf = /* @__PURE__ */ __name((prefix, row2) => ({
39865
40235
  chatId: String(row2.key).slice(prefix.length),
@@ -39880,7 +40250,7 @@ var setTaskAnalysisMark = /* @__PURE__ */ __name((database, account, { chatId, c
39880
40250
  database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(prefixOf2(account) + chatId, JSON.stringify({ ...saved, checkedAt: checkedAt ?? new Date(now2).toISOString() }), now2);
39881
40251
  }, "setTaskAnalysisMark");
39882
40252
 
39883
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
40253
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
39884
40254
  var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
39885
40255
  var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
39886
40256
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
@@ -39890,7 +40260,7 @@ var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) =
39890
40260
  database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(keyOf4(account), JSON.stringify(until), now2);
39891
40261
  }, "setTaskRulesStop");
39892
40262
 
39893
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sync.js
40263
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sync.js
39894
40264
  var syncStoreOver = /* @__PURE__ */ __name((context) => {
39895
40265
  const { database } = context;
39896
40266
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
@@ -39949,7 +40319,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
39949
40319
  };
39950
40320
  }, "syncStoreOver");
39951
40321
 
39952
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/tags.js
40322
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/tags.js
39953
40323
  var tagsStoreOver = /* @__PURE__ */ __name((context) => {
39954
40324
  const { database } = context;
39955
40325
  return {
@@ -39971,7 +40341,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
39971
40341
  };
39972
40342
  }, "tagsStoreOver");
39973
40343
 
39974
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
40344
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
39975
40345
  var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
39976
40346
  var neighbours = /* @__PURE__ */ __name(({ orm }, chatKey, messagePk, sentAt, { messages: messages2, withinMs }, side) => orm.all(sql`SELECT sender_name AS sender, text, sent_at AS sentAt FROM messages
39977
40347
  WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
@@ -40098,7 +40468,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
40098
40468
  dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
40099
40469
  }, "savePictureChunks");
40100
40470
 
40101
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
40471
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
40102
40472
  var messagesToEmbed = /* @__PURE__ */ __name(({ orm }, accountPk2, { chatKey, model, after: after2, limit }) => orm.all(sql`SELECT m.id AS messagePk, m.text, m.sent_at AS sentAt, k.content_hash AS hash,
40103
40473
  EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
40104
40474
  FROM messages m
@@ -40187,7 +40557,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
40187
40557
  return plain2(best(found2));
40188
40558
  }, "nearestMessages");
40189
40559
 
40190
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/vectors.js
40560
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/vectors.js
40191
40561
  var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
40192
40562
  const { database } = context;
40193
40563
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -40445,7 +40815,7 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
40445
40815
  embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
40446
40816
  }), "vectorsStoreOver");
40447
40817
 
40448
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
40818
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
40449
40819
  import { existsSync, readFileSync as readFileSync4 } from "node:fs";
40450
40820
  import { dirname as dirname2, join as join2 } from "node:path";
40451
40821
  var BOOKKEEPING = ["schema_migrations", "store_settings"];
@@ -40533,10 +40903,10 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
40533
40903
  }
40534
40904
  }, "lastBackup");
40535
40905
 
40536
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/providers.js
40906
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/providers.js
40537
40907
  var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
40538
40908
 
40539
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
40909
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
40540
40910
  var COUNTED_TABLES = [
40541
40911
  "accounts",
40542
40912
  "chats",
@@ -40621,7 +40991,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
40621
40991
  };
40622
40992
  }, "storeContents");
40623
40993
 
40624
- // node_modules/.pnpm/@wirecat+cli-core@0.573.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ebc00d7fcc6d9dd842f7c9d3c7667e19/node_modules/@wirecat/cli-core/dist/store/store.js
40994
+ // node_modules/.pnpm/@wirecat+cli-core@0.576.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8c38491da697a73b6a1be72960f7baeb/node_modules/@wirecat/cli-core/dist/store/store.js
40625
40995
  var openStore = /* @__PURE__ */ __name(async (options = {}) => {
40626
40996
  const context = await openStoreContext(options);
40627
40997
  try {
@@ -40674,7 +41044,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
40674
41044
  const tasks2 = once3(() => taskStoreOver(context));
40675
41045
  const sourceMentions = once3(() => sourceMentionStoreOver(context));
40676
41046
  const knowledge = once3(() => knowledgeStoreOver(context));
40677
- const notes3 = once3(() => ({ ...notesStoreOver(context), ...noteSearchOver(context) }));
41047
+ const notes2 = once3(() => ({ ...notesStoreOver(context), ...noteSearchOver(context) }));
40678
41048
  const catalog = once3(() => catalogStoreOver(context));
40679
41049
  const files2 = once3(() => filesStoreOver(context));
40680
41050
  const calendar = once3(() => ({ ...eventStoreOver(context), ...eventSearchOver(context) }));
@@ -40686,6 +41056,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
40686
41056
  };
40687
41057
  const facts2 = once3(() => factsStoreOver(context));
40688
41058
  const finance = once3(() => financeStoreOver(context));
41059
+ const orders2 = once3(() => ordersStoreOver(context));
40689
41060
  const records2 = once3(() => recordStoreOver(context));
40690
41061
  const memories2 = once3(() => memoriesStoreOver(context));
40691
41062
  const proposedActions2 = once3(() => proposedActionsStoreOver(context));
@@ -40766,7 +41137,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
40766
41137
  return knowledge();
40767
41138
  },
40768
41139
  get notes() {
40769
- return notes3();
41140
+ return notes2();
40770
41141
  },
40771
41142
  get catalog() {
40772
41143
  return catalog();
@@ -40793,6 +41164,9 @@ var storeOver = /* @__PURE__ */ __name((context) => {
40793
41164
  get finance() {
40794
41165
  return finance();
40795
41166
  },
41167
+ get orders() {
41168
+ return orders2();
41169
+ },
40796
41170
  get records() {
40797
41171
  return records2();
40798
41172
  },
@@ -40921,12 +41295,6 @@ export {
40921
41295
  mayDecide,
40922
41296
  assertMayDecide,
40923
41297
  deciderAuthor,
40924
- minorUnits,
40925
- moneyOf,
40926
- INVOICE_DIRECTIONS,
40927
- INVOICE_STATUSES,
40928
- MONEY_DIRECTIONS,
40929
- FINANCE_REVIEWS,
40930
41298
  openOf,
40931
41299
  refLabel,
40932
41300
  MAX_FILE_BYTES,