@wirecat/drive-cli 0.63.0 → 0.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +2 -1
  2. package/dist/bin/drive.js +2 -2
  3. package/dist/bundle/{all-profiles-GZJS3UKC.js → all-profiles-BPPT2AK5.js} +13 -13
  4. package/dist/bundle/{anthropic-RGV3WXX5.js → anthropic-JW6GOJUD.js} +13 -11
  5. package/dist/bundle/{app-server-AA2PJ7PV.js → app-server-KAQIOJMZ.js} +53 -53
  6. package/dist/bundle/{bun-OXZYIA3R.js → bun-UT7GNTPV.js} +2 -2
  7. package/dist/bundle/{bun-sqlite-D45NSDM3.js → bun-sqlite-2OIVV3LS.js} +8 -8
  8. package/dist/bundle/{chunk-EOOGWUTP.js → chunk-2FEZ24DK.js} +10 -10
  9. package/dist/bundle/{chunk-TWUH22Z5.js → chunk-2W464HAE.js} +4 -4
  10. package/dist/bundle/{chunk-YIP7ELON.js → chunk-34BIDKF4.js} +275 -419
  11. package/dist/bundle/{chunk-2NIC72HH.js → chunk-36GPBPWM.js} +1 -1
  12. package/dist/bundle/{chunk-44SBK6KB.js → chunk-3J5KAFNA.js} +1601 -877
  13. package/dist/bundle/{chunk-ZM5J6ZMB.js → chunk-3NULZGQU.js} +2 -2
  14. package/dist/bundle/{chunk-DJHLVUL6.js → chunk-46CD64J2.js} +152 -36
  15. package/dist/bundle/{chunk-2TFXK3R4.js → chunk-4CNTID2X.js} +4 -4
  16. package/dist/bundle/{chunk-WYGWWHZP.js → chunk-4YRENUB5.js} +2 -2
  17. package/dist/bundle/{chunk-L37LMMRJ.js → chunk-5HSRQ53R.js} +2 -2
  18. package/dist/bundle/{chunk-XR6ESRU6.js → chunk-5OFA5EXE.js} +2 -2
  19. package/dist/bundle/{chunk-3QINVLZI.js → chunk-5ZBR55US.js} +1 -1
  20. package/dist/bundle/{chunk-LMAVCYLQ.js → chunk-66AF4FBW.js} +4 -4
  21. package/dist/bundle/{chunk-Y6GNA7HE.js → chunk-6B37XO6B.js} +23 -5
  22. package/dist/bundle/{chunk-ZMOUUOT2.js → chunk-6G53ZFUT.js} +1 -1
  23. package/dist/bundle/{chunk-2TDUGC5D.js → chunk-AHB4OJCI.js} +1885 -565
  24. package/dist/bundle/{chunk-E4SDKMBJ.js → chunk-B67BLRAI.js} +3 -3
  25. package/dist/bundle/{chunk-YGU6ULU5.js → chunk-B7XBIOMR.js} +12 -12
  26. package/dist/bundle/{chunk-FEZF3TII.js → chunk-BDYWZ7JE.js} +50 -6
  27. package/dist/bundle/{chunk-BKYMKVHT.js → chunk-BEUAICUD.js} +2 -2
  28. package/dist/bundle/{chunk-ABYGSJZ4.js → chunk-BEZJA44H.js} +7 -7
  29. package/dist/bundle/{chunk-TF23BZW5.js → chunk-BZ2ZKILM.js} +3 -3
  30. package/dist/bundle/{chunk-FUITWY7O.js → chunk-C7WBNOYW.js} +1 -1
  31. package/dist/bundle/{chunk-V3NVXIQR.js → chunk-CPMRM3GQ.js} +231 -191
  32. package/dist/bundle/{chunk-AEX37ETW.js → chunk-DD7EFG6B.js} +2 -2
  33. package/dist/bundle/{chunk-PDCCYHCH.js → chunk-E2LBCCTG.js} +5 -5
  34. package/dist/bundle/{chunk-O2XOX4HB.js → chunk-EC2XGDKJ.js} +50 -34
  35. package/dist/bundle/{chunk-4OSSOWDM.js → chunk-EJ4PNHPP.js} +1 -1
  36. package/dist/bundle/{chunk-4S4JMW6I.js → chunk-EQEGJVO2.js} +1 -1
  37. package/dist/bundle/{chunk-XNVFKMVR.js → chunk-EWGVDFPT.js} +957 -533
  38. package/dist/bundle/{chunk-CE2TJBLP.js → chunk-EZ6O3ST3.js} +3 -3
  39. package/dist/bundle/{chunk-FRIJUILO.js → chunk-F2VDAG32.js} +3 -3
  40. package/dist/bundle/{chunk-HZZCEQTH.js → chunk-G3NULXOM.js} +4 -4
  41. package/dist/bundle/{chunk-OD4U7GUY.js → chunk-G4KEKKDE.js} +20 -20
  42. package/dist/bundle/{chunk-OTROVC4E.js → chunk-GSMYXGFR.js} +1 -1
  43. package/dist/bundle/{chunk-4CIZWCXV.js → chunk-GW3U6OLD.js} +1 -1
  44. package/dist/bundle/{chunk-6EY46GAN.js → chunk-HW4UPST2.js} +2 -2
  45. package/dist/bundle/{chunk-2HF2MRXI.js → chunk-IDAK4DDK.js} +1 -1
  46. package/dist/bundle/{chunk-27YUUGXQ.js → chunk-IK6KH3RE.js} +1 -1
  47. package/dist/bundle/{chunk-DJ3SDJZY.js → chunk-IX7NQJLY.js} +8 -8
  48. package/dist/bundle/{chunk-534OBX5Y.js → chunk-J62DI53V.js} +1 -1
  49. package/dist/bundle/{chunk-PO5RQQIG.js → chunk-JRXFW7HE.js} +5 -5
  50. package/dist/bundle/{chunk-XIUDS3OK.js → chunk-K6BSB53R.js} +1 -1
  51. package/dist/bundle/{chunk-ND6LLYGF.js → chunk-KE4XPPRQ.js} +27 -27
  52. package/dist/bundle/{chunk-UQLWMGSD.js → chunk-KG2XKEHL.js} +5 -5
  53. package/dist/bundle/{chunk-MOTRI3SY.js → chunk-KIN6PDFE.js} +24 -2
  54. package/dist/bundle/{chunk-VAUMOZU5.js → chunk-KVW4XNKB.js} +16 -16
  55. package/dist/bundle/{chunk-33MGFUED.js → chunk-LOMW6F2E.js} +194 -229
  56. package/dist/bundle/{chunk-5PPL7JDM.js → chunk-M73NNJ3X.js} +2 -2
  57. package/dist/bundle/{chunk-QCKZ3GAA.js → chunk-N622LRPM.js} +4 -4
  58. package/dist/bundle/{chunk-3BZRKLJ6.js → chunk-O2QO5UZC.js} +13 -13
  59. package/dist/bundle/{chunk-SXM6MHRR.js → chunk-OEVHZOHC.js} +12 -12
  60. package/dist/bundle/{chunk-6MQSQ4LX.js → chunk-OH3K2E7X.js} +402 -184
  61. package/dist/bundle/{chunk-J24ZFCWM.js → chunk-P7DEGRZA.js} +21 -21
  62. package/dist/bundle/{chunk-YUWPNG7B.js → chunk-PBMSBCVB.js} +1 -1
  63. package/dist/bundle/{chunk-S4RXABDR.js → chunk-QEAD2LF4.js} +3 -3
  64. package/dist/bundle/{chunk-OXY6SSZG.js → chunk-QXCKJUZY.js} +33 -18
  65. package/dist/bundle/{chunk-LZEOQW7S.js → chunk-SIOIMO62.js} +36 -36
  66. package/dist/bundle/{chunk-RKELRWH7.js → chunk-TNV2FXVK.js} +5 -5
  67. package/dist/bundle/{chunk-UPOSDTPT.js → chunk-UD55VB2N.js} +3 -3
  68. package/dist/bundle/{chunk-6KQJSFYF.js → chunk-UIEA6FIV.js} +22 -22
  69. package/dist/bundle/{chunk-XDC3TWTL.js → chunk-UJR272CP.js} +28 -28
  70. package/dist/bundle/{chunk-3HK5WMI5.js → chunk-USLZE36C.js} +6 -6
  71. package/dist/bundle/{chunk-ZOJU7ZFI.js → chunk-VIJ6ACYB.js} +8 -8
  72. package/dist/bundle/{chunk-VKPCONDQ.js → chunk-VPLFD5RJ.js} +4 -4
  73. package/dist/bundle/{chunk-VJEOGKAN.js → chunk-VT2UFYPJ.js} +7 -7
  74. package/dist/bundle/{chunk-Q5DJTRKV.js → chunk-WWCYTMAV.js} +2 -2
  75. package/dist/bundle/{chunk-7EMQ26BA.js → chunk-XPXKD63J.js} +13 -13
  76. package/dist/bundle/{chunk-J4DIHPZ6.js → chunk-ZF6GUZCE.js} +1 -1
  77. package/dist/bundle/{chunk-Z42YYLTS.js → chunk-ZRZ4HTCK.js} +52 -34
  78. package/dist/bundle/{chunk-NEFSGCVA.js → chunk-ZSZJLJIA.js} +10 -10
  79. package/dist/bundle/command-contract-H5OYJOPF.js +38 -0
  80. package/dist/bundle/{decode-G5YEIPNC.js → decode-HTOQ6S3V.js} +8 -8
  81. package/dist/bundle/{dispatch-GEFIXA6X.js → dispatch-SH5SP6LA.js} +11 -11
  82. package/dist/bundle/drive.js +11 -11
  83. package/dist/bundle/{echarts-W2CWHNXR.js → echarts-KFHB6SLX.js} +2 -2
  84. package/dist/bundle/{embed-OBFFPVF4.js → embed-YATFB2PN.js} +9 -9
  85. package/dist/bundle/{embedder-NGCBQHIG.js → embedder-MQPDFGTJ.js} +12 -12
  86. package/dist/bundle/entry-YZBB647C.js +22 -0
  87. package/dist/bundle/{failure-GV77W3CD.js → failure-4FQL4XJI.js} +4 -4
  88. package/dist/bundle/first-run-5JT3UQZB.js +30 -0
  89. package/dist/bundle/first-screen-BEMDEWO7.js +36 -0
  90. package/dist/bundle/{google-CIWUVJ5C.js → google-DVADVICN.js} +13 -13
  91. package/dist/bundle/{google-api-Z3NSTBBR.js → google-api-QMFGCXBM.js} +55 -56
  92. package/dist/bundle/grants-WKB2E4TA.js +103 -0
  93. package/dist/bundle/{identity-OM6GFZ7T.js → identity-FYVDK4M2.js} +6 -6
  94. package/dist/bundle/{instructions-YQBQSYSS.js → instructions-D3GF3B7M.js} +1 -1
  95. package/dist/bundle/{login-7RYSDVN3.js → login-COFZ2IWP.js} +61 -62
  96. package/dist/bundle/{mcp-GWDA3HOA.js → mcp-RKJG22KM.js} +2 -2
  97. package/dist/bundle/{node-IVU33RL7.js → node-OFICOKX3.js} +2 -2
  98. package/dist/bundle/{node-sqlite-SIH5BEW2.js → node-sqlite-DNBTDOXD.js} +9 -9
  99. package/dist/bundle/oauth-PDQHWFBF.js +22 -0
  100. package/dist/bundle/{open-IAO2SNII.js → open-PTPR2YWX.js} +8 -8
  101. package/dist/bundle/{openai-SGOUBHXP.js → openai-2KV5LUW4.js} +17 -17
  102. package/dist/bundle/{process-BPBMV3AT.js → process-EAW6NST2.js} +1 -1
  103. package/dist/bundle/{program-MYKKJ4F6.js → program-6UV5Q5YN.js} +306 -276
  104. package/dist/bundle/prompt-634TPMJK.js +19 -0
  105. package/dist/bundle/{reasons-57J2D77K.js → reasons-DDWCEYSQ.js} +5 -5
  106. package/dist/bundle/{recognize-A5C5RPB3.js → recognize-SJO6QUDW.js} +7 -7
  107. package/dist/bundle/{remote-VWYFLRGO.js → remote-6JXZITKF.js} +10 -10
  108. package/dist/bundle/{rerank-4NGQWREA.js → rerank-MD5VOPQ6.js} +10 -10
  109. package/dist/bundle/{serve-Y6LQTFH5.js → serve-LZTROA2M.js} +12 -12
  110. package/dist/bundle/server-GT7X666D.js +69 -0
  111. package/dist/bundle/{server-6AUHIIUA.js → server-NSA3UAFY.js} +43 -43
  112. package/dist/bundle/{services-2W4J7EMW.js → services-F5A6XQCV.js} +63 -33
  113. package/dist/bundle/{sqlite-runtime-P6BBDX2H.js → sqlite-runtime-7YF6REKS.js} +9 -9
  114. package/dist/bundle/{start-AFFA3LKM.js → start-MUFLE6FA.js} +30 -8
  115. package/dist/bundle/{state-PXKKXR3R.js → state-UC54F3YZ.js} +9 -9
  116. package/dist/bundle/{store-IVV2BAGZ.js → store-F5FJGWMR.js} +28 -20
  117. package/dist/bundle/{store-CN6JEUC4.js → store-J53YNAH6.js} +35 -18
  118. package/dist/bundle/store-maintenance-command-GJVXLBAB.js +58 -0
  119. package/dist/bundle/tokens-H2EJKGA5.js +101 -0
  120. package/dist/commands/account.d.ts +4 -0
  121. package/dist/commands/account.d.ts.map +1 -0
  122. package/dist/commands/account.js +33 -0
  123. package/dist/commands/account.js.map +1 -0
  124. package/dist/profile-lock.d.ts +1 -0
  125. package/dist/profile-lock.d.ts.map +1 -1
  126. package/dist/profile-lock.js +1 -0
  127. package/dist/profile-lock.js.map +1 -1
  128. package/dist/program.d.ts.map +1 -1
  129. package/dist/program.js +2 -0
  130. package/dist/program.js.map +1 -1
  131. package/dist/version.d.ts +1 -1
  132. package/dist/version.js +1 -1
  133. package/package.json +3 -3
  134. package/dist/bundle/chunk-Z5KC7XBR.js +0 -33
  135. package/dist/bundle/command-contract-BRW3AP44.js +0 -38
  136. package/dist/bundle/entry-ET6HGM7A.js +0 -22
  137. package/dist/bundle/first-run-JG52UZVO.js +0 -30
  138. package/dist/bundle/first-screen-CIL3GFAA.js +0 -36
  139. package/dist/bundle/grants-3S4RL3WB.js +0 -104
  140. package/dist/bundle/oauth-PT4JEHLL.js +0 -22
  141. package/dist/bundle/prompt-3ZM64DCB.js +0 -17
  142. package/dist/bundle/server-PFHI35HA.js +0 -69
  143. package/dist/bundle/store-maintenance-command-MSY2QNEH.js +0 -59
  144. package/dist/bundle/tokens-P4LPNUFW.js +0 -102
  145. /package/dist/bundle/{chunk-ZQ3GWKDQ.js → chunk-SW6C6WH5.js} +0 -0
@@ -5,9 +5,13 @@ import {
5
5
  googleDocumentId,
6
6
  googleDocumentLinks,
7
7
  trimUrl
8
- } from "./chunk-UPOSDTPT.js";
8
+ } from "./chunk-UD55VB2N.js";
9
9
  import {
10
+ BUSINESS_KINDS,
11
+ CATALOG_KINDS,
10
12
  CHAT_MESSAGES_READ,
13
+ CONTRACT_KINDS,
14
+ CONTRACT_STATUSES,
11
15
  COUNTERPART_ROLE,
12
16
  DEAL_KINDS,
13
17
  DEAL_ROLES,
@@ -25,6 +29,7 @@ import {
25
29
  MEMORY_SCOPES,
26
30
  MONEY_DIRECTIONS,
27
31
  MeetingError,
32
+ ORDER_DIRECTIONS,
28
33
  ORDER_PURPOSES,
29
34
  ORDER_STATUSES,
30
35
  PRIORITY_LABELS,
@@ -33,11 +38,14 @@ import {
33
38
  ROLE_LISTS,
34
39
  STAGE_OUTCOMES,
35
40
  STANDINGS,
41
+ SUBSCRIPTION_STATUSES,
36
42
  TASK_KINDS,
37
43
  TASK_ORIGINS,
38
44
  TASK_STATES,
39
45
  TASK_TYPES,
40
46
  TASK_VERDICTS,
47
+ TRANSACTION_STATUSES,
48
+ WALLET_KINDS,
41
49
  WORK_TASK_TYPES,
42
50
  aggregateMeetingCounts,
43
51
  aggregateMeetingStats,
@@ -46,8 +54,8 @@ import {
46
54
  checkEnds,
47
55
  checkRole,
48
56
  checkedScore,
57
+ contractLine,
49
58
  currencyOf,
50
- dayMonth,
51
59
  dealLine,
52
60
  entryInWindow,
53
61
  entryMetadata,
@@ -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,
@@ -92,6 +100,7 @@ import {
92
100
  paymentTitle,
93
101
  priorityBand,
94
102
  priorityLabel,
103
+ productLine,
95
104
  project,
96
105
  quantityOf,
97
106
  refuseDamagedStore,
@@ -102,7 +111,9 @@ import {
102
111
  settledStatus,
103
112
  signedMinorUnits,
104
113
  standingOf,
114
+ subscriptionLine,
105
115
  tagOf,
116
+ transactionLine,
106
117
  transcriptLanguage,
107
118
  usableLinkSql,
108
119
  validEvidence,
@@ -114,8 +125,9 @@ import {
114
125
  validateMeetingPreparationContext,
115
126
  validateMeetingRelatedHistory,
116
127
  validateMeetingSeriesHistory,
117
- validatePayment
118
- } from "./chunk-V3NVXIQR.js";
128
+ validatePayment,
129
+ walletLine
130
+ } from "./chunk-CPMRM3GQ.js";
119
131
  import {
120
132
  OPERATORS_BY_TYPE,
121
133
  QUERY_LIMITS,
@@ -131,12 +143,12 @@ import {
131
143
  validateQuery,
132
144
  walkQuery,
133
145
  zonedMoment
134
- } from "./chunk-EOOGWUTP.js";
146
+ } from "./chunk-2FEZ24DK.js";
135
147
  import {
136
148
  holdsCredential,
137
149
  secretNamed,
138
150
  sqliteCode
139
- } from "./chunk-E4SDKMBJ.js";
151
+ } from "./chunk-B67BLRAI.js";
140
152
  import {
141
153
  DEFAULT_STEMMERS,
142
154
  DEFAULT_STEMMERS_VERSION,
@@ -149,21 +161,21 @@ import {
149
161
  fold,
150
162
  normalize,
151
163
  parseStemmers
152
- } from "./chunk-ZOJU7ZFI.js";
164
+ } from "./chunk-VIJ6ACYB.js";
153
165
  import {
154
166
  DEFAULT_TASK_CATEGORIES,
155
167
  sharedConfigPath,
156
168
  storedTaskCategories,
157
169
  taskCategoriesReader
158
- } from "./chunk-ABYGSJZ4.js";
170
+ } from "./chunk-BEZJA44H.js";
159
171
  import {
160
172
  refuseOwnerStoreInTests,
161
173
  storePath
162
- } from "./chunk-AEX37ETW.js";
174
+ } from "./chunk-DD7EFG6B.js";
163
175
  import {
164
176
  quietSqliteWarning,
165
177
  storeCapable
166
- } from "./chunk-3HK5WMI5.js";
178
+ } from "./chunk-USLZE36C.js";
167
179
  import {
168
180
  SQLiteTable,
169
181
  TableAliasProxyHandler,
@@ -188,19 +200,19 @@ import {
188
200
  sql,
189
201
  sqliteTable,
190
202
  text
191
- } from "./chunk-4S4JMW6I.js";
203
+ } from "./chunk-EQEGJVO2.js";
192
204
  import {
193
205
  PRAGMAS,
194
206
  TIME_LIMIT_FUNCTION,
195
207
  TimeLimitReached,
196
208
  isQueryOnly
197
- } from "./chunk-2NIC72HH.js";
209
+ } from "./chunk-36GPBPWM.js";
198
210
  import {
199
211
  resolveFrom
200
212
  } from "./chunk-Y5E2WNWB.js";
201
213
  import {
202
214
  singleLine
203
- } from "./chunk-2HF2MRXI.js";
215
+ } from "./chunk-IDAK4DDK.js";
204
216
  import {
205
217
  array,
206
218
  boolean,
@@ -218,11 +230,11 @@ import {
218
230
  safeParse,
219
231
  strictObject,
220
232
  string
221
- } from "./chunk-FEZF3TII.js";
233
+ } from "./chunk-BDYWZ7JE.js";
222
234
  import {
223
235
  CliError,
224
236
  isCliError
225
- } from "./chunk-4OSSOWDM.js";
237
+ } from "./chunk-EJ4PNHPP.js";
226
238
  import {
227
239
  __commonJS,
228
240
  __name,
@@ -9966,7 +9978,7 @@ var require_cjs = __commonJS({
9966
9978
  }
9967
9979
  });
9968
9980
 
9969
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/account-store.js
9981
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/account-store.js
9970
9982
  var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
9971
9983
  const methods = whole;
9972
9984
  return Object.fromEntries(Object.keys(keyed).map((name) => [
@@ -10094,7 +10106,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
10094
10106
  };
10095
10107
  }, "bindAccount");
10096
10108
 
10097
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/locator.js
10109
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/locator.js
10098
10110
  var SCHEME = "msg:";
10099
10111
  var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat: chat2, message: message3 }) => SCHEME + [provider, account, chat2, message3].map(encodeURIComponent).join("/"), "formatLocator");
10100
10112
  var isLocator = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith(SCHEME), "isLocator");
@@ -10108,7 +10120,7 @@ var parseLocator = /* @__PURE__ */ __name((reference2) => {
10108
10120
  return { provider, account, chat: chat2, message: message3 };
10109
10121
  }, "parseLocator");
10110
10122
 
10111
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/references.js
10123
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/references.js
10112
10124
  var SIMPLE_REFERENCES = [
10113
10125
  "note",
10114
10126
  "document",
@@ -10264,7 +10276,7 @@ var looksLikeReference = /* @__PURE__ */ __name((text7) => {
10264
10276
  return match !== null && byPrefix.has(match[1]);
10265
10277
  }, "looksLikeReference");
10266
10278
 
10267
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/providers.js
10279
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/providers.js
10268
10280
  var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events", "crm"];
10269
10281
  var MESSENGER_OPENS = { chat: "messages list", message: "messages show", contact: "contacts show" };
10270
10282
  var PROVIDERS = [
@@ -10427,7 +10439,7 @@ var holdsKind = /* @__PURE__ */ __name((provider, kind4) => kindsIn(provider).in
10427
10439
  var holdsKindOf = /* @__PURE__ */ __name((provider, kind4) => kindIn(provider) === void 0 ? kind4 === "messages" : holdsKind(provider, kind4), "holdsKindOf");
10428
10440
  var kindOf = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
10429
10441
 
10430
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/query.js
10442
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/search/query.js
10431
10443
  var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
10432
10444
  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");
10433
10445
  var fail = /* @__PURE__ */ __name((message3) => {
@@ -10450,7 +10462,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
10450
10462
  return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
10451
10463
  }, "sourceOf");
10452
10464
 
10453
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/account-list.js
10465
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/search/account-list.js
10454
10466
  var ACCOUNT_GROUPS = "accountGroups";
10455
10467
  var ACCOUNT_GROUPS_SETTING = "account_groups";
10456
10468
  var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
@@ -10625,16 +10637,16 @@ var READS = {
10625
10637
  events: "calendar events \u2014 no search reads them yet",
10626
10638
  crm: "CRM deals and leads \u2014 search all reads them"
10627
10639
  };
10628
- var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind4) => READS[kind4]) => {
10640
+ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind4) => READS[kind4], alsoFits = () => false) => {
10629
10641
  const chosen = /* @__PURE__ */ new Map();
10630
10642
  const skipped = [];
10631
10643
  for (const { entry: entry2, accounts: accounts2 } of entries) {
10632
- const fits = accounts2.filter((one2) => kinds2.some((kind4) => listedHolds(one2, kind4)));
10644
+ const fits = accounts2.filter((one2) => kinds2.some((kind4) => listedHolds(one2, kind4)) || alsoFits(one2));
10633
10645
  for (const { provider, account } of fits)
10634
10646
  if (!chosen.has(keyOf({ provider, account })))
10635
10647
  chosen.set(keyOf({ provider, account }), { provider, account });
10636
10648
  const known2 = accounts2.filter(({ kind: kind4 }) => kind4 !== void 0);
10637
- const unknown2 = accounts2.filter(({ kind: kind4 }) => kind4 === void 0);
10649
+ const unknown2 = accounts2.filter((one2) => one2.kind === void 0 && !alsoFits(one2));
10638
10650
  if (known2.length)
10639
10651
  for (const { provider, account } of unknown2)
10640
10652
  skipped.push({ source: `${provider}:${account}`, code: "not_found", reason: UNKNOWN_PROVIDER });
@@ -10648,7 +10660,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind4)
10648
10660
  return { accounts: [...chosen.values()], skipped };
10649
10661
  }, "fitting");
10650
10662
 
