@wirecat/tg-cli 0.111.0 → 0.112.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 (111) hide show
  1. package/README.md +3 -0
  2. package/dist/bin/tg.js +2 -2
  3. package/dist/bundle/{adapter-WFC2JAD4.js → adapter-ILDV2YSZ.js} +70 -50
  4. package/dist/bundle/{all-profiles-FEUSGHT7.js → all-profiles-4SH2Q4WV.js} +8 -8
  5. package/dist/bundle/{anthropic-O646SJIJ.js → anthropic-64SM23YO.js} +5 -5
  6. package/dist/bundle/{app-server-7P23Y45A.js → app-server-SSYZWCDJ.js} +40 -40
  7. package/dist/bundle/{bot-api-WTJCL6VF.js → bot-api-OHAGQMES.js} +46 -46
  8. package/dist/bundle/{bot-history-5J2Q4SPC.js → bot-history-AUFO7UL2.js} +15 -15
  9. package/dist/bundle/{bun-KUKVEKDW.js → bun-AHZX63TR.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-2G5TXHYE.js → bun-sqlite-KBIIODPV.js} +4 -4
  11. package/dist/bundle/{chunk-43ZFY6TW.js → chunk-2IGZLBTE.js} +2 -2
  12. package/dist/bundle/{chunk-ABVHA4K6.js → chunk-3AJO4GER.js} +5 -5
  13. package/dist/bundle/{chunk-PNUHAHTF.js → chunk-3GL4AOOG.js} +1 -1
  14. package/dist/bundle/{chunk-TWZTQHP6.js → chunk-3W7BU2BL.js} +6 -6
  15. package/dist/bundle/{chunk-YFK3DNNP.js → chunk-4IDJ7QCG.js} +4 -4
  16. package/dist/bundle/{chunk-KLHLWKWC.js → chunk-4JXZKMXV.js} +65 -54
  17. package/dist/bundle/{chunk-J4QVXR5I.js → chunk-5BNYW5RA.js} +2 -2
  18. package/dist/bundle/{chunk-33HEHPIK.js → chunk-5W72OARG.js} +8 -8
  19. package/dist/bundle/{chunk-YG4BO7N3.js → chunk-6KGENDPF.js} +2 -2
  20. package/dist/bundle/{chunk-HN6ZMUAS.js → chunk-7MFJFVUN.js} +1 -1
  21. package/dist/bundle/{chunk-3BD24JYK.js → chunk-B3Y2KZRS.js} +105 -94
  22. package/dist/bundle/{chunk-KE47Y4PW.js → chunk-BIERCQVG.js} +639 -374
  23. package/dist/bundle/{chunk-J2Z5E7TO.js → chunk-BTAET4U3.js} +1 -1
  24. package/dist/bundle/{chunk-UIPT6IAU.js → chunk-COTC7HF3.js} +1 -1
  25. package/dist/bundle/{chunk-MSGYLWCH.js → chunk-D5JP2YWG.js} +2 -2
  26. package/dist/bundle/{chunk-UDYCZ5KB.js → chunk-DFUTZGEV.js} +1 -1
  27. package/dist/bundle/{chunk-QVM2HKJP.js → chunk-DNYGJAEP.js} +4 -4
  28. package/dist/bundle/{chunk-2ZH3PUQX.js → chunk-E4EJ2UTT.js} +2 -2
  29. package/dist/bundle/{chunk-DREEXESG.js → chunk-EO7PQE3J.js} +82 -64
  30. package/dist/bundle/{chunk-NIKYFRDQ.js → chunk-EPAOLRUL.js} +2 -2
  31. package/dist/bundle/{chunk-BNQOUCL2.js → chunk-GM44UNGL.js} +1 -1
  32. package/dist/bundle/{chunk-NQAV7U7C.js → chunk-GSGS62LX.js} +1 -1
  33. package/dist/bundle/{chunk-UPRYEDAV.js → chunk-GW7JRFTF.js} +3 -3
  34. package/dist/bundle/{chunk-QEAMO2TS.js → chunk-ICEJKOKO.js} +7 -7
  35. package/dist/bundle/{chunk-LLAZSGS7.js → chunk-JIGYVVWA.js} +22 -22
  36. package/dist/bundle/{chunk-UMUJHC4M.js → chunk-JLB5LEXJ.js} +3 -3
  37. package/dist/bundle/{chunk-WDRNVSWF.js → chunk-JPRYFDOJ.js} +45 -44
  38. package/dist/bundle/{chunk-VIEVOF3O.js → chunk-JXTYTAWE.js} +11 -11
  39. package/dist/bundle/{chunk-XXOJ7PQY.js → chunk-JYOQMYNJ.js} +28 -28
  40. package/dist/bundle/{chunk-7665YBJ7.js → chunk-K7VOCHVS.js} +6 -6
  41. package/dist/bundle/{chunk-K457FHD4.js → chunk-KGYPSBTI.js} +22 -22
  42. package/dist/bundle/{chunk-BWRCPMMC.js → chunk-KLNQXUDX.js} +18 -18
  43. package/dist/bundle/{chunk-5ZPLOYTP.js → chunk-KYYAHIG2.js} +238 -222
  44. package/dist/bundle/{chunk-COHMFCHD.js → chunk-MCXVGHL6.js} +85 -31
  45. package/dist/bundle/{chunk-T6DSAROY.js → chunk-NKACHGB2.js} +25 -14
  46. package/dist/bundle/{chunk-OYVDWHP5.js → chunk-NQKPXVLX.js} +2 -2
  47. package/dist/bundle/{chunk-CJUSP5X2.js → chunk-PDVSMGWO.js} +2 -2
  48. package/dist/bundle/{chunk-XIRASTVS.js → chunk-PXUHQO66.js} +11 -11
  49. package/dist/bundle/{chunk-EO563SUX.js → chunk-QL4WBCL5.js} +7 -7
  50. package/dist/bundle/{chunk-PQGWEFJ2.js → chunk-QMJGHSGN.js} +3 -3
  51. package/dist/bundle/{chunk-UFIUMPXP.js → chunk-RANORATG.js} +4 -4
  52. package/dist/bundle/{chunk-5FJQG5UZ.js → chunk-RC7EBLHM.js} +8 -8
  53. package/dist/bundle/{chunk-7GQLD5TJ.js → chunk-RHYMEHYK.js} +2 -2
  54. package/dist/bundle/{chunk-QAC6Z675.js → chunk-RPNRCFEE.js} +2 -2
  55. package/dist/bundle/{chunk-EB44Z44U.js → chunk-SC2DUQAK.js} +1 -1
  56. package/dist/bundle/{chunk-ONHHBPV3.js → chunk-SFJFBIYP.js} +2 -2
  57. package/dist/bundle/{chunk-ITSSCYLP.js → chunk-TOBJGMMA.js} +11 -11
  58. package/dist/bundle/{chunk-ZCHC7TYO.js → chunk-TUJEJ4D5.js} +26 -13
  59. package/dist/bundle/{chunk-DEG4JJHG.js → chunk-UQOSZ2XX.js} +449 -341
  60. package/dist/bundle/{chunk-ZCV4UEVH.js → chunk-UVRD447S.js} +3 -3
  61. package/dist/bundle/{chunk-2K6IGVSI.js → chunk-UXCWUEN7.js} +5 -5
  62. package/dist/bundle/{chunk-3WUTBGZE.js → chunk-WI2S6INJ.js} +6 -6
  63. package/dist/bundle/{chunk-AUWYMMYL.js → chunk-WWKXTKCE.js} +4 -4
  64. package/dist/bundle/{chunk-QLLPZWYZ.js → chunk-XSYJKEA5.js} +4 -4
  65. package/dist/bundle/command-contract-4KVJJZ46.js +32 -0
  66. package/dist/bundle/{decode-QJNVAAKJ.js → decode-FR3QHHJI.js} +4 -4
  67. package/dist/bundle/{echarts-2EDY7OUX.js → echarts-VTV4C2OS.js} +2 -2
  68. package/dist/bundle/{embed-PZSXOQJO.js → embed-US7X5P5D.js} +5 -5
  69. package/dist/bundle/{embedder-O4EGMMUU.js → embedder-63Z7ZBYG.js} +8 -8
  70. package/dist/bundle/{entry-DVLMQM6J.js → entry-B4J7IAG3.js} +5 -5
  71. package/dist/bundle/{first-run-J67KTUWA.js → first-run-MXPPUGII.js} +9 -9
  72. package/dist/bundle/first-screen-GFYHUBBD.js +30 -0
  73. package/dist/bundle/{identity-DSYY4FLQ.js → identity-AQWKU7SM.js} +3 -3
  74. package/dist/bundle/{instructions-O535XB2L.js → instructions-GBR6DJTK.js} +1 -1
  75. package/dist/bundle/{mcp-EMNFFY4N.js → mcp-YJEQYYTR.js} +2 -2
  76. package/dist/bundle/{node-S3VEQNTE.js → node-QXGPMDH2.js} +2 -2
  77. package/dist/bundle/{node-sqlite-3DNWF2BW.js → node-sqlite-L6CAMXQ2.js} +4 -4
  78. package/dist/bundle/{oauth-IU2RAZ3D.js → oauth-5RK6J4SG.js} +6 -6
  79. package/dist/bundle/{open-M2IPPXMI.js → open-A3IAG7U6.js} +3 -3
  80. package/dist/bundle/{openai-GDI7HISL.js → openai-YKNGCHVV.js} +13 -13
  81. package/dist/bundle/{process-3IGMEATV.js → process-CGLNXFIU.js} +1 -1
  82. package/dist/bundle/{program-P7YPHVLD.js → program-AEDR6R5P.js} +48 -48
  83. package/dist/bundle/{prompt-S6R7IHDK.js → prompt-65CSCL2T.js} +4 -4
  84. package/dist/bundle/{proxy-transport-OROEVBCG.js → proxy-transport-U3QOYMQF.js} +4 -4
  85. package/dist/bundle/{recognize-PFZRQ3P4.js → recognize-ECRO6CFK.js} +3 -3
  86. package/dist/bundle/{remote-Q37V7LUX.js → remote-6IEFZFGO.js} +6 -6
  87. package/dist/bundle/{rerank-V5YQQQAM.js → rerank-23GXWT2V.js} +6 -6
  88. package/dist/bundle/{serve-5CAD2UVG.js → serve-S65YTPZN.js} +8 -8
  89. package/dist/bundle/server-IH24WEAC.js +56 -0
  90. package/dist/bundle/{server-R6YAO2SG.js → server-MVTBK7GV.js} +32 -32
  91. package/dist/bundle/{state-Y3A2NEM3.js → state-TH3UVQAW.js} +5 -5
  92. package/dist/bundle/{store-H5K32CNI.js → store-2WFTUSNG.js} +12 -10
  93. package/dist/bundle/store-maintenance-command-PUOU2CL6.js +45 -0
  94. package/dist/bundle/tg.js +4 -4
  95. package/dist/telegram/adapter.d.ts +2 -0
  96. package/dist/telegram/adapter.d.ts.map +1 -1
  97. package/dist/telegram/adapter.js +3 -0
  98. package/dist/telegram/adapter.js.map +1 -1
  99. package/dist/telegram/topics.d.ts +4 -2
  100. package/dist/telegram/topics.d.ts.map +1 -1
  101. package/dist/telegram/topics.js +21 -3
  102. package/dist/telegram/topics.js.map +1 -1
  103. package/dist/version.d.ts +1 -1
  104. package/dist/version.js +1 -1
  105. package/package.json +3 -3
  106. package/skills/tg-cli/SKILL.md +2 -0
  107. package/dist/bundle/command-contract-JCRVVL7P.js +0 -32
  108. package/dist/bundle/first-screen-PYEE5NMQ.js +0 -30
  109. package/dist/bundle/server-RUQLAWWS.js +0 -56
  110. package/dist/bundle/store-maintenance-command-QZDC4WKW.js +0 -45
  111. /package/dist/bundle/{chunk-NPGVOZVK.js → chunk-WJWLHLQ7.js} +0 -0
@@ -26,6 +26,7 @@ import {
26
26
  canonicalMeetingReference,
27
27
  checkedScore,
28
28
  dateRange,
29
+ dayBoundary,
29
30
  defineQuery,
30
31
  entryInWindow,
31
32
  entryMetadata,
@@ -59,7 +60,7 @@ import {
59
60
  validateQuery,
60
61
  walkQuery,
61
62
  zonedMoment
62
- } from "./chunk-DREEXESG.js";
63
+ } from "./chunk-EO7PQE3J.js";
63
64
  import {
64
65
  DEFAULT_STEMMERS,
65
66
  DEFAULT_STEMMERS_VERSION,
@@ -72,21 +73,21 @@ import {
72
73
  fold,
73
74
  normalize,
74
75
  parseStemmers
75
- } from "./chunk-33HEHPIK.js";
76
+ } from "./chunk-5W72OARG.js";
76
77
  import {
77
78
  DEFAULT_TASK_CATEGORIES,
78
79
  sharedConfigPath,
79
80
  storedTaskCategories,
80
81
  taskCategoriesReader
81
- } from "./chunk-3WUTBGZE.js";
82
+ } from "./chunk-WI2S6INJ.js";
82
83
  import {
83
84
  storePath
84
- } from "./chunk-7GQLD5TJ.js";
85
+ } from "./chunk-RHYMEHYK.js";
85
86
  import {
86
87
  PRAGMAS,
87
88
  quietSqliteWarning,
88
89
  storeCapable
89
- } from "./chunk-TWZTQHP6.js";
90
+ } from "./chunk-3W7BU2BL.js";
90
91
  import {
91
92
  SQLiteTable,
92
93
  TableAliasProxyHandler,
@@ -111,10 +112,10 @@ import {
111
112
  sql,
112
113
  sqliteTable,
113
114
  text
114
- } from "./chunk-HN6ZMUAS.js";
115
+ } from "./chunk-7MFJFVUN.js";
115
116
  import {
116
117
  singleLine
117
- } from "./chunk-BWRCPMMC.js";
118
+ } from "./chunk-KLNQXUDX.js";
118
119
  import {
119
120
  CliError,
120
121
  array,
@@ -132,7 +133,7 @@ import {
132
133
  safeParse,
133
134
  strictObject,
134
135
  string
135
- } from "./chunk-EO563SUX.js";
136
+ } from "./chunk-QL4WBCL5.js";
136
137
  import {
137
138
  resolveFrom
138
139
  } from "./chunk-Y5E2WNWB.js";
@@ -140,7 +141,7 @@ import {
140
141
  __name
141
142
  } from "./chunk-ZVVMGPBJ.js";
142
143
 
143
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/account-store.js
144
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/account-store.js
144
145
  var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
145
146
  const methods = whole;
146
147
  return Object.fromEntries(Object.keys(keyed).map((name) => [
@@ -268,7 +269,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
268
269
  };
269
270
  }, "bindAccount");
270
271
 
271
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/providers.js
272
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/providers.js
272
273
  var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events"];
273
274
  var PROVIDERS = [
274
275
  { name: "telegram", kind: "messages", aliases: ["tg"] },
@@ -359,7 +360,7 @@ var providerNamed = /* @__PURE__ */ __name((word) => {
359
360
  var kindIn = /* @__PURE__ */ __name((provider) => isFolderProvider(provider) ? "notes" : registry.find(({ name }) => name === provider)?.kind, "kindIn");
360
361
  var kindOf = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
361
362
 
362
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/query.js
363
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/search/query.js
363
364
  var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
364
365
  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");
365
366
  var fail = /* @__PURE__ */ __name((message2) => {
@@ -382,7 +383,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
382
383
  return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
383
384
  }, "sourceOf");
384
385
 
385
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/account-list.js
386
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/search/account-list.js
386
387
  var ACCOUNT_GROUPS = "accountGroups";
387
388
  var ACCOUNT_GROUPS_SETTING = "account_groups";
388
389
  var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
@@ -569,7 +570,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf = (kind3)
569
570
  return { accounts: [...chosen.values()], skipped };
570
571
  }, "fitting");
571
572
 
572
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
573
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
573
574
  var IndexBuilderOn = class {
574
575
  static {
575
576
  __name(this, "IndexBuilderOn");
@@ -764,7 +765,7 @@ function alias(table, alias2) {
764
765
  }
765
766
  __name(alias, "alias");
766
767
 
767
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
768
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
768
769
  var ENTITY_TABLES = {
769
770
  account: "accounts",
770
771
  attachment: "attachments",
@@ -804,7 +805,7 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
804
805
  return { table, pointer, type, count, known: known2 };
805
806
  }).filter(({ count }) => count > 0)), "orphanPointers");
806
807
 
807
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
808
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
808
809
  var canonicalTags = sqliteTable("canonical_tags", {
809
810
  id: integer("id").primaryKey(),
810
811
  name: text("name").notNull().unique(),
@@ -813,7 +814,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
813
814
  updatedAt: integer("updated_at").notNull()
814
815
  });
815
816
 
816
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
817
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
817
818
  var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
818
819
  sourceKey: text("source_key").notNull(),
819
820
  collection: text("collection").notNull(),
@@ -823,13 +824,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
823
824
  createdAt: integer("created_at").notNull()
824
825
  }, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
825
826
 
826
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
827
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
827
828
  var documentIndexPending = sqliteTable("document_index_pending", {
828
829
  id: integer("id").notNull(),
829
830
  indexableType: text("indexable_type").notNull()
830
831
  }, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
831
832
 
832
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
833
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
833
834
  var tagRedirects = sqliteTable("tag_redirects", {
834
835
  sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
835
836
  survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
@@ -855,7 +856,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
855
856
  index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
856
857
  ]);
857
858
 
858
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
859
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
859
860
  var accounts = sqliteTable("accounts", {
860
861
  id: integer("id").primaryKey(),
861
862
  provider: text("provider").notNull(),
@@ -1569,11 +1570,13 @@ var memories = sqliteTable("memories", {
1569
1570
  scope: text("scope").notNull(),
1570
1571
  createdAt: integer("created_at").notNull(),
1571
1572
  updatedAt: integer("updated_at").notNull(),
1572
- deletedAt: integer("deleted_at")
1573
+ deletedAt: integer("deleted_at"),
1574
+ projectId: integer("project_id").references(() => projects.id)
1573
1575
  }, (table) => [
1574
1576
  index("memories_by_subject_type_subject_id").on(table.subjectType, table.subjectId),
1575
1577
  index("memories_by_author_type_author_id").on(table.authorType, table.authorId),
1576
- index("memories_by_supersedes_id").on(table.supersedesId)
1578
+ index("memories_by_supersedes_id").on(table.supersedesId),
1579
+ index("memories_by_project_id").on(table.projectId)
1577
1580
  ]);
1578
1581
  var memoryIndexPending = sqliteTable("memory_index_pending", {
1579
1582
  id: integer("id").notNull(),
@@ -2354,7 +2357,7 @@ var storeSettings = sqliteTable("store_settings", {
2354
2357
  at: integer("at").notNull()
2355
2358
  });
2356
2359
 
2357
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
2360
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
2358
2361
  var ARMS = [
2359
2362
  [
2360
2363
  "message",
@@ -2481,7 +2484,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
2481
2484
  return recomputed;
2482
2485
  }, "drainInvolvementQueue");
2483
2486
 
2484
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/mentions.js
2487
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/mentions.js
2485
2488
  import { domainToUnicode } from "node:url";
2486
2489
 
2487
2490
  // node_modules/.pnpm/psl@1.15.0/node_modules/psl/dist/psl.mjs
@@ -12503,7 +12506,7 @@ var oa = /* @__PURE__ */ __name((e) => {
12503
12506
  }, "oa");
12504
12507
  var na = { parse: O, get: aa, isValid: oa };
12505
12508
 
12506
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
12509
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
12507
12510
  var LINK = /https?:\/\/(?:(?:docs|drive|sheets|slides)\.google\.com|forms\.gle)(?:[/?#][^\s<>"'`]*)?/gi;
12508
12511
  var ID = /^[\w-]{10,}$/;
12509
12512
  var trimUrl = /* @__PURE__ */ __name((url) => {
@@ -12544,7 +12547,7 @@ var googleDocumentLinks = /* @__PURE__ */ __name((text5) => [...text5.matchAll(L
12544
12547
  return { url, documentId: googleDocumentId(url) };
12545
12548
  }), "googleDocumentLinks");
12546
12549
 
12547
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
12550
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
12548
12551
  var PHONE_PLANS = [
12549
12552
  {
12550
12553
  country: "us",
@@ -12924,7 +12927,7 @@ var PHONE_PLANS = [
12924
12927
  }
12925
12928
  ];
12926
12929
 
12927
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/phones.js
12930
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/phones.js
12928
12931
  var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
12929
12932
  var DEFAULT_PHONE_COUNTRIES = ["ru"];
12930
12933
  var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
@@ -12965,7 +12968,7 @@ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
12965
12968
  return void 0;
12966
12969
  }, "nationalPhone");
12967
12970
 
12968
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/places.js
12971
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/places.js
12969
12972
  var BEFORE = [
12970
12973
  [/^(?:ул\.?|улиц[аеыу]|улицей)$/iu, "\u0443\u043B\u0438\u0446\u0430"],
12971
12974
  [/^(?:пр-т|просп\.?|проспект[аеу]?)$/iu, "\u043F\u0440\u043E\u0441\u043F\u0435\u043A\u0442"],
@@ -13225,7 +13228,7 @@ var findPlaces = /* @__PURE__ */ __name((text5) => {
13225
13228
  return found2.sort((a, b) => a.start - b.start);
13226
13229
  }, "findPlaces");
13227
13230
 
13228
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/mentions.js
13231
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/mentions.js
13229
13232
  var MENTION_KINDS = ["phone", "email", "url", "document", "person-name", "place"];
13230
13233
  var MENTION_VERSIONS = {
13231
13234
  phone: 1,
@@ -13415,7 +13418,7 @@ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE
13415
13418
  };
13416
13419
  }, "typedPhone");
13417
13420
 
13418
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/first-names.js
13421
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/first-names.js
13419
13422
  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";
13420
13423
  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";
13421
13424
  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";
@@ -13423,7 +13426,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
13423
13426
  var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
13424
13427
  var NAME_WORDS = WORDS.split(" ");
13425
13428
 
13426
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/person-names.js
13429
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/person-names.js
13427
13430
  var LATIN_TO_CYRILLIC = {
13428
13431
  shch: "\u0449",
13429
13432
  sch: "\u0449",
@@ -13631,7 +13634,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text5, stem, taken) => {
13631
13634
  return found2;
13632
13635
  }, "findUnknownNames");
13633
13636
 
13634
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/attachments.js
13637
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/attachments.js
13635
13638
  var NOT_FILES = /* @__PURE__ */ new Set([
13636
13639
  "webpage",
13637
13640
  "share",
@@ -13663,7 +13666,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored3, files2) => {
13663
13666
  });
13664
13667
  }, "matchDownloads");
13665
13668
 
13666
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
13669
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
13667
13670
  var QUERY_VERSION = 1;
13668
13671
  var QUERY_LIMITS2 = {
13669
13672
  ...QUERY_LIMITS,
@@ -13694,7 +13697,7 @@ function exhausted(budget) {
13694
13697
  }
13695
13698
  __name(exhausted, "exhausted");
13696
13699
 
13697
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
13700
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
13698
13701
  var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
13699
13702
  var literal2 = /* @__PURE__ */ __name((c) => ({
13700
13703
  kind: "char",
@@ -14094,7 +14097,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
14094
14097
  return out;
14095
14098
  }, "foldRegex");
14096
14099
 
14097
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
14100
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
14098
14101
  var PRESET_VERSION = 1;
14099
14102
  var PRESETS = {
14100
14103
  password: {
@@ -14148,7 +14151,7 @@ var PRESETS = {
14148
14151
  }
14149
14152
  };
14150
14153
 
14151
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
14154
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
14152
14155
  var FIELD_VERSION = 2;
14153
14156
  var UNITS = {
14154
14157
  "": 1,
@@ -14271,6 +14274,17 @@ var QUERY_FIELDS = [
14271
14274
  normalization: "the same as mailbox:; mail only",
14272
14275
  support: "A1"
14273
14276
  },
14277
+ {
14278
+ name: "list",
14279
+ example: "list:github.com",
14280
+ index: "emails.headers list-id",
14281
+ aliases: [],
14282
+ type: "kw",
14283
+ operators: terms,
14284
+ normalization: "the List-Id of a mailing list, lower case; a domain matches every list under it; mail only",
14285
+ support: "A1",
14286
+ validate: filled
14287
+ },
14274
14288
  {
14275
14289
  name: "is",
14276
14290
  example: "is:unread",
@@ -14597,12 +14611,12 @@ var validateAst = /* @__PURE__ */ __name((input) => {
14597
14611
  return validateFields(parsed2.output);
14598
14612
  }, "validateAst");
14599
14613
 
14600
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
14614
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
14601
14615
  var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
14602
14616
  var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
14603
14617
  var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
14604
14618
 
14605
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
14619
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
14606
14620
  var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
14607
14621
  var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
14608
14622
  var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
@@ -14626,7 +14640,7 @@ var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
14626
14640
  };
14627
14641
  }, "linkMatch");
14628
14642
 
14629
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
14643
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
14630
14644
  var SETTING = "phoneCountries";
14631
14645
  var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
14632
14646
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
@@ -14657,7 +14671,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
14657
14671
  return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
14658
14672
  }, "valueMatch");
14659
14673
 
14660
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/locator.js
14674
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/locator.js
14661
14675
  var SCHEME = "msg:";
14662
14676
  var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat: chat2, message: message2 }) => SCHEME + [provider, account, chat2, message2].map(encodeURIComponent).join("/"), "formatLocator");
14663
14677
  var isLocator = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith(SCHEME), "isLocator");
