@wirecat/mail-cli 0.1.1 → 0.3.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/CHANGELOG.md +51 -0
- package/README.md +4 -3
- package/dist/bin/mail.js +2 -2
- package/dist/bundle/{all-profiles-TKMBELRZ.js → all-profiles-52LCOKSL.js} +5 -5
- package/dist/bundle/{anthropic-7LMUAEIZ.js → anthropic-HPW7PLTT.js} +3 -3
- package/dist/bundle/{app-server-JGMIJDD4.js → app-server-Y7XSPVHJ.js} +39 -39
- package/dist/bundle/{bun-XRO6XJHQ.js → bun-B7YXDIMT.js} +2 -2
- package/dist/bundle/{bun-sqlite-Z54LEHVM.js → bun-sqlite-TTTKY7H2.js} +2 -2
- package/dist/bundle/{chunk-52F5DWS5.js → chunk-37MSU5O6.js} +1 -1
- package/dist/bundle/{chunk-5NYMNSSO.js → chunk-3RDTVH3H.js} +3 -3
- package/dist/bundle/{chunk-4E7BN3TC.js → chunk-4PXWXI2U.js} +2 -2
- package/dist/bundle/{chunk-GN62YOT5.js → chunk-4UOEUEZZ.js} +4 -4
- package/dist/bundle/{chunk-TQFCPUIM.js → chunk-5LY3OS7U.js} +1 -1
- package/dist/bundle/{chunk-QLEUNU6G.js → chunk-5SSFYIFF.js} +4 -4
- package/dist/bundle/{chunk-IK5TH3O7.js → chunk-732GKOLO.js} +10 -10
- package/dist/bundle/{chunk-UH4DDRHA.js → chunk-C2THROZU.js} +42 -42
- package/dist/bundle/{chunk-OTUOZ33L.js → chunk-C6E3VFUX.js} +2 -2
- package/dist/bundle/{chunk-YPQQ5J4X.js → chunk-DKKCQMDM.js} +16 -16
- package/dist/bundle/{chunk-6MAZWSC3.js → chunk-FGNTGLWA.js} +3 -3
- package/dist/bundle/{chunk-GQQJOH7A.js → chunk-FUXSKWWJ.js} +58 -46
- package/dist/bundle/{chunk-3KEVLSNN.js → chunk-FX77WAQL.js} +46 -8
- package/dist/bundle/{chunk-VEIZZRQ5.js → chunk-GX2M3AOO.js} +12 -3
- package/dist/bundle/{chunk-CEW6KIFA.js → chunk-H2JVXO5V.js} +32 -22
- package/dist/bundle/{chunk-ZANYM66S.js → chunk-HS25KDT3.js} +1 -1
- package/dist/bundle/{chunk-KM7Q67Z3.js → chunk-I2ARI6FI.js} +1 -1
- package/dist/bundle/{chunk-TWPDVUBR.js → chunk-IXHLMSHV.js} +2 -2
- package/dist/bundle/{chunk-BTQX2ZSZ.js → chunk-JDOOPGKW.js} +2 -2
- package/dist/bundle/{chunk-GK4M2SUP.js → chunk-JHNLU42I.js} +1 -1
- package/dist/bundle/{chunk-KHTO2Q6E.js → chunk-JXYFIUVX.js} +4 -4
- package/dist/bundle/{chunk-F6D6PJ34.js → chunk-K6SIGXRS.js} +5 -5
- package/dist/bundle/{chunk-QQB7WT7R.js → chunk-KALDYMKJ.js} +3 -3
- package/dist/bundle/{chunk-NK7EB63L.js → chunk-KXVZ373I.js} +960 -496
- package/dist/bundle/{chunk-GAH7N7HO.js → chunk-LCA5KC34.js} +44 -44
- package/dist/bundle/{chunk-TVREDYX4.js → chunk-LJDOPCPW.js} +100 -91
- package/dist/bundle/{chunk-3KOA73LS.js → chunk-MHNEMDH3.js} +14 -14
- package/dist/bundle/{chunk-MS53RALV.js → chunk-MXUUQXMA.js} +5 -5
- package/dist/bundle/{chunk-YO4CUH5E.js → chunk-N5WIUNOT.js} +1 -1
- package/dist/bundle/{chunk-EOEDICIE.js → chunk-O2F54PUO.js} +1 -1
- package/dist/bundle/{chunk-2LLNPNMB.js → chunk-O3DRPTWF.js} +1 -1
- package/dist/bundle/{chunk-FZ5FXIG6.js → chunk-PL6UPJIL.js} +1 -1
- package/dist/bundle/{chunk-75CWWETH.js → chunk-PYIJCWCH.js} +11 -11
- package/dist/bundle/{chunk-GWDCKUBI.js → chunk-QTWIZKUI.js} +30 -29
- package/dist/bundle/{chunk-7SXGLT6T.js → chunk-RMYYKBFW.js} +9 -8
- package/dist/bundle/{chunk-JVMVLITS.js → chunk-RORC2FW7.js} +4 -2
- package/dist/bundle/{chunk-K4FVKPDQ.js → chunk-RVIMMCHF.js} +9 -9
- package/dist/bundle/{chunk-T6464KYA.js → chunk-RZCFEASJ.js} +205 -204
- package/dist/bundle/{chunk-Z34ICZA3.js → chunk-SRMJ6LLC.js} +5 -5
- package/dist/bundle/{chunk-TWTATDM7.js → chunk-TL7PE6JU.js} +6 -6
- package/dist/bundle/{chunk-4FEMINO2.js → chunk-TLZWUADZ.js} +5 -5
- package/dist/bundle/{chunk-3E3WA2L6.js → chunk-TNQOKGJS.js} +21 -21
- package/dist/bundle/{chunk-MNOIRJEO.js → chunk-V7NZTJKU.js} +7 -7
- package/dist/bundle/{chunk-TE5U5OAM.js → chunk-VTJDEWMB.js} +2 -2
- package/dist/bundle/{chunk-J6MSJLIW.js → chunk-X7TFD5SX.js} +1 -1
- package/dist/bundle/{chunk-FDCGTODC.js → chunk-XD3TL4BK.js} +1 -1
- package/dist/bundle/{chunk-WLFLBWNH.js → chunk-XQVGIW4R.js} +2 -2
- package/dist/bundle/{chunk-JBBZCTTF.js → chunk-Y2HGQK7A.js} +1 -1
- package/dist/bundle/{chunk-WXAXYJJ7.js → chunk-YVIX7FHL.js} +5 -5
- package/dist/bundle/{chunk-CH6RXYAX.js → chunk-ZIJJNH47.js} +1 -1
- package/dist/bundle/{command-contract-WU434ZUL.js → command-contract-3HA7CZEQ.js} +13 -13
- package/dist/bundle/{decode-YB3ZDTES.js → decode-VLI3MAXE.js} +2 -2
- package/dist/bundle/{dist-A6GKSKFC.js → dist-C7LAAMNF.js} +14 -14
- package/dist/bundle/{echarts-YNGCOYHW.js → echarts-POTU3SHN.js} +2 -2
- package/dist/bundle/{embed-LWNHIRBQ.js → embed-J2DEEEUF.js} +3 -3
- package/dist/bundle/{embedder-2LYD3U37.js → embedder-5N56V7YJ.js} +6 -6
- package/dist/bundle/{first-run-N3HJKGU7.js → first-run-XILZE4PI.js} +5 -5
- package/dist/bundle/{first-screen-4U2DMV3G.js → first-screen-43VLEDWZ.js} +14 -14
- package/dist/bundle/{instructions-GJHHFV64.js → instructions-B7AUZXPL.js} +1 -1
- package/dist/bundle/mail.js +2 -2
- package/dist/bundle/{node-GFOH6FKP.js → node-SZAO6HTA.js} +2 -2
- package/dist/bundle/{node-sqlite-NBXQXBIU.js → node-sqlite-O34FFLRV.js} +2 -2
- package/dist/bundle/{oauth-56EFO5AQ.js → oauth-YYTLIPJT.js} +4 -4
- package/dist/bundle/{open-2V7QZQJP.js → open-SWJGI6H4.js} +1 -1
- package/dist/bundle/{openai-V3SVACVL.js → openai-GYXWCQOV.js} +10 -10
- package/dist/bundle/{process-XVDX4SPD.js → process-GLVWCUMK.js} +1 -1
- package/dist/bundle/{program-JTJB26P3.js → program-HW73TGIF.js} +1725 -1467
- package/dist/bundle/{prompt-YKWAI222.js → prompt-OZLHHGCD.js} +2 -2
- package/dist/bundle/{recognize-PAR66KVM.js → recognize-RDQSGHC5.js} +1 -1
- package/dist/bundle/{remote-CE43TKXC.js → remote-BKU5P3GK.js} +4 -4
- package/dist/bundle/{rerank-M7S7P2TW.js → rerank-EQIXYHKB.js} +4 -4
- package/dist/bundle/{serve-ENPMIV6J.js → serve-S6K5HKWG.js} +6 -6
- package/dist/bundle/{server-MBEZLVKZ.js → server-4VRVHPQC.js} +31 -31
- package/dist/bundle/server-WK6DRJX2.js +63 -0
- package/dist/bundle/{sqlite-runtime-HVGDHBJJ.js → sqlite-runtime-OOE455YM.js} +2 -2
- package/dist/bundle/{state-QZSOSKBD.js → state-OLPOJ2TY.js} +3 -3
- package/dist/bundle/{store-2BUX6LVX.js → store-6AVCPLH4.js} +9 -9
- package/dist/bundle/{store-UJ7SNKXI.js → store-WFV26CWY.js} +30 -12
- package/dist/bundle/store-maintenance-command-S6235I3W.js +52 -0
- package/dist/commands/account.d.ts.map +1 -1
- package/dist/commands/account.js +6 -5
- package/dist/commands/account.js.map +1 -1
- package/dist/commands/context.d.ts +19 -8
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +14 -10
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/folders.js +4 -4
- package/dist/commands/folders.js.map +1 -1
- package/dist/commands/login.d.ts +2 -2
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +3 -5
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/mailbox.d.ts +2 -1
- package/dist/commands/mailbox.d.ts.map +1 -1
- package/dist/commands/mailbox.js.map +1 -1
- package/dist/commands/session-start.d.ts +3 -0
- package/dist/commands/session-start.d.ts.map +1 -0
- package/dist/commands/session-start.js +117 -0
- package/dist/commands/session-start.js.map +1 -0
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +9 -117
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +8 -20
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +49 -26
- package/dist/commands/sync.js.map +1 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -0
- package/dist/config.js.map +1 -1
- package/dist/discovery.d.ts +4 -15
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +19 -92
- package/dist/discovery.js.map +1 -1
- package/dist/mail/backend.d.ts +36 -0
- package/dist/mail/backend.d.ts.map +1 -0
- package/dist/mail/backend.js +2 -0
- package/dist/mail/backend.js.map +1 -0
- package/dist/mail/imap/account.d.ts +5 -0
- package/dist/mail/imap/account.d.ts.map +1 -0
- package/dist/mail/imap/account.js +41 -0
- package/dist/mail/imap/account.js.map +1 -0
- package/dist/mail/imap/connection.d.ts +62 -0
- package/dist/mail/imap/connection.d.ts.map +1 -0
- package/dist/mail/imap/connection.js +188 -0
- package/dist/mail/imap/connection.js.map +1 -0
- package/dist/mail/{imap-errors.d.ts → imap/errors.d.ts} +1 -1
- package/dist/mail/imap/errors.d.ts.map +1 -0
- package/dist/mail/{imap-errors.js → imap/errors.js} +1 -1
- package/dist/mail/imap/errors.js.map +1 -0
- package/dist/mail/imap/index.d.ts +7 -0
- package/dist/mail/imap/index.d.ts.map +1 -0
- package/dist/mail/imap/index.js +11 -0
- package/dist/mail/imap/index.js.map +1 -0
- package/dist/mail/{imap-messages.d.ts → imap/messages.d.ts} +9 -9
- package/dist/mail/imap/messages.d.ts.map +1 -0
- package/dist/mail/imap/messages.js +66 -0
- package/dist/mail/imap/messages.js.map +1 -0
- package/dist/mail/imap/read.d.ts +7 -0
- package/dist/mail/imap/read.d.ts.map +1 -0
- package/dist/mail/imap/read.js +164 -0
- package/dist/mail/imap/read.js.map +1 -0
- package/dist/mail/rethread.d.ts +15 -0
- package/dist/mail/rethread.d.ts.map +1 -0
- package/dist/mail/rethread.js +52 -0
- package/dist/mail/rethread.js.map +1 -0
- package/dist/profile.d.ts +2 -1
- package/dist/profile.d.ts.map +1 -1
- package/dist/profile.js +1 -0
- package/dist/profile.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +8 -1
- package/dist/program.js.map +1 -1
- package/dist/providers.d.ts +126 -26
- package/dist/providers.d.ts.map +1 -1
- package/dist/providers.js +141 -72
- package/dist/providers.js.map +1 -1
- package/dist/secret.d.ts +2 -1
- package/dist/secret.d.ts.map +1 -1
- package/dist/secret.js +1 -0
- package/dist/secret.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -2
- package/skills/mail-cli/SKILL.md +8 -0
- package/dist/bundle/server-JRTHUCVY.js +0 -63
- package/dist/bundle/store-maintenance-command-I7V5C44K.js +0 -52
- package/dist/mail/imap-errors.d.ts.map +0 -1
- package/dist/mail/imap-errors.js.map +0 -1
- package/dist/mail/imap-messages.d.ts.map +0 -1
- package/dist/mail/imap-messages.js +0 -66
- package/dist/mail/imap-messages.js.map +0 -1
- package/dist/mail/imap.d.ts +0 -67
- package/dist/mail/imap.d.ts.map +0 -1
- package/dist/mail/imap.js +0 -348
- package/dist/mail/imap.js.map +0 -1
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
rankingWords,
|
|
32
32
|
useStoredProviders,
|
|
33
33
|
validCounter
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-TLZWUADZ.js";
|
|
35
35
|
import {
|
|
36
36
|
FACT_STATUSES,
|
|
37
37
|
FACT_TYPES,
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
LINK_ORIGINS,
|
|
40
40
|
MEMORY_KINDS,
|
|
41
41
|
MEMORY_SCOPES,
|
|
42
|
+
PRIORITY_LABELS,
|
|
42
43
|
RELATION_KINDS,
|
|
43
44
|
TASK_KINDS,
|
|
44
45
|
TASK_ORIGINS,
|
|
@@ -46,13 +47,19 @@ import {
|
|
|
46
47
|
TASK_TYPES,
|
|
47
48
|
TASK_VERDICTS,
|
|
48
49
|
WORK_TASK_TYPES,
|
|
50
|
+
checkedScore,
|
|
51
|
+
isClosedState,
|
|
52
|
+
legacyPriority,
|
|
49
53
|
linkKind,
|
|
50
|
-
matches
|
|
51
|
-
|
|
54
|
+
matches,
|
|
55
|
+
priorityBand,
|
|
56
|
+
priorityLabel
|
|
57
|
+
} from "./chunk-FX77WAQL.js";
|
|
52
58
|
import {
|
|
53
59
|
CHAT_MESSAGES_READ,
|
|
54
60
|
MEETING_FINDINGS_KIND,
|
|
55
61
|
MeetingError,
|
|
62
|
+
OPERATORS_BY_TYPE,
|
|
56
63
|
QUERY_LIMITS,
|
|
57
64
|
REVIEW_LIMIT,
|
|
58
65
|
aggregateMeetingStats,
|
|
@@ -86,7 +93,7 @@ import {
|
|
|
86
93
|
validateQuery,
|
|
87
94
|
walkQuery,
|
|
88
95
|
zonedMoment
|
|
89
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-C2THROZU.js";
|
|
90
97
|
import {
|
|
91
98
|
DEFAULT_STEMMERS,
|
|
92
99
|
DEFAULT_STEMMERS_VERSION,
|
|
@@ -99,18 +106,18 @@ import {
|
|
|
99
106
|
fold,
|
|
100
107
|
normalize,
|
|
101
108
|
parseStemmers
|
|
102
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-V7NZTJKU.js";
|
|
103
110
|
import {
|
|
104
111
|
DEFAULT_TASK_CATEGORIES,
|
|
105
112
|
sharedConfigPath,
|
|
106
113
|
storedTaskCategories,
|
|
107
114
|
taskCategoriesReader
|
|
108
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-JXYFIUVX.js";
|
|
109
116
|
import {
|
|
110
117
|
PRAGMAS,
|
|
111
118
|
quietSqliteWarning,
|
|
112
119
|
storeCapable
|
|
113
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-K6SIGXRS.js";
|
|
114
121
|
import {
|
|
115
122
|
SQLiteTable,
|
|
116
123
|
TableAliasProxyHandler,
|
|
@@ -135,10 +142,10 @@ import {
|
|
|
135
142
|
sql,
|
|
136
143
|
sqliteTable,
|
|
137
144
|
text
|
|
138
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-O2F54PUO.js";
|
|
139
146
|
import {
|
|
140
147
|
storePath
|
|
141
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-PL6UPJIL.js";
|
|
142
149
|
import {
|
|
143
150
|
array,
|
|
144
151
|
boolean,
|
|
@@ -167,7 +174,7 @@ import {
|
|
|
167
174
|
__name
|
|
168
175
|
} from "./chunk-ZVVMGPBJ.js";
|
|
169
176
|
|
|
170
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
177
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/account-store.js
|
|
171
178
|
var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
|
|
172
179
|
const methods = whole;
|
|
173
180
|
return Object.fromEntries(Object.keys(keyed).map((name) => [
|
|
@@ -183,7 +190,7 @@ var once = /* @__PURE__ */ __name((build) => {
|
|
|
183
190
|
};
|
|
184
191
|
}, "once");
|
|
185
192
|
var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
|
|
186
|
-
const
|
|
193
|
+
const bound5 = /* @__PURE__ */ __name((area) => once(() => bindArea(area(), account)), "bound");
|
|
187
194
|
const ownAttachment = /* @__PURE__ */ __name((attachmentPk) => {
|
|
188
195
|
const pk = owners.accountPk();
|
|
189
196
|
if (pk === void 0 || owners.attachmentAccount(attachmentPk) !== pk)
|
|
@@ -226,9 +233,9 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
|
|
|
226
233
|
return id2 === void 0 ? [] : store.meetings.search(query, { ...filter, accountId: id2 });
|
|
227
234
|
}, "search")
|
|
228
235
|
};
|
|
229
|
-
const accounts2 =
|
|
230
|
-
const chats2 =
|
|
231
|
-
const sync =
|
|
236
|
+
const accounts2 = bound5(areas.accounts);
|
|
237
|
+
const chats2 = bound5(areas.chats);
|
|
238
|
+
const sync = bound5(areas.sync);
|
|
232
239
|
const messages2 = once(() => ({
|
|
233
240
|
...bindArea(areas.messages(), account),
|
|
234
241
|
find: /* @__PURE__ */ __name((filter) => store.messages.find({ ...filter, account }), "find"),
|
|
@@ -245,13 +252,13 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
|
|
|
245
252
|
return store.attachments.keepAttachmentText(attachmentPk, entry2);
|
|
246
253
|
}, "keepAttachmentText")
|
|
247
254
|
}));
|
|
248
|
-
const roster =
|
|
249
|
-
const people2 =
|
|
250
|
-
const conversations2 =
|
|
251
|
-
const vectors =
|
|
252
|
-
const counters =
|
|
253
|
-
const tags =
|
|
254
|
-
const mentions3 =
|
|
255
|
+
const roster = bound5(areas.roster);
|
|
256
|
+
const people2 = bound5(areas.people);
|
|
257
|
+
const conversations2 = bound5(areas.conversations);
|
|
258
|
+
const vectors = bound5(areas.vectors);
|
|
259
|
+
const counters = bound5(areas.counters);
|
|
260
|
+
const tags = bound5(areas.tags);
|
|
261
|
+
const mentions3 = bound5(areas.mentions);
|
|
255
262
|
return {
|
|
256
263
|
account,
|
|
257
264
|
get accounts() {
|
|
@@ -295,7 +302,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
|
|
|
295
302
|
};
|
|
296
303
|
}, "bindAccount");
|
|
297
304
|
|
|
298
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
305
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/search/query.js
|
|
299
306
|
var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
|
|
300
307
|
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");
|
|
301
308
|
var fail = /* @__PURE__ */ __name((message2) => {
|
|
@@ -318,7 +325,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
|
|
|
318
325
|
return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
|
|
319
326
|
}, "sourceOf");
|
|
320
327
|
|
|
321
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
328
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/search/account-list.js
|
|
322
329
|
var ACCOUNT_GROUPS = "accountGroups";
|
|
323
330
|
var ACCOUNT_GROUPS_SETTING = "account_groups";
|
|
324
331
|
var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
|
|
@@ -505,7 +512,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf = (kind3)
|
|
|
505
512
|
return { accounts: [...chosen.values()], skipped };
|
|
506
513
|
}, "fitting");
|
|
507
514
|
|
|
508
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
515
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
|
|
509
516
|
var IndexBuilderOn = class {
|
|
510
517
|
static {
|
|
511
518
|
__name(this, "IndexBuilderOn");
|
|
@@ -700,7 +707,7 @@ function alias(table, alias2) {
|
|
|
700
707
|
}
|
|
701
708
|
__name(alias, "alias");
|
|
702
709
|
|
|
703
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
710
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
|
|
704
711
|
var ENTITY_TABLES = {
|
|
705
712
|
account: "accounts",
|
|
706
713
|
attachment: "attachments",
|
|
@@ -740,7 +747,7 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
|
|
|
740
747
|
return { table, pointer, type, count, known: known2 };
|
|
741
748
|
}).filter(({ count }) => count > 0)), "orphanPointers");
|
|
742
749
|
|
|
743
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
750
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
|
|
744
751
|
var canonicalTags = sqliteTable("canonical_tags", {
|
|
745
752
|
id: integer("id").primaryKey(),
|
|
746
753
|
name: text("name").notNull().unique(),
|
|
@@ -749,7 +756,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
|
|
|
749
756
|
updatedAt: integer("updated_at").notNull()
|
|
750
757
|
});
|
|
751
758
|
|
|
752
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
759
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
|
|
753
760
|
var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
|
|
754
761
|
sourceKey: text("source_key").notNull(),
|
|
755
762
|
collection: text("collection").notNull(),
|
|
@@ -759,13 +766,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
|
|
|
759
766
|
createdAt: integer("created_at").notNull()
|
|
760
767
|
}, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
|
|
761
768
|
|
|
762
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
769
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
|
|
763
770
|
var documentIndexPending = sqliteTable("document_index_pending", {
|
|
764
771
|
id: integer("id").notNull(),
|
|
765
772
|
indexableType: text("indexable_type").notNull()
|
|
766
773
|
}, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
|
|
767
774
|
|
|
768
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
775
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
|
|
769
776
|
var tagRedirects = sqliteTable("tag_redirects", {
|
|
770
777
|
sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
|
|
771
778
|
survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
|
|
@@ -791,7 +798,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
|
|
|
791
798
|
index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
|
|
792
799
|
]);
|
|
793
800
|
|
|
794
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
801
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
|
|
795
802
|
var accounts = sqliteTable("accounts", {
|
|
796
803
|
id: integer("id").primaryKey(),
|
|
797
804
|
provider: text("provider").notNull(),
|
|
@@ -1505,11 +1512,13 @@ var memories = sqliteTable("memories", {
|
|
|
1505
1512
|
scope: text("scope").notNull(),
|
|
1506
1513
|
createdAt: integer("created_at").notNull(),
|
|
1507
1514
|
updatedAt: integer("updated_at").notNull(),
|
|
1508
|
-
deletedAt: integer("deleted_at")
|
|
1515
|
+
deletedAt: integer("deleted_at"),
|
|
1516
|
+
projectId: integer("project_id").references(() => projects.id)
|
|
1509
1517
|
}, (table) => [
|
|
1510
1518
|
index("memories_by_subject_type_subject_id").on(table.subjectType, table.subjectId),
|
|
1511
1519
|
index("memories_by_author_type_author_id").on(table.authorType, table.authorId),
|
|
1512
|
-
index("memories_by_supersedes_id").on(table.supersedesId)
|
|
1520
|
+
index("memories_by_supersedes_id").on(table.supersedesId),
|
|
1521
|
+
index("memories_by_project_id").on(table.projectId)
|
|
1513
1522
|
]);
|
|
1514
1523
|
var memoryIndexPending = sqliteTable("memory_index_pending", {
|
|
1515
1524
|
id: integer("id").notNull(),
|
|
@@ -1864,7 +1873,10 @@ var tasks = sqliteTable("tasks", {
|
|
|
1864
1873
|
closeSuggestedById: integer("close_suggested_by_id"),
|
|
1865
1874
|
closeSuggestedCertainty: real("close_suggested_certainty"),
|
|
1866
1875
|
closeSuggestedReason: text("close_suggested_reason"),
|
|
1867
|
-
closeSuggestedAt: integer("close_suggested_at")
|
|
1876
|
+
closeSuggestedAt: integer("close_suggested_at"),
|
|
1877
|
+
priorityScore: real("priority_score"),
|
|
1878
|
+
agent: text("agent"),
|
|
1879
|
+
revision: integer("revision").notNull().default(1)
|
|
1868
1880
|
}, (table) => [
|
|
1869
1881
|
unique().on(table.projectId, table.number),
|
|
1870
1882
|
index("tasks_by_title_folded").on(table.titleFolded),
|
|
@@ -2287,7 +2299,7 @@ var storeSettings = sqliteTable("store_settings", {
|
|
|
2287
2299
|
at: integer("at").notNull()
|
|
2288
2300
|
});
|
|
2289
2301
|
|
|
2290
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2302
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
|
|
2291
2303
|
var ARMS = [
|
|
2292
2304
|
[
|
|
2293
2305
|
"message",
|
|
@@ -2414,7 +2426,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
|
|
|
2414
2426
|
return recomputed;
|
|
2415
2427
|
}, "drainInvolvementQueue");
|
|
2416
2428
|
|
|
2417
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2429
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/mentions.js
|
|
2418
2430
|
import { domainToUnicode } from "node:url";
|
|
2419
2431
|
|
|
2420
2432
|
// node_modules/.pnpm/psl@1.15.0/node_modules/psl/dist/psl.mjs
|
|
@@ -12436,7 +12448,7 @@ var oa = /* @__PURE__ */ __name((e) => {
|
|
|
12436
12448
|
}, "oa");
|
|
12437
12449
|
var na = { parse: O, get: aa, isValid: oa };
|
|
12438
12450
|
|
|
12439
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12451
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
|
|
12440
12452
|
var LINK = /https?:\/\/(?:(?:docs|drive|sheets|slides)\.google\.com|forms\.gle)(?:[/?#][^\s<>"'`]*)?/gi;
|
|
12441
12453
|
var ID = /^[\w-]{10,}$/;
|
|
12442
12454
|
var trimUrl = /* @__PURE__ */ __name((url) => {
|
|
@@ -12477,7 +12489,7 @@ var googleDocumentLinks = /* @__PURE__ */ __name((text5) => [...text5.matchAll(L
|
|
|
12477
12489
|
return { url, documentId: googleDocumentId(url) };
|
|
12478
12490
|
}), "googleDocumentLinks");
|
|
12479
12491
|
|
|
12480
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12492
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
|
|
12481
12493
|
var PHONE_PLANS = [
|
|
12482
12494
|
{
|
|
12483
12495
|
country: "us",
|
|
@@ -12857,7 +12869,7 @@ var PHONE_PLANS = [
|
|
|
12857
12869
|
}
|
|
12858
12870
|
];
|
|
12859
12871
|
|
|
12860
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12872
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/phones.js
|
|
12861
12873
|
var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
|
|
12862
12874
|
var DEFAULT_PHONE_COUNTRIES = ["ru"];
|
|
12863
12875
|
var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
|
|
@@ -12898,7 +12910,7 @@ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
|
|
|
12898
12910
|
return void 0;
|
|
12899
12911
|
}, "nationalPhone");
|
|
12900
12912
|
|
|
12901
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12913
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/places.js
|
|
12902
12914
|
var BEFORE = [
|
|
12903
12915
|
[/^(?:ул\.?|улиц[аеыу]|улицей)$/iu, "\u0443\u043B\u0438\u0446\u0430"],
|
|
12904
12916
|
[/^(?:пр-т|просп\.?|проспект[аеу]?)$/iu, "\u043F\u0440\u043E\u0441\u043F\u0435\u043A\u0442"],
|
|
@@ -13158,7 +13170,7 @@ var findPlaces = /* @__PURE__ */ __name((text5) => {
|
|
|
13158
13170
|
return found2.sort((a, b) => a.start - b.start);
|
|
13159
13171
|
}, "findPlaces");
|
|
13160
13172
|
|
|
13161
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13173
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/mentions.js
|
|
13162
13174
|
var MENTION_KINDS = ["phone", "email", "url", "document", "person-name", "place"];
|
|
13163
13175
|
var MENTION_VERSIONS = {
|
|
13164
13176
|
phone: 1,
|
|
@@ -13348,7 +13360,7 @@ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE
|
|
|
13348
13360
|
};
|
|
13349
13361
|
}, "typedPhone");
|
|
13350
13362
|
|
|
13351
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13363
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/first-names.js
|
|
13352
13364
|
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";
|
|
13353
13365
|
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";
|
|
13354
13366
|
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";
|
|
@@ -13356,7 +13368,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
|
|
|
13356
13368
|
var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
|
|
13357
13369
|
var NAME_WORDS = WORDS.split(" ");
|
|
13358
13370
|
|
|
13359
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13371
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/person-names.js
|
|
13360
13372
|
var LATIN_TO_CYRILLIC = {
|
|
13361
13373
|
shch: "\u0449",
|
|
13362
13374
|
sch: "\u0449",
|
|
@@ -13564,7 +13576,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text5, stem, taken) => {
|
|
|
13564
13576
|
return found2;
|
|
13565
13577
|
}, "findUnknownNames");
|
|
13566
13578
|
|
|
13567
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13579
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/attachments.js
|
|
13568
13580
|
var NOT_FILES = /* @__PURE__ */ new Set([
|
|
13569
13581
|
"webpage",
|
|
13570
13582
|
"share",
|
|
@@ -13596,7 +13608,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored3, files2) => {
|
|
|
13596
13608
|
});
|
|
13597
13609
|
}, "matchDownloads");
|
|
13598
13610
|
|
|
13599
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13611
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
|
|
13600
13612
|
var QUERY_VERSION = 1;
|
|
13601
13613
|
var QUERY_LIMITS2 = {
|
|
13602
13614
|
...QUERY_LIMITS,
|
|
@@ -13627,7 +13639,7 @@ function exhausted(budget) {
|
|
|
13627
13639
|
}
|
|
13628
13640
|
__name(exhausted, "exhausted");
|
|
13629
13641
|
|
|
13630
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13642
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
|
|
13631
13643
|
var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
|
|
13632
13644
|
var literal2 = /* @__PURE__ */ __name((c) => ({
|
|
13633
13645
|
kind: "char",
|
|
@@ -14027,7 +14039,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
|
|
|
14027
14039
|
return out;
|
|
14028
14040
|
}, "foldRegex");
|
|
14029
14041
|
|
|
14030
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14042
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
|
|
14031
14043
|
var PRESET_VERSION = 1;
|
|
14032
14044
|
var PRESETS = {
|
|
14033
14045
|
password: {
|
|
@@ -14081,7 +14093,7 @@ var PRESETS = {
|
|
|
14081
14093
|
}
|
|
14082
14094
|
};
|
|
14083
14095
|
|
|
14084
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14096
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
|
|
14085
14097
|
var FIELD_VERSION = 2;
|
|
14086
14098
|
var UNITS = {
|
|
14087
14099
|
"": 1,
|
|
@@ -14105,9 +14117,9 @@ var filled = /* @__PURE__ */ __name((node) => {
|
|
|
14105
14117
|
searchError("query.missing-value", node.span);
|
|
14106
14118
|
}, "filled");
|
|
14107
14119
|
var validateSize = /* @__PURE__ */ __name((node) => {
|
|
14108
|
-
for (const
|
|
14109
|
-
if (
|
|
14110
|
-
parseBytes(
|
|
14120
|
+
for (const bound5 of node.operator === "range" ? [node.value, node.upper] : [node.value])
|
|
14121
|
+
if (bound5 !== void 0 && bound5 !== "*")
|
|
14122
|
+
parseBytes(bound5, node.span);
|
|
14111
14123
|
}, "validateSize");
|
|
14112
14124
|
var validateTag = /* @__PURE__ */ __name((node) => {
|
|
14113
14125
|
if (tagOf(node.value) === void 0)
|
|
@@ -14480,8 +14492,8 @@ var MESSAGES = { entity: "message", backend: "sql", fields: QUERY_FIELDS };
|
|
|
14480
14492
|
var NEAR_FIELDS = /* @__PURE__ */ new Set(["text", "exact", "transcript", "content"]);
|
|
14481
14493
|
var validateFields = /* @__PURE__ */ __name((ast) => {
|
|
14482
14494
|
for (const node of walkQuery(ast.root)) {
|
|
14483
|
-
const
|
|
14484
|
-
if (!
|
|
14495
|
+
const field4 = QUERY_FIELDS.find(({ name }) => name === node.field);
|
|
14496
|
+
if (!field4 && ["after", "before"].includes(node.field)) {
|
|
14485
14497
|
const plain2 = ["term", "phrase"].includes(node.operator) && /^[\w:.+-]+$/u.test(node.value);
|
|
14486
14498
|
searchError("legacy_date_field", node.span, plain2 ? `use date${node.field === "after" ? ">=" : "<"}${node.value}` : "use date>=YYYY-MM-DD or date:[a TO b]");
|
|
14487
14499
|
}
|
|
@@ -14489,8 +14501,8 @@ var validateFields = /* @__PURE__ */ __name((ast) => {
|
|
|
14489
14501
|
searchError("query.unsupported-operator", node.span, `"a b"~N takes words: ${[...NEAR_FIELDS].join(", ")}`);
|
|
14490
14502
|
if (node.slop !== void 0 && node.slop > MOST_WORDS_APART)
|
|
14491
14503
|
searchError("query.invalid-number", node.span, `words at most ${MOST_WORDS_APART} apart: "a b"~${MOST_WORDS_APART}`);
|
|
14492
|
-
if (
|
|
14493
|
-
searchError("query.unsupported-operator", node.span, `${
|
|
14504
|
+
if (field4 && node.operator === "wildcard" && !field4.operators.includes("wildcard"))
|
|
14505
|
+
searchError("query.unsupported-operator", node.span, `${field4.name} takes ${field4.operators.join(", ")}`);
|
|
14494
14506
|
}
|
|
14495
14507
|
return validateQuery(ast, MESSAGES, SEARCH_QUERY);
|
|
14496
14508
|
}, "validateFields");
|
|
@@ -14530,16 +14542,16 @@ var validateAst = /* @__PURE__ */ __name((input) => {
|
|
|
14530
14542
|
return validateFields(parsed2.output);
|
|
14531
14543
|
}, "validateAst");
|
|
14532
14544
|
|
|
14533
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14545
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
|
|
14534
14546
|
var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
|
|
14535
14547
|
var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
|
|
14536
14548
|
var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
|
|
14537
14549
|
|
|
14538
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14550
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
|
|
14539
14551
|
var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
|
|
14540
14552
|
var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
|
|
14541
|
-
var linkMatch = /* @__PURE__ */ __name((
|
|
14542
|
-
if (
|
|
14553
|
+
var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
|
|
14554
|
+
if (field4 === "url") {
|
|
14543
14555
|
const value = normalizedValue(typed);
|
|
14544
14556
|
const origin = mail ? trackedOrigin(value) : void 0;
|
|
14545
14557
|
if (origin === void 0)
|
|
@@ -14559,7 +14571,7 @@ var linkMatch = /* @__PURE__ */ __name((field3, typed, mail, mentioned2) => {
|
|
|
14559
14571
|
};
|
|
14560
14572
|
}, "linkMatch");
|
|
14561
14573
|
|
|
14562
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14574
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
|
|
14563
14575
|
var SETTING = "phoneCountries";
|
|
14564
14576
|
var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
|
|
14565
14577
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
|
|
@@ -14590,7 +14602,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
|
|
|
14590
14602
|
return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
|
|
14591
14603
|
}, "valueMatch");
|
|
14592
14604
|
|
|
14593
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14605
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
|
|
14594
14606
|
var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
|
|
14595
14607
|
if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
|
|
14596
14608
|
throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
|
|
@@ -14618,7 +14630,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
|
|
|
14618
14630
|
return 2 * intersection2 / (aa2.size + bb.size);
|
|
14619
14631
|
}, "vocabularySimilarity");
|
|
14620
14632
|
|
|
14621
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14633
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
|
|
14622
14634
|
import { createHash } from "node:crypto";
|
|
14623
14635
|
var folded2 = /* @__PURE__ */ __name((name) => {
|
|
14624
14636
|
try {
|
|
@@ -14684,30 +14696,30 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind3, by, options
|
|
|
14684
14696
|
});
|
|
14685
14697
|
}, "guardTagCreation");
|
|
14686
14698
|
|
|
14687
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14699
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
|
|
14688
14700
|
var invalid = /* @__PURE__ */ __name((message2) => {
|
|
14689
14701
|
throw new CliError("validation_error", message2);
|
|
14690
14702
|
}, "invalid");
|
|
14691
|
-
var record2 = /* @__PURE__ */ __name((value, fields4,
|
|
14703
|
+
var record2 = /* @__PURE__ */ __name((value, fields4, field4) => {
|
|
14692
14704
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
14693
|
-
return invalid(`${
|
|
14705
|
+
return invalid(`${field4} must be an object`);
|
|
14694
14706
|
for (const key2 of Object.keys(value))
|
|
14695
14707
|
if (!fields4.includes(key2))
|
|
14696
|
-
invalid(`unknown ${
|
|
14708
|
+
invalid(`unknown ${field4} field: ${key2}`);
|
|
14697
14709
|
return value;
|
|
14698
14710
|
}, "record");
|
|
14699
|
-
var tagId = /* @__PURE__ */ __name((value,
|
|
14711
|
+
var tagId = /* @__PURE__ */ __name((value, field4) => {
|
|
14700
14712
|
if (typeof value !== "string" || value.length > 16 || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
14701
|
-
return invalid(`${
|
|
14713
|
+
return invalid(`${field4} must be a positive canonical tag id`);
|
|
14702
14714
|
return value;
|
|
14703
14715
|
}, "tagId");
|
|
14704
14716
|
var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
|
|
14705
14717
|
const input = record2(snapshot2, ["complete", "tags", "redirects"], "snapshot");
|
|
14706
14718
|
if (input.complete !== true)
|
|
14707
14719
|
invalid("snapshot.complete must be true; partial tag graphs cannot resolve labels");
|
|
14708
|
-
for (const
|
|
14709
|
-
if (!Array.isArray(input[
|
|
14710
|
-
invalid(`snapshot.${
|
|
14720
|
+
for (const field4 of ["tags", "redirects"])
|
|
14721
|
+
if (!Array.isArray(input[field4]) || input[field4].length > 4096)
|
|
14722
|
+
invalid(`snapshot.${field4} must be an array of at most 4096 rows`);
|
|
14711
14723
|
const ids = /* @__PURE__ */ new Set();
|
|
14712
14724
|
for (const [index2, value] of snapshot2.tags.entries()) {
|
|
14713
14725
|
const row2 = record2(value, ["id", "kind"], `tags[${index2}]`);
|
|
@@ -14761,7 +14773,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
|
|
|
14761
14773
|
};
|
|
14762
14774
|
}, "createTagRedirectIndex");
|
|
14763
14775
|
|
|
14764
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14776
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
|
|
14765
14777
|
var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
|
|
14766
14778
|
const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
|
|
14767
14779
|
if (!row2)
|
|
@@ -14789,7 +14801,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
|
|
|
14789
14801
|
return snapshot2;
|
|
14790
14802
|
}, "tagRedirectSnapshot");
|
|
14791
14803
|
|
|
14792
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14804
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
|
|
14793
14805
|
import { createHash as createHash2 } from "node:crypto";
|
|
14794
14806
|
var TASK_KEY_PREFIXES = {
|
|
14795
14807
|
question: "Q",
|
|
@@ -14817,7 +14829,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
|
|
|
14817
14829
|
return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
|
|
14818
14830
|
}, "taskAccountOf");
|
|
14819
14831
|
|
|
14820
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14832
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
|
|
14821
14833
|
var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
|
|
14822
14834
|
var REFERABLE = {
|
|
14823
14835
|
note: { tombstone: true },
|
|
@@ -14975,7 +14987,7 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
|
|
|
14975
14987
|
}, "taskIdOf");
|
|
14976
14988
|
var canonicalThingReference = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith("meeting:") ? canonicalMeetingReference(reference2) : canonicalReference(reference2), "canonicalThingReference");
|
|
14977
14989
|
|
|
14978
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14990
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
|
|
14979
14991
|
var toMs = /* @__PURE__ */ __name((iso11) => {
|
|
14980
14992
|
if (iso11 === null || iso11 === void 0)
|
|
14981
14993
|
return null;
|
|
@@ -14989,7 +15001,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
|
|
|
14989
15001
|
var DELIVERY = { delivered: 1, read: 2 };
|
|
14990
15002
|
var deliveryOf = /* @__PURE__ */ __name((stored3) => stored3 === DELIVERY.read ? "read" : stored3 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
|
|
14991
15003
|
|
|
14992
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15004
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
|
|
14993
15005
|
var TAG_KINDS = ["tag", "topic"];
|
|
14994
15006
|
var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
|
|
14995
15007
|
var TAG_TYPE = {
|
|
@@ -15057,12 +15069,19 @@ var createTag = /* @__PURE__ */ __name((context, name, kind3, by, options = {})
|
|
|
15057
15069
|
var ensureTag = /* @__PURE__ */ __name((context, name) => {
|
|
15058
15070
|
return canonicalTagNamed(context.database, name) ?? createTag(context, name, "tag", "owner");
|
|
15059
15071
|
}, "ensureTag");
|
|
15072
|
+
var taskTagsChanged = /* @__PURE__ */ __name((context, thing, changes, author) => {
|
|
15073
|
+
if (thing.type !== "task" || [...changes.added ?? [], ...changes.removed ?? []].length === 0)
|
|
15074
|
+
return;
|
|
15075
|
+
const at = context.now();
|
|
15076
|
+
context.database.prepare("UPDATE tasks SET updated_at = ? WHERE id = ?").run(at, thing.id);
|
|
15077
|
+
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);
|
|
15078
|
+
}, "taskTagsChanged");
|
|
15060
15079
|
var addTags = /* @__PURE__ */ __name((context, thing, tags, source2 = "owner", author) => {
|
|
15061
15080
|
const { database, now: now2 } = context;
|
|
15062
15081
|
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");
|
|
15063
15082
|
const claim3 = database.prepare("UPDATE taggings SET source = 'owner', updated_at = ? WHERE tag_id = ? AND taggable_type = ? AND taggable_id = ? AND source <> 'owner'");
|
|
15064
15083
|
const at = now2();
|
|
15065
|
-
|
|
15084
|
+
const fresh = tags.filter((name) => {
|
|
15066
15085
|
const tag2 = ensureTag(context, name);
|
|
15067
15086
|
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);
|
|
15068
15087
|
if (held.some((row2) => row2.source === source2 && row2.author_type === (author?.type ?? null) && row2.author_id === (author?.id ?? null)))
|
|
@@ -15072,10 +15091,13 @@ var addTags = /* @__PURE__ */ __name((context, thing, tags, source2 = "owner", a
|
|
|
15072
15091
|
claim3.run(at, tag2.id, thing.type, thing.id);
|
|
15073
15092
|
return added && held.length === 0;
|
|
15074
15093
|
});
|
|
15094
|
+
taskTagsChanged(context, thing, { added: fresh }, author);
|
|
15095
|
+
return fresh;
|
|
15075
15096
|
}, "addTags");
|
|
15076
|
-
var removeTags = /* @__PURE__ */ __name((
|
|
15097
|
+
var removeTags = /* @__PURE__ */ __name((context, thing, tags, source2) => {
|
|
15098
|
+
const { database } = context;
|
|
15077
15099
|
const remove = database.prepare("DELETE FROM taggings WHERE tag_id=? AND taggable_type=? AND taggable_id=?");
|
|
15078
|
-
|
|
15100
|
+
const removed = tags.filter((name) => {
|
|
15079
15101
|
const tag2 = canonicalTagNamed(database, name);
|
|
15080
15102
|
if (!tag2)
|
|
15081
15103
|
return false;
|
|
@@ -15105,6 +15127,8 @@ var removeTags = /* @__PURE__ */ __name(({ database }, thing, tags, source2) =>
|
|
|
15105
15127
|
}
|
|
15106
15128
|
return changed;
|
|
15107
15129
|
});
|
|
15130
|
+
taskTagsChanged(context, thing, { removed });
|
|
15131
|
+
return removed;
|
|
15108
15132
|
}, "removeTags");
|
|
15109
15133
|
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");
|
|
15110
15134
|
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");
|
|
@@ -15180,7 +15204,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
|
|
|
15180
15204
|
return result;
|
|
15181
15205
|
}, "tagsOf");
|
|
15182
15206
|
|
|
15183
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15207
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
|
|
15184
15208
|
var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
|
|
15185
15209
|
var SPEECH = speech("att");
|
|
15186
15210
|
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");
|
|
@@ -15217,8 +15241,8 @@ var wordMatch = /* @__PURE__ */ __name((corpus, match) => ({
|
|
|
15217
15241
|
exact: true,
|
|
15218
15242
|
fts: match
|
|
15219
15243
|
}), "wordMatch");
|
|
15220
|
-
var tooManyWords = /* @__PURE__ */ __name(({ field:
|
|
15221
|
-
const term = `${
|
|
15244
|
+
var tooManyWords = /* @__PURE__ */ __name(({ field: field4, operator, value, span }, alone) => {
|
|
15245
|
+
const term = `${field4}:${operator === "regex" ? `/${value}/` : value}`;
|
|
15222
15246
|
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`, {
|
|
15223
15247
|
reason: "query.too-large",
|
|
15224
15248
|
budget: "term expansions",
|
|
@@ -15430,13 +15454,13 @@ var mentions2 = /* @__PURE__ */ __name((node, scope3) => {
|
|
|
15430
15454
|
searchError("query.invalid-reference", node.span);
|
|
15431
15455
|
return always(mentioned(scope3, `mn.status = 'linked' AND (${target[0]})`, target[1]));
|
|
15432
15456
|
}, "mentions");
|
|
15433
|
-
var link = /* @__PURE__ */ __name((
|
|
15434
|
-
...linkMatch(
|
|
15457
|
+
var link = /* @__PURE__ */ __name((field4) => ({ value }, scope3) => always({
|
|
15458
|
+
...linkMatch(field4, value, scope3.mail, (where, params) => mentioned(scope3, where, params)),
|
|
15435
15459
|
exact: true
|
|
15436
15460
|
}), "link");
|
|
15437
|
-
var found = /* @__PURE__ */ __name(({ field:
|
|
15438
|
-
const match =
|
|
15439
|
-
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'`, [
|
|
15461
|
+
var found = /* @__PURE__ */ __name(({ field: field4, value }, scope3) => {
|
|
15462
|
+
const match = field4 === "domain" ? void 0 : valueMatch(scope3.database, value);
|
|
15463
|
+
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]));
|
|
15440
15464
|
}, "found");
|
|
15441
15465
|
var tag = /* @__PURE__ */ __name((node, { corpus, database }) => {
|
|
15442
15466
|
const selected = tagOf(node.value);
|
|
@@ -15535,7 +15559,7 @@ var FIELD_COMPILERS = {
|
|
|
15535
15559
|
subject
|
|
15536
15560
|
};
|
|
15537
15561
|
|
|
15538
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15562
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
|
|
15539
15563
|
var placeOf = /* @__PURE__ */ __name((database) => {
|
|
15540
15564
|
const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
|
|
15541
15565
|
const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
|
|
@@ -15551,7 +15575,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
|
|
|
15551
15575
|
};
|
|
15552
15576
|
}, "placeOf");
|
|
15553
15577
|
|
|
15554
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15578
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
|
|
15555
15579
|
var DRAIN_ON_WRITE = 500;
|
|
15556
15580
|
var METHOD = "rules";
|
|
15557
15581
|
var telegramLink = /* @__PURE__ */ __name((database) => {
|
|
@@ -15714,7 +15738,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
|
|
|
15714
15738
|
return queued.length;
|
|
15715
15739
|
}, "drainMentions");
|
|
15716
15740
|
|
|
15717
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15741
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
|
|
15718
15742
|
var indexRow = /* @__PURE__ */ __name((database, name) => {
|
|
15719
15743
|
const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
|
|
15720
15744
|
if (!exists2)
|
|
@@ -15722,7 +15746,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
|
|
|
15722
15746
|
return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
|
|
15723
15747
|
}, "indexRow");
|
|
15724
15748
|
|
|
15725
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15749
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
|
|
15726
15750
|
var INDEX = "message_stems";
|
|
15727
15751
|
var SETTING2 = "searchStemmers";
|
|
15728
15752
|
var DRAIN_ON_WRITE2 = 500;
|
|
@@ -15844,7 +15868,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
|
|
|
15844
15868
|
};
|
|
15845
15869
|
}, "stemmerCache");
|
|
15846
15870
|
|
|
15847
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15871
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
|
|
15848
15872
|
var SQLITE_BUSY = 5;
|
|
15849
15873
|
var pause = new Int32Array(new SharedArrayBuffer(4));
|
|
15850
15874
|
var isBusy = /* @__PURE__ */ __name((error) => {
|
|
@@ -15939,7 +15963,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
|
|
|
15939
15963
|
}
|
|
15940
15964
|
}, "read");
|
|
15941
15965
|
|
|
15942
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15966
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
|
|
15943
15967
|
var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
|
|
15944
15968
|
coalesce(CASE k.chunkable_type
|
|
15945
15969
|
WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
|
|
@@ -16081,7 +16105,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
|
|
|
16081
16105
|
}, "dropUnusedVectors");
|
|
16082
16106
|
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");
|
|
16083
16107
|
|
|
16084
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16108
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
|
|
16085
16109
|
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({
|
|
16086
16110
|
target: [accounts.provider, accounts.externalId],
|
|
16087
16111
|
set: {
|
|
@@ -16187,7 +16211,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
|
|
|
16187
16211
|
AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
|
|
16188
16212
|
}, "dropOrphanPeople");
|
|
16189
16213
|
|
|
16190
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16214
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
|
|
16191
16215
|
var FOLDED = [
|
|
16192
16216
|
{ table: "tasks", column: "title" },
|
|
16193
16217
|
{ table: "tasks", column: "close_reason" },
|
|
@@ -16224,7 +16248,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
|
16224
16248
|
return filled2;
|
|
16225
16249
|
}, "fillFolded");
|
|
16226
16250
|
|
|
16227
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16251
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
|
|
16228
16252
|
import { createHash as createHash3 } from "node:crypto";
|
|
16229
16253
|
var CHUNK_CHARS = 1200;
|
|
16230
16254
|
var CHUNK_OVERLAP = 150;
|
|
@@ -16329,7 +16353,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
|
|
|
16329
16353
|
return chunks2;
|
|
16330
16354
|
}, "cutChunks");
|
|
16331
16355
|
|
|
16332
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16356
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/search/task-signature.js
|
|
16333
16357
|
var DAY = 864e5;
|
|
16334
16358
|
var CURRENCY = [
|
|
16335
16359
|
[/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
|
|
@@ -16446,7 +16470,7 @@ var dueDayOf = /* @__PURE__ */ __name((text5, createdMs) => {
|
|
|
16446
16470
|
return best?.day ?? null;
|
|
16447
16471
|
}, "dueDayOf");
|
|
16448
16472
|
|
|
16449
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16473
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
|
|
16450
16474
|
var DAY2 = 864e5;
|
|
16451
16475
|
var STOP_WORDS = new Set([
|
|
16452
16476
|
// Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
|
|
@@ -16549,7 +16573,7 @@ var LEVEL_REASONS = {
|
|
|
16549
16573
|
person: { same: "same person", different: "different person" },
|
|
16550
16574
|
amount: { equal: "same amount", different: "different amount" }
|
|
16551
16575
|
};
|
|
16552
|
-
var weightOf = /* @__PURE__ */ __name((
|
|
16576
|
+
var weightOf = /* @__PURE__ */ __name((field4, level) => TASK_SIMILARITY_WEIGHTS[field4][level].weight, "weightOf");
|
|
16553
16577
|
var plural = /* @__PURE__ */ __name((count, word) => `${count} ${word}${count === 1 ? "" : "s"}`, "plural");
|
|
16554
16578
|
var bandOf = /* @__PURE__ */ __name((score) => score >= TASK_SIMILARITY_BANDS.likely ? "likely" : score >= TASK_SIMILARITY_BANDS.maybe ? "maybe" : "different", "bandOf");
|
|
16555
16579
|
var compareTasks = /* @__PURE__ */ __name((a, b, { replyChain = false } = {}) => {
|
|
@@ -16601,7 +16625,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
|
|
|
16601
16625
|
...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
|
|
16602
16626
|
})).sort((a, b) => b.score - a.score), "rankCandidates");
|
|
16603
16627
|
|
|
16604
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16628
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
|
|
16605
16629
|
var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
|
|
16606
16630
|
r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
|
|
16607
16631
|
JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
|
|
@@ -16732,7 +16756,7 @@ var dot = /* @__PURE__ */ __name((query, blob2) => {
|
|
|
16732
16756
|
}, "dot");
|
|
16733
16757
|
var nearestChunks = /* @__PURE__ */ __name((context, accountPk2, filter) => {
|
|
16734
16758
|
const { orm } = context;
|
|
16735
|
-
const { chatKey, model, since, limit, query, exclude, conversations: conversations2, scope: scope3, projectId, before: before2, personId } = filter;
|
|
16759
|
+
const { chatKey, model, since, limit, query, exclude, conversations: conversations2, scope: scope3, projectId: projectId2, before: before2, personId } = filter;
|
|
16736
16760
|
const rows = /* @__PURE__ */ __name((page3) => orm.all(
|
|
16737
16761
|
// CROSS JOIN keeps the chunks first, so each page walks their key; led by the vectors, SQLite re-read and
|
|
16738
16762
|
// sorted every one of them per page — 1.3 s against 140 ms at 42k chunks (bench/embeddings/README.md).
|
|
@@ -16745,7 +16769,7 @@ var nearestChunks = /* @__PURE__ */ __name((context, accountPk2, filter) => {
|
|
|
16745
16769
|
JOIN embeddings v ON v.model = ${model} AND v.content_hash = k.content_hash
|
|
16746
16770
|
WHERE k.chunkable_type = 'conversation' AND ch.account_id = ${accountPk2}
|
|
16747
16771
|
${scope3 === void 0 ? sql`` : sql`AND k.scope=${scope3}`}
|
|
16748
|
-
${
|
|
16772
|
+
${projectId2 === void 0 ? sql`` : sql`AND k.project_id=${projectId2}`}
|
|
16749
16773
|
${before2 === void 0 ? sql`` : sql`AND k.occurred_at < ${before2}`}
|
|
16750
16774
|
${personId === void 0 ? sql`` : sql`AND EXISTS (SELECT 1 FROM conversation_messages pcm JOIN messages pm ON pm.id=pcm.message_id JOIN identity_links pil ON pil.identity_id=pm.sender_identity_id WHERE pcm.conversation_id=c.id AND pil.person_id=${personId})`}
|
|
16751
16775
|
${chatKey === void 0 ? sql`AND ch.searchable = 1` : sql`AND c.chat_id = ${chatKey}`}
|
|
@@ -16774,7 +16798,7 @@ var nearestChunks = /* @__PURE__ */ __name((context, accountPk2, filter) => {
|
|
|
16774
16798
|
}, "keepBest");
|
|
16775
16799
|
const ranked = /* @__PURE__ */ __name((found2) => found2.sort((a, b) => b.score - a.score).slice(0, limit), "ranked");
|
|
16776
16800
|
const plain2 = /* @__PURE__ */ __name((found2) => found2.map(({ id: _, ...chunk }) => chunk), "plain");
|
|
16777
|
-
const indexable = personId === void 0 &&
|
|
16801
|
+
const indexable = personId === void 0 && projectId2 === void 0 && scope3 === void 0 && conversations2 === void 0;
|
|
16778
16802
|
const indexed = indexable && searchIndex(context.database, model, {
|
|
16779
16803
|
kind: "conversation",
|
|
16780
16804
|
account: accountPk2,
|
|
@@ -16872,7 +16896,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
|
|
|
16872
16896
|
};
|
|
16873
16897
|
}, "readiness");
|
|
16874
16898
|
|
|
16875
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16899
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
|
|
16876
16900
|
var DOCUMENT_PICTURE = "document_picture";
|
|
16877
16901
|
var SCAN_PAGE2 = 5e3;
|
|
16878
16902
|
var idOf = /* @__PURE__ */ __name((ref3) => {
|
|
@@ -16935,7 +16959,7 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
16935
16959
|
}, "nearestPictures")
|
|
16936
16960
|
}), "documentPicturesOver");
|
|
16937
16961
|
|
|
16938
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16962
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
|
|
16939
16963
|
var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
|
|
16940
16964
|
const literal4 = escaped2 ?? plain2 ?? "";
|
|
16941
16965
|
return wildcard ?? (/[*?[]/u.test(literal4) ? `[${literal4}]` : literal4);
|
|
@@ -17000,7 +17024,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
|
|
|
17000
17024
|
var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
|
|
17001
17025
|
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");
|
|
17002
17026
|
|
|
17003
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17027
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
|
|
17004
17028
|
var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
|
|
17005
17029
|
var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
|
|
17006
17030
|
var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
|
|
@@ -17090,7 +17114,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
|
|
|
17090
17114
|
});
|
|
17091
17115
|
}, "linkMeeting");
|
|
17092
17116
|
|
|
17093
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17117
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
|
|
17094
17118
|
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), ''))";
|
|
17095
17119
|
var UNSEARCHED_EVENT_TYPES = [
|
|
17096
17120
|
"working-location",
|
|
@@ -17165,7 +17189,7 @@ var holdingText = /* @__PURE__ */ __name((type, column2, search2) => {
|
|
|
17165
17189
|
if ([...text5].length < 3)
|
|
17166
17190
|
throw new CliError("validation_error", "search needs at least three characters");
|
|
17167
17191
|
const queued = `SELECT id FROM ${type}_index_pending WHERE indexable_type = '${type}'`;
|
|
17168
|
-
const state = /* @__PURE__ */ __name((
|
|
17192
|
+
const state = /* @__PURE__ */ __name((field4) => `(SELECT ${field4} FROM search_index_state WHERE name = '${type}_trigrams')`, "state");
|
|
17169
17193
|
return {
|
|
17170
17194
|
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)`,
|
|
17171
17195
|
params: [`"${text5.replaceAll('"', '""')}"`, search2]
|
|
@@ -17320,7 +17344,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
|
|
|
17320
17344
|
return true;
|
|
17321
17345
|
}, "resetNoteIndex");
|
|
17322
17346
|
|
|
17323
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17347
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
|
|
17324
17348
|
var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
|
|
17325
17349
|
var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
|
|
17326
17350
|
for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
|
|
@@ -17339,7 +17363,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
|
|
|
17339
17363
|
}
|
|
17340
17364
|
}, "resolvePersonLinks");
|
|
17341
17365
|
|
|
17342
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17366
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
|
|
17343
17367
|
var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
|
|
17344
17368
|
var prepare = /* @__PURE__ */ __name((orm) => ({
|
|
17345
17369
|
find: orm.select({
|
|
@@ -17564,7 +17588,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
|
|
|
17564
17588
|
}, "meetingIdentityPk");
|
|
17565
17589
|
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");
|
|
17566
17590
|
|
|
17567
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17591
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
|
|
17568
17592
|
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");
|
|
17569
17593
|
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");
|
|
17570
17594
|
var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
|
|
@@ -17844,7 +17868,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
|
|
|
17844
17868
|
}
|
|
17845
17869
|
}, "replaceAutoTags");
|
|
17846
17870
|
|
|
17847
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17871
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
|
|
17848
17872
|
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");
|
|
17849
17873
|
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;
|
|
17850
17874
|
var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
|
|
@@ -17925,7 +17949,7 @@ var mailCore = /* @__PURE__ */ __name((body2, earlier) => {
|
|
|
17925
17949
|
return withoutSignOff(withoutGreeting(kept)).join("\n").trim();
|
|
17926
17950
|
}, "mailCore");
|
|
17927
17951
|
|
|
17928
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17952
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
|
|
17929
17953
|
var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
|
|
17930
17954
|
var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
|
|
17931
17955
|
k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
|
|
@@ -18035,7 +18059,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
|
|
|
18035
18059
|
return emails3 + threads;
|
|
18036
18060
|
}, "drainEmailIndex");
|
|
18037
18061
|
|
|
18038
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18062
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
|
|
18039
18063
|
var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
|
|
18040
18064
|
SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
|
|
18041
18065
|
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,
|
|
@@ -18081,7 +18105,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
|
|
|
18081
18105
|
leave.run(emailId, Number(box.id), emailId, Number(box.id));
|
|
18082
18106
|
}, "forgetLocations");
|
|
18083
18107
|
|
|
18084
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18108
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
|
|
18085
18109
|
var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
|
|
18086
18110
|
emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
|
|
18087
18111
|
last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
|
|
@@ -18131,7 +18155,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
|
|
|
18131
18155
|
return threads.length;
|
|
18132
18156
|
}, "markEmailsRestored");
|
|
18133
18157
|
|
|
18134
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18158
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
|
|
18135
18159
|
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");
|
|
18136
18160
|
var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
|
|
18137
18161
|
var ruleOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -18198,7 +18222,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
|
|
|
18198
18222
|
}
|
|
18199
18223
|
}), "mailRulesOver");
|
|
18200
18224
|
|
|
18201
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18225
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
|
|
18202
18226
|
var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
|
|
18203
18227
|
database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
|
|
18204
18228
|
VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
|
|
@@ -18206,7 +18230,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
|
|
|
18206
18230
|
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);
|
|
18207
18231
|
}, "reviewLink");
|
|
18208
18232
|
|
|
18209
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18233
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
|
|
18210
18234
|
function checkMeetingCancelled(signal) {
|
|
18211
18235
|
if (!signal?.aborted)
|
|
18212
18236
|
return;
|
|
@@ -18217,7 +18241,7 @@ function checkMeetingCancelled(signal) {
|
|
|
18217
18241
|
}
|
|
18218
18242
|
__name(checkMeetingCancelled, "checkMeetingCancelled");
|
|
18219
18243
|
|
|
18220
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18244
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
|
|
18221
18245
|
var meetingOf = /* @__PURE__ */ __name((row2) => ({
|
|
18222
18246
|
id: Number(row2.id),
|
|
18223
18247
|
accountId: Number(row2.account_id),
|
|
@@ -18267,7 +18291,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
|
|
|
18267
18291
|
createdAt: Number(row2.created_at)
|
|
18268
18292
|
}), "transcriptRowOf");
|
|
18269
18293
|
|
|
18270
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18294
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
|
|
18271
18295
|
var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
|
|
18272
18296
|
var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
|
|
18273
18297
|
var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
|
|
@@ -18434,7 +18458,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
18434
18458
|
}
|
|
18435
18459
|
}), "meetingReadsOver");
|
|
18436
18460
|
|
|
18437
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18461
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
|
|
18438
18462
|
var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
|
|
18439
18463
|
const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
|
|
18440
18464
|
const params = [input.accountId];
|
|
@@ -18477,7 +18501,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
|
|
|
18477
18501
|
return { clauses, params };
|
|
18478
18502
|
}, "meetingSelectionSql");
|
|
18479
18503
|
|
|
18480
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18504
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
|
|
18481
18505
|
var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
18482
18506
|
async meetingChatLines(input) {
|
|
18483
18507
|
checkMeetingCancelled(input.signal);
|
|
@@ -18505,7 +18529,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
18505
18529
|
}
|
|
18506
18530
|
}), "meetingChatLinesOver");
|
|
18507
18531
|
|
|
18508
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18532
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
|
|
18509
18533
|
var MESSAGE_FIELDS = {
|
|
18510
18534
|
pk: messages.id,
|
|
18511
18535
|
nativeId: messages.externalId,
|
|
@@ -18672,7 +18696,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
|
|
|
18672
18696
|
storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
|
|
18673
18697
|
}), "chatActivity");
|
|
18674
18698
|
|
|
18675
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18699
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
|
|
18676
18700
|
var HIT_FIELDS = {
|
|
18677
18701
|
...MESSAGE_FIELDS,
|
|
18678
18702
|
chatTitle: sql`${chats.title}`.as("chat_title"),
|
|
@@ -18771,7 +18795,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
|
|
|
18771
18795
|
};
|
|
18772
18796
|
}, "directReplies");
|
|
18773
18797
|
|
|
18774
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18798
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
|
|
18775
18799
|
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");
|
|
18776
18800
|
var required = /* @__PURE__ */ __name((context, ref3) => {
|
|
18777
18801
|
const found2 = identityRow(context, ref3);
|
|
@@ -18902,7 +18926,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
|
|
|
18902
18926
|
}, "mentioning");
|
|
18903
18927
|
var escaped = /* @__PURE__ */ __name((text5) => text5.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
|
|
18904
18928
|
|
|
18905
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18929
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
|
|
18906
18930
|
var missing2 = /* @__PURE__ */ __name(() => {
|
|
18907
18931
|
throw new CliError("not_found", "Meeting, participant or selected target not found");
|
|
18908
18932
|
}, "missing");
|
|
@@ -19024,7 +19048,7 @@ function meetingContextLinksOver(context) {
|
|
|
19024
19048
|
}
|
|
19025
19049
|
__name(meetingContextLinksOver, "meetingContextLinksOver");
|
|
19026
19050
|
|
|
19027
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19051
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
|
|
19028
19052
|
var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
|
|
19029
19053
|
var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
|
|
19030
19054
|
var summaryOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -19053,7 +19077,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
19053
19077
|
return row2 ? summaryText(summaryOf(row2)) : null;
|
|
19054
19078
|
}, "indexedText");
|
|
19055
19079
|
|
|
19056
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19080
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
|
|
19057
19081
|
var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
|
|
19058
19082
|
var meetingCurrentIndexRows = `
|
|
19059
19083
|
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
|
|
@@ -19084,7 +19108,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
19084
19108
|
}, "invalidateMeetingStems");
|
|
19085
19109
|
var meetingStemmableText = /* @__PURE__ */ __name((text5) => text5.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
|
|
19086
19110
|
|
|
19087
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19111
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
|
|
19088
19112
|
function meetingHitIndexOver({ database, now: now2 }) {
|
|
19089
19113
|
return {
|
|
19090
19114
|
async indexSearch(original) {
|
|
@@ -19152,10 +19176,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
|
|
|
19152
19176
|
}
|
|
19153
19177
|
__name(meetingHitIndexOver, "meetingHitIndexOver");
|
|
19154
19178
|
|
|
19155
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19179
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
|
|
19156
19180
|
import { createHash as createHash4 } from "node:crypto";
|
|
19157
19181
|
|
|
19158
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19182
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/search/trigrams.js
|
|
19159
19183
|
var trigrams = /* @__PURE__ */ __name((term) => {
|
|
19160
19184
|
const padded = ` ${term} `;
|
|
19161
19185
|
const pieces = /* @__PURE__ */ new Set();
|
|
@@ -19164,7 +19188,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
|
|
|
19164
19188
|
return [...pieces];
|
|
19165
19189
|
}, "trigrams");
|
|
19166
19190
|
|
|
19167
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19191
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/search/correct.js
|
|
19168
19192
|
var SHORTEST_CORRECTION = 3;
|
|
19169
19193
|
var maxEdits = /* @__PURE__ */ __name((word) => word.length <= 4 ? 1 : 2, "maxEdits");
|
|
19170
19194
|
var editDistance = /* @__PURE__ */ __name((a, b, max) => {
|
|
@@ -19211,7 +19235,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
|
|
|
19211
19235
|
return corrections;
|
|
19212
19236
|
}, "correctWords");
|
|
19213
19237
|
|
|
19214
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19238
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/search/garbled.js
|
|
19215
19239
|
var SHORTEST_GARBLED = 4;
|
|
19216
19240
|
var MOST_WIDENED = 64;
|
|
19217
19241
|
var plain = /* @__PURE__ */ __name((word) => word.replaceAll("\u044D", "\u0435"), "plain");
|
|
@@ -19303,7 +19327,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
|
|
|
19303
19327
|
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));
|
|
19304
19328
|
}, "widenWords");
|
|
19305
19329
|
|
|
19306
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19330
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
|
|
19307
19331
|
import { readFileSync } from "node:fs";
|
|
19308
19332
|
var loaded;
|
|
19309
19333
|
var dictionary = /* @__PURE__ */ __name(() => {
|
|
@@ -19362,7 +19386,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word) => {
|
|
|
19362
19386
|
return false;
|
|
19363
19387
|
}, "knownRussianWord");
|
|
19364
19388
|
|
|
19365
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19389
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
|
|
19366
19390
|
var WORD2 = /[\p{L}\p{N}\p{M}]+/gu;
|
|
19367
19391
|
var MOST_WORDS = 128;
|
|
19368
19392
|
var quote = /* @__PURE__ */ __name((word) => `"${word.replaceAll('"', '""')}"`, "quote");
|
|
@@ -19589,7 +19613,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text5, stemmer) => {
|
|
|
19589
19613
|
return check3(tree);
|
|
19590
19614
|
}, "matchMeetingText");
|
|
19591
19615
|
|
|
19592
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19616
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
|
|
19593
19617
|
var fail3 = /* @__PURE__ */ __name((message2) => {
|
|
19594
19618
|
throw new CliError("validation_error", message2);
|
|
19595
19619
|
}, "fail");
|
|
@@ -19766,7 +19790,7 @@ function meetingHitSearchOver({ database }) {
|
|
|
19766
19790
|
}
|
|
19767
19791
|
__name(meetingHitSearchOver, "meetingHitSearchOver");
|
|
19768
19792
|
|
|
19769
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19793
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
|
|
19770
19794
|
import { createHash as createHash5 } from "node:crypto";
|
|
19771
19795
|
var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
|
|
19772
19796
|
if (value === void 0)
|
|
@@ -19856,7 +19880,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
|
|
|
19856
19880
|
}
|
|
19857
19881
|
}), "meetingParticipantSearchOver");
|
|
19858
19882
|
|
|
19859
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19883
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
|
|
19860
19884
|
var preparationQueries = {
|
|
19861
19885
|
participants: {
|
|
19862
19886
|
fields: "p.id, p.identity_id, p.display_name, l.person_id",
|
|
@@ -19906,7 +19930,7 @@ var preparationQueries = {
|
|
|
19906
19930
|
}
|
|
19907
19931
|
};
|
|
19908
19932
|
|
|
19909
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19933
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
|
|
19910
19934
|
var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
19911
19935
|
async preparationContext(original) {
|
|
19912
19936
|
const input = validateMeetingPreparationContext(original);
|
|
@@ -19920,7 +19944,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
19920
19944
|
let total = 0;
|
|
19921
19945
|
for (const key2 of keys) {
|
|
19922
19946
|
const query = preparationQueries[key2];
|
|
19923
|
-
const bytes3 = query.text.map((
|
|
19947
|
+
const bytes3 = query.text.map((field4) => `coalesce(length(CAST(${field4} AS BLOB)),0)`).join("+");
|
|
19924
19948
|
const probe = database.prepare(`SELECT coalesce(sum(read_bytes),0) AS read_bytes FROM (SELECT ${bytes3} AS read_bytes ${query.from})`).get(...params(key2));
|
|
19925
19949
|
total += Number(probe?.read_bytes);
|
|
19926
19950
|
if (!Number.isSafeInteger(total) || total < 0 || total > maxReadBytes)
|
|
@@ -19947,7 +19971,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
19947
19971
|
}
|
|
19948
19972
|
}), "meetingPreparationContextOver");
|
|
19949
19973
|
|
|
19950
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19974
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
|
|
19951
19975
|
var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
|
|
19952
19976
|
SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
|
|
19953
19977
|
WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
|
|
@@ -19961,7 +19985,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
|
|
|
19961
19985
|
JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
|
|
19962
19986
|
)`, "preparationSubjects");
|
|
19963
19987
|
|
|
19964
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19988
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
|
|
19965
19989
|
var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
19966
19990
|
async preparationKnowledge(original) {
|
|
19967
19991
|
const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
|
|
@@ -20006,7 +20030,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
|
|
|
20006
20030
|
}
|
|
20007
20031
|
}), "meetingPreparationKnowledgeOver");
|
|
20008
20032
|
|
|
20009
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20033
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
|
|
20010
20034
|
var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20011
20035
|
async preparationNotes(original) {
|
|
20012
20036
|
const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
|
|
@@ -20059,7 +20083,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20059
20083
|
}
|
|
20060
20084
|
}), "meetingPreparationNotesOver");
|
|
20061
20085
|
|
|
20062
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20086
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
|
|
20063
20087
|
var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20064
20088
|
async relatedHistory(original) {
|
|
20065
20089
|
const input = validateMeetingRelatedHistory(original);
|
|
@@ -20130,7 +20154,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20130
20154
|
}
|
|
20131
20155
|
}), "meetingRelatedHistoryOver");
|
|
20132
20156
|
|
|
20133
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20157
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
|
|
20134
20158
|
var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
|
|
20135
20159
|
var text2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
|
|
20136
20160
|
var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
@@ -20211,7 +20235,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20211
20235
|
}
|
|
20212
20236
|
}), "meetingReviewOver");
|
|
20213
20237
|
|
|
20214
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20238
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
|
|
20215
20239
|
var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
|
|
20216
20240
|
var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
|
|
20217
20241
|
if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
|
|
@@ -20265,7 +20289,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20265
20289
|
}
|
|
20266
20290
|
}), "meetingSeriesHistoryOver");
|
|
20267
20291
|
|
|
20268
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20292
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
|
|
20269
20293
|
var MOST_ROWS = 5e5;
|
|
20270
20294
|
var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20271
20295
|
async meetingStats(input) {
|
|
@@ -20312,7 +20336,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20312
20336
|
}
|
|
20313
20337
|
}), "meetingStatsOver");
|
|
20314
20338
|
|
|
20315
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20339
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
|
|
20316
20340
|
var CURSOR_KEY = "meetings";
|
|
20317
20341
|
var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
|
|
20318
20342
|
id: Number(row2.id),
|
|
@@ -20864,7 +20888,7 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
20864
20888
|
};
|
|
20865
20889
|
}, "meetingStoreOver");
|
|
20866
20890
|
|
|
20867
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20891
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
|
|
20868
20892
|
var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
|
|
20869
20893
|
const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
|
|
20870
20894
|
return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
|
|
@@ -20890,7 +20914,7 @@ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
|
|
|
20890
20914
|
orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
|
|
20891
20915
|
}, "release");
|
|
20892
20916
|
|
|
20893
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20917
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
|
|
20894
20918
|
var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
|
|
20895
20919
|
id: `email:${place.emailId}`,
|
|
20896
20920
|
chatId: place.threadExternalId,
|
|
@@ -21043,9 +21067,9 @@ var saveEmail = /* @__PURE__ */ __name((database, orm, accountId, threadId, mail
|
|
|
21043
21067
|
["metadata", "metadata", toJson],
|
|
21044
21068
|
["mailRuleId", "mail_rule_id", (v) => v]
|
|
21045
21069
|
];
|
|
21046
|
-
for (const [
|
|
21047
|
-
if (mail[
|
|
21048
|
-
values.push([column2, encode(mail[
|
|
21070
|
+
for (const [field4, column2, encode] of optional)
|
|
21071
|
+
if (mail[field4] !== void 0)
|
|
21072
|
+
values.push([column2, encode(mail[field4])]);
|
|
21049
21073
|
const found2 = database.prepare("SELECT id, email_thread_id FROM emails WHERE account_id = ? AND external_id = ?").get(accountId, mail.externalId);
|
|
21050
21074
|
let emailId;
|
|
21051
21075
|
if (found2) {
|
|
@@ -21055,13 +21079,13 @@ var saveEmail = /* @__PURE__ */ __name((database, orm, accountId, threadId, mail
|
|
|
21055
21079
|
const columns = ["account_id", "external_id", ...values.map(([c]) => c), "created_at", "updated_at"];
|
|
21056
21080
|
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);
|
|
21057
21081
|
}
|
|
21058
|
-
if (ROLES.some(([
|
|
21082
|
+
if (ROLES.some(([field4]) => mail[field4] !== void 0)) {
|
|
21059
21083
|
database.prepare("DELETE FROM email_recipients WHERE email_id = ?").run(emailId);
|
|
21060
21084
|
const insert = database.prepare(`INSERT INTO email_recipients (email_id, identity_id, address, name, role, position, created_at, updated_at)
|
|
21061
21085
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
21062
21086
|
let position2 = 0;
|
|
21063
|
-
for (const [
|
|
21064
|
-
for (const recipient2 of mail[
|
|
21087
|
+
for (const [field4, role] of ROLES)
|
|
21088
|
+
for (const recipient2 of mail[field4] ?? []) {
|
|
21065
21089
|
const address = recipient2.address.trim().toLowerCase();
|
|
21066
21090
|
const identity = addressIdentity(database, orm, accountId, recipient2, now2);
|
|
21067
21091
|
insert.run(emailId, identity, address, recipient2.name, role, position2++, now2, now2);
|
|
@@ -21447,7 +21471,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
|
|
|
21447
21471
|
}
|
|
21448
21472
|
}), "mailStoreOver");
|
|
21449
21473
|
|
|
21450
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21474
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/search/dictionary.js
|
|
21451
21475
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
21452
21476
|
var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
|
|
21453
21477
|
var folded4 = /* @__PURE__ */ __name((word) => /^[а-яё'-]*$/.test(word) ? word.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word), "folded");
|
|
@@ -21537,7 +21561,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
|
|
|
21537
21561
|
}, "knownWord");
|
|
21538
21562
|
var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
|
|
21539
21563
|
|
|
21540
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21564
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
|
|
21541
21565
|
var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
|
|
21542
21566
|
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");
|
|
21543
21567
|
var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
|
|
@@ -21623,7 +21647,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
|
|
|
21623
21647
|
return found2;
|
|
21624
21648
|
}, "spokenTranscripts");
|
|
21625
21649
|
|
|
21626
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21650
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
|
|
21627
21651
|
var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
|
|
21628
21652
|
const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
|
|
21629
21653
|
if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
|
|
@@ -21670,7 +21694,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
|
|
|
21670
21694
|
});
|
|
21671
21695
|
}, "placeHits");
|
|
21672
21696
|
|
|
21673
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21697
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
|
|
21674
21698
|
var MESSAGES2 = {
|
|
21675
21699
|
rows: "messages",
|
|
21676
21700
|
threads: "chats",
|
|
@@ -22144,7 +22168,7 @@ var runQuery = /* @__PURE__ */ __name(async (context, execution, by) => {
|
|
|
22144
22168
|
};
|
|
22145
22169
|
}, "runQuery");
|
|
22146
22170
|
|
|
22147
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22171
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
|
|
22148
22172
|
function invalidMetadata() {
|
|
22149
22173
|
throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
|
|
22150
22174
|
}
|
|
@@ -22182,10 +22206,10 @@ var counterStates = /* @__PURE__ */ __name(({ database }, messagePk, now2, maxAg
|
|
|
22182
22206
|
}, "counterStates");
|
|
22183
22207
|
var applyCounterObservations = /* @__PURE__ */ __name((context, messagePk, observations) => {
|
|
22184
22208
|
const { database, now: now2 } = context;
|
|
22185
|
-
const validated = Object.entries(observations).map(([
|
|
22186
|
-
if (!COUNTER_FIELDS.includes(
|
|
22209
|
+
const validated = Object.entries(observations).map(([field4, observation]) => {
|
|
22210
|
+
if (!COUNTER_FIELDS.includes(field4) || !observation)
|
|
22187
22211
|
throw new CliError("validation_error", "unknown counter observation field");
|
|
22188
|
-
return { field:
|
|
22212
|
+
return { field: field4, observation, at: counterObservationTime(observation, now2()) };
|
|
22189
22213
|
});
|
|
22190
22214
|
if (!validated.length)
|
|
22191
22215
|
return 0;
|
|
@@ -22207,20 +22231,20 @@ var applyCounterObservations = /* @__PURE__ */ __name((context, messagePk, obser
|
|
|
22207
22231
|
const metadata3 = validated.some((one) => one.field !== "reactions") ? object(message2.metadata) : {};
|
|
22208
22232
|
let reactions = message2.reactions === null ? null : String(message2.reactions);
|
|
22209
22233
|
let updated = 0;
|
|
22210
|
-
for (const { field:
|
|
22211
|
-
const existing = database.prepare("SELECT value,created_at FROM message_counter_observations WHERE message_id=? AND counter=?").get(messagePk,
|
|
22234
|
+
for (const { field: field4, observation, at } of validated) {
|
|
22235
|
+
const existing = database.prepare("SELECT value,created_at FROM message_counter_observations WHERE message_id=? AND counter=?").get(messagePk, field4);
|
|
22212
22236
|
const oldWins = existing && Number(existing.created_at) > at;
|
|
22213
22237
|
const value = oldWins ? Number(existing.value) : observation.value;
|
|
22214
|
-
if (
|
|
22238
|
+
if (field4 === "reactions") {
|
|
22215
22239
|
if (!oldWins && observation.reactions)
|
|
22216
22240
|
reactions = JSON.stringify(observation.reactions);
|
|
22217
22241
|
else
|
|
22218
22242
|
reactions = JSON.stringify({ total: value, mine: null, counts: [] });
|
|
22219
22243
|
} else
|
|
22220
|
-
metadata3[
|
|
22244
|
+
metadata3[field4] = value;
|
|
22221
22245
|
if (oldWins)
|
|
22222
22246
|
continue;
|
|
22223
|
-
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,
|
|
22247
|
+
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);
|
|
22224
22248
|
updated++;
|
|
22225
22249
|
}
|
|
22226
22250
|
if (validated.length)
|
|
@@ -22246,7 +22270,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
|
|
|
22246
22270
|
};
|
|
22247
22271
|
}), "counterTargets");
|
|
22248
22272
|
|
|
22249
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22273
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
|
|
22250
22274
|
var NOT_FILE_LIST = [...NOT_FILES].map((kind3) => `'${kind3}'`).join(",");
|
|
22251
22275
|
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,
|
|
22252
22276
|
att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
|
|
@@ -22365,7 +22389,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
|
|
|
22365
22389
|
}));
|
|
22366
22390
|
}, "attachmentViews");
|
|
22367
22391
|
|
|
22368
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22392
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
|
|
22369
22393
|
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");
|
|
22370
22394
|
var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text5, source2) => {
|
|
22371
22395
|
const { orm, database, now: now2 } = context;
|
|
@@ -22403,7 +22427,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
|
|
|
22403
22427
|
keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
|
|
22404
22428
|
}, "intoVoiceAttachment");
|
|
22405
22429
|
|
|
22406
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22430
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
|
|
22407
22431
|
var FIELDS = [
|
|
22408
22432
|
"threadExternalId",
|
|
22409
22433
|
"senderIdentityId",
|
|
@@ -22524,9 +22548,9 @@ var upsertMessage = /* @__PURE__ */ __name((context, key2, accountKey, chatKey,
|
|
|
22524
22548
|
const previous = JSON.parse(found2.providerMetadata);
|
|
22525
22549
|
const incoming = JSON.parse(String(fields4.metadata ?? "{}"));
|
|
22526
22550
|
if (previous && incoming && !Array.isArray(previous) && !Array.isArray(incoming)) {
|
|
22527
|
-
for (const
|
|
22528
|
-
if (!validCounter(incoming[
|
|
22529
|
-
incoming[
|
|
22551
|
+
for (const field4 of ["views", "comments"])
|
|
22552
|
+
if (!validCounter(incoming[field4]) && validCounter(previous[field4]))
|
|
22553
|
+
incoming[field4] = previous[field4];
|
|
22530
22554
|
fields4.metadata = JSON.stringify(edit ? { ...previous, ...incoming } : incoming);
|
|
22531
22555
|
}
|
|
22532
22556
|
} catch {
|
|
@@ -22720,7 +22744,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
|
|
|
22720
22744
|
reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
|
|
22721
22745
|
}, "writeDerivedReactions");
|
|
22722
22746
|
|
|
22723
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22747
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/keys.js
|
|
22724
22748
|
var keysOver = /* @__PURE__ */ __name((context) => {
|
|
22725
22749
|
const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
|
|
22726
22750
|
const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
|
|
@@ -22741,7 +22765,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
|
|
|
22741
22765
|
};
|
|
22742
22766
|
}, "keysOver");
|
|
22743
22767
|
|
|
22744
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22768
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
|
|
22745
22769
|
var accountGroupsOf = /* @__PURE__ */ __name((database) => {
|
|
22746
22770
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
|
|
22747
22771
|
if (!row2)
|
|
@@ -22776,7 +22800,7 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
|
|
|
22776
22800
|
database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
|
|
22777
22801
|
}, "saveProfile");
|
|
22778
22802
|
|
|
22779
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22803
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
|
|
22780
22804
|
var BOT_KINDS = ["agent", "script", "integration"];
|
|
22781
22805
|
var ownerPerson = /* @__PURE__ */ __name((database) => {
|
|
22782
22806
|
const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
|
|
@@ -22812,7 +22836,7 @@ var originOfActor = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
22812
22836
|
return database.prepare("SELECT name FROM bots WHERE id = ?").get(Number(id2))?.name === "rule" ? "rule" : "agent";
|
|
22813
22837
|
}, "originOfActor");
|
|
22814
22838
|
|
|
22815
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22839
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
|
|
22816
22840
|
var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
|
|
22817
22841
|
const owner = ownerPerson(context.database).id;
|
|
22818
22842
|
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);
|
|
@@ -22833,7 +22857,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
|
|
|
22833
22857
|
return personOf(context, ref3);
|
|
22834
22858
|
}, "linkToOwner");
|
|
22835
22859
|
|
|
22836
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22860
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
|
|
22837
22861
|
var PROVIDERS_SETTING = "providers";
|
|
22838
22862
|
var storedProvidersOf = /* @__PURE__ */ __name((database) => {
|
|
22839
22863
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
|
|
@@ -22868,7 +22892,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
|
|
|
22868
22892
|
});
|
|
22869
22893
|
}, "registerProvider");
|
|
22870
22894
|
|
|
22871
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22895
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
|
|
22872
22896
|
var DAY3 = 864e5;
|
|
22873
22897
|
var RECENTLY_CLOSED_MS = 14 * DAY3;
|
|
22874
22898
|
var TEXT_LIMIT = 20;
|
|
@@ -22892,7 +22916,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
|
22892
22916
|
...own || row2.person == null ? {} : { person: `person:${row2.person}` }
|
|
22893
22917
|
};
|
|
22894
22918
|
}, "messageOf");
|
|
22895
|
-
const
|
|
22919
|
+
const sourceOf4 = /* @__PURE__ */ __name((locator2) => {
|
|
22896
22920
|
if (typeof locator2 !== "string" || !isLocator(locator2))
|
|
22897
22921
|
return void 0;
|
|
22898
22922
|
let thing;
|
|
@@ -22913,7 +22937,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
|
22913
22937
|
return { ...side, linked };
|
|
22914
22938
|
}, "linkedOf");
|
|
22915
22939
|
const sideOf = /* @__PURE__ */ __name((row2) => {
|
|
22916
|
-
const source2 =
|
|
22940
|
+
const source2 = sourceOf4(row2.source_locator);
|
|
22917
22941
|
const person2 = source2?.person;
|
|
22918
22942
|
return {
|
|
22919
22943
|
row: Number(row2.id),
|
|
@@ -22968,7 +22992,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
|
22968
22992
|
if (!project)
|
|
22969
22993
|
return void 0;
|
|
22970
22994
|
const { draft } = subject2;
|
|
22971
|
-
const source2 = draft.source === void 0 ? void 0 :
|
|
22995
|
+
const source2 = draft.source === void 0 ? void 0 : sourceOf4(draft.source);
|
|
22972
22996
|
const person2 = draft.person ?? source2?.person;
|
|
22973
22997
|
return {
|
|
22974
22998
|
project: Number(project.id),
|
|
@@ -23007,7 +23031,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
|
23007
23031
|
drainCorpus(database, CORPORA.task, stemmerFor2);
|
|
23008
23032
|
const stemmer = stemmerFor2(storeStemmers(database) ?? DEFAULT_STEMMERS);
|
|
23009
23033
|
const since = now2() - RECENTLY_CLOSED_MS;
|
|
23010
|
-
const live2 = "t.project_id = ? AND t.deleted_at IS NULL AND t.id <> ? AND (t.status
|
|
23034
|
+
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 >= ?)";
|
|
23011
23035
|
const scope3 = [side.project, side.row ?? -1, since];
|
|
23012
23036
|
const found2 = /* @__PURE__ */ new Map();
|
|
23013
23037
|
const add = /* @__PURE__ */ __name((id2, by) => found2.set(id2, (found2.get(id2) ?? /* @__PURE__ */ new Set()).add(by)), "add");
|
|
@@ -23067,7 +23091,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
|
23067
23091
|
};
|
|
23068
23092
|
}, "taskSimilarityOver");
|
|
23069
23093
|
|
|
23070
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23094
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
|
|
23071
23095
|
var SETTING3 = "taskCategories";
|
|
23072
23096
|
var savedTaskCategories = /* @__PURE__ */ __name((database) => {
|
|
23073
23097
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
|
|
@@ -23076,7 +23100,7 @@ var savedTaskCategories = /* @__PURE__ */ __name((database) => {
|
|
|
23076
23100
|
var storeTaskCategories = /* @__PURE__ */ __name((database) => savedTaskCategories(database) ?? DEFAULT_TASK_CATEGORIES, "storeTaskCategories");
|
|
23077
23101
|
var unlistedTaskCategories = /* @__PURE__ */ __name((database, list) => {
|
|
23078
23102
|
const listed = new Set(list.map(({ name }) => name));
|
|
23079
|
-
return database.prepare("SELECT category, COUNT(*) AS total, SUM(status
|
|
23103
|
+
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));
|
|
23080
23104
|
}, "unlistedTaskCategories");
|
|
23081
23105
|
var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) => {
|
|
23082
23106
|
if (categories === void 0) {
|
|
@@ -23086,7 +23110,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
|
|
|
23086
23110
|
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);
|
|
23087
23111
|
}, "saveTaskCategories");
|
|
23088
23112
|
|
|
23089
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23113
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
|
|
23090
23114
|
var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
|
|
23091
23115
|
var ALLOWED = "taskAgentClose";
|
|
23092
23116
|
var MIN = "taskAgentCloseMin";
|
|
@@ -23142,7 +23166,7 @@ var SUGGESTION_COLUMNS = [
|
|
|
23142
23166
|
];
|
|
23143
23167
|
var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
|
|
23144
23168
|
|
|
23145
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23169
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
|
|
23146
23170
|
var EXCERPT_CHARS = 280;
|
|
23147
23171
|
var excerptOf = /* @__PURE__ */ __name((text5) => {
|
|
23148
23172
|
if (text5 == null)
|
|
@@ -23167,8 +23191,7 @@ var KIND = {
|
|
|
23167
23191
|
meeting_transcript: "meeting",
|
|
23168
23192
|
meeting_transcript_row: "meeting"
|
|
23169
23193
|
};
|
|
23170
|
-
var
|
|
23171
|
-
const thing = storedThing(link3.to_type, link3.to_id);
|
|
23194
|
+
var sourceOf3 = /* @__PURE__ */ __name((database, thing) => {
|
|
23172
23195
|
const state = stateOfThing(database, thing);
|
|
23173
23196
|
const read2 = READS2[thing.type];
|
|
23174
23197
|
const row2 = read2 === void 0 || state === "unavailable" ? void 0 : database.prepare(read2).get(thing.id);
|
|
@@ -23183,9 +23206,32 @@ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => database.pre
|
|
|
23183
23206
|
tool: textOf(row2?.tool),
|
|
23184
23207
|
missing: gone
|
|
23185
23208
|
};
|
|
23186
|
-
}
|
|
23209
|
+
}, "sourceOf");
|
|
23210
|
+
var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => database.prepare(`SELECT to_type, to_id FROM links WHERE from_type = ? AND from_id = ? AND kind = ${linkKind("evidence")} AND to_id IS NOT NULL ORDER BY id`).all(from2.type, from2.id).map((link3) => sourceOf3(database, storedThing(link3.to_type, link3.to_id))), "evidenceSourcesOf");
|
|
23211
|
+
var thingNamed = /* @__PURE__ */ __name((database, reference2) => {
|
|
23212
|
+
try {
|
|
23213
|
+
return thingOf(database, canonicalThingReference(reference2));
|
|
23214
|
+
} catch {
|
|
23215
|
+
return void 0;
|
|
23216
|
+
}
|
|
23217
|
+
}, "thingNamed");
|
|
23218
|
+
var sourcesOfReferences = /* @__PURE__ */ __name((database, references) => [...new Set(references)].map((reference2) => {
|
|
23219
|
+
const thing = thingNamed(database, reference2);
|
|
23220
|
+
if (thing)
|
|
23221
|
+
return { ...sourceOf3(database, thing), ref: reference2 };
|
|
23222
|
+
return {
|
|
23223
|
+
ref: reference2,
|
|
23224
|
+
kind: reference2.startsWith("msg:") ? "message" : reference2.split(":")[0] || "unknown",
|
|
23225
|
+
title: null,
|
|
23226
|
+
sender: null,
|
|
23227
|
+
at: null,
|
|
23228
|
+
excerpt: null,
|
|
23229
|
+
tool: null,
|
|
23230
|
+
missing: true
|
|
23231
|
+
};
|
|
23232
|
+
}), "sourcesOfReferences");
|
|
23187
23233
|
|
|
23188
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23234
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/attachments/limits.js
|
|
23189
23235
|
var MAX_FILE_BYTES = 50 * 1024 * 1024;
|
|
23190
23236
|
var MAX_TEXT_CHARS = 2e6;
|
|
23191
23237
|
var ATTACHMENT_LIMIT_ENV = [
|
|
@@ -23211,7 +23257,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
|
|
|
23211
23257
|
return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
|
|
23212
23258
|
}, "pdfPreviewLimits");
|
|
23213
23259
|
|
|
23214
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23260
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/ulid.js
|
|
23215
23261
|
import { randomBytes } from "node:crypto";
|
|
23216
23262
|
var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
23217
23263
|
var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
|
|
@@ -23224,16 +23270,16 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
|
|
|
23224
23270
|
return time3 + random;
|
|
23225
23271
|
}, "ulid");
|
|
23226
23272
|
|
|
23227
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23273
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
|
|
23228
23274
|
var FOLDED_FIELDS = ["title", "site", "language", "author"];
|
|
23229
23275
|
var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
|
|
23230
23276
|
if (!meta && !sections?.length)
|
|
23231
23277
|
return null;
|
|
23232
23278
|
const folded5 = {};
|
|
23233
|
-
for (const
|
|
23234
|
-
const value = meta?.[
|
|
23279
|
+
for (const field4 of FOLDED_FIELDS) {
|
|
23280
|
+
const value = meta?.[field4];
|
|
23235
23281
|
if (typeof value === "string" && value !== "")
|
|
23236
|
-
folded5[
|
|
23282
|
+
folded5[field4] = normalize(value);
|
|
23237
23283
|
}
|
|
23238
23284
|
const keywords = meta?.keywords;
|
|
23239
23285
|
if (Array.isArray(keywords) && keywords.length)
|
|
@@ -23245,7 +23291,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
|
|
|
23245
23291
|
return typeof language === "string" && language !== "" ? language : null;
|
|
23246
23292
|
}, "languageOf");
|
|
23247
23293
|
|
|
23248
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23294
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
|
|
23249
23295
|
var isObject = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
|
|
23250
23296
|
var objectOf = /* @__PURE__ */ __name((value) => {
|
|
23251
23297
|
if (isObject(value))
|
|
@@ -23488,7 +23534,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
23488
23534
|
};
|
|
23489
23535
|
}, "filesStoreOver");
|
|
23490
23536
|
|
|
23491
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23537
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
|
|
23492
23538
|
var IMPORTED_DOCUMENT_QUERY = defineQuery({
|
|
23493
23539
|
entity: "document",
|
|
23494
23540
|
backend: "sql",
|
|
@@ -23534,7 +23580,7 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
|
|
|
23534
23580
|
return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
|
|
23535
23581
|
}, "importedDocumentWhere");
|
|
23536
23582
|
|
|
23537
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23583
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
|
|
23538
23584
|
var NOTE_FORMATS = ["obsidian", "markdown"];
|
|
23539
23585
|
var iso2 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
23540
23586
|
var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso2(value), "optionalIso");
|
|
@@ -24044,7 +24090,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
24044
24090
|
};
|
|
24045
24091
|
}, "notesStoreOver");
|
|
24046
24092
|
|
|
24047
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24093
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
|
|
24048
24094
|
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";
|
|
24049
24095
|
var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
24050
24096
|
var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
@@ -24091,6 +24137,18 @@ var subjectOf = /* @__PURE__ */ __name((database, row2) => {
|
|
|
24091
24137
|
subjectIsOwner: Number(named2?.owner) === 1
|
|
24092
24138
|
};
|
|
24093
24139
|
}, "subjectOf");
|
|
24140
|
+
var projectOf = /* @__PURE__ */ __name((database, row2) => {
|
|
24141
|
+
if (row2.project_id == null)
|
|
24142
|
+
return { project: null, projectName: null };
|
|
24143
|
+
const named2 = database.prepare(SUBJECT_NAMES.project).get(Number(row2.project_id));
|
|
24144
|
+
return { project: `project:${row2.project_id}`, projectName: named2?.name == null ? null : String(named2.name) };
|
|
24145
|
+
}, "projectOf");
|
|
24146
|
+
var projectId = /* @__PURE__ */ __name((database, reference2) => {
|
|
24147
|
+
const project = requiredThing(database, reference2, "the project");
|
|
24148
|
+
if (project.type !== "project")
|
|
24149
|
+
throw new CliError("validation_error", `${reference2} is not a project`);
|
|
24150
|
+
return project.id;
|
|
24151
|
+
}, "projectId");
|
|
24094
24152
|
var highestKey = /* @__PURE__ */ __name((table) => `ids.${table}.highest`, "highestKey");
|
|
24095
24153
|
var nextId = /* @__PURE__ */ __name((database, table) => {
|
|
24096
24154
|
const kept = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(highestKey(table));
|
|
@@ -24130,6 +24188,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
24130
24188
|
kind: row2.kind,
|
|
24131
24189
|
body: String(row2.body),
|
|
24132
24190
|
...subjectOf(database, row2),
|
|
24191
|
+
...projectOf(database, row2),
|
|
24133
24192
|
author: authorOf(row2),
|
|
24134
24193
|
model: row2.model == null ? null : String(row2.model),
|
|
24135
24194
|
confidence: row2.confidence == null ? null : Number(row2.confidence),
|
|
@@ -24177,9 +24236,10 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
24177
24236
|
const id2 = write(database, () => {
|
|
24178
24237
|
const { actor, model } = authorActor(context, input.author);
|
|
24179
24238
|
const subject2 = input.subject === void 0 ? void 0 : requiredThing(database, input.subject, "the subject");
|
|
24239
|
+
const project = input.project === void 0 ? null : projectId(database, input.project);
|
|
24180
24240
|
const replaced = input.supersedes === void 0 ? void 0 : Number(rowOf(input.supersedes).id);
|
|
24181
24241
|
const at = now2();
|
|
24182
|
-
const made = Number(database.prepare("INSERT INTO memories (id, kind, body, subject_type, subject_id, author_type, author_id, model, confidence, status, last_verified_at, supersedes_id, scope, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(nextId(database, "memories"), kind3, body2, subject2?.type ?? null, subject2?.id ?? null, actor.type, actor.id, model, input.confidence ?? null, status, status === "confirmed" ? at : null, replaced ?? null, scope3, at, at)?.id);
|
|
24242
|
+
const made = Number(database.prepare("INSERT INTO memories (id, kind, body, subject_type, subject_id, author_type, author_id, model, confidence, status, last_verified_at, supersedes_id, scope, project_id, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(nextId(database, "memories"), kind3, body2, subject2?.type ?? null, subject2?.id ?? null, actor.type, actor.id, model, input.confidence ?? null, status, status === "confirmed" ? at : null, replaced ?? null, scope3, project, at, at)?.id);
|
|
24183
24243
|
linkEvidence(context, { type: "memory", id: made }, input.evidence, input.author === "owner" ? "owner" : "agent");
|
|
24184
24244
|
if (replaced !== void 0)
|
|
24185
24245
|
database.prepare("UPDATE memories SET status = 'superseded', updated_at = ? WHERE id = ?").run(at, replaced);
|
|
@@ -24190,8 +24250,15 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
24190
24250
|
get: /* @__PURE__ */ __name(async (reference2) => memoryOf(rowOf(reference2)), "get"),
|
|
24191
24251
|
list: /* @__PURE__ */ __name(async (options = {}) => {
|
|
24192
24252
|
const subject2 = options.subject === void 0 ? void 0 : requiredThing(database, options.subject);
|
|
24193
|
-
|
|
24253
|
+
const project = options.project === void 0 ? null : projectId(database, options.project);
|
|
24254
|
+
return database.prepare(`${NAMED} WHERE m.deleted_at IS NULL AND (? IS NULL OR (m.subject_type = ? AND m.subject_id = ?)) AND (? IS NULL OR m.project_id = ?) AND (? IS NULL OR m.kind = ?) AND (? IS NULL OR m.status = ?) AND (? IS NULL OR m.scope = ?) ORDER BY m.created_at DESC, m.id DESC LIMIT ?`).all(subject2?.type ?? null, subject2?.type ?? null, subject2?.id ?? null, project, project, options.kind ?? null, options.kind ?? null, options.status ?? null, options.status ?? null, options.scope ?? null, options.scope ?? null, Math.min(Math.max(options.limit ?? 100, 1), 500)).map(memoryOf);
|
|
24194
24255
|
}, "list"),
|
|
24256
|
+
update: /* @__PURE__ */ __name(async (reference2, change) => write(database, () => {
|
|
24257
|
+
const id2 = Number(rowOf(reference2).id);
|
|
24258
|
+
const project = change.project === null ? null : projectId(database, change.project);
|
|
24259
|
+
database.prepare("UPDATE memories SET project_id = ?, updated_at = ? WHERE id = ?").run(project, now2(), id2);
|
|
24260
|
+
return memoryOf(rowOf(`memory:${id2}`));
|
|
24261
|
+
}), "update"),
|
|
24195
24262
|
confirm: /* @__PURE__ */ __name(async (reference2) => setStatus(reference2, "confirmed", true), "confirm"),
|
|
24196
24263
|
markStale: /* @__PURE__ */ __name(async (reference2) => setStatus(reference2, "stale", false), "markStale"),
|
|
24197
24264
|
remove: /* @__PURE__ */ __name(async (reference2) => {
|
|
@@ -24219,7 +24286,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
24219
24286
|
};
|
|
24220
24287
|
}, "memoriesStoreOver");
|
|
24221
24288
|
|
|
24222
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24289
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
|
|
24223
24290
|
var DEFAULT_FIRST_PASS_PER_CHAT = 0;
|
|
24224
24291
|
var KEY = "taskFirstPassPerChat";
|
|
24225
24292
|
var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
|
|
@@ -24239,7 +24306,181 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
|
|
|
24239
24306
|
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);
|
|
24240
24307
|
}, "saveFirstPassPerChat");
|
|
24241
24308
|
|
|
24242
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24309
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
|
|
24310
|
+
var TASK_SORTS = ["priority", "due", "created", "updated", "key", "state"];
|
|
24311
|
+
var field = /* @__PURE__ */ __name((name, type, example, more = {}) => ({
|
|
24312
|
+
name,
|
|
24313
|
+
type,
|
|
24314
|
+
operators: OPERATORS_BY_TYPE[type],
|
|
24315
|
+
example,
|
|
24316
|
+
...more
|
|
24317
|
+
}), "field");
|
|
24318
|
+
var PROJECT_TASK_FIELDS = [
|
|
24319
|
+
field("state", "enum", "state:todo", { values: TASK_STATES }),
|
|
24320
|
+
field("kind", "enum", "kind:bug", { values: TASK_TYPES }),
|
|
24321
|
+
field("project", "kw", "project:HRB", {
|
|
24322
|
+
relation: "a project by its key or project:<id>; project:* is every project, and lists project tasks only"
|
|
24323
|
+
}),
|
|
24324
|
+
field("assignee", "kw", 'assignee:"person:12"', {
|
|
24325
|
+
relation: "who does it: any, none, or a person (person:12 in quotes, or the bare 12)"
|
|
24326
|
+
}),
|
|
24327
|
+
field("priority", "kw", "priority:high", {
|
|
24328
|
+
operators: ["term", "range", "wildcard"],
|
|
24329
|
+
relation: "low, medium, high, critical or none; a range of labels or of the 0\u20131 number: priority:[high TO critical]"
|
|
24330
|
+
}),
|
|
24331
|
+
field("agent", "kw", "agent:hermes", { relation: "the agent working on it, by name; none or any" }),
|
|
24332
|
+
field("due", "time", "due:[today TO 2026-12-31]", { relation: "the due date; NOT due:* has none" }),
|
|
24333
|
+
field("overdue", "bool", "overdue:true", { relation: "open work whose due date has passed" }),
|
|
24334
|
+
field("closed", "time", "closed:>=14d", { relation: "when it was done or dismissed" }),
|
|
24335
|
+
field("ready", "bool", "ready:true", { relation: "open work whose blocked-by tasks are all done" }),
|
|
24336
|
+
field("text", "txt", "text:invoice", { relation: "words of the title and description; a bare word means this" })
|
|
24337
|
+
];
|
|
24338
|
+
var OPEN = "t.status NOT IN ('done', 'dismissed')";
|
|
24339
|
+
var OWNER_PROJECTS = `SELECT id FROM projects WHERE deleted_at IS NULL AND length(key) <> ${INBOX_KEY_LENGTH}`;
|
|
24340
|
+
var ASSIGNED = "SELECT 1 FROM task_assignments a WHERE a.task_id = t.id AND a.assignee_type = 'person' AND a.role = 'assignee'";
|
|
24341
|
+
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')";
|
|
24342
|
+
var wordsMatch = /* @__PURE__ */ __name((node) => {
|
|
24343
|
+
const words3 = taskWordsOf(node.value.replaceAll("*", " ")).split(/\s+/).filter((word) => /[\p{L}\p{N}]/u.test(word));
|
|
24344
|
+
if (words3.length === 0)
|
|
24345
|
+
return void 0;
|
|
24346
|
+
const quoted3 = /* @__PURE__ */ __name((text5) => `"${text5.replaceAll('"', '""')}"`, "quoted");
|
|
24347
|
+
return `normalized_text : (${node.operator === "phrase" ? quoted3(words3.join(" ")) : words3.map((word) => `${quoted3(word)}*`).join(" AND ")})`;
|
|
24348
|
+
}, "wordsMatch");
|
|
24349
|
+
var projectWhere = /* @__PURE__ */ __name((node) => {
|
|
24350
|
+
if (node.operator === "wildcard" && node.value === "*")
|
|
24351
|
+
return { sql: "1", params: [] };
|
|
24352
|
+
const id2 = /^project:(\d+)$/.exec(node.value.trim())?.[1];
|
|
24353
|
+
if (id2 !== void 0)
|
|
24354
|
+
return { sql: "t.project_id = ?", params: [Number(id2)] };
|
|
24355
|
+
const key2 = node.value.trim().toUpperCase();
|
|
24356
|
+
return {
|
|
24357
|
+
sql: `t.project_id IN (SELECT id FROM projects WHERE key ${node.operator === "wildcard" ? "GLOB" : "="} ?)`,
|
|
24358
|
+
params: [key2]
|
|
24359
|
+
};
|
|
24360
|
+
}, "projectWhere");
|
|
24361
|
+
var assigneeWhere = /* @__PURE__ */ __name((node) => {
|
|
24362
|
+
const value = node.value.trim().toLowerCase();
|
|
24363
|
+
if (value === "any" || node.operator === "wildcard" && value === "*")
|
|
24364
|
+
return { sql: `EXISTS (${ASSIGNED})`, params: [] };
|
|
24365
|
+
if (value === "none")
|
|
24366
|
+
return { sql: `NOT EXISTS (${ASSIGNED})`, params: [] };
|
|
24367
|
+
const id2 = /^(?:person:)?(\d+)$/.exec(value)?.[1];
|
|
24368
|
+
if (id2 === void 0)
|
|
24369
|
+
throw new CliError("validation_error", `assignee: takes any, none or "person:<id>", not "${node.value}"`);
|
|
24370
|
+
return { sql: `EXISTS (${ASSIGNED} AND a.assignee_id = ?)`, params: [Number(id2)] };
|
|
24371
|
+
}, "assigneeWhere");
|
|
24372
|
+
var bound3 = /* @__PURE__ */ __name((value, side, node) => {
|
|
24373
|
+
const word = value.trim().toLowerCase();
|
|
24374
|
+
if (word === "*")
|
|
24375
|
+
return void 0;
|
|
24376
|
+
if (PRIORITY_LABELS.includes(word))
|
|
24377
|
+
return priorityBand(word)[side];
|
|
24378
|
+
const number3 = Number(word);
|
|
24379
|
+
if (word === "" || !Number.isFinite(number3) || number3 < 0 || number3 > 1)
|
|
24380
|
+
throw new CliError("validation_error", `priority: takes ${PRIORITY_LABELS.join(", ")}, none, or 0 to 1, not "${node.value}"`);
|
|
24381
|
+
return number3;
|
|
24382
|
+
}, "bound");
|
|
24383
|
+
var priorityWhere = /* @__PURE__ */ __name((node) => {
|
|
24384
|
+
const score = "t.priority_score";
|
|
24385
|
+
if (node.operator === "wildcard") {
|
|
24386
|
+
if (node.value === "*")
|
|
24387
|
+
return { sql: `${score} IS NOT NULL`, params: [] };
|
|
24388
|
+
throw new CliError("validation_error", "priority: takes a label, none, or a range");
|
|
24389
|
+
}
|
|
24390
|
+
if (node.operator !== "range") {
|
|
24391
|
+
const word = node.value.trim().toLowerCase();
|
|
24392
|
+
if (word === "none")
|
|
24393
|
+
return { sql: `${score} IS NULL`, params: [] };
|
|
24394
|
+
if (!PRIORITY_LABELS.includes(word))
|
|
24395
|
+
throw new CliError("validation_error", `priority: takes ${PRIORITY_LABELS.join(", ")} or none; a number goes in a range`);
|
|
24396
|
+
const { from: from2, to } = priorityBand(word);
|
|
24397
|
+
return { sql: `${score} >= ? AND ${score} ${to === 1 ? "<=" : "<"} ?`, params: [from2, to] };
|
|
24398
|
+
}
|
|
24399
|
+
const lower = bound3(node.value, "from", node);
|
|
24400
|
+
const upperWord = (node.upper ?? "*").trim().toLowerCase();
|
|
24401
|
+
const upper = bound3(upperWord, "to", node);
|
|
24402
|
+
const labelUpper = PRIORITY_LABELS.includes(upperWord);
|
|
24403
|
+
const parts = [`${score} IS NOT NULL`];
|
|
24404
|
+
const params = [];
|
|
24405
|
+
if (lower !== void 0) {
|
|
24406
|
+
parts.push(`${score} ${node.lower_inclusive === false ? ">" : ">="} ?`);
|
|
24407
|
+
params.push(lower);
|
|
24408
|
+
}
|
|
24409
|
+
if (upper !== void 0) {
|
|
24410
|
+
parts.push(`${score} ${labelUpper ? upper === 1 ? "<=" : "<" : node.upper_inclusive === false ? "<" : "<="} ?`);
|
|
24411
|
+
params.push(upper);
|
|
24412
|
+
}
|
|
24413
|
+
return { sql: parts.join(" AND "), params };
|
|
24414
|
+
}, "priorityWhere");
|
|
24415
|
+
var agentWhere = /* @__PURE__ */ __name((node) => {
|
|
24416
|
+
const value = node.value.trim().toLowerCase();
|
|
24417
|
+
if (value === "none")
|
|
24418
|
+
return { sql: "t.agent IS NULL", params: [] };
|
|
24419
|
+
if (value === "any" || node.operator === "wildcard" && value === "*")
|
|
24420
|
+
return { sql: "t.agent IS NOT NULL", params: [] };
|
|
24421
|
+
return node.operator === "wildcard" ? { sql: "lower(t.agent) GLOB ?", params: [value] } : { sql: "lower(t.agent) = ?", params: [value] };
|
|
24422
|
+
}, "agentWhere");
|
|
24423
|
+
var truth = /* @__PURE__ */ __name((node, sql2) => ({
|
|
24424
|
+
sql: node.value.toLowerCase() === "true" ? sql2 : `NOT (${sql2})`,
|
|
24425
|
+
params: []
|
|
24426
|
+
}), "truth");
|
|
24427
|
+
var projectTaskColumns = /* @__PURE__ */ __name((now2) => ({
|
|
24428
|
+
state: { type: "enum", sql: "t.status" },
|
|
24429
|
+
kind: { type: "enum", sql: "t.type" },
|
|
24430
|
+
project: { where: projectWhere },
|
|
24431
|
+
assignee: { where: assigneeWhere },
|
|
24432
|
+
priority: { where: priorityWhere },
|
|
24433
|
+
agent: { where: agentWhere },
|
|
24434
|
+
due: { type: "time", sql: "t.due_at" },
|
|
24435
|
+
closed: { type: "time", sql: "t.closed_at" },
|
|
24436
|
+
overdue: { where: /* @__PURE__ */ __name((node) => truth(node, `${OPEN} AND t.due_at IS NOT NULL AND t.due_at < ${Number(now2)}`), "where") },
|
|
24437
|
+
ready: { where: /* @__PURE__ */ __name((node) => truth(node, `${OPEN} AND NOT EXISTS (${UNFINISHED_BLOCKER})`), "where") },
|
|
24438
|
+
text: {
|
|
24439
|
+
where: /* @__PURE__ */ __name((node) => {
|
|
24440
|
+
const match = wordsMatch(node);
|
|
24441
|
+
const byKey = { sql: "t.key = ?", params: [node.value.trim().toUpperCase()] };
|
|
24442
|
+
if (match === void 0)
|
|
24443
|
+
return byKey;
|
|
24444
|
+
return {
|
|
24445
|
+
sql: `(t.id IN (SELECT rowid FROM task_words WHERE task_words MATCH ?) OR ${byKey.sql})`,
|
|
24446
|
+
params: [match, ...byKey.params]
|
|
24447
|
+
};
|
|
24448
|
+
}, "where")
|
|
24449
|
+
}
|
|
24450
|
+
}), "projectTaskColumns");
|
|
24451
|
+
var BOARD_SCOPE = `t.deleted_at IS NULL AND t.project_id IN (${OWNER_PROJECTS})`;
|
|
24452
|
+
var STATE_ORDER = `CASE t.status ${TASK_STATES.map((state, at) => `WHEN '${state}' THEN ${at}`).join(" ")} END`;
|
|
24453
|
+
var boardOrder = /* @__PURE__ */ __name((sort, descending) => {
|
|
24454
|
+
const direction = descending ? "DESC" : "ASC";
|
|
24455
|
+
const first = {
|
|
24456
|
+
priority: ["t.priority_score IS NULL", `t.priority_score ${descending ? "ASC" : "DESC"}`],
|
|
24457
|
+
due: ["t.due_at IS NULL", `t.due_at ${direction}`],
|
|
24458
|
+
created: [`t.created_at ${direction}`],
|
|
24459
|
+
updated: [`t.updated_at ${direction}`],
|
|
24460
|
+
key: [`(SELECT key FROM projects WHERE id = t.project_id) ${direction}`, `t.number ${direction}`],
|
|
24461
|
+
state: [`${STATE_ORDER} ${direction}`]
|
|
24462
|
+
}[sort];
|
|
24463
|
+
return [...first, "t.priority_score IS NULL", "t.priority_score DESC", "t.created_at", "t.id"].join(", ");
|
|
24464
|
+
}, "boardOrder");
|
|
24465
|
+
var withoutField = /* @__PURE__ */ __name((query, name) => {
|
|
24466
|
+
if (query === void 0)
|
|
24467
|
+
return void 0;
|
|
24468
|
+
const strip = /* @__PURE__ */ __name((node) => {
|
|
24469
|
+
if (walkQuery(node).every((leaf2) => leaf2.field === name))
|
|
24470
|
+
return void 0;
|
|
24471
|
+
if (node.kind === "predicate" || node.clauses.some((clause) => clause.occur === "should"))
|
|
24472
|
+
return node;
|
|
24473
|
+
const clauses = node.clauses.flatMap((clause) => {
|
|
24474
|
+
const kept = strip(clause.node);
|
|
24475
|
+
return kept === void 0 ? [] : [{ ...clause, node: kept }];
|
|
24476
|
+
});
|
|
24477
|
+
return clauses.length === 0 ? void 0 : { ...node, clauses };
|
|
24478
|
+
}, "strip");
|
|
24479
|
+
const root = strip(query.root);
|
|
24480
|
+
return root === void 0 ? void 0 : { ...query, root };
|
|
24481
|
+
}, "withoutField");
|
|
24482
|
+
|
|
24483
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
|
|
24243
24484
|
var TASK_RELATION_KINDS = [
|
|
24244
24485
|
"blocked-by",
|
|
24245
24486
|
"follow-up-of",
|
|
@@ -24351,7 +24592,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
|
|
|
24351
24592
|
task: ref3(Number(row2.to_id)),
|
|
24352
24593
|
state: row2.status == null || row2.deleted_at != null || row2.project_deleted != null ? "unavailable" : row2.status === "dismissed" ? "dismissed" : "open"
|
|
24353
24594
|
}));
|
|
24354
|
-
return { ready: liveTask(database, rowId).status
|
|
24595
|
+
return { ready: !isClosedState(String(liveTask(database, rowId).status)) && blockers.length === 0, blockers };
|
|
24355
24596
|
}), "taskReadiness"),
|
|
24356
24597
|
readyTasks: /* @__PURE__ */ __name(async (project, options = {}) => read(database, () => {
|
|
24357
24598
|
const limit = options.limit ?? 50;
|
|
@@ -24360,7 +24601,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
|
|
|
24360
24601
|
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());
|
|
24361
24602
|
if (!row2)
|
|
24362
24603
|
throw new CliError("not_found", "the owner project is unavailable");
|
|
24363
|
-
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
|
|
24604
|
+
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);
|
|
24364
24605
|
return {
|
|
24365
24606
|
items: rows.slice(0, limit).map((value) => ({ id: String(value.id), key: String(value.key), title: String(value.title ?? "") })),
|
|
24366
24607
|
hasMore: rows.length > limit
|
|
@@ -24369,7 +24610,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
|
|
|
24369
24610
|
};
|
|
24370
24611
|
}, "taskRelationsStoreOver");
|
|
24371
24612
|
|
|
24372
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24613
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
|
|
24373
24614
|
var TASK_ROLES = ["assignee", "reviewer", "watcher"];
|
|
24374
24615
|
var TASK_EVENT_KINDS = [
|
|
24375
24616
|
"created",
|
|
@@ -24384,7 +24625,15 @@ var TASK_EVENT_KINDS = [
|
|
|
24384
24625
|
"linked",
|
|
24385
24626
|
"unlinked",
|
|
24386
24627
|
"category",
|
|
24387
|
-
"close-suggestion"
|
|
24628
|
+
"close-suggestion",
|
|
24629
|
+
"agent",
|
|
24630
|
+
"claimed",
|
|
24631
|
+
"released",
|
|
24632
|
+
"next-check",
|
|
24633
|
+
"resolution",
|
|
24634
|
+
"verdict",
|
|
24635
|
+
"close-certainty",
|
|
24636
|
+
"tags"
|
|
24388
24637
|
];
|
|
24389
24638
|
var iso4 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
24390
24639
|
var recordTaskEvent = /* @__PURE__ */ __name((database, task, actor, kind3, changes, at) => {
|
|
@@ -24397,11 +24646,11 @@ var textOf3 = /* @__PURE__ */ __name((value, what, max) => {
|
|
|
24397
24646
|
return text5;
|
|
24398
24647
|
}, "textOf");
|
|
24399
24648
|
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");
|
|
24400
|
-
var
|
|
24401
|
-
if (
|
|
24402
|
-
|
|
24403
|
-
|
|
24404
|
-
}, "
|
|
24649
|
+
var checkRevision = /* @__PURE__ */ __name((row2, expected) => {
|
|
24650
|
+
if (expected === void 0 || Number(row2.revision) === expected)
|
|
24651
|
+
return;
|
|
24652
|
+
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) });
|
|
24653
|
+
}, "checkRevision");
|
|
24405
24654
|
var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
24406
24655
|
const { database, now: now2 } = context;
|
|
24407
24656
|
const required3 = /* @__PURE__ */ __name((id2) => {
|
|
@@ -24411,7 +24660,7 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24411
24660
|
throw new CliError("not_found", `no task ${id2}`);
|
|
24412
24661
|
return row2;
|
|
24413
24662
|
}, "required");
|
|
24414
|
-
const
|
|
24663
|
+
const projectOf2 = /* @__PURE__ */ __name((reference2) => {
|
|
24415
24664
|
if (reference2.startsWith("project:")) {
|
|
24416
24665
|
const thing = requiredThing(database, reference2, "the project");
|
|
24417
24666
|
if (thing.type !== "project")
|
|
@@ -24454,7 +24703,10 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24454
24703
|
description: row2.description == null ? null : String(row2.description),
|
|
24455
24704
|
type: row2.type,
|
|
24456
24705
|
status: row2.status,
|
|
24457
|
-
priority: row2.
|
|
24706
|
+
priority: row2.priority_score == null ? null : Number(row2.priority_score),
|
|
24707
|
+
priorityLabel: priorityLabel(row2.priority_score == null ? null : Number(row2.priority_score)),
|
|
24708
|
+
agent: row2.agent == null ? null : String(row2.agent),
|
|
24709
|
+
revision: Number(row2.revision),
|
|
24458
24710
|
parent: row2.parent_id == null ? null : reference2(Number(row2.parent_id)),
|
|
24459
24711
|
source: row2.source_locator == null ? null : String(row2.source_locator),
|
|
24460
24712
|
dueAt: iso4(row2.due_at),
|
|
@@ -24471,6 +24723,19 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24471
24723
|
updatedAt: iso4(row2.updated_at)
|
|
24472
24724
|
};
|
|
24473
24725
|
}, "detailsOf");
|
|
24726
|
+
const stemmerFor2 = stemmerCache();
|
|
24727
|
+
const touch = /* @__PURE__ */ __name((task, at) => database.prepare("UPDATE tasks SET updated_at = ? WHERE id = ?").run(at, task), "touch");
|
|
24728
|
+
const boardWhere = /* @__PURE__ */ __name((query, zone, at) => {
|
|
24729
|
+
if (query === void 0)
|
|
24730
|
+
return { sql: BOARD_SCOPE, params: [] };
|
|
24731
|
+
const where = queryFilter(query, projectTaskColumns(at), {
|
|
24732
|
+
command: "tasks list",
|
|
24733
|
+
now: at,
|
|
24734
|
+
...zone ? { zone } : {}
|
|
24735
|
+
});
|
|
24736
|
+
return { sql: `${BOARD_SCOPE} AND (${where.sql})`, params: where.params };
|
|
24737
|
+
}, "boardWhere");
|
|
24738
|
+
const countOf = /* @__PURE__ */ __name((where) => Number(database.prepare(`SELECT count(*) AS n FROM tasks t WHERE ${where.sql}`).get(...where.params)?.n ?? 0), "countOf");
|
|
24474
24739
|
const rowById = /* @__PURE__ */ __name((id2) => database.prepare("SELECT * FROM tasks WHERE id = ?").get(id2), "rowById");
|
|
24475
24740
|
const details2 = /* @__PURE__ */ __name((id2) => detailsOf(rowById(id2)), "details");
|
|
24476
24741
|
const edit = /* @__PURE__ */ __name((task, fields4, actor, created = false) => {
|
|
@@ -24478,13 +24743,13 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24478
24743
|
const at = now2();
|
|
24479
24744
|
const set = [];
|
|
24480
24745
|
const values = [];
|
|
24481
|
-
const change = /* @__PURE__ */ __name((column2, value, event) => {
|
|
24746
|
+
const change = /* @__PURE__ */ __name((column2, value, event, key2 = column2) => {
|
|
24482
24747
|
if ((before2[column2] ?? null) === value)
|
|
24483
24748
|
return;
|
|
24484
24749
|
set.push(`${column2} = ?`);
|
|
24485
24750
|
values.push(value);
|
|
24486
24751
|
if (event)
|
|
24487
|
-
recordTaskEvent(database, task, actor, event, { [
|
|
24752
|
+
recordTaskEvent(database, task, actor, event, { [key2]: [before2[column2] ?? null, value] }, at);
|
|
24488
24753
|
}, "change");
|
|
24489
24754
|
if (fields4.title !== void 0) {
|
|
24490
24755
|
const title = textOf3(fields4.title, "a task's title", 300);
|
|
@@ -24493,23 +24758,35 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24493
24758
|
}
|
|
24494
24759
|
if (fields4.description !== void 0)
|
|
24495
24760
|
change("description", fields4.description === null ? null : textOf3(fields4.description, "a description", 2e4), created ? void 0 : "description");
|
|
24496
|
-
if (fields4.priority !== void 0)
|
|
24497
|
-
|
|
24761
|
+
if (fields4.priority !== void 0) {
|
|
24762
|
+
const score = fields4.priority === null ? null : checkedScore(fields4.priority);
|
|
24763
|
+
change("priority_score", score, "priority", "priority");
|
|
24764
|
+
change("priority", legacyPriority(score));
|
|
24765
|
+
}
|
|
24766
|
+
if (fields4.agent !== void 0)
|
|
24767
|
+
change("agent", fields4.agent === null ? null : textOf3(fields4.agent, "an agent's name", 100), "agent");
|
|
24498
24768
|
if (fields4.parent !== void 0)
|
|
24499
24769
|
change("parent_id", fields4.parent === null ? null : parentOf(task, Number(before2.project_id), fields4.parent));
|
|
24500
24770
|
if (fields4.dueAt !== void 0)
|
|
24501
24771
|
change("due_at", fields4.dueAt === null ? null : fields4.dueAt.getTime(), "due");
|
|
24502
24772
|
if (fields4.nextCheckAt !== void 0)
|
|
24503
|
-
change("next_check_at", fields4.nextCheckAt === null ? null : fields4.nextCheckAt.getTime());
|
|
24773
|
+
change("next_check_at", fields4.nextCheckAt === null ? null : fields4.nextCheckAt.getTime(), "next-check");
|
|
24504
24774
|
if (fields4.status !== void 0) {
|
|
24505
24775
|
if (!TASK_STATES.includes(fields4.status))
|
|
24506
24776
|
throw new CliError("validation_error", `a task's status is one of ${TASK_STATES.join(", ")}`);
|
|
24507
|
-
|
|
24777
|
+
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)
|
|
24778
|
+
throw new CliError("validation_error", "a task from a message is open, done or dismissed; todo and in_progress are for a project task");
|
|
24779
|
+
const closed = isClosedState(fields4.status);
|
|
24780
|
+
const reopened = !closed && isClosedState(String(before2.status));
|
|
24508
24781
|
if (before2.status !== fields4.status) {
|
|
24509
24782
|
change("status", fields4.status, "status");
|
|
24510
|
-
|
|
24511
|
-
|
|
24512
|
-
|
|
24783
|
+
if (fields4.status === "in_progress" && before2.started_at == null)
|
|
24784
|
+
change("started_at", at);
|
|
24785
|
+
if (closed || reopened) {
|
|
24786
|
+
change("closed_at", closed ? at : null);
|
|
24787
|
+
change("closed_by_type", closed ? actor.type : null);
|
|
24788
|
+
change("closed_by_id", closed ? actor.id : null);
|
|
24789
|
+
}
|
|
24513
24790
|
if (closed) {
|
|
24514
24791
|
change("claimed_by", null);
|
|
24515
24792
|
change("claimed_until", null);
|
|
@@ -24517,6 +24794,10 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24517
24794
|
change(column2, null);
|
|
24518
24795
|
} else
|
|
24519
24796
|
change("close_certainty", null);
|
|
24797
|
+
if (reopened && fields4.reason === void 0) {
|
|
24798
|
+
change("close_reason", null);
|
|
24799
|
+
change("close_reason_folded", null);
|
|
24800
|
+
}
|
|
24520
24801
|
}
|
|
24521
24802
|
}
|
|
24522
24803
|
if (fields4.reason !== void 0) {
|
|
@@ -24530,13 +24811,71 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24530
24811
|
return;
|
|
24531
24812
|
database.prepare(`UPDATE tasks SET ${set.join(", ")}, updated_at = ? WHERE id = ?`).run(...values, at, task);
|
|
24532
24813
|
}, "edit");
|
|
24814
|
+
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");
|
|
24815
|
+
const moveTask = /* @__PURE__ */ __name((task, row2, move2, actor) => {
|
|
24816
|
+
if (move2.before !== void 0 && move2.after !== void 0)
|
|
24817
|
+
throw new CliError("validation_error", "give --before or --after, not both");
|
|
24818
|
+
if (!database.prepare(`SELECT 1 FROM tasks t WHERE t.id = ? AND ${BOARD_SCOPE}`).get(task))
|
|
24819
|
+
throw new CliError("validation_error", "only a project task moves on the board");
|
|
24820
|
+
const neighbour = move2.before ?? move2.after;
|
|
24821
|
+
if (neighbour === void 0) {
|
|
24822
|
+
const status2 = move2.status ?? row2.status;
|
|
24823
|
+
if (columnOf(task, status2).length > 0 || move2.status === void 0)
|
|
24824
|
+
throw new CliError("validation_error", "say where it goes: --before <key> or --after <key>");
|
|
24825
|
+
const from3 = priorityLabel(row2.priority_score == null ? null : Number(row2.priority_score));
|
|
24826
|
+
edit(task, { status: move2.status }, actor);
|
|
24827
|
+
return { label: { from: from3, to: from3, changed: false }, renumbered: [] };
|
|
24828
|
+
}
|
|
24829
|
+
const target = required3(neighbour);
|
|
24830
|
+
const anchor = database.prepare(`SELECT t.key, t.status FROM tasks t WHERE t.id = ? AND ${BOARD_SCOPE}`).get(target);
|
|
24831
|
+
if (target === task)
|
|
24832
|
+
throw new CliError("validation_error", "a task moves beside another task, not itself");
|
|
24833
|
+
if (!anchor)
|
|
24834
|
+
throw new CliError("validation_error", `${neighbour} is not on a project's board`);
|
|
24835
|
+
const status = anchor.status;
|
|
24836
|
+
if (move2.status !== void 0 && move2.status !== status)
|
|
24837
|
+
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 });
|
|
24838
|
+
const column2 = columnOf(task, status);
|
|
24839
|
+
const at = column2.findIndex(({ id: id2 }) => id2 === target);
|
|
24840
|
+
const index2 = move2.before === void 0 ? at + 1 : at;
|
|
24841
|
+
const above = column2[index2 - 1];
|
|
24842
|
+
const below = column2[index2];
|
|
24843
|
+
const STEP = 1 / 64;
|
|
24844
|
+
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;
|
|
24845
|
+
const roomy = (above === void 0 || score < above.score) && (below === void 0 || score > below.score);
|
|
24846
|
+
const from2 = priorityLabel(row2.priority_score == null ? null : Number(row2.priority_score));
|
|
24847
|
+
const renumbered = [];
|
|
24848
|
+
let given = score;
|
|
24849
|
+
if (!roomy || above !== void 0 && below !== void 0 && above.score - below.score < 1e-9) {
|
|
24850
|
+
const label = priorityLabel((above ?? below)?.score ?? 0);
|
|
24851
|
+
const band = priorityBand(label);
|
|
24852
|
+
const inBand = /* @__PURE__ */ __name((one) => priorityLabel(one.score) === label, "inBand");
|
|
24853
|
+
const ordered = [...column2.slice(0, index2), { id: task, key: String(row2.key), score }, ...column2.slice(index2)];
|
|
24854
|
+
const spread = ordered.filter((one) => one.id === task || inBand(one));
|
|
24855
|
+
const gap = (band.to - band.from) / (spread.length + 1);
|
|
24856
|
+
spread.forEach((one, place) => {
|
|
24857
|
+
const value = band.to - gap * (place + 1);
|
|
24858
|
+
if (one.id === task) {
|
|
24859
|
+
given = value;
|
|
24860
|
+
return;
|
|
24861
|
+
}
|
|
24862
|
+
if (one.score === value)
|
|
24863
|
+
return;
|
|
24864
|
+
edit(one.id, { priority: value }, actor);
|
|
24865
|
+
renumbered.push(one.key);
|
|
24866
|
+
});
|
|
24867
|
+
}
|
|
24868
|
+
edit(task, { priority: given, status }, actor);
|
|
24869
|
+
const to = priorityLabel(given);
|
|
24870
|
+
return { label: { from: from2, to, changed: from2 !== to }, renumbered };
|
|
24871
|
+
}, "moveTask");
|
|
24533
24872
|
return {
|
|
24534
24873
|
...taskRelationsStoreOver(context, (task, actor, kind3, changes, at) => recordTaskEvent(database, task, actor, kind3, changes, at)),
|
|
24535
24874
|
create: /* @__PURE__ */ __name((input, by) => {
|
|
24536
24875
|
if (!WORK_TASK_TYPES.includes(input.type))
|
|
24537
24876
|
throw new CliError("validation_error", `a task made here is one of ${WORK_TASK_TYPES.join(", ")}`);
|
|
24538
24877
|
const made = write(database, () => {
|
|
24539
|
-
const project =
|
|
24878
|
+
const project = projectOf2(input.project);
|
|
24540
24879
|
const { actor } = authorActor(context, by);
|
|
24541
24880
|
const at = now2();
|
|
24542
24881
|
const counted = database.prepare("UPDATE projects SET tasks_count = tasks_count + 1, updated_at = ? WHERE id = ? RETURNING key, tasks_count").get(at, project);
|
|
@@ -24551,22 +24890,36 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24551
24890
|
});
|
|
24552
24891
|
return details2(made);
|
|
24553
24892
|
}, "create"),
|
|
24554
|
-
edit: /* @__PURE__ */ __name(async (id2, fields4, by) => {
|
|
24893
|
+
edit: /* @__PURE__ */ __name(async (id2, fields4, by, check3 = {}) => {
|
|
24555
24894
|
const task = required3(id2);
|
|
24556
|
-
write(database, () =>
|
|
24895
|
+
write(database, () => {
|
|
24896
|
+
checkRevision(rowById(task), check3.revision);
|
|
24897
|
+
edit(task, fields4, authorActor(context, by).actor);
|
|
24898
|
+
});
|
|
24557
24899
|
return details2(task);
|
|
24558
24900
|
}, "edit"),
|
|
24559
|
-
|
|
24901
|
+
move: /* @__PURE__ */ __name(async (id2, move2, by, check3 = {}) => {
|
|
24902
|
+
const task = required3(id2);
|
|
24903
|
+
return write(database, () => {
|
|
24904
|
+
const row2 = rowById(task);
|
|
24905
|
+
checkRevision(row2, check3.revision);
|
|
24906
|
+
const moved = moveTask(task, row2, move2, authorActor(context, by).actor);
|
|
24907
|
+
return { ...moved, task: details2(task) };
|
|
24908
|
+
});
|
|
24909
|
+
}, "move"),
|
|
24910
|
+
assign: /* @__PURE__ */ __name((id2, { to, role }, by, check3 = {}) => {
|
|
24560
24911
|
if (!TASK_ROLES.includes(role))
|
|
24561
24912
|
throw new CliError("validation_error", `a role is one of ${TASK_ROLES.join(", ")}`);
|
|
24562
24913
|
const task = required3(id2);
|
|
24563
24914
|
write(database, () => {
|
|
24915
|
+
checkRevision(rowById(task), check3.revision);
|
|
24564
24916
|
const person2 = personOf2(to);
|
|
24565
24917
|
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);
|
|
24566
24918
|
if (held)
|
|
24567
24919
|
return;
|
|
24568
24920
|
const at = now2();
|
|
24569
24921
|
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);
|
|
24922
|
+
touch(task, at);
|
|
24570
24923
|
const changes = { [role]: [null, `person:${person2}`] };
|
|
24571
24924
|
recordTaskEvent(database, task, authorActor(context, by).actor, "assigned", changes, at);
|
|
24572
24925
|
});
|
|
@@ -24587,15 +24940,18 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24587
24940
|
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);
|
|
24588
24941
|
return row2 ? `person:${String(row2.id)}` : void 0;
|
|
24589
24942
|
}, "sourceSender"),
|
|
24590
|
-
unassign: /* @__PURE__ */ __name(async (id2, { to, role }, by) => {
|
|
24943
|
+
unassign: /* @__PURE__ */ __name(async (id2, { to, role }, by, check3 = {}) => {
|
|
24591
24944
|
const task = required3(id2);
|
|
24592
24945
|
write(database, () => {
|
|
24946
|
+
checkRevision(rowById(task), check3.revision);
|
|
24593
24947
|
const person2 = personOf2(to);
|
|
24594
24948
|
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;
|
|
24595
24949
|
if (removed === 0)
|
|
24596
24950
|
return;
|
|
24951
|
+
const at = now2();
|
|
24952
|
+
touch(task, at);
|
|
24597
24953
|
const changes = { [role]: [`person:${person2}`, null] };
|
|
24598
|
-
recordTaskEvent(database, task, authorActor(context, by).actor, "unassigned", changes,
|
|
24954
|
+
recordTaskEvent(database, task, authorActor(context, by).actor, "unassigned", changes, at);
|
|
24599
24955
|
});
|
|
24600
24956
|
return details2(task);
|
|
24601
24957
|
}, "unassign"),
|
|
@@ -24610,17 +24966,23 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24610
24966
|
find: /* @__PURE__ */ __name(async ({ project, type, status, assignee, where, limit = 100 }) => {
|
|
24611
24967
|
if (type !== void 0 && !TASK_TYPES.includes(type))
|
|
24612
24968
|
throw new CliError("validation_error", `a task's type is one of ${TASK_TYPES.join(", ")}`);
|
|
24613
|
-
const
|
|
24969
|
+
const projectId2 = project === void 0 ? null : projectOf2(project);
|
|
24614
24970
|
const person2 = assignee === void 0 ? null : personOf2(assignee);
|
|
24615
|
-
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
|
|
24971
|
+
return database.prepare(`SELECT * FROM tasks t WHERE deleted_at IS NULL AND (? IS NULL OR project_id = ?) AND (? IS NULL OR type = ?) AND (? IS NULL OR status = ?) AND (? IS NULL OR EXISTS (SELECT 1 FROM task_assignments a WHERE a.task_id = t.id AND a.assignee_type = 'person' AND a.assignee_id = ?)) AND (${where?.sql || "1"}) ORDER BY priority_score IS NULL, priority_score DESC, created_at, id LIMIT ?`).all(projectId2, projectId2, type ?? null, type ?? null, status ?? null, status ?? null, person2, person2, ...where?.params ?? [], Math.min(Math.max(limit, 1), 500)).map(detailsOf);
|
|
24616
24972
|
}, "find"),
|
|
24617
24973
|
claim: /* @__PURE__ */ __name(async (id2, holder, until) => {
|
|
24618
24974
|
const task = required3(id2);
|
|
24619
24975
|
const at = now2();
|
|
24620
|
-
const won = write(database, () =>
|
|
24976
|
+
const won = write(database, () => {
|
|
24977
|
+
const before2 = claimOf(rowById(task), at).claimedBy;
|
|
24978
|
+
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);
|
|
24979
|
+
if (claimed)
|
|
24980
|
+
recordTaskEvent(database, task, null, "claimed", { claimed_by: [before2, holder] }, at);
|
|
24981
|
+
return claimed;
|
|
24982
|
+
});
|
|
24621
24983
|
if (!won) {
|
|
24622
24984
|
const row2 = rowById(task);
|
|
24623
|
-
if (row2.status
|
|
24985
|
+
if (isClosedState(String(row2.status)))
|
|
24624
24986
|
throw new CliError("validation_error", `task ${String(row2.key)} is ${String(row2.status)}; only an open task is claimed`);
|
|
24625
24987
|
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) });
|
|
24626
24988
|
}
|
|
@@ -24635,13 +24997,66 @@ var workTaskOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
24635
24997
|
throw new CliError("validation_error", `${claimedBy} holds task ${String(row2.key)}; only they or the owner release it`, {
|
|
24636
24998
|
reason: "task.claimed"
|
|
24637
24999
|
});
|
|
24638
|
-
|
|
25000
|
+
const at = now2();
|
|
25001
|
+
database.prepare("UPDATE tasks SET claimed_by = NULL, claimed_until = NULL, updated_at = ? WHERE id = ?").run(at, task);
|
|
25002
|
+
if (claimedBy !== null)
|
|
25003
|
+
recordTaskEvent(database, task, null, "released", { claimed_by: [claimedBy, null] }, at);
|
|
24639
25004
|
});
|
|
24640
25005
|
return details2(task);
|
|
24641
25006
|
}, "release"),
|
|
24642
|
-
|
|
25007
|
+
board: /* @__PURE__ */ __name(async (query, { limit, offset = 0, sort = "priority", descending = false, zone }) => {
|
|
25008
|
+
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 500)
|
|
25009
|
+
throw new CliError("validation_error", "a page of tasks holds 1\u2013500");
|
|
25010
|
+
drainCorpus(database, CORPORA.task, stemmerFor2);
|
|
25011
|
+
const where = boardWhere(query, zone, now2());
|
|
25012
|
+
const rows = database.prepare(`SELECT t.* FROM tasks t WHERE ${where.sql} ORDER BY ${boardOrder(sort, descending)} LIMIT ? OFFSET ?`).all(...where.params, limit, offset);
|
|
25013
|
+
return { items: rows.map(detailsOf), total: countOf(where) };
|
|
25014
|
+
}, "board"),
|
|
25015
|
+
boardCounts: /* @__PURE__ */ __name(async (query, { zone } = {}) => {
|
|
25016
|
+
drainCorpus(database, CORPORA.task, stemmerFor2);
|
|
25017
|
+
const at = now2();
|
|
25018
|
+
const without = /* @__PURE__ */ __name((name) => boardWhere(withoutField(query, name), zone, at), "without");
|
|
25019
|
+
const grouped = /* @__PURE__ */ __name((name, select2, from2, group) => {
|
|
25020
|
+
const where = without(name);
|
|
25021
|
+
return database.prepare(`SELECT ${select2}, count(*) AS n FROM tasks t ${from2} WHERE ${where.sql} GROUP BY ${group}`).all(...where.params);
|
|
25022
|
+
}, "grouped");
|
|
25023
|
+
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));
|
|
25024
|
+
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");
|
|
25025
|
+
const assignee = assigned.map((row2) => ({
|
|
25026
|
+
value: row2.person == null ? "none" : `person:${row2.person}`,
|
|
25027
|
+
name: row2.name == null ? null : String(row2.name),
|
|
25028
|
+
count: Number(row2.n)
|
|
25029
|
+
})).sort((a, b) => b.count - a.count || a.value.localeCompare(b.value));
|
|
25030
|
+
const priorities = /* @__PURE__ */ new Map();
|
|
25031
|
+
for (const row2 of grouped("priority", "t.priority_score", "", "t.priority_score")) {
|
|
25032
|
+
const label = priorityLabel(row2.priority_score == null ? null : Number(row2.priority_score)) ?? "none";
|
|
25033
|
+
priorities.set(label, (priorities.get(label) ?? 0) + Number(row2.n));
|
|
25034
|
+
}
|
|
25035
|
+
const states = new Map(grouped("state", "t.status", "", "t.status").map((row2) => [row2.status, Number(row2.n)]));
|
|
25036
|
+
return {
|
|
25037
|
+
total: countOf(boardWhere(query, zone, at)),
|
|
25038
|
+
project,
|
|
25039
|
+
assignee,
|
|
25040
|
+
priority: [...[...PRIORITY_LABELS].reverse(), "none"].map((value) => ({
|
|
25041
|
+
value,
|
|
25042
|
+
count: priorities.get(value) ?? 0
|
|
25043
|
+
})),
|
|
25044
|
+
state: TASK_STATES.map((value) => ({ value, count: states.get(value) ?? 0 }))
|
|
25045
|
+
};
|
|
25046
|
+
}, "boardCounts"),
|
|
25047
|
+
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) => ({
|
|
25048
|
+
person: `person:${row2.id}`,
|
|
25049
|
+
name: row2.name == null ? null : String(row2.name),
|
|
25050
|
+
owner: Number(row2.owner) === 1,
|
|
25051
|
+
tasks: Number(row2.n)
|
|
25052
|
+
})), "taskPeople"),
|
|
25053
|
+
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) => ({
|
|
24643
25054
|
kind: row2.kind,
|
|
24644
|
-
actor: row2.actor_type == null ? null : {
|
|
25055
|
+
actor: row2.actor_type == null ? null : {
|
|
25056
|
+
type: row2.actor_type,
|
|
25057
|
+
id: Number(row2.actor_id),
|
|
25058
|
+
name: row2.actor_name == null ? null : String(row2.actor_name)
|
|
25059
|
+
},
|
|
24645
25060
|
changes: row2.changes == null ? null : JSON.parse(String(row2.changes)),
|
|
24646
25061
|
at: iso4(row2.created_at)
|
|
24647
25062
|
})), "events")
|
|
@@ -24652,11 +25067,11 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
|
|
|
24652
25067
|
return {
|
|
24653
25068
|
...operations,
|
|
24654
25069
|
create: /* @__PURE__ */ __name(async (input, by) => operations.create(input, by), "create"),
|
|
24655
|
-
assign: /* @__PURE__ */ __name(async (id2, assignment, by) => operations.assign(id2, assignment, by), "assign")
|
|
25070
|
+
assign: /* @__PURE__ */ __name(async (id2, assignment, by, check3) => operations.assign(id2, assignment, by, check3), "assign")
|
|
24656
25071
|
};
|
|
24657
25072
|
}, "workTasksOver");
|
|
24658
25073
|
|
|
24659
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25074
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
|
|
24660
25075
|
var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
24661
25076
|
const { database, now: now2 } = context;
|
|
24662
25077
|
const liveRow = /* @__PURE__ */ __name((id2) => {
|
|
@@ -24674,7 +25089,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
|
24674
25089
|
closeSuggestion: /* @__PURE__ */ __name(async (id2) => closeSuggestionOf(database, liveRow(id2)), "closeSuggestion"),
|
|
24675
25090
|
suggestClose: /* @__PURE__ */ __name(async (id2, suggestion, by) => write(database, () => {
|
|
24676
25091
|
const row2 = liveRow(id2);
|
|
24677
|
-
if (row2.status
|
|
25092
|
+
if (isClosedState(String(row2.status)))
|
|
24678
25093
|
throw new CliError("validation_error", `task ${String(row2.key)} is already ${String(row2.status)}`, {
|
|
24679
25094
|
reason: "task.closed"
|
|
24680
25095
|
});
|
|
@@ -24697,12 +25112,15 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
|
24697
25112
|
}), "suggestClose"),
|
|
24698
25113
|
recordCloseCertainty: /* @__PURE__ */ __name(async (id2, certainty) => write(database, () => {
|
|
24699
25114
|
const row2 = liveRow(id2);
|
|
24700
|
-
|
|
25115
|
+
const value = certaintyOf(certainty);
|
|
25116
|
+
database.prepare("UPDATE tasks SET close_certainty = ? WHERE id = ?").run(value, Number(row2.id));
|
|
25117
|
+
if ((row2.close_certainty ?? null) !== value)
|
|
25118
|
+
recordTaskEvent(database, Number(row2.id), null, "close-certainty", { close_certainty: [row2.close_certainty ?? null, value] }, now2());
|
|
24701
25119
|
}), "recordCloseCertainty")
|
|
24702
25120
|
};
|
|
24703
25121
|
}, "taskCloseOver");
|
|
24704
25122
|
|
|
24705
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25123
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
|
|
24706
25124
|
var TASK_PAIR_DECISIONS = ["review", "unsure", "merged", "rejected", "unmerged", "attached", "new"];
|
|
24707
25125
|
var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
24708
25126
|
const { database, now: now2 } = context;
|
|
@@ -24790,7 +25208,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
|
24790
25208
|
}, "linkMessage");
|
|
24791
25209
|
const followUp = /* @__PURE__ */ __name(async (row2, candidates, by) => write(database, () => {
|
|
24792
25210
|
for (const one of candidates) {
|
|
24793
|
-
if (one.status
|
|
25211
|
+
if (!isClosedState(one.status) || one.band === "different")
|
|
24794
25212
|
continue;
|
|
24795
25213
|
const closed = required3(one.key);
|
|
24796
25214
|
if (mergedInto(closed))
|
|
@@ -24810,7 +25228,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
|
24810
25228
|
const alike = (await similarity.similar({ task: String(row2.key) }, { limit: 40 })).filter((one) => one.band !== "different");
|
|
24811
25229
|
if (!linked)
|
|
24812
25230
|
await followUp(row2, alike, { bot: "rule" });
|
|
24813
|
-
const found2 = linked ? alike : alike.filter((one) => one.status
|
|
25231
|
+
const found2 = linked ? alike : alike.filter((one) => !isClosedState(one.status));
|
|
24814
25232
|
if (found2.length === 0)
|
|
24815
25233
|
return 0;
|
|
24816
25234
|
return write(database, () => {
|
|
@@ -24859,7 +25277,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
|
24859
25277
|
const a = required3(dup);
|
|
24860
25278
|
const b = required3(into);
|
|
24861
25279
|
sameInbox(a, b);
|
|
24862
|
-
if (a.status
|
|
25280
|
+
if (isClosedState(String(a.status)))
|
|
24863
25281
|
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" });
|
|
24864
25282
|
const onward = mergedInto(b);
|
|
24865
25283
|
if (onward)
|
|
@@ -24921,7 +25339,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
|
24921
25339
|
};
|
|
24922
25340
|
}, "taskPairsOver");
|
|
24923
25341
|
|
|
24924
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25342
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
|
|
24925
25343
|
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";
|
|
24926
25344
|
var taskStoreOver = /* @__PURE__ */ __name((context) => {
|
|
24927
25345
|
const { database, now: now2 } = context;
|
|
@@ -25049,8 +25467,8 @@ var taskStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25049
25467
|
write(database, () => {
|
|
25050
25468
|
const before2 = database.prepare("SELECT status, due_at FROM tasks WHERE id = ?").get(row2);
|
|
25051
25469
|
const at = now2();
|
|
25052
|
-
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 ?
|
|
25053
|
-
if (task.state
|
|
25470
|
+
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);
|
|
25471
|
+
if (isClosedState(task.state))
|
|
25054
25472
|
database.prepare(`UPDATE tasks SET ${CLEAR_SUGGESTION} WHERE id = ?`).run(row2);
|
|
25055
25473
|
if (before2.status !== task.state)
|
|
25056
25474
|
recordTaskEvent(database, row2, closedBy ?? null, "status", { status: [before2.status, task.state] }, at);
|
|
@@ -25066,7 +25484,10 @@ var taskStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25066
25484
|
const row2 = required3(id2);
|
|
25067
25485
|
const at = now2();
|
|
25068
25486
|
write(database, () => {
|
|
25487
|
+
const before2 = database.prepare("SELECT resolution FROM tasks WHERE id = ?").get(row2)?.resolution ?? null;
|
|
25069
25488
|
database.prepare("UPDATE tasks SET resolution = ?, updated_at = ? WHERE id = ?").run(text5, at, row2);
|
|
25489
|
+
if (before2 !== text5)
|
|
25490
|
+
recordTaskEvent(database, row2, null, "resolution", { resolution: [before2, text5] }, at);
|
|
25070
25491
|
if (!by)
|
|
25071
25492
|
return;
|
|
25072
25493
|
database.prepare(`DELETE FROM links WHERE from_type = 'task' AND from_id = ? AND kind = ${linkKind("answered-by")}`).run(row2);
|
|
@@ -25077,7 +25498,14 @@ var taskStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25077
25498
|
judge: /* @__PURE__ */ __name(async (id2, verdict) => {
|
|
25078
25499
|
if (verdict !== null && !TASK_VERDICTS.includes(verdict))
|
|
25079
25500
|
throw new CliError("validation_error", `a verdict is one of ${TASK_VERDICTS.join(", ")}`);
|
|
25080
|
-
|
|
25501
|
+
const row2 = required3(id2);
|
|
25502
|
+
write(database, () => {
|
|
25503
|
+
const at = now2();
|
|
25504
|
+
const before2 = database.prepare("SELECT verdict FROM tasks WHERE id = ?").get(row2)?.verdict ?? null;
|
|
25505
|
+
database.prepare("UPDATE tasks SET verdict = ?, updated_at = ? WHERE id = ?").run(verdict, at, row2);
|
|
25506
|
+
if (before2 !== verdict)
|
|
25507
|
+
recordTaskEvent(database, row2, null, "verdict", { verdict: [before2, verdict] }, at);
|
|
25508
|
+
});
|
|
25081
25509
|
}, "judge")
|
|
25082
25510
|
};
|
|
25083
25511
|
}, "taskStoreOver");
|
|
@@ -25116,7 +25544,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
|
|
|
25116
25544
|
throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
|
|
25117
25545
|
}, "oneOf");
|
|
25118
25546
|
|
|
25119
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25547
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/accounts.js
|
|
25120
25548
|
var accountAccountsOver = /* @__PURE__ */ __name((context) => {
|
|
25121
25549
|
const { database } = context;
|
|
25122
25550
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
|
|
@@ -25161,7 +25589,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
|
|
|
25161
25589
|
};
|
|
25162
25590
|
}, "accountsStoreOver");
|
|
25163
25591
|
|
|
25164
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25592
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
|
|
25165
25593
|
var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
|
|
25166
25594
|
var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
|
|
25167
25595
|
const message2 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
|
|
@@ -25185,7 +25613,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
|
|
|
25185
25613
|
})), "keepDownloads");
|
|
25186
25614
|
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");
|
|
25187
25615
|
|
|
25188
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25616
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/attachments.js
|
|
25189
25617
|
var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
|
|
25190
25618
|
const { database } = context;
|
|
25191
25619
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -25242,7 +25670,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
25242
25670
|
}, "keepAttachmentText")
|
|
25243
25671
|
}), "attachmentsStoreOver");
|
|
25244
25672
|
|
|
25245
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25673
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
|
|
25246
25674
|
var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
|
|
25247
25675
|
var pointerMover = /* @__PURE__ */ __name((context, type) => {
|
|
25248
25676
|
const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
|
|
@@ -25389,14 +25817,14 @@ var moveChat = /* @__PURE__ */ __name((context, key2, accountKey, old, twin, fro
|
|
|
25389
25817
|
throw new CliError("validation_error", `a ${String(old.kind)} and a ${String(twin.kind)} are not one chat`);
|
|
25390
25818
|
const strict = stricterPrivacy(context, accountKey, privacyOf(old), privacyOf(twin));
|
|
25391
25819
|
moved = absorb(context, kept, Number(twin.id));
|
|
25392
|
-
const fields4 = MESSENGER_FIELDS.map((
|
|
25820
|
+
const fields4 = MESSENGER_FIELDS.map((field4) => `${field4} = coalesce(?, ${field4})`).join(", ");
|
|
25393
25821
|
context.database.prepare(
|
|
25394
25822
|
// Left only when both were: a complete chat list that named the new id before the re-key marked the old one.
|
|
25395
25823
|
`UPDATE chats SET ${fields4}, kind = CASE WHEN kind = 'unknown' THEN ? ELSE kind END,
|
|
25396
25824
|
membership_state = CASE WHEN ? IS NULL THEN nullif(membership_state, 'left') ELSE coalesce(nullif(?, 'left'), membership_state) END,
|
|
25397
25825
|
muted_until = CASE WHEN ? IS NULL THEN muted_until ELSE ? END,
|
|
25398
25826
|
searchable = ?, scope = ?, last_message_at = ?, updated_at = ? WHERE id = ?`
|
|
25399
|
-
).run(...MESSENGER_FIELDS.map((
|
|
25827
|
+
).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);
|
|
25400
25828
|
}
|
|
25401
25829
|
context.database.prepare("UPDATE chats SET external_id = ?, updated_at = ? WHERE id = ?").run(to, context.now(), kept);
|
|
25402
25830
|
renameText(context, key2, accountKey, from2, to);
|
|
@@ -25422,7 +25850,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
|
|
|
25422
25850
|
return done;
|
|
25423
25851
|
}, "rekeyChats");
|
|
25424
25852
|
|
|
25425
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25853
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
|
|
25426
25854
|
var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
|
|
25427
25855
|
var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
|
|
25428
25856
|
var CHAT_LIST_KEY = "chat_list_complete";
|
|
@@ -25454,7 +25882,7 @@ var chatCompleteness = /* @__PURE__ */ __name(({ database }, accountKey, chatIds
|
|
|
25454
25882
|
});
|
|
25455
25883
|
}, "chatCompleteness");
|
|
25456
25884
|
|
|
25457
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25885
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/chats.js
|
|
25458
25886
|
var chatsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
25459
25887
|
const { database } = context;
|
|
25460
25888
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
|
|
@@ -25561,7 +25989,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25561
25989
|
};
|
|
25562
25990
|
}, "chatsStoreOver");
|
|
25563
25991
|
|
|
25564
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25992
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
|
|
25565
25993
|
import { createHash as createHash6 } from "node:crypto";
|
|
25566
25994
|
var BATCH_CONTEXT = 50;
|
|
25567
25995
|
var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
|
|
@@ -25699,7 +26127,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
|
|
|
25699
26127
|
var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
|
|
25700
26128
|
${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
|
|
25701
26129
|
|
|
25702
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26130
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
|
|
25703
26131
|
import { setTimeout } from "node:timers/promises";
|
|
25704
26132
|
var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
|
|
25705
26133
|
var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
|
|
@@ -26011,7 +26439,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
|
|
|
26011
26439
|
AND NOT EXISTS (SELECT 1 FROM messages d
|
|
26012
26440
|
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");
|
|
26013
26441
|
|
|
26014
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26442
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/conversations.js
|
|
26015
26443
|
var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
26016
26444
|
const { database } = context;
|
|
26017
26445
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -26118,7 +26546,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
26118
26546
|
};
|
|
26119
26547
|
}, "conversationsStoreOver");
|
|
26120
26548
|
|
|
26121
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26549
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/counters.js
|
|
26122
26550
|
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";
|
|
26123
26551
|
var accountCountersOver = /* @__PURE__ */ __name((context) => {
|
|
26124
26552
|
const { database } = context;
|
|
@@ -26143,7 +26571,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
26143
26571
|
counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
|
|
26144
26572
|
}), "countersStoreOver");
|
|
26145
26573
|
|
|
26146
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26574
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
|
|
26147
26575
|
var MENTION_STATUSES = ["found", "linked", "dismissed"];
|
|
26148
26576
|
var MENTION_QUERY = defineQuery({
|
|
26149
26577
|
entity: "mention",
|
|
@@ -26359,7 +26787,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
|
|
|
26359
26787
|
return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
|
|
26360
26788
|
}, "listPlaces");
|
|
26361
26789
|
|
|
26362
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26790
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/mentions.js
|
|
26363
26791
|
var accountMentionsOver = /* @__PURE__ */ __name((context) => {
|
|
26364
26792
|
const { database } = context;
|
|
26365
26793
|
const { findAccountPk: findAccountPk2 } = keysOver(context);
|
|
@@ -26394,7 +26822,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
26394
26822
|
places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
|
|
26395
26823
|
}), "mentionsStoreOver");
|
|
26396
26824
|
|
|
26397
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26825
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
|
|
26398
26826
|
var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
|
|
26399
26827
|
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");
|
|
26400
26828
|
const rows = messageId === void 0 ? read2.all(chatKey) : read2.all(chatKey, messageId);
|
|
@@ -26409,7 +26837,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
|
|
|
26409
26837
|
}));
|
|
26410
26838
|
}, "documentLinkMessages");
|
|
26411
26839
|
|
|
26412
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26840
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
|
|
26413
26841
|
var stemmerFor = stemmerCache();
|
|
26414
26842
|
var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
|
|
26415
26843
|
if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
|
|
@@ -26453,7 +26881,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
|
|
|
26453
26881
|
});
|
|
26454
26882
|
}, "laterSharingRare");
|
|
26455
26883
|
|
|
26456
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26884
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/messages.js
|
|
26457
26885
|
var accountMessagesOver = /* @__PURE__ */ __name((context) => {
|
|
26458
26886
|
const { database } = context;
|
|
26459
26887
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
|
|
@@ -26588,7 +27016,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
26588
27016
|
laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
|
|
26589
27017
|
}), "messagesStoreOver");
|
|
26590
27018
|
|
|
26591
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27019
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
|
|
26592
27020
|
var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
|
|
26593
27021
|
var iso5 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
26594
27022
|
var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: accounts2, limit }) => {
|
|
@@ -26628,7 +27056,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
|
|
|
26628
27056
|
}));
|
|
26629
27057
|
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
|
|
26630
27058
|
FROM task_assignments ta JOIN tasks t ON t.id=ta.task_id JOIN main.projects p ON p.id=t.project_id
|
|
26631
|
-
WHERE ta.assignee_type='person' AND ta.assignee_id=? AND t.deleted_at IS NULL AND t.status
|
|
27059
|
+
WHERE ta.assignee_type='person' AND ta.assignee_id=? AND t.deleted_at IS NULL AND t.status NOT IN ('done','dismissed')
|
|
26632
27060
|
AND p.deleted_at IS NULL AND (p.account_id IS NULL OR p.account_id IN (SELECT a.id FROM accounts a
|
|
26633
27061
|
JOIN json_each(?) k ON a.provider=json_extract(k.value,'$.provider')
|
|
26634
27062
|
AND a.external_id=json_extract(k.value,'$.account')))
|
|
@@ -26645,7 +27073,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
|
|
|
26645
27073
|
});
|
|
26646
27074
|
}, "personPreparation");
|
|
26647
27075
|
|
|
26648
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27076
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
|
|
26649
27077
|
var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
|
|
26650
27078
|
const id2 = Number(uid);
|
|
26651
27079
|
if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
|
|
@@ -26653,7 +27081,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
|
|
|
26653
27081
|
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)));
|
|
26654
27082
|
}, "personSeenInAccounts");
|
|
26655
27083
|
|
|
26656
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27084
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
|
|
26657
27085
|
var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
|
|
26658
27086
|
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);
|
|
26659
27087
|
if (!row2)
|
|
@@ -26719,7 +27147,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
|
|
|
26719
27147
|
return { id: id2, personId, removed: true };
|
|
26720
27148
|
}, "removeNote");
|
|
26721
27149
|
|
|
26722
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27150
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/people.js
|
|
26723
27151
|
var accountPeopleOver = /* @__PURE__ */ __name((context) => {
|
|
26724
27152
|
const { database } = context;
|
|
26725
27153
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
|
|
@@ -26794,13 +27222,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
|
|
|
26794
27222
|
};
|
|
26795
27223
|
}, "peopleStoreOver");
|
|
26796
27224
|
|
|
26797
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27225
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
|
|
26798
27226
|
import { createHash as createHash8 } from "node:crypto";
|
|
26799
27227
|
|
|
26800
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27228
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
|
|
26801
27229
|
import { createHash as createHash7 } from "node:crypto";
|
|
26802
27230
|
|
|
26803
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27231
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
|
|
26804
27232
|
var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
|
|
26805
27233
|
var exhausted2 = /* @__PURE__ */ __name((budget) => {
|
|
26806
27234
|
throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
|
|
@@ -27022,7 +27450,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
|
|
|
27022
27450
|
};
|
|
27023
27451
|
}, "rankReplyGraph");
|
|
27024
27452
|
|
|
27025
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27453
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
|
|
27026
27454
|
var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
|
|
27027
27455
|
var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
|
|
27028
27456
|
var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
|
|
@@ -27196,7 +27624,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
|
|
|
27196
27624
|
return { items, evidence, summary, graph: graph.quality };
|
|
27197
27625
|
}, "calculateAdminStatistics");
|
|
27198
27626
|
|
|
27199
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27627
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
|
|
27200
27628
|
var rankingContextRange = /* @__PURE__ */ __name((root) => {
|
|
27201
27629
|
const dates = [];
|
|
27202
27630
|
const visit = /* @__PURE__ */ __name((node, required3) => {
|
|
@@ -27218,7 +27646,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
|
|
|
27218
27646
|
return dates[0].node.resolution.date;
|
|
27219
27647
|
}, "rankingContextRange");
|
|
27220
27648
|
|
|
27221
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27649
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
|
|
27222
27650
|
var reactionCounts = /* @__PURE__ */ __name((stored3) => {
|
|
27223
27651
|
let counts;
|
|
27224
27652
|
try {
|
|
@@ -27236,9 +27664,9 @@ var reactionCounts = /* @__PURE__ */ __name((stored3) => {
|
|
|
27236
27664
|
var column = /* @__PURE__ */ __name((name) => `"${name.replaceAll('"', '""')}"`, "column");
|
|
27237
27665
|
var finite = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null, "finite");
|
|
27238
27666
|
var metadata2 = /* @__PURE__ */ __name((alias2) => `CASE WHEN json_valid(${alias2}.metadata) THEN ${alias2}.metadata ELSE '{}' END`, "metadata");
|
|
27239
|
-
var rankingCounter = /* @__PURE__ */ __name((alias2,
|
|
27667
|
+
var rankingCounter = /* @__PURE__ */ __name((alias2, field4, reactions = false) => {
|
|
27240
27668
|
const source2 = reactions ? `CASE WHEN json_valid(${alias2}.reactions) THEN ${alias2}.reactions ELSE '{}' END` : metadata2(alias2);
|
|
27241
|
-
const path = reactions ? "$.total" : `$.${
|
|
27669
|
+
const path = reactions ? "$.total" : `$.${field4}`;
|
|
27242
27670
|
const value = `json_extract(${source2},'${path}')`;
|
|
27243
27671
|
return `CASE WHEN json_type(${source2},'${path}') IN ('integer','real') AND ${value}>=0 AND ${value}<=1.7976931348623157e308 THEN CAST(${value} AS REAL) END`;
|
|
27244
27672
|
}, "rankingCounter");
|
|
@@ -27513,7 +27941,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
|
|
|
27513
27941
|
});
|
|
27514
27942
|
}, "rankQuery");
|
|
27515
27943
|
|
|
27516
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27944
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
|
|
27517
27945
|
function fail4(message2, reason = "query.too-large") {
|
|
27518
27946
|
throw new CliError("validation_error", message2, { reason, complete: false });
|
|
27519
27947
|
}
|
|
@@ -27534,12 +27962,12 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
|
|
|
27534
27962
|
} else
|
|
27535
27963
|
scope3 += " AND c.searchable=1";
|
|
27536
27964
|
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)"})`;
|
|
27537
|
-
const
|
|
27538
|
-
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 ${joined2} WHERE ${where}`).get(...
|
|
27965
|
+
const bound5 = [...selection.params, ...params, lower, options.cutoff];
|
|
27966
|
+
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 ${joined2} WHERE ${where}`).get(...bound5);
|
|
27539
27967
|
check3();
|
|
27540
27968
|
if (Number(size2?.n ?? 0) > RANKING_GRAPH_LIMITS.nodes || Number(size2?.bytes ?? 0) > RANKING_GRAPH_LIMITS.bytes)
|
|
27541
27969
|
fail4("admin statistics context exceeds node/byte budgets \u2014 narrow chat/date scope");
|
|
27542
|
-
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 ${joined2} WHERE ${where} ORDER BY m.id`).all(...
|
|
27970
|
+
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 ${joined2} WHERE ${where} ORDER BY m.id`).all(...bound5);
|
|
27543
27971
|
const nodes = raw.map((row2) => {
|
|
27544
27972
|
let metadata3 = {};
|
|
27545
27973
|
try {
|
|
@@ -27690,7 +28118,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
|
|
|
27690
28118
|
return result;
|
|
27691
28119
|
}), "adminStatisticsQuery");
|
|
27692
28120
|
|
|
27693
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28121
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
|
|
27694
28122
|
var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
|
|
27695
28123
|
if (!execution.accounts.length)
|
|
27696
28124
|
return { conversations: [], chats: [] };
|
|
@@ -27708,7 +28136,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
|
|
|
27708
28136
|
return { conversations: conversations2, chats: chats2 };
|
|
27709
28137
|
}, "conversationEligibility");
|
|
27710
28138
|
|
|
27711
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28139
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
|
|
27712
28140
|
import { createHash as createHash9 } from "node:crypto";
|
|
27713
28141
|
var EVIDENCE_BYTES = 64 * 1024;
|
|
27714
28142
|
var FINGERPRINT_BYTES = 8 * 1024 * 1024;
|
|
@@ -27858,7 +28286,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
|
|
|
27858
28286
|
return result;
|
|
27859
28287
|
}, "rankingEvidence");
|
|
27860
28288
|
|
|
27861
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28289
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/queries.js
|
|
27862
28290
|
var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
|
|
27863
28291
|
const mailIndexed = /* @__PURE__ */ __name((execution) => {
|
|
27864
28292
|
if (execution.corpus === "mail")
|
|
@@ -27877,7 +28305,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
|
|
|
27877
28305
|
};
|
|
27878
28306
|
}, "queriesStoreOver");
|
|
27879
28307
|
|
|
27880
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28308
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
|
|
27881
28309
|
var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
|
|
27882
28310
|
const { database, now: now2 } = context;
|
|
27883
28311
|
const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
|
|
@@ -27916,10 +28344,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
|
|
|
27916
28344
|
}));
|
|
27917
28345
|
}, "chatEventsOf");
|
|
27918
28346
|
|
|
27919
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28347
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
|
|
27920
28348
|
import { createHash as createHash10 } from "node:crypto";
|
|
27921
28349
|
|
|
27922
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28350
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/calendar.js
|
|
27923
28351
|
var calendarKey = /* @__PURE__ */ __name((zone, by) => {
|
|
27924
28352
|
const format = new Intl.DateTimeFormat("en-CA", {
|
|
27925
28353
|
timeZone: zone,
|
|
@@ -27934,7 +28362,7 @@ var calendarKey = /* @__PURE__ */ __name((zone, by) => {
|
|
|
27934
28362
|
};
|
|
27935
28363
|
}, "calendarKey");
|
|
27936
28364
|
|
|
27937
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28365
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/retention.js
|
|
27938
28366
|
var RETENTION_TOLERANCE = 864e5;
|
|
27939
28367
|
var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
|
|
27940
28368
|
const { since, until, cutoff, checkpoints, within, limit, by } = options;
|
|
@@ -27988,7 +28416,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
|
|
|
27988
28416
|
return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
|
|
27989
28417
|
}, "retentionCohorts");
|
|
27990
28418
|
|
|
27991
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28419
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
|
|
27992
28420
|
var iso6 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
|
|
27993
28421
|
var week = /* @__PURE__ */ __name((day) => {
|
|
27994
28422
|
const date3 = /* @__PURE__ */ new Date(`${day}T00:00:00Z`);
|
|
@@ -28124,7 +28552,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
|
|
|
28124
28552
|
};
|
|
28125
28553
|
}, "retentionQuery");
|
|
28126
28554
|
|
|
28127
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28555
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
|
|
28128
28556
|
var iso7 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
|
|
28129
28557
|
var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
|
|
28130
28558
|
...isBot === void 0 ? {} : { bot: isBot },
|
|
@@ -28255,7 +28683,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
|
|
|
28255
28683
|
lastCount: memberCountsOf(context, pk).at(-1) ?? null
|
|
28256
28684
|
})), "trackedChats");
|
|
28257
28685
|
|
|
28258
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28686
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/roster.js
|
|
28259
28687
|
var rosterStoreOver = /* @__PURE__ */ __name((context) => {
|
|
28260
28688
|
const { database } = context;
|
|
28261
28689
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
|
|
@@ -28311,7 +28739,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28311
28739
|
};
|
|
28312
28740
|
}, "rosterStoreOver");
|
|
28313
28741
|
|
|
28314
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28742
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
|
|
28315
28743
|
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");
|
|
28316
28744
|
var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
|
|
28317
28745
|
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 ?`);
|
|
@@ -28335,7 +28763,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
|
|
|
28335
28763
|
}
|
|
28336
28764
|
}, "backfillNormalized");
|
|
28337
28765
|
|
|
28338
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28766
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
|
|
28339
28767
|
var INDEX2 = "message_words";
|
|
28340
28768
|
var searchIndexState2 = /* @__PURE__ */ __name((database) => {
|
|
28341
28769
|
const row2 = indexRow(database, INDEX2);
|
|
@@ -28462,7 +28890,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
|
|
|
28462
28890
|
});
|
|
28463
28891
|
}, "resetSearchIndex");
|
|
28464
28892
|
|
|
28465
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28893
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
|
|
28466
28894
|
var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
|
|
28467
28895
|
const filled2 = { stemmed: 0, drained: 0 };
|
|
28468
28896
|
const before2 = stemsState(database);
|
|
@@ -28557,7 +28985,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
|
|
|
28557
28985
|
return resetStems(database, { now: now2 });
|
|
28558
28986
|
}, "followDefaultStemmers");
|
|
28559
28987
|
|
|
28560
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28988
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
|
|
28561
28989
|
var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
|
|
28562
28990
|
var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
|
|
28563
28991
|
const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
|
|
@@ -28579,7 +29007,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
|
|
|
28579
29007
|
});
|
|
28580
29008
|
}, "termCandidates");
|
|
28581
29009
|
|
|
28582
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29010
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/search-index.js
|
|
28583
29011
|
var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
|
|
28584
29012
|
const { database } = context;
|
|
28585
29013
|
const stemmerFor2 = stemmerCache();
|
|
@@ -28601,7 +29029,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28601
29029
|
};
|
|
28602
29030
|
}, "searchIndexStoreOver");
|
|
28603
29031
|
|
|
28604
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29032
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
|
|
28605
29033
|
var HISTORY_KEPT = 1e3;
|
|
28606
29034
|
var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
|
|
28607
29035
|
var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
|
|
@@ -28670,7 +29098,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
|
|
|
28670
29098
|
return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
|
|
28671
29099
|
}, "clearHistory");
|
|
28672
29100
|
|
|
28673
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29101
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/searches.js
|
|
28674
29102
|
var searchesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
28675
29103
|
const { database } = context;
|
|
28676
29104
|
return {
|
|
@@ -28694,7 +29122,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28694
29122
|
};
|
|
28695
29123
|
}, "searchesStoreOver");
|
|
28696
29124
|
|
|
28697
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29125
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
|
|
28698
29126
|
var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
|
|
28699
29127
|
var ACTION_OUTCOMES = ["ok", "refused", "failed"];
|
|
28700
29128
|
var CODE = /^[a-z][a-z0-9_]{0,63}$/;
|
|
@@ -28737,7 +29165,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
|
|
|
28737
29165
|
};
|
|
28738
29166
|
}, "agentActionsStoreOver");
|
|
28739
29167
|
|
|
28740
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29168
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
|
|
28741
29169
|
var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
|
|
28742
29170
|
}) => {
|
|
28743
29171
|
const { database, now: now2 } = context;
|
|
@@ -28796,7 +29224,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
|
|
|
28796
29224
|
};
|
|
28797
29225
|
}, "botUpdateStoreOver");
|
|
28798
29226
|
|
|
28799
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29227
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
|
|
28800
29228
|
var DAY4 = 864e5;
|
|
28801
29229
|
var listEvents = /* @__PURE__ */ __name((database, filter) => {
|
|
28802
29230
|
const clauses = ["e.deleted_at IS NULL"];
|
|
@@ -28881,7 +29309,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
|
|
|
28881
29309
|
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);
|
|
28882
29310
|
}, "listEvents");
|
|
28883
29311
|
|
|
28884
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29312
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
|
|
28885
29313
|
var calendarOf = /* @__PURE__ */ __name((row2) => ({
|
|
28886
29314
|
id: Number(row2.id),
|
|
28887
29315
|
accountId: Number(row2.account_id),
|
|
@@ -29461,7 +29889,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
29461
29889
|
};
|
|
29462
29890
|
}, "eventStoreOver");
|
|
29463
29891
|
|
|
29464
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29892
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
|
|
29465
29893
|
var CATALOG_QUERY = defineQuery({
|
|
29466
29894
|
entity: "document",
|
|
29467
29895
|
backend: "sql",
|
|
@@ -29499,7 +29927,7 @@ var objectOf2 = /* @__PURE__ */ __name((value) => {
|
|
|
29499
29927
|
throw new CliError("invalid_response", "stored catalog metadata must be an object");
|
|
29500
29928
|
return parsed2;
|
|
29501
29929
|
}, "objectOf");
|
|
29502
|
-
var
|
|
29930
|
+
var field2 = /* @__PURE__ */ __name((value, max = 4e3) => {
|
|
29503
29931
|
if (typeof value !== "string" || !value || value.length > max)
|
|
29504
29932
|
throw new CliError("validation_error", "catalog field is empty or too long");
|
|
29505
29933
|
return value;
|
|
@@ -29534,7 +29962,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
29534
29962
|
throw new CliError("not_found", "catalog account is not in the local store");
|
|
29535
29963
|
return Number(id2);
|
|
29536
29964
|
}, "account");
|
|
29537
|
-
const
|
|
29965
|
+
const bound5 = /* @__PURE__ */ __name((id2, includeInactive = false) => {
|
|
29538
29966
|
const scope3 = "account_id = ? AND json_type(metadata, '$.catalog') = 'object'" + (includeInactive ? "" : " AND json_extract(metadata, '$.catalog.active') = 1 AND deleted_at IS NULL");
|
|
29539
29967
|
const budget = database.prepare(`SELECT count(*) AS entries, sum(length(metadata)) AS bytes FROM documents WHERE ${scope3}`).get(id2);
|
|
29540
29968
|
if (Number(budget?.bytes ?? 0) > 32 * 1024 * 1024)
|
|
@@ -29549,14 +29977,14 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
29549
29977
|
throw new CliError("validation_error", "catalog writes take at most 200 entries");
|
|
29550
29978
|
const seen = /* @__PURE__ */ new Set();
|
|
29551
29979
|
const checked = inputs.map((input) => {
|
|
29552
|
-
|
|
29980
|
+
field2(input.externalId);
|
|
29553
29981
|
if (seen.has(input.externalId))
|
|
29554
29982
|
throw new CliError("validation_error", "catalog batch repeats an external id");
|
|
29555
29983
|
seen.add(input.externalId);
|
|
29556
29984
|
if (!["file", "folder"].includes(input.kind) || typeof input.name !== "string" || input.name.length > 4e3 || !Array.isArray(input.parents) || input.parents.length > 100)
|
|
29557
29985
|
throw new CliError("validation_error", "invalid catalog name, kind or parents");
|
|
29558
29986
|
for (const parent2 of input.parents)
|
|
29559
|
-
|
|
29987
|
+
field2(parent2);
|
|
29560
29988
|
if (input.actors !== void 0) {
|
|
29561
29989
|
if (!Array.isArray(input.actors) || input.actors.length > 100)
|
|
29562
29990
|
throw new CliError("validation_error", "invalid catalog actors");
|
|
@@ -29565,7 +29993,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
29565
29993
|
throw new CliError("validation_error", "invalid catalog actor");
|
|
29566
29994
|
for (const value of [actor.id, actor.name, actor.email, actor.role])
|
|
29567
29995
|
if (value !== void 0)
|
|
29568
|
-
|
|
29996
|
+
field2(value);
|
|
29569
29997
|
}
|
|
29570
29998
|
}
|
|
29571
29999
|
if (input.size !== void 0 && (!Number.isSafeInteger(input.size) || input.size < 0))
|
|
@@ -29617,7 +30045,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
29617
30045
|
const id2 = account(accountId);
|
|
29618
30046
|
if (externalIds.length > 1e4)
|
|
29619
30047
|
throw new CliError("validation_error", "catalog scope exceeds 10000 entries");
|
|
29620
|
-
const current = [...new Set(externalIds.map((key2) =>
|
|
30048
|
+
const current = [...new Set(externalIds.map((key2) => field2(key2)))];
|
|
29621
30049
|
return write(database, () => {
|
|
29622
30050
|
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]);
|
|
29623
30051
|
const at = now2();
|
|
@@ -29696,14 +30124,14 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
29696
30124
|
if (compiled.sql)
|
|
29697
30125
|
add(compiled.sql, ...compiled.params);
|
|
29698
30126
|
}
|
|
29699
|
-
|
|
30127
|
+
bound5(id2, query.includeInactive);
|
|
29700
30128
|
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);
|
|
29701
30129
|
return { items: found2.slice(0, limit).map(entryOf2), hasMore: found2.length > limit };
|
|
29702
30130
|
}, "list")
|
|
29703
30131
|
};
|
|
29704
30132
|
}, "catalogStoreOver");
|
|
29705
30133
|
|
|
29706
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30134
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/context/evidence.js
|
|
29707
30135
|
import { createHash as createHash11 } from "node:crypto";
|
|
29708
30136
|
var CONTEXT_MAX_READ_BYTES = 262144;
|
|
29709
30137
|
var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
|
|
@@ -29801,20 +30229,20 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
|
|
|
29801
30229
|
return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
|
|
29802
30230
|
}, "contextEvidenceRequest");
|
|
29803
30231
|
|
|
29804
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30232
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
|
|
29805
30233
|
var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
|
|
29806
|
-
var
|
|
30234
|
+
var field3 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
|
|
29807
30235
|
CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
|
|
29808
30236
|
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
|
|
29809
30237
|
ORDER BY ${PREFERRED_FILE} LIMIT 1)`, "preferred");
|
|
29810
|
-
var modified = `round(unixepoch(${
|
|
30238
|
+
var modified = `round(unixepoch(${field3("modifiedAt")},'subsec')*1000)`;
|
|
29811
30239
|
var remoteTime = `coalesce(${preferred("external_updated_at")},n.external_updated_at,${modified})`;
|
|
29812
30240
|
var contextDocumentTime = `coalesce(${remoteTime},n.updated_at)`;
|
|
29813
30241
|
var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
|
|
29814
30242
|
THEN 'source-modified' ELSE 'stored-update' END`;
|
|
29815
|
-
var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${
|
|
30243
|
+
var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field3("sourceUrl")})`;
|
|
29816
30244
|
|
|
29817
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30245
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
|
|
29818
30246
|
var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
|
|
29819
30247
|
const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
|
|
29820
30248
|
signal?.throwIfAborted();
|
|
@@ -29913,7 +30341,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
|
|
|
29913
30341
|
});
|
|
29914
30342
|
}, "readMeetingContextEvidence");
|
|
29915
30343
|
|
|
29916
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30344
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
|
|
29917
30345
|
var corpora = {
|
|
29918
30346
|
message: {
|
|
29919
30347
|
table: "messages",
|
|
@@ -30142,7 +30570,7 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
30142
30570
|
}
|
|
30143
30571
|
}), "contextRecordsOver");
|
|
30144
30572
|
|
|
30145
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30573
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
|
|
30146
30574
|
var NOTE_FIELDS = [
|
|
30147
30575
|
"text",
|
|
30148
30576
|
"exact",
|
|
@@ -30159,7 +30587,7 @@ var NOTE_FIELDS = [
|
|
|
30159
30587
|
"source"
|
|
30160
30588
|
];
|
|
30161
30589
|
var quoted2 = /* @__PURE__ */ __name((value) => `"${value.replaceAll('"', '""')}"`, "quoted");
|
|
30162
|
-
var
|
|
30590
|
+
var bound4 = /* @__PURE__ */ __name((sql2, ...params) => ({ sql: sql2, params, exact: true }), "bound");
|
|
30163
30591
|
var combine2 = /* @__PURE__ */ __name((parts, operator) => ({
|
|
30164
30592
|
sql: parts.length ? `(${parts.map(({ sql: sql2 }) => sql2).join(` ${operator} `)})` : operator === "AND" ? "1" : "0",
|
|
30165
30593
|
params: parts.flatMap(({ params }) => params),
|
|
@@ -30174,8 +30602,8 @@ var CORPORA2 = [
|
|
|
30174
30602
|
words: "document_words",
|
|
30175
30603
|
stems: "document_stems",
|
|
30176
30604
|
live: "coalesce(json_extract(n.metadata, '$.catalog.active'), 1)=1",
|
|
30177
|
-
inAccounts: /* @__PURE__ */ __name((ids) =>
|
|
30178
|
-
tagged: /* @__PURE__ */ __name((tag2) =>
|
|
30605
|
+
inAccounts: /* @__PURE__ */ __name((ids) => bound4("n.folder_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))", ids), "inAccounts"),
|
|
30606
|
+
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")
|
|
30179
30607
|
},
|
|
30180
30608
|
{
|
|
30181
30609
|
type: "note",
|
|
@@ -30184,7 +30612,7 @@ var CORPORA2 = [
|
|
|
30184
30612
|
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)",
|
|
30185
30613
|
words: "note_words",
|
|
30186
30614
|
stems: "note_stems",
|
|
30187
|
-
tagged: /* @__PURE__ */ __name((tag2) =>
|
|
30615
|
+
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")
|
|
30188
30616
|
}
|
|
30189
30617
|
];
|
|
30190
30618
|
var matchedRows = /* @__PURE__ */ __name((context, query) => {
|
|
@@ -30249,17 +30677,17 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
|
|
|
30249
30677
|
let titles;
|
|
30250
30678
|
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");
|
|
30251
30679
|
const leaf2 = /* @__PURE__ */ __name((node) => {
|
|
30252
|
-
const { field:
|
|
30253
|
-
if (!corpus.fields.includes(
|
|
30254
|
-
searchError("query.unsupported-field", node.span, `${
|
|
30255
|
-
if ((
|
|
30256
|
-
return
|
|
30680
|
+
const { field: field4, operator, value } = node;
|
|
30681
|
+
if (!corpus.fields.includes(field4))
|
|
30682
|
+
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(", ")}`);
|
|
30683
|
+
if ((field4 === "text" || field4 === "exact") && value === "")
|
|
30684
|
+
return bound4("0");
|
|
30257
30685
|
if (isStemmed(node)) {
|
|
30258
30686
|
if (!query.stemmer)
|
|
30259
30687
|
throw new Error("a stemmed leaf reached the notes search without the store's stemmer");
|
|
30260
30688
|
const text5 = normalize(value);
|
|
30261
30689
|
if (!/[\p{L}\p{N}]/u.test(text5))
|
|
30262
|
-
return
|
|
30690
|
+
return bound4("0");
|
|
30263
30691
|
const stems = query.stemmer.phrases(value);
|
|
30264
30692
|
return {
|
|
30265
30693
|
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 ?)` : ""}`,
|
|
@@ -30269,11 +30697,11 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
|
|
|
30269
30697
|
...stems ? { stems } : {}
|
|
30270
30698
|
};
|
|
30271
30699
|
}
|
|
30272
|
-
if (
|
|
30700
|
+
if (field4 === "text" || field4 === "exact") {
|
|
30273
30701
|
if (operator === "term" || operator === "phrase") {
|
|
30274
30702
|
const text5 = normalize(value);
|
|
30275
30703
|
const stems = query.stemmer?.phrases(value);
|
|
30276
|
-
return /[\p{L}\p{N}]/u.test(text5) ? { ...wordMatch2(quoted2(text5)), ...stems ? { stems } : {} } :
|
|
30704
|
+
return /[\p{L}\p{N}]/u.test(text5) ? { ...wordMatch2(quoted2(text5)), ...stems ? { stems } : {} } : bound4("0");
|
|
30277
30705
|
}
|
|
30278
30706
|
const pattern = operator === "wildcard" ? wildcardPattern(normalize(value)) : foldRegex(value, node.span);
|
|
30279
30707
|
const matcher = automaton(pattern, node);
|
|
@@ -30286,54 +30714,54 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
|
|
|
30286
30714
|
check3();
|
|
30287
30715
|
return matcher.test(String(term), budget) ? [quoted2(String(term))] : [];
|
|
30288
30716
|
});
|
|
30289
|
-
return matches2.length ? wordMatch2(matches2.join(" OR ")) :
|
|
30717
|
+
return matches2.length ? wordMatch2(matches2.join(" OR ")) : bound4("0");
|
|
30290
30718
|
}
|
|
30291
|
-
if (
|
|
30719
|
+
if (field4 === "body") {
|
|
30292
30720
|
if (operator === "term" || operator === "phrase")
|
|
30293
|
-
return
|
|
30721
|
+
return bound4("n.text = ?", value);
|
|
30294
30722
|
const matcher = automaton(operator === "wildcard" ? wildcardPattern(value) : value, node);
|
|
30295
30723
|
tests.set(node, (text5) => matcher.test(text5, budget));
|
|
30296
30724
|
return { sql: "1", params: [], exact: false };
|
|
30297
30725
|
}
|
|
30298
|
-
if (
|
|
30726
|
+
if (field4 === "tag") {
|
|
30299
30727
|
const tag2 = tagOf(value);
|
|
30300
30728
|
if (tag2 === void 0)
|
|
30301
30729
|
searchError("query.invalid-tag", node.span);
|
|
30302
|
-
return corpus.tagged?.(canonicalTagNamed(database, tag2)?.name ?? tag2) ??
|
|
30730
|
+
return corpus.tagged?.(canonicalTagNamed(database, tag2)?.name ?? tag2) ?? bound4("0");
|
|
30303
30731
|
}
|
|
30304
|
-
if (
|
|
30305
|
-
return
|
|
30306
|
-
if (
|
|
30732
|
+
if (field4 === "source")
|
|
30733
|
+
return bound4(value.toLowerCase() === (corpus.type === "note" ? "internal" : "file") ? "1" : "0");
|
|
30734
|
+
if (field4 === "has") {
|
|
30307
30735
|
if (value.toLowerCase() !== "text")
|
|
30308
30736
|
searchError("query.unknown-value", node.span, `has:${value} is a message field \u2014 notes take has:text`);
|
|
30309
|
-
return
|
|
30737
|
+
return bound4("length(trim(coalesce(n.text,''))) > 0");
|
|
30310
30738
|
}
|
|
30311
|
-
if (
|
|
30739
|
+
if (field4 === "title" || field4 === "site" || field4 === "lang" || field4 === "author" || field4 === "keyword") {
|
|
30312
30740
|
const wanted = normalize(value);
|
|
30313
30741
|
if (wanted === "")
|
|
30314
|
-
return
|
|
30742
|
+
return bound4("0");
|
|
30315
30743
|
const folded5 = /* @__PURE__ */ __name((key2) => `coalesce(json_extract(n.metadata, '$.folded.${key2}'), '')`, "folded");
|
|
30316
|
-
if (
|
|
30317
|
-
return
|
|
30318
|
-
if (
|
|
30319
|
-
return
|
|
30320
|
-
if (
|
|
30744
|
+
if (field4 === "keyword")
|
|
30745
|
+
return bound4("EXISTS (SELECT 1 FROM json_each(n.metadata, '$.folded.keywords') WHERE value = ?)", wanted);
|
|
30746
|
+
if (field4 === "lang")
|
|
30747
|
+
return bound4(`(${folded5("language")} = ? OR ${folded5("language")} LIKE ? || '-%')`, wanted, wanted);
|
|
30748
|
+
if (field4 === "title") {
|
|
30321
30749
|
check3();
|
|
30322
30750
|
const ids = foldedTitles().flatMap(({ id: id2, title }) => title.includes(wanted) ? [id2] : []);
|
|
30323
|
-
return
|
|
30751
|
+
return bound4(`(instr(${folded5("title")}, ?) > 0 OR n.id IN (SELECT value FROM json_each(?)))`, wanted, JSON.stringify(ids));
|
|
30324
30752
|
}
|
|
30325
|
-
return
|
|
30753
|
+
return bound4(`instr(${folded5(field4)}, ?) > 0`, wanted);
|
|
30326
30754
|
}
|
|
30327
|
-
if (
|
|
30755
|
+
if (field4 === "date") {
|
|
30328
30756
|
const range = node.resolution?.date;
|
|
30329
30757
|
if (!range)
|
|
30330
30758
|
searchError("query.invalid-ast", node.span);
|
|
30331
30759
|
return combine2([
|
|
30332
|
-
...range.lower === void 0 ? [] : [
|
|
30333
|
-
...range.upper === void 0 ? [] : [
|
|
30760
|
+
...range.lower === void 0 ? [] : [bound4(`n.at ${range.lower_inclusive ? ">=" : ">"} ?`, range.lower)],
|
|
30761
|
+
...range.upper === void 0 ? [] : [bound4(`n.at ${range.upper_inclusive ? "<=" : "<"} ?`, range.upper)]
|
|
30334
30762
|
], "AND");
|
|
30335
30763
|
}
|
|
30336
|
-
return
|
|
30764
|
+
return bound4([corpus.noun, `${corpus.noun}s`].includes(value.toLowerCase()) ? "1" : "0");
|
|
30337
30765
|
}, "leaf");
|
|
30338
30766
|
const compile2 = /* @__PURE__ */ __name((node) => {
|
|
30339
30767
|
if (node.kind === "predicate") {
|
|
@@ -30364,10 +30792,10 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
|
|
|
30364
30792
|
const expression = compile2(query.root);
|
|
30365
30793
|
const stemmed = [...fragments.keys()].some(isStemmed);
|
|
30366
30794
|
const scope3 = combine2([
|
|
30367
|
-
|
|
30368
|
-
...corpus.live ? [
|
|
30795
|
+
bound4("n.deleted_at IS NULL"),
|
|
30796
|
+
...corpus.live ? [bound4(corpus.live)] : [],
|
|
30369
30797
|
...query.accountIds?.length && corpus.inAccounts ? [corpus.inAccounts(JSON.stringify(query.accountIds))] : [],
|
|
30370
|
-
...query.ids ? [
|
|
30798
|
+
...query.ids ? [bound4("n.id IN (SELECT value FROM json_each(?))", JSON.stringify(query.ids))] : []
|
|
30371
30799
|
], "AND");
|
|
30372
30800
|
const where = combine2([scope3, expression], "AND");
|
|
30373
30801
|
const ranking = query.newest ? void 0 : required3(query.root, stemmed ? "stems" : "fts");
|
|
@@ -30572,7 +31000,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
30572
31000
|
};
|
|
30573
31001
|
}, "noteSearchOver");
|
|
30574
31002
|
|
|
30575
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31003
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
|
|
30576
31004
|
var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
|
|
30577
31005
|
var inEventAccounts = /* @__PURE__ */ __name((event) => searchableCopy(event, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
|
|
30578
31006
|
var EVENT_CORPUS = {
|
|
@@ -30704,7 +31132,7 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
30704
31132
|
};
|
|
30705
31133
|
}, "eventSearchOver");
|
|
30706
31134
|
|
|
30707
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31135
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
|
|
30708
31136
|
var EVIDENCE_FINDINGS_KIND = "evidence_findings";
|
|
30709
31137
|
var reference = /* @__PURE__ */ __name((raw) => {
|
|
30710
31138
|
if (/^document:[1-9]\d*$/.test(raw))
|
|
@@ -30717,7 +31145,7 @@ var reference = /* @__PURE__ */ __name((raw) => {
|
|
|
30717
31145
|
}, "reference");
|
|
30718
31146
|
var validateEvidenceFindings = /* @__PURE__ */ __name((input) => validateFindings(input, { plural: "evidence findings", singular: "evidence finding", cited: "reference", reference }), "validateEvidenceFindings");
|
|
30719
31147
|
|
|
30720
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31148
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/domain/moment.js
|
|
30721
31149
|
var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
|
|
30722
31150
|
try {
|
|
30723
31151
|
return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
|
|
@@ -30729,7 +31157,7 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
|
|
|
30729
31157
|
}
|
|
30730
31158
|
}, "calendarMoment");
|
|
30731
31159
|
|
|
30732
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31160
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
|
|
30733
31161
|
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";
|
|
30734
31162
|
var iso8 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
30735
31163
|
var oneOf4 = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
@@ -30745,7 +31173,7 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
30745
31173
|
type: row2.type,
|
|
30746
31174
|
statement: String(row2.statement),
|
|
30747
31175
|
status: row2.status,
|
|
30748
|
-
|
|
31176
|
+
...projectOf(database, row2),
|
|
30749
31177
|
...subjectOf(database, row2),
|
|
30750
31178
|
occurredAt: row2.occurred_at == null ? null : iso8(row2.occurred_at),
|
|
30751
31179
|
supersedes: row2.supersedes_id == null ? null : `fact:${row2.supersedes_id}`,
|
|
@@ -30767,12 +31195,12 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
30767
31195
|
const accept = /* @__PURE__ */ __name((id2) => {
|
|
30768
31196
|
const row2 = database.prepare("SELECT * FROM facts WHERE id = ?").get(id2);
|
|
30769
31197
|
if (row2.status !== "proposed" && row2.status !== "accepted")
|
|
30770
|
-
throw new CliError("validation_error", `a ${String(row2.status)}
|
|
31198
|
+
throw new CliError("validation_error", `a ${String(row2.status)} fact cannot be accepted`);
|
|
30771
31199
|
const { actor } = authorActor(context, "owner");
|
|
30772
31200
|
const at = now2();
|
|
30773
31201
|
database.prepare("UPDATE facts SET status = 'accepted', confirmed_by_type = ?, confirmed_by_id = ?, updated_at = ? WHERE id = ?").run(actor.type, actor.id, at, id2);
|
|
30774
31202
|
if (row2.supersedes_id != null)
|
|
30775
|
-
database.prepare("UPDATE facts SET status = 'superseded', updated_at = ? WHERE id = ? AND status
|
|
31203
|
+
database.prepare("UPDATE facts SET status = 'superseded', updated_at = ? WHERE id = ? AND status IN ('proposed', 'accepted')").run(at, Number(row2.supersedes_id));
|
|
30776
31204
|
}, "accept");
|
|
30777
31205
|
return {
|
|
30778
31206
|
add: /* @__PURE__ */ __name((input) => {
|
|
@@ -30784,16 +31212,14 @@ var factOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
30784
31212
|
const occurredAt = input.occurredAt === void 0 ? null : calendarMoment(input.occurredAt, "occurredAt");
|
|
30785
31213
|
if (occurredAt !== null && !Number.isFinite(occurredAt))
|
|
30786
31214
|
throw new CliError("validation_error", "occurredAt takes an ISO timestamp");
|
|
30787
|
-
if (input.supersedes !== void 0 && type !== "decision")
|
|
30788
|
-
throw new CliError("validation_error", "only a decision supersedes another");
|
|
30789
31215
|
const id2 = write(database, () => {
|
|
30790
31216
|
const project = input.project === void 0 ? void 0 : requiredThing(database, input.project, "the project");
|
|
30791
31217
|
if (project && project.type !== "project")
|
|
30792
31218
|
throw new CliError("validation_error", `${input.project} is not a project`);
|
|
30793
31219
|
const subject2 = input.subject === void 0 ? void 0 : requiredThing(database, input.subject, "the subject");
|
|
30794
31220
|
const replaced = input.supersedes === void 0 ? void 0 : rowOf(input.supersedes);
|
|
30795
|
-
if (replaced && replaced.
|
|
30796
|
-
throw new CliError("validation_error", `${input.supersedes} is
|
|
31221
|
+
if (replaced && replaced.status !== "proposed" && replaced.status !== "accepted")
|
|
31222
|
+
throw new CliError("validation_error", `${input.supersedes} is ${String(replaced.status)}; only a proposed or accepted fact can be corrected`);
|
|
30797
31223
|
const owner = input.by === "owner";
|
|
30798
31224
|
const { actor, model } = authorActor(context, input.by);
|
|
30799
31225
|
const at = now2();
|
|
@@ -30880,7 +31306,7 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
30880
31306
|
};
|
|
30881
31307
|
}, "factsStoreOver");
|
|
30882
31308
|
|
|
30883
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31309
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
|
|
30884
31310
|
var invalid2 = /* @__PURE__ */ __name((message2) => {
|
|
30885
31311
|
throw new CliError("validation_error", message2);
|
|
30886
31312
|
}, "invalid");
|
|
@@ -30970,12 +31396,13 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
|
|
|
30970
31396
|
return { snapshot: snapshot2, snapshotParts, previous, outcomes };
|
|
30971
31397
|
}, "findingsCoreOver");
|
|
30972
31398
|
|
|
30973
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31399
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
|
|
30974
31400
|
var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
|
|
30975
31401
|
var PROPOSAL_VERDICTS = ["useful", "not_useful"];
|
|
30976
31402
|
var iso9 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
30977
|
-
var NAMED4 = "SELECT p.*, b.name AS proposer_name FROM proposed_actions p LEFT JOIN bots b ON p.proposed_by_type = 'bot' AND b.id = p.proposed_by_id";
|
|
30978
31403
|
var json2 = /* @__PURE__ */ __name((value) => value == null ? null : JSON.parse(String(value)), "json");
|
|
31404
|
+
var STATUS = `CASE WHEN p.status = 'approved' AND p.kind IN ('${MEETING_FINDINGS_KIND}', '${EVIDENCE_FINDINGS_KIND}') AND json_array_length(p.result, '$.accepted') = 0 THEN 'rejected' ELSE p.status END`;
|
|
31405
|
+
var NAMED4 = `SELECT p.*, ${STATUS} AS shown_status, b.name AS proposer_name FROM proposed_actions p LEFT JOIN bots b ON p.proposed_by_type = 'bot' AND b.id = p.proposed_by_id`;
|
|
30979
31406
|
var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
30980
31407
|
const { database, now: now2 } = context;
|
|
30981
31408
|
const actionOf = /* @__PURE__ */ __name((row2) => {
|
|
@@ -30987,7 +31414,7 @@ var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
30987
31414
|
target: row2.target_type == null ? null : referenceOfThing(database, storedThing(row2.target_type, row2.target_id)) ?? null,
|
|
30988
31415
|
payload: json2(row2.payload),
|
|
30989
31416
|
reason: row2.reason == null ? null : String(row2.reason),
|
|
30990
|
-
status: row2.
|
|
31417
|
+
status: row2.shown_status,
|
|
30991
31418
|
proposedBy: {
|
|
30992
31419
|
type: row2.proposed_by_type,
|
|
30993
31420
|
id: String(row2.proposed_by_id),
|
|
@@ -31051,7 +31478,7 @@ var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
31051
31478
|
list: /* @__PURE__ */ __name(({ status, limit = 100 } = {}) => {
|
|
31052
31479
|
if (status !== void 0 && !PROPOSAL_STATUSES.includes(status))
|
|
31053
31480
|
throw new CliError("validation_error", `a status is one of ${PROPOSAL_STATUSES.join(", ")}`);
|
|
31054
|
-
return database.prepare(`${NAMED4} WHERE (? IS NULL OR
|
|
31481
|
+
return database.prepare(`${NAMED4} WHERE (? IS NULL OR ${STATUS} = ?) ORDER BY p.created_at DESC, p.id DESC LIMIT ?`).all(status ?? null, status ?? null, Math.min(Math.max(limit, 1), 500)).map(actionOf);
|
|
31055
31482
|
}, "list"),
|
|
31056
31483
|
approve: /* @__PURE__ */ __name((id2, result, by) => decide2(id2, "approved", result, by), "approve"),
|
|
31057
31484
|
reject: /* @__PURE__ */ __name((id2) => decide2(id2, "rejected"), "reject"),
|
|
@@ -31116,7 +31543,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
31116
31543
|
};
|
|
31117
31544
|
}, "proposedActionsStoreOver");
|
|
31118
31545
|
|
|
31119
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31546
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
|
|
31120
31547
|
var stale = /* @__PURE__ */ __name(() => {
|
|
31121
31548
|
throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
|
|
31122
31549
|
reason: "evidence-findings.stale"
|
|
@@ -31142,7 +31569,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
31142
31569
|
}, "load");
|
|
31143
31570
|
const view = /* @__PURE__ */ __name((proposal) => {
|
|
31144
31571
|
const input = proposal.payload;
|
|
31145
|
-
if (!input || !proposal.target || !["proposed", "approved"].includes(proposal.status))
|
|
31572
|
+
if (!input || !proposal.target || !["proposed", "approved", "rejected"].includes(proposal.status))
|
|
31146
31573
|
return invalid3("invalid stored findings batch");
|
|
31147
31574
|
return {
|
|
31148
31575
|
id: proposal.id,
|
|
@@ -31227,15 +31654,16 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
31227
31654
|
});
|
|
31228
31655
|
}, "stage"),
|
|
31229
31656
|
get: /* @__PURE__ */ __name(async (id2) => view(load(id2)), "get"),
|
|
31657
|
+
sources: /* @__PURE__ */ __name(async (id2) => sourcesOfReferences(database, view(load(id2)).input.findings.flatMap((finding) => finding.evidence.map((one) => one.reference))), "sources"),
|
|
31230
31658
|
list: /* @__PURE__ */ __name(async ({ project, limit = 20, offset = 0, status } = {}) => {
|
|
31231
31659
|
if (status !== void 0 && status !== "proposed" && status !== "reviewed")
|
|
31232
31660
|
return invalid3("finding status is proposed or reviewed");
|
|
31233
31661
|
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 50 || !Number.isSafeInteger(offset) || offset < 0)
|
|
31234
31662
|
return invalid3("findings lists take 1\u201350 items and a nonnegative offset");
|
|
31235
|
-
const
|
|
31236
|
-
if (
|
|
31663
|
+
const projectId2 = project === void 0 ? null : /^project:([1-9]\d*)$/.exec(project)?.[1];
|
|
31664
|
+
if (projectId2 === void 0)
|
|
31237
31665
|
return invalid3("a findings list filters by a project reference");
|
|
31238
|
-
const ids = database.prepare("SELECT id FROM proposed_actions WHERE account_id IS NULL AND kind=? AND (? IS NULL OR (target_type='project' AND target_id=?)) AND (? IS NULL OR status=?) ORDER BY id DESC LIMIT ? OFFSET ?").all(EVIDENCE_FINDINGS_KIND,
|
|
31666
|
+
const ids = database.prepare("SELECT id FROM proposed_actions WHERE account_id IS NULL AND kind=? AND (? IS NULL OR (target_type='project' AND target_id=?)) AND (? IS NULL OR status=?) ORDER BY id DESC LIMIT ? OFFSET ?").all(EVIDENCE_FINDINGS_KIND, projectId2, projectId2 === null ? null : Number(projectId2), status ?? null, status === "reviewed" ? "approved" : status ?? null, limit + 1, offset);
|
|
31239
31667
|
return { items: ids.slice(0, limit).map((row2) => view(load(String(row2.id)))), hasMore: ids.length > limit };
|
|
31240
31668
|
}, "list"),
|
|
31241
31669
|
review: /* @__PURE__ */ __name(async (id2, decision) => write(database, () => {
|
|
@@ -31282,7 +31710,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
31282
31710
|
};
|
|
31283
31711
|
}, "evidenceFindingsStoreOver");
|
|
31284
31712
|
|
|
31285
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31713
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
|
|
31286
31714
|
var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
|
|
31287
31715
|
var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
|
|
31288
31716
|
rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
|
|
@@ -31307,7 +31735,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
31307
31735
|
...since === void 0 ? [] : [["AND i.occurred_at>=?", since]],
|
|
31308
31736
|
...until === void 0 ? [] : [["AND i.occurred_at<=?", until]]
|
|
31309
31737
|
];
|
|
31310
|
-
const
|
|
31738
|
+
const bound5 = before2 === void 0 ? [] : [before2.at, before2.at, before2.id];
|
|
31311
31739
|
const account = only === void 0 ? [] : [only.provider, only.account];
|
|
31312
31740
|
return database.prepare(`SELECT i.*, a.provider, a.external_id AS account, c.external_id AS chat, m.external_id AS message
|
|
31313
31741
|
FROM involvements i LEFT JOIN projects pr ON pr.id=i.project_id
|
|
@@ -31316,7 +31744,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
31316
31744
|
LEFT JOIN chats c ON c.id=CASE WHEN i.subject_type='chat' THEN i.subject_id ELSE m.chat_id END
|
|
31317
31745
|
WHERE i.person_id=? ${filters.map(([sql2]) => sql2).join(" ")}
|
|
31318
31746
|
${before2 === void 0 ? "" : "AND (i.occurred_at<? OR (i.occurred_at=? AND i.id<?))"}
|
|
31319
|
-
${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), ...
|
|
31747
|
+
${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) => ({
|
|
31320
31748
|
id: Number(row2.id),
|
|
31321
31749
|
personId: Number(row2.person_id),
|
|
31322
31750
|
identityId: row2.identity_id == null ? null : Number(row2.identity_id),
|
|
@@ -31335,7 +31763,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
31335
31763
|
}, "forPerson")
|
|
31336
31764
|
}), "involvementStoreOver");
|
|
31337
31765
|
|
|
31338
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31766
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
|
|
31339
31767
|
import { createHash as createHash12 } from "node:crypto";
|
|
31340
31768
|
var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
|
|
31341
31769
|
var id = /* @__PURE__ */ __name((value) => {
|
|
@@ -31369,10 +31797,10 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
|
|
|
31369
31797
|
};
|
|
31370
31798
|
}, "linkOf");
|
|
31371
31799
|
return {
|
|
31372
|
-
linkMeetingProject: /* @__PURE__ */ __name(async (key2, meetingId,
|
|
31800
|
+
linkMeetingProject: /* @__PURE__ */ __name(async (key2, meetingId, projectId2, options = {}) => {
|
|
31373
31801
|
check2(options.signal);
|
|
31374
31802
|
const meeting = id(meetingId);
|
|
31375
|
-
const project = id(
|
|
31803
|
+
const project = id(projectId2);
|
|
31376
31804
|
const by = options.by ?? "owner";
|
|
31377
31805
|
if (by !== "owner" && by !== "agent")
|
|
31378
31806
|
throw new CliError("validation_error", "choose owner or agent provenance");
|
|
@@ -31421,24 +31849,24 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
|
|
|
31421
31849
|
};
|
|
31422
31850
|
}, "meetingProjectsStoreOver");
|
|
31423
31851
|
|
|
31424
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31852
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
|
|
31425
31853
|
import { createHash as createHash15 } from "node:crypto";
|
|
31426
31854
|
|
|
31427
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31855
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
|
|
31428
31856
|
import { createHash as createHash14 } from "node:crypto";
|
|
31429
31857
|
|
|
31430
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31858
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
|
|
31431
31859
|
import { createHash as createHash13 } from "node:crypto";
|
|
31432
31860
|
|
|
31433
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31434
|
-
var consolidationId = /* @__PURE__ */ __name((value,
|
|
31861
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
|
|
31862
|
+
var consolidationId = /* @__PURE__ */ __name((value, field4) => {
|
|
31435
31863
|
if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
31436
|
-
throw new CliError("validation_error", `${
|
|
31864
|
+
throw new CliError("validation_error", `${field4} must be a positive canonical tag id`);
|
|
31437
31865
|
return Number(value);
|
|
31438
31866
|
}, "consolidationId");
|
|
31439
|
-
var bounded = /* @__PURE__ */ __name((value, max,
|
|
31867
|
+
var bounded = /* @__PURE__ */ __name((value, max, field4) => {
|
|
31440
31868
|
if (!Number.isSafeInteger(value) || value < 1 || value > max)
|
|
31441
|
-
throw new CliError("validation_error", `${
|
|
31869
|
+
throw new CliError("validation_error", `${field4} must be an integer from 1 to ${max}`);
|
|
31442
31870
|
return value;
|
|
31443
31871
|
}, "bounded");
|
|
31444
31872
|
var consolidationInput = /* @__PURE__ */ __name((options, apply = false) => {
|
|
@@ -31453,9 +31881,9 @@ var consolidationInput = /* @__PURE__ */ __name((options, apply = false) => {
|
|
|
31453
31881
|
"signal",
|
|
31454
31882
|
...apply ? ["by", "expectedPreviewFingerprint", "idempotencyKey"] : ["sampleLimit"]
|
|
31455
31883
|
]);
|
|
31456
|
-
for (const
|
|
31457
|
-
if (!allowed.has(
|
|
31458
|
-
throw new CliError("validation_error", `unknown consolidation field: ${
|
|
31884
|
+
for (const field4 of Object.keys(options))
|
|
31885
|
+
if (!allowed.has(field4))
|
|
31886
|
+
throw new CliError("validation_error", `unknown consolidation field: ${field4}`);
|
|
31459
31887
|
const source2 = consolidationId(options.sourceId, "sourceId");
|
|
31460
31888
|
const survivor = consolidationId(options.survivorId, "survivorId");
|
|
31461
31889
|
if (source2 === survivor)
|
|
@@ -31481,7 +31909,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
|
|
|
31481
31909
|
return input;
|
|
31482
31910
|
}, "consolidationApplyInput");
|
|
31483
31911
|
|
|
31484
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31912
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
|
|
31485
31913
|
var receiptOf = /* @__PURE__ */ __name((row2) => ({
|
|
31486
31914
|
id: String(row2.id),
|
|
31487
31915
|
sourceId: String(row2.source_id),
|
|
@@ -31556,7 +31984,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
|
|
|
31556
31984
|
}, { beforeCommit: check3 });
|
|
31557
31985
|
}, "applyTagConsolidation");
|
|
31558
31986
|
|
|
31559
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31987
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
|
|
31560
31988
|
var selections = [
|
|
31561
31989
|
["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
|
|
31562
31990
|
["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
|
|
@@ -31639,9 +32067,9 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
|
|
|
31639
32067
|
totals.survivor++;
|
|
31640
32068
|
byTargetType.set(type, totals);
|
|
31641
32069
|
}
|
|
31642
|
-
const counts = /* @__PURE__ */ __name((values,
|
|
31643
|
-
source: values.filter((row2) => sourceMembers.has(Number(row2[
|
|
31644
|
-
survivor: values.filter((row2) => !sourceMembers.has(Number(row2[
|
|
32070
|
+
const counts = /* @__PURE__ */ __name((values, field4) => ({
|
|
32071
|
+
source: values.filter((row2) => sourceMembers.has(Number(row2[field4]))).length,
|
|
32072
|
+
survivor: values.filter((row2) => !sourceMembers.has(Number(row2[field4]))).length
|
|
31645
32073
|
}), "counts");
|
|
31646
32074
|
const overlaps = /* @__PURE__ */ __name((values, key2) => {
|
|
31647
32075
|
const targets = new Set(values.filter((row2) => sourceMembers.has(Number(row2.tag_id))).map(key2));
|
|
@@ -31700,7 +32128,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
|
|
|
31700
32128
|
};
|
|
31701
32129
|
}, "previewRows");
|
|
31702
32130
|
|
|
31703
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32131
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
|
|
31704
32132
|
var kinds = ["project", "tag", "topic"];
|
|
31705
32133
|
var cancelled2 = /* @__PURE__ */ __name((signal) => {
|
|
31706
32134
|
if (signal?.aborted)
|
|
@@ -31964,7 +32392,7 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
31964
32392
|
};
|
|
31965
32393
|
}, "vocabularyStoreOver");
|
|
31966
32394
|
|
|
31967
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32395
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
|
|
31968
32396
|
var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
|
|
31969
32397
|
var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
|
|
31970
32398
|
var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
|
|
@@ -32123,7 +32551,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32123
32551
|
scope: row2.scope,
|
|
32124
32552
|
createdAt: iso10(row2.created_at)
|
|
32125
32553
|
}), "organizationOf");
|
|
32126
|
-
const
|
|
32554
|
+
const projectOf2 = /* @__PURE__ */ __name((row2) => ({
|
|
32127
32555
|
id: String(row2.id),
|
|
32128
32556
|
ref: `project:${row2.id}`,
|
|
32129
32557
|
key: String(row2.key),
|
|
@@ -32188,7 +32616,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32188
32616
|
}, "due");
|
|
32189
32617
|
const openTask = /* @__PURE__ */ __name((key2, id2) => {
|
|
32190
32618
|
const row2 = taskRowOf(database, id2);
|
|
32191
|
-
const open = row2 !== void 0 && taskAccountOf(database, row2) === taskAccount(key2) && database.prepare("SELECT status FROM tasks WHERE id = ?").get(row2)?.status
|
|
32619
|
+
const open = row2 !== void 0 && taskAccountOf(database, row2) === taskAccount(key2) && !isClosedState(String(database.prepare("SELECT status FROM tasks WHERE id = ?").get(row2)?.status ?? "done"));
|
|
32192
32620
|
if (!open)
|
|
32193
32621
|
throw new CliError("validation_error", "a reminder requires an open task in this account");
|
|
32194
32622
|
return row2;
|
|
@@ -32358,7 +32786,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32358
32786
|
}
|
|
32359
32787
|
const at = now2();
|
|
32360
32788
|
const row2 = database.prepare("INSERT INTO projects (key, name, name_folded, description, type, organization_id, scope, tasks_count, status, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, 0, 'active', ?, ?) RETURNING *").get(chosen, title, fold(title), description === void 0 ? null : textOf4(description, 2e3), oneOf5(type, PROJECT_TYPES, "a project's type"), organizationId, oneOf5(scope3, SCOPES, "a scope"), at, at);
|
|
32361
|
-
return
|
|
32789
|
+
return projectOf2(row2);
|
|
32362
32790
|
}), "addProject"),
|
|
32363
32791
|
projects: /* @__PURE__ */ __name(async (query) => {
|
|
32364
32792
|
const asksKind = query !== void 0 && walkQuery(query.root).some((node) => node.field === "kind");
|
|
@@ -32372,7 +32800,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32372
32800
|
scope: { type: "enum", sql: "scope" },
|
|
32373
32801
|
created_at: { type: "time", sql: "created_at" }
|
|
32374
32802
|
});
|
|
32375
|
-
return database.prepare(`SELECT * FROM projects WHERE deleted_at IS NULL${asksKind ? "" : ` AND length(key) <> ${INBOX_KEY_LENGTH}`}${where ? ` AND (${where.sql})` : ""} ORDER BY name, id LIMIT 500`).all(...where?.params ?? []).map(
|
|
32803
|
+
return database.prepare(`SELECT * FROM projects WHERE deleted_at IS NULL${asksKind ? "" : ` AND length(key) <> ${INBOX_KEY_LENGTH}`}${where ? ` AND (${where.sql})` : ""} ORDER BY name, id LIMIT 500`).all(...where?.params ?? []).map(projectOf2);
|
|
32376
32804
|
}, "projects"),
|
|
32377
32805
|
relate: /* @__PURE__ */ __name(async (key2, input) => {
|
|
32378
32806
|
const from2 = related(key2, input.from, true);
|
|
@@ -32460,7 +32888,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32460
32888
|
if (!Number.isInteger(lease) || lease < 1e3 || lease > 36e5)
|
|
32461
32889
|
throw new CliError("validation_error", "lease takes 1000\u20133600000 milliseconds");
|
|
32462
32890
|
const accountId = account(key2), at = now2();
|
|
32463
|
-
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
|
|
32891
|
+
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);
|
|
32464
32892
|
const claimed = [];
|
|
32465
32893
|
for (const row2 of rows) {
|
|
32466
32894
|
const receipt = ulid(at);
|
|
@@ -32486,7 +32914,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
|
|
|
32486
32914
|
return key2.padEnd(3, "X");
|
|
32487
32915
|
}, "projectKey");
|
|
32488
32916
|
|
|
32489
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32917
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
|
|
32490
32918
|
var DAY5 = 864e5;
|
|
32491
32919
|
var SETTING4 = "logs_pruned_at";
|
|
32492
32920
|
var LOG_RETENTION = { agentActionsMs: 90 * DAY5, botUpdatePayloadsMs: 30 * DAY5 };
|
|
@@ -32513,7 +32941,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
|
|
|
32513
32941
|
};
|
|
32514
32942
|
}, "logPruner");
|
|
32515
32943
|
|
|
32516
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32944
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
|
|
32517
32945
|
var stale2 = /* @__PURE__ */ __name(() => {
|
|
32518
32946
|
throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
|
|
32519
32947
|
reason: "meeting-findings.stale"
|
|
@@ -32545,7 +32973,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32545
32973
|
}, "load");
|
|
32546
32974
|
const view = /* @__PURE__ */ __name((proposal) => {
|
|
32547
32975
|
const input = proposal.payload;
|
|
32548
|
-
if (!input || !proposal.account || !["proposed", "approved"].includes(proposal.status))
|
|
32976
|
+
if (!input || !proposal.account || !["proposed", "approved", "rejected"].includes(proposal.status))
|
|
32549
32977
|
return invalid4("invalid stored findings batch");
|
|
32550
32978
|
return {
|
|
32551
32979
|
id: proposal.id,
|
|
@@ -32566,11 +32994,11 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32566
32994
|
const core = findingsCoreOver(context, MEETING_FINDINGS_KIND);
|
|
32567
32995
|
const snapshot2 = /* @__PURE__ */ __name((account, input) => {
|
|
32568
32996
|
let readBytes = 0;
|
|
32569
|
-
return core.snapshot(input, (evidence, finding,
|
|
32997
|
+
return core.snapshot(input, (evidence, finding, projectId2, seen) => {
|
|
32570
32998
|
const parsed2 = parseMeetingReference(evidence.reference);
|
|
32571
32999
|
if (parsed2.accountId !== account)
|
|
32572
33000
|
throw new CliError("not_found", "the cited cue belongs to another account");
|
|
32573
|
-
const membership = database.prepare("SELECT id,updated_at,confirmed,source FROM links WHERE from_type='meeting' AND from_id=? AND to_type='project' AND to_id=? AND kind='member-of' AND anchor IS NULL AND confirmed=1").get(parsed2.meetingId,
|
|
33001
|
+
const membership = database.prepare("SELECT id,updated_at,confirmed,source FROM links WHERE from_type='meeting' AND from_id=? AND to_type='project' AND to_id=? AND kind='member-of' AND anchor IS NULL AND confirmed=1").get(parsed2.meetingId, projectId2);
|
|
32574
33002
|
if (!membership)
|
|
32575
33003
|
return invalid4("each cited meeting needs confirmed membership in the finding's project");
|
|
32576
33004
|
seen.set(`${finding.project}/${parsed2.meetingId}`, membership);
|
|
@@ -32682,7 +33110,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32682
33110
|
};
|
|
32683
33111
|
}, "meetingFindingsStoreOver");
|
|
32684
33112
|
|
|
32685
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33113
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
|
|
32686
33114
|
var RANK_BATCH = 512;
|
|
32687
33115
|
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";
|
|
32688
33116
|
var limitOf = /* @__PURE__ */ __name((value, name, max = 1e3) => {
|
|
@@ -32953,7 +33381,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
|
|
|
32953
33381
|
}
|
|
32954
33382
|
}), "meetingVectorsOver");
|
|
32955
33383
|
|
|
32956
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33384
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
|
|
32957
33385
|
var OTHER_SOURCES = ["document", "note", "email"];
|
|
32958
33386
|
var TEXTS = {
|
|
32959
33387
|
document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
|
|
@@ -33054,11 +33482,11 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
33054
33482
|
};
|
|
33055
33483
|
}, "sourceMentionStoreOver");
|
|
33056
33484
|
|
|
33057
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33485
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
|
|
33058
33486
|
import { mkdirSync, statSync, writeFileSync } from "node:fs";
|
|
33059
33487
|
import { dirname } from "node:path";
|
|
33060
33488
|
|
|
33061
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33489
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
|
|
33062
33490
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
33063
33491
|
var CLIENTS_SETTING = "clients";
|
|
33064
33492
|
var coreVersion = (() => {
|
|
@@ -33116,7 +33544,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
|
|
|
33116
33544
|
return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
|
|
33117
33545
|
}, "refusalAdvice");
|
|
33118
33546
|
|
|
33119
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33547
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
|
|
33120
33548
|
var GENERATED = [
|
|
33121
33549
|
{
|
|
33122
33550
|
"name": "20261010184427_initial",
|
|
@@ -33979,10 +34407,40 @@ WHERE json_type(params, '$.selection') = 'object';`
|
|
|
33979
34407
|
"CREATE TRIGGER document_trigrams_bd BEFORE DELETE ON documents BEGIN\n DELETE FROM document_trigrams WHERE rowid = old.id;\nEND;",
|
|
33980
34408
|
"-- 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;"
|
|
33981
34409
|
]
|
|
34410
|
+
},
|
|
34411
|
+
{
|
|
34412
|
+
"name": "20261031230945_version-41-task-fields",
|
|
34413
|
+
"statements": [
|
|
34414
|
+
"ALTER TABLE `tasks` ADD `priority_score` real;",
|
|
34415
|
+
"ALTER TABLE `tasks` ADD `agent` text;",
|
|
34416
|
+
"ALTER TABLE `tasks` ADD `revision` integer DEFAULT 1 NOT NULL;",
|
|
34417
|
+
"-- 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;",
|
|
34418
|
+
"-- 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;",
|
|
34419
|
+
"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;",
|
|
34420
|
+
"-- 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;"
|
|
34421
|
+
]
|
|
34422
|
+
},
|
|
34423
|
+
{
|
|
34424
|
+
"name": "20261101002523_version-42-task-revision",
|
|
34425
|
+
"statements": [
|
|
34426
|
+
"-- 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;",
|
|
34427
|
+
"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;",
|
|
34428
|
+
"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;",
|
|
34429
|
+
"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;",
|
|
34430
|
+
"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;",
|
|
34431
|
+
"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;"
|
|
34432
|
+
]
|
|
34433
|
+
},
|
|
34434
|
+
{
|
|
34435
|
+
"name": "20261101011859_version-43-memory-project",
|
|
34436
|
+
"statements": [
|
|
34437
|
+
"ALTER TABLE `memories` ADD `project_id` integer REFERENCES projects(id);",
|
|
34438
|
+
"CREATE INDEX `memories_by_project_id` ON `memories` (`project_id`);"
|
|
34439
|
+
]
|
|
33982
34440
|
}
|
|
33983
34441
|
];
|
|
33984
34442
|
|
|
33985
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34443
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
|
|
33986
34444
|
var MANIFEST = [
|
|
33987
34445
|
{ name: "20261010184427_initial", version: 1, minCompatible: 1 },
|
|
33988
34446
|
{ name: "20261011035353_version-2-facts", version: 2, minCompatible: 1 },
|
|
@@ -34036,7 +34494,10 @@ var MANIFEST = [
|
|
|
34036
34494
|
{ name: "20261029224106_version-38-folded-names", version: 38, minCompatible: 34 },
|
|
34037
34495
|
{ name: "20261029224107_version-38-folded-triggers", version: 38, minCompatible: 34 },
|
|
34038
34496
|
{ name: "20261030114008_version-39-email-locations", version: 39, minCompatible: 34 },
|
|
34039
|
-
{ name: "20261030225520_version-40-note-trigrams", version: 40, minCompatible: 34 }
|
|
34497
|
+
{ name: "20261030225520_version-40-note-trigrams", version: 40, minCompatible: 34 },
|
|
34498
|
+
{ name: "20261031230945_version-41-task-fields", version: 41, minCompatible: 34 },
|
|
34499
|
+
{ name: "20261101002523_version-42-task-revision", version: 42, minCompatible: 34 },
|
|
34500
|
+
{ name: "20261101011859_version-43-memory-project", version: 43, minCompatible: 34 }
|
|
34040
34501
|
];
|
|
34041
34502
|
var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated = GENERATED) => {
|
|
34042
34503
|
const migrations = [];
|
|
@@ -34060,7 +34521,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
|
|
|
34060
34521
|
return migrations;
|
|
34061
34522
|
}, "generatedMigrations");
|
|
34062
34523
|
|
|
34063
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34524
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/migrations.js
|
|
34064
34525
|
var MIGRATIONS = generatedMigrations();
|
|
34065
34526
|
var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
34066
34527
|
version INTEGER PRIMARY KEY,
|
|
@@ -34113,7 +34574,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
|
|
|
34113
34574
|
}
|
|
34114
34575
|
}, "migrate");
|
|
34115
34576
|
|
|
34116
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34577
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
|
|
34117
34578
|
var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
34118
34579
|
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 ?");
|
|
34119
34580
|
if (pending.get(0, 1) === void 0)
|
|
@@ -34135,7 +34596,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
|
34135
34596
|
}
|
|
34136
34597
|
}, "fillJoinKeys");
|
|
34137
34598
|
|
|
34138
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34599
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
|
|
34139
34600
|
var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
|
|
34140
34601
|
const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
|
|
34141
34602
|
try {
|
|
@@ -34148,8 +34609,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
|
|
|
34148
34609
|
}, "openSqlite");
|
|
34149
34610
|
var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
34150
34611
|
quietSqliteWarning();
|
|
34151
|
-
const { drizzle } = await import("./node-
|
|
34152
|
-
const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-
|
|
34612
|
+
const { drizzle } = await import("./node-SZAO6HTA.js");
|
|
34613
|
+
const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-O34FFLRV.js");
|
|
34153
34614
|
const client = await nodeClient(path, { readOnly });
|
|
34154
34615
|
try {
|
|
34155
34616
|
return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
|
|
@@ -34159,8 +34620,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
|
34159
34620
|
}
|
|
34160
34621
|
}, "openUnderNode");
|
|
34161
34622
|
var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
34162
|
-
const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-
|
|
34163
|
-
const { drizzle } = await import("./bun-
|
|
34623
|
+
const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-TTTKY7H2.js");
|
|
34624
|
+
const { drizzle } = await import("./bun-B7YXDIMT.js");
|
|
34164
34625
|
const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
|
|
34165
34626
|
try {
|
|
34166
34627
|
return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
|
|
@@ -34170,7 +34631,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
|
34170
34631
|
}
|
|
34171
34632
|
}, "openUnderBun");
|
|
34172
34633
|
|
|
34173
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34634
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
|
|
34174
34635
|
var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
|
|
34175
34636
|
const ours = MIGRATIONS.at(-1)?.version ?? 0;
|
|
34176
34637
|
if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
|
|
@@ -34185,7 +34646,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
|
|
|
34185
34646
|
throw new CliError("configuration_error", `The store requires schema ${minCompatible}, but this tool supports ${ours}; ${refusalAdvice(storeClients(database), command, version)}`);
|
|
34186
34647
|
}, "assertReadCompatible");
|
|
34187
34648
|
|
|
34188
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34649
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
|
|
34189
34650
|
var BACKFILL_ON_OPEN = 5e3;
|
|
34190
34651
|
var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
|
|
34191
34652
|
var createWritable = /* @__PURE__ */ __name((file) => {
|
|
@@ -34241,13 +34702,13 @@ var openStoreContext = /* @__PURE__ */ __name(async ({ path, env, now: now2 = Da
|
|
|
34241
34702
|
}
|
|
34242
34703
|
}, "openStoreContext");
|
|
34243
34704
|
|
|
34244
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34705
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
|
|
34245
34706
|
import { createHash as createHash17 } from "node:crypto";
|
|
34246
34707
|
|
|
34247
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34708
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
|
|
34248
34709
|
import { createHash as createHash16 } from "node:crypto";
|
|
34249
34710
|
|
|
34250
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34711
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
|
|
34251
34712
|
var text3 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
|
|
34252
34713
|
var ref = text3(2048);
|
|
34253
34714
|
var timestamp2 = pipe(number(), safeInteger(), minValue(0));
|
|
@@ -34313,10 +34774,10 @@ var projectAnnotationsSchema = strictObject({
|
|
|
34313
34774
|
}))
|
|
34314
34775
|
});
|
|
34315
34776
|
|
|
34316
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34777
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
|
|
34317
34778
|
var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
|
|
34318
|
-
var invalid5 = /* @__PURE__ */ __name((
|
|
34319
|
-
throw new CliError("validation_error", `invalid project annotations.${
|
|
34779
|
+
var invalid5 = /* @__PURE__ */ __name((field4) => {
|
|
34780
|
+
throw new CliError("validation_error", `invalid project annotations.${field4}`);
|
|
34320
34781
|
}, "invalid");
|
|
34321
34782
|
var canonical = /* @__PURE__ */ __name((ref3) => {
|
|
34322
34783
|
try {
|
|
@@ -34446,7 +34907,7 @@ var projectAnnotationsFingerprint = /* @__PURE__ */ __name((json3) => {
|
|
|
34446
34907
|
return createHash16("sha256").update(JSON.stringify(normalized)).digest("hex");
|
|
34447
34908
|
}, "projectAnnotationsFingerprint");
|
|
34448
34909
|
|
|
34449
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34910
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
|
|
34450
34911
|
var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
|
|
34451
34912
|
var ref2 = pipe(string(), minLength(1), maxLength(2048));
|
|
34452
34913
|
var targetSchema = strictObject({
|
|
@@ -34466,8 +34927,8 @@ var kind2 = /* @__PURE__ */ __name((ref3) => {
|
|
|
34466
34927
|
const parsed2 = parseReference(ref3);
|
|
34467
34928
|
return "provider" in parsed2 ? `${parsed2.type}:${parsed2.provider}` : parsed2.type;
|
|
34468
34929
|
}, "kind");
|
|
34469
|
-
var invalid6 = /* @__PURE__ */ __name((
|
|
34470
|
-
throw new CliError("validation_error", `invalid project annotation plan.${
|
|
34930
|
+
var invalid6 = /* @__PURE__ */ __name((field4) => {
|
|
34931
|
+
throw new CliError("validation_error", `invalid project annotation plan.${field4}`);
|
|
34471
34932
|
}, "invalid");
|
|
34472
34933
|
var projectAnnotationBindingSources = /* @__PURE__ */ __name((manifest, bindings) => {
|
|
34473
34934
|
if (!bindings || typeof bindings !== "object" || Array.isArray(bindings) || Object.keys(bindings).length > 1001)
|
|
@@ -34553,7 +35014,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
|
|
|
34553
35014
|
}, "planBoundProjectAnnotations");
|
|
34554
35015
|
var planProjectAnnotations = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotations(json3), projectAnnotationsFingerprint(json3), target, bindings), "planProjectAnnotations");
|
|
34555
35016
|
|
|
34556
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35017
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
|
|
34557
35018
|
import { createHash as createHash18 } from "node:crypto";
|
|
34558
35019
|
var text4 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
|
|
34559
35020
|
var timestamp3 = pipe(number(), safeInteger(), minValue(0));
|
|
@@ -34600,8 +35061,8 @@ var snapshotGraph = /* @__PURE__ */ __name((value) => ({
|
|
|
34600
35061
|
external: value.external
|
|
34601
35062
|
}), "snapshotGraph");
|
|
34602
35063
|
var decodeProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3) => {
|
|
34603
|
-
const invalid8 = /* @__PURE__ */ __name((
|
|
34604
|
-
throw new CliError("validation_error", `invalid project annotation snapshot.${
|
|
35064
|
+
const invalid8 = /* @__PURE__ */ __name((field4) => {
|
|
35065
|
+
throw new CliError("validation_error", `invalid project annotation snapshot.${field4}`);
|
|
34605
35066
|
}, "invalid");
|
|
34606
35067
|
if (typeof json3 !== "string" || Buffer.byteLength(json3) > PROJECT_ANNOTATIONS_MAX_BYTES)
|
|
34607
35068
|
return invalid8("bytes");
|
|
@@ -34617,13 +35078,13 @@ var decodeProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3) => {
|
|
|
34617
35078
|
const snapshot2 = checked.output;
|
|
34618
35079
|
if (snapshot2.aliases.length + snapshot2.facts.length + snapshot2.links.length + snapshot2.external.length > 1e3)
|
|
34619
35080
|
return invalid8("record budget");
|
|
34620
|
-
for (const
|
|
34621
|
-
if (snapshot2.project[
|
|
34622
|
-
return invalid8(`project.${
|
|
35081
|
+
for (const field4 of ["description", "status", "owner"])
|
|
35082
|
+
if (snapshot2.project[field4] !== null && !snapshot2.project[field4].trim())
|
|
35083
|
+
return invalid8(`project.${field4}`);
|
|
34623
35084
|
for (const alias2 of snapshot2.aliases)
|
|
34624
|
-
for (const
|
|
34625
|
-
if (!alias2[
|
|
34626
|
-
return invalid8(`aliases.${
|
|
35085
|
+
for (const field4 of ["name", "source"])
|
|
35086
|
+
if (!alias2[field4].trim())
|
|
35087
|
+
return invalid8(`aliases.${field4}`);
|
|
34627
35088
|
if (snapshot2.project.updated_at < snapshot2.project.created_at)
|
|
34628
35089
|
return invalid8("project.updated_at");
|
|
34629
35090
|
for (const alias2 of snapshot2.aliases)
|
|
@@ -34647,14 +35108,14 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
|
|
|
34647
35108
|
})).digest("hex");
|
|
34648
35109
|
}, "projectAnnotationSnapshotFingerprint");
|
|
34649
35110
|
|
|
34650
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35111
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
|
|
34651
35112
|
var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
|
|
34652
35113
|
if (!request || typeof request !== "object" || Array.isArray(request))
|
|
34653
35114
|
throw new CliError("validation_error", "project annotation request is required");
|
|
34654
35115
|
const fields4 = ["snapshot", "project", "bindings", "maxReadBytes", ...restore ? ["fingerprint"] : []];
|
|
34655
|
-
for (const
|
|
34656
|
-
if (!fields4.includes(
|
|
34657
|
-
throw new CliError("validation_error", `unknown project annotation field ${
|
|
35116
|
+
for (const field4 of Object.keys(request))
|
|
35117
|
+
if (!fields4.includes(field4))
|
|
35118
|
+
throw new CliError("validation_error", `unknown project annotation field ${field4}`);
|
|
34658
35119
|
const snapshot2 = decodeProjectAnnotationSnapshot(request.snapshot);
|
|
34659
35120
|
projectAnnotationBindingSources(snapshot2, request.bindings);
|
|
34660
35121
|
if (typeof request.project !== "string" || !/^project:[1-9]\d*$/.test(request.project) || !Number.isSafeInteger(Number(request.project.slice(8))))
|
|
@@ -34664,7 +35125,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
|
|
|
34664
35125
|
return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
|
|
34665
35126
|
}, "projectAnnotationRequest");
|
|
34666
35127
|
|
|
34667
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35128
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
|
|
34668
35129
|
var SnapshotBudget = class {
|
|
34669
35130
|
static {
|
|
34670
35131
|
__name(this, "SnapshotBudget");
|
|
@@ -34684,19 +35145,19 @@ var SnapshotBudget = class {
|
|
|
34684
35145
|
this.bytes += bytes3;
|
|
34685
35146
|
}
|
|
34686
35147
|
rows(database, from2, fields4, parameters) {
|
|
34687
|
-
const bytes3 = fields4.map((
|
|
35148
|
+
const bytes3 = fields4.map((field4) => `coalesce(length(CAST(${field4} AS BLOB)),0)`).join("+");
|
|
34688
35149
|
const sized = database.prepare(`SELECT ${bytes3} AS bytes ${from2} LIMIT 1001`).all(...parameters);
|
|
34689
35150
|
this.reserve(sized.length, sized.reduce((sum, row2) => sum + Number(row2.bytes) + 128, 0));
|
|
34690
35151
|
}
|
|
34691
35152
|
};
|
|
34692
35153
|
|
|
34693
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35154
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
|
|
34694
35155
|
import { createHash as createHash20 } from "node:crypto";
|
|
34695
35156
|
|
|
34696
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35157
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
|
|
34697
35158
|
var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
|
|
34698
35159
|
|
|
34699
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35160
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
|
|
34700
35161
|
import { createHash as createHash19 } from "node:crypto";
|
|
34701
35162
|
var invalid7 = /* @__PURE__ */ __name(() => {
|
|
34702
35163
|
throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
|
|
@@ -34839,7 +35300,7 @@ var ProjectSnapshotSources = class {
|
|
|
34839
35300
|
}
|
|
34840
35301
|
};
|
|
34841
35302
|
|
|
34842
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35303
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
|
|
34843
35304
|
var unsupported = /* @__PURE__ */ __name(() => {
|
|
34844
35305
|
throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
|
|
34845
35306
|
}, "unsupported");
|
|
@@ -34865,7 +35326,7 @@ var provenance = /* @__PURE__ */ __name((raw) => {
|
|
|
34865
35326
|
return unsupported();
|
|
34866
35327
|
return text5 ?? null;
|
|
34867
35328
|
}, "provenance");
|
|
34868
|
-
var projectAnnotationSnapshot = /* @__PURE__ */ __name((database,
|
|
35329
|
+
var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, budget) => read(database, () => {
|
|
34869
35330
|
if (database.prepare("SELECT max(version) AS version FROM schema_migrations").get()?.version !== MIGRATIONS.at(-1)?.version)
|
|
34870
35331
|
throw new CliError("configuration_error", "project snapshots require the SDK's current store schema without source migration");
|
|
34871
35332
|
const sources = new ProjectSnapshotSources(database, budget);
|
|
@@ -34873,7 +35334,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
|
|
|
34873
35334
|
budget.rows(database, from2, fields4, params);
|
|
34874
35335
|
return database.prepare(`SELECT ${fields4.join(",")} ${from2} LIMIT 1001`).all(...params);
|
|
34875
35336
|
}, "rows");
|
|
34876
|
-
const descriptor = database.prepare("SELECT account_id,deleted_at FROM projects WHERE id=?").get(
|
|
35337
|
+
const descriptor = database.prepare("SELECT account_id,deleted_at FROM projects WHERE id=?").get(projectId2);
|
|
34877
35338
|
if (!descriptor)
|
|
34878
35339
|
throw new CliError("not_found", "the source project does not exist");
|
|
34879
35340
|
if (descriptor.account_id !== null || descriptor.deleted_at !== null)
|
|
@@ -34891,13 +35352,13 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
|
|
|
34891
35352
|
"status",
|
|
34892
35353
|
"created_at",
|
|
34893
35354
|
"updated_at"
|
|
34894
|
-
], [
|
|
35355
|
+
], [projectId2])[0];
|
|
34895
35356
|
if (!project)
|
|
34896
35357
|
throw new CliError("not_found", "the source project does not exist");
|
|
34897
|
-
const aliases2 = rows("FROM aliases WHERE aliasable_type='project' AND aliasable_id=? ORDER BY id", ["name", "source", "display", "account_id", "created_at", "updated_at"], [
|
|
35358
|
+
const aliases2 = rows("FROM aliases WHERE aliasable_type='project' AND aliasable_id=? ORDER BY id", ["name", "source", "display", "account_id", "created_at", "updated_at"], [projectId2]);
|
|
34898
35359
|
if (aliases2.some((alias2) => alias2.account_id !== null))
|
|
34899
35360
|
return unsupported();
|
|
34900
|
-
if (database.prepare("SELECT 1 FROM facts WHERE project_id=? AND (metadata IS NOT NULL OR deleted_at IS NOT NULL) LIMIT 1").get(
|
|
35361
|
+
if (database.prepare("SELECT 1 FROM facts WHERE project_id=? AND (metadata IS NOT NULL OR deleted_at IS NOT NULL) LIMIT 1").get(projectId2))
|
|
34901
35362
|
return unsupported();
|
|
34902
35363
|
const facts2 = rows("FROM facts WHERE project_id=? ORDER BY id", [
|
|
34903
35364
|
"id",
|
|
@@ -34917,7 +35378,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
|
|
|
34917
35378
|
"source",
|
|
34918
35379
|
"created_at",
|
|
34919
35380
|
"updated_at"
|
|
34920
|
-
], [
|
|
35381
|
+
], [projectId2]);
|
|
34921
35382
|
const links2 = rows("FROM links WHERE (from_type='project' AND from_id=?) OR (to_type='project' AND to_id=?) OR (from_type='fact' AND from_id IN (SELECT id FROM facts WHERE project_id=?)) OR (to_type='fact' AND to_id IN (SELECT id FROM facts WHERE project_id=?)) ORDER BY id", [
|
|
34922
35383
|
"id",
|
|
34923
35384
|
"from_type",
|
|
@@ -34935,8 +35396,8 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
|
|
|
34935
35396
|
"author",
|
|
34936
35397
|
"created_at",
|
|
34937
35398
|
"updated_at"
|
|
34938
|
-
], [
|
|
34939
|
-
const projectRef = `project:${
|
|
35399
|
+
], [projectId2, projectId2, projectId2, projectId2]);
|
|
35400
|
+
const projectRef = `project:${projectId2}`;
|
|
34940
35401
|
const owned = /* @__PURE__ */ new Set([projectRef, ...facts2.map((row2) => `fact:${row2.id}`)]);
|
|
34941
35402
|
const data = {
|
|
34942
35403
|
format: "wirecat.project-annotations",
|
|
@@ -35010,9 +35471,9 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, bud
|
|
|
35010
35471
|
return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
|
|
35011
35472
|
}), "projectAnnotationSnapshot");
|
|
35012
35473
|
|
|
35013
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35014
|
-
var previewAnnotationSnapshot = /* @__PURE__ */ __name((database,
|
|
35015
|
-
const current = projectAnnotationSnapshot(database,
|
|
35474
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
|
|
35475
|
+
var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, manifest, bindings, budget) => read(database, () => {
|
|
35476
|
+
const current = projectAnnotationSnapshot(database, projectId2, budget).snapshot;
|
|
35016
35477
|
const sources = new ProjectSnapshotSources(database, budget);
|
|
35017
35478
|
for (const ref3 of new Set(Object.values(bindings))) {
|
|
35018
35479
|
if (ref3 === current.project.ref)
|
|
@@ -35033,7 +35494,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
|
|
|
35033
35494
|
const names = new Set([manifest.project.key, manifest.project.name, ...manifest.aliases.map((a) => a.name)].map(normalizeVocabularyName));
|
|
35034
35495
|
const namespace = /* @__PURE__ */ new Set();
|
|
35035
35496
|
for (const project of projects2) {
|
|
35036
|
-
if (project.id ===
|
|
35497
|
+
if (project.id === projectId2)
|
|
35037
35498
|
continue;
|
|
35038
35499
|
const keyMatches = names.has(normalizeVocabularyName(String(project.key)));
|
|
35039
35500
|
const nameMatches = project.account_id === null && project.deleted_at === null && names.has(normalizeVocabularyName(String(project.name)));
|
|
@@ -35041,13 +35502,13 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
|
|
|
35041
35502
|
namespace.add(`project:${project.id}`);
|
|
35042
35503
|
}
|
|
35043
35504
|
for (const alias2 of aliases2) {
|
|
35044
|
-
if (alias2.aliasable_id ===
|
|
35505
|
+
if (alias2.aliasable_id === projectId2 || alias2.account_id !== null)
|
|
35045
35506
|
continue;
|
|
35046
35507
|
const project = projects2.find((p) => p.id === alias2.aliasable_id && p.account_id === null && p.deleted_at === null);
|
|
35047
35508
|
if (project && names.has(normalizeVocabularyName(String(alias2.name))))
|
|
35048
35509
|
namespace.add(`project:${project.id}`);
|
|
35049
35510
|
}
|
|
35050
|
-
const descriptor_conflicts = ["key", "name"].filter((
|
|
35511
|
+
const descriptor_conflicts = ["key", "name"].filter((field4) => current.project[field4] !== manifest.project[field4]);
|
|
35051
35512
|
const target = {
|
|
35052
35513
|
project: current.project.ref,
|
|
35053
35514
|
annotation_count: current.aliases.length + current.facts.length + current.links.length,
|
|
@@ -35072,8 +35533,8 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId, man
|
|
|
35072
35533
|
};
|
|
35073
35534
|
}), "previewAnnotationSnapshot");
|
|
35074
35535
|
|
|
35075
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35076
|
-
var restoreAnnotationRecords = /* @__PURE__ */ __name((database,
|
|
35536
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
|
|
35537
|
+
var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, snapshot2, bindings) => {
|
|
35077
35538
|
const mappings = { ...bindings };
|
|
35078
35539
|
const resolve = /* @__PURE__ */ __name((ref3) => {
|
|
35079
35540
|
if (ref3 === null)
|
|
@@ -35084,14 +35545,14 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snap
|
|
|
35084
35545
|
return thing;
|
|
35085
35546
|
}, "resolve");
|
|
35086
35547
|
const organization = resolve(snapshot2.project.organization), owner = resolve(snapshot2.project.owner);
|
|
35087
|
-
database.prepare("UPDATE projects SET description=?,type=?,scope=?,organization_id=?,owner_type=?,owner_id=?,status=?,created_at=?,updated_at=? WHERE id=?").run(snapshot2.project.description, snapshot2.project.type, snapshot2.project.scope, organization?.id ?? null, owner?.type ?? null, owner?.id ?? null, snapshot2.project.status, snapshot2.project.created_at, snapshot2.project.updated_at,
|
|
35548
|
+
database.prepare("UPDATE projects SET description=?,type=?,scope=?,organization_id=?,owner_type=?,owner_id=?,status=?,created_at=?,updated_at=? WHERE id=?").run(snapshot2.project.description, snapshot2.project.type, snapshot2.project.scope, organization?.id ?? null, owner?.type ?? null, owner?.id ?? null, snapshot2.project.status, snapshot2.project.created_at, snapshot2.project.updated_at, projectId2);
|
|
35088
35549
|
for (const alias2 of snapshot2.aliases)
|
|
35089
|
-
database.prepare("INSERT INTO aliases(aliasable_type,aliasable_id,account_id,name,name_folded,display,source,created_at,updated_at) VALUES('project',?,NULL,?,?,?,?,?,?)").run(
|
|
35550
|
+
database.prepare("INSERT INTO aliases(aliasable_type,aliasable_id,account_id,name,name_folded,display,source,created_at,updated_at) VALUES('project',?,NULL,?,?,?,?,?,?)").run(projectId2, alias2.name, fold(alias2.name), Number(alias2.display), alias2.source, alias2.created_at, alias2.updated_at);
|
|
35090
35551
|
for (const fact of snapshot2.facts) {
|
|
35091
35552
|
const author = resolve(fact.author), confirmed = resolve(fact.confirmed_by);
|
|
35092
35553
|
if (!author)
|
|
35093
35554
|
throw new CliError("validation_error", "project annotation author is required");
|
|
35094
|
-
const row2 = database.prepare("INSERT INTO facts(id,type,statement,status,project_id,subject_type,subject_id,occurred_at,supersedes_id,author_type,author_id,model,confirmed_by_type,confirmed_by_id,scope,source,created_at,updated_at) VALUES(?,?,?,?,?,NULL,NULL,?,NULL,?,?,?,?,?,?,?,?,?) RETURNING id").get(nextId(database, "facts"), fact.type, fact.statement, fact.status,
|
|
35555
|
+
const row2 = database.prepare("INSERT INTO facts(id,type,statement,status,project_id,subject_type,subject_id,occurred_at,supersedes_id,author_type,author_id,model,confirmed_by_type,confirmed_by_id,scope,source,created_at,updated_at) VALUES(?,?,?,?,?,NULL,NULL,?,NULL,?,?,?,?,?,?,?,?,?) RETURNING id").get(nextId(database, "facts"), fact.type, fact.statement, fact.status, projectId2, fact.occurred_at, author.type, author.id, fact.model, confirmed?.type ?? null, confirmed?.id ?? null, fact.scope, fact.source, fact.created_at, fact.updated_at);
|
|
35095
35556
|
if (!row2)
|
|
35096
35557
|
throw new CliError("configuration_error", "project annotation fact insertion failed");
|
|
35097
35558
|
mappings[fact.ref] = `fact:${row2.id}`;
|
|
@@ -35114,21 +35575,21 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId, snap
|
|
|
35114
35575
|
return mappings;
|
|
35115
35576
|
}, "restoreAnnotationRecords");
|
|
35116
35577
|
|
|
35117
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35578
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
|
|
35118
35579
|
var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
35119
35580
|
async preview(request) {
|
|
35120
|
-
const { snapshot: snapshot2, projectId } = projectAnnotationRequest(request);
|
|
35121
|
-
return previewAnnotationSnapshot(database,
|
|
35581
|
+
const { snapshot: snapshot2, projectId: projectId2 } = projectAnnotationRequest(request);
|
|
35582
|
+
return previewAnnotationSnapshot(database, projectId2, snapshot2, request.bindings, new SnapshotBudget(request.maxReadBytes ?? 4 * 1024 * 1024));
|
|
35122
35583
|
},
|
|
35123
35584
|
async restore(request) {
|
|
35124
|
-
const { snapshot: snapshot2, projectId } = projectAnnotationRequest(request, true);
|
|
35585
|
+
const { snapshot: snapshot2, projectId: projectId2 } = projectAnnotationRequest(request, true);
|
|
35125
35586
|
const budget = new SnapshotBudget(request.maxReadBytes ?? 4 * 1024 * 1024);
|
|
35126
35587
|
try {
|
|
35127
35588
|
return write(database, () => {
|
|
35128
|
-
const preview = previewAnnotationSnapshot(database,
|
|
35589
|
+
const preview = previewAnnotationSnapshot(database, projectId2, snapshot2, request.bindings, budget);
|
|
35129
35590
|
if (!preview.ready || preview.fingerprint !== request.fingerprint)
|
|
35130
35591
|
throw new CliError("validation_error", "project annotation preview is stale or has conflicts; preview again");
|
|
35131
|
-
const mappings = restoreAnnotationRecords(database,
|
|
35592
|
+
const mappings = restoreAnnotationRecords(database, projectId2, snapshot2, request.bindings);
|
|
35132
35593
|
return {
|
|
35133
35594
|
project: request.project,
|
|
35134
35595
|
fingerprint: preview.fingerprint,
|
|
@@ -35144,7 +35605,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
35144
35605
|
}
|
|
35145
35606
|
}), "projectAnnotationStoreOver");
|
|
35146
35607
|
|
|
35147
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35608
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
|
|
35148
35609
|
var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
|
|
35149
35610
|
const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
|
|
35150
35611
|
let merged = { from: from2, to };
|
|
@@ -35157,7 +35618,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
|
|
|
35157
35618
|
}, "markRange");
|
|
35158
35619
|
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");
|
|
35159
35620
|
|
|
35160
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35621
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
|
|
35161
35622
|
var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
|
|
35162
35623
|
var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
|
|
35163
35624
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
|
|
@@ -35167,7 +35628,7 @@ var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) =
|
|
|
35167
35628
|
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);
|
|
35168
35629
|
}, "setTaskRulesStop");
|
|
35169
35630
|
|
|
35170
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35631
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sync.js
|
|
35171
35632
|
var syncStoreOver = /* @__PURE__ */ __name((context) => {
|
|
35172
35633
|
const { database } = context;
|
|
35173
35634
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
|
|
@@ -35223,7 +35684,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
35223
35684
|
};
|
|
35224
35685
|
}, "syncStoreOver");
|
|
35225
35686
|
|
|
35226
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35687
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/tags.js
|
|
35227
35688
|
var tagsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
35228
35689
|
const { database } = context;
|
|
35229
35690
|
return {
|
|
@@ -35245,7 +35706,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
35245
35706
|
};
|
|
35246
35707
|
}, "tagsStoreOver");
|
|
35247
35708
|
|
|
35248
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35709
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
|
|
35249
35710
|
var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
|
|
35250
35711
|
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
|
|
35251
35712
|
WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
|
|
@@ -35372,7 +35833,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
|
|
|
35372
35833
|
dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
|
|
35373
35834
|
}, "savePictureChunks");
|
|
35374
35835
|
|
|
35375
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35836
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
|
|
35376
35837
|
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,
|
|
35377
35838
|
EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
|
|
35378
35839
|
FROM messages m
|
|
@@ -35461,7 +35922,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
|
|
|
35461
35922
|
return plain2(best(found2));
|
|
35462
35923
|
}, "nearestMessages");
|
|
35463
35924
|
|
|
35464
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35925
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/vectors.js
|
|
35465
35926
|
var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
|
|
35466
35927
|
const { database } = context;
|
|
35467
35928
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -35620,12 +36081,12 @@ var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
|
|
|
35620
36081
|
});
|
|
35621
36082
|
return cleared;
|
|
35622
36083
|
}, "clearVectors"),
|
|
35623
|
-
nearestConversations: /* @__PURE__ */ __name(async (key2, { chatId, model, since, limit, query, exclude, conversations: conversations2, scope: scope3, projectId, personId, before: before2 }) => {
|
|
36084
|
+
nearestConversations: /* @__PURE__ */ __name(async (key2, { chatId, model, since, limit, query, exclude, conversations: conversations2, scope: scope3, projectId: projectId2, personId, before: before2 }) => {
|
|
35624
36085
|
const accountPk2 = findAccountPk2(key2);
|
|
35625
36086
|
if (accountPk2 === void 0)
|
|
35626
36087
|
return [];
|
|
35627
36088
|
const chatKey = chatId === void 0 ? void 0 : chatKeyOf(key2, chatId);
|
|
35628
|
-
const mailToo = key2.provider === "email" && conversations2 === void 0 && scope3 === void 0 &&
|
|
36089
|
+
const mailToo = key2.provider === "email" && conversations2 === void 0 && scope3 === void 0 && projectId2 === void 0 && personId === void 0 && before2 === void 0;
|
|
35629
36090
|
const mailHits = /* @__PURE__ */ __name(async () => mailToo ? (await mail().nearest(model, query, {
|
|
35630
36091
|
accountId: accountPk2,
|
|
35631
36092
|
limit,
|
|
@@ -35648,7 +36109,7 @@ var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
|
|
|
35648
36109
|
query,
|
|
35649
36110
|
...conversations2 === void 0 ? {} : { conversations: conversations2 },
|
|
35650
36111
|
...scope3 === void 0 ? {} : { scope: scope3 },
|
|
35651
|
-
...
|
|
36112
|
+
...projectId2 === void 0 ? {} : { projectId: Number(projectId2) },
|
|
35652
36113
|
...personId === void 0 ? {} : { personId: Number(personId) },
|
|
35653
36114
|
...before2 === void 0 ? {} : { before: Date.parse(before2) }
|
|
35654
36115
|
});
|
|
@@ -35719,7 +36180,7 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
35719
36180
|
embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
|
|
35720
36181
|
}), "vectorsStoreOver");
|
|
35721
36182
|
|
|
35722
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36183
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
|
|
35723
36184
|
import { existsSync, readFileSync as readFileSync4 } from "node:fs";
|
|
35724
36185
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
35725
36186
|
var BOOKKEEPING = ["schema_migrations", "store_settings"];
|
|
@@ -35807,10 +36268,10 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
|
|
|
35807
36268
|
}
|
|
35808
36269
|
}, "lastBackup");
|
|
35809
36270
|
|
|
35810
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36271
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/providers.js
|
|
35811
36272
|
var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
|
|
35812
36273
|
|
|
35813
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36274
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
|
|
35814
36275
|
var COUNTED_TABLES = [
|
|
35815
36276
|
"accounts",
|
|
35816
36277
|
"chats",
|
|
@@ -35895,7 +36356,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
|
|
|
35895
36356
|
};
|
|
35896
36357
|
}, "storeContents");
|
|
35897
36358
|
|
|
35898
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36359
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.519.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_3a77a7242330d89656a32c8be893f1d1/node_modules/@wirecat/cli-core/dist/store/store.js
|
|
35899
36360
|
var openStore = /* @__PURE__ */ __name(async (options = {}) => {
|
|
35900
36361
|
const context = await openStoreContext(options);
|
|
35901
36362
|
try {
|
|
@@ -36130,6 +36591,7 @@ export {
|
|
|
36130
36591
|
stemmersOrigin,
|
|
36131
36592
|
stemsState,
|
|
36132
36593
|
stemmerCache,
|
|
36594
|
+
isBusy,
|
|
36133
36595
|
write,
|
|
36134
36596
|
read,
|
|
36135
36597
|
vectorIndexCounts,
|
|
@@ -36168,6 +36630,8 @@ export {
|
|
|
36168
36630
|
DEFAULT_FIRST_PASS_PER_CHAT,
|
|
36169
36631
|
firstPassPerChatOf,
|
|
36170
36632
|
savedFirstPassPerChat,
|
|
36633
|
+
TASK_SORTS,
|
|
36634
|
+
PROJECT_TASK_FIELDS,
|
|
36171
36635
|
TASK_RELATION_KINDS,
|
|
36172
36636
|
TASK_ROLES,
|
|
36173
36637
|
TASK_EVENT_KINDS,
|