@wirecat/zoom-cli 0.60.1 → 0.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/README.md +3 -3
  2. package/dist/answers.d.ts +16 -0
  3. package/dist/answers.d.ts.map +1 -1
  4. package/dist/bin/zm.js +2 -2
  5. package/dist/bundle/{chunk-3R437ICM.js → all-profiles-CGGNBINU.js} +11 -7
  6. package/dist/bundle/answer-policy-D46SGQ35.js +96 -0
  7. package/dist/bundle/{anthropic-CSLAACWX.js → anthropic-KVWPIHFG.js} +4 -4
  8. package/dist/bundle/{app-server-RYYXX6QV.js → app-server-NKKFBTQN.js} +50 -50
  9. package/dist/bundle/{bun-JVDJVDHL.js → bun-XRO6XJHQ.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-B5CZHAV4.js → bun-sqlite-FWNCLOAR.js} +3 -3
  11. package/dist/bundle/{chunk-HAUAEGGI.js → chunk-2DPMYUWQ.js} +10 -10
  12. package/dist/bundle/{chunk-HBYE4EP2.js → chunk-2LLNPNMB.js} +1 -1
  13. package/dist/bundle/{chunk-WB7MQHUI.js → chunk-2NAM2XQG.js} +2 -2
  14. package/dist/bundle/{chunk-PAEBFJUC.js → chunk-2T7MUSDB.js} +118 -95
  15. package/dist/bundle/{chunk-LPY2ISJK.js → chunk-3YBDRVOG.js} +6 -6
  16. package/dist/bundle/{chunk-WEUXLXOZ.js → chunk-4OQVRDTG.js} +31 -21
  17. package/dist/bundle/{chunk-Q7U627RY.js → chunk-4OTXE6CF.js} +79 -59
  18. package/dist/bundle/{chunk-LPDYI5GR.js → chunk-4UUQEQ5D.js} +1 -1
  19. package/dist/bundle/{chunk-FWJ3Q7NO.js → chunk-5LMQTEU5.js} +5 -5
  20. package/dist/bundle/{chunk-6BJQBVMN.js → chunk-5MYLM6SU.js} +45 -27
  21. package/dist/bundle/{chunk-Z5H47R4G.js → chunk-5NLFQ644.js} +1034 -870
  22. package/dist/bundle/{chunk-XS72YFPV.js → chunk-6R3GMSLR.js} +2 -2
  23. package/dist/bundle/{chunk-AZZPMHP2.js → chunk-6SK5SHCR.js} +2 -2
  24. package/dist/bundle/{chunk-TY5PBEH2.js → chunk-6SPWQCJF.js} +11 -11
  25. package/dist/bundle/{chunk-EUHQ5D4K.js → chunk-6URISMGR.js} +26 -26
  26. package/dist/bundle/{chunk-43BX56ZI.js → chunk-72S5TXFN.js} +9 -9
  27. package/dist/bundle/{chunk-OBUKZ2ZM.js → chunk-73BAQ7PH.js} +31 -211
  28. package/dist/bundle/{chunk-3LBA63D5.js → chunk-7AY3ADNV.js} +22 -5
  29. package/dist/bundle/{chunk-RACSKYNX.js → chunk-7CNRZSAV.js} +7 -5
  30. package/dist/bundle/{chunk-IQENQXUJ.js → chunk-7LQLJ7LW.js} +2 -2
  31. package/dist/bundle/{chunk-EN5DBDKW.js → chunk-AMIIU3UZ.js} +4 -4
  32. package/dist/bundle/{chunk-RUEPZTNA.js → chunk-BJPFWPKH.js} +2 -2
  33. package/dist/bundle/{chunk-KNAS4VEA.js → chunk-BNTAQADF.js} +2 -2
  34. package/dist/bundle/{chunk-PEMLI3T7.js → chunk-BPMKLWHV.js} +6 -4
  35. package/dist/bundle/chunk-CXPHUOJR.js +380 -0
  36. package/dist/bundle/{chunk-LVHZQCP4.js → chunk-D6FTCPXA.js} +14 -10
  37. package/dist/bundle/{chunk-IRX2YVAH.js → chunk-DIXC56OU.js} +4 -4
  38. package/dist/bundle/{chunk-WFT2GGFH.js → chunk-ECXRRW7J.js} +25 -22
  39. package/dist/bundle/{chunk-KXEC5FVT.js → chunk-EG7HC4EC.js} +2 -2
  40. package/dist/bundle/{chunk-GEVHI226.js → chunk-EJFSS65P.js} +6 -6
  41. package/dist/bundle/{chunk-HIAO4MPA.js → chunk-EOEDICIE.js} +1 -1
  42. package/dist/bundle/{chunk-BO7J5Z3T.js → chunk-FAOLCUKV.js} +17 -17
  43. package/dist/bundle/{chunk-ZK7Y5K63.js → chunk-FDCGTODC.js} +1 -1
  44. package/dist/bundle/{chunk-IQSBMAYB.js → chunk-GOESXUJQ.js} +3 -3
  45. package/dist/bundle/{chunk-AOZGGGUK.js → chunk-HIZQYFY3.js} +3 -3
  46. package/dist/bundle/{chunk-YLATWUE7.js → chunk-IK2OSV5C.js} +6 -6
  47. package/dist/bundle/{chunk-46R2JTGO.js → chunk-IOCS5FXW.js} +2 -2
  48. package/dist/bundle/{chunk-Y3YURIZF.js → chunk-IOUPXUFH.js} +52 -38
  49. package/dist/bundle/{chunk-ZXQCA3ZW.js → chunk-IR73ZZY6.js} +8 -8
  50. package/dist/bundle/{chunk-EF2RCQ3L.js → chunk-JBBZCTTF.js} +1 -1
  51. package/dist/bundle/{chunk-OEEMCNAO.js → chunk-JDJDVYGS.js} +6 -6
  52. package/dist/bundle/{chunk-PATM7JGR.js → chunk-JYVFFUIX.js} +1 -1
  53. package/dist/bundle/{chunk-W5EUHV3J.js → chunk-KM7Q67Z3.js} +1 -1
  54. package/dist/bundle/{chunk-FZMRHNOP.js → chunk-KMQUZ4YM.js} +3 -3
  55. package/dist/bundle/{chunk-VLE3FWE3.js → chunk-LXYC75D3.js} +120 -32
  56. package/dist/bundle/{chunk-V53IB5AU.js → chunk-M2WQWF3I.js} +47 -47
  57. package/dist/bundle/{chunk-X7YPTYM4.js → chunk-M6FCCVYZ.js} +16 -3
  58. package/dist/bundle/{chunk-4TCQT57W.js → chunk-M7YNOK4D.js} +408 -420
  59. package/dist/bundle/chunk-MI3JK6MW.js +335 -0
  60. package/dist/bundle/{chunk-ES6UWVTM.js → chunk-MIUPH3WA.js} +6 -6
  61. package/dist/bundle/{chunk-VJBVNDFR.js → chunk-MLNC5N7H.js} +3 -3
  62. package/dist/bundle/{chunk-UWVNY5CA.js → chunk-N3KQ7XND.js} +2 -2
  63. package/dist/bundle/{chunk-VKUS2V4L.js → chunk-NQCFUYC2.js} +8 -8
  64. package/dist/bundle/{chunk-KYUIU5UR.js → chunk-Q4ZE2LXE.js} +2 -2
  65. package/dist/bundle/{chunk-VVKHF6VJ.js → chunk-QLQ7VVLK.js} +49 -24
  66. package/dist/bundle/{chunk-K6NPOZUP.js → chunk-QUWMFBMS.js} +7 -7
  67. package/dist/bundle/{chunk-WWNZS7ZY.js → chunk-RWG44LQD.js} +16 -4
  68. package/dist/bundle/{chunk-R4SRXI7M.js → chunk-SB47UAW2.js} +187 -113
  69. package/dist/bundle/{chunk-N27LOY3D.js → chunk-SEH7DBAM.js} +7 -7
  70. package/dist/bundle/{chunk-YEZQ7SD7.js → chunk-SPJJCD2A.js} +13 -13
  71. package/dist/bundle/{chunk-CGCJ6P3A.js → chunk-TILW3EJY.js} +696 -418
  72. package/dist/bundle/{chunk-XLJV3ZOH.js → chunk-TQFCPUIM.js} +1 -1
  73. package/dist/bundle/{chunk-ZDRDCANC.js → chunk-TZE6WXID.js} +693 -336
  74. package/dist/bundle/{chunk-XX7KVQIG.js → chunk-UD4FKICZ.js} +4 -4
  75. package/dist/bundle/{chunk-MFS52LTZ.js → chunk-UIPT6IAU.js} +1 -1
  76. package/dist/bundle/{chunk-QKSCDALS.js → chunk-URJZK4GX.js} +1 -1
  77. package/dist/bundle/{decode-CTQJQYNU.js → chunk-VFJ3MOIR.js} +21 -18
  78. package/dist/bundle/{chunk-REC3AZP6.js → chunk-XAXXEZZ5.js} +2 -2
  79. package/dist/bundle/{chunk-Z4D6M62I.js → chunk-YBMOFCY5.js} +2 -2
  80. package/dist/bundle/{chunk-PPHUBORC.js → chunk-YF2PT5KA.js} +32 -34
  81. package/dist/bundle/chunk-YFIUXE25.js +217 -0
  82. package/dist/bundle/{chunk-7IDNHVJS.js → chunk-YI6ZNDPC.js} +22 -12
  83. package/dist/bundle/{chunk-HYZ545ON.js → chunk-YJN4XYNA.js} +2 -2
  84. package/dist/bundle/{cli-CYKEKT5P.js → cli-AHPIESAC.js} +70 -54
  85. package/dist/bundle/command-contract-HVLI3OKU.js +38 -0
  86. package/dist/bundle/config-UW6W34I2.js +78 -0
  87. package/dist/bundle/decode-ZU7WLMMV.js +20 -0
  88. package/dist/bundle/{dist-YLSQKPPY.js → dist-LTS7VI3S.js} +14 -14
  89. package/dist/bundle/{echarts-4OQHS575.js → echarts-YNGCOYHW.js} +2 -2
  90. package/dist/bundle/{embed-P2BKRRJD.js → embed-VWWOW7PP.js} +4 -4
  91. package/dist/bundle/{embedder-HC6ZARP5.js → embedder-T5GJC7M2.js} +7 -7
  92. package/dist/bundle/{first-run-UERFFXBV.js → first-run-PX3SHPUU.js} +8 -8
  93. package/dist/bundle/first-screen-RAPEZG57.js +36 -0
  94. package/dist/bundle/{folders-RSLPTZLJ.js → folders-VXMDFC2D.js} +2 -2
  95. package/dist/bundle/{instructions-3QZBKKPF.js → instructions-GJHHFV64.js} +1 -1
  96. package/dist/bundle/{main-2T6D77JC.js → main-IYCD6MBH.js} +16 -16
  97. package/dist/bundle/{mcp-OQBZXELQ.js → mcp-EMNFFY4N.js} +2 -2
  98. package/dist/bundle/{meetings-ZIDSQZBJ.js → meetings-GHYNIOHG.js} +4 -4
  99. package/dist/bundle/{node-R2BLYUSB.js → node-GFOH6FKP.js} +2 -2
  100. package/dist/bundle/{node-sqlite-7CGHAHIS.js → node-sqlite-QXKSPHTP.js} +3 -3
  101. package/dist/bundle/{oauth-UBCYXTWV.js → oauth-A6I2OMDD.js} +5 -5
  102. package/dist/bundle/{open-AWUB4Q7Z.js → open-TQKCU447.js} +2 -2
  103. package/dist/bundle/openai-XE3BJXOI.js +22 -0
  104. package/dist/bundle/{output-file-SN22HAVL.js → output-file-FQNFCUKE.js} +3 -3
  105. package/dist/bundle/{process-IX5YWGDP.js → process-XVDX4SPD.js} +1 -1
  106. package/dist/bundle/{program-STYPTNT3.js → program-UYK4AD2W.js} +415 -428
  107. package/dist/bundle/{prompt-MAYUHEGN.js → prompt-ISYG5RWM.js} +3 -3
  108. package/dist/bundle/{recognize-FVTNXRTF.js → recognize-KENPECLZ.js} +4 -2
  109. package/dist/bundle/{remote-WCPRU73L.js → remote-ZP5XTDCC.js} +5 -5
  110. package/dist/bundle/{rerank-6CBLZBCV.js → rerank-SG653RHT.js} +5 -5
  111. package/dist/bundle/{run-log-G4WZTOBW.js → run-log-HYKGQ42E.js} +53 -53
  112. package/dist/bundle/{chunk-XNUFDYR6.js → serve-6UJCZD7Z.js} +8 -6
  113. package/dist/bundle/server-AXE37E6Q.js +66 -0
  114. package/dist/bundle/{chunk-INARC5O7.js → server-ZAYEDPFR.js} +43 -10
  115. package/dist/bundle/{services-326Z3TNE.js → services-KMH7XZPY.js} +37 -26
  116. package/dist/bundle/{speech-KSZ7RKM3.js → speech-LINBLG5E.js} +28 -5
  117. package/dist/bundle/{state-EPB3L2JM.js → state-4RKZNHE7.js} +4 -4
  118. package/dist/bundle/{store-7WX7SW2R.js → store-253N7NUC.js} +15 -15
  119. package/dist/bundle/{store-KO242JBK.js → store-JTBHRQZK.js} +13 -13
  120. package/dist/bundle/store-connection-PWLUMCP7.js +76 -0
  121. package/dist/bundle/store-maintenance-command-XRNECVDU.js +55 -0
  122. package/dist/bundle/{streaming-M6VDKBBH.js → streaming-YW64OKKQ.js} +4 -4
  123. package/dist/bundle/{tokens-BTNXHR7T.js → tokens-DPBC2P3I.js} +4 -4
  124. package/dist/bundle/zm.js +1 -1
  125. package/dist/commands.d.ts +1 -2
  126. package/dist/commands.d.ts.map +1 -1
  127. package/dist/commands.js +3 -16
  128. package/dist/commands.js.map +1 -1
  129. package/dist/contract-overrides.d.ts +0 -2
  130. package/dist/contract-overrides.d.ts.map +1 -1
  131. package/dist/contract-overrides.js +0 -158
  132. package/dist/contract-overrides.js.map +1 -1
  133. package/dist/program-bindings.d.ts +1 -1
  134. package/dist/program-bindings.d.ts.map +1 -1
  135. package/dist/program-bindings.js +16 -18
  136. package/dist/program-bindings.js.map +1 -1
  137. package/dist/program.d.ts +2 -4
  138. package/dist/program.d.ts.map +1 -1
  139. package/dist/program.js.map +1 -1
  140. package/dist/read-only.d.ts.map +1 -1
  141. package/dist/read-only.js +3 -0
  142. package/dist/read-only.js.map +1 -1
  143. package/dist/run.d.ts.map +1 -1
  144. package/dist/run.js +82 -32
  145. package/dist/run.js.map +1 -1
  146. package/dist/setup-commands.d.ts.map +1 -1
  147. package/dist/setup-commands.js +8 -46
  148. package/dist/setup-commands.js.map +1 -1
  149. package/dist/store-commands.d.ts.map +1 -1
  150. package/dist/store-commands.js +4 -1
  151. package/dist/store-commands.js.map +1 -1
  152. package/dist/tokens.d.ts +6 -1
  153. package/dist/tokens.d.ts.map +1 -1
  154. package/dist/tokens.js +21 -10
  155. package/dist/tokens.js.map +1 -1
  156. package/dist/version.d.ts +1 -1
  157. package/dist/version.js +1 -1
  158. package/package.json +3 -3
  159. package/dist/bundle/all-profiles-E6KXASLY.js +0 -25
  160. package/dist/bundle/answer-policy-YWCC55NB.js +0 -96
  161. package/dist/bundle/chunk-DBSWVZES.js +0 -48
  162. package/dist/bundle/chunk-WYRYLBST.js +0 -390
  163. package/dist/bundle/chunk-YLBNPI7H.js +0 -2
  164. package/dist/bundle/command-contract-P45QCCXM.js +0 -38
  165. package/dist/bundle/config-JYKTLEA3.js +0 -79
  166. package/dist/bundle/first-screen-VFIS7FX3.js +0 -36
  167. package/dist/bundle/mcp-4VHVUMCR.js +0 -92
  168. package/dist/bundle/mcp-6CLW2IZM.js +0 -189
  169. package/dist/bundle/serve-3IDUVTZL.js +0 -19
  170. package/dist/bundle/server-7GU36TER.js +0 -66
  171. package/dist/bundle/server-VHRS5UAL.js +0 -53
  172. package/dist/bundle/store-connection-K3MNDCQQ.js +0 -76
  173. package/dist/bundle/store-maintenance-command-GJDJYI2U.js +0 -54
  174. package/dist/mcp-command.d.ts +0 -33
  175. package/dist/mcp-command.d.ts.map +0 -1
  176. package/dist/mcp-command.js +0 -143
  177. package/dist/mcp-command.js.map +0 -1
  178. package/dist/mcp.d.ts +0 -30
  179. package/dist/mcp.d.ts.map +0 -1
  180. package/dist/mcp.js +0 -110
  181. package/dist/mcp.js.map +0 -1
  182. /package/dist/bundle/{chunk-O5EHUB2V.js → chunk-NPGVOZVK.js} +0 -0
@@ -16,7 +16,7 @@ import {
16
16
  WORK_TASK_TYPES,
17
17
  linkKind,
18
18
  matches
19
- } from "./chunk-K6NPOZUP.js";
19
+ } from "./chunk-QUWMFBMS.js";
20
20
  import {
21
21
  DEFAULT_STEMMERS,
22
22
  DEFAULT_STEMMERS_VERSION,
@@ -29,13 +29,13 @@ import {
29
29
  fold,
30
30
  normalize,
31
31
  parseStemmers
32
- } from "./chunk-ZXQCA3ZW.js";
32
+ } from "./chunk-IR73ZZY6.js";
33
33
  import {
34
34
  DEFAULT_TASK_CATEGORIES,
35
35
  sharedConfigPath,
36
36
  storedTaskCategories,
37
37
  taskCategoriesReader
38
- } from "./chunk-FWJ3Q7NO.js";
38
+ } from "./chunk-5LMQTEU5.js";
39
39
  import {
40
40
  COUNTER_FIELDS,
41
41
  DOCUMENT_ACCOUNT_PROVIDERS,
@@ -67,19 +67,19 @@ import {
67
67
  rankingWords,
68
68
  useStoredProviders,
69
69
  validCounter
70
- } from "./chunk-ES6UWVTM.js";
70
+ } from "./chunk-MIUPH3WA.js";
71
71
  import {
72
72
  normalizeTag,
73
73
  tagOf
74
- } from "./chunk-Z4D6M62I.js";
74
+ } from "./chunk-YBMOFCY5.js";
75
75
  import {
76
76
  storePath
77
- } from "./chunk-KXEC5FVT.js";
77
+ } from "./chunk-EG7HC4EC.js";
78
78
  import {
79
79
  PRAGMAS,
80
80
  quietSqliteWarning,
81
81
  storeCapable
82
- } from "./chunk-YLATWUE7.js";
82
+ } from "./chunk-IK2OSV5C.js";
83
83
  import {
84
84
  CHAT_MESSAGES_READ,
85
85
  MEETING_FINDINGS_KIND,
@@ -106,7 +106,7 @@ import {
106
106
  validateMeetingPreparationContext,
107
107
  validateMeetingRelatedHistory,
108
108
  validateMeetingSeriesHistory
109
- } from "./chunk-Q7U627RY.js";
109
+ } from "./chunk-4OTXE6CF.js";
110
110
  import {
111
111
  QUERY_LIMITS,
112
112
  dateRange,
@@ -117,7 +117,7 @@ import {
117
117
  validateQuery,
118
118
  walkQuery,
119
119
  zonedMoment
120
- } from "./chunk-LVHZQCP4.js";
120
+ } from "./chunk-D6FTCPXA.js";
121
121
  import {
122
122
  CliError,
123
123
  array,
@@ -136,7 +136,7 @@ import {
136
136
  singleLine,
137
137
  strictObject,
138
138
  string
139
- } from "./chunk-R4SRXI7M.js";
139
+ } from "./chunk-SB47UAW2.js";
140
140
  import {
141
141
  resolveFrom
142
142
  } from "./chunk-Y5E2WNWB.js";
@@ -164,12 +164,12 @@ import {
164
164
  sql,
165
165
  sqliteTable,
166
166
  text
167
- } from "./chunk-HIAO4MPA.js";
167
+ } from "./chunk-EOEDICIE.js";
168
168
  import {
169
169
  __name
170
170
  } from "./chunk-ZVVMGPBJ.js";
171
171
 
172
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/account-store.js
172
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/account-store.js
173
173
  var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
174
174
  const methods = whole;
175
175
  return Object.fromEntries(Object.keys(keyed).map((name) => [
@@ -297,7 +297,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
297
297
  };
298
298
  }, "bindAccount");
299
299
 
300
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/search/query.js
300
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/query.js
301
301
  var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
302
302
  var inSource = /* @__PURE__ */ __name((source2, provider) => source2 === "all" || source2 === "bots" && isBotProvider(provider) || source2 === "personal" && !isBotProvider(provider) || source2 === provider || providerNamed(source2)?.name === provider || isKind(source2) && kindOf(provider) === source2, "inSource");
303
303
  var fail = /* @__PURE__ */ __name((message2) => {
@@ -320,7 +320,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
320
320
  return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
321
321
  }, "sourceOf");
322
322
 
323
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/search/account-list.js
323
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/account-list.js
324
324
  var ACCOUNT_GROUPS = "accountGroups";
325
325
  var ACCOUNT_GROUPS_SETTING = "account_groups";
326
326
  var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
@@ -507,7 +507,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf = (kind3)
507
507
  return { accounts: [...chosen.values()], skipped };
508
508
  }, "fitting");
509
509
 
510
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
510
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
511
511
  var IndexBuilderOn = class {
512
512
  static {
513
513
  __name(this, "IndexBuilderOn");
@@ -702,7 +702,7 @@ function alias(table, alias2) {
702
702
  }
703
703
  __name(alias, "alias");
704
704
 
705
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
705
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
706
706
  var ENTITY_TABLES = {
707
707
  account: "accounts",
708
708
  attachment: "attachments",
@@ -742,7 +742,7 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
742
742
  return { table, pointer, type, count, known: known2 };
743
743
  }).filter(({ count }) => count > 0)), "orphanPointers");
744
744
 
745
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
745
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
746
746
  var canonicalTags = sqliteTable("canonical_tags", {
747
747
  id: integer("id").primaryKey(),
748
748
  name: text("name").notNull().unique(),
@@ -751,7 +751,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
751
751
  updatedAt: integer("updated_at").notNull()
752
752
  });
753
753
 
754
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
754
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
755
755
  var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
756
756
  sourceKey: text("source_key").notNull(),
757
757
  collection: text("collection").notNull(),
@@ -761,13 +761,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
761
761
  createdAt: integer("created_at").notNull()
762
762
  }, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
763
763
 
