@wirecat/drive-cli 0.52.1 → 0.54.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 (218) hide show
  1. package/dist/bin/drive.js +2 -2
  2. package/dist/bin/drive.js.map +1 -1
  3. package/dist/bundle/{chunk-ZWSG7OCA.js → all-profiles-LFIPUPZI.js} +13 -8
  4. package/dist/bundle/{anthropic-KW6KU36Y.js → anthropic-G5ZRRWG4.js} +5 -5
  5. package/dist/bundle/{app-server-TCJZ333E.js → app-server-UVWATOQC.js} +48 -56
  6. package/dist/bundle/{bun-7SYKSCLA.js → bun-DNEFTPTR.js} +2 -2
  7. package/dist/bundle/{bun-sqlite-RI7DR6RZ.js → bun-sqlite-FWBYHIXB.js} +4 -4
  8. package/dist/bundle/{chunk-CM7GAXGD.js → chunk-2CQT2WWN.js} +5 -5
  9. package/dist/bundle/{chunk-HQVJK5E7.js → chunk-2D6AAGBP.js} +246 -383
  10. package/dist/bundle/{chunk-FG4XXZZE.js → chunk-2FFXRWI2.js} +2 -2
  11. package/dist/bundle/{chunk-2UIMEMWU.js → chunk-2HQPJ366.js} +3 -3
  12. package/dist/bundle/{chunk-CB7SBYLO.js → chunk-2HWOGSTA.js} +57 -37
  13. package/dist/bundle/{chunk-7XKAVMCF.js → chunk-2MSJVFAS.js} +8 -8
  14. package/dist/bundle/{chunk-NSIFQ5OP.js → chunk-2NWFZ43Q.js} +1 -1
  15. package/dist/bundle/{chunk-H47W2J6S.js → chunk-2Q3S47BC.js} +1312 -626
  16. package/dist/bundle/{chunk-O6IOL6RX.js → chunk-47MEPBWG.js} +21 -21
  17. package/dist/bundle/{chunk-725OHXKR.js → chunk-4RDXCE45.js} +2226 -37
  18. package/dist/bundle/{chunk-UR32UWTQ.js → chunk-5BPOAHVD.js} +13 -2
  19. package/dist/bundle/{chunk-5FONRUG6.js → chunk-5D4AEUVA.js} +1 -23
  20. package/dist/bundle/{chunk-VZ2I62HN.js → chunk-5LNOVPOR.js} +2 -2
  21. package/dist/bundle/{chunk-EKFEY3KP.js → chunk-5WQN2TUM.js} +1 -1
  22. package/dist/bundle/{chunk-ALJWBGD5.js → chunk-6MGSFYGL.js} +1 -1
  23. package/dist/bundle/{chunk-WUX7AUOQ.js → chunk-6RAEXK7Y.js} +26 -26
  24. package/dist/bundle/{chunk-BSSCTWWK.js → chunk-6SOQJRGI.js} +4 -4
  25. package/dist/bundle/{chunk-CKBHR7QO.js → chunk-75DSLCPC.js} +1 -1
  26. package/dist/bundle/{chunk-VSOLLTYT.js → chunk-76JIVDKC.js} +7 -2
  27. package/dist/bundle/{chunk-33NVQGUY.js → chunk-7WCZ2OZ5.js} +6 -6
  28. package/dist/bundle/{chunk-IDUNJCFO.js → chunk-7XU3TR7K.js} +2 -2
  29. package/dist/bundle/{chunk-7SH4JHYW.js → chunk-A4FTLORC.js} +12 -12
  30. package/dist/bundle/{chunk-CITFEQ6S.js → chunk-AACQA2CO.js} +1 -1
  31. package/dist/bundle/{chunk-PSNHPFSK.js → chunk-AAHIBA36.js} +1 -1
  32. package/dist/bundle/{chunk-PEOCBV2Z.js → chunk-BWBVBW5T.js} +8 -8
  33. package/dist/bundle/{chunk-A4UNTWAX.js → chunk-CVALO727.js} +99 -30
  34. package/dist/bundle/{chunk-G6QF5KWF.js → chunk-FHW4ENRF.js} +37 -43
  35. package/dist/bundle/{chunk-LONV6HIK.js → chunk-HAHARAJD.js} +455 -40
  36. package/dist/bundle/{chunk-2623YE5I.js → chunk-IBRXVPBI.js} +97 -99
  37. package/dist/bundle/{chunk-IWFBAWZK.js → chunk-IKODUUQG.js} +292 -19
  38. package/dist/bundle/{chunk-PQJYM5ES.js → chunk-IOMSC4ZG.js} +3 -3
  39. package/dist/bundle/{chunk-YKZ4IPLB.js → chunk-JKEAZBEZ.js} +7 -7
  40. package/dist/bundle/{chunk-FCJAHD4R.js → chunk-KIQIF5M7.js} +3 -3
  41. package/dist/bundle/{chunk-KYVXMEBC.js → chunk-KT5G3KVS.js} +3 -3
  42. package/dist/bundle/{chunk-W7IK7E4B.js → chunk-L3RV42O3.js} +20 -22
  43. package/dist/bundle/{chunk-NHBUTCNR.js → chunk-LQXLWHKM.js} +9 -9
  44. package/dist/bundle/{chunk-WBTVGFXI.js → chunk-MATUQFYL.js} +11 -11
  45. package/dist/bundle/{chunk-54O62JWP.js → chunk-MULPNGM2.js} +29 -10
  46. package/dist/bundle/{chunk-FJW3DDCF.js → chunk-N4OO3SPQ.js} +5 -5
  47. package/dist/bundle/{chunk-6DHQTUB2.js → chunk-NDWWGBSM.js} +1 -1
  48. package/dist/bundle/{chunk-DLAFGSTN.js → chunk-NHDSJMAR.js} +1 -1
  49. package/dist/bundle/{chunk-PQYVPCJ2.js → chunk-O6YYFVDD.js} +38 -37
  50. package/dist/bundle/{chunk-I7UH5CTA.js → chunk-OYGEBFFO.js} +12 -14
  51. package/dist/bundle/chunk-P7E7K467.js +110 -0
  52. package/dist/bundle/{chunk-ZNZUZGSV.js → chunk-PKNTBZXN.js} +176 -49
  53. package/dist/bundle/{chunk-YNFELLNQ.js → chunk-PU4GANCD.js} +3 -3
  54. package/dist/bundle/{chunk-5PLJKSG4.js → chunk-Q46JLJ5O.js} +7 -9
  55. package/dist/bundle/{chunk-R276546S.js → chunk-QKHFQHE7.js} +1 -1
  56. package/dist/bundle/{chunk-RNSP57TC.js → chunk-QUJCD5U7.js} +4 -4
  57. package/dist/bundle/{chunk-43QVYW3K.js → chunk-RIYXQFKU.js} +262 -88
  58. package/dist/bundle/{chunk-2AUXBJRX.js → chunk-RWEFKLXJ.js} +104 -29
  59. package/dist/bundle/{chunk-WQJBAWQP.js → chunk-SBOTSSYV.js} +879 -508
  60. package/dist/bundle/{chunk-PAXKALHV.js → chunk-U3BOQ63L.js} +118 -7
  61. package/dist/bundle/{chunk-VJZST5RD.js → chunk-UBJX5D2O.js} +2 -2
  62. package/dist/bundle/{chunk-HX7Y2ASG.js → chunk-VCGQMTHW.js} +26318 -15143
  63. package/dist/bundle/{chunk-7YMDL4JQ.js → chunk-VKYCMXEQ.js} +8 -5
  64. package/dist/bundle/{chunk-ZSXRDF6I.js → chunk-VX4RAT3A.js} +1 -1
  65. package/dist/bundle/{chunk-NYOPEHEU.js → chunk-W5SYBHRX.js} +8 -3
  66. package/dist/bundle/{chunk-XOLQSCMF.js → chunk-WGSTTWM5.js} +6 -6
  67. package/dist/bundle/{chunk-WLFUBNFX.js → chunk-WJRE45Z6.js} +4 -4
  68. package/dist/bundle/{chunk-IEXPOEEO.js → chunk-WQPTZHHR.js} +17 -26
  69. package/dist/bundle/{chunk-JEOYFKUK.js → chunk-WSX5UQNT.js} +2 -2
  70. package/dist/bundle/{chunk-LJAX6YCF.js → chunk-WYDYSQ7T.js} +2 -2
  71. package/dist/bundle/{chunk-C6Z25IBJ.js → chunk-XCUUYQN7.js} +4 -4
  72. package/dist/bundle/{chunk-GVCN3GLZ.js → chunk-YOHOQ6ZR.js} +4 -4
  73. package/dist/bundle/chunk-YZ5VMR2S.js +5305 -0
  74. package/dist/bundle/{chunk-ZDLIO76S.js → chunk-ZMMOVTUB.js} +2 -2
  75. package/dist/bundle/command-contract-VZ3ZJLEF.js +35 -0
  76. package/dist/bundle/{decode-EDN2ARXZ.js → decode-DN2DDFET.js} +4 -4
  77. package/dist/bundle/drive.js +11 -22
  78. package/dist/bundle/{echarts-GXY34GHA.js → echarts-VMHZ2UYP.js} +2 -2
  79. package/dist/bundle/{embed-3GSQIQXE.js → embed-MDN7R7BA.js} +5 -5
  80. package/dist/bundle/{embedder-6ULWRG3R.js → embedder-KEVEDNDJ.js} +8 -8
  81. package/dist/bundle/{entry-IPRJLFHO.js → entry-HTNK5TJQ.js} +6 -6
  82. package/dist/bundle/{first-run-FGHGWHC2.js → first-run-QNMCMP67.js} +9 -9
  83. package/dist/bundle/first-screen-RQBEHUQC.js +33 -0
  84. package/dist/bundle/{google-BD3ZNFVJ.js → google-QAKMV57Q.js} +9 -9
  85. package/dist/bundle/{chunk-GR5GGZKH.js → google-api-UJJS7ECO.js} +62 -6
  86. package/dist/bundle/grants-VMPKFEC2.js +98 -0
  87. package/dist/bundle/{identity-U7IHZEMR.js → identity-UODE3QAL.js} +4 -2
  88. package/dist/bundle/{instructions-K5BEQM4C.js → instructions-IWLHCDC7.js} +1 -1
  89. package/dist/bundle/{login-7HRYPZMM.js → login-GIZXEN7I.js} +60 -68
  90. package/dist/bundle/{mcp-WSGVVZWI.js → mcp-RUYPQVYS.js} +2 -2
  91. package/dist/bundle/{node-ZYWB7IET.js → node-25IJLDBZ.js} +2 -2
  92. package/dist/bundle/{node-sqlite-J3OODPYK.js → node-sqlite-DYR4FEI4.js} +4 -4
  93. package/dist/bundle/{oauth-L4VTCBLF.js → oauth-FLHXEDDY.js} +7 -7
  94. package/dist/bundle/{open-SGUN7ZVF.js → open-FWDZB7KX.js} +3 -3
  95. package/dist/bundle/{openai-RLVISEDH.js → openai-HB7UGKPW.js} +13 -13
  96. package/dist/bundle/{process-ZXO2MWRJ.js → process-P6TW37HQ.js} +1 -1
  97. package/dist/bundle/{program-YVLXSKZV.js → program-DVUNLXXS.js} +730 -919
  98. package/dist/bundle/{prompt-AUWTBLO7.js → prompt-MKWMYO3B.js} +4 -4
  99. package/dist/bundle/{reasons-J57GSRWN.js → reasons-25BEO2NE.js} +3 -3
  100. package/dist/bundle/{recognize-ORX2UBQW.js → recognize-VXGNPROM.js} +3 -3
  101. package/dist/bundle/{remote-AGIJY73X.js → remote-H5ZWLJHR.js} +6 -6
  102. package/dist/bundle/{rerank-R6PE44M5.js → rerank-5A3JDK7O.js} +6 -6
  103. package/dist/bundle/{chunk-G7DCVJ4F.js → serve-QNPNEZVR.js} +10 -7
  104. package/dist/bundle/{chunk-F7UUZATI.js → server-GWBVIRLY.js} +42 -15
  105. package/dist/bundle/server-QJU3HEGM.js +63 -0
  106. package/dist/bundle/{services-HZFTTZSF.js → services-PFXEWHJG.js} +30 -31
  107. package/dist/bundle/{sqlite-runtime-DTGPR2T2.js → sqlite-runtime-RGFISYXM.js} +4 -4
  108. package/dist/bundle/{state-WG3JKJM3.js → state-BUSX5BXF.js} +5 -5
  109. package/dist/bundle/{store-EV72MT5U.js → store-FIEE5HHG.js} +14 -16
  110. package/dist/bundle/{store-33VHIMEO.js → store-HFF5KQ44.js} +12 -14
  111. package/dist/bundle/store-maintenance-command-Z4SPEQUM.js +52 -0
  112. package/dist/bundle/{chunk-GNI7INK6.js → terminal-DHJ4D3BC.js} +2 -3
  113. package/dist/bundle/tokens-B6MUZRFM.js +96 -0
  114. package/dist/commands/context.d.ts +14 -13
  115. package/dist/commands/context.d.ts.map +1 -1
  116. package/dist/commands/context.js.map +1 -1
  117. package/dist/commands/documents.d.ts.map +1 -1
  118. package/dist/commands/documents.js +1 -4
  119. package/dist/commands/documents.js.map +1 -1
  120. package/dist/commands/mirrors.d.ts.map +1 -1
  121. package/dist/commands/mirrors.js +1 -2
  122. package/dist/commands/mirrors.js.map +1 -1
  123. package/dist/commands/upgrade.d.ts +1 -1
  124. package/dist/commands/upgrade.d.ts.map +1 -1
  125. package/dist/commands/upgrade.js +4 -9
  126. package/dist/commands/upgrade.js.map +1 -1
  127. package/dist/config.d.ts +182 -0
  128. package/dist/config.d.ts.map +1 -1
  129. package/dist/config.js +38 -3
  130. package/dist/config.js.map +1 -1
  131. package/dist/contract-overrides.d.ts +0 -3
  132. package/dist/contract-overrides.d.ts.map +1 -1
  133. package/dist/contract-overrides.js +0 -234
  134. package/dist/contract-overrides.js.map +1 -1
  135. package/dist/first-screen.d.ts +3 -2
  136. package/dist/first-screen.d.ts.map +1 -1
  137. package/dist/first-screen.js +17 -22
  138. package/dist/first-screen.js.map +1 -1
  139. package/dist/grants.d.ts +9 -0
  140. package/dist/grants.d.ts.map +1 -0
  141. package/dist/grants.js +30 -0
  142. package/dist/grants.js.map +1 -0
  143. package/dist/identity.d.ts.map +1 -1
  144. package/dist/identity.js +2 -0
  145. package/dist/identity.js.map +1 -1
  146. package/dist/login.d.ts.map +1 -1
  147. package/dist/login.js +2 -4
  148. package/dist/login.js.map +1 -1
  149. package/dist/policy-keys.d.ts +12 -0
  150. package/dist/policy-keys.d.ts.map +1 -0
  151. package/dist/policy-keys.js +107 -0
  152. package/dist/policy-keys.js.map +1 -0
  153. package/dist/policy.d.ts +1 -8
  154. package/dist/policy.d.ts.map +1 -1
  155. package/dist/policy.js +2 -105
  156. package/dist/policy.js.map +1 -1
  157. package/dist/program.d.ts +8 -4
  158. package/dist/program.d.ts.map +1 -1
  159. package/dist/program.js +251 -222
  160. package/dist/program.js.map +1 -1
  161. package/dist/testing/mcp.d.ts +28 -0
  162. package/dist/testing/mcp.d.ts.map +1 -0
  163. package/dist/testing/mcp.js +56 -0
  164. package/dist/testing/mcp.js.map +1 -0
  165. package/dist/tokens.d.ts.map +1 -1
  166. package/dist/tokens.js +0 -9
  167. package/dist/tokens.js.map +1 -1
  168. package/dist/version.d.ts +1 -1
  169. package/dist/version.js +1 -1
  170. package/package.json +6 -5
  171. package/scenarios/agent-access.md +4 -2
  172. package/dist/bundle/all-profiles-CYW6XBBS.js +0 -26
  173. package/dist/bundle/chunk-234MHU76.js +0 -384
  174. package/dist/bundle/chunk-BBYD2FA3.js +0 -9
  175. package/dist/bundle/chunk-DO4PDQY5.js +0 -48
  176. package/dist/bundle/chunk-FDWYPONW.js +0 -1988
  177. package/dist/bundle/chunk-FQRJWVEB.js +0 -2
  178. package/dist/bundle/chunk-GJN5B5JK.js +0 -522
  179. package/dist/bundle/chunk-NPSZPUK6.js +0 -193
  180. package/dist/bundle/chunk-PDGECM5D.js +0 -138
  181. package/dist/bundle/chunk-Q765VPZY.js +0 -421
  182. package/dist/bundle/chunk-QYUHS6DE.js +0 -1714
  183. package/dist/bundle/chunk-WQRGA75U.js +0 -256
  184. package/dist/bundle/chunk-YVPHJHIL.js +0 -15572
  185. package/dist/bundle/chunk-Z47LOJUS.js +0 -484
  186. package/dist/bundle/command-contract-I2YB5IXI.js +0 -38
  187. package/dist/bundle/failure-IXS2ZHA5.js +0 -37
  188. package/dist/bundle/first-screen-M62KTPZG.js +0 -36
  189. package/dist/bundle/google-api-BDUWZMRV.js +0 -83
  190. package/dist/bundle/mcp-F67RATLF.js +0 -502
  191. package/dist/bundle/mcp-JZSYPQA4.js +0 -96
  192. package/dist/bundle/serve-VOBAQHAQ.js +0 -20
  193. package/dist/bundle/server-24PS4M7U.js +0 -70
  194. package/dist/bundle/server-G6HFZ2CK.js +0 -57
  195. package/dist/bundle/store-maintenance-command-ZTUEI4EC.js +0 -58
  196. package/dist/bundle/terminal-TFCTWLOS.js +0 -11
  197. package/dist/bundle/tokens-XMOGQFI6.js +0 -102
  198. package/dist/commands/doctor.d.ts +0 -56
  199. package/dist/commands/doctor.d.ts.map +0 -1
  200. package/dist/commands/doctor.js +0 -75
  201. package/dist/commands/doctor.js.map +0 -1
  202. package/dist/commands/mcp.d.ts +0 -6
  203. package/dist/commands/mcp.d.ts.map +0 -1
  204. package/dist/commands/mcp.js +0 -156
  205. package/dist/commands/mcp.js.map +0 -1
  206. package/dist/commands/skill.d.ts +0 -6
  207. package/dist/commands/skill.d.ts.map +0 -1
  208. package/dist/commands/skill.js +0 -34
  209. package/dist/commands/skill.js.map +0 -1
  210. package/dist/failure.d.ts +0 -88
  211. package/dist/failure.d.ts.map +0 -1
  212. package/dist/failure.js +0 -60
  213. package/dist/failure.js.map +0 -1
  214. package/dist/mcp.d.ts +0 -175
  215. package/dist/mcp.d.ts.map +0 -1
  216. package/dist/mcp.js +0 -412
  217. package/dist/mcp.js.map +0 -1
  218. /package/dist/bundle/{chunk-62EDJKGP.js → chunk-HEA3XVAJ.js} +0 -0
@@ -2,61 +2,25 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  MAX_TEXT_CHARS
5
- } from "./chunk-JEOYFKUK.js";
6
- import {
7
- COUNTER_FIELDS,
8
- DOCUMENT_ACCOUNT_PROVIDERS,
9
- INTERNAL_NOTES,
10
- UNKNOWN_PROVIDER,
11
- addProvider,
12
- canonicalReference,
13
- counterFreshness,
14
- counterObservationTime,
15
- filesAccountSql,
16
- folderProviderOf,
17
- folderProviderSql,
18
- formatLocator,
19
- formatReference,
20
- isDocumentAccountProvider,
21
- isFolderProvider,
22
- isKind,
23
- isLocator,
24
- kindIn,
25
- kindOf,
26
- needsRankingContext,
27
- parseLocator,
28
- parseReference,
29
- providerEntryOf,
30
- providerNamed,
31
- providers,
32
- rankingQuestion,
33
- rankingScore,
34
- rankingWords,
35
- useStoredProviders,
36
- validCounter
37
- } from "./chunk-234MHU76.js";
5
+ } from "./chunk-WSX5UQNT.js";
38
6
  import {
7
+ CHAT_MESSAGES_READ,
39
8
  FACT_STATUSES,
40
9
  FACT_TYPES,
41
10
  LINK_KINDS,
42
11
  LINK_ORIGINS,
12
+ MEETING_FINDINGS_KIND,
43
13
  MEMORY_KINDS,
44
14
  MEMORY_SCOPES,
15
+ MeetingError,
45
16
  RELATION_KINDS,
17
+ REVIEW_LIMIT,
46
18
  TASK_KINDS,
47
19
  TASK_ORIGINS,
48
20
  TASK_STATES,
49
21
  TASK_TYPES,
50
22
  TASK_VERDICTS,
51
23
  WORK_TASK_TYPES,
52
- linkKind,
53
- matches
54
- } from "./chunk-PDGECM5D.js";
55
- import {
56
- CHAT_MESSAGES_READ,
57
- MEETING_FINDINGS_KIND,
58
- MeetingError,
59
- REVIEW_LIMIT,
60
24
  aggregateMeetingStats,
61
25
  calendarText,
62
26
  canonicalMeetingReference,
@@ -67,6 +31,8 @@ import {
67
31
  formatMeetingReference,
68
32
  joinKeyOf,
69
33
  joinUrlWithoutQuery,
34
+ linkKind,
35
+ matches,
70
36
  meetingCueFingerprint,
71
37
  meetingFindingFingerprint,
72
38
  normalizeMeetingParticipantQuery,
@@ -80,7 +46,7 @@ import {
80
46
  validateMeetingPreparationContext,
81
47
  validateMeetingRelatedHistory,
82
48
  validateMeetingSeriesHistory
83
- } from "./chunk-ZNZUZGSV.js";
49
+ } from "./chunk-PKNTBZXN.js";
84
50
  import {
85
51
  QUERY_LIMITS,
86
52
  dateRange,
@@ -91,7 +57,7 @@ import {
91
57
  validateQuery,
92
58
  walkQuery,
93
59
  zonedMoment
94
- } from "./chunk-NHBUTCNR.js";
60
+ } from "./chunk-LQXLWHKM.js";
95
61
  import {
96
62
  DEFAULT_STEMMERS,
97
63
  DEFAULT_STEMMERS_VERSION,
@@ -104,24 +70,24 @@ import {
104
70
  fold,
105
71
  normalize,
106
72
  parseStemmers
107
- } from "./chunk-7XKAVMCF.js";
73
+ } from "./chunk-2MSJVFAS.js";
108
74
  import {
109
75
  DEFAULT_TASK_CATEGORIES,
110
76
  sharedConfigPath,
111
77
  storedTaskCategories,
112
78
  taskCategoriesReader
113
- } from "./chunk-XOLQSCMF.js";
79
+ } from "./chunk-WGSTTWM5.js";
114
80
  import {
115
81
  storePath
116
- } from "./chunk-VJZST5RD.js";
82
+ } from "./chunk-UBJX5D2O.js";
117
83
  import {
118
84
  PRAGMAS,
119
85
  quietSqliteWarning,
120
86
  storeCapable
121
- } from "./chunk-33NVQGUY.js";
87
+ } from "./chunk-7WCZ2OZ5.js";
122
88
  import {
123
89
  singleLine
124
- } from "./chunk-HQVJK5E7.js";
90
+ } from "./chunk-2D6AAGBP.js";
125
91
  import {
126
92
  CliError,
127
93
  array,
@@ -139,7 +105,7 @@ import {
139
105
  safeParse,
140
106
  strictObject,
141
107
  string
142
- } from "./chunk-YKZ4IPLB.js";
108
+ } from "./chunk-JKEAZBEZ.js";
143
109
  import {
144
110
  resolveFrom
145
111
  } from "./chunk-Y5E2WNWB.js";
@@ -167,12 +133,12 @@ import {
167
133
  sql,
168
134
  sqliteTable,
169
135
  text
170
- } from "./chunk-ALJWBGD5.js";
136
+ } from "./chunk-6MGSFYGL.js";
171
137
  import {
172
138
  __name
173
139
  } from "./chunk-ZVVMGPBJ.js";
174
140
 
175
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/account-store.js
141
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/account-store.js
176
142
  var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
177
143
  const methods = whole;
178
144
  return Object.fromEntries(Object.keys(keyed).map((name) => [
@@ -300,7 +266,98 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
300
266
  };
301
267
  }, "bindAccount");
302
268
 
