@wirecat/mail-cli 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +2 -1
  3. package/dist/bin/mail.js +2 -2
  4. package/dist/bundle/{all-profiles-DTUWUCQQ.js → all-profiles-CI32WFEV.js} +9 -9
  5. package/dist/bundle/{anthropic-YJAEQSNT.js → anthropic-ICSOMJIN.js} +9 -7
  6. package/dist/bundle/{app-server-3ZXSTBA3.js → app-server-3F4ZB7DH.js} +46 -46
  7. package/dist/bundle/{bun-34VBM7C5.js → bun-7AHNFZMZ.js} +2 -2
  8. package/dist/bundle/{bun-sqlite-GCT7ROCK.js → bun-sqlite-UIWRS4HI.js} +4 -4
  9. package/dist/bundle/{chunk-NOVBK4SY.js → chunk-2BAO4T4Z.js} +12 -12
  10. package/dist/bundle/{chunk-UWL2IOII.js → chunk-3QVGB2CI.js} +2 -2
  11. package/dist/bundle/{chunk-HN43G27G.js → chunk-4PNIZUEC.js} +45 -27
  12. package/dist/bundle/{chunk-LF5XM4HE.js → chunk-4TKQIXND.js} +1 -1
  13. package/dist/bundle/{chunk-HSBGNVEL.js → chunk-4YTX5YAU.js} +334 -185
  14. package/dist/bundle/{chunk-LTXYJAJK.js → chunk-5AQ4S4TZ.js} +24 -63
  15. package/dist/bundle/{chunk-ODFHIXMA.js → chunk-5AS5N7V5.js} +1 -1
  16. package/dist/bundle/{chunk-WBAA2X3E.js → chunk-5J4WNTTM.js} +11 -11
  17. package/dist/bundle/{chunk-GAPQENMY.js → chunk-5QQOUYNA.js} +22 -4
  18. package/dist/bundle/{chunk-RPCKBXKN.js → chunk-5Y2WRUYP.js} +2 -2
  19. package/dist/bundle/{chunk-AF62BPIW.js → chunk-5Z7LZAVP.js} +5 -5
  20. package/dist/bundle/{chunk-SYEICLTR.js → chunk-6FSLEARF.js} +1 -1
  21. package/dist/bundle/{chunk-QTMVGOSF.js → chunk-7DFWXIY5.js} +1336 -796
  22. package/dist/bundle/{chunk-J4UZXBEV.js → chunk-7OVVX4F4.js} +1 -1
  23. package/dist/bundle/{chunk-QE72KTS7.js → chunk-7SIWMF77.js} +1 -1
  24. package/dist/bundle/{chunk-J2U6LUT5.js → chunk-7ZDH2XEY.js} +3 -3
  25. package/dist/bundle/{chunk-SFC46MP2.js → chunk-AFPETMXZ.js} +10 -10
  26. package/dist/bundle/{chunk-Z7N4MGOQ.js → chunk-AHRHP2H2.js} +5 -5
  27. package/dist/bundle/{chunk-HJ2CXDKJ.js → chunk-B4MWHI2V.js} +12 -12
  28. package/dist/bundle/{chunk-HRRSTIGP.js → chunk-B6GITVDX.js} +10 -6
  29. package/dist/bundle/{chunk-3DSYLE5N.js → chunk-BT7UUI6E.js} +2 -2
  30. package/dist/bundle/{chunk-72N26BQM.js → chunk-CNYQ3TTZ.js} +88 -88
  31. package/dist/bundle/{chunk-RFB27ACZ.js → chunk-D6WTKSRA.js} +2 -2
  32. package/dist/bundle/{chunk-4FWJNIPH.js → chunk-ELGEHZK2.js} +1 -1
  33. package/dist/bundle/{chunk-3HDQVTND.js → chunk-ETIUB2DF.js} +5 -5
  34. package/dist/bundle/{chunk-VDUGE6TH.js → chunk-FHCOGR7S.js} +2 -2
  35. package/dist/bundle/{chunk-VQZCIDSO.js → chunk-FIZWQTUC.js} +3 -3
  36. package/dist/bundle/{chunk-KMQAHDBM.js → chunk-FVKZ55I2.js} +860 -420
  37. package/dist/bundle/{chunk-BHNBWFT5.js → chunk-GOMJNH56.js} +44 -0
  38. package/dist/bundle/{chunk-FTI73RLC.js → chunk-HGV7DSSA.js} +2 -2
  39. package/dist/bundle/{chunk-RY7PBP4F.js → chunk-HN6PB7F5.js} +16 -16
  40. package/dist/bundle/{chunk-R3WPMQYZ.js → chunk-HRIYU2HJ.js} +245 -387
  41. package/dist/bundle/{chunk-ZKLXSVIO.js → chunk-I3YNNSGB.js} +1 -1
  42. package/dist/bundle/{chunk-MDDB7M7Z.js → chunk-IMIY7HQB.js} +1 -1
  43. package/dist/bundle/{chunk-2PPEDB67.js → chunk-JDKC7EXM.js} +30 -30
  44. package/dist/bundle/{chunk-T3DTYJTG.js → chunk-JO4BJYVE.js} +1 -1
  45. package/dist/bundle/{chunk-O3M2S62X.js → chunk-KJQZXCNK.js} +3 -3
  46. package/dist/bundle/{chunk-25PD6FZY.js → chunk-KNRONMVG.js} +2 -2
  47. package/dist/bundle/{chunk-BMV56JCL.js → chunk-LLYVBO3R.js} +1 -1
  48. package/dist/bundle/{chunk-TCCN5TON.js → chunk-NEDYKKJJ.js} +24 -2
  49. package/dist/bundle/{chunk-OKO2Q6H6.js → chunk-NKDYHAHP.js} +2 -2
  50. package/dist/bundle/{chunk-P2QJA7S5.js → chunk-OMW37FXK.js} +1 -1
  51. package/dist/bundle/{chunk-P6FT6YYT.js → chunk-R4RAWEMV.js} +16 -16
  52. package/dist/bundle/{chunk-V6OIIVH3.js → chunk-RIAZTS6C.js} +11 -11
  53. package/dist/bundle/{chunk-7XLOWYGD.js → chunk-S2U5BXWS.js} +19 -4
  54. package/dist/bundle/{chunk-566MEXK5.js → chunk-SCH3NC5X.js} +3 -3
  55. package/dist/bundle/{chunk-Z75WYAX6.js → chunk-SETCGPFG.js} +7 -7
  56. package/dist/bundle/{chunk-4WIEVQ2Q.js → chunk-SGMENSI6.js} +127 -9
  57. package/dist/bundle/{chunk-I2SDXWLR.js → chunk-TEL2OMS5.js} +97 -54
  58. package/dist/bundle/{chunk-SCIC2CJS.js → chunk-UA4BOLIY.js} +4 -4
  59. package/dist/bundle/{chunk-VINSQR4X.js → chunk-UTLJQG6Q.js} +7 -7
  60. package/dist/bundle/{chunk-ZZSHGCRC.js → chunk-WQRX4RQS.js} +4 -4
  61. package/dist/bundle/{chunk-MD64ITYO.js → chunk-XP5FBDIG.js} +1 -1
  62. package/dist/bundle/{chunk-RT6SLZBI.js → chunk-XV3M3NAN.js} +1 -1
  63. package/dist/bundle/{chunk-B74SOC4R.js → chunk-ZYHBMDNU.js} +8 -8
  64. package/dist/bundle/command-contract-UIRWJVEY.js +35 -0
  65. package/dist/bundle/{decode-BIOOL5E4.js → decode-BJXABRAN.js} +4 -4
  66. package/dist/bundle/{dispatch-R5OF2FVZ.js → dispatch-G4CYFWQ2.js} +1 -1
  67. package/dist/bundle/{dist-TJVIRLE5.js → dist-LLEA6R4V.js} +36 -22
  68. package/dist/bundle/{echarts-ECPGMKXO.js → echarts-YPTKBOZV.js} +2 -2
  69. package/dist/bundle/{embed-F7JFSLHN.js → embed-DMROTI5M.js} +5 -5
  70. package/dist/bundle/{embedder-U4G74HV3.js → embedder-DWMHXCHJ.js} +8 -8
  71. package/dist/bundle/{failure-WYKVF6RH.js → failure-FFPK2WYB.js} +1 -1
  72. package/dist/bundle/{first-run-JTYPUYQP.js → first-run-FQOEF2IO.js} +8 -8
  73. package/dist/bundle/first-screen-B6LF5464.js +33 -0
  74. package/dist/bundle/{instructions-WNCGZ7OJ.js → instructions-OGKMROLD.js} +1 -1
  75. package/dist/bundle/mail.js +5 -5
  76. package/dist/bundle/{node-UIRGGMGT.js → node-HIKYE546.js} +2 -2
  77. package/dist/bundle/{node-sqlite-4ZM7OPRF.js → node-sqlite-3GJAG7VO.js} +5 -5
  78. package/dist/bundle/{oauth-5RAJZPBW.js → oauth-H3DB6IHI.js} +6 -6
  79. package/dist/bundle/{open-7ORCHOAI.js → open-DJ2PRG74.js} +4 -4
  80. package/dist/bundle/{openai-XSJNXJA7.js → openai-MDBRYB55.js} +12 -12
  81. package/dist/bundle/{process-ZLO72UVZ.js → process-4LBD72JH.js} +1 -1
  82. package/dist/bundle/{program-MXGQFQJG.js → program-F6WK6RX4.js} +3699 -2437
  83. package/dist/bundle/{prompt-IDUPCUGM.js → prompt-UNPUG6SO.js} +6 -4
  84. package/dist/bundle/{recognize-OS3EZKIM.js → recognize-DMIO4PDB.js} +3 -3
  85. package/dist/bundle/{remote-PF4LZR65.js → remote-24HJA72D.js} +6 -6
  86. package/dist/bundle/{rerank-CQNZF3JI.js → rerank-PTNCHHIU.js} +6 -6
  87. package/dist/bundle/{serve-Y2DDLGBT.js → serve-T6JHM2YD.js} +8 -8
  88. package/dist/bundle/{server-TVRT7YEY.js → server-BWEYRUR3.js} +36 -36
  89. package/dist/bundle/server-VUQNR5ZD.js +65 -0
  90. package/dist/bundle/{sqlite-runtime-5343C3OE.js → sqlite-runtime-ZJ4EH5ZM.js} +5 -5
  91. package/dist/bundle/{state-4GBTMPIV.js → state-KSN4OFYW.js} +5 -5
  92. package/dist/bundle/{store-OLBLTQPT.js → store-GVBW2ZFK.js} +24 -16
  93. package/dist/bundle/{store-QA6QJ5BB.js → store-OIEZJEA7.js} +31 -14
  94. package/dist/bundle/store-maintenance-command-KJ54HLUQ.js +54 -0
  95. package/dist/commands/account-remove.d.ts +3 -0
  96. package/dist/commands/account-remove.d.ts.map +1 -0
  97. package/dist/commands/account-remove.js +65 -0
  98. package/dist/commands/account-remove.js.map +1 -0
  99. package/dist/commands/account.d.ts.map +1 -1
  100. package/dist/commands/account.js +3 -1
  101. package/dist/commands/account.js.map +1 -1
  102. package/dist/commands/context.d.ts +3 -1
  103. package/dist/commands/context.d.ts.map +1 -1
  104. package/dist/commands/context.js.map +1 -1
  105. package/dist/mail/changes.d.ts +1 -0
  106. package/dist/mail/changes.d.ts.map +1 -1
  107. package/dist/mail/changes.js +1 -1
  108. package/dist/mail/changes.js.map +1 -1
  109. package/dist/providers.js +2 -2
  110. package/dist/providers.js.map +1 -1
  111. package/dist/version.d.ts +1 -1
  112. package/dist/version.js +1 -1
  113. package/package.json +2 -2
  114. package/dist/bundle/chunk-QPRXTLMD.js +0 -33
  115. package/dist/bundle/command-contract-Y4ZQAJEC.js +0 -35
  116. package/dist/bundle/first-screen-W6RWTAU7.js +0 -33
  117. package/dist/bundle/server-I3IALQMC.js +0 -65
  118. package/dist/bundle/store-maintenance-command-LB6CMGP4.js +0 -55
@@ -4,9 +4,6 @@ import {
4
4
  ADDED_ACCOUNT,
5
5
  ADDED_PROVIDER,
6
6
  AMOUNT_ROLES,
7
- CATALOG_KINDS,
8
- CONTRACT_KINDS,
9
- CONTRACT_STATUSES,
10
7
  COUNTER_FIELDS,
11
8
  DECIDED_TABLES,
12
9
  DEFAULT_PHONE_COUNTRIES,
@@ -16,17 +13,12 @@ import {
16
13
  INTERNAL_NOTES,
17
14
  MENTION_KINDS,
18
15
  MENTION_VERSIONS,
19
- ORDER_DIRECTIONS,
20
16
  RECORD_TABLES,
21
17
  RECORD_TYPES,
22
- SUBSCRIPTION_STATUSES,
23
- TRANSACTION_STATUSES,
24
18
  UNKNOWN_PROVIDER,
25
- WALLET_KINDS,
26
19
  addProvider,
27
20
  article,
28
21
  canonicalReference,
29
- contractLine,
30
22
  counterFreshness,
31
23
  counterObservationTime,
32
24
  fieldReferences,
@@ -40,7 +32,6 @@ import {
40
32
  hasV1Roles,
41
33
  holdsKindOf,
42
34
  importedOf,
43
- intervalOf,
44
35
  isBusinessType,
45
36
  isDocumentAccountProvider,
46
37
  isFolderProvider,
@@ -65,7 +56,6 @@ import {
65
56
  parsePhoneCountries,
66
57
  parseReference,
67
58
  pointerOf,
68
- productLine,
69
59
  providerEntryOf,
70
60
  providerLabel,
71
61
  providerNamed,
@@ -76,16 +66,13 @@ import {
76
66
  recordFingerprint,
77
67
  roleOf,
78
68
  siteOf,
79
- subscriptionLine,
80
69
  telegramTarget,
81
70
  trackedOrigin,
82
- transactionLine,
83
71
  typedPhone,
84
72
  unitedKinds,
85
73
  useStoredProviders,
86
- validCounter,
87
- walletLine
88
- } from "./chunk-LTXYJAJK.js";
74
+ validCounter
75
+ } from "./chunk-5AQ4S4TZ.js";
89
76
  import {
90
77
  COUNTERPART_ROLE,
91
78
  FACT_STATUSES,
@@ -111,9 +98,13 @@ import {
111
98
  project,
112
99
  refuseDamagedStore,
113
100
  reminder
114
- } from "./chunk-HJ2CXDKJ.js";
101
+ } from "./chunk-B4MWHI2V.js";
115
102
  import {
103
+ BUSINESS_KINDS,
104
+ CATALOG_KINDS,
116
105
  CHAT_MESSAGES_READ,
106
+ CONTRACT_KINDS,
107
+ CONTRACT_STATUSES,
117
108
  DEAL_KINDS,
118
109
  DEAL_ROLES,
119
110
  DEAL_STATUSES,
@@ -126,6 +117,7 @@ import {
126
117
  MONEY_DIRECTIONS,
127
118
  MeetingError,
128
119
  OPERATORS_BY_TYPE,
120
+ ORDER_DIRECTIONS,
129
121
  ORDER_PURPOSES,
130
122
  ORDER_STATUSES,
131
123
  QUERY_LIMITS,
@@ -134,12 +126,16 @@ import {
134
126
  ROLE_LISTS,
135
127
  STAGE_OUTCOMES,
136
128
  STANDINGS,
129
+ SUBSCRIPTION_STATUSES,
130
+ TRANSACTION_STATUSES,
131
+ WALLET_KINDS,
137
132
  aggregateMeetingCounts,
138
133
  aggregateMeetingStats,
139
134
  calendarText,
140
135
  canonicalMeetingReference,
141
136
  checkEnds,
142
137
  checkRole,
138
+ contractLine,
143
139
  currencyOf,
144
140
  dateRange,
145
141
  dayBoundary,
@@ -156,6 +152,7 @@ import {
156
152
  findingText,
157
153
  formatDecimal,
158
154
  formatMeetingReference,
155
+ intervalOf,
159
156
  inverseOf,
160
157
  invoiceLine,
161
158
  invoiceTitle,
@@ -182,6 +179,7 @@ import {
182
179
  paymentEntryTitle,
183
180
  paymentLine,
184
181
  paymentTitle,
182
+ productLine,
185
183
  quantityOf,
186
184
  queryAstSchema,
187
185
  queryError,
@@ -192,8 +190,10 @@ import {
192
190
  settledStatus,
193
191
  signedMinorUnits,
194
192
  standingOf,
193
+ subscriptionLine,
195
194
  tagOf,
196
195
  timezoneOf,
196
+ transactionLine,
197
197
  transcriptLanguage,
198
198
  usableLinkSql,
199
199
  validEvidence,
@@ -208,11 +208,12 @@ import {
208
208
  validatePayment,
209
209
  validateQuery,
210
210
  walkQuery,
211
+ walletLine,
211
212
  zonedMoment
212
- } from "./chunk-I2SDXWLR.js";
213
+ } from "./chunk-TEL2OMS5.js";
213
214
  import {
214
215
  sqliteCode
215
- } from "./chunk-SYEICLTR.js";
216
+ } from "./chunk-6FSLEARF.js";
216
217
  import {
217
218
  DEFAULT_STEMMERS,
218
219
  DEFAULT_STEMMERS_VERSION,
@@ -225,27 +226,27 @@ import {
225
226
  fold,
226
227
  normalize,
227
228
  parseStemmers
228
- } from "./chunk-VINSQR4X.js";
229
+ } from "./chunk-UTLJQG6Q.js";
229
230
  import {
230
231
  DEFAULT_TASK_CATEGORIES,
231
232
  sharedConfigPath,
232
233
  storedTaskCategories,
233
234
  taskCategoriesReader
234
- } from "./chunk-3HDQVTND.js";
235
+ } from "./chunk-ETIUB2DF.js";
235
236
  import {
236
237
  refuseOwnerStoreInTests,
237
238
  storePath
238
- } from "./chunk-RPCKBXKN.js";
239
+ } from "./chunk-5Y2WRUYP.js";
239
240
  import {
240
241
  quietSqliteWarning,
241
242
  storeCapable
242
- } from "./chunk-AF62BPIW.js";
243
+ } from "./chunk-5Z7LZAVP.js";
243
244
  import {
244
245
  PRAGMAS,
245
246
  TIME_LIMIT_FUNCTION,
246
247
  TimeLimitReached,
247
248
  isQueryOnly
248
- } from "./chunk-ODFHIXMA.js";
249
+ } from "./chunk-5AS5N7V5.js";
249
250
  import {
250
251
  array,
251
252
  boolean,
@@ -263,7 +264,7 @@ import {
263
264
  safeParse,
264
265
  strictObject,
265
266
  string
266
- } from "./chunk-BHNBWFT5.js";
267
+ } from "./chunk-GOMJNH56.js";
267
268
  import {
268
269
  resolveFrom
269
270
  } from "./chunk-Y5E2WNWB.js";
@@ -296,7 +297,7 @@ import {
296
297
  sql,
297
298
  sqliteTable,
298
299
  text
299
- } from "./chunk-RT6SLZBI.js";
300
+ } from "./chunk-XV3M3NAN.js";
300
301
  import {
301
302
  __commonJS,
302
303
  __name,
@@ -10040,7 +10041,7 @@ var require_cjs = __commonJS({
10040
10041
  }
10041
10042
  });
10042
10043
 
10043
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/account-store.js
10044
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/account-store.js
10044
10045
  var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
10045
10046
  const methods = whole;
10046
10047
  return Object.fromEntries(Object.keys(keyed).map((name) => [
@@ -10168,7 +10169,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
10168
10169
  };
10169
10170
  }, "bindAccount");
10170
10171
 
10171
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/search/query.js
10172
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/search/query.js
10172
10173
  var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
10173
10174
  var inSource = /* @__PURE__ */ __name((source2, provider) => source2 === "all" || source2 === "bots" && isBotProvider(provider) || source2 === "personal" && !isBotProvider(provider) || source2 === provider || providerNamed(source2)?.name === provider || isKind(source2) && holdsKindOf(provider, source2), "inSource");
10174
10175
  var fail = /* @__PURE__ */ __name((message3) => {
@@ -10191,7 +10192,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
10191
10192
  return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
10192
10193
  }, "sourceOf");
10193
10194
 
10194
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/search/account-list.js
10195
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/search/account-list.js
10195
10196
  var ACCOUNT_GROUPS = "accountGroups";
10196
10197
  var ACCOUNT_GROUPS_SETTING = "account_groups";
10197
10198
  var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
@@ -10366,16 +10367,16 @@ var READS = {
10366
10367
  events: "calendar events \u2014 no search reads them yet",
10367
10368
  crm: "CRM deals and leads \u2014 search all reads them"
10368
10369
  };
10369
- var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind3) => READS[kind3]) => {
10370
+ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind3) => READS[kind3], alsoFits = () => false) => {
10370
10371
  const chosen = /* @__PURE__ */ new Map();
10371
10372
  const skipped = [];
10372
10373
  for (const { entry: entry2, accounts: accounts2 } of entries) {
10373
- const fits = accounts2.filter((one2) => kinds2.some((kind3) => listedHolds(one2, kind3)));
10374
+ const fits = accounts2.filter((one2) => kinds2.some((kind3) => listedHolds(one2, kind3)) || alsoFits(one2));
10374
10375
  for (const { provider, account } of fits)
10375
10376
  if (!chosen.has(keyOf({ provider, account })))
10376
10377
  chosen.set(keyOf({ provider, account }), { provider, account });
10377
10378
  const known2 = accounts2.filter(({ kind: kind3 }) => kind3 !== void 0);
10378
- const unknown2 = accounts2.filter(({ kind: kind3 }) => kind3 === void 0);
10379
+ const unknown2 = accounts2.filter((one2) => one2.kind === void 0 && !alsoFits(one2));
10379
10380
  if (known2.length)
10380
10381
  for (const { provider, account } of unknown2)
10381
10382
  skipped.push({ source: `${provider}:${account}`, code: "not_found", reason: UNKNOWN_PROVIDER });
@@ -10389,7 +10390,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind3)
10389
10390
  return { accounts: [...chosen.values()], skipped };
10390
10391
  }, "fitting");
10391
10392
 
10392
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
10393
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
10393
10394
  var IndexBuilderOn = class {
10394
10395
  static {
10395
10396
  __name(this, "IndexBuilderOn");
@@ -10584,7 +10585,7 @@ function alias(table, alias2) {
10584
10585
  }
10585
10586
  __name(alias, "alias");
10586
10587
 
10587
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
10588
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
10588
10589
  var ENTITY_TABLES = {
10589
10590
  ...RECORD_TABLES,
10590
10591
  account: "accounts",
@@ -10596,6 +10597,7 @@ var ENTITY_TABLES = {
10596
10597
  document: "documents",
10597
10598
  document_picture: "documents",
10598
10599
  email: "emails",
10600
+ email_enrichment: "emails",
10599
10601
  email_thread: "email_threads",
10600
10602
  event: "events",
10601
10603
  event_series: "event_series",
@@ -10622,14 +10624,14 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
10622
10624
  return { table, pointer, type, count, known: known2 };
10623
10625
  }).filter(({ count }) => count > 0)), "orphanPointers");
10624
10626
 
10625
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/source-review.js
10627
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/source-review.js
10626
10628
  var SOURCE_REVIEW_KIND = "memory_source_review";
10627
10629
  var SOURCE_REVIEW_CAUSES = ["changed", "outdated", "deleted", "contradicted"];
10628
10630
  var ERASED_TEXT = "[source erased]";
10629
10631
  var severity = /* @__PURE__ */ __name((cause) => SOURCE_REVIEW_CAUSES.indexOf(cause), "severity");
10630
10632
  var graver = /* @__PURE__ */ __name((a, b) => severity(b) > severity(a) ? b : a, "graver");
10631
10633
 
10632
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
10634
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
10633
10635
  var BOT_KINDS = ["agent", "rule", "script", "integration"];
10634
10636
  var ownerPerson = /* @__PURE__ */ __name((database) => {
10635
10637
  const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
@@ -10686,7 +10688,7 @@ var proposedBySql = /* @__PURE__ */ __name((type, id2, by) => {
10686
10688
  return { sql: bot("pb.name = ?"), params: [by.bot] };
10687
10689
  }, "proposedBySql");
10688
10690
 
10689
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review-marks.js
10691
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review-marks.js
10690
10692
  var TABLES = { memory: "memories", fact: "facts" };
10691
10693
  var HOLDING = { memory: ["proposed", "confirmed"], fact: ["proposed", "accepted"] };
10692
10694
  var KEPT = 20;
@@ -10781,7 +10783,7 @@ var scrubSourceReviews = /* @__PURE__ */ __name((database, erased, { refs }) =>
10781
10783
  return scrubbed;
10782
10784
  }, "scrubSourceReviews");
10783
10785
 
10784
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
10786
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
10785
10787
  var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
10786
10788
  var REFERABLE = {
10787
10789
  ...Object.fromEntries(Object.entries(RECORD_TYPES).map(([type, { tombstone: tombstone2 }]) => [type, { tombstone: tombstone2 }])),
@@ -10941,7 +10943,7 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
10941
10943
  return row2 ? String(row2.id ?? row2.key) : void 0;
10942
10944
  }, "taskIdOf");
10943
10945
 
10944
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-signature.js
10946
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-signature.js
10945
10947
  var QUOTE_LIMIT = 500;
10946
10948
  var GONE = { sig: "gone", rev: null, deleted: true, changedAt: null };
10947
10949
  var part = /* @__PURE__ */ __name((value) => value == null ? "" : String(value), "part");
@@ -11219,7 +11221,7 @@ var deleteDocumentRow = /* @__PURE__ */ __name((database, id2, at) => {
11219
11221
  database.prepare("DELETE FROM documents WHERE id = ?").run(id2);
11220
11222
  }, "deleteDocumentRow");
11221
11223
 
11222
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
11224
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
11223
11225
  var canonicalTags = sqliteTable("canonical_tags", {
11224
11226
  id: integer("id").primaryKey(),
11225
11227
  name: text("name").notNull().unique(),
@@ -11228,7 +11230,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
11228
11230
  updatedAt: integer("updated_at").notNull()
11229
11231
  });
11230
11232
 