764
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
764
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
765
765
  var documentIndexPending = sqliteTable("document_index_pending", {
766
766
  id: integer("id").notNull(),
767
767
  indexableType: text("indexable_type").notNull()
768
768
  }, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
769
769
 
770
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
770
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
771
771
  var tagRedirects = sqliteTable("tag_redirects", {
772
772
  sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
773
773
  survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
@@ -793,7 +793,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
793
793
  index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
794
794
  ]);
795
795
 
796
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
796
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
797
797
  var accounts = sqliteTable("accounts", {
798
798
  id: integer("id").primaryKey(),
799
799
  provider: text("provider").notNull(),
@@ -2289,7 +2289,7 @@ var storeSettings = sqliteTable("store_settings", {
2289
2289
  at: integer("at").notNull()
2290
2290
  });
2291
2291
 
2292
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
2292
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
2293
2293
  var ARMS = [
2294
2294
  [
2295
2295
  "message",
@@ -2416,7 +2416,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
2416
2416
  return recomputed;
2417
2417
  }, "drainInvolvementQueue");
2418
2418
 
2419
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/mentions.js
2419
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/mentions.js
2420
2420
  import { domainToUnicode } from "node:url";
2421
2421
 
2422
2422
  // node_modules/.pnpm/psl@1.15.0/node_modules/psl/dist/psl.mjs
@@ -12438,7 +12438,7 @@ var oa = /* @__PURE__ */ __name((e) => {
12438
12438
  }, "oa");
12439
12439
  var na = { parse: O, get: aa, isValid: oa };
12440
12440
 
12441
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
12441
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
12442
12442
  var LINK = /https?:\/\/(?:(?:docs|drive|sheets|slides)\.google\.com|forms\.gle)(?:[/?#][^\s<>"'`]*)?/gi;
12443
12443
  var ID = /^[\w-]{10,}$/;
12444
12444
  var trimUrl = /* @__PURE__ */ __name((url) => {
@@ -12479,7 +12479,7 @@ var googleDocumentLinks = /* @__PURE__ */ __name((text5) => [...text5.matchAll(L
12479
12479
  return { url, documentId: googleDocumentId(url) };
12480
12480
  }), "googleDocumentLinks");
12481
12481
 
12482
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
12482
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
12483
12483
  var PHONE_PLANS = [
12484
12484
  {
12485
12485
  country: "us",
@@ -12859,7 +12859,7 @@ var PHONE_PLANS = [
12859
12859
  }
12860
12860
  ];
12861
12861
 
12862
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/phones.js
12862
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/phones.js
12863
12863
  var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
12864
12864
  var DEFAULT_PHONE_COUNTRIES = ["ru"];
12865
12865
  var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
@@ -12900,7 +12900,7 @@ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
12900
12900
  return void 0;
12901
12901
  }, "nationalPhone");
12902
12902
 
12903
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/places.js
12903
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/places.js
12904
12904
  var BEFORE = [
12905
12905
  [/^(?:ул\.?|улиц[аеыу]|улицей)$/iu, "\u0443\u043B\u0438\u0446\u0430"],
12906
12906
  [/^(?:пр-т|просп\.?|проспект[аеу]?)$/iu, "\u043F\u0440\u043E\u0441\u043F\u0435\u043A\u0442"],
@@ -13160,7 +13160,7 @@ var findPlaces = /* @__PURE__ */ __name((text5) => {
13160
13160
  return found2.sort((a, b) => a.start - b.start);
13161
13161
  }, "findPlaces");
13162
13162
 
13163
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/mentions.js
13163
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/mentions.js
13164
13164
  var MENTION_KINDS = ["phone", "email", "url", "document", "person-name", "place"];
13165
13165
  var MENTION_VERSIONS = {
13166
13166
  phone: 1,
@@ -13350,7 +13350,7 @@ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE
13350
13350
  };
13351
13351
  }, "typedPhone");
13352
13352
 
13353
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/first-names.js
13353
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/first-names.js
13354
13354
  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";
13355
13355
  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";
13356
13356
  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";
@@ -13358,7 +13358,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
13358
13358
  var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
13359
13359
  var NAME_WORDS = WORDS.split(" ");
13360
13360
 
13361
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/person-names.js
13361
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/person-names.js
13362
13362
  var LATIN_TO_CYRILLIC = {
13363
13363
  shch: "\u0449",
13364
13364
  sch: "\u0449",
@@ -13566,7 +13566,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text5, stem, taken) => {
13566
13566
  return found2;
13567
13567
  }, "findUnknownNames");
13568
13568
 
13569
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/attachments.js
13569
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/attachments.js
13570
13570
  var NOT_FILES = /* @__PURE__ */ new Set([
13571
13571
  "webpage",
13572
13572
  "share",
@@ -13598,7 +13598,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored3, files2) => {
13598
13598
  });
13599
13599
  }, "matchDownloads");
13600
13600
 
13601
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
13601
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
13602
13602
  var QUERY_VERSION = 1;
13603
13603
  var QUERY_LIMITS2 = {
13604
13604
  ...QUERY_LIMITS,
@@ -13629,7 +13629,7 @@ function exhausted(budget) {
13629
13629
  }
13630
13630
  __name(exhausted, "exhausted");
13631
13631
 
13632
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
13632
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
13633
13633
  var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
13634
13634
  var literal2 = /* @__PURE__ */ __name((c) => ({
13635
13635
  kind: "char",
@@ -14029,7 +14029,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
14029
14029
  return out;
14030
14030
  }, "foldRegex");
14031
14031
 
14032
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
14032
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
14033
14033
  var PRESET_VERSION = 1;
14034
14034
  var PRESETS = {
14035
14035
  password: {
@@ -14083,7 +14083,7 @@ var PRESETS = {
14083
14083
  }
14084
14084
  };
14085
14085
 
14086
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
14086
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
14087
14087
  var FIELD_VERSION = 2;
14088
14088
  var UNITS = {
14089
14089
  "": 1,
@@ -14583,12 +14583,12 @@ var QUERY_OPERATORS = [
14583
14583
  { name: "boost / minimum / intervals", example: "invoice^2", semantics: "query.unsupported-operator" }
14584
14584
  ];
14585
14585
 
14586
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
14586
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
14587
14587
  var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
14588
14588
  var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
14589
14589
  var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
14590
14590
 
14591
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
14591
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
14592
14592
  var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
14593
14593
  var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
14594
14594
  var linkMatch = /* @__PURE__ */ __name((field3, typed, mail, mentioned2) => {
@@ -14612,7 +14612,7 @@ var linkMatch = /* @__PURE__ */ __name((field3, typed, mail, mentioned2) => {
14612
14612
  };
14613
14613
  }, "linkMatch");
14614
14614
 
14615
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
14615
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
14616
14616
  var SETTING = "phoneCountries";
14617
14617
  var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
14618
14618
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
@@ -14643,7 +14643,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
14643
14643
  return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
14644
14644
  }, "valueMatch");
14645
14645
 
14646
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
14646
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
14647
14647
  var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
14648
14648
  if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
14649
14649
  throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
@@ -14671,7 +14671,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
14671
14671
  return 2 * intersection2 / (aa2.size + bb.size);
14672
14672
  }, "vocabularySimilarity");
14673
14673
 
14674
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
14674
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
14675
14675
  import { createHash } from "node:crypto";
14676
14676
  var folded2 = /* @__PURE__ */ __name((name) => {
14677
14677
  try {
@@ -14737,7 +14737,7 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind3, by, options
14737
14737
  });
14738
14738
  }, "guardTagCreation");
14739
14739
 
14740
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
14740
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
14741
14741
  var invalid = /* @__PURE__ */ __name((message2) => {
14742
14742
  throw new CliError("validation_error", message2);
14743
14743
  }, "invalid");
@@ -14814,7 +14814,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
14814
14814
  };
14815
14815
  }, "createTagRedirectIndex");
14816
14816
 
14817
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
14817
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
14818
14818
  var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
14819
14819
  const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
14820
14820
  if (!row2)
@@ -14842,7 +14842,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
14842
14842
  return snapshot2;
14843
14843
  }, "tagRedirectSnapshot");
14844
14844
 
14845
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
14845
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
14846
14846
  import { createHash as createHash2 } from "node:crypto";
14847
14847
  var TASK_KEY_PREFIXES = {
14848
14848
  question: "Q",
@@ -14870,7 +14870,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
14870
14870
  return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
14871
14871
  }, "taskAccountOf");
14872
14872
 
14873
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
14873
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
14874
14874
  var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
14875
14875
  var REFERABLE = {
14876
14876
  note: { tombstone: true },
@@ -15028,11 +15028,11 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
15028
15028
  }, "taskIdOf");
15029
15029
  var canonicalThingReference = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith("meeting:") ? canonicalMeetingReference(reference2) : canonicalReference(reference2), "canonicalThingReference");
15030
15030
 
15031
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
15032
- var toMs = /* @__PURE__ */ __name((iso10) => {
15033
- if (iso10 === null || iso10 === void 0)
15031
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
15032
+ var toMs = /* @__PURE__ */ __name((iso11) => {
15033
+ if (iso11 === null || iso11 === void 0)
15034
15034
  return null;
15035
- const ms = Date.parse(iso10);
15035
+ const ms = Date.parse(iso11);
15036
15036
  return Number.isNaN(ms) ? null : ms;
15037
15037
  }, "toMs");
15038
15038
  var toIso = /* @__PURE__ */ __name((ms) => typeof ms === "number" ? new Date(ms).toISOString() : null, "toIso");
@@ -15042,7 +15042,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
15042
15042
  var DELIVERY = { delivered: 1, read: 2 };
15043
15043
  var deliveryOf = /* @__PURE__ */ __name((stored3) => stored3 === DELIVERY.read ? "read" : stored3 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
15044
15044
 
15045
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
15045
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
15046
15046
  var TAG_KINDS = ["tag", "topic"];
15047
15047
  var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
15048
15048
  var TAG_TYPE = {
@@ -15233,7 +15233,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
15233
15233
  return result;
15234
15234
  }, "tagsOf");
15235
15235
 
15236
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
15236
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
15237
15237
  var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
15238
15238
  var SPEECH = speech("att");
15239
15239
  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");
@@ -15588,7 +15588,7 @@ var FIELD_COMPILERS = {
15588
15588
  subject
15589
15589
  };
15590
15590
 
15591
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
15591
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
15592
15592
  var placeOf = /* @__PURE__ */ __name((database) => {
15593
15593
  const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
15594
15594
  const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
@@ -15604,7 +15604,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
15604
15604
  };
15605
15605
  }, "placeOf");
15606
15606
 
15607
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
15607
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
15608
15608
  var DRAIN_ON_WRITE = 500;
15609
15609
  var METHOD = "rules";
15610
15610
  var telegramLink = /* @__PURE__ */ __name((database) => {
@@ -15767,7 +15767,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
15767
15767
  return queued.length;
15768
15768
  }, "drainMentions");
15769
15769
 
15770
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
15770
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
15771
15771
  var indexRow = /* @__PURE__ */ __name((database, name) => {
15772
15772
  const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
15773
15773
  if (!exists2)
@@ -15775,7 +15775,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
15775
15775
  return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
15776
15776
  }, "indexRow");
15777
15777
 
15778
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
15778
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
15779
15779
  var INDEX = "message_stems";
15780
15780
  var SETTING2 = "searchStemmers";
15781
15781
  var DRAIN_ON_WRITE2 = 500;
@@ -15878,14 +15878,14 @@ var stemWriter = /* @__PURE__ */ __name((database, stemmer) => {
15878
15878
  };
15879
15879
  }, "stemWriter");
15880
15880
  var nextQueued = /* @__PURE__ */ __name((database, limit) => database.prepare("SELECT id AS pk FROM message_stems_pending ORDER BY id LIMIT ?").all(limit).map((row2) => Number(row2.pk)), "nextQueued");
15881
- var drainStems = /* @__PURE__ */ __name((database, stemmerFor, limit = DRAIN_ON_WRITE2) => {
15881
+ var drainStems = /* @__PURE__ */ __name((database, stemmerFor2, limit = DRAIN_ON_WRITE2) => {
15882
15882
  const pks = nextQueued(database, limit);
15883
15883
  if (pks.length === 0)
15884
15884
  return 0;
15885
15885
  const stemmers = storeStemmers(database);
15886
15886
  if (!stemmers)
15887
15887
  return 0;
15888
- const stemmer = stemmerFor(stemmers);
15888
+ const stemmer = stemmerFor2(stemmers);
15889
15889
  return claim(database, stemmer.identity) ? stemWriter(database, stemmer).queued(pks) : 0;
15890
15890
  }, "drainStems");
15891
15891
  var stemmerCache = /* @__PURE__ */ __name(() => {
@@ -15897,7 +15897,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
15897
15897
  };
15898
15898
  }, "stemmerCache");
15899
15899
 
15900
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
15900
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
15901
15901
  var SQLITE_BUSY = 5;
15902
15902
  var pause = new Int32Array(new SharedArrayBuffer(4));
15903
15903
  var isBusy = /* @__PURE__ */ __name((error) => {
@@ -15934,7 +15934,14 @@ var connectionOf = /* @__PURE__ */ __name((database) => {
15934
15934
  return connection;
15935
15935
  }, "connectionOf");
15936
15936
  var write = /* @__PURE__ */ __name((database, body2, { beforeCommit } = {}) => transact(database, body2, true, beforeCommit), "write");
15937
- var writeBatch = /* @__PURE__ */ __name((database, body2) => transact(database, body2, false), "writeBatch");
15937
+ var writeBatch = /* @__PURE__ */ __name((database, body2) => {
15938
+ const outer = connectionOf(database).depth === 0;
15939
+ const result = transact(database, body2, false);
15940
+ if (outer)
15941
+ Atomics.wait(pause, 0, 0, BATCH_PAUSE_MS);
15942
+ return result;
15943
+ }, "writeBatch");
15944
+ var BATCH_PAUSE_MS = 2;
15938
15945
  var transact = /* @__PURE__ */ __name((database, body2, drain, beforeCommit) => {
15939
15946
  const connection = connectionOf(database);
15940
15947
  if (connection.reading)
@@ -15985,7 +15992,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
15985
15992
  }
15986
15993
  }, "read");
15987
15994
 
15988
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
15995
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
15989
15996
  var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
15990
15997
  coalesce(CASE k.chunkable_type
15991
15998
  WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
@@ -16127,7 +16134,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
16127
16134
  }, "dropUnusedVectors");
16128
16135
  var dropAllUnusedVectors = /* @__PURE__ */ __name((database) => database.prepare("DELETE FROM embeddings WHERE NOT EXISTS (SELECT 1 FROM chunks k WHERE k.content_hash = embeddings.content_hash) RETURNING 1").all().length, "dropAllUnusedVectors");
16129
16136
 
16130
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
16137
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
16131
16138
  var accountPk = /* @__PURE__ */ __name(({ orm, now: now2 }, { provider, account, scope: scope3 }, name = null) => Number(orm.insert(accounts).values({ provider, externalId: account, name, scope: scope3 ?? "personal", createdAt: now2(), updatedAt: now2() }).onConflictDoUpdate({
16132
16139
  target: [accounts.provider, accounts.externalId],
16133
16140
  set: {
@@ -16233,7 +16240,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
16233
16240
  AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
16234
16241
  }, "dropOrphanPeople");
16235
16242
 
16236
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
16243
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
16237
16244
  var FOLDED = [
16238
16245
  { table: "tasks", column: "title" },
16239
16246
  { table: "tasks", column: "close_reason" },
@@ -16270,7 +16277,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
16270
16277
  return filled2;
16271
16278
  }, "fillFolded");
16272
16279
 
16273
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
16280
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
16274
16281
  import { createHash as createHash3 } from "node:crypto";
16275
16282
  var CHUNK_CHARS = 1200;
16276
16283
  var CHUNK_OVERLAP = 150;
@@ -16375,7 +16382,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
16375
16382
  return chunks2;
16376
16383
  }, "cutChunks");
16377
16384
 
16378
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/search/task-signature.js
16385
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/task-signature.js
16379
16386
  var DAY = 864e5;
16380
16387
  var CURRENCY = [
16381
16388
  [/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
@@ -16492,7 +16499,7 @@ var dueDayOf = /* @__PURE__ */ __name((text5, createdMs) => {
16492
16499
  return best?.day ?? null;
16493
16500
  }, "dueDayOf");
16494
16501
 
16495
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
16502
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
16496
16503
  var DAY2 = 864e5;
16497
16504
  var STOP_WORDS = new Set([
16498
16505
  // Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
@@ -16647,7 +16654,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
16647
16654
  ...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
16648
16655
  })).sort((a, b) => b.score - a.score), "rankCandidates");
16649
16656
 
16650
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
16657
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
16651
16658
  var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
16652
16659
  r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
16653
16660
  JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
@@ -16918,7 +16925,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
16918
16925
  };
16919
16926
  }, "readiness");
16920
16927
 
16921
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
16928
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
16922
16929
  var DOCUMENT_PICTURE = "document_picture";
16923
16930
  var SCAN_PAGE2 = 5e3;
16924
16931
  var idOf = /* @__PURE__ */ __name((ref3) => {
@@ -16981,7 +16988,7 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
16981
16988
  }, "nearestPictures")
16982
16989
  }), "documentPicturesOver");
16983
16990
 
16984
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
16991
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
16985
16992
  var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
16986
16993
  const literal4 = escaped2 ?? plain2 ?? "";
16987
16994
  return wildcard ?? (/[*?[]/u.test(literal4) ? `[${literal4}]` : literal4);
@@ -17046,7 +17053,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
17046
17053
  var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
17047
17054
  var bound2 = /* @__PURE__ */ __name(({ sql: text5, params }) => sql.join(text5.split("?").map((part, at) => at < params.length ? sql`${sql.raw(part)}${params[at]}` : sql.raw(part)), sql``), "bound");
17048
17055
 
17049
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
17056
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
17050
17057
  var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
17051
17058
  var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
17052
17059
  var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
@@ -17136,7 +17143,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
17136
17143
  });
17137
17144
  }, "linkMeeting");
17138
17145
 
17139
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
17146
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
17140
17147
  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), ''))";
17141
17148
  var UNSEARCHED_EVENT_TYPES = [
17142
17149
  "working-location",
@@ -17320,7 +17327,7 @@ var writer2 = /* @__PURE__ */ __name((database, corpus, stemmer) => {
17320
17327
  statements.dequeue.run(queuedAs(corpus), id2);
17321
17328
  };
17322
17329
  }, "writer");
17323
- var drainCorpus = /* @__PURE__ */ __name((database, corpus, stemmerFor, { batch = 200, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
17330
+ var drainCorpus = /* @__PURE__ */ __name((database, corpus, stemmerFor2, { batch = 200, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
17324
17331
  if (corpus.type === "email" || corpus.type === "document")
17325
17332
  database.prepare(`UPDATE chunks SET account_id = (SELECT account_id FROM ${corpus.table} WHERE id = chunks.chunkable_id)
17326
17333
  WHERE chunkable_type = ? AND account_id IS NULL`).run(corpus.type);
@@ -17328,7 +17335,7 @@ var drainCorpus = /* @__PURE__ */ __name((database, corpus, stemmerFor, { batch
17328
17335
  const state = corpusIndexState(database, corpus);
17329
17336
  if (state.wanted === null)
17330
17337
  return 0;
17331
- const stemmer = stemmerFor(savedStemmers(database) ?? DEFAULT_STEMMERS);
17338
+ const stemmer = stemmerFor2(savedStemmers(database) ?? DEFAULT_STEMMERS);
17332
17339
  const queue = `${corpus.type}_index_pending`;
17333
17340
  if (state.built !== stemmer.identity) {
17334
17341
  write(database, () => {
@@ -17357,7 +17364,7 @@ var drainCorpus = /* @__PURE__ */ __name((database, corpus, stemmerFor, { batch
17357
17364
  }
17358
17365
  return done;
17359
17366
  }, "drainCorpus");
17360
- var drainNoteIndex = /* @__PURE__ */ __name((database, stemmerFor, options = {}) => drainCorpus(database, CORPORA.document, stemmerFor, options) + drainCorpus(database, CORPORA.note, stemmerFor, options) + fillTrigrams(database, options), "drainNoteIndex");
17367
+ var drainNoteIndex = /* @__PURE__ */ __name((database, stemmerFor2, options = {}) => drainCorpus(database, CORPORA.document, stemmerFor2, options) + drainCorpus(database, CORPORA.note, stemmerFor2, options) + fillTrigrams(database, options), "drainNoteIndex");
17361
17368
  var resetNoteIndex = /* @__PURE__ */ __name((database) => {
17362
17369
  write(database, () => {
17363
17370
  for (const corpus of Object.values(CORPORA))
@@ -17366,7 +17373,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
17366
17373
  return true;
17367
17374
  }, "resetNoteIndex");
17368
17375
 
17369
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
17376
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
17370
17377
  var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
17371
17378
  var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
17372
17379
  for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
@@ -17385,7 +17392,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
17385
17392
  }
17386
17393
  }, "resolvePersonLinks");
17387
17394
 
17388
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
17395
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
17389
17396
  var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
17390
17397
  var prepare = /* @__PURE__ */ __name((orm) => ({
17391
17398
  find: orm.select({
@@ -17610,7 +17617,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
17610
17617
  }, "meetingIdentityPk");
17611
17618
  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");
17612
17619
 
17613
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
17620
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
17614
17621
  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");
17615
17622
  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");
17616
17623
  var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
@@ -17890,7 +17897,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
17890
17897
  }
17891
17898
  }, "replaceAutoTags");
17892
17899
 
17893
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
17900
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
17894
17901
  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");
17895
17902
  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;
17896
17903
  var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
@@ -17971,7 +17978,7 @@ var mailCore = /* @__PURE__ */ __name((body2, earlier) => {
17971
17978
  return withoutSignOff(withoutGreeting(kept)).join("\n").trim();
17972
17979
  }, "mailCore");
17973
17980
 
17974
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
17981
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
17975
17982
  var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
17976
17983
  var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
17977
17984
  k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
@@ -18038,7 +18045,7 @@ var chunkAttachments = /* @__PURE__ */ __name((database, accountId, emailId, now
18038
18045
  }, "chunkAttachments");
18039
18046
  var MAIL_CUT = "mail_pieces_cut";
18040
18047
  var CUT = "email";
18041
- var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor) => {
18048
+ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
18042
18049
  if (database.prepare("SELECT value FROM store_settings WHERE key = ?").get(MAIL_CUT)?.value !== CUT)
18043
18050
  write(database, () => {
18044
18051
  const single = database.prepare("SELECT DISTINCT content_hash AS hash FROM chunks WHERE chunkable_type = 'email'").all().map(({ hash: hash2 }) => String(hash2));
@@ -18061,7 +18068,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor) => {
18061
18068
  dropUnusedVectors(database, before2);
18062
18069
  }
18063
18070
  });
18064
- const emails3 = drainCorpus(database, CORPORA.email, stemmerFor);
18071
+ const emails3 = drainCorpus(database, CORPORA.email, stemmerFor2);
18065
18072
  const next = database.prepare("SELECT id FROM email_index_pending WHERE indexable_type = 'email_thread' ORDER BY id LIMIT 50");
18066
18073
  const done = database.prepare("DELETE FROM email_index_pending WHERE indexable_type = 'email_thread' AND id = ?");
18067
18074
  let threads = 0;
@@ -18081,7 +18088,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor) => {
18081
18088
  return emails3 + threads;
18082
18089
  }, "drainEmailIndex");
18083
18090
 
18084
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
18091
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
18085
18092
  var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
18086
18093
  SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
18087
18094
  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,
@@ -18127,7 +18134,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
18127
18134
  leave.run(emailId, Number(box.id), emailId, Number(box.id));
18128
18135
  }, "forgetLocations");
18129
18136
 
18130
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
18137
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
18131
18138
  var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
18132
18139
  emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
18133
18140
  last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
@@ -18177,7 +18184,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
18177
18184
  return threads.length;
18178
18185
  }, "markEmailsRestored");
18179
18186
 
18180
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
18187
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
18181
18188
  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");
18182
18189
  var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
18183
18190
  var ruleOf = /* @__PURE__ */ __name((row2) => ({
@@ -18244,7 +18251,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
18244
18251
  }
18245
18252
  }), "mailRulesOver");
18246
18253
 
18247
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
18254
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
18248
18255
  var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
18249
18256
  database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
18250
18257
  VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
@@ -18252,7 +18259,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
18252
18259
  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);
18253
18260
  }, "reviewLink");
18254
18261
 
18255
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
18262
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
18256
18263
  function checkMeetingCancelled(signal) {
18257
18264
  if (!signal?.aborted)
18258
18265
  return;
@@ -18263,7 +18270,7 @@ function checkMeetingCancelled(signal) {
18263
18270
  }
18264
18271
  __name(checkMeetingCancelled, "checkMeetingCancelled");
18265
18272
 
18266
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
18273
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
18267
18274
  var meetingOf = /* @__PURE__ */ __name((row2) => ({
18268
18275
  id: Number(row2.id),
18269
18276
  accountId: Number(row2.account_id),
@@ -18313,7 +18320,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
18313
18320
  createdAt: Number(row2.created_at)
18314
18321
  }), "transcriptRowOf");
18315
18322
 
18316
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
18323
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
18317
18324
  var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
18318
18325
  var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
18319
18326
  var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
@@ -18480,7 +18487,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
18480
18487
  }
18481
18488
  }), "meetingReadsOver");
18482
18489
 
18483
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
18490
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
18484
18491
  var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
18485
18492
  const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
18486
18493
  const params = [input.accountId];
@@ -18523,7 +18530,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
18523
18530
  return { clauses, params };
18524
18531
  }, "meetingSelectionSql");
18525
18532
 
18526
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
18533
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
18527
18534
  var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
18528
18535
  async meetingChatLines(input) {
18529
18536
  checkMeetingCancelled(input.signal);
@@ -18551,7 +18558,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
18551
18558
  }
18552
18559
  }), "meetingChatLinesOver");
18553
18560
 
18554
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
18561
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
18555
18562
  var MESSAGE_FIELDS = {
18556
18563
  pk: messages.id,
18557
18564
  nativeId: messages.externalId,
@@ -18718,7 +18725,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
18718
18725
  storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
18719
18726
  }), "chatActivity");
18720
18727
 
18721
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
18728
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
18722
18729
  var HIT_FIELDS = {
18723
18730
  ...MESSAGE_FIELDS,
18724
18731
  chatTitle: sql`${chats.title}`.as("chat_title"),
@@ -18817,7 +18824,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
18817
18824
  };
18818
18825
  }, "directReplies");
18819
18826
 
18820
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
18827
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
18821
18828
  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");
18822
18829
  var required = /* @__PURE__ */ __name((context, ref3) => {
18823
18830
  const found2 = identityRow(context, ref3);
@@ -18948,7 +18955,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
18948
18955
  }, "mentioning");
