@wirecat/cli-memo 0.131.58 → 0.131.60

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 (115) hide show
  1. package/dist/bin/memo.js +2 -2
  2. package/dist/bundle/{all-profiles-XWRUFNP2.js → all-profiles-NUBT2FJI.js} +5 -5
  3. package/dist/bundle/{anthropic-266QJJGV.js → anthropic-QNTKWSQT.js} +3 -3
  4. package/dist/bundle/{app-server-YV3D7PPC.js → app-server-6TXXVCSE.js} +35 -35
  5. package/dist/bundle/auto-4VLWHDG7.js +86 -0
  6. package/dist/bundle/{bun-22MM6T54.js → bun-3NYKD7YB.js} +2 -2
  7. package/dist/bundle/{bun-sqlite-V73FFF2C.js → bun-sqlite-IIJSZ5I2.js} +2 -2
  8. package/dist/bundle/{chunk-DUBGCFRO.js → chunk-25N2ZCXV.js} +2 -2
  9. package/dist/bundle/{chunk-5T7BFCDJ.js → chunk-3M237SBK.js} +5 -5
  10. package/dist/bundle/{chunk-4K2ECEHT.js → chunk-4II6DM7L.js} +10 -10
  11. package/dist/bundle/{chunk-OROO3KYQ.js → chunk-4RSPI6OR.js} +1 -1
  12. package/dist/bundle/{chunk-IY7GB2SJ.js → chunk-4VAKZH56.js} +2 -2
  13. package/dist/bundle/{chunk-TB4IRRAC.js → chunk-636FK3A6.js} +1 -1
  14. package/dist/bundle/{chunk-CQPMBTB6.js → chunk-67CIUJO6.js} +1 -1
  15. package/dist/bundle/{chunk-NSYTJAL6.js → chunk-67L6BQOD.js} +4 -4
  16. package/dist/bundle/{chunk-RTROEIYE.js → chunk-6NYZ32K5.js} +2 -2
  17. package/dist/bundle/{chunk-XXOWA66S.js → chunk-AEATD5XH.js} +32 -21
  18. package/dist/bundle/{chunk-RYDNM3K2.js → chunk-B6R7O3U5.js} +1 -1
  19. package/dist/bundle/{chunk-NEWKSMXP.js → chunk-BYIKFYRY.js} +2 -2
  20. package/dist/bundle/{chunk-QLCPRKFK.js → chunk-BZZRBJ2C.js} +28 -28
  21. package/dist/bundle/{chunk-YTAQKOAW.js → chunk-CZPAYIQR.js} +1 -1
  22. package/dist/bundle/{chunk-DQWHLOKG.js → chunk-CZUMANL4.js} +4 -4
  23. package/dist/bundle/{chunk-PHWJBFZ6.js → chunk-DZKTPOTJ.js} +31 -31
  24. package/dist/bundle/{chunk-Z6RSOFHK.js → chunk-EMU7UIUA.js} +2 -2
  25. package/dist/bundle/{chunk-2CF2R7SA.js → chunk-FH56EHWA.js} +6 -6
  26. package/dist/bundle/{chunk-3R6YNDPC.js → chunk-FXXXBLZD.js} +5 -5
  27. package/dist/bundle/{chunk-RJWL3NEL.js → chunk-G6P5NWIZ.js} +1 -1
  28. package/dist/bundle/{chunk-PBVG3KJR.js → chunk-GGGIUXKD.js} +3 -3
  29. package/dist/bundle/{chunk-XIZPMFEC.js → chunk-GLPSPFTP.js} +4 -4
  30. package/dist/bundle/{chunk-FG7ZGEZ6.js → chunk-HF2W6622.js} +4 -4
  31. package/dist/bundle/{chunk-ONJNZ2RJ.js → chunk-IJKXX7LB.js} +1 -1
  32. package/dist/bundle/{chunk-NDCURVJS.js → chunk-KMA63WO5.js} +4 -4
  33. package/dist/bundle/{chunk-WKMLLL2F.js → chunk-KOBVPWMU.js} +49 -49
  34. package/dist/bundle/{chunk-BRT6M2TW.js → chunk-L3G5UY2P.js} +4 -4
  35. package/dist/bundle/{chunk-G3QR3IYN.js → chunk-LXQ56N66.js} +8 -8
  36. package/dist/bundle/{chunk-MV6ZSBA3.js → chunk-LZFQZOAL.js} +256 -256
  37. package/dist/bundle/{chunk-V4BKQWDS.js → chunk-LZQ7QENQ.js} +227 -187
  38. package/dist/bundle/{chunk-HVHUHYNF.js → chunk-MCPHBBJL.js} +1 -1
  39. package/dist/bundle/{chunk-D7FZIH5H.js → chunk-MV6M3VR3.js} +9 -9
  40. package/dist/bundle/{chunk-72ZEEKOJ.js → chunk-MYVP4IFW.js} +3 -3
  41. package/dist/bundle/{chunk-XLYMVYMU.js → chunk-ND2PQA4X.js} +22 -4
  42. package/dist/bundle/{chunk-N2TGYTKE.js → chunk-NMWIWQ7J.js} +1 -1
  43. package/dist/bundle/{chunk-BLCYVRW3.js → chunk-NSEX4YST.js} +7 -7
  44. package/dist/bundle/{chunk-L3GFAQFP.js → chunk-NX4XCS64.js} +21 -21
  45. package/dist/bundle/{chunk-EUE76Q4D.js → chunk-NXV3USUU.js} +3 -3
  46. package/dist/bundle/{chunk-XEQPZBIH.js → chunk-O55ELCFO.js} +1 -1
  47. package/dist/bundle/{chunk-3BWYMNWP.js → chunk-PMGGNQHL.js} +1 -1
  48. package/dist/bundle/{chunk-4XKHXETB.js → chunk-PNIAEDGJ.js} +726 -517
  49. package/dist/bundle/{chunk-F5DOQOCK.js → chunk-RC2NAT7T.js} +12 -12
  50. package/dist/bundle/{chunk-2LPPNYOZ.js → chunk-RU34XFKL.js} +1 -1
  51. package/dist/bundle/{chunk-GBOES7QS.js → chunk-S2VXXF4H.js} +2 -2
  52. package/dist/bundle/{chunk-VEDOHZEU.js → chunk-S56CC44R.js} +7 -7
  53. package/dist/bundle/{chunk-XC6OYACL.js → chunk-SSKSRETJ.js} +13 -9
  54. package/dist/bundle/{chunk-PE7RYCI4.js → chunk-SU2EPGGH.js} +12 -12
  55. package/dist/bundle/{chunk-ATEHG5O6.js → chunk-SYJMQIIJ.js} +2 -2
  56. package/dist/bundle/{chunk-FU3XDL34.js → chunk-TLZEAHCB.js} +5 -5
  57. package/dist/bundle/{chunk-5FYDQEM7.js → chunk-VGLDBSGN.js} +5 -5
  58. package/dist/bundle/{chunk-JYUNAC6P.js → chunk-VUJANY4X.js} +6 -6
  59. package/dist/bundle/{chunk-EQQIUVLP.js → chunk-WUOQ7CQU.js} +4 -4
  60. package/dist/bundle/{chunk-6WWF4RST.js → chunk-XBSLZQY4.js} +418 -359
  61. package/dist/bundle/{chunk-6FABO4WB.js → chunk-XW4NE2NW.js} +1 -1
  62. package/dist/bundle/{chunk-KZDKFYIF.js → chunk-XXZ3WQSW.js} +156 -151
  63. package/dist/bundle/{chunk-3N7LEJRT.js → chunk-YXBMP74S.js} +1 -1
  64. package/dist/bundle/{chunk-HJWWZXVG.js → chunk-Z3SASH3J.js} +1 -1
  65. package/dist/bundle/{command-contract-DKK56GZX.js → command-contract-KE77NBYG.js} +11 -11
  66. package/dist/bundle/{decode-JHVAOF3N.js → decode-AD352TI2.js} +2 -2
  67. package/dist/bundle/{echarts-KCOXA225.js → echarts-VCQEG6RB.js} +2 -2
  68. package/dist/bundle/{embed-4NYYOVNS.js → embed-A2YCI5TM.js} +3 -3
  69. package/dist/bundle/{embedder-SHPWEDIQ.js → embedder-G35OKUR5.js} +6 -6
  70. package/dist/bundle/{entry-VZE4CVPX.js → entry-3Y2C4AAL.js} +4 -4
  71. package/dist/bundle/failure-GHNN2IIX.js +66 -0
  72. package/dist/bundle/{first-run-EKXME7UK.js → first-run-RDQFQ5MD.js} +5 -5
  73. package/dist/bundle/{first-screen-QS5PVWDZ.js → first-screen-XWHL4AEK.js} +12 -12
  74. package/dist/bundle/{instructions-ER3ONEOR.js → instructions-VWX5TPRM.js} +1 -1
  75. package/dist/bundle/{mcp-3ABYEJI3.js → mcp-JHDRZPSO.js} +35 -35
  76. package/dist/bundle/memo.js +6 -6
  77. package/dist/bundle/{node-DBZKVPDA.js → node-OCRAUHTJ.js} +2 -2
  78. package/dist/bundle/{node-sqlite-UZVU7EXS.js → node-sqlite-UIZIEENG.js} +3 -3
  79. package/dist/bundle/{oauth-VEFHKRWG.js → oauth-WZOYRQA4.js} +4 -4
  80. package/dist/bundle/{open-XNRAMLOK.js → open-ITE5EG22.js} +2 -2
  81. package/dist/bundle/{openai-4XIX5RN2.js → openai-S4TD7H5G.js} +7 -7
  82. package/dist/bundle/{process-EIGF77RB.js → process-Z7OS65OQ.js} +1 -1
  83. package/dist/bundle/{program-OM6GO5X2.js → program-PYCRRMXK.js} +82 -60
  84. package/dist/bundle/{prompt-V7RFTWTA.js → prompt-NW2KOEQS.js} +4 -2
  85. package/dist/bundle/{recognize-7PWWI67V.js → recognize-65IM7MS4.js} +1 -1
  86. package/dist/bundle/{remote-NOKKQ2U5.js → remote-4EOO533Z.js} +4 -4
  87. package/dist/bundle/{rerank-X7UWX2ZF.js → rerank-LKRFHRN6.js} +4 -4
  88. package/dist/bundle/{serve-Z6YCLXXP.js → serve-SIB2TBOF.js} +6 -6
  89. package/dist/bundle/server-DO3J7CR5.js +48 -0
  90. package/dist/bundle/{server-KHFBSBCY.js → server-JZAL3SRH.js} +50 -50
  91. package/dist/bundle/server-NQLMHLMU.js +61 -0
  92. package/dist/bundle/{state-K5D3BMKT.js → state-245GTWCO.js} +3 -3
  93. package/dist/bundle/{store-6SZBCSUF.js → store-2QSJI77T.js} +14 -9
  94. package/dist/bundle/store-maintenance-command-F7FSHWHW.js +48 -0
  95. package/dist/bundle/update-NENHRNFS.js +69 -0
  96. package/dist/examples.js +1 -1
  97. package/dist/examples.js.map +1 -1
  98. package/dist/knowledge/relationships-scan.d.ts.map +1 -1
  99. package/dist/knowledge/relationships-scan.js +23 -2
  100. package/dist/knowledge/relationships-scan.js.map +1 -1
  101. package/dist/review/review.d.ts +1 -1
  102. package/dist/review/review.d.ts.map +1 -1
  103. package/dist/review/review.js +5 -0
  104. package/dist/review/review.js.map +1 -1
  105. package/dist/version.d.ts +1 -1
  106. package/dist/version.js +1 -1
  107. package/package.json +2 -2
  108. package/skills/cli-memo/topics/projects.md +1 -1
  109. package/dist/bundle/auto-3TXQDVO6.js +0 -86
  110. package/dist/bundle/failure-HKKLVEZA.js +0 -66
  111. package/dist/bundle/server-AXMJBL6J.js +0 -61
  112. package/dist/bundle/server-KABSY3RL.js +0 -48
  113. package/dist/bundle/store-maintenance-command-GTMZOLMZ.js +0 -48
  114. package/dist/bundle/update-DT4DCRXS.js +0 -69
  115. /package/dist/bundle/{chunk-SO2HNIPX.js → chunk-GK2FRFM6.js} +0 -0
@@ -1,7 +1,11 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
+ BUSINESS_KINDS,
5
+ CATALOG_KINDS,
4
6
  CHAT_MESSAGES_READ,
7
+ CONTRACT_KINDS,
8
+ CONTRACT_STATUSES,
5
9
  COUNTERPART_ROLE,
6
10
  DEAL_KINDS,
7
11
  DEAL_ROLES,
@@ -20,6 +24,7 @@ import {
20
24
  MONEY_DIRECTIONS,
21
25
  MeetingError,
22
26
  OPERATORS_BY_TYPE,
27
+ ORDER_DIRECTIONS,
23
28
  ORDER_PURPOSES,
24
29
  ORDER_STATUSES,
25
30
  PRIORITY_LABELS,
@@ -29,11 +34,14 @@ import {
29
34
  ROLE_LISTS,
30
35
  STAGE_OUTCOMES,
31
36
  STANDINGS,
37
+ SUBSCRIPTION_STATUSES,
32
38
  TASK_KINDS,
33
39
  TASK_ORIGINS,
34
40
  TASK_STATES,
35
41
  TASK_TYPES,
36
42
  TASK_VERDICTS,
43
+ TRANSACTION_STATUSES,
44
+ WALLET_KINDS,
37
45
  WORK_TASK_TYPES,
38
46
  aggregateMeetingCounts,
39
47
  aggregateMeetingStats,
@@ -42,10 +50,10 @@ import {
42
50
  checkEnds,
43
51
  checkRole,
44
52
  checkedScore,
53
+ contractLine,
45
54
  currencyOf,
46
55
  dateRange,
47
56
  dayBoundary,
48
- dayMonth,
49
57
  dealLine,
50
58
  defineQuery,
51
59
  entryInWindow,
@@ -59,6 +67,7 @@ import {
59
67
  findingText,
60
68
  formatDecimal,
61
69
  formatMeetingReference,
70
+ intervalOf,
62
71
  inverseOf,
63
72
  invoiceLine,
64
73
  invoiceTitle,
@@ -80,7 +89,6 @@ import {
80
89
  normalizeMeetingParticipantQuery,
81
90
  normalizeTag,
82
91
  notOverriddenSql,
83
- notes,
84
92
  orderLine,
85
93
  orderTitle,
86
94
  organization,
@@ -93,6 +101,7 @@ import {
93
101
  paymentTitle,
94
102
  priorityBand,
95
103
  priorityLabel,
104
+ productLine,
96
105
  project,
97
106
  quantityOf,
98
107
  queryAstSchema,
@@ -107,8 +116,10 @@ import {
107
116
  signedMinorUnits,
108
117
  snakeCase,
109
118
  standingOf,
119
+ subscriptionLine,
110
120
  tagOf,
111
121
  timezoneOf,
122
+ transactionLine,
112
123
  transcriptLanguage,
113
124
  usableLinkSql,
114
125
  validEvidence,
@@ -123,13 +134,14 @@ import {
123
134
  validatePayment,
124
135
  validateQuery,
125
136
  walkQuery,
137
+ walletLine,
126
138
  zonedMoment
127
- } from "./chunk-V4BKQWDS.js";
139
+ } from "./chunk-LZQ7QENQ.js";
128
140
  import {
129
141
  holdsCredential,
130
142
  secretNamed,
131
143
  sqliteCode
132
- } from "./chunk-IY7GB2SJ.js";
144
+ } from "./chunk-4VAKZH56.js";
133
145
  import {
134
146
  DEFAULT_STEMMERS,
135
147
  DEFAULT_STEMMERS_VERSION,
@@ -142,27 +154,27 @@ import {
142
154
  fold,
143
155
  normalize,
144
156
  parseStemmers
145
- } from "./chunk-VEDOHZEU.js";
157
+ } from "./chunk-S56CC44R.js";
146
158
  import {
147
159
  DEFAULT_TASK_CATEGORIES,
148
160
  sharedConfigPath,
149
161
  storedTaskCategories,
150
162
  taskCategoriesReader
151
- } from "./chunk-NDCURVJS.js";
163
+ } from "./chunk-KMA63WO5.js";
152
164
  import {
153
165
  refuseOwnerStoreInTests,
154
166
  storePath
155
- } from "./chunk-OROO3KYQ.js";
167
+ } from "./chunk-4RSPI6OR.js";
156
168
  import {
157
169
  quietSqliteWarning,
158
170
  storeCapable
159
- } from "./chunk-5FYDQEM7.js";
171
+ } from "./chunk-VGLDBSGN.js";
160
172
  import {
161
173
  PRAGMAS,
162
174
  TIME_LIMIT_FUNCTION,
163
175
  TimeLimitReached,
164
176
  isQueryOnly
165
- } from "./chunk-N2TGYTKE.js";
177
+ } from "./chunk-NMWIWQ7J.js";
166
178
  import {
167
179
  array,
168
180
  boolean,
@@ -213,7 +225,7 @@ import {
213
225
  sql,
214
226
  sqliteTable,
215
227
  text
216
- } from "./chunk-2LPPNYOZ.js";
228
+ } from "./chunk-RU34XFKL.js";
217
229
  import {
218
230
  __commonJS,
219
231
  __name,
@@ -9957,7 +9969,7 @@ var require_cjs = __commonJS({
9957
9969
  }
9958
9970
  });
9959
9971
 
9960
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/account-store.js
9972
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/account-store.js
9961
9973
  var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
9962
9974
  const methods = whole;
9963
9975
  return Object.fromEntries(Object.keys(keyed).map((name) => [
@@ -10085,7 +10097,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
10085
10097
  };
10086
10098
  }, "bindAccount");
10087
10099
 
10088
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/locator.js
10100
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/locator.js
10089
10101
  var SCHEME = "msg:";
10090
10102
  var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat: chat2, message: message3 }) => SCHEME + [provider, account, chat2, message3].map(encodeURIComponent).join("/"), "formatLocator");
10091
10103
  var isLocator = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith(SCHEME), "isLocator");
@@ -10099,7 +10111,7 @@ var parseLocator = /* @__PURE__ */ __name((reference2) => {
10099
10111
  return { provider, account, chat: chat2, message: message3 };
10100
10112
  }, "parseLocator");
10101
10113
 
10102
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/references.js
10114
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/references.js
10103
10115
  var SIMPLE_REFERENCES = [
10104
10116
  "note",
10105
10117
  "document",
@@ -10255,7 +10267,7 @@ var looksLikeReference = /* @__PURE__ */ __name((text7) => {
10255
10267
  return match !== null && byPrefix.has(match[1]);
10256
10268
  }, "looksLikeReference");
10257
10269
 
10258
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/providers.js
10270
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/providers.js
10259
10271
  var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events", "crm"];
10260
10272
  var MESSENGER_OPENS = { chat: "messages list", message: "messages show", contact: "contacts show" };
10261
10273
  var PROVIDERS = [
@@ -10418,7 +10430,7 @@ var holdsKind = /* @__PURE__ */ __name((provider, kind4) => kindsIn(provider).in
10418
10430
  var holdsKindOf = /* @__PURE__ */ __name((provider, kind4) => kindIn(provider) === void 0 ? kind4 === "messages" : holdsKind(provider, kind4), "holdsKindOf");
10419
10431
  var kindOf = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
10420
10432
 
10421
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/search/query.js
10433
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/search/query.js
10422
10434
  var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
10423
10435
  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");
10424
10436
  var fail = /* @__PURE__ */ __name((message3) => {
@@ -10441,7 +10453,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
10441
10453
  return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
10442
10454
  }, "sourceOf");
10443
10455
 
10444
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/search/account-list.js
10456
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/search/account-list.js
10445
10457
  var ACCOUNT_GROUPS = "accountGroups";
10446
10458
  var ACCOUNT_GROUPS_SETTING = "account_groups";
10447
10459
  var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
@@ -10616,16 +10628,16 @@ var READS = {
10616
10628
  events: "calendar events \u2014 no search reads them yet",
10617
10629
  crm: "CRM deals and leads \u2014 search all reads them"
10618
10630
  };
10619
- var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind4) => READS[kind4]) => {
10631
+ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind4) => READS[kind4], alsoFits = () => false) => {
10620
10632
  const chosen = /* @__PURE__ */ new Map();
10621
10633
  const skipped = [];
10622
10634
  for (const { entry: entry2, accounts: accounts2 } of entries) {
10623
- const fits = accounts2.filter((one2) => kinds2.some((kind4) => listedHolds(one2, kind4)));
10635
+ const fits = accounts2.filter((one2) => kinds2.some((kind4) => listedHolds(one2, kind4)) || alsoFits(one2));
10624
10636
  for (const { provider, account } of fits)
10625
10637
  if (!chosen.has(keyOf({ provider, account })))
10626
10638
  chosen.set(keyOf({ provider, account }), { provider, account });
10627
10639
  const known2 = accounts2.filter(({ kind: kind4 }) => kind4 !== void 0);
10628
- const unknown2 = accounts2.filter(({ kind: kind4 }) => kind4 === void 0);
10640
+ const unknown2 = accounts2.filter((one2) => one2.kind === void 0 && !alsoFits(one2));
10629
10641
  if (known2.length)
10630
10642
  for (const { provider, account } of unknown2)
10631
10643
  skipped.push({ source: `${provider}:${account}`, code: "not_found", reason: UNKNOWN_PROVIDER });
@@ -10639,7 +10651,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind4)
10639
10651
  return { accounts: [...chosen.values()], skipped };
10640
10652
  }, "fitting");
10641
10653
 
