@wirecat/cli-memo 0.131.67 → 0.131.69

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 (152) hide show
  1. package/dist/bin/memo.js +2 -2
  2. package/dist/bundle/{all-profiles-W3GRNNLJ.js → all-profiles-6JKSPBBO.js} +5 -5
  3. package/dist/bundle/{anthropic-GWMYHBO4.js → anthropic-YA2N6EJ4.js} +2 -2
  4. package/dist/bundle/{app-server-RQ26EXNI.js → app-server-UP3AL2XQ.js} +35 -35
  5. package/dist/bundle/auto-IKZIROGF.js +85 -0
  6. package/dist/bundle/{bun-KKLPQTG5.js → bun-OUFOAYV4.js} +2 -2
  7. package/dist/bundle/{bun-sqlite-WKIZJNTG.js → bun-sqlite-5RZTFU2Q.js} +2 -2
  8. package/dist/bundle/{chunk-R4H5HSQZ.js → chunk-22CDLXSR.js} +4 -4
  9. package/dist/bundle/{chunk-XI5UABKO.js → chunk-267N22E4.js} +1 -1
  10. package/dist/bundle/{chunk-7IKET6ES.js → chunk-276KPJI5.js} +2 -2
  11. package/dist/bundle/{chunk-32ROGX5N.js → chunk-2C7Z7CKD.js} +1 -1
  12. package/dist/bundle/{chunk-NNUJWCEJ.js → chunk-2DQYP2K3.js} +1 -1
  13. package/dist/bundle/{chunk-TQXXOUOX.js → chunk-2F35N6BI.js} +1 -1
  14. package/dist/bundle/{chunk-BOOEDDVY.js → chunk-2NFI7SDW.js} +83 -63
  15. package/dist/bundle/{chunk-ECMYCWG2.js → chunk-3LGLKLBA.js} +2 -2
  16. package/dist/bundle/{chunk-Q4JYHQ47.js → chunk-3TFK7RBA.js} +342 -323
  17. package/dist/bundle/{chunk-VVTC2YAX.js → chunk-3YVLNOPE.js} +4 -4
  18. package/dist/bundle/{chunk-MLF5FLAP.js → chunk-4HSWIXYE.js} +4 -4
  19. package/dist/bundle/{chunk-GU3MRYK2.js → chunk-53EAI4VZ.js} +1 -1
  20. package/dist/bundle/{chunk-ZU6HZLZP.js → chunk-5EHUHZU5.js} +429 -90
  21. package/dist/bundle/{chunk-MCA265JM.js → chunk-5MUR6D2G.js} +19 -1
  22. package/dist/bundle/{chunk-ZVXXJYNW.js → chunk-5OMM4CDT.js} +2 -2
  23. package/dist/bundle/{chunk-AGNWFOAJ.js → chunk-67VEVKMJ.js} +1 -1
  24. package/dist/bundle/{chunk-JG7EDH7K.js → chunk-7JFLHRQL.js} +1 -1
  25. package/dist/bundle/{chunk-CQNYBTWP.js → chunk-7L4PBN5S.js} +2 -2
  26. package/dist/bundle/{chunk-WJ2OYD2D.js → chunk-BGWPKEKK.js} +4 -4
  27. package/dist/bundle/{chunk-TPYXULNG.js → chunk-BJJULUUC.js} +5 -5
  28. package/dist/bundle/{chunk-VUCD4DAQ.js → chunk-ECHN36DC.js} +4 -4
  29. package/dist/bundle/{chunk-TXWVZVDK.js → chunk-EDPA54WQ.js} +3 -3
  30. package/dist/bundle/{chunk-JEKIBI7P.js → chunk-EKSOPEFQ.js} +4 -4
  31. package/dist/bundle/{chunk-ZOIW2YEU.js → chunk-EO4JMJFZ.js} +7 -7
  32. package/dist/bundle/{chunk-7DANHJF6.js → chunk-FQ54GW57.js} +31 -31
  33. package/dist/bundle/{chunk-DNDELSVT.js → chunk-FZHYGJQ2.js} +5 -5
  34. package/dist/bundle/{chunk-IKZBO7NV.js → chunk-GGFL64HF.js} +623 -509
  35. package/dist/bundle/{chunk-FBSHWCIZ.js → chunk-GVEY6743.js} +9 -9
  36. package/dist/bundle/{chunk-TNHFKR6P.js → chunk-GVP6CAPH.js} +21 -21
  37. package/dist/bundle/{chunk-4JTCNMW6.js → chunk-IHHXGTMX.js} +1 -1
  38. package/dist/bundle/{chunk-TWTAWPC7.js → chunk-IJAILIZR.js} +12 -12
  39. package/dist/bundle/{chunk-XK4VVGMH.js → chunk-JMGQATR6.js} +2 -2
  40. package/dist/bundle/{chunk-GHN2KYMO.js → chunk-LYAJUZM4.js} +21 -21
  41. package/dist/bundle/{chunk-YAFSD345.js → chunk-MK6SQ32Q.js} +12 -12
  42. package/dist/bundle/{chunk-XVPMSMSP.js → chunk-MWQI6FSU.js} +3 -3
  43. package/dist/bundle/{chunk-7OMKWYFN.js → chunk-MYLNRBDF.js} +16 -9
  44. package/dist/bundle/{chunk-W7FYMZOW.js → chunk-N73YBQ42.js} +6 -6
  45. package/dist/bundle/{chunk-ZNBLWLCD.js → chunk-OAO5UCPJ.js} +151 -151
  46. package/dist/bundle/{chunk-OUSLPKWY.js → chunk-OBQ7TSUB.js} +1 -1
  47. package/dist/bundle/{chunk-TFAUB6JO.js → chunk-OHA7HDPX.js} +374 -306
  48. package/dist/bundle/{chunk-QCWA3JUT.js → chunk-PHSYMVYX.js} +2 -2
  49. package/dist/bundle/{chunk-HUPZ6XYH.js → chunk-PSYQPO6D.js} +2 -2
  50. package/dist/bundle/{chunk-SKBDI7LU.js → chunk-QAXIZHK7.js} +28 -28
  51. package/dist/bundle/{chunk-GUWRR7F2.js → chunk-QZU5IM5E.js} +2 -2
  52. package/dist/bundle/{chunk-SUCG5HBF.js → chunk-RHW3DDWI.js} +1 -1
  53. package/dist/bundle/{chunk-OU4PN7PF.js → chunk-TV75OHKJ.js} +7 -7
  54. package/dist/bundle/{chunk-4C6RU7DG.js → chunk-TVZXLAID.js} +4 -4
  55. package/dist/bundle/{chunk-7KYVUVDS.js → chunk-TXOXPQN2.js} +2 -2
  56. package/dist/bundle/{chunk-QMTCYKAA.js → chunk-UEMI6FXR.js} +6 -6
  57. package/dist/bundle/{chunk-QFSMJTEA.js → chunk-V2YS63Z5.js} +1 -1
  58. package/dist/bundle/{chunk-6SFTVGNL.js → chunk-VPKJZKXV.js} +1 -1
  59. package/dist/bundle/{chunk-XYL7GDCX.js → chunk-W2FFA7T5.js} +5 -5
  60. package/dist/bundle/{chunk-DNS2QWK3.js → chunk-WNA2WNDK.js} +3 -3
  61. package/dist/bundle/{chunk-ORKWFXWV.js → chunk-XTEJXJJ3.js} +10 -10
  62. package/dist/bundle/{chunk-GJ3P7RJF.js → chunk-YTJWIJIG.js} +5 -5
  63. package/dist/bundle/{chunk-PBOVHHYG.js → chunk-YXXAPVAZ.js} +8 -8
  64. package/dist/bundle/{command-contract-46BU5YKL.js → command-contract-OGW2DX4C.js} +11 -11
  65. package/dist/bundle/{decode-KRVQZPSB.js → decode-IJMDTGTW.js} +2 -2
  66. package/dist/bundle/{echarts-O6QQRVZE.js → echarts-EHYUXOKP.js} +2 -2
  67. package/dist/bundle/{embed-DA4H2F4F.js → embed-RUY3UIVC.js} +3 -3
  68. package/dist/bundle/{embedder-HWAFLIYM.js → embedder-P6WBMEGP.js} +6 -6
  69. package/dist/bundle/{entry-DE7GJOIZ.js → entry-7S2ONYSF.js} +4 -4
  70. package/dist/bundle/failure-NRZUB77S.js +65 -0
  71. package/dist/bundle/{first-run-GOBPIKQF.js → first-run-MLIFZSVH.js} +5 -5
  72. package/dist/bundle/{first-screen-3V3HWSQM.js → first-screen-DGTTK6VK.js} +12 -12
  73. package/dist/bundle/{instructions-GYYMBSZW.js → instructions-ZMG4FLGO.js} +1 -1
  74. package/dist/bundle/{mcp-6RDHWRXG.js → mcp-CFIL7WZU.js} +35 -35
  75. package/dist/bundle/memo.js +6 -6
  76. package/dist/bundle/{node-R3OFASC5.js → node-QYL4B7JS.js} +2 -2
  77. package/dist/bundle/{node-sqlite-DYHDZJ5A.js → node-sqlite-ESTT2OCF.js} +3 -3
  78. package/dist/bundle/{oauth-SMCDSCXQ.js → oauth-CFQFSIRQ.js} +4 -4
  79. package/dist/bundle/{open-GX7RPGQW.js → open-3XO2HMIT.js} +2 -2
  80. package/dist/bundle/{openai-WM4TRXCC.js → openai-STUNDBD6.js} +7 -7
  81. package/dist/bundle/{process-NT5OZH2V.js → process-P4UAJCZX.js} +1 -1
  82. package/dist/bundle/{program-YQ3UT2LI.js → program-BXL5ZOVQ.js} +2052 -1870
  83. package/dist/bundle/{prompt-5XJNSXCW.js → prompt-ZCYMFMIG.js} +2 -2
  84. package/dist/bundle/{recognize-DQNGZLRX.js → recognize-V3BY33FK.js} +1 -1
  85. package/dist/bundle/{remote-RMRYJZSZ.js → remote-IP4QR7SP.js} +4 -4
  86. package/dist/bundle/{rerank-5J6JM43S.js → rerank-VKUSF3DM.js} +4 -4
  87. package/dist/bundle/{serve-4RVWOQVC.js → serve-VBIUARHJ.js} +6 -6
  88. package/dist/bundle/server-AASCSGCI.js +61 -0
  89. package/dist/bundle/{server-NKCRFK26.js → server-JLPZUC42.js} +49 -49
  90. package/dist/bundle/server-YQLPZK4Z.js +48 -0
  91. package/dist/bundle/{state-MGVPOLPZ.js → state-UBAIZ2WP.js} +3 -3
  92. package/dist/bundle/{store-IEK4PPOE.js → store-VQQVUA4W.js} +9 -9
  93. package/dist/bundle/store-maintenance-command-GCBABKEZ.js +47 -0
  94. package/dist/bundle/update-M54Z3SEU.js +68 -0
  95. package/dist/digest/backfill.d.ts +9 -0
  96. package/dist/digest/backfill.d.ts.map +1 -0
  97. package/dist/digest/backfill.js +142 -0
  98. package/dist/digest/backfill.js.map +1 -0
  99. package/dist/digest/command.d.ts +2 -0
  100. package/dist/digest/command.d.ts.map +1 -1
  101. package/dist/digest/command.js +18 -1
  102. package/dist/digest/command.js.map +1 -1
  103. package/dist/digest/digest.d.ts +6 -1
  104. package/dist/digest/digest.d.ts.map +1 -1
  105. package/dist/digest/digest.js +26 -15
  106. package/dist/digest/digest.js.map +1 -1
  107. package/dist/digest/sync-health.d.ts +1 -2
  108. package/dist/digest/sync-health.d.ts.map +1 -1
  109. package/dist/digest/tasks.d.ts +14 -1
  110. package/dist/digest/tasks.d.ts.map +1 -1
  111. package/dist/digest/tasks.js +31 -4
  112. package/dist/digest/tasks.js.map +1 -1
  113. package/dist/discovery/command.d.ts.map +1 -1
  114. package/dist/discovery/command.js +1 -0
  115. package/dist/discovery/command.js.map +1 -1
  116. package/dist/examples.d.ts.map +1 -1
  117. package/dist/examples.js +7 -1
  118. package/dist/examples.js.map +1 -1
  119. package/dist/knowledge/command.d.ts.map +1 -1
  120. package/dist/knowledge/command.js +17 -6
  121. package/dist/knowledge/command.js.map +1 -1
  122. package/dist/knowledge/project-context.d.ts.map +1 -1
  123. package/dist/knowledge/project-context.js +3 -2
  124. package/dist/knowledge/project-context.js.map +1 -1
  125. package/dist/knowledge/relationships.d.ts +2 -0
  126. package/dist/knowledge/relationships.d.ts.map +1 -1
  127. package/dist/knowledge/relationships.js +11 -2
  128. package/dist/knowledge/relationships.js.map +1 -1
  129. package/dist/program.d.ts.map +1 -1
  130. package/dist/program.js +2 -0
  131. package/dist/program.js.map +1 -1
  132. package/dist/read-only.d.ts +1 -1
  133. package/dist/reasons.d.ts.map +1 -1
  134. package/dist/reasons.js +18 -0
  135. package/dist/reasons.js.map +1 -1
  136. package/dist/schedule/command.d.ts +2 -1
  137. package/dist/schedule/command.d.ts.map +1 -1
  138. package/dist/schedule/command.js +6 -2
  139. package/dist/schedule/command.js.map +1 -1
  140. package/dist/version.d.ts +1 -1
  141. package/dist/version.js +1 -1
  142. package/package.json +4 -4
  143. package/skills/cli-memo/topics/projects.md +7 -0
  144. package/skills/mail-triage/SKILL.md +25 -19
  145. package/skills/morning-digest/SKILL.md +15 -1
  146. package/dist/bundle/auto-FR6LX5KO.js +0 -85
  147. package/dist/bundle/failure-U3VNIQNX.js +0 -65
  148. package/dist/bundle/server-HH2X6G7V.js +0 -61
  149. package/dist/bundle/server-MS3JKMGF.js +0 -48
  150. package/dist/bundle/store-maintenance-command-GSS2AY4J.js +0 -47
  151. package/dist/bundle/update-S5XRRWTH.js +0 -68
  152. /package/dist/bundle/{chunk-DS7NXKAN.js → chunk-AWVQHWIS.js} +0 -0
@@ -51,6 +51,7 @@ import {
51
51
  calendarText,
52
52
  canonicalMeetingReference,
53
53
  checkEnds,
54
+ checkEngagement,
54
55
  checkRole,
55
56
  checkedScore,
56
57
  contractLine,
@@ -76,6 +77,7 @@ import {
76
77
  invoiceLine,
77
78
  invoiceTitle,
78
79
  isClosedState,
80
+ isEngagement,
79
81
  isRelationKind,
80
82
  isSymmetric,
81
83
  joinKeyOf,
@@ -141,12 +143,12 @@ import {
141
143
  walkQuery,
142
144
  walletLine,
143
145
  zonedMoment
144
- } from "./chunk-BOOEDDVY.js";
146
+ } from "./chunk-2NFI7SDW.js";
145
147
  import {
146
148
  holdsCredential,
147
149
  secretNamed,
148
150
  sqliteCode
149
- } from "./chunk-ECMYCWG2.js";
151
+ } from "./chunk-3LGLKLBA.js";
150
152
  import {
151
153
  DEFAULT_STEMMERS,
152
154
  DEFAULT_STEMMERS_VERSION,
@@ -159,27 +161,27 @@ import {
159
161
  fold,
160
162
  normalize,
161
163
  parseStemmers
162
- } from "./chunk-OU4PN7PF.js";
164
+ } from "./chunk-TV75OHKJ.js";
163
165
  import {
164
166
  DEFAULT_TASK_CATEGORIES,
165
167
  sharedConfigPath,
166
168
  storedTaskCategories,
167
169
  taskCategoriesReader
168
- } from "./chunk-WJ2OYD2D.js";
170
+ } from "./chunk-BGWPKEKK.js";
169
171
  import {
170
172
  refuseOwnerStoreInTests,
171
173
  storePath
172
- } from "./chunk-QFSMJTEA.js";
174
+ } from "./chunk-V2YS63Z5.js";
173
175
  import {
174
176
  quietSqliteWarning,
175
177
  storeCapable
176
- } from "./chunk-GJ3P7RJF.js";
178
+ } from "./chunk-YTJWIJIG.js";
177
179
  import {
178
180
  PRAGMAS,
179
181
  TIME_LIMIT_FUNCTION,
180
182
  TimeLimitReached,
181
183
  isQueryOnly
182
- } from "./chunk-AGNWFOAJ.js";
184
+ } from "./chunk-67VEVKMJ.js";
183
185
  import {
184
186
  array,
185
187
  boolean,
@@ -230,7 +232,7 @@ import {
230
232
  sql,
231
233
  sqliteTable,
232
234
  text
233
- } from "./chunk-6SFTVGNL.js";
235
+ } from "./chunk-VPKJZKXV.js";
234
236
  import {
235
237
  __commonJS,
236
238
  __name,
@@ -9974,7 +9976,7 @@ var require_cjs = __commonJS({
9974
9976
  }
9975
9977
  });
9976
9978
 
9977
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/account-store.js
9979
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/account-store.js
9978
9980
  var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
9979
9981
  const methods = whole;
9980
9982
  return Object.fromEntries(Object.keys(keyed).map((name) => [
@@ -10102,7 +10104,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
10102
10104
  };
10103
10105
  }, "bindAccount");
10104
10106
 
10105
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/locator.js
10107
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/locator.js
10106
10108
  var SCHEME = "msg:";
10107
10109
  var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat: chat2, message: message3 }) => SCHEME + [provider, account, chat2, message3].map(encodeURIComponent).join("/"), "formatLocator");
10108
10110
  var isLocator = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith(SCHEME), "isLocator");
@@ -10116,7 +10118,7 @@ var parseLocator = /* @__PURE__ */ __name((reference2) => {
10116
10118
  return { provider, account, chat: chat2, message: message3 };
10117
10119
  }, "parseLocator");
10118
10120
 
10119
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/references.js
10121
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/references.js
10120
10122
  var SIMPLE_REFERENCES = [
10121
10123
  "note",
10122
10124
  "document",
@@ -10272,7 +10274,7 @@ var looksLikeReference = /* @__PURE__ */ __name((text7) => {
10272
10274
  return match !== null && byPrefix.has(match[1]);
10273
10275
  }, "looksLikeReference");
10274
10276
 
10275
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/providers.js
10277
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/providers.js
10276
10278
  var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events", "crm"];
10277
10279
  var MESSENGER_OPENS = { chat: "messages list", message: "messages show", contact: "contacts show" };
10278
10280
  var PROVIDERS = [
@@ -10435,7 +10437,7 @@ var holdsKind = /* @__PURE__ */ __name((provider, kind4) => kindsIn(provider).in
10435
10437
  var holdsKindOf = /* @__PURE__ */ __name((provider, kind4) => kindIn(provider) === void 0 ? kind4 === "messages" : holdsKind(provider, kind4), "holdsKindOf");
10436
10438
  var kindOf = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
10437
10439
 
10438
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/search/query.js
10440
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/search/query.js
10439
10441
  var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
10440
10442
  var inSource = /* @__PURE__ */ __name((source2, provider) => source2 === "all" || source2 === "bots" && isBotProvider(provider) || source2 === "personal" && !isBotProvider(provider) || source2 === provider || providerNamed(source2)?.name === provider || isKind(source2) && holdsKindOf(provider, source2), "inSource");
10441
10443
  var fail = /* @__PURE__ */ __name((message3) => {
@@ -10458,7 +10460,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
10458
10460
  return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
10459
10461
  }, "sourceOf");
10460
10462
 
10461
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/search/account-list.js
10463
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/search/account-list.js
10462
10464
  var ACCOUNT_GROUPS = "accountGroups";
10463
10465
  var ACCOUNT_GROUPS_SETTING = "account_groups";
10464
10466
  var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
@@ -10656,7 +10658,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind4)
10656
10658
  return { accounts: [...chosen.values()], skipped };
10657
10659
  }, "fitting");
10658
10660
 