18949
18956
  var escaped = /* @__PURE__ */ __name((text5) => text5.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
18950
18957
 
18951
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
18958
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
18952
18959
  var missing2 = /* @__PURE__ */ __name(() => {
18953
18960
  throw new CliError("not_found", "Meeting, participant or selected target not found");
18954
18961
  }, "missing");
@@ -19070,7 +19077,7 @@ function meetingContextLinksOver(context) {
19070
19077
  }
19071
19078
  __name(meetingContextLinksOver, "meetingContextLinksOver");
19072
19079
 
19073
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
19080
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
19074
19081
  var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
19075
19082
  var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
19076
19083
  var summaryOf = /* @__PURE__ */ __name((row2) => ({
@@ -19099,7 +19106,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
19099
19106
  return row2 ? summaryText(summaryOf(row2)) : null;
19100
19107
  }, "indexedText");
19101
19108
 
19102
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
19109
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
19103
19110
  var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
19104
19111
  var meetingCurrentIndexRows = `
19105
19112
  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
@@ -19130,7 +19137,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
19130
19137
  }, "invalidateMeetingStems");
19131
19138
  var meetingStemmableText = /* @__PURE__ */ __name((text5) => text5.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
19132
19139
 
19133
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
19140
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
19134
19141
  function meetingHitIndexOver({ database, now: now2 }) {
19135
19142
  return {
19136
19143
  async indexSearch(original) {
@@ -19198,10 +19205,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
19198
19205
  }
19199
19206
  __name(meetingHitIndexOver, "meetingHitIndexOver");
19200
19207
 
19201
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19208
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19202
19209
  import { createHash as createHash4 } from "node:crypto";
19203
19210
 
19204
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/search/trigrams.js
19211
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/trigrams.js
19205
19212
  var trigrams = /* @__PURE__ */ __name((term) => {
19206
19213
  const padded = ` ${term} `;
19207
19214
  const pieces = /* @__PURE__ */ new Set();
@@ -19210,7 +19217,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
19210
19217
  return [...pieces];
19211
19218
  }, "trigrams");
19212
19219
 
19213
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/search/correct.js
19220
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/correct.js
19214
19221
  var SHORTEST_CORRECTION = 3;
19215
19222
  var maxEdits = /* @__PURE__ */ __name((word) => word.length <= 4 ? 1 : 2, "maxEdits");
19216
19223
  var editDistance = /* @__PURE__ */ __name((a, b, max) => {
@@ -19257,7 +19264,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
19257
19264
  return corrections;
19258
19265
  }, "correctWords");
19259
19266
 
19260
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/search/garbled.js
19267
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/garbled.js
19261
19268
  var SHORTEST_GARBLED = 4;
19262
19269
  var MOST_WIDENED = 64;
19263
19270
  var plain = /* @__PURE__ */ __name((word) => word.replaceAll("\u044D", "\u0435"), "plain");
@@ -19349,7 +19356,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
19349
19356
  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((word) => word.term));
19350
19357
  }, "widenWords");
19351
19358
 
19352
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
19359
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
19353
19360
  import { readFileSync } from "node:fs";
19354
19361
  var loaded;
19355
19362
  var dictionary = /* @__PURE__ */ __name(() => {
@@ -19408,7 +19415,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word) => {
19408
19415
  return false;
19409
19416
  }, "knownRussianWord");
19410
19417
 
19411
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
19418
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
19412
19419
  var WORD2 = /[\p{L}\p{N}\p{M}]+/gu;
19413
19420
  var MOST_WORDS = 128;
19414
19421
  var quote = /* @__PURE__ */ __name((word) => `"${word.replaceAll('"', '""')}"`, "quote");
@@ -19635,7 +19642,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text5, stemmer) => {
19635
19642
  return check3(tree);
19636
19643
  }, "matchMeetingText");
19637
19644
 
19638
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19645
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19639
19646
  var fail3 = /* @__PURE__ */ __name((message2) => {
19640
19647
  throw new CliError("validation_error", message2);
19641
19648
  }, "fail");
@@ -19812,7 +19819,7 @@ function meetingHitSearchOver({ database }) {
19812
19819
  }
19813
19820
  __name(meetingHitSearchOver, "meetingHitSearchOver");
19814
19821
 
19815
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
19822
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
19816
19823
  import { createHash as createHash5 } from "node:crypto";
19817
19824
  var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
19818
19825
  if (value === void 0)
@@ -19902,7 +19909,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
19902
19909
  }
19903
19910
  }), "meetingParticipantSearchOver");
19904
19911
 
19905
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
19912
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
19906
19913
  var preparationQueries = {
19907
19914
  participants: {
19908
19915
  fields: "p.id, p.identity_id, p.display_name, l.person_id",
@@ -19952,7 +19959,7 @@ var preparationQueries = {
19952
19959
  }
19953
19960
  };
19954
19961
 
19955
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
19962
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
19956
19963
  var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
19957
19964
  async preparationContext(original) {
19958
19965
  const input = validateMeetingPreparationContext(original);
@@ -19993,7 +20000,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
19993
20000
  }
19994
20001
  }), "meetingPreparationContextOver");
19995
20002
 
19996
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
20003
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
19997
20004
  var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
19998
20005
  SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
19999
20006
  WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
@@ -20007,7 +20014,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
20007
20014
  JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
20008
20015
  )`, "preparationSubjects");
20009
20016
 
20010
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
20017
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
20011
20018
  var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
20012
20019
  async preparationKnowledge(original) {
20013
20020
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -20052,7 +20059,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
20052
20059
  }
20053
20060
  }), "meetingPreparationKnowledgeOver");
20054
20061
 
20055
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
20062
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
20056
20063
  var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
20057
20064
  async preparationNotes(original) {
20058
20065
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -20105,7 +20112,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
20105
20112
  }
20106
20113
  }), "meetingPreparationNotesOver");
20107
20114
 
20108
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
20115
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
20109
20116
  var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20110
20117
  async relatedHistory(original) {
20111
20118
  const input = validateMeetingRelatedHistory(original);
@@ -20176,7 +20183,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20176
20183
  }
20177
20184
  }), "meetingRelatedHistoryOver");
20178
20185
 
20179
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
20186
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
20180
20187
  var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
20181
20188
  var text2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
20182
20189
  var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
@@ -20257,7 +20264,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
20257
20264
  }
20258
20265
  }), "meetingReviewOver");
20259
20266
 
20260
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
20267
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
20261
20268
  var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
20262
20269
  var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
20263
20270
  if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
@@ -20311,7 +20318,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20311
20318
  }
20312
20319
  }), "meetingSeriesHistoryOver");
20313
20320
 
20314
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
20321
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
20315
20322
  var MOST_ROWS = 5e5;
20316
20323
  var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
20317
20324
  async meetingStats(input) {
@@ -20358,7 +20365,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
20358
20365
  }
20359
20366
  }), "meetingStatsOver");
20360
20367
 
20361
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
20368
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
20362
20369
  var CURSOR_KEY = "meetings";
20363
20370
  var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
20364
20371
  id: Number(row2.id),
@@ -20910,7 +20917,33 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
20910
20917
  };
20911
20918
  }, "meetingStoreOver");
20912
20919
 
20913
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
20920
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
20921
+ var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
20922
+ const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
20923
+ return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
20924
+ }, "syncStateOf");
20925
+ var writeState = /* @__PURE__ */ __name(({ orm, now: now2 }, accountKey, name, value) => {
20926
+ orm.insert(syncCursors).values({ accountId: accountKey, key: name, value, createdAt: now2(), updatedAt: now2() }).onConflictDoUpdate({
20927
+ target: [syncCursors.accountId, syncCursors.key],
20928
+ set: { value: sql`excluded.value`, updatedAt: sql`excluded.updated_at` }
20929
+ }).run();
20930
+ }, "writeState");
20931
+ var clearState = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
20932
+ orm.delete(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).run();
20933
+ }, "clearState");
20934
+ var claim2 = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, anchor, holder, forMs) => {
20935
+ const at = now2();
20936
+ return orm.insert(fetchLeases).values({ chatId: chatKey, anchor, holder, expiresAt: at + forMs }).onConflictDoUpdate({
20937
+ target: [fetchLeases.chatId, fetchLeases.anchor],
20938
+ set: { holder: sql`excluded.holder`, expiresAt: sql`excluded.expires_at` },
20939
+ setWhere: or(eq(fetchLeases.holder, sql`excluded.holder`), lte(fetchLeases.expiresAt, at))
20940
+ }).returning({ chatId: fetchLeases.chatId }).all().length > 0;
20941
+ }, "claim");
20942
+ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
20943
+ orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
20944
+ }, "release");
20945
+
20946
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
20914
20947
  var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
20915
20948
  id: `email:${place.emailId}`,
20916
20949
  chatId: place.threadExternalId,
@@ -21243,12 +21276,21 @@ var emailHitsByPk = /* @__PURE__ */ __name((database, pks) => {
21243
21276
  ];
21244
21277
  });
21245
21278
  }, "emailHitsByPk");
21246
- var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stemmerCache()) => ({
21279
+ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemmerFor2 = stemmerCache()) => ({
21247
21280
  rules: mailRulesOver(database),
21248
21281
  async saveThread(input) {
21249
21282
  const id2 = write(database, () => saveThread(database, orm, input));
21250
21283
  return threadDetails(database, id2);
21251
21284
  },
21285
+ async saveThreads(inputs, states = []) {
21286
+ const ids = write(database, () => {
21287
+ const saved = inputs.map((input) => saveThread(database, orm, input));
21288
+ for (const { accountId, name, value } of states)
21289
+ writeState({ orm, now: now2 }, accountId, name, value);
21290
+ return saved;
21291
+ });
21292
+ return ids.map((id2) => threadDetails(database, id2));
21293
+ },
21252
21294
  async threads(filter = {}) {
21253
21295
  const [limit, offset] = page(filter);
21254
21296
  return database.prepare(`SELECT * FROM email_threads WHERE (? IS NULL OR account_id = ?) AND (? OR deleted_at IS NULL)
@@ -21307,7 +21349,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stem
21307
21349
  dmarc: str(row2.dmarc)
21308
21350
  }));
21309
21351
  },
21310
- async setSenderScores(accountId, scores, now2) {
21352
+ async setSenderScores(accountId, scores, now3) {
21311
21353
  return write(database, () => {
21312
21354
  const link3 = database.prepare(`INSERT INTO account_identities
21313
21355
  (account_id, identity_id, created_at, updated_at, mail_score, mail_signals, mail_scored_at, mail_demoted)
@@ -21316,7 +21358,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stem
21316
21358
  mail_signals = excluded.mail_signals, mail_scored_at = excluded.mail_scored_at,
21317
21359
  mail_demoted = excluded.mail_demoted`);
21318
21360
  for (const { address, score, signals, demoted } of scores)
21319
- link3.run(accountId, identityOf2(database, { address, name: null }, now2), now2, now2, score, JSON.stringify(signals), now2, demoted ? 1 : null);
21361
+ link3.run(accountId, identityOf2(database, { address, name: null }, now3), now3, now3, score, JSON.stringify(signals), now3, demoted ? 1 : null);
21320
21362
  return scores.length;
21321
21363
  });
21322
21364
  },
@@ -21329,9 +21371,9 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stem
21329
21371
  kind: str(b.kind)
21330
21372
  }));
21331
21373
  },
21332
- async setMailboxes(accountId, scanned, found2, now2) {
21374
+ async setMailboxes(accountId, scanned, found2, now3) {
21333
21375
  return write(database, () => {
21334
- const boxes = new Map(scanned.map((box) => [box.externalId, mailboxPk(database, accountId, box, now2)]));
21376
+ const boxes = new Map(scanned.map((box) => [box.externalId, mailboxPk(database, accountId, box, now3)]));
21335
21377
  const lookup = database.prepare("SELECT id FROM emails WHERE account_id = ? AND external_id = ?");
21336
21378
  const leave = database.prepare(`DELETE FROM email_mailboxes WHERE email_id = ? AND mailbox_id IN (SELECT value FROM json_each(?))
21337
21379
  AND mailbox_id NOT IN (SELECT value FROM json_each(?))`);
@@ -21348,24 +21390,24 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stem
21348
21390
  });
21349
21391
  leave.run(Number(row2.id), JSON.stringify([...boxes.values()]), JSON.stringify(kept));
21350
21392
  for (const pk of kept)
21351
- join(database, Number(row2.id), pk, now2);
21393
+ join(database, Number(row2.id), pk, now3);
21352
21394
  count++;
21353
21395
  }
21354
21396
  return count;
21355
21397
  });
21356
21398
  },