10651
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
10663
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
10652
10664
  var IndexBuilderOn = class {
10653
10665
  static {
10654
10666
  __name(this, "IndexBuilderOn");
@@ -10843,34 +10855,7 @@ function alias(table, alias2) {
10843
10855
  }
10844
10856
  __name(alias, "alias");
10845
10857
 
10846
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/business.js
10847
- var CATALOG_KINDS = ["product", "service"];
10848
- var CONTRACT_KINDS = ["sale", "purchase", "service", "lease", "employment", "nda", "license", "other"];
10849
- var CONTRACT_STATUSES = ["draft", "active", "ended", "terminated"];
10850
- var SUBSCRIPTION_STATUSES = ["trial", "active", "paused", "cancelled", "ended"];
10851
- var WALLET_KINDS = ["bank", "card", "cash", "wallet", "other"];
10852
- var TRANSACTION_STATUSES = ["pending", "booked"];
10853
- var ORDER_DIRECTIONS = ["purchase", "sale"];
10854
- var intervalOf = /* @__PURE__ */ __name((text7, reason = "subscription.interval") => {
10855
- const match = typeof text7 === "string" ? /^(?:([1-9]\d{0,2})-)?(day|week|month|year)$/.exec(text7.trim()) : null;
10856
- if (!match)
10857
- throw new CliError("validation_error", "an interval is a count and a unit, such as 1-month or 2-week", { reason });
10858
- return { count: match[1] === void 0 ? 1 : Number(match[1]), unit: match[2] };
10859
- }, "intervalOf");
10860
- var intervalText = /* @__PURE__ */ __name(({ count, unit }) => `${count}-${unit}`, "intervalText");
10861
- var priced = /* @__PURE__ */ __name((units, currency2) => units === null || currency2 === null ? "" : `, ${moneyLabel(units, currency2)}`, "priced");
10862
- var pending = /* @__PURE__ */ __name((review) => review === "confirmed" ? null : review, "pending");
10863
- var productLine = /* @__PURE__ */ __name((product) => {
10864
- const price = product.unitPrice === null || product.currency === null ? "" : moneyLabel(product.unitPrice, product.currency);
10865
- const per = price && product.unit !== null ? ` per ${product.unit}` : "";
10866
- return `${product.name}${price ? ` \xB7 ${price}${per}` : ""}${notes(product.kind, product.archived ? "archived" : null)}`;
10867
- }, "productLine");
10868
- var contractLine = /* @__PURE__ */ __name((contract) => `${contract.number ?? `#${contract.id}`} \xB7 ${contract.name}${priced(contract.value, contract.currency)}` + notes(contract.status, pending(contract.review)), "contractLine");
10869
- var subscriptionLine = /* @__PURE__ */ __name((subscription) => `${subscription.name}${priced(subscription.price, subscription.currency)} every ${intervalText(subscription.interval)}` + notes(subscription.status, pending(subscription.review)), "subscriptionLine");
10870
- var walletLine = /* @__PURE__ */ __name((wallet) => `${wallet.name} \xB7 ${wallet.kind}, ${wallet.currency}${wallet.numberHint === null ? "" : `, \u2026${wallet.numberHint}`}` + notes(wallet.closed ? "closed" : null), "walletLine");
10871
- 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");
10872
-
10873
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/record-fields.js
10858
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/record-fields.js
10874
10859
  var DECIMAL_PATTERN = "^[0-9]{1,16}(\\.[0-9]{1,6})?$";
10875
10860
  var SIGNED_DECIMAL = "^-?[0-9]{1,16}(\\.[0-9]{1,6})?$";
10876
10861
  var DAY = "^[0-9]{4}-[0-9]{2}-[0-9]{2}$";
@@ -10989,7 +10974,7 @@ var fieldError = /* @__PURE__ */ __name((schema, value, at = []) => {
10989
10974
  return void 0;
10990
10975
  }, "fieldError");
10991
10976
 
10992
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/record-types.js
10977
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/record-types.js
10993
10978
  var kept = /* @__PURE__ */ __name((description) => ({ description }), "kept");
10994
10979
  var PARTY = ["person", "organization"];
10995
10980
  var ORGANIZATION = ["organization"];
@@ -11362,7 +11347,7 @@ var hasV1Roles = /* @__PURE__ */ __name((type) => rolesOf2(type).some(([, role])
11362
11347
  var IDENTITY_TYPES = RECORD_ENTITY_TYPES.filter((type) => RECORD_TYPES[type].review === "identity");
11363
11348
  var article = /* @__PURE__ */ __name((word2) => /^[aeiou]/.test(word2) ? "an" : "a", "article");
11364
11349
 
11365
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
11350
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
11366
11351
  var ENTITY_TABLES = {
11367
11352
  ...RECORD_TABLES,
11368
11353
  account: "accounts",
@@ -11374,6 +11359,7 @@ var ENTITY_TABLES = {
11374
11359
  document: "documents",
11375
11360
  document_picture: "documents",
11376
11361
  email: "emails",
11362
+ email_enrichment: "emails",
11377
11363
  email_thread: "email_threads",
11378
11364
  event: "events",
11379
11365
  event_series: "event_series",
@@ -11400,14 +11386,14 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
11400
11386
  return { table, pointer, type, count, known: known2 };
11401
11387
  }).filter(({ count }) => count > 0)), "orphanPointers");
11402
11388
 
11403
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/source-review.js
11389
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/source-review.js
11404
11390
  var SOURCE_REVIEW_KIND = "memory_source_review";
11405
11391
  var SOURCE_REVIEW_CAUSES = ["changed", "outdated", "deleted", "contradicted"];
11406
11392
  var ERASED_TEXT = "[source erased]";
11407
11393
  var severity = /* @__PURE__ */ __name((cause) => SOURCE_REVIEW_CAUSES.indexOf(cause), "severity");
11408
11394
  var graver = /* @__PURE__ */ __name((a, b) => severity(b) > severity(a) ? b : a, "graver");
11409
11395
 
11410
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
11396
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
11411
11397
  var BOT_KINDS = ["agent", "rule", "script", "integration"];
11412
11398
  var ownerPerson = /* @__PURE__ */ __name((database) => {
11413
11399
  const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
@@ -11464,7 +11450,7 @@ var proposedBySql = /* @__PURE__ */ __name((type, id2, by) => {
11464
11450
  return { sql: bot("pb.name = ?"), params: [by.bot] };
11465
11451
  }, "proposedBySql");
11466
11452
 
11467
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review-marks.js
11453
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review-marks.js
11468
11454
  var TABLES = { memory: "memories", fact: "facts" };
11469
11455
  var HOLDING = { memory: ["proposed", "confirmed"], fact: ["proposed", "accepted"] };
11470
11456
  var KEPT = 20;
@@ -11559,7 +11545,7 @@ var scrubSourceReviews = /* @__PURE__ */ __name((database, erased, { refs }) =>
11559
11545
  return scrubbed;
11560
11546
  }, "scrubSourceReviews");
11561
11547
 
11562
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
11548
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
11563
11549
  var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
11564
11550
  var REFERABLE = {
11565
11551
  ...Object.fromEntries(Object.entries(RECORD_TYPES).map(([type, { tombstone: tombstone2 }]) => [type, { tombstone: tombstone2 }])),
@@ -11719,7 +11705,7 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
11719
11705
  return row2 ? String(row2.id ?? row2.key) : void 0;
11720
11706
  }, "taskIdOf");
11721
11707
 
11722
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-signature.js
11708
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-signature.js
11723
11709
  var QUOTE_LIMIT = 500;
11724
11710
  var GONE = { sig: "gone", rev: null, deleted: true, changedAt: null };
11725
11711
  var part = /* @__PURE__ */ __name((value) => value == null ? "" : String(value), "part");
@@ -11997,7 +11983,7 @@ var deleteDocumentRow = /* @__PURE__ */ __name((database, id2, at) => {
11997
11983
  database.prepare("DELETE FROM documents WHERE id = ?").run(id2);
11998
11984
  }, "deleteDocumentRow");
11999
11985
 
12000
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
11986
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
12001
11987
  var canonicalTags = sqliteTable("canonical_tags", {
12002
11988
  id: integer("id").primaryKey(),
12003
11989
  name: text("name").notNull().unique(),
@@ -12006,7 +11992,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
12006
11992
  updatedAt: integer("updated_at").notNull()
12007
11993
  });
12008
11994
 
12009
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/link-revisions.js
11995
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/link-revisions.js
12010
11996
  var linkRevisions = sqliteTable("link_revisions", {
12011
11997
  id: integer("id").primaryKey(),
12012
11998
  linkId: integer("link_id").notNull(),
@@ -12018,7 +12004,7 @@ var linkRevisions = sqliteTable("link_revisions", {
12018
12004
  createdAt: integer("created_at").notNull()
12019
12005
  }, (table) => [index("link_revisions_by_link_id_created_at").on(table.linkId, table.createdAt)]);
12020
12006
 
12021
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
12007
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
12022
12008
  var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
12023
12009
  sourceKey: text("source_key").notNull(),
12024
12010
  collection: text("collection").notNull(),
@@ -12028,13 +12014,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
12028
12014
  createdAt: integer("created_at").notNull()
12029
12015
  }, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
12030
12016
 
12031
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
12017
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
12032
12018
  var documentIndexPending = sqliteTable("document_index_pending", {
12033
12019
  id: integer("id").notNull(),
12034
12020
  indexableType: text("indexable_type").notNull()
12035
12021
  }, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
12036
12022
 
12037
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/decision-requests.js
12023
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/decision-requests.js
12038
12024
  var decisionRequests = sqliteTable("decision_requests", {
12039
12025
  id: integer("id").primaryKey(),
12040
12026
  tokenDigest: text("token_digest").notNull().unique(),
@@ -12054,7 +12040,19 @@ var decisionRequests = sqliteTable("decision_requests", {
12054
12040
  index("decision_requests_by_channel_bot_profile_chat_id_message_id").on(table.channel, table.botProfile, table.chatId, table.messageId)
12055
12041
  ]);
12056
12042
 
12057
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/links.js
12043
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/enrichments.js
12044
+ var enrichments = sqliteTable("enrichments", {
12045
+ subjectType: text("subject_type").notNull(),
12046
+ subjectId: integer("subject_id").notNull(),
12047
+ sourceHash: text("source_hash").notNull(),
12048
+ provider: text("provider").notNull(),
12049
+ model: text("model").notNull(),
12050
+ text: text("text").notNull(),
12051
+ tokens: integer("tokens").notNull(),
12052
+ createdAt: integer("created_at").notNull()
12053
+ }, (table) => [primaryKey({ columns: [table.subjectType, table.subjectId] })]);
12054
+
12055
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/links.js
12058
12056
  var links = sqliteTable("links", {
12059
12057
  id: integer("id").primaryKey(),
12060
12058
  fromType: text("from_type").notNull(),
@@ -12085,7 +12083,7 @@ var links = sqliteTable("links", {
12085
12083
  index("links_by_to_type_to_id").on(table.toType, table.toId)
12086
12084
  ]);
12087
12085
 
12088
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
12086
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
12089
12087
  var tagRedirects = sqliteTable("tag_redirects", {
12090
12088
  sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
12091
12089
  survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
@@ -12111,7 +12109,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
12111
12109
  index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
12112
12110
  ]);
12113
12111
 
12114
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
12112
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
12115
12113
  var accounts = sqliteTable("accounts", {
12116
12114
  id: integer("id").primaryKey(),
12117
12115
  provider: text("provider").notNull(),
@@ -12782,7 +12780,7 @@ var documentRevisions = sqliteTable("document_revisions", {
12782
12780
  revision: integer("revision").notNull(),
12783
12781
  createdAt: integer("created_at").notNull()
12784
12782
  }, (table) => [index("document_revisions_by_document_id").on(table.documentId)]);
12785
- var notes2 = sqliteTable("notes", {
12783
+ var notes = sqliteTable("notes", {
12786
12784
  id: integer("id").primaryKey(),
12787
12785
  notableType: text("notable_type").notNull(),
12788
12786
  notableId: integer("notable_id").notNull(),
@@ -12800,7 +12798,7 @@ var notes2 = sqliteTable("notes", {
12800
12798
  ]);
12801
12799
  var noteRevisions = sqliteTable("note_revisions", {
12802
12800
  id: integer("id").primaryKey(),
12803
- noteId: integer("note_id").notNull().references(() => notes2.id),
12801
+ noteId: integer("note_id").notNull().references(() => notes.id),
12804
12802
  body: text("body").notNull(),
12805
12803
  revision: integer("revision").notNull(),
12806
12804
  createdAt: integer("created_at").notNull()
@@ -14107,10 +14105,10 @@ var storeSettings = sqliteTable("store_settings", {
14107
14105
  at: integer("at").notNull()
14108
14106
  });
14109
14107
 
14110
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
14108
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
14111
14109
  import { AsyncLocalStorage } from "node:async_hooks";
14112
14110
 
14113
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
14111
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
14114
14112
  var ARMS = [
14115
14113
  [
14116
14114
  "message",
@@ -14203,16 +14201,15 @@ var linkArm = /* @__PURE__ */ __name((linkFrom, linkTo) => `
14203
14201
  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)
14204
14202
  `, "linkArm");
14205
14203
  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";
14206
- var sourcesOf = /* @__PURE__ */ __name((subject2) => {
14207
- if (subject2 === void 0)
14204
+ var sourcesOf = /* @__PURE__ */ __name((type) => {
14205
+ if (type === void 0)
14208
14206
  return [COLUMNS, ...ARMS.map(([, , sql2]) => sql2), linkArm("1", "1")].join(" UNION ");
14209
- if (!/^[a-z_]+$/.test(subject2.type) || !Number.isSafeInteger(subject2.id))
14210
- throw new CliError("configuration_error", `the involvement queue holds ${subject2.type} ${subject2.id}`);
14211
- const { type, id: id2 } = subject2;
14207
+ if (!/^[a-z_]+$/.test(type))
14208
+ throw new CliError("configuration_error", `the involvement queue holds a ${type}`);
14212
14209
  return [
14213
14210
  COLUMNS,
14214
- ...ARMS.filter(([of]) => of === type).map(([, key2, sql2]) => `${sql2} AND ${key2}=${id2}`),
14215
- linkArm(`from_type='${type}' AND from_id=${id2}`, `to_type='${type}' AND to_id=${id2}`)
14211
+ ...ARMS.filter(([of]) => of === type).map(([, key2, sql2]) => `${sql2} AND ${key2}=?`),
14212
+ linkArm(`from_type='${type}' AND from_id=?`, `to_type='${type}' AND to_id=?`)
14216
14213
  ].join(" UNION ");
14217
14214
  }, "sourcesOf");
14218
14215
  var INSERT = "INSERT INTO involvements (person_id, identity_id, subject_type, subject_id, role, occurred_at, scope, account_id, project_id, created_at)";
@@ -14229,7 +14226,9 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
14229
14226
  break;
14230
14227
  for (const subject2 of subjects) {
14231
14228
  drop.run(subject2.type, subject2.id);
14232
- database.prepare(`${INSERT} SELECT s.*, ? FROM (${sourcesOf(subject2)}) s JOIN persons p ON p.id=s.person_id`).run(at);
14229
+ const sql2 = `${INSERT} SELECT s.*, ? FROM (${sourcesOf(subject2.type)}) s JOIN persons p ON p.id=s.person_id`;
14230
+ const ids = Array(sql2.split("?").length - 2).fill(subject2.id);
14231
+ database.prepare(sql2).run(at, ...ids);
14233
14232
  done.run(subject2.type, subject2.id);
14234
14233
  }
14235
14234
  recomputed += subjects.length;
@@ -14237,7 +14236,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
14237
14236
  return recomputed;
14238
14237
  }, "drainInvolvementQueue");
14239
14238
 
14240
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/mentions.js
14239
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/mentions.js
14241
14240
  import { domainToUnicode } from "node:url";
14242
14241
 
14243
14242
  // node_modules/.pnpm/psl@1.15.0/node_modules/psl/dist/psl.mjs
@@ -24259,7 +24258,7 @@ var oa = /* @__PURE__ */ __name((e) => {
24259
24258
  }, "oa");
24260
24259
  var na = { parse: O, get: aa, isValid: oa };
24261
24260
 
24262
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
24261
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
24263
24262
  var PHONE_PLANS = [
24264
24263
  {
24265
24264
  country: "us",
@@ -24639,7 +24638,7 @@ var PHONE_PLANS = [
24639
24638
  }
24640
24639
  ];
24641
24640
 
24642
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/phones.js
24641
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/phones.js
24643
24642
  var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
24644
24643
  var DEFAULT_PHONE_COUNTRIES = ["ru"];
24645
24644
  var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
@@ -24680,7 +24679,7 @@ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
24680
24679
  return void 0;
24681
24680
  }, "nationalPhone");
24682
24681
 
24683
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/places.js
24682
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/places.js
24684
24683
  var BEFORE = [
24685
24684
  [/^(?:ул\.?|улиц[аеыу]|улицей)$/iu, "\u0443\u043B\u0438\u0446\u0430"],
24686
24685
  [/^(?:пр-т|просп\.?|проспект[аеу]?)$/iu, "\u043F\u0440\u043E\u0441\u043F\u0435\u043A\u0442"],
@@ -24940,7 +24939,7 @@ var findPlaces = /* @__PURE__ */ __name((text7) => {
24940
24939
  return found2.sort((a, b) => a.start - b.start);
24941
24940
  }, "findPlaces");
24942
24941
 
24943
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/mentions.js
24942
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/mentions.js
24944
24943
  var MENTION_KINDS = ["phone", "email", "url", "document", "person-name", "place"];
24945
24944
  var MENTION_VERSIONS = {
24946
24945
  phone: 1,
@@ -25130,7 +25129,7 @@ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE
25130
25129
  };
25131
25130
  }, "typedPhone");
25132
25131
 
25133
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/first-names.js
25132
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/first-names.js
25134
25133
  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";
25135
25134
  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";
25136
25135
  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";
@@ -25138,7 +25137,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
25138
25137
  var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
25139
25138
  var NAME_WORDS = WORDS.split(" ");
25140
25139
 
25141
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/person-names.js
25140
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/person-names.js
25142
25141
  var LATIN_TO_CYRILLIC = {
25143
25142
  shch: "\u0449",
25144
25143
  sch: "\u0449",
@@ -25346,7 +25345,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text7, stem, taken) => {
25346
25345
  return found2;
25347
25346
  }, "findUnknownNames");
25348
25347
 
25349
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/attachments.js
25348
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/attachments.js
25350
25349
  var NOT_FILES = /* @__PURE__ */ new Set([
25351
25350
  "webpage",
25352
25351
  "share",
@@ -25386,7 +25385,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored4, files2) => {
25386
25385
  });
25387
25386
  }, "matchDownloads");
25388
25387
 
25389
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
25388
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
25390
25389
  var QUERY_VERSION = 1;
25391
25390
  var QUERY_LIMITS2 = {
25392
25391
  ...QUERY_LIMITS,
@@ -25422,7 +25421,7 @@ function exhausted(budget) {
25422
25421
  }
25423
25422
  __name(exhausted, "exhausted");
25424
25423
 
25425
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
25424
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
25426
25425
  var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
25427
25426
  var literal2 = /* @__PURE__ */ __name((c) => ({
25428
25427
  kind: "char",
@@ -25822,7 +25821,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
25822
25821
  return out;
25823
25822
  }, "foldRegex");
25824
25823
 
25825
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
25824
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
25826
25825
  var PRESET_VERSION = 1;
25827
25826
  var PRESETS = {
25828
25827
  password: {
@@ -25876,7 +25875,7 @@ var PRESETS = {
25876
25875
  }
25877
25876
  };
25878
25877
 
25879
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
25878
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
25880
25879
  var FIELD_VERSION = 2;
25881
25880
  var UNITS = {
25882
25881
  "": 1,
@@ -26388,12 +26387,12 @@ var QUERY_OPERATORS = [
26388
26387
  { name: "boost / minimum / intervals", example: "invoice^2", semantics: "query.unsupported-operator" }
26389
26388
  ];
26390
26389
 
26391
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
26390
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
26392
26391
  var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
26393
26392
  var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
26394
26393
  var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
26395
26394
 
26396
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
26395
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
26397
26396
  var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
26398
26397
  var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
26399
26398
  var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
@@ -26417,7 +26416,7 @@ var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
26417
26416
  };
26418
26417
  }, "linkMatch");
26419
26418
 
26420
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
26419
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
26421
26420
  var SETTING = "phoneCountries";
26422
26421
  var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
26423
26422
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
@@ -26448,7 +26447,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
26448
26447
  return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
26449
26448
  }, "valueMatch");
26450
26449
 
26451
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
26450
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
26452
26451
  var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
26453
26452
  if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
26454
26453
  throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
@@ -26476,7 +26475,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
26476
26475
  return 2 * intersection2 / (aa2.size + bb.size);
26477
26476
  }, "vocabularySimilarity");
26478
26477
 
26479
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
26478
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
26480
26479
  import { createHash } from "node:crypto";
26481
26480
  var folded3 = /* @__PURE__ */ __name((name) => {
26482
26481
  try {
@@ -26542,7 +26541,7 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind4, by, options
26542
26541
  });
26543
26542
  }, "guardTagCreation");
26544
26543
 
26545
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
26544
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
26546
26545
  var invalid2 = /* @__PURE__ */ __name((message3) => {
26547
26546
  throw new CliError("validation_error", message3);
26548
26547
  }, "invalid");
@@ -26619,7 +26618,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
26619
26618
  };
26620
26619
  }, "createTagRedirectIndex");
26621
26620
 
26622
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
26621
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
26623
26622
  var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
26624
26623
  const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
26625
26624
  if (!row2)
@@ -26647,7 +26646,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
26647
26646
  return snapshot2;
26648
26647
  }, "tagRedirectSnapshot");
26649
26648
 
26650
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
26649
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
26651
26650
  import { createHash as createHash2 } from "node:crypto";
26652
26651
  var TASK_KEY_PREFIXES = {
26653
26652
  question: "Q",
@@ -26675,7 +26674,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
26675
26674
  return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
26676
26675
  }, "taskAccountOf");
26677
26676
 
26678
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
26677
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
26679
26678
  var toMs = /* @__PURE__ */ __name((iso16) => {
26680
26679
  if (iso16 === null || iso16 === void 0)
26681
26680
  return null;
@@ -26689,7 +26688,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
26689
26688
  var DELIVERY = { delivered: 1, read: 2 };
26690
26689
  var deliveryOf = /* @__PURE__ */ __name((stored4) => stored4 === DELIVERY.read ? "read" : stored4 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
26691
26690
 
26692
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
26691
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
26693
26692
  var TAG_KINDS = ["tag", "topic"];
26694
26693
  var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
26695
26694
  var TAG_TYPE = {
@@ -26892,7 +26891,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
26892
26891
  return result;
26893
26892
  }, "tagsOf");
26894
26893
 
26895
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
26894
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
26896
26895
  var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
26897
26896
  var SPEECH = speech("att");
26898
26897
  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");
@@ -27256,7 +27255,7 @@ var FIELD_COMPILERS = {
27256
27255
  subject
27257
27256
  };
27258
27257
 
27259
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
27258
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
27260
27259
  var placeOf = /* @__PURE__ */ __name((database) => {
27261
27260
  const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
27262
27261
  const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
@@ -27272,7 +27271,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
27272
27271
  };
27273
27272
  }, "placeOf");
27274
27273
 
27275
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
27274
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
27276
27275
  var DRAIN_ON_WRITE = 500;
27277
27276
  var METHOD = "rules";
27278
27277
  var telegramLink = /* @__PURE__ */ __name((database) => {
@@ -27435,7 +27434,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
27435
27434
  return queued.length;
27436
27435
  }, "drainMentions");
27437
27436
 
27438
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
27437
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
27439
27438
  var indexRow = /* @__PURE__ */ __name((database, name) => {
27440
27439
  const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
27441
27440
  if (!exists2)
@@ -27443,7 +27442,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
27443
27442
  return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
27444
27443
  }, "indexRow");
27445
27444
 
27446
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
27445
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
27447
27446
  var INDEX = "message_stems";
27448
27447
  var SETTING2 = "searchStemmers";
27449
27448
  var DRAIN_ON_WRITE2 = 500;
@@ -27486,16 +27485,16 @@ var stemsState = /* @__PURE__ */ __name((database) => {
27486
27485
  return void 0;
27487
27486
  const watermark = Number(row2.watermark);
27488
27487
  const filledThrough = Number(row2.filled_through);
27489
- const pending2 = Number(database.prepare("SELECT count(*) AS n FROM message_stems_pending").get()?.n);
27488
+ const pending = Number(database.prepare("SELECT count(*) AS n FROM message_stems_pending").get()?.n);
27490
27489
  const built = row2.analyzer === null ? null : String(row2.analyzer);
27491
27490
  const stemmers = storeStemmers(database);
27492
27491
  const wanted = stemmers ? analyzerIdentity(stemmers) : UNKNOWN;
27493
- const ready = stemmers !== null && (built === wanted || built === null) && filledThrough >= watermark && pending2 === 0;
27492
+ const ready = stemmers !== null && (built === wanted || built === null) && filledThrough >= watermark && pending === 0;
27494
27493
  const cause = !stemmers ? "stemmer_unknown" : built !== null && built !== wanted ? "stemmer_changed" : "building";
27495
27494
  return {
27496
27495
  watermark,
27497
27496
  filledThrough,
27498
- pending: pending2,
27497
+ pending,
27499
27498
  built,
27500
27499
  wanted,
27501
27500
  ready,
@@ -27565,7 +27564,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
27565
27564
  };
27566
27565
  }, "stemmerCache");
27567
27566
 
27568
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
27567
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
27569
27568
  var rehearsal = new AsyncLocalStorage();
27570
27569
  var SQLITE_BUSY = 5;
27571
27570
  var pause = new Int32Array(new SharedArrayBuffer(4));
@@ -27699,7 +27698,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
27699
27698
  }
27700
27699
  }, "read");
27701
27700
 
27702
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
27701
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
27703
27702
  var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
27704
27703
  coalesce(CASE k.chunkable_type
27705
27704
  WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
@@ -27756,8 +27755,8 @@ var fillVectorIndexes = /* @__PURE__ */ __name((database, { batch = FILL_HASHES,
27756
27755
  }, "notice") } = {}) => {
27757
27756
  for (const { model, dims } of modelsWithoutIndex(database))
27758
27757
  writeBatch(database, () => ensureVectorIndex(database, model, Number(dims)));
27759
- const pending2 = database.prepare("SELECT id, model, dims, filled_through FROM vector_indexes WHERE ready = 0 ORDER BY id").all();
27760
- for (const { id: id2, model, dims, filled_through } of pending2) {
27758
+ const pending = database.prepare("SELECT id, model, dims, filled_through FROM vector_indexes WHERE ready = 0 ORDER BY id").all();
27759
+ for (const { id: id2, model, dims, filled_through } of pending) {
27761
27760
  notice(model);
27762
27761
  const table = tableOf(id2);
27763
27762
  const step = database.prepare(`INSERT INTO ${table} (${COLUMNS2}) ${source(model, dims)}
@@ -27778,7 +27777,7 @@ var fillVectorIndexes = /* @__PURE__ */ __name((database, { batch = FILL_HASHES,
27778
27777
  break;
27779
27778
  }
27780
27779
  }
27781
- return pending2.map(({ model }) => model);
27780
+ return pending.map(({ model }) => model);
27782
27781
  }, "fillVectorIndexes");
27783
27782
  var NEAR_TIE = 1e-5;
27784
27783
  var MAX_K = 4096;
@@ -27841,7 +27840,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
27841
27840
  }, "dropUnusedVectors");
27842
27841
  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");
27843
27842
 
27844
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
27843
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
27845
27844
  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({
27846
27845
  target: [accounts.provider, accounts.externalId],
27847
27846
  set: {
@@ -27972,7 +27971,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
27972
27971
  AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
27973
27972
  }, "dropOrphanPeople");
27974
27973
 
27975
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
27974
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
27976
27975
  var FOLDED = [
27977
27976
  { table: "tasks", column: "title" },
27978
27977
  { table: "tasks", column: "close_reason" },
@@ -27990,13 +27989,13 @@ var folded4 = /* @__PURE__ */ __name((value) => value === null || value === void
27990
27989
  var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
27991
27990
  let filled2 = 0;
27992
27991
  for (const { table, column: column2 } of FOLDED) {
27993
- const pending2 = database.prepare(`SELECT id, ${column2} AS value FROM ${table} WHERE ${column2} IS NOT NULL AND ${column2}_folded IS NULL LIMIT ?`);
27994
- if (pending2.get(1) === void 0)
27992
+ const pending = database.prepare(`SELECT id, ${column2} AS value FROM ${table} WHERE ${column2} IS NOT NULL AND ${column2}_folded IS NULL LIMIT ?`);
27993
+ if (pending.get(1) === void 0)
27995
27994
  continue;
27996
27995
  const fill = database.prepare(`UPDATE ${table} SET ${column2}_folded = ? WHERE id = ?`);
27997
27996
  for (; ; ) {
27998
27997
  const count = writeBatch(database, () => {
27999
- const rows = pending2.all(batch);
27998
+ const rows = pending.all(batch);
28000
27999
  for (const row2 of rows)
28001
28000
  fill.run(fold(String(row2.value)), Number(row2.id));
28002
28001
  return rows.length;
@@ -28009,7 +28008,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
28009
28008
  return filled2;
28010
28009
  }, "fillFolded");
28011
28010
 
28012
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/history-skips.js
28011
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/history-skips.js
28013
28012
  var HISTORY_KEY = "$history";
28014
28013
  var objectOf2 = /* @__PURE__ */ __name((text7) => {
28015
28014
  if (typeof text7 !== "string")
@@ -28085,7 +28084,7 @@ var withoutHistory = /* @__PURE__ */ __name((metadata3) => {
28085
28084
  return rest;
28086
28085
  }, "withoutHistory");
28087
28086
 
28088
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
28087
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
28089
28088
  import { createHash as createHash3 } from "node:crypto";
28090
28089
  var CHUNK_CHARS = 1200;
28091
28090
  var CHUNK_OVERLAP = 150;
@@ -28190,7 +28189,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
28190
28189
  return chunks2;
28191
28190
  }, "cutChunks");
28192
28191
 
28193
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/task-signature.js
28192
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/search/task-signature.js
28194
28193
  var DAY2 = 864e5;
28195
28194
  var CURRENCY = [
28196
28195
  [/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
@@ -28316,7 +28315,7 @@ var dueDayOf = /* @__PURE__ */ __name((text7, createdMs) => {
28316
28315
  return best?.day ?? null;
28317
28316
  }, "dueDayOf");
28318
28317
 
28319
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
28318
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
28320
28319
  var DAY3 = 864e5;
28321
28320
  var STOP_WORDS = new Set([
28322
28321
  // Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
@@ -28471,7 +28470,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
28471
28470
  ...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
28472
28471
  })).sort((a, b) => b.score - a.score), "rankCandidates");
28473
28472
 
28474
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
28473
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
28475
28474
  var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
28476
28475
  r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
28477
28476
  JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
@@ -28707,7 +28706,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
28707
28706
  const member = /* @__PURE__ */ __name((pk) => sql`EXISTS (SELECT 1 FROM conversation_messages cm
28708
28707
  JOIN conversations c ON c.id = cm.conversation_id WHERE cm.message_id = ${pk} AND c.build = ${build})`, "member");
28709
28708
  const editedSince = /* @__PURE__ */ __name((pk) => sql`EXISTS (SELECT 1 FROM message_revisions r WHERE r.message_id = ${pk} AND r.created_at >= ${builtAt})`, "editedSince");
28710
- const pending2 = orm.get(sql`SELECT
28709
+ const pending = orm.get(sql`SELECT
28711
28710
  sum(m.deleted_at IS NULL AND NOT ${member(sql`m.id`)}) AS new,
28712
28711
  sum(m.deleted_at IS NULL AND ${editedSince(sql`m.id`)} AND ${member(sql`m.id`)}) AS edited,
28713
28712
  sum(m.deleted_at IS NOT NULL AND ${member(sql`m.id`)}) AS deleted
@@ -28734,15 +28733,19 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
28734
28733
  builtAt,
28735
28734
  algorithmVersion: state.algorithmVersion,
28736
28735
  pending: {
28737
- new: Number(pending2?.new ?? 0),
28738
- edited: Number(pending2?.edited ?? 0),
28739
- deleted: Number(pending2?.deleted ?? 0)
28736
+ new: Number(pending?.new ?? 0),
28737
+ edited: Number(pending?.edited ?? 0),
28738
+ deleted: Number(pending?.deleted ?? 0)
28740
28739
  },
28741
28740
  vectors: { chunks: chunks2, embedded: Number(vectors?.embedded ?? 0), current, stale: stale4, missing: chunks2 - current - stale4 }
28742
28741
  };
28743
28742
  }, "readiness");
28743
+ var vectorCounts = /* @__PURE__ */ __name(({ orm }, models) => new Map(models.map((model) => [
28744
+ model,
28745
+ Number(orm.get(sql`SELECT count(*) AS n FROM embeddings WHERE model = ${model}`)?.n ?? 0)
28746
+ ])), "vectorCounts");
28744
28747
 
28745
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
28748
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
28746
28749
  var DOCUMENT_PICTURE = "document_picture";
28747
28750
  var SCAN_PAGE2 = 5e3;
28748
28751
  var idOf = /* @__PURE__ */ __name((ref3) => {
@@ -28805,7 +28808,106 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
28805
28808
  }, "nearestPictures")
28806
28809
  }), "documentPicturesOver");
28807
28810
 
28808
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
28811
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/index-text.js
28812
+ var noteIndexText = /* @__PURE__ */ __name((title, text7) => title ? `${title}
28813
+
28814
+ ${text7}` : text7, "noteIndexText");
28815
+
28816
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/enrichments.js
28817
+ var ENRICHMENT_SUBJECTS = ["document", "note", "email"];
28818
+ var ENRICHMENT_POSITION = 1e6;
28819
+ var EMAIL_ENRICHMENT = "email_enrichment";
28820
+ var LIVE2 = {
28821
+ document: "SELECT d.id, d.title, coalesce(d.body, '') AS body, coalesce(d.external_updated_at, d.updated_at) AS at FROM documents d WHERE d.deleted_at IS NULL AND coalesce(json_extract(d.metadata, '$.catalog.active'), 1) = 1",
28822
+ note: "SELECT n.id, n.title, coalesce(n.body, '') AS body, n.updated_at AS at FROM notes n WHERE n.deleted_at IS NULL",
28823
+ email: "SELECT e.id, e.subject AS title, coalesce(e.body_text, '') AS body, coalesce(e.sent_at, e.received_at) AS at FROM emails e WHERE e.deleted_at IS NULL"
28824
+ };
28825
+ var QUEUES = {
28826
+ document: "INSERT OR IGNORE INTO document_index_pending (indexable_type, id) VALUES ('document', ?)",
28827
+ note: "INSERT OR IGNORE INTO note_index_pending (indexable_type, id) VALUES ('note', ?)",
28828
+ email: "INSERT OR IGNORE INTO email_index_pending (indexable_type, id) VALUES ('email', ?)"
28829
+ };
28830
+ var currentEnrichment = /* @__PURE__ */ __name((database, type, id2, indexed) => {
28831
+ if (!ENRICHMENT_SUBJECTS.includes(type))
28832
+ return void 0;
28833
+ const row2 = database.prepare("SELECT text, source_hash FROM enrichments WHERE subject_type = ? AND subject_id = ?").get(type, id2);
28834
+ return row2 && String(row2.source_hash) === chunkHash(indexed) ? String(row2.text) : void 0;
28835
+ }, "currentEnrichment");
28836
+ var enrichmentText = /* @__PURE__ */ __name((database, type, id2) => {
28837
+ const row2 = database.prepare("SELECT text FROM enrichments WHERE subject_type = ? AND subject_id = ?").get(type === EMAIL_ENRICHMENT ? "email" : type, id2);
28838
+ return row2 === void 0 ? void 0 : String(row2.text);
28839
+ }, "enrichmentText");
28840
+ var scan = /* @__PURE__ */ __name(function* (database, type, only) {
28841
+ const held = new Map(database.prepare("SELECT subject_id AS id, source_hash AS hash FROM enrichments WHERE subject_type = ?").all(type).map((row2) => [Number(row2.id), String(row2.hash)]));
28842
+ for (const row2 of database.prepare(`${LIVE2[type]} ORDER BY 1`).all()) {
28843
+ const id2 = Number(row2.id);
28844
+ if (only && !only.has(id2))
28845
+ continue;
28846
+ const title = row2.title == null ? null : String(row2.title);
28847
+ const text7 = noteIndexText(title, String(row2.body));
28848
+ if (!text7.trim())
28849
+ continue;
28850
+ const hash2 = chunkHash(text7);
28851
+ yield { type, id: id2, text: text7, at: row2.at == null ? null : Number(row2.at), hash: hash2, enriched: held.get(id2) === hash2 };
28852
+ }
28853
+ }, "scan");
28854
+ var enrichmentsOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
28855
+ pending: /* @__PURE__ */ __name(async (limit, { types = ENRICHMENT_SUBJECTS, only } = {}) => {
28856
+ const found2 = [];
28857
+ for (const type of types) {
28858
+ const ids = only ? new Set(only.filter((one2) => one2.type === type).map((one2) => one2.id)) : void 0;
28859
+ if (ids?.size === 0)
28860
+ continue;
28861
+ for (const { enriched, ...candidate } of scan(database, type, ids)) {
28862
+ if (found2.length >= limit)
28863
+ return found2;
28864
+ if (!enriched)
28865
+ found2.push(candidate);
28866
+ }
28867
+ }
28868
+ return found2;
28869
+ }, "pending"),
28870
+ counts: /* @__PURE__ */ __name(async () => {
28871
+ const counts = {
28872
+ records: 0,
28873
+ enriched: 0,
28874
+ pendingChars: 0,
28875
+ pendingByType: { document: 0, note: 0, email: 0 }
28876
+ };
28877
+ for (const type of ENRICHMENT_SUBJECTS)
28878
+ for (const one2 of scan(database, type)) {
28879
+ counts.records += 1;
28880
+ if (one2.enriched)
28881
+ counts.enriched += 1;
28882
+ else {
28883
+ counts.pendingChars += one2.text.length;
28884
+ counts.pendingByType[type] += 1;
28885
+ }
28886
+ }
28887
+ return counts;
28888
+ }, "counts"),
28889
+ save: /* @__PURE__ */ __name(async (rows) => write(database, () => {
28890
+ const upsert2 = database.prepare(`INSERT INTO enrichments (subject_type, subject_id, source_hash, provider, model, text, tokens, created_at)
28891
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
28892
+ ON CONFLICT (subject_type, subject_id) DO UPDATE SET source_hash = excluded.source_hash,
28893
+ provider = excluded.provider, model = excluded.model, text = excluded.text, tokens = excluded.tokens,
28894
+ created_at = excluded.created_at`);
28895
+ const at = now2();
28896
+ for (const row2 of rows) {
28897
+ upsert2.run(row2.type, row2.id, row2.hash, row2.provider, row2.model, row2.text, row2.tokens, at);
28898
+ database.prepare(QUEUES[row2.type]).run(row2.id);
28899
+ }
28900
+ }), "save"),
28901
+ clear: /* @__PURE__ */ __name(async () => write(database, () => {
28902
+ const rows = database.prepare("SELECT subject_type AS type, subject_id AS id FROM enrichments").all();
28903
+ for (const row2 of rows)
28904
+ database.prepare(QUEUES[row2.type]).run(Number(row2.id));
28905
+ database.prepare("DELETE FROM enrichments").run();
28906
+ return rows.length;
28907
+ }), "clear")
28908
+ }), "enrichmentsOver");
28909
+
28910
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
28809
28911
  var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
28810
28912
  const literal5 = escaped2 ?? plain2 ?? "";
28811
28913
  return wildcard ?? (/[*?[]/u.test(literal5) ? `[${literal5}]` : literal5);
@@ -28870,7 +28972,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
28870
28972
  var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
28871
28973
  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");
28872
28974
 
28873
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
28975
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
28874
28976
  var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
28875
28977
  var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
28876
28978
  var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
@@ -28960,7 +29062,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
28960
29062
  });
28961
29063
  }, "linkMeeting");
28962
29064
 
28963
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
29065
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
28964
29066
  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), ''))";
28965
29067
  var UNSEARCHED_EVENT_TYPES = [
28966
29068
  "working-location",
@@ -29023,9 +29125,6 @@ var CORPORA = {
29023
29125
  read: `SELECT e.title, ${EVENT_TEXT} AS body, ${EVENT_LIVE} AS live, coalesce((SELECT a.scope FROM calendar_entries ce JOIN calendars c ON c.id = ce.calendar_id JOIN accounts a ON a.id = c.account_id WHERE ce.event_id = e.id LIMIT 1), 'personal') AS scope, (SELECT c.account_id FROM calendar_entries ce JOIN calendars c ON c.id = ce.calendar_id WHERE ce.event_id = e.id AND ce.deleted_at IS NULL ORDER BY ce.id LIMIT 1) AS account_id FROM events e WHERE e.id = ?`
29024
29126
  }
29025
29127
  };
29026
- var noteIndexText = /* @__PURE__ */ __name((title, text7) => title ? `${title}
29027
-
29028
- ${text7}` : text7, "noteIndexText");
29029
29128
  var queuedAs = /* @__PURE__ */ __name((corpus) => corpus.queued ?? corpus.type, "queuedAs");
29030
29129
  var hasTrigrams = /* @__PURE__ */ __name((corpus) => corpus.type === "note" || corpus.type === "document", "hasTrigrams");
29031
29130
  var holdingText = /* @__PURE__ */ __name((type, column2, search2) => {
@@ -29072,20 +29171,20 @@ var fillTrigrams = /* @__PURE__ */ __name((database, { batch = 200, until = /* @
29072
29171
  }, "fillTrigrams");
29073
29172
  var corpusIndexState = /* @__PURE__ */ __name((database, corpus) => {
29074
29173
  const row2 = indexRow(database, corpus.index);
29075
- const pending2 = Number(database.prepare(`SELECT count(*) AS n FROM ${corpus.type}_index_pending WHERE indexable_type = ?`).get(queuedAs(corpus))?.n);
29174
+ const pending = Number(database.prepare(`SELECT count(*) AS n FROM ${corpus.type}_index_pending WHERE indexable_type = ?`).get(queuedAs(corpus))?.n);
29076
29175
  const saved = savedStemmers(database);
29077
29176
  const wanted = saved === null ? null : analyzerIdentity(saved ?? DEFAULT_STEMMERS);
29078
29177
  const built = row2.analyzer === null ? null : String(row2.analyzer);
29079
- return { pending: pending2, built, wanted, ready: pending2 === 0 && wanted !== null && (built === wanted || built === null) };
29178
+ return { pending, built, wanted, ready: pending === 0 && wanted !== null && (built === wanted || built === null) };
29080
29179
  }, "corpusIndexState");
29081
29180
  var noteIndexState = /* @__PURE__ */ __name((database) => {
29082
29181
  const documents2 = corpusIndexState(database, CORPORA.document);
29083
- const notes3 = corpusIndexState(database, CORPORA.note);
29182
+ const notes2 = corpusIndexState(database, CORPORA.note);
29084
29183
  return {
29085
- pending: documents2.pending + notes3.pending,
29086
- built: notes3.built ?? documents2.built,
29087
- wanted: notes3.wanted,
29088
- ready: documents2.ready && notes3.ready
29184
+ pending: documents2.pending + notes2.pending,
29185
+ built: notes2.built ?? documents2.built,
29186
+ wanted: notes2.wanted,
29187
+ ready: documents2.ready && notes2.ready
29089
29188
  };
29090
29189
  }, "noteIndexState");
29091
29190
  var storedSections = /* @__PURE__ */ __name((metadata3) => {
@@ -29108,27 +29207,44 @@ var writer2 = /* @__PURE__ */ __name((database, corpus, stemmer) => {
29108
29207
  stems: database.prepare(`INSERT INTO ${corpus.type}_stems (rowid, stems, scope) VALUES (?, ?, ?)`),
29109
29208
  trigrams: hasTrigrams(corpus) ? database.prepare(`INSERT INTO ${corpus.type}_trigrams (rowid, text) VALUES (?, ?)`) : null,
29110
29209
  chunk: database.prepare("INSERT INTO chunks (chunkable_type, chunkable_id, position, start_offset, end_offset, content_hash, scope, account_id, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"),
29111
- dequeue: database.prepare(`DELETE FROM ${corpus.type}_index_pending WHERE indexable_type = ? AND id = ?`)
29210
+ dequeue: database.prepare(`DELETE FROM ${corpus.type}_index_pending WHERE indexable_type = ? AND id = ?`),
29211
+ emailAt: database.prepare("SELECT coalesce(received_at, sent_at) AS at FROM emails WHERE id = ?")
29112
29212
  };
29213
+ const enrichedType = corpus.type === "email" ? EMAIL_ENRICHMENT : corpus.type;
29113
29214
  return (id2) => {
29114
29215
  const row2 = read3.get(id2);
29115
- const before2 = oldHashes.all(corpus.type, id2).map((hash2) => String(hash2.hash));
29216
+ const before2 = [
29217
+ ...oldHashes.all(corpus.type, id2).map((hash2) => String(hash2.hash)),
29218
+ ...corpus.type === "email" ? oldHashes.all(EMAIL_ENRICHMENT, id2).map((hash2) => String(hash2.hash)) : []
29219
+ ];
29116
29220
  statements.dropWords.run(id2);
29117
29221
  statements.dropStems.run(id2);
29118
29222
  statements.dropTrigrams?.run(id2);
29119
29223
  statements.dropChunks.run(corpus.type, id2);
29224
+ if (corpus.type === "email")
29225
+ statements.dropChunks.run(EMAIL_ENRICHMENT, id2);
29120
29226
  const live2 = row2 !== void 0 && Number(row2.live) === 1;
29121
29227
  const text7 = live2 ? noteIndexText(row2.title == null ? null : String(row2.title), String(row2.body)) : "";
29122
29228
  const scope3 = live2 ? String(row2.scope ?? "personal") : "";
29229
+ const enrichment = text7.trim() ? currentEnrichment(database, corpus.type, id2, text7) : void 0;
29123
29230
  const terms2 = corpus.terms && text7 ? corpus.terms(text7, stemmer) : void 0;
29124
29231
  const words3 = terms2 ? terms2.words : normalize(text7);
29125
29232
  if (words3 !== "") {
29126
29233
  statements.words.run(id2, words3, scope3);
29127
29234
  statements.trigrams?.run(id2, words3);
29128
29235
  }
29129
- const stems = terms2 ? terms2.stems : text7 ? stemmer.indexText(text7) : "";
29236
+ const stems = terms2 ? terms2.stems : text7 ? stemmer.indexText(enrichment ? `${text7}
29237
+
29238
+ ${enrichment}` : text7) : "";
29130
29239
  if (stems !== "")
29131
29240
  statements.stems.run(id2, stems, scope3);
29241
+ if (enrichment) {
29242
+ const at = Date.now();
29243
+ const occurred = corpus.type === "email" ? int(statements.emailAt.get(id2)?.at) : null;
29244
+ statements.chunk.run(enrichedType, id2, corpus.type === "email" ? 0 : ENRICHMENT_POSITION, 0, 0, chunkHash(enrichment), scope3, int(row2?.account_id), at, at);
29245
+ if (occurred !== null && occurred !== void 0)
29246
+ database.prepare("UPDATE chunks SET occurred_at = ? WHERE chunkable_type = ? AND chunkable_id = ?").run(occurred, EMAIL_ENRICHMENT, id2);
29247
+ }
29132
29248
  if (text7.trim() && corpus.pieces !== false) {
29133
29249
  const at = Date.now();
29134
29250
  const sections = row2?.metadata == null ? [] : storedSections(String(row2.metadata));
@@ -29192,7 +29308,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
29192
29308
  return true;
29193
29309
  }, "resetNoteIndex");
29194
29310
 
29195
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
29311
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
29196
29312
  var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
29197
29313
  var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
29198
29314
  for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
@@ -29211,7 +29327,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
29211
29327
  }
29212
29328
  }, "resolvePersonLinks");
29213
29329
 
29214
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
29330
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
29215
29331
  var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
29216
29332
  var prepare = /* @__PURE__ */ __name((orm) => ({
29217
29333
  find: orm.select({
@@ -29353,14 +29469,14 @@ var people = /* @__PURE__ */ __name(({ orm, database }, provider, { account, acc
29353
29469
  const byId2 = new Map(everyone.map((person2) => [person2.id, person2]));
29354
29470
  return { provider, get: /* @__PURE__ */ __name((id2) => byId2.get(id2), "get"), all: /* @__PURE__ */ __name(() => everyone, "all") };
29355
29471
  }, "people");
29356
- var contactsWhere = /* @__PURE__ */ __name((accountKey, key2, { query, notes: notes3 }) => {
29472
+ var contactsWhere = /* @__PURE__ */ __name((accountKey, key2, { query, notes: notes2 }) => {
29357
29473
  if (query !== void 0 && query.trim().length < 3) {
29358
29474
  throw new CliError("validation_error", `a contact search takes at least 3 characters, got "${query}"`);
29359
29475
  }
29360
- const noted = notes3 === void 0 ? void 0 : holdingText("note", "n.id", notes3);
29476
+ const noted = notes2 === void 0 ? void 0 : holdingText("note", "n.id", notes2);
29361
29477
  return and(eq(accountIdentities.accountId, accountKey), ne(identities.externalId, key2.account), sql`EXISTS (SELECT 1 FROM ${chatMembers} JOIN ${chats} ON ${chats.id} = ${chatMembers.chatId}
29362
29478
  WHERE ${chatMembers.identityId} = ${identities.id} AND ${chats.accountId} = ${accountIdentities.accountId}
29363
- 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``})`);
29479
+ 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``})`);
29364
29480
  }, "contactsWhere");
29365
29481
  var contacts = /* @__PURE__ */ __name(({ orm }, accountKey, key2, { order, limit, offset = 0, ...filter }) => {
29366
29482
  const byName = [
@@ -29436,7 +29552,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
29436
29552
  }, "meetingIdentityPk");
29437
29553
  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");
29438
29554
 
29439
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
29555
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
29440
29556
  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");
29441
29557
  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");
29442
29558
  var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
@@ -29724,7 +29840,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
29724
29840
  }
29725
29841
  }, "replaceAutoTags");
29726
29842
 
29727
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/counters.js
29843
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/counters.js
29728
29844
  var COUNTER_FIELDS = ["views", "reactions", "comments"];
29729
29845
  var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
29730
29846
  var counterObservationTime = /* @__PURE__ */ __name((observation, now2) => {
@@ -29743,7 +29859,7 @@ var counterFreshness = /* @__PURE__ */ __name((states) => {
29743
29859
  return states.some((one2) => one2.freshness === "stale") ? "stale" : "fresh";
29744
29860
  }, "counterFreshness");
29745
29861
 
29746
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/context/evidence.js
29862
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/context/evidence.js
29747
29863
  import { createHash as createHash4 } from "node:crypto";
29748
29864
  var CONTEXT_MAX_READ_BYTES = 262144;
29749
29865
  var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
@@ -29841,7 +29957,7 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
29841
29957
  return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
29842
29958
  }, "contextEvidenceRequest");
29843
29959
 
29844
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/email-activity.js
29960
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/email-activity.js
29845
29961
  var MAIL_AGENDA_COLUMNS = { chat_kind: { type: "enum", sql: "'dialog'" } };
29846
29962
  var ACTIVITY = `
29847
29963
  SELECT t.external_id AS thread, t.subject, t.last_email_at, t.emails_count,
@@ -29971,7 +30087,7 @@ var mailActivity = /* @__PURE__ */ __name((database) => ({
29971
30087
  threadActivity: /* @__PURE__ */ __name(async (accountId, since, where) => threadActivity(database, accountId, since, where), "threadActivity")
29972
30088
  }), "mailActivity");
29973
30089
 
29974
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
30090
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
29975
30091
  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");
29976
30092
  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;
29977
30093
  var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
@@ -30052,15 +30168,17 @@ var mailCore = /* @__PURE__ */ __name((body2, earlier) => {
30052
30168
  return withoutSignOff(withoutGreeting(kept2)).join("\n").trim();
30053
30169
  }, "mailCore");
30054
30170
 
30055
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
30171
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
30056
30172
  var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
30057
30173
  var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
30058
- k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
30174
+ k.start_offset, k.end_offset, k.account_id, k.occurred_at,
30175
+ CASE k.chunkable_type WHEN 'email_enrichment' THEN k.chunkable_id ELSE a.attachable_id END AS email_id,
30059
30176
  CASE k.chunkable_type WHEN 'email_thread' THEN k.chunkable_id
30060
- ELSE (SELECT email_thread_id FROM emails WHERE id = a.attachable_id) END AS thread_id
30177
+ ELSE (SELECT email_thread_id FROM emails
30178
+ WHERE id = CASE k.chunkable_type WHEN 'email_enrichment' THEN k.chunkable_id ELSE a.attachable_id END) END AS thread_id
30061
30179
  FROM chunks k LEFT JOIN attachments a ON k.chunkable_type = 'attachment' AND a.id = k.chunkable_id
30062
30180
  AND a.attachable_type = 'email'
30063
- WHERE k.chunkable_type = 'email_thread' OR a.id IS NOT NULL) p`;
30181
+ WHERE k.chunkable_type IN ('email_thread', 'email_enrichment') OR a.id IS NOT NULL) p`;
30064
30182
  var threadText = /* @__PURE__ */ __name((database, threadId) => {
30065
30183
  const rows = database.prepare(`SELECT id, subject, coalesce(body_text, '') AS body, coalesce(from_name, from_address) AS sender,