11231
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/link-revisions.js
11233
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/link-revisions.js
11232
11234
  var linkRevisions = sqliteTable("link_revisions", {
11233
11235
  id: integer("id").primaryKey(),
11234
11236
  linkId: integer("link_id").notNull(),
@@ -11240,7 +11242,7 @@ var linkRevisions = sqliteTable("link_revisions", {
11240
11242
  createdAt: integer("created_at").notNull()
11241
11243
  }, (table) => [index("link_revisions_by_link_id_created_at").on(table.linkId, table.createdAt)]);
11242
11244
 
11243
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
11245
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
11244
11246
  var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
11245
11247
  sourceKey: text("source_key").notNull(),
11246
11248
  collection: text("collection").notNull(),
@@ -11250,13 +11252,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
11250
11252
  createdAt: integer("created_at").notNull()
11251
11253
  }, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
11252
11254
 
11253
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
11255
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
11254
11256
  var documentIndexPending = sqliteTable("document_index_pending", {
11255
11257
  id: integer("id").notNull(),
11256
11258
  indexableType: text("indexable_type").notNull()
11257
11259
  }, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
11258
11260
 
11259
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/decision-requests.js
11261
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/decision-requests.js
11260
11262
  var decisionRequests = sqliteTable("decision_requests", {
11261
11263
  id: integer("id").primaryKey(),
11262
11264
  tokenDigest: text("token_digest").notNull().unique(),
@@ -11276,7 +11278,19 @@ var decisionRequests = sqliteTable("decision_requests", {
11276
11278
  index("decision_requests_by_channel_bot_profile_chat_id_message_id").on(table.channel, table.botProfile, table.chatId, table.messageId)
11277
11279
  ]);
11278
11280
 
11279
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/links.js
11281
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/enrichments.js
11282
+ var enrichments = sqliteTable("enrichments", {
11283
+ subjectType: text("subject_type").notNull(),
11284
+ subjectId: integer("subject_id").notNull(),
11285
+ sourceHash: text("source_hash").notNull(),
11286
+ provider: text("provider").notNull(),
11287
+ model: text("model").notNull(),
11288
+ text: text("text").notNull(),
11289
+ tokens: integer("tokens").notNull(),
11290
+ createdAt: integer("created_at").notNull()
11291
+ }, (table) => [primaryKey({ columns: [table.subjectType, table.subjectId] })]);
11292
+
11293
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/links.js
11280
11294
  var links = sqliteTable("links", {
11281
11295
  id: integer("id").primaryKey(),
11282
11296
  fromType: text("from_type").notNull(),
@@ -11307,7 +11321,7 @@ var links = sqliteTable("links", {
11307
11321
  index("links_by_to_type_to_id").on(table.toType, table.toId)
11308
11322
  ]);
11309
11323
 
11310
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
11324
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
11311
11325
  var tagRedirects = sqliteTable("tag_redirects", {
11312
11326
  sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
11313
11327
  survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
@@ -11333,7 +11347,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
11333
11347
  index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
11334
11348
  ]);
11335
11349
 
11336
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
11350
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
11337
11351
  var accounts = sqliteTable("accounts", {
11338
11352
  id: integer("id").primaryKey(),
11339
11353
  provider: text("provider").notNull(),
@@ -13329,10 +13343,10 @@ var storeSettings = sqliteTable("store_settings", {
13329
13343
  at: integer("at").notNull()
13330
13344
  });
13331
13345
 
13332
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
13346
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
13333
13347
  import { AsyncLocalStorage } from "node:async_hooks";
13334
13348
 
13335
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
13349
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
13336
13350
  var ARMS = [
13337
13351
  [
13338
13352
  "message",
@@ -13425,16 +13439,15 @@ var linkArm = /* @__PURE__ */ __name((linkFrom, linkTo) => `
13425
13439
  WHERE l.to_type IN ('person','identity') AND l.to_id IS NOT NULL AND ${usableLinkSql("l")} AND (l.from_type<>'message' OR m.deleted_at IS NULL) AND (l.from_type<>'email' OR e.deleted_at IS NULL) AND (l.from_type<>'meeting' OR mt.deleted_at IS NULL) AND (l.from_type<>'task' OR t.deleted_at IS NULL) AND (l.from_type<>'document' OR d.deleted_at IS NULL)
13426
13440
  `, "linkArm");
13427
13441
  var COLUMNS = "SELECT NULL AS person_id, NULL AS identity_id, NULL AS subject_type, NULL AS subject_id, NULL AS role, NULL AS occurred_at, NULL AS scope, NULL AS account_id, NULL AS project_id WHERE 0";
13428
- var sourcesOf = /* @__PURE__ */ __name((subject2) => {
13429
- if (subject2 === void 0)
13442
+ var sourcesOf = /* @__PURE__ */ __name((type) => {
13443
+ if (type === void 0)
13430
13444
  return [COLUMNS, ...ARMS.map(([, , sql2]) => sql2), linkArm("1", "1")].join(" UNION ");
13431
- if (!/^[a-z_]+$/.test(subject2.type) || !Number.isSafeInteger(subject2.id))
13432
- throw new CliError("configuration_error", `the involvement queue holds ${subject2.type} ${subject2.id}`);
13433
- const { type, id: id2 } = subject2;
13445
+ if (!/^[a-z_]+$/.test(type))
13446
+ throw new CliError("configuration_error", `the involvement queue holds a ${type}`);
13434
13447
  return [
13435
13448
  COLUMNS,
13436
- ...ARMS.filter(([of]) => of === type).map(([, key2, sql2]) => `${sql2} AND ${key2}=${id2}`),
13437
- linkArm(`from_type='${type}' AND from_id=${id2}`, `to_type='${type}' AND to_id=${id2}`)
13449
+ ...ARMS.filter(([of]) => of === type).map(([, key2, sql2]) => `${sql2} AND ${key2}=?`),
13450
+ linkArm(`from_type='${type}' AND from_id=?`, `to_type='${type}' AND to_id=?`)
13438
13451
  ].join(" UNION ");
13439
13452
  }, "sourcesOf");
13440
13453
  var INSERT = "INSERT INTO involvements (person_id, identity_id, subject_type, subject_id, role, occurred_at, scope, account_id, project_id, created_at)";
@@ -13451,7 +13464,9 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
13451
13464
  break;
13452
13465
  for (const subject2 of subjects) {
13453
13466
  drop.run(subject2.type, subject2.id);
13454
- database.prepare(`${INSERT} SELECT s.*, ? FROM (${sourcesOf(subject2)}) s JOIN persons p ON p.id=s.person_id`).run(at);
13467
+ const sql2 = `${INSERT} SELECT s.*, ? FROM (${sourcesOf(subject2.type)}) s JOIN persons p ON p.id=s.person_id`;
13468
+ const ids = Array(sql2.split("?").length - 2).fill(subject2.id);
13469
+ database.prepare(sql2).run(at, ...ids);
13455
13470
  done.run(subject2.type, subject2.id);
13456
13471
  }
13457
13472
  recomputed += subjects.length;
@@ -13459,7 +13474,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
13459
13474
  return recomputed;
13460
13475
  }, "drainInvolvementQueue");
13461
13476
 
13462
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/first-names.js
13477
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/domain/first-names.js
13463
13478
  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";
13464
13479
  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";
13465
13480
  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";
@@ -13467,7 +13482,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
13467
13482
  var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
13468
13483
  var NAME_WORDS = WORDS.split(" ");
13469
13484
 
13470
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/person-names.js
13485
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/domain/person-names.js
13471
13486
  var LATIN_TO_CYRILLIC = {
13472
13487
  shch: "\u0449",
13473
13488
  sch: "\u0449",
@@ -13675,7 +13690,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text6, stem, taken) => {
13675
13690
  return found2;
13676
13691
  }, "findUnknownNames");
13677
13692
 
13678
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/attachments.js
13693
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/domain/attachments.js
13679
13694
  var NOT_FILES = /* @__PURE__ */ new Set([
13680
13695
  "webpage",
13681
13696
  "share",
@@ -13715,7 +13730,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored4, files2) => {
13715
13730
  });
13716
13731
  }, "matchDownloads");
13717
13732
 
13718
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
13733
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
13719
13734
  var QUERY_VERSION = 1;
13720
13735
  var QUERY_LIMITS2 = {
13721
13736
  ...QUERY_LIMITS,
@@ -13751,7 +13766,7 @@ function exhausted(budget) {
13751
13766
  }
13752
13767
  __name(exhausted, "exhausted");
13753
13768
 
13754
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
13769
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
13755
13770
  var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
13756
13771
  var literal2 = /* @__PURE__ */ __name((c) => ({
13757
13772
  kind: "char",
@@ -14151,7 +14166,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
14151
14166
  return out;
14152
14167
  }, "foldRegex");
14153
14168
 
14154
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
14169
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
14155
14170
  var PRESET_VERSION = 1;
14156
14171
  var PRESETS = {
14157
14172
  password: {
@@ -14205,7 +14220,7 @@ var PRESETS = {
14205
14220
  }
14206
14221
  };
14207
14222
 
14208
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
14223
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
14209
14224
  var FIELD_VERSION = 2;
14210
14225
  var UNITS = {
14211
14226
  "": 1,
@@ -14666,12 +14681,12 @@ var validateAst = /* @__PURE__ */ __name((input) => {
14666
14681
  return validateFields(parsed3.output);
14667
14682
  }, "validateAst");
14668
14683
 
14669
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
14684
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
14670
14685
  var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
14671
14686
  var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
14672
14687
  var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
14673
14688
 
14674
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
14689
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
14675
14690
  var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
14676
14691
  var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
14677
14692
  var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
@@ -14695,7 +14710,7 @@ var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
14695
14710
  };
14696
14711
  }, "linkMatch");
14697
14712
 
14698
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
14713
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
14699
14714
  var SETTING = "phoneCountries";
14700
14715
  var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
14701
14716
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
@@ -14726,7 +14741,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
14726
14741
  return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
14727
14742
  }, "valueMatch");
14728
14743
 
14729
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
14744
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
14730
14745
  var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
14731
14746
  if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
14732
14747
  throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
@@ -14754,7 +14769,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
14754
14769
  return 2 * intersection2 / (aa.size + bb.size);
14755
14770
  }, "vocabularySimilarity");
14756
14771
 
14757
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
14772
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
14758
14773
  import { createHash } from "node:crypto";
14759
14774
  var folded2 = /* @__PURE__ */ __name((name) => {
14760
14775
  try {
@@ -14820,7 +14835,7 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind3, by, options
14820
14835
  });
14821
14836
  }, "guardTagCreation");
14822
14837
 
14823
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
14838
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
14824
14839
  var invalid = /* @__PURE__ */ __name((message3) => {
14825
14840
  throw new CliError("validation_error", message3);
14826
14841
  }, "invalid");
@@ -14897,7 +14912,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
14897
14912
  };
14898
14913
  }, "createTagRedirectIndex");
14899
14914
 
14900
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
14915
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
14901
14916
  var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
14902
14917
  const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
14903
14918
  if (!row2)
@@ -14925,7 +14940,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
14925
14940
  return snapshot2;
14926
14941
  }, "tagRedirectSnapshot");
14927
14942
 
14928
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
14943
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
14929
14944
  import { createHash as createHash2 } from "node:crypto";
14930
14945
  var TASK_KEY_PREFIXES = {
14931
14946
  question: "Q",
@@ -14953,7 +14968,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
14953
14968
  return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
14954
14969
  }, "taskAccountOf");
14955
14970
 
14956
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
14971
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
14957
14972
  var toMs = /* @__PURE__ */ __name((iso16) => {
14958
14973
  if (iso16 === null || iso16 === void 0)
14959
14974
  return null;
@@ -14967,7 +14982,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
14967
14982
  var DELIVERY = { delivered: 1, read: 2 };
14968
14983
  var deliveryOf = /* @__PURE__ */ __name((stored4) => stored4 === DELIVERY.read ? "read" : stored4 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
14969
14984
 
14970
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
14985
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
14971
14986
  var TAG_KINDS = ["tag", "topic"];
14972
14987
  var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
14973
14988
  var TAG_TYPE = {
@@ -15170,7 +15185,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
15170
15185
  return result;
15171
15186
  }, "tagsOf");
15172
15187
 
15173
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
15188
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
15174
15189
  var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
15175
15190
  var SPEECH = speech("att");
15176
15191
  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");
@@ -15534,7 +15549,7 @@ var FIELD_COMPILERS = {
15534
15549
  subject
15535
15550
  };
15536
15551
 
15537
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
15552
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
15538
15553
  var placeOf = /* @__PURE__ */ __name((database) => {
15539
15554
  const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
15540
15555
  const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
@@ -15550,7 +15565,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
15550
15565
  };
15551
15566
  }, "placeOf");
15552
15567
 
15553
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
15568
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
15554
15569
  var DRAIN_ON_WRITE = 500;
15555
15570
  var METHOD = "rules";
15556
15571
  var telegramLink = /* @__PURE__ */ __name((database) => {
@@ -15713,7 +15728,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
15713
15728
  return queued.length;
15714
15729
  }, "drainMentions");
15715
15730
 
15716
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
15731
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
15717
15732
  var indexRow = /* @__PURE__ */ __name((database, name) => {
15718
15733
  const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
15719
15734
  if (!exists2)
@@ -15721,7 +15736,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
15721
15736
  return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
15722
15737
  }, "indexRow");
15723
15738
 
15724
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
15739
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
15725
15740
  var INDEX = "message_stems";
15726
15741
  var SETTING2 = "searchStemmers";
15727
15742
  var DRAIN_ON_WRITE2 = 500;
@@ -15843,7 +15858,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
15843
15858
  };
15844
15859
  }, "stemmerCache");
15845
15860
 
15846
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
15861
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
15847
15862
  var rehearsal = new AsyncLocalStorage();
15848
15863
  var SQLITE_BUSY = 5;
15849
15864
  var pause = new Int32Array(new SharedArrayBuffer(4));
@@ -15977,7 +15992,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
15977
15992
  }
15978
15993
  }, "read");
15979
15994
 
15980
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
15995
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
15981
15996
  var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
15982
15997
  coalesce(CASE k.chunkable_type
15983
15998
  WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
@@ -16119,7 +16134,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
16119
16134
  }, "dropUnusedVectors");
16120
16135
  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");
16121
16136
 
16122
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
16137
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
16123
16138
  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({
16124
16139
  target: [accounts.provider, accounts.externalId],
16125
16140
  set: {
@@ -16250,7 +16265,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
16250
16265
  AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
16251
16266
  }, "dropOrphanPeople");
16252
16267
 
16253
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
16268
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
16254
16269
  var FOLDED = [
16255
16270
  { table: "tasks", column: "title" },
16256
16271
  { table: "tasks", column: "close_reason" },
@@ -16287,7 +16302,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
16287
16302
  return filled2;
16288
16303
  }, "fillFolded");
16289
16304
 
16290
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/history-skips.js
16305
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/history-skips.js
16291
16306
  var HISTORY_KEY = "$history";
16292
16307
  var objectOf = /* @__PURE__ */ __name((text6) => {
16293
16308
  if (typeof text6 !== "string")
@@ -16363,7 +16378,7 @@ var withoutHistory = /* @__PURE__ */ __name((metadata3) => {
16363
16378
  return rest;
16364
16379
  }, "withoutHistory");
16365
16380
 
16366
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
16381
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
16367
16382
  import { createHash as createHash3 } from "node:crypto";
16368
16383
  var CHUNK_CHARS = 1200;
16369
16384
  var CHUNK_OVERLAP = 150;
@@ -16468,7 +16483,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
16468
16483
  return chunks2;
16469
16484
  }, "cutChunks");
16470
16485
 
16471
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/search/task-signature.js
16486
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/search/task-signature.js
16472
16487
  var DAY = 864e5;
16473
16488
  var CURRENCY = [
16474
16489
  [/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
@@ -16594,7 +16609,7 @@ var dueDayOf = /* @__PURE__ */ __name((text6, createdMs) => {
16594
16609
  return best?.day ?? null;
16595
16610
  }, "dueDayOf");
16596
16611
 
16597
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
16612
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
16598
16613
  var DAY2 = 864e5;
16599
16614
  var STOP_WORDS = new Set([
16600
16615
  // Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
@@ -16749,7 +16764,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
16749
16764
  ...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
16750
16765
  })).sort((a, b) => b.score - a.score), "rankCandidates");
16751
16766
 
16752
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
16767
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
16753
16768
  var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
16754
16769
  r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
16755
16770
  JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
@@ -17019,8 +17034,12 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
17019
17034
  vectors: { chunks: chunks2, embedded: Number(vectors?.embedded ?? 0), current, stale: stale4, missing: chunks2 - current - stale4 }
17020
17035
  };
17021
17036
  }, "readiness");
17037
+ var vectorCounts = /* @__PURE__ */ __name(({ orm }, models) => new Map(models.map((model) => [
17038
+ model,
17039
+ Number(orm.get(sql`SELECT count(*) AS n FROM embeddings WHERE model = ${model}`)?.n ?? 0)
17040
+ ])), "vectorCounts");
17022
17041
 
17023
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
17042
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
17024
17043
  var DOCUMENT_PICTURE = "document_picture";
17025
17044
  var SCAN_PAGE2 = 5e3;
17026
17045
  var idOf = /* @__PURE__ */ __name((ref3) => {
@@ -17083,7 +17102,106 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
17083
17102
  }, "nearestPictures")
17084
17103
  }), "documentPicturesOver");
17085
17104
 
17086
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
17105
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/index-text.js
17106
+ var noteIndexText = /* @__PURE__ */ __name((title, text6) => title ? `${title}
17107
+
17108
+ ${text6}` : text6, "noteIndexText");
17109
+
17110
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/enrichments.js
17111
+ var ENRICHMENT_SUBJECTS = ["document", "note", "email"];
17112
+ var ENRICHMENT_POSITION = 1e6;
17113
+ var EMAIL_ENRICHMENT = "email_enrichment";
17114
+ var LIVE2 = {
17115
+ document: "SELECT d.id, d.title, coalesce(d.body, '') AS body, coalesce(d.external_updated_at, d.updated_at) AS at FROM documents d WHERE d.deleted_at IS NULL AND coalesce(json_extract(d.metadata, '$.catalog.active'), 1) = 1",
17116
+ note: "SELECT n.id, n.title, coalesce(n.body, '') AS body, n.updated_at AS at FROM notes n WHERE n.deleted_at IS NULL",
17117
+ email: "SELECT e.id, e.subject AS title, coalesce(e.body_text, '') AS body, coalesce(e.sent_at, e.received_at) AS at FROM emails e WHERE e.deleted_at IS NULL"
17118
+ };
17119
+ var QUEUES = {
17120
+ document: "INSERT OR IGNORE INTO document_index_pending (indexable_type, id) VALUES ('document', ?)",
17121
+ note: "INSERT OR IGNORE INTO note_index_pending (indexable_type, id) VALUES ('note', ?)",
17122
+ email: "INSERT OR IGNORE INTO email_index_pending (indexable_type, id) VALUES ('email', ?)"
17123
+ };
17124
+ var currentEnrichment = /* @__PURE__ */ __name((database, type, id2, indexed) => {
17125
+ if (!ENRICHMENT_SUBJECTS.includes(type))
17126
+ return void 0;
17127
+ const row2 = database.prepare("SELECT text, source_hash FROM enrichments WHERE subject_type = ? AND subject_id = ?").get(type, id2);
17128
+ return row2 && String(row2.source_hash) === chunkHash(indexed) ? String(row2.text) : void 0;
17129
+ }, "currentEnrichment");
17130
+ var enrichmentText = /* @__PURE__ */ __name((database, type, id2) => {
17131
+ const row2 = database.prepare("SELECT text FROM enrichments WHERE subject_type = ? AND subject_id = ?").get(type === EMAIL_ENRICHMENT ? "email" : type, id2);
17132
+ return row2 === void 0 ? void 0 : String(row2.text);
17133
+ }, "enrichmentText");
17134
+ var scan = /* @__PURE__ */ __name(function* (database, type, only) {
17135
+ const held = new Map(database.prepare("SELECT subject_id AS id, source_hash AS hash FROM enrichments WHERE subject_type = ?").all(type).map((row2) => [Number(row2.id), String(row2.hash)]));
17136
+ for (const row2 of database.prepare(`${LIVE2[type]} ORDER BY 1`).all()) {
17137
+ const id2 = Number(row2.id);
17138
+ if (only && !only.has(id2))
17139
+ continue;
17140
+ const title = row2.title == null ? null : String(row2.title);
17141
+ const text6 = noteIndexText(title, String(row2.body));
17142
+ if (!text6.trim())
17143
+ continue;
17144
+ const hash2 = chunkHash(text6);
17145
+ yield { type, id: id2, text: text6, at: row2.at == null ? null : Number(row2.at), hash: hash2, enriched: held.get(id2) === hash2 };
17146
+ }
17147
+ }, "scan");
17148
+ var enrichmentsOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
17149
+ pending: /* @__PURE__ */ __name(async (limit, { types = ENRICHMENT_SUBJECTS, only } = {}) => {
17150
+ const found2 = [];
17151
+ for (const type of types) {
17152
+ const ids = only ? new Set(only.filter((one2) => one2.type === type).map((one2) => one2.id)) : void 0;
17153
+ if (ids?.size === 0)
17154
+ continue;
17155
+ for (const { enriched, ...candidate } of scan(database, type, ids)) {
17156
+ if (found2.length >= limit)
17157
+ return found2;
17158
+ if (!enriched)
17159
+ found2.push(candidate);
17160
+ }
17161
+ }
17162
+ return found2;
17163
+ }, "pending"),
17164
+ counts: /* @__PURE__ */ __name(async () => {
17165
+ const counts = {
17166
+ records: 0,
17167
+ enriched: 0,
17168
+ pendingChars: 0,
17169
+ pendingByType: { document: 0, note: 0, email: 0 }
17170
+ };
17171
+ for (const type of ENRICHMENT_SUBJECTS)
17172
+ for (const one2 of scan(database, type)) {
17173
+ counts.records += 1;
17174
+ if (one2.enriched)
17175
+ counts.enriched += 1;
17176
+ else {
17177
+ counts.pendingChars += one2.text.length;
17178
+ counts.pendingByType[type] += 1;
17179
+ }
17180
+ }
17181
+ return counts;
17182
+ }, "counts"),
17183
+ save: /* @__PURE__ */ __name(async (rows) => write(database, () => {
17184
+ const upsert2 = database.prepare(`INSERT INTO enrichments (subject_type, subject_id, source_hash, provider, model, text, tokens, created_at)
17185
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
17186
+ ON CONFLICT (subject_type, subject_id) DO UPDATE SET source_hash = excluded.source_hash,
17187
+ provider = excluded.provider, model = excluded.model, text = excluded.text, tokens = excluded.tokens,
17188
+ created_at = excluded.created_at`);
17189
+ const at = now2();
17190
+ for (const row2 of rows) {
17191
+ upsert2.run(row2.type, row2.id, row2.hash, row2.provider, row2.model, row2.text, row2.tokens, at);
17192
+ database.prepare(QUEUES[row2.type]).run(row2.id);
17193
+ }
17194
+ }), "save"),
17195
+ clear: /* @__PURE__ */ __name(async () => write(database, () => {
17196
+ const rows = database.prepare("SELECT subject_type AS type, subject_id AS id FROM enrichments").all();
17197
+ for (const row2 of rows)
17198
+ database.prepare(QUEUES[row2.type]).run(Number(row2.id));
17199
+ database.prepare("DELETE FROM enrichments").run();
17200
+ return rows.length;
17201
+ }), "clear")
17202
+ }), "enrichmentsOver");
17203
+
17204
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
17087
17205
  var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
17088
17206
  const literal5 = escaped2 ?? plain2 ?? "";
17089
17207
  return wildcard ?? (/[*?[]/u.test(literal5) ? `[${literal5}]` : literal5);
@@ -17148,7 +17266,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
17148
17266
  var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
17149
17267
  var bound2 = /* @__PURE__ */ __name(({ sql: text6, params }) => sql.join(text6.split("?").map((part2, at) => at < params.length ? sql`${sql.raw(part2)}${params[at]}` : sql.raw(part2)), sql``), "bound");
17150
17268
 
17151
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
17269
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
17152
17270
  var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
17153
17271
  var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
17154
17272
  var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
@@ -17238,7 +17356,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
17238
17356
  });
17239
17357
  }, "linkMeeting");
17240
17358
 
17241
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
17359
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
17242
17360
  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), ''))";
17243
17361
  var UNSEARCHED_EVENT_TYPES = [
17244
17362
  "working-location",
@@ -17301,9 +17419,6 @@ var CORPORA = {
17301
17419
  read: `SELECT e.title, ${EVENT_TEXT} AS body, ${EVENT_LIVE} AS live, coalesce((SELECT a.scope FROM calendar_entries ce JOIN calendars c ON c.id = ce.calendar_id JOIN accounts a ON a.id = c.account_id WHERE ce.event_id = e.id LIMIT 1), 'personal') AS scope, (SELECT c.account_id FROM calendar_entries ce JOIN calendars c ON c.id = ce.calendar_id WHERE ce.event_id = e.id AND ce.deleted_at IS NULL ORDER BY ce.id LIMIT 1) AS account_id FROM events e WHERE e.id = ?`
17302
17420
  }
17303
17421
  };
17304
- var noteIndexText = /* @__PURE__ */ __name((title, text6) => title ? `${title}
17305
-
17306
- ${text6}` : text6, "noteIndexText");
17307
17422
  var queuedAs = /* @__PURE__ */ __name((corpus) => corpus.queued ?? corpus.type, "queuedAs");
17308
17423
  var hasTrigrams = /* @__PURE__ */ __name((corpus) => corpus.type === "note" || corpus.type === "document", "hasTrigrams");
17309
17424
  var holdingText = /* @__PURE__ */ __name((type, column2, search2) => {
@@ -17386,27 +17501,44 @@ var writer2 = /* @__PURE__ */ __name((database, corpus, stemmer) => {
17386
17501
  stems: database.prepare(`INSERT INTO ${corpus.type}_stems (rowid, stems, scope) VALUES (?, ?, ?)`),
17387
17502
  trigrams: hasTrigrams(corpus) ? database.prepare(`INSERT INTO ${corpus.type}_trigrams (rowid, text) VALUES (?, ?)`) : null,
17388
17503
  chunk: database.prepare("INSERT INTO chunks (chunkable_type, chunkable_id, position, start_offset, end_offset, content_hash, scope, account_id, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"),
17389
- dequeue: database.prepare(`DELETE FROM ${corpus.type}_index_pending WHERE indexable_type = ? AND id = ?`)
17504
+ dequeue: database.prepare(`DELETE FROM ${corpus.type}_index_pending WHERE indexable_type = ? AND id = ?`),
17505
+ emailAt: database.prepare("SELECT coalesce(received_at, sent_at) AS at FROM emails WHERE id = ?")
17390
17506
  };
17507
+ const enrichedType = corpus.type === "email" ? EMAIL_ENRICHMENT : corpus.type;
17391
17508
  return (id2) => {
17392
17509
  const row2 = read3.get(id2);
17393
- const before2 = oldHashes.all(corpus.type, id2).map((hash2) => String(hash2.hash));
17510
+ const before2 = [
17511
+ ...oldHashes.all(corpus.type, id2).map((hash2) => String(hash2.hash)),
17512
+ ...corpus.type === "email" ? oldHashes.all(EMAIL_ENRICHMENT, id2).map((hash2) => String(hash2.hash)) : []
17513
+ ];
17394
17514
  statements.dropWords.run(id2);
17395
17515
  statements.dropStems.run(id2);
17396
17516
  statements.dropTrigrams?.run(id2);
17397
17517
  statements.dropChunks.run(corpus.type, id2);
17518
+ if (corpus.type === "email")
17519
+ statements.dropChunks.run(EMAIL_ENRICHMENT, id2);
17398
17520
  const live2 = row2 !== void 0 && Number(row2.live) === 1;
17399
17521
  const text6 = live2 ? noteIndexText(row2.title == null ? null : String(row2.title), String(row2.body)) : "";
17400
17522
  const scope3 = live2 ? String(row2.scope ?? "personal") : "";
17523
+ const enrichment = text6.trim() ? currentEnrichment(database, corpus.type, id2, text6) : void 0;
17401
17524
  const terms2 = corpus.terms && text6 ? corpus.terms(text6, stemmer) : void 0;
17402
17525
  const words3 = terms2 ? terms2.words : normalize(text6);
17403
17526
  if (words3 !== "") {
17404
17527
  statements.words.run(id2, words3, scope3);
17405
17528
  statements.trigrams?.run(id2, words3);
17406
17529
  }
17407
- const stems = terms2 ? terms2.stems : text6 ? stemmer.indexText(text6) : "";
17530
+ const stems = terms2 ? terms2.stems : text6 ? stemmer.indexText(enrichment ? `${text6}
17531
+
17532
+ ${enrichment}` : text6) : "";
17408
17533
  if (stems !== "")
17409
17534
  statements.stems.run(id2, stems, scope3);
17535
+ if (enrichment) {
17536
+ const at = Date.now();
17537
+ const occurred = corpus.type === "email" ? int(statements.emailAt.get(id2)?.at) : null;
17538
+ statements.chunk.run(enrichedType, id2, corpus.type === "email" ? 0 : ENRICHMENT_POSITION, 0, 0, chunkHash(enrichment), scope3, int(row2?.account_id), at, at);
17539
+ if (occurred !== null && occurred !== void 0)
17540
+ database.prepare("UPDATE chunks SET occurred_at = ? WHERE chunkable_type = ? AND chunkable_id = ?").run(occurred, EMAIL_ENRICHMENT, id2);
17541
+ }
17410
17542
  if (text6.trim() && corpus.pieces !== false) {
17411
17543
  const at = Date.now();
17412
17544
  const sections = row2?.metadata == null ? [] : storedSections(String(row2.metadata));
@@ -17470,7 +17602,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
17470
17602
  return true;
17471
17603
  }, "resetNoteIndex");
17472
17604
 
17473
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
17605
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
17474
17606
  var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
17475
17607
  var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
17476
17608
  for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
@@ -17489,7 +17621,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
17489
17621
  }
17490
17622
  }, "resolvePersonLinks");
