@wirecat/tg-cli 0.115.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/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-ODK7R4LY.js → adapter-6CLMTQOV.js} +76 -50
- package/dist/bundle/{all-profiles-AQYM65BS.js → all-profiles-R2UZMH24.js} +10 -9
- package/dist/bundle/{anthropic-VBDSVNIM.js → anthropic-QKIPHV2Z.js} +6 -6
- package/dist/bundle/{app-server-YOIHLBNS.js → app-server-AZB2MFK6.js} +43 -42
- package/dist/bundle/{bot-api-TRYLGQKK.js → bot-api-2IM243J4.js} +50 -49
- package/dist/bundle/{bot-history-7DTJLBBJ.js → bot-history-G6CRVCL2.js} +18 -17
- package/dist/bundle/{bun-XIMM6EHD.js → bun-JDKPISPX.js} +2 -2
- package/dist/bundle/{bun-sqlite-6B3BL5IV.js → bun-sqlite-X5PY5IQT.js} +5 -5
- package/dist/bundle/{chunk-XY7IGVVS.js → chunk-42GK3XRS.js} +2 -2
- package/dist/bundle/{chunk-PEKTB3FQ.js → chunk-4D5AUWAY.js} +25 -14
- package/dist/bundle/{chunk-XIYRHIBK.js → chunk-4IQZRW4O.js} +13 -13
- package/dist/bundle/{chunk-DIABP7ZP.js → chunk-577MFPCP.js} +3 -3
- package/dist/bundle/{chunk-O7CBGHI7.js → chunk-5FCONCJO.js} +1 -1
- package/dist/bundle/{chunk-GX4DMI4H.js → chunk-5VFPUOJO.js} +15 -12
- package/dist/bundle/{chunk-5ROWSRK7.js → chunk-5ZIBAYIZ.js} +2 -2
- package/dist/bundle/{chunk-77M3IAVU.js → chunk-76CX2YPT.js} +27 -8
- package/dist/bundle/{chunk-MUZ4KYGY.js → chunk-B4UOCWM4.js} +2 -2
- package/dist/bundle/{chunk-Y3AQHPAJ.js → chunk-BGMV66FC.js} +1 -1
- package/dist/bundle/{chunk-WOQGUIXE.js → chunk-DP5LRU7K.js} +1 -1
- package/dist/bundle/{chunk-CCHHEMPM.js → chunk-EB2IULWB.js} +3 -2
- package/dist/bundle/{chunk-IUDIRZVU.js → chunk-FDI4GOIP.js} +890 -473
- package/dist/bundle/{chunk-AICS3TSF.js → chunk-GV7ZJ33M.js} +4 -4
- package/dist/bundle/{chunk-WMG4IGEB.js → chunk-H72UEHNG.js} +66 -33
- package/dist/bundle/{chunk-HZKWB6WS.js → chunk-HBUJNNZD.js} +28 -28
- package/dist/bundle/{chunk-GCFU6WBE.js → chunk-HK6SIIGG.js} +3 -3
- package/dist/bundle/{chunk-BIEBJLYO.js → chunk-HLNYJPAB.js} +2 -2
- package/dist/bundle/{chunk-PZAEI4NM.js → chunk-HUOXUI2M.js} +22 -22
- package/dist/bundle/{chunk-TQYMLXDS.js → chunk-I6JF43YP.js} +3 -3
- package/dist/bundle/{chunk-OSP335AJ.js → chunk-IR4S7POE.js} +8 -8
- package/dist/bundle/{chunk-KDOBY524.js → chunk-JFTCOV37.js} +74 -20
- package/dist/bundle/{chunk-POKTQZOM.js → chunk-JJMQA272.js} +12 -89
- package/dist/bundle/{chunk-GWDMKEDY.js → chunk-K2RYCCTP.js} +4 -4
- package/dist/bundle/{chunk-RHUNMU4Q.js → chunk-K62YATVD.js} +4 -4
- package/dist/bundle/{chunk-UBQ3LOF6.js → chunk-KA6EGOJY.js} +2 -2
- package/dist/bundle/{chunk-ILHTNOIV.js → chunk-KV4267S4.js} +1 -1
- package/dist/bundle/{chunk-M7B5IMH3.js → chunk-LFKEKSI5.js} +1032 -298
- package/dist/bundle/{chunk-BPPRR7TV.js → chunk-LSKGCJWD.js} +3403 -1275
- package/dist/bundle/{chunk-CNO3R4O4.js → chunk-LXH3SKY3.js} +8 -8
- package/dist/bundle/{chunk-JZXQZW2D.js → chunk-MQ7MCVZV.js} +2 -2
- package/dist/bundle/{chunk-2TC76TLJ.js → chunk-N42VUNTO.js} +2 -2
- package/dist/bundle/{chunk-KIZT2MI6.js → chunk-N6TIFJHW.js} +1 -1
- package/dist/bundle/{chunk-WDNNN3J4.js → chunk-NL3PAFAE.js} +6 -6
- package/dist/bundle/{chunk-AVWPMJ6E.js → chunk-NUYRMU56.js} +2 -2
- package/dist/bundle/{chunk-NTW5ZE47.js → chunk-OX6EWGSG.js} +39 -33
- package/dist/bundle/{chunk-WINKEV4F.js → chunk-PPLFOIYX.js} +4 -4
- package/dist/bundle/{chunk-OMP6ALBT.js → chunk-PPSUA3IZ.js} +3 -3
- package/dist/bundle/{chunk-UY7GJRGY.js → chunk-PXMHBTK3.js} +4 -4
- package/dist/bundle/{chunk-VVKEWWSO.js → chunk-QAKL3GXB.js} +1 -1
- package/dist/bundle/{chunk-QK6VLKG5.js → chunk-QGL2UGML.js} +301 -185
- package/dist/bundle/{chunk-OUX3QMYI.js → chunk-QHBVGKC3.js} +45 -26
- package/dist/bundle/{chunk-BEQPZA3S.js → chunk-R52RMHWF.js} +2 -2
- package/dist/bundle/chunk-RSDIPQXP.js +35 -0
- package/dist/bundle/{chunk-VQCWVZWG.js → chunk-RSNGMNU5.js} +6 -6
- package/dist/bundle/{chunk-TMATSEP5.js → chunk-SD5PUYKF.js} +12 -12
- package/dist/bundle/chunk-SKZ2E3WC.js +91 -0
- package/dist/bundle/{chunk-PEJHI7QO.js → chunk-T7CDLV33.js} +4 -4
- package/dist/bundle/{chunk-D4E345BC.js → chunk-TZVL4U7U.js} +2 -2
- package/dist/bundle/{chunk-YCUQKFGD.js → chunk-UCSFO5GW.js} +3 -3
- package/dist/bundle/{chunk-A4BQGSKI.js → chunk-VQPLHOVQ.js} +6 -6
- package/dist/bundle/{chunk-EW3XTUPB.js → chunk-XBIPSSKI.js} +4 -4
- package/dist/bundle/{chunk-LUIPXRKN.js → chunk-XQUTJITP.js} +46 -46
- 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-PQLBPYJR.js → chunk-YPF6OS37.js} +1 -1
- package/dist/bundle/{chunk-U67TSAAO.js → chunk-YYKJN6H5.js} +908 -555
- package/dist/bundle/{chunk-WMRFAK5B.js → chunk-ZDIAPICE.js} +4 -4
- package/dist/bundle/command-contract-DPXM4SZT.js +33 -0
- package/dist/bundle/{decode-2GATBZGH.js → decode-W6YPTGJA.js} +5 -5
- package/dist/bundle/{dispatch-MJMW7WDH.js → dispatch-H7EFNBEH.js} +8 -8
- package/dist/bundle/{echarts-GKEZEAL7.js → echarts-YAWDIC5D.js} +2 -2
- package/dist/bundle/{embed-TBQPLA4Y.js → embed-EN4UTLV5.js} +6 -6
- package/dist/bundle/{embedder-B5DTNCRO.js → embedder-HEKHRL7E.js} +9 -9
- package/dist/bundle/{entry-A6DEW2TD.js → entry-2KB6MTCG.js} +7 -7
- package/dist/bundle/{failure-TLF3SISS.js → failure-3DU3HLBQ.js} +2 -2
- package/dist/bundle/{first-run-3N5AABEY.js → first-run-LBG26WWO.js} +11 -11
- package/dist/bundle/first-screen-TGTSLUI6.js +31 -0
- package/dist/bundle/{instructions-P5E34PQR.js → instructions-HA62QNPR.js} +1 -1
- package/dist/bundle/{mcp-MNI62HHE.js → mcp-PPVOM4SE.js} +2 -2
- package/dist/bundle/{node-GKPRXS5Y.js → node-MZ2VWSQQ.js} +2 -2
- package/dist/bundle/{node-sqlite-GIDPALK3.js → node-sqlite-KNNS6DCM.js} +6 -6
- package/dist/bundle/{oauth-C57W4IMD.js → oauth-KWUABBSQ.js} +7 -7
- package/dist/bundle/{open-E6Q4WRPU.js → open-JXMCYCIV.js} +5 -5
- package/dist/bundle/{openai-5WMXY2KP.js → openai-HL3IR4VT.js} +14 -14
- package/dist/bundle/{process-U2P5Z6UF.js → process-K2FICLWY.js} +1 -1
- package/dist/bundle/{program-FEUDU6GF.js → program-IFOMT4JS.js} +58 -50
- package/dist/bundle/{prompt-4NGAZGHE.js → prompt-HVD3Q77P.js} +5 -5
- package/dist/bundle/{proxy-transport-MGCJ7JAW.js → proxy-transport-PA5SGMRY.js} +5 -5
- package/dist/bundle/{recognize-EUHRBA7V.js → recognize-HHLVETKI.js} +4 -4
- package/dist/bundle/{remote-3JHLB2FV.js → remote-HUAKXJCS.js} +7 -7
- package/dist/bundle/{rerank-ZZ45SZPC.js → rerank-NWFIV7OF.js} +7 -7
- package/dist/bundle/{serve-XOGX5FC5.js → serve-ANUKAJJN.js} +9 -9
- package/dist/bundle/{server-I6O72XP5.js → server-7Q7WAOHO.js} +35 -34
- package/dist/bundle/server-HCQS4YDQ.js +60 -0
- package/dist/bundle/{state-BIUYTGH6.js → state-Y2AJ5XTP.js} +6 -6
- package/dist/bundle/{store-FOJFYOMR.js → store-S3IG5KWL.js} +15 -12
- package/dist/bundle/store-maintenance-command-V2WC4G6J.js +50 -0
- package/dist/bundle/tg.js +13 -13
- 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 +3 -3
- package/dist/bundle/chunk-63YKD7YA.js +0 -18
- package/dist/bundle/command-contract-YF4KGFXC.js +0 -32
- package/dist/bundle/first-screen-HANARM67.js +0 -30
- package/dist/bundle/server-DRE5MJ76.js +0 -59
- package/dist/bundle/store-maintenance-command-YKV2C34N.js +0 -49
- /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,17 +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-
|
|
61
|
+
} from "./chunk-TZVL4U7U.js";
|
|
62
62
|
import {
|
|
63
63
|
AGENDA_COLUMNS,
|
|
64
64
|
CHAT_COLUMNS,
|
|
@@ -69,6 +69,7 @@ import {
|
|
|
69
69
|
COUNTER_FIELDS,
|
|
70
70
|
FIELD_VERSION,
|
|
71
71
|
INTERNAL_NOTES,
|
|
72
|
+
MAIL_AGENDA_COLUMNS,
|
|
72
73
|
MAX_FILE_BYTES,
|
|
73
74
|
MAX_TEXT_CHARS,
|
|
74
75
|
MENTION_QUERY,
|
|
@@ -97,6 +98,7 @@ import {
|
|
|
97
98
|
counterFreshness,
|
|
98
99
|
counterObservationTime,
|
|
99
100
|
cutChunks,
|
|
101
|
+
delayStats,
|
|
100
102
|
dueDayOf,
|
|
101
103
|
entriesOfList,
|
|
102
104
|
exhausted,
|
|
@@ -132,12 +134,14 @@ import {
|
|
|
132
134
|
queryFilter,
|
|
133
135
|
rankingContextRange,
|
|
134
136
|
rankingOptions,
|
|
137
|
+
rankingQuestion,
|
|
135
138
|
searchError,
|
|
136
139
|
sourceOf,
|
|
137
140
|
threadConversation,
|
|
138
141
|
validateAst,
|
|
139
|
-
validateFields
|
|
140
|
-
|
|
142
|
+
validateFields,
|
|
143
|
+
withoutField
|
|
144
|
+
} from "./chunk-LSKGCJWD.js";
|
|
141
145
|
import {
|
|
142
146
|
EVENT_QUERY,
|
|
143
147
|
MEETING_PROJECT_EVIDENCE_QUERY,
|
|
@@ -171,7 +175,6 @@ import {
|
|
|
171
175
|
normalizeTag,
|
|
172
176
|
parseLucene,
|
|
173
177
|
parseMeetingReference,
|
|
174
|
-
paymentTitle,
|
|
175
178
|
pull,
|
|
176
179
|
queryError,
|
|
177
180
|
queryFieldsOf,
|
|
@@ -183,23 +186,23 @@ import {
|
|
|
183
186
|
validateQuery,
|
|
184
187
|
walkQuery,
|
|
185
188
|
zonedMoment
|
|
186
|
-
} from "./chunk-
|
|
189
|
+
} from "./chunk-QGL2UGML.js";
|
|
187
190
|
import {
|
|
188
191
|
DEFAULT_STEMMERS,
|
|
189
192
|
createStemmer,
|
|
190
193
|
fold,
|
|
191
194
|
normalize
|
|
192
|
-
} from "./chunk-
|
|
195
|
+
} from "./chunk-IR4S7POE.js";
|
|
193
196
|
import {
|
|
194
197
|
DEFAULT_TASK_CATEGORIES,
|
|
195
198
|
FALLBACK_CATEGORY
|
|
196
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-VQPLHOVQ.js";
|
|
197
200
|
import {
|
|
198
201
|
MAX_MODEL_IMAGE_BYTES
|
|
199
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-MQ7MCVZV.js";
|
|
200
203
|
import {
|
|
201
204
|
remoteKey
|
|
202
|
-
} from "./chunk-
|
|
205
|
+
} from "./chunk-577MFPCP.js";
|
|
203
206
|
import {
|
|
204
207
|
Unzip,
|
|
205
208
|
UnzipInflate,
|
|
@@ -210,19 +213,19 @@ import {
|
|
|
210
213
|
placedText,
|
|
211
214
|
runEmbedders,
|
|
212
215
|
textModelsDirectory
|
|
213
|
-
} from "./chunk-
|
|
216
|
+
} from "./chunk-NL3PAFAE.js";
|
|
214
217
|
import {
|
|
215
218
|
installFiles,
|
|
216
219
|
megabytes
|
|
217
|
-
} from "./chunk-
|
|
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
227
|
writeSecurely
|
|
225
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-OX6EWGSG.js";
|
|
226
229
|
import {
|
|
227
230
|
array,
|
|
228
231
|
boolean,
|
|
@@ -245,7 +248,7 @@ import {
|
|
|
245
248
|
string,
|
|
246
249
|
transform,
|
|
247
250
|
unknown
|
|
248
|
-
} from "./chunk-
|
|
251
|
+
} from "./chunk-76CX2YPT.js";
|
|
249
252
|
import {
|
|
250
253
|
importFrom,
|
|
251
254
|
resolveFrom
|
|
@@ -255,7 +258,7 @@ import {
|
|
|
255
258
|
isCliError,
|
|
256
259
|
singleLine,
|
|
257
260
|
visibleControls
|
|
258
|
-
} from "./chunk-
|
|
261
|
+
} from "./chunk-EB2IULWB.js";
|
|
259
262
|
import {
|
|
260
263
|
__commonJS,
|
|
261
264
|
__name,
|
|
@@ -276,9 +279,9 @@ var require_conventions = __commonJS({
|
|
|
276
279
|
}
|
|
277
280
|
for (var i = 0; i < list3.length; i++) {
|
|
278
281
|
if (hasOwn(list3, i)) {
|
|
279
|
-
var
|
|
280
|
-
if (predicate.call(void 0,
|
|
281
|
-
return
|
|
282
|
+
var item2 = list3[i];
|
|
283
|
+
if (predicate.call(void 0, item2, i, list3)) {
|
|
284
|
+
return item2;
|
|
282
285
|
}
|
|
283
286
|
}
|
|
284
287
|
}
|
|
@@ -1087,8 +1090,8 @@ var require_dom = __commonJS({
|
|
|
1087
1090
|
* The first index of the node in the NodeList; -1 if not found.
|
|
1088
1091
|
* @private
|
|
1089
1092
|
*/
|
|
1090
|
-
indexOf: /* @__PURE__ */ __name(function(
|
|
1091
|
-
return Array.prototype.indexOf.call(this,
|
|
1093
|
+
indexOf: /* @__PURE__ */ __name(function(item2) {
|
|
1094
|
+
return Array.prototype.indexOf.call(this, item2);
|
|
1092
1095
|
}, "indexOf")
|
|
1093
1096
|
};
|
|
1094
1097
|
NodeList.prototype[Symbol.iterator] = function() {
|
|
@@ -16871,7 +16874,7 @@ var require_lib3 = __commonJS({
|
|
|
16871
16874
|
}
|
|
16872
16875
|
});
|
|
16873
16876
|
|
|
16874
|
-
// 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
|
|
16875
16878
|
var RULES_VERSION = 5;
|
|
16876
16879
|
var LOOK_BACK = 50;
|
|
16877
16880
|
var SAME_SENDER_WITHIN = 10;
|
|
@@ -16961,15 +16964,15 @@ var latest = /* @__PURE__ */ __name((window3, matches) => {
|
|
|
16961
16964
|
var sameThread = /* @__PURE__ */ __name((a, b) => a.threadId === b.threadId, "sameThread");
|
|
16962
16965
|
var link = /* @__PURE__ */ __name((message, parentId, source, kind, confidence, method) => ({ messageId: message.id, parentId, source, kind, confidence, method }), "link");
|
|
16963
16966
|
|
|
16964
|
-
// 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
|
|
16965
16968
|
var syncsOneChat = /* @__PURE__ */ __name((messenger) => messenger.history !== "store" || messenger.historyOnDemand === true, "syncsOneChat");
|
|
16966
16969
|
|
|
16967
|
-
// 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
|
|
16968
16971
|
import { randomBytes } from "node:crypto";
|
|
16969
16972
|
var newSendId = /* @__PURE__ */ __name(() => randomBytes(8).readBigInt64BE().toString(), "newSendId");
|
|
16970
16973
|
var newOperationId = newSendId;
|
|
16971
16974
|
|
|
16972
|
-
// 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
|
|
16973
16976
|
import { openAsBlob, realpathSync } from "node:fs";
|
|
16974
16977
|
import { open, stat } from "node:fs/promises";
|
|
16975
16978
|
import { basename, dirname, extname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
@@ -17190,7 +17193,7 @@ var readStickerFile = /* @__PURE__ */ __name(async (path, maxBytes, read) => {
|
|
|
17190
17193
|
return { name, source };
|
|
17191
17194
|
}, "readStickerFile");
|
|
17192
17195
|
|
|
17193
|
-
// 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
|
|
17194
17197
|
var COMMAND_NEEDS = {
|
|
17195
17198
|
"account update": ["updateProfile", "change the profile"],
|
|
17196
17199
|
"account sessions list": ["sessions", "list the account's sessions"],
|
|
@@ -17240,7 +17243,7 @@ var hideNever = /* @__PURE__ */ __name((messenger, group) => {
|
|
|
17240
17243
|
return group;
|
|
17241
17244
|
}, "hideNever");
|
|
17242
17245
|
|
|
17243
|
-
// 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
|
|
17244
17247
|
var AUDIT_PAGE = 200;
|
|
17245
17248
|
var AUDIT_BUDGET = 10;
|
|
17246
17249
|
var AUDIT_PAUSE_MS = 1e3;
|
|
@@ -17320,7 +17323,7 @@ var burstJoins = /* @__PURE__ */ __name((members) => {
|
|
|
17320
17323
|
return found;
|
|
17321
17324
|
}, "burstJoins");
|
|
17322
17325
|
|
|
17323
|
-
// 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
|
|
17324
17327
|
var queryWordsAfterOptions = /* @__PURE__ */ __name((command) => {
|
|
17325
17328
|
command.allowUnknownOption();
|
|
17326
17329
|
const parse = command.parseOptions.bind(command);
|
|
@@ -17340,7 +17343,7 @@ var queryWordsAfterOptions = /* @__PURE__ */ __name((command) => {
|
|
|
17340
17343
|
return command;
|
|
17341
17344
|
}, "queryWordsAfterOptions");
|
|
17342
17345
|
|
|
17343
|
-
// 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
|
|
17344
17347
|
var count = /* @__PURE__ */ __name((value) => {
|
|
17345
17348
|
if (!/^(0|[1-9]\d*)$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
17346
17349
|
throw new CliError("validation_error", "expected a nonnegative safe integer");
|
|
@@ -17382,7 +17385,7 @@ var addMeetingPassageCommandDefinition = /* @__PURE__ */ __name((program, deps)
|
|
|
17382
17385
|
var createMeetingPassageCommand = sharedCommand(createMeetingPassageCommandDefinition);
|
|
17383
17386
|
var addMeetingPassageCommand = sharedCommand(addMeetingPassageCommandDefinition);
|
|
17384
17387
|
|
|
17385
|
-
// 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
|
|
17386
17389
|
var integer2 = /* @__PURE__ */ __name((value) => {
|
|
17387
17390
|
if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
17388
17391
|
throw new CliError("validation_error", "expected a positive safe integer");
|
|
@@ -17405,7 +17408,7 @@ ${fieldsHelp(MEETING_PROJECT_EVIDENCE_QUERY)}`).option("--limit <n>", "hits in o
|
|
|
17405
17408
|
}, "addMeetingProjectEvidenceCommandDefinition");
|
|
17406
17409
|
var addMeetingProjectEvidenceCommand = sharedCommand(addMeetingProjectEvidenceCommandDefinition);
|
|
17407
17410
|
|
|
17408
|
-
// 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
|
|
17409
17412
|
var ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/i;
|
|
17410
17413
|
var moment = /* @__PURE__ */ __name((flag, end, readIn) => (value) => {
|
|
17411
17414
|
const zone = timezoneOf();
|
|
@@ -17491,7 +17494,7 @@ var addMeetingSearchCommandDefinition = /* @__PURE__ */ __name((program, deps) =
|
|
|
17491
17494
|
var createMeetingSearchCommand = sharedCommand(createMeetingSearchCommandDefinition);
|
|
17492
17495
|
var addMeetingSearchCommand = sharedCommand(addMeetingSearchCommandDefinition);
|
|
17493
17496
|
|
|
17494
|
-
// 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
|
|
17495
17498
|
var integer4 = /* @__PURE__ */ __name((text2) => {
|
|
17496
17499
|
if (!/^[1-9]\d*$/.test(text2) || !Number.isSafeInteger(Number(text2)))
|
|
17497
17500
|
throw new InvalidArgumentError("expected a positive integer");
|
|
@@ -17623,7 +17626,7 @@ ${fieldsHelp(EVENT_QUERY, MEETING_QUERY_GUIDE)}`);
|
|
|
17623
17626
|
}, "addMeetingCommandsDefinition");
|
|
17624
17627
|
var addMeetingCommands = sharedCommand(addMeetingCommandsDefinition);
|
|
17625
17628
|
|
|
17626
|
-
// 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
|
|
17627
17630
|
var LIST_QUERY_GUIDE = "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md";
|
|
17628
17631
|
var QUERY_ARGUMENT = "field:value terms that narrow the list \u2014 the fields are below";
|
|
17629
17632
|
var withQuery = /* @__PURE__ */ __name((command, registry) => {
|
|
@@ -17756,7 +17759,7 @@ var termField = /* @__PURE__ */ __name((name, type, example, more = {}) => nativ
|
|
|
17756
17759
|
var queryHelp = /* @__PURE__ */ __name((registry) => `
|
|
17757
17760
|
${fieldsHelp(registry, LIST_QUERY_GUIDE)}`, "queryHelp");
|
|
17758
17761
|
|
|
17759
|
-
// 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
|
|
17760
17763
|
var positiveCount = /* @__PURE__ */ __name((flag) => (value) => {
|
|
17761
17764
|
if (!/^\d+$/.test(value.trim()) || Number(value) < 1)
|
|
17762
17765
|
throw new CliError("validation_error", `${flag} takes a whole number from 1 upwards, not "${value}"`);
|
|
@@ -17765,7 +17768,7 @@ var positiveCount = /* @__PURE__ */ __name((flag) => (value) => {
|
|
|
17765
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");
|
|
17766
17769
|
var window = /* @__PURE__ */ __name(({ limit, page, all }) => all ? { offset: 0 } : { limit, offset: (page - 1) * limit }, "window");
|
|
17767
17770
|
|
|
17768
|
-
// 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
|
|
17769
17772
|
var defined = /* @__PURE__ */ __name((record2) => Object.fromEntries(Object.entries(record2).filter(([, value]) => value !== void 0)), "defined");
|
|
17770
17773
|
var chatRef = /* @__PURE__ */ __name((account, chat) => formatReference({ type: "chat", provider: account.provider, account: account.account, chat }), "chatRef");
|
|
17771
17774
|
var settingsOf = /* @__PURE__ */ __name((settings) => defined({
|
|
@@ -17956,7 +17959,7 @@ var folderAnswer = /* @__PURE__ */ __name((folder) => {
|
|
|
17956
17959
|
excluded_chats: shown?.excluded
|
|
17957
17960
|
});
|
|
17958
17961
|
}, "folderAnswer");
|
|
17959
|
-
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()}
|
|
17960
17963
|
`).join(""), "lines");
|
|
17961
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");
|
|
17962
17965
|
var wholeList = /* @__PURE__ */ __name((command, items, extra = {}) => listOf(command, { items, limit: Math.max(1, items.length), has_more: false, ...extra }), "wholeList");
|
|
@@ -18027,7 +18030,7 @@ var sessionAnswer = /* @__PURE__ */ __name(({ current, client, device, location,
|
|
|
18027
18030
|
...createdAt === void 0 ? {} : { created_at: createdAt }
|
|
18028
18031
|
}), "sessionAnswer");
|
|
18029
18032
|
|
|
18030
|
-
// 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
|
|
18031
18034
|
var throughWrapper = /* @__PURE__ */ __name((inner, handled, wrap = (_, call) => call) => new Proxy(handled, {
|
|
18032
18035
|
get: /* @__PURE__ */ __name((own, key) => {
|
|
18033
18036
|
if (key in own)
|
|
@@ -18044,7 +18047,7 @@ var capability = /* @__PURE__ */ __name((adapter, method, what) => {
|
|
|
18044
18047
|
return found.bind(adapter);
|
|
18045
18048
|
}, "capability");
|
|
18046
18049
|
|
|
18047
|
-
// 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
|
|
18048
18051
|
var TAKES = {
|
|
18049
18052
|
chat: "a chat: chat:<provider>/<account>/<chat>, its id or its title",
|
|
18050
18053
|
message: "a message: msg:<provider>/<account>/<chat>/<message>, or a chat and the message's id"
|
|
@@ -18104,7 +18107,7 @@ var ensureAccount = /* @__PURE__ */ __name(async (reference, scope, profilesOn)
|
|
|
18104
18107
|
throw wrongAccount(reference, scope, profiles);
|
|
18105
18108
|
}, "ensureAccount");
|
|
18106
18109
|
|
|
18107
|
-
// 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
|
|
18108
18111
|
var isId = /* @__PURE__ */ __name((reference) => /^-?\d+$/.test(reference.trim()), "isId");
|
|
18109
18112
|
var foldName = /* @__PURE__ */ __name((name) => name.normalize("NFC").replace(/[\uFE0E\uFE0F\u200D]/g, "").toLowerCase(), "foldName");
|
|
18110
18113
|
var pickChat = /* @__PURE__ */ __name((reference, chats) => {
|
|
@@ -18149,7 +18152,7 @@ ${lines3}`, { candidates });
|
|
|
18149
18152
|
}, "ambiguous");
|
|
18150
18153
|
var isPresent = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isPresent");
|
|
18151
18154
|
|
|
18152
|
-
// 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
|
|
18153
18156
|
var accountStore = /* @__PURE__ */ __name(async (deps) => (await deps.store()).forAccount(await deps.account()), "accountStore");
|
|
18154
18157
|
var crossAccount = /* @__PURE__ */ __name((deps, _reason) => deps.store(), "crossAccount");
|
|
18155
18158
|
var NO_LOCAL_STORE = "this answer comes from the messenger, not from the local store";
|
|
@@ -18162,11 +18165,11 @@ var storeAbsent = /* @__PURE__ */ __name((error) => {
|
|
|
18162
18165
|
return error instanceof Error && typeof code === "number" && (code & 255) === SQLITE_BUSY;
|
|
18163
18166
|
}, "storeAbsent");
|
|
18164
18167
|
var accountUnknown = /* @__PURE__ */ __name((error) => isCliFailure(error) && (error.code === "not_found" || error.code === "authentication_error"), "accountUnknown");
|
|
18165
|
-
var unless = /* @__PURE__ */ __name(async (work,
|
|
18168
|
+
var unless = /* @__PURE__ */ __name(async (work, expected2) => {
|
|
18166
18169
|
try {
|
|
18167
18170
|
return await work();
|
|
18168
18171
|
} catch (error) {
|
|
18169
|
-
if (
|
|
18172
|
+
if (expected2(error))
|
|
18170
18173
|
return void 0;
|
|
18171
18174
|
throw error;
|
|
18172
18175
|
}
|
|
@@ -18213,7 +18216,7 @@ var storedDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({
|
|
|
18213
18216
|
}), "storedDeps");
|
|
18214
18217
|
var storeModeDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({ ...storedDeps(messenger, store, account, guard), offline: false, reads: "store" }), "storeModeDeps");
|
|
18215
18218
|
|
|
18216
|
-
// 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
|
|
18217
18220
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
18218
18221
|
var LONGEST_WAIT_MS = 5 * 60 * 1e3;
|
|
18219
18222
|
var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
|
|
@@ -18236,10 +18239,10 @@ var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
|
|
|
18236
18239
|
}
|
|
18237
18240
|
}, "patiently");
|
|
18238
18241
|
|
|
18239
|
-
// 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
|
|
18240
18243
|
import { setTimeout as sleep2 } from "node:timers/promises";
|
|
18241
18244
|
|
|
18242
|
-
// 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
|
|
18243
18246
|
var REQUEST_MS = 400;
|
|
18244
18247
|
var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, maxPages, pauseMs }) => {
|
|
18245
18248
|
const lowest = ranges[0];
|
|
@@ -18262,13 +18265,13 @@ var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, max
|
|
|
18262
18265
|
};
|
|
18263
18266
|
}, "estimateBackfill");
|
|
18264
18267
|
|
|
18265
|
-
// 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
|
|
18266
18269
|
var withRecovery = /* @__PURE__ */ __name((error) => ({
|
|
18267
18270
|
...error,
|
|
18268
18271
|
retryable: typeof error.retryable === "boolean" ? error.retryable : error.code === "rate_limited" || error.status === 429
|
|
18269
18272
|
}), "withRecovery");
|
|
18270
18273
|
|
|
18271
|
-
// 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
|
|
18272
18275
|
var actionable = /* @__PURE__ */ __name((error) => {
|
|
18273
18276
|
if (isCliFailure(error))
|
|
18274
18277
|
return withRecovery({ code: error.code, message: error.message, ...error.details });
|
|
@@ -18351,7 +18354,7 @@ var mergeBatches = /* @__PURE__ */ __name((a, b) => {
|
|
|
18351
18354
|
};
|
|
18352
18355
|
}, "mergeBatches");
|
|
18353
18356
|
|
|
18354
|
-
// 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
|
|
18355
18358
|
var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account) => {
|
|
18356
18359
|
if (deps.reads !== "store")
|
|
18357
18360
|
return keptChatId(deps.messenger, reference, store, account);
|
|
@@ -18369,11 +18372,11 @@ var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account)
|
|
|
18369
18372
|
}, "readChatId");
|
|
18370
18373
|
var LEFT_EMPTY = "you left this chat, and the store holds none of its messages";
|
|
18371
18374
|
var storedChatId = /* @__PURE__ */ __name((messenger, reference, store, account, { includeLeft = false } = {}) => {
|
|
18372
|
-
const
|
|
18375
|
+
const renamed2 = /* @__PURE__ */ __name((id2) => store.chats.renamedChatId(account, id2), "renamed");
|
|
18373
18376
|
const profilesOn = profilesOnAccount(store, messenger.app?.command, account.provider);
|
|
18374
18377
|
const among = chatIdAmong(messenger, reference, account, {
|
|
18375
18378
|
held: /* @__PURE__ */ __name(() => store.chats.chats(account, {}), "held"),
|
|
18376
|
-
renamed,
|
|
18379
|
+
renamed: renamed2,
|
|
18377
18380
|
left: /* @__PURE__ */ __name(async (id2) => leftIn(await store.chats.chats(account, byId(id2))), "left"),
|
|
18378
18381
|
profilesOn
|
|
18379
18382
|
});
|
|
@@ -18384,17 +18387,17 @@ var storedChatId = /* @__PURE__ */ __name((messenger, reference, store, account,
|
|
|
18384
18387
|
throw error;
|
|
18385
18388
|
return chatIdAmong(messenger, reference, account, {
|
|
18386
18389
|
held: /* @__PURE__ */ __name(() => store.chats.chats(account, { includeLeft: true }), "held"),
|
|
18387
|
-
renamed,
|
|
18390
|
+
renamed: renamed2,
|
|
18388
18391
|
profilesOn
|
|
18389
18392
|
});
|
|
18390
18393
|
});
|
|
18391
18394
|
}, "storedChatId");
|
|
18392
18395
|
var keptChatId = /* @__PURE__ */ __name((messenger, reference, store, account) => storedChatId(messenger, reference, store, account, { includeLeft: true }), "keptChatId");
|
|
18393
18396
|
var chatIdIn = /* @__PURE__ */ __name((messenger, reference, store, { includeLeft = false } = {}) => {
|
|
18394
|
-
const
|
|
18397
|
+
const renamed2 = /* @__PURE__ */ __name((id2) => store.chats.renamedChatId(id2), "renamed");
|
|
18395
18398
|
const among = chatIdAmong(messenger, reference, store.account, {
|
|
18396
18399
|
held: /* @__PURE__ */ __name(() => store.chats.chats({}), "held"),
|
|
18397
|
-
renamed,
|
|
18400
|
+
renamed: renamed2,
|
|
18398
18401
|
left: /* @__PURE__ */ __name(async (id2) => leftIn(await store.chats.chats(byId(id2))), "left")
|
|
18399
18402
|
});
|
|
18400
18403
|
if (!includeLeft)
|
|
@@ -18404,7 +18407,7 @@ var chatIdIn = /* @__PURE__ */ __name((messenger, reference, store, { includeLef
|
|
|
18404
18407
|
throw error;
|
|
18405
18408
|
return chatIdAmong(messenger, reference, store.account, {
|
|
18406
18409
|
held: /* @__PURE__ */ __name(() => store.chats.chats({ includeLeft: true }), "held"),
|
|
18407
|
-
renamed
|
|
18410
|
+
renamed: renamed2
|
|
18408
18411
|
});
|
|
18409
18412
|
});
|
|
18410
18413
|
}, "chatIdIn");
|
|
@@ -18419,7 +18422,7 @@ var profilesOnAccount = /* @__PURE__ */ __name((store, app, provider) => async (
|
|
|
18419
18422
|
return void 0;
|
|
18420
18423
|
return Object.entries((await store.accounts.profiles())[app] ?? {}).filter(([, key]) => key.provider === provider && key.account === account).map(([name]) => name);
|
|
18421
18424
|
}, "profilesOnAccount");
|
|
18422
|
-
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 }) => {
|
|
18423
18426
|
const trimmed = reference.trim();
|
|
18424
18427
|
if (messenger.savedChatId && ["me", "self", "saved"].includes(trimmed.toLowerCase())) {
|
|
18425
18428
|
return messenger.savedChatId(account);
|
|
@@ -18429,7 +18432,7 @@ var chatIdAmong = /* @__PURE__ */ __name(async (messenger, reference, account, {
|
|
|
18429
18432
|
await ensureAccount(named2, { account: account.account }, profilesOn);
|
|
18430
18433
|
if (named2 || /^-?\d+$/.test(trimmed)) {
|
|
18431
18434
|
const typed = named2?.chat ?? trimmed;
|
|
18432
|
-
const id2 = await
|
|
18435
|
+
const id2 = await renamed2(typed) ?? typed;
|
|
18433
18436
|
if (await left?.(id2))
|
|
18434
18437
|
throw new CliError("not_found", `you left chat ${id2}`);
|
|
18435
18438
|
return id2;
|
|
@@ -18438,7 +18441,7 @@ var chatIdAmong = /* @__PURE__ */ __name(async (messenger, reference, account, {
|
|
|
18438
18441
|
const exact = chats.find((one) => one.id === trimmed);
|
|
18439
18442
|
if (exact)
|
|
18440
18443
|
return exact.id;
|
|
18441
|
-
const moved = await
|
|
18444
|
+
const moved = await renamed2(trimmed);
|
|
18442
18445
|
if (moved !== void 0 && chats.some((one) => one.id === moved))
|
|
18443
18446
|
return moved;
|
|
18444
18447
|
if (trimmed.startsWith("@")) {
|
|
@@ -18510,7 +18513,7 @@ var senderAmong = /* @__PURE__ */ __name(async (store, accounts, reference) => {
|
|
|
18510
18513
|
}
|
|
18511
18514
|
}, "senderAmong");
|
|
18512
18515
|
|
|
18513
|
-
// 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
|
|
18514
18517
|
var CONTEXT_MESSAGES = 3;
|
|
18515
18518
|
var CONTEXT_MINUTES = 10;
|
|
18516
18519
|
var MAX_CHARS = 1200;
|
|
@@ -18534,12 +18537,12 @@ var context = {
|
|
|
18534
18537
|
}, "describe")
|
|
18535
18538
|
};
|
|
18536
18539
|
|
|
18537
|
-
// 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
|
|
18538
18541
|
var BUILT_INS = [context];
|
|
18539
18542
|
var providers = [...BUILT_INS];
|
|
18540
18543
|
var registeredImageProviders = /* @__PURE__ */ __name(() => providers, "registeredImageProviders");
|
|
18541
18544
|
|
|
18542
|
-
// 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
|
|
18543
18546
|
var READ_PAGE = 5e3;
|
|
18544
18547
|
var CHAIN = 50;
|
|
18545
18548
|
var CONVERSATION_QUERY = {
|
|
@@ -18691,7 +18694,7 @@ var sized = /* @__PURE__ */ __name((size2) => {
|
|
|
18691
18694
|
return size2;
|
|
18692
18695
|
}, "sized");
|
|
18693
18696
|
|
|
18694
|
-
// 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
|
|
18695
18698
|
var REFRESH_BOUNDS = { maxChats: 20, maxChunks: 2e3 };
|
|
18696
18699
|
var MESSAGE_PAGE = 5e3;
|
|
18697
18700
|
var PER_SESSION = 8;
|
|
@@ -18710,7 +18713,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
|
|
|
18710
18713
|
price: remote.price,
|
|
18711
18714
|
installed: true,
|
|
18712
18715
|
perBatch: PER_REQUEST * concurrency,
|
|
18713
|
-
open: /* @__PURE__ */ __name(async () => (await import("./remote-
|
|
18716
|
+
open: /* @__PURE__ */ __name(async () => (await import("./remote-HUAKXJCS.js")).openRemote(remote, apiKey, { concurrency }), "open")
|
|
18714
18717
|
};
|
|
18715
18718
|
}
|
|
18716
18719
|
const model = textModel(choice);
|
|
@@ -18727,7 +18730,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
|
|
|
18727
18730
|
if (!isTextModelInstalled(model, directory2))
|
|
18728
18731
|
throw notDownloaded(model.id);
|
|
18729
18732
|
if (apart) {
|
|
18730
|
-
const { openProcess } = await import("./process-
|
|
18733
|
+
const { openProcess } = await import("./process-K2FICLWY.js");
|
|
18731
18734
|
return openProcess(model, directory2, { threads: threads ?? defaultThreads() });
|
|
18732
18735
|
}
|
|
18733
18736
|
return openEmbedder(model, directory2, { threads: threads ?? defaultThreads() });
|
|
@@ -19016,7 +19019,7 @@ var shaped = /* @__PURE__ */ __name(({ chatId, builtAt, algorithmVersion, pendin
|
|
|
19016
19019
|
return { ...one, state };
|
|
19017
19020
|
}, "shaped");
|
|
19018
19021
|
|
|
19019
|
-
// 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
|
|
19020
19023
|
var CATCH_UP_BOUNDS = { maxChunks: 500, maxMessages: 1e4, timeMs: 3e4 };
|
|
19021
19024
|
var validateCatchUpBounds = /* @__PURE__ */ __name((options) => {
|
|
19022
19025
|
for (const [key, value, maximum] of [
|
|
@@ -19069,7 +19072,7 @@ var catchUpSearch = /* @__PURE__ */ __name(async (deps, chat, options, signal, c
|
|
|
19069
19072
|
}
|
|
19070
19073
|
}, "catchUpSearch");
|
|
19071
19074
|
|
|
19072
|
-
// 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
|
|
19073
19076
|
var pushed = /* @__PURE__ */ __name((deps, what) => {
|
|
19074
19077
|
if (deps.reads === "store") {
|
|
19075
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`);
|
|
@@ -19435,7 +19438,7 @@ var timeOfKey = /* @__PURE__ */ __name(async (store, account, chatId, key, byTim
|
|
|
19435
19438
|
return message?.timestamp ?? fallback;
|
|
19436
19439
|
}, "timeOfKey");
|
|
19437
19440
|
|
|
19438
|
-
// 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
|
|
19439
19442
|
var LINKS = /https?:\/\/\S+/g;
|
|
19440
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");
|
|
19441
19444
|
var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker = "others" }) => {
|
|
@@ -19465,7 +19468,7 @@ var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker
|
|
|
19465
19468
|
});
|
|
19466
19469
|
}, "questions");
|
|
19467
19470
|
|
|
19468
|
-
// 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
|
|
19469
19472
|
var names = /* @__PURE__ */ __name((categories) => categories.map(({ name }) => name).join(", "), "names");
|
|
19470
19473
|
var taskCategoryOf = /* @__PURE__ */ __name((categories = DEFAULT_TASK_CATEGORIES, flag = "--category") => (typed) => {
|
|
19471
19474
|
const name = typed.trim().toLowerCase();
|
|
@@ -19522,7 +19525,7 @@ var categorize = /* @__PURE__ */ __name((text2, categories = DEFAULT_TASK_CATEGO
|
|
|
19522
19525
|
return best.name;
|
|
19523
19526
|
}, "categorize");
|
|
19524
19527
|
|
|
19525
|
-
// 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
|
|
19526
19529
|
var taskAccount = /* @__PURE__ */ __name(({ provider, account }) => `${provider}:${account}`, "taskAccount");
|
|
19527
19530
|
var RULES_IN = {
|
|
19528
19531
|
dialog: "all",
|
|
@@ -19728,7 +19731,7 @@ var applyTaskRulesToChats = /* @__PURE__ */ __name(async (store, account, chatId
|
|
|
19728
19731
|
return passes;
|
|
19729
19732
|
}, "applyTaskRulesToChats");
|
|
19730
19733
|
|
|
19731
|
-
// 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
|
|
19732
19735
|
var AGO = /^(\d+)(m|h|d)$/;
|
|
19733
19736
|
var AGO_MS = { m: 6e4, h: 36e5, d: 864e5 };
|
|
19734
19737
|
var DATE = /^\d{4}-\d{2}-\d{2}/;
|
|
@@ -19768,7 +19771,7 @@ var dateWindow = /* @__PURE__ */ __name(({ sinceTime, untilTime, zone, now = Dat
|
|
|
19768
19771
|
};
|
|
19769
19772
|
}, "dateWindow");
|
|
19770
19773
|
|
|
19771
|
-
// 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
|
|
19772
19775
|
var DAY_MS = 864e5;
|
|
19773
19776
|
var NEW_DAYS = 30;
|
|
19774
19777
|
var SAME_TEXT_MIN = 20;
|
|
@@ -19845,7 +19848,7 @@ var scorePerson = /* @__PURE__ */ __name(({ subject, provider, activity, photos,
|
|
|
19845
19848
|
};
|
|
19846
19849
|
}, "scorePerson");
|
|
19847
19850
|
|
|
19848
|
-
// 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
|
|
19849
19852
|
var REGISTRIES = {
|
|
19850
19853
|
cas: { title: "Combot Anti-Spam (CAS)", docs: "https://cas.chat/api" },
|
|
19851
19854
|
lols: { title: "lols.bot", docs: "https://api.lols.bot/lols-bot.json" }
|
|
@@ -19930,7 +19933,7 @@ var notCovered = /* @__PURE__ */ __name((messenger, now = /* @__PURE__ */ new Da
|
|
|
19930
19933
|
detail: `lists Telegram accounts only, not ${messenger} ones`
|
|
19931
19934
|
})), "notCovered");
|
|
19932
19935
|
|
|
19933
|
-
// 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
|
|
19934
19937
|
var ACTIVITY_MESSAGES = 1e3;
|
|
19935
19938
|
var botCheckService = /* @__PURE__ */ __name((deps) => {
|
|
19936
19939
|
const subjectOf = /* @__PURE__ */ __name(async (reference) => {
|
|
@@ -20018,7 +20021,7 @@ var botCheckService = /* @__PURE__ */ __name((deps) => {
|
|
|
20018
20021
|
};
|
|
20019
20022
|
}, "botCheckService");
|
|
20020
20023
|
|
|
20021
|
-
// 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
|
|
20022
20025
|
var threadIdOf = /* @__PURE__ */ __name((value) => {
|
|
20023
20026
|
if (value === void 0)
|
|
20024
20027
|
return void 0;
|
|
@@ -20028,7 +20031,7 @@ var threadIdOf = /* @__PURE__ */ __name((value) => {
|
|
|
20028
20031
|
return id2;
|
|
20029
20032
|
}, "threadIdOf");
|
|
20030
20033
|
|
|
20031
|
-
// 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
|
|
20032
20035
|
var TOP_POSTS = 5;
|
|
20033
20036
|
var JOINS = /* @__PURE__ */ new Set(["join", "add"]);
|
|
20034
20037
|
var LEAVES = /* @__PURE__ */ new Set(["leave", "remove"]);
|
|
@@ -20145,7 +20148,7 @@ var median = /* @__PURE__ */ __name((values) => {
|
|
|
20145
20148
|
return Math.round(sorted.length % 2 === 0 ? ((sorted[middle - 1] ?? upper) + upper) / 2 : upper);
|
|
20146
20149
|
}, "median");
|
|
20147
20150
|
|
|
20148
|
-
// 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
|
|
20149
20152
|
var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
|
|
20150
20153
|
const events = [];
|
|
20151
20154
|
for (const stay of stays) {
|
|
@@ -20177,7 +20180,7 @@ var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
|
|
|
20177
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));
|
|
20178
20181
|
}, "memberEvents");
|
|
20179
20182
|
|
|
20180
|
-
// 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
|
|
20181
20184
|
var EVENTS_DAYS = 7;
|
|
20182
20185
|
var TRACKED_DAYS = 30;
|
|
20183
20186
|
var STATS_PAGE = 1e3;
|
|
@@ -20195,18 +20198,18 @@ var storedEvents = /* @__PURE__ */ __name(async (store, deps, chat, since) => {
|
|
|
20195
20198
|
var deepChecks = /* @__PURE__ */ __name(async (deps, items, deep, pauseMs, registry) => {
|
|
20196
20199
|
const checks = botCheckService(deps);
|
|
20197
20200
|
const checked2 = [];
|
|
20198
|
-
for (const [index,
|
|
20201
|
+
for (const [index, item2] of items.entries()) {
|
|
20199
20202
|
if (index >= deep) {
|
|
20200
|
-
checked2.push(
|
|
20203
|
+
checked2.push(item2);
|
|
20201
20204
|
continue;
|
|
20202
20205
|
}
|
|
20203
20206
|
if (index > 0)
|
|
20204
20207
|
await new Promise((resolve7) => setTimeout(resolve7, pauseMs));
|
|
20205
|
-
const { score, reasons, registries, unknown: unknown3 } = await checks.person(
|
|
20208
|
+
const { score, reasons, registries, unknown: unknown3 } = await checks.person(item2.id, {
|
|
20206
20209
|
registries: true,
|
|
20207
20210
|
...registry ? { registry } : {}
|
|
20208
20211
|
});
|
|
20209
|
-
checked2.push({ ...
|
|
20212
|
+
checked2.push({ ...item2, check: { score, reasons, registries, unknown: unknown3 } });
|
|
20210
20213
|
}
|
|
20211
20214
|
return checked2;
|
|
20212
20215
|
}, "deepChecks");
|
|
@@ -20472,7 +20475,7 @@ var storedMembers = /* @__PURE__ */ __name(async (store, chatId) => {
|
|
|
20472
20475
|
return members.length === 0 ? null : members;
|
|
20473
20476
|
}, "storedMembers");
|
|
20474
20477
|
|
|
20475
|
-
// 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
|
|
20476
20479
|
var INBOX_CHATS = 20;
|
|
20477
20480
|
var REVIEW_DAYS = 3;
|
|
20478
20481
|
var UNANSWERED_HOURS = 24;
|
|
@@ -20680,7 +20683,7 @@ var inboxService = /* @__PURE__ */ __name((deps) => {
|
|
|
20680
20683
|
};
|
|
20681
20684
|
}, "inboxService");
|
|
20682
20685
|
|
|
20683
|
-
// 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
|
|
20684
20687
|
var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "the messenger formatter returned invalid text spans"), "invalid");
|
|
20685
20688
|
var validateFormattedText = /* @__PURE__ */ __name((formatted2) => {
|
|
20686
20689
|
const { text: text2, spans } = formatted2;
|
|
@@ -20740,7 +20743,7 @@ var visibleFormattedText = /* @__PURE__ */ __name((formatted2) => {
|
|
|
20740
20743
|
};
|
|
20741
20744
|
}, "visibleFormattedText");
|
|
20742
20745
|
|
|
20743
|
-
// 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
|
|
20744
20747
|
var INVITE = /max\.ru\/join\/|(t|telegram)\.me\/(\+|joinchat\/)|tg:\/\/join/i;
|
|
20745
20748
|
var LINK2 = /https?:\/\/\S+/i;
|
|
20746
20749
|
var STRENGTH = { report: 0, delete: 1, remove: 2 };
|
|
@@ -20928,7 +20931,7 @@ var nextPoint = /* @__PURE__ */ __name((rows, found) => {
|
|
|
20928
20931
|
}, "nextPoint");
|
|
20929
20932
|
var someUndone = /* @__PURE__ */ __name((rows) => rows.some(undone), "someUndone");
|
|
20930
20933
|
|
|
20931
|
-
// 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
|
|
20932
20935
|
import { existsSync, readFileSync } from "node:fs";
|
|
20933
20936
|
import { join } from "node:path";
|
|
20934
20937
|
var RULE_ACTIONS = ["report", "delete", "remove"];
|
|
@@ -20978,7 +20981,7 @@ var defaultRules = /* @__PURE__ */ __name((title) => ({
|
|
|
20978
20981
|
newAccount: { days: 7, action: "report" },
|
|
20979
20982
|
consent: { delete: "ask", remove: "ask" }
|
|
20980
20983
|
}), "defaultRules");
|
|
20981
|
-
var list = /* @__PURE__ */ __name((value) => value.split(",").map((
|
|
20984
|
+
var list = /* @__PURE__ */ __name((value) => value.split(",").map((item2) => item2.trim()).filter(Boolean), "list");
|
|
20982
20985
|
var whole = /* @__PURE__ */ __name((value) => /^\d+$/.test(value.trim()) ? Number(value) : Number.NaN, "whole");
|
|
20983
20986
|
var KEYS = {
|
|
20984
20987
|
trusted: { help: "person ids, comma-separated; never acted on", parse: list },
|
|
@@ -21071,7 +21074,7 @@ var assign = /* @__PURE__ */ __name((rules, key, value) => {
|
|
|
21071
21074
|
return { ...rules, [head]: { ...rules[head], [tail]: value } };
|
|
21072
21075
|
}, "assign");
|
|
21073
21076
|
|
|
21074
|
-
// 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
|
|
21075
21078
|
var CONTEXT_MESSAGES2 = 10;
|
|
21076
21079
|
var CONTEXT_BYTES = 64 * 1024;
|
|
21077
21080
|
var toContext = /* @__PURE__ */ __name((key, message, chatTitle2) => ({
|
|
@@ -21256,8 +21259,8 @@ var recordContext = /* @__PURE__ */ __name(async (store, record2, reads, { messa
|
|
|
21256
21259
|
var withinBytes = /* @__PURE__ */ __name((lists, bytes2) => {
|
|
21257
21260
|
let used = 0;
|
|
21258
21261
|
let cut = false;
|
|
21259
|
-
const keep2 = /* @__PURE__ */ __name((items) => items.filter((
|
|
21260
|
-
const size2 = Buffer.byteLength(JSON.stringify(
|
|
21262
|
+
const keep2 = /* @__PURE__ */ __name((items) => items.filter((item2) => {
|
|
21263
|
+
const size2 = Buffer.byteLength(JSON.stringify(item2), "utf8");
|
|
21261
21264
|
if (cut || used + size2 > bytes2) {
|
|
21262
21265
|
cut = true;
|
|
21263
21266
|
return false;
|
|
@@ -21332,10 +21335,10 @@ var personMessages = /* @__PURE__ */ __name(async (store, asked, reference, { ch
|
|
|
21332
21335
|
};
|
|
21333
21336
|
}, "personMessages");
|
|
21334
21337
|
|
|
21335
|
-
// 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
|
|
21336
21339
|
import { createHash } from "node:crypto";
|
|
21337
21340
|
|
|
21338
|
-
// 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
|
|
21339
21342
|
var missing2 = /* @__PURE__ */ __name(() => new CliError("not_found", "the meeting evidence is unavailable for this account"), "missing");
|
|
21340
21343
|
var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId, reference, options = {}) => {
|
|
21341
21344
|
const parsed = parseMeetingReference(reference);
|
|
@@ -21353,7 +21356,7 @@ var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId,
|
|
|
21353
21356
|
return { parsed, meeting };
|
|
21354
21357
|
}, "authorizedMeetingMetadata");
|
|
21355
21358
|
|
|
21356
|
-
// 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
|
|
21357
21360
|
var hash = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
|
|
21358
21361
|
var checkMeetingCancelled = /* @__PURE__ */ __name((signal) => {
|
|
21359
21362
|
if (signal?.aborted)
|
|
@@ -21499,16 +21502,16 @@ var readMeetingEvidence = /* @__PURE__ */ __name(async (store, accountId, refere
|
|
|
21499
21502
|
hasMore = true;
|
|
21500
21503
|
break;
|
|
21501
21504
|
}
|
|
21502
|
-
const
|
|
21503
|
-
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);
|
|
21504
21507
|
if (contentBytes + bytes2 > limits.bytes) {
|
|
21505
21508
|
truncatedBy = "bytes";
|
|
21506
21509
|
hasMore = true;
|
|
21507
21510
|
break;
|
|
21508
21511
|
}
|
|
21509
|
-
items.push(
|
|
21512
|
+
items.push(item2);
|
|
21510
21513
|
contentBytes += bytes2;
|
|
21511
|
-
nextReference =
|
|
21514
|
+
nextReference = item2.reference;
|
|
21512
21515
|
afterPosition = row.position;
|
|
21513
21516
|
}
|
|
21514
21517
|
if (truncatedBy !== null || parsed.cuePosition !== void 0 || !page.hasMore)
|
|
@@ -21552,7 +21555,7 @@ var readMeetingEvidence = /* @__PURE__ */ __name(async (store, accountId, refere
|
|
|
21552
21555
|
return { ...packet, fingerprint: hash(packet) };
|
|
21553
21556
|
}, "readMeetingEvidence");
|
|
21554
21557
|
|
|
21555
|
-
// 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
|
|
21556
21559
|
var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference, options) => {
|
|
21557
21560
|
const { meetings = 10, cues = 5, bytes: bytes2 = 64 * 1024, scanLimit = 1e3, since, signal } = options;
|
|
21558
21561
|
const requestedAccounts = options.accountIds;
|
|
@@ -21616,7 +21619,7 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
|
|
|
21616
21619
|
}
|
|
21617
21620
|
throw error;
|
|
21618
21621
|
}
|
|
21619
|
-
const
|
|
21622
|
+
const item2 = {
|
|
21620
21623
|
reference,
|
|
21621
21624
|
cues: evidence.items,
|
|
21622
21625
|
cueCoverage: {
|
|
@@ -21625,12 +21628,12 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
|
|
|
21625
21628
|
hasMore: evidence.coverage.hasMore
|
|
21626
21629
|
}
|
|
21627
21630
|
};
|
|
21628
|
-
const itemBytes = Buffer.byteLength(JSON.stringify(
|
|
21631
|
+
const itemBytes = Buffer.byteLength(JSON.stringify(item2), "utf8") + (items.length ? 1 : 0);
|
|
21629
21632
|
if (contentBytes + itemBytes > bytes2) {
|
|
21630
21633
|
truncatedBy = "bytes";
|
|
21631
21634
|
break;
|
|
21632
21635
|
}
|
|
21633
|
-
items.push(
|
|
21636
|
+
items.push(item2);
|
|
21634
21637
|
contentBytes += itemBytes;
|
|
21635
21638
|
}
|
|
21636
21639
|
checkMeetingCancelled(signal);
|
|
@@ -21651,7 +21654,7 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
|
|
|
21651
21654
|
};
|
|
21652
21655
|
}, "personMeetingContext");
|
|
21653
21656
|
|
|
21654
|
-
// 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
|
|
21655
21658
|
var PREPARE_BYTES = 96 * 1024;
|
|
21656
21659
|
var MEETINGS = 5;
|
|
21657
21660
|
var CUES = 3;
|
|
@@ -21664,14 +21667,14 @@ var personPreparation = /* @__PURE__ */ __name(async (store, asked, reference, o
|
|
|
21664
21667
|
const budgeted = /* @__PURE__ */ __name((page) => {
|
|
21665
21668
|
const items = [];
|
|
21666
21669
|
let cut = false;
|
|
21667
|
-
for (const
|
|
21668
|
-
const bytes2 = size(
|
|
21670
|
+
for (const item2 of page.items.slice(0, limit)) {
|
|
21671
|
+
const bytes2 = size(item2);
|
|
21669
21672
|
if (cut || bytes2 > left) {
|
|
21670
21673
|
cut = true;
|
|
21671
21674
|
continue;
|
|
21672
21675
|
}
|
|
21673
21676
|
left -= bytes2;
|
|
21674
|
-
items.push(
|
|
21677
|
+
items.push(item2);
|
|
21675
21678
|
}
|
|
21676
21679
|
const over = page.hasMore || page.items.length > limit;
|
|
21677
21680
|
return {
|
|
@@ -21754,7 +21757,7 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
|
|
|
21754
21757
|
bytes: Math.min(left(), 4 * 1024 * 1024),
|
|
21755
21758
|
...since === void 0 ? {} : { since }
|
|
21756
21759
|
});
|
|
21757
|
-
const read = new Set(found.items.map((
|
|
21760
|
+
const read = new Set(found.items.map((item2) => parseMeetingReference(item2.reference).accountId));
|
|
21758
21761
|
return {
|
|
21759
21762
|
items: found.items,
|
|
21760
21763
|
hasMore: found.coverage.truncatedBy !== null || found.coverage.scanLimitReached,
|
|
@@ -21768,7 +21771,7 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
|
|
|
21768
21771
|
}
|
|
21769
21772
|
}, "meetingsOf");
|
|
21770
21773
|
|
|
21771
|
-
// 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
|
|
21772
21775
|
var personProfile = /* @__PURE__ */ __name(async (deps, person, known2) => {
|
|
21773
21776
|
const online = deps.offline ? void 0 : await deps.connection();
|
|
21774
21777
|
const held = await storeIfOpen(deps);
|
|
@@ -21838,7 +21841,7 @@ var quiet = /* @__PURE__ */ __name((facts) => facts.chats.map(({ id: id2, title,
|
|
|
21838
21841
|
complete: false
|
|
21839
21842
|
})), "quiet");
|
|
21840
21843
|
|
|
21841
|
-
// 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
|
|
21842
21845
|
var TIMELINE_ITEMS = 50;
|
|
21843
21846
|
var TIMELINE_MAX = 500;
|
|
21844
21847
|
var SCOPES = ["personal", "work"];
|
|
@@ -21893,7 +21896,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
|
|
|
21893
21896
|
};
|
|
21894
21897
|
}, "personTimeline");
|
|
21895
21898
|
|
|
21896
|
-
// 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
|
|
21897
21900
|
var peopleService = /* @__PURE__ */ __name((deps) => {
|
|
21898
21901
|
const localCard = /* @__PURE__ */ __name(async (card, includeNotes = false) => {
|
|
21899
21902
|
const held = await storeIfOpen(deps);
|
|
@@ -22120,7 +22123,110 @@ var withoutPhone = /* @__PURE__ */ __name((answer) => {
|
|
|
22120
22123
|
return rest;
|
|
22121
22124
|
}, "withoutPhone");
|
|
22122
22125
|
|
|
22123
|
-
// 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
|
|
22124
22230
|
var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
|
|
22125
22231
|
const tags = /* @__PURE__ */ new Map();
|
|
22126
22232
|
for (const node of query ? walkQuery(query.root) : [])
|
|
@@ -22129,7 +22235,7 @@ var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
|
|
|
22129
22235
|
return tags;
|
|
22130
22236
|
}, "taskTagFilters");
|
|
22131
22237
|
|
|
22132
|
-
// 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
|
|
22133
22239
|
var TASK_QUERY = {
|
|
22134
22240
|
entity: "task",
|
|
22135
22241
|
backend: "sql",
|
|
@@ -22160,6 +22266,20 @@ var TASK_QUERY = {
|
|
|
22160
22266
|
}
|
|
22161
22267
|
})
|
|
22162
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
|
+
};
|
|
22163
22283
|
var PAIR_DECISIONS = ["review", "unsure"];
|
|
22164
22284
|
var TASK_PAIR_QUERY = {
|
|
22165
22285
|
entity: "task_pair",
|
|
@@ -22246,6 +22366,13 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
|
|
|
22246
22366
|
const inStore = /* @__PURE__ */ __name(async (work) => work(await deps.store(), await deps.account()), "inStore");
|
|
22247
22367
|
const service = /* @__PURE__ */ __name((store) => createTaskService({ store: store.tasks }), "service");
|
|
22248
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");
|
|
22249
22376
|
const refuseBare = /* @__PURE__ */ __name((target2) => {
|
|
22250
22377
|
throw new CliError("validation_error", `no task ${singleLine(target2)} \u2014 write task:${singleLine(target2)} for a task`);
|
|
22251
22378
|
}, "refuseBare");
|
|
@@ -22300,12 +22427,7 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
|
|
|
22300
22427
|
const reviewAfterLink = /* @__PURE__ */ __name(async (store, id2) => !isClosedState((await store.tasks.get(id2))?.state ?? "done") ? store.tasks.reviewDuplicates(id2, { linked: true }) : 0, "reviewAfterLink");
|
|
22301
22428
|
return {
|
|
22302
22429
|
list: /* @__PURE__ */ __name(({ query, limit, offset, previews }) => inStore(async (store, account) => {
|
|
22303
|
-
const
|
|
22304
|
-
for (const node of query ? walkQuery(query.root) : [])
|
|
22305
|
-
if (node.field === "chat" && node.operator !== "wildcard" && !groups.has(node.value))
|
|
22306
|
-
groups.set(node.value, await storedChatId(deps.messenger, node.value, store, account, { includeLeft: true }));
|
|
22307
|
-
const tags = await taskTagFilters(store, query);
|
|
22308
|
-
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;
|
|
22309
22431
|
const rows = await store.tasks.query(taskAccount(account), where, { limit: limit + 1, offset });
|
|
22310
22432
|
const shown = rows.slice(0, limit);
|
|
22311
22433
|
return {
|
|
@@ -22552,13 +22674,9 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
|
|
|
22552
22674
|
await owned(store, account, subject);
|
|
22553
22675
|
return store.tasks.similar({ task: subject }, options);
|
|
22554
22676
|
}), "similar"),
|
|
22555
|
-
stats: /* @__PURE__ */ __name((
|
|
22556
|
-
const group = await groupOf(store, account,
|
|
22557
|
-
|
|
22558
|
-
account: taskAccount(account),
|
|
22559
|
-
...filter.type === void 0 ? {} : { kind: filter.type }
|
|
22560
|
-
});
|
|
22561
|
-
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));
|
|
22562
22680
|
}), "stats")
|
|
22563
22681
|
};
|
|
22564
22682
|
}, "tasksService");
|
|
@@ -22609,7 +22727,74 @@ var taskView = /* @__PURE__ */ __name(async (store, account, task2) => {
|
|
|
22609
22727
|
};
|
|
22610
22728
|
}, "taskView");
|
|
22611
22729
|
|
|
22612
|
-
// 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
|
|
22613
22798
|
var chatCoverage = /* @__PURE__ */ __name(async (store, account, chatIds) => {
|
|
22614
22799
|
const ids = [...new Set(chatIds)];
|
|
22615
22800
|
if (ids.length === 0)
|
|
@@ -22635,7 +22820,7 @@ var chatCoverage = /* @__PURE__ */ __name(async (store, account, chatIds) => {
|
|
|
22635
22820
|
}));
|
|
22636
22821
|
}, "chatCoverage");
|
|
22637
22822
|
|
|
22638
|
-
// 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
|
|
22639
22824
|
var DAY = 864e5;
|
|
22640
22825
|
var AGENDA_DEFAULTS = { unanswered: DAY, waiting: 7 * DAY };
|
|
22641
22826
|
var CLAIMS = ["none", "mine", "others", "any"];
|
|
@@ -22669,7 +22854,7 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
|
|
|
22669
22854
|
const [store, account] = [await deps.store(), await deps.account()];
|
|
22670
22855
|
const at = now();
|
|
22671
22856
|
const parts = query ? split(query) : { tasks: void 0, chats: void 0 };
|
|
22672
|
-
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) => {
|
|
22673
22858
|
if (error instanceof Error && "code" in error && error.code === "not_found")
|
|
22674
22859
|
return [];
|
|
22675
22860
|
throw error;
|
|
@@ -22706,9 +22891,11 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
|
|
|
22706
22891
|
createdAt: task2.createdAt,
|
|
22707
22892
|
assignees
|
|
22708
22893
|
}));
|
|
22709
|
-
const
|
|
22710
|
-
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");
|
|
22711
22897
|
const chats = activity.chats.map(({ lastMessageId, ...chat }) => ({
|
|
22898
|
+
turn: turnOf({ lastMessageId, ...chat }),
|
|
22712
22899
|
...chat,
|
|
22713
22900
|
lastMessage: lastMessageId === null ? null : formatLocator({
|
|
22714
22901
|
provider: account.provider,
|
|
@@ -22720,12 +22907,14 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
|
|
|
22720
22907
|
}));
|
|
22721
22908
|
const silentFor = /* @__PURE__ */ __name((chat) => at - Date.parse(chat.lastMessageAt), "silentFor");
|
|
22722
22909
|
const shown = {
|
|
22723
|
-
owed: chats.filter((chat) => chat.
|
|
22724
|
-
waiting: chats.filter((chat) => chat.
|
|
22725
|
-
|
|
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)
|
|
22726
22914
|
};
|
|
22727
|
-
const
|
|
22728
|
-
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");
|
|
22729
22918
|
const inList = new Set((await store.tasks.categories()).map(({ name }) => name));
|
|
22730
22919
|
const unlisted = /* @__PURE__ */ new Map();
|
|
22731
22920
|
for (const { category } of open7)
|
|
@@ -22878,7 +23067,7 @@ var agendaItem = /* @__PURE__ */ __name((shown) => {
|
|
|
22878
23067
|
};
|
|
22879
23068
|
}, "agendaItem");
|
|
22880
23069
|
|
|
22881
|
-
// 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
|
|
22882
23071
|
var contextSourceKey = /* @__PURE__ */ __name((source) => JSON.stringify([source.kind, source.accountId, source.provider, source.account]), "contextSourceKey");
|
|
22883
23072
|
var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
|
|
22884
23073
|
const fail2 = /* @__PURE__ */ __name(() => {
|
|
@@ -22901,33 +23090,33 @@ var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
|
|
|
22901
23090
|
if (big !== void 0 && (!big || page.items.length || typeof big.ref !== "string" || !Number.isSafeInteger(big.bytes) || big.bytes <= maxReadBytes))
|
|
22902
23091
|
fail2();
|
|
22903
23092
|
let actual = 0;
|
|
22904
|
-
for (const
|
|
22905
|
-
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")
|
|
22906
23095
|
fail2();
|
|
22907
|
-
if (!Number.isSafeInteger(
|
|
23096
|
+
if (!Number.isSafeInteger(item2.at) || item2.at < after || item2.at >= before2 || !Number.isSafeInteger(item2.updatedAt) || item2.updatedAt < 0)
|
|
22908
23097
|
fail2();
|
|
22909
|
-
if (
|
|
23098
|
+
if (item2.revision !== null && (!Number.isSafeInteger(item2.revision) || item2.revision < 1))
|
|
22910
23099
|
fail2();
|
|
22911
|
-
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"))
|
|
22912
23101
|
fail2();
|
|
22913
|
-
const sender =
|
|
23102
|
+
const sender = item2.sender;
|
|
22914
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)))
|
|
22915
23104
|
fail2();
|
|
22916
|
-
const text2 = [
|
|
23105
|
+
const text2 = [item2.text, item2.title, item2.url, item2.provider, item2.account, item2.timeKind];
|
|
22917
23106
|
if (text2.some((value) => value !== null && typeof value !== "string"))
|
|
22918
23107
|
fail2();
|
|
22919
23108
|
if (source.kind === "document") {
|
|
22920
|
-
const id2 = Number(
|
|
22921
|
-
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}`)
|
|
22922
23111
|
fail2();
|
|
22923
23112
|
} else if (source.kind === "meeting") {
|
|
22924
|
-
const reference = parseMeetingReference(
|
|
22925
|
-
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)
|
|
22926
23115
|
fail2();
|
|
22927
|
-
text2.push(
|
|
23116
|
+
text2.push(item2.ref);
|
|
22928
23117
|
} else {
|
|
22929
|
-
const locator = parseLocator(
|
|
22930
|
-
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)
|
|
22931
23120
|
fail2();
|
|
22932
23121
|
text2.push(locator.chat, locator.message);
|
|
22933
23122
|
}
|
|
@@ -22942,7 +23131,7 @@ var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
|
|
|
22942
23131
|
}
|
|
22943
23132
|
}, "validateContextEvidencePage");
|
|
22944
23133
|
|
|
22945
|
-
// 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
|
|
22946
23135
|
var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
|
|
22947
23136
|
if (!limits || typeof limits !== "object" || Array.isArray(limits))
|
|
22948
23137
|
throw new CliError("validation_error", "limits needs a context read allowance");
|
|
@@ -22995,7 +23184,7 @@ var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
|
|
|
22995
23184
|
};
|
|
22996
23185
|
}, "contextReadBudget");
|
|
22997
23186
|
|
|
22998
|
-
// 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
|
|
22999
23188
|
var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits) => {
|
|
23000
23189
|
if (!port || typeof port.read !== "function")
|
|
23001
23190
|
throw new CliError("configuration_error", "context evidence reader is unavailable");
|
|
@@ -23039,7 +23228,7 @@ var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits)
|
|
|
23039
23228
|
};
|
|
23040
23229
|
}, "createContextEvidenceReader");
|
|
23041
23230
|
|
|
23042
|
-
// 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
|
|
23043
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");
|
|
23044
23233
|
var excerpt = /* @__PURE__ */ __name((text2, query, size2 = 240, options = {}) => {
|
|
23045
23234
|
const flat = text2.replace(/\s+/g, " ").trim();
|
|
@@ -23055,7 +23244,7 @@ var excerpt = /* @__PURE__ */ __name((text2, query, size2 = 240, options = {}) =
|
|
|
23055
23244
|
}, "excerpt");
|
|
23056
23245
|
var withExcerpt = /* @__PURE__ */ __name(({ matchedText, ...hit }, query) => ({ ...hit, excerpt: excerpt(matchedText ?? hit.text, query) }), "withExcerpt");
|
|
23057
23246
|
|
|
23058
|
-
// 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
|
|
23059
23248
|
var BUILT_IN_PURPOSES = ["work", "sales", "support", "other"];
|
|
23060
23249
|
var DEFAULT_PURPOSES = ["work"];
|
|
23061
23250
|
var LINK_PURPOSE = "work";
|
|
@@ -23085,7 +23274,7 @@ var purposeList = /* @__PURE__ */ __name((value, previous = []) => [
|
|
|
23085
23274
|
...value.split(",").map((one) => one.trim()).filter(Boolean)
|
|
23086
23275
|
], "purposeList");
|
|
23087
23276
|
|
|
23088
|
-
// 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
|
|
23089
23278
|
var storedMessageNeighbours = /* @__PURE__ */ __name((messages) => ({
|
|
23090
23279
|
async around(ref, window3) {
|
|
23091
23280
|
const at = parseLocator(ref);
|
|
@@ -23119,35 +23308,35 @@ var documentMatches = /* @__PURE__ */ __name((text2, queries, window3) => {
|
|
|
23119
23308
|
var attachNeighbours = /* @__PURE__ */ __name(async (items, reader, window3, budget, known2, signal) => {
|
|
23120
23309
|
if (!reader || window3.before + window3.after === 0)
|
|
23121
23310
|
return;
|
|
23122
|
-
for (const
|
|
23123
|
-
if (
|
|
23311
|
+
for (const item2 of items) {
|
|
23312
|
+
if (item2.kind !== "message" && item2.kind !== "mail")
|
|
23124
23313
|
continue;
|
|
23125
23314
|
if (budget.remaining() <= 0) {
|
|
23126
|
-
|
|
23127
|
-
|
|
23315
|
+
item2.around = null;
|
|
23316
|
+
item2.aroundIssue = "read-bytes";
|
|
23128
23317
|
continue;
|
|
23129
23318
|
}
|
|
23130
23319
|
signal?.throwIfAborted();
|
|
23131
23320
|
try {
|
|
23132
|
-
const rows = await reader.around(
|
|
23321
|
+
const rows = await reader.around(item2.ref, window3);
|
|
23133
23322
|
const around = [];
|
|
23134
23323
|
for (const row of rows.slice(0, window3.before + window3.after)) {
|
|
23135
23324
|
const text2 = excerpt(row.text, "", 200);
|
|
23136
23325
|
const bytes2 = Buffer.byteLength(text2);
|
|
23137
23326
|
if (bytes2 > budget.remaining()) {
|
|
23138
|
-
|
|
23327
|
+
item2.aroundIssue = "read-bytes";
|
|
23139
23328
|
break;
|
|
23140
23329
|
}
|
|
23141
23330
|
budget.charge(bytes2);
|
|
23142
23331
|
around.push({ ...row, text: text2, found: known2(row.ref) });
|
|
23143
23332
|
}
|
|
23144
|
-
|
|
23333
|
+
item2.around = around;
|
|
23145
23334
|
} catch (error) {
|
|
23146
23335
|
signal?.throwIfAborted();
|
|
23147
23336
|
if (!(error instanceof CliError))
|
|
23148
23337
|
throw error;
|
|
23149
|
-
|
|
23150
|
-
|
|
23338
|
+
item2.around = null;
|
|
23339
|
+
item2.aroundIssue = error.code;
|
|
23151
23340
|
}
|
|
23152
23341
|
}
|
|
23153
23342
|
}, "attachNeighbours");
|
|
@@ -23180,7 +23369,7 @@ var storedNeighbours = /* @__PURE__ */ __name((store) => {
|
|
|
23180
23369
|
};
|
|
23181
23370
|
}, "storedNeighbours");
|
|
23182
23371
|
|
|
23183
|
-
// 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
|
|
23184
23373
|
import { createHash as createHash2 } from "node:crypto";
|
|
23185
23374
|
var DAY2 = 864e5;
|
|
23186
23375
|
var MAX_TIME = 864e13;
|
|
@@ -23496,7 +23685,7 @@ var decodeCheckpoint = /* @__PURE__ */ __name((text2, plan) => {
|
|
|
23496
23685
|
return value;
|
|
23497
23686
|
}, "decodeCheckpoint");
|
|
23498
23687
|
|
|
23499
|
-
// 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
|
|
23500
23689
|
var terminal = /* @__PURE__ */ new Set(["done", "unavailable", "failed"]);
|
|
23501
23690
|
var PAGE3 = 20;
|
|
23502
23691
|
var PEOPLE = 20;
|
|
@@ -23643,27 +23832,27 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
23643
23832
|
matchedAgain.set(ref, (matchedAgain.get(ref) ?? /* @__PURE__ */ new Set()).add(lane.id));
|
|
23644
23833
|
return true;
|
|
23645
23834
|
}, "again");
|
|
23646
|
-
const take = /* @__PURE__ */ __name((
|
|
23647
|
-
if (again(
|
|
23835
|
+
const take = /* @__PURE__ */ __name((item2, lane, kind, source) => {
|
|
23836
|
+
if (again(item2.ref, lane))
|
|
23648
23837
|
return;
|
|
23649
|
-
seen.add(seenKey(
|
|
23650
|
-
const short = excerpt(
|
|
23651
|
-
const fingerprint = contextEvidenceFingerprint(
|
|
23652
|
-
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;
|
|
23653
23842
|
if (sender)
|
|
23654
|
-
senderOf.set(
|
|
23843
|
+
senderOf.set(item2.ref, sender);
|
|
23655
23844
|
const entry = {
|
|
23656
23845
|
...stored,
|
|
23657
23846
|
kind,
|
|
23658
23847
|
source,
|
|
23659
23848
|
text: short,
|
|
23660
|
-
textTruncated: short !==
|
|
23849
|
+
textTruncated: short !== item2.text.replace(/\s+/g, " ").trim(),
|
|
23661
23850
|
fingerprint,
|
|
23662
23851
|
lanes: [lane.id],
|
|
23663
23852
|
context: contextOf(lane)
|
|
23664
23853
|
};
|
|
23665
23854
|
if (kind === "document" && lane.query !== null && plan.around.before + plan.around.after) {
|
|
23666
|
-
const passage = documentMatches(
|
|
23855
|
+
const passage = documentMatches(item2.text, queries, plan.around);
|
|
23667
23856
|
entry.around = [];
|
|
23668
23857
|
entry.moreMatches = passage.moreMatches;
|
|
23669
23858
|
for (const part of passage.around) {
|
|
@@ -23673,10 +23862,10 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
23673
23862
|
break;
|
|
23674
23863
|
}
|
|
23675
23864
|
usage.aroundBytes += bytes2;
|
|
23676
|
-
entry.around.push({ ref:
|
|
23865
|
+
entry.around.push({ ref: item2.ref, at: item2.at, sender: null, ...part });
|
|
23677
23866
|
}
|
|
23678
23867
|
}
|
|
23679
|
-
byRef.set(
|
|
23868
|
+
byRef.set(item2.ref, entry);
|
|
23680
23869
|
items.push(entry);
|
|
23681
23870
|
usage.items++;
|
|
23682
23871
|
if (linkedLanes.has(lane.id))
|
|
@@ -23743,8 +23932,8 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
23743
23932
|
}
|
|
23744
23933
|
state.pages++;
|
|
23745
23934
|
state.code = page.coverage.index === "ready" ? null : `index-${page.coverage.index}`;
|
|
23746
|
-
for (const
|
|
23747
|
-
take(
|
|
23935
|
+
for (const item2 of page.items)
|
|
23936
|
+
take(item2, unit.lane, unit.source.kind, unit.sourceIndex);
|
|
23748
23937
|
if (!page.coverage.available)
|
|
23749
23938
|
state.state = "unavailable";
|
|
23750
23939
|
else if (page.next) {
|
|
@@ -23768,7 +23957,7 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
23768
23957
|
}
|
|
23769
23958
|
await attachNeighbours(
|
|
23770
23959
|
// A linked chat's neighbours are already its own lane's evidence.
|
|
23771
|
-
items.filter((
|
|
23960
|
+
items.filter((item2) => item2.context !== "linked-chat"),
|
|
23772
23961
|
ports.neighbours,
|
|
23773
23962
|
plan.around,
|
|
23774
23963
|
{
|
|
@@ -23879,8 +24068,8 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
23879
24068
|
}, "gatherProjectEvidence");
|
|
23880
24069
|
var peopleOf = /* @__PURE__ */ __name((items, senderOf) => {
|
|
23881
24070
|
const byKey = /* @__PURE__ */ new Map();
|
|
23882
|
-
for (const
|
|
23883
|
-
const sender = senderOf.get(
|
|
24071
|
+
for (const item2 of items) {
|
|
24072
|
+
const sender = senderOf.get(item2.ref);
|
|
23884
24073
|
if (!sender || sender.owner)
|
|
23885
24074
|
continue;
|
|
23886
24075
|
const key = sender.person ?? JSON.stringify([sender.provider, sender.id]);
|
|
@@ -23892,15 +24081,15 @@ var peopleOf = /* @__PURE__ */ __name((items, senderOf) => {
|
|
|
23892
24081
|
contexts: {}
|
|
23893
24082
|
};
|
|
23894
24083
|
byKey.set(key, found);
|
|
23895
|
-
if (!found.identities.some((i) => i.provider === sender.provider && i.account ===
|
|
23896
|
-
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 });
|
|
23897
24086
|
found.items++;
|
|
23898
|
-
found.contexts[
|
|
24087
|
+
found.contexts[item2.context] = (found.contexts[item2.context] ?? 0) + 1;
|
|
23899
24088
|
}
|
|
23900
24089
|
return [...byKey.values()].sort((a, b) => b.items - a.items || a.name.localeCompare(b.name));
|
|
23901
24090
|
}, "peopleOf");
|
|
23902
24091
|
|
|
23903
|
-
// 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
|
|
23904
24093
|
var normalizedText = /* @__PURE__ */ __name((text2) => text2.normalize("NFKC").toLowerCase().replace(/\s+/gu, " "), "normalizedText");
|
|
23905
24094
|
var termsOf = /* @__PURE__ */ __name((entry) => [
|
|
23906
24095
|
{ name: entry.name, kind: "canonical" },
|
|
@@ -23944,7 +24133,7 @@ var matchVocabularyTerms = /* @__PURE__ */ __name((catalog, texts) => {
|
|
|
23944
24133
|
return result.sort((a, b) => Number(a.entry.id) - Number(b.entry.id));
|
|
23945
24134
|
}, "matchVocabularyTerms");
|
|
23946
24135
|
|
|
23947
|
-
// 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
|
|
23948
24137
|
var KINDS = ["project", "tag", "topic"];
|
|
23949
24138
|
var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering, options = {}) => {
|
|
23950
24139
|
if (typeof vocabulary?.vocabulary !== "function")
|
|
@@ -23952,9 +24141,9 @@ var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering,
|
|
|
23952
24141
|
const limit = options.limit ?? 50;
|
|
23953
24142
|
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 200)
|
|
23954
24143
|
throw new CliError("validation_error", "limit must be a whole number from 1 to 200", { param: "limit" });
|
|
23955
|
-
const texts = gathering.items.flatMap((
|
|
23956
|
-
{ text: `${
|
|
23957
|
-
...(
|
|
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" } }))
|
|
23958
24147
|
]);
|
|
23959
24148
|
const items = [];
|
|
23960
24149
|
const vocabularyFingerprints = {};
|
|
@@ -23999,7 +24188,7 @@ var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering,
|
|
|
23999
24188
|
};
|
|
24000
24189
|
}, "findEvidenceMentions");
|
|
24001
24190
|
|
|
24002
|
-
// 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
|
|
24003
24192
|
var storedChatCount = /* @__PURE__ */ __name((store) => async (account, chatId, { since, until }) => {
|
|
24004
24193
|
const window3 = { since: new Date(since).toISOString(), until: new Date(until - 1).toISOString() };
|
|
24005
24194
|
const [messages, newest, oldest] = await Promise.all([
|
|
@@ -24250,9 +24439,9 @@ var gatherStoredProject = /* @__PURE__ */ __name(async (store, input) => {
|
|
|
24250
24439
|
if (proposed && lane.kinds.includes("sender"))
|
|
24251
24440
|
proposedLanes.set(lane.id, proposed);
|
|
24252
24441
|
}
|
|
24253
|
-
const items = gathered.items.map((
|
|
24254
|
-
const proposed =
|
|
24255
|
-
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;
|
|
24256
24445
|
});
|
|
24257
24446
|
const linkedRows = gathered.linkedChats.map((row) => {
|
|
24258
24447
|
const link4 = byRef.get(row.ref);
|
|
@@ -24305,18 +24494,18 @@ var purposeHintOf = /* @__PURE__ */ __name((linked, rows, of) => {
|
|
|
24305
24494
|
return { chat: top.ref, relationship: link4.relationship, items, of };
|
|
24306
24495
|
}, "purposeHintOf");
|
|
24307
24496
|
|
|
24308
|
-
// 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
|
|
24309
24498
|
import { setTimeout as sleep3 } from "node:timers/promises";
|
|
24310
24499
|
|
|
24311
|
-
// 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
|
|
24312
24501
|
import { lstat } from "node:fs/promises";
|
|
24313
24502
|
|
|
24314
|
-
// 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
|
|
24315
24504
|
import { createHash as createHash4, randomUUID as randomUUID2 } from "node:crypto";
|
|
24316
24505
|
import { open as open3, rename as rename2, unlink as unlink2 } from "node:fs/promises";
|
|
24317
24506
|
import { join as join3 } from "node:path";
|
|
24318
24507
|
|
|
24319
|
-
// 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
|
|
24320
24509
|
import { createHash as createHash3 } from "node:crypto";
|
|
24321
24510
|
var metadataLimit = 16384;
|
|
24322
24511
|
var partialIdentity = /* @__PURE__ */ __name((locator) => JSON.stringify([locator.provider, locator.account, locator.occurrenceId, locator.assetId]), "partialIdentity");
|
|
@@ -24376,7 +24565,7 @@ var readPartialMetadata = /* @__PURE__ */ __name(async (path, locator, maxBytes,
|
|
|
24376
24565
|
}
|
|
24377
24566
|
}, "readPartialMetadata");
|
|
24378
24567
|
|
|
24379
|
-
// 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
|
|
24380
24569
|
import { randomUUID } from "node:crypto";
|
|
24381
24570
|
import { open as open2, rename, unlink } from "node:fs/promises";
|
|
24382
24571
|
import { join as join2 } from "node:path";
|
|
@@ -24468,7 +24657,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
|
|
|
24468
24657
|
};
|
|
24469
24658
|
}, "partialWriter");
|
|
24470
24659
|
|
|
24471
|
-
// 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
|
|
24472
24661
|
var NativeRecordingPartialStore = class {
|
|
24473
24662
|
static {
|
|
24474
24663
|
__name(this, "NativeRecordingPartialStore");
|
|
@@ -24575,21 +24764,21 @@ var NativeRecordingPartialStore = class {
|
|
|
24575
24764
|
}
|
|
24576
24765
|
};
|
|
24577
24766
|
|
|
24578
|
-
// 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
|
|
24579
24768
|
import { createHash as createHash5 } from "node:crypto";
|
|
24580
24769
|
import { link as link2 } from "node:fs/promises";
|
|
24581
24770
|
import { basename as basename2, dirname as dirname2, join as join5, resolve as resolve2 } from "node:path";
|
|
24582
24771
|
|
|
24583
|
-
// 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
|
|
24584
24773
|
import { unlink as unlink3 } from "node:fs/promises";
|
|
24585
|
-
var verifiedPublicationFile = /* @__PURE__ */ __name(async (path,
|
|
24774
|
+
var verifiedPublicationFile = /* @__PURE__ */ __name(async (path, expected2, signal, writable = false) => {
|
|
24586
24775
|
signal?.throwIfAborted();
|
|
24587
24776
|
const file2 = await openOrdinaryFile(path, { writable });
|
|
24588
24777
|
try {
|
|
24589
|
-
if ((await file2.stat()).size !==
|
|
24778
|
+
if ((await file2.stat()).size !== expected2.size)
|
|
24590
24779
|
throw new CliError("validation_error", "recording recovery final checksum does not match");
|
|
24591
|
-
const actual = await fingerprintPartial(file2, signal,
|
|
24592
|
-
if (actual.offset !==
|
|
24780
|
+
const actual = await fingerprintPartial(file2, signal, expected2.size);
|
|
24781
|
+
if (actual.offset !== expected2.size || actual.sha256 !== expected2.sha256)
|
|
24593
24782
|
throw new CliError("validation_error", "recording recovery final checksum does not match");
|
|
24594
24783
|
return file2;
|
|
24595
24784
|
} catch (error) {
|
|
@@ -24615,7 +24804,7 @@ var commitPublication = /* @__PURE__ */ __name(async (root, partialPath, finalPa
|
|
|
24615
24804
|
signal?.throwIfAborted();
|
|
24616
24805
|
}, "commitPublication");
|
|
24617
24806
|
|
|
24618
|
-
// 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
|
|
24619
24808
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
24620
24809
|
import { open as open4, rename as rename3, unlink as unlink4 } from "node:fs/promises";
|
|
24621
24810
|
import { join as join4 } from "node:path";
|
|
@@ -24688,7 +24877,7 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
|
|
|
24688
24877
|
}
|
|
24689
24878
|
}, "writePublicationJournal");
|
|
24690
24879
|
|
|
24691
|
-
// 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
|
|
24692
24881
|
var NativeRecordingPublication = class {
|
|
24693
24882
|
static {
|
|
24694
24883
|
__name(this, "NativeRecordingPublication");
|
|
@@ -24715,13 +24904,13 @@ var NativeRecordingPublication = class {
|
|
|
24715
24904
|
write(value) {
|
|
24716
24905
|
return writePublicationJournal(this.root, this.journalPath, this.options.prefix, value, this.options.codec, this.options.metadataLimit, this.options.signal);
|
|
24717
24906
|
}
|
|
24718
|
-
validate(partialPath,
|
|
24719
|
-
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))
|
|
24720
24909
|
throw new CliError("validation_error", "invalid recording publication evidence");
|
|
24721
24910
|
this.options.signal?.throwIfAborted();
|
|
24722
24911
|
}
|
|
24723
|
-
async publish(partialPath,
|
|
24724
|
-
const proof = { ...
|
|
24912
|
+
async publish(partialPath, expected2, commit) {
|
|
24913
|
+
const proof = { ...expected2 };
|
|
24725
24914
|
this.validate(partialPath, proof);
|
|
24726
24915
|
const partial = await verifiedPublicationFile(partialPath, proof, this.options.signal, true);
|
|
24727
24916
|
try {
|
|
@@ -24739,14 +24928,14 @@ var NativeRecordingPublication = class {
|
|
|
24739
24928
|
const intent = await this.read();
|
|
24740
24929
|
if (intent === null)
|
|
24741
24930
|
throw new CliError("validation_error", "recording path already exists without a verified manifest or scoped recovery record");
|
|
24742
|
-
const
|
|
24743
|
-
this.validate(partialPath,
|
|
24931
|
+
const expected2 = { ...this.options.evidence(intent) };
|
|
24932
|
+
this.validate(partialPath, expected2);
|
|
24744
24933
|
const completed = await loadPartial();
|
|
24745
|
-
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)
|
|
24746
24935
|
throw new CliError("validation_error", "recording recovery checkpoint does not prove this completed asset");
|
|
24747
|
-
const partial = await verifiedPublicationFile(partialPath,
|
|
24936
|
+
const partial = await verifiedPublicationFile(partialPath, expected2, this.options.signal);
|
|
24748
24937
|
try {
|
|
24749
|
-
const final = await verifiedPublicationFile(this.finalPath,
|
|
24938
|
+
const final = await verifiedPublicationFile(this.finalPath, expected2, this.options.signal, true);
|
|
24750
24939
|
try {
|
|
24751
24940
|
await final.sync();
|
|
24752
24941
|
this.options.signal?.throwIfAborted();
|
|
@@ -24761,7 +24950,7 @@ var NativeRecordingPublication = class {
|
|
|
24761
24950
|
}
|
|
24762
24951
|
};
|
|
24763
24952
|
|
|
24764
|
-
// 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
|
|
24765
24954
|
import { createHash as createHash6 } from "node:crypto";
|
|
24766
24955
|
import { readdir } from "node:fs/promises";
|
|
24767
24956
|
import { isAbsolute as isAbsolute2, join as join6, resolve as resolve3 } from "node:path";
|
|
@@ -24848,7 +25037,7 @@ var commitMediaEntry = /* @__PURE__ */ __name((root, one, beforePublish) => writ
|
|
|
24848
25037
|
beforePublish
|
|
24849
25038
|
}), "commitMediaEntry");
|
|
24850
25039
|
|
|
24851
|
-
// 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
|
|
24852
25041
|
var validator = '"media-completed-v1"';
|
|
24853
25042
|
var maximumFileBytes = 64 * 1024 * 1024 * 1024;
|
|
24854
25043
|
var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file2, beforeWrite, signal, metadata = {}) => {
|
|
@@ -24949,7 +25138,7 @@ var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file2
|
|
|
24949
25138
|
return entry;
|
|
24950
25139
|
}, "archiveMediaFile");
|
|
24951
25140
|
|
|
24952
|
-
// 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
|
|
24953
25142
|
import { mkdir, realpath } from "node:fs/promises";
|
|
24954
25143
|
import { join as join7, resolve as resolve4 } from "node:path";
|
|
24955
25144
|
var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
|
|
@@ -25016,7 +25205,7 @@ var withMediaArchiveLocks = /* @__PURE__ */ __name(async (directory2, signal, ru
|
|
|
25016
25205
|
throw new CliError("validation_error", "archive locations changed during locking; run the command again");
|
|
25017
25206
|
}, "withMediaArchiveLocks");
|
|
25018
25207
|
|
|
25019
|
-
// 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
|
|
25020
25209
|
var validateMediaSince = /* @__PURE__ */ __name((value, flag = "--since-time") => {
|
|
25021
25210
|
if (value === void 0)
|
|
25022
25211
|
return void 0;
|
|
@@ -25169,7 +25358,7 @@ var archiveMedia = /* @__PURE__ */ __name(async (ports, options) => {
|
|
|
25169
25358
|
}, { create: true });
|
|
25170
25359
|
}, "archiveMedia");
|
|
25171
25360
|
|
|
25172
|
-
// 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
|
|
25173
25362
|
import { realpath as realpath2, unlink as unlink5 } from "node:fs/promises";
|
|
25174
25363
|
import { basename as basename3, dirname as dirname3, join as join8, resolve as resolve5 } from "node:path";
|
|
25175
25364
|
var canonicalDestination = /* @__PURE__ */ __name(async (directory2) => {
|
|
@@ -25322,7 +25511,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
|
|
|
25322
25511
|
}, { additional: [target2], createAdditional: !options.dryRun });
|
|
25323
25512
|
}, "moveMediaArchive");
|
|
25324
25513
|
|
|
25325
|
-
// 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
|
|
25326
25515
|
var bytesOf = /* @__PURE__ */ __name((model) => model.files.reduce((sum2, file2) => sum2 + file2.bytes, 0), "bytesOf");
|
|
25327
25516
|
var nativeRuntime = /* @__PURE__ */ __name(async ({ env, progress = /* @__PURE__ */ __name(() => {
|
|
25328
25517
|
}, "progress") }) => {
|
|
@@ -25345,7 +25534,7 @@ var downloadTextModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
|
|
|
25345
25534
|
}
|
|
25346
25535
|
await nativeRuntime({ env, progress });
|
|
25347
25536
|
progress(`${model.id}: loading it once to check it works`);
|
|
25348
|
-
const { openEmbedder: openEmbedder2 } = await import("./embed-
|
|
25537
|
+
const { openEmbedder: openEmbedder2 } = await import("./embed-EN4UTLV5.js");
|
|
25349
25538
|
const embedder = await openEmbedder2(model, directory2);
|
|
25350
25539
|
try {
|
|
25351
25540
|
const [vector] = await embedder.embed(["check"], "query");
|
|
@@ -25366,7 +25555,7 @@ var downloadRerankModel = /* @__PURE__ */ __name(async (id2, { env, progress = /
|
|
|
25366
25555
|
}
|
|
25367
25556
|
await nativeRuntime({ env, progress });
|
|
25368
25557
|
progress(`${model.id}: loading it once to check it works`);
|
|
25369
|
-
const { openReranker } = await import("./rerank-
|
|
25558
|
+
const { openReranker } = await import("./rerank-NWFIV7OF.js");
|
|
25370
25559
|
const reranker = await openReranker(model, directory2);
|
|
25371
25560
|
try {
|
|
25372
25561
|
await reranker.score("check", ["check"]);
|
|
@@ -25384,7 +25573,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
|
|
|
25384
25573
|
await installFiles(placedImage(model, directory2), { progress });
|
|
25385
25574
|
}
|
|
25386
25575
|
progress(`${model.id}: loading it once to check it works`);
|
|
25387
|
-
const { openPictureEmbedder } = await import("./embedder-
|
|
25576
|
+
const { openPictureEmbedder } = await import("./embedder-HEKHRL7E.js");
|
|
25388
25577
|
const embedder = await openPictureEmbedder(model, directory2);
|
|
25389
25578
|
try {
|
|
25390
25579
|
const vector = await embedder.embedQuery("check");
|
|
@@ -25396,7 +25585,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
|
|
|
25396
25585
|
return { model, directory: directory2 };
|
|
25397
25586
|
}, "downloadImageModel");
|
|
25398
25587
|
|
|
25399
|
-
// 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
|
|
25400
25589
|
var MONEY_REQUEST = "money-request";
|
|
25401
25590
|
var MONEY_DONE = "money-done";
|
|
25402
25591
|
var PROMISE = "promise";
|
|
@@ -25430,10 +25619,10 @@ var MONEY_WORDS = [
|
|
|
25430
25619
|
}
|
|
25431
25620
|
];
|
|
25432
25621
|
|
|
25433
|
-
// 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
|
|
25434
25623
|
var moneyClassesOf = /* @__PURE__ */ __name((text2) => listsHit(text2, MONEY_WORDS), "moneyClassesOf");
|
|
25435
25624
|
|
|
25436
|
-
// 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
|
|
25437
25626
|
var words = /* @__PURE__ */ __name((forms) => new RegExp(`(?<![\\p{L}\\p{N}])(?:${forms.join("|")})(?![\\p{L}\\p{N}])`, "iu"), "words");
|
|
25438
25627
|
var MONEY_DONE_FORMS = words([
|
|
25439
25628
|
"\u043E\u043F\u043B\u0430\u0442\u0438\u043B[\u0430\u0438]?",
|
|
@@ -25473,7 +25662,7 @@ var PROMISE_FORMS = words([
|
|
|
25473
25662
|
"estar\xE1 listo"
|
|
25474
25663
|
]);
|
|
25475
25664
|
|
|
25476
|
-
// 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
|
|
25477
25666
|
var EXCERPT_CHARS = 80;
|
|
25478
25667
|
var excerpt2 = /* @__PURE__ */ __name((text2) => {
|
|
25479
25668
|
const flat = text2.replace(/\s+/g, " ").trim();
|
|
@@ -25495,7 +25684,7 @@ var whoOf = /* @__PURE__ */ __name((message) => ({
|
|
|
25495
25684
|
var fromOwner = /* @__PURE__ */ __name((message) => message.outgoing === true, "fromOwner");
|
|
25496
25685
|
var day = /* @__PURE__ */ __name((at) => new Date(at).toISOString().slice(0, 10), "day");
|
|
25497
25686
|
|
|
25498
|
-
// 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
|
|
25499
25688
|
var MONEY = DEFAULT_TASK_CATEGORIES.filter((category) => category.name === "money");
|
|
25500
25689
|
var verbOf = /* @__PURE__ */ __name((text2) => {
|
|
25501
25690
|
if (MONEY_DONE_FORMS.test(text2))
|
|
@@ -25572,16 +25761,16 @@ var amounts = {
|
|
|
25572
25761
|
};
|
|
25573
25762
|
});
|
|
25574
25763
|
}, "read"),
|
|
25575
|
-
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")
|
|
25576
25765
|
};
|
|
25577
25766
|
|
|
25578
|
-
// 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
|
|
25579
25768
|
var children = {
|
|
25580
25769
|
id: "children",
|
|
25581
25770
|
version: 1,
|
|
25582
25771
|
scope: "project",
|
|
25583
25772
|
read: /* @__PURE__ */ __name(async (context2) => {
|
|
25584
|
-
const
|
|
25773
|
+
const item2 = /* @__PURE__ */ __name((data) => ({
|
|
25585
25774
|
signal: "children",
|
|
25586
25775
|
chat: null,
|
|
25587
25776
|
at: null,
|
|
@@ -25591,7 +25780,7 @@ var children = {
|
|
|
25591
25780
|
data
|
|
25592
25781
|
}), "item");
|
|
25593
25782
|
return [
|
|
25594
|
-
...context2.project.children.map((child) =>
|
|
25783
|
+
...context2.project.children.map((child) => item2({
|
|
25595
25784
|
child: child.ref,
|
|
25596
25785
|
key: child.key,
|
|
25597
25786
|
name: child.name,
|
|
@@ -25599,12 +25788,12 @@ var children = {
|
|
|
25599
25788
|
chats: context2.chats.filter((chat) => chat.project === child.ref).length,
|
|
25600
25789
|
cut: null
|
|
25601
25790
|
})),
|
|
25602
|
-
...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 }))
|
|
25603
25792
|
];
|
|
25604
25793
|
}, "read")
|
|
25605
25794
|
};
|
|
25606
25795
|
|
|
25607
|
-
// 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
|
|
25608
25797
|
var coverage = {
|
|
25609
25798
|
id: "coverage",
|
|
25610
25799
|
version: 1,
|
|
@@ -25630,10 +25819,10 @@ var coverage = {
|
|
|
25630
25819
|
}
|
|
25631
25820
|
];
|
|
25632
25821
|
}, "read"),
|
|
25633
|
-
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")
|
|
25634
25823
|
};
|
|
25635
25824
|
|
|
25636
|
-
// 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
|
|
25637
25826
|
var lastMessage = {
|
|
25638
25827
|
id: "last-message",
|
|
25639
25828
|
version: 1,
|
|
@@ -25642,7 +25831,7 @@ var lastMessage = {
|
|
|
25642
25831
|
const last = chat?.messages.at(-1);
|
|
25643
25832
|
if (!chat || !last)
|
|
25644
25833
|
return [];
|
|
25645
|
-
const
|
|
25834
|
+
const item2 = {
|
|
25646
25835
|
signal: "last-message",
|
|
25647
25836
|
chat: chat.ref,
|
|
25648
25837
|
at: last.timestamp,
|
|
@@ -25651,33 +25840,61 @@ var lastMessage = {
|
|
|
25651
25840
|
basis: "store",
|
|
25652
25841
|
data: {}
|
|
25653
25842
|
};
|
|
25654
|
-
return [
|
|
25843
|
+
return [item2];
|
|
25655
25844
|
}, "read")
|
|
25656
25845
|
};
|
|
25657
25846
|
|
|
25658
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25659
|
-
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");
|
|
25660
25883
|
var payments = {
|
|
25661
25884
|
id: "payments",
|
|
25662
|
-
version:
|
|
25885
|
+
version: 3,
|
|
25663
25886
|
scope: "project",
|
|
25664
25887
|
read: /* @__PURE__ */ __name(async (context2) => {
|
|
25665
25888
|
const projects = [context2.project.ref, ...context2.project.children.map((child) => child.ref)];
|
|
25666
|
-
const
|
|
25667
|
-
|
|
25668
|
-
|
|
25669
|
-
|
|
25670
|
-
|
|
25671
|
-
who: null,
|
|
25672
|
-
// The fact first, then what it cites, so an amount read from a cited message is not counted twice.
|
|
25673
|
-
evidence: [fact.ref, ...fact.evidence].map((ref) => ({ ref, fingerprint: null })),
|
|
25674
|
-
basis: "fact",
|
|
25675
|
-
data: { ...fact.payment, title: paymentTitle(fact), status: fact.status }
|
|
25676
|
-
}));
|
|
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();
|
|
25677
25894
|
}, "read")
|
|
25678
25895
|
};
|
|
25679
25896
|
|
|
25680
|
-
// 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
|
|
25681
25898
|
var PATTERNS_PER_CHAT = 3;
|
|
25682
25899
|
var DAY3 = 864e5;
|
|
25683
25900
|
var KINDS2 = /* @__PURE__ */ new Set(["promise", "request"]);
|
|
@@ -25766,7 +25983,7 @@ var promises = {
|
|
|
25766
25983
|
}, "read")
|
|
25767
25984
|
};
|
|
25768
25985
|
|
|
25769
|
-
// 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
|
|
25770
25987
|
var PER_SIDE = 5;
|
|
25771
25988
|
var WEEK = 7 * 864e5;
|
|
25772
25989
|
var NOBODY = /* @__PURE__ */ new Set();
|
|
@@ -25792,12 +26009,12 @@ var questions2 = {
|
|
|
25792
26009
|
})));
|
|
25793
26010
|
}, "read"),
|
|
25794
26011
|
attention: /* @__PURE__ */ __name((items, context2) => {
|
|
25795
|
-
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] : []));
|
|
25796
26013
|
return [...stale].map((chat) => ({ chat, weight: 1, why: "your question unanswered for a week" }));
|
|
25797
26014
|
}, "attention")
|
|
25798
26015
|
};
|
|
25799
26016
|
|
|
25800
|
-
// 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
|
|
25801
26018
|
var targetOf = /* @__PURE__ */ __name((message, chat, owners) => {
|
|
25802
26019
|
const byId2 = /* @__PURE__ */ __name((id2) => chat.messages.find((one) => one.id === id2), "byId");
|
|
25803
26020
|
const quoted = message.replyTo ?? (message.replyToId === void 0 ? void 0 : byId2(message.replyToId));
|
|
@@ -25862,10 +26079,10 @@ var replyNext = {
|
|
|
25862
26079
|
}
|
|
25863
26080
|
];
|
|
25864
26081
|
}, "read"),
|
|
25865
|
-
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")
|
|
25866
26083
|
};
|
|
25867
26084
|
|
|
25868
|
-
// 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
|
|
25869
26086
|
var escaped = /* @__PURE__ */ __name((text2) => text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
|
|
25870
26087
|
var wholeWord = /* @__PURE__ */ __name((word) => new RegExp(`(?<![\\p{L}\\p{N}])${escaped(word)}(?![\\p{L}\\p{N}])`, "u"), "wholeWord");
|
|
25871
26088
|
var matcherOf = /* @__PURE__ */ __name((query) => {
|
|
@@ -25911,7 +26128,7 @@ var topics = {
|
|
|
25911
26128
|
}, "read")
|
|
25912
26129
|
};
|
|
25913
26130
|
|
|
25914
|
-
// 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
|
|
25915
26132
|
var STATUS_SIGNALS = [
|
|
25916
26133
|
lastMessage,
|
|
25917
26134
|
replyNext,
|
|
@@ -25924,7 +26141,7 @@ var STATUS_SIGNALS = [
|
|
|
25924
26141
|
children
|
|
25925
26142
|
];
|
|
25926
26143
|
|
|
25927
|
-
// 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
|
|
25928
26145
|
var DAY4 = 864e5;
|
|
25929
26146
|
var STATUS_WINDOW = 300;
|
|
25930
26147
|
var STATUS_CHATS = 16;
|
|
@@ -25970,15 +26187,16 @@ var childrenOf = /* @__PURE__ */ __name(async (store, root, catalog) => {
|
|
|
25970
26187
|
var inAccounts = /* @__PURE__ */ __name((accounts, provider, account) => accounts === void 0 || accounts.some((one) => one.provider === provider && one.account === account), "inAccounts");
|
|
25971
26188
|
var failure = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "failure");
|
|
25972
26189
|
var counted2 = /* @__PURE__ */ __name((items) => {
|
|
25973
|
-
const
|
|
25974
|
-
|
|
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));
|
|
25975
26193
|
}, "counted");
|
|
25976
26194
|
var totalsOf = /* @__PURE__ */ __name((items) => {
|
|
25977
26195
|
const totals = /* @__PURE__ */ new Map();
|
|
25978
26196
|
const open7 = counted2(items);
|
|
25979
|
-
for (const
|
|
25980
|
-
const data =
|
|
25981
|
-
if (!open7(
|
|
26197
|
+
for (const item2 of items) {
|
|
26198
|
+
const data = item2.data;
|
|
26199
|
+
if (!open7(item2, data.state) || data.amount === void 0)
|
|
25982
26200
|
continue;
|
|
25983
26201
|
const key = `${data.direction}|${data.currency ?? ""}`;
|
|
25984
26202
|
const total = totals.get(key) ?? {
|
|
@@ -26105,7 +26323,7 @@ var projectStatus = /* @__PURE__ */ __name(async (store, input) => {
|
|
|
26105
26323
|
};
|
|
26106
26324
|
}, "projectStatus");
|
|
26107
26325
|
|
|
26108
|
-
// 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
|
|
26109
26327
|
var accountService = /* @__PURE__ */ __name((deps) => {
|
|
26110
26328
|
const online = /* @__PURE__ */ __name(async (command) => {
|
|
26111
26329
|
if (deps.offline)
|
|
@@ -26177,7 +26395,7 @@ var accountService = /* @__PURE__ */ __name((deps) => {
|
|
|
26177
26395
|
};
|
|
26178
26396
|
}, "accountService");
|
|
26179
26397
|
|
|
26180
|
-
// 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
|
|
26181
26399
|
var MINUTE = 6e4;
|
|
26182
26400
|
var YEAR = 365 * 24 * 60 * MINUTE;
|
|
26183
26401
|
var DELAY = /^(\d+)(m|h|d)$/;
|
|
@@ -26196,7 +26414,7 @@ var sendTime = /* @__PURE__ */ __name((value, now = Date.now(), flag = "--at-tim
|
|
|
26196
26414
|
return new Date(at - at % MINUTE).toISOString();
|
|
26197
26415
|
}, "sendTime");
|
|
26198
26416
|
|
|
26199
|
-
// 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
|
|
26200
26418
|
var recordMembership = /* @__PURE__ */ __name(async (deps, operationId, done2, change, fix, write) => {
|
|
26201
26419
|
try {
|
|
26202
26420
|
const held = await accountStoreIfOpen(deps);
|
|
@@ -26443,7 +26661,7 @@ var linkLimits = /* @__PURE__ */ __name(({ approval, expires, maxUses }) => {
|
|
|
26443
26661
|
return expires === void 0 ? void 0 : sendTime(expires, Date.now(), "--expire-time");
|
|
26444
26662
|
}, "linkLimits");
|
|
26445
26663
|
|
|
26446
|
-
// 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
|
|
26447
26665
|
var THREADS_PAGE = 500;
|
|
26448
26666
|
var threadsOf = /* @__PURE__ */ __name(async (store, key) => {
|
|
26449
26667
|
const account = await store.accounts.storedAccount(key).catch(() => void 0);
|
|
@@ -26522,7 +26740,7 @@ var readMail = /* @__PURE__ */ __name(async (store, locator, { before: before2 =
|
|
|
26522
26740
|
return thread.slice(Math.max(0, at - before2), at + after + 1).map((hit) => hit.id === message ? { ...hit, anchor: true } : hit);
|
|
26523
26741
|
}, "readMail");
|
|
26524
26742
|
|
|
26525
|
-
// 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
|
|
26526
26744
|
var NO_MAIL = "no_mail";
|
|
26527
26745
|
var MAIL = "email";
|
|
26528
26746
|
var listContextOf = /* @__PURE__ */ __name(async (store, account, app, stored) => {
|
|
@@ -26569,7 +26787,7 @@ var accountsOfKind = /* @__PURE__ */ __name((kind, chosen, held, explicit, comma
|
|
|
26569
26787
|
return chosenMail.map(({ provider, account }) => ({ provider, account }));
|
|
26570
26788
|
}, "accountsOfKind");
|
|
26571
26789
|
|
|
26572
|
-
// 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
|
|
26573
26791
|
var MAIL_FIELDS = /* @__PURE__ */ new Set(["to", "cc", "bcc", "subject", "mailbox", "label", "is"]);
|
|
26574
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");
|
|
26575
26793
|
var prepareLucene = /* @__PURE__ */ __name(async (store, account, request, messenger) => {
|
|
@@ -26828,9 +27046,9 @@ var searchLucene = /* @__PURE__ */ __name(async (store, account, request, messen
|
|
|
26828
27046
|
}, "inMailTables");
|
|
26829
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);
|
|
26830
27048
|
const { completeness, coverage: coverage2 } = request.kind === "mail" ? { completeness: [], coverage: void 0 } : await coverageOf(store, prepared, messenger);
|
|
26831
|
-
const items = await Promise.all(found.items.map(async (
|
|
26832
|
-
const garbled =
|
|
26833
|
-
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(" "));
|
|
26834
27052
|
if (!request.context)
|
|
26835
27053
|
return hit;
|
|
26836
27054
|
const locator = parseLocator(hit.locator);
|
|
@@ -26917,7 +27135,7 @@ var statsLucene = /* @__PURE__ */ __name(async (store, account, request, messeng
|
|
|
26917
27135
|
};
|
|
26918
27136
|
}, "statsLucene");
|
|
26919
27137
|
|
|
26920
|
-
// 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
|
|
26921
27139
|
var RANKING_SELECTION_BYTES = 64 * 1024;
|
|
26922
27140
|
var object = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0, "object");
|
|
26923
27141
|
function invalid3(message = "ranking selection is invalid \u2014 obtain a new drilldown from stats top") {
|
|
@@ -27086,7 +27304,7 @@ var readRankingSelection = /* @__PURE__ */ __name(async (store, input) => {
|
|
|
27086
27304
|
};
|
|
27087
27305
|
}, "readRankingSelection");
|
|
27088
27306
|
|
|
27089
|
-
// 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
|
|
27090
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");
|
|
27091
27309
|
var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
|
|
27092
27310
|
command,
|
|
@@ -27096,7 +27314,7 @@ var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
|
|
|
27096
27314
|
fieldsVersion: FIELD_VERSION
|
|
27097
27315
|
}), "searchRecordOf");
|
|
27098
27316
|
|
|
27099
|
-
// 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
|
|
27100
27318
|
function invalid4(message) {
|
|
27101
27319
|
throw new CliError("validation_error", message);
|
|
27102
27320
|
}
|
|
@@ -27390,7 +27608,7 @@ var adminStatisticsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
27390
27608
|
}, "evidence")
|
|
27391
27609
|
}), "adminStatisticsService");
|
|
27392
27610
|
|
|
27393
|
-
// 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
|
|
27394
27612
|
import { createHash as createHash7, randomUUID as randomUUID4 } from "node:crypto";
|
|
27395
27613
|
var GAP_BOUNDS = { maxGaps: 5, limit: 500, timeMs: 3e4 };
|
|
27396
27614
|
var validateRepair = /* @__PURE__ */ __name((messenger, options) => {
|
|
@@ -27527,12 +27745,12 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
|
|
|
27527
27745
|
return { plan, repair };
|
|
27528
27746
|
}, "gapsService");
|
|
27529
27747
|
|
|
27530
|
-
// 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
|
|
27531
27749
|
import { createHash as createHash9 } from "node:crypto";
|
|
27532
27750
|
import { constants as constants2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
27533
27751
|
import { lstat as lstat4, open as open6, readFile, stat as stat2 } from "node:fs/promises";
|
|
27534
27752
|
|
|
27535
|
-
// 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
|
|
27536
27754
|
import { lstat as lstat2, readdir as readdir2, realpath as realpath3 } from "node:fs/promises";
|
|
27537
27755
|
import { basename as basename4, join as join9, relative as relative2, sep as sep2 } from "node:path";
|
|
27538
27756
|
var MAX_FILES = 1e4;
|
|
@@ -27603,15 +27821,15 @@ var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app,
|
|
|
27603
27821
|
return choices;
|
|
27604
27822
|
}, "directoryPaths");
|
|
27605
27823
|
|
|
27606
|
-
// 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
|
|
27607
27825
|
import { posix } from "node:path";
|
|
27608
27826
|
|
|
27609
|
-
// 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
|
|
27610
27828
|
import { setImmediate as tick } from "node:timers/promises";
|
|
27611
27829
|
import { crc32 } from "node:zlib";
|
|
27612
27830
|
var import_xmldom = __toESM(require_lib(), 1);
|
|
27613
27831
|
|
|
27614
|
-
// 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
|
|
27615
27833
|
var import_chardet = __toESM(require_lib2(), 1);
|
|
27616
27834
|
var import_iconv_lite = __toESM(require_lib3(), 1);
|
|
27617
27835
|
var SAMPLE = 65536;
|
|
@@ -27713,7 +27931,7 @@ var decodeXml = /* @__PURE__ */ __name((bytes2) => {
|
|
|
27713
27931
|
return result.text;
|
|
27714
27932
|
}, "decodeXml");
|
|
27715
27933
|
|
|
27716
|
-
// 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
|
|
27717
27935
|
var MAX_PART = 10 * 1024 * 1024;
|
|
27718
27936
|
var MAX_ENTRIES = 1e3;
|
|
27719
27937
|
var decoder = new TextDecoder("utf-8", { fatal: true });
|
|
@@ -27792,8 +28010,8 @@ var readContainer = /* @__PURE__ */ __name(async (bytes2, signal) => {
|
|
|
27792
28010
|
const done2 = /* @__PURE__ */ new Set();
|
|
27793
28011
|
let expanded = 0;
|
|
27794
28012
|
const archive = new Unzip((file2) => {
|
|
27795
|
-
const
|
|
27796
|
-
if (!
|
|
28013
|
+
const expected2 = entries.get(file2.name);
|
|
28014
|
+
if (!expected2 || seen.has(file2.name))
|
|
27797
28015
|
throw new Error("invalid_zip");
|
|
27798
28016
|
seen.add(file2.name);
|
|
27799
28017
|
const keep2 = /\.(xml|rels|opf|xhtml|html)$/i.test(file2.name) || file2.name === "mimetype";
|
|
@@ -27811,7 +28029,7 @@ var readContainer = /* @__PURE__ */ __name(async (bytes2, signal) => {
|
|
|
27811
28029
|
if (keep2)
|
|
27812
28030
|
parts.push(data.slice());
|
|
27813
28031
|
if (final) {
|
|
27814
|
-
if (size2 !==
|
|
28032
|
+
if (size2 !== expected2.size || checksum !== expected2.crc)
|
|
27815
28033
|
throw new Error("invalid_zip");
|
|
27816
28034
|
done2.add(file2.name);
|
|
27817
28035
|
if (keep2) {
|
|
@@ -27928,7 +28146,7 @@ var elements = /* @__PURE__ */ __name((node, name, namespace) => {
|
|
|
27928
28146
|
return found;
|
|
27929
28147
|
}, "elements");
|
|
27930
28148
|
|
|
27931
|
-
// 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
|
|
27932
28150
|
var columnName = /* @__PURE__ */ __name((column) => {
|
|
27933
28151
|
let name = "";
|
|
27934
28152
|
for (let rest = column; rest > 0; rest = Math.floor((rest - 1) / 26))
|
|
@@ -27983,7 +28201,7 @@ var sheetText = /* @__PURE__ */ __name((sheets2, maxChars = MAX_TEXT_CHARS) => {
|
|
|
27983
28201
|
return { text: parts.join("").trim(), truncated: false };
|
|
27984
28202
|
}, "sheetText");
|
|
27985
28203
|
|
|
27986
|
-
// 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
|
|
27987
28205
|
var OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
|
|
27988
28206
|
var TEXT = "urn:oasis:names:tc:opendocument:xmlns:text:1.0";
|
|
27989
28207
|
var TABLE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0";
|
|
@@ -28319,21 +28537,21 @@ var readBook = /* @__PURE__ */ __name((archive, output) => {
|
|
|
28319
28537
|
const book = xmlPart(archive, path);
|
|
28320
28538
|
rootIs(book, "package", [OPF]);
|
|
28321
28539
|
const manifest = /* @__PURE__ */ new Map();
|
|
28322
|
-
for (const
|
|
28323
|
-
const id2 = required(attribute(
|
|
28540
|
+
for (const item2 of elements(book, "item", OPF)) {
|
|
28541
|
+
const id2 = required(attribute(item2, "id"));
|
|
28324
28542
|
if (manifest.has(id2))
|
|
28325
28543
|
throw new Error("duplicate_chapter");
|
|
28326
|
-
manifest.set(id2, { path: target(path, required(attribute(
|
|
28544
|
+
manifest.set(id2, { path: target(path, required(attribute(item2, "href"))), type: attribute(item2, "media-type") });
|
|
28327
28545
|
}
|
|
28328
28546
|
let number2 = 0;
|
|
28329
28547
|
const chapters = elements(book, "itemref", OPF);
|
|
28330
28548
|
if (!chapters.length)
|
|
28331
28549
|
throw new Error("missing_chapters");
|
|
28332
28550
|
for (const chapter of chapters) {
|
|
28333
|
-
const
|
|
28334
|
-
if (
|
|
28551
|
+
const item2 = manifest.get(required(attribute(chapter, "idref")));
|
|
28552
|
+
if (item2?.type !== "application/xhtml+xml")
|
|
28335
28553
|
throw new Error("unsupported_chapter");
|
|
28336
|
-
const document = xmlPart(archive,
|
|
28554
|
+
const document = xmlPart(archive, item2.path);
|
|
28337
28555
|
const bodies = elements(document, "body", XHTML);
|
|
28338
28556
|
if (bodies.length !== 1)
|
|
28339
28557
|
throw new Error("missing_chapter");
|
|
@@ -28383,10 +28601,10 @@ var readDocument = /* @__PURE__ */ __name(async (bytes2, kind, signal) => {
|
|
|
28383
28601
|
}
|
|
28384
28602
|
}, "readDocument");
|
|
28385
28603
|
|
|
28386
|
-
// 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
|
|
28387
28605
|
import { extname as extname3 } from "node:path";
|
|
28388
28606
|
|
|
28389
|
-
// 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
|
|
28390
28608
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
28391
28609
|
import { dirname as dirname4, extname as extname2, join as join10 } from "node:path";
|
|
28392
28610
|
import { fileURLToPath } from "node:url";
|
|
@@ -28447,7 +28665,7 @@ var derived = /* @__PURE__ */ __name((bytes2, extractor, read) => {
|
|
|
28447
28665
|
}
|
|
28448
28666
|
}, "derived");
|
|
28449
28667
|
|
|
28450
|
-
// 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
|
|
28451
28669
|
var IMAGES = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp", ".gif", ".heic", ".tif", ".tiff", ".bmp"]);
|
|
28452
28670
|
var image2 = {
|
|
28453
28671
|
id: "image",
|
|
@@ -28456,7 +28674,7 @@ var image2 = {
|
|
|
28456
28674
|
read: /* @__PURE__ */ __name(async () => ({ status: "needs-agent" }), "read")
|
|
28457
28675
|
};
|
|
28458
28676
|
|
|
28459
|
-
// 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
|
|
28460
28678
|
var OLE = "\xD0\xCF\xE0\xA1\xB1\xE1";
|
|
28461
28679
|
var doc = {
|
|
28462
28680
|
id: "doc",
|
|
@@ -28468,7 +28686,7 @@ var doc = {
|
|
|
28468
28686
|
}), "read")
|
|
28469
28687
|
};
|
|
28470
28688
|
|
|
28471
|
-
// 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
|
|
28472
28690
|
var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
28473
28691
|
var docx = {
|
|
28474
28692
|
id: "docx",
|
|
@@ -28481,7 +28699,7 @@ var docx = {
|
|
|
28481
28699
|
}), "read")
|
|
28482
28700
|
};
|
|
28483
28701
|
|
|
28484
|
-
// 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
|
|
28485
28703
|
var import_iconv_lite2 = __toESM(require_lib3(), 1);
|
|
28486
28704
|
var RTF_SKIPPED = /* @__PURE__ */ new Set([
|
|
28487
28705
|
"fonttbl",
|
|
@@ -28657,7 +28875,7 @@ var htmlText = /* @__PURE__ */ __name((source) => {
|
|
|
28657
28875
|
}, "htmlText");
|
|
28658
28876
|
var safeChar = /* @__PURE__ */ __name((code, fallback) => code > 0 && code <= 1114111 ? String.fromCodePoint(code) : fallback, "safeChar");
|
|
28659
28877
|
|
|
28660
|
-
// 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
|
|
28661
28879
|
var clean = /* @__PURE__ */ __name((value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "", "clean");
|
|
28662
28880
|
var namesIn = /* @__PURE__ */ __name((value) => [value].flat().map((entry) => typeof entry === "string" ? clean(entry) : clean(entry?.name)).filter(Boolean).join(", "), "namesIn");
|
|
28663
28881
|
var jsonLdNodes = /* @__PURE__ */ __name((document) => {
|
|
@@ -28713,7 +28931,7 @@ var markdownSections = /* @__PURE__ */ __name((text2) => {
|
|
|
28713
28931
|
return found.map((section, index) => ({ ...section, end: found[index + 1]?.start ?? text2.length }));
|
|
28714
28932
|
}, "markdownSections");
|
|
28715
28933
|
|
|
28716
|
-
// 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
|
|
28717
28935
|
var HTML = /* @__PURE__ */ new Set([".html", ".htm", ".xhtml"]);
|
|
28718
28936
|
var first = /* @__PURE__ */ __name((...values) => values.find((value) => typeof value === "string" && value !== ""), "first");
|
|
28719
28937
|
var loaded = /* @__PURE__ */ __name(async (load, name) => {
|
|
@@ -28784,7 +29002,7 @@ var html = {
|
|
|
28784
29002
|
}, "read")
|
|
28785
29003
|
};
|
|
28786
29004
|
|
|
28787
|
-
// 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
|
|
28788
29006
|
var office = {
|
|
28789
29007
|
id: "office",
|
|
28790
29008
|
version: documentExtractor("odt"),
|
|
@@ -28795,7 +29013,7 @@ var office = {
|
|
|
28795
29013
|
}, "read")
|
|
28796
29014
|
};
|
|
28797
29015
|
|
|
28798
|
-
// 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
|
|
28799
29017
|
var pdf = {
|
|
28800
29018
|
id: "pdf",
|
|
28801
29019
|
version: "unpdf",
|
|
@@ -28862,7 +29080,7 @@ var pdf = {
|
|
|
28862
29080
|
}), "read")
|
|
28863
29081
|
};
|
|
28864
29082
|
|
|
28865
|
-
// 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
|
|
28866
29084
|
var PLAIN = /* @__PURE__ */ new Set([".txt", ".md", ".markdown", ".csv", ".tsv", ".json", ".log"]);
|
|
28867
29085
|
var isPlain = /* @__PURE__ */ __name((hint) => PLAIN.has(extensionOf(hint)) || hint.mime?.startsWith("text/") || hint.mime === "application/json", "isPlain");
|
|
28868
29086
|
var readPlain = /* @__PURE__ */ __name((bytes2) => {
|
|
@@ -28882,7 +29100,7 @@ var plain = {
|
|
|
28882
29100
|
read: /* @__PURE__ */ __name(async (bytes2) => readPlain(bytes2), "read")
|
|
28883
29101
|
};
|
|
28884
29102
|
|
|
28885
|
-
// 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
|
|
28886
29104
|
var rtf = {
|
|
28887
29105
|
id: "rtf",
|
|
28888
29106
|
version: "v1",
|
|
@@ -28890,10 +29108,10 @@ var rtf = {
|
|
|
28890
29108
|
read: /* @__PURE__ */ __name(async (bytes2) => derived(bytes2, "rtf:v1", rtfText), "read")
|
|
28891
29109
|
};
|
|
28892
29110
|
|
|
28893
|
-
// 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
|
|
28894
29112
|
import { basename as basename5 } from "node:path";
|
|
28895
29113
|
|
|
28896
|
-
// 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
|
|
28897
29115
|
var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) => {
|
|
28898
29116
|
const cells = [];
|
|
28899
29117
|
let row = 1, column = 1, start = 0, quoted = false, truncated = false;
|
|
@@ -28931,7 +29149,7 @@ var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) =
|
|
|
28931
29149
|
return { cells, truncated };
|
|
28932
29150
|
}, "delimitedSpans");
|
|
28933
29151
|
|
|
28934
|
-
// 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
|
|
28935
29153
|
var DELIMITED = {
|
|
28936
29154
|
".csv": ",",
|
|
28937
29155
|
".tsv": " ",
|
|
@@ -28970,7 +29188,7 @@ var sheets = {
|
|
|
28970
29188
|
}, "read")
|
|
28971
29189
|
};
|
|
28972
29190
|
|
|
28973
|
-
// 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
|
|
28974
29192
|
var BUILT_INS2 = [office, pdf, docx, doc, rtf, html, sheets, plain, image2];
|
|
28975
29193
|
var HEAD_BYTES = 1024;
|
|
28976
29194
|
var readers = [...BUILT_INS2];
|
|
@@ -28980,7 +29198,7 @@ var readWithRegistry = /* @__PURE__ */ __name(async (bytes2, hint, context2) =>
|
|
|
28980
29198
|
return reader ? reader.read(bytes2, hint, context2) : { status: "unsupported" };
|
|
28981
29199
|
}, "readWithRegistry");
|
|
28982
29200
|
|
|
28983
|
-
// 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
|
|
28984
29202
|
var importEngine = /* @__PURE__ */ __name((name) => importFrom(new URL("attachments/extract.js", import.meta.resolve("@wirecat/cli-core")).href, name), "importEngine");
|
|
28985
29203
|
var extensionOf2 = /* @__PURE__ */ __name(({ name, path }) => extname3(name ?? path).toLowerCase(), "extensionOf");
|
|
28986
29204
|
var extractText = /* @__PURE__ */ __name(async (bytes2, hint, load, signal, env = process.env) => {
|
|
@@ -30059,7 +30277,7 @@ function imageSize(input) {
|
|
|
30059
30277
|
}
|
|
30060
30278
|
__name(imageSize, "imageSize");
|
|
30061
30279
|
|
|
30062
|
-
// 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
|
|
30063
30281
|
var MAX_PAGES = 20;
|
|
30064
30282
|
var MAX_PIXELS = 2e7;
|
|
30065
30283
|
var cancelled2 = /* @__PURE__ */ __name((signal) => {
|
|
@@ -30143,7 +30361,7 @@ var ocrPdf = /* @__PURE__ */ __name(async (bytes2, pipeline2, load, signal) => {
|
|
|
30143
30361
|
let text2;
|
|
30144
30362
|
try {
|
|
30145
30363
|
const content = await page.getTextContent();
|
|
30146
|
-
text2 = content.items.map((
|
|
30364
|
+
text2 = content.items.map((item2) => `${item2.str ?? ""}${item2.hasEOL ? "\n" : " "}`).join("").trim();
|
|
30147
30365
|
if (!text2) {
|
|
30148
30366
|
if (typeof unpdf.createIsomorphicCanvasFactory !== "function" || typeof unpdf.renderPageAsImage !== "function")
|
|
30149
30367
|
return { status: "engine-missing", engine: "unpdf" };
|
|
@@ -30210,7 +30428,7 @@ var ocrPdf = /* @__PURE__ */ __name(async (bytes2, pipeline2, load, signal) => {
|
|
|
30210
30428
|
}
|
|
30211
30429
|
}, "ocrPdf");
|
|
30212
30430
|
|
|
30213
|
-
// 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
|
|
30214
30432
|
var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = importEngine, env = process.env) => {
|
|
30215
30433
|
const limits = pdfPreviewLimits(env);
|
|
30216
30434
|
const cancelled4 = /* @__PURE__ */ __name(() => {
|
|
@@ -30287,7 +30505,7 @@ var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = impo
|
|
|
30287
30505
|
}
|
|
30288
30506
|
}, "pdfPreview");
|
|
30289
30507
|
|
|
30290
|
-
// 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
|
|
30291
30509
|
import { createHash as createHash8 } from "node:crypto";
|
|
30292
30510
|
import { constants } from "node:fs";
|
|
30293
30511
|
import { lstat as lstat3, open as open5 } from "node:fs/promises";
|
|
@@ -30395,7 +30613,7 @@ var transferMime = /* @__PURE__ */ __name((head, hint, name = null) => {
|
|
|
30395
30613
|
return hint !== null && /^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(hint) ? hint : "application/octet-stream";
|
|
30396
30614
|
}, "transferMime");
|
|
30397
30615
|
|
|
30398
|
-
// 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
|
|
30399
30617
|
import { createWriteStream, mkdirSync } from "node:fs";
|
|
30400
30618
|
import { link as link3, rm } from "node:fs/promises";
|
|
30401
30619
|
import { join as join11, resolve as resolve6 } from "node:path";
|
|
@@ -30509,7 +30727,7 @@ var save = /* @__PURE__ */ __name(async (file2, directory2, fallbackName, { uniq
|
|
|
30509
30727
|
}
|
|
30510
30728
|
}, "save");
|
|
30511
30729
|
|
|
30512
|
-
// 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
|
|
30513
30731
|
var ATTACHMENT_QUERY = {
|
|
30514
30732
|
entity: "attachment",
|
|
30515
30733
|
backend: "sql",
|
|
@@ -30705,7 +30923,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30705
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);
|
|
30706
30924
|
} else
|
|
30707
30925
|
batch.ok();
|
|
30708
|
-
const
|
|
30926
|
+
const item2 = {
|
|
30709
30927
|
ref: formatLocator({ ...account, chat: file2.chatId, message: file2.messageId }),
|
|
30710
30928
|
attachment: file2.position + 1,
|
|
30711
30929
|
kind: file2.kind,
|
|
@@ -30720,13 +30938,13 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30720
30938
|
...extraction.pages === void 0 ? {} : { pages: extraction.pages, ocrPages: extraction.ocrPages }
|
|
30721
30939
|
} : {}
|
|
30722
30940
|
};
|
|
30723
|
-
finished.set(file2.pk,
|
|
30724
|
-
onItem?.(
|
|
30941
|
+
finished.set(file2.pk, item2);
|
|
30942
|
+
onItem?.(item2);
|
|
30725
30943
|
}, "processFile");
|
|
30726
30944
|
const failedItem = /* @__PURE__ */ __name((file2, stage, error) => {
|
|
30727
30945
|
const issue = batch.fail(formatLocator({ ...account, chat: file2.chatId, message: file2.messageId }), stage, error, file2.position + 1);
|
|
30728
30946
|
run.failed += 1;
|
|
30729
|
-
const
|
|
30947
|
+
const item2 = {
|
|
30730
30948
|
ref: formatLocator({ ...account, chat: file2.chatId, message: file2.messageId }),
|
|
30731
30949
|
attachment: file2.position + 1,
|
|
30732
30950
|
kind: file2.kind,
|
|
@@ -30735,8 +30953,8 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30735
30953
|
error: issue.code,
|
|
30736
30954
|
issue
|
|
30737
30955
|
};
|
|
30738
|
-
finished.set(file2.pk,
|
|
30739
|
-
onItem?.(
|
|
30956
|
+
finished.set(file2.pk, item2);
|
|
30957
|
+
onItem?.(item2);
|
|
30740
30958
|
}, "failedItem");
|
|
30741
30959
|
try {
|
|
30742
30960
|
walk: for (; ; ) {
|
|
@@ -30796,7 +31014,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30796
31014
|
run.batch = batch.result();
|
|
30797
31015
|
run.complete = false;
|
|
30798
31016
|
}
|
|
30799
|
-
run.items = [...finished.entries()].sort(([a], [b]) => b - a).map(([,
|
|
31017
|
+
run.items = [...finished.entries()].sort(([a], [b]) => b - a).map(([, item2]) => item2);
|
|
30800
31018
|
return run;
|
|
30801
31019
|
}, "extract"),
|
|
30802
31020
|
list: /* @__PURE__ */ __name(async ({ limit, offset = 0, query }) => {
|
|
@@ -30932,7 +31150,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30932
31150
|
}, "setText")
|
|
30933
31151
|
}), "attachmentsService");
|
|
30934
31152
|
|
|
30935
|
-
// 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
|
|
30936
31154
|
var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
|
|
30937
31155
|
list: /* @__PURE__ */ __name(async (chat, { limit, offset, ref }) => {
|
|
30938
31156
|
const store = await accountStore(deps);
|
|
@@ -30962,7 +31180,7 @@ var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30962
31180
|
}, "list")
|
|
30963
31181
|
}), "chatDocumentsService");
|
|
30964
31182
|
|
|
30965
|
-
// 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
|
|
30966
31184
|
var observationDuration = /* @__PURE__ */ __name((text2, flag) => {
|
|
30967
31185
|
const match = /^(\d+(?:\.\d+)?)([smhdw])$/.exec(text2);
|
|
30968
31186
|
const units2 = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
|
|
@@ -30996,14 +31214,14 @@ var retentionService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30996
31214
|
const result = await store.roster.retention(account, chatId, options);
|
|
30997
31215
|
return {
|
|
30998
31216
|
...result,
|
|
30999
|
-
items: result.items.map((
|
|
31000
|
-
...
|
|
31217
|
+
items: result.items.map((item2) => ({
|
|
31218
|
+
...item2,
|
|
31001
31219
|
drilldown: {
|
|
31002
31220
|
command: "stats messages evidence",
|
|
31003
31221
|
arguments: {
|
|
31004
|
-
message:
|
|
31222
|
+
message: item2.cohort,
|
|
31005
31223
|
component: "report",
|
|
31006
|
-
selection: { kind: "retention", version: 1, account, chatId, cohort:
|
|
31224
|
+
selection: { kind: "retention", version: 1, account, chatId, cohort: item2.cohort, options }
|
|
31007
31225
|
}
|
|
31008
31226
|
}
|
|
31009
31227
|
})),
|
|
@@ -31049,7 +31267,7 @@ var isRetentionSelection = /* @__PURE__ */ __name((selection) => {
|
|
|
31049
31267
|
}
|
|
31050
31268
|
}, "isRetentionSelection");
|
|
31051
31269
|
|
|
31052
|
-
// 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
|
|
31053
31271
|
var counterFields = /* @__PURE__ */ __name((text2 = "views,reactions,comments") => {
|
|
31054
31272
|
const fields = text2.split(",").map((one) => one.trim());
|
|
31055
31273
|
if (!fields.length || fields.some((one) => !COUNTER_FIELDS.includes(one)) || new Set(fields).size !== fields.length)
|
|
@@ -31112,7 +31330,7 @@ var countersService = /* @__PURE__ */ __name((deps) => {
|
|
|
31112
31330
|
fields,
|
|
31113
31331
|
now,
|
|
31114
31332
|
maxAge,
|
|
31115
|
-
items: items.map((
|
|
31333
|
+
items: items.map((item2) => ({ ...item2, counters: item2.counters.filter((one) => fields.includes(one.counter)) })),
|
|
31116
31334
|
hasMore
|
|
31117
31335
|
};
|
|
31118
31336
|
}, "select");
|
|
@@ -31256,7 +31474,7 @@ var countersService = /* @__PURE__ */ __name((deps) => {
|
|
|
31256
31474
|
};
|
|
31257
31475
|
}, "countersService");
|
|
31258
31476
|
|
|
31259
|
-
// 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
|
|
31260
31478
|
var SYNC_KEY = "messages.sync-first";
|
|
31261
31479
|
var SYNC_BOUNDS = { maxChats: 5, timeMs: 3e4, maxMessages: 500 };
|
|
31262
31480
|
var keyOf2 = /* @__PURE__ */ __name((chat) => JSON.stringify([chat.account.provider, chat.account.account, chat.chatId]), "keyOf");
|
|
@@ -31388,7 +31606,7 @@ var withRefresh = /* @__PURE__ */ __name((found, refreshed) => ({
|
|
|
31388
31606
|
...!refreshed || refreshed.complete ? {} : { coverage: { ...found.coverage, state: "stale" } }
|
|
31389
31607
|
}), "withRefresh");
|
|
31390
31608
|
|
|
31391
|
-
// 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
|
|
31392
31610
|
var CANDIDATES = 50;
|
|
31393
31611
|
var WORD_HITS = 200;
|
|
31394
31612
|
var RRF_K = 60;
|
|
@@ -31506,7 +31724,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
|
|
|
31506
31724
|
}, deps.messenger);
|
|
31507
31725
|
const eligibility = filter === void 0 ? void 0 : await store.queries.conversationEligibility(prepared.execution);
|
|
31508
31726
|
const selected = prepared.selectedChat;
|
|
31509
|
-
const
|
|
31727
|
+
const scopeOf4 = /* @__PURE__ */ __name((one) => selected ? selected.account.provider === one.provider && selected.account.account === one.account ? { chatId: selected.chatId } : null : {}, "scopeOf");
|
|
31510
31728
|
const words3 = await byWords(query, prepared, eligibility?.conversations, since);
|
|
31511
31729
|
const meaning = [];
|
|
31512
31730
|
const sources = words3.sources;
|
|
@@ -31514,7 +31732,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
|
|
|
31514
31732
|
await withEmbedder(deps, target2, choice, {}, async (embedder) => {
|
|
31515
31733
|
const [vector] = await embedder.embed([query], "query");
|
|
31516
31734
|
for (const one of prepared.scopeAccounts) {
|
|
31517
|
-
const scope =
|
|
31735
|
+
const scope = scopeOf4(one);
|
|
31518
31736
|
if (scope === null)
|
|
31519
31737
|
continue;
|
|
31520
31738
|
const hits = await store.vectors.nearestConversations(one, {
|
|
@@ -31548,7 +31766,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
|
|
|
31548
31766
|
const scoped = [];
|
|
31549
31767
|
const elsewhere = [];
|
|
31550
31768
|
for (const one of prepared.scopeAccounts) {
|
|
31551
|
-
const scope =
|
|
31769
|
+
const scope = scopeOf4(one);
|
|
31552
31770
|
if (scope === null)
|
|
31553
31771
|
continue;
|
|
31554
31772
|
const eligibleChats = eligibility?.chats.filter(({ account: account2 }) => account2.provider === one.provider && account2.account === one.account).map(({ chat: chat2 }) => chat2);
|
|
@@ -31654,22 +31872,22 @@ var searchReadiness = /* @__PURE__ */ __name((chats, meaning, outside) => {
|
|
|
31654
31872
|
};
|
|
31655
31873
|
}, "searchReadiness");
|
|
31656
31874
|
var meanOf = /* @__PURE__ */ __name((vectors) => {
|
|
31657
|
-
const
|
|
31875
|
+
const mean2 = new Float32Array(vectors[0]?.length ?? 0);
|
|
31658
31876
|
for (const vector of vectors) {
|
|
31659
|
-
for (let index = 0; index <
|
|
31660
|
-
|
|
31877
|
+
for (let index = 0; index < mean2.length; index++)
|
|
31878
|
+
mean2[index] = mean2[index] + vector[index];
|
|
31661
31879
|
}
|
|
31662
|
-
const length = Math.hypot(...
|
|
31663
|
-
return
|
|
31880
|
+
const length = Math.hypot(...mean2) || 1;
|
|
31881
|
+
return mean2.map((value) => value / length);
|
|
31664
31882
|
}, "meanOf");
|
|
31665
31883
|
|
|
31666
|
-
// 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
|
|
31667
31885
|
var embeddingsService = /* @__PURE__ */ __name((deps) => ({
|
|
31668
31886
|
...embeddingsMaintenance(deps),
|
|
31669
31887
|
...embeddingsSearch(deps)
|
|
31670
31888
|
}), "embeddingsService");
|
|
31671
31889
|
|
|
31672
|
-
// 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
|
|
31673
31891
|
var foldersService = /* @__PURE__ */ __name((deps) => {
|
|
31674
31892
|
const online = /* @__PURE__ */ __name(async (command) => {
|
|
31675
31893
|
if (deps.offline)
|
|
@@ -31810,7 +32028,7 @@ var foldersService = /* @__PURE__ */ __name((deps) => {
|
|
|
31810
32028
|
};
|
|
31811
32029
|
}, "foldersService");
|
|
31812
32030
|
|
|
31813
|
-
// 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
|
|
31814
32032
|
var REVIEW_COUNT = 500;
|
|
31815
32033
|
var mentionsService = /* @__PURE__ */ __name((deps) => {
|
|
31816
32034
|
const located = /* @__PURE__ */ __name(async () => {
|
|
@@ -31889,7 +32107,7 @@ var mentionsService = /* @__PURE__ */ __name((deps) => {
|
|
|
31889
32107
|
};
|
|
31890
32108
|
}, "mentionsService");
|
|
31891
32109
|
|
|
31892
|
-
// 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
|
|
31893
32111
|
var fileLinks = /* @__PURE__ */ __name((attachments) => hitFiles(attachments).map(({ position, kind, name }) => ({
|
|
31894
32112
|
position,
|
|
31895
32113
|
kind,
|
|
@@ -31938,7 +32156,7 @@ var validatePermalink = /* @__PURE__ */ __name((link4) => {
|
|
|
31938
32156
|
return { url: link4.url, access: link4.access, reason: link4.reason };
|
|
31939
32157
|
}, "validatePermalink");
|
|
31940
32158
|
|
|
31941
|
-
// 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
|
|
31942
32160
|
var spokenSeconds = /* @__PURE__ */ __name((seconds) => {
|
|
31943
32161
|
if (seconds % 86400 === 0 && seconds > 86400)
|
|
31944
32162
|
return `${seconds / 86400}d`;
|
|
@@ -31970,7 +32188,7 @@ var pinDurationOf = /* @__PURE__ */ __name((value, allowed, flag = "--expire-tim
|
|
|
31970
32188
|
return seconds;
|
|
31971
32189
|
}, "pinDurationOf");
|
|
31972
32190
|
|
|
31973
|
-
// 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
|
|
31974
32192
|
var sendAsCheck = /* @__PURE__ */ __name((connection, sendAs) => {
|
|
31975
32193
|
if (sendAs === void 0) {
|
|
31976
32194
|
const saved = connection.savedSender?.bind(connection);
|
|
@@ -31995,7 +32213,7 @@ var typedSendAs = /* @__PURE__ */ __name((typed) => {
|
|
|
31995
32213
|
return sendAs;
|
|
31996
32214
|
}, "typedSendAs");
|
|
31997
32215
|
|
|
31998
|
-
// 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
|
|
31999
32217
|
var TOTAL_CAP = 1e4;
|
|
32000
32218
|
var totalOf = /* @__PURE__ */ __name((count4, shown, hasMore, exact = true) => {
|
|
32001
32219
|
const least = shown + (hasMore ? 1 : 0);
|
|
@@ -32006,7 +32224,7 @@ var totalOf = /* @__PURE__ */ __name((count4, shown, hasMore, exact = true) => {
|
|
|
32006
32224
|
return { value: count4, relation: exact ? "eq" : "gte" };
|
|
32007
32225
|
}, "totalOf");
|
|
32008
32226
|
|
|
32009
|
-
// 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
|
|
32010
32228
|
var WORD_FIELDS = /* @__PURE__ */ new Set(["text", "exact"]);
|
|
32011
32229
|
var fieldsOfQuery = /* @__PURE__ */ __name((root, everything) => {
|
|
32012
32230
|
let narrows = false;
|
|
@@ -32035,7 +32253,7 @@ var meaningWords = /* @__PURE__ */ __name((root) => {
|
|
|
32035
32253
|
return wanted(root).join(" ").trim();
|
|
32036
32254
|
}, "meaningWords");
|
|
32037
32255
|
|
|
32038
|
-
// 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
|
|
32039
32257
|
var words2 = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
|
|
32040
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"));
|
|
32041
32259
|
var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
|
|
@@ -32149,8 +32367,25 @@ function planQuestion(text2, strict = false) {
|
|
|
32149
32367
|
return { changed: true, natural: true, queries, scope, terms, rankingTerms: original, removed, aliases: changes };
|
|
32150
32368
|
}
|
|
32151
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");
|
|
32152
32387
|
|
|
32153
|
-
// 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
|
|
32154
32389
|
var COMBINED_DEFAULTS = { candidateDepth: 300, rrfK: 60, rerank: "all", chatCap: 0 };
|
|
32155
32390
|
var tokensOf = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}\p{Co}\p{M}]+/gu) ?? [], "tokensOf");
|
|
32156
32391
|
var searchCombined = /* @__PURE__ */ __name(async (store, account, request, messenger = {}, options = COMBINED_DEFAULTS) => {
|
|
@@ -32274,8 +32509,8 @@ var searchCombined = /* @__PURE__ */ __name(async (store, account, request, mess
|
|
|
32274
32509
|
return finish(listed2.map(({ fused: _fused, ...hit }) => hit), ordered.length > request.limit || truncated, usedCorrections, truncated, true);
|
|
32275
32510
|
async function finish(items, hasMore, listed3, truncated2, expanded) {
|
|
32276
32511
|
const { completeness, coverage: coverage2 } = request.kind === "mail" ? { completeness: [], coverage: void 0 } : await coverageOf(store, prepared, messenger);
|
|
32277
|
-
const hydrated = await Promise.all(items.map(async (
|
|
32278
|
-
const hit = withExcerpt(
|
|
32512
|
+
const hydrated = await Promise.all(items.map(async (item2) => {
|
|
32513
|
+
const hit = withExcerpt(item2, request.text ?? "");
|
|
32279
32514
|
if (!request.context)
|
|
32280
32515
|
return hit;
|
|
32281
32516
|
const { provider, account: account2 } = parseLocator(hit.locator);
|
|
@@ -32343,7 +32578,7 @@ var signals = /* @__PURE__ */ __name((hit, terms, corrections, execution, mode,
|
|
|
32343
32578
|
return mode === "coverage" ? coverage2 * 4 : mode === "proximity" ? proximity : mode === "phrase" ? phrase : coverage2 * 4 + proximity + phrase;
|
|
32344
32579
|
}, "signals");
|
|
32345
32580
|
|
|
32346
|
-
// 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
|
|
32347
32582
|
var MEANING_DEPTH = 100;
|
|
32348
32583
|
var RRF_K2 = 60;
|
|
32349
32584
|
var RERANK_DEPTH = 50;
|
|
@@ -32365,10 +32600,7 @@ var EVERY_MESSAGE = {
|
|
|
32365
32600
|
upper_inclusive: true
|
|
32366
32601
|
};
|
|
32367
32602
|
var scopeOf2 = /* @__PURE__ */ __name((root) => root === void 0 ? {} : { ast: { version: 1, language: "lucene-v1", root } }, "scopeOf");
|
|
32368
|
-
var discoveryRequest = /* @__PURE__ */ __name((asked) => asked.ast !== void 0 || asked.exact || !asked.text ? asked : {
|
|
32369
|
-
...asked,
|
|
32370
|
-
text: asked.text.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found)
|
|
32371
|
-
}, "discoveryRequest");
|
|
32603
|
+
var discoveryRequest = /* @__PURE__ */ __name((asked) => asked.ast !== void 0 || asked.exact || !asked.text ? asked : { ...asked, text: questionText(asked.text) }, "discoveryRequest");
|
|
32372
32604
|
var searchDiscovery = /* @__PURE__ */ __name(async (store, account, asked, messenger = {}, meaning, rerank) => {
|
|
32373
32605
|
const request = discoveryRequest(asked);
|
|
32374
32606
|
const original = await prepareLucene(store, account, request, messenger);
|
|
@@ -32382,7 +32614,7 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account, asked, messe
|
|
|
32382
32614
|
const question = root === void 0 ? text2 : meaningWords(root);
|
|
32383
32615
|
if (!question)
|
|
32384
32616
|
return searchLucene(store, account, request, messenger);
|
|
32385
|
-
const terms = root === void 0 ?
|
|
32617
|
+
const terms = root === void 0 ? lookupTerms(plan) : [...new Set(words2(question))];
|
|
32386
32618
|
if (!terms.length)
|
|
32387
32619
|
return searchLucene(store, account, request, messenger);
|
|
32388
32620
|
if (terms.length > 64)
|
|
@@ -32419,7 +32651,7 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account, asked, messe
|
|
|
32419
32651
|
truncated ||= found.hasMore || found.query.combined.truncated;
|
|
32420
32652
|
}
|
|
32421
32653
|
check2();
|
|
32422
|
-
const relaxed = root === void 0 ?
|
|
32654
|
+
const relaxed = root === void 0 ? anyOfTerms(terms, plan.scope) : text2;
|
|
32423
32655
|
const partialRequest = { ...request, text: relaxed, ast: void 0, limit: 300, context: 0, thread: void 0 };
|
|
32424
32656
|
const partial = await searchLucene(store, account, partialRequest, messenger);
|
|
32425
32657
|
add(partial.items);
|
|
@@ -32671,7 +32903,7 @@ var mixedWithReranker = /* @__PURE__ */ __name((head, scores) => {
|
|
|
32671
32903
|
})).sort((a, b) => b.mixed - a.mixed).map(({ hit }) => hit);
|
|
32672
32904
|
}, "mixedWithReranker");
|
|
32673
32905
|
|
|
32674
|
-
// 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
|
|
32675
32907
|
var THREAD_BOUNDS = { maxHops: 8, maxMessages: 50, maxBytes: 65536, withinMs: 864e5 };
|
|
32676
32908
|
var bytes = /* @__PURE__ */ __name((items, links) => Buffer.byteLength(JSON.stringify({ items, links }), "utf8"), "bytes");
|
|
32677
32909
|
var threadBounds = /* @__PURE__ */ __name((options = {}) => {
|
|
@@ -32741,8 +32973,8 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
32741
32973
|
stopped("messages");
|
|
32742
32974
|
const neighbours = anchor ? await around(message, before2, after) : [];
|
|
32743
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 ?? "")));
|
|
32744
|
-
for (const
|
|
32745
|
-
if (
|
|
32976
|
+
for (const item2 of nearest) {
|
|
32977
|
+
if (item2.threadId !== anchor?.threadId) {
|
|
32746
32978
|
stopped("thread");
|
|
32747
32979
|
continue;
|
|
32748
32980
|
}
|
|
@@ -32750,15 +32982,15 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
32750
32982
|
stopped("messages");
|
|
32751
32983
|
break;
|
|
32752
32984
|
}
|
|
32753
|
-
if (Math.abs(Date.parse(
|
|
32985
|
+
if (Math.abs(Date.parse(item2.timestamp) - Date.parse(anchor?.timestamp ?? "")) > bounds.withinMs) {
|
|
32754
32986
|
stopped("time");
|
|
32755
32987
|
continue;
|
|
32756
32988
|
}
|
|
32757
|
-
if (bytes([...result.items,
|
|
32989
|
+
if (bytes([...result.items, item2], []) > bounds.maxBytes) {
|
|
32758
32990
|
stopped("bytes");
|
|
32759
32991
|
break;
|
|
32760
32992
|
}
|
|
32761
|
-
result.items.push(
|
|
32993
|
+
result.items.push(item2);
|
|
32762
32994
|
}
|
|
32763
32995
|
result.items.sort((a, b) => a.timestamp.localeCompare(b.timestamp) || a.id.localeCompare(b.id));
|
|
32764
32996
|
return result;
|
|
@@ -32788,16 +33020,16 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
32788
33020
|
break;
|
|
32789
33021
|
}
|
|
32790
33022
|
const node = queue[index];
|
|
32791
|
-
const [
|
|
32792
|
-
if (!
|
|
33023
|
+
const [item2] = node.id === message ? [anchor] : await around(node.id);
|
|
33024
|
+
if (!item2) {
|
|
32793
33025
|
result.stale = true;
|
|
32794
33026
|
continue;
|
|
32795
33027
|
}
|
|
32796
|
-
if (Math.abs(Date.parse(
|
|
33028
|
+
if (Math.abs(Date.parse(item2.timestamp) - at) > bounds.withinMs) {
|
|
32797
33029
|
stopped("time");
|
|
32798
33030
|
continue;
|
|
32799
33031
|
}
|
|
32800
|
-
if (
|
|
33032
|
+
if (item2.threadId !== anchor.threadId) {
|
|
32801
33033
|
stopped("thread");
|
|
32802
33034
|
continue;
|
|
32803
33035
|
}
|
|
@@ -32805,7 +33037,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
32805
33037
|
stopped("messages");
|
|
32806
33038
|
break;
|
|
32807
33039
|
}
|
|
32808
|
-
const { anchor: _anchor, ...body } =
|
|
33040
|
+
const { anchor: _anchor, ...body } = item2;
|
|
32809
33041
|
const displayed2 = node.id === message ? { ...body, anchor: true } : body;
|
|
32810
33042
|
const own = await linksOf(node.id);
|
|
32811
33043
|
const parent = chosen(own);
|
|
@@ -32870,7 +33102,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
32870
33102
|
return result;
|
|
32871
33103
|
}, "readThreadContext");
|
|
32872
33104
|
|
|
32873
|
-
// 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
|
|
32874
33106
|
var SEARCH_FILL_MS = 200;
|
|
32875
33107
|
var statsStore = /* @__PURE__ */ __name(async (store, account, request, messenger = {}) => {
|
|
32876
33108
|
const stop = Date.now() + SEARCH_FILL_MS;
|
|
@@ -32937,12 +33169,12 @@ var accountOf2 = /* @__PURE__ */ __name((hit) => {
|
|
|
32937
33169
|
}, "accountOf");
|
|
32938
33170
|
var keyOf3 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}/${account}`, "keyOf");
|
|
32939
33171
|
|
|
32940
|
-
// 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
|
|
32941
33173
|
import { createHash as createHash10 } from "node:crypto";
|
|
32942
33174
|
import { readFile as readFile2, stat as stat3 } from "node:fs/promises";
|
|
32943
33175
|
import { setTimeout as sleep4 } from "node:timers/promises";
|
|
32944
33176
|
|
|
32945
|
-
// 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
|
|
32946
33178
|
var GROUP_SETTINGS = [
|
|
32947
33179
|
"allCanPin",
|
|
32948
33180
|
"onlyAdminsAdd",
|
|
@@ -32956,7 +33188,7 @@ var ADMIN_RIGHTS = ["read", "members", "admins", "info", "pin", "link", "post",
|
|
|
32956
33188
|
var senderIsMe = /* @__PURE__ */ __name((message, account) => message.outgoing === true || message.senderId !== null && String(message.senderId) === account, "senderIsMe");
|
|
32957
33189
|
var MEDIA_KINDS = ["photo", "video", "file", "audio", "link"];
|
|
32958
33190
|
|
|
32959
|
-
// 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
|
|
32960
33192
|
var PICTURE_MAX_BYTES = 25 * 1024 * 1024;
|
|
32961
33193
|
var PICTURE_FLOOR = 0.25;
|
|
32962
33194
|
var PAGE5 = 50;
|
|
@@ -32973,7 +33205,7 @@ var picturesService = /* @__PURE__ */ __name((deps) => {
|
|
|
32973
33205
|
const directory2 = imageModelsDirectory(deps.env);
|
|
32974
33206
|
if (!isImageModelInstalled(model2, directory2))
|
|
32975
33207
|
throw new CliError("not_found", missingModel(model2.id), { reason: "model.not-downloaded", model: model2.id });
|
|
32976
|
-
const { openPictureEmbedder } = await import("./embedder-
|
|
33208
|
+
const { openPictureEmbedder } = await import("./embedder-HEKHRL7E.js");
|
|
32977
33209
|
return openPictureEmbedder(model2, directory2);
|
|
32978
33210
|
}, "open");
|
|
32979
33211
|
const embedder = /* @__PURE__ */ __name(() => {
|
|
@@ -33170,7 +33402,7 @@ var withPictures = /* @__PURE__ */ __name((messages, pictures) => ({
|
|
|
33170
33402
|
}, "search")
|
|
33171
33403
|
}), "withPictures");
|
|
33172
33404
|
|
|
33173
|
-
// 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
|
|
33174
33406
|
var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, shared, within) => {
|
|
33175
33407
|
const target2 = embeddingTarget(deps, DEFAULT_TEXT_MODEL);
|
|
33176
33408
|
const skipped = /* @__PURE__ */ __name((reason, step) => ({
|
|
@@ -33181,9 +33413,16 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
|
|
|
33181
33413
|
const store = await deps.store();
|
|
33182
33414
|
const ready = [];
|
|
33183
33415
|
const without = [];
|
|
33184
|
-
|
|
33185
|
-
|
|
33186
|
-
|
|
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)
|
|
33187
33426
|
return skipped("no message has a vector yet", "conversations.rebuild");
|
|
33188
33427
|
const words3 = plainWords(question);
|
|
33189
33428
|
try {
|
|
@@ -33201,12 +33440,24 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
|
|
|
33201
33440
|
for (const { chatId, messageId, score } of near2)
|
|
33202
33441
|
ranked.push({ ...one, chatId, id: messageId, score });
|
|
33203
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
|
+
}
|
|
33204
33453
|
}, "lookUp");
|
|
33205
33454
|
if (shared && !deps.embedders)
|
|
33206
33455
|
await lookUp(await shared.get(target2.key, () => target2.open()));
|
|
33207
33456
|
else
|
|
33208
33457
|
await withEmbedder(deps, target2, DEFAULT_TEXT_MODEL, {}, lookUp);
|
|
33209
33458
|
}
|
|
33459
|
+
if (ranked.length === 0 && without.length === accounts.length)
|
|
33460
|
+
return skipped("no message has a vector yet", "conversations.rebuild");
|
|
33210
33461
|
return {
|
|
33211
33462
|
model: target2.id,
|
|
33212
33463
|
ranked: ranked.sort((a, b) => b.score - a.score).slice(0, MEANING_DEPTH),
|
|
@@ -33219,7 +33470,7 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
|
|
|
33219
33470
|
}
|
|
33220
33471
|
}, "meaningLane");
|
|
33221
33472
|
|
|
33222
|
-
// 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
|
|
33223
33474
|
var rerankLane = /* @__PURE__ */ __name((deps) => {
|
|
33224
33475
|
const choice = deps.reranker ?? DEFAULT_RERANK_MODEL;
|
|
33225
33476
|
if (choice === "off")
|
|
@@ -33231,9 +33482,9 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
|
|
|
33231
33482
|
return { skipped: { reason: `${model.id} is not downloaded`, step: "models.download", model: model.id } };
|
|
33232
33483
|
try {
|
|
33233
33484
|
const warm = deps.embedders;
|
|
33234
|
-
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, {
|
|
33235
33486
|
threads: defaultThreads()
|
|
33236
|
-
})) : await (await import("./rerank-
|
|
33487
|
+
})) : await (await import("./rerank-NWFIV7OF.js")).openReranker(model, directory2);
|
|
33237
33488
|
return {
|
|
33238
33489
|
model: model.id,
|
|
33239
33490
|
score: /* @__PURE__ */ __name((question, passages) => reranker.score(plainWords(question), passages), "score"),
|
|
@@ -33253,17 +33504,17 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
|
|
|
33253
33504
|
};
|
|
33254
33505
|
}, "rerankLane");
|
|
33255
33506
|
|
|
33256
|
-
// 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
|
|
33257
33508
|
var openPictureEmbedderFor = /* @__PURE__ */ __name(async ({ env, command } = {}) => {
|
|
33258
33509
|
const model = imageModel(DEFAULT_IMAGE_MODEL);
|
|
33259
33510
|
const directory2 = imageModelsDirectory(env);
|
|
33260
33511
|
if (!isImageModelInstalled(model, directory2))
|
|
33261
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 });
|
|
33262
|
-
const { openPictureEmbedder } = await import("./embedder-
|
|
33513
|
+
const { openPictureEmbedder } = await import("./embedder-HEKHRL7E.js");
|
|
33263
33514
|
return openPictureEmbedder(model, directory2);
|
|
33264
33515
|
}, "openPictureEmbedderFor");
|
|
33265
33516
|
|
|
33266
|
-
// 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
|
|
33267
33518
|
var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file2) => {
|
|
33268
33519
|
const metadata = note.frontMatter;
|
|
33269
33520
|
const account = accounts.find(({ id: id2 }) => String(id2) === note.folderId);
|
|
@@ -33278,7 +33529,7 @@ var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file2) =>
|
|
|
33278
33529
|
};
|
|
33279
33530
|
}, "documentSource");
|
|
33280
33531
|
|
|
33281
|
-
// 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
|
|
33282
33533
|
var plainQueryWords = /* @__PURE__ */ __name((query) => {
|
|
33283
33534
|
let root;
|
|
33284
33535
|
try {
|
|
@@ -33305,7 +33556,7 @@ var titleTiers = /* @__PURE__ */ __name((hits, words3) => {
|
|
|
33305
33556
|
return [...hits].sort((a, b) => rank(a) - rank(b));
|
|
33306
33557
|
}, "titleTiers");
|
|
33307
33558
|
|
|
33308
|
-
// 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
|
|
33309
33560
|
var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone } = {}) => resolvedQuery(store, parsedQuery(text2, exact), timezone), "storeQuery");
|
|
33310
33561
|
var parsedQuery = /* @__PURE__ */ __name((text2, exact) => validateFields(parseLucene(text2, { ...SEARCH_QUERY, defaultField: exact ? "exact" : "text" })).root, "parsedQuery");
|
|
33311
33562
|
var resolvedQuery = /* @__PURE__ */ __name(async (store, root, timezone) => {
|
|
@@ -33520,19 +33771,21 @@ var notesTotal = /* @__PURE__ */ __name(async (store, text2, { exact, scope, sho
|
|
|
33520
33771
|
const count4 = (/* @__PURE__ */ new Set([...words3.refs, ...others])).size + (words3.hasMore ? 1 : 0);
|
|
33521
33772
|
return totalOf(count4, shown, hasMore, othersComplete);
|
|
33522
33773
|
}, "notesTotal");
|
|
33523
|
-
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 } = {}) => {
|
|
33524
33775
|
const typed = noteSourceOfQuery(query);
|
|
33525
33776
|
const source = given ?? typed.source;
|
|
33526
33777
|
const rest = typed.source !== void 0 && typed.source === source ? typed.rest : query;
|
|
33527
33778
|
const label = tag === void 0 ? void 0 : normalizeTag(tag);
|
|
33528
33779
|
const filter = [expression ? `(${expression})` : "", label === void 0 ? "" : `tag:${label}`].filter(Boolean).join(" AND ") || void 0;
|
|
33529
|
-
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;
|
|
33530
33782
|
const words3 = parsed === void 0 ? "" : meaningWords(parsed);
|
|
33531
33783
|
const narrowing = allOf([
|
|
33532
33784
|
...parsed === void 0 ? [] : [fieldsOfQuery2(parsed)].filter((node) => node !== void 0),
|
|
33533
33785
|
...filter === void 0 ? [] : [parsedQuery(filter)]
|
|
33534
33786
|
]);
|
|
33535
|
-
const
|
|
33787
|
+
const asked = lookup2 ?? query;
|
|
33788
|
+
const text2 = [asked.trim() ? `(${asked})` : "", filter ?? ""].filter(Boolean).join(" AND ");
|
|
33536
33789
|
const window3 = offset + limit;
|
|
33537
33790
|
const scope = {
|
|
33538
33791
|
...folderIds === void 0 ? {} : { folderIds },
|
|
@@ -33542,6 +33795,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
33542
33795
|
};
|
|
33543
33796
|
let meaningSkipped;
|
|
33544
33797
|
let meaning;
|
|
33798
|
+
const cosines = /* @__PURE__ */ new Map();
|
|
33545
33799
|
let meaningRefs;
|
|
33546
33800
|
let meaningComplete = true;
|
|
33547
33801
|
if (exact)
|
|
@@ -33568,8 +33822,10 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
33568
33822
|
nearest = ranked2.slice(0, depth);
|
|
33569
33823
|
}
|
|
33570
33824
|
const allowed = await matching(store, nearest.map(({ ref }) => ref), narrowing, scope);
|
|
33571
|
-
meaning = nearest.flatMap(({ ref }) => {
|
|
33825
|
+
meaning = nearest.flatMap(({ ref, score }) => {
|
|
33572
33826
|
const found = allowed.get(ref);
|
|
33827
|
+
if (found)
|
|
33828
|
+
cosines.set(ref, score);
|
|
33573
33829
|
return found ? [{ ref, ...found }] : [];
|
|
33574
33830
|
});
|
|
33575
33831
|
meaningRefs ??= new Set(meaning.map(({ ref }) => ref));
|
|
@@ -33600,9 +33856,11 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
33600
33856
|
if (tierRefs.has(ref))
|
|
33601
33857
|
return;
|
|
33602
33858
|
const held = ranked.get(ref) ?? { note, at, score: 0, foundBy: [] };
|
|
33603
|
-
held.score += 1 / (RRF_K3 + rank + 1);
|
|
33604
33859
|
held.foundBy.push(by);
|
|
33605
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);
|
|
33606
33864
|
}), "add");
|
|
33607
33865
|
add(matched.items, "words");
|
|
33608
33866
|
if (meaning !== void 0)
|
|
@@ -33635,7 +33893,8 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
33635
33893
|
updated_at: at,
|
|
33636
33894
|
excerpt: firstLine(note.text, words3),
|
|
33637
33895
|
links,
|
|
33638
|
-
found_by: foundBy
|
|
33896
|
+
found_by: foundBy,
|
|
33897
|
+
...cosines.has(ref) ? { meaning_score: cosines.get(ref) } : {}
|
|
33639
33898
|
});
|
|
33640
33899
|
for (const link4 of new Map(links.map((link5) => [link5.to ?? `?${link5.target_text}`, link5])).values()) {
|
|
33641
33900
|
const key = link4.to ?? `?${link4.target_text}`;
|
|
@@ -33714,7 +33973,7 @@ var searchNotesOf = /* @__PURE__ */ __name(async (store, account, text2, { accou
|
|
|
33714
33973
|
};
|
|
33715
33974
|
}, "searchNotesOf");
|
|
33716
33975
|
|
|
33717
|
-
// 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
|
|
33718
33977
|
var MAX_EVENTS_OFFSET = 1e3;
|
|
33719
33978
|
var iso3 = /* @__PURE__ */ __name((at) => at === null ? null : new Date(at).toISOString(), "iso");
|
|
33720
33979
|
var accountIdsOf = /* @__PURE__ */ __name(async (store, accounts) => {
|
|
@@ -33748,17 +34007,18 @@ var nearestEvents = /* @__PURE__ */ __name(async (store, words3, { limit, accoun
|
|
|
33748
34007
|
return (await store.calendar.nearest(key, vector, { limit, ...accountIds ? { accountIds } : {} })).filter(({ score }) => score > floor);
|
|
33749
34008
|
}, "nearestEvents");
|
|
33750
34009
|
var keyOf4 = /* @__PURE__ */ __name(({ event }) => event.eventSeriesId === null ? `e${event.id}` : `s${event.eventSeriesId}`, "keyOf");
|
|
33751
|
-
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 } = {}) => {
|
|
33752
34011
|
if (!query.trim())
|
|
33753
34012
|
throw new CliError("validation_error", "say what to find in the events");
|
|
33754
|
-
const
|
|
34013
|
+
const asked = discover && !exact && !newest ? questionLookup(query) : void 0;
|
|
34014
|
+
const { root, stemmer } = await storeQuery(store, asked ?? query, {
|
|
33755
34015
|
...exact ? { exact: true } : {},
|
|
33756
34016
|
...timezone === void 0 ? {} : { timezone }
|
|
33757
34017
|
});
|
|
33758
34018
|
const accountIds = accounts === void 0 ? void 0 : await accountIdsOf(store, accounts);
|
|
33759
34019
|
if (accountIds?.length === 0)
|
|
33760
34020
|
return { query, by: "words", hits: [], has_more: false };
|
|
33761
|
-
const words3 = plainQueryWords(query);
|
|
34021
|
+
const words3 = plainQueryWords(asked === void 0 ? query : questionText(query));
|
|
33762
34022
|
const window3 = offset + limit;
|
|
33763
34023
|
let meaningSkipped;
|
|
33764
34024
|
let meaning;
|
|
@@ -33814,19 +34074,23 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
|
|
|
33814
34074
|
}), "add");
|
|
33815
34075
|
add(found.items, "words");
|
|
33816
34076
|
add(meaning, "meaning");
|
|
34077
|
+
const cosines = new Map(meaning.map((hit) => [keyOf4(hit), hit.score]));
|
|
33817
34078
|
const ordered = [...ranked.values()].sort((a, b) => b.score - a.score);
|
|
33818
34079
|
const hasMore = ordered.length > window3 || found.hasMore;
|
|
33819
34080
|
return {
|
|
33820
34081
|
query,
|
|
33821
34082
|
by,
|
|
33822
|
-
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
|
+
}),
|
|
33823
34087
|
has_more: hasMore,
|
|
33824
34088
|
...hasMore && window3 <= MAX_EVENTS_OFFSET ? { next_offset: window3 } : {},
|
|
33825
34089
|
...truncated
|
|
33826
34090
|
};
|
|
33827
34091
|
}, "searchEvents");
|
|
33828
34092
|
|
|
33829
|
-
// 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
|
|
33830
34094
|
var RESOURCES_SEARCHED = ["messages", "mail", "notes", "events"];
|
|
33831
34095
|
var skippable = /* @__PURE__ */ __name((error) => error instanceof CliError && (error.code === "validation_error" || error.code === "not_found"), "skippable");
|
|
33832
34096
|
var filtersBeside = /* @__PURE__ */ __name((text2) => {
|
|
@@ -33851,11 +34115,14 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33851
34115
|
let hasMore = false;
|
|
33852
34116
|
let notes;
|
|
33853
34117
|
let events;
|
|
33854
|
-
|
|
34118
|
+
const by = {};
|
|
33855
34119
|
let server;
|
|
34120
|
+
const discover = !request.exact && questionLookup(request.text) !== void 0;
|
|
34121
|
+
const cosines = /* @__PURE__ */ new Map();
|
|
33856
34122
|
let coverage2;
|
|
33857
34123
|
const messagesOf = /* @__PURE__ */ __name(async (kind) => {
|
|
33858
34124
|
const given = request.scope?.[kind];
|
|
34125
|
+
const discovers = discover && (kind === "mail" || request.backend !== "server");
|
|
33859
34126
|
const query = {
|
|
33860
34127
|
text: request.text,
|
|
33861
34128
|
kind,
|
|
@@ -33868,6 +34135,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33868
34135
|
} : {},
|
|
33869
34136
|
limit: window3,
|
|
33870
34137
|
...request.exact ? { exact: true } : {},
|
|
34138
|
+
...discovers ? { discover: true } : {},
|
|
33871
34139
|
...request.timezone === void 0 ? {} : { timezone: request.timezone },
|
|
33872
34140
|
...request.signal === void 0 ? {} : { signal: request.signal }
|
|
33873
34141
|
};
|
|
@@ -33900,7 +34168,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33900
34168
|
};
|
|
33901
34169
|
}, "itemOf");
|
|
33902
34170
|
const byWords = found.items.map((hit) => itemOf3(hit, ["words"]));
|
|
33903
|
-
if (
|
|
34171
|
+
if (!meaning || request.exact || kind === "messages" && request.backend === "server")
|
|
33904
34172
|
return byWords;
|
|
33905
34173
|
const filters = filtersBeside(request.text);
|
|
33906
34174
|
const lane = filters === void 0 ? {
|
|
@@ -33910,25 +34178,28 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33910
34178
|
}
|
|
33911
34179
|
} : await meaning(request.text, read, embedders);
|
|
33912
34180
|
if ("skipped" in lane) {
|
|
33913
|
-
|
|
34181
|
+
by[kind] = { by: "words", meaningSkipped: lane.skipped };
|
|
33914
34182
|
return byWords;
|
|
33915
34183
|
}
|
|
33916
|
-
|
|
34184
|
+
by[kind] = { by: "words and meaning", ...lane.partly ? { meaningSkipped: lane.partly } : {} };
|
|
33917
34185
|
const near2 = await nearEligible(store, account, query, messenger, lane.ranked, filters ? { text: filters } : {});
|
|
33918
34186
|
const fused2 = /* @__PURE__ */ new Map();
|
|
33919
|
-
byWords.forEach((
|
|
33920
|
-
fused2.set(
|
|
34187
|
+
byWords.forEach((item2, rank) => {
|
|
34188
|
+
fused2.set(item2.ref, { item: item2, score: 1 / (RRF_K3 + rank + 1) });
|
|
33921
34189
|
});
|
|
33922
34190
|
near2.forEach((hit, rank) => {
|
|
34191
|
+
cosines.set(hit.locator, hit.cosine);
|
|
33923
34192
|
const held = fused2.get(hit.locator);
|
|
33924
34193
|
if (held)
|
|
33925
34194
|
held.item.foundBy = ["words", "meaning"];
|
|
34195
|
+
if (held && discovers)
|
|
34196
|
+
return;
|
|
33926
34197
|
fused2.set(hit.locator, {
|
|
33927
34198
|
item: held?.item ?? itemOf3(hit, ["meaning"]),
|
|
33928
34199
|
score: (held?.score ?? 0) + 1 / (RRF_K3 + rank + 1)
|
|
33929
34200
|
});
|
|
33930
34201
|
});
|
|
33931
|
-
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);
|
|
33932
34203
|
}, "messagesOf");
|
|
33933
34204
|
const embedders = runEmbedders();
|
|
33934
34205
|
try {
|
|
@@ -33942,6 +34213,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33942
34213
|
embedders,
|
|
33943
34214
|
...chosen === void 0 ? {} : notesScopeOf(chosen),
|
|
33944
34215
|
...request.exact ? { exact: true } : {},
|
|
34216
|
+
...discover ? { discover: true } : {},
|
|
33945
34217
|
...request.timezone === void 0 ? {} : { timezone: request.timezone },
|
|
33946
34218
|
...request.env === void 0 ? {} : { env: request.env }
|
|
33947
34219
|
});
|
|
@@ -33950,6 +34222,9 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33950
34222
|
by: found.by,
|
|
33951
34223
|
...found.meaning_skipped === void 0 ? {} : { meaningSkipped: found.meaning_skipped }
|
|
33952
34224
|
};
|
|
34225
|
+
for (const hit of found.hits)
|
|
34226
|
+
if (hit.meaning_score !== void 0)
|
|
34227
|
+
cosines.set(hit.ref, hit.meaning_score);
|
|
33953
34228
|
lists.push(found.hits.map((hit) => ({
|
|
33954
34229
|
kind: hit.kind ?? "note",
|
|
33955
34230
|
ref: hit.ref,
|
|
@@ -33978,6 +34253,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33978
34253
|
...command === void 0 ? {} : { command },
|
|
33979
34254
|
...request.env === void 0 ? {} : { env: request.env },
|
|
33980
34255
|
...request.exact ? { exact: true } : {},
|
|
34256
|
+
...discover ? { discover: true } : {},
|
|
33981
34257
|
...request.timezone === void 0 ? {} : { timezone: request.timezone },
|
|
33982
34258
|
...request.signal === void 0 ? {} : { signal: request.signal }
|
|
33983
34259
|
});
|
|
@@ -33986,6 +34262,9 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33986
34262
|
by: found.by,
|
|
33987
34263
|
...found.meaning_skipped === void 0 ? {} : { meaningSkipped: found.meaning_skipped }
|
|
33988
34264
|
};
|
|
34265
|
+
for (const hit of found.hits)
|
|
34266
|
+
if (hit.meaning_score !== void 0)
|
|
34267
|
+
cosines.set(hit.ref, hit.meaning_score);
|
|
33989
34268
|
lists.push(found.hits.map((hit) => ({
|
|
33990
34269
|
kind: "event",
|
|
33991
34270
|
ref: hit.ref,
|
|
@@ -34010,14 +34289,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
34010
34289
|
} finally {
|
|
34011
34290
|
await embedders.close();
|
|
34012
34291
|
}
|
|
34013
|
-
const
|
|
34014
|
-
for (const list3 of lists)
|
|
34015
|
-
list3.forEach((item, rank) => {
|
|
34016
|
-
const held = ranked.get(item.ref) ?? { item, score: 0 };
|
|
34017
|
-
held.score += 1 / (RRF_K3 + rank + 1);
|
|
34018
|
-
ranked.set(item.ref, held);
|
|
34019
|
-
});
|
|
34020
|
-
const ordered = [...ranked.values()].sort((a, b) => b.score - a.score).map(({ item }) => item);
|
|
34292
|
+
const ordered = oneList(lists, cosines);
|
|
34021
34293
|
const more = hasMore || ordered.length > window3;
|
|
34022
34294
|
return {
|
|
34023
34295
|
query: request.text,
|
|
@@ -34029,13 +34301,25 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
34029
34301
|
skipped,
|
|
34030
34302
|
...notes === void 0 ? {} : { notes },
|
|
34031
34303
|
...events === void 0 ? {} : { events },
|
|
34032
|
-
...
|
|
34304
|
+
...by.messages === void 0 ? {} : { messages: by.messages },
|
|
34305
|
+
...by.mail === void 0 ? {} : { mail: by.mail },
|
|
34033
34306
|
...server === void 0 ? {} : { server },
|
|
34034
34307
|
...coverage2 === void 0 ? {} : { coverage: coverage2 }
|
|
34035
34308
|
};
|
|
34036
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");
|
|
34037
34321
|
|
|
34038
|
-
// 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
|
|
34039
34323
|
var RESOURCES_SEARCHED_WITH_MEETINGS = [...RESOURCES_SEARCHED, "meetings"];
|
|
34040
34324
|
var whole3 = /* @__PURE__ */ __name((value, minimum, maximum, label) => {
|
|
34041
34325
|
if (!Number.isSafeInteger(value) || value < minimum || value > maximum)
|
|
@@ -34203,16 +34487,16 @@ var searchAllIncludingMeetings = /* @__PURE__ */ __name(async (store, account, r
|
|
|
34203
34487
|
};
|
|
34204
34488
|
}
|
|
34205
34489
|
const ranked = /* @__PURE__ */ new Map();
|
|
34206
|
-
for (const list3 of [legacy.items, meetings.items.map(({ item }) =>
|
|
34207
|
-
list3.forEach((
|
|
34208
|
-
const key =
|
|
34209
|
-
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 };
|
|
34210
34494
|
held.score += 1 / (RRF_K3 + rank + 1);
|
|
34211
34495
|
ranked.set(key, held);
|
|
34212
34496
|
});
|
|
34213
|
-
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);
|
|
34214
34498
|
const items = ordered.slice(offset, window3);
|
|
34215
|
-
const returnedMeetings = ordered.slice(0, window3).filter((
|
|
34499
|
+
const returnedMeetings = ordered.slice(0, window3).filter((item2) => item2.kind === "meeting").length;
|
|
34216
34500
|
const nextCursor = meetings.items[returnedMeetings]?.before ?? (!meetings.coverage.complete ? meetings.after : void 0);
|
|
34217
34501
|
const more = legacy.hasMore || ordered.length > window3;
|
|
34218
34502
|
const { nextOffset: _, ...rest } = legacy;
|
|
@@ -34247,13 +34531,13 @@ var searchAllWithMeetings = /* @__PURE__ */ __name(async (store, account, reques
|
|
|
34247
34531
|
var holdingMeetings = /* @__PURE__ */ __name(async (store, named2) => {
|
|
34248
34532
|
if (named2.length < 2)
|
|
34249
34533
|
return named2;
|
|
34250
|
-
const
|
|
34534
|
+
const holding2 = [];
|
|
34251
34535
|
for (const key of named2) {
|
|
34252
34536
|
const { id: id2 } = await store.accounts.storedAccount(key);
|
|
34253
34537
|
if ((await store.meetings.meetings({ accountId: id2, limit: 1 })).length)
|
|
34254
|
-
|
|
34538
|
+
holding2.push(key);
|
|
34255
34539
|
}
|
|
34256
|
-
return
|
|
34540
|
+
return holding2.length ? holding2 : named2;
|
|
34257
34541
|
}, "holdingMeetings");
|
|
34258
34542
|
var searchAllOfSource = /* @__PURE__ */ __name(async (store, account, source, request, messenger, searchMessages, meaning) => {
|
|
34259
34543
|
const only = request.only ?? RESOURCES_SEARCHED_WITH_MEETINGS;
|
|
@@ -34288,7 +34572,7 @@ var searchAllOfSource = /* @__PURE__ */ __name(async (store, account, source, re
|
|
|
34288
34572
|
return { ...found, skipped: [...skipped, ...empty2, ...unnamed, ...found.skipped] };
|
|
34289
34573
|
}, "searchAllOfSource");
|
|
34290
34574
|
|
|
34291
|
-
// 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
|
|
34292
34576
|
var SERVER_SEARCH_KEY = "messages.server-search";
|
|
34293
34577
|
var SERVER_BOUNDS = { timeMs: 5e3, perCall: 100, maxCalls: 3, textBytes: 262144 };
|
|
34294
34578
|
var DEFAULT_BACKEND = "both";
|
|
@@ -34477,7 +34761,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
|
|
|
34477
34761
|
return { report, sources };
|
|
34478
34762
|
}, "searchServer");
|
|
34479
34763
|
|
|
34480
|
-
// 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
|
|
34481
34765
|
var DELETE_AT_ONCE = 10;
|
|
34482
34766
|
var filesOf = /* @__PURE__ */ __name(({ attachments }) => {
|
|
34483
34767
|
const files = fileLinks(attachments);
|
|
@@ -34493,18 +34777,18 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
|
|
|
34493
34777
|
return;
|
|
34494
34778
|
await ensureAccount({ text: target2.text, account: target2.account }, { account: account.account, ...deps.profile === void 0 ? {} : { profile: deps.profile } });
|
|
34495
34779
|
}, "ownTarget");
|
|
34496
|
-
const serverThenStore = /* @__PURE__ */ __name(async (store, account, query) => {
|
|
34780
|
+
const serverThenStore = /* @__PURE__ */ __name(async (store, account, query, lanes = true) => {
|
|
34497
34781
|
const server = await searchServer(deps, query);
|
|
34498
34782
|
const only = query.backend === "server" && server ? [...server.sources.keys()].map((key) => {
|
|
34499
34783
|
const [chatId, id2] = JSON.parse(key);
|
|
34500
34784
|
return { ...account, chatId, id: id2 };
|
|
34501
34785
|
}) : void 0;
|
|
34502
|
-
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);
|
|
34503
34787
|
return { found, server };
|
|
34504
34788
|
}, "serverThenStore");
|
|
34505
34789
|
const unifiedMessages = /* @__PURE__ */ __name((store, account) => async (query) => {
|
|
34506
34790
|
await topUp(store);
|
|
34507
|
-
const { found, server } = await serverThenStore(store, account, query);
|
|
34791
|
+
const { found, server } = await serverThenStore(store, account, query, false);
|
|
34508
34792
|
return withServer(found, account, server);
|
|
34509
34793
|
}, "unifiedMessages");
|
|
34510
34794
|
const remember = /* @__PURE__ */ __name(async (store, command, query) => {
|
|
@@ -34634,7 +34918,7 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
|
|
|
34634
34918
|
const store = await deps.store();
|
|
34635
34919
|
const chat2 = await readChatId(deps, target2.chat, store, account);
|
|
34636
34920
|
const found2 = await store.messages.around(account, chat2, target2.message, { before: 0, after: 0 });
|
|
34637
|
-
const held2 = found2.find((
|
|
34921
|
+
const held2 = found2.find((item2) => item2.id === target2.message && item2.chatId === chat2);
|
|
34638
34922
|
if (!held2)
|
|
34639
34923
|
throw new CliError("not_found", "no such message in this account's stored chat");
|
|
34640
34924
|
return {
|
|
@@ -34652,14 +34936,14 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
|
|
|
34652
34936
|
const locator = formatLocator({ ...account, chat, message: target2.message });
|
|
34653
34937
|
if (connection.permalink) {
|
|
34654
34938
|
const permalink = validatePermalink(await connection.permalink(chat, target2.message));
|
|
34655
|
-
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);
|
|
34656
34940
|
return { locator, ...permalink, ...held2 ? filesOf(held2) : {} };
|
|
34657
34941
|
}
|
|
34658
34942
|
const found = await capability(connection, "around", "read a message")(chat, target2.message, {
|
|
34659
34943
|
before: 0,
|
|
34660
34944
|
after: 0
|
|
34661
34945
|
});
|
|
34662
|
-
const held = found.find((
|
|
34946
|
+
const held = found.find((item2) => item2.id === target2.message && item2.chatId === chat);
|
|
34663
34947
|
if (!held)
|
|
34664
34948
|
throw new CliError("not_found", "no such message in this chat");
|
|
34665
34949
|
return { locator, url: null, access: "unavailable", reason: "unsupported_provider", ...filesOf(held) };
|
|
@@ -34918,7 +35202,7 @@ var checkMediaOptions = /* @__PURE__ */ __name((messenger, asked, attachments) =
|
|
|
34918
35202
|
throw new CliError("validation_error", `${MEDIA_FLAGS[first2]} needs a --photo or --file`);
|
|
34919
35203
|
}, "checkMediaOptions");
|
|
34920
35204
|
|
|
34921
|
-
// 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
|
|
34922
35206
|
var CHANNEL_TAG_RULES_VERSION = "keywords-v1";
|
|
34923
35207
|
var RULES = {
|
|
34924
35208
|
ai: [/\b(ai|gpt|llm|machine learning|artificial intelligence)\b/iu, /нейросет|искусственн/iu],
|
|
@@ -34933,7 +35217,7 @@ var classifyChannel = /* @__PURE__ */ __name((metadata) => Object.entries(RULES)
|
|
|
34933
35217
|
return fields.length ? [{ tag, score: fields.length / 3, fields }] : [];
|
|
34934
35218
|
}), "classifyChannel");
|
|
34935
35219
|
|
|
34936
|
-
// 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
|
|
34937
35221
|
var metadataService = /* @__PURE__ */ __name((deps) => {
|
|
34938
35222
|
const held = /* @__PURE__ */ __name(async (reference, { includeLeft = false } = {}) => {
|
|
34939
35223
|
const store = await deps.store();
|
|
@@ -35019,7 +35303,7 @@ var metadataService = /* @__PURE__ */ __name((deps) => {
|
|
|
35019
35303
|
};
|
|
35020
35304
|
}, "metadataService");
|
|
35021
35305
|
|
|
35022
|
-
// 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
|
|
35023
35307
|
var FIRST_LOOK_MS = 24 * 36e5;
|
|
35024
35308
|
var moderateWith = /* @__PURE__ */ __name(async (run) => {
|
|
35025
35309
|
const { chatId, title, rules, point, since, dryRun } = run;
|
|
@@ -35056,7 +35340,7 @@ var moderateWith = /* @__PURE__ */ __name(async (run) => {
|
|
|
35056
35340
|
return { chatId, rows, notes };
|
|
35057
35341
|
}, "moderateWith");
|
|
35058
35342
|
|
|
35059
|
-
// 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
|
|
35060
35344
|
var moderationService = /* @__PURE__ */ __name((deps) => {
|
|
35061
35345
|
const file2 = /* @__PURE__ */ __name(() => new ModerationRules(moderationPathFor(deps.messenger.app, deps.profile ?? "default", deps.env ?? process.env)), "file");
|
|
35062
35346
|
const group = /* @__PURE__ */ __name(async (chat) => {
|
|
@@ -35134,7 +35418,7 @@ var moderatorOf = /* @__PURE__ */ __name((adapter, deps) => ({
|
|
|
35134
35418
|
}, "removePerson")
|
|
35135
35419
|
}), "moderatorOf");
|
|
35136
35420
|
|
|
35137
|
-
// 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
|
|
35138
35422
|
var noteItem = /* @__PURE__ */ __name((provider, note) => ({
|
|
35139
35423
|
id: note.id,
|
|
35140
35424
|
contact: formatReference({ type: "contact", provider, id: note.personId }),
|
|
@@ -35178,7 +35462,7 @@ var privatePeopleService = /* @__PURE__ */ __name((deps) => {
|
|
|
35178
35462
|
};
|
|
35179
35463
|
}, "privatePeopleService");
|
|
35180
35464
|
|
|
35181
|
-
// 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
|
|
35182
35466
|
var empty = /* @__PURE__ */ __name(() => ({
|
|
35183
35467
|
total: 0,
|
|
35184
35468
|
population: 0,
|
|
@@ -35434,7 +35718,134 @@ var rankingsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
35434
35718
|
}, "evidence")
|
|
35435
35719
|
}), "rankingsService");
|
|
35436
35720
|
|
|
35437
|
-
// 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
|
|
35438
35849
|
var savedSearchItem = /* @__PURE__ */ __name((one) => ({
|
|
35439
35850
|
id: one.id,
|
|
35440
35851
|
name: one.name,
|
|
@@ -35563,7 +35974,7 @@ var searchesService = /* @__PURE__ */ __name((deps) => {
|
|
|
35563
35974
|
};
|
|
35564
35975
|
}, "searchesService");
|
|
35565
35976
|
|
|
35566
|
-
// 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
|
|
35567
35978
|
var TAGGING_QUERY = {
|
|
35568
35979
|
entity: "tagging",
|
|
35569
35980
|
backend: "sql",
|
|
@@ -35647,7 +36058,7 @@ var tagsService = /* @__PURE__ */ __name((deps) => {
|
|
|
35647
36058
|
};
|
|
35648
36059
|
}, "tagsService");
|
|
35649
36060
|
|
|
35650
|
-
// 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
|
|
35651
36062
|
var actionOf = /* @__PURE__ */ __name(({ title, closed, pinned, hidden, icon }) => {
|
|
35652
36063
|
const set = [closed, pinned, hidden].filter((one) => one !== void 0).length;
|
|
35653
36064
|
if (title !== void 0 || icon !== void 0 || set !== 1)
|
|
@@ -35846,7 +36257,7 @@ var topicsService = /* @__PURE__ */ __name((deps) => {
|
|
|
35846
36257
|
};
|
|
35847
36258
|
}, "topicsService");
|
|
35848
36259
|
|
|
35849
|
-
// 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
|
|
35850
36261
|
import { createHash as createHash11, randomUUID as randomUUID5 } from "node:crypto";
|
|
35851
36262
|
var hash2 = /* @__PURE__ */ __name((value) => createHash11("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
|
|
35852
36263
|
var positive = /* @__PURE__ */ __name((value, name, minimum = 1) => {
|
|
@@ -35892,13 +36303,13 @@ var prepareEvidencePacket = /* @__PURE__ */ __name(({ kind, source, page, limits
|
|
|
35892
36303
|
threadId: message.threadId ?? null,
|
|
35893
36304
|
attachmentKinds: message.attachments.map(({ kind: attachmentKind }) => attachmentKind)
|
|
35894
36305
|
};
|
|
35895
|
-
const
|
|
35896
|
-
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);
|
|
35897
36308
|
if (bytes2 > limits.bytes - contentBytes) {
|
|
35898
36309
|
truncatedBy = "bytes";
|
|
35899
36310
|
break;
|
|
35900
36311
|
}
|
|
35901
|
-
items.push(
|
|
36312
|
+
items.push(item2);
|
|
35902
36313
|
contentBytes += bytes2;
|
|
35903
36314
|
}
|
|
35904
36315
|
const content = {
|
|
@@ -35920,7 +36331,7 @@ var prepareEvidencePacket = /* @__PURE__ */ __name(({ kind, source, page, limits
|
|
|
35920
36331
|
return { ...content, id: randomUUID5(), fingerprint: hash2(content) };
|
|
35921
36332
|
}, "prepareEvidencePacket");
|
|
35922
36333
|
|
|
35923
|
-
// 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
|
|
35924
36335
|
var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, limit, before: before2 }, messenger = {}) => {
|
|
35925
36336
|
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
|
|
35926
36337
|
throw new CliError("validation_error", "evidence message limit must be an integer from 1 to 100");
|
|
@@ -35940,7 +36351,7 @@ var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, l
|
|
|
35940
36351
|
return { ...packet, nextBeforeId: older && last ? last.id : null };
|
|
35941
36352
|
}, "readEvidencePacket");
|
|
35942
36353
|
|
|
35943
|
-
// 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
|
|
35944
36355
|
var scopeKeys = [
|
|
35945
36356
|
"accountId",
|
|
35946
36357
|
"meetingId",
|
|
@@ -35962,7 +36373,7 @@ var optionKeys = /* @__PURE__ */ new Set([
|
|
|
35962
36373
|
"maxVocabularyReadBytes"
|
|
35963
36374
|
]);
|
|
35964
36375
|
|
|
35965
|
-
// 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
|
|
35966
36377
|
var communicationFields = {
|
|
35967
36378
|
sources: pipe(array(strictObject({
|
|
35968
36379
|
id: pipe(string(), regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)),
|
|
@@ -35994,7 +36405,7 @@ var communicationRequest = /* @__PURE__ */ __name((value, preparationAfter) => {
|
|
|
35994
36405
|
return { ...input, after, before: before2 };
|
|
35995
36406
|
}, "communicationRequest");
|
|
35996
36407
|
|
|
35997
|
-
// 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
|
|
35998
36409
|
var MEETING_PREPARATION_LIMITS = {
|
|
35999
36410
|
meetings: { min: 1, max: 20, default: 5 },
|
|
36000
36411
|
cues: { min: 1, max: 100, default: 10 },
|
|
@@ -36067,7 +36478,7 @@ var validateMeetingPreparationRequest = /* @__PURE__ */ __name((externalId, orig
|
|
|
36067
36478
|
};
|
|
36068
36479
|
}, "validateMeetingPreparationRequest");
|
|
36069
36480
|
|
|
36070
|
-
// 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
|
|
36071
36482
|
var validatePreparationCommunications = /* @__PURE__ */ __name((section, request, after) => {
|
|
36072
36483
|
const fail2 = /* @__PURE__ */ __name(() => {
|
|
36073
36484
|
throw new CliError("invalid_response", "Preparation communications returned another selection or invalid evidence");
|
|
@@ -36077,13 +36488,13 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
|
|
|
36077
36488
|
fail2();
|
|
36078
36489
|
return;
|
|
36079
36490
|
}
|
|
36080
|
-
const
|
|
36081
|
-
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)
|
|
36082
36493
|
fail2();
|
|
36083
|
-
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)
|
|
36084
36495
|
fail2();
|
|
36085
36496
|
for (const source of section.sources) {
|
|
36086
|
-
if (!
|
|
36497
|
+
if (!expected2.sources.some((s) => s.id === source.selectionId))
|
|
36087
36498
|
fail2();
|
|
36088
36499
|
try {
|
|
36089
36500
|
contextSource(source.source);
|
|
@@ -36093,20 +36504,20 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
|
|
|
36093
36504
|
}
|
|
36094
36505
|
if (!Array.isArray(section.items) || section.items.length > 20)
|
|
36095
36506
|
fail2();
|
|
36096
|
-
for (const
|
|
36097
|
-
if (!
|
|
36507
|
+
for (const item2 of section.items) {
|
|
36508
|
+
if (!item2)
|
|
36098
36509
|
fail2();
|
|
36099
|
-
const source = section.sources.find((s) => s.selectionId ===
|
|
36100
|
-
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)
|
|
36101
36512
|
fail2();
|
|
36102
36513
|
try {
|
|
36103
36514
|
if (source.kind === "document") {
|
|
36104
|
-
const id2 = Number(
|
|
36105
|
-
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}`)
|
|
36106
36517
|
fail2();
|
|
36107
36518
|
} else {
|
|
36108
|
-
const locator = parseLocator(
|
|
36109
|
-
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)
|
|
36110
36521
|
fail2();
|
|
36111
36522
|
}
|
|
36112
36523
|
} catch {
|
|
@@ -36115,7 +36526,7 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
|
|
|
36115
36526
|
}
|
|
36116
36527
|
}, "validatePreparationCommunications");
|
|
36117
36528
|
|
|
36118
|
-
// 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
|
|
36119
36530
|
var upgradePackage = /* @__PURE__ */ __name(async ({ current, command, packageName, check: check2 }, ports) => {
|
|
36120
36531
|
const installer = ports.installer();
|
|
36121
36532
|
const argv = updateCommand(installer, packageName);
|
|
@@ -36180,7 +36591,7 @@ var dayAfter = /* @__PURE__ */ __name((published) => {
|
|
|
36180
36591
|
return Number.isNaN(time) ? null : new Date(time + 24 * 60 * 60 * 1e3).toISOString();
|
|
36181
36592
|
}, "dayAfter");
|
|
36182
36593
|
|
|
36183
|
-
// 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
|
|
36184
36595
|
var servicesFor = /* @__PURE__ */ __name((deps) => {
|
|
36185
36596
|
const pictures = picturesService(deps);
|
|
36186
36597
|
const base = {
|
|
@@ -36190,6 +36601,7 @@ var servicesFor = /* @__PURE__ */ __name((deps) => {
|
|
|
36190
36601
|
counters: countersService(deps),
|
|
36191
36602
|
retention: retentionService(deps),
|
|
36192
36603
|
rankings: rankingsService(deps),
|
|
36604
|
+
replyStats: replyStatsService(deps),
|
|
36193
36605
|
topics: topicsService(deps),
|
|
36194
36606
|
messages: withPictures(messagesService(deps), pictures),
|
|
36195
36607
|
chats: chatsService(deps),
|
|
@@ -36216,7 +36628,7 @@ var servicesFor = /* @__PURE__ */ __name((deps) => {
|
|
|
36216
36628
|
return deps.messenger.services ? { ...base, ...deps.messenger.services(base, deps) } : base;
|
|
36217
36629
|
}, "servicesFor");
|
|
36218
36630
|
|
|
36219
|
-
// 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
|
|
36220
36632
|
import { createHash as createHash12 } from "node:crypto";
|
|
36221
36633
|
import { chmodSync, lstatSync, mkdirSync as mkdirSync3, rmSync } from "node:fs";
|
|
36222
36634
|
import { createConnection, createServer } from "node:net";
|
|
@@ -36437,7 +36849,7 @@ var relayCommand = /* @__PURE__ */ __name((path, request, options) => new Promis
|
|
|
36437
36849
|
}, () => finish({ error: stopped() }));
|
|
36438
36850
|
}), "relayCommand");
|
|
36439
36851
|
|
|
36440
|
-
// 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
|
|
36441
36853
|
var lentConnection = /* @__PURE__ */ __name((connection, watchers) => throughWrapper(connection, {
|
|
36442
36854
|
close: /* @__PURE__ */ __name(async () => {
|
|
36443
36855
|
}, "close"),
|
|
@@ -36564,8 +36976,11 @@ export {
|
|
|
36564
36976
|
EVENTS_DAYS,
|
|
36565
36977
|
TRACKED_DAYS,
|
|
36566
36978
|
CHAT_KINDS,
|
|
36979
|
+
taskAccount,
|
|
36980
|
+
RULES_IN,
|
|
36567
36981
|
ARRIVAL_WINDOW,
|
|
36568
36982
|
applyTaskRulesOnArrival,
|
|
36983
|
+
FIRST_PASS_DAYS,
|
|
36569
36984
|
applyTaskRulesSinceLastPass,
|
|
36570
36985
|
openRequestTask,
|
|
36571
36986
|
applyTaskRulesToChats,
|
|
@@ -36645,7 +37060,9 @@ export {
|
|
|
36645
37060
|
withoutPhone,
|
|
36646
37061
|
savedSearchItem,
|
|
36647
37062
|
TAGGING_QUERY,
|
|
37063
|
+
TASK_STATS_BY,
|
|
36648
37064
|
TASK_QUERY,
|
|
37065
|
+
TASK_STATS_QUERY,
|
|
36649
37066
|
TASK_PAIR_QUERY,
|
|
36650
37067
|
CLAIM_LEASE_MS,
|
|
36651
37068
|
taskTypeOf,
|