30066
30184
  coalesce(received_at, sent_at) AS at
@@ -30162,7 +30280,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
30162
30280
  return emails3 + threads;
30163
30281
  }, "drainEmailIndex");
30164
30282
 
30165
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
30283
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
30166
30284
  var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
30167
30285
  SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
30168
30286
  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,
@@ -30260,7 +30378,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
30260
30378
  var backfillSentAt = /* @__PURE__ */ __name((database, accountId, limit) => Number(database.prepare(`UPDATE emails SET sent_at = received_at WHERE id IN (
30261
30379
  SELECT id FROM emails WHERE account_id = ? AND sent_at IS NULL AND received_at IS NOT NULL LIMIT ?)`).run(accountId, limit).changes), "backfillSentAt");
30262
30380
 
30263
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
30381
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
30264
30382
  var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
30265
30383
  emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
30266
30384
  last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
@@ -30310,7 +30428,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
30310
30428
  return threads.length;
30311
30429
  }, "markEmailsRestored");
30312
30430
 
30313
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-nearest.js
30431
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-nearest.js
30314
30432
  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
30315
30433
  FROM ${MAIL_PIECES} JOIN embeddings v ON v.model = ? AND v.content_hash = p.content_hash
30316
30434
  WHERE p.account_id = ?
@@ -30346,7 +30464,7 @@ var scannedMailPieces = /* @__PURE__ */ __name((database, model, query, filter)
30346
30464
  var indexedMailPieces = /* @__PURE__ */ __name((database, model, query, filter, depth) => {
30347
30465
  const candidates = database.prepare(`${MAIL_PIECE_ROWS} AND p.id IN (SELECT value FROM json_each(?)) ORDER BY p.id`);
30348
30466
  const merged = /* @__PURE__ */ new Map();
30349
- for (const kind4 of ["email_thread", "attachment"]) {
30467
+ for (const kind4 of ["email_thread", "attachment", "email_enrichment"]) {
30350
30468
  const found2 = searchIndex(database, model, { kind: kind4, account: filter.accountId, ...filter.since === void 0 ? {} : { since: filter.since } }, query, depth, (near2) => {
30351
30469
  const hashes = new Map(near2.map(({ id: id2, hash: hash2 }) => [id2, hash2]));
30352
30470
  const best = /* @__PURE__ */ new Map();
@@ -30370,7 +30488,7 @@ var indexedMailPieces = /* @__PURE__ */ __name((database, model, query, filter,
30370
30488
  }, "indexedMailPieces");
30371
30489
  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");
30372
30490
 
30373
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
30491
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
30374
30492
  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");
30375
30493
  var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
30376
30494
  var ruleOf = /* @__PURE__ */ __name((row2) => ({
@@ -30437,7 +30555,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
30437
30555
  }
30438
30556
  }), "mailRulesOver");
30439
30557
 
30440
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
30558
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
30441
30559
  var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
30442
30560
  database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
30443
30561
  VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
@@ -30445,7 +30563,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
30445
30563
  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);
30446
30564
  }, "reviewLink");
30447
30565
 
30448
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
30566
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
30449
30567
  function checkMeetingCancelled(signal) {
30450
30568
  if (!signal?.aborted)
30451
30569
  return;
@@ -30456,7 +30574,7 @@ function checkMeetingCancelled(signal) {
30456
30574
  }
30457
30575
  __name(checkMeetingCancelled, "checkMeetingCancelled");
30458
30576
 
30459
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
30577
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
30460
30578
  var meetingOf = /* @__PURE__ */ __name((row2) => ({
30461
30579
  id: Number(row2.id),
30462
30580
  accountId: Number(row2.account_id),
@@ -30506,7 +30624,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
30506
30624
  createdAt: Number(row2.created_at)
30507
30625
  }), "transcriptRowOf");
30508
30626
 
30509
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
30627
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
30510
30628
  var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
30511
30629
  var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
30512
30630
  var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
@@ -30673,7 +30791,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
30673
30791
  }
30674
30792
  }), "meetingReadsOver");
30675
30793
 
30676
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
30794
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
30677
30795
  var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
30678
30796
  const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
30679
30797
  const params = [input.accountId];
@@ -30716,7 +30834,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
30716
30834
  return { clauses, params };
30717
30835
  }, "meetingSelectionSql");
30718
30836
 
30719
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
30837
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
30720
30838
  var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
30721
30839
  async meetingChatLines(input) {
30722
30840
  checkMeetingCancelled(input.signal);
@@ -30744,7 +30862,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
30744
30862
  }
30745
30863
  }), "meetingChatLinesOver");
30746
30864
 
30747
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/person-separation.js
30865
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/person-separation.js
30748
30866
  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");
30749
30867
  var MOVED_AWAY = `moved.identity_id IN (SELECT value FROM json_each(?))
30750
30868
  AND (moved.from_person_id IN (SELECT value FROM json_each(?))
@@ -30759,7 +30877,7 @@ var apart = /* @__PURE__ */ __name(({ database }, one2, other) => {
30759
30877
  var separated = /* @__PURE__ */ __name((context, one2, other) => one2 !== other && apart(context, { identities: identitiesOf(context, one2), person: one2 }, { identities: identitiesOf(context, other), person: other }), "separated");
30760
30878
  var identitySeparated = /* @__PURE__ */ __name((context, identity, person2) => apart(context, { identities: [identity] }, { identities: identitiesOf(context, person2).filter((pk) => pk !== identity), person: person2 }), "identitySeparated");
30761
30879
 
30762
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
30880
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
30763
30881
  var MESSAGE_FIELDS = {
30764
30882
  pk: messages.id,
30765
30883
  nativeId: messages.externalId,
@@ -30930,7 +31048,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
30930
31048
  storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
30931
31049
  }), "chatActivity");
30932
31050
 
30933
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
31051
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
30934
31052
  var HIT_FIELDS = {
30935
31053
  ...MESSAGE_FIELDS,
30936
31054
  chatTitle: sql`${chats.title}`.as("chat_title"),
@@ -31029,7 +31147,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
31029
31147
  };
31030
31148
  }, "directReplies");
31031
31149
 
31032
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
31150
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
31033
31151
  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");
31034
31152
  var required = /* @__PURE__ */ __name((context, ref3) => {
31035
31153
  const found2 = identityRow(context, ref3);
@@ -31163,7 +31281,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
31163
31281
  }, "mentioning");
31164
31282
  var escaped = /* @__PURE__ */ __name((text7) => text7.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
31165
31283
 
31166
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
31284
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
31167
31285
  var missing2 = /* @__PURE__ */ __name(() => {
31168
31286
  throw new CliError("not_found", "Meeting, participant or selected target not found");
31169
31287
  }, "missing");
@@ -31285,7 +31403,7 @@ function meetingContextLinksOver(context) {
31285
31403
  }
31286
31404
  __name(meetingContextLinksOver, "meetingContextLinksOver");
31287
31405
 
31288
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
31406
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
31289
31407
  var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
31290
31408
  var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
31291
31409
  var summaryOf = /* @__PURE__ */ __name((row2) => ({
@@ -31314,7 +31432,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
31314
31432
  return row2 ? summaryText(summaryOf(row2)) : null;
31315
31433
  }, "indexedText");
31316
31434
 
31317
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
31435
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
31318
31436
  var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
31319
31437
  var meetingCurrentIndexRows = `
31320
31438
  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
@@ -31345,7 +31463,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
31345
31463
  }, "invalidateMeetingStems");
31346
31464
  var meetingStemmableText = /* @__PURE__ */ __name((text7) => text7.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
31347
31465
 
31348
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
31466
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
31349
31467
  function meetingHitIndexOver({ database, now: now2 }) {
31350
31468
  return {
31351
31469
  async indexSearch(original) {
@@ -31413,10 +31531,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
31413
31531
  }
31414
31532
  __name(meetingHitIndexOver, "meetingHitIndexOver");
31415
31533
 
31416
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
31534
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
31417
31535
  import { createHash as createHash5 } from "node:crypto";
31418
31536
 
31419
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/lucene/plain.js
31537
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/search/lucene/plain.js
31420
31538
  var REPAIRED = /* @__PURE__ */ new Set([
31421
31539
  "query.invalid-syntax",
31422
31540
  "query.unclosed-literal",
@@ -31485,6 +31603,8 @@ var read2 = /* @__PURE__ */ __name((text7, fields4) => {
31485
31603
  }, "read");
31486
31604
  var without = /* @__PURE__ */ __name((text7, leaves) => [...leaves].sort((a, b) => b.span.start - a.span.start).reduce((left, { span }) => left.slice(0, span.start) + left.slice(span.end), text7).trim(), "without");
31487
31605
  var plainQuery = /* @__PURE__ */ __name((text7, fields4 = SEARCH_FIELDS) => {
31606
+ if (text7.trim() && !/[\p{L}\p{N}*]/u.test(text7))
31607
+ throw new CliError("validation_error", `search needs a letter or a digit to look for; ${JSON.stringify(text7)} has none`);
31488
31608
  let current = text7;
31489
31609
  let whole = false;
31490
31610
  for (let tries = 0; tries <= 64; tries++) {
@@ -31521,7 +31641,7 @@ var plainQuery = /* @__PURE__ */ __name((text7, fields4 = SEARCH_FIELDS) => {
31521
31641
  return text7;
31522
31642
  }, "plainQuery");
31523
31643
 
31524
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/trigrams.js
31644
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/search/trigrams.js
31525
31645
  var trigrams = /* @__PURE__ */ __name((term) => {
31526
31646
  const padded = ` ${term} `;
31527
31647
  const pieces = /* @__PURE__ */ new Set();
@@ -31530,7 +31650,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
31530
31650
  return [...pieces];
31531
31651
  }, "trigrams");
31532
31652
 
31533
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/correct.js
31653
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/search/correct.js
31534
31654
  var SHORTEST_CORRECTION = 3;
31535
31655
  var maxEdits = /* @__PURE__ */ __name((word2) => word2.length <= 4 ? 1 : 2, "maxEdits");
31536
31656
  var editDistance = /* @__PURE__ */ __name((a, b, max) => {
@@ -31577,7 +31697,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
31577
31697
  return corrections;
31578
31698
  }, "correctWords");
31579
31699
 
31580
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/garbled.js
31700
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/search/garbled.js
31581
31701
  var SHORTEST_GARBLED = 4;
31582
31702
  var MOST_WIDENED = 64;
31583
31703
  var plain = /* @__PURE__ */ __name((word2) => word2.replaceAll("\u044D", "\u0435"), "plain");
@@ -31669,7 +31789,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
31669
31789
  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));
31670
31790
  }, "widenWords");
31671
31791
 
31672
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
31792
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
31673
31793
  import { readFileSync } from "node:fs";
31674
31794
  var loaded;
31675
31795
  var dictionary = /* @__PURE__ */ __name(() => {
@@ -31728,7 +31848,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word2) => {
31728
31848
  return false;
31729
31849
  }, "knownRussianWord");
31730
31850
 
31731
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
31851
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
31732
31852
  var WORD3 = /[\p{L}\p{N}\p{M}]+/gu;
31733
31853
  var MOST_WORDS = 128;
31734
31854
  var quote = /* @__PURE__ */ __name((word2) => `"${word2.replaceAll('"', '""')}"`, "quote");
@@ -31955,7 +32075,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text7, stemmer) => {
31955
32075
  return check3(tree);
31956
32076
  }, "matchMeetingText");
31957
32077
 
31958
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
32078
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
31959
32079
  var fail3 = /* @__PURE__ */ __name((message3) => {
31960
32080
  throw new CliError("validation_error", message3);
31961
32081
  }, "fail");
@@ -32031,7 +32151,7 @@ function meetingHitSearchOver({ database }) {
32031
32151
  const tree = resolveMeetingQuery(database, input.accountId, ast, state);
32032
32152
  const key2 = fingerprint(JSON.stringify(tree), input, state.identity);
32033
32153
  const after2 = cursorOf(input.after, key2);
32034
- const pending2 = database.prepare(`SELECT 1 FROM meeting_index_pending p
32154
+ const pending = database.prepare(`SELECT 1 FROM meeting_index_pending p
32035
32155
  LEFT JOIN meeting_transcript_rows r ON p.indexable_type='meeting_transcript_row' AND r.id=p.id
32036
32156
  LEFT JOIN meeting_transcripts t ON t.id=r.meeting_transcript_id
32037
32157
  LEFT JOIN meeting_chat_messages c ON p.indexable_type='meeting_chat_message' AND c.id=p.id
@@ -32042,7 +32162,7 @@ function meetingHitSearchOver({ database }) {
32042
32162
  const coverage = {
32043
32163
  archiveCompleteness: "unknown",
32044
32164
  currentRevisions: true,
32045
- indexing: pending2 || !state.stemmer || state.through < state.watermark ? "pending" : "ready",
32165
+ indexing: pending || !state.stemmer || state.through < state.watermark ? "pending" : "ready",
32046
32166
  indexCompleteness: "unknown"
32047
32167
  };
32048
32168
  const { sql: matching2, params: queryParams } = meetingQuerySql(tree, state);
@@ -32137,7 +32257,7 @@ function meetingHitSearchOver({ database }) {
32137
32257
  }
32138
32258
  __name(meetingHitSearchOver, "meetingHitSearchOver");
32139
32259
 
32140
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-languages.js
32260
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-languages.js
32141
32261
  var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
32142
32262
  async fillTranscriptLanguages({ accountId, apply, now: now2 }) {
32143
32263
  positiveReadInteger(accountId, "accountId");
@@ -32169,7 +32289,7 @@ var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
32169
32289
  }
32170
32290
  }), "meetingLanguagesOver");
32171
32291
 
32172
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
32292
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
32173
32293
  import { createHash as createHash6 } from "node:crypto";
32174
32294
  var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
32175
32295
  if (value === void 0)
@@ -32259,7 +32379,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
32259
32379
  }
32260
32380
  }), "meetingParticipantSearchOver");
