@wirecat/tg-cli 0.111.0 → 0.113.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-EQKEFGPB.js} +70 -50
  4. package/dist/bundle/{all-profiles-FEUSGHT7.js → all-profiles-TTBFF663.js} +8 -8
  5. package/dist/bundle/{anthropic-O646SJIJ.js → anthropic-XPZS7267.js} +5 -5
  6. package/dist/bundle/{app-server-7P23Y45A.js → app-server-ZSZ7KRAY.js} +42 -42
  7. package/dist/bundle/{bot-api-WTJCL6VF.js → bot-api-X7BOVNIO.js} +46 -46
  8. package/dist/bundle/{bot-history-5J2Q4SPC.js → bot-history-DWIUIPN5.js} +15 -15
  9. package/dist/bundle/{bun-KUKVEKDW.js → bun-ZGZVAJU2.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-2G5TXHYE.js → bun-sqlite-UN2UJ6SI.js} +4 -4
  11. package/dist/bundle/{chunk-UDYCZ5KB.js → chunk-3MAYYFKY.js} +1 -1
  12. package/dist/bundle/{chunk-3BD24JYK.js → chunk-452UZ2PU.js} +121 -95
  13. package/dist/bundle/{chunk-EB44Z44U.js → chunk-4GLMEES6.js} +1 -1
  14. package/dist/bundle/{chunk-J2Z5E7TO.js → chunk-4SQB5VKL.js} +1 -1
  15. package/dist/bundle/{chunk-BNQOUCL2.js → chunk-5NF7M4MN.js} +1 -1
  16. package/dist/bundle/{chunk-VIEVOF3O.js → chunk-6F6K3LWV.js} +11 -11
  17. package/dist/bundle/{chunk-QLLPZWYZ.js → chunk-6OKGHHRL.js} +4 -4
  18. package/dist/bundle/{chunk-QVM2HKJP.js → chunk-6WJ5M2Q4.js} +4 -4
  19. package/dist/bundle/{chunk-OYVDWHP5.js → chunk-7IWDS2CM.js} +2 -2
  20. package/dist/bundle/{chunk-ABVHA4K6.js → chunk-AGUCXSSM.js} +5 -5
  21. package/dist/bundle/{chunk-2ZH3PUQX.js → chunk-AVUIWZTP.js} +2 -2
  22. package/dist/bundle/{chunk-LLAZSGS7.js → chunk-BI5YJZJB.js} +31 -27
  23. package/dist/bundle/{chunk-COHMFCHD.js → chunk-EGR5IJCG.js} +95 -34
  24. package/dist/bundle/{chunk-7665YBJ7.js → chunk-ENXO43TV.js} +6 -6
  25. package/dist/bundle/{chunk-MSGYLWCH.js → chunk-G74QMORP.js} +2 -2
  26. package/dist/bundle/{chunk-KLHLWKWC.js → chunk-GX4LRLVD.js} +80 -60
  27. package/dist/bundle/{chunk-DREEXESG.js → chunk-HNN7EKIM.js} +114 -79
  28. package/dist/bundle/{chunk-2K6IGVSI.js → chunk-HO53POQG.js} +5 -5
  29. package/dist/bundle/{chunk-43ZFY6TW.js → chunk-IDUYRTPF.js} +2 -2
  30. package/dist/bundle/{chunk-WDRNVSWF.js → chunk-IYKRHDX6.js} +45 -44
  31. package/dist/bundle/{chunk-KE47Y4PW.js → chunk-J6USEBA6.js} +699 -379
  32. package/dist/bundle/{chunk-5ZPLOYTP.js → chunk-JDQSX2JQ.js} +453 -358
  33. package/dist/bundle/{chunk-NIKYFRDQ.js → chunk-JO45BOYE.js} +2 -2
  34. package/dist/bundle/{chunk-ONHHBPV3.js → chunk-JRTZ5I6M.js} +2 -2
  35. package/dist/bundle/{chunk-YG4BO7N3.js → chunk-JW7BMJ6O.js} +2 -2
  36. package/dist/bundle/{chunk-J4QVXR5I.js → chunk-K3F46QVN.js} +2 -2
  37. package/dist/bundle/{chunk-XXOJ7PQY.js → chunk-KK3JVOOV.js} +30 -30
  38. package/dist/bundle/{chunk-UPRYEDAV.js → chunk-KOWQVHXI.js} +3 -3
  39. package/dist/bundle/{chunk-BWRCPMMC.js → chunk-KQ23JWLJ.js} +20 -18
  40. package/dist/bundle/{chunk-ZCV4UEVH.js → chunk-KVLCIZUK.js} +3 -3
  41. package/dist/bundle/{chunk-DEG4JJHG.js → chunk-MTX5EDYJ.js} +813 -542
  42. package/dist/bundle/{chunk-UFIUMPXP.js → chunk-OC4RRFKH.js} +4 -4
  43. package/dist/bundle/{chunk-PNUHAHTF.js → chunk-OQR442B6.js} +1 -1
  44. package/dist/bundle/{chunk-TWZTQHP6.js → chunk-OSBAISA5.js} +6 -6
  45. package/dist/bundle/{chunk-UIPT6IAU.js → chunk-OYNSFQ7K.js} +1 -1
  46. package/dist/bundle/{chunk-EO563SUX.js → chunk-PCRLXJRH.js} +11 -7
  47. package/dist/bundle/{chunk-XIRASTVS.js → chunk-PHPNA2HU.js} +11 -11
  48. package/dist/bundle/{chunk-7GQLD5TJ.js → chunk-PHYDBR5M.js} +2 -2
  49. package/dist/bundle/{chunk-T6DSAROY.js → chunk-Q264PYGE.js} +51 -14
  50. package/dist/bundle/{chunk-QEAMO2TS.js → chunk-T4TTRFP5.js} +7 -7
  51. package/dist/bundle/{chunk-UMUJHC4M.js → chunk-T5RM4Y35.js} +3 -3
  52. package/dist/bundle/{chunk-ITSSCYLP.js → chunk-TQ6EA7TB.js} +11 -11
  53. package/dist/bundle/{chunk-QAC6Z675.js → chunk-TUD4MU7S.js} +2 -2
  54. package/dist/bundle/{chunk-ZCHC7TYO.js → chunk-U3MJQLZQ.js} +26 -13
  55. package/dist/bundle/{chunk-YFK3DNNP.js → chunk-UE75KPAC.js} +4 -4
  56. package/dist/bundle/{chunk-HN6ZMUAS.js → chunk-UIVLDKWT.js} +1 -1
  57. package/dist/bundle/{chunk-3WUTBGZE.js → chunk-VDATXIO4.js} +6 -6
  58. package/dist/bundle/{chunk-AUWYMMYL.js → chunk-VDEXNNMH.js} +4 -4
  59. package/dist/bundle/{chunk-33HEHPIK.js → chunk-VVA4555T.js} +8 -8
  60. package/dist/bundle/{chunk-PQGWEFJ2.js → chunk-WSAHUQ6K.js} +3 -3
  61. package/dist/bundle/{chunk-K457FHD4.js → chunk-XXNJF3ZM.js} +32 -26
  62. package/dist/bundle/{chunk-NQAV7U7C.js → chunk-XZ2ZHIAO.js} +1 -1
  63. package/dist/bundle/{chunk-5FJQG5UZ.js → chunk-Z6TRIW2O.js} +8 -8
  64. package/dist/bundle/{chunk-CJUSP5X2.js → chunk-ZID2Y4XU.js} +2 -2
  65. package/dist/bundle/command-contract-GV67H22L.js +32 -0
  66. package/dist/bundle/{decode-QJNVAAKJ.js → decode-AMQVTEMW.js} +4 -4
  67. package/dist/bundle/{echarts-2EDY7OUX.js → echarts-ECYONFQJ.js} +2 -2
  68. package/dist/bundle/{embed-PZSXOQJO.js → embed-VZYBZEWI.js} +5 -5
  69. package/dist/bundle/{embedder-O4EGMMUU.js → embedder-GSWBGHRK.js} +8 -8
  70. package/dist/bundle/{entry-DVLMQM6J.js → entry-LALZILY4.js} +5 -5
  71. package/dist/bundle/{first-run-J67KTUWA.js → first-run-LEAI623Q.js} +9 -9
  72. package/dist/bundle/first-screen-MOCVLE23.js +30 -0
  73. package/dist/bundle/{identity-DSYY4FLQ.js → identity-54HA5GN6.js} +3 -3
  74. package/dist/bundle/{instructions-O535XB2L.js → instructions-AXLQQS3G.js} +1 -1
  75. package/dist/bundle/{mcp-EMNFFY4N.js → mcp-VVMPUDSL.js} +2 -2
  76. package/dist/bundle/{node-S3VEQNTE.js → node-7JHC5K77.js} +2 -2
  77. package/dist/bundle/{node-sqlite-3DNWF2BW.js → node-sqlite-LYJEK46T.js} +4 -4
  78. package/dist/bundle/{oauth-IU2RAZ3D.js → oauth-BROPKI3K.js} +6 -6
  79. package/dist/bundle/{open-M2IPPXMI.js → open-C6XQ46JK.js} +3 -3
  80. package/dist/bundle/{openai-GDI7HISL.js → openai-VWSU7ZDD.js} +13 -13
  81. package/dist/bundle/{process-3IGMEATV.js → process-QKEFL5HL.js} +1 -1
  82. package/dist/bundle/{program-P7YPHVLD.js → program-ACY7O33O.js} +48 -48
  83. package/dist/bundle/{prompt-S6R7IHDK.js → prompt-EGULVW2F.js} +4 -4
  84. package/dist/bundle/{proxy-transport-OROEVBCG.js → proxy-transport-KIMADLQ2.js} +4 -4
  85. package/dist/bundle/{recognize-PFZRQ3P4.js → recognize-UMTKLWVR.js} +3 -3
  86. package/dist/bundle/{remote-Q37V7LUX.js → remote-DABI7PSQ.js} +6 -6
  87. package/dist/bundle/{rerank-V5YQQQAM.js → rerank-ZFATWWBE.js} +6 -6
  88. package/dist/bundle/{serve-5CAD2UVG.js → serve-B7YYCMGN.js} +8 -8
  89. package/dist/bundle/{server-R6YAO2SG.js → server-DGKZISZH.js} +32 -32
  90. package/dist/bundle/server-UC7UWUIS.js +56 -0
  91. package/dist/bundle/{state-Y3A2NEM3.js → state-AQ2PABA5.js} +5 -5
  92. package/dist/bundle/{store-H5K32CNI.js → store-46GJTFLJ.js} +12 -10
  93. package/dist/bundle/store-maintenance-command-FCFKHGRM.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-HPXYN7F3.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-HNN7EKIM.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-VVA4555T.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-VDATXIO4.js";
82
83
  import {
83
84
  storePath
84
- } from "./chunk-7GQLD5TJ.js";
85
+ } from "./chunk-PHYDBR5M.js";
85
86
  import {
86
87
  PRAGMAS,
87
88
  quietSqliteWarning,
88
89
  storeCapable
89
- } from "./chunk-TWZTQHP6.js";
90
+ } from "./chunk-OSBAISA5.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-UIVLDKWT.js";
115
116
  import {
116
117
  singleLine
117
- } from "./chunk-BWRCPMMC.js";
118
+ } from "./chunk-KQ23JWLJ.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-PCRLXJRH.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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/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.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/domain/attachments.js
13635
13638
  var NOT_FILES = /* @__PURE__ */ new Set([
13636
13639
  "webpage",
13637
13640
  "share",
@@ -13642,6 +13645,14 @@ var NOT_FILES = /* @__PURE__ */ new Set([
13642
13645
  "call",
13643
13646
  "inline_keyboard"
13644
13647
  ]);
13648
+ var hitFiles = /* @__PURE__ */ __name((attachments2) => (attachments2 ?? []).flatMap(({ kind: kind3, name, size: size2 }, index2) => NOT_FILES.has(kind3) ? [] : [
13649
+ {
13650
+ position: index2 + 1,
13651
+ kind: kind3,
13652
+ ...name === void 0 ? {} : { name },
13653
+ ...size2 === void 0 ? {} : { size: size2 }
13654
+ }
13655
+ ]), "hitFiles");
13645
13656
  var storedKinds = /* @__PURE__ */ __name((kind3) => kind3 === "file" ? ["file", "document"] : [kind3], "storedKinds");
13646
13657
  var matchDownloads = /* @__PURE__ */ __name((stored3, files2) => {
13647
13658
  const byPosition = new Map(stored3.map((one) => [one.position, one]));
@@ -13663,7 +13674,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored3, files2) => {
13663
13674
  });
13664
13675
  }, "matchDownloads");
13665
13676
 
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
13677
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
13667
13678
  var QUERY_VERSION = 1;
13668
13679
  var QUERY_LIMITS2 = {
13669
13680
  ...QUERY_LIMITS,
@@ -13694,7 +13705,7 @@ function exhausted(budget) {
13694
13705
  }
13695
13706
  __name(exhausted, "exhausted");
13696
13707
 
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
13708
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
13698
13709
  var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
13699
13710
  var literal2 = /* @__PURE__ */ __name((c) => ({
13700
13711
  kind: "char",
@@ -14094,7 +14105,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
14094
14105
  return out;
14095
14106
  }, "foldRegex");
14096
14107
 
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
14108
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
14098
14109
  var PRESET_VERSION = 1;
14099
14110
  var PRESETS = {
14100
14111
  password: {
@@ -14148,7 +14159,7 @@ var PRESETS = {
14148
14159
  }
14149
14160
  };
14150
14161
 
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
14162
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
14152
14163
  var FIELD_VERSION = 2;
14153
14164
  var UNITS = {
14154
14165
  "": 1,
@@ -14271,6 +14282,17 @@ var QUERY_FIELDS = [
14271
14282
  normalization: "the same as mailbox:; mail only",
14272
14283
  support: "A1"
14273
14284
  },
14285
+ {
14286
+ name: "list",
14287
+ example: "list:github.com",
14288
+ index: "emails.headers list-id",
14289
+ aliases: [],
14290
+ type: "kw",
14291
+ operators: terms,
14292
+ normalization: "the List-Id of a mailing list, lower case; a domain matches every list under it; mail only",
14293
+ support: "A1",
14294
+ validate: filled
14295
+ },
14274
14296
  {
14275
14297
  name: "is",
14276
14298
  example: "is:unread",
@@ -14597,12 +14619,12 @@ var validateAst = /* @__PURE__ */ __name((input) => {
14597
14619
  return validateFields(parsed2.output);
14598
14620
  }, "validateAst");
14599
14621
 
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
14622
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
14601
14623
  var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
14602
14624
  var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
14603
14625
  var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
14604
14626
 
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
14627
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
14606
14628
  var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
14607
14629
  var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
14608
14630
  var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
@@ -14626,7 +14648,7 @@ var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
14626
14648
  };
14627
14649
  }, "linkMatch");
14628
14650
 
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
14651
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
14630
14652
  var SETTING = "phoneCountries";
14631
14653
  var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
14632
14654
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
@@ -14657,7 +14679,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
14657
14679
  return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
14658
14680
  }, "valueMatch");
14659
14681
 
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
14682
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/domain/locator.js
14661
14683
  var SCHEME = "msg:";
14662
14684
  var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat: chat2, message: message2 }) => SCHEME + [provider, account, chat2, message2].map(encodeURIComponent).join("/"), "formatLocator");
14663
14685
  var isLocator = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith(SCHEME), "isLocator");
@@ -14671,7 +14693,7 @@ var parseLocator = /* @__PURE__ */ __name((reference2) => {
14671
14693
  return { provider, account, chat: chat2, message: message2 };
14672
14694
  }, "parseLocator");
14673
14695
 
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
14696
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
14675
14697
  var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
14676
14698
  if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
14677
14699
  throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
@@ -14699,7 +14721,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
14699
14721
  return 2 * intersection2 / (aa2.size + bb.size);
14700
14722
  }, "vocabularySimilarity");
14701
14723
 
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
14724
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
14703
14725
  import { createHash } from "node:crypto";
14704
14726
  var folded2 = /* @__PURE__ */ __name((name) => {
14705
14727
  try {
@@ -14765,7 +14787,7 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind3, by, options
14765
14787
  });
14766
14788
  }, "guardTagCreation");
14767
14789
 
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
14790
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
14769
14791
  var invalid2 = /* @__PURE__ */ __name((message2) => {
14770
14792
  throw new CliError("validation_error", message2);
14771
14793
  }, "invalid");
@@ -14842,7 +14864,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
14842
14864
  };
14843
14865
  }, "createTagRedirectIndex");
14844
14866
 
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
14867
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
14846
14868
  var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
14847
14869
  const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
14848
14870
  if (!row2)
@@ -14870,7 +14892,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
14870
14892
  return snapshot2;
14871
14893
  }, "tagRedirectSnapshot");
14872
14894
 
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
14895
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
14874
14896
  import { createHash as createHash2 } from "node:crypto";
14875
14897
  var TASK_KEY_PREFIXES = {
14876
14898
  question: "Q",
@@ -14898,7 +14920,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
14898
14920
  return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
14899
14921
  }, "taskAccountOf");
14900
14922
 
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
14923
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/domain/references.js
14902
14924
  var SIMPLE_REFERENCES = [
14903
14925
  "note",
14904
14926
  "document",
@@ -14970,7 +14992,7 @@ var folderPath = /* @__PURE__ */ __name((path) => {
14970
14992
  }, "folderPath");
14971
14993
  var canonicalReference = /* @__PURE__ */ __name((text5) => formatReference(parseReference(text5)), "canonicalReference");
14972
14994
 
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
14995
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
14974
14996
  var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
14975
14997
  var REFERABLE = {
14976
14998
  note: { tombstone: true },
@@ -15120,7 +15142,10 @@ var stateOfThing = /* @__PURE__ */ __name((database, thing) => {
15120
15142
  }, "stateOfThing");
15121
15143
  var taskRowOf = /* @__PURE__ */ __name((database, id2) => {
15122
15144
  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;
15145
+ if (row2)
15146
+ return Number(row2.id);
15147
+ 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);
15148
+ return moved ? Number(moved.task_id) : void 0;
15124
15149
  }, "taskRowOf");
15125
15150
  var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
15126
15151
  const row2 = database.prepare("SELECT key, package_id AS id FROM tasks WHERE id = ?").get(rowId);
@@ -15128,7 +15153,7 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
15128
15153
  }, "taskIdOf");
