@wirecat/bitrix24-cli 0.2.0 → 0.4.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 (178) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/api-keys.d.ts +30 -8
  3. package/dist/api-keys.d.ts.map +1 -1
  4. package/dist/api-keys.js +81 -18
  5. package/dist/api-keys.js.map +1 -1
  6. package/dist/bin/b24.js +2 -2
  7. package/dist/bitrix/methods.d.ts.map +1 -1
  8. package/dist/bitrix/methods.js +7 -3
  9. package/dist/bitrix/methods.js.map +1 -1
  10. package/dist/bitrix/transport.d.ts +4 -7
  11. package/dist/bitrix/transport.d.ts.map +1 -1
  12. package/dist/bitrix/transport.js +12 -16
  13. package/dist/bitrix/transport.js.map +1 -1
  14. package/dist/bundle/{all-profiles-QJ444GSX.js → all-profiles-MBQZCOVK.js} +6 -6
  15. package/dist/bundle/{anthropic-RHRAVHC2.js → anthropic-QCYLKSJJ.js} +4 -4
  16. package/dist/bundle/{app-server-QIT6S7AZ.js → app-server-FSLZ2Y6N.js} +42 -42
  17. package/dist/bundle/b24.js +12 -12
  18. package/dist/bundle/{bun-H6RSODZ3.js → bun-UYRQXF33.js} +2 -2
  19. package/dist/bundle/{bun-sqlite-BO4LTQHX.js → bun-sqlite-GXME7EMT.js} +3 -3
  20. package/dist/bundle/{chunk-MBDK4YXG.js → chunk-2D5W4LWL.js} +1 -1
  21. package/dist/bundle/{chunk-U5ACMCAQ.js → chunk-2IZ6GGU2.js} +151 -151
  22. package/dist/bundle/{chunk-VEWWAGTD.js → chunk-4OVK5XW2.js} +8 -8
  23. package/dist/bundle/{chunk-45AKJVKV.js → chunk-66QLBRIT.js} +1 -1
  24. package/dist/bundle/{chunk-P364PLIK.js → chunk-6BLVBGRK.js} +9 -9
  25. package/dist/bundle/{chunk-FOTREPNS.js → chunk-6ERX33NC.js} +8 -8
  26. package/dist/bundle/{chunk-LRGYKOCP.js → chunk-AMVRNYD6.js} +1 -1
  27. package/dist/bundle/{chunk-YZ5LHE5Q.js → chunk-AOUNT22U.js} +2 -2
  28. package/dist/bundle/{chunk-ZDQQCXFG.js → chunk-B252WFK7.js} +13 -13
  29. package/dist/bundle/{chunk-WKRQ44EH.js → chunk-BHZ5VDDY.js} +13 -13
  30. package/dist/bundle/{chunk-ZIAQPTUS.js → chunk-COOOXDKZ.js} +3 -3
  31. package/dist/bundle/{chunk-GDFNH33E.js → chunk-CR3TLGM4.js} +9 -4
  32. package/dist/bundle/{chunk-D5S6QV6R.js → chunk-D2IRPC5I.js} +6 -6
  33. package/dist/bundle/{chunk-POC3V3AO.js → chunk-DQIQIZQS.js} +297 -256
  34. package/dist/bundle/{chunk-QGMDQ2PM.js → chunk-EIGPMMGC.js} +3 -3
  35. package/dist/bundle/{chunk-WTPMJYMD.js → chunk-ELBOQHJA.js} +45 -45
  36. package/dist/bundle/{chunk-LSPIOT6Z.js → chunk-EQLWU6ZB.js} +7 -7
  37. package/dist/bundle/{chunk-WII44RXN.js → chunk-F5NH3UJQ.js} +2 -2
  38. package/dist/bundle/{chunk-HAXNUIGQ.js → chunk-GTDOUP6L.js} +26 -23
  39. package/dist/bundle/{chunk-QQXH2OPB.js → chunk-GTFRSYYJ.js} +17 -12
  40. package/dist/bundle/{chunk-H2ADPPSH.js → chunk-GTMCLOYY.js} +670 -465
  41. package/dist/bundle/{chunk-7GRZAKBB.js → chunk-IF27EQN6.js} +2 -2
  42. package/dist/bundle/{chunk-FZL7F5NR.js → chunk-IWEWDVZ6.js} +22 -22
  43. package/dist/bundle/{program-UYX5362I.js → chunk-J7OMY6EO.js} +16672 -18336
  44. package/dist/bundle/{chunk-QIPTIUMJ.js → chunk-JAS3OZSP.js} +4 -4
  45. package/dist/bundle/{chunk-OTD2ZRXD.js → chunk-JB7OXYAU.js} +4 -4
  46. package/dist/bundle/{chunk-ZEW4P6AH.js → chunk-K7XWCZF6.js} +8 -8
  47. package/dist/bundle/{chunk-YYO7D2MO.js → chunk-LAYH344Y.js} +28 -28
  48. package/dist/bundle/{chunk-K3UIB6ZF.js → chunk-M5XMAUGZ.js} +2 -2
  49. package/dist/bundle/{chunk-2KCZ7BKW.js → chunk-MPI2FDJ4.js} +11 -11
  50. package/dist/bundle/{chunk-HGL63O5V.js → chunk-MY6FAZRA.js} +2 -2
  51. package/dist/bundle/{chunk-QC53QBNC.js → chunk-NDSOBIR3.js} +3 -3
  52. package/dist/bundle/{chunk-XRFJWHY5.js → chunk-NEK7LKC6.js} +4 -4
  53. package/dist/bundle/{chunk-2SNUMZ7S.js → chunk-NKLLI4B2.js} +6 -6
  54. package/dist/bundle/{chunk-QMPN6WKD.js → chunk-NWKXMMON.js} +100 -81
  55. package/dist/bundle/{chunk-P33NDCDI.js → chunk-O7FVOICH.js} +1 -1
  56. package/dist/bundle/{chunk-SFRNX2TI.js → chunk-OCRCVLZQ.js} +1 -1
  57. package/dist/bundle/{chunk-TE3FR6MI.js → chunk-OKDC6CLH.js} +5 -5
  58. package/dist/bundle/{chunk-DTXERR44.js → chunk-OWILUBCI.js} +2 -2
  59. package/dist/bundle/{chunk-CXL33BFL.js → chunk-OYLJHX74.js} +1 -1
  60. package/dist/bundle/{chunk-6WY72XVQ.js → chunk-POUSZWMP.js} +4 -4
  61. package/dist/bundle/{chunk-N6FLBXZS.js → chunk-Q4ILKTV4.js} +3 -3
  62. package/dist/bundle/{chunk-FLUEXJ4X.js → chunk-Q7Z5IMVY.js} +1 -1
  63. package/dist/bundle/{chunk-XJXONOB5.js → chunk-QVZSLBR6.js} +1 -1
  64. package/dist/bundle/{chunk-IRV2PCQ2.js → chunk-SBW2Y7AZ.js} +26 -26
  65. package/dist/bundle/{chunk-XNHSPHUN.js → chunk-UCLWWSQK.js} +2 -2
  66. package/dist/bundle/{chunk-BCF7P4FZ.js → chunk-UH56WLDS.js} +8 -8
  67. package/dist/bundle/{chunk-ZGZT5S6B.js → chunk-VMQL4GNH.js} +55 -55
  68. package/dist/bundle/{chunk-XD4FRDSL.js → chunk-VTIUWHZ3.js} +5 -5
  69. package/dist/bundle/{chunk-SGRYYE4X.js → chunk-WJRBX5QB.js} +4 -4
  70. package/dist/bundle/{chunk-VL6SPMZV.js → chunk-XG6QKS7L.js} +5 -5
  71. package/dist/bundle/{chunk-RRJNNPR4.js → chunk-XKQZLR2X.js} +1 -1
  72. package/dist/bundle/{chunk-QSNROIJL.js → chunk-XOPMSWFC.js} +9 -9
  73. package/dist/bundle/{chunk-EVYSBZ3I.js → chunk-XR5SUCAC.js} +4 -4
  74. package/dist/bundle/{chunk-PH5FZX6E.js → chunk-Y5PPMGCS.js} +2 -2
  75. package/dist/bundle/{chunk-EXOOKUEA.js → chunk-YFZXI3NN.js} +2 -2
  76. package/dist/bundle/{chunk-CNNEA2M4.js → chunk-ZU4HXKEW.js} +3 -3
  77. package/dist/bundle/command-contract-UON4EIC4.js +30 -0
  78. package/dist/bundle/{decode-5ZPLTYV6.js → decode-IF2F2SFC.js} +3 -3
  79. package/dist/bundle/{echarts-J6LAPIX7.js → echarts-WDDVEJO2.js} +2 -2
  80. package/dist/bundle/{embed-YG5LDHME.js → embed-VDUGYEAR.js} +4 -4
  81. package/dist/bundle/{embedder-7FNUA5OZ.js → embedder-DUN62H3Z.js} +7 -7
  82. package/dist/bundle/{first-run-JPZNWIJN.js → first-run-NDGYBQEN.js} +8 -8
  83. package/dist/bundle/first-screen-QAVKP5RF.js +28 -0
  84. package/dist/bundle/{instructions-AXWTQHMR.js → instructions-JIIKWS7X.js} +1 -1
  85. package/dist/bundle/{mcp-7F46P6AM.js → mcp-33JX6KP4.js} +2 -2
  86. package/dist/bundle/{mcp-HUD6UH5X.js → mcp-57EQ6QJO.js} +58 -47
  87. package/dist/bundle/mcp-PFJER2DE.js +87 -0
  88. package/dist/bundle/{node-CWKAIOEM.js → node-K57WT42O.js} +2 -2
  89. package/dist/bundle/{node-sqlite-LSEKVRDA.js → node-sqlite-KS6ORRIG.js} +4 -4
  90. package/dist/bundle/{oauth-THYNLRLD.js → oauth-SLSANN37.js} +5 -5
  91. package/dist/bundle/{open-E47QYKFC.js → open-WJPHADEX.js} +3 -3
  92. package/dist/bundle/{openai-EWSGC3BC.js → openai-HXB3GTOD.js} +12 -12
  93. package/dist/bundle/{process-WKTEA3WE.js → process-P73TFAXT.js} +1 -1
  94. package/dist/bundle/program-7BMG5NIN.js +2250 -0
  95. package/dist/bundle/{prompt-CAQ7QR3U.js → prompt-WDPV37R4.js} +3 -3
  96. package/dist/bundle/{recognize-6KGHNZC3.js → recognize-CXIFL6IV.js} +2 -2
  97. package/dist/bundle/{remote-3UO2WDC3.js → remote-Q4VJ4OQW.js} +5 -5
  98. package/dist/bundle/{rerank-2JVDPZBX.js → rerank-SUFYK63I.js} +5 -5
  99. package/dist/bundle/{serve-ES7AG5IK.js → serve-B7PGFOC2.js} +7 -7
  100. package/dist/bundle/server-4DBNJWW6.js +58 -0
  101. package/dist/bundle/server-OKE7SXJ2.js +45 -0
  102. package/dist/bundle/{state-7NH5G4XJ.js → state-EZCCXQV7.js} +4 -4
  103. package/dist/bundle/{store-7O4JQD2Z.js → store-MZ7JBYR6.js} +12 -12
  104. package/dist/bundle/store-maintenance-command-T5QZMENJ.js +47 -0
  105. package/dist/commands/api.d.ts.map +1 -1
  106. package/dist/commands/api.js +57 -7
  107. package/dist/commands/api.js.map +1 -1
  108. package/dist/commands/crm-writes.d.ts.map +1 -1
  109. package/dist/commands/crm-writes.js +24 -8
  110. package/dist/commands/crm-writes.js.map +1 -1
  111. package/dist/commands/crm.d.ts.map +1 -1
  112. package/dist/commands/crm.js +29 -3
  113. package/dist/commands/crm.js.map +1 -1
  114. package/dist/commands/fields.d.ts +3 -0
  115. package/dist/commands/fields.d.ts.map +1 -0
  116. package/dist/commands/fields.js +45 -0
  117. package/dist/commands/fields.js.map +1 -0
  118. package/dist/commands/write.d.ts +6 -1
  119. package/dist/commands/write.d.ts.map +1 -1
  120. package/dist/commands/write.js +7 -5
  121. package/dist/commands/write.js.map +1 -1
  122. package/dist/config.d.ts.map +1 -1
  123. package/dist/config.js +2 -1
  124. package/dist/config.js.map +1 -1
  125. package/dist/crm/conditions.js +1 -1
  126. package/dist/crm/conditions.js.map +1 -1
  127. package/dist/crm/custom-query.d.ts +19 -0
  128. package/dist/crm/custom-query.d.ts.map +1 -0
  129. package/dist/crm/custom-query.js +79 -0
  130. package/dist/crm/custom-query.js.map +1 -0
  131. package/dist/crm/deal.d.ts +7 -3
  132. package/dist/crm/deal.d.ts.map +1 -1
  133. package/dist/crm/deal.js +3 -3
  134. package/dist/crm/deal.js.map +1 -1
  135. package/dist/crm/fields.d.ts +44 -0
  136. package/dist/crm/fields.d.ts.map +1 -0
  137. package/dist/crm/fields.js +143 -0
  138. package/dist/crm/fields.js.map +1 -0
  139. package/dist/crm/items.d.ts +9 -3
  140. package/dist/crm/items.d.ts.map +1 -1
  141. package/dist/crm/items.js +27 -6
  142. package/dist/crm/items.js.map +1 -1
  143. package/dist/crm/lead.d.ts +7 -3
  144. package/dist/crm/lead.d.ts.map +1 -1
  145. package/dist/crm/lead.js +3 -3
  146. package/dist/crm/lead.js.map +1 -1
  147. package/dist/crm/organization.d.ts +7 -3
  148. package/dist/crm/organization.d.ts.map +1 -1
  149. package/dist/crm/organization.js +3 -3
  150. package/dist/crm/organization.js.map +1 -1
  151. package/dist/crm/person.d.ts +7 -3
  152. package/dist/crm/person.d.ts.map +1 -1
  153. package/dist/crm/person.js +3 -3
  154. package/dist/crm/person.js.map +1 -1
  155. package/dist/crm/values.d.ts +12 -1
  156. package/dist/crm/values.d.ts.map +1 -1
  157. package/dist/crm/values.js +12 -2
  158. package/dist/crm/values.js.map +1 -1
  159. package/dist/mcp.d.ts.map +1 -1
  160. package/dist/mcp.js +4 -1
  161. package/dist/mcp.js.map +1 -1
  162. package/dist/program.d.ts.map +1 -1
  163. package/dist/program.js +4 -1
  164. package/dist/program.js.map +1 -1
  165. package/dist/reasons.d.ts.map +1 -1
  166. package/dist/reasons.js +6 -1
  167. package/dist/reasons.js.map +1 -1
  168. package/dist/version.d.ts +1 -1
  169. package/dist/version.js +1 -1
  170. package/package.json +3 -3
  171. package/skills/bitrix24-cli/SKILL.md +8 -3
  172. package/dist/bundle/command-contract-OKQOE6G4.js +0 -30
  173. package/dist/bundle/first-screen-VQM4MTS7.js +0 -28
  174. package/dist/bundle/mcp-J5R5A65I.js +0 -87
  175. package/dist/bundle/server-5LE5LNUQ.js +0 -45
  176. package/dist/bundle/server-BU4VBM6S.js +0 -58
  177. package/dist/bundle/store-maintenance-command-UDVGEY2D.js +0 -47
  178. /package/dist/bundle/{chunk-4PDYYS5K.js → chunk-NDTJE6JQ.js} +0 -0
@@ -24,7 +24,7 @@ import {
24
24
  priorityLabel,
25
25
  project,
26
26
  reminder
27
- } from "./chunk-P364PLIK.js";
27
+ } from "./chunk-6BLVBGRK.js";
28
28
  import {
29
29
  DEFAULT_STEMMERS,
30
30
  DEFAULT_STEMMERS_VERSION,
@@ -37,23 +37,25 @@ import {
37
37
  fold,
38
38
  normalize,
39
39
  parseStemmers
40
- } from "./chunk-VEWWAGTD.js";
40
+ } from "./chunk-4OVK5XW2.js";
41
41
  import {
42
42
  DEFAULT_TASK_CATEGORIES,
43
43
  sharedConfigPath,
44
44
  storedTaskCategories,
45
45
  taskCategoriesReader
46
- } from "./chunk-TE3FR6MI.js";
46
+ } from "./chunk-OKDC6CLH.js";
47
47
  import {
48
48
  refuseOwnerStoreInTests,
49
49
  storePath
50
- } from "./chunk-DTXERR44.js";
50
+ } from "./chunk-OWILUBCI.js";
51
51
  import {
52
52
  COUNTER_FIELDS,
53
+ DEAL_KINDS,
53
54
  DEAL_ROLES,
54
55
  DEAL_STATUSES,
55
56
  DOCUMENT_ACCOUNT_PROVIDERS,
56
57
  INTERNAL_NOTES,
58
+ STAGE_OUTCOMES,
57
59
  UNKNOWN_PROVIDER,
58
60
  addProvider,
59
61
  canonicalReference,
@@ -85,7 +87,7 @@ import {
85
87
  recordFingerprint,
86
88
  useStoredProviders,
87
89
  validCounter
88
- } from "./chunk-QQXH2OPB.js";
90
+ } from "./chunk-GTFRSYYJ.js";
89
91
  import {
90
92
  CHAT_MESSAGES_READ,
91
93
  FACT_TYPES,
@@ -162,16 +164,16 @@ import {
162
164
  validateQuery,
163
165
  walkQuery,
164
166
  zonedMoment
165
- } from "./chunk-ZGZT5S6B.js";
167
+ } from "./chunk-VMQL4GNH.js";
166
168
  import {
167
169
  quietSqliteWarning,
168
170
  storeCapable
169
- } from "./chunk-D5S6QV6R.js";
171
+ } from "./chunk-D2IRPC5I.js";
170
172
  import {
171
173
  PRAGMAS,
172
174
  TIME_LIMIT_FUNCTION,
173
175
  TimeLimitReached
174
- } from "./chunk-MBDK4YXG.js";
176
+ } from "./chunk-2D5W4LWL.js";
175
177
  import {
176
178
  CliError,
177
179
  array,
@@ -191,7 +193,7 @@ import {
191
193
  singleLine,
192
194
  strictObject,
193
195
  string
194
- } from "./chunk-IRV2PCQ2.js";
196
+ } from "./chunk-SBW2Y7AZ.js";
195
197
  import {
196
198
  resolveFrom
197
199
  } from "./chunk-Y5E2WNWB.js";
@@ -219,7 +221,7 @@ import {
219
221
  sql,
220
222
  sqliteTable,
221
223
  text
222
- } from "./chunk-SFRNX2TI.js";
224
+ } from "./chunk-OCRCVLZQ.js";
223
225
  import {
224
226
  __commonJS,
225
227
  __name,
@@ -9963,7 +9965,7 @@ var require_cjs = __commonJS({
9963
9965
  }
9964
9966
  });
9965
9967
 
9966
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/account-store.js
9968
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/account-store.js
9967
9969
  var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
9968
9970
  const methods = whole;
9969
9971
  return Object.fromEntries(Object.keys(keyed).map((name) => [
@@ -10091,7 +10093,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
10091
10093
  };
10092
10094
  }, "bindAccount");
10093
10095
 
10094
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/search/query.js
10096
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/search/query.js
10095
10097
  var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
10096
10098
  var inSource = /* @__PURE__ */ __name((source2, provider) => source2 === "all" || source2 === "bots" && isBotProvider(provider) || source2 === "personal" && !isBotProvider(provider) || source2 === provider || providerNamed(source2)?.name === provider || isKind(source2) && kindOf(provider) === source2, "inSource");
10097
10099
  var fail = /* @__PURE__ */ __name((message2) => {
@@ -10114,7 +10116,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
10114
10116
  return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
10115
10117
  }, "sourceOf");
10116
10118
 
10117
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/search/account-list.js
10119
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/search/account-list.js
10118
10120
  var ACCOUNT_GROUPS = "accountGroups";
10119
10121
  var ACCOUNT_GROUPS_SETTING = "account_groups";
10120
10122
  var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
@@ -10276,7 +10278,8 @@ var READS = {
10276
10278
  notes: "notes \u2014 search notes reads them",
10277
10279
  documents: "documents \u2014 search notes reads them",
10278
10280
  meetings: "meetings \u2014 search all reads them",
10279
- events: "calendar events \u2014 no search reads them yet"
10281
+ events: "calendar events \u2014 no search reads them yet",
10282
+ crm: "CRM deals and leads \u2014 search all reads them"
10280
10283
  };
10281
10284
  var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind3) => READS[kind3]) => {
10282
10285
  const chosen = /* @__PURE__ */ new Map();
@@ -10301,7 +10304,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind3)
10301
10304
  return { accounts: [...chosen.values()], skipped };
10302
10305
  }, "fitting");
10303
10306
 
