@wirecat/tg-cli 0.110.0 → 0.111.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-JWUCHTXU.js → adapter-WFC2JAD4.js} +38 -38
- package/dist/bundle/{all-profiles-OMRCKP54.js → all-profiles-FEUSGHT7.js} +5 -5
- package/dist/bundle/{anthropic-WXFHH74P.js → anthropic-O646SJIJ.js} +3 -3
- package/dist/bundle/{app-server-ILIPNO6T.js → app-server-7P23Y45A.js} +35 -35
- package/dist/bundle/{bot-api-KV765AZK.js → bot-api-WTJCL6VF.js} +39 -39
- package/dist/bundle/{bot-history-3P6EIM5L.js → bot-history-5J2Q4SPC.js} +10 -10
- package/dist/bundle/{bun-MJOYPPEN.js → bun-KUKVEKDW.js} +2 -2
- package/dist/bundle/{bun-sqlite-GFRVRRDZ.js → bun-sqlite-2G5TXHYE.js} +2 -2
- package/dist/bundle/{chunk-4BMXELWN.js → chunk-2K6IGVSI.js} +4 -4
- package/dist/bundle/{chunk-3L2JTAVD.js → chunk-2ZH3PUQX.js} +1 -1
- package/dist/bundle/{chunk-6WTLP2SI.js → chunk-33HEHPIK.js} +7 -7
- package/dist/bundle/{chunk-4YOPRYEY.js → chunk-3BD24JYK.js} +96 -92
- package/dist/bundle/{chunk-54CWOD7V.js → chunk-3WUTBGZE.js} +4 -4
- package/dist/bundle/{chunk-XLNYDJKG.js → chunk-43ZFY6TW.js} +1 -1
- package/dist/bundle/{chunk-Q35J5LCO.js → chunk-5FJQG5UZ.js} +9 -8
- package/dist/bundle/{chunk-3XTMVGTS.js → chunk-5ZPLOYTP.js} +205 -204
- package/dist/bundle/{chunk-YWSNUUW5.js → chunk-7665YBJ7.js} +5 -5
- package/dist/bundle/{chunk-VM7I5VKX.js → chunk-7GQLD5TJ.js} +1 -1
- package/dist/bundle/{chunk-NFBOZT7H.js → chunk-AUWYMMYL.js} +3 -3
- package/dist/bundle/{chunk-TJA3BWY3.js → chunk-BNQOUCL2.js} +1 -1
- package/dist/bundle/{chunk-L3YDXUDK.js → chunk-CJUSP5X2.js} +2 -2
- package/dist/bundle/{chunk-TDQVVXPF.js → chunk-COHMFCHD.js} +11 -11
- package/dist/bundle/{chunk-BYOEVYY2.js → chunk-DEG4JJHG.js} +267 -258
- package/dist/bundle/{chunk-YPLL3Q3M.js → chunk-DREEXESG.js} +86 -50
- package/dist/bundle/{chunk-4GOF43MW.js → chunk-HN6ZMUAS.js} +1 -1
- package/dist/bundle/{chunk-SD5J5T7M.js → chunk-ITSSCYLP.js} +9 -9
- package/dist/bundle/{chunk-AXNBGLO5.js → chunk-J2Z5E7TO.js} +1 -1
- package/dist/bundle/{chunk-6KESAYMZ.js → chunk-J4QVXR5I.js} +2 -2
- package/dist/bundle/{chunk-KLOFBUXA.js → chunk-K457FHD4.js} +31 -21
- package/dist/bundle/{chunk-RXWG7OWT.js → chunk-KE47Y4PW.js} +839 -440
- package/dist/bundle/{chunk-QRH2AWBZ.js → chunk-KLHLWKWC.js} +59 -47
- package/dist/bundle/{chunk-GPIORQAD.js → chunk-LLAZSGS7.js} +20 -20
- package/dist/bundle/{chunk-F7RWNBC2.js → chunk-MSGYLWCH.js} +1 -1
- package/dist/bundle/{chunk-YPEAEEHF.js → chunk-NIKYFRDQ.js} +1 -1
- package/dist/bundle/{chunk-4I6HTOCM.js → chunk-NQAV7U7C.js} +1 -1
- package/dist/bundle/{chunk-HCAYTAJN.js → chunk-OYVDWHP5.js} +1 -1
- package/dist/bundle/{chunk-RARYRHQA.js → chunk-PNUHAHTF.js} +1 -1
- package/dist/bundle/{chunk-MZRD776E.js → chunk-PQGWEFJ2.js} +2 -2
- package/dist/bundle/{chunk-NDT22GBK.js → chunk-QAC6Z675.js} +1 -1
- package/dist/bundle/{chunk-5CMOXHQS.js → chunk-QEAMO2TS.js} +6 -6
- package/dist/bundle/{chunk-7LZBMZQM.js → chunk-QLLPZWYZ.js} +3 -3
- package/dist/bundle/{chunk-3KOF5T4N.js → chunk-QVM2HKJP.js} +4 -4
- package/dist/bundle/{chunk-32HEOKI2.js → chunk-T6DSAROY.js} +11 -9
- package/dist/bundle/{chunk-SLAPUEMZ.js → chunk-TWZTQHP6.js} +5 -5
- package/dist/bundle/{chunk-W3B6EEZU.js → chunk-UDYCZ5KB.js} +1 -1
- package/dist/bundle/{chunk-M3XIME74.js → chunk-UFIUMPXP.js} +3 -3
- package/dist/bundle/{chunk-AZYVTDAE.js → chunk-UMUJHC4M.js} +2 -2
- package/dist/bundle/{chunk-7ABA4EXC.js → chunk-UPRYEDAV.js} +2 -2
- package/dist/bundle/{chunk-FYAHTTOB.js → chunk-VIEVOF3O.js} +8 -8
- package/dist/bundle/{chunk-VOBMR7E5.js → chunk-WDRNVSWF.js} +42 -42
- package/dist/bundle/{chunk-2YWQEG2P.js → chunk-XIRASTVS.js} +10 -10
- package/dist/bundle/{chunk-F24EAGOU.js → chunk-XXOJ7PQY.js} +26 -26
- package/dist/bundle/{chunk-MXIBRT6W.js → chunk-YFK3DNNP.js} +4 -4
- package/dist/bundle/{chunk-RSZEEWOW.js → chunk-YG4BO7N3.js} +1 -1
- package/dist/bundle/{chunk-5ASW5BNM.js → chunk-ZCHC7TYO.js} +11 -11
- package/dist/bundle/{chunk-JDOSIWPN.js → chunk-ZCV4UEVH.js} +2 -2
- package/dist/bundle/{command-contract-TNSW7W6G.js → command-contract-JCRVVL7P.js} +12 -12
- package/dist/bundle/{decode-3KBXZCFM.js → decode-QJNVAAKJ.js} +2 -2
- package/dist/bundle/{echarts-24TVPFGC.js → echarts-2EDY7OUX.js} +2 -2
- package/dist/bundle/{embed-3BDPZ4Q7.js → embed-PZSXOQJO.js} +3 -3
- package/dist/bundle/{embedder-EMVDEZFR.js → embedder-O4EGMMUU.js} +6 -6
- package/dist/bundle/{entry-NQD6Z2BM.js → entry-DVLMQM6J.js} +3 -3
- package/dist/bundle/{first-run-ZBIO6C67.js → first-run-J67KTUWA.js} +5 -5
- package/dist/bundle/{first-screen-4HRCG7OX.js → first-screen-PYEE5NMQ.js} +13 -13
- package/dist/bundle/{identity-EDGOOTOM.js → identity-DSYY4FLQ.js} +1 -1
- package/dist/bundle/{instructions-N2WVMNFZ.js → instructions-O535XB2L.js} +1 -1
- package/dist/bundle/{node-VBZAZHUS.js → node-S3VEQNTE.js} +2 -2
- package/dist/bundle/{node-sqlite-C3V64OAL.js → node-sqlite-3DNWF2BW.js} +2 -2
- package/dist/bundle/{oauth-NZXELYDA.js → oauth-IU2RAZ3D.js} +4 -4
- package/dist/bundle/{open-2XRUGMV7.js → open-M2IPPXMI.js} +1 -1
- package/dist/bundle/{openai-OLGTN3ZB.js → openai-GDI7HISL.js} +10 -10
- package/dist/bundle/{process-CASPZ2DH.js → process-3IGMEATV.js} +1 -1
- package/dist/bundle/{program-QPQDSGYA.js → program-P7YPHVLD.js} +41 -41
- package/dist/bundle/{prompt-ESZL7SGX.js → prompt-S6R7IHDK.js} +2 -2
- package/dist/bundle/{recognize-LQ7QOG4T.js → recognize-PFZRQ3P4.js} +1 -1
- package/dist/bundle/{remote-34XP4EDN.js → remote-Q37V7LUX.js} +4 -4
- package/dist/bundle/{rerank-7F6NLBCW.js → rerank-V5YQQQAM.js} +4 -4
- package/dist/bundle/{serve-M6TTKXI4.js → serve-5CAD2UVG.js} +6 -6
- package/dist/bundle/{server-GLZ5M7PE.js → server-R6YAO2SG.js} +27 -27
- package/dist/bundle/server-RUQLAWWS.js +56 -0
- package/dist/bundle/{state-UKKPLMHS.js → state-Y3A2NEM3.js} +3 -3
- package/dist/bundle/{store-J2MBIDJK.js → store-H5K32CNI.js} +7 -7
- package/dist/bundle/store-maintenance-command-QZDC4WKW.js +45 -0
- package/dist/bundle/tg.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/skills/tg-cli/SKILL.md +14 -9
- package/dist/bundle/server-KOW7OKE2.js +0 -56
- package/dist/bundle/store-maintenance-command-64B57C3U.js +0 -45
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
MEMORY_KINDS,
|
|
11
11
|
MEMORY_SCOPES,
|
|
12
12
|
MeetingError,
|
|
13
|
+
OPERATORS_BY_TYPE,
|
|
14
|
+
PRIORITY_LABELS,
|
|
13
15
|
QUERY_LIMITS,
|
|
14
16
|
RELATION_KINDS,
|
|
15
17
|
REVIEW_LIMIT,
|
|
@@ -22,6 +24,7 @@ import {
|
|
|
22
24
|
aggregateMeetingStats,
|
|
23
25
|
calendarText,
|
|
24
26
|
canonicalMeetingReference,
|
|
27
|
+
checkedScore,
|
|
25
28
|
dateRange,
|
|
26
29
|
defineQuery,
|
|
27
30
|
entryInWindow,
|
|
@@ -29,8 +32,10 @@ import {
|
|
|
29
32
|
findingFingerprint,
|
|
30
33
|
findingHash,
|
|
31
34
|
formatMeetingReference,
|
|
35
|
+
isClosedState,
|
|
32
36
|
joinKeyOf,
|
|
33
37
|
joinUrlWithoutQuery,
|
|
38
|
+
legacyPriority,
|
|
34
39
|
linkKind,
|
|
35
40
|
matches,
|
|
36
41
|
meetingCueFingerprint,
|
|
@@ -39,6 +44,8 @@ import {
|
|
|
39
44
|
normalizeTag,
|
|
40
45
|
parseMeetingQuery,
|
|
41
46
|
parseMeetingReference,
|
|
47
|
+
priorityBand,
|
|
48
|
+
priorityLabel,
|
|
42
49
|
queryAstSchema,
|
|
43
50
|
queryError,
|
|
44
51
|
tagOf,
|
|
@@ -52,7 +59,7 @@ import {
|
|
|
52
59
|
validateQuery,
|
|
53
60
|
walkQuery,
|
|
54
61
|
zonedMoment
|
|
55
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-DREEXESG.js";
|
|
56
63
|
import {
|
|
57
64
|
DEFAULT_STEMMERS,
|
|
58
65
|
DEFAULT_STEMMERS_VERSION,
|
|
@@ -65,21 +72,21 @@ import {
|
|
|
65
72
|
fold,
|
|
66
73
|
normalize,
|
|
67
74
|
parseStemmers
|
|
68
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-33HEHPIK.js";
|
|
69
76
|
import {
|
|
70
77
|
DEFAULT_TASK_CATEGORIES,
|
|
71
78
|
sharedConfigPath,
|
|
72
79
|
storedTaskCategories,
|
|
73
80
|
taskCategoriesReader
|
|
74
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-3WUTBGZE.js";
|
|
75
82
|
import {
|
|
76
83
|
storePath
|
|
77
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-7GQLD5TJ.js";
|
|
78
85
|
import {
|
|
79
86
|
PRAGMAS,
|
|
80
87
|
quietSqliteWarning,
|
|
81
88
|
storeCapable
|
|
82
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-TWZTQHP6.js";
|
|
83
90
|
import {
|
|
84
91
|
SQLiteTable,
|
|
85
92
|
TableAliasProxyHandler,
|
|
@@ -104,7 +111,7 @@ import {
|
|
|
104
111
|
sql,
|
|
105
112
|
sqliteTable,
|
|
106
113
|
text
|
|
107
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-HN6ZMUAS.js";
|
|
108
115
|
import {
|
|
109
116
|
singleLine
|
|
110
117
|
} from "./chunk-BWRCPMMC.js";
|
|
@@ -133,7 +140,7 @@ import {
|
|
|
133
140
|
__name
|
|
134
141
|
} from "./chunk-ZVVMGPBJ.js";
|
|
135
142
|
|
|
136
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
143
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/account-store.js
|
|
137
144
|
var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
|
|
138
145
|
const methods = whole;
|
|
139
146
|
return Object.fromEntries(Object.keys(keyed).map((name) => [
|
|
@@ -149,7 +156,7 @@ var once = /* @__PURE__ */ __name((build) => {
|
|
|
149
156
|
};
|
|
150
157
|
}, "once");
|
|
151
158
|
var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
|
|
152
|
-
const
|
|
159
|
+
const bound5 = /* @__PURE__ */ __name((area) => once(() => bindArea(area(), account)), "bound");
|
|
153
160
|
const ownAttachment = /* @__PURE__ */ __name((attachmentPk) => {
|
|
154
161
|
const pk = owners.accountPk();
|
|
155
162
|
if (pk === void 0 || owners.attachmentAccount(attachmentPk) !== pk)
|
|
@@ -192,9 +199,9 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
|
|
|
192
199
|
return id2 === void 0 ? [] : store.meetings.search(query, { ...filter, accountId: id2 });
|
|
193
200
|
}, "search")
|
|
194
201
|
};
|
|
195
|
-
const accounts2 =
|
|
196
|
-
const chats2 =
|
|
197
|
-
const sync =
|
|
202
|
+
const accounts2 = bound5(areas.accounts);
|
|
203
|
+
const chats2 = bound5(areas.chats);
|
|
204
|
+
const sync = bound5(areas.sync);
|
|
198
205
|
const messages2 = once(() => ({
|
|
199
206
|
...bindArea(areas.messages(), account),
|
|
200
207
|
find: /* @__PURE__ */ __name((filter) => store.messages.find({ ...filter, account }), "find"),
|
|
@@ -211,13 +218,13 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
|
|
|
211
218
|
return store.attachments.keepAttachmentText(attachmentPk, entry2);
|
|
212
219
|
}, "keepAttachmentText")
|
|
213
220
|
}));
|
|
214
|
-
const roster =
|
|
215
|
-
const people2 =
|
|
216
|
-
const conversations2 =
|
|
217
|
-
const vectors =
|
|
218
|
-
const counters =
|
|
219
|
-
const tags =
|
|
220
|
-
const mentions3 =
|
|
221
|
+
const roster = bound5(areas.roster);
|
|
222
|
+
const people2 = bound5(areas.people);
|
|
223
|
+
const conversations2 = bound5(areas.conversations);
|
|
224
|
+
const vectors = bound5(areas.vectors);
|
|
225
|
+
const counters = bound5(areas.counters);
|
|
226
|
+
const tags = bound5(areas.tags);
|
|
227
|
+
const mentions3 = bound5(areas.mentions);
|
|
221
228
|
return {
|
|
222
229
|
account,
|
|
223
230
|
get accounts() {
|
|
@@ -261,7 +268,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
|
|
|
261
268
|
};
|
|
262
269
|
}, "bindAccount");
|
|
263
270
|
|
|
264
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
271
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/providers.js
|
|
265
272
|
var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events"];
|
|
266
273
|
var PROVIDERS = [
|
|
267
274
|
{ name: "telegram", kind: "messages", aliases: ["tg"] },
|
|
@@ -352,7 +359,7 @@ var providerNamed = /* @__PURE__ */ __name((word) => {
|
|
|
352
359
|
var kindIn = /* @__PURE__ */ __name((provider) => isFolderProvider(provider) ? "notes" : registry.find(({ name }) => name === provider)?.kind, "kindIn");
|
|
353
360
|
var kindOf = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
|
|
354
361
|
|
|
355
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
362
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/query.js
|
|
356
363
|
var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
|
|
357
364
|
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
365
|
var fail = /* @__PURE__ */ __name((message2) => {
|
|
@@ -375,7 +382,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
|
|
|
375
382
|
return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
|
|
376
383
|
}, "sourceOf");
|
|
377
384
|
|
|
378
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
385
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/account-list.js
|
|
379
386
|
var ACCOUNT_GROUPS = "accountGroups";
|
|
380
387
|
var ACCOUNT_GROUPS_SETTING = "account_groups";
|
|
381
388
|
var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
|
|
@@ -562,7 +569,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf = (kind3)
|
|
|
562
569
|
return { accounts: [...chosen.values()], skipped };
|
|
563
570
|
}, "fitting");
|
|
564
571
|
|
|
565
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
572
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
|
|
566
573
|
var IndexBuilderOn = class {
|
|
567
574
|
static {
|
|
568
575
|
__name(this, "IndexBuilderOn");
|
|
@@ -757,7 +764,7 @@ function alias(table, alias2) {
|
|
|
757
764
|
}
|
|
758
765
|
__name(alias, "alias");
|
|
759
766
|
|
|
760
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
767
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
|
|
761
768
|
var ENTITY_TABLES = {
|
|
762
769
|
account: "accounts",
|
|
763
770
|
attachment: "attachments",
|
|
@@ -797,7 +804,7 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
|
|
|
797
804
|
return { table, pointer, type, count, known: known2 };
|
|
798
805
|
}).filter(({ count }) => count > 0)), "orphanPointers");
|
|
799
806
|
|
|
800
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
807
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
|
|
801
808
|
var canonicalTags = sqliteTable("canonical_tags", {
|
|
802
809
|
id: integer("id").primaryKey(),
|
|
803
810
|
name: text("name").notNull().unique(),
|
|
@@ -806,7 +813,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
|
|
|
806
813
|
updatedAt: integer("updated_at").notNull()
|
|
807
814
|
});
|
|
808
815
|
|
|
809
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
816
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
|
|
810
817
|
var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
|
|
811
818
|
sourceKey: text("source_key").notNull(),
|
|
812
819
|
collection: text("collection").notNull(),
|
|
@@ -816,13 +823,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
|
|
|
816
823
|
createdAt: integer("created_at").notNull()
|
|
817
824
|
}, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
|
|
818
825
|
|
|
819
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
826
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
|
|
820
827
|
var documentIndexPending = sqliteTable("document_index_pending", {
|
|
821
828
|
id: integer("id").notNull(),
|
|
822
829
|
indexableType: text("indexable_type").notNull()
|
|
823
830
|
}, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
|
|
824
831
|
|
|
825
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
832
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
|
|
826
833
|
var tagRedirects = sqliteTable("tag_redirects", {
|
|
827
834
|
sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
|
|
828
835
|
survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
|
|
@@ -848,7 +855,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
|
|
|
848
855
|
index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
|
|
849
856
|
]);
|
|
850
857
|
|
|
851
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
858
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
|
|
852
859
|
var accounts = sqliteTable("accounts", {
|
|
853
860
|
id: integer("id").primaryKey(),
|
|
854
861
|
provider: text("provider").notNull(),
|
|
@@ -1921,7 +1928,10 @@ var tasks = sqliteTable("tasks", {
|
|
|
1921
1928
|
closeSuggestedById: integer("close_suggested_by_id"),
|
|
1922
1929
|
closeSuggestedCertainty: real("close_suggested_certainty"),
|
|
1923
1930
|
closeSuggestedReason: text("close_suggested_reason"),
|
|
1924
|
-
closeSuggestedAt: integer("close_suggested_at")
|
|
1931
|
+
closeSuggestedAt: integer("close_suggested_at"),
|
|
1932
|
+
priorityScore: real("priority_score"),
|
|
1933
|
+
agent: text("agent"),
|
|
1934
|
+
revision: integer("revision").notNull().default(1)
|
|
1925
1935
|
}, (table) => [
|
|
1926
1936
|
unique().on(table.projectId, table.number),
|
|
1927
1937
|
index("tasks_by_title_folded").on(table.titleFolded),
|
|
@@ -2344,7 +2354,7 @@ var storeSettings = sqliteTable("store_settings", {
|
|
|
2344
2354
|
at: integer("at").notNull()
|
|
2345
2355
|
});
|
|
2346
2356
|
|
|
2347
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2357
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
|
|
2348
2358
|
var ARMS = [
|
|
2349
2359
|
[
|
|
2350
2360
|
"message",
|
|
@@ -2471,7 +2481,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
|
|
|
2471
2481
|
return recomputed;
|
|
2472
2482
|
}, "drainInvolvementQueue");
|
|
2473
2483
|
|
|
2474
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2484
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/mentions.js
|
|
2475
2485
|
import { domainToUnicode } from "node:url";
|
|
2476
2486
|
|
|
2477
2487
|
// node_modules/.pnpm/psl@1.15.0/node_modules/psl/dist/psl.mjs
|
|
@@ -12493,7 +12503,7 @@ var oa = /* @__PURE__ */ __name((e) => {
|
|
|
12493
12503
|
}, "oa");
|
|
12494
12504
|
var na = { parse: O, get: aa, isValid: oa };
|
|
12495
12505
|
|
|
12496
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12506
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
|
|
12497
12507
|
var LINK = /https?:\/\/(?:(?:docs|drive|sheets|slides)\.google\.com|forms\.gle)(?:[/?#][^\s<>"'`]*)?/gi;
|
|
12498
12508
|
var ID = /^[\w-]{10,}$/;
|
|
12499
12509
|
var trimUrl = /* @__PURE__ */ __name((url) => {
|
|
@@ -12534,7 +12544,7 @@ var googleDocumentLinks = /* @__PURE__ */ __name((text5) => [...text5.matchAll(L
|
|
|
12534
12544
|
return { url, documentId: googleDocumentId(url) };
|
|
12535
12545
|
}), "googleDocumentLinks");
|
|
12536
12546
|
|
|
12537
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12547
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
|
|
12538
12548
|
var PHONE_PLANS = [
|
|
12539
12549
|
{
|
|
12540
12550
|
country: "us",
|
|
@@ -12914,7 +12924,7 @@ var PHONE_PLANS = [
|
|
|
12914
12924
|
}
|
|
12915
12925
|
];
|
|
12916
12926
|
|
|
12917
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12927
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/phones.js
|
|
12918
12928
|
var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
|
|
12919
12929
|
var DEFAULT_PHONE_COUNTRIES = ["ru"];
|
|
12920
12930
|
var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
|
|
@@ -12955,7 +12965,7 @@ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
|
|
|
12955
12965
|
return void 0;
|
|
12956
12966
|
}, "nationalPhone");
|
|
12957
12967
|
|
|
12958
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12968
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/places.js
|
|
12959
12969
|
var BEFORE = [
|
|
12960
12970
|
[/^(?:ул\.?|улиц[аеыу]|улицей)$/iu, "\u0443\u043B\u0438\u0446\u0430"],
|
|
12961
12971
|
[/^(?:пр-т|просп\.?|проспект[аеу]?)$/iu, "\u043F\u0440\u043E\u0441\u043F\u0435\u043A\u0442"],
|
|
@@ -13215,7 +13225,7 @@ var findPlaces = /* @__PURE__ */ __name((text5) => {
|
|
|
13215
13225
|
return found2.sort((a, b) => a.start - b.start);
|
|
13216
13226
|
}, "findPlaces");
|
|
13217
13227
|
|
|
13218
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13228
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/mentions.js
|
|
13219
13229
|
var MENTION_KINDS = ["phone", "email", "url", "document", "person-name", "place"];
|
|
13220
13230
|
var MENTION_VERSIONS = {
|
|
13221
13231
|
phone: 1,
|
|
@@ -13405,7 +13415,7 @@ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE
|
|
|
13405
13415
|
};
|
|
13406
13416
|
}, "typedPhone");
|
|
13407
13417
|
|
|
13408
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13418
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/first-names.js
|
|
13409
13419
|
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
13420
|
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
13421
|
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 +13423,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
|
|
|
13413
13423
|
var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
|
|
13414
13424
|
var NAME_WORDS = WORDS.split(" ");
|
|
13415
13425
|
|
|
13416
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13426
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/person-names.js
|
|
13417
13427
|
var LATIN_TO_CYRILLIC = {
|
|
13418
13428
|
shch: "\u0449",
|
|
13419
13429
|
sch: "\u0449",
|
|
@@ -13621,7 +13631,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text5, stem, taken) => {
|
|
|
13621
13631
|
return found2;
|
|
13622
13632
|
}, "findUnknownNames");
|
|
13623
13633
|
|
|
13624
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13634
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/attachments.js
|
|
13625
13635
|
var NOT_FILES = /* @__PURE__ */ new Set([
|
|
13626
13636
|
"webpage",
|
|
13627
13637
|
"share",
|
|
@@ -13653,7 +13663,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored3, files2) => {
|
|
|
13653
13663
|
});
|
|
13654
13664
|
}, "matchDownloads");
|
|
13655
13665
|
|
|
13656
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13666
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
|
|
13657
13667
|
var QUERY_VERSION = 1;
|
|
13658
13668
|
var QUERY_LIMITS2 = {
|
|
13659
13669
|
...QUERY_LIMITS,
|
|
@@ -13684,7 +13694,7 @@ function exhausted(budget) {
|
|
|
13684
13694
|
}
|
|
13685
13695
|
__name(exhausted, "exhausted");
|
|
13686
13696
|
|
|
13687
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13697
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
|
|
13688
13698
|
var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
|
|
13689
13699
|
var literal2 = /* @__PURE__ */ __name((c) => ({
|
|
13690
13700
|
kind: "char",
|
|
@@ -14084,7 +14094,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
|
|
|
14084
14094
|
return out;
|
|
14085
14095
|
}, "foldRegex");
|
|
14086
14096
|
|
|
14087
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14097
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
|
|
14088
14098
|
var PRESET_VERSION = 1;
|
|
14089
14099
|
var PRESETS = {
|
|
14090
14100
|
password: {
|
|
@@ -14138,7 +14148,7 @@ var PRESETS = {
|
|
|
14138
14148
|
}
|
|
14139
14149
|
};
|
|
14140
14150
|
|
|
14141
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14151
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
|
|
14142
14152
|
var FIELD_VERSION = 2;
|
|
14143
14153
|
var UNITS = {
|
|
14144
14154
|
"": 1,
|
|
@@ -14162,9 +14172,9 @@ var filled = /* @__PURE__ */ __name((node) => {
|
|
|
14162
14172
|
searchError("query.missing-value", node.span);
|
|
14163
14173
|
}, "filled");
|
|
14164
14174
|
var validateSize = /* @__PURE__ */ __name((node) => {
|
|
14165
|
-
for (const
|
|
14166
|
-
if (
|
|
14167
|
-
parseBytes(
|
|
14175
|
+
for (const bound5 of node.operator === "range" ? [node.value, node.upper] : [node.value])
|
|
14176
|
+
if (bound5 !== void 0 && bound5 !== "*")
|
|
14177
|
+
parseBytes(bound5, node.span);
|
|
14168
14178
|
}, "validateSize");
|
|
14169
14179
|
var validateTag = /* @__PURE__ */ __name((node) => {
|
|
14170
14180
|
if (tagOf(node.value) === void 0)
|
|
@@ -14537,8 +14547,8 @@ var MESSAGES = { entity: "message", backend: "sql", fields: QUERY_FIELDS };
|
|
|
14537
14547
|
var NEAR_FIELDS = /* @__PURE__ */ new Set(["text", "exact", "transcript", "content"]);
|
|
14538
14548
|
var validateFields = /* @__PURE__ */ __name((ast) => {
|
|
14539
14549
|
for (const node of walkQuery(ast.root)) {
|
|
14540
|
-
const
|
|
14541
|
-
if (!
|
|
14550
|
+
const field4 = QUERY_FIELDS.find(({ name }) => name === node.field);
|
|
14551
|
+
if (!field4 && ["after", "before"].includes(node.field)) {
|
|
14542
14552
|
const plain2 = ["term", "phrase"].includes(node.operator) && /^[\w:.+-]+$/u.test(node.value);
|
|
14543
14553
|
searchError("legacy_date_field", node.span, plain2 ? `use date${node.field === "after" ? ">=" : "<"}${node.value}` : "use date>=YYYY-MM-DD or date:[a TO b]");
|
|
14544
14554
|
}
|
|
@@ -14546,8 +14556,8 @@ var validateFields = /* @__PURE__ */ __name((ast) => {
|
|
|
14546
14556
|
searchError("query.unsupported-operator", node.span, `"a b"~N takes words: ${[...NEAR_FIELDS].join(", ")}`);
|
|
14547
14557
|
if (node.slop !== void 0 && node.slop > MOST_WORDS_APART)
|
|
14548
14558
|
searchError("query.invalid-number", node.span, `words at most ${MOST_WORDS_APART} apart: "a b"~${MOST_WORDS_APART}`);
|
|
14549
|
-
if (
|
|
14550
|
-
searchError("query.unsupported-operator", node.span, `${
|
|
14559
|
+
if (field4 && node.operator === "wildcard" && !field4.operators.includes("wildcard"))
|
|
14560
|
+
searchError("query.unsupported-operator", node.span, `${field4.name} takes ${field4.operators.join(", ")}`);
|
|
14551
14561
|
}
|
|
14552
14562
|
return validateQuery(ast, MESSAGES, SEARCH_QUERY);
|
|
14553
14563
|
}, "validateFields");
|
|
@@ -14587,16 +14597,16 @@ var validateAst = /* @__PURE__ */ __name((input) => {
|
|
|
14587
14597
|
return validateFields(parsed2.output);
|
|
14588
14598
|
}, "validateAst");
|
|
14589
14599
|
|
|
14590
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14600
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
|
|
14591
14601
|
var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
|
|
14592
14602
|
var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
|
|
14593
14603
|
var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
|
|
14594
14604
|
|
|
14595
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14605
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
|
|
14596
14606
|
var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
|
|
14597
14607
|
var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
|
|
14598
|
-
var linkMatch = /* @__PURE__ */ __name((
|
|
14599
|
-
if (
|
|
14608
|
+
var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
|
|
14609
|
+
if (field4 === "url") {
|
|
14600
14610
|
const value = normalizedValue(typed);
|
|
14601
14611
|
const origin = mail ? trackedOrigin(value) : void 0;
|
|
14602
14612
|
if (origin === void 0)
|
|
@@ -14616,7 +14626,7 @@ var linkMatch = /* @__PURE__ */ __name((field3, typed, mail, mentioned2) => {
|
|
|
14616
14626
|
};
|
|
14617
14627
|
}, "linkMatch");
|
|
14618
14628
|
|
|
14619
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14629
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
|
|
14620
14630
|
var SETTING = "phoneCountries";
|
|
14621
14631
|
var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
|
|
14622
14632
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
|
|
@@ -14647,7 +14657,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
|
|
|
14647
14657
|
return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
|
|
14648
14658
|
}, "valueMatch");
|
|
14649
14659
|
|
|
14650
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14660
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/locator.js
|
|
14651
14661
|
var SCHEME = "msg:";
|
|
14652
14662
|
var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat: chat2, message: message2 }) => SCHEME + [provider, account, chat2, message2].map(encodeURIComponent).join("/"), "formatLocator");
|
|
14653
14663
|
var isLocator = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith(SCHEME), "isLocator");
|
|
@@ -14661,7 +14671,7 @@ var parseLocator = /* @__PURE__ */ __name((reference2) => {
|
|
|
14661
14671
|
return { provider, account, chat: chat2, message: message2 };
|
|
14662
14672
|
}, "parseLocator");
|
|
14663
14673
|
|
|
14664
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14674
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
|
|
14665
14675
|
var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
|
|
14666
14676
|
if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
|
|
14667
14677
|
throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
|
|
@@ -14689,7 +14699,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
|
|
|
14689
14699
|
return 2 * intersection2 / (aa2.size + bb.size);
|
|
14690
14700
|
}, "vocabularySimilarity");
|
|
14691
14701
|
|
|
14692
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14702
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
|
|
14693
14703
|
import { createHash } from "node:crypto";
|
|
14694
14704
|
var folded2 = /* @__PURE__ */ __name((name) => {
|
|
14695
14705
|
try {
|
|
@@ -14755,30 +14765,30 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind3, by, options
|
|
|
14755
14765
|
});
|
|
14756
14766
|
}, "guardTagCreation");
|
|
14757
14767
|
|
|
14758
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14768
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
|
|
14759
14769
|
var invalid2 = /* @__PURE__ */ __name((message2) => {
|
|
14760
14770
|
throw new CliError("validation_error", message2);
|
|
14761
14771
|
}, "invalid");
|
|
14762
|
-
var record2 = /* @__PURE__ */ __name((value, fields4,
|
|
14772
|
+
var record2 = /* @__PURE__ */ __name((value, fields4, field4) => {
|
|
14763
14773
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
14764
|
-
return invalid2(`${
|
|
14774
|
+
return invalid2(`${field4} must be an object`);
|
|
14765
14775
|
for (const key2 of Object.keys(value))
|
|
14766
14776
|
if (!fields4.includes(key2))
|
|
14767
|
-
invalid2(`unknown ${
|
|
14777
|
+
invalid2(`unknown ${field4} field: ${key2}`);
|
|
14768
14778
|
return value;
|
|
14769
14779
|
}, "record");
|
|
14770
|
-
var tagId = /* @__PURE__ */ __name((value,
|
|
14780
|
+
var tagId = /* @__PURE__ */ __name((value, field4) => {
|
|
14771
14781
|
if (typeof value !== "string" || value.length > 16 || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
14772
|
-
return invalid2(`${
|
|
14782
|
+
return invalid2(`${field4} must be a positive canonical tag id`);
|
|
14773
14783
|
return value;
|
|
14774
14784
|
}, "tagId");
|
|
14775
14785
|
var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
|
|
14776
14786
|
const input = record2(snapshot2, ["complete", "tags", "redirects"], "snapshot");
|
|
14777
14787
|
if (input.complete !== true)
|
|
14778
14788
|
invalid2("snapshot.complete must be true; partial tag graphs cannot resolve labels");
|
|
14779
|
-
for (const
|
|
14780
|
-
if (!Array.isArray(input[
|
|
14781
|
-
invalid2(`snapshot.${
|
|
14789
|
+
for (const field4 of ["tags", "redirects"])
|
|
14790
|
+
if (!Array.isArray(input[field4]) || input[field4].length > 4096)
|
|
14791
|
+
invalid2(`snapshot.${field4} must be an array of at most 4096 rows`);
|
|
14782
14792
|
const ids = /* @__PURE__ */ new Set();
|
|
14783
14793
|
for (const [index2, value] of snapshot2.tags.entries()) {
|
|
14784
14794
|
const row2 = record2(value, ["id", "kind"], `tags[${index2}]`);
|
|
@@ -14832,7 +14842,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
|
|
|
14832
14842
|
};
|
|
14833
14843
|
}, "createTagRedirectIndex");
|
|
14834
14844
|
|
|
14835
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14845
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
|
|
14836
14846
|
var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
|
|
14837
14847
|
const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
|
|
14838
14848
|
if (!row2)
|
|
@@ -14860,7 +14870,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
|
|
|
14860
14870
|
return snapshot2;
|
|
14861
14871
|
}, "tagRedirectSnapshot");
|
|
14862
14872
|
|
|
14863
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14873
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
|
|
14864
14874
|
import { createHash as createHash2 } from "node:crypto";
|
|
14865
14875
|
var TASK_KEY_PREFIXES = {
|
|
14866
14876
|
question: "Q",
|
|
@@ -14888,7 +14898,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
|
|
|
14888
14898
|
return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
|
|
14889
14899
|
}, "taskAccountOf");
|
|
14890
14900
|
|
|
14891
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14901
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/references.js
|
|
14892
14902
|
var SIMPLE_REFERENCES = [
|
|
14893
14903
|
"note",
|
|
14894
14904
|
"document",
|
|
@@ -14960,7 +14970,7 @@ var folderPath = /* @__PURE__ */ __name((path) => {
|
|
|
14960
14970
|
}, "folderPath");
|
|
14961
14971
|
var canonicalReference = /* @__PURE__ */ __name((text5) => formatReference(parseReference(text5)), "canonicalReference");
|
|
14962
14972
|
|
|
14963
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14973
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
|
|
14964
14974
|
var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
|
|
14965
14975
|
var REFERABLE = {
|
|
14966
14976
|
note: { tombstone: true },
|
|
@@ -15118,7 +15128,7 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
|
|
|
15118
15128
|
}, "taskIdOf");
|
|
15119
15129
|
var canonicalThingReference = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith("meeting:") ? canonicalMeetingReference(reference2) : canonicalReference(reference2), "canonicalThingReference");
|
|
15120
15130
|
|
|
15121
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15131
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
|
|
15122
15132
|
var toMs = /* @__PURE__ */ __name((iso11) => {
|
|
15123
15133
|
if (iso11 === null || iso11 === void 0)
|
|
15124
15134
|
return null;
|
|
@@ -15132,7 +15142,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
|
|
|
15132
15142
|
var DELIVERY = { delivered: 1, read: 2 };
|
|
15133
15143
|
var deliveryOf = /* @__PURE__ */ __name((stored3) => stored3 === DELIVERY.read ? "read" : stored3 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
|
|
15134
15144
|
|
|
15135
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15145
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
|
|
15136
15146
|
var TAG_KINDS = ["tag", "topic"];
|
|
15137
15147
|
var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
|
|
15138
15148
|
var TAG_TYPE = {
|
|
@@ -15200,12 +15210,19 @@ var createTag = /* @__PURE__ */ __name((context, name, kind3, by, options = {})
|
|
|
15200
15210
|
var ensureTag = /* @__PURE__ */ __name((context, name) => {
|
|
15201
15211
|
return canonicalTagNamed(context.database, name) ?? createTag(context, name, "tag", "owner");
|
|
15202
15212
|
}, "ensureTag");
|
|
15213
|
+
var taskTagsChanged = /* @__PURE__ */ __name((context, thing, changes, author) => {
|
|
15214
|
+
if (thing.type !== "task" || [...changes.added ?? [], ...changes.removed ?? []].length === 0)
|
|
15215
|
+
return;
|
|
15216
|
+
const at = context.now();
|
|
15217
|
+
context.database.prepare("UPDATE tasks SET updated_at = ? WHERE id = ?").run(at, thing.id);
|
|
15218
|
+
context.database.prepare("INSERT INTO task_events (task_id, actor_type, actor_id, kind, changes, created_at) VALUES (?, ?, ?, 'tags', ?, ?)").run(thing.id, author?.type ?? null, author?.id ?? null, JSON.stringify({ tags: [changes.removed ?? [], changes.added ?? []] }), at);
|
|
15219
|
+
}, "taskTagsChanged");
|
|
15203
15220
|
var addTags = /* @__PURE__ */ __name((context, thing, tags, source2 = "owner", author) => {
|
|
15204
15221
|
const { database, now: now2 } = context;
|
|
15205
15222
|
const insert = database.prepare("INSERT INTO taggings (tag_id, taggable_type, taggable_id, main, source, author_type, author_id, created_at, updated_at) VALUES (?, ?, ?, 0, ?, ?, ?, ?, ?) ON CONFLICT (tag_id, taggable_type, taggable_id) DO NOTHING");
|
|
15206
15223
|
const claim3 = database.prepare("UPDATE taggings SET source = 'owner', updated_at = ? WHERE tag_id = ? AND taggable_type = ? AND taggable_id = ? AND source <> 'owner'");
|
|
15207
15224
|
const at = now2();
|
|
15208
|
-
|
|
15225
|
+
const fresh = tags.filter((name) => {
|
|
15209
15226
|
const tag2 = ensureTag(context, name);
|
|
15210
15227
|
const held = database.prepare("SELECT source,author_type,author_id FROM taggings WHERE tag_id IN (SELECT ? UNION ALL SELECT source_id FROM tag_redirects WHERE survivor_id=?) AND taggable_type=? AND taggable_id=?").all(tag2.id, tag2.id, thing.type, thing.id);
|
|
15211
15228
|
if (held.some((row2) => row2.source === source2 && row2.author_type === (author?.type ?? null) && row2.author_id === (author?.id ?? null)))
|
|
@@ -15215,10 +15232,13 @@ var addTags = /* @__PURE__ */ __name((context, thing, tags, source2 = "owner", a
|
|
|
15215
15232
|
claim3.run(at, tag2.id, thing.type, thing.id);
|
|
15216
15233
|
return added && held.length === 0;
|
|
15217
15234
|
});
|
|
15235
|
+
taskTagsChanged(context, thing, { added: fresh }, author);
|
|
15236
|
+
return fresh;
|
|
15218
15237
|
}, "addTags");
|
|
15219
|
-
var removeTags = /* @__PURE__ */ __name((
|
|
15238
|
+
var removeTags = /* @__PURE__ */ __name((context, thing, tags, source2) => {
|
|
15239
|
+
const { database } = context;
|
|
15220
15240
|
const remove = database.prepare("DELETE FROM taggings WHERE tag_id=? AND taggable_type=? AND taggable_id=?");
|
|
15221
|
-
|
|
15241
|
+
const removed = tags.filter((name) => {
|
|
15222
15242
|
const tag2 = canonicalTagNamed(database, name);
|
|
15223
15243
|
if (!tag2)
|
|
15224
15244
|
return false;
|
|
@@ -15248,6 +15268,8 @@ var removeTags = /* @__PURE__ */ __name(({ database }, thing, tags, source2) =>
|
|
|
15248
15268
|
}
|
|
15249
15269
|
return changed;
|
|
15250
15270
|
});
|
|
15271
|
+
taskTagsChanged(context, thing, { removed });
|
|
15272
|
+
return removed;
|
|
15251
15273
|
}, "removeTags");
|
|
15252
15274
|
var liveTagging = /* @__PURE__ */ __name((alias2) => `NOT (${alias2}.taggable_type = 'document' AND EXISTS (SELECT 1 FROM documents dt WHERE dt.id = ${alias2}.taggable_id AND dt.deleted_at IS NOT NULL))`, "liveTagging");
|
|
15253
15275
|
var labelsOf = /* @__PURE__ */ __name((database, thing, tag2) => database.prepare(`SELECT t.name,CASE WHEN min(g.source)='file' AND max(g.source)='file' THEN 'file' ELSE 'owner' END AS source FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE g.taggable_type=? AND g.taggable_id=?${tag2 === void 0 ? "" : " AND t.name = ?"} GROUP BY t.canonical_id ORDER BY t.name`).all(thing.type, thing.id, ...tag2 === void 0 ? [] : [tag2]).map((row2) => ({ tag: String(row2.name), origin: row2.source === "file" ? "file" : "owner" })), "labelsOf");
|
|
@@ -15323,7 +15345,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
|
|
|
15323
15345
|
return result;
|
|
15324
15346
|
}, "tagsOf");
|
|
15325
15347
|
|
|
15326
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15348
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
|
|
15327
15349
|
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
15350
|
var SPEECH = speech("att");
|
|
15329
15351
|
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");
|
|
@@ -15360,8 +15382,8 @@ var wordMatch = /* @__PURE__ */ __name((corpus, match) => ({
|
|
|
15360
15382
|
exact: true,
|
|
15361
15383
|
fts: match
|
|
15362
15384
|
}), "wordMatch");
|
|
15363
|
-
var tooManyWords = /* @__PURE__ */ __name(({ field:
|
|
15364
|
-
const term = `${
|
|
15385
|
+
var tooManyWords = /* @__PURE__ */ __name(({ field: field4, operator, value, span }, alone) => {
|
|
15386
|
+
const term = `${field4}:${operator === "regex" ? `/${value}/` : value}`;
|
|
15365
15387
|
throw new CliError("validation_error", `search: ${term}${alone ? " matches" : " and the patterns before it match"} more than ${QUERY_LIMITS2.expansions} indexed words, the term expansions budget \u2014 use a longer prefix, or body:/\u2026/ inside one chat`, {
|
|
15366
15388
|
reason: "query.too-large",
|
|
15367
15389
|
budget: "term expansions",
|
|
@@ -15573,13 +15595,13 @@ var mentions2 = /* @__PURE__ */ __name((node, scope3) => {
|
|
|
15573
15595
|
searchError("query.invalid-reference", node.span);
|
|
15574
15596
|
return always(mentioned(scope3, `mn.status = 'linked' AND (${target[0]})`, target[1]));
|
|
15575
15597
|
}, "mentions");
|
|
15576
|
-
var link = /* @__PURE__ */ __name((
|
|
15577
|
-
...linkMatch(
|
|
15598
|
+
var link = /* @__PURE__ */ __name((field4) => ({ value }, scope3) => always({
|
|
15599
|
+
...linkMatch(field4, value, scope3.mail, (where, params) => mentioned(scope3, where, params)),
|
|
15578
15600
|
exact: true
|
|
15579
15601
|
}), "link");
|
|
15580
|
-
var found = /* @__PURE__ */ __name(({ field:
|
|
15581
|
-
const match =
|
|
15582
|
-
return always(match === void 0 ? mentioned(scope3, "mn.domain = ? AND mn.status <> 'dismissed'", [siteOf(value.toLowerCase())]) : mentioned(scope3, `mn.kind = ? AND ${match.sql} AND mn.status <> 'dismissed'`, [
|
|
15602
|
+
var found = /* @__PURE__ */ __name(({ field: field4, value }, scope3) => {
|
|
15603
|
+
const match = field4 === "domain" ? void 0 : valueMatch(scope3.database, value);
|
|
15604
|
+
return always(match === void 0 ? mentioned(scope3, "mn.domain = ? AND mn.status <> 'dismissed'", [siteOf(value.toLowerCase())]) : mentioned(scope3, `mn.kind = ? AND ${match.sql} AND mn.status <> 'dismissed'`, [field4, ...match.params]));
|
|
15583
15605
|
}, "found");
|
|
15584
15606
|
var tag = /* @__PURE__ */ __name((node, { corpus, database }) => {
|
|
15585
15607
|
const selected = tagOf(node.value);
|
|
@@ -15678,7 +15700,7 @@ var FIELD_COMPILERS = {
|
|
|
15678
15700
|
subject
|
|
15679
15701
|
};
|
|
15680
15702
|
|
|
15681
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15703
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
|
|
15682
15704
|
var placeOf = /* @__PURE__ */ __name((database) => {
|
|
15683
15705
|
const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
|
|
15684
15706
|
const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
|
|
@@ -15694,7 +15716,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
|
|
|
15694
15716
|
};
|
|
15695
15717
|
}, "placeOf");
|
|
15696
15718
|
|
|
15697
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15719
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
|
|
15698
15720
|
var DRAIN_ON_WRITE = 500;
|
|
15699
15721
|
var METHOD = "rules";
|
|
15700
15722
|
var telegramLink = /* @__PURE__ */ __name((database) => {
|
|
@@ -15857,7 +15879,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
|
|
|
15857
15879
|
return queued.length;
|
|
15858
15880
|
}, "drainMentions");
|
|
15859
15881
|
|
|
15860
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15882
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
|
|
15861
15883
|
var indexRow = /* @__PURE__ */ __name((database, name) => {
|
|
15862
15884
|
const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
|
|
15863
15885
|
if (!exists2)
|
|
@@ -15865,7 +15887,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
|
|
|
15865
15887
|
return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
|
|
15866
15888
|
}, "indexRow");
|
|
15867
15889
|
|
|
15868
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15890
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
|
|
15869
15891
|
var INDEX = "message_stems";
|
|
15870
15892
|
var SETTING2 = "searchStemmers";
|
|
15871
15893
|
var DRAIN_ON_WRITE2 = 500;
|
|
@@ -15987,7 +16009,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
|
|
|
15987
16009
|
};
|
|
15988
16010
|
}, "stemmerCache");
|
|
15989
16011
|
|
|
15990
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16012
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
|
|
15991
16013
|
var SQLITE_BUSY = 5;
|
|
15992
16014
|
var pause = new Int32Array(new SharedArrayBuffer(4));
|
|
15993
16015
|
var isBusy = /* @__PURE__ */ __name((error) => {
|
|
@@ -16082,7 +16104,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
|
|
|
16082
16104
|
}
|
|
16083
16105
|
}, "read");
|
|
16084
16106
|
|
|
16085
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16107
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
|
|
16086
16108
|
var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
|
|
16087
16109
|
coalesce(CASE k.chunkable_type
|
|
16088
16110
|
WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
|
|
@@ -16224,7 +16246,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
|
|
|
16224
16246
|
}, "dropUnusedVectors");
|
|
16225
16247
|
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");
|
|
16226
16248
|
|
|
16227
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16249
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
|
|
16228
16250
|
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({
|
|
16229
16251
|
target: [accounts.provider, accounts.externalId],
|
|
16230
16252
|
set: {
|
|
@@ -16330,7 +16352,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
|
|
|
16330
16352
|
AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
|
|
16331
16353
|
}, "dropOrphanPeople");
|
|
16332
16354
|
|
|
16333
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16355
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
|
|
16334
16356
|
var FOLDED = [
|
|
16335
16357
|
{ table: "tasks", column: "title" },
|
|
16336
16358
|
{ table: "tasks", column: "close_reason" },
|
|
@@ -16367,7 +16389,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
|
16367
16389
|
return filled2;
|
|
16368
16390
|
}, "fillFolded");
|
|
16369
16391
|
|
|
16370
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16392
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
|
|
16371
16393
|
import { createHash as createHash3 } from "node:crypto";
|
|
16372
16394
|
var CHUNK_CHARS = 1200;
|
|
16373
16395
|
var CHUNK_OVERLAP = 150;
|
|
@@ -16472,7 +16494,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
|
|
|
16472
16494
|
return chunks2;
|
|
16473
16495
|
}, "cutChunks");
|
|
16474
16496
|
|
|
16475
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16497
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/task-signature.js
|
|
16476
16498
|
var DAY = 864e5;
|
|
16477
16499
|
var CURRENCY = [
|
|
16478
16500
|
[/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
|
|
@@ -16589,7 +16611,7 @@ var dueDayOf = /* @__PURE__ */ __name((text5, createdMs) => {
|
|
|
16589
16611
|
return best?.day ?? null;
|
|
16590
16612
|
}, "dueDayOf");
|
|
16591
16613
|
|
|
16592
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16614
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
|
|
16593
16615
|
var DAY2 = 864e5;
|
|
16594
16616
|
var STOP_WORDS = new Set([
|
|
16595
16617
|
// Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
|
|
@@ -16692,7 +16714,7 @@ var LEVEL_REASONS = {
|
|
|
16692
16714
|
person: { same: "same person", different: "different person" },
|
|
16693
16715
|
amount: { equal: "same amount", different: "different amount" }
|
|
16694
16716
|
};
|
|
16695
|
-
var weightOf = /* @__PURE__ */ __name((
|
|
16717
|
+
var weightOf = /* @__PURE__ */ __name((field4, level) => TASK_SIMILARITY_WEIGHTS[field4][level].weight, "weightOf");
|
|
16696
16718
|
var plural = /* @__PURE__ */ __name((count, word) => `${count} ${word}${count === 1 ? "" : "s"}`, "plural");
|
|
16697
16719
|
var bandOf = /* @__PURE__ */ __name((score) => score >= TASK_SIMILARITY_BANDS.likely ? "likely" : score >= TASK_SIMILARITY_BANDS.maybe ? "maybe" : "different", "bandOf");
|
|
16698
16720
|
var compareTasks = /* @__PURE__ */ __name((a, b, { replyChain = false } = {}) => {
|
|
@@ -16744,7 +16766,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
|
|
|
16744
16766
|
...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
|
|
16745
16767
|
})).sort((a, b) => b.score - a.score), "rankCandidates");
|
|
16746
16768
|
|
|
16747
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16769
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
|
|
16748
16770
|
var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
|
|
16749
16771
|
r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
|
|
16750
16772
|
JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
|
|
@@ -17015,7 +17037,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
|
|
|
17015
17037
|
};
|
|
17016
17038
|
}, "readiness");
|
|
17017
17039
|
|
|
17018
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17040
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
|
|
17019
17041
|
var DOCUMENT_PICTURE = "document_picture";
|
|
17020
17042
|
var SCAN_PAGE2 = 5e3;
|
|
17021
17043
|
var idOf = /* @__PURE__ */ __name((ref3) => {
|
|
@@ -17078,7 +17100,7 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
17078
17100
|
}, "nearestPictures")
|
|
17079
17101
|
}), "documentPicturesOver");
|
|
17080
17102
|
|
|
17081
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17103
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
|
|
17082
17104
|
var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
|
|
17083
17105
|
const literal4 = escaped2 ?? plain2 ?? "";
|
|
17084
17106
|
return wildcard ?? (/[*?[]/u.test(literal4) ? `[${literal4}]` : literal4);
|
|
@@ -17143,7 +17165,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
|
|
|
17143
17165
|
var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
|
|
17144
17166
|
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");
|
|
17145
17167
|
|
|
17146
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17168
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
|
|
17147
17169
|
var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
|
|
17148
17170
|
var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
|
|
17149
17171
|
var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
|
|
@@ -17233,7 +17255,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
|
|
|
17233
17255
|
});
|
|
17234
17256
|
}, "linkMeeting");
|
|
17235
17257
|
|
|
17236
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17258
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
|
|
17237
17259
|
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), ''))";
|
|
17238
17260
|
var UNSEARCHED_EVENT_TYPES = [
|
|
17239
17261
|
"working-location",
|
|
@@ -17308,7 +17330,7 @@ var holdingText = /* @__PURE__ */ __name((type, column2, search2) => {
|
|
|
17308
17330
|
if ([...text5].length < 3)
|
|
17309
17331
|
throw new CliError("validation_error", "search needs at least three characters");
|
|
17310
17332
|
const queued = `SELECT id FROM ${type}_index_pending WHERE indexable_type = '${type}'`;
|
|
17311
|
-
const state = /* @__PURE__ */ __name((
|
|
17333
|
+
const state = /* @__PURE__ */ __name((field4) => `(SELECT ${field4} FROM search_index_state WHERE name = '${type}_trigrams')`, "state");
|
|
17312
17334
|
return {
|
|
17313
17335
|
sql: `${column2} IN (SELECT rowid FROM ${type}_trigrams WHERE ${type}_trigrams MATCH ? AND rowid NOT IN (${queued}) UNION ALL SELECT r.id FROM ${type}s r WHERE (r.id IN (${queued}) OR (r.id > ${state("filled_through")} AND r.id <= ${state("watermark")})) AND instr(lower(coalesce(r.body, '')), lower(?)) > 0)`,
|
|
17314
17336
|
params: [`"${text5.replaceAll('"', '""')}"`, search2]
|
|
@@ -17463,7 +17485,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
|
|
|
17463
17485
|
return true;
|
|
17464
17486
|
}, "resetNoteIndex");
|
|
17465
17487
|
|
|
17466
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17488
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
|
|
17467
17489
|
var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
|
|
17468
17490
|
var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
|
|
17469
17491
|
for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
|
|
@@ -17482,7 +17504,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
|
|
|
17482
17504
|
}
|
|
17483
17505
|
}, "resolvePersonLinks");
|
|
17484
17506
|
|
|
17485
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17507
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
|
|
17486
17508
|
var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
|
|
17487
17509
|
var prepare = /* @__PURE__ */ __name((orm) => ({
|
|
17488
17510
|
find: orm.select({
|
|
@@ -17707,7 +17729,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
|
|
|
17707
17729
|
}, "meetingIdentityPk");
|
|
17708
17730
|
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");
|
|
17709
17731
|
|
|
17710
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17732
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
|
|
17711
17733
|
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");
|
|
17712
17734
|
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");
|
|
17713
17735
|
var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
|
|
@@ -17987,11 +18009,11 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
|
|
|
17987
18009
|
}
|
|
17988
18010
|
}, "replaceAutoTags");
|
|
17989
18011
|
|
|
17990
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18012
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/counters.js
|
|
17991
18013
|
var COUNTER_FIELDS = ["views", "reactions", "comments"];
|
|
17992
18014
|
var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
|
|
17993
|
-
var counterValue = /* @__PURE__ */ __name((message2,
|
|
17994
|
-
const value =
|
|
18015
|
+
var counterValue = /* @__PURE__ */ __name((message2, field4) => {
|
|
18016
|
+
const value = field4 === "reactions" ? message2.reactions?.total : message2.providerMetadata?.[field4];
|
|
17995
18017
|
return validCounter(value) ? value : null;
|
|
17996
18018
|
}, "counterValue");
|
|
17997
18019
|
var counterObservationTime = /* @__PURE__ */ __name((observation, now2) => {
|
|
@@ -18004,14 +18026,14 @@ var counterObservationTime = /* @__PURE__ */ __name((observation, now2) => {
|
|
|
18004
18026
|
}, "counterObservationTime");
|
|
18005
18027
|
var observedCounters = /* @__PURE__ */ __name((message2, observedAt, fields4, source2 = "remote_fetch") => {
|
|
18006
18028
|
const observations = {};
|
|
18007
|
-
for (const
|
|
18008
|
-
const value = counterValue(message2,
|
|
18029
|
+
for (const field4 of fields4) {
|
|
18030
|
+
const value = counterValue(message2, field4);
|
|
18009
18031
|
if (value !== null)
|
|
18010
|
-
observations[
|
|
18032
|
+
observations[field4] = {
|
|
18011
18033
|
value,
|
|
18012
18034
|
observedAt,
|
|
18013
18035
|
source: source2,
|
|
18014
|
-
...
|
|
18036
|
+
...field4 === "reactions" && message2.reactions ? { reactions: message2.reactions } : {}
|
|
18015
18037
|
};
|
|
18016
18038
|
}
|
|
18017
18039
|
return { ...message2, counterObservations: observations };
|
|
@@ -18024,7 +18046,7 @@ var counterFreshness = /* @__PURE__ */ __name((states) => {
|
|
|
18024
18046
|
return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
|
|
18025
18047
|
}, "counterFreshness");
|
|
18026
18048
|
|
|
18027
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18049
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
|
|
18028
18050
|
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");
|
|
18029
18051
|
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;
|
|
18030
18052
|
var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
|
|
@@ -18105,7 +18127,7 @@ var mailCore = /* @__PURE__ */ __name((body2, earlier) => {
|
|
|
18105
18127
|
return withoutSignOff(withoutGreeting(kept)).join("\n").trim();
|
|
18106
18128
|
}, "mailCore");
|
|
18107
18129
|
|
|
18108
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18130
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
|
|
18109
18131
|
var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
|
|
18110
18132
|
var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
|
|
18111
18133
|
k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
|
|
@@ -18215,7 +18237,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
|
|
|
18215
18237
|
return emails3 + threads;
|
|
18216
18238
|
}, "drainEmailIndex");
|
|
18217
18239
|
|
|
18218
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18240
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
|
|
18219
18241
|
var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
|
|
18220
18242
|
SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
|
|
18221
18243
|
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,
|
|
@@ -18261,7 +18283,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
|
|
|
18261
18283
|
leave.run(emailId, Number(box.id), emailId, Number(box.id));
|
|
18262
18284
|
}, "forgetLocations");
|
|
18263
18285
|
|
|
18264
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18286
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
|
|
18265
18287
|
var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
|
|
18266
18288
|
emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
|
|
18267
18289
|
last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
|
|
@@ -18311,7 +18333,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
|
|
|
18311
18333
|
return threads.length;
|
|
18312
18334
|
}, "markEmailsRestored");
|
|
18313
18335
|
|
|
18314
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18336
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
|
|
18315
18337
|
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");
|
|
18316
18338
|
var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
|
|
18317
18339
|
var ruleOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -18378,7 +18400,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
|
|
|
18378
18400
|
}
|
|
18379
18401
|
}), "mailRulesOver");
|
|
18380
18402
|
|
|
18381
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18403
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
|
|
18382
18404
|
var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
|
|
18383
18405
|
database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
|
|
18384
18406
|
VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
|
|
@@ -18386,7 +18408,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
|
|
|
18386
18408
|
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);
|
|
18387
18409
|
}, "reviewLink");
|
|
18388
18410
|
|
|
18389
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18411
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
|
|
18390
18412
|
function checkMeetingCancelled(signal) {
|
|
18391
18413
|
if (!signal?.aborted)
|
|
18392
18414
|
return;
|
|
@@ -18397,7 +18419,7 @@ function checkMeetingCancelled(signal) {
|
|
|
18397
18419
|
}
|
|
18398
18420
|
__name(checkMeetingCancelled, "checkMeetingCancelled");
|
|
18399
18421
|
|
|
18400
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18422
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
|
|
18401
18423
|
var meetingOf = /* @__PURE__ */ __name((row2) => ({
|
|
18402
18424
|
id: Number(row2.id),
|
|
18403
18425
|
accountId: Number(row2.account_id),
|
|
@@ -18447,7 +18469,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
|
|
|
18447
18469
|
createdAt: Number(row2.created_at)
|
|
18448
18470
|
}), "transcriptRowOf");
|
|
18449
18471
|
|
|
18450
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18472
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
|
|
18451
18473
|
var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
|
|
18452
18474
|
var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
|
|
18453
18475
|
var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
|
|
@@ -18614,7 +18636,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
18614
18636
|
}
|
|
18615
18637
|
}), "meetingReadsOver");
|
|
18616
18638
|
|
|
18617
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18639
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
|
|
18618
18640
|
var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
|
|
18619
18641
|
const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
|
|
18620
18642
|
const params = [input.accountId];
|
|
@@ -18657,7 +18679,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
|
|
|
18657
18679
|
return { clauses, params };
|
|
18658
18680
|
}, "meetingSelectionSql");
|
|
18659
18681
|
|
|
18660
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18682
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
|
|
18661
18683
|
var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
18662
18684
|
async meetingChatLines(input) {
|
|
18663
18685
|
checkMeetingCancelled(input.signal);
|
|
@@ -18685,7 +18707,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
18685
18707
|
}
|
|
18686
18708
|
}), "meetingChatLinesOver");
|
|
18687
18709
|
|
|
18688
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18710
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
|
|
18689
18711
|
var MESSAGE_FIELDS = {
|
|
18690
18712
|
pk: messages.id,
|
|
18691
18713
|
nativeId: messages.externalId,
|
|
@@ -18852,7 +18874,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
|
|
|
18852
18874
|
storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
|
|
18853
18875
|
}), "chatActivity");
|
|
18854
18876
|
|
|
18855
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18877
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
|
|
18856
18878
|
var HIT_FIELDS = {
|
|
18857
18879
|
...MESSAGE_FIELDS,
|
|
18858
18880
|
chatTitle: sql`${chats.title}`.as("chat_title"),
|
|
@@ -18951,7 +18973,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
|
|
|
18951
18973
|
};
|
|
18952
18974
|
}, "directReplies");
|
|
18953
18975
|
|
|
18954
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18976
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
|
|
18955
18977
|
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");
|
|
18956
18978
|
var required = /* @__PURE__ */ __name((context, ref3) => {
|
|
18957
18979
|
const found2 = identityRow(context, ref3);
|
|
@@ -19082,7 +19104,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
|
|
|
19082
19104
|
}, "mentioning");
|
|
19083
19105
|
var escaped = /* @__PURE__ */ __name((text5) => text5.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
|
|
19084
19106
|
|
|
19085
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19107
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
|
|
19086
19108
|
var missing2 = /* @__PURE__ */ __name(() => {
|
|
19087
19109
|
throw new CliError("not_found", "Meeting, participant or selected target not found");
|
|
19088
19110
|
}, "missing");
|
|
@@ -19204,7 +19226,7 @@ function meetingContextLinksOver(context) {
|
|
|
19204
19226
|
}
|
|
19205
19227
|
__name(meetingContextLinksOver, "meetingContextLinksOver");
|
|
19206
19228
|
|
|
19207
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19229
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
|
|
19208
19230
|
var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
|
|
19209
19231
|
var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
|
|
19210
19232
|
var summaryOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -19233,7 +19255,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
19233
19255
|
return row2 ? summaryText(summaryOf(row2)) : null;
|
|
19234
19256
|
}, "indexedText");
|
|
19235
19257
|
|
|
19236
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19258
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
|
|
19237
19259
|
var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
|
|
19238
19260
|
var meetingCurrentIndexRows = `
|
|
19239
19261
|
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
|
|
@@ -19264,7 +19286,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
19264
19286
|
}, "invalidateMeetingStems");
|
|
19265
19287
|
var meetingStemmableText = /* @__PURE__ */ __name((text5) => text5.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
|
|
19266
19288
|
|
|
19267
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19289
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
|
|
19268
19290
|
function meetingHitIndexOver({ database, now: now2 }) {
|
|
19269
19291
|
return {
|
|
19270
19292
|
async indexSearch(original) {
|
|
@@ -19332,10 +19354,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
|
|
|
19332
19354
|
}
|
|
19333
19355
|
__name(meetingHitIndexOver, "meetingHitIndexOver");
|
|
19334
19356
|
|
|
19335
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19357
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
|
|
19336
19358
|
import { createHash as createHash4 } from "node:crypto";
|
|
19337
19359
|
|
|
19338
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19360
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/trigrams.js
|
|
19339
19361
|
var trigrams = /* @__PURE__ */ __name((term) => {
|
|
19340
19362
|
const padded = ` ${term} `;
|
|
19341
19363
|
const pieces = /* @__PURE__ */ new Set();
|
|
@@ -19344,7 +19366,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
|
|
|
19344
19366
|
return [...pieces];
|
|
19345
19367
|
}, "trigrams");
|
|
19346
19368
|
|
|
19347
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19369
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/correct.js
|
|
19348
19370
|
var SHORTEST_CORRECTION = 3;
|
|
19349
19371
|
var maxEdits = /* @__PURE__ */ __name((word) => word.length <= 4 ? 1 : 2, "maxEdits");
|
|
19350
19372
|
var editDistance = /* @__PURE__ */ __name((a, b, max) => {
|
|
@@ -19391,7 +19413,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
|
|
|
19391
19413
|
return corrections;
|
|
19392
19414
|
}, "correctWords");
|
|
19393
19415
|
|
|
19394
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19416
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/garbled.js
|
|
19395
19417
|
var SHORTEST_GARBLED = 4;
|
|
19396
19418
|
var MOST_WIDENED = 64;
|
|
19397
19419
|
var plain = /* @__PURE__ */ __name((word) => word.replaceAll("\u044D", "\u0435"), "plain");
|
|
@@ -19483,7 +19505,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
|
|
|
19483
19505
|
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));
|
|
19484
19506
|
}, "widenWords");
|
|
19485
19507
|
|
|
19486
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19508
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
|
|
19487
19509
|
import { readFileSync } from "node:fs";
|
|
19488
19510
|
var loaded;
|
|
19489
19511
|
var dictionary = /* @__PURE__ */ __name(() => {
|
|
@@ -19542,7 +19564,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word) => {
|
|
|
19542
19564
|
return false;
|
|
19543
19565
|
}, "knownRussianWord");
|
|
19544
19566
|
|
|
19545
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19567
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
|
|
19546
19568
|
var WORD3 = /[\p{L}\p{N}\p{M}]+/gu;
|
|
19547
19569
|
var MOST_WORDS = 128;
|
|
19548
19570
|
var quote = /* @__PURE__ */ __name((word) => `"${word.replaceAll('"', '""')}"`, "quote");
|
|
@@ -19769,7 +19791,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text5, stemmer) => {
|
|
|
19769
19791
|
return check3(tree);
|
|
19770
19792
|
}, "matchMeetingText");
|
|
19771
19793
|
|
|
19772
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19794
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
|
|
19773
19795
|
var fail3 = /* @__PURE__ */ __name((message2) => {
|
|
19774
19796
|
throw new CliError("validation_error", message2);
|
|
19775
19797
|
}, "fail");
|
|
@@ -19946,7 +19968,7 @@ function meetingHitSearchOver({ database }) {
|
|
|
19946
19968
|
}
|
|
19947
19969
|
__name(meetingHitSearchOver, "meetingHitSearchOver");
|
|
19948
19970
|
|
|
19949
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19971
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
|
|
19950
19972
|
import { createHash as createHash5 } from "node:crypto";
|
|
19951
19973
|
var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
|
|
19952
19974
|
if (value === void 0)
|
|
@@ -20036,7 +20058,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
|
|
|
20036
20058
|
}
|
|
20037
20059
|
}), "meetingParticipantSearchOver");
|
|
20038
20060
|
|
|
20039
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20061
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
|
|
20040
20062
|
var preparationQueries = {
|
|
20041
20063
|
participants: {
|
|
20042
20064
|
fields: "p.id, p.identity_id, p.display_name, l.person_id",
|
|
@@ -20086,7 +20108,7 @@ var preparationQueries = {
|
|
|
20086
20108
|
}
|
|
20087
20109
|
};
|
|
20088
20110
|
|
|
20089
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20111
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
|
|
20090
20112
|
var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20091
20113
|
async preparationContext(original) {
|
|
20092
20114
|
const input = validateMeetingPreparationContext(original);
|
|
@@ -20100,7 +20122,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20100
20122
|
let total = 0;
|
|
20101
20123
|
for (const key2 of keys) {
|
|
20102
20124
|
const query = preparationQueries[key2];
|
|
20103
|
-
const bytes3 = query.text.map((
|
|
20125
|
+
const bytes3 = query.text.map((field4) => `coalesce(length(CAST(${field4} AS BLOB)),0)`).join("+");
|
|
20104
20126
|
const probe = database.prepare(`SELECT coalesce(sum(read_bytes),0) AS read_bytes FROM (SELECT ${bytes3} AS read_bytes ${query.from})`).get(...params(key2));
|
|
20105
20127
|
total += Number(probe?.read_bytes);
|
|
20106
20128
|
if (!Number.isSafeInteger(total) || total < 0 || total > maxReadBytes)
|
|
@@ -20127,7 +20149,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20127
20149
|
}
|
|
20128
20150
|
}), "meetingPreparationContextOver");
|
|
20129
20151
|
|
|
20130
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20152
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
|
|
20131
20153
|
var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
|
|
20132
20154
|
SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
|
|
20133
20155
|
WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
|
|
@@ -20141,7 +20163,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
|
|
|
20141
20163
|
JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
|
|
20142
20164
|
)`, "preparationSubjects");
|
|
20143
20165
|
|
|
20144
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20166
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
|
|
20145
20167
|
var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20146
20168
|
async preparationKnowledge(original) {
|
|
20147
20169
|
const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
|
|
@@ -20186,7 +20208,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
|
|
|
20186
20208
|
}
|
|
20187
20209
|
}), "meetingPreparationKnowledgeOver");
|
|
20188
20210
|
|
|
20189
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20211
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
|
|
20190
20212
|
var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20191
20213
|
async preparationNotes(original) {
|
|
20192
20214
|
const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
|
|
@@ -20239,7 +20261,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20239
20261
|
}
|
|
20240
20262
|
}), "meetingPreparationNotesOver");
|
|
20241
20263
|
|
|
20242
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20264
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
|
|
20243
20265
|
var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20244
20266
|
async relatedHistory(original) {
|
|
20245
20267
|
const input = validateMeetingRelatedHistory(original);
|
|
@@ -20310,7 +20332,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20310
20332
|
}
|
|
20311
20333
|
}), "meetingRelatedHistoryOver");
|
|
20312
20334
|
|
|
20313
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20335
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
|
|
20314
20336
|
var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
|
|
20315
20337
|
var text2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
|
|
20316
20338
|
var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
@@ -20391,7 +20413,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20391
20413
|
}
|
|
20392
20414
|
}), "meetingReviewOver");
|
|
20393
20415
|
|
|
20394
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20416
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
|
|
20395
20417
|
var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
|
|
20396
20418
|
var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
|
|
20397
20419
|
if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
|
|
@@ -20445,7 +20467,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20445
20467
|
}
|
|
20446
20468
|
}), "meetingSeriesHistoryOver");
|
|
20447
20469
|
|
|
20448
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20470
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
|
|
20449
20471
|
var MOST_ROWS = 5e5;
|
|
20450
20472
|
var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20451
20473
|
async meetingStats(input) {
|
|
@@ -20492,7 +20514,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20492
20514
|
}
|
|
20493
20515
|
}), "meetingStatsOver");
|
|
20494
20516
|
|
|
20495
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20517
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
|
|
20496
20518
|
var CURSOR_KEY = "meetings";
|
|
20497
20519
|
var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
|
|
20498
20520
|
id: Number(row2.id),
|
|
@@ -21044,7 +21066,7 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
21044
21066
|
};
|
|
21045
21067
|
}, "meetingStoreOver");
|
|
21046
21068
|
|
|
21047
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21069
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
|
|
21048
21070
|
var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
|
|
21049
21071
|
const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
|
|
21050
21072
|
return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
|
|
@@ -21070,7 +21092,7 @@ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
|
|
|
21070
21092
|
orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
|
|
21071
21093
|
}, "release");
|
|
21072
21094
|
|
|
21073
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21095
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
|
|
21074
21096
|
var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
|
|
21075
21097
|
id: `email:${place.emailId}`,
|
|
21076
21098
|
chatId: place.threadExternalId,
|
|
@@ -21223,9 +21245,9 @@ var saveEmail = /* @__PURE__ */ __name((database, orm, accountId, threadId, mail
|
|
|
21223
21245
|
["metadata", "metadata", toJson],
|
|
21224
21246
|
["mailRuleId", "mail_rule_id", (v) => v]
|
|
21225
21247
|
];
|
|
21226
|
-
for (const [
|
|
21227
|
-
if (mail[
|
|
21228
|
-
values.push([column2, encode(mail[
|
|
21248
|
+
for (const [field4, column2, encode] of optional)
|
|
21249
|
+
if (mail[field4] !== void 0)
|
|
21250
|
+
values.push([column2, encode(mail[field4])]);
|
|
21229
21251
|
const found2 = database.prepare("SELECT id, email_thread_id FROM emails WHERE account_id = ? AND external_id = ?").get(accountId, mail.externalId);
|
|
21230
21252
|
let emailId;
|
|
21231
21253
|
if (found2) {
|
|
@@ -21235,13 +21257,13 @@ var saveEmail = /* @__PURE__ */ __name((database, orm, accountId, threadId, mail
|
|
|
21235
21257
|
const columns = ["account_id", "external_id", ...values.map(([c]) => c), "created_at", "updated_at"];
|
|
21236
21258
|
emailId = Number(database.prepare(`INSERT INTO emails (${columns.join(", ")}) VALUES (${columns.map(() => "?").join(", ")}) RETURNING id`).get(accountId, mail.externalId, ...values.map(([, v]) => v), now2, now2)?.id);
|
|
21237
21259
|
}
|
|
21238
|
-
if (ROLES.some(([
|
|
21260
|
+
if (ROLES.some(([field4]) => mail[field4] !== void 0)) {
|
|
21239
21261
|
database.prepare("DELETE FROM email_recipients WHERE email_id = ?").run(emailId);
|
|
21240
21262
|
const insert = database.prepare(`INSERT INTO email_recipients (email_id, identity_id, address, name, role, position, created_at, updated_at)
|
|
21241
21263
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
21242
21264
|
let position2 = 0;
|
|
21243
|
-
for (const [
|
|
21244
|
-
for (const recipient2 of mail[
|
|
21265
|
+
for (const [field4, role] of ROLES)
|
|
21266
|
+
for (const recipient2 of mail[field4] ?? []) {
|
|
21245
21267
|
const address = recipient2.address.trim().toLowerCase();
|
|
21246
21268
|
const identity = addressIdentity(database, orm, accountId, recipient2, now2);
|
|
21247
21269
|
insert.run(emailId, identity, address, recipient2.name, role, position2++, now2, now2);
|
|
@@ -21627,7 +21649,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
|
|
|
21627
21649
|
}
|
|
21628
21650
|
}), "mailStoreOver");
|
|
21629
21651
|
|
|
21630
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21652
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/search/dictionary.js
|
|
21631
21653
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
21632
21654
|
var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
|
|
21633
21655
|
var folded4 = /* @__PURE__ */ __name((word) => /^[а-яё'-]*$/.test(word) ? word.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word), "folded");
|
|
@@ -21717,7 +21739,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
|
|
|
21717
21739
|
}, "knownWord");
|
|
21718
21740
|
var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
|
|
21719
21741
|
|
|
21720
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21742
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
|
|
21721
21743
|
var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
|
|
21722
21744
|
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");
|
|
21723
21745
|
var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
|
|
@@ -21803,7 +21825,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
|
|
|
21803
21825
|
return found2;
|
|
21804
21826
|
}, "spokenTranscripts");
|
|
21805
21827
|
|
|
21806
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21828
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
|
|
21807
21829
|
var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
|
|
21808
21830
|
const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
|
|
21809
21831
|
if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
|
|
@@ -21850,7 +21872,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
|
|
|
21850
21872
|
});
|
|
21851
21873
|
}, "placeHits");
|
|
21852
21874
|
|
|
21853
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21875
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
|
|
21854
21876
|
var MESSAGES2 = {
|
|
21855
21877
|
rows: "messages",
|
|
21856
21878
|
threads: "chats",
|
|
@@ -22324,7 +22346,7 @@ var runQuery = /* @__PURE__ */ __name(async (context, execution, by) => {
|
|
|
22324
22346
|
};
|
|
22325
22347
|
}, "runQuery");
|
|
22326
22348
|
|
|
22327
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22349
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
|
|
22328
22350
|
function invalidMetadata() {
|
|
22329
22351
|
throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
|
|
22330
22352
|
}
|
|
@@ -22362,10 +22384,10 @@ var counterStates = /* @__PURE__ */ __name(({ database }, messagePk, now2, maxAg
|
|
|
22362
22384
|
}, "counterStates");
|
|
22363
22385
|
var applyCounterObservations = /* @__PURE__ */ __name((context, messagePk, observations) => {
|
|
22364
22386
|
const { database, now: now2 } = context;
|
|
22365
|
-
const validated = Object.entries(observations).map(([
|
|
22366
|
-
if (!COUNTER_FIELDS.includes(
|
|
22387
|
+
const validated = Object.entries(observations).map(([field4, observation]) => {
|
|
22388
|
+
if (!COUNTER_FIELDS.includes(field4) || !observation)
|
|
22367
22389
|
throw new CliError("validation_error", "unknown counter observation field");
|
|
22368
|
-
return { field:
|
|
22390
|
+
return { field: field4, observation, at: counterObservationTime(observation, now2()) };
|
|
22369
22391
|
});
|
|
22370
22392
|
if (!validated.length)
|
|
22371
22393
|
return 0;
|
|
@@ -22387,20 +22409,20 @@ var applyCounterObservations = /* @__PURE__ */ __name((context, messagePk, obser
|
|
|
22387
22409
|
const metadata3 = validated.some((one) => one.field !== "reactions") ? object(message2.metadata) : {};
|
|
22388
22410
|
let reactions = message2.reactions === null ? null : String(message2.reactions);
|
|
22389
22411
|
let updated = 0;
|
|
22390
|
-
for (const { field:
|
|
22391
|
-
const existing = database.prepare("SELECT value,created_at FROM message_counter_observations WHERE message_id=? AND counter=?").get(messagePk,
|
|
22412
|
+
for (const { field: field4, observation, at } of validated) {
|
|
22413
|
+
const existing = database.prepare("SELECT value,created_at FROM message_counter_observations WHERE message_id=? AND counter=?").get(messagePk, field4);
|
|
22392
22414
|
const oldWins = existing && Number(existing.created_at) > at;
|
|
22393
22415
|
const value = oldWins ? Number(existing.value) : observation.value;
|
|
22394
|
-
if (
|
|
22416
|
+
if (field4 === "reactions") {
|
|
22395
22417
|
if (!oldWins && observation.reactions)
|
|
22396
22418
|
reactions = JSON.stringify(observation.reactions);
|
|
22397
22419
|
else
|
|
22398
22420
|
reactions = JSON.stringify({ total: value, mine: null, counts: [] });
|
|
22399
22421
|
} else
|
|
22400
|
-
metadata3[
|
|
22422
|
+
metadata3[field4] = value;
|
|
22401
22423
|
if (oldWins)
|
|
22402
22424
|
continue;
|
|
22403
|
-
database.prepare("INSERT INTO message_counter_observations(message_id,counter,value,created_at,source) VALUES(?,?,?,?,?) ON CONFLICT(message_id,counter) DO UPDATE SET value=excluded.value,created_at=excluded.created_at,source=excluded.source").run(messagePk,
|
|
22425
|
+
database.prepare("INSERT INTO message_counter_observations(message_id,counter,value,created_at,source) VALUES(?,?,?,?,?) ON CONFLICT(message_id,counter) DO UPDATE SET value=excluded.value,created_at=excluded.created_at,source=excluded.source").run(messagePk, field4, value, at, observation.source);
|
|
22404
22426
|
updated++;
|
|
22405
22427
|
}
|
|
22406
22428
|
if (validated.length)
|
|
@@ -22426,7 +22448,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
|
|
|
22426
22448
|
};
|
|
22427
22449
|
}), "counterTargets");
|
|
22428
22450
|
|
|
22429
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22451
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
|
|
22430
22452
|
var NOT_FILE_LIST = [...NOT_FILES].map((kind3) => `'${kind3}'`).join(",");
|
|
22431
22453
|
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,
|
|
22432
22454
|
att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
|
|
@@ -22545,7 +22567,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
|
|
|
22545
22567
|
}));
|
|
22546
22568
|
}, "attachmentViews");
|
|
22547
22569
|
|
|
22548
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22570
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
|
|
22549
22571
|
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");
|
|
22550
22572
|
var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text5, source2) => {
|
|
22551
22573
|
const { orm, database, now: now2 } = context;
|
|
@@ -22583,7 +22605,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
|
|
|
22583
22605
|
keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
|
|
22584
22606
|
}, "intoVoiceAttachment");
|
|
22585
22607
|
|
|
22586
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22608
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
|
|
22587
22609
|
var FIELDS = [
|
|
22588
22610
|
"threadExternalId",
|
|
22589
22611
|
"senderIdentityId",
|
|
@@ -22704,9 +22726,9 @@ var upsertMessage = /* @__PURE__ */ __name((context, key2, accountKey, chatKey,
|
|
|
22704
22726
|
const previous = JSON.parse(found2.providerMetadata);
|
|
22705
22727
|
const incoming = JSON.parse(String(fields4.metadata ?? "{}"));
|
|
22706
22728
|
if (previous && incoming && !Array.isArray(previous) && !Array.isArray(incoming)) {
|
|
22707
|
-
for (const
|
|
22708
|
-
if (!validCounter(incoming[
|
|
22709
|
-
incoming[
|
|
22729
|
+
for (const field4 of ["views", "comments"])
|
|
22730
|
+
if (!validCounter(incoming[field4]) && validCounter(previous[field4]))
|
|
22731
|
+
incoming[field4] = previous[field4];
|
|
22710
22732
|
fields4.metadata = JSON.stringify(edit ? { ...previous, ...incoming } : incoming);
|
|
22711
22733
|
}
|
|
22712
22734
|
} catch {
|
|
@@ -22900,7 +22922,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
|
|
|
22900
22922
|
reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
|
|
22901
22923
|
}, "writeDerivedReactions");
|
|
22902
22924
|
|
|
22903
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22925
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/keys.js
|
|
22904
22926
|
var keysOver = /* @__PURE__ */ __name((context) => {
|
|
22905
22927
|
const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
|
|
22906
22928
|
const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
|
|
@@ -22921,7 +22943,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
|
|
|
22921
22943
|
};
|
|
22922
22944
|
}, "keysOver");
|
|
22923
22945
|
|
|
22924
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22946
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
|
|
22925
22947
|
var accountGroupsOf = /* @__PURE__ */ __name((database) => {
|
|
22926
22948
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
|
|
22927
22949
|
if (!row2)
|
|
@@ -22956,7 +22978,7 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
|
|
|
22956
22978
|
database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
|
|
22957
22979
|
}, "saveProfile");
|
|
22958
22980
|
|
|
22959
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22981
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
|
|
22960
22982
|
var BOT_KINDS = ["agent", "script", "integration"];
|
|
22961
22983
|
var ownerPerson = /* @__PURE__ */ __name((database) => {
|
|
22962
22984
|
const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
|
|
@@ -22992,7 +23014,7 @@ var originOfActor = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
22992
23014
|
return database.prepare("SELECT name FROM bots WHERE id = ?").get(Number(id2))?.name === "rule" ? "rule" : "agent";
|
|
22993
23015
|
}, "originOfActor");
|
|
22994
23016
|
|
|
22995
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23017
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
|
|
22996
23018
|
var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
|
|
22997
23019
|
const owner = ownerPerson(context.database).id;
|
|
22998
23020
|
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);
|
|
@@ -23013,7 +23035,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
|
|
|
23013
23035
|
return personOf(context, ref3);
|
|
23014
23036
|
}, "linkToOwner");
|
|
23015
23037
|
|
|
23016
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23038
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
|
|
23017
23039
|
var PROVIDERS_SETTING = "providers";
|
|
23018
23040
|
var storedProvidersOf = /* @__PURE__ */ __name((database) => {
|
|
23019
23041
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
|
|
@@ -23048,7 +23070,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
|
|
|
23048
23070
|
});
|
|
23049
23071
|
}, "registerProvider");
|
|
23050
23072
|
|
|
23051
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23073
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
|
|
23052
23074
|
var DAY3 = 864e5;
|
|
23053
23075
|
var RECENTLY_CLOSED_MS = 14 * DAY3;
|
|
23054
23076
|
var TEXT_LIMIT = 20;
|
|
@@ -23187,7 +23209,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
|
23187
23209
|
drainCorpus(database, CORPORA.task, stemmerFor2);
|
|
23188
23210
|
const stemmer = stemmerFor2(storeStemmers(database) ?? DEFAULT_STEMMERS);
|
|
23189
23211
|
const since = now2() - RECENTLY_CLOSED_MS;
|
|
23190
|
-
const live2 = "t.project_id = ? AND t.deleted_at IS NULL AND t.id <> ? AND (t.status
|
|
23212
|
+
const live2 = "t.project_id = ? AND t.deleted_at IS NULL AND t.id <> ? AND (t.status NOT IN ('done', 'dismissed') OR t.closed_at >= ?)";
|
|
23191
23213
|
const scope3 = [side.project, side.row ?? -1, since];
|
|
23192
23214
|
const found2 = /* @__PURE__ */ new Map();
|
|
23193
23215
|
const add = /* @__PURE__ */ __name((id2, by) => found2.set(id2, (found2.get(id2) ?? /* @__PURE__ */ new Set()).add(by)), "add");
|
|
@@ -23247,7 +23269,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
|
23247
23269
|
};
|
|
23248
23270
|
}, "taskSimilarityOver");
|
|
23249
23271
|
|
|
23250
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23272
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
|
|
23251
23273
|
var SETTING3 = "taskCategories";
|
|
23252
23274
|
var savedTaskCategories = /* @__PURE__ */ __name((database) => {
|
|
23253
23275
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
|
|
@@ -23256,7 +23278,7 @@ var savedTaskCategories = /* @__PURE__ */ __name((database) => {
|
|
|
23256
23278
|
var storeTaskCategories = /* @__PURE__ */ __name((database) => savedTaskCategories(database) ?? DEFAULT_TASK_CATEGORIES, "storeTaskCategories");
|
|
23257
23279
|
var unlistedTaskCategories = /* @__PURE__ */ __name((database, list) => {
|
|
23258
23280
|
const listed = new Set(list.map(({ name }) => name));
|
|
23259
|
-
return database.prepare("SELECT category, COUNT(*) AS total, SUM(status
|
|
23281
|
+
return database.prepare("SELECT category, COUNT(*) AS total, SUM(status NOT IN ('done', 'dismissed')) AS open FROM tasks WHERE category IS NOT NULL AND deleted_at IS NULL GROUP BY category ORDER BY category").all().map((row2) => ({ name: String(row2.category), open: Number(row2.open), total: Number(row2.total) })).filter(({ name }) => !listed.has(name));
|
|
23260
23282
|
}, "unlistedTaskCategories");
|
|
23261
23283
|
var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) => {
|
|
23262
23284
|
if (categories === void 0) {
|
|
@@ -23266,7 +23288,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
|
|
|
23266
23288
|
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);
|
|
23267
23289
|
}, "saveTaskCategories");
|
|
23268
23290
|
|
|
23269
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23291
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
|
|
23270
23292
|
var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
|
|
23271
23293
|
var ALLOWED = "taskAgentClose";
|
|
23272
23294
|
var MIN = "taskAgentCloseMin";
|
|
@@ -23322,7 +23344,7 @@ var SUGGESTION_COLUMNS = [
|
|
|
23322
23344
|
];
|
|
23323
23345
|
var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
|
|
23324
23346
|
|
|
23325
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23347
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
|
|
23326
23348
|
var EXCERPT_CHARS = 280;
|
|
23327
23349
|
var excerptOf = /* @__PURE__ */ __name((text5) => {
|
|
23328
23350
|
if (text5 == null)
|
|
@@ -23365,7 +23387,7 @@ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => database.pre
|
|
|
23365
23387
|
};
|
|
23366
23388
|
}), "evidenceSourcesOf");
|
|
23367
23389
|
|
|
23368
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23390
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/attachments/limits.js
|
|
23369
23391
|
var MAX_FILE_BYTES = 50 * 1024 * 1024;
|
|
23370
23392
|
var MAX_TEXT_CHARS = 2e6;
|
|
23371
23393
|
var ATTACHMENT_LIMIT_ENV = [
|
|
@@ -23391,7 +23413,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
|
|
|
23391
23413
|
return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
|
|
23392
23414
|
}, "pdfPreviewLimits");
|
|
23393
23415
|
|
|
23394
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23416
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/ulid.js
|
|
23395
23417
|
import { randomBytes } from "node:crypto";
|
|
23396
23418
|
var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
23397
23419
|
var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
|
|
@@ -23404,16 +23426,16 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
|
|
|
23404
23426
|
return time3 + random;
|
|
23405
23427
|
}, "ulid");
|
|
23406
23428
|
|
|
23407
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23429
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
|
|
23408
23430
|
var FOLDED_FIELDS = ["title", "site", "language", "author"];
|
|
23409
23431
|
var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
|
|
23410
23432
|
if (!meta && !sections?.length)
|
|
23411
23433
|
return null;
|
|
23412
23434
|
const folded5 = {};
|
|
23413
|
-
for (const
|
|
23414
|
-
const value = meta?.[
|
|
23435
|
+
for (const field4 of FOLDED_FIELDS) {
|
|
23436
|
+
const value = meta?.[field4];
|
|
23415
23437
|
if (typeof value === "string" && value !== "")
|
|
23416
|
-
folded5[
|
|
23438
|
+
folded5[field4] = normalize(value);
|
|
23417
23439
|
}
|
|
23418
23440
|
const keywords = meta?.keywords;
|
|
23419
23441
|
if (Array.isArray(keywords) && keywords.length)
|
|
@@ -23425,7 +23447,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
|
|
|
23425
23447
|
return typeof language === "string" && language !== "" ? language : null;
|
|
23426
23448
|
}, "languageOf");
|
|
23427
23449
|
|
|
23428
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23450
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
|
|
23429
23451
|
var isObject = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
|
|
23430
23452
|
var objectOf = /* @__PURE__ */ __name((value) => {
|
|
23431
23453
|
if (isObject(value))
|
|
@@ -23668,7 +23690,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
23668
23690
|
};
|
|
23669
23691
|
}, "filesStoreOver");
|
|
23670
23692
|
|
|
23671
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23693
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
|
|
23672
23694
|
var IMPORTED_DOCUMENT_QUERY = defineQuery({
|
|
23673
23695
|
entity: "document",
|
|
23674
23696
|
backend: "sql",
|
|
@@ -23714,7 +23736,7 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
|
|
|
23714
23736
|
return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
|
|
23715
23737
|
}, "importedDocumentWhere");
|
|
23716
23738
|
|
|
23717
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23739
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
|
|
23718
23740
|
var NOTE_FORMATS = ["obsidian", "markdown"];
|
|
23719
23741
|
var iso2 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
23720
23742
|
var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso2(value), "optionalIso");
|
|
@@ -24224,7 +24246,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
24224
24246
|
};
|
|
24225
24247
|
}, "notesStoreOver");
|
|
24226
24248
|
|
|
24227
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24249
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
|
|
24228
24250
|
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";
|
|
24229
24251
|
var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
24230
24252
|
var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
@@ -24399,7 +24421,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
24399
24421
|
};
|
|
24400
24422
|
}, "memoriesStoreOver");
|
|
24401
24423
|
|
|
24402
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24424
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
|
|
24403
24425
|
var DEFAULT_FIRST_PASS_PER_CHAT = 0;
|
|
24404
24426
|
var KEY = "taskFirstPassPerChat";
|
|
24405
24427
|
var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
|
|
@@ -24419,7 +24441,180 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
|
|
|
24419
24441
|
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);
|
|
24420
24442
|
}, "saveFirstPassPerChat");
|
|
24421
24443
|
|
|
24422
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24444
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
|
|
24445
|
+
var field = /* @__PURE__ */ __name((name, type, example, more = {}) => ({
|
|
24446
|
+
name,
|
|
24447
|
+
type,
|
|
24448
|
+
operators: OPERATORS_BY_TYPE[type],
|
|
24449
|
+
example,
|
|
24450
|
+
...more
|
|
24451
|
+
}), "field");
|
|
24452
|
+
var PROJECT_TASK_FIELDS = [
|
|
24453
|
+
field("state", "enum", "state:todo", { values: TASK_STATES }),
|
|
24454
|
+
field("kind", "enum", "kind:bug", { values: TASK_TYPES }),
|
|
24455
|
+
field("project", "kw", "project:HRB", {
|
|
24456
|
+
relation: "a project by its key or project:<id>; project:* is every project, and lists project tasks only"
|
|
24457
|
+
}),
|
|
24458
|
+
field("assignee", "kw", 'assignee:"person:12"', {
|
|
24459
|
+
relation: "who does it: any, none, or a person (person:12 in quotes, or the bare 12)"
|
|
24460
|
+
}),
|
|
24461
|
+
field("priority", "kw", "priority:high", {
|
|
24462
|
+
operators: ["term", "range", "wildcard"],
|
|
24463
|
+
relation: "low, medium, high, critical or none; a range of labels or of the 0\u20131 number: priority:[high TO critical]"
|
|
24464
|
+
}),
|
|
24465
|
+
field("agent", "kw", "agent:hermes", { relation: "the agent working on it, by name; none or any" }),
|
|
24466
|
+
field("due", "time", "due:[today TO 2026-12-31]", { relation: "the due date; NOT due:* has none" }),
|
|
24467
|
+
field("overdue", "bool", "overdue:true", { relation: "open work whose due date has passed" }),
|
|
24468
|
+
field("closed", "time", "closed:>=14d", { relation: "when it was done or dismissed" }),
|
|
24469
|
+
field("ready", "bool", "ready:true", { relation: "open work whose blocked-by tasks are all done" }),
|
|
24470
|
+
field("text", "txt", "text:invoice", { relation: "words of the title and description; a bare word means this" })
|
|
24471
|
+
];
|
|
24472
|
+
var OPEN = "t.status NOT IN ('done', 'dismissed')";
|
|
24473
|
+
var OWNER_PROJECTS = `SELECT id FROM projects WHERE deleted_at IS NULL AND length(key) <> ${INBOX_KEY_LENGTH}`;
|
|
24474
|
+
var ASSIGNED = "SELECT 1 FROM task_assignments a WHERE a.task_id = t.id AND a.assignee_type = 'person' AND a.role = 'assignee'";
|
|
24475
|
+
var UNFINISHED_BLOCKER = "SELECT 1 FROM links l LEFT JOIN tasks b ON b.id = l.to_id LEFT JOIN projects bp ON bp.id = b.project_id WHERE l.from_type = 'task' AND l.to_type = 'task' AND l.kind = 'blocked-by' AND l.from_id = t.id AND l.confirmed = 1 AND l.anchor IS NULL AND (b.id IS NULL OR b.deleted_at IS NOT NULL OR bp.deleted_at IS NOT NULL OR b.status <> 'done')";
|
|
24476
|
+
var wordsMatch = /* @__PURE__ */ __name((node) => {
|
|
24477
|
+
const words3 = taskWordsOf(node.value.replaceAll("*", " ")).split(/\s+/).filter((word) => /[\p{L}\p{N}]/u.test(word));
|
|
24478
|
+
if (words3.length === 0)
|
|
24479
|
+
return void 0;
|
|
24480
|
+
const quoted3 = /* @__PURE__ */ __name((text5) => `"${text5.replaceAll('"', '""')}"`, "quoted");
|
|
24481
|
+
return `normalized_text : (${node.operator === "phrase" ? quoted3(words3.join(" ")) : words3.map((word) => `${quoted3(word)}*`).join(" AND ")})`;
|
|
24482
|
+
}, "wordsMatch");
|
|
24483
|
+
var projectWhere = /* @__PURE__ */ __name((node) => {
|
|
24484
|
+
if (node.operator === "wildcard" && node.value === "*")
|
|
24485
|
+
return { sql: "1", params: [] };
|
|
24486
|
+
const id2 = /^project:(\d+)$/.exec(node.value.trim())?.[1];
|
|
24487
|
+
if (id2 !== void 0)
|
|
24488
|
+
return { sql: "t.project_id = ?", params: [Number(id2)] };
|
|
24489
|
+
const key2 = node.value.trim().toUpperCase();
|
|
24490
|
+
return {
|
|
24491
|
+
sql: `t.project_id IN (SELECT id FROM projects WHERE key ${node.operator === "wildcard" ? "GLOB" : "="} ?)`,
|
|
24492
|
+
params: [key2]
|
|
24493
|
+
};
|
|
24494
|
+
}, "projectWhere");
|
|
24495
|
+
var assigneeWhere = /* @__PURE__ */ __name((node) => {
|
|
24496
|
+
const value = node.value.trim().toLowerCase();
|
|
24497
|
+
if (value === "any" || node.operator === "wildcard" && value === "*")
|
|
24498
|
+
return { sql: `EXISTS (${ASSIGNED})`, params: [] };
|
|
24499
|
+
if (value === "none")
|
|
24500
|
+
return { sql: `NOT EXISTS (${ASSIGNED})`, params: [] };
|
|
24501
|
+
const id2 = /^(?:person:)?(\d+)$/.exec(value)?.[1];
|
|
24502
|
+
if (id2 === void 0)
|
|
24503
|
+
throw new CliError("validation_error", `assignee: takes any, none or "person:<id>", not "${node.value}"`);
|
|
24504
|
+
return { sql: `EXISTS (${ASSIGNED} AND a.assignee_id = ?)`, params: [Number(id2)] };
|
|
24505
|
+
}, "assigneeWhere");
|
|
24506
|
+
var bound3 = /* @__PURE__ */ __name((value, side, node) => {
|
|
24507
|
+
const word = value.trim().toLowerCase();
|
|
24508
|
+
if (word === "*")
|
|
24509
|
+
return void 0;
|
|
24510
|
+
if (PRIORITY_LABELS.includes(word))
|
|
24511
|
+
return priorityBand(word)[side];
|
|
24512
|
+
const number3 = Number(word);
|
|
24513
|
+
if (word === "" || !Number.isFinite(number3) || number3 < 0 || number3 > 1)
|
|
24514
|
+
throw new CliError("validation_error", `priority: takes ${PRIORITY_LABELS.join(", ")}, none, or 0 to 1, not "${node.value}"`);
|
|
24515
|
+
return number3;
|
|
24516
|
+
}, "bound");
|
|
24517
|
+
var priorityWhere = /* @__PURE__ */ __name((node) => {
|
|
24518
|
+
const score = "t.priority_score";
|
|
24519
|
+
if (node.operator === "wildcard") {
|
|
24520
|
+
if (node.value === "*")
|
|
24521
|
+
return { sql: `${score} IS NOT NULL`, params: [] };
|
|
24522
|
+
throw new CliError("validation_error", "priority: takes a label, none, or a range");
|
|
24523
|
+
}
|
|
24524
|
+
if (node.operator !== "range") {
|
|
24525
|
+
const word = node.value.trim().toLowerCase();
|
|
24526
|
+
if (word === "none")
|
|
24527
|
+
return { sql: `${score} IS NULL`, params: [] };
|
|
24528
|
+
if (!PRIORITY_LABELS.includes(word))
|
|
24529
|
+
throw new CliError("validation_error", `priority: takes ${PRIORITY_LABELS.join(", ")} or none; a number goes in a range`);
|
|
24530
|
+
const { from: from2, to } = priorityBand(word);
|
|
24531
|
+
return { sql: `${score} >= ? AND ${score} ${to === 1 ? "<=" : "<"} ?`, params: [from2, to] };
|
|
24532
|
+
}
|
|
24533
|
+
const lower = bound3(node.value, "from", node);
|
|
24534
|
+
const upperWord = (node.upper ?? "*").trim().toLowerCase();
|
|
24535
|
+
const upper = bound3(upperWord, "to", node);
|
|
24536
|
+
const labelUpper = PRIORITY_LABELS.includes(upperWord);
|
|
24537
|
+
const parts2 = [`${score} IS NOT NULL`];
|
|
24538
|
+
const params = [];
|
|
24539
|
+
if (lower !== void 0) {
|
|
24540
|
+
parts2.push(`${score} ${node.lower_inclusive === false ? ">" : ">="} ?`);
|
|
24541
|
+
params.push(lower);
|
|
24542
|
+
}
|
|
24543
|
+
if (upper !== void 0) {
|
|
24544
|
+
parts2.push(`${score} ${labelUpper ? upper === 1 ? "<=" : "<" : node.upper_inclusive === false ? "<" : "<="} ?`);
|
|
24545
|
+
params.push(upper);
|
|
24546
|
+
}
|
|
24547
|
+
return { sql: parts2.join(" AND "), params };
|
|
24548
|
+
}, "priorityWhere");
|
|
24549
|
+
var agentWhere = /* @__PURE__ */ __name((node) => {
|
|
24550
|
+
const value = node.value.trim().toLowerCase();
|
|
24551
|
+
if (value === "none")
|
|
24552
|
+
return { sql: "t.agent IS NULL", params: [] };
|
|
24553
|
+
if (value === "any" || node.operator === "wildcard" && value === "*")
|
|
24554
|
+
return { sql: "t.agent IS NOT NULL", params: [] };
|
|
24555
|
+
return node.operator === "wildcard" ? { sql: "lower(t.agent) GLOB ?", params: [value] } : { sql: "lower(t.agent) = ?", params: [value] };
|
|
24556
|
+
}, "agentWhere");
|
|
24557
|
+
var truth = /* @__PURE__ */ __name((node, sql2) => ({
|
|
24558
|
+
sql: node.value.toLowerCase() === "true" ? sql2 : `NOT (${sql2})`,
|
|
24559
|
+
params: []
|
|
24560
|
+
}), "truth");
|
|
24561
|
+
var projectTaskColumns = /* @__PURE__ */ __name((now2) => ({
|
|
24562
|
+
state: { type: "enum", sql: "t.status" },
|
|
24563
|
+
kind: { type: "enum", sql: "t.type" },
|
|
24564
|
+
project: { where: projectWhere },
|
|
24565
|
+
assignee: { where: assigneeWhere },
|
|
24566
|
+
priority: { where: priorityWhere },
|
|
24567
|
+
agent: { where: agentWhere },
|
|
24568
|
+
due: { type: "time", sql: "t.due_at" },
|
|
24569
|
+
closed: { type: "time", sql: "t.closed_at" },
|
|
24570
|
+
overdue: { where: /* @__PURE__ */ __name((node) => truth(node, `${OPEN} AND t.due_at IS NOT NULL AND t.due_at < ${Number(now2)}`), "where") },
|
|
24571
|
+
ready: { where: /* @__PURE__ */ __name((node) => truth(node, `${OPEN} AND NOT EXISTS (${UNFINISHED_BLOCKER})`), "where") },
|
|
24572
|
+
text: {
|
|
24573
|
+
where: /* @__PURE__ */ __name((node) => {
|
|
24574
|
+
const match = wordsMatch(node);
|
|
24575
|
+
const byKey = { sql: "t.key = ?", params: [node.value.trim().toUpperCase()] };
|
|
24576
|
+
if (match === void 0)
|
|
24577
|
+
return byKey;
|
|
24578
|
+
return {
|
|
24579
|
+
sql: `(t.id IN (SELECT rowid FROM task_words WHERE task_words MATCH ?) OR ${byKey.sql})`,
|
|
24580
|
+
params: [match, ...byKey.params]
|
|
24581
|
+
};
|
|
24582
|
+
}, "where")
|
|
24583
|
+
}
|
|
24584
|
+
}), "projectTaskColumns");
|
|
24585
|
+
var BOARD_SCOPE = `t.deleted_at IS NULL AND t.project_id IN (${OWNER_PROJECTS})`;
|
|
24586
|
+
var STATE_ORDER = `CASE t.status ${TASK_STATES.map((state, at) => `WHEN '${state}' THEN ${at}`).join(" ")} END`;
|
|
24587
|
+
var boardOrder = /* @__PURE__ */ __name((sort, descending) => {
|
|
24588
|
+
const direction = descending ? "DESC" : "ASC";
|
|
24589
|
+
const first = {
|
|
24590
|
+
priority: ["t.priority_score IS NULL", `t.priority_score ${descending ? "ASC" : "DESC"}`],
|
|
24591
|
+
due: ["t.due_at IS NULL", `t.due_at ${direction}`],
|
|
24592
|
+
created: [`t.created_at ${direction}`],
|
|
24593
|
+
updated: [`t.updated_at ${direction}`],
|
|
24594
|
+
key: [`(SELECT key FROM projects WHERE id = t.project_id) ${direction}`, `t.number ${direction}`],
|
|
24595
|
+
state: [`${STATE_ORDER} ${direction}`]
|
|
24596
|
+
}[sort];
|
|
24597
|
+
return [...first, "t.priority_score IS NULL", "t.priority_score DESC", "t.created_at", "t.id"].join(", ");
|
|
24598
|
+
}, "boardOrder");
|
|
24599
|
+
var withoutField = /* @__PURE__ */ __name((query, name) => {
|
|
24600
|
+
if (query === void 0)
|
|
24601
|
+
return void 0;
|
|
24602
|
+
const strip = /* @__PURE__ */ __name((node) => {
|
|
24603
|
+
if (walkQuery(node).every((leaf2) => leaf2.field === name))
|
|
24604
|
+
return void 0;
|
|
24605
|
+
if (node.kind === "predicate" || node.clauses.some((clause) => clause.occur === "should"))
|
|
24606
|
+
return node;
|
|
24607
|
+
const clauses = node.clauses.flatMap((clause) => {
|
|
24608
|
+
const kept = strip(clause.node);
|
|
24609
|
+
return kept === void 0 ? [] : [{ ...clause, node: kept }];
|
|
24610
|
+
});
|
|
24611
|
+
return clauses.length === 0 ? void 0 : { ...node, clauses };
|
|
24612
|
+
}, "strip");
|
|
24613
|
+
const root = strip(query.root);
|
|
24614
|
+
return root === void 0 ? void 0 : { ...query, root };
|
|
24615
|
+
}, "withoutField");
|
|
24616
|
+
|
|
24617
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
|
|
24423
24618
|
var TASK_RELATION_KINDS = [
|
|
24424
24619
|
"blocked-by",
|
|
24425
24620
|
"follow-up-of",
|
|
@@ -24531,7 +24726,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
|
|
|
24531
24726
|
task: ref3(Number(row2.to_id)),
|
|
24532
24727
|
state: row2.status == null || row2.deleted_at != null || row2.project_deleted != null ? "unavailable" : row2.status === "dismissed" ? "dismissed" : "open"
|
|
24533
24728
|
}));
|
|
24534
|
-
return { ready: liveTask(database, rowId).status
|
|
24729
|
+
return { ready: !isClosedState(String(liveTask(database, rowId).status)) && blockers.length === 0, blockers };
|
|
24535
24730
|
}), "taskReadiness"),
|
|
24536
24731
|
readyTasks: /* @__PURE__ */ __name(async (project, options = {}) => read(database, () => {
|
|
24537
24732
|
const limit = options.limit ?? 50;
|
|
@@ -24540,7 +24735,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
|
|
|
24540
24735
|
const row2 = project.startsWith("project:") ? database.prepare("SELECT id FROM projects WHERE id=? AND account_id IS NULL AND deleted_at IS NULL").get(project.slice(8)) : database.prepare("SELECT id FROM projects WHERE key=? AND account_id IS NULL AND deleted_at IS NULL").get(project.trim().toUpperCase());
|
|
24541
24736
|
if (!row2)
|
|
24542
24737
|
throw new CliError("not_found", "the owner project is unavailable");
|
|
24543
|
-
const rows = database.prepare("SELECT coalesce(t.package_id,t.key) AS id,t.key,substr(t.title,1,300) AS title FROM tasks t WHERE t.project_id=? AND t.status
|
|
24738
|
+
const rows = database.prepare("SELECT coalesce(t.package_id,t.key) AS id,t.key,substr(t.title,1,300) AS title FROM tasks t WHERE t.project_id=? AND t.status NOT IN ('done','dismissed') AND t.deleted_at IS NULL AND NOT EXISTS (SELECT 1 FROM links l LEFT JOIN tasks b ON b.id=l.to_id LEFT JOIN projects p ON p.id=b.project_id WHERE l.from_type='task' AND l.to_type='task' AND l.kind='blocked-by' AND l.from_id=t.id AND l.confirmed=1 AND l.anchor IS NULL AND (b.id IS NULL OR b.deleted_at IS NOT NULL OR p.deleted_at IS NOT NULL OR b.status!='done')) ORDER BY t.priority_score IS NULL,t.priority_score DESC,t.number,t.id LIMIT ?").all(Number(row2.id), limit + 1);
|
|
24544
24739
|
return {
|
|
24545
24740
|
items: rows.slice(0, limit).map((value) => ({ id: String(value.id), key: String(value.key), title: String(value.title ?? "") })),
|
|
24546
24741
|
hasMore: rows.length > limit
|
|
@@ -24549,7 +24744,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
|
|
|
24549
24744
|
};
|
|
24550
24745
|
}, "taskRelationsStoreOver");
|
|
24551
24746
|
|
|
24552
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24747
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
|
|
24553
24748
|
var TASK_ROLES = ["assignee", "reviewer", "watcher"];
|
|
24554
24749
|
var iso4 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
24555
24750
|
var recordTaskEvent = /* @__PURE__ */ __name((database, task, actor, kind3, changes, at) => {
|
|
@@ -24562,11 +24757,11 @@ var textOf3 = /* @__PURE__ */ __name((value, what, max) => {
|
|
|
24562
24757
|
return text5;
|
|
24563
24758
|
}, "textOf");
|
|
24564
24759
|
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");
|
|
24565
|
-
var
|
|
24566
|
-
if (
|
|
24567
|
-
|
|
24568
|
-
|
|
24569
|
-
}, "
|
|
24760
|
+
var checkRevision = /* @__PURE__ */ __name((row2, expected) => {
|
|
24761
|
+
if (expected === void 0 || Number(row2.revision) === expected)
|
|
24762
|
+
return;
|
|
24763
|
+
throw new CliError("configuration_error", `task ${String(row2.key)} changed since revision ${expected}; it is at ${String(row2.revision)}: read it again`, { reason: "task.stale", revision: Number(row2.revision) });
|
|
24764
|
+
}, "checkRevision");
|
|
24570
24765
|
var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
24571
24766
|
const { database, now: now2 } = context;
|
|
24572
24767
|
const required3 = /* @__PURE__ */ __name((id2) => {
|
|
@@ -24619,7 +24814,10 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24619
24814
|
description: row2.description == null ? null : String(row2.description),
|
|
24620
24815
|
type: row2.type,
|
|
24621
24816
|
status: row2.status,
|
|
24622
|
-
priority: row2.
|
|
24817
|
+
priority: row2.priority_score == null ? null : Number(row2.priority_score),
|
|
24818
|
+
priorityLabel: priorityLabel(row2.priority_score == null ? null : Number(row2.priority_score)),
|
|
24819
|
+
agent: row2.agent == null ? null : String(row2.agent),
|
|
24820
|
+
revision: Number(row2.revision),
|
|
24623
24821
|
parent: row2.parent_id == null ? null : reference2(Number(row2.parent_id)),
|
|
24624
24822
|
source: row2.source_locator == null ? null : String(row2.source_locator),
|
|
24625
24823
|
dueAt: iso4(row2.due_at),
|
|
@@ -24636,6 +24834,19 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24636
24834
|
updatedAt: iso4(row2.updated_at)
|
|
24637
24835
|
};
|
|
24638
24836
|
}, "detailsOf");
|
|
24837
|
+
const stemmerFor2 = stemmerCache();
|
|
24838
|
+
const touch = /* @__PURE__ */ __name((task, at) => database.prepare("UPDATE tasks SET updated_at = ? WHERE id = ?").run(at, task), "touch");
|
|
24839
|
+
const boardWhere = /* @__PURE__ */ __name((query, zone, at) => {
|
|
24840
|
+
if (query === void 0)
|
|
24841
|
+
return { sql: BOARD_SCOPE, params: [] };
|
|
24842
|
+
const where = queryFilter(query, projectTaskColumns(at), {
|
|
24843
|
+
command: "tasks list",
|
|
24844
|
+
now: at,
|
|
24845
|
+
...zone ? { zone } : {}
|
|
24846
|
+
});
|
|
24847
|
+
return { sql: `${BOARD_SCOPE} AND (${where.sql})`, params: where.params };
|
|
24848
|
+
}, "boardWhere");
|
|
24849
|
+
const countOf = /* @__PURE__ */ __name((where) => Number(database.prepare(`SELECT count(*) AS n FROM tasks t WHERE ${where.sql}`).get(...where.params)?.n ?? 0), "countOf");
|
|
24639
24850
|
const rowById = /* @__PURE__ */ __name((id2) => database.prepare("SELECT * FROM tasks WHERE id = ?").get(id2), "rowById");
|
|
24640
24851
|
const details2 = /* @__PURE__ */ __name((id2) => detailsOf(rowById(id2)), "details");
|
|
24641
24852
|
const edit = /* @__PURE__ */ __name((task, fields4, actor, created = false) => {
|
|
@@ -24643,13 +24854,13 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24643
24854
|
const at = now2();
|
|
24644
24855
|
const set = [];
|
|
24645
24856
|
const values = [];
|
|
24646
|
-
const change = /* @__PURE__ */ __name((column2, value, event) => {
|
|
24857
|
+
const change = /* @__PURE__ */ __name((column2, value, event, key2 = column2) => {
|
|
24647
24858
|
if ((before2[column2] ?? null) === value)
|
|
24648
24859
|
return;
|
|
24649
24860
|
set.push(`${column2} = ?`);
|
|
24650
24861
|
values.push(value);
|
|
24651
24862
|
if (event)
|
|
24652
|
-
recordTaskEvent(database, task, actor, event, { [
|
|
24863
|
+
recordTaskEvent(database, task, actor, event, { [key2]: [before2[column2] ?? null, value] }, at);
|
|
24653
24864
|
}, "change");
|
|
24654
24865
|
if (fields4.title !== void 0) {
|
|
24655
24866
|
const title = textOf3(fields4.title, "a task's title", 300);
|
|
@@ -24658,23 +24869,35 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24658
24869
|
}
|
|
24659
24870
|
if (fields4.description !== void 0)
|
|
24660
24871
|
change("description", fields4.description === null ? null : textOf3(fields4.description, "a description", 2e4), created ? void 0 : "description");
|
|
24661
|
-
if (fields4.priority !== void 0)
|
|
24662
|
-
|
|
24872
|
+
if (fields4.priority !== void 0) {
|
|
24873
|
+
const score = fields4.priority === null ? null : checkedScore(fields4.priority);
|
|
24874
|
+
change("priority_score", score, "priority", "priority");
|
|
24875
|
+
change("priority", legacyPriority(score));
|
|
24876
|
+
}
|
|
24877
|
+
if (fields4.agent !== void 0)
|
|
24878
|
+
change("agent", fields4.agent === null ? null : textOf3(fields4.agent, "an agent's name", 100), "agent");
|
|
24663
24879
|
if (fields4.parent !== void 0)
|
|
24664
24880
|
change("parent_id", fields4.parent === null ? null : parentOf(task, Number(before2.project_id), fields4.parent));
|
|
24665
24881
|
if (fields4.dueAt !== void 0)
|
|
24666
24882
|
change("due_at", fields4.dueAt === null ? null : fields4.dueAt.getTime(), "due");
|
|
24667
24883
|
if (fields4.nextCheckAt !== void 0)
|
|
24668
|
-
change("next_check_at", fields4.nextCheckAt === null ? null : fields4.nextCheckAt.getTime());
|
|
24884
|
+
change("next_check_at", fields4.nextCheckAt === null ? null : fields4.nextCheckAt.getTime(), "next-check");
|
|
24669
24885
|
if (fields4.status !== void 0) {
|
|
24670
24886
|
if (!TASK_STATES.includes(fields4.status))
|
|
24671
24887
|
throw new CliError("validation_error", `a task's status is one of ${TASK_STATES.join(", ")}`);
|
|
24672
|
-
|
|
24888
|
+
if ((fields4.status === "todo" || fields4.status === "in_progress") && String(database.prepare("SELECT key FROM projects WHERE id = ?").get(Number(before2.project_id))?.key).length === INBOX_KEY_LENGTH)
|
|
24889
|
+
throw new CliError("validation_error", "a task from a message is open, done or dismissed; todo and in_progress are for a project task");
|
|
24890
|
+
const closed = isClosedState(fields4.status);
|
|
24891
|
+
const reopened = !closed && isClosedState(String(before2.status));
|
|
24673
24892
|
if (before2.status !== fields4.status) {
|
|
24674
24893
|
change("status", fields4.status, "status");
|
|
24675
|
-
|
|
24676
|
-
|
|
24677
|
-
|
|
24894
|
+
if (fields4.status === "in_progress" && before2.started_at == null)
|
|
24895
|
+
change("started_at", at);
|
|
24896
|
+
if (closed || reopened) {
|
|
24897
|
+
change("closed_at", closed ? at : null);
|
|
24898
|
+
change("closed_by_type", closed ? actor.type : null);
|
|
24899
|
+
change("closed_by_id", closed ? actor.id : null);
|
|
24900
|
+
}
|
|
24678
24901
|
if (closed) {
|
|
24679
24902
|
change("claimed_by", null);
|
|
24680
24903
|
change("claimed_until", null);
|
|
@@ -24682,6 +24905,10 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24682
24905
|
change(column2, null);
|
|
24683
24906
|
} else
|
|
24684
24907
|
change("close_certainty", null);
|
|
24908
|
+
if (reopened && fields4.reason === void 0) {
|
|
24909
|
+
change("close_reason", null);
|
|
24910
|
+
change("close_reason_folded", null);
|
|
24911
|
+
}
|
|
24685
24912
|
}
|
|
24686
24913
|
}
|
|
24687
24914
|
if (fields4.reason !== void 0) {
|
|
@@ -24695,6 +24922,64 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24695
24922
|
return;
|
|
24696
24923
|
database.prepare(`UPDATE tasks SET ${set.join(", ")}, updated_at = ? WHERE id = ?`).run(...values, at, task);
|
|
24697
24924
|
}, "edit");
|
|
24925
|
+
const columnOf = /* @__PURE__ */ __name((task, status) => database.prepare(`SELECT t.id, t.key, coalesce(t.priority_score, 0) AS score FROM tasks t WHERE ${BOARD_SCOPE} AND t.status = ? AND t.id <> ? ORDER BY ${boardOrder("priority", false)}`).all(status, task).map((row2) => ({ id: Number(row2.id), key: String(row2.key), score: Number(row2.score) })), "columnOf");
|
|
24926
|
+
const moveTask = /* @__PURE__ */ __name((task, row2, move2, actor) => {
|
|
24927
|
+
if (move2.before !== void 0 && move2.after !== void 0)
|
|
24928
|
+
throw new CliError("validation_error", "give --before or --after, not both");
|
|
24929
|
+
if (!database.prepare(`SELECT 1 FROM tasks t WHERE t.id = ? AND ${BOARD_SCOPE}`).get(task))
|
|
24930
|
+
throw new CliError("validation_error", "only a project task moves on the board");
|
|
24931
|
+
const neighbour = move2.before ?? move2.after;
|
|
24932
|
+
if (neighbour === void 0) {
|
|
24933
|
+
const status2 = move2.status ?? row2.status;
|
|
24934
|
+
if (columnOf(task, status2).length > 0 || move2.status === void 0)
|
|
24935
|
+
throw new CliError("validation_error", "say where it goes: --before <key> or --after <key>");
|
|
24936
|
+
const from3 = priorityLabel(row2.priority_score == null ? null : Number(row2.priority_score));
|
|
24937
|
+
edit(task, { status: move2.status }, actor);
|
|
24938
|
+
return { label: { from: from3, to: from3, changed: false }, renumbered: [] };
|
|
24939
|
+
}
|
|
24940
|
+
const target = required3(neighbour);
|
|
24941
|
+
const anchor = database.prepare(`SELECT t.key, t.status FROM tasks t WHERE t.id = ? AND ${BOARD_SCOPE}`).get(target);
|
|
24942
|
+
if (target === task)
|
|
24943
|
+
throw new CliError("validation_error", "a task moves beside another task, not itself");
|
|
24944
|
+
if (!anchor)
|
|
24945
|
+
throw new CliError("validation_error", `${neighbour} is not on a project's board`);
|
|
24946
|
+
const status = anchor.status;
|
|
24947
|
+
if (move2.status !== void 0 && move2.status !== status)
|
|
24948
|
+
throw new CliError("validation_error", `${String(anchor.key)} is in ${status}, not ${move2.status}: pick a task in the ${move2.status} column`, { reason: "task.column", anchor: String(anchor.key), anchorStatus: status, requestedStatus: move2.status });
|
|
24949
|
+
const column2 = columnOf(task, status);
|
|
24950
|
+
const at = column2.findIndex(({ id: id2 }) => id2 === target);
|
|
24951
|
+
const index2 = move2.before === void 0 ? at + 1 : at;
|
|
24952
|
+
const above = column2[index2 - 1];
|
|
24953
|
+
const below = column2[index2];
|
|
24954
|
+
const STEP = 1 / 64;
|
|
24955
|
+
const score = above === void 0 ? Math.min(1, (below?.score ?? 0) + STEP) : below === void 0 ? Math.max(0, above.score - STEP) : (above.score + below.score) / 2;
|
|
24956
|
+
const roomy = (above === void 0 || score < above.score) && (below === void 0 || score > below.score);
|
|
24957
|
+
const from2 = priorityLabel(row2.priority_score == null ? null : Number(row2.priority_score));
|
|
24958
|
+
const renumbered = [];
|
|
24959
|
+
let given = score;
|
|
24960
|
+
if (!roomy || above !== void 0 && below !== void 0 && above.score - below.score < 1e-9) {
|
|
24961
|
+
const label = priorityLabel((above ?? below)?.score ?? 0);
|
|
24962
|
+
const band = priorityBand(label);
|
|
24963
|
+
const inBand = /* @__PURE__ */ __name((one) => priorityLabel(one.score) === label, "inBand");
|
|
24964
|
+
const ordered = [...column2.slice(0, index2), { id: task, key: String(row2.key), score }, ...column2.slice(index2)];
|
|
24965
|
+
const spread = ordered.filter((one) => one.id === task || inBand(one));
|
|
24966
|
+
const gap = (band.to - band.from) / (spread.length + 1);
|
|
24967
|
+
spread.forEach((one, place) => {
|
|
24968
|
+
const value = band.to - gap * (place + 1);
|
|
24969
|
+
if (one.id === task) {
|
|
24970
|
+
given = value;
|
|
24971
|
+
return;
|
|
24972
|
+
}
|
|
24973
|
+
if (one.score === value)
|
|
24974
|
+
return;
|
|
24975
|
+
edit(one.id, { priority: value }, actor);
|
|
24976
|
+
renumbered.push(one.key);
|
|
24977
|
+
});
|
|
24978
|
+
}
|
|
24979
|
+
edit(task, { priority: given, status }, actor);
|
|
24980
|
+
const to = priorityLabel(given);
|
|
24981
|
+
return { label: { from: from2, to, changed: from2 !== to }, renumbered };
|
|
24982
|
+
}, "moveTask");
|
|
24698
24983
|
return {
|
|
24699
24984
|
...taskRelationsStoreOver(context, (task, actor, kind3, changes, at) => recordTaskEvent(database, task, actor, kind3, changes, at)),
|
|
24700
24985
|
create: /* @__PURE__ */ __name((input, by) => {
|
|
@@ -24716,22 +25001,36 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24716
25001
|
});
|
|
24717
25002
|
return details2(made);
|
|
24718
25003
|
}, "create"),
|
|
24719
|
-
edit: /* @__PURE__ */ __name(async (id2, fields4, by) => {
|
|
25004
|
+
edit: /* @__PURE__ */ __name(async (id2, fields4, by, check3 = {}) => {
|
|
24720
25005
|
const task = required3(id2);
|
|
24721
|
-
write(database, () =>
|
|
25006
|
+
write(database, () => {
|
|
25007
|
+
checkRevision(rowById(task), check3.revision);
|
|
25008
|
+
edit(task, fields4, authorActor(context, by).actor);
|
|
25009
|
+
});
|
|
24722
25010
|
return details2(task);
|
|
24723
25011
|
}, "edit"),
|
|
24724
|
-
|
|
25012
|
+
move: /* @__PURE__ */ __name(async (id2, move2, by, check3 = {}) => {
|
|
25013
|
+
const task = required3(id2);
|
|
25014
|
+
return write(database, () => {
|
|
25015
|
+
const row2 = rowById(task);
|
|
25016
|
+
checkRevision(row2, check3.revision);
|
|
25017
|
+
const moved = moveTask(task, row2, move2, authorActor(context, by).actor);
|
|
25018
|
+
return { ...moved, task: details2(task) };
|
|
25019
|
+
});
|
|
25020
|
+
}, "move"),
|
|
25021
|
+
assign: /* @__PURE__ */ __name((id2, { to, role }, by, check3 = {}) => {
|
|
24725
25022
|
if (!TASK_ROLES.includes(role))
|
|
24726
25023
|
throw new CliError("validation_error", `a role is one of ${TASK_ROLES.join(", ")}`);
|
|
24727
25024
|
const task = required3(id2);
|
|
24728
25025
|
write(database, () => {
|
|
25026
|
+
checkRevision(rowById(task), check3.revision);
|
|
24729
25027
|
const person2 = personOf2(to);
|
|
24730
25028
|
const held = database.prepare("SELECT 1 FROM task_assignments WHERE task_id = ? AND assignee_type = 'person' AND assignee_id = ? AND role = ?").get(task, person2, role);
|
|
24731
25029
|
if (held)
|
|
24732
25030
|
return;
|
|
24733
25031
|
const at = now2();
|
|
24734
25032
|
database.prepare("INSERT INTO task_assignments (task_id, assignee_type, assignee_id, role, created_at, updated_at) VALUES (?, 'person', ?, ?, ?, ?)").run(task, person2, role, at, at);
|
|
25033
|
+
touch(task, at);
|
|
24735
25034
|
const changes = { [role]: [null, `person:${person2}`] };
|
|
24736
25035
|
recordTaskEvent(database, task, authorActor(context, by).actor, "assigned", changes, at);
|
|
24737
25036
|
});
|
|
@@ -24752,15 +25051,18 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24752
25051
|
const row2 = database.prepare("SELECT p.id FROM messages m JOIN identity_links il ON il.identity_id = m.sender_identity_id JOIN persons p ON p.id = il.person_id WHERE m.id = ? AND m.outgoing = 0 AND p.owner = 0").get(thing.id);
|
|
24753
25052
|
return row2 ? `person:${String(row2.id)}` : void 0;
|
|
24754
25053
|
}, "sourceSender"),
|
|
24755
|
-
unassign: /* @__PURE__ */ __name(async (id2, { to, role }, by) => {
|
|
25054
|
+
unassign: /* @__PURE__ */ __name(async (id2, { to, role }, by, check3 = {}) => {
|
|
24756
25055
|
const task = required3(id2);
|
|
24757
25056
|
write(database, () => {
|
|
25057
|
+
checkRevision(rowById(task), check3.revision);
|
|
24758
25058
|
const person2 = personOf2(to);
|
|
24759
25059
|
const removed = database.prepare("DELETE FROM task_assignments WHERE task_id = ? AND assignee_type = 'person' AND assignee_id = ? AND role = ?").run(task, person2, role).changes;
|
|
24760
25060
|
if (removed === 0)
|
|
24761
25061
|
return;
|
|
25062
|
+
const at = now2();
|
|
25063
|
+
touch(task, at);
|
|
24762
25064
|
const changes = { [role]: [`person:${person2}`, null] };
|
|
24763
|
-
recordTaskEvent(database, task, authorActor(context, by).actor, "unassigned", changes,
|
|
25065
|
+
recordTaskEvent(database, task, authorActor(context, by).actor, "unassigned", changes, at);
|
|
24764
25066
|
});
|
|
24765
25067
|
return details2(task);
|
|
24766
25068
|
}, "unassign"),
|
|
@@ -24777,15 +25079,21 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24777
25079
|
throw new CliError("validation_error", `a task's type is one of ${TASK_TYPES.join(", ")}`);
|
|
24778
25080
|
const projectId = project === void 0 ? null : projectOf(project);
|
|
24779
25081
|
const person2 = assignee === void 0 ? null : personOf2(assignee);
|
|
24780
|
-
return database.prepare(`SELECT * FROM tasks t WHERE deleted_at IS NULL AND (? IS NULL OR project_id = ?) AND (? IS NULL OR type = ?) AND (? IS NULL OR status = ?) AND (? IS NULL OR EXISTS (SELECT 1 FROM task_assignments a WHERE a.task_id = t.id AND a.assignee_type = 'person' AND a.assignee_id = ?)) AND (${where?.sql || "1"}) ORDER BY
|
|
25082
|
+
return database.prepare(`SELECT * FROM tasks t WHERE deleted_at IS NULL AND (? IS NULL OR project_id = ?) AND (? IS NULL OR type = ?) AND (? IS NULL OR status = ?) AND (? IS NULL OR EXISTS (SELECT 1 FROM task_assignments a WHERE a.task_id = t.id AND a.assignee_type = 'person' AND a.assignee_id = ?)) AND (${where?.sql || "1"}) ORDER BY priority_score IS NULL, priority_score DESC, created_at, id LIMIT ?`).all(projectId, projectId, type ?? null, type ?? null, status ?? null, status ?? null, person2, person2, ...where?.params ?? [], Math.min(Math.max(limit, 1), 500)).map(detailsOf);
|
|
24781
25083
|
}, "find"),
|
|
24782
25084
|
claim: /* @__PURE__ */ __name(async (id2, holder, until) => {
|
|
24783
25085
|
const task = required3(id2);
|
|
24784
25086
|
const at = now2();
|
|
24785
|
-
const won = write(database, () =>
|
|
25087
|
+
const won = write(database, () => {
|
|
25088
|
+
const before2 = claimOf(rowById(task), at).claimedBy;
|
|
25089
|
+
const claimed = database.prepare("UPDATE tasks SET claimed_by = ?, claimed_until = ?, updated_at = ? WHERE id = ? AND status NOT IN ('done', 'dismissed') AND (claimed_by IS NULL OR claimed_until < ? OR claimed_by = ?) RETURNING id").get(holder, until.getTime(), at, task, at, holder);
|
|
25090
|
+
if (claimed)
|
|
25091
|
+
recordTaskEvent(database, task, null, "claimed", { claimed_by: [before2, holder] }, at);
|
|
25092
|
+
return claimed;
|
|
25093
|
+
});
|
|
24786
25094
|
if (!won) {
|
|
24787
25095
|
const row2 = rowById(task);
|
|
24788
|
-
if (row2.status
|
|
25096
|
+
if (isClosedState(String(row2.status)))
|
|
24789
25097
|
throw new CliError("validation_error", `task ${String(row2.key)} is ${String(row2.status)}; only an open task is claimed`);
|
|
24790
25098
|
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) });
|
|
24791
25099
|
}
|
|
@@ -24800,13 +25108,66 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24800
25108
|
throw new CliError("validation_error", `${claimedBy} holds task ${String(row2.key)}; only they or the owner release it`, {
|
|
24801
25109
|
reason: "task.claimed"
|
|
24802
25110
|
});
|
|
24803
|
-
|
|
25111
|
+
const at = now2();
|
|
25112
|
+
database.prepare("UPDATE tasks SET claimed_by = NULL, claimed_until = NULL, updated_at = ? WHERE id = ?").run(at, task);
|
|
25113
|
+
if (claimedBy !== null)
|
|
25114
|
+
recordTaskEvent(database, task, null, "released", { claimed_by: [claimedBy, null] }, at);
|
|
24804
25115
|
});
|
|
24805
25116
|
return details2(task);
|
|
24806
25117
|
}, "release"),
|
|
24807
|
-
|
|
25118
|
+
board: /* @__PURE__ */ __name(async (query, { limit, offset = 0, sort = "priority", descending = false, zone }) => {
|
|
25119
|
+
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 500)
|
|
25120
|
+
throw new CliError("validation_error", "a page of tasks holds 1\u2013500");
|
|
25121
|
+
drainCorpus(database, CORPORA.task, stemmerFor2);
|
|
25122
|
+
const where = boardWhere(query, zone, now2());
|
|
25123
|
+
const rows = database.prepare(`SELECT t.* FROM tasks t WHERE ${where.sql} ORDER BY ${boardOrder(sort, descending)} LIMIT ? OFFSET ?`).all(...where.params, limit, offset);
|
|
25124
|
+
return { items: rows.map(detailsOf), total: countOf(where) };
|
|
25125
|
+
}, "board"),
|
|
25126
|
+
boardCounts: /* @__PURE__ */ __name(async (query, { zone } = {}) => {
|
|
25127
|
+
drainCorpus(database, CORPORA.task, stemmerFor2);
|
|
25128
|
+
const at = now2();
|
|
25129
|
+
const without = /* @__PURE__ */ __name((name) => boardWhere(withoutField(query, name), zone, at), "without");
|
|
25130
|
+
const grouped = /* @__PURE__ */ __name((name, select2, from2, group) => {
|
|
25131
|
+
const where = without(name);
|
|
25132
|
+
return database.prepare(`SELECT ${select2}, count(*) AS n FROM tasks t ${from2} WHERE ${where.sql} GROUP BY ${group}`).all(...where.params);
|
|
25133
|
+
}, "grouped");
|
|
25134
|
+
const project = grouped("project", "p.key, p.name", "JOIN projects p ON p.id = t.project_id", "p.id").map((row2) => ({ value: String(row2.key), name: String(row2.name), count: Number(row2.n) })).sort((a, b) => a.value.localeCompare(b.value));
|
|
25135
|
+
const assigned = grouped("assignee", "a.assignee_id AS person, pe.name", "LEFT JOIN task_assignments a ON a.task_id = t.id AND a.assignee_type = 'person' AND a.role = 'assignee' LEFT JOIN persons pe ON pe.id = a.assignee_id", "a.assignee_id");
|
|
25136
|
+
const assignee = assigned.map((row2) => ({
|
|
25137
|
+
value: row2.person == null ? "none" : `person:${row2.person}`,
|
|
25138
|
+
name: row2.name == null ? null : String(row2.name),
|
|
25139
|
+
count: Number(row2.n)
|
|
25140
|
+
})).sort((a, b) => b.count - a.count || a.value.localeCompare(b.value));
|
|
25141
|
+
const priorities = /* @__PURE__ */ new Map();
|
|
25142
|
+
for (const row2 of grouped("priority", "t.priority_score", "", "t.priority_score")) {
|
|
25143
|
+
const label = priorityLabel(row2.priority_score == null ? null : Number(row2.priority_score)) ?? "none";
|
|
25144
|
+
priorities.set(label, (priorities.get(label) ?? 0) + Number(row2.n));
|
|
25145
|
+
}
|
|
25146
|
+
const states = new Map(grouped("state", "t.status", "", "t.status").map((row2) => [row2.status, Number(row2.n)]));
|
|
25147
|
+
return {
|
|
25148
|
+
total: countOf(boardWhere(query, zone, at)),
|
|
25149
|
+
project,
|
|
25150
|
+
assignee,
|
|
25151
|
+
priority: [...[...PRIORITY_LABELS].reverse(), "none"].map((value) => ({
|
|
25152
|
+
value,
|
|
25153
|
+
count: priorities.get(value) ?? 0
|
|
25154
|
+
})),
|
|
25155
|
+
state: TASK_STATES.map((value) => ({ value, count: states.get(value) ?? 0 }))
|
|
25156
|
+
};
|
|
25157
|
+
}, "boardCounts"),
|
|
25158
|
+
taskPeople: /* @__PURE__ */ __name(async () => database.prepare("SELECT p.id, p.name, p.owner, count(DISTINCT t.id) AS n FROM persons p LEFT JOIN task_assignments a ON a.assignee_type = 'person' AND a.assignee_id = p.id LEFT JOIN tasks t ON t.id = a.task_id AND t.deleted_at IS NULL WHERE p.owner = 1 OR t.id IS NOT NULL GROUP BY p.id ORDER BY p.owner DESC, p.name COLLATE NOCASE, p.id").all().map((row2) => ({
|
|
25159
|
+
person: `person:${row2.id}`,
|
|
25160
|
+
name: row2.name == null ? null : String(row2.name),
|
|
25161
|
+
owner: Number(row2.owner) === 1,
|
|
25162
|
+
tasks: Number(row2.n)
|
|
25163
|
+
})), "taskPeople"),
|
|
25164
|
+
events: /* @__PURE__ */ __name(async (id2) => database.prepare("SELECT e.actor_type, e.actor_id, e.kind, e.changes, e.created_at, CASE e.actor_type WHEN 'person' THEN p.name WHEN 'bot' THEN b.name END AS actor_name FROM task_events e LEFT JOIN persons p ON e.actor_type = 'person' AND p.id = e.actor_id LEFT JOIN bots b ON e.actor_type = 'bot' AND b.id = e.actor_id WHERE e.task_id = ? ORDER BY e.id").all(required3(id2)).map((row2) => ({
|
|
24808
25165
|
kind: row2.kind,
|
|
24809
|
-
actor: row2.actor_type == null ? null : {
|
|
25166
|
+
actor: row2.actor_type == null ? null : {
|
|
25167
|
+
type: row2.actor_type,
|
|
25168
|
+
id: Number(row2.actor_id),
|
|
25169
|
+
name: row2.actor_name == null ? null : String(row2.actor_name)
|
|
25170
|
+
},
|
|
24810
25171
|
changes: row2.changes == null ? null : JSON.parse(String(row2.changes)),
|
|
24811
25172
|
at: iso4(row2.created_at)
|
|
24812
25173
|
})), "events")
|
|
@@ -24817,11 +25178,11 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
|
|
|
24817
25178
|
return {
|
|
24818
25179
|
...operations,
|
|
24819
25180
|
create: /* @__PURE__ */ __name(async (input, by) => operations.create(input, by), "create"),
|
|
24820
|
-
assign: /* @__PURE__ */ __name(async (id2, assignment, by) => operations.assign(id2, assignment, by), "assign")
|
|
25181
|
+
assign: /* @__PURE__ */ __name(async (id2, assignment, by, check3) => operations.assign(id2, assignment, by, check3), "assign")
|
|
24821
25182
|
};
|
|
24822
25183
|
}, "workTasksOver");
|
|
24823
25184
|
|
|
24824
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25185
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
|
|
24825
25186
|
var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
24826
25187
|
const { database, now: now2 } = context;
|
|
24827
25188
|
const liveRow = /* @__PURE__ */ __name((id2) => {
|
|
@@ -24839,7 +25200,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
|
24839
25200
|
closeSuggestion: /* @__PURE__ */ __name(async (id2) => closeSuggestionOf(database, liveRow(id2)), "closeSuggestion"),
|
|
24840
25201
|
suggestClose: /* @__PURE__ */ __name(async (id2, suggestion, by) => write(database, () => {
|
|
24841
25202
|
const row2 = liveRow(id2);
|
|
24842
|
-
if (row2.status
|
|
25203
|
+
if (isClosedState(String(row2.status)))
|
|
24843
25204
|
throw new CliError("validation_error", `task ${String(row2.key)} is already ${String(row2.status)}`, {
|
|
24844
25205
|
reason: "task.closed"
|
|
24845
25206
|
});
|
|
@@ -24862,12 +25223,15 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
|
24862
25223
|
}), "suggestClose"),
|
|
24863
25224
|
recordCloseCertainty: /* @__PURE__ */ __name(async (id2, certainty) => write(database, () => {
|
|
24864
25225
|
const row2 = liveRow(id2);
|
|
24865
|
-
|
|
25226
|
+
const value = certaintyOf(certainty);
|
|
25227
|
+
database.prepare("UPDATE tasks SET close_certainty = ? WHERE id = ?").run(value, Number(row2.id));
|
|
25228
|
+
if ((row2.close_certainty ?? null) !== value)
|
|
25229
|
+
recordTaskEvent(database, Number(row2.id), null, "close-certainty", { close_certainty: [row2.close_certainty ?? null, value] }, now2());
|
|
24866
25230
|
}), "recordCloseCertainty")
|
|
24867
25231
|
};
|
|
24868
25232
|
}, "taskCloseOver");
|
|
24869
25233
|
|
|
24870
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25234
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
|
|
24871
25235
|
var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
24872
25236
|
const { database, now: now2 } = context;
|
|
24873
25237
|
const required3 = /* @__PURE__ */ __name((id2) => {
|
|
@@ -24954,7 +25318,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
|
24954
25318
|
}, "linkMessage");
|
|
24955
25319
|
const followUp = /* @__PURE__ */ __name(async (row2, candidates, by) => write(database, () => {
|
|
24956
25320
|
for (const one of candidates) {
|
|
24957
|
-
if (one.status
|
|
25321
|
+
if (!isClosedState(one.status) || one.band === "different")
|
|
24958
25322
|
continue;
|
|
24959
25323
|
const closed = required3(one.key);
|
|
24960
25324
|
if (mergedInto(closed))
|
|
@@ -24974,7 +25338,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
|
24974
25338
|
const alike = (await similarity.similar({ task: String(row2.key) }, { limit: 40 })).filter((one) => one.band !== "different");
|
|
24975
25339
|
if (!linked)
|
|
24976
25340
|
await followUp(row2, alike, { bot: "rule" });
|
|
24977
|
-
const found2 = linked ? alike : alike.filter((one) => one.status
|
|
25341
|
+
const found2 = linked ? alike : alike.filter((one) => !isClosedState(one.status));
|
|
24978
25342
|
if (found2.length === 0)
|
|
24979
25343
|
return 0;
|
|
24980
25344
|
return write(database, () => {
|
|
@@ -25023,7 +25387,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
|
25023
25387
|
const a = required3(dup);
|
|
25024
25388
|
const b = required3(into);
|
|
25025
25389
|
sameInbox(a, b);
|
|
25026
|
-
if (a.status
|
|
25390
|
+
if (isClosedState(String(a.status)))
|
|
25027
25391
|
throw new CliError("validation_error", `task ${String(a.key)} is already ${String(a.status)}; a merge closes an open task \u2014 reopen it with tasks unmerge if a merge closed it`, { reason: "task.closed" });
|
|
25028
25392
|
const onward = mergedInto(b);
|
|
25029
25393
|
if (onward)
|
|
@@ -25085,7 +25449,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
|
25085
25449
|
};
|
|
25086
25450
|
}, "taskPairsOver");
|
|
25087
25451
|
|
|
25088
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25452
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
|
|
25089
25453
|
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";
|
|
25090
25454
|
var taskStoreOver = /* @__PURE__ */ __name((context) => {
|
|
25091
25455
|
const { database, now: now2 } = context;
|
|
@@ -25213,8 +25577,8 @@ var taskStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25213
25577
|
write(database, () => {
|
|
25214
25578
|
const before2 = database.prepare("SELECT status, due_at FROM tasks WHERE id = ?").get(row2);
|
|
25215
25579
|
const at = now2();
|
|
25216
|
-
database.prepare("UPDATE tasks SET status = ?, close_reason = ?, close_reason_folded = ?, due_at = ?, closed_at = ?, closed_by_type = ?, closed_by_id = ?, updated_at = ?, claimed_by = CASE WHEN ?
|
|
25217
|
-
if (task.state
|
|
25580
|
+
database.prepare("UPDATE tasks SET status = ?, close_reason = ?, close_reason_folded = ?, due_at = ?, closed_at = ?, closed_by_type = ?, closed_by_id = ?, updated_at = ?, claimed_by = CASE WHEN ? NOT IN ('done', 'dismissed') THEN claimed_by END, claimed_until = CASE WHEN ? NOT IN ('done', 'dismissed') THEN claimed_until END, close_certainty = CASE WHEN ? NOT IN ('done', 'dismissed') THEN NULL ELSE close_certainty END WHERE id = ?").run(task.state, task.reason ?? null, folded3(task.reason), time(task.dueAt), time(task.closedAt), closedBy?.type ?? null, closedBy?.id ?? null, at, task.state, task.state, task.state, row2);
|
|
25581
|
+
if (isClosedState(task.state))
|
|
25218
25582
|
database.prepare(`UPDATE tasks SET ${CLEAR_SUGGESTION} WHERE id = ?`).run(row2);
|
|
25219
25583
|
if (before2.status !== task.state)
|
|
25220
25584
|
recordTaskEvent(database, row2, closedBy ?? null, "status", { status: [before2.status, task.state] }, at);
|
|
@@ -25230,7 +25594,10 @@ var taskStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25230
25594
|
const row2 = required3(id2);
|
|
25231
25595
|
const at = now2();
|
|
25232
25596
|
write(database, () => {
|
|
25597
|
+
const before2 = database.prepare("SELECT resolution FROM tasks WHERE id = ?").get(row2)?.resolution ?? null;
|
|
25233
25598
|
database.prepare("UPDATE tasks SET resolution = ?, updated_at = ? WHERE id = ?").run(text5, at, row2);
|
|
25599
|
+
if (before2 !== text5)
|
|
25600
|
+
recordTaskEvent(database, row2, null, "resolution", { resolution: [before2, text5] }, at);
|
|
25234
25601
|
if (!by)
|
|
25235
25602
|
return;
|
|
25236
25603
|
database.prepare(`DELETE FROM links WHERE from_type = 'task' AND from_id = ? AND kind = ${linkKind("answered-by")}`).run(row2);
|
|
@@ -25241,7 +25608,14 @@ var taskStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25241
25608
|
judge: /* @__PURE__ */ __name(async (id2, verdict) => {
|
|
25242
25609
|
if (verdict !== null && !TASK_VERDICTS.includes(verdict))
|
|
25243
25610
|
throw new CliError("validation_error", `a verdict is one of ${TASK_VERDICTS.join(", ")}`);
|
|
25244
|
-
|
|
25611
|
+
const row2 = required3(id2);
|
|
25612
|
+
write(database, () => {
|
|
25613
|
+
const at = now2();
|
|
25614
|
+
const before2 = database.prepare("SELECT verdict FROM tasks WHERE id = ?").get(row2)?.verdict ?? null;
|
|
25615
|
+
database.prepare("UPDATE tasks SET verdict = ?, updated_at = ? WHERE id = ?").run(verdict, at, row2);
|
|
25616
|
+
if (before2 !== verdict)
|
|
25617
|
+
recordTaskEvent(database, row2, null, "verdict", { verdict: [before2, verdict] }, at);
|
|
25618
|
+
});
|
|
25245
25619
|
}, "judge")
|
|
25246
25620
|
};
|
|
25247
25621
|
}, "taskStoreOver");
|
|
@@ -25280,7 +25654,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
|
|
|
25280
25654
|
throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
|
|
25281
25655
|
}, "oneOf");
|
|
25282
25656
|
|
|
25283
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25657
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/accounts.js
|
|
25284
25658
|
var accountAccountsOver = /* @__PURE__ */ __name((context) => {
|
|
25285
25659
|
const { database } = context;
|
|
25286
25660
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
|
|
@@ -25325,7 +25699,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
|
|
|
25325
25699
|
};
|
|
25326
25700
|
}, "accountsStoreOver");
|
|
25327
25701
|
|
|
25328
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25702
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
|
|
25329
25703
|
var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
|
|
25330
25704
|
var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
|
|
25331
25705
|
const message2 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
|
|
@@ -25349,7 +25723,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
|
|
|
25349
25723
|
})), "keepDownloads");
|
|
25350
25724
|
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");
|
|
25351
25725
|
|
|
25352
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25726
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/attachments.js
|
|
25353
25727
|
var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
|
|
25354
25728
|
const { database } = context;
|
|
25355
25729
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -25406,7 +25780,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
25406
25780
|
}, "keepAttachmentText")
|
|
25407
25781
|
}), "attachmentsStoreOver");
|
|
25408
25782
|
|
|
25409
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25783
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
|
|
25410
25784
|
var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
|
|
25411
25785
|
var pointerMover = /* @__PURE__ */ __name((context, type) => {
|
|
25412
25786
|
const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
|
|
@@ -25553,14 +25927,14 @@ var moveChat = /* @__PURE__ */ __name((context, key2, accountKey, old, twin, fro
|
|
|
25553
25927
|
throw new CliError("validation_error", `a ${String(old.kind)} and a ${String(twin.kind)} are not one chat`);
|
|
25554
25928
|
const strict = stricterPrivacy(context, accountKey, privacyOf(old), privacyOf(twin));
|
|
25555
25929
|
moved = absorb(context, kept, Number(twin.id));
|
|
25556
|
-
const fields4 = MESSENGER_FIELDS.map((
|
|
25930
|
+
const fields4 = MESSENGER_FIELDS.map((field4) => `${field4} = coalesce(?, ${field4})`).join(", ");
|
|
25557
25931
|
context.database.prepare(
|
|
25558
25932
|
// Left only when both were: a complete chat list that named the new id before the re-key marked the old one.
|
|
25559
25933
|
`UPDATE chats SET ${fields4}, kind = CASE WHEN kind = 'unknown' THEN ? ELSE kind END,
|
|
25560
25934
|
membership_state = CASE WHEN ? IS NULL THEN nullif(membership_state, 'left') ELSE coalesce(nullif(?, 'left'), membership_state) END,
|
|
25561
25935
|
muted_until = CASE WHEN ? IS NULL THEN muted_until ELSE ? END,
|
|
25562
25936
|
searchable = ?, scope = ?, last_message_at = ?, updated_at = ? WHERE id = ?`
|
|
25563
|
-
).run(...MESSENGER_FIELDS.map((
|
|
25937
|
+
).run(...MESSENGER_FIELDS.map((field4) => scalar(twin[field4])), scalar(twin.kind), scalar(twin.membership_state), scalar(twin.membership_state), scalar(twin.muted), scalar(twin.muted_until), strict.searchable, strict.scope, latest(old.last_message_at, twin.last_message_at), context.now(), kept);
|
|
25564
25938
|
}
|
|
25565
25939
|
context.database.prepare("UPDATE chats SET external_id = ?, updated_at = ? WHERE id = ?").run(to, context.now(), kept);
|
|
25566
25940
|
renameText(context, key2, accountKey, from2, to);
|
|
@@ -25586,7 +25960,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
|
|
|
25586
25960
|
return done;
|
|
25587
25961
|
}, "rekeyChats");
|
|
25588
25962
|
|
|
25589
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25963
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
|
|
25590
25964
|
var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
|
|
25591
25965
|
var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
|
|
25592
25966
|
var CHAT_LIST_KEY = "chat_list_complete";
|
|
@@ -25618,7 +25992,7 @@ var chatCompleteness = /* @__PURE__ */ __name(({ database }, accountKey, chatIds
|
|
|
25618
25992
|
});
|
|
25619
25993
|
}, "chatCompleteness");
|
|
25620
25994
|
|
|
25621
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25995
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/chats.js
|
|
25622
25996
|
var chatsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
25623
25997
|
const { database } = context;
|
|
25624
25998
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
|
|
@@ -25725,7 +26099,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25725
26099
|
};
|
|
25726
26100
|
}, "chatsStoreOver");
|
|
25727
26101
|
|
|
25728
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26102
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
|
|
25729
26103
|
import { createHash as createHash6 } from "node:crypto";
|
|
25730
26104
|
var BATCH_CONTEXT = 50;
|
|
25731
26105
|
var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
|
|
@@ -25863,7 +26237,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
|
|
|
25863
26237
|
var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
|
|
25864
26238
|
${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
|
|
25865
26239
|
|
|
25866
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26240
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
|
|
25867
26241
|
import { setTimeout } from "node:timers/promises";
|
|
25868
26242
|
var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
|
|
25869
26243
|
var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
|
|
@@ -26175,7 +26549,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
|
|
|
26175
26549
|
AND NOT EXISTS (SELECT 1 FROM messages d
|
|
26176
26550
|
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");
|
|
26177
26551
|
|
|
26178
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26552
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/conversations.js
|
|
26179
26553
|
var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
26180
26554
|
const { database } = context;
|
|
26181
26555
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -26282,7 +26656,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
26282
26656
|
};
|
|
26283
26657
|
}, "conversationsStoreOver");
|
|
26284
26658
|
|
|
26285
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26659
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/counters.js
|
|
26286
26660
|
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";
|
|
26287
26661
|
var accountCountersOver = /* @__PURE__ */ __name((context) => {
|
|
26288
26662
|
const { database } = context;
|
|
@@ -26307,7 +26681,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
26307
26681
|
counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
|
|
26308
26682
|
}), "countersStoreOver");
|
|
26309
26683
|
|
|
26310
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26684
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
|
|
26311
26685
|
var MENTION_STATUSES = ["found", "linked", "dismissed"];
|
|
26312
26686
|
var MENTION_QUERY = defineQuery({
|
|
26313
26687
|
entity: "mention",
|
|
@@ -26523,7 +26897,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
|
|
|
26523
26897
|
return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
|
|
26524
26898
|
}, "listPlaces");
|
|
26525
26899
|
|
|
26526
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26900
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/mentions.js
|
|
26527
26901
|
var accountMentionsOver = /* @__PURE__ */ __name((context) => {
|
|
26528
26902
|
const { database } = context;
|
|
26529
26903
|
const { findAccountPk: findAccountPk2 } = keysOver(context);
|
|
@@ -26558,7 +26932,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
26558
26932
|
places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
|
|
26559
26933
|
}), "mentionsStoreOver");
|
|
26560
26934
|
|
|
26561
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26935
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
|
|
26562
26936
|
var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
|
|
26563
26937
|
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");
|
|
26564
26938
|
const rows = messageId === void 0 ? read2.all(chatKey) : read2.all(chatKey, messageId);
|
|
@@ -26573,7 +26947,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
|
|
|
26573
26947
|
}));
|
|
26574
26948
|
}, "documentLinkMessages");
|
|
26575
26949
|
|
|
26576
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26950
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
|
|
26577
26951
|
var stemmerFor = stemmerCache();
|
|
26578
26952
|
var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
|
|
26579
26953
|
if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
|
|
@@ -26617,7 +26991,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
|
|
|
26617
26991
|
});
|
|
26618
26992
|
}, "laterSharingRare");
|
|
26619
26993
|
|
|
26620
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26994
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/messages.js
|
|
26621
26995
|
var accountMessagesOver = /* @__PURE__ */ __name((context) => {
|
|
26622
26996
|
const { database } = context;
|
|
26623
26997
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
|
|
@@ -26752,7 +27126,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
26752
27126
|
laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
|
|
26753
27127
|
}), "messagesStoreOver");
|
|
26754
27128
|
|
|
26755
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27129
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
|
|
26756
27130
|
var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
|
|
26757
27131
|
var iso5 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
26758
27132
|
var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: accounts2, limit }) => {
|
|
@@ -26792,7 +27166,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
|
|
|
26792
27166
|
}));
|
|
26793
27167
|
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
|
|
26794
27168
|
FROM task_assignments ta JOIN tasks t ON t.id=ta.task_id JOIN main.projects p ON p.id=t.project_id
|
|
26795
|
-
WHERE ta.assignee_type='person' AND ta.assignee_id=? AND t.deleted_at IS NULL AND t.status
|
|
27169
|
+
WHERE ta.assignee_type='person' AND ta.assignee_id=? AND t.deleted_at IS NULL AND t.status NOT IN ('done','dismissed')
|
|
26796
27170
|
AND p.deleted_at IS NULL AND (p.account_id IS NULL OR p.account_id IN (SELECT a.id FROM accounts a
|
|
26797
27171
|
JOIN json_each(?) k ON a.provider=json_extract(k.value,'$.provider')
|
|
26798
27172
|
AND a.external_id=json_extract(k.value,'$.account')))
|
|
@@ -26809,7 +27183,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
|
|
|
26809
27183
|
});
|
|
26810
27184
|
}, "personPreparation");
|
|
26811
27185
|
|
|
26812
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27186
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
|
|
26813
27187
|
var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
|
|
26814
27188
|
const id2 = Number(uid);
|
|
26815
27189
|
if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
|
|
@@ -26817,7 +27191,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
|
|
|
26817
27191
|
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)));
|
|
26818
27192
|
}, "personSeenInAccounts");
|
|
26819
27193
|
|
|
26820
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27194
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
|
|
26821
27195
|
var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
|
|
26822
27196
|
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);
|
|
26823
27197
|
if (!row2)
|
|
@@ -26883,7 +27257,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
|
|
|
26883
27257
|
return { id: id2, personId, removed: true };
|
|
26884
27258
|
}, "removeNote");
|
|
26885
27259
|
|
|
26886
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27260
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/people.js
|
|
26887
27261
|
var accountPeopleOver = /* @__PURE__ */ __name((context) => {
|
|
26888
27262
|
const { database } = context;
|
|
26889
27263
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
|
|
@@ -26958,13 +27332,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
|
|
|
26958
27332
|
};
|
|
26959
27333
|
}, "peopleStoreOver");
|
|
26960
27334
|
|
|
26961
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27335
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
|
|
26962
27336
|
import { createHash as createHash8 } from "node:crypto";
|
|
26963
27337
|
|
|
26964
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27338
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
|
|
26965
27339
|
import { createHash as createHash7 } from "node:crypto";
|
|
26966
27340
|
|
|
26967
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27341
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
|
|
26968
27342
|
var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
|
|
26969
27343
|
var AUTHOR_MEASURES = [
|
|
26970
27344
|
"messages",
|
|
@@ -27104,7 +27478,7 @@ var withoutUrls = /* @__PURE__ */ __name((text5) => text5.replace(/\S+/gu, (toke
|
|
|
27104
27478
|
var rankingWords = /* @__PURE__ */ __name((text5) => withoutUrls(text5).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
|
|
27105
27479
|
var rankingQuestion = /* @__PURE__ */ __name((text5) => withoutUrls(text5).includes("?"), "rankingQuestion");
|
|
27106
27480
|
|
|
27107
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27481
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
|
|
27108
27482
|
var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
|
|
27109
27483
|
var exhausted2 = /* @__PURE__ */ __name((budget) => {
|
|
27110
27484
|
throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
|
|
@@ -27326,7 +27700,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
|
|
|
27326
27700
|
};
|
|
27327
27701
|
}, "rankReplyGraph");
|
|
27328
27702
|
|
|
27329
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27703
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
|
|
27330
27704
|
var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
|
|
27331
27705
|
var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
|
|
27332
27706
|
var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
|
|
@@ -27500,7 +27874,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
|
|
|
27500
27874
|
return { items, evidence, summary, graph: graph.quality };
|
|
27501
27875
|
}, "calculateAdminStatistics");
|
|
27502
27876
|
|
|
27503
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27877
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
|
|
27504
27878
|
var rankingContextRange = /* @__PURE__ */ __name((root) => {
|
|
27505
27879
|
const dates = [];
|
|
27506
27880
|
const visit = /* @__PURE__ */ __name((node, required3) => {
|
|
@@ -27522,7 +27896,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
|
|
|
27522
27896
|
return dates[0].node.resolution.date;
|
|
27523
27897
|
}, "rankingContextRange");
|
|
27524
27898
|
|
|
27525
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27899
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
|
|
27526
27900
|
var reactionCounts = /* @__PURE__ */ __name((stored3) => {
|
|
27527
27901
|
let counts;
|
|
27528
27902
|
try {
|
|
@@ -27540,9 +27914,9 @@ var reactionCounts = /* @__PURE__ */ __name((stored3) => {
|
|
|
27540
27914
|
var column = /* @__PURE__ */ __name((name) => `"${name.replaceAll('"', '""')}"`, "column");
|
|
27541
27915
|
var finite = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null, "finite");
|
|
27542
27916
|
var metadata2 = /* @__PURE__ */ __name((alias2) => `CASE WHEN json_valid(${alias2}.metadata) THEN ${alias2}.metadata ELSE '{}' END`, "metadata");
|
|
27543
|
-
var rankingCounter = /* @__PURE__ */ __name((alias2,
|
|
27917
|
+
var rankingCounter = /* @__PURE__ */ __name((alias2, field4, reactions = false) => {
|
|
27544
27918
|
const source2 = reactions ? `CASE WHEN json_valid(${alias2}.reactions) THEN ${alias2}.reactions ELSE '{}' END` : metadata2(alias2);
|
|
27545
|
-
const path = reactions ? "$.total" : `$.${
|
|
27919
|
+
const path = reactions ? "$.total" : `$.${field4}`;
|
|
27546
27920
|
const value = `json_extract(${source2},'${path}')`;
|
|
27547
27921
|
return `CASE WHEN json_type(${source2},'${path}') IN ('integer','real') AND ${value}>=0 AND ${value}<=1.7976931348623157e308 THEN CAST(${value} AS REAL) END`;
|
|
27548
27922
|
}, "rankingCounter");
|
|
@@ -27817,7 +28191,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
|
|
|
27817
28191
|
});
|
|
27818
28192
|
}, "rankQuery");
|
|
27819
28193
|
|
|
27820
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28194
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
|
|
27821
28195
|
function fail4(message2, reason = "query.too-large") {
|
|
27822
28196
|
throw new CliError("validation_error", message2, { reason, complete: false });
|
|
27823
28197
|
}
|
|
@@ -27838,12 +28212,12 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
|
|
|
27838
28212
|
} else
|
|
27839
28213
|
scope3 += " AND c.searchable=1";
|
|
27840
28214
|
const where = `m.deleted_at IS NULL AND ${scope3} AND (m.sent_at BETWEEN ? AND ?${options.report === "newcomers" ? "" : " OR m.id IN (SELECT id FROM selected)"})`;
|
|
27841
|
-
const
|
|
27842
|
-
const size2 = database.prepare(`${prefix}SELECT count(*) AS n,sum(length(cast(m.text AS BLOB))+length(cast(coalesce(m.metadata,'') AS BLOB))+length(cast(${snapshot} AS BLOB))) AS bytes ${joined3} WHERE ${where}`).get(...
|
|
28215
|
+
const bound5 = [...selection.params, ...params, lower, options.cutoff];
|
|
28216
|
+
const size2 = database.prepare(`${prefix}SELECT count(*) AS n,sum(length(cast(m.text AS BLOB))+length(cast(coalesce(m.metadata,'') AS BLOB))+length(cast(${snapshot} AS BLOB))) AS bytes ${joined3} WHERE ${where}`).get(...bound5);
|
|
27843
28217
|
check3();
|
|
27844
28218
|
if (Number(size2?.n ?? 0) > RANKING_GRAPH_LIMITS.nodes || Number(size2?.bytes ?? 0) > RANKING_GRAPH_LIMITS.bytes)
|
|
27845
28219
|
fail4("admin statistics context exceeds node/byte budgets \u2014 narrow chat/date scope");
|
|
27846
|
-
const raw = database.prepare(`${prefix}SELECT m.id AS pk,m.external_id AS id,c.id AS chat_id,ac.id AS account_id,c.external_id AS chat,c.title AS title,c.kind,ac.provider,ac.external_id AS account,i.external_id AS sender,m.sender_chat_external_id AS sender_chat,i.bot,m.sent_at,m.text,m.metadata,${rankingCounter("m", "views")} AS views,${rankingCounter("m", "comments")} AS comments,m.id IN (SELECT id FROM selected) AS selected ${joined3} WHERE ${where} ORDER BY m.id`).all(...
|
|
28220
|
+
const raw = database.prepare(`${prefix}SELECT m.id AS pk,m.external_id AS id,c.id AS chat_id,ac.id AS account_id,c.external_id AS chat,c.title AS title,c.kind,ac.provider,ac.external_id AS account,i.external_id AS sender,m.sender_chat_external_id AS sender_chat,i.bot,m.sent_at,m.text,m.metadata,${rankingCounter("m", "views")} AS views,${rankingCounter("m", "comments")} AS comments,m.id IN (SELECT id FROM selected) AS selected ${joined3} WHERE ${where} ORDER BY m.id`).all(...bound5);
|
|
27847
28221
|
const nodes = raw.map((row2) => {
|
|
27848
28222
|
let metadata3 = {};
|
|
27849
28223
|
try {
|
|
@@ -27994,7 +28368,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
|
|
|
27994
28368
|
return result;
|
|
27995
28369
|
}), "adminStatisticsQuery");
|
|
27996
28370
|
|
|
27997
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28371
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
|
|
27998
28372
|
var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
|
|
27999
28373
|
if (!execution.accounts.length)
|
|
28000
28374
|
return { conversations: [], chats: [] };
|
|
@@ -28012,7 +28386,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
|
|
|
28012
28386
|
return { conversations: conversations2, chats: chats2 };
|
|
28013
28387
|
}, "conversationEligibility");
|
|
28014
28388
|
|
|
28015
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28389
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
|
|
28016
28390
|
import { createHash as createHash9 } from "node:crypto";
|
|
28017
28391
|
var EVIDENCE_BYTES = 64 * 1024;
|
|
28018
28392
|
var FINGERPRINT_BYTES = 8 * 1024 * 1024;
|
|
@@ -28162,7 +28536,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
|
|
|
28162
28536
|
return result;
|
|
28163
28537
|
}, "rankingEvidence");
|
|
28164
28538
|
|
|
28165
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28539
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/queries.js
|
|
28166
28540
|
var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
|
|
28167
28541
|
const mailIndexed = /* @__PURE__ */ __name((execution) => {
|
|
28168
28542
|
if (execution.corpus === "mail")
|
|
@@ -28181,7 +28555,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
|
|
|
28181
28555
|
};
|
|
28182
28556
|
}, "queriesStoreOver");
|
|
28183
28557
|
|
|
28184
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28558
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
|
|
28185
28559
|
var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
|
|
28186
28560
|
const { database, now: now2 } = context;
|
|
28187
28561
|
const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
|
|
@@ -28220,10 +28594,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
|
|
|
28220
28594
|
}));
|
|
28221
28595
|
}, "chatEventsOf");
|
|
28222
28596
|
|
|
28223
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28597
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
|
|
28224
28598
|
import { createHash as createHash10 } from "node:crypto";
|
|
28225
28599
|
|
|
28226
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28600
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/calendar.js
|
|
28227
28601
|
var calendarKey = /* @__PURE__ */ __name((zone, by) => {
|
|
28228
28602
|
const format = new Intl.DateTimeFormat("en-CA", {
|
|
28229
28603
|
timeZone: zone,
|
|
@@ -28238,7 +28612,7 @@ var calendarKey = /* @__PURE__ */ __name((zone, by) => {
|
|
|
28238
28612
|
};
|
|
28239
28613
|
}, "calendarKey");
|
|
28240
28614
|
|
|
28241
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28615
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/retention.js
|
|
28242
28616
|
var RETENTION_TOLERANCE = 864e5;
|
|
28243
28617
|
var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
|
|
28244
28618
|
const { since, until, cutoff, checkpoints, within, limit, by } = options;
|
|
@@ -28292,7 +28666,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
|
|
|
28292
28666
|
return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
|
|
28293
28667
|
}, "retentionCohorts");
|
|
28294
28668
|
|
|
28295
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28669
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
|
|
28296
28670
|
var iso6 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
|
|
28297
28671
|
var week = /* @__PURE__ */ __name((day) => {
|
|
28298
28672
|
const date3 = /* @__PURE__ */ new Date(`${day}T00:00:00Z`);
|
|
@@ -28428,7 +28802,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
|
|
|
28428
28802
|
};
|
|
28429
28803
|
}, "retentionQuery");
|
|
28430
28804
|
|
|
28431
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28805
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
|
|
28432
28806
|
var iso7 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
|
|
28433
28807
|
var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
|
|
28434
28808
|
...isBot === void 0 ? {} : { bot: isBot },
|
|
@@ -28559,7 +28933,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
|
|
|
28559
28933
|
lastCount: memberCountsOf(context, pk).at(-1) ?? null
|
|
28560
28934
|
})), "trackedChats");
|
|
28561
28935
|
|
|
28562
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28936
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/roster.js
|
|
28563
28937
|
var rosterStoreOver = /* @__PURE__ */ __name((context) => {
|
|
28564
28938
|
const { database } = context;
|
|
28565
28939
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
|
|
@@ -28615,7 +28989,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28615
28989
|
};
|
|
28616
28990
|
}, "rosterStoreOver");
|
|
28617
28991
|
|
|
28618
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28992
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
|
|
28619
28993
|
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");
|
|
28620
28994
|
var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
|
|
28621
28995
|
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 ?`);
|
|
@@ -28639,7 +29013,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
|
|
|
28639
29013
|
}
|
|
28640
29014
|
}, "backfillNormalized");
|
|
28641
29015
|
|
|
28642
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29016
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
|
|
28643
29017
|
var INDEX2 = "message_words";
|
|
28644
29018
|
var searchIndexState2 = /* @__PURE__ */ __name((database) => {
|
|
28645
29019
|
const row2 = indexRow(database, INDEX2);
|
|
@@ -28766,7 +29140,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
|
|
|
28766
29140
|
});
|
|
28767
29141
|
}, "resetSearchIndex");
|
|
28768
29142
|
|
|
28769
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29143
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
|
|
28770
29144
|
var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
|
|
28771
29145
|
const filled2 = { stemmed: 0, drained: 0 };
|
|
28772
29146
|
const before2 = stemsState(database);
|
|
@@ -28861,7 +29235,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
|
|
|
28861
29235
|
return resetStems(database, { now: now2 });
|
|
28862
29236
|
}, "followDefaultStemmers");
|
|
28863
29237
|
|
|
28864
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29238
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
|
|
28865
29239
|
var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
|
|
28866
29240
|
var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
|
|
28867
29241
|
const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
|
|
@@ -28883,7 +29257,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
|
|
|
28883
29257
|
});
|
|
28884
29258
|
}, "termCandidates");
|
|
28885
29259
|
|
|
28886
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29260
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/search-index.js
|
|
28887
29261
|
var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
|
|
28888
29262
|
const { database } = context;
|
|
28889
29263
|
const stemmerFor2 = stemmerCache();
|
|
@@ -28905,7 +29279,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28905
29279
|
};
|
|
28906
29280
|
}, "searchIndexStoreOver");
|
|
28907
29281
|
|
|
28908
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29282
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
|
|
28909
29283
|
var HISTORY_KEPT = 1e3;
|
|
28910
29284
|
var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
|
|
28911
29285
|
var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
|
|
@@ -28974,7 +29348,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
|
|
|
28974
29348
|
return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
|
|
28975
29349
|
}, "clearHistory");
|
|
28976
29350
|
|
|
28977
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29351
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/searches.js
|
|
28978
29352
|
var searchesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
28979
29353
|
const { database } = context;
|
|
28980
29354
|
return {
|
|
@@ -28998,7 +29372,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28998
29372
|
};
|
|
28999
29373
|
}, "searchesStoreOver");
|
|
29000
29374
|
|
|
29001
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29375
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
|
|
29002
29376
|
var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
|
|
29003
29377
|
var ACTION_OUTCOMES = ["ok", "refused", "failed"];
|
|
29004
29378
|
var CODE = /^[a-z][a-z0-9_]{0,63}$/;
|
|
@@ -29041,7 +29415,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
|
|
|
29041
29415
|
};
|
|
29042
29416
|
}, "agentActionsStoreOver");
|
|
29043
29417
|
|
|
29044
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29418
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
|
|
29045
29419
|
var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
|
|
29046
29420
|
}) => {
|
|
29047
29421
|
const { database, now: now2 } = context;
|
|
@@ -29100,7 +29474,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
|
|
|
29100
29474
|
};
|
|
29101
29475
|
}, "botUpdateStoreOver");
|
|
29102
29476
|
|
|
29103
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29477
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
|
|
29104
29478
|
var DAY4 = 864e5;
|
|
29105
29479
|
var listEvents = /* @__PURE__ */ __name((database, filter) => {
|
|
29106
29480
|
const clauses = ["e.deleted_at IS NULL"];
|
|
@@ -29185,7 +29559,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
|
|
|
29185
29559
|
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);
|
|
29186
29560
|
}, "listEvents");
|
|
29187
29561
|
|
|
29188
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29562
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
|
|
29189
29563
|
var calendarOf = /* @__PURE__ */ __name((row2) => ({
|
|
29190
29564
|
id: Number(row2.id),
|
|
29191
29565
|
accountId: Number(row2.account_id),
|
|
@@ -29765,7 +30139,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
29765
30139
|
};
|
|
29766
30140
|
}, "eventStoreOver");
|
|
29767
30141
|
|
|
29768
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30142
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
|
|
29769
30143
|
var CATALOG_QUERY = defineQuery({
|
|
29770
30144
|
entity: "document",
|
|
29771
30145
|
backend: "sql",
|
|
@@ -29803,7 +30177,7 @@ var objectOf2 = /* @__PURE__ */ __name((value) => {
|
|
|
29803
30177
|
throw new CliError("invalid_response", "stored catalog metadata must be an object");
|
|
29804
30178
|
return parsed2;
|
|
29805
30179
|
}, "objectOf");
|
|
29806
|
-
var
|
|
30180
|
+
var field2 = /* @__PURE__ */ __name((value, max = 4e3) => {
|
|
29807
30181
|
if (typeof value !== "string" || !value || value.length > max)
|
|
29808
30182
|
throw new CliError("validation_error", "catalog field is empty or too long");
|
|
29809
30183
|
return value;
|
|
@@ -29838,7 +30212,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
29838
30212
|
throw new CliError("not_found", "catalog account is not in the local store");
|
|
29839
30213
|
return Number(id2);
|
|
29840
30214
|
}, "account");
|
|
29841
|
-
const
|
|
30215
|
+
const bound5 = /* @__PURE__ */ __name((id2, includeInactive = false) => {
|
|
29842
30216
|
const scope3 = "account_id = ? AND json_type(metadata, '$.catalog') = 'object'" + (includeInactive ? "" : " AND json_extract(metadata, '$.catalog.active') = 1 AND deleted_at IS NULL");
|
|
29843
30217
|
const budget = database.prepare(`SELECT count(*) AS entries, sum(length(metadata)) AS bytes FROM documents WHERE ${scope3}`).get(id2);
|
|
29844
30218
|
if (Number(budget?.bytes ?? 0) > 32 * 1024 * 1024)
|
|
@@ -29853,14 +30227,14 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
29853
30227
|
throw new CliError("validation_error", "catalog writes take at most 200 entries");
|
|
29854
30228
|
const seen = /* @__PURE__ */ new Set();
|
|
29855
30229
|
const checked = inputs.map((input) => {
|
|
29856
|
-
|
|
30230
|
+
field2(input.externalId);
|
|
29857
30231
|
if (seen.has(input.externalId))
|
|
29858
30232
|
throw new CliError("validation_error", "catalog batch repeats an external id");
|
|
29859
30233
|
seen.add(input.externalId);
|
|
29860
30234
|
if (!["file", "folder"].includes(input.kind) || typeof input.name !== "string" || input.name.length > 4e3 || !Array.isArray(input.parents) || input.parents.length > 100)
|
|
29861
30235
|
throw new CliError("validation_error", "invalid catalog name, kind or parents");
|
|
29862
30236
|
for (const parent2 of input.parents)
|
|
29863
|
-
|
|
30237
|
+
field2(parent2);
|
|
29864
30238
|
if (input.actors !== void 0) {
|
|
29865
30239
|
if (!Array.isArray(input.actors) || input.actors.length > 100)
|
|
29866
30240
|
throw new CliError("validation_error", "invalid catalog actors");
|
|
@@ -29869,7 +30243,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
29869
30243
|
throw new CliError("validation_error", "invalid catalog actor");
|
|
29870
30244
|
for (const value of [actor.id, actor.name, actor.email, actor.role])
|
|
29871
30245
|
if (value !== void 0)
|
|
29872
|
-
|
|
30246
|
+
field2(value);
|
|
29873
30247
|
}
|
|
29874
30248
|
}
|
|
29875
30249
|
if (input.size !== void 0 && (!Number.isSafeInteger(input.size) || input.size < 0))
|
|
@@ -29921,7 +30295,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
29921
30295
|
const id2 = account(accountId);
|
|
29922
30296
|
if (externalIds.length > 1e4)
|
|
29923
30297
|
throw new CliError("validation_error", "catalog scope exceeds 10000 entries");
|
|
29924
|
-
const current = [...new Set(externalIds.map((key2) =>
|
|
30298
|
+
const current = [...new Set(externalIds.map((key2) => field2(key2)))];
|
|
29925
30299
|
return write(database, () => {
|
|
29926
30300
|
const retired = database.prepare("UPDATE documents SET metadata=json_set(metadata, '$.catalog.active', json('false')) WHERE account_id=? AND json_type(metadata, '$.catalog')='object' AND json_extract(metadata, '$.catalog.active')=1" + (current.length ? " AND external_id NOT IN (SELECT value FROM json_each(?))" : "") + " RETURNING id").all(...current.length ? [id2, JSON.stringify(current)] : [id2]);
|
|
29927
30301
|
const at = now2();
|
|
@@ -30000,14 +30374,14 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
30000
30374
|
if (compiled.sql)
|
|
30001
30375
|
add(compiled.sql, ...compiled.params);
|
|
30002
30376
|
}
|
|
30003
|
-
|
|
30377
|
+
bound5(id2, query.includeInactive);
|
|
30004
30378
|
const found2 = database.prepare(`SELECT d.id, d.external_id, d.title, d.front_matter, d.metadata, d.deleted_at, d.body IS NOT NULL AS has_body FROM documents d WHERE ${clauses.join(" AND ")} ORDER BY d.external_id LIMIT ? OFFSET ?`).all(...params, limit + 1, offset);
|
|
30005
30379
|
return { items: found2.slice(0, limit).map(entryOf2), hasMore: found2.length > limit };
|
|
30006
30380
|
}, "list")
|
|
30007
30381
|
};
|
|
30008
30382
|
}, "catalogStoreOver");
|
|
30009
30383
|
|
|
30010
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30384
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/context/evidence.js
|
|
30011
30385
|
import { createHash as createHash11 } from "node:crypto";
|
|
30012
30386
|
var CONTEXT_MAX_READ_BYTES = 262144;
|
|
30013
30387
|
var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
|
|
@@ -30105,20 +30479,20 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
|
|
|
30105
30479
|
return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
|
|
30106
30480
|
}, "contextEvidenceRequest");
|
|
30107
30481
|
|
|
30108
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30482
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
|
|
30109
30483
|
var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
|
|
30110
|
-
var
|
|
30484
|
+
var field3 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
|
|
30111
30485
|
CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
|
|
30112
30486
|
var preferred = /* @__PURE__ */ __name((column2) => `(SELECT f.${column2} FROM files f JOIN documents d ON d.id = f.document_id WHERE f.document_id = n.id
|
|
30113
30487
|
ORDER BY ${PREFERRED_FILE} LIMIT 1)`, "preferred");
|
|
30114
|
-
var modified = `round(unixepoch(${
|
|
30488
|
+
var modified = `round(unixepoch(${field3("modifiedAt")},'subsec')*1000)`;
|
|
30115
30489
|
var remoteTime = `coalesce(${preferred("external_updated_at")},n.external_updated_at,${modified})`;
|
|
30116
30490
|
var contextDocumentTime = `coalesce(${remoteTime},n.updated_at)`;
|
|
30117
30491
|
var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
|
|
30118
30492
|
THEN 'source-modified' ELSE 'stored-update' END`;
|
|
30119
|
-
var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${
|
|
30493
|
+
var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field3("sourceUrl")})`;
|
|
30120
30494
|
|
|
30121
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30495
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
|
|
30122
30496
|
var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
|
|
30123
30497
|
const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
|
|
30124
30498
|
signal?.throwIfAborted();
|
|
@@ -30217,7 +30591,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
|
|
|
30217
30591
|
});
|
|
30218
30592
|
}, "readMeetingContextEvidence");
|
|
30219
30593
|
|
|
30220
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30594
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
|
|
30221
30595
|
var corpora = {
|
|
30222
30596
|
message: {
|
|
30223
30597
|
table: "messages",
|
|
@@ -30446,7 +30820,7 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
30446
30820
|
}
|
|
30447
30821
|
}), "contextRecordsOver");
|
|
30448
30822
|
|
|
30449
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30823
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
|
|
30450
30824
|
var NOTE_FIELDS = [
|
|
30451
30825
|
"text",
|
|
30452
30826
|
"exact",
|
|
@@ -30463,7 +30837,7 @@ var NOTE_FIELDS = [
|
|
|
30463
30837
|
"source"
|
|
30464
30838
|
];
|
|
30465
30839
|
var quoted2 = /* @__PURE__ */ __name((value) => `"${value.replaceAll('"', '""')}"`, "quoted");
|
|
30466
|
-
var
|
|
30840
|
+
var bound4 = /* @__PURE__ */ __name((sql2, ...params) => ({ sql: sql2, params, exact: true }), "bound");
|
|
30467
30841
|
var combine2 = /* @__PURE__ */ __name((parts2, operator) => ({
|
|
30468
30842
|
sql: parts2.length ? `(${parts2.map(({ sql: sql2 }) => sql2).join(` ${operator} `)})` : operator === "AND" ? "1" : "0",
|
|
30469
30843
|
params: parts2.flatMap(({ params }) => params),
|
|
@@ -30478,8 +30852,8 @@ var CORPORA2 = [
|
|
|
30478
30852
|
words: "document_words",
|
|
30479
30853
|
stems: "document_stems",
|
|
30480
30854
|
live: "coalesce(json_extract(n.metadata, '$.catalog.active'), 1)=1",
|
|
30481
|
-
inAccounts: /* @__PURE__ */ __name((ids) =>
|
|
30482
|
-
tagged: /* @__PURE__ */ __name((tag2) =>
|
|
30855
|
+
inAccounts: /* @__PURE__ */ __name((ids) => bound4("n.folder_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))", ids), "inAccounts"),
|
|
30856
|
+
tagged: /* @__PURE__ */ __name((tag2) => bound4(`(n.id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'document') OR n.folder_id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'account') OR EXISTS (SELECT 1 FROM links l JOIN resolved_tags t ON t.id=l.to_id WHERE l.from_type = 'account' AND l.from_id = n.folder_id AND l.kind = ${linkKind("labelled")} AND l.to_type = 'tag' AND t.name = ? AND substr(n.path, 1, length(l.anchor) + 1) = l.anchor || '/'))`, tag2, tag2, tag2), "tagged")
|
|
30483
30857
|
},
|
|
30484
30858
|
{
|
|
30485
30859
|
type: "note",
|
|
@@ -30488,7 +30862,7 @@ var CORPORA2 = [
|
|
|
30488
30862
|
view: "(SELECT id, NULL AS folder_id, NULL AS path, title, body AS text, NULL AS metadata, updated_at AS at, deleted_at FROM notes)",
|
|
30489
30863
|
words: "note_words",
|
|
30490
30864
|
stems: "note_stems",
|
|
30491
|
-
tagged: /* @__PURE__ */ __name((tag2) =>
|
|
30865
|
+
tagged: /* @__PURE__ */ __name((tag2) => bound4("n.id IN (SELECT g.taggable_id FROM taggings g JOIN resolved_tags t ON t.id=g.tag_id WHERE t.name = ? AND g.taggable_type = 'note')", tag2), "tagged")
|
|
30492
30866
|
}
|
|
30493
30867
|
];
|
|
30494
30868
|
var matchedRows = /* @__PURE__ */ __name((context, query) => {
|
|
@@ -30553,17 +30927,17 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
|
|
|
30553
30927
|
let titles;
|
|
30554
30928
|
const foldedTitles = /* @__PURE__ */ __name(() => titles ??= database.prepare(`SELECT id, title FROM ${corpus.view} n WHERE n.title IS NOT NULL AND n.deleted_at IS NULL`).all().map((row2) => ({ id: Number(row2.id), title: normalize(String(row2.title)) })), "foldedTitles");
|
|
30555
30929
|
const leaf2 = /* @__PURE__ */ __name((node) => {
|
|
30556
|
-
const { field:
|
|
30557
|
-
if (!corpus.fields.includes(
|
|
30558
|
-
searchError("query.unsupported-field", node.span, `${
|
|
30559
|
-
if ((
|
|
30560
|
-
return
|
|
30930
|
+
const { field: field4, operator, value } = node;
|
|
30931
|
+
if (!corpus.fields.includes(field4))
|
|
30932
|
+
searchError("query.unsupported-field", node.span, `${field4}: is not ${corpus.noun === "event" ? "an" : "a"} ${corpus.noun} field \u2014 ${corpus.noun}s take ${corpus.fields.join(", ")}`);
|
|
30933
|
+
if ((field4 === "text" || field4 === "exact") && value === "")
|
|
30934
|
+
return bound4("0");
|
|
30561
30935
|
if (isStemmed(node)) {
|
|
30562
30936
|
if (!query.stemmer)
|
|
30563
30937
|
throw new Error("a stemmed leaf reached the notes search without the store's stemmer");
|
|
30564
30938
|
const text5 = normalize(value);
|
|
30565
30939
|
if (!/[\p{L}\p{N}]/u.test(text5))
|
|
30566
|
-
return
|
|
30940
|
+
return bound4("0");
|
|
30567
30941
|
const stems = query.stemmer.phrases(value);
|
|
30568
30942
|
return {
|
|
30569
30943
|
sql: `n.id IN (SELECT rowid FROM ${corpus.words} WHERE ${corpus.words} MATCH ?)${stems ? ` OR n.id IN (SELECT rowid FROM ${corpus.stems} WHERE ${corpus.stems} MATCH ?)` : ""}`,
|
|
@@ -30573,11 +30947,11 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
|
|
|
30573
30947
|
...stems ? { stems } : {}
|
|
30574
30948
|
};
|
|
30575
30949
|
}
|
|
30576
|
-
if (
|
|
30950
|
+
if (field4 === "text" || field4 === "exact") {
|
|
30577
30951
|
if (operator === "term" || operator === "phrase") {
|
|
30578
30952
|
const text5 = normalize(value);
|
|
30579
30953
|
const stems = query.stemmer?.phrases(value);
|
|
30580
|
-
return /[\p{L}\p{N}]/u.test(text5) ? { ...wordMatch2(quoted2(text5)), ...stems ? { stems } : {} } :
|
|
30954
|
+
return /[\p{L}\p{N}]/u.test(text5) ? { ...wordMatch2(quoted2(text5)), ...stems ? { stems } : {} } : bound4("0");
|
|
30581
30955
|
}
|
|
30582
30956
|
const pattern = operator === "wildcard" ? wildcardPattern(normalize(value)) : foldRegex(value, node.span);
|
|
30583
30957
|
const matcher = automaton(pattern, node);
|
|
@@ -30590,54 +30964,54 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
|
|
|
30590
30964
|
check3();
|
|
30591
30965
|
return matcher.test(String(term), budget) ? [quoted2(String(term))] : [];
|
|
30592
30966
|
});
|
|
30593
|
-
return matches2.length ? wordMatch2(matches2.join(" OR ")) :
|
|
30967
|
+
return matches2.length ? wordMatch2(matches2.join(" OR ")) : bound4("0");
|
|
30594
30968
|
}
|
|
30595
|
-
if (
|
|
30969
|
+
if (field4 === "body") {
|
|
30596
30970
|
if (operator === "term" || operator === "phrase")
|
|
30597
|
-
return
|
|
30971
|
+
return bound4("n.text = ?", value);
|
|
30598
30972
|
const matcher = automaton(operator === "wildcard" ? wildcardPattern(value) : value, node);
|
|
30599
30973
|
tests.set(node, (text5) => matcher.test(text5, budget));
|
|
30600
30974
|
return { sql: "1", params: [], exact: false };
|
|
30601
30975
|
}
|
|
30602
|
-
if (
|
|
30976
|
+
if (field4 === "tag") {
|
|
30603
30977
|
const tag2 = tagOf(value);
|
|
30604
30978
|
if (tag2 === void 0)
|
|
30605
30979
|
searchError("query.invalid-tag", node.span);
|
|
30606
|
-
return corpus.tagged?.(canonicalTagNamed(database, tag2)?.name ?? tag2) ??
|
|
30980
|
+
return corpus.tagged?.(canonicalTagNamed(database, tag2)?.name ?? tag2) ?? bound4("0");
|
|
30607
30981
|
}
|
|
30608
|
-
if (
|
|
30609
|
-
return
|
|
30610
|
-
if (
|
|
30982
|
+
if (field4 === "source")
|
|
30983
|
+
return bound4(value.toLowerCase() === (corpus.type === "note" ? "internal" : "file") ? "1" : "0");
|
|
30984
|
+
if (field4 === "has") {
|
|
30611
30985
|
if (value.toLowerCase() !== "text")
|
|
30612
30986
|
searchError("query.unknown-value", node.span, `has:${value} is a message field \u2014 notes take has:text`);
|
|
30613
|
-
return
|
|
30987
|
+
return bound4("length(trim(coalesce(n.text,''))) > 0");
|
|
30614
30988
|
}
|
|
30615
|
-
if (
|
|
30989
|
+
if (field4 === "title" || field4 === "site" || field4 === "lang" || field4 === "author" || field4 === "keyword") {
|
|
30616
30990
|
const wanted = normalize(value);
|
|
30617
30991
|
if (wanted === "")
|
|
30618
|
-
return
|
|
30992
|
+
return bound4("0");
|
|
30619
30993
|
const folded5 = /* @__PURE__ */ __name((key2) => `coalesce(json_extract(n.metadata, '$.folded.${key2}'), '')`, "folded");
|
|
30620
|
-
if (
|
|
30621
|
-
return
|
|
30622
|
-
if (
|
|
30623
|
-
return
|
|
30624
|
-
if (
|
|
30994
|
+
if (field4 === "keyword")
|
|
30995
|
+
return bound4("EXISTS (SELECT 1 FROM json_each(n.metadata, '$.folded.keywords') WHERE value = ?)", wanted);
|
|
30996
|
+
if (field4 === "lang")
|
|
30997
|
+
return bound4(`(${folded5("language")} = ? OR ${folded5("language")} LIKE ? || '-%')`, wanted, wanted);
|
|
30998
|
+
if (field4 === "title") {
|
|
30625
30999
|
check3();
|
|
30626
31000
|
const ids = foldedTitles().flatMap(({ id: id2, title }) => title.includes(wanted) ? [id2] : []);
|
|
30627
|
-
return
|
|
31001
|
+
return bound4(`(instr(${folded5("title")}, ?) > 0 OR n.id IN (SELECT value FROM json_each(?)))`, wanted, JSON.stringify(ids));
|
|
30628
31002
|
}
|
|
30629
|
-
return
|
|
31003
|
+
return bound4(`instr(${folded5(field4)}, ?) > 0`, wanted);
|
|
30630
31004
|
}
|
|
30631
|
-
if (
|
|
31005
|
+
if (field4 === "date") {
|
|
30632
31006
|
const range = node.resolution?.date;
|
|
30633
31007
|
if (!range)
|
|
30634
31008
|
searchError("query.invalid-ast", node.span);
|
|
30635
31009
|
return combine2([
|
|
30636
|
-
...range.lower === void 0 ? [] : [
|
|
30637
|
-
...range.upper === void 0 ? [] : [
|
|
31010
|
+
...range.lower === void 0 ? [] : [bound4(`n.at ${range.lower_inclusive ? ">=" : ">"} ?`, range.lower)],
|
|
31011
|
+
...range.upper === void 0 ? [] : [bound4(`n.at ${range.upper_inclusive ? "<=" : "<"} ?`, range.upper)]
|
|
30638
31012
|
], "AND");
|
|
30639
31013
|
}
|
|
30640
|
-
return
|
|
31014
|
+
return bound4([corpus.noun, `${corpus.noun}s`].includes(value.toLowerCase()) ? "1" : "0");
|
|
30641
31015
|
}, "leaf");
|
|
30642
31016
|
const compile2 = /* @__PURE__ */ __name((node) => {
|
|
30643
31017
|
if (node.kind === "predicate") {
|
|
@@ -30668,10 +31042,10 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
|
|
|
30668
31042
|
const expression = compile2(query.root);
|
|
30669
31043
|
const stemmed = [...fragments.keys()].some(isStemmed);
|
|
30670
31044
|
const scope3 = combine2([
|
|
30671
|
-
|
|
30672
|
-
...corpus.live ? [
|
|
31045
|
+
bound4("n.deleted_at IS NULL"),
|
|
31046
|
+
...corpus.live ? [bound4(corpus.live)] : [],
|
|
30673
31047
|
...query.accountIds?.length && corpus.inAccounts ? [corpus.inAccounts(JSON.stringify(query.accountIds))] : [],
|
|
30674
|
-
...query.ids ? [
|
|
31048
|
+
...query.ids ? [bound4("n.id IN (SELECT value FROM json_each(?))", JSON.stringify(query.ids))] : []
|
|
30675
31049
|
], "AND");
|
|
30676
31050
|
const where = combine2([scope3, expression], "AND");
|
|
30677
31051
|
const ranking = query.newest ? void 0 : required3(query.root, stemmed ? "stems" : "fts");
|
|
@@ -30876,7 +31250,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
30876
31250
|
};
|
|
30877
31251
|
}, "noteSearchOver");
|
|
30878
31252
|
|
|
30879
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31253
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
|
|
30880
31254
|
var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
|
|
30881
31255
|
var inEventAccounts = /* @__PURE__ */ __name((event) => searchableCopy(event, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
|
|
30882
31256
|
var EVENT_CORPUS = {
|
|
@@ -31008,7 +31382,7 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
31008
31382
|
};
|
|
31009
31383
|
}, "eventSearchOver");
|
|
31010
31384
|
|
|
31011
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31385
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
|
|
31012
31386
|
var EVIDENCE_FINDINGS_KIND = "evidence_findings";
|
|
31013
31387
|
var reference = /* @__PURE__ */ __name((raw) => {
|
|
31014
31388
|
if (/^document:[1-9]\d*$/.test(raw))
|
|
@@ -31021,7 +31395,7 @@ var reference = /* @__PURE__ */ __name((raw) => {
|
|
|
31021
31395
|
}, "reference");
|
|
31022
31396
|
var validateEvidenceFindings = /* @__PURE__ */ __name((input) => validateFindings(input, { plural: "evidence findings", singular: "evidence finding", cited: "reference", reference }), "validateEvidenceFindings");
|
|
31023
31397
|
|
|
31024
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31398
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/domain/moment.js
|
|
31025
31399
|
var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
|
|
31026
31400
|
try {
|
|
31027
31401
|
return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
|
|
@@ -31033,7 +31407,7 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
|
|
|
31033
31407
|
}
|
|
31034
31408
|
}, "calendarMoment");
|
|
31035
31409
|
|
|
31036
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31410
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
|
|
31037
31411
|
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";
|
|
31038
31412
|
var iso8 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
31039
31413
|
var oneOf4 = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
@@ -31182,7 +31556,7 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
31182
31556
|
};
|
|
31183
31557
|
}, "factsStoreOver");
|
|
31184
31558
|
|
|
31185
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31559
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
|
|
31186
31560
|
var invalid4 = /* @__PURE__ */ __name((message2) => {
|
|
31187
31561
|
throw new CliError("validation_error", message2);
|
|
31188
31562
|
}, "invalid");
|
|
@@ -31272,7 +31646,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
|
|
|
31272
31646
|
return { snapshot: snapshot2, snapshotParts, previous, outcomes };
|
|
31273
31647
|
}, "findingsCoreOver");
|
|
31274
31648
|
|
|
31275
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31649
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
|
|
31276
31650
|
var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
|
|
31277
31651
|
var PROPOSAL_VERDICTS = ["useful", "not_useful"];
|
|
31278
31652
|
var iso9 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
@@ -31418,7 +31792,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
31418
31792
|
};
|
|
31419
31793
|
}, "proposedActionsStoreOver");
|
|
31420
31794
|
|
|
31421
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31795
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
|
|
31422
31796
|
var stale = /* @__PURE__ */ __name(() => {
|
|
31423
31797
|
throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
|
|
31424
31798
|
reason: "evidence-findings.stale"
|
|
@@ -31584,7 +31958,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
31584
31958
|
};
|
|
31585
31959
|
}, "evidenceFindingsStoreOver");
|
|
31586
31960
|
|
|
31587
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31961
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
|
|
31588
31962
|
var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
|
|
31589
31963
|
var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
|
|
31590
31964
|
rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
|
|
@@ -31609,7 +31983,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
31609
31983
|
...since === void 0 ? [] : [["AND i.occurred_at>=?", since]],
|
|
31610
31984
|
...until === void 0 ? [] : [["AND i.occurred_at<=?", until]]
|
|
31611
31985
|
];
|
|
31612
|
-
const
|
|
31986
|
+
const bound5 = before2 === void 0 ? [] : [before2.at, before2.at, before2.id];
|
|
31613
31987
|
const account = only === void 0 ? [] : [only.provider, only.account];
|
|
31614
31988
|
return database.prepare(`SELECT i.*, a.provider, a.external_id AS account, c.external_id AS chat, m.external_id AS message
|
|
31615
31989
|
FROM involvements i LEFT JOIN projects pr ON pr.id=i.project_id
|
|
@@ -31618,7 +31992,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
31618
31992
|
LEFT JOIN chats c ON c.id=CASE WHEN i.subject_type='chat' THEN i.subject_id ELSE m.chat_id END
|
|
31619
31993
|
WHERE i.person_id=? ${filters.map(([sql2]) => sql2).join(" ")}
|
|
31620
31994
|
${before2 === void 0 ? "" : "AND (i.occurred_at<? OR (i.occurred_at=? AND i.id<?))"}
|
|
31621
|
-
${only === void 0 ? "" : "AND (a.provider IS NULL OR a.provider<>? OR a.external_id=?)"} ORDER BY i.occurred_at DESC, i.id DESC LIMIT ?`).all(personId, ...filters.map(([, value]) => value), ...
|
|
31995
|
+
${only === void 0 ? "" : "AND (a.provider IS NULL OR a.provider<>? OR a.external_id=?)"} ORDER BY i.occurred_at DESC, i.id DESC LIMIT ?`).all(personId, ...filters.map(([, value]) => value), ...bound5, ...account, limit).map((row2) => ({
|
|
31622
31996
|
id: Number(row2.id),
|
|
31623
31997
|
personId: Number(row2.person_id),
|
|
31624
31998
|
identityId: row2.identity_id == null ? null : Number(row2.identity_id),
|
|
@@ -31637,7 +32011,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
31637
32011
|
}, "forPerson")
|
|
31638
32012
|
}), "involvementStoreOver");
|
|
31639
32013
|
|
|
31640
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32014
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
|
|
31641
32015
|
import { createHash as createHash12 } from "node:crypto";
|
|
31642
32016
|
var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
|
|
31643
32017
|
var id = /* @__PURE__ */ __name((value) => {
|
|
@@ -31723,24 +32097,24 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
|
|
|
31723
32097
|
};
|
|
31724
32098
|
}, "meetingProjectsStoreOver");
|
|
31725
32099
|
|
|
31726
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32100
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
|
|
31727
32101
|
import { createHash as createHash15 } from "node:crypto";
|
|
31728
32102
|
|
|
31729
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32103
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
|
|
31730
32104
|
import { createHash as createHash14 } from "node:crypto";
|
|
31731
32105
|
|
|
31732
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32106
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
|
|
31733
32107
|
import { createHash as createHash13 } from "node:crypto";
|
|
31734
32108
|
|
|
31735
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31736
|
-
var consolidationId = /* @__PURE__ */ __name((value,
|
|
32109
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
|
|
32110
|
+
var consolidationId = /* @__PURE__ */ __name((value, field4) => {
|
|
31737
32111
|
if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
31738
|
-
throw new CliError("validation_error", `${
|
|
32112
|
+
throw new CliError("validation_error", `${field4} must be a positive canonical tag id`);
|
|
31739
32113
|
return Number(value);
|
|
31740
32114
|
}, "consolidationId");
|
|
31741
|
-
var bounded = /* @__PURE__ */ __name((value, max,
|
|
32115
|
+
var bounded = /* @__PURE__ */ __name((value, max, field4) => {
|
|
31742
32116
|
if (!Number.isSafeInteger(value) || value < 1 || value > max)
|
|
31743
|
-
throw new CliError("validation_error", `${
|
|
32117
|
+
throw new CliError("validation_error", `${field4} must be an integer from 1 to ${max}`);
|
|
31744
32118
|
return value;
|
|
31745
32119
|
}, "bounded");
|
|
31746
32120
|
var consolidationInput = /* @__PURE__ */ __name((options, apply = false) => {
|
|
@@ -31755,9 +32129,9 @@ var consolidationInput = /* @__PURE__ */ __name((options, apply = false) => {
|
|
|
31755
32129
|
"signal",
|
|
31756
32130
|
...apply ? ["by", "expectedPreviewFingerprint", "idempotencyKey"] : ["sampleLimit"]
|
|
31757
32131
|
]);
|
|
31758
|
-
for (const
|
|
31759
|
-
if (!allowed.has(
|
|
31760
|
-
throw new CliError("validation_error", `unknown consolidation field: ${
|
|
32132
|
+
for (const field4 of Object.keys(options))
|
|
32133
|
+
if (!allowed.has(field4))
|
|
32134
|
+
throw new CliError("validation_error", `unknown consolidation field: ${field4}`);
|
|
31761
32135
|
const source2 = consolidationId(options.sourceId, "sourceId");
|
|
31762
32136
|
const survivor = consolidationId(options.survivorId, "survivorId");
|
|
31763
32137
|
if (source2 === survivor)
|
|
@@ -31783,7 +32157,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
|
|
|
31783
32157
|
return input;
|
|
31784
32158
|
}, "consolidationApplyInput");
|
|
31785
32159
|
|
|
31786
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32160
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
|
|
31787
32161
|
var receiptOf = /* @__PURE__ */ __name((row2) => ({
|
|
31788
32162
|
id: String(row2.id),
|
|
31789
32163
|
sourceId: String(row2.source_id),
|
|
@@ -31858,7 +32232,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
|
|
|
31858
32232
|
}, { beforeCommit: check3 });
|
|
31859
32233
|
}, "applyTagConsolidation");
|
|
31860
32234
|
|
|
31861
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32235
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
|
|
31862
32236
|
var selections = [
|
|
31863
32237
|
["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
|
|
31864
32238
|
["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
|
|
@@ -31941,9 +32315,9 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
|
|
|
31941
32315
|
totals.survivor++;
|
|
31942
32316
|
byTargetType.set(type, totals);
|
|
31943
32317
|
}
|
|
31944
|
-
const counts = /* @__PURE__ */ __name((values,
|
|
31945
|
-
source: values.filter((row2) => sourceMembers.has(Number(row2[
|
|
31946
|
-
survivor: values.filter((row2) => !sourceMembers.has(Number(row2[
|
|
32318
|
+
const counts = /* @__PURE__ */ __name((values, field4) => ({
|
|
32319
|
+
source: values.filter((row2) => sourceMembers.has(Number(row2[field4]))).length,
|
|
32320
|
+
survivor: values.filter((row2) => !sourceMembers.has(Number(row2[field4]))).length
|
|
31947
32321
|
}), "counts");
|
|
31948
32322
|
const overlaps = /* @__PURE__ */ __name((values, key2) => {
|
|
31949
32323
|
const targets = new Set(values.filter((row2) => sourceMembers.has(Number(row2.tag_id))).map(key2));
|
|
@@ -32002,7 +32376,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
|
|
|
32002
32376
|
};
|
|
32003
32377
|
}, "previewRows");
|
|
32004
32378
|
|
|
32005
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32379
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
|
|
32006
32380
|
var kinds = ["project", "tag", "topic"];
|
|
32007
32381
|
var cancelled2 = /* @__PURE__ */ __name((signal) => {
|
|
32008
32382
|
if (signal?.aborted)
|
|
@@ -32266,7 +32640,7 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32266
32640
|
};
|
|
32267
32641
|
}, "vocabularyStoreOver");
|
|
32268
32642
|
|
|
32269
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32643
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
|
|
32270
32644
|
var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
|
|
32271
32645
|
var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
|
|
32272
32646
|
var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
|
|
@@ -32490,7 +32864,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32490
32864
|
}, "due");
|
|
32491
32865
|
const openTask = /* @__PURE__ */ __name((key2, id2) => {
|
|
32492
32866
|
const row2 = taskRowOf(database, id2);
|
|
32493
|
-
const open = row2 !== void 0 && taskAccountOf(database, row2) === taskAccount(key2) && database.prepare("SELECT status FROM tasks WHERE id = ?").get(row2)?.status
|
|
32867
|
+
const open = row2 !== void 0 && taskAccountOf(database, row2) === taskAccount(key2) && !isClosedState(String(database.prepare("SELECT status FROM tasks WHERE id = ?").get(row2)?.status ?? "done"));
|
|
32494
32868
|
if (!open)
|
|
32495
32869
|
throw new CliError("validation_error", "a reminder requires an open task in this account");
|
|
32496
32870
|
return row2;
|
|
@@ -32762,7 +33136,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32762
33136
|
if (!Number.isInteger(lease) || lease < 1e3 || lease > 36e5)
|
|
32763
33137
|
throw new CliError("validation_error", "lease takes 1000\u20133600000 milliseconds");
|
|
32764
33138
|
const accountId = account(key2), at = now2();
|
|
32765
|
-
const rows = database.prepare("SELECT r.id FROM reminders r JOIN tasks t ON t.id = r.task_id WHERE r.account_id=? AND r.due_at<=? AND t.status
|
|
33139
|
+
const rows = database.prepare("SELECT r.id FROM reminders r JOIN tasks t ON t.id = r.task_id WHERE r.account_id=? AND r.due_at<=? AND t.status NOT IN ('done','dismissed') AND (r.state='pending' OR (r.state='leased' AND r.lease_until<=?)) ORDER BY r.due_at, r.id LIMIT ?").all(accountId, at, at, limit);
|
|
32766
33140
|
const claimed = [];
|
|
32767
33141
|
for (const row2 of rows) {
|
|
32768
33142
|
const receipt = ulid(at);
|
|
@@ -32788,7 +33162,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
|
|
|
32788
33162
|
return key2.padEnd(3, "X");
|
|
32789
33163
|
}, "projectKey");
|
|
32790
33164
|
|
|
32791
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33165
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
|
|
32792
33166
|
var DAY5 = 864e5;
|
|
32793
33167
|
var SETTING4 = "logs_pruned_at";
|
|
32794
33168
|
var LOG_RETENTION = { agentActionsMs: 90 * DAY5, botUpdatePayloadsMs: 30 * DAY5 };
|
|
@@ -32815,7 +33189,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
|
|
|
32815
33189
|
};
|
|
32816
33190
|
}, "logPruner");
|
|
32817
33191
|
|
|
32818
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33192
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
|
|
32819
33193
|
var stale2 = /* @__PURE__ */ __name(() => {
|
|
32820
33194
|
throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
|
|
32821
33195
|
reason: "meeting-findings.stale"
|
|
@@ -32984,7 +33358,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32984
33358
|
};
|
|
32985
33359
|
}, "meetingFindingsStoreOver");
|
|
32986
33360
|
|
|
32987
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33361
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
|
|
32988
33362
|
var RANK_BATCH = 512;
|
|
32989
33363
|
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";
|
|
32990
33364
|
var limitOf = /* @__PURE__ */ __name((value, name, max = 1e3) => {
|
|
@@ -33255,7 +33629,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
|
|
|
33255
33629
|
}
|
|
33256
33630
|
}), "meetingVectorsOver");
|
|
33257
33631
|
|
|
33258
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33632
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
|
|
33259
33633
|
var OTHER_SOURCES = ["document", "note", "email"];
|
|
33260
33634
|
var TEXTS = {
|
|
33261
33635
|
document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
|
|
@@ -33356,11 +33730,11 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
33356
33730
|
};
|
|
33357
33731
|
}, "sourceMentionStoreOver");
|
|
33358
33732
|
|
|
33359
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33733
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
|
|
33360
33734
|
import { mkdirSync, statSync, writeFileSync } from "node:fs";
|
|
33361
33735
|
import { dirname } from "node:path";
|
|
33362
33736
|
|
|
33363
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33737
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
|
|
33364
33738
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
33365
33739
|
var CLIENTS_SETTING = "clients";
|
|
33366
33740
|
var coreVersion = (() => {
|
|
@@ -33418,7 +33792,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
|
|
|
33418
33792
|
return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
|
|
33419
33793
|
}, "refusalAdvice");
|
|
33420
33794
|
|
|
33421
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33795
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
|
|
33422
33796
|
var GENERATED = [
|
|
33423
33797
|
{
|
|
33424
33798
|
"name": "20261010184427_initial",
|
|
@@ -34281,10 +34655,33 @@ WHERE json_type(params, '$.selection') = 'object';`
|
|
|
34281
34655
|
"CREATE TRIGGER document_trigrams_bd BEFORE DELETE ON documents BEGIN\n DELETE FROM document_trigrams WHERE rowid = old.id;\nEND;",
|
|
34282
34656
|
"-- The trigrams hold JS-normalized text, which SQL cannot produce: fillTrigrams fills the rows stored before this\n-- version, up to `watermark`, and a search reads the rest of them by their text meanwhile.\nINSERT INTO search_index_state (name, watermark, filled_through, terms_through, normalizer_version)\n SELECT 'note_trigrams', coalesce(max(id), 0), 0, 0, 1 FROM notes\n UNION ALL SELECT 'document_trigrams', coalesce(max(id), 0), 0, 0, 1 FROM documents;"
|
|
34283
34657
|
]
|
|
34658
|
+
},
|
|
34659
|
+
{
|
|
34660
|
+
"name": "20261031230945_version-41-task-fields",
|
|
34661
|
+
"statements": [
|
|
34662
|
+
"ALTER TABLE `tasks` ADD `priority_score` real;",
|
|
34663
|
+
"ALTER TABLE `tasks` ADD `agent` text;",
|
|
34664
|
+
"ALTER TABLE `tasks` ADD `revision` integer DEFAULT 1 NOT NULL;",
|
|
34665
|
+
"-- 0 urgent \u2026 4 low land inside the critical, high, medium and low quarters, with room on either side for moves.\nUPDATE tasks SET priority_score = CASE priority WHEN 0 THEN 0.875 WHEN 1 THEN 0.625 WHEN 2 THEN 0.375 WHEN 3 THEN 0.1875 WHEN 4 THEN 0.0625 END WHERE priority IS NOT NULL;",
|
|
34666
|
+
"-- A build before version 41 writes only `priority`; these keep the score in step with what it wrote.\nCREATE TRIGGER tasks_priority_score_ai AFTER INSERT ON tasks WHEN new.priority IS NOT NULL AND new.priority_score IS NULL BEGIN\n UPDATE tasks SET priority_score = CASE new.priority WHEN 0 THEN 0.875 WHEN 1 THEN 0.625 WHEN 2 THEN 0.375 WHEN 3 THEN 0.1875 WHEN 4 THEN 0.0625 END WHERE id = new.id;\nEND;",
|
|
34667
|
+
"CREATE TRIGGER tasks_priority_score_au AFTER UPDATE OF priority ON tasks WHEN new.priority IS NOT old.priority AND new.priority_score IS old.priority_score BEGIN\n UPDATE tasks SET priority_score = CASE new.priority WHEN 0 THEN 0.875 WHEN 1 THEN 0.625 WHEN 2 THEN 0.375 WHEN 3 THEN 0.1875 WHEN 4 THEN 0.0625 END WHERE id = new.id;\nEND;",
|
|
34668
|
+
"-- Every build's write bumps it, older ones too, so a stale copy is caught whoever wrote last.\nCREATE TRIGGER tasks_revision_au AFTER UPDATE ON tasks WHEN new.revision IS old.revision BEGIN\n UPDATE tasks SET revision = old.revision + 1 WHERE id = new.id;\nEND;"
|
|
34669
|
+
]
|
|
34670
|
+
},
|
|
34671
|
+
{
|
|
34672
|
+
"name": "20261101002523_version-42-task-revision",
|
|
34673
|
+
"statements": [
|
|
34674
|
+
"-- A claim renewed, a follow-up time or a close suggestion is an agent at work, not a change a person could overwrite;\n-- bumping on those made the board report a conflict while an agent simply worked.\nDROP TRIGGER tasks_revision_au;",
|
|
34675
|
+
"CREATE TRIGGER tasks_revision_au AFTER UPDATE OF title, description, status, priority, priority_score, agent, due_at, project_id, parent_id ON tasks\n WHEN new.revision IS old.revision AND (new.title IS NOT old.title OR new.description IS NOT old.description\n OR new.status IS NOT old.status OR new.priority IS NOT old.priority OR new.priority_score IS NOT old.priority_score\n OR new.agent IS NOT old.agent OR new.due_at IS NOT old.due_at OR new.project_id IS NOT old.project_id\n OR new.parent_id IS NOT old.parent_id) BEGIN\n UPDATE tasks SET revision = old.revision + 1 WHERE id = new.id;\nEND;",
|
|
34676
|
+
"CREATE TRIGGER tasks_revision_assignment_ai AFTER INSERT ON task_assignments BEGIN\n UPDATE tasks SET revision = revision + 1 WHERE id = new.task_id;\nEND;",
|
|
34677
|
+
"CREATE TRIGGER tasks_revision_assignment_ad AFTER DELETE ON task_assignments BEGIN\n UPDATE tasks SET revision = revision + 1 WHERE id = old.task_id;\nEND;",
|
|
34678
|
+
"CREATE TRIGGER tasks_revision_tagging_ai AFTER INSERT ON taggings WHEN new.taggable_type = 'task' BEGIN\n UPDATE tasks SET revision = revision + 1 WHERE id = new.taggable_id;\nEND;",
|
|
34679
|
+
"CREATE TRIGGER tasks_revision_tagging_ad AFTER DELETE ON taggings WHEN old.taggable_type = 'task' BEGIN\n UPDATE tasks SET revision = revision + 1 WHERE id = old.taggable_id;\nEND;"
|
|
34680
|
+
]
|
|
34284
34681
|
}
|
|
34285
34682
|
];
|
|
34286
34683
|
|
|
34287
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34684
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
|
|
34288
34685
|
var MANIFEST = [
|
|
34289
34686
|
{ name: "20261010184427_initial", version: 1, minCompatible: 1 },
|
|
34290
34687
|
{ name: "20261011035353_version-2-facts", version: 2, minCompatible: 1 },
|
|
@@ -34338,7 +34735,9 @@ var MANIFEST = [
|
|
|
34338
34735
|
{ name: "20261029224106_version-38-folded-names", version: 38, minCompatible: 34 },
|
|
34339
34736
|
{ name: "20261029224107_version-38-folded-triggers", version: 38, minCompatible: 34 },
|
|
34340
34737
|
{ name: "20261030114008_version-39-email-locations", version: 39, minCompatible: 34 },
|
|
34341
|
-
{ name: "20261030225520_version-40-note-trigrams", version: 40, minCompatible: 34 }
|
|
34738
|
+
{ name: "20261030225520_version-40-note-trigrams", version: 40, minCompatible: 34 },
|
|
34739
|
+
{ name: "20261031230945_version-41-task-fields", version: 41, minCompatible: 34 },
|
|
34740
|
+
{ name: "20261101002523_version-42-task-revision", version: 42, minCompatible: 34 }
|
|
34342
34741
|
];
|
|
34343
34742
|
var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated = GENERATED) => {
|
|
34344
34743
|
const migrations = [];
|
|
@@ -34362,7 +34761,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
|
|
|
34362
34761
|
return migrations;
|
|
34363
34762
|
}, "generatedMigrations");
|
|
34364
34763
|
|
|
34365
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34764
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/migrations.js
|
|
34366
34765
|
var MIGRATIONS = generatedMigrations();
|
|
34367
34766
|
var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
34368
34767
|
version INTEGER PRIMARY KEY,
|
|
@@ -34415,7 +34814,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
|
|
|
34415
34814
|
}
|
|
34416
34815
|
}, "migrate");
|
|
34417
34816
|
|
|
34418
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34817
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
|
|
34419
34818
|
var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
34420
34819
|
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 ?");
|
|
34421
34820
|
if (pending.get(0, 1) === void 0)
|
|
@@ -34437,7 +34836,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
|
34437
34836
|
}
|
|
34438
34837
|
}, "fillJoinKeys");
|
|
34439
34838
|
|
|
34440
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34839
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
|
|
34441
34840
|
var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
|
|
34442
34841
|
const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
|
|
34443
34842
|
try {
|
|
@@ -34450,8 +34849,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
|
|
|
34450
34849
|
}, "openSqlite");
|
|
34451
34850
|
var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
34452
34851
|
quietSqliteWarning();
|
|
34453
|
-
const { drizzle } = await import("./node-
|
|
34454
|
-
const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-
|
|
34852
|
+
const { drizzle } = await import("./node-S3VEQNTE.js");
|
|
34853
|
+
const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-3DNWF2BW.js");
|
|
34455
34854
|
const client = await nodeClient(path, { readOnly });
|
|
34456
34855
|
try {
|
|
34457
34856
|
return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
|
|
@@ -34461,8 +34860,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
|
34461
34860
|
}
|
|
34462
34861
|
}, "openUnderNode");
|
|
34463
34862
|
var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
34464
|
-
const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-
|
|
34465
|
-
const { drizzle } = await import("./bun-
|
|
34863
|
+
const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-2G5TXHYE.js");
|
|
34864
|
+
const { drizzle } = await import("./bun-KUKVEKDW.js");
|
|
34466
34865
|
const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
|
|
34467
34866
|
try {
|
|
34468
34867
|
return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
|
|
@@ -34472,7 +34871,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
|
34472
34871
|
}
|
|
34473
34872
|
}, "openUnderBun");
|
|
34474
34873
|
|
|
34475
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34874
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
|
|
34476
34875
|
var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
|
|
34477
34876
|
const ours = MIGRATIONS.at(-1)?.version ?? 0;
|
|
34478
34877
|
if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
|
|
@@ -34487,7 +34886,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
|
|
|
34487
34886
|
throw new CliError("configuration_error", `The store requires schema ${minCompatible}, but this tool supports ${ours}; ${refusalAdvice(storeClients(database), command, version)}`);
|
|
34488
34887
|
}, "assertReadCompatible");
|
|
34489
34888
|
|
|
34490
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34889
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
|
|
34491
34890
|
var BACKFILL_ON_OPEN = 5e3;
|
|
34492
34891
|
var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
|
|
34493
34892
|
var createWritable = /* @__PURE__ */ __name((file) => {
|
|
@@ -34543,10 +34942,10 @@ var openStoreContext = /* @__PURE__ */ __name(async ({ path, env, now: now2 = Da
|
|
|
34543
34942
|
}
|
|
34544
34943
|
}, "openStoreContext");
|
|
34545
34944
|
|
|
34546
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34945
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
|
|
34547
34946
|
import { createHash as createHash16 } from "node:crypto";
|
|
34548
34947
|
|
|
34549
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34948
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
|
|
34550
34949
|
var text3 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
|
|
34551
34950
|
var ref = text3(2048);
|
|
34552
34951
|
var timestamp2 = pipe(number(), safeInteger(), minValue(0));
|
|
@@ -34612,10 +35011,10 @@ var projectAnnotationsSchema = strictObject({
|
|
|
34612
35011
|
}))
|
|
34613
35012
|
});
|
|
34614
35013
|
|
|
34615
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35014
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
|
|
34616
35015
|
var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
|
|
34617
|
-
var invalid7 = /* @__PURE__ */ __name((
|
|
34618
|
-
throw new CliError("validation_error", `invalid project annotations.${
|
|
35016
|
+
var invalid7 = /* @__PURE__ */ __name((field4) => {
|
|
35017
|
+
throw new CliError("validation_error", `invalid project annotations.${field4}`);
|
|
34619
35018
|
}, "invalid");
|
|
34620
35019
|
var canonical = /* @__PURE__ */ __name((ref3) => {
|
|
34621
35020
|
try {
|
|
@@ -34716,7 +35115,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
|
|
|
34716
35115
|
invalid7("external.unused");
|
|
34717
35116
|
}, "validateProjectAnnotationsGraph");
|
|
34718
35117
|
|
|
34719
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35118
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
|
|
34720
35119
|
var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
|
|
34721
35120
|
var ref2 = pipe(string(), minLength(1), maxLength(2048));
|
|
34722
35121
|
var targetSchema = strictObject({
|
|
@@ -34736,8 +35135,8 @@ var kind2 = /* @__PURE__ */ __name((ref3) => {
|
|
|
34736
35135
|
const parsed2 = parseReference(ref3);
|
|
34737
35136
|
return "provider" in parsed2 ? `${parsed2.type}:${parsed2.provider}` : parsed2.type;
|
|
34738
35137
|
}, "kind");
|
|
34739
|
-
var invalid8 = /* @__PURE__ */ __name((
|
|
34740
|
-
throw new CliError("validation_error", `invalid project annotation plan.${
|
|
35138
|
+
var invalid8 = /* @__PURE__ */ __name((field4) => {
|
|
35139
|
+
throw new CliError("validation_error", `invalid project annotation plan.${field4}`);
|
|
34741
35140
|
}, "invalid");
|
|
34742
35141
|
var projectAnnotationBindingSources = /* @__PURE__ */ __name((manifest, bindings) => {
|
|
34743
35142
|
if (!bindings || typeof bindings !== "object" || Array.isArray(bindings) || Object.keys(bindings).length > 1001)
|
|
@@ -34822,7 +35221,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
|
|
|
34822
35221
|
};
|
|
34823
35222
|
}, "planBoundProjectAnnotations");
|
|
34824
35223
|
|
|
34825
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35224
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
|
|
34826
35225
|
import { createHash as createHash17 } from "node:crypto";
|
|
34827
35226
|
var text4 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
|
|
34828
35227
|
var timestamp3 = pipe(number(), safeInteger(), minValue(0));
|
|
@@ -34869,8 +35268,8 @@ var snapshotGraph = /* @__PURE__ */ __name((value) => ({
|
|
|
34869
35268
|
external: value.external
|
|
34870
35269
|
}), "snapshotGraph");
|
|
34871
35270
|
var decodeProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3) => {
|
|
34872
|
-
const invalid10 = /* @__PURE__ */ __name((
|
|
34873
|
-
throw new CliError("validation_error", `invalid project annotation snapshot.${
|
|
35271
|
+
const invalid10 = /* @__PURE__ */ __name((field4) => {
|
|
35272
|
+
throw new CliError("validation_error", `invalid project annotation snapshot.${field4}`);
|
|
34874
35273
|
}, "invalid");
|
|
34875
35274
|
if (typeof json3 !== "string" || Buffer.byteLength(json3) > PROJECT_ANNOTATIONS_MAX_BYTES)
|
|
34876
35275
|
return invalid10("bytes");
|
|
@@ -34886,13 +35285,13 @@ var decodeProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3) => {
|
|
|
34886
35285
|
const snapshot2 = checked.output;
|
|
34887
35286
|
if (snapshot2.aliases.length + snapshot2.facts.length + snapshot2.links.length + snapshot2.external.length > 1e3)
|
|
34888
35287
|
return invalid10("record budget");
|
|
34889
|
-
for (const
|
|
34890
|
-
if (snapshot2.project[
|
|
34891
|
-
return invalid10(`project.${
|
|
35288
|
+
for (const field4 of ["description", "status", "owner"])
|
|
35289
|
+
if (snapshot2.project[field4] !== null && !snapshot2.project[field4].trim())
|
|
35290
|
+
return invalid10(`project.${field4}`);
|
|
34892
35291
|
for (const alias2 of snapshot2.aliases)
|
|
34893
|
-
for (const
|
|
34894
|
-
if (!alias2[
|
|
34895
|
-
return invalid10(`aliases.${
|
|
35292
|
+
for (const field4 of ["name", "source"])
|
|
35293
|
+
if (!alias2[field4].trim())
|
|
35294
|
+
return invalid10(`aliases.${field4}`);
|
|
34896
35295
|
if (snapshot2.project.updated_at < snapshot2.project.created_at)
|
|
34897
35296
|
return invalid10("project.updated_at");
|
|
34898
35297
|
for (const alias2 of snapshot2.aliases)
|
|
@@ -34916,14 +35315,14 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
|
|
|
34916
35315
|
})).digest("hex");
|
|
34917
35316
|
}, "projectAnnotationSnapshotFingerprint");
|
|
34918
35317
|
|
|
34919
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35318
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
|
|
34920
35319
|
var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
|
|
34921
35320
|
if (!request || typeof request !== "object" || Array.isArray(request))
|
|
34922
35321
|
throw new CliError("validation_error", "project annotation request is required");
|
|
34923
35322
|
const fields4 = ["snapshot", "project", "bindings", "maxReadBytes", ...restore ? ["fingerprint"] : []];
|
|
34924
|
-
for (const
|
|
34925
|
-
if (!fields4.includes(
|
|
34926
|
-
throw new CliError("validation_error", `unknown project annotation field ${
|
|
35323
|
+
for (const field4 of Object.keys(request))
|
|
35324
|
+
if (!fields4.includes(field4))
|
|
35325
|
+
throw new CliError("validation_error", `unknown project annotation field ${field4}`);
|
|
34927
35326
|
const snapshot2 = decodeProjectAnnotationSnapshot(request.snapshot);
|
|
34928
35327
|
projectAnnotationBindingSources(snapshot2, request.bindings);
|
|
34929
35328
|
if (typeof request.project !== "string" || !/^project:[1-9]\d*$/.test(request.project) || !Number.isSafeInteger(Number(request.project.slice(8))))
|
|
@@ -34933,7 +35332,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
|
|
|
34933
35332
|
return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
|
|
34934
35333
|
}, "projectAnnotationRequest");
|
|
34935
35334
|
|
|
34936
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35335
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
|
|
34937
35336
|
var SnapshotBudget = class {
|
|
34938
35337
|
static {
|
|
34939
35338
|
__name(this, "SnapshotBudget");
|
|
@@ -34953,19 +35352,19 @@ var SnapshotBudget = class {
|
|
|
34953
35352
|
this.bytes += bytes3;
|
|
34954
35353
|
}
|
|
34955
35354
|
rows(database, from2, fields4, parameters) {
|
|
34956
|
-
const bytes3 = fields4.map((
|
|
35355
|
+
const bytes3 = fields4.map((field4) => `coalesce(length(CAST(${field4} AS BLOB)),0)`).join("+");
|
|
34957
35356
|
const sized = database.prepare(`SELECT ${bytes3} AS bytes ${from2} LIMIT 1001`).all(...parameters);
|
|
34958
35357
|
this.reserve(sized.length, sized.reduce((sum, row2) => sum + Number(row2.bytes) + 128, 0));
|
|
34959
35358
|
}
|
|
34960
35359
|
};
|
|
34961
35360
|
|
|
34962
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35361
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
|
|
34963
35362
|
import { createHash as createHash19 } from "node:crypto";
|
|
34964
35363
|
|
|
34965
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35364
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
|
|
34966
35365
|
var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
|
|
34967
35366
|
|
|
34968
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35367
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
|
|
34969
35368
|
import { createHash as createHash18 } from "node:crypto";
|
|
34970
35369
|
var invalid9 = /* @__PURE__ */ __name(() => {
|
|
34971
35370
|
throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
|
|
@@ -35108,7 +35507,7 @@ var ProjectSnapshotSources = class {
|
|
|
35108
35507
|
}
|
|
35109
35508
|
};
|
|
35110
35509
|
|
|
35111
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35510
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
|
|
35112
35511
|
var unsupported = /* @__PURE__ */ __name(() => {
|
|
35113
35512
|
throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
|
|
35114
35513
|
}, "unsupported");
|
|
@@ -35279,7 +35678,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
|
|
|
35279
35678
|
return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
|
|
35280
35679
|
}), "projectAnnotationSnapshot");
|
|
35281
35680
|
|
|
35282
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35681
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
|
|
35283
35682
|
var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, manifest, bindings, budget) => read(database, () => {
|
|
35284
35683
|
const current = projectAnnotationSnapshot(database, projectId, budget).snapshot;
|
|
35285
35684
|
const sources = new ProjectSnapshotSources(database, budget);
|
|
@@ -35316,7 +35715,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
|
|
|
35316
35715
|
if (project && names.has(normalizeVocabularyName(String(alias2.name))))
|
|
35317
35716
|
namespace.add(`project:${project.id}`);
|
|
35318
35717
|
}
|
|
35319
|
-
const descriptor_conflicts = ["key", "name"].filter((
|
|
35718
|
+
const descriptor_conflicts = ["key", "name"].filter((field4) => current.project[field4] !== manifest.project[field4]);
|
|
35320
35719
|
const target = {
|
|
35321
35720
|
project: current.project.ref,
|
|
35322
35721
|
annotation_count: current.aliases.length + current.facts.length + current.links.length,
|
|
@@ -35341,7 +35740,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
|
|
|
35341
35740
|
};
|
|
35342
35741
|
}), "previewAnnotationSnapshot");
|
|
35343
35742
|
|
|
35344
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35743
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
|
|
35345
35744
|
var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snapshot2, bindings) => {
|
|
35346
35745
|
const mappings = { ...bindings };
|
|
35347
35746
|
const resolve = /* @__PURE__ */ __name((ref3) => {
|
|
@@ -35383,7 +35782,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snap
|
|
|
35383
35782
|
return mappings;
|
|
35384
35783
|
}, "restoreAnnotationRecords");
|
|
35385
35784
|
|
|
35386
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35785
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
|
|
35387
35786
|
var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
35388
35787
|
async preview(request) {
|
|
35389
35788
|
const { snapshot: snapshot2, projectId } = projectAnnotationRequest(request);
|
|
@@ -35413,7 +35812,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
35413
35812
|
}
|
|
35414
35813
|
}), "projectAnnotationStoreOver");
|
|
35415
35814
|
|
|
35416
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35815
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
|
|
35417
35816
|
var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
|
|
35418
35817
|
const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
|
|
35419
35818
|
let merged = { from: from2, to };
|
|
@@ -35426,7 +35825,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
|
|
|
35426
35825
|
}, "markRange");
|
|
35427
35826
|
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");
|
|
35428
35827
|
|
|
35429
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35828
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
|
|
35430
35829
|
var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
|
|
35431
35830
|
var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
|
|
35432
35831
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
|
|
@@ -35436,7 +35835,7 @@ var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) =
|
|
|
35436
35835
|
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);
|
|
35437
35836
|
}, "setTaskRulesStop");
|
|
35438
35837
|
|
|
35439
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35838
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sync.js
|
|
35440
35839
|
var syncStoreOver = /* @__PURE__ */ __name((context) => {
|
|
35441
35840
|
const { database } = context;
|
|
35442
35841
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
|
|
@@ -35492,7 +35891,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
35492
35891
|
};
|
|
35493
35892
|
}, "syncStoreOver");
|
|
35494
35893
|
|
|
35495
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35894
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/tags.js
|
|
35496
35895
|
var tagsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
35497
35896
|
const { database } = context;
|
|
35498
35897
|
return {
|
|
@@ -35514,7 +35913,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
35514
35913
|
};
|
|
35515
35914
|
}, "tagsStoreOver");
|
|
35516
35915
|
|
|
35517
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35916
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
|
|
35518
35917
|
var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
|
|
35519
35918
|
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
|
|
35520
35919
|
WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
|
|
@@ -35641,7 +36040,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
|
|
|
35641
36040
|
dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
|
|
35642
36041
|
}, "savePictureChunks");
|
|
35643
36042
|
|
|
35644
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36043
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
|
|
35645
36044
|
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,
|
|
35646
36045
|
EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
|
|
35647
36046
|
FROM messages m
|
|
@@ -35730,7 +36129,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
|
|
|
35730
36129
|
return plain2(best(found2));
|
|
35731
36130
|
}, "nearestMessages");
|
|
35732
36131
|
|
|
35733
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36132
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/vectors.js
|
|
35734
36133
|
var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
|
|
35735
36134
|
const { database } = context;
|
|
35736
36135
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -35988,7 +36387,7 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
35988
36387
|
embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
|
|
35989
36388
|
}), "vectorsStoreOver");
|
|
35990
36389
|
|
|
35991
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36390
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
|
|
35992
36391
|
import { existsSync, readFileSync as readFileSync4 } from "node:fs";
|
|
35993
36392
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
35994
36393
|
var BOOKKEEPING = ["schema_migrations", "store_settings"];
|
|
@@ -36076,10 +36475,10 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
|
|
|
36076
36475
|
}
|
|
36077
36476
|
}, "lastBackup");
|
|
36078
36477
|
|
|
36079
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36478
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/providers.js
|
|
36080
36479
|
var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
|
|
36081
36480
|
|
|
36082
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36481
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
|
|
36083
36482
|
var COUNTED_TABLES = [
|
|
36084
36483
|
"accounts",
|
|
36085
36484
|
"chats",
|
|
@@ -36164,7 +36563,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
|
|
|
36164
36563
|
};
|
|
36165
36564
|
}, "storeContents");
|
|
36166
36565
|
|
|
36167
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36566
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.517.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._6629eebba461c30d3c69d5318744d1d9/node_modules/@wirecat/cli-core/dist/store/store.js
|
|
36168
36567
|
var openStore = /* @__PURE__ */ __name(async (options = {}) => {
|
|
36169
36568
|
const context = await openStoreContext(options);
|
|
36170
36569
|
try {
|