10659
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
10661
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
10660
10662
  var IndexBuilderOn = class {
10661
10663
  static {
10662
10664
  __name(this, "IndexBuilderOn");
@@ -10851,7 +10853,7 @@ function alias(table, alias2) {
10851
10853
  }
10852
10854
  __name(alias, "alias");
10853
10855
 
10854
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/record-fields.js
10856
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/record-fields.js
10855
10857
  var DECIMAL_PATTERN = "^[0-9]{1,16}(\\.[0-9]{1,6})?$";
10856
10858
  var SIGNED_DECIMAL = "^-?[0-9]{1,16}(\\.[0-9]{1,6})?$";
10857
10859
  var DAY = "^[0-9]{4}-[0-9]{2}-[0-9]{2}$";
@@ -10970,7 +10972,7 @@ var fieldError = /* @__PURE__ */ __name((schema, value, at2 = []) => {
10970
10972
  return void 0;
10971
10973
  }, "fieldError");
10972
10974
 
10973
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/record-types.js
10975
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/record-types.js
10974
10976
  var kept = /* @__PURE__ */ __name((description) => ({ description }), "kept");
10975
10977
  var PARTY = ["person", "organization"];
10976
10978
  var ORGANIZATION = ["organization"];
@@ -11343,7 +11345,7 @@ var hasV1Roles = /* @__PURE__ */ __name((type) => rolesOf2(type).some(([, role])
11343
11345
  var IDENTITY_TYPES = RECORD_ENTITY_TYPES.filter((type) => RECORD_TYPES[type].review === "identity");
11344
11346
  var article = /* @__PURE__ */ __name((word2) => /^[aeiou]/.test(word2) ? "an" : "a", "article");
11345
11347
 
11346
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
11348
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
11347
11349
  var ENTITY_TABLES = {
11348
11350
  ...RECORD_TABLES,
11349
11351
  account: "accounts",
@@ -11382,7 +11384,7 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
11382
11384
  return { table, pointer, type, count, known: known2 };
11383
11385
  }).filter(({ count }) => count > 0)), "orphanPointers");
11384
11386
 
11385
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
11387
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
11386
11388
  var BOT_KINDS = ["agent", "rule", "script", "integration"];
11387
11389
  var ownerPerson = /* @__PURE__ */ __name((database) => {
11388
11390
  const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
@@ -11439,7 +11441,7 @@ var proposedBySql = /* @__PURE__ */ __name((type, id2, by) => {
11439
11441
  return { sql: bot("pb.name = ?"), params: [by.bot] };
11440
11442
  }, "proposedBySql");
11441
11443
 
11442
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review-marks.js
11444
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review-marks.js
11443
11445
  var TABLES = { memory: "memories", fact: "facts" };
11444
11446
  var HOLDING = { memory: ["proposed", "confirmed"], fact: ["proposed", "accepted"] };
11445
11447
  var KEPT = 20;
@@ -11534,7 +11536,7 @@ var scrubSourceReviews = /* @__PURE__ */ __name((database, erased, { refs }) =>
11534
11536
  return scrubbed;
11535
11537
  }, "scrubSourceReviews");
11536
11538
 
11537
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
11539
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
11538
11540
  var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
11539
11541
  var REFERABLE = {
11540
11542
  ...Object.fromEntries(Object.entries(RECORD_TYPES).map(([type, { tombstone: tombstone2 }]) => [type, { tombstone: tombstone2 }])),
@@ -11694,7 +11696,7 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
11694
11696
  return row2 ? String(row2.id ?? row2.key) : void 0;
11695
11697
  }, "taskIdOf");
11696
11698
 
11697
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-signature.js
11699
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-signature.js
11698
11700
  var QUOTE_LIMIT = 500;
11699
11701
  var GONE = { sig: "gone", rev: null, deleted: true, changedAt: null };
11700
11702
  var part = /* @__PURE__ */ __name((value) => value == null ? "" : String(value), "part");
@@ -11973,7 +11975,7 @@ var deleteDocumentRow = /* @__PURE__ */ __name((database, id2, at2) => {
11973
11975
  database.prepare("DELETE FROM documents WHERE id = ?").run(id2);
11974
11976
  }, "deleteDocumentRow");
11975
11977
 
11976
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/merged-persons.js
11978
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/merged-persons.js
11977
11979
  var SEPARATIONS = ["unlink", "split", "undo-merge"];
11978
11980
  var mergeSql = /* @__PURE__ */ __name((event2) => `(${event2}.from_person_id IS NOT NULL AND ${event2}.from_person_id <> ${event2}.to_person_id AND ${event2}.method NOT IN (${SEPARATIONS.map((method) => `'${method}'`).join(", ")}) AND NOT EXISTS (SELECT 1 FROM identity_link_events stay WHERE stay.to_person_id = ${event2}.from_person_id AND stay.identity_id <> ${event2}.identity_id AND stay.id < ${event2}.id AND stay.id = (SELECT max(s.id) FROM identity_link_events s WHERE s.identity_id = stay.identity_id AND s.id < ${event2}.id) AND NOT EXISTS (SELECT 1 FROM identity_link_events went WHERE went.identity_id = stay.identity_id AND went.from_person_id = ${event2}.from_person_id AND went.to_person_id = ${event2}.to_person_id AND went.id = (SELECT min(w.id) FROM identity_link_events w WHERE w.identity_id = stay.identity_id AND w.id > ${event2}.id))))`, "mergeSql");
11979
11981
  var mergedAwaySql = /* @__PURE__ */ __name((person2) => `(${person2}.owner = 0 AND NOT EXISTS (SELECT 1 FROM identity_links ml WHERE ml.person_id = ${person2}.id) AND EXISTS (SELECT 1 FROM identity_link_events me WHERE me.from_person_id = ${person2}.id AND ${mergeSql("me")}))`, "mergedAwaySql");
@@ -12005,7 +12007,7 @@ var samePersons = /* @__PURE__ */ __name((database, pk) => {
12005
12007
  }, "samePersons");
12006
12008
  var idsOf = /* @__PURE__ */ __name((database, type, id2) => JSON.stringify(type === "person" ? samePersons(database, id2) : [id2]), "idsOf");
12007
12009
 
12008
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
12010
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
12009
12011
  var canonicalTags = sqliteTable("canonical_tags", {
12010
12012
  id: integer("id").primaryKey(),
12011
12013
  name: text("name").notNull().unique(),
@@ -12014,7 +12016,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
12014
12016
  updatedAt: integer("updated_at").notNull()
12015
12017
  });
12016
12018
 
12017
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/link-revisions.js
12019
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/link-revisions.js
12018
12020
  var linkRevisions = sqliteTable("link_revisions", {
12019
12021
  id: integer("id").primaryKey(),
12020
12022
  linkId: integer("link_id").notNull(),
@@ -12026,7 +12028,7 @@ var linkRevisions = sqliteTable("link_revisions", {
12026
12028
  createdAt: integer("created_at").notNull()
12027
12029
  }, (table) => [index("link_revisions_by_link_id_created_at").on(table.linkId, table.createdAt)]);
12028
12030
 
12029
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
12031
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
12030
12032
  var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
12031
12033
  sourceKey: text("source_key").notNull(),
12032
12034
  collection: text("collection").notNull(),
@@ -12036,13 +12038,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
12036
12038
  createdAt: integer("created_at").notNull()
12037
12039
  }, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
12038
12040
 
12039
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
12041
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
12040
12042
  var documentIndexPending = sqliteTable("document_index_pending", {
12041
12043
  id: integer("id").notNull(),
12042
12044
  indexableType: text("indexable_type").notNull()
12043
12045
  }, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
12044
12046
 
12045
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/decision-requests.js
12047
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/decision-requests.js
12046
12048
  var decisionRequests = sqliteTable("decision_requests", {
12047
12049
  id: integer("id").primaryKey(),
12048
12050
  tokenDigest: text("token_digest").notNull().unique(),
@@ -12062,7 +12064,7 @@ var decisionRequests = sqliteTable("decision_requests", {
12062
12064
  index("decision_requests_by_channel_bot_profile_chat_id_message_id").on(table.channel, table.botProfile, table.chatId, table.messageId)
12063
12065
  ]);
12064
12066
 
12065
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/enrichments.js
12067
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/enrichments.js
12066
12068
  var enrichments = sqliteTable("enrichments", {
12067
12069
  subjectType: text("subject_type").notNull(),
12068
12070
  subjectId: integer("subject_id").notNull(),
@@ -12074,7 +12076,7 @@ var enrichments = sqliteTable("enrichments", {
12074
12076
  createdAt: integer("created_at").notNull()
12075
12077
  }, (table) => [primaryKey({ columns: [table.subjectType, table.subjectId] })]);
12076
12078
 
12077
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/templates.js
12079
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/templates.js
12078
12080
  var templates = sqliteTable("templates", {
12079
12081
  key: text("key").notNull(),
12080
12082
  channel: text("channel").notNull(),
@@ -12096,7 +12098,7 @@ var templatesHistory = sqliteTable("templates_history", {
12096
12098
  index("templates_history_by_key_channel_language_id").on(table.key, table.channel, table.language, table.id)
12097
12099
  ]);
12098
12100
 
12099
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/links.js
12101
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/links.js
12100
12102
  var links = sqliteTable("links", {
12101
12103
  id: integer("id").primaryKey(),
12102
12104
  fromType: text("from_type").notNull(),
@@ -12127,7 +12129,7 @@ var links = sqliteTable("links", {
12127
12129
  index("links_by_to_type_to_id").on(table.toType, table.toId)
12128
12130
  ]);
12129
12131
 
12130
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
12132
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
12131
12133
  var tagRedirects = sqliteTable("tag_redirects", {
12132
12134
  sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
12133
12135
  survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
@@ -12153,7 +12155,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
12153
12155
  index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
12154
12156
  ]);
12155
12157
 
12156
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
12158
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
12157
12159
  var accounts = sqliteTable("accounts", {
12158
12160
  id: integer("id").primaryKey(),
12159
12161
  provider: text("provider").notNull(),
@@ -14149,10 +14151,10 @@ var storeSettings = sqliteTable("store_settings", {
14149
14151
  at: integer("at").notNull()
14150
14152
  });
14151
14153
 
14152
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
14154
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
14153
14155
  import { AsyncLocalStorage } from "node:async_hooks";
14154
14156
 
14155
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
14157
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
14156
14158
  var ARMS = [
14157
14159
  [
14158
14160
  "message",
@@ -14280,7 +14282,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
14280
14282
  return recomputed;
14281
14283
  }, "drainInvolvementQueue");
14282
14284
 
14283
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/mentions.js
14285
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/mentions.js
14284
14286
  import { domainToUnicode } from "node:url";
14285
14287
 
14286
14288
  // node_modules/.pnpm/psl@1.15.0/node_modules/psl/dist/psl.mjs
@@ -24302,7 +24304,7 @@ var oa = /* @__PURE__ */ __name((e) => {
24302
24304
  }, "oa");
24303
24305
  var na = { parse: O, get: aa, isValid: oa };
24304
24306
 
24305
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
24307
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
24306
24308
  var LINK = /https?:\/\/(?:(?:docs|drive|sheets|slides)\.google\.com|forms\.gle)(?:[/?#][^\s<>"'`]*)?/gi;
24307
24309
  var ID = /^[\w-]{10,}$/;
24308
24310
  var trimUrl = /* @__PURE__ */ __name((url) => {
@@ -24344,7 +24346,7 @@ var googleDocumentLinks = /* @__PURE__ */ __name((text7) => [...text7.matchAll(L
24344
24346
  return { url, documentId: googleDocumentId(url) };
24345
24347
  }), "googleDocumentLinks");
24346
24348
 
24347
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
24349
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
24348
24350
  var PHONE_PLANS = [
24349
24351
  {
24350
24352
  country: "us",
@@ -24724,7 +24726,7 @@ var PHONE_PLANS = [
24724
24726
  }
24725
24727
  ];
24726
24728
 
24727
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/phones.js
24729
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/phones.js
24728
24730
  var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
24729
24731
  var DEFAULT_PHONE_COUNTRIES = ["ru"];
24730
24732
  var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
@@ -24765,7 +24767,7 @@ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
24765
24767
  return void 0;
24766
24768
  }, "nationalPhone");
24767
24769
 
24768
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/places.js
24770
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/places.js
24769
24771
  var BEFORE = [
24770
24772
  [/^(?:ул\.?|улиц[аеыу]|улицей)$/iu, "\u0443\u043B\u0438\u0446\u0430"],
24771
24773
  [/^(?:пр-т|просп\.?|проспект[аеу]?)$/iu, "\u043F\u0440\u043E\u0441\u043F\u0435\u043A\u0442"],
@@ -25025,7 +25027,7 @@ var findPlaces = /* @__PURE__ */ __name((text7) => {
25025
25027
  return found2.sort((a, b) => a.start - b.start);
25026
25028
  }, "findPlaces");
25027
25029
 
25028
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/mentions.js
25030
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/mentions.js
25029
25031
  var MENTION_KINDS = ["phone", "email", "url", "document", "person-name", "place"];
25030
25032
  var MENTION_VERSIONS = {
25031
25033
  phone: 1,
@@ -25215,7 +25217,7 @@ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE
25215
25217
  };
25216
25218
  }, "typedPhone");
25217
25219
 
25218
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/first-names.js
25220
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/first-names.js
25219
25221
  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";
25220
25222
  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";
25221
25223
  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";
@@ -25223,7 +25225,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
25223
25225
  var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
25224
25226
  var NAME_WORDS = WORDS.split(" ");
25225
25227
 
25226
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/person-names.js
25228
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/person-names.js
25227
25229
  var LATIN_TO_CYRILLIC = {
25228
25230
  shch: "\u0449",
25229
25231
  sch: "\u0449",
@@ -25431,7 +25433,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text7, stem, taken) => {
25431
25433
  return found2;
25432
25434
  }, "findUnknownNames");
25433
25435
 
25434
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/attachments.js
25436
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/attachments.js
25435
25437
  var NOT_FILES = /* @__PURE__ */ new Set([
25436
25438
  "webpage",
25437
25439
  "share",
@@ -25471,7 +25473,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored4, files2) => {
25471
25473
  });
25472
25474
  }, "matchDownloads");
25473
25475
 
25474
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
25476
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
25475
25477
  var QUERY_VERSION = 1;
25476
25478
  var QUERY_LIMITS2 = {
25477
25479
  ...QUERY_LIMITS,
@@ -25507,7 +25509,7 @@ function exhausted(budget) {
25507
25509
  }
25508
25510
  __name(exhausted, "exhausted");
25509
25511
 
25510
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
25512
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
25511
25513
  var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
25512
25514
  var literal2 = /* @__PURE__ */ __name((c) => ({
25513
25515
  kind: "char",
@@ -25710,35 +25712,35 @@ var compileAutomaton = /* @__PURE__ */ __name((pattern, span = { start: 0, end:
25710
25712
  return;
25711
25713
  }
25712
25714
  if (node.kind === "concat") {
25713
- let current2 = from2;
25715
+ let current3 = from2;
25714
25716
  node.children.forEach((child, index2) => {
25715
25717
  const next = index2 === node.children.length - 1 ? to : state();
25716
- build(child, current2, next);
25717
- current2 = next;
25718
+ build(child, current3, next);
25719
+ current3 = next;
25718
25720
  });
25719
25721
  if (node.children.length === 0)
25720
25722
  epsilon(from2, to);
25721
25723
  return;
25722
25724
  }
25723
- let current = from2;
25725
+ let current2 = from2;
25724
25726
  for (let i = 0; i < node.min; i++) {
25725
25727
  const next = state();
25726
- build(node.child, current, next);
25727
- current = next;
25728
+ build(node.child, current2, next);
25729
+ current2 = next;
25728
25730
  }
25729
25731
  if (node.max === null) {
25730
- epsilon(current, to);
25732
+ epsilon(current2, to);
25731
25733
  const end2 = state();
25732
- build(node.child, current, end2);
25733
- epsilon(end2, current);
25734
+ build(node.child, current2, end2);
25735
+ epsilon(end2, current2);
25734
25736
  } else {
25735
25737
  for (let i = node.min; i < node.max; i++) {
25736
- epsilon(current, to);
25738
+ epsilon(current2, to);
25737
25739
  const next = state();
25738
- build(node.child, current, next);
25739
- current = next;
25740
+ build(node.child, current2, next);
25741
+ current2 = next;
25740
25742
  }
25741
- epsilon(current, to);
25743
+ epsilon(current2, to);
25742
25744
  }
25743
25745
  }, "build");
25744
25746
  const start = state(), end = state();
@@ -25764,22 +25766,22 @@ var compileAutomaton = /* @__PURE__ */ __name((pattern, span = { start: 0, end:
25764
25766
  }
25765
25767
  return initial;
25766
25768
  }, "closure");
25767
- let current = closure(/* @__PURE__ */ new Set([start]));
25769
+ let current2 = closure(/* @__PURE__ */ new Set([start]));
25768
25770
  for (const c of text7) {
25769
25771
  const point = c.codePointAt(0) ?? 0;
25770
25772
  const next = /* @__PURE__ */ new Set();
25771
- for (const id2 of current)
25773
+ for (const id2 of current2)
25772
25774
  for (const edge of states[id2].edges) {
25773
25775
  spend();
25774
25776
  const inside = edge.atom.ranges.some(([lo, hi]) => point >= lo && point <= hi);
25775
25777
  if (inside !== edge.atom.negate)
25776
25778
  next.add(edge.to);
25777
25779
  }
25778
- current = closure(next);
25779
- if (current.size === 0)
25780
+ current2 = closure(next);
25781
+ if (current2.size === 0)
25780
25782
  return false;
25781
25783
  }
25782
- return current.has(end);
25784
+ return current2.has(end);
25783
25785
  }, "test")
25784
25786
  };
25785
25787
  }, "compileAutomaton");
@@ -25907,7 +25909,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
25907
25909
  return out;
25908
25910
  }, "foldRegex");
25909
25911
 
25910
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
25912
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
25911
25913
  var PRESET_VERSION = 1;
25912
25914
  var PRESETS = {
25913
25915
  password: {
@@ -25961,7 +25963,7 @@ var PRESETS = {
25961
25963
  }
25962
25964
  };
25963
25965
 
25964
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
25966
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
25965
25967
  var FIELD_VERSION = 2;
25966
25968
  var UNITS = {
25967
25969
  "": 1,
@@ -26422,12 +26424,12 @@ var validateAst = /* @__PURE__ */ __name((input) => {
26422
26424
  return validateFields(parsed3.output);
26423
26425
  }, "validateAst");
26424
26426
 
26425
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
26427
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
26426
26428
  var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
26427
26429
  var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
26428
26430
  var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
26429
26431
 
26430
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
26432
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
26431
26433
  var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
26432
26434
  var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
26433
26435
  var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
@@ -26451,7 +26453,7 @@ var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
26451
26453
  };
26452
26454
  }, "linkMatch");
26453
26455
 
26454
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
26456
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
26455
26457
  var SETTING = "phoneCountries";
26456
26458
  var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
26457
26459
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
@@ -26482,7 +26484,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
26482
26484
  return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
26483
26485
  }, "valueMatch");
26484
26486
 
26485
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
26487
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
26486
26488
  var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
26487
26489
  if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
26488
26490
  throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
@@ -26510,7 +26512,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
26510
26512
  return 2 * intersection2 / (aa2.size + bb.size);
26511
26513
  }, "vocabularySimilarity");
26512
26514
 
26513
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
26515
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
26514
26516
  import { createHash } from "node:crypto";
26515
26517
  var folded3 = /* @__PURE__ */ __name((name) => {
26516
26518
  try {
@@ -26576,7 +26578,7 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind4, by, options
26576
26578
  });
26577
26579
  }, "guardTagCreation");
26578
26580
 
26579
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
26581
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
26580
26582
  var invalid2 = /* @__PURE__ */ __name((message3) => {
26581
26583
  throw new CliError("validation_error", message3);
26582
26584
  }, "invalid");
@@ -26626,20 +26628,20 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
26626
26628
  const ordered = [...ids].sort((a, b) => Number(a) - Number(b));
26627
26629
  for (const id2 of ordered) {
26628
26630
  const path = [id2];
26629
- let current = id2;
26630
- while (edges.has(current)) {
26631
- const next = edges.get(current);
26631
+ let current2 = id2;
26632
+ while (edges.has(current2)) {
26633
+ const next = edges.get(current2);
26632
26634
  if (path.includes(next))
26633
26635
  invalid2("redirects contain a cycle");
26634
26636
  if (path.length > 16)
26635
26637
  invalid2("redirects exceed the maximum of 16 hops");
26636
26638
  path.push(next);
26637
- current = next;
26639
+ current2 = next;
26638
26640
  }
26639
26641
  paths.set(id2, path);
26640
- const group = members2.get(current) ?? [];
26642
+ const group = members2.get(current2) ?? [];
26641
26643
  group.push(id2);
26642
- members2.set(current, group);
26644
+ members2.set(current2, group);
26643
26645
  }
26644
26646
  return {
26645
26647
  resolve: /* @__PURE__ */ __name((value) => {
@@ -26653,7 +26655,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
26653
26655
  };
26654
26656
  }, "createTagRedirectIndex");
26655
26657
 
26656
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
26658
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
26657
26659
  var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
26658
26660
  const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
26659
26661
  if (!row2)
@@ -26681,7 +26683,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
26681
26683
  return snapshot2;
26682
26684
  }, "tagRedirectSnapshot");
26683
26685
 
26684
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
26686
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
26685
26687
  import { createHash as createHash2 } from "node:crypto";
26686
26688
  var TASK_KEY_PREFIXES = {
26687
26689
  question: "Q",
@@ -26709,7 +26711,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
26709
26711
  return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
26710
26712
  }, "taskAccountOf");
26711
26713
 
26712
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
26714
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
26713
26715
  var toMs = /* @__PURE__ */ __name((iso16) => {
26714
26716
  if (iso16 === null || iso16 === void 0)
26715
26717
  return null;
@@ -26723,7 +26725,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
26723
26725
  var DELIVERY = { delivered: 1, read: 2 };
26724
26726
  var deliveryOf = /* @__PURE__ */ __name((stored4) => stored4 === DELIVERY.read ? "read" : stored4 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
26725
26727
 
26726
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
26728
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
26727
26729
  var TAG_KINDS = ["tag", "topic"];
26728
26730
  var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
26729
26731
  var TAG_TYPE = {
@@ -26926,7 +26928,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
26926
26928
  return result;
26927
26929
  }, "tagsOf");
26928
26930
 
26929
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
26931
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
26930
26932
  var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
26931
26933
  var SPEECH = speech("att");
26932
26934
  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");
@@ -27290,7 +27292,7 @@ var FIELD_COMPILERS = {
27290
27292
  subject
27291
27293
  };
27292
27294
 
27293
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
27295
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
27294
27296
  var placeOf = /* @__PURE__ */ __name((database) => {
27295
27297
  const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
27296
27298
  const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
@@ -27306,7 +27308,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
27306
27308
  };
27307
27309
  }, "placeOf");
27308
27310
 
27309
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
27311
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
27310
27312
  var DRAIN_ON_WRITE = 500;
27311
27313
  var METHOD = "rules";
27312
27314
  var telegramLink = /* @__PURE__ */ __name((database) => {
@@ -27472,7 +27474,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
27472
27474
  return queued.length;
27473
27475
  }, "drainMentions");
27474
27476
 
27475
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
27477
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
27476
27478
  var indexRow = /* @__PURE__ */ __name((database, name) => {
27477
27479
  const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
27478
27480
  if (!exists2)
@@ -27480,7 +27482,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
27480
27482
  return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
27481
27483
  }, "indexRow");
27482
27484
 
27483
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
27485
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
27484
27486
  var INDEX = "message_stems";
27485
27487
  var SETTING2 = "searchStemmers";
27486
27488
  var DRAIN_ON_WRITE2 = 500;
@@ -27602,7 +27604,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
27602
27604
  };
27603
27605
  }, "stemmerCache");
27604
27606
 
27605
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
27607
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
27606
27608
  var rehearsal = new AsyncLocalStorage();
27607
27609
  var SQLITE_BUSY = 5;
27608
27610
  var pause = new Int32Array(new SharedArrayBuffer(4));