32261
32381
 
32262
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
32382
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
32263
32383
  var preparationQueries = {
32264
32384
  participants: {
32265
32385
  fields: "p.id, p.identity_id, p.display_name, l.person_id",
@@ -32309,7 +32429,7 @@ var preparationQueries = {
32309
32429
  }
32310
32430
  };
32311
32431
 
32312
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
32432
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
32313
32433
  var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
32314
32434
  async preparationContext(original) {
32315
32435
  const input = validateMeetingPreparationContext(original);
@@ -32350,7 +32470,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
32350
32470
  }
32351
32471
  }), "meetingPreparationContextOver");
32352
32472
 
32353
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
32473
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
32354
32474
  var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
32355
32475
  SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
32356
32476
  WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
@@ -32364,7 +32484,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
32364
32484
  JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
32365
32485
  )`, "preparationSubjects");
32366
32486
 
32367
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
32487
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
32368
32488
  var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
32369
32489
  async preparationKnowledge(original) {
32370
32490
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -32409,7 +32529,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
32409
32529
  }
32410
32530
  }), "meetingPreparationKnowledgeOver");
32411
32531
 
32412
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
32532
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
32413
32533
  var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
32414
32534
  async preparationNotes(original) {
32415
32535
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -32462,7 +32582,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
32462
32582
  }
32463
32583
  }), "meetingPreparationNotesOver");
32464
32584
 
32465
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
32585
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
32466
32586
  var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
32467
32587
  async relatedHistory(original) {
32468
32588
  const input = validateMeetingRelatedHistory(original);
@@ -32533,7 +32653,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
32533
32653
  }
32534
32654
  }), "meetingRelatedHistoryOver");
32535
32655
 
32536
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
32656
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
32537
32657
  var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
32538
32658
  var text3 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
32539
32659
  var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
@@ -32614,7 +32734,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
32614
32734
  }
32615
32735
  }), "meetingReviewOver");
32616
32736
 
32617
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
32737
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
32618
32738
  var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
32619
32739
  var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
32620
32740
  if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
@@ -32668,7 +32788,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
32668
32788
  }
32669
32789
  }), "meetingSeriesHistoryOver");
32670
32790
 
32671
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
32791
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
32672
32792
  var MOST_ROWS = 5e5;
32673
32793
  var meetingCountsSql = /* @__PURE__ */ __name((where) => `SELECT m.started_at, coalesce(m.duration_ms, m.ended_at - m.started_at) AS duration_ms,
32674
32794
  EXISTS (SELECT 1 FROM meeting_transcripts t WHERE t.meeting_id = m.id AND t.deleted_at IS NULL
@@ -32737,7 +32857,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
32737
32857
  }
32738
32858
  }), "meetingStatsOver");
32739
32859
 
32740
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
32860
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
32741
32861
  var CURSOR_KEY = "meetings";
32742
32862
  var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
32743
32863
  id: Number(row2.id),
@@ -33306,7 +33426,7 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
33306
33426
  };
33307
33427
  }, "meetingStoreOver");
33308
33428
 
33309
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
33429
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
33310
33430
  var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
33311
33431
  const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
33312
33432
  return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
@@ -33332,7 +33452,7 @@ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
33332
33452
  orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
33333
33453
  }, "release");
33334
33454
 
33335
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
33455
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
33336
33456
  var THREAD_COLUMNS = {
33337
33457
  subject: {
33338
33458
  where: /* @__PURE__ */ __name(({ value }) => ({
@@ -33349,7 +33469,7 @@ var threadRows = /* @__PURE__ */ __name((database, filter) => {
33349
33469
  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);
33350
33470
  }, "threadRows");
33351
33471
 
33352
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
33472
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
33353
33473
  var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
33354
33474
  id: `email:${place.emailId}`,
33355
33475
  chatId: place.threadExternalId,
@@ -33831,6 +33951,10 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
33831
33951
  const piece = threads.get(owner)?.[Number(row2.position)];
33832
33952
  return piece && piece.hash === row2.hash ? [{ hash: piece.hash, text: piece.text }] : [];
33833
33953
  }
33954
+ if (type === EMAIL_ENRICHMENT) {
33955
+ const text8 = enrichmentText(database, type, owner);
33956
+ return text8 === void 0 ? [] : [{ hash: String(row2.hash), text: text8 }];
33957
+ }
33834
33958
  const text7 = str(file.get(owner)?.text);
33835
33959
  return text7 == null ? [] : [{ hash: String(row2.hash), text: text7.slice(Number(row2.start), Number(row2.end)) }];
33836
33960
  });
@@ -33887,7 +34011,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
33887
34011
  }
33888
34012
  }), "mailStoreOver");
33889
34013
 
33890
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/dictionary.js
34014
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/search/dictionary.js
33891
34015
  import { readFileSync as readFileSync2 } from "node:fs";
33892
34016
  var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
33893
34017
  var folded5 = /* @__PURE__ */ __name((word2) => /^[а-яё'-]*$/.test(word2) ? word2.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word2), "folded");
@@ -33977,7 +34101,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
33977
34101
  }, "knownWord");
33978
34102
  var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
33979
34103
 
33980
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
34104
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
33981
34105
  var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
33982
34106
  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");
33983
34107
  var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
@@ -34063,7 +34187,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
34063
34187
  return found2;
34064
34188
  }, "spokenTranscripts");
34065
34189
 
34066
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
34190
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
34067
34191
  var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
34068
34192
  const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
34069
34193
  if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
@@ -34110,7 +34234,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
34110
34234
  });
34111
34235
  }, "placeHits");
34112
34236
 
34113
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-groups.js
34237
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-groups.js
34114
34238
  var GROUPS = {
34115
34239
  chat: {
34116
34240
  key: "m.chat_id",
@@ -34132,7 +34256,7 @@ var GROUPS = {
34132
34256
  }
34133
34257
  };
34134
34258
 
34135
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
34259
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
34136
34260
  var MESSAGES2 = {
34137
34261
  rows: "messages",
34138
34262
  threads: "chats",
@@ -34615,7 +34739,7 @@ var runCompiled = /* @__PURE__ */ __name(async (context, execution, by) => {
34615
34739
  };
34616
34740
  }, "runCompiled");
34617
34741
 
34618
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
34742
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
34619
34743
  function invalidMetadata() {
34620
34744
  throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
34621
34745
  }
@@ -34717,7 +34841,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
34717
34841
  };
34718
34842
  }), "counterTargets");
34719
34843
 
34720
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
34844
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
34721
34845
  var NOT_FILE_LIST = [...NOT_FILES].map((kind4) => `'${kind4}'`).join(",");
34722
34846
  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,
34723
34847
  att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
@@ -34836,7 +34960,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
34836
34960
  }));
34837
34961
  }, "attachmentViews");
34838
34962
 
34839
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
34963
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
34840
34964
  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");
34841
34965
  var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text7, source2) => {
34842
34966
  const { orm, database, now: now2 } = context;
@@ -34874,7 +34998,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
34874
34998
  keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
34875
34999
  }, "intoVoiceAttachment");
34876
35000
 
34877
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
35001
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
34878
35002
  var FIELDS = [
34879
35003
  "threadExternalId",
34880
35004
  "senderIdentityId",
@@ -35192,7 +35316,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
35192
35316
  reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
35193
35317
  }, "writeDerivedReactions");
35194
35318
 
35195
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/keys.js
35319
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/keys.js
35196
35320
  var keysOver = /* @__PURE__ */ __name((context) => {
35197
35321
  const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
35198
35322
  const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
@@ -35213,7 +35337,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
35213
35337
  };
35214
35338
  }, "keysOver");
35215
35339
 
35216
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
35340
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
35217
35341
  var accountGroupsOf = /* @__PURE__ */ __name((database) => {
35218
35342
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
35219
35343
  if (!row2)
@@ -35247,8 +35371,20 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
35247
35371
  profiles[app] = { ...profiles[app], [profile]: { provider: key2.provider, account: key2.account } };
35248
35372
  database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
35249
35373
  }, "saveProfile");
35374
+ var forgetProfile = /* @__PURE__ */ __name((database, app, profile, now2) => {
35375
+ const profiles = profilesOf2(database);
35376
+ const own = profiles[app];
35377
+ if (own?.[profile] === void 0)
35378
+ return;
35379
+ const { [profile]: _, ...rest } = own;
35380
+ if (Object.keys(rest).length === 0)
35381
+ delete profiles[app];
35382
+ else
35383
+ profiles[app] = rest;
35384
+ database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
35385
+ }, "forgetProfile");
35250
35386
 
35251
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
35387
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
35252
35388
  var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
35253
35389
  const owner = ownerPerson(context.database).id;
35254
35390
  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);
@@ -35270,7 +35406,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
35270
35406
  return personOf(context, ref3);
35271
35407
  }, "linkToOwner");
35272
35408
 
35273
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
35409
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
35274
35410
  var PROVIDERS_SETTING = "providers";
35275
35411
  var storedProvidersOf = /* @__PURE__ */ __name((database) => {
35276
35412
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
@@ -35318,7 +35454,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
35318
35454
  });
35319
35455
  }, "registerProvider");
35320
35456
 
35321
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
35457
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
35322
35458
  var DAY4 = 864e5;
35323
35459
  var RECENTLY_CLOSED_MS = 14 * DAY4;
35324
35460
  var TEXT_LIMIT = 20;
@@ -35517,7 +35653,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
35517
35653
  };
35518
35654
  }, "taskSimilarityOver");
35519
35655
 
35520
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
35656
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
35521
35657
  var SETTING3 = "taskCategories";
35522
35658
  var savedTaskCategories = /* @__PURE__ */ __name((database) => {
35523
35659
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
@@ -35536,7 +35672,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
35536
35672
  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);
35537
35673
  }, "saveTaskCategories");
35538
35674
 
35539
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
35675
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
35540
35676
  var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
35541
35677
  var ALLOWED = "taskAgentClose";
35542
35678
  var MIN = "taskAgentCloseMin";
@@ -35592,10 +35728,10 @@ var SUGGESTION_COLUMNS = [
35592
35728
  ];
35593
35729
  var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
35594
35730
 
35595
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/mail-findings.js
35731
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/mail-findings.js
35596
35732
  var MAIL_FINDINGS_KIND = "mail_findings";
35597
35733
 
35598
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/decisions.js
35734
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/decisions.js
35599
35735
  var TASK_CLOSE_KIND = "task_close";
35600
35736
  var DEFAULT_DECISION_POLICY = { agentDecisions: false, ruleProposalsOwnerOnly: true };
35601
35737
  var isOwnerOnlyKind = /* @__PURE__ */ __name((kind4) => kind4 === MAIL_FINDINGS_KIND || kind4 === MEETING_FINDINGS_KIND || kind4 === TASK_CLOSE_KIND || kind4 === SOURCE_REVIEW_KIND, "isOwnerOnlyKind");
@@ -35643,10 +35779,10 @@ var assertMayDecide = /* @__PURE__ */ __name((row2, by, policy = DEFAULT_DECISIO
35643
35779
  }, "assertMayDecide");
35644
35780
  var deciderAuthor = /* @__PURE__ */ __name((by) => by === "owner" ? "owner" : { bot: by.bot, ...by.model === void 0 ? {} : { model: by.model } }, "deciderAuthor");
35645
35781
 
35646
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/ref-summaries.js
35782
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/ref-summaries.js
35647
35783
  var oneLine = /* @__PURE__ */ __name((text7) => singleLine(text7.replace(/\s+/g, " ").trim()), "oneLine");
35648
35784
 
35649
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/ref-summaries.js
35785
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/ref-summaries.js
35650
35786
  var EXCERPT_CHARS = 280;
35651
35787
  var TITLE_CHARS = 120;
35652
35788
  var MEMORY_TITLE_CHARS = 80;
@@ -36044,9 +36180,9 @@ var refReadsOf = /* @__PURE__ */ __name((database, texts2, { excerpt = false, no
36044
36180
  group.push({ text: text7, reference: reference2, keys: routed.keys });
36045
36181
  groups.set(routed.reader, group);
36046
36182
  }
36047
- const pending2 = [...groups.entries()];
36048
- while (pending2.length > 0) {
36049
- const [name, wanted] = pending2.shift();
36183
+ const pending = [...groups.entries()];
36184
+ while (pending.length > 0) {
36185
+ const [name, wanted] = pending.shift();
36050
36186
  const reader = READERS[name];
36051
36187
  const found2 = runReader(database, reader, wanted, excerpt, today);
36052
36188
  const fallback = FALLBACK[name];
@@ -36058,14 +36194,17 @@ var refReadsOf = /* @__PURE__ */ __name((database, texts2, { excerpt = false, no
36058
36194
  reads.set(one2.text, readOf(one2, row2, reader, excerpt));
36059
36195
  }
36060
36196
  if (fallback !== void 0 && missed.length > 0)
36061
- pending2.push([fallback, missed.map((one2) => ({ ...one2, keys: keysOf(fallback, one2.reference) }))]);
36197
+ pending.push([fallback, missed.map((one2) => ({ ...one2, keys: keysOf(fallback, one2.reference) }))]);
36062
36198
  }
36063
36199
  return reads;
36064
36200
  }, "refReadsOf");
36065
36201
  var summaryOf2 = /* @__PURE__ */ __name(({ sender, excerpt, ...summary }, withExcerpt) => withExcerpt ? { ...summary, excerpt } : summary, "summaryOf");
36066
36202
  var refSummariesOf = /* @__PURE__ */ __name((database, texts2, options = {}) => new Map([...refReadsOf(database, texts2, options)].map(([text7, read3]) => [text7, summaryOf2(read3, options.excerpt === true)])), "refSummariesOf");
36203
+ var refsStoreOver = /* @__PURE__ */ __name((context) => ({
36204
+ summaries: /* @__PURE__ */ __name(async (texts2, options) => refSummariesOf(context.database, texts2, { ...options, now: context.now() }), "summaries")
36205
+ }), "refsStoreOver");
36067
36206
 
36068
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
36207
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
36069
36208
  var sourceOf3 = /* @__PURE__ */ __name((read3, ref3) => ({
36070
36209
  ref: ref3,
36071
36210
  kind: read3.kind,
@@ -36103,7 +36242,7 @@ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => {
36103
36242
  });
36104
36243
  }, "evidenceSourcesOf");
36105
36244
 
36106
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/ulid.js
36245
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/ulid.js
36107
36246
  import { randomBytes } from "node:crypto";
36108
36247
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
36109
36248
  var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
@@ -36116,7 +36255,7 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
36116
36255
  return time3 + random;
36117
36256
  }, "ulid");
36118
36257
 
36119
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
36258
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
36120
36259
  var FOLDED_FIELDS = ["title", "site", "language", "author"];
36121
36260
  var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
36122
36261
  if (!meta && !sections?.length)
@@ -36137,7 +36276,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
36137
36276
  return typeof language === "string" && language !== "" ? language : null;
36138
36277
  }, "languageOf");
36139
36278
 
36140
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
36279
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
36141
36280
  var isObject2 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
36142
36281
  var objectOf3 = /* @__PURE__ */ __name((value) => {
36143
36282
  if (isObject2(value))
@@ -36380,7 +36519,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
36380
36519
  };
36381
36520
  }, "filesStoreOver");
36382
36521
 
36383
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
36522
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
36384
36523
  var IMPORTED_DOCUMENT_QUERY = defineQuery({
36385
36524
  entity: "document",
36386
36525
  backend: "sql",
@@ -36426,7 +36565,7 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
36426
36565
  return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
36427
36566
  }, "importedDocumentWhere");
36428
36567
 
36429
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/note-dates.js
36568
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/note-dates.js
36430
36569
  var dateFileNotes = /* @__PURE__ */ __name((database, folder, dates) => {
36431
36570
  const fileAt = database.prepare("SELECT id, document_id FROM files WHERE account_id = ? AND external_id = ? AND kind <> 'folder' AND deleted_at IS NULL");
36432
36571
  const legacy = database.prepare("SELECT id FROM documents WHERE account_id = ? AND external_id = ? AND deleted_at IS NULL");
@@ -36447,7 +36586,7 @@ var dateFileNotes = /* @__PURE__ */ __name((database, folder, dates) => {
36447
36586
  return changed;
36448
36587
  }, "dateFileNotes");
36449
36588
 
36450
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/text-input.js
36589
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/text-input.js
36451
36590
  var textOf2 = /* @__PURE__ */ __name((text7, what, max = 1e5, allowEmpty = false) => {
36452
36591
  const value = text7.trim();
36453
36592
  if (!value && !allowEmpty || value.length > max)
@@ -36460,7 +36599,7 @@ var oneOf = /* @__PURE__ */ __name((value, allowed, what) => {
36460
36599
  return value;
36461
36600
  }, "oneOf");
36462
36601
 
36463
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
36602
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
36464
36603
  var NOTE_FORMATS = ["obsidian", "markdown"];
36465
36604
  var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
36466
36605
  var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso3(value), "optionalIso");
@@ -36993,7 +37132,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
36993
37132
  };
36994
37133
  }, "notesStoreOver");
36995
37134
 
36996
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
37135
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
36997
37136
  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";
36998
37137
  var iso4 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
36999
37138
  var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -37252,7 +37391,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
37252
37391
  };
37253
37392
  }, "memoriesStoreOver");
37254
37393
 
37255
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
37394
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
37256
37395
  var DEFAULT_FIRST_PASS_PER_CHAT = 0;
37257
37396
  var KEY = "taskFirstPassPerChat";
37258
37397
  var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
@@ -37272,7 +37411,7 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
37272
37411
  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);
37273
37412
  }, "saveFirstPassPerChat");
37274
37413
 
37275
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/external-links.js
37414
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/external-links.js
37276
37415
  var EXTERNAL_SERVICE = /^[a-z][a-z0-9-]{0,31}$/;
37277
37416
  var EXTERNAL_ID_CHARS = 200;
37278
37417
  var SOURCE_URL_CHARS = 2e3;
@@ -37299,7 +37438,7 @@ var sourceUrlOf = /* @__PURE__ */ __name((value, reason = "task.source-url") =>
37299
37438
  return text7;
37300
37439
  }, "sourceUrlOf");
37301
37440
 
37302
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
37441
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
37303
37442
  var TASK_SORTS = ["priority", "due", "created", "updated", "key", "state"];
37304
37443
  var field = /* @__PURE__ */ __name((name, type, example, more = {}) => ({
37305
37444
  name,
@@ -37522,7 +37661,7 @@ var withoutField = /* @__PURE__ */ __name((query, name) => {
37522
37661
  return root === void 0 ? void 0 : { ...query, root };
37523
37662
  }, "withoutField");
37524
37663
 
37525
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
37664
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
37526
37665
  var authorNamed = /* @__PURE__ */ __name((database, row2) => {
37527
37666
  if (row2.author_type == null)
37528
37667
  return null;
@@ -37550,7 +37689,7 @@ var addComment = /* @__PURE__ */ __name((context, task, body2, by) => {
37550
37689
  return commentsOf(database, task).find((one2) => one2.ref === `note:${made}`);
37551
37690
  }, "addComment");
37552
37691
 
37553
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
37692
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
37554
37693
  var TASK_RELATION_KINDS = [
37555
37694
  "blocked-by",
37556
37695
  "follow-up-of",
@@ -37680,7 +37819,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
37680
37819
  };
37681
37820
  }, "taskRelationsStoreOver");
37682
37821
 
37683
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
37822
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
37684
37823
  var TASK_ROLES = ["assignee", "reviewer", "watcher"];
37685
37824
  var TASK_EVENT_KINDS = [
37686
37825
  "created",
@@ -38234,7 +38373,7 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
38234
38373
  };
38235
38374
  }, "workTasksOver");
38236
38375
 
38237
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
38376
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
38238
38377
  var taskCloseOver = /* @__PURE__ */ __name((context) => {
38239
38378
  const { database, now: now2 } = context;
38240
38379
  const liveRow = /* @__PURE__ */ __name((id2) => {
@@ -38283,7 +38422,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
38283
38422
  };
38284
38423
  }, "taskCloseOver");
38285
38424
 
38286
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
38425
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
38287
38426
  var TASK_PAIR_DECISIONS = ["review", "unsure", "merged", "rejected", "unmerged", "attached", "new"];
38288
38427
  var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
38289
38428
  const { database, now: now2 } = context;
@@ -38502,7 +38641,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
38502
38641
  };
38503
38642
  }, "taskPairsOver");
38504
38643
 
38505
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-stats.js
38644
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-stats.js
38506
38645
  var ACCOUNT_SCOPE = "t.package_id IS NOT NULL AND t.deleted_at IS NULL AND t.project_id = ?";
38507
38646
  var TASK_STATS_SQL = {
38508
38647
  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"),
@@ -38541,7 +38680,7 @@ var taskStatsOver = /* @__PURE__ */ __name(({ database }, inbox) => ({
38541
38680
  }, "statNames")
38542
38681
  }), "taskStatsOver");
38543
38682
 
38544
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
38683
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
38545
38684
  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";
38546
38685
  var inboxProject = /* @__PURE__ */ __name(({ database, now: now2 }, account, create) => {
38547
38686
  const key2 = inboxKey(account);
@@ -38748,7 +38887,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
38748
38887
  throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
38749
38888
  }, "oneOf");
38750
38889
 
38751
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/accounts.js
38890
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/accounts.js
38752
38891
  var accountAccountsOver = /* @__PURE__ */ __name((context) => {
38753
38892
  const { database } = context;
38754
38893
  const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
@@ -38781,6 +38920,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
38781
38920
  accountGroups: /* @__PURE__ */ __name(async () => accountGroupsOf(database), "accountGroups"),
38782
38921
  profiles: /* @__PURE__ */ __name(async () => profilesOf2(database), "profiles"),
38783
38922
  saveProfile: /* @__PURE__ */ __name(async (app, profile, key2) => write(database, () => saveProfile(database, app, profile, key2, context.now())), "saveProfile"),
38923
+ forgetProfile: /* @__PURE__ */ __name(async (app, profile) => write(database, () => forgetProfile(database, app, profile, context.now())), "forgetProfile"),
38784
38924
  registerProvider: /* @__PURE__ */ __name(async (entry2) => registerProvider(database, entry2, context.now()), "registerProvider"),
38785
38925
  saveAccountGroup: /* @__PURE__ */ __name(async (name, members2) => write(database, () => {
38786
38926
  const groups = accountGroupsOf(database);
@@ -38793,7 +38933,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
38793
38933
  };
38794
38934
  }, "accountsStoreOver");
38795
38935
 
38796
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
38936
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
38797
38937
  var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
38798
38938
  var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
38799
38939
  const message3 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
@@ -38817,7 +38957,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
38817
38957
  })), "keepDownloads");
38818
38958
  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");
38819
38959
 
38820
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/attachments.js
38960
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/attachments.js
38821
38961
  var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
38822
38962
  const { database } = context;
38823
38963
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -38874,7 +39014,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
38874
39014
  }, "keepAttachmentText")
38875
39015
  }), "attachmentsStoreOver");
38876
39016
 
38877
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
39017
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
38878
39018
  var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
38879
39019
  var pointerMover = /* @__PURE__ */ __name((context, type) => {
38880
39020
  const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
@@ -39059,7 +39199,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
39059
39199
  return done;
39060
39200
  }, "rekeyChats");
39061
39201
 
39062
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
39202
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
39063
39203
  var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
39064
39204
  var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
39065
39205
  var CHAT_LIST_KEY = "chat_list_complete";
@@ -39117,7 +39257,7 @@ var chatCoverage = /* @__PURE__ */ __name(({ database }, accountKey) => {
39117
39257
  return { ...coverage, oldestMessageAt: toIso(oldest) };
39118
39258
  }, "chatCoverage");
39119
39259
 
39120
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/chats.js
39260
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/chats.js
39121
39261
  var chatsStoreOver = /* @__PURE__ */ __name((context) => {
39122
39262
  const { database } = context;
39123
39263
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
@@ -39252,7 +39392,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
39252
39392
  };
39253
39393
  }, "chatsStoreOver");
39254
39394
 
39255
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
39395
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
39256
39396
  import { createHash as createHash7 } from "node:crypto";
39257
39397
  var BATCH_CONTEXT = 50;
39258
39398
  var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
@@ -39390,7 +39530,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
39390
39530
  var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
39391
39531
  ${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
39392
39532
 
39393
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
39533
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
39394
39534
  import { setTimeout } from "node:timers/promises";
39395
39535
  var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
39396
39536
  var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
@@ -39702,7 +39842,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
39702
39842
  AND NOT EXISTS (SELECT 1 FROM messages d
39703
39843
  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");
39704
39844
 
39705
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/conversations.js
39845
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/conversations.js
39706
39846
  var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
39707
39847
  const { database } = context;
39708
39848
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -39809,7 +39949,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
39809
39949
  };
39810
39950
  }, "conversationsStoreOver");
39811
39951
 
39812
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/counters.js
39952
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/counters.js
39813
39953
  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";
39814
39954
  var accountCountersOver = /* @__PURE__ */ __name((context) => {
39815
39955
  const { database } = context;
@@ -39834,7 +39974,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
39834
39974
  counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
39835
39975
  }), "countersStoreOver");
39836
39976
 
39837
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
39977
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
39838
39978
  var MENTION_STATUSES = ["found", "linked", "dismissed"];
39839
39979
  var MENTION_QUERY = defineQuery({
39840
39980
  entity: "mention",
@@ -39904,9 +40044,9 @@ var rebuildMentions = /* @__PURE__ */ __name((database, { now: now2, kinds: kind
39904
40044
  };
39905
40045
  }, "rebuildMentions");
39906
40046
  var mentionsState = /* @__PURE__ */ __name((database) => {
39907
- const pending2 = Number(database.prepare("SELECT count(*) AS n FROM mention_pending").get()?.n);
40047
+ const pending = Number(database.prepare("SELECT count(*) AS n FROM mention_pending").get()?.n);
39908
40048
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(REBUILT_AT);
39909
- return { pending: pending2, rebuiltAt: row2 ? JSON.parse(String(row2.value)) : null };
40049
+ return { pending, rebuiltAt: row2 ? JSON.parse(String(row2.value)) : null };
39910
40050
  }, "mentionsState");
39911
40051
  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 ";
39912
40052
  var stored = /* @__PURE__ */ __name((row2) => ({
@@ -40050,7 +40190,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
40050
40190
  return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
40051
40191
  }, "listPlaces");
40052
40192
 
40053
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/mentions.js
40193
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/mentions.js
40054
40194
  var accountMentionsOver = /* @__PURE__ */ __name((context) => {
40055
40195
  const { database } = context;
40056
40196
  const { findAccountPk: findAccountPk2 } = keysOver(context);
@@ -40085,7 +40225,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
40085
40225
  places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
40086
40226
  }), "mentionsStoreOver");
40087
40227
 
40088
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
40228
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
40089
40229
  var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
40090
40230
  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");
40091
40231
  const rows = messageId === void 0 ? read3.all(chatKey) : read3.all(chatKey, messageId);
@@ -40100,7 +40240,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
40100
40240
  }));
40101
40241
  }, "documentLinkMessages");
40102
40242
 
40103
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
40243
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
40104
40244
  var stemmerFor = stemmerCache();
40105
40245
  var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
40106
40246
  if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
@@ -40144,7 +40284,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
40144
40284
  });
40145
40285
  }, "laterSharingRare");
40146
40286
 
40147
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/messages.js
40287
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/messages.js
40148
40288
  var accountMessagesOver = /* @__PURE__ */ __name((context) => {
40149
40289
  const { database } = context;
40150
40290
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
@@ -40279,7 +40419,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
40279
40419
  laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
40280
40420
  }), "messagesStoreOver");
40281
40421
 
40282
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
40422
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
40283
40423
  var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
40284
40424
  var iso6 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
40285
40425
  var personPreparation = /* @__PURE__ */ __name(({ database, now: now2 }, uid, { accounts: accounts2, limit }) => {
@@ -40304,7 +40444,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database, now: now2 }, uid, {
40304
40444
  project: row2.project_id == null ? null : `project:${row2.project_id}`,
40305
40445
  updatedAt: iso6(row2.updated_at)
40306
40446
  }));
40307
- const notes3 = database.prepare(`SELECT n.id,n.title,n.body,n.revision,n.updated_at FROM notes n
40447
+ const notes2 = database.prepare(`SELECT n.id,n.title,n.body,n.revision,n.updated_at FROM notes n
40308
40448
  JOIN persons owner ON n.author_type='person' AND n.author_id=owner.id AND owner.owner=1
40309
40449
  WHERE n.deleted_at IS NULL
40310
40450
  AND ((n.notable_type='person' AND n.notable_id=?) OR EXISTS(SELECT 1 FROM links l WHERE l.from_type='note'
@@ -40332,11 +40472,11 @@ var personPreparation = /* @__PURE__ */ __name(({ database, now: now2 }, uid, {
40332
40472
  source: row2.source_locator == null ? null : String(row2.source_locator),
40333
40473
  createdAt: iso6(row2.created_at)
40334
40474
  }));
40335
- return { facts: page3(facts2), notes: page3(notes3), tasks: page3(tasks2) };
40475
+ return { facts: page3(facts2), notes: page3(notes2), tasks: page3(tasks2) };
40336
40476
  });
40337
40477
  }, "personPreparation");
40338
40478
 
40339
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
40479
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
40340
40480
  var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
40341
40481
  const id2 = Number(uid);
40342
40482
  if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
@@ -40344,7 +40484,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
40344
40484
  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)));
40345
40485
  }, "personSeenInAccounts");
40346
40486
 
40347
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
40487
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
40348
40488
  var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
40349
40489
  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);
40350
40490
  if (!row2)