21357
- async setFlags(accountId, flags, now2) {
21399
+ async setFlags(accountId, flags, now3) {
21358
21400
  return write(database, () => {
21359
- return setEmailFlags(database, accountId, flags, now2);
21401
+ return setEmailFlags(database, accountId, flags, now3);
21360
21402
  });
21361
21403
  },
21362
21404
  folderEmails: /* @__PURE__ */ __name(async (accountId, folder, uidvalidity) => folderEmails(database, accountId, folder, uidvalidity), "folderEmails"),
21363
21405
  setLocations: /* @__PURE__ */ __name(async (accountId, folder, uidvalidity, found2) => write(database, () => setLocations(database, accountId, folder, uidvalidity, found2)), "setLocations"),
21364
21406
  forgetLocations: /* @__PURE__ */ __name(async (accountId, folder, uidvalidity, uids) => write(database, () => forgetLocations(database, accountId, folder, uidvalidity, uids)), "forgetLocations"),
21365
- markDeleted: /* @__PURE__ */ __name(async (accountId, externalIds, now2) => write(database, () => markEmailsDeleted(database, accountId, externalIds, now2)), "markDeleted"),
21366
- markRestored: /* @__PURE__ */ __name(async (accountId, externalIds, now2) => write(database, () => markEmailsRestored(database, accountId, externalIds, now2)), "markRestored"),
21407
+ markDeleted: /* @__PURE__ */ __name(async (accountId, externalIds, now3) => write(database, () => markEmailsDeleted(database, accountId, externalIds, now3)), "markDeleted"),
21408
+ markRestored: /* @__PURE__ */ __name(async (accountId, externalIds, now3) => write(database, () => markEmailsRestored(database, accountId, externalIds, now3)), "markRestored"),
21367
21409
  async chunksToEmbed(model, { after: after2, limit }) {
21368
- drainEmailIndex(database, stemmerFor);
21410
+ drainEmailIndex(database, stemmerFor2);
21369
21411
  const file = database.prepare("SELECT text FROM attachments WHERE id = ?");
21370
21412
  const threads = /* @__PURE__ */ new Map();
21371
21413
  return database.prepare(`SELECT p.content_hash AS hash, min(p.type || ':' || p.owner) AS owner, p.position, p.start_offset AS start,
@@ -21387,7 +21429,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stem
21387
21429
  });
21388
21430
  },
21389
21431
  async nearest(model, query, { accountId, limit, threadExternalId, since }) {
21390
- drainEmailIndex(database, stemmerFor);
21432
+ drainEmailIndex(database, stemmerFor2);
21391
21433
  const page3 = database.prepare(`SELECT p.id, p.type, p.owner, p.position, p.email_id AS email, v.vector FROM ${MAIL_PIECES}
21392
21434
  JOIN embeddings v ON v.model = ? AND v.content_hash = p.content_hash
21393
21435
  WHERE p.id > ? AND p.account_id = ?
@@ -21450,7 +21492,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stem
21450
21492
  if (match === null)
21451
21493
  return [];
21452
21494
  const [limit, offset] = page(filter);
21453
- drainEmailIndex(database, stemmerFor);
21495
+ drainEmailIndex(database, stemmerFor2);
21454
21496
  const [where, params] = emailWhere({ ...filter, includeDeleted: false });
21455
21497
  return database.prepare(`SELECT e.* FROM email_words w JOIN emails e ON e.id = w.rowid
21456
21498
  WHERE email_words MATCH ? AND ${where}
@@ -21458,7 +21500,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stem
21458
21500
  }
21459
21501
  }), "mailStoreOver");
21460
21502
 
21461
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/search/dictionary.js
21503
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/dictionary.js
21462
21504
  import { readFileSync as readFileSync2 } from "node:fs";
21463
21505
  var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
21464
21506
  var folded4 = /* @__PURE__ */ __name((word) => /^[а-яё'-]*$/.test(word) ? word.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word), "folded");
@@ -21548,7 +21590,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
21548
21590
  }, "knownWord");
21549
21591
  var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
21550
21592
 
21551
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
21593
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
21552
21594
  var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
21553
21595
  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");
21554
21596
  var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
@@ -21634,7 +21676,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
21634
21676
  return found2;
21635
21677
  }, "spokenTranscripts");
21636
21678
 
21637
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
21679
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
21638
21680
  var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
21639
21681
  const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
21640
21682
  if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
@@ -21681,7 +21723,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
21681
21723
  });
21682
21724
  }, "placeHits");
21683
21725
 
21684
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
21726
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
21685
21727
  var MESSAGES2 = {
21686
21728
  rows: "messages",
21687
21729
  threads: "chats",
@@ -21717,6 +21759,18 @@ var GROUPS = {
21717
21759
  var matchQuery = /* @__PURE__ */ __name((context, execution) => runQuery(context, execution), "matchQuery");
21718
21760
  var countQuery = /* @__PURE__ */ __name((context, execution, by) => runQuery(context, execution, by), "countQuery");
21719
21761
  var queryMessagePks = /* @__PURE__ */ __name((context, execution) => runQuery(context, execution, "pks"), "queryMessagePks");
21762
+ var countMatches = /* @__PURE__ */ __name((context, execution, cap) => matchingPks(context, execution, cap)?.length, "countMatches");
21763
+ var matchingPks = /* @__PURE__ */ __name((context, execution, cap) => {
21764
+ const { database, check: check3, where, from: from2, withRanking, ranked, leaves } = compileQuery(context, {
21765
+ ...execution,
21766
+ newest: true
21767
+ });
21768
+ if (leaves.some(({ test }) => test))
21769
+ return void 0;
21770
+ const rows = database.prepare(`${withRanking}SELECT m.id ${from2} WHERE ${where.sql} LIMIT ?`).all(...ranked.params, ...where.params, cap + 1);
21771
+ check3();
21772
+ return rows.map(({ id: id2 }) => Number(id2));
21773
+ }, "matchingPks");
21720
21774
  var compileQuery = /* @__PURE__ */ __name((context, execution, boundedAttachments = false) => {
21721
21775
  const { database } = context;
21722
21776
  const corpus = execution.corpus === "mail" ? MAIL : MESSAGES2;
@@ -22143,7 +22197,7 @@ var runQuery = /* @__PURE__ */ __name(async (context, execution, by) => {
22143
22197
  };
22144
22198
  }, "runQuery");
22145
22199
 
22146
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
22200
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
22147
22201
  function invalidMetadata() {
22148
22202
  throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
22149
22203
  }
@@ -22245,7 +22299,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
22245
22299
  };
22246
22300
  }), "counterTargets");
22247
22301
 
22248
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
22302
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
22249
22303
  var NOT_FILE_LIST = [...NOT_FILES].map((kind3) => `'${kind3}'`).join(",");
22250
22304
  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,
22251
22305
  att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
@@ -22364,7 +22418,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
22364
22418
  }));
22365
22419
  }, "attachmentViews");
22366
22420
 
22367
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
22421
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
22368
22422
  var transcript = /* @__PURE__ */ __name(({ orm }, chatKey, messageId) => orm.select({ text: messageTranscripts.text, source: messageTranscripts.source }).from(messageTranscripts).where(and(eq(messageTranscripts.chatId, chatKey), eq(messageTranscripts.messageExternalId, messageId))).get(), "transcript");
22369
22423
  var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text5, source2) => {
22370
22424
  const { orm, database, now: now2 } = context;
@@ -22402,7 +22456,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
22402
22456
  keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
22403
22457
  }, "intoVoiceAttachment");
22404
22458
 
22405
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
22459
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
22406
22460
  var FIELDS = [
22407
22461
  "threadExternalId",
22408
22462
  "senderIdentityId",
@@ -22719,33 +22773,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
22719
22773
  reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
22720
22774
  }, "writeDerivedReactions");
22721
22775
 
22722
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
22723
- var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
22724
- const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
22725
- return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
22726
- }, "syncStateOf");
22727
- var writeState = /* @__PURE__ */ __name(({ orm, now: now2 }, accountKey, name, value) => {
22728
- orm.insert(syncCursors).values({ accountId: accountKey, key: name, value, createdAt: now2(), updatedAt: now2() }).onConflictDoUpdate({
22729
- target: [syncCursors.accountId, syncCursors.key],
22730
- set: { value: sql`excluded.value`, updatedAt: sql`excluded.updated_at` }
22731
- }).run();
22732
- }, "writeState");
22733
- var clearState = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
22734
- orm.delete(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).run();
22735
- }, "clearState");
22736
- var claim2 = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, anchor, holder, forMs) => {
22737
- const at = now2();
22738
- return orm.insert(fetchLeases).values({ chatId: chatKey, anchor, holder, expiresAt: at + forMs }).onConflictDoUpdate({
22739
- target: [fetchLeases.chatId, fetchLeases.anchor],
22740
- set: { holder: sql`excluded.holder`, expiresAt: sql`excluded.expires_at` },
22741
- setWhere: or(eq(fetchLeases.holder, sql`excluded.holder`), lte(fetchLeases.expiresAt, at))
22742
- }).returning({ chatId: fetchLeases.chatId }).all().length > 0;
22743
- }, "claim");
22744
- var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
22745
- orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
22746
- }, "release");
22747
-
22748
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/keys.js
22776
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/keys.js
22749
22777
  var keysOver = /* @__PURE__ */ __name((context) => {
22750
22778
  const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
22751
22779
  const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
@@ -22766,7 +22794,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
22766
22794
  };
22767
22795
  }, "keysOver");
22768
22796
 
22769
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
22797
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
22770
22798
  var accountGroupsOf = /* @__PURE__ */ __name((database) => {
22771
22799
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
22772
22800
  if (!row2)
@@ -22801,7 +22829,7 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
22801
22829
  database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
22802
22830
  }, "saveProfile");
22803
22831
 
22804
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
22832
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
22805
22833
  var BOT_KINDS = ["agent", "script", "integration"];
22806
22834
  var ownerPerson = /* @__PURE__ */ __name((database) => {
22807
22835
  const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
@@ -22837,7 +22865,7 @@ var originOfActor = /* @__PURE__ */ __name((database, type, id2) => {
22837
22865
  return database.prepare("SELECT name FROM bots WHERE id = ?").get(Number(id2))?.name === "rule" ? "rule" : "agent";
22838
22866
  }, "originOfActor");
22839
22867
 
22840
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
22868
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
22841
22869
  var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
22842
22870
  const owner = ownerPerson(context.database).id;
22843
22871
  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);
@@ -22858,7 +22886,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
22858
22886
  return personOf(context, ref3);
22859
22887
  }, "linkToOwner");
22860
22888
 
22861
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
22889
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
22862
22890
  var PROVIDERS_SETTING = "providers";
22863
22891
  var storedProvidersOf = /* @__PURE__ */ __name((database) => {
22864
22892
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
@@ -22893,7 +22921,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
22893
22921
  });
22894
22922
  }, "registerProvider");
22895
22923
 
22896
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
22924
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
22897
22925
  var DAY3 = 864e5;
22898
22926
  var RECENTLY_CLOSED_MS = 14 * DAY3;
22899
22927
  var TEXT_LIMIT = 20;
@@ -22906,7 +22934,7 @@ var ABOUT_TASK = ["related-to", "evidence", "created-from"];
22906
22934
  var PLACEHOLDER = /* @__PURE__ */ __name((row2) => `${String(row2.type)} \u2014 ${String(row2.source_locator ?? "")}`, "PLACEHOLDER");
22907
22935
  var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
22908
22936
  const { database, now: now2 } = context;
22909
- const stemmerFor = stemmerCache();
22937
+ const stemmerFor2 = stemmerCache();
22910
22938
  const MESSAGE = "SELECT m.id, m.text, m.sent_at, m.outgoing, p.id AS person, p.owner FROM messages m LEFT JOIN identity_links il ON il.identity_id = m.sender_identity_id LEFT JOIN persons p ON p.id = il.person_id";
22911
22939
  const messageOf = /* @__PURE__ */ __name((row2) => {
22912
22940
  const own = Number(row2.outgoing) === 1 || Number(row2.owner) === 1;
@@ -22980,7 +23008,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
22980
23008
  }, "replyChain");
22981
23009
  const COLUMNS7 = "t.id, t.project_id, t.key, t.package_id, t.title, t.description, t.type, t.status, t.source_locator, t.created_at, t.due_at, t.category";
22982
23010
  const rowOf = /* @__PURE__ */ __name((id2) => database.prepare(`SELECT ${COLUMNS7} FROM tasks t WHERE t.id = ? AND t.deleted_at IS NULL`).get(id2), "rowOf");
22983
- const subjectOf = /* @__PURE__ */ __name((subject2) => {
23011
+ const subjectOf2 = /* @__PURE__ */ __name((subject2) => {
22984
23012
  if ("task" in subject2) {
22985
23013
  const bare = subject2.task.startsWith("task:") ? subject2.task.slice("task:".length) : subject2.task;
22986
23014
  const id2 = taskRowOf(database, bare);
@@ -23009,12 +23037,12 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
23009
23037
  }, "subjectOf");
23010
23038
  return {
23011
23039
  compare: /* @__PURE__ */ __name(async (subject2, other) => {
23012
- const side = subjectOf(subject2);
23040
+ const side = subjectOf2(subject2);
23013
23041
  const id2 = taskRowOf(database, other.startsWith("task:") ? other.slice("task:".length) : other);
23014
23042
  const row2 = id2 === void 0 ? void 0 : rowOf(id2);
23015
23043
  if (!side || !row2)
23016
23044
  throw new CliError("not_found", `no task ${other}`);
23017
- const stemmer = stemmerFor(storeStemmers(database) ?? DEFAULT_STEMMERS);
23045
+ const stemmer = stemmerFor2(storeStemmers(database) ?? DEFAULT_STEMMERS);
23018
23046
  const one = linkedOf(side);
23019
23047
  const otherSide = linkedOf(sideOf(row2));
23020
23048
  const chain = chainOf(one);
@@ -23025,12 +23053,12 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
23025
23053
  });
23026
23054
  }, "compare"),
23027
23055
  similar: /* @__PURE__ */ __name(async (subject2, { limit = 10 } = {}) => {
23028
- const named2 = subjectOf(subject2);
23056
+ const named2 = subjectOf2(subject2);
23029
23057
  if (!named2)
23030
23058
  return [];
23031
23059
  const side = linkedOf(named2);
23032
- drainCorpus(database, CORPORA.task, stemmerFor);
23033
- const stemmer = stemmerFor(storeStemmers(database) ?? DEFAULT_STEMMERS);
23060
+ drainCorpus(database, CORPORA.task, stemmerFor2);
23061
+ const stemmer = stemmerFor2(storeStemmers(database) ?? DEFAULT_STEMMERS);
23034
23062
  const since = now2() - RECENTLY_CLOSED_MS;
23035
23063
  const live2 = "t.project_id = ? AND t.deleted_at IS NULL AND t.id <> ? AND (t.status = 'open' OR t.closed_at >= ?)";
23036
23064
  const scope3 = [side.project, side.row ?? -1, since];
@@ -23092,7 +23120,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
23092
23120
  };
23093
23121
  }, "taskSimilarityOver");
23094
23122
 
23095
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
23123
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
23096
23124
  var SETTING3 = "taskCategories";
23097
23125
  var savedTaskCategories = /* @__PURE__ */ __name((database) => {
23098
23126
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
@@ -23111,7 +23139,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
23111
23139
  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);
23112
23140
  }, "saveTaskCategories");
23113
23141
 
23114
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
23142
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
23115
23143
  var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
23116
23144
  var ALLOWED = "taskAgentClose";
23117
23145
  var MIN = "taskAgentCloseMin";
@@ -23167,7 +23195,50 @@ var SUGGESTION_COLUMNS = [
23167
23195
  ];
23168
23196
  var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
23169
23197
 
23170
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/limits.js
23198
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
23199
+ var EXCERPT_CHARS = 280;
23200
+ var excerptOf = /* @__PURE__ */ __name((text5) => {
23201
+ if (text5 == null)
23202
+ return null;
23203
+ const flat2 = String(text5).replace(/\s+/g, " ").trim();
23204
+ if (!flat2)
23205
+ return null;
23206
+ return flat2.length > EXCERPT_CHARS ? `${flat2.slice(0, EXCERPT_CHARS - 1)}\u2026` : flat2;
23207
+ }, "excerptOf");
23208
+ var iso = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
23209
+ var textOf = /* @__PURE__ */ __name((value) => value == null || String(value).trim() === "" ? null : String(value), "textOf");
23210
+ var READS2 = {
23211
+ message: "SELECT c.title, coalesce(m.sender_name, i.name) AS sender, m.sent_at AS at, m.text AS body, a.provider AS tool FROM messages m JOIN chats c ON c.id = m.chat_id JOIN accounts a ON a.id = c.account_id LEFT JOIN identities i ON i.id = m.sender_identity_id WHERE m.id = ?",
23212
+ email: "SELECT e.subject AS title, coalesce(e.from_name, e.from_address) AS sender, e.sent_at AS at, coalesce(e.body_text, e.snippet) AS body, 'email' AS tool FROM emails e WHERE e.id = ?",
23213
+ note: "SELECT title, NULL AS sender, updated_at AS at, body, 'notes' AS tool FROM notes WHERE id = ?",
23214
+ document: "SELECT d.title, NULL AS sender, coalesce(d.external_updated_at, d.updated_at) AS at, d.body, a.provider AS tool FROM documents d JOIN accounts a ON a.id = d.account_id WHERE d.id = ?",
23215
+ meeting: "SELECT m.title, NULL AS sender, m.started_at AS at, m.description AS body, a.provider AS tool FROM meetings m JOIN accounts a ON a.id = m.account_id WHERE m.id = ?",
23216
+ meeting_transcript: "SELECT m.title, NULL AS sender, m.started_at AS at, NULL AS body, a.provider AS tool FROM meeting_transcripts t JOIN meetings m ON m.id = t.meeting_id JOIN accounts a ON a.id = m.account_id WHERE t.id = ?",
23217
+ meeting_transcript_row: "SELECT m.title, r.speaker_name AS sender, m.started_at + coalesce(r.start_ms, 0) AS at, r.text AS body, a.provider AS tool 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 JOIN accounts a ON a.id = m.account_id WHERE r.id = ?"
23218
+ };
23219
+ var KIND = {
23220
+ meeting_transcript: "meeting",
23221
+ meeting_transcript_row: "meeting"
23222
+ };
23223
+ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => database.prepare(`SELECT to_type, to_id FROM links WHERE from_type = ? AND from_id = ? AND kind = ${linkKind("evidence")} AND to_id IS NOT NULL ORDER BY id`).all(from2.type, from2.id).map((link3) => {
23224
+ const thing = storedThing(link3.to_type, link3.to_id);
23225
+ const state = stateOfThing(database, thing);
23226
+ const read2 = READS2[thing.type];
23227
+ const row2 = read2 === void 0 || state === "unavailable" ? void 0 : database.prepare(read2).get(thing.id);
23228
+ const gone = state !== "available";
23229
+ return {
23230
+ ref: referenceOfThing(database, thing) ?? null,
23231
+ kind: KIND[thing.type] ?? thing.type,
23232
+ title: textOf(row2?.title),
23233
+ sender: textOf(row2?.sender),
23234
+ at: iso(row2?.at),
23235
+ excerpt: gone ? null : excerptOf(row2?.body),
23236
+ tool: textOf(row2?.tool),
23237
+ missing: gone
23238
+ };
23239
+ }), "evidenceSourcesOf");
23240
+
23241
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/limits.js
23171
23242
  var MAX_FILE_BYTES = 50 * 1024 * 1024;
23172
23243
  var MAX_TEXT_CHARS = 2e6;
23173
23244
  var ATTACHMENT_LIMIT_ENV = [
@@ -23193,7 +23264,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
23193
23264
  return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
23194
23265
  }, "pdfPreviewLimits");
23195
23266
 
23196
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/ulid.js
23267
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/ulid.js
23197
23268
  import { randomBytes } from "node:crypto";
23198
23269
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
23199
23270
  var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
@@ -23206,7 +23277,7 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
23206
23277
  return time3 + random;
23207
23278
  }, "ulid");
23208
23279
 
23209
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
23280
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
23210
23281
  var FOLDED_FIELDS = ["title", "site", "language", "author"];
23211
23282
  var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
23212
23283
  if (!meta && !sections?.length)
@@ -23227,7 +23298,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
23227
23298
  return typeof language === "string" && language !== "" ? language : null;
23228
23299
  }, "languageOf");
23229
23300
 
23230
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
23301
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
23231
23302
  var isObject = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
23232
23303
  var objectOf = /* @__PURE__ */ __name((value) => {
23233
23304
  if (isObject(value))
@@ -23470,7 +23541,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
23470
23541
  };
23471
23542
  }, "filesStoreOver");
23472
23543
 
23473
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
23544
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
23474
23545
  var IMPORTED_DOCUMENT_QUERY = defineQuery({
23475
23546
  entity: "document",
23476
23547
  backend: "sql",
@@ -23516,11 +23587,11 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
23516
23587
  return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
23517
23588
  }, "importedDocumentWhere");
23518
23589
 
23519
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
23590
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
23520
23591
  var NOTE_FORMATS = ["obsidian", "markdown"];
23521
- var iso = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
23522
- var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso(value), "optionalIso");
23523
- var textOf = /* @__PURE__ */ __name((text5, what, max = 1e5, allowEmpty = false) => {
23592
+ var iso2 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
23593
+ var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso2(value), "optionalIso");
23594
+ var textOf2 = /* @__PURE__ */ __name((text5, what, max = 1e5, allowEmpty = false) => {
23524
23595
  const value = text5.trim();
23525
23596
  if (!value && !allowEmpty || value.length > max)
23526
23597
  throw new CliError("validation_error", `${what} takes ${allowEmpty ? 0 : 1}\u2013${max} characters`);
@@ -23544,8 +23615,8 @@ var documentOf = /* @__PURE__ */ __name((row2) => ({
23544
23615
  contentHash: row2.content_hash == null ? null : String(row2.content_hash),
23545
23616
  revision: Number(row2.revision),
23546
23617
  exportPath: row2.export_path == null ? null : String(row2.export_path),
23547
- createdAt: iso(row2.created_at),
23548
- updatedAt: iso(row2.updated_at),
23618
+ createdAt: iso2(row2.created_at),
23619
+ updatedAt: iso2(row2.updated_at),
23549
23620
  deletedAt: optionalIso(row2.deleted_at)
23550
23621
  }), "documentOf");
23551
23622
  var noteOf = /* @__PURE__ */ __name((row2) => ({
@@ -23560,8 +23631,8 @@ var noteOf = /* @__PURE__ */ __name((row2) => ({
23560
23631
  contentHash: null,
23561
23632
  revision: Number(row2.revision),
23562
23633
  exportPath: null,
23563
- createdAt: iso(row2.created_at),
23564
- updatedAt: iso(row2.updated_at),
23634
+ createdAt: iso2(row2.created_at),
23635
+ updatedAt: iso2(row2.updated_at),
23565
23636
  deletedAt: optionalIso(row2.deleted_at)
23566
23637
  }), "noteOf");
23567
23638
  var noteRowOf = /* @__PURE__ */ __name((database, reference2) => {
@@ -23587,7 +23658,7 @@ var linkOf = /* @__PURE__ */ __name((database, row2) => {
23587
23658
  evidence: row2.evidence == null ? null : String(row2.evidence),
23588
23659
  provenance: metadata3.provenance ?? null,
23589
23660
  confirmed: Number(row2.confirmed) === 1,
23590
- createdAt: iso(row2.created_at)
23661
+ createdAt: iso2(row2.created_at)
23591
23662
  };
23592
23663
  }, "linkOf");
23593
23664
  var requiredThing = /* @__PURE__ */ __name((database, reference2, what = "the target") => {
@@ -23626,7 +23697,7 @@ var insertLink = /* @__PURE__ */ __name((context, input) => {
23626
23697
  const origin = oneOf(input.origin ?? "owner", LINK_ORIGINS, "a link's origin");
23627
23698
  const from2 = requiredThing(database, input.from, "a link's source");
23628
23699
  const to = input.to === void 0 ? null : requiredThing(database, input.to, "a link's target");
23629
- const targetText = input.targetText === void 0 ? null : textOf(input.targetText, "a link's target", 500);
23700
+ const targetText = input.targetText === void 0 ? null : textOf2(input.targetText, "a link's target", 500);
23630
23701
  if (to === null && targetText === null)
23631
23702
  throw new CliError("validation_error", "a link needs a target");
23632
23703
  if (to !== null) {
@@ -23635,8 +23706,8 @@ var insertLink = /* @__PURE__ */ __name((context, input) => {
23635
23706
  return linkOf(database, existing);
23636
23707
  }
23637
23708
  const at = now2();
23638
- const provenance2 = input.provenance === void 0 ? void 0 : textOf(input.provenance, "provenance", 2e3);
23639
- 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) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(from2.type, from2.id, to?.type ?? null, to?.id ?? null, kind3, input.anchor ?? null, origin, targetText, targetText === null ? null : targetKey(targetText), input.role === void 0 ? null : textOf(input.role, "a role", 200), input.evidence === void 0 ? null : textOf(input.evidence, "evidence", 2e3), provenance2 === void 0 ? null : JSON.stringify({ provenance: provenance2 }), input.confirmed === false ? 0 : 1, at, origin === "owner" ? "owner" : null, at);
23709
+ const provenance2 = input.provenance === void 0 ? void 0 : textOf2(input.provenance, "provenance", 2e3);
23710
+ 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) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(from2.type, from2.id, to?.type ?? null, to?.id ?? null, kind3, 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), provenance2 === void 0 ? null : JSON.stringify({ provenance: provenance2 }), input.confirmed === false ? 0 : 1, at, origin === "owner" ? "owner" : null, at);
23640
23711
  if (to === null && targetText !== null)
23641
23712
  resolveKey(database, targetKey(targetText));
23642
23713
  return linkOf(database, database.prepare("SELECT * FROM links WHERE id = ?").get(Number(row2?.id)));
@@ -23649,7 +23720,7 @@ var folderOf = /* @__PURE__ */ __name((row2) => {
23649
23720
  name: folder ? String(row2.name) : `${String(row2.provider)}:${String(row2.external_id)}`,
23650
23721
  provider: String(row2.provider),
23651
23722
  format: settings.format ?? (folder ? "obsidian" : "markdown"),
23652
- createdAt: iso(row2.created_at),
23723
+ createdAt: iso2(row2.created_at),
23653
23724
  ...folder ? {} : { account: { provider: String(row2.provider), account: String(row2.external_id) } }
23654
23725
  };
23655
23726
  }, "folderOf");
@@ -23754,7 +23825,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
23754
23825
  addFolder: /* @__PURE__ */ __name(async ({ name, format = "obsidian" }) => {
23755
23826
  const at = now2();
23756
23827
  const checked = oneOf(format, NOTE_FORMATS, "a folder's format");
23757
- const row2 = database.prepare("INSERT INTO accounts (provider, external_id, name, settings, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?) RETURNING id").get(folderProviderOf(checked), ulid(at), textOf(name, "a folder's name", 200), JSON.stringify({ format: checked }), at, at);
23828
+ const row2 = database.prepare("INSERT INTO accounts (provider, external_id, name, settings, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?) RETURNING id").get(folderProviderOf(checked), ulid(at), textOf2(name, "a folder's name", 200), JSON.stringify({ format: checked }), at, at);
23758
23829
  return folderOf(folderRow(String(row2?.id)));
23759
23830
  }, "addFolder"),
23760
23831
  folders: /* @__PURE__ */ __name(async () => database.prepare(`SELECT * FROM accounts WHERE ${folderProviderSql()} ORDER BY name, id`).all().map(folderOf), "folders"),
@@ -23766,14 +23837,14 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
23766
23837
  if (found2 || !create)
23767
23838
  return found2 ? folderOf(found2) : void 0;
23768
23839
  const at = now2();
23769
- database.prepare("INSERT OR IGNORE INTO accounts (provider, external_id, name, settings, created_at, updated_at) VALUES (?, ?, NULL, ?, ?, ?)").run(provider, textOf(account, "an account's id", 200), JSON.stringify({ format: "markdown" }), at, at);
23840
+ database.prepare("INSERT OR IGNORE INTO accounts (provider, external_id, name, settings, created_at, updated_at) VALUES (?, ?, NULL, ?, ?, ?)").run(provider, textOf2(account, "an account's id", 200), JSON.stringify({ format: "markdown" }), at, at);
23770
23841
  return folderOf(find2());
23771
23842
  }, "documentsAccount"),
23772
23843
  documentsAccounts: /* @__PURE__ */ __name(async () => database.prepare(`SELECT * FROM accounts WHERE provider IN (${DOCUMENT_ACCOUNT_PROVIDERS.map(() => "?").join(", ")}) ORDER BY provider, external_id`).all(...DOCUMENT_ACCOUNT_PROVIDERS).map(folderOf), "documentsAccounts"),
23773
23844
  saveFileNote: /* @__PURE__ */ __name(async (input) => write(database, () => {
23774
23845
  const folder = Number(folderRow(input.folderId).id);
23775
- const path = textOf(input.path, "a note's path", 4096);
23776
- const text5 = textOf(input.text, "a note's text", MAX_TEXT_CHARS, true);
23846
+ const path = textOf2(input.path, "a note's path", 4096);
23847
+ const text5 = textOf2(input.text, "a note's text", MAX_TEXT_CHARS, true);
23777
23848
  const frontMatter = input.frontMatter == null ? null : JSON.stringify(input.frontMatter);
23778
23849
  let metadata3 = encodeDocumentMetadata(input.metadata, input.sections);
23779
23850
  const language = languageOf(input.metadata);
@@ -23824,7 +23895,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
23824
23895
  }), "saveFileNote"),
23825
23896
  renameFileNote: /* @__PURE__ */ __name(async (folderId, from2, to) => write(database, () => {
23826
23897
  const folder = Number(folderRow(folderId).id);
23827
- const target = textOf(to, "a note's path", 4096);
23898
+ const target = textOf2(to, "a note's path", 4096);
23828
23899
  const at = now2();
23829
23900
  const place = fileAt(folder, from2, true);
23830
23901
  const legacy = database.prepare("SELECT id FROM documents WHERE account_id = ? AND external_id = ? AND deleted_at IS NULL").get(folder, from2);
@@ -23891,7 +23962,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
23891
23962
  const owner = ownerPerson(database);
23892
23963
  const [subject2] = about.map((reference2) => requiredThing(database, reference2));
23893
23964
  const notable = subject2 ?? owner;
23894
- const row2 = database.prepare("INSERT INTO notes (notable_type, notable_id, title, body, author_type, author_id, revision, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, 1, ?, ?) RETURNING id").get(notable.type, notable.id, title === void 0 ? null : textOf(title, "a title", 500), textOf(text5, "a note"), owner.type, owner.id, at, at);
23965
+ const row2 = database.prepare("INSERT INTO notes (notable_type, notable_id, title, body, author_type, author_id, revision, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, 1, ?, ?) RETURNING id").get(notable.type, notable.id, title === void 0 ? null : textOf2(title, "a title", 500), textOf2(text5, "a note"), owner.type, owner.id, at, at);
23895
23966
  const id2 = Number(row2?.id);
23896
23967
  for (const reference2 of about.slice(1))
23897
23968
  insertLink(context, { from: `note:${id2}`, to: reference2, kind: "about", origin: "owner" });
@@ -23936,7 +24007,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
23936
24007
  throw new CliError("validation_error", "a file note is edited in its file; the next import reads it");
23937
24008
  const bare = id2.replace(/^note:/, "");
23938
24009
  const found2 = noteRow(bare);
23939
- const changed = database.prepare("UPDATE notes SET body = ?, revision = revision + 1, updated_at = ? WHERE id = ? AND revision = ? AND deleted_at IS NULL").run(textOf(text5, "a note"), now2(), Number(bare), revision2).changes;
24010
+ const changed = database.prepare("UPDATE notes SET body = ?, revision = revision + 1, updated_at = ? WHERE id = ? AND revision = ? AND deleted_at IS NULL").run(textOf2(text5, "a note"), now2(), Number(bare), revision2).changes;
23940
24011
  if (!changed)
23941
24012
  throw new CliError("validation_error", "the note changed; read its current revision before editing");
23942
24013
  database.prepare("INSERT INTO note_revisions (note_id, body, revision, created_at) VALUES (?, ?, ?, ?)").run(Number(bare), String(found2.body), revision2, now2());
@@ -24026,9 +24097,9 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
24026
24097
  };
24027
24098
  }, "notesStoreOver");
24028
24099
 
24029
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
24100
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
24030
24101
  var NAMED = "SELECT m.*, b.name AS author_name FROM memories m LEFT JOIN bots b ON m.author_type = 'bot' AND b.id = m.author_id";
24031
- var iso2 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
24102
+ var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
24032
24103
  var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
24033
24104
  if (typeof value !== "string" || !allowed.includes(value))
24034
24105
  throw new CliError("validation_error", `${what} is one of ${allowed.join(", ")}`);
@@ -24056,15 +24127,62 @@ var linkEvidence = /* @__PURE__ */ __name((context, from2, references, author) =
24056
24127
  }
24057
24128
  }, "linkEvidence");
24058
24129
  var evidenceOf = /* @__PURE__ */ __name((context, from2) => context.database.prepare(`SELECT to_type, to_id FROM links WHERE from_type = ? AND from_id = ? AND kind = ${linkKind("evidence")} AND to_id IS NOT NULL ORDER BY id`).all(from2.type, from2.id).flatMap((row2) => referenceOfThing(context.database, storedThing(row2.to_type, row2.to_id)) ?? []), "evidenceOf");
24130
+ var SUBJECT_NAMES = {
24131
+ person: "SELECT p.owner, coalesce(p.name, (SELECT a.name FROM aliases a WHERE a.aliasable_type = 'person' AND a.aliasable_id = p.id ORDER BY a.display DESC, a.id LIMIT 1), (SELECT i.name FROM identity_links l JOIN identities i ON i.id = l.identity_id WHERE l.person_id = p.id AND i.name IS NOT NULL ORDER BY i.id LIMIT 1)) AS name FROM persons p WHERE p.id = ?",
24132
+ project: "SELECT 0 AS owner, name FROM projects WHERE id = ?",
24133
+ organization: "SELECT 0 AS owner, name FROM organizations WHERE id = ?"
24134
+ };
24135
+ var subjectOf = /* @__PURE__ */ __name((database, row2) => {
24136
+ if (row2.subject_type == null)
24137
+ return { subject: null, subjectName: null, subjectIsOwner: false };
24138
+ const thing = storedThing(row2.subject_type, row2.subject_id);
24139
+ const read2 = SUBJECT_NAMES[thing.type];
24140
+ const named2 = read2 === void 0 ? void 0 : database.prepare(read2).get(thing.id);
24141
+ return {
24142
+ subject: referenceOfThing(database, thing) ?? null,
24143
+ subjectName: named2?.name == null ? null : String(named2.name),
24144
+ subjectIsOwner: Number(named2?.owner) === 1
24145
+ };
24146
+ }, "subjectOf");
24147
+ var highestKey = /* @__PURE__ */ __name((table) => `ids.${table}.highest`, "highestKey");
24148
+ var nextId = /* @__PURE__ */ __name((database, table) => {
24149
+ const kept = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(highestKey(table));
24150
+ const highest = database.prepare(`SELECT max(id) AS id FROM ${table}`).get();
24151
+ return Math.max(Number(kept?.value ?? 0), Number(highest?.id ?? 0)) + 1;
24152
+ }, "nextId");
24153
+ var keepHighestId = /* @__PURE__ */ __name((database, table, at) => {
24154
+ const highest = nextId(database, table) - 1;
24155
+ database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(highestKey(table), String(highest), at);
24156
+ }, "keepHighestId");
24157
+ var dropLinksOf = /* @__PURE__ */ __name((database, thing) => {
24158
+ const count = Number(database.prepare("SELECT count(*) AS n FROM links WHERE (from_type = ? AND from_id = ?) OR (to_type = ? AND to_id = ?)").get(thing.type, thing.id, thing.type, thing.id)?.n);
24159
+ database.prepare("DELETE FROM links WHERE to_type = ? AND to_id = ?").run(thing.type, thing.id);
24160
+ return count;
24161
+ }, "dropLinksOf");
24162
+ var erase = /* @__PURE__ */ __name((database, work) => {
24163
+ database.exec("PRAGMA secure_delete = ON");
24164
+ try {
24165
+ const done = write(database, () => {
24166
+ const result = work();
24167
+ for (const index2 of ["memory_words", "memory_stems"])
24168
+ database.prepare(`INSERT INTO ${index2} (${index2}) VALUES ('optimize')`).run();
24169
+ return result;
24170
+ });
24171
+ database.exec("PRAGMA wal_checkpoint(TRUNCATE)");
24172
+ return done;
24173
+ } finally {
24174
+ database.exec("PRAGMA secure_delete = OFF");
24175
+ }
24176
+ }, "erase");
24059
24177
  var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24060
24178
  const { database, now: now2 } = context;
24061
- const stemmerFor = stemmerCache();
24179
+ const stemmerFor2 = stemmerCache();
24062
24180
  const memoryOf = /* @__PURE__ */ __name((row2) => ({
24063
24181
  id: String(row2.id),
24064
24182
  ref: `memory:${row2.id}`,
24065
24183
  kind: row2.kind,
24066
24184
  body: String(row2.body),
24067
- subject: row2.subject_type == null ? null : referenceOfThing(database, storedThing(row2.subject_type, row2.subject_id)) ?? null,
24185
+ ...subjectOf(database, row2),
24068
24186
  author: authorOf(row2),
24069
24187
  model: row2.model == null ? null : String(row2.model),
24070
24188
  confidence: row2.confidence == null ? null : Number(row2.confidence),
@@ -24072,9 +24190,9 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24072
24190
  scope: row2.scope,
24073
24191
  supersedes: row2.supersedes_id == null ? null : `memory:${row2.supersedes_id}`,
24074
24192
  evidence: evidenceOf(context, { type: "memory", id: Number(row2.id) }),
24075
- lastVerifiedAt: row2.last_verified_at == null ? null : iso2(row2.last_verified_at),
24076
- createdAt: iso2(row2.created_at),
24077
- updatedAt: iso2(row2.updated_at)
24193
+ lastVerifiedAt: row2.last_verified_at == null ? null : iso3(row2.last_verified_at),
24194
+ createdAt: iso3(row2.created_at),
24195
+ updatedAt: iso3(row2.updated_at)
24078
24196
  }), "memoryOf");
24079
24197
  const rowOf = /* @__PURE__ */ __name((reference2) => {
24080
24198
  const thing = requiredThing(database, reference2.includes(":") ? reference2 : `memory:${reference2}`, "the memory");
@@ -24114,7 +24232,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24114
24232
  const subject2 = input.subject === void 0 ? void 0 : requiredThing(database, input.subject, "the subject");
24115
24233
  const replaced = input.supersedes === void 0 ? void 0 : Number(rowOf(input.supersedes).id);
24116
24234
  const at = now2();
24117
- const made = Number(database.prepare("INSERT INTO memories (kind, body, subject_type, subject_id, author_type, author_id, model, confidence, status, last_verified_at, supersedes_id, scope, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(kind3, body2, subject2?.type ?? null, subject2?.id ?? null, actor.type, actor.id, model, input.confidence ?? null, status, status === "confirmed" ? at : null, replaced ?? null, scope3, at, at)?.id);
24235
+ const made = Number(database.prepare("INSERT INTO memories (id, kind, body, subject_type, subject_id, author_type, author_id, model, confidence, status, last_verified_at, supersedes_id, scope, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(nextId(database, "memories"), kind3, body2, subject2?.type ?? null, subject2?.id ?? null, actor.type, actor.id, model, input.confidence ?? null, status, status === "confirmed" ? at : null, replaced ?? null, scope3, at, at)?.id);
24118
24236
  linkEvidence(context, { type: "memory", id: made }, input.evidence, input.author === "owner" ? "owner" : "agent");
24119
24237
  if (replaced !== void 0)
24120
24238
  database.prepare("UPDATE memories SET status = 'superseded', updated_at = ? WHERE id = ?").run(at, replaced);
@@ -24129,9 +24247,21 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24129
24247
  }, "list"),
24130
24248
  confirm: /* @__PURE__ */ __name(async (reference2) => setStatus(reference2, "confirmed", true), "confirm"),
24131
24249
  markStale: /* @__PURE__ */ __name(async (reference2) => setStatus(reference2, "stale", false), "markStale"),
24250
+ remove: /* @__PURE__ */ __name(async (reference2) => {
24251
+ const id2 = Number(rowOf(reference2).id);
24252
+ const links2 = erase(database, () => {
24253
+ keepHighestId(database, "memories", now2());
24254
+ database.prepare("UPDATE memories SET supersedes_id = NULL WHERE supersedes_id = ?").run(id2);
24255
+ const count = dropLinksOf(database, { type: "memory", id: id2 });
24256
+ database.prepare("DELETE FROM memories WHERE id = ?").run(id2);
24257
+ return count;
24258
+ });
24259
+ return { ref: `memory:${id2}`, removed: true, links: links2 };
24260
+ }, "remove"),
24261
+ sources: /* @__PURE__ */ __name(async (reference2) => evidenceSourcesOf(database, { type: "memory", id: Number(rowOf(reference2).id) }), "sources"),
24132
24262
  search: /* @__PURE__ */ __name(async (text5, { subject: subjectRef, scope: scope3, limit = 20 } = {}) => {
24133
24263
  const subject2 = subjectRef === void 0 ? void 0 : requiredThing(database, subjectRef);
24134
- drainCorpus(database, CORPORA.memory, stemmerFor);
24264
+ drainCorpus(database, CORPORA.memory, stemmerFor2);
24135
24265
  const words3 = normalize(text5).split(/\s+/).filter((word) => /[\p{L}\p{N}]/u.test(word));
24136
24266
  if (words3.length === 0)
24137
24267
  throw new CliError("validation_error", "say what to find in the memories");
@@ -24142,7 +24272,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24142
24272
  };
24143
24273
  }, "memoriesStoreOver");
24144
24274
 
24145
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
24275
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
24146
24276
  var DEFAULT_FIRST_PASS_PER_CHAT = 0;
24147
24277
  var KEY = "taskFirstPassPerChat";
24148
24278
  var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
@@ -24162,7 +24292,7 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
24162
24292
  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);
24163
24293
  }, "saveFirstPassPerChat");
24164
24294
 
24165
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
24295
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
24166
24296
  var TASK_RELATION_KINDS = [
24167
24297
  "blocked-by",
24168
24298
  "follow-up-of",
@@ -24292,7 +24422,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
24292
24422
  };
24293
24423
  }, "taskRelationsStoreOver");
24294
24424
 
24295
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
24425
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
24296
24426
  var TASK_ROLES = ["assignee", "reviewer", "watcher"];
24297
24427
  var TASK_EVENT_KINDS = [
24298
24428
  "created",
@@ -24309,17 +24439,17 @@ var TASK_EVENT_KINDS = [
24309
24439
  "category",
24310
24440
  "close-suggestion"
24311
24441
  ];
24312
- var iso3 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
24442
+ var iso4 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
24313
24443
  var recordTaskEvent = /* @__PURE__ */ __name((database, task, actor, kind3, changes, at) => {
24314
24444
  database.prepare("INSERT INTO task_events (task_id, actor_type, actor_id, kind, changes, created_at) VALUES (?, ?, ?, ?, ?, ?)").run(task, actor?.type ?? null, actor?.id ?? null, kind3, changes === null ? null : JSON.stringify(changes), at);
24315
24445
  }, "recordTaskEvent");
24316
- var textOf2 = /* @__PURE__ */ __name((value, what, max) => {
24446
+ var textOf3 = /* @__PURE__ */ __name((value, what, max) => {
24317
24447
  const text5 = value.trim();
24318
24448
  if (!text5 || text5.length > max)
24319
24449
  throw new CliError("validation_error", `${what} takes 1\u2013${max} characters`);
24320
24450
  return text5;
24321
24451
  }, "textOf");
24322
- var claimOf = /* @__PURE__ */ __name((row2, at) => row2.claimed_by != null && Number(row2.claimed_until) >= at ? { claimedBy: String(row2.claimed_by), claimedUntil: iso3(row2.claimed_until) } : { claimedBy: null, claimedUntil: null }, "claimOf");
24452
+ var claimOf = /* @__PURE__ */ __name((row2, at) => row2.claimed_by != null && Number(row2.claimed_until) >= at ? { claimedBy: String(row2.claimed_by), claimedUntil: iso4(row2.claimed_until) } : { claimedBy: null, claimedUntil: null }, "claimOf");
24323
24453
  var priorityOf = /* @__PURE__ */ __name((value) => {
24324
24454
  if (value !== null && !(Number.isInteger(value) && value >= 0 && value <= 4))
24325
24455
  throw new CliError("validation_error", "a priority is 0 (urgent) to 4 (low)");
@@ -24380,9 +24510,9 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24380
24510
  priority: row2.priority == null ? null : Number(row2.priority),
24381
24511
  parent: row2.parent_id == null ? null : reference2(Number(row2.parent_id)),
24382
24512
  source: row2.source_locator == null ? null : String(row2.source_locator),
24383
- dueAt: iso3(row2.due_at),
24384
- nextCheckAt: iso3(row2.next_check_at),
24385
- closedAt: iso3(row2.closed_at),
24513
+ dueAt: iso4(row2.due_at),
24514
+ nextCheckAt: iso4(row2.next_check_at),
24515
+ closedAt: iso4(row2.closed_at),
24386
24516
  reason: row2.close_reason == null ? null : String(row2.close_reason),
24387
24517
  verdict: row2.verdict == null ? null : row2.verdict,
24388
24518
  category: row2.category == null ? null : String(row2.category),
@@ -24390,8 +24520,8 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24390
24520
  closeCertainty: row2.close_certainty == null ? null : Number(row2.close_certainty),
24391
24521
  closeSuggestion: closeSuggestionOf(database, row2),
24392
24522
  assignments: database.prepare("SELECT assignee_id, role FROM task_assignments WHERE task_id = ? AND assignee_type = 'person' ORDER BY id").all(id2).map((assigned) => ({ to: `person:${assigned.assignee_id}`, role: assigned.role })),
24393
- createdAt: iso3(row2.created_at),
24394
- updatedAt: iso3(row2.updated_at)
24523
+ createdAt: iso4(row2.created_at),
24524
+ updatedAt: iso4(row2.updated_at)
24395
24525
  };
24396
24526
  }, "detailsOf");
24397
24527
  const rowById = /* @__PURE__ */ __name((id2) => database.prepare("SELECT * FROM tasks WHERE id = ?").get(id2), "rowById");
@@ -24410,12 +24540,12 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24410
24540
  recordTaskEvent(database, task, actor, event, { [column2]: [before2[column2] ?? null, value] }, at);
24411
24541
  }, "change");
24412
24542
  if (fields4.title !== void 0) {
24413
- const title = textOf2(fields4.title, "a task's title", 300);
24543
+ const title = textOf3(fields4.title, "a task's title", 300);
24414
24544
  change("title", title, created ? void 0 : "title");
24415
24545
  change("title_folded", folded3(title));
24416
24546
  }
24417
24547
  if (fields4.description !== void 0)
24418
- change("description", fields4.description === null ? null : textOf2(fields4.description, "a description", 2e4), created ? void 0 : "description");
24548
+ change("description", fields4.description === null ? null : textOf3(fields4.description, "a description", 2e4), created ? void 0 : "description");
24419
24549
  if (fields4.priority !== void 0)
24420
24550
  change("priority", priorityOf(fields4.priority), "priority");
24421
24551
  if (fields4.parent !== void 0)
@@ -24443,7 +24573,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24443
24573
  }
24444
24574
  }
24445
24575
  if (fields4.reason !== void 0) {
24446
- const reason = fields4.reason === null ? null : textOf2(fields4.reason, "a reason", 500);
24576
+ const reason = fields4.reason === null ? null : textOf3(fields4.reason, "a reason", 500);
24447
24577
  change("close_reason", reason);
24448
24578
  change("close_reason_folded", folded3(reason));
24449
24579
  }
@@ -24466,7 +24596,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24466
24596
  const number3 = Number(counted.tasks_count);
24467
24597
  if (!Number.isSafeInteger(number3) || number3 < 1)
24468
24598
  throw new CliError("configuration_error", "the project task counter exceeds the safe numbering range");
24469
- const id2 = Number(database.prepare("INSERT INTO tasks (project_id, number, key, title, title_folded, type, status, author_type, author_id, source, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, 'open', ?, ?, ?, ?, ?) RETURNING id").get(project, number3, `${String(counted.key)}-${number3}`, textOf2(input.title, "a task's title", 300), folded3(textOf2(input.title, "a task's title", 300)), input.type, actor.type, actor.id, by === "owner" ? "owner" : "agent", at, at)?.id);
24599
+ const id2 = Number(database.prepare("INSERT INTO tasks (project_id, number, key, title, title_folded, type, status, author_type, author_id, source, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, 'open', ?, ?, ?, ?, ?) RETURNING id").get(project, number3, `${String(counted.key)}-${number3}`, textOf3(input.title, "a task's title", 300), folded3(textOf3(input.title, "a task's title", 300)), input.type, actor.type, actor.id, by === "owner" ? "owner" : "agent", at, at)?.id);
24470
24600
  recordTaskEvent(database, id2, actor, "created", null, at);
24471
24601
  const { title: _title, project: _project, type: _type, ...fields4 } = input;
24472
24602
  edit(id2, fields4, actor, true);
@@ -24545,7 +24675,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24545
24675
  const row2 = rowById(task);
24546
24676
  if (row2.status !== "open")
24547
24677
  throw new CliError("validation_error", `task ${String(row2.key)} is ${String(row2.status)}; only an open task is claimed`);
24548
- throw new CliError("validation_error", `${String(row2.claimed_by)} holds task ${String(row2.key)} until ${iso3(row2.claimed_until)}; wait for it, or ask them to release it`, { reason: "task.claimed", holder: String(row2.claimed_by), until: iso3(row2.claimed_until) });
24678
+ throw new CliError("validation_error", `${String(row2.claimed_by)} holds task ${String(row2.key)} until ${iso4(row2.claimed_until)}; wait for it, or ask them to release it`, { reason: "task.claimed", holder: String(row2.claimed_by), until: iso4(row2.claimed_until) });
24549
24679
  }
24550
24680
  return details2(task);
24551
24681
  }, "claim"),
@@ -24566,7 +24696,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24566
24696
  kind: row2.kind,
24567
24697
  actor: row2.actor_type == null ? null : { type: row2.actor_type, id: Number(row2.actor_id) },
24568
24698
  changes: row2.changes == null ? null : JSON.parse(String(row2.changes)),
24569
- at: iso3(row2.created_at)
24699
+ at: iso4(row2.created_at)
24570
24700
  })), "events")
24571
24701
  };
24572
24702
  }, "workTaskOperationsOver");
@@ -24579,7 +24709,7 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
24579
24709
  };
24580
24710
  }, "workTasksOver");
24581
24711
 
24582
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
24712
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
24583
24713
  var taskCloseOver = /* @__PURE__ */ __name((context) => {
24584
24714
  const { database, now: now2 } = context;
24585
24715
  const liveRow = /* @__PURE__ */ __name((id2) => {
@@ -24625,7 +24755,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
24625
24755
  };
24626
24756
  }, "taskCloseOver");
24627
24757
 
24628
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
24758
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
24629
24759
  var TASK_PAIR_DECISIONS = ["review", "unsure", "merged", "rejected", "unmerged", "attached", "new"];
24630
24760
  var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
24631
24761
  const { database, now: now2 } = context;
@@ -24844,7 +24974,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
24844
24974
  };
24845
24975
  }, "taskPairsOver");
24846
24976
 
24847
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
24977
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
24848
24978
  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";
24849
24979
  var taskStoreOver = /* @__PURE__ */ __name((context) => {
24850
24980
  const { database, now: now2 } = context;
@@ -25039,7 +25169,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
25039
25169
  throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
25040
25170
  }, "oneOf");
25041
25171
 
25042
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/accounts.js
25172
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/accounts.js
25043
25173
  var accountAccountsOver = /* @__PURE__ */ __name((context) => {
25044
25174
  const { database } = context;
25045
25175
  const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
@@ -25084,7 +25214,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
25084
25214
  };
25085
25215
  }, "accountsStoreOver");
25086
25216
 
25087
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
25217
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
25088
25218
  var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
25089
25219
  var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
25090
25220
  const message2 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
@@ -25108,7 +25238,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
25108
25238
  })), "keepDownloads");
25109
25239
  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");
25110
25240
 
25111
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/attachments.js
25241
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/attachments.js
25112
25242
  var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
25113
25243
  const { database } = context;
25114
25244
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -25165,7 +25295,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
25165
25295
  }, "keepAttachmentText")
25166
25296
  }), "attachmentsStoreOver");
25167
25297
 
25168
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
25298
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
25169
25299
  var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
25170
25300
  var pointerMover = /* @__PURE__ */ __name((context, type) => {
25171
25301
  const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
@@ -25345,7 +25475,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
25345
25475
  return done;
25346
25476
  }, "rekeyChats");
25347
25477
 
25348
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
25478
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
25349
25479
  var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
25350
25480
  var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
25351
25481
  var CHAT_LIST_KEY = "chat_list_complete";
@@ -25377,7 +25507,7 @@ var chatCompleteness = /* @__PURE__ */ __name(({ database }, accountKey, chatIds
25377
25507
  });
25378
25508
  }, "chatCompleteness");
25379
25509
 
25380
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/chats.js
25510
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/chats.js
25381
25511
  var chatsStoreOver = /* @__PURE__ */ __name((context) => {
25382
25512
  const { database } = context;
25383
25513
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
@@ -25461,6 +25591,13 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
25461
25591
  const row2 = context.database.prepare("SELECT kind FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId);
25462
25592
  return row2 ? String(row2.kind) : void 0;
25463
25593
  }, "chatKind"),
25594
+ chatTitle: /* @__PURE__ */ __name(async (key2, chatId) => {
25595
+ const accountKey = findAccountPk2(key2);
25596
+ if (accountKey === void 0)
25597
+ return null;
25598
+ const row2 = context.database.prepare("SELECT title FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId);
25599
+ return row2?.title == null ? null : String(row2.title);
25600
+ }, "chatTitle"),
25464
25601
  chatActivity: /* @__PURE__ */ __name(async (key2, since, where) => {
25465
25602
  const accountKey = findAccountPk2(key2);
25466
25603
  return accountKey === void 0 ? { chats: [], storedAt: null } : chatActivity(context, accountKey, since, where);
@@ -25477,7 +25614,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
25477
25614
  };
25478
25615
  }, "chatsStoreOver");
25479
25616
 
25480
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
25617
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
25481
25618
  import { createHash as createHash6 } from "node:crypto";
25482
25619
  var BATCH_CONTEXT = 50;
25483
25620
  var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
@@ -25615,7 +25752,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
25615
25752
  var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
25616
25753
  ${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
25617
25754
 
25618
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
25755
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
25619
25756
  import { setTimeout } from "node:timers/promises";
25620
25757
  var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
25621
25758
  var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
@@ -25927,7 +26064,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
25927
26064
  AND NOT EXISTS (SELECT 1 FROM messages d
25928
26065
  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");
25929
26066
 
25930
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/conversations.js
26067
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/conversations.js
25931
26068
  var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
25932
26069
  const { database } = context;
25933
26070
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -26034,7 +26171,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
26034
26171
  };
26035
26172
  }, "conversationsStoreOver");
26036
26173
 
26037
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/counters.js
26174
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/counters.js
26038
26175
  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";
26039
26176
  var accountCountersOver = /* @__PURE__ */ __name((context) => {
26040
26177
  const { database } = context;
@@ -26059,7 +26196,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
26059
26196
  counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
26060
26197
  }), "countersStoreOver");
26061
26198
 
26062
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
26199
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
26063
26200
  var MENTION_STATUSES = ["found", "linked", "dismissed"];
26064
26201
  var MENTION_QUERY = defineQuery({
26065
26202
  entity: "mention",
@@ -26275,7 +26412,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
26275
26412
  return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
26276
26413
  }, "listPlaces");
26277
26414
 
26278
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/mentions.js
26415
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/mentions.js
26279
26416
  var accountMentionsOver = /* @__PURE__ */ __name((context) => {
26280
26417
  const { database } = context;
26281
26418
  const { findAccountPk: findAccountPk2 } = keysOver(context);
@@ -26310,7 +26447,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
26310
26447
  places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
26311
26448
  }), "mentionsStoreOver");
26312
26449
 
26313
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
26450
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
26314
26451
  var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
26315
26452
  const read2 = database.prepare("SELECT m.id, m.external_id, m.text, m.sent_at, m.sender_name, coalesce(m.sender_chat_external_id, i.external_id) AS sender_id FROM messages m LEFT JOIN identities i ON i.id = m.sender_identity_id WHERE m.chat_id = ? AND m.deleted_at IS NULL AND (m.text LIKE '%google.com%' OR m.text LIKE '%forms.gle%') " + (messageId === void 0 ? "" : "AND m.external_id = ? ") + "ORDER BY m.sent_at DESC, m.id DESC");
26316
26453
  const rows = messageId === void 0 ? read2.all(chatKey) : read2.all(chatKey, messageId);
@@ -26325,7 +26462,51 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
26325
26462
  }));
26326
26463
  }, "documentLinkMessages");
26327
26464
 
26328
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/messages.js
26465
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
26466
+ var stemmerFor = stemmerCache();
26467
+ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
26468
+ if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
26469
+ throw new CliError("validation_error", "a follow-up lookup takes at most 50 messages and 1\u2013100 results each");
26470
+ const { database } = context;
26471
+ const stemmers = storeStemmers(database);
26472
+ if (!wanted.length || !stemmers || !stemsState(database)?.ready)
26473
+ return wanted.map(() => []);
26474
+ const stemmer = stemmerFor(stemmers);
26475
+ const count = database.prepare("SELECT count(*) AS doc FROM (SELECT rowid FROM message_stems WHERE message_stems MATCH ? LIMIT ?)");
26476
+ const counts = /* @__PURE__ */ new Map();
26477
+ const countOf = /* @__PURE__ */ __name((stem) => {
26478
+ let found2 = counts.get(stem);
26479
+ if (found2 === void 0) {
26480
+ found2 = Number(count.get(`stems : "${stem.replaceAll('"', '""')}"`, rareAt + 1)?.doc ?? 0);
26481
+ counts.set(stem, found2);
26482
+ }
26483
+ return found2;
26484
+ }, "countOf");
26485
+ const message2 = database.prepare(`
26486
+ SELECT m.text, m.sent_at FROM accounts ac
26487
+ JOIN chats c ON c.account_id = ac.id AND c.external_id = ?
26488
+ JOIN messages m ON m.chat_id = c.id AND m.external_id = ?
26489
+ WHERE ac.provider = ? AND ac.external_id = ? AND m.deleted_at IS NULL
26490
+ `);
26491
+ const later = database.prepare(`
26492
+ SELECT m.id FROM message_stems s JOIN messages m ON m.id = s.rowid
26493
+ WHERE message_stems MATCH ? AND m.deleted_at IS NULL AND m.sent_at > ?
26494
+ ORDER BY m.sent_at DESC, m.id DESC LIMIT ?
26495
+ `);
26496
+ return wanted.map(({ account, chatId, id: id2 }) => {
26497
+ const row2 = message2.get(chatId, id2, account.provider, account.account);
26498
+ if (!row2)
26499
+ return [];
26500
+ const stems = new Set(stemmer.explain(String(row2.text)).filter(({ word }) => new RegExp("^\\p{L}{3,}$", "u").test(word)).map(({ word }) => stemmer.stemToken(word)).filter(Boolean));
26501
+ const rare = [...stems].filter((stem) => countOf(stem) <= rareAt);
26502
+ if (!rare.length)
26503
+ return [];
26504
+ const match = `stems : (${rare.map((stem) => `"${stem.replaceAll('"', '""')}"`).join(" OR ")})`;
26505
+ return hitsByPk(context, later.all(match, Number(row2.sent_at), limit).map((one) => Number(one.id)));
26506
+ });
26507
+ }, "laterSharingRare");
26508
+
26509
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/messages.js
26329
26510
  var accountMessagesOver = /* @__PURE__ */ __name((context) => {
26330
26511
  const { database } = context;
26331
26512
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
@@ -26456,12 +26637,13 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
26456
26637
  ...keyed,
26457
26638
  search: /* @__PURE__ */ __name(async (query, { limit, account }) => find(context, { text: query, limit, ...account ? { account } : {} }), "search"),
26458
26639
  find: /* @__PURE__ */ __name(async (filter) => find(context, filter), "find"),
26459
- directReplies: /* @__PURE__ */ __name(async (parents, limit) => directReplies(context, parents, limit), "directReplies")
26640
+ directReplies: /* @__PURE__ */ __name(async (parents, limit) => directReplies(context, parents, limit), "directReplies"),
26641
+ laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
26460
26642
  }), "messagesStoreOver");