10304
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
10307
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
10305
10308
  var IndexBuilderOn = class {
10306
10309
  static {
10307
10310
  __name(this, "IndexBuilderOn");
@@ -10496,7 +10499,7 @@ function alias(table, alias2) {
10496
10499
  }
10497
10500
  __name(alias, "alias");
10498
10501
 
10499
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
10502
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
10500
10503
  var ENTITY_TABLES = {
10501
10504
  account: "accounts",
10502
10505
  attachment: "attachments",
@@ -10504,7 +10507,7 @@ var ENTITY_TABLES = {
10504
10507
  calendar_entry: "calendar_entries",
10505
10508
  chat: "chats",
10506
10509
  conversation: "conversations",
10507
- deal: "opportunities",
10510
+ deal: "deals",
10508
10511
  document: "documents",
10509
10512
  document_picture: "documents",
10510
10513
  email: "emails",
@@ -10516,6 +10519,7 @@ var ENTITY_TABLES = {
10516
10519
  identity: "identities",
10517
10520
  image: "attachments",
10518
10521
  invoice: "invoices",
10522
+ lead: "leads",
10519
10523
  meeting: "meetings",
10520
10524
  meeting_transcript: "meeting_transcripts",
10521
10525
  meeting_transcript_row: "meeting_transcript_rows",
@@ -10526,6 +10530,7 @@ var ENTITY_TABLES = {
10526
10530
  organization: "organizations",
10527
10531
  payment: "payments",
10528
10532
  person: "persons",
10533
+ pipeline: "pipelines",
10529
10534
  place: "places",
10530
10535
  project: "projects",
10531
10536
  tag: "canonical_tags",
@@ -10540,7 +10545,7 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
10540
10545
  return { table, pointer, type, count, known: known2 };
10541
10546
  }).filter(({ count }) => count > 0)), "orphanPointers");
10542
10547
 
10543
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
10548
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
10544
10549
  var canonicalTags = sqliteTable("canonical_tags", {
10545
10550
  id: integer("id").primaryKey(),
10546
10551
  name: text("name").notNull().unique(),
@@ -10549,7 +10554,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
10549
10554
  updatedAt: integer("updated_at").notNull()
10550
10555
  });
10551
10556
 
10552
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
10557
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
10553
10558
  var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
10554
10559
  sourceKey: text("source_key").notNull(),
10555
10560
  collection: text("collection").notNull(),
@@ -10559,13 +10564,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
10559
10564
  createdAt: integer("created_at").notNull()
10560
10565
  }, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
10561
10566
 
10562
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
10567
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
10563
10568
  var documentIndexPending = sqliteTable("document_index_pending", {
10564
10569
  id: integer("id").notNull(),
10565
10570
  indexableType: text("indexable_type").notNull()
10566
10571
  }, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
10567
10572
 
10568
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
10573
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
10569
10574
  var tagRedirects = sqliteTable("tag_redirects", {
10570
10575
  sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
10571
10576
  survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
@@ -10591,7 +10596,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
10591
10596
  index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
10592
10597
  ]);
10593
10598
 
10594
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
10599
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
10595
10600
  var accounts = sqliteTable("accounts", {
10596
10601
  id: integer("id").primaryKey(),
10597
10602
  provider: text("provider").notNull(),
@@ -11919,21 +11924,33 @@ var orders = sqliteTable("orders", {
11919
11924
  ]);
11920
11925
  var pipelines = sqliteTable("pipelines", {
11921
11926
  id: integer("id").primaryKey(),
11927
+ accountId: integer("account_id").references(() => accounts.id),
11928
+ externalId: text("external_id"),
11929
+ kind: text("kind").notNull().default("deal"),
11922
11930
  name: text("name").notNull(),
11923
- nameFolded: text("name_folded").notNull().unique(),
11931
+ nameFolded: text("name_folded").notNull(),
11924
11932
  createdAt: integer("created_at").notNull(),
11925
11933
  updatedAt: integer("updated_at").notNull()
11926
- });
11934
+ }, (table) => [
11935
+ uniqueIndex("pipelines_by_account_id_external_id").on(table.accountId, table.externalId).where(sql`account_id IS NOT NULL AND external_id IS NOT NULL`),
11936
+ uniqueIndex("pipelines_by_name_folded_kind").on(table.nameFolded, table.kind).where(sql`account_id IS NULL`)
11937
+ ]);
11927
11938
  var pipelineStages = sqliteTable("pipeline_stages", {
11928
11939
  id: integer("id").primaryKey(),
11929
11940
  pipelineId: integer("pipeline_id").notNull().references(() => pipelines.id),
11930
11941
  name: text("name").notNull(),
11931
11942
  nameFolded: text("name_folded").notNull(),
11932
11943
  position: integer("position").notNull(),
11944
+ outcome: text("outcome").notNull().default("open"),
11945
+ externalId: text("external_id"),
11933
11946
  createdAt: integer("created_at").notNull(),
11934
11947
  updatedAt: integer("updated_at").notNull()
11935
- }, (table) => [unique().on(table.pipelineId, table.nameFolded), unique().on(table.pipelineId, table.position)]);
11936
- var opportunities = sqliteTable("opportunities", {
11948
+ }, (table) => [
11949
+ unique().on(table.pipelineId, table.nameFolded),
11950
+ uniqueIndex("pipeline_stages_by_pipeline_id_external_id").on(table.pipelineId, table.externalId).where(sql`external_id IS NOT NULL`),
11951
+ index("pipeline_stages_by_pipeline_id_position").on(table.pipelineId, table.position)
11952
+ ]);
11953
+ var deals = sqliteTable("deals", {
11937
11954
  id: integer("id").primaryKey(),
11938
11955
  title: text("title").notNull(),
11939
11956
  organizationId: integer("organization_id").references(() => organizations.id),
@@ -11941,27 +11958,71 @@ var opportunities = sqliteTable("opportunities", {
11941
11958
  stageId: integer("stage_id").notNull().references(() => pipelineStages.id),
11942
11959
  status: text("status").notNull(),
11943
11960
  currency: text("currency"),
11944
- /** Minor units of `currency`. */
11945
11961
  amount: integer("amount"),
11946
11962
  closeDate: text("close_date"),
11947
11963
  closedDate: text("closed_date"),
11948
- review: text("review").notNull(),
11964
+ rank: real("rank"),
11965
+ accountId: integer("account_id").references(() => accounts.id),
11966
+ externalId: text("external_id"),
11949
11967
  authorType: text("author_type").notNull(),
11950
11968
  authorId: integer("author_id").notNull(),
11951
11969
  model: text("model"),
11952
- confirmedByType: text("confirmed_by_type"),
11953
- confirmedById: integer("confirmed_by_id"),
11954
11970
  source: text("source").notNull(),
11955
11971
  metadata: text("metadata"),
11956
11972
  createdAt: integer("created_at").notNull(),
11957
11973
  updatedAt: integer("updated_at").notNull(),
11958
11974
  deletedAt: integer("deleted_at")
11959
11975
  }, (table) => [
11960
- index("opportunities_by_organization_id").on(table.organizationId),
11961
- index("opportunities_by_project_id").on(table.projectId),
11962
- index("opportunities_by_stage_id").on(table.stageId),
11963
- index("opportunities_by_author_type_author_id").on(table.authorType, table.authorId),
11964
- index("opportunities_by_confirmed_by_type_confirmed_by_id").on(table.confirmedByType, table.confirmedById)
11976
+ uniqueIndex("deals_by_account_id_external_id").on(table.accountId, table.externalId).where(sql`account_id IS NOT NULL AND external_id IS NOT NULL`),
11977
+ index("deals_by_organization_id").on(table.organizationId),
11978
+ index("deals_by_project_id").on(table.projectId),
11979
+ index("deals_by_stage_id").on(table.stageId),
11980
+ index("deals_by_author_type_author_id").on(table.authorType, table.authorId)
11981
+ ]);
11982
+ var leads = sqliteTable("leads", {
11983
+ id: integer("id").primaryKey(),
11984
+ title: text("title").notNull(),
11985
+ organizationId: integer("organization_id").references(() => organizations.id),
11986
+ projectId: integer("project_id").references(() => projects.id),
11987
+ stageId: integer("stage_id").notNull().references(() => pipelineStages.id),
11988
+ status: text("status").notNull(),
11989
+ currency: text("currency"),
11990
+ amount: integer("amount"),
11991
+ closeDate: text("close_date"),
11992
+ closedDate: text("closed_date"),
11993
+ rank: real("rank"),
11994
+ dealId: integer("deal_id").references(() => deals.id),
11995
+ accountId: integer("account_id").references(() => accounts.id),
11996
+ externalId: text("external_id"),
11997
+ authorType: text("author_type").notNull(),
11998
+ authorId: integer("author_id").notNull(),
11999
+ model: text("model"),
12000
+ source: text("source").notNull(),
12001
+ metadata: text("metadata"),
12002
+ createdAt: integer("created_at").notNull(),
12003
+ updatedAt: integer("updated_at").notNull(),
12004
+ deletedAt: integer("deleted_at")
12005
+ }, (table) => [
12006
+ uniqueIndex("leads_by_account_id_external_id").on(table.accountId, table.externalId).where(sql`account_id IS NOT NULL AND external_id IS NOT NULL`),
12007
+ index("leads_by_organization_id").on(table.organizationId),
12008
+ index("leads_by_project_id").on(table.projectId),
12009
+ index("leads_by_stage_id").on(table.stageId),
12010
+ index("leads_by_deal_id").on(table.dealId),
12011
+ index("leads_by_author_type_author_id").on(table.authorType, table.authorId)
12012
+ ]);
12013
+ var pipelineStageChanges = sqliteTable("pipeline_stage_changes", {
12014
+ id: integer("id").primaryKey(),
12015
+ itemType: text("item_type").notNull(),
12016
+ itemId: integer("item_id").notNull(),
12017
+ pipelineId: integer("pipeline_id").notNull().references(() => pipelines.id),
12018
+ fromStageId: integer("from_stage_id").references(() => pipelineStages.id),
12019
+ toStageId: integer("to_stage_id").notNull().references(() => pipelineStages.id),
12020
+ changedAt: integer("changed_at").notNull()
12021
+ }, (table) => [
12022
+ index("pipeline_stage_changes_by_item_type_item_id").on(table.itemType, table.itemId),
12023
+ index("pipeline_stage_changes_by_pipeline_id").on(table.pipelineId),
12024
+ index("pipeline_stage_changes_by_from_stage_id").on(table.fromStageId),
12025
+ index("pipeline_stage_changes_by_to_stage_id").on(table.toStageId)
11965
12026
  ]);
11966
12027
  var records = sqliteTable("records", {
11967
12028
  id: integer("id").primaryKey(),
@@ -12304,7 +12365,7 @@ var storeSettings = sqliteTable("store_settings", {
12304
12365
  at: integer("at").notNull()
12305
12366
  });
12306
12367
 
12307
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
12368
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
12308
12369
  var ARMS = [
12309
12370
  [
12310
12371
  "message",
@@ -12431,7 +12492,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
12431
12492
  return recomputed;
12432
12493
  }, "drainInvolvementQueue");
12433
12494
 
12434
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/mentions.js
12495
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/mentions.js
12435
12496
  import { domainToUnicode } from "node:url";
12436
12497
 
12437
12498
  // node_modules/.pnpm/psl@1.15.0/node_modules/psl/dist/psl.mjs
@@ -22453,7 +22514,7 @@ var oa = /* @__PURE__ */ __name((e) => {
22453
22514
  }, "oa");
22454
22515
  var na = { parse: O, get: aa, isValid: oa };
22455
22516
 
22456
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
22517
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
22457
22518
  var LINK = /https?:\/\/(?:(?:docs|drive|sheets|slides)\.google\.com|forms\.gle)(?:[/?#][^\s<>"'`]*)?/gi;
22458
22519
  var ID = /^[\w-]{10,}$/;
22459
22520
  var trimUrl = /* @__PURE__ */ __name((url) => {
@@ -22494,7 +22555,7 @@ var googleDocumentLinks = /* @__PURE__ */ __name((text6) => [...text6.matchAll(L
22494
22555
  return { url, documentId: googleDocumentId(url) };
22495
22556
  }), "googleDocumentLinks");
22496
22557
 
22497
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
22558
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
22498
22559
  var PHONE_PLANS = [
22499
22560
  {
22500
22561
  country: "us",
@@ -22874,7 +22935,7 @@ var PHONE_PLANS = [
22874
22935
  }
22875
22936
  ];
22876
22937
 
22877
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/phones.js
22938
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/phones.js
22878
22939
  var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
22879
22940
  var DEFAULT_PHONE_COUNTRIES = ["ru"];
22880
22941
  var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
@@ -22915,7 +22976,7 @@ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
22915
22976
  return void 0;
22916
22977
  }, "nationalPhone");
22917
22978
 
22918
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/places.js
22979
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/places.js
22919
22980
  var BEFORE = [
22920
22981
  [/^(?:ул\.?|улиц[аеыу]|улицей)$/iu, "\u0443\u043B\u0438\u0446\u0430"],
22921
22982
  [/^(?:пр-т|просп\.?|проспект[аеу]?)$/iu, "\u043F\u0440\u043E\u0441\u043F\u0435\u043A\u0442"],
@@ -23175,7 +23236,7 @@ var findPlaces = /* @__PURE__ */ __name((text6) => {
23175
23236
  return found2.sort((a, b) => a.start - b.start);
23176
23237
  }, "findPlaces");
23177
23238
 
23178
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/mentions.js
23239
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/mentions.js
23179
23240
  var MENTION_KINDS = ["phone", "email", "url", "document", "person-name", "place"];
23180
23241
  var MENTION_VERSIONS = {
23181
23242
  phone: 1,
@@ -23365,7 +23426,7 @@ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE
23365
23426
  };
23366
23427
  }, "typedPhone");
23367
23428
 
23368
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/first-names.js
23429
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/first-names.js
23369
23430
  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";
23370
23431
  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";
23371
23432
  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";
@@ -23373,7 +23434,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
23373
23434
  var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
23374
23435
  var NAME_WORDS = WORDS.split(" ");
23375
23436
 
23376
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/person-names.js
23437
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/person-names.js
23377
23438
  var LATIN_TO_CYRILLIC = {
23378
23439
  shch: "\u0449",
23379
23440
  sch: "\u0449",
@@ -23581,7 +23642,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text6, stem, taken) => {
23581
23642
  return found2;
23582
23643
  }, "findUnknownNames");
23583
23644
 
23584
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/attachments.js
23645
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/attachments.js
23585
23646
  var NOT_FILES = /* @__PURE__ */ new Set([
23586
23647
  "webpage",
23587
23648
  "share",
@@ -23621,7 +23682,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored3, files2) => {
23621
23682
  });
23622
23683
  }, "matchDownloads");
23623
23684
 
23624
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
23685
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
23625
23686
  var QUERY_VERSION = 1;
23626
23687
  var QUERY_LIMITS2 = {
23627
23688
  ...QUERY_LIMITS,
@@ -23657,7 +23718,7 @@ function exhausted(budget) {
23657
23718
  }
23658
23719
  __name(exhausted, "exhausted");
23659
23720
 
23660
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
23721
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
23661
23722
  var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
23662
23723
  var literal2 = /* @__PURE__ */ __name((c) => ({
23663
23724
  kind: "char",
@@ -24057,7 +24118,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
24057
24118
  return out;
24058
24119
  }, "foldRegex");
24059
24120
 
24060
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
24121
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
24061
24122
  var PRESET_VERSION = 1;
24062
24123
  var PRESETS = {
24063
24124
  password: {
@@ -24111,7 +24172,7 @@ var PRESETS = {
24111
24172
  }
24112
24173
  };
24113
24174
 
24114
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
24175
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
24115
24176
  var FIELD_VERSION = 2;
24116
24177
  var UNITS = {
24117
24178
  "": 1,
@@ -24572,12 +24633,12 @@ var validateAst = /* @__PURE__ */ __name((input) => {
24572
24633
  return validateFields(parsed3.output);
24573
24634
  }, "validateAst");
24574
24635
 
24575
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
24636
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
24576
24637
  var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
24577
24638
  var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
24578
24639
  var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
24579
24640
 
24580
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
24641
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
24581
24642
  var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
24582
24643
  var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
24583
24644
  var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
@@ -24601,7 +24662,7 @@ var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
24601
24662
  };
24602
24663
  }, "linkMatch");
24603
24664
 
24604
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
24665
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
24605
24666
  var SETTING = "phoneCountries";
24606
24667
  var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
24607
24668
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
@@ -24632,7 +24693,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
24632
24693
  return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
24633
24694
  }, "valueMatch");
24634
24695
 
24635
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
24696
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
24636
24697
  var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
24637
24698
  if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
24638
24699
  throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
@@ -24660,7 +24721,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
24660
24721
  return 2 * intersection2 / (aa2.size + bb.size);
24661
24722
  }, "vocabularySimilarity");
24662
24723
 
24663
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
24724
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
24664
24725
  import { createHash } from "node:crypto";
24665
24726
  var folded2 = /* @__PURE__ */ __name((name) => {
24666
24727
  try {
@@ -24726,7 +24787,7 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind3, by, options
24726
24787
  });
24727
24788
  }, "guardTagCreation");
24728
24789
 
24729
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
24790
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
24730
24791
  var invalid = /* @__PURE__ */ __name((message2) => {
24731
24792
  throw new CliError("validation_error", message2);
24732
24793
  }, "invalid");
@@ -24803,7 +24864,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
24803
24864
  };
24804
24865
  }, "createTagRedirectIndex");
24805
24866
 
24806
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
24867
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
24807
24868
  var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
24808
24869
  const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
24809
24870
  if (!row2)
@@ -24831,7 +24892,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
24831
24892
  return snapshot2;
24832
24893
  }, "tagRedirectSnapshot");
24833
24894
 
24834
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
24895
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
24835
24896
  import { createHash as createHash2 } from "node:crypto";
24836
24897
  var TASK_KEY_PREFIXES = {
24837
24898
  question: "Q",
@@ -24859,7 +24920,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
24859
24920
  return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
24860
24921
  }, "taskAccountOf");
24861
24922
 
24862
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
24923
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
24863
24924
  var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
24864
24925
  var REFERABLE = {
24865
24926
  note: { tombstone: true },
@@ -24876,6 +24937,8 @@ var REFERABLE = {
24876
24937
  payment: { tombstone: true },
24877
24938
  order: { tombstone: true },
24878
24939
  deal: { tombstone: true },
24940
+ lead: { tombstone: true },
24941
+ pipeline: { tombstone: false },
24879
24942
  message: { tombstone: true },
24880
24943
  email: { tombstone: true },
24881
24944
  email_thread: { tombstone: true },
@@ -25025,11 +25088,11 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
25025
25088
  return row2 ? String(row2.id ?? row2.key) : void 0;
25026
25089
  }, "taskIdOf");
25027
25090
 
25028
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
25029
- var toMs = /* @__PURE__ */ __name((iso13) => {
25030
- if (iso13 === null || iso13 === void 0)
25091
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
25092
+ var toMs = /* @__PURE__ */ __name((iso14) => {
25093
+ if (iso14 === null || iso14 === void 0)
25031
25094
  return null;
25032
- const ms = Date.parse(iso13);
25095
+ const ms = Date.parse(iso14);
25033
25096
  return Number.isNaN(ms) ? null : ms;
25034
25097
  }, "toMs");
25035
25098
  var toIso = /* @__PURE__ */ __name((ms) => typeof ms === "number" ? new Date(ms).toISOString() : null, "toIso");
@@ -25039,7 +25102,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
25039
25102
  var DELIVERY = { delivered: 1, read: 2 };
25040
25103
  var deliveryOf = /* @__PURE__ */ __name((stored3) => stored3 === DELIVERY.read ? "read" : stored3 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
25041
25104
 
25042
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
25105
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
25043
25106
  var TAG_KINDS = ["tag", "topic"];
25044
25107
  var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
25045
25108
  var TAG_TYPE = {
@@ -25242,7 +25305,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
25242
25305
  return result;
25243
25306
  }, "tagsOf");
25244
25307
 
25245
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
25308
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
25246
25309
  var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
25247
25310
  var SPEECH = speech("att");
25248
25311
  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");
@@ -25606,7 +25669,7 @@ var FIELD_COMPILERS = {
25606
25669
  subject
25607
25670
  };
25608
25671
 
25609
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
25672
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
25610
25673
  var placeOf = /* @__PURE__ */ __name((database) => {
25611
25674
  const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
25612
25675
  const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
@@ -25622,7 +25685,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
25622
25685
  };
25623
25686
  }, "placeOf");
25624
25687
 
25625
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
25688
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
25626
25689
  var DRAIN_ON_WRITE = 500;
25627
25690
  var METHOD = "rules";
25628
25691
  var telegramLink = /* @__PURE__ */ __name((database) => {
@@ -25785,7 +25848,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
25785
25848
  return queued.length;
25786
25849
  }, "drainMentions");
25787
25850
 
25788
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
25851
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
25789
25852
  var indexRow = /* @__PURE__ */ __name((database, name) => {
25790
25853
  const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
25791
25854
  if (!exists2)
@@ -25793,7 +25856,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
25793
25856
  return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
25794
25857
  }, "indexRow");
25795
25858
 
25796
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
25859
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
25797
25860
  var INDEX = "message_stems";
25798
25861
  var SETTING2 = "searchStemmers";
25799
25862
  var DRAIN_ON_WRITE2 = 500;
@@ -25915,7 +25978,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
25915
25978
  };
25916
25979
  }, "stemmerCache");
25917
25980
 
25918
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
25981
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
25919
25982
  var SQLITE_BUSY = 5;
25920
25983
  var pause = new Int32Array(new SharedArrayBuffer(4));
25921
25984
  var isBusy = /* @__PURE__ */ __name((error) => {
@@ -26010,7 +26073,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
26010
26073
  }
26011
26074
  }, "read");
26012
26075
 
26013
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
26076
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
26014
26077
  var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
26015
26078
  coalesce(CASE k.chunkable_type
26016
26079
  WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
@@ -26152,7 +26215,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
26152
26215
  }, "dropUnusedVectors");
26153
26216
  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");
26154
26217
 
26155
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
26218
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
26156
26219
  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({
26157
26220
  target: [accounts.provider, accounts.externalId],
26158
26221
  set: {
@@ -26261,7 +26324,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
26261
26324
  AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
26262
26325
  }, "dropOrphanPeople");
26263
26326
 
26264
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
26327
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
26265
26328
  var FOLDED = [
26266
26329
  { table: "tasks", column: "title" },
26267
26330
  { table: "tasks", column: "close_reason" },
@@ -26298,7 +26361,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
26298
26361
  return filled2;
26299
26362
  }, "fillFolded");
26300
26363
 
26301
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/history-skips.js
26364
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/history-skips.js
26302
26365
  var HISTORY_KEY = "$history";
26303
26366
  var objectOf = /* @__PURE__ */ __name((text6) => {
26304
26367
  if (typeof text6 !== "string")
@@ -26374,7 +26437,7 @@ var withoutHistory = /* @__PURE__ */ __name((metadata3) => {
26374
26437
  return rest;
26375
26438
  }, "withoutHistory");
26376
26439
 
26377
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
26440
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
26378
26441
  import { createHash as createHash3 } from "node:crypto";
26379
26442
  var CHUNK_CHARS = 1200;
26380
26443
  var CHUNK_OVERLAP = 150;
@@ -26479,7 +26542,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
26479
26542
  return chunks2;
26480
26543
  }, "cutChunks");
26481
26544
 
26482
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/search/task-signature.js
26545
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/search/task-signature.js
26483
26546
  var DAY = 864e5;
26484
26547
  var CURRENCY = [
26485
26548
  [/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
@@ -26605,7 +26668,7 @@ var dueDayOf = /* @__PURE__ */ __name((text6, createdMs) => {
26605
26668
  return best?.day ?? null;
26606
26669
  }, "dueDayOf");
26607
26670
 
26608
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
26671
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
26609
26672
  var DAY2 = 864e5;
26610
26673
  var STOP_WORDS = new Set([
26611
26674
  // Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
@@ -26760,7 +26823,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
26760
26823
  ...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
26761
26824
  })).sort((a, b) => b.score - a.score), "rankCandidates");
26762
26825
 
26763
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
26826
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
26764
26827
  var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
26765
26828
  r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
26766
26829
  JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
@@ -27031,7 +27094,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
27031
27094
  };
27032
27095
  }, "readiness");
27033
27096
 
27034
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
27097
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
27035
27098
  var DOCUMENT_PICTURE = "document_picture";
27036
27099
  var SCAN_PAGE2 = 5e3;
27037
27100
  var idOf = /* @__PURE__ */ __name((ref3) => {
@@ -27094,7 +27157,7 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
27094
27157
  }, "nearestPictures")
27095
27158
  }), "documentPicturesOver");
27096
27159
 
27097
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
27160
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
27098
27161
  var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
27099
27162
  const literal4 = escaped2 ?? plain2 ?? "";
27100
27163
  return wildcard ?? (/[*?[]/u.test(literal4) ? `[${literal4}]` : literal4);
@@ -27159,7 +27222,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
27159
27222
  var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
27160
27223
  var bound2 = /* @__PURE__ */ __name(({ sql: text6, params }) => sql.join(text6.split("?").map((part, at) => at < params.length ? sql`${sql.raw(part)}${params[at]}` : sql.raw(part)), sql``), "bound");
27161
27224
 
27162
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
27225
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
27163
27226
  var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
27164
27227
  var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
27165
27228
  var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
@@ -27249,7 +27312,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
27249
27312
  });
27250
27313
  }, "linkMeeting");
27251
27314
 
27252
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
27315
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
27253
27316
  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), ''))";
27254
27317
  var UNSEARCHED_EVENT_TYPES = [
27255
27318
  "working-location",
@@ -27479,7 +27542,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
27479
27542
  return true;
27480
27543
  }, "resetNoteIndex");
27481
27544
 
27482
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
27545
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
27483
27546
  var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
27484
27547
  var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
27485
27548
  for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
@@ -27498,7 +27561,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
27498
27561
  }
27499
27562
  }, "resolvePersonLinks");
27500
27563
 
27501
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
27564
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
27502
27565
  var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
27503
27566
  var prepare = /* @__PURE__ */ __name((orm) => ({
27504
27567
  find: orm.select({
@@ -27723,7 +27786,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
27723
27786
  }, "meetingIdentityPk");
27724
27787
  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");
27725
27788
 
27726
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
27789
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
27727
27790
  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");
27728
27791
  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");
27729
27792
  var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
@@ -28003,7 +28066,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
28003
28066
  }
28004
28067
  }, "replaceAutoTags");
28005
28068
 
28006
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/context/evidence.js
28069
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/context/evidence.js
28007
28070
  import { createHash as createHash4 } from "node:crypto";
28008
28071
  var CONTEXT_MAX_READ_BYTES = 262144;
28009
28072
  var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
@@ -28101,7 +28164,7 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
28101
28164
  return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
28102
28165
  }, "contextEvidenceRequest");
28103
28166
 
28104
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/email-activity.js
28167
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/email-activity.js
28105
28168
  var MAIL_AGENDA_COLUMNS = { chat_kind: { type: "enum", sql: "'dialog'" } };