15129
15154
  var canonicalThingReference = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith("meeting:") ? canonicalMeetingReference(reference2) : canonicalReference(reference2), "canonicalThingReference");
15130
15155
 
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
15156
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
15132
15157
  var toMs = /* @__PURE__ */ __name((iso11) => {
15133
15158
  if (iso11 === null || iso11 === void 0)
15134
15159
  return null;
@@ -15142,7 +15167,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
15142
15167
  var DELIVERY = { delivered: 1, read: 2 };
15143
15168
  var deliveryOf = /* @__PURE__ */ __name((stored3) => stored3 === DELIVERY.read ? "read" : stored3 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
15144
15169
 
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
15170
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
15146
15171
  var TAG_KINDS = ["tag", "topic"];
15147
15172
  var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
15148
15173
  var TAG_TYPE = {
@@ -15345,7 +15370,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
15345
15370
  return result;
15346
15371
  }, "tagsOf");
15347
15372
 
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
15373
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
15349
15374
  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
15375
  var SPEECH = speech("att");
15351
15376
  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 +15669,11 @@ var mailbox = /* @__PURE__ */ __name(({ value }, { mail }) => always(mail ? boun
15644
15669
  value,
15645
15670
  fold(value)
15646
15671
  ) : bound("0")), "mailbox");
15672
+ var list = /* @__PURE__ */ __name(({ value }, { mail }) => {
15673
+ const wanted = value.trim().toLowerCase();
15674
+ return always(mail ? bound(`m.id IN (SELECT id FROM (SELECT id, coalesce(json_extract(headers, '$."list-id"'),
15675
+ json_extract(metadata, '$.listId')) AS list_id FROM emails) WHERE list_id = ? OR list_id LIKE '%.' || ? ESCAPE '\\')`, wanted, wanted.replace(/[\\%_]/g, "\\$&")) : bound("0"));
15676
+ }, "list");
15647
15677
  var is2 = /* @__PURE__ */ __name(({ value }, { mail }) => {
15648
15678
  const state = value.toLowerCase();
15649
15679
  return always(state === "starred" ? bound(mail ? "m.flagged = 1" : "m.starred = 1") : !mail ? bound("0") : bound("m.read = ?", state === "read" ? 1 : 0));
@@ -15696,11 +15726,12 @@ var FIELD_COMPILERS = {
15696
15726
  source: notesOnly,
15697
15727
  mailbox,
15698
15728
  label: mailbox,
15729
+ list,
15699
15730
  is: is2,
15700
15731
  subject
15701
15732
  };
15702
15733
 
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
15734
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
15704
15735
  var placeOf = /* @__PURE__ */ __name((database) => {
15705
15736
  const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
15706
15737
  const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
@@ -15716,7 +15747,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
15716
15747
  };
15717
15748
  }, "placeOf");
15718
15749
 
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
15750
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
15720
15751
  var DRAIN_ON_WRITE = 500;
15721
15752
  var METHOD = "rules";
15722
15753
  var telegramLink = /* @__PURE__ */ __name((database) => {
@@ -15879,7 +15910,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
15879
15910
  return queued.length;
15880
15911
  }, "drainMentions");
15881
15912
 
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
15913
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
15883
15914
  var indexRow = /* @__PURE__ */ __name((database, name) => {
15884
15915
  const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
15885
15916
  if (!exists2)
@@ -15887,7 +15918,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
15887
15918
  return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
15888
15919
  }, "indexRow");
15889
15920
 
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
15921
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
15891
15922
  var INDEX = "message_stems";
15892
15923
  var SETTING2 = "searchStemmers";
15893
15924
  var DRAIN_ON_WRITE2 = 500;
@@ -16009,7 +16040,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
16009
16040
  };
16010
16041
  }, "stemmerCache");
16011
16042
 
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
16043
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
16013
16044
  var SQLITE_BUSY = 5;
16014
16045
  var pause = new Int32Array(new SharedArrayBuffer(4));
16015
16046
  var isBusy = /* @__PURE__ */ __name((error) => {
@@ -16104,7 +16135,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
16104
16135
  }
16105
16136
  }, "read");
16106
16137
 
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
16138
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
16108
16139
  var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
16109
16140
  coalesce(CASE k.chunkable_type
16110
16141
  WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
@@ -16246,7 +16277,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
16246
16277
  }, "dropUnusedVectors");
16247
16278
  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
16279
 
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
16280
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
16250
16281
  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
16282
  target: [accounts.provider, accounts.externalId],
16252
16283
  set: {
@@ -16352,7 +16383,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
16352
16383
  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
16384
  }, "dropOrphanPeople");
16354
16385
 
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
16386
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
16356
16387
  var FOLDED = [
16357
16388
  { table: "tasks", column: "title" },
16358
16389
  { table: "tasks", column: "close_reason" },
@@ -16389,7 +16420,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
16389
16420
  return filled2;
16390
16421
  }, "fillFolded");
16391
16422
 
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
16423
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
16393
16424
  import { createHash as createHash3 } from "node:crypto";
16394
16425
  var CHUNK_CHARS = 1200;
16395
16426
  var CHUNK_OVERLAP = 150;
@@ -16494,7 +16525,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
16494
16525
  return chunks2;
16495
16526
  }, "cutChunks");
16496
16527
 
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
16528
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/search/task-signature.js
16498
16529
  var DAY = 864e5;
16499
16530
  var CURRENCY = [
16500
16531
  [/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
@@ -16611,7 +16642,7 @@ var dueDayOf = /* @__PURE__ */ __name((text5, createdMs) => {
16611
16642
  return best?.day ?? null;
16612
16643
  }, "dueDayOf");
16613
16644
 
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
16645
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
16615
16646
  var DAY2 = 864e5;
16616
16647
  var STOP_WORDS = new Set([
16617
16648
  // Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
@@ -16766,7 +16797,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
16766
16797
  ...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
16767
16798
  })).sort((a, b) => b.score - a.score), "rankCandidates");
16768
16799
 
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
16800
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
16770
16801
  var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
16771
16802
  r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
16772
16803
  JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
@@ -16897,7 +16928,7 @@ var dot = /* @__PURE__ */ __name((query, blob2) => {
16897
16928
  }, "dot");
16898
16929
  var nearestChunks = /* @__PURE__ */ __name((context, accountPk2, filter) => {
16899
16930
  const { orm } = context;
16900
- const { chatKey, model, since, limit, query, exclude, conversations: conversations2, scope: scope3, projectId, before: before2, personId } = filter;
16931
+ const { chatKey, model, since, limit, query, exclude, conversations: conversations2, scope: scope3, projectId: projectId2, before: before2, personId } = filter;
16901
16932
  const rows = /* @__PURE__ */ __name((page3) => orm.all(
16902
16933
  // CROSS JOIN keeps the chunks first, so each page walks their key; led by the vectors, SQLite re-read and
16903
16934
  // sorted every one of them per page — 1.3 s against 140 ms at 42k chunks (bench/embeddings/README.md).
@@ -16910,7 +16941,7 @@ var nearestChunks = /* @__PURE__ */ __name((context, accountPk2, filter) => {
16910
16941
  JOIN embeddings v ON v.model = ${model} AND v.content_hash = k.content_hash
16911
16942
  WHERE k.chunkable_type = 'conversation' AND ch.account_id = ${accountPk2}
16912
16943
  ${scope3 === void 0 ? sql`` : sql`AND k.scope=${scope3}`}
16913
- ${projectId === void 0 ? sql`` : sql`AND k.project_id=${projectId}`}
16944
+ ${projectId2 === void 0 ? sql`` : sql`AND k.project_id=${projectId2}`}
16914
16945
  ${before2 === void 0 ? sql`` : sql`AND k.occurred_at < ${before2}`}
16915
16946
  ${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
16947
  ${chatKey === void 0 ? sql`AND ch.searchable = 1` : sql`AND c.chat_id = ${chatKey}`}
@@ -16939,7 +16970,7 @@ var nearestChunks = /* @__PURE__ */ __name((context, accountPk2, filter) => {
16939
16970
  }, "keepBest");
16940
16971
  const ranked = /* @__PURE__ */ __name((found2) => found2.sort((a, b) => b.score - a.score).slice(0, limit), "ranked");
16941
16972
  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;
16973
+ const indexable = personId === void 0 && projectId2 === void 0 && scope3 === void 0 && conversations2 === void 0;
16943
16974
  const indexed = indexable && searchIndex(context.database, model, {
16944
16975
  kind: "conversation",
16945
16976
  account: accountPk2,
@@ -17037,7 +17068,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
17037
17068
  };
17038
17069
  }, "readiness");
17039
17070
 
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
17071
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
17041
17072
  var DOCUMENT_PICTURE = "document_picture";
17042
17073
  var SCAN_PAGE2 = 5e3;
17043
17074
  var idOf = /* @__PURE__ */ __name((ref3) => {
@@ -17100,7 +17131,7 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
17100
17131
  }, "nearestPictures")
17101
17132
  }), "documentPicturesOver");
17102
17133
 
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
17134
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
17104
17135
  var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
17105
17136
  const literal4 = escaped2 ?? plain2 ?? "";
17106
17137
  return wildcard ?? (/[*?[]/u.test(literal4) ? `[${literal4}]` : literal4);
@@ -17165,7 +17196,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
17165
17196
  var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
17166
17197
  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
17198
 
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
17199
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
17169
17200
  var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
17170
17201
  var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
17171
17202
  var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
@@ -17255,7 +17286,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
17255
17286
  });
17256
17287
  }, "linkMeeting");
17257
17288
 
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
17289
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
17259
17290
  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
17291
  var UNSEARCHED_EVENT_TYPES = [
17261
17292
  "working-location",
@@ -17485,7 +17516,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
17485
17516
  return true;
17486
17517
  }, "resetNoteIndex");
17487
17518
 
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
17519
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
17489
17520
  var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
17490
17521
  var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
17491
17522
  for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
@@ -17504,7 +17535,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
17504
17535
  }
17505
17536
  }, "resolvePersonLinks");
17506
17537
 
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
17538
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
17508
17539
  var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
17509
17540
  var prepare = /* @__PURE__ */ __name((orm) => ({
17510
17541
  find: orm.select({
@@ -17729,7 +17760,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
17729
17760
  }, "meetingIdentityPk");
17730
17761
  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
17762
 
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
17763
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
17733
17764
  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
17765
  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
17766
  var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
@@ -18009,7 +18040,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
18009
18040
  }
18010
18041
  }, "replaceAutoTags");
18011
18042
 
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
18043
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/domain/counters.js
18013
18044
  var COUNTER_FIELDS = ["views", "reactions", "comments"];
18014
18045
  var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
18015
18046
  var counterValue = /* @__PURE__ */ __name((message2, field4) => {
@@ -18046,7 +18077,7 @@ var counterFreshness = /* @__PURE__ */ __name((states) => {
18046
18077
  return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
18047
18078
  }, "counterFreshness");
18048
18079
 
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
18080
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
18050
18081
  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
18082
  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
18083
  var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
@@ -18127,7 +18158,7 @@ var mailCore = /* @__PURE__ */ __name((body2, earlier) => {
18127
18158
  return withoutSignOff(withoutGreeting(kept)).join("\n").trim();
18128
18159
  }, "mailCore");
18129
18160
 
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
18161
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
18131
18162
  var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
18132
18163
  var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
18133
18164
  k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
@@ -18237,7 +18268,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
18237
18268
  return emails3 + threads;
18238
18269
  }, "drainEmailIndex");
18239
18270
 
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
18271
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
18241
18272
  var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
18242
18273
  SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
18243
18274
  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 +18314,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
18283
18314
  leave.run(emailId, Number(box.id), emailId, Number(box.id));
18284
18315
  }, "forgetLocations");
18285
18316
 
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
18317
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
18287
18318
  var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
18288
18319
  emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
18289
18320
  last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
@@ -18333,7 +18364,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
18333
18364
  return threads.length;
18334
18365
  }, "markEmailsRestored");
18335
18366
 
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
18367
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
18337
18368
  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
18369
  var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
18339
18370
  var ruleOf = /* @__PURE__ */ __name((row2) => ({
@@ -18400,7 +18431,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
18400
18431
  }
18401
18432
  }), "mailRulesOver");
18402
18433
 
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
18434
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
18404
18435
  var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
18405
18436
  database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
18406
18437
  VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
@@ -18408,7 +18439,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
18408
18439
  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
18440
  }, "reviewLink");
18410
18441
 
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
18442
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
18412
18443
  function checkMeetingCancelled(signal) {
18413
18444
  if (!signal?.aborted)
18414
18445
  return;
@@ -18419,7 +18450,7 @@ function checkMeetingCancelled(signal) {
18419
18450
  }
18420
18451
  __name(checkMeetingCancelled, "checkMeetingCancelled");
18421
18452
 
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
18453
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
18423
18454
  var meetingOf = /* @__PURE__ */ __name((row2) => ({
18424
18455
  id: Number(row2.id),
18425
18456
  accountId: Number(row2.account_id),
@@ -18469,7 +18500,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
18469
18500
  createdAt: Number(row2.created_at)
18470
18501
  }), "transcriptRowOf");
18471
18502
 
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
18503
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
18473
18504
  var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
18474
18505
  var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
18475
18506
  var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
@@ -18636,7 +18667,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
18636
18667
  }
18637
18668
  }), "meetingReadsOver");
18638
18669
 
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
18670
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
18640
18671
  var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
18641
18672
  const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
18642
18673
  const params = [input.accountId];
@@ -18679,7 +18710,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
18679
18710
  return { clauses, params };
18680
18711
  }, "meetingSelectionSql");
18681
18712
 
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
18713
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
18683
18714
  var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
18684
18715
  async meetingChatLines(input) {
18685
18716
  checkMeetingCancelled(input.signal);
@@ -18707,7 +18738,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
18707
18738
  }
18708
18739
  }), "meetingChatLinesOver");
18709
18740
 
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
18741
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
18711
18742
  var MESSAGE_FIELDS = {
18712
18743
  pk: messages.id,
18713
18744
  nativeId: messages.externalId,
@@ -18874,7 +18905,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
18874
18905
  storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
18875
18906
  }), "chatActivity");
18876
18907
 
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
18908
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
18878
18909
  var HIT_FIELDS = {
18879
18910
  ...MESSAGE_FIELDS,
18880
18911
  chatTitle: sql`${chats.title}`.as("chat_title"),
@@ -18973,7 +19004,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
18973
19004
  };
18974
19005
  }, "directReplies");
18975
19006
 
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
19007
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
18977
19008
  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
19009
  var required = /* @__PURE__ */ __name((context, ref3) => {
18979
19010
  const found2 = identityRow(context, ref3);
@@ -19104,7 +19135,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
19104
19135
  }, "mentioning");
19105
19136
  var escaped = /* @__PURE__ */ __name((text5) => text5.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
19106
19137
 
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
19138
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
19108
19139
  var missing2 = /* @__PURE__ */ __name(() => {
19109
19140
  throw new CliError("not_found", "Meeting, participant or selected target not found");
19110
19141
  }, "missing");
@@ -19226,7 +19257,7 @@ function meetingContextLinksOver(context) {
19226
19257
  }
19227
19258
  __name(meetingContextLinksOver, "meetingContextLinksOver");
19228
19259
 
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
19260
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
19230
19261
  var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
19231
19262
  var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
19232
19263
  var summaryOf = /* @__PURE__ */ __name((row2) => ({
@@ -19255,7 +19286,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
19255
19286
  return row2 ? summaryText(summaryOf(row2)) : null;
19256
19287
  }, "indexedText");
19257
19288
 
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
19289
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
19259
19290
  var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
19260
19291
  var meetingCurrentIndexRows = `
19261
19292
  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 +19317,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
19286
19317
  }, "invalidateMeetingStems");
19287
19318
  var meetingStemmableText = /* @__PURE__ */ __name((text5) => text5.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
19288
19319
 
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
19320
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
19290
19321
  function meetingHitIndexOver({ database, now: now2 }) {
19291
19322
  return {
19292
19323
  async indexSearch(original) {
@@ -19354,10 +19385,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
19354
19385
  }
19355
19386
  __name(meetingHitIndexOver, "meetingHitIndexOver");
19356
19387
 
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
19388
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19358
19389
  import { createHash as createHash4 } from "node:crypto";
19359
19390
 
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
19391
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/search/trigrams.js
19361
19392
  var trigrams = /* @__PURE__ */ __name((term) => {
19362
19393
  const padded = ` ${term} `;
19363
19394
  const pieces = /* @__PURE__ */ new Set();
@@ -19366,7 +19397,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
19366
19397
  return [...pieces];
19367
19398
  }, "trigrams");
19368
19399
 
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
19400
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/search/correct.js
19370
19401
  var SHORTEST_CORRECTION = 3;
19371
19402
  var maxEdits = /* @__PURE__ */ __name((word) => word.length <= 4 ? 1 : 2, "maxEdits");
19372
19403
  var editDistance = /* @__PURE__ */ __name((a, b, max) => {
@@ -19413,7 +19444,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
19413
19444
  return corrections;
19414
19445
  }, "correctWords");
19415
19446
 
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
19447
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/search/garbled.js
19417
19448
  var SHORTEST_GARBLED = 4;
19418
19449
  var MOST_WIDENED = 64;
19419
19450
  var plain = /* @__PURE__ */ __name((word) => word.replaceAll("\u044D", "\u0435"), "plain");
@@ -19505,7 +19536,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
19505
19536
  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
19537
  }, "widenWords");
19507
19538
 
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
19539
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
19509
19540
  import { readFileSync } from "node:fs";
19510
19541
  var loaded;
19511
19542
  var dictionary = /* @__PURE__ */ __name(() => {
@@ -19564,7 +19595,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word) => {
19564
19595
  return false;
19565
19596
  }, "knownRussianWord");
19566
19597
 
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
19598
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
19568
19599
  var WORD3 = /[\p{L}\p{N}\p{M}]+/gu;
19569
19600
  var MOST_WORDS = 128;
19570
19601
  var quote = /* @__PURE__ */ __name((word) => `"${word.replaceAll('"', '""')}"`, "quote");
@@ -19791,7 +19822,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text5, stemmer) => {
19791
19822
  return check3(tree);
19792
19823
  }, "matchMeetingText");
19793
19824
 
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
19825
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
19795
19826
  var fail3 = /* @__PURE__ */ __name((message2) => {
19796
19827
  throw new CliError("validation_error", message2);
19797
19828
  }, "fail");
@@ -19968,7 +19999,7 @@ function meetingHitSearchOver({ database }) {
19968
19999
  }