303
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/query.js
269
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/providers.js
270
+ var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events"];
271
+ var PROVIDERS = [
272
+ { name: "telegram", kind: "messages", aliases: ["tg"] },
273
+ { name: "telegram-bot", kind: "messages", aliases: ["tg-bot"] },
274
+ { name: "max", kind: "messages", aliases: [] },
275
+ { name: "max-bot", kind: "messages", aliases: [] },
276
+ { name: "whatsapp", kind: "messages", aliases: ["wa"] },
277
+ { name: "whatsapp-bot", kind: "messages", aliases: ["wa-bot"] },
278
+ { name: "email", kind: "mail", aliases: [] },
279
+ { name: "notes", kind: "notes", aliases: [] },
280
+ { name: "local", kind: "notes", aliases: [] },
281
+ { name: "obsidian", kind: "notes", aliases: [] },
282
+ { name: "zoom", kind: "meetings", aliases: [] }
283
+ ];
284
+ var FOLDER_PROVIDERS = ["local", "obsidian", "folder"];
285
+ var isFolderProvider = /* @__PURE__ */ __name((provider) => FOLDER_PROVIDERS.includes(provider), "isFolderProvider");
286
+ var folderProviderSql = /* @__PURE__ */ __name((column2 = "provider") => `${column2} IN (${FOLDER_PROVIDERS.map((name) => `'${name}'`).join(", ")})`, "folderProviderSql");
287
+ var folderProviderOf = /* @__PURE__ */ __name((format) => format === "markdown" ? "local" : "obsidian", "folderProviderOf");
288
+ var DOCUMENT_ACCOUNT_PROVIDERS = ["google-drive"];
289
+ var isDocumentAccountProvider = /* @__PURE__ */ __name((provider) => DOCUMENT_ACCOUNT_PROVIDERS.includes(provider), "isDocumentAccountProvider");
290
+ var filesAccountSql = /* @__PURE__ */ __name((column2 = "provider") => `${column2} IN (${[...FOLDER_PROVIDERS, ...DOCUMENT_ACCOUNT_PROVIDERS].map((name) => `'${name}'`).join(", ")})`, "filesAccountSql");
291
+ var INTERNAL_NOTES = "internal";
292
+ var UNKNOWN_PROVIDER = "unknown provider \u2014 run its CLI once";
293
+ var WORD = /^[a-z0-9][a-z0-9_-]*$/;
294
+ var invalid = /* @__PURE__ */ __name((message2) => {
295
+ throw new CliError("validation_error", message2);
296
+ }, "invalid");
297
+ var wordOf = /* @__PURE__ */ __name((value, what) => typeof value === "string" && WORD.test(value) ? value : invalid(`${what} is lowercase letters, digits, - and _ \u2014 not ${JSON.stringify(value)}`), "wordOf");
298
+ var providerEntryOf = /* @__PURE__ */ __name((value) => {
299
+ if (typeof value !== "object" || value === null || Array.isArray(value))
300
+ return invalid("a provider entry is an object");
301
+ const { name, kind: kind3, aliases: aliases2 = [], command } = value;
302
+ const named2 = wordOf(name, "a provider's name");
303
+ if (typeof kind3 !== "string" || !KINDS.includes(kind3))
304
+ invalid(`provider ${named2}'s kind is one of ${KINDS.join(", ")} \u2014 not ${JSON.stringify(kind3)}`);
305
+ if (!Array.isArray(aliases2))
306
+ invalid(`provider ${named2}'s aliases are a list`);
307
+ return {
308
+ name: named2,
309
+ kind: kind3,
310
+ aliases: [...new Set(aliases2.map((alias2) => wordOf(alias2, `an alias of ${named2}`)))],
311
+ ...command === void 0 ? {} : { command: wordOf(command, `the command of ${named2}`) }
312
+ };
313
+ }, "providerEntryOf");
314
+ var describe = /* @__PURE__ */ __name(({ name, kind: kind3, command }) => `${name} (${kind3}${command ? `, from ${command}` : ""})`, "describe");
315
+ var wordsOf = /* @__PURE__ */ __name(({ name, aliases: aliases2 }) => [name, ...aliases2], "wordsOf");
316
+ var joined = /* @__PURE__ */ __name((known2, entry2) => {
317
+ const same = known2.find(({ name }) => name === entry2.name);
318
+ if (same && same.kind !== entry2.kind)
319
+ invalid(`two provider entries disagree on the kind: ${describe(same)} and ${describe(entry2)}`);
320
+ const merged = same ? {
321
+ ...same,
322
+ aliases: [.../* @__PURE__ */ new Set([...same.aliases, ...entry2.aliases])],
323
+ ...entry2.command ? { command: entry2.command } : {}
324
+ } : entry2;
325
+ const others = known2.filter((one) => one !== same);
326
+ for (const word of wordsOf(merged)) {
327
+ const owner = others.find((one) => wordsOf(one).includes(word));
328
+ if (owner)
329
+ invalid(`"${word}" names two providers: ${describe(owner)} and ${describe(merged)}`);
330
+ }
331
+ return same ? known2.map((one) => one === same ? merged : one) : [...known2, merged];
332
+ }, "joined");
333
+ var registry = PROVIDERS;
334
+ var providers = /* @__PURE__ */ __name(() => registry, "providers");
335
+ var useStoredProviders = /* @__PURE__ */ __name((entries) => {
336
+ const left = [];
337
+ registry = entries.reduce((known2, entry2) => {
338
+ try {
339
+ return joined(known2, providerEntryOf(entry2));
340
+ } catch (error) {
341
+ if (!(error instanceof CliError))
342
+ throw error;
343
+ left.push(entry2);
344
+ return known2;
345
+ }
346
+ }, PROVIDERS);
347
+ return left;
348
+ }, "useStoredProviders");
349
+ var addProvider = /* @__PURE__ */ __name((entry2) => {
350
+ registry = joined(registry, providerEntryOf(entry2));
351
+ }, "addProvider");
352
+ var isKind = /* @__PURE__ */ __name((word) => KINDS.includes(word.toLowerCase()), "isKind");
353
+ var providerNamed = /* @__PURE__ */ __name((word) => {
354
+ const wanted = word.toLowerCase();
355
+ return registry.find((entry2) => wordsOf(entry2).includes(wanted));
356
+ }, "providerNamed");
357
+ var kindIn = /* @__PURE__ */ __name((provider) => isFolderProvider(provider) ? "notes" : registry.find(({ name }) => name === provider)?.kind, "kindIn");
358
+ var kindOf = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
359
+
360
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/search/query.js
304
361
  var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
305
362
  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");
306
363
  var fail = /* @__PURE__ */ __name((message2) => {
@@ -323,7 +380,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
323
380
  return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
324
381
  }, "sourceOf");
325
382
 
326
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/account-list.js
383
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/search/account-list.js
327
384
  var ACCOUNT_GROUPS = "accountGroups";
328
385
  var ACCOUNT_GROUPS_SETTING = "account_groups";
329
386
  var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
@@ -339,7 +396,7 @@ var itemsOf = /* @__PURE__ */ __name((value) => {
339
396
  }, "itemsOf");
340
397
  var groupName = /* @__PURE__ */ __name((name) => GROUP_NAME.test(name) ? name : fail2(`a group name is letters, digits, - and _ \u2014 not "${name}"`), "groupName");
341
398
  var groupMembers = /* @__PURE__ */ __name((value) => itemsOf(value).map((item) => item.toLowerCase().startsWith("group:") ? fail2(`a group lists accounts, not other groups \u2014 "${item}"`) : item.includes(":") && item.split(":")[1] === "" ? fail2(`"${item}" names no account after the colon`) : item), "groupMembers");
342
- var describe = /* @__PURE__ */ __name((accounts2) => accounts2.map(({ provider, account, name }) => `${provider}:${account}${name ? ` (${name})` : ""}`).join(", "), "describe");
399
+ var describe2 = /* @__PURE__ */ __name((accounts2) => accounts2.map(({ provider, account, name }) => `${provider}:${account}${name ? ` (${name})` : ""}`).join(", "), "describe");
343
400
  var kindHere = /* @__PURE__ */ __name((provider, running) => provider === running.provider ? kindOf(provider) : kindIn(provider), "kindHere");
344
401
  var heldOf = /* @__PURE__ */ __name((stored3, running) => [
345
402
  ...stored3.filter(({ provider }) => kindIn(provider) !== "notes" && !isDocumentAccountProvider(provider)).map(({ provider, account, name }) => ({ provider, account, name, kind: kindHere(provider, running) })),
@@ -360,7 +417,7 @@ var heldOf = /* @__PURE__ */ __name((stored3, running) => [
360
417
  }))
361
418
  ], "heldOf");
362
419
  var storedAs = /* @__PURE__ */ __name((held, key2) => held.filter(({ stored: stored3 }) => stored3?.provider === key2.provider && (key2.account === "" || stored3.account === key2.account)), "storedAs");
363
- var registry = /* @__PURE__ */ __name(() => providers().map(({ name, aliases: aliases2 }) => aliases2.length ? `${name} (${aliases2.join(", ")})` : name).join(", "), "registry");
420
+ var registry2 = /* @__PURE__ */ __name(() => providers().map(({ name, aliases: aliases2 }) => aliases2.length ? `${name} (${aliases2.join(", ")})` : name).join(", "), "registry");
364
421
  var providerOf = /* @__PURE__ */ __name((prefix, held, { running, profiles }) => {
365
422
  const wanted = prefix.toLowerCase();
366
423
  if (wanted === running.command?.toLowerCase())
@@ -374,7 +431,7 @@ var providerOf = /* @__PURE__ */ __name((prefix, held, { running, profiles }) =>
374
431
  const recorded = Object.values(profiles[wanted] ?? {})[0];
375
432
  if (recorded)
376
433
  return recorded.provider;
377
- return fail2(`${prefix} is not a provider \u2014 they are ${registry()}; the store holds ${providers2.join(", ")}`);
434
+ return fail2(`${prefix} is not a provider \u2014 they are ${registry2()}; the store holds ${providers2.join(", ")}`);
378
435
  }, "providerOf");
379
436
  var profilesOf = /* @__PURE__ */ __name((provider, profiles) => Object.values(profiles).flatMap((named2) => Object.entries(named2).filter(([, key2]) => key2.provider === provider)), "profilesOf");
380
437
  var accountOf = /* @__PURE__ */ __name((prefix, ref3, held, context) => {
@@ -418,9 +475,9 @@ var accountOf = /* @__PURE__ */ __name((prefix, ref3, held, context) => {
418
475
  if (byName.length === 1)
419
476
  return byName[0];
420
477
  if (byName.length > 1 || byProfile.length > 1)
421
- fail2(`${provider}:${ref3} names more than one account \u2014 use the id: ${describe(ofProvider)}`);
478
+ fail2(`${provider}:${ref3} names more than one account \u2014 use the id: ${describe2(ofProvider)}`);
422
479
  const names = profilesOf(provider, context.profiles).map(([name]) => name);
423
- return fail2(`no ${provider} account "${ref3}" \u2014 the store holds ${describe(ofProvider) || "none"}` + (names.length ? `; profiles: ${[...new Set(names)].join(", ")}` : ""));
480
+ return fail2(`no ${provider} account "${ref3}" \u2014 the store holds ${describe2(ofProvider) || "none"}` + (names.length ? `; profiles: ${[...new Set(names)].join(", ")}` : ""));
424
481
  }, "accountOf");
425
482
  var accountsOfWord = /* @__PURE__ */ __name((word, held, context) => {
426
483
  const wanted = word.toLowerCase();
@@ -510,7 +567,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf = (kind3)
510
567
  return { accounts: [...chosen.values()], skipped };
511
568
  }, "fitting");
512
569
 
513
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
570
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
514
571
  var IndexBuilderOn = class {
515
572
  static {
516
573
  __name(this, "IndexBuilderOn");
@@ -705,7 +762,7 @@ function alias(table, alias2) {
705
762
  }
706
763
  __name(alias, "alias");
707
764
 
708
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
765
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
709
766
  var ENTITY_TABLES = {
710
767
  account: "accounts",
711
768
  attachment: "attachments",
@@ -745,7 +802,7 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
745
802
  return { table, pointer, type, count, known: known2 };
746
803
  }).filter(({ count }) => count > 0)), "orphanPointers");
747
804
 
748
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
805
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
749
806
  var canonicalTags = sqliteTable("canonical_tags", {
750
807
  id: integer("id").primaryKey(),
751
808
  name: text("name").notNull().unique(),
@@ -754,7 +811,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
754
811
  updatedAt: integer("updated_at").notNull()
755
812
  });
756
813
 
757
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
814
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
758
815
  var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
759
816
  sourceKey: text("source_key").notNull(),
760
817
  collection: text("collection").notNull(),
@@ -764,13 +821,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
764
821
  createdAt: integer("created_at").notNull()
765
822
  }, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
766
823
 
767
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
824
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
768
825
  var documentIndexPending = sqliteTable("document_index_pending", {
769
826
  id: integer("id").notNull(),
770
827
  indexableType: text("indexable_type").notNull()
771
828
  }, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
772
829
 
773
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
830
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
774
831
  var tagRedirects = sqliteTable("tag_redirects", {
775
832
  sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
776
833
  survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
@@ -796,7 +853,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
796
853
  index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
797
854
  ]);
798
855
 
799
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
856
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
800
857
  var accounts = sqliteTable("accounts", {
801
858
  id: integer("id").primaryKey(),
802
859
  provider: text("provider").notNull(),
@@ -2292,7 +2349,7 @@ var storeSettings = sqliteTable("store_settings", {
2292
2349
  at: integer("at").notNull()
2293
2350
  });
2294
2351
 
2295
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
2352
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
2296
2353
  var ARMS = [
2297
2354
  [
2298
2355
  "message",
@@ -2419,7 +2476,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
2419
2476
  return recomputed;
2420
2477
  }, "drainInvolvementQueue");
2421
2478
 
2422
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/mentions.js
2479
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/mentions.js
2423
2480
  import { domainToUnicode } from "node:url";
2424
2481
 
2425
2482
  // node_modules/.pnpm/psl@1.15.0/node_modules/psl/dist/psl.mjs
@@ -12441,7 +12498,7 @@ var oa = /* @__PURE__ */ __name((e) => {
12441
12498
  }, "oa");
12442
12499
  var na = { parse: O, get: aa, isValid: oa };
12443
12500
 
12444
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
12501
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
12445
12502
  var LINK = /https?:\/\/(?:(?:docs|drive|sheets|slides)\.google\.com|forms\.gle)(?:[/?#][^\s<>"'`]*)?/gi;
12446
12503
  var ID = /^[\w-]{10,}$/;
12447
12504
  var trimUrl = /* @__PURE__ */ __name((url) => {
@@ -12482,7 +12539,7 @@ var googleDocumentLinks = /* @__PURE__ */ __name((text5) => [...text5.matchAll(L
12482
12539
  return { url, documentId: googleDocumentId(url) };
12483
12540
  }), "googleDocumentLinks");
12484
12541
 
12485
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
12542
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
12486
12543
  var PHONE_PLANS = [
12487
12544
  {
12488
12545
  country: "us",
@@ -12862,7 +12919,7 @@ var PHONE_PLANS = [
12862
12919
  }
12863
12920
  ];
12864
12921
 
12865
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/phones.js
12922
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/phones.js
12866
12923
  var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
12867
12924
  var DEFAULT_PHONE_COUNTRIES = ["ru"];
12868
12925
  var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
@@ -12903,7 +12960,7 @@ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
12903
12960
  return void 0;
12904
12961
  }, "nationalPhone");
12905
12962
 
12906
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/places.js
12963
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/places.js
12907
12964
  var BEFORE = [
12908
12965
  [/^(?:ул\.?|улиц[аеыу]|улицей)$/iu, "\u0443\u043B\u0438\u0446\u0430"],
12909
12966
  [/^(?:пр-т|просп\.?|проспект[аеу]?)$/iu, "\u043F\u0440\u043E\u0441\u043F\u0435\u043A\u0442"],
@@ -13163,7 +13220,7 @@ var findPlaces = /* @__PURE__ */ __name((text5) => {
13163
13220
  return found2.sort((a, b) => a.start - b.start);
13164
13221
  }, "findPlaces");
13165
13222
 
13166
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/mentions.js
13223
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/mentions.js
13167
13224
  var MENTION_KINDS = ["phone", "email", "url", "document", "person-name", "place"];
13168
13225
  var MENTION_VERSIONS = {
13169
13226
  phone: 1,
@@ -13353,7 +13410,7 @@ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE
13353
13410
  };
13354
13411
  }, "typedPhone");
13355
13412
 
13356
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/first-names.js
13413
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/first-names.js
13357
13414
  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";
13358
13415
  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";
13359
13416
  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";
@@ -13361,7 +13418,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
13361
13418
  var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
13362
13419
  var NAME_WORDS = WORDS.split(" ");
13363
13420
 
13364
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/person-names.js
13421
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/person-names.js
13365
13422
  var LATIN_TO_CYRILLIC = {
13366
13423
  shch: "\u0449",
13367
13424
  sch: "\u0449",
@@ -13404,7 +13461,7 @@ var LATIN_UNIT = new RegExp(Object.keys(LATIN_TO_CYRILLIC).join("|"), "g");
13404
13461
  var cyrillicOf = /* @__PURE__ */ __name((latin) => latin.toLowerCase().replace(/ey$/, "\u0435\u0439").replace(/i?y$/, "\u0438\u0439").replace(LATIN_UNIT, (unit) => LATIN_TO_CYRILLIC[unit] ?? unit), "cyrillicOf");
13405
13462
  var MIN_STEM = 2;
13406
13463
  var MIN_WORD = 4;
13407
- var WORD = new RegExp("(?<![\\p{L}\\p{N}])\\p{Lu}\\p{Ll}{3,}(?![\\p{L}\\p{N}])", "gu");
13464
+ var WORD2 = new RegExp("(?<![\\p{L}\\p{N}])\\p{Lu}\\p{Ll}{3,}(?![\\p{L}\\p{N}])", "gu");
13408
13465
  var NAME_WORD = new RegExp("^\\p{L}{3,}$", "u");
13409
13466
  var MAX_ENDING = 3;
13410
13467
  var keyOf2 = /* @__PURE__ */ __name((stem, word) => `s:${stem.stemToken(word)}`, "keyOf");
@@ -13453,7 +13510,7 @@ var findNames = /* @__PURE__ */ __name((text5, index2) => {
13453
13510
  return [];
13454
13511
  const found2 = [];
13455
13512
  let previous;
13456
- for (const match of text5.matchAll(WORD)) {
13513
+ for (const match of text5.matchAll(WORD2)) {
13457
13514
  const bearers = POLITE.test(match[0]) ? void 0 : bearersOf(index2, match[0]);
13458
13515
  const start = match.index;
13459
13516
  const end = start + match[0].length;
@@ -13518,7 +13575,7 @@ var nameForms = /* @__PURE__ */ __name(() => {
13518
13575
  }, "nameForms");
13519
13576
  var roleOf = /* @__PURE__ */ __name((word) => PATRONYMIC.test(word) ? "patronymic" : nameForms().get(word.toLowerCase()), "roleOf");
13520
13577
  var findUnknownNames = /* @__PURE__ */ __name((text5, stem, taken) => {
13521
- const words3 = [...text5.matchAll(WORD)].map((match) => ({ text: match[0], start: match.index, end: match.index + match[0].length })).filter((word) => !taken.some((one) => word.start < one.end && word.end > one.start));
13578
+ const words3 = [...text5.matchAll(WORD2)].map((match) => ({ text: match[0], start: match.index, end: match.index + match[0].length })).filter((word) => !taken.some((one) => word.start < one.end && word.end > one.start));
13522
13579
  const adjacent = /* @__PURE__ */ __name((a, b) => {
13523
13580
  const left = words3[a];
13524
13581
  const right = words3[b];
@@ -13569,7 +13626,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text5, stem, taken) => {
13569
13626
  return found2;
13570
13627
  }, "findUnknownNames");
13571
13628
 
13572
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/attachments.js
13629
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/attachments.js
13573
13630
  var NOT_FILES = /* @__PURE__ */ new Set([
13574
13631
  "webpage",
13575
13632
  "share",
@@ -13601,7 +13658,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored3, files2) => {
13601
13658
  });
13602
13659
  }, "matchDownloads");
13603
13660
 
13604
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
13661
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
13605
13662
  var QUERY_VERSION = 1;
13606
13663
  var QUERY_LIMITS2 = {
13607
13664
  ...QUERY_LIMITS,
@@ -13632,7 +13689,7 @@ function exhausted(budget) {
13632
13689
  }
13633
13690
  __name(exhausted, "exhausted");
13634
13691
 
13635
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
13692
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
13636
13693
  var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
13637
13694
  var literal2 = /* @__PURE__ */ __name((c) => ({
13638
13695
  kind: "char",
@@ -14032,7 +14089,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
14032
14089
  return out;
14033
14090
  }, "foldRegex");
14034
14091
 
14035
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
14092
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
14036
14093
  var PRESET_VERSION = 1;
14037
14094
  var PRESETS = {
14038
14095
  password: {
@@ -14086,7 +14143,7 @@ var PRESETS = {
14086
14143
  }
14087
14144
  };
14088
14145
 
14089
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
14146
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
14090
14147
  var FIELD_VERSION = 2;
14091
14148
  var UNITS = {
14092
14149
  "": 1,
@@ -14586,12 +14643,12 @@ var QUERY_OPERATORS = [
14586
14643
  { name: "boost / minimum / intervals", example: "invoice^2", semantics: "query.unsupported-operator" }
14587
14644
  ];
14588
14645
 
14589
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
14646
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
14590
14647
  var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
14591
14648
  var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
14592
14649
  var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
14593
14650
 
14594
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
14651
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
14595
14652
  var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
14596
14653
  var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
14597
14654
  var linkMatch = /* @__PURE__ */ __name((field3, typed, mail, mentioned2) => {
@@ -14615,7 +14672,7 @@ var linkMatch = /* @__PURE__ */ __name((field3, typed, mail, mentioned2) => {
14615
14672
  };
14616
14673
  }, "linkMatch");
14617
14674
 
14618
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
14675
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
14619
14676
  var SETTING = "phoneCountries";
14620
14677
  var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
14621
14678
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
@@ -14646,7 +14703,21 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
14646
14703
  return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
14647
14704
  }, "valueMatch");
14648
14705
 
14649
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
14706
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/locator.js
14707
+ var SCHEME = "msg:";
14708
+ var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat: chat2, message: message2 }) => SCHEME + [provider, account, chat2, message2].map(encodeURIComponent).join("/"), "formatLocator");
14709
+ var isLocator = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith(SCHEME), "isLocator");
14710
+ var parseLocator = /* @__PURE__ */ __name((reference2) => {
14711
+ const trimmed = reference2.trim();
14712
+ const parts2 = trimmed.startsWith(SCHEME) ? trimmed.slice(SCHEME.length).split("/") : [];
14713
+ if (parts2.length !== 4 || parts2.some((part) => part === "")) {
14714
+ throw new CliError("validation_error", `"${singleLine(reference2)}" is not a message locator \u2014 expected msg:<provider>/<account>/<chat>/<message>`);
14715
+ }
14716
+ const [provider, account, chat2, message2] = parts2.map(decodeURIComponent);
14717
+ return { provider, account, chat: chat2, message: message2 };
14718
+ }, "parseLocator");
14719
+
14720
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
14650
14721
  var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
14651
14722
  if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
14652
14723
  throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
@@ -14674,7 +14745,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
14674
14745
  return 2 * intersection2 / (aa2.size + bb.size);
14675
14746
  }, "vocabularySimilarity");
14676
14747
 
14677
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
14748
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
14678
14749
  import { createHash } from "node:crypto";
14679
14750
  var folded2 = /* @__PURE__ */ __name((name) => {
14680
14751
  try {
@@ -14740,38 +14811,38 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind3, by, options
14740
14811
  });
14741
14812
  }, "guardTagCreation");
14742
14813
 
14743
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
14744
- var invalid = /* @__PURE__ */ __name((message2) => {
14814
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
14815
+ var invalid2 = /* @__PURE__ */ __name((message2) => {
14745
14816
  throw new CliError("validation_error", message2);
14746
14817
  }, "invalid");
14747
14818
  var record2 = /* @__PURE__ */ __name((value, fields4, field3) => {
14748
14819
  if (!value || typeof value !== "object" || Array.isArray(value))
14749
- return invalid(`${field3} must be an object`);
14820
+ return invalid2(`${field3} must be an object`);
14750
14821
  for (const key2 of Object.keys(value))
14751
14822
  if (!fields4.includes(key2))
14752
- invalid(`unknown ${field3} field: ${key2}`);
14823
+ invalid2(`unknown ${field3} field: ${key2}`);
14753
14824
  return value;
14754
14825
  }, "record");
14755
14826
  var tagId = /* @__PURE__ */ __name((value, field3) => {
14756
14827
  if (typeof value !== "string" || value.length > 16 || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
14757
- return invalid(`${field3} must be a positive canonical tag id`);
14828
+ return invalid2(`${field3} must be a positive canonical tag id`);
14758
14829
  return value;
14759
14830
  }, "tagId");
14760
14831
  var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
14761
14832
  const input = record2(snapshot2, ["complete", "tags", "redirects"], "snapshot");
14762
14833
  if (input.complete !== true)
14763
- invalid("snapshot.complete must be true; partial tag graphs cannot resolve labels");
14834
+ invalid2("snapshot.complete must be true; partial tag graphs cannot resolve labels");
14764
14835
  for (const field3 of ["tags", "redirects"])
14765
14836
  if (!Array.isArray(input[field3]) || input[field3].length > 4096)
14766
- invalid(`snapshot.${field3} must be an array of at most 4096 rows`);
14837
+ invalid2(`snapshot.${field3} must be an array of at most 4096 rows`);
14767
14838
  const ids = /* @__PURE__ */ new Set();
14768
14839
  for (const [index2, value] of snapshot2.tags.entries()) {
14769
14840
  const row2 = record2(value, ["id", "kind"], `tags[${index2}]`);
14770
14841
  const id2 = tagId(row2.id, `tags[${index2}].id`);
14771
14842
  if (row2.kind !== "tag")
14772
- invalid(`tags[${index2}].kind must be tag; topics and projects cannot redirect`);
14843
+ invalid2(`tags[${index2}].kind must be tag; topics and projects cannot redirect`);
14773
14844
  if (ids.has(id2))
14774
- invalid(`tags[${index2}].id is duplicated`);
14845
+ invalid2(`tags[${index2}].id is duplicated`);
14775
14846
  ids.add(id2);
14776
14847
  }
14777
14848
  const edges = /* @__PURE__ */ new Map();
@@ -14780,9 +14851,9 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
14780
14851
  const source2 = tagId(row2.sourceId, `redirects[${index2}].sourceId`);
14781
14852
  const survivor = tagId(row2.survivorId, `redirects[${index2}].survivorId`);
14782
14853
  if (!ids.has(source2) || !ids.has(survivor))
14783
- invalid(`redirects[${index2}] names an unavailable tag`);
14854
+ invalid2(`redirects[${index2}] names an unavailable tag`);
14784
14855
  if (edges.has(source2))
14785
- invalid(`redirects[${index2}].sourceId has more than one redirect`);
14856
+ invalid2(`redirects[${index2}].sourceId has more than one redirect`);
14786
14857
  edges.set(source2, survivor);
14787
14858
  }
14788
14859
  const paths = /* @__PURE__ */ new Map();
@@ -14794,9 +14865,9 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
14794
14865
  while (edges.has(current)) {
14795
14866
  const next = edges.get(current);
14796
14867
  if (path.includes(next))
14797
- invalid("redirects contain a cycle");
14868
+ invalid2("redirects contain a cycle");
14798
14869
  if (path.length > 16)
14799
- invalid("redirects exceed the maximum of 16 hops");
14870
+ invalid2("redirects exceed the maximum of 16 hops");
14800
14871
  path.push(next);
14801
14872
  current = next;
14802
14873
  }
@@ -14817,7 +14888,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
14817
14888
  };
14818
14889
  }, "createTagRedirectIndex");
14819
14890
 
14820
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
14891
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
14821
14892
  var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
14822
14893
  const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
14823
14894
  if (!row2)
@@ -14845,7 +14916,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
14845
14916
  return snapshot2;
14846
14917
  }, "tagRedirectSnapshot");
14847
14918
 
14848
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
14919
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
14849
14920
  import { createHash as createHash2 } from "node:crypto";
14850
14921
  var TASK_KEY_PREFIXES = {
14851
14922
  question: "Q",
@@ -14873,7 +14944,79 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
14873
14944
  return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
14874
14945
  }, "taskAccountOf");
14875
14946
 
14876
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
14947
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/references.js
14948
+ var SIMPLE_REFERENCES = [
14949
+ "note",
14950
+ "document",
14951
+ "person",
14952
+ "organization",
14953
+ "project",
14954
+ "task",
14955
+ "memory",
14956
+ "fact",
14957
+ "bot",
14958
+ "entity"
14959
+ ];
14960
+ var parts = /* @__PURE__ */ __name((rest, count, reference2, shape) => {
14961
+ const split = rest.split("/");
14962
+ if (split.length !== count || split.some((part) => part === ""))
14963
+ throw new CliError("validation_error", `"${singleLine(reference2)}" is not a reference \u2014 expected ${shape}`);
14964
+ return split.map(decodeURIComponent);
14965
+ }, "parts");
14966
+ var formatReference = /* @__PURE__ */ __name((reference2) => {
14967
+ switch (reference2.type) {
14968
+ case "message":
14969
+ return formatLocator(reference2);
14970
+ case "chat":
14971
+ return `chat:${[reference2.provider, reference2.account, reference2.chat].map(encodeURIComponent).join("/")}`;
14972
+ case "contact":
14973
+ return `contact:${[reference2.provider, reference2.id].map(encodeURIComponent).join("/")}`;
14974
+ case "folder":
14975
+ return reference2.path === null ? `folder:${encodeURIComponent(reference2.id)}` : `folder:${encodeURIComponent(reference2.id)}/${encodeURIComponent(reference2.path)}`;
14976
+ default:
14977
+ return `${reference2.type}:${reference2.id}`;
14978
+ }
14979
+ }, "formatReference");
14980
+ var parseReference = /* @__PURE__ */ __name((text5) => {
14981
+ const reference2 = text5.trim();
14982
+ const colon = reference2.indexOf(":");
14983
+ const prefix = colon < 0 ? "" : reference2.slice(0, colon);
14984
+ const rest = reference2.slice(colon + 1);
14985
+ switch (prefix) {
14986
+ case "msg":
14987
+ return { type: "message", ...parseLocator(reference2) };
14988
+ case "chat": {
14989
+ const [provider, account, chat2] = parts(rest, 3, reference2, "chat:<provider>/<account>/<chat>");
14990
+ return { type: "chat", provider, account, chat: chat2 };
14991
+ }
14992
+ case "contact": {
14993
+ const [provider, id2] = parts(rest, 2, reference2, "contact:<provider>/<id>");
14994
+ return { type: "contact", provider, id: id2 };
14995
+ }
14996
+ case "folder": {
14997
+ const slash = rest.indexOf("/");
14998
+ const id2 = decodeURIComponent(slash < 0 ? rest : rest.slice(0, slash));
14999
+ const path = slash < 0 ? null : folderPath(decodeURIComponent(rest.slice(slash + 1)));
15000
+ if (!id2.trim() || path === "")
15001
+ throw new CliError("validation_error", `"${singleLine(reference2)}" is not a reference \u2014 expected folder:<id>[/<path>]`);
15002
+ return { type: "folder", id: id2, path };
15003
+ }
15004
+ default:
15005
+ if (SIMPLE_REFERENCES.includes(prefix)) {
15006
+ if (!rest.trim())
15007
+ throw new CliError("validation_error", `"${singleLine(reference2)}" names no ${prefix}`);
15008
+ return { type: prefix, id: rest };
15009
+ }
15010
+ throw new CliError("validation_error", `"${singleLine(reference2)}" is not a reference \u2014 expected msg:, chat:, contact:, folder:, ${SIMPLE_REFERENCES.filter((one) => one !== "entity").join(":, ")}:`);
15011
+ }
15012
+ }, "parseReference");
15013
+ var folderPath = /* @__PURE__ */ __name((path) => {
15014
+ const clean = path.split("/").filter((part) => part !== "" && part !== ".").join("/");
15015
+ return clean === "" ? path.trim() === "" ? "" : null : clean;
15016
+ }, "folderPath");
15017
+ var canonicalReference = /* @__PURE__ */ __name((text5) => formatReference(parseReference(text5)), "canonicalReference");
15018
+
15019
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
14877
15020
  var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
14878
15021
  var REFERABLE = {
14879
15022
  note: { tombstone: true },
@@ -15031,7 +15174,7 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
15031
15174
  }, "taskIdOf");
15032
15175
  var canonicalThingReference = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith("meeting:") ? canonicalMeetingReference(reference2) : canonicalReference(reference2), "canonicalThingReference");
15033
15176
 
15034
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
15177
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
15035
15178
  var toMs = /* @__PURE__ */ __name((iso11) => {
15036
15179
  if (iso11 === null || iso11 === void 0)
15037
15180
  return null;
@@ -15045,7 +15188,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
15045
15188
  var DELIVERY = { delivered: 1, read: 2 };
15046
15189
  var deliveryOf = /* @__PURE__ */ __name((stored3) => stored3 === DELIVERY.read ? "read" : stored3 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
15047
15190
 
15048
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
15191
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
15049
15192
  var TAG_KINDS = ["tag", "topic"];
15050
15193
  var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
15051
15194
  var TAG_TYPE = {
@@ -15179,7 +15322,7 @@ var setMainTopic = /* @__PURE__ */ __name((context, thing, topic2) => {
15179
15322
  var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
15180
15323
  const selectedTag = filter.tag === void 0 ? void 0 : canonicalTagNamed(database, filter.tag)?.id ?? -1;
15181
15324
  const tagged = selectedTag === void 0 ? "" : " AND t.canonical_id=(SELECT canonical_id FROM resolved_tags WHERE id=?)";
15182
- const parts = [
15325
+ const parts2 = [
15183
15326
  {
15184
15327
  type: "chat",
15185
15328
  sql: "SELECT t.name AS tag, g.taggable_type AS type, g.created_at, c.external_id AS chat_id, c.title AS chat_title, c.title_folded AS name_folded, NULL AS person_id, NULL AS name, NULL AS message_id, g.source, g.taggable_id AS target_id, t.canonical_id AS tag_id, NULL AS task_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id JOIN chats c ON c.id=g.taggable_id JOIN accounts a ON a.id=c.account_id WHERE g.taggable_type='chat' AND a.provider=? AND a.external_id=?",
@@ -15211,7 +15354,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
15211
15354
  params: [inboxKey(`${key2.provider}:${key2.account}`)]
15212
15355
  }
15213
15356
  ];
15214
- const chosen = parts.filter(({ type }) => filter.type === void 0 || filter.type === type);
15357
+ const chosen = parts2.filter(({ type }) => filter.type === void 0 || filter.type === type);
15215
15358
  const union = chosen.map(({ sql: sql2 }) => sql2 + tagged).join(" UNION ALL ");
15216
15359
  const where = [
15217
15360
  ...filter.where ? [filter.where] : [],
@@ -15236,7 +15379,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
15236
15379
  return result;
15237
15380
  }, "tagsOf");
15238
15381
 
15239
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
15382
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
15240
15383
  var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
15241
15384
  var SPEECH = speech("att");
15242
15385
  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");
@@ -15248,10 +15391,10 @@ var ftsMatch = /* @__PURE__ */ __name((node) => {
15248
15391
  return words3.length > 1 ? nearMatch(words3, node.slop) : quoted(text5);
15249
15392
  }, "ftsMatch");
15250
15393
  var nearMatch = /* @__PURE__ */ __name((words3, apart) => `NEAR(${words3.map(quoted).join(" ")}, ${apart})`, "nearMatch");
15251
- var combine = /* @__PURE__ */ __name((parts, operator) => ({
15252
- sql: parts.length ? `(${parts.map(({ sql: sql2 }) => sql2).join(` ${operator} `)})` : operator === "AND" ? "1" : "0",
15253
- params: parts.flatMap(({ params }) => params),
15254
- exact: parts.every(({ exact }) => exact)
15394
+ var combine = /* @__PURE__ */ __name((parts2, operator) => ({
15395
+ sql: parts2.length ? `(${parts2.map(({ sql: sql2 }) => sql2).join(` ${operator} `)})` : operator === "AND" ? "1" : "0",
15396
+ params: parts2.flatMap(({ params }) => params),
15397
+ exact: parts2.every(({ exact }) => exact)
15255
15398
  }), "combine");
15256
15399
  var prefixOf = /* @__PURE__ */ __name((pattern) => {
15257
15400
  if (pattern.includes("|"))
@@ -15541,14 +15684,14 @@ var is2 = /* @__PURE__ */ __name(({ value }, { mail }) => {
15541
15684
  }, "is");
15542
15685
  var subject = /* @__PURE__ */ __name(({ operator, value }, { corpus, mail }) => {
15543
15686
  const wanted = normalize(value);
15544
- const parts = wanted.match(/[\p{L}\p{N}]+/gu) ?? [];
15545
- if (!mail || !parts.length)
15687
+ const parts2 = wanted.match(/[\p{L}\p{N}]+/gu) ?? [];
15688
+ if (!mail || !parts2.length)
15546
15689
  return always(bound("0"));
15547
15690
  return {
15548
- fragment: { ...wordMatch(corpus, parts.map(quoted).join(" AND ")), exact: false },
15691
+ fragment: { ...wordMatch(corpus, parts2.map(quoted).join(" AND ")), exact: false },
15549
15692
  test: /* @__PURE__ */ __name((text5) => {
15550
15693
  const heading = normalize(text5.slice(0, Math.max(0, text5.indexOf("\n\n"))));
15551
- return operator === "phrase" ? heading.includes(wanted) : parts.every((word) => new RegExp(`(^|[^\\p{L}\\p{N}])${word}`, "u").test(heading));
15694
+ return operator === "phrase" ? heading.includes(wanted) : parts2.every((word) => new RegExp(`(^|[^\\p{L}\\p{N}])${word}`, "u").test(heading));
15552
15695
  }, "test")
15553
15696
  };
15554
15697
  }, "subject");
@@ -15591,7 +15734,7 @@ var FIELD_COMPILERS = {
15591
15734
  subject
15592
15735
  };
15593
15736
 
15594
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
15737
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
15595
15738
  var placeOf = /* @__PURE__ */ __name((database) => {
15596
15739
  const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
15597
15740
  const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
@@ -15607,7 +15750,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
15607
15750
  };
15608
15751
  }, "placeOf");
15609
15752
 
15610
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
15753
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
15611
15754
  var DRAIN_ON_WRITE = 500;
15612
15755
  var METHOD = "rules";
15613
15756
  var telegramLink = /* @__PURE__ */ __name((database) => {
@@ -15770,7 +15913,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
15770
15913
  return queued.length;
15771
15914
  }, "drainMentions");
15772
15915
 
15773
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
15916
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
15774
15917
  var indexRow = /* @__PURE__ */ __name((database, name) => {
15775
15918
  const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
15776
15919
  if (!exists2)
@@ -15778,7 +15921,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
15778
15921
  return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
15779
15922
  }, "indexRow");
15780
15923
 
15781
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
15924
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
15782
15925
  var INDEX = "message_stems";
15783
15926
  var SETTING2 = "searchStemmers";
15784
15927
  var DRAIN_ON_WRITE2 = 500;
@@ -15900,7 +16043,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
15900
16043
  };
15901
16044
  }, "stemmerCache");
15902
16045
 
15903
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
16046
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
15904
16047
  var SQLITE_BUSY = 5;
15905
16048
  var pause = new Int32Array(new SharedArrayBuffer(4));
15906
16049
  var isBusy = /* @__PURE__ */ __name((error) => {
@@ -15937,7 +16080,14 @@ var connectionOf = /* @__PURE__ */ __name((database) => {
15937
16080
  return connection;
15938
16081
  }, "connectionOf");
15939
16082
  var write = /* @__PURE__ */ __name((database, body2, { beforeCommit } = {}) => transact(database, body2, true, beforeCommit), "write");
15940
- var writeBatch = /* @__PURE__ */ __name((database, body2) => transact(database, body2, false), "writeBatch");
16083
+ var writeBatch = /* @__PURE__ */ __name((database, body2) => {
16084
+ const outer = connectionOf(database).depth === 0;
16085
+ const result = transact(database, body2, false);
16086
+ if (outer)
16087
+ Atomics.wait(pause, 0, 0, BATCH_PAUSE_MS);
16088
+ return result;
16089
+ }, "writeBatch");
16090
+ var BATCH_PAUSE_MS = 2;
15941
16091
  var transact = /* @__PURE__ */ __name((database, body2, drain, beforeCommit) => {
15942
16092
  const connection = connectionOf(database);
15943
16093
  if (connection.reading)
@@ -15988,7 +16138,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
15988
16138
  }
15989
16139
  }, "read");
15990
16140
 
15991
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
16141
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
15992
16142
  var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
15993
16143
  coalesce(CASE k.chunkable_type
15994
16144
  WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
@@ -16130,7 +16280,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
16130
16280
  }, "dropUnusedVectors");
16131
16281
  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");
16132
16282
 
16133
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
16283
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
16134
16284
  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({
16135
16285
  target: [accounts.provider, accounts.externalId],
16136
16286
  set: {
@@ -16236,7 +16386,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
16236
16386
  AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
16237
16387
  }, "dropOrphanPeople");
16238
16388
 
16239
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
16389
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
16240
16390
  var FOLDED = [
16241
16391
  { table: "tasks", column: "title" },
16242
16392
  { table: "tasks", column: "close_reason" },
@@ -16273,7 +16423,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
16273
16423
  return filled2;
16274
16424
  }, "fillFolded");
16275
16425
 
16276
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
16426
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
16277
16427
  import { createHash as createHash3 } from "node:crypto";
16278
16428
  var CHUNK_CHARS = 1200;
16279
16429
  var CHUNK_OVERLAP = 150;
@@ -16378,7 +16528,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
16378
16528
  return chunks2;
16379
16529
  }, "cutChunks");
16380
16530
 
16381
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/task-signature.js
16531
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/search/task-signature.js
16382
16532
  var DAY = 864e5;
16383
16533
  var CURRENCY = [
16384
16534
  [/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
@@ -16495,7 +16645,7 @@ var dueDayOf = /* @__PURE__ */ __name((text5, createdMs) => {
16495
16645
  return best?.day ?? null;
16496
16646
  }, "dueDayOf");
16497
16647
 
16498
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
16648
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
16499
16649
  var DAY2 = 864e5;
16500
16650
  var STOP_WORDS = new Set([
16501
16651
  // Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
@@ -16650,7 +16800,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
16650
16800
  ...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
16651
16801
  })).sort((a, b) => b.score - a.score), "rankCandidates");
16652
16802
 
16653
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
16803
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
16654
16804
  var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
16655
16805
  r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
16656
16806
  JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
@@ -16921,7 +17071,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
16921
17071
  };
16922
17072
  }, "readiness");
16923
17073
 
16924
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
17074
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
16925
17075
  var DOCUMENT_PICTURE = "document_picture";
16926
17076
  var SCAN_PAGE2 = 5e3;
16927
17077
  var idOf = /* @__PURE__ */ __name((ref3) => {
@@ -16984,7 +17134,7 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
16984
17134
  }, "nearestPictures")
16985
17135
  }), "documentPicturesOver");