28106
28169
  var ACTIVITY = `
28107
28170
  SELECT t.external_id AS thread, t.subject, t.last_email_at, t.emails_count,
@@ -28218,7 +28281,7 @@ var mailActivity = /* @__PURE__ */ __name((database) => ({
28218
28281
  threadActivity: /* @__PURE__ */ __name(async (accountId, since, where) => threadActivity(database, accountId, since, where), "threadActivity")
28219
28282
  }), "mailActivity");
28220
28283
 
28221
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
28284
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
28222
28285
  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");
28223
28286
  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;
28224
28287
  var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
@@ -28299,7 +28362,7 @@ var mailCore = /* @__PURE__ */ __name((body2, earlier) => {
28299
28362
  return withoutSignOff(withoutGreeting(kept)).join("\n").trim();
28300
28363
  }, "mailCore");
28301
28364
 
28302
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
28365
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
28303
28366
  var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
28304
28367
  var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
28305
28368
  k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
@@ -28409,7 +28472,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
28409
28472
  return emails3 + threads;
28410
28473
  }, "drainEmailIndex");
28411
28474
 
28412
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
28475
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
28413
28476
  var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
28414
28477
  SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
28415
28478
  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,
@@ -28507,7 +28570,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
28507
28570
  var backfillSentAt = /* @__PURE__ */ __name((database, accountId, limit) => Number(database.prepare(`UPDATE emails SET sent_at = received_at WHERE id IN (
28508
28571
  SELECT id FROM emails WHERE account_id = ? AND sent_at IS NULL AND received_at IS NOT NULL LIMIT ?)`).run(accountId, limit).changes), "backfillSentAt");
28509
28572
 
28510
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
28573
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
28511
28574
  var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
28512
28575
  emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
28513
28576
  last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
@@ -28557,7 +28620,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
28557
28620
  return threads.length;
28558
28621
  }, "markEmailsRestored");
28559
28622
 
28560
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
28623
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
28561
28624
  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");
28562
28625
  var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
28563
28626
  var ruleOf = /* @__PURE__ */ __name((row2) => ({
@@ -28624,7 +28687,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
28624
28687
  }
28625
28688
  }), "mailRulesOver");
28626
28689
 
28627
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
28690
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
28628
28691
  var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
28629
28692
  database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
28630
28693
  VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
@@ -28632,7 +28695,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
28632
28695
  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);
28633
28696
  }, "reviewLink");
28634
28697
 
28635
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
28698
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
28636
28699
  function checkMeetingCancelled(signal) {
28637
28700
  if (!signal?.aborted)
28638
28701
  return;
@@ -28643,7 +28706,7 @@ function checkMeetingCancelled(signal) {
28643
28706
  }
28644
28707
  __name(checkMeetingCancelled, "checkMeetingCancelled");
28645
28708
 
28646
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
28709
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
28647
28710
  var meetingOf = /* @__PURE__ */ __name((row2) => ({
28648
28711
  id: Number(row2.id),
28649
28712
  accountId: Number(row2.account_id),
@@ -28693,7 +28756,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
28693
28756
  createdAt: Number(row2.created_at)
28694
28757
  }), "transcriptRowOf");
28695
28758
 
28696
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
28759
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
28697
28760
  var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
28698
28761
  var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
28699
28762
  var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
@@ -28860,7 +28923,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
28860
28923
  }
28861
28924
  }), "meetingReadsOver");
28862
28925
 
28863
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
28926
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
28864
28927
  var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
28865
28928
  const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
28866
28929
  const params = [input.accountId];
@@ -28903,7 +28966,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
28903
28966
  return { clauses, params };
28904
28967
  }, "meetingSelectionSql");
28905
28968
 
28906
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
28969
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
28907
28970
  var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
28908
28971
  async meetingChatLines(input) {
28909
28972
  checkMeetingCancelled(input.signal);
@@ -28931,7 +28994,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
28931
28994
  }
28932
28995
  }), "meetingChatLinesOver");
28933
28996
 
28934
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
28997
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
28935
28998
  var MESSAGE_FIELDS = {
28936
28999
  pk: messages.id,
28937
29000
  nativeId: messages.externalId,
@@ -29102,7 +29165,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
29102
29165
  storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
29103
29166
  }), "chatActivity");
29104
29167
 
29105
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
29168
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
29106
29169
  var HIT_FIELDS = {
29107
29170
  ...MESSAGE_FIELDS,
29108
29171
  chatTitle: sql`${chats.title}`.as("chat_title"),
@@ -29201,7 +29264,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
29201
29264
  };
29202
29265
  }, "directReplies");
29203
29266
 
29204
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
29267
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
29205
29268
  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");
29206
29269
  var required = /* @__PURE__ */ __name((context, ref3) => {
29207
29270
  const found2 = identityRow(context, ref3);
@@ -29332,7 +29395,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
29332
29395
  }, "mentioning");
29333
29396
  var escaped = /* @__PURE__ */ __name((text6) => text6.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
29334
29397
 
29335
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
29398
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
29336
29399
  var missing2 = /* @__PURE__ */ __name(() => {
29337
29400
  throw new CliError("not_found", "Meeting, participant or selected target not found");
29338
29401
  }, "missing");
@@ -29454,7 +29517,7 @@ function meetingContextLinksOver(context) {
29454
29517
  }
29455
29518
  __name(meetingContextLinksOver, "meetingContextLinksOver");
29456
29519
 
29457
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
29520
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
29458
29521
  var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
29459
29522
  var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
29460
29523
  var summaryOf = /* @__PURE__ */ __name((row2) => ({
@@ -29483,7 +29546,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
29483
29546
  return row2 ? summaryText(summaryOf(row2)) : null;
29484
29547
  }, "indexedText");
29485
29548
 
29486
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
29549
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
29487
29550
  var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
29488
29551
  var meetingCurrentIndexRows = `
29489
29552
  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
@@ -29514,7 +29577,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
29514
29577
  }, "invalidateMeetingStems");
29515
29578
  var meetingStemmableText = /* @__PURE__ */ __name((text6) => text6.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
29516
29579
 
29517
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
29580
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
29518
29581
  function meetingHitIndexOver({ database, now: now2 }) {
29519
29582
  return {
29520
29583
  async indexSearch(original) {
@@ -29582,10 +29645,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
29582
29645
  }
29583
29646
  __name(meetingHitIndexOver, "meetingHitIndexOver");
29584
29647
 
29585
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
29648
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
29586
29649
  import { createHash as createHash5 } from "node:crypto";
29587
29650
 
29588
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/search/trigrams.js
29651
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/search/trigrams.js
29589
29652
  var trigrams = /* @__PURE__ */ __name((term) => {
29590
29653
  const padded = ` ${term} `;
29591
29654
  const pieces = /* @__PURE__ */ new Set();
@@ -29594,7 +29657,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
29594
29657
  return [...pieces];
29595
29658
  }, "trigrams");
29596
29659
 
29597
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/search/correct.js
29660
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/search/correct.js
29598
29661
  var SHORTEST_CORRECTION = 3;
29599
29662
  var maxEdits = /* @__PURE__ */ __name((word2) => word2.length <= 4 ? 1 : 2, "maxEdits");
29600
29663
  var editDistance = /* @__PURE__ */ __name((a, b, max) => {
@@ -29641,7 +29704,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
29641
29704
  return corrections;
29642
29705
  }, "correctWords");
29643
29706
 
29644
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/search/garbled.js
29707
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/search/garbled.js
29645
29708
  var SHORTEST_GARBLED = 4;
29646
29709
  var MOST_WIDENED = 64;
29647
29710
  var plain = /* @__PURE__ */ __name((word2) => word2.replaceAll("\u044D", "\u0435"), "plain");
@@ -29733,7 +29796,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
29733
29796
  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));
29734
29797
  }, "widenWords");
29735
29798
 
29736
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
29799
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
29737
29800
  import { readFileSync } from "node:fs";
29738
29801
  var loaded;
29739
29802
  var dictionary = /* @__PURE__ */ __name(() => {
@@ -29792,7 +29855,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word2) => {
29792
29855
  return false;
29793
29856
  }, "knownRussianWord");
29794
29857
 
29795
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
29858
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
29796
29859
  var WORD2 = /[\p{L}\p{N}\p{M}]+/gu;
29797
29860
  var MOST_WORDS = 128;
29798
29861
  var quote = /* @__PURE__ */ __name((word2) => `"${word2.replaceAll('"', '""')}"`, "quote");
@@ -30019,7 +30082,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text6, stemmer) => {
30019
30082
  return check3(tree);
30020
30083
  }, "matchMeetingText");
30021
30084
 
30022
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
30085
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
30023
30086
  var fail3 = /* @__PURE__ */ __name((message2) => {
30024
30087
  throw new CliError("validation_error", message2);
30025
30088
  }, "fail");
@@ -30201,7 +30264,7 @@ function meetingHitSearchOver({ database }) {
30201
30264
  }
30202
30265
  __name(meetingHitSearchOver, "meetingHitSearchOver");
30203
30266
 
30204
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-languages.js
30267
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-languages.js
30205
30268
  var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
30206
30269
  async fillTranscriptLanguages({ accountId, apply, now: now2 }) {
30207
30270
  positiveReadInteger(accountId, "accountId");
@@ -30233,7 +30296,7 @@ var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
30233
30296
  }
30234
30297
  }), "meetingLanguagesOver");
30235
30298
 
30236
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
30299
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
30237
30300
  import { createHash as createHash6 } from "node:crypto";
30238
30301
  var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
30239
30302
  if (value === void 0)
@@ -30323,7 +30386,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
30323
30386
  }
30324
30387
  }), "meetingParticipantSearchOver");
30325
30388
 
30326
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
30389
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
30327
30390
  var preparationQueries = {
30328
30391
  participants: {
30329
30392
  fields: "p.id, p.identity_id, p.display_name, l.person_id",
@@ -30373,7 +30436,7 @@ var preparationQueries = {
30373
30436
  }
30374
30437
  };
30375
30438
 
30376
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
30439
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
30377
30440
  var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
30378
30441
  async preparationContext(original) {
30379
30442
  const input = validateMeetingPreparationContext(original);
@@ -30414,7 +30477,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
30414
30477
  }
30415
30478
  }), "meetingPreparationContextOver");
30416
30479
 
30417
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
30480
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
30418
30481
  var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
30419
30482
  SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
30420
30483
  WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
@@ -30428,7 +30491,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
30428
30491
  JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
30429
30492
  )`, "preparationSubjects");
30430
30493
 
30431
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
30494
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
30432
30495
  var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
30433
30496
  async preparationKnowledge(original) {
30434
30497
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -30473,7 +30536,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
30473
30536
  }
30474
30537
  }), "meetingPreparationKnowledgeOver");
30475
30538
 
30476
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
30539
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
30477
30540
  var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
30478
30541
  async preparationNotes(original) {
30479
30542
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -30526,7 +30589,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
30526
30589
  }
30527
30590
  }), "meetingPreparationNotesOver");
30528
30591
 
30529
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
30592
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
30530
30593
  var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
30531
30594
  async relatedHistory(original) {
30532
30595
  const input = validateMeetingRelatedHistory(original);
@@ -30597,7 +30660,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
30597
30660
  }
30598
30661
  }), "meetingRelatedHistoryOver");
30599
30662
 
30600
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
30663
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
30601
30664
  var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
30602
30665
  var text2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
30603
30666
  var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
@@ -30678,7 +30741,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
30678
30741
  }
30679
30742
  }), "meetingReviewOver");
30680
30743
 
30681
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
30744
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
30682
30745
  var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
30683
30746
  var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
30684
30747
  if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
@@ -30732,7 +30795,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
30732
30795
  }
30733
30796
  }), "meetingSeriesHistoryOver");
30734
30797
 
30735
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
30798
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
30736
30799
  var MOST_ROWS = 5e5;
30737
30800
  var meetingCountsSql = /* @__PURE__ */ __name((where) => `SELECT m.started_at, coalesce(m.duration_ms, m.ended_at - m.started_at) AS duration_ms,
30738
30801
  EXISTS (SELECT 1 FROM meeting_transcripts t WHERE t.meeting_id = m.id AND t.deleted_at IS NULL
@@ -30801,7 +30864,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
30801
30864
  }
30802
30865
  }), "meetingStatsOver");
30803
30866
 
30804
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
30867
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
30805
30868
  var CURSOR_KEY = "meetings";
30806
30869
  var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
30807
30870
  id: Number(row2.id),
@@ -31370,7 +31433,7 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
31370
31433
  };
31371
31434
  }, "meetingStoreOver");
31372
31435
 
31373
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
31436
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
31374
31437
  var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
31375
31438
  const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
31376
31439
  return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
@@ -31396,7 +31459,7 @@ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
31396
31459
  orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
31397
31460
  }, "release");
31398
31461
 
31399
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
31462
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
31400
31463
  var THREAD_COLUMNS = {
31401
31464
  subject: {
31402
31465
  where: /* @__PURE__ */ __name(({ value }) => ({
@@ -31413,7 +31476,7 @@ var threadRows = /* @__PURE__ */ __name((database, filter) => {
31413
31476
  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);
31414
31477
  }, "threadRows");
31415
31478
 
31416
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
31479
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
31417
31480
  var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
31418
31481
  id: `email:${place.emailId}`,
31419
31482
  chatId: place.threadExternalId,
@@ -31969,7 +32032,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
31969
32032
  }
31970
32033
  }), "mailStoreOver");
31971
32034
 
31972
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/search/dictionary.js
32035
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/search/dictionary.js
31973
32036
  import { readFileSync as readFileSync2 } from "node:fs";
31974
32037
  var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
31975
32038
  var folded4 = /* @__PURE__ */ __name((word2) => /^[а-яё'-]*$/.test(word2) ? word2.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word2), "folded");
@@ -32059,7 +32122,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
32059
32122
  }, "knownWord");
32060
32123
  var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
32061
32124
 
32062
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
32125
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
32063
32126
  var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
32064
32127
  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");
32065
32128
  var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
@@ -32145,7 +32208,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
32145
32208
  return found2;
32146
32209
  }, "spokenTranscripts");
32147
32210
 
32148
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
32211
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
32149
32212
  var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
32150
32213
  const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
32151
32214
  if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
@@ -32192,7 +32255,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
32192
32255
  });
32193
32256
  }, "placeHits");
32194
32257
 
32195
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-groups.js
32258
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-groups.js
32196
32259
  var GROUPS = {
32197
32260
  chat: {
32198
32261
  key: "m.chat_id",
@@ -32214,7 +32277,7 @@ var GROUPS = {
32214
32277
  }
32215
32278
  };
32216
32279
 
32217
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
32280
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
32218
32281
  var MESSAGES2 = {
32219
32282
  rows: "messages",
32220
32283
  threads: "chats",
@@ -32697,7 +32760,7 @@ var runCompiled = /* @__PURE__ */ __name(async (context, execution, by) => {
32697
32760
  };
32698
32761
  }, "runCompiled");
32699
32762
 
32700
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
32763
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
32701
32764
  function invalidMetadata() {
32702
32765
  throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
32703
32766
  }
@@ -32799,7 +32862,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
32799
32862
  };
32800
32863
  }), "counterTargets");
32801
32864
 
32802
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
32865
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
32803
32866
  var NOT_FILE_LIST = [...NOT_FILES].map((kind3) => `'${kind3}'`).join(",");
32804
32867
  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,
32805
32868
  att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
@@ -32918,7 +32981,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
32918
32981
  }));
32919
32982
  }, "attachmentViews");
32920
32983
 
32921
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
32984
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
32922
32985
  var transcript = /* @__PURE__ */ __name(({ orm }, chatKey, messageId) => orm.select({ text: messageTranscripts.text, source: messageTranscripts.source }).from(messageTranscripts).where(and(eq(messageTranscripts.chatId, chatKey), eq(messageTranscripts.messageExternalId, messageId))).get(), "transcript");
32923
32986
  var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text6, source2) => {
32924
32987
  const { orm, database, now: now2 } = context;
@@ -32956,7 +33019,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
32956
33019
  keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
32957
33020
  }, "intoVoiceAttachment");
32958
33021
 
32959
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
33022
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
32960
33023
  var FIELDS = [
32961
33024
  "threadExternalId",
32962
33025
  "senderIdentityId",
@@ -33273,7 +33336,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
33273
33336
  reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
33274
33337
  }, "writeDerivedReactions");
33275
33338
 
33276
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/keys.js
33339
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/keys.js
33277
33340
  var keysOver = /* @__PURE__ */ __name((context) => {
33278
33341
  const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
33279
33342
  const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
@@ -33294,7 +33357,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
33294
33357
  };
33295
33358
  }, "keysOver");
33296
33359
 
33297
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
33360
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
33298
33361
  var accountGroupsOf = /* @__PURE__ */ __name((database) => {
33299
33362
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
33300
33363
  if (!row2)
@@ -33329,7 +33392,7 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
33329
33392
  database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
33330
33393
  }, "saveProfile");
33331
33394
 
33332
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
33395
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
33333
33396
  var BOT_KINDS = ["agent", "rule", "script", "integration"];
33334
33397
  var ownerPerson = /* @__PURE__ */ __name((database) => {
33335
33398
  const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
@@ -33386,7 +33449,7 @@ var proposedBySql = /* @__PURE__ */ __name((type, id2, by) => {
33386
33449
  return { sql: bot("pb.name = ?"), params: [by.bot] };
33387
33450
  }, "proposedBySql");
33388
33451
 
33389
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
33452
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
33390
33453
  var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
33391
33454
  const owner = ownerPerson(context.database).id;
33392
33455
  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);
@@ -33407,7 +33470,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
33407
33470
  return personOf(context, ref3);
33408
33471
  }, "linkToOwner");
33409
33472
 
33410
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
33473
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
33411
33474
  var PROVIDERS_SETTING = "providers";
33412
33475
  var storedProvidersOf = /* @__PURE__ */ __name((database) => {
33413
33476
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
@@ -33442,7 +33505,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
33442
33505
  });
33443
33506
  }, "registerProvider");
33444
33507
 
33445
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
33508
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
33446
33509
  var DAY3 = 864e5;
33447
33510
  var RECENTLY_CLOSED_MS = 14 * DAY3;
33448
33511
  var TEXT_LIMIT = 20;
@@ -33641,7 +33704,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
33641
33704
  };
33642
33705
  }, "taskSimilarityOver");
33643
33706
 
33644
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
33707
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
33645
33708
  var SETTING3 = "taskCategories";
33646
33709
  var savedTaskCategories = /* @__PURE__ */ __name((database) => {
33647
33710
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
@@ -33660,7 +33723,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
33660
33723
  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);
33661
33724
  }, "saveTaskCategories");
33662
33725
 
33663
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
33726
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
33664
33727
  var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
33665
33728
  var ALLOWED = "taskAgentClose";
33666
33729
  var MIN = "taskAgentCloseMin";
@@ -33716,10 +33779,10 @@ var SUGGESTION_COLUMNS = [
33716
33779
  ];
33717
33780
  var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
33718
33781
 
33719
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/mail-findings.js
33782
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/mail-findings.js
33720
33783
  var MAIL_FINDINGS_KIND = "mail_findings";
33721
33784
 
33722
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/decisions.js
33785
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/decisions.js
33723
33786
  var TASK_CLOSE_KIND = "task_close";
33724
33787
  var DEFAULT_DECISION_POLICY = { agentDecisions: false, ruleProposalsOwnerOnly: true };
33725
33788
  var isOwnerOnlyKind = /* @__PURE__ */ __name((kind3) => kind3 === MAIL_FINDINGS_KIND || kind3 === MEETING_FINDINGS_KIND || kind3 === TASK_CLOSE_KIND, "isOwnerOnlyKind");
@@ -33767,10 +33830,10 @@ var assertMayDecide = /* @__PURE__ */ __name((row2, by, policy = DEFAULT_DECISIO
33767
33830
  }, "assertMayDecide");
33768
33831
  var deciderAuthor = /* @__PURE__ */ __name((by) => by === "owner" ? "owner" : { bot: by.bot, ...by.model === void 0 ? {} : { model: by.model } }, "deciderAuthor");
33769
33832
 
33770
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/ref-summaries.js
33833
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/ref-summaries.js
33771
33834
  var oneLine = /* @__PURE__ */ __name((text6) => singleLine(text6.replace(/\s+/g, " ").trim()), "oneLine");
33772
33835
 
33773
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/ref-summaries.js
33836
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/ref-summaries.js
33774
33837
  var EXCERPT_CHARS = 280;
33775
33838
  var TITLE_CHARS = 120;
33776
33839
  var MEMORY_TITLE_CHARS = 80;
@@ -33793,6 +33856,12 @@ var byId = /* @__PURE__ */ __name((kind3, table, columns) => ({
33793
33856
  kind: kind3,
33794
33857
  sql: /* @__PURE__ */ __name((body2) => `${select(columns(body2))} FROM w JOIN ${table} x ON x.id = w.k1`, "sql")
33795
33858
  }), "byId");
33859
+ var crmColumns = /* @__PURE__ */ __name(() => ({
33860
+ title: "json_object('id', x.id, 'title', x.title, 'stage', (SELECT name FROM pipeline_stages WHERE id = x.stage_id), 'amount', x.amount, 'currency', x.currency, 'status', x.status)",
33861
+ holder: "(SELECT name FROM projects WHERE id = x.project_id)",
33862
+ at: "x.created_at",
33863
+ deleted: "x.deleted_at"
33864
+ }), "crmColumns");
33796
33865
  var READERS = {
33797
33866
  message: {
33798
33867
  kind: "message",
@@ -33945,12 +34014,9 @@ var READERS = {
33945
34014
  at: "x.created_at",
33946
34015
  deleted: "x.deleted_at"
33947
34016
  })),
33948
- deal: byId("deal", "opportunities", () => ({
33949
- title: "json_object('id', x.id, 'title', x.title, 'stage', (SELECT name FROM pipeline_stages WHERE id = x.stage_id), 'amount', x.amount, 'currency', x.currency, 'status', x.status, 'review', x.review)",
33950
- holder: "(SELECT name FROM projects WHERE id = x.project_id)",
33951
- at: "x.created_at",
33952
- deleted: "x.deleted_at"
33953
- }))
34017
+ deal: byId("deal", "deals", crmColumns),
34018
+ lead: byId("lead", "leads", crmColumns),
34019
+ pipeline: byId("pipeline", "pipelines", () => ({ title: "x.name", at: "x.created_at" }))
33954
34020
  };
33955
34021
  var FALLBACK = { email: "message", email_thread: "chat" };
33956
34022
  var route = /* @__PURE__ */ __name((reference2) => {
@@ -34042,6 +34108,7 @@ var titleOf2 = /* @__PURE__ */ __name((kind3, reference2, found2) => {
34042
34108
  case "order":
34043
34109
  return fieldsOf2(found2.title, orderLine);
34044
34110
  case "deal":
34111
+ case "lead":
34045
34112
  return fieldsOf2(found2.title, dealLine);
34046
34113
  case "folder":
34047
34114
  return reference2.type === "folder" && reference2.path !== null && found2.title !== null ? `${found2.title}/${reference2.path}` : found2.title;
@@ -34139,7 +34206,7 @@ var refReadsOf = /* @__PURE__ */ __name((database, texts2, { excerpt = false } =
34139
34206
  var summaryOf2 = /* @__PURE__ */ __name(({ sender, excerpt, ...summary }, withExcerpt) => withExcerpt ? { ...summary, excerpt } : summary, "summaryOf");
34140
34207
  var refSummariesOf = /* @__PURE__ */ __name((database, texts2, options = {}) => new Map([...refReadsOf(database, texts2, options)].map(([text6, read2]) => [text6, summaryOf2(read2, options.excerpt === true)])), "refSummariesOf");
34141
34208
 
34142
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
34209
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
34143
34210
  var sourceOf3 = /* @__PURE__ */ __name((read2, ref3) => ({
34144
34211
  ref: ref3,
34145
34212
  kind: read2.kind,
@@ -34175,7 +34242,7 @@ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => {
34175
34242
  });
34176
34243
  }, "evidenceSourcesOf");
34177
34244
 
34178
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/attachments/limits.js
34245
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/attachments/limits.js
34179
34246
  var MAX_FILE_BYTES = 50 * 1024 * 1024;
34180
34247
  var MAX_TEXT_CHARS = 2e6;
34181
34248
  var ATTACHMENT_LIMIT_ENV = [
@@ -34201,7 +34268,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
34201
34268
  return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
34202
34269
  }, "pdfPreviewLimits");
34203
34270
 
34204
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/ulid.js
34271
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/ulid.js
34205
34272
  import { randomBytes } from "node:crypto";
34206
34273
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
34207
34274
  var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
@@ -34214,7 +34281,7 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
34214
34281
  return time3 + random;
34215
34282
  }, "ulid");
34216
34283
 
34217
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
34284
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
34218
34285
  var FOLDED_FIELDS = ["title", "site", "language", "author"];
34219
34286
  var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
34220
34287
  if (!meta && !sections?.length)
@@ -34235,7 +34302,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
34235
34302
  return typeof language === "string" && language !== "" ? language : null;
34236
34303
  }, "languageOf");
34237
34304
 
34238
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
34305
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
34239
34306
  var isObject = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
34240
34307
  var objectOf2 = /* @__PURE__ */ __name((value) => {
34241
34308
  if (isObject(value))
@@ -34478,7 +34545,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
34478
34545
  };
34479
34546
  }, "filesStoreOver");