@@ -14671,7 +14685,7 @@ var parseLocator = /* @__PURE__ */ __name((reference2) => {
14671
14685
  return { provider, account, chat: chat2, message: message2 };
14672
14686
  }, "parseLocator");
14673
14687
 
14674
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
14688
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
14675
14689
  var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
14676
14690
  if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
14677
14691
  throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
@@ -14699,7 +14713,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
14699
14713
  return 2 * intersection2 / (aa2.size + bb.size);
14700
14714
  }, "vocabularySimilarity");
14701
14715
 
14702
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
14716
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
14703
14717
  import { createHash } from "node:crypto";
14704
14718
  var folded2 = /* @__PURE__ */ __name((name) => {
14705
14719
  try {
@@ -14765,7 +14779,7 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind3, by, options
14765
14779
  });
14766
14780
  }, "guardTagCreation");
14767
14781
 
14768
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
14782
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
14769
14783
  var invalid2 = /* @__PURE__ */ __name((message2) => {
14770
14784
  throw new CliError("validation_error", message2);
14771
14785
  }, "invalid");
@@ -14842,7 +14856,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
14842
14856
  };
14843
14857
  }, "createTagRedirectIndex");
14844
14858
 
14845
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
14859
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
14846
14860
  var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
14847
14861
  const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
14848
14862
  if (!row2)
@@ -14870,7 +14884,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
14870
14884
  return snapshot2;
14871
14885
  }, "tagRedirectSnapshot");
14872
14886
 
14873
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
14887
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
14874
14888
  import { createHash as createHash2 } from "node:crypto";
14875
14889
  var TASK_KEY_PREFIXES = {
14876
14890
  question: "Q",
@@ -14898,7 +14912,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
14898
14912
  return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
14899
14913
  }, "taskAccountOf");
14900
14914
 
14901
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/references.js
14915
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/references.js
14902
14916
  var SIMPLE_REFERENCES = [
14903
14917
  "note",
14904
14918
  "document",
@@ -14970,7 +14984,7 @@ var folderPath = /* @__PURE__ */ __name((path) => {
14970
14984
  }, "folderPath");
14971
14985
  var canonicalReference = /* @__PURE__ */ __name((text5) => formatReference(parseReference(text5)), "canonicalReference");
14972
14986
 
14973
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
14987
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
14974
14988
  var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
14975
14989
  var REFERABLE = {
14976
14990
  note: { tombstone: true },
@@ -15120,7 +15134,10 @@ var stateOfThing = /* @__PURE__ */ __name((database, thing) => {
15120
15134
  }, "stateOfThing");
15121
15135
  var taskRowOf = /* @__PURE__ */ __name((database, id2) => {
15122
15136
  const row2 = database.prepare("SELECT id FROM tasks WHERE package_id = ? OR key = ? ORDER BY id LIMIT 1").get(id2, id2);
15123
- return row2 ? Number(row2.id) : void 0;
15137
+ if (row2)
15138
+ return Number(row2.id);
15139
+ const moved = database.prepare("SELECT task_id FROM task_events WHERE kind = 'project' AND json_extract(changes, '$.key[0]') = ? ORDER BY id DESC LIMIT 1").get(id2);
15140
+ return moved ? Number(moved.task_id) : void 0;
15124
15141
  }, "taskRowOf");
15125
15142
  var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
15126
15143
  const row2 = database.prepare("SELECT key, package_id AS id FROM tasks WHERE id = ?").get(rowId);
@@ -15128,7 +15145,7 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
15128
15145
  }, "taskIdOf");
15129
15146
  var canonicalThingReference = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith("meeting:") ? canonicalMeetingReference(reference2) : canonicalReference(reference2), "canonicalThingReference");
15130
15147
 
15131
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
15148
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
15132
15149
  var toMs = /* @__PURE__ */ __name((iso11) => {
15133
15150
  if (iso11 === null || iso11 === void 0)
15134
15151
  return null;
@@ -15142,7 +15159,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
15142
15159
  var DELIVERY = { delivered: 1, read: 2 };
15143
15160
  var deliveryOf = /* @__PURE__ */ __name((stored3) => stored3 === DELIVERY.read ? "read" : stored3 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
15144
15161
 
15145
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
15162
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
15146
15163
  var TAG_KINDS = ["tag", "topic"];
15147
15164
  var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
15148
15165
  var TAG_TYPE = {
@@ -15345,7 +15362,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
15345
15362
  return result;
15346
15363
  }, "tagsOf");
15347
15364
 
15348
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
15365
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
15349
15366
  var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
15350
15367
  var SPEECH = speech("att");
15351
15368
  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");
@@ -15644,6 +15661,11 @@ var mailbox = /* @__PURE__ */ __name(({ value }, { mail }) => always(mail ? boun
15644
15661
  value,
15645
15662
  fold(value)
15646
15663
  ) : bound("0")), "mailbox");
15664
+ var list = /* @__PURE__ */ __name(({ value }, { mail }) => {
15665
+ const wanted = value.trim().toLowerCase();
15666
+ return always(mail ? bound(`m.id IN (SELECT id FROM (SELECT id, coalesce(json_extract(headers, '$."list-id"'),
15667
+ json_extract(metadata, '$.listId')) AS list_id FROM emails) WHERE list_id = ? OR list_id LIKE '%.' || ? ESCAPE '\\')`, wanted, wanted.replace(/[\\%_]/g, "\\$&")) : bound("0"));
15668
+ }, "list");
15647
15669
  var is2 = /* @__PURE__ */ __name(({ value }, { mail }) => {
15648
15670
  const state = value.toLowerCase();
15649
15671
  return always(state === "starred" ? bound(mail ? "m.flagged = 1" : "m.starred = 1") : !mail ? bound("0") : bound("m.read = ?", state === "read" ? 1 : 0));
@@ -15696,11 +15718,12 @@ var FIELD_COMPILERS = {
15696
15718
  source: notesOnly,
15697
15719
  mailbox,
15698
15720
  label: mailbox,
15721
+ list,
15699
15722
  is: is2,
15700
15723
  subject
15701
15724
  };
15702
15725
 
15703
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
15726
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
15704
15727
  var placeOf = /* @__PURE__ */ __name((database) => {
15705
15728
  const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
15706
15729
  const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
@@ -15716,7 +15739,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
15716
15739
  };
15717
15740
  }, "placeOf");
15718
15741
 
15719
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
15742
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
15720
15743
  var DRAIN_ON_WRITE = 500;
15721
15744
  var METHOD = "rules";
15722
15745
  var telegramLink = /* @__PURE__ */ __name((database) => {
@@ -15879,7 +15902,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
15879
15902
  return queued.length;
15880
15903
  }, "drainMentions");
15881
15904
 
15882
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
15905
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
15883
15906
  var indexRow = /* @__PURE__ */ __name((database, name) => {
15884
15907
  const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
15885
15908
  if (!exists2)
@@ -15887,7 +15910,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
15887
15910
  return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
15888
15911
  }, "indexRow");
15889
15912
 
15890
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
15913
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
15891
15914
  var INDEX = "message_stems";
15892
15915
  var SETTING2 = "searchStemmers";
15893
15916
  var DRAIN_ON_WRITE2 = 500;
@@ -16009,7 +16032,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
16009
16032
  };
16010
16033
  }, "stemmerCache");
16011
16034
 
16012
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
16035
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
16013
16036
  var SQLITE_BUSY = 5;
16014
16037
  var pause = new Int32Array(new SharedArrayBuffer(4));
16015
16038
  var isBusy = /* @__PURE__ */ __name((error) => {
@@ -16104,7 +16127,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
16104
16127
  }
16105
16128
  }, "read");
16106
16129
 
16107
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
16130
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
16108
16131
  var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
16109
16132
  coalesce(CASE k.chunkable_type
16110
16133
  WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
@@ -16246,7 +16269,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
16246
16269
  }, "dropUnusedVectors");
16247
16270
  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");
16248
16271
 
16249
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
16272
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
16250
16273
  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({
16251
16274
  target: [accounts.provider, accounts.externalId],
16252
16275
  set: {
@@ -16352,7 +16375,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
16352
16375
  AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
16353
16376
  }, "dropOrphanPeople");
16354
16377
 
16355
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
16378
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
16356
16379
  var FOLDED = [
16357
16380
  { table: "tasks", column: "title" },
16358
16381
  { table: "tasks", column: "close_reason" },
@@ -16389,7 +16412,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
16389
16412
  return filled2;
16390
16413
  }, "fillFolded");
16391
16414
 
16392
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
16415
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
16393
16416
  import { createHash as createHash3 } from "node:crypto";
16394
16417
  var CHUNK_CHARS = 1200;
16395
16418
  var CHUNK_OVERLAP = 150;
@@ -16494,7 +16517,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
16494
16517
  return chunks2;
16495
16518
  }, "cutChunks");
16496
16519
 
16497
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/task-signature.js
16520
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/search/task-signature.js
16498
16521
  var DAY = 864e5;
16499
16522
  var CURRENCY = [
16500
16523
  [/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
@@ -16611,7 +16634,7 @@ var dueDayOf = /* @__PURE__ */ __name((text5, createdMs) => {
16611
16634
  return best?.day ?? null;
16612
16635
  }, "dueDayOf");
16613
16636
 
16614
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
16637
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
16615
16638
  var DAY2 = 864e5;
16616
16639
  var STOP_WORDS = new Set([
16617
16640
  // Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
@@ -16766,7 +16789,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
16766
16789
  ...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
16767
16790
  })).sort((a, b) => b.score - a.score), "rankCandidates");
16768
16791
 
16769
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
16792
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
16770
16793
  var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
16771
16794
  r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
16772
16795
  JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
@@ -16897,7 +16920,7 @@ var dot = /* @__PURE__ */ __name((query, blob2) => {
16897
16920
  }, "dot");
16898
16921
  var nearestChunks = /* @__PURE__ */ __name((context, accountPk2, filter) => {
16899
16922
  const { orm } = context;
16900
- const { chatKey, model, since, limit, query, exclude, conversations: conversations2, scope: scope3, projectId, before: before2, personId } = filter;
16923
+ const { chatKey, model, since, limit, query, exclude, conversations: conversations2, scope: scope3, projectId: projectId2, before: before2, personId } = filter;
16901
16924
  const rows = /* @__PURE__ */ __name((page3) => orm.all(
16902
16925
  // CROSS JOIN keeps the chunks first, so each page walks their key; led by the vectors, SQLite re-read and
16903
16926
  // sorted every one of them per page — 1.3 s against 140 ms at 42k chunks (bench/embeddings/README.md).
@@ -16910,7 +16933,7 @@ var nearestChunks = /* @__PURE__ */ __name((context, accountPk2, filter) => {
16910
16933
  JOIN embeddings v ON v.model = ${model} AND v.content_hash = k.content_hash
16911
16934
  WHERE k.chunkable_type = 'conversation' AND ch.account_id = ${accountPk2}
16912
16935
  ${scope3 === void 0 ? sql`` : sql`AND k.scope=${scope3}`}
16913
- ${projectId === void 0 ? sql`` : sql`AND k.project_id=${projectId}`}
16936
+ ${projectId2 === void 0 ? sql`` : sql`AND k.project_id=${projectId2}`}
16914
16937
  ${before2 === void 0 ? sql`` : sql`AND k.occurred_at < ${before2}`}
16915
16938
  ${personId === void 0 ? sql`` : sql`AND EXISTS (SELECT 1 FROM conversation_messages pcm JOIN messages pm ON pm.id=pcm.message_id JOIN identity_links pil ON pil.identity_id=pm.sender_identity_id WHERE pcm.conversation_id=c.id AND pil.person_id=${personId})`}
16916
16939
  ${chatKey === void 0 ? sql`AND ch.searchable = 1` : sql`AND c.chat_id = ${chatKey}`}
@@ -16939,7 +16962,7 @@ var nearestChunks = /* @__PURE__ */ __name((context, accountPk2, filter) => {
16939
16962
  }, "keepBest");
16940
16963
  const ranked = /* @__PURE__ */ __name((found2) => found2.sort((a, b) => b.score - a.score).slice(0, limit), "ranked");
16941
16964
  const plain2 = /* @__PURE__ */ __name((found2) => found2.map(({ id: _, ...chunk }) => chunk), "plain");
16942
- const indexable = personId === void 0 && projectId === void 0 && scope3 === void 0 && conversations2 === void 0;
16965
+ const indexable = personId === void 0 && projectId2 === void 0 && scope3 === void 0 && conversations2 === void 0;
16943
16966
  const indexed = indexable && searchIndex(context.database, model, {
16944
16967
  kind: "conversation",
16945
16968
  account: accountPk2,
@@ -17037,7 +17060,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
17037
17060
  };
17038
17061
  }, "readiness");
17039
17062
 
17040
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
17063
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
17041
17064
  var DOCUMENT_PICTURE = "document_picture";
17042
17065
  var SCAN_PAGE2 = 5e3;
17043
17066
  var idOf = /* @__PURE__ */ __name((ref3) => {
@@ -17100,7 +17123,7 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
17100
17123
  }, "nearestPictures")
17101
17124
  }), "documentPicturesOver");
17102
17125
 
17103
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
17126
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
17104
17127
  var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
17105
17128
  const literal4 = escaped2 ?? plain2 ?? "";
17106
17129
  return wildcard ?? (/[*?[]/u.test(literal4) ? `[${literal4}]` : literal4);
@@ -17165,7 +17188,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
17165
17188
  var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
17166
17189
  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");
17167
17190
 
17168
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
17191
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
17169
17192
  var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
17170
17193
  var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
17171
17194
  var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
@@ -17255,7 +17278,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
17255
17278
  });
17256
17279
  }, "linkMeeting");
17257
17280
 
17258
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
17281
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
17259
17282
  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), ''))";
17260
17283
  var UNSEARCHED_EVENT_TYPES = [
17261
17284
  "working-location",
@@ -17485,7 +17508,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
17485
17508
  return true;
17486
17509
  }, "resetNoteIndex");
17487
17510
 
17488
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
17511
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
17489
17512
  var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
17490
17513
  var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
17491
17514
  for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
@@ -17504,7 +17527,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
17504
17527
  }
17505
17528
  }, "resolvePersonLinks");
17506
17529
 
17507
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
17530
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
17508
17531
  var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
17509
17532
  var prepare = /* @__PURE__ */ __name((orm) => ({
17510
17533
  find: orm.select({
@@ -17729,7 +17752,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
17729
17752
  }, "meetingIdentityPk");
17730
17753
  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");
17731
17754
 
17732
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
17755
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
17733
17756
  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");
17734
17757
  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");
17735
17758
  var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
@@ -18009,7 +18032,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
18009
18032
  }
18010
18033
  }, "replaceAutoTags");
18011
18034
 
18012
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/counters.js
18035
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/counters.js
18013
18036
  var COUNTER_FIELDS = ["views", "reactions", "comments"];
18014
18037
  var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
18015
18038
  var counterValue = /* @__PURE__ */ __name((message2, field4) => {
@@ -18046,7 +18069,7 @@ var counterFreshness = /* @__PURE__ */ __name((states) => {
18046
18069
  return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
18047
18070
  }, "counterFreshness");
18048
18071
 
18049
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
18072
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
18050
18073
  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");
18051
18074
  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;
18052
18075
  var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
@@ -18127,7 +18150,7 @@ var mailCore = /* @__PURE__ */ __name((body2, earlier) => {
18127
18150
  return withoutSignOff(withoutGreeting(kept)).join("\n").trim();
18128
18151
  }, "mailCore");
18129
18152
 
18130
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
18153
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
18131
18154
  var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
18132
18155
  var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
18133
18156
  k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
@@ -18237,7 +18260,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
18237
18260
  return emails3 + threads;
18238
18261
  }, "drainEmailIndex");
18239
18262
 
18240
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
18263
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
18241
18264
  var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
18242
18265
  SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
18243
18266
  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,
@@ -18283,7 +18306,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
18283
18306
  leave.run(emailId, Number(box.id), emailId, Number(box.id));
18284
18307
  }, "forgetLocations");
18285
18308
 
18286
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
18309
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
18287
18310
  var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
18288
18311
  emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
18289
18312
  last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
@@ -18333,7 +18356,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
18333
18356
  return threads.length;
18334
18357
  }, "markEmailsRestored");
18335
18358
 
18336
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
18359
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
18337
18360
  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");
18338
18361
  var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
18339
18362
  var ruleOf = /* @__PURE__ */ __name((row2) => ({
@@ -18400,7 +18423,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
18400
18423
  }
18401
18424
  }), "mailRulesOver");
18402
18425
 
18403
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
18426
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
18404
18427
  var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
18405
18428
  database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
18406
18429
  VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
@@ -18408,7 +18431,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
18408
18431
  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);
18409
18432
  }, "reviewLink");
18410
18433
 
18411
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
18434
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
18412
18435
  function checkMeetingCancelled(signal) {
18413
18436
  if (!signal?.aborted)
18414
18437
  return;
@@ -18419,7 +18442,7 @@ function checkMeetingCancelled(signal) {
18419
18442
  }
18420
18443
  __name(checkMeetingCancelled, "checkMeetingCancelled");
18421
18444
 
18422
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
18445
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
18423
18446
  var meetingOf = /* @__PURE__ */ __name((row2) => ({
18424
18447
  id: Number(row2.id),
18425
18448
  accountId: Number(row2.account_id),
@@ -18469,7 +18492,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
18469
18492
  createdAt: Number(row2.created_at)
18470
18493
  }), "transcriptRowOf");
18471
18494
 
18472
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
18495
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
18473
18496
  var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
18474
18497
  var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
18475
18498
  var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
@@ -18636,7 +18659,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
18636
18659
  }
