@wirecat/tg-cli 0.108.0 → 0.110.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/dist/bin/tg.js +2 -2
- package/dist/bundle/{adapter-YFWRJWL5.js → adapter-JWUCHTXU.js} +45 -44
- package/dist/bundle/{all-profiles-GQIZSF4W.js → all-profiles-OMRCKP54.js} +8 -8
- package/dist/bundle/{anthropic-BKWEDKPU.js → anthropic-WXFHH74P.js} +5 -5
- package/dist/bundle/{app-server-RJV7ICLH.js → app-server-ILIPNO6T.js} +40 -39
- package/dist/bundle/{bot-api-2PAH2JZ3.js → bot-api-KV765AZK.js} +46 -45
- package/dist/bundle/{bot-history-DPPZ43F4.js → bot-history-3P6EIM5L.js} +15 -15
- package/dist/bundle/{bun-Q7COX3Z5.js → bun-MJOYPPEN.js} +2 -2
- package/dist/bundle/{bun-sqlite-YI4AYZXO.js → bun-sqlite-GFRVRRDZ.js} +4 -4
- package/dist/bundle/{chunk-BOSMBW4I.js → chunk-2YWQEG2P.js} +11 -11
- package/dist/bundle/{chunk-4RDMNNVO.js → chunk-32HEOKI2.js} +27 -14
- package/dist/bundle/{chunk-3GXKJKIC.js → chunk-3KOF5T4N.js} +4 -4
- package/dist/bundle/{chunk-AOUB2QFP.js → chunk-3L2JTAVD.js} +2 -2
- package/dist/bundle/{chunk-26PWIQPP.js → chunk-3XTMVGTS.js} +2338 -1174
- package/dist/bundle/{chunk-5P27JGGA.js → chunk-4BMXELWN.js} +5 -5
- package/dist/bundle/{chunk-VK2YLSK7.js → chunk-4GOF43MW.js} +1 -1
- package/dist/bundle/{chunk-5HPXENE5.js → chunk-4I6HTOCM.js} +1 -1
- package/dist/bundle/{chunk-LY2LFJMU.js → chunk-4YOPRYEY.js} +117 -94
- package/dist/bundle/{chunk-ON67U6WV.js → chunk-54CWOD7V.js} +6 -6
- package/dist/bundle/chunk-5ASW5BNM.js +379 -0
- package/dist/bundle/{chunk-OB5PPPXH.js → chunk-5CMOXHQS.js} +7 -7
- package/dist/bundle/{chunk-WEDWIXIC.js → chunk-6KESAYMZ.js} +2 -2
- package/dist/bundle/{chunk-3562DVQ7.js → chunk-6WTLP2SI.js} +8 -8
- package/dist/bundle/{chunk-BT6PWDM6.js → chunk-7ABA4EXC.js} +3 -3
- package/dist/bundle/{chunk-WKSLGPZQ.js → chunk-7LZBMZQM.js} +16 -4
- package/dist/bundle/{chunk-VMU4SGCE.js → chunk-ABVHA4K6.js} +8 -6
- package/dist/bundle/{chunk-YJ6GFFEE.js → chunk-AXNBGLO5.js} +1 -1
- package/dist/bundle/{chunk-LYLGLFWY.js → chunk-AZYVTDAE.js} +3 -3
- package/dist/bundle/{chunk-T4SDOYPY.js → chunk-BWRCPMMC.js} +138 -81
- package/dist/bundle/{chunk-DNOJKQXQ.js → chunk-BYOEVYY2.js} +678 -325
- package/dist/bundle/{chunk-FG2QTYEF.js → chunk-EB44Z44U.js} +1 -1
- package/dist/bundle/{chunk-67SRVSPU.js → chunk-EO563SUX.js} +26 -9
- package/dist/bundle/{chunk-F67VPIJL.js → chunk-F24EAGOU.js} +32 -31
- package/dist/bundle/{chunk-ZHHVNTBJ.js → chunk-F7RWNBC2.js} +2 -2
- package/dist/bundle/{chunk-REI5TPS3.js → chunk-FYAHTTOB.js} +11 -11
- package/dist/bundle/{chunk-CZANI3DM.js → chunk-GPIORQAD.js} +22 -22
- package/dist/bundle/{chunk-76OSISA3.js → chunk-HCAYTAJN.js} +2 -2
- package/dist/bundle/{chunk-SONKULUF.js → chunk-JDOSIWPN.js} +3 -3
- package/dist/bundle/{chunk-KZPZFPGB.js → chunk-KLOFBUXA.js} +81 -30
- package/dist/bundle/{chunk-6MZ2ZBX4.js → chunk-L3YDXUDK.js} +12 -3
- package/dist/bundle/{chunk-AS2BVZU3.js → chunk-M3XIME74.js} +49 -24
- package/dist/bundle/{chunk-WUF64WOG.js → chunk-MXIBRT6W.js} +4 -4
- package/dist/bundle/{chunk-D6DBVPES.js → chunk-MZRD776E.js} +3 -3
- package/dist/bundle/{chunk-6QTUYMGX.js → chunk-NDT22GBK.js} +2 -2
- package/dist/bundle/{chunk-3HYDKCXB.js → chunk-NFBOZT7H.js} +12 -12
- package/dist/bundle/{chunk-WAGDZB62.js → chunk-ONHHBPV3.js} +2 -2
- package/dist/bundle/{chunk-DUWTG2GE.js → chunk-Q35J5LCO.js} +8 -8
- package/dist/bundle/{chunk-77OOX2OE.js → chunk-QRH2AWBZ.js} +81 -57
- package/dist/bundle/{chunk-PQHYM2XC.js → chunk-RARYRHQA.js} +1 -1
- package/dist/bundle/{chunk-ZYBDAZFO.js → chunk-RSZEEWOW.js} +2 -2
- package/dist/bundle/{chunk-QVIT6SQ5.js → chunk-RXWG7OWT.js} +705 -425
- package/dist/bundle/{chunk-R5YOKYTE.js → chunk-SD5J5T7M.js} +11 -11
- package/dist/bundle/{chunk-NCXCBVHO.js → chunk-SLAPUEMZ.js} +6 -6
- package/dist/bundle/{chunk-KQFR7ZAA.js → chunk-TDQVVXPF.js} +43 -25
- package/dist/bundle/{chunk-BL72ZIBV.js → chunk-TJA3BWY3.js} +1 -1
- package/dist/bundle/{chunk-MFS52LTZ.js → chunk-UIPT6IAU.js} +1 -1
- package/dist/bundle/{chunk-EBB7RFCW.js → chunk-VM7I5VKX.js} +2 -2
- package/dist/bundle/{chunk-CVWF3BFK.js → chunk-VOBMR7E5.js} +45 -45
- package/dist/bundle/{chunk-B7TFWNKJ.js → chunk-W3B6EEZU.js} +1 -1
- package/dist/bundle/{chunk-PCMW3PW6.js → chunk-XLNYDJKG.js} +2 -2
- package/dist/bundle/{chunk-TVA3NXXO.js → chunk-YPEAEEHF.js} +2 -2
- package/dist/bundle/{chunk-XZXOGHU5.js → chunk-YPLL3Q3M.js} +71 -60
- package/dist/bundle/{chunk-EWL3ZFOI.js → chunk-YWSNUUW5.js} +6 -6
- package/dist/bundle/command-contract-TNSW7W6G.js +32 -0
- package/dist/bundle/{decode-ZFAFVFWX.js → decode-3KBXZCFM.js} +19 -17
- package/dist/bundle/{echarts-SVXNTKGV.js → echarts-24TVPFGC.js} +2 -2
- package/dist/bundle/{embed-V755YE7O.js → embed-3BDPZ4Q7.js} +5 -5
- package/dist/bundle/{embedder-MQAPNQBH.js → embedder-EMVDEZFR.js} +8 -8
- package/dist/bundle/{entry-ULQ3VOMQ.js → entry-NQD6Z2BM.js} +5 -5
- package/dist/bundle/{first-run-64BTWXDR.js → first-run-ZBIO6C67.js} +9 -9
- package/dist/bundle/first-screen-4HRCG7OX.js +30 -0
- package/dist/bundle/{identity-PW45VBUU.js → identity-EDGOOTOM.js} +3 -3
- package/dist/bundle/{instructions-G3ZUIRRH.js → instructions-N2WVMNFZ.js} +1 -1
- package/dist/bundle/{mcp-OQBZXELQ.js → mcp-EMNFFY4N.js} +2 -2
- package/dist/bundle/{node-IDJXLZSX.js → node-VBZAZHUS.js} +2 -2
- package/dist/bundle/{node-sqlite-W22J37MG.js → node-sqlite-C3V64OAL.js} +4 -4
- package/dist/bundle/{oauth-Q52LBXDE.js → oauth-NZXELYDA.js} +6 -6
- package/dist/bundle/{open-YLD7VHEC.js → open-2XRUGMV7.js} +3 -3
- package/dist/bundle/openai-OLGTN3ZB.js +250 -0
- package/dist/bundle/{process-OBESF2XG.js → process-CASPZ2DH.js} +1 -1
- package/dist/bundle/{program-EBMWHOKQ.js → program-QPQDSGYA.js} +50 -47
- package/dist/bundle/{prompt-FHHQF3MG.js → prompt-ESZL7SGX.js} +4 -4
- package/dist/bundle/{proxy-transport-YSBYG26I.js → proxy-transport-OROEVBCG.js} +4 -4
- package/dist/bundle/{recognize-QNHKHGKM.js → recognize-LQ7QOG4T.js} +5 -3
- package/dist/bundle/{remote-RVZWRCCT.js → remote-34XP4EDN.js} +6 -6
- package/dist/bundle/{rerank-KG2USEME.js → rerank-7F6NLBCW.js} +6 -6
- package/dist/bundle/{serve-I4MJKEQ4.js → serve-M6TTKXI4.js} +8 -8
- package/dist/bundle/{server-GV7SV3L6.js → server-GLZ5M7PE.js} +32 -31
- package/dist/bundle/server-KOW7OKE2.js +56 -0
- package/dist/bundle/{state-AJKHWFBU.js → state-UKKPLMHS.js} +5 -5
- package/dist/bundle/{store-L3HFSSGJ.js → store-J2MBIDJK.js} +10 -10
- package/dist/bundle/store-maintenance-command-64B57C3U.js +45 -0
- package/dist/bundle/tg.js +4 -4
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +2 -1
- package/dist/program.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/bundle/command-contract-5GJV6EHG.js +0 -32
- package/dist/bundle/first-screen-YZCH4TEV.js +0 -30
- package/dist/bundle/server-AXMWFPNT.js +0 -55
- package/dist/bundle/store-maintenance-command-Y22ARSDR.js +0 -44
- /package/dist/bundle/{chunk-O5EHUB2V.js → chunk-NPGVOZVK.js} +0 -0
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
validateQuery,
|
|
53
53
|
walkQuery,
|
|
54
54
|
zonedMoment
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-YPLL3Q3M.js";
|
|
56
56
|
import {
|
|
57
57
|
DEFAULT_STEMMERS,
|
|
58
58
|
DEFAULT_STEMMERS_VERSION,
|
|
@@ -65,21 +65,21 @@ import {
|
|
|
65
65
|
fold,
|
|
66
66
|
normalize,
|
|
67
67
|
parseStemmers
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-6WTLP2SI.js";
|
|
69
69
|
import {
|
|
70
70
|
DEFAULT_TASK_CATEGORIES,
|
|
71
71
|
sharedConfigPath,
|
|
72
72
|
storedTaskCategories,
|
|
73
73
|
taskCategoriesReader
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-54CWOD7V.js";
|
|
75
75
|
import {
|
|
76
76
|
storePath
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-VM7I5VKX.js";
|
|
78
78
|
import {
|
|
79
79
|
PRAGMAS,
|
|
80
80
|
quietSqliteWarning,
|
|
81
81
|
storeCapable
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-SLAPUEMZ.js";
|
|
83
83
|
import {
|
|
84
84
|
SQLiteTable,
|
|
85
85
|
TableAliasProxyHandler,
|
|
@@ -104,10 +104,10 @@ import {
|
|
|
104
104
|
sql,
|
|
105
105
|
sqliteTable,
|
|
106
106
|
text
|
|
107
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-4GOF43MW.js";
|
|
108
108
|
import {
|
|
109
109
|
singleLine
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-BWRCPMMC.js";
|
|
111
111
|
import {
|
|
112
112
|
CliError,
|
|
113
113
|
array,
|
|
@@ -125,7 +125,7 @@ import {
|
|
|
125
125
|
safeParse,
|
|
126
126
|
strictObject,
|
|
127
127
|
string
|
|
128
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-EO563SUX.js";
|
|
129
129
|
import {
|
|
130
130
|
resolveFrom
|
|
131
131
|
} from "./chunk-Y5E2WNWB.js";
|
|
@@ -133,7 +133,7 @@ import {
|
|
|
133
133
|
__name
|
|
134
134
|
} from "./chunk-ZVVMGPBJ.js";
|
|
135
135
|
|
|
136
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
136
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/account-store.js
|
|
137
137
|
var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
|
|
138
138
|
const methods = whole;
|
|
139
139
|
return Object.fromEntries(Object.keys(keyed).map((name) => [
|
|
@@ -261,7 +261,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
|
|
|
261
261
|
};
|
|
262
262
|
}, "bindAccount");
|
|
263
263
|
|
|
264
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
264
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/providers.js
|
|
265
265
|
var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events"];
|
|
266
266
|
var PROVIDERS = [
|
|
267
267
|
{ name: "telegram", kind: "messages", aliases: ["tg"] },
|
|
@@ -352,7 +352,7 @@ var providerNamed = /* @__PURE__ */ __name((word) => {
|
|
|
352
352
|
var kindIn = /* @__PURE__ */ __name((provider) => isFolderProvider(provider) ? "notes" : registry.find(({ name }) => name === provider)?.kind, "kindIn");
|
|
353
353
|
var kindOf = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
|
|
354
354
|
|
|
355
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
355
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/search/query.js
|
|
356
356
|
var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
|
|
357
357
|
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");
|
|
358
358
|
var fail = /* @__PURE__ */ __name((message2) => {
|
|
@@ -375,7 +375,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
|
|
|
375
375
|
return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
|
|
376
376
|
}, "sourceOf");
|
|
377
377
|
|
|
378
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
378
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/search/account-list.js
|
|
379
379
|
var ACCOUNT_GROUPS = "accountGroups";
|
|
380
380
|
var ACCOUNT_GROUPS_SETTING = "account_groups";
|
|
381
381
|
var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
|
|
@@ -562,7 +562,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf = (kind3)
|
|
|
562
562
|
return { accounts: [...chosen.values()], skipped };
|
|
563
563
|
}, "fitting");
|
|
564
564
|
|
|
565
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
565
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
|
|
566
566
|
var IndexBuilderOn = class {
|
|
567
567
|
static {
|
|
568
568
|
__name(this, "IndexBuilderOn");
|
|
@@ -757,7 +757,7 @@ function alias(table, alias2) {
|
|
|
757
757
|
}
|
|
758
758
|
__name(alias, "alias");
|
|
759
759
|
|
|
760
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
760
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
|
|
761
761
|
var ENTITY_TABLES = {
|
|
762
762
|
account: "accounts",
|
|
763
763
|
attachment: "attachments",
|
|
@@ -797,7 +797,7 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
|
|
|
797
797
|
return { table, pointer, type, count, known: known2 };
|
|
798
798
|
}).filter(({ count }) => count > 0)), "orphanPointers");
|
|
799
799
|
|
|
800
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
800
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
|
|
801
801
|
var canonicalTags = sqliteTable("canonical_tags", {
|
|
802
802
|
id: integer("id").primaryKey(),
|
|
803
803
|
name: text("name").notNull().unique(),
|
|
@@ -806,7 +806,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
|
|
|
806
806
|
updatedAt: integer("updated_at").notNull()
|
|
807
807
|
});
|
|
808
808
|
|
|
809
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
809
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
|
|
810
810
|
var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
|
|
811
811
|
sourceKey: text("source_key").notNull(),
|
|
812
812
|
collection: text("collection").notNull(),
|
|
@@ -816,13 +816,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
|
|
|
816
816
|
createdAt: integer("created_at").notNull()
|
|
817
817
|
}, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
|
|
818
818
|
|
|
819
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
819
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
|
|
820
820
|
var documentIndexPending = sqliteTable("document_index_pending", {
|
|
821
821
|
id: integer("id").notNull(),
|
|
822
822
|
indexableType: text("indexable_type").notNull()
|
|
823
823
|
}, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
|
|
824
824
|
|
|
825
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
825
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
|
|
826
826
|
var tagRedirects = sqliteTable("tag_redirects", {
|
|
827
827
|
sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
|
|
828
828
|
survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
|
|
@@ -848,7 +848,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
|
|
|
848
848
|
index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
|
|
849
849
|
]);
|
|
850
850
|
|
|
851
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
851
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
|
|
852
852
|
var accounts = sqliteTable("accounts", {
|
|
853
853
|
id: integer("id").primaryKey(),
|
|
854
854
|
provider: text("provider").notNull(),
|
|
@@ -2344,7 +2344,7 @@ var storeSettings = sqliteTable("store_settings", {
|
|
|
2344
2344
|
at: integer("at").notNull()
|
|
2345
2345
|
});
|
|
2346
2346
|
|
|
2347
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2347
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
|
|
2348
2348
|
var ARMS = [
|
|
2349
2349
|
[
|
|
2350
2350
|
"message",
|
|
@@ -2471,7 +2471,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
|
|
|
2471
2471
|
return recomputed;
|
|
2472
2472
|
}, "drainInvolvementQueue");
|
|
2473
2473
|
|
|
2474
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2474
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/mentions.js
|
|
2475
2475
|
import { domainToUnicode } from "node:url";
|
|
2476
2476
|
|
|
2477
2477
|
// node_modules/.pnpm/psl@1.15.0/node_modules/psl/dist/psl.mjs
|
|
@@ -12493,7 +12493,7 @@ var oa = /* @__PURE__ */ __name((e) => {
|
|
|
12493
12493
|
}, "oa");
|
|
12494
12494
|
var na = { parse: O, get: aa, isValid: oa };
|
|
12495
12495
|
|
|
12496
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12496
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
|
|
12497
12497
|
var LINK = /https?:\/\/(?:(?:docs|drive|sheets|slides)\.google\.com|forms\.gle)(?:[/?#][^\s<>"'`]*)?/gi;
|
|
12498
12498
|
var ID = /^[\w-]{10,}$/;
|
|
12499
12499
|
var trimUrl = /* @__PURE__ */ __name((url) => {
|
|
@@ -12534,7 +12534,7 @@ var googleDocumentLinks = /* @__PURE__ */ __name((text5) => [...text5.matchAll(L
|
|
|
12534
12534
|
return { url, documentId: googleDocumentId(url) };
|
|
12535
12535
|
}), "googleDocumentLinks");
|
|
12536
12536
|
|
|
12537
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12537
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
|
|
12538
12538
|
var PHONE_PLANS = [
|
|
12539
12539
|
{
|
|
12540
12540
|
country: "us",
|
|
@@ -12914,7 +12914,7 @@ var PHONE_PLANS = [
|
|
|
12914
12914
|
}
|
|
12915
12915
|
];
|
|
12916
12916
|
|
|
12917
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12917
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/phones.js
|
|
12918
12918
|
var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
|
|
12919
12919
|
var DEFAULT_PHONE_COUNTRIES = ["ru"];
|
|
12920
12920
|
var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
|
|
@@ -12955,7 +12955,7 @@ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
|
|
|
12955
12955
|
return void 0;
|
|
12956
12956
|
}, "nationalPhone");
|
|
12957
12957
|
|
|
12958
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12958
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/places.js
|
|
12959
12959
|
var BEFORE = [
|
|
12960
12960
|
[/^(?:ул\.?|улиц[аеыу]|улицей)$/iu, "\u0443\u043B\u0438\u0446\u0430"],
|
|
12961
12961
|
[/^(?:пр-т|просп\.?|проспект[аеу]?)$/iu, "\u043F\u0440\u043E\u0441\u043F\u0435\u043A\u0442"],
|
|
@@ -13215,7 +13215,7 @@ var findPlaces = /* @__PURE__ */ __name((text5) => {
|
|
|
13215
13215
|
return found2.sort((a, b) => a.start - b.start);
|
|
13216
13216
|
}, "findPlaces");
|
|
13217
13217
|
|
|
13218
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13218
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/mentions.js
|
|
13219
13219
|
var MENTION_KINDS = ["phone", "email", "url", "document", "person-name", "place"];
|
|
13220
13220
|
var MENTION_VERSIONS = {
|
|
13221
13221
|
phone: 1,
|
|
@@ -13405,7 +13405,7 @@ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE
|
|
|
13405
13405
|
};
|
|
13406
13406
|
}, "typedPhone");
|
|
13407
13407
|
|
|
13408
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13408
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/first-names.js
|
|
13409
13409
|
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";
|
|
13410
13410
|
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";
|
|
13411
13411
|
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";
|
|
@@ -13413,7 +13413,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
|
|
|
13413
13413
|
var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
|
|
13414
13414
|
var NAME_WORDS = WORDS.split(" ");
|
|
13415
13415
|
|
|
13416
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13416
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/person-names.js
|
|
13417
13417
|
var LATIN_TO_CYRILLIC = {
|
|
13418
13418
|
shch: "\u0449",
|
|
13419
13419
|
sch: "\u0449",
|
|
@@ -13621,7 +13621,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text5, stem, taken) => {
|
|
|
13621
13621
|
return found2;
|
|
13622
13622
|
}, "findUnknownNames");
|
|
13623
13623
|
|
|
13624
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13624
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/attachments.js
|
|
13625
13625
|
var NOT_FILES = /* @__PURE__ */ new Set([
|
|
13626
13626
|
"webpage",
|
|
13627
13627
|
"share",
|
|
@@ -13653,7 +13653,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored3, files2) => {
|
|
|
13653
13653
|
});
|
|
13654
13654
|
}, "matchDownloads");
|
|
13655
13655
|
|
|
13656
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13656
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
|
|
13657
13657
|
var QUERY_VERSION = 1;
|
|
13658
13658
|
var QUERY_LIMITS2 = {
|
|
13659
13659
|
...QUERY_LIMITS,
|
|
@@ -13684,7 +13684,7 @@ function exhausted(budget) {
|
|
|
13684
13684
|
}
|
|
13685
13685
|
__name(exhausted, "exhausted");
|
|
13686
13686
|
|
|
13687
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13687
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
|
|
13688
13688
|
var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
|
|
13689
13689
|
var literal2 = /* @__PURE__ */ __name((c) => ({
|
|
13690
13690
|
kind: "char",
|
|
@@ -14084,7 +14084,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
|
|
|
14084
14084
|
return out;
|
|
14085
14085
|
}, "foldRegex");
|
|
14086
14086
|
|
|
14087
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14087
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
|
|
14088
14088
|
var PRESET_VERSION = 1;
|
|
14089
14089
|
var PRESETS = {
|
|
14090
14090
|
password: {
|
|
@@ -14138,7 +14138,7 @@ var PRESETS = {
|
|
|
14138
14138
|
}
|
|
14139
14139
|
};
|
|
14140
14140
|
|
|
14141
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14141
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
|
|
14142
14142
|
var FIELD_VERSION = 2;
|
|
14143
14143
|
var UNITS = {
|
|
14144
14144
|
"": 1,
|
|
@@ -14587,12 +14587,12 @@ var validateAst = /* @__PURE__ */ __name((input) => {
|
|
|
14587
14587
|
return validateFields(parsed2.output);
|
|
14588
14588
|
}, "validateAst");
|
|
14589
14589
|
|
|
14590
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14590
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
|
|
14591
14591
|
var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
|
|
14592
14592
|
var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
|
|
14593
14593
|
var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
|
|
14594
14594
|
|
|
14595
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14595
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
|
|
14596
14596
|
var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
|
|
14597
14597
|
var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
|
|
14598
14598
|
var linkMatch = /* @__PURE__ */ __name((field3, typed, mail, mentioned2) => {
|
|
@@ -14616,7 +14616,7 @@ var linkMatch = /* @__PURE__ */ __name((field3, typed, mail, mentioned2) => {
|
|
|
14616
14616
|
};
|
|
14617
14617
|
}, "linkMatch");
|
|
14618
14618
|
|
|
14619
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14619
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
|
|
14620
14620
|
var SETTING = "phoneCountries";
|
|
14621
14621
|
var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
|
|
14622
14622
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
|
|
@@ -14647,7 +14647,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
|
|
|
14647
14647
|
return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
|
|
14648
14648
|
}, "valueMatch");
|
|
14649
14649
|
|
|
14650
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14650
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/locator.js
|
|
14651
14651
|
var SCHEME = "msg:";
|
|
14652
14652
|
var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat: chat2, message: message2 }) => SCHEME + [provider, account, chat2, message2].map(encodeURIComponent).join("/"), "formatLocator");
|
|
14653
14653
|
var isLocator = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith(SCHEME), "isLocator");
|
|
@@ -14661,7 +14661,7 @@ var parseLocator = /* @__PURE__ */ __name((reference2) => {
|
|
|
14661
14661
|
return { provider, account, chat: chat2, message: message2 };
|
|
14662
14662
|
}, "parseLocator");
|
|
14663
14663
|
|
|
14664
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14664
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
|
|
14665
14665
|
var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
|
|
14666
14666
|
if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
|
|
14667
14667
|
throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
|
|
@@ -14689,7 +14689,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
|
|
|
14689
14689
|
return 2 * intersection2 / (aa2.size + bb.size);
|
|
14690
14690
|
}, "vocabularySimilarity");
|
|
14691
14691
|
|
|
14692
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14692
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
|
|
14693
14693
|
import { createHash } from "node:crypto";
|
|
14694
14694
|
var folded2 = /* @__PURE__ */ __name((name) => {
|
|
14695
14695
|
try {
|
|
@@ -14755,7 +14755,7 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind3, by, options
|
|
|
14755
14755
|
});
|
|
14756
14756
|
}, "guardTagCreation");
|
|
14757
14757
|
|
|
14758
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14758
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
|
|
14759
14759
|
var invalid2 = /* @__PURE__ */ __name((message2) => {
|
|
14760
14760
|
throw new CliError("validation_error", message2);
|
|
14761
14761
|
}, "invalid");
|
|
@@ -14832,7 +14832,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
|
|
|
14832
14832
|
};
|
|
14833
14833
|
}, "createTagRedirectIndex");
|
|
14834
14834
|
|
|
14835
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14835
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
|
|
14836
14836
|
var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
|
|
14837
14837
|
const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
|
|
14838
14838
|
if (!row2)
|
|
@@ -14860,7 +14860,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
|
|
|
14860
14860
|
return snapshot2;
|
|
14861
14861
|
}, "tagRedirectSnapshot");
|
|
14862
14862
|
|
|
14863
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14863
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
|
|
14864
14864
|
import { createHash as createHash2 } from "node:crypto";
|
|
14865
14865
|
var TASK_KEY_PREFIXES = {
|
|
14866
14866
|
question: "Q",
|
|
@@ -14888,7 +14888,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
|
|
|
14888
14888
|
return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
|
|
14889
14889
|
}, "taskAccountOf");
|
|
14890
14890
|
|
|
14891
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14891
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/references.js
|
|
14892
14892
|
var SIMPLE_REFERENCES = [
|
|
14893
14893
|
"note",
|
|
14894
14894
|
"document",
|
|
@@ -14960,7 +14960,7 @@ var folderPath = /* @__PURE__ */ __name((path) => {
|
|
|
14960
14960
|
}, "folderPath");
|
|
14961
14961
|
var canonicalReference = /* @__PURE__ */ __name((text5) => formatReference(parseReference(text5)), "canonicalReference");
|
|
14962
14962
|
|
|
14963
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14963
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
|
|
14964
14964
|
var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
|
|
14965
14965
|
var REFERABLE = {
|
|
14966
14966
|
note: { tombstone: true },
|
|
@@ -15118,11 +15118,11 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
|
|
|
15118
15118
|
}, "taskIdOf");
|
|
15119
15119
|
var canonicalThingReference = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith("meeting:") ? canonicalMeetingReference(reference2) : canonicalReference(reference2), "canonicalThingReference");
|
|
15120
15120
|
|
|
15121
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15122
|
-
var toMs = /* @__PURE__ */ __name((
|
|
15123
|
-
if (
|
|
15121
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
|
|
15122
|
+
var toMs = /* @__PURE__ */ __name((iso11) => {
|
|
15123
|
+
if (iso11 === null || iso11 === void 0)
|
|
15124
15124
|
return null;
|
|
15125
|
-
const ms = Date.parse(
|
|
15125
|
+
const ms = Date.parse(iso11);
|
|
15126
15126
|
return Number.isNaN(ms) ? null : ms;
|
|
15127
15127
|
}, "toMs");
|
|
15128
15128
|
var toIso = /* @__PURE__ */ __name((ms) => typeof ms === "number" ? new Date(ms).toISOString() : null, "toIso");
|
|
@@ -15132,7 +15132,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
|
|
|
15132
15132
|
var DELIVERY = { delivered: 1, read: 2 };
|
|
15133
15133
|
var deliveryOf = /* @__PURE__ */ __name((stored3) => stored3 === DELIVERY.read ? "read" : stored3 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
|
|
15134
15134
|
|
|
15135
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15135
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
|
|
15136
15136
|
var TAG_KINDS = ["tag", "topic"];
|
|
15137
15137
|
var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
|
|
15138
15138
|
var TAG_TYPE = {
|
|
@@ -15323,7 +15323,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
|
|
|
15323
15323
|
return result;
|
|
15324
15324
|
}, "tagsOf");
|
|
15325
15325
|
|
|
15326
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15326
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
|
|
15327
15327
|
var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
|
|
15328
15328
|
var SPEECH = speech("att");
|
|
15329
15329
|
var mentionText = /* @__PURE__ */ __name((alias2) => `CASE WHEN coalesce(json_extract(${alias2}.contact, '$.phone'), '') <> '' THEN 'phone: ' || json_extract(${alias2}.contact, '$.phone') ELSE ${alias2}.text END`, "mentionText");
|
|
@@ -15678,7 +15678,7 @@ var FIELD_COMPILERS = {
|
|
|
15678
15678
|
subject
|
|
15679
15679
|
};
|
|
15680
15680
|
|
|
15681
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15681
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
|
|
15682
15682
|
var placeOf = /* @__PURE__ */ __name((database) => {
|
|
15683
15683
|
const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
|
|
15684
15684
|
const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
|
|
@@ -15694,7 +15694,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
|
|
|
15694
15694
|
};
|
|
15695
15695
|
}, "placeOf");
|
|
15696
15696
|
|
|
15697
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15697
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
|
|
15698
15698
|
var DRAIN_ON_WRITE = 500;
|
|
15699
15699
|
var METHOD = "rules";
|
|
15700
15700
|
var telegramLink = /* @__PURE__ */ __name((database) => {
|
|
@@ -15857,7 +15857,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
|
|
|
15857
15857
|
return queued.length;
|
|
15858
15858
|
}, "drainMentions");
|
|
15859
15859
|
|
|
15860
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15860
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
|
|
15861
15861
|
var indexRow = /* @__PURE__ */ __name((database, name) => {
|
|
15862
15862
|
const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
|
|
15863
15863
|
if (!exists2)
|
|
@@ -15865,7 +15865,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
|
|
|
15865
15865
|
return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
|
|
15866
15866
|
}, "indexRow");
|
|
15867
15867
|
|
|
15868
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15868
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
|
|
15869
15869
|
var INDEX = "message_stems";
|
|
15870
15870
|
var SETTING2 = "searchStemmers";
|
|
15871
15871
|
var DRAIN_ON_WRITE2 = 500;
|
|
@@ -15968,14 +15968,14 @@ var stemWriter = /* @__PURE__ */ __name((database, stemmer) => {
|
|
|
15968
15968
|
};
|
|
15969
15969
|
}, "stemWriter");
|
|
15970
15970
|
var nextQueued = /* @__PURE__ */ __name((database, limit) => database.prepare("SELECT id AS pk FROM message_stems_pending ORDER BY id LIMIT ?").all(limit).map((row2) => Number(row2.pk)), "nextQueued");
|
|
15971
|
-
var drainStems = /* @__PURE__ */ __name((database,
|
|
15971
|
+
var drainStems = /* @__PURE__ */ __name((database, stemmerFor2, limit = DRAIN_ON_WRITE2) => {
|
|
15972
15972
|
const pks = nextQueued(database, limit);
|
|
15973
15973
|
if (pks.length === 0)
|
|
15974
15974
|
return 0;
|
|
15975
15975
|
const stemmers = storeStemmers(database);
|
|
15976
15976
|
if (!stemmers)
|
|
15977
15977
|
return 0;
|
|
15978
|
-
const stemmer =
|
|
15978
|
+
const stemmer = stemmerFor2(stemmers);
|
|
15979
15979
|
return claim(database, stemmer.identity) ? stemWriter(database, stemmer).queued(pks) : 0;
|
|
15980
15980
|
}, "drainStems");
|
|
15981
15981
|
var stemmerCache = /* @__PURE__ */ __name(() => {
|
|
@@ -15987,7 +15987,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
|
|
|
15987
15987
|
};
|
|
15988
15988
|
}, "stemmerCache");
|
|
15989
15989
|
|
|
15990
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15990
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
|
|
15991
15991
|
var SQLITE_BUSY = 5;
|
|
15992
15992
|
var pause = new Int32Array(new SharedArrayBuffer(4));
|
|
15993
15993
|
var isBusy = /* @__PURE__ */ __name((error) => {
|
|
@@ -16024,7 +16024,14 @@ var connectionOf = /* @__PURE__ */ __name((database) => {
|
|
|
16024
16024
|
return connection;
|
|
16025
16025
|
}, "connectionOf");
|
|
16026
16026
|
var write = /* @__PURE__ */ __name((database, body2, { beforeCommit } = {}) => transact(database, body2, true, beforeCommit), "write");
|
|
16027
|
-
var writeBatch = /* @__PURE__ */ __name((database, body2) =>
|
|
16027
|
+
var writeBatch = /* @__PURE__ */ __name((database, body2) => {
|
|
16028
|
+
const outer = connectionOf(database).depth === 0;
|
|
16029
|
+
const result = transact(database, body2, false);
|
|
16030
|
+
if (outer)
|
|
16031
|
+
Atomics.wait(pause, 0, 0, BATCH_PAUSE_MS);
|
|
16032
|
+
return result;
|
|
16033
|
+
}, "writeBatch");
|
|
16034
|
+
var BATCH_PAUSE_MS = 2;
|
|
16028
16035
|
var transact = /* @__PURE__ */ __name((database, body2, drain, beforeCommit) => {
|
|
16029
16036
|
const connection = connectionOf(database);
|
|
16030
16037
|
if (connection.reading)
|
|
@@ -16075,7 +16082,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
|
|
|
16075
16082
|
}
|
|
16076
16083
|
}, "read");
|
|
16077
16084
|
|
|
16078
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16085
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
|
|
16079
16086
|
var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
|
|
16080
16087
|
coalesce(CASE k.chunkable_type
|
|
16081
16088
|
WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
|
|
@@ -16217,7 +16224,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
|
|
|
16217
16224
|
}, "dropUnusedVectors");
|
|
16218
16225
|
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");
|
|
16219
16226
|
|
|
16220
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16227
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
|
|
16221
16228
|
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({
|
|
16222
16229
|
target: [accounts.provider, accounts.externalId],
|
|
16223
16230
|
set: {
|
|
@@ -16323,7 +16330,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
|
|
|
16323
16330
|
AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
|
|
16324
16331
|
}, "dropOrphanPeople");
|
|
16325
16332
|
|
|
16326
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16333
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
|
|
16327
16334
|
var FOLDED = [
|
|
16328
16335
|
{ table: "tasks", column: "title" },
|
|
16329
16336
|
{ table: "tasks", column: "close_reason" },
|
|
@@ -16360,7 +16367,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
|
16360
16367
|
return filled2;
|
|
16361
16368
|
}, "fillFolded");
|
|
16362
16369
|
|
|
16363
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16370
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
|
|
16364
16371
|
import { createHash as createHash3 } from "node:crypto";
|
|
16365
16372
|
var CHUNK_CHARS = 1200;
|
|
16366
16373
|
var CHUNK_OVERLAP = 150;
|
|
@@ -16465,7 +16472,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
|
|
|
16465
16472
|
return chunks2;
|
|
16466
16473
|
}, "cutChunks");
|
|
16467
16474
|
|
|
16468
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16475
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/search/task-signature.js
|
|
16469
16476
|
var DAY = 864e5;
|
|
16470
16477
|
var CURRENCY = [
|
|
16471
16478
|
[/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
|
|
@@ -16582,7 +16589,7 @@ var dueDayOf = /* @__PURE__ */ __name((text5, createdMs) => {
|
|
|
16582
16589
|
return best?.day ?? null;
|
|
16583
16590
|
}, "dueDayOf");
|
|
16584
16591
|
|
|
16585
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16592
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
|
|
16586
16593
|
var DAY2 = 864e5;
|
|
16587
16594
|
var STOP_WORDS = new Set([
|
|
16588
16595
|
// Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
|
|
@@ -16737,7 +16744,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
|
|
|
16737
16744
|
...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
|
|
16738
16745
|
})).sort((a, b) => b.score - a.score), "rankCandidates");
|
|
16739
16746
|
|
|
16740
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16747
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
|
|
16741
16748
|
var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
|
|
16742
16749
|
r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
|
|
16743
16750
|
JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
|
|
@@ -17008,7 +17015,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
|
|
|
17008
17015
|
};
|
|
17009
17016
|
}, "readiness");
|
|
17010
17017
|
|
|
17011
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17018
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
|
|
17012
17019
|
var DOCUMENT_PICTURE = "document_picture";
|
|
17013
17020
|
var SCAN_PAGE2 = 5e3;
|
|
17014
17021
|
var idOf = /* @__PURE__ */ __name((ref3) => {
|
|
@@ -17071,7 +17078,7 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
17071
17078
|
}, "nearestPictures")
|
|
17072
17079
|
}), "documentPicturesOver");
|
|
17073
17080
|
|
|
17074
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17081
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
|
|
17075
17082
|
var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
|
|
17076
17083
|
const literal4 = escaped2 ?? plain2 ?? "";
|
|
17077
17084
|
return wildcard ?? (/[*?[]/u.test(literal4) ? `[${literal4}]` : literal4);
|
|
@@ -17136,7 +17143,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
|
|
|
17136
17143
|
var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
|
|
17137
17144
|
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");
|
|
17138
17145
|
|
|
17139
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17146
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
|
|
17140
17147
|
var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
|
|
17141
17148
|
var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
|
|
17142
17149
|
var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
|
|
@@ -17226,7 +17233,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
|
|
|
17226
17233
|
});
|
|
17227
17234
|
}, "linkMeeting");
|
|
17228
17235
|
|
|
17229
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17236
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
|
|
17230
17237
|
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), ''))";
|
|
17231
17238
|
var UNSEARCHED_EVENT_TYPES = [
|
|
17232
17239
|
"working-location",
|
|
@@ -17410,7 +17417,7 @@ var writer2 = /* @__PURE__ */ __name((database, corpus, stemmer) => {
|
|
|
17410
17417
|
statements.dequeue.run(queuedAs(corpus), id2);
|
|
17411
17418
|
};
|
|
17412
17419
|
}, "writer");
|
|
17413
|
-
var drainCorpus = /* @__PURE__ */ __name((database, corpus,
|
|
17420
|
+
var drainCorpus = /* @__PURE__ */ __name((database, corpus, stemmerFor2, { batch = 200, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
|
|
17414
17421
|
if (corpus.type === "email" || corpus.type === "document")
|
|
17415
17422
|
database.prepare(`UPDATE chunks SET account_id = (SELECT account_id FROM ${corpus.table} WHERE id = chunks.chunkable_id)
|
|
17416
17423
|
WHERE chunkable_type = ? AND account_id IS NULL`).run(corpus.type);
|
|
@@ -17418,7 +17425,7 @@ var drainCorpus = /* @__PURE__ */ __name((database, corpus, stemmerFor, { batch
|
|
|
17418
17425
|
const state = corpusIndexState(database, corpus);
|
|
17419
17426
|
if (state.wanted === null)
|
|
17420
17427
|
return 0;
|
|
17421
|
-
const stemmer =
|
|
17428
|
+
const stemmer = stemmerFor2(savedStemmers(database) ?? DEFAULT_STEMMERS);
|
|
17422
17429
|
const queue = `${corpus.type}_index_pending`;
|
|
17423
17430
|
if (state.built !== stemmer.identity) {
|
|
17424
17431
|
write(database, () => {
|
|
@@ -17447,7 +17454,7 @@ var drainCorpus = /* @__PURE__ */ __name((database, corpus, stemmerFor, { batch
|
|
|
17447
17454
|
}
|
|
17448
17455
|
return done;
|
|
17449
17456
|
}, "drainCorpus");
|
|
17450
|
-
var drainNoteIndex = /* @__PURE__ */ __name((database,
|
|
17457
|
+
var drainNoteIndex = /* @__PURE__ */ __name((database, stemmerFor2, options = {}) => drainCorpus(database, CORPORA.document, stemmerFor2, options) + drainCorpus(database, CORPORA.note, stemmerFor2, options) + fillTrigrams(database, options), "drainNoteIndex");
|
|
17451
17458
|
var resetNoteIndex = /* @__PURE__ */ __name((database) => {
|
|
17452
17459
|
write(database, () => {
|
|
17453
17460
|
for (const corpus of Object.values(CORPORA))
|
|
@@ -17456,7 +17463,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
|
|
|
17456
17463
|
return true;
|
|
17457
17464
|
}, "resetNoteIndex");
|
|
17458
17465
|
|
|
17459
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17466
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
|
|
17460
17467
|
var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
|
|
17461
17468
|
var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
|
|
17462
17469
|
for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
|
|
@@ -17475,7 +17482,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
|
|
|
17475
17482
|
}
|
|
17476
17483
|
}, "resolvePersonLinks");
|
|
17477
17484
|
|
|
17478
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17485
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
|
|
17479
17486
|
var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
|
|
17480
17487
|
var prepare = /* @__PURE__ */ __name((orm) => ({
|
|
17481
17488
|
find: orm.select({
|
|
@@ -17700,7 +17707,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
|
|
|
17700
17707
|
}, "meetingIdentityPk");
|
|
17701
17708
|
var phoneOf = /* @__PURE__ */ __name(({ orm }, provider, nativeId) => orm.select({ phone: identities.phone }).from(identities).where(and(eq(identities.provider, provider), eq(identities.externalId, nativeId))).get()?.phone ?? null, "phoneOf");
|
|
17702
17709
|
|
|
17703
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17710
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
|
|
17704
17711
|
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");
|
|
17705
17712
|
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");
|
|
17706
17713
|
var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
|
|
@@ -17980,7 +17987,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
|
|
|
17980
17987
|
}
|
|
17981
17988
|
}, "replaceAutoTags");
|
|
17982
17989
|
|
|
17983
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17990
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/counters.js
|
|
17984
17991
|
var COUNTER_FIELDS = ["views", "reactions", "comments"];
|
|
17985
17992
|
var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
|
|
17986
17993
|
var counterValue = /* @__PURE__ */ __name((message2, field3) => {
|
|
@@ -18017,7 +18024,7 @@ var counterFreshness = /* @__PURE__ */ __name((states) => {
|
|
|
18017
18024
|
return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
|
|
18018
18025
|
}, "counterFreshness");
|
|
18019
18026
|
|
|
18020
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18027
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
|
|
18021
18028
|
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");
|
|
18022
18029
|
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;
|
|
18023
18030
|
var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
|
|
@@ -18098,7 +18105,7 @@ var mailCore = /* @__PURE__ */ __name((body2, earlier) => {
|
|
|
18098
18105
|
return withoutSignOff(withoutGreeting(kept)).join("\n").trim();
|
|
18099
18106
|
}, "mailCore");
|
|
18100
18107
|
|
|
18101
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18108
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
|
|
18102
18109
|
var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
|
|
18103
18110
|
var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
|
|
18104
18111
|
k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
|
|
@@ -18165,7 +18172,7 @@ var chunkAttachments = /* @__PURE__ */ __name((database, accountId, emailId, now
|
|
|
18165
18172
|
}, "chunkAttachments");
|
|
18166
18173
|
var MAIL_CUT = "mail_pieces_cut";
|
|
18167
18174
|
var CUT = "email";
|
|
18168
|
-
var drainEmailIndex = /* @__PURE__ */ __name((database,
|
|
18175
|
+
var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
|
|
18169
18176
|
if (database.prepare("SELECT value FROM store_settings WHERE key = ?").get(MAIL_CUT)?.value !== CUT)
|
|
18170
18177
|
write(database, () => {
|
|
18171
18178
|
const single = database.prepare("SELECT DISTINCT content_hash AS hash FROM chunks WHERE chunkable_type = 'email'").all().map(({ hash: hash2 }) => String(hash2));
|
|
@@ -18188,7 +18195,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor) => {
|
|
|
18188
18195
|
dropUnusedVectors(database, before2);
|
|
18189
18196
|
}
|
|
18190
18197
|
});
|
|
18191
|
-
const emails3 = drainCorpus(database, CORPORA.email,
|
|
18198
|
+
const emails3 = drainCorpus(database, CORPORA.email, stemmerFor2);
|
|
18192
18199
|
const next = database.prepare("SELECT id FROM email_index_pending WHERE indexable_type = 'email_thread' ORDER BY id LIMIT 50");
|
|
18193
18200
|
const done = database.prepare("DELETE FROM email_index_pending WHERE indexable_type = 'email_thread' AND id = ?");
|
|
18194
18201
|
let threads = 0;
|
|
@@ -18208,7 +18215,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor) => {
|
|
|
18208
18215
|
return emails3 + threads;
|
|
18209
18216
|
}, "drainEmailIndex");
|
|
18210
18217
|
|
|
18211
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18218
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
|
|
18212
18219
|
var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
|
|
18213
18220
|
SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
|
|
18214
18221
|
var folderEmails = /* @__PURE__ */ __name((database, accountId, folder, uidvalidity) => database.prepare(`SELECT l.uid, e.external_id, coalesce(e.received_at, e.sent_at) AS at, e.read, e.flagged,
|
|
@@ -18254,7 +18261,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
|
|
|
18254
18261
|
leave.run(emailId, Number(box.id), emailId, Number(box.id));
|
|
18255
18262
|
}, "forgetLocations");
|
|
18256
18263
|
|
|
18257
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18264
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
|
|
18258
18265
|
var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
|
|
18259
18266
|
emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
|
|
18260
18267
|
last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
|
|
@@ -18304,7 +18311,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
|
|
|
18304
18311
|
return threads.length;
|
|
18305
18312
|
}, "markEmailsRestored");
|
|
18306
18313
|
|
|
18307
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18314
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
|
|
18308
18315
|
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");
|
|
18309
18316
|
var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
|
|
18310
18317
|
var ruleOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -18371,7 +18378,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
|
|
|
18371
18378
|
}
|
|
18372
18379
|
}), "mailRulesOver");
|
|
18373
18380
|
|
|
18374
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18381
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
|
|
18375
18382
|
var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
|
|
18376
18383
|
database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
|
|
18377
18384
|
VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
|
|
@@ -18379,7 +18386,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
|
|
|
18379
18386
|
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);
|
|
18380
18387
|
}, "reviewLink");
|
|
18381
18388
|
|
|
18382
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18389
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
|
|
18383
18390
|
function checkMeetingCancelled(signal) {
|
|
18384
18391
|
if (!signal?.aborted)
|
|
18385
18392
|
return;
|
|
@@ -18390,7 +18397,7 @@ function checkMeetingCancelled(signal) {
|
|
|
18390
18397
|
}
|
|
18391
18398
|
__name(checkMeetingCancelled, "checkMeetingCancelled");
|
|
18392
18399
|
|
|
18393
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18400
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
|
|
18394
18401
|
var meetingOf = /* @__PURE__ */ __name((row2) => ({
|
|
18395
18402
|
id: Number(row2.id),
|
|
18396
18403
|
accountId: Number(row2.account_id),
|
|
@@ -18440,7 +18447,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
|
|
|
18440
18447
|
createdAt: Number(row2.created_at)
|
|
18441
18448
|
}), "transcriptRowOf");
|
|
18442
18449
|
|
|
18443
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18450
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
|
|
18444
18451
|
var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
|
|
18445
18452
|
var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
|
|
18446
18453
|
var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
|
|
@@ -18607,7 +18614,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
18607
18614
|
}
|
|
18608
18615
|
}), "meetingReadsOver");
|
|
18609
18616
|
|
|
18610
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18617
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
|
|
18611
18618
|
var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
|
|
18612
18619
|
const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
|
|
18613
18620
|
const params = [input.accountId];
|
|
@@ -18650,7 +18657,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
|
|
|
18650
18657
|
return { clauses, params };
|
|
18651
18658
|
}, "meetingSelectionSql");
|
|
18652
18659
|
|
|
18653
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18660
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
|
|
18654
18661
|
var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
18655
18662
|
async meetingChatLines(input) {
|
|
18656
18663
|
checkMeetingCancelled(input.signal);
|
|
@@ -18678,7 +18685,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
18678
18685
|
}
|
|
18679
18686
|
}), "meetingChatLinesOver");
|
|
18680
18687
|
|
|
18681
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18688
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
|
|
18682
18689
|
var MESSAGE_FIELDS = {
|
|
18683
18690
|
pk: messages.id,
|
|
18684
18691
|
nativeId: messages.externalId,
|
|
@@ -18845,7 +18852,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
|
|
|
18845
18852
|
storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
|
|
18846
18853
|
}), "chatActivity");
|
|
18847
18854
|
|
|
18848
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18855
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
|
|
18849
18856
|
var HIT_FIELDS = {
|
|
18850
18857
|
...MESSAGE_FIELDS,
|
|
18851
18858
|
chatTitle: sql`${chats.title}`.as("chat_title"),
|
|
@@ -18944,7 +18951,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
|
|
|
18944
18951
|
};
|
|
18945
18952
|
}, "directReplies");
|
|
18946
18953
|
|
|
18947
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18954
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
|
|
18948
18955
|
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");
|
|
18949
18956
|
var required = /* @__PURE__ */ __name((context, ref3) => {
|
|
18950
18957
|
const found2 = identityRow(context, ref3);
|
|
@@ -19075,7 +19082,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
|
|
|
19075
19082
|
}, "mentioning");
|
|
19076
19083
|
var escaped = /* @__PURE__ */ __name((text5) => text5.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
|
|
19077
19084
|
|
|
19078
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19085
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
|
|
19079
19086
|
var missing2 = /* @__PURE__ */ __name(() => {
|
|
19080
19087
|
throw new CliError("not_found", "Meeting, participant or selected target not found");
|
|
19081
19088
|
}, "missing");
|
|
@@ -19197,7 +19204,7 @@ function meetingContextLinksOver(context) {
|
|
|
19197
19204
|
}
|
|
19198
19205
|
__name(meetingContextLinksOver, "meetingContextLinksOver");
|
|
19199
19206
|
|
|
19200
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19207
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
|
|
19201
19208
|
var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
|
|
19202
19209
|
var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
|
|
19203
19210
|
var summaryOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -19226,7 +19233,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
19226
19233
|
return row2 ? summaryText(summaryOf(row2)) : null;
|
|
19227
19234
|
}, "indexedText");
|
|
19228
19235
|
|
|
19229
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19236
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
|
|
19230
19237
|
var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
|
|
19231
19238
|
var meetingCurrentIndexRows = `
|
|
19232
19239
|
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
|
|
@@ -19257,7 +19264,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
19257
19264
|
}, "invalidateMeetingStems");
|
|
19258
19265
|
var meetingStemmableText = /* @__PURE__ */ __name((text5) => text5.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
|
|
19259
19266
|
|
|
19260
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19267
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
|
|
19261
19268
|
function meetingHitIndexOver({ database, now: now2 }) {
|
|
19262
19269
|
return {
|
|
19263
19270
|
async indexSearch(original) {
|
|
@@ -19325,10 +19332,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
|
|
|
19325
19332
|
}
|
|
19326
19333
|
__name(meetingHitIndexOver, "meetingHitIndexOver");
|
|
19327
19334
|
|
|
19328
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19335
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
|
|
19329
19336
|
import { createHash as createHash4 } from "node:crypto";
|
|
19330
19337
|
|
|
19331
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19338
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/search/trigrams.js
|
|
19332
19339
|
var trigrams = /* @__PURE__ */ __name((term) => {
|
|
19333
19340
|
const padded = ` ${term} `;
|
|
19334
19341
|
const pieces = /* @__PURE__ */ new Set();
|
|
@@ -19337,7 +19344,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
|
|
|
19337
19344
|
return [...pieces];
|
|
19338
19345
|
}, "trigrams");
|
|
19339
19346
|
|
|
19340
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19347
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/search/correct.js
|
|
19341
19348
|
var SHORTEST_CORRECTION = 3;
|
|
19342
19349
|
var maxEdits = /* @__PURE__ */ __name((word) => word.length <= 4 ? 1 : 2, "maxEdits");
|
|
19343
19350
|
var editDistance = /* @__PURE__ */ __name((a, b, max) => {
|
|
@@ -19384,7 +19391,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
|
|
|
19384
19391
|
return corrections;
|
|
19385
19392
|
}, "correctWords");
|
|
19386
19393
|
|
|
19387
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19394
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/search/garbled.js
|
|
19388
19395
|
var SHORTEST_GARBLED = 4;
|
|
19389
19396
|
var MOST_WIDENED = 64;
|
|
19390
19397
|
var plain = /* @__PURE__ */ __name((word) => word.replaceAll("\u044D", "\u0435"), "plain");
|
|
@@ -19476,7 +19483,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
|
|
|
19476
19483
|
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));
|
|
19477
19484
|
}, "widenWords");
|
|
19478
19485
|
|
|
19479
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19486
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
|
|
19480
19487
|
import { readFileSync } from "node:fs";
|
|
19481
19488
|
var loaded;
|
|
19482
19489
|
var dictionary = /* @__PURE__ */ __name(() => {
|
|
@@ -19535,7 +19542,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word) => {
|
|
|
19535
19542
|
return false;
|
|
19536
19543
|
}, "knownRussianWord");
|
|
19537
19544
|
|
|
19538
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19545
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
|
|
19539
19546
|
var WORD3 = /[\p{L}\p{N}\p{M}]+/gu;
|
|
19540
19547
|
var MOST_WORDS = 128;
|
|
19541
19548
|
var quote = /* @__PURE__ */ __name((word) => `"${word.replaceAll('"', '""')}"`, "quote");
|
|
@@ -19762,7 +19769,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text5, stemmer) => {
|
|
|
19762
19769
|
return check3(tree);
|
|
19763
19770
|
}, "matchMeetingText");
|
|
19764
19771
|
|
|
19765
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19772
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
|
|
19766
19773
|
var fail3 = /* @__PURE__ */ __name((message2) => {
|
|
19767
19774
|
throw new CliError("validation_error", message2);
|
|
19768
19775
|
}, "fail");
|
|
@@ -19939,7 +19946,7 @@ function meetingHitSearchOver({ database }) {
|
|
|
19939
19946
|
}
|
|
19940
19947
|
__name(meetingHitSearchOver, "meetingHitSearchOver");
|
|
19941
19948
|
|
|
19942
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19949
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
|
|
19943
19950
|
import { createHash as createHash5 } from "node:crypto";
|
|
19944
19951
|
var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
|
|
19945
19952
|
if (value === void 0)
|
|
@@ -20029,7 +20036,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
|
|
|
20029
20036
|
}
|
|
20030
20037
|
}), "meetingParticipantSearchOver");
|
|
20031
20038
|
|
|
20032
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20039
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
|
|
20033
20040
|
var preparationQueries = {
|
|
20034
20041
|
participants: {
|
|
20035
20042
|
fields: "p.id, p.identity_id, p.display_name, l.person_id",
|
|
@@ -20079,7 +20086,7 @@ var preparationQueries = {
|
|
|
20079
20086
|
}
|
|
20080
20087
|
};
|
|
20081
20088
|
|
|
20082
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20089
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
|
|
20083
20090
|
var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20084
20091
|
async preparationContext(original) {
|
|
20085
20092
|
const input = validateMeetingPreparationContext(original);
|
|
@@ -20120,7 +20127,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20120
20127
|
}
|
|
20121
20128
|
}), "meetingPreparationContextOver");
|
|
20122
20129
|
|
|
20123
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20130
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
|
|
20124
20131
|
var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
|
|
20125
20132
|
SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
|
|
20126
20133
|
WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
|
|
@@ -20134,7 +20141,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
|
|
|
20134
20141
|
JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
|
|
20135
20142
|
)`, "preparationSubjects");
|
|
20136
20143
|
|
|
20137
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20144
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
|
|
20138
20145
|
var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20139
20146
|
async preparationKnowledge(original) {
|
|
20140
20147
|
const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
|
|
@@ -20179,7 +20186,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
|
|
|
20179
20186
|
}
|
|
20180
20187
|
}), "meetingPreparationKnowledgeOver");
|
|
20181
20188
|
|
|
20182
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20189
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
|
|
20183
20190
|
var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20184
20191
|
async preparationNotes(original) {
|
|
20185
20192
|
const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
|
|
@@ -20232,7 +20239,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20232
20239
|
}
|
|
20233
20240
|
}), "meetingPreparationNotesOver");
|
|
20234
20241
|
|
|
20235
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20242
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
|
|
20236
20243
|
var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20237
20244
|
async relatedHistory(original) {
|
|
20238
20245
|
const input = validateMeetingRelatedHistory(original);
|
|
@@ -20303,7 +20310,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20303
20310
|
}
|
|
20304
20311
|
}), "meetingRelatedHistoryOver");
|
|
20305
20312
|
|
|
20306
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20313
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
|
|
20307
20314
|
var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
|
|
20308
20315
|
var text2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
|
|
20309
20316
|
var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
@@ -20384,7 +20391,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20384
20391
|
}
|
|
20385
20392
|
}), "meetingReviewOver");
|
|
20386
20393
|
|
|
20387
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20394
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
|
|
20388
20395
|
var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
|
|
20389
20396
|
var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
|
|
20390
20397
|
if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
|
|
@@ -20438,7 +20445,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20438
20445
|
}
|
|
20439
20446
|
}), "meetingSeriesHistoryOver");
|
|
20440
20447
|
|
|
20441
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20448
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
|
|
20442
20449
|
var MOST_ROWS = 5e5;
|
|
20443
20450
|
var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20444
20451
|
async meetingStats(input) {
|
|
@@ -20485,7 +20492,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20485
20492
|
}
|
|
20486
20493
|
}), "meetingStatsOver");
|
|
20487
20494
|
|
|
20488
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20495
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
|
|
20489
20496
|
var CURSOR_KEY = "meetings";
|
|
20490
20497
|
var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
|
|
20491
20498
|
id: Number(row2.id),
|
|
@@ -21037,7 +21044,33 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
21037
21044
|
};
|
|
21038
21045
|
}, "meetingStoreOver");
|
|
21039
21046
|
|
|
21040
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21047
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
|
|
21048
|
+
var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
|
|
21049
|
+
const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
|
|
21050
|
+
return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
|
|
21051
|
+
}, "syncStateOf");
|
|
21052
|
+
var writeState = /* @__PURE__ */ __name(({ orm, now: now2 }, accountKey, name, value) => {
|
|
21053
|
+
orm.insert(syncCursors).values({ accountId: accountKey, key: name, value, createdAt: now2(), updatedAt: now2() }).onConflictDoUpdate({
|
|
21054
|
+
target: [syncCursors.accountId, syncCursors.key],
|
|
21055
|
+
set: { value: sql`excluded.value`, updatedAt: sql`excluded.updated_at` }
|
|
21056
|
+
}).run();
|
|
21057
|
+
}, "writeState");
|
|
21058
|
+
var clearState = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
|
|
21059
|
+
orm.delete(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).run();
|
|
21060
|
+
}, "clearState");
|
|
21061
|
+
var claim2 = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, anchor, holder, forMs) => {
|
|
21062
|
+
const at = now2();
|
|
21063
|
+
return orm.insert(fetchLeases).values({ chatId: chatKey, anchor, holder, expiresAt: at + forMs }).onConflictDoUpdate({
|
|
21064
|
+
target: [fetchLeases.chatId, fetchLeases.anchor],
|
|
21065
|
+
set: { holder: sql`excluded.holder`, expiresAt: sql`excluded.expires_at` },
|
|
21066
|
+
setWhere: or(eq(fetchLeases.holder, sql`excluded.holder`), lte(fetchLeases.expiresAt, at))
|
|
21067
|
+
}).returning({ chatId: fetchLeases.chatId }).all().length > 0;
|
|
21068
|
+
}, "claim");
|
|
21069
|
+
var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
|
|
21070
|
+
orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
|
|
21071
|
+
}, "release");
|
|
21072
|
+
|
|
21073
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
|
|
21041
21074
|
var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
|
|
21042
21075
|
id: `email:${place.emailId}`,
|
|
21043
21076
|
chatId: place.threadExternalId,
|
|
@@ -21370,12 +21403,21 @@ var emailHitsByPk = /* @__PURE__ */ __name((database, pks) => {
|
|
|
21370
21403
|
];
|
|
21371
21404
|
});
|
|
21372
21405
|
}, "emailHitsByPk");
|
|
21373
|
-
var mailStoreOver = /* @__PURE__ */ __name(({ database, orm },
|
|
21406
|
+
var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemmerFor2 = stemmerCache()) => ({
|
|
21374
21407
|
rules: mailRulesOver(database),
|
|
21375
21408
|
async saveThread(input) {
|
|
21376
21409
|
const id2 = write(database, () => saveThread(database, orm, input));
|
|
21377
21410
|
return threadDetails(database, id2);
|
|
21378
21411
|
},
|
|
21412
|
+
async saveThreads(inputs, states = []) {
|
|
21413
|
+
const ids = write(database, () => {
|
|
21414
|
+
const saved = inputs.map((input) => saveThread(database, orm, input));
|
|
21415
|
+
for (const { accountId, name, value } of states)
|
|
21416
|
+
writeState({ orm, now: now2 }, accountId, name, value);
|
|
21417
|
+
return saved;
|
|
21418
|
+
});
|
|
21419
|
+
return ids.map((id2) => threadDetails(database, id2));
|
|
21420
|
+
},
|
|
21379
21421
|
async threads(filter = {}) {
|
|
21380
21422
|
const [limit, offset] = page(filter);
|
|
21381
21423
|
return database.prepare(`SELECT * FROM email_threads WHERE (? IS NULL OR account_id = ?) AND (? OR deleted_at IS NULL)
|
|
@@ -21434,7 +21476,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stem
|
|
|
21434
21476
|
dmarc: str(row2.dmarc)
|
|
21435
21477
|
}));
|
|
21436
21478
|
},
|
|
21437
|
-
async setSenderScores(accountId, scores,
|
|
21479
|
+
async setSenderScores(accountId, scores, now3) {
|
|
21438
21480
|
return write(database, () => {
|
|
21439
21481
|
const link3 = database.prepare(`INSERT INTO account_identities
|
|
21440
21482
|
(account_id, identity_id, created_at, updated_at, mail_score, mail_signals, mail_scored_at, mail_demoted)
|
|
@@ -21443,7 +21485,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stem
|
|
|
21443
21485
|
mail_signals = excluded.mail_signals, mail_scored_at = excluded.mail_scored_at,
|
|
21444
21486
|
mail_demoted = excluded.mail_demoted`);
|
|
21445
21487
|
for (const { address, score, signals, demoted } of scores)
|
|
21446
|
-
link3.run(accountId, identityOf2(database, { address, name: null },
|
|
21488
|
+
link3.run(accountId, identityOf2(database, { address, name: null }, now3), now3, now3, score, JSON.stringify(signals), now3, demoted ? 1 : null);
|
|
21447
21489
|
return scores.length;
|
|
21448
21490
|
});
|
|
21449
21491
|
},
|
|
@@ -21456,9 +21498,9 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stem
|
|
|
21456
21498
|
kind: str(b.kind)
|
|
21457
21499
|
}));
|
|
21458
21500
|
},
|
|
21459
|
-
async setMailboxes(accountId, scanned, found2,
|
|
21501
|
+
async setMailboxes(accountId, scanned, found2, now3) {
|
|
21460
21502
|
return write(database, () => {
|
|
21461
|
-
const boxes = new Map(scanned.map((box) => [box.externalId, mailboxPk(database, accountId, box,
|
|
21503
|
+
const boxes = new Map(scanned.map((box) => [box.externalId, mailboxPk(database, accountId, box, now3)]));
|
|
21462
21504
|
const lookup = database.prepare("SELECT id FROM emails WHERE account_id = ? AND external_id = ?");
|
|
21463
21505
|
const leave = database.prepare(`DELETE FROM email_mailboxes WHERE email_id = ? AND mailbox_id IN (SELECT value FROM json_each(?))
|
|
21464
21506
|
AND mailbox_id NOT IN (SELECT value FROM json_each(?))`);
|
|
@@ -21475,24 +21517,24 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stem
|
|
|
21475
21517
|
});
|
|
21476
21518
|
leave.run(Number(row2.id), JSON.stringify([...boxes.values()]), JSON.stringify(kept));
|
|
21477
21519
|
for (const pk of kept)
|
|
21478
|
-
join(database, Number(row2.id), pk,
|
|
21520
|
+
join(database, Number(row2.id), pk, now3);
|
|
21479
21521
|
count++;
|
|
21480
21522
|
}
|
|
21481
21523
|
return count;
|
|
21482
21524
|
});
|
|
21483
21525
|
},
|
|
21484
|
-
async setFlags(accountId, flags,
|
|
21526
|
+
async setFlags(accountId, flags, now3) {
|
|
21485
21527
|
return write(database, () => {
|
|
21486
|
-
return setEmailFlags(database, accountId, flags,
|
|
21528
|
+
return setEmailFlags(database, accountId, flags, now3);
|
|
21487
21529
|
});
|
|
21488
21530
|
},
|
|
21489
21531
|
folderEmails: /* @__PURE__ */ __name(async (accountId, folder, uidvalidity) => folderEmails(database, accountId, folder, uidvalidity), "folderEmails"),
|
|
21490
21532
|
setLocations: /* @__PURE__ */ __name(async (accountId, folder, uidvalidity, found2) => write(database, () => setLocations(database, accountId, folder, uidvalidity, found2)), "setLocations"),
|
|
21491
21533
|
forgetLocations: /* @__PURE__ */ __name(async (accountId, folder, uidvalidity, uids) => write(database, () => forgetLocations(database, accountId, folder, uidvalidity, uids)), "forgetLocations"),
|
|
21492
|
-
markDeleted: /* @__PURE__ */ __name(async (accountId, externalIds,
|
|
21493
|
-
markRestored: /* @__PURE__ */ __name(async (accountId, externalIds,
|
|
21534
|
+
markDeleted: /* @__PURE__ */ __name(async (accountId, externalIds, now3) => write(database, () => markEmailsDeleted(database, accountId, externalIds, now3)), "markDeleted"),
|
|
21535
|
+
markRestored: /* @__PURE__ */ __name(async (accountId, externalIds, now3) => write(database, () => markEmailsRestored(database, accountId, externalIds, now3)), "markRestored"),
|
|
21494
21536
|
async chunksToEmbed(model, { after: after2, limit }) {
|
|
21495
|
-
drainEmailIndex(database,
|
|
21537
|
+
drainEmailIndex(database, stemmerFor2);
|
|
21496
21538
|
const file = database.prepare("SELECT text FROM attachments WHERE id = ?");
|
|
21497
21539
|
const threads = /* @__PURE__ */ new Map();
|
|
21498
21540
|
return database.prepare(`SELECT p.content_hash AS hash, min(p.type || ':' || p.owner) AS owner, p.position, p.start_offset AS start,
|
|
@@ -21514,7 +21556,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stem
|
|
|
21514
21556
|
});
|
|
21515
21557
|
},
|
|
21516
21558
|
async nearest(model, query, { accountId, limit, threadExternalId, since }) {
|
|
21517
|
-
drainEmailIndex(database,
|
|
21559
|
+
drainEmailIndex(database, stemmerFor2);
|
|
21518
21560
|
const page3 = database.prepare(`SELECT p.id, p.type, p.owner, p.position, p.email_id AS email, v.vector FROM ${MAIL_PIECES}
|
|
21519
21561
|
JOIN embeddings v ON v.model = ? AND v.content_hash = p.content_hash
|
|
21520
21562
|
WHERE p.id > ? AND p.account_id = ?
|
|
@@ -21577,7 +21619,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stem
|
|
|
21577
21619
|
if (match === null)
|
|
21578
21620
|
return [];
|
|
21579
21621
|
const [limit, offset] = page(filter);
|
|
21580
|
-
drainEmailIndex(database,
|
|
21622
|
+
drainEmailIndex(database, stemmerFor2);
|
|
21581
21623
|
const [where, params] = emailWhere({ ...filter, includeDeleted: false });
|
|
21582
21624
|
return database.prepare(`SELECT e.* FROM email_words w JOIN emails e ON e.id = w.rowid
|
|
21583
21625
|
WHERE email_words MATCH ? AND ${where}
|
|
@@ -21585,7 +21627,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm }, stemmerFor = stem
|
|
|
21585
21627
|
}
|
|
21586
21628
|
}), "mailStoreOver");
|
|
21587
21629
|
|
|
21588
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21630
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/search/dictionary.js
|
|
21589
21631
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
21590
21632
|
var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
|
|
21591
21633
|
var folded4 = /* @__PURE__ */ __name((word) => /^[а-яё'-]*$/.test(word) ? word.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word), "folded");
|
|
@@ -21675,7 +21717,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
|
|
|
21675
21717
|
}, "knownWord");
|
|
21676
21718
|
var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
|
|
21677
21719
|
|
|
21678
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21720
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
|
|
21679
21721
|
var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
|
|
21680
21722
|
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");
|
|
21681
21723
|
var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
|
|
@@ -21761,7 +21803,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
|
|
|
21761
21803
|
return found2;
|
|
21762
21804
|
}, "spokenTranscripts");
|
|
21763
21805
|
|
|
21764
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21806
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
|
|
21765
21807
|
var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
|
|
21766
21808
|
const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
|
|
21767
21809
|
if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
|
|
@@ -21808,7 +21850,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
|
|
|
21808
21850
|
});
|
|
21809
21851
|
}, "placeHits");
|
|
21810
21852
|
|
|
21811
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21853
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
|
|
21812
21854
|
var MESSAGES2 = {
|
|
21813
21855
|
rows: "messages",
|
|
21814
21856
|
threads: "chats",
|
|
@@ -21844,6 +21886,18 @@ var GROUPS = {
|
|
|
21844
21886
|
var matchQuery = /* @__PURE__ */ __name((context, execution) => runQuery(context, execution), "matchQuery");
|
|
21845
21887
|
var countQuery = /* @__PURE__ */ __name((context, execution, by) => runQuery(context, execution, by), "countQuery");
|
|
21846
21888
|
var queryMessagePks = /* @__PURE__ */ __name((context, execution) => runQuery(context, execution, "pks"), "queryMessagePks");
|
|
21889
|
+
var countMatches = /* @__PURE__ */ __name((context, execution, cap) => matchingPks(context, execution, cap)?.length, "countMatches");
|
|
21890
|
+
var matchingPks = /* @__PURE__ */ __name((context, execution, cap) => {
|
|
21891
|
+
const { database, check: check3, where, from: from2, withRanking, ranked, leaves } = compileQuery(context, {
|
|
21892
|
+
...execution,
|
|
21893
|
+
newest: true
|
|
21894
|
+
});
|
|
21895
|
+
if (leaves.some(({ test }) => test))
|
|
21896
|
+
return void 0;
|
|
21897
|
+
const rows = database.prepare(`${withRanking}SELECT m.id ${from2} WHERE ${where.sql} LIMIT ?`).all(...ranked.params, ...where.params, cap + 1);
|
|
21898
|
+
check3();
|
|
21899
|
+
return rows.map(({ id: id2 }) => Number(id2));
|
|
21900
|
+
}, "matchingPks");
|
|
21847
21901
|
var compileQuery = /* @__PURE__ */ __name((context, execution, boundedAttachments = false) => {
|
|
21848
21902
|
const { database } = context;
|
|
21849
21903
|
const corpus = execution.corpus === "mail" ? MAIL : MESSAGES2;
|
|
@@ -22270,7 +22324,7 @@ var runQuery = /* @__PURE__ */ __name(async (context, execution, by) => {
|
|
|
22270
22324
|
};
|
|
22271
22325
|
}, "runQuery");
|
|
22272
22326
|
|
|
22273
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22327
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
|
|
22274
22328
|
function invalidMetadata() {
|
|
22275
22329
|
throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
|
|
22276
22330
|
}
|
|
@@ -22372,7 +22426,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
|
|
|
22372
22426
|
};
|
|
22373
22427
|
}), "counterTargets");
|
|
22374
22428
|
|
|
22375
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22429
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
|
|
22376
22430
|
var NOT_FILE_LIST = [...NOT_FILES].map((kind3) => `'${kind3}'`).join(",");
|
|
22377
22431
|
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,
|
|
22378
22432
|
att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
|
|
@@ -22491,7 +22545,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
|
|
|
22491
22545
|
}));
|
|
22492
22546
|
}, "attachmentViews");
|
|
22493
22547
|
|
|
22494
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22548
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
|
|
22495
22549
|
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");
|
|
22496
22550
|
var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text5, source2) => {
|
|
22497
22551
|
const { orm, database, now: now2 } = context;
|
|
@@ -22529,7 +22583,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
|
|
|
22529
22583
|
keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
|
|
22530
22584
|
}, "intoVoiceAttachment");
|
|
22531
22585
|
|
|
22532
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22586
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
|
|
22533
22587
|
var FIELDS = [
|
|
22534
22588
|
"threadExternalId",
|
|
22535
22589
|
"senderIdentityId",
|
|
@@ -22846,33 +22900,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
|
|
|
22846
22900
|
reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
|
|
22847
22901
|
}, "writeDerivedReactions");
|
|
22848
22902
|
|
|
22849
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22850
|
-
var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
|
|
22851
|
-
const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
|
|
22852
|
-
return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
|
|
22853
|
-
}, "syncStateOf");
|
|
22854
|
-
var writeState = /* @__PURE__ */ __name(({ orm, now: now2 }, accountKey, name, value) => {
|
|
22855
|
-
orm.insert(syncCursors).values({ accountId: accountKey, key: name, value, createdAt: now2(), updatedAt: now2() }).onConflictDoUpdate({
|
|
22856
|
-
target: [syncCursors.accountId, syncCursors.key],
|
|
22857
|
-
set: { value: sql`excluded.value`, updatedAt: sql`excluded.updated_at` }
|
|
22858
|
-
}).run();
|
|
22859
|
-
}, "writeState");
|
|
22860
|
-
var clearState = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
|
|
22861
|
-
orm.delete(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).run();
|
|
22862
|
-
}, "clearState");
|
|
22863
|
-
var claim2 = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, anchor, holder, forMs) => {
|
|
22864
|
-
const at = now2();
|
|
22865
|
-
return orm.insert(fetchLeases).values({ chatId: chatKey, anchor, holder, expiresAt: at + forMs }).onConflictDoUpdate({
|
|
22866
|
-
target: [fetchLeases.chatId, fetchLeases.anchor],
|
|
22867
|
-
set: { holder: sql`excluded.holder`, expiresAt: sql`excluded.expires_at` },
|
|
22868
|
-
setWhere: or(eq(fetchLeases.holder, sql`excluded.holder`), lte(fetchLeases.expiresAt, at))
|
|
22869
|
-
}).returning({ chatId: fetchLeases.chatId }).all().length > 0;
|
|
22870
|
-
}, "claim");
|
|
22871
|
-
var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
|
|
22872
|
-
orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
|
|
22873
|
-
}, "release");
|
|
22874
|
-
|
|
22875
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.491.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._95f40a748301e48ce1af109feea5b293/node_modules/@wirecat/cli-core/dist/store/keys.js
|
|
22903
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/keys.js
|
|
22876
22904
|
var keysOver = /* @__PURE__ */ __name((context) => {
|
|
22877
22905
|
const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
|
|
22878
22906
|
const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
|
|
@@ -22893,7 +22921,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
|
|
|
22893
22921
|
};
|
|
22894
22922
|
}, "keysOver");
|
|
22895
22923
|
|
|
22896
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22924
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
|
|
22897
22925
|
var accountGroupsOf = /* @__PURE__ */ __name((database) => {
|
|
22898
22926
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
|
|
22899
22927
|
if (!row2)
|
|
@@ -22928,7 +22956,7 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
|
|
|
22928
22956
|
database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
|
|
22929
22957
|
}, "saveProfile");
|
|
22930
22958
|
|
|
22931
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22959
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
|
|
22932
22960
|
var BOT_KINDS = ["agent", "script", "integration"];
|
|
22933
22961
|
var ownerPerson = /* @__PURE__ */ __name((database) => {
|
|
22934
22962
|
const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
|
|
@@ -22964,7 +22992,7 @@ var originOfActor = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
22964
22992
|
return database.prepare("SELECT name FROM bots WHERE id = ?").get(Number(id2))?.name === "rule" ? "rule" : "agent";
|
|
22965
22993
|
}, "originOfActor");
|
|
22966
22994
|
|
|
22967
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22995
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
|
|
22968
22996
|
var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
|
|
22969
22997
|
const owner = ownerPerson(context.database).id;
|
|
22970
22998
|
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);
|
|
@@ -22985,7 +23013,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
|
|
|
22985
23013
|
return personOf(context, ref3);
|
|
22986
23014
|
}, "linkToOwner");
|
|
22987
23015
|
|
|
22988
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23016
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
|
|
22989
23017
|
var PROVIDERS_SETTING = "providers";
|
|
22990
23018
|
var storedProvidersOf = /* @__PURE__ */ __name((database) => {
|
|
22991
23019
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
|
|
@@ -23020,7 +23048,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
|
|
|
23020
23048
|
});
|
|
23021
23049
|
}, "registerProvider");
|
|
23022
23050
|
|
|
23023
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23051
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
|
|
23024
23052
|
var DAY3 = 864e5;
|
|
23025
23053
|
var RECENTLY_CLOSED_MS = 14 * DAY3;
|
|
23026
23054
|
var TEXT_LIMIT = 20;
|
|
@@ -23033,7 +23061,7 @@ var ABOUT_TASK = ["related-to", "evidence", "created-from"];
|
|
|
23033
23061
|
var PLACEHOLDER = /* @__PURE__ */ __name((row2) => `${String(row2.type)} \u2014 ${String(row2.source_locator ?? "")}`, "PLACEHOLDER");
|
|
23034
23062
|
var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
23035
23063
|
const { database, now: now2 } = context;
|
|
23036
|
-
const
|
|
23064
|
+
const stemmerFor2 = stemmerCache();
|
|
23037
23065
|
const MESSAGE = "SELECT m.id, m.text, m.sent_at, m.outgoing, p.id AS person, p.owner FROM messages m LEFT JOIN identity_links il ON il.identity_id = m.sender_identity_id LEFT JOIN persons p ON p.id = il.person_id";
|
|
23038
23066
|
const messageOf = /* @__PURE__ */ __name((row2) => {
|
|
23039
23067
|
const own = Number(row2.outgoing) === 1 || Number(row2.owner) === 1;
|
|
@@ -23107,7 +23135,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
|
23107
23135
|
}, "replyChain");
|
|
23108
23136
|
const COLUMNS7 = "t.id, t.project_id, t.key, t.package_id, t.title, t.description, t.type, t.status, t.source_locator, t.created_at, t.due_at, t.category";
|
|
23109
23137
|
const rowOf = /* @__PURE__ */ __name((id2) => database.prepare(`SELECT ${COLUMNS7} FROM tasks t WHERE t.id = ? AND t.deleted_at IS NULL`).get(id2), "rowOf");
|
|
23110
|
-
const
|
|
23138
|
+
const subjectOf2 = /* @__PURE__ */ __name((subject2) => {
|
|
23111
23139
|
if ("task" in subject2) {
|
|
23112
23140
|
const bare = subject2.task.startsWith("task:") ? subject2.task.slice("task:".length) : subject2.task;
|
|
23113
23141
|
const id2 = taskRowOf(database, bare);
|
|
@@ -23136,12 +23164,12 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
|
23136
23164
|
}, "subjectOf");
|
|
23137
23165
|
return {
|
|
23138
23166
|
compare: /* @__PURE__ */ __name(async (subject2, other) => {
|
|
23139
|
-
const side =
|
|
23167
|
+
const side = subjectOf2(subject2);
|
|
23140
23168
|
const id2 = taskRowOf(database, other.startsWith("task:") ? other.slice("task:".length) : other);
|
|
23141
23169
|
const row2 = id2 === void 0 ? void 0 : rowOf(id2);
|
|
23142
23170
|
if (!side || !row2)
|
|
23143
23171
|
throw new CliError("not_found", `no task ${other}`);
|
|
23144
|
-
const stemmer =
|
|
23172
|
+
const stemmer = stemmerFor2(storeStemmers(database) ?? DEFAULT_STEMMERS);
|
|
23145
23173
|
const one = linkedOf(side);
|
|
23146
23174
|
const otherSide = linkedOf(sideOf(row2));
|
|
23147
23175
|
const chain = chainOf(one);
|
|
@@ -23152,12 +23180,12 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
|
23152
23180
|
});
|
|
23153
23181
|
}, "compare"),
|
|
23154
23182
|
similar: /* @__PURE__ */ __name(async (subject2, { limit = 10 } = {}) => {
|
|
23155
|
-
const named2 =
|
|
23183
|
+
const named2 = subjectOf2(subject2);
|
|
23156
23184
|
if (!named2)
|
|
23157
23185
|
return [];
|
|
23158
23186
|
const side = linkedOf(named2);
|
|
23159
|
-
drainCorpus(database, CORPORA.task,
|
|
23160
|
-
const stemmer =
|
|
23187
|
+
drainCorpus(database, CORPORA.task, stemmerFor2);
|
|
23188
|
+
const stemmer = stemmerFor2(storeStemmers(database) ?? DEFAULT_STEMMERS);
|
|
23161
23189
|
const since = now2() - RECENTLY_CLOSED_MS;
|
|
23162
23190
|
const live2 = "t.project_id = ? AND t.deleted_at IS NULL AND t.id <> ? AND (t.status = 'open' OR t.closed_at >= ?)";
|
|
23163
23191
|
const scope3 = [side.project, side.row ?? -1, since];
|
|
@@ -23219,7 +23247,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
|
23219
23247
|
};
|
|
23220
23248
|
}, "taskSimilarityOver");
|
|
23221
23249
|
|
|
23222
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23250
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
|
|
23223
23251
|
var SETTING3 = "taskCategories";
|
|
23224
23252
|
var savedTaskCategories = /* @__PURE__ */ __name((database) => {
|
|
23225
23253
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
|
|
@@ -23238,7 +23266,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
|
|
|
23238
23266
|
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);
|
|
23239
23267
|
}, "saveTaskCategories");
|
|
23240
23268
|
|
|
23241
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23269
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
|
|
23242
23270
|
var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
|
|
23243
23271
|
var ALLOWED = "taskAgentClose";
|
|
23244
23272
|
var MIN = "taskAgentCloseMin";
|
|
@@ -23294,7 +23322,50 @@ var SUGGESTION_COLUMNS = [
|
|
|
23294
23322
|
];
|
|
23295
23323
|
var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
|
|
23296
23324
|
|
|
23297
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23325
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
|
|
23326
|
+
var EXCERPT_CHARS = 280;
|
|
23327
|
+
var excerptOf = /* @__PURE__ */ __name((text5) => {
|
|
23328
|
+
if (text5 == null)
|
|
23329
|
+
return null;
|
|
23330
|
+
const flat2 = String(text5).replace(/\s+/g, " ").trim();
|
|
23331
|
+
if (!flat2)
|
|
23332
|
+
return null;
|
|
23333
|
+
return flat2.length > EXCERPT_CHARS ? `${flat2.slice(0, EXCERPT_CHARS - 1)}\u2026` : flat2;
|
|
23334
|
+
}, "excerptOf");
|
|
23335
|
+
var iso = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
23336
|
+
var textOf = /* @__PURE__ */ __name((value) => value == null || String(value).trim() === "" ? null : String(value), "textOf");
|
|
23337
|
+
var READS2 = {
|
|
23338
|
+
message: "SELECT c.title, coalesce(m.sender_name, i.name) AS sender, m.sent_at AS at, m.text AS body, a.provider AS tool FROM messages m JOIN chats c ON c.id = m.chat_id JOIN accounts a ON a.id = c.account_id LEFT JOIN identities i ON i.id = m.sender_identity_id WHERE m.id = ?",
|
|
23339
|
+
email: "SELECT e.subject AS title, coalesce(e.from_name, e.from_address) AS sender, e.sent_at AS at, coalesce(e.body_text, e.snippet) AS body, 'email' AS tool FROM emails e WHERE e.id = ?",
|
|
23340
|
+
note: "SELECT title, NULL AS sender, updated_at AS at, body, 'notes' AS tool FROM notes WHERE id = ?",
|
|
23341
|
+
document: "SELECT d.title, NULL AS sender, coalesce(d.external_updated_at, d.updated_at) AS at, d.body, a.provider AS tool FROM documents d JOIN accounts a ON a.id = d.account_id WHERE d.id = ?",
|
|
23342
|
+
meeting: "SELECT m.title, NULL AS sender, m.started_at AS at, m.description AS body, a.provider AS tool FROM meetings m JOIN accounts a ON a.id = m.account_id WHERE m.id = ?",
|
|
23343
|
+
meeting_transcript: "SELECT m.title, NULL AS sender, m.started_at AS at, NULL AS body, a.provider AS tool FROM meeting_transcripts t JOIN meetings m ON m.id = t.meeting_id JOIN accounts a ON a.id = m.account_id WHERE t.id = ?",
|
|
23344
|
+
meeting_transcript_row: "SELECT m.title, r.speaker_name AS sender, m.started_at + coalesce(r.start_ms, 0) AS at, r.text AS body, a.provider AS tool 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 JOIN accounts a ON a.id = m.account_id WHERE r.id = ?"
|
|
23345
|
+
};
|
|
23346
|
+
var KIND = {
|
|
23347
|
+
meeting_transcript: "meeting",
|
|
23348
|
+
meeting_transcript_row: "meeting"
|
|
23349
|
+
};
|
|
23350
|
+
var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => database.prepare(`SELECT to_type, to_id FROM links WHERE from_type = ? AND from_id = ? AND kind = ${linkKind("evidence")} AND to_id IS NOT NULL ORDER BY id`).all(from2.type, from2.id).map((link3) => {
|
|
23351
|
+
const thing = storedThing(link3.to_type, link3.to_id);
|
|
23352
|
+
const state = stateOfThing(database, thing);
|
|
23353
|
+
const read2 = READS2[thing.type];
|
|
23354
|
+
const row2 = read2 === void 0 || state === "unavailable" ? void 0 : database.prepare(read2).get(thing.id);
|
|
23355
|
+
const gone = state !== "available";
|
|
23356
|
+
return {
|
|
23357
|
+
ref: referenceOfThing(database, thing) ?? null,
|
|
23358
|
+
kind: KIND[thing.type] ?? thing.type,
|
|
23359
|
+
title: textOf(row2?.title),
|
|
23360
|
+
sender: textOf(row2?.sender),
|
|
23361
|
+
at: iso(row2?.at),
|
|
23362
|
+
excerpt: gone ? null : excerptOf(row2?.body),
|
|
23363
|
+
tool: textOf(row2?.tool),
|
|
23364
|
+
missing: gone
|
|
23365
|
+
};
|
|
23366
|
+
}), "evidenceSourcesOf");
|
|
23367
|
+
|
|
23368
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/attachments/limits.js
|
|
23298
23369
|
var MAX_FILE_BYTES = 50 * 1024 * 1024;
|
|
23299
23370
|
var MAX_TEXT_CHARS = 2e6;
|
|
23300
23371
|
var ATTACHMENT_LIMIT_ENV = [
|
|
@@ -23320,7 +23391,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
|
|
|
23320
23391
|
return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
|
|
23321
23392
|
}, "pdfPreviewLimits");
|
|
23322
23393
|
|
|
23323
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23394
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/ulid.js
|
|
23324
23395
|
import { randomBytes } from "node:crypto";
|
|
23325
23396
|
var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
23326
23397
|
var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
|
|
@@ -23333,7 +23404,7 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
|
|
|
23333
23404
|
return time3 + random;
|
|
23334
23405
|
}, "ulid");
|
|
23335
23406
|
|
|
23336
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23407
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
|
|
23337
23408
|
var FOLDED_FIELDS = ["title", "site", "language", "author"];
|
|
23338
23409
|
var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
|
|
23339
23410
|
if (!meta && !sections?.length)
|
|
@@ -23354,7 +23425,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
|
|
|
23354
23425
|
return typeof language === "string" && language !== "" ? language : null;
|
|
23355
23426
|
}, "languageOf");
|
|
23356
23427
|
|
|
23357
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23428
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
|
|
23358
23429
|
var isObject = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
|
|
23359
23430
|
var objectOf = /* @__PURE__ */ __name((value) => {
|
|
23360
23431
|
if (isObject(value))
|
|
@@ -23597,7 +23668,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
23597
23668
|
};
|
|
23598
23669
|
}, "filesStoreOver");
|
|
23599
23670
|
|
|
23600
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23671
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
|
|
23601
23672
|
var IMPORTED_DOCUMENT_QUERY = defineQuery({
|
|
23602
23673
|
entity: "document",
|
|
23603
23674
|
backend: "sql",
|
|
@@ -23643,11 +23714,11 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
|
|
|
23643
23714
|
return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
|
|
23644
23715
|
}, "importedDocumentWhere");
|
|
23645
23716
|
|
|
23646
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23717
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
|
|
23647
23718
|
var NOTE_FORMATS = ["obsidian", "markdown"];
|
|
23648
|
-
var
|
|
23649
|
-
var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null :
|
|
23650
|
-
var
|
|
23719
|
+
var iso2 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
23720
|
+
var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso2(value), "optionalIso");
|
|
23721
|
+
var textOf2 = /* @__PURE__ */ __name((text5, what, max = 1e5, allowEmpty = false) => {
|
|
23651
23722
|
const value = text5.trim();
|
|
23652
23723
|
if (!value && !allowEmpty || value.length > max)
|
|
23653
23724
|
throw new CliError("validation_error", `${what} takes ${allowEmpty ? 0 : 1}\u2013${max} characters`);
|
|
@@ -23671,8 +23742,8 @@ var documentOf = /* @__PURE__ */ __name((row2) => ({
|
|
|
23671
23742
|
contentHash: row2.content_hash == null ? null : String(row2.content_hash),
|
|
23672
23743
|
revision: Number(row2.revision),
|
|
23673
23744
|
exportPath: row2.export_path == null ? null : String(row2.export_path),
|
|
23674
|
-
createdAt:
|
|
23675
|
-
updatedAt:
|
|
23745
|
+
createdAt: iso2(row2.created_at),
|
|
23746
|
+
updatedAt: iso2(row2.updated_at),
|
|
23676
23747
|
deletedAt: optionalIso(row2.deleted_at)
|
|
23677
23748
|
}), "documentOf");
|
|
23678
23749
|
var noteOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -23687,8 +23758,8 @@ var noteOf = /* @__PURE__ */ __name((row2) => ({
|
|
|
23687
23758
|
contentHash: null,
|
|
23688
23759
|
revision: Number(row2.revision),
|
|
23689
23760
|
exportPath: null,
|
|
23690
|
-
createdAt:
|
|
23691
|
-
updatedAt:
|
|
23761
|
+
createdAt: iso2(row2.created_at),
|
|
23762
|
+
updatedAt: iso2(row2.updated_at),
|
|
23692
23763
|
deletedAt: optionalIso(row2.deleted_at)
|
|
23693
23764
|
}), "noteOf");
|
|
23694
23765
|
var noteRowOf = /* @__PURE__ */ __name((database, reference2) => {
|
|
@@ -23714,7 +23785,7 @@ var linkOf = /* @__PURE__ */ __name((database, row2) => {
|
|
|
23714
23785
|
evidence: row2.evidence == null ? null : String(row2.evidence),
|
|
23715
23786
|
provenance: metadata3.provenance ?? null,
|
|
23716
23787
|
confirmed: Number(row2.confirmed) === 1,
|
|
23717
|
-
createdAt:
|
|
23788
|
+
createdAt: iso2(row2.created_at)
|
|
23718
23789
|
};
|
|
23719
23790
|
}, "linkOf");
|
|
23720
23791
|
var requiredThing = /* @__PURE__ */ __name((database, reference2, what = "the target") => {
|
|
@@ -23753,7 +23824,7 @@ var insertLink = /* @__PURE__ */ __name((context, input) => {
|
|
|
23753
23824
|
const origin = oneOf(input.origin ?? "owner", LINK_ORIGINS, "a link's origin");
|
|
23754
23825
|
const from2 = requiredThing(database, input.from, "a link's source");
|
|
23755
23826
|
const to = input.to === void 0 ? null : requiredThing(database, input.to, "a link's target");
|
|
23756
|
-
const targetText = input.targetText === void 0 ? null :
|
|
23827
|
+
const targetText = input.targetText === void 0 ? null : textOf2(input.targetText, "a link's target", 500);
|
|
23757
23828
|
if (to === null && targetText === null)
|
|
23758
23829
|
throw new CliError("validation_error", "a link needs a target");
|
|
23759
23830
|
if (to !== null) {
|
|
@@ -23762,8 +23833,8 @@ var insertLink = /* @__PURE__ */ __name((context, input) => {
|
|
|
23762
23833
|
return linkOf(database, existing);
|
|
23763
23834
|
}
|
|
23764
23835
|
const at = now2();
|
|
23765
|
-
const provenance2 = input.provenance === void 0 ? void 0 :
|
|
23766
|
-
const row2 = database.prepare("INSERT INTO links (from_type, from_id, to_type, to_id, kind, anchor, source, target_text, target_folded, role, evidence, metadata, confirmed, created_at, author, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(from2.type, from2.id, to?.type ?? null, to?.id ?? null, kind3, input.anchor ?? null, origin, targetText, targetText === null ? null : targetKey(targetText), input.role === void 0 ? null :
|
|
23836
|
+
const provenance2 = input.provenance === void 0 ? void 0 : textOf2(input.provenance, "provenance", 2e3);
|
|
23837
|
+
const row2 = database.prepare("INSERT INTO links (from_type, from_id, to_type, to_id, kind, anchor, source, target_text, target_folded, role, evidence, metadata, confirmed, created_at, author, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(from2.type, from2.id, to?.type ?? null, to?.id ?? null, kind3, input.anchor ?? null, origin, targetText, targetText === null ? null : targetKey(targetText), input.role === void 0 ? null : textOf2(input.role, "a role", 200), input.evidence === void 0 ? null : textOf2(input.evidence, "evidence", 2e3), provenance2 === void 0 ? null : JSON.stringify({ provenance: provenance2 }), input.confirmed === false ? 0 : 1, at, origin === "owner" ? "owner" : null, at);
|
|
23767
23838
|
if (to === null && targetText !== null)
|
|
23768
23839
|
resolveKey(database, targetKey(targetText));
|
|
23769
23840
|
return linkOf(database, database.prepare("SELECT * FROM links WHERE id = ?").get(Number(row2?.id)));
|
|
@@ -23776,7 +23847,7 @@ var folderOf = /* @__PURE__ */ __name((row2) => {
|
|
|
23776
23847
|
name: folder ? String(row2.name) : `${String(row2.provider)}:${String(row2.external_id)}`,
|
|
23777
23848
|
provider: String(row2.provider),
|
|
23778
23849
|
format: settings.format ?? (folder ? "obsidian" : "markdown"),
|
|
23779
|
-
createdAt:
|
|
23850
|
+
createdAt: iso2(row2.created_at),
|
|
23780
23851
|
...folder ? {} : { account: { provider: String(row2.provider), account: String(row2.external_id) } }
|
|
23781
23852
|
};
|
|
23782
23853
|
}, "folderOf");
|
|
@@ -23881,7 +23952,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
23881
23952
|
addFolder: /* @__PURE__ */ __name(async ({ name, format = "obsidian" }) => {
|
|
23882
23953
|
const at = now2();
|
|
23883
23954
|
const checked = oneOf(format, NOTE_FORMATS, "a folder's format");
|
|
23884
|
-
const row2 = database.prepare("INSERT INTO accounts (provider, external_id, name, settings, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?) RETURNING id").get(folderProviderOf(checked), ulid(at),
|
|
23955
|
+
const row2 = database.prepare("INSERT INTO accounts (provider, external_id, name, settings, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?) RETURNING id").get(folderProviderOf(checked), ulid(at), textOf2(name, "a folder's name", 200), JSON.stringify({ format: checked }), at, at);
|
|
23885
23956
|
return folderOf(folderRow(String(row2?.id)));
|
|
23886
23957
|
}, "addFolder"),
|
|
23887
23958
|
folders: /* @__PURE__ */ __name(async () => database.prepare(`SELECT * FROM accounts WHERE ${folderProviderSql()} ORDER BY name, id`).all().map(folderOf), "folders"),
|
|
@@ -23893,14 +23964,14 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
23893
23964
|
if (found2 || !create)
|
|
23894
23965
|
return found2 ? folderOf(found2) : void 0;
|
|
23895
23966
|
const at = now2();
|
|
23896
|
-
database.prepare("INSERT OR IGNORE INTO accounts (provider, external_id, name, settings, created_at, updated_at) VALUES (?, ?, NULL, ?, ?, ?)").run(provider,
|
|
23967
|
+
database.prepare("INSERT OR IGNORE INTO accounts (provider, external_id, name, settings, created_at, updated_at) VALUES (?, ?, NULL, ?, ?, ?)").run(provider, textOf2(account, "an account's id", 200), JSON.stringify({ format: "markdown" }), at, at);
|
|
23897
23968
|
return folderOf(find2());
|
|
23898
23969
|
}, "documentsAccount"),
|
|
23899
23970
|
documentsAccounts: /* @__PURE__ */ __name(async () => database.prepare(`SELECT * FROM accounts WHERE provider IN (${DOCUMENT_ACCOUNT_PROVIDERS.map(() => "?").join(", ")}) ORDER BY provider, external_id`).all(...DOCUMENT_ACCOUNT_PROVIDERS).map(folderOf), "documentsAccounts"),
|
|
23900
23971
|
saveFileNote: /* @__PURE__ */ __name(async (input) => write(database, () => {
|
|
23901
23972
|
const folder = Number(folderRow(input.folderId).id);
|
|
23902
|
-
const path =
|
|
23903
|
-
const text5 =
|
|
23973
|
+
const path = textOf2(input.path, "a note's path", 4096);
|
|
23974
|
+
const text5 = textOf2(input.text, "a note's text", MAX_TEXT_CHARS, true);
|
|
23904
23975
|
const frontMatter = input.frontMatter == null ? null : JSON.stringify(input.frontMatter);
|
|
23905
23976
|
let metadata3 = encodeDocumentMetadata(input.metadata, input.sections);
|
|
23906
23977
|
const language = languageOf(input.metadata);
|
|
@@ -23951,7 +24022,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
23951
24022
|
}), "saveFileNote"),
|
|
23952
24023
|
renameFileNote: /* @__PURE__ */ __name(async (folderId, from2, to) => write(database, () => {
|
|
23953
24024
|
const folder = Number(folderRow(folderId).id);
|
|
23954
|
-
const target =
|
|
24025
|
+
const target = textOf2(to, "a note's path", 4096);
|
|
23955
24026
|
const at = now2();
|
|
23956
24027
|
const place = fileAt(folder, from2, true);
|
|
23957
24028
|
const legacy = database.prepare("SELECT id FROM documents WHERE account_id = ? AND external_id = ? AND deleted_at IS NULL").get(folder, from2);
|
|
@@ -24018,7 +24089,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
24018
24089
|
const owner = ownerPerson(database);
|
|
24019
24090
|
const [subject2] = about.map((reference2) => requiredThing(database, reference2));
|
|
24020
24091
|
const notable = subject2 ?? owner;
|
|
24021
|
-
const row2 = database.prepare("INSERT INTO notes (notable_type, notable_id, title, body, author_type, author_id, revision, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, 1, ?, ?) RETURNING id").get(notable.type, notable.id, title === void 0 ? null :
|
|
24092
|
+
const row2 = database.prepare("INSERT INTO notes (notable_type, notable_id, title, body, author_type, author_id, revision, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, 1, ?, ?) RETURNING id").get(notable.type, notable.id, title === void 0 ? null : textOf2(title, "a title", 500), textOf2(text5, "a note"), owner.type, owner.id, at, at);
|
|
24022
24093
|
const id2 = Number(row2?.id);
|
|
24023
24094
|
for (const reference2 of about.slice(1))
|
|
24024
24095
|
insertLink(context, { from: `note:${id2}`, to: reference2, kind: "about", origin: "owner" });
|
|
@@ -24063,7 +24134,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
24063
24134
|
throw new CliError("validation_error", "a file note is edited in its file; the next import reads it");
|
|
24064
24135
|
const bare = id2.replace(/^note:/, "");
|
|
24065
24136
|
const found2 = noteRow(bare);
|
|
24066
|
-
const changed = database.prepare("UPDATE notes SET body = ?, revision = revision + 1, updated_at = ? WHERE id = ? AND revision = ? AND deleted_at IS NULL").run(
|
|
24137
|
+
const changed = database.prepare("UPDATE notes SET body = ?, revision = revision + 1, updated_at = ? WHERE id = ? AND revision = ? AND deleted_at IS NULL").run(textOf2(text5, "a note"), now2(), Number(bare), revision2).changes;
|
|
24067
24138
|
if (!changed)
|
|
24068
24139
|
throw new CliError("validation_error", "the note changed; read its current revision before editing");
|
|
24069
24140
|
database.prepare("INSERT INTO note_revisions (note_id, body, revision, created_at) VALUES (?, ?, ?, ?)").run(Number(bare), String(found2.body), revision2, now2());
|
|
@@ -24153,9 +24224,9 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
24153
24224
|
};
|
|
24154
24225
|
}, "notesStoreOver");
|
|
24155
24226
|
|
|
24156
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24227
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
|
|
24157
24228
|
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";
|
|
24158
|
-
var
|
|
24229
|
+
var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
24159
24230
|
var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
24160
24231
|
if (typeof value !== "string" || !allowed.includes(value))
|
|
24161
24232
|
throw new CliError("validation_error", `${what} is one of ${allowed.join(", ")}`);
|
|
@@ -24183,15 +24254,62 @@ var linkEvidence = /* @__PURE__ */ __name((context, from2, references, author) =
|
|
|
24183
24254
|
}
|
|
24184
24255
|
}, "linkEvidence");
|
|
24185
24256
|
var evidenceOf = /* @__PURE__ */ __name((context, from2) => context.database.prepare(`SELECT to_type, to_id FROM links WHERE from_type = ? AND from_id = ? AND kind = ${linkKind("evidence")} AND to_id IS NOT NULL ORDER BY id`).all(from2.type, from2.id).flatMap((row2) => referenceOfThing(context.database, storedThing(row2.to_type, row2.to_id)) ?? []), "evidenceOf");
|
|
24257
|
+
var SUBJECT_NAMES = {
|
|
24258
|
+
person: "SELECT p.owner, coalesce(p.name, (SELECT a.name FROM aliases a WHERE a.aliasable_type = 'person' AND a.aliasable_id = p.id ORDER BY a.display DESC, a.id LIMIT 1), (SELECT i.name FROM identity_links l JOIN identities i ON i.id = l.identity_id WHERE l.person_id = p.id AND i.name IS NOT NULL ORDER BY i.id LIMIT 1)) AS name FROM persons p WHERE p.id = ?",
|
|
24259
|
+
project: "SELECT 0 AS owner, name FROM projects WHERE id = ?",
|
|
24260
|
+
organization: "SELECT 0 AS owner, name FROM organizations WHERE id = ?"
|
|
24261
|
+
};
|
|
24262
|
+
var subjectOf = /* @__PURE__ */ __name((database, row2) => {
|
|
24263
|
+
if (row2.subject_type == null)
|
|
24264
|
+
return { subject: null, subjectName: null, subjectIsOwner: false };
|
|
24265
|
+
const thing = storedThing(row2.subject_type, row2.subject_id);
|
|
24266
|
+
const read2 = SUBJECT_NAMES[thing.type];
|
|
24267
|
+
const named2 = read2 === void 0 ? void 0 : database.prepare(read2).get(thing.id);
|
|
24268
|
+
return {
|
|
24269
|
+
subject: referenceOfThing(database, thing) ?? null,
|
|
24270
|
+
subjectName: named2?.name == null ? null : String(named2.name),
|
|
24271
|
+
subjectIsOwner: Number(named2?.owner) === 1
|
|
24272
|
+
};
|
|
24273
|
+
}, "subjectOf");
|
|
24274
|
+
var highestKey = /* @__PURE__ */ __name((table) => `ids.${table}.highest`, "highestKey");
|
|
24275
|
+
var nextId = /* @__PURE__ */ __name((database, table) => {
|
|
24276
|
+
const kept = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(highestKey(table));
|
|
24277
|
+
const highest = database.prepare(`SELECT max(id) AS id FROM ${table}`).get();
|
|
24278
|
+
return Math.max(Number(kept?.value ?? 0), Number(highest?.id ?? 0)) + 1;
|
|
24279
|
+
}, "nextId");
|
|
24280
|
+
var keepHighestId = /* @__PURE__ */ __name((database, table, at) => {
|
|
24281
|
+
const highest = nextId(database, table) - 1;
|
|
24282
|
+
database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(highestKey(table), String(highest), at);
|
|
24283
|
+
}, "keepHighestId");
|
|
24284
|
+
var dropLinksOf = /* @__PURE__ */ __name((database, thing) => {
|
|
24285
|
+
const count = Number(database.prepare("SELECT count(*) AS n FROM links WHERE (from_type = ? AND from_id = ?) OR (to_type = ? AND to_id = ?)").get(thing.type, thing.id, thing.type, thing.id)?.n);
|
|
24286
|
+
database.prepare("DELETE FROM links WHERE to_type = ? AND to_id = ?").run(thing.type, thing.id);
|
|
24287
|
+
return count;
|
|
24288
|
+
}, "dropLinksOf");
|
|
24289
|
+
var erase = /* @__PURE__ */ __name((database, work) => {
|
|
24290
|
+
database.exec("PRAGMA secure_delete = ON");
|
|
24291
|
+
try {
|
|
24292
|
+
const done = write(database, () => {
|
|
24293
|
+
const result = work();
|
|
24294
|
+
for (const index2 of ["memory_words", "memory_stems"])
|
|
24295
|
+
database.prepare(`INSERT INTO ${index2} (${index2}) VALUES ('optimize')`).run();
|
|
24296
|
+
return result;
|
|
24297
|
+
});
|
|
24298
|
+
database.exec("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
24299
|
+
return done;
|
|
24300
|
+
} finally {
|
|
24301
|
+
database.exec("PRAGMA secure_delete = OFF");
|
|
24302
|
+
}
|
|
24303
|
+
}, "erase");
|
|
24186
24304
|
var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
24187
24305
|
const { database, now: now2 } = context;
|
|
24188
|
-
const
|
|
24306
|
+
const stemmerFor2 = stemmerCache();
|
|
24189
24307
|
const memoryOf = /* @__PURE__ */ __name((row2) => ({
|
|
24190
24308
|
id: String(row2.id),
|
|
24191
24309
|
ref: `memory:${row2.id}`,
|
|
24192
24310
|
kind: row2.kind,
|
|
24193
24311
|
body: String(row2.body),
|
|
24194
|
-
|
|
24312
|
+
...subjectOf(database, row2),
|
|
24195
24313
|
author: authorOf(row2),
|
|
24196
24314
|
model: row2.model == null ? null : String(row2.model),
|
|
24197
24315
|
confidence: row2.confidence == null ? null : Number(row2.confidence),
|
|
@@ -24199,9 +24317,9 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
24199
24317
|
scope: row2.scope,
|
|
24200
24318
|
supersedes: row2.supersedes_id == null ? null : `memory:${row2.supersedes_id}`,
|
|
24201
24319
|
evidence: evidenceOf(context, { type: "memory", id: Number(row2.id) }),
|
|
24202
|
-
lastVerifiedAt: row2.last_verified_at == null ? null :
|
|
24203
|
-
createdAt:
|
|
24204
|
-
updatedAt:
|
|
24320
|
+
lastVerifiedAt: row2.last_verified_at == null ? null : iso3(row2.last_verified_at),
|
|
24321
|
+
createdAt: iso3(row2.created_at),
|
|
24322
|
+
updatedAt: iso3(row2.updated_at)
|
|
24205
24323
|
}), "memoryOf");
|
|
24206
24324
|
const rowOf = /* @__PURE__ */ __name((reference2) => {
|
|
24207
24325
|
const thing = requiredThing(database, reference2.includes(":") ? reference2 : `memory:${reference2}`, "the memory");
|
|
@@ -24241,7 +24359,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
24241
24359
|
const subject2 = input.subject === void 0 ? void 0 : requiredThing(database, input.subject, "the subject");
|
|
24242
24360
|
const replaced = input.supersedes === void 0 ? void 0 : Number(rowOf(input.supersedes).id);
|
|
24243
24361
|
const at = now2();
|
|
24244
|
-
const made = Number(database.prepare("INSERT INTO memories (kind, body, subject_type, subject_id, author_type, author_id, model, confidence, status, last_verified_at, supersedes_id, scope, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(kind3, body2, subject2?.type ?? null, subject2?.id ?? null, actor.type, actor.id, model, input.confidence ?? null, status, status === "confirmed" ? at : null, replaced ?? null, scope3, at, at)?.id);
|
|
24362
|
+
const made = Number(database.prepare("INSERT INTO memories (id, kind, body, subject_type, subject_id, author_type, author_id, model, confidence, status, last_verified_at, supersedes_id, scope, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(nextId(database, "memories"), kind3, body2, subject2?.type ?? null, subject2?.id ?? null, actor.type, actor.id, model, input.confidence ?? null, status, status === "confirmed" ? at : null, replaced ?? null, scope3, at, at)?.id);
|
|
24245
24363
|
linkEvidence(context, { type: "memory", id: made }, input.evidence, input.author === "owner" ? "owner" : "agent");
|
|
24246
24364
|
if (replaced !== void 0)
|
|
24247
24365
|
database.prepare("UPDATE memories SET status = 'superseded', updated_at = ? WHERE id = ?").run(at, replaced);
|
|
@@ -24256,9 +24374,21 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
24256
24374
|
}, "list"),
|
|
24257
24375
|
confirm: /* @__PURE__ */ __name(async (reference2) => setStatus(reference2, "confirmed", true), "confirm"),
|
|
24258
24376
|
markStale: /* @__PURE__ */ __name(async (reference2) => setStatus(reference2, "stale", false), "markStale"),
|
|
24377
|
+
remove: /* @__PURE__ */ __name(async (reference2) => {
|
|
24378
|
+
const id2 = Number(rowOf(reference2).id);
|
|
24379
|
+
const links2 = erase(database, () => {
|
|
24380
|
+
keepHighestId(database, "memories", now2());
|
|
24381
|
+
database.prepare("UPDATE memories SET supersedes_id = NULL WHERE supersedes_id = ?").run(id2);
|
|
24382
|
+
const count = dropLinksOf(database, { type: "memory", id: id2 });
|
|
24383
|
+
database.prepare("DELETE FROM memories WHERE id = ?").run(id2);
|
|
24384
|
+
return count;
|
|
24385
|
+
});
|
|
24386
|
+
return { ref: `memory:${id2}`, removed: true, links: links2 };
|
|
24387
|
+
}, "remove"),
|
|
24388
|
+
sources: /* @__PURE__ */ __name(async (reference2) => evidenceSourcesOf(database, { type: "memory", id: Number(rowOf(reference2).id) }), "sources"),
|
|
24259
24389
|
search: /* @__PURE__ */ __name(async (text5, { subject: subjectRef, scope: scope3, limit = 20 } = {}) => {
|
|
24260
24390
|
const subject2 = subjectRef === void 0 ? void 0 : requiredThing(database, subjectRef);
|
|
24261
|
-
drainCorpus(database, CORPORA.memory,
|
|
24391
|
+
drainCorpus(database, CORPORA.memory, stemmerFor2);
|
|
24262
24392
|
const words3 = normalize(text5).split(/\s+/).filter((word) => /[\p{L}\p{N}]/u.test(word));
|
|
24263
24393
|
if (words3.length === 0)
|
|
24264
24394
|
throw new CliError("validation_error", "say what to find in the memories");
|
|
@@ -24269,7 +24399,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
24269
24399
|
};
|
|
24270
24400
|
}, "memoriesStoreOver");
|
|
24271
24401
|
|
|
24272
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24402
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
|
|
24273
24403
|
var DEFAULT_FIRST_PASS_PER_CHAT = 0;
|
|
24274
24404
|
var KEY = "taskFirstPassPerChat";
|
|
24275
24405
|
var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
|
|
@@ -24289,7 +24419,7 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
|
|
|
24289
24419
|
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);
|
|
24290
24420
|
}, "saveFirstPassPerChat");
|
|
24291
24421
|
|
|
24292
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24422
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
|
|
24293
24423
|
var TASK_RELATION_KINDS = [
|
|
24294
24424
|
"blocked-by",
|
|
24295
24425
|
"follow-up-of",
|
|
@@ -24419,19 +24549,19 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
|
|
|
24419
24549
|
};
|
|
24420
24550
|
}, "taskRelationsStoreOver");
|
|
24421
24551
|
|
|
24422
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24552
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
|
|
24423
24553
|
var TASK_ROLES = ["assignee", "reviewer", "watcher"];
|
|
24424
|
-
var
|
|
24554
|
+
var iso4 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
24425
24555
|
var recordTaskEvent = /* @__PURE__ */ __name((database, task, actor, kind3, changes, at) => {
|
|
24426
24556
|
database.prepare("INSERT INTO task_events (task_id, actor_type, actor_id, kind, changes, created_at) VALUES (?, ?, ?, ?, ?, ?)").run(task, actor?.type ?? null, actor?.id ?? null, kind3, changes === null ? null : JSON.stringify(changes), at);
|
|
24427
24557
|
}, "recordTaskEvent");
|
|
24428
|
-
var
|
|
24558
|
+
var textOf3 = /* @__PURE__ */ __name((value, what, max) => {
|
|
24429
24559
|
const text5 = value.trim();
|
|
24430
24560
|
if (!text5 || text5.length > max)
|
|
24431
24561
|
throw new CliError("validation_error", `${what} takes 1\u2013${max} characters`);
|
|
24432
24562
|
return text5;
|
|
24433
24563
|
}, "textOf");
|
|
24434
|
-
var claimOf = /* @__PURE__ */ __name((row2, at) => row2.claimed_by != null && Number(row2.claimed_until) >= at ? { claimedBy: String(row2.claimed_by), claimedUntil:
|
|
24564
|
+
var claimOf = /* @__PURE__ */ __name((row2, at) => row2.claimed_by != null && Number(row2.claimed_until) >= at ? { claimedBy: String(row2.claimed_by), claimedUntil: iso4(row2.claimed_until) } : { claimedBy: null, claimedUntil: null }, "claimOf");
|
|
24435
24565
|
var priorityOf = /* @__PURE__ */ __name((value) => {
|
|
24436
24566
|
if (value !== null && !(Number.isInteger(value) && value >= 0 && value <= 4))
|
|
24437
24567
|
throw new CliError("validation_error", "a priority is 0 (urgent) to 4 (low)");
|
|
@@ -24492,9 +24622,9 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24492
24622
|
priority: row2.priority == null ? null : Number(row2.priority),
|
|
24493
24623
|
parent: row2.parent_id == null ? null : reference2(Number(row2.parent_id)),
|
|
24494
24624
|
source: row2.source_locator == null ? null : String(row2.source_locator),
|
|
24495
|
-
dueAt:
|
|
24496
|
-
nextCheckAt:
|
|
24497
|
-
closedAt:
|
|
24625
|
+
dueAt: iso4(row2.due_at),
|
|
24626
|
+
nextCheckAt: iso4(row2.next_check_at),
|
|
24627
|
+
closedAt: iso4(row2.closed_at),
|
|
24498
24628
|
reason: row2.close_reason == null ? null : String(row2.close_reason),
|
|
24499
24629
|
verdict: row2.verdict == null ? null : row2.verdict,
|
|
24500
24630
|
category: row2.category == null ? null : String(row2.category),
|
|
@@ -24502,8 +24632,8 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24502
24632
|
closeCertainty: row2.close_certainty == null ? null : Number(row2.close_certainty),
|
|
24503
24633
|
closeSuggestion: closeSuggestionOf(database, row2),
|
|
24504
24634
|
assignments: database.prepare("SELECT assignee_id, role FROM task_assignments WHERE task_id = ? AND assignee_type = 'person' ORDER BY id").all(id2).map((assigned) => ({ to: `person:${assigned.assignee_id}`, role: assigned.role })),
|
|
24505
|
-
createdAt:
|
|
24506
|
-
updatedAt:
|
|
24635
|
+
createdAt: iso4(row2.created_at),
|
|
24636
|
+
updatedAt: iso4(row2.updated_at)
|
|
24507
24637
|
};
|
|
24508
24638
|
}, "detailsOf");
|
|
24509
24639
|
const rowById = /* @__PURE__ */ __name((id2) => database.prepare("SELECT * FROM tasks WHERE id = ?").get(id2), "rowById");
|
|
@@ -24522,12 +24652,12 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24522
24652
|
recordTaskEvent(database, task, actor, event, { [column2]: [before2[column2] ?? null, value] }, at);
|
|
24523
24653
|
}, "change");
|
|
24524
24654
|
if (fields4.title !== void 0) {
|
|
24525
|
-
const title =
|
|
24655
|
+
const title = textOf3(fields4.title, "a task's title", 300);
|
|
24526
24656
|
change("title", title, created ? void 0 : "title");
|
|
24527
24657
|
change("title_folded", folded3(title));
|
|
24528
24658
|
}
|
|
24529
24659
|
if (fields4.description !== void 0)
|
|
24530
|
-
change("description", fields4.description === null ? null :
|
|
24660
|
+
change("description", fields4.description === null ? null : textOf3(fields4.description, "a description", 2e4), created ? void 0 : "description");
|
|
24531
24661
|
if (fields4.priority !== void 0)
|
|
24532
24662
|
change("priority", priorityOf(fields4.priority), "priority");
|
|
24533
24663
|
if (fields4.parent !== void 0)
|
|
@@ -24555,7 +24685,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24555
24685
|
}
|
|
24556
24686
|
}
|
|
24557
24687
|
if (fields4.reason !== void 0) {
|
|
24558
|
-
const reason = fields4.reason === null ? null :
|
|
24688
|
+
const reason = fields4.reason === null ? null : textOf3(fields4.reason, "a reason", 500);
|
|
24559
24689
|
change("close_reason", reason);
|
|
24560
24690
|
change("close_reason_folded", folded3(reason));
|
|
24561
24691
|
}
|
|
@@ -24578,7 +24708,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24578
24708
|
const number3 = Number(counted.tasks_count);
|
|
24579
24709
|
if (!Number.isSafeInteger(number3) || number3 < 1)
|
|
24580
24710
|
throw new CliError("configuration_error", "the project task counter exceeds the safe numbering range");
|
|
24581
|
-
const id2 = Number(database.prepare("INSERT INTO tasks (project_id, number, key, title, title_folded, type, status, author_type, author_id, source, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, 'open', ?, ?, ?, ?, ?) RETURNING id").get(project, number3, `${String(counted.key)}-${number3}`,
|
|
24711
|
+
const id2 = Number(database.prepare("INSERT INTO tasks (project_id, number, key, title, title_folded, type, status, author_type, author_id, source, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, 'open', ?, ?, ?, ?, ?) RETURNING id").get(project, number3, `${String(counted.key)}-${number3}`, textOf3(input.title, "a task's title", 300), folded3(textOf3(input.title, "a task's title", 300)), input.type, actor.type, actor.id, by === "owner" ? "owner" : "agent", at, at)?.id);
|
|
24582
24712
|
recordTaskEvent(database, id2, actor, "created", null, at);
|
|
24583
24713
|
const { title: _title, project: _project, type: _type, ...fields4 } = input;
|
|
24584
24714
|
edit(id2, fields4, actor, true);
|
|
@@ -24657,7 +24787,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24657
24787
|
const row2 = rowById(task);
|
|
24658
24788
|
if (row2.status !== "open")
|
|
24659
24789
|
throw new CliError("validation_error", `task ${String(row2.key)} is ${String(row2.status)}; only an open task is claimed`);
|
|
24660
|
-
throw new CliError("validation_error", `${String(row2.claimed_by)} holds task ${String(row2.key)} until ${
|
|
24790
|
+
throw new CliError("validation_error", `${String(row2.claimed_by)} holds task ${String(row2.key)} until ${iso4(row2.claimed_until)}; wait for it, or ask them to release it`, { reason: "task.claimed", holder: String(row2.claimed_by), until: iso4(row2.claimed_until) });
|
|
24661
24791
|
}
|
|
24662
24792
|
return details2(task);
|
|
24663
24793
|
}, "claim"),
|
|
@@ -24678,7 +24808,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24678
24808
|
kind: row2.kind,
|
|
24679
24809
|
actor: row2.actor_type == null ? null : { type: row2.actor_type, id: Number(row2.actor_id) },
|
|
24680
24810
|
changes: row2.changes == null ? null : JSON.parse(String(row2.changes)),
|
|
24681
|
-
at:
|
|
24811
|
+
at: iso4(row2.created_at)
|
|
24682
24812
|
})), "events")
|
|
24683
24813
|
};
|
|
24684
24814
|
}, "workTaskOperationsOver");
|
|
@@ -24691,7 +24821,7 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
|
|
|
24691
24821
|
};
|
|
24692
24822
|
}, "workTasksOver");
|
|
24693
24823
|
|
|
24694
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24824
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
|
|
24695
24825
|
var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
24696
24826
|
const { database, now: now2 } = context;
|
|
24697
24827
|
const liveRow = /* @__PURE__ */ __name((id2) => {
|
|
@@ -24737,7 +24867,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
|
24737
24867
|
};
|
|
24738
24868
|
}, "taskCloseOver");
|
|
24739
24869
|
|
|
24740
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24870
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
|
|
24741
24871
|
var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
24742
24872
|
const { database, now: now2 } = context;
|
|
24743
24873
|
const required3 = /* @__PURE__ */ __name((id2) => {
|
|
@@ -24955,7 +25085,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
|
24955
25085
|
};
|
|
24956
25086
|
}, "taskPairsOver");
|
|
24957
25087
|
|
|
24958
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25088
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
|
|
24959
25089
|
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";
|
|
24960
25090
|
var taskStoreOver = /* @__PURE__ */ __name((context) => {
|
|
24961
25091
|
const { database, now: now2 } = context;
|
|
@@ -25150,7 +25280,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
|
|
|
25150
25280
|
throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
|
|
25151
25281
|
}, "oneOf");
|
|
25152
25282
|
|
|
25153
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25283
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/accounts.js
|
|
25154
25284
|
var accountAccountsOver = /* @__PURE__ */ __name((context) => {
|
|
25155
25285
|
const { database } = context;
|
|
25156
25286
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
|
|
@@ -25195,7 +25325,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
|
|
|
25195
25325
|
};
|
|
25196
25326
|
}, "accountsStoreOver");
|
|
25197
25327
|
|
|
25198
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25328
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
|
|
25199
25329
|
var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
|
|
25200
25330
|
var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
|
|
25201
25331
|
const message2 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
|
|
@@ -25219,7 +25349,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
|
|
|
25219
25349
|
})), "keepDownloads");
|
|
25220
25350
|
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");
|
|
25221
25351
|
|
|
25222
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25352
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/attachments.js
|
|
25223
25353
|
var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
|
|
25224
25354
|
const { database } = context;
|
|
25225
25355
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -25276,7 +25406,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
25276
25406
|
}, "keepAttachmentText")
|
|
25277
25407
|
}), "attachmentsStoreOver");
|
|
25278
25408
|
|
|
25279
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25409
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
|
|
25280
25410
|
var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
|
|
25281
25411
|
var pointerMover = /* @__PURE__ */ __name((context, type) => {
|
|
25282
25412
|
const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
|
|
@@ -25456,7 +25586,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
|
|
|
25456
25586
|
return done;
|
|
25457
25587
|
}, "rekeyChats");
|
|
25458
25588
|
|
|
25459
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25589
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
|
|
25460
25590
|
var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
|
|
25461
25591
|
var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
|
|
25462
25592
|
var CHAT_LIST_KEY = "chat_list_complete";
|
|
@@ -25488,7 +25618,7 @@ var chatCompleteness = /* @__PURE__ */ __name(({ database }, accountKey, chatIds
|
|
|
25488
25618
|
});
|
|
25489
25619
|
}, "chatCompleteness");
|
|
25490
25620
|
|
|
25491
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25621
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/chats.js
|
|
25492
25622
|
var chatsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
25493
25623
|
const { database } = context;
|
|
25494
25624
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
|
|
@@ -25572,6 +25702,13 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25572
25702
|
const row2 = context.database.prepare("SELECT kind FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId);
|
|
25573
25703
|
return row2 ? String(row2.kind) : void 0;
|
|
25574
25704
|
}, "chatKind"),
|
|
25705
|
+
chatTitle: /* @__PURE__ */ __name(async (key2, chatId) => {
|
|
25706
|
+
const accountKey = findAccountPk2(key2);
|
|
25707
|
+
if (accountKey === void 0)
|
|
25708
|
+
return null;
|
|
25709
|
+
const row2 = context.database.prepare("SELECT title FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId);
|
|
25710
|
+
return row2?.title == null ? null : String(row2.title);
|
|
25711
|
+
}, "chatTitle"),
|
|
25575
25712
|
chatActivity: /* @__PURE__ */ __name(async (key2, since, where) => {
|
|
25576
25713
|
const accountKey = findAccountPk2(key2);
|
|
25577
25714
|
return accountKey === void 0 ? { chats: [], storedAt: null } : chatActivity(context, accountKey, since, where);
|
|
@@ -25588,7 +25725,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25588
25725
|
};
|
|
25589
25726
|
}, "chatsStoreOver");
|
|
25590
25727
|
|
|
25591
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25728
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
|
|
25592
25729
|
import { createHash as createHash6 } from "node:crypto";
|
|
25593
25730
|
var BATCH_CONTEXT = 50;
|
|
25594
25731
|
var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
|
|
@@ -25726,7 +25863,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
|
|
|
25726
25863
|
var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
|
|
25727
25864
|
${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
|
|
25728
25865
|
|
|
25729
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25866
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
|
|
25730
25867
|
import { setTimeout } from "node:timers/promises";
|
|
25731
25868
|
var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
|
|
25732
25869
|
var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
|
|
@@ -26038,7 +26175,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
|
|
|
26038
26175
|
AND NOT EXISTS (SELECT 1 FROM messages d
|
|
26039
26176
|
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");
|
|
26040
26177
|
|
|
26041
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26178
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/conversations.js
|
|
26042
26179
|
var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
26043
26180
|
const { database } = context;
|
|
26044
26181
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -26145,7 +26282,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
26145
26282
|
};
|
|
26146
26283
|
}, "conversationsStoreOver");
|
|
26147
26284
|
|
|
26148
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26285
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/counters.js
|
|
26149
26286
|
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";
|
|
26150
26287
|
var accountCountersOver = /* @__PURE__ */ __name((context) => {
|
|
26151
26288
|
const { database } = context;
|
|
@@ -26170,7 +26307,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
26170
26307
|
counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
|
|
26171
26308
|
}), "countersStoreOver");
|
|
26172
26309
|
|
|
26173
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26310
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
|
|
26174
26311
|
var MENTION_STATUSES = ["found", "linked", "dismissed"];
|
|
26175
26312
|
var MENTION_QUERY = defineQuery({
|
|
26176
26313
|
entity: "mention",
|
|
@@ -26386,7 +26523,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
|
|
|
26386
26523
|
return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
|
|
26387
26524
|
}, "listPlaces");
|
|
26388
26525
|
|
|
26389
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26526
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/mentions.js
|
|
26390
26527
|
var accountMentionsOver = /* @__PURE__ */ __name((context) => {
|
|
26391
26528
|
const { database } = context;
|
|
26392
26529
|
const { findAccountPk: findAccountPk2 } = keysOver(context);
|
|
@@ -26421,7 +26558,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
26421
26558
|
places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
|
|
26422
26559
|
}), "mentionsStoreOver");
|
|
26423
26560
|
|
|
26424
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26561
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
|
|
26425
26562
|
var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
|
|
26426
26563
|
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");
|
|
26427
26564
|
const rows = messageId === void 0 ? read2.all(chatKey) : read2.all(chatKey, messageId);
|
|
@@ -26436,7 +26573,51 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
|
|
|
26436
26573
|
}));
|
|
26437
26574
|
}, "documentLinkMessages");
|
|
26438
26575
|
|
|
26439
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26576
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
|
|
26577
|
+
var stemmerFor = stemmerCache();
|
|
26578
|
+
var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
|
|
26579
|
+
if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
|
|
26580
|
+
throw new CliError("validation_error", "a follow-up lookup takes at most 50 messages and 1\u2013100 results each");
|
|
26581
|
+
const { database } = context;
|
|
26582
|
+
const stemmers = storeStemmers(database);
|
|
26583
|
+
if (!wanted.length || !stemmers || !stemsState(database)?.ready)
|
|
26584
|
+
return wanted.map(() => []);
|
|
26585
|
+
const stemmer = stemmerFor(stemmers);
|
|
26586
|
+
const count = database.prepare("SELECT count(*) AS doc FROM (SELECT rowid FROM message_stems WHERE message_stems MATCH ? LIMIT ?)");
|
|
26587
|
+
const counts = /* @__PURE__ */ new Map();
|
|
26588
|
+
const countOf = /* @__PURE__ */ __name((stem) => {
|
|
26589
|
+
let found2 = counts.get(stem);
|
|
26590
|
+
if (found2 === void 0) {
|
|
26591
|
+
found2 = Number(count.get(`stems : "${stem.replaceAll('"', '""')}"`, rareAt + 1)?.doc ?? 0);
|
|
26592
|
+
counts.set(stem, found2);
|
|
26593
|
+
}
|
|
26594
|
+
return found2;
|
|
26595
|
+
}, "countOf");
|
|
26596
|
+
const message2 = database.prepare(`
|
|
26597
|
+
SELECT m.text, m.sent_at FROM accounts ac
|
|
26598
|
+
JOIN chats c ON c.account_id = ac.id AND c.external_id = ?
|
|
26599
|
+
JOIN messages m ON m.chat_id = c.id AND m.external_id = ?
|
|
26600
|
+
WHERE ac.provider = ? AND ac.external_id = ? AND m.deleted_at IS NULL
|
|
26601
|
+
`);
|
|
26602
|
+
const later = database.prepare(`
|
|
26603
|
+
SELECT m.id FROM message_stems s JOIN messages m ON m.id = s.rowid
|
|
26604
|
+
WHERE message_stems MATCH ? AND m.deleted_at IS NULL AND m.sent_at > ?
|
|
26605
|
+
ORDER BY m.sent_at DESC, m.id DESC LIMIT ?
|
|
26606
|
+
`);
|
|
26607
|
+
return wanted.map(({ account, chatId, id: id2 }) => {
|
|
26608
|
+
const row2 = message2.get(chatId, id2, account.provider, account.account);
|
|
26609
|
+
if (!row2)
|
|
26610
|
+
return [];
|
|
26611
|
+
const stems = new Set(stemmer.explain(String(row2.text)).filter(({ word }) => new RegExp("^\\p{L}{3,}$", "u").test(word)).map(({ word }) => stemmer.stemToken(word)).filter(Boolean));
|
|
26612
|
+
const rare = [...stems].filter((stem) => countOf(stem) <= rareAt);
|
|
26613
|
+
if (!rare.length)
|
|
26614
|
+
return [];
|
|
26615
|
+
const match = `stems : (${rare.map((stem) => `"${stem.replaceAll('"', '""')}"`).join(" OR ")})`;
|
|
26616
|
+
return hitsByPk(context, later.all(match, Number(row2.sent_at), limit).map((one) => Number(one.id)));
|
|
26617
|
+
});
|
|
26618
|
+
}, "laterSharingRare");
|
|
26619
|
+
|
|
26620
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/messages.js
|
|
26440
26621
|
var accountMessagesOver = /* @__PURE__ */ __name((context) => {
|
|
26441
26622
|
const { database } = context;
|
|
26442
26623
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
|
|
@@ -26567,12 +26748,13 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
26567
26748
|
...keyed,
|
|
26568
26749
|
search: /* @__PURE__ */ __name(async (query, { limit, account }) => find(context, { text: query, limit, ...account ? { account } : {} }), "search"),
|
|
26569
26750
|
find: /* @__PURE__ */ __name(async (filter) => find(context, filter), "find"),
|
|
26570
|
-
directReplies: /* @__PURE__ */ __name(async (parents, limit) => directReplies(context, parents, limit), "directReplies")
|
|
26751
|
+
directReplies: /* @__PURE__ */ __name(async (parents, limit) => directReplies(context, parents, limit), "directReplies"),
|
|
26752
|
+
laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
|
|
26571
26753
|
}), "messagesStoreOver");
|
|
26572
26754
|
|
|
26573
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26755
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
|
|
26574
26756
|
var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
|
|
26575
|
-
var
|
|
26757
|
+
var iso5 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
26576
26758
|
var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: accounts2, limit }) => {
|
|
26577
26759
|
const person2 = Number(uid);
|
|
26578
26760
|
if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(person2) || !Number.isSafeInteger(limit) || limit < 1)
|
|
@@ -26593,7 +26775,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
|
|
|
26593
26775
|
statement: String(row2.statement),
|
|
26594
26776
|
subject: row2.subject_type == null ? null : `${row2.subject_type}:${row2.subject_id}`,
|
|
26595
26777
|
project: row2.project_id == null ? null : `project:${row2.project_id}`,
|
|
26596
|
-
updatedAt:
|
|
26778
|
+
updatedAt: iso5(row2.updated_at)
|
|
26597
26779
|
}));
|
|
26598
26780
|
const notes2 = database.prepare(`SELECT n.id,n.title,n.body,n.revision,n.updated_at FROM notes n
|
|
26599
26781
|
JOIN persons owner ON n.author_type='person' AND n.author_id=owner.id AND owner.owner=1
|
|
@@ -26606,7 +26788,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
|
|
|
26606
26788
|
title: row2.title == null ? null : String(row2.title),
|
|
26607
26789
|
text: String(row2.body),
|
|
26608
26790
|
revision: Number(row2.revision),
|
|
26609
|
-
updatedAt:
|
|
26791
|
+
updatedAt: iso5(row2.updated_at)
|
|
26610
26792
|
}));
|
|
26611
26793
|
const tasks2 = database.prepare(`SELECT t.id,t.title,t.due_at,t.project_id,t.source_locator,t.created_at,group_concat(DISTINCT ta.role) AS role
|
|
26612
26794
|
FROM task_assignments ta JOIN tasks t ON t.id=ta.task_id JOIN main.projects p ON p.id=t.project_id
|
|
@@ -26618,16 +26800,16 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
|
|
|
26618
26800
|
ref: `task:${taskIdOf(database, Number(row2.id))}`,
|
|
26619
26801
|
title: String(row2.title),
|
|
26620
26802
|
role: String(row2.role),
|
|
26621
|
-
dueAt:
|
|
26803
|
+
dueAt: iso5(row2.due_at),
|
|
26622
26804
|
project: `project:${row2.project_id}`,
|
|
26623
26805
|
source: row2.source_locator == null ? null : String(row2.source_locator),
|
|
26624
|
-
createdAt:
|
|
26806
|
+
createdAt: iso5(row2.created_at)
|
|
26625
26807
|
}));
|
|
26626
26808
|
return { facts: page3(facts2), notes: page3(notes2), tasks: page3(tasks2) };
|
|
26627
26809
|
});
|
|
26628
26810
|
}, "personPreparation");
|
|
26629
26811
|
|
|
26630
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26812
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
|
|
26631
26813
|
var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
|
|
26632
26814
|
const id2 = Number(uid);
|
|
26633
26815
|
if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
|
|
@@ -26635,7 +26817,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
|
|
|
26635
26817
|
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)));
|
|
26636
26818
|
}, "personSeenInAccounts");
|
|
26637
26819
|
|
|
26638
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26820
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
|
|
26639
26821
|
var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
|
|
26640
26822
|
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);
|
|
26641
26823
|
if (!row2)
|
|
@@ -26701,7 +26883,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
|
|
|
26701
26883
|
return { id: id2, personId, removed: true };
|
|
26702
26884
|
}, "removeNote");
|
|
26703
26885
|
|
|
26704
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26886
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/people.js
|
|
26705
26887
|
var accountPeopleOver = /* @__PURE__ */ __name((context) => {
|
|
26706
26888
|
const { database } = context;
|
|
26707
26889
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
|
|
@@ -26776,13 +26958,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
|
|
|
26776
26958
|
};
|
|
26777
26959
|
}, "peopleStoreOver");
|
|
26778
26960
|
|
|
26779
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26961
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
|
|
26780
26962
|
import { createHash as createHash8 } from "node:crypto";
|
|
26781
26963
|
|
|
26782
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26964
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
|
|
26783
26965
|
import { createHash as createHash7 } from "node:crypto";
|
|
26784
26966
|
|
|
26785
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26967
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
|
|
26786
26968
|
var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
|
|
26787
26969
|
var AUTHOR_MEASURES = [
|
|
26788
26970
|
"messages",
|
|
@@ -26922,7 +27104,7 @@ var withoutUrls = /* @__PURE__ */ __name((text5) => text5.replace(/\S+/gu, (toke
|
|
|
26922
27104
|
var rankingWords = /* @__PURE__ */ __name((text5) => withoutUrls(text5).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
|
|
26923
27105
|
var rankingQuestion = /* @__PURE__ */ __name((text5) => withoutUrls(text5).includes("?"), "rankingQuestion");
|
|
26924
27106
|
|
|
26925
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27107
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
|
|
26926
27108
|
var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
|
|
26927
27109
|
var exhausted2 = /* @__PURE__ */ __name((budget) => {
|
|
26928
27110
|
throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
|
|
@@ -27144,7 +27326,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
|
|
|
27144
27326
|
};
|
|
27145
27327
|
}, "rankReplyGraph");
|
|
27146
27328
|
|
|
27147
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27329
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
|
|
27148
27330
|
var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
|
|
27149
27331
|
var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
|
|
27150
27332
|
var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
|
|
@@ -27318,7 +27500,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
|
|
|
27318
27500
|
return { items, evidence, summary, graph: graph.quality };
|
|
27319
27501
|
}, "calculateAdminStatistics");
|
|
27320
27502
|
|
|
27321
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27503
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
|
|
27322
27504
|
var rankingContextRange = /* @__PURE__ */ __name((root) => {
|
|
27323
27505
|
const dates = [];
|
|
27324
27506
|
const visit = /* @__PURE__ */ __name((node, required3) => {
|
|
@@ -27340,7 +27522,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
|
|
|
27340
27522
|
return dates[0].node.resolution.date;
|
|
27341
27523
|
}, "rankingContextRange");
|
|
27342
27524
|
|
|
27343
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27525
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
|
|
27344
27526
|
var reactionCounts = /* @__PURE__ */ __name((stored3) => {
|
|
27345
27527
|
let counts;
|
|
27346
27528
|
try {
|
|
@@ -27635,7 +27817,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
|
|
|
27635
27817
|
});
|
|
27636
27818
|
}, "rankQuery");
|
|
27637
27819
|
|
|
27638
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27820
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
|
|
27639
27821
|
function fail4(message2, reason = "query.too-large") {
|
|
27640
27822
|
throw new CliError("validation_error", message2, { reason, complete: false });
|
|
27641
27823
|
}
|
|
@@ -27812,7 +27994,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
|
|
|
27812
27994
|
return result;
|
|
27813
27995
|
}), "adminStatisticsQuery");
|
|
27814
27996
|
|
|
27815
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27997
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
|
|
27816
27998
|
var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
|
|
27817
27999
|
if (!execution.accounts.length)
|
|
27818
28000
|
return { conversations: [], chats: [] };
|
|
@@ -27830,7 +28012,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
|
|
|
27830
28012
|
return { conversations: conversations2, chats: chats2 };
|
|
27831
28013
|
}, "conversationEligibility");
|
|
27832
28014
|
|
|
27833
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28015
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
|
|
27834
28016
|
import { createHash as createHash9 } from "node:crypto";
|
|
27835
28017
|
var EVIDENCE_BYTES = 64 * 1024;
|
|
27836
28018
|
var FINGERPRINT_BYTES = 8 * 1024 * 1024;
|
|
@@ -27980,16 +28162,18 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
|
|
|
27980
28162
|
return result;
|
|
27981
28163
|
}, "rankingEvidence");
|
|
27982
28164
|
|
|
27983
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27984
|
-
var queriesStoreOver = /* @__PURE__ */ __name((context,
|
|
28165
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/queries.js
|
|
28166
|
+
var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
|
|
27985
28167
|
const mailIndexed = /* @__PURE__ */ __name((execution) => {
|
|
27986
28168
|
if (execution.corpus === "mail")
|
|
27987
|
-
drainEmailIndex(context.database,
|
|
28169
|
+
drainEmailIndex(context.database, stemmerFor2);
|
|
27988
28170
|
return execution;
|
|
27989
28171
|
}, "mailIndexed");
|
|
27990
28172
|
return {
|
|
27991
28173
|
matchQuery: /* @__PURE__ */ __name(async (execution) => matchQuery(context, mailIndexed(execution)), "matchQuery"),
|
|
27992
28174
|
countQuery: /* @__PURE__ */ __name(async (execution, by) => countQuery(context, mailIndexed(execution), by), "countQuery"),
|
|
28175
|
+
countMatches: /* @__PURE__ */ __name(async (execution, cap) => countMatches(context, mailIndexed(execution), cap), "countMatches"),
|
|
28176
|
+
matchingPks: /* @__PURE__ */ __name(async (execution, cap) => matchingPks(context, mailIndexed(execution), cap), "matchingPks"),
|
|
27993
28177
|
conversationEligibility: /* @__PURE__ */ __name(async (execution) => conversationEligibility(context, execution), "conversationEligibility"),
|
|
27994
28178
|
rankQuery: /* @__PURE__ */ __name(async (execution, request) => rankQuery(context, execution, request), "rankQuery"),
|
|
27995
28179
|
rankingEvidence: /* @__PURE__ */ __name(async (execution, request) => rankingEvidence(context, execution, request), "rankingEvidence"),
|
|
@@ -27997,7 +28181,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor) => {
|
|
|
27997
28181
|
};
|
|
27998
28182
|
}, "queriesStoreOver");
|
|
27999
28183
|
|
|
28000
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28184
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
|
|
28001
28185
|
var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
|
|
28002
28186
|
const { database, now: now2 } = context;
|
|
28003
28187
|
const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
|
|
@@ -28036,10 +28220,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
|
|
|
28036
28220
|
}));
|
|
28037
28221
|
}, "chatEventsOf");
|
|
28038
28222
|
|
|
28039
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28223
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
|
|
28040
28224
|
import { createHash as createHash10 } from "node:crypto";
|
|
28041
28225
|
|
|
28042
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28226
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/calendar.js
|
|
28043
28227
|
var calendarKey = /* @__PURE__ */ __name((zone, by) => {
|
|
28044
28228
|
const format = new Intl.DateTimeFormat("en-CA", {
|
|
28045
28229
|
timeZone: zone,
|
|
@@ -28054,7 +28238,7 @@ var calendarKey = /* @__PURE__ */ __name((zone, by) => {
|
|
|
28054
28238
|
};
|
|
28055
28239
|
}, "calendarKey");
|
|
28056
28240
|
|
|
28057
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28241
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/retention.js
|
|
28058
28242
|
var RETENTION_TOLERANCE = 864e5;
|
|
28059
28243
|
var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
|
|
28060
28244
|
const { since, until, cutoff, checkpoints, within, limit, by } = options;
|
|
@@ -28108,8 +28292,8 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
|
|
|
28108
28292
|
return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
|
|
28109
28293
|
}, "retentionCohorts");
|
|
28110
28294
|
|
|
28111
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28112
|
-
var
|
|
28295
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
|
|
28296
|
+
var iso6 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
|
|
28113
28297
|
var week = /* @__PURE__ */ __name((day) => {
|
|
28114
28298
|
const date3 = /* @__PURE__ */ new Date(`${day}T00:00:00Z`);
|
|
28115
28299
|
date3.setUTCDate(date3.getUTCDate() - (date3.getUTCDay() + 6) % 7);
|
|
@@ -28146,14 +28330,14 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
|
|
|
28146
28330
|
return {
|
|
28147
28331
|
stay: pk,
|
|
28148
28332
|
person: String(row2.person),
|
|
28149
|
-
joinedAt:
|
|
28333
|
+
joinedAt: iso6(joinedAt),
|
|
28150
28334
|
cohort,
|
|
28151
28335
|
checkpoints: options.checkpoints.map((checkpoint) => {
|
|
28152
28336
|
const target = joinedAt + checkpoint;
|
|
28153
28337
|
if (target > options.cutoff)
|
|
28154
28338
|
return {
|
|
28155
28339
|
checkpoint,
|
|
28156
|
-
targetAt:
|
|
28340
|
+
targetAt: iso6(target),
|
|
28157
28341
|
state: "pending",
|
|
28158
28342
|
observedAt: null,
|
|
28159
28343
|
lagMilliseconds: null,
|
|
@@ -28162,22 +28346,22 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
|
|
|
28162
28346
|
const read2 = observationStatement.get(pk, chatPk, target, Math.min(target + RETENTION_TOLERANCE, options.cutoff));
|
|
28163
28347
|
return {
|
|
28164
28348
|
checkpoint,
|
|
28165
|
-
targetAt:
|
|
28349
|
+
targetAt: iso6(target),
|
|
28166
28350
|
state: !read2 ? "unknown" : Number(read2.present) === 1 ? "present" : Number(read2.complete) === 1 ? "absent" : "unknown",
|
|
28167
|
-
observedAt: read2 ?
|
|
28351
|
+
observedAt: read2 ? iso6(Number(read2.observed_at)) : null,
|
|
28168
28352
|
lagMilliseconds: read2 ? Number(read2.observed_at) - target : null,
|
|
28169
28353
|
complete: read2 ? Number(read2.complete) === 1 : null
|
|
28170
28354
|
};
|
|
28171
28355
|
}),
|
|
28172
28356
|
activity: {
|
|
28173
28357
|
state: first !== null && first !== void 0 ? "observed-message" : end > options.cutoff ? "pending" : "no-observed-message",
|
|
28174
|
-
firstMessageAt: first === null || first === void 0 ? null :
|
|
28175
|
-
windowEnd:
|
|
28358
|
+
firstMessageAt: first === null || first === void 0 ? null : iso6(Number(first)),
|
|
28359
|
+
windowEnd: iso6(end),
|
|
28176
28360
|
archiveCovered: covered === true
|
|
28177
28361
|
},
|
|
28178
28362
|
departure: {
|
|
28179
|
-
after: lower === null ? null :
|
|
28180
|
-
atOrBefore: upper === null ? null :
|
|
28363
|
+
after: lower === null ? null : iso6(lower),
|
|
28364
|
+
atOrBefore: upper === null ? null : iso6(upper),
|
|
28181
28365
|
early: upper !== null && upper <= end ? "observed" : lower !== null && lower >= end ? "not-observed" : end > options.cutoff ? "pending" : "unknown"
|
|
28182
28366
|
}
|
|
28183
28367
|
};
|
|
@@ -28221,7 +28405,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
|
|
|
28221
28405
|
const nextCursor = next < selected.length ? Buffer.from(JSON.stringify({ offset: next, fingerprint: fingerprint2, cohort: evidence?.cohort ?? null })).toString("base64url") : null;
|
|
28222
28406
|
return {
|
|
28223
28407
|
chatId,
|
|
28224
|
-
cutoff:
|
|
28408
|
+
cutoff: iso6(options.cutoff),
|
|
28225
28409
|
options,
|
|
28226
28410
|
items: cohorts.slice(0, options.limit),
|
|
28227
28411
|
total: cohorts.length,
|
|
@@ -28244,8 +28428,8 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
|
|
|
28244
28428
|
};
|
|
28245
28429
|
}, "retentionQuery");
|
|
28246
28430
|
|
|
28247
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28248
|
-
var
|
|
28431
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
|
|
28432
|
+
var iso7 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
|
|
28249
28433
|
var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
|
|
28250
28434
|
...isBot === void 0 ? {} : { bot: isBot },
|
|
28251
28435
|
...flagged === void 0 ? {} : { [flagged]: true },
|
|
@@ -28339,10 +28523,10 @@ var memberStaysOf = /* @__PURE__ */ __name(({ orm }, chatKey, since) => orm.sele
|
|
|
28339
28523
|
goneAt: memberStays.leftAt
|
|
28340
28524
|
}).from(memberStays).innerJoin(identities, eq(identities.id, memberStays.identityId)).where(and(eq(memberStays.chatId, chatKey), since === void 0 ? void 0 : or(isNull(memberStays.leftAt), gte(memberStays.leftAt, since)))).orderBy(asc(memberStays.firstSeenAt), asc(memberStays.id)).all().map((row2) => ({
|
|
28341
28525
|
...row2,
|
|
28342
|
-
firstSeenAt:
|
|
28343
|
-
lastSeenAt:
|
|
28344
|
-
joinedAt:
|
|
28345
|
-
goneAt:
|
|
28526
|
+
firstSeenAt: iso7(row2.firstSeenAt),
|
|
28527
|
+
lastSeenAt: iso7(row2.lastSeenAt),
|
|
28528
|
+
joinedAt: iso7(row2.joinedAt),
|
|
28529
|
+
goneAt: iso7(row2.goneAt)
|
|
28346
28530
|
})), "memberStaysOf");
|
|
28347
28531
|
var memberCountsOf = /* @__PURE__ */ __name(({ orm }, chatKey, since) => orm.select({
|
|
28348
28532
|
day: memberCounts.date,
|
|
@@ -28362,7 +28546,7 @@ var profileRevisionsOf = /* @__PURE__ */ __name(({ orm }, chatKey, since) => {
|
|
|
28362
28546
|
}).from(identityRevisions).innerJoin(identities, eq(identities.id, identityRevisions.identityId)).where(and(inArray(identityRevisions.identityId, people2), since === void 0 ? void 0 : gte(identityRevisions.createdAt, since))).orderBy(asc(identityRevisions.createdAt), asc(identityRevisions.id)).all().map((row2) => ({
|
|
28363
28547
|
...row2,
|
|
28364
28548
|
marks: row2.marks ? JSON.parse(row2.marks) : {},
|
|
28365
|
-
capturedAt:
|
|
28549
|
+
capturedAt: iso7(row2.capturedAt)
|
|
28366
28550
|
}));
|
|
28367
28551
|
}, "profileRevisionsOf");
|
|
28368
28552
|
var setTracked = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, tracked) => {
|
|
@@ -28371,11 +28555,11 @@ var setTracked = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, tracked) =
|
|
|
28371
28555
|
var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => context.orm.select({ pk: chats.id, chatId: chats.externalId, title: chats.title, trackedAt: chats.membersTrackedAt }).from(chats).where(and(eq(chats.accountId, accountKey), isNotNull(chats.membersTrackedAt), where ? bound2(where) : void 0)).orderBy(asc(chats.membersTrackedAt)).all().map(({ pk, chatId, title, trackedAt }) => ({
|
|
28372
28556
|
chatId,
|
|
28373
28557
|
title,
|
|
28374
|
-
trackedAt:
|
|
28558
|
+
trackedAt: iso7(trackedAt),
|
|
28375
28559
|
lastCount: memberCountsOf(context, pk).at(-1) ?? null
|
|
28376
28560
|
})), "trackedChats");
|
|
28377
28561
|
|
|
28378
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28562
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/roster.js
|
|
28379
28563
|
var rosterStoreOver = /* @__PURE__ */ __name((context) => {
|
|
28380
28564
|
const { database } = context;
|
|
28381
28565
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
|
|
@@ -28431,7 +28615,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28431
28615
|
};
|
|
28432
28616
|
}, "rosterStoreOver");
|
|
28433
28617
|
|
|
28434
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28618
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
|
|
28435
28619
|
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");
|
|
28436
28620
|
var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
|
|
28437
28621
|
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 ?`);
|
|
@@ -28455,7 +28639,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
|
|
|
28455
28639
|
}
|
|
28456
28640
|
}, "backfillNormalized");
|
|
28457
28641
|
|
|
28458
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28642
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
|
|
28459
28643
|
var INDEX2 = "message_words";
|
|
28460
28644
|
var searchIndexState2 = /* @__PURE__ */ __name((database) => {
|
|
28461
28645
|
const row2 = indexRow(database, INDEX2);
|
|
@@ -28582,7 +28766,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
|
|
|
28582
28766
|
});
|
|
28583
28767
|
}, "resetSearchIndex");
|
|
28584
28768
|
|
|
28585
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28769
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
|
|
28586
28770
|
var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
|
|
28587
28771
|
const filled2 = { stemmed: 0, drained: 0 };
|
|
28588
28772
|
const before2 = stemsState(database);
|
|
@@ -28677,7 +28861,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
|
|
|
28677
28861
|
return resetStems(database, { now: now2 });
|
|
28678
28862
|
}, "followDefaultStemmers");
|
|
28679
28863
|
|
|
28680
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28864
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
|
|
28681
28865
|
var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
|
|
28682
28866
|
var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
|
|
28683
28867
|
const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
|
|
@@ -28699,10 +28883,10 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
|
|
|
28699
28883
|
});
|
|
28700
28884
|
}, "termCandidates");
|
|
28701
28885
|
|
|
28702
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28886
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/search-index.js
|
|
28703
28887
|
var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
|
|
28704
28888
|
const { database } = context;
|
|
28705
|
-
const
|
|
28889
|
+
const stemmerFor2 = stemmerCache();
|
|
28706
28890
|
return {
|
|
28707
28891
|
knownTerms: /* @__PURE__ */ __name(async (terms2) => knownTerms(context, terms2), "knownTerms"),
|
|
28708
28892
|
termCandidates: /* @__PURE__ */ __name(async (trigrams2, lengths) => termCandidates(context, trigrams2, lengths), "termCandidates"),
|
|
@@ -28713,7 +28897,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28713
28897
|
const filled2 = fillStems(database, { now: context.now, ...until ? { until } : {} });
|
|
28714
28898
|
const transcripts = corpusIndexState(database, CORPORA.transcript);
|
|
28715
28899
|
if (transcripts.wanted !== null && (transcripts.pending > 0 || transcripts.built !== transcripts.wanted))
|
|
28716
|
-
drainCorpus(database, CORPORA.transcript,
|
|
28900
|
+
drainCorpus(database, CORPORA.transcript, stemmerFor2, until ? { until } : {});
|
|
28717
28901
|
return filled2;
|
|
28718
28902
|
}, "fillStems"),
|
|
28719
28903
|
stemmers: /* @__PURE__ */ __name(async () => savedStemmers(database), "stemmers"),
|
|
@@ -28721,7 +28905,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28721
28905
|
};
|
|
28722
28906
|
}, "searchIndexStoreOver");
|
|
28723
28907
|
|
|
28724
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28908
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
|
|
28725
28909
|
var HISTORY_KEPT = 1e3;
|
|
28726
28910
|
var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
|
|
28727
28911
|
var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
|
|
@@ -28790,7 +28974,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
|
|
|
28790
28974
|
return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
|
|
28791
28975
|
}, "clearHistory");
|
|
28792
28976
|
|
|
28793
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28977
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/searches.js
|
|
28794
28978
|
var searchesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
28795
28979
|
const { database } = context;
|
|
28796
28980
|
return {
|
|
@@ -28814,7 +28998,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28814
28998
|
};
|
|
28815
28999
|
}, "searchesStoreOver");
|
|
28816
29000
|
|
|
28817
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29001
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
|
|
28818
29002
|
var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
|
|
28819
29003
|
var ACTION_OUTCOMES = ["ok", "refused", "failed"];
|
|
28820
29004
|
var CODE = /^[a-z][a-z0-9_]{0,63}$/;
|
|
@@ -28857,7 +29041,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
|
|
|
28857
29041
|
};
|
|
28858
29042
|
}, "agentActionsStoreOver");
|
|
28859
29043
|
|
|
28860
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29044
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
|
|
28861
29045
|
var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
|
|
28862
29046
|
}) => {
|
|
28863
29047
|
const { database, now: now2 } = context;
|
|
@@ -28916,7 +29100,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
|
|
|
28916
29100
|
};
|
|
28917
29101
|
}, "botUpdateStoreOver");
|
|
28918
29102
|
|
|
28919
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29103
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
|
|
28920
29104
|
var DAY4 = 864e5;
|
|
28921
29105
|
var listEvents = /* @__PURE__ */ __name((database, filter) => {
|
|
28922
29106
|
const clauses = ["e.deleted_at IS NULL"];
|
|
@@ -28935,6 +29119,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
|
|
|
28935
29119
|
}, "dated");
|
|
28936
29120
|
dated("end_date > ?", filter.fromDate, "coalesce(e.ends_at, e.starts_at + 1) > ?", filter.from);
|
|
28937
29121
|
dated("start_date < ?", filter.toDate, "e.starts_at < ?", filter.to);
|
|
29122
|
+
dated("start_date >= ?", filter.startsFromDate, "e.starts_at >= ?", filter.startsFrom);
|
|
28938
29123
|
const longest = /* @__PURE__ */ __name(() => Number(database.prepare("SELECT coalesce(max(ends_at - starts_at), 0) AS ms FROM events WHERE deleted_at IS NULL").get()?.ms ?? 0), "longest");
|
|
28939
29124
|
if (filter.from !== void 0) {
|
|
28940
29125
|
clauses.push("e.starts_at >= ?");
|
|
@@ -28944,6 +29129,10 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
|
|
|
28944
29129
|
clauses.push("e.starts_at < ?");
|
|
28945
29130
|
params.push(filter.to + DAY4);
|
|
28946
29131
|
}
|
|
29132
|
+
if (filter.startsFrom !== void 0 && filter.startsFromDate !== void 0) {
|
|
29133
|
+
clauses.push("e.starts_at >= ?");
|
|
29134
|
+
params.push(filter.startsFrom - DAY4);
|
|
29135
|
+
}
|
|
28947
29136
|
if (filter.calendarId !== void 0) {
|
|
28948
29137
|
clauses.push(entries("ce.calendar_id = ?"));
|
|
28949
29138
|
params.push(filter.calendarId);
|
|
@@ -28996,7 +29185,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
|
|
|
28996
29185
|
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);
|
|
28997
29186
|
}, "listEvents");
|
|
28998
29187
|
|
|
28999
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29188
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
|
|
29000
29189
|
var calendarOf = /* @__PURE__ */ __name((row2) => ({
|
|
29001
29190
|
id: Number(row2.id),
|
|
29002
29191
|
accountId: Number(row2.account_id),
|
|
@@ -29576,7 +29765,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
29576
29765
|
};
|
|
29577
29766
|
}, "eventStoreOver");
|
|
29578
29767
|
|
|
29579
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29768
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
|
|
29580
29769
|
var CATALOG_QUERY = defineQuery({
|
|
29581
29770
|
entity: "document",
|
|
29582
29771
|
backend: "sql",
|
|
@@ -29818,7 +30007,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
29818
30007
|
};
|
|
29819
30008
|
}, "catalogStoreOver");
|
|
29820
30009
|
|
|
29821
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30010
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/context/evidence.js
|
|
29822
30011
|
import { createHash as createHash11 } from "node:crypto";
|
|
29823
30012
|
var CONTEXT_MAX_READ_BYTES = 262144;
|
|
29824
30013
|
var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
|
|
@@ -29916,7 +30105,7 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
|
|
|
29916
30105
|
return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
|
|
29917
30106
|
}, "contextEvidenceRequest");
|
|
29918
30107
|
|
|
29919
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30108
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
|
|
29920
30109
|
var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
|
|
29921
30110
|
var field2 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
|
|
29922
30111
|
CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
|
|
@@ -29929,7 +30118,7 @@ var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
|
|
|
29929
30118
|
THEN 'source-modified' ELSE 'stored-update' END`;
|
|
29930
30119
|
var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field2("sourceUrl")})`;
|
|
29931
30120
|
|
|
29932
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30121
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
|
|
29933
30122
|
var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
|
|
29934
30123
|
const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
|
|
29935
30124
|
signal?.throwIfAborted();
|
|
@@ -30028,7 +30217,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
|
|
|
30028
30217
|
});
|
|
30029
30218
|
}, "readMeetingContextEvidence");
|
|
30030
30219
|
|
|
30031
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30220
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
|
|
30032
30221
|
var corpora = {
|
|
30033
30222
|
message: {
|
|
30034
30223
|
table: "messages",
|
|
@@ -30215,12 +30404,12 @@ var contextEvidenceOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
30215
30404
|
});
|
|
30216
30405
|
}
|
|
30217
30406
|
}), "contextEvidenceOver");
|
|
30218
|
-
var contextIndexOver = /* @__PURE__ */ __name(({ database },
|
|
30407
|
+
var contextIndexOver = /* @__PURE__ */ __name(({ database }, stemmerFor2) => ({
|
|
30219
30408
|
async catchUp({ kinds: kinds2, signal }) {
|
|
30220
30409
|
signal?.throwIfAborted();
|
|
30221
|
-
const mail = kinds2.includes("mail") ? drainEmailIndex(database,
|
|
30410
|
+
const mail = kinds2.includes("mail") ? drainEmailIndex(database, stemmerFor2) : 0;
|
|
30222
30411
|
signal?.throwIfAborted();
|
|
30223
|
-
const documents2 = kinds2.includes("document") ? drainNoteIndex(database,
|
|
30412
|
+
const documents2 = kinds2.includes("document") ? drainNoteIndex(database, stemmerFor2) : 0;
|
|
30224
30413
|
return { mail, documents: documents2 };
|
|
30225
30414
|
}
|
|
30226
30415
|
}), "contextIndexOver");
|
|
@@ -30257,7 +30446,7 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
30257
30446
|
}
|
|
30258
30447
|
}), "contextRecordsOver");
|
|
30259
30448
|
|
|
30260
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30449
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
|
|
30261
30450
|
var NOTE_FIELDS = [
|
|
30262
30451
|
"text",
|
|
30263
30452
|
"exact",
|
|
@@ -30285,7 +30474,7 @@ var CORPORA2 = [
|
|
|
30285
30474
|
type: "document",
|
|
30286
30475
|
noun: "note",
|
|
30287
30476
|
fields: NOTE_FIELDS,
|
|
30288
|
-
view:
|
|
30477
|
+
view: `(SELECT n.id, n.account_id AS folder_id, n.external_id AS path, n.title, coalesce(n.body, '') AS text, n.metadata, ${contextDocumentTime} AS at, n.deleted_at FROM documents n)`,
|
|
30289
30478
|
words: "document_words",
|
|
30290
30479
|
stems: "document_stems",
|
|
30291
30480
|
live: "coalesce(json_extract(n.metadata, '$.catalog.active'), 1)=1",
|
|
@@ -30302,12 +30491,22 @@ var CORPORA2 = [
|
|
|
30302
30491
|
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")
|
|
30303
30492
|
}
|
|
30304
30493
|
];
|
|
30305
|
-
var
|
|
30306
|
-
const offset = query.offset ?? 0;
|
|
30494
|
+
var matchedRows = /* @__PURE__ */ __name((context, query) => {
|
|
30307
30495
|
const chosen = CORPORA2.filter(({ type }) => (query.source === void 0 || query.source === "file" === (type === "document")) && (!query.folderIds?.length || query.withInternal === true || type === "document"));
|
|
30308
|
-
const
|
|
30496
|
+
const idsOf = /* @__PURE__ */ __name((type) => query.refs?.flatMap((ref3) => ref3.startsWith(`${type}:`) ? [Number(ref3.slice(type.length + 1))] : []), "idsOf");
|
|
30497
|
+
const rows = chosen.flatMap((corpus) => {
|
|
30498
|
+
const ids = idsOf(corpus.type);
|
|
30499
|
+
if (ids?.length === 0)
|
|
30500
|
+
return [];
|
|
30501
|
+
return searchCorpus(context, { ...query, ...query.folderIds ? { accountIds: query.folderIds } : {}, ...ids ? { ids } : {} }, corpus);
|
|
30502
|
+
});
|
|
30309
30503
|
const exactFirst = rows.some((row2) => row2.exact !== void 0);
|
|
30310
30504
|
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);
|
|
30505
|
+
return rows;
|
|
30506
|
+
}, "matchedRows");
|
|
30507
|
+
var searchNotes = /* @__PURE__ */ __name((context, query) => {
|
|
30508
|
+
const offset = query.offset ?? 0;
|
|
30509
|
+
const rows = matchedRows(context, query);
|
|
30311
30510
|
const read2 = {
|
|
30312
30511
|
document: context.database.prepare("SELECT * FROM documents WHERE id = ?"),
|
|
30313
30512
|
note: context.database.prepare("SELECT * FROM notes WHERE id = ?")
|
|
@@ -30320,12 +30519,17 @@ var searchNotes = /* @__PURE__ */ __name((context, query) => {
|
|
|
30320
30519
|
ref: note2.ref,
|
|
30321
30520
|
note: note2,
|
|
30322
30521
|
relevance: row2.relevance,
|
|
30323
|
-
...row2.exact === void 0 ? {} : { exact: row2.exact }
|
|
30522
|
+
...row2.exact === void 0 ? {} : { exact: row2.exact },
|
|
30523
|
+
at: new Date(row2.at ?? 0).toISOString()
|
|
30324
30524
|
};
|
|
30325
30525
|
}),
|
|
30326
30526
|
hasMore: rows.length > offset + query.limit
|
|
30327
30527
|
};
|
|
30328
30528
|
}, "searchNotes");
|
|
30529
|
+
var matchingNoteRefs = /* @__PURE__ */ __name((context, query) => {
|
|
30530
|
+
const rows = matchedRows(context, { ...query, newest: true });
|
|
30531
|
+
return { refs: rows.slice(0, query.limit).map(({ type, id: id2 }) => `${type}:${id2}`), hasMore: rows.length > query.limit };
|
|
30532
|
+
}, "matchingNoteRefs");
|
|
30329
30533
|
var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
|
|
30330
30534
|
const { database } = context;
|
|
30331
30535
|
const wordMatch2 = /* @__PURE__ */ __name((match) => ({
|
|
@@ -30466,7 +30670,8 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
|
|
|
30466
30670
|
const scope3 = combine2([
|
|
30467
30671
|
bound3("n.deleted_at IS NULL"),
|
|
30468
30672
|
...corpus.live ? [bound3(corpus.live)] : [],
|
|
30469
|
-
...query.accountIds?.length && corpus.inAccounts ? [corpus.inAccounts(JSON.stringify(query.accountIds))] : []
|
|
30673
|
+
...query.accountIds?.length && corpus.inAccounts ? [corpus.inAccounts(JSON.stringify(query.accountIds))] : [],
|
|
30674
|
+
...query.ids ? [bound3("n.id IN (SELECT value FROM json_each(?))", JSON.stringify(query.ids))] : []
|
|
30470
30675
|
], "AND");
|
|
30471
30676
|
const where = combine2([scope3, expression], "AND");
|
|
30472
30677
|
const ranking = query.newest ? void 0 : required3(query.root, stemmed ? "stems" : "fts");
|
|
@@ -30487,7 +30692,7 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
|
|
|
30487
30692
|
const leaves = [...fragments.entries()].filter(([node]) => !tests.has(node));
|
|
30488
30693
|
const projection = tests.size ? leaves.map(([, fragment], index2) => `, coalesce(${fragment.sql}, 0) AS q${index2}`).join("") : "";
|
|
30489
30694
|
const window = tests.size ? QUERY_LIMITS2.candidates + 1 : query.limit + offset + 1;
|
|
30490
|
-
const rows = database.prepare(`${ctes.length ? `WITH ${ctes.join(", ")} ` : ""}SELECT n
|
|
30695
|
+
const rows = database.prepare(`${ctes.length ? `WITH ${ctes.join(", ")} ` : ""}SELECT ${tests.size ? "n.*" : "n.id, n.at"}, ${ranking ? "f.rank" : "NULL"} AS relevance${exactTier ? ", n.id IN (SELECT id FROM x) AS exact" : ""}${projection}
|
|
30491
30696
|
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);
|
|
30492
30697
|
if (tests.size && rows.length > QUERY_LIMITS2.candidates)
|
|
30493
30698
|
exhausted("candidates");
|
|
@@ -30522,8 +30727,8 @@ var SCAN_PAGE3 = 5e3;
|
|
|
30522
30727
|
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)))";
|
|
30523
30728
|
var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
30524
30729
|
const { database } = context;
|
|
30525
|
-
const
|
|
30526
|
-
const drain = /* @__PURE__ */ __name(() => drainNoteIndex(database,
|
|
30730
|
+
const stemmerFor2 = stemmerCache();
|
|
30731
|
+
const drain = /* @__PURE__ */ __name(() => drainNoteIndex(database, stemmerFor2), "drain");
|
|
30527
30732
|
const read2 = /* @__PURE__ */ __name((type, id2) => {
|
|
30528
30733
|
const row2 = database.prepare(`SELECT * FROM ${type === "document" ? "documents" : "notes"} WHERE id = ?`).get(id2);
|
|
30529
30734
|
return row2 ? type === "document" ? documentOf(row2) : noteOf(row2) : void 0;
|
|
@@ -30542,12 +30747,16 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
30542
30747
|
drain();
|
|
30543
30748
|
return searchNotes(context, query);
|
|
30544
30749
|
}, "search"),
|
|
30750
|
+
matchingRefs: /* @__PURE__ */ __name(async (query) => {
|
|
30751
|
+
drain();
|
|
30752
|
+
return matchingNoteRefs(context, query);
|
|
30753
|
+
}, "matchingRefs"),
|
|
30545
30754
|
indexState: /* @__PURE__ */ __name(async () => noteIndexState(database), "indexState"),
|
|
30546
30755
|
chunksToEmbed: /* @__PURE__ */ __name(async (model, { after: after2, limit }) => {
|
|
30547
30756
|
drain();
|
|
30548
30757
|
const scope3 = live2(void 0, void 0);
|
|
30549
30758
|
const texts2 = /* @__PURE__ */ new Map();
|
|
30550
|
-
const
|
|
30759
|
+
const textOf6 = /* @__PURE__ */ __name((owner) => {
|
|
30551
30760
|
if (!texts2.has(owner)) {
|
|
30552
30761
|
const [type, id2] = owner.split(":");
|
|
30553
30762
|
const note2 = read2(String(type), Number(id2));
|
|
@@ -30560,7 +30769,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
30560
30769
|
WHERE k.content_hash > ?${scope3.sql}
|
|
30561
30770
|
AND NOT EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ? AND v.content_hash = k.content_hash)
|
|
30562
30771
|
GROUP BY k.content_hash ORDER BY k.content_hash LIMIT ?`).all(after2 ?? "", ...scope3.params, model, limit).flatMap((row2) => {
|
|
30563
|
-
const text5 =
|
|
30772
|
+
const text5 = textOf6(String(row2.owner));
|
|
30564
30773
|
return text5 === void 0 ? [] : [{ hash: String(row2.hash), text: text5.slice(Number(row2.start), Number(row2.end)) }];
|
|
30565
30774
|
});
|
|
30566
30775
|
}, "chunksToEmbed"),
|
|
@@ -30642,11 +30851,32 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
30642
30851
|
const note2 = read2(String(type), Number(id2));
|
|
30643
30852
|
return note2 ? [{ ref: note2.ref, note: note2, score, range: { start, end } }] : [];
|
|
30644
30853
|
});
|
|
30645
|
-
}, "nearest")
|
|
30854
|
+
}, "nearest"),
|
|
30855
|
+
scoreNotes: /* @__PURE__ */ __name(async (model, query, refs) => {
|
|
30856
|
+
drain();
|
|
30857
|
+
const scope3 = live2(void 0, void 0, true);
|
|
30858
|
+
const owned = database.prepare(`SELECT k.chunkable_type AS type, k.chunkable_id AS owner, v.vector
|
|
30859
|
+
FROM chunks k JOIN embeddings v ON v.model = ? AND v.content_hash = k.content_hash
|
|
30860
|
+
WHERE k.chunkable_type = ? AND k.chunkable_id IN (SELECT value FROM json_each(?))${scope3.sql}`);
|
|
30861
|
+
const best = /* @__PURE__ */ new Map();
|
|
30862
|
+
for (const type of ["document", "note"]) {
|
|
30863
|
+
const ids = refs.flatMap((ref3) => ref3.startsWith(`${type}:`) ? [Number(ref3.slice(type.length + 1))] : []);
|
|
30864
|
+
if (!ids.length)
|
|
30865
|
+
continue;
|
|
30866
|
+
for (const row2 of owned.all(model, type, JSON.stringify(ids), ...scope3.params)) {
|
|
30867
|
+
const key2 = `${row2.type}:${row2.owner}`;
|
|
30868
|
+
const score = dot(query, row2.vector);
|
|
30869
|
+
if (score > (best.get(key2) ?? Number.NEGATIVE_INFINITY))
|
|
30870
|
+
best.set(key2, score);
|
|
30871
|
+
}
|
|
30872
|
+
}
|
|
30873
|
+
const order = new Map(refs.map((ref3, index2) => [ref3, index2]));
|
|
30874
|
+
return [...best].map(([ref3, score]) => ({ ref: ref3, score })).sort((a, b) => b.score - a.score || (order.get(a.ref) ?? 0) - (order.get(b.ref) ?? 0));
|
|
30875
|
+
}, "scoreNotes")
|
|
30646
30876
|
};
|
|
30647
30877
|
}, "noteSearchOver");
|
|
30648
30878
|
|
|
30649
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30879
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
|
|
30650
30880
|
var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
|
|
30651
30881
|
var inEventAccounts = /* @__PURE__ */ __name((event) => searchableCopy(event, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
|
|
30652
30882
|
var EVENT_CORPUS = {
|
|
@@ -30666,8 +30896,8 @@ var EVENT_CORPUS = {
|
|
|
30666
30896
|
var SCAN_PAGE4 = 5e3;
|
|
30667
30897
|
var eventSearchOver = /* @__PURE__ */ __name((context) => {
|
|
30668
30898
|
const { database } = context;
|
|
30669
|
-
const
|
|
30670
|
-
const drain = /* @__PURE__ */ __name(() => drainCorpus(database, CORPORA.event,
|
|
30899
|
+
const stemmerFor2 = stemmerCache();
|
|
30900
|
+
const drain = /* @__PURE__ */ __name(() => drainCorpus(database, CORPORA.event, stemmerFor2), "drain");
|
|
30671
30901
|
const live2 = /* @__PURE__ */ __name((accountIds) => {
|
|
30672
30902
|
const sql2 = ` AND k.chunkable_type = 'event' AND EXISTS (SELECT 1 FROM events e WHERE e.id = k.chunkable_id AND ${EVENT_LIVE})`;
|
|
30673
30903
|
return accountIds?.length ? { sql: `${sql2} AND ${inEventAccounts("k.chunkable_id")}`, params: [JSON.stringify(accountIds)] } : { sql: sql2, params: [] };
|
|
@@ -30778,7 +31008,7 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
30778
31008
|
};
|
|
30779
31009
|
}, "eventSearchOver");
|
|
30780
31010
|
|
|
30781
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31011
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
|
|
30782
31012
|
var EVIDENCE_FINDINGS_KIND = "evidence_findings";
|
|
30783
31013
|
var reference = /* @__PURE__ */ __name((raw) => {
|
|
30784
31014
|
if (/^document:[1-9]\d*$/.test(raw))
|
|
@@ -30791,7 +31021,7 @@ var reference = /* @__PURE__ */ __name((raw) => {
|
|
|
30791
31021
|
}, "reference");
|
|
30792
31022
|
var validateEvidenceFindings = /* @__PURE__ */ __name((input) => validateFindings(input, { plural: "evidence findings", singular: "evidence finding", cited: "reference", reference }), "validateEvidenceFindings");
|
|
30793
31023
|
|
|
30794
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31024
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/domain/moment.js
|
|
30795
31025
|
var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
|
|
30796
31026
|
try {
|
|
30797
31027
|
return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
|
|
@@ -30803,9 +31033,9 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
|
|
|
30803
31033
|
}
|
|
30804
31034
|
}, "calendarMoment");
|
|
30805
31035
|
|
|
30806
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31036
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
|
|
30807
31037
|
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";
|
|
30808
|
-
var
|
|
31038
|
+
var iso8 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
30809
31039
|
var oneOf4 = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
30810
31040
|
if (typeof value !== "string" || !allowed.includes(value))
|
|
30811
31041
|
throw new CliError("validation_error", `${what} is one of ${allowed.join(", ")}`);
|
|
@@ -30820,8 +31050,8 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
30820
31050
|
statement: String(row2.statement),
|
|
30821
31051
|
status: row2.status,
|
|
30822
31052
|
project: row2.project_id == null ? null : `project:${row2.project_id}`,
|
|
30823
|
-
|
|
30824
|
-
occurredAt: row2.occurred_at == null ? null :
|
|
31053
|
+
...subjectOf(database, row2),
|
|
31054
|
+
occurredAt: row2.occurred_at == null ? null : iso8(row2.occurred_at),
|
|
30825
31055
|
supersedes: row2.supersedes_id == null ? null : `fact:${row2.supersedes_id}`,
|
|
30826
31056
|
author: authorOf(row2),
|
|
30827
31057
|
model: row2.model == null ? null : String(row2.model),
|
|
@@ -30829,8 +31059,8 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
30829
31059
|
scope: row2.scope == null ? null : row2.scope,
|
|
30830
31060
|
source: String(row2.source),
|
|
30831
31061
|
evidence: evidenceOf(context, { type: "fact", id: Number(row2.id) }),
|
|
30832
|
-
createdAt:
|
|
30833
|
-
updatedAt:
|
|
31062
|
+
createdAt: iso8(row2.created_at),
|
|
31063
|
+
updatedAt: iso8(row2.updated_at)
|
|
30834
31064
|
}), "factOf");
|
|
30835
31065
|
const rowOf = /* @__PURE__ */ __name((reference2) => {
|
|
30836
31066
|
const thing = requiredThing(database, reference2.includes(":") ? reference2 : `fact:${reference2}`, "the fact");
|
|
@@ -30841,12 +31071,12 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
30841
31071
|
const accept = /* @__PURE__ */ __name((id2) => {
|
|
30842
31072
|
const row2 = database.prepare("SELECT * FROM facts WHERE id = ?").get(id2);
|
|
30843
31073
|
if (row2.status !== "proposed" && row2.status !== "accepted")
|
|
30844
|
-
throw new CliError("validation_error", `a ${String(row2.status)}
|
|
31074
|
+
throw new CliError("validation_error", `a ${String(row2.status)} fact cannot be accepted`);
|
|
30845
31075
|
const { actor } = authorActor(context, "owner");
|
|
30846
31076
|
const at = now2();
|
|
30847
31077
|
database.prepare("UPDATE facts SET status = 'accepted', confirmed_by_type = ?, confirmed_by_id = ?, updated_at = ? WHERE id = ?").run(actor.type, actor.id, at, id2);
|
|
30848
31078
|
if (row2.supersedes_id != null)
|
|
30849
|
-
database.prepare("UPDATE facts SET status = 'superseded', updated_at = ? WHERE id = ? AND status
|
|
31079
|
+
database.prepare("UPDATE facts SET status = 'superseded', updated_at = ? WHERE id = ? AND status IN ('proposed', 'accepted')").run(at, Number(row2.supersedes_id));
|
|
30850
31080
|
}, "accept");
|
|
30851
31081
|
return {
|
|
30852
31082
|
add: /* @__PURE__ */ __name((input) => {
|
|
@@ -30858,20 +31088,18 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
30858
31088
|
const occurredAt = input.occurredAt === void 0 ? null : calendarMoment(input.occurredAt, "occurredAt");
|
|
30859
31089
|
if (occurredAt !== null && !Number.isFinite(occurredAt))
|
|
30860
31090
|
throw new CliError("validation_error", "occurredAt takes an ISO timestamp");
|
|
30861
|
-
if (input.supersedes !== void 0 && type !== "decision")
|
|
30862
|
-
throw new CliError("validation_error", "only a decision supersedes another");
|
|
30863
31091
|
const id2 = write(database, () => {
|
|
30864
31092
|
const project = input.project === void 0 ? void 0 : requiredThing(database, input.project, "the project");
|
|
30865
31093
|
if (project && project.type !== "project")
|
|
30866
31094
|
throw new CliError("validation_error", `${input.project} is not a project`);
|
|
30867
31095
|
const subject2 = input.subject === void 0 ? void 0 : requiredThing(database, input.subject, "the subject");
|
|
30868
31096
|
const replaced = input.supersedes === void 0 ? void 0 : rowOf(input.supersedes);
|
|
30869
|
-
if (replaced && replaced.
|
|
30870
|
-
throw new CliError("validation_error", `${input.supersedes} is
|
|
31097
|
+
if (replaced && replaced.status !== "proposed" && replaced.status !== "accepted")
|
|
31098
|
+
throw new CliError("validation_error", `${input.supersedes} is ${String(replaced.status)}; only a proposed or accepted fact can be corrected`);
|
|
30871
31099
|
const owner = input.by === "owner";
|
|
30872
31100
|
const { actor, model } = authorActor(context, input.by);
|
|
30873
31101
|
const at = now2();
|
|
30874
|
-
const made = Number(database.prepare("INSERT INTO facts (type, statement, status, project_id, subject_type, subject_id, occurred_at, supersedes_id, author_type, author_id, model, scope, source, created_at, updated_at) VALUES (?, ?, 'proposed', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(type, statement, project?.id ?? null, subject2?.type ?? null, subject2?.id ?? null, occurredAt, replaced === void 0 ? null : Number(replaced.id), actor.type, actor.id, model, scope3, owner ? "owner" : "agent", at, at)?.id);
|
|
31102
|
+
const made = Number(database.prepare("INSERT INTO facts (id, type, statement, status, project_id, subject_type, subject_id, occurred_at, supersedes_id, author_type, author_id, model, scope, source, created_at, updated_at) VALUES (?, ?, ?, 'proposed', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(nextId(database, "facts"), type, statement, project?.id ?? null, subject2?.type ?? null, subject2?.id ?? null, occurredAt, replaced === void 0 ? null : Number(replaced.id), actor.type, actor.id, model, scope3, owner ? "owner" : "agent", at, at)?.id);
|
|
30875
31103
|
linkEvidence(context, { type: "fact", id: made }, input.evidence ?? [], owner ? "owner" : "agent");
|
|
30876
31104
|
if (input.createdFrom !== void 0) {
|
|
30877
31105
|
const from2 = requiredThing(database, input.createdFrom, "the source");
|
|
@@ -30902,9 +31130,44 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
30902
31130
|
throw new CliError("validation_error", "only an accepted decision can be reversed");
|
|
30903
31131
|
database.prepare("UPDATE facts SET status = 'reversed', updated_at = ? WHERE id = ?").run(now2(), Number(row2.id));
|
|
30904
31132
|
return factOf(rowOf(reference2));
|
|
30905
|
-
}, "reverse")
|
|
31133
|
+
}, "reverse"),
|
|
31134
|
+
reject: /* @__PURE__ */ __name((reference2) => {
|
|
31135
|
+
const row2 = rowOf(reference2);
|
|
31136
|
+
if (row2.status !== "proposed")
|
|
31137
|
+
throw new CliError("validation_error", `only a proposed fact can be rejected; this one is ${String(row2.status)}`);
|
|
31138
|
+
database.prepare("UPDATE facts SET status = 'rejected', updated_at = ? WHERE id = ?").run(now2(), Number(row2.id));
|
|
31139
|
+
return factOf(rowOf(reference2));
|
|
31140
|
+
}, "reject"),
|
|
31141
|
+
remove: /* @__PURE__ */ __name((reference2) => {
|
|
31142
|
+
const row2 = rowOf(reference2);
|
|
31143
|
+
const id2 = Number(row2.id);
|
|
31144
|
+
const twin = row2.source === "memory" && row2.metadata != null ? migratedFrom(String(row2.metadata)) : void 0;
|
|
31145
|
+
const links2 = erase(database, () => {
|
|
31146
|
+
keepHighestId(database, "facts", now2());
|
|
31147
|
+
if (twin !== void 0)
|
|
31148
|
+
keepHighestId(database, "memories", now2());
|
|
31149
|
+
database.prepare("UPDATE facts SET supersedes_id = NULL WHERE supersedes_id = ?").run(id2);
|
|
31150
|
+
const count = dropLinksOf(database, { type: "fact", id: id2 });
|
|
31151
|
+
database.prepare("DELETE FROM links WHERE from_type = 'fact' AND from_id = ?").run(id2);
|
|
31152
|
+
database.prepare("DELETE FROM taggings WHERE taggable_type = 'fact' AND taggable_id = ?").run(id2);
|
|
31153
|
+
database.prepare("DELETE FROM facts WHERE id = ?").run(id2);
|
|
31154
|
+
if (twin !== void 0)
|
|
31155
|
+
database.prepare("DELETE FROM memories WHERE id = ? AND deleted_at IS NOT NULL").run(twin);
|
|
31156
|
+
return count;
|
|
31157
|
+
});
|
|
31158
|
+
return { ref: `fact:${id2}`, removed: true, links: links2 };
|
|
31159
|
+
}, "remove"),
|
|
31160
|
+
sources: /* @__PURE__ */ __name((reference2) => evidenceSourcesOf(database, { type: "fact", id: Number(rowOf(reference2).id) }), "sources")
|
|
30906
31161
|
};
|
|
30907
31162
|
}, "factOperationsOver");
|
|
31163
|
+
var migratedFrom = /* @__PURE__ */ __name((metadata3) => {
|
|
31164
|
+
try {
|
|
31165
|
+
const { memory } = JSON.parse(metadata3);
|
|
31166
|
+
return Number.isInteger(memory) ? Number(memory) : void 0;
|
|
31167
|
+
} catch {
|
|
31168
|
+
return void 0;
|
|
31169
|
+
}
|
|
31170
|
+
}, "migratedFrom");
|
|
30908
31171
|
var factsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
30909
31172
|
const operations = factOperationsOver(context);
|
|
30910
31173
|
return {
|
|
@@ -30912,11 +31175,14 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
30912
31175
|
get: /* @__PURE__ */ __name(async (reference2) => operations.get(reference2), "get"),
|
|
30913
31176
|
list: /* @__PURE__ */ __name(async (options) => operations.list(options), "list"),
|
|
30914
31177
|
accept: /* @__PURE__ */ __name(async (reference2) => operations.accept(reference2), "accept"),
|
|
30915
|
-
reverse: /* @__PURE__ */ __name(async (reference2) => operations.reverse(reference2), "reverse")
|
|
31178
|
+
reverse: /* @__PURE__ */ __name(async (reference2) => operations.reverse(reference2), "reverse"),
|
|
31179
|
+
reject: /* @__PURE__ */ __name(async (reference2) => operations.reject(reference2), "reject"),
|
|
31180
|
+
remove: /* @__PURE__ */ __name(async (reference2) => operations.remove(reference2), "remove"),
|
|
31181
|
+
sources: /* @__PURE__ */ __name(async (reference2) => operations.sources(reference2), "sources")
|
|
30916
31182
|
};
|
|
30917
31183
|
}, "factsStoreOver");
|
|
30918
31184
|
|
|
30919
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31185
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
|
|
30920
31186
|
var invalid4 = /* @__PURE__ */ __name((message2) => {
|
|
30921
31187
|
throw new CliError("validation_error", message2);
|
|
30922
31188
|
}, "invalid");
|
|
@@ -31006,10 +31272,10 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
|
|
|
31006
31272
|
return { snapshot: snapshot2, snapshotParts, previous, outcomes };
|
|
31007
31273
|
}, "findingsCoreOver");
|
|
31008
31274
|
|
|
31009
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31275
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
|
|
31010
31276
|
var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
|
|
31011
31277
|
var PROPOSAL_VERDICTS = ["useful", "not_useful"];
|
|
31012
|
-
var
|
|
31278
|
+
var iso9 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
31013
31279
|
var NAMED4 = "SELECT p.*, b.name AS proposer_name FROM proposed_actions p LEFT JOIN bots b ON p.proposed_by_type = 'bot' AND b.id = p.proposed_by_id";
|
|
31014
31280
|
var json2 = /* @__PURE__ */ __name((value) => value == null ? null : JSON.parse(String(value)), "json");
|
|
31015
31281
|
var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
@@ -31030,12 +31296,12 @@ var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
31030
31296
|
name: row2.proposer_name == null ? null : String(row2.proposer_name)
|
|
31031
31297
|
},
|
|
31032
31298
|
decidedBy: row2.decided_by_type == null ? null : { type: row2.decided_by_type, id: String(row2.decided_by_id) },
|
|
31033
|
-
decidedAt:
|
|
31034
|
-
executedAt:
|
|
31299
|
+
decidedAt: iso9(row2.decided_at),
|
|
31300
|
+
executedAt: iso9(row2.executed_at),
|
|
31035
31301
|
result: json2(row2.result),
|
|
31036
31302
|
error: row2.error == null ? null : String(row2.error),
|
|
31037
31303
|
verdict: row2.verdict ?? null,
|
|
31038
|
-
createdAt:
|
|
31304
|
+
createdAt: iso9(row2.created_at)
|
|
31039
31305
|
};
|
|
31040
31306
|
}, "actionOf");
|
|
31041
31307
|
const rowOf = /* @__PURE__ */ __name((id2) => {
|
|
@@ -31152,7 +31418,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
31152
31418
|
};
|
|
31153
31419
|
}, "proposedActionsStoreOver");
|
|
31154
31420
|
|
|
31155
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31421
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
|
|
31156
31422
|
var stale = /* @__PURE__ */ __name(() => {
|
|
31157
31423
|
throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
|
|
31158
31424
|
reason: "evidence-findings.stale"
|
|
@@ -31318,7 +31584,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
31318
31584
|
};
|
|
31319
31585
|
}, "evidenceFindingsStoreOver");
|
|
31320
31586
|
|
|
31321
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31587
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
|
|
31322
31588
|
var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
|
|
31323
31589
|
var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
|
|
31324
31590
|
rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
|
|
@@ -31371,7 +31637,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
31371
31637
|
}, "forPerson")
|
|
31372
31638
|
}), "involvementStoreOver");
|
|
31373
31639
|
|
|
31374
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31640
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
|
|
31375
31641
|
import { createHash as createHash12 } from "node:crypto";
|
|
31376
31642
|
var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
|
|
31377
31643
|
var id = /* @__PURE__ */ __name((value) => {
|
|
@@ -31457,16 +31723,16 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
|
|
|
31457
31723
|
};
|
|
31458
31724
|
}, "meetingProjectsStoreOver");
|
|
31459
31725
|
|
|
31460
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31726
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
|
|
31461
31727
|
import { createHash as createHash15 } from "node:crypto";
|
|
31462
31728
|
|
|
31463
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31729
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
|
|
31464
31730
|
import { createHash as createHash14 } from "node:crypto";
|
|
31465
31731
|
|
|
31466
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31732
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
|
|
31467
31733
|
import { createHash as createHash13 } from "node:crypto";
|
|
31468
31734
|
|
|
31469
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31735
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
|
|
31470
31736
|
var consolidationId = /* @__PURE__ */ __name((value, field3) => {
|
|
31471
31737
|
if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
31472
31738
|
throw new CliError("validation_error", `${field3} must be a positive canonical tag id`);
|
|
@@ -31517,7 +31783,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
|
|
|
31517
31783
|
return input;
|
|
31518
31784
|
}, "consolidationApplyInput");
|
|
31519
31785
|
|
|
31520
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31786
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
|
|
31521
31787
|
var receiptOf = /* @__PURE__ */ __name((row2) => ({
|
|
31522
31788
|
id: String(row2.id),
|
|
31523
31789
|
sourceId: String(row2.source_id),
|
|
@@ -31592,7 +31858,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
|
|
|
31592
31858
|
}, { beforeCommit: check3 });
|
|
31593
31859
|
}, "applyTagConsolidation");
|
|
31594
31860
|
|
|
31595
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31861
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
|
|
31596
31862
|
var selections = [
|
|
31597
31863
|
["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
|
|
31598
31864
|
["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
|
|
@@ -31736,7 +32002,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
|
|
|
31736
32002
|
};
|
|
31737
32003
|
}, "previewRows");
|
|
31738
32004
|
|
|
31739
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32005
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
|
|
31740
32006
|
var kinds = ["project", "tag", "topic"];
|
|
31741
32007
|
var cancelled2 = /* @__PURE__ */ __name((signal) => {
|
|
31742
32008
|
if (signal?.aborted)
|
|
@@ -32000,18 +32266,18 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32000
32266
|
};
|
|
32001
32267
|
}, "vocabularyStoreOver");
|
|
32002
32268
|
|
|
32003
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32269
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
|
|
32004
32270
|
var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
|
|
32005
32271
|
var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
|
|
32006
32272
|
var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
|
|
32007
32273
|
var SCOPES = ["personal", "work"];
|
|
32008
|
-
var
|
|
32274
|
+
var iso10 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
32009
32275
|
var bounded2 = /* @__PURE__ */ __name((limit = 100, offset = 0) => {
|
|
32010
32276
|
if (!Number.isInteger(limit) || limit < 1 || limit > 500 || !Number.isInteger(offset) || offset < 0 || offset > 1e5)
|
|
32011
32277
|
throw new CliError("validation_error", "limit takes 1\u2013500 and offset takes 0\u2013100000");
|
|
32012
32278
|
return { limit, offset };
|
|
32013
32279
|
}, "bounded");
|
|
32014
|
-
var
|
|
32280
|
+
var textOf4 = /* @__PURE__ */ __name((text5, max = 1e5) => {
|
|
32015
32281
|
const value = text5.trim();
|
|
32016
32282
|
if (!value || value.length > max)
|
|
32017
32283
|
throw new CliError("validation_error", `text takes 1\u2013${max} characters`);
|
|
@@ -32138,8 +32404,8 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32138
32404
|
text: String(row2.body),
|
|
32139
32405
|
revision: Number(row2.revision),
|
|
32140
32406
|
authoredBy: "owner",
|
|
32141
|
-
createdAt:
|
|
32142
|
-
updatedAt:
|
|
32407
|
+
createdAt: iso10(row2.created_at),
|
|
32408
|
+
updatedAt: iso10(row2.updated_at)
|
|
32143
32409
|
};
|
|
32144
32410
|
}, "annotationOf");
|
|
32145
32411
|
const noteRow = /* @__PURE__ */ __name((id2) => /^\d+$/.test(id2) ? database.prepare("SELECT * FROM notes WHERE id = ? AND deleted_at IS NULL").get(Number(id2)) : void 0, "noteRow");
|
|
@@ -32157,7 +32423,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32157
32423
|
kind: row2.kind,
|
|
32158
32424
|
name: String(row2.name),
|
|
32159
32425
|
scope: row2.scope,
|
|
32160
|
-
createdAt:
|
|
32426
|
+
createdAt: iso10(row2.created_at)
|
|
32161
32427
|
}), "organizationOf");
|
|
32162
32428
|
const projectOf = /* @__PURE__ */ __name((row2) => ({
|
|
32163
32429
|
id: String(row2.id),
|
|
@@ -32168,7 +32434,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32168
32434
|
type: row2.type,
|
|
32169
32435
|
organizationId: row2.organization_id == null ? null : String(row2.organization_id),
|
|
32170
32436
|
scope: row2.scope,
|
|
32171
|
-
createdAt:
|
|
32437
|
+
createdAt: iso10(row2.created_at)
|
|
32172
32438
|
}), "projectOf");
|
|
32173
32439
|
const relationOf = /* @__PURE__ */ __name((link3) => ({
|
|
32174
32440
|
id: link3.id,
|
|
@@ -32205,7 +32471,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32205
32471
|
const reminderOf = /* @__PURE__ */ __name((row2) => ({
|
|
32206
32472
|
id: String(row2.id),
|
|
32207
32473
|
task: taskIdOf(database, Number(row2.task_id)) ?? String(row2.task_id),
|
|
32208
|
-
dueAt:
|
|
32474
|
+
dueAt: iso10(row2.due_at),
|
|
32209
32475
|
timezone: String(row2.timezone),
|
|
32210
32476
|
state: row2.state,
|
|
32211
32477
|
revision: Number(row2.revision),
|
|
@@ -32247,7 +32513,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32247
32513
|
return { items: rows.slice(0, limit).map((row2) => String(row2.id ?? row2.key)), hasMore: rows.length > limit };
|
|
32248
32514
|
}, "taskIds"),
|
|
32249
32515
|
addAnnotation: /* @__PURE__ */ __name(async (key2, target, text5) => {
|
|
32250
|
-
const body2 =
|
|
32516
|
+
const body2 = textOf4(text5);
|
|
32251
32517
|
if (subfolder(target) !== null)
|
|
32252
32518
|
throw new CliError("validation_error", "annotate a folder, not one of its subfolders");
|
|
32253
32519
|
const thing = available(key2, target);
|
|
@@ -32272,7 +32538,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32272
32538
|
annotation: /* @__PURE__ */ __name(async (key2, id2) => annotation(key2, id2), "annotation"),
|
|
32273
32539
|
editAnnotation: /* @__PURE__ */ __name(async (key2, id2, text5, revision2) => {
|
|
32274
32540
|
const held = annotation(key2, id2);
|
|
32275
|
-
const changed = database.prepare("UPDATE notes SET body=?, revision=revision+1, updated_at=? WHERE id=? AND revision=?").run(
|
|
32541
|
+
const changed = database.prepare("UPDATE notes SET body=?, revision=revision+1, updated_at=? WHERE id=? AND revision=?").run(textOf4(text5), now2(), Number(id2), revision2).changes;
|
|
32276
32542
|
if (!changed)
|
|
32277
32543
|
throw new CliError("validation_error", "annotation changed; read the current revision before editing");
|
|
32278
32544
|
database.prepare("INSERT INTO note_revisions (note_id, body, revision, created_at) VALUES (?, ?, ?, ?)").run(Number(id2), held.text, held.revision, now2());
|
|
@@ -32345,7 +32611,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32345
32611
|
}, "labelled"),
|
|
32346
32612
|
addOrganization: /* @__PURE__ */ __name(async ({ kind: kind3, name, scope: scope3 = "personal" }) => {
|
|
32347
32613
|
const at = now2();
|
|
32348
|
-
const row2 = database.prepare("INSERT INTO organizations (kind, name, scope, created_at, updated_at) VALUES (?, ?, ?, ?, ?) RETURNING *").get(oneOf5(kind3, ORGANIZATION_KINDS, "an organization's kind"),
|
|
32614
|
+
const row2 = database.prepare("INSERT INTO organizations (kind, name, scope, created_at, updated_at) VALUES (?, ?, ?, ?, ?) RETURNING *").get(oneOf5(kind3, ORGANIZATION_KINDS, "an organization's kind"), textOf4(name, 200), oneOf5(scope3, SCOPES, "a scope"), at, at);
|
|
32349
32615
|
return organizationOf(row2);
|
|
32350
32616
|
}, "addOrganization"),
|
|
32351
32617
|
organizations: /* @__PURE__ */ __name(async (query) => {
|
|
@@ -32358,7 +32624,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32358
32624
|
return database.prepare(`SELECT * FROM organizations WHERE deleted_at IS NULL${where ? ` AND (${where.sql})` : ""} ORDER BY name, id LIMIT 500`).all(...where?.params ?? []).map(organizationOf);
|
|
32359
32625
|
}, "organizations"),
|
|
32360
32626
|
addProject: /* @__PURE__ */ __name(async ({ name, key: key2, type = "other", organization, scope: scope3 = "personal", description }) => write(database, () => {
|
|
32361
|
-
const title =
|
|
32627
|
+
const title = textOf4(name, 200);
|
|
32362
32628
|
const organizationId = organization === void 0 ? null : (() => {
|
|
32363
32629
|
const thing = thingOf(database, organization);
|
|
32364
32630
|
if (thing?.type !== "organization")
|
|
@@ -32393,7 +32659,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32393
32659
|
chosen = `${wanted.slice(0, 4 - suffix.length)}${suffix}`;
|
|
32394
32660
|
}
|
|
32395
32661
|
const at = now2();
|
|
32396
|
-
const row2 = database.prepare("INSERT INTO projects (key, name, name_folded, description, type, organization_id, scope, tasks_count, status, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, 0, 'active', ?, ?) RETURNING *").get(chosen, title, fold(title), description === void 0 ? null :
|
|
32662
|
+
const row2 = database.prepare("INSERT INTO projects (key, name, name_folded, description, type, organization_id, scope, tasks_count, status, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, 0, 'active', ?, ?) RETURNING *").get(chosen, title, fold(title), description === void 0 ? null : textOf4(description, 2e3), oneOf5(type, PROJECT_TYPES, "a project's type"), organizationId, oneOf5(scope3, SCOPES, "a scope"), at, at);
|
|
32397
32663
|
return projectOf(row2);
|
|
32398
32664
|
}), "addProject"),
|
|
32399
32665
|
projects: /* @__PURE__ */ __name(async (query) => {
|
|
@@ -32522,7 +32788,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
|
|
|
32522
32788
|
return key2.padEnd(3, "X");
|
|
32523
32789
|
}, "projectKey");
|
|
32524
32790
|
|
|
32525
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32791
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
|
|
32526
32792
|
var DAY5 = 864e5;
|
|
32527
32793
|
var SETTING4 = "logs_pruned_at";
|
|
32528
32794
|
var LOG_RETENTION = { agentActionsMs: 90 * DAY5, botUpdatePayloadsMs: 30 * DAY5 };
|
|
@@ -32549,7 +32815,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
|
|
|
32549
32815
|
};
|
|
32550
32816
|
}, "logPruner");
|
|
32551
32817
|
|
|
32552
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32818
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
|
|
32553
32819
|
var stale2 = /* @__PURE__ */ __name(() => {
|
|
32554
32820
|
throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
|
|
32555
32821
|
reason: "meeting-findings.stale"
|
|
@@ -32718,7 +32984,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32718
32984
|
};
|
|
32719
32985
|
}, "meetingFindingsStoreOver");
|
|
32720
32986
|
|
|
32721
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32987
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
|
|
32722
32988
|
var RANK_BATCH = 512;
|
|
32723
32989
|
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";
|
|
32724
32990
|
var limitOf = /* @__PURE__ */ __name((value, name, max = 1e3) => {
|
|
@@ -32738,7 +33004,7 @@ var modelOf = /* @__PURE__ */ __name((model) => {
|
|
|
32738
33004
|
var missing3 = /* @__PURE__ */ __name(() => {
|
|
32739
33005
|
throw new CliError("not_found", "Current transcript not found");
|
|
32740
33006
|
}, "missing");
|
|
32741
|
-
var
|
|
33007
|
+
var textOf5 = /* @__PURE__ */ __name((context, accountId, transcriptId, budget, signal) => {
|
|
32742
33008
|
const maxRows = limitOf(budget.maxRows ?? 1e4, "maxRows", 1e5);
|
|
32743
33009
|
const maxBytes = limitOf(budget.maxTextBytes ?? 4 * 1024 * 1024, "maxTextBytes", 64 * 1024 * 1024);
|
|
32744
33010
|
const parent2 = context.database.prepare("SELECT m.id AS meeting_id FROM meeting_transcripts t JOIN meetings m ON m.id=t.meeting_id WHERE t.id=? AND m.account_id=? AND m.deleted_at IS NULL AND t.deleted_at IS NULL AND t.superseded_at IS NULL").get(transcriptId, accountId) ?? missing3();
|
|
@@ -32772,14 +33038,14 @@ var textLoader = /* @__PURE__ */ __name((context, input) => {
|
|
|
32772
33038
|
return existing;
|
|
32773
33039
|
if (remaining <= 0)
|
|
32774
33040
|
throw new CliError("validation_error", "Vector operation exceeds its aggregate text read budget");
|
|
32775
|
-
const document =
|
|
33041
|
+
const document = textOf5(context, input.accountId, id2, { ...input, maxTextBytes: remaining }, input.signal);
|
|
32776
33042
|
remaining -= document.readBytes;
|
|
32777
33043
|
loaded3.set(id2, document);
|
|
32778
33044
|
return document;
|
|
32779
33045
|
};
|
|
32780
33046
|
}, "textLoader");
|
|
32781
33047
|
var chunkText = /* @__PURE__ */ __name((context, accountId, row2, budget, signal, loaded3) => {
|
|
32782
|
-
const document = loaded3 ??
|
|
33048
|
+
const document = loaded3 ?? textOf5(context, accountId, Number(row2.chunkable_id), budget, signal);
|
|
32783
33049
|
const start = Number(row2.start_offset), end = Number(row2.end_offset);
|
|
32784
33050
|
const text5 = document.text.slice(start, end);
|
|
32785
33051
|
if (chunkHash(text5) !== String(row2.content_hash))
|
|
@@ -32989,7 +33255,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
|
|
|
32989
33255
|
}
|
|
32990
33256
|
}), "meetingVectorsOver");
|
|
32991
33257
|
|
|
32992
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33258
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
|
|
32993
33259
|
var OTHER_SOURCES = ["document", "note", "email"];
|
|
32994
33260
|
var TEXTS = {
|
|
32995
33261
|
document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
|
|
@@ -33090,11 +33356,11 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
33090
33356
|
};
|
|
33091
33357
|
}, "sourceMentionStoreOver");
|
|
33092
33358
|
|
|
33093
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33359
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
|
|
33094
33360
|
import { mkdirSync, statSync, writeFileSync } from "node:fs";
|
|
33095
33361
|
import { dirname } from "node:path";
|
|
33096
33362
|
|
|
33097
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33363
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
|
|
33098
33364
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
33099
33365
|
var CLIENTS_SETTING = "clients";
|
|
33100
33366
|
var coreVersion = (() => {
|
|
@@ -33152,7 +33418,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
|
|
|
33152
33418
|
return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
|
|
33153
33419
|
}, "refusalAdvice");
|
|
33154
33420
|
|
|
33155
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33421
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
|
|
33156
33422
|
var GENERATED = [
|
|
33157
33423
|
{
|
|
33158
33424
|
"name": "20261010184427_initial",
|
|
@@ -34018,7 +34284,7 @@ WHERE json_type(params, '$.selection') = 'object';`
|
|
|
34018
34284
|
}
|
|
34019
34285
|
];
|
|
34020
34286
|
|
|
34021
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34287
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
|
|
34022
34288
|
var MANIFEST = [
|
|
34023
34289
|
{ name: "20261010184427_initial", version: 1, minCompatible: 1 },
|
|
34024
34290
|
{ name: "20261011035353_version-2-facts", version: 2, minCompatible: 1 },
|
|
@@ -34096,7 +34362,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
|
|
|
34096
34362
|
return migrations;
|
|
34097
34363
|
}, "generatedMigrations");
|
|
34098
34364
|
|
|
34099
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34365
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/migrations.js
|
|
34100
34366
|
var MIGRATIONS = generatedMigrations();
|
|
34101
34367
|
var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
34102
34368
|
version INTEGER PRIMARY KEY,
|
|
@@ -34149,7 +34415,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
|
|
|
34149
34415
|
}
|
|
34150
34416
|
}, "migrate");
|
|
34151
34417
|
|
|
34152
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34418
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
|
|
34153
34419
|
var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
34154
34420
|
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 ?");
|
|
34155
34421
|
if (pending.get(0, 1) === void 0)
|
|
@@ -34171,7 +34437,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
|
34171
34437
|
}
|
|
34172
34438
|
}, "fillJoinKeys");
|
|
34173
34439
|
|
|
34174
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34440
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
|
|
34175
34441
|
var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
|
|
34176
34442
|
const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
|
|
34177
34443
|
try {
|
|
@@ -34184,8 +34450,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
|
|
|
34184
34450
|
}, "openSqlite");
|
|
34185
34451
|
var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
34186
34452
|
quietSqliteWarning();
|
|
34187
|
-
const { drizzle } = await import("./node-
|
|
34188
|
-
const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-
|
|
34453
|
+
const { drizzle } = await import("./node-VBZAZHUS.js");
|
|
34454
|
+
const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-C3V64OAL.js");
|
|
34189
34455
|
const client = await nodeClient(path, { readOnly });
|
|
34190
34456
|
try {
|
|
34191
34457
|
return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
|
|
@@ -34195,8 +34461,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
|
34195
34461
|
}
|
|
34196
34462
|
}, "openUnderNode");
|
|
34197
34463
|
var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
34198
|
-
const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-
|
|
34199
|
-
const { drizzle } = await import("./bun-
|
|
34464
|
+
const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-GFRVRRDZ.js");
|
|
34465
|
+
const { drizzle } = await import("./bun-MJOYPPEN.js");
|
|
34200
34466
|
const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
|
|
34201
34467
|
try {
|
|
34202
34468
|
return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
|
|
@@ -34206,7 +34472,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
|
34206
34472
|
}
|
|
34207
34473
|
}, "openUnderBun");
|
|
34208
34474
|
|
|
34209
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34475
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
|
|
34210
34476
|
var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
|
|
34211
34477
|
const ours = MIGRATIONS.at(-1)?.version ?? 0;
|
|
34212
34478
|
if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
|
|
@@ -34221,7 +34487,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
|
|
|
34221
34487
|
throw new CliError("configuration_error", `The store requires schema ${minCompatible}, but this tool supports ${ours}; ${refusalAdvice(storeClients(database), command, version)}`);
|
|
34222
34488
|
}, "assertReadCompatible");
|
|
34223
34489
|
|
|
34224
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34490
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
|
|
34225
34491
|
var BACKFILL_ON_OPEN = 5e3;
|
|
34226
34492
|
var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
|
|
34227
34493
|
var createWritable = /* @__PURE__ */ __name((file) => {
|
|
@@ -34277,10 +34543,10 @@ var openStoreContext = /* @__PURE__ */ __name(async ({ path, env, now: now2 = Da
|
|
|
34277
34543
|
}
|
|
34278
34544
|
}, "openStoreContext");
|
|
34279
34545
|
|
|
34280
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34546
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
|
|
34281
34547
|
import { createHash as createHash16 } from "node:crypto";
|
|
34282
34548
|
|
|
34283
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34549
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
|
|
34284
34550
|
var text3 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
|
|
34285
34551
|
var ref = text3(2048);
|
|
34286
34552
|
var timestamp2 = pipe(number(), safeInteger(), minValue(0));
|
|
@@ -34346,7 +34612,7 @@ var projectAnnotationsSchema = strictObject({
|
|
|
34346
34612
|
}))
|
|
34347
34613
|
});
|
|
34348
34614
|
|
|
34349
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34615
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
|
|
34350
34616
|
var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
|
|
34351
34617
|
var invalid7 = /* @__PURE__ */ __name((field3) => {
|
|
34352
34618
|
throw new CliError("validation_error", `invalid project annotations.${field3}`);
|
|
@@ -34450,7 +34716,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
|
|
|
34450
34716
|
invalid7("external.unused");
|
|
34451
34717
|
}, "validateProjectAnnotationsGraph");
|
|
34452
34718
|
|
|
34453
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34719
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
|
|
34454
34720
|
var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
|
|
34455
34721
|
var ref2 = pipe(string(), minLength(1), maxLength(2048));
|
|
34456
34722
|
var targetSchema = strictObject({
|
|
@@ -34556,7 +34822,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
|
|
|
34556
34822
|
};
|
|
34557
34823
|
}, "planBoundProjectAnnotations");
|
|
34558
34824
|
|
|
34559
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34825
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
|
|
34560
34826
|
import { createHash as createHash17 } from "node:crypto";
|
|
34561
34827
|
var text4 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
|
|
34562
34828
|
var timestamp3 = pipe(number(), safeInteger(), minValue(0));
|
|
@@ -34650,7 +34916,7 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
|
|
|
34650
34916
|
})).digest("hex");
|
|
34651
34917
|
}, "projectAnnotationSnapshotFingerprint");
|
|
34652
34918
|
|
|
34653
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34919
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
|
|
34654
34920
|
var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
|
|
34655
34921
|
if (!request || typeof request !== "object" || Array.isArray(request))
|
|
34656
34922
|
throw new CliError("validation_error", "project annotation request is required");
|
|
@@ -34667,7 +34933,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
|
|
|
34667
34933
|
return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
|
|
34668
34934
|
}, "projectAnnotationRequest");
|
|
34669
34935
|
|
|
34670
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34936
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
|
|
34671
34937
|
var SnapshotBudget = class {
|
|
34672
34938
|
static {
|
|
34673
34939
|
__name(this, "SnapshotBudget");
|
|
@@ -34693,13 +34959,13 @@ var SnapshotBudget = class {
|
|
|
34693
34959
|
}
|
|
34694
34960
|
};
|
|
34695
34961
|
|
|
34696
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34962
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
|
|
34697
34963
|
import { createHash as createHash19 } from "node:crypto";
|
|
34698
34964
|
|
|
34699
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34965
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
|
|
34700
34966
|
var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
|
|
34701
34967
|
|
|
34702
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34968
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
|
|
34703
34969
|
import { createHash as createHash18 } from "node:crypto";
|
|
34704
34970
|
var invalid9 = /* @__PURE__ */ __name(() => {
|
|
34705
34971
|
throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
|
|
@@ -34842,7 +35108,7 @@ var ProjectSnapshotSources = class {
|
|
|
34842
35108
|
}
|
|
34843
35109
|
};
|
|
34844
35110
|
|
|
34845
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35111
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
|
|
34846
35112
|
var unsupported = /* @__PURE__ */ __name(() => {
|
|
34847
35113
|
throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
|
|
34848
35114
|
}, "unsupported");
|
|
@@ -35013,7 +35279,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
|
|
|
35013
35279
|
return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
|
|
35014
35280
|
}), "projectAnnotationSnapshot");
|
|
35015
35281
|
|
|
35016
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35282
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
|
|
35017
35283
|
var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, manifest, bindings, budget) => read(database, () => {
|
|
35018
35284
|
const current = projectAnnotationSnapshot(database, projectId, budget).snapshot;
|
|
35019
35285
|
const sources = new ProjectSnapshotSources(database, budget);
|
|
@@ -35075,7 +35341,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
|
|
|
35075
35341
|
};
|
|
35076
35342
|
}), "previewAnnotationSnapshot");
|
|
35077
35343
|
|
|
35078
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35344
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
|
|
35079
35345
|
var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snapshot2, bindings) => {
|
|
35080
35346
|
const mappings = { ...bindings };
|
|
35081
35347
|
const resolve = /* @__PURE__ */ __name((ref3) => {
|
|
@@ -35094,7 +35360,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snap
|
|
|
35094
35360
|
const author = resolve(fact.author), confirmed = resolve(fact.confirmed_by);
|
|
35095
35361
|
if (!author)
|
|
35096
35362
|
throw new CliError("validation_error", "project annotation author is required");
|
|
35097
|
-
const row2 = database.prepare("INSERT INTO facts(type,statement,status,project_id,subject_type,subject_id,occurred_at,supersedes_id,author_type,author_id,model,confirmed_by_type,confirmed_by_id,scope,source,created_at,updated_at) VALUES(
|
|
35363
|
+
const row2 = database.prepare("INSERT INTO facts(id,type,statement,status,project_id,subject_type,subject_id,occurred_at,supersedes_id,author_type,author_id,model,confirmed_by_type,confirmed_by_id,scope,source,created_at,updated_at) VALUES(?,?,?,?,?,NULL,NULL,?,NULL,?,?,?,?,?,?,?,?,?) RETURNING id").get(nextId(database, "facts"), fact.type, fact.statement, fact.status, projectId, fact.occurred_at, author.type, author.id, fact.model, confirmed?.type ?? null, confirmed?.id ?? null, fact.scope, fact.source, fact.created_at, fact.updated_at);
|
|
35098
35364
|
if (!row2)
|
|
35099
35365
|
throw new CliError("configuration_error", "project annotation fact insertion failed");
|
|
35100
35366
|
mappings[fact.ref] = `fact:${row2.id}`;
|
|
@@ -35117,7 +35383,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snap
|
|
|
35117
35383
|
return mappings;
|
|
35118
35384
|
}, "restoreAnnotationRecords");
|
|
35119
35385
|
|
|
35120
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35386
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
|
|
35121
35387
|
var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
35122
35388
|
async preview(request) {
|
|
35123
35389
|
const { snapshot: snapshot2, projectId } = projectAnnotationRequest(request);
|
|
@@ -35147,7 +35413,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
35147
35413
|
}
|
|
35148
35414
|
}), "projectAnnotationStoreOver");
|
|
35149
35415
|
|
|
35150
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35416
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
|
|
35151
35417
|
var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
|
|
35152
35418
|
const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
|
|
35153
35419
|
let merged = { from: from2, to };
|
|
@@ -35160,7 +35426,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
|
|
|
35160
35426
|
}, "markRange");
|
|
35161
35427
|
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");
|
|
35162
35428
|
|
|
35163
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35429
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
|
|
35164
35430
|
var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
|
|
35165
35431
|
var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
|
|
35166
35432
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
|
|
@@ -35170,7 +35436,7 @@ var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) =
|
|
|
35170
35436
|
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);
|
|
35171
35437
|
}, "setTaskRulesStop");
|
|
35172
35438
|
|
|
35173
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35439
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sync.js
|
|
35174
35440
|
var syncStoreOver = /* @__PURE__ */ __name((context) => {
|
|
35175
35441
|
const { database } = context;
|
|
35176
35442
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
|
|
@@ -35226,7 +35492,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
35226
35492
|
};
|
|
35227
35493
|
}, "syncStoreOver");
|
|
35228
35494
|
|
|
35229
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35495
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/tags.js
|
|
35230
35496
|
var tagsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
35231
35497
|
const { database } = context;
|
|
35232
35498
|
return {
|
|
@@ -35248,7 +35514,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
35248
35514
|
};
|
|
35249
35515
|
}, "tagsStoreOver");
|
|
35250
35516
|
|
|
35251
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35517
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
|
|
35252
35518
|
var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
|
|
35253
35519
|
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
|
|
35254
35520
|
WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
|
|
@@ -35375,7 +35641,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
|
|
|
35375
35641
|
dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
|
|
35376
35642
|
}, "savePictureChunks");
|
|
35377
35643
|
|
|
35378
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35644
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
|
|
35379
35645
|
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,
|
|
35380
35646
|
EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
|
|
35381
35647
|
FROM messages m
|
|
@@ -35422,6 +35688,12 @@ var messageRows = /* @__PURE__ */ __name(({ orm }, accountPk2, { chatKey, model,
|
|
|
35422
35688
|
${since === void 0 ? sql`` : sql`AND m.sent_at >= ${since}`}
|
|
35423
35689
|
${before2 === void 0 ? sql`` : sql`AND m.sent_at < ${before2}`}
|
|
35424
35690
|
${"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");
|
|
35691
|
+
var scoreMessages = /* @__PURE__ */ __name(({ orm }, accountPk2, { model, query, pks }) => orm.all(sql`SELECT ch.external_id AS chatId, m.external_id AS messageId, v.vector
|
|
35692
|
+
FROM chunks k CROSS JOIN messages m ON m.id = k.chunkable_id AND m.deleted_at IS NULL
|
|
35693
|
+
JOIN chats ch ON ch.id = m.chat_id AND ch.searchable = 1
|
|
35694
|
+
JOIN embeddings v ON v.model = ${model} AND v.content_hash = k.content_hash
|
|
35695
|
+
WHERE k.chunkable_type = 'message' AND k.position = 0 AND k.account_id = ${accountPk2}
|
|
35696
|
+
AND k.chunkable_id IN (SELECT value FROM json_each(${JSON.stringify(pks)}))`).map(({ chatId, messageId, vector }) => ({ chatId, messageId, score: dot(query, vector) })).sort((a, b) => b.score - a.score), "scoreMessages");
|
|
35425
35697
|
var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, query, ...filter }) => {
|
|
35426
35698
|
const score = /* @__PURE__ */ __name((row2) => ({
|
|
35427
35699
|
id: row2.id,
|
|
@@ -35458,7 +35730,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
|
|
|
35458
35730
|
return plain2(best(found2));
|
|
35459
35731
|
}, "nearestMessages");
|
|
35460
35732
|
|
|
35461
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35733
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/vectors.js
|
|
35462
35734
|
var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
|
|
35463
35735
|
const { database } = context;
|
|
35464
35736
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -35599,6 +35871,10 @@ var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
|
|
|
35599
35871
|
query
|
|
35600
35872
|
});
|
|
35601
35873
|
}, "nearestMessages"),
|
|
35874
|
+
scoreMessages: /* @__PURE__ */ __name(async (key2, options) => {
|
|
35875
|
+
const accountPk2 = findAccountPk2(key2);
|
|
35876
|
+
return accountPk2 === void 0 ? [] : scoreMessages(context, accountPk2, options);
|
|
35877
|
+
}, "scoreMessages"),
|
|
35602
35878
|
vectorStatus: /* @__PURE__ */ __name(async (key2, chatId, model) => {
|
|
35603
35879
|
const chatKey = chatKeyOf(key2, chatId);
|
|
35604
35880
|
return chatKey === void 0 ? { chunks: 0, embedded: 0 } : vectorStatus(context, chatKey, model);
|
|
@@ -35712,7 +35988,7 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
35712
35988
|
embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
|
|
35713
35989
|
}), "vectorsStoreOver");
|
|
35714
35990
|
|
|
35715
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35991
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
|
|
35716
35992
|
import { existsSync, readFileSync as readFileSync4 } from "node:fs";
|
|
35717
35993
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
35718
35994
|
var BOOKKEEPING = ["schema_migrations", "store_settings"];
|
|
@@ -35800,10 +36076,10 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
|
|
|
35800
36076
|
}
|
|
35801
36077
|
}, "lastBackup");
|
|
35802
36078
|
|
|
35803
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36079
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/providers.js
|
|
35804
36080
|
var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
|
|
35805
36081
|
|
|
35806
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36082
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
|
|
35807
36083
|
var COUNTED_TABLES = [
|
|
35808
36084
|
"accounts",
|
|
35809
36085
|
"chats",
|
|
@@ -35888,7 +36164,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
|
|
|
35888
36164
|
};
|
|
35889
36165
|
}, "storeContents");
|
|
35890
36166
|
|
|
35891
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36167
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/store.js
|
|
35892
36168
|
var openStore = /* @__PURE__ */ __name(async (options = {}) => {
|
|
35893
36169
|
const context = await openStoreContext(options);
|
|
35894
36170
|
try {
|
|
@@ -35911,10 +36187,10 @@ var areaOf = /* @__PURE__ */ __name((keyed, whole) => once3(() => {
|
|
|
35911
36187
|
}), "areaOf");
|
|
35912
36188
|
var storeOver = /* @__PURE__ */ __name((context) => {
|
|
35913
36189
|
const { database } = context;
|
|
35914
|
-
const
|
|
36190
|
+
const stemmerFor2 = stemmerCache();
|
|
35915
36191
|
const pruneLogsWhenDue = logPruner(database, context.now);
|
|
35916
36192
|
const own = /* @__PURE__ */ __name((keyed) => ({ ...keyed }), "own");
|
|
35917
|
-
const mail = once3(() => mailStoreOver(context,
|
|
36193
|
+
const mail = once3(() => mailStoreOver(context, stemmerFor2));
|
|
35918
36194
|
const areas = {
|
|
35919
36195
|
accounts: areaOf(() => accountAccountsOver(context), (keyed) => accountsStoreOver(context, keyed)),
|
|
35920
36196
|
chats: areaOf(() => chatsStoreOver(context), own),
|
|
@@ -35931,10 +36207,10 @@ var storeOver = /* @__PURE__ */ __name((context) => {
|
|
|
35931
36207
|
};
|
|
35932
36208
|
const contextEvidence = once3(() => contextEvidenceOver(context));
|
|
35933
36209
|
const projectAnnotations = once3(() => projectAnnotationStoreOver(context));
|
|
35934
|
-
const contextIndex = once3(() => contextIndexOver(context,
|
|
36210
|
+
const contextIndex = once3(() => contextIndexOver(context, stemmerFor2));
|
|
35935
36211
|
const contextRecords = once3(() => contextRecordsOver(context));
|
|
35936
36212
|
const searches2 = once3(() => searchesStoreOver(context));
|
|
35937
|
-
const queries = once3(() => queriesStoreOver(context,
|
|
36213
|
+
const queries = once3(() => queriesStoreOver(context, stemmerFor2));
|
|
35938
36214
|
const searchIndex2 = once3(() => searchIndexStoreOver(context));
|
|
35939
36215
|
const botUpdates2 = once3(() => botUpdateStoreOver(context, pruneLogsWhenDue));
|
|
35940
36216
|
const involvements2 = once3(() => involvementStoreOver(context));
|
|
@@ -36114,6 +36390,7 @@ export {
|
|
|
36114
36390
|
formatLocator,
|
|
36115
36391
|
isLocator,
|
|
36116
36392
|
parseLocator,
|
|
36393
|
+
normalizeVocabularyName,
|
|
36117
36394
|
inboxKey,
|
|
36118
36395
|
formatReference,
|
|
36119
36396
|
parseReference,
|
|
@@ -36176,7 +36453,10 @@ export {
|
|
|
36176
36453
|
resetSearchIndex,
|
|
36177
36454
|
fillStems,
|
|
36178
36455
|
resetStems,
|
|
36456
|
+
CONTEXT_MAX_READ_BYTES,
|
|
36457
|
+
contextEvidenceFingerprint,
|
|
36179
36458
|
contextSource,
|
|
36459
|
+
contextEvidenceRequest,
|
|
36180
36460
|
calendarMoment,
|
|
36181
36461
|
involvementStoreOver,
|
|
36182
36462
|
OTHER_SOURCES,
|