19969
20000
  __name(meetingHitSearchOver, "meetingHitSearchOver");
19970
20001
 
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
20002
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
19972
20003
  import { createHash as createHash5 } from "node:crypto";
19973
20004
  var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
19974
20005
  if (value === void 0)
@@ -20058,7 +20089,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
20058
20089
  }
20059
20090
  }), "meetingParticipantSearchOver");
20060
20091
 
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
20092
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
20062
20093
  var preparationQueries = {
20063
20094
  participants: {
20064
20095
  fields: "p.id, p.identity_id, p.display_name, l.person_id",
@@ -20108,7 +20139,7 @@ var preparationQueries = {
20108
20139
  }
20109
20140
  };
20110
20141
 
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
20142
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
20112
20143
  var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
20113
20144
  async preparationContext(original) {
20114
20145
  const input = validateMeetingPreparationContext(original);
@@ -20149,7 +20180,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
20149
20180
  }
20150
20181
  }), "meetingPreparationContextOver");
20151
20182
 
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
20183
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
20153
20184
  var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
20154
20185
  SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
20155
20186
  WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
@@ -20163,7 +20194,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
20163
20194
  JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
20164
20195
  )`, "preparationSubjects");
20165
20196
 
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
20197
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
20167
20198
  var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
20168
20199
  async preparationKnowledge(original) {
20169
20200
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -20208,7 +20239,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
20208
20239
  }
20209
20240
  }), "meetingPreparationKnowledgeOver");
20210
20241
 
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
20242
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
20212
20243
  var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
20213
20244
  async preparationNotes(original) {
20214
20245
  const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
@@ -20261,7 +20292,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
20261
20292
  }
20262
20293
  }), "meetingPreparationNotesOver");
20263
20294
 
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
20295
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
20265
20296
  var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20266
20297
  async relatedHistory(original) {
20267
20298
  const input = validateMeetingRelatedHistory(original);
@@ -20332,7 +20363,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20332
20363
  }
20333
20364
  }), "meetingRelatedHistoryOver");
20334
20365
 
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
20366
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
20336
20367
  var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
20337
20368
  var text2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
20338
20369
  var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
@@ -20413,7 +20444,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
20413
20444
  }
20414
20445
  }), "meetingReviewOver");
20415
20446
 
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
20447
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
20417
20448
  var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
20418
20449
  var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
20419
20450
  if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
@@ -20467,7 +20498,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
20467
20498
  }
20468
20499
  }), "meetingSeriesHistoryOver");
20469
20500
 
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
20501
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
20471
20502
  var MOST_ROWS = 5e5;
20472
20503
  var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
20473
20504
  async meetingStats(input) {
@@ -20514,7 +20545,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
20514
20545
  }
20515
20546
  }), "meetingStatsOver");
20516
20547
 
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
20548
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
20518
20549
  var CURSOR_KEY = "meetings";
20519
20550
  var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
20520
20551
  id: Number(row2.id),
@@ -20943,17 +20974,18 @@ var search = /* @__PURE__ */ __name((database, query, filter) => {
20943
20974
  const picked = filtered(filter);
20944
20975
  const rows = database.prepare(`WITH hit AS (SELECT rowid AS r FROM meeting_words WHERE meeting_words MATCH ?),
20945
20976
  picked AS (SELECT id, row_number() OVER (ORDER BY coalesce(started_at, 0) DESC, id) AS n FROM (${picked.sql}))
20946
- SELECT p.n, 0 AS kind, t.id AS a, r.position AS b, r.id, t.meeting_id, r.start_ms, coalesce(length(CAST(r.text AS BLOB)),0) AS bytes
20977
+ SELECT p.n, 0 AS kind, t.id AS a, r.position AS b, r.id, t.meeting_id, r.start_ms, coalesce(length(CAST(r.text AS BLOB)),0) AS bytes,
20978
+ r.speaker_name AS speaker, m.account_id
20947
20979
  FROM hit h JOIN meeting_transcript_rows r ON h.r % 4 = 1 AND r.id = h.r / 4
20948
20980
  JOIN meeting_transcripts t ON t.id = r.meeting_transcript_id
20949
20981
  AND t.superseded_at IS NULL AND t.deleted_at IS NULL
20950
- JOIN picked p ON p.id = t.meeting_id
20982
+ JOIN picked p ON p.id = t.meeting_id JOIN meetings m ON m.id = t.meeting_id
20951
20983
  UNION ALL
20952
- SELECT p.n, 1, c.id, 0, c.id, c.meeting_id, NULL, coalesce(length(CAST(c.text AS BLOB)),0)
20984
+ SELECT p.n, 1, c.id, 0, c.id, c.meeting_id, NULL, coalesce(length(CAST(c.text AS BLOB)),0), NULL, NULL
20953
20985
  FROM hit h JOIN meeting_chat_messages c ON h.r % 4 = 2 AND c.id = h.r / 4
20954
20986
  JOIN picked p ON p.id = c.meeting_id
20955
20987
  UNION ALL
20956
- SELECT p.n, 2, s.id, 0, s.id, s.meeting_id, NULL, coalesce(length(CAST(s.title AS BLOB)),0)+coalesce(length(CAST(s.overview AS BLOB)),0)+coalesce(length(CAST(s.sections AS BLOB)),0)+coalesce(length(CAST(s.next_steps AS BLOB)),0)+coalesce(length(CAST(s.content AS BLOB)),0)
20988
+ SELECT p.n, 2, s.id, 0, s.id, s.meeting_id, NULL, coalesce(length(CAST(s.title AS BLOB)),0)+coalesce(length(CAST(s.overview AS BLOB)),0)+coalesce(length(CAST(s.sections AS BLOB)),0)+coalesce(length(CAST(s.next_steps AS BLOB)),0)+coalesce(length(CAST(s.content AS BLOB)),0), NULL, NULL
20957
20989
  FROM hit h JOIN meeting_summaries s ON h.r % 4 = 3 AND s.id = h.r / 4
20958
20990
  JOIN picked p ON p.id = s.meeting_id
20959
20991
  ORDER BY 1, 2, 3, 4 LIMIT 10001`).all(`normalized_text : (${match})`, ...picked.params);
@@ -20967,7 +20999,18 @@ var search = /* @__PURE__ */ __name((database, query, filter) => {
20967
20999
  const scopes = ["transcript", "chat", "summary"];
20968
21000
  return rows.map((row2) => {
20969
21001
  const scope3 = scopes[Number(row2.kind)];
21002
+ const cue = scope3 === "transcript" ? {
21003
+ ref: formatMeetingReference({
21004
+ type: "meeting",
21005
+ accountId: Number(row2.account_id),
21006
+ meetingId: Number(row2.meeting_id),
21007
+ transcriptId: Number(row2.a),
21008
+ cuePosition: Number(row2.b)
21009
+ }),
21010
+ speakerName: row2.speaker === null ? null : String(row2.speaker)
21011
+ } : {};
20970
21012
  return {
21013
+ ...cue,
20971
21014
  meetingId: Number(row2.meeting_id),
20972
21015
  scope: scope3,
20973
21016
  id: Number(row2.id),
@@ -21066,7 +21109,7 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
21066
21109
  };
21067
21110
  }, "meetingStoreOver");
21068
21111
 
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
21112
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
21070
21113
  var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
21071
21114
  const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
21072
21115
  return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
@@ -21092,7 +21135,24 @@ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
21092
21135
  orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
21093
21136
  }, "release");
21094
21137
 
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
21138
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
21139
+ var THREAD_COLUMNS = {
21140
+ subject: {
21141
+ where: /* @__PURE__ */ __name(({ value }) => ({
21142
+ sql: "instr(' ' || coalesce(email_threads.subject_folded, lower(email_threads.subject)), ' ' || ?) > 0",
21143
+ params: [fold(value).replace(/\*+$/, "")]
21144
+ }), "where")
21145
+ },
21146
+ emails_count: { type: "num", sql: "email_threads.emails_count" },
21147
+ last_email_at: { type: "time", sql: "email_threads.last_email_at" }
21148
+ };
21149
+ var threadRows = /* @__PURE__ */ __name((database, filter) => {
21150
+ const [limit, offset] = page(filter);
21151
+ return database.prepare(`SELECT * FROM email_threads WHERE (? IS NULL OR account_id = ?) AND (? OR deleted_at IS NULL)
21152
+ 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);
21153
+ }, "threadRows");
21154
+
21155
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
21096
21156
  var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
21097
21157
  id: `email:${place.emailId}`,
21098
21158
  chatId: place.threadExternalId,
@@ -21341,6 +21401,8 @@ var emailWhere = /* @__PURE__ */ __name((filter) => {
21341
21401
  if (filter.attachmentErrors !== void 0)
21342
21402
  add(`e.id IN (SELECT attachable_id FROM attachments WHERE attachable_type = 'email'
21343
21403
  AND extraction_error IN (${filter.attachmentErrors.map(() => "?").join(",") || "NULL"}))`, ...filter.attachmentErrors);
21404
+ if (filter.externalIds !== void 0)
21405
+ add("e.external_id IN (SELECT value FROM json_each(?))", JSON.stringify(filter.externalIds));
21344
21406
  return [where.join(" AND "), params];
21345
21407
  }, "emailWhere");
21346
21408
  var messageOfEmail = /* @__PURE__ */ __name((email, thread) => {
@@ -21441,9 +21503,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
21441
21503
  return ids.map((id2) => threadDetails(database, id2));
21442
21504
  },
21443
21505
  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);
21506
+ return threadRows(database, filter).map(threadOf);
21447
21507
  },
21448
21508
  async thread(id2) {
21449
21509
  return threadDetails(database, id2);
@@ -21649,7 +21709,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
21649
21709
  }
21650
21710
  }), "mailStoreOver");
21651
21711
 
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
21712
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/search/dictionary.js
21653
21713
  import { readFileSync as readFileSync2 } from "node:fs";
21654
21714
  var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
21655
21715
  var folded4 = /* @__PURE__ */ __name((word) => /^[а-яё'-]*$/.test(word) ? word.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word), "folded");
@@ -21739,7 +21799,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
21739
21799
  }, "knownWord");
21740
21800
  var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
21741
21801
 
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
21802
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
21743
21803
  var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
21744
21804
  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
21805
  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 +21885,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
21825
21885
  return found2;
21826
21886
  }, "spokenTranscripts");
21827
21887
 
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
21888
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
21829
21889
  var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
21830
21890
  const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
21831
21891
  if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
@@ -21872,7 +21932,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
21872
21932
  });
21873
21933
  }, "placeHits");