34480
34547
 
34481
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
34548
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
34482
34549
  var IMPORTED_DOCUMENT_QUERY = defineQuery({
34483
34550
  entity: "document",
34484
34551
  backend: "sql",
@@ -34524,7 +34591,7 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
34524
34591
  return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
34525
34592
  }, "importedDocumentWhere");
34526
34593
 
34527
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
34594
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
34528
34595
  var NOTE_FORMATS = ["obsidian", "markdown"];
34529
34596
  var iso2 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
34530
34597
  var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso2(value), "optionalIso");
@@ -35050,7 +35117,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
35050
35117
  };
35051
35118
  }, "notesStoreOver");
35052
35119
 
35053
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
35120
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
35054
35121
  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";
35055
35122
  var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
35056
35123
  var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -35272,7 +35339,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
35272
35339
  };
35273
35340
  }, "memoriesStoreOver");
35274
35341
 
35275
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
35342
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
35276
35343
  var DEFAULT_FIRST_PASS_PER_CHAT = 0;
35277
35344
  var KEY = "taskFirstPassPerChat";
35278
35345
  var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
@@ -35292,7 +35359,7 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
35292
35359
  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);
35293
35360
  }, "saveFirstPassPerChat");
35294
35361
 
35295
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/external-links.js
35362
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/external-links.js
35296
35363
  var EXTERNAL_SERVICE = /^[a-z][a-z0-9-]{0,31}$/;
35297
35364
  var EXTERNAL_ID_CHARS = 200;
35298
35365
  var SOURCE_URL_CHARS = 2e3;
@@ -35319,7 +35386,7 @@ var sourceUrlOf = /* @__PURE__ */ __name((value, reason = "task.source-url") =>
35319
35386
  return text6;
35320
35387
  }, "sourceUrlOf");
35321
35388
 
35322
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
35389
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
35323
35390
  var field = /* @__PURE__ */ __name((name, type, example, more = {}) => ({
35324
35391
  name,
35325
35392
  type,
@@ -35541,7 +35608,7 @@ var withoutField = /* @__PURE__ */ __name((query, name) => {
35541
35608
  return root === void 0 ? void 0 : { ...query, root };
35542
35609
  }, "withoutField");
35543
35610
 
35544
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
35611
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
35545
35612
  var authorNamed = /* @__PURE__ */ __name((database, row2) => {
35546
35613
  if (row2.author_type == null)
35547
35614
  return null;
@@ -35569,7 +35636,7 @@ var addComment = /* @__PURE__ */ __name((context, task, body2, by) => {
35569
35636
  return commentsOf(database, task).find((one2) => one2.ref === `note:${made}`);
35570
35637
  }, "addComment");
35571
35638
 
35572
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
35639
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
35573
35640
  var TASK_RELATION_KINDS = [
35574
35641
  "blocked-by",
35575
35642
  "follow-up-of",
@@ -35699,7 +35766,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
35699
35766
  };
35700
35767
  }, "taskRelationsStoreOver");
35701
35768
 
35702
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
35769
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
35703
35770
  var TASK_ROLES = ["assignee", "reviewer", "watcher"];
35704
35771
  var iso4 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
35705
35772
  var recordTaskEvent = /* @__PURE__ */ __name((database, task, actor, kind3, changes, at) => {
@@ -36228,7 +36295,7 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
36228
36295
  };
36229
36296
  }, "workTasksOver");
36230
36297
 
36231
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
36298
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
36232
36299
  var taskCloseOver = /* @__PURE__ */ __name((context) => {
36233
36300
  const { database, now: now2 } = context;
36234
36301
  const liveRow = /* @__PURE__ */ __name((id2) => {
@@ -36277,7 +36344,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
36277
36344
  };
36278
36345
  }, "taskCloseOver");
36279
36346
 
36280
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
36347
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
36281
36348
  var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
36282
36349
  const { database, now: now2 } = context;
36283
36350
  const required3 = /* @__PURE__ */ __name((id2) => {
@@ -36495,7 +36562,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
36495
36562
  };
36496
36563
  }, "taskPairsOver");
36497
36564
 
36498
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-stats.js
36565
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/task-stats.js
36499
36566
  var ACCOUNT_SCOPE = "t.package_id IS NOT NULL AND t.deleted_at IS NULL AND t.project_id = ?";
36500
36567
  var TASK_STATS_SQL = {
36501
36568
  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"),
@@ -36534,7 +36601,7 @@ var taskStatsOver = /* @__PURE__ */ __name(({ database }, inbox) => ({
36534
36601
  }, "statNames")
36535
36602
  }), "taskStatsOver");
36536
36603
 
36537
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
36604
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
36538
36605
  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";
36539
36606
  var inboxProject = /* @__PURE__ */ __name(({ database, now: now2 }, account, create) => {
36540
36607
  const key2 = inboxKey(account);
@@ -36741,7 +36808,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
36741
36808
  throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
36742
36809
  }, "oneOf");
36743
36810
 
36744
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/accounts.js
36811
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/accounts.js
36745
36812
  var accountAccountsOver = /* @__PURE__ */ __name((context) => {
36746
36813
  const { database } = context;
36747
36814
  const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
@@ -36786,7 +36853,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
36786
36853
  };
36787
36854
  }, "accountsStoreOver");
36788
36855
 
36789
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
36856
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
36790
36857
  var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
36791
36858
  var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
36792
36859
  const message2 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
@@ -36810,7 +36877,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
36810
36877
  })), "keepDownloads");
36811
36878
  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");
36812
36879
 
36813
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/attachments.js
36880
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/attachments.js
36814
36881
  var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
36815
36882
  const { database } = context;
36816
36883
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -36867,7 +36934,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
36867
36934
  }, "keepAttachmentText")
36868
36935
  }), "attachmentsStoreOver");
36869
36936
 
36870
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
36937
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
36871
36938
  var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
36872
36939
  var pointerMover = /* @__PURE__ */ __name((context, type) => {
36873
36940
  const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
@@ -37047,7 +37114,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
37047
37114
  return done;
37048
37115
  }, "rekeyChats");
37049
37116
 
37050
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
37117
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
37051
37118
  var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
37052
37119
  var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
37053
37120
  var CHAT_LIST_KEY = "chat_list_complete";
@@ -37105,7 +37172,7 @@ var chatCoverage = /* @__PURE__ */ __name(({ database }, accountKey) => {
37105
37172
  return { ...coverage, oldestMessageAt: toIso(oldest) };
37106
37173
  }, "chatCoverage");
37107
37174
 
37108
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/chats.js
37175
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/chats.js
37109
37176
  var chatsStoreOver = /* @__PURE__ */ __name((context) => {
37110
37177
  const { database } = context;
37111
37178
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
@@ -37240,7 +37307,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
37240
37307
  };
37241
37308
  }, "chatsStoreOver");
37242
37309
 
37243
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
37310
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
37244
37311
  import { createHash as createHash7 } from "node:crypto";
37245
37312
  var BATCH_CONTEXT = 50;
37246
37313
  var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
@@ -37378,7 +37445,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
37378
37445
  var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
37379
37446
  ${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
37380
37447
 
37381
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
37448
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
37382
37449
  import { setTimeout } from "node:timers/promises";
37383
37450
  var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
37384
37451
  var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
@@ -37690,7 +37757,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
37690
37757
  AND NOT EXISTS (SELECT 1 FROM messages d
37691
37758
  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");
37692
37759
 
37693
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/conversations.js
37760
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/conversations.js
37694
37761
  var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
37695
37762
  const { database } = context;
37696
37763
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -37797,7 +37864,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
37797
37864
  };
37798
37865
  }, "conversationsStoreOver");
37799
37866
 
37800
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/counters.js
37867
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/counters.js
37801
37868
  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";
37802
37869
  var accountCountersOver = /* @__PURE__ */ __name((context) => {
37803
37870
  const { database } = context;
@@ -37822,7 +37889,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
37822
37889
  counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
37823
37890
  }), "countersStoreOver");
37824
37891
 
37825
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
37892
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
37826
37893
  var MENTION_STATUSES = ["found", "linked", "dismissed"];
37827
37894
  var MENTION_QUERY = defineQuery({
37828
37895
  entity: "mention",
@@ -38038,7 +38105,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
38038
38105
  return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
38039
38106
  }, "listPlaces");
38040
38107
 
38041
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/mentions.js
38108
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/mentions.js
38042
38109
  var accountMentionsOver = /* @__PURE__ */ __name((context) => {
38043
38110
  const { database } = context;
38044
38111
  const { findAccountPk: findAccountPk2 } = keysOver(context);
@@ -38073,7 +38140,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
38073
38140
  places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
38074
38141
  }), "mentionsStoreOver");
38075
38142
 
38076
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
38143
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
38077
38144
  var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
38078
38145
  const read2 = database.prepare("SELECT m.id, m.external_id, m.text, m.sent_at, m.sender_name, coalesce(m.sender_chat_external_id, i.external_id) AS sender_id FROM messages m LEFT JOIN identities i ON i.id = m.sender_identity_id WHERE m.chat_id = ? AND m.deleted_at IS NULL AND (m.text LIKE '%google.com%' OR m.text LIKE '%forms.gle%') " + (messageId === void 0 ? "" : "AND m.external_id = ? ") + "ORDER BY m.sent_at DESC, m.id DESC");
38079
38146
  const rows = messageId === void 0 ? read2.all(chatKey) : read2.all(chatKey, messageId);
@@ -38088,7 +38155,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
38088
38155
  }));
38089
38156
  }, "documentLinkMessages");
38090
38157
 
38091
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
38158
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
38092
38159
  var stemmerFor = stemmerCache();
38093
38160
  var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
38094
38161
  if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
@@ -38132,7 +38199,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
38132
38199
  });
38133
38200
  }, "laterSharingRare");
38134
38201
 
38135
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/messages.js
38202
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/messages.js
38136
38203
  var accountMessagesOver = /* @__PURE__ */ __name((context) => {
38137
38204
  const { database } = context;
38138
38205
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
@@ -38267,7 +38334,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
38267
38334
  laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
38268
38335
  }), "messagesStoreOver");
38269
38336
 
38270
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
38337
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
38271
38338
  var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
38272
38339
  var iso5 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
38273
38340
  var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: accounts2, limit }) => {
@@ -38324,7 +38391,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
38324
38391
  });
38325
38392
  }, "personPreparation");
38326
38393
 
38327
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
38394
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
38328
38395
  var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
38329
38396
  const id2 = Number(uid);
38330
38397
  if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
@@ -38332,7 +38399,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
38332
38399
  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)));
38333
38400
  }, "personSeenInAccounts");
38334
38401
 
38335
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
38402
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
38336
38403
  var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
38337
38404
  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);
38338
38405
  if (!row2)
@@ -38398,7 +38465,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
38398
38465
  return { id: id2, personId, removed: true };
38399
38466
  }, "removeNote");
38400
38467
 
38401
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/people.js
38468
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/people.js
38402
38469
  var accountPeopleOver = /* @__PURE__ */ __name((context) => {
38403
38470
  const { database } = context;
38404
38471
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
@@ -38483,13 +38550,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
38483
38550
  };
38484
38551
  }, "peopleStoreOver");
38485
38552
 
38486
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
38553
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
38487
38554
  import { createHash as createHash9 } from "node:crypto";
38488
38555
 
38489
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
38556
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
38490
38557
  import { createHash as createHash8 } from "node:crypto";
38491
38558
 
38492
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
38559
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
38493
38560
  var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
38494
38561
  var exhausted2 = /* @__PURE__ */ __name((budget) => {
38495
38562
  throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
@@ -38711,7 +38778,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
38711
38778
  };
38712
38779
  }, "rankReplyGraph");
38713
38780
 
38714
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
38781
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
38715
38782
  var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
38716
38783
  var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
38717
38784
  var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
@@ -38885,7 +38952,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
38885
38952
  return { items, evidence, summary, graph: graph.quality };
38886
38953
  }, "calculateAdminStatistics");
38887
38954
 
38888
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
38955
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
38889
38956
  var rankingContextRange = /* @__PURE__ */ __name((root) => {
38890
38957
  const dates = [];
38891
38958
  const visit = /* @__PURE__ */ __name((node, required3) => {
@@ -38907,7 +38974,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
38907
38974
  return dates[0].node.resolution.date;
38908
38975
  }, "rankingContextRange");
38909
38976
 
38910
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
38977
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
38911
38978
  var reactionCounts = /* @__PURE__ */ __name((stored3) => {
38912
38979
  let counts;
38913
38980
  try {
@@ -39202,7 +39269,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
39202
39269
  });
39203
39270
  }, "rankQuery");
39204
39271
 
39205
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
39272
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
39206
39273
  function fail4(message2, reason = "query.too-large") {
39207
39274
  throw new CliError("validation_error", message2, { reason, complete: false });
39208
39275
  }
@@ -39379,7 +39446,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
39379
39446
  return result;
39380
39447
  }), "adminStatisticsQuery");
39381
39448
 
39382
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
39449
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
39383
39450
  var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
39384
39451
  if (!execution.accounts.length)
39385
39452
  return { conversations: [], chats: [] };
@@ -39397,7 +39464,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
39397
39464
  return { conversations: conversations2, chats: chats2 };
39398
39465
  }, "conversationEligibility");
39399
39466
 
39400
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
39467
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
39401
39468
  import { createHash as createHash10 } from "node:crypto";
39402
39469
  var EVIDENCE_BYTES = 64 * 1024;
39403
39470
  var FINGERPRINT_BYTES = 8 * 1024 * 1024;
@@ -39547,7 +39614,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
39547
39614
  return result;
39548
39615
  }, "rankingEvidence");
39549
39616
 
39550
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/reply-times.js
39617
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/reply-times.js
39551
39618
  var FAR = Number.MAX_SAFE_INTEGER;
39552
39619
  var chatsIn = /* @__PURE__ */ __name((scope3, kinds2) => {
39553
39620
  const params = [...scope3.accounts.flatMap(({ provider, account }) => [provider, account]), ...kinds2];
@@ -39641,7 +39708,7 @@ var waitingChats = /* @__PURE__ */ __name((context, scope3, waits, cap) => {
39641
39708
  });
39642
39709
  }, "waitingChats");
39643
39710
 
39644
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/queries.js
39711
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/queries.js
39645
39712
  var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
39646
39713
  const mailIndexed = /* @__PURE__ */ __name((execution) => {
39647
39714
  if (execution.corpus === "mail")
@@ -39662,7 +39729,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
39662
39729
  };
39663
39730
  }, "queriesStoreOver");
39664
39731
 
39665
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
39732
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
39666
39733
  var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
39667
39734
  const { database, now: now2 } = context;
39668
39735
  const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
@@ -39701,10 +39768,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
39701
39768
  }));
39702
39769
  }, "chatEventsOf");
39703
39770
 
39704
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
39771
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
39705
39772
  import { createHash as createHash11 } from "node:crypto";
39706
39773
 
39707
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/calendar.js
39774
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/calendar.js
39708
39775
  var calendarKey = /* @__PURE__ */ __name((zone, by) => {
39709
39776
  const format = new Intl.DateTimeFormat("en-CA", {
39710
39777
  timeZone: zone,
@@ -39724,7 +39791,7 @@ var weekKey = /* @__PURE__ */ __name((day) => {
39724
39791
  return date3.toISOString().slice(0, 10);
39725
39792
  }, "weekKey");
39726
39793
 
39727
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/retention.js
39794
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/retention.js
39728
39795
  var RETENTION_TOLERANCE = 864e5;
39729
39796
  var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
39730
39797
  const { since, until, cutoff, checkpoints, within, limit, by } = options;
@@ -39778,7 +39845,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
39778
39845
  return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
39779
39846
  }, "retentionCohorts");
39780
39847
 
39781
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
39848
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
39782
39849
  var iso6 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
39783
39850
  var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId, options, evidence) => {
39784
39851
  validateRetentionOptions(options);
@@ -39909,7 +39976,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
39909
39976
  };
39910
39977
  }, "retentionQuery");
39911
39978
 
39912
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
39979
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
39913
39980
  var iso7 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
39914
39981
  var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
39915
39982
  ...isBot === void 0 ? {} : { bot: isBot },
@@ -40040,7 +40107,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
40040
40107
  lastCount: memberCountsOf(context, pk).at(-1) ?? null
40041
40108
  })), "trackedChats");
40042
40109
 
40043
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/roster.js
40110
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/roster.js
40044
40111
  var rosterStoreOver = /* @__PURE__ */ __name((context) => {
40045
40112
  const { database } = context;
40046
40113
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
@@ -40096,7 +40163,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
40096
40163
  };
40097
40164
  }, "rosterStoreOver");
40098
40165
 
40099
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
40166
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
40100
40167
  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");
40101
40168
  var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
40102
40169
  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 ?`);
@@ -40120,7 +40187,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
40120
40187
  }
40121
40188
  }, "backfillNormalized");
40122
40189
 
40123
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
40190
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
40124
40191
  var INDEX2 = "message_words";
40125
40192
  var searchIndexState2 = /* @__PURE__ */ __name((database) => {
40126
40193
  const row2 = indexRow(database, INDEX2);
@@ -40247,7 +40314,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
40247
40314
  });
40248
40315
  }, "resetSearchIndex");
40249
40316
 
40250
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
40317
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
40251
40318
  var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
40252
40319
  const filled2 = { stemmed: 0, drained: 0 };
40253
40320
  const before2 = stemsState(database);
@@ -40342,7 +40409,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
40342
40409
  return resetStems(database, { now: now2 });
40343
40410
  }, "followDefaultStemmers");
40344
40411
 
40345
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
40412
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
40346
40413
  var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
40347
40414
  var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
40348
40415
  const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
@@ -40364,7 +40431,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
40364
40431
  });
40365
40432
  }, "termCandidates");
40366
40433
 
40367
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/search-index.js
40434
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/search-index.js
40368
40435
  var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
40369
40436
  const { database } = context;
40370
40437
  const stemmerFor2 = stemmerCache();
@@ -40386,7 +40453,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
40386
40453
  };
40387
40454
  }, "searchIndexStoreOver");
40388
40455
 
40389
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
40456
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
40390
40457
  var HISTORY_KEPT = 1e3;
40391
40458
  var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
40392
40459
  var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
@@ -40455,7 +40522,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
40455
40522
  return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
40456
40523
  }, "clearHistory");
40457
40524
 
40458
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/searches.js
40525
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/searches.js
40459
40526
  var searchesStoreOver = /* @__PURE__ */ __name((context) => {
40460
40527
  const { database } = context;
40461
40528
  return {
@@ -40479,7 +40546,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
40479
40546
  };
40480
40547
  }, "searchesStoreOver");
40481
40548
 
40482
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
40549
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
40483
40550
  var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
40484
40551
  var ACTION_OUTCOMES = ["ok", "refused", "failed"];
40485
40552
  var CODE = /^[a-z][a-z0-9_]{0,63}$/;
@@ -40522,7 +40589,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
40522
40589
  };
40523
40590
  }, "agentActionsStoreOver");
40524
40591
 
40525
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
40592
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
40526
40593
  var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
40527
40594
  }) => {
40528
40595
  const { database, now: now2 } = context;
@@ -40581,7 +40648,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
40581
40648
  };
40582
40649
  }, "botUpdateStoreOver");
40583
40650
 
40584
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
40651
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
40585
40652
  var DAY4 = 864e5;
40586
40653
  var accountsOf = /* @__PURE__ */ __name((filter) => {
40587
40654
  if (filter.accountIds !== void 0 && filter.accountId !== void 0)
@@ -40690,7 +40757,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
40690
40757
  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);
40691
40758
  }, "listEvents");
40692
40759
 
40693
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-forget.js
40760
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-forget.js
40694
40761
  var distinctIds = /* @__PURE__ */ __name((rows) => [...new Set(rows.map((row2) => Number(row2.id)))], "distinctIds");
40695
40762
  var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, accountId, cursorKey: cursorKey2, now: now2 }, refresh) => {
40696
40763
  const unseenBefore = unreferenced(database, "identities");
@@ -40745,7 +40812,7 @@ var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, account
40745
40812
  return { entries: entryIds.length, events: goneEvents.length };
40746
40813
  }, "forgetCalendarRows");
40747
40814
 
40748
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
40815
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
40749
40816
  var calendarOf = /* @__PURE__ */ __name((row2) => ({
40750
40817
  id: Number(row2.id),
40751
40818
  accountId: Number(row2.account_id),
@@ -41332,7 +41399,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
41332
41399
  };
41333
41400
  }, "eventStoreOver");
41334
41401
 
41335
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
41402
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
41336
41403
  var CATALOG_QUERY = defineQuery({
41337
41404
  entity: "document",
41338
41405
  backend: "sql",
@@ -41574,7 +41641,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
41574
41641
  };
41575
41642
  }, "catalogStoreOver");
41576
41643
 
41577
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
41644
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
41578
41645
  var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
41579
41646
  var field3 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
41580
41647
  CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
@@ -41587,7 +41654,7 @@ var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
41587
41654
  THEN 'source-modified' ELSE 'stored-update' END`;