18637
18660
  }), "meetingReadsOver");
18638
18661
 
18639
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
18662
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
18640
18663
  var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
18641
18664
  const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
18642
18665
  const params = [input.accountId];
@@ -18679,7 +18702,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
18679
18702
  return { clauses, params };
18680
18703
  }, "meetingSelectionSql");
18681
18704
 
18682
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
18705
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
18683
18706
  var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
18684
18707
  async meetingChatLines(input) {
18685
18708
  checkMeetingCancelled(input.signal);
@@ -18707,7 +18730,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
18707
18730
  }
18708
18731
  }), "meetingChatLinesOver");
18709
18732
 
18710
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
18733
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
18711
18734
  var MESSAGE_FIELDS = {
18712
18735
  pk: messages.id,
18713
18736
  nativeId: messages.externalId,
@@ -18874,7 +18897,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
18874
18897
  storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
18875
18898
  }), "chatActivity");
18876
18899
 
18877
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
18900
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
18878
18901
  var HIT_FIELDS = {
18879
18902
  ...MESSAGE_FIELDS,
18880
18903
  chatTitle: sql`${chats.title}`.as("chat_title"),
@@ -18973,7 +18996,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
18973
18996
  };
18974
18997
  }, "directReplies");
18975
18998
 
18976
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
18999
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
18977
19000
  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");
18978
19001
  var required = /* @__PURE__ */ __name((context, ref3) => {
18979
19002
  const found2 = identityRow(context, ref3);
@@ -19104,7 +19127,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
19104
19127
  }, "mentioning");
19105
19128
  var escaped = /* @__PURE__ */ __name((text5) => text5.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
19106
19129
 
19107
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
19130
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
19108
19131
  var missing2 = /* @__PURE__ */ __name(() => {
19109
19132
  throw new CliError("not_found", "Meeting, participant or selected target not found");
19110
19133
  }, "missing");
@@ -19226,7 +19249,7 @@ function meetingContextLinksOver(context) {
19226
19249
  }
19227
19250
  __name(meetingContextLinksOver, "meetingContextLinksOver");
19228
19251
 
19229
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
19252
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
19230
19253
  var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
19231
19254
  var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
19232
19255
  var summaryOf = /* @__PURE__ */ __name((row2) => ({
@@ -19255,7 +19278,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
19255
19278
  return row2 ? summaryText(summaryOf(row2)) : null;
19256
19279
  }, "indexedText");
19257
19280
 
19258
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
19281
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
19259
19282
  var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
19260
19283
  var meetingCurrentIndexRows = `
19261
19284
  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
@@ -19286,7 +19309,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
19286
19309
  }, "invalidateMeetingStems");
19287
19310
  var meetingStemmableText = /* @__PURE__ */ __name((text5) => text5.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
19288
19311
 
19289
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
19312
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
19290
19313
  function meetingHitIndexOver({ database, now: now2 }) {
19291
19314
  return {
19292
19315
  async indexSearch(original) {
@@ -19354,10 +19377,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
19354
19377
  }
19355
19378
  __name(meetingHitIndexOver, "meetingHitIndexOver");
19356
19379
 
19357
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19380
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19358
19381
  import { createHash as createHash4 } from "node:crypto";
19359
19382
 
19360
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/trigrams.js
19383
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/search/trigrams.js
19361
19384
  var trigrams = /* @__PURE__ */ __name((term) => {
19362
19385
  const padded = ` ${term} `;
19363
19386
  const pieces = /* @__PURE__ */ new Set();
@@ -19366,7 +19389,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
19366
19389
  return [...pieces];
19367
19390
  }, "trigrams");
19368
19391
 
19369
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/correct.js
19392
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/search/correct.js
19370
19393
  var SHORTEST_CORRECTION = 3;
19371
19394
  var maxEdits = /* @__PURE__ */ __name((word) => word.length <= 4 ? 1 : 2, "maxEdits");
19372
19395
  var editDistance = /* @__PURE__ */ __name((a, b, max) => {
@@ -19413,7 +19436,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
19413
19436
  return corrections;
19414
19437
  }, "correctWords");
19415
19438
 
19416
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/garbled.js
19439
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/search/garbled.js
19417
19440
  var SHORTEST_GARBLED = 4;
19418
19441
  var MOST_WIDENED = 64;
19419
19442
  var plain = /* @__PURE__ */ __name((word) => word.replaceAll("\u044D", "\u0435"), "plain");
@@ -19505,7 +19528,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
19505
19528
  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));
19506
19529
  }, "widenWords");
19507
19530
 
19508
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
19531
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
19509
19532
  import { readFileSync } from "node:fs";
19510
19533
  var loaded;
19511
19534
  var dictionary = /* @__PURE__ */ __name(() => {
@@ -19564,7 +19587,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word) => {
19564
19587
  return false;
19565
19588
  }, "knownRussianWord");
19566
19589
 
19567
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
19590
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
19568
19591
  var WORD3 = /[\p{L}\p{N}\p{M}]+/gu;
19569
19592
  var MOST_WORDS = 128;
19570
19593
  var quote = /* @__PURE__ */ __name((word) => `"${word.replaceAll('"', '""')}"`, "quote");
@@ -19791,7 +19814,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text5, stemmer) => {
19791
19814
  return check3(tree);
19792
19815
  }, "matchMeetingText");
19793
19816
 
19794
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19817
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19795
19818
  var fail3 = /* @__PURE__ */ __name((message2) => {
19796
19819
  throw new CliError("validation_error", message2);
19797
19820
  }, "fail");
@@ -19968,7 +19991,7 @@ function meetingHitSearchOver({ database }) {
19968
19991
  }
19969
19992
  __name(meetingHitSearchOver, "meetingHitSearchOver");
19970
19993
 
19971
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
19994
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
19972
19995
  import { createHash as createHash5 } from "node:crypto";
19973
19996
  var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
19974
19997
  if (value === void 0)
@@ -20058,7 +20081,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
20058
20081
  }
20059
20082
  }), "meetingParticipantSearchOver");
20060
20083
 
20061
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
20084
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
20062
20085
  var preparationQueries = {
20063
20086
  participants: {
20064
20087
  fields: "p.id, p.identity_id, p.display_name, l.person_id",
@@ -20108,7 +20131,7 @@ var preparationQueries = {
20108
20131
  }
20109
20132
  };
20110
20133
 
20111
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
20134
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
20112
20135
  var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
20113
20136
  async preparationContext(original) {
20114
20137
  const input = validateMeetingPreparationContext(original);
@@ -20149,7 +20172,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
20149
20172
  }
20150
20173
  }), "meetingPreparationContextOver");
20151
20174
 
20152
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
20175
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
20153
20176
  var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
20154
20177
  SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
20155
20178
  WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
@@ -20163,7 +20186,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
20163
20186
  JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