@@ -27612,10 +27614,10 @@ var beginImmediate = /* @__PURE__ */ __name((database) => {
27612
27614
  const deadline = Date.now() + timeout;
27613
27615
  database.exec("PRAGMA busy_timeout = 0");
27614
27616
  try {
27615
- for (; ; ) {
27617
+ for (let waited = false; ; waited = true) {
27616
27618
  try {
27617
27619
  database.exec("BEGIN IMMEDIATE");
27618
- return;
27620
+ return waited;
27619
27621
  } catch (error) {
27620
27622
  if (!isBusy(error) || Date.now() >= deadline)
27621
27623
  throw error;
@@ -27626,6 +27628,12 @@ var beginImmediate = /* @__PURE__ */ __name((database) => {
27626
27628
  database.exec(`PRAGMA busy_timeout = ${timeout}`);
27627
27629
  }
27628
27630
  }, "beginImmediate");
27631
+ var rollBack = /* @__PURE__ */ __name((database, sql2 = "ROLLBACK") => {
27632
+ try {
27633
+ database.exec(sql2);
27634
+ } catch {
27635
+ }
27636
+ }, "rollBack");
27629
27637
  var connections = /* @__PURE__ */ new WeakMap();
27630
27638
  var connectionOf = /* @__PURE__ */ __name((database) => {
27631
27639
  let connection = connections.get(database);
@@ -27636,13 +27644,7 @@ var connectionOf = /* @__PURE__ */ __name((database) => {
27636
27644
  return connection;
27637
27645
  }, "connectionOf");
27638
27646
  var write = /* @__PURE__ */ __name((database, body2, { beforeCommit } = {}) => transact(database, body2, true, beforeCommit), "write");
27639
- var writeBatch = /* @__PURE__ */ __name((database, body2) => {
27640
- const outer = connectionOf(database).depth === 0;
27641
- const result = transact(database, body2, false);
27642
- if (outer)
27643
- Atomics.wait(pause, 0, 0, BATCH_PAUSE_MS);
27644
- return result;
27645
- }, "writeBatch");
27647
+ var writeBatch = /* @__PURE__ */ __name((database, body2) => transact(database, body2, false), "writeBatch");
27646
27648
  var BATCH_PAUSE_MS = 2;
27647
27649
  var transact = /* @__PURE__ */ __name((database, body2, drain, beforeCommit) => {
27648
27650
  const connection = connectionOf(database);
@@ -27650,9 +27652,8 @@ var transact = /* @__PURE__ */ __name((database, body2, drain, beforeCommit) =>
27650
27652
  throw new Error("a store write cannot run inside a read");
27651
27653
  const outer = connection.depth === 0;
27652
27654
  const name = `w${connection.depth + 1}`;
27653
- if (outer)
27654
- beginImmediate(database);
27655
- else
27655
+ const waited = outer && beginImmediate(database);
27656
+ if (!outer)
27656
27657
  database.exec(`SAVEPOINT ${name}`);
27657
27658
  connection.depth += 1;
27658
27659
  try {
@@ -27664,9 +27665,11 @@ var transact = /* @__PURE__ */ __name((database, body2, drain, beforeCommit) =>
27664
27665
  }
27665
27666
  beforeCommit?.();
27666
27667
  database.exec(outer ? "COMMIT" : `RELEASE ${name}`);
27668
+ if (outer && (waited || !drain))
27669
+ Atomics.wait(pause, 0, 0, BATCH_PAUSE_MS);
27667
27670
  return result;
27668
27671
  } catch (error) {
27669
- database.exec(outer ? "ROLLBACK" : `ROLLBACK TO ${name}; RELEASE ${name}`);
27672
+ rollBack(database, outer ? "ROLLBACK" : `ROLLBACK TO ${name}; RELEASE ${name}`);
27670
27673
  throw error;
27671
27674
  } finally {
27672
27675
  connection.depth -= 1;
@@ -27711,7 +27714,7 @@ var rehearse = /* @__PURE__ */ __name(async ({ database, client }, body2) => {
27711
27714
  else
27712
27715
  delete target[name];
27713
27716
  connection.depth -= 1;
27714
- database.exec("ROLLBACK");
27717
+ rollBack(database);
27715
27718
  }
27716
27719
  }, "rehearse");
27717
27720
  var read = /* @__PURE__ */ __name((database, body2) => {
@@ -27727,7 +27730,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
27727
27730
  database.exec(`RELEASE ${name}`);
27728
27731
  return result;
27729
27732
  } catch (error) {
27730
- database.exec(`ROLLBACK TO ${name}; RELEASE ${name}`);
27733
+ rollBack(database, `ROLLBACK TO ${name}; RELEASE ${name}`);
27731
27734
  throw error;
27732
27735
  } finally {
27733
27736
  connection.depth -= 1;
@@ -27736,7 +27739,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
27736
27739
  }
27737
27740
  }, "read");
27738
27741
 
27739
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
27742
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
27740
27743
  var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
27741
27744
  coalesce(CASE k.chunkable_type
27742
27745
  WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
@@ -27878,7 +27881,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
27878
27881
  }, "dropUnusedVectors");
27879
27882
  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");
27880
27883
 
27881
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
27884
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
27882
27885
  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({
27883
27886
  target: [accounts.provider, accounts.externalId],
27884
27887
  set: {
@@ -28013,7 +28016,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
28013
28016
  AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
28014
28017
  }, "dropOrphanPeople");
28015
28018
 
28016
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
28019
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
28017
28020
  var FOLDED = [
28018
28021
  { table: "tasks", column: "title" },
28019
28022
  { table: "tasks", column: "close_reason" },
@@ -28050,7 +28053,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
28050
28053
  return filled2;
28051
28054
  }, "fillFolded");
28052
28055
 
28053
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/history-skips.js
28056
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/history-skips.js
28054
28057
  var HISTORY_KEY = "$history";
28055
28058
  var objectOf2 = /* @__PURE__ */ __name((text7) => {
28056
28059
  if (typeof text7 !== "string")
@@ -28126,7 +28129,7 @@ var withoutHistory = /* @__PURE__ */ __name((metadata3) => {
28126
28129
  return rest;
28127
28130
  }, "withoutHistory");
28128
28131
 
28129
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
28132
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
28130
28133
  import { createHash as createHash3 } from "node:crypto";
28131
28134
  var CHUNK_CHARS = 1200;
28132
28135
  var CHUNK_OVERLAP = 150;
@@ -28231,7 +28234,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
28231
28234
  return chunks2;
28232
28235
  }, "cutChunks");
28233
28236
 
28234
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/search/task-signature.js
28237
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/search/task-signature.js
28235
28238
  var DAY2 = 864e5;
28236
28239
  var CURRENCY = [
28237
28240
  [/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
@@ -28357,7 +28360,7 @@ var dueDayOf = /* @__PURE__ */ __name((text7, createdMs) => {
28357
28360
  return best?.day ?? null;
28358
28361
  }, "dueDayOf");
28359
28362
 
28360
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
28363
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
28361
28364
  var DAY3 = 864e5;
28362
28365
  var STOP_WORDS = new Set([
28363
28366
  // Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
@@ -28512,7 +28515,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
28512
28515
  ...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
28513
28516
  })).sort((a, b) => b.score - a.score), "rankCandidates");
28514
28517
 
28515
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
28518
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
28516
28519
  var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
28517
28520
  r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
28518
28521
  JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
@@ -28769,7 +28772,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
28769
28772
  SELECT count(*) AS chunks, sum(vector) AS embedded, sum(vector AND NOT stale) AS current, sum(stale) AS stale
28770
28773
  FROM hashes`);
28771
28774
  const chunks2 = Number(vectors?.chunks ?? 0);
28772
- const current = Number(vectors?.current ?? 0);
28775
+ const current2 = Number(vectors?.current ?? 0);
28773
28776
  const stale4 = Number(vectors?.stale ?? 0);
28774
28777
  return {
28775
28778
  builtAt,
@@ -28779,7 +28782,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
28779
28782
  edited: Number(pending?.edited ?? 0),
28780
28783
  deleted: Number(pending?.deleted ?? 0)
28781
28784
  },
28782
- vectors: { chunks: chunks2, embedded: Number(vectors?.embedded ?? 0), current, stale: stale4, missing: chunks2 - current - stale4 }
28785
+ vectors: { chunks: chunks2, embedded: Number(vectors?.embedded ?? 0), current: current2, stale: stale4, missing: chunks2 - current2 - stale4 }
28783
28786
  };
28784
28787
  }, "readiness");
28785
28788
  var vectorCounts = /* @__PURE__ */ __name(({ orm }, models) => new Map(models.map((model) => [
@@ -28787,7 +28790,7 @@ var vectorCounts = /* @__PURE__ */ __name(({ orm }, models) => new Map(models.ma
28787
28790
  Number(orm.get(sql`SELECT count(*) AS n FROM embeddings WHERE model = ${model}`)?.n ?? 0)
28788
28791
  ])), "vectorCounts");
28789
28792
 
28790
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
28793
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
28791
28794
  var DOCUMENT_PICTURE = "document_picture";
28792
28795
  var SCAN_PAGE2 = 5e3;
28793
28796
  var idOf = /* @__PURE__ */ __name((ref3) => {
@@ -28850,12 +28853,12 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
28850
28853
  }, "nearestPictures")
28851
28854
  }), "documentPicturesOver");
28852
28855
 
28853
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/index-text.js
28856
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/index-text.js
28854
28857
  var noteIndexText = /* @__PURE__ */ __name((title, text7) => title ? `${title}
28855
28858
 
28856
28859
  ${text7}` : text7, "noteIndexText");
28857
28860
 
28858
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/enrichments.js
28861
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/enrichments.js
28859
28862
  var ENRICHMENT_SUBJECTS = ["document", "note", "email"];
28860
28863
  var ENRICHMENT_POSITION = 1e6;
28861
28864
  var EMAIL_ENRICHMENT = "email_enrichment";
@@ -28949,7 +28952,7 @@ var enrichmentsOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
28949
28952
  }), "clear")
28950
28953
  }), "enrichmentsOver");
28951
28954
 
28952
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
28955
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
28953
28956
  var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
28954
28957
  const literal5 = escaped2 ?? plain2 ?? "";
28955
28958
  return wildcard ?? (/[*?[]/u.test(literal5) ? `[${literal5}]` : literal5);
@@ -29014,7 +29017,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
29014
29017
  var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
29015
29018
  var bound2 = /* @__PURE__ */ __name(({ sql: text7, params }) => sql.join(text7.split("?").map((part2, at2) => at2 < params.length ? sql`${sql.raw(part2)}${params[at2]}` : sql.raw(part2)), sql``), "bound");
29016
29019
 
29017
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
29020
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
29018
29021
  var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
29019
29022
  var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
29020
29023
  var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
@@ -29104,7 +29107,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
29104
29107
  });
29105
29108
  }, "linkMeeting");
29106
29109
 
29107
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
29110
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
29108
29111
  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), ''))";
29109
29112
  var UNSEARCHED_EVENT_TYPES = [
29110
29113
  "working-location",
@@ -29305,10 +29308,11 @@ ${enrichment}` : text7) : "";
29305
29308
  var drainCorpus = /* @__PURE__ */ __name((database, corpus, stemmerFor2, { batch = 200, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
29306
29309
  if (isQueryOnly(database))
29307
29310
  return 0;
29308
- if (corpus.type === "email" || corpus.type === "document")
29309
- database.prepare(`UPDATE chunks SET account_id = (SELECT account_id FROM ${corpus.table} WHERE id = chunks.chunkable_id)
29310
- WHERE chunkable_type = ? AND account_id IS NULL`).run(corpus.type);
29311
- database.prepare("INSERT OR IGNORE INTO search_index_state (name, watermark, filled_through, terms_through, normalizer_version) VALUES (?, 0, 0, 0, 1)").run(corpus.index);
29311
+ if ((corpus.type === "email" || corpus.type === "document") && database.prepare("SELECT 1 FROM chunks WHERE chunkable_type = ? AND account_id IS NULL LIMIT 1").get(corpus.type))
29312
+ write(database, () => database.prepare(`UPDATE chunks SET account_id = (SELECT account_id FROM ${corpus.table} WHERE id = chunks.chunkable_id)
29313
+ WHERE chunkable_type = ? AND account_id IS NULL`).run(corpus.type));
29314
+ if (!database.prepare("SELECT 1 FROM search_index_state WHERE name = ?").get(corpus.index))
29315
+ write(database, () => database.prepare("INSERT OR IGNORE INTO search_index_state (name, watermark, filled_through, terms_through, normalizer_version) VALUES (?, 0, 0, 0, 1)").run(corpus.index));
29312
29316
  const state = corpusIndexState(database, corpus);
29313
29317
  if (state.wanted === null)
29314
29318
  return 0;
@@ -29350,7 +29354,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
29350
29354
  return true;
29351
29355
  }, "resetNoteIndex");
29352
29356
 
29353
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
29357
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
29354
29358
  var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
29355
29359
  var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
29356
29360
  for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
@@ -29369,7 +29373,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
29369
29373
  }
29370
29374
  }, "resolvePersonLinks");
29371
29375
 
29372
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
29376
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
29373
29377
  var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
29374
29378
  var prepare = /* @__PURE__ */ __name((orm) => ({
29375
29379
  find: orm.select({
@@ -29594,7 +29598,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
29594
29598
  }, "meetingIdentityPk");
29595
29599
  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");
29596
29600
 
29597
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
29601
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
29598
29602
  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");
29599
29603
  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");
29600
29604
  var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
@@ -29671,12 +29675,14 @@ var upsertChat = /* @__PURE__ */ __name((context, accountKey, chat2) => {
29671
29675
  metadata: mergedMetadata(stored4?.metadata ?? null, chat2.providerMetadata),
29672
29676
  membershipState: chat2.membershipState === "member" ? null : chat2.membershipState ?? null,
29673
29677
  ...stateOf(chat2, now2()),
29678
+ ...chat2.searchable === false ? { searchable: 0 } : {},
29674
29679
  createdAt: now2(),
29675
29680
  updatedAt: now2()
29676
29681
  }).onConflictDoUpdate({
29677
29682
  target: [chats.accountId, chats.externalId],
29678
29683
  set: {
29679
29684
  kind: sql`excluded.kind`,
29685
+ ...chat2.searchable === false ? { searchable: 0 } : {},
29680
29686
  ...chat2.parentChatId === void 0 ? {} : { parentChatId: sql`excluded.parent_chat_id` },
29681
29687
  scope: sql`coalesce(excluded.scope, ${chats.scope})`,
29682
29688
  ...chat2.title === void 0 ? {} : { title: sql`excluded.title`, titleFolded: sql`excluded.title_folded` },
@@ -29882,7 +29888,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
29882
29888
  }
29883
29889
  }, "replaceAutoTags");
29884
29890
 
29885
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/counters.js
29891
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/counters.js
29886
29892
  var COUNTER_FIELDS = ["views", "reactions", "comments"];
29887
29893
  var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
29888
29894
  var counterObservationTime = /* @__PURE__ */ __name((observation, now2) => {
@@ -29901,7 +29907,47 @@ var counterFreshness = /* @__PURE__ */ __name((states) => {
29901
29907
  return states.some((one2) => one2.freshness === "stale") ? "stale" : "fresh";
29902
29908
  }, "counterFreshness");
29903
29909
 
29904
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/context/evidence.js
29910
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-tokens.js
29911
+ var BOT_TOKEN = /(?<!\d)(\d{6,12}):[A-Za-z0-9_-]{30,40}(?![A-Za-z0-9_-])/g;
29912
+ var MAY_HOLD = "*[0-9][0-9][0-9][0-9][0-9][0-9]:*";
29913
+ var MASKED_THROUGH = "bot_tokens_masked_through";
29914
+ var withoutBotTokens = /* @__PURE__ */ __name((text7) => text7.replace(BOT_TOKEN, "$1:<bot token hidden>"), "withoutBotTokens");
29915
+ var withoutBotTokensIn = /* @__PURE__ */ __name((message3) => {
29916
+ const { replyTo } = message3;
29917
+ return {
29918
+ ...message3,
29919
+ text: withoutBotTokens(message3.text),
29920
+ ...replyTo ? { replyTo: { ...replyTo, text: withoutBotTokens(replyTo.text) } } : {}
29921
+ };
29922
+ }, "withoutBotTokensIn");
29923
+ var maskStoredBotTokens = /* @__PURE__ */ __name((context) => {
29924
+ const { database, now: now2 } = context;
29925
+ const through = Number(database.prepare("SELECT value FROM store_settings WHERE key = ?").get(MASKED_THROUGH)?.value ?? 0);
29926
+ const newest = Number(database.prepare("SELECT max(id) AS id FROM messages").get()?.id ?? 0);
29927
+ if (newest <= through)
29928
+ return 0;
29929
+ const messages2 = database.prepare("SELECT id, text, reply_to FROM messages WHERE id > ? AND id <= ? AND (text GLOB ? OR reply_to GLOB ?)").all(through, newest, MAY_HOLD, MAY_HOLD).filter((row2) => masks(row2.text) || masks(row2.reply_to));
29930
+ const revisions = database.prepare("SELECT id, text FROM message_revisions WHERE message_id > ? AND message_id <= ? AND text GLOB ?").all(through, newest, MAY_HOLD).filter((row2) => masks(row2.text));
29931
+ write(database, () => {
29932
+ const message3 = database.prepare(`UPDATE messages SET text = ?, normalized_text = ?, normalizer_version = ?, reply_to = ?
29933
+ WHERE id = ? AND text = ? AND reply_to IS ?`);
29934
+ for (const row2 of messages2) {
29935
+ const text7 = withoutBotTokens(String(row2.text));
29936
+ const quote3 = row2.reply_to == null ? null : withoutBotTokens(String(row2.reply_to));
29937
+ const { changes } = message3.run(text7, normalize(text7), NORMALIZER_VERSION, quote3, Number(row2.id), row2.text, row2.reply_to);
29938
+ if (Number(changes) > 0)
29939
+ purgeVectorsOf(context, Number(row2.id));
29940
+ }
29941
+ const revision2 = database.prepare("UPDATE message_revisions SET text = ? WHERE id = ? AND text = ?");
29942
+ for (const row2 of revisions)
29943
+ revision2.run(withoutBotTokens(String(row2.text)), Number(row2.id), row2.text);
29944
+ database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(MASKED_THROUGH, String(newest), now2());
29945
+ });
29946
+ return messages2.length + revisions.length;
29947
+ }, "maskStoredBotTokens");
29948
+ var masks = /* @__PURE__ */ __name((value) => value != null && withoutBotTokens(String(value)) !== value, "masks");
29949
+
29950
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/context/evidence.js
29905
29951
  import { createHash as createHash4 } from "node:crypto";
29906
29952
  var CONTEXT_MAX_READ_BYTES = 262144;
29907
29953
  var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
@@ -29999,7 +30045,7 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
29999
30045
  return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
30000
30046
  }, "contextEvidenceRequest");
30001
30047
 
30002
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/email-activity.js
30048
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/email-activity.js
30003
30049
  var MAIL_AGENDA_COLUMNS = { chat_kind: { type: "enum", sql: "'dialog'" } };
30004
30050
  var ACTIVITY = `
30005
30051
  SELECT t.external_id AS thread, t.subject, t.last_email_at, t.emails_count,
@@ -30129,7 +30175,7 @@ var mailActivity = /* @__PURE__ */ __name((database) => ({
30129
30175
  threadActivity: /* @__PURE__ */ __name(async (accountId, since, where) => threadActivity(database, accountId, since, where), "threadActivity")
30130
30176
  }), "mailActivity");
30131
30177
 
30132
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
30178
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
30133
30179
  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");
30134
30180
  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;
30135
30181
  var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
@@ -30270,7 +30316,7 @@ var mailOwnText = /* @__PURE__ */ __name((body2) => {
30270
30316
  return text7 || body2.trim();
30271
30317
  }, "mailOwnText");
30272
30318
 
30273
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
30319
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
30274
30320
  var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
30275
30321
  var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
30276
30322
  k.start_offset, k.end_offset, k.account_id, k.occurred_at,
@@ -30348,9 +30394,11 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
30348
30394
  dropUnusedVectors(database, single);
30349
30395
  database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(MAIL_CUT, CUT, Date.now());
30350
30396
  });
30351
- database.prepare(`INSERT OR IGNORE INTO email_index_pending (indexable_type, id)
30352
- SELECT DISTINCT 'email_thread', e.email_thread_id FROM email_index_pending q JOIN emails e ON e.id = q.id
30353
- WHERE q.indexable_type = 'email' AND e.email_thread_id IS NOT NULL`).run();
30397
+ const unqueued = `FROM email_index_pending q JOIN emails e ON e.id = q.id
30398
+ WHERE q.indexable_type = 'email' AND e.email_thread_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM email_index_pending t
30399
+ WHERE t.indexable_type = 'email_thread' AND t.id = e.email_thread_id)`;
30400
+ if (database.prepare(`SELECT 1 ${unqueued} LIMIT 1`).get())
30401
+ write(database, () => database.prepare(`INSERT OR IGNORE INTO email_index_pending (indexable_type, id) SELECT DISTINCT 'email_thread', e.email_thread_id ${unqueued}`).run());
30354
30402
  const unchunked = database.prepare(`SELECT DISTINCT e.id, e.account_id FROM attachments a JOIN emails e ON a.attachable_type = 'email' AND e.id = a.attachable_id
30355
30403
  WHERE a.text <> '' AND e.deleted_at IS NULL
30356
30404
  AND NOT EXISTS (SELECT 1 FROM chunks k WHERE k.chunkable_type = 'attachment' AND k.chunkable_id = a.id)`).all();
@@ -30366,8 +30414,8 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
30366
30414
  const next = database.prepare("SELECT id FROM email_index_pending WHERE indexable_type = 'email_thread' ORDER BY id LIMIT 50");
30367
30415
  const done = database.prepare("DELETE FROM email_index_pending WHERE indexable_type = 'email_thread' AND id = ?");
30368
30416
  let threads = 0;
30369
- for (; ; ) {
30370
- const count = write(database, () => {
30417
+ while (next.all().length > 0)
30418
+ threads += write(database, () => {
30371
30419
  const ids = next.all().map(({ id: id2 }) => Number(id2));
30372
30420
  for (const id2 of ids) {
30373
30421
  chunkThread(database, id2, Date.now());
@@ -30375,14 +30423,10 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
30375
30423
  }
30376
30424
  return ids.length;
30377
30425
  });
30378
- if (count === 0)
30379
- break;
30380
- threads += count;
30381
- }
30382
30426
  return emails3 + threads;
30383
30427
  }, "drainEmailIndex");
30384
30428
 
30385
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
30429
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
30386
30430
  var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
30387
30431
  SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
30388
30432
  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,
@@ -30480,7 +30524,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
30480
30524
  var backfillSentAt = /* @__PURE__ */ __name((database, accountId, limit) => Number(database.prepare(`UPDATE emails SET sent_at = received_at WHERE id IN (
30481
30525
  SELECT id FROM emails WHERE account_id = ? AND sent_at IS NULL AND received_at IS NOT NULL LIMIT ?)`).run(accountId, limit).changes), "backfillSentAt");
30482
30526
 
30483
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
30527
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
30484
30528
  var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
30485
30529
  emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
30486
30530
  last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
@@ -30530,7 +30574,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
30530
30574
  return threads.length;
30531
30575
  }, "markEmailsRestored");
30532
30576
 
30533
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-nearest.js
30577
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-nearest.js
30534
30578
  var MAIL_PIECE_ROWS = `SELECT p.id, p.content_hash AS hash, p.type, p.owner, p.position, p.email_id AS email, v.vector
30535
30579
  FROM ${MAIL_PIECES} JOIN embeddings v ON v.model = ? AND v.content_hash = p.content_hash
30536
30580
  WHERE p.account_id = ?
@@ -30590,7 +30634,7 @@ var indexedMailPieces = /* @__PURE__ */ __name((database, model, query, filter,
30590
30634
  }, "indexedMailPieces");
30591
30635
  var nearestMailPieces = /* @__PURE__ */ __name((database, model, query, filter, depth) => (filter.threadExternalId === void 0 ? indexedMailPieces(database, model, query, filter, depth) : void 0) ?? scannedMailPieces(database, model, query, filter), "nearestMailPieces");
30592
30636
 
30593
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
30637
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
30594
30638
  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");
30595
30639
  var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
30596
30640
  var ruleOf = /* @__PURE__ */ __name((row2) => ({
@@ -30657,7 +30701,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
30657
30701
  }
30658
30702
  }), "mailRulesOver");
30659
30703
 
30660
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
30704
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
30661
30705
  var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
30662
30706
  database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
30663
30707
  VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
@@ -30665,7 +30709,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
30665
30709
  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);
30666
30710
  }, "reviewLink");
30667
30711
 
30668
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
30712
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
30669
30713
  function checkMeetingCancelled(signal) {
30670
30714
  if (!signal?.aborted)
30671
30715
  return;
@@ -30676,7 +30720,7 @@ function checkMeetingCancelled(signal) {
30676
30720
  }
30677
30721
  __name(checkMeetingCancelled, "checkMeetingCancelled");
30678
30722
 
30679
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
30723
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
30680
30724
  var meetingOf = /* @__PURE__ */ __name((row2) => ({
30681
30725
  id: Number(row2.id),
30682
30726
  accountId: Number(row2.account_id),
@@ -30726,7 +30770,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
30726
30770
  createdAt: Number(row2.created_at)
30727
30771
  }), "transcriptRowOf");
30728
30772
 
30729
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
30773
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
30730
30774
  var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
30731
30775
  var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
30732
30776
  var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
@@ -30893,7 +30937,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
30893
30937
  }
30894
30938
  }), "meetingReadsOver");
30895
30939
 
30896
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
30940
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
30897
30941
  var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
30898
30942
  const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
30899
30943
  const params = [input.accountId];
@@ -30936,7 +30980,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
30936
30980
  return { clauses, params };
30937
30981
  }, "meetingSelectionSql");
30938
30982
 
30939
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
30983
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
30940
30984
  var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
30941
30985
  async meetingChatLines(input) {
30942
30986
  checkMeetingCancelled(input.signal);
@@ -30964,7 +31008,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
30964
31008
  }
30965
31009
  }), "meetingChatLinesOver");
30966
31010
 
30967
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/person-separation.js
31011
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/person-separation.js
30968
31012
  var identitiesOf = /* @__PURE__ */ __name(({ database }, person2) => database.prepare("SELECT identity_id AS pk FROM identity_links WHERE person_id = ?").all(person2).map(({ pk }) => Number(pk)), "identitiesOf");
30969
31013
  var MOVED_AWAY = `moved.identity_id IN (SELECT value FROM json_each(?))
30970
31014
  AND (moved.from_person_id IN (SELECT value FROM json_each(?))
@@ -30979,7 +31023,7 @@ var apart = /* @__PURE__ */ __name(({ database }, one2, other) => {
30979
31023
  var separated = /* @__PURE__ */ __name((context, one2, other) => one2 !== other && apart(context, { identities: identitiesOf(context, one2), person: one2 }, { identities: identitiesOf(context, other), person: other }), "separated");
30980
31024
  var identitySeparated = /* @__PURE__ */ __name((context, identity, person2) => apart(context, { identities: [identity] }, { identities: identitiesOf(context, person2).filter((pk) => pk !== identity), person: person2 }), "identitySeparated");
30981
31025
 
30982
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
31026
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
30983
31027
  var MESSAGE_FIELDS = {
30984
31028
  pk: messages.id,
30985
31029
  nativeId: messages.externalId,
@@ -31150,7 +31194,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
31150
31194
  storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
31151
31195
  }), "chatActivity");
31152
31196
 
31153
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
31197
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
31154
31198
  var HIT_FIELDS = {
31155
31199
  ...MESSAGE_FIELDS,
31156
31200
  chatTitle: sql`${chats.title}`.as("chat_title"),
@@ -31249,7 +31293,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
31249
31293
  };
31250
31294
  }, "directReplies");
31251
31295
 
31252
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
31296
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
31253
31297
  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");
31254
31298
  var required = /* @__PURE__ */ __name((context, ref3) => {
31255
31299
  const found2 = identityRow(context, ref3);
@@ -31291,9 +31335,9 @@ var personByUid = /* @__PURE__ */ __name((context, uid) => {
31291
31335
  const found2 = context.database.prepare("SELECT id AS pk FROM persons WHERE id = ?").get(uid);
31292
31336
  if (!found2)
31293
31337
  return void 0;
31294
- const current = currentPerson(context.database, Number(found2.pk));
31295
- const record4 = recordOf2(context, current);
31296
- return current === Number(found2.pk) ? record4 : { ...record4, mergedInto: String(current) };
31338
+ const current2 = currentPerson(context.database, Number(found2.pk));
31339
+ const record4 = recordOf2(context, current2);
31340
+ return current2 === Number(found2.pk) ? record4 : { ...record4, mergedInto: String(current2) };
31297
31341
  }, "personByUid");
31298
31342
  var personOf = /* @__PURE__ */ __name((context, ref3) => {
31299
31343
  const found2 = identityRow(context, ref3);
@@ -31387,7 +31431,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
31387
31431
  }, "mentioning");
31388
31432
  var escaped = /* @__PURE__ */ __name((text7) => text7.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
31389
31433
 
31390
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
31434
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
31391
31435
  var missing2 = /* @__PURE__ */ __name(() => {
31392
31436
  throw new CliError("not_found", "Meeting, participant or selected target not found");
31393
31437
  }, "missing");
@@ -31509,7 +31553,7 @@ function meetingContextLinksOver(context) {
31509
31553
  }
31510
31554
  __name(meetingContextLinksOver, "meetingContextLinksOver");
31511
31555
 
31512
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
31556
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
31513
31557
  var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
31514
31558
  var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
31515
31559
  var summaryOf = /* @__PURE__ */ __name((row2) => ({
@@ -31538,7 +31582,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
31538
31582
  return row2 ? summaryText(summaryOf(row2)) : null;
31539
31583
  }, "indexedText");
31540
31584
 
31541
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
31585
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
31542
31586
  var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
31543
31587
  var meetingCurrentIndexRows = `
31544
31588
  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
@@ -31569,7 +31613,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
31569
31613
  }, "invalidateMeetingStems");
31570
31614
  var meetingStemmableText = /* @__PURE__ */ __name((text7) => text7.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
31571
31615
 
31572
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
31616
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
31573
31617
  function meetingHitIndexOver({ database, now: now2 }) {
31574
31618
  return {
31575
31619
  async indexSearch(original) {
@@ -31637,10 +31681,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
31637
31681
  }
31638
31682
  __name(meetingHitIndexOver, "meetingHitIndexOver");
31639
31683
 
31640
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
31684
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
31641
31685
  import { createHash as createHash5 } from "node:crypto";
31642
31686
 
31643
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/search/lucene/plain.js
31687
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/search/lucene/plain.js
31644
31688
  var REPAIRED = /* @__PURE__ */ new Set([
31645
31689
  "query.invalid-syntax",
31646
31690
  "query.unclosed-literal",
@@ -31711,43 +31755,43 @@ var without = /* @__PURE__ */ __name((text7, leaves) => [...leaves].sort((a, b)
31711
31755
  var plainQuery = /* @__PURE__ */ __name((text7, fields4 = SEARCH_FIELDS) => {
31712
31756
  if (text7.trim() && !/[\p{L}\p{N}*]/u.test(text7))
31713
31757
  throw new CliError("validation_error", `search needs a letter or a digit to look for; ${JSON.stringify(text7)} has none`);
31714
- let current = text7;
31758
+ let current2 = text7;
31715
31759
  let whole = false;
31716
31760
  for (let tries = 0; tries <= 64; tries++) {
31717
31761
  let reading;
31718
31762
  try {
31719
- reading = read2(current, fields4);
31763
+ reading = read2(current2, fields4);
31720
31764
  } catch {
31721
31765
  return text7;
31722
31766
  }
31723
31767
  if ("questions" in reading) {
31724
- current = reading.questions.sort((a, b) => b - a).reduce((left, at2) => left.slice(0, at2) + left.slice(at2).replace(/^\?+/u, (marks) => "\\?".repeat(marks.length)), current);
31768
+ current2 = reading.questions.sort((a, b) => b - a).reduce((left, at2) => left.slice(0, at2) + left.slice(at2).replace(/^\?+/u, (marks) => "\\?".repeat(marks.length)), current2);
31725
31769
  continue;
31726
31770
  }
31727
31771
  if ("wordless" in reading) {
31728
- if (!reading.words && current !== text7)
31772
+ if (!reading.words && current2 !== text7)
31729
31773
  return text7;
31730
31774
  if (!reading.wordless.length)
31731
- return current;
31732
- current = without(current, reading.wordless);
31775
+ return current2;
31776
+ current2 = without(current2, reading.wordless);
31733
31777
  continue;
31734
31778
  }
31735
- const word2 = reading.at < 0 || reading.at >= current.length ? void 0 : wordAround(current, reading.at);
31736
- const paren = "()".includes(current[reading.at] ?? "");
31737
- const repaired = word2 ? current.slice(0, word2.start) + literal4(current.slice(word2.start, word2.end), !paren, fields4) + current.slice(word2.end) : current;
31738
- if (repaired !== current) {
31739
- current = repaired;
31779
+ const word2 = reading.at < 0 || reading.at >= current2.length ? void 0 : wordAround(current2, reading.at);
31780
+ const paren = "()".includes(current2[reading.at] ?? "");
31781
+ const repaired = word2 ? current2.slice(0, word2.start) + literal4(current2.slice(word2.start, word2.end), !paren, fields4) + current2.slice(word2.end) : current2;
31782
+ if (repaired !== current2) {
31783
+ current2 = repaired;
31740
31784
  continue;
31741
31785
  }
31742
31786
  if (whole)
31743
31787
  return text7;
31744
31788
  whole = true;
31745
- current = everyWordLiteral(text7, fields4);
31789
+ current2 = everyWordLiteral(text7, fields4);
31746
31790
  }
31747
31791
  return text7;
31748
31792
  }, "plainQuery");
31749
31793
 
31750
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/search/trigrams.js
31794
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/search/trigrams.js
31751
31795
  var trigrams = /* @__PURE__ */ __name((term) => {
31752
31796
  const padded = ` ${term} `;
31753
31797
  const pieces = /* @__PURE__ */ new Set();
@@ -31756,7 +31800,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
31756
31800
  return [...pieces];
31757
31801
  }, "trigrams");
31758
31802
 
31759
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/search/correct.js
31803
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/search/correct.js
31760
31804
  var SHORTEST_CORRECTION = 3;
31761
31805
  var maxEdits = /* @__PURE__ */ __name((word2) => word2.length <= 4 ? 1 : 2, "maxEdits");
31762
31806
  var editDistance = /* @__PURE__ */ __name((a, b, max) => {
@@ -31764,22 +31808,22 @@ var editDistance = /* @__PURE__ */ __name((a, b, max) => {
31764
31808
  return max + 1;
31765
31809
  let before2 = new Array(b.length + 1).fill(0);
31766
31810
  let previous = Array.from({ length: b.length + 1 }, (_, at2) => at2);
31767
- let current = new Array(b.length + 1).fill(0);
31811
+ let current2 = new Array(b.length + 1).fill(0);
31768
31812
  for (let i = 1; i <= a.length; i++) {
31769
- current[0] = i;
31813
+ current2[0] = i;
31770
31814
  let lowest = i;
31771
31815
  for (let j = 1; j <= b.length; j++) {
31772
31816
  const cost = a[i - 1] === b[j - 1] ? 0 : 1;
31773
- let value = Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + cost);
31817
+ let value = Math.min(previous[j] + 1, current2[j - 1] + 1, previous[j - 1] + cost);
31774
31818
  if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
31775
31819
  value = Math.min(value, before2[j - 2] + 1);
31776
31820
  }
31777
- current[j] = value;
31821
+ current2[j] = value;
31778
31822
  lowest = Math.min(lowest, value);
31779
31823
  }
31780
31824
  if (lowest > max)
31781
31825
  return max + 1;
31782
- [before2, previous, current] = [previous, current, before2];
31826
+ [before2, previous, current2] = [previous, current2, before2];
31783
31827
  }
31784
31828
  return previous[b.length];
31785
31829
  }, "editDistance");
@@ -31803,7 +31847,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
31803
31847
  return corrections;
31804
31848
  }, "correctWords");
31805
31849
 
31806
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/search/garbled.js
31850
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/search/garbled.js
31807
31851
  var SHORTEST_GARBLED = 4;
31808
31852
  var MOST_WIDENED = 64;
31809
31853
  var plain = /* @__PURE__ */ __name((word2) => word2.replaceAll("\u044D", "\u0435"), "plain");
@@ -31848,20 +31892,20 @@ var garbledDistance = /* @__PURE__ */ __name((probe, word2, stems) => {
31848
31892
  var prefixDistance = /* @__PURE__ */ __name((stem, word2, max) => {
31849
31893
  let before2 = new Int32Array(word2.length + 1);
31850
31894
  let previous = new Int32Array(word2.length + 1);
31851
- let current = new Int32Array(word2.length + 1);
31895
+ let current2 = new Int32Array(word2.length + 1);
31852
31896
  for (let i = 1; i <= stem.length; i++) {
31853
- current[0] = i;
31897
+ current2[0] = i;
31854
31898
  let lowest = i;
31855
31899
  for (let j = 1; j <= word2.length; j++) {
31856
- let value = Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + (stem[i - 1] === word2[j - 1] ? 0 : 1));
31900
+ let value = Math.min(previous[j] + 1, current2[j - 1] + 1, previous[j - 1] + (stem[i - 1] === word2[j - 1] ? 0 : 1));
31857
31901
  if (i > 1 && j > 1 && stem[i - 1] === word2[j - 2] && stem[i - 2] === word2[j - 1])
31858
31902
  value = Math.min(value, before2[j - 2] + 1);
31859
- current[j] = value;
31903
+ current2[j] = value;
31860
31904
  lowest = Math.min(lowest, value);
31861
31905
  }
31862
31906
  if (lowest > max)
31863
31907
  return max + 1;
31864
- [before2, previous, current] = [previous, current, before2];
31908
+ [before2, previous, current2] = [previous, current2, before2];
31865
31909
  }
31866
31910
  return previous.reduce((lowest, value) => Math.min(lowest, value), max + 1);
31867
31911
  }, "prefixDistance");
@@ -31895,7 +31939,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
31895
31939
  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));
31896
31940
  }, "widenWords");
31897
31941
 
31898
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
31942
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
31899
31943
  import { readFileSync } from "node:fs";
31900
31944
  var loaded;
31901
31945
  var dictionary = /* @__PURE__ */ __name(() => {
@@ -31954,7 +31998,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word2) => {
31954
31998
  return false;
31955
31999
  }, "knownRussianWord");
31956
32000
 
31957
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
32001
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
31958
32002
  var WORD3 = /[\p{L}\p{N}\p{M}]+/gu;
31959
32003
  var MOST_WORDS = 128;
31960
32004
  var quote = /* @__PURE__ */ __name((word2) => `"${word2.replaceAll('"', '""')}"`, "quote");
@@ -32181,7 +32225,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text7, stemmer) => {
32181
32225
  return check3(tree);
32182
32226
  }, "matchMeetingText");
32183
32227
 
32184
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
32228
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
32185
32229
  var fail3 = /* @__PURE__ */ __name((message3) => {
32186
32230
  throw new CliError("validation_error", message3);
32187
32231
  }, "fail");
@@ -32363,7 +32407,7 @@ function meetingHitSearchOver({ database }) {
32363
32407
  }
32364
32408
  __name(meetingHitSearchOver, "meetingHitSearchOver");
32365
32409
 
32366
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-languages.js
32410
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-languages.js
32367
32411
  var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
32368
32412
  async fillTranscriptLanguages({ accountId, apply, now: now2 }) {
32369
32413
  positiveReadInteger(accountId, "accountId");
@@ -32395,7 +32439,7 @@ var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
32395
32439
  }
32396
32440
  }), "meetingLanguagesOver");
