@wirecat/mail-cli 0.1.0 → 0.2.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 (212) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +37 -11
  3. package/dist/bin/mail.js +2 -2
  4. package/dist/bundle/{all-profiles-TKMBELRZ.js → all-profiles-7WILOT5E.js} +5 -5
  5. package/dist/bundle/{anthropic-7LMUAEIZ.js → anthropic-NHWLIMEZ.js} +3 -3
  6. package/dist/bundle/{app-server-JGMIJDD4.js → app-server-XDMYCJLV.js} +39 -39
  7. package/dist/bundle/{bun-XRO6XJHQ.js → bun-GTG5IYLQ.js} +2 -2
  8. package/dist/bundle/{bun-sqlite-Z54LEHVM.js → bun-sqlite-KGH5F33G.js} +2 -2
  9. package/dist/bundle/{chunk-JVMVLITS.js → chunk-2X4WYZPA.js} +4 -2
  10. package/dist/bundle/{chunk-GN62YOT5.js → chunk-4I3YT5KK.js} +4 -4
  11. package/dist/bundle/{chunk-MS53RALV.js → chunk-5FLW25US.js} +5 -5
  12. package/dist/bundle/{chunk-FZ5FXIG6.js → chunk-5JOKRFWE.js} +1 -1
  13. package/dist/bundle/{chunk-KHTO2Q6E.js → chunk-6HIW7IJL.js} +4 -4
  14. package/dist/bundle/{chunk-TVREDYX4.js → chunk-76IKLP2M.js} +95 -91
  15. package/dist/bundle/{chunk-ZANYM66S.js → chunk-77VHMI3A.js} +1 -1
  16. package/dist/bundle/{chunk-TQFCPUIM.js → chunk-7LKJDJNS.js} +1 -1
  17. package/dist/bundle/{chunk-WLFLBWNH.js → chunk-7QEE5I7H.js} +2 -2
  18. package/dist/bundle/{chunk-6MAZWSC3.js → chunk-7REG25RM.js} +3 -3
  19. package/dist/bundle/{chunk-TWTATDM7.js → chunk-AJIT2T3F.js} +6 -6
  20. package/dist/bundle/{chunk-JBBZCTTF.js → chunk-AROBJF5P.js} +1 -1
  21. package/dist/bundle/{chunk-NK7EB63L.js → chunk-BKZEYTLU.js} +849 -440
  22. package/dist/bundle/{chunk-4FEMINO2.js → chunk-BPF7IXJT.js} +5 -5
  23. package/dist/bundle/{chunk-BTQX2ZSZ.js → chunk-BUOSCMCD.js} +2 -2
  24. package/dist/bundle/{chunk-5NYMNSSO.js → chunk-CT7NG7BI.js} +3 -3
  25. package/dist/bundle/{chunk-TWPDVUBR.js → chunk-D7UZXUSB.js} +2 -2
  26. package/dist/bundle/{chunk-OTUOZ33L.js → chunk-DDMJ3RVO.js} +2 -2
  27. package/dist/bundle/{chunk-3KEVLSNN.js → chunk-EKE3R36Y.js} +46 -8
  28. package/dist/bundle/{chunk-YO4CUH5E.js → chunk-ETPT7TPW.js} +1 -1
  29. package/dist/bundle/{chunk-3KOA73LS.js → chunk-GPAAQ6LY.js} +14 -14
  30. package/dist/bundle/{chunk-GQQJOH7A.js → chunk-GQKYSGIA.js} +58 -46
  31. package/dist/bundle/{chunk-QLEUNU6G.js → chunk-H5BW7454.js} +4 -4
  32. package/dist/bundle/{chunk-KM7Q67Z3.js → chunk-H66ZMBDD.js} +1 -1
  33. package/dist/bundle/{chunk-VEIZZRQ5.js → chunk-H7NUGJPV.js} +12 -3
  34. package/dist/bundle/{chunk-2LLNPNMB.js → chunk-H7XOHNRY.js} +1 -1
  35. package/dist/bundle/{chunk-F6D6PJ34.js → chunk-HJRUFT5Y.js} +5 -5
  36. package/dist/bundle/{chunk-5WGEUDE4.js → chunk-MABCR67K.js} +1 -1
  37. package/dist/bundle/{chunk-IK5TH3O7.js → chunk-MDVXIPA3.js} +10 -10
  38. package/dist/bundle/{chunk-YPQQ5J4X.js → chunk-QJHCKFFC.js} +16 -16
  39. package/dist/bundle/{chunk-Z34ICZA3.js → chunk-QLYHLW54.js} +5 -5
  40. package/dist/bundle/{chunk-7SXGLT6T.js → chunk-QUGFBY7O.js} +9 -8
  41. package/dist/bundle/{chunk-CEW6KIFA.js → chunk-QUSZWBZF.js} +21 -21
  42. package/dist/bundle/{chunk-FDCGTODC.js → chunk-R5JD4GMA.js} +1 -1
  43. package/dist/bundle/{chunk-K4FVKPDQ.js → chunk-S2GSU4MT.js} +9 -9
  44. package/dist/bundle/{chunk-T6464KYA.js → chunk-STC45HZX.js} +204 -203
  45. package/dist/bundle/{chunk-75CWWETH.js → chunk-SVNTRF5O.js} +11 -11
  46. package/dist/bundle/{chunk-GWDCKUBI.js → chunk-THVLMTH7.js} +30 -29
  47. package/dist/bundle/{chunk-4E7BN3TC.js → chunk-TMVIQJCG.js} +2 -2
  48. package/dist/bundle/{chunk-EOEDICIE.js → chunk-UZR3IKS7.js} +1 -1
  49. package/dist/bundle/{chunk-CH6RXYAX.js → chunk-VBLFQJY3.js} +1 -1
  50. package/dist/bundle/{chunk-GAH7N7HO.js → chunk-VRQRBVKT.js} +44 -44
  51. package/dist/bundle/{chunk-GK4M2SUP.js → chunk-VWO3XXSF.js} +1 -1
  52. package/dist/bundle/{chunk-QQB7WT7R.js → chunk-WJ3LUWRN.js} +3 -3
  53. package/dist/bundle/{chunk-3E3WA2L6.js → chunk-Y5WA7AOA.js} +21 -21
  54. package/dist/bundle/{chunk-TE5U5OAM.js → chunk-Y6KUKIQZ.js} +2 -2
  55. package/dist/bundle/{chunk-J6MSJLIW.js → chunk-YQAUH3PN.js} +1 -1
  56. package/dist/bundle/{chunk-MNOIRJEO.js → chunk-Z6F7EXT2.js} +7 -7
  57. package/dist/bundle/{chunk-WXAXYJJ7.js → chunk-ZKH5CHGI.js} +5 -5
  58. package/dist/bundle/{chunk-UH4DDRHA.js → chunk-ZNYJG4AY.js} +42 -42
  59. package/dist/bundle/{command-contract-WU434ZUL.js → command-contract-Y42ULKE5.js} +13 -13
  60. package/dist/bundle/{decode-YB3ZDTES.js → decode-L4X542L3.js} +2 -2
  61. package/dist/bundle/{dist-X36THCOF.js → dist-HFUVURJG.js} +1 -1
  62. package/dist/bundle/{dist-A6GKSKFC.js → dist-WKIRHOLK.js} +14 -14
  63. package/dist/bundle/{echarts-YNGCOYHW.js → echarts-G6QLXR4X.js} +2 -2
  64. package/dist/bundle/{embed-LWNHIRBQ.js → embed-E33ZBHQR.js} +3 -3
  65. package/dist/bundle/{embedder-2LYD3U37.js → embedder-EMBCIVGF.js} +6 -6
  66. package/dist/bundle/{first-run-N3HJKGU7.js → first-run-WF2HF5FI.js} +5 -5
  67. package/dist/bundle/{first-screen-4U2DMV3G.js → first-screen-DZFOUUZC.js} +14 -14
  68. package/dist/bundle/{instructions-GJHHFV64.js → instructions-DUH7265J.js} +1 -1
  69. package/dist/bundle/mail.js +2 -2
  70. package/dist/bundle/{node-GFOH6FKP.js → node-73PKCCE7.js} +2 -2
  71. package/dist/bundle/{node-sqlite-NBXQXBIU.js → node-sqlite-FDD5N6GC.js} +2 -2
  72. package/dist/bundle/{oauth-56EFO5AQ.js → oauth-ND3K2F7B.js} +4 -4
  73. package/dist/bundle/{open-2V7QZQJP.js → open-FZYY6TKE.js} +1 -1
  74. package/dist/bundle/{openai-V3SVACVL.js → openai-BXOF6XIM.js} +10 -10
  75. package/dist/bundle/{process-XVDX4SPD.js → process-TXIK4VJP.js} +1 -1
  76. package/dist/bundle/{program-ILID6EAT.js → program-2SUR4WOS.js} +1700 -1459
  77. package/dist/bundle/{prompt-YKWAI222.js → prompt-I5GCP73M.js} +2 -2
  78. package/dist/bundle/{recognize-PAR66KVM.js → recognize-ILYEKXVB.js} +1 -1
  79. package/dist/bundle/{remote-CE43TKXC.js → remote-SSPZEAJ7.js} +4 -4
  80. package/dist/bundle/{rerank-M7S7P2TW.js → rerank-NAO5RMGB.js} +4 -4
  81. package/dist/bundle/{serve-ENPMIV6J.js → serve-UDXIEQKC.js} +6 -6
  82. package/dist/bundle/{server-MBEZLVKZ.js → server-KTPELKAN.js} +31 -31
  83. package/dist/bundle/server-UZFSEKNJ.js +63 -0
  84. package/dist/bundle/{sqlite-runtime-HVGDHBJJ.js → sqlite-runtime-AONFLND6.js} +2 -2
  85. package/dist/bundle/{state-QZSOSKBD.js → state-I4PLX3UB.js} +3 -3
  86. package/dist/bundle/{store-UJ7SNKXI.js → store-OHQH3MGN.js} +30 -12
  87. package/dist/bundle/{store-2BUX6LVX.js → store-ZPPRXGPY.js} +9 -9
  88. package/dist/bundle/store-maintenance-command-QOYXEBT6.js +52 -0
  89. package/dist/commands/account.d.ts.map +1 -1
  90. package/dist/commands/account.js +6 -5
  91. package/dist/commands/account.js.map +1 -1
  92. package/dist/commands/context.d.ts +19 -8
  93. package/dist/commands/context.d.ts.map +1 -1
  94. package/dist/commands/context.js +14 -10
  95. package/dist/commands/context.js.map +1 -1
  96. package/dist/commands/folders.js +4 -4
  97. package/dist/commands/folders.js.map +1 -1
  98. package/dist/commands/login.d.ts +2 -2
  99. package/dist/commands/login.d.ts.map +1 -1
  100. package/dist/commands/login.js +3 -5
  101. package/dist/commands/login.js.map +1 -1
  102. package/dist/commands/mailbox.d.ts +2 -1
  103. package/dist/commands/mailbox.d.ts.map +1 -1
  104. package/dist/commands/mailbox.js.map +1 -1
  105. package/dist/commands/session-start.d.ts +3 -0
  106. package/dist/commands/session-start.d.ts.map +1 -0
  107. package/dist/commands/session-start.js +117 -0
  108. package/dist/commands/session-start.js.map +1 -0
  109. package/dist/commands/session.d.ts.map +1 -1
  110. package/dist/commands/session.js +9 -117
  111. package/dist/commands/session.js.map +1 -1
  112. package/dist/commands/status.d.ts.map +1 -1
  113. package/dist/commands/status.js +8 -20
  114. package/dist/commands/status.js.map +1 -1
  115. package/dist/commands/sync.d.ts.map +1 -1
  116. package/dist/commands/sync.js +49 -26
  117. package/dist/commands/sync.js.map +1 -1
  118. package/dist/config.d.ts +2 -0
  119. package/dist/config.d.ts.map +1 -1
  120. package/dist/config.js +4 -0
  121. package/dist/config.js.map +1 -1
  122. package/dist/discovery.d.ts +4 -15
  123. package/dist/discovery.d.ts.map +1 -1
  124. package/dist/discovery.js +19 -92
  125. package/dist/discovery.js.map +1 -1
  126. package/dist/mail/backend.d.ts +36 -0
  127. package/dist/mail/backend.d.ts.map +1 -0
  128. package/dist/mail/backend.js +2 -0
  129. package/dist/mail/backend.js.map +1 -0
  130. package/dist/mail/imap/account.d.ts +5 -0
  131. package/dist/mail/imap/account.d.ts.map +1 -0
  132. package/dist/mail/imap/account.js +41 -0
  133. package/dist/mail/imap/account.js.map +1 -0
  134. package/dist/mail/imap/connection.d.ts +62 -0
  135. package/dist/mail/imap/connection.d.ts.map +1 -0
  136. package/dist/mail/imap/connection.js +188 -0
  137. package/dist/mail/imap/connection.js.map +1 -0
  138. package/dist/mail/{imap-errors.d.ts → imap/errors.d.ts} +1 -1
  139. package/dist/mail/imap/errors.d.ts.map +1 -0
  140. package/dist/mail/{imap-errors.js → imap/errors.js} +1 -1
  141. package/dist/mail/imap/errors.js.map +1 -0
  142. package/dist/mail/imap/index.d.ts +7 -0
  143. package/dist/mail/imap/index.d.ts.map +1 -0
  144. package/dist/mail/imap/index.js +11 -0
  145. package/dist/mail/imap/index.js.map +1 -0
  146. package/dist/mail/{imap-messages.d.ts → imap/messages.d.ts} +9 -9
  147. package/dist/mail/imap/messages.d.ts.map +1 -0
  148. package/dist/mail/imap/messages.js +66 -0
  149. package/dist/mail/imap/messages.js.map +1 -0
  150. package/dist/mail/imap/read.d.ts +7 -0
  151. package/dist/mail/imap/read.d.ts.map +1 -0
  152. package/dist/mail/imap/read.js +164 -0
  153. package/dist/mail/imap/read.js.map +1 -0
  154. package/dist/mail/rethread.d.ts +15 -0
  155. package/dist/mail/rethread.d.ts.map +1 -0
  156. package/dist/mail/rethread.js +52 -0
  157. package/dist/mail/rethread.js.map +1 -0
  158. package/dist/profile.d.ts +2 -1
  159. package/dist/profile.d.ts.map +1 -1
  160. package/dist/profile.js +1 -0
  161. package/dist/profile.js.map +1 -1
  162. package/dist/providers.d.ts +126 -26
  163. package/dist/providers.d.ts.map +1 -1
  164. package/dist/providers.js +141 -72
  165. package/dist/providers.js.map +1 -1
  166. package/dist/secret.d.ts +2 -1
  167. package/dist/secret.d.ts.map +1 -1
  168. package/dist/secret.js +1 -0
  169. package/dist/secret.js.map +1 -1
  170. package/dist/version.d.ts +1 -1
  171. package/dist/version.js +1 -1
  172. package/package.json +3 -2
  173. package/skills/mail-cli/SKILL.md +8 -0
  174. package/dist/bundle/server-JRTHUCVY.js +0 -63
  175. package/dist/bundle/store-maintenance-command-I7V5C44K.js +0 -52
  176. package/dist/commands/doctor.d.ts +0 -77
  177. package/dist/commands/doctor.d.ts.map +0 -1
  178. package/dist/commands/doctor.js +0 -74
  179. package/dist/commands/doctor.js.map +0 -1
  180. package/dist/commands/mcp.d.ts +0 -3
  181. package/dist/commands/mcp.d.ts.map +0 -1
  182. package/dist/commands/mcp.js +0 -97
  183. package/dist/commands/mcp.js.map +0 -1
  184. package/dist/commands/setup.d.ts +0 -3
  185. package/dist/commands/setup.d.ts.map +0 -1
  186. package/dist/commands/setup.js +0 -156
  187. package/dist/commands/setup.js.map +0 -1
  188. package/dist/mail/imap-errors.d.ts.map +0 -1
  189. package/dist/mail/imap-errors.js.map +0 -1
  190. package/dist/mail/imap-messages.d.ts.map +0 -1
  191. package/dist/mail/imap-messages.js +0 -66
  192. package/dist/mail/imap-messages.js.map +0 -1
  193. package/dist/mail/imap.d.ts +0 -67
  194. package/dist/mail/imap.d.ts.map +0 -1
  195. package/dist/mail/imap.js +0 -348
  196. package/dist/mail/imap.js.map +0 -1
  197. package/dist/mail/parse.d.ts +0 -18
  198. package/dist/mail/parse.d.ts.map +0 -1
  199. package/dist/mail/parse.js +0 -31
  200. package/dist/mail/parse.js.map +0 -1
  201. package/dist/mail/port.d.ts +0 -50
  202. package/dist/mail/port.d.ts.map +0 -1
  203. package/dist/mail/port.js +0 -4
  204. package/dist/mail/port.js.map +0 -1
  205. package/dist/mcp.d.ts +0 -29
  206. package/dist/mcp.d.ts.map +0 -1
  207. package/dist/mcp.js +0 -98
  208. package/dist/mcp.js.map +0 -1
  209. package/dist/sync.d.ts +0 -26
  210. package/dist/sync.d.ts.map +0 -1
  211. package/dist/sync.js +0 -75
  212. package/dist/sync.js.map +0 -1
@@ -31,7 +31,7 @@ import {
31
31
  rankingWords,
32
32
  useStoredProviders,
33
33
  validCounter
34
- } from "./chunk-4FEMINO2.js";
34
+ } from "./chunk-BPF7IXJT.js";
35
35
  import {
36
36
  FACT_STATUSES,
37
37
  FACT_TYPES,
@@ -39,6 +39,7 @@ import {
39
39
  LINK_ORIGINS,
40
40
  MEMORY_KINDS,
41
41
  MEMORY_SCOPES,
42
+ PRIORITY_LABELS,
42
43
  RELATION_KINDS,
43
44
  TASK_KINDS,
44
45
  TASK_ORIGINS,
@@ -46,13 +47,19 @@ import {
46
47
  TASK_TYPES,
47
48
  TASK_VERDICTS,
48
49
  WORK_TASK_TYPES,
50
+ checkedScore,
51
+ isClosedState,
52
+ legacyPriority,
49
53
  linkKind,
50
- matches
51
- } from "./chunk-3KEVLSNN.js";
54
+ matches,
55
+ priorityBand,
56
+ priorityLabel
57
+ } from "./chunk-EKE3R36Y.js";
52
58
  import {
53
59
  CHAT_MESSAGES_READ,
54
60
  MEETING_FINDINGS_KIND,
55
61
  MeetingError,
62
+ OPERATORS_BY_TYPE,
56
63
  QUERY_LIMITS,
57
64
  REVIEW_LIMIT,
58
65
  aggregateMeetingStats,
@@ -86,7 +93,7 @@ import {
86
93
  validateQuery,
87
94
  walkQuery,
88
95
  zonedMoment
89
- } from "./chunk-UH4DDRHA.js";
96
+ } from "./chunk-ZNYJG4AY.js";
90
97
  import {
91
98
  DEFAULT_STEMMERS,
92
99
  DEFAULT_STEMMERS_VERSION,
@@ -99,18 +106,18 @@ import {
99
106
  fold,
100
107
  normalize,
101
108
  parseStemmers
102
- } from "./chunk-MNOIRJEO.js";
109
+ } from "./chunk-Z6F7EXT2.js";
103
110
  import {
104
111
  DEFAULT_TASK_CATEGORIES,
105
112
  sharedConfigPath,
106
113
  storedTaskCategories,
107
114
  taskCategoriesReader
108
- } from "./chunk-KHTO2Q6E.js";
115
+ } from "./chunk-6HIW7IJL.js";
109
116
  import {
110
117
  PRAGMAS,
111
118
  quietSqliteWarning,
112
119
  storeCapable
113
- } from "./chunk-F6D6PJ34.js";
120
+ } from "./chunk-HJRUFT5Y.js";
114
121
  import {
115
122
  SQLiteTable,
116
123
  TableAliasProxyHandler,
@@ -135,10 +142,10 @@ import {
135
142
  sql,
136
143
  sqliteTable,
137
144
  text
138
- } from "./chunk-EOEDICIE.js";
145
+ } from "./chunk-UZR3IKS7.js";
139
146
  import {
140
147
  storePath
141
- } from "./chunk-FZ5FXIG6.js";
148
+ } from "./chunk-5JOKRFWE.js";
142
149
  import {
143
150
  array,
144
151
  boolean,
@@ -167,7 +174,7 @@ import {
167
174
  __name
168
175
  } from "./chunk-ZVVMGPBJ.js";
169
176
 
170
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/account-store.js
177
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/account-store.js
171
178
  var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
172
179
  const methods = whole;
173
180
  return Object.fromEntries(Object.keys(keyed).map((name) => [
@@ -183,7 +190,7 @@ var once = /* @__PURE__ */ __name((build) => {
183
190
  };
184
191
  }, "once");
185
192
  var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
186
- const bound4 = /* @__PURE__ */ __name((area) => once(() => bindArea(area(), account)), "bound");
193
+ const bound5 = /* @__PURE__ */ __name((area) => once(() => bindArea(area(), account)), "bound");
187
194
  const ownAttachment = /* @__PURE__ */ __name((attachmentPk) => {
188
195
  const pk = owners.accountPk();
189
196
  if (pk === void 0 || owners.attachmentAccount(attachmentPk) !== pk)
@@ -226,9 +233,9 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
226
233
  return id2 === void 0 ? [] : store.meetings.search(query, { ...filter, accountId: id2 });
227
234
  }, "search")
228
235
  };
229
- const accounts2 = bound4(areas.accounts);
230
- const chats2 = bound4(areas.chats);
231
- const sync = bound4(areas.sync);
236
+ const accounts2 = bound5(areas.accounts);
237
+ const chats2 = bound5(areas.chats);
238
+ const sync = bound5(areas.sync);
232
239
  const messages2 = once(() => ({
233
240
  ...bindArea(areas.messages(), account),
234
241
  find: /* @__PURE__ */ __name((filter) => store.messages.find({ ...filter, account }), "find"),
@@ -245,13 +252,13 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
245
252
  return store.attachments.keepAttachmentText(attachmentPk, entry2);
246
253
  }, "keepAttachmentText")
247
254
  }));
248
- const roster = bound4(areas.roster);
249
- const people2 = bound4(areas.people);
250
- const conversations2 = bound4(areas.conversations);
251
- const vectors = bound4(areas.vectors);
252
- const counters = bound4(areas.counters);
253
- const tags = bound4(areas.tags);
254
- const mentions3 = bound4(areas.mentions);
255
+ const roster = bound5(areas.roster);
256
+ const people2 = bound5(areas.people);
257
+ const conversations2 = bound5(areas.conversations);
258
+ const vectors = bound5(areas.vectors);
259
+ const counters = bound5(areas.counters);
260
+ const tags = bound5(areas.tags);
261
+ const mentions3 = bound5(areas.mentions);
255
262
  return {
256
263
  account,
257
264
  get accounts() {
@@ -295,7 +302,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
295
302
  };
296
303
  }, "bindAccount");
297
304
 
298
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/query.js
305
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/search/query.js
299
306
  var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
300
307
  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");
301
308
  var fail = /* @__PURE__ */ __name((message2) => {
@@ -318,7 +325,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
318
325
  return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
319
326
  }, "sourceOf");
320
327
 
321
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/account-list.js
328
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/search/account-list.js
322
329
  var ACCOUNT_GROUPS = "accountGroups";
323
330
  var ACCOUNT_GROUPS_SETTING = "account_groups";
324
331
  var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
@@ -505,7 +512,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf = (kind3)
505
512
  return { accounts: [...chosen.values()], skipped };
506
513
  }, "fitting");
507
514
 
508
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
515
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
509
516
  var IndexBuilderOn = class {
510
517
  static {
511
518
  __name(this, "IndexBuilderOn");
@@ -700,7 +707,7 @@ function alias(table, alias2) {
700
707
  }
701
708
  __name(alias, "alias");
702
709
 
703
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
710
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
704
711
  var ENTITY_TABLES = {
705
712
  account: "accounts",
706
713
  attachment: "attachments",
@@ -740,7 +747,7 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
740
747
  return { table, pointer, type, count, known: known2 };
741
748
  }).filter(({ count }) => count > 0)), "orphanPointers");
742
749
 
743
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
750
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
744
751
  var canonicalTags = sqliteTable("canonical_tags", {
745
752
  id: integer("id").primaryKey(),
746
753
  name: text("name").notNull().unique(),
@@ -749,7 +756,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
749
756
  updatedAt: integer("updated_at").notNull()
750
757
  });
751
758
 
752
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
759
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
753
760
  var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
754
761
  sourceKey: text("source_key").notNull(),
755
762
  collection: text("collection").notNull(),
@@ -759,13 +766,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
759
766
  createdAt: integer("created_at").notNull()
760
767
  }, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
761
768
 