20164
20187
  )`, "preparationSubjects");
20165
20188
 
20166
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
20189
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
20167
20190
  var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
20168
20191
  async preparationKnowledge(original) {
20169
20192
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -20208,7 +20231,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
20208
20231
  }
20209
20232
  }), "meetingPreparationKnowledgeOver");
20210
20233
 
20211
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
20234
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
20212
20235
  var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
20213
20236
  async preparationNotes(original) {
20214
20237
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -20261,7 +20284,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
20261
20284
  }
20262
20285
  }), "meetingPreparationNotesOver");
20263
20286
 
20264
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
20287
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
20265
20288
  var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20266
20289
  async relatedHistory(original) {
20267
20290
  const input = validateMeetingRelatedHistory(original);
@@ -20332,7 +20355,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20332
20355
  }
20333
20356
  }), "meetingRelatedHistoryOver");
20334
20357
 
20335
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
20358
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
20336
20359
  var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
20337
20360
  var text2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
20338
20361
  var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
@@ -20413,7 +20436,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
20413
20436
  }
20414
20437
  }), "meetingReviewOver");
20415
20438
 
20416
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
20439
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
20417
20440
  var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
20418
20441
  var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
20419
20442
  if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
@@ -20467,7 +20490,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20467
20490
  }
20468
20491
  }), "meetingSeriesHistoryOver");
20469
20492
 
20470
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
20493
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
20471
20494
  var MOST_ROWS = 5e5;
20472
20495
  var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
20473
20496
  async meetingStats(input) {
@@ -20514,7 +20537,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
20514
20537
  }
20515
20538
  }), "meetingStatsOver");
20516
20539
 
20517
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
20540
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
20518
20541
  var CURSOR_KEY = "meetings";
20519
20542
  var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
20520
20543
  id: Number(row2.id),
@@ -21066,7 +21089,7 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
21066
21089
  };
21067
21090
  }, "meetingStoreOver");
21068
21091
 
21069
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
21092
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
21070
21093
  var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
21071
21094
  const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
21072
21095
  return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
@@ -21092,7 +21115,24 @@ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
21092
21115
  orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
21093
21116
  }, "release");
21094
21117
 
21095
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
21118
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
21119
+ var THREAD_COLUMNS = {
21120
+ subject: {
21121
+ where: /* @__PURE__ */ __name(({ value }) => ({
21122
+ sql: "instr(' ' || coalesce(email_threads.subject_folded, lower(email_threads.subject)), ' ' || ?) > 0",
21123
+ params: [fold(value).replace(/\*+$/, "")]
21124
+ }), "where")
21125
+ },
21126
+ emails_count: { type: "num", sql: "email_threads.emails_count" },
21127
+ last_email_at: { type: "time", sql: "email_threads.last_email_at" }
21128
+ };
21129
+ var threadRows = /* @__PURE__ */ __name((database, filter) => {
21130
+ const [limit, offset] = page(filter);
21131
+ return database.prepare(`SELECT * FROM email_threads WHERE (? IS NULL OR account_id = ?) AND (? OR deleted_at IS NULL)
21132
+ AND (${filter.where?.sql ?? "1"}) ORDER BY coalesce(last_email_at, 0) DESC, id DESC LIMIT ? OFFSET ?`).all(filter.accountId ?? null, filter.accountId ?? null, filter.includeDeleted ? 1 : 0, ...filter.where?.params ?? [], limit, offset);
21133
+ }, "threadRows");
21134
+
21135
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
21096
21136
  var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
21097
21137
  id: `email:${place.emailId}`,
21098
21138
  chatId: place.threadExternalId,
@@ -21441,9 +21481,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
21441
21481
  return ids.map((id2) => threadDetails(database, id2));
21442
21482
  },
21443
21483
  async threads(filter = {}) {
21444
- const [limit, offset] = page(filter);
21445
- return database.prepare(`SELECT * FROM email_threads WHERE (? IS NULL OR account_id = ?) AND (? OR deleted_at IS NULL)
21446
- ORDER BY coalesce(last_email_at, 0) DESC, id DESC LIMIT ? OFFSET ?`).all(filter.accountId ?? null, filter.accountId ?? null, filter.includeDeleted ? 1 : 0, limit, offset).map(threadOf);
21484
+ return threadRows(database, filter).map(threadOf);
21447
21485
  },
21448
21486
  async thread(id2) {
21449
21487
  return threadDetails(database, id2);
@@ -21649,7 +21687,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
21649
21687
  }
21650
21688
  }), "mailStoreOver");
21651
21689
 
21652
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/dictionary.js
21690
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/search/dictionary.js
21653
21691
  import { readFileSync as readFileSync2 } from "node:fs";
21654
21692
  var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
21655
21693
  var folded4 = /* @__PURE__ */ __name((word) => /^[а-яё'-]*$/.test(word) ? word.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word), "folded");
@@ -21739,7 +21777,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
21739
21777
  }, "knownWord");
21740
21778
  var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
21741
21779
 
21742
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
21780
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
21743
21781
  var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
21744
21782
  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");
21745
21783
  var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
@@ -21825,7 +21863,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
21825
21863
  return found2;
21826
21864
  }, "spokenTranscripts");
21827
21865
 
21828
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
21866
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
21829
21867
  var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
21830
21868
  const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
21831
21869
  if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
@@ -21872,7 +21910,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
21872
21910
  });
21873
21911
  }, "placeHits");
21874
21912
 
21875
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
21913
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
21876
21914
  var MESSAGES2 = {
21877
21915
  rows: "messages",
21878
21916
  threads: "chats",
@@ -21924,8 +21962,8 @@ var compileQuery = /* @__PURE__ */ __name((context, execution, boundedAttachment
21924
21962
  const { database } = context;
21925
21963
  const corpus = execution.corpus === "mail" ? MAIL : MESSAGES2;
21926
21964
  const mail = corpus === MAIL;
21927
- if (mail && (execution.only || execution.conversationIds || execution.conversationSince !== void 0))
21928
- throw new CliError("validation_error", "mail has no server search or conversations");
21965
+ if (mail && (execution.conversationIds || execution.conversationSince !== void 0))
21966
+ throw new CliError("validation_error", "mail has no conversations to search within");
21929
21967
  const started = context.now();
21930
21968
  const budget = { work: 0 };
21931
21969
  let states = 0, expansions = 0;
@@ -22066,11 +22104,11 @@ var compileQuery = /* @__PURE__ */ __name((context, execution, boundedAttachment
22066
22104
  where = combine([
22067
22105
  where,
22068
22106
  {
22069
- sql: `m.id IN (SELECT picked.id FROM json_each(?) j CROSS JOIN accounts allowed CROSS JOIN chats scoped CROSS JOIN messages picked
22107
+ sql: `m.id IN (SELECT picked.id FROM json_each(?) j CROSS JOIN accounts allowed CROSS JOIN ${mail ? "email_threads" : "chats"} scoped CROSS JOIN ${mail ? "emails" : "messages"} picked
22070
22108
  WHERE (${execution.accounts.map(() => "(allowed.provider=? AND allowed.external_id=?)").join(" OR ") || "0"})
22071
22109
  AND allowed.provider=json_extract(j.value,'$.provider') AND allowed.external_id=json_extract(j.value,'$.account')
22072
22110
  AND scoped.account_id=allowed.id AND scoped.external_id=json_extract(j.value,'$.chatId')
22073
- AND picked.chat_id=scoped.id AND picked.external_id=json_extract(j.value,'$.id'))`,
22111
+ AND picked.${mail ? "email_thread_id" : "chat_id"}=scoped.id AND picked.external_id=json_extract(j.value,'$.id'))`,
22074
22112
  params: [JSON.stringify(execution.only), ...execution.accounts.flatMap((key2) => [key2.provider, key2.account])],
22075
22113
  exact: true
22076
22114
  }
@@ -22346,7 +22384,7 @@ var runQuery = /* @__PURE__ */ __name(async (context, execution, by) => {
22346
22384
  };
22347
22385
  }, "runQuery");
22348
22386
 
22349
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
22387
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
22350
22388
  function invalidMetadata() {
22351
22389
  throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
22352
22390
  }
@@ -22448,7 +22486,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
22448
22486
  };
22449
22487
  }), "counterTargets");
22450
22488
 
22451
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
22489
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
22452
22490
  var NOT_FILE_LIST = [...NOT_FILES].map((kind3) => `'${kind3}'`).join(",");
22453
22491
  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,
22454
22492
  att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
@@ -22567,7 +22605,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
22567
22605
  }));
22568
22606
  }, "attachmentViews");
22569
22607
 
22570
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
22608
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
22571
22609
  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");
22572
22610
  var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text5, source2) => {
22573
22611
  const { orm, database, now: now2 } = context;
@@ -22605,7 +22643,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
22605
22643
  keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
22606
22644
  }, "intoVoiceAttachment");
22607
22645
 
22608
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
22646
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
22609
22647
  var FIELDS = [
22610
22648
  "threadExternalId",
22611
22649
  "senderIdentityId",
@@ -22922,7 +22960,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
22922
22960
  reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
22923
22961
  }, "writeDerivedReactions");
22924
22962
 
22925
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/keys.js
22963
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/keys.js
22926
22964
  var keysOver = /* @__PURE__ */ __name((context) => {
22927
22965
  const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
22928
22966
  const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
@@ -22943,7 +22981,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
22943
22981
  };
22944
22982
  }, "keysOver");
22945
22983
 
22946
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
22984
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
22947
22985
  var accountGroupsOf = /* @__PURE__ */ __name((database) => {
22948
22986
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
22949
22987
  if (!row2)
@@ -22978,7 +23016,7 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
22978
23016
  database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
22979
23017
  }, "saveProfile");
22980
23018
 
22981
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
23019
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
22982
23020
  var BOT_KINDS = ["agent", "script", "integration"];
22983
23021
  var ownerPerson = /* @__PURE__ */ __name((database) => {
22984
23022
  const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
@@ -23014,7 +23052,7 @@ var originOfActor = /* @__PURE__ */ __name((database, type, id2) => {
23014
23052
  return database.prepare("SELECT name FROM bots WHERE id = ?").get(Number(id2))?.name === "rule" ? "rule" : "agent";
23015
23053
  }, "originOfActor");
23016
23054
 
23017
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
23055
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
23018
23056
  var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
23019
23057
  const owner = ownerPerson(context.database).id;
23020
23058
  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);
@@ -23035,7 +23073,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
23035
23073
  return personOf(context, ref3);
23036
23074
  }, "linkToOwner");
23037
23075
 
23038
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
23076
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
23039
23077
  var PROVIDERS_SETTING = "providers";
23040
23078
  var storedProvidersOf = /* @__PURE__ */ __name((database) => {
23041
23079
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
@@ -23070,7 +23108,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
23070
23108
  });
23071
23109
  }, "registerProvider");
23072
23110
 
23073
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
23111
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
23074
23112
  var DAY3 = 864e5;
23075
23113
  var RECENTLY_CLOSED_MS = 14 * DAY3;
23076
23114
  var TEXT_LIMIT = 20;
@@ -23094,7 +23132,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
23094
23132
  ...own || row2.person == null ? {} : { person: `person:${row2.person}` }
23095
23133
  };
23096
23134
  }, "messageOf");
23097
- const sourceOf3 = /* @__PURE__ */ __name((locator2) => {
23135
+ const sourceOf4 = /* @__PURE__ */ __name((locator2) => {
23098
23136
  if (typeof locator2 !== "string" || !isLocator(locator2))
23099
23137
  return void 0;
23100
23138
  let thing;
@@ -23115,7 +23153,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
23115
23153
  return { ...side, linked };
23116
23154
  }, "linkedOf");
23117
23155
  const sideOf = /* @__PURE__ */ __name((row2) => {
23118
- const source2 = sourceOf3(row2.source_locator);
23156
+ const source2 = sourceOf4(row2.source_locator);
23119
23157
  const person2 = source2?.person;
23120
23158
  return {
23121
23159
  row: Number(row2.id),
@@ -23170,7 +23208,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
23170
23208
  if (!project)
23171
23209
  return void 0;
23172
23210
  const { draft } = subject2;
23173
- const source2 = draft.source === void 0 ? void 0 : sourceOf3(draft.source);
23211
+ const source2 = draft.source === void 0 ? void 0 : sourceOf4(draft.source);
23174
23212
  const person2 = draft.person ?? source2?.person;
23175
23213
  return {
23176
23214
  project: Number(project.id),
@@ -23269,15 +23307,15 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
23269
23307
  };
23270
23308
  }, "taskSimilarityOver");
23271
23309
 
23272
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
23310
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
23273
23311
  var SETTING3 = "taskCategories";
23274
23312
  var savedTaskCategories = /* @__PURE__ */ __name((database) => {
23275
23313
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
23276
23314
  return row2 ? storedTaskCategories(String(row2.value)) : void 0;
23277
23315
  }, "savedTaskCategories");
23278
23316
  var storeTaskCategories = /* @__PURE__ */ __name((database) => savedTaskCategories(database) ?? DEFAULT_TASK_CATEGORIES, "storeTaskCategories");
23279
- var unlistedTaskCategories = /* @__PURE__ */ __name((database, list) => {
23280
- const listed = new Set(list.map(({ name }) => name));
23317
+ var unlistedTaskCategories = /* @__PURE__ */ __name((database, list2) => {
23318
+ const listed = new Set(list2.map(({ name }) => name));
23281
23319
  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));
23282
23320
  }, "unlistedTaskCategories");
23283
23321
  var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) => {
@@ -23288,7 +23326,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
23288
23326
  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);
23289
23327
  }, "saveTaskCategories");
23290
23328
 
23291
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
23329
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
23292
23330
  var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
23293
23331
  var ALLOWED = "taskAgentClose";
23294
23332
  var MIN = "taskAgentCloseMin";
@@ -23344,7 +23382,7 @@ var SUGGESTION_COLUMNS = [
23344
23382
  ];
23345
23383
  var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
23346
23384
 
23347
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
23385
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
23348
23386
  var EXCERPT_CHARS = 280;
23349
23387
  var excerptOf = /* @__PURE__ */ __name((text5) => {
23350
23388
  if (text5 == null)
@@ -23369,8 +23407,7 @@ var KIND = {
23369
23407
  meeting_transcript: "meeting",
23370
23408
  meeting_transcript_row: "meeting"
23371
23409
  };
23372
- var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => database.prepare(`SELECT to_type, to_id FROM links WHERE from_type = ? AND from_id = ? AND kind = ${linkKind("evidence")} AND to_id IS NOT NULL ORDER BY id`).all(from2.type, from2.id).map((link3) => {
23373
- const thing = storedThing(link3.to_type, link3.to_id);
23410
+ var sourceOf3 = /* @__PURE__ */ __name((database, thing) => {
23374
23411
  const state = stateOfThing(database, thing);
23375
23412
  const read2 = READS2[thing.type];
23376
23413
  const row2 = read2 === void 0 || state === "unavailable" ? void 0 : database.prepare(read2).get(thing.id);
@@ -23385,9 +23422,32 @@ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => database.pre
23385
23422
  tool: textOf(row2?.tool),
23386
23423
  missing: gone
23387
23424
  };
23388
- }), "evidenceSourcesOf");
23425
+ }, "sourceOf");
23426
+ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => database.prepare(`SELECT to_type, to_id FROM links WHERE from_type = ? AND from_id = ? AND kind = ${linkKind("evidence")} AND to_id IS NOT NULL ORDER BY id`).all(from2.type, from2.id).map((link3) => sourceOf3(database, storedThing(link3.to_type, link3.to_id))), "evidenceSourcesOf");
23427
+ var thingNamed = /* @__PURE__ */ __name((database, reference2) => {
23428
+ try {
23429
+ return thingOf(database, canonicalThingReference(reference2));
23430
+ } catch {
23431
+ return void 0;
23432
+ }
23433
+ }, "thingNamed");
23434
+ var sourcesOfReferences = /* @__PURE__ */ __name((database, references) => [...new Set(references)].map((reference2) => {
23435
+ const thing = thingNamed(database, reference2);
23436
+ if (thing)
23437
+ return { ...sourceOf3(database, thing), ref: reference2 };
23438
+ return {
23439
+ ref: reference2,
23440
+ kind: reference2.startsWith("msg:") ? "message" : reference2.split(":")[0] || "unknown",
23441
+ title: null,
23442
+ sender: null,
23443
+ at: null,
23444
+ excerpt: null,
23445
+ tool: null,
23446
+ missing: true
23447
+ };
23448
+ }), "sourcesOfReferences");
23389
23449
 
23390
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/attachments/limits.js
23450
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/attachments/limits.js
23391
23451
  var MAX_FILE_BYTES = 50 * 1024 * 1024;
23392
23452
  var MAX_TEXT_CHARS = 2e6;
23393
23453
  var ATTACHMENT_LIMIT_ENV = [
@@ -23413,7 +23473,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
23413
23473
  return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
23414
23474
  }, "pdfPreviewLimits");
23415
23475
 
23416
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/ulid.js
23476
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/ulid.js
23417
23477
  import { randomBytes } from "node:crypto";
23418
23478
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
23419
23479
  var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
@@ -23426,7 +23486,7 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
23426
23486
  return time3 + random;
23427
23487
  }, "ulid");
23428
23488
 
23429
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
23489
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
23430
23490
  var FOLDED_FIELDS = ["title", "site", "language", "author"];
23431
23491
  var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
23432
23492
  if (!meta && !sections?.length)
@@ -23447,7 +23507,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
23447
23507
  return typeof language === "string" && language !== "" ? language : null;
23448
23508
  }, "languageOf");
23449
23509
 
23450
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
23510
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
23451
23511
  var isObject = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
23452
23512
  var objectOf = /* @__PURE__ */ __name((value) => {
23453
23513
  if (isObject(value))
@@ -23690,7 +23750,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
23690
23750
  };
23691
23751
  }, "filesStoreOver");
23692
23752
 
23693
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
23753
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
23694
23754
  var IMPORTED_DOCUMENT_QUERY = defineQuery({
23695
23755
  entity: "document",
23696
23756
  backend: "sql",
@@ -23736,7 +23796,7 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
23736
23796
  return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
23737
23797
  }, "importedDocumentWhere");
23738
23798
 
23739
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
23799
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
23740
23800
  var NOTE_FORMATS = ["obsidian", "markdown"];
23741
23801
  var iso2 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
23742
23802
  var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso2(value), "optionalIso");
@@ -24246,7 +24306,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
24246
24306
  };
24247
24307
  }, "notesStoreOver");
24248
24308
 
24249
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
24309
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
24250
24310
  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";
24251
24311
  var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
24252
24312
  var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -24293,6 +24353,18 @@ var subjectOf = /* @__PURE__ */ __name((database, row2) => {
24293
24353
  subjectIsOwner: Number(named2?.owner) === 1
24294
24354
  };
24295
24355
  }, "subjectOf");
24356
+ var projectOf = /* @__PURE__ */ __name((database, row2) => {
24357
+ if (row2.project_id == null)
24358
+ return { project: null, projectName: null };
24359
+ const named2 = database.prepare(SUBJECT_NAMES.project).get(Number(row2.project_id));
24360
+ return { project: `project:${row2.project_id}`, projectName: named2?.name == null ? null : String(named2.name) };
24361
+ }, "projectOf");
24362
+ var projectId = /* @__PURE__ */ __name((database, reference2) => {
24363
+ const project = requiredThing(database, reference2, "the project");
24364
+ if (project.type !== "project")
24365
+ throw new CliError("validation_error", `${reference2} is not a project`);
24366
+ return project.id;
24367
+ }, "projectId");
24296
24368
  var highestKey = /* @__PURE__ */ __name((table) => `ids.${table}.highest`, "highestKey");
24297
24369
  var nextId = /* @__PURE__ */ __name((database, table) => {
24298
24370
  const kept = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(highestKey(table));
@@ -24332,6 +24404,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24332
24404
  kind: row2.kind,
24333
24405
  body: String(row2.body),
24334
24406
  ...subjectOf(database, row2),
24407
+ ...projectOf(database, row2),
24335
24408
  author: authorOf(row2),
24336
24409
  model: row2.model == null ? null : String(row2.model),
24337
24410
  confidence: row2.confidence == null ? null : Number(row2.confidence),
@@ -24379,9 +24452,10 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24379
24452
  const id2 = write(database, () => {
24380
24453
  const { actor, model } = authorActor(context, input.author);
24381
24454
  const subject2 = input.subject === void 0 ? void 0 : requiredThing(database, input.subject, "the subject");
24455
+ const project = input.project === void 0 ? null : projectId(database, input.project);
24382
24456
  const replaced = input.supersedes === void 0 ? void 0 : Number(rowOf(input.supersedes).id);
24383
24457
  const at = now2();
24384
- const made = Number(database.prepare("INSERT INTO memories (id, kind, body, subject_type, subject_id, author_type, author_id, model, confidence, status, last_verified_at, supersedes_id, scope, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(nextId(database, "memories"), kind3, body2, subject2?.type ?? null, subject2?.id ?? null, actor.type, actor.id, model, input.confidence ?? null, status, status === "confirmed" ? at : null, replaced ?? null, scope3, at, at)?.id);
24458
+ const made = Number(database.prepare("INSERT INTO memories (id, kind, body, subject_type, subject_id, author_type, author_id, model, confidence, status, last_verified_at, supersedes_id, scope, project_id, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(nextId(database, "memories"), kind3, body2, subject2?.type ?? null, subject2?.id ?? null, actor.type, actor.id, model, input.confidence ?? null, status, status === "confirmed" ? at : null, replaced ?? null, scope3, project, at, at)?.id);
24385
24459
  linkEvidence(context, { type: "memory", id: made }, input.evidence, input.author === "owner" ? "owner" : "agent");
24386
24460
  if (replaced !== void 0)
24387
24461
  database.prepare("UPDATE memories SET status = 'superseded', updated_at = ? WHERE id = ?").run(at, replaced);
@@ -24392,8 +24466,15 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24392
24466
  get: /* @__PURE__ */ __name(async (reference2) => memoryOf(rowOf(reference2)), "get"),
24393
24467
  list: /* @__PURE__ */ __name(async (options = {}) => {
24394
24468
  const subject2 = options.subject === void 0 ? void 0 : requiredThing(database, options.subject);
24395
- return database.prepare(`${NAMED} WHERE m.deleted_at IS NULL AND (? IS NULL OR (m.subject_type = ? AND m.subject_id = ?)) AND (? IS NULL OR m.kind = ?) AND (? IS NULL OR m.status = ?) AND (? IS NULL OR m.scope = ?) ORDER BY m.created_at DESC, m.id DESC LIMIT ?`).all(subject2?.type ?? null, subject2?.type ?? null, subject2?.id ?? null, options.kind ?? null, options.kind ?? null, options.status ?? null, options.status ?? null, options.scope ?? null, options.scope ?? null, Math.min(Math.max(options.limit ?? 100, 1), 500)).map(memoryOf);
24469
+ const project = options.project === void 0 ? null : projectId(database, options.project);
24470
+ return database.prepare(`${NAMED} WHERE m.deleted_at IS NULL AND (? IS NULL OR (m.subject_type = ? AND m.subject_id = ?)) AND (? IS NULL OR m.project_id = ?) AND (? IS NULL OR m.kind = ?) AND (? IS NULL OR m.status = ?) AND (? IS NULL OR m.scope = ?) ORDER BY m.created_at DESC, m.id DESC LIMIT ?`).all(subject2?.type ?? null, subject2?.type ?? null, subject2?.id ?? null, project, project, options.kind ?? null, options.kind ?? null, options.status ?? null, options.status ?? null, options.scope ?? null, options.scope ?? null, Math.min(Math.max(options.limit ?? 100, 1), 500)).map(memoryOf);
24396
24471
  }, "list"),
24472
+ update: /* @__PURE__ */ __name(async (reference2, change) => write(database, () => {
24473
+ const id2 = Number(rowOf(reference2).id);
24474
+ const project = change.project === null ? null : projectId(database, change.project);
24475
+ database.prepare("UPDATE memories SET project_id = ?, updated_at = ? WHERE id = ?").run(project, now2(), id2);
24476
+ return memoryOf(rowOf(`memory:${id2}`));
24477
+ }), "update"),
24397
24478
  confirm: /* @__PURE__ */ __name(async (reference2) => setStatus(reference2, "confirmed", true), "confirm"),
24398
24479
  markStale: /* @__PURE__ */ __name(async (reference2) => setStatus(reference2, "stale", false), "markStale"),
24399
24480
  remove: /* @__PURE__ */ __name(async (reference2) => {
@@ -24421,7 +24502,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24421
24502
  };
24422
24503
  }, "memoriesStoreOver");
24423
24504
 
24424
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
24505
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
24425
24506
  var DEFAULT_FIRST_PASS_PER_CHAT = 0;
24426
24507
  var KEY = "taskFirstPassPerChat";
24427
24508
  var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
@@ -24441,7 +24522,7 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
24441
24522
  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);
24442
24523
  }, "saveFirstPassPerChat");
24443
24524
 
24444
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
24525
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
24445
24526
  var field = /* @__PURE__ */ __name((name, type, example, more = {}) => ({
24446
24527
  name,
24447
24528
  type,
@@ -24463,8 +24544,14 @@ var PROJECT_TASK_FIELDS = [
24463
24544
  relation: "low, medium, high, critical or none; a range of labels or of the 0\u20131 number: priority:[high TO critical]"
24464
24545
  }),
24465
24546
  field("agent", "kw", "agent:hermes", { relation: "the agent working on it, by name; none or any" }),
24466
- field("due", "time", "due:[today TO 2026-12-31]", { relation: "the due date; NOT due:* has none" }),
24467
- field("overdue", "bool", "overdue:true", { relation: "open work whose due date has passed" }),
24547
+ field("due", "time", "due:[today TO 2026-12-31]", {
24548
+ relation: "the due date; today, tomorrow and yesterday are your calendar days; NOT due:* has none"
24549
+ }),
24550
+ field("overdue", "bool", "overdue:true", { relation: "open work due before today" }),
24551
+ field("when", "enum", "when:today", {
24552
+ values: ["overdue", "today", "upcoming", "later", "none"],
24553
+ relation: "the due date as a board groups it: overdue (open work due before today), today, upcoming (the next 7 days after today), later, or none"
24554
+ }),
24468
24555
  field("closed", "time", "closed:>=14d", { relation: "when it was done or dismissed" }),
24469
24556
  field("ready", "bool", "ready:true", { relation: "open work whose blocked-by tasks are all done" }),
24470
24557
  field("text", "txt", "text:invoice", { relation: "words of the title and description; a bare word means this" })
@@ -24558,7 +24645,26 @@ var truth = /* @__PURE__ */ __name((node, sql2) => ({
24558
24645
  sql: node.value.toLowerCase() === "true" ? sql2 : `NOT (${sql2})`,
24559
24646
  params: []
24560
24647
  }), "truth");
24561
- var projectTaskColumns = /* @__PURE__ */ __name((now2) => ({
24648
+ var SPAN = { start: 0, end: 0 };
24649
+ var UPCOMING_DAYS = 7;
24650
+ var dayIn = /* @__PURE__ */ __name((at, zone, ahead) => {
24651
+ const date3 = /* @__PURE__ */ new Date(`${new Intl.DateTimeFormat("en-CA", { timeZone: zone, year: "numeric", month: "2-digit", day: "2-digit" }).format(at)}T00:00:00Z`);
24652
+ date3.setUTCDate(date3.getUTCDate() + ahead);
24653
+ return dayBoundary(date3.toISOString().slice(0, 10), zone, false, SPAN);
24654
+ }, "dayIn");
24655
+ var dueGroups = /* @__PURE__ */ __name((now2, zone) => {
24656
+ const today = dayIn(now2, zone, 0);
24657
+ const tomorrow = dayIn(now2, zone, 1);
24658
+ const after2 = dayIn(now2, zone, UPCOMING_DAYS + 1);
24659
+ return {
24660
+ overdue: `${OPEN} AND t.due_at IS NOT NULL AND t.due_at < ${today}`,
24661
+ today: `t.due_at >= ${today} AND t.due_at < ${tomorrow}`,
24662
+ upcoming: `t.due_at >= ${tomorrow} AND t.due_at < ${after2}`,
24663
+ later: `t.due_at >= ${after2}`,
24664
+ none: "t.due_at IS NULL"
24665
+ };
24666
+ }, "dueGroups");
24667
+ var projectTaskColumns = /* @__PURE__ */ __name((now2, zone) => ({
24562
24668
  state: { type: "enum", sql: "t.status" },
24563
24669
  kind: { type: "enum", sql: "t.type" },
24564
24670
  project: { where: projectWhere },
@@ -24567,7 +24673,15 @@ var projectTaskColumns = /* @__PURE__ */ __name((now2) => ({
24567
24673
  agent: { where: agentWhere },
24568
24674
  due: { type: "time", sql: "t.due_at" },
24569
24675
  closed: { type: "time", sql: "t.closed_at" },
24570
- overdue: { where: /* @__PURE__ */ __name((node) => truth(node, `${OPEN} AND t.due_at IS NOT NULL AND t.due_at < ${Number(now2)}`), "where") },
24676
+ overdue: { where: /* @__PURE__ */ __name((node) => truth(node, dueGroups(now2, zone).overdue), "where") },
24677
+ when: {
24678
+ where: /* @__PURE__ */ __name((node) => {
24679
+ const group = dueGroups(now2, zone)[node.value.toLowerCase()];
24680
+ if (group === void 0)
24681
+ throw new CliError("validation_error", "when is overdue, today, upcoming, later or none");
24682
+ return { sql: group, params: [] };
24683
+ }, "where")
24684
+ },
24571
24685
  ready: { where: /* @__PURE__ */ __name((node) => truth(node, `${OPEN} AND NOT EXISTS (${UNFINISHED_BLOCKER})`), "where") },
24572
24686
  text: {
24573
24687
  where: /* @__PURE__ */ __name((node) => {
@@ -24614,7 +24728,35 @@ var withoutField = /* @__PURE__ */ __name((query, name) => {
24614
24728
  return root === void 0 ? void 0 : { ...query, root };
24615
24729
  }, "withoutField");
24616
24730
 
24617
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
24731
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
24732
+ var authorNamed = /* @__PURE__ */ __name((database, row2) => {
24733
+ if (row2.author_type == null)
24734
+ return null;
24735
+ const named2 = database.prepare(row2.author_type === "bot" ? "SELECT name, 0 AS owner FROM bots WHERE id = ?" : "SELECT name, owner FROM persons WHERE id = ?").get(Number(row2.author_id));
24736
+ return {
24737
+ type: row2.author_type,
24738
+ id: String(row2.author_id),
24739
+ name: named2?.name == null ? null : String(named2.name),
24740
+ owner: Number(named2?.owner) === 1
24741
+ };
24742
+ }, "authorNamed");
24743
+ var commentsOf = /* @__PURE__ */ __name((database, task) => database.prepare("SELECT n.id, n.body, n.created_at, n.author_type, n.author_id FROM notes n WHERE n.notable_type = 'task' AND n.notable_id = ? AND n.deleted_at IS NULL ORDER BY n.created_at, n.id").all(task).map((row2) => ({
24744
+ ref: `note:${row2.id}`,
24745
+ text: String(row2.body),
24746
+ author: authorNamed(database, row2),
24747
+ at: new Date(Number(row2.created_at)).toISOString()
24748
+ })), "commentsOf");
24749
+ var addComment = /* @__PURE__ */ __name((context, task, body2, by) => {
24750
+ const { database, now: now2 } = context;
24751
+ const made = write(database, () => {
24752
+ const { actor } = authorActor(context, by);
24753
+ const at = now2();
24754
+ return Number(database.prepare("INSERT INTO notes (notable_type, notable_id, body, author_type, author_id, revision, created_at, updated_at) VALUES ('task', ?, ?, ?, ?, 1, ?, ?) RETURNING id").get(task, body2, actor.type, actor.id, at, at)?.id);
24755
+ });
24756
+ return commentsOf(database, task).find((one) => one.ref === `note:${made}`);
24757
+ }, "addComment");
24758
+
24759
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
24618
24760
  var TASK_RELATION_KINDS = [
24619
24761
  "blocked-by",
24620
24762
  "follow-up-of",
@@ -24744,7 +24886,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
24744
24886
  };
24745
24887
  }, "taskRelationsStoreOver");
24746
24888
 
24747
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
24889
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
24748
24890
  var TASK_ROLES = ["assignee", "reviewer", "watcher"];
24749
24891
  var iso4 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
24750
24892
  var recordTaskEvent = /* @__PURE__ */ __name((database, task, actor, kind3, changes, at) => {
@@ -24757,6 +24899,10 @@ var textOf3 = /* @__PURE__ */ __name((value, what, max) => {
24757
24899
  return text5;
24758
24900
  }, "textOf");
24759
24901
  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");
24902
+ var timesAsIso = /* @__PURE__ */ __name((changes) => Object.fromEntries(Object.entries(changes).map(([key2, pair]) => [
24903
+ key2,
24904
+ key2.endsWith("_at") && Array.isArray(pair) ? pair.map((value) => typeof value === "number" ? new Date(value).toISOString() : value) : pair
24905
+ ])), "timesAsIso");
24760
24906
  var checkRevision = /* @__PURE__ */ __name((row2, expected) => {
24761
24907
  if (expected === void 0 || Number(row2.revision) === expected)
24762
24908
  return;
@@ -24771,7 +24917,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24771
24917
  throw new CliError("not_found", `no task ${id2}`);
24772
24918
  return row2;
24773
24919
  }, "required");
24774
- const projectOf = /* @__PURE__ */ __name((reference2) => {
24920
+ const projectOf2 = /* @__PURE__ */ __name((reference2) => {
24775
24921
  if (reference2.startsWith("project:")) {
24776
24922
  const thing = requiredThing(database, reference2, "the project");
24777
24923
  if (thing.type !== "project")
@@ -24802,6 +24948,10 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24802
24948
  }
24803
24949
  return parent2;
24804
24950
  }, "parentOf");
24951
+ const projectNamed = /* @__PURE__ */ __name((id2) => {
24952
+ const project = database.prepare("SELECT key, name FROM projects WHERE id = ?").get(id2);
24953
+ return { projectKey: String(project.key), projectName: String(project.name) };
24954
+ }, "projectNamed");
24805
24955
  const detailsOf = /* @__PURE__ */ __name((row2) => {
24806
24956
  const id2 = Number(row2.id);
24807
24957
  const reference2 = /* @__PURE__ */ __name((taskRow) => `task:${taskIdOf(database, taskRow)}`, "reference");
@@ -24810,6 +24960,8 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24810
24960
  ref: reference2(id2),
24811
24961
  key: String(row2.key),
24812
24962
  project: `project:${row2.project_id}`,
24963
+ ...projectNamed(Number(row2.project_id)),
24964
+ createdBy: authorNamed(database, row2),
24813
24965
  title: String(row2.title),
24814
24966
  description: row2.description == null ? null : String(row2.description),
24815
24967
  type: row2.type,
@@ -24839,7 +24991,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24839
24991
  const boardWhere = /* @__PURE__ */ __name((query, zone, at) => {
24840
24992
  if (query === void 0)
24841
24993
  return { sql: BOARD_SCOPE, params: [] };
24842
- const where = queryFilter(query, projectTaskColumns(at), {
24994
+ const where = queryFilter(query, projectTaskColumns(at, timezoneOf(zone)), {
24843
24995
  command: "tasks list",
24844
24996
  now: at,
24845
24997
  ...zone ? { zone } : {}
@@ -24849,11 +25001,34 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24849
25001
  const countOf = /* @__PURE__ */ __name((where) => Number(database.prepare(`SELECT count(*) AS n FROM tasks t WHERE ${where.sql}`).get(...where.params)?.n ?? 0), "countOf");
24850
25002
  const rowById = /* @__PURE__ */ __name((id2) => database.prepare("SELECT * FROM tasks WHERE id = ?").get(id2), "rowById");
24851
25003
  const details2 = /* @__PURE__ */ __name((id2) => detailsOf(rowById(id2)), "details");
25004
+ const onBoard = /* @__PURE__ */ __name((task) => Boolean(database.prepare(`SELECT 1 FROM tasks t WHERE t.id = ? AND ${BOARD_SCOPE}`).get(task)), "onBoard");
25005
+ const moveToProject = /* @__PURE__ */ __name((task, before2, target, actor, at) => {
25006
+ if (target === Number(before2.project_id))
25007
+ return;
25008
+ if (!onBoard(task))
25009
+ throw new CliError("validation_error", "only a project task moves to another project");
25010
+ const targetRow = database.prepare("SELECT key FROM projects WHERE id = ?").get(target);
25011
+ if (String(targetRow.key).length === INBOX_KEY_LENGTH)
25012
+ throw new CliError("validation_error", "a task moves only into one of your projects");
25013
+ const children = database.prepare("SELECT key FROM tasks WHERE parent_id = ? AND deleted_at IS NULL ORDER BY id").all(task).map((row2) => String(row2.key));
25014
+ if (children.length)
25015
+ throw new CliError("validation_error", `${String(before2.key)} has subtasks (${children.join(", ")}); move or detach them first`, { reason: "task.has-subtasks", subtasks: children });
25016
+ const counted = database.prepare("UPDATE projects SET tasks_count = tasks_count + 1, updated_at = ? WHERE id = ? RETURNING key, tasks_count").get(at, target);
25017
+ const number3 = Number(counted.tasks_count);
25018
+ const key2 = `${String(counted.key)}-${number3}`;
25019
+ database.prepare("UPDATE tasks SET project_id = ?, number = ?, key = ?, parent_id = NULL, updated_at = ? WHERE id = ?").run(target, number3, key2, at, task);
25020
+ recordTaskEvent(database, task, actor, "project", {
25021
+ project: [`project:${before2.project_id}`, `project:${target}`],
25022
+ key: [String(before2.key), key2],
25023
+ ...before2.parent_id == null ? {} : { parent: [`task:${taskIdOf(database, Number(before2.parent_id))}`, null] }
25024
+ }, at);
25025
+ }, "moveToProject");
24852
25026
  const edit = /* @__PURE__ */ __name((task, fields4, actor, created = false) => {
24853
25027
  const before2 = rowById(task);
24854
25028
  const at = now2();
24855
25029
  const set = [];
24856
25030
  const values = [];
25031
+ let bump = false;
24857
25032
  const change = /* @__PURE__ */ __name((column2, value, event, key2 = column2) => {
24858
25033
  if ((before2[column2] ?? null) === value)
24859
25034
  return;
@@ -24918,8 +25093,21 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24918
25093
  }
24919
25094
  if (fields4.category !== void 0)
24920
25095
  change("category", fields4.category, "category");
24921
- if (set.length === 0)
25096
+ if (fields4.type !== void 0 && fields4.type !== before2.type) {
25097
+ if (!WORK_TASK_TYPES.includes(fields4.type) || !onBoard(task))
25098
+ throw new CliError("validation_error", `a project task's kind is one of ${WORK_TASK_TYPES.join(", ")}`);
25099
+ change("type", fields4.type, "type");
25100
+ bump = true;
25101
+ }
25102
+ if (fields4.project !== void 0)
25103
+ moveToProject(task, before2, projectOf2(fields4.project), actor, at);
25104
+ if (set.length === 0) {
25105
+ if (bump)
25106
+ database.prepare("UPDATE tasks SET revision = revision + 1 WHERE id = ?").run(task);
24922
25107
  return;
25108
+ }
25109
+ if (bump)
25110
+ set.push("revision = revision + 1");
24923
25111
  database.prepare(`UPDATE tasks SET ${set.join(", ")}, updated_at = ? WHERE id = ?`).run(...values, at, task);