@@ -40363,8 +40503,8 @@ var NOTES_ABOUT = "SELECT n.* FROM notes n WHERE notable_type='identity' AND not
40363
40503
  var privateContact = /* @__PURE__ */ __name((context, key2, personId) => {
40364
40504
  const { account, identity } = required2(context, key2, personId);
40365
40505
  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;
40366
- const notes3 = context.database.prepare(`${NOTES_ABOUT} ORDER BY n.created_at, n.id`).all(identity).map((row2) => noteOf2(row2, personId));
40367
- return { personId, alias: alias2 == null ? null : String(alias2), notes: notes3 };
40506
+ const notes2 = context.database.prepare(`${NOTES_ABOUT} ORDER BY n.created_at, n.id`).all(identity).map((row2) => noteOf2(row2, personId));
40507
+ return { personId, alias: alias2 == null ? null : String(alias2), notes: notes2 };
40368
40508
  }, "privateContact");
40369
40509
  var setAlias = /* @__PURE__ */ __name((context, key2, personId, alias2) => {
40370
40510
  const { account, identity } = required2(context, key2, personId);
@@ -40411,7 +40551,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
40411
40551
  return { id: id2, personId, removed: true };
40412
40552
  }, "removeNote");
40413
40553
 
40414
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/people.js
40554
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/people.js
40415
40555
  var accountPeopleOver = /* @__PURE__ */ __name((context) => {
40416
40556
  const { database } = context;
40417
40557
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
@@ -40496,13 +40636,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
40496
40636
  };
40497
40637
  }, "peopleStoreOver");
40498
40638
 
40499
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
40639
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
40500
40640
  import { createHash as createHash9 } from "node:crypto";
40501
40641
 
40502
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
40642
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
40503
40643
  import { createHash as createHash8 } from "node:crypto";
40504
40644
 
40505
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
40645
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
40506
40646
  var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
40507
40647
  var AUTHOR_MEASURES = [
40508
40648
  "messages",
@@ -40642,7 +40782,7 @@ var withoutUrls = /* @__PURE__ */ __name((text7) => text7.replace(/\S+/gu, (toke
40642
40782
  var rankingWords = /* @__PURE__ */ __name((text7) => withoutUrls(text7).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
40643
40783
  var rankingQuestion = /* @__PURE__ */ __name((text7) => withoutUrls(text7).includes("?"), "rankingQuestion");
40644
40784
 
40645
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
40785
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
40646
40786
  var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
40647
40787
  var exhausted2 = /* @__PURE__ */ __name((budget) => {
40648
40788
  throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
@@ -40864,7 +41004,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
40864
41004
  };
40865
41005
  }, "rankReplyGraph");
40866
41006
 
40867
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
41007
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
40868
41008
  var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
40869
41009
  var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
40870
41010
  var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
@@ -41038,7 +41178,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
41038
41178
  return { items, evidence, summary, graph: graph.quality };
41039
41179
  }, "calculateAdminStatistics");
41040
41180
 
41041
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
41181
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
41042
41182
  var rankingContextRange = /* @__PURE__ */ __name((root) => {
41043
41183
  const dates = [];
41044
41184
  const visit = /* @__PURE__ */ __name((node, required3) => {
@@ -41060,7 +41200,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
41060
41200
  return dates[0].node.resolution.date;
41061
41201
  }, "rankingContextRange");
41062
41202
 
41063
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
41203
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
41064
41204
  var reactionCounts = /* @__PURE__ */ __name((stored4) => {
41065
41205
  let counts;
41066
41206
  try {
@@ -41355,7 +41495,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
41355
41495
  });
41356
41496
  }, "rankQuery");
41357
41497
 
41358
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
41498
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
41359
41499
  function fail4(message3, reason = "query.too-large") {
41360
41500
  throw new CliError("validation_error", message3, { reason, complete: false });
41361
41501
  }
@@ -41532,7 +41672,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
41532
41672
  return result;
41533
41673
  }), "adminStatisticsQuery");
41534
41674
 
41535
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
41675
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
41536
41676
  var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
41537
41677
  if (!execution.accounts.length)
41538
41678
  return { conversations: [], chats: [] };
@@ -41550,7 +41690,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
41550
41690
  return { conversations: conversations2, chats: chats2 };
41551
41691
  }, "conversationEligibility");
41552
41692
 
41553
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
41693
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
41554
41694
  import { createHash as createHash10 } from "node:crypto";
41555
41695
  var EVIDENCE_BYTES = 64 * 1024;
41556
41696
  var FINGERPRINT_BYTES = 8 * 1024 * 1024;
@@ -41700,7 +41840,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
41700
41840
  return result;
41701
41841
  }, "rankingEvidence");
41702
41842
 
41703
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/reply-times.js
41843
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/reply-times.js
41704
41844
  var FAR = Number.MAX_SAFE_INTEGER;
41705
41845
  var chatsIn = /* @__PURE__ */ __name((scope3, kinds2) => {
41706
41846
  const params = [...scope3.accounts.flatMap(({ provider, account }) => [provider, account]), ...kinds2];
@@ -41794,7 +41934,7 @@ var waitingChats = /* @__PURE__ */ __name((context, scope3, waits, cap) => {
41794
41934
  });
41795
41935
  }, "waitingChats");
41796
41936
 
41797
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/queries.js
41937
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/queries.js
41798
41938
  var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
41799
41939
  const mailIndexed = /* @__PURE__ */ __name((execution) => {
41800
41940
  if (execution.corpus === "mail")
@@ -41815,7 +41955,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
41815
41955
  };
41816
41956
  }, "queriesStoreOver");
41817
41957
 
41818
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
41958
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
41819
41959
  var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
41820
41960
  const { database, now: now2 } = context;
41821
41961
  const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
@@ -41854,10 +41994,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
41854
41994
  }));
41855
41995
  }, "chatEventsOf");
41856
41996
 
41857
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
41997
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
41858
41998
  import { createHash as createHash11 } from "node:crypto";
41859
41999
 
41860
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/calendar.js
42000
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/calendar.js
41861
42001
  var calendarKey = /* @__PURE__ */ __name((zone, by) => {
41862
42002
  const format = new Intl.DateTimeFormat("en-CA", {
41863
42003
  timeZone: zone,
@@ -41877,7 +42017,7 @@ var weekKey = /* @__PURE__ */ __name((day3) => {
41877
42017
  return date3.toISOString().slice(0, 10);
41878
42018
  }, "weekKey");
41879
42019
 
41880
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/retention.js
42020
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/retention.js
41881
42021
  var RETENTION_TOLERANCE = 864e5;
41882
42022
  var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
41883
42023
  const { since, until, cutoff, checkpoints, within, limit, by } = options;
@@ -41931,7 +42071,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
41931
42071
  return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
41932
42072
  }, "retentionCohorts");
41933
42073
 
41934
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
42074
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
41935
42075
  var iso7 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
41936
42076
  var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId, options, evidence) => {
41937
42077
  validateRetentionOptions(options);
@@ -42062,7 +42202,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
42062
42202
  };
42063
42203
  }, "retentionQuery");
42064
42204
 
42065
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
42205
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
42066
42206
  var iso8 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
42067
42207
  var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
42068
42208
  ...isBot === void 0 ? {} : { bot: isBot },
@@ -42193,7 +42333,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
42193
42333
  lastCount: memberCountsOf(context, pk).at(-1) ?? null
42194
42334
  })), "trackedChats");
42195
42335
 
42196
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/roster.js
42336
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/roster.js
42197
42337
  var rosterStoreOver = /* @__PURE__ */ __name((context) => {
42198
42338
  const { database } = context;
42199
42339
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
@@ -42249,7 +42389,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
42249
42389
  };
42250
42390
  }, "rosterStoreOver");
42251
42391
 
42252
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
42392
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
42253
42393
  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");
42254
42394
  var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
42255
42395
  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 ?`);
@@ -42273,7 +42413,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
42273
42413
  }
42274
42414
  }, "backfillNormalized");
42275
42415
 
42276
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
42416
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
42277
42417
  var INDEX2 = "message_words";
42278
42418
  var searchIndexState2 = /* @__PURE__ */ __name((database) => {
42279
42419
  const row2 = indexRow(database, INDEX2);
@@ -42281,14 +42421,14 @@ var searchIndexState2 = /* @__PURE__ */ __name((database) => {
42281
42421
  return void 0;
42282
42422
  const watermark = Number(row2.watermark);
42283
42423
  const filledThrough = Number(row2.filled_through);
42284
- const pending2 = pendingNormalization(database);
42424
+ const pending = pendingNormalization(database);
42285
42425
  const termsThrough = Number(row2.terms_through);
42286
42426
  const newest = newestMessage(database);
42287
42427
  return {
42288
42428
  watermark,
42289
42429
  filledThrough,
42290
- pendingNormalization: pending2,
42291
- ready: filledThrough >= watermark && pending2 === 0,
42430
+ pendingNormalization: pending,
42431
+ ready: filledThrough >= watermark && pending === 0,
42292
42432
  termsThrough,
42293
42433
  newest,
42294
42434
  termsReady: termsThrough >= newest,
@@ -42400,7 +42540,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
42400
42540
  });
42401
42541
  }, "resetSearchIndex");
42402
42542
 
42403
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
42543
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
42404
42544
  var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
42405
42545
  const filled2 = { stemmed: 0, drained: 0 };
42406
42546
  const before2 = stemsState(database);
@@ -42495,7 +42635,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
42495
42635
  return resetStems(database, { now: now2 });
42496
42636
  }, "followDefaultStemmers");
42497
42637
 
42498
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
42638
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
42499
42639
  var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
42500
42640
  var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
42501
42641
  const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
@@ -42517,7 +42657,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
42517
42657
  });
42518
42658
  }, "termCandidates");
42519
42659
 
42520
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/search-index.js
42660
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/search-index.js
42521
42661
  var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
42522
42662
  const { database } = context;
42523
42663
  const stemmerFor2 = stemmerCache();
@@ -42541,7 +42681,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
42541
42681
  };
42542
42682
  }, "searchIndexStoreOver");
42543
42683
 
42544
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
42684
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
42545
42685
  var HISTORY_KEPT = 1e3;
42546
42686
  var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
42547
42687
  var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
@@ -42610,7 +42750,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
42610
42750
  return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
42611
42751
  }, "clearHistory");
42612
42752
 
42613
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/searches.js
42753
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/searches.js
42614
42754
  var searchesStoreOver = /* @__PURE__ */ __name((context) => {
42615
42755
  const { database } = context;
42616
42756
  return {
@@ -42634,7 +42774,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
42634
42774
  };
42635
42775
  }, "searchesStoreOver");
42636
42776
 
42637
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/added-sources.js
42777
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/added-sources.js
42638
42778
  import { createHash as createHash12 } from "node:crypto";
42639
42779
  var ADDED_KINDS = ["text", "file", "page"];
42640
42780
  var sha256 = /* @__PURE__ */ __name((value) => createHash12("sha256").update(value).digest("hex"), "sha256");
@@ -42814,7 +42954,7 @@ var addedSourcesOver = /* @__PURE__ */ __name((context) => {
42814
42954
  };
42815
42955
  }, "addedSourcesOver");
42816
42956
 
42817
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
42957
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
42818
42958
  var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
42819
42959
  var ACTION_OUTCOMES = ["ok", "refused", "failed"];
42820
42960
  var CODE = /^[a-z][a-z0-9_]{0,63}$/;
@@ -42857,7 +42997,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
42857
42997
  };
42858
42998
  }, "agentActionsStoreOver");
42859
42999
 
42860
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
43000
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
42861
43001
  var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
42862
43002
  }) => {
42863
43003
  const { database, now: now2 } = context;
@@ -42916,7 +43056,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
42916
43056
  };
42917
43057
  }, "botUpdateStoreOver");
42918
43058
 
42919
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/reviewed.js
43059
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/reviewed.js
42920
43060
  var prefixesText = /* @__PURE__ */ __name((types) => `${article(types[0] ?? "")} ${types.map((type) => `${type}:`).join(" or ")}`, "prefixesText");
42921
43061
  var refuse = /* @__PURE__ */ __name((message3, reason, code = "validation_error") => {
42922
43062
  throw new CliError(code, message3, { reason });
@@ -43064,7 +43204,7 @@ var reviewedRowsOver = /* @__PURE__ */ __name((context) => {
43064
43204
  return { partyOf, partyThing, reviewedOf, written, keepEvidence, ownerOnly, linkedId, ...decisionsOver(context) };
43065
43205
  }, "reviewedRowsOver");
43066
43206
 
43067
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/business-contracts.js
43207
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/business-contracts.js
43068
43208
  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";
43069
43209
  var DAY_MS = 864e5;
43070
43210
  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");
@@ -43213,7 +43353,111 @@ var contractsStoreOver = /* @__PURE__ */ __name((context) => {
43213
43353
  };
43214
43354
  }, "contractsStoreOver");
43215
43355
 
43216
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
43356
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/business-search.js
43357
+ var BUSINESS_FIND_MAX = 2001;
43358
+ 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");
43359
+ var partyName = /* @__PURE__ */ __name((as) => `coalesce(${as}p.name, ${as}o.name, ${as}j.name)`, "partyName");
43360
+ var LIVE3 = "x.deleted_at IS NULL";
43361
+ var DECIDED = `${LIVE3} AND x.review <> 'rejected'`;
43362
+ var SEARCHED = {
43363
+ 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}`,
43364
+ 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}`,
43365
+ 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}`,
43366
+ contract: `SELECT x.id, x.review, x.source, x.updated_at, x.name AS f1, x.number AS f2 FROM contracts x WHERE ${DECIDED}`,
43367
+ subscription: `SELECT x.id, x.review, x.source, x.updated_at, x.name AS f1 FROM subscriptions x WHERE ${DECIDED}`,
43368
+ product: `SELECT x.id, 'confirmed' AS review, x.source, x.updated_at, x.name AS f1, x.sku AS f2 FROM catalog_items x WHERE ${LIVE3}`,
43369
+ wallet: `SELECT x.id, 'confirmed' AS review, x.source, x.updated_at, x.name AS f1, x.institution AS f2 FROM financial_accounts x WHERE ${LIVE3}`
43370
+ };
43371
+ var FIELDS2 = ["f1", "f2", "f3"];
43372
+ var TEXT_CHARS = 240;
43373
+ var KINDS_SQL = BUSINESS_KINDS.map((kind4) => `'${kind4}'`).join(", ");
43374
+ var IMPORT = "import:";
43375
+ var WORD_CHAR = /[\p{L}\p{N}]/u;
43376
+ var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}\0${account}`, "keyOf");
43377
+ var lineOf2 = /* @__PURE__ */ __name((parts2) => {
43378
+ const line = parts2.join(" \xB7 ").replace(/\s+/gu, " ").trim();
43379
+ return line.length <= TEXT_CHARS ? line : `${line.slice(0, TEXT_CHARS - 1)}\u2026`;
43380
+ }, "lineOf");
43381
+ var startsAWord = /* @__PURE__ */ __name((folded6, word2) => {
43382
+ for (let at = folded6.indexOf(word2); at !== -1; at = folded6.indexOf(word2, at + 1))
43383
+ if (at === 0 || !WORD_CHAR.test(folded6[at - 1]))
43384
+ return true;
43385
+ return false;
43386
+ }, "startsAWord");
43387
+ var businessSearchOver = /* @__PURE__ */ __name(({ database }) => {
43388
+ const matchedOf = /* @__PURE__ */ __name((kind4, wanted, anyWord) => database.prepare(SEARCHED[kind4]).all().flatMap((row2) => {
43389
+ const parts2 = FIELDS2.flatMap((field4) => row2[field4] == null ? [] : [String(row2[field4])]);
43390
+ const folded6 = fold(parts2.join("\n"));
43391
+ const score = wanted.filter((word2) => startsAWord(folded6, word2)).length;
43392
+ if (anyWord ? score === 0 : score < wanted.length)
43393
+ return [];
43394
+ const source2 = String(row2.source);
43395
+ return [
43396
+ {
43397
+ kind: kind4,
43398
+ id: Number(row2.id),
43399
+ review: row2.review === "proposed" ? "proposed" : "confirmed",
43400
+ imported: source2.startsWith(IMPORT) ? source2.slice(IMPORT.length) : void 0,
43401
+ parts: parts2,
43402
+ score,
43403
+ updatedAt: Number(row2.updated_at)
43404
+ }
43405
+ ];
43406
+ }), "matchedOf");
43407
+ const sourcesOf2 = /* @__PURE__ */ __name((matched) => {
43408
+ const sources = /* @__PURE__ */ new Map();
43409
+ for (const kind4 of BUSINESS_KINDS) {
43410
+ const ids = matched.filter((one2) => one2.kind === kind4 && one2.imported !== void 0).map(({ id: id2 }) => id2);
43411
+ if (!ids.length)
43412
+ continue;
43413
+ 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));
43414
+ for (const row2 of rows) {
43415
+ const ref3 = `${kind4}:${row2.entity_id}`;
43416
+ if (!sources.has(ref3))
43417
+ sources.set(ref3, {
43418
+ provider: String(row2.provider),
43419
+ account: String(row2.account),
43420
+ externalId: String(row2.external_id)
43421
+ });
43422
+ }
43423
+ }
43424
+ return sources;
43425
+ }, "sourcesOf");
43426
+ const find2 = /* @__PURE__ */ __name(({ words: words3, anyWord = false, accounts: accounts2, limit }) => {
43427
+ const wanted = [...new Set(words3.map((word2) => fold(word2).trim()).filter(Boolean))];
43428
+ if (!wanted.length)
43429
+ return [];
43430
+ const most = Math.min(Math.max(limit ?? 100, 1), BUSINESS_FIND_MAX);
43431
+ const within = accounts2 === void 0 ? void 0 : new Set(accounts2.map(keyOf4));
43432
+ 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);
43433
+ const candidates = within === void 0 ? matched.slice(0, most) : matched.filter((one2) => one2.imported);
43434
+ const sources = sourcesOf2(candidates);
43435
+ const kept2 = within === void 0 ? candidates : candidates.filter((one2) => {
43436
+ const source2 = sources.get(`${one2.kind}:${one2.id}`);
43437
+ return source2 !== void 0 && within.has(keyOf4(source2));
43438
+ }).slice(0, most);
43439
+ return kept2.map((one2) => {
43440
+ const ref3 = `${one2.kind}:${one2.id}`;
43441
+ const source2 = sources.get(ref3);
43442
+ return {
43443
+ kind: one2.kind,
43444
+ ref: ref3,
43445
+ review: one2.review,
43446
+ ...one2.imported === void 0 ? {} : { imported: one2.imported },
43447
+ ...source2 === void 0 ? {} : { source: source2 },
43448
+ text: lineOf2(one2.parts),
43449
+ updatedAt: one2.updatedAt
43450
+ };
43451
+ });
43452
+ }, "find");
43453
+ 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");
43454
+ return {
43455
+ find: /* @__PURE__ */ __name(async (search2) => find2(search2), "find"),
43456
+ accounts: /* @__PURE__ */ __name(async () => sourceAccounts(), "accounts")
43457
+ };
43458
+ }, "businessSearchOver");
43459
+
43460
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
43217
43461
  var DAY5 = 864e5;
43218
43462
  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}')`;
43219
43463
  var accountsOf = /* @__PURE__ */ __name((filter) => {
@@ -43323,7 +43567,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
43323
43567
  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);
43324
43568
  }, "listEvents");
43325
43569
 
43326
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-forget.js
43570
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-forget.js
43327
43571
  var distinctIds = /* @__PURE__ */ __name((rows) => [...new Set(rows.map((row2) => Number(row2.id)))], "distinctIds");
43328
43572
  var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, accountId, cursorKey: cursorKey2, now: now2 }, refresh) => {
43329
43573
  const unseenBefore = unreferenced(database, "identities");
@@ -43380,7 +43624,7 @@ var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, account
43380
43624
  return { entries: entryIds.length, events: goneEvents.length };
43381
43625
  }, "forgetCalendarRows");
43382
43626
 
43383
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
43627
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
43384
43628
  var calendarOf = /* @__PURE__ */ __name((row2) => ({
43385
43629
  id: Number(row2.id),
43386
43630
  accountId: Number(row2.account_id),
@@ -43983,7 +44227,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
43983
44227
  };
43984
44228
  }, "eventStoreOver");
43985
44229
 
43986
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
44230
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
43987
44231
  var CATALOG_QUERY = defineQuery({
43988
44232
  entity: "document",
43989
44233
  backend: "sql",
@@ -44225,7 +44469,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
44225
44469
  };
44226
44470
  }, "catalogStoreOver");
44227
44471
 
44228
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
44472
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
44229
44473
  var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
44230
44474
  var field3 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
44231
44475
  CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
@@ -44238,7 +44482,7 @@ var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
44238
44482
  THEN 'source-modified' ELSE 'stored-update' END`;
44239
44483
  var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field3("sourceUrl")})`;
44240
44484
 
44241
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
44485
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
44242
44486
  var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
44243
44487
  const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
44244
44488
  signal?.throwIfAborted();
@@ -44337,7 +44581,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
44337
44581
  });
44338
44582
  }, "readMeetingContextEvidence");
44339
44583
 
44340
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
44584
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
44341
44585
  var corpora = {
44342
44586
  message: {
44343
44587
  table: "messages",
@@ -44576,10 +44820,10 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
44576
44820
  }
44577
44821
  }), "contextRecordsOver");
44578
44822
 
44579
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/crm.js
44823
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/crm.js
44580
44824
  var isItemKind = /* @__PURE__ */ __name((kind4) => kind4 === "deal" || kind4 === "lead", "isItemKind");
44581
44825
 
44582
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/records.js
44826
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/records.js
44583
44827
  import { createHash as createHash13 } from "node:crypto";
44584
44828
  var RECORDS_SCHEMA_VERSION = 1;
44585
44829
  var RECORD_OPERATIONS = ["upsert", "delete"];
@@ -44909,7 +45153,7 @@ var fieldReferences = /* @__PURE__ */ __name((record4, options = {}) => {
44909
45153
  return found2;
44910
45154
  }, "fieldReferences");
44911
45155
 
44912
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-rows.js
45156
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-rows.js
44913
45157
  var TABLES2 = { deal: "deals", lead: "leads" };
44914
45158
  var SOURCE = "crm";
44915
45159
  var crmIdentityId = /* @__PURE__ */ __name((key2, externalId, type = "contact") => `${idPart(key2.account)}/${type}/${idPart(externalId)}`, "crmIdentityId");
@@ -45038,7 +45282,7 @@ var crmRowsOver = /* @__PURE__ */ __name((context) => {
45038
45282
  return { savePipeline, saveItemRow };
45039
45283
  }, "crmRowsOver");
45040
45284
 
45041
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-settings.js
45285
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-settings.js
45042
45286
  var CRM_LINK_MODES = ["reported", "review"];
45043
45287
  var COMPANY_TYPE_MEANINGS = ["customer-of", "supplier", "partner-of"];
45044
45288
  var crmSettingKey = /* @__PURE__ */ __name((key2, name) => `crm.${key2.provider}:${key2.account}.${name}`, "crmSettingKey");
@@ -45101,10 +45345,25 @@ var crmSettingsOf = /* @__PURE__ */ __name((database) => database.prepare("SELEC
45101
45345
  ];
45102
45346
  }), "crmSettingsOf");
45103
45347
 
45104
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/money-lines.js
45348
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/money-lines.js
45349
+ var MAX_LINES = 500;
45105
45350
  var PARENTS = {
45106
- invoice: { table: "invoice_lines", column: "invoice_id", reasons: "finance" },
45107
- order: { table: "order_lines", column: "order_id", reasons: "order" }
45351
+ invoice: {
45352
+ parents: "invoices",
45353
+ table: "invoice_lines",
45354
+ column: "invoice_id",
45355
+ reasons: "finance",
45356
+ full: "finance.lines",
45357
+ instead: "reject or void the invoice instead"
45358
+ },
45359
+ order: {
45360
+ parents: "orders",
45361
+ table: "order_lines",
45362
+ column: "order_id",
45363
+ reasons: "order",
45364
+ full: "order.field",
45365
+ instead: "reject or cancel the order instead"
45366
+ }
45108
45367
  };
45109
45368
  var moneyLinesOver = /* @__PURE__ */ __name(({ database }) => {
45110
45369
  const productOf2 = /* @__PURE__ */ __name((reference2, what, code) => {
@@ -45116,7 +45375,7 @@ var moneyLinesOver = /* @__PURE__ */ __name(({ database }) => {
45116
45375
  refuse(`product:${row2.id} is deleted`, code("lines"));
45117
45376
  return row2;
45118
45377
  }, "productOf");
45119
- const priced2 = /* @__PURE__ */ __name((parent2, line, at, currency2) => {
45378
+ const priced = /* @__PURE__ */ __name((parent2, line, at, currency2) => {
45120
45379
  const code = /* @__PURE__ */ __name((name) => `${PARENTS[parent2].reasons}.${name}`, "code");
45121
45380
  const what = `line ${at + 1}`;
45122
45381
  const product = line.product === void 0 ? null : productOf2(line.product, what, code);
@@ -45140,7 +45399,7 @@ var moneyLinesOver = /* @__PURE__ */ __name(({ database }) => {
45140
45399
  productId: product === null ? null : Number(product.id)
45141
45400
  };
45142
45401
  }, "priced");
45143
- const linesOf = /* @__PURE__ */ __name((parent2, lines, currency2) => lines.map((line, at) => priced2(parent2, line, at, currency2)), "linesOf");
45402
+ const linesOf = /* @__PURE__ */ __name((parent2, lines, currency2) => lines.map((line, at) => priced(parent2, line, at, currency2)), "linesOf");
45144
45403
  const insertLines = /* @__PURE__ */ __name((parent2, id2, lines, from2, at) => {
45145
45404
  const { table, column: column2 } = PARENTS[parent2];
45146
45405
  const insert = database.prepare(`INSERT INTO ${table} (${column2}, position, description, quantity, unit_price, amount, catalog_item_id, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`);
@@ -45159,10 +45418,34 @@ var moneyLinesOver = /* @__PURE__ */ __name(({ database }) => {
45159
45418
  product: line.catalog_item_id == null ? null : `product:${line.catalog_item_id}`
45160
45419
  }));
45161
45420
  }, "shownLines");
45162
- return { linesOf, insertLines, shownLines };
45421
+ const appendLine = /* @__PURE__ */ __name((parent2, id2, line, at) => {
45422
+ const { table, column: column2, full } = PARENTS[parent2];
45423
+ const last = Number(database.prepare(`SELECT coalesce(max(position), 0) AS n FROM ${table} WHERE ${column2} = ?`).get(id2)?.n);
45424
+ if (last >= MAX_LINES)
45425
+ refuse(`an ${parent2} has at most ${MAX_LINES} lines`, full);
45426
+ insertLines(parent2, id2, [line], last + 1, at);
45427
+ }, "appendLine");
45428
+ const deleteLine = /* @__PURE__ */ __name((parent2, id2, position2) => {
45429
+ const { table, column: column2, reasons, instead } = PARENTS[parent2];
45430
+ const lines = Number(database.prepare(`SELECT count(*) AS n FROM ${table} WHERE ${column2} = ?`).get(id2)?.n);
45431
+ const gone = database.prepare(`DELETE FROM ${table} WHERE ${column2} = ? AND position = ?`).run(id2, position2);
45432
+ if (gone.changes === 0)
45433
+ throw new CliError("not_found", `${parent2}:${id2} has no line ${position2}`, { reason: `${reasons}.no-line` });
45434
+ if (lines === 1)
45435
+ refuse(`line ${position2} is the last of ${parent2}:${id2}; ${instead}`, `${reasons}.line`);
45436
+ }, "deleteLine");
45437
+ const sumOf = /* @__PURE__ */ __name((parent2, id2) => {
45438
+ const { table, column: column2 } = PARENTS[parent2];
45439
+ return Number(database.prepare(`SELECT coalesce(sum(amount), 0) AS n FROM ${table} WHERE ${column2} = ?`).get(id2)?.n);
45440
+ }, "sumOf");
45441
+ const retotal = /* @__PURE__ */ __name((parent2, id2, at) => {
45442
+ const { parents, table, column: column2 } = PARENTS[parent2];
45443
+ database.prepare(`UPDATE ${parents} SET total = coalesce((SELECT sum(amount) FROM ${table} WHERE ${column2} = ?), total), updated_at = ? WHERE id = ?`).run(id2, at, id2);
45444
+ }, "retotal");
45445
+ return { linesOf, insertLines, shownLines, appendLine, deleteLine, sumOf, retotal };
45163
45446
  }, "moneyLinesOver");
45164
45447
 
45165
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/refunds.js
45448
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/refunds.js
45166
45449
  var COUNTED = {
45167
45450
  confirmed: "np.review = 'confirmed' AND np.deleted_at IS NULL",
45168
45451
  // A proposed refund promises nothing back yet, so it must not free room an import could then fill.
@@ -45237,10 +45520,9 @@ var refundRulesOver = /* @__PURE__ */ __name((context) => {
45237
45520
  return { originalFor, refundShare, confirmable, keepsRefunded, keepsShare, keepsInvoice };
45238
45521
  }, "refundRulesOver");
45239
45522
 
45240
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/finance.js
45523
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/finance.js
45241
45524
  var FINANCE_TYPES = ["invoice", "payment"];
45242
45525
  var isFinanceType = /* @__PURE__ */ __name((type) => FINANCE_TYPES.includes(type), "isFinanceType");
45243
- var MAX_LINES = 500;
45244
45526
  var PAID = netPaidSql("i.id");
45245
45527
  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`;
45246
45528
  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";
@@ -45423,6 +45705,28 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
45423
45705
  for (const refund of [true, false])
45424
45706
  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);
45425
45707
  }, "dropAllocations");
45708
+ const mayChangeLines = /* @__PURE__ */ __name((row2, by) => {
45709
+ 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`);
45710
+ if (row2.deleted_at != null || row2.review === "rejected" || row2.status === "void")
45711
+ refuse(`invoice:${row2.id} is ${row2.deleted_at != null ? "deleted" : row2.review === "rejected" ? "rejected" : "void"}`, "finance.status");
45712
+ }, "mayChangeLines");
45713
+ const relined = /* @__PURE__ */ __name((row2, change) => {
45714
+ const [id2, currency2] = [Number(row2.id), String(row2.currency)];
45715
+ write(database, () => {
45716
+ change(id2);
45717
+ const total = lines.sumOf("invoice", id2);
45718
+ if (!Number.isSafeInteger(total))
45719
+ refuse("an invoice's total is too large", "finance.total");
45720
+ if (total <= 0)
45721
+ refuse("an invoice totals more than 0", "finance.total");
45722
+ const paid = Number(database.prepare(`SELECT ${netPaidSql("?")} AS n`).get(id2)?.n);
45723
+ if (total < paid)
45724
+ refuse(`${moneyLabel(paid, currency2)} is paid on invoice:${id2}; its lines cannot total ${moneyLabel(total, currency2)}`, "finance.below-paid");
45725
+ lines.retotal("invoice", id2, now2());
45726
+ settle(id2);
45727
+ });
45728
+ return invoiceDetail(`invoice:${id2}`);
45729
+ }, "relined");
45426
45730
  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");
45427
45731
  return {
45428
45732
  addInvoice: /* @__PURE__ */ __name((input) => {
@@ -45430,8 +45734,8 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
45430
45734
  const currency2 = currencyOf(input.currency);
45431
45735
  if (!Array.isArray(input.lines) || input.lines.length === 0 || input.lines.length > MAX_LINES)
45432
45736
  refuse(`an invoice has 1\u2013${MAX_LINES} lines`, "finance.lines");
45433
- const priced2 = lines.linesOf("invoice", input.lines, currency2);
45434
- const total = priced2.reduce((sum, line) => sum + line.amount, 0);
45737
+ const priced = lines.linesOf("invoice", input.lines, currency2);
45738
+ const total = priced.reduce((sum, line) => sum + line.amount, 0);
45435
45739
  if (!Number.isSafeInteger(total))
45436
45740
  refuse("an invoice's total is too large", "finance.total");
45437
45741
  if (total <= 0)
@@ -45452,13 +45756,24 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
45452
45756
  const by = written(input);
45453
45757
  const at = now2();
45454
45758
  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);
45455
- lines.insertLines("invoice", made, priced2, 1, at);
45759
+ lines.insertLines("invoice", made, priced, 1, at);
45456
45760
  keepEvidence("invoice", made, by);
45457
45761
  return made;
45458
45762
  });
45459
45763
  return invoiceDetail(`invoice:${id2}`);
45460
45764
  }, "addInvoice"),