762
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
769
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
763
770
  var documentIndexPending = sqliteTable("document_index_pending", {
764
771
  id: integer("id").notNull(),
765
772
  indexableType: text("indexable_type").notNull()
766
773
  }, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
767
774
 
768
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
775
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
769
776
  var tagRedirects = sqliteTable("tag_redirects", {
770
777
  sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
771
778
  survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
@@ -791,7 +798,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
791
798
  index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
792
799
  ]);
793
800
 
794
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
801
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
795
802
  var accounts = sqliteTable("accounts", {
796
803
  id: integer("id").primaryKey(),
797
804
  provider: text("provider").notNull(),
@@ -1864,7 +1871,10 @@ var tasks = sqliteTable("tasks", {
1864
1871
  closeSuggestedById: integer("close_suggested_by_id"),
1865
1872
  closeSuggestedCertainty: real("close_suggested_certainty"),
1866
1873
  closeSuggestedReason: text("close_suggested_reason"),
1867
- closeSuggestedAt: integer("close_suggested_at")
1874
+ closeSuggestedAt: integer("close_suggested_at"),
1875
+ priorityScore: real("priority_score"),
1876
+ agent: text("agent"),
1877
+ revision: integer("revision").notNull().default(1)
1868
1878
  }, (table) => [
1869
1879
  unique().on(table.projectId, table.number),
1870
1880
  index("tasks_by_title_folded").on(table.titleFolded),
@@ -2287,7 +2297,7 @@ var storeSettings = sqliteTable("store_settings", {
2287
2297
  at: integer("at").notNull()
2288
2298
  });
2289
2299
 
2290
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
2300
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
2291
2301
  var ARMS = [
2292
2302
  [
2293
2303
  "message",
@@ -2414,7 +2424,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
2414
2424
  return recomputed;
2415
2425
  }, "drainInvolvementQueue");
2416
2426
 
2417
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/mentions.js
2427
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/mentions.js
2418
2428
  import { domainToUnicode } from "node:url";
2419
2429
 
2420
2430
  // node_modules/.pnpm/psl@1.15.0/node_modules/psl/dist/psl.mjs
@@ -12436,7 +12446,7 @@ var oa = /* @__PURE__ */ __name((e) => {
12436
12446
  }, "oa");
12437
12447
  var na = { parse: O, get: aa, isValid: oa };
12438
12448
 
12439
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
12449
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
12440
12450
  var LINK = /https?:\/\/(?:(?:docs|drive|sheets|slides)\.google\.com|forms\.gle)(?:[/?#][^\s<>"'`]*)?/gi;
12441
12451
  var ID = /^[\w-]{10,}$/;
12442
12452
  var trimUrl = /* @__PURE__ */ __name((url) => {
@@ -12477,7 +12487,7 @@ var googleDocumentLinks = /* @__PURE__ */ __name((text5) => [...text5.matchAll(L
12477
12487
  return { url, documentId: googleDocumentId(url) };
12478
12488
  }), "googleDocumentLinks");
12479
12489
 
12480
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
12490
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
12481
12491
  var PHONE_PLANS = [
12482
12492
  {
12483
12493
  country: "us",
@@ -12857,7 +12867,7 @@ var PHONE_PLANS = [
12857
12867
  }
12858
12868
  ];
12859
12869
 
12860
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/phones.js
12870
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/phones.js
12861
12871
  var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
12862
12872
  var DEFAULT_PHONE_COUNTRIES = ["ru"];
12863
12873
  var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
@@ -12898,7 +12908,7 @@ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
12898
12908
  return void 0;
12899
12909
  }, "nationalPhone");
12900
12910
 
12901
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/places.js
12911
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/places.js
12902
12912
  var BEFORE = [
12903
12913
  [/^(?:ул\.?|улиц[аеыу]|улицей)$/iu, "\u0443\u043B\u0438\u0446\u0430"],
12904
12914
  [/^(?:пр-т|просп\.?|проспект[аеу]?)$/iu, "\u043F\u0440\u043E\u0441\u043F\u0435\u043A\u0442"],
@@ -13158,7 +13168,7 @@ var findPlaces = /* @__PURE__ */ __name((text5) => {
13158
13168
  return found2.sort((a, b) => a.start - b.start);
13159
13169
  }, "findPlaces");
13160
13170
 
13161
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/mentions.js
13171
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/mentions.js
13162
13172
  var MENTION_KINDS = ["phone", "email", "url", "document", "person-name", "place"];
13163
13173
  var MENTION_VERSIONS = {
13164
13174
  phone: 1,
@@ -13348,7 +13358,7 @@ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE
13348
13358
  };
13349
13359
  }, "typedPhone");
13350
13360
 
13351
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/first-names.js
13361
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/first-names.js
13352
13362
  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";
13353
13363
  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";
13354
13364
  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";
@@ -13356,7 +13366,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
13356
13366
  var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
13357
13367
  var NAME_WORDS = WORDS.split(" ");
13358
13368
 
13359
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/person-names.js
13369
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/person-names.js
13360
13370
  var LATIN_TO_CYRILLIC = {
13361
13371
  shch: "\u0449",
13362
13372
  sch: "\u0449",
@@ -13564,7 +13574,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text5, stem, taken) => {
13564
13574
  return found2;
13565
13575
  }, "findUnknownNames");
13566
13576
 
13567
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/attachments.js
13577
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/attachments.js
13568
13578
  var NOT_FILES = /* @__PURE__ */ new Set([
13569
13579
  "webpage",
13570
13580
  "share",
@@ -13596,7 +13606,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored3, files2) => {
13596
13606
  });
13597
13607
  }, "matchDownloads");
13598
13608
 
13599
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
13609
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
13600
13610
  var QUERY_VERSION = 1;
13601
13611
  var QUERY_LIMITS2 = {
13602
13612
  ...QUERY_LIMITS,
@@ -13627,7 +13637,7 @@ function exhausted(budget) {
13627
13637
  }
13628
13638
  __name(exhausted, "exhausted");
13629
13639
 
13630
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
13640
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
13631
13641
  var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
13632
13642
  var literal2 = /* @__PURE__ */ __name((c) => ({
13633
13643
  kind: "char",
@@ -14027,7 +14037,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
14027
14037
  return out;
14028
14038
  }, "foldRegex");
14029
14039
 
14030
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
14040
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
14031
14041
  var PRESET_VERSION = 1;
14032
14042
  var PRESETS = {
14033
14043
  password: {
@@ -14081,7 +14091,7 @@ var PRESETS = {
14081
14091
  }
14082
14092
  };
14083
14093
 
14084
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
14094
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
14085
14095
  var FIELD_VERSION = 2;
14086
14096
  var UNITS = {
14087
14097
  "": 1,
@@ -14105,9 +14115,9 @@ var filled = /* @__PURE__ */ __name((node) => {
14105
14115
  searchError("query.missing-value", node.span);
14106
14116
  }, "filled");
14107
14117
  var validateSize = /* @__PURE__ */ __name((node) => {
14108
- for (const bound4 of node.operator === "range" ? [node.value, node.upper] : [node.value])
14109
- if (bound4 !== void 0 && bound4 !== "*")
14110
- parseBytes(bound4, node.span);
14118
+ for (const bound5 of node.operator === "range" ? [node.value, node.upper] : [node.value])
14119
+ if (bound5 !== void 0 && bound5 !== "*")
14120
+ parseBytes(bound5, node.span);
14111
14121
  }, "validateSize");
14112
14122
  var validateTag = /* @__PURE__ */ __name((node) => {
14113
14123
  if (tagOf(node.value) === void 0)
@@ -14480,8 +14490,8 @@ var MESSAGES = { entity: "message", backend: "sql", fields: QUERY_FIELDS };
14480
14490
  var NEAR_FIELDS = /* @__PURE__ */ new Set(["text", "exact", "transcript", "content"]);
14481
14491
  var validateFields = /* @__PURE__ */ __name((ast) => {
14482
14492
  for (const node of walkQuery(ast.root)) {
14483
- const field3 = QUERY_FIELDS.find(({ name }) => name === node.field);
14484
- if (!field3 && ["after", "before"].includes(node.field)) {
14493
+ const field4 = QUERY_FIELDS.find(({ name }) => name === node.field);
14494
+ if (!field4 && ["after", "before"].includes(node.field)) {
14485
14495
  const plain2 = ["term", "phrase"].includes(node.operator) && /^[\w:.+-]+$/u.test(node.value);
14486
14496
  searchError("legacy_date_field", node.span, plain2 ? `use date${node.field === "after" ? ">=" : "<"}${node.value}` : "use date>=YYYY-MM-DD or date:[a TO b]");
14487
14497
  }
@@ -14489,8 +14499,8 @@ var validateFields = /* @__PURE__ */ __name((ast) => {
14489
14499
  searchError("query.unsupported-operator", node.span, `"a b"~N takes words: ${[...NEAR_FIELDS].join(", ")}`);
14490
14500
  if (node.slop !== void 0 && node.slop > MOST_WORDS_APART)
14491
14501
  searchError("query.invalid-number", node.span, `words at most ${MOST_WORDS_APART} apart: "a b"~${MOST_WORDS_APART}`);
14492
- if (field3 && node.operator === "wildcard" && !field3.operators.includes("wildcard"))
14493
- searchError("query.unsupported-operator", node.span, `${field3.name} takes ${field3.operators.join(", ")}`);
14502
+ if (field4 && node.operator === "wildcard" && !field4.operators.includes("wildcard"))
14503
+ searchError("query.unsupported-operator", node.span, `${field4.name} takes ${field4.operators.join(", ")}`);
14494
14504
  }
14495
14505
  return validateQuery(ast, MESSAGES, SEARCH_QUERY);
14496
14506
  }, "validateFields");
@@ -14530,16 +14540,16 @@ var validateAst = /* @__PURE__ */ __name((input) => {
14530
14540
  return validateFields(parsed2.output);
14531
14541
  }, "validateAst");
14532
14542
 
14533
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
14543
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
14534
14544
  var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
14535
14545
  var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
14536
14546
  var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
14537
14547
 
14538
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
14548
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
14539
14549
  var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
14540
14550
  var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
14541
- var linkMatch = /* @__PURE__ */ __name((field3, typed, mail, mentioned2) => {
14542
- if (field3 === "url") {
14551
+ var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
14552
+ if (field4 === "url") {
14543
14553
  const value = normalizedValue(typed);
14544
14554
  const origin = mail ? trackedOrigin(value) : void 0;
14545
14555
  if (origin === void 0)
@@ -14559,7 +14569,7 @@ var linkMatch = /* @__PURE__ */ __name((field3, typed, mail, mentioned2) => {
14559
14569
  };
14560
14570
  }, "linkMatch");
14561
14571
 
14562
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
14572
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
14563
14573
  var SETTING = "phoneCountries";
14564
14574
  var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
14565
14575
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
@@ -14590,7 +14600,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
14590
14600
  return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
14591
14601
  }, "valueMatch");
14592
14602
 
14593
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
14603
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
14594
14604
  var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
14595
14605
  if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
14596
14606
  throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
@@ -14618,7 +14628,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
14618
14628
  return 2 * intersection2 / (aa2.size + bb.size);
14619
14629
  }, "vocabularySimilarity");
14620
14630
 
14621
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
14631
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
14622
14632
  import { createHash } from "node:crypto";
14623
14633
  var folded2 = /* @__PURE__ */ __name((name) => {
14624
14634
  try {
@@ -14684,30 +14694,30 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind3, by, options
14684
14694
  });
14685
14695
  }, "guardTagCreation");
14686
14696
 
14687
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
14697
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
14688
14698
  var invalid = /* @__PURE__ */ __name((message2) => {
14689
14699
  throw new CliError("validation_error", message2);
14690
14700
  }, "invalid");
14691
- var record2 = /* @__PURE__ */ __name((value, fields4, field3) => {
14701
+ var record2 = /* @__PURE__ */ __name((value, fields4, field4) => {
14692
14702
  if (!value || typeof value !== "object" || Array.isArray(value))
14693
- return invalid(`${field3} must be an object`);
14703
+ return invalid(`${field4} must be an object`);
14694
14704
  for (const key2 of Object.keys(value))
14695
14705
  if (!fields4.includes(key2))
14696
- invalid(`unknown ${field3} field: ${key2}`);
14706
+ invalid(`unknown ${field4} field: ${key2}`);
14697
14707
  return value;
14698
14708
  }, "record");
14699
- var tagId = /* @__PURE__ */ __name((value, field3) => {
14709
+ var tagId = /* @__PURE__ */ __name((value, field4) => {
14700
14710
  if (typeof value !== "string" || value.length > 16 || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
14701
- return invalid(`${field3} must be a positive canonical tag id`);
14711
+ return invalid(`${field4} must be a positive canonical tag id`);
14702
14712
  return value;
14703
14713
  }, "tagId");
14704
14714
  var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
14705
14715
  const input = record2(snapshot2, ["complete", "tags", "redirects"], "snapshot");
14706
14716
  if (input.complete !== true)
14707
14717
  invalid("snapshot.complete must be true; partial tag graphs cannot resolve labels");
14708
- for (const field3 of ["tags", "redirects"])
14709
- if (!Array.isArray(input[field3]) || input[field3].length > 4096)
14710
- invalid(`snapshot.${field3} must be an array of at most 4096 rows`);
14718
+ for (const field4 of ["tags", "redirects"])
14719
+ if (!Array.isArray(input[field4]) || input[field4].length > 4096)
14720
+ invalid(`snapshot.${field4} must be an array of at most 4096 rows`);
14711
14721
  const ids = /* @__PURE__ */ new Set();
14712
14722
  for (const [index2, value] of snapshot2.tags.entries()) {
14713
14723
  const row2 = record2(value, ["id", "kind"], `tags[${index2}]`);
@@ -14761,7 +14771,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
14761
14771
  };
14762
14772
  }, "createTagRedirectIndex");
14763
14773
 
14764
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
14774
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
14765
14775
  var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
14766
14776
  const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
14767
14777
  if (!row2)
@@ -14789,7 +14799,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
14789
14799
  return snapshot2;
14790
14800
  }, "tagRedirectSnapshot");
14791
14801
 
14792
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
14802
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
14793
14803
  import { createHash as createHash2 } from "node:crypto";
14794
14804
  var TASK_KEY_PREFIXES = {
14795
14805
  question: "Q",
@@ -14817,7 +14827,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
14817
14827
  return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
14818
14828
  }, "taskAccountOf");
14819
14829
 
14820
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
14830
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
14821
14831
  var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
14822
14832
  var REFERABLE = {
14823
14833
  note: { tombstone: true },
@@ -14975,7 +14985,7 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
14975
14985
  }, "taskIdOf");
14976
14986
  var canonicalThingReference = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith("meeting:") ? canonicalMeetingReference(reference2) : canonicalReference(reference2), "canonicalThingReference");
14977
14987
 
14978
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
14988
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
14979
14989
  var toMs = /* @__PURE__ */ __name((iso11) => {
14980
14990
  if (iso11 === null || iso11 === void 0)
14981
14991
  return null;
@@ -14989,7 +14999,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
14989
14999
  var DELIVERY = { delivered: 1, read: 2 };
14990
15000
  var deliveryOf = /* @__PURE__ */ __name((stored3) => stored3 === DELIVERY.read ? "read" : stored3 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
14991
15001
 
14992
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
15002
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
14993
15003
  var TAG_KINDS = ["tag", "topic"];
14994
15004
  var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
14995
15005
  var TAG_TYPE = {
@@ -15057,12 +15067,19 @@ var createTag = /* @__PURE__ */ __name((context, name, kind3, by, options = {})
15057
15067
  var ensureTag = /* @__PURE__ */ __name((context, name) => {
15058
15068
  return canonicalTagNamed(context.database, name) ?? createTag(context, name, "tag", "owner");
15059
15069
  }, "ensureTag");
15070
+ var taskTagsChanged = /* @__PURE__ */ __name((context, thing, changes, author) => {
15071
+ if (thing.type !== "task" || [...changes.added ?? [], ...changes.removed ?? []].length === 0)
15072
+ return;
15073
+ const at = context.now();
15074
+ context.database.prepare("UPDATE tasks SET updated_at = ? WHERE id = ?").run(at, thing.id);
15075
+ context.database.prepare("INSERT INTO task_events (task_id, actor_type, actor_id, kind, changes, created_at) VALUES (?, ?, ?, 'tags', ?, ?)").run(thing.id, author?.type ?? null, author?.id ?? null, JSON.stringify({ tags: [changes.removed ?? [], changes.added ?? []] }), at);
15076
+ }, "taskTagsChanged");
15060
15077
  var addTags = /* @__PURE__ */ __name((context, thing, tags, source2 = "owner", author) => {
15061
15078
  const { database, now: now2 } = context;
15062
15079
  const insert = database.prepare("INSERT INTO taggings (tag_id, taggable_type, taggable_id, main, source, author_type, author_id, created_at, updated_at) VALUES (?, ?, ?, 0, ?, ?, ?, ?, ?) ON CONFLICT (tag_id, taggable_type, taggable_id) DO NOTHING");
15063
15080
  const claim3 = database.prepare("UPDATE taggings SET source = 'owner', updated_at = ? WHERE tag_id = ? AND taggable_type = ? AND taggable_id = ? AND source <> 'owner'");
15064
15081
  const at = now2();
15065
- return tags.filter((name) => {
15082
+ const fresh = tags.filter((name) => {
15066
15083
  const tag2 = ensureTag(context, name);
15067
15084
  const held = database.prepare("SELECT source,author_type,author_id FROM taggings WHERE tag_id IN (SELECT ? UNION ALL SELECT source_id FROM tag_redirects WHERE survivor_id=?) AND taggable_type=? AND taggable_id=?").all(tag2.id, tag2.id, thing.type, thing.id);
15068
15085
  if (held.some((row2) => row2.source === source2 && row2.author_type === (author?.type ?? null) && row2.author_id === (author?.id ?? null)))
@@ -15072,10 +15089,13 @@ var addTags = /* @__PURE__ */ __name((context, thing, tags, source2 = "owner", a
15072
15089
  claim3.run(at, tag2.id, thing.type, thing.id);
15073
15090
  return added && held.length === 0;
15074
15091
  });
15092
+ taskTagsChanged(context, thing, { added: fresh }, author);
15093
+ return fresh;
15075
15094
  }, "addTags");
15076
- var removeTags = /* @__PURE__ */ __name(({ database }, thing, tags, source2) => {
15095
+ var removeTags = /* @__PURE__ */ __name((context, thing, tags, source2) => {
15096
+ const { database } = context;
15077
15097
  const remove = database.prepare("DELETE FROM taggings WHERE tag_id=? AND taggable_type=? AND taggable_id=?");
15078
- return tags.filter((name) => {
15098
+ const removed = tags.filter((name) => {
15079
15099
  const tag2 = canonicalTagNamed(database, name);
15080
15100
  if (!tag2)
15081
15101
  return false;
@@ -15105,6 +15125,8 @@ var removeTags = /* @__PURE__ */ __name(({ database }, thing, tags, source2) =>
15105
15125
  }
15106
15126
  return changed;
15107
15127
  });
15128
+ taskTagsChanged(context, thing, { removed });
15129
+ return removed;
15108
15130
  }, "removeTags");
15109
15131
  var liveTagging = /* @__PURE__ */ __name((alias2) => `NOT (${alias2}.taggable_type = 'document' AND EXISTS (SELECT 1 FROM documents dt WHERE dt.id = ${alias2}.taggable_id AND dt.deleted_at IS NOT NULL))`, "liveTagging");
15110
15132
  var labelsOf = /* @__PURE__ */ __name((database, thing, tag2) => database.prepare(`SELECT t.name,CASE WHEN min(g.source)='file' AND max(g.source)='file' THEN 'file' ELSE 'owner' END AS source FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE g.taggable_type=? AND g.taggable_id=?${tag2 === void 0 ? "" : " AND t.name = ?"} GROUP BY t.canonical_id ORDER BY t.name`).all(thing.type, thing.id, ...tag2 === void 0 ? [] : [tag2]).map((row2) => ({ tag: String(row2.name), origin: row2.source === "file" ? "file" : "owner" })), "labelsOf");
@@ -15180,7 +15202,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
15180
15202
  return result;
15181
15203
  }, "tagsOf");
15182
15204
 
15183
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
15205
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
15184
15206
  var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
15185
15207
  var SPEECH = speech("att");
15186
15208
  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");
@@ -15217,8 +15239,8 @@ var wordMatch = /* @__PURE__ */ __name((corpus, match) => ({
15217
15239
  exact: true,
15218
15240
  fts: match
15219
15241
  }), "wordMatch");
15220
- var tooManyWords = /* @__PURE__ */ __name(({ field: field3, operator, value, span }, alone) => {
15221
- const term = `${field3}:${operator === "regex" ? `/${value}/` : value}`;
15242
+ var tooManyWords = /* @__PURE__ */ __name(({ field: field4, operator, value, span }, alone) => {
15243
+ const term = `${field4}:${operator === "regex" ? `/${value}/` : value}`;
15222
15244
  throw new CliError("validation_error", `search: ${term}${alone ? " matches" : " and the patterns before it match"} more than ${QUERY_LIMITS2.expansions} indexed words, the term expansions budget \u2014 use a longer prefix, or body:/\u2026/ inside one chat`, {
15223
15245
  reason: "query.too-large",
15224
15246
  budget: "term expansions",
@@ -15430,13 +15452,13 @@ var mentions2 = /* @__PURE__ */ __name((node, scope3) => {
15430
15452
  searchError("query.invalid-reference", node.span);
15431
15453
  return always(mentioned(scope3, `mn.status = 'linked' AND (${target[0]})`, target[1]));
15432
15454
  }, "mentions");
15433
- var link = /* @__PURE__ */ __name((field3) => ({ value }, scope3) => always({
15434
- ...linkMatch(field3, value, scope3.mail, (where, params) => mentioned(scope3, where, params)),
15455
+ var link = /* @__PURE__ */ __name((field4) => ({ value }, scope3) => always({
15456
+ ...linkMatch(field4, value, scope3.mail, (where, params) => mentioned(scope3, where, params)),
15435
15457
  exact: true
15436
15458
  }), "link");
15437
- var found = /* @__PURE__ */ __name(({ field: field3, value }, scope3) => {
15438
- const match = field3 === "domain" ? void 0 : valueMatch(scope3.database, value);
15439
- return always(match === void 0 ? mentioned(scope3, "mn.domain = ? AND mn.status <> 'dismissed'", [siteOf(value.toLowerCase())]) : mentioned(scope3, `mn.kind = ? AND ${match.sql} AND mn.status <> 'dismissed'`, [field3, ...match.params]));
15459
+ var found = /* @__PURE__ */ __name(({ field: field4, value }, scope3) => {
15460
+ const match = field4 === "domain" ? void 0 : valueMatch(scope3.database, value);
15461
+ return always(match === void 0 ? mentioned(scope3, "mn.domain = ? AND mn.status <> 'dismissed'", [siteOf(value.toLowerCase())]) : mentioned(scope3, `mn.kind = ? AND ${match.sql} AND mn.status <> 'dismissed'`, [field4, ...match.params]));
15440
15462
  }, "found");
15441
15463
  var tag = /* @__PURE__ */ __name((node, { corpus, database }) => {
15442
15464
  const selected = tagOf(node.value);
@@ -15535,7 +15557,7 @@ var FIELD_COMPILERS = {
15535
15557
  subject
15536
15558
  };
15537
15559
 
15538
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
15560
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
15539
15561
  var placeOf = /* @__PURE__ */ __name((database) => {
15540
15562
  const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
15541
15563
  const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
@@ -15551,7 +15573,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
15551
15573
  };
15552
15574
  }, "placeOf");
15553
15575
 
15554
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
15576
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
15555
15577
  var DRAIN_ON_WRITE = 500;
15556
15578
  var METHOD = "rules";
15557
15579
  var telegramLink = /* @__PURE__ */ __name((database) => {
@@ -15714,7 +15736,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
15714
15736
  return queued.length;
15715
15737
  }, "drainMentions");
15716
15738
 
15717
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
15739
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
15718
15740
  var indexRow = /* @__PURE__ */ __name((database, name) => {
15719
15741
  const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
15720
15742
  if (!exists2)
@@ -15722,7 +15744,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
15722
15744
  return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
15723
15745
  }, "indexRow");
15724
15746
 
15725
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
15747
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
15726
15748
  var INDEX = "message_stems";
15727
15749
  var SETTING2 = "searchStemmers";
15728
15750
  var DRAIN_ON_WRITE2 = 500;
@@ -15844,7 +15866,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
15844
15866
  };
15845
15867
  }, "stemmerCache");
15846
15868
 
15847
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
15869
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
15848
15870
  var SQLITE_BUSY = 5;
15849
15871
  var pause = new Int32Array(new SharedArrayBuffer(4));
15850
15872
  var isBusy = /* @__PURE__ */ __name((error) => {
@@ -15939,7 +15961,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
15939
15961
  }
15940
15962
  }, "read");
15941
15963
 
15942
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
15964
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
15943
15965
  var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
15944
15966
  coalesce(CASE k.chunkable_type
15945
15967
  WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
@@ -16081,7 +16103,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
16081
16103
  }, "dropUnusedVectors");
16082
16104
  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");
16083
16105
 
16084
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
16106
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
16085
16107
  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({
16086
16108
  target: [accounts.provider, accounts.externalId],
16087
16109
  set: {
@@ -16187,7 +16209,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
16187
16209
  AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
16188
16210
  }, "dropOrphanPeople");
16189
16211
 
16190
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
16212
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
16191
16213
  var FOLDED = [
16192
16214
  { table: "tasks", column: "title" },
16193
16215
  { table: "tasks", column: "close_reason" },
@@ -16224,7 +16246,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
16224
16246
  return filled2;
16225
16247
  }, "fillFolded");
16226
16248
 
16227
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
16249
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
16228
16250
  import { createHash as createHash3 } from "node:crypto";
16229
16251
  var CHUNK_CHARS = 1200;
16230
16252
  var CHUNK_OVERLAP = 150;
@@ -16329,7 +16351,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
16329
16351
  return chunks2;
16330
16352
  }, "cutChunks");
16331
16353
 
16332
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/task-signature.js
16354
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/search/task-signature.js
16333
16355
  var DAY = 864e5;
16334
16356
  var CURRENCY = [
16335
16357
  [/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
@@ -16446,7 +16468,7 @@ var dueDayOf = /* @__PURE__ */ __name((text5, createdMs) => {
16446
16468
  return best?.day ?? null;
16447
16469
  }, "dueDayOf");
16448
16470
 
16449
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
16471
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
16450
16472
  var DAY2 = 864e5;
16451
16473
  var STOP_WORDS = new Set([
16452
16474
  // Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
@@ -16549,7 +16571,7 @@ var LEVEL_REASONS = {
16549
16571
  person: { same: "same person", different: "different person" },
16550
16572
  amount: { equal: "same amount", different: "different amount" }
16551
16573
  };
16552
- var weightOf = /* @__PURE__ */ __name((field3, level) => TASK_SIMILARITY_WEIGHTS[field3][level].weight, "weightOf");
16574
+ var weightOf = /* @__PURE__ */ __name((field4, level) => TASK_SIMILARITY_WEIGHTS[field4][level].weight, "weightOf");
16553
16575
  var plural = /* @__PURE__ */ __name((count, word) => `${count} ${word}${count === 1 ? "" : "s"}`, "plural");
16554
16576
  var bandOf = /* @__PURE__ */ __name((score) => score >= TASK_SIMILARITY_BANDS.likely ? "likely" : score >= TASK_SIMILARITY_BANDS.maybe ? "maybe" : "different", "bandOf");
16555
16577
  var compareTasks = /* @__PURE__ */ __name((a, b, { replyChain = false } = {}) => {
@@ -16601,7 +16623,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
16601
16623
  ...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
16602
16624
  })).sort((a, b) => b.score - a.score), "rankCandidates");
16603
16625
 
16604
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
16626
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
16605
16627
  var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
16606
16628
  r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
16607
16629
  JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
@@ -16872,7 +16894,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
16872
16894
  };
16873
16895
  }, "readiness");
16874
16896
 
16875
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
16897
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
16876
16898
  var DOCUMENT_PICTURE = "document_picture";
16877
16899
  var SCAN_PAGE2 = 5e3;
16878
16900
  var idOf = /* @__PURE__ */ __name((ref3) => {
@@ -16935,7 +16957,7 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
16935
16957
  }, "nearestPictures")
16936
16958
  }), "documentPicturesOver");
16937
16959
 
16938
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
16960
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
16939
16961
  var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
16940
16962
  const literal4 = escaped2 ?? plain2 ?? "";
16941
16963
  return wildcard ?? (/[*?[]/u.test(literal4) ? `[${literal4}]` : literal4);
@@ -17000,7 +17022,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
17000
17022
  var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
17001
17023
  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");
17002
17024
 
17003
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
17025
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
17004
17026
  var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
17005
17027
  var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
17006
17028
  var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
@@ -17090,7 +17112,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
17090
17112
  });
17091
17113
  }, "linkMeeting");
17092
17114
 
17093
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
17115
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
17094
17116
  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), ''))";
17095
17117
  var UNSEARCHED_EVENT_TYPES = [
17096
17118
  "working-location",
@@ -17165,7 +17187,7 @@ var holdingText = /* @__PURE__ */ __name((type, column2, search2) => {
17165
17187
  if ([...text5].length < 3)
17166
17188
  throw new CliError("validation_error", "search needs at least three characters");
17167
17189
  const queued = `SELECT id FROM ${type}_index_pending WHERE indexable_type = '${type}'`;
17168
- const state = /* @__PURE__ */ __name((field3) => `(SELECT ${field3} FROM search_index_state WHERE name = '${type}_trigrams')`, "state");
17190
+ const state = /* @__PURE__ */ __name((field4) => `(SELECT ${field4} FROM search_index_state WHERE name = '${type}_trigrams')`, "state");
17169
17191
  return {
17170
17192
  sql: `${column2} IN (SELECT rowid FROM ${type}_trigrams WHERE ${type}_trigrams MATCH ? AND rowid NOT IN (${queued}) UNION ALL SELECT r.id FROM ${type}s r WHERE (r.id IN (${queued}) OR (r.id > ${state("filled_through")} AND r.id <= ${state("watermark")})) AND instr(lower(coalesce(r.body, '')), lower(?)) > 0)`,
17171
17193
  params: [`"${text5.replaceAll('"', '""')}"`, search2]
@@ -17320,7 +17342,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
17320
17342
  return true;
17321
17343
  }, "resetNoteIndex");
17322
17344
 
17323
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
17345
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
17324
17346
  var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
17325
17347
  var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
17326
17348
  for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
@@ -17339,7 +17361,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
17339
17361
  }
17340
17362
  }, "resolvePersonLinks");
17341
17363
 
17342
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
17364
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
17343
17365
  var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
17344
17366
  var prepare = /* @__PURE__ */ __name((orm) => ({
17345
17367
  find: orm.select({
@@ -17564,7 +17586,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
17564
17586
  }, "meetingIdentityPk");
17565
17587
  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");
17566
17588
 
17567
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
17589
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
17568
17590
  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");
17569
17591
  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");
17570
17592
  var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
@@ -17844,7 +17866,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
17844
17866
  }
17845
17867
  }, "replaceAutoTags");
17846
17868
 
17847
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
17869
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
17848
17870
  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");
17849
17871
  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;
17850
17872
  var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
@@ -17925,7 +17947,7 @@ var mailCore = /* @__PURE__ */ __name((body2, earlier) => {
17925
17947
  return withoutSignOff(withoutGreeting(kept)).join("\n").trim();
17926
17948
  }, "mailCore");
17927
17949
 
17928
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
17950
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
17929
17951
  var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
17930
17952
  var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
17931
17953
  k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
@@ -18035,7 +18057,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
18035
18057
  return emails3 + threads;
18036
18058
  }, "drainEmailIndex");
18037
18059
 
18038
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
18060
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
18039
18061
  var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
18040
18062
  SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
18041
18063
  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,
@@ -18081,7 +18103,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
18081
18103
  leave.run(emailId, Number(box.id), emailId, Number(box.id));
18082
18104
  }, "forgetLocations");
18083
18105
 
18084
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
18106
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
18085
18107
  var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
18086
18108
  emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
18087
18109
  last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
@@ -18131,7 +18153,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
18131
18153
  return threads.length;
18132
18154
  }, "markEmailsRestored");
18133
18155
 
18134
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
18156
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
18135
18157
  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");
18136
18158
  var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
18137
18159
  var ruleOf = /* @__PURE__ */ __name((row2) => ({
@@ -18198,7 +18220,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
18198
18220
  }
18199
18221
  }), "mailRulesOver");
18200
18222
 
18201
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
18223
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
18202
18224
  var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
18203
18225
  database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
18204
18226
  VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
@@ -18206,7 +18228,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
18206
18228
  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);
18207
18229
  }, "reviewLink");
18208
18230
 
18209
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
18231
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
18210
18232
  function checkMeetingCancelled(signal) {
18211
18233
  if (!signal?.aborted)
18212
18234
  return;
@@ -18217,7 +18239,7 @@ function checkMeetingCancelled(signal) {
18217
18239
  }
18218
18240
  __name(checkMeetingCancelled, "checkMeetingCancelled");
18219
18241
 
18220
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
18242
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
18221
18243
  var meetingOf = /* @__PURE__ */ __name((row2) => ({
18222
18244
  id: Number(row2.id),
18223
18245
  accountId: Number(row2.account_id),
@@ -18267,7 +18289,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
18267
18289
  createdAt: Number(row2.created_at)
18268
18290
  }), "transcriptRowOf");
18269
18291
 
18270
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
18292
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
18271
18293
  var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
18272
18294
  var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
18273
18295
  var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
@@ -18434,7 +18456,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
18434
18456
  }
18435
18457
  }), "meetingReadsOver");
18436
18458
 
18437
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
18459
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
18438
18460
  var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
18439
18461
  const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
18440
18462
  const params = [input.accountId];
@@ -18477,7 +18499,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
18477
18499
  return { clauses, params };
18478
18500
  }, "meetingSelectionSql");