16986
17136
 
16987
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
17137
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
16988
17138
  var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
16989
17139
  const literal4 = escaped2 ?? plain2 ?? "";
16990
17140
  return wildcard ?? (/[*?[]/u.test(literal4) ? `[${literal4}]` : literal4);
@@ -17029,9 +17179,9 @@ var leaf = /* @__PURE__ */ __name((node, columns, options) => {
17029
17179
  return node.operator === "wildcard" ? { sql: `lower(${sql2}) LIKE ? ESCAPE '\\'`, params: [like(node.value)] } : { sql: `lower(${sql2}) = ?`, params: [node.value.toLowerCase()] };
17030
17180
  }
17031
17181
  }, "leaf");
17032
- var all = /* @__PURE__ */ __name((parts) => ({
17033
- sql: parts.map(({ sql: sql2 }) => `(${sql2})`).join(" AND "),
17034
- params: parts.flatMap(({ params }) => params)
17182
+ var all = /* @__PURE__ */ __name((parts2) => ({
17183
+ sql: parts2.map(({ sql: sql2 }) => `(${sql2})`).join(" AND "),
17184
+ params: parts2.flatMap(({ params }) => params)
17035
17185
  }), "all");
17036
17186
  var known = /* @__PURE__ */ __name((where) => where.known ? where : { sql: `IFNULL((${where.sql}), 0)`, params: where.params }, "known");
17037
17187
  var compile = /* @__PURE__ */ __name((node, columns, options) => {
@@ -17039,17 +17189,17 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
17039
17189
  return known(leaf(node, columns, options));
17040
17190
  const of = /* @__PURE__ */ __name((occur) => node.clauses.filter((clause) => clause.occur === occur).map((clause) => compile(clause.node, columns, options)), "of");
17041
17191
  const [must, should, mustNot] = [of("must"), of("should"), of("must_not")];
17042
- const parts = [
17192
+ const parts2 = [
17043
17193
  ...must,
17044
17194
  ...must.length === 0 && should.length > 0 ? [{ sql: should.map(({ sql: sql2 }) => `(${sql2})`).join(" OR "), params: should.flatMap(({ params }) => params) }] : [],
17045
17195
  ...mustNot.map(({ sql: sql2, params }) => ({ sql: `NOT (${sql2})`, params }))
17046
17196
  ];
17047
- return all(parts);
17197
+ return all(parts2);
17048
17198
  }, "compile");
17049
17199
  var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
17050
17200
  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");
17051
17201
 
17052
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
17202
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
17053
17203
  var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
17054
17204
  var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
17055
17205
  var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
@@ -17139,7 +17289,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
17139
17289
  });
17140
17290
  }, "linkMeeting");
17141
17291
 
17142
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
17292
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
17143
17293
  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), ''))";
17144
17294
  var UNSEARCHED_EVENT_TYPES = [
17145
17295
  "working-location",
@@ -17369,7 +17519,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
17369
17519
  return true;
17370
17520
  }, "resetNoteIndex");
17371
17521
 
17372
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
17522
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
17373
17523
  var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
17374
17524
  var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
17375
17525
  for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
@@ -17388,7 +17538,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
17388
17538
  }
17389
17539
  }, "resolvePersonLinks");
17390
17540
 
17391
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
17541
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
17392
17542
  var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
17393
17543
  var prepare = /* @__PURE__ */ __name((orm) => ({
17394
17544
  find: orm.select({
@@ -17613,7 +17763,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
17613
17763
  }, "meetingIdentityPk");
17614
17764
  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");
17615
17765
 
17616
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
17766
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
17617
17767
  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");
17618
17768
  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");
17619
17769
  var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
@@ -17893,7 +18043,26 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
17893
18043
  }
17894
18044
  }, "replaceAutoTags");
17895
18045
 
17896
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
18046
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/counters.js
18047
+ var COUNTER_FIELDS = ["views", "reactions", "comments"];
18048
+ var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
18049
+ var counterObservationTime = /* @__PURE__ */ __name((observation, now2) => {
18050
+ const at = Date.parse(observation.observedAt);
18051
+ if (!validCounter(observation.value) || !Number.isSafeInteger(at) || at < 0 || at > now2 || !["remote_fetch", "remote_update"].includes(observation.source))
18052
+ throw new CliError("validation_error", "counter observation needs a valid value, source and nonfuture observation time");
18053
+ if (observation.reactions && (!validCounter(observation.reactions.total) || observation.reactions.total !== observation.value))
18054
+ throw new CliError("validation_error", "reaction observation payload and total disagree");
18055
+ return at;
18056
+ }, "counterObservationTime");
18057
+ var counterFreshness = /* @__PURE__ */ __name((states) => {
18058
+ if (!states.length || states.every((one) => one.freshness === "unknown"))
18059
+ return "unknown";
18060
+ if (states.some((one) => one.freshness === "unknown"))
18061
+ return "partial";
18062
+ return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
18063
+ }, "counterFreshness");
18064
+
18065
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
17897
18066
  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");
17898
18067
  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;
17899
18068
  var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
@@ -17974,7 +18143,7 @@ var mailCore = /* @__PURE__ */ __name((body2, earlier) => {
17974
18143
  return withoutSignOff(withoutGreeting(kept)).join("\n").trim();
17975
18144
  }, "mailCore");
17976
18145
 
17977
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
18146
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
17978
18147
  var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
17979
18148
  var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
17980
18149
  k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
@@ -18084,7 +18253,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
18084
18253
  return emails3 + threads;
18085
18254
  }, "drainEmailIndex");
18086
18255
 
18087
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
18256
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
18088
18257
  var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
18089
18258
  SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
18090
18259
  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,
@@ -18130,7 +18299,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
18130
18299
  leave.run(emailId, Number(box.id), emailId, Number(box.id));
18131
18300
  }, "forgetLocations");
18132
18301
 
18133
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
18302
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
18134
18303
  var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
18135
18304
  emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
18136
18305
  last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
@@ -18180,7 +18349,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
18180
18349
  return threads.length;
18181
18350
  }, "markEmailsRestored");
18182
18351
 
18183
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
18352
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
18184
18353
  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");
18185
18354
  var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
18186
18355
  var ruleOf = /* @__PURE__ */ __name((row2) => ({
@@ -18247,7 +18416,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
18247
18416
  }
18248
18417
  }), "mailRulesOver");
18249
18418
 
18250
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
18419
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
18251
18420
  var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
18252
18421
  database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
18253
18422
  VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
@@ -18255,7 +18424,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
18255
18424
  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);
18256
18425
  }, "reviewLink");
18257
18426
 
18258
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
18427
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
18259
18428
  function checkMeetingCancelled(signal) {
18260
18429
  if (!signal?.aborted)
18261
18430
  return;
@@ -18266,7 +18435,7 @@ function checkMeetingCancelled(signal) {
18266
18435
  }
18267
18436
  __name(checkMeetingCancelled, "checkMeetingCancelled");
18268
18437
 
18269
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
18438
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
18270
18439
  var meetingOf = /* @__PURE__ */ __name((row2) => ({
18271
18440
  id: Number(row2.id),
18272
18441
  accountId: Number(row2.account_id),
@@ -18316,7 +18485,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
18316
18485
  createdAt: Number(row2.created_at)
18317
18486
  }), "transcriptRowOf");
18318
18487
 
18319
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
18488
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
18320
18489
  var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
18321
18490
  var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
18322
18491
  var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
@@ -18483,7 +18652,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
18483
18652
  }
18484
18653
  }), "meetingReadsOver");
18485
18654
 
18486
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
18655
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
18487
18656
  var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
18488
18657
  const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
18489
18658
  const params = [input.accountId];
@@ -18526,7 +18695,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
18526
18695
  return { clauses, params };
18527
18696
  }, "meetingSelectionSql");
18528
18697
 
18529
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
18698
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
18530
18699
  var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
18531
18700
  async meetingChatLines(input) {
18532
18701
  checkMeetingCancelled(input.signal);
@@ -18554,7 +18723,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
18554
18723
  }
18555
18724
  }), "meetingChatLinesOver");
18556
18725
 
18557
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
18726
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
18558
18727
  var MESSAGE_FIELDS = {
18559
18728
  pk: messages.id,
18560
18729
  nativeId: messages.externalId,
@@ -18721,14 +18890,14 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
18721
18890
  storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
18722
18891
  }), "chatActivity");
18723
18892
 
18724
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
18893
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
18725
18894
  var HIT_FIELDS = {
18726
18895
  ...MESSAGE_FIELDS,
18727
18896
  chatTitle: sql`${chats.title}`.as("chat_title"),
18728
18897
  provider: sql`${accounts.provider}`.as("provider"),
18729
18898
  accountNativeId: sql`${accounts.externalId}`.as("account_native_id")
18730
18899
  };
18731
- var wordsOf = /* @__PURE__ */ __name((text5) => {
18900
+ var wordsOf2 = /* @__PURE__ */ __name((text5) => {
18732
18901
  const words3 = (text5.match(/[\p{L}\p{N}]+/gu) ?? []).filter((word) => [...word].length >= 3);
18733
18902
  if (words3.length === 0)
18734
18903
  throw new CliError("validation_error", "search needs a word of three letters or more");
@@ -18749,7 +18918,7 @@ var matching = /* @__PURE__ */ __name((context, { provider, account, accounts: w
18749
18918
  throw new CliError("validation_error", "a read across accounts names their provider");
18750
18919
  }
18751
18920
  const ids = senders?.length ? [...new Set(senders)] : void 0;
18752
- return and(isNull(messages.deletedAt), trimmed ? sql`${messages.id} IN (SELECT rowid FROM messages_fts WHERE messages_fts MATCH ${wordsOf(trimmed)})` : void 0, scopeProvider === void 0 ? void 0 : eq(accounts.provider, scopeProvider), account ? eq(accounts.externalId, account.account) : void 0, within ? inArray(accounts.externalId, within) : void 0, chatId === void 0 ? eq(chats.searchable, 1) : eq(chats.externalId, chatId), ids ? and(eq(identities.provider, accounts.provider), inArray(identities.externalId, ids)) : void 0, ids && together ? inArray(messages.chatId, everyoneWrote(context, ids, scopeProvider)) : void 0);
18921
+ return and(isNull(messages.deletedAt), trimmed ? sql`${messages.id} IN (SELECT rowid FROM messages_fts WHERE messages_fts MATCH ${wordsOf2(trimmed)})` : void 0, scopeProvider === void 0 ? void 0 : eq(accounts.provider, scopeProvider), account ? eq(accounts.externalId, account.account) : void 0, within ? inArray(accounts.externalId, within) : void 0, chatId === void 0 ? eq(chats.searchable, 1) : eq(chats.externalId, chatId), ids ? and(eq(identities.provider, accounts.provider), inArray(identities.externalId, ids)) : void 0, ids && together ? inArray(messages.chatId, everyoneWrote(context, ids, scopeProvider)) : void 0);
18753
18922
  }, "matching");
18754
18923
  var everyoneWrote = /* @__PURE__ */ __name(({ orm }, ids, scopeProvider) => {
18755
18924
  const written = alias(messages, "m2");
@@ -18820,7 +18989,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
18820
18989
  };
18821
18990
  }, "directReplies");
18822
18991
 
18823
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
18992
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
18824
18993
  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");
18825
18994
  var required = /* @__PURE__ */ __name((context, ref3) => {
18826
18995
  const found2 = identityRow(context, ref3);
@@ -18951,7 +19120,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
18951
19120
  }, "mentioning");
18952
19121
  var escaped = /* @__PURE__ */ __name((text5) => text5.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
18953
19122
 
18954
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
19123
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
18955
19124
  var missing2 = /* @__PURE__ */ __name(() => {
18956
19125
  throw new CliError("not_found", "Meeting, participant or selected target not found");
18957
19126
  }, "missing");
@@ -19073,7 +19242,7 @@ function meetingContextLinksOver(context) {
19073
19242
  }
19074
19243
  __name(meetingContextLinksOver, "meetingContextLinksOver");
19075
19244
 
19076
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
19245
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
19077
19246
  var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
19078
19247
  var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
19079
19248
  var summaryOf = /* @__PURE__ */ __name((row2) => ({
@@ -19102,7 +19271,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
19102
19271
  return row2 ? summaryText(summaryOf(row2)) : null;
19103
19272
  }, "indexedText");
19104
19273
 
19105
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
19274
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
19106
19275
  var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
19107
19276
  var meetingCurrentIndexRows = `
19108
19277
  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
@@ -19133,7 +19302,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
19133
19302
  }, "invalidateMeetingStems");
19134
19303
  var meetingStemmableText = /* @__PURE__ */ __name((text5) => text5.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
19135
19304
 
19136
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
19305
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
19137
19306
  function meetingHitIndexOver({ database, now: now2 }) {
19138
19307
  return {
19139
19308
  async indexSearch(original) {
@@ -19201,10 +19370,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
19201
19370
  }
19202
19371
  __name(meetingHitIndexOver, "meetingHitIndexOver");
19203
19372
 
19204
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19373
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19205
19374
  import { createHash as createHash4 } from "node:crypto";
19206
19375
 
19207
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/trigrams.js
19376
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/search/trigrams.js
19208
19377
  var trigrams = /* @__PURE__ */ __name((term) => {
19209
19378
  const padded = ` ${term} `;
19210
19379
  const pieces = /* @__PURE__ */ new Set();
@@ -19213,7 +19382,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
19213
19382
  return [...pieces];
19214
19383
  }, "trigrams");
19215
19384
 
19216
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/correct.js
19385
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/search/correct.js
19217
19386
  var SHORTEST_CORRECTION = 3;
19218
19387
  var maxEdits = /* @__PURE__ */ __name((word) => word.length <= 4 ? 1 : 2, "maxEdits");
19219
19388
  var editDistance = /* @__PURE__ */ __name((a, b, max) => {
@@ -19260,7 +19429,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
19260
19429
  return corrections;
19261
19430
  }, "correctWords");
19262
19431
 
19263
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/garbled.js
19432
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/search/garbled.js
19264
19433
  var SHORTEST_GARBLED = 4;
19265
19434
  var MOST_WIDENED = 64;
19266
19435
  var plain = /* @__PURE__ */ __name((word) => word.replaceAll("\u044D", "\u0435"), "plain");
@@ -19352,7 +19521,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
19352
19521
  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));
19353
19522
  }, "widenWords");
19354
19523
 
19355
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
19524
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
19356
19525
  import { readFileSync } from "node:fs";
19357
19526
  var loaded;
19358
19527
  var dictionary = /* @__PURE__ */ __name(() => {
@@ -19411,8 +19580,8 @@ var knownRussianWord = /* @__PURE__ */ __name((word) => {
19411
19580
  return false;
19412
19581
  }, "knownRussianWord");
19413
19582
 
19414
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
19415
- var WORD2 = /[\p{L}\p{N}\p{M}]+/gu;
19583
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
19584
+ var WORD3 = /[\p{L}\p{N}\p{M}]+/gu;
19416
19585
  var MOST_WORDS = 128;
19417
19586
  var quote = /* @__PURE__ */ __name((word) => `"${word.replaceAll('"', '""')}"`, "quote");
19418
19587
  var speakers = /* @__PURE__ */ __name((database, accountId) => {
@@ -19487,8 +19656,8 @@ ${matches2.map((speaker) => ` ${singleLine(speaker.label)}`).join("\n")}`, { ca
19487
19656
  }, "pickSpeaker");
19488
19657
  var resolveMeetingQuery = /* @__PURE__ */ __name((database, accountId, ast, state) => {
19489
19658
  const all2 = [];
19490
- const wordsOf2 = /* @__PURE__ */ __name((value, exact) => {
19491
- const words3 = (value.match(WORD2) ?? []).filter((raw) => normalize(raw)).map((raw) => {
19659
+ const wordsOf3 = /* @__PURE__ */ __name((value, exact) => {
19660
+ const words3 = (value.match(WORD3) ?? []).filter((raw) => normalize(raw)).map((raw) => {
19492
19661
  const literal4 = normalize(raw);
19493
19662
  return {
19494
19663
  raw,
@@ -19515,7 +19684,7 @@ var resolveMeetingQuery = /* @__PURE__ */ __name((database, accountId, ast, stat
19515
19684
  if (node.field === "from")
19516
19685
  return pickSpeaker(database, accountId, node.value);
19517
19686
  const exact = node.field === "exact";
19518
- const words3 = wordsOf2(node.value, exact);
19687
+ const words3 = wordsOf3(node.value, exact);
19519
19688
  if (node.operator === "phrase" && node.slop !== void 0 && words3.length > 1)
19520
19689
  return { kind: "near", exact, words: words3, lines: node.slop };
19521
19690
  return { kind: node.operator === "phrase" && words3.length > 1 ? "phrase" : "words", exact, words: words3 };
@@ -19555,8 +19724,8 @@ var meetingQuerySql = /* @__PURE__ */ __name((tree, state) => {
19555
19724
  }
19556
19725
  return `SELECT rid,min(tier) AS tier FROM (${select2}) GROUP BY rid`;
19557
19726
  }, "word");
19558
- const all2 = /* @__PURE__ */ __name((parts) => parts.length === 1 ? parts[0] : `SELECT rid,max(tier) AS tier FROM (${parts.join(" UNION ALL ")}) GROUP BY rid HAVING count(*)=${parts.length}`, "all");
19559
- const any2 = /* @__PURE__ */ __name((parts) => parts.length === 1 ? parts[0] : `SELECT rid,min(tier) AS tier FROM (${parts.join(" UNION ALL ")}) GROUP BY rid`, "any");
19727
+ const all2 = /* @__PURE__ */ __name((parts2) => parts2.length === 1 ? parts2[0] : `SELECT rid,max(tier) AS tier FROM (${parts2.join(" UNION ALL ")}) GROUP BY rid HAVING count(*)=${parts2.length}`, "all");
19728
+ const any2 = /* @__PURE__ */ __name((parts2) => parts2.length === 1 ? parts2[0] : `SELECT rid,min(tier) AS tier FROM (${parts2.join(" UNION ALL ")}) GROUP BY rid`, "any");
19560
19729
  const nothing = "SELECT NULL AS rid,0 AS tier WHERE 0";
19561
19730
  const compile2 = /* @__PURE__ */ __name((node) => {
19562
19731
  if (node.kind === "words")
@@ -19638,7 +19807,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text5, stemmer) => {
19638
19807
  return check3(tree);
19639
19808
  }, "matchMeetingText");
19640
19809
 
19641
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19810
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19642
19811
  var fail3 = /* @__PURE__ */ __name((message2) => {
19643
19812
  throw new CliError("validation_error", message2);
19644
19813
  }, "fail");
@@ -19815,7 +19984,7 @@ function meetingHitSearchOver({ database }) {
19815
19984
  }
19816
19985
  __name(meetingHitSearchOver, "meetingHitSearchOver");
19817
19986
 
19818
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
19987
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
19819
19988
  import { createHash as createHash5 } from "node:crypto";
19820
19989
  var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
19821
19990
  if (value === void 0)
@@ -19905,7 +20074,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
19905
20074
  }
19906
20075
  }), "meetingParticipantSearchOver");
19907
20076
 
19908
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
20077
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
19909
20078
  var preparationQueries = {
19910
20079
  participants: {
19911
20080
  fields: "p.id, p.identity_id, p.display_name, l.person_id",
@@ -19955,7 +20124,7 @@ var preparationQueries = {
19955
20124
  }
19956
20125
  };
19957
20126
 
19958
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
20127
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
19959
20128
  var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
19960
20129
  async preparationContext(original) {
19961
20130
  const input = validateMeetingPreparationContext(original);
@@ -19996,7 +20165,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
19996
20165
  }
19997
20166
  }), "meetingPreparationContextOver");
19998
20167
 
19999
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
20168
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
20000
20169
  var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
20001
20170
  SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
20002
20171
  WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
@@ -20010,7 +20179,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
20010
20179
  JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
20011
20180
  )`, "preparationSubjects");
20012
20181
 
20013
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
20182
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
20014
20183
  var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
20015
20184
  async preparationKnowledge(original) {
20016
20185
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -20055,7 +20224,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
20055
20224
  }
20056
20225
  }), "meetingPreparationKnowledgeOver");
20057
20226
 
20058
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
20227
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
20059
20228
  var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
20060
20229
  async preparationNotes(original) {
20061
20230
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -20108,7 +20277,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
20108
20277
  }
20109
20278
  }), "meetingPreparationNotesOver");