21874
21934
 
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
21935
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
21876
21936
  var MESSAGES2 = {
21877
21937
  rows: "messages",
21878
21938
  threads: "chats",
@@ -21924,8 +21984,8 @@ var compileQuery = /* @__PURE__ */ __name((context, execution, boundedAttachment
21924
21984
  const { database } = context;
21925
21985
  const corpus = execution.corpus === "mail" ? MAIL : MESSAGES2;
21926
21986
  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");
21987
+ if (mail && (execution.conversationIds || execution.conversationSince !== void 0))
21988
+ throw new CliError("validation_error", "mail has no conversations to search within");
21929
21989
  const started = context.now();
21930
21990
  const budget = { work: 0 };
21931
21991
  let states = 0, expansions = 0;
@@ -22066,11 +22126,11 @@ var compileQuery = /* @__PURE__ */ __name((context, execution, boundedAttachment
22066
22126
  where = combine([
22067
22127
  where,
22068
22128
  {
22069
- sql: `m.id IN (SELECT picked.id FROM json_each(?) j CROSS JOIN accounts allowed CROSS JOIN chats scoped CROSS JOIN messages picked
22129
+ 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
22130
  WHERE (${execution.accounts.map(() => "(allowed.provider=? AND allowed.external_id=?)").join(" OR ") || "0"})
22071
22131
  AND allowed.provider=json_extract(j.value,'$.provider') AND allowed.external_id=json_extract(j.value,'$.account')
22072
22132
  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'))`,
22133
+ AND picked.${mail ? "email_thread_id" : "chat_id"}=scoped.id AND picked.external_id=json_extract(j.value,'$.id'))`,
22074
22134
  params: [JSON.stringify(execution.only), ...execution.accounts.flatMap((key2) => [key2.provider, key2.account])],
22075
22135
  exact: true
22076
22136
  }
@@ -22346,7 +22406,7 @@ var runQuery = /* @__PURE__ */ __name(async (context, execution, by) => {
22346
22406
  };
22347
22407
  }, "runQuery");
22348
22408
 
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
22409
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
22350
22410
  function invalidMetadata() {
22351
22411
  throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
22352
22412
  }
@@ -22448,7 +22508,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
22448
22508
  };
22449
22509
  }), "counterTargets");
22450
22510
 
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
22511
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
22452
22512
  var NOT_FILE_LIST = [...NOT_FILES].map((kind3) => `'${kind3}'`).join(",");
22453
22513
  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
22514
  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 +22627,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
22567
22627
  }));
22568
22628
  }, "attachmentViews");
22569
22629
 
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
22630
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
22571
22631
  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
22632
  var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text5, source2) => {
22573
22633
  const { orm, database, now: now2 } = context;
@@ -22605,7 +22665,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
22605
22665
  keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
22606
22666
  }, "intoVoiceAttachment");
22607
22667
 
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
22668
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
22609
22669
  var FIELDS = [
22610
22670
  "threadExternalId",
22611
22671
  "senderIdentityId",
@@ -22922,7 +22982,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
22922
22982
  reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
22923
22983
  }, "writeDerivedReactions");
22924
22984
 
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
22985
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/keys.js
22926
22986
  var keysOver = /* @__PURE__ */ __name((context) => {
22927
22987
  const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
22928
22988
  const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
@@ -22943,7 +23003,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
22943
23003
  };
22944
23004
  }, "keysOver");
22945
23005
 
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
23006
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
22947
23007
  var accountGroupsOf = /* @__PURE__ */ __name((database) => {
22948
23008
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
22949
23009
  if (!row2)
@@ -22978,7 +23038,7 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
22978
23038
  database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
22979
23039
  }, "saveProfile");
22980
23040
 
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
23041
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
22982
23042
  var BOT_KINDS = ["agent", "script", "integration"];
22983
23043
  var ownerPerson = /* @__PURE__ */ __name((database) => {
22984
23044
  const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
@@ -23014,7 +23074,7 @@ var originOfActor = /* @__PURE__ */ __name((database, type, id2) => {
23014
23074
  return database.prepare("SELECT name FROM bots WHERE id = ?").get(Number(id2))?.name === "rule" ? "rule" : "agent";
23015
23075
  }, "originOfActor");
23016
23076
 
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
23077
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
23018
23078
  var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
23019
23079
  const owner = ownerPerson(context.database).id;
23020
23080
  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 +23095,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
23035
23095
  return personOf(context, ref3);
23036
23096
  }, "linkToOwner");
23037
23097
 
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
23098
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
23039
23099
  var PROVIDERS_SETTING = "providers";
23040
23100
  var storedProvidersOf = /* @__PURE__ */ __name((database) => {
23041
23101
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
@@ -23070,7 +23130,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
23070
23130
  });
23071
23131
  }, "registerProvider");
23072
23132
 
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
23133
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
23074
23134
  var DAY3 = 864e5;
23075
23135
  var RECENTLY_CLOSED_MS = 14 * DAY3;
23076
23136
  var TEXT_LIMIT = 20;
@@ -23094,7 +23154,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
23094
23154
  ...own || row2.person == null ? {} : { person: `person:${row2.person}` }
23095
23155
  };
23096
23156
  }, "messageOf");
23097
- const sourceOf3 = /* @__PURE__ */ __name((locator2) => {
23157
+ const sourceOf4 = /* @__PURE__ */ __name((locator2) => {
23098
23158
  if (typeof locator2 !== "string" || !isLocator(locator2))
23099
23159
  return void 0;
23100
23160
  let thing;
@@ -23115,7 +23175,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
23115
23175
  return { ...side, linked };
23116
23176
  }, "linkedOf");
23117
23177
  const sideOf = /* @__PURE__ */ __name((row2) => {
23118
- const source2 = sourceOf3(row2.source_locator);
23178
+ const source2 = sourceOf4(row2.source_locator);
23119
23179
  const person2 = source2?.person;
23120
23180
  return {
23121
23181
  row: Number(row2.id),
@@ -23170,7 +23230,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
23170
23230
  if (!project)
23171
23231
  return void 0;
23172
23232
  const { draft } = subject2;
23173
- const source2 = draft.source === void 0 ? void 0 : sourceOf3(draft.source);
23233
+ const source2 = draft.source === void 0 ? void 0 : sourceOf4(draft.source);
23174
23234
  const person2 = draft.person ?? source2?.person;
23175
23235
  return {
23176
23236
  project: Number(project.id),
@@ -23269,15 +23329,15 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
23269
23329
  };
23270
23330
  }, "taskSimilarityOver");
23271
23331
 
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
23332
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
23273
23333
  var SETTING3 = "taskCategories";
23274
23334
  var savedTaskCategories = /* @__PURE__ */ __name((database) => {
23275
23335
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
23276
23336
  return row2 ? storedTaskCategories(String(row2.value)) : void 0;
23277
23337
  }, "savedTaskCategories");
23278
23338
  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));
23339
+ var unlistedTaskCategories = /* @__PURE__ */ __name((database, list2) => {
23340
+ const listed = new Set(list2.map(({ name }) => name));
23281
23341
  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
23342
  }, "unlistedTaskCategories");
23283
23343
  var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) => {
@@ -23288,7 +23348,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
23288
23348
  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
23349
  }, "saveTaskCategories");
23290
23350
 
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
23351
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
23292
23352
  var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
23293
23353
  var ALLOWED = "taskAgentClose";
23294
23354
  var MIN = "taskAgentCloseMin";
@@ -23344,7 +23404,7 @@ var SUGGESTION_COLUMNS = [
23344
23404
  ];
23345
23405
  var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
23346
23406
 
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
23407
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
23348
23408
  var EXCERPT_CHARS = 280;
23349
23409
  var excerptOf = /* @__PURE__ */ __name((text5) => {
23350
23410
  if (text5 == null)
@@ -23369,8 +23429,7 @@ var KIND = {
23369
23429
  meeting_transcript: "meeting",
23370
23430
  meeting_transcript_row: "meeting"
23371
23431
  };
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);
23432
+ var sourceOf3 = /* @__PURE__ */ __name((database, thing) => {
23374
23433
  const state = stateOfThing(database, thing);
23375
23434
  const read2 = READS2[thing.type];
23376
23435
  const row2 = read2 === void 0 || state === "unavailable" ? void 0 : database.prepare(read2).get(thing.id);
@@ -23385,9 +23444,32 @@ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => database.pre
23385
23444
  tool: textOf(row2?.tool),
23386
23445
  missing: gone
23387
23446
  };
23388
- }), "evidenceSourcesOf");
23447
+ }, "sourceOf");
23448
+ 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");
23449
+ var thingNamed = /* @__PURE__ */ __name((database, reference2) => {
23450
+ try {
23451
+ return thingOf(database, canonicalThingReference(reference2));
23452
+ } catch {
23453
+ return void 0;
23454
+ }
23455
+ }, "thingNamed");
23456
+ var sourcesOfReferences = /* @__PURE__ */ __name((database, references) => [...new Set(references)].map((reference2) => {
23457
+ const thing = thingNamed(database, reference2);
23458
+ if (thing)
23459
+ return { ...sourceOf3(database, thing), ref: reference2 };
23460
+ return {
23461
+ ref: reference2,
23462
+ kind: reference2.startsWith("msg:") ? "message" : reference2.split(":")[0] || "unknown",
23463
+ title: null,
23464
+ sender: null,
23465
+ at: null,
23466
+ excerpt: null,
23467
+ tool: null,
23468
+ missing: true
23469
+ };
23470
+ }), "sourcesOfReferences");
23389
23471
 
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
23472
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/attachments/limits.js
23391
23473
  var MAX_FILE_BYTES = 50 * 1024 * 1024;
23392
23474
  var MAX_TEXT_CHARS = 2e6;
23393
23475
  var ATTACHMENT_LIMIT_ENV = [
@@ -23413,7 +23495,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
23413
23495
  return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
23414
23496
  }, "pdfPreviewLimits");
23415
23497
 
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
23498
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/ulid.js
23417
23499
  import { randomBytes } from "node:crypto";
23418
23500
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
23419
23501
  var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
@@ -23426,7 +23508,7 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
23426
23508
  return time3 + random;
23427
23509
  }, "ulid");
23428
23510
 
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
23511
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
23430
23512
  var FOLDED_FIELDS = ["title", "site", "language", "author"];
23431
23513
  var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
23432
23514
  if (!meta && !sections?.length)
@@ -23447,7 +23529,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
23447
23529
  return typeof language === "string" && language !== "" ? language : null;
23448
23530
  }, "languageOf");
23449
23531
 
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
23532
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
23451
23533
  var isObject = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
23452
23534
  var objectOf = /* @__PURE__ */ __name((value) => {
23453
23535
  if (isObject(value))
@@ -23690,7 +23772,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
23690
23772
  };
23691
23773
  }, "filesStoreOver");
23692
23774
 
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
23775
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
23694
23776
  var IMPORTED_DOCUMENT_QUERY = defineQuery({
23695
23777
  entity: "document",
23696
23778
  backend: "sql",
@@ -23736,7 +23818,7 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
23736
23818
  return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
23737
23819
  }, "importedDocumentWhere");
23738
23820
 
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
23821
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
23740
23822
  var NOTE_FORMATS = ["obsidian", "markdown"];
23741
23823
  var iso2 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
23742
23824
  var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso2(value), "optionalIso");
@@ -24246,7 +24328,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
24246
24328
  };
24247
24329
  }, "notesStoreOver");
24248
24330
 
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
24331
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
24250
24332
  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
24333
  var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
24252
24334
  var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -24293,6 +24375,18 @@ var subjectOf = /* @__PURE__ */ __name((database, row2) => {
24293
24375
  subjectIsOwner: Number(named2?.owner) === 1
24294
24376
  };
24295
24377
  }, "subjectOf");
24378
+ var projectOf = /* @__PURE__ */ __name((database, row2) => {
24379
+ if (row2.project_id == null)
24380
+ return { project: null, projectName: null };
24381
+ const named2 = database.prepare(SUBJECT_NAMES.project).get(Number(row2.project_id));
24382
+ return { project: `project:${row2.project_id}`, projectName: named2?.name == null ? null : String(named2.name) };
24383
+ }, "projectOf");
24384
+ var projectId = /* @__PURE__ */ __name((database, reference2) => {
24385
+ const project = requiredThing(database, reference2, "the project");
24386
+ if (project.type !== "project")
24387
+ throw new CliError("validation_error", `${reference2} is not a project`);
24388
+ return project.id;
24389
+ }, "projectId");
24296
24390
  var highestKey = /* @__PURE__ */ __name((table) => `ids.${table}.highest`, "highestKey");
24297
24391
  var nextId = /* @__PURE__ */ __name((database, table) => {
24298
24392
  const kept = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(highestKey(table));
@@ -24332,6 +24426,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24332
24426
  kind: row2.kind,
24333
24427
  body: String(row2.body),
24334
24428
  ...subjectOf(database, row2),
24429
+ ...projectOf(database, row2),
24335
24430
  author: authorOf(row2),
24336
24431
  model: row2.model == null ? null : String(row2.model),
24337
24432
  confidence: row2.confidence == null ? null : Number(row2.confidence),
@@ -24379,9 +24474,10 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24379
24474
  const id2 = write(database, () => {
24380
24475
  const { actor, model } = authorActor(context, input.author);
24381
24476
  const subject2 = input.subject === void 0 ? void 0 : requiredThing(database, input.subject, "the subject");
24477
+ const project = input.project === void 0 ? null : projectId(database, input.project);
24382
24478
  const replaced = input.supersedes === void 0 ? void 0 : Number(rowOf(input.supersedes).id);
24383
24479
  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);
24480
+ 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
24481
  linkEvidence(context, { type: "memory", id: made }, input.evidence, input.author === "owner" ? "owner" : "agent");
24386
24482
  if (replaced !== void 0)
24387
24483
  database.prepare("UPDATE memories SET status = 'superseded', updated_at = ? WHERE id = ?").run(at, replaced);
@@ -24392,8 +24488,15 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24392
24488
  get: /* @__PURE__ */ __name(async (reference2) => memoryOf(rowOf(reference2)), "get"),
24393
24489
  list: /* @__PURE__ */ __name(async (options = {}) => {
24394
24490
  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);
24491
+ const project = options.project === void 0 ? null : projectId(database, options.project);
24492
+ 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
24493
  }, "list"),
24494
+ update: /* @__PURE__ */ __name(async (reference2, change) => write(database, () => {
24495
+ const id2 = Number(rowOf(reference2).id);
24496
+ const project = change.project === null ? null : projectId(database, change.project);
24497
+ database.prepare("UPDATE memories SET project_id = ?, updated_at = ? WHERE id = ?").run(project, now2(), id2);
24498
+ return memoryOf(rowOf(`memory:${id2}`));
24499
+ }), "update"),
24397
24500
  confirm: /* @__PURE__ */ __name(async (reference2) => setStatus(reference2, "confirmed", true), "confirm"),
24398
24501
  markStale: /* @__PURE__ */ __name(async (reference2) => setStatus(reference2, "stale", false), "markStale"),
24399
24502
  remove: /* @__PURE__ */ __name(async (reference2) => {
@@ -24421,7 +24524,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
24421
24524
  };
24422
24525
  }, "memoriesStoreOver");
24423
24526
 
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
24527
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
24425
24528
  var DEFAULT_FIRST_PASS_PER_CHAT = 0;
24426
24529
  var KEY = "taskFirstPassPerChat";
24427
24530
  var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
@@ -24441,7 +24544,7 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
24441
24544
  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
24545
  }, "saveFirstPassPerChat");
24443
24546
 
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
24547
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
24445
24548
  var field = /* @__PURE__ */ __name((name, type, example, more = {}) => ({
24446
24549
  name,
24447
24550
  type,
@@ -24463,8 +24566,15 @@ var PROJECT_TASK_FIELDS = [
24463
24566
  relation: "low, medium, high, critical or none; a range of labels or of the 0\u20131 number: priority:[high TO critical]"
24464
24567
  }),
24465
24568
  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" }),
24569
+ field("parent", "kw", "parent:HRB-1", { relation: "the subtasks of a task, by its key; none or any" }),
24570
+ field("due", "time", "due:[today TO 2026-12-31]", {
24571
+ relation: "the due date; today, tomorrow and yesterday are your calendar days; NOT due:* has none"
24572
+ }),
24573
+ field("overdue", "bool", "overdue:true", { relation: "open work due before today" }),
24574
+ field("when", "enum", "when:today", {
24575
+ values: ["overdue", "today", "upcoming", "later", "none"],
24576
+ 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"
24577
+ }),
24468
24578
  field("closed", "time", "closed:>=14d", { relation: "when it was done or dismissed" }),
24469
24579
  field("ready", "bool", "ready:true", { relation: "open work whose blocked-by tasks are all done" }),
24470
24580
  field("text", "txt", "text:invoice", { relation: "words of the title and description; a bare word means this" })
@@ -24554,20 +24664,60 @@ var agentWhere = /* @__PURE__ */ __name((node) => {
24554
24664
  return { sql: "t.agent IS NOT NULL", params: [] };
24555
24665
  return node.operator === "wildcard" ? { sql: "lower(t.agent) GLOB ?", params: [value] } : { sql: "lower(t.agent) = ?", params: [value] };
24556
24666
  }, "agentWhere");
24667
+ var parentWhere = /* @__PURE__ */ __name((node) => {
24668
+ const value = node.value.trim();
24669
+ if (value.toLowerCase() === "none")
24670
+ return { sql: "t.parent_id IS NULL", params: [] };
24671
+ if (value.toLowerCase() === "any")
24672
+ return { sql: "t.parent_id IS NOT NULL", params: [] };
24673
+ const key2 = value.replace(/^task:/, "");
24674
+ return {
24675
+ sql: "t.parent_id IN (SELECT id FROM tasks WHERE key = ? OR package_id = ? UNION SELECT task_id FROM task_events WHERE kind = 'project' AND json_extract(changes, '$.key[0]') = ?)",
24676
+ params: [key2.toUpperCase(), key2, key2.toUpperCase()]
24677
+ };
24678
+ }, "parentWhere");
24557
24679
  var truth = /* @__PURE__ */ __name((node, sql2) => ({
24558
24680
  sql: node.value.toLowerCase() === "true" ? sql2 : `NOT (${sql2})`,
24559
24681
  params: []
24560
24682
  }), "truth");
24561
- var projectTaskColumns = /* @__PURE__ */ __name((now2) => ({
24683
+ var SPAN = { start: 0, end: 0 };
24684
+ var UPCOMING_DAYS = 7;
24685
+ var dayIn = /* @__PURE__ */ __name((at, zone, ahead) => {
24686
+ 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`);
24687
+ date3.setUTCDate(date3.getUTCDate() + ahead);
24688
+ return dayBoundary(date3.toISOString().slice(0, 10), zone, false, SPAN);
24689
+ }, "dayIn");
24690
+ var dueGroups = /* @__PURE__ */ __name((now2, zone) => {
24691
+ const today = dayIn(now2, zone, 0);
24692
+ const tomorrow = dayIn(now2, zone, 1);
24693
+ const after2 = dayIn(now2, zone, UPCOMING_DAYS + 1);
24694
+ return {
24695
+ overdue: `${OPEN} AND t.due_at IS NOT NULL AND t.due_at < ${today}`,
24696
+ today: `t.due_at >= ${today} AND t.due_at < ${tomorrow}`,
24697
+ upcoming: `t.due_at >= ${tomorrow} AND t.due_at < ${after2}`,
24698
+ later: `t.due_at >= ${after2}`,
24699
+ none: "t.due_at IS NULL"
24700
+ };
24701
+ }, "dueGroups");
24702
+ var projectTaskColumns = /* @__PURE__ */ __name((now2, zone) => ({
24562
24703
  state: { type: "enum", sql: "t.status" },
24563
24704
  kind: { type: "enum", sql: "t.type" },
24564
24705
  project: { where: projectWhere },
24565
24706
  assignee: { where: assigneeWhere },
24566
24707
  priority: { where: priorityWhere },
24567
24708
  agent: { where: agentWhere },
24709
+ parent: { where: parentWhere },
24568
24710
  due: { type: "time", sql: "t.due_at" },
24569
24711
  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") },
24712
+ overdue: { where: /* @__PURE__ */ __name((node) => truth(node, dueGroups(now2, zone).overdue), "where") },
24713
+ when: {
24714
+ where: /* @__PURE__ */ __name((node) => {
24715
+ const group = dueGroups(now2, zone)[node.value.toLowerCase()];
24716
+ if (group === void 0)
24717
+ throw new CliError("validation_error", "when is overdue, today, upcoming, later or none");
24718
+ return { sql: group, params: [] };
24719
+ }, "where")
24720
+ },
24571
24721
  ready: { where: /* @__PURE__ */ __name((node) => truth(node, `${OPEN} AND NOT EXISTS (${UNFINISHED_BLOCKER})`), "where") },
24572
24722
  text: {
24573
24723
  where: /* @__PURE__ */ __name((node) => {
@@ -24614,7 +24764,35 @@ var withoutField = /* @__PURE__ */ __name((query, name) => {
24614
24764
  return root === void 0 ? void 0 : { ...query, root };
24615
24765
  }, "withoutField");
24616
24766
 
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
24767
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
24768
+ var authorNamed = /* @__PURE__ */ __name((database, row2) => {
24769
+ if (row2.author_type == null)
24770
+ return null;
24771
+ 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));
24772
+ return {
24773
+ type: row2.author_type,
24774
+ id: String(row2.author_id),
24775
+ name: named2?.name == null ? null : String(named2.name),
24776
+ owner: Number(named2?.owner) === 1
24777
+ };
24778
+ }, "authorNamed");
24779
+ 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) => ({
24780
+ ref: `note:${row2.id}`,
24781
+ text: String(row2.body),
24782
+ author: authorNamed(database, row2),
24783
+ at: new Date(Number(row2.created_at)).toISOString()
24784
+ })), "commentsOf");
24785
+ var addComment = /* @__PURE__ */ __name((context, task, body2, by) => {
24786
+ const { database, now: now2 } = context;
24787
+ const made = write(database, () => {
24788
+ const { actor } = authorActor(context, by);
24789
+ const at = now2();
24790
+ 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);
24791
+ });
24792
+ return commentsOf(database, task).find((one) => one.ref === `note:${made}`);
24793
+ }, "addComment");
24794
+
24795
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
24618
24796
  var TASK_RELATION_KINDS = [
24619
24797
  "blocked-by",
24620
24798
  "follow-up-of",
@@ -24744,7 +24922,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
24744
24922
  };
24745
24923
  }, "taskRelationsStoreOver");
24746
24924
 
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
24925
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
24748
24926
  var TASK_ROLES = ["assignee", "reviewer", "watcher"];
24749
24927
  var iso4 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
24750
24928
  var recordTaskEvent = /* @__PURE__ */ __name((database, task, actor, kind3, changes, at) => {
@@ -24757,6 +24935,10 @@ var textOf3 = /* @__PURE__ */ __name((value, what, max) => {
24757
24935
  return text5;
24758
24936
  }, "textOf");
24759
24937
  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");
24938
+ var timesAsIso = /* @__PURE__ */ __name((changes) => Object.fromEntries(Object.entries(changes).map(([key2, pair]) => [
24939
+ key2,
24940
+ key2.endsWith("_at") && Array.isArray(pair) ? pair.map((value) => typeof value === "number" ? new Date(value).toISOString() : value) : pair
24941
+ ])), "timesAsIso");
24760
24942
  var checkRevision = /* @__PURE__ */ __name((row2, expected) => {
24761
24943
  if (expected === void 0 || Number(row2.revision) === expected)
24762
24944
  return;
@@ -24771,7 +24953,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24771
24953
  throw new CliError("not_found", `no task ${id2}`);
24772
24954
  return row2;
24773
24955
  }, "required");
24774
- const projectOf = /* @__PURE__ */ __name((reference2) => {
24956
+ const projectOf2 = /* @__PURE__ */ __name((reference2) => {
24775
24957
  if (reference2.startsWith("project:")) {
24776
24958
  const thing = requiredThing(database, reference2, "the project");
24777
24959
  if (thing.type !== "project")
@@ -24802,6 +24984,10 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24802
24984
  }
24803
24985
  return parent2;
24804
24986
  }, "parentOf");
24987
+ const projectNamed = /* @__PURE__ */ __name((id2) => {
24988
+ const project = database.prepare("SELECT key, name FROM projects WHERE id = ?").get(id2);
24989
+ return { projectKey: String(project.key), projectName: String(project.name) };
24990
+ }, "projectNamed");
24805
24991
  const detailsOf = /* @__PURE__ */ __name((row2) => {
24806
24992
  const id2 = Number(row2.id);
24807
24993
  const reference2 = /* @__PURE__ */ __name((taskRow) => `task:${taskIdOf(database, taskRow)}`, "reference");
@@ -24810,6 +24996,8 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24810
24996
  ref: reference2(id2),
24811
24997
  key: String(row2.key),
24812
24998
  project: `project:${row2.project_id}`,
24999
+ ...projectNamed(Number(row2.project_id)),
25000
+ createdBy: authorNamed(database, row2),
24813
25001
  title: String(row2.title),
24814
25002
  description: row2.description == null ? null : String(row2.description),
24815
25003
  type: row2.type,
@@ -24839,7 +25027,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24839
25027
  const boardWhere = /* @__PURE__ */ __name((query, zone, at) => {
24840
25028
  if (query === void 0)
24841
25029
  return { sql: BOARD_SCOPE, params: [] };
24842
- const where = queryFilter(query, projectTaskColumns(at), {
25030
+ const where = queryFilter(query, projectTaskColumns(at, timezoneOf(zone)), {
24843
25031
  command: "tasks list",
24844
25032
  now: at,
24845
25033
  ...zone ? { zone } : {}
@@ -24849,11 +25037,38 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24849
25037
  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
25038
  const rowById = /* @__PURE__ */ __name((id2) => database.prepare("SELECT * FROM tasks WHERE id = ?").get(id2), "rowById");
24851
25039
  const details2 = /* @__PURE__ */ __name((id2) => detailsOf(rowById(id2)), "details");
25040
+ const onBoard = /* @__PURE__ */ __name((task) => Boolean(database.prepare(`SELECT 1 FROM tasks t WHERE t.id = ? AND ${BOARD_SCOPE}`).get(task)), "onBoard");
25041
+ const moveToProject = /* @__PURE__ */ __name((task, before2, target, actor, at, detach) => {
25042
+ if (target === Number(before2.project_id))
25043
+ return;
25044
+ if (!onBoard(task))
25045
+ throw new CliError("validation_error", "only a project task moves to another project");
25046
+ const targetRow = database.prepare("SELECT key FROM projects WHERE id = ?").get(target);
25047
+ if (String(targetRow.key).length === INBOX_KEY_LENGTH)
25048
+ throw new CliError("validation_error", "a task moves only into one of your projects");
25049
+ if (before2.parent_id != null && !detach) {
25050
+ const parent2 = taskIdOf(database, Number(before2.parent_id));
25051
+ throw new CliError("validation_error", `${String(before2.key)} is a subtask of ${parent2}; detach it in the same write (parent none) to move it alone`, { reason: "task.is-subtask", parent: parent2 });
25052
+ }
25053
+ 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));
25054
+ if (children.length)
25055
+ throw new CliError("validation_error", `${String(before2.key)} has subtasks (${children.join(", ")}); move or detach them first`, { reason: "task.has-subtasks", subtasks: children });
25056
+ const counted = database.prepare("UPDATE projects SET tasks_count = tasks_count + 1, updated_at = ? WHERE id = ? RETURNING key, tasks_count").get(at, target);
25057
+ const number3 = Number(counted.tasks_count);
25058
+ const key2 = `${String(counted.key)}-${number3}`;
25059
+ database.prepare("UPDATE tasks SET project_id = ?, number = ?, key = ?, parent_id = NULL, updated_at = ? WHERE id = ?").run(target, number3, key2, at, task);
25060
+ recordTaskEvent(database, task, actor, "project", {
25061
+ project: [`project:${before2.project_id}`, `project:${target}`],
25062
+ key: [String(before2.key), key2],
25063
+ ...before2.parent_id == null ? {} : { parent: [`task:${taskIdOf(database, Number(before2.parent_id))}`, null] }
25064
+ }, at);
25065
+ }, "moveToProject");
24852
25066
  const edit = /* @__PURE__ */ __name((task, fields4, actor, created = false) => {
24853
25067
  const before2 = rowById(task);
24854
25068
  const at = now2();
24855
25069
  const set = [];
24856
25070
  const values = [];
25071
+ let bump = false;
24857
25072
  const change = /* @__PURE__ */ __name((column2, value, event, key2 = column2) => {
24858
25073
  if ((before2[column2] ?? null) === value)
24859
25074
  return;
@@ -24918,8 +25133,21 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24918
25133
  }
24919
25134
  if (fields4.category !== void 0)
24920
25135
  change("category", fields4.category, "category");
24921
- if (set.length === 0)
25136
+ if (fields4.type !== void 0 && fields4.type !== before2.type) {
25137
+ if (!WORK_TASK_TYPES.includes(fields4.type) || !onBoard(task))
25138
+ throw new CliError("validation_error", `a project task's kind is one of ${WORK_TASK_TYPES.join(", ")}`);
25139
+ change("type", fields4.type, "type");
25140
+ bump = true;
25141
+ }
25142
+ if (fields4.project !== void 0)
25143
+ moveToProject(task, before2, projectOf2(fields4.project), actor, at, fields4.parent === null);
25144
+ if (set.length === 0) {
25145
+ if (bump)
25146
+ database.prepare("UPDATE tasks SET revision = revision + 1 WHERE id = ?").run(task);
24922
25147
  return;
25148
+ }
25149
+ if (bump)
25150
+ set.push("revision = revision + 1");
24923
25151
  database.prepare(`UPDATE tasks SET ${set.join(", ")}, updated_at = ? WHERE id = ?`).run(...values, at, task);
24924
25152
  }, "edit");
24925
25153
  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 +25214,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
24986
25214
  if (!WORK_TASK_TYPES.includes(input.type))
24987
25215
  throw new CliError("validation_error", `a task made here is one of ${WORK_TASK_TYPES.join(", ")}`);
24988
25216
  const made = write(database, () => {
24989
- const project = projectOf(input.project);
25217
+ const project = projectOf2(input.project);
24990
25218
  const { actor } = authorActor(context, by);
24991
25219
  const at = now2();
24992
25220
  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 +25305,9 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
25077
25305
  find: /* @__PURE__ */ __name(async ({ project, type, status, assignee, where, limit = 100 }) => {
25078
25306
  if (type !== void 0 && !TASK_TYPES.includes(type))
25079
25307
  throw new CliError("validation_error", `a task's type is one of ${TASK_TYPES.join(", ")}`);
25080
- const projectId = project === void 0 ? null : projectOf(project);
25308
+ const projectId2 = project === void 0 ? null : projectOf2(project);
25081
25309
  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);
25310
+ 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
25311
  }, "find"),
25084
25312
  claim: /* @__PURE__ */ __name(async (id2, holder, until) => {
25085
25313
  const task = required3(id2);
@@ -25131,7 +25359,12 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
25131
25359
  const where = without(name);
25132
25360
  return database.prepare(`SELECT ${select2}, count(*) AS n FROM tasks t ${from2} WHERE ${where.sql} GROUP BY ${group}`).all(...where.params);
25133
25361
  }, "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));
25362
+ const project = grouped("project", "p.id, p.key, p.name", "JOIN projects p ON p.id = t.project_id", "p.id").map((row2) => ({
25363
+ value: String(row2.key),
25364
+ ref: `project:${row2.id}`,
25365
+ name: String(row2.name),
25366
+ count: Number(row2.n)
25367
+ })).sort((a, b) => a.value.localeCompare(b.value));
25135
25368
  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
25369
  const assignee = assigned.map((row2) => ({
25137
25370
  value: row2.person == null ? "none" : `person:${row2.person}`,
@@ -25144,6 +25377,13 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
25144
25377
  priorities.set(label, (priorities.get(label) ?? 0) + Number(row2.n));
25145
25378
  }
25146
25379
  const states = new Map(grouped("state", "t.status", "", "t.status").map((row2) => [row2.status, Number(row2.n)]));
25380
+ const groups = dueGroups(at, timezoneOf(zone));
25381
+ const dueWhere = boardWhere(withoutField(withoutField(query, "when"), "overdue"), zone, at);
25382
+ const due = Object.keys(groups).map((value) => ({
25383
+ value,
25384
+ count: Number(database.prepare(`SELECT count(*) AS n FROM tasks t WHERE ${dueWhere.sql} AND ${groups[value]}`).get(...dueWhere.params)?.n ?? 0)
25385
+ }));
25386
+ 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
25387
  return {
25148
25388
  total: countOf(boardWhere(query, zone, at)),
25149
25389
  project,
@@ -25152,15 +25392,19 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
25152
25392
  value,
25153
25393
  count: priorities.get(value) ?? 0
25154
25394
  })),
25155
- state: TASK_STATES.map((value) => ({ value, count: states.get(value) ?? 0 }))
25395
+ state: TASK_STATES.map((value) => ({ value, count: states.get(value) ?? 0 })),
25396
+ due,
25397
+ agent
25156
25398
  };
25157
25399
  }, "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) => ({
25400
+ 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
25401
  person: `person:${row2.id}`,
25160
25402
  name: row2.name == null ? null : String(row2.name),
25161
25403
  owner: Number(row2.owner) === 1,
25162
25404
  tasks: Number(row2.n)
25163
25405
  })), "taskPeople"),
25406
+ comment: /* @__PURE__ */ __name(async (id2, text5, by) => addComment(context, required3(id2), textOf3(text5, "a comment", 2e4), by), "comment"),
25407
+ comments: /* @__PURE__ */ __name(async (id2) => commentsOf(database, required3(id2)), "comments"),
25164
25408
  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
25409
  kind: row2.kind,
25166
25410
  actor: row2.actor_type == null ? null : {
@@ -25168,7 +25412,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
25168
25412
  id: Number(row2.actor_id),
25169
25413
  name: row2.actor_name == null ? null : String(row2.actor_name)
25170
25414
  },
25171
- changes: row2.changes == null ? null : JSON.parse(String(row2.changes)),
25415
+ changes: row2.changes == null ? null : timesAsIso(JSON.parse(String(row2.changes))),
25172
25416
  at: iso4(row2.created_at)
25173
25417
  })), "events")
25174
25418
  };
@@ -25182,7 +25426,7 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
25182
25426
  };
25183
25427
  }, "workTasksOver");
25184
25428
 
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
25429
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
25186
25430
  var taskCloseOver = /* @__PURE__ */ __name((context) => {
25187
25431
  const { database, now: now2 } = context;
25188
25432
  const liveRow = /* @__PURE__ */ __name((id2) => {
@@ -25231,7 +25475,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
25231
25475
  };
25232
25476
  }, "taskCloseOver");
25233
25477
 
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
25478
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
25235
25479
  var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
25236
25480
  const { database, now: now2 } = context;
25237
25481
  const required3 = /* @__PURE__ */ __name((id2) => {
@@ -25449,7 +25693,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
25449
25693
  };
25450
25694
  }, "taskPairsOver");
25451
25695
 
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
25696
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
25453
25697
  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
25698
  var taskStoreOver = /* @__PURE__ */ __name((context) => {
25455
25699
  const { database, now: now2 } = context;
@@ -25654,7 +25898,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
25654
25898
  throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
25655
25899
  }, "oneOf");
25656
25900
 
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
25901
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/accounts.js
25658
25902
  var accountAccountsOver = /* @__PURE__ */ __name((context) => {
25659
25903
  const { database } = context;
25660
25904
  const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
@@ -25699,7 +25943,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
25699
25943
  };
25700
25944
  }, "accountsStoreOver");