26461
26643
 
26462
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
26644
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
26463
26645
  var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
26464
- var iso4 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
26646
+ var iso5 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
26465
26647
  var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: accounts2, limit }) => {
26466
26648
  const person2 = Number(uid);
26467
26649
  if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(person2) || !Number.isSafeInteger(limit) || limit < 1)
@@ -26482,7 +26664,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
26482
26664
  statement: String(row2.statement),
26483
26665
  subject: row2.subject_type == null ? null : `${row2.subject_type}:${row2.subject_id}`,
26484
26666
  project: row2.project_id == null ? null : `project:${row2.project_id}`,
26485
- updatedAt: iso4(row2.updated_at)
26667
+ updatedAt: iso5(row2.updated_at)
26486
26668
  }));
26487
26669
  const notes2 = database.prepare(`SELECT n.id,n.title,n.body,n.revision,n.updated_at FROM notes n
26488
26670
  JOIN persons owner ON n.author_type='person' AND n.author_id=owner.id AND owner.owner=1
@@ -26495,7 +26677,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
26495
26677
  title: row2.title == null ? null : String(row2.title),
26496
26678
  text: String(row2.body),
26497
26679
  revision: Number(row2.revision),
26498
- updatedAt: iso4(row2.updated_at)
26680
+ updatedAt: iso5(row2.updated_at)
26499
26681
  }));
26500
26682
  const tasks2 = database.prepare(`SELECT t.id,t.title,t.due_at,t.project_id,t.source_locator,t.created_at,group_concat(DISTINCT ta.role) AS role
26501
26683
  FROM task_assignments ta JOIN tasks t ON t.id=ta.task_id JOIN main.projects p ON p.id=t.project_id
@@ -26507,16 +26689,16 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
26507
26689
  ref: `task:${taskIdOf(database, Number(row2.id))}`,
26508
26690
  title: String(row2.title),
26509
26691
  role: String(row2.role),
26510
- dueAt: iso4(row2.due_at),
26692
+ dueAt: iso5(row2.due_at),
26511
26693
  project: `project:${row2.project_id}`,
26512
26694
  source: row2.source_locator == null ? null : String(row2.source_locator),
26513
- createdAt: iso4(row2.created_at)
26695
+ createdAt: iso5(row2.created_at)
26514
26696
  }));
26515
26697
  return { facts: page3(facts2), notes: page3(notes2), tasks: page3(tasks2) };
26516
26698
  });
26517
26699
  }, "personPreparation");
26518
26700
 
26519
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
26701
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
26520
26702
  var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
26521
26703
  const id2 = Number(uid);
26522
26704
  if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
@@ -26524,7 +26706,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
26524
26706
  return Boolean(database.prepare("SELECT 1 FROM persons p JOIN identity_links l ON l.person_id=p.id JOIN account_identities a ON a.identity_id=l.identity_id WHERE p.id=? AND a.account_id IN (SELECT value FROM json_each(?)) LIMIT 1").get(id2, JSON.stringify(accountIds)));
26525
26707
  }, "personSeenInAccounts");
26526
26708
 
26527
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
26709
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
26528
26710
  var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
26529
26711
  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);
26530
26712
  if (!row2)
@@ -26590,7 +26772,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
26590
26772
  return { id: id2, personId, removed: true };
26591
26773
  }, "removeNote");
26592
26774
 
26593
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/people.js
26775
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/people.js
26594
26776
  var accountPeopleOver = /* @__PURE__ */ __name((context) => {
26595
26777
  const { database } = context;
26596
26778
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
@@ -26665,13 +26847,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
26665
26847
  };
26666
26848
  }, "peopleStoreOver");