32397
32441
 
32398
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
32442
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
32399
32443
  import { createHash as createHash6 } from "node:crypto";
32400
32444
  var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
32401
32445
  if (value === void 0)
@@ -32485,7 +32529,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
32485
32529
  }
32486
32530
  }), "meetingParticipantSearchOver");
32487
32531
 
32488
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
32532
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
32489
32533
  var preparationQueries = {
32490
32534
  participants: {
32491
32535
  fields: "p.id, p.identity_id, p.display_name, l.person_id",
@@ -32535,7 +32579,7 @@ var preparationQueries = {
32535
32579
  }
32536
32580
  };
32537
32581
 
32538
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
32582
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
32539
32583
  var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
32540
32584
  async preparationContext(original) {
32541
32585
  const input = validateMeetingPreparationContext(original);
@@ -32576,7 +32620,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
32576
32620
  }
32577
32621
  }), "meetingPreparationContextOver");
32578
32622
 
32579
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
32623
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
32580
32624
  var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
32581
32625
  SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
32582
32626
  WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
@@ -32590,7 +32634,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
32590
32634
  JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
32591
32635
  )`, "preparationSubjects");
32592
32636
 
32593
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
32637
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
32594
32638
  var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
32595
32639
  async preparationKnowledge(original) {
32596
32640
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -32635,7 +32679,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
32635
32679
  }
32636
32680
  }), "meetingPreparationKnowledgeOver");
32637
32681
 
32638
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
32682
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
32639
32683
  var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
32640
32684
  async preparationNotes(original) {
32641
32685
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -32688,7 +32732,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
32688
32732
  }
32689
32733
  }), "meetingPreparationNotesOver");
32690
32734
 
32691
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
32735
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
32692
32736
  var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
32693
32737
  async relatedHistory(original) {
32694
32738
  const input = validateMeetingRelatedHistory(original);
@@ -32759,7 +32803,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
32759
32803
  }
32760
32804
  }), "meetingRelatedHistoryOver");
32761
32805
 
32762
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
32806
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
32763
32807
  var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
32764
32808
  var text3 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
32765
32809
  var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
@@ -32840,7 +32884,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
32840
32884
  }
32841
32885
  }), "meetingReviewOver");
32842
32886
 
32843
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
32887
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
32844
32888
  var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
32845
32889
  var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
32846
32890
  if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
@@ -32894,7 +32938,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
32894
32938
  }
32895
32939
  }), "meetingSeriesHistoryOver");
32896
32940
 
32897
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
32941
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
32898
32942
  var MOST_ROWS = 5e5;
32899
32943
  var meetingCountsSql = /* @__PURE__ */ __name((where) => `SELECT m.started_at, coalesce(m.duration_ms, m.ended_at - m.started_at) AS duration_ms,
32900
32944
  EXISTS (SELECT 1 FROM meeting_transcripts t WHERE t.meeting_id = m.id AND t.deleted_at IS NULL
@@ -32963,7 +33007,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
32963
33007
  }
32964
33008
  }), "meetingStatsOver");
32965
33009
 
32966
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
33010
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
32967
33011
  var CURSOR_KEY = "meetings";
32968
33012
  var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
32969
33013
  id: Number(row2.id),
@@ -33532,7 +33576,7 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
33532
33576
  };
33533
33577
  }, "meetingStoreOver");
33534
33578
 
33535
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
33579
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
33536
33580
  var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
33537
33581
  const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
33538
33582
  return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
@@ -33558,7 +33602,7 @@ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
33558
33602
  orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
33559
33603
  }, "release");
33560
33604
 
33561
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
33605
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
33562
33606
  var THREAD_COLUMNS = {
33563
33607
  subject: {
33564
33608
  where: /* @__PURE__ */ __name(({ value }) => ({
@@ -33575,7 +33619,7 @@ var threadRows = /* @__PURE__ */ __name((database, filter) => {
33575
33619
  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);
33576
33620
  }, "threadRows");
33577
33621
 
33578
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
33622
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
33579
33623
  var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
33580
33624
  id: `email:${place.emailId}`,
33581
33625
  chatId: place.threadExternalId,
@@ -34117,7 +34161,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
34117
34161
  }
34118
34162
  }), "mailStoreOver");
34119
34163
 
34120
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/search/dictionary.js
34164
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/search/dictionary.js
34121
34165
  import { readFileSync as readFileSync2 } from "node:fs";
34122
34166
  var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
34123
34167
  var folded5 = /* @__PURE__ */ __name((word2) => /^[а-яё'-]*$/.test(word2) ? word2.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word2), "folded");
@@ -34207,7 +34251,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
34207
34251
  }, "knownWord");
34208
34252
  var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
34209
34253
 
34210
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
34254
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
34211
34255
  var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
34212
34256
  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");
34213
34257
  var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
@@ -34293,7 +34337,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
34293
34337
  return found2;
34294
34338
  }, "spokenTranscripts");
34295
34339
 
34296
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
34340
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
34297
34341
  var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
34298
34342
  const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
34299
34343
  if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
@@ -34340,7 +34384,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
34340
34384
  });
34341
34385
  }, "placeHits");
34342
34386
 
34343
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-groups.js
34387
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-groups.js
34344
34388
  var GROUPS = {
34345
34389
  chat: {
34346
34390
  key: "m.chat_id",
@@ -34362,7 +34406,7 @@ var GROUPS = {
34362
34406
  }
34363
34407
  };
34364
34408
 
34365
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
34409
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
34366
34410
  var MESSAGES2 = {
34367
34411
  rows: "messages",
34368
34412
  threads: "chats",
@@ -34845,7 +34889,7 @@ var runCompiled = /* @__PURE__ */ __name(async (context, execution, by) => {
34845
34889
  };
34846
34890
  }, "runCompiled");
34847
34891
 
34848
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
34892
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
34849
34893
  function invalidMetadata() {
34850
34894
  throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
34851
34895
  }
@@ -34947,7 +34991,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
34947
34991
  };
34948
34992
  }), "counterTargets");
34949
34993
 
34950
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
34994
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
34951
34995
  var NOT_FILE_LIST = [...NOT_FILES].map((kind4) => `'${kind4}'`).join(",");
34952
34996
  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,
34953
34997
  att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
@@ -35066,7 +35110,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
35066
35110
  }));
35067
35111
  }, "attachmentViews");
35068
35112
 
35069
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
35113
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
35070
35114
  var transcript2 = /* @__PURE__ */ __name(({ orm }, chatKey, messageId) => orm.select({ text: messageTranscripts.text, source: messageTranscripts.source }).from(messageTranscripts).where(and(eq(messageTranscripts.chatId, chatKey), eq(messageTranscripts.messageExternalId, messageId))).get(), "transcript");
35071
35115
  var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text7, source2) => {
35072
35116
  const { orm, database, now: now2 } = context;
@@ -35104,7 +35148,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
35104
35148
  keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
35105
35149
  }, "intoVoiceAttachment");
35106
35150
 
35107
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
35151
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
35108
35152
  var FIELDS = [
35109
35153
  "threadExternalId",
35110
35154
  "senderIdentityId",
@@ -35189,8 +35233,9 @@ var fieldsOf = /* @__PURE__ */ __name((message3, sender) => ({
35189
35233
  normalizedText: normalize(message3.text),
35190
35234
  normalizerVersion: NORMALIZER_VERSION
35191
35235
  }), "fieldsOf");
35192
- var upsertMessage = /* @__PURE__ */ __name((context, key2, accountKey, chatKey, message3, via, seenAt) => {
35236
+ var upsertMessage = /* @__PURE__ */ __name((context, key2, accountKey, chatKey, received, via, seenAt) => {
35193
35237
  const { orm, now: now2 } = context;
35238
+ const message3 = withoutBotTokensIn(received);
35194
35239
  const statements = statementsOf2(orm);
35195
35240
  const sender = message3.senderId === null || message3.senderIsChat ? null : identityPk(context, accountKey, key2.provider, message3.senderId, message3.senderName, message3.senderUsername === void 0 ? {} : { username: message3.senderUsername });
35196
35241
  const fields4 = fieldsOf(message3, sender);
@@ -35422,7 +35467,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
35422
35467
  reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
35423
35468
  }, "writeDerivedReactions");
35424
35469
 
35425
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/keys.js
35470
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/keys.js
35426
35471
  var keysOver = /* @__PURE__ */ __name((context) => {
35427
35472
  const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
35428
35473
  const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
@@ -35443,7 +35488,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
35443
35488
  };
35444
35489
  }, "keysOver");
35445
35490
 
35446
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
35491
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
35447
35492
  var accountGroupsOf = /* @__PURE__ */ __name((database) => {
35448
35493
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
35449
35494
  if (!row2)
@@ -35490,7 +35535,7 @@ var forgetProfile = /* @__PURE__ */ __name((database, app, profile, now2) => {
35490
35535
  database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
35491
35536
  }, "forgetProfile");
35492
35537
 
35493
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
35538
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
35494
35539
  var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
35495
35540
  const owner = ownerPerson(context.database).id;
35496
35541
  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);
@@ -35512,7 +35557,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
35512
35557
  return personOf(context, ref3);
35513
35558
  }, "linkToOwner");
35514
35559
 
35515
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
35560
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
35516
35561
  var PROVIDERS_SETTING = "providers";
35517
35562
  var storedProvidersOf = /* @__PURE__ */ __name((database) => {
35518
35563
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
@@ -35560,7 +35605,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
35560
35605
  });
35561
35606
  }, "registerProvider");
35562
35607
 
35563
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
35608
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
35564
35609
  var DAY4 = 864e5;
35565
35610
  var RECENTLY_CLOSED_MS = 14 * DAY4;
35566
35611
  var TEXT_LIMIT = 20;
@@ -35759,7 +35804,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
35759
35804
  };
35760
35805
  }, "taskSimilarityOver");
35761
35806
 
35762
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
35807
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
35763
35808
  var SETTING3 = "taskCategories";
35764
35809
  var savedTaskCategories = /* @__PURE__ */ __name((database) => {
35765
35810
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
@@ -35778,7 +35823,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
35778
35823
  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);
35779
35824
  }, "saveTaskCategories");
35780
35825
 
35781
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
35826
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
35782
35827
  var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
35783
35828
  var ALLOWED = "taskAgentClose";
35784
35829
  var MIN = "taskAgentCloseMin";
@@ -35834,10 +35879,10 @@ var SUGGESTION_COLUMNS = [
35834
35879
  ];
35835
35880
  var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
35836
35881
 
35837
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/mail-findings.js
35882
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/mail-findings.js
35838
35883
  var MAIL_FINDINGS_KIND = "mail_findings";
35839
35884
 
35840
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/decisions.js
35885
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/decisions.js
35841
35886
  var TASK_CLOSE_KIND = "task_close";
35842
35887
  var DEFAULT_DECISION_POLICY = { agentDecisions: false, ruleProposalsOwnerOnly: true };
35843
35888
  var isOwnerOnlyKind = /* @__PURE__ */ __name((kind4) => kind4 === MAIL_FINDINGS_KIND || kind4 === MEETING_FINDINGS_KIND || kind4 === TASK_CLOSE_KIND || kind4 === SOURCE_REVIEW_KIND, "isOwnerOnlyKind");
@@ -35885,7 +35930,7 @@ var assertMayDecide = /* @__PURE__ */ __name((row2, by, policy = DEFAULT_DECISIO
35885
35930
  }, "assertMayDecide");
35886
35931
  var deciderAuthor = /* @__PURE__ */ __name((by) => by === "owner" ? "owner" : { bot: by.bot, ...by.model === void 0 ? {} : { model: by.model } }, "deciderAuthor");
35887
35932
 
35888
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/ref-summaries.js
35933
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/ref-summaries.js
35889
35934
  var PROFILE_PLACEHOLDER = "<profile>";
35890
35935
  var oneLine = /* @__PURE__ */ __name((text7) => singleLine(text7.replace(/\s+/g, " ").trim()), "oneLine");
35891
35936
  var openKind = /* @__PURE__ */ __name((kind4) => kind4 === "email" ? "message" : kind4 === "email_thread" ? "chat" : kind4 === "unknown" ? void 0 : kind4, "openKind");
@@ -35946,7 +35991,7 @@ var refLabel = /* @__PURE__ */ __name((summary) => {
35946
35991
  return `${WORDS2[summary.kind]} ${named3}${notes2 === "" ? "" : ` (${notes2})`}`;
35947
35992
  }, "refLabel");
35948
35993
 
35949
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/ref-summaries.js
35994
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/ref-summaries.js
35950
35995
  var EXCERPT_CHARS = 280;
35951
35996
  var TITLE_CHARS = 120;
35952
35997
  var MEMORY_TITLE_CHARS = 80;
@@ -36368,7 +36413,7 @@ var refsStoreOver = /* @__PURE__ */ __name((context) => ({
36368
36413
  summaries: /* @__PURE__ */ __name(async (texts2, options) => refSummariesOf(context.database, texts2, { ...options, now: context.now() }), "summaries")
36369
36414
  }), "refsStoreOver");
36370
36415
 
36371
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
36416
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
36372
36417
  var sourceOf3 = /* @__PURE__ */ __name((read3, ref3) => ({
36373
36418
  ref: ref3,
36374
36419
  kind: read3.kind,
@@ -36406,7 +36451,7 @@ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => {
36406
36451
  });
36407
36452
  }, "evidenceSourcesOf");
36408
36453
 
36409
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/attachments/limits.js
36454
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/attachments/limits.js
36410
36455
  var MAX_FILE_BYTES = 50 * 1024 * 1024;
36411
36456
  var MAX_TEXT_CHARS = 2e6;
36412
36457
  var ATTACHMENT_LIMIT_ENV = [
@@ -36432,7 +36477,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
36432
36477
  return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
36433
36478
  }, "pdfPreviewLimits");
36434
36479
 
36435
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/ulid.js
36480
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/ulid.js
36436
36481
  import { randomBytes } from "node:crypto";
36437
36482
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
36438
36483
  var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
@@ -36445,7 +36490,7 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
36445
36490
  return time3 + random;
36446
36491
  }, "ulid");
36447
36492
 
36448
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
36493
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
36449
36494
  var FOLDED_FIELDS = ["title", "site", "language", "author"];
36450
36495
  var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
36451
36496
  if (!meta && !sections?.length)
@@ -36466,7 +36511,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
36466
36511
  return typeof language === "string" && language !== "" ? language : null;
36467
36512
  }, "languageOf");
36468
36513
 
36469
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
36514
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
36470
36515
  var isObject2 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
36471
36516
  var objectOf3 = /* @__PURE__ */ __name((value) => {
36472
36517
  if (isObject2(value))
@@ -36709,7 +36754,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
36709
36754
  };
36710
36755
  }, "filesStoreOver");
36711
36756
 
36712
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
36757
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
36713
36758
  var IMPORTED_DOCUMENT_QUERY = defineQuery({
36714
36759
  entity: "document",
36715
36760
  backend: "sql",
@@ -36755,7 +36800,7 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
36755
36800
  return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
36756
36801
  }, "importedDocumentWhere");
36757
36802
 
36758
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/note-dates.js
36803
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/note-dates.js
36759
36804
  var dateFileNotes = /* @__PURE__ */ __name((database, folder, dates) => {
36760
36805
  const fileAt = database.prepare("SELECT id, document_id FROM files WHERE account_id = ? AND external_id = ? AND kind <> 'folder' AND deleted_at IS NULL");
36761
36806
  const legacy = database.prepare("SELECT id FROM documents WHERE account_id = ? AND external_id = ? AND deleted_at IS NULL");
@@ -36776,7 +36821,7 @@ var dateFileNotes = /* @__PURE__ */ __name((database, folder, dates) => {
36776
36821
  return changed;
36777
36822
  }, "dateFileNotes");
36778
36823
 
36779
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/text-input.js
36824
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/text-input.js
36780
36825
  var textOf2 = /* @__PURE__ */ __name((text7, what, max = 1e5, allowEmpty = false) => {
36781
36826
  const value = text7.trim();
36782
36827
  if (!value && !allowEmpty || value.length > max)
@@ -36789,7 +36834,7 @@ var oneOf = /* @__PURE__ */ __name((value, allowed, what) => {
36789
36834
  return value;
36790
36835
  }, "oneOf");
36791
36836
 
36792
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
36837
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
36793
36838
  var NOTE_FORMATS = ["obsidian", "markdown"];
36794
36839
  var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
36795
36840
  var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso3(value), "optionalIso");
@@ -36850,7 +36895,7 @@ var linkOf = /* @__PURE__ */ __name((database, row2) => {
36850
36895
  role: row2.role == null ? null : String(row2.role),
36851
36896
  purpose: row2.purpose == null ? null : String(row2.purpose),
36852
36897
  evidence: row2.evidence == null ? null : String(row2.evidence),
36853
- provenance: metadata3.provenance ?? null,
36898
+ provenance: typeof metadata3.provenance === "string" ? metadata3.provenance : null,
36854
36899
  confirmed: Number(row2.confirmed) === 1,
36855
36900
  createdAt: iso3(row2.created_at),
36856
36901
  ...row2.account_id == null ? {} : { accountId: Number(row2.account_id) },
@@ -36858,6 +36903,8 @@ var linkOf = /* @__PURE__ */ __name((database, row2) => {
36858
36903
  ...row2.ends_at == null ? {} : { endsAt: Number(row2.ends_at) },
36859
36904
  ...row2.deleted_at == null ? {} : { deletedAt: Number(row2.deleted_at) },
36860
36905
  ...typeof metadata3.position === "string" ? { position: metadata3.position } : {},
36906
+ ...typeof metadata3.roleNote === "string" ? { roleNote: metadata3.roleNote } : {},
36907
+ ...isEngagement(metadata3.engagement) ? { engagement: metadata3.engagement } : {},
36861
36908
  ...typeof metadata3.overrides === "number" ? { overrides: metadata3.overrides } : {}
36862
36909
  };
36863
36910
  }, "linkOf");
@@ -36926,7 +36973,9 @@ var insertLink = /* @__PURE__ */ __name((context, input) => {
36926
36973
  const position2 = input.position === void 0 ? void 0 : textOf2(input.position, "a position", 200);
36927
36974
  if (input.startsAt !== void 0 && input.endsAt !== void 0 && input.endsAt <= input.startsAt)
36928
36975
  throw new CliError("validation_error", "a relationship ends after it starts");
36929
- const metadata3 = provenance2 === void 0 && position2 === void 0 ? null : JSON.stringify({ provenance: provenance2, position: position2 });
36976
+ const roleNote = input.roleNote === void 0 ? void 0 : textOf2(input.roleNote, "a role note", 200);
36977
+ const fields4 = { provenance: provenance2, position: position2, roleNote, engagement: input.engagement };
36978
+ const metadata3 = Object.values(fields4).every((value) => value === void 0) ? null : JSON.stringify(fields4);
36930
36979
  const row2 = database.prepare("INSERT INTO links (from_type, from_id, to_type, to_id, kind, anchor, source, target_text, target_folded, role, evidence, metadata, confirmed, created_at, author, updated_at, purpose, starts_at, ends_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(from2.type, from2.id, to?.type ?? null, to?.id ?? null, kind4, input.anchor ?? null, origin, targetText, targetText === null ? null : targetKey(targetText), input.role === void 0 ? null : textOf2(input.role, "a role", 200), input.evidence === void 0 ? null : textOf2(input.evidence, "evidence", 2e3), metadata3, input.confirmed === false ? 0 : 1, at2, origin === "owner" ? "owner" : null, at2, input.purpose === void 0 ? null : purposeOf(input.purpose), input.startsAt ?? null, input.endsAt ?? null);
36931
36980
  if (to === null && targetText !== null)
36932
36981
  resolveKey(database, targetKey(targetText));
@@ -37322,7 +37371,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
37322
37371
  };
37323
37372
  }, "notesStoreOver");
37324
37373
 
37325
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
37374
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
37326
37375
  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";
37327
37376
  var iso4 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
37328
37377
  var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -37581,7 +37630,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
37581
37630
  };
37582
37631
  }, "memoriesStoreOver");
37583
37632
 
37584
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
37633
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
37585
37634
  var DEFAULT_FIRST_PASS_PER_CHAT = 0;
37586
37635
  var KEY = "taskFirstPassPerChat";
37587
37636
  var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
@@ -37601,7 +37650,7 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
37601
37650
  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);
37602
37651
  }, "saveFirstPassPerChat");
37603
37652
 
37604
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/external-links.js
37653
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/external-links.js
37605
37654
  var EXTERNAL_SERVICE = /^[a-z][a-z0-9-]{0,31}$/;
37606
37655
  var EXTERNAL_ID_CHARS = 200;
37607
37656
  var SOURCE_URL_CHARS = 2e3;
@@ -37628,7 +37677,7 @@ var sourceUrlOf = /* @__PURE__ */ __name((value, reason = "task.source-url") =>
37628
37677
  return text7;
37629
37678
  }, "sourceUrlOf");
37630
37679
 
37631
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
37680
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
37632
37681
  var TASK_SORTS = ["priority", "due", "created", "updated", "key", "state"];
37633
37682
  var field = /* @__PURE__ */ __name((name, type, example, more = {}) => ({
37634
37683
  name,
@@ -37856,7 +37905,7 @@ var withoutField = /* @__PURE__ */ __name((query, name) => {
37856
37905
  var TASK_PEOPLE = `WITH merged AS (SELECT json_extract(value, '$[0]') AS id, json_extract(value, '$[1]') AS now FROM json_each(?)), counts AS (SELECT coalesce(m.now, a.assignee_id) AS person, count(DISTINCT t.id) AS n FROM task_assignments a JOIN tasks t ON t.id = a.task_id AND t.deleted_at IS NULL LEFT JOIN merged m ON m.id = a.assignee_id WHERE a.assignee_type = 'person' GROUP BY 1) SELECT p.id, p.name, p.owner, coalesce(c.n, 0) AS n FROM persons p LEFT JOIN counts c ON c.person = p.id WHERE NOT ${mergedAwaySql("p")} ORDER BY p.owner DESC, n DESC, p.name IS NULL, p.name COLLATE NOCASE, p.id LIMIT ?`;
37857
37906
  var mergedAssignees = /* @__PURE__ */ __name((database) => JSON.stringify(database.prepare(`SELECT DISTINCT a.assignee_id AS id FROM task_assignments a JOIN persons p ON p.id = a.assignee_id WHERE a.assignee_type = 'person' AND ${mergedAwaySql("p")}`).all().map(({ id: id2 }) => [Number(id2), currentPerson(database, Number(id2))])), "mergedAssignees");
37858
37907
 
37859
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
37908
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
37860
37909
  var authorNamed = /* @__PURE__ */ __name((database, row2) => {
37861
37910
  if (row2.author_type == null)
37862
37911
  return null;
@@ -37884,7 +37933,7 @@ var addComment = /* @__PURE__ */ __name((context, task, body2, by) => {
37884
37933
  return commentsOf(database, task).find((one2) => one2.ref === `note:${made}`);
37885
37934
  }, "addComment");
37886
37935
 
37887
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
37936
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
37888
37937
  var TASK_RELATION_KINDS = [
37889
37938
  "blocked-by",
37890
37939
  "follow-up-of",
@@ -38014,7 +38063,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
38014
38063
  };
38015
38064
  }, "taskRelationsStoreOver");
38016
38065
 
38017
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
38066
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
38018
38067
  var TASK_ROLES = ["assignee", "reviewer", "watcher"];
38019
38068
  var iso5 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
38020
38069
  var recordTaskEvent = /* @__PURE__ */ __name((database, task, actor, kind4, changes, at2) => {
@@ -38543,7 +38592,7 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
38543
38592
  };
38544
38593
  }, "workTasksOver");
38545
38594
 
38546
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
38595
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
38547
38596
  var taskCloseOver = /* @__PURE__ */ __name((context) => {
38548
38597
  const { database, now: now2 } = context;
38549
38598
  const liveRow = /* @__PURE__ */ __name((id2) => {
@@ -38592,7 +38641,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
38592
38641
  };
38593
38642
  }, "taskCloseOver");
38594
38643
 
38595
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
38644
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
38596
38645
  var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
38597
38646
  const { database, now: now2 } = context;
38598
38647
  const required3 = /* @__PURE__ */ __name((id2) => {
@@ -38810,7 +38859,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
38810
38859
  };
38811
38860
  }, "taskPairsOver");
38812
38861
 
38813
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-stats.js
38862
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-stats.js
38814
38863
  var ACCOUNT_SCOPE = "t.package_id IS NOT NULL AND t.deleted_at IS NULL AND t.project_id = ?";
38815
38864
  var TASK_STATS_SQL = {
38816
38865
  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"),
@@ -38849,7 +38898,7 @@ var taskStatsOver = /* @__PURE__ */ __name(({ database }, inbox) => ({
38849
38898
  }, "statNames")
38850
38899
  }), "taskStatsOver");
38851
38900
 
38852
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
38901
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
38853
38902
  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";
38854
38903
  var inboxProject = /* @__PURE__ */ __name(({ database, now: now2 }, account, create) => {
38855
38904
  const key2 = inboxKey(account);
@@ -39056,7 +39105,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
39056
39105
  throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
39057
39106
  }, "oneOf");
39058
39107
 
39059
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/accounts.js
39108
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/accounts.js
39060
39109
  var accountAccountsOver = /* @__PURE__ */ __name((context) => {
39061
39110
  const { database } = context;
39062
39111
  const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
@@ -39102,7 +39151,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
39102
39151
  };
39103
39152
  }, "accountsStoreOver");
39104
39153
 
39105
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
39154
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
39106
39155
  var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
39107
39156
  var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
39108
39157
  const message3 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
@@ -39126,7 +39175,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
39126
39175
  })), "keepDownloads");
39127
39176
  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");
39128
39177
 
39129
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/attachments.js
39178
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/attachments.js
39130
39179
  var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
39131
39180
  const { database } = context;
39132
39181
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -39183,7 +39232,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
39183
39232
  }, "keepAttachmentText")
39184
39233
  }), "attachmentsStoreOver");
39185
39234
 
39186
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
39235
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
39187
39236
  var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
39188
39237
  var pointerMover = /* @__PURE__ */ __name((context, type) => {
39189
39238
  const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
@@ -39368,7 +39417,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
39368
39417
  return done;
39369
39418
  }, "rekeyChats");
39370
39419
 
39371
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
39420
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
39372
39421
  var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
39373
39422
  var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
39374
39423
  var CHAT_LIST_KEY = "chat_list_complete";
@@ -39426,7 +39475,7 @@ var chatCoverage = /* @__PURE__ */ __name(({ database }, accountKey) => {
39426
39475
  return { ...coverage, oldestMessageAt: toIso(oldest) };
39427
39476
  }, "chatCoverage");
39428
39477
 
39429
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/chats.js
39478
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/chats.js
39430
39479
  var chatsStoreOver = /* @__PURE__ */ __name((context) => {
39431
39480
  const { database } = context;
39432
39481
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
@@ -39561,7 +39610,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
39561
39610
  };
39562
39611
  }, "chatsStoreOver");
39563
39612
 
39564
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
39613
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
39565
39614
  import { createHash as createHash7 } from "node:crypto";
39566
39615
  var BATCH_CONTEXT = 50;
39567
39616
  var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
@@ -39699,7 +39748,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
39699
39748
  var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