45461
45765
  invoice: /* @__PURE__ */ __name((reference2) => invoiceDetail(reference2), "invoice"),
45766
+ addInvoiceLine: /* @__PURE__ */ __name((reference2, { by, ...line }) => {
45767
+ const row2 = rowOf2(reference2, "invoice");
45768
+ mayChangeLines(row2, by);
45769
+ const [priced] = lines.linesOf("invoice", [line], String(row2.currency));
45770
+ return relined(row2, (id2) => lines.appendLine("invoice", id2, priced, now2()));
45771
+ }, "addInvoiceLine"),
45772
+ removeInvoiceLine: /* @__PURE__ */ __name((reference2, { position: position2, by }) => {
45773
+ const row2 = rowOf2(reference2, "invoice");
45774
+ mayChangeLines(row2, by);
45775
+ return relined(row2, (id2) => lines.deleteLine("invoice", id2, position2));
45776
+ }, "removeInvoiceLine"),
45462
45777
  invoices: /* @__PURE__ */ __name((filter = {}) => {
45463
45778
  const project2 = filter.project === void 0 ? null : projectId(database, filter.project);
45464
45779
  const counterparty = partyThing(filter.counterparty, "the counterparty");
@@ -45525,10 +45840,10 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
45525
45840
  payment: /* @__PURE__ */ __name((reference2) => paymentDetail(reference2), "payment"),
45526
45841
  payments: /* @__PURE__ */ __name((filter = {}) => {
45527
45842
  const project2 = filter.project === void 0 ? null : projectId(database, filter.project);
45528
- const party2 = partyThing(filter.party, "the party");
45843
+ const party3 = partyThing(filter.party, "the party");
45529
45844
  const by = proposedBySql("p.author_type", "p.author_id", filter.proposedBy);
45530
45845
  const review = filter.review === void 0 ? null : oneOf4(filter.review, FINANCE_REVIEWS, "a review");
45531
- 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);
45846
+ 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);
45532
45847
  }, "payments"),
45533
45848
  allocate: /* @__PURE__ */ __name(({ payment, invoice, amount, by }) => {
45534
45849
  const row2 = rowOf2(payment, "payment");
@@ -45587,6 +45902,8 @@ var financeStoreOver = /* @__PURE__ */ __name((context) => {
45587
45902
  return {
45588
45903
  addInvoice: /* @__PURE__ */ __name(async (input) => operations.addInvoice(input), "addInvoice"),
45589
45904
  invoice: /* @__PURE__ */ __name(async (reference2) => operations.invoice(reference2), "invoice"),
45905
+ addInvoiceLine: /* @__PURE__ */ __name(async (reference2, input) => operations.addInvoiceLine(reference2, input), "addInvoiceLine"),
45906
+ removeInvoiceLine: /* @__PURE__ */ __name(async (reference2, input) => operations.removeInvoiceLine(reference2, input), "removeInvoiceLine"),
45590
45907
  invoices: /* @__PURE__ */ __name(async (filter) => operations.invoices(filter), "invoices"),
45591
45908
  issueInvoice: /* @__PURE__ */ __name(async (reference2, by) => operations.issueInvoice(reference2, by), "issueInvoice"),
45592
45909
  voidInvoice: /* @__PURE__ */ __name(async (reference2, by) => operations.voidInvoice(reference2, by), "voidInvoice"),
@@ -45601,7 +45918,7 @@ var financeStoreOver = /* @__PURE__ */ __name((context) => {
45601
45918
  };
45602
45919
  }, "financeStoreOver");
45603
45920
 
45604
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-entries.js
45921
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-entries.js
45605
45922
  var refuse2 = /* @__PURE__ */ __name((message3, reason) => {
45606
45923
  throw new CliError("validation_error", message3, { reason });
45607
45924
  }, "refuse");
@@ -45617,7 +45934,7 @@ var entryAmount = /* @__PURE__ */ __name((payment) => {
45617
45934
  return refuse2(`${payment.currency} has ${scale} decimals; ${payment.amount} does not fit`, "money.amount");
45618
45935
  return formatDecimal(cents / shift, scale);
45619
45936
  }, "entryAmount");
45620
- var party = /* @__PURE__ */ __name((payment) => /^(person|organization):/.test(payment.counterparty ?? "") ? payment.counterparty : null, "party");
45937
+ var party2 = /* @__PURE__ */ __name((payment) => /^(person|organization):/.test(payment.counterparty ?? "") ? payment.counterparty : null, "party");
45621
45938
  var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
45622
45939
  const finance = financeOperationsOver(context);
45623
45940
  const today = /* @__PURE__ */ __name(() => new Date(context.now()).toISOString().slice(0, 10), "today");
@@ -45641,7 +45958,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
45641
45958
  ...by === "owner" ? {} : { source: "agent", reason: entry2.statement ?? paymentTitle(entry2) },
45642
45959
  evidence: entry2.evidence
45643
45960
  };
45644
- const counterparty = party(payment);
45961
+ const counterparty = party2(payment);
45645
45962
  if (payment.state === "cancelled") {
45646
45963
  if (entry2.supersedes === void 0)
45647
45964
  return refuse2("a cancelled payment names the invoice it cancels", "finance.ref");
@@ -45679,7 +45996,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
45679
45996
  };
45680
45997
  }, "paymentEntriesOver");
45681
45998
 
45682
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
45999
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
45683
46000
  var EVIDENCE_FINDINGS_KIND = "evidence_findings";
45684
46001
  var reference = /* @__PURE__ */ __name((raw) => {
45685
46002
  if (/^(document|note):[1-9]\d*$/.test(raw))
@@ -45705,7 +46022,7 @@ var validateEvidenceFindings = /* @__PURE__ */ __name((input) => {
45705
46022
  return valid;
45706
46023
  }, "validateEvidenceFindings");
45707
46024
 
45708
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
46025
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
45709
46026
  var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
45710
46027
  var PROPOSAL_VERDICTS = ["useful", "not_useful"];
45711
46028
  var iso10 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
@@ -45793,11 +46110,11 @@ var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
45793
46110
  }, "propose"),
45794
46111
  get: /* @__PURE__ */ __name((id2) => actionOf(rowOf2(id2)), "get"),
45795
46112
  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"),
45796
- list: /* @__PURE__ */ __name(({ status: status2, limit = 100, kinds: kinds2, except, proposedBy, project: project2 } = {}) => {
46113
+ list: /* @__PURE__ */ __name(({ status: status2, limit = 100, kinds: kinds2, except, proposedBy, project: project2, evidence } = {}) => {
45797
46114
  if (status2 !== void 0 && !PROPOSAL_STATUSES.includes(status2))
45798
46115
  throw new CliError("validation_error", `a status is one of ${PROPOSAL_STATUSES.join(", ")}`);
45799
46116
  const by = proposedBySql("p.proposed_by_type", "p.proposed_by_id", proposedBy);
45800
- 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);
46117
+ 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);
45801
46118
  }, "list"),
45802
46119
  approve: /* @__PURE__ */ __name((id2, result, by) => decide2(id2, "approved", result, by), "approve"),
45803
46120
  reject: /* @__PURE__ */ __name((id2, by, result) => decide2(id2, "rejected", result, by), "reject"),
@@ -45886,7 +46203,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
45886
46203
  };
45887
46204
  }, "proposedActionsStoreOver");
45888
46205
 
45889
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-roles.js
46206
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-roles.js
45890
46207
  var settingOf = /* @__PURE__ */ __name((list2) => `relationships.roles.${list2}`, "settingOf");
45891
46208
  var isList = /* @__PURE__ */ __name((list2) => Object.hasOwn(ROLE_LISTS, list2), "isList");
45892
46209
  var listOf = /* @__PURE__ */ __name((list2) => {
@@ -45958,7 +46275,7 @@ var relationRolesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
45958
46275
  };
45959
46276
  }, "relationRolesOver");
45960
46277
 
45961
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-proposals.js
46278
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-proposals.js
45962
46279
  var isoOf = /* @__PURE__ */ __name((ms) => ms === void 0 ? null : new Date(ms).toISOString(), "isoOf");
45963
46280
  var relationOf = /* @__PURE__ */ __name((link3, now2) => ({
45964
46281
  id: link3.id,
@@ -46078,12 +46395,12 @@ var relationProposalsOver = /* @__PURE__ */ __name((context) => {
46078
46395
  const { from: from2, existing: existing2 } = found2;
46079
46396
  const { to } = found2.ends;
46080
46397
  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);
46081
- const pending2 = rows.find((row2) => row2.status === "proposed");
46398
+ const pending = rows.find((row2) => row2.status === "proposed");
46082
46399
  return {
46083
46400
  linked: existing2 !== void 0,
46084
46401
  confirmed: existing2 !== void 0 && Number(existing2.confirmed) === 1,
46085
46402
  rejected: rows.some((row2) => row2.status === "rejected"),
46086
- pending: pending2 ? operations.get(String(pending2.id)) : null
46403
+ pending: pending ? operations.get(String(pending.id)) : null
46087
46404
  };
46088
46405
  }, "state"),
46089
46406
  /** The same pending pair returns the proposal already held; a scored one updates its score in place. */
@@ -46277,7 +46594,8 @@ var decidedOrigin = /* @__PURE__ */ __name((by) => by === "owner" ? { origin: "o
46277
46594
  provenance: `agent:${by.bot} for the owner: ${by.reason.trim()}`
46278
46595
  }, "decidedOrigin");
46279
46596
 
46280
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/reported-relations.js
46597
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/reported-relations.js
46598
+ var KEYED = "kind IN ('member-of', 'related-to', 'reports-to', 'customer-of', 'partner-of') AND to_id IS NOT NULL";
46281
46599
  var metadataOf = /* @__PURE__ */ __name((relation) => relation.metadata && Object.keys(relation.metadata).length ? JSON.stringify(relation.metadata) : null, "metadataOf");
46282
46600
  var syncReportedIn = /* @__PURE__ */ __name((context, key2, relationships, scope3, { source: source2 = "import", by = { bot: key2.provider, kind: "rule" } } = {}) => {
46283
46601
  const { database, now: now2 } = context;
@@ -46296,7 +46614,7 @@ var syncReportedIn = /* @__PURE__ */ __name((context, key2, relationships, scope
46296
46614
  };
46297
46615
  const seen = /* @__PURE__ */ new Set();
46298
46616
  const issue = /* @__PURE__ */ __name((relation, reason, message3) => result.issues.push({ reason, message: message3, from: relation.from, to: relation.to, kind: relation.kind }), "issue");
46299
- const sameKey = "kind = ? AND from_type = ? AND from_id = ? AND to_type = ? AND to_id = ? AND anchor IS NULL AND ifnull(role, '') = ?";
46617
+ const sameKey = `${KEYED} AND kind = ? AND from_type = ? AND from_id = ? AND to_type = ? AND to_id = ? AND anchor IS NULL AND ifnull(role, '') = ?`;
46300
46618
  for (const relation of relationships) {
46301
46619
  let from2 = thingOf(database, relation.from);
46302
46620
  let to = thingOf(database, relation.to);
@@ -46382,7 +46700,7 @@ var relationsStoreOver = /* @__PURE__ */ __name((context) => ({
46382
46700
  syncReported: /* @__PURE__ */ __name(async (key2, relationships, scope3, options) => write(context.database, () => syncReportedIn(context, key2, relationships, scope3, options)), "syncReported")
46383
46701
  }), "relationsStoreOver");
46384
46702
 
46385
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/crm.js
46703
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/crm.js
46386
46704
  var PENDING = "crm:pending-relations";
46387
46705
  var PENDING_DAYS = 30;
46388
46706
  var PENDING_MOST = 5e3;
@@ -46523,7 +46841,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46523
46841
  }, "flush")
46524
46842
  };
46525
46843
  }, "pendingBook");
46526
- const reportFrom = /* @__PURE__ */ __name((key2, accountId, owner, wanted, scope3, tally, pending2) => {
46844
+ const reportFrom = /* @__PURE__ */ __name((key2, accountId, owner, wanted, scope3, tally, pending) => {
46527
46845
  const name = `${owner.type}:${owner.id}`;
46528
46846
  const relationships = [];
46529
46847
  const waiting = [];
@@ -46553,7 +46871,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46553
46871
  ...one2.metadata ? { metadata: one2.metadata } : {}
46554
46872
  });
46555
46873
  }
46556
- pending2.replace(name, waiting);
46874
+ pending.replace(name, waiting);
46557
46875
  const done = syncReportedIn(context, key2, relationships, scope3, { source: SOURCE });
46558
46876
  tally.skippedOwnerRejected += done.skippedOwnerRejected;
46559
46877
  for (const one2 of done.issues)
@@ -46563,10 +46881,10 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46563
46881
  const accountId = findAccountPk(context, key2);
46564
46882
  if (accountId === void 0)
46565
46883
  return { written: 0, dropped: 0 };
46566
- const pending2 = pendingBook(accountId);
46884
+ const pending = pendingBook(accountId);
46567
46885
  let written = 0;
46568
46886
  const owners = /* @__PURE__ */ new Map();
46569
- for (const one2 of pending2.all())
46887
+ for (const one2 of pending.all())
46570
46888
  owners.set(one2.owner, [...owners.get(one2.owner) ?? [], one2]);
46571
46889
  for (const [owner, entries] of owners) {
46572
46890
  const kept2 = [];
@@ -46588,9 +46906,9 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46588
46906
  written += 1;
46589
46907
  }
46590
46908
  if (kept2.length !== entries.length)
46591
- pending2.replace(owner, kept2);
46909
+ pending.replace(owner, kept2);
46592
46910
  }
46593
- return { written, dropped: pending2.flush() };
46911
+ return { written, dropped: pending.flush() };
46594
46912
  }), "retryPending");
46595
46913
  const saveItem = /* @__PURE__ */ __name((key2, accountId, kind4, item, at, report) => {
46596
46914
  const saved = saveItemRow(key2, accountId, kind4, item, at);
@@ -46628,10 +46946,10 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46628
46946
  const at = now2();
46629
46947
  const skipped = [];
46630
46948
  const tally = tallied();
46631
- const pending2 = pendingBook(accountId);
46949
+ const pending = pendingBook(accountId);
46632
46950
  for (const item of items)
46633
46951
  try {
46634
- const missing4 = saveItem(key2, accountId, kind4, item, at, { tally, pending: pending2, users });
46952
+ const missing4 = saveItem(key2, accountId, kind4, item, at, { tally, pending, users });
46635
46953
  if (missing4)
46636
46954
  skipped.push(missing4);
46637
46955
  } catch (error) {
@@ -46639,7 +46957,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46639
46957
  throw error;
46640
46958
  skipped.push({ externalId: item.externalId, reason: "crm.item-invalid", message: error.message });
46641
46959
  }
46642
- tally.droppedPending += pending2.flush();
46960
+ tally.droppedPending += pending.flush();
46643
46961
  return { saved: items.length - skipped.length, skipped, ...relationNotes(tally) };
46644
46962
  }), "saveItems");
46645
46963
  const saveOrganizations = /* @__PURE__ */ __name((key2, organizations2) => write(database, () => {
@@ -46707,7 +47025,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46707
47025
  const saveUsers = /* @__PURE__ */ __name((key2, users, departments) => {
46708
47026
  const accountId = account(key2);
46709
47027
  const tally = tallied();
46710
- const pending2 = pendingBook(accountId);
47028
+ const pending = pendingBook(accountId);
46711
47029
  for (const user of users)
46712
47030
  nameUnnamed(key2, user.externalId, "user", textOf4(user.name, 200));
46713
47031
  const active = new Map(users.filter((user) => user.active !== false).map((user) => [user.externalId, user]));
@@ -46734,7 +47052,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46734
47052
  ...position2 ? { metadata: { position: position2 } } : {}
46735
47053
  })) : [];
46736
47054
  const scope3 = { from: [ref3], kinds: ["member-of"], roles: ["employee"] };
46737
- reportFrom(key2, accountId, self, wanted, scope3, tally, pending2);
47055
+ reportFrom(key2, accountId, self, wanted, scope3, tally, pending);
46738
47056
  }
46739
47057
  if (departments === void 0 || user.departments === void 0)
46740
47058
  continue;
@@ -46753,9 +47071,9 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46753
47071
  metadata: { derived: "department-head" }
46754
47072
  }));
46755
47073
  const owner = { type: "user", id: `${user.externalId}/reports-to` };
46756
- reportFrom(key2, accountId, owner, lines, { from: [ref3], kinds: ["reports-to"] }, tally, pending2);
47074
+ reportFrom(key2, accountId, owner, lines, { from: [ref3], kinds: ["reports-to"] }, tally, pending);
46757
47075
  }
46758
- tally.droppedPending += pending2.flush();
47076
+ tally.droppedPending += pending.flush();
46759
47077
  return { saved: users.length, skipped: [], ...relationNotes(tally) };
46760
47078
  }, "saveUsers");
46761
47079
  const stored4 = /* @__PURE__ */ __name((key2, kind4) => {
@@ -46772,10 +47090,10 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46772
47090
  mark.run(at, Number(row2.id));
46773
47091
  const accountId = findAccountPk(context, key2);
46774
47092
  if (isItemKind(kind4) && accountId !== void 0 && rows.length) {
46775
- const pending2 = pendingBook(accountId);
47093
+ const pending = pendingBook(accountId);
46776
47094
  for (const row2 of rows)
46777
- pending2.forget(`${kind4}:${row2.external_id}`);
46778
- pending2.flush();
47095
+ pending.forget(`${kind4}:${row2.external_id}`);
47096
+ pending.flush();
46779
47097
  }
46780
47098
  return rows.length;
46781
47099
  }, "markDeleted");
@@ -46792,7 +47110,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46792
47110
  return write(database, () => {
46793
47111
  const accountId = account(key2);
46794
47112
  const tally = tallied();
46795
- const pending2 = pendingBook(accountId);
47113
+ const pending = pendingBook(accountId);
46796
47114
  for (const contact of contacts2) {
46797
47115
  const person2 = nameUnnamed(key2, contact.externalId, "contact", textOf4(contact.name, 200));
46798
47116
  const email = textOf4(contact.email, 320)?.toLowerCase();
@@ -46823,9 +47141,9 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46823
47141
  };
46824
47142
  });
46825
47143
  const scope3 = { from: [`person:${person2}`], kinds: ["member-of"], roles: ["contact"] };
46826
- reportFrom(key2, accountId, self, wanted, scope3, tally, pending2);
47144
+ reportFrom(key2, accountId, self, wanted, scope3, tally, pending);
46827
47145
  }
46828
- tally.droppedPending += pending2.flush();
47146
+ tally.droppedPending += pending.flush();
46829
47147
  return { saved: contacts2.length, skipped: [], ...relationNotes(tally) };
46830
47148
  });
46831
47149
  }, "savePeople"),
@@ -46860,7 +47178,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
46860
47178
  };
46861
47179
  }, "crmCopiesOver");
46862
47180
 
46863
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/stage-amounts.js
47181
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/stage-amounts.js
46864
47182
  var TABLES3 = { deal: "deals", lead: "leads" };
46865
47183
  var stageAmountsOf = /* @__PURE__ */ __name(({ database }, kind4, stageIds, cutoff) => {
46866
47184
  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);
@@ -46877,7 +47195,7 @@ var stageAmountsOf = /* @__PURE__ */ __name(({ database }, kind4, stageIds, cuto
46877
47195
  });
46878
47196
  }, "stageAmountsOf");
46879
47197
 
46880
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/deals.js
47198
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/deals.js
46881
47199
  var TABLES4 = { deal: "deals", lead: "leads" };
46882
47200
  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");
46883
47201
  var MAX_STAGES = 30;
@@ -47218,10 +47536,10 @@ var dealsStoreOver = /* @__PURE__ */ __name((context) => {
47218
47536
  };
47219
47537
  }, "dealsStoreOver");
47220
47538
 
47221
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
47539
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
47222
47540
  import { createHash as createHash14, randomBytes as randomBytes2 } from "node:crypto";
47223
47541
 
47224
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/decision-requests.js
47542
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/decision-requests.js
47225
47543
  var DECISION_ACTIONS = ["confirm", "reject", "ask-confirm", "ask-reject", "back", "later"];
47226
47544
  var DECISION_TTL_MS = 72 * 60 * 60 * 1e3;
47227
47545
  var CALLBACK_PREFIX = "wcr1:";
@@ -47235,7 +47553,7 @@ var callbackDataOf = /* @__PURE__ */ __name((token) => {
47235
47553
  }, "callbackDataOf");
47236
47554
  var parseCallbackData = /* @__PURE__ */ __name((data) => typeof data === "string" ? CALLBACK.exec(data)?.[1] : void 0, "parseCallbackData");
47237
47555
 
47238
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
47556
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
47239
47557
  var digestOf = /* @__PURE__ */ __name((token) => createHash14("sha256").update(token).digest("hex"), "digestOf");
47240
47558
  var newToken = /* @__PURE__ */ __name(() => randomBytes2(16).toString("base64url"), "newToken");
47241
47559
  var requestOf = /* @__PURE__ */ __name((row2) => ({
@@ -47331,7 +47649,7 @@ var decisionRequestStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
47331
47649
  };
47332
47650
  }, "decisionRequestStoreOver");
47333
47651
 
47334
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
47652
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
47335
47653
  var NOTE_FIELDS = [
47336
47654
  "text",
47337
47655
  "exact",
@@ -47609,7 +47927,7 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
47609
47927
  });
47610
47928
  }, "searchCorpus");
47611
47929
  var SCAN_PAGE3 = 5e3;
47612
- 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)))";
47930
+ var LIVE4 = "((k.chunkable_type = 'document' AND EXISTS (SELECT 1 FROM documents d WHERE d.id = k.chunkable_id AND d.deleted_at IS NULL AND coalesce(json_extract(d.metadata, '$.catalog.active'), 1)=1 AND (? IS NULL OR d.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))))) OR (k.chunkable_type = 'note' AND ? IS NULL AND EXISTS (SELECT 1 FROM notes n WHERE n.id = k.chunkable_id AND n.deleted_at IS NULL)))";
47613
47931
  var noteSearchOver = /* @__PURE__ */ __name((context) => {
47614
47932
  const { database } = context;
47615
47933
  const stemmerFor2 = stemmerCache();
@@ -47622,7 +47940,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
47622
47940
  const folders = folderIds?.length ? JSON.stringify(folderIds) : null;
47623
47941
  const types = source2 === void 0 ? ["document", "note"] : source2 === "file" ? ["document"] : ["note"];
47624
47942
  return {
47625
- sql: ` AND k.chunkable_type IN (${types.map(() => "?").join(", ")}) AND ${LIVE2}`,
47943
+ sql: ` AND k.chunkable_type IN (${types.map(() => "?").join(", ")}) AND ${LIVE4}`,
47626
47944
  params: [...types, folders, folders, withInternal ? null : folders]
47627
47945
  };
47628
47946
  }, "live");
@@ -47649,11 +47967,17 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
47649
47967
  }
47650
47968
  return texts2.get(owner);
47651
47969
  }, "textOf");
47652
- return database.prepare(`SELECT k.content_hash AS hash, min(k.chunkable_type || ':' || k.chunkable_id) AS owner, k.start_offset AS start, k.end_offset AS end
47970
+ return database.prepare(`SELECT k.content_hash AS hash, min(k.chunkable_type || ':' || k.chunkable_id) AS owner, k.start_offset AS start, k.end_offset AS end,
47971
+ k.position
47653
47972
  FROM chunks k
47654
47973
  WHERE k.content_hash > ?${scope3.sql}
47655
47974
  AND NOT EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ? AND v.content_hash = k.content_hash)