41588
41655
  var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field3("sourceUrl")})`;
41589
41656
 
41590
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
41657
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
41591
41658
  var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
41592
41659
  const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
41593
41660
  signal?.throwIfAborted();
@@ -41686,7 +41753,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
41686
41753
  });
41687
41754
  }, "readMeetingContextEvidence");
41688
41755
 
41689
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
41756
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
41690
41757
  var corpora = {
41691
41758
  message: {
41692
41759
  table: "messages",
@@ -41925,7 +41992,7 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
41925
41992
  }
41926
41993
  }), "contextRecordsOver");
41927
41994
 
41928
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/finance.js
41995
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/finance.js
41929
41996
  var refuse = /* @__PURE__ */ __name((message2, reason, code = "validation_error") => {
41930
41997
  throw new CliError(code, message2, { reason });
41931
41998
  }, "refuse");
@@ -42021,7 +42088,7 @@ var reviewedRowsOver = /* @__PURE__ */ __name((context) => {
42021
42088
  if (by.evidence.length)
42022
42089
  linkEvidence(context, { type, id: id2 }, by.evidence, by.owner ? "owner" : "agent");
42023
42090
  }, "keepEvidence");
42024
- const ownerOnly2 = /* @__PURE__ */ __name((by, what) => {
42091
+ const ownerOnly = /* @__PURE__ */ __name((by, what) => {
42025
42092
  if (by !== "owner")
42026
42093
  refuse(`only the owner ${what}`, "finance.owner-only", "permission_error");
42027
42094
  }, "ownerOnly");
@@ -42032,11 +42099,11 @@ var reviewedRowsOver = /* @__PURE__ */ __name((context) => {
42032
42099
  const decision = by === "owner" ? { by: "owner", reason: why } : { by: "agent", bot: by.bot, reason: why };
42033
42100
  database.prepare(`UPDATE ${table} SET metadata = json_set(coalesce(metadata, '{}'), '$.decision', json(?)) WHERE id = ?`).run(JSON.stringify(decision), id2);
42034
42101
  }, "keepDecision");
42035
- return { partyOf, partyThing, reviewedOf, written: written2, keepEvidence, ownerOnly: ownerOnly2, keepDecision };
42102
+ return { partyOf, partyThing, reviewedOf, written: written2, keepEvidence, ownerOnly, keepDecision };
42036
42103
  }, "reviewedRowsOver");
42037
42104
  var financeOperationsOver = /* @__PURE__ */ __name((context) => {
42038
42105
  const { database, now: now2 } = context;
42039
- const { partyOf, partyThing, reviewedOf, written: written2, keepEvidence, ownerOnly: ownerOnly2, keepDecision } = reviewedRowsOver(context);
42106
+ const { partyOf, partyThing, reviewedOf, written: written2, keepEvidence, ownerOnly, keepDecision } = reviewedRowsOver(context);
42040
42107
  const invoiceOf2 = /* @__PURE__ */ __name((row2) => {
42041
42108
  const currency = String(row2.currency);
42042
42109
  const scale = scaleOf(currency);
@@ -42263,7 +42330,7 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
42263
42330
  return database.prepare(`${INVOICES} WHERE i.deleted_at IS NULL AND (? IS NULL OR i.direction = ?) AND (? IS NULL OR i.status = ?) AND (? IS NULL OR i.review = ?) AND (? IS NULL OR i.project_id = ?) AND (? IS NULL OR (i.counterparty_type = ? AND i.counterparty_id = ?)) AND (? IS NULL OR i.number = ?) ${filter.open ? "AND i.status IN ('issued', 'partly_paid') " : ""}AND ${by.sql} ORDER BY i.created_at DESC, i.id DESC LIMIT ?`).all(filter.direction ?? null, filter.direction ?? null, status, status, review, review, project2, project2, counterparty?.type ?? null, counterparty?.type ?? null, counterparty?.id ?? null, filter.number ?? null, filter.number ?? null, ...by.params, limitOf2(filter.limit)).map(invoiceOf2);
42264
42331
  }, "invoices"),
42265
42332
  issueInvoice: /* @__PURE__ */ __name((reference2, by) => {
42266
- ownerOnly2(by, "issues an invoice");
42333
+ ownerOnly(by, "issues an invoice");
42267
42334
  const row2 = rowOf2(reference2, "invoice");
42268
42335
  if (row2.status !== "draft")
42269
42336
  refuse(`invoice:${row2.id} is ${String(row2.status)}, not a draft`, "finance.status");
@@ -42274,7 +42341,7 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
42274
42341
  return invoiceDetail(`invoice:${row2.id}`);
42275
42342
  }, "issueInvoice"),
42276
42343
  voidInvoice: /* @__PURE__ */ __name((reference2, by) => {
42277
- ownerOnly2(by, "voids an invoice");
42344
+ ownerOnly(by, "voids an invoice");
42278
42345
  const row2 = rowOf2(reference2, "invoice");
42279
42346
  if (row2.status === "void")
42280
42347
  refuse(`invoice:${row2.id} is already void`, "finance.status");
@@ -42386,29 +42453,29 @@ var financeStoreOver = /* @__PURE__ */ __name((context) => {
42386
42453
  };
42387
42454
  }, "financeStoreOver");
42388
42455
 
42389
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/deals.js
42390
- var DEALS = "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 FROM opportunities 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";
42391
- var MAX_STAGES = 20;
42456
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/deals.js
42457
+ var TABLES = { deal: "deals", lead: "leads" };
42458
+ var itemsSql = /* @__PURE__ */ __name((kind3) => `SELECT d.*, s.name AS stage_name, s.pipeline_id, p.name AS pipeline_name, b.name AS author_name, b.kind AS author_kind, a.provider AS account_provider, a.external_id AS account_external_id FROM ${TABLES[kind3]} d JOIN pipeline_stages s ON s.id = d.stage_id JOIN pipelines p ON p.id = s.pipeline_id LEFT JOIN bots b ON d.author_type = 'bot' AND b.id = d.author_id LEFT JOIN accounts a ON a.id = d.account_id`, "itemsSql");
42459
+ var MAX_STAGES = 30;
42392
42460
  var MAX_PEOPLE = 20;
42393
- var ownerOnly = /* @__PURE__ */ __name((by, what) => {
42394
- if (by !== "owner")
42395
- refuse(`only the owner ${what}`, "deal.owner-only", "permission_error");
42396
- }, "ownerOnly");
42461
+ var iso9 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
42462
+ var jsonField = /* @__PURE__ */ __name((metadata3, key2) => {
42463
+ if (metadata3 == null)
42464
+ return null;
42465
+ try {
42466
+ const value = JSON.parse(String(metadata3))[key2];
42467
+ return typeof value === "string" ? value : null;
42468
+ } catch {
42469
+ return null;
42470
+ }
42471
+ }, "jsonField");
42472
+ var accountOf3 = /* @__PURE__ */ __name((provider, external) => provider == null ? null : { provider: String(provider), account: String(external) }, "accountOf");
42397
42473
  var dealOperationsOver = /* @__PURE__ */ __name((context) => {
42398
42474
  const { database, now: now2 } = context;
42399
- const { partyOf, partyThing, reviewedOf, written: written2, keepEvidence, keepDecision } = reviewedRowsOver(context);
42400
- const closedReasonOf = /* @__PURE__ */ __name((metadata3) => {
42401
- if (metadata3 == null)
42402
- return null;
42403
- try {
42404
- const { closed_reason } = JSON.parse(String(metadata3));
42405
- return typeof closed_reason === "string" ? closed_reason : null;
42406
- } catch {
42407
- return null;
42408
- }
42409
- }, "closedReasonOf");
42410
- const peopleOf = /* @__PURE__ */ __name((id2) => database.prepare(`SELECT to_id, role FROM links WHERE from_type = 'deal' AND from_id = ? AND kind = ${linkKind("related-to")} AND to_type = 'person' AND to_id IS NOT NULL ORDER BY id`).all(id2).map((row2) => ({ ...partyOf("person", row2.to_id), role: row2.role })), "peopleOf");
42411
- const dealOf = /* @__PURE__ */ __name((row2) => {
42475
+ const { partyOf, partyThing } = reviewedRowsOver(context);
42476
+ const today = /* @__PURE__ */ __name(() => new Date(now2()).toISOString().slice(0, 10), "today");
42477
+ const peopleOf = /* @__PURE__ */ __name((kind3, id2) => database.prepare(`SELECT to_id, role FROM links WHERE from_type = ? AND from_id = ? AND kind = ${linkKind("related-to")} AND to_type = 'person' AND to_id IS NOT NULL ORDER BY id`).all(kind3, id2).map((row2) => ({ ...partyOf("person", row2.to_id), role: row2.role })), "peopleOf");
42478
+ const itemOf = /* @__PURE__ */ __name((kind3) => (row2) => {
42412
42479
  const currency = row2.currency == null ? null : String(row2.currency);
42413
42480
  const amount = row2.amount == null || currency === null ? null : Number(row2.amount);
42414
42481
  const fields4 = {
@@ -42417,15 +42484,16 @@ var dealOperationsOver = /* @__PURE__ */ __name((context) => {
42417
42484
  stage: String(row2.stage_name),
42418
42485
  amount,
42419
42486
  currency,
42420
- status: row2.status,
42421
- review: row2.review
42487
+ status: row2.status
42422
42488
  };
42423
42489
  return {
42424
42490
  id: String(row2.id),
42425
- ref: `deal:${row2.id}`,
42491
+ ref: `${kind3}:${row2.id}`,
42492
+ kind: kind3,
42426
42493
  title: fields4.title,
42427
42494
  summary: dealLine(fields4),
42428
- pipeline: String(row2.pipeline_name),
42495
+ pipeline: `pipeline:${row2.pipeline_id}`,
42496
+ pipelineName: String(row2.pipeline_name),
42429
42497
  stage: fields4.stage,
42430
42498
  status: fields4.status,
42431
42499
  organization: partyOf(row2.organization_id == null ? null : "organization", row2.organization_id),
@@ -42433,97 +42501,194 @@ var dealOperationsOver = /* @__PURE__ */ __name((context) => {
42433
42501
  amount: amount === null || currency === null ? null : formatDecimal(amount, scaleOf(currency)),
42434
42502
  closeDate: row2.close_date == null ? null : String(row2.close_date),
42435
42503
  closedDate: row2.closed_date == null ? null : String(row2.closed_date),
42436
- closedReason: closedReasonOf(row2.metadata),
42437
- people: peopleOf(fields4.id),
42438
- ...reviewedOf(row2, "deal")
42504
+ closedReason: jsonField(row2.metadata, "closed_reason"),
42505
+ rank: row2.rank == null ? null : Number(row2.rank),
42506
+ deal: row2.deal_id == null ? null : `deal:${row2.deal_id}`,
42507
+ account: accountOf3(row2.account_provider, row2.account_external_id),
42508
+ externalId: row2.external_id == null ? null : String(row2.external_id),
42509
+ people: peopleOf(kind3, fields4.id),
42510
+ author: authorOf(row2),
42511
+ model: row2.model == null ? null : String(row2.model),
42512
+ source: String(row2.source),
42513
+ reason: jsonField(row2.metadata, "reason"),
42514
+ evidence: evidenceOf(context, { type: kind3, id: fields4.id }),
42515
+ ...projectOf(database, row2),
42516
+ createdAt: iso9(row2.created_at),
42517
+ updatedAt: iso9(row2.updated_at)
42439
42518
  };
42440
- }, "dealOf");
42519
+ }, "itemOf");
42441
42520
  const rowOf2 = /* @__PURE__ */ __name((reference2) => {
42442
42521
  const thing = requiredThing(database, reference2.includes(":") ? reference2 : `deal:${reference2}`, "the deal");
42443
- if (thing.type !== "deal")
42444
- return refuse(`${reference2} is not a deal`, "deal.ref");
42445
- return database.prepare(`${DEALS} WHERE d.id = ?`).get(thing.id);
42522
+ if (thing.type !== "deal" && thing.type !== "lead")
42523
+ return refuse(`${reference2} is not a deal or a lead`, "deal.ref");
42524
+ return { kind: thing.type, row: database.prepare(`${itemsSql(thing.type)} WHERE d.id = ?`).get(thing.id) };
42446
42525
  }, "rowOf");
42447
- const pipelineNamed = /* @__PURE__ */ __name((name) => {
42448
- const found2 = database.prepare("SELECT id FROM pipelines WHERE name_folded = ?").get(fold(name.trim()));
42449
- if (!found2)
42450
- throw new CliError("not_found", `no pipeline named ${name}`, { reason: "pipeline.not-found" });
42451
- return Number(found2.id);
42452
- }, "pipelineNamed");
42453
- const stageNamed = /* @__PURE__ */ __name((stage, pipeline) => {
42454
- const within = typeof pipeline === "string" ? pipelineNamed(pipeline) : pipeline ?? null;
42455
- const rows = database.prepare("SELECT id FROM pipeline_stages WHERE name_folded = ? AND (? IS NULL OR pipeline_id = ?)").all(fold(stage.trim()), within, within);
42526
+ const read2 = /* @__PURE__ */ __name((reference2) => {
42527
+ const { kind: kind3, row: row2 } = rowOf2(reference2);
42528
+ return itemOf(kind3)(row2);
42529
+ }, "read");
42530
+ const kindOf4 = /* @__PURE__ */ __name((kind3) => kind3 === void 0 ? "deal" : oneOf4(kind3, DEAL_KINDS, "a kind"), "kindOf");
42531
+ const pipelineRows = /* @__PURE__ */ __name((kind3) => database.prepare("SELECT p.*, a.provider AS account_provider, a.external_id AS account_external_id FROM pipelines p LEFT JOIN accounts a ON a.id = p.account_id WHERE (? IS NULL OR p.kind = ?) ORDER BY p.name_folded, p.id").all(kind3 ?? null, kind3 ?? null), "pipelineRows");
42532
+ const label = /* @__PURE__ */ __name((row2) => `pipeline:${row2.id} (${row2.name}${row2.account_provider == null ? "" : `, ${row2.account_provider}:${row2.account_external_id}`})`, "label");
42533
+ const pipelineRow = /* @__PURE__ */ __name((reference2, kind3) => {
42534
+ const named2 = reference2.trim();
42535
+ if (/^pipeline:\d+$/.test(named2)) {
42536
+ const row2 = pipelineRows(kind3).find((one2) => `pipeline:${one2.id}` === named2);
42537
+ if (!row2)
42538
+ throw new CliError("not_found", `no ${kind3 ?? ""} pipeline ${named2}`, { reason: "pipeline.not-found" });
42539
+ return row2;
42540
+ }
42541
+ const rows = pipelineRows(kind3).filter((one2) => one2.name_folded === fold(named2));
42456
42542
  if (rows.length === 0)
42457
- return refuse(`no stage named ${stage}${within === null ? "" : " in that pipeline"}`, "deal.stage");
42543
+ throw new CliError("not_found", `no ${kind3 === void 0 ? "" : `${kind3} `}pipeline named ${named2}`, {
42544
+ reason: "pipeline.not-found"
42545
+ });
42458
42546
  if (rows.length > 1)
42459
- return refuse(`more than one pipeline has a stage named ${stage}; name the pipeline`, "deal.stage");
42460
- return Number(rows[0]?.id);
42461
- }, "stageNamed");
42462
- const pipelinesOf = /* @__PURE__ */ __name(() => {
42463
- const stages = database.prepare("SELECT s.pipeline_id, s.name, s.position, (SELECT count(*) FROM opportunities d WHERE d.stage_id = s.id AND d.status = 'open' AND d.review <> 'rejected' AND d.deleted_at IS NULL) AS open FROM pipeline_stages s ORDER BY s.pipeline_id, s.position").all();
42464
- return database.prepare("SELECT id, name, created_at FROM pipelines ORDER BY name_folded").all().map((pipeline) => ({
42465
- name: String(pipeline.name),
42466
- stages: stages.filter((stage) => stage.pipeline_id === pipeline.id).map((stage) => ({ name: String(stage.name), position: Number(stage.position), open: Number(stage.open) })),
42467
- createdAt: new Date(Number(pipeline.created_at)).toISOString()
42547
+ return refuse(`more than one pipeline is named ${named2}: ${rows.map(label).join(", ")}; name one by its reference`, "pipeline.ambiguous");
42548
+ return rows[0];
42549
+ }, "pipelineRow");
42550
+ const stagesOf = /* @__PURE__ */ __name((pipelineIds) => database.prepare(`SELECT s.*, (SELECT count(*) FROM deals d WHERE d.stage_id = s.id AND d.status = 'open' AND d.deleted_at IS NULL) + (SELECT count(*) FROM leads l WHERE l.stage_id = s.id AND l.status = 'open' AND l.deleted_at IS NULL) AS open FROM pipeline_stages s WHERE s.pipeline_id IN (${pipelineIds.map(() => "?").join(", ") || "NULL"}) ORDER BY s.pipeline_id, s.position, s.id`).all(...pipelineIds), "stagesOf");
42551
+ const pipelinesOf = /* @__PURE__ */ __name((rows) => {
42552
+ const stages = stagesOf(rows.map((row2) => Number(row2.id)));
42553
+ return rows.map((row2) => ({
42554
+ id: String(row2.id),
42555
+ ref: `pipeline:${row2.id}`,
42556
+ name: String(row2.name),
42557
+ kind: row2.kind,
42558
+ account: accountOf3(row2.account_provider, row2.account_external_id),
42559
+ externalId: row2.external_id == null ? null : String(row2.external_id),
42560
+ stages: stages.filter((stage) => stage.pipeline_id === row2.id).map((stage) => ({
42561
+ name: String(stage.name),
42562
+ position: Number(stage.position),
42563
+ outcome: stage.outcome,
42564
+ externalId: stage.external_id == null ? null : String(stage.external_id),
42565
+ open: Number(stage.open)
42566
+ })),
42567
+ createdAt: iso9(row2.created_at)
42468
42568
  }));
42469
42569
  }, "pipelinesOf");
42470
- const stillOpen = /* @__PURE__ */ __name((row2, what) => {
42471
- if (row2.status !== "open" || row2.review === "rejected" || row2.deleted_at != null)
42472
- refuse(`deal:${row2.id} is ${row2.deleted_at != null ? "deleted" : row2.review === "rejected" ? "rejected" : String(row2.status)}; it no longer ${what}`, "deal.closed");
42473
- }, "stillOpen");
42474
- const decide2 = /* @__PURE__ */ __name((reference2, by, reason, confirm) => {
42475
- const row2 = rowOf2(reference2);
42476
- const ref3 = `deal:${row2.id}`;
42477
- assertMayDecide({ id: ref3, proposedBy: proposerOf(database, row2.author_type, row2.author_id), ownerOnly: true }, by, context.decisions);
42478
- if (row2.review !== "proposed")
42479
- refuse(`${ref3} is already ${String(row2.review)}`, "proposal.wrong-state");
42480
- write(database, () => {
42481
- if (confirm) {
42482
- const { actor } = authorActor(context, deciderAuthor(by));
42483
- database.prepare("UPDATE opportunities SET review = 'confirmed', confirmed_by_type = ?, confirmed_by_id = ?, updated_at = ? WHERE id = ?").run(actor.type, actor.id, now2(), Number(row2.id));
42484
- } else
42485
- database.prepare("UPDATE opportunities SET review = 'rejected', updated_at = ? WHERE id = ?").run(now2(), Number(row2.id));
42486
- keepDecision("opportunities", Number(row2.id), by, reason);
42570
+ const stageRow = /* @__PURE__ */ __name((stage, kind3, pipeline) => {
42571
+ const rows = database.prepare("SELECT s.*, p.name AS pipeline_name FROM pipeline_stages s JOIN pipelines p ON p.id = s.pipeline_id WHERE s.name_folded = ? AND p.kind = ? AND (? IS NULL OR p.id = ?) ORDER BY p.id").all(fold(stage.trim()), kind3, pipeline ?? null, pipeline ?? null);
42572
+ if (rows.length === 0)
42573
+ return refuse(`no stage named ${stage} in ${pipeline === void 0 ? `a ${kind3} pipeline` : "that pipeline"}`, "deal.stage");
42574
+ if (rows.length > 1)
42575
+ return refuse(`more than one pipeline has a stage named ${stage}: ${rows.map((row2) => `pipeline:${row2.pipeline_id} (${row2.pipeline_name})`).join(", ")}; name the pipeline`, "deal.stage");
42576
+ return rows[0];
42577
+ }, "stageRow");
42578
+ const firstStage = /* @__PURE__ */ __name((kind3, pipeline) => {
42579
+ const pipelines2 = pipeline === void 0 ? pipelineRows(kind3) : [{ id: pipeline }];
42580
+ if (pipelines2.length !== 1)
42581
+ return refuse(`name the stage: ${pipelines2.length === 0 ? `no ${kind3} pipeline is stored` : `more than one ${kind3} pipeline is stored`}`, "deal.stage");
42582
+ const row2 = database.prepare("SELECT * FROM pipeline_stages WHERE pipeline_id = ? ORDER BY position, id LIMIT 1").get(Number(pipelines2[0]?.id));
42583
+ return row2 ?? refuse("the pipeline has no stages", "deal.stage");
42584
+ }, "firstStage");
42585
+ const funnelOf = /* @__PURE__ */ __name((pipeline, since) => {
42586
+ const kind3 = pipeline.kind;
42587
+ const cutoff = since === null ? null : Date.parse(`${since}T00:00:00Z`);
42588
+ const items = database.prepare(`SELECT d.id, d.status, d.stage_id FROM ${TABLES[kind3]} d JOIN pipeline_stages s ON s.id = d.stage_id WHERE s.pipeline_id = ? AND d.deleted_at IS NULL AND (? IS NULL OR d.created_at >= ?)`).all(Number(pipeline.id), cutoff, cutoff);
42589
+ const stages = database.prepare("SELECT id, position, outcome FROM pipeline_stages WHERE pipeline_id = ? ORDER BY position, id").all(Number(pipeline.id));
42590
+ const order = new Map(stages.map((stage, at) => [Number(stage.id), at]));
42591
+ const lostStage = new Set(stages.filter((stage) => stage.outcome === "lost").map((stage) => Number(stage.id)));
42592
+ const entered = /* @__PURE__ */ new Map();
42593
+ for (const change of database.prepare("SELECT item_id, to_stage_id FROM pipeline_stage_changes WHERE item_type = ? AND pipeline_id = ?").all(kind3, Number(pipeline.id))) {
42594
+ const list2 = entered.get(Number(change.item_id)) ?? [];
42595
+ list2.push(Number(change.to_stage_id));
42596
+ entered.set(Number(change.item_id), list2);
42597
+ }
42598
+ const furthest = items.map((item) => {
42599
+ if (item.status === "won")
42600
+ return Number.POSITIVE_INFINITY;
42601
+ const reached = [...entered.get(Number(item.id)) ?? [], Number(item.stage_id)].filter((stage) => !lostStage.has(stage)).map((stage) => order.get(stage) ?? -1);
42602
+ return Math.max(-1, ...reached);
42487
42603
  });
42488
- return dealOf(rowOf2(ref3));
42489
- }, "decide");
42604
+ const lost = items.filter((item) => item.status === "lost").length;
42605
+ const reachedAt = /* @__PURE__ */ __name((at) => lostStage.has(Number(stages[at]?.id)) ? lost : furthest.filter((far) => far >= at).length, "reachedAt");
42606
+ const funnel = pipeline.stages.map((stage, at) => {
42607
+ const reached = reachedAt(at);
42608
+ const next = stages.findIndex((one2, after2) => after2 > at && !lostStage.has(Number(one2.id)));
42609
+ const conversion = lostStage.has(Number(stages[at]?.id)) || next === -1 || reached === 0 ? null : Math.round(reachedAt(next) / reached * 1e3) / 1e3;
42610
+ return { ...stage, reached, conversion };
42611
+ });
42612
+ const won = items.filter((item) => item.status === "won").length;
42613
+ return {
42614
+ ...pipeline,
42615
+ stages: funnel,
42616
+ totals: {
42617
+ items: items.length,
42618
+ open: items.length - won - lost,
42619
+ won,
42620
+ lost,
42621
+ winRate: won + lost === 0 ? null : Math.round(won / (won + lost) * 1e3) / 1e3
42622
+ },
42623
+ since
42624
+ };
42625
+ }, "funnelOf");
42626
+ const setStage = /* @__PURE__ */ __name((kind3, id2, stage, status, date3) => {
42627
+ database.prepare(`UPDATE ${TABLES[kind3]} SET stage_id = ?, status = ?, closed_date = ?, updated_at = ? WHERE id = ?`).run(Number(stage.id), status, status === "open" ? null : date3, now2(), id2);
42628
+ }, "setStage");
42629
+ const notDeleted = /* @__PURE__ */ __name((row2, kind3, what) => {
42630
+ if (row2.deleted_at != null)
42631
+ refuse(`${kind3}:${row2.id} is deleted; it no longer ${what}`, "deal.closed");
42632
+ }, "notDeleted");
42490
42633
  return {
42491
- addPipeline: /* @__PURE__ */ __name(({ name, stages, by }) => {
42492
- ownerOnly(by, "makes a pipeline");
42634
+ addPipeline: /* @__PURE__ */ __name(({ name, kind: kind3, stages, by }) => {
42635
+ const pipelineKind = kindOf4(kind3);
42493
42636
  const named2 = text3(name, "a pipeline's name", 80) ?? refuse("a pipeline needs a name", "pipeline.field");
42494
42637
  if (!Array.isArray(stages) || stages.length === 0 || stages.length > MAX_STAGES)
42495
42638
  refuse(`a pipeline has 1\u2013${MAX_STAGES} stages`, "pipeline.field");
42496
- const kept = stages.map((stage) => text3(stage, "a stage's name", 80));
42497
- if (new Set(kept.map(fold)).size !== kept.length)
42639
+ const kept = stages.map((stage) => {
42640
+ const one2 = typeof stage === "string" ? { name: stage } : stage;
42641
+ return {
42642
+ name: text3(one2.name, "a stage's name", 80),
42643
+ outcome: one2.outcome === void 0 ? "open" : oneOf4(one2.outcome, STAGE_OUTCOMES, "a stage's outcome")
42644
+ };
42645
+ });
42646
+ if (new Set(kept.map((stage) => fold(stage.name))).size !== kept.length)
42498
42647
  refuse("each stage is named once", "pipeline.field");
42499
- write(database, () => {
42500
- if (database.prepare("SELECT 1 FROM pipelines WHERE name_folded = ?").get(fold(named2)))
42501
- refuse(`a pipeline named ${named2} is already stored`, "pipeline.duplicate");
42648
+ authorActor(context, by);
42649
+ const id2 = write(database, () => {
42650
+ if (database.prepare("SELECT 1 FROM pipelines WHERE name_folded = ? AND kind = ? AND account_id IS NULL").get(fold(named2), pipelineKind))
42651
+ refuse(`a ${pipelineKind} pipeline named ${named2} is already stored`, "pipeline.duplicate");
42502
42652
  const at = now2();
42503
- const id2 = database.prepare("INSERT INTO pipelines (name, name_folded, created_at, updated_at) VALUES (?, ?, ?, ?) RETURNING id").get(named2, fold(named2), at, at)?.id;
42504
- const insert = database.prepare("INSERT INTO pipeline_stages (pipeline_id, name, name_folded, position, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)");
42505
- kept.forEach((stage, at_) => {
42506
- insert.run(Number(id2), stage, fold(stage), at_ + 1, at, at);
42653
+ const made = Number(database.prepare("INSERT INTO pipelines (kind, name, name_folded, created_at, updated_at) VALUES (?, ?, ?, ?, ?) RETURNING id").get(pipelineKind, named2, fold(named2), at, at)?.id);
42654
+ const insert = database.prepare("INSERT INTO pipeline_stages (pipeline_id, name, name_folded, position, outcome, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?)");
42655
+ kept.forEach((stage, index2) => {
42656
+ insert.run(made, stage.name, fold(stage.name), index2 + 1, stage.outcome, at, at);
42507
42657
  });
42658
+ return made;
42508
42659
  });
42509
- return pipelinesOf().find((pipeline) => fold(pipeline.name) === fold(named2));
42660
+ return pipelinesOf(pipelineRows(pipelineKind).filter((row2) => Number(row2.id) === id2))[0];
42510
42661
  }, "addPipeline"),
42511
- pipelines: /* @__PURE__ */ __name(() => pipelinesOf(), "pipelines"),
42662
+ pipelines: /* @__PURE__ */ __name((filter = {}) => pipelinesOf(pipelineRows(filter.kind === void 0 ? void 0 : kindOf4(filter.kind))), "pipelines"),
42663
+ pipeline: /* @__PURE__ */ __name((reference2, options = {}) => {
42664
+ const kind3 = options.kind === void 0 ? void 0 : kindOf4(options.kind);
42665
+ const since = isoDate(options.since, "the first day counted");
42666
+ return funnelOf(pipelinesOf([pipelineRow(reference2, kind3)])[0], since);
42667
+ }, "pipeline"),
42512
42668
  add: /* @__PURE__ */ __name((input) => {
42513
- const title = text3(input.title, "a deal's title", 200) ?? refuse("a deal needs a title", "deal.field");
42514
- const stageText = text3(input.stage, "a stage's name", 80) ?? refuse("a deal starts in a stage", "deal.field");
42669
+ const kind3 = kindOf4(input.kind);
42670
+ const title = text3(input.title, `a ${kind3}'s title`, 200) ?? refuse(`a ${kind3} needs a title`, "deal.field");
42515
42671
  if (input.amount === void 0 !== (input.currency === void 0))