26667
26849
 
26668
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
26850
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
26669
26851
  import { createHash as createHash8 } from "node:crypto";
26670
26852
 
26671
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
26853
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
26672
26854
  import { createHash as createHash7 } from "node:crypto";
26673
26855
 
26674
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
26856
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
26675
26857
  var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
26676
26858
  var exhausted2 = /* @__PURE__ */ __name((budget) => {
26677
26859
  throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
@@ -26893,7 +27075,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
26893
27075
  };
26894
27076
  }, "rankReplyGraph");
26895
27077
 
26896
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
27078
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
26897
27079
  var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
26898
27080
  var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
26899
27081
  var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
@@ -27067,7 +27249,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
27067
27249
  return { items, evidence, summary, graph: graph.quality };
27068
27250
  }, "calculateAdminStatistics");
27069
27251
 
27070
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
27252
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
27071
27253
  var rankingContextRange = /* @__PURE__ */ __name((root) => {
27072
27254
  const dates = [];
27073
27255
  const visit = /* @__PURE__ */ __name((node, required3) => {
@@ -27089,7 +27271,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
27089
27271
  return dates[0].node.resolution.date;
27090
27272
  }, "rankingContextRange");
27091
27273
 
27092
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
27274
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
27093
27275
  var reactionCounts = /* @__PURE__ */ __name((stored3) => {
27094
27276
  let counts;
27095
27277
  try {
@@ -27384,7 +27566,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
27384
27566
  });
27385
27567
  }, "rankQuery");
27386
27568
 
27387
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
27569
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
27388
27570
  function fail4(message2, reason = "query.too-large") {
27389
27571
  throw new CliError("validation_error", message2, { reason, complete: false });
27390
27572
  }
@@ -27561,7 +27743,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
27561
27743
  return result;
27562
27744
  }), "adminStatisticsQuery");
27563
27745
 
27564
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
27746
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
27565
27747
  var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
27566
27748
  if (!execution.accounts.length)
27567
27749
  return { conversations: [], chats: [] };
@@ -27579,7 +27761,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
27579
27761
  return { conversations: conversations2, chats: chats2 };
27580
27762
  }, "conversationEligibility");
27581
27763
 
27582
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
27764
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
27583
27765
  import { createHash as createHash9 } from "node:crypto";
27584
27766
  var EVIDENCE_BYTES = 64 * 1024;
27585
27767
  var FINGERPRINT_BYTES = 8 * 1024 * 1024;
@@ -27729,16 +27911,18 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
27729
27911
  return result;
27730
27912
  }, "rankingEvidence");
27731
27913
 
27732
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/queries.js
27733
- var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor) => {
27914
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/queries.js
27915
+ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
27734
27916
  const mailIndexed = /* @__PURE__ */ __name((execution) => {
27735
27917
  if (execution.corpus === "mail")
27736
- drainEmailIndex(context.database, stemmerFor);
27918
+ drainEmailIndex(context.database, stemmerFor2);
27737
27919
  return execution;
27738
27920
  }, "mailIndexed");
27739
27921
  return {
27740
27922
  matchQuery: /* @__PURE__ */ __name(async (execution) => matchQuery(context, mailIndexed(execution)), "matchQuery"),
27741
27923
  countQuery: /* @__PURE__ */ __name(async (execution, by) => countQuery(context, mailIndexed(execution), by), "countQuery"),
27924
+ countMatches: /* @__PURE__ */ __name(async (execution, cap) => countMatches(context, mailIndexed(execution), cap), "countMatches"),
27925
+ matchingPks: /* @__PURE__ */ __name(async (execution, cap) => matchingPks(context, mailIndexed(execution), cap), "matchingPks"),
27742
27926
  conversationEligibility: /* @__PURE__ */ __name(async (execution) => conversationEligibility(context, execution), "conversationEligibility"),
27743
27927
  rankQuery: /* @__PURE__ */ __name(async (execution, request) => rankQuery(context, execution, request), "rankQuery"),
27744
27928
  rankingEvidence: /* @__PURE__ */ __name(async (execution, request) => rankingEvidence(context, execution, request), "rankingEvidence"),
@@ -27746,7 +27930,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor) => {
27746
27930
  };
27747
27931
  }, "queriesStoreOver");
27748
27932
 
27749
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
27933
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
27750
27934
  var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
27751
27935
  const { database, now: now2 } = context;
27752
27936
  const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
@@ -27785,10 +27969,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
27785
27969
  }));
27786
27970
  }, "chatEventsOf");
27787
27971
 
27788
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
27972
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
27789
27973
  import { createHash as createHash10 } from "node:crypto";
27790
27974
 
27791
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/calendar.js
27975
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/calendar.js
27792
27976
  var calendarKey = /* @__PURE__ */ __name((zone, by) => {
27793
27977
  const format = new Intl.DateTimeFormat("en-CA", {
27794
27978
  timeZone: zone,
@@ -27803,7 +27987,7 @@ var calendarKey = /* @__PURE__ */ __name((zone, by) => {
27803
27987
  };
27804
27988
  }, "calendarKey");
27805
27989
 
27806
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/retention.js
27990
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/retention.js
27807
27991
  var RETENTION_TOLERANCE = 864e5;
27808
27992
  var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
27809
27993
  const { since, until, cutoff, checkpoints, within, limit, by } = options;
@@ -27857,8 +28041,8 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
27857
28041
  return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
27858
28042
  }, "retentionCohorts");
27859
28043
 
27860
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
27861
- var iso5 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
28044
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
28045
+ var iso6 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
27862
28046
  var week = /* @__PURE__ */ __name((day) => {
27863
28047
  const date3 = /* @__PURE__ */ new Date(`${day}T00:00:00Z`);
27864
28048
  date3.setUTCDate(date3.getUTCDate() - (date3.getUTCDay() + 6) % 7);
@@ -27895,14 +28079,14 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
27895
28079
  return {
27896
28080
  stay: pk,
27897
28081
  person: String(row2.person),
27898
- joinedAt: iso5(joinedAt),
28082
+ joinedAt: iso6(joinedAt),
27899
28083
  cohort,
27900
28084
  checkpoints: options.checkpoints.map((checkpoint) => {
27901
28085
  const target = joinedAt + checkpoint;
27902
28086
  if (target > options.cutoff)
27903
28087
  return {
27904
28088
  checkpoint,
27905
- targetAt: iso5(target),
28089
+ targetAt: iso6(target),
27906
28090
  state: "pending",
27907
28091
  observedAt: null,
27908
28092
  lagMilliseconds: null,
@@ -27911,22 +28095,22 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
27911
28095
  const read2 = observationStatement.get(pk, chatPk, target, Math.min(target + RETENTION_TOLERANCE, options.cutoff));
27912
28096
  return {
27913
28097
  checkpoint,
27914
- targetAt: iso5(target),
28098
+ targetAt: iso6(target),
27915
28099
  state: !read2 ? "unknown" : Number(read2.present) === 1 ? "present" : Number(read2.complete) === 1 ? "absent" : "unknown",
27916
- observedAt: read2 ? iso5(Number(read2.observed_at)) : null,
28100
+ observedAt: read2 ? iso6(Number(read2.observed_at)) : null,
27917
28101
  lagMilliseconds: read2 ? Number(read2.observed_at) - target : null,
27918
28102
  complete: read2 ? Number(read2.complete) === 1 : null
27919
28103
  };
27920
28104
  }),
27921
28105
  activity: {
27922
28106
  state: first !== null && first !== void 0 ? "observed-message" : end > options.cutoff ? "pending" : "no-observed-message",
27923
- firstMessageAt: first === null || first === void 0 ? null : iso5(Number(first)),
27924
- windowEnd: iso5(end),
28107
+ firstMessageAt: first === null || first === void 0 ? null : iso6(Number(first)),
28108
+ windowEnd: iso6(end),
27925
28109
  archiveCovered: covered === true
27926
28110
  },
27927
28111
  departure: {
27928
- after: lower === null ? null : iso5(lower),
27929
- atOrBefore: upper === null ? null : iso5(upper),
28112
+ after: lower === null ? null : iso6(lower),
28113
+ atOrBefore: upper === null ? null : iso6(upper),
27930
28114
  early: upper !== null && upper <= end ? "observed" : lower !== null && lower >= end ? "not-observed" : end > options.cutoff ? "pending" : "unknown"
27931
28115
  }
27932
28116
  };
@@ -27970,7 +28154,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
27970
28154
  const nextCursor = next < selected.length ? Buffer.from(JSON.stringify({ offset: next, fingerprint: fingerprint2, cohort: evidence?.cohort ?? null })).toString("base64url") : null;
27971
28155
  return {
27972
28156
  chatId,
27973
- cutoff: iso5(options.cutoff),
28157
+ cutoff: iso6(options.cutoff),
27974
28158
  options,
27975
28159
  items: cohorts.slice(0, options.limit),
27976
28160
  total: cohorts.length,
@@ -27993,8 +28177,8 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
27993
28177
  };
27994
28178
  }, "retentionQuery");
27995
28179
 
27996
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
27997
- var iso6 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
28180
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
28181
+ var iso7 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
27998
28182
  var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
27999
28183
  ...isBot === void 0 ? {} : { bot: isBot },
28000
28184
  ...flagged === void 0 ? {} : { [flagged]: true },
@@ -28088,10 +28272,10 @@ var memberStaysOf = /* @__PURE__ */ __name(({ orm }, chatKey, since) => orm.sele
28088
28272
  goneAt: memberStays.leftAt
28089
28273
  }).from(memberStays).innerJoin(identities, eq(identities.id, memberStays.identityId)).where(and(eq(memberStays.chatId, chatKey), since === void 0 ? void 0 : or(isNull(memberStays.leftAt), gte(memberStays.leftAt, since)))).orderBy(asc(memberStays.firstSeenAt), asc(memberStays.id)).all().map((row2) => ({
28090
28274
  ...row2,
28091
- firstSeenAt: iso6(row2.firstSeenAt),
28092
- lastSeenAt: iso6(row2.lastSeenAt),
28093
- joinedAt: iso6(row2.joinedAt),
28094
- goneAt: iso6(row2.goneAt)
28275
+ firstSeenAt: iso7(row2.firstSeenAt),
28276
+ lastSeenAt: iso7(row2.lastSeenAt),
28277
+ joinedAt: iso7(row2.joinedAt),
28278
+ goneAt: iso7(row2.goneAt)
28095
28279
  })), "memberStaysOf");
28096
28280
  var memberCountsOf = /* @__PURE__ */ __name(({ orm }, chatKey, since) => orm.select({
28097
28281
  day: memberCounts.date,
@@ -28111,7 +28295,7 @@ var profileRevisionsOf = /* @__PURE__ */ __name(({ orm }, chatKey, since) => {
28111
28295
  }).from(identityRevisions).innerJoin(identities, eq(identities.id, identityRevisions.identityId)).where(and(inArray(identityRevisions.identityId, people2), since === void 0 ? void 0 : gte(identityRevisions.createdAt, since))).orderBy(asc(identityRevisions.createdAt), asc(identityRevisions.id)).all().map((row2) => ({
28112
28296
  ...row2,
28113
28297
  marks: row2.marks ? JSON.parse(row2.marks) : {},
28114
- capturedAt: iso6(row2.capturedAt)
28298
+ capturedAt: iso7(row2.capturedAt)
28115
28299
  }));
28116
28300
  }, "profileRevisionsOf");
28117
28301
  var setTracked = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, tracked) => {
@@ -28120,11 +28304,11 @@ var setTracked = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, tracked) =
28120
28304
  var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => context.orm.select({ pk: chats.id, chatId: chats.externalId, title: chats.title, trackedAt: chats.membersTrackedAt }).from(chats).where(and(eq(chats.accountId, accountKey), isNotNull(chats.membersTrackedAt), where ? bound2(where) : void 0)).orderBy(asc(chats.membersTrackedAt)).all().map(({ pk, chatId, title, trackedAt }) => ({
28121
28305
  chatId,
28122
28306
  title,
28123
- trackedAt: iso6(trackedAt),
28307
+ trackedAt: iso7(trackedAt),
28124
28308
  lastCount: memberCountsOf(context, pk).at(-1) ?? null
28125
28309
  })), "trackedChats");
28126
28310
 
28127
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/roster.js
28311
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/roster.js
28128
28312
  var rosterStoreOver = /* @__PURE__ */ __name((context) => {
28129
28313
  const { database } = context;
28130
28314
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
@@ -28180,7 +28364,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
28180
28364
  };
28181
28365
  }, "rosterStoreOver");
28182
28366
 
28183
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
28367
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
28184
28368
  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");
28185
28369
  var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
28186
28370
  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 ?`);
@@ -28204,7 +28388,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
28204
28388
  }
28205
28389
  }, "backfillNormalized");
28206
28390
 
28207
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
28391
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
28208
28392
  var INDEX2 = "message_words";
28209
28393
  var searchIndexState2 = /* @__PURE__ */ __name((database) => {
28210
28394
  const row2 = indexRow(database, INDEX2);
@@ -28331,7 +28515,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
28331
28515
  });
28332
28516
  }, "resetSearchIndex");
28333
28517
 
28334
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
28518
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
28335
28519
  var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
28336
28520
  const filled2 = { stemmed: 0, drained: 0 };
28337
28521
  const before2 = stemsState(database);
@@ -28426,7 +28610,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
28426
28610
  return resetStems(database, { now: now2 });
28427
28611
  }, "followDefaultStemmers");
28428
28612
 
28429
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
28613
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
28430
28614
  var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
28431
28615
  var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
28432
28616
  const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
@@ -28448,10 +28632,10 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
28448
28632
  });
28449
28633
  }, "termCandidates");
28450
28634
 
28451
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/search-index.js
28635
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/search-index.js
28452
28636
  var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
28453
28637
  const { database } = context;
28454
- const stemmerFor = stemmerCache();
28638
+ const stemmerFor2 = stemmerCache();
28455
28639
  return {
28456
28640
  knownTerms: /* @__PURE__ */ __name(async (terms2) => knownTerms(context, terms2), "knownTerms"),
28457
28641
  termCandidates: /* @__PURE__ */ __name(async (trigrams2, lengths) => termCandidates(context, trigrams2, lengths), "termCandidates"),
@@ -28462,7 +28646,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
28462
28646
  const filled2 = fillStems(database, { now: context.now, ...until ? { until } : {} });
28463
28647
  const transcripts = corpusIndexState(database, CORPORA.transcript);
28464
28648
  if (transcripts.wanted !== null && (transcripts.pending > 0 || transcripts.built !== transcripts.wanted))
28465
- drainCorpus(database, CORPORA.transcript, stemmerFor, until ? { until } : {});
28649
+ drainCorpus(database, CORPORA.transcript, stemmerFor2, until ? { until } : {});
28466
28650
  return filled2;
28467
28651
  }, "fillStems"),
28468
28652
  stemmers: /* @__PURE__ */ __name(async () => savedStemmers(database), "stemmers"),
@@ -28470,7 +28654,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
28470
28654
  };
28471
28655
  }, "searchIndexStoreOver");
28472
28656
 
28473
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
28657
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
28474
28658
  var HISTORY_KEPT = 1e3;
28475
28659
  var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
28476
28660
  var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
@@ -28539,7 +28723,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
28539
28723
  return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
28540
28724
  }, "clearHistory");
28541
28725
 
28542
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/searches.js
28726
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/searches.js
28543
28727
  var searchesStoreOver = /* @__PURE__ */ __name((context) => {
28544
28728
  const { database } = context;
28545
28729
  return {
@@ -28563,7 +28747,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
28563
28747
  };
28564
28748
  }, "searchesStoreOver");
28565
28749
 
28566
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
28750
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
28567
28751
  var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
28568
28752
  var ACTION_OUTCOMES = ["ok", "refused", "failed"];
28569
28753
  var CODE = /^[a-z][a-z0-9_]{0,63}$/;
@@ -28606,7 +28790,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
28606
28790
  };
28607
28791
  }, "agentActionsStoreOver");
28608
28792
 
28609
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
28793
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
28610
28794
  var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
28611
28795
  }) => {
28612
28796
  const { database, now: now2 } = context;
@@ -28665,7 +28849,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
28665
28849
  };
28666
28850
  }, "botUpdateStoreOver");
28667
28851
 
28668
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
28852
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
28669
28853
  var DAY4 = 864e5;
28670
28854
  var listEvents = /* @__PURE__ */ __name((database, filter) => {
28671
28855
  const clauses = ["e.deleted_at IS NULL"];
@@ -28684,6 +28868,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
28684
28868
  }, "dated");
28685
28869
  dated("end_date > ?", filter.fromDate, "coalesce(e.ends_at, e.starts_at + 1) > ?", filter.from);
28686
28870
  dated("start_date < ?", filter.toDate, "e.starts_at < ?", filter.to);
28871
+ dated("start_date >= ?", filter.startsFromDate, "e.starts_at >= ?", filter.startsFrom);
28687
28872
  const longest = /* @__PURE__ */ __name(() => Number(database.prepare("SELECT coalesce(max(ends_at - starts_at), 0) AS ms FROM events WHERE deleted_at IS NULL").get()?.ms ?? 0), "longest");
28688
28873
  if (filter.from !== void 0) {
28689
28874
  clauses.push("e.starts_at >= ?");
@@ -28693,6 +28878,10 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
28693
28878
  clauses.push("e.starts_at < ?");
28694
28879
  params.push(filter.to + DAY4);
28695
28880
  }
28881
+ if (filter.startsFrom !== void 0 && filter.startsFromDate !== void 0) {
28882
+ clauses.push("e.starts_at >= ?");
28883
+ params.push(filter.startsFrom - DAY4);
28884
+ }
28696
28885
  if (filter.calendarId !== void 0) {
28697
28886
  clauses.push(entries("ce.calendar_id = ?"));
28698
28887
  params.push(filter.calendarId);
@@ -28745,7 +28934,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
28745
28934
  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);
28746
28935
  }, "listEvents");
28747
28936
 
28748
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
28937
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
28749
28938
  var calendarOf = /* @__PURE__ */ __name((row2) => ({
28750
28939
  id: Number(row2.id),
28751
28940
  accountId: Number(row2.account_id),
@@ -29325,7 +29514,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
29325
29514
  };
29326
29515
  }, "eventStoreOver");
29327
29516
 
29328
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
29517
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
29329
29518
  var CATALOG_QUERY = defineQuery({
29330
29519
  entity: "document",
29331
29520
  backend: "sql",
@@ -29567,7 +29756,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
29567
29756
  };
29568
29757
  }, "catalogStoreOver");
29569
29758
 
29570
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/context/evidence.js
29759
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/context/evidence.js
29571
29760
  import { createHash as createHash11 } from "node:crypto";
29572
29761
  var CONTEXT_MAX_READ_BYTES = 262144;
29573
29762
  var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
@@ -29665,7 +29854,7 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
29665
29854
  return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
29666
29855
  }, "contextEvidenceRequest");
29667
29856
 
29668
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
29857
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
29669
29858
  var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
29670
29859
  var field2 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
29671
29860
  CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
@@ -29678,7 +29867,7 @@ var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
29678
29867
  THEN 'source-modified' ELSE 'stored-update' END`;
29679
29868
  var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field2("sourceUrl")})`;
29680
29869
 
29681
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
29870
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
29682
29871
  var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
29683
29872
  const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
29684
29873
  signal?.throwIfAborted();
@@ -29777,7 +29966,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
29777
29966
  });
29778
29967
  }, "readMeetingContextEvidence");
29779
29968
 
29780
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
29969
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
29781
29970
  var corpora = {
29782
29971
  message: {
29783
29972
  table: "messages",
@@ -29964,12 +30153,12 @@ var contextEvidenceOver = /* @__PURE__ */ __name(({ database }) => ({
29964
30153
  });
29965
30154
  }
29966
30155
  }), "contextEvidenceOver");
29967
- var contextIndexOver = /* @__PURE__ */ __name(({ database }, stemmerFor) => ({
30156
+ var contextIndexOver = /* @__PURE__ */ __name(({ database }, stemmerFor2) => ({
29968
30157
  async catchUp({ kinds: kinds2, signal }) {
29969
30158
  signal?.throwIfAborted();
29970
- const mail = kinds2.includes("mail") ? drainEmailIndex(database, stemmerFor) : 0;
30159
+ const mail = kinds2.includes("mail") ? drainEmailIndex(database, stemmerFor2) : 0;
29971
30160
  signal?.throwIfAborted();
29972
- const documents2 = kinds2.includes("document") ? drainNoteIndex(database, stemmerFor) : 0;
30161
+ const documents2 = kinds2.includes("document") ? drainNoteIndex(database, stemmerFor2) : 0;
29973
30162
  return { mail, documents: documents2 };
29974
30163
  }
29975
30164
  }), "contextIndexOver");
@@ -30006,7 +30195,7 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
30006
30195
  }
30007
30196
  }), "contextRecordsOver");
30008
30197
 
30009
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
30198
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
30010
30199
  var NOTE_FIELDS = [
30011
30200
  "text",
30012
30201
  "exact",
@@ -30034,7 +30223,7 @@ var CORPORA2 = [
30034
30223
  type: "document",
30035
30224
  noun: "note",
30036
30225
  fields: NOTE_FIELDS,
30037
- view: "(SELECT id, account_id AS folder_id, external_id AS path, title, coalesce(body, '') AS text, metadata, updated_at AS at, deleted_at FROM documents)",
30226
+ view: `(SELECT n.id, n.account_id AS folder_id, n.external_id AS path, n.title, coalesce(n.body, '') AS text, n.metadata, ${contextDocumentTime} AS at, n.deleted_at FROM documents n)`,
30038
30227
  words: "document_words",
30039
30228
  stems: "document_stems",
30040
30229
  live: "coalesce(json_extract(n.metadata, '$.catalog.active'), 1)=1",
@@ -30051,12 +30240,22 @@ var CORPORA2 = [
30051
30240
  tagged: /* @__PURE__ */ __name((tag2) => bound3("n.id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'note')", tag2), "tagged")
30052
30241
  }
30053
30242
  ];
30054
- var searchNotes = /* @__PURE__ */ __name((context, query) => {
30055
- const offset = query.offset ?? 0;
30243
+ var matchedRows = /* @__PURE__ */ __name((context, query) => {
30056
30244
  const chosen = CORPORA2.filter(({ type }) => (query.source === void 0 || query.source === "file" === (type === "document")) && (!query.folderIds?.length || query.withInternal === true || type === "document"));
30057
- const rows = chosen.flatMap((corpus) => searchCorpus(context, { ...query, ...query.folderIds ? { accountIds: query.folderIds } : {} }, corpus));
30245
+ const idsOf = /* @__PURE__ */ __name((type) => query.refs?.flatMap((ref3) => ref3.startsWith(`${type}:`) ? [Number(ref3.slice(type.length + 1))] : []), "idsOf");
30246
+ const rows = chosen.flatMap((corpus) => {
30247
+ const ids = idsOf(corpus.type);
30248
+ if (ids?.length === 0)
30249
+ return [];
30250
+ return searchCorpus(context, { ...query, ...query.folderIds ? { accountIds: query.folderIds } : {}, ...ids ? { ids } : {} }, corpus);
30251
+ });
30058
30252
  const exactFirst = rows.some((row2) => row2.exact !== void 0);
30059
30253
  rows.sort((a, b) => query.newest ? (b.at ?? 0) - (a.at ?? 0) || a.id - b.id : (exactFirst ? Number(b.exact === true) - Number(a.exact === true) : 0) || Number(a.relevance === null) - Number(b.relevance === null) || (a.relevance ?? 0) - (b.relevance ?? 0) || (b.at ?? 0) - (a.at ?? 0) || a.id - b.id);
30254
+ return rows;
30255
+ }, "matchedRows");
30256
+ var searchNotes = /* @__PURE__ */ __name((context, query) => {
30257
+ const offset = query.offset ?? 0;
30258
+ const rows = matchedRows(context, query);
30060
30259
  const read2 = {
30061
30260
  document: context.database.prepare("SELECT * FROM documents WHERE id = ?"),
30062
30261
  note: context.database.prepare("SELECT * FROM notes WHERE id = ?")
@@ -30069,12 +30268,17 @@ var searchNotes = /* @__PURE__ */ __name((context, query) => {
30069
30268
  ref: note2.ref,
30070
30269
  note: note2,
30071
30270
  relevance: row2.relevance,
30072
- ...row2.exact === void 0 ? {} : { exact: row2.exact }
30271
+ ...row2.exact === void 0 ? {} : { exact: row2.exact },
30272
+ at: new Date(row2.at ?? 0).toISOString()
30073
30273
  };
30074
30274
  }),
30075
30275
  hasMore: rows.length > offset + query.limit
30076
30276
  };
30077
30277
  }, "searchNotes");
30278
+ var matchingNoteRefs = /* @__PURE__ */ __name((context, query) => {
30279
+ const rows = matchedRows(context, { ...query, newest: true });
30280
+ return { refs: rows.slice(0, query.limit).map(({ type, id: id2 }) => `${type}:${id2}`), hasMore: rows.length > query.limit };
30281
+ }, "matchingNoteRefs");
30078
30282
  var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
30079
30283
  const { database } = context;
30080
30284
  const wordMatch2 = /* @__PURE__ */ __name((match) => ({
@@ -30215,7 +30419,8 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
30215
30419
  const scope3 = combine2([
30216
30420
  bound3("n.deleted_at IS NULL"),
30217
30421
  ...corpus.live ? [bound3(corpus.live)] : [],
30218
- ...query.accountIds?.length && corpus.inAccounts ? [corpus.inAccounts(JSON.stringify(query.accountIds))] : []
30422
+ ...query.accountIds?.length && corpus.inAccounts ? [corpus.inAccounts(JSON.stringify(query.accountIds))] : [],
30423
+ ...query.ids ? [bound3("n.id IN (SELECT value FROM json_each(?))", JSON.stringify(query.ids))] : []
30219
30424
  ], "AND");
30220
30425
  const where = combine2([scope3, expression], "AND");
30221
30426
  const ranking = query.newest ? void 0 : required3(query.root, stemmed ? "stems" : "fts");
@@ -30236,7 +30441,7 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
30236
30441
  const leaves = [...fragments.entries()].filter(([node]) => !tests.has(node));
30237
30442
  const projection = tests.size ? leaves.map(([, fragment], index2) => `, coalesce(${fragment.sql}, 0) AS q${index2}`).join("") : "";
30238
30443
  const window = tests.size ? QUERY_LIMITS2.candidates + 1 : query.limit + offset + 1;
30239
- const rows = database.prepare(`${ctes.length ? `WITH ${ctes.join(", ")} ` : ""}SELECT n.*, ${ranking ? "f.rank" : "NULL"} AS relevance${exactTier ? ", n.id IN (SELECT id FROM x) AS exact" : ""}${projection}
30444
+ const rows = database.prepare(`${ctes.length ? `WITH ${ctes.join(", ")} ` : ""}SELECT ${tests.size ? "n.*" : "n.id, n.at"}, ${ranking ? "f.rank" : "NULL"} AS relevance${exactTier ? ", n.id IN (SELECT id FROM x) AS exact" : ""}${projection}
30240
30445
  FROM ${corpus.view} n${ranking ? " LEFT JOIN f ON f.id = n.id" : ""} WHERE ${where.sql} ORDER BY ${order} LIMIT ?`).all(...cteParams, ...leaves.flatMap(([, fragment]) => tests.size ? fragment.params : []), ...where.params, window);