17491
17623
 
17492
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
17624
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
17493
17625
  var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
17494
17626
  var prepare = /* @__PURE__ */ __name((orm) => ({
17495
17627
  find: orm.select({
@@ -17714,7 +17846,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
17714
17846
  }, "meetingIdentityPk");
17715
17847
  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");
17716
17848
 
17717
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
17849
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
17718
17850
  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");
17719
17851
  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");
17720
17852
  var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
@@ -18002,7 +18134,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
18002
18134
  }
18003
18135
  }, "replaceAutoTags");
18004
18136
 
18005
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/context/evidence.js
18137
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/context/evidence.js
18006
18138
  import { createHash as createHash4 } from "node:crypto";
18007
18139
  var CONTEXT_MAX_READ_BYTES = 262144;
18008
18140
  var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
@@ -18100,7 +18232,7 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
18100
18232
  return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
18101
18233
  }, "contextEvidenceRequest");
18102
18234
 
18103
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/email-activity.js
18235
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/email-activity.js
18104
18236
  var MAIL_AGENDA_COLUMNS = { chat_kind: { type: "enum", sql: "'dialog'" } };
18105
18237
  var ACTIVITY = `
18106
18238
  SELECT t.external_id AS thread, t.subject, t.last_email_at, t.emails_count,
@@ -18230,7 +18362,7 @@ var mailActivity = /* @__PURE__ */ __name((database) => ({
18230
18362
  threadActivity: /* @__PURE__ */ __name(async (accountId, since, where) => threadActivity(database, accountId, since, where), "threadActivity")
18231
18363
  }), "mailActivity");
18232
18364
 
18233
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
18365
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
18234
18366
  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");
18235
18367
  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;
18236
18368
  var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
@@ -18371,15 +18503,17 @@ var mailOwnText = /* @__PURE__ */ __name((body2) => {
18371
18503
  return text6 || body2.trim();
18372
18504
  }, "mailOwnText");
18373
18505
 
18374
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
18506
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
18375
18507
  var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
18376
18508
  var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
18377
- k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
18509
+ k.start_offset, k.end_offset, k.account_id, k.occurred_at,
18510
+ CASE k.chunkable_type WHEN 'email_enrichment' THEN k.chunkable_id ELSE a.attachable_id END AS email_id,
18378
18511
  CASE k.chunkable_type WHEN 'email_thread' THEN k.chunkable_id
18379
- ELSE (SELECT email_thread_id FROM emails WHERE id = a.attachable_id) END AS thread_id
18512
+ ELSE (SELECT email_thread_id FROM emails
18513
+ WHERE id = CASE k.chunkable_type WHEN 'email_enrichment' THEN k.chunkable_id ELSE a.attachable_id END) END AS thread_id
18380
18514
  FROM chunks k LEFT JOIN attachments a ON k.chunkable_type = 'attachment' AND a.id = k.chunkable_id
18381
18515
  AND a.attachable_type = 'email'
18382
- WHERE k.chunkable_type = 'email_thread' OR a.id IS NOT NULL) p`;
18516
+ WHERE k.chunkable_type IN ('email_thread', 'email_enrichment') OR a.id IS NOT NULL) p`;
18383
18517
  var threadText = /* @__PURE__ */ __name((database, threadId) => {
18384
18518
  const rows = database.prepare(`SELECT id, subject, coalesce(body_text, '') AS body, coalesce(from_name, from_address) AS sender,
18385
18519
  coalesce(received_at, sent_at) AS at
@@ -18481,7 +18615,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
18481
18615
  return emails2 + threads;
18482
18616
  }, "drainEmailIndex");
18483
18617
 
18484
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
18618
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
18485
18619
  var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
18486
18620
  SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
18487
18621
  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,
@@ -18579,7 +18713,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
18579
18713
  var backfillSentAt = /* @__PURE__ */ __name((database, accountId, limit) => Number(database.prepare(`UPDATE emails SET sent_at = received_at WHERE id IN (
18580
18714
  SELECT id FROM emails WHERE account_id = ? AND sent_at IS NULL AND received_at IS NOT NULL LIMIT ?)`).run(accountId, limit).changes), "backfillSentAt");
18581
18715
 
18582
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
18716
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
18583
18717
  var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
18584
18718
  emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
18585
18719
  last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
@@ -18629,7 +18763,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
18629
18763
  return threads.length;
18630
18764
  }, "markEmailsRestored");
18631
18765
 
18632
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-nearest.js
18766
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-nearest.js
18633
18767
  var MAIL_PIECE_ROWS = `SELECT p.id, p.content_hash AS hash, p.type, p.owner, p.position, p.email_id AS email, v.vector
18634
18768
  FROM ${MAIL_PIECES} JOIN embeddings v ON v.model = ? AND v.content_hash = p.content_hash
18635
18769
  WHERE p.account_id = ?
@@ -18665,7 +18799,7 @@ var scannedMailPieces = /* @__PURE__ */ __name((database, model, query, filter)
18665
18799
  var indexedMailPieces = /* @__PURE__ */ __name((database, model, query, filter, depth) => {
18666
18800
  const candidates = database.prepare(`${MAIL_PIECE_ROWS} AND p.id IN (SELECT value FROM json_each(?)) ORDER BY p.id`);
18667
18801
  const merged = /* @__PURE__ */ new Map();
18668
- for (const kind3 of ["email_thread", "attachment"]) {
18802
+ for (const kind3 of ["email_thread", "attachment", "email_enrichment"]) {
18669
18803
  const found2 = searchIndex(database, model, { kind: kind3, account: filter.accountId, ...filter.since === void 0 ? {} : { since: filter.since } }, query, depth, (near2) => {
18670
18804
  const hashes = new Map(near2.map(({ id: id2, hash: hash2 }) => [id2, hash2]));
18671
18805
  const best = /* @__PURE__ */ new Map();
@@ -18689,7 +18823,7 @@ var indexedMailPieces = /* @__PURE__ */ __name((database, model, query, filter,
18689
18823
  }, "indexedMailPieces");
18690
18824
  var nearestMailPieces = /* @__PURE__ */ __name((database, model, query, filter, depth) => (filter.threadExternalId === void 0 ? indexedMailPieces(database, model, query, filter, depth) : void 0) ?? scannedMailPieces(database, model, query, filter), "nearestMailPieces");
18691
18825
 
18692
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
18826
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
18693
18827
  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");
18694
18828
  var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
18695
18829
  var ruleOf = /* @__PURE__ */ __name((row2) => ({
@@ -18756,7 +18890,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
18756
18890
  }
18757
18891
  }), "mailRulesOver");
18758
18892
 
18759
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
18893
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
18760
18894
  var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
18761
18895
  database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
18762
18896
  VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
@@ -18764,7 +18898,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
18764
18898
  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);
18765
18899
  }, "reviewLink");
18766
18900
 
18767
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
18901
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
18768
18902
  function checkMeetingCancelled(signal) {
18769
18903
  if (!signal?.aborted)
18770
18904
  return;
@@ -18775,7 +18909,7 @@ function checkMeetingCancelled(signal) {
18775
18909
  }
18776
18910
  __name(checkMeetingCancelled, "checkMeetingCancelled");
18777
18911
 
18778
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
18912
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
18779
18913
  var meetingOf = /* @__PURE__ */ __name((row2) => ({
18780
18914
  id: Number(row2.id),
18781
18915
  accountId: Number(row2.account_id),
@@ -18825,7 +18959,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
18825
18959
  createdAt: Number(row2.created_at)
18826
18960
  }), "transcriptRowOf");
18827
18961
 
18828
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
18962
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
18829
18963
  var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
18830
18964
  var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
18831
18965
  var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
@@ -18992,7 +19126,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
18992
19126
  }
18993
19127
  }), "meetingReadsOver");
18994
19128
 
18995
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
19129
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
18996
19130
  var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
18997
19131
  const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
18998
19132
  const params = [input.accountId];
@@ -19035,7 +19169,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
19035
19169
  return { clauses, params };
19036
19170
  }, "meetingSelectionSql");
19037
19171
 
19038
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
19172
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
19039
19173
  var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
19040
19174
  async meetingChatLines(input) {
19041
19175
  checkMeetingCancelled(input.signal);
@@ -19063,7 +19197,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
19063
19197
  }
19064
19198
  }), "meetingChatLinesOver");
19065
19199
 
19066
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/person-separation.js
19200
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/person-separation.js
19067
19201
  var identitiesOf = /* @__PURE__ */ __name(({ database }, person2) => database.prepare("SELECT identity_id AS pk FROM identity_links WHERE person_id = ?").all(person2).map(({ pk }) => Number(pk)), "identitiesOf");
19068
19202
  var MOVED_AWAY = `moved.identity_id IN (SELECT value FROM json_each(?))
19069
19203
  AND (moved.from_person_id IN (SELECT value FROM json_each(?))
@@ -19078,7 +19212,7 @@ var apart = /* @__PURE__ */ __name(({ database }, one2, other) => {
19078
19212
  var separated = /* @__PURE__ */ __name((context, one2, other) => one2 !== other && apart(context, { identities: identitiesOf(context, one2), person: one2 }, { identities: identitiesOf(context, other), person: other }), "separated");
19079
19213
  var identitySeparated = /* @__PURE__ */ __name((context, identity, person2) => apart(context, { identities: [identity] }, { identities: identitiesOf(context, person2).filter((pk) => pk !== identity), person: person2 }), "identitySeparated");
19080
19214
 
19081
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
19215
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
19082
19216
  var MESSAGE_FIELDS = {
19083
19217
  pk: messages.id,
19084
19218
  nativeId: messages.externalId,
@@ -19249,7 +19383,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
19249
19383
  storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
19250
19384
  }), "chatActivity");
19251
19385
 
19252
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
19386
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
19253
19387
  var HIT_FIELDS = {
19254
19388
  ...MESSAGE_FIELDS,
19255
19389
  chatTitle: sql`${chats.title}`.as("chat_title"),
@@ -19348,7 +19482,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
19348
19482
  };
19349
19483
  }, "directReplies");
19350
19484
 
19351
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
19485
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
19352
19486
  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");
19353
19487
  var required = /* @__PURE__ */ __name((context, ref3) => {
19354
19488
  const found2 = identityRow(context, ref3);
@@ -19482,7 +19616,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
19482
19616
  }, "mentioning");
19483
19617
  var escaped = /* @__PURE__ */ __name((text6) => text6.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
19484
19618
 
19485
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
19619
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
19486
19620
  var missing2 = /* @__PURE__ */ __name(() => {
19487
19621
  throw new CliError("not_found", "Meeting, participant or selected target not found");
19488
19622
  }, "missing");
@@ -19604,7 +19738,7 @@ function meetingContextLinksOver(context) {
19604
19738
  }
19605
19739
  __name(meetingContextLinksOver, "meetingContextLinksOver");
19606
19740
 
19607
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
19741
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
19608
19742
  var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
19609
19743
  var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
19610
19744
  var summaryOf = /* @__PURE__ */ __name((row2) => ({
@@ -19633,7 +19767,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
19633
19767
  return row2 ? summaryText(summaryOf(row2)) : null;
19634
19768
  }, "indexedText");
19635
19769
 
19636
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
19770
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
19637
19771
  var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
19638
19772
  var meetingCurrentIndexRows = `
19639
19773
  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
@@ -19664,7 +19798,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
19664
19798
  }, "invalidateMeetingStems");
19665
19799
  var meetingStemmableText = /* @__PURE__ */ __name((text6) => text6.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
19666
19800
 
19667
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
19801
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
19668
19802
  function meetingHitIndexOver({ database, now: now2 }) {
19669
19803
  return {
19670
19804
  async indexSearch(original) {
@@ -19732,10 +19866,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
19732
19866
  }
19733
19867
  __name(meetingHitIndexOver, "meetingHitIndexOver");
19734
19868
 
19735
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19869
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19736
19870
  import { createHash as createHash5 } from "node:crypto";
19737
19871
 
19738
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/search/lucene/plain.js
19872
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/search/lucene/plain.js
19739
19873
  var REPAIRED = /* @__PURE__ */ new Set([
19740
19874
  "query.invalid-syntax",
19741
19875
  "query.unclosed-literal",
@@ -19804,6 +19938,8 @@ var read2 = /* @__PURE__ */ __name((text6, fields4) => {
19804
19938
  }, "read");
19805
19939
  var without = /* @__PURE__ */ __name((text6, leaves) => [...leaves].sort((a, b) => b.span.start - a.span.start).reduce((left, { span }) => left.slice(0, span.start) + left.slice(span.end), text6).trim(), "without");
19806
19940
  var plainQuery = /* @__PURE__ */ __name((text6, fields4 = SEARCH_FIELDS) => {
19941
+ if (text6.trim() && !/[\p{L}\p{N}*]/u.test(text6))
19942
+ throw new CliError("validation_error", `search needs a letter or a digit to look for; ${JSON.stringify(text6)} has none`);
19807
19943
  let current = text6;
19808
19944
  let whole = false;
19809
19945
  for (let tries = 0; tries <= 64; tries++) {
@@ -19840,7 +19976,7 @@ var plainQuery = /* @__PURE__ */ __name((text6, fields4 = SEARCH_FIELDS) => {
19840
19976
  return text6;
19841
19977
  }, "plainQuery");
19842
19978
 
19843
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/search/trigrams.js
19979
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/search/trigrams.js
19844
19980
  var trigrams = /* @__PURE__ */ __name((term) => {
19845
19981
  const padded = ` ${term} `;
19846
19982
  const pieces = /* @__PURE__ */ new Set();
@@ -19849,7 +19985,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
19849
19985
  return [...pieces];
19850
19986
  }, "trigrams");
19851
19987
 
19852
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/search/correct.js
19988
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/search/correct.js
19853
19989
  var SHORTEST_CORRECTION = 3;
19854
19990
  var maxEdits = /* @__PURE__ */ __name((word2) => word2.length <= 4 ? 1 : 2, "maxEdits");
19855
19991
  var editDistance = /* @__PURE__ */ __name((a, b, max) => {
@@ -19896,7 +20032,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
19896
20032
  return corrections;
19897
20033
  }, "correctWords");
19898
20034
 
19899
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/search/garbled.js
20035
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/search/garbled.js
19900
20036
  var SHORTEST_GARBLED = 4;
19901
20037
  var MOST_WIDENED = 64;
19902
20038
  var plain = /* @__PURE__ */ __name((word2) => word2.replaceAll("\u044D", "\u0435"), "plain");
@@ -19988,7 +20124,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
19988
20124
  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));
19989
20125
  }, "widenWords");
19990
20126
 
19991
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
20127
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
19992
20128
  import { readFileSync } from "node:fs";
19993
20129
  var loaded;
19994
20130
  var dictionary = /* @__PURE__ */ __name(() => {
@@ -20047,7 +20183,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word2) => {
20047
20183
  return false;
20048
20184
  }, "knownRussianWord");
20049
20185
 
20050
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
20186
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
20051
20187
  var WORD2 = /[\p{L}\p{N}\p{M}]+/gu;
20052
20188
  var MOST_WORDS = 128;
20053
20189
  var quote = /* @__PURE__ */ __name((word2) => `"${word2.replaceAll('"', '""')}"`, "quote");
@@ -20274,7 +20410,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text6, stemmer) => {
20274
20410
  return check3(tree);
20275
20411
  }, "matchMeetingText");
20276
20412
 
20277
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
20413
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
20278
20414
  var fail3 = /* @__PURE__ */ __name((message3) => {
20279
20415
  throw new CliError("validation_error", message3);
20280
20416
  }, "fail");
@@ -20456,7 +20592,7 @@ function meetingHitSearchOver({ database }) {
20456
20592
  }
20457
20593
  __name(meetingHitSearchOver, "meetingHitSearchOver");
20458
20594
 
20459
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-languages.js
20595
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-languages.js
20460
20596
  var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
20461
20597
  async fillTranscriptLanguages({ accountId, apply, now: now2 }) {
20462
20598
  positiveReadInteger(accountId, "accountId");
@@ -20488,7 +20624,7 @@ var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
20488
20624
  }
20489
20625
  }), "meetingLanguagesOver");
20490
20626
 
20491
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
20627
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
20492
20628
  import { createHash as createHash6 } from "node:crypto";
20493
20629
  var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
20494
20630
  if (value === void 0)
@@ -20578,7 +20714,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
20578
20714
  }
20579
20715
  }), "meetingParticipantSearchOver");
20580
20716
 
20581
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
20717
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
20582
20718
  var preparationQueries = {
20583
20719
  participants: {
20584
20720
  fields: "p.id, p.identity_id, p.display_name, l.person_id",
@@ -20628,7 +20764,7 @@ var preparationQueries = {
20628
20764
  }
20629
20765
  };
20630
20766
 
20631
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
20767
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
20632
20768
  var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
20633
20769
  async preparationContext(original) {
20634
20770
  const input = validateMeetingPreparationContext(original);
@@ -20669,7 +20805,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
20669
20805
  }
20670
20806
  }), "meetingPreparationContextOver");
20671
20807
 
20672
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
20808
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
20673
20809
  var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
20674
20810
  SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
20675
20811
  WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
@@ -20683,7 +20819,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
20683
20819
  JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
20684
20820
  )`, "preparationSubjects");
20685
20821
 
20686
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
20822
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
20687
20823
  var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
20688
20824
  async preparationKnowledge(original) {
20689
20825
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -20728,7 +20864,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
20728
20864
  }
20729
20865
  }), "meetingPreparationKnowledgeOver");
20730
20866
 
20731
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
20867
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
20732
20868
  var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
20733
20869
  async preparationNotes(original) {
20734
20870
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -20781,7 +20917,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
20781
20917
  }
20782
20918
  }), "meetingPreparationNotesOver");
20783
20919
 
20784
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
20920
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
20785
20921
  var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20786
20922
  async relatedHistory(original) {
20787
20923
  const input = validateMeetingRelatedHistory(original);
@@ -20852,7 +20988,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20852
20988
  }
20853
20989
  }), "meetingRelatedHistoryOver");
20854
20990
 
20855
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
20991
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
20856
20992
  var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
20857
20993
  var text2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
20858
20994
  var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
@@ -20933,7 +21069,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
20933
21069
  }
20934
21070
  }), "meetingReviewOver");
20935
21071
 
20936
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
21072
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
20937
21073
  var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
20938
21074
  var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
20939
21075
  if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
@@ -20987,7 +21123,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20987
21123
  }
20988
21124
  }), "meetingSeriesHistoryOver");
20989
21125
 
20990
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
21126
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
20991
21127
  var MOST_ROWS = 5e5;
20992
21128
  var meetingCountsSql = /* @__PURE__ */ __name((where) => `SELECT m.started_at, coalesce(m.duration_ms, m.ended_at - m.started_at) AS duration_ms,
20993
21129
  EXISTS (SELECT 1 FROM meeting_transcripts t WHERE t.meeting_id = m.id AND t.deleted_at IS NULL
@@ -21056,7 +21192,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
21056
21192
  }
21057
21193
  }), "meetingStatsOver");
21058
21194
 
21059
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
21195
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
21060
21196
  var CURSOR_KEY = "meetings";
21061
21197
  var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
21062
21198
  id: Number(row2.id),
@@ -21625,7 +21761,7 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
21625
21761
  };
21626
21762
  }, "meetingStoreOver");
21627
21763
 
21628
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
21764
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
21629
21765
  var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
21630
21766
  const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
21631
21767
  return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
@@ -21651,7 +21787,7 @@ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
21651
21787
  orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
21652
21788
  }, "release");
21653
21789
 
21654
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
21790
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
21655
21791
  var THREAD_COLUMNS = {
21656
21792
  subject: {
21657
21793
  where: /* @__PURE__ */ __name(({ value }) => ({
@@ -21668,7 +21804,7 @@ var threadRows = /* @__PURE__ */ __name((database, filter) => {
21668
21804
  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);
21669
21805
  }, "threadRows");
21670
21806
 
21671
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
21807
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
21672
21808
  var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
21673
21809
  id: `email:${place.emailId}`,
21674
21810
  chatId: place.threadExternalId,
@@ -22150,6 +22286,10 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
22150
22286
  const piece = threads.get(owner)?.[Number(row2.position)];
22151
22287
  return piece && piece.hash === row2.hash ? [{ hash: piece.hash, text: piece.text }] : [];
22152
22288
  }
22289
+ if (type === EMAIL_ENRICHMENT) {
22290
+ const text7 = enrichmentText(database, type, owner);
22291
+ return text7 === void 0 ? [] : [{ hash: String(row2.hash), text: text7 }];
22292
+ }
22153
22293
  const text6 = str(file.get(owner)?.text);
22154
22294
  return text6 == null ? [] : [{ hash: String(row2.hash), text: text6.slice(Number(row2.start), Number(row2.end)) }];
22155
22295
  });
@@ -22206,7 +22346,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
22206
22346
  }
22207
22347
  }), "mailStoreOver");
22208
22348
 
22209
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/search/dictionary.js
22349
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/search/dictionary.js
22210
22350
  import { readFileSync as readFileSync2 } from "node:fs";
22211
22351
  var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
22212
22352
  var folded4 = /* @__PURE__ */ __name((word2) => /^[а-яё'-]*$/.test(word2) ? word2.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word2), "folded");
@@ -22296,7 +22436,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
22296
22436
  }, "knownWord");
22297
22437
  var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
22298
22438
 
22299
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
22439
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
22300
22440
  var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
22301
22441
  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");
22302
22442
  var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
@@ -22382,7 +22522,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
22382
22522
  return found2;
22383
22523
  }, "spokenTranscripts");
22384
22524
 
22385
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
22525
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
22386
22526
  var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
22387
22527
  const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
22388
22528
  if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
@@ -22429,7 +22569,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
22429
22569
  });
22430
22570
  }, "placeHits");
22431
22571
 
22432
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-groups.js
22572
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-groups.js
22433
22573
  var GROUPS = {
22434
22574
  chat: {
22435
22575
  key: "m.chat_id",
@@ -22451,7 +22591,7 @@ var GROUPS = {
22451
22591
  }
22452
22592
  };
22453
22593
 
22454
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
22594
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
22455
22595
  var MESSAGES2 = {
22456
22596
  rows: "messages",
22457
22597
  threads: "chats",
@@ -22934,7 +23074,7 @@ var runCompiled = /* @__PURE__ */ __name(async (context, execution, by) => {
22934
23074
  };
22935
23075
  }, "runCompiled");
22936
23076
 
22937
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
23077
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
22938
23078
  function invalidMetadata() {
22939
23079
  throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
22940
23080
  }
@@ -23036,7 +23176,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
23036
23176
  };
23037
23177
  }), "counterTargets");
23038
23178
 
23039
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
23179
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
23040
23180
  var NOT_FILE_LIST = [...NOT_FILES].map((kind3) => `'${kind3}'`).join(",");
23041
23181
  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,
23042
23182
  att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
@@ -23155,7 +23295,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
23155
23295
  }));
23156
23296
  }, "attachmentViews");
23157
23297
 
23158
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
23298
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
23159
23299
  var transcript2 = /* @__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");
23160
23300
  var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text6, source2) => {
23161
23301
  const { orm, database, now: now2 } = context;
@@ -23193,7 +23333,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
23193
23333
  keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
23194
23334
  }, "intoVoiceAttachment");
23195
23335
 
23196
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
23336
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
23197
23337
  var FIELDS = [
23198
23338
  "threadExternalId",
23199
23339
  "senderIdentityId",
@@ -23511,7 +23651,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
23511
23651
  reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
23512
23652
  }, "writeDerivedReactions");
23513
23653
 
23514
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/keys.js
23654
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/keys.js
23515
23655
  var keysOver = /* @__PURE__ */ __name((context) => {
23516
23656
  const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
23517
23657
  const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
@@ -23532,7 +23672,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
23532
23672
  };
23533
23673
  }, "keysOver");
23534
23674
 
23535
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
23675
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
23536
23676
  var accountGroupsOf = /* @__PURE__ */ __name((database) => {
23537
23677
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
23538
23678
  if (!row2)
@@ -23566,8 +23706,20 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
23566
23706
  profiles[app] = { ...profiles[app], [profile]: { provider: key2.provider, account: key2.account } };
23567
23707
  database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
23568
23708
  }, "saveProfile");
23709
+ var forgetProfile = /* @__PURE__ */ __name((database, app, profile, now2) => {
23710
+ const profiles = profilesOf2(database);
23711
+ const own = profiles[app];
23712
+ if (own?.[profile] === void 0)
23713
+ return;
23714
+ const { [profile]: _, ...rest } = own;
23715
+ if (Object.keys(rest).length === 0)
23716
+ delete profiles[app];
23717
+ else
23718
+ profiles[app] = rest;
23719
+ database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
23720
+ }, "forgetProfile");
23569
23721
 
23570
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
23722
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
23571
23723
  var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
23572
23724
  const owner = ownerPerson(context.database).id;
23573
23725
  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);
@@ -23589,7 +23741,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
23589
23741
  return personOf(context, ref3);
23590
23742
  }, "linkToOwner");
23591
23743
 
23592
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
23744
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
23593
23745
  var PROVIDERS_SETTING = "providers";
23594
23746
  var storedProvidersOf = /* @__PURE__ */ __name((database) => {
23595
23747
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
@@ -23637,7 +23789,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
23637
23789
  });
23638
23790
  }, "registerProvider");
23639
23791
 
23640
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
23792
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
23641
23793
  var DAY3 = 864e5;
23642
23794
  var RECENTLY_CLOSED_MS = 14 * DAY3;
23643
23795
  var TEXT_LIMIT = 20;
@@ -23836,7 +23988,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
23836
23988
  };
23837
23989
  }, "taskSimilarityOver");
23838
23990
 
23839
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
23991
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
23840
23992
  var SETTING3 = "taskCategories";