25701
25945
 
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
25946
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
25703
25947
  var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
25704
25948
  var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
25705
25949
  const message2 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
@@ -25723,7 +25967,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
25723
25967
  })), "keepDownloads");
25724
25968
  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
25969
 
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
25970
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/attachments.js
25727
25971
  var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
25728
25972
  const { database } = context;
25729
25973
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -25780,7 +26024,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
25780
26024
  }, "keepAttachmentText")
25781
26025
  }), "attachmentsStoreOver");
25782
26026
 
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
26027
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
25784
26028
  var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
25785
26029
  var pointerMover = /* @__PURE__ */ __name((context, type) => {
25786
26030
  const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
@@ -25960,7 +26204,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
25960
26204
  return done;
25961
26205
  }, "rekeyChats");
25962
26206
 
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
26207
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
25964
26208
  var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
25965
26209
  var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
25966
26210
  var CHAT_LIST_KEY = "chat_list_complete";
@@ -25992,15 +26236,15 @@ var chatCompleteness = /* @__PURE__ */ __name(({ database }, accountKey, chatIds
25992
26236
  });
25993
26237
  }, "chatCompleteness");
25994
26238
 
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
26239
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/chats.js
25996
26240
  var chatsStoreOver = /* @__PURE__ */ __name((context) => {
25997
26241
  const { database } = context;
25998
26242
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
25999
26243
  return {
26000
- saveChats: /* @__PURE__ */ __name(async (key2, list) => write(database, () => {
26244
+ saveChats: /* @__PURE__ */ __name(async (key2, list2) => write(database, () => {
26001
26245
  const accountKey = accountPk2(key2);
26002
26246
  revisedBy(context, "chats", () => {
26003
- for (const chat2 of list)
26247
+ for (const chat2 of list2)
26004
26248
  upsertChat(context, accountKey, chat2);
26005
26249
  });
26006
26250
  }), "saveChats"),
@@ -26099,7 +26343,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
26099
26343
  };
26100
26344
  }, "chatsStoreOver");
26101
26345
 
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
26346
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
26103
26347
  import { createHash as createHash6 } from "node:crypto";
26104
26348
  var BATCH_CONTEXT = 50;
26105
26349
  var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
@@ -26237,7 +26481,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
26237
26481
  var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
26238
26482
  ${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
26239
26483
 
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
26484
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
26241
26485
  import { setTimeout } from "node:timers/promises";
26242
26486
  var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
26243
26487
  var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
@@ -26549,7 +26793,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
26549
26793
  AND NOT EXISTS (SELECT 1 FROM messages d
26550
26794
  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
26795
 
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
26796
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/conversations.js
26553
26797
  var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
26554
26798
  const { database } = context;
26555
26799
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -26656,7 +26900,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
26656
26900
  };
26657
26901
  }, "conversationsStoreOver");
26658
26902
 
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
26903
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/counters.js
26660
26904
  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
26905
  var accountCountersOver = /* @__PURE__ */ __name((context) => {
26662
26906
  const { database } = context;
@@ -26681,7 +26925,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
26681
26925
  counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
26682
26926
  }), "countersStoreOver");
26683
26927
 
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
26928
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
26685
26929
  var MENTION_STATUSES = ["found", "linked", "dismissed"];
26686
26930
  var MENTION_QUERY = defineQuery({
26687
26931
  entity: "mention",
@@ -26897,7 +27141,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
26897
27141
  return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
26898
27142
  }, "listPlaces");
26899
27143
 
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
27144
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/mentions.js
26901
27145
  var accountMentionsOver = /* @__PURE__ */ __name((context) => {
26902
27146
  const { database } = context;
26903
27147
  const { findAccountPk: findAccountPk2 } = keysOver(context);
@@ -26932,7 +27176,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
26932
27176
  places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
26933
27177
  }), "mentionsStoreOver");
26934
27178
 
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
27179
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
26936
27180
  var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
26937
27181
  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
27182
  const rows = messageId === void 0 ? read2.all(chatKey) : read2.all(chatKey, messageId);
@@ -26947,7 +27191,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
26947
27191
  }));
26948
27192
  }, "documentLinkMessages");
26949
27193
 
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
27194
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
26951
27195
  var stemmerFor = stemmerCache();
26952
27196
  var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
26953
27197
  if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
@@ -26991,7 +27235,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
26991
27235
  });
26992
27236
  }, "laterSharingRare");
26993
27237
 
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
27238
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/messages.js
26995
27239
  var accountMessagesOver = /* @__PURE__ */ __name((context) => {
26996
27240
  const { database } = context;
26997
27241
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
@@ -27126,7 +27370,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
27126
27370
  laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
27127
27371
  }), "messagesStoreOver");
27128
27372
 
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
27373
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
27130
27374
  var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
27131
27375
  var iso5 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
27132
27376
  var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: accounts2, limit }) => {
@@ -27183,7 +27427,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
27183
27427
  });
27184
27428
  }, "personPreparation");
27185
27429
 
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
27430
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
27187
27431
  var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
27188
27432
  const id2 = Number(uid);
27189
27433
  if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
@@ -27191,7 +27435,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
27191
27435
  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
27436
  }, "personSeenInAccounts");
27193
27437
 
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
27438
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
27195
27439
  var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
27196
27440
  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
27441
  if (!row2)
@@ -27257,7 +27501,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
27257
27501
  return { id: id2, personId, removed: true };
27258
27502
  }, "removeNote");
27259
27503
 
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
27504
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/people.js
27261
27505
  var accountPeopleOver = /* @__PURE__ */ __name((context) => {
27262
27506
  const { database } = context;
27263
27507
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
@@ -27312,6 +27556,16 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
27312
27556
  personOf: /* @__PURE__ */ __name(async (identity) => personOf(context, identity), "personOf"),
27313
27557
  personSeenInAccounts: /* @__PURE__ */ __name(async (uid, accountIds) => personSeenInAccounts(context, uid, accountIds), "personSeenInAccounts"),
27314
27558
  personByUid: /* @__PURE__ */ __name(async (uid) => personByUid(context, uid), "personByUid"),
27559
+ add: /* @__PURE__ */ __name(async ({ name }) => {
27560
+ const text5 = typeof name === "string" ? name.trim() : "";
27561
+ if (!text5 || text5.length > 200)
27562
+ throw new CliError("validation_error", "a person's name takes 1\u2013200 characters");
27563
+ const id2 = write(database, () => {
27564
+ const at = context.now();
27565
+ return Number(database.prepare("INSERT INTO persons (name, owner, created_at, updated_at) VALUES (?, 0, ?, ?) RETURNING id").get(text5, at, at)?.id);
27566
+ });
27567
+ return personByUid(context, String(id2));
27568
+ }, "add"),
27315
27569
  owner: /* @__PURE__ */ __name(async () => {
27316
27570
  try {
27317
27571
  return personByUid(context, String(ownerPerson(database).id));
@@ -27332,13 +27586,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
27332
27586
  };
27333
27587
  }, "peopleStoreOver");
27334
27588
 
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
27589
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
27336
27590
  import { createHash as createHash8 } from "node:crypto";
27337
27591
 
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
27592
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
27339
27593
  import { createHash as createHash7 } from "node:crypto";
27340
27594
 
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
27595
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
27342
27596
  var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
27343
27597
  var AUTHOR_MEASURES = [
27344
27598
  "messages",
@@ -27478,7 +27732,7 @@ var withoutUrls = /* @__PURE__ */ __name((text5) => text5.replace(/\S+/gu, (toke
27478
27732
  var rankingWords = /* @__PURE__ */ __name((text5) => withoutUrls(text5).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
27479
27733
  var rankingQuestion = /* @__PURE__ */ __name((text5) => withoutUrls(text5).includes("?"), "rankingQuestion");
27480
27734
 
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
27735
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
27482
27736
  var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
27483
27737
  var exhausted2 = /* @__PURE__ */ __name((budget) => {
27484
27738
  throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
@@ -27700,7 +27954,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
27700
27954
  };
27701
27955
  }, "rankReplyGraph");
27702
27956
 
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
27957
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
27704
27958
  var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
27705
27959
  var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
27706
27960
  var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
@@ -27778,9 +28032,9 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
27778
28032
  const answer = answers.get(node.pk);
27779
28033
  if (!answer)
27780
28034
  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);
28035
+ const key2 = personKey(answer), list2 = grouped.get(key2) ?? [];
28036
+ list2.push({ pk: answer.pk, related: node.pk, contribution: answer.timestamp - node.timestamp });
28037
+ grouped.set(key2, list2);
27784
28038
  }
27785
28039
  for (const person2 of options.answerers) {
27786
28040
  const rows = grouped.get(personKey({ account: person2, sender: person2.id })) ?? [];
@@ -27798,9 +28052,9 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
27798
28052
  const grouped = /* @__PURE__ */ new Map();
27799
28053
  for (const node of eligible) {
27800
28054
  const key2 = JSON.stringify([personKey(node), node.chatId]);
27801
- const list = grouped.get(key2) ?? [];
27802
- list.push(node);
27803
- grouped.set(key2, list);
28055
+ const list2 = grouped.get(key2) ?? [];
28056
+ list2.push(node);
28057
+ grouped.set(key2, list2);
27804
28058
  }
27805
28059
  for (const stay of stays) {
27806
28060
  check3();
@@ -27845,9 +28099,9 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
27845
28099
  const node = byPk.get(child);
27846
28100
  if (!node || node.timestamp > options.cutoff)
27847
28101
  continue;
27848
- const list = replies.get(parent2) ?? [];
27849
- list.push({ pk: child, related: parent2, contribution: 1 });
27850
- replies.set(parent2, list);
28102
+ const list2 = replies.get(parent2) ?? [];
28103
+ list2.push({ pk: child, related: parent2, contribution: 1 });
28104
+ replies.set(parent2, list2);
27851
28105
  }
27852
28106
  for (const node of nodes.filter((one) => one.selected && one.chatKind === "channel" && one.graph?.reply === null && !one.graph.discussionSource && one.timestamp <= options.cutoff)) {
27853
28107
  check3();
@@ -27874,7 +28128,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
27874
28128
  return { items, evidence, summary, graph: graph.quality };
27875
28129
  }, "calculateAdminStatistics");
27876
28130
 
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
28131
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
27878
28132
  var rankingContextRange = /* @__PURE__ */ __name((root) => {
27879
28133
  const dates = [];
27880
28134
  const visit = /* @__PURE__ */ __name((node, required3) => {
@@ -27896,7 +28150,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
27896
28150
  return dates[0].node.resolution.date;
27897
28151
  }, "rankingContextRange");
27898
28152
 
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
28153
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
27900
28154
  var reactionCounts = /* @__PURE__ */ __name((stored3) => {
27901
28155
  let counts;
27902
28156
  try {
@@ -28191,7 +28445,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
28191
28445
  });
28192
28446
  }, "rankQuery");
28193
28447
 
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
28448
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
28195
28449
  function fail4(message2, reason = "query.too-large") {
28196
28450
  throw new CliError("validation_error", message2, { reason, complete: false });
28197
28451
  }
@@ -28368,7 +28622,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
28368
28622
  return result;
28369
28623
  }), "adminStatisticsQuery");
28370
28624
 
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
28625
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
28372
28626
  var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
28373
28627
  if (!execution.accounts.length)
28374
28628
  return { conversations: [], chats: [] };
@@ -28386,7 +28640,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
28386
28640
  return { conversations: conversations2, chats: chats2 };
28387
28641
  }, "conversationEligibility");