30241
30446
  if (tests.size && rows.length > QUERY_LIMITS2.candidates)
30242
30447
  exhausted("candidates");
@@ -30271,8 +30476,8 @@ var SCAN_PAGE3 = 5e3;
30271
30476
  var LIVE2 = "((k.chunkable_type = 'document' AND EXISTS (SELECT 1 FROM documents d WHERE d.id = k.chunkable_id AND d.deleted_at IS NULL AND coalesce(json_extract(d.metadata, '$.catalog.active'), 1)=1 AND (? IS NULL OR d.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))))) OR (k.chunkable_type = 'note' AND ? IS NULL AND EXISTS (SELECT 1 FROM notes n WHERE n.id = k.chunkable_id AND n.deleted_at IS NULL)))";
30272
30477
  var noteSearchOver = /* @__PURE__ */ __name((context) => {
30273
30478
  const { database } = context;
30274
- const stemmerFor = stemmerCache();
30275
- const drain = /* @__PURE__ */ __name(() => drainNoteIndex(database, stemmerFor), "drain");
30479
+ const stemmerFor2 = stemmerCache();
30480
+ const drain = /* @__PURE__ */ __name(() => drainNoteIndex(database, stemmerFor2), "drain");
30276
30481
  const read2 = /* @__PURE__ */ __name((type, id2) => {
30277
30482
  const row2 = database.prepare(`SELECT * FROM ${type === "document" ? "documents" : "notes"} WHERE id = ?`).get(id2);
30278
30483
  return row2 ? type === "document" ? documentOf(row2) : noteOf(row2) : void 0;
@@ -30291,12 +30496,16 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
30291
30496
  drain();
30292
30497
  return searchNotes(context, query);
30293
30498
  }, "search"),
30499
+ matchingRefs: /* @__PURE__ */ __name(async (query) => {
30500
+ drain();
30501
+ return matchingNoteRefs(context, query);
30502
+ }, "matchingRefs"),
30294
30503
  indexState: /* @__PURE__ */ __name(async () => noteIndexState(database), "indexState"),
30295
30504
  chunksToEmbed: /* @__PURE__ */ __name(async (model, { after: after2, limit }) => {
30296
30505
  drain();
30297
30506
  const scope3 = live2(void 0, void 0);
30298
30507
  const texts2 = /* @__PURE__ */ new Map();
30299
- const textOf5 = /* @__PURE__ */ __name((owner) => {
30508
+ const textOf6 = /* @__PURE__ */ __name((owner) => {
30300
30509
  if (!texts2.has(owner)) {
30301
30510
  const [type, id2] = owner.split(":");
30302
30511
  const note2 = read2(String(type), Number(id2));
@@ -30309,7 +30518,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
30309
30518
  WHERE k.content_hash > ?${scope3.sql}
30310
30519
  AND NOT EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ? AND v.content_hash = k.content_hash)
30311
30520
  GROUP BY k.content_hash ORDER BY k.content_hash LIMIT ?`).all(after2 ?? "", ...scope3.params, model, limit).flatMap((row2) => {
30312
- const text5 = textOf5(String(row2.owner));
30521
+ const text5 = textOf6(String(row2.owner));
30313
30522
  return text5 === void 0 ? [] : [{ hash: String(row2.hash), text: text5.slice(Number(row2.start), Number(row2.end)) }];
30314
30523
  });
30315
30524
  }, "chunksToEmbed"),
@@ -30391,11 +30600,32 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
30391
30600
  const note2 = read2(String(type), Number(id2));
30392
30601
  return note2 ? [{ ref: note2.ref, note: note2, score, range: { start, end } }] : [];
30393
30602
  });
30394
- }, "nearest")
30603
+ }, "nearest"),
30604
+ scoreNotes: /* @__PURE__ */ __name(async (model, query, refs) => {
30605
+ drain();
30606
+ const scope3 = live2(void 0, void 0, true);
30607
+ const owned = database.prepare(`SELECT k.chunkable_type AS type, k.chunkable_id AS owner, v.vector
30608
+ FROM chunks k JOIN embeddings v ON v.model = ? AND v.content_hash = k.content_hash
30609
+ WHERE k.chunkable_type = ? AND k.chunkable_id IN (SELECT value FROM json_each(?))${scope3.sql}`);
30610
+ const best = /* @__PURE__ */ new Map();
30611
+ for (const type of ["document", "note"]) {
30612
+ const ids = refs.flatMap((ref3) => ref3.startsWith(`${type}:`) ? [Number(ref3.slice(type.length + 1))] : []);
30613
+ if (!ids.length)
30614
+ continue;
30615
+ for (const row2 of owned.all(model, type, JSON.stringify(ids), ...scope3.params)) {
30616
+ const key2 = `${row2.type}:${row2.owner}`;
30617
+ const score = dot(query, row2.vector);
30618
+ if (score > (best.get(key2) ?? Number.NEGATIVE_INFINITY))
30619
+ best.set(key2, score);
30620
+ }
30621
+ }
30622
+ const order = new Map(refs.map((ref3, index2) => [ref3, index2]));
30623
+ return [...best].map(([ref3, score]) => ({ ref: ref3, score })).sort((a, b) => b.score - a.score || (order.get(a.ref) ?? 0) - (order.get(b.ref) ?? 0));
30624
+ }, "scoreNotes")
30395
30625
  };
30396
30626
  }, "noteSearchOver");
30397
30627
 
30398
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
30628
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
30399
30629
  var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
30400
30630
  var inEventAccounts = /* @__PURE__ */ __name((event) => searchableCopy(event, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
30401
30631
  var EVENT_CORPUS = {
@@ -30415,8 +30645,8 @@ var EVENT_CORPUS = {
30415
30645
  var SCAN_PAGE4 = 5e3;
30416
30646
  var eventSearchOver = /* @__PURE__ */ __name((context) => {
30417
30647
  const { database } = context;
30418
- const stemmerFor = stemmerCache();
30419
- const drain = /* @__PURE__ */ __name(() => drainCorpus(database, CORPORA.event, stemmerFor), "drain");
30648
+ const stemmerFor2 = stemmerCache();
30649
+ const drain = /* @__PURE__ */ __name(() => drainCorpus(database, CORPORA.event, stemmerFor2), "drain");
30420
30650
  const live2 = /* @__PURE__ */ __name((accountIds) => {
30421
30651
  const sql2 = ` AND k.chunkable_type = 'event' AND EXISTS (SELECT 1 FROM events e WHERE e.id = k.chunkable_id AND ${EVENT_LIVE})`;
30422
30652
  return accountIds?.length ? { sql: `${sql2} AND ${inEventAccounts("k.chunkable_id")}`, params: [JSON.stringify(accountIds)] } : { sql: sql2, params: [] };
@@ -30527,7 +30757,7 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
30527
30757
  };
30528
30758
  }, "eventSearchOver");
30529
30759
 
30530
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
30760
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
30531
30761
  var EVIDENCE_FINDINGS_KIND = "evidence_findings";
30532
30762
  var reference = /* @__PURE__ */ __name((raw) => {
30533
30763
  if (/^document:[1-9]\d*$/.test(raw))
@@ -30540,7 +30770,7 @@ var reference = /* @__PURE__ */ __name((raw) => {
30540
30770
  }, "reference");
30541
30771
  var validateEvidenceFindings = /* @__PURE__ */ __name((input) => validateFindings(input, { plural: "evidence findings", singular: "evidence finding", cited: "reference", reference }), "validateEvidenceFindings");
30542
30772
 
30543
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/moment.js
30773
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/moment.js
30544
30774
  var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
30545
30775
  try {
30546
30776
  return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
@@ -30552,9 +30782,9 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
30552
30782
  }
30553
30783
  }, "calendarMoment");
30554
30784
 
30555
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
30785
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
30556
30786
  var NAMED3 = "SELECT f.*, b.name AS author_name FROM facts f LEFT JOIN bots b ON f.author_type = 'bot' AND b.id = f.author_id";
30557
- var iso7 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
30787
+ var iso8 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
30558
30788
  var oneOf4 = /* @__PURE__ */ __name((value, allowed, what) => {
30559
30789
  if (typeof value !== "string" || !allowed.includes(value))
30560
30790
  throw new CliError("validation_error", `${what} is one of ${allowed.join(", ")}`);
@@ -30569,8 +30799,8 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
30569
30799
  statement: String(row2.statement),
30570
30800
  status: row2.status,
30571
30801
  project: row2.project_id == null ? null : `project:${row2.project_id}`,
30572
- subject: row2.subject_type == null ? null : referenceOfThing(database, storedThing(row2.subject_type, row2.subject_id)) ?? null,
30573
- occurredAt: row2.occurred_at == null ? null : iso7(row2.occurred_at),
30802
+ ...subjectOf(database, row2),
30803
+ occurredAt: row2.occurred_at == null ? null : iso8(row2.occurred_at),
30574
30804
  supersedes: row2.supersedes_id == null ? null : `fact:${row2.supersedes_id}`,
30575
30805
  author: authorOf(row2),
30576
30806
  model: row2.model == null ? null : String(row2.model),
@@ -30578,8 +30808,8 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
30578
30808
  scope: row2.scope == null ? null : row2.scope,
30579
30809
  source: String(row2.source),
30580
30810
  evidence: evidenceOf(context, { type: "fact", id: Number(row2.id) }),
30581
- createdAt: iso7(row2.created_at),
30582
- updatedAt: iso7(row2.updated_at)
30811
+ createdAt: iso8(row2.created_at),
30812
+ updatedAt: iso8(row2.updated_at)
30583
30813
  }), "factOf");
30584
30814
  const rowOf = /* @__PURE__ */ __name((reference2) => {
30585
30815
  const thing = requiredThing(database, reference2.includes(":") ? reference2 : `fact:${reference2}`, "the fact");
@@ -30620,7 +30850,7 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
30620
30850
  const owner = input.by === "owner";
30621
30851
  const { actor, model } = authorActor(context, input.by);
30622
30852
  const at = now2();
30623
- const made = Number(database.prepare("INSERT INTO facts (type, statement, status, project_id, subject_type, subject_id, occurred_at, supersedes_id, author_type, author_id, model, scope, source, created_at, updated_at) VALUES (?, ?, 'proposed', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(type, statement, project?.id ?? null, subject2?.type ?? null, subject2?.id ?? null, occurredAt, replaced === void 0 ? null : Number(replaced.id), actor.type, actor.id, model, scope3, owner ? "owner" : "agent", at, at)?.id);
30853
+ const made = Number(database.prepare("INSERT INTO facts (id, type, statement, status, project_id, subject_type, subject_id, occurred_at, supersedes_id, author_type, author_id, model, scope, source, created_at, updated_at) VALUES (?, ?, ?, 'proposed', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(nextId(database, "facts"), type, statement, project?.id ?? null, subject2?.type ?? null, subject2?.id ?? null, occurredAt, replaced === void 0 ? null : Number(replaced.id), actor.type, actor.id, model, scope3, owner ? "owner" : "agent", at, at)?.id);
30624
30854
  linkEvidence(context, { type: "fact", id: made }, input.evidence ?? [], owner ? "owner" : "agent");
30625
30855
  if (input.createdFrom !== void 0) {
30626
30856
  const from2 = requiredThing(database, input.createdFrom, "the source");
@@ -30651,9 +30881,44 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
30651
30881
  throw new CliError("validation_error", "only an accepted decision can be reversed");
30652
30882
  database.prepare("UPDATE facts SET status = 'reversed', updated_at = ? WHERE id = ?").run(now2(), Number(row2.id));
30653
30883
  return factOf(rowOf(reference2));
30654
- }, "reverse")
30884
+ }, "reverse"),
30885
+ reject: /* @__PURE__ */ __name((reference2) => {
30886
+ const row2 = rowOf(reference2);
30887
+ if (row2.status !== "proposed")
30888
+ throw new CliError("validation_error", `only a proposed fact can be rejected; this one is ${String(row2.status)}`);
30889
+ database.prepare("UPDATE facts SET status = 'rejected', updated_at = ? WHERE id = ?").run(now2(), Number(row2.id));
30890
+ return factOf(rowOf(reference2));
30891
+ }, "reject"),
30892
+ remove: /* @__PURE__ */ __name((reference2) => {
30893
+ const row2 = rowOf(reference2);
30894
+ const id2 = Number(row2.id);
30895
+ const twin = row2.source === "memory" && row2.metadata != null ? migratedFrom(String(row2.metadata)) : void 0;
30896
+ const links2 = erase(database, () => {
30897
+ keepHighestId(database, "facts", now2());
30898
+ if (twin !== void 0)
30899
+ keepHighestId(database, "memories", now2());
30900
+ database.prepare("UPDATE facts SET supersedes_id = NULL WHERE supersedes_id = ?").run(id2);
30901
+ const count = dropLinksOf(database, { type: "fact", id: id2 });
30902
+ database.prepare("DELETE FROM links WHERE from_type = 'fact' AND from_id = ?").run(id2);
30903
+ database.prepare("DELETE FROM taggings WHERE taggable_type = 'fact' AND taggable_id = ?").run(id2);
30904
+ database.prepare("DELETE FROM facts WHERE id = ?").run(id2);
30905
+ if (twin !== void 0)
30906
+ database.prepare("DELETE FROM memories WHERE id = ? AND deleted_at IS NOT NULL").run(twin);
30907
+ return count;
30908
+ });
30909
+ return { ref: `fact:${id2}`, removed: true, links: links2 };
30910
+ }, "remove"),
30911
+ sources: /* @__PURE__ */ __name((reference2) => evidenceSourcesOf(database, { type: "fact", id: Number(rowOf(reference2).id) }), "sources")
30655
30912
  };
30656
30913
  }, "factOperationsOver");
30914
+ var migratedFrom = /* @__PURE__ */ __name((metadata3) => {
30915
+ try {
30916
+ const { memory } = JSON.parse(metadata3);
30917
+ return Number.isInteger(memory) ? Number(memory) : void 0;
30918
+ } catch {
30919
+ return void 0;
30920
+ }
30921
+ }, "migratedFrom");
30657
30922
  var factsStoreOver = /* @__PURE__ */ __name((context) => {
30658
30923
  const operations = factOperationsOver(context);
30659
30924
  return {
@@ -30661,11 +30926,14 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
30661
30926
  get: /* @__PURE__ */ __name(async (reference2) => operations.get(reference2), "get"),
30662
30927
  list: /* @__PURE__ */ __name(async (options) => operations.list(options), "list"),
30663
30928
  accept: /* @__PURE__ */ __name(async (reference2) => operations.accept(reference2), "accept"),
30664
- reverse: /* @__PURE__ */ __name(async (reference2) => operations.reverse(reference2), "reverse")
30929
+ reverse: /* @__PURE__ */ __name(async (reference2) => operations.reverse(reference2), "reverse"),
30930
+ reject: /* @__PURE__ */ __name(async (reference2) => operations.reject(reference2), "reject"),
30931
+ remove: /* @__PURE__ */ __name(async (reference2) => operations.remove(reference2), "remove"),
30932
+ sources: /* @__PURE__ */ __name(async (reference2) => operations.sources(reference2), "sources")
30665
30933
  };
30666
30934
  }, "factsStoreOver");
30667
30935
 
30668
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
30936
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
30669
30937
  var invalid2 = /* @__PURE__ */ __name((message2) => {
30670
30938
  throw new CliError("validation_error", message2);
30671
30939
  }, "invalid");
@@ -30755,10 +31023,10 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
30755
31023
  return { snapshot: snapshot2, snapshotParts, previous, outcomes };
30756
31024
  }, "findingsCoreOver");
30757
31025
 
30758
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
31026
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
30759
31027
  var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
30760
31028
  var PROPOSAL_VERDICTS = ["useful", "not_useful"];
30761
- var iso8 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
31029
+ var iso9 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
30762
31030
  var NAMED4 = "SELECT p.*, b.name AS proposer_name FROM proposed_actions p LEFT JOIN bots b ON p.proposed_by_type = 'bot' AND b.id = p.proposed_by_id";
30763
31031
  var json2 = /* @__PURE__ */ __name((value) => value == null ? null : JSON.parse(String(value)), "json");
30764
31032
  var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
@@ -30779,12 +31047,12 @@ var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
30779
31047
  name: row2.proposer_name == null ? null : String(row2.proposer_name)
30780
31048
  },
30781
31049
  decidedBy: row2.decided_by_type == null ? null : { type: row2.decided_by_type, id: String(row2.decided_by_id) },
30782
- decidedAt: iso8(row2.decided_at),
30783
- executedAt: iso8(row2.executed_at),
31050
+ decidedAt: iso9(row2.decided_at),
31051
+ executedAt: iso9(row2.executed_at),
30784
31052
  result: json2(row2.result),
30785
31053
  error: row2.error == null ? null : String(row2.error),
30786
31054
  verdict: row2.verdict ?? null,
30787
- createdAt: iso8(row2.created_at)
31055
+ createdAt: iso9(row2.created_at)
30788
31056
  };
30789
31057
  }, "actionOf");
30790
31058
  const rowOf = /* @__PURE__ */ __name((id2) => {
@@ -30901,7 +31169,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
30901
31169
  };
30902
31170
  }, "proposedActionsStoreOver");
30903
31171
 
30904
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
31172
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
30905
31173
  var stale = /* @__PURE__ */ __name(() => {
30906
31174
  throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
30907
31175
  reason: "evidence-findings.stale"
@@ -31067,7 +31335,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31067
31335
  };
31068
31336
  }, "evidenceFindingsStoreOver");
31069
31337
 
31070
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
31338
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
31071
31339
  var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
31072
31340
  var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
31073
31341
  rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
@@ -31120,7 +31388,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
31120
31388
  }, "forPerson")
31121
31389
  }), "involvementStoreOver");
31122
31390
 
31123
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
31391
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
31124
31392
  import { createHash as createHash12 } from "node:crypto";
31125
31393
  var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
31126
31394
  var id = /* @__PURE__ */ __name((value) => {
@@ -31206,16 +31474,16 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
31206
31474
  };
31207
31475
  }, "meetingProjectsStoreOver");
31208
31476
 
31209
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
31477
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
31210
31478
  import { createHash as createHash15 } from "node:crypto";
31211
31479
 
31212
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
31480
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
31213
31481
  import { createHash as createHash14 } from "node:crypto";
31214
31482
 
31215
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
31483
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
31216
31484
  import { createHash as createHash13 } from "node:crypto";
31217
31485
 
31218
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
31486
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
31219
31487
  var consolidationId = /* @__PURE__ */ __name((value, field3) => {
31220
31488
  if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
31221
31489
  throw new CliError("validation_error", `${field3} must be a positive canonical tag id`);
@@ -31266,7 +31534,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
31266
31534
  return input;
31267
31535
  }, "consolidationApplyInput");
31268
31536
 
31269
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
31537
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
31270
31538
  var receiptOf = /* @__PURE__ */ __name((row2) => ({
31271
31539
  id: String(row2.id),
31272
31540
  sourceId: String(row2.source_id),
@@ -31341,7 +31609,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
31341
31609
  }, { beforeCommit: check3 });
31342
31610
  }, "applyTagConsolidation");
31343
31611
 
31344
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
31612
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
31345
31613
  var selections = [
31346
31614
  ["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
31347
31615
  ["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
@@ -31485,7 +31753,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
31485
31753
  };
31486
31754
  }, "previewRows");
31487
31755
 
31488
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
31756
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
31489
31757
  var kinds = ["project", "tag", "topic"];
31490
31758
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
31491
31759
  if (signal?.aborted)
@@ -31749,18 +32017,18 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
31749
32017
  };
31750
32018
  }, "vocabularyStoreOver");
31751
32019
 
31752
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
32020
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
31753
32021
  var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
31754
32022
  var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
31755
32023
  var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
31756
32024
  var SCOPES = ["personal", "work"];
31757
- var iso9 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
32025
+ var iso10 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
31758
32026
  var bounded2 = /* @__PURE__ */ __name((limit = 100, offset = 0) => {
31759
32027
  if (!Number.isInteger(limit) || limit < 1 || limit > 500 || !Number.isInteger(offset) || offset < 0 || offset > 1e5)
31760
32028
  throw new CliError("validation_error", "limit takes 1\u2013500 and offset takes 0\u2013100000");
31761
32029
  return { limit, offset };
31762
32030
  }, "bounded");
31763
- var textOf3 = /* @__PURE__ */ __name((text5, max = 1e5) => {
32031
+ var textOf4 = /* @__PURE__ */ __name((text5, max = 1e5) => {
31764
32032
  const value = text5.trim();
31765
32033
  if (!value || value.length > max)
31766
32034
  throw new CliError("validation_error", `text takes 1\u2013${max} characters`);
@@ -31887,8 +32155,8 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
31887
32155
  text: String(row2.body),
31888
32156
  revision: Number(row2.revision),
31889
32157
  authoredBy: "owner",
31890
- createdAt: iso9(row2.created_at),
31891
- updatedAt: iso9(row2.updated_at)
32158
+ createdAt: iso10(row2.created_at),
32159
+ updatedAt: iso10(row2.updated_at)
31892
32160
  };
31893
32161
  }, "annotationOf");
31894
32162
  const noteRow = /* @__PURE__ */ __name((id2) => /^\d+$/.test(id2) ? database.prepare("SELECT * FROM notes WHERE id = ? AND deleted_at IS NULL").get(Number(id2)) : void 0, "noteRow");
@@ -31906,7 +32174,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
31906
32174
  kind: row2.kind,
31907
32175
  name: String(row2.name),
31908
32176
  scope: row2.scope,
31909
- createdAt: iso9(row2.created_at)
32177
+ createdAt: iso10(row2.created_at)
31910
32178
  }), "organizationOf");
31911
32179
  const projectOf = /* @__PURE__ */ __name((row2) => ({
31912
32180
  id: String(row2.id),
@@ -31917,7 +32185,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
31917
32185
  type: row2.type,
31918
32186
  organizationId: row2.organization_id == null ? null : String(row2.organization_id),
31919
32187
  scope: row2.scope,
31920
- createdAt: iso9(row2.created_at)
32188
+ createdAt: iso10(row2.created_at)
31921
32189
  }), "projectOf");
31922
32190
  const relationOf = /* @__PURE__ */ __name((link3) => ({
31923
32191
  id: link3.id,
@@ -31954,7 +32222,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
31954
32222
  const reminderOf = /* @__PURE__ */ __name((row2) => ({
31955
32223
  id: String(row2.id),
31956
32224
  task: taskIdOf(database, Number(row2.task_id)) ?? String(row2.task_id),
31957
- dueAt: iso9(row2.due_at),
32225
+ dueAt: iso10(row2.due_at),
31958
32226
  timezone: String(row2.timezone),
31959
32227
  state: row2.state,
31960
32228
  revision: Number(row2.revision),
@@ -31996,7 +32264,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
31996
32264
  return { items: rows.slice(0, limit).map((row2) => String(row2.id ?? row2.key)), hasMore: rows.length > limit };
31997
32265
  }, "taskIds"),
31998
32266
  addAnnotation: /* @__PURE__ */ __name(async (key2, target, text5) => {
31999
- const body2 = textOf3(text5);
32267
+ const body2 = textOf4(text5);
32000
32268
  if (subfolder(target) !== null)
32001
32269
  throw new CliError("validation_error", "annotate a folder, not one of its subfolders");
32002
32270
  const thing = available(key2, target);
@@ -32021,7 +32289,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
32021
32289
  annotation: /* @__PURE__ */ __name(async (key2, id2) => annotation(key2, id2), "annotation"),
32022
32290
  editAnnotation: /* @__PURE__ */ __name(async (key2, id2, text5, revision2) => {
32023
32291
  const held = annotation(key2, id2);
32024
- const changed = database.prepare("UPDATE notes SET body=?, revision=revision+1, updated_at=? WHERE id=? AND revision=?").run(textOf3(text5), now2(), Number(id2), revision2).changes;
32292
+ const changed = database.prepare("UPDATE notes SET body=?, revision=revision+1, updated_at=? WHERE id=? AND revision=?").run(textOf4(text5), now2(), Number(id2), revision2).changes;
32025
32293
  if (!changed)
32026
32294
  throw new CliError("validation_error", "annotation changed; read the current revision before editing");
32027
32295
  database.prepare("INSERT INTO note_revisions (note_id, body, revision, created_at) VALUES (?, ?, ?, ?)").run(Number(id2), held.text, held.revision, now2());
@@ -32094,7 +32362,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
32094
32362
  }, "labelled"),
32095
32363
  addOrganization: /* @__PURE__ */ __name(async ({ kind: kind3, name, scope: scope3 = "personal" }) => {
32096
32364
  const at = now2();
32097
- const row2 = database.prepare("INSERT INTO organizations (kind, name, scope, created_at, updated_at) VALUES (?, ?, ?, ?, ?) RETURNING *").get(oneOf5(kind3, ORGANIZATION_KINDS, "an organization's kind"), textOf3(name, 200), oneOf5(scope3, SCOPES, "a scope"), at, at);
32365
+ const row2 = database.prepare("INSERT INTO organizations (kind, name, scope, created_at, updated_at) VALUES (?, ?, ?, ?, ?) RETURNING *").get(oneOf5(kind3, ORGANIZATION_KINDS, "an organization's kind"), textOf4(name, 200), oneOf5(scope3, SCOPES, "a scope"), at, at);
32098
32366
  return organizationOf(row2);
32099
32367
  }, "addOrganization"),
32100
32368
  organizations: /* @__PURE__ */ __name(async (query) => {
@@ -32107,7 +32375,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
32107
32375
  return database.prepare(`SELECT * FROM organizations WHERE deleted_at IS NULL${where ? ` AND (${where.sql})` : ""} ORDER BY name, id LIMIT 500`).all(...where?.params ?? []).map(organizationOf);
32108
32376
  }, "organizations"),
32109
32377
  addProject: /* @__PURE__ */ __name(async ({ name, key: key2, type = "other", organization, scope: scope3 = "personal", description }) => write(database, () => {
32110
- const title = textOf3(name, 200);
32378
+ const title = textOf4(name, 200);
32111
32379
  const organizationId = organization === void 0 ? null : (() => {
32112
32380
  const thing = thingOf(database, organization);
32113
32381
  if (thing?.type !== "organization")
@@ -32142,7 +32410,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
32142
32410
  chosen = `${wanted.slice(0, 4 - suffix.length)}${suffix}`;
32143
32411
  }
32144
32412
  const at = now2();
32145
- const row2 = database.prepare("INSERT INTO projects (key, name, name_folded, description, type, organization_id, scope, tasks_count, status, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, 0, 'active', ?, ?) RETURNING *").get(chosen, title, fold(title), description === void 0 ? null : textOf3(description, 2e3), oneOf5(type, PROJECT_TYPES, "a project's type"), organizationId, oneOf5(scope3, SCOPES, "a scope"), at, at);
32413
+ const row2 = database.prepare("INSERT INTO projects (key, name, name_folded, description, type, organization_id, scope, tasks_count, status, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, 0, 'active', ?, ?) RETURNING *").get(chosen, title, fold(title), description === void 0 ? null : textOf4(description, 2e3), oneOf5(type, PROJECT_TYPES, "a project's type"), organizationId, oneOf5(scope3, SCOPES, "a scope"), at, at);
32146
32414
  return projectOf(row2);
32147
32415
  }), "addProject"),
32148
32416
  projects: /* @__PURE__ */ __name(async (query) => {
@@ -32271,7 +32539,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
32271
32539
  return key2.padEnd(3, "X");
32272
32540
  }, "projectKey");
32273
32541
 
32274
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
32542
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
32275
32543
  var DAY5 = 864e5;
32276
32544
  var SETTING4 = "logs_pruned_at";
32277
32545
  var LOG_RETENTION = { agentActionsMs: 90 * DAY5, botUpdatePayloadsMs: 30 * DAY5 };
@@ -32298,7 +32566,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
32298
32566
  };
32299
32567
  }, "logPruner");
32300
32568
 
32301
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
32569
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
32302
32570
  var stale2 = /* @__PURE__ */ __name(() => {
32303
32571
  throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
32304
32572
  reason: "meeting-findings.stale"
@@ -32467,7 +32735,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
32467
32735
  };
32468
32736
  }, "meetingFindingsStoreOver");
32469
32737
 
32470
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
32738
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
32471
32739
  var RANK_BATCH = 512;
32472
32740
  var LIVE3 = "FROM chunks k JOIN meeting_transcripts t ON k.chunkable_type = 'meeting_transcript' AND t.id = k.chunkable_id JOIN meetings m ON m.id = t.meeting_id WHERE m.account_id = ? AND m.deleted_at IS NULL AND t.deleted_at IS NULL AND t.superseded_at IS NULL";
32473
32741
  var limitOf = /* @__PURE__ */ __name((value, name, max = 1e3) => {
@@ -32487,7 +32755,7 @@ var modelOf = /* @__PURE__ */ __name((model) => {
32487
32755
  var missing3 = /* @__PURE__ */ __name(() => {
32488
32756
  throw new CliError("not_found", "Current transcript not found");
32489
32757
  }, "missing");
32490
- var textOf4 = /* @__PURE__ */ __name((context, accountId, transcriptId, budget, signal) => {
32758
+ var textOf5 = /* @__PURE__ */ __name((context, accountId, transcriptId, budget, signal) => {
32491
32759
  const maxRows = limitOf(budget.maxRows ?? 1e4, "maxRows", 1e5);
32492
32760
  const maxBytes = limitOf(budget.maxTextBytes ?? 4 * 1024 * 1024, "maxTextBytes", 64 * 1024 * 1024);
32493
32761
  const parent2 = context.database.prepare("SELECT m.id AS meeting_id FROM meeting_transcripts t JOIN meetings m ON m.id=t.meeting_id WHERE t.id=? AND m.account_id=? AND m.deleted_at IS NULL AND t.deleted_at IS NULL AND t.superseded_at IS NULL").get(transcriptId, accountId) ?? missing3();
@@ -32521,14 +32789,14 @@ var textLoader = /* @__PURE__ */ __name((context, input) => {
32521
32789
  return existing;
32522
32790
  if (remaining <= 0)
32523
32791
  throw new CliError("validation_error", "Vector operation exceeds its aggregate text read budget");
32524
- const document = textOf4(context, input.accountId, id2, { ...input, maxTextBytes: remaining }, input.signal);
32792
+ const document = textOf5(context, input.accountId, id2, { ...input, maxTextBytes: remaining }, input.signal);
32525
32793
  remaining -= document.readBytes;
32526
32794
  loaded3.set(id2, document);
32527
32795
  return document;
32528
32796
  };
32529
32797
  }, "textLoader");
32530
32798
  var chunkText = /* @__PURE__ */ __name((context, accountId, row2, budget, signal, loaded3) => {
32531
- const document = loaded3 ?? textOf4(context, accountId, Number(row2.chunkable_id), budget, signal);
32799
+ const document = loaded3 ?? textOf5(context, accountId, Number(row2.chunkable_id), budget, signal);
32532
32800
  const start = Number(row2.start_offset), end = Number(row2.end_offset);
32533
32801
  const text5 = document.text.slice(start, end);
32534
32802
  if (chunkHash(text5) !== String(row2.content_hash))
@@ -32738,7 +33006,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
32738
33006
  }
32739
33007
  }), "meetingVectorsOver");
32740
33008
 
32741
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
33009
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
32742
33010
  var OTHER_SOURCES = ["document", "note", "email"];
32743
33011
  var TEXTS = {
32744
33012
  document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
@@ -32839,11 +33107,11 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
32839
33107
  };
32840
33108
  }, "sourceMentionStoreOver");
32841
33109
 
32842
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
33110
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
32843
33111
  import { mkdirSync, statSync, writeFileSync } from "node:fs";
32844
33112
  import { dirname } from "node:path";
32845
33113
 
32846
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
33114
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
32847
33115
  import { readFileSync as readFileSync3 } from "node:fs";
32848
33116
  var CLIENTS_SETTING = "clients";
32849
33117
  var coreVersion = (() => {
@@ -32901,7 +33169,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
32901
33169
  return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
32902
33170
  }, "refusalAdvice");
32903
33171
 
32904
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
33172
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
32905
33173
  var GENERATED = [
32906
33174
  {
32907
33175
  "name": "20261010184427_initial",
@@ -33767,7 +34035,7 @@ WHERE json_type(params, '$.selection') = 'object';`
33767
34035
  }
33768
34036
  ];
33769
34037
 
33770
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
34038
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
33771
34039
  var MANIFEST = [
33772
34040
  { name: "20261010184427_initial", version: 1, minCompatible: 1 },
33773
34041
  { name: "20261011035353_version-2-facts", version: 2, minCompatible: 1 },
@@ -33845,7 +34113,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
33845
34113
  return migrations;
33846
34114
  }, "generatedMigrations");
33847
34115
 
33848
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/migrations.js
34116
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/migrations.js
33849
34117
  var MIGRATIONS = generatedMigrations();
33850
34118
  var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
33851
34119
  version INTEGER PRIMARY KEY,
@@ -33898,7 +34166,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
33898
34166
  }
33899
34167
  }, "migrate");
33900
34168
 
33901
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
34169
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
33902
34170
  var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
33903
34171
  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 ?");
33904
34172
  if (pending.get(0, 1) === void 0)
@@ -33920,7 +34188,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
33920
34188
  }
33921
34189
  }, "fillJoinKeys");