18479
18501
 
18480
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
18502
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
18481
18503
  var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
18482
18504
  async meetingChatLines(input) {
18483
18505
  checkMeetingCancelled(input.signal);
@@ -18505,7 +18527,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
18505
18527
  }
18506
18528
  }), "meetingChatLinesOver");
18507
18529
 
18508
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
18530
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
18509
18531
  var MESSAGE_FIELDS = {
18510
18532
  pk: messages.id,
18511
18533
  nativeId: messages.externalId,
@@ -18672,7 +18694,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
18672
18694
  storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
18673
18695
  }), "chatActivity");
18674
18696
 
18675
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
18697
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
18676
18698
  var HIT_FIELDS = {
18677
18699
  ...MESSAGE_FIELDS,
18678
18700
  chatTitle: sql`${chats.title}`.as("chat_title"),
@@ -18771,7 +18793,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
18771
18793
  };
18772
18794
  }, "directReplies");
18773
18795
 
18774
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
18796
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
18775
18797
  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");
18776
18798
  var required = /* @__PURE__ */ __name((context, ref3) => {
18777
18799
  const found2 = identityRow(context, ref3);
@@ -18902,7 +18924,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
18902
18924
  }, "mentioning");
18903
18925
  var escaped = /* @__PURE__ */ __name((text5) => text5.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
18904
18926
 
18905
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
18927
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
18906
18928
  var missing2 = /* @__PURE__ */ __name(() => {
18907
18929
  throw new CliError("not_found", "Meeting, participant or selected target not found");
18908
18930
  }, "missing");
@@ -19024,7 +19046,7 @@ function meetingContextLinksOver(context) {
19024
19046
  }
19025
19047
  __name(meetingContextLinksOver, "meetingContextLinksOver");
19026
19048
 
19027
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
19049
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
19028
19050
  var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
19029
19051
  var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
19030
19052
  var summaryOf = /* @__PURE__ */ __name((row2) => ({
@@ -19053,7 +19075,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
19053
19075
  return row2 ? summaryText(summaryOf(row2)) : null;
19054
19076
  }, "indexedText");
19055
19077
 
19056
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
19078
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
19057
19079
  var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
19058
19080
  var meetingCurrentIndexRows = `
19059
19081
  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
@@ -19084,7 +19106,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
19084
19106
  }, "invalidateMeetingStems");
19085
19107
  var meetingStemmableText = /* @__PURE__ */ __name((text5) => text5.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
19086
19108
 
19087
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
19109
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
19088
19110
  function meetingHitIndexOver({ database, now: now2 }) {
19089
19111
  return {
19090
19112
  async indexSearch(original) {
@@ -19152,10 +19174,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
19152
19174
  }
19153
19175
  __name(meetingHitIndexOver, "meetingHitIndexOver");
19154
19176
 
19155
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19177
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19156
19178
  import { createHash as createHash4 } from "node:crypto";
19157
19179
 
19158
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/trigrams.js
19180
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/search/trigrams.js
19159
19181
  var trigrams = /* @__PURE__ */ __name((term) => {
19160
19182
  const padded = ` ${term} `;
19161
19183
  const pieces = /* @__PURE__ */ new Set();
@@ -19164,7 +19186,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
19164
19186
  return [...pieces];
19165
19187
  }, "trigrams");
19166
19188
 
19167
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/correct.js
19189
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/search/correct.js
19168
19190
  var SHORTEST_CORRECTION = 3;
19169
19191
  var maxEdits = /* @__PURE__ */ __name((word) => word.length <= 4 ? 1 : 2, "maxEdits");
19170
19192
  var editDistance = /* @__PURE__ */ __name((a, b, max) => {
@@ -19211,7 +19233,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
19211
19233
  return corrections;
19212
19234
  }, "correctWords");
19213
19235
 
19214
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/garbled.js
19236
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/search/garbled.js
19215
19237
  var SHORTEST_GARBLED = 4;
19216
19238
  var MOST_WIDENED = 64;
19217
19239
  var plain = /* @__PURE__ */ __name((word) => word.replaceAll("\u044D", "\u0435"), "plain");
@@ -19303,7 +19325,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
19303
19325
  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));
19304
19326
  }, "widenWords");
19305
19327
 
19306
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
19328
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
19307
19329
  import { readFileSync } from "node:fs";
19308
19330
  var loaded;
19309
19331
  var dictionary = /* @__PURE__ */ __name(() => {
@@ -19362,7 +19384,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word) => {
19362
19384
  return false;
19363
19385
  }, "knownRussianWord");
19364
19386
 
19365
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
19387
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
19366
19388
  var WORD2 = /[\p{L}\p{N}\p{M}]+/gu;
19367
19389
  var MOST_WORDS = 128;
19368
19390
  var quote = /* @__PURE__ */ __name((word) => `"${word.replaceAll('"', '""')}"`, "quote");
@@ -19589,7 +19611,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text5, stemmer) => {
19589
19611
  return check3(tree);
19590
19612
  }, "matchMeetingText");
19591
19613
 
19592
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19614
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19593
19615
  var fail3 = /* @__PURE__ */ __name((message2) => {
19594
19616
  throw new CliError("validation_error", message2);
19595
19617
  }, "fail");
@@ -19766,7 +19788,7 @@ function meetingHitSearchOver({ database }) {
19766
19788
  }
19767
19789
  __name(meetingHitSearchOver, "meetingHitSearchOver");
19768
19790
 
19769
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
19791
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
19770
19792
  import { createHash as createHash5 } from "node:crypto";
19771
19793
  var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
19772
19794
  if (value === void 0)
@@ -19856,7 +19878,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
19856
19878
  }
19857
19879
  }), "meetingParticipantSearchOver");
19858
19880
 
19859
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
19881
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
19860
19882
  var preparationQueries = {
19861
19883
  participants: {
19862
19884
  fields: "p.id, p.identity_id, p.display_name, l.person_id",
@@ -19906,7 +19928,7 @@ var preparationQueries = {
19906
19928
  }
19907
19929
  };
19908
19930
 
19909
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
19931
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
19910
19932
  var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
19911
19933
  async preparationContext(original) {
19912
19934
  const input = validateMeetingPreparationContext(original);
@@ -19920,7 +19942,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
19920
19942
  let total = 0;
19921
19943
  for (const key2 of keys) {
19922
19944
  const query = preparationQueries[key2];
19923
- const bytes3 = query.text.map((field3) => `coalesce(length(CAST(${field3} AS BLOB)),0)`).join("+");
19945
+ const bytes3 = query.text.map((field4) => `coalesce(length(CAST(${field4} AS BLOB)),0)`).join("+");
19924
19946
  const probe = database.prepare(`SELECT coalesce(sum(read_bytes),0) AS read_bytes FROM (SELECT ${bytes3} AS read_bytes ${query.from})`).get(...params(key2));
19925
19947
  total += Number(probe?.read_bytes);
19926
19948
  if (!Number.isSafeInteger(total) || total < 0 || total > maxReadBytes)
@@ -19947,7 +19969,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
19947
19969
  }
19948
19970
  }), "meetingPreparationContextOver");
19949
19971
 
19950
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
19972
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
19951
19973
  var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
19952
19974
  SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
19953
19975
  WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
@@ -19961,7 +19983,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
19961
19983
  JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
19962
19984
  )`, "preparationSubjects");
19963
19985
 
19964
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
19986
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
19965
19987
  var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
19966
19988
  async preparationKnowledge(original) {
19967
19989
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -20006,7 +20028,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
20006
20028
  }
20007
20029
  }), "meetingPreparationKnowledgeOver");
20008
20030
 
20009
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
20031
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
20010
20032
  var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
20011
20033
  async preparationNotes(original) {
20012
20034
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -20059,7 +20081,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
20059
20081
  }
20060
20082
  }), "meetingPreparationNotesOver");
20061
20083
 
20062
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
20084
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
20063
20085
  var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20064
20086
  async relatedHistory(original) {
20065
20087
  const input = validateMeetingRelatedHistory(original);
@@ -20130,7 +20152,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20130
20152
  }
20131
20153
  }), "meetingRelatedHistoryOver");
20132
20154
 
20133
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
20155
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
20134
20156
  var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
20135
20157
  var text2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
20136
20158
  var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
@@ -20211,7 +20233,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
20211
20233
  }
20212
20234
  }), "meetingReviewOver");
20213
20235
 
20214
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
20236
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
20215
20237
  var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
20216
20238
  var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
20217
20239
  if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
@@ -20265,7 +20287,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20265
20287
  }
20266
20288
  }), "meetingSeriesHistoryOver");
20267
20289
 
20268
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
20290
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
20269
20291
  var MOST_ROWS = 5e5;
20270
20292
  var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
20271
20293
  async meetingStats(input) {
@@ -20312,7 +20334,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
20312
20334
  }
20313
20335
  }), "meetingStatsOver");
20314
20336
 
20315
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
20337
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
20316
20338
  var CURSOR_KEY = "meetings";
20317
20339
  var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
20318
20340
  id: Number(row2.id),
@@ -20864,7 +20886,7 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
20864
20886
  };
20865
20887
  }, "meetingStoreOver");
20866
20888
 
20867
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
20889
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
20868
20890
  var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
20869
20891
  const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
20870
20892
  return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
@@ -20890,7 +20912,7 @@ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
20890
20912
  orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
20891
20913
  }, "release");
20892
20914
 
20893
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
20915
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
20894
20916
  var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
20895
20917
  id: `email:${place.emailId}`,
20896
20918
  chatId: place.threadExternalId,
@@ -21043,9 +21065,9 @@ var saveEmail = /* @__PURE__ */ __name((database, orm, accountId, threadId, mail
21043
21065
  ["metadata", "metadata", toJson],
21044
21066
  ["mailRuleId", "mail_rule_id", (v) => v]
21045
21067
  ];
21046
- for (const [field3, column2, encode] of optional)
21047
- if (mail[field3] !== void 0)
21048
- values.push([column2, encode(mail[field3])]);
21068
+ for (const [field4, column2, encode] of optional)
21069
+ if (mail[field4] !== void 0)
21070
+ values.push([column2, encode(mail[field4])]);
21049
21071
  const found2 = database.prepare("SELECT id, email_thread_id FROM emails WHERE account_id = ? AND external_id = ?").get(accountId, mail.externalId);
21050
21072
  let emailId;
21051
21073
  if (found2) {
@@ -21055,13 +21077,13 @@ var saveEmail = /* @__PURE__ */ __name((database, orm, accountId, threadId, mail
21055
21077
  const columns = ["account_id", "external_id", ...values.map(([c]) => c), "created_at", "updated_at"];
21056
21078
  emailId = Number(database.prepare(`INSERT INTO emails (${columns.join(", ")}) VALUES (${columns.map(() => "?").join(", ")}) RETURNING id`).get(accountId, mail.externalId, ...values.map(([, v]) => v), now2, now2)?.id);
21057
21079
  }
21058
- if (ROLES.some(([field3]) => mail[field3] !== void 0)) {
21080
+ if (ROLES.some(([field4]) => mail[field4] !== void 0)) {
21059
21081
  database.prepare("DELETE FROM email_recipients WHERE email_id = ?").run(emailId);
21060
21082
  const insert = database.prepare(`INSERT INTO email_recipients (email_id, identity_id, address, name, role, position, created_at, updated_at)