10642
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
10654
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
10643
10655
  var IndexBuilderOn = class {
10644
10656
  static {
10645
10657
  __name(this, "IndexBuilderOn");
@@ -10834,34 +10846,7 @@ function alias(table, alias2) {
10834
10846
  }
10835
10847
  __name(alias, "alias");
10836
10848
 
10837
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/business.js
10838
- var CATALOG_KINDS = ["product", "service"];
10839
- var CONTRACT_KINDS = ["sale", "purchase", "service", "lease", "employment", "nda", "license", "other"];
10840
- var CONTRACT_STATUSES = ["draft", "active", "ended", "terminated"];
10841
- var SUBSCRIPTION_STATUSES = ["trial", "active", "paused", "cancelled", "ended"];
10842
- var WALLET_KINDS = ["bank", "card", "cash", "wallet", "other"];
10843
- var TRANSACTION_STATUSES = ["pending", "booked"];
10844
- var ORDER_DIRECTIONS = ["purchase", "sale"];
10845
- var intervalOf = /* @__PURE__ */ __name((text7, reason = "subscription.interval") => {
10846
- const match = typeof text7 === "string" ? /^(?:([1-9]\d{0,2})-)?(day|week|month|year)$/.exec(text7.trim()) : null;
10847
- if (!match)
10848
- throw new CliError("validation_error", "an interval is a count and a unit, such as 1-month or 2-week", { reason });
10849
- return { count: match[1] === void 0 ? 1 : Number(match[1]), unit: match[2] };
10850
- }, "intervalOf");
10851
- var intervalText = /* @__PURE__ */ __name(({ count, unit }) => `${count}-${unit}`, "intervalText");
10852
- var priced = /* @__PURE__ */ __name((units, currency2) => units === null || currency2 === null ? "" : `, ${moneyLabel(units, currency2)}`, "priced");
10853
- var pending = /* @__PURE__ */ __name((review) => review === "confirmed" ? null : review, "pending");
10854
- var productLine = /* @__PURE__ */ __name((product) => {
10855
- const price = product.unitPrice === null || product.currency === null ? "" : moneyLabel(product.unitPrice, product.currency);
10856
- const per = price && product.unit !== null ? ` per ${product.unit}` : "";
10857
- return `${product.name}${price ? ` \xB7 ${price}${per}` : ""}${notes(product.kind, product.archived ? "archived" : null)}`;
10858
- }, "productLine");
10859
- var contractLine = /* @__PURE__ */ __name((contract) => `${contract.number ?? `#${contract.id}`} \xB7 ${contract.name}${priced(contract.value, contract.currency)}` + notes(contract.status, pending(contract.review)), "contractLine");
10860
- var subscriptionLine = /* @__PURE__ */ __name((subscription) => `${subscription.name}${priced(subscription.price, subscription.currency)} every ${intervalText(subscription.interval)}` + notes(subscription.status, pending(subscription.review)), "subscriptionLine");
10861
- var walletLine = /* @__PURE__ */ __name((wallet) => `${wallet.name} \xB7 ${wallet.kind}, ${wallet.currency}${wallet.numberHint === null ? "" : `, \u2026${wallet.numberHint}`}` + notes(wallet.closed ? "closed" : null), "walletLine");
10862
- var transactionLine = /* @__PURE__ */ __name((transaction) => `${moneyLabel(transaction.amount, transaction.currency)} ${transaction.direction}${transaction.label === null ? "" : ` \xB7 ${transaction.label}`}, ${dayMonth(transaction.date)}` + notes(transaction.status === "pending" ? "pending" : null, pending(transaction.review)), "transactionLine");
10863
-
10864
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/record-fields.js
10849
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/record-fields.js
10865
10850
  var DECIMAL_PATTERN = "^[0-9]{1,16}(\\.[0-9]{1,6})?$";
10866
10851
  var SIGNED_DECIMAL = "^-?[0-9]{1,16}(\\.[0-9]{1,6})?$";
10867
10852
  var DAY = "^[0-9]{4}-[0-9]{2}-[0-9]{2}$";
@@ -10980,7 +10965,7 @@ var fieldError = /* @__PURE__ */ __name((schema, value, at = []) => {
10980
10965
  return void 0;
10981
10966
  }, "fieldError");
10982
10967
 
10983
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/record-types.js
10968
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/record-types.js
10984
10969
  var kept = /* @__PURE__ */ __name((description) => ({ description }), "kept");
10985
10970
  var PARTY = ["person", "organization"];
10986
10971
  var ORGANIZATION = ["organization"];
@@ -11353,7 +11338,7 @@ var hasV1Roles = /* @__PURE__ */ __name((type) => rolesOf2(type).some(([, role])
11353
11338
  var IDENTITY_TYPES = RECORD_ENTITY_TYPES.filter((type) => RECORD_TYPES[type].review === "identity");
11354
11339
  var article = /* @__PURE__ */ __name((word2) => /^[aeiou]/.test(word2) ? "an" : "a", "article");
11355
11340
 
11356
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
11341
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
11357
11342
  var ENTITY_TABLES = {
11358
11343
  ...RECORD_TABLES,
11359
11344
  account: "accounts",
@@ -11391,14 +11376,14 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
11391
11376
  return { table, pointer, type, count, known: known2 };
11392
11377
  }).filter(({ count }) => count > 0)), "orphanPointers");
11393
11378
 
11394
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/source-review.js
11379
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/source-review.js
11395
11380
  var SOURCE_REVIEW_KIND = "memory_source_review";
11396
11381
  var SOURCE_REVIEW_CAUSES = ["changed", "outdated", "deleted", "contradicted"];
11397
11382
  var ERASED_TEXT = "[source erased]";
11398
11383
  var severity = /* @__PURE__ */ __name((cause) => SOURCE_REVIEW_CAUSES.indexOf(cause), "severity");
11399
11384
  var graver = /* @__PURE__ */ __name((a, b) => severity(b) > severity(a) ? b : a, "graver");
11400
11385
 
11401
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
11386
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
11402
11387
  var BOT_KINDS = ["agent", "rule", "script", "integration"];
11403
11388
  var ownerPerson = /* @__PURE__ */ __name((database) => {
11404
11389
  const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
@@ -11455,7 +11440,7 @@ var proposedBySql = /* @__PURE__ */ __name((type, id2, by) => {
11455
11440
  return { sql: bot("pb.name = ?"), params: [by.bot] };
11456
11441
  }, "proposedBySql");
11457
11442
 
11458
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review-marks.js
11443
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review-marks.js
11459
11444
  var TABLES = { memory: "memories", fact: "facts" };
11460
11445
  var HOLDING = { memory: ["proposed", "confirmed"], fact: ["proposed", "accepted"] };
11461
11446
  var KEPT = 20;
@@ -11550,7 +11535,7 @@ var scrubSourceReviews = /* @__PURE__ */ __name((database, erased, { refs }) =>
11550
11535
  return scrubbed;
11551
11536
  }, "scrubSourceReviews");
11552
11537
 
11553
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
11538
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
11554
11539
  var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
11555
11540
  var REFERABLE = {
11556
11541
  ...Object.fromEntries(Object.entries(RECORD_TYPES).map(([type, { tombstone: tombstone2 }]) => [type, { tombstone: tombstone2 }])),
@@ -11710,7 +11695,7 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
11710
11695
  return row2 ? String(row2.id ?? row2.key) : void 0;
11711
11696
  }, "taskIdOf");
11712
11697
 
11713
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-signature.js
11698
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-signature.js
11714
11699
  var QUOTE_LIMIT = 500;
11715
11700
  var GONE = { sig: "gone", rev: null, deleted: true, changedAt: null };
11716
11701
  var part = /* @__PURE__ */ __name((value) => value == null ? "" : String(value), "part");
@@ -11988,7 +11973,7 @@ var deleteDocumentRow = /* @__PURE__ */ __name((database, id2, at) => {
11988
11973
  database.prepare("DELETE FROM documents WHERE id = ?").run(id2);
11989
11974
  }, "deleteDocumentRow");
11990
11975
 
11991
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
11976
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
11992
11977
  var canonicalTags = sqliteTable("canonical_tags", {
11993
11978
  id: integer("id").primaryKey(),
11994
11979
  name: text("name").notNull().unique(),
@@ -11997,7 +11982,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
11997
11982
  updatedAt: integer("updated_at").notNull()
11998
11983
  });
11999
11984
 
12000
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/link-revisions.js
11985
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/link-revisions.js
12001
11986
  var linkRevisions = sqliteTable("link_revisions", {
12002
11987
  id: integer("id").primaryKey(),
12003
11988
  linkId: integer("link_id").notNull(),
@@ -12009,7 +11994,7 @@ var linkRevisions = sqliteTable("link_revisions", {
12009
11994
  createdAt: integer("created_at").notNull()
12010
11995
  }, (table) => [index("link_revisions_by_link_id_created_at").on(table.linkId, table.createdAt)]);
12011
11996
 
12012
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
11997
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
12013
11998
  var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
12014
11999
  sourceKey: text("source_key").notNull(),
12015
12000
  collection: text("collection").notNull(),
@@ -12019,13 +12004,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
12019
12004
  createdAt: integer("created_at").notNull()
12020
12005
  }, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
12021
12006
 
12022
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
12007
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
12023
12008
  var documentIndexPending = sqliteTable("document_index_pending", {
12024
12009
  id: integer("id").notNull(),
12025
12010
  indexableType: text("indexable_type").notNull()
12026
12011
  }, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
12027
12012
 
12028
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/decision-requests.js
12013
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/decision-requests.js
12029
12014
  var decisionRequests = sqliteTable("decision_requests", {
12030
12015
  id: integer("id").primaryKey(),
12031
12016
  tokenDigest: text("token_digest").notNull().unique(),
@@ -12045,7 +12030,7 @@ var decisionRequests = sqliteTable("decision_requests", {
12045
12030
  index("decision_requests_by_channel_bot_profile_chat_id_message_id").on(table.channel, table.botProfile, table.chatId, table.messageId)
12046
12031
  ]);
12047
12032
 
12048
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/links.js
12033
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/links.js
12049
12034
  var links = sqliteTable("links", {
12050
12035
  id: integer("id").primaryKey(),
12051
12036
  fromType: text("from_type").notNull(),
@@ -12076,7 +12061,7 @@ var links = sqliteTable("links", {
12076
12061
  index("links_by_to_type_to_id").on(table.toType, table.toId)
12077
12062
  ]);
12078
12063
 
12079
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
12064
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
12080
12065
  var tagRedirects = sqliteTable("tag_redirects", {
12081
12066
  sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
12082
12067
  survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
@@ -12102,7 +12087,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
12102
12087
  index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
12103
12088
  ]);
12104
12089
 
12105
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
12090
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
12106
12091
  var accounts = sqliteTable("accounts", {
12107
12092
  id: integer("id").primaryKey(),
12108
12093
  provider: text("provider").notNull(),
@@ -12773,7 +12758,7 @@ var documentRevisions = sqliteTable("document_revisions", {
12773
12758
  revision: integer("revision").notNull(),
12774
12759
  createdAt: integer("created_at").notNull()
12775
12760
  }, (table) => [index("document_revisions_by_document_id").on(table.documentId)]);
12776
- var notes2 = sqliteTable("notes", {
12761
+ var notes = sqliteTable("notes", {
12777
12762
  id: integer("id").primaryKey(),
12778
12763
  notableType: text("notable_type").notNull(),
12779
12764
  notableId: integer("notable_id").notNull(),
@@ -12791,7 +12776,7 @@ var notes2 = sqliteTable("notes", {
12791
12776
  ]);
12792
12777
  var noteRevisions = sqliteTable("note_revisions", {
12793
12778
  id: integer("id").primaryKey(),
12794
- noteId: integer("note_id").notNull().references(() => notes2.id),
12779
+ noteId: integer("note_id").notNull().references(() => notes.id),
12795
12780
  body: text("body").notNull(),
12796
12781
  revision: integer("revision").notNull(),
12797
12782
  createdAt: integer("created_at").notNull()
@@ -14098,10 +14083,10 @@ var storeSettings = sqliteTable("store_settings", {
14098
14083
  at: integer("at").notNull()
14099
14084
  });
14100
14085
 
14101
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
14086
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
14102
14087
  import { AsyncLocalStorage } from "node:async_hooks";
14103
14088
 
14104
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
14089
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
14105
14090
  var ARMS = [
14106
14091
  [
14107
14092
  "message",
@@ -14194,16 +14179,15 @@ var linkArm = /* @__PURE__ */ __name((linkFrom, linkTo) => `
14194
14179
  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)
14195
14180
  `, "linkArm");
14196
14181
  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";
14197
- var sourcesOf = /* @__PURE__ */ __name((subject2) => {
14198
- if (subject2 === void 0)
14182
+ var sourcesOf = /* @__PURE__ */ __name((type) => {
14183
+ if (type === void 0)
14199
14184
  return [COLUMNS, ...ARMS.map(([, , sql2]) => sql2), linkArm("1", "1")].join(" UNION ");
14200
- if (!/^[a-z_]+$/.test(subject2.type) || !Number.isSafeInteger(subject2.id))
14201
- throw new CliError("configuration_error", `the involvement queue holds ${subject2.type} ${subject2.id}`);
14202
- const { type, id: id2 } = subject2;
14185
+ if (!/^[a-z_]+$/.test(type))
14186
+ throw new CliError("configuration_error", `the involvement queue holds a ${type}`);
14203
14187
  return [
14204
14188
  COLUMNS,
14205
- ...ARMS.filter(([of]) => of === type).map(([, key2, sql2]) => `${sql2} AND ${key2}=${id2}`),
14206
- linkArm(`from_type='${type}' AND from_id=${id2}`, `to_type='${type}' AND to_id=${id2}`)
14189
+ ...ARMS.filter(([of]) => of === type).map(([, key2, sql2]) => `${sql2} AND ${key2}=?`),
14190
+ linkArm(`from_type='${type}' AND from_id=?`, `to_type='${type}' AND to_id=?`)
14207
14191
  ].join(" UNION ");
14208
14192
  }, "sourcesOf");
14209
14193
  var INSERT = "INSERT INTO involvements (person_id, identity_id, subject_type, subject_id, role, occurred_at, scope, account_id, project_id, created_at)";
@@ -14220,7 +14204,9 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
14220
14204
  break;
14221
14205
  for (const subject2 of subjects) {
14222
14206
  drop.run(subject2.type, subject2.id);
14223
- database.prepare(`${INSERT} SELECT s.*, ? FROM (${sourcesOf(subject2)}) s JOIN persons p ON p.id=s.person_id`).run(at);
14207
+ const sql2 = `${INSERT} SELECT s.*, ? FROM (${sourcesOf(subject2.type)}) s JOIN persons p ON p.id=s.person_id`;
14208
+ const ids = Array(sql2.split("?").length - 2).fill(subject2.id);
14209
+ database.prepare(sql2).run(at, ...ids);
14224
14210
  done.run(subject2.type, subject2.id);
14225
14211
  }
14226
14212
  recomputed += subjects.length;
@@ -14228,7 +14214,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
14228
14214
  return recomputed;
14229
14215
  }, "drainInvolvementQueue");
14230
14216
 
14231
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/mentions.js
14217
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/mentions.js
14232
14218
  import { domainToUnicode } from "node:url";
14233
14219
 
14234
14220
  // node_modules/.pnpm/psl@1.15.0/node_modules/psl/dist/psl.mjs
@@ -24250,7 +24236,7 @@ var oa = /* @__PURE__ */ __name((e) => {
24250
24236
  }, "oa");
24251
24237
  var na = { parse: O, get: aa, isValid: oa };
24252
24238
 
24253
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
24239
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
24254
24240
  var LINK = /https?:\/\/(?:(?:docs|drive|sheets|slides)\.google\.com|forms\.gle)(?:[/?#][^\s<>"'`]*)?/gi;
24255
24241
  var ID = /^[\w-]{10,}$/;
24256
24242
  var trimUrl = /* @__PURE__ */ __name((url) => {
@@ -24292,7 +24278,7 @@ var googleDocumentLinks = /* @__PURE__ */ __name((text7) => [...text7.matchAll(L
24292
24278
  return { url, documentId: googleDocumentId(url) };
24293
24279
  }), "googleDocumentLinks");
24294
24280
 
24295
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
24281
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
24296
24282
  var PHONE_PLANS = [
24297
24283
  {
24298
24284
  country: "us",
@@ -24672,7 +24658,7 @@ var PHONE_PLANS = [
24672
24658
  }
24673
24659
  ];
24674
24660
 
24675
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/phones.js
24661
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/phones.js
24676
24662
  var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
24677
24663
  var DEFAULT_PHONE_COUNTRIES = ["ru"];
24678
24664
  var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
@@ -24713,7 +24699,7 @@ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
24713
24699
  return void 0;
24714
24700
  }, "nationalPhone");
24715
24701
 
24716
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/places.js
24702
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/places.js
24717
24703
  var BEFORE = [
24718
24704
  [/^(?:ул\.?|улиц[аеыу]|улицей)$/iu, "\u0443\u043B\u0438\u0446\u0430"],
24719
24705
  [/^(?:пр-т|просп\.?|проспект[аеу]?)$/iu, "\u043F\u0440\u043E\u0441\u043F\u0435\u043A\u0442"],
@@ -24973,7 +24959,7 @@ var findPlaces = /* @__PURE__ */ __name((text7) => {
24973
24959
  return found2.sort((a, b) => a.start - b.start);
24974
24960
  }, "findPlaces");
24975
24961
 
24976
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/mentions.js
24962
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/mentions.js
24977
24963
  var MENTION_KINDS = ["phone", "email", "url", "document", "person-name", "place"];
24978
24964
  var MENTION_VERSIONS = {
24979
24965
  phone: 1,
@@ -25163,7 +25149,7 @@ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE
25163
25149
  };
25164
25150
  }, "typedPhone");
25165
25151
 
25166
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/first-names.js
25152
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/first-names.js
25167
25153
  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";
25168
25154
  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";
25169
25155
  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";
@@ -25171,7 +25157,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
25171
25157
  var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
25172
25158
  var NAME_WORDS = WORDS.split(" ");
25173
25159
 
25174
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/person-names.js
25160
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/person-names.js
25175
25161
  var LATIN_TO_CYRILLIC = {
25176
25162
  shch: "\u0449",
25177
25163
  sch: "\u0449",
@@ -25379,7 +25365,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text7, stem, taken) => {
25379
25365
  return found2;
25380
25366
  }, "findUnknownNames");
25381
25367
 
25382
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/attachments.js
25368
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/attachments.js
25383
25369
  var NOT_FILES = /* @__PURE__ */ new Set([
25384
25370
  "webpage",
25385
25371
  "share",
@@ -25419,7 +25405,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored4, files2) => {
25419
25405
  });
25420
25406
  }, "matchDownloads");
25421
25407
 
25422
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
25408
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
25423
25409
  var QUERY_VERSION = 1;
25424
25410
  var QUERY_LIMITS2 = {
25425
25411
  ...QUERY_LIMITS,
@@ -25455,7 +25441,7 @@ function exhausted(budget) {
25455
25441
  }
25456
25442
  __name(exhausted, "exhausted");
25457
25443
 
25458
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
25444
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
25459
25445
  var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
25460
25446
  var literal2 = /* @__PURE__ */ __name((c) => ({
25461
25447
  kind: "char",
@@ -25855,7 +25841,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
25855
25841
  return out;
25856
25842
  }, "foldRegex");
25857
25843
 
25858
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
25844
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
25859
25845
  var PRESET_VERSION = 1;
25860
25846
  var PRESETS = {
25861
25847
  password: {
@@ -25909,7 +25895,7 @@ var PRESETS = {
25909
25895
  }
25910
25896
  };
25911
25897
 
25912
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
25898
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
25913
25899
  var FIELD_VERSION = 2;
25914
25900
  var UNITS = {
25915
25901
  "": 1,
@@ -26370,12 +26356,12 @@ var validateAst = /* @__PURE__ */ __name((input) => {
26370
26356
  return validateFields(parsed3.output);
26371
26357
  }, "validateAst");
26372
26358
 
26373
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
26359
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
26374
26360
  var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
26375
26361
  var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
26376
26362
  var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
26377
26363
 
26378
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
26364
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
26379
26365
  var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
26380
26366
  var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
26381
26367
  var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
@@ -26399,7 +26385,7 @@ var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
26399
26385
  };
26400
26386
  }, "linkMatch");
26401
26387
 
26402
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
26388
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
26403
26389
  var SETTING = "phoneCountries";
26404
26390
  var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
26405
26391
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
@@ -26430,7 +26416,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
26430
26416
  return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
26431
26417
  }, "valueMatch");
26432
26418
 
26433
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
26419
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
26434
26420
  var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
26435
26421
  if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
26436
26422
  throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
@@ -26458,7 +26444,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
26458
26444
  return 2 * intersection2 / (aa2.size + bb.size);
26459
26445
  }, "vocabularySimilarity");
26460
26446
 
26461
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
26447
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
26462
26448
  import { createHash } from "node:crypto";
26463
26449
  var folded3 = /* @__PURE__ */ __name((name) => {
26464
26450
  try {
@@ -26524,7 +26510,7 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind4, by, options
26524
26510
  });
26525
26511
  }, "guardTagCreation");
26526
26512
 
26527
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
26513
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
26528
26514
  var invalid2 = /* @__PURE__ */ __name((message3) => {
26529
26515
  throw new CliError("validation_error", message3);
26530
26516
  }, "invalid");
@@ -26601,7 +26587,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
26601
26587
  };
26602
26588
  }, "createTagRedirectIndex");
26603
26589
 
26604
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
26590
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
26605
26591
  var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
26606
26592
  const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
26607
26593
  if (!row2)
@@ -26629,7 +26615,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
26629
26615
  return snapshot2;
26630
26616
  }, "tagRedirectSnapshot");
26631
26617
 
26632
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
26618
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
26633
26619
  import { createHash as createHash2 } from "node:crypto";
26634
26620
  var TASK_KEY_PREFIXES = {
26635
26621
  question: "Q",
@@ -26657,7 +26643,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
26657
26643
  return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
26658
26644
  }, "taskAccountOf");
26659
26645
 
26660
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
26646
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
26661
26647
  var toMs = /* @__PURE__ */ __name((iso16) => {
26662
26648
  if (iso16 === null || iso16 === void 0)
26663
26649
  return null;
@@ -26671,7 +26657,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
26671
26657
  var DELIVERY = { delivered: 1, read: 2 };
26672
26658
  var deliveryOf = /* @__PURE__ */ __name((stored4) => stored4 === DELIVERY.read ? "read" : stored4 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
26673
26659
 
26674
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
26660
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
26675
26661
  var TAG_KINDS = ["tag", "topic"];
26676
26662
  var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
26677
26663
  var TAG_TYPE = {
@@ -26874,7 +26860,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
26874
26860
  return result;
26875
26861
  }, "tagsOf");
26876
26862
 
26877
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
26863
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
26878
26864
  var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
26879
26865
  var SPEECH = speech("att");
26880
26866
  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");
@@ -27238,7 +27224,7 @@ var FIELD_COMPILERS = {
27238
27224
  subject
27239
27225
  };
27240
27226
 
27241
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
27227
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
27242
27228
  var placeOf = /* @__PURE__ */ __name((database) => {
27243
27229
  const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
27244
27230
  const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
@@ -27254,7 +27240,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
27254
27240
  };
27255
27241
  }, "placeOf");
27256
27242
 
27257
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
27243
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
27258
27244
  var DRAIN_ON_WRITE = 500;
27259
27245
  var METHOD = "rules";
27260
27246
  var telegramLink = /* @__PURE__ */ __name((database) => {
@@ -27417,7 +27403,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
27417
27403
  return queued.length;
27418
27404
  }, "drainMentions");
27419
27405
 
27420
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
27406
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
27421
27407
  var indexRow = /* @__PURE__ */ __name((database, name) => {
27422
27408
  const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
27423
27409
  if (!exists2)
@@ -27425,7 +27411,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
27425
27411
  return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
27426
27412
  }, "indexRow");
27427
27413
 
27428
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
27414
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
27429
27415
  var INDEX = "message_stems";
27430
27416
  var SETTING2 = "searchStemmers";
27431
27417
  var DRAIN_ON_WRITE2 = 500;
@@ -27468,16 +27454,16 @@ var stemsState = /* @__PURE__ */ __name((database) => {
27468
27454
  return void 0;
27469
27455
  const watermark = Number(row2.watermark);
27470
27456
  const filledThrough = Number(row2.filled_through);
27471
- const pending2 = Number(database.prepare("SELECT count(*) AS n FROM message_stems_pending").get()?.n);
27457
+ const pending = Number(database.prepare("SELECT count(*) AS n FROM message_stems_pending").get()?.n);
27472
27458
  const built = row2.analyzer === null ? null : String(row2.analyzer);
27473
27459
  const stemmers = storeStemmers(database);
27474
27460
  const wanted = stemmers ? analyzerIdentity(stemmers) : UNKNOWN;
27475
- const ready = stemmers !== null && (built === wanted || built === null) && filledThrough >= watermark && pending2 === 0;
27461
+ const ready = stemmers !== null && (built === wanted || built === null) && filledThrough >= watermark && pending === 0;
27476
27462
  const cause = !stemmers ? "stemmer_unknown" : built !== null && built !== wanted ? "stemmer_changed" : "building";
27477
27463
  return {
27478
27464
  watermark,
27479
27465
  filledThrough,
27480
- pending: pending2,
27466
+ pending,
27481
27467
  built,
27482
27468
  wanted,
27483
27469
  ready,
@@ -27547,7 +27533,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
27547
27533
  };
27548
27534
  }, "stemmerCache");
27549
27535
 
27550
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
27536
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
27551
27537
  var rehearsal = new AsyncLocalStorage();
27552
27538
  var SQLITE_BUSY = 5;
27553
27539
  var pause = new Int32Array(new SharedArrayBuffer(4));
@@ -27681,7 +27667,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
27681
27667
  }
27682
27668
  }, "read");
27683
27669
 
27684
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
27670
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
27685
27671
  var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
27686
27672
  coalesce(CASE k.chunkable_type
27687
27673
  WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
@@ -27738,8 +27724,8 @@ var fillVectorIndexes = /* @__PURE__ */ __name((database, { batch = FILL_HASHES,
27738
27724
  }, "notice") } = {}) => {
27739
27725
  for (const { model, dims } of modelsWithoutIndex(database))
27740
27726
  writeBatch(database, () => ensureVectorIndex(database, model, Number(dims)));
27741
- const pending2 = database.prepare("SELECT id, model, dims, filled_through FROM vector_indexes WHERE ready = 0 ORDER BY id").all();
27742
- for (const { id: id2, model, dims, filled_through } of pending2) {
27727
+ const pending = database.prepare("SELECT id, model, dims, filled_through FROM vector_indexes WHERE ready = 0 ORDER BY id").all();
27728
+ for (const { id: id2, model, dims, filled_through } of pending) {
27743
27729
  notice(model);
27744
27730
  const table = tableOf(id2);
27745
27731
  const step = database.prepare(`INSERT INTO ${table} (${COLUMNS2}) ${source(model, dims)}
@@ -27760,7 +27746,7 @@ var fillVectorIndexes = /* @__PURE__ */ __name((database, { batch = FILL_HASHES,
27760
27746
  break;
27761
27747
  }
27762
27748
  }
27763
- return pending2.map(({ model }) => model);
27749
+ return pending.map(({ model }) => model);
27764
27750
  }, "fillVectorIndexes");
27765
27751
  var NEAR_TIE = 1e-5;
27766
27752
  var MAX_K = 4096;
@@ -27823,7 +27809,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
27823
27809
  }, "dropUnusedVectors");
27824
27810
  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");
27825
27811
 
27826
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
27812
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
27827
27813
  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({
27828
27814
  target: [accounts.provider, accounts.externalId],
27829
27815
  set: {
@@ -27954,7 +27940,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
27954
27940
  AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
27955
27941
  }, "dropOrphanPeople");
27956
27942
 
27957
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
27943
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
27958
27944
  var FOLDED = [
27959
27945
  { table: "tasks", column: "title" },
27960
27946
  { table: "tasks", column: "close_reason" },
@@ -27972,13 +27958,13 @@ var folded4 = /* @__PURE__ */ __name((value) => value === null || value === void
27972
27958
  var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
27973
27959
  let filled2 = 0;
27974
27960
  for (const { table, column: column2 } of FOLDED) {
27975
- const pending2 = database.prepare(`SELECT id, ${column2} AS value FROM ${table} WHERE ${column2} IS NOT NULL AND ${column2}_folded IS NULL LIMIT ?`);
27976
- if (pending2.get(1) === void 0)
27961
+ const pending = database.prepare(`SELECT id, ${column2} AS value FROM ${table} WHERE ${column2} IS NOT NULL AND ${column2}_folded IS NULL LIMIT ?`);
27962
+ if (pending.get(1) === void 0)
27977
27963
  continue;
27978
27964
  const fill = database.prepare(`UPDATE ${table} SET ${column2}_folded = ? WHERE id = ?`);
27979
27965
  for (; ; ) {
27980
27966
  const count = writeBatch(database, () => {
27981
- const rows = pending2.all(batch);
27967
+ const rows = pending.all(batch);
27982
27968
  for (const row2 of rows)
27983
27969
  fill.run(fold(String(row2.value)), Number(row2.id));
27984
27970
  return rows.length;
@@ -27991,7 +27977,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
27991
27977
  return filled2;
27992
27978
  }, "fillFolded");
27993
27979
 
27994
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/history-skips.js
27980
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/history-skips.js
27995
27981
  var HISTORY_KEY = "$history";
27996
27982
  var objectOf2 = /* @__PURE__ */ __name((text7) => {
27997
27983
  if (typeof text7 !== "string")
@@ -28067,7 +28053,7 @@ var withoutHistory = /* @__PURE__ */ __name((metadata3) => {
28067
28053
  return rest;
28068
28054
  }, "withoutHistory");
28069
28055
 
28070
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
28056
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
28071
28057
  import { createHash as createHash3 } from "node:crypto";
28072
28058
  var CHUNK_CHARS = 1200;
28073
28059
  var CHUNK_OVERLAP = 150;
@@ -28172,7 +28158,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
28172
28158
  return chunks2;
28173
28159
  }, "cutChunks");
28174
28160
 
28175
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/search/task-signature.js
28161
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/search/task-signature.js
28176
28162
  var DAY2 = 864e5;
28177
28163
  var CURRENCY = [
28178
28164
  [/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
@@ -28298,7 +28284,7 @@ var dueDayOf = /* @__PURE__ */ __name((text7, createdMs) => {
28298
28284
  return best?.day ?? null;
28299
28285
  }, "dueDayOf");
28300
28286
 
28301
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
28287
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
28302
28288
  var DAY3 = 864e5;
28303
28289
  var STOP_WORDS = new Set([
28304
28290
  // Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
@@ -28453,7 +28439,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
28453
28439
  ...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
28454
28440
  })).sort((a, b) => b.score - a.score), "rankCandidates");
28455
28441
 
28456
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
28442
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
28457
28443
  var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
28458
28444
  r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
28459
28445
  JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
@@ -28689,7 +28675,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
28689
28675
  const member = /* @__PURE__ */ __name((pk) => sql`EXISTS (SELECT 1 FROM conversation_messages cm
28690
28676
  JOIN conversations c ON c.id = cm.conversation_id WHERE cm.message_id = ${pk} AND c.build = ${build})`, "member");
28691
28677
  const editedSince = /* @__PURE__ */ __name((pk) => sql`EXISTS (SELECT 1 FROM message_revisions r WHERE r.message_id = ${pk} AND r.created_at >= ${builtAt})`, "editedSince");
28692
- const pending2 = orm.get(sql`SELECT
28678
+ const pending = orm.get(sql`SELECT
28693
28679
  sum(m.deleted_at IS NULL AND NOT ${member(sql`m.id`)}) AS new,
28694
28680
  sum(m.deleted_at IS NULL AND ${editedSince(sql`m.id`)} AND ${member(sql`m.id`)}) AS edited,
28695
28681
  sum(m.deleted_at IS NOT NULL AND ${member(sql`m.id`)}) AS deleted
@@ -28716,9 +28702,9 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
28716
28702
  builtAt,
28717
28703
  algorithmVersion: state.algorithmVersion,
28718
28704
  pending: {
28719
- new: Number(pending2?.new ?? 0),
28720
- edited: Number(pending2?.edited ?? 0),
28721
- deleted: Number(pending2?.deleted ?? 0)
28705
+ new: Number(pending?.new ?? 0),
28706
+ edited: Number(pending?.edited ?? 0),
28707
+ deleted: Number(pending?.deleted ?? 0)
28722
28708
  },
28723
28709
  vectors: { chunks: chunks2, embedded: Number(vectors?.embedded ?? 0), current, stale: stale4, missing: chunks2 - current - stale4 }
28724
28710
  };
@@ -28728,7 +28714,7 @@ var vectorCounts = /* @__PURE__ */ __name(({ orm }, models) => new Map(models.ma
28728
28714
  Number(orm.get(sql`SELECT count(*) AS n FROM embeddings WHERE model = ${model}`)?.n ?? 0)
28729
28715
  ])), "vectorCounts");
28730
28716
 
28731
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
28717
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
28732
28718
  var DOCUMENT_PICTURE = "document_picture";
28733
28719
  var SCAN_PAGE2 = 5e3;
28734
28720
  var idOf = /* @__PURE__ */ __name((ref3) => {
@@ -28791,7 +28777,7 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
28791
28777
  }, "nearestPictures")
28792
28778
  }), "documentPicturesOver");
28793
28779
 
28794
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
28780
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
28795
28781
  var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
28796
28782
  const literal5 = escaped2 ?? plain2 ?? "";
28797
28783
  return wildcard ?? (/[*?[]/u.test(literal5) ? `[${literal5}]` : literal5);
@@ -28856,7 +28842,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
28856
28842
  var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
28857
28843
  var bound2 = /* @__PURE__ */ __name(({ sql: text7, params }) => sql.join(text7.split("?").map((part2, at) => at < params.length ? sql`${sql.raw(part2)}${params[at]}` : sql.raw(part2)), sql``), "bound");
28858
28844
 
28859
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
28845
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
28860
28846
  var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
28861
28847
  var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
28862
28848
  var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
@@ -28946,7 +28932,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
28946
28932
  });
28947
28933
  }, "linkMeeting");
28948
28934
 
28949
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
28935
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
28950
28936
  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), ''))";
28951
28937
  var UNSEARCHED_EVENT_TYPES = [
28952
28938
  "working-location",
@@ -29058,20 +29044,20 @@ var fillTrigrams = /* @__PURE__ */ __name((database, { batch = 200, until = /* @
29058
29044
  }, "fillTrigrams");
29059
29045
  var corpusIndexState = /* @__PURE__ */ __name((database, corpus) => {
29060
29046
  const row2 = indexRow(database, corpus.index);
29061
- const pending2 = Number(database.prepare(`SELECT count(*) AS n FROM ${corpus.type}_index_pending WHERE indexable_type = ?`).get(queuedAs(corpus))?.n);
29047
+ const pending = Number(database.prepare(`SELECT count(*) AS n FROM ${corpus.type}_index_pending WHERE indexable_type = ?`).get(queuedAs(corpus))?.n);
29062
29048
  const saved = savedStemmers(database);
29063
29049
  const wanted = saved === null ? null : analyzerIdentity(saved ?? DEFAULT_STEMMERS);
29064
29050
  const built = row2.analyzer === null ? null : String(row2.analyzer);
29065
- return { pending: pending2, built, wanted, ready: pending2 === 0 && wanted !== null && (built === wanted || built === null) };
29051
+ return { pending, built, wanted, ready: pending === 0 && wanted !== null && (built === wanted || built === null) };
29066
29052
  }, "corpusIndexState");
29067
29053
  var noteIndexState = /* @__PURE__ */ __name((database) => {
29068
29054
  const documents2 = corpusIndexState(database, CORPORA.document);
29069
- const notes3 = corpusIndexState(database, CORPORA.note);
29055
+ const notes2 = corpusIndexState(database, CORPORA.note);
29070
29056
  return {
29071
- pending: documents2.pending + notes3.pending,
29072
- built: notes3.built ?? documents2.built,
29073
- wanted: notes3.wanted,
29074
- ready: documents2.ready && notes3.ready
29057
+ pending: documents2.pending + notes2.pending,
29058
+ built: notes2.built ?? documents2.built,
29059
+ wanted: notes2.wanted,
29060
+ ready: documents2.ready && notes2.ready
29075
29061
  };
29076
29062
  }, "noteIndexState");
29077
29063
  var storedSections = /* @__PURE__ */ __name((metadata3) => {
@@ -29178,7 +29164,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
29178
29164
  return true;
29179
29165
  }, "resetNoteIndex");
29180
29166
 
29181
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
29167
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
29182
29168
  var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
29183
29169
  var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
29184
29170
  for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
@@ -29197,7 +29183,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
29197
29183
  }
29198
29184
  }, "resolvePersonLinks");
29199
29185
 
29200
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
29186
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
29201
29187
  var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
29202
29188
  var prepare = /* @__PURE__ */ __name((orm) => ({
29203
29189
  find: orm.select({
@@ -29339,14 +29325,14 @@ var people = /* @__PURE__ */ __name(({ orm, database }, provider, { account, acc
29339
29325
  const byId2 = new Map(everyone.map((person2) => [person2.id, person2]));
29340
29326
  return { provider, get: /* @__PURE__ */ __name((id2) => byId2.get(id2), "get"), all: /* @__PURE__ */ __name(() => everyone, "all") };
29341
29327
  }, "people");
29342
- var contactsWhere = /* @__PURE__ */ __name((accountKey, key2, { query, notes: notes3 }) => {
29328
+ var contactsWhere = /* @__PURE__ */ __name((accountKey, key2, { query, notes: notes2 }) => {
29343
29329
  if (query !== void 0 && query.trim().length < 3) {
29344
29330
  throw new CliError("validation_error", `a contact search takes at least 3 characters, got "${query}"`);
29345
29331
  }
29346
- const noted = notes3 === void 0 ? void 0 : holdingText("note", "n.id", notes3);
29332
+ const noted = notes2 === void 0 ? void 0 : holdingText("note", "n.id", notes2);
29347
29333
  return and(eq(accountIdentities.accountId, accountKey), ne(identities.externalId, key2.account), sql`EXISTS (SELECT 1 FROM ${chatMembers} JOIN ${chats} ON ${chats.id} = ${chatMembers.chatId}
29348
29334
  WHERE ${chatMembers.identityId} = ${identities.id} AND ${chats.accountId} = ${accountIdentities.accountId}
29349
- AND ${chats.kind} = 'dialog')`, query === void 0 ? void 0 : sql`(${identities.id} IN (SELECT rowid FROM identities_fts WHERE identities_fts MATCH ${`"${query.trim().replaceAll('"', '""')}"`}) OR EXISTS (SELECT 1 FROM aliases ca WHERE ca.aliasable_type='identity' AND ca.display=1 AND ca.account_id=${accountKey} AND ca.aliasable_id=${identities.id} AND instr(ca.name_folded, ${fold(query.trim())}) > 0))`, notes3 === void 0 ? void 0 : sql`EXISTS (SELECT 1 FROM notes n WHERE n.notable_type='identity' AND n.notable_id=${identities.id} AND n.deleted_at IS NULL${noted ? sql` AND ${bound2(noted)}` : sql``})`);
29335
+ AND ${chats.kind} = 'dialog')`, query === void 0 ? void 0 : sql`(${identities.id} IN (SELECT rowid FROM identities_fts WHERE identities_fts MATCH ${`"${query.trim().replaceAll('"', '""')}"`}) OR EXISTS (SELECT 1 FROM aliases ca WHERE ca.aliasable_type='identity' AND ca.display=1 AND ca.account_id=${accountKey} AND ca.aliasable_id=${identities.id} AND instr(ca.name_folded, ${fold(query.trim())}) > 0))`, notes2 === void 0 ? void 0 : sql`EXISTS (SELECT 1 FROM notes n WHERE n.notable_type='identity' AND n.notable_id=${identities.id} AND n.deleted_at IS NULL${noted ? sql` AND ${bound2(noted)}` : sql``})`);
29350
29336
  }, "contactsWhere");
29351
29337
  var contacts = /* @__PURE__ */ __name(({ orm }, accountKey, key2, { order, limit, offset = 0, ...filter }) => {
29352
29338
  const byName = [
@@ -29422,7 +29408,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
29422
29408
  }, "meetingIdentityPk");
29423
29409
  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");
29424
29410
 
29425
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
29411
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
29426
29412
  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");
29427
29413
  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");
29428
29414
  var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
@@ -29710,7 +29696,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
29710
29696
  }
29711
29697
  }, "replaceAutoTags");
29712
29698
 
29713
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/counters.js
29699
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/counters.js
29714
29700
  var COUNTER_FIELDS = ["views", "reactions", "comments"];
29715
29701
  var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
29716
29702
  var counterObservationTime = /* @__PURE__ */ __name((observation, now2) => {
@@ -29729,7 +29715,7 @@ var counterFreshness = /* @__PURE__ */ __name((states) => {
29729
29715
  return states.some((one2) => one2.freshness === "stale") ? "stale" : "fresh";
29730
29716
  }, "counterFreshness");
29731
29717
 
29732
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/context/evidence.js
29718
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/context/evidence.js
29733
29719
  import { createHash as createHash4 } from "node:crypto";
29734
29720
  var CONTEXT_MAX_READ_BYTES = 262144;
29735
29721
  var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
@@ -29827,7 +29813,7 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
29827
29813
  return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
29828
29814
  }, "contextEvidenceRequest");
29829
29815
 
29830
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/email-activity.js
29816
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/email-activity.js
29831
29817
  var MAIL_AGENDA_COLUMNS = { chat_kind: { type: "enum", sql: "'dialog'" } };
29832
29818
  var ACTIVITY = `
29833
29819
  SELECT t.external_id AS thread, t.subject, t.last_email_at, t.emails_count,
@@ -29957,7 +29943,7 @@ var mailActivity = /* @__PURE__ */ __name((database) => ({
29957
29943
  threadActivity: /* @__PURE__ */ __name(async (accountId, since, where) => threadActivity(database, accountId, since, where), "threadActivity")
29958
29944
  }), "mailActivity");
29959
29945
 
29960
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
29946
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
29961
29947
  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");
29962
29948
  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;
29963
29949
  var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
@@ -30098,7 +30084,7 @@ var mailOwnText = /* @__PURE__ */ __name((body2) => {
30098
30084
  return text7 || body2.trim();
30099
30085
  }, "mailOwnText");
30100
30086
 
30101
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
30087
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
30102
30088
  var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
30103
30089
  var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
30104
30090
  k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
@@ -30208,7 +30194,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
30208
30194
  return emails3 + threads;
30209
30195
  }, "drainEmailIndex");
30210
30196
 
30211
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
30197
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
30212
30198
  var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
30213
30199
  SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
30214
30200
  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,
@@ -30306,7 +30292,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
30306
30292
  var backfillSentAt = /* @__PURE__ */ __name((database, accountId, limit) => Number(database.prepare(`UPDATE emails SET sent_at = received_at WHERE id IN (
30307
30293
  SELECT id FROM emails WHERE account_id = ? AND sent_at IS NULL AND received_at IS NOT NULL LIMIT ?)`).run(accountId, limit).changes), "backfillSentAt");
30308
30294
 
30309
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
30295
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
30310
30296
  var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
30311
30297
  emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
30312
30298
  last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
@@ -30356,7 +30342,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
30356
30342
  return threads.length;
30357
30343
  }, "markEmailsRestored");
30358
30344
 
30359
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-nearest.js
30345
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-nearest.js
30360
30346
  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
30361
30347
  FROM ${MAIL_PIECES} JOIN embeddings v ON v.model = ? AND v.content_hash = p.content_hash
30362
30348
  WHERE p.account_id = ?
@@ -30416,7 +30402,7 @@ var indexedMailPieces = /* @__PURE__ */ __name((database, model, query, filter,
30416
30402
  }, "indexedMailPieces");
30417
30403
  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");
30418
30404
 
30419
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
30405
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
30420
30406
  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");
30421
30407
  var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
30422
30408
  var ruleOf = /* @__PURE__ */ __name((row2) => ({
@@ -30483,7 +30469,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
30483
30469
  }
30484
30470
  }), "mailRulesOver");
30485
30471
 
30486
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
30472
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
30487
30473
  var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
30488
30474
  database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
30489
30475
  VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
@@ -30491,7 +30477,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
30491
30477
  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);
30492
30478
  }, "reviewLink");
30493
30479
 
30494
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
30480
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
30495
30481
  function checkMeetingCancelled(signal) {
30496
30482
  if (!signal?.aborted)
30497
30483
  return;
@@ -30502,7 +30488,7 @@ function checkMeetingCancelled(signal) {
30502
30488
  }
30503
30489
  __name(checkMeetingCancelled, "checkMeetingCancelled");
30504
30490
 
30505
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
30491
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
30506
30492
  var meetingOf = /* @__PURE__ */ __name((row2) => ({
30507
30493
  id: Number(row2.id),
30508
30494
  accountId: Number(row2.account_id),
@@ -30552,7 +30538,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
30552
30538
  createdAt: Number(row2.created_at)
30553
30539
  }), "transcriptRowOf");
30554
30540
 
30555
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
30541
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
30556
30542
  var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
30557
30543
  var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
30558
30544
  var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
@@ -30719,7 +30705,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
30719
30705
  }
30720
30706
  }), "meetingReadsOver");
30721
30707
 
30722
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
30708
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
30723
30709
  var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
30724
30710
  const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
30725
30711
  const params = [input.accountId];
@@ -30762,7 +30748,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
30762
30748
  return { clauses, params };
30763
30749
  }, "meetingSelectionSql");
30764
30750
 
30765
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
30751
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
30766
30752
  var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
30767
30753
  async meetingChatLines(input) {
30768
30754
  checkMeetingCancelled(input.signal);
@@ -30790,7 +30776,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
30790
30776
  }
30791
30777
  }), "meetingChatLinesOver");
30792
30778
 
30793
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/person-separation.js
30779
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/person-separation.js
30794
30780
  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");
30795
30781
  var MOVED_AWAY = `moved.identity_id IN (SELECT value FROM json_each(?))
30796
30782
  AND (moved.from_person_id IN (SELECT value FROM json_each(?))
@@ -30805,7 +30791,7 @@ var apart = /* @__PURE__ */ __name(({ database }, one2, other) => {
30805
30791
  var separated = /* @__PURE__ */ __name((context, one2, other) => one2 !== other && apart(context, { identities: identitiesOf(context, one2), person: one2 }, { identities: identitiesOf(context, other), person: other }), "separated");
30806
30792
  var identitySeparated = /* @__PURE__ */ __name((context, identity, person2) => apart(context, { identities: [identity] }, { identities: identitiesOf(context, person2).filter((pk) => pk !== identity), person: person2 }), "identitySeparated");
30807
30793
 
30808
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
30794
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
30809
30795
  var MESSAGE_FIELDS = {
30810
30796
  pk: messages.id,
30811
30797
  nativeId: messages.externalId,
@@ -30976,7 +30962,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
30976
30962
  storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
30977
30963
  }), "chatActivity");
30978
30964
 
30979
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
30965
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
30980
30966
  var HIT_FIELDS = {
30981
30967
  ...MESSAGE_FIELDS,
30982
30968
  chatTitle: sql`${chats.title}`.as("chat_title"),
@@ -31075,7 +31061,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
31075
31061
  };
31076
31062
  }, "directReplies");
31077
31063
 
31078
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
31064
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
31079
31065
  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");
31080
31066
  var required = /* @__PURE__ */ __name((context, ref3) => {
31081
31067
  const found2 = identityRow(context, ref3);
@@ -31209,7 +31195,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
31209
31195
  }, "mentioning");
31210
31196
  var escaped = /* @__PURE__ */ __name((text7) => text7.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
31211
31197
 
31212
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
31198
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
31213
31199
  var missing2 = /* @__PURE__ */ __name(() => {
31214
31200
  throw new CliError("not_found", "Meeting, participant or selected target not found");
31215
31201
  }, "missing");
@@ -31331,7 +31317,7 @@ function meetingContextLinksOver(context) {
31331
31317
  }
31332
31318
  __name(meetingContextLinksOver, "meetingContextLinksOver");
31333
31319
 
31334
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
31320
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
31335
31321
  var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
31336
31322
  var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
31337
31323
  var summaryOf = /* @__PURE__ */ __name((row2) => ({
@@ -31360,7 +31346,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
31360
31346
  return row2 ? summaryText(summaryOf(row2)) : null;
31361
31347
  }, "indexedText");
31362
31348
 
31363
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
31349
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
31364
31350
  var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
31365
31351
  var meetingCurrentIndexRows = `
31366
31352
  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
@@ -31391,7 +31377,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
31391
31377
  }, "invalidateMeetingStems");
31392
31378
  var meetingStemmableText = /* @__PURE__ */ __name((text7) => text7.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
31393
31379
 
31394
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
31380
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
31395
31381
  function meetingHitIndexOver({ database, now: now2 }) {
31396
31382
  return {
31397
31383
  async indexSearch(original) {
@@ -31459,10 +31445,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
31459
31445
  }
31460
31446
  __name(meetingHitIndexOver, "meetingHitIndexOver");
31461
31447
 
31462
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
31448
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
31463
31449
  import { createHash as createHash5 } from "node:crypto";
31464
31450
 
31465
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/search/lucene/plain.js
31451
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/search/lucene/plain.js
31466
31452
  var REPAIRED = /* @__PURE__ */ new Set([
31467
31453
  "query.invalid-syntax",
31468
31454
  "query.unclosed-literal",
@@ -31569,7 +31555,7 @@ var plainQuery = /* @__PURE__ */ __name((text7, fields4 = SEARCH_FIELDS) => {
31569
31555
  return text7;
31570
31556
  }, "plainQuery");
31571
31557
 
31572
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/search/trigrams.js
31558
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/search/trigrams.js
31573
31559
  var trigrams = /* @__PURE__ */ __name((term) => {
31574
31560
  const padded = ` ${term} `;
31575
31561
  const pieces = /* @__PURE__ */ new Set();
@@ -31578,7 +31564,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
31578
31564
  return [...pieces];
31579
31565
  }, "trigrams");
31580
31566
 
31581
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/search/correct.js
31567
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/search/correct.js
31582
31568
  var SHORTEST_CORRECTION = 3;
31583
31569
  var maxEdits = /* @__PURE__ */ __name((word2) => word2.length <= 4 ? 1 : 2, "maxEdits");
31584
31570
  var editDistance = /* @__PURE__ */ __name((a, b, max) => {
@@ -31625,7 +31611,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
31625
31611
  return corrections;
31626
31612
  }, "correctWords");
31627
31613
 
31628
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/search/garbled.js
31614
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/search/garbled.js
31629
31615
  var SHORTEST_GARBLED = 4;
31630
31616
  var MOST_WIDENED = 64;
31631
31617
  var plain = /* @__PURE__ */ __name((word2) => word2.replaceAll("\u044D", "\u0435"), "plain");
@@ -31717,7 +31703,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
31717
31703
  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));
31718
31704
  }, "widenWords");
31719
31705
 
31720
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
31706
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
31721
31707
  import { readFileSync } from "node:fs";
31722
31708
  var loaded;
31723
31709
  var dictionary = /* @__PURE__ */ __name(() => {
@@ -31776,7 +31762,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word2) => {
31776
31762
  return false;
31777
31763
  }, "knownRussianWord");
31778
31764
 
31779
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
31765
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
31780
31766
  var WORD3 = /[\p{L}\p{N}\p{M}]+/gu;
31781
31767
  var MOST_WORDS = 128;
31782
31768
  var quote = /* @__PURE__ */ __name((word2) => `"${word2.replaceAll('"', '""')}"`, "quote");
@@ -32003,7 +31989,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text7, stemmer) => {
32003
31989
  return check3(tree);
32004
31990
  }, "matchMeetingText");
32005
31991
 
32006
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
31992
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
32007
31993
  var fail3 = /* @__PURE__ */ __name((message3) => {
32008
31994
  throw new CliError("validation_error", message3);
32009
31995
  }, "fail");
@@ -32079,7 +32065,7 @@ function meetingHitSearchOver({ database }) {
32079
32065
  const tree = resolveMeetingQuery(database, input.accountId, ast, state);
32080
32066
  const key2 = fingerprint(JSON.stringify(tree), input, state.identity);
32081
32067
  const after2 = cursorOf(input.after, key2);
32082
- const pending2 = database.prepare(`SELECT 1 FROM meeting_index_pending p
32068
+ const pending = database.prepare(`SELECT 1 FROM meeting_index_pending p
32083
32069
  LEFT JOIN meeting_transcript_rows r ON p.indexable_type='meeting_transcript_row' AND r.id=p.id
32084
32070
  LEFT JOIN meeting_transcripts t ON t.id=r.meeting_transcript_id
32085
32071
  LEFT JOIN meeting_chat_messages c ON p.indexable_type='meeting_chat_message' AND c.id=p.id
@@ -32090,7 +32076,7 @@ function meetingHitSearchOver({ database }) {
32090
32076
  const coverage = {
32091
32077
  archiveCompleteness: "unknown",
32092
32078
  currentRevisions: true,
32093
- indexing: pending2 || !state.stemmer || state.through < state.watermark ? "pending" : "ready",
32079
+ indexing: pending || !state.stemmer || state.through < state.watermark ? "pending" : "ready",
32094
32080
  indexCompleteness: "unknown"
32095
32081
  };
32096
32082
  const { sql: matching2, params: queryParams } = meetingQuerySql(tree, state);
@@ -32185,7 +32171,7 @@ function meetingHitSearchOver({ database }) {
32185
32171
  }
32186
32172
  __name(meetingHitSearchOver, "meetingHitSearchOver");
32187
32173
 
32188
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-languages.js
32174
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-languages.js
32189
32175
  var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
32190
32176
  async fillTranscriptLanguages({ accountId, apply, now: now2 }) {
32191
32177
  positiveReadInteger(accountId, "accountId");
@@ -32217,7 +32203,7 @@ var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
32217
32203
  }
32218
32204
  }), "meetingLanguagesOver");
32219
32205
 
32220
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
32206
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
32221
32207
  import { createHash as createHash6 } from "node:crypto";
32222
32208
  var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
32223
32209
  if (value === void 0)
@@ -32307,7 +32293,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
32307
32293
  }
32308
32294
  }), "meetingParticipantSearchOver");
32309
32295
 
32310
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
32296
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
32311
32297
  var preparationQueries = {
32312
32298
  participants: {
32313
32299
  fields: "p.id, p.identity_id, p.display_name, l.person_id",
@@ -32357,7 +32343,7 @@ var preparationQueries = {
32357
32343
  }
32358
32344
  };
32359
32345
 
32360
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
32346
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
32361
32347
  var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
32362
32348
  async preparationContext(original) {
32363
32349
  const input = validateMeetingPreparationContext(original);
@@ -32398,7 +32384,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
32398
32384
  }
32399
32385
  }), "meetingPreparationContextOver");