33922
34190
 
33923
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
34191
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
33924
34192
  var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
33925
34193
  const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
33926
34194
  try {
@@ -33933,8 +34201,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
33933
34201
  }, "openSqlite");
33934
34202
  var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
33935
34203
  quietSqliteWarning();
33936
- const { drizzle } = await import("./node-R2BLYUSB.js");
33937
- const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-7CGHAHIS.js");
34204
+ const { drizzle } = await import("./node-GFOH6FKP.js");
34205
+ const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-QXKSPHTP.js");
33938
34206
  const client = await nodeClient(path, { readOnly });
33939
34207
  try {
33940
34208
  return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
@@ -33944,8 +34212,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
33944
34212
  }
33945
34213
  }, "openUnderNode");
33946
34214
  var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
33947
- const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-B5CZHAV4.js");
33948
- const { drizzle } = await import("./bun-JVDJVDHL.js");
34215
+ const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-FWNCLOAR.js");
34216
+ const { drizzle } = await import("./bun-XRO6XJHQ.js");
33949
34217
  const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
33950
34218
  try {
33951
34219
  return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
@@ -33955,7 +34223,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
33955
34223
  }
33956
34224
  }, "openUnderBun");
33957
34225
 
33958
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
34226
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
33959
34227
  var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
33960
34228
  const ours = MIGRATIONS.at(-1)?.version ?? 0;
33961
34229
  if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
@@ -33970,7 +34238,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
33970
34238
  throw new CliError("configuration_error", `The store requires schema ${minCompatible}, but this tool supports ${ours}; ${refusalAdvice(storeClients(database), command, version)}`);
33971
34239
  }, "assertReadCompatible");
33972
34240
 
33973
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
34241
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
33974
34242
  var BACKFILL_ON_OPEN = 5e3;
33975
34243
  var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
33976
34244
  var createWritable = /* @__PURE__ */ __name((file) => {
@@ -34026,13 +34294,13 @@ var openStoreContext = /* @__PURE__ */ __name(async ({ path, env, now: now2 = Da
34026
34294
  }
34027
34295
  }, "openStoreContext");
34028
34296
 
34029
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
34297
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
34030
34298
  import { createHash as createHash17 } from "node:crypto";
34031
34299
 
34032
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
34300
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
34033
34301
  import { createHash as createHash16 } from "node:crypto";
34034
34302
 
34035
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
34303
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
34036
34304
  var text3 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
34037
34305
  var ref = text3(2048);
34038
34306
  var timestamp2 = pipe(number(), safeInteger(), minValue(0));
@@ -34098,7 +34366,7 @@ var projectAnnotationsSchema = strictObject({
34098
34366
  }))
34099
34367
  });
34100
34368
 
34101
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
34369
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
34102
34370
  var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
34103
34371
  var invalid5 = /* @__PURE__ */ __name((field3) => {
34104
34372
  throw new CliError("validation_error", `invalid project annotations.${field3}`);
@@ -34231,7 +34499,7 @@ var projectAnnotationsFingerprint = /* @__PURE__ */ __name((json3) => {
34231
34499
  return createHash16("sha256").update(JSON.stringify(normalized)).digest("hex");
34232
34500
  }, "projectAnnotationsFingerprint");
34233
34501
 
34234
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
34502
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
34235
34503
  var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
34236
34504
  var ref2 = pipe(string(), minLength(1), maxLength(2048));
34237
34505
  var targetSchema = strictObject({
@@ -34338,7 +34606,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
34338
34606
  }, "planBoundProjectAnnotations");
34339
34607
  var planProjectAnnotations = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotations(json3), projectAnnotationsFingerprint(json3), target, bindings), "planProjectAnnotations");
34340
34608
 
34341
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
34609
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
34342
34610
  import { createHash as createHash18 } from "node:crypto";
34343
34611
  var text4 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
34344
34612
  var timestamp3 = pipe(number(), safeInteger(), minValue(0));
@@ -34432,7 +34700,7 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
34432
34700
  })).digest("hex");
34433
34701
  }, "projectAnnotationSnapshotFingerprint");
34434
34702
 
34435
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
34703
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
34436
34704
  var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
34437
34705
  if (!request || typeof request !== "object" || Array.isArray(request))
34438
34706
  throw new CliError("validation_error", "project annotation request is required");
@@ -34449,7 +34717,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
34449
34717
  return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
34450
34718
  }, "projectAnnotationRequest");
34451
34719
 
34452
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
34720
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
34453
34721
  var SnapshotBudget = class {
34454
34722
  static {
34455
34723
  __name(this, "SnapshotBudget");
@@ -34475,13 +34743,13 @@ var SnapshotBudget = class {
34475
34743
  }
34476
34744
  };
34477
34745
 
34478
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
34746
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
34479
34747
  import { createHash as createHash20 } from "node:crypto";
34480
34748
 
34481
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
34749
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
34482
34750
  var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
34483
34751
 
34484
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
34752
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
34485
34753
  import { createHash as createHash19 } from "node:crypto";
34486
34754
  var invalid7 = /* @__PURE__ */ __name(() => {
34487
34755
  throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
@@ -34624,7 +34892,7 @@ var ProjectSnapshotSources = class {
34624
34892
  }
34625
34893
  };
34626
34894
 
34627
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
34895
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
34628
34896
  var unsupported = /* @__PURE__ */ __name(() => {
34629
34897
  throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
34630
34898
  }, "unsupported");
@@ -34795,7 +35063,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
34795
35063
  return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
34796
35064
  }), "projectAnnotationSnapshot");
34797
35065
 
34798
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
35066
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
34799
35067
  var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, manifest, bindings, budget) => read(database, () => {
34800
35068
  const current = projectAnnotationSnapshot(database, projectId, budget).snapshot;
34801
35069
  const sources = new ProjectSnapshotSources(database, budget);
@@ -34857,7 +35125,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
34857
35125
  };
34858
35126
  }), "previewAnnotationSnapshot");
34859
35127
 
34860
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
35128
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
34861
35129
  var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snapshot2, bindings) => {
34862
35130
  const mappings = { ...bindings };
34863
35131
  const resolve = /* @__PURE__ */ __name((ref3) => {
@@ -34876,7 +35144,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snap
34876
35144
  const author = resolve(fact.author), confirmed = resolve(fact.confirmed_by);
34877
35145
  if (!author)
34878
35146
  throw new CliError("validation_error", "project annotation author is required");
34879
- const row2 = database.prepare("INSERT INTO facts(type,statement,status,project_id,subject_type,subject_id,occurred_at,supersedes_id,author_type,author_id,model,confirmed_by_type,confirmed_by_id,scope,source,created_at,updated_at) VALUES(?,?,?,?,NULL,NULL,?,NULL,?,?,?,?,?,?,?,?,?) RETURNING id").get(fact.type, fact.statement, fact.status, projectId, fact.occurred_at, author.type, author.id, fact.model, confirmed?.type ?? null, confirmed?.id ?? null, fact.scope, fact.source, fact.created_at, fact.updated_at);
35147
+ const row2 = database.prepare("INSERT INTO facts(id,type,statement,status,project_id,subject_type,subject_id,occurred_at,supersedes_id,author_type,author_id,model,confirmed_by_type,confirmed_by_id,scope,source,created_at,updated_at) VALUES(?,?,?,?,?,NULL,NULL,?,NULL,?,?,?,?,?,?,?,?,?) RETURNING id").get(nextId(database, "facts"), fact.type, fact.statement, fact.status, projectId, fact.occurred_at, author.type, author.id, fact.model, confirmed?.type ?? null, confirmed?.id ?? null, fact.scope, fact.source, fact.created_at, fact.updated_at);
34880
35148
  if (!row2)
34881
35149
  throw new CliError("configuration_error", "project annotation fact insertion failed");
34882
35150
  mappings[fact.ref] = `fact:${row2.id}`;
@@ -34899,7 +35167,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snap
34899
35167
  return mappings;
34900
35168
  }, "restoreAnnotationRecords");
34901
35169
 
34902
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
35170
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
34903
35171
  var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
34904
35172
  async preview(request) {
34905
35173
  const { snapshot: snapshot2, projectId } = projectAnnotationRequest(request);
@@ -34929,7 +35197,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
34929
35197
  }
34930
35198
  }), "projectAnnotationStoreOver");
34931
35199
 
34932
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
35200
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
34933
35201
  var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
34934
35202
  const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
34935
35203
  let merged = { from: from2, to };
@@ -34942,7 +35210,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
34942
35210
  }, "markRange");
34943
35211
  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");
34944
35212
 
34945
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
35213
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
34946
35214
  var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
34947
35215
  var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
34948
35216
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
@@ -34952,7 +35220,7 @@ var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) =
34952
35220
  database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(keyOf4(account), JSON.stringify(until), now2);
34953
35221
  }, "setTaskRulesStop");
34954
35222
 
34955
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sync.js
35223
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sync.js
34956
35224
  var syncStoreOver = /* @__PURE__ */ __name((context) => {
34957
35225
  const { database } = context;
34958
35226
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
@@ -35008,7 +35276,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
35008
35276
  };
35009
35277
  }, "syncStoreOver");
35010
35278
 
35011
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/tags.js
35279
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/tags.js
35012
35280
  var tagsStoreOver = /* @__PURE__ */ __name((context) => {
35013
35281
  const { database } = context;
35014
35282
  return {
@@ -35030,7 +35298,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
35030
35298
  };
35031
35299
  }, "tagsStoreOver");
35032
35300
 
35033
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
35301
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
35034
35302
  var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
35035
35303
  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
35036
35304
  WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
@@ -35157,7 +35425,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
35157
35425
  dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
35158
35426
  }, "savePictureChunks");
35159
35427
 
35160
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
35428
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
35161
35429
  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,
35162
35430
  EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
35163
35431
  FROM messages m
@@ -35204,6 +35472,12 @@ var messageRows = /* @__PURE__ */ __name(({ orm }, accountPk2, { chatKey, model,
35204
35472
  ${since === void 0 ? sql`` : sql`AND m.sent_at >= ${since}`}
35205
35473
  ${before2 === void 0 ? sql`` : sql`AND m.sent_at < ${before2}`}
35206
35474
  ${"ids" in rows ? sql`AND k.id IN (SELECT value FROM json_each(${JSON.stringify(rows.ids)})) ORDER BY k.id` : sql`AND k.id > ${rows.after} ORDER BY k.id LIMIT ${SCAN_PAGE6}`}`), "messageRows");
35475
+ var scoreMessages = /* @__PURE__ */ __name(({ orm }, accountPk2, { model, query, pks }) => orm.all(sql`SELECT ch.external_id AS chatId, m.external_id AS messageId, v.vector
35476
+ FROM chunks k CROSS JOIN messages m ON m.id = k.chunkable_id AND m.deleted_at IS NULL
35477
+ JOIN chats ch ON ch.id = m.chat_id AND ch.searchable = 1
35478
+ JOIN embeddings v ON v.model = ${model} AND v.content_hash = k.content_hash
35479
+ WHERE k.chunkable_type = 'message' AND k.position = 0 AND k.account_id = ${accountPk2}
35480
+ AND k.chunkable_id IN (SELECT value FROM json_each(${JSON.stringify(pks)}))`).map(({ chatId, messageId, vector }) => ({ chatId, messageId, score: dot(query, vector) })).sort((a, b) => b.score - a.score), "scoreMessages");
35207
35481
  var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, query, ...filter }) => {
35208
35482
  const score = /* @__PURE__ */ __name((row2) => ({
35209
35483
  id: row2.id,
@@ -35240,7 +35514,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
35240
35514
  return plain2(best(found2));
35241
35515
  }, "nearestMessages");
35242
35516
 
35243
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/vectors.js
35517
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/vectors.js
35244
35518
  var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
35245
35519
  const { database } = context;
35246
35520
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -35381,6 +35655,10 @@ var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
35381
35655
  query
35382
35656
  });
35383
35657
  }, "nearestMessages"),
35658
+ scoreMessages: /* @__PURE__ */ __name(async (key2, options) => {
35659
+ const accountPk2 = findAccountPk2(key2);
35660
+ return accountPk2 === void 0 ? [] : scoreMessages(context, accountPk2, options);
35661
+ }, "scoreMessages"),
35384
35662
  vectorStatus: /* @__PURE__ */ __name(async (key2, chatId, model) => {
35385
35663
  const chatKey = chatKeyOf(key2, chatId);
35386
35664
  return chatKey === void 0 ? { chunks: 0, embedded: 0 } : vectorStatus(context, chatKey, model);
@@ -35494,7 +35772,7 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
35494
35772
  embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
35495
35773
  }), "vectorsStoreOver");
35496
35774
 
35497
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
35775
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
35498
35776
  import { existsSync, readFileSync as readFileSync4 } from "node:fs";
35499
35777
  import { dirname as dirname2, join as join2 } from "node:path";
35500
35778
  var BOOKKEEPING = ["schema_migrations", "store_settings"];
@@ -35582,10 +35860,10 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
35582
35860
  }
35583
35861
  }, "lastBackup");
35584
35862
 
35585
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/providers.js
35863
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/providers.js
35586
35864
  var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
35587
35865
 
35588
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
35866
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
35589
35867
  var COUNTED_TABLES = [
35590
35868
  "accounts",
35591
35869
  "chats",
@@ -35670,7 +35948,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
35670
35948
  };
35671
35949
  }, "storeContents");
35672
35950
 
35673
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/store/store.js
35951
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/store.js
35674
35952
  var openStore = /* @__PURE__ */ __name(async (options = {}) => {
35675
35953
  const context = await openStoreContext(options);
35676
35954
  try {
@@ -35693,10 +35971,10 @@ var areaOf = /* @__PURE__ */ __name((keyed, whole) => once3(() => {
35693
35971
  }), "areaOf");
35694
35972
  var storeOver = /* @__PURE__ */ __name((context) => {
35695
35973
  const { database } = context;
35696
- const stemmerFor = stemmerCache();
35974
+ const stemmerFor2 = stemmerCache();
35697
35975
  const pruneLogsWhenDue = logPruner(database, context.now);
35698
35976
  const own = /* @__PURE__ */ __name((keyed) => ({ ...keyed }), "own");
35699
- const mail = once3(() => mailStoreOver(context, stemmerFor));
35977
+ const mail = once3(() => mailStoreOver(context, stemmerFor2));
35700
35978
  const areas = {
35701
35979
  accounts: areaOf(() => accountAccountsOver(context), (keyed) => accountsStoreOver(context, keyed)),
35702
35980
  chats: areaOf(() => chatsStoreOver(context), own),
@@ -35713,10 +35991,10 @@ var storeOver = /* @__PURE__ */ __name((context) => {
35713
35991
  };
35714
35992
  const contextEvidence = once3(() => contextEvidenceOver(context));
35715
35993
  const projectAnnotations = once3(() => projectAnnotationStoreOver(context));
35716
- const contextIndex = once3(() => contextIndexOver(context, stemmerFor));
35994
+ const contextIndex = once3(() => contextIndexOver(context, stemmerFor2));
35717
35995
  const contextRecords = once3(() => contextRecordsOver(context));
35718
35996
  const searches2 = once3(() => searchesStoreOver(context));
35719
- const queries = once3(() => queriesStoreOver(context, stemmerFor));
35997
+ const queries = once3(() => queriesStoreOver(context, stemmerFor2));
35720
35998
  const searchIndex2 = once3(() => searchIndexStoreOver(context));
35721
35999
  const botUpdates2 = once3(() => botUpdateStoreOver(context, pruneLogsWhenDue));
35722
36000
  const involvements2 = once3(() => involvementStoreOver(context));