21061
21083
  VALUES (?, ?, ?, ?, ?, ?, ?, ?)`);
21062
21084
  let position2 = 0;
21063
- for (const [field3, role] of ROLES)
21064
- for (const recipient2 of mail[field3] ?? []) {
21085
+ for (const [field4, role] of ROLES)
21086
+ for (const recipient2 of mail[field4] ?? []) {
21065
21087
  const address = recipient2.address.trim().toLowerCase();
21066
21088
  const identity = addressIdentity(database, orm, accountId, recipient2, now2);
21067
21089
  insert.run(emailId, identity, address, recipient2.name, role, position2++, now2, now2);
@@ -21447,7 +21469,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
21447
21469
  }
21448
21470
  }), "mailStoreOver");
21449
21471
 
21450
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/dictionary.js
21472
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/search/dictionary.js
21451
21473
  import { readFileSync as readFileSync2 } from "node:fs";
21452
21474
  var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
21453
21475
  var folded4 = /* @__PURE__ */ __name((word) => /^[а-яё'-]*$/.test(word) ? word.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word), "folded");
@@ -21537,7 +21559,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
21537
21559
  }, "knownWord");
21538
21560
  var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
21539
21561
 
21540
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
21562
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
21541
21563
  var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
21542
21564
  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");
21543
21565
  var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
@@ -21623,7 +21645,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
21623
21645
  return found2;
21624
21646
  }, "spokenTranscripts");
21625
21647
 
21626
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
21648
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
21627
21649
  var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
21628
21650
  const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
21629
21651
  if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
@@ -21670,7 +21692,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
21670
21692
  });
21671
21693
  }, "placeHits");
21672
21694
 
21673
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
21695
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
21674
21696
  var MESSAGES2 = {
21675
21697
  rows: "messages",
21676
21698
  threads: "chats",
@@ -22144,7 +22166,7 @@ var runQuery = /* @__PURE__ */ __name(async (context, execution, by) => {
22144
22166
  };
22145
22167
  }, "runQuery");
22146
22168
 
22147
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
22169
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
22148
22170
  function invalidMetadata() {
22149
22171
  throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
22150
22172
  }
@@ -22182,10 +22204,10 @@ var counterStates = /* @__PURE__ */ __name(({ database }, messagePk, now2, maxAg
22182
22204
  }, "counterStates");
22183
22205
  var applyCounterObservations = /* @__PURE__ */ __name((context, messagePk, observations) => {
22184
22206
  const { database, now: now2 } = context;
22185
- const validated = Object.entries(observations).map(([field3, observation]) => {
22186
- if (!COUNTER_FIELDS.includes(field3) || !observation)
22207
+ const validated = Object.entries(observations).map(([field4, observation]) => {
22208
+ if (!COUNTER_FIELDS.includes(field4) || !observation)
22187
22209
  throw new CliError("validation_error", "unknown counter observation field");
22188
- return { field: field3, observation, at: counterObservationTime(observation, now2()) };
22210
+ return { field: field4, observation, at: counterObservationTime(observation, now2()) };
22189
22211
  });
22190
22212
  if (!validated.length)
22191
22213
  return 0;
@@ -22207,20 +22229,20 @@ var applyCounterObservations = /* @__PURE__ */ __name((context, messagePk, obser
22207
22229
  const metadata3 = validated.some((one) => one.field !== "reactions") ? object(message2.metadata) : {};
22208
22230
  let reactions = message2.reactions === null ? null : String(message2.reactions);
22209
22231
  let updated = 0;
22210
- for (const { field: field3, observation, at } of validated) {
22211
- const existing = database.prepare("SELECT value,created_at FROM message_counter_observations WHERE message_id=? AND counter=?").get(messagePk, field3);
22232
+ for (const { field: field4, observation, at } of validated) {
22233
+ const existing = database.prepare("SELECT value,created_at FROM message_counter_observations WHERE message_id=? AND counter=?").get(messagePk, field4);
22212
22234
  const oldWins = existing && Number(existing.created_at) > at;
22213
22235
  const value = oldWins ? Number(existing.value) : observation.value;
22214
- if (field3 === "reactions") {
22236
+ if (field4 === "reactions") {
22215
22237
  if (!oldWins && observation.reactions)
22216
22238
  reactions = JSON.stringify(observation.reactions);
22217
22239
  else
22218
22240
  reactions = JSON.stringify({ total: value, mine: null, counts: [] });
22219
22241
  } else
22220
- metadata3[field3] = value;
22242
+ metadata3[field4] = value;
22221
22243
  if (oldWins)
22222
22244
  continue;
22223
- database.prepare("INSERT INTO message_counter_observations(message_id,counter,value,created_at,source) VALUES(?,?,?,?,?) ON CONFLICT(message_id,counter) DO UPDATE SET value=excluded.value,created_at=excluded.created_at,source=excluded.source").run(messagePk, field3, value, at, observation.source);
22245
+ database.prepare("INSERT INTO message_counter_observations(message_id,counter,value,created_at,source) VALUES(?,?,?,?,?) ON CONFLICT(message_id,counter) DO UPDATE SET value=excluded.value,created_at=excluded.created_at,source=excluded.source").run(messagePk, field4, value, at, observation.source);
22224
22246
  updated++;
22225
22247
  }
22226
22248
  if (validated.length)
@@ -22246,7 +22268,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
22246
22268
  };
22247
22269
  }), "counterTargets");
22248
22270
 
22249
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
22271
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
22250
22272
  var NOT_FILE_LIST = [...NOT_FILES].map((kind3) => `'${kind3}'`).join(",");
22251
22273
  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,
22252
22274
  att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
@@ -22365,7 +22387,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
22365
22387
  }));
22366
22388
  }, "attachmentViews");
22367
22389
 
22368
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
22390
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
22369
22391
  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");
22370
22392
  var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text5, source2) => {
22371
22393
  const { orm, database, now: now2 } = context;
@@ -22403,7 +22425,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
22403
22425
  keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
22404
22426
  }, "intoVoiceAttachment");
22405
22427
 
22406
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
22428
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
22407
22429
  var FIELDS = [
22408
22430
  "threadExternalId",
22409
22431
  "senderIdentityId",
@@ -22524,9 +22546,9 @@ var upsertMessage = /* @__PURE__ */ __name((context, key2, accountKey, chatKey,
22524
22546
  const previous = JSON.parse(found2.providerMetadata);
22525
22547
  const incoming = JSON.parse(String(fields4.metadata ?? "{}"));
22526
22548
  if (previous && incoming && !Array.isArray(previous) && !Array.isArray(incoming)) {
22527
- for (const field3 of ["views", "comments"])
22528
- if (!validCounter(incoming[field3]) && validCounter(previous[field3]))
22529
- incoming[field3] = previous[field3];
22549
+ for (const field4 of ["views", "comments"])
22550
+ if (!validCounter(incoming[field4]) && validCounter(previous[field4]))
22551
+ incoming[field4] = previous[field4];
22530
22552
  fields4.metadata = JSON.stringify(edit ? { ...previous, ...incoming } : incoming);
22531
22553
  }
22532
22554
  } catch {
@@ -22720,7 +22742,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
22720
22742
  reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
22721
22743
  }, "writeDerivedReactions");
22722
22744
 
22723
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/keys.js
22745
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/keys.js
22724
22746
  var keysOver = /* @__PURE__ */ __name((context) => {
22725
22747
  const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
22726
22748
  const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
@@ -22741,7 +22763,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
22741
22763
  };
22742
22764
  }, "keysOver");
22743
22765
 
22744
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
22766
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
22745
22767
  var accountGroupsOf = /* @__PURE__ */ __name((database) => {
22746
22768
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
22747
22769
  if (!row2)
@@ -22776,7 +22798,7 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
22776
22798
  database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
22777
22799
  }, "saveProfile");
22778
22800
 
22779
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
22801
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
22780
22802
  var BOT_KINDS = ["agent", "script", "integration"];
22781
22803
  var ownerPerson = /* @__PURE__ */ __name((database) => {
22782
22804
  const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
@@ -22812,7 +22834,7 @@ var originOfActor = /* @__PURE__ */ __name((database, type, id2) => {
22812
22834
  return database.prepare("SELECT name FROM bots WHERE id = ?").get(Number(id2))?.name === "rule" ? "rule" : "agent";
22813
22835
  }, "originOfActor");
22814
22836
 
22815
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
22837
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
22816
22838
  var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
22817
22839
  const owner = ownerPerson(context.database).id;
22818
22840
  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);
@@ -22833,7 +22855,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
22833
22855
  return personOf(context, ref3);
22834
22856
  }, "linkToOwner");
22835
22857
 
22836
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
22858
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
22837
22859
  var PROVIDERS_SETTING = "providers";
22838
22860
  var storedProvidersOf = /* @__PURE__ */ __name((database) => {
22839
22861
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
@@ -22868,7 +22890,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
22868
22890
  });
22869
22891
  }, "registerProvider");
22870
22892
 
22871
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
22893
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
22872
22894
  var DAY3 = 864e5;
22873
22895
  var RECENTLY_CLOSED_MS = 14 * DAY3;
22874
22896
  var TEXT_LIMIT = 20;
@@ -23007,7 +23029,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
23007
23029
  drainCorpus(database, CORPORA.task, stemmerFor2);
23008
23030
  const stemmer = stemmerFor2(storeStemmers(database) ?? DEFAULT_STEMMERS);
23009
23031
  const since = now2() - RECENTLY_CLOSED_MS;
23010
- const live2 = "t.project_id = ? AND t.deleted_at IS NULL AND t.id <> ? AND (t.status = 'open' OR t.closed_at >= ?)";
23032
+ const live2 = "t.project_id = ? AND t.deleted_at IS NULL AND t.id <> ? AND (t.status NOT IN ('done', 'dismissed') OR t.closed_at >= ?)";
23011
23033
  const scope3 = [side.project, side.row ?? -1, since];
23012
23034
  const found2 = /* @__PURE__ */ new Map();
23013
23035
  const add = /* @__PURE__ */ __name((id2, by) => found2.set(id2, (found2.get(id2) ?? /* @__PURE__ */ new Set()).add(by)), "add");
@@ -23067,7 +23089,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
23067
23089
  };
23068
23090
  }, "taskSimilarityOver");
23069
23091
 
23070
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
23092
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
23071
23093
  var SETTING3 = "taskCategories";
23072
23094
  var savedTaskCategories = /* @__PURE__ */ __name((database) => {
23073
23095
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
@@ -23076,7 +23098,7 @@ var savedTaskCategories = /* @__PURE__ */ __name((database) => {
23076
23098
  var storeTaskCategories = /* @__PURE__ */ __name((database) => savedTaskCategories(database) ?? DEFAULT_TASK_CATEGORIES, "storeTaskCategories");
23077
23099
  var unlistedTaskCategories = /* @__PURE__ */ __name((database, list) => {
23078
23100
  const listed = new Set(list.map(({ name }) => name));
23079
- return database.prepare("SELECT category, COUNT(*) AS total, SUM(status = 'open') AS open FROM tasks WHERE category IS NOT NULL AND deleted_at IS NULL GROUP BY category ORDER BY category").all().map((row2) => ({ name: String(row2.category), open: Number(row2.open), total: Number(row2.total) })).filter(({ name }) => !listed.has(name));
23101
+ return database.prepare("SELECT category, COUNT(*) AS total, SUM(status NOT IN ('done', 'dismissed')) AS open FROM tasks WHERE category IS NOT NULL AND deleted_at IS NULL GROUP BY category ORDER BY category").all().map((row2) => ({ name: String(row2.category), open: Number(row2.open), total: Number(row2.total) })).filter(({ name }) => !listed.has(name));
23080
23102
  }, "unlistedTaskCategories");
23081
23103
  var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) => {
23082
23104
  if (categories === void 0) {
@@ -23086,7 +23108,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
23086
23108
  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);
23087
23109
  }, "saveTaskCategories");
23088
23110
 
23089
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
23111
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
23090
23112
  var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
23091
23113
  var ALLOWED = "taskAgentClose";
23092
23114
  var MIN = "taskAgentCloseMin";
@@ -23142,7 +23164,7 @@ var SUGGESTION_COLUMNS = [
23142
23164
  ];
23143
23165
  var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
23144
23166
 
23145
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
23167
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
23146
23168
  var EXCERPT_CHARS = 280;
23147
23169
  var excerptOf = /* @__PURE__ */ __name((text5) => {
23148
23170
  if (text5 == null)
@@ -23185,7 +23207,7 @@ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => database.pre
23185
23207
  };
23186
23208
  }), "evidenceSourcesOf");
23187
23209
 
23188
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/limits.js
23210
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/attachments/limits.js
23189
23211
  var MAX_FILE_BYTES = 50 * 1024 * 1024;
23190
23212
  var MAX_TEXT_CHARS = 2e6;
23191
23213
  var ATTACHMENT_LIMIT_ENV = [
@@ -23211,7 +23233,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
23211
23233
  return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
23212
23234
  }, "pdfPreviewLimits");
23213
23235
 
23214
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/ulid.js
23236
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/ulid.js
23215
23237
  import { randomBytes } from "node:crypto";
23216
23238
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
23217
23239
  var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
@@ -23224,16 +23246,16 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
23224
23246
  return time3 + random;
23225
23247
  }, "ulid");
23226
23248
 
23227
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
23249
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
23228
23250
  var FOLDED_FIELDS = ["title", "site", "language", "author"];
23229
23251
  var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
23230
23252
  if (!meta && !sections?.length)
23231
23253
  return null;
23232
23254
  const folded5 = {};
23233
- for (const field3 of FOLDED_FIELDS) {
23234
- const value = meta?.[field3];
23255
+ for (const field4 of FOLDED_FIELDS) {
23256
+ const value = meta?.[field4];
23235
23257
  if (typeof value === "string" && value !== "")
23236
- folded5[field3] = normalize(value);
23258
+ folded5[field4] = normalize(value);
23237
23259
  }
23238
23260
  const keywords = meta?.keywords;
23239
23261
  if (Array.isArray(keywords) && keywords.length)
@@ -23245,7 +23267,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
23245
23267
  return typeof language === "string" && language !== "" ? language : null;
23246
23268
  }, "languageOf");
23247
23269
 
23248
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
23270
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
23249
23271
  var isObject = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
23250
23272
  var objectOf = /* @__PURE__ */ __name((value) => {
23251
23273
  if (isObject(value))
@@ -23488,7 +23510,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
23488
23510
  };
23489
23511
  }, "filesStoreOver");
23490
23512
 
23491
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
23513
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
23492
23514
  var IMPORTED_DOCUMENT_QUERY = defineQuery({
23493
23515
  entity: "document",
23494
23516
  backend: "sql",
@@ -23534,7 +23556,7 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
23534
23556
  return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
23535
23557
  }, "importedDocumentWhere");
23536
23558
 
23537
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
23559
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
23538
23560
  var NOTE_FORMATS = ["obsidian", "markdown"];
23539
23561
  var iso2 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
23540
23562
  var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso2(value), "optionalIso");
@@ -24044,7 +24066,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
24044
24066
  };
24045
24067
  }, "notesStoreOver");
24046
24068
 
24047
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
24069
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
24048
24070
  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";
24049
24071
  var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
24050
24072
  var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -24219,7 +24241,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24219
24241
  };
24220
24242
  }, "memoriesStoreOver");
24221
24243
 
24222
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
24244
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
24223
24245
  var DEFAULT_FIRST_PASS_PER_CHAT = 0;
24224
24246
  var KEY = "taskFirstPassPerChat";
24225
24247
  var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
@@ -24239,7 +24261,181 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
24239
24261
  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);
24240
24262
  }, "saveFirstPassPerChat");
24241
24263
 
24242
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
24264
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
24265
+ var TASK_SORTS = ["priority", "due", "created", "updated", "key", "state"];
24266
+ var field = /* @__PURE__ */ __name((name, type, example, more = {}) => ({
24267
+ name,
24268
+ type,
24269
+ operators: OPERATORS_BY_TYPE[type],
24270
+ example,
24271
+ ...more
24272
+ }), "field");
24273
+ var PROJECT_TASK_FIELDS = [
24274
+ field("state", "enum", "state:todo", { values: TASK_STATES }),
24275
+ field("kind", "enum", "kind:bug", { values: TASK_TYPES }),
24276
+ field("project", "kw", "project:HRB", {
24277
+ relation: "a project by its key or project:<id>; project:* is every project, and lists project tasks only"
24278
+ }),
24279
+ field("assignee", "kw", 'assignee:"person:12"', {
24280
+ relation: "who does it: any, none, or a person (person:12 in quotes, or the bare 12)"
24281
+ }),
24282
+ field("priority", "kw", "priority:high", {
24283
+ operators: ["term", "range", "wildcard"],
24284
+ relation: "low, medium, high, critical or none; a range of labels or of the 0\u20131 number: priority:[high TO critical]"
24285
+ }),
24286
+ field("agent", "kw", "agent:hermes", { relation: "the agent working on it, by name; none or any" }),
24287
+ field("due", "time", "due:[today TO 2026-12-31]", { relation: "the due date; NOT due:* has none" }),
24288
+ field("overdue", "bool", "overdue:true", { relation: "open work whose due date has passed" }),
24289
+ field("closed", "time", "closed:>=14d", { relation: "when it was done or dismissed" }),
24290
+ field("ready", "bool", "ready:true", { relation: "open work whose blocked-by tasks are all done" }),
24291
+ field("text", "txt", "text:invoice", { relation: "words of the title and description; a bare word means this" })
24292
+ ];
24293
+ var OPEN = "t.status NOT IN ('done', 'dismissed')";
24294
+ var OWNER_PROJECTS = `SELECT id FROM projects WHERE deleted_at IS NULL AND length(key) <> ${INBOX_KEY_LENGTH}`;
24295
+ var ASSIGNED = "SELECT 1 FROM task_assignments a WHERE a.task_id = t.id AND a.assignee_type = 'person' AND a.role = 'assignee'";
24296
+ var UNFINISHED_BLOCKER = "SELECT 1 FROM links l LEFT JOIN tasks b ON b.id = l.to_id LEFT JOIN projects bp ON bp.id = b.project_id WHERE l.from_type = 'task' AND l.to_type = 'task' AND l.kind = 'blocked-by' AND l.from_id = t.id AND l.confirmed = 1 AND l.anchor IS NULL AND (b.id IS NULL OR b.deleted_at IS NOT NULL OR bp.deleted_at IS NOT NULL OR b.status <> 'done')";
24297
+ var wordsMatch = /* @__PURE__ */ __name((node) => {
24298
+ const words3 = taskWordsOf(node.value.replaceAll("*", " ")).split(/\s+/).filter((word) => /[\p{L}\p{N}]/u.test(word));
24299
+ if (words3.length === 0)
24300
+ return void 0;
24301
+ const quoted3 = /* @__PURE__ */ __name((text5) => `"${text5.replaceAll('"', '""')}"`, "quoted");
24302
+ return `normalized_text : (${node.operator === "phrase" ? quoted3(words3.join(" ")) : words3.map((word) => `${quoted3(word)}*`).join(" AND ")})`;
24303
+ }, "wordsMatch");
24304
+ var projectWhere = /* @__PURE__ */ __name((node) => {
24305
+ if (node.operator === "wildcard" && node.value === "*")
24306
+ return { sql: "1", params: [] };
24307
+ const id2 = /^project:(\d+)$/.exec(node.value.trim())?.[1];
24308
+ if (id2 !== void 0)
24309
+ return { sql: "t.project_id = ?", params: [Number(id2)] };
24310
+ const key2 = node.value.trim().toUpperCase();
24311
+ return {
24312
+ sql: `t.project_id IN (SELECT id FROM projects WHERE key ${node.operator === "wildcard" ? "GLOB" : "="} ?)`,
24313
+ params: [key2]
24314
+ };
24315
+ }, "projectWhere");
24316
+ var assigneeWhere = /* @__PURE__ */ __name((node) => {
24317
+ const value = node.value.trim().toLowerCase();
24318
+ if (value === "any" || node.operator === "wildcard" && value === "*")
24319
+ return { sql: `EXISTS (${ASSIGNED})`, params: [] };
24320
+ if (value === "none")
24321
+ return { sql: `NOT EXISTS (${ASSIGNED})`, params: [] };
24322
+ const id2 = /^(?:person:)?(\d+)$/.exec(value)?.[1];
24323
+ if (id2 === void 0)
24324
+ throw new CliError("validation_error", `assignee: takes any, none or "person:<id>", not "${node.value}"`);
24325
+ return { sql: `EXISTS (${ASSIGNED} AND a.assignee_id = ?)`, params: [Number(id2)] };
24326
+ }, "assigneeWhere");
24327
+ var bound3 = /* @__PURE__ */ __name((value, side, node) => {
24328
+ const word = value.trim().toLowerCase();
24329
+ if (word === "*")
24330
+ return void 0;
24331
+ if (PRIORITY_LABELS.includes(word))
24332
+ return priorityBand(word)[side];
24333
+ const number3 = Number(word);
24334
+ if (word === "" || !Number.isFinite(number3) || number3 < 0 || number3 > 1)
24335
+ throw new CliError("validation_error", `priority: takes ${PRIORITY_LABELS.join(", ")}, none, or 0 to 1, not "${node.value}"`);
24336
+ return number3;
24337
+ }, "bound");
24338
+ var priorityWhere = /* @__PURE__ */ __name((node) => {
24339
+ const score = "t.priority_score";
24340
+ if (node.operator === "wildcard") {
24341
+ if (node.value === "*")
24342
+ return { sql: `${score} IS NOT NULL`, params: [] };
24343
+ throw new CliError("validation_error", "priority: takes a label, none, or a range");
24344
+ }
24345
+ if (node.operator !== "range") {
24346
+ const word = node.value.trim().toLowerCase();
24347
+ if (word === "none")
24348
+ return { sql: `${score} IS NULL`, params: [] };
24349
+ if (!PRIORITY_LABELS.includes(word))
24350
+ throw new CliError("validation_error", `priority: takes ${PRIORITY_LABELS.join(", ")} or none; a number goes in a range`);
24351
+ const { from: from2, to } = priorityBand(word);
24352
+ return { sql: `${score} >= ? AND ${score} ${to === 1 ? "<=" : "<"} ?`, params: [from2, to] };
24353
+ }
24354
+ const lower = bound3(node.value, "from", node);
24355
+ const upperWord = (node.upper ?? "*").trim().toLowerCase();
24356
+ const upper = bound3(upperWord, "to", node);
24357
+ const labelUpper = PRIORITY_LABELS.includes(upperWord);
24358
+ const parts = [`${score} IS NOT NULL`];
24359
+ const params = [];
24360
+ if (lower !== void 0) {
24361
+ parts.push(`${score} ${node.lower_inclusive === false ? ">" : ">="} ?`);
24362
+ params.push(lower);
24363
+ }
24364
+ if (upper !== void 0) {
24365
+ parts.push(`${score} ${labelUpper ? upper === 1 ? "<=" : "<" : node.upper_inclusive === false ? "<" : "<="} ?`);
24366
+ params.push(upper);
24367
+ }
24368
+ return { sql: parts.join(" AND "), params };
24369
+ }, "priorityWhere");
24370
+ var agentWhere = /* @__PURE__ */ __name((node) => {
24371
+ const value = node.value.trim().toLowerCase();
24372
+ if (value === "none")
24373
+ return { sql: "t.agent IS NULL", params: [] };
24374
+ if (value === "any" || node.operator === "wildcard" && value === "*")
24375
+ return { sql: "t.agent IS NOT NULL", params: [] };
24376
+ return node.operator === "wildcard" ? { sql: "lower(t.agent) GLOB ?", params: [value] } : { sql: "lower(t.agent) = ?", params: [value] };
24377
+ }, "agentWhere");
24378
+ var truth = /* @__PURE__ */ __name((node, sql2) => ({
24379
+ sql: node.value.toLowerCase() === "true" ? sql2 : `NOT (${sql2})`,
24380
+ params: []
24381
+ }), "truth");
24382
+ var projectTaskColumns = /* @__PURE__ */ __name((now2) => ({
24383
+ state: { type: "enum", sql: "t.status" },
24384
+ kind: { type: "enum", sql: "t.type" },
24385
+ project: { where: projectWhere },
24386
+ assignee: { where: assigneeWhere },
24387
+ priority: { where: priorityWhere },
24388
+ agent: { where: agentWhere },
24389
+ due: { type: "time", sql: "t.due_at" },
24390
+ closed: { type: "time", sql: "t.closed_at" },
24391
+ overdue: { where: /* @__PURE__ */ __name((node) => truth(node, `${OPEN} AND t.due_at IS NOT NULL AND t.due_at < ${Number(now2)}`), "where") },
24392
+ ready: { where: /* @__PURE__ */ __name((node) => truth(node, `${OPEN} AND NOT EXISTS (${UNFINISHED_BLOCKER})`), "where") },
24393
+ text: {
24394
+ where: /* @__PURE__ */ __name((node) => {
24395
+ const match = wordsMatch(node);
24396
+ const byKey = { sql: "t.key = ?", params: [node.value.trim().toUpperCase()] };
24397
+ if (match === void 0)
24398
+ return byKey;
24399
+ return {
24400
+ sql: `(t.id IN (SELECT rowid FROM task_words WHERE task_words MATCH ?) OR ${byKey.sql})`,
24401
+ params: [match, ...byKey.params]
24402
+ };
24403
+ }, "where")
24404
+ }
24405
+ }), "projectTaskColumns");
24406
+ var BOARD_SCOPE = `t.deleted_at IS NULL AND t.project_id IN (${OWNER_PROJECTS})`;
24407
+ var STATE_ORDER = `CASE t.status ${TASK_STATES.map((state, at) => `WHEN '${state}' THEN ${at}`).join(" ")} END`;
24408
+ var boardOrder = /* @__PURE__ */ __name((sort, descending) => {
24409
+ const direction = descending ? "DESC" : "ASC";
24410
+ const first = {
24411
+ priority: ["t.priority_score IS NULL", `t.priority_score ${descending ? "ASC" : "DESC"}`],
24412
+ due: ["t.due_at IS NULL", `t.due_at ${direction}`],
24413
+ created: [`t.created_at ${direction}`],
24414
+ updated: [`t.updated_at ${direction}`],
24415
+ key: [`(SELECT key FROM projects WHERE id = t.project_id) ${direction}`, `t.number ${direction}`],
24416
+ state: [`${STATE_ORDER} ${direction}`]
24417
+ }[sort];
24418
+ return [...first, "t.priority_score IS NULL", "t.priority_score DESC", "t.created_at", "t.id"].join(", ");
24419
+ }, "boardOrder");
24420
+ var withoutField = /* @__PURE__ */ __name((query, name) => {
24421
+ if (query === void 0)
24422
+ return void 0;
24423
+ const strip = /* @__PURE__ */ __name((node) => {
24424
+ if (walkQuery(node).every((leaf2) => leaf2.field === name))
24425
+ return void 0;
24426
+ if (node.kind === "predicate" || node.clauses.some((clause) => clause.occur === "should"))
24427
+ return node;
24428
+ const clauses = node.clauses.flatMap((clause) => {
24429
+ const kept = strip(clause.node);
24430
+ return kept === void 0 ? [] : [{ ...clause, node: kept }];
24431
+ });
24432
+ return clauses.length === 0 ? void 0 : { ...node, clauses };
24433
+ }, "strip");
24434
+ const root = strip(query.root);
24435
+ return root === void 0 ? void 0 : { ...query, root };
24436
+ }, "withoutField");
24437
+
24438
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
24243
24439
  var TASK_RELATION_KINDS = [
24244
24440
  "blocked-by",
24245
24441
  "follow-up-of",
@@ -24351,7 +24547,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
24351
24547
  task: ref3(Number(row2.to_id)),
24352
24548
  state: row2.status == null || row2.deleted_at != null || row2.project_deleted != null ? "unavailable" : row2.status === "dismissed" ? "dismissed" : "open"
24353
24549
  }));
24354
- return { ready: liveTask(database, rowId).status === "open" && blockers.length === 0, blockers };
24550
+ return { ready: !isClosedState(String(liveTask(database, rowId).status)) && blockers.length === 0, blockers };
24355
24551
  }), "taskReadiness"),