42516
- refuse("a deal's amount and currency come together", "deal.field");
42672
+ refuse("an amount and its currency come together", "deal.field");
42517
42673
  const currency = input.currency === void 0 ? null : currencyOf(input.currency);
42518
- const amount = currency === null ? null : minorUnits(input.amount, currency, "a deal's amount");
42674
+ const amount = currency === null ? null : minorUnits(input.amount, currency, "an amount");
42519
42675
  if (amount !== null && amount < 0)
42520
- refuse("a deal's amount is 0 or more", "money.amount");
42521
- const closeDate = isoDate(input.closeDate, "a deal's close date");
42676
+ refuse("an amount is 0 or more", "money.amount");
42677
+ const closeDate = isoDate(input.closeDate, "an expected close day");
42522
42678
  const people2 = input.people ?? [];
42523
42679
  if (people2.length > MAX_PEOPLE)
42524
- refuse(`a deal names at most ${MAX_PEOPLE} people`, "deal.field");
42680
+ refuse(`at most ${MAX_PEOPLE} people`, "deal.field");
42681
+ const owner = input.by === "owner";
42682
+ const source2 = owner ? "owner" : text3(input.source, "a source", 80) ?? "agent";
42683
+ const reason = text3(input.reason, "a reason", 2e3);
42684
+ const evidence = input.evidence ?? [];
42685
+ if (!Array.isArray(evidence) || evidence.length > 8)
42686
+ refuse("evidence is at most 8 references", "deal.field");
42525
42687
  const id2 = write(database, () => {
42526
- const stage = stageNamed(stageText, input.pipeline);
42688
+ const pipeline = input.pipeline === void 0 ? void 0 : Number(pipelineRow(input.pipeline, kind3).id);
42689
+ const stageText = text3(input.stage, "a stage's name", 80);
42690
+ const stage = stageText === null ? kind3 === "lead" ? firstStage(kind3, pipeline) : refuse("a deal starts in a stage", "deal.field") : stageRow(stageText, kind3, pipeline);
42691
+ const status = stage.outcome ?? "open";
42527
42692
  const organization2 = partyThing(input.organization, "the organization");
42528
42693
  if (organization2 !== void 0 && organization2.type !== "organization")
42529
42694
  refuse(`the organization is an organization: reference, not ${input.organization}`, "deal.field");
@@ -42531,73 +42696,85 @@ var dealOperationsOver = /* @__PURE__ */ __name((context) => {
42531
42696
  const thing = requiredThing(database, person2, "the person");
42532
42697
  if (thing.type !== "person")
42533
42698
  return refuse(`${person2} is not a person`, "deal.field");
42534
- return { id: thing.id, role: oneOf4(role, DEAL_ROLES, "a person's role on a deal") };
42699
+ return { id: thing.id, role: oneOf4(role, DEAL_ROLES, "a person's role") };
42535
42700
  });
42536
- const by = written2(input);
42701
+ const { actor, model } = authorActor(context, input.by);
42537
42702
  const at = now2();
42538
- const made = Number(database.prepare("INSERT INTO opportunities (title, organization_id, project_id, stage_id, status, currency, amount, close_date, review, author_type, author_id, model, confirmed_by_type, confirmed_by_id, source, metadata, created_at, updated_at) VALUES (?, ?, ?, ?, 'open', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(title, organization2?.id ?? null, by.project, stage, currency, amount, closeDate, by.review, by.actor.type, by.actor.id, by.model, by.confirmedType, by.confirmedId, by.source, by.metadata, at, at)?.id);
42539
- const link3 = database.prepare(`INSERT INTO links (from_type, from_id, to_type, to_id, kind, role, source, confirmed, created_at, author, updated_at) VALUES ('deal', ?, 'person', ?, ${linkKind("related-to")}, ?, ?, 1, ?, ?, ?)`);
42703
+ const made = Number(database.prepare(`INSERT INTO ${TABLES[kind3]} (title, organization_id, project_id, stage_id, status, currency, amount, close_date, closed_date, author_type, author_id, model, source, metadata, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id`).get(title, organization2?.id ?? null, input.project === void 0 ? null : projectId(database, input.project), Number(stage.id), status, currency, amount, closeDate, status === "open" ? null : today(), actor.type, actor.id, model, source2, reason === null ? null : JSON.stringify({ reason }), at, at)?.id);
42704
+ const link3 = database.prepare(`INSERT INTO links (from_type, from_id, to_type, to_id, kind, role, source, confirmed, created_at, author, updated_at) VALUES (?, ?, 'person', ?, ${linkKind("related-to")}, ?, ?, 1, ?, ?, ?)`);
42540
42705
  for (const person2 of persons2)
42541
- link3.run(made, person2.id, person2.role, by.owner ? "owner" : "suggested", at, by.owner ? "owner" : "agent", at);
42542
- keepEvidence("deal", made, by);
42706
+ link3.run(kind3, made, person2.id, person2.role, owner ? "owner" : "suggested", at, owner ? "owner" : "agent", at);
42707
+ if (evidence.length)
42708
+ linkEvidence(context, { type: kind3, id: made }, evidence, owner ? "owner" : "agent");
42543
42709
  return made;
42544
42710
  });
42545
- return dealOf(rowOf2(`deal:${id2}`));
42711
+ return read2(`${kind3}:${id2}`);
42546
42712
  }, "add"),
42547
- get: /* @__PURE__ */ __name((reference2) => dealOf(rowOf2(reference2)), "get"),
42713
+ get: /* @__PURE__ */ __name((reference2) => read2(reference2), "get"),
42548
42714
  list: /* @__PURE__ */ __name((filter = {}) => {
42715
+ const kind3 = kindOf4(filter.kind);
42549
42716
  const project2 = filter.project === void 0 ? null : projectId(database, filter.project);
42550
42717
  const organization2 = partyThing(filter.organization, "the organization");
42551
42718
  const by = proposedBySql("d.author_type", "d.author_id", filter.proposedBy);
42552
- const status = filter.status === void 0 ? null : oneOf4(filter.status, DEAL_STATUSES, "a deal's status");
42553
- const review = filter.review === void 0 ? null : oneOf4(filter.review, FINANCE_REVIEWS, "a review");
42719
+ const status = filter.status === void 0 ? null : oneOf4(filter.status, DEAL_STATUSES, "a status");
42554
42720
  const stage = filter.stage === void 0 ? null : fold(filter.stage.trim());
42555
- const pipeline = filter.pipeline === void 0 ? null : fold(filter.pipeline.trim());
42721
+ const pipeline = filter.pipeline === void 0 ? null : Number(pipelineRow(filter.pipeline, kind3).id);
42556
42722
  const limit = Math.min(Math.max(filter.limit ?? 100, 1), 500);
42557
- return database.prepare(`${DEALS} WHERE d.deleted_at IS NULL AND (? IS NULL OR d.status = ?) AND (? IS NULL OR d.review = ?) AND (? IS NULL OR d.project_id = ?) AND (? IS NULL OR s.name_folded = ?) AND (? IS NULL OR p.name_folded = ?) AND (? IS NULL OR d.organization_id = ?) AND ${by.sql} ORDER BY d.created_at DESC, d.id DESC LIMIT ?`).all(status, status, review, review, project2, project2, stage, stage, pipeline, pipeline, organization2?.id ?? null, organization2?.id ?? null, ...by.params, limit).map(dealOf);
42723
+ return database.prepare(`${itemsSql(kind3)} WHERE d.deleted_at IS NULL AND (? IS NULL OR d.status = ?) AND (? IS NULL OR d.project_id = ?) AND (? IS NULL OR s.name_folded = ?) AND (? IS NULL OR p.id = ?) AND (? IS NULL OR d.organization_id = ?) AND ${by.sql} ORDER BY d.created_at DESC, d.id DESC LIMIT ?`).all(status, status, project2, project2, stage, stage, pipeline, pipeline, organization2?.id ?? null, organization2?.id ?? null, ...by.params, limit).map(itemOf(kind3));
42558
42724
  }, "list"),
42725
+ find: /* @__PURE__ */ __name(({ words: words3, anyWord, accounts: accounts2, limit }) => {
42726
+ const wanted = [...new Set(words3.map((word2) => fold(word2).trim()).filter(Boolean))];
42727
+ if (!wanted.length)
42728
+ return [];
42729
+ const most = Math.min(Math.max(limit ?? 100, 1), 500);
42730
+ const within = accounts2?.map(({ provider, account }) => `${provider}\0${account}`);
42731
+ const found2 = DEAL_KINDS.flatMap((kind3) => database.prepare(`SELECT d.id, d.title, d.updated_at, a.provider, a.external_id AS account FROM ${TABLES[kind3]} d LEFT JOIN accounts a ON a.id = d.account_id WHERE d.deleted_at IS NULL`).all().filter((row2) => within === void 0 || within.includes(`${row2.provider}\0${row2.account}`)).map((row2) => {
42732
+ const title = fold(String(row2.title));
42733
+ return { kind: kind3, row: row2, score: wanted.filter((word2) => title.includes(word2)).length };
42734
+ }).filter(({ score }) => anyWord ? score > 0 : score === wanted.length));
42735
+ return found2.sort((a, b) => b.score - a.score || Number(b.row.updated_at) - Number(a.row.updated_at) || Number(b.row.id) - Number(a.row.id)).slice(0, most).map(({ kind: kind3, row: row2 }) => read2(`${kind3}:${row2.id}`));
42736
+ }, "find"),
42559
42737
  move: /* @__PURE__ */ __name((reference2, { stage, by }) => {
42560
- ownerOnly(by, "moves a deal");
42561
- const row2 = rowOf2(reference2);
42562
- stillOpen(row2, "moves");
42563
- const next = stageNamed(text3(stage, "a stage's name", 80) ?? "", Number(row2.pipeline_id));
42564
- write(database, () => {
42565
- database.prepare("UPDATE opportunities SET stage_id = ?, updated_at = ? WHERE id = ?").run(next, now2(), Number(row2.id));
42566
- });
42567
- return dealOf(rowOf2(`deal:${row2.id}`));
42738
+ authorActor(context, by);
42739
+ const { kind: kind3, row: row2 } = rowOf2(reference2);
42740
+ notDeleted(row2, kind3, "moves");
42741
+ const next = stageRow(text3(stage, "a stage's name", 80) ?? "", kind3, Number(row2.pipeline_id));
42742
+ write(database, () => setStage(kind3, Number(row2.id), next, next.outcome, today()));
42743
+ return read2(`${kind3}:${row2.id}`);
42568
42744
  }, "move"),
42569
42745
  close: /* @__PURE__ */ __name((reference2, { status, date: date3, reason, by }) => {
42570
- ownerOnly(by, "closes a deal");
42571
- const outcome = oneOf4(status, ["won", "lost"], "a closed deal's status");
42572
- const day = isoDate(date3, "the day a deal closed") ?? new Date(now2()).toISOString().slice(0, 10);
42573
- const why = text3(reason, "why a deal closed", 2e3);
42574
- const row2 = rowOf2(reference2);
42575
- stillOpen(row2, "closes");
42746
+ authorActor(context, by);
42747
+ const outcome = oneOf4(status, ["won", "lost"], "a closed status");
42748
+ const day = isoDate(date3, "the day it closed") ?? today();
42749
+ const why = text3(reason, "why it closed", 2e3);
42750
+ const { kind: kind3, row: row2 } = rowOf2(reference2);
42751
+ notDeleted(row2, kind3, "closes");
42752
+ const stage = database.prepare("SELECT * FROM pipeline_stages WHERE pipeline_id = ? AND outcome = ? ORDER BY position, id LIMIT 1").get(Number(row2.pipeline_id), outcome) ?? { id: row2.stage_id };
42576
42753
  write(database, () => {
42577
- database.prepare("UPDATE opportunities SET status = ?, closed_date = ?, updated_at = ?, metadata = CASE WHEN ? IS NULL THEN metadata ELSE json_set(coalesce(metadata, '{}'), '$.closed_reason', ?) END WHERE id = ?").run(outcome, day, now2(), why, why, Number(row2.id));
42754
+ setStage(kind3, Number(row2.id), stage, outcome, day);
42755
+ if (why !== null)
42756
+ database.prepare(`UPDATE ${TABLES[kind3]} SET metadata = json_set(coalesce(metadata, '{}'), '$.closed_reason', ?) WHERE id = ?`).run(why, Number(row2.id));
42578
42757
  });
42579
- return dealOf(rowOf2(`deal:${row2.id}`));
42580
- }, "close"),
42581
- confirm: /* @__PURE__ */ __name((reference2, by, reason) => decide2(reference2, by, reason, true), "confirm"),
42582
- reject: /* @__PURE__ */ __name((reference2, by, reason) => decide2(reference2, by, reason, false), "reject")
42758
+ return read2(`${kind3}:${row2.id}`);
42759
+ }, "close")
42583
42760
  };
42584
42761
  }, "dealOperationsOver");
42585
42762
  var dealsStoreOver = /* @__PURE__ */ __name((context) => {
42586
42763
  const operations = dealOperationsOver(context);
42587
42764
  return {
42588
42765
  addPipeline: /* @__PURE__ */ __name(async (input) => operations.addPipeline(input), "addPipeline"),
42589
- pipelines: /* @__PURE__ */ __name(async () => operations.pipelines(), "pipelines"),
42766
+ pipelines: /* @__PURE__ */ __name(async (filter) => operations.pipelines(filter), "pipelines"),
42767
+ pipeline: /* @__PURE__ */ __name(async (reference2, options) => operations.pipeline(reference2, options), "pipeline"),
42590
42768
  add: /* @__PURE__ */ __name(async (input) => operations.add(input), "add"),
42591
42769
  get: /* @__PURE__ */ __name(async (reference2) => operations.get(reference2), "get"),
42592
42770
  list: /* @__PURE__ */ __name(async (filter) => operations.list(filter), "list"),
42771
+ find: /* @__PURE__ */ __name(async (search2) => operations.find(search2), "find"),
42593
42772
  move: /* @__PURE__ */ __name(async (reference2, input) => operations.move(reference2, input), "move"),
42594
- close: /* @__PURE__ */ __name(async (reference2, input) => operations.close(reference2, input), "close"),
42595
- confirm: /* @__PURE__ */ __name(async (reference2, by, reason) => operations.confirm(reference2, by, reason), "confirm"),
42596
- reject: /* @__PURE__ */ __name(async (reference2, by, reason) => operations.reject(reference2, by, reason), "reject")
42773
+ close: /* @__PURE__ */ __name(async (reference2, input) => operations.close(reference2, input), "close")
42597
42774
  };
42598
42775
  }, "dealsStoreOver");
42599
42776
 
42600
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
42777
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
42601
42778
  var NOTE_FIELDS = [
42602
42779
  "text",
42603
42780
  "exact",
@@ -43027,7 +43204,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
43027
43204
  };
43028
43205
  }, "noteSearchOver");
43029
43206
 
43030
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
43207
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
43031
43208
  var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
43032
43209
  var inEventAccounts = /* @__PURE__ */ __name((event) => searchableCopy(event, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
43033
43210
  var EVENT_CORPUS = {
@@ -43159,7 +43336,7 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
43159
43336
  };
43160
43337
  }, "eventSearchOver");
43161
43338
 
43162
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-entries.js
43339
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-entries.js
43163
43340
  var refuse2 = /* @__PURE__ */ __name((message2, reason) => {
43164
43341
  throw new CliError("validation_error", message2, { reason });
43165
43342
  }, "refuse");
@@ -43237,7 +43414,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
43237
43414
  };
43238
43415
  }, "paymentEntriesOver");
43239
43416
 
43240
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
43417
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
43241
43418
  var EVIDENCE_FINDINGS_KIND = "evidence_findings";
43242
43419
  var reference = /* @__PURE__ */ __name((raw) => {
43243
43420
  if (/^(document|note):[1-9]\d*$/.test(raw))
@@ -43263,7 +43440,7 @@ var validateEvidenceFindings = /* @__PURE__ */ __name((input) => {
43263
43440
  return valid;
43264
43441
  }, "validateEvidenceFindings");
43265
43442
 
43266
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/domain/moment.js
43443
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/domain/moment.js
43267
43444
  var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
43268
43445
  try {
43269
43446
  return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
@@ -43275,9 +43452,9 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
43275
43452
  }
43276
43453
  }, "calendarMoment");
43277
43454
 
43278
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
43455
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
43279
43456
  var NAMED3 = "SELECT f.*, b.name AS author_name, b.kind AS author_kind FROM facts f LEFT JOIN bots b ON f.author_type = 'bot' AND b.id = f.author_id";
43280
- var iso9 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
43457
+ var iso10 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
43281
43458
  var oneOf5 = /* @__PURE__ */ __name((value, allowed, what) => {
43282
43459
  if (typeof value !== "string" || !allowed.includes(value))
43283
43460
  throw new CliError("validation_error", `${what} is one of ${allowed.join(", ")}`);
@@ -43293,7 +43470,7 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
43293
43470
  status: row2.status,
43294
43471
  ...projectOf(database, row2),
43295
43472
  ...subjectOf(database, row2),
43296
- occurredAt: row2.occurred_at == null ? null : iso9(row2.occurred_at),
43473
+ occurredAt: row2.occurred_at == null ? null : iso10(row2.occurred_at),
43297
43474
  supersedes: row2.supersedes_id == null ? null : `fact:${row2.supersedes_id}`,
43298
43475
  author: authorOf(row2),
43299
43476
  model: row2.model == null ? null : String(row2.model),
@@ -43301,8 +43478,8 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
43301
43478
  scope: row2.scope == null ? null : row2.scope,
43302
43479
  source: String(row2.source),
43303
43480
  evidence: evidenceOf(context, { type: "fact", id: Number(row2.id) }),
43304
- createdAt: iso9(row2.created_at),
43305
- updatedAt: iso9(row2.updated_at)
43481
+ createdAt: iso10(row2.created_at),
43482
+ updatedAt: iso10(row2.updated_at)
43306
43483
  }), "factOf");
43307
43484
  const rowOf2 = /* @__PURE__ */ __name((reference2) => {
43308
43485
  const thing = requiredThing(database, reference2.includes(":") ? reference2 : `fact:${reference2}`, "the fact");
@@ -43418,7 +43595,7 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
43418
43595
  const step = {
43419
43596
  step: "revoked",
43420
43597
  by: "owner",
43421
- at: iso9(at),
43598
+ at: iso10(at),
43422
43599
  confirmedBy: { type: current.confirmed_by_type, id: String(current.confirmed_by_id) },
43423
43600
  ...decision === void 0 ? {} : { decision },
43424
43601
  ...reason?.trim() ? { reason: reason.trim() } : {}
@@ -43484,7 +43661,7 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
43484
43661
  };
43485
43662
  }, "factsStoreOver");
43486
43663
 
43487
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
43664
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
43488
43665
  var invalid2 = /* @__PURE__ */ __name((message2) => {
43489
43666
  throw new CliError("validation_error", message2);
43490
43667
  }, "invalid");
@@ -43588,10 +43765,10 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
43588
43765
  return { snapshot: snapshot2, snapshotParts, previous, outcomes, create };
43589
43766
  }, "findingsCoreOver");
43590
43767
 
43591
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
43768
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
43592
43769
  var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
43593
43770
  var PROPOSAL_VERDICTS = ["useful", "not_useful"];
43594
- var iso10 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
43771
+ var iso11 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
43595
43772
  var json2 = /* @__PURE__ */ __name((value) => value == null ? null : JSON.parse(String(value)), "json");
43596
43773
  var STATUS = `CASE WHEN p.status = 'approved' AND p.kind IN ('${MEETING_FINDINGS_KIND}', '${EVIDENCE_FINDINGS_KIND}', '${MAIL_FINDINGS_KIND}') AND json_array_length(p.result, '$.accepted') = 0 THEN 'rejected' ELSE p.status END`;
43597
43774
  var NAMED4 = `SELECT p.*, ${STATUS} AS shown_status, b.name AS proposer_name, b.kind AS proposer_kind FROM proposed_actions p LEFT JOIN bots b ON p.proposed_by_type = 'bot' AND b.id = p.proposed_by_id`;
@@ -43622,12 +43799,12 @@ var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
43622
43799
  kind: row2.proposed_by_type !== "bot" ? null : row2.proposer_kind === "rule" || row2.proposer_name === "rule" ? "rule" : "agent"
43623
43800
  },
43624
43801
  decidedBy: row2.decided_by_type == null ? null : { type: row2.decided_by_type, id: String(row2.decided_by_id) },
43625
- decidedAt: iso10(row2.decided_at),
43626
- executedAt: iso10(row2.executed_at),
43802
+ decidedAt: iso11(row2.decided_at),
43803
+ executedAt: iso11(row2.executed_at),
43627
43804
  result: json2(row2.result),
43628
43805
  error: row2.error == null ? null : String(row2.error),
43629
43806
  verdict: row2.verdict ?? null,
43630
- createdAt: iso10(row2.created_at)
43807
+ createdAt: iso11(row2.created_at)
43631
43808
  };
43632
43809
  }, "actionOf");