39700
39749
  ${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
39701
39750
 
39702
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
39751
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
39703
39752
  import { setTimeout } from "node:timers/promises";
39704
39753
  var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
39705
39754
  var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
@@ -39886,13 +39935,13 @@ var replaceConversations = /* @__PURE__ */ __name(async (context, chatKey, { sta
39886
39935
  orm.update(conversationState).set({ currentBuild: build, builtAt: startedAt, algorithmVersion }).where(and(eq(conversationState.chatId, chatKey), sql`coalesce(${conversationState.currentBuild}, 0) < ${build}`)).run();
39887
39936
  orm.run(sql`DELETE FROM chunks WHERE chunkable_type='conversation' AND chunkable_id IN (SELECT id FROM conversations WHERE chat_id=${chatKey} AND build < (SELECT current_build FROM conversation_state WHERE chat_id=${chatKey}))`);
39888
39937
  }));
39889
- const current = sql`(SELECT ${conversationState.currentBuild} FROM ${conversationState}
39938
+ const current2 = sql`(SELECT ${conversationState.currentBuild} FROM ${conversationState}
39890
39939
  WHERE ${conversationState.chatId} = ${chatKey})`;
39891
39940
  await inTurns(context, (function* () {
39892
39941
  for (; ; ) {
39893
39942
  const removed = orm.delete(conversations).where(sql`${conversations.id} IN (SELECT ${conversations.id} FROM ${conversations}
39894
- WHERE ${conversations.chatId} = ${chatKey} AND ${conversations.build} < ${current} LIMIT ${batch})`).returning({ pk: conversations.id }).all().length + orm.delete(messageLinks).where(sql`rowid IN (SELECT rowid FROM ${messageLinks} WHERE ${messageLinks.chatId} = ${chatKey}
39895
- AND ${messageLinks.build} < ${current} LIMIT ${batch})`).returning({ pk: messageLinks.messageId }).all().length;
39943
+ WHERE ${conversations.chatId} = ${chatKey} AND ${conversations.build} < ${current2} LIMIT ${batch})`).returning({ pk: conversations.id }).all().length + orm.delete(messageLinks).where(sql`rowid IN (SELECT rowid FROM ${messageLinks} WHERE ${messageLinks.chatId} = ${chatKey}
39944
+ AND ${messageLinks.build} < ${current2} LIMIT ${batch})`).returning({ pk: messageLinks.messageId }).all().length;
39896
39945
  if (removed === 0)
39897
39946
  return;
39898
39947
  yield;
@@ -40011,7 +40060,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
40011
40060
  AND NOT EXISTS (SELECT 1 FROM messages d
40012
40061
  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");
40013
40062
 
40014
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/conversations.js
40063
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/conversations.js
40015
40064
  var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
40016
40065
  const { database } = context;
40017
40066
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -40118,7 +40167,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
40118
40167
  };
40119
40168
  }, "conversationsStoreOver");
40120
40169
 
40121
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/counters.js
40170
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/counters.js
40122
40171
  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";
40123
40172
  var accountCountersOver = /* @__PURE__ */ __name((context) => {
40124
40173
  const { database } = context;
@@ -40143,7 +40192,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
40143
40192
  counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
40144
40193
  }), "countersStoreOver");
40145
40194
 
40146
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
40195
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
40147
40196
  var MENTION_STATUSES = ["found", "linked", "dismissed"];
40148
40197
  var MENTION_QUERY = defineQuery({
40149
40198
  entity: "mention",
@@ -40359,7 +40408,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
40359
40408
  return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
40360
40409
  }, "listPlaces");
40361
40410
 
40362
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/mentions.js
40411
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/mentions.js
40363
40412
  var accountMentionsOver = /* @__PURE__ */ __name((context) => {
40364
40413
  const { database } = context;
40365
40414
  const { findAccountPk: findAccountPk2 } = keysOver(context);
@@ -40394,7 +40443,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
40394
40443
  places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
40395
40444
  }), "mentionsStoreOver");
40396
40445
 
40397
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
40446
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
40398
40447
  var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
40399
40448
  const read3 = database.prepare("SELECT m.id, m.external_id, m.text, m.sent_at, m.sender_name, coalesce(m.sender_chat_external_id, i.external_id) AS sender_id FROM messages m LEFT JOIN identities i ON i.id = m.sender_identity_id WHERE m.chat_id = ? AND m.deleted_at IS NULL AND (m.text LIKE '%google.com%' OR m.text LIKE '%forms.gle%') " + (messageId === void 0 ? "" : "AND m.external_id = ? ") + "ORDER BY m.sent_at DESC, m.id DESC");
40400
40449
  const rows = messageId === void 0 ? read3.all(chatKey) : read3.all(chatKey, messageId);
@@ -40409,7 +40458,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
40409
40458
  }));
40410
40459
  }, "documentLinkMessages");
40411
40460
 
40412
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
40461
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
40413
40462
  var stemmerFor = stemmerCache();
40414
40463
  var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
40415
40464
  if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
@@ -40453,7 +40502,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
40453
40502
  });
40454
40503
  }, "laterSharingRare");
40455
40504
 
40456
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/messages.js
40505
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/messages.js
40457
40506
  var accountMessagesOver = /* @__PURE__ */ __name((context) => {
40458
40507
  const { database } = context;
40459
40508
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
@@ -40588,7 +40637,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
40588
40637
  laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
40589
40638
  }), "messagesStoreOver");
40590
40639
 
40591
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/person-merges.js
40640
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/person-merges.js
40592
40641
  var mergeId = /* @__PURE__ */ __name((to, from2) => `merge:${to}-${from2}`, "mergeId");
40593
40642
  var parseMergeId = /* @__PURE__ */ __name((id2) => {
40594
40643
  const found2 = /^merge:([1-9]\d*)-([1-9]\d*)$/.exec(id2.trim());
@@ -40693,7 +40742,7 @@ var split = /* @__PURE__ */ __name((context, uid, refs, by) => {
40693
40742
  return recordOf2(context, alone);
40694
40743
  }, "split");
40695
40744
 
40696
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
40745
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
40697
40746
  var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
40698
40747
  var iso6 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
40699
40748
  var personPreparation = /* @__PURE__ */ __name(({ database, now: now2 }, uid, { accounts: accounts2, limit }) => {
@@ -40752,7 +40801,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database, now: now2 }, uid, {
40752
40801
  });
40753
40802
  }, "personPreparation");
40754
40803
 
40755
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
40804
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
40756
40805
  var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
40757
40806
  const id2 = Number(uid);
40758
40807
  if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
@@ -40760,7 +40809,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
40760
40809
  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(currentPerson(database, id2), JSON.stringify(accountIds)));
40761
40810
  }, "personSeenInAccounts");
40762
40811
 
40763
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
40812
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
40764
40813
  var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
40765
40814
  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);
40766
40815
  if (!row2)
@@ -40827,7 +40876,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
40827
40876
  return { id: id2, personId, removed: true };
40828
40877
  }, "removeNote");
40829
40878
 
40830
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/people.js
40879
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/people.js
40831
40880
  var accountPeopleOver = /* @__PURE__ */ __name((context) => {
40832
40881
  const { database } = context;
40833
40882
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
@@ -40915,13 +40964,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
40915
40964
  };
40916
40965
  }, "peopleStoreOver");
40917
40966
 
40918
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
40967
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
40919
40968
  import { createHash as createHash9 } from "node:crypto";
40920
40969
 
40921
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
40970
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
40922
40971
  import { createHash as createHash8 } from "node:crypto";
40923
40972
 
40924
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
40973
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
40925
40974
  var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
40926
40975
  var AUTHOR_MEASURES = [
40927
40976
  "messages",
@@ -41061,7 +41110,7 @@ var withoutUrls = /* @__PURE__ */ __name((text7) => text7.replace(/\S+/gu, (toke
41061
41110
  var rankingWords = /* @__PURE__ */ __name((text7) => withoutUrls(text7).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
41062
41111
  var rankingQuestion = /* @__PURE__ */ __name((text7) => withoutUrls(text7).includes("?"), "rankingQuestion");
41063
41112
 
41064
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
41113
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
41065
41114
  var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
41066
41115
  var exhausted2 = /* @__PURE__ */ __name((budget) => {
41067
41116
  throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
@@ -41209,26 +41258,26 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
41209
41258
  }
41210
41259
  }
41211
41260
  const visited = /* @__PURE__ */ new Set([node.pk]);
41212
- let current = node;
41261
+ let current2 = node;
41213
41262
  let depth = 0;
41214
- while (current) {
41263
+ while (current2) {
41215
41264
  touch();
41216
41265
  if (++depth > RANKING_GRAPH_LIMITS.depth)
41217
41266
  exhausted2("reply graph depth");
41218
41267
  const row2 = result.get(node.pk);
41219
- if (!["group", "channel"].includes(current.chatKind)) {
41268
+ if (!["group", "channel"].includes(current2.chatKind)) {
41220
41269
  row2.kind = "other";
41221
41270
  break;
41222
41271
  }
41223
- if (current.graph?.discussionSource) {
41224
- row2.kind = current.pk === node.pk ? "bridge" : originOf(current) ? "comments" : null;
41272
+ if (current2.graph?.discussionSource) {
41273
+ row2.kind = current2.pk === node.pk ? "bridge" : originOf(current2) ? "comments" : null;
41225
41274
  break;
41226
41275
  }
41227
- if (current.chatKind === "channel" || current.chatKind === "group" && current.graph?.reply === null) {
41228
- row2.kind = current.pk === node.pk ? "posts" : "comments";
41276
+ if (current2.chatKind === "channel" || current2.chatKind === "group" && current2.graph?.reply === null) {
41277
+ row2.kind = current2.pk === node.pk ? "posts" : "comments";
41229
41278
  break;
41230
41279
  }
41231
- const ancestorPk = parents.get(current.pk);
41280
+ const ancestorPk = parents.get(current2.pk);
41232
41281
  if (ancestorPk === void 0)
41233
41282
  break;
41234
41283
  if (visited.has(ancestorPk)) {
@@ -41239,7 +41288,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
41239
41288
  break;
41240
41289
  }
41241
41290
  visited.add(ancestorPk);
41242
- current = byPk.get(ancestorPk);
41291
+ current2 = byPk.get(ancestorPk);
41243
41292
  }
41244
41293
  if (!node.event || node.graph?.discussionSource)
41245
41294
  continue;
@@ -41283,7 +41332,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
41283
41332
  };
41284
41333
  }, "rankReplyGraph");
41285
41334
 
41286
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
41335
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
41287
41336
  var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
41288
41337
  var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
41289
41338
  var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
@@ -41457,7 +41506,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
41457
41506
  return { items, evidence, summary, graph: graph.quality };
41458
41507
  }, "calculateAdminStatistics");
41459
41508
 
41460
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
41509
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
41461
41510
  var rankingContextRange = /* @__PURE__ */ __name((root) => {
41462
41511
  const dates = [];
41463
41512
  const visit = /* @__PURE__ */ __name((node, required3) => {
@@ -41479,7 +41528,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
41479
41528
  return dates[0].node.resolution.date;
41480
41529
  }, "rankingContextRange");
41481
41530
 
41482
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
41531
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
41483
41532
  var reactionCounts = /* @__PURE__ */ __name((stored4) => {
41484
41533
  let counts;
41485
41534
  try {
@@ -41774,7 +41823,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
41774
41823
  });
41775
41824
  }, "rankQuery");
41776
41825
 
41777
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
41826
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
41778
41827
  function fail4(message3, reason = "query.too-large") {
41779
41828
  throw new CliError("validation_error", message3, { reason, complete: false });
41780
41829
  }
@@ -41951,7 +42000,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
41951
42000
  return result;
41952
42001
  }), "adminStatisticsQuery");
41953
42002
 
41954
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
42003
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
41955
42004
  var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
41956
42005
  if (!execution.accounts.length)
41957
42006
  return { conversations: [], chats: [] };
@@ -41969,7 +42018,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
41969
42018
  return { conversations: conversations2, chats: chats2 };
41970
42019
  }, "conversationEligibility");
41971
42020
 
41972
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
42021
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
41973
42022
  import { createHash as createHash10 } from "node:crypto";
41974
42023
  var EVIDENCE_BYTES = 64 * 1024;
41975
42024
  var FINGERPRINT_BYTES = 8 * 1024 * 1024;
@@ -42119,7 +42168,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
42119
42168
  return result;
42120
42169
  }, "rankingEvidence");
42121
42170
 
42122
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/reply-times.js
42171
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/reply-times.js
42123
42172
  var FAR = Number.MAX_SAFE_INTEGER;
42124
42173
  var chatsIn = /* @__PURE__ */ __name((scope3, kinds2) => {
42125
42174
  const params = [...scope3.accounts.flatMap(({ provider, account }) => [provider, account]), ...kinds2];
@@ -42213,7 +42262,7 @@ var waitingChats = /* @__PURE__ */ __name((context, scope3, waits, cap) => {
42213
42262
  });
42214
42263
  }, "waitingChats");
42215
42264
 
42216
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/queries.js
42265
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/queries.js
42217
42266
  var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
42218
42267
  const mailIndexed = /* @__PURE__ */ __name((execution) => {
42219
42268
  if (execution.corpus === "mail")
@@ -42234,7 +42283,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
42234
42283
  };
42235
42284
  }, "queriesStoreOver");
42236
42285
 
42237
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
42286
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
42238
42287
  var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
42239
42288
  const { database, now: now2 } = context;
42240
42289
  const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
@@ -42273,10 +42322,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
42273
42322
  }));
42274
42323
  }, "chatEventsOf");
42275
42324
 
42276
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
42325
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
42277
42326
  import { createHash as createHash11 } from "node:crypto";
42278
42327
 
42279
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/calendar.js
42328
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/calendar.js
42280
42329
  var calendarKey = /* @__PURE__ */ __name((zone, by) => {
42281
42330
  const format = new Intl.DateTimeFormat("en-CA", {
42282
42331
  timeZone: zone,
@@ -42296,7 +42345,7 @@ var weekKey = /* @__PURE__ */ __name((day3) => {
42296
42345
  return date3.toISOString().slice(0, 10);
42297
42346
  }, "weekKey");
42298
42347
 
42299
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/retention.js
42348
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/retention.js
42300
42349
  var RETENTION_TOLERANCE = 864e5;
42301
42350
  var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
42302
42351
  const { since, until, cutoff, checkpoints, within, limit, by } = options;
@@ -42350,7 +42399,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
42350
42399
  return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
42351
42400
  }, "retentionCohorts");
42352
42401
 
42353
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
42402
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
42354
42403
  var iso7 = /* @__PURE__ */ __name((at2) => new Date(at2).toISOString(), "iso");
42355
42404
  var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId, options, evidence) => {
42356
42405
  validateRetentionOptions(options);
@@ -42481,7 +42530,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
42481
42530
  };
42482
42531
  }, "retentionQuery");
42483
42532
 
42484
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
42533
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
42485
42534
  var iso8 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
42486
42535
  var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
42487
42536
  ...isBot === void 0 ? {} : { bot: isBot },
@@ -42612,7 +42661,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
42612
42661
  lastCount: memberCountsOf(context, pk).at(-1) ?? null
42613
42662
  })), "trackedChats");
42614
42663
 
42615
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/roster.js
42664
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/roster.js
42616
42665
  var rosterStoreOver = /* @__PURE__ */ __name((context) => {
42617
42666
  const { database } = context;
42618
42667
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
@@ -42668,7 +42717,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
42668
42717
  };
42669
42718
  }, "rosterStoreOver");
42670
42719
 
42671
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
42720
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
42672
42721
  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");
42673
42722
  var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
42674
42723
  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 ?`);
@@ -42692,7 +42741,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
42692
42741
  }
42693
42742
  }, "backfillNormalized");
42694
42743
 
42695
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
42744
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
42696
42745
  var INDEX2 = "message_words";
42697
42746
  var searchIndexState2 = /* @__PURE__ */ __name((database) => {
42698
42747
  const row2 = indexRow(database, INDEX2);
@@ -42819,7 +42868,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
42819
42868
  });
42820
42869
  }, "resetSearchIndex");
42821
42870
 
42822
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
42871
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
42823
42872
  var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
42824
42873
  const filled2 = { stemmed: 0, drained: 0 };
42825
42874
  const before2 = stemsState(database);
@@ -42914,7 +42963,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
42914
42963
  return resetStems(database, { now: now2 });
42915
42964
  }, "followDefaultStemmers");
42916
42965
 
42917
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
42966
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
42918
42967
  var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
42919
42968
  var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
42920
42969
  const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
@@ -42936,7 +42985,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
42936
42985
  });
42937
42986
  }, "termCandidates");
42938
42987
 
42939
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/search-index.js
42988
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/search-index.js
42940
42989
  var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
42941
42990
  const { database } = context;
42942
42991
  const stemmerFor2 = stemmerCache();
@@ -42960,7 +43009,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
42960
43009
  };
42961
43010
  }, "searchIndexStoreOver");
42962
43011
 
42963
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
43012
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
42964
43013
  var HISTORY_KEPT = 1e3;
42965
43014
  var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
42966
43015
  var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
@@ -43029,7 +43078,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
43029
43078
  return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
43030
43079
  }, "clearHistory");
43031
43080
 
43032
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/searches.js
43081
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/searches.js
43033
43082
  var searchesStoreOver = /* @__PURE__ */ __name((context) => {
43034
43083
  const { database } = context;
43035
43084
  return {
@@ -43053,7 +43102,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
43053
43102
  };
43054
43103
  }, "searchesStoreOver");
43055
43104
 
43056
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/added-sources.js
43105
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/added-sources.js
43057
43106
  import { createHash as createHash12 } from "node:crypto";
43058
43107
  var ADDED_KINDS = ["text", "file", "page"];
43059
43108
  var sha256 = /* @__PURE__ */ __name((value) => createHash12("sha256").update(value).digest("hex"), "sha256");
@@ -43250,7 +43299,7 @@ var addedSourcesOver = /* @__PURE__ */ __name((context) => {
43250
43299
  };
43251
43300
  }, "addedSourcesOver");
43252
43301
 
43253
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
43302
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
43254
43303
  var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
43255
43304
  var ACTION_OUTCOMES = ["ok", "refused", "failed"];
43256
43305
  var CODE = /^[a-z][a-z0-9_]{0,63}$/;
@@ -43293,7 +43342,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
43293
43342
  };
43294
43343
  }, "agentActionsStoreOver");
43295
43344
 
43296
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
43345
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
43297
43346
  var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
43298
43347
  }) => {
43299
43348
  const { database, now: now2 } = context;
@@ -43352,7 +43401,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
43352
43401
  };
43353
43402
  }, "botUpdateStoreOver");
43354
43403
 
43355
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/reviewed.js
43404
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/reviewed.js
43356
43405
  var prefixesText = /* @__PURE__ */ __name((types) => `${article(types[0] ?? "")} ${types.map((type) => `${type}:`).join(" or ")}`, "prefixesText");
43357
43406
  var refuse = /* @__PURE__ */ __name((message3, reason, code = "validation_error") => {
43358
43407
  throw new CliError(code, message3, { reason });
@@ -43500,7 +43549,7 @@ var reviewedRowsOver = /* @__PURE__ */ __name((context) => {
43500
43549
  return { partyOf, partyThing, reviewedOf, written, keepEvidence, ownerOnly: ownerOnly2, linkedId, ...decisionsOver(context) };
43501
43550
  }, "reviewedRowsOver");
43502
43551
 
43503
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/business-contracts.js
43552
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/business-contracts.js
43504
43553
  var CONTRACTS = "SELECT k.*, b.name AS author_name, b.kind AS author_kind FROM contracts k LEFT JOIN bots b ON k.author_type = 'bot' AND b.id = k.author_id";
43505
43554
  var DAY_MS = 864e5;
43506
43555
  var deadlineOf = /* @__PURE__ */ __name((expiration, days) => expiration === null || days === null ? null : new Date(Date.parse(`${expiration}T00:00:00Z`) - days * DAY_MS).toISOString().slice(0, 10), "deadlineOf");
@@ -43649,7 +43698,7 @@ var contractsStoreOver = /* @__PURE__ */ __name((context) => {
43649
43698
  };
43650
43699
  }, "contractsStoreOver");
43651
43700
 
43652
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/business-search.js
43701
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/business-search.js
43653
43702
  var BUSINESS_FIND_MAX = 2001;
43654
43703
  var party = /* @__PURE__ */ __name((kind4, id2, as) => `LEFT JOIN persons ${as}p ON ${kind4} = 'person' AND ${as}p.id = ${id2} AND ${as}p.owner = 0 LEFT JOIN organizations ${as}o ON ${kind4} = 'organization' AND ${as}o.id = ${id2} LEFT JOIN projects ${as}j ON ${kind4} = 'project' AND ${as}j.id = ${id2}`, "party");
43655
43704
  var partyName = /* @__PURE__ */ __name((as) => `coalesce(${as}p.name, ${as}o.name, ${as}j.name)`, "partyName");
@@ -43753,7 +43802,7 @@ var businessSearchOver = /* @__PURE__ */ __name(({ database }) => {
43753
43802
  };
43754
43803
  }, "businessSearchOver");
43755
43804
 
43756
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
43805
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
43757
43806
  var DAY5 = 864e5;
43758
43807
  var COUNTERPART_LINK = `EXISTS (SELECT 1 FROM links l WHERE l.from_type = 'event' AND l.from_id = e.id AND l.to_type = 'person' AND l.to_id = ? AND l.kind = ${linkKind("related-to")} AND l.role = '${COUNTERPART_ROLE}')`;
43759
43808
  var accountsOf = /* @__PURE__ */ __name((filter) => {
@@ -43863,7 +43912,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
43863
43912
  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);
43864
43913
  }, "listEvents");
43865
43914
 
43866
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-forget.js
43915
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-forget.js
43867
43916
  var distinctIds = /* @__PURE__ */ __name((rows) => [...new Set(rows.map((row2) => Number(row2.id)))], "distinctIds");
43868
43917
  var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, accountId, cursorKey: cursorKey2, now: now2 }, refresh) => {
43869
43918
  const unseenBefore = unreferenced(database, "identities");
@@ -43920,7 +43969,7 @@ var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, account
43920
43969
  return { entries: entryIds.length, events: goneEvents.length };
43921
43970
  }, "forgetCalendarRows");
43922
43971
 
43923
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
43972
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
43924
43973
  var calendarOf = /* @__PURE__ */ __name((row2) => ({
43925
43974
  id: Number(row2.id),
43926
43975
  accountId: Number(row2.account_id),
@@ -44286,10 +44335,10 @@ var calendarWritesOver = /* @__PURE__ */ __name((context) => {
44286
44335
  for (const entry2 of saved)
44287
44336
  if (entry2.kind === "series" && entry2.status === "cancelled")
44288
44337
  cancelOccurrences(entry2.id, now2);
44289
- const current = saved.map(({ id: id2 }) => entryOf(entryRow(id2)));
44290
- for (const entry2 of current)
44338
+ const current2 = saved.map(({ id: id2 }) => entryOf(entryRow(id2)));
44339
+ for (const entry2 of current2)
44291
44340
  link3(entry2, now2);
44292
- refreshAround(current.map(({ id: id2 }) => id2), now2);
44341
+ refreshAround(current2.map(({ id: id2 }) => id2), now2);
44293
44342
  return entries.map((input) => entryOf(entryRow(ids.get(input))));
44294
44343
  }, "saveAll");
44295
44344
  const removeAll = /* @__PURE__ */ __name((calendarId, externalIds, now2) => {
@@ -44523,7 +44572,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
44523
44572
  };
44524
44573
  }, "eventStoreOver");
44525
44574
 
44526
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
44575
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
44527
44576
  var CATALOG_QUERY = defineQuery({
44528
44577
  entity: "document",
44529
44578
  backend: "sql",
@@ -44679,9 +44728,9 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
44679
44728
  const id2 = account(accountId);
44680
44729
  if (externalIds.length > 1e4)
44681
44730
  throw new CliError("validation_error", "catalog scope exceeds 10000 entries");
44682
- const current = [...new Set(externalIds.map((key2) => field2(key2)))];
44731
+ const current2 = [...new Set(externalIds.map((key2) => field2(key2)))];
44683
44732
  return write(database, () => {
44684
- const retired = database.prepare("UPDATE documents SET metadata=json_set(metadata, '$.catalog.active', json('false')) WHERE account_id=? AND json_type(metadata, '$.catalog')='object' AND json_extract(metadata, '$.catalog.active')=1" + (current.length ? " AND external_id NOT IN (SELECT value FROM json_each(?))" : "") + " RETURNING id").all(...current.length ? [id2, JSON.stringify(current)] : [id2]);
44733
+ const retired = database.prepare("UPDATE documents SET metadata=json_set(metadata, '$.catalog.active', json('false')) WHERE account_id=? AND json_type(metadata, '$.catalog')='object' AND json_extract(metadata, '$.catalog.active')=1" + (current2.length ? " AND external_id NOT IN (SELECT value FROM json_each(?))" : "") + " RETURNING id").all(...current2.length ? [id2, JSON.stringify(current2)] : [id2]);
44685
44734
  const at2 = now2();
44686
44735
  for (const row2 of retired)
44687
44736
  syncFile(database, at2, Number(row2.id), { seen: false });
@@ -44765,7 +44814,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
44765
44814
  };
44766
44815
  }, "catalogStoreOver");
44767
44816
 
44768
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
44817
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
44769
44818
  var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
44770
44819
  var field3 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
44771
44820
  CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
@@ -44778,7 +44827,7 @@ var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
44778
44827
  THEN 'source-modified' ELSE 'stored-update' END`;