20110
20279
 
20111
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
20280
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
20112
20281
  var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20113
20282
  async relatedHistory(original) {
20114
20283
  const input = validateMeetingRelatedHistory(original);
@@ -20179,7 +20348,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20179
20348
  }
20180
20349
  }), "meetingRelatedHistoryOver");
20181
20350
 
20182
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
20351
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
20183
20352
  var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
20184
20353
  var text2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
20185
20354
  var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
@@ -20260,7 +20429,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
20260
20429
  }
20261
20430
  }), "meetingReviewOver");
20262
20431
 
20263
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
20432
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
20264
20433
  var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
20265
20434
  var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
20266
20435
  if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
@@ -20314,7 +20483,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20314
20483
  }
20315
20484
  }), "meetingSeriesHistoryOver");
20316
20485
 
20317
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
20486
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
20318
20487
  var MOST_ROWS = 5e5;
20319
20488
  var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
20320
20489
  async meetingStats(input) {
@@ -20361,7 +20530,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
20361
20530
  }
20362
20531
  }), "meetingStatsOver");
20363
20532
 
20364
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
20533
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
20365
20534
  var CURSOR_KEY = "meetings";
20366
20535
  var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
20367
20536
  id: Number(row2.id),
@@ -20650,21 +20819,21 @@ var saveTranscripts = /* @__PURE__ */ __name((database, meetingId, transcripts,
20650
20819
  return counts;
20651
20820
  }, "saveTranscripts");
20652
20821
  var append = /* @__PURE__ */ __name((context, input) => {
20653
- const invalid8 = /* @__PURE__ */ __name((message2) => {
20822
+ const invalid10 = /* @__PURE__ */ __name((message2) => {
20654
20823
  throw new MeetingError("validation_error", message2);
20655
20824
  }, "invalid");
20656
20825
  if (!Number.isSafeInteger(input.accountId) || input.accountId <= 0 || !input.externalId?.trim() || !Number.isSafeInteger(input.now) || !Array.isArray(input.transcripts) || input.transcripts.length === 0)
20657
- invalid8("Invalid transcript append");
20826
+ invalid10("Invalid transcript append");
20658
20827
  if (input.create && (!Number.isSafeInteger(input.create.startedAt) || Math.abs(input.create.startedAt) > 864e13))
20659
- invalid8("Invalid meeting start");
20828
+ invalid10("Invalid meeting start");
20660
20829
  const sources = /* @__PURE__ */ new Set();
20661
20830
  for (const transcript2 of input.transcripts) {
20662
20831
  if (!transcript2.source?.trim() || !transcript2.contentHash?.trim() || sources.has(transcript2.source))
20663
- invalid8("Expected distinct transcript sources and nonempty hashes");
20832
+ invalid10("Expected distinct transcript sources and nonempty hashes");
20664
20833
  sources.add(transcript2.source);
20665
20834
  for (const row2 of transcript2.rows)
20666
20835
  if ("speakerParticipantPosition" in row2 || "speakerParticipantId" in row2)
20667
- invalid8("Appended transcript rows must be unlinked");
20836
+ invalid10("Appended transcript rows must be unlinked");
20668
20837
  }
20669
20838
  const { database } = context;
20670
20839
  return write(database, () => {
@@ -20913,7 +21082,33 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
20913
21082
  };
20914
21083
  }, "meetingStoreOver");
20915
21084
 
20916
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
21085
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
21086
+ var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
21087
+ const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
21088
+ return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
21089
+ }, "syncStateOf");
21090
+ var writeState = /* @__PURE__ */ __name(({ orm, now: now2 }, accountKey, name, value) => {
21091
+ orm.insert(syncCursors).values({ accountId: accountKey, key: name, value, createdAt: now2(), updatedAt: now2() }).onConflictDoUpdate({
21092
+ target: [syncCursors.accountId, syncCursors.key],
21093
+ set: { value: sql`excluded.value`, updatedAt: sql`excluded.updated_at` }
21094
+ }).run();
21095
+ }, "writeState");
21096
+ var clearState = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
21097
+ orm.delete(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).run();
21098
+ }, "clearState");
21099
+ var claim2 = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, anchor, holder, forMs) => {
21100
+ const at = now2();
21101
+ return orm.insert(fetchLeases).values({ chatId: chatKey, anchor, holder, expiresAt: at + forMs }).onConflictDoUpdate({
21102
+ target: [fetchLeases.chatId, fetchLeases.anchor],
21103
+ set: { holder: sql`excluded.holder`, expiresAt: sql`excluded.expires_at` },
21104
+ setWhere: or(eq(fetchLeases.holder, sql`excluded.holder`), lte(fetchLeases.expiresAt, at))
21105
+ }).returning({ chatId: fetchLeases.chatId }).all().length > 0;
21106
+ }, "claim");
21107
+ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
21108
+ orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
21109
+ }, "release");
21110
+
21111
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
20917
21112
  var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
20918
21113
  id: `email:${place.emailId}`,
20919
21114
  chatId: place.threadExternalId,
@@ -21246,12 +21441,21 @@ var emailHitsByPk = /* @__PURE__ */ __name((database, pks) => {
21246
21441
  ];
21247
21442
  });
21248
21443
  }, "emailHitsByPk");
21249
- var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor2 = stemmerCache()) => ({
21444
+ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemmerFor2 = stemmerCache()) => ({
21250
21445
  rules: mailRulesOver(database),
21251
21446
  async saveThread(input) {
21252
21447
  const id2 = write(database, () => saveThread(database, orm, input));
21253
21448
  return threadDetails(database, id2);
21254
21449
  },
21450
+ async saveThreads(inputs, states = []) {
21451
+ const ids = write(database, () => {
21452
+ const saved = inputs.map((input) => saveThread(database, orm, input));
21453
+ for (const { accountId, name, value } of states)
21454
+ writeState({ orm, now: now2 }, accountId, name, value);
21455
+ return saved;
21456
+ });
21457
+ return ids.map((id2) => threadDetails(database, id2));
21458
+ },
21255
21459
  async threads(filter = {}) {
21256
21460
  const [limit, offset] = page(filter);
21257
21461
  return database.prepare(`SELECT * FROM email_threads WHERE (? IS NULL OR account_id = ?) AND (? OR deleted_at IS NULL)
@@ -21310,7 +21514,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor2 = ste
21310
21514
  dmarc: str(row2.dmarc)
21311
21515
  }));
21312
21516
  },
21313
- async setSenderScores(accountId, scores, now2) {
21517
+ async setSenderScores(accountId, scores, now3) {
21314
21518
  return write(database, () => {
21315
21519
  const link3 = database.prepare(`INSERT INTO account_identities
21316
21520
  (account_id, identity_id, created_at, updated_at, mail_score, mail_signals, mail_scored_at, mail_demoted)
@@ -21319,7 +21523,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor2 = ste
21319
21523
  mail_signals = excluded.mail_signals, mail_scored_at = excluded.mail_scored_at,
21320
21524
  mail_demoted = excluded.mail_demoted`);
21321
21525
  for (const { address, score, signals, demoted } of scores)
21322
- link3.run(accountId, identityOf2(database, { address, name: null }, now2), now2, now2, score, JSON.stringify(signals), now2, demoted ? 1 : null);
21526
+ link3.run(accountId, identityOf2(database, { address, name: null }, now3), now3, now3, score, JSON.stringify(signals), now3, demoted ? 1 : null);
21323
21527
  return scores.length;
21324
21528
  });
21325
21529
  },
@@ -21332,9 +21536,9 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor2 = ste
21332
21536
  kind: str(b.kind)
21333
21537
  }));
21334
21538
  },
21335
- async setMailboxes(accountId, scanned, found2, now2) {
21539
+ async setMailboxes(accountId, scanned, found2, now3) {
21336
21540
  return write(database, () => {
21337
- const boxes = new Map(scanned.map((box) => [box.externalId, mailboxPk(database, accountId, box, now2)]));
21541
+ const boxes = new Map(scanned.map((box) => [box.externalId, mailboxPk(database, accountId, box, now3)]));
21338
21542
  const lookup = database.prepare("SELECT id FROM emails WHERE account_id = ? AND external_id = ?");
21339
21543
  const leave = database.prepare(`DELETE FROM email_mailboxes WHERE email_id = ? AND mailbox_id IN (SELECT value FROM json_each(?))
21340
21544
  AND mailbox_id NOT IN (SELECT value FROM json_each(?))`);
@@ -21351,22 +21555,22 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor2 = ste
21351
21555
  });
21352
21556
  leave.run(Number(row2.id), JSON.stringify([...boxes.values()]), JSON.stringify(kept));
21353
21557
  for (const pk of kept)
21354
- join(database, Number(row2.id), pk, now2);
21558
+ join(database, Number(row2.id), pk, now3);
21355
21559
  count++;
21356
21560
  }
21357
21561
  return count;
21358
21562
  });
21359
21563
  },
21360
- async setFlags(accountId, flags, now2) {
21564
+ async setFlags(accountId, flags, now3) {
21361
21565
  return write(database, () => {
21362
- return setEmailFlags(database, accountId, flags, now2);
21566
+ return setEmailFlags(database, accountId, flags, now3);
21363
21567
  });
21364
21568
  },
21365
21569
  folderEmails: /* @__PURE__ */ __name(async (accountId, folder, uidvalidity) => folderEmails(database, accountId, folder, uidvalidity), "folderEmails"),
21366
21570
  setLocations: /* @__PURE__ */ __name(async (accountId, folder, uidvalidity, found2) => write(database, () => setLocations(database, accountId, folder, uidvalidity, found2)), "setLocations"),
21367
21571
  forgetLocations: /* @__PURE__ */ __name(async (accountId, folder, uidvalidity, uids) => write(database, () => forgetLocations(database, accountId, folder, uidvalidity, uids)), "forgetLocations"),
21368
- markDeleted: /* @__PURE__ */ __name(async (accountId, externalIds, now2) => write(database, () => markEmailsDeleted(database, accountId, externalIds, now2)), "markDeleted"),
21369
- markRestored: /* @__PURE__ */ __name(async (accountId, externalIds, now2) => write(database, () => markEmailsRestored(database, accountId, externalIds, now2)), "markRestored"),
21572
+ markDeleted: /* @__PURE__ */ __name(async (accountId, externalIds, now3) => write(database, () => markEmailsDeleted(database, accountId, externalIds, now3)), "markDeleted"),
21573
+ markRestored: /* @__PURE__ */ __name(async (accountId, externalIds, now3) => write(database, () => markEmailsRestored(database, accountId, externalIds, now3)), "markRestored"),
21370
21574
  async chunksToEmbed(model, { after: after2, limit }) {
21371
21575
  drainEmailIndex(database, stemmerFor2);
21372
21576
  const file = database.prepare("SELECT text FROM attachments WHERE id = ?");
@@ -21461,7 +21665,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor2 = ste
21461
21665
  }
21462
21666
  }), "mailStoreOver");
21463
21667
 
21464
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/dictionary.js
21668
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/search/dictionary.js
21465
21669
  import { readFileSync as readFileSync2 } from "node:fs";
21466
21670
  var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
21467
21671
  var folded4 = /* @__PURE__ */ __name((word) => /^[а-яё'-]*$/.test(word) ? word.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word), "folded");
@@ -21551,7 +21755,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
21551
21755
  }, "knownWord");
21552
21756
  var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
21553
21757
 
21554
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
21758
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
21555
21759
  var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
21556
21760
  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");
21557
21761
  var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
@@ -21592,21 +21796,21 @@ var transcriptTerms = /* @__PURE__ */ __name((database, root, item) => {
21592
21796
  return terms2;
21593
21797
  }, "transcriptTerms");
21594
21798
  var transcriptCondition = /* @__PURE__ */ __name((terms2, part = "all") => {
21595
- const parts = [];
21799
+ const parts2 = [];
21596
21800
  const words3 = /* @__PURE__ */ __name((match) => ({
21597
21801
  sql: "att.id IN (SELECT rowid FROM attachment_words WHERE attachment_words MATCH ?)",
21598
21802
  params: [match]
21599
21803
  }), "words");
21600
21804
  if (part === "all" || part === "typed")
21601
- parts.push(words3(terms2.match));
21805
+ parts2.push(words3(terms2.match));
21602
21806
  if ((part === "all" || part === "forms") && terms2.stems)
21603
- parts.push({
21807
+ parts2.push({
21604
21808
  sql: "att.id IN (SELECT rowid FROM transcript_stems WHERE transcript_stems MATCH ?)",
21605
21809
  params: [`stems : (${terms2.stems})`]
21606
21810
  });
21607
21811
  if ((part === "all" || part === "widened") && terms2.widened.length)
21608
- parts.push(words3(terms2.widened.map(quoted).join(" OR ")));
21609
- return parts.length ? { sql: `(${parts.map(({ sql: sql2 }) => sql2).join(" OR ")})`, params: parts.flatMap(({ params }) => params) } : { sql: "0", params: [] };
21812
+ parts2.push(words3(terms2.widened.map(quoted).join(" OR ")));
21813
+ return parts2.length ? { sql: `(${parts2.map(({ sql: sql2 }) => sql2).join(" OR ")})`, params: parts2.flatMap(({ params }) => params) } : { sql: "0", params: [] };
21610
21814
  }, "transcriptCondition");
21611
21815
  var transcriptItems = /* @__PURE__ */ __name((item, terms2, part) => {
21612
21816
  const condition = transcriptCondition(terms2, part);
@@ -21637,7 +21841,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
21637
21841
  return found2;
21638
21842
  }, "spokenTranscripts");
21639
21843
 
21640
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
21844
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
21641
21845
  var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
21642
21846
  const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
21643
21847
  if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
@@ -21684,7 +21888,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
21684
21888
  });
21685
21889
  }, "placeHits");
21686
21890
 
21687
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
21891
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
21688
21892
  var MESSAGES2 = {
21689
21893
  rows: "messages",
21690
21894
  threads: "chats",
@@ -21720,17 +21924,18 @@ var GROUPS = {
21720
21924
  var matchQuery = /* @__PURE__ */ __name((context, execution) => runQuery(context, execution), "matchQuery");
21721
21925
  var countQuery = /* @__PURE__ */ __name((context, execution, by) => runQuery(context, execution, by), "countQuery");
21722
21926
  var queryMessagePks = /* @__PURE__ */ __name((context, execution) => runQuery(context, execution, "pks"), "queryMessagePks");
21723
- var countMatches = /* @__PURE__ */ __name((context, execution, cap) => {
21927
+ var countMatches = /* @__PURE__ */ __name((context, execution, cap) => matchingPks(context, execution, cap)?.length, "countMatches");
21928
+ var matchingPks = /* @__PURE__ */ __name((context, execution, cap) => {
21724
21929
  const { database, check: check3, where, from: from2, withRanking, ranked, leaves } = compileQuery(context, {
21725
21930
  ...execution,
21726
21931
  newest: true
21727
21932
  });
21728
21933
  if (leaves.some(({ test }) => test))
21729
21934
  return void 0;
21730
- const row2 = database.prepare(`SELECT count(*) AS n FROM (${withRanking}SELECT m.id ${from2} WHERE ${where.sql} LIMIT ?)`).get(...ranked.params, ...where.params, cap + 1);
21935
+ const rows = database.prepare(`${withRanking}SELECT m.id ${from2} WHERE ${where.sql} LIMIT ?`).all(...ranked.params, ...where.params, cap + 1);
21731
21936
  check3();
21732
- return Number(row2?.n ?? 0);
21733
- }, "countMatches");
21937
+ return rows.map(({ id: id2 }) => Number(id2));
21938
+ }, "matchingPks");
21734
21939
  var compileQuery = /* @__PURE__ */ __name((context, execution, boundedAttachments = false) => {
21735
21940
  const { database } = context;
21736
21941
  const corpus = execution.corpus === "mail" ? MAIL : MESSAGES2;
@@ -21895,11 +22100,11 @@ var compileQuery = /* @__PURE__ */ __name((context, execution, boundedAttachment
21895
22100
  const required3 = node.clauses.filter(({ occur }) => occur === "must");
21896
22101
  const optional = node.clauses.filter(({ occur }) => occur === "should");
21897
22102
  if (required3.length) {
21898
- const parts2 = required3.flatMap(({ node: node2 }) => requiredText(node2, index2) ?? []);
21899
- return parts2.length ? parts2.map((part) => `(${part})`).join(" AND ") : void 0;
22103
+ const parts3 = required3.flatMap(({ node: node2 }) => requiredText(node2, index2) ?? []);
22104
+ return parts3.length ? parts3.map((part) => `(${part})`).join(" AND ") : void 0;
21900
22105
  }
21901
- const parts = optional.map(({ node: node2 }) => requiredText(node2, index2));
21902
- return parts.length && parts.every((part) => part !== void 0) ? parts.map((part) => `(${part})`).join(" OR ") : void 0;
22106
+ const parts2 = optional.map(({ node: node2 }) => requiredText(node2, index2));
22107
+ return parts2.length && parts2.every((part) => part !== void 0) ? parts2.map((part) => `(${part})`).join(" OR ") : void 0;
21903
22108
  }, "requiredText");
21904
22109
  const stemmed = [...fragments.keys()].some(isStemmed);
21905
22110
  const elsewhere = [...fragments.values()].some(({ fragment }) => fragment.elsewhere);
@@ -21922,10 +22127,10 @@ var compileQuery = /* @__PURE__ */ __name((context, execution, boundedAttachment
21922
22127
  }
21923
22128
  const required3 = node.clauses.filter(({ occur }) => occur === "must");
21924
22129
  const optional = node.clauses.filter(({ occur }) => occur === "should");
21925
- const parts = required3.length ? required3.flatMap(({ node: node2 }) => driverOf(node2) ?? []) : optional.map(({ node: node2 }) => driverOf(node2));
21926
- if (!parts.length || parts.some((part) => part === void 0))
22130
+ const parts2 = required3.length ? required3.flatMap(({ node: node2 }) => driverOf(node2) ?? []) : optional.map(({ node: node2 }) => driverOf(node2));
22131
+ if (!parts2.length || parts2.some((part) => part === void 0))
21927
22132
  return void 0;
21928
- const sets = parts;
22133
+ const sets = parts2;
21929
22134
  return {
21930
22135
  sql: sets.map(({ sql: sql2 }) => `SELECT id FROM (${sql2})`).join(required3.length ? " INTERSECT " : " UNION "),
21931
22136
  params: sets.flatMap(({ params }) => params)
@@ -21960,9 +22165,9 @@ var compileQuery = /* @__PURE__ */ __name((context, execution, boundedAttachment
21960
22165
  const one = said(node, part);
21961
22166
  return { sql: `SELECT attachable_id, ${tier} FROM (${one.sql})`, params: one.params };
21962
22167
  }), "spoken");
21963
- const parts = [...spoken("forms", 2), ...spoken("widened", 5)];
21964
- ranked.sql.push(`s(id, tier) AS MATERIALIZED (SELECT att.attachable_id, min(CASE WHEN ${SPEECH} THEN 1 ELSE 4 END) FROM attachments att WHERE att.attachable_type='${corpus.item}' AND att.id IN (SELECT rowid FROM attachment_words WHERE attachment_words MATCH ?) GROUP BY att.attachable_id UNION ALL SELECT attachable_id, 3 FROM (${namedSql})${parts.map(({ sql: sql2 }) => ` UNION ALL ${sql2}`).join("")})`);
21965
- ranked.params.push(places2.join(" OR "), places2.join(" OR "), ...parts.flatMap(({ params }) => params));
22168
+ const parts2 = [...spoken("forms", 2), ...spoken("widened", 5)];
22169
+ ranked.sql.push(`s(id, tier) AS MATERIALIZED (SELECT att.attachable_id, min(CASE WHEN ${SPEECH} THEN 1 ELSE 4 END) FROM attachments att WHERE att.attachable_type='${corpus.item}' AND att.id IN (SELECT rowid FROM attachment_words WHERE attachment_words MATCH ?) GROUP BY att.attachable_id UNION ALL SELECT attachable_id, 3 FROM (${namedSql})${parts2.map(({ sql: sql2 }) => ` UNION ALL ${sql2}`).join("")})`);
22170
+ ranked.params.push(places2.join(" OR "), places2.join(" OR "), ...parts2.flatMap(({ params }) => params));
21966
22171
  }
21967
22172
  const placeTier = places2.length && !execution.newest ? "coalesce((SELECT min(tier) FROM s WHERE s.id=m.id), 6)," : "";
21968
22173
  if (exactTier) {
@@ -22157,7 +22362,7 @@ var runQuery = /* @__PURE__ */ __name(async (context, execution, by) => {
22157
22362
  };
22158
22363
  }, "runQuery");
22159
22364
 
22160
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
22365
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
22161
22366
  function invalidMetadata() {
22162
22367
  throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
22163
22368
  }
@@ -22259,7 +22464,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
22259
22464
  };
22260
22465
  }), "counterTargets");
22261
22466
 
22262
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
22467
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
22263
22468
  var NOT_FILE_LIST = [...NOT_FILES].map((kind3) => `'${kind3}'`).join(",");
22264
22469
  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,
22265
22470
  att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
@@ -22378,7 +22583,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
22378
22583
  }));
22379
22584
  }, "attachmentViews");
22380
22585
 
22381
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
22586
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
22382
22587
  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");
22383
22588
  var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text5, source2) => {
22384
22589
  const { orm, database, now: now2 } = context;
@@ -22416,7 +22621,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
22416
22621
  keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
22417
22622
  }, "intoVoiceAttachment");
22418
22623
 
22419
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
22624
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
22420
22625
  var FIELDS = [
22421
22626
  "threadExternalId",
22422
22627
  "senderIdentityId",
@@ -22733,33 +22938,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
22733
22938
  reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
22734
22939
  }, "writeDerivedReactions");
22735
22940
 
22736
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
22737
- var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
22738
- const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
22739
- return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
22740
- }, "syncStateOf");
22741
- var writeState = /* @__PURE__ */ __name(({ orm, now: now2 }, accountKey, name, value) => {
22742
- orm.insert(syncCursors).values({ accountId: accountKey, key: name, value, createdAt: now2(), updatedAt: now2() }).onConflictDoUpdate({
22743
- target: [syncCursors.accountId, syncCursors.key],
22744
- set: { value: sql`excluded.value`, updatedAt: sql`excluded.updated_at` }
22745
- }).run();
22746
- }, "writeState");
22747
- var clearState = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
22748
- orm.delete(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).run();
22749
- }, "clearState");
22750
- var claim2 = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, anchor, holder, forMs) => {
22751
- const at = now2();
22752
- return orm.insert(fetchLeases).values({ chatId: chatKey, anchor, holder, expiresAt: at + forMs }).onConflictDoUpdate({
22753
- target: [fetchLeases.chatId, fetchLeases.anchor],
22754
- set: { holder: sql`excluded.holder`, expiresAt: sql`excluded.expires_at` },
22755
- setWhere: or(eq(fetchLeases.holder, sql`excluded.holder`), lte(fetchLeases.expiresAt, at))
22756
- }).returning({ chatId: fetchLeases.chatId }).all().length > 0;
22757
- }, "claim");
22758
- var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
22759
- orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
22760
- }, "release");
22761
-
22762
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/keys.js
22941
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/keys.js
22763
22942
  var keysOver = /* @__PURE__ */ __name((context) => {
22764
22943
  const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
22765
22944
  const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
@@ -22780,7 +22959,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
22780
22959
  };
22781
22960
  }, "keysOver");
22782
22961
 
22783
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
22962
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
22784
22963
  var accountGroupsOf = /* @__PURE__ */ __name((database) => {
22785
22964
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
22786
22965
  if (!row2)
@@ -22815,7 +22994,7 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
22815
22994
  database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
22816
22995
  }, "saveProfile");
22817
22996
 
22818
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
22997
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
22819
22998
  var BOT_KINDS = ["agent", "script", "integration"];
22820
22999
  var ownerPerson = /* @__PURE__ */ __name((database) => {
22821
23000
  const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
@@ -22851,7 +23030,7 @@ var originOfActor = /* @__PURE__ */ __name((database, type, id2) => {
22851
23030
  return database.prepare("SELECT name FROM bots WHERE id = ?").get(Number(id2))?.name === "rule" ? "rule" : "agent";
22852
23031
  }, "originOfActor");
22853
23032
 
22854
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
23033
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
22855
23034
  var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
22856
23035
  const owner = ownerPerson(context.database).id;
22857
23036
  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);
@@ -22872,7 +23051,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
22872
23051
  return personOf(context, ref3);
22873
23052
  }, "linkToOwner");
22874
23053
 
22875
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
23054
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
22876
23055
  var PROVIDERS_SETTING = "providers";
22877
23056
  var storedProvidersOf = /* @__PURE__ */ __name((database) => {
22878
23057
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
@@ -22907,7 +23086,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
22907
23086
  });
22908
23087
  }, "registerProvider");
22909
23088
 
22910
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
23089
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
22911
23090
  var DAY3 = 864e5;
22912
23091
  var RECENTLY_CLOSED_MS = 14 * DAY3;
22913
23092
  var TEXT_LIMIT = 20;
@@ -23106,7 +23285,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
23106
23285
  };
23107
23286
  }, "taskSimilarityOver");
23108
23287
 
23109
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
23288
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
23110
23289
  var SETTING3 = "taskCategories";
23111
23290
  var savedTaskCategories = /* @__PURE__ */ __name((database) => {
23112
23291
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
@@ -23125,7 +23304,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
23125
23304
  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);
23126
23305
  }, "saveTaskCategories");
23127
23306
 
23128
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
23307
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
23129
23308
  var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
23130
23309
  var ALLOWED = "taskAgentClose";
23131
23310
  var MIN = "taskAgentCloseMin";
@@ -23181,7 +23360,7 @@ var SUGGESTION_COLUMNS = [
23181
23360
  ];
23182
23361
  var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
23183
23362
 
23184
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
23363
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
23185
23364
  var EXCERPT_CHARS = 280;
23186
23365
  var excerptOf = /* @__PURE__ */ __name((text5) => {
23187
23366
  if (text5 == null)
@@ -23224,7 +23403,7 @@ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => database.pre
23224
23403
  };
23225
23404
  }), "evidenceSourcesOf");
23226
23405
 
23227
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/ulid.js
23406
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/ulid.js
23228
23407
  import { randomBytes } from "node:crypto";
23229
23408
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
23230
23409
  var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
@@ -23237,7 +23416,7 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
23237
23416
  return time3 + random;
23238
23417
  }, "ulid");
23239
23418
 
23240
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
23419
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
23241
23420
  var FOLDED_FIELDS = ["title", "site", "language", "author"];
23242
23421
  var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
23243
23422
  if (!meta && !sections?.length)
@@ -23258,7 +23437,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
23258
23437
  return typeof language === "string" && language !== "" ? language : null;
23259
23438
  }, "languageOf");
23260
23439
 
23261
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
23440
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
23262
23441
  var isObject = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
23263
23442
  var objectOf = /* @__PURE__ */ __name((value) => {
23264
23443
  if (isObject(value))
@@ -23501,7 +23680,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
23501
23680
  };
23502
23681
  }, "filesStoreOver");
23503
23682
 
23504
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
23683
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
23505
23684
  var IMPORTED_DOCUMENT_QUERY = defineQuery({
23506
23685
  entity: "document",
23507
23686
  backend: "sql",
@@ -23547,7 +23726,7 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
23547
23726
  return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
23548
23727
  }, "importedDocumentWhere");
23549
23728
 
23550
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
23729
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
23551
23730
  var NOTE_FORMATS = ["obsidian", "markdown"];
23552
23731
  var iso2 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
23553
23732
  var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso2(value), "optionalIso");
@@ -23817,8 +23996,8 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
23817
23996
  const candidates = !found2 && !place && localSave(folder, input.frontMatter) ? sameContent(hash2, text5) : [];
23818
23997
  if (candidates.length === 1) {
23819
23998
  const id3 = candidates[0];
23820
- const joined3 = documentRow(String(id3));
23821
- if (joined3.deleted_at != null)
23999
+ const joined4 = documentRow(String(id3));
24000
+ if (joined4.deleted_at != null)
23822
24001
  database.prepare("UPDATE documents SET deleted_at = NULL, body = ?, updated_at = ? WHERE id = ?").run(text5, at, id3);
23823
24002
  syncFile(database, at, id3, { place: here, method: "content-hash" });
23824
24003
  followPreferred(id3, at);
@@ -24057,7 +24236,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
24057
24236
  };
24058
24237
  }, "notesStoreOver");
24059
24238
 
24060
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
24239
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
24061
24240
  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";
24062
24241
  var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
24063
24242
  var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -24104,6 +24283,16 @@ var subjectOf = /* @__PURE__ */ __name((database, row2) => {
24104
24283
  subjectIsOwner: Number(named2?.owner) === 1
24105
24284
  };
24106
24285
  }, "subjectOf");
24286
+ var highestKey = /* @__PURE__ */ __name((table) => `ids.${table}.highest`, "highestKey");
24287
+ var nextId = /* @__PURE__ */ __name((database, table) => {
24288
+ const kept = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(highestKey(table));
24289
+ const highest = database.prepare(`SELECT max(id) AS id FROM ${table}`).get();
24290
+ return Math.max(Number(kept?.value ?? 0), Number(highest?.id ?? 0)) + 1;
24291
+ }, "nextId");
24292
+ var keepHighestId = /* @__PURE__ */ __name((database, table, at) => {
24293
+ const highest = nextId(database, table) - 1;
24294
+ database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(highestKey(table), String(highest), at);
24295
+ }, "keepHighestId");
24107
24296
  var dropLinksOf = /* @__PURE__ */ __name((database, thing) => {
24108
24297
  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);
24109
24298
  database.prepare("DELETE FROM links WHERE to_type = ? AND to_id = ?").run(thing.type, thing.id);
@@ -24182,7 +24371,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24182
24371
  const subject2 = input.subject === void 0 ? void 0 : requiredThing(database, input.subject, "the subject");
24183
24372
  const replaced = input.supersedes === void 0 ? void 0 : Number(rowOf(input.supersedes).id);
24184
24373
  const at = now2();
24185
- 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);
24374
+ 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);
24186
24375
  linkEvidence(context, { type: "memory", id: made }, input.evidence, input.author === "owner" ? "owner" : "agent");
24187
24376
  if (replaced !== void 0)
24188
24377
  database.prepare("UPDATE memories SET status = 'superseded', updated_at = ? WHERE id = ?").run(at, replaced);
@@ -24200,6 +24389,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24200
24389
  remove: /* @__PURE__ */ __name(async (reference2) => {
24201
24390
  const id2 = Number(rowOf(reference2).id);
24202
24391
  const links2 = erase(database, () => {
24392
+ keepHighestId(database, "memories", now2());
24203
24393
  database.prepare("UPDATE memories SET supersedes_id = NULL WHERE supersedes_id = ?").run(id2);
24204
24394
  const count = dropLinksOf(database, { type: "memory", id: id2 });
24205
24395
  database.prepare("DELETE FROM memories WHERE id = ?").run(id2);
@@ -24221,7 +24411,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24221
24411
  };
24222
24412
  }, "memoriesStoreOver");
24223
24413
 
24224
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
24414
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
24225
24415
  var DEFAULT_FIRST_PASS_PER_CHAT = 0;
24226
24416
  var KEY = "taskFirstPassPerChat";
24227
24417
  var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
@@ -24241,7 +24431,7 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
24241
24431
  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);
24242
24432
  }, "saveFirstPassPerChat");
24243
24433
 
24244
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
24434
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
24245
24435
  var TASK_RELATION_KINDS = [
24246
24436
  "blocked-by",
24247
24437
  "follow-up-of",
@@ -24371,7 +24561,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
24371
24561
  };
24372
24562
  }, "taskRelationsStoreOver");
24373
24563
 
24374
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
24564
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
24375
24565
  var TASK_ROLES = ["assignee", "reviewer", "watcher"];
24376
24566
  var TASK_EVENT_KINDS = [
24377
24567
  "created",
@@ -24658,7 +24848,7 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
24658
24848
  };
24659
24849
  }, "workTasksOver");
24660
24850
 
24661
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
24851
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
24662
24852
  var taskCloseOver = /* @__PURE__ */ __name((context) => {
24663
24853
  const { database, now: now2 } = context;
24664
24854
  const liveRow = /* @__PURE__ */ __name((id2) => {
@@ -24704,7 +24894,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
24704
24894
  };
24705
24895
  }, "taskCloseOver");
24706
24896
 
24707
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
24897
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
24708
24898
  var TASK_PAIR_DECISIONS = ["review", "unsure", "merged", "rejected", "unmerged", "attached", "new"];
24709
24899
  var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
24710
24900
  const { database, now: now2 } = context;
@@ -24923,7 +25113,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
24923
25113
  };
24924
25114
  }, "taskPairsOver");
24925
25115
 
24926
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
25116
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
24927
25117
  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";
24928
25118
  var taskStoreOver = /* @__PURE__ */ __name((context) => {
24929
25119
  const { database, now: now2 } = context;
@@ -25118,7 +25308,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
25118
25308
  throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
25119
25309
  }, "oneOf");
25120
25310
 
25121
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/accounts.js
25311
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/accounts.js
25122
25312
  var accountAccountsOver = /* @__PURE__ */ __name((context) => {
25123
25313
  const { database } = context;
25124
25314
  const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
@@ -25163,7 +25353,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
25163
25353
  };
25164
25354
  }, "accountsStoreOver");
25165
25355
 
25166
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
25356
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
25167
25357
  var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
25168
25358
  var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
25169
25359
  const message2 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
@@ -25187,7 +25377,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
25187
25377
  })), "keepDownloads");
25188
25378
  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");
25189
25379
 
25190
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/attachments.js
25380
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/attachments.js
25191
25381
  var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
25192
25382
  const { database } = context;
25193
25383
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -25244,7 +25434,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
25244
25434
  }, "keepAttachmentText")
25245
25435
  }), "attachmentsStoreOver");
25246
25436
 
25247
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
25437
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
25248
25438
  var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
25249
25439
  var pointerMover = /* @__PURE__ */ __name((context, type) => {
25250
25440
  const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
@@ -25424,7 +25614,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
25424
25614
  return done;
25425
25615
  }, "rekeyChats");
25426
25616
 
25427
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
25617
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
25428
25618
  var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
25429
25619
  var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
25430
25620
  var CHAT_LIST_KEY = "chat_list_complete";
@@ -25456,7 +25646,7 @@ var chatCompleteness = /* @__PURE__ */ __name(({ database }, accountKey, chatIds
25456
25646
  });
25457
25647
  }, "chatCompleteness");
25458
25648
 
25459
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/chats.js
25649
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/chats.js
25460
25650
  var chatsStoreOver = /* @__PURE__ */ __name((context) => {
25461
25651
  const { database } = context;
25462
25652
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
@@ -25563,7 +25753,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
25563
25753
  };
25564
25754
  }, "chatsStoreOver");
25565
25755
 
25566
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
25756
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
25567
25757
  import { createHash as createHash6 } from "node:crypto";
25568
25758
  var BATCH_CONTEXT = 50;
25569
25759
  var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
@@ -25701,7 +25891,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
25701
25891
  var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
25702
25892
  ${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
25703
25893
 
25704
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
25894
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
25705
25895
  import { setTimeout } from "node:timers/promises";
25706
25896
  var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
25707
25897
  var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
@@ -26013,7 +26203,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
26013
26203
  AND NOT EXISTS (SELECT 1 FROM messages d
26014
26204
  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");
26015
26205
 
26016
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/conversations.js
26206
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/conversations.js
26017
26207
  var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
26018
26208
  const { database } = context;
26019
26209
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -26120,7 +26310,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
26120
26310
  };
26121
26311
  }, "conversationsStoreOver");
26122
26312
 
26123
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/counters.js
26313
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/counters.js
26124
26314
  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";
26125
26315
  var accountCountersOver = /* @__PURE__ */ __name((context) => {
26126
26316
  const { database } = context;
@@ -26145,7 +26335,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
26145
26335
  counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
26146
26336
  }), "countersStoreOver");
26147
26337
 
26148
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
26338
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
26149
26339
  var MENTION_STATUSES = ["found", "linked", "dismissed"];
26150
26340
  var MENTION_QUERY = defineQuery({
26151
26341
  entity: "mention",
@@ -26361,7 +26551,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
26361
26551
  return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
26362
26552
  }, "listPlaces");
26363
26553
 
26364
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/mentions.js
26554
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/mentions.js
26365
26555
  var accountMentionsOver = /* @__PURE__ */ __name((context) => {
26366
26556
  const { database } = context;
26367
26557
  const { findAccountPk: findAccountPk2 } = keysOver(context);
@@ -26396,7 +26586,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
26396
26586
  places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
26397
26587
  }), "mentionsStoreOver");
26398
26588
 
26399
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
26589
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
26400
26590
  var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
26401
26591
  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");
26402
26592
  const rows = messageId === void 0 ? read2.all(chatKey) : read2.all(chatKey, messageId);
@@ -26411,7 +26601,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
26411
26601
  }));
26412
26602
  }, "documentLinkMessages");
26413
26603
 
26414
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
26604
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
26415
26605
  var stemmerFor = stemmerCache();
26416
26606
  var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
26417
26607
  if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
@@ -26421,13 +26611,12 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
26421
26611
  if (!wanted.length || !stemmers || !stemsState(database)?.ready)
26422
26612
  return wanted.map(() => []);
26423
26613
  const stemmer = stemmerFor(stemmers);
26424
- database.exec("CREATE VIRTUAL TABLE IF NOT EXISTS temp.message_stem_counts USING fts5vocab(main, message_stems, col)");
26425
- const count = database.prepare("SELECT doc FROM temp.message_stem_counts WHERE term = ? AND col = 'stems'");
26614
+ const count = database.prepare("SELECT count(*) AS doc FROM (SELECT rowid FROM message_stems WHERE message_stems MATCH ? LIMIT ?)");
26426
26615
  const counts = /* @__PURE__ */ new Map();
26427
26616
  const countOf = /* @__PURE__ */ __name((stem) => {
26428
26617
  let found2 = counts.get(stem);
26429
26618
  if (found2 === void 0) {
26430
- found2 = Number(count.get(stem)?.doc ?? 0);
26619
+ found2 = Number(count.get(`stems : "${stem.replaceAll('"', '""')}"`, rareAt + 1)?.doc ?? 0);
26431
26620
  counts.set(stem, found2);
26432
26621
  }
26433
26622
  return found2;
@@ -26456,7 +26645,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
26456
26645
  });
26457
26646
  }, "laterSharingRare");