43633
43810
  const rowOf2 = /* @__PURE__ */ __name((id2) => {
@@ -43753,7 +43930,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
43753
43930
  };
43754
43931
  }, "proposedActionsStoreOver");
43755
43932
 
43756
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
43933
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
43757
43934
  var stale = /* @__PURE__ */ __name(() => {
43758
43935
  throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
43759
43936
  reason: "evidence-findings.stale"
@@ -43934,7 +44111,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
43934
44111
  };
43935
44112
  }, "evidenceFindingsStoreOver");
43936
44113
 
43937
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
44114
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
43938
44115
  var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
43939
44116
  var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
43940
44117
  rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
@@ -43987,7 +44164,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
43987
44164
  }, "forPerson")
43988
44165
  }), "involvementStoreOver");
43989
44166
 
43990
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
44167
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
43991
44168
  import { createHash as createHash12 } from "node:crypto";
43992
44169
  var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
43993
44170
  var id = /* @__PURE__ */ __name((value) => {
@@ -44073,7 +44250,7 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
44073
44250
  };
44074
44251
  }, "meetingProjectsStoreOver");
44075
44252
 
44076
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
44253
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
44077
44254
  var ORGANIZATIONS_QUERY = {
44078
44255
  entity: "organization",
44079
44256
  backend: "sql",
@@ -44114,7 +44291,7 @@ var REMINDERS_QUERY = {
44114
44291
  })
44115
44292
  };
44116
44293
 
44117
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/organizations.js
44294
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/organizations.js
44118
44295
  var organizationOf = /* @__PURE__ */ __name((row2) => ({
44119
44296
  id: String(row2.id),
44120
44297
  ref: `organization:${row2.id}`,
@@ -44147,7 +44324,7 @@ var organizationsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) =>
44147
44324
  }), "updateOrganization")
44148
44325
  }), "organizationsStoreOver");
44149
44326
 
44150
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-proposals.js
44327
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-proposals.js
44151
44328
  var relationOf = /* @__PURE__ */ __name((link3) => ({
44152
44329
  id: link3.id,
44153
44330
  from: link3.from,
@@ -44373,16 +44550,16 @@ var decidedOrigin = /* @__PURE__ */ __name((by) => by === "owner" ? { origin: "o
44373
44550
  provenance: `agent:${by.bot} for the owner: ${by.reason.trim()}`
44374
44551
  }, "decidedOrigin");
44375
44552
 
44376
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
44553
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
44377
44554
  import { createHash as createHash15 } from "node:crypto";
44378
44555
 
44379
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
44556
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
44380
44557
  import { createHash as createHash14 } from "node:crypto";
44381
44558
 
44382
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
44559
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
44383
44560
  import { createHash as createHash13 } from "node:crypto";
44384
44561
 
44385
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
44562
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
44386
44563
  var consolidationId = /* @__PURE__ */ __name((value, field4) => {
44387
44564
  if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
44388
44565
  throw new CliError("validation_error", `${field4} must be a positive canonical tag id`);
@@ -44433,7 +44610,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
44433
44610
  return input;
44434
44611
  }, "consolidationApplyInput");
44435
44612
 
44436
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
44613
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
44437
44614
  var receiptOf = /* @__PURE__ */ __name((row2) => ({
44438
44615
  id: String(row2.id),
44439
44616
  sourceId: String(row2.source_id),
@@ -44508,7 +44685,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
44508
44685
  }, { beforeCommit: check3 });
44509
44686
  }, "applyTagConsolidation");
44510
44687
 
44511
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
44688
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
44512
44689
  var selections = [
44513
44690
  ["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
44514
44691
  ["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
@@ -44652,7 +44829,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
44652
44829
  };
44653
44830
  }, "previewRows");
44654
44831
 
44655
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
44832
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
44656
44833
  var kinds = ["project", "tag", "topic"];
44657
44834
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
44658
44835
  if (signal?.aborted)
@@ -44916,13 +45093,13 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
44916
45093
  };
44917
45094
  }, "vocabularyStoreOver");
44918
45095
 
44919
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
45096
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
44920
45097
  var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
44921
45098
  var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
44922
45099
  var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
44923
45100
  var SCOPES = ["personal", "work"];
44924
45101
  var UNVERIFIED = { type: "unknown" };
44925
- var iso11 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
45102
+ var iso12 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
44926
45103
  var bounded2 = /* @__PURE__ */ __name((limit = 100, offset = 0) => {
44927
45104
  if (!Number.isInteger(limit) || limit < 1 || limit > 500 || !Number.isInteger(offset) || offset < 0 || offset > 1e5)
44928
45105
  throw new CliError("validation_error", "limit takes 1\u2013500 and offset takes 0\u2013100000");
@@ -45024,7 +45201,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
45024
45201
  return { type: "chat", id: parsed3.chat };
45025
45202
  if (parsed3.type === "folder")
45026
45203
  return { type: "folder", id: parsed3.id, path: parsed3.path };
45027
- if (parsed3.type === "entity" || parsed3.type === "memory" || parsed3.type === "fact" || parsed3.type === "bot" || parsed3.type === "event" || parsed3.type === "meeting" || parsed3.type === "invoice" || parsed3.type === "payment" || parsed3.type === "order" || parsed3.type === "deal")
45204
+ if (parsed3.type === "entity" || parsed3.type === "memory" || parsed3.type === "fact" || parsed3.type === "bot" || parsed3.type === "event" || parsed3.type === "meeting" || parsed3.type === "invoice" || parsed3.type === "payment" || parsed3.type === "order" || parsed3.type === "deal" || parsed3.type === "lead" || parsed3.type === "pipeline")
45028
45205
  return void 0;
45029
45206
  return { type: parsed3.type, id: parsed3.id };
45030
45207
  }, "targetOfThing");
@@ -45055,8 +45232,8 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
45055
45232
  text: String(row2.body),
45056
45233
  revision: Number(row2.revision),
45057
45234
  authoredBy: "owner",
45058
- createdAt: iso11(row2.created_at),
45059
- updatedAt: iso11(row2.updated_at)
45235
+ createdAt: iso12(row2.created_at),
45236
+ updatedAt: iso12(row2.updated_at)
45060
45237
  };
45061
45238
  }, "annotationOf");
45062
45239
  const noteRow = /* @__PURE__ */ __name((id2) => /^\d+$/.test(id2) ? database.prepare("SELECT * FROM notes WHERE id = ? AND deleted_at IS NULL").get(Number(id2)) : void 0, "noteRow");
@@ -45077,7 +45254,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
45077
45254
  type: row2.type,
45078
45255
  organizationId: row2.organization_id == null ? null : String(row2.organization_id),
45079
45256
  scope: row2.scope,
45080
- createdAt: iso11(row2.created_at)
45257
+ createdAt: iso12(row2.created_at)
45081
45258
  }), "projectOf");
45082
45259
  const proposals = relationProposalsOver(context);
45083
45260
  const RELATIONS = `SELECT * FROM links WHERE kind IN (${RELATION_KINDS.map(linkKind).join(",")}) AND to_id IS NOT NULL`;
@@ -45113,7 +45290,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
45113
45290
  const reminderOf = /* @__PURE__ */ __name((row2) => ({
45114
45291
  id: String(row2.id),
45115
45292
  task: taskIdOf(database, Number(row2.task_id)) ?? String(row2.task_id),
45116
- dueAt: iso11(row2.due_at),
45293
+ dueAt: iso12(row2.due_at),
45117
45294
  timezone: String(row2.timezone),
45118
45295
  state: row2.state,
45119
45296
  revision: Number(row2.revision),
@@ -45457,7 +45634,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
45457
45634
  return key2.padEnd(3, "X");
45458
45635
  }, "projectKey");
45459
45636
 
45460
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
45637
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
45461
45638
  var DAY5 = 864e5;
45462
45639
  var SETTING4 = "logs_pruned_at";
45463
45640
  var LOG_RETENTION = { agentActionsMs: 90 * DAY5, botUpdatePayloadsMs: 30 * DAY5 };
@@ -45484,7 +45661,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
45484
45661
  };
45485
45662
  }, "logPruner");
45486
45663
 
45487
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/mail/findings.js
45664
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/mail/findings.js
45488
45665
  var MAIL_FINDINGS_PER_RUN = 30;
45489
45666
  var MAIL_FINDINGS_PER_SENDER = 5;