44779
44828
  var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field3("sourceUrl")})`;
44780
44829
 
44781
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
44830
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
44782
44831
  var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
44783
44832
  const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
44784
44833
  signal?.throwIfAborted();
@@ -44877,7 +44926,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
44877
44926
  });
44878
44927
  }, "readMeetingContextEvidence");
44879
44928
 
44880
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
44929
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
44881
44930
  var corpora = {
44882
44931
  message: {
44883
44932
  table: "messages",
@@ -45116,10 +45165,10 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
45116
45165
  }
45117
45166
  }), "contextRecordsOver");
45118
45167
 
45119
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/crm.js
45168
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/crm.js
45120
45169
  var isItemKind = /* @__PURE__ */ __name((kind4) => kind4 === "deal" || kind4 === "lead", "isItemKind");
45121
45170
 
45122
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/records.js
45171
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/records.js
45123
45172
  import { createHash as createHash13 } from "node:crypto";
45124
45173
  var RECORDS_SCHEMA_VERSION = 1;
45125
45174
  var RECORD_OPERATIONS = ["upsert", "delete"];
@@ -45471,7 +45520,7 @@ var fieldReferences = /* @__PURE__ */ __name((record4, options = {}) => {
45471
45520
  return found2;
45472
45521
  }, "fieldReferences");
45473
45522
 
45474
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-rows.js
45523
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-rows.js
45475
45524
  var TABLES2 = { deal: "deals", lead: "leads" };
45476
45525
  var SOURCE = "crm";
45477
45526
  var crmIdentityId = /* @__PURE__ */ __name((key2, externalId, type = "contact") => `${idPart(key2.account)}/${type}/${idPart(externalId)}`, "crmIdentityId");
@@ -45600,7 +45649,7 @@ var crmRowsOver = /* @__PURE__ */ __name((context) => {
45600
45649
  return { savePipeline, saveItemRow };
45601
45650
  }, "crmRowsOver");
45602
45651
 
45603
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-settings.js
45652
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-settings.js
45604
45653
  var CRM_LINK_MODES = ["reported", "review"];
45605
45654
  var COMPANY_TYPE_MEANINGS = ["customer-of", "supplier", "partner-of"];
45606
45655
  var crmSettingKey = /* @__PURE__ */ __name((key2, name) => `crm.${key2.provider}:${key2.account}.${name}`, "crmSettingKey");
@@ -45663,7 +45712,7 @@ var crmSettingsOf = /* @__PURE__ */ __name((database) => database.prepare("SELEC
45663
45712
  ];
45664
45713
  }), "crmSettingsOf");
45665
45714
 
45666
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/money-lines.js
45715
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/money-lines.js
45667
45716
  var MAX_LINES = 500;
45668
45717
  var PARENTS = {
45669
45718
  invoice: {
@@ -45763,7 +45812,7 @@ var moneyLinesOver = /* @__PURE__ */ __name(({ database }) => {
45763
45812
  return { linesOf, insertLines, shownLines, appendLine, deleteLine, sumOf, retotal };
45764
45813
  }, "moneyLinesOver");
45765
45814
 
45766
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/refunds.js
45815
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/refunds.js
45767
45816
  var COUNTED = {
45768
45817
  confirmed: "np.review = 'confirmed' AND np.deleted_at IS NULL",
45769
45818
  // A proposed refund promises nothing back yet, so it must not free room an import could then fill.
@@ -45838,7 +45887,7 @@ var refundRulesOver = /* @__PURE__ */ __name((context) => {
45838
45887
  return { originalFor, refundShare, confirmable, keepsRefunded, keepsShare, keepsInvoice };
45839
45888
  }, "refundRulesOver");
45840
45889
 
45841
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/finance.js
45890
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/finance.js
45842
45891
  var FINANCE_TYPES = ["invoice", "payment"];
45843
45892
  var isFinanceType = /* @__PURE__ */ __name((type) => FINANCE_TYPES.includes(type), "isFinanceType");
45844
45893
  var PAID = netPaidSql("i.id");
@@ -46236,7 +46285,7 @@ var financeStoreOver = /* @__PURE__ */ __name((context) => {
46236
46285
  };
46237
46286
  }, "financeStoreOver");
46238
46287
 
46239
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-entries.js
46288
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-entries.js
46240
46289
  var refuse2 = /* @__PURE__ */ __name((message3, reason) => {
46241
46290
  throw new CliError("validation_error", message3, { reason });
46242
46291
  }, "refuse");
@@ -46314,7 +46363,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
46314
46363
  };
46315
46364
  }, "paymentEntriesOver");
46316
46365
 
46317
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
46366
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
46318
46367
  var EVIDENCE_FINDINGS_KIND = "evidence_findings";
46319
46368
  var reference = /* @__PURE__ */ __name((raw) => {
46320
46369
  if (/^(document|note):[1-9]\d*$/.test(raw))
@@ -46340,7 +46389,7 @@ var validateEvidenceFindings = /* @__PURE__ */ __name((input) => {
46340
46389
  return valid;
46341
46390
  }, "validateEvidenceFindings");
46342
46391
 
46343
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
46392
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
46344
46393
  var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
46345
46394
  var PROPOSAL_VERDICTS = ["useful", "not_useful"];
46346
46395
  var iso10 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
@@ -46521,7 +46570,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
46521
46570
  };
46522
46571
  }, "proposedActionsStoreOver");
46523
46572
 
46524
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-roles.js
46573
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-roles.js
46525
46574
  var settingOf = /* @__PURE__ */ __name((list2) => `relationships.roles.${list2}`, "settingOf");
46526
46575
  var isList = /* @__PURE__ */ __name((list2) => Object.hasOwn(ROLE_LISTS, list2), "isList");
46527
46576
  var listOf = /* @__PURE__ */ __name((list2) => {
@@ -46593,7 +46642,7 @@ var relationRolesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
46593
46642
  };
46594
46643
  }, "relationRolesOver");
46595
46644
 
46596
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-proposals.js
46645
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-proposals.js
46597
46646
  var isoOf = /* @__PURE__ */ __name((ms) => ms === void 0 ? null : new Date(ms).toISOString(), "isoOf");
46598
46647
  var relationOf = /* @__PURE__ */ __name((link3, now2) => ({
46599
46648
  id: link3.id,
@@ -46608,6 +46657,8 @@ var relationOf = /* @__PURE__ */ __name((link3, now2) => ({
46608
46657
  confidenceCategory: link3.confirmed ? "owner-confirmed" : "weak",
46609
46658
  standing: standingOf(link3, now2),
46610
46659
  position: link3.position ?? null,
46660
+ roleNote: link3.roleNote ?? null,
46661
+ engagement: link3.engagement ?? null,
46611
46662
  startsAt: isoOf(link3.startsAt),
46612
46663
  endsAt: isoOf(link3.endsAt),
46613
46664
  createdAt: link3.createdAt
@@ -46627,15 +46678,29 @@ var relationProposalsOver = /* @__PURE__ */ __name((context) => {
46627
46678
  const from2 = thingOf(database, link3.from);
46628
46679
  database.prepare("INSERT INTO proposed_actions (kind, target_type, target_id, payload, reason, status, proposed_by_type, proposed_by_id, decided_by_type, decided_by_id, decided_at, result, created_at, updated_at) VALUES ('relationship', ?, ?, ?, ?, 'rejected', ?, ?, ?, ?, ?, ?, ?, ?)").run(from2?.type ?? null, from2?.id ?? null, JSON.stringify({ from: link3.from, to: link3.to, kind: link3.kind, ...link3.role ? { role: link3.role } : {} }), link3.evidence, proposed.type, proposed.id, decided.type, decided.id, at2, JSON.stringify({ reason: why.join(": "), link: link3.id }), at2, at2);
46629
46680
  }, "rejected");
46630
- const checkedRole = /* @__PURE__ */ __name((link3, role) => {
46631
- if (typeof role !== "string")
46632
- return;
46681
+ const checkedRole = /* @__PURE__ */ __name((link3, { role, engagement }) => {
46633
46682
  const [fromType, , toType] = fromTo(link3);
46634
- checkStoredRole(database, link3.kind, fromType, toType, role);
46683
+ if (typeof role === "string")
46684
+ checkStoredRole(database, link3.kind, fromType, toType, role);
46685
+ if (typeof engagement === "string")
46686
+ checkEngagement(link3.kind, fromType, toType, engagement);
46635
46687
  }, "checkedRole");
46688
+ const metadataOf3 = /* @__PURE__ */ __name((link3, changes) => {
46689
+ const fields4 = METADATA_FIELDS.filter((field4) => field4 in changes);
46690
+ if (!fields4.length)
46691
+ return;
46692
+ const row2 = database.prepare("SELECT metadata FROM links WHERE id = ?").get(Number(link3.id));
46693
+ const metadata3 = row2?.metadata == null ? {} : JSON.parse(String(row2.metadata));
46694
+ for (const field4 of fields4)
46695
+ if (changes[field4] == null)
46696
+ delete metadata3[field4];
46697
+ else
46698
+ metadata3[field4] = changes[field4];
46699
+ return JSON.stringify(metadata3);
46700
+ }, "metadataOf");
46636
46701
  const applyUpdate = /* @__PURE__ */ __name((link3, input) => {
46637
46702
  const changes = changesOf(input);
46638
- checkedRole(link3, changes.role);
46703
+ checkedRole(link3, changes);
46639
46704
  if ("role" in changes) {
46640
46705
  const taken = database.prepare("SELECT b.id FROM links a JOIN links b ON b.kind = a.kind AND b.from_type = a.from_type AND b.from_id = a.from_id AND b.to_type = a.to_type AND b.to_id = a.to_id AND b.anchor IS a.anchor AND b.account_id IS a.account_id AND ifnull(b.role, '') = ifnull(?, '') AND b.id <> a.id WHERE a.id = ?").get(changes.role ?? null, Number(link3.id));
46641
46706
  if (taken)
@@ -46646,7 +46711,8 @@ var relationProposalsOver = /* @__PURE__ */ __name((context) => {
46646
46711
  const startsAt = "startsAt" in changes ? changes.startsAt ?? void 0 : link3.startsAt;
46647
46712
  const endsAt = "endsAt" in changes ? changes.endsAt ?? void 0 : link3.endsAt;
46648
46713
  spanOf2(startsAt, endsAt);
46649
- database.prepare("UPDATE links SET role = CASE WHEN ? THEN ? ELSE role END, purpose = CASE WHEN ? THEN ? ELSE purpose END, starts_at = CASE WHEN ? THEN ? ELSE starts_at END, ends_at = CASE WHEN ? THEN ? ELSE ends_at END, metadata = CASE WHEN ? THEN (CASE WHEN ? IS NULL THEN json_remove(coalesce(metadata, '{}'), '$.position') ELSE json_set(coalesce(metadata, '{}'), '$.position', ?) END) ELSE metadata END, updated_at = ? WHERE id = ?").run(Number("role" in changes), changes.role ?? null, Number("purpose" in changes), changes.purpose ?? null, Number("startsAt" in changes), changes.startsAt ?? null, Number("endsAt" in changes), changes.endsAt ?? null, Number("position" in changes), changes.position ?? null, changes.position ?? null, now2(), Number(link3.id));
46714
+ const metadata3 = metadataOf3(link3, changes);
46715
+ database.prepare("UPDATE links SET role = CASE WHEN ? THEN ? ELSE role END, purpose = CASE WHEN ? THEN ? ELSE purpose END, starts_at = CASE WHEN ? THEN ? ELSE starts_at END, ends_at = CASE WHEN ? THEN ? ELSE ends_at END, metadata = CASE WHEN ? THEN ? ELSE metadata END, updated_at = ? WHERE id = ?").run(Number("role" in changes), changes.role ?? null, Number("purpose" in changes), changes.purpose ?? null, Number("startsAt" in changes), changes.startsAt ?? null, Number("endsAt" in changes), changes.endsAt ?? null, Number(metadata3 !== void 0), metadata3 ?? null, now2(), Number(link3.id));
46650
46716
  return linkOf(database, database.prepare("SELECT * FROM links WHERE id = ?").get(Number(link3.id)));
46651
46717
  }, "applyUpdate");
46652
46718
  const ownerUpdate = /* @__PURE__ */ __name((link3, input) => {
@@ -46661,7 +46727,9 @@ var relationProposalsOver = /* @__PURE__ */ __name((context) => {
46661
46727
  const at2 = now2();
46662
46728
  const metadata3 = JSON.stringify({
46663
46729
  overrides: Number(link3.id),
46664
- ...link3.position ? { position: link3.position } : {}
46730
+ ...link3.position ? { position: link3.position } : {},
46731
+ ...link3.roleNote ? { roleNote: link3.roleNote } : {},
46732
+ ...link3.engagement ? { engagement: link3.engagement } : {}
46665
46733
  });
46666
46734
  const same = database.prepare("SELECT id FROM links WHERE kind = ? AND from_type = ? AND from_id = ? AND to_type = ? AND to_id = ? AND account_id IS NULL AND anchor IS NULL AND ifnull(role, '') = ?").get(...endsOf(link3), role ?? "");
46667
46735
  const id2 = same ? Number(same.id) : Number(database.prepare("INSERT INTO links (from_type, from_id, to_type, to_id, kind, role, purpose, source, metadata, confirmed, starts_at, ends_at, created_at, author, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, 'owner', ?, 1, ?, ?, ?, 'owner', ?) RETURNING id").get(...fromTo(link3), link3.kind, role, link3.purpose, metadata3, link3.startsAt ?? null, link3.endsAt ?? null, at2, at2)?.id);
@@ -46745,6 +46813,8 @@ var relationProposalsOver = /* @__PURE__ */ __name((context) => {
46745
46813
  ...input.role === void 0 ? {} : { role: input.role },
46746
46814
  ...input.purpose === void 0 ? {} : { purpose: purposeOf(input.purpose) },
46747
46815
  ...input.position === void 0 ? {} : { position: positionOf(input.position) },
46816
+ ...input.roleNote === void 0 ? {} : { roleNote: roleNoteOf(input.roleNote) },
46817
+ ...input.engagement === void 0 ? {} : { engagement: input.engagement },
46748
46818
  ...input.startsAt === void 0 ? {} : { startsAt: input.startsAt },
46749
46819
  ...input.endsAt === void 0 ? {} : { endsAt: input.endsAt },
46750
46820
  evidence,
@@ -46758,7 +46828,7 @@ var relationProposalsOver = /* @__PURE__ */ __name((context) => {
46758
46828
  update: /* @__PURE__ */ __name((link3, input) => write(database, () => ownerUpdate(link3, input)), "update"),
46759
46829
  proposeUpdate: /* @__PURE__ */ __name((link3, input, by) => {
46760
46830
  const changes = changesOf(input);
46761
- checkedRole(link3, changes.role);
46831
+ checkedRole(link3, changes);
46762
46832
  return write(database, () => {
46763
46833
  const from2 = thingOf(database, link3.from);
46764
46834
  const held = database.prepare("SELECT id FROM proposed_actions WHERE kind='relationship_update' AND status='proposed' AND target_type=? AND target_id=? AND json_extract(payload,'$.relationship')=? AND json_extract(payload,'$.changes')=json(?) ORDER BY id LIMIT 1").get(from2?.type ?? null, from2?.id ?? null, link3.id, JSON.stringify(changes));
@@ -46778,6 +46848,8 @@ var relationProposalsOver = /* @__PURE__ */ __name((context) => {
46778
46848
  role: link3.role,
46779
46849
  purpose: link3.purpose,
46780
46850
  position: link3.position ?? null,
46851
+ roleNote: link3.roleNote ?? null,
46852
+ engagement: link3.engagement ?? null,
46781
46853
  startsAt: link3.startsAt ?? null,
46782
46854
  endsAt: link3.endsAt ?? null
46783
46855
  }
@@ -46823,6 +46895,8 @@ var relationProposalsOver = /* @__PURE__ */ __name((context) => {
46823
46895
  const ends = key2 ? void 0 : [thingOf(database, String(payload.from)), thingOf(database, String(payload.to))];
46824
46896
  if (ends?.[0] && ends[1] && payload.role !== void 0)
46825
46897
  checkStoredRole(database, payload.kind ?? "member-of", ends[0].type, ends[1].type, payload.role);
46898
+ if (ends?.[0] && ends[1] && payload.engagement !== void 0)
46899
+ checkEngagement(payload.kind ?? "member-of", ends[0].type, ends[1].type, payload.engagement);
46826
46900
  const link3 = insertLink(context, {
46827
46901
  from: String(key2 ? payload.ref : payload.from),
46828
46902
  to: String(key2 ? payload.project : payload.to),
@@ -46830,6 +46904,8 @@ var relationProposalsOver = /* @__PURE__ */ __name((context) => {
46830
46904
  ...key2 ? { role: "key" } : payload.role === void 0 ? {} : { role: payload.role },
46831
46905
  ...key2 || payload.purpose === void 0 ? {} : { purpose: payload.purpose },
46832
46906
  ...key2 || payload.position === void 0 ? {} : { position: payload.position },
46907
+ ...key2 || payload.roleNote === void 0 ? {} : { roleNote: payload.roleNote },
46908
+ ...key2 || payload.engagement === void 0 ? {} : { engagement: payload.engagement },
46833
46909
  ...key2 || payload.startsAt === void 0 ? {} : { startsAt: payload.startsAt },
46834
46910
  ...key2 || payload.endsAt === void 0 ? {} : { endsAt: payload.endsAt },
46835
46911
  ...proposal.reason === null ? {} : { evidence: proposal.reason },
@@ -46878,6 +46954,13 @@ var spanOf2 = /* @__PURE__ */ __name((startsAt, endsAt) => {
46878
46954
  if (startsAt != null && endsAt != null && endsAt <= startsAt)
46879
46955
  throw new CliError("validation_error", "a relationship ends after it starts");
46880
46956
  }, "spanOf");
46957
+ var METADATA_FIELDS = ["position", "roleNote", "engagement"];
46958
+ var roleNoteOf = /* @__PURE__ */ __name((note2) => {
46959
+ const value = note2.trim();
46960
+ if (!value || value.length > 200)
46961
+ throw new CliError("validation_error", "a role note takes 1\u2013200 characters");
46962
+ return value;
46963
+ }, "roleNoteOf");
46881
46964
  var positionOf = /* @__PURE__ */ __name((position2) => {
46882
46965
  const value = position2.trim();
46883
46966
  if (!value || value.length > 200)
@@ -46892,12 +46975,16 @@ var changesOf = /* @__PURE__ */ __name((input) => {
46892
46975
  changes.purpose = input.purpose === null ? null : purposeOf(input.purpose);
46893
46976
  if (input.position !== void 0)
46894
46977
  changes.position = input.position === null ? null : positionOf(input.position);
46978
+ if (input.roleNote !== void 0)
46979
+ changes.roleNote = input.roleNote === null ? null : roleNoteOf(input.roleNote);
46980
+ if (input.engagement !== void 0)
46981
+ changes.engagement = input.engagement;
46895
46982
  if (input.startsAt !== void 0)
46896
46983
  changes.startsAt = input.startsAt === null ? null : timeOf2(input.startsAt, "a start");
46897
46984
  if (input.endsAt !== void 0)
46898
46985
  changes.endsAt = input.endsAt === null ? null : timeOf2(input.endsAt, "an end");
46899
46986
  if (!Object.keys(changes).length)
46900
- throw new CliError("validation_error", "a relationship update sets a role, a purpose, a position or its dates");
46987
+ throw new CliError("validation_error", "a relationship update sets a role, a role note, an engagement level, a purpose, a position or its dates");
46901
46988
  return changes;
46902
46989
  }, "changesOf");
46903
46990
  var roleOf3 = /* @__PURE__ */ __name((role) => {
@@ -46912,7 +46999,7 @@ var decidedOrigin = /* @__PURE__ */ __name((by) => by === "owner" ? { origin: "o
46912
46999
  provenance: `agent:${by.bot} for the owner: ${by.reason.trim()}`
46913
47000
  }, "decidedOrigin");
46914
47001
 
46915
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/reported-relations.js
47002
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/reported-relations.js
46916
47003
  var KEYED = "kind IN ('member-of', 'related-to', 'reports-to', 'customer-of', 'partner-of') AND to_id IS NOT NULL";
46917
47004
  var metadataOf = /* @__PURE__ */ __name((relation) => relation.metadata && Object.keys(relation.metadata).length ? JSON.stringify(relation.metadata) : null, "metadataOf");
46918
47005
  var syncReportedIn = /* @__PURE__ */ __name((context, key2, relationships, scope3, { source: source2 = "import", by = { bot: key2.provider, kind: "rule" } } = {}) => {
@@ -47019,7 +47106,7 @@ var relationsStoreOver = /* @__PURE__ */ __name((context) => ({
47019
47106
  syncReported: /* @__PURE__ */ __name(async (key2, relationships, scope3, options) => write(context.database, () => syncReportedIn(context, key2, relationships, scope3, options)), "syncReported")
47020
47107
  }), "relationsStoreOver");
47021
47108
 
47022
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/crm.js
47109
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/crm.js
47023
47110
  var PENDING = "crm:pending-relations";
47024
47111
  var PENDING_DAYS = 30;
47025
47112
  var PENDING_MOST = 5e3;
@@ -47497,7 +47584,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
47497
47584
  };
47498
47585
  }, "crmCopiesOver");
47499
47586
 
47500
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/stage-amounts.js
47587
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/stage-amounts.js
47501
47588
  var TABLES3 = { deal: "deals", lead: "leads" };
47502
47589
  var stageAmountsOf = /* @__PURE__ */ __name(({ database }, kind4, stageIds, cutoff) => {
47503
47590
  const rows = database.prepare(`SELECT stage_id, currency, count(*) AS items, coalesce(sum(amount), 0) AS units FROM ${TABLES3[kind4]} WHERE stage_id IN (${stageIds.map(() => "?").join(", ") || "NULL"}) AND deleted_at IS NULL AND (? IS NULL OR created_at >= ?) GROUP BY stage_id, currency ORDER BY currency`).all(...stageIds, cutoff, cutoff);
@@ -47514,7 +47601,7 @@ var stageAmountsOf = /* @__PURE__ */ __name(({ database }, kind4, stageIds, cuto
47514
47601
  });
47515
47602
  }, "stageAmountsOf");
47516
47603
 
47517
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/deals.js
47604
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/deals.js
47518
47605
  var TABLES4 = { deal: "deals", lead: "leads" };
47519
47606
  var itemsSql = /* @__PURE__ */ __name((kind4) => `SELECT d.*, s.name AS stage_name, s.pipeline_id, p.name AS pipeline_name, b.name AS author_name, b.kind AS author_kind, a.provider AS account_provider, a.external_id AS account_external_id FROM ${TABLES4[kind4]} d JOIN pipeline_stages s ON s.id = d.stage_id JOIN pipelines p ON p.id = s.pipeline_id LEFT JOIN bots b ON d.author_type = 'bot' AND b.id = d.author_id LEFT JOIN accounts a ON a.id = d.account_id`, "itemsSql");
47520
47607
  var MAX_STAGES = 30;
@@ -47855,16 +47942,16 @@ var dealsStoreOver = /* @__PURE__ */ __name((context) => {
47855
47942
  };
47856
47943
  }, "dealsStoreOver");
47857
47944
 
47858
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
47945
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
47859
47946
  import { createHash as createHash14, randomBytes as randomBytes2 } from "node:crypto";
47860
47947
 
47861
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/decision-requests.js
47948
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/decision-requests.js
47862
47949
  var DECISION_ACTIONS = ["confirm", "reject", "ask-confirm", "ask-reject", "back", "later"];
47863
47950
  var DECISION_TTL_MS = 72 * 60 * 60 * 1e3;
47864
47951
  var TOKEN2 = /^[A-Za-z0-9_-]{21}[AQgw]$/;
47865
47952
  var isDecisionToken = /* @__PURE__ */ __name((value) => typeof value === "string" && TOKEN2.test(value), "isDecisionToken");
47866
47953
 
47867
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
47954
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
47868
47955
  var digestOf = /* @__PURE__ */ __name((token) => createHash14("sha256").update(token).digest("hex"), "digestOf");
47869
47956
  var newToken = /* @__PURE__ */ __name(() => randomBytes2(16).toString("base64url"), "newToken");
47870
47957
  var requestOf = /* @__PURE__ */ __name((row2) => ({
@@ -47960,7 +48047,7 @@ var decisionRequestStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
47960
48047
  };
47961
48048
  }, "decisionRequestStoreOver");
47962
48049
 
47963
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
48050
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
47964
48051
  var NOTE_FIELDS = [
47965
48052
  "text",
47966
48053
  "exact",
@@ -48396,7 +48483,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
48396
48483
  };
48397
48484
  }, "noteSearchOver");
48398
48485
 
48399
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
48486
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
48400
48487
  var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
48401
48488
  var inEventAccounts = /* @__PURE__ */ __name((event2) => searchableCopy(event2, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
48402
48489
  var EVENT_CORPUS = {
@@ -48528,7 +48615,7 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
48528
48615
  };
48529
48616
  }, "eventSearchOver");
48530
48617
 
48531
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/domain/moment.js
48618
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/domain/moment.js
48532
48619
  var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
48533
48620
  try {
48534
48621
  return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
@@ -48540,7 +48627,7 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
48540
48627
  }
48541
48628
  }, "calendarMoment");
48542
48629
 
48543
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
48630
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
48544
48631
  var NAMED4 = "SELECT f.*, b.name AS author_name, b.kind AS author_kind FROM facts f LEFT JOIN bots b ON f.author_type = 'bot' AND b.id = f.author_id";
48545
48632
  var iso12 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
48546
48633
  var oneOf5 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -48680,20 +48767,20 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
48680
48767
  const ref3 = `fact:${row2.id}`;
48681
48768
  assertMayWithdraw({ id: ref3, proposedBy: { type: "unknown" }, proposed: false }, by);
48682
48769
  write(database, () => {
48683
- const current = database.prepare("SELECT * FROM facts WHERE id = ?").get(Number(row2.id));
48684
- if (current.status !== "accepted")
48685
- throw new CliError("validation_error", `only an accepted fact can be revoked; ${ref3} is ${String(current.status)}`, { reason: "fact.not-accepted" });
48686
- if (current.author_type === "person")
48770
+ const current2 = database.prepare("SELECT * FROM facts WHERE id = ?").get(Number(row2.id));
48771
+ if (current2.status !== "accepted")
48772
+ throw new CliError("validation_error", `only an accepted fact can be revoked; ${ref3} is ${String(current2.status)}`, { reason: "fact.not-accepted" });
48773
+ if (current2.author_type === "person")
48687
48774
  throw new CliError("validation_error", `${ref3} is the owner's own fact, never proposed; correct it with a fact that supersedes it, or remove it`, { reason: "fact.owner-written" });
48688
- if (current.supersedes_id != null)
48689
- throw new CliError("validation_error", `${ref3} corrects fact:${current.supersedes_id}, which stopped holding when ${ref3} was accepted; remove it or correct it with another fact instead`, { reason: "fact.revoke-correction" });
48775
+ if (current2.supersedes_id != null)
48776
+ throw new CliError("validation_error", `${ref3} corrects fact:${current2.supersedes_id}, which stopped holding when ${ref3} was accepted; remove it or correct it with another fact instead`, { reason: "fact.revoke-correction" });
48690
48777
  const at2 = now2();
48691
- const { decision, history, ...metadata3 } = current.metadata == null ? {} : JSON.parse(String(current.metadata));
48778
+ const { decision, history, ...metadata3 } = current2.metadata == null ? {} : JSON.parse(String(current2.metadata));
48692
48779
  const step = {
48693
48780
  step: "revoked",
48694
48781
  by: "owner",
48695
48782
  at: iso12(at2),
48696
- confirmedBy: { type: current.confirmed_by_type, id: String(current.confirmed_by_id) },
48783
+ confirmedBy: { type: current2.confirmed_by_type, id: String(current2.confirmed_by_id) },
48697
48784
  ...decision === void 0 ? {} : { decision },
48698
48785
  ...reason?.trim() ? { reason: reason.trim() } : {}
48699
48786
  };
@@ -48760,7 +48847,7 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
48760
48847
  };
48761
48848
  }, "factsStoreOver");
48762
48849
 
48763
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
48850
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
48764
48851
  var invalid5 = /* @__PURE__ */ __name((message3) => {
48765
48852
  throw new CliError("validation_error", message3);
48766
48853
  }, "invalid");
@@ -48864,7 +48951,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind4) => {
48864
48951
  return { snapshot: snapshot2, snapshotParts, previous, outcomes, create };
48865
48952
  }, "findingsCoreOver");
48866
48953
 
48867
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
48954
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
48868
48955
  var stale = /* @__PURE__ */ __name(() => {
48869
48956
  throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
48870
48957
  reason: "evidence-findings.stale"
@@ -49045,7 +49132,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
49045
49132
  };
49046
49133
  }, "evidenceFindingsStoreOver");
49047
49134
 
49048
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
49135
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
49049
49136
  var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
49050
49137
  var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
49051
49138
  rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
@@ -49098,7 +49185,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
49098
49185
  }, "forPerson")
49099
49186
  }), "involvementStoreOver");
49100
49187
 
49101
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/labelled.js
49188
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/labelled.js
49102
49189
  var LABELLED = {
49103
49190
  note: "note",
49104
49191
  document: "document",
@@ -49110,7 +49197,7 @@ var LABELLED = {
49110
49197
  account: "folder"
49111
49198
  };
49112
49199
 
49113
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
49200
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
49114
49201
  import { createHash as createHash15 } from "node:crypto";
49115
49202
  var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
49116
49203
  var id = /* @__PURE__ */ __name((value) => {
@@ -49196,7 +49283,7 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
49196
49283
  };
49197
49284
  }, "meetingProjectsStoreOver");
49198
49285
 
49199
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
49286
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
49200
49287
  var ORGANIZATIONS_QUERY = {
49201
49288
  entity: "organization",
49202
49289
  backend: "sql",
@@ -49237,7 +49324,7 @@ var REMINDERS_QUERY = {
49237
49324
  })
49238
49325
  };
49239
49326
 
49240
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/organizations.js
49327
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/organizations.js
49241
49328
  var organizationOf = /* @__PURE__ */ __name((row2) => ({
49242
49329
  id: String(row2.id),
49243
49330
  ref: `organization:${row2.id}`,
@@ -49279,7 +49366,7 @@ var organizationsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) =>
49279
49366
  }), "setOwnOrganization")
49280
49367
  }), "organizationsStoreOver");
49281
49368
 
49282
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-list.js
49369
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-list.js
49283
49370
  var KINDS2 = RELATION_KINDS.map(linkKind).join(", ");
49284
49371
  var typeOfRef = /* @__PURE__ */ __name((column2) => `substr(${column2}, 1, instr(${column2}, ':') - 1)`, "typeOfRef");
49285
49372
  var idOfRef = /* @__PURE__ */ __name((column2) => `CAST(substr(${column2}, instr(${column2}, ':') + 1) AS INTEGER)`, "idOfRef");