28388
28642
 
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
28643
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
28390
28644
  import { createHash as createHash9 } from "node:crypto";
28391
28645
  var EVIDENCE_BYTES = 64 * 1024;
28392
28646
  var FINGERPRINT_BYTES = 8 * 1024 * 1024;
@@ -28536,7 +28790,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
28536
28790
  return result;
28537
28791
  }, "rankingEvidence");
28538
28792
 
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
28793
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/queries.js
28540
28794
  var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
28541
28795
  const mailIndexed = /* @__PURE__ */ __name((execution) => {
28542
28796
  if (execution.corpus === "mail")
@@ -28555,7 +28809,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
28555
28809
  };
28556
28810
  }, "queriesStoreOver");
28557
28811
 
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
28812
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
28559
28813
  var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
28560
28814
  const { database, now: now2 } = context;
28561
28815
  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 +28848,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
28594
28848
  }));
28595
28849
  }, "chatEventsOf");
28596
28850
 
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
28851
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
28598
28852
  import { createHash as createHash10 } from "node:crypto";
28599
28853
 
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
28854
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/domain/calendar.js
28601
28855
  var calendarKey = /* @__PURE__ */ __name((zone, by) => {
28602
28856
  const format = new Intl.DateTimeFormat("en-CA", {
28603
28857
  timeZone: zone,
@@ -28612,7 +28866,7 @@ var calendarKey = /* @__PURE__ */ __name((zone, by) => {
28612
28866
  };
28613
28867
  }, "calendarKey");
28614
28868
 
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
28869
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/domain/retention.js
28616
28870
  var RETENTION_TOLERANCE = 864e5;
28617
28871
  var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
28618
28872
  const { since, until, cutoff, checkpoints, within, limit, by } = options;
@@ -28666,7 +28920,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
28666
28920
  return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
28667
28921
  }, "retentionCohorts");
28668
28922
 
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
28923
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
28670
28924
  var iso6 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
28671
28925
  var week = /* @__PURE__ */ __name((day) => {
28672
28926
  const date3 = /* @__PURE__ */ new Date(`${day}T00:00:00Z`);
@@ -28802,7 +29056,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
28802
29056
  };
28803
29057
  }, "retentionQuery");
28804
29058
 
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
29059
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
28806
29060
  var iso7 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
28807
29061
  var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
28808
29062
  ...isBot === void 0 ? {} : { bot: isBot },
@@ -28933,7 +29187,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
28933
29187
  lastCount: memberCountsOf(context, pk).at(-1) ?? null
28934
29188
  })), "trackedChats");
28935
29189
 
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
29190
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/roster.js
28937
29191
  var rosterStoreOver = /* @__PURE__ */ __name((context) => {
28938
29192
  const { database } = context;
28939
29193
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
@@ -28989,7 +29243,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
28989
29243
  };
28990
29244
  }, "rosterStoreOver");
28991
29245
 
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
29246
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
28993
29247
  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
29248
  var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
28995
29249
  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 +29267,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
29013
29267
  }
29014
29268
  }, "backfillNormalized");
29015
29269
 
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
29270
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
29017
29271
  var INDEX2 = "message_words";
29018
29272
  var searchIndexState2 = /* @__PURE__ */ __name((database) => {
29019
29273
  const row2 = indexRow(database, INDEX2);
@@ -29140,7 +29394,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
29140
29394
  });
29141
29395
  }, "resetSearchIndex");
29142
29396
 
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
29397
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
29144
29398
  var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
29145
29399
  const filled2 = { stemmed: 0, drained: 0 };
29146
29400
  const before2 = stemsState(database);
@@ -29235,7 +29489,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
29235
29489
  return resetStems(database, { now: now2 });
29236
29490
  }, "followDefaultStemmers");
29237
29491
 
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
29492
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
29239
29493
  var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
29240
29494
  var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
29241
29495
  const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
@@ -29257,7 +29511,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
29257
29511
  });
29258
29512
  }, "termCandidates");
29259
29513
 
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
29514
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/search-index.js
29261
29515
  var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
29262
29516
  const { database } = context;
29263
29517
  const stemmerFor2 = stemmerCache();
@@ -29279,7 +29533,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
29279
29533
  };
29280
29534
  }, "searchIndexStoreOver");
29281
29535
 
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
29536
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
29283
29537
  var HISTORY_KEPT = 1e3;
29284
29538
  var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
29285
29539
  var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
@@ -29348,7 +29602,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
29348
29602
  return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
29349
29603
  }, "clearHistory");
29350
29604
 
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
29605
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/searches.js
29352
29606
  var searchesStoreOver = /* @__PURE__ */ __name((context) => {
29353
29607
  const { database } = context;
29354
29608
  return {
@@ -29372,7 +29626,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
29372
29626
  };
29373
29627
  }, "searchesStoreOver");
29374
29628
 
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
29629
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
29376
29630
  var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
29377
29631
  var ACTION_OUTCOMES = ["ok", "refused", "failed"];
29378
29632
  var CODE = /^[a-z][a-z0-9_]{0,63}$/;
@@ -29415,7 +29669,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
29415
29669
  };
29416
29670
  }, "agentActionsStoreOver");
29417
29671
 
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
29672
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
29419
29673
  var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
29420
29674
  }) => {
29421
29675
  const { database, now: now2 } = context;
@@ -29474,8 +29728,15 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
29474
29728
  };
29475
29729
  }, "botUpdateStoreOver");
29476
29730
 
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
29731
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
29478
29732
  var DAY4 = 864e5;
29733
+ var accountsOf = /* @__PURE__ */ __name((filter) => {
29734
+ if (filter.accountIds !== void 0 && filter.accountId !== void 0)
29735
+ throw new CliError("validation_error", "an event filter takes accountId or accountIds, not both");
29736
+ if (filter.accountIds?.length === 0)
29737
+ throw new CliError("validation_error", "accountIds names no account");
29738
+ return filter.accountIds ?? (filter.accountId === void 0 ? void 0 : [filter.accountId]);
29739
+ }, "accountsOf");
29479
29740
  var listEvents = /* @__PURE__ */ __name((database, filter) => {
29480
29741
  const clauses = ["e.deleted_at IS NULL"];
29481
29742
  const params = [];
@@ -29507,24 +29768,39 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
29507
29768
  clauses.push("e.starts_at >= ?");
29508
29769
  params.push(filter.startsFrom - DAY4);
29509
29770
  }
29771
+ if (filter.id !== void 0) {
29772
+ clauses.push("e.id = ?");
29773
+ params.push(filter.id);
29774
+ }
29510
29775
  if (filter.calendarId !== void 0) {
29511
29776
  clauses.push(entries("ce.calendar_id = ?"));
29512
29777
  params.push(filter.calendarId);
29513
29778
  }
29514
- if (filter.accountId !== void 0) {
29515
- clauses.push(entries("c.account_id = ?"));
29516
- params.push(filter.accountId);
29517
- }
29779
+ const accounts2 = accountsOf(filter);
29780
+ const inAccounts = /* @__PURE__ */ __name((column2) => {
29781
+ if (accounts2 === void 0)
29782
+ return "";
29783
+ for (const id2 of accounts2)
29784
+ params.push(id2);
29785
+ return `${column2} IN (${accounts2.map(() => "?").join(", ")})`;
29786
+ }, "inAccounts");
29787
+ if (accounts2 !== void 0)
29788
+ clauses.push(entries(inAccounts("c.account_id")));
29789
+ const ofKind = /* @__PURE__ */ __name((kinds2) => {
29790
+ for (const kind3 of kinds2)
29791
+ params.push(kind3);
29792
+ const scope3 = accounts2 === void 0 ? "" : ` AND ${inAccounts("c.account_id")}`;
29793
+ return entries(`coalesce(ce.event_type, 'default') IN (${kinds2.map(() => "?").join(", ")})${scope3}`);
29794
+ }, "ofKind");
29795
+ if (filter.eventType !== void 0)
29796
+ clauses.push(ofKind([filter.eventType]));
29797
+ if (filter.notEventTypes?.length)
29798
+ clauses.push(`NOT ${ofKind(filter.notEventTypes)}`);
29518
29799
  if (filter.personId !== void 0) {
29519
29800
  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
29801
  params.push(filter.personId);
29521
29802
  }
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");
29803
+ const account = /* @__PURE__ */ __name((alias2) => accounts2 === void 0 ? "" : ` AND ${inAccounts(`${alias2}.account_id`)}`, "account");
29528
29804
  if (filter.changedSince !== void 0) {
29529
29805
  const since = filter.changedSince;
29530
29806
  const own = account("c");
@@ -29541,16 +29817,18 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
29541
29817
  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
29818
  ORDER BY r.created_at, r.id LIMIT 1) = 1)))`);
29543
29819
  }
29544
- if (filter.overlapping) {
29820
+ if (filter.overlapping !== void 0) {
29545
29821
  const busy = /* @__PURE__ */ __name((event) => `${event}.deleted_at IS NULL AND ${event}.status <> 'cancelled' AND ${event}.all_day = 0
29546
29822
  AND ${event}.starts_at IS NOT NULL AND ${event}.ends_at IS NOT NULL AND EXISTS (SELECT 1 FROM calendar_entries
29547
29823
  bce JOIN calendars bc ON bc.id = bce.calendar_id WHERE bce.event_id = ${event}.id${account("bc")}
29548
29824
  AND bce.deleted_at IS NULL AND bce.status <> 'cancelled' AND coalesce(bce.own_response, '') <> 'declined'
29549
- AND coalesce(bce.transparency, '') <> 'transparent')`, "busy");
29825
+ AND coalesce(bce.transparency, '') <> 'transparent'
29826
+ AND coalesce(bce.event_type, '') <> 'working-location')`, "busy");
29550
29827
  const own = busy("e");
29551
29828
  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")})`);
29829
+ const clash = `${own} AND EXISTS (SELECT 1 FROM events e2 WHERE e2.id <> e.id AND e2.starts_at < e.ends_at
29830
+ AND e2.ends_at > e.starts_at AND e2.starts_at >= e.starts_at - ? AND ${busy("e2")})`;
29831
+ clauses.push(filter.overlapping ? clash : `NOT (${clash})`);
29554
29832
  }
29555
29833
  const limit = filter.limit ?? 100;
29556
29834
  const offset = filter.offset ?? 0;
@@ -29559,7 +29837,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
29559
29837
  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
29838
  }, "listEvents");
29561
29839
 
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
29840
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
29563
29841
  var calendarOf = /* @__PURE__ */ __name((row2) => ({
29564
29842
  id: Number(row2.id),
29565
29843
  accountId: Number(row2.account_id),
@@ -30139,7 +30417,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
30139
30417
  };
30140
30418
  }, "eventStoreOver");
30141
30419
 
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
30420
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
30143
30421
  var CATALOG_QUERY = defineQuery({
30144
30422
  entity: "document",
30145
30423
  backend: "sql",
@@ -30381,7 +30659,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
30381
30659
  };
30382
30660
  }, "catalogStoreOver");
30383
30661
 
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
30662
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/context/evidence.js
30385
30663
  import { createHash as createHash11 } from "node:crypto";
30386
30664
  var CONTEXT_MAX_READ_BYTES = 262144;
30387
30665
  var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
@@ -30479,7 +30757,7 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
30479
30757
  return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
30480
30758
  }, "contextEvidenceRequest");
30481
30759
 
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
30760
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
30483
30761
  var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
30484
30762
  var field3 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
30485
30763
  CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
@@ -30492,7 +30770,7 @@ var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
30492
30770
  THEN 'source-modified' ELSE 'stored-update' END`;
30493
30771
  var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field3("sourceUrl")})`;
30494
30772
 
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
30773
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
30496
30774
  var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
30497
30775
  const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
30498
30776
  signal?.throwIfAborted();
@@ -30591,7 +30869,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
30591
30869
  });
30592
30870
  }, "readMeetingContextEvidence");
30593
30871
 
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
30872
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
30595
30873
  var corpora = {
30596
30874
  message: {
30597
30875
  table: "messages",
@@ -30802,6 +31080,16 @@ var contextRecordOf = /* @__PURE__ */ __name((database, ref3) => {
30802
31080
  revision: row3.revision == null ? null : Number(row3.revision)
30803
31081
  } : null;
30804
31082
  }
31083
+ const note2 = /^note:([1-9]\d*)$/.exec(ref3);
31084
+ if (note2) {
31085
+ const row3 = database.prepare("SELECT title, body, revision FROM notes WHERE id=? AND deleted_at IS NULL").get(Number(note2[1]));
31086
+ return row3 ? {
31087
+ ref: ref3,
31088
+ title: row3.title == null ? null : String(row3.title),
31089
+ text: String(row3.body),
31090
+ revision: Number(row3.revision)
31091
+ } : null;
31092
+ }
30805
31093
  let at;
30806
31094
  try {
30807
31095
  at = parseLocator(ref3);
@@ -30820,7 +31108,7 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
30820
31108
  }
30821
31109
  }), "contextRecordsOver");
30822
31110
 
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
31111
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
30824
31112
  var NOTE_FIELDS = [
30825
31113
  "text",
30826
31114
  "exact",
@@ -31250,7 +31538,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
31250
31538
  };
31251
31539
  }, "noteSearchOver");
31252
31540
 
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
31541
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
31254
31542
  var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
31255
31543
  var inEventAccounts = /* @__PURE__ */ __name((event) => searchableCopy(event, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
31256
31544
  var EVENT_CORPUS = {
@@ -31382,20 +31670,26 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
31382
31670
  };
31383
31671
  }, "eventSearchOver");
31384
31672
 
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
31673
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
31386
31674
  var EVIDENCE_FINDINGS_KIND = "evidence_findings";
31387
31675
  var reference = /* @__PURE__ */ __name((raw) => {
31388
- if (/^document:[1-9]\d*$/.test(raw))
31676
+ if (/^(document|note):[1-9]\d*$/.test(raw))
31389
31677
  return raw;
31390
31678
  try {
31391
31679
  return formatLocator(parseLocator(raw));
31392
31680
  } catch {
31393
- throw new CliError("validation_error", "finding evidence is a msg: or document: reference");
31681
+ throw new CliError("validation_error", "finding evidence is a msg:, document: or note: reference");
31394
31682
  }
31395
31683
  }, "reference");
31396
- var validateEvidenceFindings = /* @__PURE__ */ __name((input) => validateFindings(input, { plural: "evidence findings", singular: "evidence finding", cited: "reference", reference }), "validateEvidenceFindings");
31684
+ var validateEvidenceFindings = /* @__PURE__ */ __name((input) => validateFindings(input, {
31685
+ plural: "evidence findings",
31686
+ singular: "evidence finding",
31687
+ cited: "reference",
31688
+ reference,
31689
+ anySubject: true
31690
+ }), "validateEvidenceFindings");
31397
31691
 
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
31692
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/domain/moment.js
31399
31693
  var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
31400
31694
  try {
31401
31695
  return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
@@ -31407,7 +31701,7 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
31407
31701
  }
31408
31702
  }, "calendarMoment");
31409
31703
 
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
31704
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
31411
31705
  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
31706
  var iso8 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
31413
31707
  var oneOf4 = /* @__PURE__ */ __name((value, allowed, what) => {
@@ -31423,7 +31717,7 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
31423
31717
  type: row2.type,
31424
31718
  statement: String(row2.statement),
31425
31719
  status: row2.status,
31426
- project: row2.project_id == null ? null : `project:${row2.project_id}`,
31720
+ ...projectOf(database, row2),
31427
31721
  ...subjectOf(database, row2),
31428
31722
  occurredAt: row2.occurred_at == null ? null : iso8(row2.occurred_at),
31429
31723
  supersedes: row2.supersedes_id == null ? null : `fact:${row2.supersedes_id}`,
@@ -31556,7 +31850,7 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
31556
31850
  };
31557
31851
  }, "factsStoreOver");
31558
31852
 
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
31853
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
31560
31854
  var invalid4 = /* @__PURE__ */ __name((message2) => {
31561
31855
  throw new CliError("validation_error", message2);
31562
31856
  }, "invalid");