23841
23993
  var savedTaskCategories = /* @__PURE__ */ __name((database) => {
23842
23994
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
@@ -23855,7 +24007,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
23855
24007
  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);
23856
24008
  }, "saveTaskCategories");
23857
24009
 
23858
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
24010
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
23859
24011
  var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
23860
24012
  var ALLOWED = "taskAgentClose";
23861
24013
  var MIN = "taskAgentCloseMin";
@@ -23911,10 +24063,10 @@ var SUGGESTION_COLUMNS = [
23911
24063
  ];
23912
24064
  var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
23913
24065
 
23914
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/mail-findings.js
24066
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/mail-findings.js
23915
24067
  var MAIL_FINDINGS_KIND = "mail_findings";
23916
24068
 
23917
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/decisions.js
24069
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/decisions.js
23918
24070
  var TASK_CLOSE_KIND = "task_close";
23919
24071
  var DEFAULT_DECISION_POLICY = { agentDecisions: false, ruleProposalsOwnerOnly: true };
23920
24072
  var isOwnerOnlyKind = /* @__PURE__ */ __name((kind3) => kind3 === MAIL_FINDINGS_KIND || kind3 === MEETING_FINDINGS_KIND || kind3 === TASK_CLOSE_KIND || kind3 === SOURCE_REVIEW_KIND, "isOwnerOnlyKind");
@@ -23962,10 +24114,10 @@ var assertMayDecide = /* @__PURE__ */ __name((row2, by, policy = DEFAULT_DECISIO
23962
24114
  }, "assertMayDecide");
23963
24115
  var deciderAuthor = /* @__PURE__ */ __name((by) => by === "owner" ? "owner" : { bot: by.bot, ...by.model === void 0 ? {} : { model: by.model } }, "deciderAuthor");
23964
24116
 
23965
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/ref-summaries.js
24117
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/domain/ref-summaries.js
23966
24118
  var oneLine = /* @__PURE__ */ __name((text6) => singleLine(text6.replace(/\s+/g, " ").trim()), "oneLine");
23967
24119
 
23968
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/ref-summaries.js
24120
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/ref-summaries.js
23969
24121
  var EXCERPT_CHARS = 280;
23970
24122
  var TITLE_CHARS = 120;
23971
24123
  var MEMORY_TITLE_CHARS = 80;
@@ -24383,8 +24535,11 @@ var refReadsOf = /* @__PURE__ */ __name((database, texts2, { excerpt = false, no
24383
24535
  }, "refReadsOf");
24384
24536
  var summaryOf2 = /* @__PURE__ */ __name(({ sender, excerpt, ...summary }, withExcerpt) => withExcerpt ? { ...summary, excerpt } : summary, "summaryOf");
24385
24537
  var refSummariesOf = /* @__PURE__ */ __name((database, texts2, options = {}) => new Map([...refReadsOf(database, texts2, options)].map(([text6, read3]) => [text6, summaryOf2(read3, options.excerpt === true)])), "refSummariesOf");
24538
+ var refsStoreOver = /* @__PURE__ */ __name((context) => ({
24539
+ summaries: /* @__PURE__ */ __name(async (texts2, options) => refSummariesOf(context.database, texts2, { ...options, now: context.now() }), "summaries")
24540
+ }), "refsStoreOver");
24386
24541
 
24387
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
24542
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
24388
24543
  var sourceOf3 = /* @__PURE__ */ __name((read3, ref3) => ({
24389
24544
  ref: ref3,
24390
24545
  kind: read3.kind,
@@ -24422,7 +24577,7 @@ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => {
24422
24577
  });
24423
24578
  }, "evidenceSourcesOf");
24424
24579
 
24425
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/attachments/limits.js
24580
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/attachments/limits.js
24426
24581
  var MAX_FILE_BYTES = 50 * 1024 * 1024;
24427
24582
  var MAX_TEXT_CHARS = 2e6;
24428
24583
  var ATTACHMENT_LIMIT_ENV = [
@@ -24448,7 +24603,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
24448
24603
  return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
24449
24604
  }, "pdfPreviewLimits");
24450
24605
 
24451
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/ulid.js
24606
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/ulid.js
24452
24607
  import { randomBytes } from "node:crypto";
24453
24608
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
24454
24609
  var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
@@ -24461,7 +24616,7 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
24461
24616
  return time3 + random;
24462
24617
  }, "ulid");
24463
24618
 
24464
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
24619
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
24465
24620
  var FOLDED_FIELDS = ["title", "site", "language", "author"];
24466
24621
  var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
24467
24622
  if (!meta && !sections?.length)
@@ -24482,7 +24637,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
24482
24637
  return typeof language === "string" && language !== "" ? language : null;
24483
24638
  }, "languageOf");
24484
24639
 
24485
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
24640
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
24486
24641
  var isObject2 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
24487
24642
  var objectOf2 = /* @__PURE__ */ __name((value) => {
24488
24643
  if (isObject2(value))
@@ -24725,7 +24880,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
24725
24880
  };
24726
24881
  }, "filesStoreOver");
24727
24882
 
24728
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
24883
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
24729
24884
  var IMPORTED_DOCUMENT_QUERY = defineQuery({
24730
24885
  entity: "document",
24731
24886
  backend: "sql",
@@ -24771,7 +24926,7 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
24771
24926
  return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
24772
24927
  }, "importedDocumentWhere");
24773
24928
 
24774
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/note-dates.js
24929
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/note-dates.js
24775
24930
  var dateFileNotes = /* @__PURE__ */ __name((database, folder, dates) => {
24776
24931
  const fileAt = database.prepare("SELECT id, document_id FROM files WHERE account_id = ? AND external_id = ? AND kind <> 'folder' AND deleted_at IS NULL");
24777
24932
  const legacy = database.prepare("SELECT id FROM documents WHERE account_id = ? AND external_id = ? AND deleted_at IS NULL");
@@ -24792,7 +24947,7 @@ var dateFileNotes = /* @__PURE__ */ __name((database, folder, dates) => {
24792
24947
  return changed;
24793
24948
  }, "dateFileNotes");
24794
24949
 
24795
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/text-input.js
24950
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/text-input.js
24796
24951
  var textOf2 = /* @__PURE__ */ __name((text6, what, max = 1e5, allowEmpty = false) => {
24797
24952
  const value = text6.trim();
24798
24953
  if (!value && !allowEmpty || value.length > max)
@@ -24805,7 +24960,7 @@ var oneOf = /* @__PURE__ */ __name((value, allowed, what) => {
24805
24960
  return value;
24806
24961
  }, "oneOf");
24807
24962
 
24808
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
24963
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
24809
24964
  var NOTE_FORMATS = ["obsidian", "markdown"];
24810
24965
  var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
24811
24966
  var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso3(value), "optionalIso");
@@ -25338,7 +25493,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
25338
25493
  };
25339
25494
  }, "notesStoreOver");
25340
25495
 
25341
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
25496
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
25342
25497
  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";
25343
25498
  var iso4 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
25344
25499
  var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -25597,7 +25752,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
25597
25752
  };
25598
25753
  }, "memoriesStoreOver");
25599
25754
 
25600
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
25755
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
25601
25756
  var DEFAULT_FIRST_PASS_PER_CHAT = 0;
25602
25757
  var KEY = "taskFirstPassPerChat";
25603
25758
  var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
@@ -25617,7 +25772,7 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
25617
25772
  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);
25618
25773
  }, "saveFirstPassPerChat");
25619
25774
 
25620
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/external-links.js
25775
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/domain/external-links.js
25621
25776
  var EXTERNAL_SERVICE = /^[a-z][a-z0-9-]{0,31}$/;
25622
25777
  var EXTERNAL_ID_CHARS = 200;
25623
25778
  var SOURCE_URL_CHARS = 2e3;
@@ -25644,7 +25799,7 @@ var sourceUrlOf = /* @__PURE__ */ __name((value, reason = "task.source-url") =>
25644
25799
  return text6;
25645
25800
  }, "sourceUrlOf");
25646
25801
 
25647
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
25802
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
25648
25803
  var TASK_SORTS = ["priority", "due", "created", "updated", "key", "state"];
25649
25804
  var field = /* @__PURE__ */ __name((name, type, example, more = {}) => ({
25650
25805
  name,
@@ -25867,7 +26022,7 @@ var withoutField = /* @__PURE__ */ __name((query, name) => {
25867
26022
  return root === void 0 ? void 0 : { ...query, root };
25868
26023
  }, "withoutField");
25869
26024
 
25870
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
26025
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
25871
26026
  var authorNamed = /* @__PURE__ */ __name((database, row2) => {
25872
26027
  if (row2.author_type == null)
25873
26028
  return null;
@@ -25895,7 +26050,7 @@ var addComment = /* @__PURE__ */ __name((context, task, body2, by) => {
25895
26050
  return commentsOf(database, task).find((one2) => one2.ref === `note:${made}`);
25896
26051
  }, "addComment");
25897
26052
 
25898
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
26053
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
25899
26054
  var TASK_RELATION_KINDS = [
25900
26055
  "blocked-by",
25901
26056
  "follow-up-of",
@@ -26025,7 +26180,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
26025
26180
  };
26026
26181
  }, "taskRelationsStoreOver");
26027
26182
 
26028
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
26183
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
26029
26184
  var TASK_ROLES = ["assignee", "reviewer", "watcher"];
26030
26185
  var TASK_EVENT_KINDS = [
26031
26186
  "created",
@@ -26579,7 +26734,7 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
26579
26734
  };
26580
26735
  }, "workTasksOver");
26581
26736
 
26582
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
26737
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
26583
26738
  var taskCloseOver = /* @__PURE__ */ __name((context) => {
26584
26739
  const { database, now: now2 } = context;
26585
26740
  const liveRow = /* @__PURE__ */ __name((id2) => {
@@ -26628,7 +26783,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
26628
26783
  };
26629
26784
  }, "taskCloseOver");
26630
26785
 
26631
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
26786
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
26632
26787
  var TASK_PAIR_DECISIONS = ["review", "unsure", "merged", "rejected", "unmerged", "attached", "new"];
26633
26788
  var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
26634
26789
  const { database, now: now2 } = context;
@@ -26847,7 +27002,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
26847
27002
  };
26848
27003
  }, "taskPairsOver");
26849
27004
 
26850
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/task-stats.js
27005
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-stats.js
26851
27006
  var ACCOUNT_SCOPE = "t.package_id IS NOT NULL AND t.deleted_at IS NULL AND t.project_id = ?";
26852
27007
  var TASK_STATS_SQL = {
26853
27008
  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"),
@@ -26886,7 +27041,7 @@ var taskStatsOver = /* @__PURE__ */ __name(({ database }, inbox) => ({
26886
27041
  }, "statNames")
26887
27042
  }), "taskStatsOver");
26888
27043
 
26889
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
27044
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
26890
27045
  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";
26891
27046
  var inboxProject = /* @__PURE__ */ __name(({ database, now: now2 }, account, create) => {
26892
27047
  const key2 = inboxKey(account);
@@ -27093,7 +27248,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
27093
27248
  throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
27094
27249
  }, "oneOf");
27095
27250
 
27096
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/accounts.js
27251
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/accounts.js
27097
27252
  var accountAccountsOver = /* @__PURE__ */ __name((context) => {
27098
27253
  const { database } = context;
27099
27254
  const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
@@ -27126,6 +27281,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
27126
27281
  accountGroups: /* @__PURE__ */ __name(async () => accountGroupsOf(database), "accountGroups"),
27127
27282
  profiles: /* @__PURE__ */ __name(async () => profilesOf2(database), "profiles"),
27128
27283
  saveProfile: /* @__PURE__ */ __name(async (app, profile, key2) => write(database, () => saveProfile(database, app, profile, key2, context.now())), "saveProfile"),
27284
+ forgetProfile: /* @__PURE__ */ __name(async (app, profile) => write(database, () => forgetProfile(database, app, profile, context.now())), "forgetProfile"),
27129
27285
  registerProvider: /* @__PURE__ */ __name(async (entry2) => registerProvider(database, entry2, context.now()), "registerProvider"),
27130
27286
  saveAccountGroup: /* @__PURE__ */ __name(async (name, members2) => write(database, () => {
27131
27287
  const groups = accountGroupsOf(database);
@@ -27138,7 +27294,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
27138
27294
  };
27139
27295
  }, "accountsStoreOver");
27140
27296
 
27141
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
27297
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
27142
27298
  var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
27143
27299
  var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
27144
27300
  const message3 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
@@ -27162,7 +27318,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
27162
27318
  })), "keepDownloads");
27163
27319
  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");
27164
27320
 
27165
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/attachments.js
27321
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/attachments.js
27166
27322
  var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
27167
27323
  const { database } = context;
27168
27324
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -27219,7 +27375,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
27219
27375
  }, "keepAttachmentText")
27220
27376
  }), "attachmentsStoreOver");
27221
27377
 
27222
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
27378
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
27223
27379
  var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
27224
27380
  var pointerMover = /* @__PURE__ */ __name((context, type) => {
27225
27381
  const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
@@ -27404,7 +27560,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
27404
27560
  return done;
27405
27561
  }, "rekeyChats");
27406
27562
 
27407
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
27563
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
27408
27564
  var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
27409
27565
  var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
27410
27566
  var CHAT_LIST_KEY = "chat_list_complete";
@@ -27462,7 +27618,7 @@ var chatCoverage = /* @__PURE__ */ __name(({ database }, accountKey) => {
27462
27618
  return { ...coverage, oldestMessageAt: toIso(oldest) };
27463
27619
  }, "chatCoverage");
27464
27620
 
27465
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/chats.js
27621
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/chats.js
27466
27622
  var chatsStoreOver = /* @__PURE__ */ __name((context) => {
27467
27623
  const { database } = context;
27468
27624
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
@@ -27597,7 +27753,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
27597
27753
  };
27598
27754
  }, "chatsStoreOver");
27599
27755
 
27600
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
27756
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
27601
27757
  import { createHash as createHash7 } from "node:crypto";
27602
27758
  var BATCH_CONTEXT = 50;
27603
27759
  var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
@@ -27735,7 +27891,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
27735
27891
  var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
27736
27892
  ${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
27737
27893
 
27738
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
27894
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
27739
27895
  import { setTimeout } from "node:timers/promises";
27740
27896
  var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
27741
27897
  var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
@@ -28047,7 +28203,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
28047
28203
  AND NOT EXISTS (SELECT 1 FROM messages d
28048
28204
  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");
28049
28205
 
28050
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/conversations.js
28206
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/conversations.js
28051
28207
  var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
28052
28208
  const { database } = context;
28053
28209
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -28154,7 +28310,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
28154
28310
  };
28155
28311
  }, "conversationsStoreOver");
28156
28312
 
28157
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/counters.js
28313
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/counters.js
28158
28314
  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";
28159
28315
  var accountCountersOver = /* @__PURE__ */ __name((context) => {
28160
28316
  const { database } = context;
@@ -28179,7 +28335,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
28179
28335
  counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
28180
28336
  }), "countersStoreOver");
28181
28337
 
28182
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
28338
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
28183
28339
  var MENTION_STATUSES = ["found", "linked", "dismissed"];
28184
28340
  var MENTION_QUERY = defineQuery({
28185
28341
  entity: "mention",
@@ -28395,7 +28551,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
28395
28551
  return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
28396
28552
  }, "listPlaces");
28397
28553
 
28398
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/mentions.js
28554
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/mentions.js
28399
28555
  var accountMentionsOver = /* @__PURE__ */ __name((context) => {
28400
28556
  const { database } = context;
28401
28557
  const { findAccountPk: findAccountPk2 } = keysOver(context);
@@ -28430,7 +28586,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
28430
28586
  places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
28431
28587
  }), "mentionsStoreOver");
28432
28588
 
28433
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
28589
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
28434
28590
  var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
28435
28591
  const read3 = 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");
28436
28592
  const rows = messageId === void 0 ? read3.all(chatKey) : read3.all(chatKey, messageId);
@@ -28445,7 +28601,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
28445
28601
  }));
28446
28602
  }, "documentLinkMessages");
28447
28603
 
28448
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
28604
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
28449
28605
  var stemmerFor = stemmerCache();
28450
28606
  var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
28451
28607
  if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
@@ -28489,7 +28645,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
28489
28645
  });
28490
28646
  }, "laterSharingRare");
28491
28647
 
28492
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/messages.js
28648
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/messages.js
28493
28649
  var accountMessagesOver = /* @__PURE__ */ __name((context) => {
28494
28650
  const { database } = context;
28495
28651
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
@@ -28624,7 +28780,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
28624
28780
  laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
28625
28781
  }), "messagesStoreOver");
28626
28782
 
28627
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
28783
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
28628
28784
  var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
28629
28785
  var iso6 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
28630
28786
  var personPreparation = /* @__PURE__ */ __name(({ database, now: now2 }, uid, { accounts: accounts2, limit }) => {
@@ -28681,7 +28837,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database, now: now2 }, uid, {
28681
28837
  });
28682
28838
  }, "personPreparation");
28683
28839
 
28684
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
28840
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
28685
28841
  var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
28686
28842
  const id2 = Number(uid);
28687
28843
  if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
@@ -28689,7 +28845,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
28689
28845
  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)));
28690
28846
  }, "personSeenInAccounts");
28691
28847
 
28692
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
28848
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
28693
28849
  var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
28694
28850
  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);
28695
28851
  if (!row2)
@@ -28756,7 +28912,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
28756
28912
  return { id: id2, personId, removed: true };
28757
28913
  }, "removeNote");
28758
28914
 
28759
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/people.js
28915
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/people.js
28760
28916
  var accountPeopleOver = /* @__PURE__ */ __name((context) => {
28761
28917
  const { database } = context;
28762
28918
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
@@ -28841,13 +28997,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
28841
28997
  };
28842
28998
  }, "peopleStoreOver");
28843
28999
 
28844
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
29000
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
28845
29001
  import { createHash as createHash9 } from "node:crypto";
28846
29002
 
28847
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
29003
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
28848
29004
  import { createHash as createHash8 } from "node:crypto";
28849
29005
 
28850
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
29006
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
28851
29007
  var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
28852
29008
  var exhausted2 = /* @__PURE__ */ __name((budget) => {
28853
29009
  throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
@@ -29069,7 +29225,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
29069
29225
  };
29070
29226
  }, "rankReplyGraph");
29071
29227
 
29072
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
29228
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
29073
29229
  var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
29074
29230
  var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
29075
29231
  var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
@@ -29243,7 +29399,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
29243
29399
  return { items, evidence, summary, graph: graph.quality };
29244
29400
  }, "calculateAdminStatistics");
29245
29401
 
29246
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
29402
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
29247
29403
  var rankingContextRange = /* @__PURE__ */ __name((root) => {
29248
29404
  const dates = [];
29249
29405
  const visit = /* @__PURE__ */ __name((node, required3) => {
@@ -29265,7 +29421,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
29265
29421
  return dates[0].node.resolution.date;
29266
29422
  }, "rankingContextRange");
29267
29423
 
29268
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
29424
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
29269
29425
  var reactionCounts = /* @__PURE__ */ __name((stored4) => {
29270
29426
  let counts;
29271
29427
  try {
@@ -29560,7 +29716,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
29560
29716
  });
29561
29717
  }, "rankQuery");
29562
29718
 
29563
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
29719
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
29564
29720
  function fail4(message3, reason = "query.too-large") {
29565
29721
  throw new CliError("validation_error", message3, { reason, complete: false });
29566
29722
  }
@@ -29737,7 +29893,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
29737
29893
  return result;
29738
29894
  }), "adminStatisticsQuery");
29739
29895
 
29740
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
29896
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
29741
29897
  var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
29742
29898
  if (!execution.accounts.length)
29743
29899
  return { conversations: [], chats: [] };
@@ -29755,7 +29911,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
29755
29911
  return { conversations: conversations2, chats: chats2 };
29756
29912
  }, "conversationEligibility");
29757
29913
 
29758
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
29914
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
29759
29915
  import { createHash as createHash10 } from "node:crypto";
29760
29916
  var EVIDENCE_BYTES = 64 * 1024;
29761
29917
  var FINGERPRINT_BYTES = 8 * 1024 * 1024;
@@ -29905,7 +30061,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
29905
30061
  return result;
29906
30062
  }, "rankingEvidence");
29907
30063
 
29908
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/reply-times.js
30064
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/reply-times.js
29909
30065
  var FAR = Number.MAX_SAFE_INTEGER;
29910
30066
  var chatsIn = /* @__PURE__ */ __name((scope3, kinds2) => {
29911
30067
  const params = [...scope3.accounts.flatMap(({ provider, account }) => [provider, account]), ...kinds2];
@@ -29999,7 +30155,7 @@ var waitingChats = /* @__PURE__ */ __name((context, scope3, waits, cap) => {
29999
30155
  });
30000
30156
  }, "waitingChats");
30001
30157
 
30002
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/queries.js
30158
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/queries.js
30003
30159
  var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
30004
30160
  const mailIndexed = /* @__PURE__ */ __name((execution) => {
30005
30161
  if (execution.corpus === "mail")
@@ -30020,7 +30176,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
30020
30176
  };
30021
30177
  }, "queriesStoreOver");
30022
30178
 
30023
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
30179
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
30024
30180
  var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
30025
30181
  const { database, now: now2 } = context;
30026
30182
  const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
@@ -30059,10 +30215,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
30059
30215
  }));
30060
30216
  }, "chatEventsOf");
30061
30217
 
30062
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
30218
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
30063
30219
  import { createHash as createHash11 } from "node:crypto";
30064
30220
 
30065
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/calendar.js
30221
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/domain/calendar.js
30066
30222
  var calendarKey = /* @__PURE__ */ __name((zone, by) => {
30067
30223
  const format = new Intl.DateTimeFormat("en-CA", {
30068
30224
  timeZone: zone,
@@ -30082,7 +30238,7 @@ var weekKey = /* @__PURE__ */ __name((day2) => {
30082
30238
  return date3.toISOString().slice(0, 10);
30083
30239
  }, "weekKey");
30084
30240
 
30085
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/retention.js
30241
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/domain/retention.js
30086
30242
  var RETENTION_TOLERANCE = 864e5;
30087
30243
  var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
30088
30244
  const { since, until, cutoff, checkpoints, within, limit, by } = options;
@@ -30136,7 +30292,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
30136
30292
  return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
30137
30293
  }, "retentionCohorts");
30138
30294
 
30139
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
30295
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
30140
30296
  var iso7 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
30141
30297
  var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId, options, evidence) => {
30142
30298
  validateRetentionOptions(options);
@@ -30267,7 +30423,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
30267
30423
  };
30268
30424
  }, "retentionQuery");
30269
30425
 
30270
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
30426
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
30271
30427
  var iso8 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
30272
30428
  var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
30273
30429
  ...isBot === void 0 ? {} : { bot: isBot },
@@ -30398,7 +30554,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
30398
30554
  lastCount: memberCountsOf(context, pk).at(-1) ?? null
30399
30555
  })), "trackedChats");
30400
30556
 
30401
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/roster.js
30557
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/roster.js
30402
30558
  var rosterStoreOver = /* @__PURE__ */ __name((context) => {
30403
30559
  const { database } = context;
30404
30560
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
@@ -30454,7 +30610,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
30454
30610
  };
30455
30611
  }, "rosterStoreOver");
30456
30612
 
30457
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
30613
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
30458
30614
  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");
30459
30615
  var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