24924
25112
  }, "edit");
24925
25113
  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");
@@ -24986,7 +25174,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24986
25174
  if (!WORK_TASK_TYPES.includes(input.type))
24987
25175
  throw new CliError("validation_error", `a task made here is one of ${WORK_TASK_TYPES.join(", ")}`);
24988
25176
  const made = write(database, () => {
24989
- const project = projectOf(input.project);
25177
+ const project = projectOf2(input.project);
24990
25178
  const { actor } = authorActor(context, by);
24991
25179
  const at = now2();
24992
25180
  const counted = database.prepare("UPDATE projects SET tasks_count = tasks_count + 1, updated_at = ? WHERE id = ? RETURNING key, tasks_count").get(at, project);
@@ -25077,9 +25265,9 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
25077
25265
  find: /* @__PURE__ */ __name(async ({ project, type, status, assignee, where, limit = 100 }) => {
25078
25266
  if (type !== void 0 && !TASK_TYPES.includes(type))
25079
25267
  throw new CliError("validation_error", `a task's type is one of ${TASK_TYPES.join(", ")}`);
25080
- const projectId = project === void 0 ? null : projectOf(project);
25268
+ const projectId2 = project === void 0 ? null : projectOf2(project);
25081
25269
  const person2 = assignee === void 0 ? null : personOf2(assignee);
25082
- 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);
25270
+ 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(projectId2, projectId2, type ?? null, type ?? null, status ?? null, status ?? null, person2, person2, ...where?.params ?? [], Math.min(Math.max(limit, 1), 500)).map(detailsOf);
25083
25271
  }, "find"),
25084
25272
  claim: /* @__PURE__ */ __name(async (id2, holder, until) => {
25085
25273
  const task = required3(id2);
@@ -25131,7 +25319,12 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
25131
25319
  const where = without(name);
25132
25320
  return database.prepare(`SELECT ${select2}, count(*) AS n FROM tasks t ${from2} WHERE ${where.sql} GROUP BY ${group}`).all(...where.params);
25133
25321
  }, "grouped");
25134
- 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));
25322
+ const project = grouped("project", "p.id, p.key, p.name", "JOIN projects p ON p.id = t.project_id", "p.id").map((row2) => ({
25323
+ value: String(row2.key),
25324
+ ref: `project:${row2.id}`,
25325
+ name: String(row2.name),
25326
+ count: Number(row2.n)
25327
+ })).sort((a, b) => a.value.localeCompare(b.value));
25135
25328
  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");
25136
25329
  const assignee = assigned.map((row2) => ({
25137
25330
  value: row2.person == null ? "none" : `person:${row2.person}`,
@@ -25144,6 +25337,13 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
25144
25337
  priorities.set(label, (priorities.get(label) ?? 0) + Number(row2.n));
25145
25338
  }
25146
25339
  const states = new Map(grouped("state", "t.status", "", "t.status").map((row2) => [row2.status, Number(row2.n)]));
25340
+ const groups = dueGroups(at, timezoneOf(zone));
25341
+ const dueWhere = boardWhere(withoutField(withoutField(query, "when"), "overdue"), zone, at);
25342
+ const due = Object.keys(groups).map((value) => ({
25343
+ value,
25344
+ count: Number(database.prepare(`SELECT count(*) AS n FROM tasks t WHERE ${dueWhere.sql} AND ${groups[value]}`).get(...dueWhere.params)?.n ?? 0)
25345
+ }));
25346
+ const agent = grouped("agent", "t.agent", "", "t.agent").map((row2) => ({ value: row2.agent == null ? "none" : String(row2.agent), count: Number(row2.n) })).sort((a, b) => b.count - a.count || a.value.localeCompare(b.value));
25147
25347
  return {
25148
25348
  total: countOf(boardWhere(query, zone, at)),
25149
25349
  project,
@@ -25152,15 +25352,19 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
25152
25352
  value,
25153
25353
  count: priorities.get(value) ?? 0
25154
25354
  })),
25155
- state: TASK_STATES.map((value) => ({ value, count: states.get(value) ?? 0 }))
25355
+ state: TASK_STATES.map((value) => ({ value, count: states.get(value) ?? 0 })),
25356
+ due,
25357
+ agent
25156
25358
  };
25157
25359
  }, "boardCounts"),
25158
- 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) => ({
25360
+ taskPeople: /* @__PURE__ */ __name(async ({ limit = 500 } = {}) => 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 GROUP BY p.id ORDER BY p.owner DESC, n DESC, p.name IS NULL, p.name COLLATE NOCASE, p.id LIMIT ?").all(Math.min(Math.max(limit, 1), 5e3)).map((row2) => ({
25159
25361
  person: `person:${row2.id}`,
25160
25362
  name: row2.name == null ? null : String(row2.name),
25161
25363
  owner: Number(row2.owner) === 1,
25162
25364
  tasks: Number(row2.n)
25163
25365
  })), "taskPeople"),
25366
+ comment: /* @__PURE__ */ __name(async (id2, text5, by) => addComment(context, required3(id2), textOf3(text5, "a comment", 2e4), by), "comment"),
25367
+ comments: /* @__PURE__ */ __name(async (id2) => commentsOf(database, required3(id2)), "comments"),
25164
25368
  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) => ({
25165
25369
  kind: row2.kind,
25166
25370
  actor: row2.actor_type == null ? null : {
@@ -25168,7 +25372,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
25168
25372
  id: Number(row2.actor_id),
25169
25373
  name: row2.actor_name == null ? null : String(row2.actor_name)
25170
25374
  },
25171
- changes: row2.changes == null ? null : JSON.parse(String(row2.changes)),
25375
+ changes: row2.changes == null ? null : timesAsIso(JSON.parse(String(row2.changes))),
25172
25376
  at: iso4(row2.created_at)
25173
25377
  })), "events")
25174
25378
  };
@@ -25182,7 +25386,7 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
25182
25386
  };
25183
25387
  }, "workTasksOver");
25184
25388
 
25185
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
25389
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
25186
25390
  var taskCloseOver = /* @__PURE__ */ __name((context) => {
25187
25391
  const { database, now: now2 } = context;
25188
25392
  const liveRow = /* @__PURE__ */ __name((id2) => {
@@ -25231,7 +25435,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
25231
25435
  };
25232
25436
  }, "taskCloseOver");
25233
25437
 
25234
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
25438
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
25235
25439
  var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
25236
25440
  const { database, now: now2 } = context;
25237
25441
  const required3 = /* @__PURE__ */ __name((id2) => {
@@ -25449,7 +25653,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
25449
25653
  };
25450
25654
  }, "taskPairsOver");
25451
25655
 
25452
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
25656
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
25453
25657
  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";
25454
25658
  var taskStoreOver = /* @__PURE__ */ __name((context) => {
25455
25659
  const { database, now: now2 } = context;
@@ -25654,7 +25858,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
25654
25858
  throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
25655
25859
  }, "oneOf");
25656
25860
 
25657
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/accounts.js
25861
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/accounts.js
25658
25862
  var accountAccountsOver = /* @__PURE__ */ __name((context) => {
25659
25863
  const { database } = context;
25660
25864
  const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
@@ -25699,7 +25903,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
25699
25903
  };
25700
25904
  }, "accountsStoreOver");
25701
25905
 
25702
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
25906
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
25703
25907
  var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
25704
25908
  var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
25705
25909
  const message2 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
@@ -25723,7 +25927,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
25723
25927
  })), "keepDownloads");
25724
25928
  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");
25725
25929
 
25726
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/attachments.js
25930
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/attachments.js
25727
25931
  var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
25728
25932
  const { database } = context;
25729
25933
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -25780,7 +25984,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
25780
25984
  }, "keepAttachmentText")
25781
25985
  }), "attachmentsStoreOver");
25782
25986
 
25783
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
25987
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
25784
25988
  var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
25785
25989
  var pointerMover = /* @__PURE__ */ __name((context, type) => {
25786
25990
  const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
@@ -25960,7 +26164,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
25960
26164
  return done;
25961
26165
  }, "rekeyChats");
25962
26166
 
25963
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
26167
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
25964
26168
  var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
25965
26169
  var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
25966
26170
  var CHAT_LIST_KEY = "chat_list_complete";
@@ -25992,15 +26196,15 @@ var chatCompleteness = /* @__PURE__ */ __name(({ database }, accountKey, chatIds
25992
26196
  });
25993
26197
  }, "chatCompleteness");
25994
26198
 
25995
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/chats.js
26199
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/chats.js
25996
26200
  var chatsStoreOver = /* @__PURE__ */ __name((context) => {
25997
26201
  const { database } = context;
25998
26202
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
25999
26203
  return {
26000
- saveChats: /* @__PURE__ */ __name(async (key2, list) => write(database, () => {
26204
+ saveChats: /* @__PURE__ */ __name(async (key2, list2) => write(database, () => {
26001
26205
  const accountKey = accountPk2(key2);
26002
26206
  revisedBy(context, "chats", () => {
26003
- for (const chat2 of list)
26207
+ for (const chat2 of list2)
26004
26208
  upsertChat(context, accountKey, chat2);
26005
26209
  });
26006
26210
  }), "saveChats"),
@@ -26099,7 +26303,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
26099
26303
  };
26100
26304
  }, "chatsStoreOver");
26101
26305
 
26102
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
26306
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
26103
26307
  import { createHash as createHash6 } from "node:crypto";
26104
26308
  var BATCH_CONTEXT = 50;
26105
26309
  var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
@@ -26237,7 +26441,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
26237
26441
  var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
26238
26442
  ${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
26239
26443
 
26240
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
26444
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
26241
26445
  import { setTimeout } from "node:timers/promises";
26242
26446
  var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
26243
26447
  var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
@@ -26549,7 +26753,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
26549
26753
  AND NOT EXISTS (SELECT 1 FROM messages d
26550
26754
  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");
26551
26755
 
26552
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/conversations.js
26756
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/conversations.js
26553
26757
  var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
26554
26758
  const { database } = context;
26555
26759
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -26656,7 +26860,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
26656
26860
  };
26657
26861
  }, "conversationsStoreOver");
26658
26862
 
26659
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/counters.js
26863
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/counters.js
26660
26864
  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";
26661
26865
  var accountCountersOver = /* @__PURE__ */ __name((context) => {
26662
26866
  const { database } = context;
@@ -26681,7 +26885,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
26681
26885
  counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
26682
26886
  }), "countersStoreOver");
26683
26887
 
26684
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
26888
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
26685
26889
  var MENTION_STATUSES = ["found", "linked", "dismissed"];
26686
26890
  var MENTION_QUERY = defineQuery({
26687
26891
  entity: "mention",
@@ -26897,7 +27101,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
26897
27101
  return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
26898
27102
  }, "listPlaces");
26899
27103
 
26900
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/mentions.js
27104
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/mentions.js
26901
27105
  var accountMentionsOver = /* @__PURE__ */ __name((context) => {
26902
27106
  const { database } = context;
26903
27107
  const { findAccountPk: findAccountPk2 } = keysOver(context);
@@ -26932,7 +27136,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
26932
27136
  places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
26933
27137
  }), "mentionsStoreOver");
26934
27138
 
26935
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
27139
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
26936
27140
  var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
26937
27141
  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");
26938
27142
  const rows = messageId === void 0 ? read2.all(chatKey) : read2.all(chatKey, messageId);
@@ -26947,7 +27151,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
26947
27151
  }));
26948
27152
  }, "documentLinkMessages");
26949
27153
 
26950
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
27154
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
26951
27155
  var stemmerFor = stemmerCache();
26952
27156
  var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
26953
27157
  if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
@@ -26991,7 +27195,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
26991
27195
  });
26992
27196
  }, "laterSharingRare");
26993
27197
 
26994
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/messages.js
27198
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/messages.js
26995
27199
  var accountMessagesOver = /* @__PURE__ */ __name((context) => {
26996
27200
  const { database } = context;
26997
27201
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
@@ -27126,7 +27330,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
27126
27330
  laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
27127
27331
  }), "messagesStoreOver");
27128
27332
 
27129
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
27333
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
27130
27334
  var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
27131
27335
  var iso5 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
27132
27336
  var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: accounts2, limit }) => {
@@ -27183,7 +27387,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
27183
27387
  });
27184
27388
  }, "personPreparation");
27185
27389
 
27186
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
27390
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
27187
27391
  var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
27188
27392
  const id2 = Number(uid);
27189
27393
  if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
@@ -27191,7 +27395,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
27191
27395
  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)));
27192
27396
  }, "personSeenInAccounts");
27193
27397
 
27194
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
27398
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
27195
27399
  var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
27196
27400
  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);
27197
27401
  if (!row2)
@@ -27257,7 +27461,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
27257
27461
  return { id: id2, personId, removed: true };
27258
27462
  }, "removeNote");
27259
27463
 
27260
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/people.js
27464
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/people.js
27261
27465
  var accountPeopleOver = /* @__PURE__ */ __name((context) => {
27262
27466
  const { database } = context;
27263
27467
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
@@ -27312,6 +27516,16 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
27312
27516
  personOf: /* @__PURE__ */ __name(async (identity) => personOf(context, identity), "personOf"),
27313
27517
  personSeenInAccounts: /* @__PURE__ */ __name(async (uid, accountIds) => personSeenInAccounts(context, uid, accountIds), "personSeenInAccounts"),
27314
27518
  personByUid: /* @__PURE__ */ __name(async (uid) => personByUid(context, uid), "personByUid"),
27519
+ add: /* @__PURE__ */ __name(async ({ name }) => {
27520
+ const text5 = typeof name === "string" ? name.trim() : "";
27521
+ if (!text5 || text5.length > 200)
27522
+ throw new CliError("validation_error", "a person's name takes 1\u2013200 characters");
27523
+ const id2 = write(database, () => {
27524
+ const at = context.now();
27525
+ return Number(database.prepare("INSERT INTO persons (name, owner, created_at, updated_at) VALUES (?, 0, ?, ?) RETURNING id").get(text5, at, at)?.id);
27526
+ });
27527
+ return personByUid(context, String(id2));
27528
+ }, "add"),
27315
27529
  owner: /* @__PURE__ */ __name(async () => {
27316
27530
  try {
27317
27531
  return personByUid(context, String(ownerPerson(database).id));
@@ -27332,13 +27546,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
27332
27546
  };
27333
27547
  }, "peopleStoreOver");
27334
27548
 
27335
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
27549
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
27336
27550
  import { createHash as createHash8 } from "node:crypto";
27337
27551
 
27338
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
27552
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
27339
27553
  import { createHash as createHash7 } from "node:crypto";
27340
27554
 
27341
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
27555
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
27342
27556
  var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
27343
27557
  var AUTHOR_MEASURES = [
27344
27558
  "messages",
@@ -27478,7 +27692,7 @@ var withoutUrls = /* @__PURE__ */ __name((text5) => text5.replace(/\S+/gu, (toke
27478
27692
  var rankingWords = /* @__PURE__ */ __name((text5) => withoutUrls(text5).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
27479
27693
  var rankingQuestion = /* @__PURE__ */ __name((text5) => withoutUrls(text5).includes("?"), "rankingQuestion");
27480
27694
 
27481
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
27695
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
27482
27696
  var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
27483
27697
  var exhausted2 = /* @__PURE__ */ __name((budget) => {
27484
27698
  throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
@@ -27700,7 +27914,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
27700
27914
  };
27701
27915
  }, "rankReplyGraph");
27702
27916
 
27703
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
27917
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
27704
27918
  var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
27705
27919
  var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
27706
27920
  var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
@@ -27778,9 +27992,9 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
27778
27992
  const answer = answers.get(node.pk);
27779
27993
  if (!answer)
27780
27994
  continue;
27781
- const key2 = personKey(answer), list = grouped.get(key2) ?? [];
27782
- list.push({ pk: answer.pk, related: node.pk, contribution: answer.timestamp - node.timestamp });
27783
- grouped.set(key2, list);
27995
+ const key2 = personKey(answer), list2 = grouped.get(key2) ?? [];
27996
+ list2.push({ pk: answer.pk, related: node.pk, contribution: answer.timestamp - node.timestamp });
27997
+ grouped.set(key2, list2);
27784
27998
  }
27785
27999
  for (const person2 of options.answerers) {
27786
28000
  const rows = grouped.get(personKey({ account: person2, sender: person2.id })) ?? [];
@@ -27798,9 +28012,9 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
27798
28012
  const grouped = /* @__PURE__ */ new Map();
27799
28013
  for (const node of eligible) {
27800
28014
  const key2 = JSON.stringify([personKey(node), node.chatId]);
27801
- const list = grouped.get(key2) ?? [];
27802
- list.push(node);
27803
- grouped.set(key2, list);
28015
+ const list2 = grouped.get(key2) ?? [];
28016
+ list2.push(node);
28017
+ grouped.set(key2, list2);
27804
28018
  }
27805
28019
  for (const stay of stays) {
27806
28020
  check3();
@@ -27845,9 +28059,9 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
27845
28059
  const node = byPk.get(child);
27846
28060
  if (!node || node.timestamp > options.cutoff)
27847
28061
  continue;
27848
- const list = replies.get(parent2) ?? [];
27849
- list.push({ pk: child, related: parent2, contribution: 1 });
27850
- replies.set(parent2, list);
28062
+ const list2 = replies.get(parent2) ?? [];
28063
+ list2.push({ pk: child, related: parent2, contribution: 1 });
28064
+ replies.set(parent2, list2);
27851
28065
  }
27852
28066
  for (const node of nodes.filter((one) => one.selected && one.chatKind === "channel" && one.graph?.reply === null && !one.graph.discussionSource && one.timestamp <= options.cutoff)) {
27853
28067
  check3();
@@ -27874,7 +28088,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
27874
28088
  return { items, evidence, summary, graph: graph.quality };
27875
28089
  }, "calculateAdminStatistics");
27876
28090
 
27877
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
28091
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
27878
28092
  var rankingContextRange = /* @__PURE__ */ __name((root) => {
27879
28093
  const dates = [];
27880
28094
  const visit = /* @__PURE__ */ __name((node, required3) => {
@@ -27896,7 +28110,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
27896
28110
  return dates[0].node.resolution.date;
27897
28111
  }, "rankingContextRange");
27898
28112
 
27899
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
28113
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
27900
28114
  var reactionCounts = /* @__PURE__ */ __name((stored3) => {
27901
28115
  let counts;
27902
28116
  try {
@@ -28191,7 +28405,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
28191
28405
  });
28192
28406
  }, "rankQuery");
28193
28407
 
28194
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
28408
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
28195
28409
  function fail4(message2, reason = "query.too-large") {
28196
28410
  throw new CliError("validation_error", message2, { reason, complete: false });
28197
28411
  }
@@ -28368,7 +28582,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
28368
28582
  return result;
28369
28583
  }), "adminStatisticsQuery");
28370
28584
 
28371
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
28585
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
28372
28586
  var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
28373
28587
  if (!execution.accounts.length)
28374
28588
  return { conversations: [], chats: [] };
@@ -28386,7 +28600,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
28386
28600
  return { conversations: conversations2, chats: chats2 };
28387
28601
  }, "conversationEligibility");
28388
28602
 
28389
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
28603
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
28390
28604
  import { createHash as createHash9 } from "node:crypto";
28391
28605
  var EVIDENCE_BYTES = 64 * 1024;
28392
28606
  var FINGERPRINT_BYTES = 8 * 1024 * 1024;
@@ -28536,7 +28750,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
28536
28750
  return result;
28537
28751
  }, "rankingEvidence");
