@wirecat/tg-cli 0.100.0 → 0.102.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.
- package/README.md +3 -3
- package/dist/bin/tg.js +1 -1
- package/dist/bot/transport.d.ts.map +1 -1
- package/dist/bot/transport.js +14 -17
- package/dist/bot/transport.js.map +1 -1
- package/dist/bundle/{adapter-2LVPMFKF.js → adapter-M2HRSFFL.js} +95 -33
- package/dist/bundle/{all-profiles-BLTK2AAB.js → all-profiles-GOD2QNTK.js} +42 -12
- package/dist/bundle/{anthropic-RJE4XEOO.js → anthropic-LKU7RWMA.js} +5 -5
- package/dist/bundle/{bot-api-4XM3NVWG.js → bot-api-X3MPFVPL.js} +49 -53
- package/dist/bundle/{bot-history-WVM5GEQN.js → bot-history-OUMVVG22.js} +15 -15
- package/dist/bundle/{bun-UZXO2LRQ.js → bun-LIZ6MKFS.js} +2 -2
- package/dist/bundle/{bun-sqlite-GJLGSQIT.js → bun-sqlite-2IFQYQ44.js} +4 -4
- package/dist/bundle/chunk-264DAFJV.js +161 -0
- package/dist/bundle/{chunk-ASDZHG5I.js → chunk-2SUTCDGO.js} +2 -2
- package/dist/bundle/{chunk-2IM4M7Q2.js → chunk-2XBSVRT2.js} +1 -1
- package/dist/bundle/{chunk-Q26JMPBP.js → chunk-334UBWOB.js} +11 -11
- package/dist/bundle/{chunk-MQNFEVAH.js → chunk-4PDEQL6T.js} +2 -2
- package/dist/bundle/chunk-4QB4WDLT.js +922 -0
- package/dist/bundle/{chunk-66E5QDLH.js → chunk-5D6OJREA.js} +1 -1
- package/dist/bundle/{chunk-RDQMV6EU.js → chunk-5DFGJPT6.js} +4 -4
- package/dist/bundle/{chunk-GTURDJJD.js → chunk-5KU4UQBM.js} +1 -1
- package/dist/bundle/{chunk-JSKT5UZX.js → chunk-5VSR5ENL.js} +8 -8
- package/dist/bundle/{chunk-DN4QUTWU.js → chunk-AUOXTGTU.js} +1 -1
- package/dist/bundle/{chunk-X4Y2ROJI.js → chunk-BBC546ZA.js} +91 -2
- package/dist/bundle/{chunk-RER6DAHP.js → chunk-BQYTIYGB.js} +171 -148
- package/dist/bundle/{chunk-3S5CL55R.js → chunk-CLWYQNSC.js} +6 -6
- package/dist/bundle/{chunk-I6WZJVRT.js → chunk-CRZPQQHE.js} +59 -46
- package/dist/bundle/chunk-DE7LFMY2.js +440 -0
- package/dist/bundle/{chunk-GYEOQS2D.js → chunk-DG62L57H.js} +17 -17
- package/dist/bundle/{chunk-QU2FJMFB.js → chunk-ENE5CSVY.js} +2903 -1490
- package/dist/bundle/{chunk-P26LWFNZ.js → chunk-ERQDBK5I.js} +1 -1
- package/dist/bundle/{chunk-UD4DOZCN.js → chunk-F2TG3BA2.js} +6 -6
- package/dist/bundle/{chunk-4U7QOFDA.js → chunk-FBWOQMPE.js} +1698 -816
- package/dist/bundle/{chunk-JFJVS5JC.js → chunk-FOUE7XLK.js} +2 -2
- package/dist/bundle/{chunk-3QDPV34J.js → chunk-GSKFAE3I.js} +1297 -518
- package/dist/bundle/{chunk-BAIZAZ6Q.js → chunk-HLAZ65AW.js} +2 -2
- package/dist/bundle/{chunk-LI7TXFLS.js → chunk-JFSVXMN6.js} +3 -3
- package/dist/bundle/{chunk-6VEOR6GD.js → chunk-M5UH5CF3.js} +6 -8
- package/dist/bundle/{chunk-HXTTDIL7.js → chunk-MGG7JSNO.js} +3 -3
- package/dist/bundle/{chunk-6YLT4YVJ.js → chunk-OCWARAFE.js} +2 -2
- package/dist/bundle/{chunk-WE3LBRMB.js → chunk-OEJ5DMCX.js} +7 -7
- package/dist/bundle/{chunk-SGJYU3SB.js → chunk-OHBHHBYL.js} +3 -3
- package/dist/bundle/{chunk-2MXQ2EUN.js → chunk-PSH7K6TL.js} +617 -57
- package/dist/bundle/{chunk-H3X5LS6U.js → chunk-PYTOIDSM.js} +4 -4
- package/dist/bundle/{chunk-ATZ44Z77.js → chunk-Q2NYEX4A.js} +150 -52
- package/dist/bundle/{chunk-KE6L2UEG.js → chunk-QEPZUFPL.js} +70 -61
- package/dist/bundle/{chunk-CV5ASHTW.js → chunk-QL7CQ6VZ.js} +255 -80
- package/dist/bundle/{chunk-THVNP6S6.js → chunk-SRU3OF4R.js} +2 -2
- package/dist/bundle/{chunk-OOOV3JBZ.js → chunk-TV5DGHBT.js} +953 -677
- package/dist/bundle/{chunk-A7OBVRJV.js → chunk-TXBUDJ3P.js} +3 -3
- package/dist/bundle/{chunk-OW3COBN5.js → chunk-U4RRZUNP.js} +9 -9
- package/dist/bundle/{chunk-WKOY3POD.js → chunk-UK3GAN7Q.js} +7 -7
- package/dist/bundle/{chunk-BL36RR34.js → chunk-UR6ASUSG.js} +10 -7
- package/dist/bundle/{chunk-4VBDVZNE.js → chunk-V52SBQYF.js} +242 -19
- package/dist/bundle/{chunk-4YCLWWZ3.js → chunk-VUJ34PEQ.js} +11 -11
- package/dist/bundle/{chunk-2XUGPE5W.js → chunk-W5EB4JLV.js} +3 -3
- package/dist/bundle/{chunk-3KHKYYCR.js → chunk-WMOEOVWZ.js} +1 -0
- package/dist/bundle/{chunk-UMLPXNJI.js → chunk-WVEHUKCZ.js} +1 -1
- package/dist/bundle/{chunk-SYPL4PHV.js → chunk-XXTJUZMB.js} +1 -1
- package/dist/bundle/{chunk-SMJTL5U7.js → chunk-Y4XSWI22.js} +6 -4
- package/dist/bundle/{chunk-HKT5EOT5.js → chunk-YHB57PFN.js} +1 -1
- package/dist/bundle/{chunk-BZANDKWT.js → chunk-ZJVZXJOG.js} +2 -2
- package/dist/bundle/{chunk-QY3YOOTP.js → chunk-ZRNRQFTF.js} +2 -2
- package/dist/bundle/command-contract-A6VZN3ZR.js +31 -0
- package/dist/bundle/{echarts-YHSYUWLY.js → echarts-27W2CIBD.js} +2 -2
- package/dist/bundle/{embed-3HGI2XIW.js → embed-FGJ273X2.js} +4 -4
- package/dist/bundle/{embedder-2CJMZETJ.js → embedder-7ELL3CQ3.js} +7 -7
- package/dist/bundle/{entry-UVE53OV3.js → entry-SEE5YWIX.js} +5 -5
- package/dist/bundle/{first-run-6GYC2QS3.js → first-run-BD7FEC3W.js} +9 -9
- package/dist/bundle/first-screen-ASZV6LSA.js +29 -0
- package/dist/bundle/{identity-HEV5E57G.js → identity-QR4F42T6.js} +3 -3
- package/dist/bundle/{instructions-5UVAXSQV.js → instructions-L74K64PV.js} +1 -1
- package/dist/bundle/{mcp-NWXBVNUA.js → mcp-4Y37G2UY.js} +2 -2
- package/dist/bundle/{node-YHYEGYVE.js → node-RSL3HANO.js} +2 -2
- package/dist/bundle/{node-sqlite-CQ33A3R2.js → node-sqlite-7R3PYQGJ.js} +4 -4
- package/dist/bundle/{oauth-OB3JFAD7.js → oauth-4ESGXF6U.js} +7 -7
- package/dist/bundle/{open-JHGZIXU2.js → open-DFYEUGTA.js} +3 -3
- package/dist/bundle/{process-PSKS3N5B.js → process-RMV3AKLB.js} +1 -1
- package/dist/bundle/{program-RPYVPNRX.js → program-PIUYQHBF.js} +62 -67
- package/dist/bundle/{prompt-7BXUMJGG.js → prompt-H7GYQQLL.js} +4 -4
- package/dist/bundle/{proxy-transport-3EEMW2HW.js → proxy-transport-G4MA6BGU.js} +4 -4
- package/dist/bundle/{recognize-YMZPL47R.js → recognize-3GMOLZF4.js} +5 -5
- package/dist/bundle/{remote-LQ3Q22NG.js → remote-IRWTCI2B.js} +5 -5
- package/dist/bundle/{rerank-SM7IYVXJ.js → rerank-W3OSXXBN.js} +5 -5
- package/dist/bundle/{serve-GHUEP5H5.js → serve-ZCPO44NO.js} +24 -9
- package/dist/bundle/{server-A45HVXQY.js → server-FXU4QFRB.js} +42 -39
- package/dist/bundle/{server-K2BQPPHN.js → server-YWL4HDOP.js} +77 -68
- package/dist/bundle/{state-WIOL52GZ.js → state-MJPTDIB5.js} +9 -5
- package/dist/bundle/{store-XE5AKUJZ.js → store-6VNQG56O.js} +10 -10
- package/dist/bundle/store-maintenance-command-62TQTMER.js +43 -0
- package/dist/bundle/tg.js +4 -4
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +2 -0
- package/dist/commands/context.js.map +1 -1
- package/dist/program.js +1 -1
- package/dist/program.js.map +1 -1
- package/dist/telegram/errors.js +1 -1
- package/dist/telegram/errors.js.map +1 -1
- package/dist/telegram/sending.d.ts.map +1 -1
- package/dist/telegram/sending.js +52 -3
- package/dist/telegram/sending.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/install/windows.ps1 +1 -1
- package/package.json +3 -3
- package/skills/tg-cli/SKILL.md +4 -4
- package/dist/bundle/chunk-3N6LXAPE.js +0 -724
- package/dist/bundle/chunk-DVOUKGFK.js +0 -1950
- package/dist/bundle/chunk-MUEXF4ME.js +0 -582
- package/dist/bundle/chunk-U7LXA4SO.js +0 -1007
- package/dist/bundle/chunk-V4JSVH4M.js +0 -190
- package/dist/bundle/chunk-YG7PNCSW.js +0 -230
- package/dist/bundle/chunk-Z2FHEIXN.js +0 -63
- package/dist/bundle/command-contract-AIVKJYIR.js +0 -31
- package/dist/bundle/first-screen-HRRLVLOG.js +0 -29
- package/dist/bundle/store-maintenance-command-YS5E7VUN.js +0 -46
- /package/dist/bundle/{chunk-3MVHRZWR.js → chunk-2SJOUK6J.js} +0 -0
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
FACT_STATUSES,
|
|
6
6
|
FACT_TYPES,
|
|
7
7
|
LINK_KINDS,
|
|
8
|
+
LINK_ORIGINS,
|
|
8
9
|
MEETING_FINDINGS_KIND,
|
|
9
10
|
MEMORY_KINDS,
|
|
10
11
|
MEMORY_SCOPES,
|
|
@@ -50,7 +51,7 @@ import {
|
|
|
50
51
|
validateQuery,
|
|
51
52
|
walkQuery,
|
|
52
53
|
zonedMoment
|
|
53
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-QEPZUFPL.js";
|
|
54
55
|
import {
|
|
55
56
|
DEFAULT_STEMMERS,
|
|
56
57
|
DEFAULT_STEMMERS_VERSION,
|
|
@@ -63,21 +64,21 @@ import {
|
|
|
63
64
|
fold,
|
|
64
65
|
normalize,
|
|
65
66
|
parseStemmers
|
|
66
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-5VSR5ENL.js";
|
|
67
68
|
import {
|
|
68
69
|
DEFAULT_TASK_CATEGORIES,
|
|
69
70
|
sharedConfigPath,
|
|
70
71
|
storedTaskCategories,
|
|
71
72
|
taskCategoriesReader
|
|
72
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-F2TG3BA2.js";
|
|
73
74
|
import {
|
|
74
75
|
storePath
|
|
75
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-ZRNRQFTF.js";
|
|
76
77
|
import {
|
|
77
78
|
PRAGMAS,
|
|
78
79
|
quietSqliteWarning,
|
|
79
80
|
storeCapable
|
|
80
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-CLWYQNSC.js";
|
|
81
82
|
import {
|
|
82
83
|
SQLiteTable,
|
|
83
84
|
TableAliasProxyHandler,
|
|
@@ -102,10 +103,10 @@ import {
|
|
|
102
103
|
sql,
|
|
103
104
|
sqliteTable,
|
|
104
105
|
text
|
|
105
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-YHB57PFN.js";
|
|
106
107
|
import {
|
|
107
108
|
singleLine
|
|
108
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-DG62L57H.js";
|
|
109
110
|
import {
|
|
110
111
|
CliError,
|
|
111
112
|
array,
|
|
@@ -123,7 +124,7 @@ import {
|
|
|
123
124
|
safeParse,
|
|
124
125
|
strictObject,
|
|
125
126
|
string
|
|
126
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-OEJ5DMCX.js";
|
|
127
128
|
import {
|
|
128
129
|
resolveFrom
|
|
129
130
|
} from "./chunk-BJG6JA5U.js";
|
|
@@ -131,7 +132,7 @@ import {
|
|
|
131
132
|
__name
|
|
132
133
|
} from "./chunk-AFV74GK3.js";
|
|
133
134
|
|
|
134
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
135
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/account-store.js
|
|
135
136
|
var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
|
|
136
137
|
const methods = whole;
|
|
137
138
|
return Object.fromEntries(Object.keys(keyed).map((name) => [
|
|
@@ -259,7 +260,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
|
|
|
259
260
|
};
|
|
260
261
|
}, "bindAccount");
|
|
261
262
|
|
|
262
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
263
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/providers.js
|
|
263
264
|
var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events"];
|
|
264
265
|
var PROVIDERS = [
|
|
265
266
|
{ name: "telegram", kind: "messages", aliases: ["tg"] },
|
|
@@ -350,7 +351,7 @@ var providerNamed = /* @__PURE__ */ __name((word) => {
|
|
|
350
351
|
var kindIn = /* @__PURE__ */ __name((provider) => isFolderProvider(provider) ? "notes" : registry.find(({ name }) => name === provider)?.kind, "kindIn");
|
|
351
352
|
var kindOf = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
|
|
352
353
|
|
|
353
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
354
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/query.js
|
|
354
355
|
var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
|
|
355
356
|
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");
|
|
356
357
|
var fail = /* @__PURE__ */ __name((message2) => {
|
|
@@ -366,14 +367,14 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
|
|
|
366
367
|
if (source2 === "messages")
|
|
367
368
|
return source2;
|
|
368
369
|
if (isKind(source2))
|
|
369
|
-
fail(`${name}${source2} names ${source2}, which a message search does not read \u2014
|
|
370
|
+
fail(`${name}${source2} names ${source2}, which a message search does not read \u2014 search ${source2 === "meetings" || source2 === "events" ? `all --source ${source2}` : "notes"} does`);
|
|
370
371
|
const named2 = providerNamed(source2);
|
|
371
372
|
if (named2 && providers2.includes(named2.name))
|
|
372
373
|
return named2.name;
|
|
373
374
|
return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
|
|
374
375
|
}, "sourceOf");
|
|
375
376
|
|
|
376
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
377
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/account-list.js
|
|
377
378
|
var ACCOUNT_GROUPS = "accountGroups";
|
|
378
379
|
var ACCOUNT_GROUPS_SETTING = "account_groups";
|
|
379
380
|
var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
|
|
@@ -560,7 +561,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf = (kind3)
|
|
|
560
561
|
return { accounts: [...chosen.values()], skipped };
|
|
561
562
|
}, "fitting");
|
|
562
563
|
|
|
563
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
564
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
|
|
564
565
|
var IndexBuilderOn = class {
|
|
565
566
|
static {
|
|
566
567
|
__name(this, "IndexBuilderOn");
|
|
@@ -755,7 +756,7 @@ function alias(table, alias2) {
|
|
|
755
756
|
}
|
|
756
757
|
__name(alias, "alias");
|
|
757
758
|
|
|
758
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
759
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
|
|
759
760
|
var ENTITY_TABLES = {
|
|
760
761
|
account: "accounts",
|
|
761
762
|
attachment: "attachments",
|
|
@@ -795,7 +796,7 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
|
|
|
795
796
|
return { table, pointer, type, count, known: known2 };
|
|
796
797
|
}).filter(({ count }) => count > 0)), "orphanPointers");
|
|
797
798
|
|
|
798
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
799
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
|
|
799
800
|
var canonicalTags = sqliteTable("canonical_tags", {
|
|
800
801
|
id: integer("id").primaryKey(),
|
|
801
802
|
name: text("name").notNull().unique(),
|
|
@@ -804,7 +805,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
|
|
|
804
805
|
updatedAt: integer("updated_at").notNull()
|
|
805
806
|
});
|
|
806
807
|
|
|
807
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
808
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
|
|
808
809
|
var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
|
|
809
810
|
sourceKey: text("source_key").notNull(),
|
|
810
811
|
collection: text("collection").notNull(),
|
|
@@ -814,13 +815,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
|
|
|
814
815
|
createdAt: integer("created_at").notNull()
|
|
815
816
|
}, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
|
|
816
817
|
|
|
817
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
818
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
|
|
818
819
|
var documentIndexPending = sqliteTable("document_index_pending", {
|
|
819
820
|
id: integer("id").notNull(),
|
|
820
821
|
indexableType: text("indexable_type").notNull()
|
|
821
822
|
}, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
|
|
822
823
|
|
|
823
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
824
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
|
|
824
825
|
var tagRedirects = sqliteTable("tag_redirects", {
|
|
825
826
|
sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
|
|
826
827
|
survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
|
|
@@ -846,7 +847,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
|
|
|
846
847
|
index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
|
|
847
848
|
]);
|
|
848
849
|
|
|
849
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
850
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
|
|
850
851
|
var accounts = sqliteTable("accounts", {
|
|
851
852
|
id: integer("id").primaryKey(),
|
|
852
853
|
provider: text("provider").notNull(),
|
|
@@ -1599,13 +1600,15 @@ var calendarEntries = sqliteTable("calendar_entries", {
|
|
|
1599
1600
|
seenAt: integer("seen_at"),
|
|
1600
1601
|
createdAt: integer("created_at").notNull(),
|
|
1601
1602
|
updatedAt: integer("updated_at").notNull(),
|
|
1602
|
-
deletedAt: integer("deleted_at")
|
|
1603
|
+
deletedAt: integer("deleted_at"),
|
|
1604
|
+
seriesExternalId: text("series_external_id")
|
|
1603
1605
|
}, (table) => [
|
|
1604
1606
|
unique().on(table.calendarId, table.externalId),
|
|
1605
1607
|
unique().on(table.seriesEntryId, table.originalStartsAt),
|
|
1606
1608
|
index("calendar_entries_by_calendar_id_starts_at").on(table.calendarId, table.startsAt),
|
|
1607
1609
|
index("calendar_entries_by_ical_uid").on(table.icalUid).where(sql`ical_uid IS NOT NULL`),
|
|
1608
1610
|
index("calendar_entries_by_join_key").on(table.joinKey).where(sql`join_key IS NOT NULL`),
|
|
1611
|
+
index("calendar_entries_by_calendar_id_series_external_id").on(table.calendarId, table.seriesExternalId).where(sql`series_external_id IS NOT NULL`),
|
|
1609
1612
|
index("calendar_entries_by_event_id").on(table.eventId),
|
|
1610
1613
|
index("calendar_entries_by_event_series_id").on(table.eventSeriesId),
|
|
1611
1614
|
index("calendar_entries_by_event_type_event_id").on(table.eventType, table.eventId),
|
|
@@ -2313,7 +2316,7 @@ var storeSettings = sqliteTable("store_settings", {
|
|
|
2313
2316
|
at: integer("at").notNull()
|
|
2314
2317
|
});
|
|
2315
2318
|
|
|
2316
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2319
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
|
|
2317
2320
|
var ARMS = [
|
|
2318
2321
|
[
|
|
2319
2322
|
"message",
|
|
@@ -2440,7 +2443,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
|
|
|
2440
2443
|
return recomputed;
|
|
2441
2444
|
}, "drainInvolvementQueue");
|
|
2442
2445
|
|
|
2443
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2446
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/mentions.js
|
|
2444
2447
|
import { domainToUnicode } from "node:url";
|
|
2445
2448
|
|
|
2446
2449
|
// node_modules/.pnpm/psl@1.15.0/node_modules/psl/dist/psl.mjs
|
|
@@ -12462,7 +12465,7 @@ var oa = /* @__PURE__ */ __name((e) => {
|
|
|
12462
12465
|
}, "oa");
|
|
12463
12466
|
var na = { parse: O, get: aa, isValid: oa };
|
|
12464
12467
|
|
|
12465
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12468
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
|
|
12466
12469
|
var LINK = /https?:\/\/(?:(?:docs|drive|sheets|slides)\.google\.com|forms\.gle)(?:[/?#][^\s<>"'`]*)?/gi;
|
|
12467
12470
|
var ID = /^[\w-]{10,}$/;
|
|
12468
12471
|
var trimUrl = /* @__PURE__ */ __name((url) => {
|
|
@@ -12503,7 +12506,7 @@ var googleDocumentLinks = /* @__PURE__ */ __name((text5) => [...text5.matchAll(L
|
|
|
12503
12506
|
return { url, documentId: googleDocumentId(url) };
|
|
12504
12507
|
}), "googleDocumentLinks");
|
|
12505
12508
|
|
|
12506
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12509
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
|
|
12507
12510
|
var PHONE_PLANS = [
|
|
12508
12511
|
{
|
|
12509
12512
|
country: "us",
|
|
@@ -12883,7 +12886,7 @@ var PHONE_PLANS = [
|
|
|
12883
12886
|
}
|
|
12884
12887
|
];
|
|
12885
12888
|
|
|
12886
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12889
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/phones.js
|
|
12887
12890
|
var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
|
|
12888
12891
|
var DEFAULT_PHONE_COUNTRIES = ["ru"];
|
|
12889
12892
|
var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
|
|
@@ -12924,7 +12927,7 @@ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
|
|
|
12924
12927
|
return void 0;
|
|
12925
12928
|
}, "nationalPhone");
|
|
12926
12929
|
|
|
12927
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12930
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/places.js
|
|
12928
12931
|
var BEFORE = [
|
|
12929
12932
|
[/^(?:ул\.?|улиц[аеыу]|улицей)$/iu, "\u0443\u043B\u0438\u0446\u0430"],
|
|
12930
12933
|
[/^(?:пр-т|просп\.?|проспект[аеу]?)$/iu, "\u043F\u0440\u043E\u0441\u043F\u0435\u043A\u0442"],
|
|
@@ -13184,7 +13187,7 @@ var findPlaces = /* @__PURE__ */ __name((text5) => {
|
|
|
13184
13187
|
return found2.sort((a, b) => a.start - b.start);
|
|
13185
13188
|
}, "findPlaces");
|
|
13186
13189
|
|
|
13187
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13190
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/mentions.js
|
|
13188
13191
|
var MENTION_KINDS = ["phone", "email", "url", "document", "person-name", "place"];
|
|
13189
13192
|
var MENTION_VERSIONS = {
|
|
13190
13193
|
phone: 1,
|
|
@@ -13374,7 +13377,7 @@ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE
|
|
|
13374
13377
|
};
|
|
13375
13378
|
}, "typedPhone");
|
|
13376
13379
|
|
|
13377
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13380
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/first-names.js
|
|
13378
13381
|
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";
|
|
13379
13382
|
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";
|
|
13380
13383
|
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";
|
|
@@ -13382,7 +13385,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
|
|
|
13382
13385
|
var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
|
|
13383
13386
|
var NAME_WORDS = WORDS.split(" ");
|
|
13384
13387
|
|
|
13385
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13388
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/person-names.js
|
|
13386
13389
|
var LATIN_TO_CYRILLIC = {
|
|
13387
13390
|
shch: "\u0449",
|
|
13388
13391
|
sch: "\u0449",
|
|
@@ -13590,7 +13593,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text5, stem, taken) => {
|
|
|
13590
13593
|
return found2;
|
|
13591
13594
|
}, "findUnknownNames");
|
|
13592
13595
|
|
|
13593
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13596
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/attachments.js
|
|
13594
13597
|
var NOT_FILES = /* @__PURE__ */ new Set([
|
|
13595
13598
|
"webpage",
|
|
13596
13599
|
"share",
|
|
@@ -13622,7 +13625,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored3, files2) => {
|
|
|
13622
13625
|
});
|
|
13623
13626
|
}, "matchDownloads");
|
|
13624
13627
|
|
|
13625
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13628
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
|
|
13626
13629
|
var QUERY_VERSION = 1;
|
|
13627
13630
|
var QUERY_LIMITS2 = {
|
|
13628
13631
|
...QUERY_LIMITS,
|
|
@@ -13653,7 +13656,7 @@ function exhausted(budget) {
|
|
|
13653
13656
|
}
|
|
13654
13657
|
__name(exhausted, "exhausted");
|
|
13655
13658
|
|
|
13656
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13659
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
|
|
13657
13660
|
var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
|
|
13658
13661
|
var literal2 = /* @__PURE__ */ __name((c) => ({
|
|
13659
13662
|
kind: "char",
|
|
@@ -14053,7 +14056,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
|
|
|
14053
14056
|
return out;
|
|
14054
14057
|
}, "foldRegex");
|
|
14055
14058
|
|
|
14056
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14059
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
|
|
14057
14060
|
var PRESET_VERSION = 1;
|
|
14058
14061
|
var PRESETS = {
|
|
14059
14062
|
password: {
|
|
@@ -14107,7 +14110,7 @@ var PRESETS = {
|
|
|
14107
14110
|
}
|
|
14108
14111
|
};
|
|
14109
14112
|
|
|
14110
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14113
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
|
|
14111
14114
|
var FIELD_VERSION = 2;
|
|
14112
14115
|
var UNITS = {
|
|
14113
14116
|
"": 1,
|
|
@@ -14556,12 +14559,12 @@ var validateAst = /* @__PURE__ */ __name((input) => {
|
|
|
14556
14559
|
return validateFields(parsed2.output);
|
|
14557
14560
|
}, "validateAst");
|
|
14558
14561
|
|
|
14559
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14562
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
|
|
14560
14563
|
var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
|
|
14561
14564
|
var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
|
|
14562
14565
|
var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
|
|
14563
14566
|
|
|
14564
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14567
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
|
|
14565
14568
|
var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
|
|
14566
14569
|
var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
|
|
14567
14570
|
var linkMatch = /* @__PURE__ */ __name((field3, typed, mail, mentioned2) => {
|
|
@@ -14585,7 +14588,7 @@ var linkMatch = /* @__PURE__ */ __name((field3, typed, mail, mentioned2) => {
|
|
|
14585
14588
|
};
|
|
14586
14589
|
}, "linkMatch");
|
|
14587
14590
|
|
|
14588
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14591
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
|
|
14589
14592
|
var SETTING = "phoneCountries";
|
|
14590
14593
|
var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
|
|
14591
14594
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
|
|
@@ -14616,7 +14619,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
|
|
|
14616
14619
|
return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
|
|
14617
14620
|
}, "valueMatch");
|
|
14618
14621
|
|
|
14619
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14622
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/locator.js
|
|
14620
14623
|
var SCHEME = "msg:";
|
|
14621
14624
|
var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat: chat2, message: message2 }) => SCHEME + [provider, account, chat2, message2].map(encodeURIComponent).join("/"), "formatLocator");
|
|
14622
14625
|
var isLocator = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith(SCHEME), "isLocator");
|
|
@@ -14630,7 +14633,7 @@ var parseLocator = /* @__PURE__ */ __name((reference2) => {
|
|
|
14630
14633
|
return { provider, account, chat: chat2, message: message2 };
|
|
14631
14634
|
}, "parseLocator");
|
|
14632
14635
|
|
|
14633
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14636
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
|
|
14634
14637
|
var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
|
|
14635
14638
|
if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
|
|
14636
14639
|
throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
|
|
@@ -14658,7 +14661,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
|
|
|
14658
14661
|
return 2 * intersection2 / (aa2.size + bb.size);
|
|
14659
14662
|
}, "vocabularySimilarity");
|
|
14660
14663
|
|
|
14661
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14664
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
|
|
14662
14665
|
import { createHash } from "node:crypto";
|
|
14663
14666
|
var folded2 = /* @__PURE__ */ __name((name) => {
|
|
14664
14667
|
try {
|
|
@@ -14724,7 +14727,7 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind3, by, options
|
|
|
14724
14727
|
});
|
|
14725
14728
|
}, "guardTagCreation");
|
|
14726
14729
|
|
|
14727
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14730
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
|
|
14728
14731
|
var invalid2 = /* @__PURE__ */ __name((message2) => {
|
|
14729
14732
|
throw new CliError("validation_error", message2);
|
|
14730
14733
|
}, "invalid");
|
|
@@ -14801,7 +14804,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
|
|
|
14801
14804
|
};
|
|
14802
14805
|
}, "createTagRedirectIndex");
|
|
14803
14806
|
|
|
14804
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14807
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
|
|
14805
14808
|
var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
|
|
14806
14809
|
const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
|
|
14807
14810
|
if (!row2)
|
|
@@ -14829,7 +14832,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
|
|
|
14829
14832
|
return snapshot2;
|
|
14830
14833
|
}, "tagRedirectSnapshot");
|
|
14831
14834
|
|
|
14832
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14835
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
|
|
14833
14836
|
import { createHash as createHash2 } from "node:crypto";
|
|
14834
14837
|
var TASK_KEY_PREFIXES = {
|
|
14835
14838
|
question: "Q",
|
|
@@ -14856,7 +14859,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
|
|
|
14856
14859
|
return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
|
|
14857
14860
|
}, "taskAccountOf");
|
|
14858
14861
|
|
|
14859
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14862
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/references.js
|
|
14860
14863
|
var SIMPLE_REFERENCES = [
|
|
14861
14864
|
"note",
|
|
14862
14865
|
"document",
|
|
@@ -14928,7 +14931,7 @@ var folderPath = /* @__PURE__ */ __name((path) => {
|
|
|
14928
14931
|
}, "folderPath");
|
|
14929
14932
|
var canonicalReference = /* @__PURE__ */ __name((text5) => formatReference(parseReference(text5)), "canonicalReference");
|
|
14930
14933
|
|
|
14931
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14934
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
|
|
14932
14935
|
var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
|
|
14933
14936
|
var REFERABLE = {
|
|
14934
14937
|
note: { tombstone: true },
|
|
@@ -15086,7 +15089,7 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
|
|
|
15086
15089
|
}, "taskIdOf");
|
|
15087
15090
|
var canonicalThingReference = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith("meeting:") ? canonicalMeetingReference(reference2) : canonicalReference(reference2), "canonicalThingReference");
|
|
15088
15091
|
|
|
15089
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15092
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
|
|
15090
15093
|
var toMs = /* @__PURE__ */ __name((iso10) => {
|
|
15091
15094
|
if (iso10 === null || iso10 === void 0)
|
|
15092
15095
|
return null;
|
|
@@ -15100,7 +15103,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
|
|
|
15100
15103
|
var DELIVERY = { delivered: 1, read: 2 };
|
|
15101
15104
|
var deliveryOf = /* @__PURE__ */ __name((stored3) => stored3 === DELIVERY.read ? "read" : stored3 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
|
|
15102
15105
|
|
|
15103
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15106
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
|
|
15104
15107
|
var TAG_KINDS = ["tag", "topic"];
|
|
15105
15108
|
var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
|
|
15106
15109
|
var TAG_TYPE = {
|
|
@@ -15291,7 +15294,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
|
|
|
15291
15294
|
return result;
|
|
15292
15295
|
}, "tagsOf");
|
|
15293
15296
|
|
|
15294
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15297
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
|
|
15295
15298
|
var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
|
|
15296
15299
|
var SPEECH = speech("att");
|
|
15297
15300
|
var quoted = /* @__PURE__ */ __name((value) => `"${value.replaceAll('"', '""')}"`, "quoted");
|
|
@@ -15644,7 +15647,7 @@ var FIELD_COMPILERS = {
|
|
|
15644
15647
|
subject
|
|
15645
15648
|
};
|
|
15646
15649
|
|
|
15647
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15650
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
|
|
15648
15651
|
var placeOf = /* @__PURE__ */ __name((database) => {
|
|
15649
15652
|
const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
|
|
15650
15653
|
const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
|
|
@@ -15660,7 +15663,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
|
|
|
15660
15663
|
};
|
|
15661
15664
|
}, "placeOf");
|
|
15662
15665
|
|
|
15663
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15666
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
|
|
15664
15667
|
var DRAIN_ON_WRITE = 500;
|
|
15665
15668
|
var METHOD = "rules";
|
|
15666
15669
|
var telegramLink = /* @__PURE__ */ __name((database) => {
|
|
@@ -15823,7 +15826,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
|
|
|
15823
15826
|
return queued.length;
|
|
15824
15827
|
}, "drainMentions");
|
|
15825
15828
|
|
|
15826
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15829
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
|
|
15827
15830
|
var indexRow = /* @__PURE__ */ __name((database, name) => {
|
|
15828
15831
|
const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
|
|
15829
15832
|
if (!exists2)
|
|
@@ -15831,7 +15834,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
|
|
|
15831
15834
|
return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
|
|
15832
15835
|
}, "indexRow");
|
|
15833
15836
|
|
|
15834
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15837
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
|
|
15835
15838
|
var INDEX = "message_stems";
|
|
15836
15839
|
var SETTING2 = "searchStemmers";
|
|
15837
15840
|
var DRAIN_ON_WRITE2 = 500;
|
|
@@ -15953,7 +15956,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
|
|
|
15953
15956
|
};
|
|
15954
15957
|
}, "stemmerCache");
|
|
15955
15958
|
|
|
15956
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15959
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
|
|
15957
15960
|
var connections = /* @__PURE__ */ new WeakMap();
|
|
15958
15961
|
var connectionOf = /* @__PURE__ */ __name((database) => {
|
|
15959
15962
|
let connection = connections.get(database);
|
|
@@ -16012,7 +16015,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
|
|
|
16012
16015
|
}
|
|
16013
16016
|
}, "read");
|
|
16014
16017
|
|
|
16015
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16018
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
|
|
16016
16019
|
var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
|
|
16017
16020
|
coalesce(CASE k.chunkable_type
|
|
16018
16021
|
WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
|
|
@@ -16154,7 +16157,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
|
|
|
16154
16157
|
}, "dropUnusedVectors");
|
|
16155
16158
|
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");
|
|
16156
16159
|
|
|
16157
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16160
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
|
|
16158
16161
|
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({
|
|
16159
16162
|
target: [accounts.provider, accounts.externalId],
|
|
16160
16163
|
set: {
|
|
@@ -16259,7 +16262,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
|
|
|
16259
16262
|
AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
|
|
16260
16263
|
}, "dropOrphanPeople");
|
|
16261
16264
|
|
|
16262
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16265
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
|
|
16263
16266
|
var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
|
|
16264
16267
|
var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
|
|
16265
16268
|
for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
|
|
@@ -16278,7 +16281,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
|
|
|
16278
16281
|
}
|
|
16279
16282
|
}, "resolvePersonLinks");
|
|
16280
16283
|
|
|
16281
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16284
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
|
|
16282
16285
|
var flag = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
|
|
16283
16286
|
var prepare = /* @__PURE__ */ __name((orm) => ({
|
|
16284
16287
|
find: orm.select({
|
|
@@ -16497,7 +16500,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
|
|
|
16497
16500
|
return saved.pk;
|
|
16498
16501
|
}, "meetingIdentityPk");
|
|
16499
16502
|
|
|
16500
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16503
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
|
|
16501
16504
|
var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
|
|
16502
16505
|
const literal4 = escaped2 ?? plain2 ?? "";
|
|
16503
16506
|
return wildcard ?? (/[*?[]/u.test(literal4) ? `[${literal4}]` : literal4);
|
|
@@ -16562,7 +16565,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
|
|
|
16562
16565
|
var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
|
|
16563
16566
|
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");
|
|
16564
16567
|
|
|
16565
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16568
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
|
|
16566
16569
|
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");
|
|
16567
16570
|
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");
|
|
16568
16571
|
var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
|
|
@@ -16834,7 +16837,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
|
|
|
16834
16837
|
}
|
|
16835
16838
|
}, "replaceAutoTags");
|
|
16836
16839
|
|
|
16837
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16840
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/counters.js
|
|
16838
16841
|
var COUNTER_FIELDS = ["views", "reactions", "comments"];
|
|
16839
16842
|
var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
|
|
16840
16843
|
var counterValue = /* @__PURE__ */ __name((message2, field3) => {
|
|
@@ -16871,7 +16874,7 @@ var counterFreshness = /* @__PURE__ */ __name((states) => {
|
|
|
16871
16874
|
return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
|
|
16872
16875
|
}, "counterFreshness");
|
|
16873
16876
|
|
|
16874
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16877
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
|
|
16875
16878
|
import { createHash as createHash3 } from "node:crypto";
|
|
16876
16879
|
var CHUNK_CHARS = 1200;
|
|
16877
16880
|
var CHUNK_OVERLAP = 150;
|
|
@@ -16976,7 +16979,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
|
|
|
16976
16979
|
return chunks2;
|
|
16977
16980
|
}, "cutChunks");
|
|
16978
16981
|
|
|
16979
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16982
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
|
|
16980
16983
|
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");
|
|
16981
16984
|
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;
|
|
16982
16985
|
var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
|
|
@@ -17057,7 +17060,7 @@ var mailCore = /* @__PURE__ */ __name((body2, earlier) => {
|
|
|
17057
17060
|
return withoutSignOff(withoutGreeting(kept)).join("\n").trim();
|
|
17058
17061
|
}, "mailCore");
|
|
17059
17062
|
|
|
17060
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17063
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
|
|
17061
17064
|
var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
|
|
17062
17065
|
var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
|
|
17063
17066
|
var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
|
|
@@ -17147,7 +17150,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
|
|
|
17147
17150
|
});
|
|
17148
17151
|
}, "linkMeeting");
|
|
17149
17152
|
|
|
17150
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17153
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/task-signature.js
|
|
17151
17154
|
var DAY = 864e5;
|
|
17152
17155
|
var CURRENCY = [
|
|
17153
17156
|
[/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
|
|
@@ -17264,7 +17267,7 @@ var dueDayOf = /* @__PURE__ */ __name((text5, createdMs) => {
|
|
|
17264
17267
|
return best?.day ?? null;
|
|
17265
17268
|
}, "dueDayOf");
|
|
17266
17269
|
|
|
17267
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17270
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
|
|
17268
17271
|
var DAY2 = 864e5;
|
|
17269
17272
|
var STOP_WORDS = new Set([
|
|
17270
17273
|
// Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
|
|
@@ -17419,7 +17422,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
|
|
|
17419
17422
|
...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
|
|
17420
17423
|
})).sort((a, b) => b.score - a.score), "rankCandidates");
|
|
17421
17424
|
|
|
17422
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17425
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
|
|
17423
17426
|
var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
|
|
17424
17427
|
r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
|
|
17425
17428
|
JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
|
|
@@ -17690,7 +17693,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
|
|
|
17690
17693
|
};
|
|
17691
17694
|
}, "readiness");
|
|
17692
17695
|
|
|
17693
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17696
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
|
|
17694
17697
|
var DOCUMENT_PICTURE = "document_picture";
|
|
17695
17698
|
var SCAN_PAGE2 = 5e3;
|
|
17696
17699
|
var idOf = /* @__PURE__ */ __name((ref3) => {
|
|
@@ -17753,7 +17756,19 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
17753
17756
|
}, "nearestPictures")
|
|
17754
17757
|
}), "documentPicturesOver");
|
|
17755
17758
|
|
|
17756
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17759
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
|
|
17760
|
+
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), ''))";
|
|
17761
|
+
var UNSEARCHED_EVENT_TYPES = [
|
|
17762
|
+
"working-location",
|
|
17763
|
+
"focus",
|
|
17764
|
+
"out-of-office",
|
|
17765
|
+
"birthday"
|
|
17766
|
+
];
|
|
17767
|
+
var BUSY_ONLY_VISIBILITIES = ["private", "confidential"];
|
|
17768
|
+
var sqlList = /* @__PURE__ */ __name((values) => values.map((value) => `'${value}'`).join(", "), "sqlList");
|
|
17769
|
+
var SEARCHABLE_COPY = `(ce.event_type IS NULL OR ce.event_type NOT IN (${sqlList(UNSEARCHED_EVENT_TYPES)})) AND NOT (coalesce(ce.visibility, '') IN (${sqlList(BUSY_ONLY_VISIBILITIES)}) AND trim(coalesce(ce.title, '')) = '' AND trim(coalesce(ce.description, '')) = '' AND trim(coalesce(ce.location, '')) = '')`;
|
|
17770
|
+
var searchableCopy = /* @__PURE__ */ __name((event, account) => `EXISTS (SELECT 1 FROM calendar_entries ce${account ? " JOIN calendars c ON c.id = ce.calendar_id" : ""} WHERE ce.event_id = ${event} AND ${SEARCHABLE_COPY}${account ? ` AND ${account}` : ""} AND (ce.deleted_at IS NULL OR NOT EXISTS (SELECT 1 FROM calendar_entries l WHERE l.event_id = ${event} AND l.deleted_at IS NULL)))`, "searchableCopy");
|
|
17771
|
+
var EVENT_LIVE = `(e.deleted_at IS NULL AND coalesce(e.status, '') <> 'cancelled' AND (NOT EXISTS (SELECT 1 FROM calendar_entries ce WHERE ce.event_id = e.id) OR ${searchableCopy("e.id")}))`;
|
|
17757
17772
|
var CORPORA = {
|
|
17758
17773
|
document: {
|
|
17759
17774
|
type: "document",
|
|
@@ -17801,9 +17816,7 @@ var CORPORA = {
|
|
|
17801
17816
|
type: "event",
|
|
17802
17817
|
index: "event_index",
|
|
17803
17818
|
table: "events",
|
|
17804
|
-
|
|
17805
|
-
read: "SELECT e.title, 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), '')) AS body, e.deleted_at IS NULL AND NOT EXISTS (SELECT 1 FROM calendar_entries ce WHERE ce.event_id = e.id AND ce.deleted_at IS NULL AND ce.event_type IN ('workingLocation', 'focusTime', 'outOfOffice', 'birthday')) AS live, coalesce((SELECT a.scope FROM calendar_entries ce JOIN calendars c ON c.id = ce.calendar_id JOIN accounts a ON a.id = c.account_id WHERE ce.event_id = e.id LIMIT 1), 'personal') AS scope FROM events e WHERE e.id = ?",
|
|
17806
|
-
pieces: false
|
|
17819
|
+
read: `SELECT e.title, ${EVENT_TEXT} AS body, ${EVENT_LIVE} AS live, coalesce((SELECT a.scope FROM calendar_entries ce JOIN calendars c ON c.id = ce.calendar_id JOIN accounts a ON a.id = c.account_id WHERE ce.event_id = e.id LIMIT 1), 'personal') AS scope, (SELECT c.account_id FROM calendar_entries ce JOIN calendars c ON c.id = ce.calendar_id WHERE ce.event_id = e.id AND ce.deleted_at IS NULL ORDER BY ce.id LIMIT 1) AS account_id FROM events e WHERE e.id = ?`
|
|
17807
17820
|
}
|
|
17808
17821
|
};
|
|
17809
17822
|
var noteIndexText = /* @__PURE__ */ __name((title, text5) => title ? `${title}
|
|
@@ -17925,7 +17938,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
|
|
|
17925
17938
|
return true;
|
|
17926
17939
|
}, "resetNoteIndex");
|
|
17927
17940
|
|
|
17928
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17941
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
|
|
17929
17942
|
var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
|
|
17930
17943
|
var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
|
|
17931
17944
|
k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
|
|
@@ -18035,7 +18048,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor) => {
|
|
|
18035
18048
|
return emails3 + threads;
|
|
18036
18049
|
}, "drainEmailIndex");
|
|
18037
18050
|
|
|
18038
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18051
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
|
|
18039
18052
|
var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
|
|
18040
18053
|
emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
|
|
18041
18054
|
last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
|
|
@@ -18059,7 +18072,7 @@ var setEmailFlags = /* @__PURE__ */ __name((database, accountId, flags, now2) =>
|
|
|
18059
18072
|
return changed;
|
|
18060
18073
|
}, "setEmailFlags");
|
|
18061
18074
|
|
|
18062
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18075
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
|
|
18063
18076
|
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");
|
|
18064
18077
|
var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
|
|
18065
18078
|
var ruleOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -18126,7 +18139,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
|
|
|
18126
18139
|
}
|
|
18127
18140
|
}), "mailRulesOver");
|
|
18128
18141
|
|
|
18129
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18142
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
|
|
18130
18143
|
var FOLDED = [
|
|
18131
18144
|
{ table: "tasks", column: "title" },
|
|
18132
18145
|
{ table: "tasks", column: "close_reason" },
|
|
@@ -18158,7 +18171,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
|
18158
18171
|
return filled2;
|
|
18159
18172
|
}, "fillFolded");
|
|
18160
18173
|
|
|
18161
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18174
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
|
|
18162
18175
|
var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
|
|
18163
18176
|
database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
|
|
18164
18177
|
VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
|
|
@@ -18166,7 +18179,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
|
|
|
18166
18179
|
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);
|
|
18167
18180
|
}, "reviewLink");
|
|
18168
18181
|
|
|
18169
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18182
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
|
|
18170
18183
|
function checkMeetingCancelled(signal) {
|
|
18171
18184
|
if (!signal?.aborted)
|
|
18172
18185
|
return;
|
|
@@ -18177,7 +18190,7 @@ function checkMeetingCancelled(signal) {
|
|
|
18177
18190
|
}
|
|
18178
18191
|
__name(checkMeetingCancelled, "checkMeetingCancelled");
|
|
18179
18192
|
|
|
18180
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18193
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
|
|
18181
18194
|
var meetingOf = /* @__PURE__ */ __name((row2) => ({
|
|
18182
18195
|
id: Number(row2.id),
|
|
18183
18196
|
accountId: Number(row2.account_id),
|
|
@@ -18227,7 +18240,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
|
|
|
18227
18240
|
createdAt: Number(row2.created_at)
|
|
18228
18241
|
}), "transcriptRowOf");
|
|
18229
18242
|
|
|
18230
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18243
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
|
|
18231
18244
|
var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
|
|
18232
18245
|
var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
|
|
18233
18246
|
var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
|
|
@@ -18394,7 +18407,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
18394
18407
|
}
|
|
18395
18408
|
}), "meetingReadsOver");
|
|
18396
18409
|
|
|
18397
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18410
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
|
|
18398
18411
|
var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
|
|
18399
18412
|
const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
|
|
18400
18413
|
const params = [input.accountId];
|
|
@@ -18437,7 +18450,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
|
|
|
18437
18450
|
return { clauses, params };
|
|
18438
18451
|
}, "meetingSelectionSql");
|
|
18439
18452
|
|
|
18440
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18453
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
|
|
18441
18454
|
var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
18442
18455
|
async meetingChatLines(input) {
|
|
18443
18456
|
checkMeetingCancelled(input.signal);
|
|
@@ -18465,7 +18478,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
18465
18478
|
}
|
|
18466
18479
|
}), "meetingChatLinesOver");
|
|
18467
18480
|
|
|
18468
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18481
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
|
|
18469
18482
|
var MESSAGE_FIELDS = {
|
|
18470
18483
|
pk: messages.id,
|
|
18471
18484
|
nativeId: messages.externalId,
|
|
@@ -18631,7 +18644,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
|
|
|
18631
18644
|
storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
|
|
18632
18645
|
}), "chatActivity");
|
|
18633
18646
|
|
|
18634
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18647
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
|
|
18635
18648
|
var HIT_FIELDS = {
|
|
18636
18649
|
...MESSAGE_FIELDS,
|
|
18637
18650
|
chatTitle: sql`${chats.title}`.as("chat_title"),
|
|
@@ -18730,7 +18743,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
|
|
|
18730
18743
|
};
|
|
18731
18744
|
}, "directReplies");
|
|
18732
18745
|
|
|
18733
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18746
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
|
|
18734
18747
|
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");
|
|
18735
18748
|
var required = /* @__PURE__ */ __name((context, ref3) => {
|
|
18736
18749
|
const found2 = identityRow(context, ref3);
|
|
@@ -18861,7 +18874,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
|
|
|
18861
18874
|
}, "mentioning");
|
|
18862
18875
|
var escaped = /* @__PURE__ */ __name((text5) => text5.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
|
|
18863
18876
|
|
|
18864
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18877
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
|
|
18865
18878
|
var missing2 = /* @__PURE__ */ __name(() => {
|
|
18866
18879
|
throw new CliError("not_found", "Meeting, participant or selected target not found");
|
|
18867
18880
|
}, "missing");
|
|
@@ -18983,7 +18996,7 @@ function meetingContextLinksOver(context) {
|
|
|
18983
18996
|
}
|
|
18984
18997
|
__name(meetingContextLinksOver, "meetingContextLinksOver");
|
|
18985
18998
|
|
|
18986
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18999
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
|
|
18987
19000
|
var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
|
|
18988
19001
|
var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
|
|
18989
19002
|
var summaryOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -19012,7 +19025,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
19012
19025
|
return row2 ? summaryText(summaryOf(row2)) : null;
|
|
19013
19026
|
}, "indexedText");
|
|
19014
19027
|
|
|
19015
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19028
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
|
|
19016
19029
|
var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
|
|
19017
19030
|
var meetingCurrentIndexRows = `
|
|
19018
19031
|
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
|
|
@@ -19043,7 +19056,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
19043
19056
|
}, "invalidateMeetingStems");
|
|
19044
19057
|
var meetingStemmableText = /* @__PURE__ */ __name((text5) => text5.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
|
|
19045
19058
|
|
|
19046
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19059
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
|
|
19047
19060
|
function meetingHitIndexOver({ database, now: now2 }) {
|
|
19048
19061
|
return {
|
|
19049
19062
|
async indexSearch(original) {
|
|
@@ -19111,10 +19124,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
|
|
|
19111
19124
|
}
|
|
19112
19125
|
__name(meetingHitIndexOver, "meetingHitIndexOver");
|
|
19113
19126
|
|
|
19114
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19127
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
|
|
19115
19128
|
import { createHash as createHash4 } from "node:crypto";
|
|
19116
19129
|
|
|
19117
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19130
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/trigrams.js
|
|
19118
19131
|
var trigrams = /* @__PURE__ */ __name((term) => {
|
|
19119
19132
|
const padded = ` ${term} `;
|
|
19120
19133
|
const pieces = /* @__PURE__ */ new Set();
|
|
@@ -19123,7 +19136,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
|
|
|
19123
19136
|
return [...pieces];
|
|
19124
19137
|
}, "trigrams");
|
|
19125
19138
|
|
|
19126
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19139
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/correct.js
|
|
19127
19140
|
var SHORTEST_CORRECTION = 3;
|
|
19128
19141
|
var maxEdits = /* @__PURE__ */ __name((word) => word.length <= 4 ? 1 : 2, "maxEdits");
|
|
19129
19142
|
var editDistance = /* @__PURE__ */ __name((a, b, max) => {
|
|
@@ -19170,7 +19183,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
|
|
|
19170
19183
|
return corrections;
|
|
19171
19184
|
}, "correctWords");
|
|
19172
19185
|
|
|
19173
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19186
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/garbled.js
|
|
19174
19187
|
var SHORTEST_GARBLED = 4;
|
|
19175
19188
|
var MOST_WIDENED = 64;
|
|
19176
19189
|
var plain = /* @__PURE__ */ __name((word) => word.replaceAll("\u044D", "\u0435"), "plain");
|
|
@@ -19262,7 +19275,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
|
|
|
19262
19275
|
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));
|
|
19263
19276
|
}, "widenWords");
|
|
19264
19277
|
|
|
19265
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19278
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
|
|
19266
19279
|
import { readFileSync } from "node:fs";
|
|
19267
19280
|
var loaded;
|
|
19268
19281
|
var dictionary = /* @__PURE__ */ __name(() => {
|
|
@@ -19321,7 +19334,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word) => {
|
|
|
19321
19334
|
return false;
|
|
19322
19335
|
}, "knownRussianWord");
|
|
19323
19336
|
|
|
19324
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19337
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
|
|
19325
19338
|
var WORD3 = /[\p{L}\p{N}\p{M}]+/gu;
|
|
19326
19339
|
var MOST_WORDS = 128;
|
|
19327
19340
|
var quote = /* @__PURE__ */ __name((word) => `"${word.replaceAll('"', '""')}"`, "quote");
|
|
@@ -19548,7 +19561,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text5, stemmer) => {
|
|
|
19548
19561
|
return check3(tree);
|
|
19549
19562
|
}, "matchMeetingText");
|
|
19550
19563
|
|
|
19551
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19564
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
|
|
19552
19565
|
var fail3 = /* @__PURE__ */ __name((message2) => {
|
|
19553
19566
|
throw new CliError("validation_error", message2);
|
|
19554
19567
|
}, "fail");
|
|
@@ -19725,7 +19738,7 @@ function meetingHitSearchOver({ database }) {
|
|
|
19725
19738
|
}
|
|
19726
19739
|
__name(meetingHitSearchOver, "meetingHitSearchOver");
|
|
19727
19740
|
|
|
19728
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19741
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
|
|
19729
19742
|
import { createHash as createHash5 } from "node:crypto";
|
|
19730
19743
|
var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
|
|
19731
19744
|
if (value === void 0)
|
|
@@ -19815,7 +19828,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
|
|
|
19815
19828
|
}
|
|
19816
19829
|
}), "meetingParticipantSearchOver");
|
|
19817
19830
|
|
|
19818
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19831
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
|
|
19819
19832
|
var preparationQueries = {
|
|
19820
19833
|
participants: {
|
|
19821
19834
|
fields: "p.id, p.identity_id, p.display_name, l.person_id",
|
|
@@ -19865,7 +19878,7 @@ var preparationQueries = {
|
|
|
19865
19878
|
}
|
|
19866
19879
|
};
|
|
19867
19880
|
|
|
19868
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19881
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
|
|
19869
19882
|
var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
19870
19883
|
async preparationContext(original) {
|
|
19871
19884
|
const input = validateMeetingPreparationContext(original);
|
|
@@ -19906,7 +19919,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
19906
19919
|
}
|
|
19907
19920
|
}), "meetingPreparationContextOver");
|
|
19908
19921
|
|
|
19909
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19922
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
|
|
19910
19923
|
var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
|
|
19911
19924
|
SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
|
|
19912
19925
|
WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
|
|
@@ -19920,7 +19933,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
|
|
|
19920
19933
|
JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
|
|
19921
19934
|
)`, "preparationSubjects");
|
|
19922
19935
|
|
|
19923
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19936
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
|
|
19924
19937
|
var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
19925
19938
|
async preparationKnowledge(original) {
|
|
19926
19939
|
const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
|
|
@@ -19965,7 +19978,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
|
|
|
19965
19978
|
}
|
|
19966
19979
|
}), "meetingPreparationKnowledgeOver");
|
|
19967
19980
|
|
|
19968
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19981
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
|
|
19969
19982
|
var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
19970
19983
|
async preparationNotes(original) {
|
|
19971
19984
|
const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
|
|
@@ -20018,7 +20031,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20018
20031
|
}
|
|
20019
20032
|
}), "meetingPreparationNotesOver");
|
|
20020
20033
|
|
|
20021
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20034
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
|
|
20022
20035
|
var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20023
20036
|
async relatedHistory(original) {
|
|
20024
20037
|
const input = validateMeetingRelatedHistory(original);
|
|
@@ -20089,7 +20102,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20089
20102
|
}
|
|
20090
20103
|
}), "meetingRelatedHistoryOver");
|
|
20091
20104
|
|
|
20092
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20105
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
|
|
20093
20106
|
var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
|
|
20094
20107
|
var text2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
|
|
20095
20108
|
var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
@@ -20170,7 +20183,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20170
20183
|
}
|
|
20171
20184
|
}), "meetingReviewOver");
|
|
20172
20185
|
|
|
20173
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20186
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
|
|
20174
20187
|
var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
|
|
20175
20188
|
var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
|
|
20176
20189
|
if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
|
|
@@ -20224,7 +20237,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20224
20237
|
}
|
|
20225
20238
|
}), "meetingSeriesHistoryOver");
|
|
20226
20239
|
|
|
20227
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20240
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
|
|
20228
20241
|
var MOST_ROWS = 5e5;
|
|
20229
20242
|
var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20230
20243
|
async meetingStats(input) {
|
|
@@ -20271,7 +20284,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20271
20284
|
}
|
|
20272
20285
|
}), "meetingStatsOver");
|
|
20273
20286
|
|
|
20274
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20287
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
|
|
20275
20288
|
var CURSOR_KEY = "meetings";
|
|
20276
20289
|
var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
|
|
20277
20290
|
id: Number(row2.id),
|
|
@@ -20823,7 +20836,7 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
20823
20836
|
};
|
|
20824
20837
|
}, "meetingStoreOver");
|
|
20825
20838
|
|
|
20826
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20839
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
|
|
20827
20840
|
var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
|
|
20828
20841
|
id: `email:${place.emailId}`,
|
|
20829
20842
|
chatId: place.threadExternalId,
|
|
@@ -21391,7 +21404,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stem
|
|
|
21391
21404
|
}
|
|
21392
21405
|
}), "mailStoreOver");
|
|
21393
21406
|
|
|
21394
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21407
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/dictionary.js
|
|
21395
21408
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
21396
21409
|
var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
|
|
21397
21410
|
var folded4 = /* @__PURE__ */ __name((word) => /^[а-яё'-]*$/.test(word) ? word.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word), "folded");
|
|
@@ -21481,7 +21494,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
|
|
|
21481
21494
|
}, "knownWord");
|
|
21482
21495
|
var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
|
|
21483
21496
|
|
|
21484
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21497
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
|
|
21485
21498
|
var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
|
|
21486
21499
|
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");
|
|
21487
21500
|
var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
|
|
@@ -21567,7 +21580,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
|
|
|
21567
21580
|
return found2;
|
|
21568
21581
|
}, "spokenTranscripts");
|
|
21569
21582
|
|
|
21570
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21583
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
|
|
21571
21584
|
var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
|
|
21572
21585
|
const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
|
|
21573
21586
|
if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
|
|
@@ -21614,7 +21627,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
|
|
|
21614
21627
|
});
|
|
21615
21628
|
}, "placeHits");
|
|
21616
21629
|
|
|
21617
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21630
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
|
|
21618
21631
|
var MESSAGES2 = {
|
|
21619
21632
|
rows: "messages",
|
|
21620
21633
|
threads: "chats",
|
|
@@ -22076,7 +22089,7 @@ var runQuery = /* @__PURE__ */ __name(async (context, execution, by) => {
|
|
|
22076
22089
|
};
|
|
22077
22090
|
}, "runQuery");
|
|
22078
22091
|
|
|
22079
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22092
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
|
|
22080
22093
|
function invalidMetadata() {
|
|
22081
22094
|
throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
|
|
22082
22095
|
}
|
|
@@ -22178,7 +22191,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
|
|
|
22178
22191
|
};
|
|
22179
22192
|
}), "counterTargets");
|
|
22180
22193
|
|
|
22181
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22194
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
|
|
22182
22195
|
var NOT_FILE_LIST = [...NOT_FILES].map((kind3) => `'${kind3}'`).join(",");
|
|
22183
22196
|
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,
|
|
22184
22197
|
att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
|
|
@@ -22297,7 +22310,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
|
|
|
22297
22310
|
}));
|
|
22298
22311
|
}, "attachmentViews");
|
|
22299
22312
|
|
|
22300
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22313
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
|
|
22301
22314
|
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");
|
|
22302
22315
|
var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text5, source2) => {
|
|
22303
22316
|
const { orm, database, now: now2 } = context;
|
|
@@ -22335,7 +22348,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
|
|
|
22335
22348
|
keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
|
|
22336
22349
|
}, "intoVoiceAttachment");
|
|
22337
22350
|
|
|
22338
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22351
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
|
|
22339
22352
|
var FIELDS = [
|
|
22340
22353
|
"threadExternalId",
|
|
22341
22354
|
"senderIdentityId",
|
|
@@ -22642,7 +22655,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
|
|
|
22642
22655
|
reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
|
|
22643
22656
|
}, "writeDerivedReactions");
|
|
22644
22657
|
|
|
22645
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22658
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
|
|
22646
22659
|
var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
|
|
22647
22660
|
const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
|
|
22648
22661
|
return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
|
|
@@ -22668,7 +22681,7 @@ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
|
|
|
22668
22681
|
orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
|
|
22669
22682
|
}, "release");
|
|
22670
22683
|
|
|
22671
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22684
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/keys.js
|
|
22672
22685
|
var keysOver = /* @__PURE__ */ __name((context) => {
|
|
22673
22686
|
const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
|
|
22674
22687
|
const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
|
|
@@ -22689,7 +22702,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
|
|
|
22689
22702
|
};
|
|
22690
22703
|
}, "keysOver");
|
|
22691
22704
|
|
|
22692
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22705
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
|
|
22693
22706
|
var accountGroupsOf = /* @__PURE__ */ __name((database) => {
|
|
22694
22707
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
|
|
22695
22708
|
if (!row2)
|
|
@@ -22724,7 +22737,7 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
|
|
|
22724
22737
|
database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
|
|
22725
22738
|
}, "saveProfile");
|
|
22726
22739
|
|
|
22727
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22740
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
|
|
22728
22741
|
var BOT_KINDS = ["agent", "script", "integration"];
|
|
22729
22742
|
var ownerPerson = /* @__PURE__ */ __name((database) => {
|
|
22730
22743
|
const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
|
|
@@ -22760,7 +22773,7 @@ var originOfActor = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
22760
22773
|
return database.prepare("SELECT name FROM bots WHERE id = ?").get(Number(id2))?.name === "rule" ? "rule" : "agent";
|
|
22761
22774
|
}, "originOfActor");
|
|
22762
22775
|
|
|
22763
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22776
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
|
|
22764
22777
|
var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
|
|
22765
22778
|
const owner = ownerPerson(context.database).id;
|
|
22766
22779
|
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);
|
|
@@ -22781,7 +22794,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
|
|
|
22781
22794
|
return personOf(context, ref3);
|
|
22782
22795
|
}, "linkToOwner");
|
|
22783
22796
|
|
|
22784
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22797
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
|
|
22785
22798
|
var PROVIDERS_SETTING = "providers";
|
|
22786
22799
|
var storedProvidersOf = /* @__PURE__ */ __name((database) => {
|
|
22787
22800
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
|
|
@@ -22816,7 +22829,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
|
|
|
22816
22829
|
});
|
|
22817
22830
|
}, "registerProvider");
|
|
22818
22831
|
|
|
22819
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22832
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
|
|
22820
22833
|
var DAY3 = 864e5;
|
|
22821
22834
|
var RECENTLY_CLOSED_MS = 14 * DAY3;
|
|
22822
22835
|
var TEXT_LIMIT = 20;
|
|
@@ -23015,7 +23028,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
|
23015
23028
|
};
|
|
23016
23029
|
}, "taskSimilarityOver");
|
|
23017
23030
|
|
|
23018
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23031
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
|
|
23019
23032
|
var SETTING3 = "taskCategories";
|
|
23020
23033
|
var savedTaskCategories = /* @__PURE__ */ __name((database) => {
|
|
23021
23034
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
|
|
@@ -23034,7 +23047,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
|
|
|
23034
23047
|
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);
|
|
23035
23048
|
}, "saveTaskCategories");
|
|
23036
23049
|
|
|
23037
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23050
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
|
|
23038
23051
|
var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
|
|
23039
23052
|
var ALLOWED = "taskAgentClose";
|
|
23040
23053
|
var MIN = "taskAgentCloseMin";
|
|
@@ -23090,7 +23103,7 @@ var SUGGESTION_COLUMNS = [
|
|
|
23090
23103
|
];
|
|
23091
23104
|
var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
|
|
23092
23105
|
|
|
23093
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23106
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/attachments/limits.js
|
|
23094
23107
|
var MAX_FILE_BYTES = 50 * 1024 * 1024;
|
|
23095
23108
|
var MAX_TEXT_CHARS = 2e6;
|
|
23096
23109
|
var ATTACHMENT_LIMIT_ENV = [
|
|
@@ -23116,7 +23129,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
|
|
|
23116
23129
|
return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
|
|
23117
23130
|
}, "pdfPreviewLimits");
|
|
23118
23131
|
|
|
23119
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23132
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/ulid.js
|
|
23120
23133
|
import { randomBytes } from "node:crypto";
|
|
23121
23134
|
var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
23122
23135
|
var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
|
|
@@ -23129,7 +23142,7 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
|
|
|
23129
23142
|
return time3 + random;
|
|
23130
23143
|
}, "ulid");
|
|
23131
23144
|
|
|
23132
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23145
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
|
|
23133
23146
|
var FOLDED_FIELDS = ["title", "site", "language", "author"];
|
|
23134
23147
|
var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
|
|
23135
23148
|
if (!meta && !sections?.length)
|
|
@@ -23150,7 +23163,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
|
|
|
23150
23163
|
return typeof language === "string" && language !== "" ? language : null;
|
|
23151
23164
|
}, "languageOf");
|
|
23152
23165
|
|
|
23153
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23166
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
|
|
23154
23167
|
var isObject = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
|
|
23155
23168
|
var objectOf = /* @__PURE__ */ __name((value) => {
|
|
23156
23169
|
if (isObject(value))
|
|
@@ -23185,6 +23198,19 @@ var localFolder = /* @__PURE__ */ __name((database, now2, accountId, path) => {
|
|
|
23185
23198
|
return { id: Number(row2?.id), path };
|
|
23186
23199
|
}, "localFolder");
|
|
23187
23200
|
var logFileLink = /* @__PURE__ */ __name((database, now2, fileId, from2, to, method = "import", author = "rules") => database.prepare("INSERT INTO entity_link_events (linkable_type, linkable_id, entity_type, from_entity_id, to_entity_id, method, confidence, author, created_at) VALUES ('file', ?, 'document', ?, ?, ?, 1, ?, ?)").run(fileId, from2 == null ? null : Number(from2), to, method, author, now2), "logFileLink");
|
|
23201
|
+
var driveFileTarget = /* @__PURE__ */ __name((fileId) => `google-drive:${fileId}`, "driveFileTarget");
|
|
23202
|
+
var driveDocumentOf = /* @__PURE__ */ __name((database, fileId) => {
|
|
23203
|
+
const rows = database.prepare("SELECT DISTINCT f.document_id AS id FROM files f JOIN accounts a ON a.id = f.account_id WHERE a.provider = 'google-drive' AND f.external_id = ? AND f.deleted_at IS NULL AND f.document_id IS NOT NULL LIMIT 2").all(fileId);
|
|
23204
|
+
return rows.length === 1 ? Number(rows[0]?.id) : null;
|
|
23205
|
+
}, "driveDocumentOf");
|
|
23206
|
+
var linkAttached = /* @__PURE__ */ __name((database, now2, fileId) => {
|
|
23207
|
+
const target = driveFileTarget(fileId);
|
|
23208
|
+
if (!database.prepare("SELECT 1 FROM links WHERE to_type = 'document' AND to_id IS NULL AND target_text = ? AND kind = 'attached'").get(target))
|
|
23209
|
+
return;
|
|
23210
|
+
const document = driveDocumentOf(database, fileId);
|
|
23211
|
+
if (document !== null)
|
|
23212
|
+
database.prepare("UPDATE links SET to_id = ?, updated_at = ? WHERE to_type = 'document' AND to_id IS NULL AND target_text = ? AND kind = 'attached'").run(document, now2, target);
|
|
23213
|
+
}, "linkAttached");
|
|
23188
23214
|
var movePaths = /* @__PURE__ */ __name((database, accountId, from2, to) => {
|
|
23189
23215
|
database.prepare("UPDATE files SET path = ? || substr(path, ?), path_folded = NULL WHERE account_id = ? AND substr(path, 1, ?) = ?").run(to, from2.length + 1, accountId, from2.length + 1, `${from2}/`);
|
|
23190
23216
|
}, "movePaths");
|
|
@@ -23250,6 +23276,8 @@ var syncFile = /* @__PURE__ */ __name((database, now2, documentId, { seen = true
|
|
|
23250
23276
|
const row2 = database.prepare(`INSERT INTO files (${columns.join(", ")}, created_at, updated_at) VALUES (${columns.map(() => "?").join(", ")}, ?, ?) RETURNING id`).get(...Object.values(values), Number(doc.created_at), now2);
|
|
23251
23277
|
const placed = { id: Number(row2?.id), path };
|
|
23252
23278
|
logFileLink(database, now2, placed.id, null, documentId, method);
|
|
23279
|
+
if (remote)
|
|
23280
|
+
linkAttached(database, now2, externalId);
|
|
23253
23281
|
if (remote && kind3 === "folder")
|
|
23254
23282
|
placeChildren(database, now2, accountId, String(doc.external_id), depth);
|
|
23255
23283
|
return placed;
|
|
@@ -23262,6 +23290,8 @@ var syncFile = /* @__PURE__ */ __name((database, now2, documentId, { seen = true
|
|
|
23262
23290
|
database.prepare(`UPDATE files SET ${Object.keys(values).map((key2) => `${key2} = ?`).join(", ")}, updated_at = ? WHERE id = ?`).run(...Object.values(values), changed ? now2 : Number(existing.updated_at), id2);
|
|
23263
23291
|
if (kind3 === "folder" && existing.path !== path)
|
|
23264
23292
|
movePaths(database, accountId, String(existing.path), path);
|
|
23293
|
+
if (remote && changed)
|
|
23294
|
+
linkAttached(database, now2, externalId);
|
|
23265
23295
|
}
|
|
23266
23296
|
return { id: id2, path };
|
|
23267
23297
|
}, "syncFile");
|
|
@@ -23376,7 +23406,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
23376
23406
|
};
|
|
23377
23407
|
}, "filesStoreOver");
|
|
23378
23408
|
|
|
23379
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23409
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
|
|
23380
23410
|
var IMPORTED_DOCUMENT_QUERY = defineQuery({
|
|
23381
23411
|
entity: "document",
|
|
23382
23412
|
backend: "sql",
|
|
@@ -23422,9 +23452,8 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
|
|
|
23422
23452
|
return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
|
|
23423
23453
|
}, "importedDocumentWhere");
|
|
23424
23454
|
|
|
23425
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23455
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
|
|
23426
23456
|
var NOTE_FORMATS = ["obsidian", "markdown"];
|
|
23427
|
-
var LINK_ORIGINS = ["file", "owner", "suggested", "message"];
|
|
23428
23457
|
var iso = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
23429
23458
|
var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso(value), "optionalIso");
|
|
23430
23459
|
var textOf = /* @__PURE__ */ __name((text5, what, max = 1e5, allowEmpty = false) => {
|
|
@@ -23932,7 +23961,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
23932
23961
|
};
|
|
23933
23962
|
}, "notesStoreOver");
|
|
23934
23963
|
|
|
23935
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23964
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
|
|
23936
23965
|
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";
|
|
23937
23966
|
var iso2 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
23938
23967
|
var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
@@ -24048,7 +24077,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
24048
24077
|
};
|
|
24049
24078
|
}, "memoriesStoreOver");
|
|
24050
24079
|
|
|
24051
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24080
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
|
|
24052
24081
|
var DEFAULT_FIRST_PASS_PER_CHAT = 0;
|
|
24053
24082
|
var KEY = "taskFirstPassPerChat";
|
|
24054
24083
|
var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
|
|
@@ -24068,7 +24097,7 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
|
|
|
24068
24097
|
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);
|
|
24069
24098
|
}, "saveFirstPassPerChat");
|
|
24070
24099
|
|
|
24071
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24100
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
|
|
24072
24101
|
var TASK_RELATION_KINDS = [
|
|
24073
24102
|
"blocked-by",
|
|
24074
24103
|
"follow-up-of",
|
|
@@ -24198,7 +24227,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
|
|
|
24198
24227
|
};
|
|
24199
24228
|
}, "taskRelationsStoreOver");
|
|
24200
24229
|
|
|
24201
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24230
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
|
|
24202
24231
|
var TASK_ROLES = ["assignee", "reviewer", "watcher"];
|
|
24203
24232
|
var iso3 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
24204
24233
|
var recordTaskEvent = /* @__PURE__ */ __name((database, task, actor, kind3, changes, at) => {
|
|
@@ -24470,7 +24499,7 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
|
|
|
24470
24499
|
};
|
|
24471
24500
|
}, "workTasksOver");
|
|
24472
24501
|
|
|
24473
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24502
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
|
|
24474
24503
|
var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
24475
24504
|
const { database, now: now2 } = context;
|
|
24476
24505
|
const liveRow = /* @__PURE__ */ __name((id2) => {
|
|
@@ -24516,7 +24545,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
|
24516
24545
|
};
|
|
24517
24546
|
}, "taskCloseOver");
|
|
24518
24547
|
|
|
24519
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24548
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
|
|
24520
24549
|
var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
24521
24550
|
const { database, now: now2 } = context;
|
|
24522
24551
|
const required3 = /* @__PURE__ */ __name((id2) => {
|
|
@@ -24734,7 +24763,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
|
24734
24763
|
};
|
|
24735
24764
|
}, "taskPairsOver");
|
|
24736
24765
|
|
|
24737
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24766
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
|
|
24738
24767
|
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";
|
|
24739
24768
|
var taskStoreOver = /* @__PURE__ */ __name((context) => {
|
|
24740
24769
|
const { database, now: now2 } = context;
|
|
@@ -24929,7 +24958,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
|
|
|
24929
24958
|
throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
|
|
24930
24959
|
}, "oneOf");
|
|
24931
24960
|
|
|
24932
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24961
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/accounts.js
|
|
24933
24962
|
var accountAccountsOver = /* @__PURE__ */ __name((context) => {
|
|
24934
24963
|
const { database } = context;
|
|
24935
24964
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
|
|
@@ -24971,7 +25000,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
|
|
|
24971
25000
|
};
|
|
24972
25001
|
}, "accountsStoreOver");
|
|
24973
25002
|
|
|
24974
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25003
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
|
|
24975
25004
|
var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
|
|
24976
25005
|
var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
|
|
24977
25006
|
const message2 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
|
|
@@ -24995,7 +25024,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
|
|
|
24995
25024
|
})), "keepDownloads");
|
|
24996
25025
|
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");
|
|
24997
25026
|
|
|
24998
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25027
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/attachments.js
|
|
24999
25028
|
var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
|
|
25000
25029
|
const { database } = context;
|
|
25001
25030
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -25052,7 +25081,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
25052
25081
|
}, "keepAttachmentText")
|
|
25053
25082
|
}), "attachmentsStoreOver");
|
|
25054
25083
|
|
|
25055
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25084
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
|
|
25056
25085
|
var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
|
|
25057
25086
|
var pointerMover = /* @__PURE__ */ __name((context, type) => {
|
|
25058
25087
|
const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
|
|
@@ -25232,7 +25261,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
|
|
|
25232
25261
|
return done;
|
|
25233
25262
|
}, "rekeyChats");
|
|
25234
25263
|
|
|
25235
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25264
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
|
|
25236
25265
|
var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
|
|
25237
25266
|
var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
|
|
25238
25267
|
var CHAT_LIST_KEY = "chat_list_complete";
|
|
@@ -25264,7 +25293,7 @@ var chatCompleteness = /* @__PURE__ */ __name(({ database }, accountKey, chatIds
|
|
|
25264
25293
|
});
|
|
25265
25294
|
}, "chatCompleteness");
|
|
25266
25295
|
|
|
25267
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25296
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/chats.js
|
|
25268
25297
|
var chatsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
25269
25298
|
const { database } = context;
|
|
25270
25299
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
|
|
@@ -25364,7 +25393,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25364
25393
|
};
|
|
25365
25394
|
}, "chatsStoreOver");
|
|
25366
25395
|
|
|
25367
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25396
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
|
|
25368
25397
|
import { createHash as createHash6 } from "node:crypto";
|
|
25369
25398
|
var BATCH_CONTEXT = 50;
|
|
25370
25399
|
var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
|
|
@@ -25502,7 +25531,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
|
|
|
25502
25531
|
var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
|
|
25503
25532
|
${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
|
|
25504
25533
|
|
|
25505
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25534
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
|
|
25506
25535
|
import { setTimeout } from "node:timers/promises";
|
|
25507
25536
|
var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
|
|
25508
25537
|
var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
|
|
@@ -25814,7 +25843,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
|
|
|
25814
25843
|
AND NOT EXISTS (SELECT 1 FROM messages d
|
|
25815
25844
|
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");
|
|
25816
25845
|
|
|
25817
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25846
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/conversations.js
|
|
25818
25847
|
var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
25819
25848
|
const { database } = context;
|
|
25820
25849
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -25921,7 +25950,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25921
25950
|
};
|
|
25922
25951
|
}, "conversationsStoreOver");
|
|
25923
25952
|
|
|
25924
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25953
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/counters.js
|
|
25925
25954
|
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";
|
|
25926
25955
|
var accountCountersOver = /* @__PURE__ */ __name((context) => {
|
|
25927
25956
|
const { database } = context;
|
|
@@ -25946,7 +25975,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
25946
25975
|
counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
|
|
25947
25976
|
}), "countersStoreOver");
|
|
25948
25977
|
|
|
25949
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25978
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
|
|
25950
25979
|
var MENTION_STATUSES = ["found", "linked", "dismissed"];
|
|
25951
25980
|
var MENTION_QUERY = defineQuery({
|
|
25952
25981
|
entity: "mention",
|
|
@@ -26162,7 +26191,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
|
|
|
26162
26191
|
return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
|
|
26163
26192
|
}, "listPlaces");
|
|
26164
26193
|
|
|
26165
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26194
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/mentions.js
|
|
26166
26195
|
var accountMentionsOver = /* @__PURE__ */ __name((context) => {
|
|
26167
26196
|
const { database } = context;
|
|
26168
26197
|
const { findAccountPk: findAccountPk2 } = keysOver(context);
|
|
@@ -26197,7 +26226,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
26197
26226
|
places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
|
|
26198
26227
|
}), "mentionsStoreOver");
|
|
26199
26228
|
|
|
26200
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26229
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
|
|
26201
26230
|
var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
|
|
26202
26231
|
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");
|
|
26203
26232
|
const rows = messageId === void 0 ? read2.all(chatKey) : read2.all(chatKey, messageId);
|
|
@@ -26212,7 +26241,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
|
|
|
26212
26241
|
}));
|
|
26213
26242
|
}, "documentLinkMessages");
|
|
26214
26243
|
|
|
26215
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26244
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/messages.js
|
|
26216
26245
|
var accountMessagesOver = /* @__PURE__ */ __name((context) => {
|
|
26217
26246
|
const { database } = context;
|
|
26218
26247
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
|
|
@@ -26342,7 +26371,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
26342
26371
|
directReplies: /* @__PURE__ */ __name(async (parents, limit) => directReplies(context, parents, limit), "directReplies")
|
|
26343
26372
|
}), "messagesStoreOver");
|
|
26344
26373
|
|
|
26345
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26374
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
|
|
26346
26375
|
var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
|
|
26347
26376
|
var iso4 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
26348
26377
|
var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: accounts2, limit }) => {
|
|
@@ -26399,7 +26428,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
|
|
|
26399
26428
|
});
|
|
26400
26429
|
}, "personPreparation");
|
|
26401
26430
|
|
|
26402
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26431
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
|
|
26403
26432
|
var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
|
|
26404
26433
|
const id2 = Number(uid);
|
|
26405
26434
|
if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
|
|
@@ -26407,7 +26436,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
|
|
|
26407
26436
|
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)));
|
|
26408
26437
|
}, "personSeenInAccounts");
|
|
26409
26438
|
|
|
26410
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26439
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
|
|
26411
26440
|
var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
|
|
26412
26441
|
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);
|
|
26413
26442
|
if (!row2)
|
|
@@ -26473,7 +26502,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
|
|
|
26473
26502
|
return { id: id2, personId, removed: true };
|
|
26474
26503
|
}, "removeNote");
|
|
26475
26504
|
|
|
26476
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26505
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/people.js
|
|
26477
26506
|
var accountPeopleOver = /* @__PURE__ */ __name((context) => {
|
|
26478
26507
|
const { database } = context;
|
|
26479
26508
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
|
|
@@ -26538,13 +26567,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
|
|
|
26538
26567
|
};
|
|
26539
26568
|
}, "peopleStoreOver");
|
|
26540
26569
|
|
|
26541
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26570
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
|
|
26542
26571
|
import { createHash as createHash8 } from "node:crypto";
|
|
26543
26572
|
|
|
26544
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26573
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
|
|
26545
26574
|
import { createHash as createHash7 } from "node:crypto";
|
|
26546
26575
|
|
|
26547
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26576
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
|
|
26548
26577
|
var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
|
|
26549
26578
|
var AUTHOR_MEASURES = [
|
|
26550
26579
|
"messages",
|
|
@@ -26684,7 +26713,7 @@ var withoutUrls = /* @__PURE__ */ __name((text5) => text5.replace(/\S+/gu, (toke
|
|
|
26684
26713
|
var rankingWords = /* @__PURE__ */ __name((text5) => withoutUrls(text5).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
|
|
26685
26714
|
var rankingQuestion = /* @__PURE__ */ __name((text5) => withoutUrls(text5).includes("?"), "rankingQuestion");
|
|
26686
26715
|
|
|
26687
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26716
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
|
|
26688
26717
|
var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
|
|
26689
26718
|
var exhausted2 = /* @__PURE__ */ __name((budget) => {
|
|
26690
26719
|
throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
|
|
@@ -26906,7 +26935,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
|
|
|
26906
26935
|
};
|
|
26907
26936
|
}, "rankReplyGraph");
|
|
26908
26937
|
|
|
26909
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26938
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
|
|
26910
26939
|
var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
|
|
26911
26940
|
var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
|
|
26912
26941
|
var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
|
|
@@ -27080,7 +27109,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
|
|
|
27080
27109
|
return { items, evidence, summary, graph: graph.quality };
|
|
27081
27110
|
}, "calculateAdminStatistics");
|
|
27082
27111
|
|
|
27083
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27112
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
|
|
27084
27113
|
var rankingContextRange = /* @__PURE__ */ __name((root) => {
|
|
27085
27114
|
const dates = [];
|
|
27086
27115
|
const visit = /* @__PURE__ */ __name((node, required3) => {
|
|
@@ -27102,7 +27131,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
|
|
|
27102
27131
|
return dates[0].node.resolution.date;
|
|
27103
27132
|
}, "rankingContextRange");
|
|
27104
27133
|
|
|
27105
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27134
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
|
|
27106
27135
|
var reactionCounts = /* @__PURE__ */ __name((stored3) => {
|
|
27107
27136
|
let counts;
|
|
27108
27137
|
try {
|
|
@@ -27397,7 +27426,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
|
|
|
27397
27426
|
});
|
|
27398
27427
|
}, "rankQuery");
|
|
27399
27428
|
|
|
27400
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27429
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
|
|
27401
27430
|
function fail4(message2, reason = "query.too-large") {
|
|
27402
27431
|
throw new CliError("validation_error", message2, { reason, complete: false });
|
|
27403
27432
|
}
|
|
@@ -27574,7 +27603,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
|
|
|
27574
27603
|
return result;
|
|
27575
27604
|
}), "adminStatisticsQuery");
|
|
27576
27605
|
|
|
27577
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27606
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
|
|
27578
27607
|
var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
|
|
27579
27608
|
if (!execution.accounts.length)
|
|
27580
27609
|
return { conversations: [], chats: [] };
|
|
@@ -27592,7 +27621,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
|
|
|
27592
27621
|
return { conversations: conversations2, chats: chats2 };
|
|
27593
27622
|
}, "conversationEligibility");
|
|
27594
27623
|
|
|
27595
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27624
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
|
|
27596
27625
|
import { createHash as createHash9 } from "node:crypto";
|
|
27597
27626
|
var EVIDENCE_BYTES = 64 * 1024;
|
|
27598
27627
|
var FINGERPRINT_BYTES = 8 * 1024 * 1024;
|
|
@@ -27742,7 +27771,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
|
|
|
27742
27771
|
return result;
|
|
27743
27772
|
}, "rankingEvidence");
|
|
27744
27773
|
|
|
27745
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27774
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/queries.js
|
|
27746
27775
|
var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor) => {
|
|
27747
27776
|
const mailIndexed = /* @__PURE__ */ __name((execution) => {
|
|
27748
27777
|
if (execution.corpus === "mail")
|
|
@@ -27759,7 +27788,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor) => {
|
|
|
27759
27788
|
};
|
|
27760
27789
|
}, "queriesStoreOver");
|
|
27761
27790
|
|
|
27762
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27791
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
|
|
27763
27792
|
var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
|
|
27764
27793
|
const { database, now: now2 } = context;
|
|
27765
27794
|
const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
|
|
@@ -27798,10 +27827,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
|
|
|
27798
27827
|
}));
|
|
27799
27828
|
}, "chatEventsOf");
|
|
27800
27829
|
|
|
27801
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27830
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
|
|
27802
27831
|
import { createHash as createHash10 } from "node:crypto";
|
|
27803
27832
|
|
|
27804
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27833
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/calendar.js
|
|
27805
27834
|
var calendarKey = /* @__PURE__ */ __name((zone, by) => {
|
|
27806
27835
|
const format = new Intl.DateTimeFormat("en-CA", {
|
|
27807
27836
|
timeZone: zone,
|
|
@@ -27816,7 +27845,7 @@ var calendarKey = /* @__PURE__ */ __name((zone, by) => {
|
|
|
27816
27845
|
};
|
|
27817
27846
|
}, "calendarKey");
|
|
27818
27847
|
|
|
27819
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27848
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/retention.js
|
|
27820
27849
|
var RETENTION_TOLERANCE = 864e5;
|
|
27821
27850
|
var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
|
|
27822
27851
|
const { since, until, cutoff, checkpoints, within, limit, by } = options;
|
|
@@ -27870,7 +27899,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
|
|
|
27870
27899
|
return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
|
|
27871
27900
|
}, "retentionCohorts");
|
|
27872
27901
|
|
|
27873
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27902
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
|
|
27874
27903
|
var iso5 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
|
|
27875
27904
|
var week = /* @__PURE__ */ __name((day) => {
|
|
27876
27905
|
const date3 = /* @__PURE__ */ new Date(`${day}T00:00:00Z`);
|
|
@@ -28006,7 +28035,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
|
|
|
28006
28035
|
};
|
|
28007
28036
|
}, "retentionQuery");
|
|
28008
28037
|
|
|
28009
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28038
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
|
|
28010
28039
|
var iso6 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
|
|
28011
28040
|
var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
|
|
28012
28041
|
...isBot === void 0 ? {} : { bot: isBot },
|
|
@@ -28137,7 +28166,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
|
|
|
28137
28166
|
lastCount: memberCountsOf(context, pk).at(-1) ?? null
|
|
28138
28167
|
})), "trackedChats");
|
|
28139
28168
|
|
|
28140
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28169
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/roster.js
|
|
28141
28170
|
var rosterStoreOver = /* @__PURE__ */ __name((context) => {
|
|
28142
28171
|
const { database } = context;
|
|
28143
28172
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
|
|
@@ -28193,7 +28222,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28193
28222
|
};
|
|
28194
28223
|
}, "rosterStoreOver");
|
|
28195
28224
|
|
|
28196
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28225
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
|
|
28197
28226
|
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");
|
|
28198
28227
|
var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
|
|
28199
28228
|
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 ?`);
|
|
@@ -28217,7 +28246,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
|
|
|
28217
28246
|
}
|
|
28218
28247
|
}, "backfillNormalized");
|
|
28219
28248
|
|
|
28220
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28249
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
|
|
28221
28250
|
var INDEX2 = "message_words";
|
|
28222
28251
|
var searchIndexState2 = /* @__PURE__ */ __name((database) => {
|
|
28223
28252
|
const row2 = indexRow(database, INDEX2);
|
|
@@ -28344,7 +28373,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
|
|
|
28344
28373
|
});
|
|
28345
28374
|
}, "resetSearchIndex");
|
|
28346
28375
|
|
|
28347
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28376
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
|
|
28348
28377
|
var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
|
|
28349
28378
|
const filled2 = { stemmed: 0, drained: 0 };
|
|
28350
28379
|
const before2 = stemsState(database);
|
|
@@ -28439,7 +28468,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
|
|
|
28439
28468
|
return resetStems(database, { now: now2 });
|
|
28440
28469
|
}, "followDefaultStemmers");
|
|
28441
28470
|
|
|
28442
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28471
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
|
|
28443
28472
|
var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
|
|
28444
28473
|
var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
|
|
28445
28474
|
const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
|
|
@@ -28461,7 +28490,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
|
|
|
28461
28490
|
});
|
|
28462
28491
|
}, "termCandidates");
|
|
28463
28492
|
|
|
28464
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28493
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/search-index.js
|
|
28465
28494
|
var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
|
|
28466
28495
|
const { database } = context;
|
|
28467
28496
|
const stemmerFor = stemmerCache();
|
|
@@ -28483,7 +28512,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28483
28512
|
};
|
|
28484
28513
|
}, "searchIndexStoreOver");
|
|
28485
28514
|
|
|
28486
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28515
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
|
|
28487
28516
|
var HISTORY_KEPT = 1e3;
|
|
28488
28517
|
var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
|
|
28489
28518
|
var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
|
|
@@ -28552,7 +28581,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
|
|
|
28552
28581
|
return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
|
|
28553
28582
|
}, "clearHistory");
|
|
28554
28583
|
|
|
28555
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28584
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/searches.js
|
|
28556
28585
|
var searchesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
28557
28586
|
const { database } = context;
|
|
28558
28587
|
return {
|
|
@@ -28576,7 +28605,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28576
28605
|
};
|
|
28577
28606
|
}, "searchesStoreOver");
|
|
28578
28607
|
|
|
28579
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28608
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
|
|
28580
28609
|
var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
|
|
28581
28610
|
var ACTION_OUTCOMES = ["ok", "refused", "failed"];
|
|
28582
28611
|
var CODE = /^[a-z][a-z0-9_]{0,63}$/;
|
|
@@ -28619,7 +28648,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
|
|
|
28619
28648
|
};
|
|
28620
28649
|
}, "agentActionsStoreOver");
|
|
28621
28650
|
|
|
28622
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28651
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
|
|
28623
28652
|
var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
|
|
28624
28653
|
}) => {
|
|
28625
28654
|
const { database, now: now2 } = context;
|
|
@@ -28678,7 +28707,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
|
|
|
28678
28707
|
};
|
|
28679
28708
|
}, "botUpdateStoreOver");
|
|
28680
28709
|
|
|
28681
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28710
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
|
|
28682
28711
|
var calendarOf = /* @__PURE__ */ __name((row2) => ({
|
|
28683
28712
|
id: Number(row2.id),
|
|
28684
28713
|
accountId: Number(row2.account_id),
|
|
@@ -28696,6 +28725,7 @@ var entryOf = /* @__PURE__ */ __name((row2) => ({
|
|
|
28696
28725
|
calendarId: Number(row2.calendar_id),
|
|
28697
28726
|
kind: row2.kind,
|
|
28698
28727
|
seriesEntryId: int(row2.series_entry_id),
|
|
28728
|
+
seriesExternalId: str(row2.series_external_id),
|
|
28699
28729
|
eventId: int(row2.event_id),
|
|
28700
28730
|
eventSeriesId: int(row2.event_series_id),
|
|
28701
28731
|
externalId: String(row2.external_id),
|
|
@@ -28721,6 +28751,7 @@ var entryOf = /* @__PURE__ */ __name((row2) => ({
|
|
|
28721
28751
|
joinKey: str(row2.join_key),
|
|
28722
28752
|
url: str(row2.url),
|
|
28723
28753
|
externalUpdatedAt: int(row2.external_updated_at),
|
|
28754
|
+
etag: str(row2.etag),
|
|
28724
28755
|
seenAt: int(row2.seen_at),
|
|
28725
28756
|
deletedAt: int(row2.deleted_at)
|
|
28726
28757
|
}), "entryOf");
|
|
@@ -28760,8 +28791,15 @@ var reviewOf = /* @__PURE__ */ __name((row2) => ({
|
|
|
28760
28791
|
decidedAt: int(row2.decided_at),
|
|
28761
28792
|
createdAt: Number(row2.created_at)
|
|
28762
28793
|
}), "reviewOf");
|
|
28794
|
+
var attachmentOf2 = /* @__PURE__ */ __name((row2) => ({
|
|
28795
|
+
entryId: Number(row2.from_id),
|
|
28796
|
+
fileId: String(row2.target_text).slice(driveFileTarget("").length),
|
|
28797
|
+
title: str(fromJson(row2.metadata)?.title),
|
|
28798
|
+
documentId: int(row2.to_id)
|
|
28799
|
+
}), "attachmentOf");
|
|
28763
28800
|
var TRACKED = ["title", "starts_at", "ends_at", "location", "status", "recurrence", "recurrence_ends_at"];
|
|
28764
28801
|
var flag4 = /* @__PURE__ */ __name((value) => value ? 1 : 0, "flag");
|
|
28802
|
+
var cursorKey = /* @__PURE__ */ __name((calendarId) => `calendar:${calendarId}`, "cursorKey");
|
|
28765
28803
|
var addressOf = /* @__PURE__ */ __name((email) => email.trim().toLowerCase(), "addressOf");
|
|
28766
28804
|
var contactOf = /* @__PURE__ */ __name((context, email, name) => {
|
|
28767
28805
|
const address = addressOf(email);
|
|
@@ -28849,13 +28887,23 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28849
28887
|
setEntity(entry2, newEntity(entry2, now2), "new", "rules", now2);
|
|
28850
28888
|
}, "link");
|
|
28851
28889
|
const refreshEvent = /* @__PURE__ */ __name((eventId, now2) => {
|
|
28890
|
+
database.prepare("INSERT OR IGNORE INTO event_index_pending (indexable_type, id) VALUES ('event', ?)").run(eventId);
|
|
28852
28891
|
const entries = database.prepare(`SELECT ce.*, EXISTS (SELECT 1 FROM calendar_entry_participants p WHERE p.entry_id = ce.id AND p.self = 1
|
|
28853
28892
|
AND p.organizer = 1) AS own FROM calendar_entries ce WHERE ce.event_id = ? AND ce.deleted_at IS NULL
|
|
28854
|
-
ORDER BY
|
|
28893
|
+
ORDER BY trim(coalesce(ce.title, '') || coalesce(ce.description, '') || coalesce(ce.location, '')) <> '' DESC,
|
|
28894
|
+
own DESC, coalesce(ce.external_updated_at, ce.updated_at) DESC, ce.id DESC`).all(eventId);
|
|
28855
28895
|
const preferred2 = entries[0];
|
|
28856
|
-
if (!preferred2)
|
|
28857
|
-
return;
|
|
28858
28896
|
const event = database.prepare("SELECT * FROM events WHERE id = ?").get(eventId);
|
|
28897
|
+
if (!preferred2) {
|
|
28898
|
+
if (!event || !database.prepare("SELECT 1 FROM calendar_entries WHERE event_id = ?").get(eventId))
|
|
28899
|
+
return;
|
|
28900
|
+
const startsAt2 = int(event.starts_at);
|
|
28901
|
+
if (startsAt2 !== null && startsAt2 < now2)
|
|
28902
|
+
database.prepare("UPDATE events SET source_deleted_at = coalesce(source_deleted_at, ?), updated_at = ? WHERE id = ?").run(now2, now2, eventId);
|
|
28903
|
+
else
|
|
28904
|
+
database.prepare("UPDATE events SET status = 'cancelled', updated_at = ? WHERE id = ?").run(now2, eventId);
|
|
28905
|
+
return;
|
|
28906
|
+
}
|
|
28859
28907
|
const cancelled3 = entries.every((row2) => row2.status === "cancelled");
|
|
28860
28908
|
const series = preferred2.series_entry_id == null ? null : entryRow(Number(preferred2.series_entry_id));
|
|
28861
28909
|
const startsAt = int(preferred2.starts_at) ?? int(event.starts_at);
|
|
@@ -28888,13 +28936,42 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28888
28936
|
for (const email of stale3)
|
|
28889
28937
|
drop.run(entryId, email);
|
|
28890
28938
|
}, "saveParticipants");
|
|
28939
|
+
const saveAttachments = /* @__PURE__ */ __name((entryId, attachments2, now2) => {
|
|
28940
|
+
const held = new Map(database.prepare("SELECT id, target_text, to_id FROM links WHERE from_type = 'calendar_entry' AND from_id = ? AND kind = 'attached'").all(entryId).map((row2) => [String(row2.target_text), { id: Number(row2.id), documentId: int(row2.to_id) }]));
|
|
28941
|
+
const insert = database.prepare(`INSERT INTO links (from_type, from_id, to_type, to_id, kind, source, target_text, metadata, confirmed, author,
|
|
28942
|
+
created_at, updated_at) VALUES ('calendar_entry', ?, 'document', ?, 'attached', 'calendar', ?, ?, 1, 'rule', ?, ?)`);
|
|
28943
|
+
const retitle = database.prepare("UPDATE links SET metadata = ?, updated_at = ? WHERE id = ? AND metadata IS NOT ?");
|
|
28944
|
+
const resolve = database.prepare("UPDATE links SET to_id = ?, updated_at = ? WHERE id = ?");
|
|
28945
|
+
const handled = /* @__PURE__ */ new Set();
|
|
28946
|
+
for (const { fileId, title } of attachments2) {
|
|
28947
|
+
const file = fileId.trim();
|
|
28948
|
+
const target = driveFileTarget(file);
|
|
28949
|
+
if (!file || handled.has(target))
|
|
28950
|
+
continue;
|
|
28951
|
+
handled.add(target);
|
|
28952
|
+
const metadata3 = title ? JSON.stringify({ title }) : null;
|
|
28953
|
+
const link4 = held.get(target);
|
|
28954
|
+
if (link4 === void 0)
|
|
28955
|
+
insert.run(entryId, driveDocumentOf(database, file), target, metadata3, now2, now2);
|
|
28956
|
+
else {
|
|
28957
|
+
retitle.run(metadata3, now2, link4.id, metadata3);
|
|
28958
|
+
const document = link4.documentId === null ? driveDocumentOf(database, file) : null;
|
|
28959
|
+
if (document !== null)
|
|
28960
|
+
resolve.run(document, now2, link4.id);
|
|
28961
|
+
}
|
|
28962
|
+
held.delete(target);
|
|
28963
|
+
}
|
|
28964
|
+
const drop = database.prepare("DELETE FROM links WHERE id = ?");
|
|
28965
|
+
for (const { id: id2 } of held.values())
|
|
28966
|
+
drop.run(id2);
|
|
28967
|
+
}, "saveAttachments");
|
|
28891
28968
|
const existingFor = /* @__PURE__ */ __name((calendarId, input, seriesEntryId) => {
|
|
28892
28969
|
const same = database.prepare("SELECT * FROM calendar_entries WHERE calendar_id = ? AND external_id = ?").get(calendarId, input.externalId);
|
|
28893
28970
|
if (same || input.kind !== "occurrence" || input.originalStartsAt == null)
|
|
28894
28971
|
return same;
|
|
28895
28972
|
if (seriesEntryId !== null)
|
|
28896
28973
|
return database.prepare("SELECT * FROM calendar_entries WHERE series_entry_id = ? AND original_starts_at = ?").get(seriesEntryId, input.originalStartsAt);
|
|
28897
|
-
return database.prepare("SELECT * FROM calendar_entries WHERE calendar_id = ? AND series_entry_id IS NULL AND original_starts_at = ? AND
|
|
28974
|
+
return database.prepare("SELECT * FROM calendar_entries WHERE calendar_id = ? AND series_entry_id IS NULL AND original_starts_at = ? AND series_external_id = ?").get(calendarId, input.originalStartsAt, input.seriesExternalId ?? null);
|
|
28898
28975
|
}, "existingFor");
|
|
28899
28976
|
const saveEntry = /* @__PURE__ */ __name((calendarId, input, now2) => {
|
|
28900
28977
|
if (input.startsAt != null && input.endsAt != null && input.endsAt < input.startsAt)
|
|
@@ -28905,6 +28982,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28905
28982
|
const values = {
|
|
28906
28983
|
kind: input.kind,
|
|
28907
28984
|
series_entry_id: seriesEntryId,
|
|
28985
|
+
series_external_id: input.kind === "occurrence" ? input.seriesExternalId ?? null : null,
|
|
28908
28986
|
external_id: input.externalId,
|
|
28909
28987
|
ical_uid: input.icalUid ?? null,
|
|
28910
28988
|
original_starts_at: input.originalStartsAt ?? null,
|
|
@@ -28929,15 +29007,11 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28929
29007
|
join_url: joinUrl,
|
|
28930
29008
|
join_key: joinUrl ? joinKeyOf(joinUrl) ?? "" : null,
|
|
28931
29009
|
conference: input.conference ?? null,
|
|
28932
|
-
// The calendar's own page of the event names it in the query (`eid`), which opens nothing on its own.
|
|
28933
29010
|
url: input.url ?? null,
|
|
28934
29011
|
sequence: input.sequence ?? null,
|
|
28935
29012
|
etag: input.etag ?? null,
|
|
28936
29013
|
external_updated_at: input.externalUpdatedAt ?? null,
|
|
28937
|
-
metadata: toJson(
|
|
28938
|
-
...entryMetadata(input.metadata),
|
|
28939
|
-
...input.kind === "occurrence" && input.seriesExternalId ? { recurring_event_id: input.seriesExternalId } : {}
|
|
28940
|
-
}),
|
|
29014
|
+
metadata: toJson(entryMetadata(input.metadata)),
|
|
28941
29015
|
seen_at: now2,
|
|
28942
29016
|
deleted_at: null
|
|
28943
29017
|
};
|
|
@@ -28956,18 +29030,33 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28956
29030
|
}
|
|
28957
29031
|
if (input.participants)
|
|
28958
29032
|
saveParticipants(id2, input.participants, now2);
|
|
29033
|
+
if (input.attachments)
|
|
29034
|
+
saveAttachments(id2, input.attachments, now2);
|
|
28959
29035
|
if (input.kind === "series")
|
|
28960
|
-
database.prepare("UPDATE calendar_entries SET series_entry_id = ?, updated_at = ? WHERE calendar_id = ? AND kind = 'occurrence' AND series_entry_id IS NULL AND
|
|
29036
|
+
database.prepare("UPDATE calendar_entries SET series_entry_id = ?, updated_at = ? WHERE calendar_id = ? AND kind = 'occurrence' AND series_entry_id IS NULL AND series_external_id = ?").run(id2, now2, calendarId, input.externalId);
|
|
28961
29037
|
return entryOf(entryRow(id2));
|
|
28962
29038
|
}, "saveEntry");
|
|
28963
|
-
const
|
|
28964
|
-
|
|
28965
|
-
|
|
28966
|
-
|
|
28967
|
-
|
|
28968
|
-
|
|
28969
|
-
|
|
29039
|
+
const cancel = /* @__PURE__ */ __name((row2, now2) => {
|
|
29040
|
+
database.prepare(`INSERT INTO calendar_entry_revisions (entry_id, title, starts_at, ends_at, location, status, recurrence,
|
|
29041
|
+
recurrence_ends_at, external_updated_at, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(Number(row2.id), str(row2.title), int(row2.starts_at), int(row2.ends_at), str(row2.location), str(row2.status), str(row2.recurrence), int(row2.recurrence_ends_at), int(row2.external_updated_at), now2);
|
|
29042
|
+
database.prepare("UPDATE calendar_entries SET status = 'cancelled', updated_at = ? WHERE id = ?").run(now2, Number(row2.id));
|
|
29043
|
+
}, "cancel");
|
|
29044
|
+
const cancelOccurrences = /* @__PURE__ */ __name((seriesEntryId, now2) => {
|
|
29045
|
+
const occurrences = database.prepare("SELECT * FROM calendar_entries WHERE series_entry_id = ? AND status <> 'cancelled' AND deleted_at IS NULL").all(seriesEntryId);
|
|
29046
|
+
for (const row2 of occurrences)
|
|
29047
|
+
cancel(row2, now2);
|
|
28970
29048
|
}, "cancelOccurrences");
|
|
29049
|
+
const refreshAround = /* @__PURE__ */ __name((entryIds, now2) => {
|
|
29050
|
+
const ids = JSON.stringify(entryIds);
|
|
29051
|
+
const touched = database.prepare(`SELECT DISTINCT ce.event_id, ce.event_series_id FROM calendar_entries ce
|
|
29052
|
+
WHERE ce.id IN (SELECT value FROM json_each(?)) OR ce.series_entry_id IN (SELECT value FROM json_each(?))`).all(ids, ids);
|
|
29053
|
+
for (const row2 of touched) {
|
|
29054
|
+
if (row2.event_series_id != null)
|
|
29055
|
+
refreshSeries(Number(row2.event_series_id), now2);
|
|
29056
|
+
if (row2.event_id != null)
|
|
29057
|
+
refreshEvent(Number(row2.event_id), now2);
|
|
29058
|
+
}
|
|
29059
|
+
}, "refreshAround");
|
|
28971
29060
|
return {
|
|
28972
29061
|
saveCalendars: /* @__PURE__ */ __name(async (accountId, calendars2, now2) => write(database, () => {
|
|
28973
29062
|
const upsert2 = database.prepare(`INSERT INTO calendars (account_id, external_id, title, timezone, access_role, primary_calendar, synced, seen_at,
|
|
@@ -28976,7 +29065,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28976
29065
|
access_role = excluded.access_role, primary_calendar = excluded.primary_calendar, seen_at = excluded.seen_at,
|
|
28977
29066
|
deleted_at = NULL, updated_at = excluded.updated_at
|
|
28978
29067
|
RETURNING *`);
|
|
28979
|
-
return calendars2.map((one) => calendarOf(upsert2.get(accountId, one.externalId, one.title, one.timezone, one.accessRole, flag4(one.primary), flag4(one.
|
|
29068
|
+
return calendars2.map((one) => calendarOf(upsert2.get(accountId, one.externalId, one.title, one.timezone, one.accessRole, flag4(one.primary), flag4(one.syncByDefault), now2, now2, now2)));
|
|
28980
29069
|
}), "saveCalendars"),
|
|
28981
29070
|
calendars: /* @__PURE__ */ __name(async (accountId) => database.prepare("SELECT * FROM calendars WHERE account_id = ? ORDER BY primary_calendar DESC, title, id").all(accountId).map(calendarOf), "calendars"),
|
|
28982
29071
|
setCalendarSynced: /* @__PURE__ */ __name(async (calendarId, synced, now2) => write(database, () => {
|
|
@@ -28994,23 +29083,52 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28994
29083
|
});
|
|
28995
29084
|
for (const entry2 of saved)
|
|
28996
29085
|
if (entry2.kind === "series" && entry2.status === "cancelled")
|
|
28997
|
-
cancelOccurrences(entry2, now2);
|
|
29086
|
+
cancelOccurrences(entry2.id, now2);
|
|
28998
29087
|
const current = saved.map(({ id: id2 }) => entryOf(entryRow(id2)));
|
|
28999
29088
|
for (const entry2 of current)
|
|
29000
29089
|
link3(entry2, now2);
|
|
29001
|
-
|
|
29002
|
-
WHERE ce.id IN (SELECT value FROM json_each(?)) OR ce.series_entry_id IN (SELECT value FROM json_each(?))`).all(JSON.stringify(current.map(({ id: id2 }) => id2)), JSON.stringify(current.map(({ id: id2 }) => id2)));
|
|
29003
|
-
for (const row2 of touched) {
|
|
29004
|
-
if (row2.event_series_id != null)
|
|
29005
|
-
refreshSeries(Number(row2.event_series_id), now2);
|
|
29006
|
-
if (row2.event_id != null)
|
|
29007
|
-
refreshEvent(Number(row2.event_id), now2);
|
|
29008
|
-
}
|
|
29090
|
+
refreshAround(current.map(({ id: id2 }) => id2), now2);
|
|
29009
29091
|
return entries.map((input) => entryOf(entryRow(ids.get(input))));
|
|
29010
29092
|
}), "saveEntries"),
|
|
29011
|
-
|
|
29012
|
-
|
|
29013
|
-
|
|
29093
|
+
removeEntries: /* @__PURE__ */ __name(async (calendarId, externalIds, now2) => write(database, () => {
|
|
29094
|
+
calendarRow(calendarId);
|
|
29095
|
+
const removed = database.prepare(`SELECT * FROM calendar_entries WHERE calendar_id = ? AND external_id IN (SELECT value FROM json_each(?))
|
|
29096
|
+
AND status <> 'cancelled' AND deleted_at IS NULL`).all(calendarId, JSON.stringify(externalIds));
|
|
29097
|
+
for (const row2 of removed) {
|
|
29098
|
+
cancel(row2, now2);
|
|
29099
|
+
database.prepare("UPDATE calendar_entries SET seen_at = ? WHERE id = ?").run(now2, Number(row2.id));
|
|
29100
|
+
if (row2.kind === "series")
|
|
29101
|
+
cancelOccurrences(Number(row2.id), now2);
|
|
29102
|
+
}
|
|
29103
|
+
refreshAround(removed.map((row2) => Number(row2.id)), now2);
|
|
29104
|
+
return removed.length;
|
|
29105
|
+
}), "removeEntries"),
|
|
29106
|
+
markUnseen: /* @__PURE__ */ __name(async (calendarId, seenBefore, window, now2) => write(database, () => {
|
|
29107
|
+
const marked = database.prepare(`UPDATE calendar_entries SET deleted_at = ?, updated_at = ? WHERE calendar_id = ? AND deleted_at IS NULL
|
|
29108
|
+
AND (seen_at IS NULL OR seen_at < ?)
|
|
29109
|
+
AND (kind <> 'occurrence' OR exception = 1 OR (original_starts_at >= ? AND original_starts_at < ?))
|
|
29110
|
+
RETURNING event_id`).all(now2, now2, calendarId, seenBefore, window.from, window.to);
|
|
29111
|
+
for (const eventId of new Set(marked.map((row2) => int(row2.event_id))))
|
|
29112
|
+
if (eventId !== null)
|
|
29113
|
+
refreshEvent(eventId, now2);
|
|
29114
|
+
return marked.length;
|
|
29115
|
+
}), "markUnseen"),
|
|
29116
|
+
entry: /* @__PURE__ */ __name(async (calendarId, externalId) => read(database, () => {
|
|
29117
|
+
const row2 = database.prepare("SELECT * FROM calendar_entries WHERE calendar_id = ? AND external_id = ?").get(calendarId, externalId);
|
|
29118
|
+
return row2 ? entryOf(row2) : null;
|
|
29119
|
+
}), "entry"),
|
|
29120
|
+
cursor: /* @__PURE__ */ __name(async (calendarId) => read(database, () => {
|
|
29121
|
+
const { account_id } = calendarRow(calendarId);
|
|
29122
|
+
return str(database.prepare("SELECT value FROM sync_cursors WHERE account_id = ? AND key = ?").get(Number(account_id), cursorKey(calendarId))?.value);
|
|
29123
|
+
}), "cursor"),
|
|
29124
|
+
setCursor: /* @__PURE__ */ __name(async (calendarId, value, now2) => write(database, () => {
|
|
29125
|
+
const accountId = Number(calendarRow(calendarId).account_id);
|
|
29126
|
+
if (value === null)
|
|
29127
|
+
database.prepare("DELETE FROM sync_cursors WHERE account_id = ? AND key = ?").run(accountId, cursorKey(calendarId));
|
|
29128
|
+
else
|
|
29129
|
+
database.prepare(`INSERT INTO sync_cursors (account_id, key, value, created_at, updated_at) VALUES (?, ?, ?, ?, ?)
|
|
29130
|
+
ON CONFLICT (account_id, key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at`).run(accountId, cursorKey(calendarId), value, now2, now2);
|
|
29131
|
+
}), "setCursor"),
|
|
29014
29132
|
events: /* @__PURE__ */ __name(async (filter = {}) => {
|
|
29015
29133
|
const clauses = ["e.deleted_at IS NULL"];
|
|
29016
29134
|
const params = [];
|
|
@@ -29039,7 +29157,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
29039
29157
|
const offset = filter.offset ?? 0;
|
|
29040
29158
|
if (!Number.isInteger(limit) || limit < 1 || limit > 1e3 || !Number.isInteger(offset) || offset < 0)
|
|
29041
29159
|
throw new CliError("validation_error", "limit takes 1\u20131000 and offset 0 or more");
|
|
29042
|
-
return database.prepare(`SELECT e.* FROM events e WHERE ${clauses.join(" AND ")} ORDER BY e.starts_at, e.id LIMIT ? OFFSET ?`).all(...params, limit, offset).map(eventOf);
|
|
29160
|
+
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);
|
|
29043
29161
|
}, "events"),
|
|
29044
29162
|
event: /* @__PURE__ */ __name(async (id2) => read(database, () => {
|
|
29045
29163
|
const row2 = database.prepare("SELECT * FROM events WHERE id = ?").get(id2);
|
|
@@ -29051,7 +29169,8 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
29051
29169
|
event: eventOf(row2),
|
|
29052
29170
|
entries,
|
|
29053
29171
|
participants: database.prepare("SELECT * FROM calendar_entry_participants WHERE entry_id IN (SELECT value FROM json_each(?)) ORDER BY entry_id, email").all(ids).map(participantOf2),
|
|
29054
|
-
revisions: database.prepare("SELECT * FROM calendar_entry_revisions WHERE entry_id IN (SELECT value FROM json_each(?)) ORDER BY created_at, id").all(ids).map(revisionOf)
|
|
29172
|
+
revisions: database.prepare("SELECT * FROM calendar_entry_revisions WHERE entry_id IN (SELECT value FROM json_each(?)) ORDER BY created_at, id").all(ids).map(revisionOf),
|
|
29173
|
+
attachments: database.prepare("SELECT l.from_id, l.target_text, CASE WHEN d.deleted_at IS NULL THEN l.to_id END AS to_id, l.metadata FROM links l LEFT JOIN documents d ON d.id = l.to_id WHERE l.from_type = 'calendar_entry' AND l.kind = 'attached' AND l.from_id IN (SELECT value FROM json_each(?)) ORDER BY l.from_id, l.id").all(ids).map(attachmentOf2)
|
|
29055
29174
|
};
|
|
29056
29175
|
}), "event"),
|
|
29057
29176
|
linkEntry: /* @__PURE__ */ __name(async (entryId, eventId, now2) => write(database, () => {
|
|
@@ -29147,7 +29266,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
29147
29266
|
};
|
|
29148
29267
|
}, "eventStoreOver");
|
|
29149
29268
|
|
|
29150
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29269
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
|
|
29151
29270
|
var CATALOG_QUERY = defineQuery({
|
|
29152
29271
|
entity: "document",
|
|
29153
29272
|
backend: "sql",
|
|
@@ -29389,7 +29508,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
29389
29508
|
};
|
|
29390
29509
|
}, "catalogStoreOver");
|
|
29391
29510
|
|
|
29392
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29511
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/context/evidence.js
|
|
29393
29512
|
import { createHash as createHash11 } from "node:crypto";
|
|
29394
29513
|
var CONTEXT_MAX_READ_BYTES = 262144;
|
|
29395
29514
|
var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
|
|
@@ -29487,7 +29606,7 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
|
|
|
29487
29606
|
return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
|
|
29488
29607
|
}, "contextEvidenceRequest");
|
|
29489
29608
|
|
|
29490
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29609
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
|
|
29491
29610
|
var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
|
|
29492
29611
|
var field2 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
|
|
29493
29612
|
CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
|
|
@@ -29500,7 +29619,7 @@ var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
|
|
|
29500
29619
|
THEN 'source-modified' ELSE 'stored-update' END`;
|
|
29501
29620
|
var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field2("sourceUrl")})`;
|
|
29502
29621
|
|
|
29503
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29622
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
|
|
29504
29623
|
var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
|
|
29505
29624
|
const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
|
|
29506
29625
|
signal?.throwIfAborted();
|
|
@@ -29599,7 +29718,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
|
|
|
29599
29718
|
});
|
|
29600
29719
|
}, "readMeetingContextEvidence");
|
|
29601
29720
|
|
|
29602
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29721
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
|
|
29603
29722
|
var corpora = {
|
|
29604
29723
|
message: {
|
|
29605
29724
|
table: "messages",
|
|
@@ -29828,7 +29947,528 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
29828
29947
|
}
|
|
29829
29948
|
}), "contextRecordsOver");
|
|
29830
29949
|
|
|
29831
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29950
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
|
|
29951
|
+
var NOTE_FIELDS = [
|
|
29952
|
+
"text",
|
|
29953
|
+
"exact",
|
|
29954
|
+
"body",
|
|
29955
|
+
"tag",
|
|
29956
|
+
"date",
|
|
29957
|
+
"in",
|
|
29958
|
+
"has",
|
|
29959
|
+
"title",
|
|
29960
|
+
"site",
|
|
29961
|
+
"lang",
|
|
29962
|
+
"author",
|
|
29963
|
+
"keyword",
|
|
29964
|
+
"source"
|
|
29965
|
+
];
|
|
29966
|
+
var quoted2 = /* @__PURE__ */ __name((value) => `"${value.replaceAll('"', '""')}"`, "quoted");
|
|
29967
|
+
var bound3 = /* @__PURE__ */ __name((sql2, ...params) => ({ sql: sql2, params, exact: true }), "bound");
|
|
29968
|
+
var combine2 = /* @__PURE__ */ __name((parts2, operator) => ({
|
|
29969
|
+
sql: parts2.length ? `(${parts2.map(({ sql: sql2 }) => sql2).join(` ${operator} `)})` : operator === "AND" ? "1" : "0",
|
|
29970
|
+
params: parts2.flatMap(({ params }) => params),
|
|
29971
|
+
exact: parts2.every(({ exact }) => exact)
|
|
29972
|
+
}), "combine");
|
|
29973
|
+
var CORPORA2 = [
|
|
29974
|
+
{
|
|
29975
|
+
type: "document",
|
|
29976
|
+
noun: "note",
|
|
29977
|
+
fields: NOTE_FIELDS,
|
|
29978
|
+
view: "(SELECT id, account_id AS folder_id, external_id AS path, title, coalesce(body, '') AS text, metadata, updated_at AS at, deleted_at FROM documents)",
|
|
29979
|
+
words: "document_words",
|
|
29980
|
+
stems: "document_stems",
|
|
29981
|
+
live: "coalesce(json_extract(n.metadata, '$.catalog.active'), 1)=1",
|
|
29982
|
+
inAccounts: /* @__PURE__ */ __name((ids) => bound3("n.folder_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))", ids), "inAccounts"),
|
|
29983
|
+
tagged: /* @__PURE__ */ __name((tag2) => bound3(`(n.id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'document') OR n.folder_id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'account') OR EXISTS (SELECT 1 FROM links l JOIN resolved_tags t ON t.id=l.to_id WHERE l.from_type = 'account' AND l.from_id = n.folder_id AND l.kind = ${linkKind("labelled")} AND l.to_type = 'tag' AND t.name = ? AND substr(n.path, 1, length(l.anchor) + 1) = l.anchor || '/'))`, tag2, tag2, tag2), "tagged")
|
|
29984
|
+
},
|
|
29985
|
+
{
|
|
29986
|
+
type: "note",
|
|
29987
|
+
noun: "note",
|
|
29988
|
+
fields: NOTE_FIELDS,
|
|
29989
|
+
view: "(SELECT id, NULL AS folder_id, NULL AS path, title, body AS text, NULL AS metadata, updated_at AS at, deleted_at FROM notes)",
|
|
29990
|
+
words: "note_words",
|
|
29991
|
+
stems: "note_stems",
|
|
29992
|
+
tagged: /* @__PURE__ */ __name((tag2) => bound3("n.id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'note')", tag2), "tagged")
|
|
29993
|
+
}
|
|
29994
|
+
];
|
|
29995
|
+
var searchNotes = /* @__PURE__ */ __name((context, query) => {
|
|
29996
|
+
const offset = query.offset ?? 0;
|
|
29997
|
+
const chosen = CORPORA2.filter(({ type }) => (query.source === void 0 || query.source === "file" === (type === "document")) && (!query.folderIds?.length || query.withInternal === true || type === "document"));
|
|
29998
|
+
const rows = chosen.flatMap((corpus) => searchCorpus(context, { ...query, ...query.folderIds ? { accountIds: query.folderIds } : {} }, corpus));
|
|
29999
|
+
const exactFirst = rows.some((row2) => row2.exact !== void 0);
|
|
30000
|
+
rows.sort((a, b) => query.newest ? (b.at ?? 0) - (a.at ?? 0) || a.id - b.id : (exactFirst ? Number(b.exact === true) - Number(a.exact === true) : 0) || Number(a.relevance === null) - Number(b.relevance === null) || (a.relevance ?? 0) - (b.relevance ?? 0) || (b.at ?? 0) - (a.at ?? 0) || a.id - b.id);
|
|
30001
|
+
const read2 = {
|
|
30002
|
+
document: context.database.prepare("SELECT * FROM documents WHERE id = ?"),
|
|
30003
|
+
note: context.database.prepare("SELECT * FROM notes WHERE id = ?")
|
|
30004
|
+
};
|
|
30005
|
+
return {
|
|
30006
|
+
items: rows.slice(offset, offset + query.limit).map((row2) => {
|
|
30007
|
+
const found2 = read2[row2.type === "document" ? "document" : "note"].get(row2.id);
|
|
30008
|
+
const note2 = row2.type === "document" ? documentOf(found2) : noteOf(found2);
|
|
30009
|
+
return {
|
|
30010
|
+
ref: note2.ref,
|
|
30011
|
+
note: note2,
|
|
30012
|
+
relevance: row2.relevance,
|
|
30013
|
+
...row2.exact === void 0 ? {} : { exact: row2.exact }
|
|
30014
|
+
};
|
|
30015
|
+
}),
|
|
30016
|
+
hasMore: rows.length > offset + query.limit
|
|
30017
|
+
};
|
|
30018
|
+
}, "searchNotes");
|
|
30019
|
+
var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
|
|
30020
|
+
const { database } = context;
|
|
30021
|
+
const wordMatch2 = /* @__PURE__ */ __name((match) => ({
|
|
30022
|
+
sql: `n.id IN (SELECT rowid FROM ${corpus.words} WHERE ${corpus.words} MATCH ?)`,
|
|
30023
|
+
params: [`normalized_text : (${match})`],
|
|
30024
|
+
exact: true,
|
|
30025
|
+
fts: match
|
|
30026
|
+
}), "wordMatch");
|
|
30027
|
+
const started = context.now();
|
|
30028
|
+
const budget = { work: 0 };
|
|
30029
|
+
let expansions = 0;
|
|
30030
|
+
const check3 = /* @__PURE__ */ __name(() => {
|
|
30031
|
+
if (query.signal?.aborted)
|
|
30032
|
+
throw new CliError("validation_error", "search was aborted", { reason: "query.aborted", complete: false });
|
|
30033
|
+
if (context.now() - started > QUERY_LIMITS2.milliseconds)
|
|
30034
|
+
exhausted("time");
|
|
30035
|
+
}, "check");
|
|
30036
|
+
const tests = /* @__PURE__ */ new Map();
|
|
30037
|
+
const fragments = /* @__PURE__ */ new Map();
|
|
30038
|
+
const automaton = /* @__PURE__ */ __name((pattern, node) => compileAutomaton(pattern, node.span), "automaton");
|
|
30039
|
+
let titles;
|
|
30040
|
+
const foldedTitles = /* @__PURE__ */ __name(() => titles ??= database.prepare(`SELECT id, title FROM ${corpus.view} n WHERE n.title IS NOT NULL AND n.deleted_at IS NULL`).all().map((row2) => ({ id: Number(row2.id), title: normalize(String(row2.title)) })), "foldedTitles");
|
|
30041
|
+
const leaf2 = /* @__PURE__ */ __name((node) => {
|
|
30042
|
+
const { field: field3, operator, value } = node;
|
|
30043
|
+
if (!corpus.fields.includes(field3))
|
|
30044
|
+
searchError("query.unsupported-field", node.span, `${field3}: is not ${corpus.noun === "event" ? "an" : "a"} ${corpus.noun} field \u2014 ${corpus.noun}s take ${corpus.fields.join(", ")}`);
|
|
30045
|
+
if ((field3 === "text" || field3 === "exact") && value === "")
|
|
30046
|
+
return bound3("0");
|
|
30047
|
+
if (isStemmed(node)) {
|
|
30048
|
+
if (!query.stemmer)
|
|
30049
|
+
throw new Error("a stemmed leaf reached the notes search without the store's stemmer");
|
|
30050
|
+
const text5 = normalize(value);
|
|
30051
|
+
if (!/[\p{L}\p{N}]/u.test(text5))
|
|
30052
|
+
return bound3("0");
|
|
30053
|
+
const stems = query.stemmer.phrases(value);
|
|
30054
|
+
return {
|
|
30055
|
+
sql: `n.id IN (SELECT rowid FROM ${corpus.words} WHERE ${corpus.words} MATCH ?)${stems ? ` OR n.id IN (SELECT rowid FROM ${corpus.stems} WHERE ${corpus.stems} MATCH ?)` : ""}`,
|
|
30056
|
+
params: [`normalized_text : (${quoted2(text5)})`, ...stems ? [`stems : (${stems})`] : []],
|
|
30057
|
+
exact: true,
|
|
30058
|
+
fts: quoted2(text5),
|
|
30059
|
+
...stems ? { stems } : {}
|
|
30060
|
+
};
|
|
30061
|
+
}
|
|
30062
|
+
if (field3 === "text" || field3 === "exact") {
|
|
30063
|
+
if (operator === "term" || operator === "phrase") {
|
|
30064
|
+
const text5 = normalize(value);
|
|
30065
|
+
const stems = query.stemmer?.phrases(value);
|
|
30066
|
+
return /[\p{L}\p{N}]/u.test(text5) ? { ...wordMatch2(quoted2(text5)), ...stems ? { stems } : {} } : bound3("0");
|
|
30067
|
+
}
|
|
30068
|
+
const pattern = operator === "wildcard" ? wildcardPattern(normalize(value)) : foldRegex(value, node.span);
|
|
30069
|
+
const matcher = automaton(pattern, node);
|
|
30070
|
+
const prefix = prefixOf(pattern);
|
|
30071
|
+
const terms2 = database.prepare(`SELECT term FROM ${corpus.words}_vocab WHERE col='normalized_text'${prefix ? " AND term>=? AND term<=?" : ""} ORDER BY term LIMIT ?`).all(...prefix ? [prefix, `${prefix}\u{10FFFF}`] : [], QUERY_LIMITS2.expansions + 1);
|
|
30072
|
+
expansions += terms2.length;
|
|
30073
|
+
if (expansions > QUERY_LIMITS2.expansions)
|
|
30074
|
+
exhausted("term expansions");
|
|
30075
|
+
const matches2 = terms2.flatMap(({ term }) => {
|
|
30076
|
+
check3();
|
|
30077
|
+
return matcher.test(String(term), budget) ? [quoted2(String(term))] : [];
|
|
30078
|
+
});
|
|
30079
|
+
return matches2.length ? wordMatch2(matches2.join(" OR ")) : bound3("0");
|
|
30080
|
+
}
|
|
30081
|
+
if (field3 === "body") {
|
|
30082
|
+
if (operator === "term" || operator === "phrase")
|
|
30083
|
+
return bound3("n.text = ?", value);
|
|
30084
|
+
const matcher = automaton(operator === "wildcard" ? wildcardPattern(value) : value, node);
|
|
30085
|
+
tests.set(node, (text5) => matcher.test(text5, budget));
|
|
30086
|
+
return { sql: "1", params: [], exact: false };
|
|
30087
|
+
}
|
|
30088
|
+
if (field3 === "tag") {
|
|
30089
|
+
const tag2 = tagOf(value);
|
|
30090
|
+
if (tag2 === void 0)
|
|
30091
|
+
searchError("query.invalid-tag", node.span);
|
|
30092
|
+
return corpus.tagged?.(canonicalTagNamed(database, tag2)?.name ?? tag2) ?? bound3("0");
|
|
30093
|
+
}
|
|
30094
|
+
if (field3 === "source")
|
|
30095
|
+
return bound3(value.toLowerCase() === (corpus.type === "note" ? "internal" : "file") ? "1" : "0");
|
|
30096
|
+
if (field3 === "has") {
|
|
30097
|
+
if (value.toLowerCase() !== "text")
|
|
30098
|
+
searchError("query.unknown-value", node.span, `has:${value} is a message field \u2014 notes take has:text`);
|
|
30099
|
+
return bound3("length(trim(coalesce(n.text,''))) > 0");
|
|
30100
|
+
}
|
|
30101
|
+
if (field3 === "title" || field3 === "site" || field3 === "lang" || field3 === "author" || field3 === "keyword") {
|
|
30102
|
+
const wanted = normalize(value);
|
|
30103
|
+
if (wanted === "")
|
|
30104
|
+
return bound3("0");
|
|
30105
|
+
const folded5 = /* @__PURE__ */ __name((key2) => `coalesce(json_extract(n.metadata, '$.folded.${key2}'), '')`, "folded");
|
|
30106
|
+
if (field3 === "keyword")
|
|
30107
|
+
return bound3("EXISTS (SELECT 1 FROM json_each(n.metadata, '$.folded.keywords') WHERE value = ?)", wanted);
|
|
30108
|
+
if (field3 === "lang")
|
|
30109
|
+
return bound3(`(${folded5("language")} = ? OR ${folded5("language")} LIKE ? || '-%')`, wanted, wanted);
|
|
30110
|
+
if (field3 === "title") {
|
|
30111
|
+
check3();
|
|
30112
|
+
const ids = foldedTitles().flatMap(({ id: id2, title }) => title.includes(wanted) ? [id2] : []);
|
|
30113
|
+
return bound3(`(instr(${folded5("title")}, ?) > 0 OR n.id IN (SELECT value FROM json_each(?)))`, wanted, JSON.stringify(ids));
|
|
30114
|
+
}
|
|
30115
|
+
return bound3(`instr(${folded5(field3)}, ?) > 0`, wanted);
|
|
30116
|
+
}
|
|
30117
|
+
if (field3 === "date") {
|
|
30118
|
+
const range = node.resolution?.date;
|
|
30119
|
+
if (!range)
|
|
30120
|
+
searchError("query.invalid-ast", node.span);
|
|
30121
|
+
return combine2([
|
|
30122
|
+
...range.lower === void 0 ? [] : [bound3(`n.at ${range.lower_inclusive ? ">=" : ">"} ?`, range.lower)],
|
|
30123
|
+
...range.upper === void 0 ? [] : [bound3(`n.at ${range.upper_inclusive ? "<=" : "<"} ?`, range.upper)]
|
|
30124
|
+
], "AND");
|
|
30125
|
+
}
|
|
30126
|
+
return bound3([corpus.noun, `${corpus.noun}s`].includes(value.toLowerCase()) ? "1" : "0");
|
|
30127
|
+
}, "leaf");
|
|
30128
|
+
const compile2 = /* @__PURE__ */ __name((node) => {
|
|
30129
|
+
if (node.kind === "predicate") {
|
|
30130
|
+
const fragment = leaf2(node);
|
|
30131
|
+
const wrapped = { ...fragment, sql: `(${fragment.sql})` };
|
|
30132
|
+
fragments.set(node, wrapped);
|
|
30133
|
+
return wrapped;
|
|
30134
|
+
}
|
|
30135
|
+
const parts2 = node.clauses.map(({ occur, node: node2 }) => ({ occur, part: compile2(node2) }));
|
|
30136
|
+
const must = parts2.filter(({ occur }) => occur === "must").map(({ part }) => part);
|
|
30137
|
+
const should = parts2.filter(({ occur }) => occur === "should").map(({ part }) => part);
|
|
30138
|
+
const not = parts2.filter(({ occur }) => occur === "must_not").map(({ part }) => part.exact ? { ...part, sql: `NOT coalesce(${part.sql},0)` } : { sql: "1", params: [], exact: false });
|
|
30139
|
+
return combine2([must.length ? combine2(must, "AND") : combine2(should, "OR"), ...not], "AND");
|
|
30140
|
+
}, "compile");
|
|
30141
|
+
const required3 = /* @__PURE__ */ __name((node, index2) => {
|
|
30142
|
+
if (node.kind === "predicate")
|
|
30143
|
+
return fragments.get(node)?.[index2];
|
|
30144
|
+
const must = node.clauses.filter(({ occur }) => occur === "must");
|
|
30145
|
+
const parts2 = (must.length ? must : node.clauses.filter(({ occur }) => occur === "should")).map(({ node: node2 }) => required3(node2, index2));
|
|
30146
|
+
if (must.length) {
|
|
30147
|
+
const known2 = parts2.filter((part) => part !== void 0);
|
|
30148
|
+
return known2.length ? known2.map((part) => `(${part})`).join(" AND ") : void 0;
|
|
30149
|
+
}
|
|
30150
|
+
return parts2.length && parts2.every((part) => part !== void 0) ? parts2.map((part) => `(${part})`).join(" OR ") : void 0;
|
|
30151
|
+
}, "required");
|
|
30152
|
+
return read(database, () => {
|
|
30153
|
+
check3();
|
|
30154
|
+
const expression = compile2(query.root);
|
|
30155
|
+
const stemmed = [...fragments.keys()].some(isStemmed);
|
|
30156
|
+
const scope3 = combine2([
|
|
30157
|
+
bound3("n.deleted_at IS NULL"),
|
|
30158
|
+
...corpus.live ? [bound3(corpus.live)] : [],
|
|
30159
|
+
...query.accountIds?.length && corpus.inAccounts ? [corpus.inAccounts(JSON.stringify(query.accountIds))] : []
|
|
30160
|
+
], "AND");
|
|
30161
|
+
const where = combine2([scope3, expression], "AND");
|
|
30162
|
+
const ranking = query.newest ? void 0 : required3(query.root, stemmed ? "stems" : "fts");
|
|
30163
|
+
const exactTier = stemmed ? required3(query.root, "fts") : void 0;
|
|
30164
|
+
const ctes = [];
|
|
30165
|
+
const cteParams = [];
|
|
30166
|
+
if (ranking) {
|
|
30167
|
+
const table = stemmed ? corpus.stems : corpus.words;
|
|
30168
|
+
ctes.push(`f(id, rank) AS MATERIALIZED (SELECT rowid, bm25(${table}, 1.0, 0.0) FROM ${table} WHERE ${table} MATCH ?)`);
|
|
30169
|
+
cteParams.push(`${stemmed ? "stems" : "normalized_text"} : (${ranking})`);
|
|
30170
|
+
}
|
|
30171
|
+
if (exactTier) {
|
|
30172
|
+
ctes.push(`x(id) AS MATERIALIZED (SELECT rowid FROM ${corpus.words} WHERE ${corpus.words} MATCH ?)`);
|
|
30173
|
+
cteParams.push(`normalized_text : (${exactTier})`);
|
|
30174
|
+
}
|
|
30175
|
+
const order = query.newest ? "n.at DESC, n.id" : `${exactTier ? "exact DESC, " : ""}${ranking ? "f.rank IS NULL, f.rank, " : ""}n.at DESC, n.id`;
|
|
30176
|
+
const offset = query.offset ?? 0;
|
|
30177
|
+
const leaves = [...fragments.entries()].filter(([node]) => !tests.has(node));
|
|
30178
|
+
const projection = tests.size ? leaves.map(([, fragment], index2) => `, coalesce(${fragment.sql}, 0) AS q${index2}`).join("") : "";
|
|
30179
|
+
const window = tests.size ? QUERY_LIMITS2.candidates + 1 : query.limit + offset + 1;
|
|
30180
|
+
const rows = database.prepare(`${ctes.length ? `WITH ${ctes.join(", ")} ` : ""}SELECT n.*, ${ranking ? "f.rank" : "NULL"} AS relevance${exactTier ? ", n.id IN (SELECT id FROM x) AS exact" : ""}${projection}
|
|
30181
|
+
FROM ${corpus.view} n${ranking ? " LEFT JOIN f ON f.id = n.id" : ""} WHERE ${where.sql} ORDER BY ${order} LIMIT ?`).all(...cteParams, ...leaves.flatMap(([, fragment]) => tests.size ? fragment.params : []), ...where.params, window);
|
|
30182
|
+
if (tests.size && rows.length > QUERY_LIMITS2.candidates)
|
|
30183
|
+
exhausted("candidates");
|
|
30184
|
+
const evaluate = /* @__PURE__ */ __name((node, row2, text5) => {
|
|
30185
|
+
if (node.kind === "predicate") {
|
|
30186
|
+
const test = tests.get(node);
|
|
30187
|
+
return test ? test(text5) : Number(row2[`q${leaves.findIndex(([leaf3]) => leaf3 === node)}`]) === 1;
|
|
30188
|
+
}
|
|
30189
|
+
const must = node.clauses.filter(({ occur }) => occur === "must");
|
|
30190
|
+
const should = node.clauses.filter(({ occur }) => occur === "should");
|
|
30191
|
+
const not = node.clauses.filter(({ occur }) => occur === "must_not");
|
|
30192
|
+
return (must.length ? must.every(({ node: node2 }) => evaluate(node2, row2, text5)) : should.length > 0 && should.some(({ node: node2 }) => evaluate(node2, row2, text5))) && not.every(({ node: node2 }) => !evaluate(node2, row2, text5));
|
|
30193
|
+
}, "evaluate");
|
|
30194
|
+
const matched = tests.size ? rows.filter((row2) => {
|
|
30195
|
+
check3();
|
|
30196
|
+
const text5 = noteIndexText(row2.title === null ? null : String(row2.title), String(row2.text));
|
|
30197
|
+
budget.work += text5.length;
|
|
30198
|
+
if (budget.work > QUERY_LIMITS2.work)
|
|
30199
|
+
exhausted("detector work");
|
|
30200
|
+
return evaluate(query.root, row2, text5);
|
|
30201
|
+
}) : rows;
|
|
30202
|
+
return matched.map((row2) => ({
|
|
30203
|
+
type: corpus.type,
|
|
30204
|
+
id: Number(row2.id),
|
|
30205
|
+
at: row2.at == null ? null : Number(row2.at),
|
|
30206
|
+
relevance: row2.relevance === null || row2.relevance === void 0 ? null : Number(row2.relevance),
|
|
30207
|
+
...exactTier ? { exact: Number(row2.exact) === 1 } : {}
|
|
30208
|
+
}));
|
|
30209
|
+
});
|
|
30210
|
+
}, "searchCorpus");
|
|
30211
|
+
var SCAN_PAGE3 = 5e3;
|
|
30212
|
+
var LIVE2 = "((k.chunkable_type = 'document' AND EXISTS (SELECT 1 FROM documents d WHERE d.id = k.chunkable_id AND d.deleted_at IS NULL AND coalesce(json_extract(d.metadata, '$.catalog.active'), 1)=1 AND (? IS NULL OR d.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))))) OR (k.chunkable_type = 'note' AND ? IS NULL AND EXISTS (SELECT 1 FROM notes n WHERE n.id = k.chunkable_id AND n.deleted_at IS NULL)))";
|
|
30213
|
+
var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
30214
|
+
const { database } = context;
|
|
30215
|
+
const stemmerFor = stemmerCache();
|
|
30216
|
+
const drain = /* @__PURE__ */ __name(() => drainNoteIndex(database, stemmerFor), "drain");
|
|
30217
|
+
const read2 = /* @__PURE__ */ __name((type, id2) => {
|
|
30218
|
+
const row2 = database.prepare(`SELECT * FROM ${type === "document" ? "documents" : "notes"} WHERE id = ?`).get(id2);
|
|
30219
|
+
return row2 ? type === "document" ? documentOf(row2) : noteOf(row2) : void 0;
|
|
30220
|
+
}, "read");
|
|
30221
|
+
const live2 = /* @__PURE__ */ __name((folderIds, source2, withInternal = false) => {
|
|
30222
|
+
const folders = folderIds?.length ? JSON.stringify(folderIds) : null;
|
|
30223
|
+
const types = source2 === void 0 ? ["document", "note"] : source2 === "file" ? ["document"] : ["note"];
|
|
30224
|
+
return {
|
|
30225
|
+
sql: ` AND k.chunkable_type IN (${types.map(() => "?").join(", ")}) AND ${LIVE2}`,
|
|
30226
|
+
params: [...types, folders, folders, withInternal ? null : folders]
|
|
30227
|
+
};
|
|
30228
|
+
}, "live");
|
|
30229
|
+
return {
|
|
30230
|
+
...documentPicturesOver(context),
|
|
30231
|
+
search: /* @__PURE__ */ __name(async (query) => {
|
|
30232
|
+
drain();
|
|
30233
|
+
return searchNotes(context, query);
|
|
30234
|
+
}, "search"),
|
|
30235
|
+
indexState: /* @__PURE__ */ __name(async () => noteIndexState(database), "indexState"),
|
|
30236
|
+
chunksToEmbed: /* @__PURE__ */ __name(async (model, { after: after2, limit }) => {
|
|
30237
|
+
drain();
|
|
30238
|
+
const scope3 = live2(void 0, void 0);
|
|
30239
|
+
const texts2 = /* @__PURE__ */ new Map();
|
|
30240
|
+
const textOf5 = /* @__PURE__ */ __name((owner) => {
|
|
30241
|
+
if (!texts2.has(owner)) {
|
|
30242
|
+
const [type, id2] = owner.split(":");
|
|
30243
|
+
const note2 = read2(String(type), Number(id2));
|
|
30244
|
+
texts2.set(owner, note2 ? noteIndexText(note2.title, note2.text) : void 0);
|
|
30245
|
+
}
|
|
30246
|
+
return texts2.get(owner);
|
|
30247
|
+
}, "textOf");
|
|
30248
|
+
return database.prepare(`SELECT k.content_hash AS hash, min(k.chunkable_type || ':' || k.chunkable_id) AS owner, k.start_offset AS start, k.end_offset AS end
|
|
30249
|
+
FROM chunks k
|
|
30250
|
+
WHERE k.content_hash > ?${scope3.sql}
|
|
30251
|
+
AND NOT EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ? AND v.content_hash = k.content_hash)
|
|
30252
|
+
GROUP BY k.content_hash ORDER BY k.content_hash LIMIT ?`).all(after2 ?? "", ...scope3.params, model, limit).flatMap((row2) => {
|
|
30253
|
+
const text5 = textOf5(String(row2.owner));
|
|
30254
|
+
return text5 === void 0 ? [] : [{ hash: String(row2.hash), text: text5.slice(Number(row2.start), Number(row2.end)) }];
|
|
30255
|
+
});
|
|
30256
|
+
}, "chunksToEmbed"),
|
|
30257
|
+
embedded: /* @__PURE__ */ __name(async (model, { folderIds, withInternal, source: source2 }) => {
|
|
30258
|
+
drain();
|
|
30259
|
+
const scope3 = live2(folderIds, source2, withInternal);
|
|
30260
|
+
return database.prepare(`SELECT 1 FROM chunks k JOIN embeddings v ON v.model = ? AND v.content_hash = k.content_hash
|
|
30261
|
+
WHERE 1 = 1${scope3.sql} LIMIT 1`).get(model, ...scope3.params) !== void 0;
|
|
30262
|
+
}, "embedded"),
|
|
30263
|
+
nearest: /* @__PURE__ */ __name(async (model, query, { limit, folderIds, withInternal, source: source2 }) => {
|
|
30264
|
+
drain();
|
|
30265
|
+
const scope3 = live2(folderIds, source2, withInternal);
|
|
30266
|
+
const columns = `k.id, k.chunkable_type AS type, k.chunkable_id AS owner, k.start_offset AS start,
|
|
30267
|
+
k.end_offset AS end, k.content_hash AS hash, v.vector
|
|
30268
|
+
FROM chunks k JOIN embeddings v ON v.model = ? AND v.content_hash = k.content_hash`;
|
|
30269
|
+
const keep = /* @__PURE__ */ __name((best, row2) => {
|
|
30270
|
+
const score = dot(query, row2.vector);
|
|
30271
|
+
const key2 = `${row2.type}:${row2.owner}`;
|
|
30272
|
+
const held = best.get(key2);
|
|
30273
|
+
if (!held || score > held.score)
|
|
30274
|
+
best.set(key2, {
|
|
30275
|
+
score,
|
|
30276
|
+
first: held?.first ?? Number(row2.id),
|
|
30277
|
+
chunk: Number(row2.id),
|
|
30278
|
+
start: Number(row2.start),
|
|
30279
|
+
end: Number(row2.end)
|
|
30280
|
+
});
|
|
30281
|
+
}, "keep");
|
|
30282
|
+
const ranked = /* @__PURE__ */ __name((best) => [...best.entries()].sort(([, a], [, b]) => b.score - a.score || a.first - b.first).slice(0, limit), "ranked");
|
|
30283
|
+
const indexed = /* @__PURE__ */ __name(() => {
|
|
30284
|
+
const types = source2 === void 0 ? ["document", "note"] : source2 === "file" ? ["document"] : ["note"];
|
|
30285
|
+
const accounts2 = database.prepare("SELECT DISTINCT coalesce(account_id, 0) AS account FROM chunks WHERE chunkable_type = ?");
|
|
30286
|
+
const wanted = folderIds?.length ? new Set(folderIds.map(Number)) : void 0;
|
|
30287
|
+
const candidates = database.prepare(`SELECT ${columns} WHERE k.id IN (SELECT value FROM json_each(?))${scope3.sql} ORDER BY k.id`);
|
|
30288
|
+
const first = database.prepare(`SELECT min(k.id) AS first FROM chunks k JOIN embeddings v ON v.model = ? AND v.content_hash = k.content_hash
|
|
30289
|
+
WHERE k.chunkable_type = ? AND k.chunkable_id = ?${scope3.sql}`);
|
|
30290
|
+
const merged = /* @__PURE__ */ new Map();
|
|
30291
|
+
for (const type of types)
|
|
30292
|
+
for (const { account } of accounts2.all(type)) {
|
|
30293
|
+
if (type === "document" && wanted && !wanted.has(Number(account)))
|
|
30294
|
+
continue;
|
|
30295
|
+
const found2 = searchIndex(database, model, { kind: type, account: Number(account) }, query, limit, (near2) => {
|
|
30296
|
+
const hashes = new Map(near2.map(({ id: id2, hash: hash2 }) => [id2, hash2]));
|
|
30297
|
+
const best = /* @__PURE__ */ new Map();
|
|
30298
|
+
for (const row2 of candidates.all(model, JSON.stringify([...hashes.keys()]), ...scope3.params))
|
|
30299
|
+
if (hashes.get(Number(row2.id)) === row2.hash)
|
|
30300
|
+
keep(best, row2);
|
|
30301
|
+
for (const [key2, held] of best) {
|
|
30302
|
+
const [kind3, owner] = key2.split(":");
|
|
30303
|
+
held.first = Number(first.get(model, String(kind3), Number(owner), ...scope3.params)?.first);
|
|
30304
|
+
}
|
|
30305
|
+
const results = ranked(best);
|
|
30306
|
+
return { results, best: results.map(([, { chunk }]) => chunk) };
|
|
30307
|
+
});
|
|
30308
|
+
if (!found2)
|
|
30309
|
+
return void 0;
|
|
30310
|
+
for (const [key2, held] of found2)
|
|
30311
|
+
merged.set(key2, held);
|
|
30312
|
+
}
|
|
30313
|
+
return ranked(merged);
|
|
30314
|
+
}, "indexed");
|
|
30315
|
+
const scanned = /* @__PURE__ */ __name(() => {
|
|
30316
|
+
const page3 = database.prepare(`SELECT ${columns} WHERE k.id > ?${scope3.sql} ORDER BY k.id LIMIT ?`);
|
|
30317
|
+
const best = /* @__PURE__ */ new Map();
|
|
30318
|
+
let after2 = 0;
|
|
30319
|
+
for (; ; ) {
|
|
30320
|
+
const rows = page3.all(model, after2, ...scope3.params, SCAN_PAGE3);
|
|
30321
|
+
for (const row2 of rows)
|
|
30322
|
+
keep(best, row2);
|
|
30323
|
+
const last = rows.at(-1);
|
|
30324
|
+
if (!last || rows.length < SCAN_PAGE3)
|
|
30325
|
+
break;
|
|
30326
|
+
after2 = Number(last.id);
|
|
30327
|
+
}
|
|
30328
|
+
return ranked(best);
|
|
30329
|
+
}, "scanned");
|
|
30330
|
+
return (indexed() ?? scanned()).flatMap(([key2, { score, start, end }]) => {
|
|
30331
|
+
const [type, id2] = key2.split(":");
|
|
30332
|
+
const note2 = read2(String(type), Number(id2));
|
|
30333
|
+
return note2 ? [{ ref: note2.ref, note: note2, score, range: { start, end } }] : [];
|
|
30334
|
+
});
|
|
30335
|
+
}, "nearest")
|
|
30336
|
+
};
|
|
30337
|
+
}, "noteSearchOver");
|
|
30338
|
+
|
|
30339
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
|
|
30340
|
+
var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
|
|
30341
|
+
var inEventAccounts = /* @__PURE__ */ __name((event) => searchableCopy(event, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
|
|
30342
|
+
var EVENT_CORPUS = {
|
|
30343
|
+
type: "event",
|
|
30344
|
+
noun: "event",
|
|
30345
|
+
fields: EVENT_FIELDS,
|
|
30346
|
+
view: `(SELECT e.id, NULL AS folder_id, NULL AS path, e.title, ${EVENT_TEXT} AS text, NULL AS metadata, e.starts_at AS at, e.deleted_at, ${EVENT_LIVE} AS live FROM events e)`,
|
|
30347
|
+
words: "event_words",
|
|
30348
|
+
stems: "event_stems",
|
|
30349
|
+
live: "n.live = 1",
|
|
30350
|
+
inAccounts: /* @__PURE__ */ __name((ids) => ({
|
|
30351
|
+
sql: inEventAccounts("n.id"),
|
|
30352
|
+
params: [ids],
|
|
30353
|
+
exact: true
|
|
30354
|
+
}), "inAccounts")
|
|
30355
|
+
};
|
|
30356
|
+
var SCAN_PAGE4 = 5e3;
|
|
30357
|
+
var eventSearchOver = /* @__PURE__ */ __name((context) => {
|
|
30358
|
+
const { database } = context;
|
|
30359
|
+
const stemmerFor = stemmerCache();
|
|
30360
|
+
const drain = /* @__PURE__ */ __name(() => drainCorpus(database, CORPORA.event, stemmerFor), "drain");
|
|
30361
|
+
const live2 = /* @__PURE__ */ __name((accountIds) => {
|
|
30362
|
+
const sql2 = ` AND k.chunkable_type = 'event' AND EXISTS (SELECT 1 FROM events e WHERE e.id = k.chunkable_id AND ${EVENT_LIVE})`;
|
|
30363
|
+
return accountIds?.length ? { sql: `${sql2} AND ${inEventAccounts("k.chunkable_id")}`, params: [JSON.stringify(accountIds)] } : { sql: sql2, params: [] };
|
|
30364
|
+
}, "live");
|
|
30365
|
+
const grouped = /* @__PURE__ */ __name((rows, accountIds) => {
|
|
30366
|
+
const facts2 = new Map(database.prepare("SELECT id, event_series_id AS series, starts_at, status FROM events WHERE id IN (SELECT value FROM json_each(?))").all(JSON.stringify(rows.map(({ id: id2 }) => id2))).map((row2) => [Number(row2.id), row2]));
|
|
30367
|
+
const groups = /* @__PURE__ */ new Map();
|
|
30368
|
+
for (const row2 of rows) {
|
|
30369
|
+
const fact = facts2.get(row2.id);
|
|
30370
|
+
if (!fact)
|
|
30371
|
+
continue;
|
|
30372
|
+
const key2 = fact.series == null ? `e${row2.id}` : `s${fact.series}`;
|
|
30373
|
+
const group = groups.get(key2) ?? { first: row2, members: [] };
|
|
30374
|
+
group.members.push(fact);
|
|
30375
|
+
groups.set(key2, group);
|
|
30376
|
+
}
|
|
30377
|
+
const now2 = context.now();
|
|
30378
|
+
const nearest = /* @__PURE__ */ __name((members2) => members2.toSorted((a, b) => Number(a.status === "cancelled") - Number(b.status === "cancelled") || Math.abs(Number(a.starts_at ?? 0) - now2) - Math.abs(Number(b.starts_at ?? 0) - now2) || Number(a.id) - Number(b.id))[0], "nearest");
|
|
30379
|
+
const event = database.prepare(`SELECT e.*, ${EVENT_TEXT} AS text FROM events e WHERE e.id = ?`);
|
|
30380
|
+
const place = database.prepare("SELECT a.provider, a.external_id AS account, ce.url FROM calendar_entries ce JOIN calendars c ON c.id = ce.calendar_id JOIN accounts a ON a.id = c.account_id WHERE ce.event_id = ? ORDER BY c.account_id NOT IN (SELECT CAST(value AS INTEGER) FROM json_each(?)), ce.deleted_at IS NOT NULL, ce.id LIMIT 1");
|
|
30381
|
+
const chosen = JSON.stringify(accountIds ?? []);
|
|
30382
|
+
return [...groups.values()].map(({ first, members: members2 }) => {
|
|
30383
|
+
const id2 = Number(nearest(members2).id);
|
|
30384
|
+
const row2 = event.get(id2);
|
|
30385
|
+
const at = place.get(id2, chosen);
|
|
30386
|
+
return {
|
|
30387
|
+
first,
|
|
30388
|
+
hit: {
|
|
30389
|
+
ref: `event:${id2}`,
|
|
30390
|
+
event: eventOf(row2),
|
|
30391
|
+
text: String(row2.text ?? ""),
|
|
30392
|
+
occurrences: members2.length,
|
|
30393
|
+
account: at ? { provider: String(at.provider), account: String(at.account) } : null,
|
|
30394
|
+
url: at?.url == null ? null : String(at.url)
|
|
30395
|
+
}
|
|
30396
|
+
};
|
|
30397
|
+
});
|
|
30398
|
+
}, "grouped");
|
|
30399
|
+
return {
|
|
30400
|
+
search: /* @__PURE__ */ __name(async (query) => {
|
|
30401
|
+
drain();
|
|
30402
|
+
const offset = query.offset ?? 0;
|
|
30403
|
+
const candidates = query.candidates ?? QUERY_LIMITS2.candidates;
|
|
30404
|
+
const matched = searchCorpus(context, { ...query, limit: candidates, offset: 0 }, EVENT_CORPUS);
|
|
30405
|
+
const truncated = matched.length > candidates;
|
|
30406
|
+
const rows = truncated ? matched.slice(0, candidates) : matched;
|
|
30407
|
+
return read(database, () => {
|
|
30408
|
+
const groups = grouped(rows, query.accountIds);
|
|
30409
|
+
return {
|
|
30410
|
+
items: groups.slice(offset, offset + query.limit).map(({ first, hit }) => ({
|
|
30411
|
+
...hit,
|
|
30412
|
+
relevance: first.relevance,
|
|
30413
|
+
...first.exact === void 0 ? {} : { exact: first.exact }
|
|
30414
|
+
})),
|
|
30415
|
+
hasMore: groups.length > offset + query.limit,
|
|
30416
|
+
truncated
|
|
30417
|
+
};
|
|
30418
|
+
});
|
|
30419
|
+
}, "search"),
|
|
30420
|
+
eventIndexState: /* @__PURE__ */ __name(async () => corpusIndexState(database, CORPORA.event), "eventIndexState"),
|
|
30421
|
+
chunksToEmbed: /* @__PURE__ */ __name(async (model, { after: after2, limit }) => {
|
|
30422
|
+
drain();
|
|
30423
|
+
const scope3 = live2(void 0);
|
|
30424
|
+
const text5 = database.prepare(`SELECT e.title, ${EVENT_TEXT} AS body FROM events e WHERE e.id = ?`);
|
|
30425
|
+
return database.prepare(`SELECT k.content_hash AS hash, min(k.chunkable_id) AS owner, k.start_offset AS start, k.end_offset AS end
|
|
30426
|
+
FROM chunks k
|
|
30427
|
+
WHERE k.content_hash > ?${scope3.sql}
|
|
30428
|
+
AND NOT EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ? AND v.content_hash = k.content_hash)
|
|
30429
|
+
GROUP BY k.content_hash ORDER BY k.content_hash LIMIT ?`).all(after2 ?? "", ...scope3.params, model, limit).flatMap((row2) => {
|
|
30430
|
+
const event = text5.get(Number(row2.owner));
|
|
30431
|
+
if (!event)
|
|
30432
|
+
return [];
|
|
30433
|
+
const whole = noteIndexText(event.title == null ? null : String(event.title), String(event.body));
|
|
30434
|
+
return [{ hash: String(row2.hash), text: whole.slice(Number(row2.start), Number(row2.end)) }];
|
|
30435
|
+
});
|
|
30436
|
+
}, "chunksToEmbed"),
|
|
30437
|
+
embedded: /* @__PURE__ */ __name(async (model, { accountIds } = {}) => {
|
|
30438
|
+
drain();
|
|
30439
|
+
const scope3 = live2(accountIds);
|
|
30440
|
+
return database.prepare(`SELECT 1 FROM chunks k JOIN embeddings v ON v.model = ? AND v.content_hash = k.content_hash
|
|
30441
|
+
WHERE 1 = 1${scope3.sql} LIMIT 1`).get(model, ...scope3.params) !== void 0;
|
|
30442
|
+
}, "embedded"),
|
|
30443
|
+
nearest: /* @__PURE__ */ __name(async (model, query, { limit, accountIds }) => {
|
|
30444
|
+
drain();
|
|
30445
|
+
const scope3 = live2(accountIds);
|
|
30446
|
+
const page3 = database.prepare(`SELECT k.id, k.chunkable_id AS owner, v.vector
|
|
30447
|
+
FROM chunks k JOIN embeddings v ON v.model = ? AND v.content_hash = k.content_hash
|
|
30448
|
+
WHERE k.id > ?${scope3.sql}
|
|
30449
|
+
ORDER BY k.id LIMIT ?`);
|
|
30450
|
+
const best = /* @__PURE__ */ new Map();
|
|
30451
|
+
let after2 = 0;
|
|
30452
|
+
for (; ; ) {
|
|
30453
|
+
const rows = page3.all(model, after2, ...scope3.params, SCAN_PAGE4);
|
|
30454
|
+
for (const row2 of rows) {
|
|
30455
|
+
const score = dot(query, row2.vector);
|
|
30456
|
+
const owner = Number(row2.owner);
|
|
30457
|
+
if (score > (best.get(owner) ?? Number.NEGATIVE_INFINITY))
|
|
30458
|
+
best.set(owner, score);
|
|
30459
|
+
}
|
|
30460
|
+
const last = rows.at(-1);
|
|
30461
|
+
if (!last || rows.length < SCAN_PAGE4)
|
|
30462
|
+
break;
|
|
30463
|
+
after2 = Number(last.id);
|
|
30464
|
+
}
|
|
30465
|
+
const ranked = [...best.entries()].map(([id2, score]) => ({ id: id2, score })).sort((a, b) => b.score - a.score);
|
|
30466
|
+
return read(database, () => grouped(ranked, accountIds).slice(0, limit).map(({ first, hit }) => ({ ...hit, score: first.score })));
|
|
30467
|
+
}, "nearest")
|
|
30468
|
+
};
|
|
30469
|
+
}, "eventSearchOver");
|
|
30470
|
+
|
|
30471
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
|
|
29832
30472
|
var EVIDENCE_FINDINGS_KIND = "evidence_findings";
|
|
29833
30473
|
var reference = /* @__PURE__ */ __name((raw) => {
|
|
29834
30474
|
if (/^document:[1-9]\d*$/.test(raw))
|
|
@@ -29841,7 +30481,7 @@ var reference = /* @__PURE__ */ __name((raw) => {
|
|
|
29841
30481
|
}, "reference");
|
|
29842
30482
|
var validateEvidenceFindings = /* @__PURE__ */ __name((input) => validateFindings(input, { plural: "evidence findings", singular: "evidence finding", cited: "reference", reference }), "validateEvidenceFindings");
|
|
29843
30483
|
|
|
29844
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30484
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/domain/moment.js
|
|
29845
30485
|
var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
|
|
29846
30486
|
try {
|
|
29847
30487
|
return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
|
|
@@ -29853,7 +30493,7 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
|
|
|
29853
30493
|
}
|
|
29854
30494
|
}, "calendarMoment");
|
|
29855
30495
|
|
|
29856
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30496
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
|
|
29857
30497
|
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";
|
|
29858
30498
|
var iso7 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
29859
30499
|
var oneOf4 = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
@@ -29966,7 +30606,7 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
29966
30606
|
};
|
|
29967
30607
|
}, "factsStoreOver");
|
|
29968
30608
|
|
|
29969
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30609
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
|
|
29970
30610
|
var invalid4 = /* @__PURE__ */ __name((message2) => {
|
|
29971
30611
|
throw new CliError("validation_error", message2);
|
|
29972
30612
|
}, "invalid");
|
|
@@ -30056,7 +30696,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
|
|
|
30056
30696
|
return { snapshot: snapshot2, snapshotParts, previous, outcomes };
|
|
30057
30697
|
}, "findingsCoreOver");
|
|
30058
30698
|
|
|
30059
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30699
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
|
|
30060
30700
|
var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
|
|
30061
30701
|
var PROPOSAL_VERDICTS = ["useful", "not_useful"];
|
|
30062
30702
|
var iso8 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
@@ -30202,7 +30842,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
30202
30842
|
};
|
|
30203
30843
|
}, "proposedActionsStoreOver");
|
|
30204
30844
|
|
|
30205
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30845
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
|
|
30206
30846
|
var stale = /* @__PURE__ */ __name(() => {
|
|
30207
30847
|
throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
|
|
30208
30848
|
reason: "evidence-findings.stale"
|
|
@@ -30368,7 +31008,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
30368
31008
|
};
|
|
30369
31009
|
}, "evidenceFindingsStoreOver");
|
|
30370
31010
|
|
|
30371
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31011
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
|
|
30372
31012
|
var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
|
|
30373
31013
|
var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
|
|
30374
31014
|
rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
|
|
@@ -30421,7 +31061,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
30421
31061
|
}, "forPerson")
|
|
30422
31062
|
}), "involvementStoreOver");
|
|
30423
31063
|
|
|
30424
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31064
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
|
|
30425
31065
|
import { createHash as createHash12 } from "node:crypto";
|
|
30426
31066
|
var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
|
|
30427
31067
|
var id = /* @__PURE__ */ __name((value) => {
|
|
@@ -30507,16 +31147,16 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
|
|
|
30507
31147
|
};
|
|
30508
31148
|
}, "meetingProjectsStoreOver");
|
|
30509
31149
|
|
|
30510
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31150
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
|
|
30511
31151
|
import { createHash as createHash15 } from "node:crypto";
|
|
30512
31152
|
|
|
30513
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31153
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
|
|
30514
31154
|
import { createHash as createHash14 } from "node:crypto";
|
|
30515
31155
|
|
|
30516
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31156
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
|
|
30517
31157
|
import { createHash as createHash13 } from "node:crypto";
|
|
30518
31158
|
|
|
30519
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31159
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
|
|
30520
31160
|
var consolidationId = /* @__PURE__ */ __name((value, field3) => {
|
|
30521
31161
|
if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
30522
31162
|
throw new CliError("validation_error", `${field3} must be a positive canonical tag id`);
|
|
@@ -30567,7 +31207,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
|
|
|
30567
31207
|
return input;
|
|
30568
31208
|
}, "consolidationApplyInput");
|
|
30569
31209
|
|
|
30570
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31210
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
|
|
30571
31211
|
var receiptOf = /* @__PURE__ */ __name((row2) => ({
|
|
30572
31212
|
id: String(row2.id),
|
|
30573
31213
|
sourceId: String(row2.source_id),
|
|
@@ -30642,7 +31282,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
|
|
|
30642
31282
|
}, { beforeCommit: check3 });
|
|
30643
31283
|
}, "applyTagConsolidation");
|
|
30644
31284
|
|
|
30645
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31285
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
|
|
30646
31286
|
var selections = [
|
|
30647
31287
|
["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
|
|
30648
31288
|
["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
|
|
@@ -30786,7 +31426,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
|
|
|
30786
31426
|
};
|
|
30787
31427
|
}, "previewRows");
|
|
30788
31428
|
|
|
30789
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31429
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
|
|
30790
31430
|
var kinds = ["project", "tag", "topic"];
|
|
30791
31431
|
var cancelled2 = /* @__PURE__ */ __name((signal) => {
|
|
30792
31432
|
if (signal?.aborted)
|
|
@@ -31050,7 +31690,7 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
31050
31690
|
};
|
|
31051
31691
|
}, "vocabularyStoreOver");
|
|
31052
31692
|
|
|
31053
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31693
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
|
|
31054
31694
|
var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
|
|
31055
31695
|
var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
|
|
31056
31696
|
var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
|
|
@@ -31567,7 +32207,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
|
|
|
31567
32207
|
return key2.padEnd(3, "X");
|
|
31568
32208
|
}, "projectKey");
|
|
31569
32209
|
|
|
31570
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32210
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
|
|
31571
32211
|
var DAY4 = 864e5;
|
|
31572
32212
|
var SETTING4 = "logs_pruned_at";
|
|
31573
32213
|
var LOG_RETENTION = { agentActionsMs: 90 * DAY4, botUpdatePayloadsMs: 30 * DAY4 };
|
|
@@ -31594,7 +32234,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
|
|
|
31594
32234
|
};
|
|
31595
32235
|
}, "logPruner");
|
|
31596
32236
|
|
|
31597
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32237
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
|
|
31598
32238
|
var stale2 = /* @__PURE__ */ __name(() => {
|
|
31599
32239
|
throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
|
|
31600
32240
|
reason: "meeting-findings.stale"
|
|
@@ -31763,9 +32403,9 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
31763
32403
|
};
|
|
31764
32404
|
}, "meetingFindingsStoreOver");
|
|
31765
32405
|
|
|
31766
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32406
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
|
|
31767
32407
|
var RANK_BATCH = 512;
|
|
31768
|
-
var
|
|
32408
|
+
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";
|
|
31769
32409
|
var limitOf = /* @__PURE__ */ __name((value, name, max = 1e3) => {
|
|
31770
32410
|
positiveReadInteger(value, name);
|
|
31771
32411
|
if (value > max)
|
|
@@ -31851,7 +32491,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
|
|
|
31851
32491
|
throw new CliError("validation_error", "Vector save exceeds its batch or 16 MiB payload budget");
|
|
31852
32492
|
return write(context.database, () => {
|
|
31853
32493
|
const unique2 = new Map(rows.map((row2) => [row2.hash, row2]));
|
|
31854
|
-
const current = context.database.prepare(`SELECT DISTINCT k.content_hash ${
|
|
32494
|
+
const current = context.database.prepare(`SELECT DISTINCT k.content_hash ${LIVE3} AND k.content_hash IN (SELECT value FROM json_each(?))`).all(input.accountId, JSON.stringify([...unique2.keys()]));
|
|
31855
32495
|
const available = new Set(current.map((row2) => String(row2.content_hash)));
|
|
31856
32496
|
const selected = [...unique2.values()].filter((row2) => available.has(row2.hash) && !context.database.prepare("SELECT 1 FROM embeddings WHERE model=? AND content_hash=?").get(model, row2.hash));
|
|
31857
32497
|
input.signal?.throwIfAborted();
|
|
@@ -31908,7 +32548,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
|
|
|
31908
32548
|
if (input.afterHash !== void 0 && !/^[a-f0-9]{64}$/.test(input.afterHash))
|
|
31909
32549
|
throw new CliError("validation_error", "afterHash must be a content hash");
|
|
31910
32550
|
return read(context.database, () => {
|
|
31911
|
-
const rows = context.database.prepare(`SELECT k.* ${
|
|
32551
|
+
const rows = context.database.prepare(`SELECT k.* ${LIVE3} AND k.content_hash > ? AND NOT EXISTS (SELECT 1 FROM embeddings e WHERE e.model=? AND e.content_hash=k.content_hash) GROUP BY k.content_hash ORDER BY k.content_hash LIMIT ?`).all(input.accountId, input.afterHash ?? "", model, limit + 1);
|
|
31912
32552
|
const load = textLoader(context, input);
|
|
31913
32553
|
const items = rows.slice(0, limit).map((row2) => ({
|
|
31914
32554
|
hash: String(row2.content_hash),
|
|
@@ -31928,13 +32568,13 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
|
|
|
31928
32568
|
if (input.afterChunkId !== void 0)
|
|
31929
32569
|
positiveReadInteger(input.afterChunkId, "afterChunkId");
|
|
31930
32570
|
return read(context.database, () => {
|
|
31931
|
-
const selectedSql = `${
|
|
32571
|
+
const selectedSql = `${LIVE3.replace(" WHERE", " JOIN embeddings e ON e.content_hash=k.content_hash AND e.model=? WHERE")} AND k.id>? ORDER BY k.id LIMIT ?`;
|
|
31932
32572
|
const params = [model, input.accountId, input.afterChunkId ?? 0, maxChunks + 1];
|
|
31933
32573
|
const preflight = context.database.prepare(`SELECT coalesce(sum(n),0) AS bytes, coalesce(sum(bad),0) AS bad FROM (SELECT length(e.vector) AS n, (e.dims != ? OR length(e.vector) != ?) AS bad ${selectedSql})`).get(query.length, query.length * 4, ...params);
|
|
31934
32574
|
if (Number(preflight?.bad ?? 0) || Number(preflight?.bytes ?? 0) > 16 * 1024 * 1024)
|
|
31935
32575
|
throw new CliError("validation_error", "Stored vectors exceed the dimension or 16 MiB scan budget");
|
|
31936
32576
|
input.signal?.throwIfAborted();
|
|
31937
|
-
const rows = context.database.prepare(`SELECT k.*,e.dims,e.vector ${
|
|
32577
|
+
const rows = context.database.prepare(`SELECT k.*,e.dims,e.vector ${LIVE3.replace(" WHERE", " JOIN embeddings e ON e.content_hash=k.content_hash AND e.model=? WHERE")} AND k.id>? ORDER BY k.id LIMIT ?`).all(model, input.accountId, input.afterChunkId ?? 0, maxChunks + 1);
|
|
31938
32578
|
const selected = rows.slice(0, maxChunks);
|
|
31939
32579
|
const load = textLoader(context, input);
|
|
31940
32580
|
const items = selected.map((row2) => {
|
|
@@ -32029,12 +32669,12 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
|
|
|
32029
32669
|
async status(input) {
|
|
32030
32670
|
scope2(input);
|
|
32031
32671
|
modelOf(input.model);
|
|
32032
|
-
const row2 = context.database.prepare(`SELECT count(DISTINCT k.content_hash) AS chunks,count(DISTINCT CASE WHEN EXISTS (SELECT 1 FROM embeddings e WHERE e.model=? AND e.content_hash=k.content_hash) THEN k.content_hash END) AS embedded ${
|
|
32672
|
+
const row2 = context.database.prepare(`SELECT count(DISTINCT k.content_hash) AS chunks,count(DISTINCT CASE WHEN EXISTS (SELECT 1 FROM embeddings e WHERE e.model=? AND e.content_hash=k.content_hash) THEN k.content_hash END) AS embedded ${LIVE3}`).get(input.model, input.accountId);
|
|
32033
32673
|
return { chunks: Number(row2?.chunks ?? 0), embedded: Number(row2?.embedded ?? 0) };
|
|
32034
32674
|
}
|
|
32035
32675
|
}), "meetingVectorsOver");
|
|
32036
32676
|
|
|
32037
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32677
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
|
|
32038
32678
|
var OTHER_SOURCES = ["document", "note", "email"];
|
|
32039
32679
|
var TEXTS = {
|
|
32040
32680
|
document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
|
|
@@ -32135,394 +32775,11 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32135
32775
|
};
|
|
32136
32776
|
}, "sourceMentionStoreOver");
|
|
32137
32777
|
|
|
32138
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32139
|
-
var NOTE_FIELDS = [
|
|
32140
|
-
"text",
|
|
32141
|
-
"exact",
|
|
32142
|
-
"body",
|
|
32143
|
-
"tag",
|
|
32144
|
-
"date",
|
|
32145
|
-
"in",
|
|
32146
|
-
"has",
|
|
32147
|
-
"title",
|
|
32148
|
-
"site",
|
|
32149
|
-
"lang",
|
|
32150
|
-
"author",
|
|
32151
|
-
"keyword",
|
|
32152
|
-
"source"
|
|
32153
|
-
];
|
|
32154
|
-
var quoted2 = /* @__PURE__ */ __name((value) => `"${value.replaceAll('"', '""')}"`, "quoted");
|
|
32155
|
-
var bound3 = /* @__PURE__ */ __name((sql2, ...params) => ({ sql: sql2, params, exact: true }), "bound");
|
|
32156
|
-
var combine2 = /* @__PURE__ */ __name((parts2, operator) => ({
|
|
32157
|
-
sql: parts2.length ? `(${parts2.map(({ sql: sql2 }) => sql2).join(` ${operator} `)})` : operator === "AND" ? "1" : "0",
|
|
32158
|
-
params: parts2.flatMap(({ params }) => params),
|
|
32159
|
-
exact: parts2.every(({ exact }) => exact)
|
|
32160
|
-
}), "combine");
|
|
32161
|
-
var CORPORA2 = [
|
|
32162
|
-
{
|
|
32163
|
-
type: "document",
|
|
32164
|
-
view: "(SELECT id, account_id AS folder_id, external_id AS path, title, coalesce(body, '') AS text, metadata, updated_at, deleted_at FROM documents)",
|
|
32165
|
-
words: "document_words",
|
|
32166
|
-
stems: "document_stems",
|
|
32167
|
-
tagged: /* @__PURE__ */ __name((tag2) => bound3(`(n.id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'document') OR n.folder_id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'account') OR EXISTS (SELECT 1 FROM links l JOIN resolved_tags t ON t.id=l.to_id WHERE l.from_type = 'account' AND l.from_id = n.folder_id AND l.kind = ${linkKind("labelled")} AND l.to_type = 'tag' AND t.name = ? AND substr(n.path, 1, length(l.anchor) + 1) = l.anchor || '/'))`, tag2, tag2, tag2), "tagged")
|
|
32168
|
-
},
|
|
32169
|
-
{
|
|
32170
|
-
type: "note",
|
|
32171
|
-
view: "(SELECT id, NULL AS folder_id, NULL AS path, title, body AS text, NULL AS metadata, updated_at, deleted_at FROM notes)",
|
|
32172
|
-
words: "note_words",
|
|
32173
|
-
stems: "note_stems",
|
|
32174
|
-
tagged: /* @__PURE__ */ __name((tag2) => bound3("n.id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'note')", tag2), "tagged")
|
|
32175
|
-
}
|
|
32176
|
-
];
|
|
32177
|
-
var searchNotes = /* @__PURE__ */ __name((context, query) => {
|
|
32178
|
-
const offset = query.offset ?? 0;
|
|
32179
|
-
const chosen = CORPORA2.filter(({ type }) => (query.source === void 0 || query.source === "file" === (type === "document")) && (!query.folderIds?.length || query.withInternal === true || type === "document"));
|
|
32180
|
-
const rows = chosen.flatMap((corpus) => searchCorpus(context, query, corpus));
|
|
32181
|
-
const exactFirst = rows.some((row2) => row2.exact !== void 0);
|
|
32182
|
-
rows.sort((a, b) => query.newest ? b.updatedAt - a.updatedAt || a.id - b.id : (exactFirst ? Number(b.exact === true) - Number(a.exact === true) : 0) || Number(a.relevance === null) - Number(b.relevance === null) || (a.relevance ?? 0) - (b.relevance ?? 0) || b.updatedAt - a.updatedAt || a.id - b.id);
|
|
32183
|
-
const read2 = {
|
|
32184
|
-
document: context.database.prepare("SELECT * FROM documents WHERE id = ?"),
|
|
32185
|
-
note: context.database.prepare("SELECT * FROM notes WHERE id = ?")
|
|
32186
|
-
};
|
|
32187
|
-
return {
|
|
32188
|
-
items: rows.slice(offset, offset + query.limit).map((row2) => {
|
|
32189
|
-
const found2 = read2[row2.type].get(row2.id);
|
|
32190
|
-
const note2 = row2.type === "document" ? documentOf(found2) : noteOf(found2);
|
|
32191
|
-
return {
|
|
32192
|
-
ref: note2.ref,
|
|
32193
|
-
note: note2,
|
|
32194
|
-
relevance: row2.relevance,
|
|
32195
|
-
...row2.exact === void 0 ? {} : { exact: row2.exact }
|
|
32196
|
-
};
|
|
32197
|
-
}),
|
|
32198
|
-
hasMore: rows.length > offset + query.limit
|
|
32199
|
-
};
|
|
32200
|
-
}, "searchNotes");
|
|
32201
|
-
var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
|
|
32202
|
-
const { database } = context;
|
|
32203
|
-
const wordMatch2 = /* @__PURE__ */ __name((match) => ({
|
|
32204
|
-
sql: `n.id IN (SELECT rowid FROM ${corpus.words} WHERE ${corpus.words} MATCH ?)`,
|
|
32205
|
-
params: [`normalized_text : (${match})`],
|
|
32206
|
-
exact: true,
|
|
32207
|
-
fts: match
|
|
32208
|
-
}), "wordMatch");
|
|
32209
|
-
const started = context.now();
|
|
32210
|
-
const budget = { work: 0 };
|
|
32211
|
-
let expansions = 0;
|
|
32212
|
-
const check3 = /* @__PURE__ */ __name(() => {
|
|
32213
|
-
if (query.signal?.aborted)
|
|
32214
|
-
throw new CliError("validation_error", "search was aborted", { reason: "query.aborted", complete: false });
|
|
32215
|
-
if (context.now() - started > QUERY_LIMITS2.milliseconds)
|
|
32216
|
-
exhausted("time");
|
|
32217
|
-
}, "check");
|
|
32218
|
-
const tests = /* @__PURE__ */ new Map();
|
|
32219
|
-
const fragments = /* @__PURE__ */ new Map();
|
|
32220
|
-
const automaton = /* @__PURE__ */ __name((pattern, node) => compileAutomaton(pattern, node.span), "automaton");
|
|
32221
|
-
let titles;
|
|
32222
|
-
const foldedTitles = /* @__PURE__ */ __name(() => titles ??= database.prepare(`SELECT id, title FROM ${corpus.view} n WHERE n.title IS NOT NULL AND n.deleted_at IS NULL`).all().map((row2) => ({ id: Number(row2.id), title: normalize(String(row2.title)) })), "foldedTitles");
|
|
32223
|
-
const leaf2 = /* @__PURE__ */ __name((node) => {
|
|
32224
|
-
const { field: field3, operator, value } = node;
|
|
32225
|
-
if (!NOTE_FIELDS.includes(field3))
|
|
32226
|
-
searchError("query.unsupported-field", node.span, `${field3}: is not a note field \u2014 notes take ${NOTE_FIELDS.join(", ")}`);
|
|
32227
|
-
if ((field3 === "text" || field3 === "exact") && value === "")
|
|
32228
|
-
return bound3("0");
|
|
32229
|
-
if (isStemmed(node)) {
|
|
32230
|
-
if (!query.stemmer)
|
|
32231
|
-
throw new Error("a stemmed leaf reached the notes search without the store's stemmer");
|
|
32232
|
-
const text5 = normalize(value);
|
|
32233
|
-
if (!/[\p{L}\p{N}]/u.test(text5))
|
|
32234
|
-
return bound3("0");
|
|
32235
|
-
const stems = query.stemmer.phrases(value);
|
|
32236
|
-
return {
|
|
32237
|
-
sql: `n.id IN (SELECT rowid FROM ${corpus.words} WHERE ${corpus.words} MATCH ?)${stems ? ` OR n.id IN (SELECT rowid FROM ${corpus.stems} WHERE ${corpus.stems} MATCH ?)` : ""}`,
|
|
32238
|
-
params: [`normalized_text : (${quoted2(text5)})`, ...stems ? [`stems : (${stems})`] : []],
|
|
32239
|
-
exact: true,
|
|
32240
|
-
fts: quoted2(text5),
|
|
32241
|
-
...stems ? { stems } : {}
|
|
32242
|
-
};
|
|
32243
|
-
}
|
|
32244
|
-
if (field3 === "text" || field3 === "exact") {
|
|
32245
|
-
if (operator === "term" || operator === "phrase") {
|
|
32246
|
-
const text5 = normalize(value);
|
|
32247
|
-
const stems = query.stemmer?.phrases(value);
|
|
32248
|
-
return /[\p{L}\p{N}]/u.test(text5) ? { ...wordMatch2(quoted2(text5)), ...stems ? { stems } : {} } : bound3("0");
|
|
32249
|
-
}
|
|
32250
|
-
const pattern = operator === "wildcard" ? wildcardPattern(normalize(value)) : foldRegex(value, node.span);
|
|
32251
|
-
const matcher = automaton(pattern, node);
|
|
32252
|
-
const prefix = prefixOf(pattern);
|
|
32253
|
-
const terms2 = database.prepare(`SELECT term FROM ${corpus.words}_vocab WHERE col='normalized_text'${prefix ? " AND term>=? AND term<=?" : ""} ORDER BY term LIMIT ?`).all(...prefix ? [prefix, `${prefix}\u{10FFFF}`] : [], QUERY_LIMITS2.expansions + 1);
|
|
32254
|
-
expansions += terms2.length;
|
|
32255
|
-
if (expansions > QUERY_LIMITS2.expansions)
|
|
32256
|
-
exhausted("term expansions");
|
|
32257
|
-
const matches2 = terms2.flatMap(({ term }) => {
|
|
32258
|
-
check3();
|
|
32259
|
-
return matcher.test(String(term), budget) ? [quoted2(String(term))] : [];
|
|
32260
|
-
});
|
|
32261
|
-
return matches2.length ? wordMatch2(matches2.join(" OR ")) : bound3("0");
|
|
32262
|
-
}
|
|
32263
|
-
if (field3 === "body") {
|
|
32264
|
-
if (operator === "term" || operator === "phrase")
|
|
32265
|
-
return bound3("n.text = ?", value);
|
|
32266
|
-
const matcher = automaton(operator === "wildcard" ? wildcardPattern(value) : value, node);
|
|
32267
|
-
tests.set(node, (text5) => matcher.test(text5, budget));
|
|
32268
|
-
return { sql: "1", params: [], exact: false };
|
|
32269
|
-
}
|
|
32270
|
-
if (field3 === "tag") {
|
|
32271
|
-
const tag2 = tagOf(value);
|
|
32272
|
-
if (tag2 === void 0)
|
|
32273
|
-
searchError("query.invalid-tag", node.span);
|
|
32274
|
-
return corpus.tagged(canonicalTagNamed(database, tag2)?.name ?? tag2);
|
|
32275
|
-
}
|
|
32276
|
-
if (field3 === "source")
|
|
32277
|
-
return bound3(value.toLowerCase() === (corpus.type === "note" ? "internal" : "file") ? "1" : "0");
|
|
32278
|
-
if (field3 === "has") {
|
|
32279
|
-
if (value.toLowerCase() !== "text")
|
|
32280
|
-
searchError("query.unknown-value", node.span, `has:${value} is a message field \u2014 notes take has:text`);
|
|
32281
|
-
return bound3("length(trim(coalesce(n.text,''))) > 0");
|
|
32282
|
-
}
|
|
32283
|
-
if (field3 === "title" || field3 === "site" || field3 === "lang" || field3 === "author" || field3 === "keyword") {
|
|
32284
|
-
const wanted = normalize(value);
|
|
32285
|
-
if (wanted === "")
|
|
32286
|
-
return bound3("0");
|
|
32287
|
-
const folded5 = /* @__PURE__ */ __name((key2) => `coalesce(json_extract(n.metadata, '$.folded.${key2}'), '')`, "folded");
|
|
32288
|
-
if (field3 === "keyword")
|
|
32289
|
-
return bound3("EXISTS (SELECT 1 FROM json_each(n.metadata, '$.folded.keywords') WHERE value = ?)", wanted);
|
|
32290
|
-
if (field3 === "lang")
|
|
32291
|
-
return bound3(`(${folded5("language")} = ? OR ${folded5("language")} LIKE ? || '-%')`, wanted, wanted);
|
|
32292
|
-
if (field3 === "title") {
|
|
32293
|
-
check3();
|
|
32294
|
-
const ids = foldedTitles().flatMap(({ id: id2, title }) => title.includes(wanted) ? [id2] : []);
|
|
32295
|
-
return bound3(`(instr(${folded5("title")}, ?) > 0 OR n.id IN (SELECT value FROM json_each(?)))`, wanted, JSON.stringify(ids));
|
|
32296
|
-
}
|
|
32297
|
-
return bound3(`instr(${folded5(field3)}, ?) > 0`, wanted);
|
|
32298
|
-
}
|
|
32299
|
-
if (field3 === "date") {
|
|
32300
|
-
const range = node.resolution?.date;
|
|
32301
|
-
if (!range)
|
|
32302
|
-
searchError("query.invalid-ast", node.span);
|
|
32303
|
-
return combine2([
|
|
32304
|
-
...range.lower === void 0 ? [] : [bound3(`n.updated_at ${range.lower_inclusive ? ">=" : ">"} ?`, range.lower)],
|
|
32305
|
-
...range.upper === void 0 ? [] : [bound3(`n.updated_at ${range.upper_inclusive ? "<=" : "<"} ?`, range.upper)]
|
|
32306
|
-
], "AND");
|
|
32307
|
-
}
|
|
32308
|
-
return bound3(["notes", "note"].includes(value.toLowerCase()) ? "1" : "0");
|
|
32309
|
-
}, "leaf");
|
|
32310
|
-
const compile2 = /* @__PURE__ */ __name((node) => {
|
|
32311
|
-
if (node.kind === "predicate") {
|
|
32312
|
-
const fragment = leaf2(node);
|
|
32313
|
-
const wrapped = { ...fragment, sql: `(${fragment.sql})` };
|
|
32314
|
-
fragments.set(node, wrapped);
|
|
32315
|
-
return wrapped;
|
|
32316
|
-
}
|
|
32317
|
-
const parts2 = node.clauses.map(({ occur, node: node2 }) => ({ occur, part: compile2(node2) }));
|
|
32318
|
-
const must = parts2.filter(({ occur }) => occur === "must").map(({ part }) => part);
|
|
32319
|
-
const should = parts2.filter(({ occur }) => occur === "should").map(({ part }) => part);
|
|
32320
|
-
const not = parts2.filter(({ occur }) => occur === "must_not").map(({ part }) => part.exact ? { ...part, sql: `NOT coalesce(${part.sql},0)` } : { sql: "1", params: [], exact: false });
|
|
32321
|
-
return combine2([must.length ? combine2(must, "AND") : combine2(should, "OR"), ...not], "AND");
|
|
32322
|
-
}, "compile");
|
|
32323
|
-
const required3 = /* @__PURE__ */ __name((node, index2) => {
|
|
32324
|
-
if (node.kind === "predicate")
|
|
32325
|
-
return fragments.get(node)?.[index2];
|
|
32326
|
-
const must = node.clauses.filter(({ occur }) => occur === "must");
|
|
32327
|
-
const parts2 = (must.length ? must : node.clauses.filter(({ occur }) => occur === "should")).map(({ node: node2 }) => required3(node2, index2));
|
|
32328
|
-
if (must.length) {
|
|
32329
|
-
const known2 = parts2.filter((part) => part !== void 0);
|
|
32330
|
-
return known2.length ? known2.map((part) => `(${part})`).join(" AND ") : void 0;
|
|
32331
|
-
}
|
|
32332
|
-
return parts2.length && parts2.every((part) => part !== void 0) ? parts2.map((part) => `(${part})`).join(" OR ") : void 0;
|
|
32333
|
-
}, "required");
|
|
32334
|
-
return read(database, () => {
|
|
32335
|
-
check3();
|
|
32336
|
-
const expression = compile2(query.root);
|
|
32337
|
-
const stemmed = [...fragments.keys()].some(isStemmed);
|
|
32338
|
-
const scope3 = combine2([
|
|
32339
|
-
bound3("n.deleted_at IS NULL"),
|
|
32340
|
-
...corpus.type === "document" ? [bound3("coalesce(json_extract(n.metadata, '$.catalog.active'), 1)=1")] : [],
|
|
32341
|
-
...query.folderIds?.length && corpus.type === "document" ? [bound3("n.folder_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))", JSON.stringify(query.folderIds))] : []
|
|
32342
|
-
], "AND");
|
|
32343
|
-
const where = combine2([scope3, expression], "AND");
|
|
32344
|
-
const ranking = query.newest ? void 0 : required3(query.root, stemmed ? "stems" : "fts");
|
|
32345
|
-
const exactTier = stemmed ? required3(query.root, "fts") : void 0;
|
|
32346
|
-
const ctes = [];
|
|
32347
|
-
const cteParams = [];
|
|
32348
|
-
if (ranking) {
|
|
32349
|
-
const table = stemmed ? corpus.stems : corpus.words;
|
|
32350
|
-
ctes.push(`f(id, rank) AS MATERIALIZED (SELECT rowid, bm25(${table}, 1.0, 0.0) FROM ${table} WHERE ${table} MATCH ?)`);
|
|
32351
|
-
cteParams.push(`${stemmed ? "stems" : "normalized_text"} : (${ranking})`);
|
|
32352
|
-
}
|
|
32353
|
-
if (exactTier) {
|
|
32354
|
-
ctes.push(`x(id) AS MATERIALIZED (SELECT rowid FROM ${corpus.words} WHERE ${corpus.words} MATCH ?)`);
|
|
32355
|
-
cteParams.push(`normalized_text : (${exactTier})`);
|
|
32356
|
-
}
|
|
32357
|
-
const order = query.newest ? "n.updated_at DESC, n.id" : `${exactTier ? "exact DESC, " : ""}${ranking ? "f.rank IS NULL, f.rank, " : ""}n.updated_at DESC, n.id`;
|
|
32358
|
-
const offset = query.offset ?? 0;
|
|
32359
|
-
const leaves = [...fragments.entries()].filter(([node]) => !tests.has(node));
|
|
32360
|
-
const projection = tests.size ? leaves.map(([, fragment], index2) => `, coalesce(${fragment.sql}, 0) AS q${index2}`).join("") : "";
|
|
32361
|
-
const window = tests.size ? QUERY_LIMITS2.candidates + 1 : query.limit + offset + 1;
|
|
32362
|
-
const rows = database.prepare(`${ctes.length ? `WITH ${ctes.join(", ")} ` : ""}SELECT n.*, ${ranking ? "f.rank" : "NULL"} AS relevance${exactTier ? ", n.id IN (SELECT id FROM x) AS exact" : ""}${projection}
|
|
32363
|
-
FROM ${corpus.view} n${ranking ? " LEFT JOIN f ON f.id = n.id" : ""} WHERE ${where.sql} ORDER BY ${order} LIMIT ?`).all(...cteParams, ...leaves.flatMap(([, fragment]) => tests.size ? fragment.params : []), ...where.params, window);
|
|
32364
|
-
if (tests.size && rows.length > QUERY_LIMITS2.candidates)
|
|
32365
|
-
exhausted("candidates");
|
|
32366
|
-
const evaluate = /* @__PURE__ */ __name((node, row2, text5) => {
|
|
32367
|
-
if (node.kind === "predicate") {
|
|
32368
|
-
const test = tests.get(node);
|
|
32369
|
-
return test ? test(text5) : Number(row2[`q${leaves.findIndex(([leaf3]) => leaf3 === node)}`]) === 1;
|
|
32370
|
-
}
|
|
32371
|
-
const must = node.clauses.filter(({ occur }) => occur === "must");
|
|
32372
|
-
const should = node.clauses.filter(({ occur }) => occur === "should");
|
|
32373
|
-
const not = node.clauses.filter(({ occur }) => occur === "must_not");
|
|
32374
|
-
return (must.length ? must.every(({ node: node2 }) => evaluate(node2, row2, text5)) : should.length > 0 && should.some(({ node: node2 }) => evaluate(node2, row2, text5))) && not.every(({ node: node2 }) => !evaluate(node2, row2, text5));
|
|
32375
|
-
}, "evaluate");
|
|
32376
|
-
const matched = tests.size ? rows.filter((row2) => {
|
|
32377
|
-
check3();
|
|
32378
|
-
const text5 = noteIndexText(row2.title === null ? null : String(row2.title), String(row2.text));
|
|
32379
|
-
budget.work += text5.length;
|
|
32380
|
-
if (budget.work > QUERY_LIMITS2.work)
|
|
32381
|
-
exhausted("detector work");
|
|
32382
|
-
return evaluate(query.root, row2, text5);
|
|
32383
|
-
}) : rows;
|
|
32384
|
-
return matched.map((row2) => ({
|
|
32385
|
-
type: corpus.type,
|
|
32386
|
-
id: Number(row2.id),
|
|
32387
|
-
updatedAt: Number(row2.updated_at),
|
|
32388
|
-
relevance: row2.relevance === null || row2.relevance === void 0 ? null : Number(row2.relevance),
|
|
32389
|
-
...exactTier ? { exact: Number(row2.exact) === 1 } : {}
|
|
32390
|
-
}));
|
|
32391
|
-
});
|
|
32392
|
-
}, "searchCorpus");
|
|
32393
|
-
var SCAN_PAGE3 = 5e3;
|
|
32394
|
-
var LIVE3 = "((k.chunkable_type = 'document' AND EXISTS (SELECT 1 FROM documents d WHERE d.id = k.chunkable_id AND d.deleted_at IS NULL AND coalesce(json_extract(d.metadata, '$.catalog.active'), 1)=1 AND (? IS NULL OR d.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))))) OR (k.chunkable_type = 'note' AND ? IS NULL AND EXISTS (SELECT 1 FROM notes n WHERE n.id = k.chunkable_id AND n.deleted_at IS NULL)))";
|
|
32395
|
-
var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
32396
|
-
const { database } = context;
|
|
32397
|
-
const stemmerFor = stemmerCache();
|
|
32398
|
-
const drain = /* @__PURE__ */ __name(() => drainNoteIndex(database, stemmerFor), "drain");
|
|
32399
|
-
const read2 = /* @__PURE__ */ __name((type, id2) => {
|
|
32400
|
-
const row2 = database.prepare(`SELECT * FROM ${type === "document" ? "documents" : "notes"} WHERE id = ?`).get(id2);
|
|
32401
|
-
return row2 ? type === "document" ? documentOf(row2) : noteOf(row2) : void 0;
|
|
32402
|
-
}, "read");
|
|
32403
|
-
const live2 = /* @__PURE__ */ __name((folderIds, source2, withInternal = false) => {
|
|
32404
|
-
const folders = folderIds?.length ? JSON.stringify(folderIds) : null;
|
|
32405
|
-
const types = source2 === void 0 ? ["document", "note"] : source2 === "file" ? ["document"] : ["note"];
|
|
32406
|
-
return {
|
|
32407
|
-
sql: ` AND k.chunkable_type IN (${types.map(() => "?").join(", ")}) AND ${LIVE3}`,
|
|
32408
|
-
params: [...types, folders, folders, withInternal ? null : folders]
|
|
32409
|
-
};
|
|
32410
|
-
}, "live");
|
|
32411
|
-
return {
|
|
32412
|
-
...documentPicturesOver(context),
|
|
32413
|
-
search: /* @__PURE__ */ __name(async (query) => {
|
|
32414
|
-
drain();
|
|
32415
|
-
return searchNotes(context, query);
|
|
32416
|
-
}, "search"),
|
|
32417
|
-
indexState: /* @__PURE__ */ __name(async () => noteIndexState(database), "indexState"),
|
|
32418
|
-
chunksToEmbed: /* @__PURE__ */ __name(async (model, { after: after2, limit }) => {
|
|
32419
|
-
drain();
|
|
32420
|
-
const scope3 = live2(void 0, void 0);
|
|
32421
|
-
const texts2 = /* @__PURE__ */ new Map();
|
|
32422
|
-
const textOf5 = /* @__PURE__ */ __name((owner) => {
|
|
32423
|
-
if (!texts2.has(owner)) {
|
|
32424
|
-
const [type, id2] = owner.split(":");
|
|
32425
|
-
const note2 = read2(String(type), Number(id2));
|
|
32426
|
-
texts2.set(owner, note2 ? noteIndexText(note2.title, note2.text) : void 0);
|
|
32427
|
-
}
|
|
32428
|
-
return texts2.get(owner);
|
|
32429
|
-
}, "textOf");
|
|
32430
|
-
return database.prepare(`SELECT k.content_hash AS hash, min(k.chunkable_type || ':' || k.chunkable_id) AS owner, k.start_offset AS start, k.end_offset AS end
|
|
32431
|
-
FROM chunks k
|
|
32432
|
-
WHERE k.content_hash > ?${scope3.sql}
|
|
32433
|
-
AND NOT EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ? AND v.content_hash = k.content_hash)
|
|
32434
|
-
GROUP BY k.content_hash ORDER BY k.content_hash LIMIT ?`).all(after2 ?? "", ...scope3.params, model, limit).flatMap((row2) => {
|
|
32435
|
-
const text5 = textOf5(String(row2.owner));
|
|
32436
|
-
return text5 === void 0 ? [] : [{ hash: String(row2.hash), text: text5.slice(Number(row2.start), Number(row2.end)) }];
|
|
32437
|
-
});
|
|
32438
|
-
}, "chunksToEmbed"),
|
|
32439
|
-
embedded: /* @__PURE__ */ __name(async (model, { folderIds, withInternal, source: source2 }) => {
|
|
32440
|
-
drain();
|
|
32441
|
-
const scope3 = live2(folderIds, source2, withInternal);
|
|
32442
|
-
return database.prepare(`SELECT 1 FROM chunks k JOIN embeddings v ON v.model = ? AND v.content_hash = k.content_hash
|
|
32443
|
-
WHERE 1 = 1${scope3.sql} LIMIT 1`).get(model, ...scope3.params) !== void 0;
|
|
32444
|
-
}, "embedded"),
|
|
32445
|
-
nearest: /* @__PURE__ */ __name(async (model, query, { limit, folderIds, withInternal, source: source2 }) => {
|
|
32446
|
-
drain();
|
|
32447
|
-
const scope3 = live2(folderIds, source2, withInternal);
|
|
32448
|
-
const columns = `k.id, k.chunkable_type AS type, k.chunkable_id AS owner, k.start_offset AS start,
|
|
32449
|
-
k.end_offset AS end, k.content_hash AS hash, v.vector
|
|
32450
|
-
FROM chunks k JOIN embeddings v ON v.model = ? AND v.content_hash = k.content_hash`;
|
|
32451
|
-
const keep = /* @__PURE__ */ __name((best, row2) => {
|
|
32452
|
-
const score = dot(query, row2.vector);
|
|
32453
|
-
const key2 = `${row2.type}:${row2.owner}`;
|
|
32454
|
-
const held = best.get(key2);
|
|
32455
|
-
if (!held || score > held.score)
|
|
32456
|
-
best.set(key2, {
|
|
32457
|
-
score,
|
|
32458
|
-
first: held?.first ?? Number(row2.id),
|
|
32459
|
-
chunk: Number(row2.id),
|
|
32460
|
-
start: Number(row2.start),
|
|
32461
|
-
end: Number(row2.end)
|
|
32462
|
-
});
|
|
32463
|
-
}, "keep");
|
|
32464
|
-
const ranked = /* @__PURE__ */ __name((best) => [...best.entries()].sort(([, a], [, b]) => b.score - a.score || a.first - b.first).slice(0, limit), "ranked");
|
|
32465
|
-
const indexed = /* @__PURE__ */ __name(() => {
|
|
32466
|
-
const types = source2 === void 0 ? ["document", "note"] : source2 === "file" ? ["document"] : ["note"];
|
|
32467
|
-
const accounts2 = database.prepare("SELECT DISTINCT coalesce(account_id, 0) AS account FROM chunks WHERE chunkable_type = ?");
|
|
32468
|
-
const wanted = folderIds?.length ? new Set(folderIds.map(Number)) : void 0;
|
|
32469
|
-
const candidates = database.prepare(`SELECT ${columns} WHERE k.id IN (SELECT value FROM json_each(?))${scope3.sql} ORDER BY k.id`);
|
|
32470
|
-
const first = database.prepare(`SELECT min(k.id) AS first FROM chunks k JOIN embeddings v ON v.model = ? AND v.content_hash = k.content_hash
|
|
32471
|
-
WHERE k.chunkable_type = ? AND k.chunkable_id = ?${scope3.sql}`);
|
|
32472
|
-
const merged = /* @__PURE__ */ new Map();
|
|
32473
|
-
for (const type of types)
|
|
32474
|
-
for (const { account } of accounts2.all(type)) {
|
|
32475
|
-
if (type === "document" && wanted && !wanted.has(Number(account)))
|
|
32476
|
-
continue;
|
|
32477
|
-
const found2 = searchIndex(database, model, { kind: type, account: Number(account) }, query, limit, (near2) => {
|
|
32478
|
-
const hashes = new Map(near2.map(({ id: id2, hash: hash2 }) => [id2, hash2]));
|
|
32479
|
-
const best = /* @__PURE__ */ new Map();
|
|
32480
|
-
for (const row2 of candidates.all(model, JSON.stringify([...hashes.keys()]), ...scope3.params))
|
|
32481
|
-
if (hashes.get(Number(row2.id)) === row2.hash)
|
|
32482
|
-
keep(best, row2);
|
|
32483
|
-
for (const [key2, held] of best) {
|
|
32484
|
-
const [kind3, owner] = key2.split(":");
|
|
32485
|
-
held.first = Number(first.get(model, String(kind3), Number(owner), ...scope3.params)?.first);
|
|
32486
|
-
}
|
|
32487
|
-
const results = ranked(best);
|
|
32488
|
-
return { results, best: results.map(([, { chunk }]) => chunk) };
|
|
32489
|
-
});
|
|
32490
|
-
if (!found2)
|
|
32491
|
-
return void 0;
|
|
32492
|
-
for (const [key2, held] of found2)
|
|
32493
|
-
merged.set(key2, held);
|
|
32494
|
-
}
|
|
32495
|
-
return ranked(merged);
|
|
32496
|
-
}, "indexed");
|
|
32497
|
-
const scanned = /* @__PURE__ */ __name(() => {
|
|
32498
|
-
const page3 = database.prepare(`SELECT ${columns} WHERE k.id > ?${scope3.sql} ORDER BY k.id LIMIT ?`);
|
|
32499
|
-
const best = /* @__PURE__ */ new Map();
|
|
32500
|
-
let after2 = 0;
|
|
32501
|
-
for (; ; ) {
|
|
32502
|
-
const rows = page3.all(model, after2, ...scope3.params, SCAN_PAGE3);
|
|
32503
|
-
for (const row2 of rows)
|
|
32504
|
-
keep(best, row2);
|
|
32505
|
-
const last = rows.at(-1);
|
|
32506
|
-
if (!last || rows.length < SCAN_PAGE3)
|
|
32507
|
-
break;
|
|
32508
|
-
after2 = Number(last.id);
|
|
32509
|
-
}
|
|
32510
|
-
return ranked(best);
|
|
32511
|
-
}, "scanned");
|
|
32512
|
-
return (indexed() ?? scanned()).flatMap(([key2, { score, start, end }]) => {
|
|
32513
|
-
const [type, id2] = key2.split(":");
|
|
32514
|
-
const note2 = read2(String(type), Number(id2));
|
|
32515
|
-
return note2 ? [{ ref: note2.ref, note: note2, score, range: { start, end } }] : [];
|
|
32516
|
-
});
|
|
32517
|
-
}, "nearest")
|
|
32518
|
-
};
|
|
32519
|
-
}, "noteSearchOver");
|
|
32520
|
-
|
|
32521
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.452.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.63.0_commander@15._e609b9d6c8060966368a91e843fe8bd2/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
|
|
32778
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
|
|
32522
32779
|
import { mkdirSync, statSync, writeFileSync } from "node:fs";
|
|
32523
32780
|
import { dirname } from "node:path";
|
|
32524
32781
|
|
|
32525
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32782
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
|
|
32526
32783
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
32527
32784
|
var CLIENTS_SETTING = "clients";
|
|
32528
32785
|
var coreVersion = (() => {
|
|
@@ -32580,7 +32837,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
|
|
|
32580
32837
|
return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
|
|
32581
32838
|
}, "refusalAdvice");
|
|
32582
32839
|
|
|
32583
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32840
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
|
|
32584
32841
|
var GENERATED = [
|
|
32585
32842
|
{
|
|
32586
32843
|
"name": "20261010184427_initial",
|
|
@@ -33357,10 +33614,27 @@ WHERE json_type(params, '$.selection') = 'object';`
|
|
|
33357
33614
|
"CREATE TRIGGER vector_index_conversation_au AFTER UPDATE OF chat_id ON conversations\n WHEN old.chat_id IS NOT new.chat_id BEGIN\n INSERT INTO vector_index_redo (chunk_id)\n SELECT id FROM chunks WHERE chunkable_type = 'conversation' AND chunkable_id = new.id;\n DELETE FROM vector_index_redo;\nEND;",
|
|
33358
33615
|
"-- Images and conversations are indexed under their chat's account; messages carry their own.\nCREATE TRIGGER vector_index_chat_au AFTER UPDATE OF account_id ON chats WHEN old.account_id IS NOT new.account_id BEGIN\n INSERT INTO vector_index_redo (chunk_id)\n SELECT k.id FROM messages m JOIN attachments a ON a.attachable_type = 'message' AND a.attachable_id = m.id\n JOIN chunks k ON k.chunkable_type = 'image' AND k.chunkable_id = a.id WHERE m.chat_id = new.id\n UNION ALL SELECT k.id FROM conversations c JOIN chunks k ON k.chunkable_type = 'conversation' AND k.chunkable_id = c.id\n WHERE c.chat_id = new.id;\n DELETE FROM vector_index_redo;\nEND;"
|
|
33359
33616
|
]
|
|
33617
|
+
},
|
|
33618
|
+
{
|
|
33619
|
+
"name": "20261027102259_version-35-calendar-neutral",
|
|
33620
|
+
"statements": [
|
|
33621
|
+
"ALTER TABLE `calendar_entries` ADD `series_external_id` text;",
|
|
33622
|
+
"CREATE INDEX `calendar_entries_by_calendar_id_series_external_id` ON `calendar_entries` (`calendar_id`,`series_external_id`) WHERE series_external_id IS NOT NULL;"
|
|
33623
|
+
]
|
|
33624
|
+
},
|
|
33625
|
+
{
|
|
33626
|
+
"name": "20261027102302_version-35-calendar-neutral-data",
|
|
33627
|
+
"statements": [
|
|
33628
|
+
"-- `metadata.recurring_event_id` stays on the rows it is on: a version-34 build may still open this file and reads it.\nUPDATE calendar_entries SET series_external_id = json_extract(metadata, '$.recurring_event_id')\n WHERE kind = 'occurrence' AND json_valid(metadata) AND json_extract(metadata, '$.recurring_event_id') IS NOT NULL;",
|
|
33629
|
+
"UPDATE calendar_entries SET event_type = CASE event_type\n WHEN 'outOfOffice' THEN 'out-of-office'\n WHEN 'focusTime' THEN 'focus'\n WHEN 'workingLocation' THEN 'working-location'\n WHEN 'fromGmail' THEN 'from-mail'\n END\n WHERE event_type IN ('outOfOffice', 'focusTime', 'workingLocation', 'fromGmail');",
|
|
33630
|
+
"UPDATE calendar_entries SET own_response = 'needs-action' WHERE own_response = 'needsAction';",
|
|
33631
|
+
"UPDATE calendar_entry_participants SET response = 'needs-action' WHERE response = 'needsAction';",
|
|
33632
|
+
"UPDATE calendars SET access_role = 'free-busy' WHERE access_role = 'freeBusyReader';"
|
|
33633
|
+
]
|
|
33360
33634
|
}
|
|
33361
33635
|
];
|
|
33362
33636
|
|
|
33363
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33637
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
|
|
33364
33638
|
var MANIFEST = [
|
|
33365
33639
|
{ name: "20261010184427_initial", version: 1, minCompatible: 1 },
|
|
33366
33640
|
{ name: "20261011035353_version-2-facts", version: 2, minCompatible: 1 },
|
|
@@ -33405,7 +33679,9 @@ var MANIFEST = [
|
|
|
33405
33679
|
{ name: "20261025072643_version-33-calendars", version: 33, minCompatible: 32 },
|
|
33406
33680
|
{ name: "20261025072644_version-33-calendars-triggers", version: 33, minCompatible: 32 },
|
|
33407
33681
|
{ name: "20261025182500_version-34-vector-index", version: 34, minCompatible: 34 },
|
|
33408
|
-
{ name: "20261025182501_version-34-vector-index-triggers", version: 34, minCompatible: 34 }
|
|
33682
|
+
{ name: "20261025182501_version-34-vector-index-triggers", version: 34, minCompatible: 34 },
|
|
33683
|
+
{ name: "20261027102259_version-35-calendar-neutral", version: 35, minCompatible: 34 },
|
|
33684
|
+
{ name: "20261027102302_version-35-calendar-neutral-data", version: 35, minCompatible: 34 }
|
|
33409
33685
|
];
|
|
33410
33686
|
var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated = GENERATED) => {
|
|
33411
33687
|
const migrations = [];
|
|
@@ -33429,7 +33705,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
|
|
|
33429
33705
|
return migrations;
|
|
33430
33706
|
}, "generatedMigrations");
|
|
33431
33707
|
|
|
33432
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33708
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/migrations.js
|
|
33433
33709
|
var MIGRATIONS = generatedMigrations();
|
|
33434
33710
|
var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
33435
33711
|
version INTEGER PRIMARY KEY,
|
|
@@ -33482,7 +33758,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
|
|
|
33482
33758
|
}
|
|
33483
33759
|
}, "migrate");
|
|
33484
33760
|
|
|
33485
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33761
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
|
|
33486
33762
|
var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
33487
33763
|
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 ?");
|
|
33488
33764
|
if (pending.get(0, 1) === void 0)
|
|
@@ -33504,7 +33780,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
|
33504
33780
|
}
|
|
33505
33781
|
}, "fillJoinKeys");
|
|
33506
33782
|
|
|
33507
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33783
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
|
|
33508
33784
|
var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
|
|
33509
33785
|
const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
|
|
33510
33786
|
try {
|
|
@@ -33517,8 +33793,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
|
|
|
33517
33793
|
}, "openSqlite");
|
|
33518
33794
|
var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
33519
33795
|
quietSqliteWarning();
|
|
33520
|
-
const { drizzle } = await import("./node-
|
|
33521
|
-
const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-
|
|
33796
|
+
const { drizzle } = await import("./node-RSL3HANO.js");
|
|
33797
|
+
const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-7R3PYQGJ.js");
|
|
33522
33798
|
const client = await nodeClient(path, { readOnly });
|
|
33523
33799
|
try {
|
|
33524
33800
|
return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
|
|
@@ -33528,8 +33804,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
|
33528
33804
|
}
|
|
33529
33805
|
}, "openUnderNode");
|
|
33530
33806
|
var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
33531
|
-
const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-
|
|
33532
|
-
const { drizzle } = await import("./bun-
|
|
33807
|
+
const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-2IFQYQ44.js");
|
|
33808
|
+
const { drizzle } = await import("./bun-LIZ6MKFS.js");
|
|
33533
33809
|
const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
|
|
33534
33810
|
try {
|
|
33535
33811
|
return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
|
|
@@ -33539,7 +33815,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
|
33539
33815
|
}
|
|
33540
33816
|
}, "openUnderBun");
|
|
33541
33817
|
|
|
33542
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33818
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
|
|
33543
33819
|
var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
|
|
33544
33820
|
const ours = MIGRATIONS.at(-1)?.version ?? 0;
|
|
33545
33821
|
if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
|
|
@@ -33554,7 +33830,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
|
|
|
33554
33830
|
throw new CliError("configuration_error", `The store requires schema ${minCompatible}, but this tool supports ${ours}; ${refusalAdvice(storeClients(database), command, version)}`);
|
|
33555
33831
|
}, "assertReadCompatible");
|
|
33556
33832
|
|
|
33557
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33833
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
|
|
33558
33834
|
var BACKFILL_ON_OPEN = 5e3;
|
|
33559
33835
|
var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
|
|
33560
33836
|
var createWritable = /* @__PURE__ */ __name((file) => {
|
|
@@ -33610,10 +33886,10 @@ var openStoreContext = /* @__PURE__ */ __name(async ({ path, env, now: now2 = Da
|
|
|
33610
33886
|
}
|
|
33611
33887
|
}, "openStoreContext");
|
|
33612
33888
|
|
|
33613
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33889
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
|
|
33614
33890
|
import { createHash as createHash16 } from "node:crypto";
|
|
33615
33891
|
|
|
33616
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33892
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
|
|
33617
33893
|
var text3 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
|
|
33618
33894
|
var ref = text3(2048);
|
|
33619
33895
|
var timestamp2 = pipe(number(), safeInteger(), minValue(0));
|
|
@@ -33679,7 +33955,7 @@ var projectAnnotationsSchema = strictObject({
|
|
|
33679
33955
|
}))
|
|
33680
33956
|
});
|
|
33681
33957
|
|
|
33682
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33958
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
|
|
33683
33959
|
var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
|
|
33684
33960
|
var invalid7 = /* @__PURE__ */ __name((field3) => {
|
|
33685
33961
|
throw new CliError("validation_error", `invalid project annotations.${field3}`);
|
|
@@ -33783,7 +34059,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
|
|
|
33783
34059
|
invalid7("external.unused");
|
|
33784
34060
|
}, "validateProjectAnnotationsGraph");
|
|
33785
34061
|
|
|
33786
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34062
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
|
|
33787
34063
|
var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
|
|
33788
34064
|
var ref2 = pipe(string(), minLength(1), maxLength(2048));
|
|
33789
34065
|
var targetSchema = strictObject({
|
|
@@ -33889,7 +34165,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
|
|
|
33889
34165
|
};
|
|
33890
34166
|
}, "planBoundProjectAnnotations");
|
|
33891
34167
|
|
|
33892
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34168
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
|
|
33893
34169
|
import { createHash as createHash17 } from "node:crypto";
|
|
33894
34170
|
var text4 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
|
|
33895
34171
|
var timestamp3 = pipe(number(), safeInteger(), minValue(0));
|
|
@@ -33983,7 +34259,7 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
|
|
|
33983
34259
|
})).digest("hex");
|
|
33984
34260
|
}, "projectAnnotationSnapshotFingerprint");
|
|
33985
34261
|
|
|
33986
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34262
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
|
|
33987
34263
|
var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
|
|
33988
34264
|
if (!request || typeof request !== "object" || Array.isArray(request))
|
|
33989
34265
|
throw new CliError("validation_error", "project annotation request is required");
|
|
@@ -34000,7 +34276,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
|
|
|
34000
34276
|
return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
|
|
34001
34277
|
}, "projectAnnotationRequest");
|
|
34002
34278
|
|
|
34003
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34279
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
|
|
34004
34280
|
var SnapshotBudget = class {
|
|
34005
34281
|
static {
|
|
34006
34282
|
__name(this, "SnapshotBudget");
|
|
@@ -34026,13 +34302,13 @@ var SnapshotBudget = class {
|
|
|
34026
34302
|
}
|
|
34027
34303
|
};
|
|
34028
34304
|
|
|
34029
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34305
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
|
|
34030
34306
|
import { createHash as createHash19 } from "node:crypto";
|
|
34031
34307
|
|
|
34032
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34308
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
|
|
34033
34309
|
var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
|
|
34034
34310
|
|
|
34035
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34311
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
|
|
34036
34312
|
import { createHash as createHash18 } from "node:crypto";
|
|
34037
34313
|
var invalid9 = /* @__PURE__ */ __name(() => {
|
|
34038
34314
|
throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
|
|
@@ -34175,7 +34451,7 @@ var ProjectSnapshotSources = class {
|
|
|
34175
34451
|
}
|
|
34176
34452
|
};
|
|
34177
34453
|
|
|
34178
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34454
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
|
|
34179
34455
|
var unsupported = /* @__PURE__ */ __name(() => {
|
|
34180
34456
|
throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
|
|
34181
34457
|
}, "unsupported");
|
|
@@ -34346,7 +34622,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
|
|
|
34346
34622
|
return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
|
|
34347
34623
|
}), "projectAnnotationSnapshot");
|
|
34348
34624
|
|
|
34349
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34625
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
|
|
34350
34626
|
var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, manifest, bindings, budget) => read(database, () => {
|
|
34351
34627
|
const current = projectAnnotationSnapshot(database, projectId, budget).snapshot;
|
|
34352
34628
|
const sources = new ProjectSnapshotSources(database, budget);
|
|
@@ -34408,7 +34684,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
|
|
|
34408
34684
|
};
|
|
34409
34685
|
}), "previewAnnotationSnapshot");
|
|
34410
34686
|
|
|
34411
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34687
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
|
|
34412
34688
|
var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snapshot2, bindings) => {
|
|
34413
34689
|
const mappings = { ...bindings };
|
|
34414
34690
|
const resolve = /* @__PURE__ */ __name((ref3) => {
|
|
@@ -34450,7 +34726,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snap
|
|
|
34450
34726
|
return mappings;
|
|
34451
34727
|
}, "restoreAnnotationRecords");
|
|
34452
34728
|
|
|
34453
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34729
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
|
|
34454
34730
|
var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
34455
34731
|
async preview(request) {
|
|
34456
34732
|
const { snapshot: snapshot2, projectId } = projectAnnotationRequest(request);
|
|
@@ -34480,7 +34756,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
34480
34756
|
}
|
|
34481
34757
|
}), "projectAnnotationStoreOver");
|
|
34482
34758
|
|
|
34483
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34759
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
|
|
34484
34760
|
var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
|
|
34485
34761
|
const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
|
|
34486
34762
|
let merged = { from: from2, to };
|
|
@@ -34493,7 +34769,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
|
|
|
34493
34769
|
}, "markRange");
|
|
34494
34770
|
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");
|
|
34495
34771
|
|
|
34496
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34772
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
|
|
34497
34773
|
var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
|
|
34498
34774
|
var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
|
|
34499
34775
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
|
|
@@ -34503,7 +34779,7 @@ var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) =
|
|
|
34503
34779
|
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);
|
|
34504
34780
|
}, "setTaskRulesStop");
|
|
34505
34781
|
|
|
34506
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34782
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sync.js
|
|
34507
34783
|
var syncStoreOver = /* @__PURE__ */ __name((context) => {
|
|
34508
34784
|
const { database } = context;
|
|
34509
34785
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
|
|
@@ -34559,7 +34835,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
34559
34835
|
};
|
|
34560
34836
|
}, "syncStoreOver");
|
|
34561
34837
|
|
|
34562
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34838
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/tags.js
|
|
34563
34839
|
var tagsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
34564
34840
|
const { database } = context;
|
|
34565
34841
|
return {
|
|
@@ -34581,7 +34857,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
34581
34857
|
};
|
|
34582
34858
|
}, "tagsStoreOver");
|
|
34583
34859
|
|
|
34584
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34860
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
|
|
34585
34861
|
var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
|
|
34586
34862
|
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
|
|
34587
34863
|
WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
|
|
@@ -34628,7 +34904,7 @@ var saveImageChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, acco
|
|
|
34628
34904
|
}, "saveImageChunks");
|
|
34629
34905
|
var embeddedHashes = /* @__PURE__ */ __name(({ orm }, model, hashes) => new Set(hashes.length === 0 ? [] : orm.all(sql`SELECT content_hash AS hash FROM embeddings
|
|
34630
34906
|
WHERE model = ${model} AND content_hash IN (SELECT value FROM json_each(${JSON.stringify(hashes)}))`).map(({ hash: hash2 }) => hash2)), "embeddedHashes");
|
|
34631
|
-
var
|
|
34907
|
+
var SCAN_PAGE5 = 5e3;
|
|
34632
34908
|
var imageRows = /* @__PURE__ */ __name(({ orm }, accountPk2, { chatKey, model, since, position: position2 }, rows) => orm.all(sql`SELECT k.id, k.content_hash AS hash, ch.external_id AS chatId, m.external_id AS messageId, v.vector
|
|
34633
34909
|
FROM chunks k CROSS JOIN attachments a ON a.id = k.chunkable_id AND a.attachable_type = 'message'
|
|
34634
34910
|
JOIN messages m ON m.id = a.attachable_id AND m.deleted_at IS NULL
|
|
@@ -34637,7 +34913,7 @@ var imageRows = /* @__PURE__ */ __name(({ orm }, accountPk2, { chatKey, model, s
|
|
|
34637
34913
|
WHERE k.chunkable_type = 'image' AND k.position = ${position2} AND ch.account_id = ${accountPk2}
|
|
34638
34914
|
${chatKey === void 0 ? sql`AND ch.searchable = 1` : sql`AND m.chat_id = ${chatKey}`}
|
|
34639
34915
|
${since === void 0 ? sql`` : sql`AND k.occurred_at >= ${since}`}
|
|
34640
|
-
${"ids" in rows ? sql`AND k.id IN (SELECT value FROM json_each(${JSON.stringify(rows.ids)})) ORDER BY k.id` : sql`AND k.id > ${rows.after} ORDER BY k.id LIMIT ${
|
|
34916
|
+
${"ids" in rows ? sql`AND k.id IN (SELECT value FROM json_each(${JSON.stringify(rows.ids)})) ORDER BY k.id` : sql`AND k.id > ${rows.after} ORDER BY k.id LIMIT ${SCAN_PAGE5}`}`), "imageRows");
|
|
34641
34917
|
var nearestImages = /* @__PURE__ */ __name((context, accountPk2, { chatKey, model, since, limit, query, position: position2 = 0 }) => {
|
|
34642
34918
|
const filter = {
|
|
34643
34919
|
model,
|
|
@@ -34672,7 +34948,7 @@ var nearestImages = /* @__PURE__ */ __name((context, accountPk2, { chatKey, mode
|
|
|
34672
34948
|
for (const row2 of rows)
|
|
34673
34949
|
found2.push(score(row2));
|
|
34674
34950
|
const last = rows.at(-1);
|
|
34675
|
-
if (!last || rows.length <
|
|
34951
|
+
if (!last || rows.length < SCAN_PAGE5)
|
|
34676
34952
|
break;
|
|
34677
34953
|
after2 = last.id;
|
|
34678
34954
|
}
|
|
@@ -34708,7 +34984,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
|
|
|
34708
34984
|
dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
|
|
34709
34985
|
}, "savePictureChunks");
|
|
34710
34986
|
|
|
34711
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34987
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
|
|
34712
34988
|
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,
|
|
34713
34989
|
EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
|
|
34714
34990
|
FROM messages m
|
|
@@ -34745,7 +35021,7 @@ var dropGoneMessageChunks = /* @__PURE__ */ __name((context, accountPk2) => {
|
|
|
34745
35021
|
}, "dropGoneMessageChunks");
|
|
34746
35022
|
var hasMessageVectors = /* @__PURE__ */ __name(({ orm }, accountPk2, model) => orm.get(sql`SELECT 1 FROM chunks k JOIN embeddings v ON v.model = ${model} AND v.content_hash = k.content_hash
|
|
34747
35023
|
WHERE k.chunkable_type = 'message' AND k.account_id = ${accountPk2} LIMIT 1`) !== void 0, "hasMessageVectors");
|
|
34748
|
-
var
|
|
35024
|
+
var SCAN_PAGE6 = 5e3;
|
|
34749
35025
|
var messageRows = /* @__PURE__ */ __name(({ orm }, accountPk2, { chatKey, model, since, before: before2 }, rows) => orm.all(sql`SELECT k.id, k.content_hash AS hash, ch.external_id AS chatId, m.external_id AS messageId, v.vector
|
|
34750
35026
|
FROM chunks k CROSS JOIN messages m ON m.id = k.chunkable_id AND m.deleted_at IS NULL
|
|
34751
35027
|
JOIN chats ch ON ch.id = m.chat_id
|
|
@@ -34754,7 +35030,7 @@ var messageRows = /* @__PURE__ */ __name(({ orm }, accountPk2, { chatKey, model,
|
|
|
34754
35030
|
${chatKey === void 0 ? sql`AND ch.searchable = 1` : sql`AND m.chat_id = ${chatKey}`}
|
|
34755
35031
|
${since === void 0 ? sql`` : sql`AND m.sent_at >= ${since}`}
|
|
34756
35032
|
${before2 === void 0 ? sql`` : sql`AND m.sent_at < ${before2}`}
|
|
34757
|
-
${"ids" in rows ? sql`AND k.id IN (SELECT value FROM json_each(${JSON.stringify(rows.ids)})) ORDER BY k.id` : sql`AND k.id > ${rows.after} ORDER BY k.id LIMIT ${
|
|
35033
|
+
${"ids" in rows ? sql`AND k.id IN (SELECT value FROM json_each(${JSON.stringify(rows.ids)})) ORDER BY k.id` : sql`AND k.id > ${rows.after} ORDER BY k.id LIMIT ${SCAN_PAGE6}`}`), "messageRows");
|
|
34758
35034
|
var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, query, ...filter }) => {
|
|
34759
35035
|
const score = /* @__PURE__ */ __name((row2) => ({
|
|
34760
35036
|
id: row2.id,
|
|
@@ -34784,14 +35060,14 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
|
|
|
34784
35060
|
for (const row2 of rows)
|
|
34785
35061
|
found2.push(score(row2));
|
|
34786
35062
|
const last = rows.at(-1);
|
|
34787
|
-
if (!last || rows.length <
|
|
35063
|
+
if (!last || rows.length < SCAN_PAGE6)
|
|
34788
35064
|
break;
|
|
34789
35065
|
after2 = last.id;
|
|
34790
35066
|
}
|
|
34791
35067
|
return plain2(best(found2));
|
|
34792
35068
|
}, "nearestMessages");
|
|
34793
35069
|
|
|
34794
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35070
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/vectors.js
|
|
34795
35071
|
var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
|
|
34796
35072
|
const { database } = context;
|
|
34797
35073
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -35045,7 +35321,7 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
35045
35321
|
embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
|
|
35046
35322
|
}), "vectorsStoreOver");
|
|
35047
35323
|
|
|
35048
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35324
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
|
|
35049
35325
|
import { existsSync, readFileSync as readFileSync4 } from "node:fs";
|
|
35050
35326
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
35051
35327
|
var BOOKKEEPING = ["schema_migrations", "store_settings"];
|
|
@@ -35133,10 +35409,10 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
|
|
|
35133
35409
|
}
|
|
35134
35410
|
}, "lastBackup");
|
|
35135
35411
|
|
|
35136
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35412
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/providers.js
|
|
35137
35413
|
var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
|
|
35138
35414
|
|
|
35139
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35415
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
|
|
35140
35416
|
var COUNTED_TABLES = [
|
|
35141
35417
|
"accounts",
|
|
35142
35418
|
"chats",
|
|
@@ -35221,7 +35497,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
|
|
|
35221
35497
|
};
|
|
35222
35498
|
}, "storeContents");
|
|
35223
35499
|
|
|
35224
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35500
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/store.js
|
|
35225
35501
|
var openStore = /* @__PURE__ */ __name(async (options = {}) => {
|
|
35226
35502
|
const context = await openStoreContext(options);
|
|
35227
35503
|
try {
|
|
@@ -35277,7 +35553,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
|
|
|
35277
35553
|
const notes2 = once3(() => ({ ...notesStoreOver(context), ...noteSearchOver(context) }));
|
|
35278
35554
|
const catalog = once3(() => catalogStoreOver(context));
|
|
35279
35555
|
const files2 = once3(() => filesStoreOver(context));
|
|
35280
|
-
const calendar = once3(() => eventStoreOver(context));
|
|
35556
|
+
const calendar = once3(() => ({ ...eventStoreOver(context), ...eventSearchOver(context) }));
|
|
35281
35557
|
const meetingFindings = once3(() => meetingFindingsStoreOver(context));
|
|
35282
35558
|
const evidenceFindings = once3(() => evidenceFindingsStoreOver(context));
|
|
35283
35559
|
const facts2 = once3(() => factsStoreOver(context));
|