30460
30616
  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 ?`);
@@ -30478,7 +30634,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
30478
30634
  }
30479
30635
  }, "backfillNormalized");
30480
30636
 
30481
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
30637
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
30482
30638
  var INDEX2 = "message_words";
30483
30639
  var searchIndexState2 = /* @__PURE__ */ __name((database) => {
30484
30640
  const row2 = indexRow(database, INDEX2);
@@ -30605,7 +30761,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
30605
30761
  });
30606
30762
  }, "resetSearchIndex");
30607
30763
 
30608
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
30764
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
30609
30765
  var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
30610
30766
  const filled2 = { stemmed: 0, drained: 0 };
30611
30767
  const before2 = stemsState(database);
@@ -30700,7 +30856,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
30700
30856
  return resetStems(database, { now: now2 });
30701
30857
  }, "followDefaultStemmers");
30702
30858
 
30703
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
30859
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
30704
30860
  var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
30705
30861
  var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
30706
30862
  const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
@@ -30722,7 +30878,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
30722
30878
  });
30723
30879
  }, "termCandidates");
30724
30880
 
30725
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/search-index.js
30881
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/search-index.js
30726
30882
  var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
30727
30883
  const { database } = context;
30728
30884
  const stemmerFor2 = stemmerCache();
@@ -30746,7 +30902,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
30746
30902
  };
30747
30903
  }, "searchIndexStoreOver");
30748
30904
 
30749
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
30905
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
30750
30906
  var HISTORY_KEPT = 1e3;
30751
30907
  var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
30752
30908
  var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
@@ -30815,7 +30971,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
30815
30971
  return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
30816
30972
  }, "clearHistory");
30817
30973
 
30818
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/searches.js
30974
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/searches.js
30819
30975
  var searchesStoreOver = /* @__PURE__ */ __name((context) => {
30820
30976
  const { database } = context;
30821
30977
  return {
@@ -30839,7 +30995,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
30839
30995
  };
30840
30996
  }, "searchesStoreOver");
30841
30997
 
30842
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/added-sources.js
30998
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/added-sources.js
30843
30999
  import { createHash as createHash12 } from "node:crypto";
30844
31000
  var ADDED_KINDS = ["text", "file", "page"];
30845
31001
  var sha256 = /* @__PURE__ */ __name((value) => createHash12("sha256").update(value).digest("hex"), "sha256");
@@ -31019,7 +31175,7 @@ var addedSourcesOver = /* @__PURE__ */ __name((context) => {
31019
31175
  };
31020
31176
  }, "addedSourcesOver");
31021
31177
 
31022
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
31178
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
31023
31179
  var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
31024
31180
  var ACTION_OUTCOMES = ["ok", "refused", "failed"];
31025
31181
  var CODE = /^[a-z][a-z0-9_]{0,63}$/;
@@ -31062,7 +31218,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
31062
31218
  };
31063
31219
  }, "agentActionsStoreOver");
31064
31220
 
31065
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
31221
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
31066
31222
  var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
31067
31223
  }) => {
31068
31224
  const { database, now: now2 } = context;
@@ -31121,7 +31277,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
31121
31277
  };
31122
31278
  }, "botUpdateStoreOver");
31123
31279
 
31124
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/reviewed.js
31280
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/reviewed.js
31125
31281
  var prefixesText = /* @__PURE__ */ __name((types) => `${article(types[0] ?? "")} ${types.map((type) => `${type}:`).join(" or ")}`, "prefixesText");
31126
31282
  var refuse = /* @__PURE__ */ __name((message3, reason, code = "validation_error") => {
31127
31283
  throw new CliError(code, message3, { reason });
@@ -31269,7 +31425,7 @@ var reviewedRowsOver = /* @__PURE__ */ __name((context) => {
31269
31425
  return { partyOf, partyThing, reviewedOf, written, keepEvidence, ownerOnly, linkedId, ...decisionsOver(context) };
31270
31426
  }, "reviewedRowsOver");
31271
31427
 
31272
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/business-contracts.js
31428
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/business-contracts.js
31273
31429
  var CONTRACTS = "SELECT k.*, b.name AS author_name, b.kind AS author_kind FROM contracts k LEFT JOIN bots b ON k.author_type = 'bot' AND b.id = k.author_id";
31274
31430
  var DAY_MS = 864e5;
31275
31431
  var deadlineOf = /* @__PURE__ */ __name((expiration, days) => expiration === null || days === null ? null : new Date(Date.parse(`${expiration}T00:00:00Z`) - days * DAY_MS).toISOString().slice(0, 10), "deadlineOf");
@@ -31418,7 +31574,111 @@ var contractsStoreOver = /* @__PURE__ */ __name((context) => {
31418
31574
  };
31419
31575
  }, "contractsStoreOver");
31420
31576
 
31421
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
31577
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/business-search.js
31578
+ var BUSINESS_FIND_MAX = 2001;
31579
+ var party = /* @__PURE__ */ __name((kind3, id2, as) => `LEFT JOIN persons ${as}p ON ${kind3} = 'person' AND ${as}p.id = ${id2} AND ${as}p.owner = 0 LEFT JOIN organizations ${as}o ON ${kind3} = 'organization' AND ${as}o.id = ${id2} LEFT JOIN projects ${as}j ON ${kind3} = 'project' AND ${as}j.id = ${id2}`, "party");
31580
+ var partyName = /* @__PURE__ */ __name((as) => `coalesce(${as}p.name, ${as}o.name, ${as}j.name)`, "partyName");
31581
+ var LIVE3 = "x.deleted_at IS NULL";
31582
+ var DECIDED = `${LIVE3} AND x.review <> 'rejected'`;
31583
+ var SEARCHED = {
31584
+ invoice: `SELECT x.id, x.review, x.source, x.updated_at, x.number AS f1, ${partyName("c")} AS f2 FROM invoices x ${party("x.counterparty_type", "x.counterparty_id", "c")} WHERE ${DECIDED}`,
31585
+ payment: `SELECT x.id, x.review, x.source, x.updated_at, x.reference AS f1, ${partyName("r")} AS f2, ${partyName("e")} AS f3 FROM payments x ${party("x.payer_type", "x.payer_id", "r")} ${party("x.payee_type", "x.payee_id", "e")} WHERE ${DECIDED}`,
31586
+ order: `SELECT x.id, x.review, x.source, x.updated_at, x.number AS f1, x.supplier_name AS f2, (SELECT group_concat(description, char(10)) FROM order_lines WHERE order_id = x.id) AS f3 FROM orders x WHERE ${DECIDED}`,
31587
+ contract: `SELECT x.id, x.review, x.source, x.updated_at, x.name AS f1, x.number AS f2 FROM contracts x WHERE ${DECIDED}`,
31588
+ subscription: `SELECT x.id, x.review, x.source, x.updated_at, x.name AS f1 FROM subscriptions x WHERE ${DECIDED}`,
31589
+ product: `SELECT x.id, 'confirmed' AS review, x.source, x.updated_at, x.name AS f1, x.sku AS f2 FROM catalog_items x WHERE ${LIVE3}`,
31590
+ wallet: `SELECT x.id, 'confirmed' AS review, x.source, x.updated_at, x.name AS f1, x.institution AS f2 FROM financial_accounts x WHERE ${LIVE3}`
31591
+ };
31592
+ var FIELDS2 = ["f1", "f2", "f3"];
31593
+ var TEXT_CHARS = 240;
31594
+ var KINDS_SQL = BUSINESS_KINDS.map((kind3) => `'${kind3}'`).join(", ");
31595
+ var IMPORT = "import:";
31596
+ var WORD_CHAR = /[\p{L}\p{N}]/u;
31597
+ var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}\0${account}`, "keyOf");
31598
+ var lineOf2 = /* @__PURE__ */ __name((parts) => {
31599
+ const line = parts.join(" \xB7 ").replace(/\s+/gu, " ").trim();
31600
+ return line.length <= TEXT_CHARS ? line : `${line.slice(0, TEXT_CHARS - 1)}\u2026`;
31601
+ }, "lineOf");
31602
+ var startsAWord = /* @__PURE__ */ __name((folded5, word2) => {
31603
+ for (let at = folded5.indexOf(word2); at !== -1; at = folded5.indexOf(word2, at + 1))
31604
+ if (at === 0 || !WORD_CHAR.test(folded5[at - 1]))
31605
+ return true;
31606
+ return false;
31607
+ }, "startsAWord");
31608
+ var businessSearchOver = /* @__PURE__ */ __name(({ database }) => {
31609
+ const matchedOf = /* @__PURE__ */ __name((kind3, wanted, anyWord) => database.prepare(SEARCHED[kind3]).all().flatMap((row2) => {
31610
+ const parts = FIELDS2.flatMap((field4) => row2[field4] == null ? [] : [String(row2[field4])]);
31611
+ const folded5 = fold(parts.join("\n"));
31612
+ const score = wanted.filter((word2) => startsAWord(folded5, word2)).length;
31613
+ if (anyWord ? score === 0 : score < wanted.length)
31614
+ return [];
31615
+ const source2 = String(row2.source);
31616
+ return [
31617
+ {
31618
+ kind: kind3,
31619
+ id: Number(row2.id),
31620
+ review: row2.review === "proposed" ? "proposed" : "confirmed",
31621
+ imported: source2.startsWith(IMPORT) ? source2.slice(IMPORT.length) : void 0,
31622
+ parts,
31623
+ score,
31624
+ updatedAt: Number(row2.updated_at)
31625
+ }
31626
+ ];
31627
+ }), "matchedOf");
31628
+ const sourcesOf2 = /* @__PURE__ */ __name((matched) => {
31629
+ const sources = /* @__PURE__ */ new Map();
31630
+ for (const kind3 of BUSINESS_KINDS) {
31631
+ const ids = matched.filter((one2) => one2.kind === kind3 && one2.imported !== void 0).map(({ id: id2 }) => id2);
31632
+ if (!ids.length)
31633
+ continue;
31634
+ const rows = database.prepare("SELECT r.entity_id, r.external_id, a.provider, a.external_id AS account FROM records r JOIN accounts a ON a.id = r.account_id WHERE r.entity_type = ? AND r.entity_id IN (SELECT value FROM json_each(?)) ORDER BY r.entity_id, (r.deleted_at IS NOT NULL), r.id").all(kind3, JSON.stringify(ids));
31635
+ for (const row2 of rows) {
31636
+ const ref3 = `${kind3}:${row2.entity_id}`;
31637
+ if (!sources.has(ref3))
31638
+ sources.set(ref3, {
31639
+ provider: String(row2.provider),
31640
+ account: String(row2.account),
31641
+ externalId: String(row2.external_id)
31642
+ });
31643
+ }
31644
+ }
31645
+ return sources;
31646
+ }, "sourcesOf");
31647
+ const find2 = /* @__PURE__ */ __name(({ words: words3, anyWord = false, accounts: accounts2, limit }) => {
31648
+ const wanted = [...new Set(words3.map((word2) => fold(word2).trim()).filter(Boolean))];
31649
+ if (!wanted.length)
31650
+ return [];
31651
+ const most2 = Math.min(Math.max(limit ?? 100, 1), BUSINESS_FIND_MAX);
31652
+ const within = accounts2 === void 0 ? void 0 : new Set(accounts2.map(keyOf4));
31653
+ const matched = BUSINESS_KINDS.flatMap((kind3) => matchedOf(kind3, wanted, anyWord)).sort((a, b) => b.score - a.score || b.updatedAt - a.updatedAt || a.kind.localeCompare(b.kind) || b.id - a.id);
31654
+ const candidates = within === void 0 ? matched.slice(0, most2) : matched.filter((one2) => one2.imported);
31655
+ const sources = sourcesOf2(candidates);
31656
+ const kept = within === void 0 ? candidates : candidates.filter((one2) => {
31657
+ const source2 = sources.get(`${one2.kind}:${one2.id}`);
31658
+ return source2 !== void 0 && within.has(keyOf4(source2));
31659
+ }).slice(0, most2);
31660
+ return kept.map((one2) => {
31661
+ const ref3 = `${one2.kind}:${one2.id}`;
31662
+ const source2 = sources.get(ref3);
31663
+ return {
31664
+ kind: one2.kind,
31665
+ ref: ref3,
31666
+ review: one2.review,
31667
+ ...one2.imported === void 0 ? {} : { imported: one2.imported },
31668
+ ...source2 === void 0 ? {} : { source: source2 },
31669
+ text: lineOf2(one2.parts),
31670
+ updatedAt: one2.updatedAt
31671
+ };
31672
+ });
31673
+ }, "find");
31674
+ const sourceAccounts = /* @__PURE__ */ __name(() => database.prepare(`SELECT DISTINCT a.provider, a.external_id AS account FROM records r JOIN accounts a ON a.id = r.account_id WHERE r.entity_type IN (${KINDS_SQL}) AND r.entity_id IS NOT NULL AND r.deleted_at IS NULL ORDER BY a.provider, a.external_id`).all().map((row2) => ({ provider: String(row2.provider), account: String(row2.account) })), "sourceAccounts");
31675
+ return {
31676
+ find: /* @__PURE__ */ __name(async (search2) => find2(search2), "find"),
31677
+ accounts: /* @__PURE__ */ __name(async () => sourceAccounts(), "accounts")
31678
+ };
31679
+ }, "businessSearchOver");
31680
+
31681
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
31422
31682
  var DAY4 = 864e5;
31423
31683
  var COUNTERPART_LINK = `EXISTS (SELECT 1 FROM links l WHERE l.from_type = 'event' AND l.from_id = e.id AND l.to_type = 'person' AND l.to_id = ? AND l.kind = ${linkKind("related-to")} AND l.role = '${COUNTERPART_ROLE}')`;
31424
31684
  var accountsOf = /* @__PURE__ */ __name((filter) => {
@@ -31528,7 +31788,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
31528
31788
  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);
31529
31789
  }, "listEvents");
31530
31790
 
31531
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-forget.js
31791
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-forget.js
31532
31792
  var distinctIds = /* @__PURE__ */ __name((rows) => [...new Set(rows.map((row2) => Number(row2.id)))], "distinctIds");
31533
31793
  var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, accountId, cursorKey: cursorKey2, now: now2 }, refresh) => {
31534
31794
  const unseenBefore = unreferenced(database, "identities");
@@ -31585,7 +31845,7 @@ var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, account
31585
31845
  return { entries: entryIds.length, events: goneEvents.length };
31586
31846
  }, "forgetCalendarRows");
31587
31847
 
31588
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
31848
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
31589
31849
  var calendarOf = /* @__PURE__ */ __name((row2) => ({
31590
31850
  id: Number(row2.id),
31591
31851
  accountId: Number(row2.account_id),
@@ -32188,7 +32448,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
32188
32448
  };
32189
32449
  }, "eventStoreOver");
32190
32450
 
32191
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
32451
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
32192
32452
  var CATALOG_QUERY = defineQuery({
32193
32453
  entity: "document",
32194
32454
  backend: "sql",
@@ -32430,7 +32690,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
32430
32690
  };
32431
32691
  }, "catalogStoreOver");
32432
32692
 
32433
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
32693
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
32434
32694
  var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
32435
32695
  var field3 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
32436
32696
  CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
@@ -32443,7 +32703,7 @@ var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
32443
32703
  THEN 'source-modified' ELSE 'stored-update' END`;
32444
32704
  var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field3("sourceUrl")})`;
32445
32705
 
32446
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
32706
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
32447
32707
  var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
32448
32708
  const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
32449
32709
  signal?.throwIfAborted();
@@ -32542,7 +32802,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
32542
32802
  });
32543
32803
  }, "readMeetingContextEvidence");
32544
32804
 
32545
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
32805
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
32546
32806
  var corpora = {
32547
32807
  message: {
32548
32808
  table: "messages",
@@ -32781,7 +33041,7 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
32781
33041
  }
32782
33042
  }), "contextRecordsOver");
32783
33043
 
32784
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-rows.js
33044
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-rows.js
32785
33045
  var TABLES2 = { deal: "deals", lead: "leads" };
32786
33046
  var SOURCE = "crm";
32787
33047
  var crmIdentityId = /* @__PURE__ */ __name((key2, externalId, type = "contact") => `${idPart(key2.account)}/${type}/${idPart(externalId)}`, "crmIdentityId");
@@ -32910,7 +33170,7 @@ var crmRowsOver = /* @__PURE__ */ __name((context) => {
32910
33170
  return { savePipeline, saveItemRow };
32911
33171
  }, "crmRowsOver");
32912
33172
 
32913
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-settings.js
33173
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-settings.js
32914
33174
  var CRM_LINK_MODES = ["reported", "review"];
32915
33175
  var COMPANY_TYPE_MEANINGS = ["customer-of", "supplier", "partner-of"];
32916
33176
  var crmSettingKey = /* @__PURE__ */ __name((key2, name) => `crm.${key2.provider}:${key2.account}.${name}`, "crmSettingKey");
@@ -32973,10 +33233,25 @@ var crmSettingsOf = /* @__PURE__ */ __name((database) => database.prepare("SELEC
32973
33233
  ];
32974
33234
  }), "crmSettingsOf");
32975
33235
 
32976
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/money-lines.js
33236
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/money-lines.js
33237
+ var MAX_LINES = 500;
32977
33238
  var PARENTS = {
32978
- invoice: { table: "invoice_lines", column: "invoice_id", reasons: "finance" },
32979
- order: { table: "order_lines", column: "order_id", reasons: "order" }
33239
+ invoice: {
33240
+ parents: "invoices",
33241
+ table: "invoice_lines",
33242
+ column: "invoice_id",
33243
+ reasons: "finance",
33244
+ full: "finance.lines",
33245
+ instead: "reject or void the invoice instead"
33246
+ },
33247
+ order: {
33248
+ parents: "orders",
33249
+ table: "order_lines",
33250
+ column: "order_id",
33251
+ reasons: "order",
33252
+ full: "order.field",
33253
+ instead: "reject or cancel the order instead"
33254
+ }
32980
33255
  };
32981
33256
  var moneyLinesOver = /* @__PURE__ */ __name(({ database }) => {
32982
33257
  const productOf2 = /* @__PURE__ */ __name((reference2, what, code) => {
@@ -33031,10 +33306,34 @@ var moneyLinesOver = /* @__PURE__ */ __name(({ database }) => {
33031
33306
  product: line.catalog_item_id == null ? null : `product:${line.catalog_item_id}`
33032
33307
  }));
33033
33308
  }, "shownLines");
33034
- return { linesOf, insertLines, shownLines };
33309
+ const appendLine = /* @__PURE__ */ __name((parent2, id2, line, at) => {
33310
+ const { table, column: column2, full } = PARENTS[parent2];
33311
+ const last = Number(database.prepare(`SELECT coalesce(max(position), 0) AS n FROM ${table} WHERE ${column2} = ?`).get(id2)?.n);
33312
+ if (last >= MAX_LINES)
33313
+ refuse(`an ${parent2} has at most ${MAX_LINES} lines`, full);
33314
+ insertLines(parent2, id2, [line], last + 1, at);
33315
+ }, "appendLine");
33316
+ const deleteLine = /* @__PURE__ */ __name((parent2, id2, position2) => {
33317
+ const { table, column: column2, reasons, instead } = PARENTS[parent2];
33318
+ const lines = Number(database.prepare(`SELECT count(*) AS n FROM ${table} WHERE ${column2} = ?`).get(id2)?.n);
33319
+ const gone = database.prepare(`DELETE FROM ${table} WHERE ${column2} = ? AND position = ?`).run(id2, position2);
33320
+ if (gone.changes === 0)
33321
+ throw new CliError("not_found", `${parent2}:${id2} has no line ${position2}`, { reason: `${reasons}.no-line` });
33322
+ if (lines === 1)
33323
+ refuse(`line ${position2} is the last of ${parent2}:${id2}; ${instead}`, `${reasons}.line`);
33324
+ }, "deleteLine");
33325
+ const sumOf = /* @__PURE__ */ __name((parent2, id2) => {
33326
+ const { table, column: column2 } = PARENTS[parent2];
33327
+ return Number(database.prepare(`SELECT coalesce(sum(amount), 0) AS n FROM ${table} WHERE ${column2} = ?`).get(id2)?.n);
33328
+ }, "sumOf");
33329
+ const retotal = /* @__PURE__ */ __name((parent2, id2, at) => {
33330
+ const { parents, table, column: column2 } = PARENTS[parent2];
33331
+ database.prepare(`UPDATE ${parents} SET total = coalesce((SELECT sum(amount) FROM ${table} WHERE ${column2} = ?), total), updated_at = ? WHERE id = ?`).run(id2, at, id2);
33332
+ }, "retotal");
33333
+ return { linesOf, insertLines, shownLines, appendLine, deleteLine, sumOf, retotal };
33035
33334
  }, "moneyLinesOver");
33036
33335
 