32400
32386
 
32401
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
32387
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
32402
32388
  var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
32403
32389
  SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
32404
32390
  WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
@@ -32412,7 +32398,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
32412
32398
  JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
32413
32399
  )`, "preparationSubjects");
32414
32400
 
32415
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
32401
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
32416
32402
  var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
32417
32403
  async preparationKnowledge(original) {
32418
32404
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -32457,7 +32443,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
32457
32443
  }
32458
32444
  }), "meetingPreparationKnowledgeOver");
32459
32445
 
32460
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
32446
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
32461
32447
  var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
32462
32448
  async preparationNotes(original) {
32463
32449
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -32510,7 +32496,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
32510
32496
  }
32511
32497
  }), "meetingPreparationNotesOver");
32512
32498
 
32513
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
32499
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
32514
32500
  var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
32515
32501
  async relatedHistory(original) {
32516
32502
  const input = validateMeetingRelatedHistory(original);
@@ -32581,7 +32567,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
32581
32567
  }
32582
32568
  }), "meetingRelatedHistoryOver");
32583
32569
 
32584
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
32570
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
32585
32571
  var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
32586
32572
  var text3 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
32587
32573
  var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
@@ -32662,7 +32648,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
32662
32648
  }
32663
32649
  }), "meetingReviewOver");
32664
32650
 
32665
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
32651
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
32666
32652
  var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
32667
32653
  var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
32668
32654
  if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
@@ -32716,7 +32702,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
32716
32702
  }
32717
32703
  }), "meetingSeriesHistoryOver");
32718
32704
 
32719
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
32705
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
32720
32706
  var MOST_ROWS = 5e5;
32721
32707
  var meetingCountsSql = /* @__PURE__ */ __name((where) => `SELECT m.started_at, coalesce(m.duration_ms, m.ended_at - m.started_at) AS duration_ms,
32722
32708
  EXISTS (SELECT 1 FROM meeting_transcripts t WHERE t.meeting_id = m.id AND t.deleted_at IS NULL
@@ -32785,7 +32771,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
32785
32771
  }
32786
32772
  }), "meetingStatsOver");
32787
32773
 
32788
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
32774
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
32789
32775
  var CURSOR_KEY = "meetings";
32790
32776
  var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
32791
32777
  id: Number(row2.id),
@@ -33354,7 +33340,7 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
33354
33340
  };
33355
33341
  }, "meetingStoreOver");
33356
33342
 
33357
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
33343
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
33358
33344
  var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
33359
33345
  const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
33360
33346
  return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
@@ -33380,7 +33366,7 @@ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
33380
33366
  orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
33381
33367
  }, "release");
33382
33368
 
33383
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
33369
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
33384
33370
  var THREAD_COLUMNS = {
33385
33371
  subject: {
33386
33372
  where: /* @__PURE__ */ __name(({ value }) => ({
@@ -33397,7 +33383,7 @@ var threadRows = /* @__PURE__ */ __name((database, filter) => {
33397
33383
  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);
33398
33384
  }, "threadRows");
33399
33385
 
33400
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
33386
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
33401
33387
  var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
33402
33388
  id: `email:${place.emailId}`,
33403
33389
  chatId: place.threadExternalId,
@@ -33935,7 +33921,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
33935
33921
  }
33936
33922
  }), "mailStoreOver");
33937
33923
 
33938
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/search/dictionary.js
33924
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/search/dictionary.js
33939
33925
  import { readFileSync as readFileSync2 } from "node:fs";
33940
33926
  var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
33941
33927
  var folded5 = /* @__PURE__ */ __name((word2) => /^[а-яё'-]*$/.test(word2) ? word2.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word2), "folded");
@@ -34025,7 +34011,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
34025
34011
  }, "knownWord");
34026
34012
  var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
34027
34013
 
34028
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
34014
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
34029
34015
  var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
34030
34016
  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");
34031
34017
  var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
@@ -34111,7 +34097,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
34111
34097
  return found2;
34112
34098
  }, "spokenTranscripts");
34113
34099
 
34114
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
34100
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
34115
34101
  var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
34116
34102
  const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
34117
34103
  if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
@@ -34158,7 +34144,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
34158
34144
  });
34159
34145
  }, "placeHits");
34160
34146
 
34161
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-groups.js
34147
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-groups.js
34162
34148
  var GROUPS = {
34163
34149
  chat: {
34164
34150
  key: "m.chat_id",
@@ -34180,7 +34166,7 @@ var GROUPS = {
34180
34166
  }
34181
34167
  };
34182
34168
 
34183
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
34169
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
34184
34170
  var MESSAGES2 = {
34185
34171
  rows: "messages",
34186
34172
  threads: "chats",
@@ -34663,7 +34649,7 @@ var runCompiled = /* @__PURE__ */ __name(async (context, execution, by) => {
34663
34649
  };
34664
34650
  }, "runCompiled");
34665
34651
 
34666
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
34652
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
34667
34653
  function invalidMetadata() {
34668
34654
  throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
34669
34655
  }
@@ -34765,7 +34751,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
34765
34751
  };
34766
34752
  }), "counterTargets");
34767
34753
 
34768
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
34754
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
34769
34755
  var NOT_FILE_LIST = [...NOT_FILES].map((kind4) => `'${kind4}'`).join(",");
34770
34756
  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,
34771
34757
  att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
@@ -34884,7 +34870,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
34884
34870
  }));
34885
34871
  }, "attachmentViews");
34886
34872
 
34887
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
34873
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
34888
34874
  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");
34889
34875
  var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text7, source2) => {
34890
34876
  const { orm, database, now: now2 } = context;
@@ -34922,7 +34908,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
34922
34908
  keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
34923
34909
  }, "intoVoiceAttachment");
34924
34910
 
34925
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
34911
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
34926
34912
  var FIELDS = [
34927
34913
  "threadExternalId",
34928
34914
  "senderIdentityId",
@@ -35240,7 +35226,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
35240
35226
  reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
35241
35227
  }, "writeDerivedReactions");
35242
35228
 
35243
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/keys.js
35229
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/keys.js
35244
35230
  var keysOver = /* @__PURE__ */ __name((context) => {
35245
35231
  const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
35246
35232
  const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
@@ -35261,7 +35247,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
35261
35247
  };
35262
35248
  }, "keysOver");
35263
35249
 
35264
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
35250
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
35265
35251
  var accountGroupsOf = /* @__PURE__ */ __name((database) => {
35266
35252
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
35267
35253
  if (!row2)
@@ -35296,7 +35282,7 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
35296
35282
  database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
35297
35283
  }, "saveProfile");