26458
26647
 
26459
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/messages.js
26648
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/messages.js
26460
26649
  var accountMessagesOver = /* @__PURE__ */ __name((context) => {
26461
26650
  const { database } = context;
26462
26651
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
@@ -26591,7 +26780,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
26591
26780
  laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
26592
26781
  }), "messagesStoreOver");
26593
26782
 
26594
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
26783
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
26595
26784
  var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
26596
26785
  var iso5 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
26597
26786
  var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: accounts2, limit }) => {
@@ -26648,7 +26837,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
26648
26837
  });
26649
26838
  }, "personPreparation");
26650
26839
 
26651
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
26840
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
26652
26841
  var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
26653
26842
  const id2 = Number(uid);
26654
26843
  if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
@@ -26656,7 +26845,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
26656
26845
  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)));
26657
26846
  }, "personSeenInAccounts");
26658
26847
 
26659
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
26848
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
26660
26849
  var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
26661
26850
  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);
26662
26851
  if (!row2)
@@ -26722,7 +26911,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
26722
26911
  return { id: id2, personId, removed: true };
26723
26912
  }, "removeNote");
26724
26913
 
26725
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/people.js
26914
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/people.js
26726
26915
  var accountPeopleOver = /* @__PURE__ */ __name((context) => {
26727
26916
  const { database } = context;
26728
26917
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
@@ -26797,13 +26986,153 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
26797
26986
  };
26798
26987
  }, "peopleStoreOver");
26799
26988
 
26800
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
26989
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
26801
26990
  import { createHash as createHash8 } from "node:crypto";
26802
26991
 
26803
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
26992
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
26804
26993
  import { createHash as createHash7 } from "node:crypto";
26805
26994
 
26806
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
26995
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
26996
+ var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
26997
+ var AUTHOR_MEASURES = [
26998
+ "messages",
26999
+ "words",
27000
+ "reactions",
27001
+ "replies",
27002
+ "answers",
27003
+ "answer-time",
27004
+ "threads",
27005
+ "active-days"
27006
+ ];
27007
+ var CONTEXT = /* @__PURE__ */ new Set([
27008
+ "replies",
27009
+ "replies-from-others",
27010
+ "replies-from-others-per-message",
27011
+ "thread-size",
27012
+ "threads",
27013
+ "answers",
27014
+ "answer-time"
27015
+ ]);
27016
+ var needsRankingContext = /* @__PURE__ */ __name((options) => options.components.some((name) => CONTEXT.has(name)), "needsRankingContext");
27017
+ var presets = {
27018
+ helpful: { answers: 0.5, "replies-from-others": 0.25, reactions: 0.25 },
27019
+ active: { "active-days": 0.6, messages: 0.4 },
27020
+ engaging: { "reactions-per-message": 0.5, "replies-from-others-per-message": 0.5 }
27021
+ };
27022
+ function invalid3(message2) {
27023
+ throw new CliError("validation_error", message2, { reason: "ranking.invalid" });
27024
+ }
27025
+ __name(invalid3, "invalid");
27026
+ var rankingOptions = /* @__PURE__ */ __name((target, input) => {
27027
+ const measures = target === "messages" ? MESSAGE_MEASURES : AUTHOR_MEASURES;
27028
+ const { measure, score, weights: given, minMessages } = input;
27029
+ const messageKind = input.messageKind ?? "all";
27030
+ if (!["all", "posts", "comments"].includes(messageKind))
27031
+ invalid3("message_kind takes all, posts or comments");
27032
+ if (target === "messages" && minMessages !== void 0)
27033
+ invalid3("min_messages applies to stats contacts top");
27034
+ if (minMessages !== void 0 && (!Number.isSafeInteger(minMessages) || minMessages < 1))
27035
+ invalid3("min_messages takes a positive integer");
27036
+ if (measure !== void 0 && !measures.includes(measure))
27037
+ invalid3(`--measure takes ${measures.join(", ")}`);
27038
+ if (measure !== void 0 && (score !== void 0 || given !== void 0))
27039
+ invalid3("--measure cannot be combined with --score or --weights");
27040
+ if (score !== void 0 && !["helpful", "active", "engaging"].includes(score))
27041
+ invalid3("--score takes helpful, active or engaging");
27042
+ if (target === "messages" && score !== void 0 && score !== "engaging")
27043
+ invalid3("helpful and active scores apply to authors only");
27044
+ const scoring = score !== void 0 || given !== void 0;
27045
+ const preset2 = score;
27046
+ let weights = null;
27047
+ if (scoring) {
27048
+ let raw = given !== void 0 ? given : target === "messages" ? { reactions: 0.5, "replies-from-others": 0.5 } : presets[preset2];
27049
+ if (typeof raw === "string") {
27050
+ try {
27051
+ raw = JSON.parse(raw);
27052
+ } catch {
27053
+ invalid3("--weights takes a JSON object of component weights");
27054
+ }
27055
+ }
27056
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
27057
+ invalid3("--weights takes a JSON object of component weights");
27058
+ const allowed = target === "messages" ? [...MESSAGE_MEASURES, "replies-from-others"] : [
27059
+ ...AUTHOR_MEASURES.filter((name) => name !== "answer-time"),
27060
+ "replies-from-others",
27061
+ "reactions-per-message",
27062
+ "replies-from-others-per-message"
27063
+ ];
27064
+ const entries = Object.entries(raw);
27065
+ for (const [name, weight] of entries) {
27066
+ if (!allowed.includes(name))
27067
+ invalid3(`unknown ${target} score component: ${name}`);
27068
+ if (typeof weight !== "number" || !Number.isFinite(weight) || weight < 0)
27069
+ invalid3(`weight for ${name} must be a finite nonnegative number`);
27070
+ }
27071
+ if (!entries.some(([, weight]) => weight > 0))
27072
+ invalid3("--weights needs at least one positive weight");
27073
+ weights = Object.fromEntries(entries);
27074
+ }
27075
+ const selected = measure ?? (target === "messages" ? "reactions" : "messages");
27076
+ return {
27077
+ target,
27078
+ messageKind,
27079
+ minMessages: minMessages ?? (target === "contacts" && score === "engaging" ? 5 : 1),
27080
+ measure: scoring ? "score" : selected,
27081
+ order: !scoring && selected === "answer-time" ? "ascending" : "descending",
27082
+ weights,
27083
+ preset: scoring ? preset2 ?? "custom" : null,
27084
+ components: weights === null ? [selected] : Object.entries(weights).filter(([, weight]) => weight > 0).map(([name]) => name)
27085
+ };
27086
+ }, "rankingOptions");
27087
+ var rankingScore = /* @__PURE__ */ __name((raw, maxima, weights) => {
27088
+ const entries = Object.entries(weights).filter(([, weight]) => weight > 0);
27089
+ const scale = Math.max(...entries.map(([, weight]) => weight));
27090
+ const denominator = entries.reduce((sum2, [, weight]) => sum2 + weight / scale, 0);
27091
+ if (!Number.isFinite(scale) || scale <= 0 || !Number.isFinite(denominator) || denominator <= 0)
27092
+ return null;
27093
+ const normalized = {};
27094
+ const contributions = {};
27095
+ let sum = 0;
27096
+ for (const [name, weight] of entries) {
27097
+ const value = raw[name];
27098
+ const maximum = maxima[name];
27099
+ if (value == null || !Number.isFinite(value) || value < 0 || maximum === void 0 || !Number.isFinite(maximum) || maximum < value)
27100
+ return null;
27101
+ const part = maximum === 0 ? 0 : value / maximum;
27102
+ normalized[name] = part;
27103
+ contributions[name] = 100 * part * (weight / scale) / denominator;
27104
+ sum += contributions[name];
27105
+ }
27106
+ return { score: Math.min(100, sum), normalized, contributions };
27107
+ }, "rankingScore");
27108
+ var RANKING_TOKENIZER_VERSION = 1;
27109
+ var withoutUrls = /* @__PURE__ */ __name((text5) => text5.replace(/\S+/gu, (token) => {
27110
+ for (let offset = 0; ; ) {
27111
+ const marker = token.indexOf("://", offset);
27112
+ if (marker < 0)
27113
+ break;
27114
+ let start = marker;
27115
+ while (start > 0 && /[a-z0-9+.-]/iu.test(token[start - 1]))
27116
+ start--;
27117
+ if (/^[a-z][a-z0-9+.-]*$/iu.test(token.slice(start, marker)) && (start === 0 || !/\w/u.test(token[start - 1])))
27118
+ return token.slice(0, start);
27119
+ offset = marker + 3;
27120
+ }
27121
+ const folded5 = token.toLowerCase();
27122
+ for (let offset = 0; ; ) {
27123
+ const start = folded5.indexOf("www.", offset);
27124
+ if (start < 0)
27125
+ break;
27126
+ if (start === 0 || !/\w/u.test(token[start - 1]))
27127
+ return token.slice(0, start);
27128
+ offset = start + 4;
27129
+ }
27130
+ return token;
27131
+ }), "withoutUrls");
27132
+ var rankingWords = /* @__PURE__ */ __name((text5) => withoutUrls(text5).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
27133
+ var rankingQuestion = /* @__PURE__ */ __name((text5) => withoutUrls(text5).includes("?"), "rankingQuestion");
27134
+
27135
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
26807
27136
  var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
26808
27137
  var exhausted2 = /* @__PURE__ */ __name((budget) => {
26809
27138
  throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
@@ -27025,7 +27354,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
27025
27354
  };
27026
27355
  }, "rankReplyGraph");
27027
27356
 
27028
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
27357
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
27029
27358
  var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
27030
27359
  var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
27031
27360
  var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
@@ -27199,7 +27528,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
27199
27528
  return { items, evidence, summary, graph: graph.quality };
27200
27529
  }, "calculateAdminStatistics");
27201
27530
 