@@ -49394,6 +49481,8 @@ var relationListOver = /* @__PURE__ */ __name((context) => {
49394
49481
  confidenceCategory: "weak",
49395
49482
  standing: "proposed",
49396
49483
  position: payload.position ?? null,
49484
+ roleNote: payload.roleNote ?? null,
49485
+ engagement: payload.engagement ?? null,
49397
49486
  startsAt: iso16(payload.startsAt),
49398
49487
  endsAt: iso16(payload.endsAt),
49399
49488
  createdAt: action.createdAt,
@@ -49404,13 +49493,13 @@ var relationListOver = /* @__PURE__ */ __name((context) => {
49404
49493
  __name(proposalItem, "proposalItem");
49405
49494
  }, "relationListOver");
49406
49495
 
49407
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-reads.js
49496
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-reads.js
49408
49497
  var relationReadsOver = /* @__PURE__ */ __name((context) => ({
49409
49498
  ...relationListOver(context),
49410
49499
  ...relationRolesOver(context)
49411
49500
  }), "relationReadsOver");
49412
49501
 
49413
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review.js
49502
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review.js
49414
49503
  var TABLES5 = { memory: "memories", fact: "facts" };
49415
49504
  var RETIRED = /* @__PURE__ */ new Set(["superseded", "reversed", "rejected", "stale"]);
49416
49505
  var DEFAULT_LIMIT = 500;
@@ -49433,14 +49522,14 @@ var sourceReviewOver = /* @__PURE__ */ __name((context) => {
49433
49522
  }, "statusOf");
49434
49523
  const replacementOf = /* @__PURE__ */ __name((target) => {
49435
49524
  const next = database.prepare(`SELECT id FROM ${TABLES5[target.type]} t WHERE t.supersedes_id = ? AND ${holdingSql("t", target.type)} ORDER BY t.id DESC LIMIT 1`);
49436
- let current = target.id;
49525
+ let current2 = target.id;
49437
49526
  for (let hop = 0; hop < 20; hop++) {
49438
- const found2 = next.get(current);
49527
+ const found2 = next.get(current2);
49439
49528
  if (!found2)
49440
49529
  break;
49441
- current = Number(found2.id);
49530
+ current2 = Number(found2.id);
49442
49531
  }
49443
- return current === target.id ? void 0 : `${target.type}:${current}`;
49532
+ return current2 === target.id ? void 0 : `${target.type}:${current2}`;
49444
49533
  }, "replacementOf");
49445
49534
  const judged = /* @__PURE__ */ __name((link3, thing, now3) => {
49446
49535
  const stored4 = storedEvidenceMetadata(link3.metadata);
@@ -49653,16 +49742,16 @@ var sourceReviewStoreOver = /* @__PURE__ */ __name((context) => {
49653
49742
  };
49654
49743
  }, "sourceReviewStoreOver");
49655
49744
 
49656
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
49745
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
49657
49746
  import { createHash as createHash18 } from "node:crypto";
49658
49747
 
49659
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
49748
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
49660
49749
  import { createHash as createHash17 } from "node:crypto";
49661
49750
 
49662
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
49751
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
49663
49752
  import { createHash as createHash16 } from "node:crypto";
49664
49753
 
49665
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
49754
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
49666
49755
  var consolidationId = /* @__PURE__ */ __name((value, field4) => {
49667
49756
  if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
49668
49757
  throw new CliError("validation_error", `${field4} must be a positive canonical tag id`);
@@ -49713,7 +49802,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
49713
49802
  return input;
49714
49803
  }, "consolidationApplyInput");
49715
49804
 
49716
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
49805
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
49717
49806
  var receiptOf = /* @__PURE__ */ __name((row2) => ({
49718
49807
  id: String(row2.id),
49719
49808
  sourceId: String(row2.source_id),
@@ -49788,7 +49877,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
49788
49877
  }, { beforeCommit: check3 });
49789
49878
  }, "applyTagConsolidation");
49790
49879
 
49791
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
49880
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
49792
49881
  var selections = [
49793
49882
  ["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
49794
49883
  ["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
@@ -49810,17 +49899,17 @@ var previewTagConsolidation = /* @__PURE__ */ __name((context, catalog, options)
49810
49899
  const { source: source2, survivor, maxRows, maxReadBytes, limit } = consolidationInput(options);
49811
49900
  cancelled(options);
49812
49901
  return read(context.database, () => {
49813
- const current = catalog();
49814
- if (current.fingerprint !== options.expectedVocabularyFingerprint)
49902
+ const current2 = catalog();
49903
+ if (current2.fingerprint !== options.expectedVocabularyFingerprint)
49815
49904
  throw new CliError("configuration_error", "vocabulary changed since the preview", { reason: "vocabulary.stale" });
49816
49905
  if (tagCanonicalId(context.database, source2) === tagCanonicalId(context.database, survivor))
49817
49906
  throw new CliError("validation_error", "sourceId and survivorId already resolve to the same canonical tag");
49818
- const selected = [source2, survivor].map((id2) => current.entries.find((entry2) => entry2.id === String(id2) && entry2.kind !== "project"));
49907
+ const selected = [source2, survivor].map((id2) => current2.entries.find((entry2) => entry2.id === String(id2) && entry2.kind !== "project"));
49819
49908
  if (selected.some((entry2) => !entry2))
49820
49909
  throw new CliError("not_found", "a selected canonical tag is unavailable");
49821
49910
  if (selected.some((entry2) => entry2?.kind !== "tag"))
49822
49911
  throw new CliError("validation_error", "consolidation preview supports tags only");
49823
- return previewRows(context, options, source2, survivor, maxRows, maxReadBytes, limit, current);
49912
+ return previewRows(context, options, source2, survivor, maxRows, maxReadBytes, limit, current2);
49824
49913
  });
49825
49914
  }, "previewTagConsolidation");
49826
49915
  var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, maxRows, maxReadBytes, limit, catalog) => {
@@ -49932,7 +50021,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
49932
50021
  };
49933
50022
  }, "previewRows");
49934
50023
 
49935
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
50024
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
49936
50025
  var kinds = ["project", "tag", "topic"];
49937
50026
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
49938
50027
  if (signal?.aborted)
@@ -50049,20 +50138,20 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
50049
50138
  const parts2 = expected?.match(/^v1:(all|project|tag|topic):(all|personal|work):[a-f0-9]{64}$/);
50050
50139
  if (expected !== void 0 && !parts2)
50051
50140
  throw new CliError("validation_error", "invalid vocabulary preview fingerprint");
50052
- const current = catalog({
50141
+ const current2 = catalog({
50053
50142
  ...parts2?.[1] && parts2[1] !== "all" ? { kind: parts2[1] } : {},
50054
50143
  ...parts2?.[2] && parts2[2] !== "all" ? { scope: parts2[2] } : {}
50055
50144
  });
50056
- if (expected !== void 0 && expected !== current.fingerprint)
50145
+ if (expected !== void 0 && expected !== current2.fingerprint)
50057
50146
  throw new CliError("configuration_error", "vocabulary changed since the preview", { reason: "vocabulary.stale" });
50058
- return parts2 && (parts2[1] !== "all" || parts2[2] !== "all") ? catalog() : current;
50147
+ return parts2 && (parts2[1] !== "all" || parts2[2] !== "all") ? catalog() : current2;
50059
50148
  }, "writable");
50060
- const targetEntry = /* @__PURE__ */ __name((current, target) => {
50149
+ const targetEntry = /* @__PURE__ */ __name((current2, target) => {
50061
50150
  if (!target || typeof target !== "object")
50062
50151
  throw new CliError("validation_error", "a vocabulary target is required");
50063
50152
  kindOf3(target.kind);
50064
50153
  idOf2(target.id);
50065
- const entry2 = current.entries.find((value) => value.kind === target.kind && value.id === target.id);
50154
+ const entry2 = current2.entries.find((value) => value.kind === target.kind && value.id === target.id);
50066
50155
  if (!entry2)
50067
50156
  throw new CliError("not_found", "the vocabulary target is unavailable");
50068
50157
  return entry2;
@@ -50076,10 +50165,10 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
50076
50165
  const limit = options.limit ?? 20;
50077
50166
  if (!Number.isFinite(minSimilarity) || minSimilarity < 0.65 || minSimilarity > 1 || !Number.isSafeInteger(maxComparisons) || maxComparisons < 1 || maxComparisons > 1e5 || !Number.isSafeInteger(limit) || limit < 1 || limit > 200)
50078
50167
  throw new CliError("validation_error", "audit takes similarity 0.65\u20131, 1\u2013100000 comparisons and 1\u2013200 pairs");
50079
- const current = catalog(options);
50168
+ const current2 = catalog(options);
50080
50169
  const report = {
50081
50170
  pairs: [],
50082
- fingerprint: current.fingerprint,
50171
+ fingerprint: current2.fingerprint,
50083
50172
  comparisons: 0,
50084
50173
  complete: true,
50085
50174
  semantic: "not-requested"
@@ -50095,9 +50184,9 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
50095
50184
  ...entry2.key ? [entry2.key] : [],
50096
50185
  ...entry2.aliases.map((alias2) => alias2.name)
50097
50186
  ], "names");
50098
- for (let left = 0; left < current.entries.length; left++) {
50099
- const a = current.entries[left];
50100
- for (const b of current.entries.slice(left + 1)) {
50187
+ for (let left = 0; left < current2.entries.length; left++) {
50188
+ const a = current2.entries[left];
50189
+ for (const b of current2.entries.slice(left + 1)) {
50101
50190
  if (a.kind === "project" !== (b.kind === "project"))
50102
50191
  continue;
50103
50192
  let similarity = 0;
@@ -50121,16 +50210,16 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
50121
50210
  }), "auditVocabulary"),
50122
50211
  resolveVocabulary: /* @__PURE__ */ __name(async (name, options) => {
50123
50212
  normalizeVocabularyName(name);
50124
- const current = catalog(options);
50125
- const found2 = matches2(current.entries, name);
50126
- return { query: name, matches: found2, ambiguous: found2.length > 1, fingerprint: current.fingerprint };
50213
+ const current2 = catalog(options);
50214
+ const found2 = matches2(current2.entries, name);
50215
+ return { query: name, matches: found2, ambiguous: found2.length > 1, fingerprint: current2.fingerprint };
50127
50216
  }, "resolveVocabulary"),
50128
50217
  addVocabularyAlias: /* @__PURE__ */ __name(async (target, name, options = {}) => {
50129
50218
  const normalized = normalizeVocabularyName(name);
50130
50219
  return write(database, () => {
50131
- const current = writable(options);
50132
- const entry2 = targetEntry(current, target);
50133
- const peers = current.entries.filter((value) => value.kind === "project" === (target.kind === "project"));
50220
+ const current2 = writable(options);
50221
+ const entry2 = targetEntry(current2, target);
50222
+ const peers = current2.entries.filter((value) => value.kind === "project" === (target.kind === "project"));
50134
50223
  const conflicts = matches2(peers, name).filter((value) => value.id !== entry2.id || value.kind !== entry2.kind);
50135
50224
  if (conflicts.length)
50136
50225
  throw new CliError("configuration_error", "this alias already names another canonical record", {
@@ -50151,8 +50240,8 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
50151
50240
  });
50152
50241
  }, "addVocabularyAlias"),
50153
50242
  removeVocabularyAlias: /* @__PURE__ */ __name(async (target, aliasId, options = {}) => write(database, () => {
50154
- const current = writable(options);
50155
- const entry2 = targetEntry(current, target);
50243
+ const current2 = writable(options);
50244
+ const entry2 = targetEntry(current2, target);
50156
50245
  if (entry2.aliases.some((alias2) => alias2.id === aliasId && alias2.retained))
50157
50246
  throw new CliError("validation_error", "aliasId names a retained tag name; its original record cannot be removed as an alias");
50158
50247
  idOf2(aliasId);
@@ -50167,8 +50256,8 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
50167
50256
  const kind4 = options.kind ?? "tag";
50168
50257
  if (kind4 !== "tag" && kind4 !== "topic")
50169
50258
  throw new CliError("validation_error", "choose tag or topic");
50170
- const current = catalog({ ...options, kind: void 0, scope: void 0 });
50171
- const entries = current.entries.filter((entry2) => entry2.kind !== "project");
50259
+ const current2 = catalog({ ...options, kind: void 0, scope: void 0 });
50260
+ const entries = current2.entries.filter((entry2) => entry2.kind !== "project");
50172
50261
  const found2 = matches2(entries, name);
50173
50262
  if (found2.length > 1)
50174
50263
  throw new CliError("configuration_error", "the label resolves ambiguously");
@@ -50189,14 +50278,14 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
50189
50278
  disposition: existing2 ? "reuse" : suggestions.length ? "review" : "create",
50190
50279
  existing: existing2,
50191
50280
  suggestions,
50192
- fingerprint: current.fingerprint,
50281
+ fingerprint: current2.fingerprint,
50193
50282
  semantic: "not-requested"
50194
50283
  };
50195
50284
  }), "tagPreflight")
50196
50285
  };
50197
50286
  }, "vocabularyStoreOver");
50198
50287
 
50199
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
50288
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
50200
50289
  var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
50201
50290
  var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
50202
50291
  var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
@@ -50368,6 +50457,8 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
50368
50457
  checkEnds(input.kind, from2.type, to.type);
50369
50458
  if (input.role !== void 0)
50370
50459
  checkStoredRole(database, input.kind, from2.type, to.type, input.role.trim());
50460
+ if (input.engagement !== void 0)
50461
+ checkEngagement(input.kind, from2.type, to.type, input.engagement);
50371
50462
  let ends = { from: input.from, to: input.to };
50372
50463
  if (isSymmetric(input.kind) && to.id < from2.id)
50373
50464
  [from2, to, ends] = [to, from2, { from: input.to, to: input.from }];
@@ -50743,7 +50834,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
50743
50834
  return key2.padEnd(3, "X");
50744
50835
  }, "projectKey");
50745
50836
 
50746
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
50837
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
50747
50838
  var DAY6 = 864e5;
50748
50839
  var SETTING4 = "logs_pruned_at";
50749
50840
  var LOG_RETENTION = { agentActionsMs: 90 * DAY6, botUpdatePayloadsMs: 30 * DAY6 };
@@ -50770,7 +50861,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
50770
50861
  };
50771
50862
  }, "logPruner");
50772
50863
 
50773
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/mail/findings.js
50864
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/mail/findings.js
50774
50865
  var MAIL_FINDINGS_PER_RUN = 30;
50775
50866
  var MAIL_FINDINGS_PER_SENDER = 5;
50776
50867
  var invalid7 = /* @__PURE__ */ __name((message3) => {
@@ -51146,7 +51237,7 @@ var checkMailFindings = /* @__PURE__ */ __name((input) => {
51146
51237
  }, "checkMailFindings");
51147
51238
  var mailFindingFingerprint = /* @__PURE__ */ __name(({ id: _id, ...finding }) => findingHash(finding), "mailFindingFingerprint");
51148
51239
 
51149
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/mail/score.js
51240
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/mail/score.js
51150
51241
  var import_disposable_email_domains_js = __toESM(require_dist(), 1);
51151
51242
  var import_tldts = __toESM(require_cjs(), 1);
51152
51243
  var WEIGHTS = {
@@ -51279,7 +51370,7 @@ var scoreGroup = /* @__PURE__ */ __name((items, context) => {
51279
51370
  return { score: kept2.reduce((sum, signal) => sum + WEIGHTS[signal], 0), signals: kept2 };
51280
51371
  }, "scoreGroup");
51281
51372
 
51282
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/orders.js
51373
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/orders.js
51283
51374
  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";
51284
51375
  var orderOperationsOver = /* @__PURE__ */ __name((context) => {
51285
51376
  const { database, now: now2 } = context;
@@ -51487,7 +51578,7 @@ var ordersStoreOver = /* @__PURE__ */ __name((context) => {
51487
51578
  };
51488
51579
  }, "ordersStoreOver");
51489
51580
 
51490
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-findings.js
51581
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-findings.js
51491
51582
  var stale2 = /* @__PURE__ */ __name(() => {
51492
51583
  throw new CliError("validation_error", "mail findings cite mail that changed since it was read; stage a new batch", {
51493
51584
  reason: "mail-findings.stale"
@@ -51944,7 +52035,7 @@ ${evidence.join("\n")}`, agent);
51944
52035
  };
51945
52036
  }, "mailFindingsStoreOver");
51946
52037
 
51947
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
52038
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
51948
52039
  var stale3 = /* @__PURE__ */ __name(() => {
51949
52040
  throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
51950
52041
  reason: "meeting-findings.stale"
@@ -52112,7 +52203,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
52112
52203
  };
52113
52204
  }, "meetingFindingsStoreOver");
52114
52205
 
52115
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
52206
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
52116
52207
  var RANK_BATCH = 512;
52117
52208
  var LIVE5 = "FROM chunks k JOIN meeting_transcripts t ON k.chunkable_type = 'meeting_transcript' AND t.id = k.chunkable_id JOIN meetings m ON m.id = t.meeting_id WHERE m.account_id = ? AND m.deleted_at IS NULL AND t.deleted_at IS NULL AND t.superseded_at IS NULL";
52118
52209
  var limitOf2 = /* @__PURE__ */ __name((value, name, max = 1e3) => {
@@ -52200,8 +52291,8 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
52200
52291
  throw new CliError("validation_error", "Vector save exceeds its batch or 16 MiB payload budget");
52201
52292
  return write(context.database, () => {
52202
52293
  const unique2 = new Map(rows.map((row2) => [row2.hash, row2]));
52203
- const current = context.database.prepare(`SELECT DISTINCT k.content_hash ${LIVE5} AND k.content_hash IN (SELECT value FROM json_each(?))`).all(input.accountId, JSON.stringify([...unique2.keys()]));
52204
- const available = new Set(current.map((row2) => String(row2.content_hash)));
52294
+ const current2 = context.database.prepare(`SELECT DISTINCT k.content_hash ${LIVE5} AND k.content_hash IN (SELECT value FROM json_each(?))`).all(input.accountId, JSON.stringify([...unique2.keys()]));
52295
+ const available = new Set(current2.map((row2) => String(row2.content_hash)));
52205
52296
  const selected = [...unique2.values()].filter((row2) => available.has(row2.hash) && !context.database.prepare("SELECT 1 FROM embeddings WHERE model=? AND content_hash=?").get(model, row2.hash));
52206
52297
  input.signal?.throwIfAborted();
52207
52298
  saveVectors(context, model, dims, selected);
@@ -52383,7 +52474,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
52383
52474
  }
52384
52475
  }), "meetingVectorsOver");
52385
52476
 
52386
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
52477
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
52387
52478
  var OTHER_SOURCES = ["document", "note", "email"];
52388
52479
  var TEXTS = {
52389
52480
  document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
@@ -52484,7 +52575,7 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
52484
52575
  };
52485
52576
  }, "sourceMentionStoreOver");
52486
52577
 
52487
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/money-transactions.js
52578
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/money-transactions.js
52488
52579
  var TRANSACTIONS = "SELECT t.*, w.name AS wallet_name, b.name AS author_name, b.kind AS author_kind, (SELECT coalesce(sum(amount), 0) FROM transaction_splits WHERE transaction_id = t.id) AS split FROM financial_transactions t JOIN financial_accounts w ON w.id = t.financial_account_id LEFT JOIN bots b ON t.author_type = 'bot' AND b.id = t.author_id";
52489
52580
  var MAX_SPLITS = 100;
52490
52581
  var transactionOperationsOver = /* @__PURE__ */ __name((context) => {
@@ -52715,11 +52806,11 @@ var transactionsStoreOver = /* @__PURE__ */ __name((context) => {
52715
52806
  };
52716
52807
  }, "transactionsStoreOver");
52717
52808
 
52718
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
52809
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
52719
52810
  import { accessSync, constants, existsSync, mkdirSync as mkdirSync2, statSync, writeFileSync as writeFileSync2 } from "node:fs";
52720
52811
  import { dirname as dirname2 } from "node:path";
52721
52812
 
52722
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
52813
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
52723
52814
  import { readFileSync as readFileSync3 } from "node:fs";
52724
52815
  var CLIENTS_SETTING = "clients";
52725
52816
  var coreVersion = (() => {
@@ -52750,13 +52841,16 @@ var storeClients = /* @__PURE__ */ __name((database) => {
52750
52841
  return [];
52751
52842
  }
52752
52843
  }, "storeClients");
52753
- var recordClient = /* @__PURE__ */ __name((database, { command, version, speaks }, now2) => {
52844
+ var clientRecorded = /* @__PURE__ */ __name((database, { command, version, speaks }, now2) => {
52754
52845
  if (!hasSettings(database))
52846
+ return true;
52847
+ const same = storeClients(database).find((one2) => one2.command === command);
52848
+ return same !== void 0 && same.version === version && same.core === coreVersion && same.speaks === speaks && now2 - same.seenAt < 864e5;
52849
+ }, "clientRecorded");
52850
+ var recordClient = /* @__PURE__ */ __name((database, { command, version, speaks }, now2) => {
52851
+ if (clientRecorded(database, { command, version, speaks }, now2))
52755
52852
  return;
52756
52853
  const stored4 = storeClients(database);
52757
- const same = stored4.find((one2) => one2.command === command);
52758
- if (same && same.version === version && same.core === coreVersion && same.speaks === speaks && now2 - same.seenAt < 864e5)
52759
- return;
52760
52854
  const entry2 = { command, version, core: coreVersion, speaks, seenAt: now2 };
52761
52855
  database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(CLIENTS_SETTING, JSON.stringify([...stored4.filter((one2) => one2.command !== command), entry2]), now2);
52762
52856
  }, "recordClient");
@@ -52777,7 +52871,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
52777
52871
  return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
52778
52872
  }, "refusalAdvice");
52779
52873
 
52780
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
52874
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
52781
52875
  var GENERATED = [
52782
52876
  {
52783
52877
  "name": "20261010184427_initial",
@@ -54012,7 +54106,7 @@ WHERE json_type(params, '$.selection') = 'object';`
54012
54106
  }
54013
54107
  ];
54014
54108
 
54015
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/rollback-copy.js
54109
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/rollback-copy.js
54016
54110
  import { mkdirSync, rmSync, statfsSync, writeFileSync } from "node:fs";
54017
54111
  import { basename, dirname, join as join2, parse } from "node:path";
54018
54112
  var DERIVED = /(_fts|_words|_stems|_trigrams|_pending)$|^(embeddings|chunks|chunk_messages|mentions|involvements|search_terms)$|^vector_index/;
@@ -54200,7 +54294,7 @@ var restoreRows = /* @__PURE__ */ __name((database, table) => {
54200
54294
  const from2 = [...rowid ? [ROWID] : [], ...columns.map(quote2)].join(", ");
54201
54295
  database.exec(`INSERT INTO main.${quote2(table)} (${into}) SELECT ${from2} FROM ${SCHEMA}.${quote2(table)}`);
54202
54296
  }, "restoreRows");
54203
- var rollBack = /* @__PURE__ */ __name((database, path) => {
54297
+ var rollBack2 = /* @__PURE__ */ __name((database, path) => {
54204
54298
  attach(database, path);
54205
54299
  let result;
54206
54300
  try {
@@ -54245,7 +54339,7 @@ var rollBack = /* @__PURE__ */ __name((database, path) => {
54245
54339
  return { ...result, foreignKeyViolations };
54246
54340
  }, "rollBack");
54247
54341
 
54248
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
54342
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
54249
54343
  var V31_TABLES = [
54250
54344
  "accounts",
54251
54345
  "account_identities",
@@ -54402,7 +54496,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
54402
54496
  return migrations;
54403
54497
  }, "generatedMigrations");
54404
54498
 
54405
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/migrations.js
54499
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/migrations.js
54406
54500
  var MIGRATIONS = generatedMigrations();
54407
54501
  var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
54408
54502
  version INTEGER PRIMARY KEY,
@@ -54416,6 +54510,24 @@ var fileState = /* @__PURE__ */ __name((database) => {
54416
54510
  const row2 = database.prepare("SELECT version, min_compatible FROM schema_migrations ORDER BY version DESC LIMIT 1").get();
54417
54511
  return { version: Number(row2?.version ?? 0), minCompatible: Number(row2?.min_compatible ?? 0) };
54418
54512
  }, "fileState");
54513
+ var refuseForeignOrNewer = /* @__PURE__ */ __name((database, file, { ours, ownTable, command }) => {
54514
+ if (file.version > 0 && ownTable !== null && !hasTable(database, ownTable)) {
54515
+ throw new CliError("configuration_error", `the message store was written by another, incompatible tool (schema ${file.version} by its own numbering, with no meetings table) \u2014 this tool will not open or change it; move it aside to start a new store`);
54516
+ }
54517
+ if (file.version > ours && file.minCompatible > ours) {
54518
+ throw new CliError("configuration_error", `the message store was written by a newer version (schema ${file.version}, needs at least ${file.minCompatible}; this one speaks ${ours}) \u2014 ${refusalAdvice(storeClients(database), command, file.version)}`);
54519
+ }
54520
+ }, "refuseForeignOrNewer");
54521
+ var current = /* @__PURE__ */ __name((database, ours, client, now2) => {
54522
+ if (!hasTable(database, "schema_migrations"))
54523
+ return void 0;
54524
+ const file = fileState(database);
54525
+ if (file.version < ours)
54526
+ return void 0;
54527
+ if (client && !clientRecorded(database, { ...client, speaks: ours }, now2()))
54528
+ return void 0;
54529
+ return file;
54530
+ }, "current");
54419
54531
  var copyBeforeBreaking = /* @__PURE__ */ __name((database, migrations, { ownTable, now: now2 }, options) => {
54420
54532
  if (!hasTable(database, "schema_migrations"))
54421
54533
  return void 0;
@@ -54437,8 +54549,13 @@ var copyBeforeBreaking = /* @__PURE__ */ __name((database, migrations, { ownTabl
54437
54549
  }, "copyBeforeBreaking");
54438
54550
  var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now: now2 = Date.now, command, version, ownTable = OWN_TABLE, rollback } = {}) => {
54439
54551
  const ours = latest3(migrations);
54552
+ const settled = current(database, ours, command && version ? { command, version } : void 0, now2);
54553
+ if (settled) {
54554
+ refuseForeignOrNewer(database, settled, { ours, ownTable, command });
54555
+ return void 0;
54556
+ }
54440
54557
  let copy = rollback ? copyBeforeBreaking(database, migrations, { ownTable, now: now2 }, rollback) : void 0;
54441
- database.exec("BEGIN IMMEDIATE");
54558
+ beginImmediate(database);
54442
54559
  try {
54443
54560
  database.exec(HISTORY);
54444
54561
  const file = fileState(database);
@@ -54446,12 +54563,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
54446
54563
  discardRollbackCopy(copy);
54447
54564
  copy = void 0;
54448
54565
  }
54449
- if (file.version > 0 && ownTable !== null && !hasTable(database, ownTable)) {
54450
- throw new CliError("configuration_error", `the message store was written by another, incompatible tool (schema ${file.version} by its own numbering, with no meetings table) \u2014 this tool will not open or change it; move it aside to start a new store`);
54451
- }
54452
- if (file.version > ours && file.minCompatible > ours) {
54453
- throw new CliError("configuration_error", `the message store was written by a newer version (schema ${file.version}, needs at least ${file.minCompatible}; this one speaks ${ours}) \u2014 ${refusalAdvice(storeClients(database), command, file.version)}`);
54454
- }
54566
+ refuseForeignOrNewer(database, file, { ours, ownTable, command });
54455
54567
  const raisedTo = migrations.filter((migration) => migration.version > file.version).reduce((highest, { minCompatible }) => Math.max(highest, minCompatible), file.minCompatible);
54456
54568
  const notice = file.version > 0 && raisedTo > file.minCompatible ? lockedOutNotice(storeClients(database), {
54457
54569
  ...command ? { command } : {},
@@ -54473,7 +54585,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
54473
54585
  database.exec("COMMIT");
54474
54586
  return notice;
54475
54587
  } catch (error) {
54476
- database.exec("ROLLBACK");
54588
+ rollBack(database);
54477
54589
  if (error instanceof CliError)
54478
54590
  throw error;
54479
54591
  const cause = error instanceof Error ? error.message : String(error);
@@ -54481,7 +54593,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
54481
54593
  }
54482
54594
  }, "migrate");
54483
54595
 
54484
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
54596
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
54485
54597
  var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
54486
54598
  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 ?");
54487
54599
  if (pending.get(0, 1) === void 0)
@@ -54503,7 +54615,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
54503
54615
  }
54504
54616
  }, "fillJoinKeys");
54505
54617
 
54506
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
54618
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
54507
54619
  var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
54508
54620
  refuseOwnerStoreInTests(path);
54509
54621
  const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
@@ -54517,8 +54629,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
54517
54629
  }, "openSqlite");
54518
54630
  var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
54519
54631
  quietSqliteWarning();
54520
- const { drizzle } = await import("./node-R3OFASC5.js");
54521
- const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-DYHDZJ5A.js");
54632
+ const { drizzle } = await import("./node-QYL4B7JS.js");
54633
+ const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-ESTT2OCF.js");
54522
54634
  const client = await nodeClient(path, { readOnly });
54523
54635
  try {
54524
54636
  return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
@@ -54528,8 +54640,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
54528
54640
  }
54529
54641
  }, "openUnderNode");
54530
54642
  var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
54531
- const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-WKIZJNTG.js");
54532
- const { drizzle } = await import("./bun-KKLPQTG5.js");
54643
+ const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-5RZTFU2Q.js");
54644
+ const { drizzle } = await import("./bun-OUFOAYV4.js");
54533
54645
  const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
54534
54646
  try {
54535
54647
  return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
@@ -54539,7 +54651,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
54539
54651
  }
54540
54652
  }, "openUnderBun");
54541
54653
 
54542
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-facts.js
54654
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-facts.js
54543
54655
  var PAYMENT_FACTS_TO_MOVE = "payment_facts_to_move";
54544
54656
  var paymentOf = /* @__PURE__ */ __name((metadata3) => {
54545
54657
  try {
@@ -54607,7 +54719,7 @@ var movePaymentFacts = /* @__PURE__ */ __name((context) => {
54607
54719
  });
54608
54720
  }, "movePaymentFacts");
54609
54721
 
54610
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
54722
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
54611
54723
  var readCompatibility = /* @__PURE__ */ __name((database, command) => {
54612
54724
  const ours = MIGRATIONS.at(-1)?.version ?? 0;
54613
54725
  if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
@@ -54625,7 +54737,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
54625
54737
  throw new CliError("configuration_error", `The store needs schema ${MIGRATIONS.at(-1)?.version ?? 0} maintenance before a read-only open`);
54626
54738
  }, "assertReadCompatible");
54627
54739
 
54628
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/suggested-links.js
54740
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/suggested-links.js
54629
54741
  var SUGGESTED_LINKS_TO_MOVE = "suggested_links_to_move";
54630
54742
  var proposerOf2 = /* @__PURE__ */ __name((provenance2) => {
54631
54743
  if (provenance2?.startsWith("rule:"))
@@ -54671,7 +54783,7 @@ var moveSuggestedLinks = /* @__PURE__ */ __name((database, now2) => {
54671
54783
  });
54672
54784
  }, "moveSuggestedLinks");
54673
54785
 
54674
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/test-accounts.js
54786
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/test-accounts.js
54675
54787
  var TEST_ACCOUNTS_TO_PURGE = "test_accounts_to_purge";
54676
54788
  var TEST_PROVIDER = "chat";
54677
54789
  var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
@@ -54692,7 +54804,7 @@ var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
54692
54804
  }
54693
54805
  }, "purgeTestAccounts");