24356
24552
  readyTasks: /* @__PURE__ */ __name(async (project, options = {}) => read(database, () => {
24357
24553
  const limit = options.limit ?? 50;
@@ -24360,7 +24556,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
24360
24556
  const row2 = project.startsWith("project:") ? database.prepare("SELECT id FROM projects WHERE id=? AND account_id IS NULL AND deleted_at IS NULL").get(project.slice(8)) : database.prepare("SELECT id FROM projects WHERE key=? AND account_id IS NULL AND deleted_at IS NULL").get(project.trim().toUpperCase());
24361
24557
  if (!row2)
24362
24558
  throw new CliError("not_found", "the owner project is unavailable");
24363
- const rows = database.prepare("SELECT coalesce(t.package_id,t.key) AS id,t.key,substr(t.title,1,300) AS title FROM tasks t WHERE t.project_id=? AND t.status='open' AND t.deleted_at IS NULL AND NOT EXISTS (SELECT 1 FROM links l LEFT JOIN tasks b ON b.id=l.to_id LEFT JOIN projects p ON p.id=b.project_id WHERE l.from_type='task' AND l.to_type='task' AND l.kind='blocked-by' AND l.from_id=t.id AND l.confirmed=1 AND l.anchor IS NULL AND (b.id IS NULL OR b.deleted_at IS NOT NULL OR p.deleted_at IS NOT NULL OR b.status!='done')) ORDER BY coalesce(t.priority,5),t.number,t.id LIMIT ?").all(Number(row2.id), limit + 1);
24559
+ const rows = database.prepare("SELECT coalesce(t.package_id,t.key) AS id,t.key,substr(t.title,1,300) AS title FROM tasks t WHERE t.project_id=? AND t.status NOT IN ('done','dismissed') AND t.deleted_at IS NULL AND NOT EXISTS (SELECT 1 FROM links l LEFT JOIN tasks b ON b.id=l.to_id LEFT JOIN projects p ON p.id=b.project_id WHERE l.from_type='task' AND l.to_type='task' AND l.kind='blocked-by' AND l.from_id=t.id AND l.confirmed=1 AND l.anchor IS NULL AND (b.id IS NULL OR b.deleted_at IS NOT NULL OR p.deleted_at IS NOT NULL OR b.status!='done')) ORDER BY t.priority_score IS NULL,t.priority_score DESC,t.number,t.id LIMIT ?").all(Number(row2.id), limit + 1);
24364
24560
  return {
24365
24561
  items: rows.slice(0, limit).map((value) => ({ id: String(value.id), key: String(value.key), title: String(value.title ?? "") })),
24366
24562
  hasMore: rows.length > limit
@@ -24369,7 +24565,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
24369
24565
  };
24370
24566
  }, "taskRelationsStoreOver");
24371
24567
 
24372
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
24568
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
24373
24569
  var TASK_ROLES = ["assignee", "reviewer", "watcher"];
24374
24570
  var TASK_EVENT_KINDS = [
24375
24571
  "created",
@@ -24384,7 +24580,15 @@ var TASK_EVENT_KINDS = [
24384
24580
  "linked",
24385
24581
  "unlinked",
24386
24582
  "category",
24387
- "close-suggestion"
24583
+ "close-suggestion",
24584
+ "agent",
24585
+ "claimed",
24586
+ "released",
24587
+ "next-check",
24588
+ "resolution",
24589
+ "verdict",
24590
+ "close-certainty",
24591
+ "tags"
24388
24592
  ];
24389
24593
  var iso4 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
24390
24594
  var recordTaskEvent = /* @__PURE__ */ __name((database, task, actor, kind3, changes, at) => {
@@ -24397,11 +24601,11 @@ var textOf3 = /* @__PURE__ */ __name((value, what, max) => {
24397
24601
  return text5;
24398
24602
  }, "textOf");
24399
24603
  var claimOf = /* @__PURE__ */ __name((row2, at) => row2.claimed_by != null && Number(row2.claimed_until) >= at ? { claimedBy: String(row2.claimed_by), claimedUntil: iso4(row2.claimed_until) } : { claimedBy: null, claimedUntil: null }, "claimOf");
24400
- var priorityOf = /* @__PURE__ */ __name((value) => {
24401
- if (value !== null && !(Number.isInteger(value) && value >= 0 && value <= 4))
24402
- throw new CliError("validation_error", "a priority is 0 (urgent) to 4 (low)");
24403
- return value;
24404
- }, "priorityOf");
24604
+ var checkRevision = /* @__PURE__ */ __name((row2, expected) => {
24605
+ if (expected === void 0 || Number(row2.revision) === expected)
24606
+ return;
24607
+ throw new CliError("configuration_error", `task ${String(row2.key)} changed since revision ${expected}; it is at ${String(row2.revision)}: read it again`, { reason: "task.stale", revision: Number(row2.revision) });
24608
+ }, "checkRevision");
24405
24609
  var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24406
24610
  const { database, now: now2 } = context;
24407
24611
  const required3 = /* @__PURE__ */ __name((id2) => {
@@ -24454,7 +24658,10 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24454
24658
  description: row2.description == null ? null : String(row2.description),
24455
24659
  type: row2.type,
24456
24660
  status: row2.status,
24457
- priority: row2.priority == null ? null : Number(row2.priority),
24661
+ priority: row2.priority_score == null ? null : Number(row2.priority_score),
24662
+ priorityLabel: priorityLabel(row2.priority_score == null ? null : Number(row2.priority_score)),
24663
+ agent: row2.agent == null ? null : String(row2.agent),
24664
+ revision: Number(row2.revision),
24458
24665
  parent: row2.parent_id == null ? null : reference2(Number(row2.parent_id)),
24459
24666
  source: row2.source_locator == null ? null : String(row2.source_locator),
24460
24667
  dueAt: iso4(row2.due_at),
@@ -24471,6 +24678,19 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24471
24678
  updatedAt: iso4(row2.updated_at)
24472
24679
  };
24473
24680
  }, "detailsOf");
24681
+ const stemmerFor2 = stemmerCache();
24682
+ const touch = /* @__PURE__ */ __name((task, at) => database.prepare("UPDATE tasks SET updated_at = ? WHERE id = ?").run(at, task), "touch");
24683
+ const boardWhere = /* @__PURE__ */ __name((query, zone, at) => {
24684
+ if (query === void 0)
24685
+ return { sql: BOARD_SCOPE, params: [] };
24686
+ const where = queryFilter(query, projectTaskColumns(at), {
24687
+ command: "tasks list",
24688
+ now: at,
24689
+ ...zone ? { zone } : {}
24690
+ });
24691
+ return { sql: `${BOARD_SCOPE} AND (${where.sql})`, params: where.params };
24692
+ }, "boardWhere");
24693
+ const countOf = /* @__PURE__ */ __name((where) => Number(database.prepare(`SELECT count(*) AS n FROM tasks t WHERE ${where.sql}`).get(...where.params)?.n ?? 0), "countOf");
24474
24694
  const rowById = /* @__PURE__ */ __name((id2) => database.prepare("SELECT * FROM tasks WHERE id = ?").get(id2), "rowById");
24475
24695
  const details2 = /* @__PURE__ */ __name((id2) => detailsOf(rowById(id2)), "details");
24476
24696
  const edit = /* @__PURE__ */ __name((task, fields4, actor, created = false) => {
@@ -24478,13 +24698,13 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24478
24698
  const at = now2();
24479
24699
  const set = [];
24480
24700
  const values = [];
24481
- const change = /* @__PURE__ */ __name((column2, value, event) => {
24701
+ const change = /* @__PURE__ */ __name((column2, value, event, key2 = column2) => {
24482
24702
  if ((before2[column2] ?? null) === value)
24483
24703
  return;
24484
24704
  set.push(`${column2} = ?`);
24485
24705
  values.push(value);
24486
24706
  if (event)
24487
- recordTaskEvent(database, task, actor, event, { [column2]: [before2[column2] ?? null, value] }, at);
24707
+ recordTaskEvent(database, task, actor, event, { [key2]: [before2[column2] ?? null, value] }, at);
24488
24708
  }, "change");
24489
24709
  if (fields4.title !== void 0) {
24490
24710
  const title = textOf3(fields4.title, "a task's title", 300);
@@ -24493,23 +24713,35 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24493
24713
  }
24494
24714
  if (fields4.description !== void 0)
24495
24715
  change("description", fields4.description === null ? null : textOf3(fields4.description, "a description", 2e4), created ? void 0 : "description");
24496
- if (fields4.priority !== void 0)
24497
- change("priority", priorityOf(fields4.priority), "priority");
24716
+ if (fields4.priority !== void 0) {
24717
+ const score = fields4.priority === null ? null : checkedScore(fields4.priority);
24718
+ change("priority_score", score, "priority", "priority");
24719
+ change("priority", legacyPriority(score));
24720
+ }
24721
+ if (fields4.agent !== void 0)
24722
+ change("agent", fields4.agent === null ? null : textOf3(fields4.agent, "an agent's name", 100), "agent");
24498
24723
  if (fields4.parent !== void 0)
24499
24724
  change("parent_id", fields4.parent === null ? null : parentOf(task, Number(before2.project_id), fields4.parent));
24500
24725
  if (fields4.dueAt !== void 0)
24501
24726
  change("due_at", fields4.dueAt === null ? null : fields4.dueAt.getTime(), "due");
24502
24727
  if (fields4.nextCheckAt !== void 0)
24503
- change("next_check_at", fields4.nextCheckAt === null ? null : fields4.nextCheckAt.getTime());
24728
+ change("next_check_at", fields4.nextCheckAt === null ? null : fields4.nextCheckAt.getTime(), "next-check");
24504
24729
  if (fields4.status !== void 0) {
24505
24730
  if (!TASK_STATES.includes(fields4.status))
24506
24731
  throw new CliError("validation_error", `a task's status is one of ${TASK_STATES.join(", ")}`);
24507
- const closed = fields4.status !== "open";
24732
+ if ((fields4.status === "todo" || fields4.status === "in_progress") && String(database.prepare("SELECT key FROM projects WHERE id = ?").get(Number(before2.project_id))?.key).length === INBOX_KEY_LENGTH)
24733
+ throw new CliError("validation_error", "a task from a message is open, done or dismissed; todo and in_progress are for a project task");
24734
+ const closed = isClosedState(fields4.status);
24735
+ const reopened = !closed && isClosedState(String(before2.status));
24508
24736
  if (before2.status !== fields4.status) {
24509
24737
  change("status", fields4.status, "status");
24510
- change("closed_at", closed ? at : null);
24511
- change("closed_by_type", closed ? actor.type : null);
24512
- change("closed_by_id", closed ? actor.id : null);
24738
+ if (fields4.status === "in_progress" && before2.started_at == null)
24739
+ change("started_at", at);
24740
+ if (closed || reopened) {
24741
+ change("closed_at", closed ? at : null);
24742
+ change("closed_by_type", closed ? actor.type : null);
24743
+ change("closed_by_id", closed ? actor.id : null);
24744
+ }
24513
24745
  if (closed) {
24514
24746
  change("claimed_by", null);
24515
24747
  change("claimed_until", null);
@@ -24517,6 +24749,10 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24517
24749
  change(column2, null);
24518
24750
  } else
24519
24751
  change("close_certainty", null);
24752
+ if (reopened && fields4.reason === void 0) {
24753
+ change("close_reason", null);
24754
+ change("close_reason_folded", null);
24755
+ }
24520
24756
  }
24521
24757
  }
24522
24758
  if (fields4.reason !== void 0) {
@@ -24530,6 +24766,64 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24530
24766
  return;
24531
24767
  database.prepare(`UPDATE tasks SET ${set.join(", ")}, updated_at = ? WHERE id = ?`).run(...values, at, task);
24532
24768
  }, "edit");
24769
+ const columnOf = /* @__PURE__ */ __name((task, status) => database.prepare(`SELECT t.id, t.key, coalesce(t.priority_score, 0) AS score FROM tasks t WHERE ${BOARD_SCOPE} AND t.status = ? AND t.id <> ? ORDER BY ${boardOrder("priority", false)}`).all(status, task).map((row2) => ({ id: Number(row2.id), key: String(row2.key), score: Number(row2.score) })), "columnOf");
24770
+ const moveTask = /* @__PURE__ */ __name((task, row2, move2, actor) => {
24771
+ if (move2.before !== void 0 && move2.after !== void 0)
24772
+ throw new CliError("validation_error", "give --before or --after, not both");
24773
+ if (!database.prepare(`SELECT 1 FROM tasks t WHERE t.id = ? AND ${BOARD_SCOPE}`).get(task))
24774
+ throw new CliError("validation_error", "only a project task moves on the board");
24775
+ const neighbour = move2.before ?? move2.after;
24776
+ if (neighbour === void 0) {
24777
+ const status2 = move2.status ?? row2.status;
24778
+ if (columnOf(task, status2).length > 0 || move2.status === void 0)
24779
+ throw new CliError("validation_error", "say where it goes: --before <key> or --after <key>");
24780
+ const from3 = priorityLabel(row2.priority_score == null ? null : Number(row2.priority_score));
24781
+ edit(task, { status: move2.status }, actor);
24782
+ return { label: { from: from3, to: from3, changed: false }, renumbered: [] };
24783
+ }
24784
+ const target = required3(neighbour);
24785
+ const anchor = database.prepare(`SELECT t.key, t.status FROM tasks t WHERE t.id = ? AND ${BOARD_SCOPE}`).get(target);
24786
+ if (target === task)
24787
+ throw new CliError("validation_error", "a task moves beside another task, not itself");
24788
+ if (!anchor)
24789
+ throw new CliError("validation_error", `${neighbour} is not on a project's board`);
24790
+ const status = anchor.status;
24791
+ if (move2.status !== void 0 && move2.status !== status)
24792
+ throw new CliError("validation_error", `${String(anchor.key)} is in ${status}, not ${move2.status}: pick a task in the ${move2.status} column`, { reason: "task.column", anchor: String(anchor.key), anchorStatus: status, requestedStatus: move2.status });
24793
+ const column2 = columnOf(task, status);
24794
+ const at = column2.findIndex(({ id: id2 }) => id2 === target);
24795
+ const index2 = move2.before === void 0 ? at + 1 : at;
24796
+ const above = column2[index2 - 1];
24797
+ const below = column2[index2];
24798
+ const STEP = 1 / 64;
24799
+ const score = above === void 0 ? Math.min(1, (below?.score ?? 0) + STEP) : below === void 0 ? Math.max(0, above.score - STEP) : (above.score + below.score) / 2;
24800
+ const roomy = (above === void 0 || score < above.score) && (below === void 0 || score > below.score);
24801
+ const from2 = priorityLabel(row2.priority_score == null ? null : Number(row2.priority_score));
24802
+ const renumbered = [];
24803
+ let given = score;
24804
+ if (!roomy || above !== void 0 && below !== void 0 && above.score - below.score < 1e-9) {
24805
+ const label = priorityLabel((above ?? below)?.score ?? 0);
24806
+ const band = priorityBand(label);
24807
+ const inBand = /* @__PURE__ */ __name((one) => priorityLabel(one.score) === label, "inBand");
24808
+ const ordered = [...column2.slice(0, index2), { id: task, key: String(row2.key), score }, ...column2.slice(index2)];
24809
+ const spread = ordered.filter((one) => one.id === task || inBand(one));
24810
+ const gap = (band.to - band.from) / (spread.length + 1);
24811
+ spread.forEach((one, place) => {
24812
+ const value = band.to - gap * (place + 1);
24813
+ if (one.id === task) {
24814
+ given = value;
24815
+ return;
24816
+ }
24817
+ if (one.score === value)
24818
+ return;
24819
+ edit(one.id, { priority: value }, actor);
24820
+ renumbered.push(one.key);
24821
+ });
24822
+ }
24823
+ edit(task, { priority: given, status }, actor);
24824
+ const to = priorityLabel(given);
24825
+ return { label: { from: from2, to, changed: from2 !== to }, renumbered };
24826
+ }, "moveTask");
24533
24827
  return {
24534
24828
  ...taskRelationsStoreOver(context, (task, actor, kind3, changes, at) => recordTaskEvent(database, task, actor, kind3, changes, at)),
24535
24829
  create: /* @__PURE__ */ __name((input, by) => {
@@ -24551,22 +24845,36 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24551
24845
  });
24552
24846
  return details2(made);
24553
24847
  }, "create"),
24554
- edit: /* @__PURE__ */ __name(async (id2, fields4, by) => {
24848
+ edit: /* @__PURE__ */ __name(async (id2, fields4, by, check3 = {}) => {
24555
24849
  const task = required3(id2);
24556
- write(database, () => edit(task, fields4, authorActor(context, by).actor));
24850
+ write(database, () => {
24851
+ checkRevision(rowById(task), check3.revision);
24852
+ edit(task, fields4, authorActor(context, by).actor);
24853
+ });
24557
24854
  return details2(task);
24558
24855
  }, "edit"),
24559
- assign: /* @__PURE__ */ __name((id2, { to, role }, by) => {
24856
+ move: /* @__PURE__ */ __name(async (id2, move2, by, check3 = {}) => {
24857
+ const task = required3(id2);
24858
+ return write(database, () => {
24859
+ const row2 = rowById(task);
24860
+ checkRevision(row2, check3.revision);
24861
+ const moved = moveTask(task, row2, move2, authorActor(context, by).actor);
24862
+ return { ...moved, task: details2(task) };
24863
+ });
24864
+ }, "move"),
24865
+ assign: /* @__PURE__ */ __name((id2, { to, role }, by, check3 = {}) => {
24560
24866
  if (!TASK_ROLES.includes(role))
24561
24867
  throw new CliError("validation_error", `a role is one of ${TASK_ROLES.join(", ")}`);
24562
24868
  const task = required3(id2);
24563
24869
  write(database, () => {
24870
+ checkRevision(rowById(task), check3.revision);
24564
24871
  const person2 = personOf2(to);
24565
24872
  const held = database.prepare("SELECT 1 FROM task_assignments WHERE task_id = ? AND assignee_type = 'person' AND assignee_id = ? AND role = ?").get(task, person2, role);
24566
24873
  if (held)
24567
24874
  return;
24568
24875
  const at = now2();
24569
24876
  database.prepare("INSERT INTO task_assignments (task_id, assignee_type, assignee_id, role, created_at, updated_at) VALUES (?, 'person', ?, ?, ?, ?)").run(task, person2, role, at, at);
24877
+ touch(task, at);
24570
24878
  const changes = { [role]: [null, `person:${person2}`] };
24571
24879
  recordTaskEvent(database, task, authorActor(context, by).actor, "assigned", changes, at);
24572
24880
  });
@@ -24587,15 +24895,18 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24587
24895
  const row2 = database.prepare("SELECT p.id FROM messages m JOIN identity_links il ON il.identity_id = m.sender_identity_id JOIN persons p ON p.id = il.person_id WHERE m.id = ? AND m.outgoing = 0 AND p.owner = 0").get(thing.id);
24588
24896
  return row2 ? `person:${String(row2.id)}` : void 0;
24589
24897
  }, "sourceSender"),
24590
- unassign: /* @__PURE__ */ __name(async (id2, { to, role }, by) => {
24898
+ unassign: /* @__PURE__ */ __name(async (id2, { to, role }, by, check3 = {}) => {
24591
24899
  const task = required3(id2);
24592
24900
  write(database, () => {
24901
+ checkRevision(rowById(task), check3.revision);
24593
24902
  const person2 = personOf2(to);
24594
24903
  const removed = database.prepare("DELETE FROM task_assignments WHERE task_id = ? AND assignee_type = 'person' AND assignee_id = ? AND role = ?").run(task, person2, role).changes;
24595
24904
  if (removed === 0)
24596
24905
  return;
24906
+ const at = now2();
24907
+ touch(task, at);
24597
24908
  const changes = { [role]: [`person:${person2}`, null] };
24598
- recordTaskEvent(database, task, authorActor(context, by).actor, "unassigned", changes, now2());
24909
+ recordTaskEvent(database, task, authorActor(context, by).actor, "unassigned", changes, at);
24599
24910
  });
24600
24911
  return details2(task);
24601
24912
  }, "unassign"),
@@ -24612,15 +24923,21 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24612
24923
  throw new CliError("validation_error", `a task's type is one of ${TASK_TYPES.join(", ")}`);
24613
24924
  const projectId = project === void 0 ? null : projectOf(project);
24614
24925
  const person2 = assignee === void 0 ? null : personOf2(assignee);
24615
- return database.prepare(`SELECT * FROM tasks t WHERE deleted_at IS NULL AND (? IS NULL OR project_id = ?) AND (? IS NULL OR type = ?) AND (? IS NULL OR status = ?) AND (? IS NULL OR EXISTS (SELECT 1 FROM task_assignments a WHERE a.task_id = t.id AND a.assignee_type = 'person' AND a.assignee_id = ?)) AND (${where?.sql || "1"}) ORDER BY coalesce(priority, 5), created_at, id LIMIT ?`).all(projectId, projectId, type ?? null, type ?? null, status ?? null, status ?? null, person2, person2, ...where?.params ?? [], Math.min(Math.max(limit, 1), 500)).map(detailsOf);
24926
+ return database.prepare(`SELECT * FROM tasks t WHERE deleted_at IS NULL AND (? IS NULL OR project_id = ?) AND (? IS NULL OR type = ?) AND (? IS NULL OR status = ?) AND (? IS NULL OR EXISTS (SELECT 1 FROM task_assignments a WHERE a.task_id = t.id AND a.assignee_type = 'person' AND a.assignee_id = ?)) AND (${where?.sql || "1"}) ORDER BY priority_score IS NULL, priority_score DESC, created_at, id LIMIT ?`).all(projectId, projectId, type ?? null, type ?? null, status ?? null, status ?? null, person2, person2, ...where?.params ?? [], Math.min(Math.max(limit, 1), 500)).map(detailsOf);
24616
24927
  }, "find"),
24617
24928
  claim: /* @__PURE__ */ __name(async (id2, holder, until) => {
24618
24929
  const task = required3(id2);
24619
24930
  const at = now2();
24620
- const won = write(database, () => database.prepare("UPDATE tasks SET claimed_by = ?, claimed_until = ?, updated_at = ? WHERE id = ? AND status = 'open' AND (claimed_by IS NULL OR claimed_until < ? OR claimed_by = ?) RETURNING id").get(holder, until.getTime(), at, task, at, holder));
24931
+ const won = write(database, () => {
24932
+ const before2 = claimOf(rowById(task), at).claimedBy;
24933
+ const claimed = database.prepare("UPDATE tasks SET claimed_by = ?, claimed_until = ?, updated_at = ? WHERE id = ? AND status NOT IN ('done', 'dismissed') AND (claimed_by IS NULL OR claimed_until < ? OR claimed_by = ?) RETURNING id").get(holder, until.getTime(), at, task, at, holder);
24934
+ if (claimed)
24935
+ recordTaskEvent(database, task, null, "claimed", { claimed_by: [before2, holder] }, at);
24936
+ return claimed;
24937
+ });
24621
24938
  if (!won) {
24622
24939
  const row2 = rowById(task);
24623
- if (row2.status !== "open")
24940
+ if (isClosedState(String(row2.status)))
24624
24941
  throw new CliError("validation_error", `task ${String(row2.key)} is ${String(row2.status)}; only an open task is claimed`);
24625
24942
  throw new CliError("validation_error", `${String(row2.claimed_by)} holds task ${String(row2.key)} until ${iso4(row2.claimed_until)}; wait for it, or ask them to release it`, { reason: "task.claimed", holder: String(row2.claimed_by), until: iso4(row2.claimed_until) });
24626
24943
  }
@@ -24635,13 +24952,66 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24635
24952
  throw new CliError("validation_error", `${claimedBy} holds task ${String(row2.key)}; only they or the owner release it`, {
24636
24953
  reason: "task.claimed"
24637
24954
  });
24638
- database.prepare("UPDATE tasks SET claimed_by = NULL, claimed_until = NULL, updated_at = ? WHERE id = ?").run(now2(), task);
24955
+ const at = now2();
24956
+ database.prepare("UPDATE tasks SET claimed_by = NULL, claimed_until = NULL, updated_at = ? WHERE id = ?").run(at, task);
24957
+ if (claimedBy !== null)
24958
+ recordTaskEvent(database, task, null, "released", { claimed_by: [claimedBy, null] }, at);
24639
24959
  });
24640
24960
  return details2(task);
24641
24961
  }, "release"),
24642
- events: /* @__PURE__ */ __name(async (id2) => database.prepare("SELECT actor_type, actor_id, kind, changes, created_at FROM task_events WHERE task_id = ? ORDER BY id").all(required3(id2)).map((row2) => ({
24962
+ board: /* @__PURE__ */ __name(async (query, { limit, offset = 0, sort = "priority", descending = false, zone }) => {
24963
+ if (!Number.isSafeInteger(limit) || limit < 1 || limit > 500)
24964
+ throw new CliError("validation_error", "a page of tasks holds 1\u2013500");
24965
+ drainCorpus(database, CORPORA.task, stemmerFor2);
24966
+ const where = boardWhere(query, zone, now2());
24967
+ const rows = database.prepare(`SELECT t.* FROM tasks t WHERE ${where.sql} ORDER BY ${boardOrder(sort, descending)} LIMIT ? OFFSET ?`).all(...where.params, limit, offset);
24968
+ return { items: rows.map(detailsOf), total: countOf(where) };
24969
+ }, "board"),
24970
+ boardCounts: /* @__PURE__ */ __name(async (query, { zone } = {}) => {
24971
+ drainCorpus(database, CORPORA.task, stemmerFor2);
24972
+ const at = now2();
24973
+ const without = /* @__PURE__ */ __name((name) => boardWhere(withoutField(query, name), zone, at), "without");
24974
+ const grouped = /* @__PURE__ */ __name((name, select2, from2, group) => {
24975
+ const where = without(name);
24976
+ return database.prepare(`SELECT ${select2}, count(*) AS n FROM tasks t ${from2} WHERE ${where.sql} GROUP BY ${group}`).all(...where.params);
24977
+ }, "grouped");
24978
+ const project = grouped("project", "p.key, p.name", "JOIN projects p ON p.id = t.project_id", "p.id").map((row2) => ({ value: String(row2.key), name: String(row2.name), count: Number(row2.n) })).sort((a, b) => a.value.localeCompare(b.value));
24979
+ const assigned = grouped("assignee", "a.assignee_id AS person, pe.name", "LEFT JOIN task_assignments a ON a.task_id = t.id AND a.assignee_type = 'person' AND a.role = 'assignee' LEFT JOIN persons pe ON pe.id = a.assignee_id", "a.assignee_id");
24980
+ const assignee = assigned.map((row2) => ({
24981
+ value: row2.person == null ? "none" : `person:${row2.person}`,
24982
+ name: row2.name == null ? null : String(row2.name),
24983
+ count: Number(row2.n)
24984
+ })).sort((a, b) => b.count - a.count || a.value.localeCompare(b.value));
24985
+ const priorities = /* @__PURE__ */ new Map();
24986
+ for (const row2 of grouped("priority", "t.priority_score", "", "t.priority_score")) {
24987
+ const label = priorityLabel(row2.priority_score == null ? null : Number(row2.priority_score)) ?? "none";
24988
+ priorities.set(label, (priorities.get(label) ?? 0) + Number(row2.n));
24989
+ }
24990
+ const states = new Map(grouped("state", "t.status", "", "t.status").map((row2) => [row2.status, Number(row2.n)]));
24991
+ return {
24992
+ total: countOf(boardWhere(query, zone, at)),
24993
+ project,
24994
+ assignee,
24995
+ priority: [...[...PRIORITY_LABELS].reverse(), "none"].map((value) => ({
24996
+ value,
24997
+ count: priorities.get(value) ?? 0
24998
+ })),
24999
+ state: TASK_STATES.map((value) => ({ value, count: states.get(value) ?? 0 }))
25000
+ };
25001
+ }, "boardCounts"),
25002
+ taskPeople: /* @__PURE__ */ __name(async () => database.prepare("SELECT p.id, p.name, p.owner, count(DISTINCT t.id) AS n FROM persons p LEFT JOIN task_assignments a ON a.assignee_type = 'person' AND a.assignee_id = p.id LEFT JOIN tasks t ON t.id = a.task_id AND t.deleted_at IS NULL WHERE p.owner = 1 OR t.id IS NOT NULL GROUP BY p.id ORDER BY p.owner DESC, p.name COLLATE NOCASE, p.id").all().map((row2) => ({
25003
+ person: `person:${row2.id}`,
25004
+ name: row2.name == null ? null : String(row2.name),
25005
+ owner: Number(row2.owner) === 1,
25006
+ tasks: Number(row2.n)
25007
+ })), "taskPeople"),
25008
+ events: /* @__PURE__ */ __name(async (id2) => database.prepare("SELECT e.actor_type, e.actor_id, e.kind, e.changes, e.created_at, CASE e.actor_type WHEN 'person' THEN p.name WHEN 'bot' THEN b.name END AS actor_name FROM task_events e LEFT JOIN persons p ON e.actor_type = 'person' AND p.id = e.actor_id LEFT JOIN bots b ON e.actor_type = 'bot' AND b.id = e.actor_id WHERE e.task_id = ? ORDER BY e.id").all(required3(id2)).map((row2) => ({
24643
25009
  kind: row2.kind,
24644
- actor: row2.actor_type == null ? null : { type: row2.actor_type, id: Number(row2.actor_id) },
25010
+ actor: row2.actor_type == null ? null : {
25011
+ type: row2.actor_type,
25012
+ id: Number(row2.actor_id),
25013
+ name: row2.actor_name == null ? null : String(row2.actor_name)
25014
+ },
24645
25015
  changes: row2.changes == null ? null : JSON.parse(String(row2.changes)),
24646
25016
  at: iso4(row2.created_at)
24647
25017
  })), "events")
@@ -24652,11 +25022,11 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
24652
25022
  return {
24653
25023
  ...operations,
24654
25024
  create: /* @__PURE__ */ __name(async (input, by) => operations.create(input, by), "create"),
24655
- assign: /* @__PURE__ */ __name(async (id2, assignment, by) => operations.assign(id2, assignment, by), "assign")
25025
+ assign: /* @__PURE__ */ __name(async (id2, assignment, by, check3) => operations.assign(id2, assignment, by, check3), "assign")
24656
25026
  };
24657
25027
  }, "workTasksOver");
24658
25028
 
24659
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
25029
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
24660
25030
  var taskCloseOver = /* @__PURE__ */ __name((context) => {
24661
25031
  const { database, now: now2 } = context;
24662
25032
  const liveRow = /* @__PURE__ */ __name((id2) => {
@@ -24674,7 +25044,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
24674
25044
  closeSuggestion: /* @__PURE__ */ __name(async (id2) => closeSuggestionOf(database, liveRow(id2)), "closeSuggestion"),
24675
25045
  suggestClose: /* @__PURE__ */ __name(async (id2, suggestion, by) => write(database, () => {
24676
25046
  const row2 = liveRow(id2);
24677
- if (row2.status !== "open")
25047
+ if (isClosedState(String(row2.status)))
24678
25048
  throw new CliError("validation_error", `task ${String(row2.key)} is already ${String(row2.status)}`, {
24679
25049
  reason: "task.closed"
24680
25050
  });
@@ -24697,12 +25067,15 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
24697
25067
  }), "suggestClose"),
24698
25068
  recordCloseCertainty: /* @__PURE__ */ __name(async (id2, certainty) => write(database, () => {
24699
25069
  const row2 = liveRow(id2);
24700
- database.prepare("UPDATE tasks SET close_certainty = ? WHERE id = ?").run(certaintyOf(certainty), Number(row2.id));
25070
+ const value = certaintyOf(certainty);
25071
+ database.prepare("UPDATE tasks SET close_certainty = ? WHERE id = ?").run(value, Number(row2.id));
25072
+ if ((row2.close_certainty ?? null) !== value)
25073
+ recordTaskEvent(database, Number(row2.id), null, "close-certainty", { close_certainty: [row2.close_certainty ?? null, value] }, now2());
24701
25074
  }), "recordCloseCertainty")
24702
25075
  };
24703
25076
  }, "taskCloseOver");
24704
25077
 
24705
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
25078
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
24706
25079
  var TASK_PAIR_DECISIONS = ["review", "unsure", "merged", "rejected", "unmerged", "attached", "new"];
24707
25080
  var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
24708
25081
  const { database, now: now2 } = context;
@@ -24790,7 +25163,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
24790
25163
  }, "linkMessage");
24791
25164
  const followUp = /* @__PURE__ */ __name(async (row2, candidates, by) => write(database, () => {
24792
25165
  for (const one of candidates) {
24793
- if (one.status === "open" || one.band === "different")
25166
+ if (!isClosedState(one.status) || one.band === "different")
24794
25167
  continue;
24795
25168
  const closed = required3(one.key);
24796
25169
  if (mergedInto(closed))
@@ -24810,7 +25183,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
24810
25183
  const alike = (await similarity.similar({ task: String(row2.key) }, { limit: 40 })).filter((one) => one.band !== "different");
24811
25184
  if (!linked)
24812
25185
  await followUp(row2, alike, { bot: "rule" });
24813
- const found2 = linked ? alike : alike.filter((one) => one.status === "open");
25186
+ const found2 = linked ? alike : alike.filter((one) => !isClosedState(one.status));
24814
25187
  if (found2.length === 0)
24815
25188
  return 0;
24816
25189
  return write(database, () => {
@@ -24859,7 +25232,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
24859
25232
  const a = required3(dup);
24860
25233
  const b = required3(into);
24861
25234
  sameInbox(a, b);
24862
- if (a.status !== "open")
25235
+ if (isClosedState(String(a.status)))
24863
25236
  throw new CliError("validation_error", `task ${String(a.key)} is already ${String(a.status)}; a merge closes an open task \u2014 reopen it with tasks unmerge if a merge closed it`, { reason: "task.closed" });
24864
25237
  const onward = mergedInto(b);
24865
25238
  if (onward)
@@ -24921,7 +25294,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
24921
25294
  };
24922
25295
  }, "taskPairsOver");
24923
25296
 
24924
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
25297
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
24925
25298
  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";
24926
25299
  var taskStoreOver = /* @__PURE__ */ __name((context) => {
24927
25300
  const { database, now: now2 } = context;
@@ -25049,8 +25422,8 @@ var taskStoreOver = /* @__PURE__ */ __name((context) => {
25049
25422
  write(database, () => {
25050
25423
  const before2 = database.prepare("SELECT status, due_at FROM tasks WHERE id = ?").get(row2);
25051
25424
  const at = now2();
25052
- database.prepare("UPDATE tasks SET status = ?, close_reason = ?, close_reason_folded = ?, due_at = ?, closed_at = ?, closed_by_type = ?, closed_by_id = ?, updated_at = ?, claimed_by = CASE WHEN ? = 'open' THEN claimed_by END, claimed_until = CASE WHEN ? = 'open' THEN claimed_until END, close_certainty = CASE WHEN ? = 'open' THEN NULL ELSE close_certainty END WHERE id = ?").run(task.state, task.reason ?? null, folded3(task.reason), time(task.dueAt), time(task.closedAt), closedBy?.type ?? null, closedBy?.id ?? null, at, task.state, task.state, task.state, row2);
25053
- if (task.state !== "open")
25425
+ database.prepare("UPDATE tasks SET status = ?, close_reason = ?, close_reason_folded = ?, due_at = ?, closed_at = ?, closed_by_type = ?, closed_by_id = ?, updated_at = ?, claimed_by = CASE WHEN ? NOT IN ('done', 'dismissed') THEN claimed_by END, claimed_until = CASE WHEN ? NOT IN ('done', 'dismissed') THEN claimed_until END, close_certainty = CASE WHEN ? NOT IN ('done', 'dismissed') THEN NULL ELSE close_certainty END WHERE id = ?").run(task.state, task.reason ?? null, folded3(task.reason), time(task.dueAt), time(task.closedAt), closedBy?.type ?? null, closedBy?.id ?? null, at, task.state, task.state, task.state, row2);
25426
+ if (isClosedState(task.state))
25054
25427
  database.prepare(`UPDATE tasks SET ${CLEAR_SUGGESTION} WHERE id = ?`).run(row2);
25055
25428
  if (before2.status !== task.state)
25056
25429
  recordTaskEvent(database, row2, closedBy ?? null, "status", { status: [before2.status, task.state] }, at);
@@ -25066,7 +25439,10 @@ var taskStoreOver = /* @__PURE__ */ __name((context) => {
25066
25439
  const row2 = required3(id2);
25067
25440
  const at = now2();
25068
25441
  write(database, () => {
25442
+ const before2 = database.prepare("SELECT resolution FROM tasks WHERE id = ?").get(row2)?.resolution ?? null;
25069
25443
  database.prepare("UPDATE tasks SET resolution = ?, updated_at = ? WHERE id = ?").run(text5, at, row2);
25444
+ if (before2 !== text5)
25445
+ recordTaskEvent(database, row2, null, "resolution", { resolution: [before2, text5] }, at);
25070
25446
  if (!by)
25071
25447
  return;
25072
25448
  database.prepare(`DELETE FROM links WHERE from_type = 'task' AND from_id = ? AND kind = ${linkKind("answered-by")}`).run(row2);
@@ -25077,7 +25453,14 @@ var taskStoreOver = /* @__PURE__ */ __name((context) => {
25077
25453
  judge: /* @__PURE__ */ __name(async (id2, verdict) => {
25078
25454
  if (verdict !== null && !TASK_VERDICTS.includes(verdict))
25079
25455
  throw new CliError("validation_error", `a verdict is one of ${TASK_VERDICTS.join(", ")}`);
25080
- database.prepare("UPDATE tasks SET verdict = ?, updated_at = ? WHERE id = ?").run(verdict, now2(), required3(id2));
25456
+ const row2 = required3(id2);
25457
+ write(database, () => {
25458
+ const at = now2();
25459
+ const before2 = database.prepare("SELECT verdict FROM tasks WHERE id = ?").get(row2)?.verdict ?? null;
25460
+ database.prepare("UPDATE tasks SET verdict = ?, updated_at = ? WHERE id = ?").run(verdict, at, row2);
25461
+ if (before2 !== verdict)
25462
+ recordTaskEvent(database, row2, null, "verdict", { verdict: [before2, verdict] }, at);
25463
+ });
25081
25464
  }, "judge")
25082
25465
  };
25083
25466
  }, "taskStoreOver");
@@ -25116,7 +25499,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
25116
25499
  throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
25117
25500
  }, "oneOf");
25118
25501
 
25119
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/accounts.js
25502
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/accounts.js
25120
25503
  var accountAccountsOver = /* @__PURE__ */ __name((context) => {
25121
25504
  const { database } = context;
25122
25505
  const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
@@ -25161,7 +25544,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
25161
25544
  };
25162
25545
  }, "accountsStoreOver");
25163
25546
 
25164
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
25547
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
25165
25548
  var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
25166
25549
  var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
25167
25550
  const message2 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
@@ -25185,7 +25568,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
25185
25568
  })), "keepDownloads");
25186
25569
  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");
25187
25570
 
25188
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/attachments.js
25571
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/attachments.js
25189
25572
  var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
25190
25573
  const { database } = context;
25191
25574
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -25242,7 +25625,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
25242
25625
  }, "keepAttachmentText")
25243
25626
  }), "attachmentsStoreOver");
25244
25627
 
25245
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
25628
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
25246
25629
  var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
25247
25630
  var pointerMover = /* @__PURE__ */ __name((context, type) => {
25248
25631
  const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
@@ -25389,14 +25772,14 @@ var moveChat = /* @__PURE__ */ __name((context, key2, accountKey, old, twin, fro
25389
25772
  throw new CliError("validation_error", `a ${String(old.kind)} and a ${String(twin.kind)} are not one chat`);
25390
25773
  const strict = stricterPrivacy(context, accountKey, privacyOf(old), privacyOf(twin));
25391
25774
  moved = absorb(context, kept, Number(twin.id));
25392
- const fields4 = MESSENGER_FIELDS.map((field3) => `${field3} = coalesce(?, ${field3})`).join(", ");
25775
+ const fields4 = MESSENGER_FIELDS.map((field4) => `${field4} = coalesce(?, ${field4})`).join(", ");
25393
25776
  context.database.prepare(
25394
25777
  // Left only when both were: a complete chat list that named the new id before the re-key marked the old one.
25395
25778
  `UPDATE chats SET ${fields4}, kind = CASE WHEN kind = 'unknown' THEN ? ELSE kind END,
25396
25779
  membership_state = CASE WHEN ? IS NULL THEN nullif(membership_state, 'left') ELSE coalesce(nullif(?, 'left'), membership_state) END,
25397
25780
  muted_until = CASE WHEN ? IS NULL THEN muted_until ELSE ? END,
25398
25781
  searchable = ?, scope = ?, last_message_at = ?, updated_at = ? WHERE id = ?`
25399
- ).run(...MESSENGER_FIELDS.map((field3) => scalar(twin[field3])), scalar(twin.kind), scalar(twin.membership_state), scalar(twin.membership_state), scalar(twin.muted), scalar(twin.muted_until), strict.searchable, strict.scope, latest(old.last_message_at, twin.last_message_at), context.now(), kept);
25782
+ ).run(...MESSENGER_FIELDS.map((field4) => scalar(twin[field4])), scalar(twin.kind), scalar(twin.membership_state), scalar(twin.membership_state), scalar(twin.muted), scalar(twin.muted_until), strict.searchable, strict.scope, latest(old.last_message_at, twin.last_message_at), context.now(), kept);
25400
25783
  }
25401
25784
  context.database.prepare("UPDATE chats SET external_id = ?, updated_at = ? WHERE id = ?").run(to, context.now(), kept);
25402
25785
  renameText(context, key2, accountKey, from2, to);
@@ -25422,7 +25805,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
25422
25805
  return done;
25423
25806
  }, "rekeyChats");
25424
25807
 
25425
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
25808
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
25426
25809
  var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
25427
25810
  var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
25428
25811
  var CHAT_LIST_KEY = "chat_list_complete";
@@ -25454,7 +25837,7 @@ var chatCompleteness = /* @__PURE__ */ __name(({ database }, accountKey, chatIds
25454
25837
  });
25455
25838
  }, "chatCompleteness");
25456
25839
 
25457
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/chats.js
25840
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/chats.js
25458
25841
  var chatsStoreOver = /* @__PURE__ */ __name((context) => {
25459
25842
  const { database } = context;
25460
25843
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
@@ -25561,7 +25944,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
25561
25944
  };
25562
25945
  }, "chatsStoreOver");
25563
25946
 
25564
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
25947
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
25565
25948
  import { createHash as createHash6 } from "node:crypto";
25566
25949
  var BATCH_CONTEXT = 50;
25567
25950
  var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
@@ -25699,7 +26082,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
25699
26082
  var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
25700
26083
  ${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
25701
26084
 
25702
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
26085
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
25703
26086
  import { setTimeout } from "node:timers/promises";
25704
26087
  var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
25705
26088
  var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
@@ -26011,7 +26394,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
26011
26394
  AND NOT EXISTS (SELECT 1 FROM messages d
26012
26395
  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");
26013
26396
 
26014
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/conversations.js
26397
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/conversations.js
26015
26398
  var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
26016
26399
  const { database } = context;
26017
26400
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -26118,7 +26501,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
26118
26501
  };
26119
26502
  }, "conversationsStoreOver");
26120
26503
 
26121
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/counters.js
26504
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/counters.js
26122
26505
  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";
26123
26506
  var accountCountersOver = /* @__PURE__ */ __name((context) => {
26124
26507
  const { database } = context;
@@ -26143,7 +26526,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
26143
26526
  counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
26144
26527
  }), "countersStoreOver");
26145
26528
 
26146
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
26529
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
26147
26530
  var MENTION_STATUSES = ["found", "linked", "dismissed"];
26148
26531
  var MENTION_QUERY = defineQuery({
26149
26532
  entity: "mention",
@@ -26359,7 +26742,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
26359
26742
  return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
26360
26743
  }, "listPlaces");
26361
26744
 
26362
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/mentions.js
26745
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/mentions.js
26363
26746
  var accountMentionsOver = /* @__PURE__ */ __name((context) => {
26364
26747
  const { database } = context;
26365
26748
  const { findAccountPk: findAccountPk2 } = keysOver(context);
@@ -26394,7 +26777,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
26394
26777
  places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
26395
26778
  }), "mentionsStoreOver");
26396
26779
 
26397
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
26780
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
26398
26781
  var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
26399
26782
  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");
26400
26783
  const rows = messageId === void 0 ? read2.all(chatKey) : read2.all(chatKey, messageId);
@@ -26409,7 +26792,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
26409
26792
  }));