27202
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
27531
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
27203
27532
  var rankingContextRange = /* @__PURE__ */ __name((root) => {
27204
27533
  const dates = [];
27205
27534
  const visit = /* @__PURE__ */ __name((node, required3) => {
@@ -27221,7 +27550,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
27221
27550
  return dates[0].node.resolution.date;
27222
27551
  }, "rankingContextRange");
27223
27552
 
27224
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
27553
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
27225
27554
  var reactionCounts = /* @__PURE__ */ __name((stored3) => {
27226
27555
  let counts;
27227
27556
  try {
@@ -27271,7 +27600,7 @@ var periodOf = /* @__PURE__ */ __name((range) => {
27271
27600
  }
27272
27601
  return { sql: clauses.join(" AND ") || "1", params };
27273
27602
  }, "periodOf");
27274
- var joined = "FROM messages m JOIN chats c ON c.id=m.chat_id JOIN accounts ac ON ac.id=m.account_id LEFT JOIN identities i ON i.id=m.sender_identity_id";
27603
+ var joined2 = "FROM messages m JOIN chats c ON c.id=m.chat_id JOIN accounts ac ON ac.id=m.account_id LEFT JOIN identities i ON i.id=m.sender_identity_id";
27275
27604
  var graphColumns = `m.id AS pk,m.external_id AS id,c.external_id AS chat,ac.provider,ac.external_id AS account,c.kind,
27276
27605
  coalesce(i.external_id,m.sender_chat_external_id) AS sender,m.sender_chat_external_id IS NOT NULL AS sender_chat,
27277
27606
  m.sent_at AS at,${metadata2("m")} AS metadata`;
@@ -27283,11 +27612,11 @@ var graphIn = /* @__PURE__ */ __name((context, execution, request, check3) => {
27283
27612
  const params = [...scope3.params, ...period.params];
27284
27613
  const questions = request.options.components.some((name) => ["answers", "answer-time"].includes(name));
27285
27614
  const body2 = questions ? "m.text" : "''";
27286
- const size2 = database.prepare(`SELECT count(*) AS n,sum(length(cast(${body2} AS BLOB))+length(cast(${metadata2("m")} AS BLOB))) AS bytes ${joined} WHERE ${where}`).get(...params);
27615
+ const size2 = database.prepare(`SELECT count(*) AS n,sum(length(cast(${body2} AS BLOB))+length(cast(${metadata2("m")} AS BLOB))) AS bytes ${joined2} WHERE ${where}`).get(...params);
27287
27616
  check3();
27288
27617
  if (Number(size2?.n ?? 0) > RANKING_GRAPH_LIMITS.nodes || Number(size2?.bytes ?? 0) > RANKING_GRAPH_LIMITS.bytes)
27289
27618
  throw new CliError("validation_error", "ranking reply context exceeds its node or byte budget \u2014 narrow chat/date scope", { reason: "query.too-large", budget: "reply context", complete: false });
27290
- const rows = database.prepare(`SELECT ${graphColumns},${body2} AS text,(${period.sql}) AS event,m.id IN (SELECT id FROM ranking_selected) AS selected ${joined} WHERE ${where}`).all(...period.params, ...params);
27619
+ const rows = database.prepare(`SELECT ${graphColumns},${body2} AS text,(${period.sql}) AS event,m.id IN (SELECT id FROM ranking_selected) AS selected ${joined2} WHERE ${where}`).all(...period.params, ...params);
27291
27620
  const nodes = [];
27292
27621
  const keys = /* @__PURE__ */ new Set();
27293
27622
  const key2 = /* @__PURE__ */ __name((provider, account, chat2, id2) => JSON.stringify([provider, account, chat2, id2]), "key");
@@ -27323,7 +27652,7 @@ var graphIn = /* @__PURE__ */ __name((context, execution, request, check3) => {
27323
27652
  for (const row2 of rows)
27324
27653
  add(row2);
27325
27654
  const missing4 = /* @__PURE__ */ new Set();
27326
- const parentQuery = database.prepare(`SELECT ${graphColumns} ${joined} WHERE m.deleted_at IS NULL AND ${scope3.sql} AND ac.provider=? AND ac.external_id=? AND c.external_id=? AND m.external_id=?`);
27655
+ const parentQuery = database.prepare(`SELECT ${graphColumns} ${joined2} WHERE m.deleted_at IS NULL AND ${scope3.sql} AND ac.provider=? AND ac.external_id=? AND c.external_id=? AND m.external_id=?`);
27327
27656
  for (let index2 = 0; index2 < nodes.length; index2++) {
27328
27657
  check3();
27329
27658
  const node = nodes[index2];
@@ -27405,8 +27734,8 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
27405
27734
  check3();
27406
27735
  for (const row2 of rows2) {
27407
27736
  check3();
27408
- const parts = format ? Object.fromEntries(format.formatToParts(Number(row2.sent_at)).map(({ type, value }) => [type, value])) : void 0;
27409
- update.run(words3 ? rankingWords(String(row2.text)) : null, parts ? `${parts.year}-${parts.month}-${parts.day}` : null, Number(row2.pk));
27737
+ const parts2 = format ? Object.fromEntries(format.formatToParts(Number(row2.sent_at)).map(({ type, value }) => [type, value])) : void 0;
27738
+ update.run(words3 ? rankingWords(String(row2.text)) : null, parts2 ? `${parts2.year}-${parts2.month}-${parts2.day}` : null, Number(row2.pk));
27410
27739
  }
27411
27740
  after2 = Number(rows2.at(-1)?.pk);
27412
27741
  }
@@ -27516,18 +27845,18 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
27516
27845
  });
27517
27846
  }, "rankQuery");
27518
27847
 
27519
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
27848
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
27520
27849
  function fail4(message2, reason = "query.too-large") {
27521
27850
  throw new CliError("validation_error", message2, { reason, complete: false });
27522
27851
  }
27523
27852
  __name(fail4, "fail");
27524
- var joined2 = "FROM messages m JOIN chats c ON c.id=m.chat_id JOIN accounts ac ON ac.id=m.account_id LEFT JOIN identities i ON i.id=m.sender_identity_id";
27853
+ var joined3 = "FROM messages m JOIN chats c ON c.id=m.chat_id JOIN accounts ac ON ac.id=m.account_id LEFT JOIN identities i ON i.id=m.sender_identity_id";
27525
27854
  var attachmentSnapshot = `(SELECT json_group_array(json_object('position',position,'kind',kind,'mime',mime,'name',name,'title',title,'url',url,'size',size,'width',width,'height',height,'duration',duration,'localPath',local_path)) FROM attachments WHERE attachable_type='message' AND attachable_id=m.id)`;
27526
27855
  var snapshot = `json_object('edited',m.edited_at,'senderName',m.sender_name,'reply',m.reply_to,'forward',m.forward,'reactions',m.reactions,'outgoing',m.outgoing,'thread',m.thread_external_id,'attachments',${attachmentSnapshot},'counterObservations',(SELECT json_group_array(json_object('counter',counter,'value',value,'at',created_at,'source',source)) FROM message_counter_observations WHERE message_id=m.id))`;
27527
27856
  var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request) => withQuerySelection(context, execution, (selection, check3) => {
27528
27857
  const { database } = context, { options } = request;
27529
27858
  const prefix = `WITH selected AS (${selection.sql}) `;
27530
- const root = database.prepare(`${prefix}SELECT min(m.sent_at) AS oldest,count(*) AS total ${joined2} WHERE m.id IN (SELECT id FROM selected)`).get(...selection.params);
27859
+ const root = database.prepare(`${prefix}SELECT min(m.sent_at) AS oldest,count(*) AS total ${joined3} WHERE m.id IN (SELECT id FROM selected)`).get(...selection.params);
27531
27860
  const lower = options.report === "newcomers" ? options.joinSince : Number(root?.oldest ?? options.cutoff);
27532
27861
  const params = execution.accounts.flatMap((account) => [account.provider, account.account]);
27533
27862
  let scope3 = `(${execution.accounts.map(() => "(ac.provider=? AND ac.external_id=?)").join(" OR ") || "0"})`;
@@ -27538,11 +27867,11 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
27538
27867
  scope3 += " AND c.searchable=1";
27539
27868
  const where = `m.deleted_at IS NULL AND ${scope3} AND (m.sent_at BETWEEN ? AND ?${options.report === "newcomers" ? "" : " OR m.id IN (SELECT id FROM selected)"})`;
27540
27869
  const bound4 = [...selection.params, ...params, lower, options.cutoff];
27541
- const size2 = database.prepare(`${prefix}SELECT count(*) AS n,sum(length(cast(m.text AS BLOB))+length(cast(coalesce(m.metadata,'') AS BLOB))+length(cast(${snapshot} AS BLOB))) AS bytes ${joined2} WHERE ${where}`).get(...bound4);
27870
+ const size2 = database.prepare(`${prefix}SELECT count(*) AS n,sum(length(cast(m.text AS BLOB))+length(cast(coalesce(m.metadata,'') AS BLOB))+length(cast(${snapshot} AS BLOB))) AS bytes ${joined3} WHERE ${where}`).get(...bound4);
27542
27871
  check3();
27543
27872
  if (Number(size2?.n ?? 0) > RANKING_GRAPH_LIMITS.nodes || Number(size2?.bytes ?? 0) > RANKING_GRAPH_LIMITS.bytes)
27544
27873
  fail4("admin statistics context exceeds node/byte budgets \u2014 narrow chat/date scope");
27545
- const raw = database.prepare(`${prefix}SELECT m.id AS pk,m.external_id AS id,c.id AS chat_id,ac.id AS account_id,c.external_id AS chat,c.title AS title,c.kind,ac.provider,ac.external_id AS account,i.external_id AS sender,m.sender_chat_external_id AS sender_chat,i.bot,m.sent_at,m.text,m.metadata,${rankingCounter("m", "views")} AS views,${rankingCounter("m", "comments")} AS comments,m.id IN (SELECT id FROM selected) AS selected ${joined2} WHERE ${where} ORDER BY m.id`).all(...bound4);
27874
+ const raw = database.prepare(`${prefix}SELECT m.id AS pk,m.external_id AS id,c.id AS chat_id,ac.id AS account_id,c.external_id AS chat,c.title AS title,c.kind,ac.provider,ac.external_id AS account,i.external_id AS sender,m.sender_chat_external_id AS sender_chat,i.bot,m.sent_at,m.text,m.metadata,${rankingCounter("m", "views")} AS views,${rankingCounter("m", "comments")} AS comments,m.id IN (SELECT id FROM selected) AS selected ${joined3} WHERE ${where} ORDER BY m.id`).all(...bound4);
27546
27875
  const nodes = raw.map((row2) => {
27547
27876
  let metadata3 = {};
27548
27877
  try {
@@ -27693,7 +28022,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
27693
28022
  return result;
27694
28023
  }), "adminStatisticsQuery");
27695
28024
 
27696
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
28025
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
27697
28026
  var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
27698
28027
  if (!execution.accounts.length)
27699
28028
  return { conversations: [], chats: [] };
@@ -27711,7 +28040,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
27711
28040
  return { conversations: conversations2, chats: chats2 };
27712
28041
  }, "conversationEligibility");
27713
28042
 
27714
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
28043
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
27715
28044
  import { createHash as createHash9 } from "node:crypto";
27716
28045
  var EVIDENCE_BYTES = 64 * 1024;
27717
28046
  var FINGERPRINT_BYTES = 8 * 1024 * 1024;
@@ -27861,7 +28190,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
27861
28190
  return result;
27862
28191
  }, "rankingEvidence");
27863
28192
 
27864
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/queries.js
28193
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/queries.js
27865
28194
  var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
27866
28195
  const mailIndexed = /* @__PURE__ */ __name((execution) => {
27867
28196
  if (execution.corpus === "mail")
@@ -27872,6 +28201,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
27872
28201
  matchQuery: /* @__PURE__ */ __name(async (execution) => matchQuery(context, mailIndexed(execution)), "matchQuery"),
27873
28202
  countQuery: /* @__PURE__ */ __name(async (execution, by) => countQuery(context, mailIndexed(execution), by), "countQuery"),
27874
28203
  countMatches: /* @__PURE__ */ __name(async (execution, cap) => countMatches(context, mailIndexed(execution), cap), "countMatches"),
28204
+ matchingPks: /* @__PURE__ */ __name(async (execution, cap) => matchingPks(context, mailIndexed(execution), cap), "matchingPks"),
27875
28205
  conversationEligibility: /* @__PURE__ */ __name(async (execution) => conversationEligibility(context, execution), "conversationEligibility"),
27876
28206
  rankQuery: /* @__PURE__ */ __name(async (execution, request) => rankQuery(context, execution, request), "rankQuery"),
27877
28207
  rankingEvidence: /* @__PURE__ */ __name(async (execution, request) => rankingEvidence(context, execution, request), "rankingEvidence"),
@@ -27879,7 +28209,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
27879
28209
  };
27880
28210
  }, "queriesStoreOver");
27881
28211
 
27882
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
28212
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
27883
28213
  var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
27884
28214
  const { database, now: now2 } = context;
27885
28215
  const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
@@ -27918,10 +28248,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
27918
28248
  }));
27919
28249
  }, "chatEventsOf");
27920
28250
 
27921
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
28251
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
27922
28252
  import { createHash as createHash10 } from "node:crypto";
27923
28253
 
27924
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/calendar.js
28254
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/calendar.js
27925
28255
  var calendarKey = /* @__PURE__ */ __name((zone, by) => {
27926
28256
  const format = new Intl.DateTimeFormat("en-CA", {
27927
28257
  timeZone: zone,
@@ -27936,7 +28266,7 @@ var calendarKey = /* @__PURE__ */ __name((zone, by) => {
27936
28266
  };
27937
28267
  }, "calendarKey");
27938
28268
 
27939
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/retention.js
28269
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/retention.js
27940
28270
  var RETENTION_TOLERANCE = 864e5;
27941
28271
  var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
27942
28272
  const { since, until, cutoff, checkpoints, within, limit, by } = options;
@@ -27990,7 +28320,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
27990
28320
  return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
27991
28321
  }, "retentionCohorts");
27992
28322
 
27993
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
28323
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
27994
28324
  var iso6 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
27995
28325
  var week = /* @__PURE__ */ __name((day) => {
27996
28326
  const date3 = /* @__PURE__ */ new Date(`${day}T00:00:00Z`);
@@ -28126,7 +28456,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
28126
28456
  };
28127
28457
  }, "retentionQuery");
28128
28458
 
28129
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
28459
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
28130
28460
  var iso7 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
28131
28461
  var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
28132
28462
  ...isBot === void 0 ? {} : { bot: isBot },
@@ -28257,7 +28587,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
28257
28587
  lastCount: memberCountsOf(context, pk).at(-1) ?? null
28258
28588
  })), "trackedChats");
28259
28589
 
28260
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/roster.js
28590
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/roster.js
28261
28591
  var rosterStoreOver = /* @__PURE__ */ __name((context) => {
28262
28592
  const { database } = context;
28263
28593
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
@@ -28313,7 +28643,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
28313
28643
  };
28314
28644
  }, "rosterStoreOver");
28315
28645
 
28316
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
28646
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
28317
28647
  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");
28318
28648
  var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
28319
28649
  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 ?`);
@@ -28337,7 +28667,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
28337
28667
  }
28338
28668
  }, "backfillNormalized");
28339
28669
 
28340
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
28670
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
28341
28671
  var INDEX2 = "message_words";
28342
28672
  var searchIndexState2 = /* @__PURE__ */ __name((database) => {
28343
28673
  const row2 = indexRow(database, INDEX2);
@@ -28464,7 +28794,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
28464
28794
  });
28465
28795
  }, "resetSearchIndex");
28466
28796
 
28467
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
28797
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
28468
28798
  var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
28469
28799
  const filled2 = { stemmed: 0, drained: 0 };
28470
28800
  const before2 = stemsState(database);
@@ -28559,7 +28889,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
28559
28889
  return resetStems(database, { now: now2 });
28560
28890
  }, "followDefaultStemmers");
28561
28891
 
28562
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
28892
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
28563
28893
  var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
28564
28894
  var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
28565
28895
  const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
@@ -28581,7 +28911,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
28581
28911
  });
28582
28912
  }, "termCandidates");
28583
28913
 
28584
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/search-index.js
28914
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/search-index.js
28585
28915
  var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
28586
28916
  const { database } = context;
28587
28917
  const stemmerFor2 = stemmerCache();
@@ -28603,7 +28933,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
28603
28933
  };
28604
28934
  }, "searchIndexStoreOver");
28605
28935
 
28606
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
28936
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
28607
28937
  var HISTORY_KEPT = 1e3;
28608
28938
  var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
28609
28939
  var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
@@ -28672,7 +29002,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
28672
29002
  return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
28673
29003
  }, "clearHistory");
28674
29004
 
28675
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/searches.js
29005
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/searches.js
28676
29006
  var searchesStoreOver = /* @__PURE__ */ __name((context) => {
28677
29007
  const { database } = context;
28678
29008
  return {
@@ -28696,7 +29026,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
28696
29026
  };
28697
29027
  }, "searchesStoreOver");
28698
29028
 
28699
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
29029
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
28700
29030
  var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
28701
29031
  var ACTION_OUTCOMES = ["ok", "refused", "failed"];
28702
29032
  var CODE = /^[a-z][a-z0-9_]{0,63}$/;
@@ -28739,7 +29069,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
28739
29069
  };
28740
29070
  }, "agentActionsStoreOver");
28741
29071
 
28742
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
29072
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
28743
29073
  var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
28744
29074
  }) => {
28745
29075
  const { database, now: now2 } = context;
@@ -28798,7 +29128,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
28798
29128
  };
28799
29129
  }, "botUpdateStoreOver");
28800
29130
 
28801
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
29131
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
28802
29132
  var DAY4 = 864e5;
28803
29133
  var listEvents = /* @__PURE__ */ __name((database, filter) => {
28804
29134
  const clauses = ["e.deleted_at IS NULL"];
@@ -28817,6 +29147,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
28817
29147
  }, "dated");
28818
29148
  dated("end_date > ?", filter.fromDate, "coalesce(e.ends_at, e.starts_at + 1) > ?", filter.from);
28819
29149
  dated("start_date < ?", filter.toDate, "e.starts_at < ?", filter.to);
29150
+ dated("start_date >= ?", filter.startsFromDate, "e.starts_at >= ?", filter.startsFrom);
28820
29151
  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");
28821
29152
  if (filter.from !== void 0) {
28822
29153
  clauses.push("e.starts_at >= ?");
@@ -28826,6 +29157,10 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
28826
29157
  clauses.push("e.starts_at < ?");
28827
29158
  params.push(filter.to + DAY4);
28828
29159
  }
29160
+ if (filter.startsFrom !== void 0 && filter.startsFromDate !== void 0) {
29161
+ clauses.push("e.starts_at >= ?");
29162
+ params.push(filter.startsFrom - DAY4);
29163
+ }
28829
29164
  if (filter.calendarId !== void 0) {
28830
29165
  clauses.push(entries("ce.calendar_id = ?"));
28831
29166
  params.push(filter.calendarId);
@@ -28878,7 +29213,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
28878
29213
  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);
28879
29214
  }, "listEvents");
28880
29215
 
28881
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
29216
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
28882
29217
  var calendarOf = /* @__PURE__ */ __name((row2) => ({
28883
29218
  id: Number(row2.id),
28884
29219
  accountId: Number(row2.account_id),
@@ -29458,7 +29793,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
29458
29793
  };
29459
29794
  }, "eventStoreOver");
29460
29795
 
29461
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
29796
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
29462
29797
  var CATALOG_QUERY = defineQuery({
29463
29798
  entity: "document",
29464
29799
  backend: "sql",
@@ -29700,7 +30035,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
29700
30035
  };
29701
30036
  }, "catalogStoreOver");
29702
30037
 
29703
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/context/evidence.js
30038
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/context/evidence.js
29704
30039
  import { createHash as createHash11 } from "node:crypto";
29705
30040
  var CONTEXT_MAX_READ_BYTES = 262144;
29706
30041
  var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
@@ -29798,7 +30133,7 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
29798
30133
  return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
29799
30134
  }, "contextEvidenceRequest");
29800
30135
 
29801
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
30136
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
29802
30137
  var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
29803
30138
  var field2 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
29804
30139
  CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
@@ -29811,7 +30146,7 @@ var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
29811
30146
  THEN 'source-modified' ELSE 'stored-update' END`;
29812
30147
  var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field2("sourceUrl")})`;
29813
30148
 
29814
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
30149
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
29815
30150
  var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
29816
30151
  const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
29817
30152
  signal?.throwIfAborted();
@@ -29910,7 +30245,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
29910
30245
  });
29911
30246
  }, "readMeetingContextEvidence");
29912
30247
 
29913
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
30248
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
29914
30249
  var corpora = {
29915
30250
  message: {
29916
30251
  table: "messages",
@@ -30139,7 +30474,7 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
30139
30474
  }
30140
30475
  }), "contextRecordsOver");
30141
30476
 
30142
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
30477
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
30143
30478
  var NOTE_FIELDS = [
30144
30479
  "text",
30145
30480
  "exact",
@@ -30157,10 +30492,10 @@ var NOTE_FIELDS = [
30157
30492
  ];
30158
30493
  var quoted2 = /* @__PURE__ */ __name((value) => `"${value.replaceAll('"', '""')}"`, "quoted");
30159
30494
  var bound3 = /* @__PURE__ */ __name((sql2, ...params) => ({ sql: sql2, params, exact: true }), "bound");
30160
- var combine2 = /* @__PURE__ */ __name((parts, operator) => ({
30161
- sql: parts.length ? `(${parts.map(({ sql: sql2 }) => sql2).join(` ${operator} `)})` : operator === "AND" ? "1" : "0",
30162
- params: parts.flatMap(({ params }) => params),
30163
- exact: parts.every(({ exact }) => exact)
30495
+ var combine2 = /* @__PURE__ */ __name((parts2, operator) => ({
30496
+ sql: parts2.length ? `(${parts2.map(({ sql: sql2 }) => sql2).join(` ${operator} `)})` : operator === "AND" ? "1" : "0",
30497
+ params: parts2.flatMap(({ params }) => params),
30498
+ exact: parts2.every(({ exact }) => exact)
30164
30499
  }), "combine");
30165
30500
  var CORPORA2 = [
30166
30501
  {
@@ -30339,22 +30674,22 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
30339
30674
  fragments.set(node, wrapped);
30340
30675
  return wrapped;
30341
30676
  }
30342
- const parts = node.clauses.map(({ occur, node: node2 }) => ({ occur, part: compile2(node2) }));
30343
- const must = parts.filter(({ occur }) => occur === "must").map(({ part }) => part);
30344
- const should = parts.filter(({ occur }) => occur === "should").map(({ part }) => part);
30345
- const not = parts.filter(({ occur }) => occur === "must_not").map(({ part }) => part.exact ? { ...part, sql: `NOT coalesce(${part.sql},0)` } : { sql: "1", params: [], exact: false });
30677
+ const parts2 = node.clauses.map(({ occur, node: node2 }) => ({ occur, part: compile2(node2) }));
30678
+ const must = parts2.filter(({ occur }) => occur === "must").map(({ part }) => part);
30679
+ const should = parts2.filter(({ occur }) => occur === "should").map(({ part }) => part);
30680
+ const not = parts2.filter(({ occur }) => occur === "must_not").map(({ part }) => part.exact ? { ...part, sql: `NOT coalesce(${part.sql},0)` } : { sql: "1", params: [], exact: false });
30346
30681
  return combine2([must.length ? combine2(must, "AND") : combine2(should, "OR"), ...not], "AND");
30347
30682
  }, "compile");
30348
30683
  const required3 = /* @__PURE__ */ __name((node, index2) => {
30349
30684
  if (node.kind === "predicate")
30350
30685
  return fragments.get(node)?.[index2];
30351
30686
  const must = node.clauses.filter(({ occur }) => occur === "must");
30352
- const parts = (must.length ? must : node.clauses.filter(({ occur }) => occur === "should")).map(({ node: node2 }) => required3(node2, index2));
30687
+ const parts2 = (must.length ? must : node.clauses.filter(({ occur }) => occur === "should")).map(({ node: node2 }) => required3(node2, index2));
30353
30688
  if (must.length) {
30354
- const known2 = parts.filter((part) => part !== void 0);
30689
+ const known2 = parts2.filter((part) => part !== void 0);
30355
30690
  return known2.length ? known2.map((part) => `(${part})`).join(" AND ") : void 0;
30356
30691
  }
30357
- return parts.length && parts.every((part) => part !== void 0) ? parts.map((part) => `(${part})`).join(" OR ") : void 0;
30692
+ return parts2.length && parts2.every((part) => part !== void 0) ? parts2.map((part) => `(${part})`).join(" OR ") : void 0;
30358
30693
  }, "required");
30359
30694
  return read(database, () => {
30360
30695
  check3();
@@ -30569,7 +30904,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
30569
30904
  };
30570
30905
  }, "noteSearchOver");
30571
30906
 
30572
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
30907
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
30573
30908
  var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
30574
30909
  var inEventAccounts = /* @__PURE__ */ __name((event) => searchableCopy(event, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
30575
30910
  var EVENT_CORPUS = {
@@ -30701,7 +31036,7 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
30701
31036
  };
30702
31037
  }, "eventSearchOver");
30703
31038
 
30704
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
31039
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
30705
31040
  var EVIDENCE_FINDINGS_KIND = "evidence_findings";
30706
31041
  var reference = /* @__PURE__ */ __name((raw) => {
30707
31042
  if (/^document:[1-9]\d*$/.test(raw))
@@ -30714,7 +31049,7 @@ var reference = /* @__PURE__ */ __name((raw) => {
30714
31049
  }, "reference");
30715
31050
  var validateEvidenceFindings = /* @__PURE__ */ __name((input) => validateFindings(input, { plural: "evidence findings", singular: "evidence finding", cited: "reference", reference }), "validateEvidenceFindings");
30716
31051
 
30717
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/moment.js
31052
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/domain/moment.js
30718
31053
  var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
30719
31054
  try {
30720
31055
  return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
@@ -30726,7 +31061,7 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
30726
31061
  }
30727
31062
  }, "calendarMoment");
30728
31063
 
30729
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
31064
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
30730
31065
  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";
30731
31066
  var iso8 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
30732
31067
  var oneOf4 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -30794,7 +31129,7 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
30794
31129
  const owner = input.by === "owner";
30795
31130
  const { actor, model } = authorActor(context, input.by);
30796
31131
  const at = now2();
30797
- 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);
31132
+ 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);
30798
31133
  linkEvidence(context, { type: "fact", id: made }, input.evidence ?? [], owner ? "owner" : "agent");
30799
31134
  if (input.createdFrom !== void 0) {
30800
31135
  const from2 = requiredThing(database, input.createdFrom, "the source");
@@ -30838,6 +31173,9 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
30838
31173
  const id2 = Number(row2.id);
30839
31174
  const twin = row2.source === "memory" && row2.metadata != null ? migratedFrom(String(row2.metadata)) : void 0;
30840
31175
  const links2 = erase(database, () => {
31176
+ keepHighestId(database, "facts", now2());
31177
+ if (twin !== void 0)
31178
+ keepHighestId(database, "memories", now2());
30841
31179
  database.prepare("UPDATE facts SET supersedes_id = NULL WHERE supersedes_id = ?").run(id2);
30842
31180
  const count = dropLinksOf(database, { type: "fact", id: id2 });
30843
31181
  database.prepare("DELETE FROM links WHERE from_type = 'fact' AND from_id = ?").run(id2);
@@ -30874,13 +31212,13 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
30874
31212
  };
30875
31213
  }, "factsStoreOver");
30876
31214
 
30877
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
30878
- var invalid2 = /* @__PURE__ */ __name((message2) => {
31215
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
31216
+ var invalid4 = /* @__PURE__ */ __name((message2) => {
30879
31217
  throw new CliError("validation_error", message2);
30880
31218
  }, "invalid");
30881
31219
  var findingsAgent = /* @__PURE__ */ __name((agent) => {
30882
31220
  if (!agent || typeof agent.bot !== "string" || !agent.bot.trim() || agent.bot.length > 200 || agent.bot === "owner" || agent.model !== void 0 && (typeof agent.model !== "string" || agent.model.length > 200))
30883
- return invalid2("findings must name an agent author independently of their payload");
31221
+ return invalid4("findings must name an agent author independently of their payload");
30884
31222
  return { bot: agent.bot, ...agent.model === void 0 ? {} : { model: agent.model } };
30885
31223
  }, "findingsAgent");
30886
31224
  var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
@@ -30892,7 +31230,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
30892
31230
  for (const finding of input.findings) {
30893
31231
  const project = requiredThing(database, finding.project, "the project");
30894
31232
  if (project.type !== "project")
30895
- return invalid2("a finding needs an owner project");
31233
+ return invalid4("a finding needs an owner project");
30896
31234
  const projectRow = database.prepare("SELECT id,key,name,description,type,scope,updated_at FROM projects WHERE id=? AND account_id IS NULL AND deleted_at IS NULL").get(project.id);
30897
31235
  if (!projectRow)
30898
31236
  throw new CliError("not_found", "the owner project is unavailable");
@@ -30900,7 +31238,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
30900
31238
  if (finding.kind === "task" && finding.assignee) {
30901
31239
  const person2 = requiredThing(database, finding.assignee, "the assignee");
30902
31240
  if (person2.type !== "person")
30903
- return invalid2("the assignee must be a stored person");
31241
+ return invalid4("the assignee must be a stored person");
30904
31242
  const personRow = database.prepare("SELECT id,name,updated_at FROM persons WHERE id=?").get(person2.id);
30905
31243
  if (!personRow)
30906
31244
  throw new CliError("not_found", "the assignee is unavailable");
@@ -30949,7 +31287,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
30949
31287
  const prior = previous(account, fingerprint2);
30950
31288
  if (prior) {
30951
31289
  if (accepted.includes(finding.id) && prior.status === "rejected")
30952
- return invalid2("this unchanged finding was already rejected; changed evidence needs a new candidate");
31290
+ return invalid4("this unchanged finding was already rejected; changed evidence needs a new candidate");
30953
31291
  return { ...prior, id: finding.id, reused: true };
30954
31292
  }
30955
31293
  const status = accepted.includes(finding.id) ? "accepted" : "rejected";
@@ -30964,7 +31302,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
30964
31302
  return { snapshot: snapshot2, snapshotParts, previous, outcomes };
30965
31303
  }, "findingsCoreOver");
30966
31304
 
30967
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
31305
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
30968
31306
  var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
30969
31307
  var PROPOSAL_VERDICTS = ["useful", "not_useful"];
30970
31308
  var iso9 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
@@ -31110,13 +31448,13 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
31110
31448
  };
31111
31449
  }, "proposedActionsStoreOver");