47656
47975
  GROUP BY k.content_hash ORDER BY k.content_hash LIMIT ?`).all(after2 ?? "", ...scope3.params, model, limit).flatMap((row2) => {
47976
+ if (Number(row2.position) === ENRICHMENT_POSITION) {
47977
+ const [type, id2] = String(row2.owner).split(":");
47978
+ const text8 = enrichmentText(database, String(type), Number(id2));
47979
+ return text8 === void 0 ? [] : [{ hash: String(row2.hash), text: text8 }];
47980
+ }
47657
47981
  const text7 = textOf7(String(row2.owner));
47658
47982
  return text7 === void 0 ? [] : [{ hash: String(row2.hash), text: text7.slice(Number(row2.start), Number(row2.end)) }];
47659
47983
  });
@@ -47761,7 +48085,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
47761
48085
  };
47762
48086
  }, "noteSearchOver");
47763
48087
 
47764
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
48088
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
47765
48089
  var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
47766
48090
  var inEventAccounts = /* @__PURE__ */ __name((event2) => searchableCopy(event2, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
47767
48091
  var EVENT_CORPUS = {
@@ -47893,7 +48217,7 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
47893
48217
  };
47894
48218
  }, "eventSearchOver");
47895
48219
 
47896
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/moment.js
48220
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/moment.js
47897
48221
  var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
47898
48222
  try {
47899
48223
  return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
@@ -47905,7 +48229,7 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
47905
48229
  }
47906
48230
  }, "calendarMoment");
47907
48231
 
47908
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
48232
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
47909
48233
  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";
47910
48234
  var iso12 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
47911
48235
  var oneOf5 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -48125,7 +48449,7 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
48125
48449
  };
48126
48450
  }, "factsStoreOver");
48127
48451
 
48128
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
48452
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
48129
48453
  var invalid5 = /* @__PURE__ */ __name((message3) => {
48130
48454
  throw new CliError("validation_error", message3);
48131
48455
  }, "invalid");
@@ -48229,7 +48553,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind4) => {
48229
48553
  return { snapshot: snapshot2, snapshotParts, previous, outcomes, create };
48230
48554
  }, "findingsCoreOver");
48231
48555
 
48232
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
48556
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
48233
48557
  var stale = /* @__PURE__ */ __name(() => {
48234
48558
  throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
48235
48559
  reason: "evidence-findings.stale"
@@ -48410,7 +48734,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
48410
48734
  };
48411
48735
  }, "evidenceFindingsStoreOver");
48412
48736
 
48413
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
48737
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
48414
48738
  var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
48415
48739
  var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
48416
48740
  rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
@@ -48463,7 +48787,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
48463
48787
  }, "forPerson")
48464
48788
  }), "involvementStoreOver");
48465
48789
 
48466
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/labelled.js
48790
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/labelled.js
48467
48791
  var LABELLED = {
48468
48792
  note: "note",
48469
48793
  document: "document",
@@ -48475,7 +48799,7 @@ var LABELLED = {
48475
48799
  account: "folder"
48476
48800
  };
48477
48801
 
48478
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
48802
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
48479
48803
  import { createHash as createHash15 } from "node:crypto";
48480
48804
  var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
48481
48805
  var id = /* @__PURE__ */ __name((value) => {
@@ -48561,7 +48885,7 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
48561
48885
  };
48562
48886
  }, "meetingProjectsStoreOver");
48563
48887
 
48564
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
48888
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
48565
48889
  var ORGANIZATIONS_QUERY = {
48566
48890
  entity: "organization",
48567
48891
  backend: "sql",
@@ -48602,7 +48926,7 @@ var REMINDERS_QUERY = {
48602
48926
  })
48603
48927
  };
48604
48928
 
48605
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/organizations.js
48929
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/organizations.js
48606
48930
  var organizationOf = /* @__PURE__ */ __name((row2) => ({
48607
48931
  id: String(row2.id),
48608
48932
  ref: `organization:${row2.id}`,
@@ -48644,7 +48968,7 @@ var organizationsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) =>
48644
48968
  }), "setOwnOrganization")
48645
48969
  }), "organizationsStoreOver");
48646
48970
 
48647
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-list.js
48971
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-list.js
48648
48972
  var KINDS2 = RELATION_KINDS.map(linkKind).join(", ");
48649
48973
  var typeOfRef = /* @__PURE__ */ __name((column2) => `substr(${column2}, 1, instr(${column2}, ':') - 1)`, "typeOfRef");
48650
48974
  var idOfRef = /* @__PURE__ */ __name((column2) => `CAST(substr(${column2}, instr(${column2}, ':') + 1) AS INTEGER)`, "idOfRef");
@@ -48769,13 +49093,13 @@ var relationListOver = /* @__PURE__ */ __name((context) => {
48769
49093
  __name(proposalItem, "proposalItem");
48770
49094
  }, "relationListOver");
48771
49095
 
48772
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-reads.js
49096
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-reads.js
48773
49097
  var relationReadsOver = /* @__PURE__ */ __name((context) => ({
48774
49098
  ...relationListOver(context),
48775
49099
  ...relationRolesOver(context)
48776
49100
  }), "relationReadsOver");
48777
49101
 
48778
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review.js
49102
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review.js
48779
49103
  var TABLES5 = { memory: "memories", fact: "facts" };
48780
49104
  var RETIRED = /* @__PURE__ */ new Set(["superseded", "reversed", "rejected", "stale"]);
48781
49105
  var DEFAULT_LIMIT = 500;
@@ -48963,16 +49287,16 @@ var sourceReviewStoreOver = /* @__PURE__ */ __name((context) => {
48963
49287
  };
48964
49288
  }, "sourceReviewStoreOver");
48965
49289
 
48966
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
49290
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
48967
49291
  import { createHash as createHash18 } from "node:crypto";
48968
49292
 
48969
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
49293
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
48970
49294
  import { createHash as createHash17 } from "node:crypto";
48971
49295
 
48972
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
49296
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
48973
49297
  import { createHash as createHash16 } from "node:crypto";
48974
49298
 
48975
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
49299
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
48976
49300
  var consolidationId = /* @__PURE__ */ __name((value, field4) => {
48977
49301
  if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
48978
49302
  throw new CliError("validation_error", `${field4} must be a positive canonical tag id`);
@@ -49023,7 +49347,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
49023
49347
  return input;
49024
49348
  }, "consolidationApplyInput");
49025
49349
 
49026
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
49350
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
49027
49351
  var receiptOf = /* @__PURE__ */ __name((row2) => ({
49028
49352
  id: String(row2.id),
49029
49353
  sourceId: String(row2.source_id),
@@ -49098,7 +49422,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
49098
49422
  }, { beforeCommit: check3 });
49099
49423
  }, "applyTagConsolidation");
49100
49424
 
49101
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
49425
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
49102
49426
  var selections = [
49103
49427
  ["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
49104
49428
  ["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
@@ -49242,7 +49566,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
49242
49566
  };
49243
49567
  }, "previewRows");
49244
49568
 
49245
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
49569
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
49246
49570
  var kinds = ["project", "tag", "topic"];
49247
49571
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
49248
49572
  if (signal?.aborted)
@@ -49506,7 +49830,7 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
49506
49830
  };
49507
49831
  }, "vocabularyStoreOver");
49508
49832
 
49509
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
49833
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
49510
49834
  var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
49511
49835
  var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
49512
49836
  var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
@@ -50052,7 +50376,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
50052
50376
  return key2.padEnd(3, "X");
50053
50377
  }, "projectKey");
50054
50378
 
50055
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
50379
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
50056
50380
  var DAY6 = 864e5;
50057
50381
  var SETTING4 = "logs_pruned_at";
50058
50382
  var LOG_RETENTION = { agentActionsMs: 90 * DAY6, botUpdatePayloadsMs: 30 * DAY6 };
@@ -50079,7 +50403,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
50079
50403
  };
50080
50404
  }, "logPruner");
50081
50405
 
50082
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/mail/findings.js
50406
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/mail/findings.js
50083
50407
  var MAIL_FINDINGS_PER_RUN = 30;
50084
50408
  var MAIL_FINDINGS_PER_SENDER = 5;
50085
50409
  var invalid7 = /* @__PURE__ */ __name((message3) => {
@@ -50218,7 +50542,7 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
50218
50542
  return invalid7(`${what} is not a reference of the kind it takes: ${text7}`);
50219
50543
  return text7;
50220
50544
  }, "reference");
50221
- const party2 = /* @__PURE__ */ __name((field4, what) => {
50545
+ const party3 = /* @__PURE__ */ __name((field4, what) => {
50222
50546
  const [given2, name, email] = [raw[field4], raw[`${field4}Name`], raw[`${field4}Email`]];
50223
50547
  if (given2 !== void 0 && name !== void 0)
50224
50548
  return invalid7(`${what} is ${field4} or ${field4}_name, not both`);
@@ -50313,7 +50637,7 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
50313
50637
  id: id2,
50314
50638
  kind: "invoice",
50315
50639
  direction: oneOf7(raw.direction, INVOICE_DIRECTIONS, "an invoice's direction"),
50316
- ...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"),
50640
+ ...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"),
50317
50641
  currency: word(raw.currency, 3),
50318
50642
  lines,
50319
50643
  ...optional2("total", raw.total, (value) => word(value, 30)),
@@ -50345,8 +50669,8 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
50345
50669
  id: id2,
50346
50670
  kind: "payment",
50347
50671
  direction: oneOf7(raw.direction, MONEY_DIRECTIONS, "a payment's direction"),
50348
- ...party2("payer", "a payment's payer"),
50349
- ...party2("payee", "a payment's payee"),
50672
+ ...party3("payer", "a payment's payer"),
50673
+ ...party3("payee", "a payment's payee"),
50350
50674
  amount: word(raw.amount, 30),
50351
50675
  currency: word(raw.currency, 3),
50352
50676
  date: word(raw.date, 10),
@@ -50362,7 +50686,7 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
50362
50686
  id: id2,
50363
50687
  kind: "order",
50364
50688
  purpose: oneOf7(raw.purpose, ORDER_PURPOSES, "an order's purpose"),
50365
- ...party2("customer", "an order's customer"),
50689
+ ...party3("customer", "an order's customer"),
50366
50690
  ...optional2("supplier", raw.supplier, (value) => reference2(value, PARTY2, "an order's supplier")),
50367
50691
  supplierName: word(raw.supplierName, 200),
50368
50692
  ...optional2("number", raw.number, (value) => word(value, 80)),
@@ -50438,7 +50762,7 @@ var checkMailFindings = /* @__PURE__ */ __name((input) => {
50438
50762
  }, "checkMailFindings");
50439
50763
  var mailFindingFingerprint = /* @__PURE__ */ __name(({ id: _id, ...finding }) => findingHash(finding), "mailFindingFingerprint");
50440
50764
 
50441
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/mail/score.js
50765
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/mail/score.js
50442
50766
  var import_disposable_email_domains_js = __toESM(require_dist(), 1);
50443
50767
  var import_tldts = __toESM(require_cjs(), 1);
50444
50768
  var FREE_MAIL = /* @__PURE__ */ new Set([
@@ -50468,8 +50792,7 @@ var FREE_MAIL = /* @__PURE__ */ new Set([
50468
50792
  ]);
50469
50793
  var DAY_MS2 = 24 * 60 * 60 * 1e3;
50470
50794
 
50471
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/orders.js
50472
- var MAX_LINES2 = 500;
50795
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/orders.js
50473
50796
  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";
50474
50797
  var orderOperationsOver = /* @__PURE__ */ __name((context) => {
50475
50798
  const { database, now: now2 } = context;
@@ -50514,9 +50837,6 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
50514
50837
  ...orderOf2(row2),
50515
50838
  lines: row2.currency == null ? [] : moneyLines.shownLines("order", Number(row2.id), String(row2.currency))
50516
50839
  }), "detailOf");
50517
- const retotal = /* @__PURE__ */ __name((orderId) => {
50518
- 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);
50519
- }, "retotal");
50520
50840
  const mayChangeLines = /* @__PURE__ */ __name((row2, by) => {
50521
50841
  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");
50522
50842
  if (row2.review === "rejected" || row2.deleted_at != null)
@@ -50547,19 +50867,19 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
50547
50867
  refuse("a sale names its customer, a person: or organization:", "order.field");
50548
50868
  const number3 = text4(input.number, "an order's number", 80);
50549
50869
  const lines = input.lines ?? [];
50550
- if (!Array.isArray(lines) || lines.length > MAX_LINES2)
50551
- refuse(`an order has at most ${MAX_LINES2} lines`, "order.field");
50870
+ if (!Array.isArray(lines) || lines.length > MAX_LINES)
50871
+ refuse(`an order has at most ${MAX_LINES} lines`, "order.field");
50552
50872
  if (lines.length && input.currency === void 0)
50553
50873
  refuse("an order with lines names its currency", "order.total");
50554
50874
  if (!lines.length && input.total === void 0 !== (input.currency === void 0))
50555
50875
  refuse("an order's amount and currency come together", "order.field");
50556
50876
  const currency2 = input.currency === void 0 ? null : currencyOf(input.currency);
50557
- const priced2 = currency2 === null ? [] : moneyLines.linesOf("order", lines, currency2);
50558
- const sum = priced2.reduce((all2, line) => all2 + line.amount, 0);
50877
+ const priced = currency2 === null ? [] : moneyLines.linesOf("order", lines, currency2);
50878
+ const sum = priced.reduce((all2, line) => all2 + line.amount, 0);
50559
50879
  const given2 = currency2 === null || input.total === void 0 ? null : minorUnits(input.total, currency2, "an order's amount");
50560
- if (priced2.length && given2 !== null && given2 !== sum)
50880
+ if (priced.length && given2 !== null && given2 !== sum)
50561
50881
  refuse(`the order's total ${moneyLabel(given2, currency2)} is not the sum of its lines, ${moneyLabel(sum, currency2)}`, "order.total");
50562
- const total = priced2.length ? sum : given2;
50882
+ const total = priced.length ? sum : given2;
50563
50883
  if (total !== null && total < 0)
50564
50884
  refuse("an order's amount is 0 or more", "money.amount");
50565
50885
  const orderDate = isoDate(input.orderDate, "an order's date");
@@ -50568,8 +50888,8 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
50568
50888
  const id2 = write(database, () => {
50569
50889
  const customer = partyThing(input.customer, "the customer") ?? ownerPerson(database);
50570
50890
  const supplier = partyThing(input.supplier, "the supplier") ?? (direction === "sale" ? ownerPerson(database) : void 0);
50571
- const party2 = partyOf(supplier?.type, supplier?.id);
50572
- const supplierName = named2 ?? party2?.name ?? (party2?.owner ? "owner" : null);
50891
+ const party3 = partyOf(supplier?.type, supplier?.id);
50892
+ const supplierName = named2 ?? party3?.name ?? (party3?.owner ? "owner" : null);
50573
50893
  if (supplierName === null)
50574
50894
  return refuse("an order names its shop or supplier", "order.field");
50575
50895
  if (number3 !== null && ordersOfShop(database, supplierName, number3).some((one2) => held === void 0 || one2.id !== held.id))
@@ -50583,12 +50903,12 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
50583
50903
  const id3 = Number(held.id);
50584
50904
  database.prepare("DELETE FROM order_lines WHERE order_id = ?").run(id3);
50585
50905
  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);
50586
- moneyLines.insertLines("order", id3, priced2, 1, at);
50906
+ moneyLines.insertLines("order", id3, priced, 1, at);
50587
50907
  return id3;
50588
50908
  }
50589
50909
  const by = written(input);
50590
50910
  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);
50591
- moneyLines.insertLines("order", made, priced2, 1, at);
50911
+ moneyLines.insertLines("order", made, priced, 1, at);
50592
50912
  keepEvidence("order", made, by);
50593
50913
  return made;
50594
50914
  });
@@ -50635,13 +50955,10 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
50635
50955
  mayChangeLines(row2, by);
50636
50956
  if (row2.currency == null)
50637
50957
  refuse(`order:${row2.id} has no currency; a line needs one`, "order.total");
50638
- const [priced2] = moneyLines.linesOf("order", [line], String(row2.currency));
50958
+ const [priced] = moneyLines.linesOf("order", [line], String(row2.currency));
50639
50959
  write(database, () => {
50640
- const last = Number(database.prepare("SELECT coalesce(max(position), 0) AS n FROM order_lines WHERE order_id = ?").get(Number(row2.id))?.n);
50641
- if (last >= MAX_LINES2)
50642
- refuse(`an order has at most ${MAX_LINES2} lines`, "order.field");
50643
- moneyLines.insertLines("order", Number(row2.id), [priced2], last + 1, now2());
50644
- retotal(Number(row2.id));
50960
+ moneyLines.appendLine("order", Number(row2.id), priced, now2());
50961
+ moneyLines.retotal("order", Number(row2.id), now2());
50645
50962
  });
50646
50963
  return detailOf(rowOf2(`order:${row2.id}`));
50647
50964
  }, "addLine"),
@@ -50649,13 +50966,8 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
50649
50966
  const row2 = rowOf2(reference2);
50650
50967
  mayChangeLines(row2, by);
50651
50968
  write(database, () => {
50652
- const lines = Number(database.prepare("SELECT count(*) AS n FROM order_lines WHERE order_id = ?").get(Number(row2.id))?.n);
50653
- const gone = database.prepare("DELETE FROM order_lines WHERE order_id = ? AND position = ?").run(Number(row2.id), position2);
50654
- if (gone.changes === 0)
50655
- throw new CliError("not_found", `order:${row2.id} has no line ${position2}`, { reason: "order.no-line" });
50656
- if (lines === 1)
50657
- refuse(`line ${position2} is the last of order:${row2.id}; reject or cancel the order instead`, "order.line");
50658
- retotal(Number(row2.id));
50969
+ moneyLines.deleteLine("order", Number(row2.id), position2);
50970
+ moneyLines.retotal("order", Number(row2.id), now2());
50659
50971
  });
50660
50972
  return detailOf(rowOf2(`order:${row2.id}`));
50661
50973
  }, "removeLine")
@@ -50688,7 +51000,7 @@ var ordersStoreOver = /* @__PURE__ */ __name((context) => {
50688
51000
  };
50689
51001
  }, "ordersStoreOver");
50690
51002
 
50691
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-findings.js
51003
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-findings.js
50692
51004
  var stale2 = /* @__PURE__ */ __name(() => {
50693
51005
  throw new CliError("validation_error", "mail findings cite mail that changed since it was read; stage a new batch", {
50694
51006
  reason: "mail-findings.stale"
@@ -51145,7 +51457,7 @@ ${evidence.join("\n")}`, agent);
51145
51457
  };
51146
51458
  }, "mailFindingsStoreOver");
51147
51459
 
51148
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
51460
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
51149
51461
  var stale3 = /* @__PURE__ */ __name(() => {
51150
51462
  throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
51151
51463
  reason: "meeting-findings.stale"
@@ -51313,9 +51625,9 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
51313
51625
  };
51314
51626
  }, "meetingFindingsStoreOver");
51315
51627
 
51316
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
51628
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
51317
51629
  var RANK_BATCH = 512;
51318
- 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";
51630
+ var LIVE5 = "FROM chunks k JOIN meeting_transcripts t ON k.chunkable_type = 'meeting_transcript' AND t.id = k.chunkable_id JOIN meetings m ON m.id = t.meeting_id WHERE m.account_id = ? AND m.deleted_at IS NULL AND t.deleted_at IS NULL AND t.superseded_at IS NULL";
51319
51631
  var limitOf2 = /* @__PURE__ */ __name((value, name, max = 1e3) => {
51320
51632
  positiveReadInteger(value, name);
51321
51633
  if (value > max)
@@ -51401,7 +51713,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
51401
51713
  throw new CliError("validation_error", "Vector save exceeds its batch or 16 MiB payload budget");
51402
51714
  return write(context.database, () => {
51403
51715
  const unique2 = new Map(rows.map((row2) => [row2.hash, row2]));
51404
- 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()]));
51716
+ const current = context.database.prepare(`SELECT DISTINCT k.content_hash ${LIVE5} AND k.content_hash IN (SELECT value FROM json_each(?))`).all(input.accountId, JSON.stringify([...unique2.keys()]));
51405
51717
  const available = new Set(current.map((row2) => String(row2.content_hash)));
51406
51718
  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));
51407
51719
  input.signal?.throwIfAborted();
@@ -51458,7 +51770,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
51458
51770
  if (input.afterHash !== void 0 && !/^[a-f0-9]{64}$/.test(input.afterHash))
51459
51771
  throw new CliError("validation_error", "afterHash must be a content hash");
51460
51772
  return read(context.database, () => {
51461
- 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);
51773
+ const rows = context.database.prepare(`SELECT k.* ${LIVE5} AND k.content_hash > ? AND NOT EXISTS (SELECT 1 FROM embeddings e WHERE e.model=? AND e.content_hash=k.content_hash) GROUP BY k.content_hash ORDER BY k.content_hash LIMIT ?`).all(input.accountId, input.afterHash ?? "", model, limit + 1);
51462
51774
  const load = textLoader(context, input);
51463
51775
  const items = rows.slice(0, limit).map((row2) => ({
51464
51776
  hash: String(row2.content_hash),
@@ -51478,13 +51790,13 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
51478
51790
  if (input.afterChunkId !== void 0)
51479
51791
  positiveReadInteger(input.afterChunkId, "afterChunkId");
51480
51792
  return read(context.database, () => {
51481
- 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 ?`;
51793
+ const selectedSql = `${LIVE5.replace(" WHERE", " JOIN embeddings e ON e.content_hash=k.content_hash AND e.model=? WHERE")} AND k.id>? ORDER BY k.id LIMIT ?`;
51482
51794
  const params = [model, input.accountId, input.afterChunkId ?? 0, maxChunks + 1];
51483
51795
  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);
51484
51796
  if (Number(preflight?.bad ?? 0) || Number(preflight?.bytes ?? 0) > 16 * 1024 * 1024)
51485
51797
  throw new CliError("validation_error", "Stored vectors exceed the dimension or 16 MiB scan budget");
51486
51798
  input.signal?.throwIfAborted();
51487
- 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);
51799
+ const rows = context.database.prepare(`SELECT k.*,e.dims,e.vector ${LIVE5.replace(" WHERE", " JOIN embeddings e ON e.content_hash=k.content_hash AND e.model=? WHERE")} AND k.id>? ORDER BY k.id LIMIT ?`).all(model, input.accountId, input.afterChunkId ?? 0, maxChunks + 1);
51488
51800
  const selected = rows.slice(0, maxChunks);
51489
51801
  const load = textLoader(context, input);
51490
51802
  const items = selected.map((row2) => {
@@ -51579,12 +51891,12 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
51579
51891
  async status(input) {
51580
51892
  scope2(input);
51581
51893
  modelOf(input.model);
51582
- 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);
51894
+ const row2 = context.database.prepare(`SELECT count(DISTINCT k.content_hash) AS chunks,count(DISTINCT CASE WHEN EXISTS (SELECT 1 FROM embeddings e WHERE e.model=? AND e.content_hash=k.content_hash) THEN k.content_hash END) AS embedded ${LIVE5}`).get(input.model, input.accountId);
51583
51895
  return { chunks: Number(row2?.chunks ?? 0), embedded: Number(row2?.embedded ?? 0) };
51584
51896
  }
51585
51897
  }), "meetingVectorsOver");
51586
51898
 
51587
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
51899
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
51588
51900
  var OTHER_SOURCES = ["document", "note", "email"];
51589
51901
  var TEXTS = {
51590
51902
  document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
@@ -51685,7 +51997,7 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
51685
51997
  };
51686
51998
  }, "sourceMentionStoreOver");
51687
51999
 
51688
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/money-transactions.js
52000
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/money-transactions.js
51689
52001
  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";
51690
52002
  var MAX_SPLITS = 100;