@@ -31572,13 +31866,19 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
31572
31866
  const cited = /* @__PURE__ */ __name((input, cite) => {
31573
31867
  const seen = /* @__PURE__ */ new Map();
31574
31868
  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);
31869
+ let projectId2 = null;
31870
+ if (finding.project !== void 0) {
31871
+ const project = requiredThing(database, finding.project, "the project");
31872
+ if (project.type !== "project")
31873
+ return invalid4("a finding needs an owner project");
31874
+ 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);
31875
+ if (!projectRow)
31876
+ throw new CliError("not_found", "the owner project is unavailable");
31877
+ seen.set(finding.project, projectRow);
31878
+ projectId2 = String(project.id);
31879
+ }
31880
+ if (finding.subject !== void 0)
31881
+ seen.set(finding.subject, requiredThing(database, finding.subject, "the subject"));
31582
31882
  if (finding.kind === "task" && finding.assignee) {
31583
31883
  const person2 = requiredThing(database, finding.assignee, "the assignee");
31584
31884
  if (person2.type !== "person")
@@ -31589,7 +31889,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
31589
31889
  seen.set(finding.assignee, personRow);
31590
31890
  }
31591
31891
  for (const evidence of finding.evidence)
31592
- cite(evidence, finding, String(project.id), seen);
31892
+ cite(evidence, finding, projectId2, seen);
31593
31893
  }
31594
31894
  return seen;
31595
31895
  }, "cited");
@@ -31605,12 +31905,15 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
31605
31905
  const fact = facts2.add({
31606
31906
  type: finding.type,
31607
31907
  statement: finding.statement,
31608
- project: finding.project,
31908
+ ...finding.project === void 0 ? {} : { project: finding.project },
31909
+ ...finding.subject === void 0 ? {} : { subject: finding.subject },
31609
31910
  evidence,
31610
31911
  by: agent
31611
31912
  });
31612
31913
  return facts2.accept(fact.ref).ref;
31613
31914
  }
31915
+ if (finding.project === void 0)
31916
+ return invalid4("a task finding names the project the task goes in");
31614
31917
  const task = tasks2.create({
31615
31918
  project: finding.project,
31616
31919
  title: finding.title,
@@ -31646,12 +31949,13 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
31646
31949
  return { snapshot: snapshot2, snapshotParts, previous, outcomes };
31647
31950
  }, "findingsCoreOver");
31648
31951
 
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
31952
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
31650
31953
  var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
31651
31954
  var PROPOSAL_VERDICTS = ["useful", "not_useful"];
31652
31955
  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
31956
  var json2 = /* @__PURE__ */ __name((value) => value == null ? null : JSON.parse(String(value)), "json");
31957
+ 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`;
31958
+ 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
31959
  var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
31656
31960
  const { database, now: now2 } = context;
31657
31961
  const actionOf = /* @__PURE__ */ __name((row2) => {
@@ -31663,7 +31967,7 @@ var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
31663
31967
  target: row2.target_type == null ? null : referenceOfThing(database, storedThing(row2.target_type, row2.target_id)) ?? null,
31664
31968
  payload: json2(row2.payload),
31665
31969
  reason: row2.reason == null ? null : String(row2.reason),
31666
- status: row2.status,
31970
+ status: row2.shown_status,
31667
31971
  proposedBy: {
31668
31972
  type: row2.proposed_by_type,
31669
31973
  id: String(row2.proposed_by_id),
@@ -31727,7 +32031,7 @@ var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
31727
32031
  list: /* @__PURE__ */ __name(({ status, limit = 100 } = {}) => {
31728
32032
  if (status !== void 0 && !PROPOSAL_STATUSES.includes(status))
31729
32033
  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);
32034
+ 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
32035
  }, "list"),
31732
32036
  approve: /* @__PURE__ */ __name((id2, result, by) => decide2(id2, "approved", result, by), "approve"),
31733
32037
  reject: /* @__PURE__ */ __name((id2) => decide2(id2, "rejected"), "reject"),
@@ -31792,7 +32096,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
31792
32096
  };
31793
32097
  }, "proposedActionsStoreOver");
31794
32098
 
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
32099
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
31796
32100
  var stale = /* @__PURE__ */ __name(() => {
31797
32101
  throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
31798
32102
  reason: "evidence-findings.stale"
@@ -31816,13 +32120,15 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31816
32120
  return invalid5("stored findings exceed the read budget");
31817
32121
  return proposals.get(id2);
31818
32122
  }, "load");
32123
+ const projectOf2 = /* @__PURE__ */ __name((input) => input.findings.find((finding) => finding.project)?.project ?? null, "projectOf");
31819
32124
  const view = /* @__PURE__ */ __name((proposal) => {
31820
32125
  const input = proposal.payload;
31821
- if (!input || !proposal.target || !["proposed", "approved"].includes(proposal.status))
32126
+ if (!input || !["proposed", "approved", "rejected"].includes(proposal.status))
31822
32127
  return invalid5("invalid stored findings batch");
31823
32128
  return {
31824
32129
  id: proposal.id,
31825
- project: proposal.target,
32130
+ project: projectOf2(input),
32131
+ subject: proposal.target,
31826
32132
  input: { schemaVersion: 1, key: input.key, extractor: input.extractor, findings: input.findings },
31827
32133
  fingerprint: findingHash({ input, author: proposal.proposedBy.id }),
31828
32134
  status: proposal.status === "proposed" ? "proposed" : "reviewed",
@@ -31875,9 +32181,12 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31875
32181
  return {
31876
32182
  stage: /* @__PURE__ */ __name(async (raw, rawAgent) => {
31877
32183
  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");
32184
+ const projects2 = new Set(input.findings.flatMap((finding) => finding.project ?? []));
32185
+ if (projects2.size > 1)
32186
+ return invalid5("an evidence findings batch is about one project at most");
32187
+ const subjects = new Set(input.findings.map((finding) => finding.subject));
32188
+ const shared = subjects.size === 1 ? [...subjects][0] : void 0;
32189
+ const target = shared ?? [...projects2][0];
31881
32190
  const by = findingsAgent(rawAgent);
31882
32191
  return write(database, () => {
31883
32192
  const { actor } = authorActor(context, by);
@@ -31897,21 +32206,22 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31897
32206
  return view(proposals.propose({
31898
32207
  kind: EVIDENCE_FINDINGS_KIND,
31899
32208
  by,
31900
- target: [...projects2][0],
32209
+ ...target === void 0 ? {} : { target },
31901
32210
  payload: { ...input, inputHash, snapshotHash, snapshotParts, agentModel: by.model ?? null }
31902
32211
  }));
31903
32212
  });
31904
32213
  }, "stage"),
31905
32214
  get: /* @__PURE__ */ __name(async (id2) => view(load(id2)), "get"),
32215
+ sources: /* @__PURE__ */ __name(async (id2) => sourcesOfReferences(database, view(load(id2)).input.findings.flatMap((finding) => finding.evidence.map((one) => one.reference))), "sources"),
31906
32216
  list: /* @__PURE__ */ __name(async ({ project, limit = 20, offset = 0, status } = {}) => {
31907
32217
  if (status !== void 0 && status !== "proposed" && status !== "reviewed")
31908
32218
  return invalid5("finding status is proposed or reviewed");
31909
32219
  if (!Number.isSafeInteger(limit) || limit < 1 || limit > 50 || !Number.isSafeInteger(offset) || offset < 0)
31910
32220
  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)
32221
+ const projectId2 = project === void 0 ? null : /^project:([1-9]\d*)$/.exec(project)?.[1];
32222
+ if (projectId2 === void 0)
31913
32223
  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);
32224
+ 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
32225
  return { items: ids.slice(0, limit).map((row2) => view(load(String(row2.id)))), hasMore: ids.length > limit };
31916
32226
  }, "list"),
31917
32227
  review: /* @__PURE__ */ __name(async (id2, decision) => write(database, () => {
@@ -31937,7 +32247,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31937
32247
  } else {
31938
32248
  const chosen = { ...batch.input, findings: batch.input.findings.filter((f) => accepted.includes(f.id)) };
31939
32249
  const now2 = core.snapshotParts(chosen, cite());
31940
- if (Object.entries(now2).some(([key2, hash2]) => parts2[key2] !== hash2))
32250
+ if (Object.entries(now2).some(([key2, hash2]) => !key2.startsWith("project:") && parts2[key2] !== hash2))
31941
32251
  return stale();
31942
32252
  }
31943
32253
  }
@@ -31958,7 +32268,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
31958
32268
  };
31959
32269
  }, "evidenceFindingsStoreOver");
31960
32270
 
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
32271
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
31962
32272
  var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
31963
32273
  var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
31964
32274
  rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
@@ -32011,7 +32321,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
32011
32321
  }, "forPerson")
32012
32322
  }), "involvementStoreOver");
32013
32323
 
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
32324
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
32015
32325
  import { createHash as createHash12 } from "node:crypto";
32016
32326
  var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
32017
32327
  var id = /* @__PURE__ */ __name((value) => {
@@ -32045,10 +32355,10 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
32045
32355
  };
32046
32356
  }, "linkOf");
32047
32357
  return {
32048
- linkMeetingProject: /* @__PURE__ */ __name(async (key2, meetingId, projectId, options = {}) => {
32358
+ linkMeetingProject: /* @__PURE__ */ __name(async (key2, meetingId, projectId2, options = {}) => {
32049
32359
  check2(options.signal);
32050
32360
  const meeting = id(meetingId);
32051
- const project = id(projectId);
32361
+ const project = id(projectId2);
32052
32362
  const by = options.by ?? "owner";
32053
32363
  if (by !== "owner" && by !== "agent")
32054
32364
  throw new CliError("validation_error", "choose owner or agent provenance");
@@ -32097,16 +32407,16 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
32097
32407
  };
32098
32408
  }, "meetingProjectsStoreOver");
32099
32409
 
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
32410
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
32101
32411
  import { createHash as createHash15 } from "node:crypto";
32102
32412
 
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
32413
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
32104
32414
  import { createHash as createHash14 } from "node:crypto";
32105
32415
 
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
32416
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
32107
32417
  import { createHash as createHash13 } from "node:crypto";
32108
32418
 
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
32419
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
32110
32420
  var consolidationId = /* @__PURE__ */ __name((value, field4) => {
32111
32421
  if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
32112
32422
  throw new CliError("validation_error", `${field4} must be a positive canonical tag id`);
@@ -32157,7 +32467,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
32157
32467
  return input;
32158
32468
  }, "consolidationApplyInput");
32159
32469
 
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
32470
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
32161
32471
  var receiptOf = /* @__PURE__ */ __name((row2) => ({
32162
32472
  id: String(row2.id),
32163
32473
  sourceId: String(row2.source_id),
@@ -32232,7 +32542,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
32232
32542
  }, { beforeCommit: check3 });
32233
32543
  }, "applyTagConsolidation");
32234
32544
 
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
32545
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
32236
32546
  var selections = [
32237
32547
  ["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
32238
32548
  ["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
@@ -32376,7 +32686,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
32376
32686
  };
32377
32687
  }, "previewRows");
32378
32688
 
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
32689
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
32380
32690
  var kinds = ["project", "tag", "topic"];
32381
32691
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
32382
32692
  if (signal?.aborted)
@@ -32640,7 +32950,7 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
32640
32950
  };
32641
32951
  }, "vocabularyStoreOver");
32642
32952
 
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
32953
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
32644
32954
  var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
32645
32955
  var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
32646
32956
  var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
@@ -32799,7 +33109,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
32799
33109
  scope: row2.scope,
32800
33110
  createdAt: iso10(row2.created_at)
32801
33111
  }), "organizationOf");
32802
- const projectOf = /* @__PURE__ */ __name((row2) => ({
33112
+ const projectOf2 = /* @__PURE__ */ __name((row2) => ({
32803
33113
  id: String(row2.id),
32804
33114
  ref: `project:${row2.id}`,
32805
33115
  key: String(row2.key),
@@ -32870,7 +33180,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
32870
33180
  return row2;
32871
33181
  }, "openTask");
32872
33182
  const canonicalTagName = /* @__PURE__ */ __name((name) => canonicalTagNamed(database, name)?.name ?? normalizeTag(name), "canonicalTagName");
32873
- const tagsOf2 = /* @__PURE__ */ __name((list) => [...new Set(list.map(canonicalTagName))], "tagsOf");
33183
+ const tagsOf2 = /* @__PURE__ */ __name((list2) => [...new Set(list2.map(canonicalTagName))], "tagsOf");
32874
33184
  return {
32875
33185
  ...vocabularyStoreOver(context),
32876
33186
  ...meetingProjectsStoreOver(context),
@@ -33034,7 +33344,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
33034
33344
  }
33035
33345
  const at = now2();
33036
33346
  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);
33347
+ return projectOf2(row2);
33038
33348
  }), "addProject"),
33039
33349
  projects: /* @__PURE__ */ __name(async (query) => {
33040
33350
  const asksKind = query !== void 0 && walkQuery(query.root).some((node) => node.field === "kind");
@@ -33048,7 +33358,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
33048
33358
  scope: { type: "enum", sql: "scope" },
33049
33359
  created_at: { type: "time", sql: "created_at" }
33050
33360
  });
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);
33361
+ 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
33362
  }, "projects"),
33053
33363
  relate: /* @__PURE__ */ __name(async (key2, input) => {
33054
33364
  const from2 = related(key2, input.from, true);
@@ -33162,7 +33472,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
33162
33472
  return key2.padEnd(3, "X");
33163
33473
  }, "projectKey");
33164
33474
 
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
33475
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
33166
33476
  var DAY5 = 864e5;
33167
33477
  var SETTING4 = "logs_pruned_at";
33168
33478
  var LOG_RETENTION = { agentActionsMs: 90 * DAY5, botUpdatePayloadsMs: 30 * DAY5 };
@@ -33189,7 +33499,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
33189
33499
  };
33190
33500
  }, "logPruner");
33191
33501
 
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
33502
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
33193
33503
  var stale2 = /* @__PURE__ */ __name(() => {
33194
33504
  throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
33195
33505
  reason: "meeting-findings.stale"
@@ -33221,7 +33531,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
33221
33531
  }, "load");
33222
33532
  const view = /* @__PURE__ */ __name((proposal) => {
33223
33533
  const input = proposal.payload;
33224
- if (!input || !proposal.account || !["proposed", "approved"].includes(proposal.status))
33534
+ if (!input || !proposal.account || !["proposed", "approved", "rejected"].includes(proposal.status))
33225
33535
  return invalid6("invalid stored findings batch");
33226
33536
  return {
33227
33537
  id: proposal.id,
@@ -33242,11 +33552,11 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
33242
33552
  const core = findingsCoreOver(context, MEETING_FINDINGS_KIND);
33243
33553
  const snapshot2 = /* @__PURE__ */ __name((account, input) => {
33244
33554
  let readBytes = 0;
33245
- return core.snapshot(input, (evidence, finding, projectId, seen) => {
33555
+ return core.snapshot(input, (evidence, finding, projectId2, seen) => {
33246
33556
  const parsed2 = parseMeetingReference(evidence.reference);
33247
33557
  if (parsed2.accountId !== account)
33248
33558
  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);
33559
+ 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
33560
  if (!membership)
33251
33561
  return invalid6("each cited meeting needs confirmed membership in the finding's project");
33252
33562
  seen.set(`${finding.project}/${parsed2.meetingId}`, membership);
@@ -33358,7 +33668,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
33358
33668
  };
33359
33669
  }, "meetingFindingsStoreOver");
33360
33670
 
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
33671
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
33362
33672
  var RANK_BATCH = 512;
33363
33673
  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
33674
  var limitOf = /* @__PURE__ */ __name((value, name, max = 1e3) => {
@@ -33629,7 +33939,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
33629
33939
  }
33630
33940
  }), "meetingVectorsOver");
33631
33941
 
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
33942
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
33633
33943
  var OTHER_SOURCES = ["document", "note", "email"];
33634
33944
  var TEXTS = {
33635
33945
  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 +34040,11 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
33730
34040
  };
33731
34041
  }, "sourceMentionStoreOver");
33732
34042
 
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
34043
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
33734
34044
  import { mkdirSync, statSync, writeFileSync } from "node:fs";
33735
34045
  import { dirname } from "node:path";
33736
34046
 
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
34047
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
33738
34048
  import { readFileSync as readFileSync3 } from "node:fs";
33739
34049
  var CLIENTS_SETTING = "clients";
33740
34050
  var coreVersion = (() => {
@@ -33792,7 +34102,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
33792
34102
  return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
33793
34103
  }, "refusalAdvice");
33794
34104
 
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
34105
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
33796
34106
  var GENERATED = [
33797
34107
  {
33798
34108
  "name": "20261010184427_initial",
@@ -34678,10 +34988,17 @@ WHERE json_type(params, '$.selection') = 'object';`
34678
34988
  "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
34989
  "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
34990
  ]
34991
+ },
34992
+ {
34993
+ "name": "20261101011859_version-43-memory-project",
34994
+ "statements": [
34995
+ "ALTER TABLE `memories` ADD `project_id` integer REFERENCES projects(id);",
34996
+ "CREATE INDEX `memories_by_project_id` ON `memories` (`project_id`);"
34997
+ ]
34681
34998
  }
34682
34999
  ];
34683
35000
 
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
35001
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
34685
35002
  var MANIFEST = [
34686
35003
  { name: "20261010184427_initial", version: 1, minCompatible: 1 },
34687
35004
  { name: "20261011035353_version-2-facts", version: 2, minCompatible: 1 },
@@ -34737,7 +35054,8 @@ var MANIFEST = [
34737
35054
  { name: "20261030114008_version-39-email-locations", version: 39, minCompatible: 34 },
34738
35055
  { name: "20261030225520_version-40-note-trigrams", version: 40, minCompatible: 34 },
34739
35056
  { name: "20261031230945_version-41-task-fields", version: 41, minCompatible: 34 },
34740
- { name: "20261101002523_version-42-task-revision", version: 42, minCompatible: 34 }
35057
+ { name: "20261101002523_version-42-task-revision", version: 42, minCompatible: 34 },
35058
+ { name: "20261101011859_version-43-memory-project", version: 43, minCompatible: 34 }
34741
35059
  ];
34742
35060
  var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated = GENERATED) => {
34743
35061
  const migrations = [];
@@ -34761,7 +35079,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
34761
35079
  return migrations;
34762
35080
  }, "generatedMigrations");
34763
35081
 
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
35082
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/migrations.js
34765
35083
  var MIGRATIONS = generatedMigrations();
34766
35084
  var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
34767
35085
  version INTEGER PRIMARY KEY,
@@ -34814,7 +35132,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
34814
35132
  }