31112
31450
 
31113
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
31451
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
31114
31452
  var stale = /* @__PURE__ */ __name(() => {
31115
31453
  throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
31116
31454
  reason: "evidence-findings.stale"
31117
31455
  });
31118
31456
  }, "stale");
31119
- var invalid3 = /* @__PURE__ */ __name((message2) => {
31457
+ var invalid5 = /* @__PURE__ */ __name((message2) => {
31120
31458
  throw new CliError("validation_error", message2);
31121
31459
  }, "invalid");
31122
31460
  var TEXT_BUDGET = 262144;
@@ -31126,18 +31464,18 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31126
31464
  const core = findingsCoreOver(context, EVIDENCE_FINDINGS_KIND);
31127
31465
  const load = /* @__PURE__ */ __name((id2) => {
31128
31466
  if (typeof id2 !== "string" || !/^[1-9]\d*$/.test(id2) || !Number.isSafeInteger(Number(id2)))
31129
- return invalid3("a findings batch needs a stored ID");
31467
+ return invalid5("a findings batch needs a stored ID");
31130
31468
  const row2 = database.prepare("SELECT length(CAST(payload AS BLOB)) AS bytes,length(CAST(result AS BLOB)) AS result_bytes FROM proposed_actions WHERE id=? AND account_id IS NULL AND kind=?").get(Number(id2), EVIDENCE_FINDINGS_KIND);
31131
31469
  if (!row2)
31132
31470
  throw new CliError("not_found", "the evidence findings batch is unavailable");
31133
31471
  if (Number(row2.bytes) > 1e5 || Number(row2.result_bytes) > 65536)
31134
- return invalid3("stored findings exceed the read budget");
31472
+ return invalid5("stored findings exceed the read budget");
31135
31473
  return proposals.get(id2);
31136
31474
  }, "load");
31137
31475
  const view = /* @__PURE__ */ __name((proposal) => {
31138
31476
  const input = proposal.payload;
31139
31477
  if (!input || !proposal.target || !["proposed", "approved"].includes(proposal.status))
31140
- return invalid3("invalid stored findings batch");
31478
+ return invalid5("invalid stored findings batch");
31141
31479
  return {
31142
31480
  id: proposal.id,
31143
31481
  project: proposal.target,
@@ -31167,7 +31505,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31167
31505
  return stale();
31168
31506
  readBytes += Buffer.byteLength(record4.text) + Buffer.byteLength(record4.title ?? "");
31169
31507
  if (readBytes > TEXT_BUDGET)
31170
- return invalid3(`finding evidence exceeds the ${TEXT_BUDGET}-byte stored text budget`);
31508
+ return invalid5(`finding evidence exceeds the ${TEXT_BUDGET}-byte stored text budget`);
31171
31509
  const fingerprint2 = contextEvidenceFingerprint(record4);
31172
31510
  if (fingerprint2 !== evidence.fingerprint)
31173
31511
  return stale();
@@ -31184,7 +31522,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31184
31522
  ...raw.model === void 0 ? {} : { model: raw.model }
31185
31523
  });
31186
31524
  if (typeof raw.reason !== "string" || !raw.reason.trim() || raw.reason.length > 2e3)
31187
- return invalid3("an agent deciding for the owner gives a reason of 1\u20132000 characters");
31525
+ return invalid5("an agent deciding for the owner gives a reason of 1\u20132000 characters");
31188
31526
  return {
31189
31527
  author: agent,
31190
31528
  decision: { by: "agent", bot: agent.bot, model: agent.model ?? null, reason: raw.reason.trim() }
@@ -31195,7 +31533,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31195
31533
  const input = validateEvidenceFindings(raw);
31196
31534
  const projects2 = new Set(input.findings.map((finding) => finding.project));
31197
31535
  if (projects2.size !== 1)
31198
- return invalid3("an evidence findings batch is about one project");
31536
+ return invalid5("an evidence findings batch is about one project");
31199
31537
  const by = findingsAgent(rawAgent);
31200
31538
  return write(database, () => {
31201
31539
  const { actor } = authorActor(context, by);
@@ -31204,14 +31542,14 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31204
31542
  if (held) {
31205
31543
  const proposal = load(String(held.id));
31206
31544
  if (proposal.payload.inputHash !== inputHash)
31207
- return invalid3("the findings batch key was already used for different input");
31545
+ return invalid5("the findings batch key was already used for different input");
31208
31546
  return view(proposal);
31209
31547
  }
31210
31548
  const snapshotHash = snapshot2(input);
31211
31549
  const snapshotParts = core.snapshotParts(input, cite());
31212
31550
  const fingerprints = input.findings.map(findingFingerprint);
31213
31551
  if (new Set(fingerprints).size !== fingerprints.length)
31214
- return invalid3("the batch contains duplicate findings");
31552
+ return invalid5("the batch contains duplicate findings");
31215
31553
  return view(proposals.propose({
31216
31554
  kind: EVIDENCE_FINDINGS_KIND,
31217
31555
  by,
@@ -31223,12 +31561,12 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31223
31561
  get: /* @__PURE__ */ __name(async (id2) => view(load(id2)), "get"),
31224
31562
  list: /* @__PURE__ */ __name(async ({ project, limit = 20, offset = 0, status } = {}) => {
31225
31563
  if (status !== void 0 && status !== "proposed" && status !== "reviewed")
31226
- return invalid3("finding status is proposed or reviewed");
31564
+ return invalid5("finding status is proposed or reviewed");
31227
31565
  if (!Number.isSafeInteger(limit) || limit < 1 || limit > 50 || !Number.isSafeInteger(offset) || offset < 0)
31228
- return invalid3("findings lists take 1\u201350 items and a nonnegative offset");
31566
+ return invalid5("findings lists take 1\u201350 items and a nonnegative offset");
31229
31567
  const projectId = project === void 0 ? null : /^project:([1-9]\d*)$/.exec(project)?.[1];
31230
31568
  if (projectId === void 0)
31231
- return invalid3("a findings list filters by a project reference");
31569
+ return invalid5("a findings list filters by a project reference");
31232
31570
  const ids = database.prepare("SELECT id FROM proposed_actions WHERE account_id IS NULL AND kind=? AND (? IS NULL OR (target_type='project' AND target_id=?)) AND (? IS NULL OR status=?) ORDER BY id DESC LIMIT ? OFFSET ?").all(EVIDENCE_FINDINGS_KIND, projectId, projectId === null ? null : Number(projectId), status ?? null, status === "reviewed" ? "approved" : status ?? null, limit + 1, offset);
31233
31571
  return { items: ids.slice(0, limit).map((row2) => view(load(String(row2.id)))), hasMore: ids.length > limit };
31234
31572
  }, "list"),
@@ -31238,29 +31576,29 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31238
31576
  if (!decision || typeof decision.fingerprint !== "string" || decision.fingerprint !== batch.fingerprint)
31239
31577
  return stale();
31240
31578
  if (!Array.isArray(decision.accept) || decision.accept.length > 16 || new Set(decision.accept).size !== decision.accept.length || decision.accept.some((candidate) => !batch.input.findings.some((finding) => finding.id === candidate)))
31241
- return invalid3("accept only unique IDs shown in this batch");
31579
+ return invalid5("accept only unique IDs shown in this batch");
31242
31580
  const accepted = [...decision.accept].sort();
31243
31581
  const { author, decision: decidedBy } = decider(decision.by);
31244
31582
  if (batch.receipt) {
31245
31583
  if (JSON.stringify(batch.receipt.accepted) !== JSON.stringify(accepted))
31246
- return invalid3("this findings batch was already reviewed with a different decision");
31584
+ return invalid5("this findings batch was already reviewed with a different decision");
31247
31585
  return batch;
31248
31586
  }
31249
31587
  const input = proposal.payload;
31250
31588
  if (accepted.length) {
31251
- const parts = input.snapshotParts;
31252
- if (!parts) {
31589
+ const parts2 = input.snapshotParts;
31590
+ if (!parts2) {
31253
31591
  if (snapshot2(batch.input) !== input.snapshotHash)
31254
31592
  return stale();
31255
31593
  } else {
31256
31594
  const chosen = { ...batch.input, findings: batch.input.findings.filter((f) => accepted.includes(f.id)) };
31257
31595
  const now2 = core.snapshotParts(chosen, cite());
31258
- if (Object.entries(now2).some(([key2, hash2]) => parts[key2] !== hash2))
31596
+ if (Object.entries(now2).some(([key2, hash2]) => parts2[key2] !== hash2))
31259
31597
  return stale();
31260
31598
  }
31261
31599
  }
31262
31600
  if (proposal.proposedBy.type !== "bot" || !proposal.proposedBy.name)
31263
- return invalid3("a findings author must be an agent");
31601
+ return invalid5("a findings author must be an agent");
31264
31602
  const agent = {
31265
31603
  bot: proposal.proposedBy.name,
31266
31604
  ...input.agentModel === null ? {} : { model: input.agentModel }
@@ -31276,7 +31614,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31276
31614
  };
31277
31615
  }, "evidenceFindingsStoreOver");
31278
31616
 
31279
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
31617
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
31280
31618
  var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
31281
31619
  var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
31282
31620
  rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
@@ -31329,7 +31667,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
31329
31667
  }, "forPerson")
31330
31668
  }), "involvementStoreOver");
31331
31669
 
31332
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
31670
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
31333
31671
  import { createHash as createHash12 } from "node:crypto";
31334
31672
  var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
31335
31673
  var id = /* @__PURE__ */ __name((value) => {
@@ -31415,16 +31753,16 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
31415
31753
  };
31416
31754
  }, "meetingProjectsStoreOver");
31417
31755
 
31418
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/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.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
31419
31757
  import { createHash as createHash15 } from "node:crypto";
31420
31758
 
31421
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
31759
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
31422
31760
  import { createHash as createHash14 } from "node:crypto";
31423
31761
 
31424
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
31762
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
31425
31763
  import { createHash as createHash13 } from "node:crypto";
31426
31764
 
31427
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
31765
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
31428
31766
  var consolidationId = /* @__PURE__ */ __name((value, field3) => {
31429
31767
  if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
31430
31768
  throw new CliError("validation_error", `${field3} must be a positive canonical tag id`);
@@ -31475,7 +31813,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
31475
31813
  return input;
31476
31814
  }, "consolidationApplyInput");
31477
31815
 
31478
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
31816
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
31479
31817
  var receiptOf = /* @__PURE__ */ __name((row2) => ({
31480
31818
  id: String(row2.id),
31481
31819
  sourceId: String(row2.source_id),
@@ -31550,7 +31888,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
31550
31888
  }, { beforeCommit: check3 });
31551
31889
  }, "applyTagConsolidation");
31552
31890
 
31553
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
31891
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
31554
31892
  var selections = [
31555
31893
  ["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
31556
31894
  ["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
@@ -31694,7 +32032,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
31694
32032
  };
31695
32033
  }, "previewRows");
31696
32034
 
31697
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
32035
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
31698
32036
  var kinds = ["project", "tag", "topic"];
31699
32037
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
31700
32038
  if (signal?.aborted)
@@ -31808,16 +32146,16 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
31808
32146
  const expected = options.expectedFingerprint;
31809
32147
  if (expected !== void 0 && typeof expected !== "string")
31810
32148
  throw new CliError("validation_error", "invalid vocabulary preview fingerprint");
31811
- const parts = expected?.match(/^v1:(all|project|tag|topic):(all|personal|work):[a-f0-9]{64}$/);
31812
- if (expected !== void 0 && !parts)
32149
+ const parts2 = expected?.match(/^v1:(all|project|tag|topic):(all|personal|work):[a-f0-9]{64}$/);
32150
+ if (expected !== void 0 && !parts2)
31813
32151
  throw new CliError("validation_error", "invalid vocabulary preview fingerprint");
31814
32152
  const current = catalog({
31815
- ...parts?.[1] && parts[1] !== "all" ? { kind: parts[1] } : {},
31816
- ...parts?.[2] && parts[2] !== "all" ? { scope: parts[2] } : {}
32153
+ ...parts2?.[1] && parts2[1] !== "all" ? { kind: parts2[1] } : {},
32154
+ ...parts2?.[2] && parts2[2] !== "all" ? { scope: parts2[2] } : {}
31817
32155
  });
31818
32156
  if (expected !== void 0 && expected !== current.fingerprint)
31819
32157
  throw new CliError("configuration_error", "vocabulary changed since the preview", { reason: "vocabulary.stale" });
31820
- return parts && (parts[1] !== "all" || parts[2] !== "all") ? catalog() : current;
32158
+ return parts2 && (parts2[1] !== "all" || parts2[2] !== "all") ? catalog() : current;
31821
32159
  }, "writable");
31822
32160
  const targetEntry = /* @__PURE__ */ __name((current, target) => {
31823
32161
  if (!target || typeof target !== "object")
@@ -31958,7 +32296,7 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
31958
32296
  };
31959
32297
  }, "vocabularyStoreOver");
31960
32298
 
31961
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
32299
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
31962
32300
  var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
31963
32301
  var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
31964
32302
  var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
@@ -32480,7 +32818,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
32480
32818
  return key2.padEnd(3, "X");
32481
32819
  }, "projectKey");
32482
32820
 
32483
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
32821
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
32484
32822
  var DAY5 = 864e5;
32485
32823
  var SETTING4 = "logs_pruned_at";
32486
32824
  var LOG_RETENTION = { agentActionsMs: 90 * DAY5, botUpdatePayloadsMs: 30 * DAY5 };
@@ -32507,13 +32845,13 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
32507
32845
  };
32508
32846
  }, "logPruner");
32509
32847
 
32510
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
32848
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
32511
32849
  var stale2 = /* @__PURE__ */ __name(() => {
32512
32850
  throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
32513
32851
  reason: "meeting-findings.stale"
32514
32852
  });
32515
32853
  }, "stale");