33037
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/refunds.js
33336
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/refunds.js
33038
33337
  var COUNTED = {
33039
33338
  confirmed: "np.review = 'confirmed' AND np.deleted_at IS NULL",
33040
33339
  // A proposed refund promises nothing back yet, so it must not free room an import could then fill.
@@ -33109,10 +33408,9 @@ var refundRulesOver = /* @__PURE__ */ __name((context) => {
33109
33408
  return { originalFor, refundShare, confirmable, keepsRefunded, keepsShare, keepsInvoice };
33110
33409
  }, "refundRulesOver");
33111
33410
 
33112
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/finance.js
33411
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/finance.js
33113
33412
  var FINANCE_TYPES = ["invoice", "payment"];
33114
33413
  var isFinanceType = /* @__PURE__ */ __name((type) => FINANCE_TYPES.includes(type), "isFinanceType");
33115
- var MAX_LINES = 500;
33116
33414
  var PAID = netPaidSql("i.id");
33117
33415
  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`;
33118
33416
  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";
@@ -33295,6 +33593,28 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33295
33593
  for (const refund of [true, false])
33296
33594
  database.prepare(`DELETE FROM payment_allocations WHERE invoice_id = ? AND payment_id IN (SELECT id FROM payments WHERE refund_of IS ${refund ? "NOT " : ""}NULL${which})`).run(invoiceId);
33297
33595
  }, "dropAllocations");
33596
+ const mayChangeLines = /* @__PURE__ */ __name((row2, by) => {
33597
+ mayChangeParts(row2, by, `only the owner changes the lines of invoice:${row2.id}; a bot changes only an invoice it proposed that is still proposed`);
33598
+ if (row2.deleted_at != null || row2.review === "rejected" || row2.status === "void")
33599
+ refuse(`invoice:${row2.id} is ${row2.deleted_at != null ? "deleted" : row2.review === "rejected" ? "rejected" : "void"}`, "finance.status");
33600
+ }, "mayChangeLines");
33601
+ const relined = /* @__PURE__ */ __name((row2, change) => {
33602
+ const [id2, currency] = [Number(row2.id), String(row2.currency)];
33603
+ write(database, () => {
33604
+ change(id2);
33605
+ const total = lines.sumOf("invoice", id2);
33606
+ if (!Number.isSafeInteger(total))
33607
+ refuse("an invoice's total is too large", "finance.total");
33608
+ if (total <= 0)
33609
+ refuse("an invoice totals more than 0", "finance.total");
33610
+ const paid = Number(database.prepare(`SELECT ${netPaidSql("?")} AS n`).get(id2)?.n);
33611
+ if (total < paid)
33612
+ refuse(`${moneyLabel(paid, currency)} is paid on invoice:${id2}; its lines cannot total ${moneyLabel(total, currency)}`, "finance.below-paid");
33613
+ lines.retotal("invoice", id2, now2());
33614
+ settle(id2);
33615
+ });
33616
+ return invoiceDetail(`invoice:${id2}`);
33617
+ }, "relined");
33298
33618
  const mayAllocate = /* @__PURE__ */ __name((row2, by) => mayChangeParts(row2, by, `only the owner allocates payment:${row2.id}; a bot allocates only from a payment it proposed that is still proposed`), "mayAllocate");
33299
33619
  return {
33300
33620
  addInvoice: /* @__PURE__ */ __name((input) => {
@@ -33331,6 +33651,17 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33331
33651
  return invoiceDetail(`invoice:${id2}`);
33332
33652
  }, "addInvoice"),
33333
33653
  invoice: /* @__PURE__ */ __name((reference2) => invoiceDetail(reference2), "invoice"),
33654
+ addInvoiceLine: /* @__PURE__ */ __name((reference2, { by, ...line }) => {
33655
+ const row2 = rowOf2(reference2, "invoice");
33656
+ mayChangeLines(row2, by);
33657
+ const [priced] = lines.linesOf("invoice", [line], String(row2.currency));
33658
+ return relined(row2, (id2) => lines.appendLine("invoice", id2, priced, now2()));
33659
+ }, "addInvoiceLine"),
33660
+ removeInvoiceLine: /* @__PURE__ */ __name((reference2, { position: position2, by }) => {
33661
+ const row2 = rowOf2(reference2, "invoice");
33662
+ mayChangeLines(row2, by);
33663
+ return relined(row2, (id2) => lines.deleteLine("invoice", id2, position2));
33664
+ }, "removeInvoiceLine"),
33334
33665
  invoices: /* @__PURE__ */ __name((filter = {}) => {
33335
33666
  const project2 = filter.project === void 0 ? null : projectId(database, filter.project);
33336
33667
  const counterparty = partyThing(filter.counterparty, "the counterparty");
@@ -33397,10 +33728,10 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
33397
33728
  payment: /* @__PURE__ */ __name((reference2) => paymentDetail(reference2), "payment"),
33398
33729
  payments: /* @__PURE__ */ __name((filter = {}) => {
33399
33730
  const project2 = filter.project === void 0 ? null : projectId(database, filter.project);
33400
- const party2 = partyThing(filter.party, "the party");
33731
+ const party3 = partyThing(filter.party, "the party");
33401
33732
  const by = proposedBySql("p.author_type", "p.author_id", filter.proposedBy);
33402
33733
  const review = filter.review === void 0 ? null : oneOf4(filter.review, FINANCE_REVIEWS, "a review");
33403
- return database.prepare(`${PAYMENTS} WHERE p.deleted_at IS NULL AND (? IS NULL OR p.direction = ?) AND (? IS NULL OR p.review = ?) AND (? IS NULL OR p.project_id = ?) AND (? IS NULL OR (p.payer_type = ? AND p.payer_id = ?) OR (p.payee_type = ? AND p.payee_id = ?)) AND ${by.sql} ORDER BY p.created_at DESC, p.id DESC LIMIT ?`).all(filter.direction ?? null, filter.direction ?? null, review, review, project2, project2, party2?.type ?? null, party2?.type ?? null, party2?.id ?? null, party2?.type ?? null, party2?.id ?? null, ...by.params, limitOf(filter.limit)).map(paymentOf3);
33734
+ return database.prepare(`${PAYMENTS} WHERE p.deleted_at IS NULL AND (? IS NULL OR p.direction = ?) AND (? IS NULL OR p.review = ?) AND (? IS NULL OR p.project_id = ?) AND (? IS NULL OR (p.payer_type = ? AND p.payer_id = ?) OR (p.payee_type = ? AND p.payee_id = ?)) AND ${by.sql} ORDER BY p.created_at DESC, p.id DESC LIMIT ?`).all(filter.direction ?? null, filter.direction ?? null, review, review, project2, project2, party3?.type ?? null, party3?.type ?? null, party3?.id ?? null, party3?.type ?? null, party3?.id ?? null, ...by.params, limitOf(filter.limit)).map(paymentOf3);
33404
33735
  }, "payments"),
33405
33736
  allocate: /* @__PURE__ */ __name(({ payment, invoice, amount, by }) => {
33406
33737
  const row2 = rowOf2(payment, "payment");
@@ -33459,6 +33790,8 @@ var financeStoreOver = /* @__PURE__ */ __name((context) => {
33459
33790
  return {
33460
33791
  addInvoice: /* @__PURE__ */ __name(async (input) => operations.addInvoice(input), "addInvoice"),
33461
33792
  invoice: /* @__PURE__ */ __name(async (reference2) => operations.invoice(reference2), "invoice"),
33793
+ addInvoiceLine: /* @__PURE__ */ __name(async (reference2, input) => operations.addInvoiceLine(reference2, input), "addInvoiceLine"),
33794
+ removeInvoiceLine: /* @__PURE__ */ __name(async (reference2, input) => operations.removeInvoiceLine(reference2, input), "removeInvoiceLine"),
33462
33795
  invoices: /* @__PURE__ */ __name(async (filter) => operations.invoices(filter), "invoices"),
33463
33796
  issueInvoice: /* @__PURE__ */ __name(async (reference2, by) => operations.issueInvoice(reference2, by), "issueInvoice"),
33464
33797
  voidInvoice: /* @__PURE__ */ __name(async (reference2, by) => operations.voidInvoice(reference2, by), "voidInvoice"),
@@ -33473,7 +33806,7 @@ var financeStoreOver = /* @__PURE__ */ __name((context) => {
33473
33806
  };
33474
33807
  }, "financeStoreOver");
33475
33808
 
33476
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-entries.js
33809
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-entries.js
33477
33810
  var refuse2 = /* @__PURE__ */ __name((message3, reason) => {
33478
33811
  throw new CliError("validation_error", message3, { reason });
33479
33812
  }, "refuse");
@@ -33489,7 +33822,7 @@ var entryAmount = /* @__PURE__ */ __name((payment) => {
33489
33822
  return refuse2(`${payment.currency} has ${scale} decimals; ${payment.amount} does not fit`, "money.amount");
33490
33823
  return formatDecimal(cents / shift, scale);
33491
33824
  }, "entryAmount");
33492
- var party = /* @__PURE__ */ __name((payment) => /^(person|organization):/.test(payment.counterparty ?? "") ? payment.counterparty : null, "party");
33825
+ var party2 = /* @__PURE__ */ __name((payment) => /^(person|organization):/.test(payment.counterparty ?? "") ? payment.counterparty : null, "party");
33493
33826
  var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
33494
33827
  const finance = financeOperationsOver(context);
33495
33828
  const today = /* @__PURE__ */ __name(() => new Date(context.now()).toISOString().slice(0, 10), "today");
@@ -33513,7 +33846,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
33513
33846
  ...by === "owner" ? {} : { source: "agent", reason: entry2.statement ?? paymentTitle(entry2) },
33514
33847
  evidence: entry2.evidence
33515
33848
  };
33516
- const counterparty = party(payment);
33849
+ const counterparty = party2(payment);
33517
33850
  if (payment.state === "cancelled") {
33518
33851
  if (entry2.supersedes === void 0)
33519
33852
  return refuse2("a cancelled payment names the invoice it cancels", "finance.ref");
@@ -33551,7 +33884,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
33551
33884
  };
33552
33885
  }, "paymentEntriesOver");
33553
33886
 
33554
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
33887
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
33555
33888
  var EVIDENCE_FINDINGS_KIND = "evidence_findings";
33556
33889
  var reference = /* @__PURE__ */ __name((raw) => {
33557
33890
  if (/^(document|note):[1-9]\d*$/.test(raw))
@@ -33577,7 +33910,7 @@ var validateEvidenceFindings = /* @__PURE__ */ __name((input) => {
33577
33910
  return valid;
33578
33911
  }, "validateEvidenceFindings");
33579
33912
 
33580
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
33913
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
33581
33914
  var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
33582
33915
  var PROPOSAL_VERDICTS = ["useful", "not_useful"];
33583
33916
  var iso10 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
@@ -33665,11 +33998,11 @@ var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
33665
33998
  }, "propose"),
33666
33999
  get: /* @__PURE__ */ __name((id2) => actionOf(rowOf2(id2)), "get"),
33667
34000
  pending: /* @__PURE__ */ __name(({ limit = 100 } = {}) => database.prepare(`${NAMED3} WHERE p.status = 'proposed' ORDER BY p.created_at, p.id LIMIT ?`).all(Math.min(Math.max(limit, 1), 500)).map(actionOf), "pending"),
33668
- list: /* @__PURE__ */ __name(({ status: status2, limit = 100, kinds: kinds2, except, proposedBy, project: project2 } = {}) => {
34001
+ list: /* @__PURE__ */ __name(({ status: status2, limit = 100, kinds: kinds2, except, proposedBy, project: project2, evidence } = {}) => {
33669
34002
  if (status2 !== void 0 && !PROPOSAL_STATUSES.includes(status2))
33670
34003
  throw new CliError("validation_error", `a status is one of ${PROPOSAL_STATUSES.join(", ")}`);
33671
34004
  const by = proposedBySql("p.proposed_by_type", "p.proposed_by_id", proposedBy);
33672
- return database.prepare(`${NAMED3} WHERE (? IS NULL OR ${STATUS} = ?) AND (? IS NULL OR p.kind IN (SELECT value FROM json_each(?))) AND p.kind NOT IN (SELECT value FROM json_each(?)) AND (? IS NULL OR (p.target_type = 'project' AND 'project:' || p.target_id = ?) OR json_extract(p.payload, '$.to') = ? OR json_extract(p.payload, '$.from') = ? OR json_extract(p.payload, '$.project') = ?) AND ${by.sql} ORDER BY p.created_at DESC, p.id DESC LIMIT ?`).all(status2 ?? null, status2 ?? null, kinds2 === void 0 ? null : 1, JSON.stringify(kinds2 ?? []), JSON.stringify(except ?? []), ...Array(5).fill(project2 ?? null), ...by.params, Math.min(Math.max(limit, 1), 500)).map(actionOf);
34005
+ return database.prepare(`${NAMED3} WHERE (? IS NULL OR ${STATUS} = ?) AND (? IS NULL OR p.kind IN (SELECT value FROM json_each(?))) AND p.kind NOT IN (SELECT value FROM json_each(?)) AND (? IS NULL OR (p.target_type = 'project' AND 'project:' || p.target_id = ?) OR json_extract(p.payload, '$.to') = ? OR json_extract(p.payload, '$.from') = ? OR json_extract(p.payload, '$.project') = ?) AND (? IS NULL OR EXISTS (SELECT 1 FROM json_each(p.payload, '$.evidence') WHERE value = ?)) AND ${by.sql} ORDER BY p.created_at DESC, p.id DESC LIMIT ?`).all(status2 ?? null, status2 ?? null, kinds2 === void 0 ? null : 1, JSON.stringify(kinds2 ?? []), JSON.stringify(except ?? []), ...Array(5).fill(project2 ?? null), evidence ?? null, evidence ?? null, ...by.params, Math.min(Math.max(limit, 1), 500)).map(actionOf);
33673
34006
  }, "list"),
33674
34007
  approve: /* @__PURE__ */ __name((id2, result, by) => decide2(id2, "approved", result, by), "approve"),
33675
34008
  reject: /* @__PURE__ */ __name((id2, by, result) => decide2(id2, "rejected", result, by), "reject"),
@@ -33758,7 +34091,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
33758
34091
  };
33759
34092
  }, "proposedActionsStoreOver");
33760
34093
 
33761
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-roles.js
34094
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-roles.js
33762
34095
  var settingOf = /* @__PURE__ */ __name((list2) => `relationships.roles.${list2}`, "settingOf");
33763
34096
  var isList = /* @__PURE__ */ __name((list2) => Object.hasOwn(ROLE_LISTS, list2), "isList");
33764
34097
  var listOf = /* @__PURE__ */ __name((list2) => {
@@ -33830,7 +34163,7 @@ var relationRolesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
33830
34163
  };
33831
34164
  }, "relationRolesOver");
33832
34165
 
33833
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-proposals.js
34166
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-proposals.js
33834
34167
  var isoOf = /* @__PURE__ */ __name((ms) => ms === void 0 ? null : new Date(ms).toISOString(), "isoOf");
33835
34168
  var relationOf = /* @__PURE__ */ __name((link3, now2) => ({
33836
34169
  id: link3.id,
@@ -34149,7 +34482,8 @@ var decidedOrigin = /* @__PURE__ */ __name((by) => by === "owner" ? { origin: "o
34149
34482
  provenance: `agent:${by.bot} for the owner: ${by.reason.trim()}`
34150
34483
  }, "decidedOrigin");
34151
34484
 
34152
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/reported-relations.js
34485
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/reported-relations.js
34486
+ var KEYED = "kind IN ('member-of', 'related-to', 'reports-to', 'customer-of', 'partner-of') AND to_id IS NOT NULL";
34153
34487
  var metadataOf = /* @__PURE__ */ __name((relation) => relation.metadata && Object.keys(relation.metadata).length ? JSON.stringify(relation.metadata) : null, "metadataOf");
34154
34488
  var syncReportedIn = /* @__PURE__ */ __name((context, key2, relationships, scope3, { source: source2 = "import", by = { bot: key2.provider, kind: "rule" } } = {}) => {
34155
34489
  const { database, now: now2 } = context;
@@ -34168,7 +34502,7 @@ var syncReportedIn = /* @__PURE__ */ __name((context, key2, relationships, scope
34168
34502
  };
34169
34503
  const seen = /* @__PURE__ */ new Set();
34170
34504
  const issue = /* @__PURE__ */ __name((relation, reason, message3) => result.issues.push({ reason, message: message3, from: relation.from, to: relation.to, kind: relation.kind }), "issue");
34171
- const sameKey = "kind = ? AND from_type = ? AND from_id = ? AND to_type = ? AND to_id = ? AND anchor IS NULL AND ifnull(role, '') = ?";
34505
+ const sameKey = `${KEYED} AND kind = ? AND from_type = ? AND from_id = ? AND to_type = ? AND to_id = ? AND anchor IS NULL AND ifnull(role, '') = ?`;
34172
34506
  for (const relation of relationships) {
34173
34507
  let from2 = thingOf(database, relation.from);
34174
34508
  let to = thingOf(database, relation.to);
@@ -34254,7 +34588,7 @@ var relationsStoreOver = /* @__PURE__ */ __name((context) => ({
34254
34588
  syncReported: /* @__PURE__ */ __name(async (key2, relationships, scope3, options) => write(context.database, () => syncReportedIn(context, key2, relationships, scope3, options)), "syncReported")
34255
34589
  }), "relationsStoreOver");
34256
34590
 
34257
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/crm.js
34591
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/crm.js
34258
34592
  var PENDING = "crm:pending-relations";
34259
34593
  var PENDING_DAYS = 30;
34260
34594
  var PENDING_MOST = 5e3;
@@ -34732,7 +35066,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
34732
35066
  };
34733
35067
  }, "crmCopiesOver");
34734
35068
 
34735
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/stage-amounts.js
35069
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/stage-amounts.js
34736
35070
  var TABLES3 = { deal: "deals", lead: "leads" };
34737
35071
  var stageAmountsOf = /* @__PURE__ */ __name(({ database }, kind3, stageIds, cutoff) => {
34738
35072
  const rows = database.prepare(`SELECT stage_id, currency, count(*) AS items, coalesce(sum(amount), 0) AS units FROM ${TABLES3[kind3]} WHERE stage_id IN (${stageIds.map(() => "?").join(", ") || "NULL"}) AND deleted_at IS NULL AND (? IS NULL OR created_at >= ?) GROUP BY stage_id, currency ORDER BY currency`).all(...stageIds, cutoff, cutoff);
@@ -34749,7 +35083,7 @@ var stageAmountsOf = /* @__PURE__ */ __name(({ database }, kind3, stageIds, cuto
34749
35083
  });
34750
35084
  }, "stageAmountsOf");
34751
35085
 
34752
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/deals.js
35086
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/deals.js
34753
35087
  var TABLES4 = { deal: "deals", lead: "leads" };
34754
35088
  var itemsSql = /* @__PURE__ */ __name((kind3) => `SELECT d.*, s.name AS stage_name, s.pipeline_id, p.name AS pipeline_name, b.name AS author_name, b.kind AS author_kind, a.provider AS account_provider, a.external_id AS account_external_id FROM ${TABLES4[kind3]} d JOIN pipeline_stages s ON s.id = d.stage_id JOIN pipelines p ON p.id = s.pipeline_id LEFT JOIN bots b ON d.author_type = 'bot' AND b.id = d.author_id LEFT JOIN accounts a ON a.id = d.account_id`, "itemsSql");
34755
35089
  var MAX_STAGES = 30;
@@ -35090,10 +35424,10 @@ var dealsStoreOver = /* @__PURE__ */ __name((context) => {
35090
35424
  };
35091
35425
  }, "dealsStoreOver");
35092
35426
 
35093
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
35427
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
35094
35428
  import { createHash as createHash13, randomBytes as randomBytes2 } from "node:crypto";
35095
35429
 
35096
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/decision-requests.js
35430
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/decision-requests.js
35097
35431
  var DECISION_ACTIONS = ["confirm", "reject", "ask-confirm", "ask-reject", "back", "later"];
35098
35432
  var DECISION_TTL_MS = 72 * 60 * 60 * 1e3;
35099
35433
  var CALLBACK_PREFIX = "wcr1:";
@@ -35107,7 +35441,7 @@ var callbackDataOf = /* @__PURE__ */ __name((token) => {
35107
35441
  }, "callbackDataOf");
35108
35442
  var parseCallbackData = /* @__PURE__ */ __name((data) => typeof data === "string" ? CALLBACK.exec(data)?.[1] : void 0, "parseCallbackData");
35109
35443
 
35110
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
35444
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
35111
35445
  var digestOf = /* @__PURE__ */ __name((token) => createHash13("sha256").update(token).digest("hex"), "digestOf");
35112
35446
  var newToken = /* @__PURE__ */ __name(() => randomBytes2(16).toString("base64url"), "newToken");
35113
35447
  var requestOf = /* @__PURE__ */ __name((row2) => ({
@@ -35203,7 +35537,7 @@ var decisionRequestStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
35203
35537
  };
35204
35538
  }, "decisionRequestStoreOver");
35205
35539
 
35206
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
35540
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
35207
35541
  var NOTE_FIELDS = [
35208
35542
  "text",
35209
35543
  "exact",
@@ -35481,7 +35815,7 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
35481
35815
  });
35482
35816
  }, "searchCorpus");
35483
35817
  var SCAN_PAGE3 = 5e3;
35484
- var LIVE2 = "((k.chunkable_type = 'document' AND EXISTS (SELECT 1 FROM documents d WHERE d.id = k.chunkable_id AND d.deleted_at IS NULL AND coalesce(json_extract(d.metadata, '$.catalog.active'), 1)=1 AND (? IS NULL OR d.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))))) OR (k.chunkable_type = 'note' AND ? IS NULL AND EXISTS (SELECT 1 FROM notes n WHERE n.id = k.chunkable_id AND n.deleted_at IS NULL)))";
35818
+ var LIVE4 = "((k.chunkable_type = 'document' AND EXISTS (SELECT 1 FROM documents d WHERE d.id = k.chunkable_id AND d.deleted_at IS NULL AND coalesce(json_extract(d.metadata, '$.catalog.active'), 1)=1 AND (? IS NULL OR d.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))))) OR (k.chunkable_type = 'note' AND ? IS NULL AND EXISTS (SELECT 1 FROM notes n WHERE n.id = k.chunkable_id AND n.deleted_at IS NULL)))";
35485
35819
  var noteSearchOver = /* @__PURE__ */ __name((context) => {
35486
35820
  const { database } = context;
35487
35821
  const stemmerFor2 = stemmerCache();
@@ -35494,7 +35828,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
35494
35828
  const folders = folderIds?.length ? JSON.stringify(folderIds) : null;
35495
35829
  const types = source2 === void 0 ? ["document", "note"] : source2 === "file" ? ["document"] : ["note"];
35496
35830
  return {
35497
- sql: ` AND k.chunkable_type IN (${types.map(() => "?").join(", ")}) AND ${LIVE2}`,
35831
+ sql: ` AND k.chunkable_type IN (${types.map(() => "?").join(", ")}) AND ${LIVE4}`,
35498
35832
  params: [...types, folders, folders, withInternal ? null : folders]
35499
35833
  };
35500
35834
  }, "live");
@@ -35521,11 +35855,17 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
35521
35855
  }
35522
35856
  return texts2.get(owner);
35523
35857
  }, "textOf");
35524
- return database.prepare(`SELECT k.content_hash AS hash, min(k.chunkable_type || ':' || k.chunkable_id) AS owner, k.start_offset AS start, k.end_offset AS end
35858
+ return database.prepare(`SELECT k.content_hash AS hash, min(k.chunkable_type || ':' || k.chunkable_id) AS owner, k.start_offset AS start, k.end_offset AS end,
35859
+ k.position
35525
35860
  FROM chunks k
35526
35861
  WHERE k.content_hash > ?${scope3.sql}
35527
35862
  AND NOT EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ? AND v.content_hash = k.content_hash)
35528
35863
  GROUP BY k.content_hash ORDER BY k.content_hash LIMIT ?`).all(after2 ?? "", ...scope3.params, model, limit).flatMap((row2) => {
35864
+ if (Number(row2.position) === ENRICHMENT_POSITION) {
35865
+ const [type, id2] = String(row2.owner).split(":");
35866
+ const text7 = enrichmentText(database, String(type), Number(id2));
35867
+ return text7 === void 0 ? [] : [{ hash: String(row2.hash), text: text7 }];
35868
+ }
35529
35869
  const text6 = textOf7(String(row2.owner));
35530
35870
  return text6 === void 0 ? [] : [{ hash: String(row2.hash), text: text6.slice(Number(row2.start), Number(row2.end)) }];
35531
35871
  });
@@ -35633,7 +35973,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
35633
35973
  };
35634
35974
  }, "noteSearchOver");
35635
35975
 
35636
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
35976
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
35637
35977
  var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
35638
35978
  var inEventAccounts = /* @__PURE__ */ __name((event2) => searchableCopy(event2, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
35639
35979
  var EVENT_CORPUS = {
@@ -35765,7 +36105,7 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
35765
36105
  };
35766
36106
  }, "eventSearchOver");
35767
36107
 
35768
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/moment.js
36108
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/domain/moment.js
35769
36109
  var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
35770
36110
  try {
35771
36111
  return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
@@ -35777,7 +36117,7 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
35777
36117
  }
35778
36118
  }, "calendarMoment");
35779
36119
 
35780
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
36120
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
35781
36121
  var NAMED4 = "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";
35782
36122
  var iso12 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
35783
36123
  var oneOf5 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -35997,7 +36337,7 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
35997
36337
  };
35998
36338
  }, "factsStoreOver");
35999
36339
 
36000
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
36340
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
36001
36341
  var invalid2 = /* @__PURE__ */ __name((message3) => {
36002
36342
  throw new CliError("validation_error", message3);
36003
36343
  }, "invalid");
@@ -36101,7 +36441,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
36101
36441
  return { snapshot: snapshot2, snapshotParts, previous, outcomes, create };
36102
36442
  }, "findingsCoreOver");
36103
36443
 
36104
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
36444
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
36105
36445
  var stale = /* @__PURE__ */ __name(() => {
36106
36446
  throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
36107
36447
  reason: "evidence-findings.stale"
@@ -36282,7 +36622,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
36282
36622
  };
36283
36623
  }, "evidenceFindingsStoreOver");
36284
36624
 
36285
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
36625
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
36286
36626
  var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
36287
36627
  var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
36288
36628
  rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
@@ -36335,7 +36675,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
36335
36675
  }, "forPerson")
36336
36676
  }), "involvementStoreOver");
36337
36677
 
36338
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/labelled.js
36678
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/labelled.js
36339
36679
  var LABELLED = {
36340
36680
  note: "note",
36341
36681
  document: "document",
@@ -36347,7 +36687,7 @@ var LABELLED = {
36347
36687
  account: "folder"
36348
36688
  };
36349
36689
 
36350
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
36690
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
36351
36691
  import { createHash as createHash14 } from "node:crypto";
36352
36692
  var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
36353
36693
  var id = /* @__PURE__ */ __name((value) => {
@@ -36433,7 +36773,7 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
36433
36773
  };
36434
36774
  }, "meetingProjectsStoreOver");
36435
36775
 
36436
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
36776
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
36437
36777
  var ORGANIZATIONS_QUERY = {
36438
36778
  entity: "organization",
36439
36779
  backend: "sql",
@@ -36474,7 +36814,7 @@ var REMINDERS_QUERY = {
36474
36814
  })
36475
36815
  };
36476
36816
 
36477
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/organizations.js
36817
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/organizations.js
36478
36818
  var organizationOf = /* @__PURE__ */ __name((row2) => ({
36479
36819
  id: String(row2.id),
36480
36820
  ref: `organization:${row2.id}`,
@@ -36516,7 +36856,7 @@ var organizationsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) =>
36516
36856
  }), "setOwnOrganization")
36517
36857
  }), "organizationsStoreOver");
36518
36858
 
36519
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-list.js
36859
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-list.js
36520
36860
  var KINDS = RELATION_KINDS.map(linkKind).join(", ");
36521
36861
  var typeOfRef = /* @__PURE__ */ __name((column2) => `substr(${column2}, 1, instr(${column2}, ':') - 1)`, "typeOfRef");
36522
36862
  var idOfRef = /* @__PURE__ */ __name((column2) => `CAST(substr(${column2}, instr(${column2}, ':') + 1) AS INTEGER)`, "idOfRef");
@@ -36641,13 +36981,13 @@ var relationListOver = /* @__PURE__ */ __name((context) => {
36641
36981
  __name(proposalItem, "proposalItem");
36642
36982
  }, "relationListOver");
36643
36983
 
36644
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-reads.js
36984
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-reads.js
36645
36985
  var relationReadsOver = /* @__PURE__ */ __name((context) => ({
36646
36986
  ...relationListOver(context),
36647
36987
  ...relationRolesOver(context)
36648
36988
  }), "relationReadsOver");
36649
36989
 
36650
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review.js
36990
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review.js
36651
36991
  var TABLES5 = { memory: "memories", fact: "facts" };
36652
36992
  var RETIRED = /* @__PURE__ */ new Set(["superseded", "reversed", "rejected", "stale"]);
36653
36993
  var DEFAULT_LIMIT = 500;
@@ -36835,16 +37175,16 @@ var sourceReviewStoreOver = /* @__PURE__ */ __name((context) => {
36835
37175
  };
36836
37176
  }, "sourceReviewStoreOver");
36837
37177
 
36838
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
37178
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
36839
37179
  import { createHash as createHash17 } from "node:crypto";
36840
37180
 
36841
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
37181
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
36842
37182
  import { createHash as createHash16 } from "node:crypto";
36843
37183
 
36844
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
37184
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
36845
37185
  import { createHash as createHash15 } from "node:crypto";
36846
37186
 
36847
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
37187
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
36848
37188
  var consolidationId = /* @__PURE__ */ __name((value, field4) => {
36849
37189
  if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
36850
37190
  throw new CliError("validation_error", `${field4} must be a positive canonical tag id`);
@@ -36895,7 +37235,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
36895
37235
  return input;
36896
37236
  }, "consolidationApplyInput");
36897
37237
 
36898
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
37238
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
36899
37239
  var receiptOf = /* @__PURE__ */ __name((row2) => ({
36900
37240
  id: String(row2.id),
36901
37241
  sourceId: String(row2.source_id),
@@ -36970,7 +37310,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
36970
37310
  }, { beforeCommit: check3 });
36971
37311
  }, "applyTagConsolidation");
36972
37312
 
36973
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
37313
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
36974
37314
  var selections = [
36975
37315
  ["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
36976
37316
  ["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
@@ -37114,7 +37454,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
37114
37454
  };
37115
37455
  }, "previewRows");
37116
37456
 
37117
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
37457
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
37118
37458
  var kinds = ["project", "tag", "topic"];
37119
37459
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
37120
37460
  if (signal?.aborted)
@@ -37378,7 +37718,7 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
37378
37718
  };
37379
37719
  }, "vocabularyStoreOver");
37380
37720
 
37381
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
37721
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
37382
37722
  var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
37383
37723
  var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
37384
37724
  var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
@@ -37924,7 +38264,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
37924
38264
  return key2.padEnd(3, "X");
37925
38265
  }, "projectKey");
37926
38266
 
37927
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
38267
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
37928
38268
  var DAY5 = 864e5;
37929
38269
  var SETTING4 = "logs_pruned_at";
37930
38270
  var LOG_RETENTION = { agentActionsMs: 90 * DAY5, botUpdatePayloadsMs: 30 * DAY5 };
@@ -37951,7 +38291,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
37951
38291
  };
37952
38292
  }, "logPruner");
37953
38293
 
37954
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/mail/findings.js
38294
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/mail/findings.js
37955
38295
  var MAIL_FINDINGS_PER_RUN = 30;
37956
38296
  var MAIL_FINDINGS_PER_SENDER = 5;
37957
38297
  var invalid4 = /* @__PURE__ */ __name((message3) => {
@@ -38090,7 +38430,7 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
38090
38430
  return invalid4(`${what} is not a reference of the kind it takes: ${text6}`);
38091
38431
  return text6;
38092
38432
  }, "reference");