35298
35284
 
35299
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
35285
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
35300
35286
  var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
35301
35287
  const owner = ownerPerson(context.database).id;
35302
35288
  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);
@@ -35318,7 +35304,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
35318
35304
  return personOf(context, ref3);
35319
35305
  }, "linkToOwner");
35320
35306
 
35321
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
35307
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
35322
35308
  var PROVIDERS_SETTING = "providers";
35323
35309
  var storedProvidersOf = /* @__PURE__ */ __name((database) => {
35324
35310
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
@@ -35366,7 +35352,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
35366
35352
  });
35367
35353
  }, "registerProvider");
35368
35354
 
35369
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
35355
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
35370
35356
  var DAY4 = 864e5;
35371
35357
  var RECENTLY_CLOSED_MS = 14 * DAY4;
35372
35358
  var TEXT_LIMIT = 20;
@@ -35565,7 +35551,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
35565
35551
  };
35566
35552
  }, "taskSimilarityOver");
35567
35553
 
35568
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
35554
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
35569
35555
  var SETTING3 = "taskCategories";
35570
35556
  var savedTaskCategories = /* @__PURE__ */ __name((database) => {
35571
35557
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
@@ -35584,7 +35570,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
35584
35570
  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);
35585
35571
  }, "saveTaskCategories");
35586
35572
 
35587
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
35573
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
35588
35574
  var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
35589
35575
  var ALLOWED = "taskAgentClose";
35590
35576
  var MIN = "taskAgentCloseMin";
@@ -35640,10 +35626,10 @@ var SUGGESTION_COLUMNS = [
35640
35626
  ];
35641
35627
  var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
35642
35628
 
35643
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/mail-findings.js
35629
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/mail-findings.js
35644
35630
  var MAIL_FINDINGS_KIND = "mail_findings";
35645
35631
 
35646
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/decisions.js
35632
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/decisions.js
35647
35633
  var TASK_CLOSE_KIND = "task_close";
35648
35634
  var DEFAULT_DECISION_POLICY = { agentDecisions: false, ruleProposalsOwnerOnly: true };
35649
35635
  var isOwnerOnlyKind = /* @__PURE__ */ __name((kind4) => kind4 === MAIL_FINDINGS_KIND || kind4 === MEETING_FINDINGS_KIND || kind4 === TASK_CLOSE_KIND || kind4 === SOURCE_REVIEW_KIND, "isOwnerOnlyKind");
@@ -35691,7 +35677,7 @@ var assertMayDecide = /* @__PURE__ */ __name((row2, by, policy = DEFAULT_DECISIO
35691
35677
  }, "assertMayDecide");
35692
35678
  var deciderAuthor = /* @__PURE__ */ __name((by) => by === "owner" ? "owner" : { bot: by.bot, ...by.model === void 0 ? {} : { model: by.model } }, "deciderAuthor");
35693
35679
 
35694
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/ref-summaries.js
35680
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/ref-summaries.js
35695
35681
  var PROFILE_PLACEHOLDER = "<profile>";
35696
35682
  var oneLine = /* @__PURE__ */ __name((text7) => singleLine(text7.replace(/\s+/g, " ").trim()), "oneLine");
35697
35683
  var openKind = /* @__PURE__ */ __name((kind4) => kind4 === "email" ? "message" : kind4 === "email_thread" ? "chat" : kind4 === "unknown" ? void 0 : kind4, "openKind");
@@ -35748,11 +35734,11 @@ var WORDS2 = {
35748
35734
  };
35749
35735
  var refLabel = /* @__PURE__ */ __name((summary) => {
35750
35736
  const named3 = summary.title === null ? summary.ref : `\xAB${oneLine(summary.title)}\xBB`;
35751
- const notes3 = [summary.in === null ? null : oneLine(summary.in), summary.state === "available" ? null : summary.state].filter((one2) => one2 !== null).join(", ");
35752
- return `${WORDS2[summary.kind]} ${named3}${notes3 === "" ? "" : ` (${notes3})`}`;
35737
+ const notes2 = [summary.in === null ? null : oneLine(summary.in), summary.state === "available" ? null : summary.state].filter((one2) => one2 !== null).join(", ");
35738
+ return `${WORDS2[summary.kind]} ${named3}${notes2 === "" ? "" : ` (${notes2})`}`;
35753
35739
  }, "refLabel");
35754
35740
 
35755
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/ref-summaries.js
35741
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/ref-summaries.js
35756
35742
  var EXCERPT_CHARS = 280;
35757
35743
  var TITLE_CHARS = 120;
35758
35744
  var MEMORY_TITLE_CHARS = 80;
@@ -36150,9 +36136,9 @@ var refReadsOf = /* @__PURE__ */ __name((database, texts2, { excerpt = false, no
36150
36136
  group.push({ text: text7, reference: reference2, keys: routed.keys });
36151
36137
  groups.set(routed.reader, group);
36152
36138
  }
36153
- const pending2 = [...groups.entries()];
36154
- while (pending2.length > 0) {
36155
- const [name, wanted] = pending2.shift();
36139
+ const pending = [...groups.entries()];
36140
+ while (pending.length > 0) {
36141
+ const [name, wanted] = pending.shift();
36156
36142
  const reader = READERS[name];
36157
36143
  const found2 = runReader(database, reader, wanted, excerpt, today);
36158
36144
  const fallback = FALLBACK[name];
@@ -36164,14 +36150,17 @@ var refReadsOf = /* @__PURE__ */ __name((database, texts2, { excerpt = false, no
36164
36150
  reads.set(one2.text, readOf(one2, row2, reader, excerpt));
36165
36151
  }
36166
36152
  if (fallback !== void 0 && missed.length > 0)
36167
- pending2.push([fallback, missed.map((one2) => ({ ...one2, keys: keysOf(fallback, one2.reference) }))]);
36153
+ pending.push([fallback, missed.map((one2) => ({ ...one2, keys: keysOf(fallback, one2.reference) }))]);
36168
36154
  }
36169
36155
  return reads;
36170
36156
  }, "refReadsOf");
36171
36157
  var summaryOf2 = /* @__PURE__ */ __name(({ sender, excerpt, ...summary }, withExcerpt) => withExcerpt ? { ...summary, excerpt } : summary, "summaryOf");
36172
36158
  var refSummariesOf = /* @__PURE__ */ __name((database, texts2, options = {}) => new Map([...refReadsOf(database, texts2, options)].map(([text7, read3]) => [text7, summaryOf2(read3, options.excerpt === true)])), "refSummariesOf");
36159
+ var refsStoreOver = /* @__PURE__ */ __name((context) => ({
36160
+ summaries: /* @__PURE__ */ __name(async (texts2, options) => refSummariesOf(context.database, texts2, { ...options, now: context.now() }), "summaries")
36161
+ }), "refsStoreOver");
36173
36162
 
36174
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
36163
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
36175
36164
  var sourceOf3 = /* @__PURE__ */ __name((read3, ref3) => ({
36176
36165
  ref: ref3,
36177
36166
  kind: read3.kind,
@@ -36209,7 +36198,7 @@ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => {
36209
36198
  });
36210
36199
  }, "evidenceSourcesOf");
36211
36200
 
36212
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/attachments/limits.js
36201
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/attachments/limits.js
36213
36202
  var MAX_FILE_BYTES = 50 * 1024 * 1024;
36214
36203
  var MAX_TEXT_CHARS = 2e6;
36215
36204
  var ATTACHMENT_LIMIT_ENV = [
@@ -36235,7 +36224,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
36235
36224
  return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
36236
36225
  }, "pdfPreviewLimits");
36237
36226
 
36238
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/ulid.js
36227
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/ulid.js
36239
36228
  import { randomBytes } from "node:crypto";
36240
36229
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
36241
36230
  var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
@@ -36248,7 +36237,7 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
36248
36237
  return time3 + random;
36249
36238
  }, "ulid");
36250
36239
 
36251
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
36240
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
36252
36241
  var FOLDED_FIELDS = ["title", "site", "language", "author"];
36253
36242
  var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
36254
36243
  if (!meta && !sections?.length)
@@ -36269,7 +36258,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
36269
36258
  return typeof language === "string" && language !== "" ? language : null;
36270
36259
  }, "languageOf");
36271
36260
 
36272
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
36261
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
36273
36262
  var isObject2 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
36274
36263
  var objectOf3 = /* @__PURE__ */ __name((value) => {
36275
36264
  if (isObject2(value))
@@ -36512,7 +36501,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
36512
36501
  };
36513
36502
  }, "filesStoreOver");
36514
36503
 
36515
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
36504
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
36516
36505
  var IMPORTED_DOCUMENT_QUERY = defineQuery({
36517
36506
  entity: "document",
36518
36507
  backend: "sql",
@@ -36558,7 +36547,7 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
36558
36547
  return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
36559
36548
  }, "importedDocumentWhere");
36560
36549
 
36561
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/note-dates.js
36550
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/note-dates.js
36562
36551
  var dateFileNotes = /* @__PURE__ */ __name((database, folder, dates) => {
36563
36552
  const fileAt = database.prepare("SELECT id, document_id FROM files WHERE account_id = ? AND external_id = ? AND kind <> 'folder' AND deleted_at IS NULL");
36564
36553
  const legacy = database.prepare("SELECT id FROM documents WHERE account_id = ? AND external_id = ? AND deleted_at IS NULL");
@@ -36579,7 +36568,7 @@ var dateFileNotes = /* @__PURE__ */ __name((database, folder, dates) => {
36579
36568
  return changed;
36580
36569
  }, "dateFileNotes");
36581
36570
 
36582
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/text-input.js
36571
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/text-input.js
36583
36572
  var textOf2 = /* @__PURE__ */ __name((text7, what, max = 1e5, allowEmpty = false) => {
36584
36573
  const value = text7.trim();
36585
36574
  if (!value && !allowEmpty || value.length > max)
@@ -36592,7 +36581,7 @@ var oneOf = /* @__PURE__ */ __name((value, allowed, what) => {
36592
36581
  return value;
36593
36582
  }, "oneOf");
36594
36583
 
36595
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
36584
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
36596
36585
  var NOTE_FORMATS = ["obsidian", "markdown"];
36597
36586
  var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
36598
36587
  var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso3(value), "optionalIso");
@@ -37125,7 +37114,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
37125
37114
  };
37126
37115
  }, "notesStoreOver");
37127
37116
 
37128
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
37117
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
37129
37118
  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";
37130
37119
  var iso4 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
37131
37120
  var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -37384,7 +37373,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
37384
37373
  };
37385
37374
  }, "memoriesStoreOver");
37386
37375
 
37387
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
37376
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
37388
37377
  var DEFAULT_FIRST_PASS_PER_CHAT = 0;
37389
37378
  var KEY = "taskFirstPassPerChat";
37390
37379
  var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
@@ -37404,7 +37393,7 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
37404
37393
  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);
37405
37394
  }, "saveFirstPassPerChat");
37406
37395
 
37407
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/external-links.js
37396
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/external-links.js
37408
37397
  var EXTERNAL_SERVICE = /^[a-z][a-z0-9-]{0,31}$/;
37409
37398
  var EXTERNAL_ID_CHARS = 200;
37410
37399
  var SOURCE_URL_CHARS = 2e3;
@@ -37431,7 +37420,7 @@ var sourceUrlOf = /* @__PURE__ */ __name((value, reason = "task.source-url") =>
37431
37420
  return text7;
37432
37421
  }, "sourceUrlOf");
37433
37422
 
37434
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
37423
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
37435
37424
  var TASK_SORTS = ["priority", "due", "created", "updated", "key", "state"];
37436
37425
  var field = /* @__PURE__ */ __name((name, type, example, more = {}) => ({
37437
37426
  name,
@@ -37654,7 +37643,7 @@ var withoutField = /* @__PURE__ */ __name((query, name) => {
37654
37643
  return root === void 0 ? void 0 : { ...query, root };
37655
37644
  }, "withoutField");
37656
37645
 
37657
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
37646
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
37658
37647
  var authorNamed = /* @__PURE__ */ __name((database, row2) => {
37659
37648
  if (row2.author_type == null)
37660
37649
  return null;
@@ -37682,7 +37671,7 @@ var addComment = /* @__PURE__ */ __name((context, task, body2, by) => {
37682
37671
  return commentsOf(database, task).find((one2) => one2.ref === `note:${made}`);
37683
37672
  }, "addComment");
37684
37673
 
37685
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
37674
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
37686
37675
  var TASK_RELATION_KINDS = [
37687
37676
  "blocked-by",
37688
37677
  "follow-up-of",
@@ -37812,7 +37801,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
37812
37801
  };
37813
37802
  }, "taskRelationsStoreOver");
37814
37803
 
37815
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
37804
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
37816
37805
  var TASK_ROLES = ["assignee", "reviewer", "watcher"];
37817
37806
  var iso5 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
37818
37807
  var recordTaskEvent = /* @__PURE__ */ __name((database, task, actor, kind4, changes, at) => {
@@ -38341,7 +38330,7 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
38341
38330
  };
38342
38331
  }, "workTasksOver");
38343
38332
 
38344
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
38333
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
38345
38334
  var taskCloseOver = /* @__PURE__ */ __name((context) => {
38346
38335
  const { database, now: now2 } = context;
38347
38336
  const liveRow = /* @__PURE__ */ __name((id2) => {
@@ -38390,7 +38379,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
38390
38379
  };
38391
38380
  }, "taskCloseOver");
38392
38381
 
38393
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
38382
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
38394
38383
  var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
38395
38384
  const { database, now: now2 } = context;
38396
38385
  const required3 = /* @__PURE__ */ __name((id2) => {
@@ -38608,7 +38597,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
38608
38597
  };
38609
38598
  }, "taskPairsOver");
38610
38599
 
38611
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/task-stats.js
38600
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/task-stats.js
38612
38601
  var ACCOUNT_SCOPE = "t.package_id IS NOT NULL AND t.deleted_at IS NULL AND t.project_id = ?";
38613
38602
  var TASK_STATS_SQL = {
38614
38603
  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"),
@@ -38647,7 +38636,7 @@ var taskStatsOver = /* @__PURE__ */ __name(({ database }, inbox) => ({
38647
38636
  }, "statNames")
38648
38637
  }), "taskStatsOver");
38649
38638
 
38650
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
38639
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
38651
38640
  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";
38652
38641
  var inboxProject = /* @__PURE__ */ __name(({ database, now: now2 }, account, create) => {
38653
38642
  const key2 = inboxKey(account);
@@ -38854,7 +38843,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
38854
38843
  throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
38855
38844
  }, "oneOf");
38856
38845
 
38857
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/accounts.js
38846
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/accounts.js
38858
38847
  var accountAccountsOver = /* @__PURE__ */ __name((context) => {
38859
38848
  const { database } = context;
38860
38849
  const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
@@ -38899,7 +38888,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
38899
38888
  };
38900
38889
  }, "accountsStoreOver");
38901
38890
 
38902
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
38891
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
38903
38892
  var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
38904
38893
  var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
38905
38894
  const message3 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
@@ -38923,7 +38912,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
38923
38912
  })), "keepDownloads");
38924
38913
  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");
38925
38914
 
38926
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/attachments.js
38915
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/attachments.js
38927
38916
  var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
38928
38917
  const { database } = context;
38929
38918
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -38980,7 +38969,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
38980
38969
  }, "keepAttachmentText")
38981
38970
  }), "attachmentsStoreOver");
38982
38971
 
38983
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
38972
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
38984
38973
  var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
38985
38974
  var pointerMover = /* @__PURE__ */ __name((context, type) => {
38986
38975
  const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
@@ -39165,7 +39154,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
39165
39154
  return done;
39166
39155
  }, "rekeyChats");
39167
39156
 
39168
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
39157
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
39169
39158
  var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
39170
39159
  var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
39171
39160
  var CHAT_LIST_KEY = "chat_list_complete";
@@ -39223,7 +39212,7 @@ var chatCoverage = /* @__PURE__ */ __name(({ database }, accountKey) => {
39223
39212
  return { ...coverage, oldestMessageAt: toIso(oldest) };
39224
39213
  }, "chatCoverage");
39225
39214
 
39226
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/chats.js
39215
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/chats.js
39227
39216
  var chatsStoreOver = /* @__PURE__ */ __name((context) => {
39228
39217
  const { database } = context;
39229
39218
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
@@ -39358,7 +39347,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
39358
39347
  };
39359
39348
  }, "chatsStoreOver");
39360
39349
 
39361
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
39350
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
39362
39351
  import { createHash as createHash7 } from "node:crypto";
39363
39352
  var BATCH_CONTEXT = 50;
39364
39353
  var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
@@ -39496,7 +39485,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
39496
39485
  var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
39497
39486
  ${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
39498
39487
 
39499
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
39488
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
39500
39489
  import { setTimeout } from "node:timers/promises";
39501
39490
  var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
39502
39491
  var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
@@ -39808,7 +39797,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
39808
39797
  AND NOT EXISTS (SELECT 1 FROM messages d
39809
39798
  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");
39810
39799
 
39811
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/conversations.js
39800
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/conversations.js
39812
39801
  var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
39813
39802
  const { database } = context;
39814
39803
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -39915,7 +39904,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
39915
39904
  };
39916
39905
  }, "conversationsStoreOver");
39917
39906
 
39918
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/counters.js
39907
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/counters.js
39919
39908
  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";
39920
39909
  var accountCountersOver = /* @__PURE__ */ __name((context) => {
39921
39910
  const { database } = context;
@@ -39940,7 +39929,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
39940
39929
  counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
39941
39930
  }), "countersStoreOver");
39942
39931
 
39943
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
39932
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
39944
39933
  var MENTION_STATUSES = ["found", "linked", "dismissed"];
39945
39934
  var MENTION_QUERY = defineQuery({
39946
39935
  entity: "mention",
@@ -40010,9 +39999,9 @@ var rebuildMentions = /* @__PURE__ */ __name((database, { now: now2, kinds: kind
40010
39999
  };
40011
40000
  }, "rebuildMentions");
40012
40001
  var mentionsState = /* @__PURE__ */ __name((database) => {
40013
- const pending2 = Number(database.prepare("SELECT count(*) AS n FROM mention_pending").get()?.n);
40002
+ const pending = Number(database.prepare("SELECT count(*) AS n FROM mention_pending").get()?.n);
40014
40003
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(REBUILT_AT);
40015
- return { pending: pending2, rebuiltAt: row2 ? JSON.parse(String(row2.value)) : null };
40004
+ return { pending, rebuiltAt: row2 ? JSON.parse(String(row2.value)) : null };
40016
40005
  }, "mentionsState");
40017
40006
  var SELECT = "SELECT mn.id, mn.kind, mn.value, mn.domain, mn.confidence, mn.status, mn.author, mn.source_field, mn.target_type, mn.target_id, mn.created_at, mn.start_offset, mn.end_offset, CASE WHEN mn.source_type = 'attachment' THEN " + mentionText("att") + " ELSE m.text END AS text, m.external_id AS message_id, m.sent_at, m.chat_id AS chat_pk, c.external_id AS chat_id FROM mentions mn LEFT JOIN attachments att ON mn.source_type = 'attachment' AND att.id = mn.source_id AND att.attachable_type = 'message' JOIN messages m ON mn.source_type IN ('message', 'attachment') AND m.id = CASE WHEN mn.source_type = 'attachment' THEN att.attachable_id ELSE mn.source_id END AND m.deleted_at IS NULL JOIN chats c ON c.id = m.chat_id ";
40018
40007
  var stored = /* @__PURE__ */ __name((row2) => ({
@@ -40156,7 +40145,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
40156
40145
  return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
40157
40146
  }, "listPlaces");
40158
40147
 
40159
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/mentions.js
40148
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/mentions.js
40160
40149
  var accountMentionsOver = /* @__PURE__ */ __name((context) => {
40161
40150
  const { database } = context;
40162
40151
  const { findAccountPk: findAccountPk2 } = keysOver(context);
@@ -40191,7 +40180,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
40191
40180
  places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
40192
40181
  }), "mentionsStoreOver");
40193
40182
 
40194
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
40183
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
40195
40184
  var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
40196
40185
  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");
40197
40186
  const rows = messageId === void 0 ? read3.all(chatKey) : read3.all(chatKey, messageId);
@@ -40206,7 +40195,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
40206
40195
  }));
40207
40196
  }, "documentLinkMessages");
40208
40197
 
40209
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
40198
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
40210
40199
  var stemmerFor = stemmerCache();
40211
40200
  var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
40212
40201
  if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
@@ -40250,7 +40239,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
40250
40239
  });
40251
40240
  }, "laterSharingRare");
40252
40241
 
40253
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/messages.js
40242
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/messages.js
40254
40243
  var accountMessagesOver = /* @__PURE__ */ __name((context) => {
40255
40244
  const { database } = context;
40256
40245
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
@@ -40385,7 +40374,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
40385
40374
  laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
40386
40375
  }), "messagesStoreOver");
40387
40376
 
40388
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
40377
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
40389
40378
  var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
40390
40379
  var iso6 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
40391
40380
  var personPreparation = /* @__PURE__ */ __name(({ database, now: now2 }, uid, { accounts: accounts2, limit }) => {
@@ -40410,7 +40399,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database, now: now2 }, uid, {
40410
40399
  project: row2.project_id == null ? null : `project:${row2.project_id}`,
40411
40400
  updatedAt: iso6(row2.updated_at)
40412
40401
  }));
40413
- const notes3 = database.prepare(`SELECT n.id,n.title,n.body,n.revision,n.updated_at FROM notes n
40402
+ const notes2 = database.prepare(`SELECT n.id,n.title,n.body,n.revision,n.updated_at FROM notes n
40414
40403
  JOIN persons owner ON n.author_type='person' AND n.author_id=owner.id AND owner.owner=1
40415
40404
  WHERE n.deleted_at IS NULL
40416
40405
  AND ((n.notable_type='person' AND n.notable_id=?) OR EXISTS(SELECT 1 FROM links l WHERE l.from_type='note'
@@ -40438,11 +40427,11 @@ var personPreparation = /* @__PURE__ */ __name(({ database, now: now2 }, uid, {
40438
40427
  source: row2.source_locator == null ? null : String(row2.source_locator),
40439
40428
  createdAt: iso6(row2.created_at)
40440
40429
  }));
40441
- return { facts: page3(facts2), notes: page3(notes3), tasks: page3(tasks2) };
40430
+ return { facts: page3(facts2), notes: page3(notes2), tasks: page3(tasks2) };
40442
40431
  });
40443
40432
  }, "personPreparation");
40444
40433
 
40445
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
40434
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
40446
40435
  var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
40447
40436
  const id2 = Number(uid);
40448
40437
  if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
@@ -40450,7 +40439,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
40450
40439
  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)));
40451
40440
  }, "personSeenInAccounts");
40452
40441
 
40453
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
40442
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
40454
40443
  var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
40455
40444
  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);
40456
40445
  if (!row2)
@@ -40469,8 +40458,8 @@ var NOTES_ABOUT = "SELECT n.* FROM notes n WHERE notable_type='identity' AND not
40469
40458
  var privateContact = /* @__PURE__ */ __name((context, key2, personId) => {
40470
40459
  const { account, identity } = required2(context, key2, personId);
40471
40460
  const alias2 = context.database.prepare("SELECT name AS alias FROM aliases WHERE account_id=? AND aliasable_type='identity' AND aliasable_id=? AND display=1").get(account, identity)?.alias;
40472
- const notes3 = context.database.prepare(`${NOTES_ABOUT} ORDER BY n.created_at, n.id`).all(identity).map((row2) => noteOf2(row2, personId));
40473
- return { personId, alias: alias2 == null ? null : String(alias2), notes: notes3 };
40461
+ const notes2 = context.database.prepare(`${NOTES_ABOUT} ORDER BY n.created_at, n.id`).all(identity).map((row2) => noteOf2(row2, personId));
40462
+ return { personId, alias: alias2 == null ? null : String(alias2), notes: notes2 };
40474
40463
  }, "privateContact");
40475
40464
  var setAlias = /* @__PURE__ */ __name((context, key2, personId, alias2) => {
40476
40465
  const { account, identity } = required2(context, key2, personId);
@@ -40517,7 +40506,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
40517
40506
  return { id: id2, personId, removed: true };
40518
40507
  }, "removeNote");
40519
40508
 
40520
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/people.js
40509
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/people.js
40521
40510
  var accountPeopleOver = /* @__PURE__ */ __name((context) => {
40522
40511
  const { database } = context;
40523
40512
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
@@ -40602,13 +40591,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
40602
40591
  };
40603
40592
  }, "peopleStoreOver");
40604
40593
 
40605
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
40594
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
40606
40595
  import { createHash as createHash9 } from "node:crypto";
40607
40596
 
40608
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
40597
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
40609
40598
  import { createHash as createHash8 } from "node:crypto";
40610
40599
 
40611
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
40600
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
40612
40601
  var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
40613
40602
  var AUTHOR_MEASURES = [
40614
40603
  "messages",
@@ -40748,7 +40737,7 @@ var withoutUrls = /* @__PURE__ */ __name((text7) => text7.replace(/\S+/gu, (toke
40748
40737
  var rankingWords = /* @__PURE__ */ __name((text7) => withoutUrls(text7).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
40749
40738
  var rankingQuestion = /* @__PURE__ */ __name((text7) => withoutUrls(text7).includes("?"), "rankingQuestion");
40750
40739
 
40751
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
40740
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
40752
40741
  var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
40753
40742
  var exhausted2 = /* @__PURE__ */ __name((budget) => {
40754
40743
  throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
@@ -40970,7 +40959,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
40970
40959
  };
40971
40960
  }, "rankReplyGraph");
40972
40961
 
40973
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
40962
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
40974
40963
  var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
40975
40964
  var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
40976
40965
  var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
@@ -41144,7 +41133,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
41144
41133
  return { items, evidence, summary, graph: graph.quality };
41145
41134
  }, "calculateAdminStatistics");
41146
41135
 
41147
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
41136
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
41148
41137
  var rankingContextRange = /* @__PURE__ */ __name((root) => {
41149
41138
  const dates = [];
41150
41139
  const visit = /* @__PURE__ */ __name((node, required3) => {
@@ -41166,7 +41155,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
41166
41155
  return dates[0].node.resolution.date;
41167
41156
  }, "rankingContextRange");
41168
41157
 
41169
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
41158
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
41170
41159
  var reactionCounts = /* @__PURE__ */ __name((stored4) => {
41171
41160
  let counts;
41172
41161
  try {
@@ -41461,7 +41450,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
41461
41450
  });
41462
41451
  }, "rankQuery");
41463
41452
 
41464
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
41453
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
41465
41454
  function fail4(message3, reason = "query.too-large") {
41466
41455
  throw new CliError("validation_error", message3, { reason, complete: false });
41467
41456
  }
@@ -41638,7 +41627,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
41638
41627
  return result;
41639
41628
  }), "adminStatisticsQuery");
41640
41629
 
41641
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
41630
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
41642
41631
  var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
41643
41632
  if (!execution.accounts.length)
41644
41633
  return { conversations: [], chats: [] };
@@ -41656,7 +41645,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
41656
41645
  return { conversations: conversations2, chats: chats2 };
41657
41646
  }, "conversationEligibility");
41658
41647
 
41659
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
41648
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
41660
41649
  import { createHash as createHash10 } from "node:crypto";
41661
41650
  var EVIDENCE_BYTES = 64 * 1024;
41662
41651
  var FINGERPRINT_BYTES = 8 * 1024 * 1024;
@@ -41806,7 +41795,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
41806
41795
  return result;
41807
41796
  }, "rankingEvidence");
41808
41797
 
41809
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/reply-times.js
41798
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/reply-times.js
41810
41799
  var FAR = Number.MAX_SAFE_INTEGER;