28538
28752
 
28539
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/queries.js
28753
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/queries.js
28540
28754
  var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
28541
28755
  const mailIndexed = /* @__PURE__ */ __name((execution) => {
28542
28756
  if (execution.corpus === "mail")
@@ -28555,7 +28769,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
28555
28769
  };
28556
28770
  }, "queriesStoreOver");
28557
28771
 
28558
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
28772
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
28559
28773
  var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
28560
28774
  const { database, now: now2 } = context;
28561
28775
  const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
@@ -28594,10 +28808,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
28594
28808
  }));
28595
28809
  }, "chatEventsOf");
28596
28810
 
28597
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
28811
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
28598
28812
  import { createHash as createHash10 } from "node:crypto";
28599
28813
 
28600
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/calendar.js
28814
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/calendar.js
28601
28815
  var calendarKey = /* @__PURE__ */ __name((zone, by) => {
28602
28816
  const format = new Intl.DateTimeFormat("en-CA", {
28603
28817
  timeZone: zone,
@@ -28612,7 +28826,7 @@ var calendarKey = /* @__PURE__ */ __name((zone, by) => {
28612
28826
  };
28613
28827
  }, "calendarKey");
28614
28828
 
28615
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/retention.js
28829
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/retention.js
28616
28830
  var RETENTION_TOLERANCE = 864e5;
28617
28831
  var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
28618
28832
  const { since, until, cutoff, checkpoints, within, limit, by } = options;
@@ -28666,7 +28880,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
28666
28880
  return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
28667
28881
  }, "retentionCohorts");
28668
28882
 
28669
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
28883
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
28670
28884
  var iso6 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
28671
28885
  var week = /* @__PURE__ */ __name((day) => {
28672
28886
  const date3 = /* @__PURE__ */ new Date(`${day}T00:00:00Z`);
@@ -28802,7 +29016,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
28802
29016
  };
28803
29017
  }, "retentionQuery");
28804
29018
 
28805
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
29019
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
28806
29020
  var iso7 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
28807
29021
  var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
28808
29022
  ...isBot === void 0 ? {} : { bot: isBot },
@@ -28933,7 +29147,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
28933
29147
  lastCount: memberCountsOf(context, pk).at(-1) ?? null
28934
29148
  })), "trackedChats");
28935
29149
 
28936
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/roster.js
29150
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/roster.js
28937
29151
  var rosterStoreOver = /* @__PURE__ */ __name((context) => {
28938
29152
  const { database } = context;
28939
29153
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
@@ -28989,7 +29203,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
28989
29203
  };
28990
29204
  }, "rosterStoreOver");
28991
29205
 
28992
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
29206
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
28993
29207
  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");
28994
29208
  var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
28995
29209
  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 ?`);
@@ -29013,7 +29227,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
29013
29227
  }
29014
29228
  }, "backfillNormalized");
29015
29229
 
29016
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
29230
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
29017
29231
  var INDEX2 = "message_words";
29018
29232
  var searchIndexState2 = /* @__PURE__ */ __name((database) => {
29019
29233
  const row2 = indexRow(database, INDEX2);
@@ -29140,7 +29354,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
29140
29354
  });
29141
29355
  }, "resetSearchIndex");
29142
29356
 
29143
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
29357
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
29144
29358
  var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
29145
29359
  const filled2 = { stemmed: 0, drained: 0 };
29146
29360
  const before2 = stemsState(database);
@@ -29235,7 +29449,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
29235
29449
  return resetStems(database, { now: now2 });
29236
29450
  }, "followDefaultStemmers");
29237
29451
 
29238
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
29452
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
29239
29453
  var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
29240
29454
  var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
29241
29455
  const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
@@ -29257,7 +29471,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
29257
29471
  });
29258
29472
  }, "termCandidates");
29259
29473
 
29260
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/search-index.js
29474
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/search-index.js
29261
29475
  var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
29262
29476
  const { database } = context;
29263
29477
  const stemmerFor2 = stemmerCache();
@@ -29279,7 +29493,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
29279
29493
  };
29280
29494
  }, "searchIndexStoreOver");
29281
29495
 
29282
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
29496
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
29283
29497
  var HISTORY_KEPT = 1e3;
29284
29498
  var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
29285
29499
  var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
@@ -29348,7 +29562,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
29348
29562
  return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
29349
29563
  }, "clearHistory");
29350
29564
 
29351
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/searches.js
29565
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/searches.js
29352
29566
  var searchesStoreOver = /* @__PURE__ */ __name((context) => {
29353
29567
  const { database } = context;
29354
29568
  return {
@@ -29372,7 +29586,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
29372
29586
  };
29373
29587
  }, "searchesStoreOver");
29374
29588
 
29375
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
29589
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
29376
29590
  var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
29377
29591
  var ACTION_OUTCOMES = ["ok", "refused", "failed"];
29378
29592
  var CODE = /^[a-z][a-z0-9_]{0,63}$/;
@@ -29415,7 +29629,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
29415
29629
  };
29416
29630
  }, "agentActionsStoreOver");
29417
29631
 
29418
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
29632
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
29419
29633
  var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
29420
29634
  }) => {
29421
29635
  const { database, now: now2 } = context;
@@ -29474,8 +29688,15 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
29474
29688
  };
29475
29689
  }, "botUpdateStoreOver");
29476
29690
 
29477
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
29691
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
29478
29692
  var DAY4 = 864e5;
29693
+ var accountsOf = /* @__PURE__ */ __name((filter) => {
29694
+ if (filter.accountIds !== void 0 && filter.accountId !== void 0)
29695
+ throw new CliError("validation_error", "an event filter takes accountId or accountIds, not both");
29696
+ if (filter.accountIds?.length === 0)
29697
+ throw new CliError("validation_error", "accountIds names no account");
29698
+ return filter.accountIds ?? (filter.accountId === void 0 ? void 0 : [filter.accountId]);
29699
+ }, "accountsOf");
29479
29700
  var listEvents = /* @__PURE__ */ __name((database, filter) => {
29480
29701
  const clauses = ["e.deleted_at IS NULL"];
29481
29702
  const params = [];
@@ -29511,20 +29732,21 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
29511
29732
  clauses.push(entries("ce.calendar_id = ?"));
29512
29733
  params.push(filter.calendarId);
29513
29734
  }
29514
- if (filter.accountId !== void 0) {
29515
- clauses.push(entries("c.account_id = ?"));
29516
- params.push(filter.accountId);
29517
- }
29735
+ const accounts2 = accountsOf(filter);
29736
+ const inAccounts = /* @__PURE__ */ __name((column2) => {
29737
+ if (accounts2 === void 0)
29738
+ return "";
29739
+ for (const id2 of accounts2)
29740
+ params.push(id2);
29741
+ return `${column2} IN (${accounts2.map(() => "?").join(", ")})`;
29742
+ }, "inAccounts");
29743
+ if (accounts2 !== void 0)
29744
+ clauses.push(entries(inAccounts("c.account_id")));
29518
29745
  if (filter.personId !== void 0) {
29519
29746
  clauses.push(entries("EXISTS (SELECT 1 FROM calendar_entry_participants p JOIN identity_links il ON il.identity_id = p.identity_id WHERE p.entry_id = ce.id AND il.person_id = ?)"));
29520
29747
  params.push(filter.personId);
29521
29748
  }
29522
- const account = /* @__PURE__ */ __name((alias2) => {
29523
- if (filter.accountId === void 0)
29524
- return "";
29525
- params.push(filter.accountId);
29526
- return ` AND ${alias2}.account_id = ?`;
29527
- }, "account");
29749
+ const account = /* @__PURE__ */ __name((alias2) => accounts2 === void 0 ? "" : ` AND ${inAccounts(`${alias2}.account_id`)}`, "account");
29528
29750
  if (filter.changedSince !== void 0) {
29529
29751
  const since = filter.changedSince;
29530
29752
  const own = account("c");
@@ -29541,16 +29763,18 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
29541
29763
  OR r.ends_at IS NOT ce.ends_at FROM calendar_entry_revisions r WHERE r.entry_id = ce.id AND r.created_at >= ?
29542
29764
  ORDER BY r.created_at, r.id LIMIT 1) = 1)))`);
29543
29765
  }