38093
- const party2 = /* @__PURE__ */ __name((field4, what) => {
38433
+ const party3 = /* @__PURE__ */ __name((field4, what) => {
38094
38434
  const [given2, name, email] = [raw[field4], raw[`${field4}Name`], raw[`${field4}Email`]];
38095
38435
  if (given2 !== void 0 && name !== void 0)
38096
38436
  return invalid4(`${what} is ${field4} or ${field4}_name, not both`);
@@ -38185,7 +38525,7 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
38185
38525
  id: id2,
38186
38526
  kind: "invoice",
38187
38527
  direction: oneOf7(raw.direction, INVOICE_DIRECTIONS, "an invoice's direction"),
38188
- ...raw.counterparty === void 0 && raw.counterpartyName === void 0 ? invalid4("an invoice names its counterparty: counterparty person:N|organization:N, or counterparty_name") : party2("counterparty", "an invoice's counterparty"),
38528
+ ...raw.counterparty === void 0 && raw.counterpartyName === void 0 ? invalid4("an invoice names its counterparty: counterparty person:N|organization:N, or counterparty_name") : party3("counterparty", "an invoice's counterparty"),
38189
38529
  currency: word(raw.currency, 3),
38190
38530
  lines,
38191
38531
  ...optional2("total", raw.total, (value) => word(value, 30)),
@@ -38217,8 +38557,8 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
38217
38557
  id: id2,
38218
38558
  kind: "payment",
38219
38559
  direction: oneOf7(raw.direction, MONEY_DIRECTIONS, "a payment's direction"),
38220
- ...party2("payer", "a payment's payer"),
38221
- ...party2("payee", "a payment's payee"),
38560
+ ...party3("payer", "a payment's payer"),
38561
+ ...party3("payee", "a payment's payee"),
38222
38562
  amount: word(raw.amount, 30),
38223
38563
  currency: word(raw.currency, 3),
38224
38564
  date: word(raw.date, 10),
@@ -38234,7 +38574,7 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
38234
38574
  id: id2,
38235
38575
  kind: "order",
38236
38576
  purpose: oneOf7(raw.purpose, ORDER_PURPOSES, "an order's purpose"),
38237
- ...party2("customer", "an order's customer"),
38577
+ ...party3("customer", "an order's customer"),
38238
38578
  ...optional2("supplier", raw.supplier, (value) => reference2(value, PARTY, "an order's supplier")),
38239
38579
  supplierName: word(raw.supplierName, 200),
38240
38580
  ...optional2("number", raw.number, (value) => word(value, 80)),
@@ -38310,7 +38650,7 @@ var checkMailFindings = /* @__PURE__ */ __name((input) => {
38310
38650
  }, "checkMailFindings");
38311
38651
  var mailFindingFingerprint = /* @__PURE__ */ __name(({ id: _id, ...finding }) => findingHash(finding), "mailFindingFingerprint");
38312
38652
 
38313
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/mail/score.js
38653
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/mail/score.js
38314
38654
  var import_disposable_email_domains_js = __toESM(require_dist(), 1);
38315
38655
  var import_tldts = __toESM(require_cjs(), 1);
38316
38656
  var WEIGHTS = {
@@ -38444,8 +38784,7 @@ var scoreGroup = /* @__PURE__ */ __name((items, context) => {
38444
38784
  return { score: kept.reduce((sum, signal) => sum + WEIGHTS[signal], 0), signals: kept };
38445
38785
  }, "scoreGroup");
38446
38786
 
38447
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/orders.js
38448
- var MAX_LINES2 = 500;
38787
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/orders.js
38449
38788
  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";
38450
38789
  var orderOperationsOver = /* @__PURE__ */ __name((context) => {
38451
38790
  const { database, now: now2 } = context;
@@ -38490,9 +38829,6 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
38490
38829
  ...orderOf2(row2),
38491
38830
  lines: row2.currency == null ? [] : moneyLines.shownLines("order", Number(row2.id), String(row2.currency))
38492
38831
  }), "detailOf");
38493
- const retotal = /* @__PURE__ */ __name((orderId) => {
38494
- database.prepare("UPDATE orders SET total = coalesce((SELECT sum(amount) FROM order_lines WHERE order_id = ?), total), updated_at = ? WHERE id = ?").run(orderId, now2(), orderId);
38495
- }, "retotal");
38496
38832
  const mayChangeLines = /* @__PURE__ */ __name((row2, by) => {
38497
38833
  mayChangeParts(row2, by, `only the owner changes the lines of order:${row2.id}; a bot changes only an order it proposed that is still proposed`, "order.owner-only");
38498
38834
  if (row2.review === "rejected" || row2.deleted_at != null)
@@ -38523,8 +38859,8 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
38523
38859
  refuse("a sale names its customer, a person: or organization:", "order.field");
38524
38860
  const number3 = text3(input.number, "an order's number", 80);
38525
38861
  const lines = input.lines ?? [];
38526
- if (!Array.isArray(lines) || lines.length > MAX_LINES2)
38527
- refuse(`an order has at most ${MAX_LINES2} lines`, "order.field");
38862
+ if (!Array.isArray(lines) || lines.length > MAX_LINES)
38863
+ refuse(`an order has at most ${MAX_LINES} lines`, "order.field");
38528
38864
  if (lines.length && input.currency === void 0)
38529
38865
  refuse("an order with lines names its currency", "order.total");
38530
38866
  if (!lines.length && input.total === void 0 !== (input.currency === void 0))
@@ -38544,8 +38880,8 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
38544
38880
  const id2 = write(database, () => {
38545
38881
  const customer = partyThing(input.customer, "the customer") ?? ownerPerson(database);
38546
38882
  const supplier = partyThing(input.supplier, "the supplier") ?? (direction === "sale" ? ownerPerson(database) : void 0);
38547
- const party2 = partyOf(supplier?.type, supplier?.id);
38548
- const supplierName = named3 ?? party2?.name ?? (party2?.owner ? "owner" : null);
38883
+ const party3 = partyOf(supplier?.type, supplier?.id);
38884
+ const supplierName = named3 ?? party3?.name ?? (party3?.owner ? "owner" : null);
38549
38885
  if (supplierName === null)
38550
38886
  return refuse("an order names its shop or supplier", "order.field");
38551
38887
  if (number3 !== null && ordersOfShop(database, supplierName, number3).some((one2) => held === void 0 || one2.id !== held.id))
@@ -38613,11 +38949,8 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
38613
38949
  refuse(`order:${row2.id} has no currency; a line needs one`, "order.total");
38614
38950
  const [priced] = moneyLines.linesOf("order", [line], String(row2.currency));
38615
38951
  write(database, () => {
38616
- const last = Number(database.prepare("SELECT coalesce(max(position), 0) AS n FROM order_lines WHERE order_id = ?").get(Number(row2.id))?.n);
38617
- if (last >= MAX_LINES2)
38618
- refuse(`an order has at most ${MAX_LINES2} lines`, "order.field");
38619
- moneyLines.insertLines("order", Number(row2.id), [priced], last + 1, now2());
38620
- retotal(Number(row2.id));
38952
+ moneyLines.appendLine("order", Number(row2.id), priced, now2());
38953
+ moneyLines.retotal("order", Number(row2.id), now2());
38621
38954
  });
38622
38955
  return detailOf(rowOf2(`order:${row2.id}`));
38623
38956
  }, "addLine"),
@@ -38625,13 +38958,8 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
38625
38958
  const row2 = rowOf2(reference2);
38626
38959
  mayChangeLines(row2, by);
38627
38960
  write(database, () => {
38628
- const lines = Number(database.prepare("SELECT count(*) AS n FROM order_lines WHERE order_id = ?").get(Number(row2.id))?.n);
38629
- const gone = database.prepare("DELETE FROM order_lines WHERE order_id = ? AND position = ?").run(Number(row2.id), position2);
38630
- if (gone.changes === 0)
38631
- throw new CliError("not_found", `order:${row2.id} has no line ${position2}`, { reason: "order.no-line" });
38632
- if (lines === 1)
38633
- refuse(`line ${position2} is the last of order:${row2.id}; reject or cancel the order instead`, "order.line");
38634
- retotal(Number(row2.id));
38961
+ moneyLines.deleteLine("order", Number(row2.id), position2);
38962
+ moneyLines.retotal("order", Number(row2.id), now2());
38635
38963
  });
38636
38964
  return detailOf(rowOf2(`order:${row2.id}`));
38637
38965
  }, "removeLine")
@@ -38664,7 +38992,7 @@ var ordersStoreOver = /* @__PURE__ */ __name((context) => {
38664
38992
  };
38665
38993
  }, "ordersStoreOver");
38666
38994
 
38667
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-findings.js
38995
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-findings.js
38668
38996
  var stale2 = /* @__PURE__ */ __name(() => {
38669
38997
  throw new CliError("validation_error", "mail findings cite mail that changed since it was read; stage a new batch", {
38670
38998
  reason: "mail-findings.stale"
@@ -39121,7 +39449,7 @@ ${evidence.join("\n")}`, agent);
39121
39449
  };
39122
39450
  }, "mailFindingsStoreOver");
39123
39451
 
39124
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
39452
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
39125
39453
  var stale3 = /* @__PURE__ */ __name(() => {
39126
39454
  throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
39127
39455
  reason: "meeting-findings.stale"
@@ -39289,9 +39617,9 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
39289
39617
  };
39290
39618
  }, "meetingFindingsStoreOver");
39291
39619
 
39292
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
39620
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
39293
39621
  var RANK_BATCH = 512;
39294
- 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";
39622
+ var LIVE5 = "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";
39295
39623
  var limitOf2 = /* @__PURE__ */ __name((value, name, max = 1e3) => {
39296
39624
  positiveReadInteger(value, name);
39297
39625
  if (value > max)
@@ -39377,7 +39705,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
39377
39705
  throw new CliError("validation_error", "Vector save exceeds its batch or 16 MiB payload budget");
39378
39706
  return write(context.database, () => {
39379
39707
  const unique2 = new Map(rows.map((row2) => [row2.hash, row2]));
39380
- const current = context.database.prepare(`SELECT DISTINCT k.content_hash ${LIVE3} AND k.content_hash IN (SELECT value FROM json_each(?))`).all(input.accountId, JSON.stringify([...unique2.keys()]));
39708
+ const current = context.database.prepare(`SELECT DISTINCT k.content_hash ${LIVE5} AND k.content_hash IN (SELECT value FROM json_each(?))`).all(input.accountId, JSON.stringify([...unique2.keys()]));
39381
39709
  const available = new Set(current.map((row2) => String(row2.content_hash)));
39382
39710
  const selected = [...unique2.values()].filter((row2) => available.has(row2.hash) && !context.database.prepare("SELECT 1 FROM embeddings WHERE model=? AND content_hash=?").get(model, row2.hash));
39383
39711
  input.signal?.throwIfAborted();
@@ -39434,7 +39762,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
39434
39762
  if (input.afterHash !== void 0 && !/^[a-f0-9]{64}$/.test(input.afterHash))
39435
39763
  throw new CliError("validation_error", "afterHash must be a content hash");
39436
39764
  return read(context.database, () => {
39437
- const rows = context.database.prepare(`SELECT k.* ${LIVE3} AND k.content_hash > ? AND NOT EXISTS (SELECT 1 FROM embeddings e WHERE e.model=? AND e.content_hash=k.content_hash) GROUP BY k.content_hash ORDER BY k.content_hash LIMIT ?`).all(input.accountId, input.afterHash ?? "", model, limit + 1);
39765
+ const rows = context.database.prepare(`SELECT k.* ${LIVE5} AND k.content_hash > ? AND NOT EXISTS (SELECT 1 FROM embeddings e WHERE e.model=? AND e.content_hash=k.content_hash) GROUP BY k.content_hash ORDER BY k.content_hash LIMIT ?`).all(input.accountId, input.afterHash ?? "", model, limit + 1);
39438
39766
  const load = textLoader(context, input);
39439
39767
  const items = rows.slice(0, limit).map((row2) => ({
39440
39768
  hash: String(row2.content_hash),
@@ -39454,13 +39782,13 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
39454
39782
  if (input.afterChunkId !== void 0)
39455
39783
  positiveReadInteger(input.afterChunkId, "afterChunkId");
39456
39784
  return read(context.database, () => {
39457
- const selectedSql = `${LIVE3.replace(" WHERE", " JOIN embeddings e ON e.content_hash=k.content_hash AND e.model=? WHERE")} AND k.id>? ORDER BY k.id LIMIT ?`;
39785
+ const selectedSql = `${LIVE5.replace(" WHERE", " JOIN embeddings e ON e.content_hash=k.content_hash AND e.model=? WHERE")} AND k.id>? ORDER BY k.id LIMIT ?`;
39458
39786
  const params = [model, input.accountId, input.afterChunkId ?? 0, maxChunks + 1];
39459
39787
  const preflight = context.database.prepare(`SELECT coalesce(sum(n),0) AS bytes, coalesce(sum(bad),0) AS bad FROM (SELECT length(e.vector) AS n, (e.dims != ? OR length(e.vector) != ?) AS bad ${selectedSql})`).get(query.length, query.length * 4, ...params);
39460
39788
  if (Number(preflight?.bad ?? 0) || Number(preflight?.bytes ?? 0) > 16 * 1024 * 1024)
39461
39789
  throw new CliError("validation_error", "Stored vectors exceed the dimension or 16 MiB scan budget");
39462
39790
  input.signal?.throwIfAborted();
39463
- const rows = context.database.prepare(`SELECT k.*,e.dims,e.vector ${LIVE3.replace(" WHERE", " JOIN embeddings e ON e.content_hash=k.content_hash AND e.model=? WHERE")} AND k.id>? ORDER BY k.id LIMIT ?`).all(model, input.accountId, input.afterChunkId ?? 0, maxChunks + 1);
39791
+ const rows = context.database.prepare(`SELECT k.*,e.dims,e.vector ${LIVE5.replace(" WHERE", " JOIN embeddings e ON e.content_hash=k.content_hash AND e.model=? WHERE")} AND k.id>? ORDER BY k.id LIMIT ?`).all(model, input.accountId, input.afterChunkId ?? 0, maxChunks + 1);
39464
39792
  const selected = rows.slice(0, maxChunks);
39465
39793
  const load = textLoader(context, input);
39466
39794
  const items = selected.map((row2) => {
@@ -39555,12 +39883,12 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
39555
39883
  async status(input) {
39556
39884
  scope2(input);
39557
39885
  modelOf(input.model);
39558
- const row2 = context.database.prepare(`SELECT count(DISTINCT k.content_hash) AS chunks,count(DISTINCT CASE WHEN EXISTS (SELECT 1 FROM embeddings e WHERE e.model=? AND e.content_hash=k.content_hash) THEN k.content_hash END) AS embedded ${LIVE3}`).get(input.model, input.accountId);
39886
+ const row2 = context.database.prepare(`SELECT count(DISTINCT k.content_hash) AS chunks,count(DISTINCT CASE WHEN EXISTS (SELECT 1 FROM embeddings e WHERE e.model=? AND e.content_hash=k.content_hash) THEN k.content_hash END) AS embedded ${LIVE5}`).get(input.model, input.accountId);
39559
39887
  return { chunks: Number(row2?.chunks ?? 0), embedded: Number(row2?.embedded ?? 0) };
39560
39888
  }
39561
39889
  }), "meetingVectorsOver");
39562
39890
 
39563
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
39891
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
39564
39892
  var OTHER_SOURCES = ["document", "note", "email"];
39565
39893
  var TEXTS = {
39566
39894
  document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
@@ -39661,7 +39989,7 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
39661
39989
  };
39662
39990
  }, "sourceMentionStoreOver");
39663
39991
 
39664
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/money-transactions.js
39992
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/money-transactions.js
39665
39993
  var TRANSACTIONS = "SELECT t.*, w.name AS wallet_name, b.name AS author_name, b.kind AS author_kind, (SELECT coalesce(sum(amount), 0) FROM transaction_splits WHERE transaction_id = t.id) AS split FROM financial_transactions t JOIN financial_accounts w ON w.id = t.financial_account_id LEFT JOIN bots b ON t.author_type = 'bot' AND b.id = t.author_id";
39666
39994
  var MAX_SPLITS = 100;
39667
39995
  var transactionOperationsOver = /* @__PURE__ */ __name((context) => {
@@ -39892,11 +40220,11 @@ var transactionsStoreOver = /* @__PURE__ */ __name((context) => {
39892
40220
  };
39893
40221
  }, "transactionsStoreOver");
39894
40222
 
39895
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
40223
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
39896
40224
  import { accessSync, constants, existsSync, mkdirSync as mkdirSync2, statSync, writeFileSync as writeFileSync2 } from "node:fs";
39897
40225
  import { dirname as dirname2 } from "node:path";
39898
40226
 
39899
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
40227
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
39900
40228
  import { readFileSync as readFileSync3 } from "node:fs";
39901
40229
  var CLIENTS_SETTING = "clients";
39902
40230
  var coreVersion = (() => {
@@ -39954,7 +40282,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
39954
40282
  return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
39955
40283
  }, "refusalAdvice");
39956
40284
 
39957
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
40285
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
39958
40286
  var GENERATED = [
39959
40287
  {
39960
40288
  "name": "20261010184427_initial",
@@ -41164,10 +41492,24 @@ WHERE json_type(params, '$.selection') = 'object';`
41164
41492
  "CREATE TRIGGER payment_allocations_refund_bd BEFORE DELETE ON payment_allocations\n WHEN (SELECT refund_of IS NOT NULL AND review = 'confirmed' AND deleted_at IS NULL FROM payments WHERE id = old.payment_id)\n AND (SELECT review FROM invoices WHERE id = old.invoice_id) <> 'rejected'\n AND (SELECT coalesce(sum(CASE WHEN np.refund_of IS NULL THEN na.amount ELSE -na.amount END), 0) FROM payment_allocations na JOIN payments np ON np.id = na.payment_id WHERE na.invoice_id = old.invoice_id AND np.review = 'confirmed' AND np.deleted_at IS NULL) + old.amount\n > (SELECT total FROM invoices WHERE id = old.invoice_id) BEGIN\n SELECT RAISE(ABORT, 'payment_allocations: taking a refund''s share back would pay the invoice beyond its total');\nEND;",
41165
41493
  "-- A void invoice keeps what was settled on it; a rejected one lets its allocations go, as reject sets review first.\nCREATE TRIGGER payment_allocations_void_bd BEFORE DELETE ON payment_allocations\n WHEN (SELECT status = 'void' AND review <> 'rejected' FROM invoices WHERE id = old.invoice_id) BEGIN\n SELECT RAISE(ABORT, 'payment_allocations: a void invoice keeps its allocations');\nEND;"
41166
41494
  ]
41495
+ },
41496
+ {
41497
+ "name": "20261108104659_version-58-enrichments",
41498
+ "statements": [
41499
+ "CREATE TABLE `enrichments` (\n `subject_type` text NOT NULL,\n `subject_id` integer NOT NULL,\n `source_hash` text NOT NULL,\n `provider` text NOT NULL,\n `model` text NOT NULL,\n `text` text NOT NULL,\n `tokens` integer NOT NULL,\n `created_at` integer NOT NULL,\n CONSTRAINT `enrichments_pk` PRIMARY KEY(`subject_type`, `subject_id`)\n);"
41500
+ ]
41501
+ },
41502
+ {
41503
+ "name": "20261108104701_version-58-enrichments-deletes",
41504
+ "statements": [
41505
+ "CREATE TRIGGER enrichments_document_gone AFTER DELETE ON documents BEGIN\n DELETE FROM enrichments WHERE subject_type = 'document' AND subject_id = OLD.id;\nEND;",
41506
+ "CREATE TRIGGER enrichments_note_gone AFTER DELETE ON notes BEGIN\n DELETE FROM enrichments WHERE subject_type = 'note' AND subject_id = OLD.id;\nEND;",
41507
+ "CREATE TRIGGER enrichments_email_gone AFTER DELETE ON emails BEGIN\n DELETE FROM enrichments WHERE subject_type = 'email' AND subject_id = OLD.id;\n DELETE FROM chunks WHERE chunkable_type = 'email_enrichment' AND chunkable_id = OLD.id;\nEND;"
41508
+ ]
41167
41509
  }
41168
41510
  ];
41169
41511
 
41170
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/rollback-copy.js
41512
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/rollback-copy.js
41171
41513
  import { mkdirSync, rmSync, statfsSync, writeFileSync } from "node:fs";
41172
41514
  import { basename, dirname, join as join2, parse } from "node:path";
41173
41515
  var DERIVED = /(_fts|_words|_stems|_trigrams|_pending)$|^(embeddings|chunks|chunk_messages|mentions|involvements|search_terms)$|^vector_index/;
@@ -41400,7 +41742,7 @@ var rollBack = /* @__PURE__ */ __name((database, path) => {
41400
41742
  return { ...result, foreignKeyViolations };
41401
41743
  }, "rollBack");
41402
41744
 
41403
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
41745
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
41404
41746
  var V31_TABLES = [
41405
41747
  "accounts",
41406
41748
  "account_identities",
@@ -41518,7 +41860,9 @@ var MANIFEST = [
41518
41860
  { name: "20261107162448_version-56-relationship-links-history", version: 56, minCompatible: 56, tables: V56_TABLES },
41519
41861
  { name: "20261107163245_version-56-relationship-links-key", version: 56, minCompatible: 56, tables: V56_TABLES },
41520
41862
  { name: "20261108010753_version-57-business", version: 57, minCompatible: 56 },
41521
- { name: "20261108010754_version-57-business-rules", version: 57, minCompatible: 56 }
41863
+ { name: "20261108010754_version-57-business-rules", version: 57, minCompatible: 56 },
41864
+ { name: "20261108104659_version-58-enrichments", version: 58, minCompatible: 56 },
41865
+ { name: "20261108104701_version-58-enrichments-deletes", version: 58, minCompatible: 56 }
41522
41866
  ];
41523
41867
  var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated = GENERATED) => {
41524
41868
  const migrations = [];
@@ -41554,7 +41898,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
41554
41898
  return migrations;
41555
41899
  }, "generatedMigrations");
41556
41900
 
41557
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/migrations.js
41901
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/migrations.js
41558
41902
  var MIGRATIONS = generatedMigrations();
41559
41903
  var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
41560
41904
  version INTEGER PRIMARY KEY,
@@ -41633,7 +41977,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
41633
41977
  }
41634
41978
  }, "migrate");
41635
41979
 
41636
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
41980
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
41637
41981
  var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
41638
41982
  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 ?");
41639
41983
  if (pending.get(0, 1) === void 0)
@@ -41655,7 +41999,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
41655
41999
  }
41656
42000
  }, "fillJoinKeys");
41657
42001
 
41658
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
42002
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
41659
42003
  var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
41660
42004
  refuseOwnerStoreInTests(path);
41661
42005
  const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
@@ -41669,8 +42013,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
41669
42013
  }, "openSqlite");
41670
42014
  var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
41671
42015
  quietSqliteWarning();
41672
- const { drizzle } = await import("./node-UIRGGMGT.js");
41673
- const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-4ZM7OPRF.js");
42016
+ const { drizzle } = await import("./node-HIKYE546.js");
42017
+ const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-3GJAG7VO.js");
41674
42018
  const client = await nodeClient(path, { readOnly });
41675
42019
  try {
41676
42020
  return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
@@ -41680,8 +42024,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
41680
42024
  }
41681
42025
  }, "openUnderNode");
41682
42026
  var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
41683
- const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-GCT7ROCK.js");
41684
- const { drizzle } = await import("./bun-34VBM7C5.js");
42027
+ const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-UIWRS4HI.js");
42028
+ const { drizzle } = await import("./bun-7AHNFZMZ.js");
41685
42029
  const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
41686
42030
  try {
41687
42031
  return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
@@ -41691,7 +42035,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
41691
42035
  }
41692
42036
  }, "openUnderBun");
41693
42037
 
41694
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-facts.js
42038
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-facts.js
41695
42039
  var PAYMENT_FACTS_TO_MOVE = "payment_facts_to_move";
41696
42040
  var paymentOf = /* @__PURE__ */ __name((metadata3) => {
41697
42041
  try {
@@ -41759,7 +42103,7 @@ var movePaymentFacts = /* @__PURE__ */ __name((context) => {
41759
42103
  });
41760
42104
  }, "movePaymentFacts");
41761
42105
 
41762
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
42106
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
41763
42107
  var readCompatibility = /* @__PURE__ */ __name((database, command) => {
41764
42108
  const ours = MIGRATIONS.at(-1)?.version ?? 0;
41765
42109
  if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
@@ -41777,7 +42121,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
41777
42121
  throw new CliError("configuration_error", `The store needs schema ${MIGRATIONS.at(-1)?.version ?? 0} maintenance before a read-only open`);
41778
42122
  }, "assertReadCompatible");
41779
42123
 
41780
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/suggested-links.js
42124
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/suggested-links.js
41781
42125
  var SUGGESTED_LINKS_TO_MOVE = "suggested_links_to_move";
41782
42126
  var proposerOf2 = /* @__PURE__ */ __name((provenance2) => {
41783
42127
  if (provenance2?.startsWith("rule:"))
@@ -41823,7 +42167,7 @@ var moveSuggestedLinks = /* @__PURE__ */ __name((database, now2) => {
41823
42167
  });
41824
42168
  }, "moveSuggestedLinks");
41825
42169
 
41826
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/test-accounts.js
42170
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/test-accounts.js
41827
42171
  var TEST_ACCOUNTS_TO_PURGE = "test_accounts_to_purge";
41828
42172
  var TEST_PROVIDER = "chat";
41829
42173
  var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
@@ -41844,7 +42188,7 @@ var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
41844
42188
  }
41845
42189
  }, "purgeTestAccounts");
41846
42190
 
41847
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
42191
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
41848
42192
  var BACKFILL_ON_OPEN = 5e3;
41849
42193
  var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
41850
42194
  var createWritable = /* @__PURE__ */ __name((file) => {
@@ -41942,7 +42286,7 @@ var openStoreContext = /* @__PURE__ */ __name(async (options = {}) => {
41942
42286
  }
41943
42287
  }, "openStoreContext");
41944
42288
 
41945
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/products.js
42289
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/products.js
41946
42290
  var PRODUCTS = "SELECT c.*, b.name AS author_name, b.kind AS author_kind FROM catalog_items c LEFT JOIN bots b ON c.author_type = 'bot' AND b.id = c.author_id";
41947
42291
  var productOperationsOver = /* @__PURE__ */ __name((context) => {
41948
42292
  const { database, now: now2 } = context;
@@ -42048,13 +42392,13 @@ var productsStoreOver = /* @__PURE__ */ __name((context) => {
42048
42392
  };
42049
42393
  }, "productsStoreOver");
42050
42394
 
42051
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
42395
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
42052
42396
  import { createHash as createHash19 } from "node:crypto";
42053
42397
 
42054
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
42398
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
42055
42399
  import { createHash as createHash18 } from "node:crypto";
42056
42400
 
42057
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
42401
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
42058
42402
  var text4 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
42059
42403
  var ref = text4(2048);
42060
42404
  var timestamp2 = pipe(number(), safeInteger(), minValue(0));
@@ -42124,7 +42468,7 @@ var projectAnnotationsSchema = strictObject({
42124
42468
  }))
42125
42469
  });
42126
42470
 
42127
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
42471
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
42128
42472
  var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
42129
42473
  var invalid7 = /* @__PURE__ */ __name((field4) => {
42130
42474
  throw new CliError("validation_error", `invalid project annotations.${field4}`);
@@ -42257,7 +42601,7 @@ var projectAnnotationsFingerprint = /* @__PURE__ */ __name((json3) => {
42257
42601
  return createHash18("sha256").update(JSON.stringify(normalized)).digest("hex");
42258
42602
  }, "projectAnnotationsFingerprint");
42259
42603
 
42260
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
42604
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
42261
42605
  var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
42262
42606
  var ref2 = pipe(string(), minLength(1), maxLength(2048));
42263
42607
  var targetSchema = strictObject({
@@ -42364,7 +42708,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
42364
42708
  }, "planBoundProjectAnnotations");
42365
42709
  var planProjectAnnotations = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotations(json3), projectAnnotationsFingerprint(json3), target, bindings), "planProjectAnnotations");
42366
42710
 
42367
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
42711
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
42368
42712
  import { createHash as createHash20 } from "node:crypto";
42369
42713
  var text5 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
42370
42714
  var timestamp3 = pipe(number(), safeInteger(), minValue(0));
@@ -42458,7 +42802,7 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
42458
42802
  })).digest("hex");
42459
42803
  }, "projectAnnotationSnapshotFingerprint");
42460
42804
 
42461
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
42805
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
42462
42806
  var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
42463
42807
  if (!request || typeof request !== "object" || Array.isArray(request))
42464
42808
  throw new CliError("validation_error", "project annotation request is required");
@@ -42475,7 +42819,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
42475
42819
  return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
42476
42820
  }, "projectAnnotationRequest");
42477
42821
 
42478
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
42822
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
42479
42823
  var SnapshotBudget = class {
42480
42824
  static {
42481
42825
  __name(this, "SnapshotBudget");
@@ -42501,13 +42845,13 @@ var SnapshotBudget = class {
42501
42845
  }
42502
42846
  };
42503
42847
 
42504
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
42848
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
42505
42849
  import { createHash as createHash22 } from "node:crypto";
42506
42850
 
42507
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
42851
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
42508
42852
  var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
42509
42853
 
42510
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
42854
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
42511
42855
  import { createHash as createHash21 } from "node:crypto";
42512
42856
  var invalid9 = /* @__PURE__ */ __name(() => {
42513
42857
  throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
@@ -42650,7 +42994,7 @@ var ProjectSnapshotSources = class {
42650
42994
  }
42651
42995
  };
42652
42996
 
42653
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
42997
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
42654
42998
  var unsupported = /* @__PURE__ */ __name(() => {
42655
42999
  throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
42656
43000
  }, "unsupported");
@@ -42828,7 +43172,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, bu
42828
43172
  return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
42829
43173
  }), "projectAnnotationSnapshot");
42830
43174
 
42831
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
43175
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
42832
43176
  var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, manifest, bindings, budget) => read(database, () => {
42833
43177
  const current = projectAnnotationSnapshot(database, projectId2, budget).snapshot;
42834
43178
  const sources = new ProjectSnapshotSources(database, budget);
@@ -42890,7 +43234,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, ma
42890
43234
  };
42891
43235
  }), "previewAnnotationSnapshot");
42892
43236
 
42893
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
43237
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
42894
43238
  var metadataOf2 = /* @__PURE__ */ __name((database, link3, to) => {
42895
43239
  const provenance2 = link3.provenance === null ? {} : { provenance: link3.provenance };
42896
43240
  if (link3.kind === "evidence" && to)
@@ -42957,7 +43301,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, sna
42957
43301
  return mappings;
42958
43302
  }, "restoreAnnotationRecords");
42959
43303
 
42960
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
43304
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
42961
43305
  var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
42962
43306
  async preview(request) {
42963
43307
  const { snapshot: snapshot2, projectId: projectId2 } = projectAnnotationRequest(request);
@@ -42987,7 +43331,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
42987
43331
  }
42988
43332
  }), "projectAnnotationStoreOver");
42989
43333
 
42990
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projection.js
43334
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projection.js
42991
43335
  var IMPORTER = { bot: "import" };
42992
43336
  var importersProposal = /* @__PURE__ */ __name((entity) => entity.review === "proposed" && entity.author.type === "bot" && entity.author.name === IMPORTER.bot, "importersProposal");