51691
52003
  var transactionOperationsOver = /* @__PURE__ */ __name((context) => {
@@ -51916,11 +52228,11 @@ var transactionsStoreOver = /* @__PURE__ */ __name((context) => {
51916
52228
  };
51917
52229
  }, "transactionsStoreOver");
51918
52230
 
51919
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
52231
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
51920
52232
  import { accessSync, constants, existsSync, mkdirSync as mkdirSync2, statSync, writeFileSync as writeFileSync2 } from "node:fs";
51921
52233
  import { dirname as dirname2 } from "node:path";
51922
52234
 
51923
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
52235
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
51924
52236
  import { readFileSync as readFileSync3 } from "node:fs";
51925
52237
  var CLIENTS_SETTING = "clients";
51926
52238
  var coreVersion = (() => {
@@ -51978,7 +52290,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
51978
52290
  return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
51979
52291
  }, "refusalAdvice");
51980
52292
 
51981
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
52293
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
51982
52294
  var GENERATED = [
51983
52295
  {
51984
52296
  "name": "20261010184427_initial",
@@ -53188,10 +53500,24 @@ WHERE json_type(params, '$.selection') = 'object';`
53188
53500
  "CREATE TRIGGER payment_allocations_refund_bd BEFORE DELETE ON payment_allocations\n WHEN (SELECT refund_of IS NOT NULL AND review = 'confirmed' AND deleted_at IS NULL FROM payments WHERE id = old.payment_id)\n AND (SELECT review FROM invoices WHERE id = old.invoice_id) <> 'rejected'\n AND (SELECT coalesce(sum(CASE WHEN np.refund_of IS NULL THEN na.amount ELSE -na.amount END), 0) FROM payment_allocations na JOIN payments np ON np.id = na.payment_id WHERE na.invoice_id = old.invoice_id AND np.review = 'confirmed' AND np.deleted_at IS NULL) + old.amount\n > (SELECT total FROM invoices WHERE id = old.invoice_id) BEGIN\n SELECT RAISE(ABORT, 'payment_allocations: taking a refund''s share back would pay the invoice beyond its total');\nEND;",
53189
53501
  "-- A void invoice keeps what was settled on it; a rejected one lets its allocations go, as reject sets review first.\nCREATE TRIGGER payment_allocations_void_bd BEFORE DELETE ON payment_allocations\n WHEN (SELECT status = 'void' AND review <> 'rejected' FROM invoices WHERE id = old.invoice_id) BEGIN\n SELECT RAISE(ABORT, 'payment_allocations: a void invoice keeps its allocations');\nEND;"
53190
53502
  ]
53503
+ },
53504
+ {
53505
+ "name": "20261108104659_version-58-enrichments",
53506
+ "statements": [
53507
+ "CREATE TABLE `enrichments` (\n `subject_type` text NOT NULL,\n `subject_id` integer NOT NULL,\n `source_hash` text NOT NULL,\n `provider` text NOT NULL,\n `model` text NOT NULL,\n `text` text NOT NULL,\n `tokens` integer NOT NULL,\n `created_at` integer NOT NULL,\n CONSTRAINT `enrichments_pk` PRIMARY KEY(`subject_type`, `subject_id`)\n);"
53508
+ ]
53509
+ },
53510
+ {
53511
+ "name": "20261108104701_version-58-enrichments-deletes",
53512
+ "statements": [
53513
+ "CREATE TRIGGER enrichments_document_gone AFTER DELETE ON documents BEGIN\n DELETE FROM enrichments WHERE subject_type = 'document' AND subject_id = OLD.id;\nEND;",
53514
+ "CREATE TRIGGER enrichments_note_gone AFTER DELETE ON notes BEGIN\n DELETE FROM enrichments WHERE subject_type = 'note' AND subject_id = OLD.id;\nEND;",
53515
+ "CREATE TRIGGER enrichments_email_gone AFTER DELETE ON emails BEGIN\n DELETE FROM enrichments WHERE subject_type = 'email' AND subject_id = OLD.id;\n DELETE FROM chunks WHERE chunkable_type = 'email_enrichment' AND chunkable_id = OLD.id;\nEND;"
53516
+ ]
53191
53517
  }
53192
53518
  ];
53193
53519
 
53194
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/rollback-copy.js
53520
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/rollback-copy.js
53195
53521
  import { mkdirSync, rmSync, statfsSync, writeFileSync } from "node:fs";
53196
53522
  import { basename, dirname, join as join2, parse } from "node:path";
53197
53523
  var DERIVED = /(_fts|_words|_stems|_trigrams|_pending)$|^(embeddings|chunks|chunk_messages|mentions|involvements|search_terms)$|^vector_index/;
@@ -53424,7 +53750,7 @@ var rollBack = /* @__PURE__ */ __name((database, path) => {
53424
53750
  return { ...result, foreignKeyViolations };
53425
53751
  }, "rollBack");
53426
53752
 
53427
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
53753
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
53428
53754
  var V31_TABLES = [
53429
53755
  "accounts",
53430
53756
  "account_identities",
@@ -53542,7 +53868,9 @@ var MANIFEST = [
53542
53868
  { name: "20261107162448_version-56-relationship-links-history", version: 56, minCompatible: 56, tables: V56_TABLES },
53543
53869
  { name: "20261107163245_version-56-relationship-links-key", version: 56, minCompatible: 56, tables: V56_TABLES },
53544
53870
  { name: "20261108010753_version-57-business", version: 57, minCompatible: 56 },
53545
- { name: "20261108010754_version-57-business-rules", version: 57, minCompatible: 56 }
53871
+ { name: "20261108010754_version-57-business-rules", version: 57, minCompatible: 56 },
53872
+ { name: "20261108104659_version-58-enrichments", version: 58, minCompatible: 56 },
53873
+ { name: "20261108104701_version-58-enrichments-deletes", version: 58, minCompatible: 56 }
53546
53874
  ];
53547
53875
  var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated = GENERATED) => {
53548
53876
  const migrations = [];
@@ -53578,7 +53906,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
53578
53906
  return migrations;
53579
53907
  }, "generatedMigrations");
53580
53908
 
53581
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/migrations.js
53909
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/migrations.js
53582
53910
  var MIGRATIONS = generatedMigrations();
53583
53911
  var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
53584
53912
  version INTEGER PRIMARY KEY,
@@ -53657,17 +53985,17 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
53657
53985
  }
53658
53986
  }, "migrate");
53659
53987
 
53660
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
53988
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
53661
53989
  var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
53662
- 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 ?");
53663
- if (pending2.get(0, 1) === void 0)
53990
+ 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 ?");
53991
+ if (pending.get(0, 1) === void 0)
53664
53992
  return 0;
53665
53993
  const fill = database.prepare("UPDATE meetings SET join_key = ? WHERE id = ?");
53666
53994
  let filled2 = 0;
53667
53995
  let after2 = 0;
53668
53996
  for (; ; ) {
53669
53997
  const rows = writeBatch(database, () => {
53670
- const page3 = pending2.all(after2, batch);
53998
+ const page3 = pending.all(after2, batch);
53671
53999
  for (const row2 of page3)
53672
54000
  fill.run(joinKeyOf(String(row2.join_url)) ?? "", Number(row2.id));
53673
54001
  return page3;
@@ -53679,7 +54007,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
53679
54007
  }
53680
54008
  }, "fillJoinKeys");
53681
54009
 
53682
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
54010
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
53683
54011
  var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
53684
54012
  refuseOwnerStoreInTests(path);
53685
54013
  const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
@@ -53693,8 +54021,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
53693
54021
  }, "openSqlite");
53694
54022
  var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
53695
54023
  quietSqliteWarning();
53696
- const { drizzle } = await import("./node-IVU33RL7.js");
53697
- const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-SIH5BEW2.js");
54024
+ const { drizzle } = await import("./node-OFICOKX3.js");
54025
+ const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-DNBTDOXD.js");
53698
54026
  const client = await nodeClient(path, { readOnly });
53699
54027
  try {
53700
54028
  return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
@@ -53704,8 +54032,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
53704
54032
  }
53705
54033
  }, "openUnderNode");
53706
54034
  var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
53707
- const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-D45NSDM3.js");
53708
- const { drizzle } = await import("./bun-OXZYIA3R.js");
54035
+ const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-2OIVV3LS.js");
54036
+ const { drizzle } = await import("./bun-UT7GNTPV.js");
53709
54037
  const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
53710
54038
  try {
53711
54039
  return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
@@ -53715,7 +54043,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
53715
54043
  }
53716
54044
  }, "openUnderBun");
53717
54045
 
53718
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-facts.js
54046
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-facts.js
53719
54047
  var PAYMENT_FACTS_TO_MOVE = "payment_facts_to_move";
53720
54048
  var paymentOf = /* @__PURE__ */ __name((metadata3) => {
53721
54049
  try {
@@ -53783,7 +54111,7 @@ var movePaymentFacts = /* @__PURE__ */ __name((context) => {
53783
54111
  });
53784
54112
  }, "movePaymentFacts");
53785
54113
 
53786
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
54114
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
53787
54115
  var readCompatibility = /* @__PURE__ */ __name((database, command) => {
53788
54116
  const ours = MIGRATIONS.at(-1)?.version ?? 0;
53789
54117
  if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
@@ -53801,7 +54129,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
53801
54129
  throw new CliError("configuration_error", `The store needs schema ${MIGRATIONS.at(-1)?.version ?? 0} maintenance before a read-only open`);
53802
54130
  }, "assertReadCompatible");
53803
54131
 
53804
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/suggested-links.js
54132
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/suggested-links.js
53805
54133
  var SUGGESTED_LINKS_TO_MOVE = "suggested_links_to_move";
53806
54134
  var proposerOf2 = /* @__PURE__ */ __name((provenance2) => {
53807
54135
  if (provenance2?.startsWith("rule:"))
@@ -53847,7 +54175,7 @@ var moveSuggestedLinks = /* @__PURE__ */ __name((database, now2) => {
53847
54175
  });
53848
54176
  }, "moveSuggestedLinks");
53849
54177
 
53850
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/test-accounts.js
54178
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/test-accounts.js
53851
54179
  var TEST_ACCOUNTS_TO_PURGE = "test_accounts_to_purge";
53852
54180
  var TEST_PROVIDER = "chat";
53853
54181
  var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
@@ -53868,7 +54196,7 @@ var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
53868
54196
  }
53869
54197
  }, "purgeTestAccounts");
53870
54198
 
53871
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
54199
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
53872
54200
  var BACKFILL_ON_OPEN = 5e3;
53873
54201
  var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
53874
54202
  var createWritable = /* @__PURE__ */ __name((file) => {
@@ -53941,8 +54269,8 @@ var openStoreContext = /* @__PURE__ */ __name(async (options = {}) => {
53941
54269
  moveSuggestedLinks(database, now2);
53942
54270
  movePaymentFacts({ ...opened, now: now2, decisions: decisions2 });
53943
54271
  purgeTestAccounts({ ...opened, now: now2, decisions: decisions2 }, warn);
53944
- const pending2 = pendingNormalization(database);
53945
- if (pending2 > 0 && pending2 <= BACKFILL_ON_OPEN)
54272
+ const pending = pendingNormalization(database);
54273
+ if (pending > 0 && pending <= BACKFILL_ON_OPEN)
53946
54274
  backfillNormalized(database);
53947
54275
  followDefaultStemmers(database, now2);
53948
54276
  const stemming = stemsState(database);
@@ -53966,7 +54294,7 @@ var openStoreContext = /* @__PURE__ */ __name(async (options = {}) => {
53966
54294
  }
53967
54295
  }, "openStoreContext");
53968
54296
 
53969
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/products.js
54297
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/products.js
53970
54298
  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";
53971
54299
  var productOperationsOver = /* @__PURE__ */ __name((context) => {
53972
54300
  const { database, now: now2 } = context;
@@ -54072,13 +54400,13 @@ var productsStoreOver = /* @__PURE__ */ __name((context) => {
54072
54400
  };
54073
54401
  }, "productsStoreOver");
54074
54402
 
54075
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
54403
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
54076
54404
  import { createHash as createHash20 } from "node:crypto";
54077
54405
 
54078
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
54406
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
54079
54407
  import { createHash as createHash19 } from "node:crypto";
54080
54408
 
54081
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
54409
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
54082
54410
  var text5 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
54083
54411
  var ref = text5(2048);
54084
54412
  var timestamp2 = pipe(number(), safeInteger(), minValue(0));
@@ -54148,7 +54476,7 @@ var projectAnnotationsSchema = strictObject({
54148
54476
  }))
54149
54477
  });
54150
54478
 
54151
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
54479
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
54152
54480
  var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
54153
54481
  var invalid10 = /* @__PURE__ */ __name((field4) => {
54154
54482
  throw new CliError("validation_error", `invalid project annotations.${field4}`);
@@ -54281,7 +54609,7 @@ var projectAnnotationsFingerprint = /* @__PURE__ */ __name((json3) => {
54281
54609
  return createHash19("sha256").update(JSON.stringify(normalized)).digest("hex");
54282
54610
  }, "projectAnnotationsFingerprint");
54283
54611
 
54284
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
54612
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
54285
54613
  var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
54286
54614
  var ref2 = pipe(string(), minLength(1), maxLength(2048));
54287
54615
  var targetSchema = strictObject({
@@ -54388,7 +54716,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
54388
54716
  }, "planBoundProjectAnnotations");
54389
54717
  var planProjectAnnotations = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotations(json3), projectAnnotationsFingerprint(json3), target, bindings), "planProjectAnnotations");
54390
54718
 
54391
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
54719
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
54392
54720
  import { createHash as createHash21 } from "node:crypto";
54393
54721
  var text6 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
54394
54722
  var timestamp3 = pipe(number(), safeInteger(), minValue(0));
@@ -54482,7 +54810,7 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
54482
54810
  })).digest("hex");
54483
54811
  }, "projectAnnotationSnapshotFingerprint");
54484
54812
 
54485
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
54813
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
54486
54814
  var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
54487
54815
  if (!request || typeof request !== "object" || Array.isArray(request))
54488
54816
  throw new CliError("validation_error", "project annotation request is required");
@@ -54499,7 +54827,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
54499
54827
  return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
54500
54828
  }, "projectAnnotationRequest");
54501
54829
 
54502
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
54830
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
54503
54831
  var SnapshotBudget = class {
54504
54832
  static {
54505
54833
  __name(this, "SnapshotBudget");
@@ -54525,13 +54853,13 @@ var SnapshotBudget = class {
54525
54853
  }
54526
54854
  };
54527
54855
 
54528
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
54856
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
54529
54857
  import { createHash as createHash23 } from "node:crypto";
54530
54858
 
54531
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
54859
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
54532
54860
  var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
54533
54861
 
54534
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
54862
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
54535
54863
  import { createHash as createHash22 } from "node:crypto";
54536
54864
  var invalid12 = /* @__PURE__ */ __name(() => {
54537
54865
  throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
@@ -54674,7 +55002,7 @@ var ProjectSnapshotSources = class {
54674
55002
  }
54675
55003
  };
54676
55004
 
54677
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
55005
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
54678
55006
  var unsupported = /* @__PURE__ */ __name(() => {
54679
55007
  throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
54680
55008
  }, "unsupported");
@@ -54852,7 +55180,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, bu
54852
55180
  return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
54853
55181
  }), "projectAnnotationSnapshot");
54854
55182
 
54855
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
55183
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
54856
55184
  var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, manifest, bindings, budget) => read(database, () => {
54857
55185
  const current = projectAnnotationSnapshot(database, projectId2, budget).snapshot;
54858
55186
  const sources = new ProjectSnapshotSources(database, budget);
@@ -54914,7 +55242,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, ma
54914
55242
  };
54915
55243
  }), "previewAnnotationSnapshot");
54916
55244
 
54917
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
55245
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
54918
55246
  var metadataOf2 = /* @__PURE__ */ __name((database, link3, to) => {
54919
55247
  const provenance2 = link3.provenance === null ? {} : { provenance: link3.provenance };
54920
55248
  if (link3.kind === "evidence" && to)
@@ -54981,7 +55309,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, sna
54981
55309
  return mappings;
54982
55310
  }, "restoreAnnotationRecords");
54983
55311
 
54984
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
55312
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
54985
55313
  var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
54986
55314
  async preview(request) {
54987
55315
  const { snapshot: snapshot2, projectId: projectId2 } = projectAnnotationRequest(request);
@@ -55011,7 +55339,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
55011
55339
  }
55012
55340
  }), "projectAnnotationStoreOver");
55013
55341
 
55014
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projection.js
55342
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projection.js
55015
55343
  var IMPORTER = { bot: "import" };
55016
55344
  var importersProposal = /* @__PURE__ */ __name((entity) => entity.review === "proposed" && entity.author.type === "bot" && entity.author.name === IMPORTER.bot, "importersProposal");
55017
55345
  var codeOf = /* @__PURE__ */ __name((error) => {
@@ -55056,7 +55384,7 @@ var moneyLinesOf = /* @__PURE__ */ __name((projection, list2) => (Array.isArray(
55056
55384
  };
55057
55385
  }), "moneyLinesOf");
55058
55386
 
55059
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-relations.js
55387
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/record-relations.js
55060
55388
  var isDerived = /* @__PURE__ */ __name((role) => role.startsWith("fields."), "isDerived");
55061
55389
  var recordRelationsOver = /* @__PURE__ */ __name(({ database }) => {
55062
55390
  const sql2 = /* @__PURE__ */ __name((text7) => database.prepare(text7), "sql");
@@ -55127,7 +55455,7 @@ var recordRelationsOver = /* @__PURE__ */ __name(({ database }) => {
55127
55455
  return { entityRef, relatedOf, storedRelations, relate, missingOf };
55128
55456
  }, "recordRelationsOver");
55129
55457
 
55130
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-remap.js
55458
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/record-remap.js
55131
55459
  var recordRemapOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
55132
55460
  const pointedAt = /* @__PURE__ */ __name((type, id2) => {
55133
55461
  for (const { table, pointer } of pointerPairs(database))
@@ -55181,7 +55509,7 @@ var recordRemapOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
55181
55509
  return { pointedAt, remap };
55182
55510
  }, "recordRemapOver");
55183
55511
 
55184
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-run.js
55512
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/record-run.js
55185
55513
  var runs = 0;
55186
55514
  var PAGE = 500;
55187
55515
  var recordRunOver = /* @__PURE__ */ __name((context, writes) => {
@@ -55341,7 +55669,7 @@ var waitingPointer = /* @__PURE__ */ __name((index2, missing4) => {
55341
55669
  return pointerOf("records", index2, "fields", key2);
55342
55670
  }, "waitingPointer");
55343
55671
 
55344
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-matching.js
55672
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/record-matching.js
55345
55673
  var valuesOf = /* @__PURE__ */ __name((value) => (Array.isArray(value) ? value : [value]).filter((one2) => typeof one2 === "string"), "valuesOf");
55346
55674
  var SCHEME2 = /^(email|domain|tax-id:[a-z]{2}|registration:[a-z]{2})$/;
55347
55675
  var ORG_EMAIL = "org-email";
@@ -55453,7 +55781,7 @@ var matchOf = /* @__PURE__ */ __name((context, type, ids) => {
55453
55781
  return { outcome: "ambiguous", ids: found2, reason: "record.separated" };
55454
55782
  return { outcome: "one", id: id2 };
55455
55783
  }, "matchOf");
55456
- var IMPORT = "import";
55784
+ var IMPORT2 = "import";
55457
55785
  var importedIdentity = /* @__PURE__ */ __name(({ database, now: now2 }, identity) => {
55458
55786
  const held = database.prepare("SELECT id FROM identities WHERE provider = ? AND external_id = ?").get(identity.provider, identity.externalId);
55459
55787
  if (held)
@@ -55468,8 +55796,8 @@ var linkToPerson = /* @__PURE__ */ __name((context, person2, identity, source2)
55468
55796
  if (identitySeparated(context, identity, person2))
55469
55797
  return;
55470
55798
  const at = now2();
55471
- 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);
55472
- 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);
55799
+ 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);
55800
+ 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);
55473
55801
  }, "linkToPerson");
55474
55802
  var addIdentifiers = /* @__PURE__ */ __name((context, type, id2, ids, name, source2) => {
55475
55803
  const { database, now: now2 } = context;
@@ -55487,7 +55815,7 @@ var addIdentifiers = /* @__PURE__ */ __name((context, type, id2, ids, name, sour
55487
55815
  for (const { provider, value } of ids.organization) {
55488
55816
  const identity = importedIdentity(context, { provider, externalId: value, name });
55489
55817
  const at = now2();
55490
- 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);
55818
+ 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);
55491
55819
  }
55492
55820
  }, "addIdentifiers");
55493
55821
  var createEntity = /* @__PURE__ */ __name((context, type, fields4, ids, related, source2, externalId) => {
@@ -55529,7 +55857,7 @@ var renameMade = /* @__PURE__ */ __name(({ database, now: now2 }, type, id2, nam
55529
55857
  ]);
55530
55858
  }, "renameMade");
55531
55859
 
55532
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-direct.js
55860
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-direct.js
55533
55861
  var productFields = /* @__PURE__ */ __name((fields4) => ({
55534
55862
  name: given(fields4, "name"),
55535
55863
  unit: given(fields4, "unit"),
@@ -55652,7 +55980,7 @@ var DIRECT_PROJECTORS = {
55652
55980
  lead: dealProjector("lead")
55653
55981
  };
55654
55982
 
55655
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-money.js
55983
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-money.js
55656
55984
  var allocatedByOthers = /* @__PURE__ */ __name((context, paymentId) => {
55657
55985
  const importer = authorActor(context, IMPORTER).actor;
55658
55986
  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;
@@ -55862,7 +56190,7 @@ var MONEY_PROJECTORS = {
55862
56190
  }
55863
56191
  };
55864
56192
 
55865
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-phone.js
56193
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-phone.js
55866
56194
  var CALLS_CALENDAR = "calls";
55867
56195
  var importOnly = /* @__PURE__ */ __name((source2, type) => {
55868
56196
  if (!isImportedProvider(source2.provider))
@@ -56037,7 +56365,7 @@ var PHONE_PROJECTORS = {
56037
56365
  }
56038
56366
  };
56039
56367
 
56040
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors.js
56368
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors.js
56041
56369
  var RECORD_PROJECTORS = {
56042
56370
  ...MONEY_PROJECTORS,
56043
56371
  ...DIRECT_PROJECTORS,
@@ -56047,7 +56375,7 @@ var RECORD_PROJECTORS = {
56047
56375
  project: null
56048
56376
  };
56049
56377
 
56050
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-settling.js
56378
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/record-settling.js
56051
56379
  var recordSettlingOver = /* @__PURE__ */ __name(({ database }, finance) => {
56052
56380
  const sql2 = /* @__PURE__ */ __name((text7) => database.prepare(text7), "sql");
56053
56381
  const freeOn = /* @__PURE__ */ __name((invoice, payment) => {
@@ -56109,7 +56437,7 @@ var recordSettlingOver = /* @__PURE__ */ __name(({ database }, finance) => {
56109
56437
  return { settle, checkShares };
56110
56438
  }, "recordSettlingOver");
56111
56439
 
56112
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-stamps.js
56440
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/record-stamps.js
56113
56441
  import { createHash as createHash24 } from "node:crypto";
56114
56442
  var VOLATILE = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "metadata"]);
56115
56443
  var content = /* @__PURE__ */ __name((row2) => row2 === void 0 ? null : Object.fromEntries(Object.entries(row2).filter(([column2]) => !VOLATILE.has(column2))), "content");
@@ -56125,7 +56453,7 @@ var importStampsOver = /* @__PURE__ */ __name(({ database }) => {
56125
56453
  return { stamp, untouched };
56126
56454
  }, "importStampsOver");
56127
56455
 
56128
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/subscriptions.js
56456
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/subscriptions.js
56129
56457
  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";
56130
56458
  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";
56131
56459
  var PRICE_REF = /^subscription_price:([1-9]\d{0,15})$/;
@@ -56223,9 +56551,9 @@ var subscriptionOperationsOver = /* @__PURE__ */ __name((context) => {
56223
56551
  if (settled === "cancelled" && cancelled3 === null)
56224
56552
  refuse("a cancelled subscription has the day it was cancelled", "subscription.field");
56225
56553
  const owner = ownerPerson(database);
56226
- 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");
56227
- const supplier = party2(fields4.supplier, "supplier_type", "supplier_id", direction === "receivable", "the supplier");
56228
- const customer = party2(fields4.customer, "customer_type", "customer_id", direction === "payable", "the customer");
56554
+ 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");
56555
+ const supplier = party3(fields4.supplier, "supplier_type", "supplier_id", direction === "receivable", "the supplier");
56556
+ const customer = party3(fields4.customer, "customer_type", "customer_id", direction === "payable", "the customer");
56229
56557
  const linked = /* @__PURE__ */ __name((given2, type, column2) => given2 === void 0 ? base[column2] ?? null : given2 === null ? null : linkedId(given2, type, "subscription.ref"), "linked");
56230
56558
  const product = linked(fields4.product, "product", "catalog_item_id");
56231
56559
  const productName = product === null ? null : String(database.prepare("SELECT name FROM catalog_items WHERE id = ?").get(product)?.name);
@@ -56356,7 +56684,7 @@ var subscriptionsStoreOver = /* @__PURE__ */ __name((context) => {
56356
56684
  };
56357
56685
  }, "subscriptionsStoreOver");
56358
56686
 
56359
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/wallets.js
56687
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/wallets.js
56360
56688
  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";
56361
56689
  var SIGNED = "CASE t.direction WHEN 'in' THEN t.amount ELSE -t.amount END";
56362
56690
  var walletOperationsOver = /* @__PURE__ */ __name((context) => {
@@ -56370,7 +56698,7 @@ var walletOperationsOver = /* @__PURE__ */ __name((context) => {
56370
56698
  const opening = row2.opening_balance == null ? null : Number(row2.opening_balance);
56371
56699
  const openingDate = row2.opening_date == null ? null : String(row2.opening_date);
56372
56700
  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);
56373
- 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);
56701
+ 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);
56374
56702
  const fields4 = {
56375
56703
  name: String(row2.name),
56376
56704
  kind: row2.kind,
@@ -56393,7 +56721,7 @@ var walletOperationsOver = /* @__PURE__ */ __name((context) => {
56393
56721
  closedDate: row2.closed_date == null ? null : String(row2.closed_date),
56394
56722
  balance: moneyOf((opening ?? 0) + booked, currency2),
56395
56723
  until,
56396
- pending: moneyOf(pending2, currency2),
56724
+ pending: moneyOf(pending, currency2),
56397
56725
  author: authorOf(row2),
56398
56726
  model: row2.model == null ? null : String(row2.model),
56399
56727
  source: String(row2.source),
@@ -56478,7 +56806,7 @@ var walletsStoreOver = /* @__PURE__ */ __name((context) => {
56478
56806
  };
56479
56807
  }, "walletsStoreOver");
56480
56808
 
56481
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-writes.js
56809
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/record-writes.js
56482
56810
  var specOf = /* @__PURE__ */ __name((type) => RECORD_TYPES[type], "specOf");
56483
56811
  var unsettled = /* @__PURE__ */ __name((fields4, relations) => recordFingerprint(fields4, relations.filter((relation) => !AMOUNT_ROLES.includes(relation.role))), "unsettled");
56484
56812
  var tableOf2 = /* @__PURE__ */ __name((type) => typeof type === "string" && Object.hasOwn(DECIDED_TABLES, type) ? DECIDED_TABLES[type] : void 0, "tableOf");
@@ -56735,9 +57063,13 @@ var recordWritesOver = /* @__PURE__ */ __name((context) => {
56735
57063
  return { writeOne, project: project2, completeDependents, entityRef, missingOf: relations.missingOf };
56736
57064
  }, "recordWritesOver");
56737
57065
 
56738
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
57066
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
56739
57067
  var LIMIT = 1e3;
56740
57068
  var iso15 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
57069
+ var checkLimit = /* @__PURE__ */ __name((limit) => {
57070
+ if (!Number.isSafeInteger(limit) || limit < 1 || limit > 500)
57071
+ throw new CliError("validation_error", "a record list takes 1\u2013500 items");
57072
+ }, "checkLimit");
56741
57073
  var IDENTITY_SQL = IDENTITY_TYPES.map((type) => `'${type}'`).join(", ");
56742
57074
  var recordStoreOver = /* @__PURE__ */ __name((context) => {
56743
57075
  const { database } = context;
@@ -56793,16 +57125,67 @@ var recordStoreOver = /* @__PURE__ */ __name((context) => {
56793
57125
  const row2 = rowOf2(key2);
56794
57126
  return row2 ? sourceRecordOf(row2) : void 0;
56795
57127
  }), "get"),
56796
- list: /* @__PURE__ */ __name(async ({ provider, account, type, waiting, unmatched, flagged, limit = 100 }) => {
56797
- if (!Number.isSafeInteger(limit) || limit < 1 || limit > 500)
56798
- throw new CliError("validation_error", "a record list takes 1\u2013500 items");
57128
+ list: /* @__PURE__ */ __name(async ({ provider, account, type, waiting, unmatched, flagged, entity, batch, deleted, limit = 100 }) => {
57129
+ checkLimit(limit);
56799
57130
  return read(database, () => {
56800
- if (findAccountPk(context, { provider, account }) === void 0)
57131
+ const accountId = findAccountPk(context, { provider, account });
57132
+ if (accountId === void 0)
56801
57133
  return [];
56802
- 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);
56803
- return rows.map(sourceRecordOf);
57134
+ const where = ["r.account_id = ?"];
57135
+ const params = [accountId];
57136
+ const and2 = /* @__PURE__ */ __name((condition, ...values) => {
57137
+ where.push(condition);
57138
+ for (const value of values)
57139
+ params.push(value);
57140
+ }, "and");
57141
+ if (type !== void 0)
57142
+ and2("r.type = ?", type);
57143
+ if (waiting)
57144
+ 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})`);
57145
+ if (unmatched)
57146
+ and2(`r.entity_id IS NULL AND r.deleted_at IS NULL AND r.type IN (${IDENTITY_SQL})`);
57147
+ if (flagged)
57148
+ and2("r.entity_id IS NOT NULL AND (r.deleted_at IS NOT NULL OR r.projected_fingerprint IS NOT r.fingerprint)");
57149
+ if (entity !== void 0) {
57150
+ const thing = requiredThing(database, entity, "the entity");
57151
+ and2("r.entity_type = ? AND r.entity_id = ?", thing.type, thing.id);
57152
+ }
57153
+ if (batch !== void 0)
57154
+ and2("r.batch_id = ?", batch);
57155
+ if (deleted !== void 0)
57156
+ and2(`r.deleted_at IS ${deleted ? "NOT " : ""}NULL`);
57157
+ return database.prepare(`${SELECT2}WHERE ${where.join(" AND ")} ORDER BY r.updated_at DESC, r.id DESC LIMIT ?`).all(...params, limit).map(sourceRecordOf);
56804
57158
  });
56805
57159
  }, "list"),
57160
+ incoming: /* @__PURE__ */ __name(async (target, { limit = 100 } = {}) => {
57161
+ checkLimit(limit);
57162
+ return read(database, () => {
57163
+ let pointing;
57164
+ if ("externalId" in target) {
57165
+ const row2 = rowOf2(target);
57166
+ if (!row2)
57167
+ return [];
57168
+ pointing = { sql: "SELECT id FROM record_relations WHERE target_id = ?", params: [Number(row2.id)] };
57169
+ } else {
57170
+ const thing = requiredThing(database, target.entity, "the entity");
57171
+ pointing = {
57172
+ 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 = ?",
57173
+ params: ["ref", `${thing.type}:${thing.id}`, thing.type, thing.id]
57174
+ };
57175
+ }
57176
+ 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) => ({
57177
+ record: {
57178
+ provider: String(row2.provider),
57179
+ account: String(row2.account),
57180
+ type: String(row2.type),
57181
+ externalId: String(row2.external_id)
57182
+ },
57183
+ role: String(row2.role),
57184
+ as: row2.as_role == null ? null : String(row2.as_role),
57185
+ amount: row2.amount == null ? null : String(row2.amount)
57186
+ }));
57187
+ });
57188
+ }, "incoming"),
56806
57189
  map: /* @__PURE__ */ __name(async (key2, entity, by) => {
56807
57190
  if (by !== "owner")
56808
57191
  throw new CliError("permission_error", "only the owner says which entity a record is", {
@@ -56885,7 +57268,7 @@ var recordStoreOver = /* @__PURE__ */ __name((context) => {
56885
57268
  };
56886
57269
  }, "recordStoreOver");
56887
57270
 
56888
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/store-errors.js
57271
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/store-errors.js
56889
57272
  var refusalOf = /* @__PURE__ */ __name((error) => error instanceof Error && error.name === "DrizzleQueryError" && error.cause instanceof CliError ? error.cause : error, "refusalOf");
56890
57273
  var wrapped = /* @__PURE__ */ new WeakMap();
56891
57274
  var storeErrors = /* @__PURE__ */ __name((area) => {
@@ -56920,7 +57303,7 @@ var storeErrors = /* @__PURE__ */ __name((area) => {
56920
57303
  return proxy;
56921
57304
  }, "storeErrors");
56922
57305
 
56923
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
57306
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
56924
57307
  var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
56925
57308
  const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
56926
57309
  let merged = { from: from2, to };
@@ -56933,7 +57316,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
56933
57316
  }, "markRange");
56934
57317
  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");
56935
57318
 
56936
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-analysis-marks.js
57319
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-analysis-marks.js
56937
57320
  var prefixOf2 = /* @__PURE__ */ __name(({ provider, account }) => `task_analysis:${provider}:${account}:`, "prefixOf");
56938
57321
  var markOf = /* @__PURE__ */ __name((prefix, row2) => ({
56939
57322
  chatId: String(row2.key).slice(prefix.length),
@@ -56954,17 +57337,17 @@ var setTaskAnalysisMark = /* @__PURE__ */ __name((database, account, { chatId, c
56954
57337
  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);
56955
57338
  }, "setTaskAnalysisMark");
56956
57339
 
56957
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
56958
- var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
57340
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
57341
+ var keyOf5 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
56959
57342
  var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
56960
- const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
57343
+ const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf5(account));
56961
57344
  return row2 ? JSON.parse(String(row2.value)) : null;
56962
57345
  }, "taskRulesStop");
56963
57346
  var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) => {
56964
- 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);
57347
+ 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);
56965
57348
  }, "setTaskRulesStop");
56966
57349
 
56967
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sync.js
57350
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sync.js
56968
57351
  var syncStoreOver = /* @__PURE__ */ __name((context) => {
56969
57352
  const { database } = context;
56970
57353
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
@@ -57023,7 +57406,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
57023
57406
  };
57024
57407
  }, "syncStoreOver");
57025
57408
 
57026
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/tags.js
57409
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/tags.js
57027
57410
  var tagsStoreOver = /* @__PURE__ */ __name((context) => {
57028
57411
  const { database } = context;
57029
57412
  return {
@@ -57045,7 +57428,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
57045
57428
  };
57046
57429
  }, "tagsStoreOver");
57047
57430
 
57048
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
57431
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
57049
57432
  var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
57050
57433
  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
57051
57434
  WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
@@ -57172,7 +57555,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
57172
57555
  dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
57173
57556
  }, "savePictureChunks");
57174
57557
 
57175
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
57558
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
57176
57559
  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,
57177
57560
  EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
57178
57561
  FROM messages m
@@ -57261,7 +57644,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
57261
57644
  return plain2(best(found2));
57262
57645
  }, "nearestMessages");
57263
57646
 
57264
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/vectors.js
57647
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/vectors.js
57265
57648
  var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
57266
57649
  const { database } = context;
57267
57650
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -57516,10 +57899,11 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
57516
57899
  saveVectors: /* @__PURE__ */ __name(async (model, dims, rows) => {
57517
57900
  write(context.database, () => saveVectors(context, model, dims, rows));
57518
57901
  }, "saveVectors"),
57519
- embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
57902
+ embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes"),
57903
+ vectorCounts: /* @__PURE__ */ __name(async (models) => vectorCounts(context, models), "vectorCounts")
57520
57904
  }), "vectorsStoreOver");
57521
57905
 
57522
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
57906
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
57523
57907
  import { existsSync as existsSync2, readFileSync as readFileSync4 } from "node:fs";
57524
57908
  import { dirname as dirname3, join as join3 } from "node:path";
57525
57909
  var BOOKKEEPING2 = ["schema_migrations", "store_settings"];
@@ -57607,10 +57991,40 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
57607
57991
  }
57608
57992
  }, "lastBackup");
57609
57993
 
57610
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/providers.js
57994
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/providers.js
57611
57995
  var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
57612
57996
 
57613
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
57997
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/owner-languages.js
57998
+ var KEY4 = "ownerLanguages";
57999
+ 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(" "));
58000
+ var DEFAULT_OWNER_LANGUAGES = ["ru"];
58001
+ var parseOwnerLanguages = /* @__PURE__ */ __name((value) => {
58002
+ const codes = value.split(/[\s,]+/).map((one2) => one2.trim().toLowerCase()).filter(Boolean);
58003
+ const unknown2 = codes.filter((one2) => !ISO_639_1.has(one2));
58004
+ if (codes.length === 0 || unknown2.length > 0)
58005
+ throw new CliError("validation_error", `owner_languages takes ISO 639-1 language codes, the language the owner reads first first (ru,en) \u2014 ${unknown2.length > 0 ? `not ${unknown2.join(", ")}` : "at least one"}`);
58006
+ return [...new Set(codes)];
58007
+ }, "parseOwnerLanguages");
58008
+ var savedOwnerLanguages = /* @__PURE__ */ __name((database) => {
58009
+ const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(KEY4);
58010
+ if (!row2)
58011
+ return void 0;
58012
+ try {
58013
+ return parseOwnerLanguages(JSON.parse(String(row2.value)).join(","));
58014
+ } catch {
58015
+ return void 0;
58016
+ }
58017
+ }, "savedOwnerLanguages");
58018
+ var ownerLanguages = /* @__PURE__ */ __name((database) => savedOwnerLanguages(database) ?? DEFAULT_OWNER_LANGUAGES, "ownerLanguages");
58019
+ var saveOwnerLanguages = /* @__PURE__ */ __name((database, languages, now2) => {
58020
+ if (languages === void 0) {
58021
+ database.prepare("DELETE FROM store_settings WHERE key = ?").run(KEY4);
58022
+ return;
58023
+ }
58024
+ 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);
58025
+ }, "saveOwnerLanguages");
58026
+
58027
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
57614
58028
  var COUNTED_TABLES = [
57615
58029
  "accounts",
57616
58030
  "chats",
@@ -57695,7 +58109,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
57695
58109
  };
57696
58110
  }, "storeContents");
57697
58111
 
57698
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/store/store.js
58112
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/store.js
57699
58113
  var openStore = /* @__PURE__ */ __name(async (options = {}) => {
57700
58114
  const context = await openStoreContext(options);
57701
58115
  try {
@@ -57745,16 +58159,14 @@ var storeOver = /* @__PURE__ */ __name((context) => {
57745
58159
  const tasks2 = once3(() => taskStoreOver(context));
57746
58160
  const sourceMentions = once3(() => sourceMentionStoreOver(context));
57747
58161
  const knowledge = once3(() => knowledgeStoreOver(context));
57748
- const notes3 = once3(() => ({ ...notesStoreOver(context), ...addedSourcesOver(context), ...noteSearchOver(context) }));
58162
+ const notes2 = once3(() => ({ ...notesStoreOver(context), ...addedSourcesOver(context), ...noteSearchOver(context) }));
57749
58163
  const catalog = once3(() => catalogStoreOver(context));
57750
58164
  const files2 = once3(() => filesStoreOver(context));
57751
58165
  const calendar = once3(() => ({ ...eventStoreOver(context), ...eventSearchOver(context) }));
57752
58166
  const meetingFindings = once3(() => meetingFindingsStoreOver(context));
57753
58167
  const evidenceFindings = once3(() => evidenceFindingsStoreOver(context));
57754
58168
  const mailFindings = once3(() => mailFindingsStoreOver(context));
57755
- const refs = {
57756
- summaries: /* @__PURE__ */ __name(async (texts2, options) => refSummariesOf(context.database, texts2, { ...options, now: context.now() }), "summaries")
57757
- };
58169
+ const refs = refsStoreOver(context);
57758
58170
  const facts2 = once3(() => factsStoreOver(context));
57759
58171
  const finance = once3(() => financeStoreOver(context));
57760
58172
  const orders2 = once3(() => ordersStoreOver(context));
@@ -57772,7 +58184,11 @@ var storeOver = /* @__PURE__ */ __name((context) => {
57772
58184
  const proposedActions2 = once3(() => proposedActionsStoreOver(context));
57773
58185
  const agentActions2 = once3(() => agentActionsStoreOver(context, pruneLogsWhenDue));
57774
58186
  const meetings2 = once3(() => meetingStoreOver(context));
58187
+ const enrichment = once3(() => enrichmentsOver(context));
57775
58188
  const store = {
58189
+ get enrichment() {
58190
+ return enrichment();
58191
+ },
57776
58192
  get projectAnnotations() {
57777
58193
  return projectAnnotations();
57778
58194
  },
@@ -57847,7 +58263,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
57847
58263
  return knowledge();
57848
58264
  },
57849
58265
  get notes() {
57850
- return notes3();
58266
+ return notes2();
57851
58267
  },
57852
58268
  get catalog() {
57853
58269
  return catalog();
@@ -57862,6 +58278,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
57862
58278
  return meetingFindings();
57863
58279
  },
57864
58280
  refs,
58281
+ business: businessSearchOver(context),
57865
58282
  get evidenceFindings() {
57866
58283
  return evidenceFindings();
57867
58284
  },
@@ -58022,6 +58439,7 @@ export {
58022
58439
  amountsOf,
58023
58440
  amountOf,
58024
58441
  dueDayOf,
58442
+ ENRICHMENT_SUBJECTS,
58025
58443
  queryFilter,
58026
58444
  CORPORA,
58027
58445
  fillTrigrams,
@@ -58097,6 +58515,7 @@ export {
58097
58515
  resetStems,
58098
58516
  ADDED_KINDS,
58099
58517
  addedSourceKeyOf,
58518
+ BUSINESS_FIND_MAX,
58100
58519
  CATALOG_QUERY,
58101
58520
  pointerOf,
58102
58521
  recordErrors,
@@ -58157,6 +58576,11 @@ export {
58157
58576
  readStoreTables,
58158
58577
  fileFacts,
58159
58578
  registerProvider2 as registerProvider,
58579
+ DEFAULT_OWNER_LANGUAGES,
58580
+ parseOwnerLanguages,
58581
+ savedOwnerLanguages,
58582
+ ownerLanguages,
58583
+ saveOwnerLanguages,
58160
58584
  rowCounts,
58161
58585
  storeContents,
58162
58586
  openStore