34815
35133
  }, "migrate");
34816
35134
 
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
35135
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
34818
35136
  var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
34819
35137
  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
35138
  if (pending.get(0, 1) === void 0)
@@ -34836,7 +35154,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
34836
35154
  }
34837
35155
  }, "fillJoinKeys");
34838
35156
 
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
35157
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
34840
35158
  var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
34841
35159
  const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
34842
35160
  try {
@@ -34849,8 +35167,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
34849
35167
  }, "openSqlite");
34850
35168
  var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
34851
35169
  quietSqliteWarning();
34852
- const { drizzle } = await import("./node-S3VEQNTE.js");
34853
- const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-3DNWF2BW.js");
35170
+ const { drizzle } = await import("./node-7JHC5K77.js");
35171
+ const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-LYJEK46T.js");
34854
35172
  const client = await nodeClient(path, { readOnly });
34855
35173
  try {
34856
35174
  return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
@@ -34860,8 +35178,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
34860
35178
  }
34861
35179
  }, "openUnderNode");
34862
35180
  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");
35181
+ const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-UN2UJ6SI.js");
35182
+ const { drizzle } = await import("./bun-ZGZVAJU2.js");
34865
35183
  const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
34866
35184
  try {
34867
35185
  return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
@@ -34871,7 +35189,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
34871
35189
  }
34872
35190
  }, "openUnderBun");
34873
35191
 
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
35192
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
34875
35193
  var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
34876
35194
  const ours = MIGRATIONS.at(-1)?.version ?? 0;
34877
35195
  if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
@@ -34886,7 +35204,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
34886
35204
  throw new CliError("configuration_error", `The store requires schema ${minCompatible}, but this tool supports ${ours}; ${refusalAdvice(storeClients(database), command, version)}`);
34887
35205
  }, "assertReadCompatible");
34888
35206
 
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
35207
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
34890
35208
  var BACKFILL_ON_OPEN = 5e3;
34891
35209
  var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
34892
35210
  var createWritable = /* @__PURE__ */ __name((file) => {
@@ -34942,10 +35260,10 @@ var openStoreContext = /* @__PURE__ */ __name(async ({ path, env, now: now2 = Da
34942
35260
  }
34943
35261
  }, "openStoreContext");
34944
35262
 
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
35263
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
34946
35264
  import { createHash as createHash16 } from "node:crypto";
34947
35265
 
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
35266
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
34949
35267
  var text3 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
34950
35268
  var ref = text3(2048);
34951
35269
  var timestamp2 = pipe(number(), safeInteger(), minValue(0));
@@ -35011,7 +35329,7 @@ var projectAnnotationsSchema = strictObject({
35011
35329
  }))
35012
35330
  });
35013
35331
 
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
35332
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
35015
35333
  var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
35016
35334
  var invalid7 = /* @__PURE__ */ __name((field4) => {
35017
35335
  throw new CliError("validation_error", `invalid project annotations.${field4}`);
@@ -35115,7 +35433,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
35115
35433
  invalid7("external.unused");
35116
35434
  }, "validateProjectAnnotationsGraph");
35117
35435
 
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
35436
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
35119
35437
  var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
35120
35438
  var ref2 = pipe(string(), minLength(1), maxLength(2048));
35121
35439
  var targetSchema = strictObject({
@@ -35221,7 +35539,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
35221
35539
  };
35222
35540
  }, "planBoundProjectAnnotations");
35223
35541
 
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
35542
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
35225
35543
  import { createHash as createHash17 } from "node:crypto";
35226
35544
  var text4 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
35227
35545
  var timestamp3 = pipe(number(), safeInteger(), minValue(0));
@@ -35315,7 +35633,7 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
35315
35633
  })).digest("hex");
35316
35634
  }, "projectAnnotationSnapshotFingerprint");
35317
35635
 
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
35636
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
35319
35637
  var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
35320
35638
  if (!request || typeof request !== "object" || Array.isArray(request))
35321
35639
  throw new CliError("validation_error", "project annotation request is required");
@@ -35332,7 +35650,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
35332
35650
  return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
35333
35651
  }, "projectAnnotationRequest");
35334
35652
 
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
35653
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
35336
35654
  var SnapshotBudget = class {
35337
35655
  static {
35338
35656
  __name(this, "SnapshotBudget");
@@ -35358,13 +35676,13 @@ var SnapshotBudget = class {
35358
35676
  }
35359
35677
  };
35360
35678
 
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
35679
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
35362
35680
  import { createHash as createHash19 } from "node:crypto";
35363
35681
 
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
35682
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
35365
35683
  var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
35366
35684
 
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
35685
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
35368
35686
  import { createHash as createHash18 } from "node:crypto";
35369
35687
  var invalid9 = /* @__PURE__ */ __name(() => {
35370
35688
  throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
@@ -35507,7 +35825,7 @@ var ProjectSnapshotSources = class {
35507
35825
  }
35508
35826
  };
35509
35827
 
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
35828
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
35511
35829
  var unsupported = /* @__PURE__ */ __name(() => {
35512
35830
  throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
35513
35831
  }, "unsupported");
@@ -35533,7 +35851,7 @@ var provenance = /* @__PURE__ */ __name((raw) => {
35533
35851
  return unsupported();
35534
35852
  return text5 ?? null;
35535
35853
  }, "provenance");
35536
- var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, budget) => read(database, () => {
35854
+ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, budget) => read(database, () => {
35537
35855
  if (database.prepare("SELECT max(version) AS version FROM schema_migrations").get()?.version !== MIGRATIONS.at(-1)?.version)
35538
35856
  throw new CliError("configuration_error", "project snapshots require the SDK's current store schema without source migration");
35539
35857
  const sources = new ProjectSnapshotSources(database, budget);
@@ -35541,7 +35859,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
35541
35859
  budget.rows(database, from2, fields4, params);
35542
35860
  return database.prepare(`SELECT ${fields4.join(",")} ${from2} LIMIT 1001`).all(...params);
35543
35861
  }, "rows");
35544
- const descriptor = database.prepare("SELECT account_id,deleted_at FROM projects WHERE id=?").get(projectId);
35862
+ const descriptor = database.prepare("SELECT account_id,deleted_at FROM projects WHERE id=?").get(projectId2);
35545
35863
  if (!descriptor)
35546
35864
  throw new CliError("not_found", "the source project does not exist");
35547
35865
  if (descriptor.account_id !== null || descriptor.deleted_at !== null)
@@ -35559,13 +35877,13 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
35559
35877
  "status",
35560
35878
  "created_at",
35561
35879
  "updated_at"
35562
- ], [projectId])[0];
35880
+ ], [projectId2])[0];
35563
35881
  if (!project)
35564
35882
  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]);
35883
+ 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
35884
  if (aliases2.some((alias2) => alias2.account_id !== null))
35567
35885
  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))
35886
+ 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
35887
  return unsupported();
35570
35888
  const facts2 = rows("FROM facts WHERE project_id=? ORDER BY id", [
35571
35889
  "id",
@@ -35585,7 +35903,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
35585
35903
  "source",
35586
35904
  "created_at",
35587
35905
  "updated_at"
35588
- ], [projectId]);
35906
+ ], [projectId2]);
35589
35907
  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
35908
  "id",
35591
35909
  "from_type",
@@ -35603,8 +35921,8 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
35603
35921
  "author",
35604
35922
  "created_at",
35605
35923
  "updated_at"
35606
- ], [projectId, projectId, projectId, projectId]);
35607
- const projectRef = `project:${projectId}`;
35924
+ ], [projectId2, projectId2, projectId2, projectId2]);
35925
+ const projectRef = `project:${projectId2}`;
35608
35926
  const owned = /* @__PURE__ */ new Set([projectRef, ...facts2.map((row2) => `fact:${row2.id}`)]);
35609
35927
  const data = {
35610
35928
  format: "wirecat.project-annotations",
@@ -35678,9 +35996,9 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
35678
35996
  return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
35679
35997
  }), "projectAnnotationSnapshot");
35680
35998
 
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;
35999
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
36000
+ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, manifest, bindings, budget) => read(database, () => {
36001
+ const current = projectAnnotationSnapshot(database, projectId2, budget).snapshot;
35684
36002
  const sources = new ProjectSnapshotSources(database, budget);
35685
36003
  for (const ref3 of new Set(Object.values(bindings))) {
35686
36004
  if (ref3 === current.project.ref)
@@ -35701,7 +36019,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
35701
36019
  const names = new Set([manifest.project.key, manifest.project.name, ...manifest.aliases.map((a) => a.name)].map(normalizeVocabularyName));
35702
36020
  const namespace = /* @__PURE__ */ new Set();
35703
36021
  for (const project of projects2) {
35704
- if (project.id === projectId)
36022
+ if (project.id === projectId2)
35705
36023
  continue;
35706
36024
  const keyMatches = names.has(normalizeVocabularyName(String(project.key)));
35707
36025
  const nameMatches = project.account_id === null && project.deleted_at === null && names.has(normalizeVocabularyName(String(project.name)));
@@ -35709,7 +36027,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
35709
36027
  namespace.add(`project:${project.id}`);
35710
36028
  }
35711
36029
  for (const alias2 of aliases2) {
35712
- if (alias2.aliasable_id === projectId || alias2.account_id !== null)
36030
+ if (alias2.aliasable_id === projectId2 || alias2.account_id !== null)
35713
36031
  continue;
35714
36032
  const project = projects2.find((p) => p.id === alias2.aliasable_id && p.account_id === null && p.deleted_at === null);
35715
36033
  if (project && names.has(normalizeVocabularyName(String(alias2.name))))
@@ -35740,8 +36058,8 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
35740
36058
  };
35741
36059
  }), "previewAnnotationSnapshot");
35742
36060
 
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) => {
36061
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
36062
+ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, snapshot2, bindings) => {
35745
36063
  const mappings = { ...bindings };
35746
36064
  const resolve = /* @__PURE__ */ __name((ref3) => {
35747
36065
  if (ref3 === null)
@@ -35752,14 +36070,14 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snap
35752
36070
  return thing;
35753
36071
  }, "resolve");
35754
36072
  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);
36073
+ 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
36074
  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);
36075
+ 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
36076
  for (const fact of snapshot2.facts) {
35759
36077
  const author = resolve(fact.author), confirmed = resolve(fact.confirmed_by);
35760
36078
  if (!author)
35761
36079
  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);
36080
+ 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
36081
  if (!row2)
35764
36082
  throw new CliError("configuration_error", "project annotation fact insertion failed");
35765
36083
  mappings[fact.ref] = `fact:${row2.id}`;
@@ -35782,21 +36100,21 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snap
35782
36100
  return mappings;
35783
36101
  }, "restoreAnnotationRecords");
35784
36102
 
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
36103
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
35786
36104
  var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
35787
36105
  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));
36106
+ const { snapshot: snapshot2, projectId: projectId2 } = projectAnnotationRequest(request);
36107
+ return previewAnnotationSnapshot(database, projectId2, snapshot2, request.bindings, new SnapshotBudget(request.maxReadBytes ?? 4 * 1024 * 1024));
35790
36108
  },
35791
36109
  async restore(request) {
35792
- const { snapshot: snapshot2, projectId } = projectAnnotationRequest(request, true);
36110
+ const { snapshot: snapshot2, projectId: projectId2 } = projectAnnotationRequest(request, true);
35793
36111
  const budget = new SnapshotBudget(request.maxReadBytes ?? 4 * 1024 * 1024);
35794
36112
  try {
35795
36113
  return write(database, () => {
35796
- const preview = previewAnnotationSnapshot(database, projectId, snapshot2, request.bindings, budget);
36114
+ const preview = previewAnnotationSnapshot(database, projectId2, snapshot2, request.bindings, budget);
35797
36115
  if (!preview.ready || preview.fingerprint !== request.fingerprint)
35798
36116
  throw new CliError("validation_error", "project annotation preview is stale or has conflicts; preview again");
35799
- const mappings = restoreAnnotationRecords(database, projectId, snapshot2, request.bindings);
36117
+ const mappings = restoreAnnotationRecords(database, projectId2, snapshot2, request.bindings);
35800
36118
  return {
35801
36119
  project: request.project,
35802
36120
  fingerprint: preview.fingerprint,
@@ -35812,7 +36130,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
35812
36130
  }
35813
36131
  }), "projectAnnotationStoreOver");
35814
36132
 
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
36133
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
35816
36134
  var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
35817
36135
  const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
35818
36136
  let merged = { from: from2, to };
@@ -35825,7 +36143,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
35825
36143
  }, "markRange");
35826
36144
  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
36145
 
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
36146
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
35829
36147
  var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
35830
36148
  var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
35831
36149
  const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
@@ -35835,7 +36153,7 @@ var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) =
35835
36153
  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
36154
  }, "setTaskRulesStop");
35837
36155
 
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
36156
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sync.js
35839
36157
  var syncStoreOver = /* @__PURE__ */ __name((context) => {
35840
36158
  const { database } = context;
35841
36159
  const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
@@ -35891,21 +36209,21 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
35891
36209
  };
35892
36210
  }, "syncStoreOver");
35893
36211
 
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
36212
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/tags.js
35895
36213
  var tagsStoreOver = /* @__PURE__ */ __name((context) => {
35896
36214
  const { database } = context;
35897
36215
  return {
35898
- addTags: /* @__PURE__ */ __name(async (key2, target, list) => {
36216
+ addTags: /* @__PURE__ */ __name(async (key2, target, list2) => {
35899
36217
  let added = [];
35900
36218
  write(database, () => {
35901
- added = addTags(context, targetThing(context, key2, target), list);
36219
+ added = addTags(context, targetThing(context, key2, target), list2);
35902
36220
  });
35903
36221
  return added;
35904
36222
  }, "addTags"),
35905
- removeTags: /* @__PURE__ */ __name(async (key2, target, list, source2) => {
36223
+ removeTags: /* @__PURE__ */ __name(async (key2, target, list2, source2) => {
35906
36224
  let removed = [];
35907
36225
  write(database, () => {
35908
- removed = removeTags(context, targetThing(context, key2, target), list, source2);
36226
+ removed = removeTags(context, targetThing(context, key2, target), list2, source2);
35909
36227
  });
35910
36228
  return removed;
35911
36229
  }, "removeTags"),
@@ -35913,7 +36231,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
35913
36231
  };
35914
36232
  }, "tagsStoreOver");
35915
36233
 
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
36234
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
35917
36235
  var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
35918
36236
  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
36237
  WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
@@ -36040,7 +36358,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
36040
36358
  dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
36041
36359
  }, "savePictureChunks");
36042
36360
 
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
36361
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
36044
36362
  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
36363
  EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
36046
36364
  FROM messages m
@@ -36129,7 +36447,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
36129
36447
  return plain2(best(found2));
36130
36448
  }, "nearestMessages");
36131
36449
 
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
36450
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/vectors.js
36133
36451
  var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
36134
36452
  const { database } = context;
36135
36453
  const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
@@ -36288,12 +36606,12 @@ var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
36288
36606
  });
36289
36607
  return cleared;
36290
36608
  }, "clearVectors"),
36291
- nearestConversations: /* @__PURE__ */ __name(async (key2, { chatId, model, since, limit, query, exclude, conversations: conversations2, scope: scope3, projectId, personId, before: before2 }) => {
36609
+ nearestConversations: /* @__PURE__ */ __name(async (key2, { chatId, model, since, limit, query, exclude, conversations: conversations2, scope: scope3, projectId: projectId2, personId, before: before2 }) => {
36292
36610
  const accountPk2 = findAccountPk2(key2);
36293
36611
  if (accountPk2 === void 0)
36294
36612
  return [];
36295
36613
  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;
36614
+ const mailToo = key2.provider === "email" && conversations2 === void 0 && scope3 === void 0 && projectId2 === void 0 && personId === void 0 && before2 === void 0;
36297
36615
  const mailHits = /* @__PURE__ */ __name(async () => mailToo ? (await mail().nearest(model, query, {
36298
36616
  accountId: accountPk2,
36299
36617
  limit,
@@ -36316,7 +36634,7 @@ var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
36316
36634
  query,
36317
36635
  ...conversations2 === void 0 ? {} : { conversations: conversations2 },
36318
36636
  ...scope3 === void 0 ? {} : { scope: scope3 },
36319
- ...projectId === void 0 ? {} : { projectId: Number(projectId) },
36637
+ ...projectId2 === void 0 ? {} : { projectId: Number(projectId2) },
36320
36638
  ...personId === void 0 ? {} : { personId: Number(personId) },
36321
36639
  ...before2 === void 0 ? {} : { before: Date.parse(before2) }
36322
36640
  });
@@ -36387,7 +36705,7 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
36387
36705
  embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
36388
36706
  }), "vectorsStoreOver");
36389
36707
 
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
36708
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
36391
36709
  import { existsSync, readFileSync as readFileSync4 } from "node:fs";
36392
36710
  import { dirname as dirname2, join as join2 } from "node:path";
36393
36711
  var BOOKKEEPING = ["schema_migrations", "store_settings"];
@@ -36475,10 +36793,10 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
36475
36793
  }
36476
36794
  }, "lastBackup");
36477
36795
 
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
36796
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/providers.js
36479
36797
  var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
36480
36798
 
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
36799
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
36482
36800
  var COUNTED_TABLES = [
36483
36801
  "accounts",
36484
36802
  "chats",
@@ -36563,7 +36881,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
36563
36881
  };
36564
36882
  }, "storeContents");
36565
36883
 
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
36884
+ // node_modules/.pnpm/@wirecat+cli-core@0.544.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.73.0_commander@15._14d279ae6bc0fc41a3606e009c109ba5/node_modules/@wirecat/cli-core/dist/store/store.js
36567
36885
  var openStore = /* @__PURE__ */ __name(async (options = {}) => {
36568
36886
  const context = await openStoreContext(options);
36569
36887
  try {
@@ -36769,6 +37087,7 @@ export {
36769
37087
  parsePhoneCountries,
36770
37088
  MENTION_KINDS,
36771
37089
  NOT_FILES,
37090
+ hitFiles,
36772
37091
  matchDownloads,
36773
37092
  QUERY_VERSION,
36774
37093
  QUERY_LIMITS2 as QUERY_LIMITS,
@@ -36816,6 +37135,7 @@ export {
36816
37135
  counterFreshness,
36817
37136
  AGENDA_COLUMNS,
36818
37137
  correctWords,
37138
+ THREAD_COLUMNS,
36819
37139
  threadConversation,
36820
37140
  messageOfEmail,
36821
37141
  resetAttachmentWords,