42993
43337
  var codeOf = /* @__PURE__ */ __name((error) => {
@@ -43032,7 +43376,7 @@ var moneyLinesOf = /* @__PURE__ */ __name((projection, list2) => (Array.isArray(
43032
43376
  };
43033
43377
  }), "moneyLinesOf");
43034
43378
 
43035
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/record-relations.js
43379
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-relations.js
43036
43380
  var isDerived = /* @__PURE__ */ __name((role) => role.startsWith("fields."), "isDerived");
43037
43381
  var recordRelationsOver = /* @__PURE__ */ __name(({ database }) => {
43038
43382
  const sql2 = /* @__PURE__ */ __name((text6) => database.prepare(text6), "sql");
@@ -43103,7 +43447,7 @@ var recordRelationsOver = /* @__PURE__ */ __name(({ database }) => {
43103
43447
  return { entityRef, relatedOf, storedRelations, relate, missingOf };
43104
43448
  }, "recordRelationsOver");
43105
43449
 
43106
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/record-remap.js
43450
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-remap.js
43107
43451
  var recordRemapOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
43108
43452
  const pointedAt = /* @__PURE__ */ __name((type, id2) => {
43109
43453
  for (const { table, pointer } of pointerPairs(database))
@@ -43157,7 +43501,7 @@ var recordRemapOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
43157
43501
  return { pointedAt, remap };
43158
43502
  }, "recordRemapOver");
43159
43503
 
43160
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/record-run.js
43504
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-run.js
43161
43505
  var runs = 0;
43162
43506
  var PAGE = 500;
43163
43507
  var recordRunOver = /* @__PURE__ */ __name((context, writes) => {
@@ -43317,7 +43661,7 @@ var waitingPointer = /* @__PURE__ */ __name((index2, missing4) => {
43317
43661
  return pointerOf("records", index2, "fields", key2);
43318
43662
  }, "waitingPointer");
43319
43663
 
43320
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/record-matching.js
43664
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-matching.js
43321
43665
  var valuesOf = /* @__PURE__ */ __name((value) => (Array.isArray(value) ? value : [value]).filter((one2) => typeof one2 === "string"), "valuesOf");
43322
43666
  var SCHEME = /^(email|domain|tax-id:[a-z]{2}|registration:[a-z]{2})$/;
43323
43667
  var ORG_EMAIL = "org-email";
@@ -43429,7 +43773,7 @@ var matchOf = /* @__PURE__ */ __name((context, type, ids) => {
43429
43773
  return { outcome: "ambiguous", ids: found2, reason: "record.separated" };
43430
43774
  return { outcome: "one", id: id2 };
43431
43775
  }, "matchOf");
43432
- var IMPORT = "import";
43776
+ var IMPORT2 = "import";
43433
43777
  var importedIdentity = /* @__PURE__ */ __name(({ database, now: now2 }, identity) => {
43434
43778
  const held = database.prepare("SELECT id FROM identities WHERE provider = ? AND external_id = ?").get(identity.provider, identity.externalId);
43435
43779
  if (held)
@@ -43444,8 +43788,8 @@ var linkToPerson = /* @__PURE__ */ __name((context, person2, identity, source2)
43444
43788
  if (identitySeparated(context, identity, person2))
43445
43789
  return;
43446
43790
  const at = now2();
43447
- database.prepare("INSERT INTO identity_links (identity_id, person_id, method, confidence, created_at, author, source, updated_at) VALUES (?, ?, ?, 1, ?, ?, ?, ?)").run(identity, person2, IMPORT, at, IMPORT, `import:${source2.provider}`, at);
43448
- database.prepare("INSERT INTO identity_link_events (identity_id, from_person_id, to_person_id, method, created_at, author) VALUES (?, NULL, ?, ?, ?, ?)").run(identity, person2, IMPORT, at, IMPORT);
43791
+ database.prepare("INSERT INTO identity_links (identity_id, person_id, method, confidence, created_at, author, source, updated_at) VALUES (?, ?, ?, 1, ?, ?, ?, ?)").run(identity, person2, IMPORT2, at, IMPORT2, `import:${source2.provider}`, at);
43792
+ database.prepare("INSERT INTO identity_link_events (identity_id, from_person_id, to_person_id, method, created_at, author) VALUES (?, NULL, ?, ?, ?, ?)").run(identity, person2, IMPORT2, at, IMPORT2);
43449
43793
  }, "linkToPerson");
43450
43794
  var addIdentifiers = /* @__PURE__ */ __name((context, type, id2, ids, name, source2) => {
43451
43795
  const { database, now: now2 } = context;
@@ -43463,7 +43807,7 @@ var addIdentifiers = /* @__PURE__ */ __name((context, type, id2, ids, name, sour
43463
43807
  for (const { provider, value } of ids.organization) {
43464
43808
  const identity = importedIdentity(context, { provider, externalId: value, name });
43465
43809
  const at = now2();
43466
- database.prepare("INSERT OR IGNORE INTO organization_identities (identity_id, organization_id, method, author, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)").run(identity, id2, IMPORT, IMPORT, at, at);
43810
+ database.prepare("INSERT OR IGNORE INTO organization_identities (identity_id, organization_id, method, author, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)").run(identity, id2, IMPORT2, IMPORT2, at, at);
43467
43811
  }
43468
43812
  }, "addIdentifiers");
43469
43813
  var createEntity = /* @__PURE__ */ __name((context, type, fields4, ids, related, source2, externalId) => {
@@ -43505,7 +43849,7 @@ var renameMade = /* @__PURE__ */ __name(({ database, now: now2 }, type, id2, nam
43505
43849
  ]);
43506
43850
  }, "renameMade");
43507
43851
 
43508
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-direct.js
43852
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-direct.js
43509
43853
  var productFields = /* @__PURE__ */ __name((fields4) => ({
43510
43854
  name: given(fields4, "name"),
43511
43855
  unit: given(fields4, "unit"),
@@ -43628,7 +43972,7 @@ var DIRECT_PROJECTORS = {
43628
43972
  lead: dealProjector("lead")
43629
43973
  };
43630
43974
 
43631
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-money.js
43975
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-money.js
43632
43976
  var allocatedByOthers = /* @__PURE__ */ __name((context, paymentId) => {
43633
43977
  const importer = authorActor(context, IMPORTER).actor;
43634
43978
  return context.database.prepare("SELECT 1 FROM payment_allocations WHERE payment_id = ? AND NOT (author_type = ? AND author_id = ?) LIMIT 1").get(paymentId, importer.type, importer.id) !== void 0;
@@ -43838,7 +44182,7 @@ var MONEY_PROJECTORS = {
43838
44182
  }
43839
44183
  };
43840
44184
 
43841
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-phone.js
44185
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-phone.js
43842
44186
  var CALLS_CALENDAR = "calls";
43843
44187
  var importOnly = /* @__PURE__ */ __name((source2, type) => {
43844
44188
  if (!isImportedProvider(source2.provider))
@@ -44013,7 +44357,7 @@ var PHONE_PROJECTORS = {
44013
44357
  }
44014
44358
  };
44015
44359
 
44016
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors.js
44360
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors.js
44017
44361
  var RECORD_PROJECTORS = {
44018
44362
  ...MONEY_PROJECTORS,
44019
44363
  ...DIRECT_PROJECTORS,
@@ -44023,7 +44367,7 @@ var RECORD_PROJECTORS = {
44023
44367
  project: null
44024
44368
  };
44025
44369
 
44026
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/record-settling.js
44370
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-settling.js
44027
44371
  var recordSettlingOver = /* @__PURE__ */ __name(({ database }, finance) => {
44028
44372
  const sql2 = /* @__PURE__ */ __name((text6) => database.prepare(text6), "sql");
44029
44373
  const freeOn = /* @__PURE__ */ __name((invoice, payment) => {
@@ -44085,7 +44429,7 @@ var recordSettlingOver = /* @__PURE__ */ __name(({ database }, finance) => {
44085
44429
  return { settle, checkShares };
44086
44430
  }, "recordSettlingOver");
44087
44431
 
44088
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/record-stamps.js
44432
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-stamps.js
44089
44433
  import { createHash as createHash23 } from "node:crypto";
44090
44434
  var VOLATILE = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "metadata"]);
44091
44435
  var content = /* @__PURE__ */ __name((row2) => row2 === void 0 ? null : Object.fromEntries(Object.entries(row2).filter(([column2]) => !VOLATILE.has(column2))), "content");
@@ -44101,7 +44445,7 @@ var importStampsOver = /* @__PURE__ */ __name(({ database }) => {
44101
44445
  return { stamp, untouched };
44102
44446
  }, "importStampsOver");
44103
44447
 
44104
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/subscriptions.js
44448
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/subscriptions.js
44105
44449
  var SUBSCRIPTIONS = "SELECT s.*, b.name AS author_name, b.kind AS author_kind FROM subscriptions s LEFT JOIN bots b ON s.author_type = 'bot' AND b.id = s.author_id";
44106
44450
  var PRICES = "SELECT p.*, b.name AS author_name, b.kind AS author_kind FROM subscription_prices p LEFT JOIN bots b ON p.author_type = 'bot' AND b.id = p.author_id";
44107
44451
  var PRICE_REF = /^subscription_price:([1-9]\d{0,15})$/;
@@ -44199,9 +44543,9 @@ var subscriptionOperationsOver = /* @__PURE__ */ __name((context) => {
44199
44543
  if (settled === "cancelled" && cancelled3 === null)
44200
44544
  refuse("a cancelled subscription has the day it was cancelled", "subscription.field");
44201
44545
  const owner = ownerPerson(database);
44202
- const party2 = /* @__PURE__ */ __name((given2, type, id2, ownerSide, what) => given2 !== void 0 ? partyThing(given2, what) : base[type] != null ? { type: String(base[type]), id: Number(base[id2]) } : ownerSide ? owner : refuse("a subscription names its supplier and its customer, a person: or organization:", "subscription.field"), "party");
44203
- const supplier = party2(fields4.supplier, "supplier_type", "supplier_id", direction === "receivable", "the supplier");
44204
- const customer = party2(fields4.customer, "customer_type", "customer_id", direction === "payable", "the customer");
44546
+ const party3 = /* @__PURE__ */ __name((given2, type, id2, ownerSide, what) => given2 !== void 0 ? partyThing(given2, what) : base[type] != null ? { type: String(base[type]), id: Number(base[id2]) } : ownerSide ? owner : refuse("a subscription names its supplier and its customer, a person: or organization:", "subscription.field"), "party");
44547
+ const supplier = party3(fields4.supplier, "supplier_type", "supplier_id", direction === "receivable", "the supplier");
44548
+ const customer = party3(fields4.customer, "customer_type", "customer_id", direction === "payable", "the customer");
44205
44549
  const linked = /* @__PURE__ */ __name((given2, type, column2) => given2 === void 0 ? base[column2] ?? null : given2 === null ? null : linkedId(given2, type, "subscription.ref"), "linked");
44206
44550
  const product = linked(fields4.product, "product", "catalog_item_id");
44207
44551
  const productName = product === null ? null : String(database.prepare("SELECT name FROM catalog_items WHERE id = ?").get(product)?.name);
@@ -44332,7 +44676,7 @@ var subscriptionsStoreOver = /* @__PURE__ */ __name((context) => {
44332
44676
  };
44333
44677
  }, "subscriptionsStoreOver");
44334
44678
 
44335
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/wallets.js
44679
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/wallets.js
44336
44680
  var WALLETS = "SELECT w.*, b.name AS author_name, b.kind AS author_kind FROM financial_accounts w LEFT JOIN bots b ON w.author_type = 'bot' AND b.id = w.author_id";
44337
44681
  var SIGNED = "CASE t.direction WHEN 'in' THEN t.amount ELSE -t.amount END";
44338
44682
  var walletOperationsOver = /* @__PURE__ */ __name((context) => {
@@ -44454,7 +44798,7 @@ var walletsStoreOver = /* @__PURE__ */ __name((context) => {
44454
44798
  };
44455
44799
  }, "walletsStoreOver");
44456
44800
 
44457
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/record-writes.js
44801
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-writes.js
44458
44802
  var specOf = /* @__PURE__ */ __name((type) => RECORD_TYPES[type], "specOf");
44459
44803
  var unsettled = /* @__PURE__ */ __name((fields4, relations) => recordFingerprint(fields4, relations.filter((relation) => !AMOUNT_ROLES.includes(relation.role))), "unsettled");
44460
44804
  var tableOf2 = /* @__PURE__ */ __name((type) => typeof type === "string" && Object.hasOwn(DECIDED_TABLES, type) ? DECIDED_TABLES[type] : void 0, "tableOf");
@@ -44711,9 +45055,13 @@ var recordWritesOver = /* @__PURE__ */ __name((context) => {
44711
45055
  return { writeOne, project: project2, completeDependents, entityRef, missingOf: relations.missingOf };
44712
45056
  }, "recordWritesOver");
44713
45057
 
44714
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
45058
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
44715
45059
  var LIMIT = 1e3;
44716
45060
  var iso15 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
45061
+ var checkLimit = /* @__PURE__ */ __name((limit) => {
45062
+ if (!Number.isSafeInteger(limit) || limit < 1 || limit > 500)
45063
+ throw new CliError("validation_error", "a record list takes 1\u2013500 items");
45064
+ }, "checkLimit");
44717
45065
  var IDENTITY_SQL = IDENTITY_TYPES.map((type) => `'${type}'`).join(", ");
44718
45066
  var recordStoreOver = /* @__PURE__ */ __name((context) => {
44719
45067
  const { database } = context;
@@ -44769,16 +45117,67 @@ var recordStoreOver = /* @__PURE__ */ __name((context) => {
44769
45117
  const row2 = rowOf2(key2);
44770
45118
  return row2 ? sourceRecordOf(row2) : void 0;
44771
45119
  }), "get"),
44772
- list: /* @__PURE__ */ __name(async ({ provider, account, type, waiting, unmatched, flagged, limit = 100 }) => {
44773
- if (!Number.isSafeInteger(limit) || limit < 1 || limit > 500)
44774
- throw new CliError("validation_error", "a record list takes 1\u2013500 items");
45120
+ list: /* @__PURE__ */ __name(async ({ provider, account, type, waiting, unmatched, flagged, entity, batch, deleted, limit = 100 }) => {
45121
+ checkLimit(limit);
44775
45122
  return read(database, () => {
44776
- if (findAccountPk(context, { provider, account }) === void 0)
45123
+ const accountId = findAccountPk(context, { provider, account });
45124
+ if (accountId === void 0)
44777
45125
  return [];
44778
- const rows = database.prepare(`${SELECT2}WHERE a.provider = ? AND a.external_id = ? AND (? IS NULL OR r.type = ?) AND (? IS NULL OR (r.entity_id IS NULL AND r.deleted_at IS NULL AND r.type NOT LIKE 'custom:%' AND r.type NOT IN (${IDENTITY_SQL}))) AND (? IS NULL OR (r.entity_id IS NULL AND r.deleted_at IS NULL AND r.type IN (${IDENTITY_SQL}))) AND (? IS NULL OR (r.entity_id IS NOT NULL AND (r.deleted_at IS NOT NULL OR r.projected_fingerprint IS NOT r.fingerprint))) ORDER BY r.updated_at DESC, r.id DESC LIMIT ?`).all(provider, account, type ?? null, type ?? null, waiting ? 1 : null, unmatched ? 1 : null, flagged ? 1 : null, limit);
44779
- return rows.map(sourceRecordOf);
45126
+ const where = ["r.account_id = ?"];
45127
+ const params = [accountId];
45128
+ const and2 = /* @__PURE__ */ __name((condition, ...values) => {
45129
+ where.push(condition);
45130
+ for (const value of values)
45131
+ params.push(value);
45132
+ }, "and");
45133
+ if (type !== void 0)
45134
+ and2("r.type = ?", type);
45135
+ if (waiting)
45136
+ and2(`r.entity_id IS NULL AND r.deleted_at IS NULL AND r.type NOT LIKE 'custom:%' AND r.type NOT IN (${IDENTITY_SQL})`);
45137
+ if (unmatched)
45138
+ and2(`r.entity_id IS NULL AND r.deleted_at IS NULL AND r.type IN (${IDENTITY_SQL})`);
45139
+ if (flagged)
45140
+ and2("r.entity_id IS NOT NULL AND (r.deleted_at IS NOT NULL OR r.projected_fingerprint IS NOT r.fingerprint)");
45141
+ if (entity !== void 0) {
45142
+ const thing = requiredThing(database, entity, "the entity");
45143
+ and2("r.entity_type = ? AND r.entity_id = ?", thing.type, thing.id);
45144
+ }
45145
+ if (batch !== void 0)
45146
+ and2("r.batch_id = ?", batch);
45147
+ if (deleted !== void 0)
45148
+ and2(`r.deleted_at IS ${deleted ? "NOT " : ""}NULL`);
45149
+ return database.prepare(`${SELECT2}WHERE ${where.join(" AND ")} ORDER BY r.updated_at DESC, r.id DESC LIMIT ?`).all(...params, limit).map(sourceRecordOf);
44780
45150
  });
44781
45151
  }, "list"),
45152
+ incoming: /* @__PURE__ */ __name(async (target, { limit = 100 } = {}) => {
45153
+ checkLimit(limit);
45154
+ return read(database, () => {
45155
+ let pointing;
45156
+ if ("externalId" in target) {
45157
+ const row2 = rowOf2(target);
45158
+ if (!row2)
45159
+ return [];
45160
+ pointing = { sql: "SELECT id FROM record_relations WHERE target_id = ?", params: [Number(row2.id)] };
45161
+ } else {
45162
+ const thing = requiredThing(database, target.entity, "the entity");
45163
+ pointing = {
45164
+ sql: "SELECT id FROM record_relations WHERE target_type = ? AND target_external_id = ? UNION SELECT rr.id FROM record_relations rr JOIN records t ON t.id = rr.target_id WHERE t.entity_type = ? AND t.entity_id = ?",
45165
+ params: ["ref", `${thing.type}:${thing.id}`, thing.type, thing.id]
45166
+ };
45167
+ }
45168
+ return database.prepare(`SELECT rr.role, rr.as_role, rr.amount, r.type, r.external_id, a.provider, a.external_id AS account FROM record_relations rr JOIN records r ON r.id = rr.record_id JOIN accounts a ON a.id = r.account_id WHERE rr.id IN (${pointing.sql}) AND r.deleted_at IS NULL AND rr.role NOT LIKE 'fields.%' ORDER BY rr.id LIMIT ?`).all(...pointing.params, limit).map((row2) => ({
45169
+ record: {
45170
+ provider: String(row2.provider),
45171
+ account: String(row2.account),
45172
+ type: String(row2.type),
45173
+ externalId: String(row2.external_id)
45174
+ },
45175
+ role: String(row2.role),
45176
+ as: row2.as_role == null ? null : String(row2.as_role),
45177
+ amount: row2.amount == null ? null : String(row2.amount)
45178
+ }));
45179
+ });
45180
+ }, "incoming"),
44782
45181
  map: /* @__PURE__ */ __name(async (key2, entity, by) => {
44783
45182
  if (by !== "owner")
44784
45183
  throw new CliError("permission_error", "only the owner says which entity a record is", {
@@ -44861,7 +45260,7 @@ var recordStoreOver = /* @__PURE__ */ __name((context) => {
44861
45260
  };
44862
45261
  }, "recordStoreOver");
44863
45262
 
44864
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/store-errors.js
45263
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/store-errors.js
44865
45264
  var refusalOf = /* @__PURE__ */ __name((error) => error instanceof Error && error.name === "DrizzleQueryError" && error.cause instanceof CliError ? error.cause : error, "refusalOf");
44866
45265
  var wrapped = /* @__PURE__ */ new WeakMap();
44867
45266
  var storeErrors = /* @__PURE__ */ __name((area) => {
@@ -44896,7 +45295,7 @@ var storeErrors = /* @__PURE__ */ __name((area) => {
44896
45295
  return proxy;
44897
45296
  }, "storeErrors");
44898
45297
 
44899
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
45298
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
44900
45299
  var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
44901
45300
  const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
44902
45301
  let merged = { from: from2, to };
@@ -44909,7 +45308,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
44909
45308
  }, "markRange");
44910
45309
  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");
44911
45310
 
44912
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/task-analysis-marks.js
45311
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-analysis-marks.js
44913
45312
  var prefixOf2 = /* @__PURE__ */ __name(({ provider, account }) => `task_analysis:${provider}:${account}:`, "prefixOf");
44914
45313
  var markOf = /* @__PURE__ */ __name((prefix, row2) => ({
44915
45314
  chatId: String(row2.key).slice(prefix.length),
@@ -44930,17 +45329,17 @@ var setTaskAnalysisMark = /* @__PURE__ */ __name((database, account, { chatId, c
44930
45329
  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);
44931
45330
  }, "setTaskAnalysisMark");
44932
45331
 
44933
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
44934
- var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
45332
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
45333
+ var keyOf5 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
44935
45334
  var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
44936
- const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
45335
+ const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf5(account));
44937
45336
  return row2 ? JSON.parse(String(row2.value)) : null;
44938
45337
  }, "taskRulesStop");
44939
45338
  var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) => {
44940
- 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);
45339
+ database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(keyOf5(account), JSON.stringify(until), now2);
44941
45340
  }, "setTaskRulesStop");
44942
45341
 
44943
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sync.js
45342
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sync.js
44944
45343
  var syncStoreOver = /* @__PURE__ */ __name((context) => {
44945
45344
  const { database } = context;
44946
45345
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
@@ -44999,7 +45398,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
44999
45398
  };
45000
45399
  }, "syncStoreOver");
45001
45400
 
45002
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/tags.js
45401
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/tags.js
45003
45402
  var tagsStoreOver = /* @__PURE__ */ __name((context) => {
45004
45403
  const { database } = context;
45005
45404
  return {
@@ -45021,7 +45420,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
45021
45420
  };
45022
45421
  }, "tagsStoreOver");
45023
45422
 
45024
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
45423
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
45025
45424
  var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
45026
45425
  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
45027
45426
  WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
@@ -45148,7 +45547,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
45148
45547
  dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
45149
45548
  }, "savePictureChunks");
45150
45549
 
45151
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
45550
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
45152
45551
  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,
45153
45552
  EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
45154
45553
  FROM messages m
@@ -45237,7 +45636,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
45237
45636
  return plain2(best(found2));
45238
45637
  }, "nearestMessages");
45239
45638
 
45240
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/vectors.js
45639
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/vectors.js
45241
45640
  var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
45242
45641
  const { database } = context;
45243
45642
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -45492,10 +45891,11 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
45492
45891
  saveVectors: /* @__PURE__ */ __name(async (model, dims, rows) => {
45493
45892
  write(context.database, () => saveVectors(context, model, dims, rows));
45494
45893
  }, "saveVectors"),
45495
- embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
45894
+ embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes"),
45895
+ vectorCounts: /* @__PURE__ */ __name(async (models) => vectorCounts(context, models), "vectorCounts")
45496
45896
  }), "vectorsStoreOver");
45497
45897
 
45498
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
45898
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
45499
45899
  import { existsSync as existsSync2, readFileSync as readFileSync4 } from "node:fs";
45500
45900
  import { dirname as dirname3, join as join3 } from "node:path";
45501
45901
  var BOOKKEEPING2 = ["schema_migrations", "store_settings"];
@@ -45583,10 +45983,40 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
45583
45983
  }
45584
45984
  }, "lastBackup");
45585
45985
 
45586
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/providers.js
45986
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/providers.js
45587
45987
  var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
45588
45988
 
45589
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
45989
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/owner-languages.js
45990
+ var KEY4 = "ownerLanguages";
45991
+ var ISO_639_1 = new Set("aa ab ae af ak am an ar as av ay az ba be bg bi bm bn bo br bs ca ce ch co cr cs cu cv cy da de dv dz ee el en eo es et eu fa ff fi fj fo fr fy ga gd gl gn gu gv ha he hi ho hr ht hu hy hz ia id ie ig ii ik io is it iu ja jv ka kg ki kj kk kl km kn ko kr ks ku kv kw ky la lb lg li ln lo lt lu lv mg mh mi mk ml mn mr ms mt my na nb nd ne ng nl nn no nr nv ny oc oj om or os pa pi pl ps pt qu rm rn ro ru rw sa sc sd se sg si sk sl sm sn so sq sr ss st su sv sw ta te tg th ti tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa wo xh yi yo za zh zu".split(" "));
45992
+ var DEFAULT_OWNER_LANGUAGES = ["ru"];
45993
+ var parseOwnerLanguages = /* @__PURE__ */ __name((value) => {
45994
+ const codes = value.split(/[\s,]+/).map((one2) => one2.trim().toLowerCase()).filter(Boolean);
45995
+ const unknown2 = codes.filter((one2) => !ISO_639_1.has(one2));
45996
+ if (codes.length === 0 || unknown2.length > 0)
45997
+ throw new CliError("validation_error", `owner_languages takes ISO 639-1 language codes, the language the owner reads first first (ru,en) \u2014 ${unknown2.length > 0 ? `not ${unknown2.join(", ")}` : "at least one"}`);
45998
+ return [...new Set(codes)];
45999
+ }, "parseOwnerLanguages");
46000
+ var savedOwnerLanguages = /* @__PURE__ */ __name((database) => {
46001
+ const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(KEY4);
46002
+ if (!row2)
46003
+ return void 0;
46004
+ try {
46005
+ return parseOwnerLanguages(JSON.parse(String(row2.value)).join(","));
46006
+ } catch {
46007
+ return void 0;
46008
+ }
46009
+ }, "savedOwnerLanguages");
46010
+ var ownerLanguages = /* @__PURE__ */ __name((database) => savedOwnerLanguages(database) ?? DEFAULT_OWNER_LANGUAGES, "ownerLanguages");
46011
+ var saveOwnerLanguages = /* @__PURE__ */ __name((database, languages, now2) => {
46012
+ if (languages === void 0) {
46013
+ database.prepare("DELETE FROM store_settings WHERE key = ?").run(KEY4);
46014
+ return;
46015
+ }
46016
+ database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(KEY4, JSON.stringify(languages), now2);
46017
+ }, "saveOwnerLanguages");
46018
+
46019
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
45590
46020
  var COUNTED_TABLES = [
45591
46021
  "accounts",
45592
46022
  "chats",
@@ -45671,7 +46101,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
45671
46101
  };
45672
46102
  }, "storeContents");
45673
46103
 
45674
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/store.js
46104
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_af5f2db22f61976c09fb28de9c7dc33e/node_modules/@wirecat/cli-core/dist/store/store.js
45675
46105
  var openStore = /* @__PURE__ */ __name(async (options = {}) => {
45676
46106
  const context = await openStoreContext(options);
45677
46107
  try {
@@ -45728,9 +46158,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
45728
46158
  const meetingFindings = once3(() => meetingFindingsStoreOver(context));
45729
46159
  const evidenceFindings = once3(() => evidenceFindingsStoreOver(context));
45730
46160
  const mailFindings = once3(() => mailFindingsStoreOver(context));
45731
- const refs = {
45732
- summaries: /* @__PURE__ */ __name(async (texts2, options) => refSummariesOf(context.database, texts2, { ...options, now: context.now() }), "summaries")
45733
- };
46161
+ const refs = refsStoreOver(context);
45734
46162
  const facts2 = once3(() => factsStoreOver(context));
45735
46163
  const finance = once3(() => financeStoreOver(context));
45736
46164
  const orders2 = once3(() => ordersStoreOver(context));
@@ -45748,7 +46176,11 @@ var storeOver = /* @__PURE__ */ __name((context) => {
45748
46176
  const proposedActions2 = once3(() => proposedActionsStoreOver(context));
45749
46177
  const agentActions2 = once3(() => agentActionsStoreOver(context, pruneLogsWhenDue));
45750
46178
  const meetings2 = once3(() => meetingStoreOver(context));
46179
+ const enrichment = once3(() => enrichmentsOver(context));
45751
46180
  const store = {
46181
+ get enrichment() {
46182
+ return enrichment();
46183
+ },
45752
46184
  get projectAnnotations() {
45753
46185
  return projectAnnotations();
45754
46186
  },
@@ -45838,6 +46270,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
45838
46270
  return meetingFindings();
45839
46271
  },
45840
46272
  refs,
46273
+ business: businessSearchOver(context),
45841
46274
  get evidenceFindings() {
45842
46275
  return evidenceFindings();
45843
46276
  },
@@ -45971,6 +46404,7 @@ export {
45971
46404
  chunkTextOf,
45972
46405
  chunkHash,
45973
46406
  cutChunks,
46407
+ ENRICHMENT_SUBJECTS,
45974
46408
  queryFilter,
45975
46409
  CORPORA,
45976
46410
  fillTrigrams,
@@ -46042,6 +46476,7 @@ export {
46042
46476
  resetStems,
46043
46477
  ADDED_KINDS,
46044
46478
  addedSourceKeyOf,
46479
+ BUSINESS_FIND_MAX,
46045
46480
  CATALOG_QUERY,
46046
46481
  crmIdentityId,
46047
46482
  CRM_LINK_MODES,
@@ -46103,6 +46538,11 @@ export {
46103
46538
  readStoreTables,
46104
46539
  fileFacts,
46105
46540
  registerProvider2 as registerProvider,
46541
+ DEFAULT_OWNER_LANGUAGES,
46542
+ parseOwnerLanguages,
46543
+ savedOwnerLanguages,
46544
+ ownerLanguages,
46545
+ saveOwnerLanguages,
46106
46546
  rowCounts,
46107
46547
  storeContents,
46108
46548
  openStore