26410
26793
  }, "documentLinkMessages");
26411
26794
 
26412
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
26795
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
26413
26796
  var stemmerFor = stemmerCache();
26414
26797
  var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
26415
26798
  if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
@@ -26453,7 +26836,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
26453
26836
  });
26454
26837
  }, "laterSharingRare");
26455
26838
 
26456
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/messages.js
26839
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/messages.js
26457
26840
  var accountMessagesOver = /* @__PURE__ */ __name((context) => {
26458
26841
  const { database } = context;
26459
26842
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
@@ -26588,7 +26971,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
26588
26971
  laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
26589
26972
  }), "messagesStoreOver");
26590
26973
 
26591
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
26974
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
26592
26975
  var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
26593
26976
  var iso5 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
26594
26977
  var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: accounts2, limit }) => {
@@ -26628,7 +27011,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
26628
27011
  }));
26629
27012
  const tasks2 = database.prepare(`SELECT t.id,t.title,t.due_at,t.project_id,t.source_locator,t.created_at,group_concat(DISTINCT ta.role) AS role
26630
27013
  FROM task_assignments ta JOIN tasks t ON t.id=ta.task_id JOIN main.projects p ON p.id=t.project_id
26631
- WHERE ta.assignee_type='person' AND ta.assignee_id=? AND t.deleted_at IS NULL AND t.status='open'
27014
+ WHERE ta.assignee_type='person' AND ta.assignee_id=? AND t.deleted_at IS NULL AND t.status NOT IN ('done','dismissed')
26632
27015
  AND p.deleted_at IS NULL AND (p.account_id IS NULL OR p.account_id IN (SELECT a.id FROM accounts a
26633
27016
  JOIN json_each(?) k ON a.provider=json_extract(k.value,'$.provider')
26634
27017
  AND a.external_id=json_extract(k.value,'$.account')))
@@ -26645,7 +27028,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
26645
27028
  });
26646
27029
  }, "personPreparation");
26647
27030
 
26648
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
27031
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
26649
27032
  var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
26650
27033
  const id2 = Number(uid);
26651
27034
  if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
@@ -26653,7 +27036,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
26653
27036
  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)));
26654
27037
  }, "personSeenInAccounts");
26655
27038
 
26656
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
27039
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
26657
27040
  var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
26658
27041
  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);
26659
27042
  if (!row2)
@@ -26719,7 +27102,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
26719
27102
  return { id: id2, personId, removed: true };
26720
27103
  }, "removeNote");
26721
27104
 
26722
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/people.js
27105
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/people.js
26723
27106
  var accountPeopleOver = /* @__PURE__ */ __name((context) => {
26724
27107
  const { database } = context;
26725
27108
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
@@ -26794,13 +27177,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
26794
27177
  };
26795
27178
  }, "peopleStoreOver");
26796
27179
 
26797
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
27180
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
26798
27181
  import { createHash as createHash8 } from "node:crypto";
26799
27182
 
26800
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
27183
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
26801
27184
  import { createHash as createHash7 } from "node:crypto";
26802
27185
 
26803
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
27186
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
26804
27187
  var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
26805
27188
  var exhausted2 = /* @__PURE__ */ __name((budget) => {
26806
27189
  throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
@@ -27022,7 +27405,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
27022
27405
  };
27023
27406
  }, "rankReplyGraph");
27024
27407
 
27025
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
27408
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
27026
27409
  var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
27027
27410
  var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
27028
27411
  var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
@@ -27196,7 +27579,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
27196
27579
  return { items, evidence, summary, graph: graph.quality };
27197
27580
  }, "calculateAdminStatistics");
27198
27581
 
27199
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
27582
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
27200
27583
  var rankingContextRange = /* @__PURE__ */ __name((root) => {
27201
27584
  const dates = [];
27202
27585
  const visit = /* @__PURE__ */ __name((node, required3) => {
@@ -27218,7 +27601,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
27218
27601
  return dates[0].node.resolution.date;
27219
27602
  }, "rankingContextRange");
27220
27603
 
27221
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
27604
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
27222
27605
  var reactionCounts = /* @__PURE__ */ __name((stored3) => {
27223
27606
  let counts;
27224
27607
  try {
@@ -27236,9 +27619,9 @@ var reactionCounts = /* @__PURE__ */ __name((stored3) => {
27236
27619
  var column = /* @__PURE__ */ __name((name) => `"${name.replaceAll('"', '""')}"`, "column");
27237
27620
  var finite = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null, "finite");
27238
27621
  var metadata2 = /* @__PURE__ */ __name((alias2) => `CASE WHEN json_valid(${alias2}.metadata) THEN ${alias2}.metadata ELSE '{}' END`, "metadata");
27239
- var rankingCounter = /* @__PURE__ */ __name((alias2, field3, reactions = false) => {
27622
+ var rankingCounter = /* @__PURE__ */ __name((alias2, field4, reactions = false) => {
27240
27623
  const source2 = reactions ? `CASE WHEN json_valid(${alias2}.reactions) THEN ${alias2}.reactions ELSE '{}' END` : metadata2(alias2);
27241
- const path = reactions ? "$.total" : `$.${field3}`;
27624
+ const path = reactions ? "$.total" : `$.${field4}`;
27242
27625
  const value = `json_extract(${source2},'${path}')`;
27243
27626
  return `CASE WHEN json_type(${source2},'${path}') IN ('integer','real') AND ${value}>=0 AND ${value}<=1.7976931348623157e308 THEN CAST(${value} AS REAL) END`;
27244
27627
  }, "rankingCounter");
@@ -27513,7 +27896,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
27513
27896
  });
27514
27897
  }, "rankQuery");
27515
27898
 
27516
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
27899
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
27517
27900
  function fail4(message2, reason = "query.too-large") {
27518
27901
  throw new CliError("validation_error", message2, { reason, complete: false });
27519
27902
  }
@@ -27534,12 +27917,12 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
27534
27917
  } else
27535
27918
  scope3 += " AND c.searchable=1";
27536
27919
  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)"})`;
27537
- const bound4 = [...selection.params, ...params, lower, options.cutoff];
27538
- 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);
27920
+ const bound5 = [...selection.params, ...params, lower, options.cutoff];
27921
+ 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(...bound5);
27539
27922
  check3();
27540
27923
  if (Number(size2?.n ?? 0) > RANKING_GRAPH_LIMITS.nodes || Number(size2?.bytes ?? 0) > RANKING_GRAPH_LIMITS.bytes)
27541
27924
  fail4("admin statistics context exceeds node/byte budgets \u2014 narrow chat/date scope");
27542
- 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);
27925
+ 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(...bound5);
27543
27926
  const nodes = raw.map((row2) => {
27544
27927
  let metadata3 = {};
27545
27928
  try {
@@ -27690,7 +28073,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
27690
28073
  return result;
27691
28074
  }), "adminStatisticsQuery");
27692
28075
 
27693
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
28076
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
27694
28077
  var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
27695
28078
  if (!execution.accounts.length)
27696
28079
  return { conversations: [], chats: [] };
@@ -27708,7 +28091,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
27708
28091
  return { conversations: conversations2, chats: chats2 };
27709
28092
  }, "conversationEligibility");
27710
28093
 
27711
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
28094
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
27712
28095
  import { createHash as createHash9 } from "node:crypto";
27713
28096
  var EVIDENCE_BYTES = 64 * 1024;
27714
28097
  var FINGERPRINT_BYTES = 8 * 1024 * 1024;
@@ -27858,7 +28241,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
27858
28241
  return result;
27859
28242
  }, "rankingEvidence");
27860
28243
 
27861
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/queries.js
28244
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/queries.js
27862
28245
  var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
27863
28246
  const mailIndexed = /* @__PURE__ */ __name((execution) => {
27864
28247
  if (execution.corpus === "mail")
@@ -27877,7 +28260,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
27877
28260
  };
27878
28261
  }, "queriesStoreOver");
27879
28262
 
27880
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
28263
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
27881
28264
  var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
27882
28265
  const { database, now: now2 } = context;
27883
28266
  const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
@@ -27916,10 +28299,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
27916
28299
  }));
27917
28300
  }, "chatEventsOf");
27918
28301
 
27919
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
28302
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
27920
28303
  import { createHash as createHash10 } from "node:crypto";
27921
28304
 
27922
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/calendar.js
28305
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/calendar.js
27923
28306
  var calendarKey = /* @__PURE__ */ __name((zone, by) => {
27924
28307
  const format = new Intl.DateTimeFormat("en-CA", {
27925
28308
  timeZone: zone,
@@ -27934,7 +28317,7 @@ var calendarKey = /* @__PURE__ */ __name((zone, by) => {
27934
28317
  };
27935
28318
  }, "calendarKey");
27936
28319
 
27937
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/retention.js
28320
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/retention.js
27938
28321
  var RETENTION_TOLERANCE = 864e5;
27939
28322
  var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
27940
28323
  const { since, until, cutoff, checkpoints, within, limit, by } = options;
@@ -27988,7 +28371,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
27988
28371
  return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
27989
28372
  }, "retentionCohorts");
27990
28373
 
27991
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
28374
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
27992
28375
  var iso6 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
27993
28376
  var week = /* @__PURE__ */ __name((day) => {
27994
28377
  const date3 = /* @__PURE__ */ new Date(`${day}T00:00:00Z`);
@@ -28124,7 +28507,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
28124
28507
  };
28125
28508
  }, "retentionQuery");
28126
28509
 
28127
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
28510
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
28128
28511
  var iso7 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
28129
28512
  var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
28130
28513
  ...isBot === void 0 ? {} : { bot: isBot },
@@ -28255,7 +28638,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
28255
28638
  lastCount: memberCountsOf(context, pk).at(-1) ?? null
28256
28639
  })), "trackedChats");
28257
28640
 
28258
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/roster.js
28641
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/roster.js
28259
28642
  var rosterStoreOver = /* @__PURE__ */ __name((context) => {
28260
28643
  const { database } = context;
28261
28644
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
@@ -28311,7 +28694,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
28311
28694
  };
28312
28695
  }, "rosterStoreOver");
28313
28696
 
28314
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
28697
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
28315
28698
  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");
28316
28699
  var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
28317
28700
  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 ?`);
@@ -28335,7 +28718,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
28335
28718
  }
28336
28719
  }, "backfillNormalized");
28337
28720
 
28338
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
28721
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
28339
28722
  var INDEX2 = "message_words";
28340
28723
  var searchIndexState2 = /* @__PURE__ */ __name((database) => {
28341
28724
  const row2 = indexRow(database, INDEX2);
@@ -28462,7 +28845,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
28462
28845
  });
28463
28846
  }, "resetSearchIndex");
28464
28847
 
28465
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
28848
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
28466
28849
  var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
28467
28850
  const filled2 = { stemmed: 0, drained: 0 };
28468
28851
  const before2 = stemsState(database);
@@ -28557,7 +28940,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
28557
28940
  return resetStems(database, { now: now2 });
28558
28941
  }, "followDefaultStemmers");
28559
28942
 
28560
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
28943
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
28561
28944
  var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
28562
28945
  var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
28563
28946
  const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
@@ -28579,7 +28962,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
28579
28962
  });
28580
28963
  }, "termCandidates");
28581
28964
 
28582
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/search-index.js
28965
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/search-index.js
28583
28966
  var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
28584
28967
  const { database } = context;
28585
28968
  const stemmerFor2 = stemmerCache();
@@ -28601,7 +28984,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
28601
28984
  };
28602
28985
  }, "searchIndexStoreOver");
28603
28986
 
28604
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
28987
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
28605
28988
  var HISTORY_KEPT = 1e3;
28606
28989
  var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
28607
28990
  var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
@@ -28670,7 +29053,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
28670
29053
  return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
28671
29054
  }, "clearHistory");
28672
29055
 
28673
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/searches.js
29056
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/searches.js
28674
29057
  var searchesStoreOver = /* @__PURE__ */ __name((context) => {
28675
29058
  const { database } = context;
28676
29059
  return {
@@ -28694,7 +29077,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
28694
29077
  };
28695
29078
  }, "searchesStoreOver");
28696
29079
 
28697
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
29080
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
28698
29081
  var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
28699
29082
  var ACTION_OUTCOMES = ["ok", "refused", "failed"];
28700
29083
  var CODE = /^[a-z][a-z0-9_]{0,63}$/;
@@ -28737,7 +29120,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
28737
29120
  };
28738
29121
  }, "agentActionsStoreOver");
28739
29122
 
28740
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
29123
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
28741
29124
  var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
28742
29125
  }) => {
28743
29126
  const { database, now: now2 } = context;
@@ -28796,7 +29179,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
28796
29179
  };
28797
29180
  }, "botUpdateStoreOver");
28798
29181
 
28799
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
29182
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
28800
29183
  var DAY4 = 864e5;
28801
29184
  var listEvents = /* @__PURE__ */ __name((database, filter) => {
28802
29185
  const clauses = ["e.deleted_at IS NULL"];
@@ -28881,7 +29264,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
28881
29264
  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);
28882
29265
  }, "listEvents");
28883
29266
 
28884
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
29267
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
28885
29268
  var calendarOf = /* @__PURE__ */ __name((row2) => ({
28886
29269
  id: Number(row2.id),
28887
29270
  accountId: Number(row2.account_id),
@@ -29461,7 +29844,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
29461
29844
  };
29462
29845
  }, "eventStoreOver");
29463
29846
 
29464
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
29847
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
29465
29848
  var CATALOG_QUERY = defineQuery({
29466
29849
  entity: "document",
29467
29850
  backend: "sql",
@@ -29499,7 +29882,7 @@ var objectOf2 = /* @__PURE__ */ __name((value) => {
29499
29882
  throw new CliError("invalid_response", "stored catalog metadata must be an object");
29500
29883
  return parsed2;
29501
29884
  }, "objectOf");
29502
- var field = /* @__PURE__ */ __name((value, max = 4e3) => {
29885
+ var field2 = /* @__PURE__ */ __name((value, max = 4e3) => {
29503
29886
  if (typeof value !== "string" || !value || value.length > max)
29504
29887
  throw new CliError("validation_error", "catalog field is empty or too long");
29505
29888
  return value;
@@ -29534,7 +29917,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
29534
29917
  throw new CliError("not_found", "catalog account is not in the local store");
29535
29918
  return Number(id2);
29536
29919
  }, "account");
29537
- const bound4 = /* @__PURE__ */ __name((id2, includeInactive = false) => {
29920
+ const bound5 = /* @__PURE__ */ __name((id2, includeInactive = false) => {
29538
29921
  const scope3 = "account_id = ? AND json_type(metadata, '$.catalog') = 'object'" + (includeInactive ? "" : " AND json_extract(metadata, '$.catalog.active') = 1 AND deleted_at IS NULL");
29539
29922
  const budget = database.prepare(`SELECT count(*) AS entries, sum(length(metadata)) AS bytes FROM documents WHERE ${scope3}`).get(id2);
29540
29923
  if (Number(budget?.bytes ?? 0) > 32 * 1024 * 1024)
@@ -29549,14 +29932,14 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
29549
29932
  throw new CliError("validation_error", "catalog writes take at most 200 entries");
29550
29933
  const seen = /* @__PURE__ */ new Set();
29551
29934
  const checked = inputs.map((input) => {
29552
- field(input.externalId);
29935
+ field2(input.externalId);
29553
29936
  if (seen.has(input.externalId))
29554
29937
  throw new CliError("validation_error", "catalog batch repeats an external id");
29555
29938
  seen.add(input.externalId);
29556
29939
  if (!["file", "folder"].includes(input.kind) || typeof input.name !== "string" || input.name.length > 4e3 || !Array.isArray(input.parents) || input.parents.length > 100)
29557
29940
  throw new CliError("validation_error", "invalid catalog name, kind or parents");
29558
29941
  for (const parent2 of input.parents)
29559
- field(parent2);
29942
+ field2(parent2);
29560
29943
  if (input.actors !== void 0) {
29561
29944
  if (!Array.isArray(input.actors) || input.actors.length > 100)
29562
29945
  throw new CliError("validation_error", "invalid catalog actors");
@@ -29565,7 +29948,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
29565
29948
  throw new CliError("validation_error", "invalid catalog actor");
29566
29949
  for (const value of [actor.id, actor.name, actor.email, actor.role])
29567
29950
  if (value !== void 0)
29568
- field(value);
29951
+ field2(value);
29569
29952
  }
29570
29953
  }
29571
29954
  if (input.size !== void 0 && (!Number.isSafeInteger(input.size) || input.size < 0))
@@ -29617,7 +30000,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
29617
30000
  const id2 = account(accountId);
29618
30001
  if (externalIds.length > 1e4)
29619
30002
  throw new CliError("validation_error", "catalog scope exceeds 10000 entries");
29620
- const current = [...new Set(externalIds.map((key2) => field(key2)))];
30003
+ const current = [...new Set(externalIds.map((key2) => field2(key2)))];
29621
30004
  return write(database, () => {
29622
30005
  const retired = database.prepare("UPDATE documents SET metadata=json_set(metadata, '$.catalog.active', json('false')) WHERE account_id=? AND json_type(metadata, '$.catalog')='object' AND json_extract(metadata, '$.catalog.active')=1" + (current.length ? " AND external_id NOT IN (SELECT value FROM json_each(?))" : "") + " RETURNING id").all(...current.length ? [id2, JSON.stringify(current)] : [id2]);
29623
30006
  const at = now2();
@@ -29696,14 +30079,14 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
29696
30079
  if (compiled.sql)
29697
30080
  add(compiled.sql, ...compiled.params);
29698
30081
  }
29699
- bound4(id2, query.includeInactive);
30082
+ bound5(id2, query.includeInactive);
29700
30083
  const found2 = database.prepare(`SELECT d.id, d.external_id, d.title, d.front_matter, d.metadata, d.deleted_at, d.body IS NOT NULL AS has_body FROM documents d WHERE ${clauses.join(" AND ")} ORDER BY d.external_id LIMIT ? OFFSET ?`).all(...params, limit + 1, offset);
29701
30084
  return { items: found2.slice(0, limit).map(entryOf2), hasMore: found2.length > limit };
29702
30085
  }, "list")
29703
30086
  };
29704
30087
  }, "catalogStoreOver");
29705
30088
 
29706
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/context/evidence.js
30089
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/context/evidence.js
29707
30090
  import { createHash as createHash11 } from "node:crypto";
29708
30091
  var CONTEXT_MAX_READ_BYTES = 262144;
29709
30092
  var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
@@ -29801,20 +30184,20 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
29801
30184
  return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
29802
30185
  }, "contextEvidenceRequest");
29803
30186
 
29804
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
30187
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
29805
30188
  var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
29806
- var field2 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
30189
+ var field3 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
29807
30190
  CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
29808
30191
  var preferred = /* @__PURE__ */ __name((column2) => `(SELECT f.${column2} FROM files f JOIN documents d ON d.id = f.document_id WHERE f.document_id = n.id
29809
30192
  ORDER BY ${PREFERRED_FILE} LIMIT 1)`, "preferred");
29810
- var modified = `round(unixepoch(${field2("modifiedAt")},'subsec')*1000)`;
30193
+ var modified = `round(unixepoch(${field3("modifiedAt")},'subsec')*1000)`;
29811
30194
  var remoteTime = `coalesce(${preferred("external_updated_at")},n.external_updated_at,${modified})`;
29812
30195
  var contextDocumentTime = `coalesce(${remoteTime},n.updated_at)`;
29813
30196
  var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
29814
30197
  THEN 'source-modified' ELSE 'stored-update' END`;
