@wirecat/tg-cli 0.114.0 → 0.116.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/tg.js +2 -2
- package/dist/bin/tg.js.map +1 -1
- package/dist/bot/transport.d.ts +10 -8
- package/dist/bot/transport.d.ts.map +1 -1
- package/dist/bot/transport.js +16 -2
- package/dist/bot/transport.js.map +1 -1
- package/dist/bundle/{adapter-YAEHX3QB.js → adapter-6CLMTQOV.js} +85 -56
- package/dist/bundle/{all-profiles-R5CW42HQ.js → all-profiles-R2UZMH24.js} +10 -8
- package/dist/bundle/{anthropic-F25RHYV2.js → anthropic-QKIPHV2Z.js} +6 -5
- package/dist/bundle/{app-server-FAG6FNXR.js → app-server-AZB2MFK6.js} +47 -43
- package/dist/bundle/{bot-api-KOIAXTQR.js → bot-api-2IM243J4.js} +53 -48
- package/dist/bundle/{bot-history-PRAOZEWC.js → bot-history-G6CRVCL2.js} +19 -17
- package/dist/bundle/{bun-XIMM6EHD.js → bun-JDKPISPX.js} +2 -2
- package/dist/bundle/{bun-sqlite-DSUCO4TR.js → bun-sqlite-X5PY5IQT.js} +5 -4
- package/dist/bundle/{chunk-CDCBFMEI.js → chunk-42GK3XRS.js} +2 -2
- package/dist/bundle/{chunk-YQ64ZNLD.js → chunk-4D5AUWAY.js} +28 -15
- package/dist/bundle/{chunk-IN25CJ3D.js → chunk-4IQZRW4O.js} +13 -13
- package/dist/bundle/{chunk-Y4LCSCSH.js → chunk-577MFPCP.js} +3 -3
- package/dist/bundle/{chunk-O7CBGHI7.js → chunk-5FCONCJO.js} +1 -1
- package/dist/bundle/{chunk-CS5DQ6KM.js → chunk-5VFPUOJO.js} +17 -14
- package/dist/bundle/{chunk-ZFMOPKPT.js → chunk-5ZIBAYIZ.js} +2 -2
- package/dist/bundle/{chunk-EARO464A.js → chunk-76CX2YPT.js} +210 -129
- package/dist/bundle/{chunk-E2IRSRTB.js → chunk-B4UOCWM4.js} +4 -2
- package/dist/bundle/{chunk-Y3AQHPAJ.js → chunk-BGMV66FC.js} +1 -1
- package/dist/bundle/{chunk-LPUFOWL3.js → chunk-D72URWJE.js} +1 -39
- package/dist/bundle/{chunk-WOQGUIXE.js → chunk-DP5LRU7K.js} +1 -1
- package/dist/bundle/chunk-EB2IULWB.js +72 -0
- package/dist/bundle/{chunk-4JOKO4IW.js → chunk-FDI4GOIP.js} +912 -493
- package/dist/bundle/{chunk-P4YBABUC.js → chunk-GV7ZJ33M.js} +6 -4
- package/dist/bundle/{chunk-C7K7AP6G.js → chunk-H72UEHNG.js} +69 -36
- package/dist/bundle/{chunk-2PAKHXIV.js → chunk-HBUJNNZD.js} +35 -35
- package/dist/bundle/{chunk-NTF34HJP.js → chunk-HK6SIIGG.js} +3 -3
- package/dist/bundle/{chunk-NUVBC3LJ.js → chunk-HLNYJPAB.js} +2 -2
- package/dist/bundle/{chunk-WIRDTH3J.js → chunk-HUOXUI2M.js} +22 -22
- package/dist/bundle/{chunk-RBC7JQ4Y.js → chunk-I6JF43YP.js} +5 -3
- package/dist/bundle/{chunk-OFDMD3YF.js → chunk-IR4S7POE.js} +8 -8
- package/dist/bundle/{chunk-3R43O3GG.js → chunk-JFTCOV37.js} +80 -24
- package/dist/bundle/{chunk-YPABTT7A.js → chunk-JJMQA272.js} +14 -89
- package/dist/bundle/{chunk-DQQEN3X4.js → chunk-K2RYCCTP.js} +4 -4
- package/dist/bundle/{chunk-OWHF6BON.js → chunk-K62YATVD.js} +6 -6
- package/dist/bundle/{chunk-6SPLZI5P.js → chunk-KA6EGOJY.js} +4 -4
- package/dist/bundle/chunk-KV4267S4.js +23 -0
- package/dist/bundle/{chunk-AL36NHO6.js → chunk-LFKEKSI5.js} +1043 -307
- package/dist/bundle/{chunk-7FOT4XD2.js → chunk-LSKGCJWD.js} +3426 -1298
- package/dist/bundle/{chunk-M3IWROIF.js → chunk-LXH3SKY3.js} +10 -8
- package/dist/bundle/{chunk-QCXYJKPF.js → chunk-MQ7MCVZV.js} +2 -2
- package/dist/bundle/{chunk-EQJG44KE.js → chunk-N42VUNTO.js} +2 -2
- package/dist/bundle/{chunk-KIZT2MI6.js → chunk-N6TIFJHW.js} +1 -1
- package/dist/bundle/{chunk-MQTTVQ3V.js → chunk-NL3PAFAE.js} +8 -8
- package/dist/bundle/{chunk-ULFTCR5W.js → chunk-NUYRMU56.js} +2 -2
- package/dist/bundle/{chunk-34USFPBF.js → chunk-OX6EWGSG.js} +185 -291
- package/dist/bundle/{chunk-KZQXOZFC.js → chunk-PPLFOIYX.js} +7 -20
- package/dist/bundle/{chunk-TTTDZOBW.js → chunk-PPSUA3IZ.js} +3 -3
- package/dist/bundle/{chunk-ALHKUQDZ.js → chunk-PXMHBTK3.js} +4 -4
- package/dist/bundle/{chunk-VVKEWWSO.js → chunk-QAKL3GXB.js} +1 -1
- package/dist/bundle/{chunk-I6BKSGZQ.js → chunk-QGL2UGML.js} +306 -190
- package/dist/bundle/{chunk-J5U2HKGZ.js → chunk-QHBVGKC3.js} +51 -30
- package/dist/bundle/{chunk-NJ2I4KFZ.js → chunk-R52RMHWF.js} +2 -2
- package/dist/bundle/chunk-RSDIPQXP.js +35 -0
- package/dist/bundle/{chunk-XDOPONC3.js → chunk-RSNGMNU5.js} +6 -6
- package/dist/bundle/{chunk-NKP3RUM4.js → chunk-SD5PUYKF.js} +14 -12
- package/dist/bundle/chunk-SKZ2E3WC.js +91 -0
- package/dist/bundle/{chunk-HA35XN2Z.js → chunk-T7CDLV33.js} +4 -4
- package/dist/bundle/{chunk-C34IDOA5.js → chunk-TZVL4U7U.js} +2 -2
- package/dist/bundle/{chunk-3EZ43DAF.js → chunk-UCSFO5GW.js} +3 -3
- package/dist/bundle/{chunk-NMVFFWF2.js → chunk-VQPLHOVQ.js} +9 -9
- package/dist/bundle/chunk-XBIPSSKI.js +166 -0
- package/dist/bundle/{chunk-VHO66SMY.js → chunk-XQUTJITP.js} +59 -57
- package/dist/bundle/{chunk-L4CMCC3V.js → chunk-Y6VWGJ4Q.js} +1 -1
- package/dist/bundle/{chunk-RFRI2HFT.js → chunk-YLRTLZF6.js} +1 -1
- package/dist/bundle/chunk-YPF6OS37.js +46 -0
- package/dist/bundle/{chunk-TKNCJMYN.js → chunk-YYKJN6H5.js} +946 -589
- package/dist/bundle/{chunk-5HKMEXVQ.js → chunk-ZDIAPICE.js} +4 -4
- package/dist/bundle/command-contract-DPXM4SZT.js +33 -0
- package/dist/bundle/{decode-7U4SXPAN.js → decode-W6YPTGJA.js} +7 -6
- package/dist/bundle/dispatch-H7EFNBEH.js +411 -0
- package/dist/bundle/{echarts-GKEZEAL7.js → echarts-YAWDIC5D.js} +2 -2
- package/dist/bundle/{embed-IDZDQMSW.js → embed-EN4UTLV5.js} +6 -5
- package/dist/bundle/{embedder-RY5R2PGO.js → embedder-HEKHRL7E.js} +11 -10
- package/dist/bundle/{entry-P6YZ3ZV6.js → entry-2KB6MTCG.js} +7 -6
- package/dist/bundle/failure-3DU3HLBQ.js +24 -0
- package/dist/bundle/first-run-LBG26WWO.js +27 -0
- package/dist/bundle/first-screen-TGTSLUI6.js +31 -0
- package/dist/bundle/{instructions-P5E34PQR.js → instructions-HA62QNPR.js} +1 -1
- package/dist/bundle/{mcp-FUSDPAOL.js → mcp-PPVOM4SE.js} +5 -3
- package/dist/bundle/{node-GKPRXS5Y.js → node-MZ2VWSQQ.js} +2 -2
- package/dist/bundle/{node-sqlite-VUXFVPJ6.js → node-sqlite-KNNS6DCM.js} +6 -5
- package/dist/bundle/{oauth-7SQIPMOY.js → oauth-KWUABBSQ.js} +7 -6
- package/dist/bundle/{open-W3BN2SIO.js → open-JXMCYCIV.js} +5 -4
- package/dist/bundle/{openai-LQTK3ZMC.js → openai-HL3IR4VT.js} +15 -14
- package/dist/bundle/{process-U2P5Z6UF.js → process-K2FICLWY.js} +1 -1
- package/dist/bundle/{program-DIPSLR6O.js → program-IFOMT4JS.js} +70 -57
- package/dist/bundle/{prompt-GESHKSM5.js → prompt-HVD3Q77P.js} +5 -4
- package/dist/bundle/{proxy-transport-C2EUUT32.js → proxy-transport-PA5SGMRY.js} +5 -4
- package/dist/bundle/{recognize-FEQTIJET.js → recognize-HHLVETKI.js} +4 -3
- package/dist/bundle/{remote-UXOPBPKS.js → remote-HUAKXJCS.js} +7 -6
- package/dist/bundle/{rerank-L4JM4REK.js → rerank-NWFIV7OF.js} +7 -6
- package/dist/bundle/{serve-DDWW44DB.js → serve-ANUKAJJN.js} +10 -9
- package/dist/bundle/{server-UTWBIZHB.js → server-7Q7WAOHO.js} +37 -34
- package/dist/bundle/server-HCQS4YDQ.js +60 -0
- package/dist/bundle/{state-EV7FGEK4.js → state-Y2AJ5XTP.js} +6 -5
- package/dist/bundle/{store-EXBUF4OG.js → store-S3IG5KWL.js} +15 -11
- package/dist/bundle/store-maintenance-command-V2WC4G6J.js +50 -0
- package/dist/bundle/tg.js +159 -14
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +7 -0
- package/dist/commands/session.js.map +1 -1
- package/dist/telegram/login.d.ts +2 -0
- package/dist/telegram/login.d.ts.map +1 -1
- package/dist/telegram/login.js +31 -2
- package/dist/telegram/login.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -4
- package/skills/tg-cli/SKILL.md +2 -0
- package/dist/bundle/chunk-TRRRRGMI.js +0 -18
- package/dist/bundle/command-contract-SOTDPG22.js +0 -31
- package/dist/bundle/first-run-66KTCVQK.js +0 -24
- package/dist/bundle/first-screen-NY46X6QU.js +0 -29
- package/dist/bundle/identity-GXVKGCNU.js +0 -11
- package/dist/bundle/server-ZI7WDAW6.js +0 -56
- package/dist/bundle/store-maintenance-command-UBZE2Z6T.js +0 -46
- /package/dist/bundle/{chunk-NUN6OGOV.js → chunk-LU3WKZBA.js} +0 -0
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
sameOrdinaryFile,
|
|
9
9
|
syncDirectory,
|
|
10
10
|
writeFileAtomic
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4IQZRW4O.js";
|
|
12
12
|
import {
|
|
13
13
|
Command,
|
|
14
14
|
DEFAULT_IMAGE_MODEL,
|
|
@@ -48,38 +48,17 @@ import {
|
|
|
48
48
|
typedCommand,
|
|
49
49
|
vectorModelKey,
|
|
50
50
|
withAttempt
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-LFKEKSI5.js";
|
|
52
52
|
import {
|
|
53
53
|
isCliFailure
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-JJMQA272.js";
|
|
55
55
|
import {
|
|
56
56
|
isNewer,
|
|
57
57
|
updateCommand
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-PPLFOIYX.js";
|
|
59
59
|
import {
|
|
60
60
|
readOnlyLockOf
|
|
61
|
-
} from "./chunk-
|
|
62
|
-
import {
|
|
63
|
-
MAX_MODEL_IMAGE_BYTES
|
|
64
|
-
} from "./chunk-QCXYJKPF.js";
|
|
65
|
-
import {
|
|
66
|
-
remoteKey
|
|
67
|
-
} from "./chunk-Y4LCSCSH.js";
|
|
68
|
-
import {
|
|
69
|
-
Unzip,
|
|
70
|
-
UnzipInflate,
|
|
71
|
-
defaultThreads,
|
|
72
|
-
installNativeRuntime,
|
|
73
|
-
isTextModelInstalled,
|
|
74
|
-
openEmbedder,
|
|
75
|
-
placedText,
|
|
76
|
-
runEmbedders,
|
|
77
|
-
textModelsDirectory
|
|
78
|
-
} from "./chunk-MQTTVQ3V.js";
|
|
79
|
-
import {
|
|
80
|
-
installFiles,
|
|
81
|
-
megabytes
|
|
82
|
-
} from "./chunk-HA35XN2Z.js";
|
|
61
|
+
} from "./chunk-TZVL4U7U.js";
|
|
83
62
|
import {
|
|
84
63
|
AGENDA_COLUMNS,
|
|
85
64
|
CHAT_COLUMNS,
|
|
@@ -90,6 +69,7 @@ import {
|
|
|
90
69
|
COUNTER_FIELDS,
|
|
91
70
|
FIELD_VERSION,
|
|
92
71
|
INTERNAL_NOTES,
|
|
72
|
+
MAIL_AGENDA_COLUMNS,
|
|
93
73
|
MAX_FILE_BYTES,
|
|
94
74
|
MAX_TEXT_CHARS,
|
|
95
75
|
MENTION_QUERY,
|
|
@@ -118,6 +98,7 @@ import {
|
|
|
118
98
|
counterFreshness,
|
|
119
99
|
counterObservationTime,
|
|
120
100
|
cutChunks,
|
|
101
|
+
delayStats,
|
|
121
102
|
dueDayOf,
|
|
122
103
|
entriesOfList,
|
|
123
104
|
exhausted,
|
|
@@ -153,12 +134,14 @@ import {
|
|
|
153
134
|
queryFilter,
|
|
154
135
|
rankingContextRange,
|
|
155
136
|
rankingOptions,
|
|
137
|
+
rankingQuestion,
|
|
156
138
|
searchError,
|
|
157
139
|
sourceOf,
|
|
158
140
|
threadConversation,
|
|
159
141
|
validateAst,
|
|
160
|
-
validateFields
|
|
161
|
-
|
|
142
|
+
validateFields,
|
|
143
|
+
withoutField
|
|
144
|
+
} from "./chunk-LSKGCJWD.js";
|
|
162
145
|
import {
|
|
163
146
|
EVENT_QUERY,
|
|
164
147
|
MEETING_PROJECT_EVIDENCE_QUERY,
|
|
@@ -192,7 +175,6 @@ import {
|
|
|
192
175
|
normalizeTag,
|
|
193
176
|
parseLucene,
|
|
194
177
|
parseMeetingReference,
|
|
195
|
-
paymentTitle,
|
|
196
178
|
pull,
|
|
197
179
|
queryError,
|
|
198
180
|
queryFieldsOf,
|
|
@@ -204,35 +186,52 @@ import {
|
|
|
204
186
|
validateQuery,
|
|
205
187
|
walkQuery,
|
|
206
188
|
zonedMoment
|
|
207
|
-
} from "./chunk-
|
|
189
|
+
} from "./chunk-QGL2UGML.js";
|
|
208
190
|
import {
|
|
209
191
|
DEFAULT_STEMMERS,
|
|
210
192
|
createStemmer,
|
|
211
193
|
fold,
|
|
212
194
|
normalize
|
|
213
|
-
} from "./chunk-
|
|
195
|
+
} from "./chunk-IR4S7POE.js";
|
|
214
196
|
import {
|
|
215
197
|
DEFAULT_TASK_CATEGORIES,
|
|
216
198
|
FALLBACK_CATEGORY
|
|
217
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-VQPLHOVQ.js";
|
|
200
|
+
import {
|
|
201
|
+
MAX_MODEL_IMAGE_BYTES
|
|
202
|
+
} from "./chunk-MQ7MCVZV.js";
|
|
203
|
+
import {
|
|
204
|
+
remoteKey
|
|
205
|
+
} from "./chunk-577MFPCP.js";
|
|
206
|
+
import {
|
|
207
|
+
Unzip,
|
|
208
|
+
UnzipInflate,
|
|
209
|
+
defaultThreads,
|
|
210
|
+
installNativeRuntime,
|
|
211
|
+
isTextModelInstalled,
|
|
212
|
+
openEmbedder,
|
|
213
|
+
placedText,
|
|
214
|
+
runEmbedders,
|
|
215
|
+
textModelsDirectory
|
|
216
|
+
} from "./chunk-NL3PAFAE.js";
|
|
217
|
+
import {
|
|
218
|
+
installFiles,
|
|
219
|
+
megabytes
|
|
220
|
+
} from "./chunk-T7CDLV33.js";
|
|
218
221
|
import {
|
|
219
222
|
storePath,
|
|
220
223
|
wirecatDirectory
|
|
221
|
-
} from "./chunk-
|
|
224
|
+
} from "./chunk-RSDIPQXP.js";
|
|
222
225
|
import {
|
|
223
226
|
resolvePaths,
|
|
224
|
-
singleLine,
|
|
225
|
-
visibleControls,
|
|
226
227
|
writeSecurely
|
|
227
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-OX6EWGSG.js";
|
|
228
229
|
import {
|
|
229
|
-
CliError,
|
|
230
230
|
array,
|
|
231
231
|
boolean,
|
|
232
232
|
check,
|
|
233
233
|
getDotPath,
|
|
234
234
|
integer,
|
|
235
|
-
isCliError,
|
|
236
235
|
maxLength,
|
|
237
236
|
minLength,
|
|
238
237
|
minValue,
|
|
@@ -249,11 +248,17 @@ import {
|
|
|
249
248
|
string,
|
|
250
249
|
transform,
|
|
251
250
|
unknown
|
|
252
|
-
} from "./chunk-
|
|
251
|
+
} from "./chunk-76CX2YPT.js";
|
|
253
252
|
import {
|
|
254
253
|
importFrom,
|
|
255
254
|
resolveFrom
|
|
256
255
|
} from "./chunk-Y5E2WNWB.js";
|
|
256
|
+
import {
|
|
257
|
+
CliError,
|
|
258
|
+
isCliError,
|
|
259
|
+
singleLine,
|
|
260
|
+
visibleControls
|
|
261
|
+
} from "./chunk-EB2IULWB.js";
|
|
257
262
|
import {
|
|
258
263
|
__commonJS,
|
|
259
264
|
__name,
|
|
@@ -274,9 +279,9 @@ var require_conventions = __commonJS({
|
|
|
274
279
|
}
|
|
275
280
|
for (var i = 0; i < list3.length; i++) {
|
|
276
281
|
if (hasOwn(list3, i)) {
|
|
277
|
-
var
|
|
278
|
-
if (predicate.call(void 0,
|
|
279
|
-
return
|
|
282
|
+
var item2 = list3[i];
|
|
283
|
+
if (predicate.call(void 0, item2, i, list3)) {
|
|
284
|
+
return item2;
|
|
280
285
|
}
|
|
281
286
|
}
|
|
282
287
|
}
|
|
@@ -1085,8 +1090,8 @@ var require_dom = __commonJS({
|
|
|
1085
1090
|
* The first index of the node in the NodeList; -1 if not found.
|
|
1086
1091
|
* @private
|
|
1087
1092
|
*/
|
|
1088
|
-
indexOf: /* @__PURE__ */ __name(function(
|
|
1089
|
-
return Array.prototype.indexOf.call(this,
|
|
1093
|
+
indexOf: /* @__PURE__ */ __name(function(item2) {
|
|
1094
|
+
return Array.prototype.indexOf.call(this, item2);
|
|
1090
1095
|
}, "indexOf")
|
|
1091
1096
|
};
|
|
1092
1097
|
NodeList.prototype[Symbol.iterator] = function() {
|
|
@@ -16869,7 +16874,7 @@ var require_lib3 = __commonJS({
|
|
|
16869
16874
|
}
|
|
16870
16875
|
});
|
|
16871
16876
|
|
|
16872
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16877
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/conversations/link.js
|
|
16873
16878
|
var RULES_VERSION = 5;
|
|
16874
16879
|
var LOOK_BACK = 50;
|
|
16875
16880
|
var SAME_SENDER_WITHIN = 10;
|
|
@@ -16959,15 +16964,15 @@ var latest = /* @__PURE__ */ __name((window3, matches) => {
|
|
|
16959
16964
|
var sameThread = /* @__PURE__ */ __name((a, b) => a.threadId === b.threadId, "sameThread");
|
|
16960
16965
|
var link = /* @__PURE__ */ __name((message, parentId, source, kind, confidence, method) => ({ messageId: message.id, parentId, source, kind, confidence, method }), "link");
|
|
16961
16966
|
|
|
16962
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16967
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/ports/traits.js
|
|
16963
16968
|
var syncsOneChat = /* @__PURE__ */ __name((messenger) => messenger.history !== "store" || messenger.historyOnDemand === true, "syncsOneChat");
|
|
16964
16969
|
|
|
16965
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16970
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/sends/send-id.js
|
|
16966
16971
|
import { randomBytes } from "node:crypto";
|
|
16967
16972
|
var newSendId = /* @__PURE__ */ __name(() => randomBytes(8).readBigInt64BE().toString(), "newSendId");
|
|
16968
16973
|
var newOperationId = newSendId;
|
|
16969
16974
|
|
|
16970
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16975
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/sends/upload.js
|
|
16971
16976
|
import { openAsBlob, realpathSync } from "node:fs";
|
|
16972
16977
|
import { open, stat } from "node:fs/promises";
|
|
16973
16978
|
import { basename, dirname, extname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
@@ -17188,7 +17193,7 @@ var readStickerFile = /* @__PURE__ */ __name(async (path, maxBytes, read) => {
|
|
|
17188
17193
|
return { name, source };
|
|
17189
17194
|
}, "readStickerFile");
|
|
17190
17195
|
|
|
17191
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17196
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/cli/messenger/lacks.js
|
|
17192
17197
|
var COMMAND_NEEDS = {
|
|
17193
17198
|
"account update": ["updateProfile", "change the profile"],
|
|
17194
17199
|
"account sessions list": ["sessions", "list the account's sessions"],
|
|
@@ -17238,7 +17243,7 @@ var hideNever = /* @__PURE__ */ __name((messenger, group) => {
|
|
|
17238
17243
|
return group;
|
|
17239
17244
|
}, "hideNever");
|
|
17240
17245
|
|
|
17241
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17246
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/members-audit.js
|
|
17242
17247
|
var AUDIT_PAGE = 200;
|
|
17243
17248
|
var AUDIT_BUDGET = 10;
|
|
17244
17249
|
var AUDIT_PAUSE_MS = 1e3;
|
|
@@ -17318,7 +17323,7 @@ var burstJoins = /* @__PURE__ */ __name((members) => {
|
|
|
17318
17323
|
return found;
|
|
17319
17324
|
}, "burstJoins");
|
|
17320
17325
|
|
|
17321
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17326
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/meetings/cli/query-options.js
|
|
17322
17327
|
var queryWordsAfterOptions = /* @__PURE__ */ __name((command) => {
|
|
17323
17328
|
command.allowUnknownOption();
|
|
17324
17329
|
const parse = command.parseOptions.bind(command);
|
|
@@ -17338,7 +17343,7 @@ var queryWordsAfterOptions = /* @__PURE__ */ __name((command) => {
|
|
|
17338
17343
|
return command;
|
|
17339
17344
|
}, "queryWordsAfterOptions");
|
|
17340
17345
|
|
|
17341
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17346
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/meetings/cli/passage.js
|
|
17342
17347
|
var count = /* @__PURE__ */ __name((value) => {
|
|
17343
17348
|
if (!/^(0|[1-9]\d*)$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
17344
17349
|
throw new CliError("validation_error", "expected a nonnegative safe integer");
|
|
@@ -17380,7 +17385,7 @@ var addMeetingPassageCommandDefinition = /* @__PURE__ */ __name((program, deps)
|
|
|
17380
17385
|
var createMeetingPassageCommand = sharedCommand(createMeetingPassageCommandDefinition);
|
|
17381
17386
|
var addMeetingPassageCommand = sharedCommand(addMeetingPassageCommandDefinition);
|
|
17382
17387
|
|
|
17383
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17388
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/meetings/cli/project-evidence.js
|
|
17384
17389
|
var integer2 = /* @__PURE__ */ __name((value) => {
|
|
17385
17390
|
if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
17386
17391
|
throw new CliError("validation_error", "expected a positive safe integer");
|
|
@@ -17403,7 +17408,7 @@ ${fieldsHelp(MEETING_PROJECT_EVIDENCE_QUERY)}`).option("--limit <n>", "hits in o
|
|
|
17403
17408
|
}, "addMeetingProjectEvidenceCommandDefinition");
|
|
17404
17409
|
var addMeetingProjectEvidenceCommand = sharedCommand(addMeetingProjectEvidenceCommandDefinition);
|
|
17405
17410
|
|
|
17406
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17411
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/meetings/cli/search.js
|
|
17407
17412
|
var ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/i;
|
|
17408
17413
|
var moment = /* @__PURE__ */ __name((flag, end, readIn) => (value) => {
|
|
17409
17414
|
const zone = timezoneOf();
|
|
@@ -17489,7 +17494,7 @@ var addMeetingSearchCommandDefinition = /* @__PURE__ */ __name((program, deps) =
|
|
|
17489
17494
|
var createMeetingSearchCommand = sharedCommand(createMeetingSearchCommandDefinition);
|
|
17490
17495
|
var addMeetingSearchCommand = sharedCommand(addMeetingSearchCommandDefinition);
|
|
17491
17496
|
|
|
17492
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17497
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/meetings/cli/index.js
|
|
17493
17498
|
var integer4 = /* @__PURE__ */ __name((text2) => {
|
|
17494
17499
|
if (!/^[1-9]\d*$/.test(text2) || !Number.isSafeInteger(Number(text2)))
|
|
17495
17500
|
throw new InvalidArgumentError("expected a positive integer");
|
|
@@ -17621,7 +17626,7 @@ ${fieldsHelp(EVENT_QUERY, MEETING_QUERY_GUIDE)}`);
|
|
|
17621
17626
|
}, "addMeetingCommandsDefinition");
|
|
17622
17627
|
var addMeetingCommands = sharedCommand(addMeetingCommandsDefinition);
|
|
17623
17628
|
|
|
17624
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17629
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/cli/list-query.js
|
|
17625
17630
|
var LIST_QUERY_GUIDE = "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md";
|
|
17626
17631
|
var QUERY_ARGUMENT = "field:value terms that narrow the list \u2014 the fields are below";
|
|
17627
17632
|
var withQuery = /* @__PURE__ */ __name((command, registry) => {
|
|
@@ -17754,7 +17759,7 @@ var termField = /* @__PURE__ */ __name((name, type, example, more = {}) => nativ
|
|
|
17754
17759
|
var queryHelp = /* @__PURE__ */ __name((registry) => `
|
|
17755
17760
|
${fieldsHelp(registry, LIST_QUERY_GUIDE)}`, "queryHelp");
|
|
17756
17761
|
|
|
17757
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17762
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/cli/paging.js
|
|
17758
17763
|
var positiveCount = /* @__PURE__ */ __name((flag) => (value) => {
|
|
17759
17764
|
if (!/^\d+$/.test(value.trim()) || Number(value) < 1)
|
|
17760
17765
|
throw new CliError("validation_error", `${flag} takes a whole number from 1 upwards, not "${value}"`);
|
|
@@ -17763,7 +17768,7 @@ var positiveCount = /* @__PURE__ */ __name((flag) => (value) => {
|
|
|
17763
17768
|
var withPaging = /* @__PURE__ */ __name((command) => command.option("--limit <n>", "how many to show", positiveCount("--limit")).option("--page <n>", "which page, starting at 1", positiveCount("--page")).option("--all", "every row, no paging"), "withPaging");
|
|
17764
17769
|
var window = /* @__PURE__ */ __name(({ limit, page, all }) => all ? { offset: 0 } : { limit, offset: (page - 1) * limit }, "window");
|
|
17765
17770
|
|
|
17766
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17771
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/cli/messenger/chat-answers.js
|
|
17767
17772
|
var defined = /* @__PURE__ */ __name((record2) => Object.fromEntries(Object.entries(record2).filter(([, value]) => value !== void 0)), "defined");
|
|
17768
17773
|
var chatRef = /* @__PURE__ */ __name((account, chat) => formatReference({ type: "chat", provider: account.provider, account: account.account, chat }), "chatRef");
|
|
17769
17774
|
var settingsOf = /* @__PURE__ */ __name((settings) => defined({
|
|
@@ -17954,7 +17959,7 @@ var folderAnswer = /* @__PURE__ */ __name((folder) => {
|
|
|
17954
17959
|
excluded_chats: shown?.excluded
|
|
17955
17960
|
});
|
|
17956
17961
|
}, "folderAnswer");
|
|
17957
|
-
var lines = /* @__PURE__ */ __name((line2) => (body) => (body.items ?? (body.item === void 0 ? [] : [body.item])).map((
|
|
17962
|
+
var lines = /* @__PURE__ */ __name((line2) => (body) => (body.items ?? (body.item === void 0 ? [] : [body.item])).map((item2) => `${line2(item2).trimEnd()}
|
|
17958
17963
|
`).join(""), "lines");
|
|
17959
17964
|
var pageOf2 = /* @__PURE__ */ __name(({ limit, page, all }, { items, hasMore }) => all ? { limit: Math.max(1, items.length), has_more: false, page: 1 } : { limit, has_more: hasMore, page }, "pageOf");
|
|
17960
17965
|
var wholeList = /* @__PURE__ */ __name((command, items, extra = {}) => listOf(command, { items, limit: Math.max(1, items.length), has_more: false, ...extra }), "wholeList");
|
|
@@ -18025,7 +18030,7 @@ var sessionAnswer = /* @__PURE__ */ __name(({ current, client, device, location,
|
|
|
18025
18030
|
...createdAt === void 0 ? {} : { created_at: createdAt }
|
|
18026
18031
|
}), "sessionAnswer");
|
|
18027
18032
|
|
|
18028
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18033
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/ports/messenger.js
|
|
18029
18034
|
var throughWrapper = /* @__PURE__ */ __name((inner, handled, wrap = (_, call) => call) => new Proxy(handled, {
|
|
18030
18035
|
get: /* @__PURE__ */ __name((own, key) => {
|
|
18031
18036
|
if (key in own)
|
|
@@ -18042,7 +18047,7 @@ var capability = /* @__PURE__ */ __name((adapter, method, what) => {
|
|
|
18042
18047
|
return found.bind(adapter);
|
|
18043
18048
|
}, "capability");
|
|
18044
18049
|
|
|
18045
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18050
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/domain/ref-arguments.js
|
|
18046
18051
|
var TAKES = {
|
|
18047
18052
|
chat: "a chat: chat:<provider>/<account>/<chat>, its id or its title",
|
|
18048
18053
|
message: "a message: msg:<provider>/<account>/<chat>/<message>, or a chat and the message's id"
|
|
@@ -18102,7 +18107,7 @@ var ensureAccount = /* @__PURE__ */ __name(async (reference, scope, profilesOn)
|
|
|
18102
18107
|
throw wrongAccount(reference, scope, profiles);
|
|
18103
18108
|
}, "ensureAccount");
|
|
18104
18109
|
|
|
18105
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18110
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/resolve.js
|
|
18106
18111
|
var isId = /* @__PURE__ */ __name((reference) => /^-?\d+$/.test(reference.trim()), "isId");
|
|
18107
18112
|
var foldName = /* @__PURE__ */ __name((name) => name.normalize("NFC").replace(/[\uFE0E\uFE0F\u200D]/g, "").toLowerCase(), "foldName");
|
|
18108
18113
|
var pickChat = /* @__PURE__ */ __name((reference, chats) => {
|
|
@@ -18147,7 +18152,7 @@ ${lines3}`, { candidates });
|
|
|
18147
18152
|
}, "ambiguous");
|
|
18148
18153
|
var isPresent = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isPresent");
|
|
18149
18154
|
|
|
18150
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18155
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/deps.js
|
|
18151
18156
|
var accountStore = /* @__PURE__ */ __name(async (deps) => (await deps.store()).forAccount(await deps.account()), "accountStore");
|
|
18152
18157
|
var crossAccount = /* @__PURE__ */ __name((deps, _reason) => deps.store(), "crossAccount");
|
|
18153
18158
|
var NO_LOCAL_STORE = "this answer comes from the messenger, not from the local store";
|
|
@@ -18160,11 +18165,11 @@ var storeAbsent = /* @__PURE__ */ __name((error) => {
|
|
|
18160
18165
|
return error instanceof Error && typeof code === "number" && (code & 255) === SQLITE_BUSY;
|
|
18161
18166
|
}, "storeAbsent");
|
|
18162
18167
|
var accountUnknown = /* @__PURE__ */ __name((error) => isCliFailure(error) && (error.code === "not_found" || error.code === "authentication_error"), "accountUnknown");
|
|
18163
|
-
var unless = /* @__PURE__ */ __name(async (work,
|
|
18168
|
+
var unless = /* @__PURE__ */ __name(async (work, expected2) => {
|
|
18164
18169
|
try {
|
|
18165
18170
|
return await work();
|
|
18166
18171
|
} catch (error) {
|
|
18167
|
-
if (
|
|
18172
|
+
if (expected2(error))
|
|
18168
18173
|
return void 0;
|
|
18169
18174
|
throw error;
|
|
18170
18175
|
}
|
|
@@ -18211,7 +18216,7 @@ var storedDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({
|
|
|
18211
18216
|
}), "storedDeps");
|
|
18212
18217
|
var storeModeDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({ ...storedDeps(messenger, store, account, guard), offline: false, reads: "store" }), "storeModeDeps");
|
|
18213
18218
|
|
|
18214
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18219
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/patience.js
|
|
18215
18220
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
18216
18221
|
var LONGEST_WAIT_MS = 5 * 60 * 1e3;
|
|
18217
18222
|
var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
|
|
@@ -18234,10 +18239,10 @@ var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
|
|
|
18234
18239
|
}
|
|
18235
18240
|
}, "patiently");
|
|
18236
18241
|
|
|
18237
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18242
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/archive.js
|
|
18238
18243
|
import { setTimeout as sleep2 } from "node:timers/promises";
|
|
18239
18244
|
|
|
18240
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18245
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
|
|
18241
18246
|
var REQUEST_MS = 400;
|
|
18242
18247
|
var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, maxPages, pauseMs }) => {
|
|
18243
18248
|
const lowest = ranges[0];
|
|
@@ -18260,13 +18265,13 @@ var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, max
|
|
|
18260
18265
|
};
|
|
18261
18266
|
}, "estimateBackfill");
|
|
18262
18267
|
|
|
18263
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18268
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/domain/recovery.js
|
|
18264
18269
|
var withRecovery = /* @__PURE__ */ __name((error) => ({
|
|
18265
18270
|
...error,
|
|
18266
18271
|
retryable: typeof error.retryable === "boolean" ? error.retryable : error.code === "rate_limited" || error.status === 429
|
|
18267
18272
|
}), "withRecovery");
|
|
18268
18273
|
|
|
18269
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18274
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/batch.js
|
|
18270
18275
|
var actionable = /* @__PURE__ */ __name((error) => {
|
|
18271
18276
|
if (isCliFailure(error))
|
|
18272
18277
|
return withRecovery({ code: error.code, message: error.message, ...error.details });
|
|
@@ -18349,7 +18354,7 @@ var mergeBatches = /* @__PURE__ */ __name((a, b) => {
|
|
|
18349
18354
|
};
|
|
18350
18355
|
}, "mergeBatches");
|
|
18351
18356
|
|
|
18352
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18357
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
|
|
18353
18358
|
var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account) => {
|
|
18354
18359
|
if (deps.reads !== "store")
|
|
18355
18360
|
return keptChatId(deps.messenger, reference, store, account);
|
|
@@ -18367,11 +18372,11 @@ var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account)
|
|
|
18367
18372
|
}, "readChatId");
|
|
18368
18373
|
var LEFT_EMPTY = "you left this chat, and the store holds none of its messages";
|
|
18369
18374
|
var storedChatId = /* @__PURE__ */ __name((messenger, reference, store, account, { includeLeft = false } = {}) => {
|
|
18370
|
-
const
|
|
18375
|
+
const renamed2 = /* @__PURE__ */ __name((id2) => store.chats.renamedChatId(account, id2), "renamed");
|
|
18371
18376
|
const profilesOn = profilesOnAccount(store, messenger.app?.command, account.provider);
|
|
18372
18377
|
const among = chatIdAmong(messenger, reference, account, {
|
|
18373
18378
|
held: /* @__PURE__ */ __name(() => store.chats.chats(account, {}), "held"),
|
|
18374
|
-
renamed,
|
|
18379
|
+
renamed: renamed2,
|
|
18375
18380
|
left: /* @__PURE__ */ __name(async (id2) => leftIn(await store.chats.chats(account, byId(id2))), "left"),
|
|
18376
18381
|
profilesOn
|
|
18377
18382
|
});
|
|
@@ -18382,17 +18387,17 @@ var storedChatId = /* @__PURE__ */ __name((messenger, reference, store, account,
|
|
|
18382
18387
|
throw error;
|
|
18383
18388
|
return chatIdAmong(messenger, reference, account, {
|
|
18384
18389
|
held: /* @__PURE__ */ __name(() => store.chats.chats(account, { includeLeft: true }), "held"),
|
|
18385
|
-
renamed,
|
|
18390
|
+
renamed: renamed2,
|
|
18386
18391
|
profilesOn
|
|
18387
18392
|
});
|
|
18388
18393
|
});
|
|
18389
18394
|
}, "storedChatId");
|
|
18390
18395
|
var keptChatId = /* @__PURE__ */ __name((messenger, reference, store, account) => storedChatId(messenger, reference, store, account, { includeLeft: true }), "keptChatId");
|
|
18391
18396
|
var chatIdIn = /* @__PURE__ */ __name((messenger, reference, store, { includeLeft = false } = {}) => {
|
|
18392
|
-
const
|
|
18397
|
+
const renamed2 = /* @__PURE__ */ __name((id2) => store.chats.renamedChatId(id2), "renamed");
|
|
18393
18398
|
const among = chatIdAmong(messenger, reference, store.account, {
|
|
18394
18399
|
held: /* @__PURE__ */ __name(() => store.chats.chats({}), "held"),
|
|
18395
|
-
renamed,
|
|
18400
|
+
renamed: renamed2,
|
|
18396
18401
|
left: /* @__PURE__ */ __name(async (id2) => leftIn(await store.chats.chats(byId(id2))), "left")
|
|
18397
18402
|
});
|
|
18398
18403
|
if (!includeLeft)
|
|
@@ -18402,7 +18407,7 @@ var chatIdIn = /* @__PURE__ */ __name((messenger, reference, store, { includeLef
|
|
|
18402
18407
|
throw error;
|
|
18403
18408
|
return chatIdAmong(messenger, reference, store.account, {
|
|
18404
18409
|
held: /* @__PURE__ */ __name(() => store.chats.chats({ includeLeft: true }), "held"),
|
|
18405
|
-
renamed
|
|
18410
|
+
renamed: renamed2
|
|
18406
18411
|
});
|
|
18407
18412
|
});
|
|
18408
18413
|
}, "chatIdIn");
|
|
@@ -18417,7 +18422,7 @@ var profilesOnAccount = /* @__PURE__ */ __name((store, app, provider) => async (
|
|
|
18417
18422
|
return void 0;
|
|
18418
18423
|
return Object.entries((await store.accounts.profiles())[app] ?? {}).filter(([, key]) => key.provider === provider && key.account === account).map(([name]) => name);
|
|
18419
18424
|
}, "profilesOnAccount");
|
|
18420
|
-
var chatIdAmong = /* @__PURE__ */ __name(async (messenger, reference, account, { held, renamed, left, profilesOn }) => {
|
|
18425
|
+
var chatIdAmong = /* @__PURE__ */ __name(async (messenger, reference, account, { held, renamed: renamed2, left, profilesOn }) => {
|
|
18421
18426
|
const trimmed = reference.trim();
|
|
18422
18427
|
if (messenger.savedChatId && ["me", "self", "saved"].includes(trimmed.toLowerCase())) {
|
|
18423
18428
|
return messenger.savedChatId(account);
|
|
@@ -18427,7 +18432,7 @@ var chatIdAmong = /* @__PURE__ */ __name(async (messenger, reference, account, {
|
|
|
18427
18432
|
await ensureAccount(named2, { account: account.account }, profilesOn);
|
|
18428
18433
|
if (named2 || /^-?\d+$/.test(trimmed)) {
|
|
18429
18434
|
const typed = named2?.chat ?? trimmed;
|
|
18430
|
-
const id2 = await
|
|
18435
|
+
const id2 = await renamed2(typed) ?? typed;
|
|
18431
18436
|
if (await left?.(id2))
|
|
18432
18437
|
throw new CliError("not_found", `you left chat ${id2}`);
|
|
18433
18438
|
return id2;
|
|
@@ -18436,7 +18441,7 @@ var chatIdAmong = /* @__PURE__ */ __name(async (messenger, reference, account, {
|
|
|
18436
18441
|
const exact = chats.find((one) => one.id === trimmed);
|
|
18437
18442
|
if (exact)
|
|
18438
18443
|
return exact.id;
|
|
18439
|
-
const moved = await
|
|
18444
|
+
const moved = await renamed2(trimmed);
|
|
18440
18445
|
if (moved !== void 0 && chats.some((one) => one.id === moved))
|
|
18441
18446
|
return moved;
|
|
18442
18447
|
if (trimmed.startsWith("@")) {
|
|
@@ -18508,7 +18513,7 @@ var senderAmong = /* @__PURE__ */ __name(async (store, accounts, reference) => {
|
|
|
18508
18513
|
}
|
|
18509
18514
|
}, "senderAmong");
|
|
18510
18515
|
|
|
18511
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18516
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/images/context/index.js
|
|
18512
18517
|
var CONTEXT_MESSAGES = 3;
|
|
18513
18518
|
var CONTEXT_MINUTES = 10;
|
|
18514
18519
|
var MAX_CHARS = 1200;
|
|
@@ -18532,12 +18537,12 @@ var context = {
|
|
|
18532
18537
|
}, "describe")
|
|
18533
18538
|
};
|
|
18534
18539
|
|
|
18535
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18540
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/images/registry.js
|
|
18536
18541
|
var BUILT_INS = [context];
|
|
18537
18542
|
var providers = [...BUILT_INS];
|
|
18538
18543
|
var registeredImageProviders = /* @__PURE__ */ __name(() => providers, "registeredImageProviders");
|
|
18539
18544
|
|
|
18540
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18545
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/conversations.js
|
|
18541
18546
|
var READ_PAGE = 5e3;
|
|
18542
18547
|
var CHAIN = 50;
|
|
18543
18548
|
var CONVERSATION_QUERY = {
|
|
@@ -18689,7 +18694,7 @@ var sized = /* @__PURE__ */ __name((size2) => {
|
|
|
18689
18694
|
return size2;
|
|
18690
18695
|
}, "sized");
|
|
18691
18696
|
|
|
18692
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18697
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
|
|
18693
18698
|
var REFRESH_BOUNDS = { maxChats: 20, maxChunks: 2e3 };
|
|
18694
18699
|
var MESSAGE_PAGE = 5e3;
|
|
18695
18700
|
var PER_SESSION = 8;
|
|
@@ -18708,7 +18713,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
|
|
|
18708
18713
|
price: remote.price,
|
|
18709
18714
|
installed: true,
|
|
18710
18715
|
perBatch: PER_REQUEST * concurrency,
|
|
18711
|
-
open: /* @__PURE__ */ __name(async () => (await import("./remote-
|
|
18716
|
+
open: /* @__PURE__ */ __name(async () => (await import("./remote-HUAKXJCS.js")).openRemote(remote, apiKey, { concurrency }), "open")
|
|
18712
18717
|
};
|
|
18713
18718
|
}
|
|
18714
18719
|
const model = textModel(choice);
|
|
@@ -18725,7 +18730,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
|
|
|
18725
18730
|
if (!isTextModelInstalled(model, directory2))
|
|
18726
18731
|
throw notDownloaded(model.id);
|
|
18727
18732
|
if (apart) {
|
|
18728
|
-
const { openProcess } = await import("./process-
|
|
18733
|
+
const { openProcess } = await import("./process-K2FICLWY.js");
|
|
18729
18734
|
return openProcess(model, directory2, { threads: threads ?? defaultThreads() });
|
|
18730
18735
|
}
|
|
18731
18736
|
return openEmbedder(model, directory2, { threads: threads ?? defaultThreads() });
|
|
@@ -19014,7 +19019,7 @@ var shaped = /* @__PURE__ */ __name(({ chatId, builtAt, algorithmVersion, pendin
|
|
|
19014
19019
|
return { ...one, state };
|
|
19015
19020
|
}, "shaped");
|
|
19016
19021
|
|
|
19017
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19022
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
|
|
19018
19023
|
var CATCH_UP_BOUNDS = { maxChunks: 500, maxMessages: 1e4, timeMs: 3e4 };
|
|
19019
19024
|
var validateCatchUpBounds = /* @__PURE__ */ __name((options) => {
|
|
19020
19025
|
for (const [key, value, maximum] of [
|
|
@@ -19067,7 +19072,7 @@ var catchUpSearch = /* @__PURE__ */ __name(async (deps, chat, options, signal, c
|
|
|
19067
19072
|
}
|
|
19068
19073
|
}, "catchUpSearch");
|
|
19069
19074
|
|
|
19070
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19075
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/archive.js
|
|
19071
19076
|
var pushed = /* @__PURE__ */ __name((deps, what) => {
|
|
19072
19077
|
if (deps.reads === "store") {
|
|
19073
19078
|
throw new CliError("validation_error", `${what} asks for older history, and this messenger pushes its history instead \u2014 keep \`${typedCommand(deps.messenger.app.command, "serve")}\` running`);
|
|
@@ -19433,7 +19438,7 @@ var timeOfKey = /* @__PURE__ */ __name(async (store, account, chatId, key, byTim
|
|
|
19433
19438
|
return message?.timestamp ?? fallback;
|
|
19434
19439
|
}, "timeOfKey");
|
|
19435
19440
|
|
|
19436
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19441
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/questions.js
|
|
19437
19442
|
var LINKS = /https?:\/\/\S+/g;
|
|
19438
19443
|
var unanswered = /* @__PURE__ */ __name((messages, { answerers: answerers2, before: before2 }) => questions(messages, { answerers: answerers2 }).filter(({ question, answer }) => answer === void 0 && Date.parse(question.timestamp) < before2).map(({ question }) => question), "unanswered");
|
|
19439
19444
|
var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker = "others" }) => {
|
|
@@ -19463,7 +19468,7 @@ var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker
|
|
|
19463
19468
|
});
|
|
19464
19469
|
}, "questions");
|
|
19465
19470
|
|
|
19466
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19471
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/task-categories.js
|
|
19467
19472
|
var names = /* @__PURE__ */ __name((categories) => categories.map(({ name }) => name).join(", "), "names");
|
|
19468
19473
|
var taskCategoryOf = /* @__PURE__ */ __name((categories = DEFAULT_TASK_CATEGORIES, flag = "--category") => (typed) => {
|
|
19469
19474
|
const name = typed.trim().toLowerCase();
|
|
@@ -19520,7 +19525,7 @@ var categorize = /* @__PURE__ */ __name((text2, categories = DEFAULT_TASK_CATEGO
|
|
|
19520
19525
|
return best.name;
|
|
19521
19526
|
}, "categorize");
|
|
19522
19527
|
|
|
19523
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19528
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/task-rules.js
|
|
19524
19529
|
var taskAccount = /* @__PURE__ */ __name(({ provider, account }) => `${provider}:${account}`, "taskAccount");
|
|
19525
19530
|
var RULES_IN = {
|
|
19526
19531
|
dialog: "all",
|
|
@@ -19726,7 +19731,7 @@ var applyTaskRulesToChats = /* @__PURE__ */ __name(async (store, account, chatId
|
|
|
19726
19731
|
return passes;
|
|
19727
19732
|
}, "applyTaskRulesToChats");
|
|
19728
19733
|
|
|
19729
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19734
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/moment.js
|
|
19730
19735
|
var AGO = /^(\d+)(m|h|d)$/;
|
|
19731
19736
|
var AGO_MS = { m: 6e4, h: 36e5, d: 864e5 };
|
|
19732
19737
|
var DATE = /^\d{4}-\d{2}-\d{2}/;
|
|
@@ -19766,7 +19771,7 @@ var dateWindow = /* @__PURE__ */ __name(({ sinceTime, untilTime, zone, now = Dat
|
|
|
19766
19771
|
};
|
|
19767
19772
|
}, "dateWindow");
|
|
19768
19773
|
|
|
19769
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19774
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/botcheck/check.js
|
|
19770
19775
|
var DAY_MS = 864e5;
|
|
19771
19776
|
var NEW_DAYS = 30;
|
|
19772
19777
|
var SAME_TEXT_MIN = 20;
|
|
@@ -19843,7 +19848,7 @@ var scorePerson = /* @__PURE__ */ __name(({ subject, provider, activity, photos,
|
|
|
19843
19848
|
};
|
|
19844
19849
|
}, "scorePerson");
|
|
19845
19850
|
|
|
19846
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19851
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/botcheck/registries.js
|
|
19847
19852
|
var REGISTRIES = {
|
|
19848
19853
|
cas: { title: "Combot Anti-Spam (CAS)", docs: "https://cas.chat/api" },
|
|
19849
19854
|
lols: { title: "lols.bot", docs: "https://api.lols.bot/lols-bot.json" }
|
|
@@ -19928,7 +19933,7 @@ var notCovered = /* @__PURE__ */ __name((messenger, now = /* @__PURE__ */ new Da
|
|
|
19928
19933
|
detail: `lists Telegram accounts only, not ${messenger} ones`
|
|
19929
19934
|
})), "notCovered");
|
|
19930
19935
|
|
|
19931
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19936
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/botcheck/service.js
|
|
19932
19937
|
var ACTIVITY_MESSAGES = 1e3;
|
|
19933
19938
|
var botCheckService = /* @__PURE__ */ __name((deps) => {
|
|
19934
19939
|
const subjectOf = /* @__PURE__ */ __name(async (reference) => {
|
|
@@ -20016,7 +20021,7 @@ var botCheckService = /* @__PURE__ */ __name((deps) => {
|
|
|
20016
20021
|
};
|
|
20017
20022
|
}, "botCheckService");
|
|
20018
20023
|
|
|
20019
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20024
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/domain/thread.js
|
|
20020
20025
|
var threadIdOf = /* @__PURE__ */ __name((value) => {
|
|
20021
20026
|
if (value === void 0)
|
|
20022
20027
|
return void 0;
|
|
@@ -20026,7 +20031,7 @@ var threadIdOf = /* @__PURE__ */ __name((value) => {
|
|
|
20026
20031
|
return id2;
|
|
20027
20032
|
}, "threadIdOf");
|
|
20028
20033
|
|
|
20029
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20034
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
|
|
20030
20035
|
var TOP_POSTS = 5;
|
|
20031
20036
|
var JOINS = /* @__PURE__ */ new Set(["join", "add"]);
|
|
20032
20037
|
var LEAVES = /* @__PURE__ */ new Set(["leave", "remove"]);
|
|
@@ -20143,7 +20148,7 @@ var median = /* @__PURE__ */ __name((values) => {
|
|
|
20143
20148
|
return Math.round(sorted.length % 2 === 0 ? ((sorted[middle - 1] ?? upper) + upper) / 2 : upper);
|
|
20144
20149
|
}, "median");
|
|
20145
20150
|
|
|
20146
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20151
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/member-history.js
|
|
20147
20152
|
var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
|
|
20148
20153
|
const events = [];
|
|
20149
20154
|
for (const stay of stays) {
|
|
@@ -20175,7 +20180,7 @@ var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
|
|
|
20175
20180
|
return events.filter(({ at }) => Date.parse(at) >= since).sort((a, b) => Date.parse(a.at) - Date.parse(b.at) || a.id.localeCompare(b.id));
|
|
20176
20181
|
}, "memberEvents");
|
|
20177
20182
|
|
|
20178
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20183
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/chats.js
|
|
20179
20184
|
var EVENTS_DAYS = 7;
|
|
20180
20185
|
var TRACKED_DAYS = 30;
|
|
20181
20186
|
var STATS_PAGE = 1e3;
|
|
@@ -20193,18 +20198,18 @@ var storedEvents = /* @__PURE__ */ __name(async (store, deps, chat, since) => {
|
|
|
20193
20198
|
var deepChecks = /* @__PURE__ */ __name(async (deps, items, deep, pauseMs, registry) => {
|
|
20194
20199
|
const checks = botCheckService(deps);
|
|
20195
20200
|
const checked2 = [];
|
|
20196
|
-
for (const [index,
|
|
20201
|
+
for (const [index, item2] of items.entries()) {
|
|
20197
20202
|
if (index >= deep) {
|
|
20198
|
-
checked2.push(
|
|
20203
|
+
checked2.push(item2);
|
|
20199
20204
|
continue;
|
|
20200
20205
|
}
|
|
20201
20206
|
if (index > 0)
|
|
20202
20207
|
await new Promise((resolve7) => setTimeout(resolve7, pauseMs));
|
|
20203
|
-
const { score, reasons, registries, unknown: unknown3 } = await checks.person(
|
|
20208
|
+
const { score, reasons, registries, unknown: unknown3 } = await checks.person(item2.id, {
|
|
20204
20209
|
registries: true,
|
|
20205
20210
|
...registry ? { registry } : {}
|
|
20206
20211
|
});
|
|
20207
|
-
checked2.push({ ...
|
|
20212
|
+
checked2.push({ ...item2, check: { score, reasons, registries, unknown: unknown3 } });
|
|
20208
20213
|
}
|
|
20209
20214
|
return checked2;
|
|
20210
20215
|
}, "deepChecks");
|
|
@@ -20470,7 +20475,7 @@ var storedMembers = /* @__PURE__ */ __name(async (store, chatId) => {
|
|
|
20470
20475
|
return members.length === 0 ? null : members;
|
|
20471
20476
|
}, "storedMembers");
|
|
20472
20477
|
|
|
20473
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20478
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/inbox.js
|
|
20474
20479
|
var INBOX_CHATS = 20;
|
|
20475
20480
|
var REVIEW_DAYS = 3;
|
|
20476
20481
|
var UNANSWERED_HOURS = 24;
|
|
@@ -20678,7 +20683,7 @@ var inboxService = /* @__PURE__ */ __name((deps) => {
|
|
|
20678
20683
|
};
|
|
20679
20684
|
}, "inboxService");
|
|
20680
20685
|
|
|
20681
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20686
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/domain/formatting.js
|
|
20682
20687
|
var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "the messenger formatter returned invalid text spans"), "invalid");
|
|
20683
20688
|
var validateFormattedText = /* @__PURE__ */ __name((formatted2) => {
|
|
20684
20689
|
const { text: text2, spans } = formatted2;
|
|
@@ -20738,7 +20743,7 @@ var visibleFormattedText = /* @__PURE__ */ __name((formatted2) => {
|
|
|
20738
20743
|
};
|
|
20739
20744
|
}, "visibleFormattedText");
|
|
20740
20745
|
|
|
20741
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20746
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/moderation/check.js
|
|
20742
20747
|
var INVITE = /max\.ru\/join\/|(t|telegram)\.me\/(\+|joinchat\/)|tg:\/\/join/i;
|
|
20743
20748
|
var LINK2 = /https?:\/\/\S+/i;
|
|
20744
20749
|
var STRENGTH = { report: 0, delete: 1, remove: 2 };
|
|
@@ -20926,7 +20931,7 @@ var nextPoint = /* @__PURE__ */ __name((rows, found) => {
|
|
|
20926
20931
|
}, "nextPoint");
|
|
20927
20932
|
var someUndone = /* @__PURE__ */ __name((rows) => rows.some(undone), "someUndone");
|
|
20928
20933
|
|
|
20929
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20934
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/moderation/rules.js
|
|
20930
20935
|
import { existsSync, readFileSync } from "node:fs";
|
|
20931
20936
|
import { join } from "node:path";
|
|
20932
20937
|
var RULE_ACTIONS = ["report", "delete", "remove"];
|
|
@@ -20976,7 +20981,7 @@ var defaultRules = /* @__PURE__ */ __name((title) => ({
|
|
|
20976
20981
|
newAccount: { days: 7, action: "report" },
|
|
20977
20982
|
consent: { delete: "ask", remove: "ask" }
|
|
20978
20983
|
}), "defaultRules");
|
|
20979
|
-
var list = /* @__PURE__ */ __name((value) => value.split(",").map((
|
|
20984
|
+
var list = /* @__PURE__ */ __name((value) => value.split(",").map((item2) => item2.trim()).filter(Boolean), "list");
|
|
20980
20985
|
var whole = /* @__PURE__ */ __name((value) => /^\d+$/.test(value.trim()) ? Number(value) : Number.NaN, "whole");
|
|
20981
20986
|
var KEYS = {
|
|
20982
20987
|
trusted: { help: "person ids, comma-separated; never acted on", parse: list },
|
|
@@ -21069,7 +21074,7 @@ var assign = /* @__PURE__ */ __name((rules, key, value) => {
|
|
|
21069
21074
|
return { ...rules, [head]: { ...rules[head], [tail]: value } };
|
|
21070
21075
|
}, "assign");
|
|
21071
21076
|
|
|
21072
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21077
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/person-context.js
|
|
21073
21078
|
var CONTEXT_MESSAGES2 = 10;
|
|
21074
21079
|
var CONTEXT_BYTES = 64 * 1024;
|
|
21075
21080
|
var toContext = /* @__PURE__ */ __name((key, message, chatTitle2) => ({
|
|
@@ -21254,8 +21259,8 @@ var recordContext = /* @__PURE__ */ __name(async (store, record2, reads, { messa
|
|
|
21254
21259
|
var withinBytes = /* @__PURE__ */ __name((lists, bytes2) => {
|
|
21255
21260
|
let used = 0;
|
|
21256
21261
|
let cut = false;
|
|
21257
|
-
const keep2 = /* @__PURE__ */ __name((items) => items.filter((
|
|
21258
|
-
const size2 = Buffer.byteLength(JSON.stringify(
|
|
21262
|
+
const keep2 = /* @__PURE__ */ __name((items) => items.filter((item2) => {
|
|
21263
|
+
const size2 = Buffer.byteLength(JSON.stringify(item2), "utf8");
|
|
21259
21264
|
if (cut || used + size2 > bytes2) {
|
|
21260
21265
|
cut = true;
|
|
21261
21266
|
return false;
|
|
@@ -21330,10 +21335,10 @@ var personMessages = /* @__PURE__ */ __name(async (store, asked, reference, { ch
|
|
|
21330
21335
|
};
|
|
21331
21336
|
}, "personMessages");
|
|
21332
21337
|
|
|
21333
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21338
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
|
|
21334
21339
|
import { createHash } from "node:crypto";
|
|
21335
21340
|
|
|
21336
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21341
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
|
|
21337
21342
|
var missing2 = /* @__PURE__ */ __name(() => new CliError("not_found", "the meeting evidence is unavailable for this account"), "missing");
|
|
21338
21343
|
var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId, reference, options = {}) => {
|
|
21339
21344
|
const parsed = parseMeetingReference(reference);
|
|
@@ -21351,7 +21356,7 @@ var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId,
|
|
|
21351
21356
|
return { parsed, meeting };
|
|
21352
21357
|
}, "authorizedMeetingMetadata");
|
|
21353
21358
|
|
|
21354
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21359
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
|
|
21355
21360
|
var hash = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
|
|
21356
21361
|
var checkMeetingCancelled = /* @__PURE__ */ __name((signal) => {
|
|
21357
21362
|
if (signal?.aborted)
|
|
@@ -21497,16 +21502,16 @@ var readMeetingEvidence = /* @__PURE__ */ __name(async (store, accountId, refere
|
|
|
21497
21502
|
hasMore = true;
|
|
21498
21503
|
break;
|
|
21499
21504
|
}
|
|
21500
|
-
const
|
|
21501
|
-
const bytes2 = Buffer.byteLength(JSON.stringify(
|
|
21505
|
+
const item2 = cueEvidence(accountId, meeting.id, page.transcript, row);
|
|
21506
|
+
const bytes2 = Buffer.byteLength(JSON.stringify(item2), "utf8") + (items.length ? 1 : 0);
|
|
21502
21507
|
if (contentBytes + bytes2 > limits.bytes) {
|
|
21503
21508
|
truncatedBy = "bytes";
|
|
21504
21509
|
hasMore = true;
|
|
21505
21510
|
break;
|
|
21506
21511
|
}
|
|
21507
|
-
items.push(
|
|
21512
|
+
items.push(item2);
|
|
21508
21513
|
contentBytes += bytes2;
|
|
21509
|
-
nextReference =
|
|
21514
|
+
nextReference = item2.reference;
|
|
21510
21515
|
afterPosition = row.position;
|
|
21511
21516
|
}
|
|
21512
21517
|
if (truncatedBy !== null || parsed.cuePosition !== void 0 || !page.hasMore)
|
|
@@ -21550,7 +21555,7 @@ var readMeetingEvidence = /* @__PURE__ */ __name(async (store, accountId, refere
|
|
|
21550
21555
|
return { ...packet, fingerprint: hash(packet) };
|
|
21551
21556
|
}, "readMeetingEvidence");
|
|
21552
21557
|
|
|
21553
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21558
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
|
|
21554
21559
|
var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference, options) => {
|
|
21555
21560
|
const { meetings = 10, cues = 5, bytes: bytes2 = 64 * 1024, scanLimit = 1e3, since, signal } = options;
|
|
21556
21561
|
const requestedAccounts = options.accountIds;
|
|
@@ -21614,7 +21619,7 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
|
|
|
21614
21619
|
}
|
|
21615
21620
|
throw error;
|
|
21616
21621
|
}
|
|
21617
|
-
const
|
|
21622
|
+
const item2 = {
|
|
21618
21623
|
reference,
|
|
21619
21624
|
cues: evidence.items,
|
|
21620
21625
|
cueCoverage: {
|
|
@@ -21623,12 +21628,12 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
|
|
|
21623
21628
|
hasMore: evidence.coverage.hasMore
|
|
21624
21629
|
}
|
|
21625
21630
|
};
|
|
21626
|
-
const itemBytes = Buffer.byteLength(JSON.stringify(
|
|
21631
|
+
const itemBytes = Buffer.byteLength(JSON.stringify(item2), "utf8") + (items.length ? 1 : 0);
|
|
21627
21632
|
if (contentBytes + itemBytes > bytes2) {
|
|
21628
21633
|
truncatedBy = "bytes";
|
|
21629
21634
|
break;
|
|
21630
21635
|
}
|
|
21631
|
-
items.push(
|
|
21636
|
+
items.push(item2);
|
|
21632
21637
|
contentBytes += itemBytes;
|
|
21633
21638
|
}
|
|
21634
21639
|
checkMeetingCancelled(signal);
|
|
@@ -21649,7 +21654,7 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
|
|
|
21649
21654
|
};
|
|
21650
21655
|
}, "personMeetingContext");
|
|
21651
21656
|
|
|
21652
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21657
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
|
|
21653
21658
|
var PREPARE_BYTES = 96 * 1024;
|
|
21654
21659
|
var MEETINGS = 5;
|
|
21655
21660
|
var CUES = 3;
|
|
@@ -21662,14 +21667,14 @@ var personPreparation = /* @__PURE__ */ __name(async (store, asked, reference, o
|
|
|
21662
21667
|
const budgeted = /* @__PURE__ */ __name((page) => {
|
|
21663
21668
|
const items = [];
|
|
21664
21669
|
let cut = false;
|
|
21665
|
-
for (const
|
|
21666
|
-
const bytes2 = size(
|
|
21670
|
+
for (const item2 of page.items.slice(0, limit)) {
|
|
21671
|
+
const bytes2 = size(item2);
|
|
21667
21672
|
if (cut || bytes2 > left) {
|
|
21668
21673
|
cut = true;
|
|
21669
21674
|
continue;
|
|
21670
21675
|
}
|
|
21671
21676
|
left -= bytes2;
|
|
21672
|
-
items.push(
|
|
21677
|
+
items.push(item2);
|
|
21673
21678
|
}
|
|
21674
21679
|
const over = page.hasMore || page.items.length > limit;
|
|
21675
21680
|
return {
|
|
@@ -21752,7 +21757,7 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
|
|
|
21752
21757
|
bytes: Math.min(left(), 4 * 1024 * 1024),
|
|
21753
21758
|
...since === void 0 ? {} : { since }
|
|
21754
21759
|
});
|
|
21755
|
-
const read = new Set(found.items.map((
|
|
21760
|
+
const read = new Set(found.items.map((item2) => parseMeetingReference(item2.reference).accountId));
|
|
21756
21761
|
return {
|
|
21757
21762
|
items: found.items,
|
|
21758
21763
|
hasMore: found.coverage.truncatedBy !== null || found.coverage.scanLimitReached,
|
|
@@ -21766,7 +21771,7 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
|
|
|
21766
21771
|
}
|
|
21767
21772
|
}, "meetingsOf");
|
|
21768
21773
|
|
|
21769
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21774
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/person-profile.js
|
|
21770
21775
|
var personProfile = /* @__PURE__ */ __name(async (deps, person, known2) => {
|
|
21771
21776
|
const online = deps.offline ? void 0 : await deps.connection();
|
|
21772
21777
|
const held = await storeIfOpen(deps);
|
|
@@ -21836,7 +21841,7 @@ var quiet = /* @__PURE__ */ __name((facts) => facts.chats.map(({ id: id2, title,
|
|
|
21836
21841
|
complete: false
|
|
21837
21842
|
})), "quiet");
|
|
21838
21843
|
|
|
21839
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21844
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
|
|
21840
21845
|
var TIMELINE_ITEMS = 50;
|
|
21841
21846
|
var TIMELINE_MAX = 500;
|
|
21842
21847
|
var SCOPES = ["personal", "work"];
|
|
@@ -21891,7 +21896,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
|
|
|
21891
21896
|
};
|
|
21892
21897
|
}, "personTimeline");
|
|
21893
21898
|
|
|
21894
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21899
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/people.js
|
|
21895
21900
|
var peopleService = /* @__PURE__ */ __name((deps) => {
|
|
21896
21901
|
const localCard = /* @__PURE__ */ __name(async (card, includeNotes = false) => {
|
|
21897
21902
|
const held = await storeIfOpen(deps);
|
|
@@ -22118,7 +22123,110 @@ var withoutPhone = /* @__PURE__ */ __name((answer) => {
|
|
|
22118
22123
|
return rest;
|
|
22119
22124
|
}, "withoutPhone");
|
|
22120
22125
|
|
|
22121
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22126
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/task-stats.js
|
|
22127
|
+
var TASK_STATS_BY = ["chat", "meeting", "project"];
|
|
22128
|
+
var PERIOD_FIELD = "created";
|
|
22129
|
+
var refuseNestedPeriod = /* @__PURE__ */ __name((node, top = true) => {
|
|
22130
|
+
if (node.kind === "predicate")
|
|
22131
|
+
return;
|
|
22132
|
+
const optional2 = node.clauses.some(({ occur }) => occur === "should");
|
|
22133
|
+
for (const { occur, node: inner } of node.clauses) {
|
|
22134
|
+
if (!walkQuery(inner).some(({ field }) => field === PERIOD_FIELD))
|
|
22135
|
+
continue;
|
|
22136
|
+
if (!top || optional2 || occur !== "must")
|
|
22137
|
+
throw new CliError("validation_error", `${PERIOD_FIELD}: sets the period of stats tasks show: give it as a required term, not inside OR or NOT`);
|
|
22138
|
+
refuseNestedPeriod(inner, top);
|
|
22139
|
+
}
|
|
22140
|
+
}, "refuseNestedPeriod");
|
|
22141
|
+
var renamed = /* @__PURE__ */ __name((node, from, to) => node.kind === "predicate" ? node.field === from ? { ...node, field: to } : node : { ...node, clauses: node.clauses.map((clause) => ({ ...clause, node: renamed(clause.node, from, to) })) }, "renamed");
|
|
22142
|
+
var median2 = /* @__PURE__ */ __name((values) => {
|
|
22143
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
22144
|
+
const middle = Math.floor(sorted.length / 2);
|
|
22145
|
+
const upper = sorted[middle] ?? 0;
|
|
22146
|
+
return sorted.length % 2 === 1 ? upper : ((sorted[middle - 1] ?? 0) + upper) / 2;
|
|
22147
|
+
}, "median");
|
|
22148
|
+
var mean = /* @__PURE__ */ __name((values) => Math.round(values.reduce((sum2, one) => sum2 + one, 0) / values.length), "mean");
|
|
22149
|
+
var spread = /* @__PURE__ */ __name((open7, closeMs, now) => ({
|
|
22150
|
+
...closeMs.length > 0 ? { medianCloseMs: median2(closeMs) } : {},
|
|
22151
|
+
...open7.length > 0 ? { meanOpenAgeMs: mean(open7.map(({ createdAt }) => now - createdAt)) } : {}
|
|
22152
|
+
}), "spread");
|
|
22153
|
+
var and = /* @__PURE__ */ __name((parts) => parts.length === 0 ? void 0 : { sql: parts.map(({ sql }) => `(${sql})`).join(" AND "), params: parts.flatMap(({ params }) => params) }, "and");
|
|
22154
|
+
var taskStatsOf = /* @__PURE__ */ __name(async (store, account, { by = "chat", query, timezone, group, kind }, columns, now = Date.now()) => {
|
|
22155
|
+
if (query)
|
|
22156
|
+
refuseNestedPeriod(query.root);
|
|
22157
|
+
const time = /* @__PURE__ */ __name((sql) => ({ type: "time", sql }), "time");
|
|
22158
|
+
const read = { ...columns, [PERIOD_FIELD]: time("t.created_at"), closed: time("t.closed_at") };
|
|
22159
|
+
const fixed = [
|
|
22160
|
+
...group === void 0 ? [] : [{ sql: "t.source_group = ?", params: [group] }],
|
|
22161
|
+
...kind === void 0 ? [] : [{ sql: "t.type = ?", params: [kind] }],
|
|
22162
|
+
...by === "meeting" ? [{ sql: "t.source_kind = 'meeting'", params: [] }] : []
|
|
22163
|
+
];
|
|
22164
|
+
const options = { command: "stats tasks show", now, ...timezone === void 0 ? {} : { zone: timezone } };
|
|
22165
|
+
const where = /* @__PURE__ */ __name((ast, more = []) => and([...fixed, ...more, ...ast ? [queryFilter(ast, read, options)] : []]), "where");
|
|
22166
|
+
const scope = by === "project" ? { board: true } : { account: taskAccount(account) };
|
|
22167
|
+
const all = await store.tasks.statRows(scope, where(withoutField(query, PERIOD_FIELD)));
|
|
22168
|
+
const created = await store.tasks.statRows(scope, where(query));
|
|
22169
|
+
const closed = await store.tasks.statRows(scope, where(query && { ...query, root: renamed(query.root, PERIOD_FIELD, "closed") }, [
|
|
22170
|
+
{ sql: "t.closed_at IS NOT NULL", params: [] }
|
|
22171
|
+
]));
|
|
22172
|
+
const keyOf5 = /* @__PURE__ */ __name((row) => by === "project" ? String(row.projectId) : row.group ?? "", "keyOf");
|
|
22173
|
+
const groups = /* @__PURE__ */ new Map();
|
|
22174
|
+
const slot = /* @__PURE__ */ __name((row) => {
|
|
22175
|
+
const key = keyOf5(row);
|
|
22176
|
+
const found = groups.get(key) ?? { open: [], created: 0, closeMs: [] };
|
|
22177
|
+
groups.set(key, found);
|
|
22178
|
+
return found;
|
|
22179
|
+
}, "slot");
|
|
22180
|
+
for (const row of all)
|
|
22181
|
+
if (!isClosedState(row.state))
|
|
22182
|
+
slot(row).open.push(row);
|
|
22183
|
+
for (const row of created)
|
|
22184
|
+
slot(row).created++;
|
|
22185
|
+
for (const row of closed)
|
|
22186
|
+
slot(row).closeMs.push((row.closedAt ?? row.createdAt) - row.createdAt);
|
|
22187
|
+
const kept2 = [...groups].filter(([, one]) => one.open.length + one.created + one.closeMs.length > 0);
|
|
22188
|
+
const ids = kept2.map(([key]) => key);
|
|
22189
|
+
const names2 = by === "chat" ? await store.tasks.statNames("chat", ids, taskAccount(account)) : by === "project" ? await store.tasks.statNames("project", ids) : await meetingNames(store, ids);
|
|
22190
|
+
const rows = kept2.map(([key, one]) => ({
|
|
22191
|
+
group: key,
|
|
22192
|
+
name: names2.get(key) ?? null,
|
|
22193
|
+
open: one.open.length,
|
|
22194
|
+
created: one.created,
|
|
22195
|
+
closed: one.closeMs.length,
|
|
22196
|
+
...one.open[0] ? { oldestOpenAt: new Date(one.open[0].createdAt) } : {},
|
|
22197
|
+
...spread(one.open, one.closeMs, now)
|
|
22198
|
+
}));
|
|
22199
|
+
const open7 = kept2.flatMap(([, one]) => one.open);
|
|
22200
|
+
const closeMs = kept2.flatMap(([, one]) => one.closeMs);
|
|
22201
|
+
return {
|
|
22202
|
+
by,
|
|
22203
|
+
open: open7.length,
|
|
22204
|
+
created: created.length,
|
|
22205
|
+
closed: closeMs.length,
|
|
22206
|
+
...spread(open7, closeMs, now),
|
|
22207
|
+
rows
|
|
22208
|
+
};
|
|
22209
|
+
}, "taskStatsOf");
|
|
22210
|
+
var meetingIdOf = /* @__PURE__ */ __name((group) => {
|
|
22211
|
+
try {
|
|
22212
|
+
return String(parseMeetingReference(group).meetingId);
|
|
22213
|
+
} catch {
|
|
22214
|
+
return void 0;
|
|
22215
|
+
}
|
|
22216
|
+
}, "meetingIdOf");
|
|
22217
|
+
var meetingNames = /* @__PURE__ */ __name(async (store, groups) => {
|
|
22218
|
+
const meetingOf = new Map(groups.flatMap((group) => {
|
|
22219
|
+
const id2 = meetingIdOf(group);
|
|
22220
|
+
return id2 === void 0 ? [] : [[group, id2]];
|
|
22221
|
+
}));
|
|
22222
|
+
const titles = await store.tasks.statNames("meeting", [...new Set(meetingOf.values())]);
|
|
22223
|
+
return new Map([...meetingOf].flatMap(([group, id2]) => {
|
|
22224
|
+
const title = titles.get(id2);
|
|
22225
|
+
return title === void 0 ? [] : [[group, title]];
|
|
22226
|
+
}));
|
|
22227
|
+
}, "meetingNames");
|
|
22228
|
+
|
|
22229
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
|
|
22122
22230
|
var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
|
|
22123
22231
|
const tags = /* @__PURE__ */ new Map();
|
|
22124
22232
|
for (const node of query ? walkQuery(query.root) : [])
|
|
@@ -22127,7 +22235,7 @@ var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
|
|
|
22127
22235
|
return tags;
|
|
22128
22236
|
}, "taskTagFilters");
|
|
22129
22237
|
|
|
22130
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22238
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/tasks.js
|
|
22131
22239
|
var TASK_QUERY = {
|
|
22132
22240
|
entity: "task",
|
|
22133
22241
|
backend: "sql",
|
|
@@ -22158,6 +22266,20 @@ var TASK_QUERY = {
|
|
|
22158
22266
|
}
|
|
22159
22267
|
})
|
|
22160
22268
|
};
|
|
22269
|
+
var TASK_STATS_QUERY = {
|
|
22270
|
+
entity: "task",
|
|
22271
|
+
backend: "sql",
|
|
22272
|
+
fields: [
|
|
22273
|
+
...TASK_QUERY.fields.filter(({ name }) => name !== "created_at" && name !== "closed_at"),
|
|
22274
|
+
{
|
|
22275
|
+
name: PERIOD_FIELD,
|
|
22276
|
+
type: "time",
|
|
22277
|
+
operators: OPERATORS_BY_TYPE.time,
|
|
22278
|
+
example: `${PERIOD_FIELD}>=30d`,
|
|
22279
|
+
relation: "the period: created counts the tasks opened in it, closed the tasks done or dismissed in it; open is open now"
|
|
22280
|
+
}
|
|
22281
|
+
]
|
|
22282
|
+
};
|
|
22161
22283
|
var PAIR_DECISIONS = ["review", "unsure"];
|
|
22162
22284
|
var TASK_PAIR_QUERY = {
|
|
22163
22285
|
entity: "task_pair",
|
|
@@ -22244,6 +22366,13 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
|
|
|
22244
22366
|
const inStore = /* @__PURE__ */ __name(async (work) => work(await deps.store(), await deps.account()), "inStore");
|
|
22245
22367
|
const service = /* @__PURE__ */ __name((store) => createTaskService({ store: store.tasks }), "service");
|
|
22246
22368
|
const groupOf = /* @__PURE__ */ __name(async (store, account, chat) => chat === void 0 ? void 0 : storedChatId(deps.messenger, chat, store, account, { includeLeft: true }), "groupOf");
|
|
22369
|
+
const queryColumns = /* @__PURE__ */ __name(async (store, account, query) => {
|
|
22370
|
+
const groups = /* @__PURE__ */ new Map();
|
|
22371
|
+
for (const node of query ? walkQuery(query.root) : [])
|
|
22372
|
+
if (node.field === "chat" && node.operator !== "wildcard" && !groups.has(node.value))
|
|
22373
|
+
groups.set(node.value, await storedChatId(deps.messenger, node.value, store, account, { includeLeft: true }));
|
|
22374
|
+
return taskColumns(groups, await taskTagFilters(store, query));
|
|
22375
|
+
}, "queryColumns");
|
|
22247
22376
|
const refuseBare = /* @__PURE__ */ __name((target2) => {
|
|
22248
22377
|
throw new CliError("validation_error", `no task ${singleLine(target2)} \u2014 write task:${singleLine(target2)} for a task`);
|
|
22249
22378
|
}, "refuseBare");
|
|
@@ -22298,12 +22427,7 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
|
|
|
22298
22427
|
const reviewAfterLink = /* @__PURE__ */ __name(async (store, id2) => !isClosedState((await store.tasks.get(id2))?.state ?? "done") ? store.tasks.reviewDuplicates(id2, { linked: true }) : 0, "reviewAfterLink");
|
|
22299
22428
|
return {
|
|
22300
22429
|
list: /* @__PURE__ */ __name(({ query, limit, offset, previews }) => inStore(async (store, account) => {
|
|
22301
|
-
const
|
|
22302
|
-
for (const node of query ? walkQuery(query.root) : [])
|
|
22303
|
-
if (node.field === "chat" && node.operator !== "wildcard" && !groups.has(node.value))
|
|
22304
|
-
groups.set(node.value, await storedChatId(deps.messenger, node.value, store, account, { includeLeft: true }));
|
|
22305
|
-
const tags = await taskTagFilters(store, query);
|
|
22306
|
-
const where = query ? queryFilter(query, taskColumns(groups, tags), { command: "tasks list" }) : void 0;
|
|
22430
|
+
const where = query ? queryFilter(query, await queryColumns(store, account, query), { command: "tasks list" }) : void 0;
|
|
22307
22431
|
const rows = await store.tasks.query(taskAccount(account), where, { limit: limit + 1, offset });
|
|
22308
22432
|
const shown = rows.slice(0, limit);
|
|
22309
22433
|
return {
|
|
@@ -22550,13 +22674,9 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
|
|
|
22550
22674
|
await owned(store, account, subject);
|
|
22551
22675
|
return store.tasks.similar({ task: subject }, options);
|
|
22552
22676
|
}), "similar"),
|
|
22553
|
-
stats: /* @__PURE__ */ __name((
|
|
22554
|
-
const group = await groupOf(store, account,
|
|
22555
|
-
|
|
22556
|
-
account: taskAccount(account),
|
|
22557
|
-
...filter.type === void 0 ? {} : { kind: filter.type }
|
|
22558
|
-
});
|
|
22559
|
-
return group === void 0 ? rows : rows.filter((one) => one.group === group);
|
|
22677
|
+
stats: /* @__PURE__ */ __name(({ chat, ...request } = {}) => inStore(async (store, account) => {
|
|
22678
|
+
const group = await groupOf(store, account, chat);
|
|
22679
|
+
return taskStatsOf(store, account, { ...request, ...group === void 0 ? {} : { group } }, await queryColumns(store, account, request.query));
|
|
22560
22680
|
}), "stats")
|
|
22561
22681
|
};
|
|
22562
22682
|
}, "tasksService");
|
|
@@ -22607,7 +22727,74 @@ var taskView = /* @__PURE__ */ __name(async (store, account, task2) => {
|
|
|
22607
22727
|
};
|
|
22608
22728
|
}, "taskView");
|
|
22609
22729
|
|
|
22610
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22730
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/mail/owed.js
|
|
22731
|
+
var mailTurn = /* @__PURE__ */ __name((newest) => {
|
|
22732
|
+
if (newest === null)
|
|
22733
|
+
return null;
|
|
22734
|
+
if (newest.outgoing)
|
|
22735
|
+
return "waiting";
|
|
22736
|
+
return newest.addressed ? "owed" : null;
|
|
22737
|
+
}, "mailTurn");
|
|
22738
|
+
|
|
22739
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/agenda-mail.js
|
|
22740
|
+
var absent = /* @__PURE__ */ __name((error) => {
|
|
22741
|
+
if (error instanceof CliError && error.code === "not_found")
|
|
22742
|
+
return void 0;
|
|
22743
|
+
throw error;
|
|
22744
|
+
}, "absent");
|
|
22745
|
+
var mailActivity = /* @__PURE__ */ __name(async (store, account, since, chats) => {
|
|
22746
|
+
const stored = await store.accounts.storedAccount(account).catch(absent);
|
|
22747
|
+
if (!stored)
|
|
22748
|
+
return { chats: [], storedAt: null, coverage: /* @__PURE__ */ __name(() => [], "coverage") };
|
|
22749
|
+
const where = chats ? queryFilter(chats, MAIL_AGENDA_COLUMNS, { command: "tasks agenda" }) : void 0;
|
|
22750
|
+
const threads = await store.mail.threadActivity(stored.id, since, where);
|
|
22751
|
+
const synced = await store.sync.syncState(account, "mail_coverage");
|
|
22752
|
+
const window3 = (() => {
|
|
22753
|
+
try {
|
|
22754
|
+
return JSON.parse(synced?.value ?? "{}");
|
|
22755
|
+
} catch {
|
|
22756
|
+
return {};
|
|
22757
|
+
}
|
|
22758
|
+
})();
|
|
22759
|
+
const byId2 = new Map(threads.map((thread) => [thread.threadId, thread]));
|
|
22760
|
+
return {
|
|
22761
|
+
chats: threads.map((thread) => ({
|
|
22762
|
+
chatId: thread.threadId,
|
|
22763
|
+
title: thread.subject,
|
|
22764
|
+
kind: "dialog",
|
|
22765
|
+
lastMessageAt: new Date(thread.newest?.at ?? thread.lastEmailAt).toISOString(),
|
|
22766
|
+
lastMessageId: thread.newest?.externalId ?? null,
|
|
22767
|
+
lastFromOwner: thread.newest ? thread.newest.outgoing : null,
|
|
22768
|
+
turn: mailTurn(thread.newest)
|
|
22769
|
+
})),
|
|
22770
|
+
storedAt: synced?.at ?? null,
|
|
22771
|
+
coverage: /* @__PURE__ */ __name((ids) => ids.map((chatId) => {
|
|
22772
|
+
const thread = byId2.get(chatId);
|
|
22773
|
+
const newest = thread?.newest?.at ?? thread?.lastEmailAt;
|
|
22774
|
+
const until = window3.until === void 0 ? Number.NaN : Date.parse(window3.until);
|
|
22775
|
+
return {
|
|
22776
|
+
chatId,
|
|
22777
|
+
title: thread?.subject ?? null,
|
|
22778
|
+
completeness: {
|
|
22779
|
+
chatId,
|
|
22780
|
+
// Sync holds a window of the mailbox, never a thread's whole history.
|
|
22781
|
+
state: synced ? "partial" : "unknown",
|
|
22782
|
+
upToDate: window3.state === "window" && newest !== void 0 && !Number.isNaN(until) ? newest <= until : null,
|
|
22783
|
+
gaps: false,
|
|
22784
|
+
reachesStart: false,
|
|
22785
|
+
fetchedAt: synced?.at ?? null
|
|
22786
|
+
},
|
|
22787
|
+
held: {
|
|
22788
|
+
messages: thread?.emails ?? 0,
|
|
22789
|
+
oldestAt: null,
|
|
22790
|
+
newestAt: newest === void 0 ? null : new Date(newest).toISOString()
|
|
22791
|
+
}
|
|
22792
|
+
};
|
|
22793
|
+
}), "coverage")
|
|
22794
|
+
};
|
|
22795
|
+
}, "mailActivity");
|
|
22796
|
+
|
|
22797
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/chat-coverage.js
|
|
22611
22798
|
var chatCoverage = /* @__PURE__ */ __name(async (store, account, chatIds) => {
|
|
22612
22799
|
const ids = [...new Set(chatIds)];
|
|
22613
22800
|
if (ids.length === 0)
|
|
@@ -22633,7 +22820,7 @@ var chatCoverage = /* @__PURE__ */ __name(async (store, account, chatIds) => {
|
|
|
22633
22820
|
}));
|
|
22634
22821
|
}, "chatCoverage");
|
|
22635
22822
|
|
|
22636
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22823
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/agenda.js
|
|
22637
22824
|
var DAY = 864e5;
|
|
22638
22825
|
var AGENDA_DEFAULTS = { unanswered: DAY, waiting: 7 * DAY };
|
|
22639
22826
|
var CLAIMS = ["none", "mine", "others", "any"];
|
|
@@ -22667,7 +22854,7 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
|
|
|
22667
22854
|
const [store, account] = [await deps.store(), await deps.account()];
|
|
22668
22855
|
const at = now();
|
|
22669
22856
|
const parts = query ? split(query) : { tasks: void 0, chats: void 0 };
|
|
22670
|
-
const find = /* @__PURE__ */ __name((
|
|
22857
|
+
const find = /* @__PURE__ */ __name((where) => store.tasks.find({ project: inboxKey(taskAccount(account)), status: "open", limit: 500, ...where ? { where } : {} }).catch((error) => {
|
|
22671
22858
|
if (error instanceof Error && "code" in error && error.code === "not_found")
|
|
22672
22859
|
return [];
|
|
22673
22860
|
throw error;
|
|
@@ -22704,9 +22891,11 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
|
|
|
22704
22891
|
createdAt: task2.createdAt,
|
|
22705
22892
|
assignees
|
|
22706
22893
|
}));
|
|
22707
|
-
const
|
|
22708
|
-
const activity = await store.chats.chatActivity(account, at - within,
|
|
22894
|
+
const mail = account.provider === "email" ? await mailActivity(store, account, at - within, parts.chats) : void 0;
|
|
22895
|
+
const activity = mail ?? await store.chats.chatActivity(account, at - within, parts.chats ? queryFilter(parts.chats, AGENDA_COLUMNS, { command: "tasks agenda" }) : void 0);
|
|
22896
|
+
const turnOf = /* @__PURE__ */ __name((chat) => "turn" in chat ? chat.turn : chat.lastFromOwner === null ? null : chat.lastFromOwner ? "waiting" : "owed", "turnOf");
|
|
22709
22897
|
const chats = activity.chats.map(({ lastMessageId, ...chat }) => ({
|
|
22898
|
+
turn: turnOf({ lastMessageId, ...chat }),
|
|
22710
22899
|
...chat,
|
|
22711
22900
|
lastMessage: lastMessageId === null ? null : formatLocator({
|
|
22712
22901
|
provider: account.provider,
|
|
@@ -22718,12 +22907,14 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
|
|
|
22718
22907
|
}));
|
|
22719
22908
|
const silentFor = /* @__PURE__ */ __name((chat) => at - Date.parse(chat.lastMessageAt), "silentFor");
|
|
22720
22909
|
const shown = {
|
|
22721
|
-
owed: chats.filter((chat) => chat.
|
|
22722
|
-
waiting: chats.filter((chat) => chat.
|
|
22723
|
-
|
|
22910
|
+
owed: chats.filter((chat) => chat.turn === "owed" && silentFor(chat) >= unanswered2),
|
|
22911
|
+
waiting: chats.filter((chat) => chat.turn === "waiting" && silentFor(chat) >= waiting),
|
|
22912
|
+
// A thread with no stored email but drafts is not behind: mail sync stores every email it lists.
|
|
22913
|
+
unsynced: mail ? [] : chats.filter((chat) => chat.lastMessage === null)
|
|
22724
22914
|
};
|
|
22725
|
-
const
|
|
22726
|
-
const
|
|
22915
|
+
const ids = Object.values(shown).flatMap((list3) => list3.map(({ chatId }) => chatId));
|
|
22916
|
+
const covered = new Map((mail ? mail.coverage(ids) : await chatCoverage(store, account, ids)).map((one) => [one.chatId, one]));
|
|
22917
|
+
const withCoverage = /* @__PURE__ */ __name((list3) => list3.map(({ turn: _, ...chat }) => ({ ...chat, coverage: covered.get(chat.chatId) })), "withCoverage");
|
|
22727
22918
|
const inList = new Set((await store.tasks.categories()).map(({ name }) => name));
|
|
22728
22919
|
const unlisted = /* @__PURE__ */ new Map();
|
|
22729
22920
|
for (const { category } of open7)
|
|
@@ -22876,7 +23067,7 @@ var agendaItem = /* @__PURE__ */ __name((shown) => {
|
|
|
22876
23067
|
};
|
|
22877
23068
|
}, "agendaItem");
|
|
22878
23069
|
|
|
22879
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23070
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/context/evidence-response.js
|
|
22880
23071
|
var contextSourceKey = /* @__PURE__ */ __name((source) => JSON.stringify([source.kind, source.accountId, source.provider, source.account]), "contextSourceKey");
|
|
22881
23072
|
var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
|
|
22882
23073
|
const fail2 = /* @__PURE__ */ __name(() => {
|
|
@@ -22899,33 +23090,33 @@ var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
|
|
|
22899
23090
|
if (big !== void 0 && (!big || page.items.length || typeof big.ref !== "string" || !Number.isSafeInteger(big.bytes) || big.bytes <= maxReadBytes))
|
|
22900
23091
|
fail2();
|
|
22901
23092
|
let actual = 0;
|
|
22902
|
-
for (const
|
|
22903
|
-
if (!
|
|
23093
|
+
for (const item2 of page.items) {
|
|
23094
|
+
if (!item2 || item2.provider !== source.provider || item2.account !== source.account || typeof item2.text !== "string" || typeof item2.ref !== "string")
|
|
22904
23095
|
fail2();
|
|
22905
|
-
if (!Number.isSafeInteger(
|
|
23096
|
+
if (!Number.isSafeInteger(item2.at) || item2.at < after || item2.at >= before2 || !Number.isSafeInteger(item2.updatedAt) || item2.updatedAt < 0)
|
|
22906
23097
|
fail2();
|
|
22907
|
-
if (
|
|
23098
|
+
if (item2.revision !== null && (!Number.isSafeInteger(item2.revision) || item2.revision < 1))
|
|
22908
23099
|
fail2();
|
|
22909
|
-
if (source.kind === "document" ? !["source-modified", "stored-update"].includes(
|
|
23100
|
+
if (source.kind === "document" ? !["source-modified", "stored-update"].includes(item2.timeKind) : item2.timeKind !== (source.kind === "meeting" ? "meeting-start" : "sent"))
|
|
22910
23101
|
fail2();
|
|
22911
|
-
const sender =
|
|
23102
|
+
const sender = item2.sender;
|
|
22912
23103
|
if (sender != null && (typeof sender !== "object" || typeof sender.provider !== "string" || typeof sender.id !== "string" || typeof sender.owner !== "boolean" || [sender.name, sender.person, sender.personName].some((v) => v !== null && typeof v !== "string") || sender.person !== null && !/^person:[1-9]\d*$/.test(sender.person)))
|
|
22913
23104
|
fail2();
|
|
22914
|
-
const text2 = [
|
|
23105
|
+
const text2 = [item2.text, item2.title, item2.url, item2.provider, item2.account, item2.timeKind];
|
|
22915
23106
|
if (text2.some((value) => value !== null && typeof value !== "string"))
|
|
22916
23107
|
fail2();
|
|
22917
23108
|
if (source.kind === "document") {
|
|
22918
|
-
const id2 = Number(
|
|
22919
|
-
if (!Number.isSafeInteger(id2) || id2 < 1 ||
|
|
23109
|
+
const id2 = Number(item2.ref.slice(9));
|
|
23110
|
+
if (!Number.isSafeInteger(id2) || id2 < 1 || item2.ref !== `document:${id2}`)
|
|
22920
23111
|
fail2();
|
|
22921
23112
|
} else if (source.kind === "meeting") {
|
|
22922
|
-
const reference = parseMeetingReference(
|
|
22923
|
-
if (reference.accountId !== source.accountId || reference.transcriptId === void 0 || reference.cuePosition === void 0 || formatMeetingReference(reference) !==
|
|
23113
|
+
const reference = parseMeetingReference(item2.ref);
|
|
23114
|
+
if (reference.accountId !== source.accountId || reference.transcriptId === void 0 || reference.cuePosition === void 0 || formatMeetingReference(reference) !== item2.ref)
|
|
22924
23115
|
fail2();
|
|
22925
|
-
text2.push(
|
|
23116
|
+
text2.push(item2.ref);
|
|
22926
23117
|
} else {
|
|
22927
|
-
const locator = parseLocator(
|
|
22928
|
-
if (locator.provider !== source.provider || locator.account !== source.account || chat !== void 0 && locator.chat !== chat || formatLocator(locator) !==
|
|
23118
|
+
const locator = parseLocator(item2.ref);
|
|
23119
|
+
if (locator.provider !== source.provider || locator.account !== source.account || chat !== void 0 && locator.chat !== chat || formatLocator(locator) !== item2.ref)
|
|
22929
23120
|
fail2();
|
|
22930
23121
|
text2.push(locator.chat, locator.message);
|
|
22931
23122
|
}
|
|
@@ -22940,7 +23131,7 @@ var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
|
|
|
22940
23131
|
}
|
|
22941
23132
|
}, "validateContextEvidencePage");
|
|
22942
23133
|
|
|
22943
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23134
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/context/read-budget.js
|
|
22944
23135
|
var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
|
|
22945
23136
|
if (!limits || typeof limits !== "object" || Array.isArray(limits))
|
|
22946
23137
|
throw new CliError("validation_error", "limits needs a context read allowance");
|
|
@@ -22993,7 +23184,7 @@ var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
|
|
|
22993
23184
|
};
|
|
22994
23185
|
}, "contextReadBudget");
|
|
22995
23186
|
|
|
22996
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23187
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/context-evidence.js
|
|
22997
23188
|
var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits) => {
|
|
22998
23189
|
if (!port || typeof port.read !== "function")
|
|
22999
23190
|
throw new CliError("configuration_error", "context evidence reader is unavailable");
|
|
@@ -23037,7 +23228,7 @@ var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits)
|
|
|
23037
23228
|
};
|
|
23038
23229
|
}, "createContextEvidenceReader");
|
|
23039
23230
|
|
|
23040
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23231
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/excerpt.js
|
|
23041
23232
|
var queryWords = /* @__PURE__ */ __name((query) => query.toLowerCase().split(/\s+/).map((word) => word.replace(/^[\p{L}_]+:/u, "").replace(/~\d+$/u, "").replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu, "")).filter((word) => word.length > 2 && !["and", "or", "not"].includes(word)), "queryWords");
|
|
23042
23233
|
var excerpt = /* @__PURE__ */ __name((text2, query, size2 = 240, options = {}) => {
|
|
23043
23234
|
const flat = text2.replace(/\s+/g, " ").trim();
|
|
@@ -23053,7 +23244,7 @@ var excerpt = /* @__PURE__ */ __name((text2, query, size2 = 240, options = {}) =
|
|
|
23053
23244
|
}, "excerpt");
|
|
23054
23245
|
var withExcerpt = /* @__PURE__ */ __name(({ matchedText, ...hit }, query) => ({ ...hit, excerpt: excerpt(matchedText ?? hit.text, query) }), "withExcerpt");
|
|
23055
23246
|
|
|
23056
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23247
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-purposes.js
|
|
23057
23248
|
var BUILT_IN_PURPOSES = ["work", "sales", "support", "other"];
|
|
23058
23249
|
var DEFAULT_PURPOSES = ["work"];
|
|
23059
23250
|
var LINK_PURPOSE = "work";
|
|
@@ -23083,7 +23274,7 @@ var purposeList = /* @__PURE__ */ __name((value, previous = []) => [
|
|
|
23083
23274
|
...value.split(",").map((one) => one.trim()).filter(Boolean)
|
|
23084
23275
|
], "purposeList");
|
|
23085
23276
|
|
|
23086
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23277
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-gathering-around.js
|
|
23087
23278
|
var storedMessageNeighbours = /* @__PURE__ */ __name((messages) => ({
|
|
23088
23279
|
async around(ref, window3) {
|
|
23089
23280
|
const at = parseLocator(ref);
|
|
@@ -23117,35 +23308,35 @@ var documentMatches = /* @__PURE__ */ __name((text2, queries, window3) => {
|
|
|
23117
23308
|
var attachNeighbours = /* @__PURE__ */ __name(async (items, reader, window3, budget, known2, signal) => {
|
|
23118
23309
|
if (!reader || window3.before + window3.after === 0)
|
|
23119
23310
|
return;
|
|
23120
|
-
for (const
|
|
23121
|
-
if (
|
|
23311
|
+
for (const item2 of items) {
|
|
23312
|
+
if (item2.kind !== "message" && item2.kind !== "mail")
|
|
23122
23313
|
continue;
|
|
23123
23314
|
if (budget.remaining() <= 0) {
|
|
23124
|
-
|
|
23125
|
-
|
|
23315
|
+
item2.around = null;
|
|
23316
|
+
item2.aroundIssue = "read-bytes";
|
|
23126
23317
|
continue;
|
|
23127
23318
|
}
|
|
23128
23319
|
signal?.throwIfAborted();
|
|
23129
23320
|
try {
|
|
23130
|
-
const rows = await reader.around(
|
|
23321
|
+
const rows = await reader.around(item2.ref, window3);
|
|
23131
23322
|
const around = [];
|
|
23132
23323
|
for (const row of rows.slice(0, window3.before + window3.after)) {
|
|
23133
23324
|
const text2 = excerpt(row.text, "", 200);
|
|
23134
23325
|
const bytes2 = Buffer.byteLength(text2);
|
|
23135
23326
|
if (bytes2 > budget.remaining()) {
|
|
23136
|
-
|
|
23327
|
+
item2.aroundIssue = "read-bytes";
|
|
23137
23328
|
break;
|
|
23138
23329
|
}
|
|
23139
23330
|
budget.charge(bytes2);
|
|
23140
23331
|
around.push({ ...row, text: text2, found: known2(row.ref) });
|
|
23141
23332
|
}
|
|
23142
|
-
|
|
23333
|
+
item2.around = around;
|
|
23143
23334
|
} catch (error) {
|
|
23144
23335
|
signal?.throwIfAborted();
|
|
23145
23336
|
if (!(error instanceof CliError))
|
|
23146
23337
|
throw error;
|
|
23147
|
-
|
|
23148
|
-
|
|
23338
|
+
item2.around = null;
|
|
23339
|
+
item2.aroundIssue = error.code;
|
|
23149
23340
|
}
|
|
23150
23341
|
}
|
|
23151
23342
|
}, "attachNeighbours");
|
|
@@ -23178,7 +23369,7 @@ var storedNeighbours = /* @__PURE__ */ __name((store) => {
|
|
|
23178
23369
|
};
|
|
23179
23370
|
}, "storedNeighbours");
|
|
23180
23371
|
|
|
23181
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23372
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-gathering-request.js
|
|
23182
23373
|
import { createHash as createHash2 } from "node:crypto";
|
|
23183
23374
|
var DAY2 = 864e5;
|
|
23184
23375
|
var MAX_TIME = 864e13;
|
|
@@ -23494,7 +23685,7 @@ var decodeCheckpoint = /* @__PURE__ */ __name((text2, plan) => {
|
|
|
23494
23685
|
return value;
|
|
23495
23686
|
}, "decodeCheckpoint");
|
|
23496
23687
|
|
|
23497
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23688
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-gathering.js
|
|
23498
23689
|
var terminal = /* @__PURE__ */ new Set(["done", "unavailable", "failed"]);
|
|
23499
23690
|
var PAGE3 = 20;
|
|
23500
23691
|
var PEOPLE = 20;
|
|
@@ -23641,27 +23832,27 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
23641
23832
|
matchedAgain.set(ref, (matchedAgain.get(ref) ?? /* @__PURE__ */ new Set()).add(lane.id));
|
|
23642
23833
|
return true;
|
|
23643
23834
|
}, "again");
|
|
23644
|
-
const take = /* @__PURE__ */ __name((
|
|
23645
|
-
if (again(
|
|
23835
|
+
const take = /* @__PURE__ */ __name((item2, lane, kind, source) => {
|
|
23836
|
+
if (again(item2.ref, lane))
|
|
23646
23837
|
return;
|
|
23647
|
-
seen.add(seenKey(
|
|
23648
|
-
const short = excerpt(
|
|
23649
|
-
const fingerprint = contextEvidenceFingerprint(
|
|
23650
|
-
const { sender, ...stored } =
|
|
23838
|
+
seen.add(seenKey(item2.ref));
|
|
23839
|
+
const short = excerpt(item2.text, lane.query ?? "", 300, { literal: true });
|
|
23840
|
+
const fingerprint = contextEvidenceFingerprint(item2);
|
|
23841
|
+
const { sender, ...stored } = item2;
|
|
23651
23842
|
if (sender)
|
|
23652
|
-
senderOf.set(
|
|
23843
|
+
senderOf.set(item2.ref, sender);
|
|
23653
23844
|
const entry = {
|
|
23654
23845
|
...stored,
|
|
23655
23846
|
kind,
|
|
23656
23847
|
source,
|
|
23657
23848
|
text: short,
|
|
23658
|
-
textTruncated: short !==
|
|
23849
|
+
textTruncated: short !== item2.text.replace(/\s+/g, " ").trim(),
|
|
23659
23850
|
fingerprint,
|
|
23660
23851
|
lanes: [lane.id],
|
|
23661
23852
|
context: contextOf(lane)
|
|
23662
23853
|
};
|
|
23663
23854
|
if (kind === "document" && lane.query !== null && plan.around.before + plan.around.after) {
|
|
23664
|
-
const passage = documentMatches(
|
|
23855
|
+
const passage = documentMatches(item2.text, queries, plan.around);
|
|
23665
23856
|
entry.around = [];
|
|
23666
23857
|
entry.moreMatches = passage.moreMatches;
|
|
23667
23858
|
for (const part of passage.around) {
|
|
@@ -23671,10 +23862,10 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
23671
23862
|
break;
|
|
23672
23863
|
}
|
|
23673
23864
|
usage.aroundBytes += bytes2;
|
|
23674
|
-
entry.around.push({ ref:
|
|
23865
|
+
entry.around.push({ ref: item2.ref, at: item2.at, sender: null, ...part });
|
|
23675
23866
|
}
|
|
23676
23867
|
}
|
|
23677
|
-
byRef.set(
|
|
23868
|
+
byRef.set(item2.ref, entry);
|
|
23678
23869
|
items.push(entry);
|
|
23679
23870
|
usage.items++;
|
|
23680
23871
|
if (linkedLanes.has(lane.id))
|
|
@@ -23741,8 +23932,8 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
23741
23932
|
}
|
|
23742
23933
|
state.pages++;
|
|
23743
23934
|
state.code = page.coverage.index === "ready" ? null : `index-${page.coverage.index}`;
|
|
23744
|
-
for (const
|
|
23745
|
-
take(
|
|
23935
|
+
for (const item2 of page.items)
|
|
23936
|
+
take(item2, unit.lane, unit.source.kind, unit.sourceIndex);
|
|
23746
23937
|
if (!page.coverage.available)
|
|
23747
23938
|
state.state = "unavailable";
|
|
23748
23939
|
else if (page.next) {
|
|
@@ -23766,7 +23957,7 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
23766
23957
|
}
|
|
23767
23958
|
await attachNeighbours(
|
|
23768
23959
|
// A linked chat's neighbours are already its own lane's evidence.
|
|
23769
|
-
items.filter((
|
|
23960
|
+
items.filter((item2) => item2.context !== "linked-chat"),
|
|
23770
23961
|
ports.neighbours,
|
|
23771
23962
|
plan.around,
|
|
23772
23963
|
{
|
|
@@ -23877,8 +24068,8 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
23877
24068
|
}, "gatherProjectEvidence");
|
|
23878
24069
|
var peopleOf = /* @__PURE__ */ __name((items, senderOf) => {
|
|
23879
24070
|
const byKey = /* @__PURE__ */ new Map();
|
|
23880
|
-
for (const
|
|
23881
|
-
const sender = senderOf.get(
|
|
24071
|
+
for (const item2 of items) {
|
|
24072
|
+
const sender = senderOf.get(item2.ref);
|
|
23882
24073
|
if (!sender || sender.owner)
|
|
23883
24074
|
continue;
|
|
23884
24075
|
const key = sender.person ?? JSON.stringify([sender.provider, sender.id]);
|
|
@@ -23890,15 +24081,15 @@ var peopleOf = /* @__PURE__ */ __name((items, senderOf) => {
|
|
|
23890
24081
|
contexts: {}
|
|
23891
24082
|
};
|
|
23892
24083
|
byKey.set(key, found);
|
|
23893
|
-
if (!found.identities.some((i) => i.provider === sender.provider && i.account ===
|
|
23894
|
-
found.identities.push({ provider: sender.provider, account:
|
|
24084
|
+
if (!found.identities.some((i) => i.provider === sender.provider && i.account === item2.account && i.id === sender.id))
|
|
24085
|
+
found.identities.push({ provider: sender.provider, account: item2.account, id: sender.id });
|
|
23895
24086
|
found.items++;
|
|
23896
|
-
found.contexts[
|
|
24087
|
+
found.contexts[item2.context] = (found.contexts[item2.context] ?? 0) + 1;
|
|
23897
24088
|
}
|
|
23898
24089
|
return [...byKey.values()].sort((a, b) => b.items - a.items || a.name.localeCompare(b.name));
|
|
23899
24090
|
}, "peopleOf");
|
|
23900
24091
|
|
|
23901
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24092
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-matching.js
|
|
23902
24093
|
var normalizedText = /* @__PURE__ */ __name((text2) => text2.normalize("NFKC").toLowerCase().replace(/\s+/gu, " "), "normalizedText");
|
|
23903
24094
|
var termsOf = /* @__PURE__ */ __name((entry) => [
|
|
23904
24095
|
{ name: entry.name, kind: "canonical" },
|
|
@@ -23942,7 +24133,7 @@ var matchVocabularyTerms = /* @__PURE__ */ __name((catalog, texts) => {
|
|
|
23942
24133
|
return result.sort((a, b) => Number(a.entry.id) - Number(b.entry.id));
|
|
23943
24134
|
}, "matchVocabularyTerms");
|
|
23944
24135
|
|
|
23945
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24136
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-gathering-mentions.js
|
|
23946
24137
|
var KINDS = ["project", "tag", "topic"];
|
|
23947
24138
|
var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering, options = {}) => {
|
|
23948
24139
|
if (typeof vocabulary?.vocabulary !== "function")
|
|
@@ -23950,9 +24141,9 @@ var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering,
|
|
|
23950
24141
|
const limit = options.limit ?? 50;
|
|
23951
24142
|
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 200)
|
|
23952
24143
|
throw new CliError("validation_error", "limit must be a whole number from 1 to 200", { param: "limit" });
|
|
23953
|
-
const texts = gathering.items.flatMap((
|
|
23954
|
-
{ text: `${
|
|
23955
|
-
...(
|
|
24144
|
+
const texts = gathering.items.flatMap((item2) => [
|
|
24145
|
+
{ text: `${item2.title ?? ""} ${item2.text}`, source: { reference: item2.ref, in: "hit" } },
|
|
24146
|
+
...(item2.around ?? []).map((one) => ({ text: one.text, source: { reference: one.ref, in: "around" } }))
|
|
23956
24147
|
]);
|
|
23957
24148
|
const items = [];
|
|
23958
24149
|
const vocabularyFingerprints = {};
|
|
@@ -23997,7 +24188,7 @@ var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering,
|
|
|
23997
24188
|
};
|
|
23998
24189
|
}, "findEvidenceMentions");
|
|
23999
24190
|
|
|
24000
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24191
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/stored-project-gathering.js
|
|
24001
24192
|
var storedChatCount = /* @__PURE__ */ __name((store) => async (account, chatId, { since, until }) => {
|
|
24002
24193
|
const window3 = { since: new Date(since).toISOString(), until: new Date(until - 1).toISOString() };
|
|
24003
24194
|
const [messages, newest, oldest] = await Promise.all([
|
|
@@ -24248,9 +24439,9 @@ var gatherStoredProject = /* @__PURE__ */ __name(async (store, input) => {
|
|
|
24248
24439
|
if (proposed && lane.kinds.includes("sender"))
|
|
24249
24440
|
proposedLanes.set(lane.id, proposed);
|
|
24250
24441
|
}
|
|
24251
|
-
const items = gathered.items.map((
|
|
24252
|
-
const proposed =
|
|
24253
|
-
return proposed ? { ...
|
|
24442
|
+
const items = gathered.items.map((item2) => {
|
|
24443
|
+
const proposed = item2.lanes.every((lane) => proposedLanes.has(lane)) ? proposedLanes.get(item2.lanes[0] ?? "") : void 0;
|
|
24444
|
+
return proposed ? { ...item2, proposed } : item2;
|
|
24254
24445
|
});
|
|
24255
24446
|
const linkedRows = gathered.linkedChats.map((row) => {
|
|
24256
24447
|
const link4 = byRef.get(row.ref);
|
|
@@ -24303,18 +24494,18 @@ var purposeHintOf = /* @__PURE__ */ __name((linked, rows, of) => {
|
|
|
24303
24494
|
return { chat: top.ref, relationship: link4.relationship, items, of };
|
|
24304
24495
|
}, "purposeHintOf");
|
|
24305
24496
|
|
|
24306
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24497
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/media-archive.js
|
|
24307
24498
|
import { setTimeout as sleep3 } from "node:timers/promises";
|
|
24308
24499
|
|
|
24309
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24500
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
|
|
24310
24501
|
import { lstat } from "node:fs/promises";
|
|
24311
24502
|
|
|
24312
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24503
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
|
|
24313
24504
|
import { createHash as createHash4, randomUUID as randomUUID2 } from "node:crypto";
|
|
24314
24505
|
import { open as open3, rename as rename2, unlink as unlink2 } from "node:fs/promises";
|
|
24315
24506
|
import { join as join3 } from "node:path";
|
|
24316
24507
|
|
|
24317
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24508
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
|
|
24318
24509
|
import { createHash as createHash3 } from "node:crypto";
|
|
24319
24510
|
var metadataLimit = 16384;
|
|
24320
24511
|
var partialIdentity = /* @__PURE__ */ __name((locator) => JSON.stringify([locator.provider, locator.account, locator.occurrenceId, locator.assetId]), "partialIdentity");
|
|
@@ -24374,7 +24565,7 @@ var readPartialMetadata = /* @__PURE__ */ __name(async (path, locator, maxBytes,
|
|
|
24374
24565
|
}
|
|
24375
24566
|
}, "readPartialMetadata");
|
|
24376
24567
|
|
|
24377
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24568
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-writer.js
|
|
24378
24569
|
import { randomUUID } from "node:crypto";
|
|
24379
24570
|
import { open as open2, rename, unlink } from "node:fs/promises";
|
|
24380
24571
|
import { join as join2 } from "node:path";
|
|
@@ -24466,7 +24657,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
|
|
|
24466
24657
|
};
|
|
24467
24658
|
}, "partialWriter");
|
|
24468
24659
|
|
|
24469
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24660
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
|
|
24470
24661
|
var NativeRecordingPartialStore = class {
|
|
24471
24662
|
static {
|
|
24472
24663
|
__name(this, "NativeRecordingPartialStore");
|
|
@@ -24573,21 +24764,21 @@ var NativeRecordingPartialStore = class {
|
|
|
24573
24764
|
}
|
|
24574
24765
|
};
|
|
24575
24766
|
|
|
24576
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24767
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
|
|
24577
24768
|
import { createHash as createHash5 } from "node:crypto";
|
|
24578
24769
|
import { link as link2 } from "node:fs/promises";
|
|
24579
24770
|
import { basename as basename2, dirname as dirname2, join as join5, resolve as resolve2 } from "node:path";
|
|
24580
24771
|
|
|
24581
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24772
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-files.js
|
|
24582
24773
|
import { unlink as unlink3 } from "node:fs/promises";
|
|
24583
|
-
var verifiedPublicationFile = /* @__PURE__ */ __name(async (path,
|
|
24774
|
+
var verifiedPublicationFile = /* @__PURE__ */ __name(async (path, expected2, signal, writable = false) => {
|
|
24584
24775
|
signal?.throwIfAborted();
|
|
24585
24776
|
const file2 = await openOrdinaryFile(path, { writable });
|
|
24586
24777
|
try {
|
|
24587
|
-
if ((await file2.stat()).size !==
|
|
24778
|
+
if ((await file2.stat()).size !== expected2.size)
|
|
24588
24779
|
throw new CliError("validation_error", "recording recovery final checksum does not match");
|
|
24589
|
-
const actual = await fingerprintPartial(file2, signal,
|
|
24590
|
-
if (actual.offset !==
|
|
24780
|
+
const actual = await fingerprintPartial(file2, signal, expected2.size);
|
|
24781
|
+
if (actual.offset !== expected2.size || actual.sha256 !== expected2.sha256)
|
|
24591
24782
|
throw new CliError("validation_error", "recording recovery final checksum does not match");
|
|
24592
24783
|
return file2;
|
|
24593
24784
|
} catch (error) {
|
|
@@ -24613,7 +24804,7 @@ var commitPublication = /* @__PURE__ */ __name(async (root, partialPath, finalPa
|
|
|
24613
24804
|
signal?.throwIfAborted();
|
|
24614
24805
|
}, "commitPublication");
|
|
24615
24806
|
|
|
24616
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24807
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-journal.js
|
|
24617
24808
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
24618
24809
|
import { open as open4, rename as rename3, unlink as unlink4 } from "node:fs/promises";
|
|
24619
24810
|
import { join as join4 } from "node:path";
|
|
@@ -24686,7 +24877,7 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
|
|
|
24686
24877
|
}
|
|
24687
24878
|
}, "writePublicationJournal");
|
|
24688
24879
|
|
|
24689
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24880
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
|
|
24690
24881
|
var NativeRecordingPublication = class {
|
|
24691
24882
|
static {
|
|
24692
24883
|
__name(this, "NativeRecordingPublication");
|
|
@@ -24713,13 +24904,13 @@ var NativeRecordingPublication = class {
|
|
|
24713
24904
|
write(value) {
|
|
24714
24905
|
return writePublicationJournal(this.root, this.journalPath, this.options.prefix, value, this.options.codec, this.options.metadataLimit, this.options.signal);
|
|
24715
24906
|
}
|
|
24716
|
-
validate(partialPath,
|
|
24717
|
-
if (resolve2(dirname2(partialPath)) !== resolve2(this.root) || resolve2(partialPath) === resolve2(this.finalPath) || resolve2(partialPath) === resolve2(this.journalPath) || !Number.isSafeInteger(
|
|
24907
|
+
validate(partialPath, expected2) {
|
|
24908
|
+
if (resolve2(dirname2(partialPath)) !== resolve2(this.root) || resolve2(partialPath) === resolve2(this.finalPath) || resolve2(partialPath) === resolve2(this.journalPath) || !Number.isSafeInteger(expected2.size) || expected2.size < 0 || expected2.size > this.options.maxBytes || typeof expected2.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(expected2.sha256))
|
|
24718
24909
|
throw new CliError("validation_error", "invalid recording publication evidence");
|
|
24719
24910
|
this.options.signal?.throwIfAborted();
|
|
24720
24911
|
}
|
|
24721
|
-
async publish(partialPath,
|
|
24722
|
-
const proof = { ...
|
|
24912
|
+
async publish(partialPath, expected2, commit) {
|
|
24913
|
+
const proof = { ...expected2 };
|
|
24723
24914
|
this.validate(partialPath, proof);
|
|
24724
24915
|
const partial = await verifiedPublicationFile(partialPath, proof, this.options.signal, true);
|
|
24725
24916
|
try {
|
|
@@ -24737,14 +24928,14 @@ var NativeRecordingPublication = class {
|
|
|
24737
24928
|
const intent = await this.read();
|
|
24738
24929
|
if (intent === null)
|
|
24739
24930
|
throw new CliError("validation_error", "recording path already exists without a verified manifest or scoped recovery record");
|
|
24740
|
-
const
|
|
24741
|
-
this.validate(partialPath,
|
|
24931
|
+
const expected2 = { ...this.options.evidence(intent) };
|
|
24932
|
+
this.validate(partialPath, expected2);
|
|
24742
24933
|
const completed = await loadPartial();
|
|
24743
|
-
if (!strongRecordingValidator(
|
|
24934
|
+
if (!strongRecordingValidator(expected2.validator) || !completed || partialIdentity(completed.locator) !== this.scope || completed.offset !== expected2.size || completed.sha256 !== expected2.sha256 || completed.validator !== expected2.validator || completed.total !== null && completed.total !== expected2.size)
|
|
24744
24935
|
throw new CliError("validation_error", "recording recovery checkpoint does not prove this completed asset");
|
|
24745
|
-
const partial = await verifiedPublicationFile(partialPath,
|
|
24936
|
+
const partial = await verifiedPublicationFile(partialPath, expected2, this.options.signal);
|
|
24746
24937
|
try {
|
|
24747
|
-
const final = await verifiedPublicationFile(this.finalPath,
|
|
24938
|
+
const final = await verifiedPublicationFile(this.finalPath, expected2, this.options.signal, true);
|
|
24748
24939
|
try {
|
|
24749
24940
|
await final.sync();
|
|
24750
24941
|
this.options.signal?.throwIfAborted();
|
|
@@ -24759,7 +24950,7 @@ var NativeRecordingPublication = class {
|
|
|
24759
24950
|
}
|
|
24760
24951
|
};
|
|
24761
24952
|
|
|
24762
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24953
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/media-archive-manifest.js
|
|
24763
24954
|
import { createHash as createHash6 } from "node:crypto";
|
|
24764
24955
|
import { readdir } from "node:fs/promises";
|
|
24765
24956
|
import { isAbsolute as isAbsolute2, join as join6, resolve as resolve3 } from "node:path";
|
|
@@ -24846,7 +25037,7 @@ var commitMediaEntry = /* @__PURE__ */ __name((root, one, beforePublish) => writ
|
|
|
24846
25037
|
beforePublish
|
|
24847
25038
|
}), "commitMediaEntry");
|
|
24848
25039
|
|
|
24849
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25040
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
|
|
24850
25041
|
var validator = '"media-completed-v1"';
|
|
24851
25042
|
var maximumFileBytes = 64 * 1024 * 1024 * 1024;
|
|
24852
25043
|
var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file2, beforeWrite, signal, metadata = {}) => {
|
|
@@ -24947,7 +25138,7 @@ var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file2
|
|
|
24947
25138
|
return entry;
|
|
24948
25139
|
}, "archiveMediaFile");
|
|
24949
25140
|
|
|
24950
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25141
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/media-archive-locks.js
|
|
24951
25142
|
import { mkdir, realpath } from "node:fs/promises";
|
|
24952
25143
|
import { join as join7, resolve as resolve4 } from "node:path";
|
|
24953
25144
|
var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
|
|
@@ -25014,7 +25205,7 @@ var withMediaArchiveLocks = /* @__PURE__ */ __name(async (directory2, signal, ru
|
|
|
25014
25205
|
throw new CliError("validation_error", "archive locations changed during locking; run the command again");
|
|
25015
25206
|
}, "withMediaArchiveLocks");
|
|
25016
25207
|
|
|
25017
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25208
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/media-archive.js
|
|
25018
25209
|
var validateMediaSince = /* @__PURE__ */ __name((value, flag = "--since-time") => {
|
|
25019
25210
|
if (value === void 0)
|
|
25020
25211
|
return void 0;
|
|
@@ -25167,7 +25358,7 @@ var archiveMedia = /* @__PURE__ */ __name(async (ports, options) => {
|
|
|
25167
25358
|
}, { create: true });
|
|
25168
25359
|
}, "archiveMedia");
|
|
25169
25360
|
|
|
25170
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25361
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/media-archive-move.js
|
|
25171
25362
|
import { realpath as realpath2, unlink as unlink5 } from "node:fs/promises";
|
|
25172
25363
|
import { basename as basename3, dirname as dirname3, join as join8, resolve as resolve5 } from "node:path";
|
|
25173
25364
|
var canonicalDestination = /* @__PURE__ */ __name(async (directory2) => {
|
|
@@ -25320,7 +25511,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
|
|
|
25320
25511
|
}, { additional: [target2], createAdditional: !options.dryRun });
|
|
25321
25512
|
}, "moveMediaArchive");
|
|
25322
25513
|
|
|
25323
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25514
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/model-downloads.js
|
|
25324
25515
|
var bytesOf = /* @__PURE__ */ __name((model) => model.files.reduce((sum2, file2) => sum2 + file2.bytes, 0), "bytesOf");
|
|
25325
25516
|
var nativeRuntime = /* @__PURE__ */ __name(async ({ env, progress = /* @__PURE__ */ __name(() => {
|
|
25326
25517
|
}, "progress") }) => {
|
|
@@ -25343,7 +25534,7 @@ var downloadTextModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
|
|
|
25343
25534
|
}
|
|
25344
25535
|
await nativeRuntime({ env, progress });
|
|
25345
25536
|
progress(`${model.id}: loading it once to check it works`);
|
|
25346
|
-
const { openEmbedder: openEmbedder2 } = await import("./embed-
|
|
25537
|
+
const { openEmbedder: openEmbedder2 } = await import("./embed-EN4UTLV5.js");
|
|
25347
25538
|
const embedder = await openEmbedder2(model, directory2);
|
|
25348
25539
|
try {
|
|
25349
25540
|
const [vector] = await embedder.embed(["check"], "query");
|
|
@@ -25364,7 +25555,7 @@ var downloadRerankModel = /* @__PURE__ */ __name(async (id2, { env, progress = /
|
|
|
25364
25555
|
}
|
|
25365
25556
|
await nativeRuntime({ env, progress });
|
|
25366
25557
|
progress(`${model.id}: loading it once to check it works`);
|
|
25367
|
-
const { openReranker } = await import("./rerank-
|
|
25558
|
+
const { openReranker } = await import("./rerank-NWFIV7OF.js");
|
|
25368
25559
|
const reranker = await openReranker(model, directory2);
|
|
25369
25560
|
try {
|
|
25370
25561
|
await reranker.score("check", ["check"]);
|
|
@@ -25382,7 +25573,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
|
|
|
25382
25573
|
await installFiles(placedImage(model, directory2), { progress });
|
|
25383
25574
|
}
|
|
25384
25575
|
progress(`${model.id}: loading it once to check it works`);
|
|
25385
|
-
const { openPictureEmbedder } = await import("./embedder-
|
|
25576
|
+
const { openPictureEmbedder } = await import("./embedder-HEKHRL7E.js");
|
|
25386
25577
|
const embedder = await openPictureEmbedder(model, directory2);
|
|
25387
25578
|
try {
|
|
25388
25579
|
const vector = await embedder.embedQuery("check");
|
|
@@ -25394,7 +25585,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
|
|
|
25394
25585
|
return { model, directory: directory2 };
|
|
25395
25586
|
}, "downloadImageModel");
|
|
25396
25587
|
|
|
25397
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25588
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/domain/money-words.js
|
|
25398
25589
|
var MONEY_REQUEST = "money-request";
|
|
25399
25590
|
var MONEY_DONE = "money-done";
|
|
25400
25591
|
var PROMISE = "promise";
|
|
@@ -25428,10 +25619,10 @@ var MONEY_WORDS = [
|
|
|
25428
25619
|
}
|
|
25429
25620
|
];
|
|
25430
25621
|
|
|
25431
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25622
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/money-words.js
|
|
25432
25623
|
var moneyClassesOf = /* @__PURE__ */ __name((text2) => listsHit(text2, MONEY_WORDS), "moneyClassesOf");
|
|
25433
25624
|
|
|
25434
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25625
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/domain/status-words.js
|
|
25435
25626
|
var words = /* @__PURE__ */ __name((forms) => new RegExp(`(?<![\\p{L}\\p{N}])(?:${forms.join("|")})(?![\\p{L}\\p{N}])`, "iu"), "words");
|
|
25436
25627
|
var MONEY_DONE_FORMS = words([
|
|
25437
25628
|
"\u043E\u043F\u043B\u0430\u0442\u0438\u043B[\u0430\u0438]?",
|
|
@@ -25471,7 +25662,7 @@ var PROMISE_FORMS = words([
|
|
|
25471
25662
|
"estar\xE1 listo"
|
|
25472
25663
|
]);
|
|
25473
25664
|
|
|
25474
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25665
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-status/items.js
|
|
25475
25666
|
var EXCERPT_CHARS = 80;
|
|
25476
25667
|
var excerpt2 = /* @__PURE__ */ __name((text2) => {
|
|
25477
25668
|
const flat = text2.replace(/\s+/g, " ").trim();
|
|
@@ -25493,7 +25684,7 @@ var whoOf = /* @__PURE__ */ __name((message) => ({
|
|
|
25493
25684
|
var fromOwner = /* @__PURE__ */ __name((message) => message.outgoing === true, "fromOwner");
|
|
25494
25685
|
var day = /* @__PURE__ */ __name((at) => new Date(at).toISOString().slice(0, 10), "day");
|
|
25495
25686
|
|
|
25496
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25687
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-status/signals/amounts.js
|
|
25497
25688
|
var MONEY = DEFAULT_TASK_CATEGORIES.filter((category) => category.name === "money");
|
|
25498
25689
|
var verbOf = /* @__PURE__ */ __name((text2) => {
|
|
25499
25690
|
if (MONEY_DONE_FORMS.test(text2))
|
|
@@ -25570,16 +25761,16 @@ var amounts = {
|
|
|
25570
25761
|
};
|
|
25571
25762
|
});
|
|
25572
25763
|
}, "read"),
|
|
25573
|
-
attention: /* @__PURE__ */ __name((items) => items.flatMap((
|
|
25764
|
+
attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.state === "open" ? [{ chat: item2.chat, weight: 2, why: "money open" }] : []), "attention")
|
|
25574
25765
|
};
|
|
25575
25766
|
|
|
25576
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25767
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-status/signals/children.js
|
|
25577
25768
|
var children = {
|
|
25578
25769
|
id: "children",
|
|
25579
25770
|
version: 1,
|
|
25580
25771
|
scope: "project",
|
|
25581
25772
|
read: /* @__PURE__ */ __name(async (context2) => {
|
|
25582
|
-
const
|
|
25773
|
+
const item2 = /* @__PURE__ */ __name((data) => ({
|
|
25583
25774
|
signal: "children",
|
|
25584
25775
|
chat: null,
|
|
25585
25776
|
at: null,
|
|
@@ -25589,7 +25780,7 @@ var children = {
|
|
|
25589
25780
|
data
|
|
25590
25781
|
}), "item");
|
|
25591
25782
|
return [
|
|
25592
|
-
...context2.project.children.map((child) =>
|
|
25783
|
+
...context2.project.children.map((child) => item2({
|
|
25593
25784
|
child: child.ref,
|
|
25594
25785
|
key: child.key,
|
|
25595
25786
|
name: child.name,
|
|
@@ -25597,12 +25788,12 @@ var children = {
|
|
|
25597
25788
|
chats: context2.chats.filter((chat) => chat.project === child.ref).length,
|
|
25598
25789
|
cut: null
|
|
25599
25790
|
})),
|
|
25600
|
-
...context2.project.cut.map(({ ref, reason }) =>
|
|
25791
|
+
...context2.project.cut.map(({ ref, reason }) => item2({ child: ref, key: null, name: null, depth: null, chats: null, cut: reason }))
|
|
25601
25792
|
];
|
|
25602
25793
|
}, "read")
|
|
25603
25794
|
};
|
|
25604
25795
|
|
|
25605
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25796
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-status/signals/coverage.js
|
|
25606
25797
|
var coverage = {
|
|
25607
25798
|
id: "coverage",
|
|
25608
25799
|
version: 1,
|
|
@@ -25628,10 +25819,10 @@ var coverage = {
|
|
|
25628
25819
|
}
|
|
25629
25820
|
];
|
|
25630
25821
|
}, "read"),
|
|
25631
|
-
attention: /* @__PURE__ */ __name((items) => items.flatMap((
|
|
25822
|
+
attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.state !== "complete" && item2.data.beforeHeld ? [{ chat: item2.chat, weight: 3, why: "held in part" }] : []), "attention")
|
|
25632
25823
|
};
|
|
25633
25824
|
|
|
25634
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25825
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-status/signals/last-message.js
|
|
25635
25826
|
var lastMessage = {
|
|
25636
25827
|
id: "last-message",
|
|
25637
25828
|
version: 1,
|
|
@@ -25640,7 +25831,7 @@ var lastMessage = {
|
|
|
25640
25831
|
const last = chat?.messages.at(-1);
|
|
25641
25832
|
if (!chat || !last)
|
|
25642
25833
|
return [];
|
|
25643
|
-
const
|
|
25834
|
+
const item2 = {
|
|
25644
25835
|
signal: "last-message",
|
|
25645
25836
|
chat: chat.ref,
|
|
25646
25837
|
at: last.timestamp,
|
|
@@ -25649,33 +25840,61 @@ var lastMessage = {
|
|
|
25649
25840
|
basis: "store",
|
|
25650
25841
|
data: {}
|
|
25651
25842
|
};
|
|
25652
|
-
return [
|
|
25843
|
+
return [item2];
|
|
25653
25844
|
}, "read")
|
|
25654
25845
|
};
|
|
25655
25846
|
|
|
25656
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25657
|
-
var
|
|
25847
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-status/signals/payments.js
|
|
25848
|
+
var holding = /* @__PURE__ */ __name((row) => row.review !== "rejected", "holding");
|
|
25849
|
+
var item = /* @__PURE__ */ __name((row, at, data) => ({
|
|
25850
|
+
signal: "payments",
|
|
25851
|
+
chat: null,
|
|
25852
|
+
at,
|
|
25853
|
+
who: null,
|
|
25854
|
+
// The row first, then what it cites, so an amount read from a cited message is not counted twice.
|
|
25855
|
+
evidence: [row.ref, ...row.evidence].map((ref) => ({ ref, fingerprint: null })),
|
|
25856
|
+
basis: "store",
|
|
25857
|
+
data: { ...data, title: row.title, status: row.review }
|
|
25858
|
+
}), "item");
|
|
25859
|
+
var paid = /* @__PURE__ */ __name((row) => {
|
|
25860
|
+
const party = row.direction === "in" ? row.payer : row.payee;
|
|
25861
|
+
return item(row, `${row.date}T00:00:00.000Z`, {
|
|
25862
|
+
amount: row.amount,
|
|
25863
|
+
currency: row.currency,
|
|
25864
|
+
direction: row.direction === "in" ? "to_us" : "from_us",
|
|
25865
|
+
counterparty: party?.ref ?? null,
|
|
25866
|
+
counterparty_name: party?.name ?? null,
|
|
25867
|
+
due_at: null,
|
|
25868
|
+
state: "paid",
|
|
25869
|
+
item: row.reference,
|
|
25870
|
+
paid_at: row.date
|
|
25871
|
+
});
|
|
25872
|
+
}, "paid");
|
|
25873
|
+
var expected = /* @__PURE__ */ __name((row) => item(row, row.issueDate === null ? row.createdAt : `${row.issueDate}T00:00:00.000Z`, {
|
|
25874
|
+
amount: row.open,
|
|
25875
|
+
currency: row.currency,
|
|
25876
|
+
direction: row.direction === "receivable" ? "to_us" : "from_us",
|
|
25877
|
+
counterparty: row.counterparty.ref,
|
|
25878
|
+
counterparty_name: row.counterparty.name,
|
|
25879
|
+
due_at: row.dueDate,
|
|
25880
|
+
state: "expected",
|
|
25881
|
+
item: row.number
|
|
25882
|
+
}), "expected");
|
|
25658
25883
|
var payments = {
|
|
25659
25884
|
id: "payments",
|
|
25660
|
-
version:
|
|
25885
|
+
version: 3,
|
|
25661
25886
|
scope: "project",
|
|
25662
25887
|
read: /* @__PURE__ */ __name(async (context2) => {
|
|
25663
25888
|
const projects = [context2.project.ref, ...context2.project.children.map((child) => child.ref)];
|
|
25664
|
-
const
|
|
25665
|
-
|
|
25666
|
-
|
|
25667
|
-
|
|
25668
|
-
|
|
25669
|
-
who: null,
|
|
25670
|
-
// The fact first, then what it cites, so an amount read from a cited message is not counted twice.
|
|
25671
|
-
evidence: [fact.ref, ...fact.evidence].map((ref) => ({ ref, fingerprint: null })),
|
|
25672
|
-
basis: "fact",
|
|
25673
|
-
data: { ...fact.payment, title: paymentTitle(fact), status: fact.status }
|
|
25674
|
-
}));
|
|
25889
|
+
const rows = await Promise.all(projects.map(async (project) => [
|
|
25890
|
+
...(await context2.store.finance.payments({ project, limit: 500 })).filter(holding).map(paid),
|
|
25891
|
+
...(await context2.store.finance.invoices({ project, open: true, limit: 500 })).filter(holding).map(expected)
|
|
25892
|
+
]));
|
|
25893
|
+
return rows.flat();
|
|
25675
25894
|
}, "read")
|
|
25676
25895
|
};
|
|
25677
25896
|
|
|
25678
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25897
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-status/signals/promises.js
|
|
25679
25898
|
var PATTERNS_PER_CHAT = 3;
|
|
25680
25899
|
var DAY3 = 864e5;
|
|
25681
25900
|
var KINDS2 = /* @__PURE__ */ new Set(["promise", "request"]);
|
|
@@ -25764,7 +25983,7 @@ var promises = {
|
|
|
25764
25983
|
}, "read")
|
|
25765
25984
|
};
|
|
25766
25985
|
|
|
25767
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25986
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-status/signals/questions.js
|
|
25768
25987
|
var PER_SIDE = 5;
|
|
25769
25988
|
var WEEK = 7 * 864e5;
|
|
25770
25989
|
var NOBODY = /* @__PURE__ */ new Set();
|
|
@@ -25790,12 +26009,12 @@ var questions2 = {
|
|
|
25790
26009
|
})));
|
|
25791
26010
|
}, "read"),
|
|
25792
26011
|
attention: /* @__PURE__ */ __name((items, context2) => {
|
|
25793
|
-
const stale = new Set(items.flatMap((
|
|
26012
|
+
const stale = new Set(items.flatMap((item2) => item2.chat !== null && item2.data.side === "yours" && item2.at && context2.now - Date.parse(item2.at) > WEEK ? [item2.chat] : []));
|
|
25794
26013
|
return [...stale].map((chat) => ({ chat, weight: 1, why: "your question unanswered for a week" }));
|
|
25795
26014
|
}, "attention")
|
|
25796
26015
|
};
|
|
25797
26016
|
|
|
25798
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26017
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-status/signals/reply-next.js
|
|
25799
26018
|
var targetOf = /* @__PURE__ */ __name((message, chat, owners) => {
|
|
25800
26019
|
const byId2 = /* @__PURE__ */ __name((id2) => chat.messages.find((one) => one.id === id2), "byId");
|
|
25801
26020
|
const quoted = message.replyTo ?? (message.replyToId === void 0 ? void 0 : byId2(message.replyToId));
|
|
@@ -25860,10 +26079,10 @@ var replyNext = {
|
|
|
25860
26079
|
}
|
|
25861
26080
|
];
|
|
25862
26081
|
}, "read"),
|
|
25863
|
-
attention: /* @__PURE__ */ __name((items) => items.flatMap((
|
|
26082
|
+
attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.next === "owner" ? [{ chat: item2.chat, weight: 2, why: "your move" }] : []), "attention")
|
|
25864
26083
|
};
|
|
25865
26084
|
|
|
25866
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26085
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-status/signals/topics.js
|
|
25867
26086
|
var escaped = /* @__PURE__ */ __name((text2) => text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
|
|
25868
26087
|
var wholeWord = /* @__PURE__ */ __name((word) => new RegExp(`(?<![\\p{L}\\p{N}])${escaped(word)}(?![\\p{L}\\p{N}])`, "u"), "wholeWord");
|
|
25869
26088
|
var matcherOf = /* @__PURE__ */ __name((query) => {
|
|
@@ -25909,7 +26128,7 @@ var topics = {
|
|
|
25909
26128
|
}, "read")
|
|
25910
26129
|
};
|
|
25911
26130
|
|
|
25912
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26131
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-status/signals/index.js
|
|
25913
26132
|
var STATUS_SIGNALS = [
|
|
25914
26133
|
lastMessage,
|
|
25915
26134
|
replyNext,
|
|
@@ -25922,7 +26141,7 @@ var STATUS_SIGNALS = [
|
|
|
25922
26141
|
children
|
|
25923
26142
|
];
|
|
25924
26143
|
|
|
25925
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26144
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/project-status/index.js
|
|
25926
26145
|
var DAY4 = 864e5;
|
|
25927
26146
|
var STATUS_WINDOW = 300;
|
|
25928
26147
|
var STATUS_CHATS = 16;
|
|
@@ -25968,15 +26187,16 @@ var childrenOf = /* @__PURE__ */ __name(async (store, root, catalog) => {
|
|
|
25968
26187
|
var inAccounts = /* @__PURE__ */ __name((accounts, provider, account) => accounts === void 0 || accounts.some((one) => one.provider === provider && one.account === account), "inAccounts");
|
|
25969
26188
|
var failure = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "failure");
|
|
25970
26189
|
var counted2 = /* @__PURE__ */ __name((items) => {
|
|
25971
|
-
const
|
|
25972
|
-
|
|
26190
|
+
const confirmed = /* @__PURE__ */ __name((item2) => item2.signal === "payments" && item2.data.status === "confirmed", "confirmed");
|
|
26191
|
+
const recorded = new Set(items.filter(confirmed).flatMap((item2) => item2.evidence.slice(1).map((one) => one.ref)));
|
|
26192
|
+
return (item2, state) => item2.signal === "payments" ? state === "expected" && confirmed(item2) : item2.signal === "amounts" && state === "open" && !item2.evidence.some((one) => recorded.has(one.ref));
|
|
25973
26193
|
}, "counted");
|
|
25974
26194
|
var totalsOf = /* @__PURE__ */ __name((items) => {
|
|
25975
26195
|
const totals = /* @__PURE__ */ new Map();
|
|
25976
26196
|
const open7 = counted2(items);
|
|
25977
|
-
for (const
|
|
25978
|
-
const data =
|
|
25979
|
-
if (!open7(
|
|
26197
|
+
for (const item2 of items) {
|
|
26198
|
+
const data = item2.data;
|
|
26199
|
+
if (!open7(item2, data.state) || data.amount === void 0)
|
|
25980
26200
|
continue;
|
|
25981
26201
|
const key = `${data.direction}|${data.currency ?? ""}`;
|
|
25982
26202
|
const total = totals.get(key) ?? {
|
|
@@ -26103,7 +26323,7 @@ var projectStatus = /* @__PURE__ */ __name(async (store, input) => {
|
|
|
26103
26323
|
};
|
|
26104
26324
|
}, "projectStatus");
|
|
26105
26325
|
|
|
26106
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26326
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/account.js
|
|
26107
26327
|
var accountService = /* @__PURE__ */ __name((deps) => {
|
|
26108
26328
|
const online = /* @__PURE__ */ __name(async (command) => {
|
|
26109
26329
|
if (deps.offline)
|
|
@@ -26175,7 +26395,7 @@ var accountService = /* @__PURE__ */ __name((deps) => {
|
|
|
26175
26395
|
};
|
|
26176
26396
|
}, "accountService");
|
|
26177
26397
|
|
|
26178
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26398
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/domain/send-time.js
|
|
26179
26399
|
var MINUTE = 6e4;
|
|
26180
26400
|
var YEAR = 365 * 24 * 60 * MINUTE;
|
|
26181
26401
|
var DELAY = /^(\d+)(m|h|d)$/;
|
|
@@ -26194,7 +26414,7 @@ var sendTime = /* @__PURE__ */ __name((value, now = Date.now(), flag = "--at-tim
|
|
|
26194
26414
|
return new Date(at - at % MINUTE).toISOString();
|
|
26195
26415
|
}, "sendTime");
|
|
26196
26416
|
|
|
26197
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26417
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/admin.js
|
|
26198
26418
|
var recordMembership = /* @__PURE__ */ __name(async (deps, operationId, done2, change, fix, write) => {
|
|
26199
26419
|
try {
|
|
26200
26420
|
const held = await accountStoreIfOpen(deps);
|
|
@@ -26441,7 +26661,7 @@ var linkLimits = /* @__PURE__ */ __name(({ approval, expires, maxUses }) => {
|
|
|
26441
26661
|
return expires === void 0 ? void 0 : sendTime(expires, Date.now(), "--expire-time");
|
|
26442
26662
|
}, "linkLimits");
|
|
26443
26663
|
|
|
26444
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26664
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/mail-search.js
|
|
26445
26665
|
var THREADS_PAGE = 500;
|
|
26446
26666
|
var threadsOf = /* @__PURE__ */ __name(async (store, key) => {
|
|
26447
26667
|
const account = await store.accounts.storedAccount(key).catch(() => void 0);
|
|
@@ -26520,7 +26740,7 @@ var readMail = /* @__PURE__ */ __name(async (store, locator, { before: before2 =
|
|
|
26520
26740
|
return thread.slice(Math.max(0, at - before2), at + after + 1).map((hit) => hit.id === message ? { ...hit, anchor: true } : hit);
|
|
26521
26741
|
}, "readMail");
|
|
26522
26742
|
|
|
26523
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26743
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/search-kind.js
|
|
26524
26744
|
var NO_MAIL = "no_mail";
|
|
26525
26745
|
var MAIL = "email";
|
|
26526
26746
|
var listContextOf = /* @__PURE__ */ __name(async (store, account, app, stored) => {
|
|
@@ -26567,7 +26787,7 @@ var accountsOfKind = /* @__PURE__ */ __name((kind, chosen, held, explicit, comma
|
|
|
26567
26787
|
return chosenMail.map(({ provider, account }) => ({ provider, account }));
|
|
26568
26788
|
}, "accountsOfKind");
|
|
26569
26789
|
|
|
26570
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26790
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/messages-search.js
|
|
26571
26791
|
var MAIL_FIELDS = /* @__PURE__ */ new Set(["to", "cc", "bcc", "subject", "mailbox", "label", "is"]);
|
|
26572
26792
|
var positiveSources = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "in" ? [node.value.toLowerCase()] : [] : node.clauses.filter(({ occur }) => occur !== "must_not").flatMap(({ node: node2 }) => positiveSources(node2)), "positiveSources");
|
|
26573
26793
|
var prepareLucene = /* @__PURE__ */ __name(async (store, account, request, messenger) => {
|
|
@@ -26826,9 +27046,9 @@ var searchLucene = /* @__PURE__ */ __name(async (store, account, request, messen
|
|
|
26826
27046
|
}, "inMailTables");
|
|
26827
27047
|
const found = !prepared.scopeAccounts.length ? { items: [], hasMore: false } : mailAccounts.length ? mergeMail(await execute(prepared.execution), await inMailTables(), request.limit, request.newest) : await execute(prepared.execution);
|
|
26828
27048
|
const { completeness, coverage: coverage2 } = request.kind === "mail" ? { completeness: [], coverage: void 0 } : await coverageOf(store, prepared, messenger);
|
|
26829
|
-
const items = await Promise.all(found.items.map(async (
|
|
26830
|
-
const garbled =
|
|
26831
|
-
const hit = withExcerpt(
|
|
27049
|
+
const items = await Promise.all(found.items.map(async (item2) => {
|
|
27050
|
+
const garbled = item2.corrections?.flatMap(({ to }) => to) ?? [];
|
|
27051
|
+
const hit = withExcerpt(item2, [request.text ?? "", ...garbled].join(" "));
|
|
26832
27052
|
if (!request.context)
|
|
26833
27053
|
return hit;
|
|
26834
27054
|
const locator = parseLocator(hit.locator);
|
|
@@ -26915,7 +27135,7 @@ var statsLucene = /* @__PURE__ */ __name(async (store, account, request, messeng
|
|
|
26915
27135
|
};
|
|
26916
27136
|
}, "statsLucene");
|
|
26917
27137
|
|
|
26918
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27138
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
|
|
26919
27139
|
var RANKING_SELECTION_BYTES = 64 * 1024;
|
|
26920
27140
|
var object = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0, "object");
|
|
26921
27141
|
function invalid3(message = "ranking selection is invalid \u2014 obtain a new drilldown from stats top") {
|
|
@@ -27084,7 +27304,7 @@ var readRankingSelection = /* @__PURE__ */ __name(async (store, input) => {
|
|
|
27084
27304
|
};
|
|
27085
27305
|
}, "readRankingSelection");
|
|
27086
27306
|
|
|
27087
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27307
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/search-record.js
|
|
27088
27308
|
var canonical = /* @__PURE__ */ __name((value, nested = false) => Array.isArray(value) ? value.map((one) => canonical(one, true)) : value !== null && typeof value === "object" ? Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0 && (nested || one !== false)).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, one]) => [key, canonical(one, true)])) : value, "canonical");
|
|
27089
27309
|
var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
|
|
27090
27310
|
command,
|
|
@@ -27094,7 +27314,7 @@ var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
|
|
|
27094
27314
|
fieldsVersion: FIELD_VERSION
|
|
27095
27315
|
}), "searchRecordOf");
|
|
27096
27316
|
|
|
27097
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27317
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
|
|
27098
27318
|
function invalid4(message) {
|
|
27099
27319
|
throw new CliError("validation_error", message);
|
|
27100
27320
|
}
|
|
@@ -27388,7 +27608,7 @@ var adminStatisticsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
27388
27608
|
}, "evidence")
|
|
27389
27609
|
}), "adminStatisticsService");
|
|
27390
27610
|
|
|
27391
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27611
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
|
|
27392
27612
|
import { createHash as createHash7, randomUUID as randomUUID4 } from "node:crypto";
|
|
27393
27613
|
var GAP_BOUNDS = { maxGaps: 5, limit: 500, timeMs: 3e4 };
|
|
27394
27614
|
var validateRepair = /* @__PURE__ */ __name((messenger, options) => {
|
|
@@ -27525,12 +27745,12 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
|
|
|
27525
27745
|
return { plan, repair };
|
|
27526
27746
|
}, "gapsService");
|
|
27527
27747
|
|
|
27528
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27748
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/attachments.js
|
|
27529
27749
|
import { createHash as createHash9 } from "node:crypto";
|
|
27530
27750
|
import { constants as constants2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
27531
27751
|
import { lstat as lstat4, open as open6, readFile, stat as stat2 } from "node:fs/promises";
|
|
27532
27752
|
|
|
27533
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27753
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/attachments/directory.js
|
|
27534
27754
|
import { lstat as lstat2, readdir as readdir2, realpath as realpath3 } from "node:fs/promises";
|
|
27535
27755
|
import { basename as basename4, join as join9, relative as relative2, sep as sep2 } from "node:path";
|
|
27536
27756
|
var MAX_FILES = 1e4;
|
|
@@ -27601,15 +27821,15 @@ var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app,
|
|
|
27601
27821
|
return choices;
|
|
27602
27822
|
}, "directoryPaths");
|
|
27603
27823
|
|
|
27604
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27824
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/attachments/documents.js
|
|
27605
27825
|
import { posix } from "node:path";
|
|
27606
27826
|
|
|
27607
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27827
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/attachments/container.js
|
|
27608
27828
|
import { setImmediate as tick } from "node:timers/promises";
|
|
27609
27829
|
import { crc32 } from "node:zlib";
|
|
27610
27830
|
var import_xmldom = __toESM(require_lib(), 1);
|
|
27611
27831
|
|
|
27612
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27832
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/attachments/encoding.js
|
|
27613
27833
|
var import_chardet = __toESM(require_lib2(), 1);
|
|
27614
27834
|
var import_iconv_lite = __toESM(require_lib3(), 1);
|
|
27615
27835
|
var SAMPLE = 65536;
|
|
@@ -27711,7 +27931,7 @@ var decodeXml = /* @__PURE__ */ __name((bytes2) => {
|
|
|
27711
27931
|
return result.text;
|
|
27712
27932
|
}, "decodeXml");
|
|
27713
27933
|
|
|
27714
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27934
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/attachments/container.js
|
|
27715
27935
|
var MAX_PART = 10 * 1024 * 1024;
|
|
27716
27936
|
var MAX_ENTRIES = 1e3;
|
|
27717
27937
|
var decoder = new TextDecoder("utf-8", { fatal: true });
|
|
@@ -27790,8 +28010,8 @@ var readContainer = /* @__PURE__ */ __name(async (bytes2, signal) => {
|
|
|
27790
28010
|
const done2 = /* @__PURE__ */ new Set();
|
|
27791
28011
|
let expanded = 0;
|
|
27792
28012
|
const archive = new Unzip((file2) => {
|
|
27793
|
-
const
|
|
27794
|
-
if (!
|
|
28013
|
+
const expected2 = entries.get(file2.name);
|
|
28014
|
+
if (!expected2 || seen.has(file2.name))
|
|
27795
28015
|
throw new Error("invalid_zip");
|
|
27796
28016
|
seen.add(file2.name);
|
|
27797
28017
|
const keep2 = /\.(xml|rels|opf|xhtml|html)$/i.test(file2.name) || file2.name === "mimetype";
|
|
@@ -27809,7 +28029,7 @@ var readContainer = /* @__PURE__ */ __name(async (bytes2, signal) => {
|
|
|
27809
28029
|
if (keep2)
|
|
27810
28030
|
parts.push(data.slice());
|
|
27811
28031
|
if (final) {
|
|
27812
|
-
if (size2 !==
|
|
28032
|
+
if (size2 !== expected2.size || checksum !== expected2.crc)
|
|
27813
28033
|
throw new Error("invalid_zip");
|
|
27814
28034
|
done2.add(file2.name);
|
|
27815
28035
|
if (keep2) {
|
|
@@ -27926,7 +28146,7 @@ var elements = /* @__PURE__ */ __name((node, name, namespace) => {
|
|
|
27926
28146
|
return found;
|
|
27927
28147
|
}, "elements");
|
|
27928
28148
|
|
|
27929
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28149
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/attachments/sheets.js
|
|
27930
28150
|
var columnName = /* @__PURE__ */ __name((column) => {
|
|
27931
28151
|
let name = "";
|
|
27932
28152
|
for (let rest = column; rest > 0; rest = Math.floor((rest - 1) / 26))
|
|
@@ -27981,7 +28201,7 @@ var sheetText = /* @__PURE__ */ __name((sheets2, maxChars = MAX_TEXT_CHARS) => {
|
|
|
27981
28201
|
return { text: parts.join("").trim(), truncated: false };
|
|
27982
28202
|
}, "sheetText");
|
|
27983
28203
|
|
|
27984
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28204
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/attachments/documents.js
|
|
27985
28205
|
var OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
|
|
27986
28206
|
var TEXT = "urn:oasis:names:tc:opendocument:xmlns:text:1.0";
|
|
27987
28207
|
var TABLE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0";
|
|
@@ -28317,21 +28537,21 @@ var readBook = /* @__PURE__ */ __name((archive, output) => {
|
|
|
28317
28537
|
const book = xmlPart(archive, path);
|
|
28318
28538
|
rootIs(book, "package", [OPF]);
|
|
28319
28539
|
const manifest = /* @__PURE__ */ new Map();
|
|
28320
|
-
for (const
|
|
28321
|
-
const id2 = required(attribute(
|
|
28540
|
+
for (const item2 of elements(book, "item", OPF)) {
|
|
28541
|
+
const id2 = required(attribute(item2, "id"));
|
|
28322
28542
|
if (manifest.has(id2))
|
|
28323
28543
|
throw new Error("duplicate_chapter");
|
|
28324
|
-
manifest.set(id2, { path: target(path, required(attribute(
|
|
28544
|
+
manifest.set(id2, { path: target(path, required(attribute(item2, "href"))), type: attribute(item2, "media-type") });
|
|
28325
28545
|
}
|
|
28326
28546
|
let number2 = 0;
|
|
28327
28547
|
const chapters = elements(book, "itemref", OPF);
|
|
28328
28548
|
if (!chapters.length)
|
|
28329
28549
|
throw new Error("missing_chapters");
|
|
28330
28550
|
for (const chapter of chapters) {
|
|
28331
|
-
const
|
|
28332
|
-
if (
|
|
28551
|
+
const item2 = manifest.get(required(attribute(chapter, "idref")));
|
|
28552
|
+
if (item2?.type !== "application/xhtml+xml")
|
|
28333
28553
|
throw new Error("unsupported_chapter");
|
|
28334
|
-
const document = xmlPart(archive,
|
|
28554
|
+
const document = xmlPart(archive, item2.path);
|
|
28335
28555
|
const bodies = elements(document, "body", XHTML);
|
|
28336
28556
|
if (bodies.length !== 1)
|
|
28337
28557
|
throw new Error("missing_chapter");
|
|
@@ -28381,10 +28601,10 @@ var readDocument = /* @__PURE__ */ __name(async (bytes2, kind, signal) => {
|
|
|
28381
28601
|
}
|
|
28382
28602
|
}, "readDocument");
|
|
28383
28603
|
|
|
28384
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28604
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/attachments/extract.js
|
|
28385
28605
|
import { extname as extname3 } from "node:path";
|
|
28386
28606
|
|
|
28387
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28607
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/readers/engine.js
|
|
28388
28608
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
28389
28609
|
import { dirname as dirname4, extname as extname2, join as join10 } from "node:path";
|
|
28390
28610
|
import { fileURLToPath } from "node:url";
|
|
@@ -28445,7 +28665,7 @@ var derived = /* @__PURE__ */ __name((bytes2, extractor, read) => {
|
|
|
28445
28665
|
}
|
|
28446
28666
|
}, "derived");
|
|
28447
28667
|
|
|
28448
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28668
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/readers/image/index.js
|
|
28449
28669
|
var IMAGES = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp", ".gif", ".heic", ".tif", ".tiff", ".bmp"]);
|
|
28450
28670
|
var image2 = {
|
|
28451
28671
|
id: "image",
|
|
@@ -28454,7 +28674,7 @@ var image2 = {
|
|
|
28454
28674
|
read: /* @__PURE__ */ __name(async () => ({ status: "needs-agent" }), "read")
|
|
28455
28675
|
};
|
|
28456
28676
|
|
|
28457
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28677
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/readers/doc/index.js
|
|
28458
28678
|
var OLE = "\xD0\xCF\xE0\xA1\xB1\xE1";
|
|
28459
28679
|
var doc = {
|
|
28460
28680
|
id: "doc",
|
|
@@ -28466,7 +28686,7 @@ var doc = {
|
|
|
28466
28686
|
}), "read")
|
|
28467
28687
|
};
|
|
28468
28688
|
|
|
28469
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28689
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/readers/docx/index.js
|
|
28470
28690
|
var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
28471
28691
|
var docx = {
|
|
28472
28692
|
id: "docx",
|
|
@@ -28479,7 +28699,7 @@ var docx = {
|
|
|
28479
28699
|
}), "read")
|
|
28480
28700
|
};
|
|
28481
28701
|
|
|
28482
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28702
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/attachments/markup.js
|
|
28483
28703
|
var import_iconv_lite2 = __toESM(require_lib3(), 1);
|
|
28484
28704
|
var RTF_SKIPPED = /* @__PURE__ */ new Set([
|
|
28485
28705
|
"fonttbl",
|
|
@@ -28655,7 +28875,7 @@ var htmlText = /* @__PURE__ */ __name((source) => {
|
|
|
28655
28875
|
}, "htmlText");
|
|
28656
28876
|
var safeChar = /* @__PURE__ */ __name((code, fallback) => code > 0 && code <= 1114111 ? String.fromCodePoint(code) : fallback, "safeChar");
|
|
28657
28877
|
|
|
28658
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28878
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/readers/html/page.js
|
|
28659
28879
|
var clean = /* @__PURE__ */ __name((value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "", "clean");
|
|
28660
28880
|
var namesIn = /* @__PURE__ */ __name((value) => [value].flat().map((entry) => typeof entry === "string" ? clean(entry) : clean(entry?.name)).filter(Boolean).join(", "), "namesIn");
|
|
28661
28881
|
var jsonLdNodes = /* @__PURE__ */ __name((document) => {
|
|
@@ -28711,7 +28931,7 @@ var markdownSections = /* @__PURE__ */ __name((text2) => {
|
|
|
28711
28931
|
return found.map((section, index) => ({ ...section, end: found[index + 1]?.start ?? text2.length }));
|
|
28712
28932
|
}, "markdownSections");
|
|
28713
28933
|
|
|
28714
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28934
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/readers/html/index.js
|
|
28715
28935
|
var HTML = /* @__PURE__ */ new Set([".html", ".htm", ".xhtml"]);
|
|
28716
28936
|
var first = /* @__PURE__ */ __name((...values) => values.find((value) => typeof value === "string" && value !== ""), "first");
|
|
28717
28937
|
var loaded = /* @__PURE__ */ __name(async (load, name) => {
|
|
@@ -28782,7 +29002,7 @@ var html = {
|
|
|
28782
29002
|
}, "read")
|
|
28783
29003
|
};
|
|
28784
29004
|
|
|
28785
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29005
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/readers/office/index.js
|
|
28786
29006
|
var office = {
|
|
28787
29007
|
id: "office",
|
|
28788
29008
|
version: documentExtractor("odt"),
|
|
@@ -28793,7 +29013,7 @@ var office = {
|
|
|
28793
29013
|
}, "read")
|
|
28794
29014
|
};
|
|
28795
29015
|
|
|
28796
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29016
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/readers/pdf/index.js
|
|
28797
29017
|
var pdf = {
|
|
28798
29018
|
id: "pdf",
|
|
28799
29019
|
version: "unpdf",
|
|
@@ -28860,7 +29080,7 @@ var pdf = {
|
|
|
28860
29080
|
}), "read")
|
|
28861
29081
|
};
|
|
28862
29082
|
|
|
28863
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29083
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/readers/plain/index.js
|
|
28864
29084
|
var PLAIN = /* @__PURE__ */ new Set([".txt", ".md", ".markdown", ".csv", ".tsv", ".json", ".log"]);
|
|
28865
29085
|
var isPlain = /* @__PURE__ */ __name((hint) => PLAIN.has(extensionOf(hint)) || hint.mime?.startsWith("text/") || hint.mime === "application/json", "isPlain");
|
|
28866
29086
|
var readPlain = /* @__PURE__ */ __name((bytes2) => {
|
|
@@ -28880,7 +29100,7 @@ var plain = {
|
|
|
28880
29100
|
read: /* @__PURE__ */ __name(async (bytes2) => readPlain(bytes2), "read")
|
|
28881
29101
|
};
|
|
28882
29102
|
|
|
28883
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29103
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/readers/rtf/index.js
|
|
28884
29104
|
var rtf = {
|
|
28885
29105
|
id: "rtf",
|
|
28886
29106
|
version: "v1",
|
|
@@ -28888,10 +29108,10 @@ var rtf = {
|
|
|
28888
29108
|
read: /* @__PURE__ */ __name(async (bytes2) => derived(bytes2, "rtf:v1", rtfText), "read")
|
|
28889
29109
|
};
|
|
28890
29110
|
|
|
28891
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29111
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
|
|
28892
29112
|
import { basename as basename5 } from "node:path";
|
|
28893
29113
|
|
|
28894
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29114
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/attachments/csv-spans.js
|
|
28895
29115
|
var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) => {
|
|
28896
29116
|
const cells = [];
|
|
28897
29117
|
let row = 1, column = 1, start = 0, quoted = false, truncated = false;
|
|
@@ -28929,7 +29149,7 @@ var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) =
|
|
|
28929
29149
|
return { cells, truncated };
|
|
28930
29150
|
}, "delimitedSpans");
|
|
28931
29151
|
|
|
28932
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29152
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
|
|
28933
29153
|
var DELIMITED = {
|
|
28934
29154
|
".csv": ",",
|
|
28935
29155
|
".tsv": " ",
|
|
@@ -28968,7 +29188,7 @@ var sheets = {
|
|
|
28968
29188
|
}, "read")
|
|
28969
29189
|
};
|
|
28970
29190
|
|
|
28971
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29191
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/readers/registry.js
|
|
28972
29192
|
var BUILT_INS2 = [office, pdf, docx, doc, rtf, html, sheets, plain, image2];
|
|
28973
29193
|
var HEAD_BYTES = 1024;
|
|
28974
29194
|
var readers = [...BUILT_INS2];
|
|
@@ -28978,7 +29198,7 @@ var readWithRegistry = /* @__PURE__ */ __name(async (bytes2, hint, context2) =>
|
|
|
28978
29198
|
return reader ? reader.read(bytes2, hint, context2) : { status: "unsupported" };
|
|
28979
29199
|
}, "readWithRegistry");
|
|
28980
29200
|
|
|
28981
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29201
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/attachments/extract.js
|
|
28982
29202
|
var importEngine = /* @__PURE__ */ __name((name) => importFrom(new URL("attachments/extract.js", import.meta.resolve("@wirecat/cli-core")).href, name), "importEngine");
|
|
28983
29203
|
var extensionOf2 = /* @__PURE__ */ __name(({ name, path }) => extname3(name ?? path).toLowerCase(), "extensionOf");
|
|
28984
29204
|
var extractText = /* @__PURE__ */ __name(async (bytes2, hint, load, signal, env = process.env) => {
|
|
@@ -30057,7 +30277,7 @@ function imageSize(input) {
|
|
|
30057
30277
|
}
|
|
30058
30278
|
__name(imageSize, "imageSize");
|
|
30059
30279
|
|
|
30060
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30280
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
|
|
30061
30281
|
var MAX_PAGES = 20;
|
|
30062
30282
|
var MAX_PIXELS = 2e7;
|
|
30063
30283
|
var cancelled2 = /* @__PURE__ */ __name((signal) => {
|
|
@@ -30141,7 +30361,7 @@ var ocrPdf = /* @__PURE__ */ __name(async (bytes2, pipeline2, load, signal) => {
|
|
|
30141
30361
|
let text2;
|
|
30142
30362
|
try {
|
|
30143
30363
|
const content = await page.getTextContent();
|
|
30144
|
-
text2 = content.items.map((
|
|
30364
|
+
text2 = content.items.map((item2) => `${item2.str ?? ""}${item2.hasEOL ? "\n" : " "}`).join("").trim();
|
|
30145
30365
|
if (!text2) {
|
|
30146
30366
|
if (typeof unpdf.createIsomorphicCanvasFactory !== "function" || typeof unpdf.renderPageAsImage !== "function")
|
|
30147
30367
|
return { status: "engine-missing", engine: "unpdf" };
|
|
@@ -30208,7 +30428,7 @@ var ocrPdf = /* @__PURE__ */ __name(async (bytes2, pipeline2, load, signal) => {
|
|
|
30208
30428
|
}
|
|
30209
30429
|
}, "ocrPdf");
|
|
30210
30430
|
|
|
30211
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30431
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
|
|
30212
30432
|
var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = importEngine, env = process.env) => {
|
|
30213
30433
|
const limits = pdfPreviewLimits(env);
|
|
30214
30434
|
const cancelled4 = /* @__PURE__ */ __name(() => {
|
|
@@ -30285,7 +30505,7 @@ var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = impo
|
|
|
30285
30505
|
}
|
|
30286
30506
|
}, "pdfPreview");
|
|
30287
30507
|
|
|
30288
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30508
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
|
|
30289
30509
|
import { createHash as createHash8 } from "node:crypto";
|
|
30290
30510
|
import { constants } from "node:fs";
|
|
30291
30511
|
import { lstat as lstat3, open as open5 } from "node:fs/promises";
|
|
@@ -30393,7 +30613,7 @@ var transferMime = /* @__PURE__ */ __name((head, hint, name = null) => {
|
|
|
30393
30613
|
return hint !== null && /^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(hint) ? hint : "application/octet-stream";
|
|
30394
30614
|
}, "transferMime");
|
|
30395
30615
|
|
|
30396
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30616
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/file-download.js
|
|
30397
30617
|
import { createWriteStream, mkdirSync } from "node:fs";
|
|
30398
30618
|
import { link as link3, rm } from "node:fs/promises";
|
|
30399
30619
|
import { join as join11, resolve as resolve6 } from "node:path";
|
|
@@ -30507,7 +30727,7 @@ var save = /* @__PURE__ */ __name(async (file2, directory2, fallbackName, { uniq
|
|
|
30507
30727
|
}
|
|
30508
30728
|
}, "save");
|
|
30509
30729
|
|
|
30510
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30730
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/attachments.js
|
|
30511
30731
|
var ATTACHMENT_QUERY = {
|
|
30512
30732
|
entity: "attachment",
|
|
30513
30733
|
backend: "sql",
|
|
@@ -30703,7 +30923,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30703
30923
|
issue = batch.fail(formatLocator({ ...account, chat: file2.chatId, message: file2.messageId }), "extract", limitIssue ?? (extraction?.status === "unreadable" && extraction.issue ? extraction.issue : new CliError(status === "missing" ? "not_found" : "validation_error", status === "too-large" ? "attachment exceeds an extraction, decompression or OCR size limit" : extraction?.status === "engine-missing" ? `attachment engine-missing; ${engineMissing(extraction.engine)}; \`doctor\` lists the readers` : `attachment ${status}; retry or skip this item`, { limit_source: ocr ? "provider" : "local" })), file2.position + 1);
|
|
30704
30924
|
} else
|
|
30705
30925
|
batch.ok();
|
|
30706
|
-
const
|
|
30926
|
+
const item2 = {
|
|
30707
30927
|
ref: formatLocator({ ...account, chat: file2.chatId, message: file2.messageId }),
|
|
30708
30928
|
attachment: file2.position + 1,
|
|
30709
30929
|
kind: file2.kind,
|
|
@@ -30718,13 +30938,13 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30718
30938
|
...extraction.pages === void 0 ? {} : { pages: extraction.pages, ocrPages: extraction.ocrPages }
|
|
30719
30939
|
} : {}
|
|
30720
30940
|
};
|
|
30721
|
-
finished.set(file2.pk,
|
|
30722
|
-
onItem?.(
|
|
30941
|
+
finished.set(file2.pk, item2);
|
|
30942
|
+
onItem?.(item2);
|
|
30723
30943
|
}, "processFile");
|
|
30724
30944
|
const failedItem = /* @__PURE__ */ __name((file2, stage, error) => {
|
|
30725
30945
|
const issue = batch.fail(formatLocator({ ...account, chat: file2.chatId, message: file2.messageId }), stage, error, file2.position + 1);
|
|
30726
30946
|
run.failed += 1;
|
|
30727
|
-
const
|
|
30947
|
+
const item2 = {
|
|
30728
30948
|
ref: formatLocator({ ...account, chat: file2.chatId, message: file2.messageId }),
|
|
30729
30949
|
attachment: file2.position + 1,
|
|
30730
30950
|
kind: file2.kind,
|
|
@@ -30733,8 +30953,8 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30733
30953
|
error: issue.code,
|
|
30734
30954
|
issue
|
|
30735
30955
|
};
|
|
30736
|
-
finished.set(file2.pk,
|
|
30737
|
-
onItem?.(
|
|
30956
|
+
finished.set(file2.pk, item2);
|
|
30957
|
+
onItem?.(item2);
|
|
30738
30958
|
}, "failedItem");
|
|
30739
30959
|
try {
|
|
30740
30960
|
walk: for (; ; ) {
|
|
@@ -30794,7 +31014,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30794
31014
|
run.batch = batch.result();
|
|
30795
31015
|
run.complete = false;
|
|
30796
31016
|
}
|
|
30797
|
-
run.items = [...finished.entries()].sort(([a], [b]) => b - a).map(([,
|
|
31017
|
+
run.items = [...finished.entries()].sort(([a], [b]) => b - a).map(([, item2]) => item2);
|
|
30798
31018
|
return run;
|
|
30799
31019
|
}, "extract"),
|
|
30800
31020
|
list: /* @__PURE__ */ __name(async ({ limit, offset = 0, query }) => {
|
|
@@ -30930,7 +31150,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30930
31150
|
}, "setText")
|
|
30931
31151
|
}), "attachmentsService");
|
|
30932
31152
|
|
|
30933
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31153
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
|
|
30934
31154
|
var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
|
|
30935
31155
|
list: /* @__PURE__ */ __name(async (chat, { limit, offset, ref }) => {
|
|
30936
31156
|
const store = await accountStore(deps);
|
|
@@ -30960,7 +31180,7 @@ var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30960
31180
|
}, "list")
|
|
30961
31181
|
}), "chatDocumentsService");
|
|
30962
31182
|
|
|
30963
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31183
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/retention.js
|
|
30964
31184
|
var observationDuration = /* @__PURE__ */ __name((text2, flag) => {
|
|
30965
31185
|
const match = /^(\d+(?:\.\d+)?)([smhdw])$/.exec(text2);
|
|
30966
31186
|
const units2 = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
|
|
@@ -30994,14 +31214,14 @@ var retentionService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30994
31214
|
const result = await store.roster.retention(account, chatId, options);
|
|
30995
31215
|
return {
|
|
30996
31216
|
...result,
|
|
30997
|
-
items: result.items.map((
|
|
30998
|
-
...
|
|
31217
|
+
items: result.items.map((item2) => ({
|
|
31218
|
+
...item2,
|
|
30999
31219
|
drilldown: {
|
|
31000
31220
|
command: "stats messages evidence",
|
|
31001
31221
|
arguments: {
|
|
31002
|
-
message:
|
|
31222
|
+
message: item2.cohort,
|
|
31003
31223
|
component: "report",
|
|
31004
|
-
selection: { kind: "retention", version: 1, account, chatId, cohort:
|
|
31224
|
+
selection: { kind: "retention", version: 1, account, chatId, cohort: item2.cohort, options }
|
|
31005
31225
|
}
|
|
31006
31226
|
}
|
|
31007
31227
|
})),
|
|
@@ -31047,7 +31267,7 @@ var isRetentionSelection = /* @__PURE__ */ __name((selection) => {
|
|
|
31047
31267
|
}
|
|
31048
31268
|
}, "isRetentionSelection");
|
|
31049
31269
|
|
|
31050
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31270
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/counters.js
|
|
31051
31271
|
var counterFields = /* @__PURE__ */ __name((text2 = "views,reactions,comments") => {
|
|
31052
31272
|
const fields = text2.split(",").map((one) => one.trim());
|
|
31053
31273
|
if (!fields.length || fields.some((one) => !COUNTER_FIELDS.includes(one)) || new Set(fields).size !== fields.length)
|
|
@@ -31110,7 +31330,7 @@ var countersService = /* @__PURE__ */ __name((deps) => {
|
|
|
31110
31330
|
fields,
|
|
31111
31331
|
now,
|
|
31112
31332
|
maxAge,
|
|
31113
|
-
items: items.map((
|
|
31333
|
+
items: items.map((item2) => ({ ...item2, counters: item2.counters.filter((one) => fields.includes(one.counter)) })),
|
|
31114
31334
|
hasMore
|
|
31115
31335
|
};
|
|
31116
31336
|
}, "select");
|
|
@@ -31254,7 +31474,7 @@ var countersService = /* @__PURE__ */ __name((deps) => {
|
|
|
31254
31474
|
};
|
|
31255
31475
|
}, "countersService");
|
|
31256
31476
|
|
|
31257
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31477
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
|
|
31258
31478
|
var SYNC_KEY = "messages.sync-first";
|
|
31259
31479
|
var SYNC_BOUNDS = { maxChats: 5, timeMs: 3e4, maxMessages: 500 };
|
|
31260
31480
|
var keyOf2 = /* @__PURE__ */ __name((chat) => JSON.stringify([chat.account.provider, chat.account.account, chat.chatId]), "keyOf");
|
|
@@ -31386,7 +31606,7 @@ var withRefresh = /* @__PURE__ */ __name((found, refreshed) => ({
|
|
|
31386
31606
|
...!refreshed || refreshed.complete ? {} : { coverage: { ...found.coverage, state: "stale" } }
|
|
31387
31607
|
}), "withRefresh");
|
|
31388
31608
|
|
|
31389
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31609
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
|
|
31390
31610
|
var CANDIDATES = 50;
|
|
31391
31611
|
var WORD_HITS = 200;
|
|
31392
31612
|
var RRF_K = 60;
|
|
@@ -31504,7 +31724,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
|
|
|
31504
31724
|
}, deps.messenger);
|
|
31505
31725
|
const eligibility = filter === void 0 ? void 0 : await store.queries.conversationEligibility(prepared.execution);
|
|
31506
31726
|
const selected = prepared.selectedChat;
|
|
31507
|
-
const
|
|
31727
|
+
const scopeOf4 = /* @__PURE__ */ __name((one) => selected ? selected.account.provider === one.provider && selected.account.account === one.account ? { chatId: selected.chatId } : null : {}, "scopeOf");
|
|
31508
31728
|
const words3 = await byWords(query, prepared, eligibility?.conversations, since);
|
|
31509
31729
|
const meaning = [];
|
|
31510
31730
|
const sources = words3.sources;
|
|
@@ -31512,7 +31732,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
|
|
|
31512
31732
|
await withEmbedder(deps, target2, choice, {}, async (embedder) => {
|
|
31513
31733
|
const [vector] = await embedder.embed([query], "query");
|
|
31514
31734
|
for (const one of prepared.scopeAccounts) {
|
|
31515
|
-
const scope =
|
|
31735
|
+
const scope = scopeOf4(one);
|
|
31516
31736
|
if (scope === null)
|
|
31517
31737
|
continue;
|
|
31518
31738
|
const hits = await store.vectors.nearestConversations(one, {
|
|
@@ -31546,7 +31766,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
|
|
|
31546
31766
|
const scoped = [];
|
|
31547
31767
|
const elsewhere = [];
|
|
31548
31768
|
for (const one of prepared.scopeAccounts) {
|
|
31549
|
-
const scope =
|
|
31769
|
+
const scope = scopeOf4(one);
|
|
31550
31770
|
if (scope === null)
|
|
31551
31771
|
continue;
|
|
31552
31772
|
const eligibleChats = eligibility?.chats.filter(({ account: account2 }) => account2.provider === one.provider && account2.account === one.account).map(({ chat: chat2 }) => chat2);
|
|
@@ -31652,22 +31872,22 @@ var searchReadiness = /* @__PURE__ */ __name((chats, meaning, outside) => {
|
|
|
31652
31872
|
};
|
|
31653
31873
|
}, "searchReadiness");
|
|
31654
31874
|
var meanOf = /* @__PURE__ */ __name((vectors) => {
|
|
31655
|
-
const
|
|
31875
|
+
const mean2 = new Float32Array(vectors[0]?.length ?? 0);
|
|
31656
31876
|
for (const vector of vectors) {
|
|
31657
|
-
for (let index = 0; index <
|
|
31658
|
-
|
|
31877
|
+
for (let index = 0; index < mean2.length; index++)
|
|
31878
|
+
mean2[index] = mean2[index] + vector[index];
|
|
31659
31879
|
}
|
|
31660
|
-
const length = Math.hypot(...
|
|
31661
|
-
return
|
|
31880
|
+
const length = Math.hypot(...mean2) || 1;
|
|
31881
|
+
return mean2.map((value) => value / length);
|
|
31662
31882
|
}, "meanOf");
|
|
31663
31883
|
|
|
31664
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31884
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/embeddings.js
|
|
31665
31885
|
var embeddingsService = /* @__PURE__ */ __name((deps) => ({
|
|
31666
31886
|
...embeddingsMaintenance(deps),
|
|
31667
31887
|
...embeddingsSearch(deps)
|
|
31668
31888
|
}), "embeddingsService");
|
|
31669
31889
|
|
|
31670
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31890
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/folders.js
|
|
31671
31891
|
var foldersService = /* @__PURE__ */ __name((deps) => {
|
|
31672
31892
|
const online = /* @__PURE__ */ __name(async (command) => {
|
|
31673
31893
|
if (deps.offline)
|
|
@@ -31808,7 +32028,7 @@ var foldersService = /* @__PURE__ */ __name((deps) => {
|
|
|
31808
32028
|
};
|
|
31809
32029
|
}, "foldersService");
|
|
31810
32030
|
|
|
31811
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32031
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/mentions.js
|
|
31812
32032
|
var REVIEW_COUNT = 500;
|
|
31813
32033
|
var mentionsService = /* @__PURE__ */ __name((deps) => {
|
|
31814
32034
|
const located = /* @__PURE__ */ __name(async () => {
|
|
@@ -31887,7 +32107,7 @@ var mentionsService = /* @__PURE__ */ __name((deps) => {
|
|
|
31887
32107
|
};
|
|
31888
32108
|
}, "mentionsService");
|
|
31889
32109
|
|
|
31890
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32110
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/domain/message-link.js
|
|
31891
32111
|
var fileLinks = /* @__PURE__ */ __name((attachments) => hitFiles(attachments).map(({ position, kind, name }) => ({
|
|
31892
32112
|
position,
|
|
31893
32113
|
kind,
|
|
@@ -31936,7 +32156,7 @@ var validatePermalink = /* @__PURE__ */ __name((link4) => {
|
|
|
31936
32156
|
return { url: link4.url, access: link4.access, reason: link4.reason };
|
|
31937
32157
|
}, "validatePermalink");
|
|
31938
32158
|
|
|
31939
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32159
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
|
|
31940
32160
|
var spokenSeconds = /* @__PURE__ */ __name((seconds) => {
|
|
31941
32161
|
if (seconds % 86400 === 0 && seconds > 86400)
|
|
31942
32162
|
return `${seconds / 86400}d`;
|
|
@@ -31968,7 +32188,7 @@ var pinDurationOf = /* @__PURE__ */ __name((value, allowed, flag = "--expire-tim
|
|
|
31968
32188
|
return seconds;
|
|
31969
32189
|
}, "pinDurationOf");
|
|
31970
32190
|
|
|
31971
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32191
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/sends/send-as.js
|
|
31972
32192
|
var sendAsCheck = /* @__PURE__ */ __name((connection, sendAs) => {
|
|
31973
32193
|
if (sendAs === void 0) {
|
|
31974
32194
|
const saved = connection.savedSender?.bind(connection);
|
|
@@ -31993,7 +32213,7 @@ var typedSendAs = /* @__PURE__ */ __name((typed) => {
|
|
|
31993
32213
|
return sendAs;
|
|
31994
32214
|
}, "typedSendAs");
|
|
31995
32215
|
|
|
31996
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32216
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/search/total.js
|
|
31997
32217
|
var TOTAL_CAP = 1e4;
|
|
31998
32218
|
var totalOf = /* @__PURE__ */ __name((count4, shown, hasMore, exact = true) => {
|
|
31999
32219
|
const least = shown + (hasMore ? 1 : 0);
|
|
@@ -32004,7 +32224,7 @@ var totalOf = /* @__PURE__ */ __name((count4, shown, hasMore, exact = true) => {
|
|
|
32004
32224
|
return { value: count4, relation: exact ? "eq" : "gte" };
|
|
32005
32225
|
}, "totalOf");
|
|
32006
32226
|
|
|
32007
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32227
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/search/lucene/meaning-parts.js
|
|
32008
32228
|
var WORD_FIELDS = /* @__PURE__ */ new Set(["text", "exact"]);
|
|
32009
32229
|
var fieldsOfQuery = /* @__PURE__ */ __name((root, everything) => {
|
|
32010
32230
|
let narrows = false;
|
|
@@ -32033,7 +32253,7 @@ var meaningWords = /* @__PURE__ */ __name((root) => {
|
|
|
32033
32253
|
return wanted(root).join(" ").trim();
|
|
32034
32254
|
}, "meaningWords");
|
|
32035
32255
|
|
|
32036
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32256
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/search/question-plan.js
|
|
32037
32257
|
var words2 = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
|
|
32038
32258
|
var scaffolding = new Set(words2("what which how many much who where when is are was were do does did can could should we the a an for of to under from in on at has have \u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043A\u0430\u043A\u043E\u0439 \u043A\u0430\u043A\u0430\u044F \u043A\u0430\u043A\u0438\u0435 \u043A\u0430\u043A\u043E\u0435 \u043A\u0442\u043E \u043A\u043E\u043C\u0443 \u043A\u0435\u043C \u0433\u0434\u0435 \u043A\u043E\u0433\u0434\u0430 \u043A\u0430\u043A \u0447\u0442\u043E \u0432\u043E \u043F\u043E \u043D\u0430 \u0432 \u043A \u0441 \u0443 \u0447\u0435\u0440\u0435\u0437 \u043B\u0438 \u0434\u043E\u043B\u0436\u0435\u043D \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0443\u0436\u043D\u043E \u0438\u0434\u0451\u0442 \u0438\u0434\u0435\u0442 \u043C\u043E\u0436\u043D\u043E \u043C\u043E\u0436\u0435\u0442 \u043C\u043E\u0433\u0443\u0442"));
|
|
32039
32259
|
var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
|
|
@@ -32147,8 +32367,25 @@ function planQuestion(text2, strict = false) {
|
|
|
32147
32367
|
return { changed: true, natural: true, queries, scope, terms, rankingTerms: original, removed, aliases: changes };
|
|
32148
32368
|
}
|
|
32149
32369
|
__name(planQuestion, "planQuestion");
|
|
32370
|
+
var questionText = /* @__PURE__ */ __name((text2) => text2.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found), "questionText");
|
|
32371
|
+
var lookupTerms = /* @__PURE__ */ __name((plan) => [
|
|
32372
|
+
...new Set(plan.terms.concat(plan.aliases.flatMap((alias) => words2(alias.split(" -> ")[1] ?? ""))))
|
|
32373
|
+
], "lookupTerms");
|
|
32374
|
+
var anyOfTerms = /* @__PURE__ */ __name((terms, scope) => `(${terms.join(" OR ")})${scope ? ` ${scope}` : ""}`, "anyOfTerms");
|
|
32375
|
+
var questionLookup = /* @__PURE__ */ __name((text2) => {
|
|
32376
|
+
let plan;
|
|
32377
|
+
try {
|
|
32378
|
+
plan = planQuestion(questionText(text2));
|
|
32379
|
+
} catch (error) {
|
|
32380
|
+
if (error instanceof CliError)
|
|
32381
|
+
return void 0;
|
|
32382
|
+
throw error;
|
|
32383
|
+
}
|
|
32384
|
+
const terms = plan.changed ? lookupTerms(plan) : [];
|
|
32385
|
+
return terms.length ? anyOfTerms(terms, plan.scope) : void 0;
|
|
32386
|
+
}, "questionLookup");
|
|
32150
32387
|
|
|
32151
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32388
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
|
|
32152
32389
|
var COMBINED_DEFAULTS = { candidateDepth: 300, rrfK: 60, rerank: "all", chatCap: 0 };
|
|
32153
32390
|
var tokensOf = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}\p{Co}\p{M}]+/gu) ?? [], "tokensOf");
|
|
32154
32391
|
var searchCombined = /* @__PURE__ */ __name(async (store, account, request, messenger = {}, options = COMBINED_DEFAULTS) => {
|
|
@@ -32272,8 +32509,8 @@ var searchCombined = /* @__PURE__ */ __name(async (store, account, request, mess
|
|
|
32272
32509
|
return finish(listed2.map(({ fused: _fused, ...hit }) => hit), ordered.length > request.limit || truncated, usedCorrections, truncated, true);
|
|
32273
32510
|
async function finish(items, hasMore, listed3, truncated2, expanded) {
|
|
32274
32511
|
const { completeness, coverage: coverage2 } = request.kind === "mail" ? { completeness: [], coverage: void 0 } : await coverageOf(store, prepared, messenger);
|
|
32275
|
-
const hydrated = await Promise.all(items.map(async (
|
|
32276
|
-
const hit = withExcerpt(
|
|
32512
|
+
const hydrated = await Promise.all(items.map(async (item2) => {
|
|
32513
|
+
const hit = withExcerpt(item2, request.text ?? "");
|
|
32277
32514
|
if (!request.context)
|
|
32278
32515
|
return hit;
|
|
32279
32516
|
const { provider, account: account2 } = parseLocator(hit.locator);
|
|
@@ -32341,7 +32578,7 @@ var signals = /* @__PURE__ */ __name((hit, terms, corrections, execution, mode,
|
|
|
32341
32578
|
return mode === "coverage" ? coverage2 * 4 : mode === "proximity" ? proximity : mode === "phrase" ? phrase : coverage2 * 4 + proximity + phrase;
|
|
32342
32579
|
}, "signals");
|
|
32343
32580
|
|
|
32344
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32581
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
|
|
32345
32582
|
var MEANING_DEPTH = 100;
|
|
32346
32583
|
var RRF_K2 = 60;
|
|
32347
32584
|
var RERANK_DEPTH = 50;
|
|
@@ -32363,10 +32600,7 @@ var EVERY_MESSAGE = {
|
|
|
32363
32600
|
upper_inclusive: true
|
|
32364
32601
|
};
|
|
32365
32602
|
var scopeOf2 = /* @__PURE__ */ __name((root) => root === void 0 ? {} : { ast: { version: 1, language: "lucene-v1", root } }, "scopeOf");
|
|
32366
|
-
var discoveryRequest = /* @__PURE__ */ __name((asked) => asked.ast !== void 0 || asked.exact || !asked.text ? asked : {
|
|
32367
|
-
...asked,
|
|
32368
|
-
text: asked.text.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found)
|
|
32369
|
-
}, "discoveryRequest");
|
|
32603
|
+
var discoveryRequest = /* @__PURE__ */ __name((asked) => asked.ast !== void 0 || asked.exact || !asked.text ? asked : { ...asked, text: questionText(asked.text) }, "discoveryRequest");
|
|
32370
32604
|
var searchDiscovery = /* @__PURE__ */ __name(async (store, account, asked, messenger = {}, meaning, rerank) => {
|
|
32371
32605
|
const request = discoveryRequest(asked);
|
|
32372
32606
|
const original = await prepareLucene(store, account, request, messenger);
|
|
@@ -32380,7 +32614,7 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account, asked, messe
|
|
|
32380
32614
|
const question = root === void 0 ? text2 : meaningWords(root);
|
|
32381
32615
|
if (!question)
|
|
32382
32616
|
return searchLucene(store, account, request, messenger);
|
|
32383
|
-
const terms = root === void 0 ?
|
|
32617
|
+
const terms = root === void 0 ? lookupTerms(plan) : [...new Set(words2(question))];
|
|
32384
32618
|
if (!terms.length)
|
|
32385
32619
|
return searchLucene(store, account, request, messenger);
|
|
32386
32620
|
if (terms.length > 64)
|
|
@@ -32417,7 +32651,7 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account, asked, messe
|
|
|
32417
32651
|
truncated ||= found.hasMore || found.query.combined.truncated;
|
|
32418
32652
|
}
|
|
32419
32653
|
check2();
|
|
32420
|
-
const relaxed = root === void 0 ?
|
|
32654
|
+
const relaxed = root === void 0 ? anyOfTerms(terms, plan.scope) : text2;
|
|
32421
32655
|
const partialRequest = { ...request, text: relaxed, ast: void 0, limit: 300, context: 0, thread: void 0 };
|
|
32422
32656
|
const partial = await searchLucene(store, account, partialRequest, messenger);
|
|
32423
32657
|
add(partial.items);
|
|
@@ -32669,7 +32903,7 @@ var mixedWithReranker = /* @__PURE__ */ __name((head, scores) => {
|
|
|
32669
32903
|
})).sort((a, b) => b.mixed - a.mixed).map(({ hit }) => hit);
|
|
32670
32904
|
}, "mixedWithReranker");
|
|
32671
32905
|
|
|
32672
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32906
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/thread-context.js
|
|
32673
32907
|
var THREAD_BOUNDS = { maxHops: 8, maxMessages: 50, maxBytes: 65536, withinMs: 864e5 };
|
|
32674
32908
|
var bytes = /* @__PURE__ */ __name((items, links) => Buffer.byteLength(JSON.stringify({ items, links }), "utf8"), "bytes");
|
|
32675
32909
|
var threadBounds = /* @__PURE__ */ __name((options = {}) => {
|
|
@@ -32739,8 +32973,8 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
32739
32973
|
stopped("messages");
|
|
32740
32974
|
const neighbours = anchor ? await around(message, before2, after) : [];
|
|
32741
32975
|
const nearest = neighbours.sort((a, b) => Number(a.id !== message) - Number(b.id !== message) || Math.abs(Date.parse(a.timestamp) - Date.parse(anchor?.timestamp ?? "")) - Math.abs(Date.parse(b.timestamp) - Date.parse(anchor?.timestamp ?? "")));
|
|
32742
|
-
for (const
|
|
32743
|
-
if (
|
|
32976
|
+
for (const item2 of nearest) {
|
|
32977
|
+
if (item2.threadId !== anchor?.threadId) {
|
|
32744
32978
|
stopped("thread");
|
|
32745
32979
|
continue;
|
|
32746
32980
|
}
|
|
@@ -32748,15 +32982,15 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
32748
32982
|
stopped("messages");
|
|
32749
32983
|
break;
|
|
32750
32984
|
}
|
|
32751
|
-
if (Math.abs(Date.parse(
|
|
32985
|
+
if (Math.abs(Date.parse(item2.timestamp) - Date.parse(anchor?.timestamp ?? "")) > bounds.withinMs) {
|
|
32752
32986
|
stopped("time");
|
|
32753
32987
|
continue;
|
|
32754
32988
|
}
|
|
32755
|
-
if (bytes([...result.items,
|
|
32989
|
+
if (bytes([...result.items, item2], []) > bounds.maxBytes) {
|
|
32756
32990
|
stopped("bytes");
|
|
32757
32991
|
break;
|
|
32758
32992
|
}
|
|
32759
|
-
result.items.push(
|
|
32993
|
+
result.items.push(item2);
|
|
32760
32994
|
}
|
|
32761
32995
|
result.items.sort((a, b) => a.timestamp.localeCompare(b.timestamp) || a.id.localeCompare(b.id));
|
|
32762
32996
|
return result;
|
|
@@ -32786,16 +33020,16 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
32786
33020
|
break;
|
|
32787
33021
|
}
|
|
32788
33022
|
const node = queue[index];
|
|
32789
|
-
const [
|
|
32790
|
-
if (!
|
|
33023
|
+
const [item2] = node.id === message ? [anchor] : await around(node.id);
|
|
33024
|
+
if (!item2) {
|
|
32791
33025
|
result.stale = true;
|
|
32792
33026
|
continue;
|
|
32793
33027
|
}
|
|
32794
|
-
if (Math.abs(Date.parse(
|
|
33028
|
+
if (Math.abs(Date.parse(item2.timestamp) - at) > bounds.withinMs) {
|
|
32795
33029
|
stopped("time");
|
|
32796
33030
|
continue;
|
|
32797
33031
|
}
|
|
32798
|
-
if (
|
|
33032
|
+
if (item2.threadId !== anchor.threadId) {
|
|
32799
33033
|
stopped("thread");
|
|
32800
33034
|
continue;
|
|
32801
33035
|
}
|
|
@@ -32803,7 +33037,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
32803
33037
|
stopped("messages");
|
|
32804
33038
|
break;
|
|
32805
33039
|
}
|
|
32806
|
-
const { anchor: _anchor, ...body } =
|
|
33040
|
+
const { anchor: _anchor, ...body } = item2;
|
|
32807
33041
|
const displayed2 = node.id === message ? { ...body, anchor: true } : body;
|
|
32808
33042
|
const own = await linksOf(node.id);
|
|
32809
33043
|
const parent = chosen(own);
|
|
@@ -32868,7 +33102,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
32868
33102
|
return result;
|
|
32869
33103
|
}, "readThreadContext");
|
|
32870
33104
|
|
|
32871
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33105
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
|
|
32872
33106
|
var SEARCH_FILL_MS = 200;
|
|
32873
33107
|
var statsStore = /* @__PURE__ */ __name(async (store, account, request, messenger = {}) => {
|
|
32874
33108
|
const stop = Date.now() + SEARCH_FILL_MS;
|
|
@@ -32935,12 +33169,12 @@ var accountOf2 = /* @__PURE__ */ __name((hit) => {
|
|
|
32935
33169
|
}, "accountOf");
|
|
32936
33170
|
var keyOf3 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}/${account}`, "keyOf");
|
|
32937
33171
|
|
|
32938
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33172
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/pictures.js
|
|
32939
33173
|
import { createHash as createHash10 } from "node:crypto";
|
|
32940
33174
|
import { readFile as readFile2, stat as stat3 } from "node:fs/promises";
|
|
32941
33175
|
import { setTimeout as sleep4 } from "node:timers/promises";
|
|
32942
33176
|
|
|
32943
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33177
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/domain/models.js
|
|
32944
33178
|
var GROUP_SETTINGS = [
|
|
32945
33179
|
"allCanPin",
|
|
32946
33180
|
"onlyAdminsAdd",
|
|
@@ -32954,7 +33188,7 @@ var ADMIN_RIGHTS = ["read", "members", "admins", "info", "pin", "link", "post",
|
|
|
32954
33188
|
var senderIsMe = /* @__PURE__ */ __name((message, account) => message.outgoing === true || message.senderId !== null && String(message.senderId) === account, "senderIsMe");
|
|
32955
33189
|
var MEDIA_KINDS = ["photo", "video", "file", "audio", "link"];
|
|
32956
33190
|
|
|
32957
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33191
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/pictures.js
|
|
32958
33192
|
var PICTURE_MAX_BYTES = 25 * 1024 * 1024;
|
|
32959
33193
|
var PICTURE_FLOOR = 0.25;
|
|
32960
33194
|
var PAGE5 = 50;
|
|
@@ -32971,7 +33205,7 @@ var picturesService = /* @__PURE__ */ __name((deps) => {
|
|
|
32971
33205
|
const directory2 = imageModelsDirectory(deps.env);
|
|
32972
33206
|
if (!isImageModelInstalled(model2, directory2))
|
|
32973
33207
|
throw new CliError("not_found", missingModel(model2.id), { reason: "model.not-downloaded", model: model2.id });
|
|
32974
|
-
const { openPictureEmbedder } = await import("./embedder-
|
|
33208
|
+
const { openPictureEmbedder } = await import("./embedder-HEKHRL7E.js");
|
|
32975
33209
|
return openPictureEmbedder(model2, directory2);
|
|
32976
33210
|
}, "open");
|
|
32977
33211
|
const embedder = /* @__PURE__ */ __name(() => {
|
|
@@ -33168,7 +33402,7 @@ var withPictures = /* @__PURE__ */ __name((messages, pictures) => ({
|
|
|
33168
33402
|
}, "search")
|
|
33169
33403
|
}), "withPictures");
|
|
33170
33404
|
|
|
33171
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33405
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
|
|
33172
33406
|
var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, shared, within) => {
|
|
33173
33407
|
const target2 = embeddingTarget(deps, DEFAULT_TEXT_MODEL);
|
|
33174
33408
|
const skipped = /* @__PURE__ */ __name((reason, step) => ({
|
|
@@ -33179,9 +33413,16 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
|
|
|
33179
33413
|
const store = await deps.store();
|
|
33180
33414
|
const ready = [];
|
|
33181
33415
|
const without = [];
|
|
33182
|
-
|
|
33183
|
-
|
|
33184
|
-
|
|
33416
|
+
const mail = /* @__PURE__ */ new Map();
|
|
33417
|
+
const stored = await store.accounts.storedAccounts();
|
|
33418
|
+
for (const one of accounts) {
|
|
33419
|
+
const id2 = one.provider === "email" ? stored.find(({ provider, account }) => provider === one.provider && account === one.account)?.id : void 0;
|
|
33420
|
+
if (id2 !== void 0)
|
|
33421
|
+
mail.set(one, Number(id2));
|
|
33422
|
+
else
|
|
33423
|
+
(await store.vectors.hasMessageVectors(one, target2.key) ? ready : without).push(one);
|
|
33424
|
+
}
|
|
33425
|
+
if (ready.length === 0 && mail.size === 0)
|
|
33185
33426
|
return skipped("no message has a vector yet", "conversations.rebuild");
|
|
33186
33427
|
const words3 = plainWords(question);
|
|
33187
33428
|
try {
|
|
@@ -33199,12 +33440,24 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
|
|
|
33199
33440
|
for (const { chatId, messageId, score } of near2)
|
|
33200
33441
|
ranked.push({ ...one, chatId, id: messageId, score });
|
|
33201
33442
|
}
|
|
33443
|
+
for (const [one, accountId] of mail) {
|
|
33444
|
+
const near2 = await store.mail.nearest(target2.key, query, {
|
|
33445
|
+
accountId,
|
|
33446
|
+
limit: MEANING_DEPTH
|
|
33447
|
+
});
|
|
33448
|
+
if (near2.length === 0)
|
|
33449
|
+
without.push(one);
|
|
33450
|
+
for (const { threadExternalId, externalId, score } of near2)
|
|
33451
|
+
ranked.push({ ...one, chatId: threadExternalId, id: externalId, score });
|
|
33452
|
+
}
|
|
33202
33453
|
}, "lookUp");
|
|
33203
33454
|
if (shared && !deps.embedders)
|
|
33204
33455
|
await lookUp(await shared.get(target2.key, () => target2.open()));
|
|
33205
33456
|
else
|
|
33206
33457
|
await withEmbedder(deps, target2, DEFAULT_TEXT_MODEL, {}, lookUp);
|
|
33207
33458
|
}
|
|
33459
|
+
if (ranked.length === 0 && without.length === accounts.length)
|
|
33460
|
+
return skipped("no message has a vector yet", "conversations.rebuild");
|
|
33208
33461
|
return {
|
|
33209
33462
|
model: target2.id,
|
|
33210
33463
|
ranked: ranked.sort((a, b) => b.score - a.score).slice(0, MEANING_DEPTH),
|
|
@@ -33217,7 +33470,7 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
|
|
|
33217
33470
|
}
|
|
33218
33471
|
}, "meaningLane");
|
|
33219
33472
|
|
|
33220
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33473
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
|
|
33221
33474
|
var rerankLane = /* @__PURE__ */ __name((deps) => {
|
|
33222
33475
|
const choice = deps.reranker ?? DEFAULT_RERANK_MODEL;
|
|
33223
33476
|
if (choice === "off")
|
|
@@ -33229,9 +33482,9 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
|
|
|
33229
33482
|
return { skipped: { reason: `${model.id} is not downloaded`, step: "models.download", model: model.id } };
|
|
33230
33483
|
try {
|
|
33231
33484
|
const warm = deps.embedders;
|
|
33232
|
-
const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-
|
|
33485
|
+
const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-K2FICLWY.js")).openRerankerProcess(model, directory2, {
|
|
33233
33486
|
threads: defaultThreads()
|
|
33234
|
-
})) : await (await import("./rerank-
|
|
33487
|
+
})) : await (await import("./rerank-NWFIV7OF.js")).openReranker(model, directory2);
|
|
33235
33488
|
return {
|
|
33236
33489
|
model: model.id,
|
|
33237
33490
|
score: /* @__PURE__ */ __name((question, passages) => reranker.score(plainWords(question), passages), "score"),
|
|
@@ -33251,17 +33504,17 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
|
|
|
33251
33504
|
};
|
|
33252
33505
|
}, "rerankLane");
|
|
33253
33506
|
|
|
33254
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33507
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
|
|
33255
33508
|
var openPictureEmbedderFor = /* @__PURE__ */ __name(async ({ env, command } = {}) => {
|
|
33256
33509
|
const model = imageModel(DEFAULT_IMAGE_MODEL);
|
|
33257
33510
|
const directory2 = imageModelsDirectory(env);
|
|
33258
33511
|
if (!isImageModelInstalled(model, directory2))
|
|
33259
33512
|
throw new CliError("not_found", `the picture model is not downloaded \u2014 ${command === void 0 ? "install it with a WireCat CLI that has `images models download` (tg, max or wa); they share the model folder" : `\`${command} images models download ${model.id}\` fetches it`}`, { reason: "model.not-downloaded", model: model.id });
|
|
33260
|
-
const { openPictureEmbedder } = await import("./embedder-
|
|
33513
|
+
const { openPictureEmbedder } = await import("./embedder-HEKHRL7E.js");
|
|
33261
33514
|
return openPictureEmbedder(model, directory2);
|
|
33262
33515
|
}, "openPictureEmbedderFor");
|
|
33263
33516
|
|
|
33264
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33517
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/document-source.js
|
|
33265
33518
|
var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file2) => {
|
|
33266
33519
|
const metadata = note.frontMatter;
|
|
33267
33520
|
const account = accounts.find(({ id: id2 }) => String(id2) === note.folderId);
|
|
@@ -33276,7 +33529,7 @@ var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file2) =>
|
|
|
33276
33529
|
};
|
|
33277
33530
|
}, "documentSource");
|
|
33278
33531
|
|
|
33279
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33532
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
|
|
33280
33533
|
var plainQueryWords = /* @__PURE__ */ __name((query) => {
|
|
33281
33534
|
let root;
|
|
33282
33535
|
try {
|
|
@@ -33303,7 +33556,7 @@ var titleTiers = /* @__PURE__ */ __name((hits, words3) => {
|
|
|
33303
33556
|
return [...hits].sort((a, b) => rank(a) - rank(b));
|
|
33304
33557
|
}, "titleTiers");
|
|
33305
33558
|
|
|
33306
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33559
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/notes-search.js
|
|
33307
33560
|
var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone } = {}) => resolvedQuery(store, parsedQuery(text2, exact), timezone), "storeQuery");
|
|
33308
33561
|
var parsedQuery = /* @__PURE__ */ __name((text2, exact) => validateFields(parseLucene(text2, { ...SEARCH_QUERY, defaultField: exact ? "exact" : "text" })).root, "parsedQuery");
|
|
33309
33562
|
var resolvedQuery = /* @__PURE__ */ __name(async (store, root, timezone) => {
|
|
@@ -33518,19 +33771,21 @@ var notesTotal = /* @__PURE__ */ __name(async (store, text2, { exact, scope, sho
|
|
|
33518
33771
|
const count4 = (/* @__PURE__ */ new Set([...words3.refs, ...others])).size + (words3.hasMore ? 1 : 0);
|
|
33519
33772
|
return totalOf(count4, shown, hasMore, othersComplete);
|
|
33520
33773
|
}, "notesTotal");
|
|
33521
|
-
var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offset = 0, tag, filter: expression, folderIds, withInternal, source: given, exact = false, timezone, env, command, embedders, pictures: withPictures2 = false, pictureLimit = 5, pictureEmbedder } = {}) => {
|
|
33774
|
+
var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offset = 0, tag, filter: expression, folderIds, withInternal, source: given, exact = false, discover = false, timezone, env, command, embedders, pictures: withPictures2 = false, pictureLimit = 5, pictureEmbedder } = {}) => {
|
|
33522
33775
|
const typed = noteSourceOfQuery(query);
|
|
33523
33776
|
const source = given ?? typed.source;
|
|
33524
33777
|
const rest = typed.source !== void 0 && typed.source === source ? typed.rest : query;
|
|
33525
33778
|
const label = tag === void 0 ? void 0 : normalizeTag(tag);
|
|
33526
33779
|
const filter = [expression ? `(${expression})` : "", label === void 0 ? "" : `tag:${label}`].filter(Boolean).join(" AND ") || void 0;
|
|
33527
|
-
const
|
|
33780
|
+
const lookup2 = discover && !exact ? questionLookup(query) : void 0;
|
|
33781
|
+
const parsed = query.trim() ? parsedQuery(lookup2 === void 0 ? query : questionText(query), exact) : void 0;
|
|
33528
33782
|
const words3 = parsed === void 0 ? "" : meaningWords(parsed);
|
|
33529
33783
|
const narrowing = allOf([
|
|
33530
33784
|
...parsed === void 0 ? [] : [fieldsOfQuery2(parsed)].filter((node) => node !== void 0),
|
|
33531
33785
|
...filter === void 0 ? [] : [parsedQuery(filter)]
|
|
33532
33786
|
]);
|
|
33533
|
-
const
|
|
33787
|
+
const asked = lookup2 ?? query;
|
|
33788
|
+
const text2 = [asked.trim() ? `(${asked})` : "", filter ?? ""].filter(Boolean).join(" AND ");
|
|
33534
33789
|
const window3 = offset + limit;
|
|
33535
33790
|
const scope = {
|
|
33536
33791
|
...folderIds === void 0 ? {} : { folderIds },
|
|
@@ -33540,6 +33795,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
33540
33795
|
};
|
|
33541
33796
|
let meaningSkipped;
|
|
33542
33797
|
let meaning;
|
|
33798
|
+
const cosines = /* @__PURE__ */ new Map();
|
|
33543
33799
|
let meaningRefs;
|
|
33544
33800
|
let meaningComplete = true;
|
|
33545
33801
|
if (exact)
|
|
@@ -33566,8 +33822,10 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
33566
33822
|
nearest = ranked2.slice(0, depth);
|
|
33567
33823
|
}
|
|
33568
33824
|
const allowed = await matching(store, nearest.map(({ ref }) => ref), narrowing, scope);
|
|
33569
|
-
meaning = nearest.flatMap(({ ref }) => {
|
|
33825
|
+
meaning = nearest.flatMap(({ ref, score }) => {
|
|
33570
33826
|
const found = allowed.get(ref);
|
|
33827
|
+
if (found)
|
|
33828
|
+
cosines.set(ref, score);
|
|
33571
33829
|
return found ? [{ ref, ...found }] : [];
|
|
33572
33830
|
});
|
|
33573
33831
|
meaningRefs ??= new Set(meaning.map(({ ref }) => ref));
|
|
@@ -33598,9 +33856,11 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
33598
33856
|
if (tierRefs.has(ref))
|
|
33599
33857
|
return;
|
|
33600
33858
|
const held = ranked.get(ref) ?? { note, at, score: 0, foundBy: [] };
|
|
33601
|
-
held.score += 1 / (RRF_K3 + rank + 1);
|
|
33602
33859
|
held.foundBy.push(by);
|
|
33603
33860
|
ranked.set(ref, held);
|
|
33861
|
+
if (by === "meaning" && lookup2 !== void 0 && held.foundBy.includes("words"))
|
|
33862
|
+
return;
|
|
33863
|
+
held.score += 1 / (RRF_K3 + rank + 1);
|
|
33604
33864
|
}), "add");
|
|
33605
33865
|
add(matched.items, "words");
|
|
33606
33866
|
if (meaning !== void 0)
|
|
@@ -33633,7 +33893,8 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
33633
33893
|
updated_at: at,
|
|
33634
33894
|
excerpt: firstLine(note.text, words3),
|
|
33635
33895
|
links,
|
|
33636
|
-
found_by: foundBy
|
|
33896
|
+
found_by: foundBy,
|
|
33897
|
+
...cosines.has(ref) ? { meaning_score: cosines.get(ref) } : {}
|
|
33637
33898
|
});
|
|
33638
33899
|
for (const link4 of new Map(links.map((link5) => [link5.to ?? `?${link5.target_text}`, link5])).values()) {
|
|
33639
33900
|
const key = link4.to ?? `?${link4.target_text}`;
|
|
@@ -33712,7 +33973,7 @@ var searchNotesOf = /* @__PURE__ */ __name(async (store, account, text2, { accou
|
|
|
33712
33973
|
};
|
|
33713
33974
|
}, "searchNotesOf");
|
|
33714
33975
|
|
|
33715
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33976
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/events-search.js
|
|
33716
33977
|
var MAX_EVENTS_OFFSET = 1e3;
|
|
33717
33978
|
var iso3 = /* @__PURE__ */ __name((at) => at === null ? null : new Date(at).toISOString(), "iso");
|
|
33718
33979
|
var accountIdsOf = /* @__PURE__ */ __name(async (store, accounts) => {
|
|
@@ -33746,17 +34007,18 @@ var nearestEvents = /* @__PURE__ */ __name(async (store, words3, { limit, accoun
|
|
|
33746
34007
|
return (await store.calendar.nearest(key, vector, { limit, ...accountIds ? { accountIds } : {} })).filter(({ score }) => score > floor);
|
|
33747
34008
|
}, "nearestEvents");
|
|
33748
34009
|
var keyOf4 = /* @__PURE__ */ __name(({ event }) => event.eventSeriesId === null ? `e${event.id}` : `s${event.eventSeriesId}`, "keyOf");
|
|
33749
|
-
var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, offset = 0, accounts, exact, newest, timezone, signal, candidates, env, command, embedders } = {}) => {
|
|
34010
|
+
var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, offset = 0, accounts, exact, discover, newest, timezone, signal, candidates, env, command, embedders } = {}) => {
|
|
33750
34011
|
if (!query.trim())
|
|
33751
34012
|
throw new CliError("validation_error", "say what to find in the events");
|
|
33752
|
-
const
|
|
34013
|
+
const asked = discover && !exact && !newest ? questionLookup(query) : void 0;
|
|
34014
|
+
const { root, stemmer } = await storeQuery(store, asked ?? query, {
|
|
33753
34015
|
...exact ? { exact: true } : {},
|
|
33754
34016
|
...timezone === void 0 ? {} : { timezone }
|
|
33755
34017
|
});
|
|
33756
34018
|
const accountIds = accounts === void 0 ? void 0 : await accountIdsOf(store, accounts);
|
|
33757
34019
|
if (accountIds?.length === 0)
|
|
33758
34020
|
return { query, by: "words", hits: [], has_more: false };
|
|
33759
|
-
const words3 = plainQueryWords(query);
|
|
34021
|
+
const words3 = plainQueryWords(asked === void 0 ? query : questionText(query));
|
|
33760
34022
|
const window3 = offset + limit;
|
|
33761
34023
|
let meaningSkipped;
|
|
33762
34024
|
let meaning;
|
|
@@ -33812,19 +34074,23 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
|
|
|
33812
34074
|
}), "add");
|
|
33813
34075
|
add(found.items, "words");
|
|
33814
34076
|
add(meaning, "meaning");
|
|
34077
|
+
const cosines = new Map(meaning.map((hit) => [keyOf4(hit), hit.score]));
|
|
33815
34078
|
const ordered = [...ranked.values()].sort((a, b) => b.score - a.score);
|
|
33816
34079
|
const hasMore = ordered.length > window3 || found.hasMore;
|
|
33817
34080
|
return {
|
|
33818
34081
|
query,
|
|
33819
34082
|
by,
|
|
33820
|
-
hits: ordered.slice(offset, window3).map(({ hit, by: halves }) =>
|
|
34083
|
+
hits: ordered.slice(offset, window3).map(({ hit, by: halves }) => {
|
|
34084
|
+
const cosine = cosines.get(keyOf4(hit));
|
|
34085
|
+
return { ...foundEvent(hit, query, halves), ...cosine === void 0 ? {} : { meaning_score: cosine } };
|
|
34086
|
+
}),
|
|
33821
34087
|
has_more: hasMore,
|
|
33822
34088
|
...hasMore && window3 <= MAX_EVENTS_OFFSET ? { next_offset: window3 } : {},
|
|
33823
34089
|
...truncated
|
|
33824
34090
|
};
|
|
33825
34091
|
}, "searchEvents");
|
|
33826
34092
|
|
|
33827
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34093
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/search-all.js
|
|
33828
34094
|
var RESOURCES_SEARCHED = ["messages", "mail", "notes", "events"];
|
|
33829
34095
|
var skippable = /* @__PURE__ */ __name((error) => error instanceof CliError && (error.code === "validation_error" || error.code === "not_found"), "skippable");
|
|
33830
34096
|
var filtersBeside = /* @__PURE__ */ __name((text2) => {
|
|
@@ -33849,11 +34115,14 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33849
34115
|
let hasMore = false;
|
|
33850
34116
|
let notes;
|
|
33851
34117
|
let events;
|
|
33852
|
-
|
|
34118
|
+
const by = {};
|
|
33853
34119
|
let server;
|
|
34120
|
+
const discover = !request.exact && questionLookup(request.text) !== void 0;
|
|
34121
|
+
const cosines = /* @__PURE__ */ new Map();
|
|
33854
34122
|
let coverage2;
|
|
33855
34123
|
const messagesOf = /* @__PURE__ */ __name(async (kind) => {
|
|
33856
34124
|
const given = request.scope?.[kind];
|
|
34125
|
+
const discovers = discover && (kind === "mail" || request.backend !== "server");
|
|
33857
34126
|
const query = {
|
|
33858
34127
|
text: request.text,
|
|
33859
34128
|
kind,
|
|
@@ -33866,6 +34135,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33866
34135
|
} : {},
|
|
33867
34136
|
limit: window3,
|
|
33868
34137
|
...request.exact ? { exact: true } : {},
|
|
34138
|
+
...discovers ? { discover: true } : {},
|
|
33869
34139
|
...request.timezone === void 0 ? {} : { timezone: request.timezone },
|
|
33870
34140
|
...request.signal === void 0 ? {} : { signal: request.signal }
|
|
33871
34141
|
};
|
|
@@ -33898,7 +34168,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33898
34168
|
};
|
|
33899
34169
|
}, "itemOf");
|
|
33900
34170
|
const byWords = found.items.map((hit) => itemOf3(hit, ["words"]));
|
|
33901
|
-
if (
|
|
34171
|
+
if (!meaning || request.exact || kind === "messages" && request.backend === "server")
|
|
33902
34172
|
return byWords;
|
|
33903
34173
|
const filters = filtersBeside(request.text);
|
|
33904
34174
|
const lane = filters === void 0 ? {
|
|
@@ -33908,25 +34178,28 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33908
34178
|
}
|
|
33909
34179
|
} : await meaning(request.text, read, embedders);
|
|
33910
34180
|
if ("skipped" in lane) {
|
|
33911
|
-
|
|
34181
|
+
by[kind] = { by: "words", meaningSkipped: lane.skipped };
|
|
33912
34182
|
return byWords;
|
|
33913
34183
|
}
|
|
33914
|
-
|
|
34184
|
+
by[kind] = { by: "words and meaning", ...lane.partly ? { meaningSkipped: lane.partly } : {} };
|
|
33915
34185
|
const near2 = await nearEligible(store, account, query, messenger, lane.ranked, filters ? { text: filters } : {});
|
|
33916
34186
|
const fused2 = /* @__PURE__ */ new Map();
|
|
33917
|
-
byWords.forEach((
|
|
33918
|
-
fused2.set(
|
|
34187
|
+
byWords.forEach((item2, rank) => {
|
|
34188
|
+
fused2.set(item2.ref, { item: item2, score: 1 / (RRF_K3 + rank + 1) });
|
|
33919
34189
|
});
|
|
33920
34190
|
near2.forEach((hit, rank) => {
|
|
34191
|
+
cosines.set(hit.locator, hit.cosine);
|
|
33921
34192
|
const held = fused2.get(hit.locator);
|
|
33922
34193
|
if (held)
|
|
33923
34194
|
held.item.foundBy = ["words", "meaning"];
|
|
34195
|
+
if (held && discovers)
|
|
34196
|
+
return;
|
|
33924
34197
|
fused2.set(hit.locator, {
|
|
33925
34198
|
item: held?.item ?? itemOf3(hit, ["meaning"]),
|
|
33926
34199
|
score: (held?.score ?? 0) + 1 / (RRF_K3 + rank + 1)
|
|
33927
34200
|
});
|
|
33928
34201
|
});
|
|
33929
|
-
return [...fused2.values()].sort((a, b) => b.score - a.score).map(({ item }) =>
|
|
34202
|
+
return [...fused2.values()].sort((a, b) => b.score - a.score).map(({ item: item2 }) => item2);
|
|
33930
34203
|
}, "messagesOf");
|
|
33931
34204
|
const embedders = runEmbedders();
|
|
33932
34205
|
try {
|
|
@@ -33940,6 +34213,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33940
34213
|
embedders,
|
|
33941
34214
|
...chosen === void 0 ? {} : notesScopeOf(chosen),
|
|
33942
34215
|
...request.exact ? { exact: true } : {},
|
|
34216
|
+
...discover ? { discover: true } : {},
|
|
33943
34217
|
...request.timezone === void 0 ? {} : { timezone: request.timezone },
|
|
33944
34218
|
...request.env === void 0 ? {} : { env: request.env }
|
|
33945
34219
|
});
|
|
@@ -33948,6 +34222,9 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33948
34222
|
by: found.by,
|
|
33949
34223
|
...found.meaning_skipped === void 0 ? {} : { meaningSkipped: found.meaning_skipped }
|
|
33950
34224
|
};
|
|
34225
|
+
for (const hit of found.hits)
|
|
34226
|
+
if (hit.meaning_score !== void 0)
|
|
34227
|
+
cosines.set(hit.ref, hit.meaning_score);
|
|
33951
34228
|
lists.push(found.hits.map((hit) => ({
|
|
33952
34229
|
kind: hit.kind ?? "note",
|
|
33953
34230
|
ref: hit.ref,
|
|
@@ -33976,6 +34253,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33976
34253
|
...command === void 0 ? {} : { command },
|
|
33977
34254
|
...request.env === void 0 ? {} : { env: request.env },
|
|
33978
34255
|
...request.exact ? { exact: true } : {},
|
|
34256
|
+
...discover ? { discover: true } : {},
|
|
33979
34257
|
...request.timezone === void 0 ? {} : { timezone: request.timezone },
|
|
33980
34258
|
...request.signal === void 0 ? {} : { signal: request.signal }
|
|
33981
34259
|
});
|
|
@@ -33984,6 +34262,9 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33984
34262
|
by: found.by,
|
|
33985
34263
|
...found.meaning_skipped === void 0 ? {} : { meaningSkipped: found.meaning_skipped }
|
|
33986
34264
|
};
|
|
34265
|
+
for (const hit of found.hits)
|
|
34266
|
+
if (hit.meaning_score !== void 0)
|
|
34267
|
+
cosines.set(hit.ref, hit.meaning_score);
|
|
33987
34268
|
lists.push(found.hits.map((hit) => ({
|
|
33988
34269
|
kind: "event",
|
|
33989
34270
|
ref: hit.ref,
|
|
@@ -34008,14 +34289,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
34008
34289
|
} finally {
|
|
34009
34290
|
await embedders.close();
|
|
34010
34291
|
}
|
|
34011
|
-
const
|
|
34012
|
-
for (const list3 of lists)
|
|
34013
|
-
list3.forEach((item, rank) => {
|
|
34014
|
-
const held = ranked.get(item.ref) ?? { item, score: 0 };
|
|
34015
|
-
held.score += 1 / (RRF_K3 + rank + 1);
|
|
34016
|
-
ranked.set(item.ref, held);
|
|
34017
|
-
});
|
|
34018
|
-
const ordered = [...ranked.values()].sort((a, b) => b.score - a.score).map(({ item }) => item);
|
|
34292
|
+
const ordered = oneList(lists, cosines);
|
|
34019
34293
|
const more = hasMore || ordered.length > window3;
|
|
34020
34294
|
return {
|
|
34021
34295
|
query: request.text,
|
|
@@ -34027,13 +34301,25 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
34027
34301
|
skipped,
|
|
34028
34302
|
...notes === void 0 ? {} : { notes },
|
|
34029
34303
|
...events === void 0 ? {} : { events },
|
|
34030
|
-
...
|
|
34304
|
+
...by.messages === void 0 ? {} : { messages: by.messages },
|
|
34305
|
+
...by.mail === void 0 ? {} : { mail: by.mail },
|
|
34031
34306
|
...server === void 0 ? {} : { server },
|
|
34032
34307
|
...coverage2 === void 0 ? {} : { coverage: coverage2 }
|
|
34033
34308
|
};
|
|
34034
34309
|
}, "searchAll");
|
|
34310
|
+
var oneList = /* @__PURE__ */ __name((lists, cosines) => {
|
|
34311
|
+
const place = /* @__PURE__ */ new Map();
|
|
34312
|
+
for (const list3 of lists)
|
|
34313
|
+
list3.forEach((item2, rank) => {
|
|
34314
|
+
const held = place.get(item2.ref);
|
|
34315
|
+
if (!held || rank < held.rank)
|
|
34316
|
+
place.set(item2.ref, { item: item2, rank });
|
|
34317
|
+
});
|
|
34318
|
+
const cosine = /* @__PURE__ */ __name((ref) => cosines.get(ref) ?? Number.NEGATIVE_INFINITY, "cosine");
|
|
34319
|
+
return [...place.values()].sort((a, b) => a.rank - b.rank || cosine(b.item.ref) - cosine(a.item.ref)).map(({ item: item2 }) => item2);
|
|
34320
|
+
}, "oneList");
|
|
34035
34321
|
|
|
34036
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34322
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
|
|
34037
34323
|
var RESOURCES_SEARCHED_WITH_MEETINGS = [...RESOURCES_SEARCHED, "meetings"];
|
|
34038
34324
|
var whole3 = /* @__PURE__ */ __name((value, minimum, maximum, label) => {
|
|
34039
34325
|
if (!Number.isSafeInteger(value) || value < minimum || value > maximum)
|
|
@@ -34201,16 +34487,16 @@ var searchAllIncludingMeetings = /* @__PURE__ */ __name(async (store, account, r
|
|
|
34201
34487
|
};
|
|
34202
34488
|
}
|
|
34203
34489
|
const ranked = /* @__PURE__ */ new Map();
|
|
34204
|
-
for (const list3 of [legacy.items, meetings.items.map(({ item }) =>
|
|
34205
|
-
list3.forEach((
|
|
34206
|
-
const key =
|
|
34207
|
-
const held = ranked.get(key) ?? { item, score: 0 };
|
|
34490
|
+
for (const list3 of [legacy.items, meetings.items.map(({ item: item2 }) => item2)])
|
|
34491
|
+
list3.forEach((item2, rank) => {
|
|
34492
|
+
const key = item2.kind === "meeting" ? JSON.stringify([item2.kind, item2.accountId, item2.meetingId, item2.scope, item2.id]) : item2.ref;
|
|
34493
|
+
const held = ranked.get(key) ?? { item: item2, score: 0 };
|
|
34208
34494
|
held.score += 1 / (RRF_K3 + rank + 1);
|
|
34209
34495
|
ranked.set(key, held);
|
|
34210
34496
|
});
|
|
34211
|
-
const ordered = [...ranked.values()].sort((a, b) => b.score - a.score).map(({ item }) =>
|
|
34497
|
+
const ordered = [...ranked.values()].sort((a, b) => b.score - a.score).map(({ item: item2 }) => item2);
|
|
34212
34498
|
const items = ordered.slice(offset, window3);
|
|
34213
|
-
const returnedMeetings = ordered.slice(0, window3).filter((
|
|
34499
|
+
const returnedMeetings = ordered.slice(0, window3).filter((item2) => item2.kind === "meeting").length;
|
|
34214
34500
|
const nextCursor = meetings.items[returnedMeetings]?.before ?? (!meetings.coverage.complete ? meetings.after : void 0);
|
|
34215
34501
|
const more = legacy.hasMore || ordered.length > window3;
|
|
34216
34502
|
const { nextOffset: _, ...rest } = legacy;
|
|
@@ -34245,13 +34531,13 @@ var searchAllWithMeetings = /* @__PURE__ */ __name(async (store, account, reques
|
|
|
34245
34531
|
var holdingMeetings = /* @__PURE__ */ __name(async (store, named2) => {
|
|
34246
34532
|
if (named2.length < 2)
|
|
34247
34533
|
return named2;
|
|
34248
|
-
const
|
|
34534
|
+
const holding2 = [];
|
|
34249
34535
|
for (const key of named2) {
|
|
34250
34536
|
const { id: id2 } = await store.accounts.storedAccount(key);
|
|
34251
34537
|
if ((await store.meetings.meetings({ accountId: id2, limit: 1 })).length)
|
|
34252
|
-
|
|
34538
|
+
holding2.push(key);
|
|
34253
34539
|
}
|
|
34254
|
-
return
|
|
34540
|
+
return holding2.length ? holding2 : named2;
|
|
34255
34541
|
}, "holdingMeetings");
|
|
34256
34542
|
var searchAllOfSource = /* @__PURE__ */ __name(async (store, account, source, request, messenger, searchMessages, meaning) => {
|
|
34257
34543
|
const only = request.only ?? RESOURCES_SEARCHED_WITH_MEETINGS;
|
|
@@ -34286,7 +34572,7 @@ var searchAllOfSource = /* @__PURE__ */ __name(async (store, account, source, re
|
|
|
34286
34572
|
return { ...found, skipped: [...skipped, ...empty2, ...unnamed, ...found.skipped] };
|
|
34287
34573
|
}, "searchAllOfSource");
|
|
34288
34574
|
|
|
34289
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34575
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/server-search.js
|
|
34290
34576
|
var SERVER_SEARCH_KEY = "messages.server-search";
|
|
34291
34577
|
var SERVER_BOUNDS = { timeMs: 5e3, perCall: 100, maxCalls: 3, textBytes: 262144 };
|
|
34292
34578
|
var DEFAULT_BACKEND = "both";
|
|
@@ -34475,7 +34761,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
|
|
|
34475
34761
|
return { report, sources };
|
|
34476
34762
|
}, "searchServer");
|
|
34477
34763
|
|
|
34478
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34764
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/messages.js
|
|
34479
34765
|
var DELETE_AT_ONCE = 10;
|
|
34480
34766
|
var filesOf = /* @__PURE__ */ __name(({ attachments }) => {
|
|
34481
34767
|
const files = fileLinks(attachments);
|
|
@@ -34491,18 +34777,18 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
|
|
|
34491
34777
|
return;
|
|
34492
34778
|
await ensureAccount({ text: target2.text, account: target2.account }, { account: account.account, ...deps.profile === void 0 ? {} : { profile: deps.profile } });
|
|
34493
34779
|
}, "ownTarget");
|
|
34494
|
-
const serverThenStore = /* @__PURE__ */ __name(async (store, account, query) => {
|
|
34780
|
+
const serverThenStore = /* @__PURE__ */ __name(async (store, account, query, lanes = true) => {
|
|
34495
34781
|
const server = await searchServer(deps, query);
|
|
34496
34782
|
const only = query.backend === "server" && server ? [...server.sources.keys()].map((key) => {
|
|
34497
34783
|
const [chatId, id2] = JSON.parse(key);
|
|
34498
34784
|
return { ...account, chatId, id: id2 };
|
|
34499
34785
|
}) : void 0;
|
|
34500
|
-
const found = await searchStore(store, account, only ? { ...query, only } : query, deps.messenger, query.discover && query.kind !== "mail" ? meaningLane(deps) : void 0, query.discover && query.kind !== "mail" ? rerankLane(deps) : void 0);
|
|
34786
|
+
const found = await searchStore(store, account, only ? { ...query, only } : query, deps.messenger, lanes && query.discover && query.kind !== "mail" ? meaningLane(deps) : void 0, lanes && query.discover && query.kind !== "mail" ? rerankLane(deps) : void 0);
|
|
34501
34787
|
return { found, server };
|
|
34502
34788
|
}, "serverThenStore");
|
|
34503
34789
|
const unifiedMessages = /* @__PURE__ */ __name((store, account) => async (query) => {
|
|
34504
34790
|
await topUp(store);
|
|
34505
|
-
const { found, server } = await serverThenStore(store, account, query);
|
|
34791
|
+
const { found, server } = await serverThenStore(store, account, query, false);
|
|
34506
34792
|
return withServer(found, account, server);
|
|
34507
34793
|
}, "unifiedMessages");
|
|
34508
34794
|
const remember = /* @__PURE__ */ __name(async (store, command, query) => {
|
|
@@ -34632,7 +34918,7 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
|
|
|
34632
34918
|
const store = await deps.store();
|
|
34633
34919
|
const chat2 = await readChatId(deps, target2.chat, store, account);
|
|
34634
34920
|
const found2 = await store.messages.around(account, chat2, target2.message, { before: 0, after: 0 });
|
|
34635
|
-
const held2 = found2.find((
|
|
34921
|
+
const held2 = found2.find((item2) => item2.id === target2.message && item2.chatId === chat2);
|
|
34636
34922
|
if (!held2)
|
|
34637
34923
|
throw new CliError("not_found", "no such message in this account's stored chat");
|
|
34638
34924
|
return {
|
|
@@ -34650,14 +34936,14 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
|
|
|
34650
34936
|
const locator = formatLocator({ ...account, chat, message: target2.message });
|
|
34651
34937
|
if (connection.permalink) {
|
|
34652
34938
|
const permalink = validatePermalink(await connection.permalink(chat, target2.message));
|
|
34653
|
-
const held2 = await deps.store().then((store) => store.messages.around(account, chat, target2.message, { before: 0, after: 0 })).then((found2) => found2.find((
|
|
34939
|
+
const held2 = await deps.store().then((store) => store.messages.around(account, chat, target2.message, { before: 0, after: 0 })).then((found2) => found2.find((item2) => item2.id === target2.message && item2.chatId === chat)).catch(() => void 0);
|
|
34654
34940
|
return { locator, ...permalink, ...held2 ? filesOf(held2) : {} };
|
|
34655
34941
|
}
|
|
34656
34942
|
const found = await capability(connection, "around", "read a message")(chat, target2.message, {
|
|
34657
34943
|
before: 0,
|
|
34658
34944
|
after: 0
|
|
34659
34945
|
});
|
|
34660
|
-
const held = found.find((
|
|
34946
|
+
const held = found.find((item2) => item2.id === target2.message && item2.chatId === chat);
|
|
34661
34947
|
if (!held)
|
|
34662
34948
|
throw new CliError("not_found", "no such message in this chat");
|
|
34663
34949
|
return { locator, url: null, access: "unavailable", reason: "unsupported_provider", ...filesOf(held) };
|
|
@@ -34916,7 +35202,7 @@ var checkMediaOptions = /* @__PURE__ */ __name((messenger, asked, attachments) =
|
|
|
34916
35202
|
throw new CliError("validation_error", `${MEDIA_FLAGS[first2]} needs a --photo or --file`);
|
|
34917
35203
|
}, "checkMediaOptions");
|
|
34918
35204
|
|
|
34919
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35205
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
|
|
34920
35206
|
var CHANNEL_TAG_RULES_VERSION = "keywords-v1";
|
|
34921
35207
|
var RULES = {
|
|
34922
35208
|
ai: [/\b(ai|gpt|llm|machine learning|artificial intelligence)\b/iu, /нейросет|искусственн/iu],
|
|
@@ -34931,7 +35217,7 @@ var classifyChannel = /* @__PURE__ */ __name((metadata) => Object.entries(RULES)
|
|
|
34931
35217
|
return fields.length ? [{ tag, score: fields.length / 3, fields }] : [];
|
|
34932
35218
|
}), "classifyChannel");
|
|
34933
35219
|
|
|
34934
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35220
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/metadata.js
|
|
34935
35221
|
var metadataService = /* @__PURE__ */ __name((deps) => {
|
|
34936
35222
|
const held = /* @__PURE__ */ __name(async (reference, { includeLeft = false } = {}) => {
|
|
34937
35223
|
const store = await deps.store();
|
|
@@ -35017,7 +35303,7 @@ var metadataService = /* @__PURE__ */ __name((deps) => {
|
|
|
35017
35303
|
};
|
|
35018
35304
|
}, "metadataService");
|
|
35019
35305
|
|
|
35020
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35306
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/moderation/run.js
|
|
35021
35307
|
var FIRST_LOOK_MS = 24 * 36e5;
|
|
35022
35308
|
var moderateWith = /* @__PURE__ */ __name(async (run) => {
|
|
35023
35309
|
const { chatId, title, rules, point, since, dryRun } = run;
|
|
@@ -35054,7 +35340,7 @@ var moderateWith = /* @__PURE__ */ __name(async (run) => {
|
|
|
35054
35340
|
return { chatId, rows, notes };
|
|
35055
35341
|
}, "moderateWith");
|
|
35056
35342
|
|
|
35057
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35343
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/moderation.js
|
|
35058
35344
|
var moderationService = /* @__PURE__ */ __name((deps) => {
|
|
35059
35345
|
const file2 = /* @__PURE__ */ __name(() => new ModerationRules(moderationPathFor(deps.messenger.app, deps.profile ?? "default", deps.env ?? process.env)), "file");
|
|
35060
35346
|
const group = /* @__PURE__ */ __name(async (chat) => {
|
|
@@ -35132,7 +35418,7 @@ var moderatorOf = /* @__PURE__ */ __name((adapter, deps) => ({
|
|
|
35132
35418
|
}, "removePerson")
|
|
35133
35419
|
}), "moderatorOf");
|
|
35134
35420
|
|
|
35135
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35421
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/private-people.js
|
|
35136
35422
|
var noteItem = /* @__PURE__ */ __name((provider, note) => ({
|
|
35137
35423
|
id: note.id,
|
|
35138
35424
|
contact: formatReference({ type: "contact", provider, id: note.personId }),
|
|
@@ -35176,7 +35462,7 @@ var privatePeopleService = /* @__PURE__ */ __name((deps) => {
|
|
|
35176
35462
|
};
|
|
35177
35463
|
}, "privatePeopleService");
|
|
35178
35464
|
|
|
35179
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35465
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/rankings.js
|
|
35180
35466
|
var empty = /* @__PURE__ */ __name(() => ({
|
|
35181
35467
|
total: 0,
|
|
35182
35468
|
population: 0,
|
|
@@ -35432,7 +35718,134 @@ var rankingsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
35432
35718
|
}, "evidence")
|
|
35433
35719
|
}), "rankingsService");
|
|
35434
35720
|
|
|
35435
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35721
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/reply-stats.js
|
|
35722
|
+
var FIELDS = ["date", "chat", "kind"];
|
|
35723
|
+
var WAITING_TAIL = 100;
|
|
35724
|
+
var plainOnly = /* @__PURE__ */ __name((text2, command) => {
|
|
35725
|
+
if (text2 === void 0)
|
|
35726
|
+
return;
|
|
35727
|
+
const refuse = /* @__PURE__ */ __name(() => {
|
|
35728
|
+
throw new CliError("validation_error", `${command} reads date:, chat: and kind: terms, AND-ed \u2014 not words, other fields, OR or NOT`, { reason: "query.unsupported-field" });
|
|
35729
|
+
}, "refuse");
|
|
35730
|
+
const visit = /* @__PURE__ */ __name((node) => {
|
|
35731
|
+
if (node.kind === "boolean")
|
|
35732
|
+
for (const clause of node.clauses) {
|
|
35733
|
+
if (clause.occur !== "must")
|
|
35734
|
+
refuse();
|
|
35735
|
+
visit(clause.node);
|
|
35736
|
+
}
|
|
35737
|
+
else if (!FIELDS.includes(node.field) || !["term", "phrase", "range"].includes(node.operator))
|
|
35738
|
+
refuse();
|
|
35739
|
+
}, "visit");
|
|
35740
|
+
visit(parseLucene(text2, { ...MESSAGE_PARSING, defaultField: "text" }).root);
|
|
35741
|
+
}, "plainOnly");
|
|
35742
|
+
var scopeOf3 = /* @__PURE__ */ __name((root, accounts) => {
|
|
35743
|
+
const scope = { accounts, chats: [], kinds: [] };
|
|
35744
|
+
const visit = /* @__PURE__ */ __name((node) => {
|
|
35745
|
+
if (node.kind === "boolean") {
|
|
35746
|
+
for (const clause of node.clauses)
|
|
35747
|
+
visit(clause.node);
|
|
35748
|
+
return;
|
|
35749
|
+
}
|
|
35750
|
+
const { chat, date: date2 } = node.resolution ?? {};
|
|
35751
|
+
if (chat)
|
|
35752
|
+
scope.chats.push(chat);
|
|
35753
|
+
else if (node.field === "kind")
|
|
35754
|
+
scope.kinds.push(node.value.toLowerCase());
|
|
35755
|
+
else if (date2) {
|
|
35756
|
+
if (date2.lower !== void 0) {
|
|
35757
|
+
const lower = date2.lower + (date2.lower_inclusive ? 0 : 1);
|
|
35758
|
+
scope.since = Math.max(scope.since ?? lower, lower);
|
|
35759
|
+
}
|
|
35760
|
+
if (date2.upper !== void 0) {
|
|
35761
|
+
const upper = date2.upper - (date2.upper_inclusive ? 0 : 1);
|
|
35762
|
+
scope.until = Math.min(scope.until ?? upper, upper);
|
|
35763
|
+
}
|
|
35764
|
+
}
|
|
35765
|
+
}, "visit");
|
|
35766
|
+
visit(root);
|
|
35767
|
+
return scope;
|
|
35768
|
+
}, "scopeOf");
|
|
35769
|
+
var figuresOf = /* @__PURE__ */ __name((delays) => {
|
|
35770
|
+
const { medianMilliseconds, p90Milliseconds } = delayStats(delays);
|
|
35771
|
+
return {
|
|
35772
|
+
replies: delays.length,
|
|
35773
|
+
medianMs: medianMilliseconds,
|
|
35774
|
+
p90Ms: p90Milliseconds,
|
|
35775
|
+
meanMs: delays.length ? Math.round(delays.reduce((sum2, one) => sum2 + one, 0) / delays.length) : null
|
|
35776
|
+
};
|
|
35777
|
+
}, "figuresOf");
|
|
35778
|
+
var MINUTE2 = 6e4;
|
|
35779
|
+
var waitsOnOwner = /* @__PURE__ */ __name((newest) => {
|
|
35780
|
+
if (newest.mine)
|
|
35781
|
+
return false;
|
|
35782
|
+
if (newest.kind === "private")
|
|
35783
|
+
return !newest.quiet && rankingQuestion(newest.text);
|
|
35784
|
+
return newest.addressed || newest.ownerUsername !== null && new RegExp(`(^|[^\\w@])@${newest.ownerUsername.replace(/[^\w]/g, "\\$&")}(?!\\w)`, "i").test(newest.text);
|
|
35785
|
+
}, "waitsOnOwner");
|
|
35786
|
+
var replyStatsService = /* @__PURE__ */ __name((deps) => {
|
|
35787
|
+
const prepared = /* @__PURE__ */ __name(async (query, command) => {
|
|
35788
|
+
plainOnly(query.text, command);
|
|
35789
|
+
const store = await deps.store();
|
|
35790
|
+
const found = await prepareLucene(store, await deps.account(), {
|
|
35791
|
+
...query.text === void 0 ? {} : { text: query.text },
|
|
35792
|
+
...query.source === void 0 ? {} : { source: query.source },
|
|
35793
|
+
timezone: timezoneOf(query.timezone),
|
|
35794
|
+
limit: 1
|
|
35795
|
+
}, deps.messenger);
|
|
35796
|
+
return { store, timezone: found.timezone, scope: scopeOf3(found.execution.root, found.scopeAccounts) };
|
|
35797
|
+
}, "prepared");
|
|
35798
|
+
return {
|
|
35799
|
+
responses: /* @__PURE__ */ __name(async ({ who: who2, by, ...query }) => {
|
|
35800
|
+
const { store, timezone, scope } = await prepared(query, "stats messages responses");
|
|
35801
|
+
const delays = scope.accounts.length ? await store.queries.replyDelays(scope, who2) : [];
|
|
35802
|
+
const buckets = { under5m: 0, under1h: 0, under1d: 0, over1d: 0 };
|
|
35803
|
+
for (const { delayMs } of delays) {
|
|
35804
|
+
if (delayMs < 5 * MINUTE2)
|
|
35805
|
+
buckets.under5m++;
|
|
35806
|
+
else if (delayMs < 60 * MINUTE2)
|
|
35807
|
+
buckets.under1h++;
|
|
35808
|
+
else if (delayMs < 24 * 60 * MINUTE2)
|
|
35809
|
+
buckets.under1d++;
|
|
35810
|
+
else
|
|
35811
|
+
buckets.over1d++;
|
|
35812
|
+
}
|
|
35813
|
+
const days = /* @__PURE__ */ new Map();
|
|
35814
|
+
if (by === "day") {
|
|
35815
|
+
const keyOf5 = calendarKey(timezone, "day");
|
|
35816
|
+
for (const { repliedAt, delayMs } of delays) {
|
|
35817
|
+
const key = keyOf5(repliedAt);
|
|
35818
|
+
const list3 = days.get(key) ?? [];
|
|
35819
|
+
list3.push(delayMs);
|
|
35820
|
+
days.set(key, list3);
|
|
35821
|
+
}
|
|
35822
|
+
}
|
|
35823
|
+
return {
|
|
35824
|
+
who: who2,
|
|
35825
|
+
by,
|
|
35826
|
+
...figuresOf(delays.map(({ delayMs }) => delayMs)),
|
|
35827
|
+
buckets,
|
|
35828
|
+
rows: [...days].sort(([a], [b]) => a.localeCompare(b)).map(([key, list3]) => ({ key, ...figuresOf(list3) }))
|
|
35829
|
+
};
|
|
35830
|
+
}, "responses"),
|
|
35831
|
+
waiting: /* @__PURE__ */ __name(async (query) => {
|
|
35832
|
+
const { store, scope } = await prepared(query, "stats messages waiting");
|
|
35833
|
+
const chats = scope.accounts.length ? await store.queries.waitingChats(scope, waitsOnOwner, WAITING_TAIL) : [];
|
|
35834
|
+
const firsts = chats.flatMap(({ unanswered: unanswered2 }) => unanswered2.at(-1) ?? []);
|
|
35835
|
+
return {
|
|
35836
|
+
chats: chats.length,
|
|
35837
|
+
messages: chats.reduce((sum2, { unanswered: unanswered2 }) => sum2 + unanswered2.length, 0),
|
|
35838
|
+
oldestAt: firsts.length ? new Date(firsts.reduce((low, one) => Math.min(low, one))).toISOString() : null,
|
|
35839
|
+
byKind: {
|
|
35840
|
+
private: chats.filter(({ kind }) => kind === "private").length,
|
|
35841
|
+
group: chats.filter(({ kind }) => kind === "group").length
|
|
35842
|
+
}
|
|
35843
|
+
};
|
|
35844
|
+
}, "waiting")
|
|
35845
|
+
};
|
|
35846
|
+
}, "replyStatsService");
|
|
35847
|
+
|
|
35848
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/searches.js
|
|
35436
35849
|
var savedSearchItem = /* @__PURE__ */ __name((one) => ({
|
|
35437
35850
|
id: one.id,
|
|
35438
35851
|
name: one.name,
|
|
@@ -35561,7 +35974,7 @@ var searchesService = /* @__PURE__ */ __name((deps) => {
|
|
|
35561
35974
|
};
|
|
35562
35975
|
}, "searchesService");
|
|
35563
35976
|
|
|
35564
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35977
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/tags.js
|
|
35565
35978
|
var TAGGING_QUERY = {
|
|
35566
35979
|
entity: "tagging",
|
|
35567
35980
|
backend: "sql",
|
|
@@ -35645,7 +36058,7 @@ var tagsService = /* @__PURE__ */ __name((deps) => {
|
|
|
35645
36058
|
};
|
|
35646
36059
|
}, "tagsService");
|
|
35647
36060
|
|
|
35648
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36061
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/topics.js
|
|
35649
36062
|
var actionOf = /* @__PURE__ */ __name(({ title, closed, pinned, hidden, icon }) => {
|
|
35650
36063
|
const set = [closed, pinned, hidden].filter((one) => one !== void 0).length;
|
|
35651
36064
|
if (title !== void 0 || icon !== void 0 || set !== 1)
|
|
@@ -35844,7 +36257,7 @@ var topicsService = /* @__PURE__ */ __name((deps) => {
|
|
|
35844
36257
|
};
|
|
35845
36258
|
}, "topicsService");
|
|
35846
36259
|
|
|
35847
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36260
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/evidence.js
|
|
35848
36261
|
import { createHash as createHash11, randomUUID as randomUUID5 } from "node:crypto";
|
|
35849
36262
|
var hash2 = /* @__PURE__ */ __name((value) => createHash11("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
|
|
35850
36263
|
var positive = /* @__PURE__ */ __name((value, name, minimum = 1) => {
|
|
@@ -35890,13 +36303,13 @@ var prepareEvidencePacket = /* @__PURE__ */ __name(({ kind, source, page, limits
|
|
|
35890
36303
|
threadId: message.threadId ?? null,
|
|
35891
36304
|
attachmentKinds: message.attachments.map(({ kind: attachmentKind }) => attachmentKind)
|
|
35892
36305
|
};
|
|
35893
|
-
const
|
|
35894
|
-
const bytes2 = Buffer.byteLength(JSON.stringify(
|
|
36306
|
+
const item2 = { ...content2, fingerprint: hash2(content2) };
|
|
36307
|
+
const bytes2 = Buffer.byteLength(JSON.stringify(item2), "utf8") + (items.length > 0 ? 1 : 0);
|
|
35895
36308
|
if (bytes2 > limits.bytes - contentBytes) {
|
|
35896
36309
|
truncatedBy = "bytes";
|
|
35897
36310
|
break;
|
|
35898
36311
|
}
|
|
35899
|
-
items.push(
|
|
36312
|
+
items.push(item2);
|
|
35900
36313
|
contentBytes += bytes2;
|
|
35901
36314
|
}
|
|
35902
36315
|
const content = {
|
|
@@ -35918,7 +36331,7 @@ var prepareEvidencePacket = /* @__PURE__ */ __name(({ kind, source, page, limits
|
|
|
35918
36331
|
return { ...content, id: randomUUID5(), fingerprint: hash2(content) };
|
|
35919
36332
|
}, "prepareEvidencePacket");
|
|
35920
36333
|
|
|
35921
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36334
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
|
|
35922
36335
|
var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, limit, before: before2 }, messenger = {}) => {
|
|
35923
36336
|
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
|
|
35924
36337
|
throw new CliError("validation_error", "evidence message limit must be an integer from 1 to 100");
|
|
@@ -35938,7 +36351,7 @@ var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, l
|
|
|
35938
36351
|
return { ...packet, nextBeforeId: older && last ? last.id : null };
|
|
35939
36352
|
}, "readEvidencePacket");
|
|
35940
36353
|
|
|
35941
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36354
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
|
|
35942
36355
|
var scopeKeys = [
|
|
35943
36356
|
"accountId",
|
|
35944
36357
|
"meetingId",
|
|
@@ -35960,7 +36373,7 @@ var optionKeys = /* @__PURE__ */ new Set([
|
|
|
35960
36373
|
"maxVocabularyReadBytes"
|
|
35961
36374
|
]);
|
|
35962
36375
|
|
|
35963
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36376
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
|
|
35964
36377
|
var communicationFields = {
|
|
35965
36378
|
sources: pipe(array(strictObject({
|
|
35966
36379
|
id: pipe(string(), regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)),
|
|
@@ -35992,7 +36405,7 @@ var communicationRequest = /* @__PURE__ */ __name((value, preparationAfter) => {
|
|
|
35992
36405
|
return { ...input, after, before: before2 };
|
|
35993
36406
|
}, "communicationRequest");
|
|
35994
36407
|
|
|
35995
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36408
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
|
|
35996
36409
|
var MEETING_PREPARATION_LIMITS = {
|
|
35997
36410
|
meetings: { min: 1, max: 20, default: 5 },
|
|
35998
36411
|
cues: { min: 1, max: 100, default: 10 },
|
|
@@ -36065,7 +36478,7 @@ var validateMeetingPreparationRequest = /* @__PURE__ */ __name((externalId, orig
|
|
|
36065
36478
|
};
|
|
36066
36479
|
}, "validateMeetingPreparationRequest");
|
|
36067
36480
|
|
|
36068
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36481
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
|
|
36069
36482
|
var validatePreparationCommunications = /* @__PURE__ */ __name((section, request, after) => {
|
|
36070
36483
|
const fail2 = /* @__PURE__ */ __name(() => {
|
|
36071
36484
|
throw new CliError("invalid_response", "Preparation communications returned another selection or invalid evidence");
|
|
@@ -36075,13 +36488,13 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
|
|
|
36075
36488
|
fail2();
|
|
36076
36489
|
return;
|
|
36077
36490
|
}
|
|
36078
|
-
const
|
|
36079
|
-
if (!section || section.query !==
|
|
36491
|
+
const expected2 = communicationRequest(request, after);
|
|
36492
|
+
if (!section || section.query !== expected2.query || section.window?.after !== expected2.after || section.window?.before !== expected2.before)
|
|
36080
36493
|
fail2();
|
|
36081
|
-
if (!Array.isArray(section.sources) || section.sources.length !==
|
|
36494
|
+
if (!Array.isArray(section.sources) || section.sources.length !== expected2.sources.length || section.sources.some((s) => !s || typeof s.selectionId !== "string") || new Set(section.sources.map((s) => s.selectionId)).size !== expected2.sources.length)
|
|
36082
36495
|
fail2();
|
|
36083
36496
|
for (const source of section.sources) {
|
|
36084
|
-
if (!
|
|
36497
|
+
if (!expected2.sources.some((s) => s.id === source.selectionId))
|
|
36085
36498
|
fail2();
|
|
36086
36499
|
try {
|
|
36087
36500
|
contextSource(source.source);
|
|
@@ -36091,20 +36504,20 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
|
|
|
36091
36504
|
}
|
|
36092
36505
|
if (!Array.isArray(section.items) || section.items.length > 20)
|
|
36093
36506
|
fail2();
|
|
36094
|
-
for (const
|
|
36095
|
-
if (!
|
|
36507
|
+
for (const item2 of section.items) {
|
|
36508
|
+
if (!item2)
|
|
36096
36509
|
fail2();
|
|
36097
|
-
const source = section.sources.find((s) => s.selectionId ===
|
|
36098
|
-
if (!source ||
|
|
36510
|
+
const source = section.sources.find((s) => s.selectionId === item2.selectionId)?.source;
|
|
36511
|
+
if (!source || item2.provider !== source.provider || item2.account !== source.account || !Number.isSafeInteger(item2.at) || item2.at < expected2.after || item2.at >= expected2.before || !Number.isSafeInteger(item2.updatedAt) || item2.updatedAt < 0 || item2.updatedAt > 864e13 || typeof item2.text !== "string" || Buffer.byteLength(item2.text) > 1024)
|
|
36099
36512
|
fail2();
|
|
36100
36513
|
try {
|
|
36101
36514
|
if (source.kind === "document") {
|
|
36102
|
-
const id2 = Number(
|
|
36103
|
-
if (!Number.isSafeInteger(id2) || id2 < 1 ||
|
|
36515
|
+
const id2 = Number(item2.ref.slice(9));
|
|
36516
|
+
if (!Number.isSafeInteger(id2) || id2 < 1 || item2.ref !== `document:${id2}`)
|
|
36104
36517
|
fail2();
|
|
36105
36518
|
} else {
|
|
36106
|
-
const locator = parseLocator(
|
|
36107
|
-
if (locator.provider !== source.provider || locator.account !== source.account || formatLocator(locator) !==
|
|
36519
|
+
const locator = parseLocator(item2.ref);
|
|
36520
|
+
if (locator.provider !== source.provider || locator.account !== source.account || formatLocator(locator) !== item2.ref)
|
|
36108
36521
|
fail2();
|
|
36109
36522
|
}
|
|
36110
36523
|
} catch {
|
|
@@ -36113,7 +36526,7 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
|
|
|
36113
36526
|
}
|
|
36114
36527
|
}, "validatePreparationCommunications");
|
|
36115
36528
|
|
|
36116
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36529
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
|
|
36117
36530
|
var upgradePackage = /* @__PURE__ */ __name(async ({ current, command, packageName, check: check2 }, ports) => {
|
|
36118
36531
|
const installer = ports.installer();
|
|
36119
36532
|
const argv = updateCommand(installer, packageName);
|
|
@@ -36178,7 +36591,7 @@ var dayAfter = /* @__PURE__ */ __name((published) => {
|
|
|
36178
36591
|
return Number.isNaN(time) ? null : new Date(time + 24 * 60 * 60 * 1e3).toISOString();
|
|
36179
36592
|
}, "dayAfter");
|
|
36180
36593
|
|
|
36181
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36594
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/services/index.js
|
|
36182
36595
|
var servicesFor = /* @__PURE__ */ __name((deps) => {
|
|
36183
36596
|
const pictures = picturesService(deps);
|
|
36184
36597
|
const base = {
|
|
@@ -36188,6 +36601,7 @@ var servicesFor = /* @__PURE__ */ __name((deps) => {
|
|
|
36188
36601
|
counters: countersService(deps),
|
|
36189
36602
|
retention: retentionService(deps),
|
|
36190
36603
|
rankings: rankingsService(deps),
|
|
36604
|
+
replyStats: replyStatsService(deps),
|
|
36191
36605
|
topics: topicsService(deps),
|
|
36192
36606
|
messages: withPictures(messagesService(deps), pictures),
|
|
36193
36607
|
chats: chatsService(deps),
|
|
@@ -36214,7 +36628,7 @@ var servicesFor = /* @__PURE__ */ __name((deps) => {
|
|
|
36214
36628
|
return deps.messenger.services ? { ...base, ...deps.messenger.services(base, deps) } : base;
|
|
36215
36629
|
}, "servicesFor");
|
|
36216
36630
|
|
|
36217
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36631
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/background/relay.js
|
|
36218
36632
|
import { createHash as createHash12 } from "node:crypto";
|
|
36219
36633
|
import { chmodSync, lstatSync, mkdirSync as mkdirSync3, rmSync } from "node:fs";
|
|
36220
36634
|
import { createConnection, createServer } from "node:net";
|
|
@@ -36435,7 +36849,7 @@ var relayCommand = /* @__PURE__ */ __name((path, request, options) => new Promis
|
|
|
36435
36849
|
}, () => finish({ error: stopped() }));
|
|
36436
36850
|
}), "relayCommand");
|
|
36437
36851
|
|
|
36438
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36852
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.567.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.77.1_commander@15._f1cdf35b93ce465cee2c32ebaca13ce7/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-relay.js
|
|
36439
36853
|
var lentConnection = /* @__PURE__ */ __name((connection, watchers) => throughWrapper(connection, {
|
|
36440
36854
|
close: /* @__PURE__ */ __name(async () => {
|
|
36441
36855
|
}, "close"),
|
|
@@ -36562,8 +36976,11 @@ export {
|
|
|
36562
36976
|
EVENTS_DAYS,
|
|
36563
36977
|
TRACKED_DAYS,
|
|
36564
36978
|
CHAT_KINDS,
|
|
36979
|
+
taskAccount,
|
|
36980
|
+
RULES_IN,
|
|
36565
36981
|
ARRIVAL_WINDOW,
|
|
36566
36982
|
applyTaskRulesOnArrival,
|
|
36983
|
+
FIRST_PASS_DAYS,
|
|
36567
36984
|
applyTaskRulesSinceLastPass,
|
|
36568
36985
|
openRequestTask,
|
|
36569
36986
|
applyTaskRulesToChats,
|
|
@@ -36643,7 +37060,9 @@ export {
|
|
|
36643
37060
|
withoutPhone,
|
|
36644
37061
|
savedSearchItem,
|
|
36645
37062
|
TAGGING_QUERY,
|
|
37063
|
+
TASK_STATS_BY,
|
|
36646
37064
|
TASK_QUERY,
|
|
37065
|
+
TASK_STATS_QUERY,
|
|
36647
37066
|
TASK_PAIR_QUERY,
|
|
36648
37067
|
CLAIM_LEASE_MS,
|
|
36649
37068
|
taskTypeOf,
|