32516
- var invalid4 = /* @__PURE__ */ __name((message2) => {
32854
+ var invalid6 = /* @__PURE__ */ __name((message2) => {
32517
32855
  throw new CliError("validation_error", message2);
32518
32856
  }, "invalid");
32519
32857
  var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
@@ -32521,7 +32859,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
32521
32859
  const proposals = proposalOperationsOver(context);
32522
32860
  const accountId = /* @__PURE__ */ __name((key2) => {
32523
32861
  if (!key2 || typeof key2.provider !== "string" || !key2.provider.trim() || typeof key2.account !== "string" || !key2.account.trim())
32524
- return invalid4("choose a meeting provider and account");
32862
+ return invalid6("choose a meeting provider and account");
32525
32863
  const row2 = database.prepare("SELECT id,scope FROM accounts WHERE provider=? AND external_id=?").get(key2.provider, key2.account);
32526
32864
  if (!row2 || key2.scope !== void 0 && row2.scope !== key2.scope)
32527
32865
  throw new CliError("not_found", "the meeting account is unavailable");
@@ -32529,18 +32867,18 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
32529
32867
  }, "accountId");
32530
32868
  const load = /* @__PURE__ */ __name((account, id2) => {
32531
32869
  if (typeof id2 !== "string" || !/^[1-9]\d*$/.test(id2) || !Number.isSafeInteger(Number(id2)))
32532
- return invalid4("a findings batch needs a stored ID");
32870
+ return invalid6("a findings batch needs a stored ID");
32533
32871
  const row2 = database.prepare("SELECT length(CAST(payload AS BLOB)) AS bytes,length(CAST(result AS BLOB)) AS result_bytes FROM proposed_actions WHERE id=? AND account_id=? AND kind=?").get(Number(id2), account, MEETING_FINDINGS_KIND);
32534
32872
  if (!row2)
32535
32873
  throw new CliError("not_found", "the findings batch is unavailable for this account");
32536
32874
  if (Number(row2.bytes) > 1e5 || Number(row2.result_bytes) > 65536)
32537
- return invalid4("stored findings exceed the read budget");
32875
+ return invalid6("stored findings exceed the read budget");
32538
32876
  return proposals.get(id2);
32539
32877
  }, "load");
32540
32878
  const view = /* @__PURE__ */ __name((proposal) => {
32541
32879
  const input = proposal.payload;
32542
32880
  if (!input || !proposal.account || !["proposed", "approved"].includes(proposal.status))
32543
- return invalid4("invalid stored findings batch");
32881
+ return invalid6("invalid stored findings batch");
32544
32882
  return {
32545
32883
  id: proposal.id,
32546
32884
  account: proposal.account,
@@ -32566,7 +32904,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
32566
32904
  throw new CliError("not_found", "the cited cue belongs to another account");
32567
32905
  const membership = database.prepare("SELECT id,updated_at,confirmed,source FROM links WHERE from_type='meeting' AND from_id=? AND to_type='project' AND to_id=? AND kind='member-of' AND anchor IS NULL AND confirmed=1").get(parsed2.meetingId, projectId);
32568
32906
  if (!membership)
32569
- return invalid4("each cited meeting needs confirmed membership in the finding's project");
32907
+ return invalid6("each cited meeting needs confirmed membership in the finding's project");
32570
32908
  seen.set(`${finding.project}/${parsed2.meetingId}`, membership);
32571
32909
  if (seen.has(evidence.reference)) {
32572
32910
  if (seen.get(evidence.reference) !== evidence.fingerprint)
@@ -32580,7 +32918,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
32580
32918
  return stale2();
32581
32919
  readBytes += Number(budget.bytes);
32582
32920
  if (!Number.isSafeInteger(readBytes) || readBytes > 65536)
32583
- return invalid4("finding evidence exceeds the 65536-byte stored text budget");
32921
+ return invalid6("finding evidence exceeds the 65536-byte stored text budget");
32584
32922
  const row2 = database.prepare(`SELECT t.content_hash,r.start_ms,r.end_ms,r.speaker_participant_id,r.speaker_name,r.text ${query}`).get(...params);
32585
32923
  if (!row2)
32586
32924
  return stale2();
@@ -32605,7 +32943,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
32605
32943
  stage: /* @__PURE__ */ __name(async (key2, raw, agent) => {
32606
32944
  const input = validateMeetingFindings(raw);
32607
32945
  if (!agent || typeof agent.bot !== "string" || !agent.bot.trim() || agent.bot.length > 200 || agent.bot === "owner" || agent.model !== void 0 && (typeof agent.model !== "string" || agent.model.length > 200))
32608
- return invalid4("findings must name an agent author independently of their payload");
32946
+ return invalid6("findings must name an agent author independently of their payload");
32609
32947
  const by = { bot: agent.bot, ...agent.model === void 0 ? {} : { model: agent.model } };
32610
32948
  return write(database, () => {
32611
32949
  const account = accountId(key2);
@@ -32615,13 +32953,13 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
32615
32953
  if (held) {
32616
32954
  const proposal = load(account, String(held.id));
32617
32955
  if (proposal.payload.inputHash !== inputHash)
32618
- return invalid4("the findings batch key was already used for different input");
32956
+ return invalid6("the findings batch key was already used for different input");
32619
32957
  return view(proposal);
32620
32958
  }
32621
32959
  const snapshotHash = snapshot2(account, input);
32622
32960
  const fingerprints = input.findings.map(meetingFindingFingerprint);
32623
32961
  if (new Set(fingerprints).size !== fingerprints.length)
32624
- return invalid4("the batch contains duplicate findings");
32962
+ return invalid6("the batch contains duplicate findings");
32625
32963
  return view(proposals.propose({
32626
32964
  kind: MEETING_FINDINGS_KIND,
32627
32965
  by,
@@ -32633,9 +32971,9 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
32633
32971
  get: /* @__PURE__ */ __name(async (key2, id2) => view(load(accountId(key2), id2)), "get"),
32634
32972
  list: /* @__PURE__ */ __name(async (key2, { limit = 20, offset = 0, status } = {}) => {
32635
32973
  if (status !== void 0 && status !== "proposed" && status !== "reviewed")
32636
- return invalid4("finding status is proposed or reviewed");
32974
+ return invalid6("finding status is proposed or reviewed");
32637
32975
  if (!Number.isSafeInteger(limit) || limit < 1 || limit > 50 || !Number.isSafeInteger(offset) || offset < 0)
32638
- return invalid4("findings lists take 1\u201350 items and a nonnegative offset");
32976
+ return invalid6("findings lists take 1\u201350 items and a nonnegative offset");
32639
32977
  const account = accountId(key2);
32640
32978
  const ids = database.prepare("SELECT id FROM proposed_actions WHERE account_id=? AND kind=? AND (? IS NULL OR status=?) ORDER BY id DESC LIMIT ? OFFSET ?").all(account, MEETING_FINDINGS_KIND, status ?? null, status === "reviewed" ? "approved" : status ?? null, limit + 1, offset);
32641
32979
  return {
@@ -32650,18 +32988,18 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
32650
32988
  if (!decision || typeof decision.fingerprint !== "string" || decision.fingerprint !== batch.fingerprint)
32651
32989
  return stale2();
32652
32990
  if (!Array.isArray(decision.accept) || decision.accept.length > 16 || new Set(decision.accept).size !== decision.accept.length || decision.accept.some((candidate) => !batch.input.findings.some((finding) => finding.id === candidate)))
32653
- return invalid4("accept only unique IDs shown in this batch");
32991
+ return invalid6("accept only unique IDs shown in this batch");
32654
32992
  const accepted = [...decision.accept].sort();
32655
32993
  if (batch.receipt) {
32656
32994
  if (JSON.stringify(batch.receipt.accepted) !== JSON.stringify(accepted))
32657
- return invalid4("this findings batch was already reviewed with a different decision");
32995
+ return invalid6("this findings batch was already reviewed with a different decision");
32658
32996
  return batch;
32659
32997
  }
32660
32998
  const input = proposal.payload;
32661
32999
  if (accepted.length && snapshot2(account, batch.input) !== input.snapshotHash)
32662
33000
  return stale2();
32663
33001
  if (proposal.proposedBy.type !== "bot" || !proposal.proposedBy.name)
32664
- return invalid4("a findings author must be an agent");
33002
+ return invalid6("a findings author must be an agent");
32665
33003
  const agent = {
32666
33004
  bot: proposal.proposedBy.name,
32667
33005
  ...input.agentModel === null ? {} : { model: input.agentModel }
@@ -32676,7 +33014,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
32676
33014
  };
32677
33015
  }, "meetingFindingsStoreOver");
32678
33016
 
32679
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
33017
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
32680
33018
  var RANK_BATCH = 512;
32681
33019
  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";
32682
33020
  var limitOf = /* @__PURE__ */ __name((value, name, max = 1e3) => {
@@ -32947,7 +33285,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
32947
33285
  }
32948
33286
  }), "meetingVectorsOver");
32949
33287
 
32950
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
33288
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
32951
33289
  var OTHER_SOURCES = ["document", "note", "email"];
32952
33290
  var TEXTS = {
32953
33291
  document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
@@ -33048,11 +33386,11 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
33048
33386
  };
33049
33387
  }, "sourceMentionStoreOver");
33050
33388
 
33051
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
33389
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
33052
33390
  import { mkdirSync, statSync, writeFileSync } from "node:fs";
33053
33391
  import { dirname } from "node:path";
33054
33392
 
33055
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
33393
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
33056
33394
  import { readFileSync as readFileSync3 } from "node:fs";
33057
33395
  var CLIENTS_SETTING = "clients";
33058
33396
  var coreVersion = (() => {
@@ -33110,7 +33448,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
33110
33448
  return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
33111
33449
  }, "refusalAdvice");
33112
33450
 
33113
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
33451
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
33114
33452
  var GENERATED = [
33115
33453
  {
33116
33454
  "name": "20261010184427_initial",
@@ -33976,7 +34314,7 @@ WHERE json_type(params, '$.selection') = 'object';`
33976
34314
  }
33977
34315
  ];
33978
34316
 
33979
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
34317
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
33980
34318
  var MANIFEST = [
33981
34319
  { name: "20261010184427_initial", version: 1, minCompatible: 1 },
33982
34320
  { name: "20261011035353_version-2-facts", version: 2, minCompatible: 1 },
@@ -34054,7 +34392,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
34054
34392
  return migrations;
34055
34393
  }, "generatedMigrations");
34056
34394
 
34057
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/migrations.js
34395
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/migrations.js
34058
34396
  var MIGRATIONS = generatedMigrations();
34059
34397
  var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
34060
34398
  version INTEGER PRIMARY KEY,
@@ -34107,7 +34445,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
34107
34445
  }
34108
34446
  }, "migrate");
34109
34447
 
34110
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
34448
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
34111
34449
  var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
34112
34450
  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 ?");
34113
34451
  if (pending.get(0, 1) === void 0)
@@ -34129,7 +34467,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
34129
34467
  }
34130
34468
  }, "fillJoinKeys");
34131
34469
 
34132
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
34470
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
34133
34471
  var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
34134
34472
  const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
34135
34473
  try {
@@ -34142,8 +34480,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
34142
34480
  }, "openSqlite");
34143
34481
  var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
34144
34482
  quietSqliteWarning();
34145
- const { drizzle } = await import("./node-ZYWB7IET.js");
34146
- const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-J3OODPYK.js");
34483
+ const { drizzle } = await import("./node-25IJLDBZ.js");
34484
+ const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-DYR4FEI4.js");
34147
34485
  const client = await nodeClient(path, { readOnly });
34148
34486
  try {
34149
34487
  return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
@@ -34153,8 +34491,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
34153
34491
  }
34154
34492
  }, "openUnderNode");
34155
34493
  var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
34156
- const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-RI7DR6RZ.js");
34157
- const { drizzle } = await import("./bun-7SYKSCLA.js");
34494
+ const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-FWBYHIXB.js");
34495
+ const { drizzle } = await import("./bun-DNEFTPTR.js");
34158
34496
  const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
34159
34497
  try {
34160
34498
  return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
@@ -34164,7 +34502,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
34164
34502
  }
34165
34503
  }, "openUnderBun");
34166
34504
 
34167
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
34505
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
34168
34506
  var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
34169
34507
  const ours = MIGRATIONS.at(-1)?.version ?? 0;
34170
34508
  if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
@@ -34179,7 +34517,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
34179
34517
  throw new CliError("configuration_error", `The store requires schema ${minCompatible}, but this tool supports ${ours}; ${refusalAdvice(storeClients(database), command, version)}`);
34180
34518
  }, "assertReadCompatible");
34181
34519
 
34182
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
34520
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
34183
34521
  var BACKFILL_ON_OPEN = 5e3;
34184
34522
  var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
34185
34523
  var createWritable = /* @__PURE__ */ __name((file) => {
@@ -34235,13 +34573,13 @@ var openStoreContext = /* @__PURE__ */ __name(async ({ path, env, now: now2 = Da
34235
34573
  }
34236
34574
  }, "openStoreContext");
34237
34575
 
34238
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
34576
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
34239
34577
  import { createHash as createHash17 } from "node:crypto";
34240
34578
 
34241
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
34579
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
34242
34580
  import { createHash as createHash16 } from "node:crypto";
34243
34581
 
34244
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
34582
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
34245
34583
  var text3 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
34246
34584
  var ref = text3(2048);
34247
34585
  var timestamp2 = pipe(number(), safeInteger(), minValue(0));
@@ -34307,16 +34645,16 @@ var projectAnnotationsSchema = strictObject({
34307
34645
  }))
34308
34646
  });
34309
34647
 
34310
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
34648
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
34311
34649
  var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
34312
- var invalid5 = /* @__PURE__ */ __name((field3) => {
34650
+ var invalid7 = /* @__PURE__ */ __name((field3) => {
34313
34651
  throw new CliError("validation_error", `invalid project annotations.${field3}`);
34314
34652
  }, "invalid");
34315
34653
  var canonical = /* @__PURE__ */ __name((ref3) => {
34316
34654
  try {
34317
34655
  return ref3.startsWith("meeting:") ? canonicalMeetingReference(ref3) : canonicalReference(ref3);
34318
34656
  } catch {
34319
- return invalid5("reference");
34657
+ return invalid7("reference");
34320
34658
  }
34321
34659
  }, "canonical");
34322
34660
  var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, additionalActors = []) => {
@@ -34325,37 +34663,37 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
34325
34663
  const used = /* @__PURE__ */ new Set();
34326
34664
  const kind3 = /* @__PURE__ */ __name((ref3, kinds2) => {
34327
34665
  if (canonical(ref3) !== ref3 || !kinds2.includes(parseReference(ref3).type) || !/^[a-z]+:[1-9]\d*$/.test(ref3))
34328
- invalid5("reference kind");
34666
+ invalid7("reference kind");
34329
34667
  }, "kind");
34330
34668
  kind3(manifest.project.ref, ["project"]);
34331
34669
  for (const fact of manifest.facts) {
34332
34670
  kind3(fact.ref, ["fact"]);
34333
34671
  if (owned.has(fact.ref))
34334
- invalid5("facts.duplicate");
34672
+ invalid7("facts.duplicate");
34335
34673
  owned.add(fact.ref);
34336
34674
  kind3(fact.author, ["person", "bot"]);
34337
34675
  if (fact.confirmed_by !== null)
34338
34676
  kind3(fact.confirmed_by, ["person", "bot"]);
34339
34677
  if (fact.updated_at < fact.created_at)
34340
- invalid5("facts.updated_at");
34678
+ invalid7("facts.updated_at");
34341
34679
  if (fact.type !== "decision" && (fact.supersedes !== null || ["superseded", "reversed"].includes(fact.status)))
34342
- invalid5("facts.lifecycle");
34680
+ invalid7("facts.lifecycle");
34343
34681
  if (fact.supersedes === fact.ref)
34344
- invalid5("facts.supersedes");
34682
+ invalid7("facts.supersedes");
34345
34683
  }
34346
34684
  for (const item of manifest.external) {
34347
34685
  if (canonical(item.ref) !== item.ref || owned.has(item.ref) || external.has(item.ref))
34348
- invalid5("external.ref");
34686
+ invalid7("external.ref");
34349
34687
  external.add(item.ref);
34350
34688
  const body2 = /^(msg|document|note|meeting):/.test(item.ref);
34351
34689
  if (body2 !== (item.content_sha256 !== null))
34352
- invalid5("external.content_sha256");
34690
+ invalid7("external.content_sha256");
34353
34691
  }
34354
34692
  const dependency = /* @__PURE__ */ __name((ref3) => {
34355
34693
  if (ref3 === null)
34356
34694
  return;
34357
34695
  if (canonical(ref3) !== ref3 || !owned.has(ref3) && !external.has(ref3))
34358
- invalid5("missing dependency");
34696
+ invalid7("missing dependency");
34359
34697
  used.add(ref3);
34360
34698
  }, "dependency");
34361
34699
  if (manifest.project.organization !== null)
@@ -34369,7 +34707,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
34369
34707
  for (const alias2 of manifest.aliases) {
34370
34708
  const name = normalizeVocabularyName(alias2);
34371
34709
  if (aliases2.has(name))
34372
- invalid5("aliases.duplicate");
34710
+ invalid7("aliases.duplicate");
34373
34711
  aliases2.add(name);
34374
34712
  }
34375
34713
  for (const fact of manifest.facts) {
@@ -34378,7 +34716,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
34378
34716
  if (fact.supersedes !== null) {
34379
34717
  kind3(fact.supersedes, ["fact"]);
34380
34718
  if (!manifest.facts.some((previous2) => previous2.ref === fact.supersedes && previous2.type === "decision"))
34381
- invalid5("facts.supersedes outside project");
34719
+ invalid7("facts.supersedes outside project");
34382
34720
  }
34383
34721
  }
34384
34722
  const previous = new Map(manifest.facts.map((fact) => [fact.ref, fact.supersedes]));
@@ -34387,7 +34725,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
34387
34725
  let ref3 = fact.ref;
34388
34726
  while (ref3) {
34389
34727
  if (path.has(ref3))
34390
- invalid5("facts.supersedes cycle");
34728
+ invalid7("facts.supersedes cycle");
34391
34729
  path.add(ref3);
34392
34730
  ref3 = previous.get(ref3);
34393
34731
  }
@@ -34395,36 +34733,36 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
34395
34733
  const links2 = /* @__PURE__ */ new Set();
34396
34734
  for (const link3 of manifest.links) {
34397
34735
  if (!/^link:[1-9]\d*$/.test(link3.ref) || links2.has(link3.ref))
34398
- invalid5("links.ref");
34736
+ invalid7("links.ref");
34399
34737
  links2.add(link3.ref);
34400
34738
  if (!owned.has(link3.from) && (link3.to === null || !owned.has(link3.to)))
34401
- invalid5("links.outside project");
34739
+ invalid7("links.outside project");
34402
34740
  if (link3.to === null && link3.target_text === null)
34403
- invalid5("links.target_text");
34741
+ invalid7("links.target_text");
34404
34742
  if (link3.updated_at < link3.created_at)
34405
- invalid5("links.updated_at");
34743
+ invalid7("links.updated_at");
34406
34744
  for (const ref3 of [link3.from, link3.to])
34407
34745
  dependency(ref3);
34408
34746
  }
34409
34747
  for (const ref3 of external)
34410
34748
  if (!used.has(ref3))
34411
- invalid5("external.unused");
34749
+ invalid7("external.unused");
34412
34750
  }, "validateProjectAnnotationsGraph");
34413
34751
  var decodeProjectAnnotations = /* @__PURE__ */ __name((json3) => {
34414
34752
  if (typeof json3 !== "string" || Buffer.byteLength(json3) > PROJECT_ANNOTATIONS_MAX_BYTES)
34415
- invalid5("bytes");
34753
+ invalid7("bytes");
34416
34754
  let input;
34417
34755
  try {
34418
34756
  input = JSON.parse(json3);
34419
34757
  } catch {
34420
- return invalid5("json");
34758
+ return invalid7("json");
34421
34759
  }
34422
34760
  const parsed2 = safeParse(projectAnnotationsSchema, input);
34423
34761
  if (!parsed2.success)
34424
- return invalid5(parsed2.issues[0]?.path?.map((part) => String(part.key)).join(".") ?? "manifest");
34762
+ return invalid7(parsed2.issues[0]?.path?.map((part) => String(part.key)).join(".") ?? "manifest");
34425
34763
  const manifest = parsed2.output;
34426
34764
  if (manifest.aliases.length + manifest.facts.length + manifest.links.length + manifest.external.length > 1e3)
34427
- invalid5("record budget");
34765
+ invalid7("record budget");
34428
34766
  validateProjectAnnotationsGraph(manifest);
34429
34767
  return manifest;
34430
34768
  }, "decodeProjectAnnotations");
@@ -34440,7 +34778,7 @@ var projectAnnotationsFingerprint = /* @__PURE__ */ __name((json3) => {
34440
34778
  return createHash16("sha256").update(JSON.stringify(normalized)).digest("hex");
34441
34779
  }, "projectAnnotationsFingerprint");
34442
34780
 
34443
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
34781
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
34444
34782
  var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
34445
34783
  var ref2 = pipe(string(), minLength(1), maxLength(2048));
34446
34784
  var targetSchema = strictObject({
@@ -34460,23 +34798,23 @@ var kind2 = /* @__PURE__ */ __name((ref3) => {
34460
34798
  const parsed2 = parseReference(ref3);
34461
34799
  return "provider" in parsed2 ? `${parsed2.type}:${parsed2.provider}` : parsed2.type;
34462
34800
  }, "kind");
34463
- var invalid6 = /* @__PURE__ */ __name((field3) => {
34801
+ var invalid8 = /* @__PURE__ */ __name((field3) => {
34464
34802
  throw new CliError("validation_error", `invalid project annotation plan.${field3}`);
34465
34803
  }, "invalid");
34466
34804
  var projectAnnotationBindingSources = /* @__PURE__ */ __name((manifest, bindings) => {
34467
34805
  if (!bindings || typeof bindings !== "object" || Array.isArray(bindings) || Object.keys(bindings).length > 1001)
34468
- return invalid6("bindings");
34806
+ return invalid8("bindings");
34469
34807
  if (Object.getPrototypeOf(bindings) !== Object.prototype && Object.getPrototypeOf(bindings) !== null)
34470
- return invalid6("bindings");
34808
+ return invalid8("bindings");
34471
34809
  const required3 = /* @__PURE__ */ new Set([manifest.project.ref, ...manifest.external.map((item) => item.ref)]);
34472
34810
  for (const [source2, destination] of Object.entries(bindings))
34473
34811
  if (!required3.has(source2) || typeof destination !== "string" || destination.length > 2048)
34474
- return invalid6("bindings");
34812
+ return invalid8("bindings");
34475
34813
  for (const destination of Object.values(bindings)) {
34476
34814
  try {
34477
34815
  kind2(destination);
34478
34816
  } catch {
34479
- return invalid6("bindings.reference");
34817
+ return invalid8("bindings.reference");
34480
34818
  }
34481
34819
  }
34482
34820
  return required3;
@@ -34484,17 +34822,17 @@ var projectAnnotationBindingSources = /* @__PURE__ */ __name((manifest, bindings
34484
34822
  var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fingerprint, target, bindings) => {
34485
34823
  const checked = safeParse(targetSchema, target);
34486
34824
  if (!checked.success)
34487
- return invalid6(checked.issues[0]?.path?.map((p) => String(p.key)).join(".") ?? "target");
34825
+ return invalid8(checked.issues[0]?.path?.map((p) => String(p.key)).join(".") ?? "target");
34488
34826
  const required3 = projectAnnotationBindingSources(manifest, bindings);
34489
34827
  const destinations = /* @__PURE__ */ new Map();
34490
34828
  for (const item of checked.output.external) {
34491
34829
  try {
34492
34830
  kind2(item.ref);
34493
34831
  } catch {
34494
- return invalid6("target.external.ref");
34832
+ return invalid8("target.external.ref");
34495
34833
  }
34496
34834
  if (destinations.has(item.ref) || item.ref === target.project)
34497
- return invalid6("target.external.duplicate");
34835
+ return invalid8("target.external.duplicate");
34498
34836
  destinations.set(item.ref, item.content_sha256);
34499
34837
  }
34500
34838
  const missing_bindings = [], conflicts = [];
@@ -34511,7 +34849,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
34511
34849
  continue;
34512
34850
  }
34513
34851
  } catch {
34514
- return invalid6("bindings.reference");
34852
+ return invalid8("bindings.reference");
34515
34853
  }
34516
34854
  if (used.has(destination))
34517
34855
  conflicts.push({ reference: source2, reason: "duplicate" });
@@ -34547,7 +34885,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
34547
34885
  }, "planBoundProjectAnnotations");
34548
34886
  var planProjectAnnotations = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotations(json3), projectAnnotationsFingerprint(json3), target, bindings), "planProjectAnnotations");
34549
34887
 
34550
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
34888
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
34551
34889
  import { createHash as createHash18 } from "node:crypto";
34552
34890
  var text4 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
34553
34891
  var timestamp3 = pipe(number(), safeInteger(), minValue(0));
@@ -34594,38 +34932,38 @@ var snapshotGraph = /* @__PURE__ */ __name((value) => ({
34594
34932
  external: value.external
34595
34933
  }), "snapshotGraph");
34596
34934
  var decodeProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3) => {
34597
- const invalid8 = /* @__PURE__ */ __name((field3) => {
34935
+ const invalid10 = /* @__PURE__ */ __name((field3) => {
34598
34936
  throw new CliError("validation_error", `invalid project annotation snapshot.${field3}`);
34599
34937
  }, "invalid");
34600
34938
  if (typeof json3 !== "string" || Buffer.byteLength(json3) > PROJECT_ANNOTATIONS_MAX_BYTES)
34601
- return invalid8("bytes");
34939
+ return invalid10("bytes");
34602
34940
  let value;
34603
34941
  try {
34604
34942
  value = JSON.parse(json3);
34605
34943
  } catch {
34606
- return invalid8("json");
34944
+ return invalid10("json");
34607
34945
  }
34608
34946
  const checked = safeParse(projectAnnotationSnapshotSchema, value);
34609
34947
  if (!checked.success)
34610
- return invalid8(checked.issues[0]?.path?.map((p) => String(p.key)).join(".") ?? "manifest");
34948
+ return invalid10(checked.issues[0]?.path?.map((p) => String(p.key)).join(".") ?? "manifest");
34611
34949
  const snapshot2 = checked.output;
34612
34950
  if (snapshot2.aliases.length + snapshot2.facts.length + snapshot2.links.length + snapshot2.external.length > 1e3)
34613
- return invalid8("record budget");
34951
+ return invalid10("record budget");
34614
34952
  for (const field3 of ["description", "status", "owner"])
34615
34953
  if (snapshot2.project[field3] !== null && !snapshot2.project[field3].trim())
34616
- return invalid8(`project.${field3}`);
34954
+ return invalid10(`project.${field3}`);
34617
34955
  for (const alias2 of snapshot2.aliases)
34618
34956
  for (const field3 of ["name", "source"])
34619
34957
  if (!alias2[field3].trim())
34620
- return invalid8(`aliases.${field3}`);
34958
+ return invalid10(`aliases.${field3}`);
34621
34959
  if (snapshot2.project.updated_at < snapshot2.project.created_at)
34622
- return invalid8("project.updated_at");
34960
+ return invalid10("project.updated_at");
34623
34961
  for (const alias2 of snapshot2.aliases)
34624
34962
  if (alias2.updated_at < alias2.created_at)
34625
- return invalid8("aliases.updated_at");
34963
+ return invalid10("aliases.updated_at");
34626
34964
  for (const fact of snapshot2.facts)
34627
34965
  if (!fact.statement.trim())
34628
- return invalid8("facts.statement");
34966
+ return invalid10("facts.statement");
34629
34967
  validateProjectAnnotationsGraph(snapshotGraph(snapshot2), snapshot2.project.owner === null ? [] : [snapshot2.project.owner]);
34630
34968
  return snapshot2;
34631
34969
  }, "decodeProjectAnnotationSnapshot");
@@ -34641,7 +34979,7 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
34641
34979
  })).digest("hex");
34642
34980
  }, "projectAnnotationSnapshotFingerprint");
34643
34981
 
34644
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
34982
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
34645
34983
  var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
34646
34984
  if (!request || typeof request !== "object" || Array.isArray(request))
34647
34985
  throw new CliError("validation_error", "project annotation request is required");
@@ -34658,7 +34996,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
34658
34996
  return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
34659
34997
  }, "projectAnnotationRequest");
34660
34998
 
34661
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
34999
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
34662
35000
  var SnapshotBudget = class {
34663
35001
  static {
34664
35002
  __name(this, "SnapshotBudget");
@@ -34684,15 +35022,15 @@ var SnapshotBudget = class {
34684
35022
  }
34685
35023
  };
34686
35024
 
34687
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
35025
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
34688
35026
  import { createHash as createHash20 } from "node:crypto";
34689
35027
 
34690
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
35028
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
34691
35029
  var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
34692
35030
 
34693
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
35031
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
34694
35032
  import { createHash as createHash19 } from "node:crypto";
34695
- var invalid7 = /* @__PURE__ */ __name(() => {
35033
+ var invalid9 = /* @__PURE__ */ __name(() => {
34696
35034
  throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
34697
35035
  }, "invalid");
34698
35036
  var scalar2 = /* @__PURE__ */ new Set([
@@ -34761,14 +35099,14 @@ var ProjectSnapshotSources = class {
34761
35099
  if (type === null && id2 === null)
34762
35100
  return null;
34763
35101
  if (typeof type !== "string" || !scalar2.has(type) || typeof id2 !== "number" || !Number.isSafeInteger(id2) || id2 < 1)
34764
- return invalid7();
35102
+ return invalid9();
34765
35103
  const key2 = `${type}:${id2}`, cached = this.byThing.get(key2);
34766
35104
  if (cached)
34767
35105
  return cached;
34768
35106
  if (type === "project" || type === "organization") {
34769
35107
  const table = type === "project" ? "projects" : "organizations";
34770
35108
  if (!this.database.prepare(`SELECT 1 FROM ${table} WHERE id=? AND deleted_at IS NULL`).get(id2))
34771
- return invalid7();
35109
+ return invalid9();
34772
35110
  }
34773
35111
  const identifier = {
34774
35112
  message: [
@@ -34790,7 +35128,7 @@ var ProjectSnapshotSources = class {
34790
35128
  this.budget.rows(this.database, selection[0], [...selection[1]], [id2]);
34791
35129
  const thing = storedThing(type, id2), ref3 = referenceOfThing(this.database, thing);
34792
35130
  if (!ref3)
34793
- return invalid7();
35131
+ return invalid9();
34794
35132
  this.byThing.set(key2, ref3);
34795
35133
  this.references.set(ref3, thing);
34796
35134
  return ref3;
@@ -34809,12 +35147,12 @@ var ProjectSnapshotSources = class {
34809
35147
  return this.transcript(thing.id);
34810
35148
  const spec = texts[thing.type];
34811
35149
  if (!spec)
34812
- return invalid7();
35150
+ return invalid9();
34813
35151
  const from2 = `FROM ${spec.table} n ${spec.join ?? ""} WHERE n.id=? AND ${spec.where}`;
34814
35152
  this.budget.rows(this.database, from2, spec.fields, [thing.id]);
34815
35153
  const row2 = this.database.prepare(`SELECT ${spec.fields.map((f, i) => `${f} AS v${i}`).join(",")} ${from2}`).get(thing.id);
34816
35154
  if (!row2)
34817
- return invalid7();
35155
+ return invalid9();
34818
35156
  return this.digest(thing.type, spec.fields.map((_f, i) => row2[`v${i}`]));
34819
35157
  }
34820
35158
  transcript(id2) {
@@ -34822,7 +35160,7 @@ var ProjectSnapshotSources = class {
34822
35160
  this.budget.rows(this.database, from2, ["n.format", "n.language", "n.source"], [id2]);
34823
35161
  const header = this.database.prepare(`SELECT n.format,n.language,n.source ${from2}`).get(id2);
34824
35162
  if (!header)
34825
- return invalid7();
35163
+ return invalid9();
34826
35164
  const rows = "FROM meeting_transcript_rows n WHERE n.meeting_transcript_id=?";
34827
35165
  this.budget.rows(this.database, rows, ["n.position", "n.start_ms", "n.end_ms", "n.speaker_name", "n.text"], [id2]);
34828
35166
  const cues = this.database.prepare(`SELECT n.position,n.start_ms,n.end_ms,n.speaker_name,n.text ${rows} ORDER BY n.position LIMIT 1001`).all(id2);
@@ -34833,7 +35171,7 @@ var ProjectSnapshotSources = class {
34833
35171
  }
34834
35172
  };
34835
35173
 
34836
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
35174
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
34837
35175
  var unsupported = /* @__PURE__ */ __name(() => {
34838
35176
  throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
34839
35177
  }, "unsupported");
@@ -35004,7 +35342,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
35004
35342
  return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
35005
35343
  }), "projectAnnotationSnapshot");
35006
35344
 
35007
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
35345
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
35008
35346
  var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, manifest, bindings, budget) => read(database, () => {
35009
35347
  const current = projectAnnotationSnapshot(database, projectId, budget).snapshot;
35010
35348
  const sources = new ProjectSnapshotSources(database, budget);
@@ -35066,7 +35404,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
35066
35404
  };
35067
35405
  }), "previewAnnotationSnapshot");
35068
35406
 
35069
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
35407
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
35070
35408
  var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snapshot2, bindings) => {
35071
35409
  const mappings = { ...bindings };
35072
35410
  const resolve = /* @__PURE__ */ __name((ref3) => {
@@ -35085,7 +35423,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snap
35085
35423
  const author = resolve(fact.author), confirmed = resolve(fact.confirmed_by);
35086
35424
  if (!author)
35087
35425
  throw new CliError("validation_error", "project annotation author is required");
35088
- 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);
35426
+ 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);
35089
35427
  if (!row2)
35090
35428
  throw new CliError("configuration_error", "project annotation fact insertion failed");
35091
35429
  mappings[fact.ref] = `fact:${row2.id}`;
@@ -35108,7 +35446,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snap
35108
35446
  return mappings;
35109
35447
  }, "restoreAnnotationRecords");
35110
35448
 
35111
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
35449
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
35112
35450
  var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
35113
35451
  async preview(request) {
35114
35452
  const { snapshot: snapshot2, projectId } = projectAnnotationRequest(request);
@@ -35138,7 +35476,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
35138
35476
  }
35139
35477
  }), "projectAnnotationStoreOver");
35140
35478
 
35141
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
35479
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
35142
35480
  var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
35143
35481
  const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
35144
35482
  let merged = { from: from2, to };
@@ -35151,7 +35489,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
35151
35489
  }, "markRange");
35152
35490
  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");
35153
35491
 
35154
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
35492
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
35155
35493
  var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
35156
35494
  var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
35157
35495
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
@@ -35161,7 +35499,7 @@ var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) =
35161
35499
  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);
35162
35500
  }, "setTaskRulesStop");
35163
35501
 
35164
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sync.js
35502
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sync.js
35165
35503
  var syncStoreOver = /* @__PURE__ */ __name((context) => {
35166
35504
  const { database } = context;
35167
35505
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
@@ -35217,7 +35555,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
35217
35555
  };
35218
35556
  }, "syncStoreOver");
35219
35557
 
35220
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/tags.js
35558
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/tags.js
35221
35559
  var tagsStoreOver = /* @__PURE__ */ __name((context) => {
35222
35560
  const { database } = context;
35223
35561
  return {
@@ -35239,7 +35577,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
35239
35577
  };
35240
35578
  }, "tagsStoreOver");
35241
35579
 
35242
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
35580
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
35243
35581
  var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
35244
35582
  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
35245
35583
  WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
@@ -35366,7 +35704,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
35366
35704
  dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
35367
35705
  }, "savePictureChunks");
35368
35706
 
35369
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
35707
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
35370
35708
  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,
35371
35709
  EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
35372
35710
  FROM messages m
@@ -35413,6 +35751,12 @@ var messageRows = /* @__PURE__ */ __name(({ orm }, accountPk2, { chatKey, model,
35413
35751
  ${since === void 0 ? sql`` : sql`AND m.sent_at >= ${since}`}
35414
35752
  ${before2 === void 0 ? sql`` : sql`AND m.sent_at < ${before2}`}
35415
35753
  ${"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");
35754
+ 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
35755
+ FROM chunks k CROSS JOIN messages m ON m.id = k.chunkable_id AND m.deleted_at IS NULL
35756
+ JOIN chats ch ON ch.id = m.chat_id AND ch.searchable = 1
35757
+ JOIN embeddings v ON v.model = ${model} AND v.content_hash = k.content_hash
35758
+ WHERE k.chunkable_type = 'message' AND k.position = 0 AND k.account_id = ${accountPk2}
35759
+ 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");
35416
35760
  var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, query, ...filter }) => {
35417
35761
  const score = /* @__PURE__ */ __name((row2) => ({
35418
35762
  id: row2.id,
@@ -35449,7 +35793,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
35449
35793
  return plain2(best(found2));
35450
35794
  }, "nearestMessages");
35451
35795
 
35452
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/vectors.js
35796
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/vectors.js
35453
35797
  var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
35454
35798
  const { database } = context;
35455
35799
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -35590,6 +35934,10 @@ var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
35590
35934
  query
35591
35935
  });
35592
35936
  }, "nearestMessages"),
35937
+ scoreMessages: /* @__PURE__ */ __name(async (key2, options) => {
35938
+ const accountPk2 = findAccountPk2(key2);
35939
+ return accountPk2 === void 0 ? [] : scoreMessages(context, accountPk2, options);
35940
+ }, "scoreMessages"),
35593
35941
  vectorStatus: /* @__PURE__ */ __name(async (key2, chatId, model) => {
35594
35942
  const chatKey = chatKeyOf(key2, chatId);
35595
35943
  return chatKey === void 0 ? { chunks: 0, embedded: 0 } : vectorStatus(context, chatKey, model);
@@ -35703,7 +36051,7 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
35703
36051
  embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
35704
36052
  }), "vectorsStoreOver");
35705
36053
 
35706
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
36054
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
35707
36055
  import { existsSync, readFileSync as readFileSync4 } from "node:fs";
35708
36056
  import { dirname as dirname2, join as join2 } from "node:path";
35709
36057
  var BOOKKEEPING = ["schema_migrations", "store_settings"];
@@ -35791,10 +36139,10 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
35791
36139
  }
35792
36140
  }, "lastBackup");
35793
36141
 
35794
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/providers.js
36142
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/providers.js
35795
36143
  var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
35796
36144
 
35797
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
36145
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
35798
36146
  var COUNTED_TABLES = [
35799
36147
  "accounts",
35800
36148
  "chats",
@@ -35879,7 +36227,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
35879
36227
  };
35880
36228
  }, "storeContents");
35881
36229
 
35882
- // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/store.js
36230
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.0_commander@15.0.0_esbuild@0.28.2_type_438c1bd9283d857a9e801e9b977bafec/node_modules/@wirecat/cli-core/dist/store/store.js
35883
36231
  var openStore = /* @__PURE__ */ __name(async (options = {}) => {
35884
36232
  const context = await openStoreContext(options);
35885
36233
  try {
@@ -36063,6 +36411,17 @@ var storeOver = /* @__PURE__ */ __name((context) => {
36063
36411
  }, "storeOver");
36064
36412
 
36065
36413
  export {
36414
+ isFolderProvider,
36415
+ folderProviderSql,
36416
+ folderProviderOf,
36417
+ isDocumentAccountProvider,
36418
+ filesAccountSql,
36419
+ INTERNAL_NOTES,
36420
+ UNKNOWN_PROVIDER,
36421
+ isKind,
36422
+ providerNamed,
36423
+ kindIn,
36424
+ kindOf,
36066
36425
  isBotProvider,
36067
36426
  inSource,
36068
36427
  sourceOf,
@@ -36098,10 +36457,15 @@ export {
36098
36457
  hasStems,
36099
36458
  savedPhoneCountries,
36100
36459
  saveStorePhoneCountries,
36460
+ formatLocator,
36461
+ isLocator,
36462
+ parseLocator,
36101
36463
  normalizeVocabularyName,
36102
36464
  createTagRedirectIndex,
36103
36465
  tagMemberIds,
36104
36466
  inboxKey,
36467
+ formatReference,
36468
+ parseReference,
36105
36469
  storedThing,
36106
36470
  thingOf,
36107
36471
  referenceOfThing,
@@ -36126,6 +36490,9 @@ export {
36126
36490
  CHAT_COLUMNS,
36127
36491
  TRACKED_CHAT_COLUMNS,
36128
36492
  titlePart,
36493
+ COUNTER_FIELDS,
36494
+ counterObservationTime,
36495
+ counterFreshness,
36129
36496
  AGENDA_COLUMNS,
36130
36497
  correctWords,
36131
36498
  threadConversation,
@@ -36154,6 +36521,10 @@ export {
36154
36521
  CONVERSATION_COLUMNS,
36155
36522
  MENTION_STATUSES,
36156
36523
  MENTION_QUERY,
36524
+ MESSAGE_MEASURES,
36525
+ AUTHOR_MEASURES,
36526
+ rankingOptions,
36527
+ RANKING_TOKENIZER_VERSION,
36157
36528
  rankingContextRange,
36158
36529
  calendarKey,
36159
36530
  pendingNormalization,