29544
- if (filter.overlapping) {
29766
+ if (filter.overlapping !== void 0) {
29545
29767
  const busy = /* @__PURE__ */ __name((event) => `${event}.deleted_at IS NULL AND ${event}.status <> 'cancelled' AND ${event}.all_day = 0
29546
29768
  AND ${event}.starts_at IS NOT NULL AND ${event}.ends_at IS NOT NULL AND EXISTS (SELECT 1 FROM calendar_entries
29547
29769
  bce JOIN calendars bc ON bc.id = bce.calendar_id WHERE bce.event_id = ${event}.id${account("bc")}
29548
29770
  AND bce.deleted_at IS NULL AND bce.status <> 'cancelled' AND coalesce(bce.own_response, '') <> 'declined'
29549
- AND coalesce(bce.transparency, '') <> 'transparent')`, "busy");
29771
+ AND coalesce(bce.transparency, '') <> 'transparent'
29772
+ AND coalesce(bce.event_type, '') <> 'working-location')`, "busy");
29550
29773
  const own = busy("e");
29551
29774
  params.push(longest());
29552
- clauses.push(`${own} AND EXISTS (SELECT 1 FROM events e2 WHERE e2.id <> e.id AND e2.starts_at < e.ends_at
29553
- AND e2.ends_at > e.starts_at AND e2.starts_at >= e.starts_at - ? AND ${busy("e2")})`);
29775
+ const clash = `${own} AND EXISTS (SELECT 1 FROM events e2 WHERE e2.id <> e.id AND e2.starts_at < e.ends_at
29776
+ AND e2.ends_at > e.starts_at AND e2.starts_at >= e.starts_at - ? AND ${busy("e2")})`;
29777
+ clauses.push(filter.overlapping ? clash : `NOT (${clash})`);
29554
29778
  }
29555
29779
  const limit = filter.limit ?? 100;
29556
29780
  const offset = filter.offset ?? 0;
@@ -29559,7 +29783,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
29559
29783
  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);
29560
29784
  }, "listEvents");
29561
29785
 
29562
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
29786
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
29563
29787
  var calendarOf = /* @__PURE__ */ __name((row2) => ({
29564
29788
  id: Number(row2.id),
29565
29789
  accountId: Number(row2.account_id),
@@ -30139,7 +30363,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
30139
30363
  };
30140
30364
  }, "eventStoreOver");
30141
30365
 
30142
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
30366
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
30143
30367
  var CATALOG_QUERY = defineQuery({
30144
30368
  entity: "document",
30145
30369
  backend: "sql",
@@ -30381,7 +30605,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
30381
30605
  };
30382
30606
  }, "catalogStoreOver");
30383
30607
 
30384
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/context/evidence.js
30608
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/context/evidence.js
30385
30609
  import { createHash as createHash11 } from "node:crypto";
30386
30610
  var CONTEXT_MAX_READ_BYTES = 262144;
30387
30611
  var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
@@ -30479,7 +30703,7 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
30479
30703
  return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
30480
30704
  }, "contextEvidenceRequest");
30481
30705
 
30482
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
30706
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
30483
30707
  var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
30484
30708
  var field3 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
30485
30709
  CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
@@ -30492,7 +30716,7 @@ var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
30492
30716
  THEN 'source-modified' ELSE 'stored-update' END`;
30493
30717
  var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field3("sourceUrl")})`;
30494
30718
 
30495
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
30719
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
30496
30720
  var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
30497
30721
  const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
30498
30722
  signal?.throwIfAborted();
@@ -30591,7 +30815,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
30591
30815
  });
30592
30816
  }, "readMeetingContextEvidence");
30593
30817
 
30594
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
30818
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
30595
30819
  var corpora = {
30596
30820
  message: {
30597
30821
  table: "messages",
@@ -30802,6 +31026,16 @@ var contextRecordOf = /* @__PURE__ */ __name((database, ref3) => {
30802
31026
  revision: row3.revision == null ? null : Number(row3.revision)
30803
31027
  } : null;
30804
31028
  }
31029
+ const note2 = /^note:([1-9]\d*)$/.exec(ref3);
31030
+ if (note2) {
31031
+ const row3 = database.prepare("SELECT title, body, revision FROM notes WHERE id=? AND deleted_at IS NULL").get(Number(note2[1]));
31032
+ return row3 ? {
31033
+ ref: ref3,
31034
+ title: row3.title == null ? null : String(row3.title),
31035
+ text: String(row3.body),
31036
+ revision: Number(row3.revision)
31037
+ } : null;
31038
+ }
30805
31039
  let at;
30806
31040
  try {
30807
31041
  at = parseLocator(ref3);
@@ -30820,7 +31054,7 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
30820
31054
  }
30821
31055
  }), "contextRecordsOver");
30822
31056
 
30823
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
31057
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
30824
31058
  var NOTE_FIELDS = [
30825
31059
  "text",
30826
31060
  "exact",
@@ -31250,7 +31484,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
31250
31484
  };
31251
31485
  }, "noteSearchOver");
31252
31486
 
31253
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
31487
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
31254
31488
  var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
31255
31489
  var inEventAccounts = /* @__PURE__ */ __name((event) => searchableCopy(event, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
31256
31490
  var EVENT_CORPUS = {
@@ -31382,20 +31616,26 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
31382
31616
  };
31383
31617
  }, "eventSearchOver");
31384
31618
 
31385
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
31619
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
31386
31620
  var EVIDENCE_FINDINGS_KIND = "evidence_findings";
31387
31621
  var reference = /* @__PURE__ */ __name((raw) => {
31388
- if (/^document:[1-9]\d*$/.test(raw))
31622
+ if (/^(document|note):[1-9]\d*$/.test(raw))
31389
31623
  return raw;
31390
31624
  try {
31391
31625
  return formatLocator(parseLocator(raw));
31392
31626
  } catch {
31393
- throw new CliError("validation_error", "finding evidence is a msg: or document: reference");
31627
+ throw new CliError("validation_error", "finding evidence is a msg:, document: or note: reference");
31394
31628
  }
31395
31629
  }, "reference");
31396
- var validateEvidenceFindings = /* @__PURE__ */ __name((input) => validateFindings(input, { plural: "evidence findings", singular: "evidence finding", cited: "reference", reference }), "validateEvidenceFindings");
31630
+ var validateEvidenceFindings = /* @__PURE__ */ __name((input) => validateFindings(input, {
31631
+ plural: "evidence findings",
31632
+ singular: "evidence finding",
31633
+ cited: "reference",
31634
+ reference,
31635
+ anySubject: true
31636
+ }), "validateEvidenceFindings");
31397
31637
 
31398
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/moment.js
31638
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/domain/moment.js
31399
31639
  var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
31400
31640
  try {
31401
31641
  return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
@@ -31407,7 +31647,7 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
31407
31647
  }
31408
31648
  }, "calendarMoment");
31409
31649
 
31410
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
31650
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
31411
31651
  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";
31412
31652
  var iso8 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
31413
31653
  var oneOf4 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -31423,7 +31663,7 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
31423
31663
  type: row2.type,
31424
31664
  statement: String(row2.statement),
31425
31665
  status: row2.status,
31426
- project: row2.project_id == null ? null : `project:${row2.project_id}`,
31666
+ ...projectOf(database, row2),
31427
31667
  ...subjectOf(database, row2),
31428
31668
  occurredAt: row2.occurred_at == null ? null : iso8(row2.occurred_at),
31429
31669
  supersedes: row2.supersedes_id == null ? null : `fact:${row2.supersedes_id}`,
@@ -31556,7 +31796,7 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
31556
31796
  };
31557
31797
  }, "factsStoreOver");
31558
31798
 
31559
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
31799
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
31560
31800
  var invalid4 = /* @__PURE__ */ __name((message2) => {
31561
31801
  throw new CliError("validation_error", message2);
31562
31802
  }, "invalid");
@@ -31572,13 +31812,19 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
31572
31812
  const cited = /* @__PURE__ */ __name((input, cite) => {
31573
31813
  const seen = /* @__PURE__ */ new Map();
31574
31814
  for (const finding of input.findings) {
31575
- const project = requiredThing(database, finding.project, "the project");
31576
- if (project.type !== "project")
31577
- return invalid4("a finding needs an owner project");
31578
- const projectRow = database.prepare("SELECT id,key,name,description,type,scope,updated_at FROM projects WHERE id=? AND account_id IS NULL AND deleted_at IS NULL").get(project.id);
31579
- if (!projectRow)
31580
- throw new CliError("not_found", "the owner project is unavailable");
31581
- seen.set(finding.project, projectRow);
31815
+ let projectId2 = null;
31816
+ if (finding.project !== void 0) {
31817
+ const project = requiredThing(database, finding.project, "the project");
31818
+ if (project.type !== "project")
31819
+ return invalid4("a finding needs an owner project");
31820
+ const projectRow = database.prepare("SELECT id,key,name,description,type,scope,updated_at FROM projects WHERE id=? AND account_id IS NULL AND deleted_at IS NULL").get(project.id);
31821
+ if (!projectRow)
31822
+ throw new CliError("not_found", "the owner project is unavailable");
31823
+ seen.set(finding.project, projectRow);
31824
+ projectId2 = String(project.id);
31825
+ }
31826
+ if (finding.subject !== void 0)
31827
+ seen.set(finding.subject, requiredThing(database, finding.subject, "the subject"));
31582
31828
  if (finding.kind === "task" && finding.assignee) {
31583
31829
  const person2 = requiredThing(database, finding.assignee, "the assignee");
31584
31830
  if (person2.type !== "person")
@@ -31589,7 +31835,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
31589
31835
  seen.set(finding.assignee, personRow);
31590
31836
  }
31591
31837
  for (const evidence of finding.evidence)
31592
- cite(evidence, finding, String(project.id), seen);
31838
+ cite(evidence, finding, projectId2, seen);
31593
31839
  }
31594
31840
  return seen;
31595
31841
  }, "cited");
@@ -31605,12 +31851,15 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
31605
31851
  const fact = facts2.add({
31606
31852
  type: finding.type,
31607
31853
  statement: finding.statement,
31608
- project: finding.project,
31854
+ ...finding.project === void 0 ? {} : { project: finding.project },
31855
+ ...finding.subject === void 0 ? {} : { subject: finding.subject },
31609
31856
  evidence,
31610
31857
  by: agent
31611
31858
  });
31612
31859
  return facts2.accept(fact.ref).ref;
31613
31860
  }
31861
+ if (finding.project === void 0)
31862
+ return invalid4("a task finding names the project the task goes in");
31614
31863
  const task = tasks2.create({
31615
31864
  project: finding.project,
31616
31865
  title: finding.title,
@@ -31646,12 +31895,13 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
31646
31895
  return { snapshot: snapshot2, snapshotParts, previous, outcomes };
31647
31896
  }, "findingsCoreOver");
31648
31897
 
31649
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
31898
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
31650
31899
  var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
31651
31900
  var PROPOSAL_VERDICTS = ["useful", "not_useful"];
31652
31901
  var iso9 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
31653
- var NAMED4 = "SELECT p.*, b.name AS proposer_name FROM proposed_actions p LEFT JOIN bots b ON p.proposed_by_type = 'bot' AND b.id = p.proposed_by_id";
31654
31902
  var json2 = /* @__PURE__ */ __name((value) => value == null ? null : JSON.parse(String(value)), "json");
31903
+ var STATUS = `CASE WHEN p.status = 'approved' AND p.kind IN ('${MEETING_FINDINGS_KIND}', '${EVIDENCE_FINDINGS_KIND}') AND json_array_length(p.result, '$.accepted') = 0 THEN 'rejected' ELSE p.status END`;
31904
+ var NAMED4 = `SELECT p.*, ${STATUS} AS shown_status, b.name AS proposer_name FROM proposed_actions p LEFT JOIN bots b ON p.proposed_by_type = 'bot' AND b.id = p.proposed_by_id`;
31655
31905
  var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
31656
31906
  const { database, now: now2 } = context;
31657
31907
  const actionOf = /* @__PURE__ */ __name((row2) => {
@@ -31663,7 +31913,7 @@ var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
31663
31913
  target: row2.target_type == null ? null : referenceOfThing(database, storedThing(row2.target_type, row2.target_id)) ?? null,
31664
31914
  payload: json2(row2.payload),
31665
31915
  reason: row2.reason == null ? null : String(row2.reason),
31666
- status: row2.status,
31916
+ status: row2.shown_status,
31667
31917
  proposedBy: {
31668
31918
  type: row2.proposed_by_type,
31669
31919
  id: String(row2.proposed_by_id),
@@ -31727,7 +31977,7 @@ var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
31727
31977
  list: /* @__PURE__ */ __name(({ status, limit = 100 } = {}) => {
31728
31978
  if (status !== void 0 && !PROPOSAL_STATUSES.includes(status))
31729
31979
  throw new CliError("validation_error", `a status is one of ${PROPOSAL_STATUSES.join(", ")}`);
31730
- return database.prepare(`${NAMED4} WHERE (? IS NULL OR p.status = ?) ORDER BY p.created_at DESC, p.id DESC LIMIT ?`).all(status ?? null, status ?? null, Math.min(Math.max(limit, 1), 500)).map(actionOf);
31980
+ return database.prepare(`${NAMED4} WHERE (? IS NULL OR ${STATUS} = ?) ORDER BY p.created_at DESC, p.id DESC LIMIT ?`).all(status ?? null, status ?? null, Math.min(Math.max(limit, 1), 500)).map(actionOf);
31731
31981
  }, "list"),
31732
31982
  approve: /* @__PURE__ */ __name((id2, result, by) => decide2(id2, "approved", result, by), "approve"),
31733
31983
  reject: /* @__PURE__ */ __name((id2) => decide2(id2, "rejected"), "reject"),
@@ -31792,7 +32042,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
31792
32042
  };
31793
32043
  }, "proposedActionsStoreOver");
31794
32044
 
31795
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
32045
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
31796
32046
  var stale = /* @__PURE__ */ __name(() => {
31797
32047
  throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
31798
32048
  reason: "evidence-findings.stale"
@@ -31816,13 +32066,15 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31816
32066
  return invalid5("stored findings exceed the read budget");
31817
32067
  return proposals.get(id2);
31818
32068
  }, "load");
32069
+ const projectOf2 = /* @__PURE__ */ __name((input) => input.findings.find((finding) => finding.project)?.project ?? null, "projectOf");
31819
32070
  const view = /* @__PURE__ */ __name((proposal) => {
31820
32071
  const input = proposal.payload;
31821
- if (!input || !proposal.target || !["proposed", "approved"].includes(proposal.status))
32072
+ if (!input || !["proposed", "approved", "rejected"].includes(proposal.status))
31822
32073
  return invalid5("invalid stored findings batch");
31823
32074
  return {
31824
32075
  id: proposal.id,
31825
- project: proposal.target,
32076
+ project: projectOf2(input),
32077
+ subject: proposal.target,
31826
32078
  input: { schemaVersion: 1, key: input.key, extractor: input.extractor, findings: input.findings },
31827
32079
  fingerprint: findingHash({ input, author: proposal.proposedBy.id }),
31828
32080
  status: proposal.status === "proposed" ? "proposed" : "reviewed",
@@ -31875,9 +32127,12 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31875
32127
  return {
31876
32128
  stage: /* @__PURE__ */ __name(async (raw, rawAgent) => {
31877
32129
  const input = validateEvidenceFindings(raw);
31878
- const projects2 = new Set(input.findings.map((finding) => finding.project));
31879
- if (projects2.size !== 1)
31880
- return invalid5("an evidence findings batch is about one project");
32130
+ const projects2 = new Set(input.findings.flatMap((finding) => finding.project ?? []));
32131
+ if (projects2.size > 1)
32132
+ return invalid5("an evidence findings batch is about one project at most");
32133
+ const subjects = new Set(input.findings.map((finding) => finding.subject));
32134
+ const shared = subjects.size === 1 ? [...subjects][0] : void 0;
32135
+ const target = shared ?? [...projects2][0];
31881
32136
  const by = findingsAgent(rawAgent);
31882
32137
  return write(database, () => {
31883
32138
  const { actor } = authorActor(context, by);
@@ -31897,21 +32152,22 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31897
32152
  return view(proposals.propose({
31898
32153
  kind: EVIDENCE_FINDINGS_KIND,
31899
32154
  by,
31900
- target: [...projects2][0],
32155
+ ...target === void 0 ? {} : { target },
31901
32156
  payload: { ...input, inputHash, snapshotHash, snapshotParts, agentModel: by.model ?? null }
31902
32157
  }));
31903
32158
  });
31904
32159
  }, "stage"),
31905
32160
  get: /* @__PURE__ */ __name(async (id2) => view(load(id2)), "get"),
32161
+ sources: /* @__PURE__ */ __name(async (id2) => sourcesOfReferences(database, view(load(id2)).input.findings.flatMap((finding) => finding.evidence.map((one) => one.reference))), "sources"),
31906
32162
  list: /* @__PURE__ */ __name(async ({ project, limit = 20, offset = 0, status } = {}) => {
31907
32163
  if (status !== void 0 && status !== "proposed" && status !== "reviewed")
31908
32164
  return invalid5("finding status is proposed or reviewed");
31909
32165
  if (!Number.isSafeInteger(limit) || limit < 1 || limit > 50 || !Number.isSafeInteger(offset) || offset < 0)
31910
32166
  return invalid5("findings lists take 1\u201350 items and a nonnegative offset");
31911
- const projectId = project === void 0 ? null : /^project:([1-9]\d*)$/.exec(project)?.[1];
31912
- if (projectId === void 0)
32167
+ const projectId2 = project === void 0 ? null : /^project:([1-9]\d*)$/.exec(project)?.[1];
32168
+ if (projectId2 === void 0)
31913
32169
  return invalid5("a findings list filters by a project reference");
31914
- const ids = database.prepare("SELECT id FROM proposed_actions WHERE account_id IS NULL AND kind=? AND (? IS NULL OR (target_type='project' AND target_id=?)) AND (? IS NULL OR status=?) ORDER BY id DESC LIMIT ? OFFSET ?").all(EVIDENCE_FINDINGS_KIND, projectId, projectId === null ? null : Number(projectId), status ?? null, status === "reviewed" ? "approved" : status ?? null, limit + 1, offset);
32170
+ const ids = database.prepare("SELECT id FROM proposed_actions WHERE account_id IS NULL AND kind=? AND (? IS NULL OR (target_type='project' AND target_id=?) OR EXISTS (SELECT 1 FROM json_each(payload,'$.findings') f WHERE json_extract(f.value,'$.project')=?)) AND (? IS NULL OR status=?) ORDER BY id DESC LIMIT ? OFFSET ?").all(EVIDENCE_FINDINGS_KIND, projectId2, projectId2 === null ? null : Number(projectId2), projectId2 === null ? null : `project:${projectId2}`, status ?? null, status === "reviewed" ? "approved" : status ?? null, limit + 1, offset);
31915
32171
  return { items: ids.slice(0, limit).map((row2) => view(load(String(row2.id)))), hasMore: ids.length > limit };
31916
32172
  }, "list"),
31917
32173
  review: /* @__PURE__ */ __name(async (id2, decision) => write(database, () => {
@@ -31958,7 +32214,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31958
32214
  };
31959
32215
  }, "evidenceFindingsStoreOver");
31960
32216
 
31961
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
32217
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
31962
32218
  var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
31963
32219
  var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
31964
32220
  rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
@@ -32011,7 +32267,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
32011
32267
  }, "forPerson")
32012
32268
  }), "involvementStoreOver");
32013
32269
 
32014
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
32270
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
32015
32271
  import { createHash as createHash12 } from "node:crypto";
32016
32272
  var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
32017
32273
  var id = /* @__PURE__ */ __name((value) => {
@@ -32045,10 +32301,10 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
32045
32301
  };
32046
32302
  }, "linkOf");
32047
32303
  return {
32048
- linkMeetingProject: /* @__PURE__ */ __name(async (key2, meetingId, projectId, options = {}) => {
32304
+ linkMeetingProject: /* @__PURE__ */ __name(async (key2, meetingId, projectId2, options = {}) => {
32049
32305
  check2(options.signal);
32050
32306
  const meeting = id(meetingId);
32051
- const project = id(projectId);
32307
+ const project = id(projectId2);
32052
32308
  const by = options.by ?? "owner";
32053
32309
  if (by !== "owner" && by !== "agent")
32054
32310
  throw new CliError("validation_error", "choose owner or agent provenance");
@@ -32097,16 +32353,16 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
32097
32353
  };
32098
32354
  }, "meetingProjectsStoreOver");
32099
32355
 
32100
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
32356
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
32101
32357
  import { createHash as createHash15 } from "node:crypto";
32102
32358
 
32103
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
32359
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
32104
32360
  import { createHash as createHash14 } from "node:crypto";
32105
32361
 
32106
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
32362
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
32107
32363
  import { createHash as createHash13 } from "node:crypto";
32108
32364
 
32109
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
32365
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
32110
32366
  var consolidationId = /* @__PURE__ */ __name((value, field4) => {
32111
32367
  if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
32112
32368
  throw new CliError("validation_error", `${field4} must be a positive canonical tag id`);
@@ -32157,7 +32413,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
32157
32413
  return input;
32158
32414
  }, "consolidationApplyInput");
32159
32415
 
32160
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
32416
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
32161
32417
  var receiptOf = /* @__PURE__ */ __name((row2) => ({
32162
32418
  id: String(row2.id),
32163
32419
  sourceId: String(row2.source_id),
@@ -32232,7 +32488,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
32232
32488
  }, { beforeCommit: check3 });
32233
32489
  }, "applyTagConsolidation");
32234
32490
 
32235
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
32491
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
32236
32492
  var selections = [
32237
32493
  ["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
32238
32494
  ["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
@@ -32376,7 +32632,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
32376
32632
  };
32377
32633
  }, "previewRows");
32378
32634
 
32379
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
32635
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
32380
32636
  var kinds = ["project", "tag", "topic"];
32381
32637
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
32382
32638
  if (signal?.aborted)
@@ -32640,7 +32896,7 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
32640
32896
  };
32641
32897
  }, "vocabularyStoreOver");
32642
32898
 
32643
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
32899
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
32644
32900
  var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
32645
32901
  var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
32646
32902
  var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
@@ -32799,7 +33055,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
32799
33055
  scope: row2.scope,
32800
33056
  createdAt: iso10(row2.created_at)
32801
33057
  }), "organizationOf");
32802
- const projectOf = /* @__PURE__ */ __name((row2) => ({
33058
+ const projectOf2 = /* @__PURE__ */ __name((row2) => ({
32803
33059
  id: String(row2.id),
32804
33060
  ref: `project:${row2.id}`,
32805
33061
  key: String(row2.key),
@@ -32870,7 +33126,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
32870
33126
  return row2;
32871
33127
  }, "openTask");
32872
33128
  const canonicalTagName = /* @__PURE__ */ __name((name) => canonicalTagNamed(database, name)?.name ?? normalizeTag(name), "canonicalTagName");
32873
- const tagsOf2 = /* @__PURE__ */ __name((list) => [...new Set(list.map(canonicalTagName))], "tagsOf");
33129
+ const tagsOf2 = /* @__PURE__ */ __name((list2) => [...new Set(list2.map(canonicalTagName))], "tagsOf");
32874
33130
  return {
32875
33131
  ...vocabularyStoreOver(context),
32876
33132
  ...meetingProjectsStoreOver(context),
@@ -33034,7 +33290,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
33034
33290
  }
33035
33291
  const at = now2();
33036
33292
  const row2 = database.prepare("INSERT INTO projects (key, name, name_folded, description, type, organization_id, scope, tasks_count, status, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, 0, 'active', ?, ?) RETURNING *").get(chosen, title, fold(title), description === void 0 ? null : textOf4(description, 2e3), oneOf5(type, PROJECT_TYPES, "a project's type"), organizationId, oneOf5(scope3, SCOPES, "a scope"), at, at);
33037
- return projectOf(row2);
33293
+ return projectOf2(row2);
33038
33294
  }), "addProject"),
33039
33295
  projects: /* @__PURE__ */ __name(async (query) => {
33040
33296
  const asksKind = query !== void 0 && walkQuery(query.root).some((node) => node.field === "kind");
@@ -33048,7 +33304,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
33048
33304
  scope: { type: "enum", sql: "scope" },
33049
33305
  created_at: { type: "time", sql: "created_at" }
33050
33306
  });
33051
- return database.prepare(`SELECT * FROM projects WHERE deleted_at IS NULL${asksKind ? "" : ` AND length(key) <> ${INBOX_KEY_LENGTH}`}${where ? ` AND (${where.sql})` : ""} ORDER BY name, id LIMIT 500`).all(...where?.params ?? []).map(projectOf);
33307
+ return database.prepare(`SELECT * FROM projects WHERE deleted_at IS NULL${asksKind ? "" : ` AND length(key) <> ${INBOX_KEY_LENGTH}`}${where ? ` AND (${where.sql})` : ""} ORDER BY name, id LIMIT 500`).all(...where?.params ?? []).map(projectOf2);
33052
33308
  }, "projects"),
33053
33309
  relate: /* @__PURE__ */ __name(async (key2, input) => {
33054
33310
  const from2 = related(key2, input.from, true);
@@ -33162,7 +33418,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
33162
33418
  return key2.padEnd(3, "X");
33163
33419
  }, "projectKey");
33164
33420
 
33165
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
33421
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
33166
33422
  var DAY5 = 864e5;
33167
33423
  var SETTING4 = "logs_pruned_at";
33168
33424
  var LOG_RETENTION = { agentActionsMs: 90 * DAY5, botUpdatePayloadsMs: 30 * DAY5 };
@@ -33189,7 +33445,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
33189
33445
  };
33190
33446
  }, "logPruner");
33191
33447
 
33192
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
33448
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
33193
33449
  var stale2 = /* @__PURE__ */ __name(() => {
33194
33450
  throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
33195
33451
  reason: "meeting-findings.stale"
@@ -33221,7 +33477,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
33221
33477
  }, "load");
33222
33478
  const view = /* @__PURE__ */ __name((proposal) => {
33223
33479
  const input = proposal.payload;
33224
- if (!input || !proposal.account || !["proposed", "approved"].includes(proposal.status))
33480
+ if (!input || !proposal.account || !["proposed", "approved", "rejected"].includes(proposal.status))
33225
33481
  return invalid6("invalid stored findings batch");
33226
33482
  return {
33227
33483
  id: proposal.id,
@@ -33242,11 +33498,11 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
33242
33498
  const core = findingsCoreOver(context, MEETING_FINDINGS_KIND);
33243
33499
  const snapshot2 = /* @__PURE__ */ __name((account, input) => {
33244
33500
  let readBytes = 0;
33245
- return core.snapshot(input, (evidence, finding, projectId, seen) => {
33501
+ return core.snapshot(input, (evidence, finding, projectId2, seen) => {
33246
33502
  const parsed2 = parseMeetingReference(evidence.reference);
33247
33503
  if (parsed2.accountId !== account)
33248
33504
  throw new CliError("not_found", "the cited cue belongs to another account");
33249
- const membership = database.prepare("SELECT id,updated_at,confirmed,source FROM links WHERE from_type='meeting' AND from_id=? AND to_type='project' AND to_id=? AND kind='member-of' AND anchor IS NULL AND confirmed=1").get(parsed2.meetingId, projectId);
33505
+ const membership = database.prepare("SELECT id,updated_at,confirmed,source FROM links WHERE from_type='meeting' AND from_id=? AND to_type='project' AND to_id=? AND kind='member-of' AND anchor IS NULL AND confirmed=1").get(parsed2.meetingId, projectId2);
33250
33506
  if (!membership)
33251
33507
  return invalid6("each cited meeting needs confirmed membership in the finding's project");
33252
33508
  seen.set(`${finding.project}/${parsed2.meetingId}`, membership);
@@ -33358,7 +33614,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
33358
33614
  };
33359
33615
  }, "meetingFindingsStoreOver");
33360
33616
 
33361
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
33617
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
33362
33618
  var RANK_BATCH = 512;
33363
33619
  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";
33364
33620
  var limitOf = /* @__PURE__ */ __name((value, name, max = 1e3) => {
@@ -33629,7 +33885,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
33629
33885
  }
33630
33886
  }), "meetingVectorsOver");
33631
33887
 
33632
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
33888
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
33633
33889
  var OTHER_SOURCES = ["document", "note", "email"];
33634
33890
  var TEXTS = {
33635
33891
  document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
@@ -33730,11 +33986,11 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
33730
33986
  };
33731
33987
  }, "sourceMentionStoreOver");
33732
33988
 
33733
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
33989
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
33734
33990
  import { mkdirSync, statSync, writeFileSync } from "node:fs";
33735
33991
  import { dirname } from "node:path";
33736
33992
 
33737
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
33993
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
33738
33994
  import { readFileSync as readFileSync3 } from "node:fs";
33739
33995
  var CLIENTS_SETTING = "clients";
33740
33996
  var coreVersion = (() => {
@@ -33792,7 +34048,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
33792
34048
  return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
33793
34049
  }, "refusalAdvice");
33794
34050
 
33795
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
34051
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
33796
34052
  var GENERATED = [
33797
34053
  {
33798
34054
  "name": "20261010184427_initial",
@@ -34678,10 +34934,17 @@ WHERE json_type(params, '$.selection') = 'object';`
34678
34934
  "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;",
34679
34935
  "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;"
34680
34936
  ]
34937
+ },
34938
+ {
34939
+ "name": "20261101011859_version-43-memory-project",
34940
+ "statements": [
34941
+ "ALTER TABLE `memories` ADD `project_id` integer REFERENCES projects(id);",
34942
+ "CREATE INDEX `memories_by_project_id` ON `memories` (`project_id`);"
34943
+ ]
34681
34944
  }
34682
34945
  ];
34683
34946
 
34684
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
34947
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
34685
34948
  var MANIFEST = [
34686
34949
  { name: "20261010184427_initial", version: 1, minCompatible: 1 },
34687
34950
  { name: "20261011035353_version-2-facts", version: 2, minCompatible: 1 },
@@ -34737,7 +35000,8 @@ var MANIFEST = [
34737
35000
  { name: "20261030114008_version-39-email-locations", version: 39, minCompatible: 34 },
34738
35001
  { name: "20261030225520_version-40-note-trigrams", version: 40, minCompatible: 34 },
34739
35002
  { name: "20261031230945_version-41-task-fields", version: 41, minCompatible: 34 },
34740
- { name: "20261101002523_version-42-task-revision", version: 42, minCompatible: 34 }
35003
+ { name: "20261101002523_version-42-task-revision", version: 42, minCompatible: 34 },
35004
+ { name: "20261101011859_version-43-memory-project", version: 43, minCompatible: 34 }
34741
35005
  ];
34742
35006
  var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated = GENERATED) => {
34743
35007
  const migrations = [];
@@ -34761,7 +35025,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
34761
35025
  return migrations;
34762
35026
  }, "generatedMigrations");
34763
35027
 
34764
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/migrations.js
35028
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/migrations.js
34765
35029
  var MIGRATIONS = generatedMigrations();
34766
35030
  var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
34767
35031
  version INTEGER PRIMARY KEY,
@@ -34814,7 +35078,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
34814
35078
  }
34815
35079
  }, "migrate");
34816
35080
 
34817
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
35081
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
34818
35082
  var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
34819
35083
  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 ?");
34820
35084
  if (pending.get(0, 1) === void 0)
@@ -34836,7 +35100,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
34836
35100
  }
34837
35101
  }, "fillJoinKeys");
34838
35102
 
34839
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
35103
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
34840
35104
  var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
34841
35105
  const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
34842
35106
  try {
@@ -34849,8 +35113,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
34849
35113
  }, "openSqlite");
34850
35114
  var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
34851
35115
  quietSqliteWarning();
34852
- const { drizzle } = await import("./node-S3VEQNTE.js");
34853
- const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-3DNWF2BW.js");
35116
+ const { drizzle } = await import("./node-QXGPMDH2.js");
35117
+ const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-L6CAMXQ2.js");
34854
35118
  const client = await nodeClient(path, { readOnly });
34855
35119
  try {
34856
35120
  return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
@@ -34860,8 +35124,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
34860
35124
  }
34861
35125
  }, "openUnderNode");
34862
35126
  var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
34863
- const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-2G5TXHYE.js");
34864
- const { drizzle } = await import("./bun-KUKVEKDW.js");
35127
+ const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-KBIIODPV.js");
35128
+ const { drizzle } = await import("./bun-AHZX63TR.js");
34865
35129
  const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
34866
35130
  try {
34867
35131
  return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
@@ -34871,7 +35135,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
34871
35135
  }
34872
35136
  }, "openUnderBun");
34873
35137
 
34874
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
35138
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
34875
35139
  var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
34876
35140
  const ours = MIGRATIONS.at(-1)?.version ?? 0;
34877
35141
  if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