41811
41800
  var chatsIn = /* @__PURE__ */ __name((scope3, kinds2) => {
41812
41801
  const params = [...scope3.accounts.flatMap(({ provider, account }) => [provider, account]), ...kinds2];
@@ -41900,7 +41889,7 @@ var waitingChats = /* @__PURE__ */ __name((context, scope3, waits, cap) => {
41900
41889
  });
41901
41890
  }, "waitingChats");
41902
41891
 
41903
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/queries.js
41892
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/queries.js
41904
41893
  var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
41905
41894
  const mailIndexed = /* @__PURE__ */ __name((execution) => {
41906
41895
  if (execution.corpus === "mail")
@@ -41921,7 +41910,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
41921
41910
  };
41922
41911
  }, "queriesStoreOver");
41923
41912
 
41924
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
41913
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
41925
41914
  var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
41926
41915
  const { database, now: now2 } = context;
41927
41916
  const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
@@ -41960,10 +41949,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
41960
41949
  }));
41961
41950
  }, "chatEventsOf");
41962
41951
 
41963
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
41952
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
41964
41953
  import { createHash as createHash11 } from "node:crypto";
41965
41954
 
41966
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/calendar.js
41955
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/calendar.js
41967
41956
  var calendarKey = /* @__PURE__ */ __name((zone, by) => {
41968
41957
  const format = new Intl.DateTimeFormat("en-CA", {
41969
41958
  timeZone: zone,
@@ -41983,7 +41972,7 @@ var weekKey = /* @__PURE__ */ __name((day3) => {
41983
41972
  return date3.toISOString().slice(0, 10);
41984
41973
  }, "weekKey");
41985
41974
 
41986
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/retention.js
41975
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/retention.js
41987
41976
  var RETENTION_TOLERANCE = 864e5;
41988
41977
  var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
41989
41978
  const { since, until, cutoff, checkpoints, within, limit, by } = options;
@@ -42037,7 +42026,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
42037
42026
  return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
42038
42027
  }, "retentionCohorts");
42039
42028
 
42040
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
42029
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
42041
42030
  var iso7 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
42042
42031
  var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId, options, evidence) => {
42043
42032
  validateRetentionOptions(options);
@@ -42168,7 +42157,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
42168
42157
  };
42169
42158
  }, "retentionQuery");
42170
42159
 
42171
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
42160
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
42172
42161
  var iso8 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
42173
42162
  var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
42174
42163
  ...isBot === void 0 ? {} : { bot: isBot },
@@ -42299,7 +42288,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
42299
42288
  lastCount: memberCountsOf(context, pk).at(-1) ?? null
42300
42289
  })), "trackedChats");
42301
42290
 
42302
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/roster.js
42291
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/roster.js
42303
42292
  var rosterStoreOver = /* @__PURE__ */ __name((context) => {
42304
42293
  const { database } = context;
42305
42294
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
@@ -42355,7 +42344,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
42355
42344
  };
42356
42345
  }, "rosterStoreOver");
42357
42346
 
42358
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
42347
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
42359
42348
  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");
42360
42349
  var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
42361
42350
  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 ?`);
@@ -42379,7 +42368,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
42379
42368
  }
42380
42369
  }, "backfillNormalized");
42381
42370
 
42382
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
42371
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
42383
42372
  var INDEX2 = "message_words";
42384
42373
  var searchIndexState2 = /* @__PURE__ */ __name((database) => {
42385
42374
  const row2 = indexRow(database, INDEX2);
@@ -42387,14 +42376,14 @@ var searchIndexState2 = /* @__PURE__ */ __name((database) => {
42387
42376
  return void 0;
42388
42377
  const watermark = Number(row2.watermark);
42389
42378
  const filledThrough = Number(row2.filled_through);
42390
- const pending2 = pendingNormalization(database);
42379
+ const pending = pendingNormalization(database);
42391
42380
  const termsThrough = Number(row2.terms_through);
42392
42381
  const newest = newestMessage(database);
42393
42382
  return {
42394
42383
  watermark,
42395
42384
  filledThrough,
42396
- pendingNormalization: pending2,
42397
- ready: filledThrough >= watermark && pending2 === 0,
42385
+ pendingNormalization: pending,
42386
+ ready: filledThrough >= watermark && pending === 0,
42398
42387
  termsThrough,
42399
42388
  newest,
42400
42389
  termsReady: termsThrough >= newest,
@@ -42506,7 +42495,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
42506
42495
  });
42507
42496
  }, "resetSearchIndex");
42508
42497
 
42509
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
42498
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
42510
42499
  var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
42511
42500
  const filled2 = { stemmed: 0, drained: 0 };
42512
42501
  const before2 = stemsState(database);
@@ -42601,7 +42590,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
42601
42590
  return resetStems(database, { now: now2 });
42602
42591
  }, "followDefaultStemmers");
42603
42592
 
42604
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
42593
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
42605
42594
  var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
42606
42595
  var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
42607
42596
  const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
@@ -42623,7 +42612,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
42623
42612
  });
42624
42613
  }, "termCandidates");
42625
42614
 
42626
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/search-index.js
42615
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/search-index.js
42627
42616
  var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
42628
42617
  const { database } = context;
42629
42618
  const stemmerFor2 = stemmerCache();
@@ -42647,7 +42636,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
42647
42636
  };
42648
42637
  }, "searchIndexStoreOver");
42649
42638
 
42650
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
42639
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
42651
42640
  var HISTORY_KEPT = 1e3;
42652
42641
  var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
42653
42642
  var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
@@ -42716,7 +42705,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
42716
42705
  return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
42717
42706
  }, "clearHistory");
42718
42707
 
42719
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/searches.js
42708
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/searches.js
42720
42709
  var searchesStoreOver = /* @__PURE__ */ __name((context) => {
42721
42710
  const { database } = context;
42722
42711
  return {
@@ -42740,7 +42729,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
42740
42729
  };
42741
42730
  }, "searchesStoreOver");
42742
42731
 
42743
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/added-sources.js
42732
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/added-sources.js
42744
42733
  import { createHash as createHash12 } from "node:crypto";
42745
42734
  var ADDED_KINDS = ["text", "file", "page"];
42746
42735
  var sha256 = /* @__PURE__ */ __name((value) => createHash12("sha256").update(value).digest("hex"), "sha256");
@@ -42920,7 +42909,7 @@ var addedSourcesOver = /* @__PURE__ */ __name((context) => {
42920
42909
  };
42921
42910
  }, "addedSourcesOver");
42922
42911
 
42923
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
42912
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
42924
42913
  var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
42925
42914
  var ACTION_OUTCOMES = ["ok", "refused", "failed"];
42926
42915
  var CODE = /^[a-z][a-z0-9_]{0,63}$/;
@@ -42963,7 +42952,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
42963
42952
  };
42964
42953
  }, "agentActionsStoreOver");
42965
42954
 
42966
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
42955
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
42967
42956
  var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
42968
42957
  }) => {
42969
42958
  const { database, now: now2 } = context;
@@ -43022,7 +43011,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
43022
43011
  };
43023
43012
  }, "botUpdateStoreOver");
43024
43013
 
43025
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/reviewed.js
43014
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/reviewed.js
43026
43015
  var prefixesText = /* @__PURE__ */ __name((types) => `${article(types[0] ?? "")} ${types.map((type) => `${type}:`).join(" or ")}`, "prefixesText");
43027
43016
  var refuse = /* @__PURE__ */ __name((message3, reason, code = "validation_error") => {
43028
43017
  throw new CliError(code, message3, { reason });
@@ -43170,7 +43159,7 @@ var reviewedRowsOver = /* @__PURE__ */ __name((context) => {
43170
43159
  return { partyOf, partyThing, reviewedOf, written, keepEvidence, ownerOnly, linkedId, ...decisionsOver(context) };
43171
43160
  }, "reviewedRowsOver");
43172
43161
 
43173
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/business-contracts.js
43162
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/business-contracts.js
43174
43163
  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";
43175
43164
  var DAY_MS = 864e5;
43176
43165
  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");
@@ -43319,7 +43308,111 @@ var contractsStoreOver = /* @__PURE__ */ __name((context) => {
43319
43308
  };
43320
43309
  }, "contractsStoreOver");
43321
43310
 
43322
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
43311
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/business-search.js
43312
+ var BUSINESS_FIND_MAX = 2001;
43313
+ var party = /* @__PURE__ */ __name((kind4, id2, as) => `LEFT JOIN persons ${as}p ON ${kind4} = 'person' AND ${as}p.id = ${id2} AND ${as}p.owner = 0 LEFT JOIN organizations ${as}o ON ${kind4} = 'organization' AND ${as}o.id = ${id2} LEFT JOIN projects ${as}j ON ${kind4} = 'project' AND ${as}j.id = ${id2}`, "party");
43314
+ var partyName = /* @__PURE__ */ __name((as) => `coalesce(${as}p.name, ${as}o.name, ${as}j.name)`, "partyName");
43315
+ var LIVE2 = "x.deleted_at IS NULL";
43316
+ var DECIDED = `${LIVE2} AND x.review <> 'rejected'`;
43317
+ var SEARCHED = {
43318
+ 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}`,
43319
+ 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}`,
43320
+ 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}`,
43321
+ contract: `SELECT x.id, x.review, x.source, x.updated_at, x.name AS f1, x.number AS f2 FROM contracts x WHERE ${DECIDED}`,
43322
+ subscription: `SELECT x.id, x.review, x.source, x.updated_at, x.name AS f1 FROM subscriptions x WHERE ${DECIDED}`,
43323
+ 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 ${LIVE2}`,
43324
+ 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 ${LIVE2}`
43325
+ };
43326
+ var FIELDS2 = ["f1", "f2", "f3"];
43327
+ var TEXT_CHARS = 240;
43328
+ var KINDS_SQL = BUSINESS_KINDS.map((kind4) => `'${kind4}'`).join(", ");
43329
+ var IMPORT = "import:";
43330
+ var WORD_CHAR = /[\p{L}\p{N}]/u;
43331
+ var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}\0${account}`, "keyOf");
43332
+ var lineOf2 = /* @__PURE__ */ __name((parts2) => {
43333
+ const line = parts2.join(" \xB7 ").replace(/\s+/gu, " ").trim();
43334
+ return line.length <= TEXT_CHARS ? line : `${line.slice(0, TEXT_CHARS - 1)}\u2026`;
43335
+ }, "lineOf");
43336
+ var startsAWord = /* @__PURE__ */ __name((folded6, word2) => {
43337
+ for (let at = folded6.indexOf(word2); at !== -1; at = folded6.indexOf(word2, at + 1))
43338
+ if (at === 0 || !WORD_CHAR.test(folded6[at - 1]))
43339
+ return true;
43340
+ return false;
43341
+ }, "startsAWord");
43342
+ var businessSearchOver = /* @__PURE__ */ __name(({ database }) => {
43343
+ const matchedOf = /* @__PURE__ */ __name((kind4, wanted, anyWord) => database.prepare(SEARCHED[kind4]).all().flatMap((row2) => {
43344
+ const parts2 = FIELDS2.flatMap((field4) => row2[field4] == null ? [] : [String(row2[field4])]);
43345
+ const folded6 = fold(parts2.join("\n"));
43346
+ const score = wanted.filter((word2) => startsAWord(folded6, word2)).length;
43347
+ if (anyWord ? score === 0 : score < wanted.length)
43348
+ return [];
43349
+ const source2 = String(row2.source);
43350
+ return [
43351
+ {
43352
+ kind: kind4,
43353
+ id: Number(row2.id),
43354
+ review: row2.review === "proposed" ? "proposed" : "confirmed",
43355
+ imported: source2.startsWith(IMPORT) ? source2.slice(IMPORT.length) : void 0,
43356
+ parts: parts2,
43357
+ score,
43358
+ updatedAt: Number(row2.updated_at)
43359
+ }
43360
+ ];
43361
+ }), "matchedOf");
43362
+ const sourcesOf2 = /* @__PURE__ */ __name((matched) => {
43363
+ const sources = /* @__PURE__ */ new Map();
43364
+ for (const kind4 of BUSINESS_KINDS) {
43365
+ const ids = matched.filter((one2) => one2.kind === kind4 && one2.imported !== void 0).map(({ id: id2 }) => id2);
43366
+ if (!ids.length)
43367
+ continue;
43368
+ 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(kind4, JSON.stringify(ids));
43369
+ for (const row2 of rows) {
43370
+ const ref3 = `${kind4}:${row2.entity_id}`;
43371
+ if (!sources.has(ref3))
43372
+ sources.set(ref3, {
43373
+ provider: String(row2.provider),
43374
+ account: String(row2.account),
43375
+ externalId: String(row2.external_id)
43376
+ });
43377
+ }
43378
+ }
43379
+ return sources;
43380
+ }, "sourcesOf");
43381
+ const find2 = /* @__PURE__ */ __name(({ words: words3, anyWord = false, accounts: accounts2, limit }) => {
43382
+ const wanted = [...new Set(words3.map((word2) => fold(word2).trim()).filter(Boolean))];
43383
+ if (!wanted.length)
43384
+ return [];
43385
+ const most2 = Math.min(Math.max(limit ?? 100, 1), BUSINESS_FIND_MAX);
43386
+ const within = accounts2 === void 0 ? void 0 : new Set(accounts2.map(keyOf4));
43387
+ const matched = BUSINESS_KINDS.flatMap((kind4) => matchedOf(kind4, wanted, anyWord)).sort((a, b) => b.score - a.score || b.updatedAt - a.updatedAt || a.kind.localeCompare(b.kind) || b.id - a.id);
43388
+ const candidates = within === void 0 ? matched.slice(0, most2) : matched.filter((one2) => one2.imported);
43389
+ const sources = sourcesOf2(candidates);
43390
+ const kept2 = within === void 0 ? candidates : candidates.filter((one2) => {
43391
+ const source2 = sources.get(`${one2.kind}:${one2.id}`);
43392
+ return source2 !== void 0 && within.has(keyOf4(source2));
43393
+ }).slice(0, most2);
43394
+ return kept2.map((one2) => {
43395
+ const ref3 = `${one2.kind}:${one2.id}`;
43396
+ const source2 = sources.get(ref3);
43397
+ return {
43398
+ kind: one2.kind,
43399
+ ref: ref3,
43400
+ review: one2.review,
43401
+ ...one2.imported === void 0 ? {} : { imported: one2.imported },
43402
+ ...source2 === void 0 ? {} : { source: source2 },
43403
+ text: lineOf2(one2.parts),
43404
+ updatedAt: one2.updatedAt
43405
+ };
43406
+ });
43407
+ }, "find");
43408
+ 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");
43409
+ return {
43410
+ find: /* @__PURE__ */ __name(async (search2) => find2(search2), "find"),
43411
+ accounts: /* @__PURE__ */ __name(async () => sourceAccounts(), "accounts")
43412
+ };
43413
+ }, "businessSearchOver");
43414
+
43415
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
43323
43416
  var DAY5 = 864e5;
43324
43417
  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}')`;
43325
43418
  var accountsOf = /* @__PURE__ */ __name((filter) => {
@@ -43429,7 +43522,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
43429
43522
  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);
43430
43523
  }, "listEvents");
43431
43524
 
43432
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-forget.js
43525
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-forget.js
43433
43526
  var distinctIds = /* @__PURE__ */ __name((rows) => [...new Set(rows.map((row2) => Number(row2.id)))], "distinctIds");
43434
43527
  var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, accountId, cursorKey: cursorKey2, now: now2 }, refresh) => {
43435
43528
  const unseenBefore = unreferenced(database, "identities");
@@ -43486,7 +43579,7 @@ var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, account
43486
43579
  return { entries: entryIds.length, events: goneEvents.length };
43487
43580
  }, "forgetCalendarRows");
43488
43581
 
43489
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
43582
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
43490
43583
  var calendarOf = /* @__PURE__ */ __name((row2) => ({
43491
43584
  id: Number(row2.id),
43492
43585
  accountId: Number(row2.account_id),
@@ -44089,7 +44182,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
44089
44182
  };
44090
44183
  }, "eventStoreOver");
44091
44184
 
44092
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
44185
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
44093
44186
  var CATALOG_QUERY = defineQuery({
44094
44187
  entity: "document",
44095
44188
  backend: "sql",
@@ -44331,7 +44424,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
44331
44424
  };
44332
44425
  }, "catalogStoreOver");
44333
44426
 
44334
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
44427
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
44335
44428
  var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
44336
44429
  var field3 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
44337
44430
  CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
@@ -44344,7 +44437,7 @@ var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
44344
44437
  THEN 'source-modified' ELSE 'stored-update' END`;
44345
44438
  var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field3("sourceUrl")})`;
44346
44439
 
44347
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
44440
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
44348
44441
  var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
44349
44442
  const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
44350
44443
  signal?.throwIfAborted();
@@ -44443,7 +44536,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
44443
44536
  });
44444
44537
  }, "readMeetingContextEvidence");
44445
44538
 
44446
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
44539
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
44447
44540
  var corpora = {
44448
44541
  message: {
44449
44542
  table: "messages",
@@ -44682,10 +44775,10 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
44682
44775
  }
44683
44776
  }), "contextRecordsOver");
44684
44777
 
44685
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/crm.js
44778
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/crm.js
44686
44779
  var isItemKind = /* @__PURE__ */ __name((kind4) => kind4 === "deal" || kind4 === "lead", "isItemKind");
44687
44780
 
44688
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/records.js
44781
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/records.js
44689
44782
  import { createHash as createHash13 } from "node:crypto";
44690
44783
  var RECORDS_SCHEMA_VERSION = 1;
44691
44784
  var RECORD_OPERATIONS = ["upsert", "delete"];
@@ -45029,7 +45122,7 @@ var fieldReferences = /* @__PURE__ */ __name((record4, options = {}) => {
45029
45122
  return found2;
45030
45123
  }, "fieldReferences");
45031
45124
 
45032
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-rows.js
45125
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-rows.js
45033
45126
  var TABLES2 = { deal: "deals", lead: "leads" };
45034
45127
  var SOURCE = "crm";
45035
45128
  var crmIdentityId = /* @__PURE__ */ __name((key2, externalId, type = "contact") => `${idPart(key2.account)}/${type}/${idPart(externalId)}`, "crmIdentityId");
@@ -45158,7 +45251,7 @@ var crmRowsOver = /* @__PURE__ */ __name((context) => {
45158
45251
  return { savePipeline, saveItemRow };
45159
45252
  }, "crmRowsOver");
45160
45253
 
45161
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-settings.js
45254
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-settings.js
45162
45255
  var CRM_LINK_MODES = ["reported", "review"];
45163
45256
  var COMPANY_TYPE_MEANINGS = ["customer-of", "supplier", "partner-of"];
45164
45257
  var crmSettingKey = /* @__PURE__ */ __name((key2, name) => `crm.${key2.provider}:${key2.account}.${name}`, "crmSettingKey");
@@ -45221,10 +45314,25 @@ var crmSettingsOf = /* @__PURE__ */ __name((database) => database.prepare("SELEC
45221
45314
  ];
45222
45315
  }), "crmSettingsOf");
45223
45316
 
45224
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/money-lines.js
45317
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/money-lines.js
45318
+ var MAX_LINES = 500;
45225
45319
  var PARENTS = {
45226
- invoice: { table: "invoice_lines", column: "invoice_id", reasons: "finance" },
45227
- order: { table: "order_lines", column: "order_id", reasons: "order" }
45320
+ invoice: {
45321
+ parents: "invoices",
45322
+ table: "invoice_lines",
45323
+ column: "invoice_id",
45324
+ reasons: "finance",
45325
+ full: "finance.lines",
45326
+ instead: "reject or void the invoice instead"
45327
+ },
45328
+ order: {
45329
+ parents: "orders",
45330
+ table: "order_lines",
45331
+ column: "order_id",
45332
+ reasons: "order",
45333
+ full: "order.field",
45334
+ instead: "reject or cancel the order instead"
45335
+ }
45228
45336
  };