54694
54806
 
54695
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
54807
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
54696
54808
  var BACKFILL_ON_OPEN = 5e3;
54697
54809
  var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
54698
54810
  var createWritable = /* @__PURE__ */ __name((file) => {
@@ -54765,6 +54877,7 @@ var openStoreContext = /* @__PURE__ */ __name(async (options = {}) => {
54765
54877
  moveSuggestedLinks(database, now2);
54766
54878
  movePaymentFacts({ ...opened, now: now2, decisions: decisions2 });
54767
54879
  purgeTestAccounts({ ...opened, now: now2, decisions: decisions2 }, warn);
54880
+ maskStoredBotTokens({ ...opened, now: now2, decisions: decisions2 });
54768
54881
  const pending = pendingNormalization(database);
54769
54882
  if (pending > 0 && pending <= BACKFILL_ON_OPEN)
54770
54883
  backfillNormalized(database);
@@ -54790,7 +54903,7 @@ var openStoreContext = /* @__PURE__ */ __name(async (options = {}) => {
54790
54903
  }
54791
54904
  }, "openStoreContext");
54792
54905
 
54793
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/products.js
54906
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/products.js
54794
54907
  var PRODUCTS = "SELECT c.*, b.name AS author_name, b.kind AS author_kind FROM catalog_items c LEFT JOIN bots b ON c.author_type = 'bot' AND b.id = c.author_id";
54795
54908
  var productOperationsOver = /* @__PURE__ */ __name((context) => {
54796
54909
  const { database, now: now2 } = context;
@@ -54896,10 +55009,10 @@ var productsStoreOver = /* @__PURE__ */ __name((context) => {
54896
55009
  };
54897
55010
  }, "productsStoreOver");
54898
55011
 
54899
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
55012
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
54900
55013
  import { createHash as createHash19 } from "node:crypto";
54901
55014
 
54902
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
55015
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
54903
55016
  var text5 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
54904
55017
  var ref = text5(2048);
54905
55018
  var timestamp2 = pipe(number(), safeInteger(), minValue(0));
@@ -54969,7 +55082,7 @@ var projectAnnotationsSchema = strictObject({
54969
55082
  }))
54970
55083
  });
54971
55084
 
54972
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
55085
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
54973
55086
  var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
54974
55087
  var invalid10 = /* @__PURE__ */ __name((field4) => {
54975
55088
  throw new CliError("validation_error", `invalid project annotations.${field4}`);
@@ -55073,7 +55186,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
55073
55186
  invalid10("external.unused");
55074
55187
  }, "validateProjectAnnotationsGraph");
55075
55188
 
55076
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
55189
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
55077
55190
  var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
55078
55191
  var ref2 = pipe(string(), minLength(1), maxLength(2048));
55079
55192
  var targetSchema = strictObject({
@@ -55179,7 +55292,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
55179
55292
  };
55180
55293
  }, "planBoundProjectAnnotations");
55181
55294
 
55182
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
55295
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
55183
55296
  import { createHash as createHash20 } from "node:crypto";
55184
55297
  var text6 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
55185
55298
  var timestamp3 = pipe(number(), safeInteger(), minValue(0));
@@ -55273,7 +55386,7 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
55273
55386
  })).digest("hex");
55274
55387
  }, "projectAnnotationSnapshotFingerprint");
55275
55388
 
55276
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
55389
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
55277
55390
  var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
55278
55391
  if (!request || typeof request !== "object" || Array.isArray(request))
55279
55392
  throw new CliError("validation_error", "project annotation request is required");
@@ -55290,7 +55403,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
55290
55403
  return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
55291
55404
  }, "projectAnnotationRequest");
55292
55405
 
55293
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
55406
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
55294
55407
  var SnapshotBudget = class {
55295
55408
  static {
55296
55409
  __name(this, "SnapshotBudget");
@@ -55316,13 +55429,13 @@ var SnapshotBudget = class {
55316
55429
  }
55317
55430
  };
55318
55431
 
55319
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
55432
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
55320
55433
  import { createHash as createHash22 } from "node:crypto";
55321
55434
 
55322
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
55435
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
55323
55436
  var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
55324
55437
 
55325
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
55438
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
55326
55439
  import { createHash as createHash21 } from "node:crypto";
55327
55440
  var invalid12 = /* @__PURE__ */ __name(() => {
55328
55441
  throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
@@ -55465,7 +55578,7 @@ var ProjectSnapshotSources = class {
55465
55578
  }
55466
55579
  };
55467
55580
 
55468
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
55581
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
55469
55582
  var unsupported = /* @__PURE__ */ __name(() => {
55470
55583
  throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
55471
55584
  }, "unsupported");
@@ -55643,18 +55756,18 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, bu
55643
55756
  return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
55644
55757
  }), "projectAnnotationSnapshot");
55645
55758
 
55646
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
55759
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
55647
55760
  var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, manifest, bindings, budget) => read(database, () => {
55648
- const current = projectAnnotationSnapshot(database, projectId2, budget).snapshot;
55761
+ const current2 = projectAnnotationSnapshot(database, projectId2, budget).snapshot;
55649
55762
  const sources = new ProjectSnapshotSources(database, budget);
55650
55763
  for (const ref3 of new Set(Object.values(bindings))) {
55651
- if (ref3 === current.project.ref)
55764
+ if (ref3 === current2.project.ref)
55652
55765
  continue;
55653
55766
  const thing = thingOf(database, ref3);
55654
55767
  if (thing)
55655
55768
  sources.ref(thing.type, thing.id);
55656
55769
  }
55657
- const external = sources.external(/* @__PURE__ */ new Set([current.project.ref]));
55770
+ const external = sources.external(/* @__PURE__ */ new Set([current2.project.ref]));
55658
55771
  const projectFields = ["id", "key", "name", "account_id", "deleted_at"];
55659
55772
  const aliasFields = ["aliasable_id", "name", "account_id"];
55660
55773
  const projectFrom = "FROM projects ORDER BY id";
@@ -55680,12 +55793,12 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, ma
55680
55793
  if (project2 && names.has(normalizeVocabularyName(String(alias2.name))))
55681
55794
  namespace.add(`project:${project2.id}`);
55682
55795
  }
55683
- const descriptor_conflicts = ["key", "name"].filter((field4) => current.project[field4] !== manifest.project[field4]);
55796
+ const descriptor_conflicts = ["key", "name"].filter((field4) => current2.project[field4] !== manifest.project[field4]);
55684
55797
  const target = {
55685
- project: current.project.ref,
55686
- annotation_count: current.aliases.length + current.facts.length + current.links.length,
55798
+ project: current2.project.ref,
55799
+ annotation_count: current2.aliases.length + current2.facts.length + current2.links.length,
55687
55800
  revision_sha256: createHash22("sha256").update(JSON.stringify({
55688
- snapshot: projectAnnotationSnapshotFingerprint(JSON.stringify(current)),
55801
+ snapshot: projectAnnotationSnapshotFingerprint(JSON.stringify(current2)),
55689
55802
  projects: projects2,
55690
55803
  aliases: aliases2,
55691
55804
  external: external.toSorted((a, b) => a.ref < b.ref ? -1 : a.ref > b.ref ? 1 : 0)
@@ -55705,7 +55818,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, ma
55705
55818
  };
55706
55819
  }), "previewAnnotationSnapshot");
55707
55820
 
55708
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
55821
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
55709
55822
  var metadataOf2 = /* @__PURE__ */ __name((database, link3, to) => {
55710
55823
  const provenance2 = link3.provenance === null ? {} : { provenance: link3.provenance };
55711
55824
  if (link3.kind === "evidence" && to)
@@ -55772,7 +55885,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, sna
55772
55885
  return mappings;
55773
55886
  }, "restoreAnnotationRecords");
55774
55887
 
55775
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
55888
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
55776
55889
  var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
55777
55890
  async preview(request) {
55778
55891
  const { snapshot: snapshot2, projectId: projectId2 } = projectAnnotationRequest(request);
@@ -55802,7 +55915,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
55802
55915
  }
55803
55916
  }), "projectAnnotationStoreOver");
55804
55917
 
55805
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projection.js
55918
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projection.js
55806
55919
  var IMPORTER = { bot: "import" };
55807
55920
  var importersProposal = /* @__PURE__ */ __name((entity) => entity.review === "proposed" && entity.author.type === "bot" && entity.author.name === IMPORTER.bot, "importersProposal");
55808
55921
  var codeOf = /* @__PURE__ */ __name((error) => {
@@ -55847,7 +55960,7 @@ var moneyLinesOf = /* @__PURE__ */ __name((projection, list2) => (Array.isArray(
55847
55960
  };
55848
55961
  }), "moneyLinesOf");
55849
55962
 
55850
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-relations.js
55963
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-relations.js
55851
55964
  var isDerived = /* @__PURE__ */ __name((role) => role.startsWith("fields."), "isDerived");
55852
55965
  var recordRelationsOver = /* @__PURE__ */ __name(({ database }) => {
55853
55966
  const sql2 = /* @__PURE__ */ __name((text7) => database.prepare(text7), "sql");
@@ -55918,7 +56031,7 @@ var recordRelationsOver = /* @__PURE__ */ __name(({ database }) => {
55918
56031
  return { entityRef, relatedOf, storedRelations, relate, missingOf };
55919
56032
  }, "recordRelationsOver");
55920
56033
 
55921
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-remap.js
56034
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-remap.js
55922
56035
  var recordRemapOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
55923
56036
  const pointedAt = /* @__PURE__ */ __name((type, id2) => {
55924
56037
  for (const { table, pointer } of pointerPairs(database))
@@ -55972,7 +56085,7 @@ var recordRemapOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
55972
56085
  return { pointedAt, remap };
55973
56086
  }, "recordRemapOver");
55974
56087
 
55975
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-run.js
56088
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-run.js
55976
56089
  var runs = 0;
55977
56090
  var PAGE = 500;
55978
56091
  var recordRunOver = /* @__PURE__ */ __name((context, writes) => {
@@ -56132,7 +56245,7 @@ var waitingPointer = /* @__PURE__ */ __name((index2, missing4) => {
56132
56245
  return pointerOf("records", index2, "fields", key2);
56133
56246
  }, "waitingPointer");
56134
56247
 
56135
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-matching.js
56248
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-matching.js
56136
56249
  var valuesOf = /* @__PURE__ */ __name((value) => (Array.isArray(value) ? value : [value]).filter((one2) => typeof one2 === "string"), "valuesOf");
56137
56250
  var SCHEME2 = /^(email|domain|tax-id:[a-z]{2}|registration:[a-z]{2})$/;
56138
56251
  var ORG_EMAIL = "org-email";
@@ -56320,7 +56433,7 @@ var renameMade = /* @__PURE__ */ __name(({ database, now: now2 }, type, id2, nam
56320
56433
  ]);
56321
56434
  }, "renameMade");
56322
56435
 
56323
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-direct.js
56436
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-direct.js
56324
56437
  var productFields = /* @__PURE__ */ __name((fields4) => ({
56325
56438
  name: given(fields4, "name"),
56326
56439
  unit: given(fields4, "unit"),
@@ -56443,7 +56556,7 @@ var DIRECT_PROJECTORS = {
56443
56556
  lead: dealProjector("lead")
56444
56557
  };
56445
56558
 
56446
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-money.js
56559
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-money.js
56447
56560
  var allocatedByOthers = /* @__PURE__ */ __name((context, paymentId) => {
56448
56561
  const importer = authorActor(context, IMPORTER).actor;
56449
56562
  return context.database.prepare("SELECT 1 FROM payment_allocations WHERE payment_id = ? AND NOT (author_type = ? AND author_id = ?) LIMIT 1").get(paymentId, importer.type, importer.id) !== void 0;
@@ -56653,7 +56766,7 @@ var MONEY_PROJECTORS = {
56653
56766
  }
56654
56767
  };
56655
56768
 
56656
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-phone.js
56769
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-phone.js
56657
56770
  var CALLS_CALENDAR = "calls";
56658
56771
  var importOnly = /* @__PURE__ */ __name((source2, type) => {
56659
56772
  if (!isImportedProvider(source2.provider))
@@ -56828,7 +56941,7 @@ var PHONE_PROJECTORS = {
56828
56941
  }
56829
56942
  };
56830
56943
 
56831
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors.js
56944
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors.js
56832
56945
  var RECORD_PROJECTORS = {
56833
56946
  ...MONEY_PROJECTORS,
56834
56947
  ...DIRECT_PROJECTORS,
@@ -56838,7 +56951,7 @@ var RECORD_PROJECTORS = {
56838
56951
  project: null
56839
56952
  };
56840
56953
 
56841
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-settling.js
56954
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-settling.js
56842
56955
  var recordSettlingOver = /* @__PURE__ */ __name(({ database }, finance) => {
56843
56956
  const sql2 = /* @__PURE__ */ __name((text7) => database.prepare(text7), "sql");
56844
56957
  const freeOn = /* @__PURE__ */ __name((invoice, payment) => {
@@ -56900,7 +57013,7 @@ var recordSettlingOver = /* @__PURE__ */ __name(({ database }, finance) => {
56900
57013
  return { settle, checkShares };
56901
57014
  }, "recordSettlingOver");
56902
57015
 
56903
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-stamps.js
57016
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-stamps.js
56904
57017
  import { createHash as createHash23 } from "node:crypto";
56905
57018
  var VOLATILE = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "metadata"]);
56906
57019
  var content = /* @__PURE__ */ __name((row2) => row2 === void 0 ? null : Object.fromEntries(Object.entries(row2).filter(([column2]) => !VOLATILE.has(column2))), "content");
@@ -56916,7 +57029,7 @@ var importStampsOver = /* @__PURE__ */ __name(({ database }) => {
56916
57029
  return { stamp, untouched };
56917
57030
  }, "importStampsOver");
56918
57031
 
56919
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/subscriptions.js
57032
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/subscriptions.js
56920
57033
  var SUBSCRIPTIONS = "SELECT s.*, b.name AS author_name, b.kind AS author_kind FROM subscriptions s LEFT JOIN bots b ON s.author_type = 'bot' AND b.id = s.author_id";
56921
57034
  var PRICES = "SELECT p.*, b.name AS author_name, b.kind AS author_kind FROM subscription_prices p LEFT JOIN bots b ON p.author_type = 'bot' AND b.id = p.author_id";
56922
57035
  var PRICE_REF = /^subscription_price:([1-9]\d{0,15})$/;
@@ -56946,12 +57059,12 @@ var subscriptionOperationsOver = /* @__PURE__ */ __name((context) => {
56946
57059
  const pricesOf2 = /* @__PURE__ */ __name((id2) => database.prepare(`${PRICES} WHERE p.subscription_id = ? ORDER BY p.effective_from, p.id`).all(id2).map(priceOf), "pricesOf");
56947
57060
  const subscriptionOf = /* @__PURE__ */ __name((row2) => {
56948
57061
  const interval = { count: Number(row2.interval_count), unit: row2.interval_unit };
56949
- const current = database.prepare(`${PRICES} WHERE p.subscription_id = ? AND p.review = 'confirmed' AND p.effective_from <= ? ORDER BY p.effective_from DESC LIMIT 1`).get(Number(row2.id), today());
56950
- const currentPrice = current ? priceOf(current) : null;
57062
+ const current2 = database.prepare(`${PRICES} WHERE p.subscription_id = ? AND p.review = 'confirmed' AND p.effective_from <= ? ORDER BY p.effective_from DESC LIMIT 1`).get(Number(row2.id), today());
57063
+ const currentPrice = current2 ? priceOf(current2) : null;
56951
57064
  const fields4 = {
56952
57065
  name: String(row2.name),
56953
57066
  interval,
56954
- price: current ? Number(current.amount) : null,
57067
+ price: current2 ? Number(current2.amount) : null,
56955
57068
  currency: currentPrice?.currency ?? null,
56956
57069
  status: row2.status,
56957
57070
  review: row2.review
@@ -57147,7 +57260,7 @@ var subscriptionsStoreOver = /* @__PURE__ */ __name((context) => {
57147
57260
  };
57148
57261
  }, "subscriptionsStoreOver");
57149
57262
 
57150
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/wallets.js
57263
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/wallets.js
57151
57264
  var WALLETS = "SELECT w.*, b.name AS author_name, b.kind AS author_kind FROM financial_accounts w LEFT JOIN bots b ON w.author_type = 'bot' AND b.id = w.author_id";
57152
57265
  var SIGNED = "CASE t.direction WHEN 'in' THEN t.amount ELSE -t.amount END";
57153
57266
  var walletOperationsOver = /* @__PURE__ */ __name((context) => {
@@ -57269,7 +57382,7 @@ var walletsStoreOver = /* @__PURE__ */ __name((context) => {
57269
57382
  };
57270
57383
  }, "walletsStoreOver");
57271
57384
 
57272
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/record-writes.js
57385
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/record-writes.js
57273
57386
  var specOf = /* @__PURE__ */ __name((type) => RECORD_TYPES[type], "specOf");
57274
57387
  var unsettled = /* @__PURE__ */ __name((fields4, relations) => recordFingerprint(fields4, relations.filter((relation) => !AMOUNT_ROLES.includes(relation.role))), "unsettled");
57275
57388
  var tableOf2 = /* @__PURE__ */ __name((type) => typeof type === "string" && Object.hasOwn(DECIDED_TABLES, type) ? DECIDED_TABLES[type] : void 0, "tableOf");
@@ -57526,7 +57639,7 @@ var recordWritesOver = /* @__PURE__ */ __name((context) => {
57526
57639
  return { writeOne, project: project2, completeDependents, entityRef, missingOf: relations.missingOf };
57527
57640
  }, "recordWritesOver");
57528
57641
 
57529
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
57642
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
57530
57643
  var LIMIT = 1e3;
57531
57644
  var iso15 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
57532
57645
  var checkLimit = /* @__PURE__ */ __name((limit) => {
@@ -57731,7 +57844,7 @@ var recordStoreOver = /* @__PURE__ */ __name((context) => {
57731
57844
  };
57732
57845
  }, "recordStoreOver");
57733
57846
 
57734
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/templates.js
57847
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/templates.js
57735
57848
  var templateOf = /* @__PURE__ */ __name((row2) => ({
57736
57849
  key: row2.key,
57737
57850
  channel: row2.channel,
@@ -57786,7 +57899,7 @@ var storedTemplateBodies = /* @__PURE__ */ __name((database, key2, language) =>
57786
57899
  return Object.fromEntries(rows.map((row2) => [row2.channel, row2.body]));
57787
57900
  }, "storedTemplateBodies");
57788
57901
 
57789
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/store-errors.js
57902
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/store-errors.js
57790
57903
  var refusalOf = /* @__PURE__ */ __name((error) => error instanceof Error && error.name === "DrizzleQueryError" && error.cause instanceof CliError ? error.cause : error, "refusalOf");
57791
57904
  var wrapped = /* @__PURE__ */ new WeakMap();
57792
57905
  var storeErrors = /* @__PURE__ */ __name((area) => {
@@ -57821,7 +57934,7 @@ var storeErrors = /* @__PURE__ */ __name((area) => {
57821
57934
  return proxy;
57822
57935
  }, "storeErrors");
57823
57936
 
57824
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
57937
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
57825
57938
  var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
57826
57939
  const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
57827
57940
  let merged = { from: from2, to };
@@ -57834,7 +57947,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
57834
57947
  }, "markRange");
57835
57948
  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");
57836
57949
 
57837
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-analysis-marks.js
57950
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-analysis-marks.js
57838
57951
  var prefixOf2 = /* @__PURE__ */ __name(({ provider, account }) => `task_analysis:${provider}:${account}:`, "prefixOf");
57839
57952
  var markOf = /* @__PURE__ */ __name((prefix, row2) => ({
57840
57953
  chatId: String(row2.key).slice(prefix.length),
@@ -57855,7 +57968,7 @@ var setTaskAnalysisMark = /* @__PURE__ */ __name((database, account, { chatId, c
57855
57968
  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);
57856
57969
  }, "setTaskAnalysisMark");
57857
57970
 
57858
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
57971
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
57859
57972
  var keyOf5 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
57860
57973
  var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
57861
57974
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf5(account));
@@ -57865,7 +57978,7 @@ var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) =
57865
57978
  database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(keyOf5(account), JSON.stringify(until), now2);
57866
57979
  }, "setTaskRulesStop");
57867
57980
 
57868
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sync.js
57981
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sync.js
57869
57982
  var syncStoreOver = /* @__PURE__ */ __name((context) => {
57870
57983
  const { database } = context;
57871
57984
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
@@ -57924,7 +58037,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
57924
58037
  };
57925
58038
  }, "syncStoreOver");
57926
58039
 
57927
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/tags.js
58040
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/tags.js
57928
58041
  var tagsStoreOver = /* @__PURE__ */ __name((context) => {
57929
58042
  const { database } = context;
57930
58043
  return {
@@ -57946,7 +58059,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
57946
58059
  };
57947
58060
  }, "tagsStoreOver");
57948
58061
 
57949
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
58062
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
57950
58063
  var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
57951
58064
  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
57952
58065
  WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
@@ -58073,7 +58186,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
58073
58186
  dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
58074
58187
  }, "savePictureChunks");
58075
58188
 
58076
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
58189
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
58077
58190
  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,
58078
58191
  EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
58079
58192
  FROM messages m
@@ -58162,7 +58275,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
58162
58275
  return plain2(best(found2));
58163
58276
  }, "nearestMessages");
58164
58277
 
58165
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/vectors.js
58278
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/vectors.js
58166
58279
  var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
58167
58280
  const { database } = context;
58168
58281
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -58421,7 +58534,7 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
58421
58534
  vectorCounts: /* @__PURE__ */ __name(async (models) => vectorCounts(context, models), "vectorCounts")
58422
58535
  }), "vectorsStoreOver");
58423
58536
 
58424
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
58537
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
58425
58538
  import { existsSync as existsSync2, readFileSync as readFileSync4 } from "node:fs";
58426
58539
  import { dirname as dirname3, join as join3 } from "node:path";
58427
58540
  var BOOKKEEPING2 = ["schema_migrations", "store_settings"];
@@ -58509,10 +58622,10 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
58509
58622
  }
58510
58623
  }, "lastBackup");
58511
58624
 
58512
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/providers.js
58625
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/providers.js
58513
58626
  var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
58514
58627
 
58515
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/owner-languages.js
58628
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/owner-languages.js
58516
58629
  var KEY4 = "ownerLanguages";
58517
58630
  var ISO_639_1 = new Set("aa ab ae af ak am an ar as av ay az ba be bg bi bm bn bo br bs ca ce ch co cr cs cu cv cy da de dv dz ee el en eo es et eu fa ff fi fj fo fr fy ga gd gl gn gu gv ha he hi ho hr ht hu hy hz ia id ie ig ii ik io is it iu ja jv ka kg ki kj kk kl km kn ko kr ks ku kv kw ky la lb lg li ln lo lt lu lv mg mh mi mk ml mn mr ms mt my na nb nd ne ng nl nn no nr nv ny oc oj om or os pa pi pl ps pt qu rm rn ro ru rw sa sc sd se sg si sk sl sm sn so sq sr ss st su sv sw ta te tg th ti tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa wo xh yi yo za zh zu".split(" "));
58518
58631
  var DEFAULT_OWNER_LANGUAGES = ["ru"];
@@ -58542,7 +58655,7 @@ var saveOwnerLanguages = /* @__PURE__ */ __name((database, languages, now2) => {
58542
58655
  database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(KEY4, JSON.stringify(languages), now2);
58543
58656
  }, "saveOwnerLanguages");
58544
58657
 
58545
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
58658
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
58546
58659
  var COUNTED_TABLES = [
58547
58660
  "accounts",
58548
58661
  "chats",
@@ -58627,7 +58740,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
58627
58740
  };
58628
58741
  }, "storeContents");
58629
58742
 
58630
- // node_modules/.pnpm/@wirecat+cli-core@0.616.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_8665abbf6fdc3acbe46baf279794bee0/node_modules/@wirecat/cli-core/dist/store/store.js
58743
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/store/store.js
58631
58744
  var openStore = /* @__PURE__ */ __name(async (options = {}) => {
58632
58745
  const context = await openStoreContext(options);
58633
58746
  try {
@@ -59055,7 +59168,8 @@ export {
59055
59168
  scoreGroup,
59056
59169
  OTHER_SOURCES,
59057
59170
  storeClients,
59058
- rollBack,
59171
+ isDerivedTable,
59172
+ rollBack2 as rollBack,
59059
59173
  MIGRATIONS,
59060
59174
  migrate,
59061
59175
  openSqlite,