29815
- var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field2("sourceUrl")})`;
30198
+ var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field3("sourceUrl")})`;
29816
30199
 
29817
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
30200
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
29818
30201
  var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
29819
30202
  const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
29820
30203
  signal?.throwIfAborted();
@@ -29913,7 +30296,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
29913
30296
  });
29914
30297
  }, "readMeetingContextEvidence");
29915
30298
 
29916
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
30299
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
29917
30300
  var corpora = {
29918
30301
  message: {
29919
30302
  table: "messages",
@@ -30142,7 +30525,7 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
30142
30525
  }
30143
30526
  }), "contextRecordsOver");
30144
30527
 
30145
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
30528
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
30146
30529
  var NOTE_FIELDS = [
30147
30530
  "text",
30148
30531
  "exact",
@@ -30159,7 +30542,7 @@ var NOTE_FIELDS = [
30159
30542
  "source"
30160
30543
  ];
30161
30544
  var quoted2 = /* @__PURE__ */ __name((value) => `"${value.replaceAll('"', '""')}"`, "quoted");
30162
- var bound3 = /* @__PURE__ */ __name((sql2, ...params) => ({ sql: sql2, params, exact: true }), "bound");
30545
+ var bound4 = /* @__PURE__ */ __name((sql2, ...params) => ({ sql: sql2, params, exact: true }), "bound");
30163
30546
  var combine2 = /* @__PURE__ */ __name((parts, operator) => ({
30164
30547
  sql: parts.length ? `(${parts.map(({ sql: sql2 }) => sql2).join(` ${operator} `)})` : operator === "AND" ? "1" : "0",
30165
30548
  params: parts.flatMap(({ params }) => params),
@@ -30174,8 +30557,8 @@ var CORPORA2 = [
30174
30557
  words: "document_words",
30175
30558
  stems: "document_stems",
30176
30559
  live: "coalesce(json_extract(n.metadata, '$.catalog.active'), 1)=1",
30177
- inAccounts: /* @__PURE__ */ __name((ids) => bound3("n.folder_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))", ids), "inAccounts"),
30178
- tagged: /* @__PURE__ */ __name((tag2) => bound3(`(n.id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'document') OR n.folder_id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'account') OR EXISTS (SELECT 1 FROM links l JOIN resolved_tags t ON t.id=l.to_id WHERE l.from_type = 'account' AND l.from_id = n.folder_id AND l.kind = ${linkKind("labelled")} AND l.to_type = 'tag' AND t.name = ? AND substr(n.path, 1, length(l.anchor) + 1) = l.anchor || '/'))`, tag2, tag2, tag2), "tagged")
30560
+ inAccounts: /* @__PURE__ */ __name((ids) => bound4("n.folder_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))", ids), "inAccounts"),
30561
+ tagged: /* @__PURE__ */ __name((tag2) => bound4(`(n.id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'document') OR n.folder_id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'account') OR EXISTS (SELECT 1 FROM links l JOIN resolved_tags t ON t.id=l.to_id WHERE l.from_type = 'account' AND l.from_id = n.folder_id AND l.kind = ${linkKind("labelled")} AND l.to_type = 'tag' AND t.name = ? AND substr(n.path, 1, length(l.anchor) + 1) = l.anchor || '/'))`, tag2, tag2, tag2), "tagged")
30179
30562
  },
30180
30563
  {
30181
30564
  type: "note",
@@ -30184,7 +30567,7 @@ var CORPORA2 = [
30184
30567
  view: "(SELECT id, NULL AS folder_id, NULL AS path, title, body AS text, NULL AS metadata, updated_at AS at, deleted_at FROM notes)",
30185
30568
  words: "note_words",
30186
30569
  stems: "note_stems",
30187
- tagged: /* @__PURE__ */ __name((tag2) => bound3("n.id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'note')", tag2), "tagged")
30570
+ tagged: /* @__PURE__ */ __name((tag2) => bound4("n.id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'note')", tag2), "tagged")
30188
30571
  }
30189
30572
  ];
30190
30573
  var matchedRows = /* @__PURE__ */ __name((context, query) => {
@@ -30249,17 +30632,17 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
30249
30632
  let titles;
30250
30633
  const foldedTitles = /* @__PURE__ */ __name(() => titles ??= database.prepare(`SELECT id, title FROM ${corpus.view} n WHERE n.title IS NOT NULL AND n.deleted_at IS NULL`).all().map((row2) => ({ id: Number(row2.id), title: normalize(String(row2.title)) })), "foldedTitles");
30251
30634
  const leaf2 = /* @__PURE__ */ __name((node) => {
30252
- const { field: field3, operator, value } = node;
30253
- if (!corpus.fields.includes(field3))
30254
- searchError("query.unsupported-field", node.span, `${field3}: is not ${corpus.noun === "event" ? "an" : "a"} ${corpus.noun} field \u2014 ${corpus.noun}s take ${corpus.fields.join(", ")}`);
30255
- if ((field3 === "text" || field3 === "exact") && value === "")
30256
- return bound3("0");
30635
+ const { field: field4, operator, value } = node;
30636
+ if (!corpus.fields.includes(field4))
30637
+ searchError("query.unsupported-field", node.span, `${field4}: is not ${corpus.noun === "event" ? "an" : "a"} ${corpus.noun} field \u2014 ${corpus.noun}s take ${corpus.fields.join(", ")}`);
30638
+ if ((field4 === "text" || field4 === "exact") && value === "")
30639
+ return bound4("0");
30257
30640
  if (isStemmed(node)) {
30258
30641
  if (!query.stemmer)
30259
30642
  throw new Error("a stemmed leaf reached the notes search without the store's stemmer");
30260
30643
  const text5 = normalize(value);
30261
30644
  if (!/[\p{L}\p{N}]/u.test(text5))
30262
- return bound3("0");
30645
+ return bound4("0");
30263
30646
  const stems = query.stemmer.phrases(value);
30264
30647
  return {
30265
30648
  sql: `n.id IN (SELECT rowid FROM ${corpus.words} WHERE ${corpus.words} MATCH ?)${stems ? ` OR n.id IN (SELECT rowid FROM ${corpus.stems} WHERE ${corpus.stems} MATCH ?)` : ""}`,
@@ -30269,11 +30652,11 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
30269
30652
  ...stems ? { stems } : {}
30270
30653
  };
30271
30654
  }
30272
- if (field3 === "text" || field3 === "exact") {
30655
+ if (field4 === "text" || field4 === "exact") {
30273
30656
  if (operator === "term" || operator === "phrase") {
30274
30657
  const text5 = normalize(value);
30275
30658
  const stems = query.stemmer?.phrases(value);
30276
- return /[\p{L}\p{N}]/u.test(text5) ? { ...wordMatch2(quoted2(text5)), ...stems ? { stems } : {} } : bound3("0");
30659
+ return /[\p{L}\p{N}]/u.test(text5) ? { ...wordMatch2(quoted2(text5)), ...stems ? { stems } : {} } : bound4("0");
30277
30660
  }
30278
30661
  const pattern = operator === "wildcard" ? wildcardPattern(normalize(value)) : foldRegex(value, node.span);
30279
30662
  const matcher = automaton(pattern, node);
@@ -30286,54 +30669,54 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
30286
30669
  check3();
30287
30670
  return matcher.test(String(term), budget) ? [quoted2(String(term))] : [];
30288
30671
  });
30289
- return matches2.length ? wordMatch2(matches2.join(" OR ")) : bound3("0");
30672
+ return matches2.length ? wordMatch2(matches2.join(" OR ")) : bound4("0");
30290
30673
  }
30291
- if (field3 === "body") {
30674
+ if (field4 === "body") {
30292
30675
  if (operator === "term" || operator === "phrase")
30293
- return bound3("n.text = ?", value);
30676
+ return bound4("n.text = ?", value);
30294
30677
  const matcher = automaton(operator === "wildcard" ? wildcardPattern(value) : value, node);
30295
30678
  tests.set(node, (text5) => matcher.test(text5, budget));
30296
30679
  return { sql: "1", params: [], exact: false };
30297
30680
  }
30298
- if (field3 === "tag") {
30681
+ if (field4 === "tag") {
30299
30682
  const tag2 = tagOf(value);
30300
30683
  if (tag2 === void 0)
30301
30684
  searchError("query.invalid-tag", node.span);
30302
- return corpus.tagged?.(canonicalTagNamed(database, tag2)?.name ?? tag2) ?? bound3("0");
30685
+ return corpus.tagged?.(canonicalTagNamed(database, tag2)?.name ?? tag2) ?? bound4("0");
30303
30686
  }
30304
- if (field3 === "source")
30305
- return bound3(value.toLowerCase() === (corpus.type === "note" ? "internal" : "file") ? "1" : "0");
30306
- if (field3 === "has") {
30687
+ if (field4 === "source")
30688
+ return bound4(value.toLowerCase() === (corpus.type === "note" ? "internal" : "file") ? "1" : "0");
30689
+ if (field4 === "has") {
30307
30690
  if (value.toLowerCase() !== "text")
30308
30691
  searchError("query.unknown-value", node.span, `has:${value} is a message field \u2014 notes take has:text`);
30309
- return bound3("length(trim(coalesce(n.text,''))) > 0");
30692
+ return bound4("length(trim(coalesce(n.text,''))) > 0");
30310
30693
  }
30311
- if (field3 === "title" || field3 === "site" || field3 === "lang" || field3 === "author" || field3 === "keyword") {
30694
+ if (field4 === "title" || field4 === "site" || field4 === "lang" || field4 === "author" || field4 === "keyword") {
30312
30695
  const wanted = normalize(value);
30313
30696
  if (wanted === "")
30314
- return bound3("0");
30697
+ return bound4("0");
30315
30698
  const folded5 = /* @__PURE__ */ __name((key2) => `coalesce(json_extract(n.metadata, '$.folded.${key2}'), '')`, "folded");
30316
- if (field3 === "keyword")
30317
- return bound3("EXISTS (SELECT 1 FROM json_each(n.metadata, '$.folded.keywords') WHERE value = ?)", wanted);
30318
- if (field3 === "lang")
30319
- return bound3(`(${folded5("language")} = ? OR ${folded5("language")} LIKE ? || '-%')`, wanted, wanted);
30320
- if (field3 === "title") {
30699
+ if (field4 === "keyword")
30700
+ return bound4("EXISTS (SELECT 1 FROM json_each(n.metadata, '$.folded.keywords') WHERE value = ?)", wanted);
30701
+ if (field4 === "lang")
30702
+ return bound4(`(${folded5("language")} = ? OR ${folded5("language")} LIKE ? || '-%')`, wanted, wanted);
30703
+ if (field4 === "title") {
30321
30704
  check3();
30322
30705
  const ids = foldedTitles().flatMap(({ id: id2, title }) => title.includes(wanted) ? [id2] : []);
30323
- return bound3(`(instr(${folded5("title")}, ?) > 0 OR n.id IN (SELECT value FROM json_each(?)))`, wanted, JSON.stringify(ids));
30706
+ return bound4(`(instr(${folded5("title")}, ?) > 0 OR n.id IN (SELECT value FROM json_each(?)))`, wanted, JSON.stringify(ids));
30324
30707
  }
30325
- return bound3(`instr(${folded5(field3)}, ?) > 0`, wanted);
30708
+ return bound4(`instr(${folded5(field4)}, ?) > 0`, wanted);
30326
30709
  }
30327
- if (field3 === "date") {
30710
+ if (field4 === "date") {
30328
30711
  const range = node.resolution?.date;
30329
30712
  if (!range)
30330
30713
  searchError("query.invalid-ast", node.span);
30331
30714
  return combine2([
30332
- ...range.lower === void 0 ? [] : [bound3(`n.at ${range.lower_inclusive ? ">=" : ">"} ?`, range.lower)],
30333
- ...range.upper === void 0 ? [] : [bound3(`n.at ${range.upper_inclusive ? "<=" : "<"} ?`, range.upper)]
30715
+ ...range.lower === void 0 ? [] : [bound4(`n.at ${range.lower_inclusive ? ">=" : ">"} ?`, range.lower)],
30716
+ ...range.upper === void 0 ? [] : [bound4(`n.at ${range.upper_inclusive ? "<=" : "<"} ?`, range.upper)]
30334
30717
  ], "AND");
30335
30718
  }
30336
- return bound3([corpus.noun, `${corpus.noun}s`].includes(value.toLowerCase()) ? "1" : "0");
30719
+ return bound4([corpus.noun, `${corpus.noun}s`].includes(value.toLowerCase()) ? "1" : "0");
30337
30720
  }, "leaf");
30338
30721
  const compile2 = /* @__PURE__ */ __name((node) => {
30339
30722
  if (node.kind === "predicate") {
@@ -30364,10 +30747,10 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
30364
30747
  const expression = compile2(query.root);
30365
30748
  const stemmed = [...fragments.keys()].some(isStemmed);
30366
30749
  const scope3 = combine2([
30367
- bound3("n.deleted_at IS NULL"),
30368
- ...corpus.live ? [bound3(corpus.live)] : [],
30750
+ bound4("n.deleted_at IS NULL"),
30751
+ ...corpus.live ? [bound4(corpus.live)] : [],
30369
30752
  ...query.accountIds?.length && corpus.inAccounts ? [corpus.inAccounts(JSON.stringify(query.accountIds))] : [],
30370
- ...query.ids ? [bound3("n.id IN (SELECT value FROM json_each(?))", JSON.stringify(query.ids))] : []
30753
+ ...query.ids ? [bound4("n.id IN (SELECT value FROM json_each(?))", JSON.stringify(query.ids))] : []
30371
30754
  ], "AND");
30372
30755
  const where = combine2([scope3, expression], "AND");
30373
30756
  const ranking = query.newest ? void 0 : required3(query.root, stemmed ? "stems" : "fts");
@@ -30572,7 +30955,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
30572
30955
  };
30573
30956
  }, "noteSearchOver");
30574
30957
 
30575
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
30958
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
30576
30959
  var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
30577
30960
  var inEventAccounts = /* @__PURE__ */ __name((event) => searchableCopy(event, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
30578
30961
  var EVENT_CORPUS = {
@@ -30704,7 +31087,7 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
30704
31087
  };
30705
31088
  }, "eventSearchOver");
30706
31089
 
30707
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
31090
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
30708
31091
  var EVIDENCE_FINDINGS_KIND = "evidence_findings";
30709
31092
  var reference = /* @__PURE__ */ __name((raw) => {
30710
31093
  if (/^document:[1-9]\d*$/.test(raw))
@@ -30717,7 +31100,7 @@ var reference = /* @__PURE__ */ __name((raw) => {
30717
31100
  }, "reference");
30718
31101
  var validateEvidenceFindings = /* @__PURE__ */ __name((input) => validateFindings(input, { plural: "evidence findings", singular: "evidence finding", cited: "reference", reference }), "validateEvidenceFindings");
30719
31102
 
30720
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/moment.js
31103
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/domain/moment.js
30721
31104
  var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
30722
31105
  try {
30723
31106
  return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
@@ -30729,7 +31112,7 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
30729
31112
  }
30730
31113
  }, "calendarMoment");
30731
31114
 
30732
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
31115
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
30733
31116
  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";
30734
31117
  var iso8 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
30735
31118
  var oneOf4 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -30767,12 +31150,12 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
30767
31150
  const accept = /* @__PURE__ */ __name((id2) => {
30768
31151
  const row2 = database.prepare("SELECT * FROM facts WHERE id = ?").get(id2);
30769
31152
  if (row2.status !== "proposed" && row2.status !== "accepted")
30770
- throw new CliError("validation_error", `a ${String(row2.status)} decision cannot be accepted`);
31153
+ throw new CliError("validation_error", `a ${String(row2.status)} fact cannot be accepted`);
30771
31154
  const { actor } = authorActor(context, "owner");
30772
31155
  const at = now2();
30773
31156
  database.prepare("UPDATE facts SET status = 'accepted', confirmed_by_type = ?, confirmed_by_id = ?, updated_at = ? WHERE id = ?").run(actor.type, actor.id, at, id2);
30774
31157
  if (row2.supersedes_id != null)
30775
- database.prepare("UPDATE facts SET status = 'superseded', updated_at = ? WHERE id = ? AND status = 'accepted'").run(at, Number(row2.supersedes_id));
31158
+ database.prepare("UPDATE facts SET status = 'superseded', updated_at = ? WHERE id = ? AND status IN ('proposed', 'accepted')").run(at, Number(row2.supersedes_id));
30776
31159
  }, "accept");
30777
31160
  return {
30778
31161
  add: /* @__PURE__ */ __name((input) => {
@@ -30784,16 +31167,14 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
30784
31167
  const occurredAt = input.occurredAt === void 0 ? null : calendarMoment(input.occurredAt, "occurredAt");
30785
31168
  if (occurredAt !== null && !Number.isFinite(occurredAt))
30786
31169
  throw new CliError("validation_error", "occurredAt takes an ISO timestamp");
30787
- if (input.supersedes !== void 0 && type !== "decision")
30788
- throw new CliError("validation_error", "only a decision supersedes another");
30789
31170
  const id2 = write(database, () => {
30790
31171
  const project = input.project === void 0 ? void 0 : requiredThing(database, input.project, "the project");
30791
31172
  if (project && project.type !== "project")
30792
31173
  throw new CliError("validation_error", `${input.project} is not a project`);
30793
31174
  const subject2 = input.subject === void 0 ? void 0 : requiredThing(database, input.subject, "the subject");
30794
31175
  const replaced = input.supersedes === void 0 ? void 0 : rowOf(input.supersedes);
30795
- if (replaced && replaced.type !== "decision")
30796
- throw new CliError("validation_error", `${input.supersedes} is not a decision`);
31176
+ if (replaced && replaced.status !== "proposed" && replaced.status !== "accepted")
31177
+ throw new CliError("validation_error", `${input.supersedes} is ${String(replaced.status)}; only a proposed or accepted fact can be corrected`);
30797
31178
  const owner = input.by === "owner";
30798
31179
  const { actor, model } = authorActor(context, input.by);
30799
31180
  const at = now2();
@@ -30880,7 +31261,7 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
30880
31261
  };
30881
31262
  }, "factsStoreOver");
30882
31263
 
30883
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
31264
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
30884
31265
  var invalid2 = /* @__PURE__ */ __name((message2) => {
30885
31266
  throw new CliError("validation_error", message2);
30886
31267
  }, "invalid");
@@ -30970,7 +31351,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
30970
31351
  return { snapshot: snapshot2, snapshotParts, previous, outcomes };
30971
31352
  }, "findingsCoreOver");
30972
31353
 
30973
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
31354
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
30974
31355
  var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
30975
31356
  var PROPOSAL_VERDICTS = ["useful", "not_useful"];
30976
31357
  var iso9 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
@@ -31116,7 +31497,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
31116
31497
  };
31117
31498
  }, "proposedActionsStoreOver");
31118
31499
 
31119
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
31500
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
31120
31501
  var stale = /* @__PURE__ */ __name(() => {
31121
31502
  throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
31122
31503
  reason: "evidence-findings.stale"
@@ -31282,7 +31663,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31282
31663
  };
31283
31664
  }, "evidenceFindingsStoreOver");
31284
31665
 
31285
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
31666
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
31286
31667
  var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
31287
31668
  var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
31288
31669
  rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
@@ -31307,7 +31688,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
31307
31688
  ...since === void 0 ? [] : [["AND i.occurred_at>=?", since]],
31308
31689
  ...until === void 0 ? [] : [["AND i.occurred_at<=?", until]]
31309
31690
  ];
31310
- const bound4 = before2 === void 0 ? [] : [before2.at, before2.at, before2.id];
31691
+ const bound5 = before2 === void 0 ? [] : [before2.at, before2.at, before2.id];
31311
31692
  const account = only === void 0 ? [] : [only.provider, only.account];
31312
31693
  return database.prepare(`SELECT i.*, a.provider, a.external_id AS account, c.external_id AS chat, m.external_id AS message
31313
31694
  FROM involvements i LEFT JOIN projects pr ON pr.id=i.project_id
@@ -31316,7 +31697,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
31316
31697
  LEFT JOIN chats c ON c.id=CASE WHEN i.subject_type='chat' THEN i.subject_id ELSE m.chat_id END
31317
31698
  WHERE i.person_id=? ${filters.map(([sql2]) => sql2).join(" ")}
31318
31699
  ${before2 === void 0 ? "" : "AND (i.occurred_at<? OR (i.occurred_at=? AND i.id<?))"}
31319
- ${only === void 0 ? "" : "AND (a.provider IS NULL OR a.provider<>? OR a.external_id=?)"} ORDER BY i.occurred_at DESC, i.id DESC LIMIT ?`).all(personId, ...filters.map(([, value]) => value), ...bound4, ...account, limit).map((row2) => ({
31700
+ ${only === void 0 ? "" : "AND (a.provider IS NULL OR a.provider<>? OR a.external_id=?)"} ORDER BY i.occurred_at DESC, i.id DESC LIMIT ?`).all(personId, ...filters.map(([, value]) => value), ...bound5, ...account, limit).map((row2) => ({
31320
31701
  id: Number(row2.id),
31321
31702
  personId: Number(row2.person_id),
31322
31703
  identityId: row2.identity_id == null ? null : Number(row2.identity_id),
@@ -31335,7 +31716,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
31335
31716
  }, "forPerson")
31336
31717
  }), "involvementStoreOver");
31337
31718
 
31338
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
31719
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
31339
31720
  import { createHash as createHash12 } from "node:crypto";
31340
31721
  var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
31341
31722
  var id = /* @__PURE__ */ __name((value) => {
@@ -31421,24 +31802,24 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
31421
31802
  };
31422
31803
  }, "meetingProjectsStoreOver");
31423
31804
 
31424
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
31805
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
31425
31806
  import { createHash as createHash15 } from "node:crypto";
31426
31807
 
31427
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
31808
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
31428
31809
  import { createHash as createHash14 } from "node:crypto";
31429
31810
 
31430
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
31811
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
31431
31812
  import { createHash as createHash13 } from "node:crypto";
31432
31813
 
31433
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
31434
- var consolidationId = /* @__PURE__ */ __name((value, field3) => {
31814
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
31815
+ var consolidationId = /* @__PURE__ */ __name((value, field4) => {
31435
31816
  if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
31436
- throw new CliError("validation_error", `${field3} must be a positive canonical tag id`);
31817
+ throw new CliError("validation_error", `${field4} must be a positive canonical tag id`);
31437
31818
  return Number(value);
31438
31819
  }, "consolidationId");
31439
- var bounded = /* @__PURE__ */ __name((value, max, field3) => {
31820
+ var bounded = /* @__PURE__ */ __name((value, max, field4) => {
31440
31821
  if (!Number.isSafeInteger(value) || value < 1 || value > max)
31441
- throw new CliError("validation_error", `${field3} must be an integer from 1 to ${max}`);
31822
+ throw new CliError("validation_error", `${field4} must be an integer from 1 to ${max}`);
31442
31823
  return value;
31443
31824
  }, "bounded");
31444
31825
  var consolidationInput = /* @__PURE__ */ __name((options, apply = false) => {
@@ -31453,9 +31834,9 @@ var consolidationInput = /* @__PURE__ */ __name((options, apply = false) => {
31453
31834
  "signal",
31454
31835
  ...apply ? ["by", "expectedPreviewFingerprint", "idempotencyKey"] : ["sampleLimit"]
31455
31836
  ]);
31456
- for (const field3 of Object.keys(options))
31457
- if (!allowed.has(field3))
31458
- throw new CliError("validation_error", `unknown consolidation field: ${field3}`);
31837
+ for (const field4 of Object.keys(options))
31838
+ if (!allowed.has(field4))
31839
+ throw new CliError("validation_error", `unknown consolidation field: ${field4}`);
31459
31840
  const source2 = consolidationId(options.sourceId, "sourceId");
31460
31841
  const survivor = consolidationId(options.survivorId, "survivorId");
31461
31842
  if (source2 === survivor)
@@ -31481,7 +31862,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
31481
31862
  return input;
31482
31863
  }, "consolidationApplyInput");
31483
31864
 
31484
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
31865
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
31485
31866
  var receiptOf = /* @__PURE__ */ __name((row2) => ({
31486
31867
  id: String(row2.id),
31487
31868
  sourceId: String(row2.source_id),
@@ -31556,7 +31937,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
31556
31937
  }, { beforeCommit: check3 });
31557
31938
  }, "applyTagConsolidation");
31558
31939
 
31559
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
31940
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
31560
31941
  var selections = [
31561
31942
  ["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
31562
31943
  ["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
@@ -31639,9 +32020,9 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
31639
32020
  totals.survivor++;
31640
32021
  byTargetType.set(type, totals);
31641
32022
  }
31642
- const counts = /* @__PURE__ */ __name((values, field3) => ({
31643
- source: values.filter((row2) => sourceMembers.has(Number(row2[field3]))).length,
31644
- survivor: values.filter((row2) => !sourceMembers.has(Number(row2[field3]))).length
32023
+ const counts = /* @__PURE__ */ __name((values, field4) => ({
32024
+ source: values.filter((row2) => sourceMembers.has(Number(row2[field4]))).length,
32025
+ survivor: values.filter((row2) => !sourceMembers.has(Number(row2[field4]))).length
31645
32026
  }), "counts");
31646
32027
  const overlaps = /* @__PURE__ */ __name((values, key2) => {
31647
32028
  const targets = new Set(values.filter((row2) => sourceMembers.has(Number(row2.tag_id))).map(key2));
@@ -31700,7 +32081,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
31700
32081
  };
31701
32082
  }, "previewRows");
31702
32083
 
31703
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
32084
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
31704
32085
  var kinds = ["project", "tag", "topic"];
31705
32086
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
31706
32087
  if (signal?.aborted)
@@ -31964,7 +32345,7 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
31964
32345
  };
31965
32346
  }, "vocabularyStoreOver");
31966
32347
 
31967
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
32348
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
31968
32349
  var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
31969
32350
  var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
31970
32351
  var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
@@ -32188,7 +32569,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
32188
32569
  }, "due");
32189
32570
  const openTask = /* @__PURE__ */ __name((key2, id2) => {
32190
32571
  const row2 = taskRowOf(database, id2);
32191
- const open = row2 !== void 0 && taskAccountOf(database, row2) === taskAccount(key2) && database.prepare("SELECT status FROM tasks WHERE id = ?").get(row2)?.status === "open";
32572
+ const open = row2 !== void 0 && taskAccountOf(database, row2) === taskAccount(key2) && !isClosedState(String(database.prepare("SELECT status FROM tasks WHERE id = ?").get(row2)?.status ?? "done"));
32192
32573
  if (!open)
32193
32574
  throw new CliError("validation_error", "a reminder requires an open task in this account");
32194
32575
  return row2;
@@ -32460,7 +32841,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
32460
32841
  if (!Number.isInteger(lease) || lease < 1e3 || lease > 36e5)
32461
32842
  throw new CliError("validation_error", "lease takes 1000\u20133600000 milliseconds");
32462
32843
  const accountId = account(key2), at = now2();
32463
- const rows = database.prepare("SELECT r.id FROM reminders r JOIN tasks t ON t.id = r.task_id WHERE r.account_id=? AND r.due_at<=? AND t.status = 'open' AND (r.state='pending' OR (r.state='leased' AND r.lease_until<=?)) ORDER BY r.due_at, r.id LIMIT ?").all(accountId, at, at, limit);
32844
+ const rows = database.prepare("SELECT r.id FROM reminders r JOIN tasks t ON t.id = r.task_id WHERE r.account_id=? AND r.due_at<=? AND t.status NOT IN ('done','dismissed') AND (r.state='pending' OR (r.state='leased' AND r.lease_until<=?)) ORDER BY r.due_at, r.id LIMIT ?").all(accountId, at, at, limit);
32464
32845
  const claimed = [];
32465
32846
  for (const row2 of rows) {
32466
32847
  const receipt = ulid(at);
@@ -32486,7 +32867,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
32486
32867
  return key2.padEnd(3, "X");
32487
32868
  }, "projectKey");
32488
32869
 
32489
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
32870
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
32490
32871
  var DAY5 = 864e5;
32491
32872
  var SETTING4 = "logs_pruned_at";
32492
32873
  var LOG_RETENTION = { agentActionsMs: 90 * DAY5, botUpdatePayloadsMs: 30 * DAY5 };
@@ -32513,7 +32894,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
32513
32894
  };
32514
32895
  }, "logPruner");
32515
32896
 
32516
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
32897
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
32517
32898
  var stale2 = /* @__PURE__ */ __name(() => {
32518
32899
  throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
32519
32900
  reason: "meeting-findings.stale"
@@ -32682,7 +33063,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
32682
33063
  };
32683
33064
  }, "meetingFindingsStoreOver");
32684
33065
 
32685
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
33066
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
32686
33067
  var RANK_BATCH = 512;
32687
33068
  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";
32688
33069
  var limitOf = /* @__PURE__ */ __name((value, name, max = 1e3) => {
@@ -32953,7 +33334,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
32953
33334
  }
32954
33335
  }), "meetingVectorsOver");
32955
33336
 
32956
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
33337
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
32957
33338
  var OTHER_SOURCES = ["document", "note", "email"];
32958
33339
  var TEXTS = {
32959
33340
  document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
@@ -33054,11 +33435,11 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
33054
33435
  };
33055
33436
  }, "sourceMentionStoreOver");
33056
33437
 
33057
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
33438
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
33058
33439
  import { mkdirSync, statSync, writeFileSync } from "node:fs";
33059
33440
  import { dirname } from "node:path";
33060
33441
 
33061
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
33442
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
33062
33443
  import { readFileSync as readFileSync3 } from "node:fs";
33063
33444
  var CLIENTS_SETTING = "clients";
33064
33445
  var coreVersion = (() => {
@@ -33116,7 +33497,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
33116
33497
  return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
33117
33498
  }, "refusalAdvice");
33118
33499
 
33119
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
33500
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
33120
33501
  var GENERATED = [
33121
33502
  {
33122
33503
  "name": "20261010184427_initial",
@@ -33979,10 +34360,33 @@ WHERE json_type(params, '$.selection') = 'object';`
33979
34360
  "CREATE TRIGGER document_trigrams_bd BEFORE DELETE ON documents BEGIN\n DELETE FROM document_trigrams WHERE rowid = old.id;\nEND;",
33980
34361
  "-- The trigrams hold JS-normalized text, which SQL cannot produce: fillTrigrams fills the rows stored before this\n-- version, up to `watermark`, and a search reads the rest of them by their text meanwhile.\nINSERT INTO search_index_state (name, watermark, filled_through, terms_through, normalizer_version)\n SELECT 'note_trigrams', coalesce(max(id), 0), 0, 0, 1 FROM notes\n UNION ALL SELECT 'document_trigrams', coalesce(max(id), 0), 0, 0, 1 FROM documents;"
33981
34362
  ]
34363
+ },
34364
+ {
34365
+ "name": "20261031230945_version-41-task-fields",
34366
+ "statements": [
34367
+ "ALTER TABLE `tasks` ADD `priority_score` real;",
34368
+ "ALTER TABLE `tasks` ADD `agent` text;",
34369
+ "ALTER TABLE `tasks` ADD `revision` integer DEFAULT 1 NOT NULL;",
34370
+ "-- 0 urgent \u2026 4 low land inside the critical, high, medium and low quarters, with room on either side for moves.\nUPDATE tasks SET priority_score = CASE priority WHEN 0 THEN 0.875 WHEN 1 THEN 0.625 WHEN 2 THEN 0.375 WHEN 3 THEN 0.1875 WHEN 4 THEN 0.0625 END WHERE priority IS NOT NULL;",
34371
+ "-- A build before version 41 writes only `priority`; these keep the score in step with what it wrote.\nCREATE TRIGGER tasks_priority_score_ai AFTER INSERT ON tasks WHEN new.priority IS NOT NULL AND new.priority_score IS NULL BEGIN\n UPDATE tasks SET priority_score = CASE new.priority WHEN 0 THEN 0.875 WHEN 1 THEN 0.625 WHEN 2 THEN 0.375 WHEN 3 THEN 0.1875 WHEN 4 THEN 0.0625 END WHERE id = new.id;\nEND;",
34372
+ "CREATE TRIGGER tasks_priority_score_au AFTER UPDATE OF priority ON tasks WHEN new.priority IS NOT old.priority AND new.priority_score IS old.priority_score BEGIN\n UPDATE tasks SET priority_score = CASE new.priority WHEN 0 THEN 0.875 WHEN 1 THEN 0.625 WHEN 2 THEN 0.375 WHEN 3 THEN 0.1875 WHEN 4 THEN 0.0625 END WHERE id = new.id;\nEND;",
34373
+ "-- Every build's write bumps it, older ones too, so a stale copy is caught whoever wrote last.\nCREATE TRIGGER tasks_revision_au AFTER UPDATE ON tasks WHEN new.revision IS old.revision BEGIN\n UPDATE tasks SET revision = old.revision + 1 WHERE id = new.id;\nEND;"
34374
+ ]
34375
+ },
34376
+ {
34377
+ "name": "20261101002523_version-42-task-revision",
34378
+ "statements": [
34379
+ "-- A claim renewed, a follow-up time or a close suggestion is an agent at work, not a change a person could overwrite;\n-- bumping on those made the board report a conflict while an agent simply worked.\nDROP TRIGGER tasks_revision_au;",
34380
+ "CREATE TRIGGER tasks_revision_au AFTER UPDATE OF title, description, status, priority, priority_score, agent, due_at, project_id, parent_id ON tasks\n WHEN new.revision IS old.revision AND (new.title IS NOT old.title OR new.description IS NOT old.description\n OR new.status IS NOT old.status OR new.priority IS NOT old.priority OR new.priority_score IS NOT old.priority_score\n OR new.agent IS NOT old.agent OR new.due_at IS NOT old.due_at OR new.project_id IS NOT old.project_id\n OR new.parent_id IS NOT old.parent_id) BEGIN\n UPDATE tasks SET revision = old.revision + 1 WHERE id = new.id;\nEND;",
34381
+ "CREATE TRIGGER tasks_revision_assignment_ai AFTER INSERT ON task_assignments BEGIN\n UPDATE tasks SET revision = revision + 1 WHERE id = new.task_id;\nEND;",
34382
+ "CREATE TRIGGER tasks_revision_assignment_ad AFTER DELETE ON task_assignments BEGIN\n UPDATE tasks SET revision = revision + 1 WHERE id = old.task_id;\nEND;",
34383
+ "CREATE TRIGGER tasks_revision_tagging_ai AFTER INSERT ON taggings WHEN new.taggable_type = 'task' BEGIN\n UPDATE tasks SET revision = revision + 1 WHERE id = new.taggable_id;\nEND;",
34384
+ "CREATE TRIGGER tasks_revision_tagging_ad AFTER DELETE ON taggings WHEN old.taggable_type = 'task' BEGIN\n UPDATE tasks SET revision = revision + 1 WHERE id = old.taggable_id;\nEND;"
34385
+ ]
33982
34386
  }
33983
34387
  ];
33984
34388
 
33985
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
34389
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
33986
34390
  var MANIFEST = [
33987
34391
  { name: "20261010184427_initial", version: 1, minCompatible: 1 },
33988
34392
  { name: "20261011035353_version-2-facts", version: 2, minCompatible: 1 },
@@ -34036,7 +34440,9 @@ var MANIFEST = [
34036
34440
  { name: "20261029224106_version-38-folded-names", version: 38, minCompatible: 34 },
34037
34441
  { name: "20261029224107_version-38-folded-triggers", version: 38, minCompatible: 34 },
34038
34442
  { name: "20261030114008_version-39-email-locations", version: 39, minCompatible: 34 },
34039
- { name: "20261030225520_version-40-note-trigrams", version: 40, minCompatible: 34 }
34443
+ { name: "20261030225520_version-40-note-trigrams", version: 40, minCompatible: 34 },
34444
+ { name: "20261031230945_version-41-task-fields", version: 41, minCompatible: 34 },
34445
+ { name: "20261101002523_version-42-task-revision", version: 42, minCompatible: 34 }
34040
34446
  ];
34041
34447
  var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated = GENERATED) => {
34042
34448
  const migrations = [];
@@ -34060,7 +34466,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
34060
34466
  return migrations;
34061
34467
  }, "generatedMigrations");
34062
34468
 
34063
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/migrations.js
34469
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/migrations.js
34064
34470
  var MIGRATIONS = generatedMigrations();
34065
34471
  var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
34066
34472
  version INTEGER PRIMARY KEY,
@@ -34113,7 +34519,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
34113
34519
  }
34114
34520
  }, "migrate");
34115
34521
 
34116
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
34522
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
34117
34523
  var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
34118
34524
  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 ?");
34119
34525
  if (pending.get(0, 1) === void 0)
@@ -34135,7 +34541,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
34135
34541
  }
34136
34542
  }, "fillJoinKeys");