45229
45337
  var moneyLinesOver = /* @__PURE__ */ __name(({ database }) => {
45230
45338
  const productOf2 = /* @__PURE__ */ __name((reference2, what, code) => {
@@ -45236,7 +45344,7 @@ var moneyLinesOver = /* @__PURE__ */ __name(({ database }) => {
45236
45344
  refuse(`product:${row2.id} is deleted`, code("lines"));
45237
45345
  return row2;
45238
45346
  }, "productOf");
45239
- const priced2 = /* @__PURE__ */ __name((parent2, line, at, currency2) => {
45347
+ const priced = /* @__PURE__ */ __name((parent2, line, at, currency2) => {
45240
45348
  const code = /* @__PURE__ */ __name((name) => `${PARENTS[parent2].reasons}.${name}`, "code");
45241
45349
  const what = `line ${at + 1}`;
45242
45350
  const product = line.product === void 0 ? null : productOf2(line.product, what, code);
@@ -45260,7 +45368,7 @@ var moneyLinesOver = /* @__PURE__ */ __name(({ database }) => {
45260
45368
  productId: product === null ? null : Number(product.id)
45261
45369
  };
45262
45370
  }, "priced");
45263
- const linesOf = /* @__PURE__ */ __name((parent2, lines, currency2) => lines.map((line, at) => priced2(parent2, line, at, currency2)), "linesOf");
45371
+ const linesOf = /* @__PURE__ */ __name((parent2, lines, currency2) => lines.map((line, at) => priced(parent2, line, at, currency2)), "linesOf");
45264
45372
  const insertLines = /* @__PURE__ */ __name((parent2, id2, lines, from2, at) => {
45265
45373
  const { table, column: column2 } = PARENTS[parent2];
45266
45374
  const insert = database.prepare(`INSERT INTO ${table} (${column2}, position, description, quantity, unit_price, amount, catalog_item_id, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`);
@@ -45279,10 +45387,34 @@ var moneyLinesOver = /* @__PURE__ */ __name(({ database }) => {
45279
45387
  product: line.catalog_item_id == null ? null : `product:${line.catalog_item_id}`
45280
45388
  }));
45281
45389
  }, "shownLines");
45282
- return { linesOf, insertLines, shownLines };
45390
+ const appendLine = /* @__PURE__ */ __name((parent2, id2, line, at) => {
45391
+ const { table, column: column2, full } = PARENTS[parent2];
45392
+ const last = Number(database.prepare(`SELECT coalesce(max(position), 0) AS n FROM ${table} WHERE ${column2} = ?`).get(id2)?.n);
45393
+ if (last >= MAX_LINES)
45394
+ refuse(`an ${parent2} has at most ${MAX_LINES} lines`, full);
45395
+ insertLines(parent2, id2, [line], last + 1, at);
45396
+ }, "appendLine");
45397
+ const deleteLine = /* @__PURE__ */ __name((parent2, id2, position2) => {
45398
+ const { table, column: column2, reasons, instead } = PARENTS[parent2];
45399
+ const lines = Number(database.prepare(`SELECT count(*) AS n FROM ${table} WHERE ${column2} = ?`).get(id2)?.n);
45400
+ const gone = database.prepare(`DELETE FROM ${table} WHERE ${column2} = ? AND position = ?`).run(id2, position2);
45401
+ if (gone.changes === 0)
45402
+ throw new CliError("not_found", `${parent2}:${id2} has no line ${position2}`, { reason: `${reasons}.no-line` });
45403
+ if (lines === 1)
45404
+ refuse(`line ${position2} is the last of ${parent2}:${id2}; ${instead}`, `${reasons}.line`);
45405
+ }, "deleteLine");
45406
+ const sumOf = /* @__PURE__ */ __name((parent2, id2) => {
45407
+ const { table, column: column2 } = PARENTS[parent2];
45408
+ return Number(database.prepare(`SELECT coalesce(sum(amount), 0) AS n FROM ${table} WHERE ${column2} = ?`).get(id2)?.n);
45409
+ }, "sumOf");
45410
+ const retotal = /* @__PURE__ */ __name((parent2, id2, at) => {
45411
+ const { parents, table, column: column2 } = PARENTS[parent2];
45412
+ database.prepare(`UPDATE ${parents} SET total = coalesce((SELECT sum(amount) FROM ${table} WHERE ${column2} = ?), total), updated_at = ? WHERE id = ?`).run(id2, at, id2);
45413
+ }, "retotal");
45414
+ return { linesOf, insertLines, shownLines, appendLine, deleteLine, sumOf, retotal };
45283
45415
  }, "moneyLinesOver");
45284
45416
 
45285
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/refunds.js
45417
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/refunds.js
45286
45418
  var COUNTED = {
45287
45419
  confirmed: "np.review = 'confirmed' AND np.deleted_at IS NULL",
45288
45420
  // A proposed refund promises nothing back yet, so it must not free room an import could then fill.
@@ -45357,10 +45489,9 @@ var refundRulesOver = /* @__PURE__ */ __name((context) => {
45357
45489
  return { originalFor, refundShare, confirmable, keepsRefunded, keepsShare, keepsInvoice };
45358
45490
  }, "refundRulesOver");
45359
45491
 
45360
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/finance.js
45492
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/finance.js
45361
45493
  var FINANCE_TYPES = ["invoice", "payment"];
45362
45494
  var isFinanceType = /* @__PURE__ */ __name((type) => FINANCE_TYPES.includes(type), "isFinanceType");
45363
- var MAX_LINES = 500;
45364
45495
  var PAID = netPaidSql("i.id");
45365
45496
  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`;
45366
45497
  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";
@@ -45543,6 +45674,28 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
45543
45674
  for (const refund of [true, false])
45544
45675
  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);
45545
45676
  }, "dropAllocations");
45677
+ const mayChangeLines = /* @__PURE__ */ __name((row2, by) => {
45678
+ 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`);
45679
+ if (row2.deleted_at != null || row2.review === "rejected" || row2.status === "void")
45680
+ refuse(`invoice:${row2.id} is ${row2.deleted_at != null ? "deleted" : row2.review === "rejected" ? "rejected" : "void"}`, "finance.status");
45681
+ }, "mayChangeLines");
45682
+ const relined = /* @__PURE__ */ __name((row2, change) => {
45683
+ const [id2, currency2] = [Number(row2.id), String(row2.currency)];
45684
+ write(database, () => {
45685
+ change(id2);
45686
+ const total = lines.sumOf("invoice", id2);
45687
+ if (!Number.isSafeInteger(total))
45688
+ refuse("an invoice's total is too large", "finance.total");
45689
+ if (total <= 0)
45690
+ refuse("an invoice totals more than 0", "finance.total");
45691
+ const paid = Number(database.prepare(`SELECT ${netPaidSql("?")} AS n`).get(id2)?.n);
45692
+ if (total < paid)
45693
+ refuse(`${moneyLabel(paid, currency2)} is paid on invoice:${id2}; its lines cannot total ${moneyLabel(total, currency2)}`, "finance.below-paid");
45694
+ lines.retotal("invoice", id2, now2());
45695
+ settle(id2);
45696
+ });
45697
+ return invoiceDetail(`invoice:${id2}`);
45698
+ }, "relined");
45546
45699
  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");
45547
45700
  return {
45548
45701
  addInvoice: /* @__PURE__ */ __name((input) => {
@@ -45550,8 +45703,8 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
45550
45703
  const currency2 = currencyOf(input.currency);
45551
45704
  if (!Array.isArray(input.lines) || input.lines.length === 0 || input.lines.length > MAX_LINES)
45552
45705
  refuse(`an invoice has 1\u2013${MAX_LINES} lines`, "finance.lines");
45553
- const priced2 = lines.linesOf("invoice", input.lines, currency2);
45554
- const total = priced2.reduce((sum, line) => sum + line.amount, 0);
45706
+ const priced = lines.linesOf("invoice", input.lines, currency2);
45707
+ const total = priced.reduce((sum, line) => sum + line.amount, 0);
45555
45708
  if (!Number.isSafeInteger(total))
45556
45709
  refuse("an invoice's total is too large", "finance.total");
45557
45710
  if (total <= 0)
@@ -45572,13 +45725,24 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
45572
45725
  const by = written(input);
45573
45726
  const at = now2();
45574
45727
  const made = Number(database.prepare("INSERT INTO invoices (direction, number, issuer_type, issuer_id, counterparty_type, counterparty_id, project_id, currency, total, issue_date, due_date, status, review, author_type, author_id, model, confirmed_by_type, confirmed_by_id, source, metadata, created_at, updated_at, contract_id, subscription_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(direction, number3, issuer?.type ?? null, issuer?.id ?? null, counterparty.type, counterparty.id, by.project, currency2, total, issueDate, dueDate, input.draft ? "draft" : "issued", by.review, by.actor.type, by.actor.id, by.model, by.confirmedType, by.confirmedId, by.source, by.metadata, at, at, contract, subscription)?.id);
45575
- lines.insertLines("invoice", made, priced2, 1, at);
45728
+ lines.insertLines("invoice", made, priced, 1, at);
45576
45729
  keepEvidence("invoice", made, by);
45577
45730
  return made;
45578
45731
  });
45579
45732
  return invoiceDetail(`invoice:${id2}`);
45580
45733
  }, "addInvoice"),
45581
45734
  invoice: /* @__PURE__ */ __name((reference2) => invoiceDetail(reference2), "invoice"),
45735
+ addInvoiceLine: /* @__PURE__ */ __name((reference2, { by, ...line }) => {
45736
+ const row2 = rowOf2(reference2, "invoice");
45737
+ mayChangeLines(row2, by);
45738
+ const [priced] = lines.linesOf("invoice", [line], String(row2.currency));
45739
+ return relined(row2, (id2) => lines.appendLine("invoice", id2, priced, now2()));
45740
+ }, "addInvoiceLine"),
45741
+ removeInvoiceLine: /* @__PURE__ */ __name((reference2, { position: position2, by }) => {
45742
+ const row2 = rowOf2(reference2, "invoice");
45743
+ mayChangeLines(row2, by);
45744
+ return relined(row2, (id2) => lines.deleteLine("invoice", id2, position2));
45745
+ }, "removeInvoiceLine"),
45582
45746
  invoices: /* @__PURE__ */ __name((filter = {}) => {
45583
45747
  const project2 = filter.project === void 0 ? null : projectId(database, filter.project);
45584
45748
  const counterparty = partyThing(filter.counterparty, "the counterparty");
@@ -45645,10 +45809,10 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
45645
45809
  payment: /* @__PURE__ */ __name((reference2) => paymentDetail(reference2), "payment"),
45646
45810
  payments: /* @__PURE__ */ __name((filter = {}) => {
45647
45811
  const project2 = filter.project === void 0 ? null : projectId(database, filter.project);
45648
- const party2 = partyThing(filter.party, "the party");
45812
+ const party3 = partyThing(filter.party, "the party");
45649
45813
  const by = proposedBySql("p.author_type", "p.author_id", filter.proposedBy);
45650
45814
  const review = filter.review === void 0 ? null : oneOf4(filter.review, FINANCE_REVIEWS, "a review");
45651
- 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);
45815
+ 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);
45652
45816
  }, "payments"),
45653
45817
  allocate: /* @__PURE__ */ __name(({ payment, invoice, amount, by }) => {
45654
45818
  const row2 = rowOf2(payment, "payment");
@@ -45707,6 +45871,8 @@ var financeStoreOver = /* @__PURE__ */ __name((context) => {
45707
45871
  return {
45708
45872
  addInvoice: /* @__PURE__ */ __name(async (input) => operations.addInvoice(input), "addInvoice"),
45709
45873
  invoice: /* @__PURE__ */ __name(async (reference2) => operations.invoice(reference2), "invoice"),
45874
+ addInvoiceLine: /* @__PURE__ */ __name(async (reference2, input) => operations.addInvoiceLine(reference2, input), "addInvoiceLine"),
45875
+ removeInvoiceLine: /* @__PURE__ */ __name(async (reference2, input) => operations.removeInvoiceLine(reference2, input), "removeInvoiceLine"),
45710
45876
  invoices: /* @__PURE__ */ __name(async (filter) => operations.invoices(filter), "invoices"),
45711
45877
  issueInvoice: /* @__PURE__ */ __name(async (reference2, by) => operations.issueInvoice(reference2, by), "issueInvoice"),
45712
45878
  voidInvoice: /* @__PURE__ */ __name(async (reference2, by) => operations.voidInvoice(reference2, by), "voidInvoice"),
@@ -45721,7 +45887,7 @@ var financeStoreOver = /* @__PURE__ */ __name((context) => {
45721
45887
  };
45722
45888
  }, "financeStoreOver");
45723
45889
 
45724
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-entries.js
45890
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-entries.js
45725
45891
  var refuse2 = /* @__PURE__ */ __name((message3, reason) => {
45726
45892
  throw new CliError("validation_error", message3, { reason });
45727
45893
  }, "refuse");
@@ -45737,7 +45903,7 @@ var entryAmount = /* @__PURE__ */ __name((payment) => {
45737
45903
  return refuse2(`${payment.currency} has ${scale} decimals; ${payment.amount} does not fit`, "money.amount");
45738
45904
  return formatDecimal(cents / shift, scale);
45739
45905
  }, "entryAmount");
45740
- var party = /* @__PURE__ */ __name((payment) => /^(person|organization):/.test(payment.counterparty ?? "") ? payment.counterparty : null, "party");
45906
+ var party2 = /* @__PURE__ */ __name((payment) => /^(person|organization):/.test(payment.counterparty ?? "") ? payment.counterparty : null, "party");
45741
45907
  var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
45742
45908
  const finance = financeOperationsOver(context);
45743
45909
  const today = /* @__PURE__ */ __name(() => new Date(context.now()).toISOString().slice(0, 10), "today");
@@ -45761,7 +45927,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
45761
45927
  ...by === "owner" ? {} : { source: "agent", reason: entry2.statement ?? paymentTitle(entry2) },
45762
45928
  evidence: entry2.evidence
45763
45929
  };
45764
- const counterparty = party(payment);
45930
+ const counterparty = party2(payment);
45765
45931
  if (payment.state === "cancelled") {
45766
45932
  if (entry2.supersedes === void 0)
45767
45933
  return refuse2("a cancelled payment names the invoice it cancels", "finance.ref");
@@ -45799,7 +45965,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
45799
45965
  };
45800
45966
  }, "paymentEntriesOver");
45801
45967
 
45802
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
45968
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
45803
45969
  var EVIDENCE_FINDINGS_KIND = "evidence_findings";
45804
45970
  var reference = /* @__PURE__ */ __name((raw) => {
45805
45971
  if (/^(document|note):[1-9]\d*$/.test(raw))
@@ -45825,7 +45991,7 @@ var validateEvidenceFindings = /* @__PURE__ */ __name((input) => {
45825
45991
  return valid;
45826
45992
  }, "validateEvidenceFindings");
45827
45993
 
45828
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
45994
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
45829
45995
  var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
45830
45996
  var PROPOSAL_VERDICTS = ["useful", "not_useful"];
45831
45997
  var iso10 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
@@ -45913,11 +46079,11 @@ var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
45913
46079
  }, "propose"),
45914
46080
  get: /* @__PURE__ */ __name((id2) => actionOf(rowOf2(id2)), "get"),
45915
46081
  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"),
45916
- list: /* @__PURE__ */ __name(({ status: status2, limit = 100, kinds: kinds2, except, proposedBy, project: project2 } = {}) => {
46082
+ list: /* @__PURE__ */ __name(({ status: status2, limit = 100, kinds: kinds2, except, proposedBy, project: project2, evidence } = {}) => {
45917
46083
  if (status2 !== void 0 && !PROPOSAL_STATUSES.includes(status2))
45918
46084
  throw new CliError("validation_error", `a status is one of ${PROPOSAL_STATUSES.join(", ")}`);
45919
46085
  const by = proposedBySql("p.proposed_by_type", "p.proposed_by_id", proposedBy);
45920
- 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);
46086
+ 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);
45921
46087
  }, "list"),
45922
46088
  approve: /* @__PURE__ */ __name((id2, result, by) => decide2(id2, "approved", result, by), "approve"),
45923
46089
  reject: /* @__PURE__ */ __name((id2, by, result) => decide2(id2, "rejected", result, by), "reject"),
@@ -46006,7 +46172,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
46006
46172
  };
46007
46173
  }, "proposedActionsStoreOver");
46008
46174
 
46009
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-roles.js
46175
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-roles.js
46010
46176
  var settingOf = /* @__PURE__ */ __name((list2) => `relationships.roles.${list2}`, "settingOf");
46011
46177
  var isList = /* @__PURE__ */ __name((list2) => Object.hasOwn(ROLE_LISTS, list2), "isList");
46012
46178
  var listOf = /* @__PURE__ */ __name((list2) => {
@@ -46078,7 +46244,7 @@ var relationRolesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
46078
46244
  };
46079
46245
  }, "relationRolesOver");
46080
46246
 
46081
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-proposals.js
46247
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-proposals.js
46082
46248
  var isoOf = /* @__PURE__ */ __name((ms) => ms === void 0 ? null : new Date(ms).toISOString(), "isoOf");
46083
46249
  var relationOf = /* @__PURE__ */ __name((link3, now2) => ({
46084
46250
  id: link3.id,
@@ -46198,12 +46364,12 @@ var relationProposalsOver = /* @__PURE__ */ __name((context) => {
46198
46364
  const { from: from2, existing: existing2 } = found2;
46199
46365
  const { to } = found2.ends;
46200
46366
  const rows = database.prepare("SELECT id, status FROM proposed_actions WHERE kind='relationship' AND status IN ('proposed','rejected') AND target_type=? AND target_id=? AND json_extract(payload,'$.to')=? AND json_extract(payload,'$.kind')=? ORDER BY id").all(from2.type, from2.id, to, kind4);
46201
- const pending2 = rows.find((row2) => row2.status === "proposed");
46367
+ const pending = rows.find((row2) => row2.status === "proposed");
46202
46368
  return {
46203
46369
  linked: existing2 !== void 0,
46204
46370
  confirmed: existing2 !== void 0 && Number(existing2.confirmed) === 1,
46205
46371
  rejected: rows.some((row2) => row2.status === "rejected"),
46206
- pending: pending2 ? operations.get(String(pending2.id)) : null
46372
+ pending: pending ? operations.get(String(pending.id)) : null
46207
46373
  };
46208
46374
  }, "state"),
46209
46375
  /** The same pending pair returns the proposal already held; a scored one updates its score in place. */
@@ -46397,7 +46563,7 @@ var decidedOrigin = /* @__PURE__ */ __name((by) => by === "owner" ? { origin: "o
46397
46563
  provenance: `agent:${by.bot} for the owner: ${by.reason.trim()}`
46398
46564
  }, "decidedOrigin");
46399
46565
 
46400
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/reported-relations.js
46566
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/reported-relations.js
46401
46567
  var KEYED = "kind IN ('member-of', 'related-to', 'reports-to', 'customer-of', 'partner-of') AND to_id IS NOT NULL";
46402
46568
  var metadataOf = /* @__PURE__ */ __name((relation) => relation.metadata && Object.keys(relation.metadata).length ? JSON.stringify(relation.metadata) : null, "metadataOf");
46403
46569
  var syncReportedIn = /* @__PURE__ */ __name((context, key2, relationships, scope3, { source: source2 = "import", by = { bot: key2.provider, kind: "rule" } } = {}) => {
@@ -46503,7 +46669,7 @@ var relationsStoreOver = /* @__PURE__ */ __name((context) => ({
46503
46669
  syncReported: /* @__PURE__ */ __name(async (key2, relationships, scope3, options) => write(context.database, () => syncReportedIn(context, key2, relationships, scope3, options)), "syncReported")
46504
46670
  }), "relationsStoreOver");
46505
46671
 
46506
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/crm.js
46672
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/crm.js
46507
46673
  var PENDING = "crm:pending-relations";
46508
46674
  var PENDING_DAYS = 30;
46509
46675
  var PENDING_MOST = 5e3;
@@ -46644,7 +46810,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46644
46810
  }, "flush")
46645
46811
  };
46646
46812
  }, "pendingBook");
46647
- const reportFrom = /* @__PURE__ */ __name((key2, accountId, owner, wanted, scope3, tally, pending2) => {
46813
+ const reportFrom = /* @__PURE__ */ __name((key2, accountId, owner, wanted, scope3, tally, pending) => {
46648
46814
  const name = `${owner.type}:${owner.id}`;
46649
46815
  const relationships = [];
46650
46816
  const waiting = [];
@@ -46674,7 +46840,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46674
46840
  ...one2.metadata ? { metadata: one2.metadata } : {}
46675
46841
  });
46676
46842
  }
46677
- pending2.replace(name, waiting);
46843
+ pending.replace(name, waiting);
46678
46844
  const done = syncReportedIn(context, key2, relationships, scope3, { source: SOURCE });
46679
46845
  tally.skippedOwnerRejected += done.skippedOwnerRejected;
46680
46846
  for (const one2 of done.issues)
@@ -46684,10 +46850,10 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46684
46850
  const accountId = findAccountPk(context, key2);
46685
46851
  if (accountId === void 0)
46686
46852
  return { written: 0, dropped: 0 };
46687
- const pending2 = pendingBook(accountId);
46853
+ const pending = pendingBook(accountId);
46688
46854
  let written = 0;
46689
46855
  const owners = /* @__PURE__ */ new Map();
46690
- for (const one2 of pending2.all())
46856
+ for (const one2 of pending.all())
46691
46857
  owners.set(one2.owner, [...owners.get(one2.owner) ?? [], one2]);
46692
46858
  for (const [owner, entries] of owners) {
46693
46859
  const kept2 = [];
@@ -46709,9 +46875,9 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46709
46875
  written += 1;
46710
46876
  }
46711
46877
  if (kept2.length !== entries.length)
46712
- pending2.replace(owner, kept2);
46878
+ pending.replace(owner, kept2);
46713
46879
  }
46714
- return { written, dropped: pending2.flush() };
46880
+ return { written, dropped: pending.flush() };
46715
46881
  }), "retryPending");
46716
46882
  const saveItem = /* @__PURE__ */ __name((key2, accountId, kind4, item, at, report) => {
46717
46883
  const saved = saveItemRow(key2, accountId, kind4, item, at);
@@ -46749,10 +46915,10 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46749
46915
  const at = now2();
46750
46916
  const skipped = [];
46751
46917
  const tally = tallied();
46752
- const pending2 = pendingBook(accountId);
46918
+ const pending = pendingBook(accountId);
46753
46919
  for (const item of items)
46754
46920
  try {
46755
- const missing4 = saveItem(key2, accountId, kind4, item, at, { tally, pending: pending2, users });
46921
+ const missing4 = saveItem(key2, accountId, kind4, item, at, { tally, pending, users });
46756
46922
  if (missing4)
46757
46923
  skipped.push(missing4);
46758
46924
  } catch (error) {
@@ -46760,7 +46926,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46760
46926
  throw error;
46761
46927
  skipped.push({ externalId: item.externalId, reason: "crm.item-invalid", message: error.message });
46762
46928
  }
46763
- tally.droppedPending += pending2.flush();
46929
+ tally.droppedPending += pending.flush();
46764
46930
  return { saved: items.length - skipped.length, skipped, ...relationNotes(tally) };
46765
46931
  }), "saveItems");
46766
46932
  const saveOrganizations = /* @__PURE__ */ __name((key2, organizations2) => write(database, () => {
@@ -46828,7 +46994,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46828
46994
  const saveUsers = /* @__PURE__ */ __name((key2, users, departments) => {
46829
46995
  const accountId = account(key2);
46830
46996
  const tally = tallied();
46831
- const pending2 = pendingBook(accountId);
46997
+ const pending = pendingBook(accountId);
46832
46998
  for (const user of users)
46833
46999
  nameUnnamed(key2, user.externalId, "user", textOf4(user.name, 200));
46834
47000
  const active = new Map(users.filter((user) => user.active !== false).map((user) => [user.externalId, user]));
@@ -46855,7 +47021,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46855
47021
  ...position2 ? { metadata: { position: position2 } } : {}
46856
47022
  })) : [];
46857
47023
  const scope3 = { from: [ref3], kinds: ["member-of"], roles: ["employee"] };
46858
- reportFrom(key2, accountId, self, wanted, scope3, tally, pending2);
47024
+ reportFrom(key2, accountId, self, wanted, scope3, tally, pending);
46859
47025
  }
46860
47026
  if (departments === void 0 || user.departments === void 0)
46861
47027
  continue;
@@ -46874,9 +47040,9 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46874
47040
  metadata: { derived: "department-head" }
46875
47041
  }));
46876
47042
  const owner = { type: "user", id: `${user.externalId}/reports-to` };
46877
- reportFrom(key2, accountId, owner, lines, { from: [ref3], kinds: ["reports-to"] }, tally, pending2);
47043
+ reportFrom(key2, accountId, owner, lines, { from: [ref3], kinds: ["reports-to"] }, tally, pending);
46878
47044
  }
46879
- tally.droppedPending += pending2.flush();
47045
+ tally.droppedPending += pending.flush();
46880
47046
  return { saved: users.length, skipped: [], ...relationNotes(tally) };
46881
47047
  }, "saveUsers");
46882
47048
  const stored4 = /* @__PURE__ */ __name((key2, kind4) => {
@@ -46893,10 +47059,10 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46893
47059
  mark.run(at, Number(row2.id));
46894
47060
  const accountId = findAccountPk(context, key2);
46895
47061
  if (isItemKind(kind4) && accountId !== void 0 && rows.length) {
46896
- const pending2 = pendingBook(accountId);
47062
+ const pending = pendingBook(accountId);
46897
47063
  for (const row2 of rows)
46898
- pending2.forget(`${kind4}:${row2.external_id}`);
46899
- pending2.flush();
47064
+ pending.forget(`${kind4}:${row2.external_id}`);
47065
+ pending.flush();
46900
47066
  }
46901
47067
  return rows.length;
46902
47068
  }, "markDeleted");
@@ -46913,7 +47079,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46913
47079
  return write(database, () => {
46914
47080
  const accountId = account(key2);
46915
47081
  const tally = tallied();
46916
- const pending2 = pendingBook(accountId);
47082
+ const pending = pendingBook(accountId);
46917
47083
  for (const contact of contacts2) {
46918
47084
  const person2 = nameUnnamed(key2, contact.externalId, "contact", textOf4(contact.name, 200));
46919
47085
  const email = textOf4(contact.email, 320)?.toLowerCase();
@@ -46944,9 +47110,9 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46944
47110
  };
46945
47111
  });
46946
47112
  const scope3 = { from: [`person:${person2}`], kinds: ["member-of"], roles: ["contact"] };
46947
- reportFrom(key2, accountId, self, wanted, scope3, tally, pending2);
47113
+ reportFrom(key2, accountId, self, wanted, scope3, tally, pending);
46948
47114
  }
46949
- tally.droppedPending += pending2.flush();
47115
+ tally.droppedPending += pending.flush();
46950
47116
  return { saved: contacts2.length, skipped: [], ...relationNotes(tally) };
46951
47117
  });
46952
47118
  }, "savePeople"),
@@ -46981,7 +47147,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46981
47147
  };
46982
47148
  }, "crmCopiesOver");
46983
47149
 
46984
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/stage-amounts.js
47150
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/stage-amounts.js
46985
47151
  var TABLES3 = { deal: "deals", lead: "leads" };
46986
47152
  var stageAmountsOf = /* @__PURE__ */ __name(({ database }, kind4, stageIds, cutoff) => {
46987
47153
  const rows = database.prepare(`SELECT stage_id, currency, count(*) AS items, coalesce(sum(amount), 0) AS units FROM ${TABLES3[kind4]} 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);
@@ -46998,7 +47164,7 @@ var stageAmountsOf = /* @__PURE__ */ __name(({ database }, kind4, stageIds, cuto
46998
47164
  });
46999
47165
  }, "stageAmountsOf");
47000
47166
 
47001
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/deals.js
47167
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/deals.js
47002
47168
  var TABLES4 = { deal: "deals", lead: "leads" };
47003
47169
  var itemsSql = /* @__PURE__ */ __name((kind4) => `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[kind4]} 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");
47004
47170
  var MAX_STAGES = 30;
@@ -47339,16 +47505,16 @@ var dealsStoreOver = /* @__PURE__ */ __name((context) => {
47339
47505
  };
47340
47506
  }, "dealsStoreOver");
47341
47507
 
47342
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
47508
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
47343
47509
  import { createHash as createHash14, randomBytes as randomBytes2 } from "node:crypto";
47344
47510
 
47345
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/decision-requests.js
47511
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/decision-requests.js
47346
47512
  var DECISION_ACTIONS = ["confirm", "reject", "ask-confirm", "ask-reject", "back", "later"];
47347
47513
  var DECISION_TTL_MS = 72 * 60 * 60 * 1e3;
47348
47514
  var TOKEN2 = /^[A-Za-z0-9_-]{21}[AQgw]$/;
47349
47515
  var isDecisionToken = /* @__PURE__ */ __name((value) => typeof value === "string" && TOKEN2.test(value), "isDecisionToken");
47350
47516
 
47351
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
47517
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
47352
47518
  var digestOf = /* @__PURE__ */ __name((token) => createHash14("sha256").update(token).digest("hex"), "digestOf");
47353
47519
  var newToken = /* @__PURE__ */ __name(() => randomBytes2(16).toString("base64url"), "newToken");
47354
47520
  var requestOf = /* @__PURE__ */ __name((row2) => ({
@@ -47444,7 +47610,7 @@ var decisionRequestStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
47444
47610
  };
47445
47611
  }, "decisionRequestStoreOver");
47446
47612
 
47447
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
47613
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
47448
47614
  var NOTE_FIELDS = [
47449
47615
  "text",
47450
47616
  "exact",
@@ -47722,7 +47888,7 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
47722
47888
  });
47723
47889
  }, "searchCorpus");
47724
47890
  var SCAN_PAGE3 = 5e3;
47725
- 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)))";
47891
+ var LIVE3 = "((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)))";
47726
47892
  var noteSearchOver = /* @__PURE__ */ __name((context) => {
47727
47893
  const { database } = context;
47728
47894
  const stemmerFor2 = stemmerCache();
@@ -47735,7 +47901,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
47735
47901
  const folders = folderIds?.length ? JSON.stringify(folderIds) : null;
47736
47902
  const types = source2 === void 0 ? ["document", "note"] : source2 === "file" ? ["document"] : ["note"];
47737
47903
  return {
47738
- sql: ` AND k.chunkable_type IN (${types.map(() => "?").join(", ")}) AND ${LIVE2}`,
47904
+ sql: ` AND k.chunkable_type IN (${types.map(() => "?").join(", ")}) AND ${LIVE3}`,
47739
47905
  params: [...types, folders, folders, withInternal ? null : folders]
47740
47906
  };
47741
47907
  }, "live");
@@ -47874,7 +48040,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
47874
48040
  };
47875
48041
  }, "noteSearchOver");
47876
48042
 
47877
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
48043
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
47878
48044
  var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
47879
48045
  var inEventAccounts = /* @__PURE__ */ __name((event2) => searchableCopy(event2, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
47880
48046
  var EVENT_CORPUS = {
@@ -48006,7 +48172,7 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
48006
48172
  };
48007
48173
  }, "eventSearchOver");
48008
48174
 
48009
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/domain/moment.js
48175
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/domain/moment.js
48010
48176
  var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
48011
48177
  try {
48012
48178
  return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
@@ -48018,7 +48184,7 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
48018
48184
  }
48019
48185
  }, "calendarMoment");
48020
48186
 
48021
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
48187
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
48022
48188
  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";
48023
48189
  var iso12 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
48024
48190
  var oneOf5 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -48238,7 +48404,7 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
48238
48404
  };
48239
48405
  }, "factsStoreOver");
48240
48406
 
48241
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
48407
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
48242
48408
  var invalid5 = /* @__PURE__ */ __name((message3) => {
48243
48409
  throw new CliError("validation_error", message3);
48244
48410
  }, "invalid");
@@ -48342,7 +48508,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind4) => {
48342
48508
  return { snapshot: snapshot2, snapshotParts, previous, outcomes, create };
48343
48509
  }, "findingsCoreOver");
48344
48510
 
48345
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
48511
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
48346
48512
  var stale = /* @__PURE__ */ __name(() => {
48347
48513
  throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
48348
48514
  reason: "evidence-findings.stale"
@@ -48523,7 +48689,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
48523
48689
  };
48524
48690
  }, "evidenceFindingsStoreOver");
48525
48691
 
48526
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
48692
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
48527
48693
  var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
48528
48694
  var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
48529
48695
  rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
@@ -48576,7 +48742,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
48576
48742
  }, "forPerson")
48577
48743
  }), "involvementStoreOver");
48578
48744
 
48579
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/labelled.js
48745
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/labelled.js
48580
48746
  var LABELLED = {
48581
48747
  note: "note",
48582
48748
  document: "document",
@@ -48588,7 +48754,7 @@ var LABELLED = {
48588
48754
  account: "folder"
48589
48755
  };
48590
48756
 
48591
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
48757
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
48592
48758
  import { createHash as createHash15 } from "node:crypto";
48593
48759
  var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
48594
48760
  var id = /* @__PURE__ */ __name((value) => {
@@ -48674,7 +48840,7 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
48674
48840
  };
48675
48841
  }, "meetingProjectsStoreOver");
48676
48842
 
48677
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
48843
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
48678
48844
  var ORGANIZATIONS_QUERY = {
48679
48845
  entity: "organization",
48680
48846
  backend: "sql",
@@ -48715,7 +48881,7 @@ var REMINDERS_QUERY = {
48715
48881
  })
48716
48882
  };
48717
48883
 
48718
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/organizations.js
48884
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/organizations.js
48719
48885
  var organizationOf = /* @__PURE__ */ __name((row2) => ({
48720
48886
  id: String(row2.id),
48721
48887
  ref: `organization:${row2.id}`,
@@ -48757,7 +48923,7 @@ var organizationsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) =>
48757
48923
  }), "setOwnOrganization")
48758
48924
  }), "organizationsStoreOver");
48759
48925
 
48760
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-list.js
48926
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-list.js
48761
48927
  var KINDS2 = RELATION_KINDS.map(linkKind).join(", ");
48762
48928
  var typeOfRef = /* @__PURE__ */ __name((column2) => `substr(${column2}, 1, instr(${column2}, ':') - 1)`, "typeOfRef");
48763
48929
  var idOfRef = /* @__PURE__ */ __name((column2) => `CAST(substr(${column2}, instr(${column2}, ':') + 1) AS INTEGER)`, "idOfRef");
@@ -48882,13 +49048,13 @@ var relationListOver = /* @__PURE__ */ __name((context) => {
48882
49048
  __name(proposalItem, "proposalItem");
48883
49049
  }, "relationListOver");
48884
49050
 
48885
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-reads.js
49051
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-reads.js
48886
49052
  var relationReadsOver = /* @__PURE__ */ __name((context) => ({
48887
49053
  ...relationListOver(context),
48888
49054
  ...relationRolesOver(context)
48889
49055
  }), "relationReadsOver");
48890
49056
 
48891
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review.js
49057
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review.js
48892
49058
  var TABLES5 = { memory: "memories", fact: "facts" };
48893
49059
  var RETIRED = /* @__PURE__ */ new Set(["superseded", "reversed", "rejected", "stale"]);
48894
49060
  var DEFAULT_LIMIT = 500;
@@ -49076,16 +49242,16 @@ var sourceReviewStoreOver = /* @__PURE__ */ __name((context) => {
49076
49242
  };
49077
49243
  }, "sourceReviewStoreOver");
49078
49244
 
49079
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
49245
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
49080
49246
  import { createHash as createHash18 } from "node:crypto";