@@ -34886,7 +35150,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
34886
35150
  throw new CliError("configuration_error", `The store requires schema ${minCompatible}, but this tool supports ${ours}; ${refusalAdvice(storeClients(database), command, version)}`);
34887
35151
  }, "assertReadCompatible");
34888
35152
 
34889
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
35153
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
34890
35154
  var BACKFILL_ON_OPEN = 5e3;
34891
35155
  var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
34892
35156
  var createWritable = /* @__PURE__ */ __name((file) => {
@@ -34942,10 +35206,10 @@ var openStoreContext = /* @__PURE__ */ __name(async ({ path, env, now: now2 = Da
34942
35206
  }
34943
35207
  }, "openStoreContext");
34944
35208
 
34945
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
35209
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
34946
35210
  import { createHash as createHash16 } from "node:crypto";
34947
35211
 
34948
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
35212
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
34949
35213
  var text3 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
34950
35214
  var ref = text3(2048);
34951
35215
  var timestamp2 = pipe(number(), safeInteger(), minValue(0));
@@ -35011,7 +35275,7 @@ var projectAnnotationsSchema = strictObject({
35011
35275
  }))
35012
35276
  });
35013
35277
 
35014
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
35278
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
35015
35279
  var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
35016
35280
  var invalid7 = /* @__PURE__ */ __name((field4) => {
35017
35281
  throw new CliError("validation_error", `invalid project annotations.${field4}`);
@@ -35115,7 +35379,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
35115
35379
  invalid7("external.unused");
35116
35380
  }, "validateProjectAnnotationsGraph");
35117
35381
 
35118
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
35382
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
35119
35383
  var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
35120
35384
  var ref2 = pipe(string(), minLength(1), maxLength(2048));
35121
35385
  var targetSchema = strictObject({
@@ -35221,7 +35485,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
35221
35485
  };
35222
35486
  }, "planBoundProjectAnnotations");
35223
35487
 
35224
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
35488
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
35225
35489
  import { createHash as createHash17 } from "node:crypto";
35226
35490
  var text4 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
35227
35491
  var timestamp3 = pipe(number(), safeInteger(), minValue(0));
@@ -35315,7 +35579,7 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
35315
35579
  })).digest("hex");
35316
35580
  }, "projectAnnotationSnapshotFingerprint");
35317
35581
 
35318
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
35582
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
35319
35583
  var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
35320
35584
  if (!request || typeof request !== "object" || Array.isArray(request))
35321
35585
  throw new CliError("validation_error", "project annotation request is required");
@@ -35332,7 +35596,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
35332
35596
  return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
35333
35597
  }, "projectAnnotationRequest");
35334
35598
 
35335
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
35599
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
35336
35600
  var SnapshotBudget = class {
35337
35601
  static {
35338
35602
  __name(this, "SnapshotBudget");
@@ -35358,13 +35622,13 @@ var SnapshotBudget = class {
35358
35622
  }
35359
35623
  };
35360
35624
 
35361
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
35625
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
35362
35626
  import { createHash as createHash19 } from "node:crypto";
35363
35627
 
35364
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
35628
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
35365
35629
  var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
35366
35630
 
35367
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
35631
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
35368
35632
  import { createHash as createHash18 } from "node:crypto";
35369
35633
  var invalid9 = /* @__PURE__ */ __name(() => {
35370
35634
  throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
@@ -35507,7 +35771,7 @@ var ProjectSnapshotSources = class {
35507
35771
  }
35508
35772
  };
35509
35773
 
35510
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
35774
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
35511
35775
  var unsupported = /* @__PURE__ */ __name(() => {
35512
35776
  throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
35513
35777
  }, "unsupported");
@@ -35533,7 +35797,7 @@ var provenance = /* @__PURE__ */ __name((raw) => {
35533
35797
  return unsupported();
35534
35798
  return text5 ?? null;
35535
35799
  }, "provenance");
35536
- var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, budget) => read(database, () => {
35800
+ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, budget) => read(database, () => {
35537
35801
  if (database.prepare("SELECT max(version) AS version FROM schema_migrations").get()?.version !== MIGRATIONS.at(-1)?.version)
35538
35802
  throw new CliError("configuration_error", "project snapshots require the SDK's current store schema without source migration");
35539
35803
  const sources = new ProjectSnapshotSources(database, budget);
@@ -35541,7 +35805,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
35541
35805
  budget.rows(database, from2, fields4, params);
35542
35806
  return database.prepare(`SELECT ${fields4.join(",")} ${from2} LIMIT 1001`).all(...params);
35543
35807
  }, "rows");
35544
- const descriptor = database.prepare("SELECT account_id,deleted_at FROM projects WHERE id=?").get(projectId);
35808
+ const descriptor = database.prepare("SELECT account_id,deleted_at FROM projects WHERE id=?").get(projectId2);
35545
35809
  if (!descriptor)
35546
35810
  throw new CliError("not_found", "the source project does not exist");
35547
35811
  if (descriptor.account_id !== null || descriptor.deleted_at !== null)
@@ -35559,13 +35823,13 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
35559
35823
  "status",
35560
35824
  "created_at",
35561
35825
  "updated_at"
35562
- ], [projectId])[0];
35826
+ ], [projectId2])[0];
35563
35827
  if (!project)
35564
35828
  throw new CliError("not_found", "the source project does not exist");
35565
- const aliases2 = rows("FROM aliases WHERE aliasable_type='project' AND aliasable_id=? ORDER BY id", ["name", "source", "display", "account_id", "created_at", "updated_at"], [projectId]);
35829
+ const aliases2 = rows("FROM aliases WHERE aliasable_type='project' AND aliasable_id=? ORDER BY id", ["name", "source", "display", "account_id", "created_at", "updated_at"], [projectId2]);
35566
35830
  if (aliases2.some((alias2) => alias2.account_id !== null))
35567
35831
  return unsupported();
35568
- if (database.prepare("SELECT 1 FROM facts WHERE project_id=? AND (metadata IS NOT NULL OR deleted_at IS NOT NULL) LIMIT 1").get(projectId))
35832
+ if (database.prepare("SELECT 1 FROM facts WHERE project_id=? AND (metadata IS NOT NULL OR deleted_at IS NOT NULL) LIMIT 1").get(projectId2))
35569
35833
  return unsupported();
35570
35834
  const facts2 = rows("FROM facts WHERE project_id=? ORDER BY id", [
35571
35835
  "id",
@@ -35585,7 +35849,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
35585
35849
  "source",
35586
35850
  "created_at",
35587
35851
  "updated_at"
35588
- ], [projectId]);
35852
+ ], [projectId2]);
35589
35853
  const links2 = rows("FROM links WHERE (from_type='project' AND from_id=?) OR (to_type='project' AND to_id=?) OR (from_type='fact' AND from_id IN (SELECT id FROM facts WHERE project_id=?)) OR (to_type='fact' AND to_id IN (SELECT id FROM facts WHERE project_id=?)) ORDER BY id", [
35590
35854
  "id",
35591
35855
  "from_type",
@@ -35603,8 +35867,8 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
35603
35867
  "author",
35604
35868
  "created_at",
35605
35869
  "updated_at"
35606
- ], [projectId, projectId, projectId, projectId]);
35607
- const projectRef = `project:${projectId}`;
35870
+ ], [projectId2, projectId2, projectId2, projectId2]);
35871
+ const projectRef = `project:${projectId2}`;
35608
35872
  const owned = /* @__PURE__ */ new Set([projectRef, ...facts2.map((row2) => `fact:${row2.id}`)]);
35609
35873
  const data = {
35610
35874
  format: "wirecat.project-annotations",
@@ -35678,9 +35942,9 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
35678
35942
  return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
35679
35943
  }), "projectAnnotationSnapshot");
35680
35944
 
35681
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
35682
- var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, manifest, bindings, budget) => read(database, () => {
35683
- const current = projectAnnotationSnapshot(database, projectId, budget).snapshot;
35945
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
35946
+ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, manifest, bindings, budget) => read(database, () => {
35947
+ const current = projectAnnotationSnapshot(database, projectId2, budget).snapshot;
35684
35948
  const sources = new ProjectSnapshotSources(database, budget);
35685
35949
  for (const ref3 of new Set(Object.values(bindings))) {
35686
35950
  if (ref3 === current.project.ref)
@@ -35701,7 +35965,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
35701
35965
  const names = new Set([manifest.project.key, manifest.project.name, ...manifest.aliases.map((a) => a.name)].map(normalizeVocabularyName));
35702
35966
  const namespace = /* @__PURE__ */ new Set();
35703
35967
  for (const project of projects2) {
35704
- if (project.id === projectId)
35968
+ if (project.id === projectId2)
35705
35969
  continue;
35706
35970
  const keyMatches = names.has(normalizeVocabularyName(String(project.key)));
35707
35971
  const nameMatches = project.account_id === null && project.deleted_at === null && names.has(normalizeVocabularyName(String(project.name)));
@@ -35709,7 +35973,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
35709
35973
  namespace.add(`project:${project.id}`);
35710
35974
  }
35711
35975
  for (const alias2 of aliases2) {
35712
- if (alias2.aliasable_id === projectId || alias2.account_id !== null)
35976
+ if (alias2.aliasable_id === projectId2 || alias2.account_id !== null)
35713
35977
  continue;
35714
35978
  const project = projects2.find((p) => p.id === alias2.aliasable_id && p.account_id === null && p.deleted_at === null);
35715
35979
  if (project && names.has(normalizeVocabularyName(String(alias2.name))))
@@ -35740,8 +36004,8 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
35740
36004
  };
35741
36005
  }), "previewAnnotationSnapshot");
35742
36006
 
35743
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
35744
- var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snapshot2, bindings) => {
36007
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
36008
+ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, snapshot2, bindings) => {
35745
36009
  const mappings = { ...bindings };
35746
36010
  const resolve = /* @__PURE__ */ __name((ref3) => {
35747
36011
  if (ref3 === null)
@@ -35752,14 +36016,14 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snap
35752
36016
  return thing;
35753
36017
  }, "resolve");
35754
36018
  const organization = resolve(snapshot2.project.organization), owner = resolve(snapshot2.project.owner);
35755
- database.prepare("UPDATE projects SET description=?,type=?,scope=?,organization_id=?,owner_type=?,owner_id=?,status=?,created_at=?,updated_at=? WHERE id=?").run(snapshot2.project.description, snapshot2.project.type, snapshot2.project.scope, organization?.id ?? null, owner?.type ?? null, owner?.id ?? null, snapshot2.project.status, snapshot2.project.created_at, snapshot2.project.updated_at, projectId);
36019
+ database.prepare("UPDATE projects SET description=?,type=?,scope=?,organization_id=?,owner_type=?,owner_id=?,status=?,created_at=?,updated_at=? WHERE id=?").run(snapshot2.project.description, snapshot2.project.type, snapshot2.project.scope, organization?.id ?? null, owner?.type ?? null, owner?.id ?? null, snapshot2.project.status, snapshot2.project.created_at, snapshot2.project.updated_at, projectId2);
35756
36020
  for (const alias2 of snapshot2.aliases)
35757
- database.prepare("INSERT INTO aliases(aliasable_type,aliasable_id,account_id,name,name_folded,display,source,created_at,updated_at) VALUES('project',?,NULL,?,?,?,?,?,?)").run(projectId, alias2.name, fold(alias2.name), Number(alias2.display), alias2.source, alias2.created_at, alias2.updated_at);
36021
+ database.prepare("INSERT INTO aliases(aliasable_type,aliasable_id,account_id,name,name_folded,display,source,created_at,updated_at) VALUES('project',?,NULL,?,?,?,?,?,?)").run(projectId2, alias2.name, fold(alias2.name), Number(alias2.display), alias2.source, alias2.created_at, alias2.updated_at);
35758
36022
  for (const fact of snapshot2.facts) {
35759
36023
  const author = resolve(fact.author), confirmed = resolve(fact.confirmed_by);
35760
36024
  if (!author)
35761
36025
  throw new CliError("validation_error", "project annotation author is required");
35762
- const row2 = database.prepare("INSERT INTO facts(id,type,statement,status,project_id,subject_type,subject_id,occurred_at,supersedes_id,author_type,author_id,model,confirmed_by_type,confirmed_by_id,scope,source,created_at,updated_at) VALUES(?,?,?,?,?,NULL,NULL,?,NULL,?,?,?,?,?,?,?,?,?) RETURNING id").get(nextId(database, "facts"), fact.type, fact.statement, fact.status, projectId, fact.occurred_at, author.type, author.id, fact.model, confirmed?.type ?? null, confirmed?.id ?? null, fact.scope, fact.source, fact.created_at, fact.updated_at);
36026
+ const row2 = database.prepare("INSERT INTO facts(id,type,statement,status,project_id,subject_type,subject_id,occurred_at,supersedes_id,author_type,author_id,model,confirmed_by_type,confirmed_by_id,scope,source,created_at,updated_at) VALUES(?,?,?,?,?,NULL,NULL,?,NULL,?,?,?,?,?,?,?,?,?) RETURNING id").get(nextId(database, "facts"), fact.type, fact.statement, fact.status, projectId2, fact.occurred_at, author.type, author.id, fact.model, confirmed?.type ?? null, confirmed?.id ?? null, fact.scope, fact.source, fact.created_at, fact.updated_at);
35763
36027
  if (!row2)
35764
36028
  throw new CliError("configuration_error", "project annotation fact insertion failed");
35765
36029
  mappings[fact.ref] = `fact:${row2.id}`;
@@ -35782,21 +36046,21 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snap
35782
36046
  return mappings;
35783
36047
  }, "restoreAnnotationRecords");
35784
36048
 
35785
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
36049
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
35786
36050
  var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
35787
36051
  async preview(request) {
35788
- const { snapshot: snapshot2, projectId } = projectAnnotationRequest(request);
35789
- return previewAnnotationSnapshot(database, projectId, snapshot2, request.bindings, new SnapshotBudget(request.maxReadBytes ?? 4 * 1024 * 1024));
36052
+ const { snapshot: snapshot2, projectId: projectId2 } = projectAnnotationRequest(request);
36053
+ return previewAnnotationSnapshot(database, projectId2, snapshot2, request.bindings, new SnapshotBudget(request.maxReadBytes ?? 4 * 1024 * 1024));
35790
36054
  },
35791
36055
  async restore(request) {
35792
- const { snapshot: snapshot2, projectId } = projectAnnotationRequest(request, true);
36056
+ const { snapshot: snapshot2, projectId: projectId2 } = projectAnnotationRequest(request, true);
35793
36057
  const budget = new SnapshotBudget(request.maxReadBytes ?? 4 * 1024 * 1024);
35794
36058
  try {
35795
36059
  return write(database, () => {
35796
- const preview = previewAnnotationSnapshot(database, projectId, snapshot2, request.bindings, budget);
36060
+ const preview = previewAnnotationSnapshot(database, projectId2, snapshot2, request.bindings, budget);
35797
36061
  if (!preview.ready || preview.fingerprint !== request.fingerprint)
35798
36062
  throw new CliError("validation_error", "project annotation preview is stale or has conflicts; preview again");
35799
- const mappings = restoreAnnotationRecords(database, projectId, snapshot2, request.bindings);
36063
+ const mappings = restoreAnnotationRecords(database, projectId2, snapshot2, request.bindings);
35800
36064
  return {
35801
36065
  project: request.project,
35802
36066
  fingerprint: preview.fingerprint,
@@ -35812,7 +36076,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
35812
36076
  }
35813
36077
  }), "projectAnnotationStoreOver");
35814
36078
 
35815
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
36079
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
35816
36080
  var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
35817
36081
  const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
35818
36082
  let merged = { from: from2, to };
@@ -35825,7 +36089,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
35825
36089
  }, "markRange");
35826
36090
  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");
35827
36091
 
35828
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
36092
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
35829
36093
  var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
35830
36094
  var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
35831
36095
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
@@ -35835,7 +36099,7 @@ var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) =
35835
36099
  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);
35836
36100
  }, "setTaskRulesStop");
35837
36101
 
35838
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sync.js
36102
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sync.js
35839
36103
  var syncStoreOver = /* @__PURE__ */ __name((context) => {
35840
36104
  const { database } = context;
35841
36105
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
@@ -35891,21 +36155,21 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
35891
36155
  };
35892
36156
  }, "syncStoreOver");
35893
36157
 
35894
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/tags.js
36158
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/tags.js
35895
36159
  var tagsStoreOver = /* @__PURE__ */ __name((context) => {
35896
36160
  const { database } = context;
35897
36161
  return {
35898
- addTags: /* @__PURE__ */ __name(async (key2, target, list) => {
36162
+ addTags: /* @__PURE__ */ __name(async (key2, target, list2) => {
35899
36163
  let added = [];
35900
36164
  write(database, () => {
35901
- added = addTags(context, targetThing(context, key2, target), list);
36165
+ added = addTags(context, targetThing(context, key2, target), list2);
35902
36166
  });
35903
36167
  return added;
35904
36168
  }, "addTags"),
35905
- removeTags: /* @__PURE__ */ __name(async (key2, target, list, source2) => {
36169
+ removeTags: /* @__PURE__ */ __name(async (key2, target, list2, source2) => {
35906
36170
  let removed = [];
35907
36171
  write(database, () => {
35908
- removed = removeTags(context, targetThing(context, key2, target), list, source2);
36172
+ removed = removeTags(context, targetThing(context, key2, target), list2, source2);
35909
36173
  });
35910
36174
  return removed;
35911
36175
  }, "removeTags"),
@@ -35913,7 +36177,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
35913
36177
  };
35914
36178
  }, "tagsStoreOver");
35915
36179
 
35916
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
36180
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
35917
36181
  var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
35918
36182
  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
35919
36183
  WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
@@ -36040,7 +36304,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
36040
36304
  dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
36041
36305
  }, "savePictureChunks");
36042
36306
 
36043
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
36307
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
36044
36308
  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,
36045
36309
  EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
36046
36310
  FROM messages m
@@ -36129,7 +36393,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
36129
36393
  return plain2(best(found2));
36130
36394
  }, "nearestMessages");
36131
36395
 
36132
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/vectors.js
36396
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/vectors.js
36133
36397
  var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
36134
36398
  const { database } = context;
36135
36399
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -36288,12 +36552,12 @@ var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
36288
36552
  });
36289
36553
  return cleared;
36290
36554
  }, "clearVectors"),
36291
- nearestConversations: /* @__PURE__ */ __name(async (key2, { chatId, model, since, limit, query, exclude, conversations: conversations2, scope: scope3, projectId, personId, before: before2 }) => {
36555
+ nearestConversations: /* @__PURE__ */ __name(async (key2, { chatId, model, since, limit, query, exclude, conversations: conversations2, scope: scope3, projectId: projectId2, personId, before: before2 }) => {
36292
36556
  const accountPk2 = findAccountPk2(key2);
36293
36557
  if (accountPk2 === void 0)
36294
36558
  return [];
36295
36559
  const chatKey = chatId === void 0 ? void 0 : chatKeyOf(key2, chatId);
36296
- const mailToo = key2.provider === "email" && conversations2 === void 0 && scope3 === void 0 && projectId === void 0 && personId === void 0 && before2 === void 0;
36560
+ const mailToo = key2.provider === "email" && conversations2 === void 0 && scope3 === void 0 && projectId2 === void 0 && personId === void 0 && before2 === void 0;
36297
36561
  const mailHits = /* @__PURE__ */ __name(async () => mailToo ? (await mail().nearest(model, query, {
36298
36562
  accountId: accountPk2,
36299
36563
  limit,
@@ -36316,7 +36580,7 @@ var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
36316
36580
  query,
36317
36581
  ...conversations2 === void 0 ? {} : { conversations: conversations2 },
36318
36582
  ...scope3 === void 0 ? {} : { scope: scope3 },
36319
- ...projectId === void 0 ? {} : { projectId: Number(projectId) },
36583
+ ...projectId2 === void 0 ? {} : { projectId: Number(projectId2) },
36320
36584
  ...personId === void 0 ? {} : { personId: Number(personId) },
36321
36585
  ...before2 === void 0 ? {} : { before: Date.parse(before2) }
36322
36586
  });
@@ -36387,7 +36651,7 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
36387
36651
  embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
36388
36652
  }), "vectorsStoreOver");
36389
36653
 
36390
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
36654
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
36391
36655
  import { existsSync, readFileSync as readFileSync4 } from "node:fs";
36392
36656
  import { dirname as dirname2, join as join2 } from "node:path";
36393
36657
  var BOOKKEEPING = ["schema_migrations", "store_settings"];
@@ -36475,10 +36739,10 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
36475
36739
  }
36476
36740
  }, "lastBackup");
36477
36741
 
36478
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/providers.js
36742
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/providers.js
36479
36743
  var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
36480
36744
 
36481
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
36745
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
36482
36746
  var COUNTED_TABLES = [
36483
36747
  "accounts",
36484
36748
  "chats",
@@ -36563,7 +36827,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
36563
36827
  };
36564
36828
  }, "storeContents");
36565
36829
 
36566
- // node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/store.js
36830
+ // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/store.js
36567
36831
  var openStore = /* @__PURE__ */ __name(async (options = {}) => {
36568
36832
  const context = await openStoreContext(options);
36569
36833
  try {
@@ -36816,6 +37080,7 @@ export {
36816
37080
  counterFreshness,
36817
37081
  AGENDA_COLUMNS,
36818
37082
  correctWords,
37083
+ THREAD_COLUMNS,
36819
37084
  threadConversation,
36820
37085
  messageOfEmail,
36821
37086
  resetAttachmentWords,