34137
34543
 
34138
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
34544
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
34139
34545
  var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
34140
34546
  const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
34141
34547
  try {
@@ -34148,8 +34554,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
34148
34554
  }, "openSqlite");
34149
34555
  var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
34150
34556
  quietSqliteWarning();
34151
- const { drizzle } = await import("./node-GFOH6FKP.js");
34152
- const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-NBXQXBIU.js");
34557
+ const { drizzle } = await import("./node-73PKCCE7.js");
34558
+ const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-FDD5N6GC.js");
34153
34559
  const client = await nodeClient(path, { readOnly });
34154
34560
  try {
34155
34561
  return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
@@ -34159,8 +34565,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
34159
34565
  }
34160
34566
  }, "openUnderNode");
34161
34567
  var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
34162
- const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-Z54LEHVM.js");
34163
- const { drizzle } = await import("./bun-XRO6XJHQ.js");
34568
+ const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-KGH5F33G.js");
34569
+ const { drizzle } = await import("./bun-GTG5IYLQ.js");
34164
34570
  const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
34165
34571
  try {
34166
34572
  return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
@@ -34170,7 +34576,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
34170
34576
  }
34171
34577
  }, "openUnderBun");
34172
34578
 
34173
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
34579
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
34174
34580
  var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
34175
34581
  const ours = MIGRATIONS.at(-1)?.version ?? 0;
34176
34582
  if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
@@ -34185,7 +34591,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
34185
34591
  throw new CliError("configuration_error", `The store requires schema ${minCompatible}, but this tool supports ${ours}; ${refusalAdvice(storeClients(database), command, version)}`);
34186
34592
  }, "assertReadCompatible");
34187
34593
 
34188
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
34594
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
34189
34595
  var BACKFILL_ON_OPEN = 5e3;
34190
34596
  var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
34191
34597
  var createWritable = /* @__PURE__ */ __name((file) => {
@@ -34241,13 +34647,13 @@ var openStoreContext = /* @__PURE__ */ __name(async ({ path, env, now: now2 = Da
34241
34647
  }
34242
34648
  }, "openStoreContext");
34243
34649
 
34244
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
34650
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
34245
34651
  import { createHash as createHash17 } from "node:crypto";
34246
34652
 
34247
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
34653
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
34248
34654
  import { createHash as createHash16 } from "node:crypto";
34249
34655
 
34250
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
34656
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
34251
34657
  var text3 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
34252
34658
  var ref = text3(2048);
34253
34659
  var timestamp2 = pipe(number(), safeInteger(), minValue(0));
@@ -34313,10 +34719,10 @@ var projectAnnotationsSchema = strictObject({
34313
34719
  }))
34314
34720
  });
34315
34721
 
34316
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
34722
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
34317
34723
  var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
34318
- var invalid5 = /* @__PURE__ */ __name((field3) => {
34319
- throw new CliError("validation_error", `invalid project annotations.${field3}`);
34724
+ var invalid5 = /* @__PURE__ */ __name((field4) => {
34725
+ throw new CliError("validation_error", `invalid project annotations.${field4}`);
34320
34726
  }, "invalid");
34321
34727
  var canonical = /* @__PURE__ */ __name((ref3) => {
34322
34728
  try {
@@ -34446,7 +34852,7 @@ var projectAnnotationsFingerprint = /* @__PURE__ */ __name((json3) => {
34446
34852
  return createHash16("sha256").update(JSON.stringify(normalized)).digest("hex");
34447
34853
  }, "projectAnnotationsFingerprint");
34448
34854
 
34449
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
34855
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
34450
34856
  var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
34451
34857
  var ref2 = pipe(string(), minLength(1), maxLength(2048));
34452
34858
  var targetSchema = strictObject({
@@ -34466,8 +34872,8 @@ var kind2 = /* @__PURE__ */ __name((ref3) => {
34466
34872
  const parsed2 = parseReference(ref3);
34467
34873
  return "provider" in parsed2 ? `${parsed2.type}:${parsed2.provider}` : parsed2.type;
34468
34874
  }, "kind");
34469
- var invalid6 = /* @__PURE__ */ __name((field3) => {
34470
- throw new CliError("validation_error", `invalid project annotation plan.${field3}`);
34875
+ var invalid6 = /* @__PURE__ */ __name((field4) => {
34876
+ throw new CliError("validation_error", `invalid project annotation plan.${field4}`);
34471
34877
  }, "invalid");
34472
34878
  var projectAnnotationBindingSources = /* @__PURE__ */ __name((manifest, bindings) => {
34473
34879
  if (!bindings || typeof bindings !== "object" || Array.isArray(bindings) || Object.keys(bindings).length > 1001)
@@ -34553,7 +34959,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
34553
34959
  }, "planBoundProjectAnnotations");
34554
34960
  var planProjectAnnotations = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotations(json3), projectAnnotationsFingerprint(json3), target, bindings), "planProjectAnnotations");
34555
34961
 
34556
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
34962
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
34557
34963
  import { createHash as createHash18 } from "node:crypto";
34558
34964
  var text4 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
34559
34965
  var timestamp3 = pipe(number(), safeInteger(), minValue(0));
@@ -34600,8 +35006,8 @@ var snapshotGraph = /* @__PURE__ */ __name((value) => ({
34600
35006
  external: value.external
34601
35007
  }), "snapshotGraph");
34602
35008
  var decodeProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3) => {
34603
- const invalid8 = /* @__PURE__ */ __name((field3) => {
34604
- throw new CliError("validation_error", `invalid project annotation snapshot.${field3}`);
35009
+ const invalid8 = /* @__PURE__ */ __name((field4) => {
35010
+ throw new CliError("validation_error", `invalid project annotation snapshot.${field4}`);
34605
35011
  }, "invalid");
34606
35012
  if (typeof json3 !== "string" || Buffer.byteLength(json3) > PROJECT_ANNOTATIONS_MAX_BYTES)
34607
35013
  return invalid8("bytes");
@@ -34617,13 +35023,13 @@ var decodeProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3) => {
34617
35023
  const snapshot2 = checked.output;
34618
35024
  if (snapshot2.aliases.length + snapshot2.facts.length + snapshot2.links.length + snapshot2.external.length > 1e3)
34619
35025
  return invalid8("record budget");
34620
- for (const field3 of ["description", "status", "owner"])
34621
- if (snapshot2.project[field3] !== null && !snapshot2.project[field3].trim())
34622
- return invalid8(`project.${field3}`);
35026
+ for (const field4 of ["description", "status", "owner"])
35027
+ if (snapshot2.project[field4] !== null && !snapshot2.project[field4].trim())
35028
+ return invalid8(`project.${field4}`);
34623
35029
  for (const alias2 of snapshot2.aliases)
34624
- for (const field3 of ["name", "source"])
34625
- if (!alias2[field3].trim())
34626
- return invalid8(`aliases.${field3}`);
35030
+ for (const field4 of ["name", "source"])
35031
+ if (!alias2[field4].trim())
35032
+ return invalid8(`aliases.${field4}`);
34627
35033
  if (snapshot2.project.updated_at < snapshot2.project.created_at)
34628
35034
  return invalid8("project.updated_at");
34629
35035
  for (const alias2 of snapshot2.aliases)
@@ -34647,14 +35053,14 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
34647
35053
  })).digest("hex");
34648
35054
  }, "projectAnnotationSnapshotFingerprint");
34649
35055
 
34650
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
35056
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
34651
35057
  var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
34652
35058
  if (!request || typeof request !== "object" || Array.isArray(request))
34653
35059
  throw new CliError("validation_error", "project annotation request is required");
34654
35060
  const fields4 = ["snapshot", "project", "bindings", "maxReadBytes", ...restore ? ["fingerprint"] : []];
34655
- for (const field3 of Object.keys(request))
34656
- if (!fields4.includes(field3))
34657
- throw new CliError("validation_error", `unknown project annotation field ${field3}`);
35061
+ for (const field4 of Object.keys(request))
35062
+ if (!fields4.includes(field4))
35063
+ throw new CliError("validation_error", `unknown project annotation field ${field4}`);
34658
35064
  const snapshot2 = decodeProjectAnnotationSnapshot(request.snapshot);
34659
35065
  projectAnnotationBindingSources(snapshot2, request.bindings);
34660
35066
  if (typeof request.project !== "string" || !/^project:[1-9]\d*$/.test(request.project) || !Number.isSafeInteger(Number(request.project.slice(8))))
@@ -34664,7 +35070,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
34664
35070
  return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
34665
35071
  }, "projectAnnotationRequest");
34666
35072
 
34667
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
35073
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
34668
35074
  var SnapshotBudget = class {
34669
35075
  static {
34670
35076
  __name(this, "SnapshotBudget");
@@ -34684,19 +35090,19 @@ var SnapshotBudget = class {
34684
35090
  this.bytes += bytes3;
34685
35091
  }
34686
35092
  rows(database, from2, fields4, parameters) {
34687
- const bytes3 = fields4.map((field3) => `coalesce(length(CAST(${field3} AS BLOB)),0)`).join("+");
35093
+ const bytes3 = fields4.map((field4) => `coalesce(length(CAST(${field4} AS BLOB)),0)`).join("+");
34688
35094
  const sized = database.prepare(`SELECT ${bytes3} AS bytes ${from2} LIMIT 1001`).all(...parameters);
34689
35095
  this.reserve(sized.length, sized.reduce((sum, row2) => sum + Number(row2.bytes) + 128, 0));
34690
35096
  }
34691
35097
  };
34692
35098
 
34693
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
35099
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
34694
35100
  import { createHash as createHash20 } from "node:crypto";
34695
35101
 
34696
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
35102
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
34697
35103
  var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
34698
35104
 
34699
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
35105
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
34700
35106
  import { createHash as createHash19 } from "node:crypto";
34701
35107
  var invalid7 = /* @__PURE__ */ __name(() => {
34702
35108
  throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
@@ -34839,7 +35245,7 @@ var ProjectSnapshotSources = class {
34839
35245
  }
34840
35246
  };
34841
35247
 
34842
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
35248
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
34843
35249
  var unsupported = /* @__PURE__ */ __name(() => {
34844
35250
  throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
34845
35251
  }, "unsupported");
@@ -35010,7 +35416,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
35010
35416
  return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
35011
35417
  }), "projectAnnotationSnapshot");
35012
35418
 
35013
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
35419
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
35014
35420
  var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, manifest, bindings, budget) => read(database, () => {
35015
35421
  const current = projectAnnotationSnapshot(database, projectId, budget).snapshot;
35016
35422
  const sources = new ProjectSnapshotSources(database, budget);
@@ -35047,7 +35453,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
35047
35453
  if (project && names.has(normalizeVocabularyName(String(alias2.name))))
35048
35454
  namespace.add(`project:${project.id}`);
35049
35455
  }
35050
- const descriptor_conflicts = ["key", "name"].filter((field3) => current.project[field3] !== manifest.project[field3]);
35456
+ const descriptor_conflicts = ["key", "name"].filter((field4) => current.project[field4] !== manifest.project[field4]);
35051
35457
  const target = {
35052
35458
  project: current.project.ref,
35053
35459
  annotation_count: current.aliases.length + current.facts.length + current.links.length,
@@ -35072,7 +35478,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
35072
35478
  };
35073
35479
  }), "previewAnnotationSnapshot");
35074
35480
 
35075
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
35481
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
35076
35482
  var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snapshot2, bindings) => {
35077
35483
  const mappings = { ...bindings };
35078
35484
  const resolve = /* @__PURE__ */ __name((ref3) => {
@@ -35114,7 +35520,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snap
35114
35520
  return mappings;
35115
35521
  }, "restoreAnnotationRecords");
35116
35522
 
35117
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
35523
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
35118
35524
  var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
35119
35525
  async preview(request) {
35120
35526
  const { snapshot: snapshot2, projectId } = projectAnnotationRequest(request);
@@ -35144,7 +35550,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
35144
35550
  }
35145
35551
  }), "projectAnnotationStoreOver");
35146
35552
 
35147
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
35553
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
35148
35554
  var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
35149
35555
  const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
35150
35556
  let merged = { from: from2, to };
@@ -35157,7 +35563,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
35157
35563
  }, "markRange");
35158
35564
  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");
35159
35565
 
35160
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
35566
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
35161
35567
  var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
35162
35568
  var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
35163
35569
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
@@ -35167,7 +35573,7 @@ var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) =
35167
35573
  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);
35168
35574
  }, "setTaskRulesStop");
35169
35575
 
35170
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sync.js
35576
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sync.js
35171
35577
  var syncStoreOver = /* @__PURE__ */ __name((context) => {
35172
35578
  const { database } = context;
35173
35579
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
@@ -35223,7 +35629,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
35223
35629
  };
35224
35630
  }, "syncStoreOver");
35225
35631
 
35226
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/tags.js
35632
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/tags.js
35227
35633
  var tagsStoreOver = /* @__PURE__ */ __name((context) => {
35228
35634
  const { database } = context;
35229
35635
  return {
@@ -35245,7 +35651,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
35245
35651
  };
35246
35652
  }, "tagsStoreOver");
35247
35653
 
35248
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
35654
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
35249
35655
  var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
35250
35656
  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
35251
35657
  WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
@@ -35372,7 +35778,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
35372
35778
  dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
35373
35779
  }, "savePictureChunks");
35374
35780
 
35375
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
35781
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
35376
35782
  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,
35377
35783
  EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
35378
35784
  FROM messages m
@@ -35461,7 +35867,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
35461
35867
  return plain2(best(found2));
35462
35868
  }, "nearestMessages");
35463
35869
 
35464
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/vectors.js
35870
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/vectors.js
35465
35871
  var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
35466
35872
  const { database } = context;
35467
35873
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -35719,7 +36125,7 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
35719
36125
  embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
35720
36126
  }), "vectorsStoreOver");
35721
36127
 
35722
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
36128
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
35723
36129
  import { existsSync, readFileSync as readFileSync4 } from "node:fs";
35724
36130
  import { dirname as dirname2, join as join2 } from "node:path";
35725
36131
  var BOOKKEEPING = ["schema_migrations", "store_settings"];
@@ -35807,10 +36213,10 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
35807
36213
  }
35808
36214
  }, "lastBackup");
35809
36215
 
35810
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/providers.js
36216
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/providers.js
35811
36217
  var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
35812
36218
 
35813
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
36219
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
35814
36220
  var COUNTED_TABLES = [
35815
36221
  "accounts",
35816
36222
  "chats",
@@ -35895,7 +36301,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
35895
36301
  };
35896
36302
  }, "storeContents");
35897
36303
 
35898
- // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/store/store.js
36304
+ // node_modules/.pnpm/@wirecat+cli-core@0.516.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_25c347a01b8fd53eda94896ae0eba94d/node_modules/@wirecat/cli-core/dist/store/store.js
35899
36305
  var openStore = /* @__PURE__ */ __name(async (options = {}) => {
35900
36306
  const context = await openStoreContext(options);
35901
36307
  try {
@@ -36130,6 +36536,7 @@ export {
36130
36536
  stemmersOrigin,
36131
36537
  stemsState,
36132
36538
  stemmerCache,
36539
+ isBusy,
36133
36540
  write,
36134
36541
  read,
36135
36542
  vectorIndexCounts,
@@ -36168,6 +36575,8 @@ export {
36168
36575
  DEFAULT_FIRST_PASS_PER_CHAT,
36169
36576
  firstPassPerChatOf,
36170
36577
  savedFirstPassPerChat,
36578
+ TASK_SORTS,
36579
+ PROJECT_TASK_FIELDS,
36171
36580
  TASK_RELATION_KINDS,
36172
36581
  TASK_ROLES,
36173
36582
  TASK_EVENT_KINDS,