49081
49247
 
49082
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
49248
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
49083
49249
  import { createHash as createHash17 } from "node:crypto";
49084
49250
 
49085
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
49251
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
49086
49252
  import { createHash as createHash16 } from "node:crypto";
49087
49253
 
49088
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
49254
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
49089
49255
  var consolidationId = /* @__PURE__ */ __name((value, field4) => {
49090
49256
  if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
49091
49257
  throw new CliError("validation_error", `${field4} must be a positive canonical tag id`);
@@ -49136,7 +49302,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
49136
49302
  return input;
49137
49303
  }, "consolidationApplyInput");
49138
49304
 
49139
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
49305
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
49140
49306
  var receiptOf = /* @__PURE__ */ __name((row2) => ({
49141
49307
  id: String(row2.id),
49142
49308
  sourceId: String(row2.source_id),
@@ -49211,7 +49377,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
49211
49377
  }, { beforeCommit: check3 });
49212
49378
  }, "applyTagConsolidation");
49213
49379
 
49214
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
49380
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
49215
49381
  var selections = [
49216
49382
  ["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
49217
49383
  ["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
@@ -49355,7 +49521,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
49355
49521
  };
49356
49522
  }, "previewRows");
49357
49523
 
49358
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
49524
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
49359
49525
  var kinds = ["project", "tag", "topic"];
49360
49526
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
49361
49527
  if (signal?.aborted)
@@ -49619,7 +49785,7 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
49619
49785
  };
49620
49786
  }, "vocabularyStoreOver");
49621
49787
 
49622
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
49788
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
49623
49789
  var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
49624
49790
  var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
49625
49791
  var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
@@ -50165,7 +50331,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
50165
50331
  return key2.padEnd(3, "X");
50166
50332
  }, "projectKey");
50167
50333
 
50168
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
50334
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
50169
50335
  var DAY6 = 864e5;
50170
50336
  var SETTING4 = "logs_pruned_at";
50171
50337
  var LOG_RETENTION = { agentActionsMs: 90 * DAY6, botUpdatePayloadsMs: 30 * DAY6 };
@@ -50192,7 +50358,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
50192
50358
  };
50193
50359
  }, "logPruner");
50194
50360
 
50195
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/mail/findings.js
50361
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/mail/findings.js
50196
50362
  var MAIL_FINDINGS_PER_RUN = 30;
50197
50363
  var MAIL_FINDINGS_PER_SENDER = 5;
50198
50364
  var invalid7 = /* @__PURE__ */ __name((message3) => {
@@ -50348,7 +50514,7 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
50348
50514
  return invalid7(`${what} is not a reference of the kind it takes: ${text7}`);
50349
50515
  return text7;
50350
50516
  }, "reference");
50351
- const party2 = /* @__PURE__ */ __name((field4, what) => {
50517
+ const party3 = /* @__PURE__ */ __name((field4, what) => {
50352
50518
  const [given2, name, email] = [raw[field4], raw[`${field4}Name`], raw[`${field4}Email`]];
50353
50519
  if (given2 !== void 0 && name !== void 0)
50354
50520
  return invalid7(`${what} is ${field4} or ${field4}_name, not both`);
@@ -50443,7 +50609,7 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
50443
50609
  id: id2,
50444
50610
  kind: "invoice",
50445
50611
  direction: oneOf7(raw.direction, INVOICE_DIRECTIONS, "an invoice's direction"),
50446
- ...raw.counterparty === void 0 && raw.counterpartyName === void 0 ? invalid7("an invoice names its counterparty: counterparty person:N|organization:N, or counterparty_name") : party2("counterparty", "an invoice's counterparty"),
50612
+ ...raw.counterparty === void 0 && raw.counterpartyName === void 0 ? invalid7("an invoice names its counterparty: counterparty person:N|organization:N, or counterparty_name") : party3("counterparty", "an invoice's counterparty"),
50447
50613
  currency: word(raw.currency, 3),
50448
50614
  lines,
50449
50615
  ...optional2("total", raw.total, (value) => word(value, 30)),
@@ -50475,8 +50641,8 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
50475
50641
  id: id2,
50476
50642
  kind: "payment",
50477
50643
  direction: oneOf7(raw.direction, MONEY_DIRECTIONS, "a payment's direction"),
50478
- ...party2("payer", "a payment's payer"),
50479
- ...party2("payee", "a payment's payee"),
50644
+ ...party3("payer", "a payment's payer"),
50645
+ ...party3("payee", "a payment's payee"),
50480
50646
  amount: word(raw.amount, 30),
50481
50647
  currency: word(raw.currency, 3),
50482
50648
  date: word(raw.date, 10),
@@ -50492,7 +50658,7 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
50492
50658
  id: id2,
50493
50659
  kind: "order",
50494
50660
  purpose: oneOf7(raw.purpose, ORDER_PURPOSES, "an order's purpose"),
50495
- ...party2("customer", "an order's customer"),
50661
+ ...party3("customer", "an order's customer"),
50496
50662
  ...optional2("supplier", raw.supplier, (value) => reference2(value, PARTY2, "an order's supplier")),
50497
50663
  supplierName: word(raw.supplierName, 200),
50498
50664
  ...optional2("number", raw.number, (value) => word(value, 80)),
@@ -50568,7 +50734,7 @@ var checkMailFindings = /* @__PURE__ */ __name((input) => {
50568
50734
  }, "checkMailFindings");
50569
50735
  var mailFindingFingerprint = /* @__PURE__ */ __name(({ id: _id, ...finding }) => findingHash(finding), "mailFindingFingerprint");
50570
50736
 
50571
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/mail/score.js
50737
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/mail/score.js
50572
50738
  var import_disposable_email_domains_js = __toESM(require_dist(), 1);
50573
50739
  var import_tldts = __toESM(require_cjs(), 1);
50574
50740
  var WEIGHTS = {
@@ -50701,8 +50867,7 @@ var scoreGroup = /* @__PURE__ */ __name((items, context) => {
50701
50867
  return { score: kept2.reduce((sum, signal) => sum + WEIGHTS[signal], 0), signals: kept2 };
50702
50868
  }, "scoreGroup");
50703
50869
 
50704
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/orders.js
50705
- var MAX_LINES2 = 500;
50870
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/orders.js
50706
50871
  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";
50707
50872
  var orderOperationsOver = /* @__PURE__ */ __name((context) => {
50708
50873
  const { database, now: now2 } = context;
@@ -50747,9 +50912,6 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
50747
50912
  ...orderOf2(row2),
50748
50913
  lines: row2.currency == null ? [] : moneyLines.shownLines("order", Number(row2.id), String(row2.currency))
50749
50914
  }), "detailOf");
50750
- const retotal = /* @__PURE__ */ __name((orderId) => {
50751
- 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);
50752
- }, "retotal");
50753
50915
  const mayChangeLines = /* @__PURE__ */ __name((row2, by) => {
50754
50916
  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");
50755
50917
  if (row2.review === "rejected" || row2.deleted_at != null)
@@ -50780,19 +50942,19 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
50780
50942
  refuse("a sale names its customer, a person: or organization:", "order.field");
50781
50943
  const number3 = text4(input.number, "an order's number", 80);
50782
50944
  const lines = input.lines ?? [];
50783
- if (!Array.isArray(lines) || lines.length > MAX_LINES2)
50784
- refuse(`an order has at most ${MAX_LINES2} lines`, "order.field");
50945
+ if (!Array.isArray(lines) || lines.length > MAX_LINES)
50946
+ refuse(`an order has at most ${MAX_LINES} lines`, "order.field");
50785
50947
  if (lines.length && input.currency === void 0)
50786
50948
  refuse("an order with lines names its currency", "order.total");
50787
50949
  if (!lines.length && input.total === void 0 !== (input.currency === void 0))
50788
50950
  refuse("an order's amount and currency come together", "order.field");
50789
50951
  const currency2 = input.currency === void 0 ? null : currencyOf(input.currency);
50790
- const priced2 = currency2 === null ? [] : moneyLines.linesOf("order", lines, currency2);
50791
- const sum = priced2.reduce((all2, line) => all2 + line.amount, 0);
50952
+ const priced = currency2 === null ? [] : moneyLines.linesOf("order", lines, currency2);
50953
+ const sum = priced.reduce((all2, line) => all2 + line.amount, 0);
50792
50954
  const given2 = currency2 === null || input.total === void 0 ? null : minorUnits(input.total, currency2, "an order's amount");
50793
- if (priced2.length && given2 !== null && given2 !== sum)
50955
+ if (priced.length && given2 !== null && given2 !== sum)
50794
50956
  refuse(`the order's total ${moneyLabel(given2, currency2)} is not the sum of its lines, ${moneyLabel(sum, currency2)}`, "order.total");
50795
- const total = priced2.length ? sum : given2;
50957
+ const total = priced.length ? sum : given2;
50796
50958
  if (total !== null && total < 0)
50797
50959
  refuse("an order's amount is 0 or more", "money.amount");
50798
50960
  const orderDate = isoDate(input.orderDate, "an order's date");
@@ -50801,8 +50963,8 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
50801
50963
  const id2 = write(database, () => {
50802
50964
  const customer = partyThing(input.customer, "the customer") ?? ownerPerson(database);
50803
50965
  const supplier = partyThing(input.supplier, "the supplier") ?? (direction === "sale" ? ownerPerson(database) : void 0);
50804
- const party2 = partyOf(supplier?.type, supplier?.id);
50805
- const supplierName = named3 ?? party2?.name ?? (party2?.owner ? "owner" : null);
50966
+ const party3 = partyOf(supplier?.type, supplier?.id);
50967
+ const supplierName = named3 ?? party3?.name ?? (party3?.owner ? "owner" : null);
50806
50968
  if (supplierName === null)
50807
50969
  return refuse("an order names its shop or supplier", "order.field");
50808
50970
  if (number3 !== null && ordersOfShop(database, supplierName, number3).some((one2) => held === void 0 || one2.id !== held.id))
@@ -50816,12 +50978,12 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
50816
50978
  const id3 = Number(held.id);
50817
50979
  database.prepare("DELETE FROM order_lines WHERE order_id = ?").run(id3);
50818
50980
  database.prepare("UPDATE orders SET customer_type = ?, customer_id = ?, purpose = ?, supplier_type = ?, supplier_id = ?, supplier_name = ?, number = ?, currency = ?, total = ?, status = ?, order_date = ?, fulfilled_date = ?, invoice_id = ?, payment_id = ?, project_id = ?, source_url = ?, direction = ?, contract_id = ?, deal_id = ?, updated_at = ? WHERE id = ?").run(customer.type, customer.id, purpose, supplier?.type ?? null, supplier?.id ?? null, supplierName, number3, currency2, total, status2, orderDate, fulfilledDate, invoice, payment, input.project === void 0 ? null : projectId(database, input.project), sourceUrl, direction, contract, deal, at, id3);
50819
- moneyLines.insertLines("order", id3, priced2, 1, at);
50981
+ moneyLines.insertLines("order", id3, priced, 1, at);
50820
50982
  return id3;
50821
50983
  }
50822
50984
  const by = written(input);
50823
50985
  const made = Number(database.prepare("INSERT INTO orders (customer_type, customer_id, purpose, supplier_type, supplier_id, supplier_name, number, currency, total, status, order_date, fulfilled_date, invoice_id, payment_id, project_id, review, author_type, author_id, model, confirmed_by_type, confirmed_by_id, source, metadata, created_at, updated_at, source_url, direction, contract_id, deal_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(customer.type, customer.id, purpose, supplier?.type ?? null, supplier?.id ?? null, supplierName, number3, currency2, total, status2, orderDate, fulfilledDate, invoice, payment, by.project, by.review, by.actor.type, by.actor.id, by.model, by.confirmedType, by.confirmedId, by.source, by.metadata, at, at, sourceUrl, direction, contract, deal)?.id);
50824
- moneyLines.insertLines("order", made, priced2, 1, at);
50986
+ moneyLines.insertLines("order", made, priced, 1, at);
50825
50987
  keepEvidence("order", made, by);
50826
50988
  return made;
50827
50989
  });
@@ -50868,13 +51030,10 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
50868
51030
  mayChangeLines(row2, by);
50869
51031
  if (row2.currency == null)
50870
51032
  refuse(`order:${row2.id} has no currency; a line needs one`, "order.total");
50871
- const [priced2] = moneyLines.linesOf("order", [line], String(row2.currency));
51033
+ const [priced] = moneyLines.linesOf("order", [line], String(row2.currency));
50872
51034
  write(database, () => {
50873
- const last = Number(database.prepare("SELECT coalesce(max(position), 0) AS n FROM order_lines WHERE order_id = ?").get(Number(row2.id))?.n);
50874
- if (last >= MAX_LINES2)
50875
- refuse(`an order has at most ${MAX_LINES2} lines`, "order.field");
50876
- moneyLines.insertLines("order", Number(row2.id), [priced2], last + 1, now2());
50877
- retotal(Number(row2.id));
51035
+ moneyLines.appendLine("order", Number(row2.id), priced, now2());
51036
+ moneyLines.retotal("order", Number(row2.id), now2());
50878
51037
  });
50879
51038
  return detailOf(rowOf2(`order:${row2.id}`));
50880
51039
  }, "addLine"),
@@ -50882,13 +51041,8 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
50882
51041
  const row2 = rowOf2(reference2);
50883
51042
  mayChangeLines(row2, by);
50884
51043
  write(database, () => {
50885
- const lines = Number(database.prepare("SELECT count(*) AS n FROM order_lines WHERE order_id = ?").get(Number(row2.id))?.n);
50886
- const gone = database.prepare("DELETE FROM order_lines WHERE order_id = ? AND position = ?").run(Number(row2.id), position2);
50887
- if (gone.changes === 0)
50888
- throw new CliError("not_found", `order:${row2.id} has no line ${position2}`, { reason: "order.no-line" });
50889
- if (lines === 1)
50890
- refuse(`line ${position2} is the last of order:${row2.id}; reject or cancel the order instead`, "order.line");
50891
- retotal(Number(row2.id));
51044
+ moneyLines.deleteLine("order", Number(row2.id), position2);
51045
+ moneyLines.retotal("order", Number(row2.id), now2());
50892
51046
  });
50893
51047
  return detailOf(rowOf2(`order:${row2.id}`));
50894
51048
  }, "removeLine")
@@ -50921,7 +51075,7 @@ var ordersStoreOver = /* @__PURE__ */ __name((context) => {
50921
51075
  };
50922
51076
  }, "ordersStoreOver");
50923
51077
 
50924
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-findings.js
51078
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-findings.js
50925
51079
  var stale2 = /* @__PURE__ */ __name(() => {
50926
51080
  throw new CliError("validation_error", "mail findings cite mail that changed since it was read; stage a new batch", {
50927
51081
  reason: "mail-findings.stale"
@@ -51378,7 +51532,7 @@ ${evidence.join("\n")}`, agent);
51378
51532
  };
51379
51533
  }, "mailFindingsStoreOver");
51380
51534
 
51381
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
51535
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
51382
51536
  var stale3 = /* @__PURE__ */ __name(() => {
51383
51537
  throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
51384
51538
  reason: "meeting-findings.stale"
@@ -51546,9 +51700,9 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
51546
51700
  };
51547
51701
  }, "meetingFindingsStoreOver");
51548
51702
 
51549
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
51703
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
51550
51704
  var RANK_BATCH = 512;
51551
- 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";
51705
+ var LIVE4 = "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";
51552
51706
  var limitOf2 = /* @__PURE__ */ __name((value, name, max = 1e3) => {
51553
51707
  positiveReadInteger(value, name);
51554
51708
  if (value > max)
@@ -51634,7 +51788,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
51634
51788
  throw new CliError("validation_error", "Vector save exceeds its batch or 16 MiB payload budget");
51635
51789
  return write(context.database, () => {
51636
51790
  const unique2 = new Map(rows.map((row2) => [row2.hash, row2]));
51637
- 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()]));
51791
+ const current = context.database.prepare(`SELECT DISTINCT k.content_hash ${LIVE4} AND k.content_hash IN (SELECT value FROM json_each(?))`).all(input.accountId, JSON.stringify([...unique2.keys()]));
51638
51792
  const available = new Set(current.map((row2) => String(row2.content_hash)));
51639
51793
  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));
51640
51794
  input.signal?.throwIfAborted();
@@ -51691,7 +51845,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
51691
51845
  if (input.afterHash !== void 0 && !/^[a-f0-9]{64}$/.test(input.afterHash))
51692
51846
  throw new CliError("validation_error", "afterHash must be a content hash");
51693
51847
  return read(context.database, () => {
51694
- 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);
51848
+ const rows = context.database.prepare(`SELECT k.* ${LIVE4} 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);
51695
51849
  const load = textLoader(context, input);
51696
51850
  const items = rows.slice(0, limit).map((row2) => ({
51697
51851
  hash: String(row2.content_hash),
@@ -51711,13 +51865,13 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
51711
51865
  if (input.afterChunkId !== void 0)
51712
51866
  positiveReadInteger(input.afterChunkId, "afterChunkId");
51713
51867
  return read(context.database, () => {
51714
- 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 ?`;
51868
+ const selectedSql = `${LIVE4.replace(" WHERE", " JOIN embeddings e ON e.content_hash=k.content_hash AND e.model=? WHERE")} AND k.id>? ORDER BY k.id LIMIT ?`;
51715
51869
  const params = [model, input.accountId, input.afterChunkId ?? 0, maxChunks + 1];
51716
51870
  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);
51717
51871
  if (Number(preflight?.bad ?? 0) || Number(preflight?.bytes ?? 0) > 16 * 1024 * 1024)
51718
51872
  throw new CliError("validation_error", "Stored vectors exceed the dimension or 16 MiB scan budget");
51719
51873
  input.signal?.throwIfAborted();
51720
- 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);
51874
+ const rows = context.database.prepare(`SELECT k.*,e.dims,e.vector ${LIVE4.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);
51721
51875
  const selected = rows.slice(0, maxChunks);
51722
51876
  const load = textLoader(context, input);
51723
51877
  const items = selected.map((row2) => {
@@ -51812,12 +51966,12 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
51812
51966
  async status(input) {
51813
51967
  scope2(input);
51814
51968
  modelOf(input.model);
51815
- 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);
51969
+ 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 ${LIVE4}`).get(input.model, input.accountId);
51816
51970
  return { chunks: Number(row2?.chunks ?? 0), embedded: Number(row2?.embedded ?? 0) };
51817
51971
  }
51818
51972
  }), "meetingVectorsOver");
51819
51973
 
51820
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
51974
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
51821
51975
  var OTHER_SOURCES = ["document", "note", "email"];
51822
51976
  var TEXTS = {
51823
51977
  document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
@@ -51918,7 +52072,7 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
51918
52072
  };
51919
52073
  }, "sourceMentionStoreOver");
51920
52074
 
51921
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/money-transactions.js
52075
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/money-transactions.js
51922
52076
  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";
51923
52077
  var MAX_SPLITS = 100;
51924
52078
  var transactionOperationsOver = /* @__PURE__ */ __name((context) => {
@@ -52149,11 +52303,11 @@ var transactionsStoreOver = /* @__PURE__ */ __name((context) => {
52149
52303
  };
52150
52304
  }, "transactionsStoreOver");
52151
52305
 
52152
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
52306
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
52153
52307
  import { accessSync, constants, existsSync, mkdirSync as mkdirSync2, statSync, writeFileSync as writeFileSync2 } from "node:fs";
52154
52308
  import { dirname as dirname2 } from "node:path";
52155
52309
 
52156
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
52310
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
52157
52311
  import { readFileSync as readFileSync3 } from "node:fs";
52158
52312
  var CLIENTS_SETTING = "clients";
52159
52313
  var coreVersion = (() => {
@@ -52211,7 +52365,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
52211
52365
  return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
52212
52366
  }, "refusalAdvice");
52213
52367
 
52214
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
52368
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
52215
52369
  var GENERATED = [
52216
52370
  {
52217
52371
  "name": "20261010184427_initial",
@@ -53424,7 +53578,7 @@ WHERE json_type(params, '$.selection') = 'object';`
53424
53578
  }
53425
53579
  ];
53426
53580
 
53427
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/rollback-copy.js
53581
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/rollback-copy.js
53428
53582
  import { mkdirSync, rmSync, statfsSync, writeFileSync } from "node:fs";
53429
53583
  import { basename, dirname, join as join2, parse } from "node:path";
53430
53584
  var DERIVED = /(_fts|_words|_stems|_trigrams|_pending)$|^(embeddings|chunks|chunk_messages|mentions|involvements|search_terms)$|^vector_index/;
@@ -53657,7 +53811,7 @@ var rollBack = /* @__PURE__ */ __name((database, path) => {
53657
53811
  return { ...result, foreignKeyViolations };
53658
53812
  }, "rollBack");
53659
53813
 
53660
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
53814
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
53661
53815
  var V31_TABLES = [
53662
53816
  "accounts",
53663
53817
  "account_identities",
@@ -53811,7 +53965,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
53811
53965
  return migrations;
53812
53966
  }, "generatedMigrations");
53813
53967
 
53814
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/migrations.js
53968
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/migrations.js
53815
53969
  var MIGRATIONS = generatedMigrations();
53816
53970
  var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
53817
53971
  version INTEGER PRIMARY KEY,
@@ -53890,17 +54044,17 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
53890
54044
  }
53891
54045
  }, "migrate");
53892
54046
 
53893
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
54047
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
53894
54048
  var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
53895
- const pending2 = 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 ?");
53896
- if (pending2.get(0, 1) === void 0)
54049
+ 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 ?");
54050
+ if (pending.get(0, 1) === void 0)
53897
54051
  return 0;
53898
54052
  const fill = database.prepare("UPDATE meetings SET join_key = ? WHERE id = ?");
53899
54053
  let filled2 = 0;
53900
54054
  let after2 = 0;
53901
54055
  for (; ; ) {
53902
54056
  const rows = writeBatch(database, () => {
53903
- const page3 = pending2.all(after2, batch);
54057
+ const page3 = pending.all(after2, batch);
53904
54058
  for (const row2 of page3)
53905
54059
  fill.run(joinKeyOf(String(row2.join_url)) ?? "", Number(row2.id));
53906
54060
  return page3;
@@ -53912,7 +54066,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
53912
54066
  }
53913
54067
  }, "fillJoinKeys");
53914
54068
 
53915
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
54069
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
53916
54070
  var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
53917
54071
  refuseOwnerStoreInTests(path);
53918
54072
  const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
@@ -53926,8 +54080,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
53926
54080
  }, "openSqlite");
53927
54081
  var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
53928
54082
  quietSqliteWarning();
53929
- const { drizzle } = await import("./node-DBZKVPDA.js");
53930
- const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-UZVU7EXS.js");
54083
+ const { drizzle } = await import("./node-OCRAUHTJ.js");
54084
+ const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-UIZIEENG.js");
53931
54085
  const client = await nodeClient(path, { readOnly });
53932
54086
  try {
53933
54087
  return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
@@ -53937,8 +54091,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
53937
54091
  }
53938
54092
  }, "openUnderNode");
53939
54093
  var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
53940
- const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-V73FFF2C.js");
53941
- const { drizzle } = await import("./bun-22MM6T54.js");
54094
+ const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-IIJSZ5I2.js");
54095
+ const { drizzle } = await import("./bun-3NYKD7YB.js");
53942
54096
  const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
53943
54097
  try {
53944
54098
  return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
@@ -53948,7 +54102,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
53948
54102
  }
53949
54103
  }, "openUnderBun");
53950
54104
 
53951
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-facts.js
54105
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-facts.js
53952
54106
  var PAYMENT_FACTS_TO_MOVE = "payment_facts_to_move";
53953
54107
  var paymentOf = /* @__PURE__ */ __name((metadata3) => {
53954
54108
  try {
@@ -54016,7 +54170,7 @@ var movePaymentFacts = /* @__PURE__ */ __name((context) => {
54016
54170
  });
54017
54171
  }, "movePaymentFacts");
54018
54172
 
54019
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
54173
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
54020
54174
  var readCompatibility = /* @__PURE__ */ __name((database, command) => {
54021
54175
  const ours = MIGRATIONS.at(-1)?.version ?? 0;
54022
54176
  if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
@@ -54034,7 +54188,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
54034
54188
  throw new CliError("configuration_error", `The store needs schema ${MIGRATIONS.at(-1)?.version ?? 0} maintenance before a read-only open`);
54035
54189
  }, "assertReadCompatible");
54036
54190
 
54037
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/suggested-links.js
54191
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/suggested-links.js
54038
54192
  var SUGGESTED_LINKS_TO_MOVE = "suggested_links_to_move";
54039
54193
  var proposerOf2 = /* @__PURE__ */ __name((provenance2) => {
54040
54194
  if (provenance2?.startsWith("rule:"))
@@ -54080,7 +54234,7 @@ var moveSuggestedLinks = /* @__PURE__ */ __name((database, now2) => {
54080
54234
  });
54081
54235
  }, "moveSuggestedLinks");
54082
54236
 
54083
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/test-accounts.js
54237
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/test-accounts.js
54084
54238
  var TEST_ACCOUNTS_TO_PURGE = "test_accounts_to_purge";
54085
54239
  var TEST_PROVIDER = "chat";
54086
54240
  var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
@@ -54101,7 +54255,7 @@ var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
54101
54255
  }
54102
54256
  }, "purgeTestAccounts");
54103
54257
 
54104
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
54258
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
54105
54259
  var BACKFILL_ON_OPEN = 5e3;
54106
54260
  var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
54107
54261
  var createWritable = /* @__PURE__ */ __name((file) => {
@@ -54174,8 +54328,8 @@ var openStoreContext = /* @__PURE__ */ __name(async (options = {}) => {
54174
54328
  moveSuggestedLinks(database, now2);
54175
54329
  movePaymentFacts({ ...opened, now: now2, decisions: decisions2 });
54176
54330
  purgeTestAccounts({ ...opened, now: now2, decisions: decisions2 }, warn);
54177
- const pending2 = pendingNormalization(database);
54178
- if (pending2 > 0 && pending2 <= BACKFILL_ON_OPEN)
54331
+ const pending = pendingNormalization(database);
54332
+ if (pending > 0 && pending <= BACKFILL_ON_OPEN)
54179
54333
  backfillNormalized(database);
54180
54334
  followDefaultStemmers(database, now2);
54181
54335
  const stemming = stemsState(database);
@@ -54199,7 +54353,7 @@ var openStoreContext = /* @__PURE__ */ __name(async (options = {}) => {
54199
54353
  }
54200
54354
  }, "openStoreContext");
54201
54355
 
54202
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/products.js
54356
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/products.js
54203
54357
  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";
54204
54358
  var productOperationsOver = /* @__PURE__ */ __name((context) => {
54205
54359
  const { database, now: now2 } = context;
@@ -54305,10 +54459,10 @@ var productsStoreOver = /* @__PURE__ */ __name((context) => {
54305
54459
  };
54306
54460
  }, "productsStoreOver");
54307
54461
 
54308
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
54462
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
54309
54463
  import { createHash as createHash19 } from "node:crypto";
54310
54464
 
54311
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
54465
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
54312
54466
  var text5 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
54313
54467
  var ref = text5(2048);
54314
54468
  var timestamp2 = pipe(number(), safeInteger(), minValue(0));
@@ -54378,7 +54532,7 @@ var projectAnnotationsSchema = strictObject({
54378
54532
  }))
54379
54533
  });
54380
54534
 
54381
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
54535
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
54382
54536
  var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
54383
54537
  var invalid10 = /* @__PURE__ */ __name((field4) => {
54384
54538
  throw new CliError("validation_error", `invalid project annotations.${field4}`);
@@ -54482,7 +54636,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
54482
54636
  invalid10("external.unused");
54483
54637
  }, "validateProjectAnnotationsGraph");
54484
54638
 
54485
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
54639
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
54486
54640
  var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
54487
54641
  var ref2 = pipe(string(), minLength(1), maxLength(2048));
54488
54642
  var targetSchema = strictObject({
@@ -54588,7 +54742,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
54588
54742
  };
54589
54743
  }, "planBoundProjectAnnotations");