45490
45667
  var invalid4 = /* @__PURE__ */ __name((message2) => {
@@ -45843,7 +46020,7 @@ var checkMailFindings = /* @__PURE__ */ __name((input) => {
45843
46020
  }, "checkMailFindings");
45844
46021
  var mailFindingFingerprint = /* @__PURE__ */ __name(({ id: _id, ...finding }) => findingHash(finding), "mailFindingFingerprint");
45845
46022
 
45846
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/mail/score.js
46023
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/mail/score.js
45847
46024
  var import_disposable_email_domains_js = __toESM(require_dist(), 1);
45848
46025
  var import_tldts = __toESM(require_cjs(), 1);
45849
46026
  var FREE_MAIL = /* @__PURE__ */ new Set([
@@ -45873,11 +46050,11 @@ var FREE_MAIL = /* @__PURE__ */ new Set([
45873
46050
  ]);
45874
46051
  var DAY_MS = 24 * 60 * 60 * 1e3;
45875
46052
 
45876
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/orders.js
46053
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/orders.js
45877
46054
  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";
45878
46055
  var orderOperationsOver = /* @__PURE__ */ __name((context) => {
45879
46056
  const { database, now: now2 } = context;
45880
- const { partyOf, partyThing, reviewedOf, written: written2, keepEvidence, ownerOnly: ownerOnly2, keepDecision } = reviewedRowsOver(context);
46057
+ const { partyOf, partyThing, reviewedOf, written: written2, keepEvidence, ownerOnly, keepDecision } = reviewedRowsOver(context);
45881
46058
  const orderOf = /* @__PURE__ */ __name((row2) => {
45882
46059
  const currency = row2.currency == null ? null : String(row2.currency);
45883
46060
  const total = row2.total == null || currency === null ? null : Number(row2.total);
@@ -45986,7 +46163,7 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
45986
46163
  return rows.filter((row2) => shop === null || fold(String(row2.supplier_name)) === shop).slice(0, limit).map(orderOf);
45987
46164
  }, "list"),
45988
46165
  setStatus: /* @__PURE__ */ __name((reference2, { status, date: date3, by }) => {
45989
- ownerOnly2(by, "moves an order on");
46166
+ ownerOnly(by, "moves an order on");
45990
46167
  const next = statusOf(status);
45991
46168
  const day = isoDate(date3, "an order's delivery date");
45992
46169
  const row2 = rowOf2(reference2);
@@ -46025,7 +46202,7 @@ var ordersStoreOver = /* @__PURE__ */ __name((context) => {
46025
46202
  };
46026
46203
  }, "ordersStoreOver");
46027
46204
 
46028
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-findings.js
46205
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-findings.js
46029
46206
  var stale2 = /* @__PURE__ */ __name(() => {
46030
46207
  throw new CliError("validation_error", "mail findings cite mail that changed since it was read; stage a new batch", {
46031
46208
  reason: "mail-findings.stale"
@@ -46066,7 +46243,7 @@ var mailFindingsStoreOver = /* @__PURE__ */ __name((context) => {
46066
46243
  return invalid5("stored findings exceed the read budget");
46067
46244
  return proposals.get(id2);
46068
46245
  }, "load");
46069
- const accountOf3 = /* @__PURE__ */ __name((proposal) => mailbox2(proposal.account), "accountOf");
46246
+ const accountOf4 = /* @__PURE__ */ __name((proposal) => mailbox2(proposal.account), "accountOf");
46070
46247
  const view = /* @__PURE__ */ __name((proposal) => {
46071
46248
  const input = proposal.payload;
46072
46249
  if (!input || !proposal.account || !["proposed", "approved", "rejected"].includes(proposal.status))
@@ -46081,7 +46258,7 @@ var mailFindingsStoreOver = /* @__PURE__ */ __name((context) => {
46081
46258
  decidedBy: proposal.decidedBy,
46082
46259
  decidedAt: proposal.decidedAt,
46083
46260
  previous: proposal.result ? proposal.result.items : input.findings.flatMap((finding) => {
46084
- const held = core.previous(accountOf3(proposal), mailFindingFingerprint(finding));
46261
+ const held = core.previous(accountOf4(proposal), mailFindingFingerprint(finding));
46085
46262
  return held ? [{ ...held, id: finding.id, reused: true }] : [];
46086
46263
  }),
46087
46264
  receipt: proposal.result
@@ -46450,7 +46627,7 @@ ${evidence.join("\n")}`, agent);
46450
46627
  return batch;
46451
46628
  }
46452
46629
  const input = proposal.payload;
46453
- const account = accountOf3(proposal);
46630
+ const account = accountOf4(proposal);
46454
46631
  const chosen = batch.input.findings.filter((finding) => accepted.includes(finding.id));
46455
46632
  if (chosen.length)
46456
46633
  cite(chosen, account, true);
@@ -46482,7 +46659,7 @@ ${evidence.join("\n")}`, agent);
46482
46659
  };
46483
46660
  }, "mailFindingsStoreOver");
46484
46661
 
46485
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
46662
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
46486
46663
  var stale3 = /* @__PURE__ */ __name(() => {
46487
46664
  throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
46488
46665
  reason: "meeting-findings.stale"
@@ -46650,7 +46827,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
46650
46827
  };
46651
46828
  }, "meetingFindingsStoreOver");
46652
46829
 
46653
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
46830
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
46654
46831
  var RANK_BATCH = 512;
46655
46832
  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";
46656
46833
  var limitOf = /* @__PURE__ */ __name((value, name, max = 1e3) => {
@@ -46921,7 +47098,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
46921
47098
  }
46922
47099
  }), "meetingVectorsOver");
46923
47100
 
46924
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
47101
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
46925
47102
  var OTHER_SOURCES = ["document", "note", "email"];
46926
47103
  var TEXTS = {
46927
47104
  document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
@@ -47022,11 +47199,11 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
47022
47199
  };
47023
47200
  }, "sourceMentionStoreOver");
47024
47201
 
47025
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
47202
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
47026
47203
  import { mkdirSync, statSync, writeFileSync } from "node:fs";
47027
47204
  import { dirname } from "node:path";
47028
47205
 
47029
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
47206
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
47030
47207
  import { readFileSync as readFileSync3 } from "node:fs";
47031
47208
  var CLIENTS_SETTING = "clients";
47032
47209
  var coreVersion = (() => {
@@ -47084,7 +47261,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
47084
47261
  return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
47085
47262
  }, "refusalAdvice");
47086
47263
 
47087
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
47264
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
47088
47265
  var GENERATED = [
47089
47266
  {
47090
47267
  "name": "20261010184427_initial",
@@ -48088,27 +48265,55 @@ WHERE json_type(params, '$.selection') = 'object';`
48088
48265
  {
48089
48266
  "name": "20261106010504_version-52-deals",
48090
48267
  "statements": [
48091
- "CREATE TABLE `opportunities` (\n `id` integer PRIMARY KEY,\n `title` text NOT NULL,\n `organization_id` integer,\n `project_id` integer,\n `stage_id` integer NOT NULL,\n `status` text NOT NULL,\n `currency` text,\n `amount` integer,\n `close_date` text,\n `closed_date` text,\n `review` text NOT NULL,\n `author_type` text NOT NULL,\n `author_id` integer NOT NULL,\n `model` text,\n `confirmed_by_type` text,\n `confirmed_by_id` integer,\n `source` text NOT NULL,\n `metadata` text,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n `deleted_at` integer,\n CONSTRAINT `fk_opportunities_organization_id_organizations_id_fk` FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`),\n CONSTRAINT `fk_opportunities_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n CONSTRAINT `fk_opportunities_stage_id_pipeline_stages_id_fk` FOREIGN KEY (`stage_id`) REFERENCES `pipeline_stages`(`id`)\n);",
48092
- "CREATE TABLE `pipeline_stages` (\n `id` integer PRIMARY KEY,\n `pipeline_id` integer NOT NULL,\n `name` text NOT NULL,\n `name_folded` text NOT NULL,\n `position` integer NOT NULL,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n CONSTRAINT `fk_pipeline_stages_pipeline_id_pipelines_id_fk` FOREIGN KEY (`pipeline_id`) REFERENCES `pipelines`(`id`),\n CONSTRAINT `pipeline_stages_pipeline_id_name_folded_unique` UNIQUE(`pipeline_id`,`name_folded`),\n CONSTRAINT `pipeline_stages_pipeline_id_position_unique` UNIQUE(`pipeline_id`,`position`)\n);",
48093
- "CREATE TABLE `pipelines` (\n `id` integer PRIMARY KEY,\n `name` text NOT NULL,\n `name_folded` text NOT NULL UNIQUE,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL\n);",
48094
- "CREATE INDEX `opportunities_by_organization_id` ON `opportunities` (`organization_id`);",
48095
- "CREATE INDEX `opportunities_by_project_id` ON `opportunities` (`project_id`);",
48096
- "CREATE INDEX `opportunities_by_stage_id` ON `opportunities` (`stage_id`);",
48097
- "CREATE INDEX `opportunities_by_author_type_author_id` ON `opportunities` (`author_type`,`author_id`);",
48098
- "CREATE INDEX `opportunities_by_confirmed_by_type_confirmed_by_id` ON `opportunities` (`confirmed_by_type`,`confirmed_by_id`);"
48268
+ "CREATE TABLE `deals` (\n `id` integer PRIMARY KEY,\n `title` text NOT NULL,\n `organization_id` integer,\n `project_id` integer,\n `stage_id` integer NOT NULL,\n `status` text NOT NULL,\n `currency` text,\n `amount` integer,\n `close_date` text,\n `closed_date` text,\n `rank` real,\n `account_id` integer,\n `external_id` text,\n `author_type` text NOT NULL,\n `author_id` integer NOT NULL,\n `model` text,\n `source` text NOT NULL,\n `metadata` text,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n `deleted_at` integer,\n CONSTRAINT `fk_deals_organization_id_organizations_id_fk` FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`),\n CONSTRAINT `fk_deals_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n CONSTRAINT `fk_deals_stage_id_pipeline_stages_id_fk` FOREIGN KEY (`stage_id`) REFERENCES `pipeline_stages`(`id`),\n CONSTRAINT `fk_deals_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`)\n);",
48269
+ "CREATE TABLE `leads` (\n `id` integer PRIMARY KEY,\n `title` text NOT NULL,\n `organization_id` integer,\n `project_id` integer,\n `stage_id` integer NOT NULL,\n `status` text NOT NULL,\n `currency` text,\n `amount` integer,\n `close_date` text,\n `closed_date` text,\n `rank` real,\n `deal_id` integer,\n `account_id` integer,\n `external_id` text,\n `author_type` text NOT NULL,\n `author_id` integer NOT NULL,\n `model` text,\n `source` text NOT NULL,\n `metadata` text,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n `deleted_at` integer,\n CONSTRAINT `fk_leads_organization_id_organizations_id_fk` FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`),\n CONSTRAINT `fk_leads_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n CONSTRAINT `fk_leads_stage_id_pipeline_stages_id_fk` FOREIGN KEY (`stage_id`) REFERENCES `pipeline_stages`(`id`),\n CONSTRAINT `fk_leads_deal_id_deals_id_fk` FOREIGN KEY (`deal_id`) REFERENCES `deals`(`id`),\n CONSTRAINT `fk_leads_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`)\n);",
48270
+ "CREATE TABLE `pipeline_stage_changes` (\n `id` integer PRIMARY KEY,\n `item_type` text NOT NULL,\n `item_id` integer NOT NULL,\n `pipeline_id` integer NOT NULL,\n `from_stage_id` integer,\n `to_stage_id` integer NOT NULL,\n `changed_at` integer NOT NULL,\n CONSTRAINT `fk_pipeline_stage_changes_pipeline_id_pipelines_id_fk` FOREIGN KEY (`pipeline_id`) REFERENCES `pipelines`(`id`),\n CONSTRAINT `fk_pipeline_stage_changes_from_stage_id_pipeline_stages_id_fk` FOREIGN KEY (`from_stage_id`) REFERENCES `pipeline_stages`(`id`),\n CONSTRAINT `fk_pipeline_stage_changes_to_stage_id_pipeline_stages_id_fk` FOREIGN KEY (`to_stage_id`) REFERENCES `pipeline_stages`(`id`)\n);",
48271
+ "CREATE TABLE `pipeline_stages` (\n `id` integer PRIMARY KEY,\n `pipeline_id` integer NOT NULL,\n `name` text NOT NULL,\n `name_folded` text NOT NULL,\n `position` integer NOT NULL,\n `outcome` text DEFAULT 'open' NOT NULL,\n `external_id` text,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n CONSTRAINT `fk_pipeline_stages_pipeline_id_pipelines_id_fk` FOREIGN KEY (`pipeline_id`) REFERENCES `pipelines`(`id`),\n CONSTRAINT `pipeline_stages_pipeline_id_name_folded_unique` UNIQUE(`pipeline_id`,`name_folded`)\n);",
48272
+ "CREATE TABLE `pipelines` (\n `id` integer PRIMARY KEY,\n `account_id` integer,\n `external_id` text,\n `kind` text DEFAULT 'deal' NOT NULL,\n `name` text NOT NULL,\n `name_folded` text NOT NULL,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n CONSTRAINT `fk_pipelines_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`)\n);",
48273
+ "CREATE UNIQUE INDEX `deals_by_account_id_external_id` ON `deals` (`account_id`,`external_id`) WHERE account_id IS NOT NULL AND external_id IS NOT NULL;",
48274
+ "CREATE INDEX `deals_by_organization_id` ON `deals` (`organization_id`);",
48275
+ "CREATE INDEX `deals_by_project_id` ON `deals` (`project_id`);",
48276
+ "CREATE INDEX `deals_by_stage_id` ON `deals` (`stage_id`);",
48277
+ "CREATE INDEX `deals_by_author_type_author_id` ON `deals` (`author_type`,`author_id`);",
48278
+ "CREATE UNIQUE INDEX `leads_by_account_id_external_id` ON `leads` (`account_id`,`external_id`) WHERE account_id IS NOT NULL AND external_id IS NOT NULL;",
48279
+ "CREATE INDEX `leads_by_organization_id` ON `leads` (`organization_id`);",
48280
+ "CREATE INDEX `leads_by_project_id` ON `leads` (`project_id`);",
48281
+ "CREATE INDEX `leads_by_stage_id` ON `leads` (`stage_id`);",
48282
+ "CREATE INDEX `leads_by_deal_id` ON `leads` (`deal_id`);",
48283
+ "CREATE INDEX `leads_by_author_type_author_id` ON `leads` (`author_type`,`author_id`);",
48284
+ "CREATE INDEX `pipeline_stage_changes_by_item_type_item_id` ON `pipeline_stage_changes` (`item_type`,`item_id`);",
48285
+ "CREATE INDEX `pipeline_stage_changes_by_pipeline_id` ON `pipeline_stage_changes` (`pipeline_id`);",
48286
+ "CREATE INDEX `pipeline_stage_changes_by_from_stage_id` ON `pipeline_stage_changes` (`from_stage_id`);",
48287
+ "CREATE INDEX `pipeline_stage_changes_by_to_stage_id` ON `pipeline_stage_changes` (`to_stage_id`);",
48288
+ "CREATE UNIQUE INDEX `pipeline_stages_by_pipeline_id_external_id` ON `pipeline_stages` (`pipeline_id`,`external_id`) WHERE external_id IS NOT NULL;",
48289
+ "CREATE INDEX `pipeline_stages_by_pipeline_id_position` ON `pipeline_stages` (`pipeline_id`,`position`);",
48290
+ "CREATE UNIQUE INDEX `pipelines_by_account_id_external_id` ON `pipelines` (`account_id`,`external_id`) WHERE account_id IS NOT NULL AND external_id IS NOT NULL;",
48291
+ "CREATE UNIQUE INDEX `pipelines_by_name_folded_kind` ON `pipelines` (`name_folded`,`kind`) WHERE account_id IS NULL;"
48099
48292
  ]
48100
48293
  },
48101
48294
  {
48102
48295
  "name": "20261106010507_version-52-deals-rules",
48103
48296
  "statements": [
48104
- "-- The store's code checks these first and says why; the triggers keep a stray write from another build or a hand\n-- edit from storing a deal with an unknown status, or an amount without its currency.\nCREATE TRIGGER opportunities_valid_bi BEFORE INSERT ON opportunities\n WHEN new.status NOT IN ('open', 'won', 'lost')\n OR new.review NOT IN ('proposed', 'confirmed', 'rejected')\n OR (new.amount IS NULL) <> (new.currency IS NULL) OR new.amount < 0 BEGIN\n SELECT RAISE(ABORT, 'opportunities: a known status and review, an amount with its currency');\nEND;",
48105
- "CREATE TRIGGER opportunities_valid_bu BEFORE UPDATE ON opportunities\n WHEN new.status NOT IN ('open', 'won', 'lost')\n OR new.review NOT IN ('proposed', 'confirmed', 'rejected')\n OR (new.amount IS NULL) <> (new.currency IS NULL) OR new.amount < 0 BEGIN\n SELECT RAISE(ABORT, 'opportunities: a known status and review, an amount with its currency');\nEND;",
48106
- "-- A deal moves between the stages of its own pipeline only.\nCREATE TRIGGER opportunities_same_pipeline_bu BEFORE UPDATE OF stage_id ON opportunities\n WHEN (SELECT pipeline_id FROM pipeline_stages WHERE id = new.stage_id)\n <> (SELECT pipeline_id FROM pipeline_stages WHERE id = old.stage_id) BEGIN\n SELECT RAISE(ABORT, 'opportunities: a deal moves within its own pipeline');\nEND;"
48297
+ "-- The store's code checks these first and says why; the triggers keep a stray write from another build, a sync or a\n-- hand edit from storing a row the store's code would refuse.\nCREATE TRIGGER pipelines_valid_bi BEFORE INSERT ON pipelines WHEN new.kind NOT IN ('deal', 'lead') BEGIN\n SELECT RAISE(ABORT, 'pipelines: kind is deal or lead');\nEND;",
48298
+ "CREATE TRIGGER pipelines_valid_bu BEFORE UPDATE ON pipelines WHEN new.kind NOT IN ('deal', 'lead') BEGIN\n SELECT RAISE(ABORT, 'pipelines: kind is deal or lead');\nEND;",
48299
+ "CREATE TRIGGER pipelines_kind_bu BEFORE UPDATE OF kind ON pipelines\n WHEN new.kind <> old.kind AND EXISTS (SELECT 1 FROM pipeline_stages s WHERE s.pipeline_id = new.id\n AND (EXISTS (SELECT 1 FROM deals d WHERE d.stage_id = s.id) OR EXISTS (SELECT 1 FROM leads l WHERE l.stage_id = s.id))) BEGIN\n SELECT RAISE(ABORT, 'pipelines: the kind of a pipeline that holds deals or leads stays');\nEND;",
48300
+ "CREATE TRIGGER pipeline_stages_valid_bi BEFORE INSERT ON pipeline_stages\n WHEN new.outcome NOT IN ('open', 'won', 'lost') BEGIN\n SELECT RAISE(ABORT, 'pipeline_stages: outcome is open, won or lost');\nEND;",
48301
+ "CREATE TRIGGER pipeline_stages_valid_bu BEFORE UPDATE ON pipeline_stages\n WHEN new.outcome NOT IN ('open', 'won', 'lost') BEGIN\n SELECT RAISE(ABORT, 'pipeline_stages: outcome is open, won or lost');\nEND;",
48302
+ "CREATE TRIGGER deals_valid_bi BEFORE INSERT ON deals\n WHEN new.status NOT IN ('open', 'won', 'lost')\n OR (new.amount IS NULL) <> (new.currency IS NULL) OR new.amount < 0\n OR (SELECT p.kind FROM pipeline_stages s JOIN pipelines p ON p.id = s.pipeline_id WHERE s.id = new.stage_id) IS NOT 'deal' BEGIN\n SELECT RAISE(ABORT, 'deals: a known status, an amount with its currency, and a stage of a deal pipeline');\nEND;",
48303
+ "CREATE TRIGGER deals_valid_bu BEFORE UPDATE ON deals\n WHEN new.status NOT IN ('open', 'won', 'lost')\n OR (new.amount IS NULL) <> (new.currency IS NULL) OR new.amount < 0\n OR (SELECT p.kind FROM pipeline_stages s JOIN pipelines p ON p.id = s.pipeline_id WHERE s.id = new.stage_id) IS NOT 'deal' BEGIN\n SELECT RAISE(ABORT, 'deals: a known status, an amount with its currency, and a stage of a deal pipeline');\nEND;",
48304
+ "-- Every stage a row enters, with the time its writer gave, is what conversion between stages is counted from.\nCREATE TRIGGER deals_stage_ai AFTER INSERT ON deals BEGIN\n INSERT INTO pipeline_stage_changes (item_type, item_id, pipeline_id, from_stage_id, to_stage_id, changed_at)\n SELECT 'deal', new.id, s.pipeline_id, NULL, new.stage_id, new.created_at FROM pipeline_stages s WHERE s.id = new.stage_id;\nEND;",
48305
+ "CREATE TRIGGER deals_stage_au AFTER UPDATE OF stage_id ON deals WHEN new.stage_id IS NOT old.stage_id BEGIN\n INSERT INTO pipeline_stage_changes (item_type, item_id, pipeline_id, from_stage_id, to_stage_id, changed_at)\n SELECT 'deal', new.id, s.pipeline_id, old.stage_id, new.stage_id, new.updated_at FROM pipeline_stages s WHERE s.id = new.stage_id;\nEND;",
48306
+ "CREATE TRIGGER leads_valid_bi BEFORE INSERT ON leads\n WHEN new.status NOT IN ('open', 'won', 'lost')\n OR (new.amount IS NULL) <> (new.currency IS NULL) OR new.amount < 0\n OR (SELECT p.kind FROM pipeline_stages s JOIN pipelines p ON p.id = s.pipeline_id WHERE s.id = new.stage_id) IS NOT 'lead' BEGIN\n SELECT RAISE(ABORT, 'leads: a known status, an amount with its currency, and a stage of a lead pipeline');\nEND;",
48307
+ "CREATE TRIGGER leads_valid_bu BEFORE UPDATE ON leads\n WHEN new.status NOT IN ('open', 'won', 'lost')\n OR (new.amount IS NULL) <> (new.currency IS NULL) OR new.amount < 0\n OR (SELECT p.kind FROM pipeline_stages s JOIN pipelines p ON p.id = s.pipeline_id WHERE s.id = new.stage_id) IS NOT 'lead' BEGIN\n SELECT RAISE(ABORT, 'leads: a known status, an amount with its currency, and a stage of a lead pipeline');\nEND;",
48308
+ "CREATE TRIGGER leads_stage_ai AFTER INSERT ON leads BEGIN\n INSERT INTO pipeline_stage_changes (item_type, item_id, pipeline_id, from_stage_id, to_stage_id, changed_at)\n SELECT 'lead', new.id, s.pipeline_id, NULL, new.stage_id, new.created_at FROM pipeline_stages s WHERE s.id = new.stage_id;\nEND;",
48309
+ "CREATE TRIGGER leads_stage_au AFTER UPDATE OF stage_id ON leads WHEN new.stage_id IS NOT old.stage_id BEGIN\n INSERT INTO pipeline_stage_changes (item_type, item_id, pipeline_id, from_stage_id, to_stage_id, changed_at)\n SELECT 'lead', new.id, s.pipeline_id, old.stage_id, new.stage_id, new.updated_at FROM pipeline_stages s WHERE s.id = new.stage_id;\nEND;",
48310
+ "-- The default lead pipeline, so a lead can be recorded before the owner or an agent makes one.\nINSERT INTO pipelines (kind, name, name_folded, created_at, updated_at)\n VALUES ('lead', 'Leads', 'leads', CAST(strftime('%s', 'now') AS INTEGER) * 1000, CAST(strftime('%s', 'now') AS INTEGER) * 1000);",
48311
+ "INSERT INTO pipeline_stages (pipeline_id, name, name_folded, position, outcome, created_at, updated_at)\n SELECT p.id, v.name, v.name, v.position, v.outcome, p.created_at, p.created_at FROM pipelines p,\n (SELECT 'new' AS name, 1 AS position, 'open' AS outcome UNION ALL SELECT 'contacted', 2, 'open'\n UNION ALL SELECT 'qualified', 3, 'open' UNION ALL SELECT 'won', 4, 'won' UNION ALL SELECT 'lost', 5, 'lost') v\n WHERE p.kind = 'lead' AND p.name_folded = 'leads' AND p.account_id IS NULL;"
48107
48312
  ]
48108
48313
  }
48109
48314
  ];
48110
48315
 
48111
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
48316
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
48112
48317
  var MANIFEST = [
48113
48318
  { name: "20261010184427_initial", version: 1, minCompatible: 1 },
48114
48319
  { name: "20261011035353_version-2-facts", version: 2, minCompatible: 1 },
@@ -48202,7 +48407,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
48202
48407
  return migrations;
48203
48408
  }, "generatedMigrations");
48204
48409
 
48205
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/migrations.js
48410
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/migrations.js
48206
48411
  var MIGRATIONS = generatedMigrations();
48207
48412
  var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
48208
48413
  version INTEGER PRIMARY KEY,
@@ -48255,7 +48460,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
48255
48460
  }
48256
48461
  }, "migrate");
48257
48462
 
48258
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
48463
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
48259
48464
  var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
48260
48465
  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 ?");
48261
48466
  if (pending.get(0, 1) === void 0)
@@ -48277,7 +48482,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
48277
48482
  }
48278
48483
  }, "fillJoinKeys");
48279
48484
 
48280
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
48485
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
48281
48486
  var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
48282
48487
  refuseOwnerStoreInTests(path);
48283
48488
  const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
@@ -48291,8 +48496,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
48291
48496
  }, "openSqlite");
48292
48497
  var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
48293
48498
  quietSqliteWarning();
48294
- const { drizzle } = await import("./node-CWKAIOEM.js");
48295
- const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-LSEKVRDA.js");
48499
+ const { drizzle } = await import("./node-K57WT42O.js");
48500
+ const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-KS6ORRIG.js");
48296
48501
  const client = await nodeClient(path, { readOnly });
48297
48502
  try {
48298
48503
  return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
@@ -48302,8 +48507,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
48302
48507
  }
48303
48508
  }, "openUnderNode");
48304
48509
  var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
48305
- const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-BO4LTQHX.js");
48306
- const { drizzle } = await import("./bun-H6RSODZ3.js");
48510
+ const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-GXME7EMT.js");
48511
+ const { drizzle } = await import("./bun-UYRQXF33.js");
48307
48512
  const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
48308
48513
  try {
48309
48514
  return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
@@ -48313,7 +48518,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
48313
48518
  }
48314
48519
  }, "openUnderBun");
48315
48520
 
48316
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-facts.js
48521
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-facts.js
48317
48522
  var PAYMENT_FACTS_TO_MOVE = "payment_facts_to_move";
48318
48523
  var paymentOf = /* @__PURE__ */ __name((metadata3) => {
48319
48524
  try {
@@ -48381,7 +48586,7 @@ var movePaymentFacts = /* @__PURE__ */ __name((context) => {
48381
48586
  });
48382
48587
  }, "movePaymentFacts");
48383
48588
 
48384
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
48589
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
48385
48590
  var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
48386
48591
  const ours = MIGRATIONS.at(-1)?.version ?? 0;
48387
48592
  if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
@@ -48396,7 +48601,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
48396
48601
  throw new CliError("configuration_error", `The store requires schema ${minCompatible}, but this tool supports ${ours}; ${refusalAdvice(storeClients(database), command, version)}`);
48397
48602
  }, "assertReadCompatible");
48398
48603
 
48399
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/suggested-links.js
48604
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/suggested-links.js
48400
48605
  var SUGGESTED_LINKS_TO_MOVE = "suggested_links_to_move";
48401
48606
  var proposerOf2 = /* @__PURE__ */ __name((provenance2) => {
48402
48607
  if (provenance2?.startsWith("rule:"))
@@ -48442,7 +48647,7 @@ var moveSuggestedLinks = /* @__PURE__ */ __name((database, now2) => {
48442
48647
  });
48443
48648
  }, "moveSuggestedLinks");
48444
48649
 
48445
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/test-accounts.js
48650
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/test-accounts.js
48446
48651
  var TEST_ACCOUNTS_TO_PURGE = "test_accounts_to_purge";
48447
48652
  var TEST_PROVIDER = "chat";
48448
48653
  var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
@@ -48463,7 +48668,7 @@ var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
48463
48668
  }
48464
48669
  }, "purgeTestAccounts");
48465
48670
 
48466
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
48671
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
48467
48672
  var BACKFILL_ON_OPEN = 5e3;
48468
48673
  var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
48469
48674
  var createWritable = /* @__PURE__ */ __name((file) => {
@@ -48528,10 +48733,10 @@ var openStoreContext = /* @__PURE__ */ __name(async ({ path, env, now: now2 = Da
48528
48733
  }
48529
48734
  }, "openStoreContext");
48530
48735
 
48531
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
48736
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
48532
48737
  import { createHash as createHash16 } from "node:crypto";
48533
48738
 
48534
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
48739
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
48535
48740
  var text4 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
48536
48741
  var ref = text4(2048);
48537
48742
  var timestamp2 = pipe(number(), safeInteger(), minValue(0));
@@ -48597,7 +48802,7 @@ var projectAnnotationsSchema = strictObject({
48597
48802
  }))
48598
48803
  });
48599
48804
 
48600
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
48805
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
48601
48806
  var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
48602
48807
  var invalid7 = /* @__PURE__ */ __name((field4) => {
48603
48808
  throw new CliError("validation_error", `invalid project annotations.${field4}`);
@@ -48701,7 +48906,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
48701
48906
  invalid7("external.unused");
48702
48907
  }, "validateProjectAnnotationsGraph");
48703
48908
 
48704
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
48909
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
48705
48910
  var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
48706
48911
  var ref2 = pipe(string(), minLength(1), maxLength(2048));
48707
48912
  var targetSchema = strictObject({
@@ -48807,7 +49012,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
48807
49012
  };
48808
49013
  }, "planBoundProjectAnnotations");
48809
49014
 
48810
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
49015
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
48811
49016
  import { createHash as createHash17 } from "node:crypto";
48812
49017
  var text5 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
48813
49018
  var timestamp3 = pipe(number(), safeInteger(), minValue(0));
@@ -48901,7 +49106,7 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
48901
49106
  })).digest("hex");
48902
49107
  }, "projectAnnotationSnapshotFingerprint");
48903
49108
 
48904
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
49109
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
48905
49110
  var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
48906
49111
  if (!request || typeof request !== "object" || Array.isArray(request))
48907
49112
  throw new CliError("validation_error", "project annotation request is required");
@@ -48918,7 +49123,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
48918
49123
  return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
48919
49124
  }, "projectAnnotationRequest");
48920
49125
 
48921
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
49126
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
48922
49127
  var SnapshotBudget = class {
48923
49128
  static {
48924
49129
  __name(this, "SnapshotBudget");
@@ -48944,13 +49149,13 @@ var SnapshotBudget = class {
48944
49149
  }
48945
49150
  };
48946
49151
 
48947
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
49152
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
48948
49153
  import { createHash as createHash19 } from "node:crypto";
48949
49154
 
48950
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
49155
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
48951
49156
  var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
48952
49157
 
48953
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
49158
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
48954
49159
  import { createHash as createHash18 } from "node:crypto";
48955
49160
  var invalid9 = /* @__PURE__ */ __name(() => {
48956
49161
  throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
@@ -49093,7 +49298,7 @@ var ProjectSnapshotSources = class {
49093
49298
  }
49094
49299
  };
49095
49300
 
49096
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
49301
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
49097
49302
  var unsupported = /* @__PURE__ */ __name(() => {
49098
49303
  throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
49099
49304
  }, "unsupported");
@@ -49264,7 +49469,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, bu
49264
49469
  return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
49265
49470
  }), "projectAnnotationSnapshot");
49266
49471
 
49267
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
49472
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
49268
49473
  var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, manifest, bindings, budget) => read(database, () => {
49269
49474
  const current = projectAnnotationSnapshot(database, projectId2, budget).snapshot;
49270
49475
  const sources = new ProjectSnapshotSources(database, budget);
@@ -49326,7 +49531,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, ma
49326
49531
  };
49327
49532
  }), "previewAnnotationSnapshot");
49328
49533
 
49329
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
49534
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
49330
49535
  var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, snapshot2, bindings) => {
49331
49536
  const mappings = { ...bindings };
49332
49537
  const resolve = /* @__PURE__ */ __name((ref3) => {
@@ -49368,7 +49573,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, sna
49368
49573
  return mappings;
49369
49574
  }, "restoreAnnotationRecords");
49370
49575
 
49371
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
49576
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
49372
49577
  var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
49373
49578
  async preview(request) {
49374
49579
  const { snapshot: snapshot2, projectId: projectId2 } = projectAnnotationRequest(request);
@@ -49398,7 +49603,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
49398
49603
  }
49399
49604
  }), "projectAnnotationStoreOver");
49400
49605
 
49401
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
49606
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
49402
49607
  var PROJECTED = {
49403
49608
  invoice: { roles: ["issuer", "counterparty", "project"], many: [] },
49404
49609
  payment: { roles: ["payer", "payee", "project", "settles"], many: ["settles"] }
@@ -49416,7 +49621,7 @@ var codeOf = /* @__PURE__ */ __name((error) => {
49416
49621
  return error.code === "not_found" ? "record.reference-not-found" : "record.entity";
49417
49622
  }, "codeOf");
49418
49623
  var unsettled = /* @__PURE__ */ __name((fields4, relations) => recordFingerprint(fields4, relations.filter((relation) => relation.role !== "settles")), "unsettled");
49419
- var iso12 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
49624
+ var iso13 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
49420
49625
  var stringField = /* @__PURE__ */ __name((fields4, name) => {
49421
49626
  const value = fields4[name];
49422
49627
  if (value === void 0 || value === null)
@@ -49749,9 +49954,9 @@ var recordStoreOver = /* @__PURE__ */ __name((context) => {
49749
49954
  entity: entityRef(row2.entity_type, row2.entity_id),
49750
49955
  flagged: row2.entity_id != null && (row2.deleted_at != null || row2.projected_fingerprint !== row2.fingerprint),
49751
49956
  batchId: String(row2.batch_id),
49752
- createdAt: iso12(row2.created_at),
49753
- updatedAt: iso12(row2.updated_at),
49754
- deletedAt: row2.deleted_at == null ? null : iso12(row2.deleted_at)
49957
+ createdAt: iso13(row2.created_at),
49958
+ updatedAt: iso13(row2.updated_at),
49959
+ deletedAt: row2.deleted_at == null ? null : iso13(row2.deleted_at)
49755
49960
  }), "sourceRecordOf");
49756
49961
  const SELECT2 = "SELECT r.*, a.provider, a.external_id AS account FROM records r JOIN accounts a ON a.id = r.account_id ";
49757
49962
  const rowOf2 = /* @__PURE__ */ __name((key2) => sql2(`${SELECT2}WHERE a.provider = ? AND a.external_id = ? AND r.type = ? AND r.external_id = ?`).get(key2.provider, key2.account, key2.type, key2.externalId), "rowOf");
@@ -49811,7 +50016,7 @@ var recordStoreOver = /* @__PURE__ */ __name((context) => {
49811
50016
  };
49812
50017
  }, "recordStoreOver");
49813
50018
 
49814
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
50019
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
49815
50020
  var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
49816
50021
  const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
49817
50022
  let merged = { from: from2, to };
@@ -49824,7 +50029,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
49824
50029
  }, "markRange");
49825
50030
  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");
49826
50031
 
49827
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-analysis-marks.js
50032
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/task-analysis-marks.js
49828
50033
  var prefixOf2 = /* @__PURE__ */ __name(({ provider, account }) => `task_analysis:${provider}:${account}:`, "prefixOf");
49829
50034
  var markOf = /* @__PURE__ */ __name((prefix, row2) => ({
49830
50035
  chatId: String(row2.key).slice(prefix.length),
@@ -49845,7 +50050,7 @@ var setTaskAnalysisMark = /* @__PURE__ */ __name((database, account, { chatId, c
49845
50050
  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);
49846
50051
  }, "setTaskAnalysisMark");
49847
50052
 
49848
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
50053
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
49849
50054
  var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
49850
50055
  var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
49851
50056
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
@@ -49855,7 +50060,7 @@ var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) =
49855
50060
  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);
49856
50061
  }, "setTaskRulesStop");
49857
50062
 
49858
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sync.js
50063
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sync.js
49859
50064
  var syncStoreOver = /* @__PURE__ */ __name((context) => {
49860
50065
  const { database } = context;
49861
50066
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
@@ -49914,7 +50119,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
49914
50119
  };
49915
50120
  }, "syncStoreOver");
49916
50121
 
49917
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/tags.js
50122
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/tags.js
49918
50123
  var tagsStoreOver = /* @__PURE__ */ __name((context) => {
49919
50124
  const { database } = context;
49920
50125
  return {
@@ -49936,7 +50141,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
49936
50141
  };
49937
50142
  }, "tagsStoreOver");
49938
50143
 
49939
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
50144
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
49940
50145
  var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
49941
50146
  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
49942
50147
  WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
@@ -50063,7 +50268,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
50063
50268
  dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
50064
50269
  }, "savePictureChunks");
50065
50270
 
50066
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
50271
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
50067
50272
  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,
50068
50273
  EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
50069
50274
  FROM messages m
@@ -50152,7 +50357,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
50152
50357
  return plain2(best(found2));
50153
50358
  }, "nearestMessages");
50154
50359
 
50155
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/vectors.js
50360
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/vectors.js
50156
50361
  var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
50157
50362
  const { database } = context;
50158
50363
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -50410,7 +50615,7 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
50410
50615
  embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
50411
50616
  }), "vectorsStoreOver");
50412
50617
 
50413
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
50618
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
50414
50619
  import { existsSync, readFileSync as readFileSync4 } from "node:fs";
50415
50620
  import { dirname as dirname2, join as join2 } from "node:path";
50416
50621
  var BOOKKEEPING = ["schema_migrations", "store_settings"];
@@ -50498,10 +50703,10 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
50498
50703
  }
50499
50704
  }, "lastBackup");
50500
50705
 
50501
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/providers.js
50706
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/providers.js
50502
50707
  var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
50503
50708
 
50504
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
50709
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
50505
50710
  var COUNTED_TABLES = [
50506
50711
  "accounts",
50507
50712
  "chats",
@@ -50586,7 +50791,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
50586
50791
  };
50587
50792
  }, "storeContents");
50588
50793
 
50589
- // node_modules/.pnpm/@wirecat+cli-core@0.586.0_@wirecat+cli-base@0.79.0_commander@15.0.0_esbuild@0.28.2_type_bdecddef0ae5a50ae90cab8b9e35c13b/node_modules/@wirecat/cli-core/dist/store/store.js
50794
+ // node_modules/.pnpm/@wirecat+cli-core@0.590.0_@wirecat+cli-base@0.80.1_commander@15.0.0_esbuild@0.28.2_type_4c7167080feb2ba6356a64767981f5fd/node_modules/@wirecat/cli-core/dist/store/store.js
50590
50795
  var openStore = /* @__PURE__ */ __name(async (options = {}) => {
50591
50796
  const context = await openStoreContext(options);
50592
50797
  try {
@@ -50652,7 +50857,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
50652
50857
  const facts2 = once3(() => factsStoreOver(context));
50653
50858
  const finance = once3(() => financeStoreOver(context));
50654
50859
  const orders2 = once3(() => ordersStoreOver(context));
50655
- const deals = once3(() => dealsStoreOver(context));
50860
+ const deals2 = once3(() => dealsStoreOver(context));
50656
50861
  const records2 = once3(() => recordStoreOver(context));
50657
50862
  const memories2 = once3(() => memoriesStoreOver(context));
50658
50863
  const proposedActions2 = once3(() => proposedActionsStoreOver(context));
@@ -50764,7 +50969,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
50764
50969
  return orders2();
50765
50970
  },
50766
50971
  get deals() {
50767
- return deals();
50972
+ return deals2();
50768
50973
  },
50769
50974
  get records() {
50770
50975
  return records2();