54590
54744
 
54591
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
54745
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
54592
54746
  import { createHash as createHash20 } from "node:crypto";
54593
54747
  var text6 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
54594
54748
  var timestamp3 = pipe(number(), safeInteger(), minValue(0));
@@ -54682,7 +54836,7 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
54682
54836
  })).digest("hex");
54683
54837
  }, "projectAnnotationSnapshotFingerprint");
54684
54838
 
54685
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
54839
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
54686
54840
  var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
54687
54841
  if (!request || typeof request !== "object" || Array.isArray(request))
54688
54842
  throw new CliError("validation_error", "project annotation request is required");
@@ -54699,7 +54853,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
54699
54853
  return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
54700
54854
  }, "projectAnnotationRequest");
54701
54855
 
54702
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
54856
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
54703
54857
  var SnapshotBudget = class {
54704
54858
  static {
54705
54859
  __name(this, "SnapshotBudget");
@@ -54725,13 +54879,13 @@ var SnapshotBudget = class {
54725
54879
  }
54726
54880
  };
54727
54881
 
54728
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
54882
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
54729
54883
  import { createHash as createHash22 } from "node:crypto";
54730
54884
 
54731
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
54885
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
54732
54886
  var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
54733
54887
 
54734
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
54888
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
54735
54889
  import { createHash as createHash21 } from "node:crypto";
54736
54890
  var invalid12 = /* @__PURE__ */ __name(() => {
54737
54891
  throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
@@ -54874,7 +55028,7 @@ var ProjectSnapshotSources = class {
54874
55028
  }
54875
55029
  };
54876
55030
 
54877
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
55031
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
54878
55032
  var unsupported = /* @__PURE__ */ __name(() => {
54879
55033
  throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
54880
55034
  }, "unsupported");
@@ -55052,7 +55206,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, bu
55052
55206
  return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
55053
55207
  }), "projectAnnotationSnapshot");
55054
55208
 
55055
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
55209
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
55056
55210
  var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, manifest, bindings, budget) => read(database, () => {
55057
55211
  const current = projectAnnotationSnapshot(database, projectId2, budget).snapshot;
55058
55212
  const sources = new ProjectSnapshotSources(database, budget);
@@ -55114,7 +55268,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, ma
55114
55268
  };
55115
55269
  }), "previewAnnotationSnapshot");
55116
55270
 
55117
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
55271
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
55118
55272
  var metadataOf2 = /* @__PURE__ */ __name((database, link3, to) => {
55119
55273
  const provenance2 = link3.provenance === null ? {} : { provenance: link3.provenance };
55120
55274
  if (link3.kind === "evidence" && to)
@@ -55181,7 +55335,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, sna
55181
55335
  return mappings;
55182
55336
  }, "restoreAnnotationRecords");
55183
55337
 
55184
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
55338
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
55185
55339
  var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
55186
55340
  async preview(request) {
55187
55341
  const { snapshot: snapshot2, projectId: projectId2 } = projectAnnotationRequest(request);
@@ -55211,7 +55365,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
55211
55365
  }
55212
55366
  }), "projectAnnotationStoreOver");
55213
55367
 
55214
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projection.js
55368
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projection.js
55215
55369
  var IMPORTER = { bot: "import" };
55216
55370
  var importersProposal = /* @__PURE__ */ __name((entity) => entity.review === "proposed" && entity.author.type === "bot" && entity.author.name === IMPORTER.bot, "importersProposal");
55217
55371
  var codeOf = /* @__PURE__ */ __name((error) => {
@@ -55256,7 +55410,7 @@ var moneyLinesOf = /* @__PURE__ */ __name((projection, list2) => (Array.isArray(
55256
55410
  };
55257
55411
  }), "moneyLinesOf");
55258
55412
 
55259
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/record-relations.js
55413
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/record-relations.js
55260
55414
  var isDerived = /* @__PURE__ */ __name((role) => role.startsWith("fields."), "isDerived");
55261
55415
  var recordRelationsOver = /* @__PURE__ */ __name(({ database }) => {
55262
55416
  const sql2 = /* @__PURE__ */ __name((text7) => database.prepare(text7), "sql");
@@ -55327,7 +55481,7 @@ var recordRelationsOver = /* @__PURE__ */ __name(({ database }) => {
55327
55481
  return { entityRef, relatedOf, storedRelations, relate, missingOf };
55328
55482
  }, "recordRelationsOver");
55329
55483
 
55330
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/record-remap.js
55484
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/record-remap.js
55331
55485
  var recordRemapOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
55332
55486
  const pointedAt = /* @__PURE__ */ __name((type, id2) => {
55333
55487
  for (const { table, pointer } of pointerPairs(database))
@@ -55381,7 +55535,7 @@ var recordRemapOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
55381
55535
  return { pointedAt, remap };
55382
55536
  }, "recordRemapOver");
55383
55537
 
55384
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/record-run.js
55538
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/record-run.js
55385
55539
  var runs = 0;
55386
55540
  var PAGE = 500;
55387
55541
  var recordRunOver = /* @__PURE__ */ __name((context, writes) => {
@@ -55541,7 +55695,7 @@ var waitingPointer = /* @__PURE__ */ __name((index2, missing4) => {
55541
55695
  return pointerOf("records", index2, "fields", key2);
55542
55696
  }, "waitingPointer");
55543
55697
 
55544
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/record-matching.js
55698
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/record-matching.js
55545
55699
  var valuesOf = /* @__PURE__ */ __name((value) => (Array.isArray(value) ? value : [value]).filter((one2) => typeof one2 === "string"), "valuesOf");
55546
55700
  var SCHEME2 = /^(email|domain|tax-id:[a-z]{2}|registration:[a-z]{2})$/;
55547
55701
  var ORG_EMAIL = "org-email";
@@ -55653,7 +55807,7 @@ var matchOf = /* @__PURE__ */ __name((context, type, ids) => {
55653
55807
  return { outcome: "ambiguous", ids: found2, reason: "record.separated" };
55654
55808
  return { outcome: "one", id: id2 };
55655
55809
  }, "matchOf");
55656
- var IMPORT = "import";
55810
+ var IMPORT2 = "import";
55657
55811
  var importedIdentity = /* @__PURE__ */ __name(({ database, now: now2 }, identity) => {
55658
55812
  const held = database.prepare("SELECT id FROM identities WHERE provider = ? AND external_id = ?").get(identity.provider, identity.externalId);
55659
55813
  if (held)
@@ -55668,8 +55822,8 @@ var linkToPerson = /* @__PURE__ */ __name((context, person2, identity, source2)
55668
55822
  if (identitySeparated(context, identity, person2))
55669
55823
  return;
55670
55824
  const at = now2();
55671
- 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);
55672
- 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);
55825
+ 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);
55826
+ 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);
55673
55827
  }, "linkToPerson");
55674
55828
  var addIdentifiers = /* @__PURE__ */ __name((context, type, id2, ids, name, source2) => {
55675
55829
  const { database, now: now2 } = context;
@@ -55687,7 +55841,7 @@ var addIdentifiers = /* @__PURE__ */ __name((context, type, id2, ids, name, sour
55687
55841
  for (const { provider, value } of ids.organization) {
55688
55842
  const identity = importedIdentity(context, { provider, externalId: value, name });
55689
55843
  const at = now2();
55690
- 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);
55844
+ 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);
55691
55845
  }
55692
55846
  }, "addIdentifiers");
55693
55847
  var createEntity = /* @__PURE__ */ __name((context, type, fields4, ids, related, source2, externalId) => {
@@ -55729,7 +55883,7 @@ var renameMade = /* @__PURE__ */ __name(({ database, now: now2 }, type, id2, nam
55729
55883
  ]);
55730
55884
  }, "renameMade");
55731
55885
 
55732
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-direct.js
55886
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-direct.js
55733
55887
  var productFields = /* @__PURE__ */ __name((fields4) => ({
55734
55888
  name: given(fields4, "name"),
55735
55889
  unit: given(fields4, "unit"),
@@ -55852,7 +56006,7 @@ var DIRECT_PROJECTORS = {
55852
56006
  lead: dealProjector("lead")
55853
56007
  };
55854
56008
 
55855
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-money.js
56009
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-money.js
55856
56010
  var allocatedByOthers = /* @__PURE__ */ __name((context, paymentId) => {
55857
56011
  const importer = authorActor(context, IMPORTER).actor;
55858
56012
  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;
@@ -56062,7 +56216,7 @@ var MONEY_PROJECTORS = {
56062
56216
  }
56063
56217
  };
56064
56218
 
56065
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-phone.js
56219
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-phone.js
56066
56220
  var CALLS_CALENDAR = "calls";
56067
56221
  var importOnly = /* @__PURE__ */ __name((source2, type) => {
56068
56222
  if (!isImportedProvider(source2.provider))
@@ -56237,7 +56391,7 @@ var PHONE_PROJECTORS = {
56237
56391
  }
56238
56392
  };
56239
56393
 
56240
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors.js
56394
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors.js
56241
56395
  var RECORD_PROJECTORS = {
56242
56396
  ...MONEY_PROJECTORS,
56243
56397
  ...DIRECT_PROJECTORS,
@@ -56247,7 +56401,7 @@ var RECORD_PROJECTORS = {
56247
56401
  project: null
56248
56402
  };
56249
56403
 
56250
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/record-settling.js
56404
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/record-settling.js
56251
56405
  var recordSettlingOver = /* @__PURE__ */ __name(({ database }, finance) => {
56252
56406
  const sql2 = /* @__PURE__ */ __name((text7) => database.prepare(text7), "sql");
56253
56407
  const freeOn = /* @__PURE__ */ __name((invoice, payment) => {
@@ -56309,7 +56463,7 @@ var recordSettlingOver = /* @__PURE__ */ __name(({ database }, finance) => {
56309
56463
  return { settle, checkShares };
56310
56464
  }, "recordSettlingOver");
56311
56465
 
56312
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/record-stamps.js
56466
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/record-stamps.js
56313
56467
  import { createHash as createHash23 } from "node:crypto";
56314
56468
  var VOLATILE = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "metadata"]);
56315
56469
  var content = /* @__PURE__ */ __name((row2) => row2 === void 0 ? null : Object.fromEntries(Object.entries(row2).filter(([column2]) => !VOLATILE.has(column2))), "content");
@@ -56325,7 +56479,7 @@ var importStampsOver = /* @__PURE__ */ __name(({ database }) => {
56325
56479
  return { stamp, untouched };
56326
56480
  }, "importStampsOver");
56327
56481
 
56328
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/subscriptions.js
56482
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/subscriptions.js
56329
56483
  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";
56330
56484
  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";
56331
56485
  var PRICE_REF = /^subscription_price:([1-9]\d{0,15})$/;
@@ -56423,9 +56577,9 @@ var subscriptionOperationsOver = /* @__PURE__ */ __name((context) => {
56423
56577
  if (settled === "cancelled" && cancelled3 === null)
56424
56578
  refuse("a cancelled subscription has the day it was cancelled", "subscription.field");
56425
56579
  const owner = ownerPerson(database);
56426
- 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");
56427
- const supplier = party2(fields4.supplier, "supplier_type", "supplier_id", direction === "receivable", "the supplier");
56428
- const customer = party2(fields4.customer, "customer_type", "customer_id", direction === "payable", "the customer");
56580
+ 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");
56581
+ const supplier = party3(fields4.supplier, "supplier_type", "supplier_id", direction === "receivable", "the supplier");
56582
+ const customer = party3(fields4.customer, "customer_type", "customer_id", direction === "payable", "the customer");
56429
56583
  const linked = /* @__PURE__ */ __name((given2, type, column2) => given2 === void 0 ? base[column2] ?? null : given2 === null ? null : linkedId(given2, type, "subscription.ref"), "linked");
56430
56584
  const product = linked(fields4.product, "product", "catalog_item_id");
56431
56585
  const productName = product === null ? null : String(database.prepare("SELECT name FROM catalog_items WHERE id = ?").get(product)?.name);
@@ -56556,7 +56710,7 @@ var subscriptionsStoreOver = /* @__PURE__ */ __name((context) => {
56556
56710
  };
56557
56711
  }, "subscriptionsStoreOver");
56558
56712
 
56559
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/wallets.js
56713
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/wallets.js
56560
56714
  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";
56561
56715
  var SIGNED = "CASE t.direction WHEN 'in' THEN t.amount ELSE -t.amount END";
56562
56716
  var walletOperationsOver = /* @__PURE__ */ __name((context) => {
@@ -56570,7 +56724,7 @@ var walletOperationsOver = /* @__PURE__ */ __name((context) => {
56570
56724
  const opening = row2.opening_balance == null ? null : Number(row2.opening_balance);
56571
56725
  const openingDate = row2.opening_date == null ? null : String(row2.opening_date);
56572
56726
  const booked = sumOf("t.financial_account_id = ? AND t.review = 'confirmed' AND t.status = 'booked' AND t.deleted_at IS NULL AND (? IS NULL OR t.booked_date > ?) AND t.booked_date <= ?", Number(row2.id), openingDate, openingDate, until);
56573
- const pending2 = sumOf("t.financial_account_id = ? AND t.deleted_at IS NULL AND t.review <> 'rejected' AND (t.status = 'pending' OR t.review = 'proposed') AND t.statement_date <= ?", Number(row2.id), until);
56727
+ const pending = sumOf("t.financial_account_id = ? AND t.deleted_at IS NULL AND t.review <> 'rejected' AND (t.status = 'pending' OR t.review = 'proposed') AND t.statement_date <= ?", Number(row2.id), until);
56574
56728
  const fields4 = {
56575
56729
  name: String(row2.name),
56576
56730
  kind: row2.kind,
@@ -56593,7 +56747,7 @@ var walletOperationsOver = /* @__PURE__ */ __name((context) => {
56593
56747
  closedDate: row2.closed_date == null ? null : String(row2.closed_date),
56594
56748
  balance: moneyOf((opening ?? 0) + booked, currency2),
56595
56749
  until,
56596
- pending: moneyOf(pending2, currency2),
56750
+ pending: moneyOf(pending, currency2),
56597
56751
  author: authorOf(row2),
56598
56752
  model: row2.model == null ? null : String(row2.model),
56599
56753
  source: String(row2.source),
@@ -56678,7 +56832,7 @@ var walletsStoreOver = /* @__PURE__ */ __name((context) => {
56678
56832
  };
56679
56833
  }, "walletsStoreOver");
56680
56834
 
56681
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/record-writes.js
56835
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/record-writes.js
56682
56836
  var specOf = /* @__PURE__ */ __name((type) => RECORD_TYPES[type], "specOf");
56683
56837
  var unsettled = /* @__PURE__ */ __name((fields4, relations) => recordFingerprint(fields4, relations.filter((relation) => !AMOUNT_ROLES.includes(relation.role))), "unsettled");
56684
56838
  var tableOf2 = /* @__PURE__ */ __name((type) => typeof type === "string" && Object.hasOwn(DECIDED_TABLES, type) ? DECIDED_TABLES[type] : void 0, "tableOf");
@@ -56935,9 +57089,13 @@ var recordWritesOver = /* @__PURE__ */ __name((context) => {
56935
57089
  return { writeOne, project: project2, completeDependents, entityRef, missingOf: relations.missingOf };
56936
57090
  }, "recordWritesOver");
56937
57091
 
56938
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
57092
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
56939
57093
  var LIMIT = 1e3;
56940
57094
  var iso15 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
57095
+ var checkLimit = /* @__PURE__ */ __name((limit) => {
57096
+ if (!Number.isSafeInteger(limit) || limit < 1 || limit > 500)
57097
+ throw new CliError("validation_error", "a record list takes 1\u2013500 items");
57098
+ }, "checkLimit");
56941
57099
  var IDENTITY_SQL = IDENTITY_TYPES.map((type) => `'${type}'`).join(", ");
56942
57100
  var recordStoreOver = /* @__PURE__ */ __name((context) => {
56943
57101
  const { database } = context;
@@ -56993,16 +57151,67 @@ var recordStoreOver = /* @__PURE__ */ __name((context) => {
56993
57151
  const row2 = rowOf2(key2);
56994
57152
  return row2 ? sourceRecordOf(row2) : void 0;
56995
57153
  }), "get"),
56996
- list: /* @__PURE__ */ __name(async ({ provider, account, type, waiting, unmatched, flagged, limit = 100 }) => {
56997
- if (!Number.isSafeInteger(limit) || limit < 1 || limit > 500)
56998
- throw new CliError("validation_error", "a record list takes 1\u2013500 items");
57154
+ list: /* @__PURE__ */ __name(async ({ provider, account, type, waiting, unmatched, flagged, entity, batch, deleted, limit = 100 }) => {
57155
+ checkLimit(limit);
56999
57156
  return read(database, () => {
57000
- if (findAccountPk(context, { provider, account }) === void 0)
57157
+ const accountId = findAccountPk(context, { provider, account });
57158
+ if (accountId === void 0)
57001
57159
  return [];
57002
- 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);
57003
- return rows.map(sourceRecordOf);
57160
+ const where = ["r.account_id = ?"];
57161
+ const params = [accountId];
57162
+ const and2 = /* @__PURE__ */ __name((condition, ...values) => {
57163
+ where.push(condition);
57164
+ for (const value of values)
57165
+ params.push(value);
57166
+ }, "and");
57167
+ if (type !== void 0)
57168
+ and2("r.type = ?", type);
57169
+ if (waiting)
57170
+ 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})`);
57171
+ if (unmatched)
57172
+ and2(`r.entity_id IS NULL AND r.deleted_at IS NULL AND r.type IN (${IDENTITY_SQL})`);
57173
+ if (flagged)
57174
+ and2("r.entity_id IS NOT NULL AND (r.deleted_at IS NOT NULL OR r.projected_fingerprint IS NOT r.fingerprint)");
57175
+ if (entity !== void 0) {
57176
+ const thing = requiredThing(database, entity, "the entity");
57177
+ and2("r.entity_type = ? AND r.entity_id = ?", thing.type, thing.id);
57178
+ }
57179
+ if (batch !== void 0)
57180
+ and2("r.batch_id = ?", batch);
57181
+ if (deleted !== void 0)
57182
+ and2(`r.deleted_at IS ${deleted ? "NOT " : ""}NULL`);
57183
+ return database.prepare(`${SELECT2}WHERE ${where.join(" AND ")} ORDER BY r.updated_at DESC, r.id DESC LIMIT ?`).all(...params, limit).map(sourceRecordOf);
57004
57184
  });
57005
57185
  }, "list"),
57186
+ incoming: /* @__PURE__ */ __name(async (target, { limit = 100 } = {}) => {
57187
+ checkLimit(limit);
57188
+ return read(database, () => {
57189
+ let pointing;
57190
+ if ("externalId" in target) {
57191
+ const row2 = rowOf2(target);
57192
+ if (!row2)
57193
+ return [];
57194
+ pointing = { sql: "SELECT id FROM record_relations WHERE target_id = ?", params: [Number(row2.id)] };
57195
+ } else {
57196
+ const thing = requiredThing(database, target.entity, "the entity");
57197
+ pointing = {
57198
+ 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 = ?",
57199
+ params: ["ref", `${thing.type}:${thing.id}`, thing.type, thing.id]
57200
+ };
57201
+ }
57202
+ 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) => ({
57203
+ record: {
57204
+ provider: String(row2.provider),
57205
+ account: String(row2.account),
57206
+ type: String(row2.type),
57207
+ externalId: String(row2.external_id)
57208
+ },
57209
+ role: String(row2.role),
57210
+ as: row2.as_role == null ? null : String(row2.as_role),
57211
+ amount: row2.amount == null ? null : String(row2.amount)
57212
+ }));
57213
+ });
57214
+ }, "incoming"),
57006
57215
  map: /* @__PURE__ */ __name(async (key2, entity, by) => {
57007
57216
  if (by !== "owner")
57008
57217
  throw new CliError("permission_error", "only the owner says which entity a record is", {
@@ -57085,7 +57294,7 @@ var recordStoreOver = /* @__PURE__ */ __name((context) => {
57085
57294
  };
57086
57295
  }, "recordStoreOver");
57087
57296
 
57088
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/store-errors.js
57297
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/store-errors.js
57089
57298
  var refusalOf = /* @__PURE__ */ __name((error) => error instanceof Error && error.name === "DrizzleQueryError" && error.cause instanceof CliError ? error.cause : error, "refusalOf");
57090
57299
  var wrapped = /* @__PURE__ */ new WeakMap();
57091
57300
  var storeErrors = /* @__PURE__ */ __name((area) => {
@@ -57120,7 +57329,7 @@ var storeErrors = /* @__PURE__ */ __name((area) => {
57120
57329
  return proxy;
57121
57330
  }, "storeErrors");
57122
57331
 
57123
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
57332
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
57124
57333
  var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
57125
57334
  const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
57126
57335
  let merged = { from: from2, to };
@@ -57133,7 +57342,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
57133
57342
  }, "markRange");
57134
57343
  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");
57135
57344
 
57136
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/task-analysis-marks.js
57345
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/task-analysis-marks.js
57137
57346
  var prefixOf2 = /* @__PURE__ */ __name(({ provider, account }) => `task_analysis:${provider}:${account}:`, "prefixOf");
57138
57347
  var markOf = /* @__PURE__ */ __name((prefix, row2) => ({
57139
57348
  chatId: String(row2.key).slice(prefix.length),
@@ -57154,17 +57363,17 @@ var setTaskAnalysisMark = /* @__PURE__ */ __name((database, account, { chatId, c
57154
57363
  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);
57155
57364
  }, "setTaskAnalysisMark");
57156
57365
 
57157
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
57158
- var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
57366
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
57367
+ var keyOf5 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
57159
57368
  var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
57160
- const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
57369
+ const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf5(account));
57161
57370
  return row2 ? JSON.parse(String(row2.value)) : null;
57162
57371
  }, "taskRulesStop");
57163
57372
  var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) => {
57164
- 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);
57373
+ 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);
57165
57374
  }, "setTaskRulesStop");
57166
57375
 
57167
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sync.js
57376
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sync.js
57168
57377
  var syncStoreOver = /* @__PURE__ */ __name((context) => {
57169
57378
  const { database } = context;
57170
57379
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
@@ -57223,7 +57432,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
57223
57432
  };
57224
57433
  }, "syncStoreOver");
57225
57434
 
57226
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/tags.js
57435
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/tags.js
57227
57436
  var tagsStoreOver = /* @__PURE__ */ __name((context) => {
57228
57437
  const { database } = context;
57229
57438
  return {
@@ -57245,7 +57454,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
57245
57454
  };
57246
57455
  }, "tagsStoreOver");
57247
57456
 
57248
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
57457
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
57249
57458
  var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
57250
57459
  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
57251
57460
  WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
@@ -57372,7 +57581,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
57372
57581
  dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
57373
57582
  }, "savePictureChunks");
57374
57583
 
57375
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
57584
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
57376
57585
  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,
57377
57586
  EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
57378
57587
  FROM messages m
@@ -57461,7 +57670,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
57461
57670
  return plain2(best(found2));
57462
57671
  }, "nearestMessages");
57463
57672
 
57464
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/vectors.js
57673
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/vectors.js
57465
57674
  var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
57466
57675
  const { database } = context;
57467
57676
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -57720,7 +57929,7 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
57720
57929
  vectorCounts: /* @__PURE__ */ __name(async (models) => vectorCounts(context, models), "vectorCounts")
57721
57930
  }), "vectorsStoreOver");
57722
57931
 
57723
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
57932
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
57724
57933
  import { existsSync as existsSync2, readFileSync as readFileSync4 } from "node:fs";
57725
57934
  import { dirname as dirname3, join as join3 } from "node:path";
57726
57935
  var BOOKKEEPING2 = ["schema_migrations", "store_settings"];
@@ -57808,10 +58017,10 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
57808
58017
  }
57809
58018
  }, "lastBackup");
57810
58019
 
57811
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/providers.js
58020
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/providers.js
57812
58021
  var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
57813
58022
 
57814
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/owner-languages.js
58023
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/owner-languages.js
57815
58024
  var KEY4 = "ownerLanguages";
57816
58025
  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(" "));
57817
58026
  var DEFAULT_OWNER_LANGUAGES = ["ru"];
@@ -57841,7 +58050,7 @@ var saveOwnerLanguages = /* @__PURE__ */ __name((database, languages, now2) => {
57841
58050
  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);
57842
58051
  }, "saveOwnerLanguages");
57843
58052
 
57844
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
58053
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
57845
58054
  var COUNTED_TABLES = [
57846
58055
  "accounts",
57847
58056
  "chats",
@@ -57926,7 +58135,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
57926
58135
  };
57927
58136
  }, "storeContents");
57928
58137
 
57929
- // node_modules/.pnpm/@wirecat+cli-core@0.609.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_cc90521890eb0d504a7d45d35f643969/node_modules/@wirecat/cli-core/dist/store/store.js
58138
+ // node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/store/store.js
57930
58139
  var openStore = /* @__PURE__ */ __name(async (options = {}) => {
57931
58140
  const context = await openStoreContext(options);
57932
58141
  try {
@@ -57976,16 +58185,14 @@ var storeOver = /* @__PURE__ */ __name((context) => {
57976
58185
  const tasks2 = once3(() => taskStoreOver(context));
57977
58186
  const sourceMentions = once3(() => sourceMentionStoreOver(context));
57978
58187
  const knowledge = once3(() => knowledgeStoreOver(context));
57979
- const notes3 = once3(() => ({ ...notesStoreOver(context), ...addedSourcesOver(context), ...noteSearchOver(context) }));
58188
+ const notes2 = once3(() => ({ ...notesStoreOver(context), ...addedSourcesOver(context), ...noteSearchOver(context) }));
57980
58189
  const catalog = once3(() => catalogStoreOver(context));
57981
58190
  const files2 = once3(() => filesStoreOver(context));
57982
58191
  const calendar = once3(() => ({ ...eventStoreOver(context), ...eventSearchOver(context) }));
57983
58192
  const meetingFindings = once3(() => meetingFindingsStoreOver(context));
57984
58193
  const evidenceFindings = once3(() => evidenceFindingsStoreOver(context));
57985
58194
  const mailFindings = once3(() => mailFindingsStoreOver(context));
57986
- const refs = {
57987
- summaries: /* @__PURE__ */ __name(async (texts2, options) => refSummariesOf(context.database, texts2, { ...options, now: context.now() }), "summaries")
57988
- };
58195
+ const refs = refsStoreOver(context);
57989
58196
  const facts2 = once3(() => factsStoreOver(context));
57990
58197
  const finance = once3(() => financeStoreOver(context));
57991
58198
  const orders2 = once3(() => ordersStoreOver(context));
@@ -58078,7 +58285,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
58078
58285
  return knowledge();
58079
58286
  },
58080
58287
  get notes() {
58081
- return notes3();
58288
+ return notes2();
58082
58289
  },
58083
58290
  get catalog() {
58084
58291
  return catalog();
@@ -58093,6 +58300,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
58093
58300
  return meetingFindings();
58094
58301
  },
58095
58302
  refs,
58303
+ business: businessSearchOver(context),
58096
58304
  get evidenceFindings() {
58097
58305
  return evidenceFindings();
58098
58306
  },
@@ -58310,6 +58518,7 @@ export {
58310
58518
  resetSearchIndex,
58311
58519
  fillStems,
58312
58520
  resetStems,
58521
+ BUSINESS_FIND_MAX,
58313
58522
  pointerOf,
58314
58523
  recordErrors,
58315
58524
  envelopeErrors,