@wirecat/tg-cli 0.113.0 → 0.115.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 +6 -2
- package/dist/bin/tg.js.map +1 -1
- package/dist/bundle/{adapter-EQKEFGPB.js → adapter-ODK7R4LY.js} +56 -53
- package/dist/bundle/{all-profiles-TTBFF663.js → all-profiles-AQYM65BS.js} +9 -8
- package/dist/bundle/{anthropic-XPZS7267.js → anthropic-VBDSVNIM.js} +6 -5
- package/dist/bundle/{app-server-ZSZ7KRAY.js → app-server-YOIHLBNS.js} +47 -43
- package/dist/bundle/{bot-api-X7BOVNIO.js → bot-api-TRYLGQKK.js} +51 -47
- package/dist/bundle/{bot-history-DWIUIPN5.js → bot-history-7DTJLBBJ.js} +18 -16
- package/dist/bundle/{bun-ZGZVAJU2.js → bun-XIMM6EHD.js} +2 -2
- package/dist/bundle/{bun-sqlite-UN2UJ6SI.js → bun-sqlite-6B3BL5IV.js} +5 -4
- package/dist/bundle/{chunk-K3F46QVN.js → chunk-2TC76TLJ.js} +4 -4
- package/dist/bundle/{chunk-JRTZ5I6M.js → chunk-5ROWSRK7.js} +2 -2
- package/dist/bundle/{chunk-PHYDBR5M.js → chunk-63YKD7YA.js} +2 -2
- package/dist/bundle/{chunk-PCRLXJRH.js → chunk-77M3IAVU.js} +193 -129
- package/dist/bundle/{chunk-VDATXIO4.js → chunk-A4BQGSKI.js} +9 -9
- package/dist/bundle/{chunk-HO53POQG.js → chunk-AICS3TSF.js} +8 -41
- package/dist/bundle/{chunk-AVUIWZTP.js → chunk-AVWPMJ6E.js} +2 -2
- package/dist/bundle/{chunk-G74QMORP.js → chunk-BEQPZA3S.js} +2 -2
- package/dist/bundle/{chunk-JO45BOYE.js → chunk-BIEBJLYO.js} +8 -3
- package/dist/bundle/{chunk-J6USEBA6.js → chunk-BPPRR7TV.js} +2200 -945
- package/dist/bundle/chunk-CCHHEMPM.js +71 -0
- package/dist/bundle/{chunk-T4TTRFP5.js → chunk-CNO3R4O4.js} +10 -8
- package/dist/bundle/{chunk-IDUYRTPF.js → chunk-D4E345BC.js} +2 -2
- package/dist/bundle/{chunk-OYNSFQ7K.js → chunk-D72URWJE.js} +1 -39
- package/dist/bundle/{chunk-T5RM4Y35.js → chunk-DIABP7ZP.js} +3 -3
- package/dist/bundle/chunk-EW3XTUPB.js +166 -0
- package/dist/bundle/{chunk-KOWQVHXI.js → chunk-GCFU6WBE.js} +3 -3
- package/dist/bundle/{chunk-6WJ5M2Q4.js → chunk-GWDMKEDY.js} +4 -4
- package/dist/bundle/{chunk-TQ6EA7TB.js → chunk-GX4DMI4H.js} +17 -16
- package/dist/bundle/{chunk-KK3JVOOV.js → chunk-HZKWB6WS.js} +36 -35
- package/dist/bundle/chunk-ILHTNOIV.js +23 -0
- package/dist/bundle/{chunk-JDQSX2JQ.js → chunk-IUDIRZVU.js} +8443 -7398
- package/dist/bundle/{chunk-TUD4MU7S.js → chunk-JZXQZW2D.js} +2 -2
- package/dist/bundle/{chunk-Q264PYGE.js → chunk-KDOBY524.js} +55 -20
- package/dist/bundle/{chunk-OQR442B6.js → chunk-KIZT2MI6.js} +1 -1
- package/dist/bundle/chunk-L4CMCC3V.js +34 -0
- package/dist/bundle/{chunk-IYKRHDX6.js → chunk-LUIPXRKN.js} +188 -57
- package/dist/bundle/{chunk-GX4LRLVD.js → chunk-M7B5IMH3.js} +5103 -937
- package/dist/bundle/{chunk-4GLMEES6.js → chunk-MUZ4KYGY.js} +4 -2
- package/dist/bundle/{chunk-KQ23JWLJ.js → chunk-NTW5ZE47.js} +164 -276
- package/dist/bundle/{chunk-UIVLDKWT.js → chunk-O7CBGHI7.js} +1 -1
- package/dist/bundle/{chunk-KVLCIZUK.js → chunk-OMP6ALBT.js} +3 -3
- package/dist/bundle/{chunk-VVA4555T.js → chunk-OSP335AJ.js} +8 -8
- package/dist/bundle/{chunk-EGR5IJCG.js → chunk-OUX3QMYI.js} +39 -31
- package/dist/bundle/{chunk-VDEXNNMH.js → chunk-PEJHI7QO.js} +6 -4
- package/dist/bundle/{chunk-6F6K3LWV.js → chunk-PEKTB3FQ.js} +18 -15
- package/dist/bundle/{chunk-Z6TRIW2O.js → chunk-POKTQZOM.js} +11 -9
- package/dist/bundle/chunk-PQLBPYJR.js +46 -0
- package/dist/bundle/{chunk-BI5YJZJB.js → chunk-PZAEI4NM.js} +115 -29
- package/dist/bundle/{chunk-HNN7EKIM.js → chunk-QK6VLKG5.js} +338 -169
- package/dist/bundle/{chunk-5NF7M4MN.js → chunk-RFRI2HFT.js} +1 -1
- package/dist/bundle/{chunk-OC4RRFKH.js → chunk-RHUNMU4Q.js} +6 -6
- package/dist/bundle/{chunk-PHPNA2HU.js → chunk-TMATSEP5.js} +14 -12
- package/dist/bundle/{chunk-JW7BMJ6O.js → chunk-TQYMLXDS.js} +5 -3
- package/dist/bundle/{chunk-MTX5EDYJ.js → chunk-U67TSAAO.js} +1136 -535
- package/dist/bundle/{chunk-7IWDS2CM.js → chunk-UBQ3LOF6.js} +4 -4
- package/dist/bundle/{chunk-UE75KPAC.js → chunk-UY7GJRGY.js} +4 -4
- package/dist/bundle/{chunk-OSBAISA5.js → chunk-VQCWVZWG.js} +8 -13
- package/dist/bundle/{chunk-XZ2ZHIAO.js → chunk-VVKEWWSO.js} +1 -1
- package/dist/bundle/{chunk-ENXO43TV.js → chunk-WDNNN3J4.js} +8 -8
- package/dist/bundle/{chunk-AGUCXSSM.js → chunk-WINKEV4F.js} +7 -20
- package/dist/bundle/{chunk-XXNJF3ZM.js → chunk-WMG4IGEB.js} +75 -33
- package/dist/bundle/{chunk-6OKGHHRL.js → chunk-WMRFAK5B.js} +35 -35
- package/dist/bundle/{chunk-4SQB5VKL.js → chunk-WOQGUIXE.js} +1 -1
- package/dist/bundle/{chunk-U3MJQLZQ.js → chunk-XIYRHIBK.js} +13 -13
- package/dist/bundle/{chunk-ZID2Y4XU.js → chunk-XY7IGVVS.js} +2 -2
- package/dist/bundle/{chunk-3MAYYFKY.js → chunk-Y3AQHPAJ.js} +1 -1
- package/dist/bundle/{chunk-WSAHUQ6K.js → chunk-YCUQKFGD.js} +3 -3
- package/dist/bundle/command-contract-YF4KGFXC.js +32 -0
- package/dist/bundle/{decode-AMQVTEMW.js → decode-2GATBZGH.js} +7 -6
- package/dist/bundle/dispatch-MJMW7WDH.js +411 -0
- package/dist/bundle/{echarts-ECYONFQJ.js → echarts-GKEZEAL7.js} +2 -2
- package/dist/bundle/{embed-VZYBZEWI.js → embed-TBQPLA4Y.js} +6 -5
- package/dist/bundle/{embedder-GSWBGHRK.js → embedder-B5DTNCRO.js} +11 -10
- package/dist/bundle/entry-A6DEW2TD.js +18 -0
- package/dist/bundle/failure-TLF3SISS.js +24 -0
- package/dist/bundle/first-run-3N5AABEY.js +27 -0
- package/dist/bundle/first-screen-HANARM67.js +30 -0
- package/dist/bundle/{instructions-AXLQQS3G.js → instructions-P5E34PQR.js} +1 -1
- package/dist/bundle/{mcp-VVMPUDSL.js → mcp-MNI62HHE.js} +5 -3
- package/dist/bundle/{node-7JHC5K77.js → node-GKPRXS5Y.js} +2 -2
- package/dist/bundle/{node-sqlite-LYJEK46T.js → node-sqlite-GIDPALK3.js} +11 -4
- package/dist/bundle/{oauth-BROPKI3K.js → oauth-C57W4IMD.js} +7 -6
- package/dist/bundle/{open-C6XQ46JK.js → open-E6Q4WRPU.js} +5 -3
- package/dist/bundle/{openai-VWSU7ZDD.js → openai-5WMXY2KP.js} +15 -14
- package/dist/bundle/{process-QKEFL5HL.js → process-U2P5Z6UF.js} +1 -1
- package/dist/bundle/{program-ACY7O33O.js → program-FEUDU6GF.js} +62 -57
- package/dist/bundle/{prompt-EGULVW2F.js → prompt-4NGAZGHE.js} +5 -4
- package/dist/bundle/{proxy-transport-KIMADLQ2.js → proxy-transport-MGCJ7JAW.js} +5 -4
- package/dist/bundle/{recognize-UMTKLWVR.js → recognize-EUHRBA7V.js} +4 -3
- package/dist/bundle/{remote-DABI7PSQ.js → remote-3JHLB2FV.js} +7 -6
- package/dist/bundle/{rerank-ZFATWWBE.js → rerank-ZZ45SZPC.js} +7 -6
- package/dist/bundle/{serve-B7YYCMGN.js → serve-XOGX5FC5.js} +12 -10
- package/dist/bundle/server-DRE5MJ76.js +59 -0
- package/dist/bundle/{server-DGKZISZH.js → server-I6O72XP5.js} +36 -34
- package/dist/bundle/{state-AQ2PABA5.js → state-BIUYTGH6.js} +6 -5
- package/dist/bundle/{store-46GJTFLJ.js → store-FOJFYOMR.js} +12 -10
- package/dist/bundle/store-maintenance-command-YKV2C34N.js +49 -0
- package/dist/bundle/tg.js +159 -14
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +6 -4
- package/dist/commands/context.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +5 -0
- package/dist/reasons.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -4
- package/skills/tg-cli/SKILL.md +2 -0
- package/dist/bundle/chunk-452UZ2PU.js +0 -3603
- package/dist/bundle/command-contract-GV67H22L.js +0 -32
- package/dist/bundle/entry-LALZILY4.js +0 -14
- package/dist/bundle/first-run-LEAI623Q.js +0 -24
- package/dist/bundle/first-screen-MOCVLE23.js +0 -30
- package/dist/bundle/identity-54HA5GN6.js +0 -11
- package/dist/bundle/server-UC7UWUIS.js +0 -56
- package/dist/bundle/store-maintenance-command-FCFKHGRM.js +0 -45
- /package/dist/bundle/{chunk-HPXYN7F3.js → chunk-NUN6OGOV.js} +0 -0
|
@@ -4,13 +4,16 @@ import {
|
|
|
4
4
|
OFFLINE,
|
|
5
5
|
capability,
|
|
6
6
|
chatIdIn,
|
|
7
|
+
chatReferenceOf,
|
|
8
|
+
ensureAccount,
|
|
7
9
|
foldName,
|
|
8
10
|
isId,
|
|
9
11
|
pickPerson,
|
|
12
|
+
profilesOnAccount,
|
|
10
13
|
refuseLacking,
|
|
11
14
|
servicesFor,
|
|
12
15
|
throughWrapper
|
|
13
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-IUDIRZVU.js";
|
|
14
17
|
import {
|
|
15
18
|
CEILING_KEY,
|
|
16
19
|
LOG_ATTRIBUTES,
|
|
@@ -26,6 +29,7 @@ import {
|
|
|
26
29
|
keyForCommand,
|
|
27
30
|
keyForWrite,
|
|
28
31
|
levelFor,
|
|
32
|
+
limitBatch,
|
|
29
33
|
logAttributes,
|
|
30
34
|
permissionIssues,
|
|
31
35
|
publicIssue,
|
|
@@ -34,35 +38,35 @@ import {
|
|
|
34
38
|
rememberAccount,
|
|
35
39
|
rootOf2 as rootOf,
|
|
36
40
|
skipFlagFor
|
|
37
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-M7B5IMH3.js";
|
|
38
42
|
import {
|
|
39
43
|
isCliFailure,
|
|
40
44
|
providerErrorKey
|
|
41
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-POKTQZOM.js";
|
|
42
46
|
import {
|
|
43
47
|
MESSENGER_CHANGE_REFUSAL,
|
|
44
48
|
readOnlyRefusal
|
|
45
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-D4E345BC.js";
|
|
46
50
|
import {
|
|
47
51
|
servingProfiles
|
|
48
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-GCFU6WBE.js";
|
|
49
53
|
import {
|
|
50
54
|
openStore
|
|
51
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-BPPRR7TV.js";
|
|
52
56
|
import {
|
|
53
57
|
logRecordOf,
|
|
54
58
|
realSleep,
|
|
55
59
|
resolvePaths,
|
|
56
60
|
writeSecurely
|
|
57
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-NTW5ZE47.js";
|
|
58
62
|
import {
|
|
59
63
|
CliError
|
|
60
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-CCHHEMPM.js";
|
|
61
65
|
import {
|
|
62
66
|
__name
|
|
63
67
|
} from "./chunk-ZVVMGPBJ.js";
|
|
64
68
|
|
|
65
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
69
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/cli/messenger/ask.js
|
|
66
70
|
import { openSync } from "node:fs";
|
|
67
71
|
import { createInterface } from "node:readline";
|
|
68
72
|
import { ReadStream } from "node:tty";
|
|
@@ -117,10 +121,10 @@ var terminalAsker = /* @__PURE__ */ __name((command) => async (key, request) =>
|
|
|
117
121
|
throw new CliError("cancelled", `${key}: not done \u2014 the answer was no`);
|
|
118
122
|
}, "terminalAsker");
|
|
119
123
|
|
|
120
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
124
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/guard.js
|
|
121
125
|
import { randomUUID } from "node:crypto";
|
|
122
126
|
|
|
123
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
127
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/flood.js
|
|
124
128
|
import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
125
129
|
import { dirname, join } from "node:path";
|
|
126
130
|
var MOST_DEADLINES = 50;
|
|
@@ -204,11 +208,11 @@ var FloodMemory = class {
|
|
|
204
208
|
}
|
|
205
209
|
};
|
|
206
210
|
|
|
207
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
211
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/journal.js
|
|
208
212
|
import { appendFileSync, mkdirSync as mkdirSync3, readFileSync as readFileSync2 } from "node:fs";
|
|
209
213
|
import { dirname as dirname3, join as join2 } from "node:path";
|
|
210
214
|
|
|
211
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
215
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/file-lock.js
|
|
212
216
|
import { closeSync, mkdirSync as mkdirSync2, openSync as openSync2, statSync, unlinkSync } from "node:fs";
|
|
213
217
|
import { dirname as dirname2 } from "node:path";
|
|
214
218
|
var LOCK_WAIT_MS = 5e3;
|
|
@@ -275,7 +279,7 @@ var lockTime = /* @__PURE__ */ __name((lock) => {
|
|
|
275
279
|
}
|
|
276
280
|
}, "lockTime");
|
|
277
281
|
|
|
278
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
282
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/journal.js
|
|
279
283
|
var sendsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join2(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "sends", `${profile}.jsonl`), "sendsPathFor");
|
|
280
284
|
var SendJournal = class {
|
|
281
285
|
static {
|
|
@@ -352,7 +356,7 @@ var withSendId = /* @__PURE__ */ __name((entry) => {
|
|
|
352
356
|
return cid === void 0 || rest.sendId !== void 0 ? rest : { ...rest, sendId: String(cid) };
|
|
353
357
|
}, "withSendId");
|
|
354
358
|
|
|
355
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
359
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/recipients.js
|
|
356
360
|
import { existsSync, readFileSync as readFileSync3, rmSync } from "node:fs";
|
|
357
361
|
import { join as join3 } from "node:path";
|
|
358
362
|
var recipientsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join3(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "profiles", `${profile}.recipients.json`), "recipientsPathFor");
|
|
@@ -464,7 +468,7 @@ var RecipientList = class {
|
|
|
464
468
|
}
|
|
465
469
|
};
|
|
466
470
|
|
|
467
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
471
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/guard.js
|
|
468
472
|
var HOUR_MS = 60 * 60 * 1e3;
|
|
469
473
|
var READS_UNDER_HOLD = /* @__PURE__ */ new Set([
|
|
470
474
|
"attachments.extract",
|
|
@@ -657,7 +661,7 @@ var guardFor = /* @__PURE__ */ __name((app, settings, warn, env = process.env, a
|
|
|
657
661
|
}), "guardFor");
|
|
658
662
|
var journalFailure = /* @__PURE__ */ __name((error) => error?.code ?? (error instanceof Error ? error.name : "error"), "journalFailure");
|
|
659
663
|
|
|
660
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
664
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/pace.js
|
|
661
665
|
import { readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
662
666
|
import { join as join4 } from "node:path";
|
|
663
667
|
var DEFAULT_PACE = { perMinute: 60, burst: 20 };
|
|
@@ -716,7 +720,7 @@ var Pacer = class {
|
|
|
716
720
|
}
|
|
717
721
|
};
|
|
718
722
|
|
|
719
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
723
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
|
|
720
724
|
var pathOf = /* @__PURE__ */ __name((command) => {
|
|
721
725
|
const words = [];
|
|
722
726
|
for (let at = command; at?.parent; at = at.parent)
|
|
@@ -776,7 +780,7 @@ var refuseUnknownPermissionKeys = /* @__PURE__ */ __name((command, settings, too
|
|
|
776
780
|
throw new CliError("validation_error", `--permission ${key} names no command`, { permission: key });
|
|
777
781
|
}, "refuseUnknownPermissionKeys");
|
|
778
782
|
|
|
779
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
783
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
|
|
780
784
|
var LONG_LIVED = /* @__PURE__ */ new Set(["self", "newSendId", "close", "formatMarkdown", "formatHtml", "storedChats"]);
|
|
781
785
|
var LISTENING = /* @__PURE__ */ new Set(["watch", "feed", "listen", "listenHistory"]);
|
|
782
786
|
var BLOCKING = /* @__PURE__ */ new Set(["frozen", "limited", "banned"]);
|
|
@@ -895,7 +899,7 @@ var flooded = /* @__PURE__ */ __name((messenger, memory, { name, warn, pacer })
|
|
|
895
899
|
});
|
|
896
900
|
}, "flooded");
|
|
897
901
|
|
|
898
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
902
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
|
|
899
903
|
var observed = /* @__PURE__ */ __name((messenger, events) => {
|
|
900
904
|
const timed = /* @__PURE__ */ __name(async (operation, named, work, after) => {
|
|
901
905
|
const write = currentOperation();
|
|
@@ -931,9 +935,9 @@ var observed = /* @__PURE__ */ __name((messenger, events) => {
|
|
|
931
935
|
}, "timed");
|
|
932
936
|
const counted = /* @__PURE__ */ __name(async (operation, onItem, work, count) => {
|
|
933
937
|
const counts = {};
|
|
934
|
-
await timed(operation, {}, () => work((item) => {
|
|
938
|
+
await timed(operation, {}, () => work((item, ...rest) => {
|
|
935
939
|
count(item, counts);
|
|
936
|
-
return onItem(item);
|
|
940
|
+
return onItem(item, ...rest);
|
|
937
941
|
}), () => ({ counts }));
|
|
938
942
|
}, "counted");
|
|
939
943
|
const mint = messenger.newSendId;
|
|
@@ -994,10 +998,37 @@ var byPart = /* @__PURE__ */ __name((batch, counts) => {
|
|
|
994
998
|
counts[part] = (counts[part] ?? 0) + items.length;
|
|
995
999
|
}, "byPart");
|
|
996
1000
|
|
|
997
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1001
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
|
|
998
1002
|
var REKEY_PACING = { lockMs: 50, pauseMs: 25 };
|
|
999
|
-
var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events, pending, announcing, deletedWithoutChat, profile, rekeyed, rekeyPacing = REKEY_PACING, closing, namesFromStore, recipientIds, countsUnread = false }) => {
|
|
1003
|
+
var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events, pending, announcing, deletedWithoutChat, profile, rekeyed, rekeyPacing = REKEY_PACING, closing, namesFromStore, recipientIds, countsUnread = false, historyLimits, command = "cli" }) => {
|
|
1000
1004
|
let warned = false;
|
|
1005
|
+
let limitedNoted = false;
|
|
1006
|
+
const limited = /* @__PURE__ */ __name(async (opened, batch) => {
|
|
1007
|
+
if (!historyLimits || !batch.messages?.length)
|
|
1008
|
+
return { batch, skipped: /* @__PURE__ */ new Map() };
|
|
1009
|
+
const shapes = await opened.chats.historyShapes(account, [...new Set(batch.messages.map((one) => one.chatId))]);
|
|
1010
|
+
return limitBatch(batch, (chatId) => shapes.get(chatId), (chatId) => shapes.get(chatId)?.included === true, historyLimits);
|
|
1011
|
+
}, "limited");
|
|
1012
|
+
const noteLimited = /* @__PURE__ */ __name((skipped) => {
|
|
1013
|
+
if (skipped.size === 0)
|
|
1014
|
+
return;
|
|
1015
|
+
const counts = {
|
|
1016
|
+
chats: skipped.size,
|
|
1017
|
+
messages: 0,
|
|
1018
|
+
group_too_large: 0,
|
|
1019
|
+
older_than_window: 0
|
|
1020
|
+
};
|
|
1021
|
+
for (const skip of skipped.values()) {
|
|
1022
|
+
counts.messages = (counts.messages ?? 0) + skip.messages;
|
|
1023
|
+
counts[skip.reason] = (counts[skip.reason] ?? 0) + 1;
|
|
1024
|
+
}
|
|
1025
|
+
const warning = { event: "warning", code: "history_limited", operation: "history.save", counts };
|
|
1026
|
+
events(warning);
|
|
1027
|
+
if (limitedNoted)
|
|
1028
|
+
return;
|
|
1029
|
+
limitedNoted = true;
|
|
1030
|
+
warn(`history limits left out ${counts.messages} pushed messages of ${skipped.size} chats (big groups, older than the window) \u2014 \`${command} store status\` lists them; \`${command} messages sync <chat> --full-history\` fetches one and keeps it in full`, warning);
|
|
1031
|
+
}, "noteLimited");
|
|
1001
1032
|
let recorded = profile === void 0;
|
|
1002
1033
|
const notWritten = /* @__PURE__ */ __name((operation, error) => {
|
|
1003
1034
|
const warning = { event: "warning", code: "store_not_written", operation };
|
|
@@ -1118,7 +1149,13 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
|
|
|
1118
1149
|
rekeysQueued += rekeys.length;
|
|
1119
1150
|
const saving = previous.then(async () => {
|
|
1120
1151
|
await saveRekeys(rekeys, round);
|
|
1121
|
-
return attempt(operation, (opened) =>
|
|
1152
|
+
return attempt(operation, async (opened) => {
|
|
1153
|
+
const { batch: kept, skipped } = await limited(opened, batch);
|
|
1154
|
+
await fill(opened, account, kept);
|
|
1155
|
+
if (skipped.size > 0)
|
|
1156
|
+
await opened.chats.recordHistorySkips(account, skipped);
|
|
1157
|
+
noteLimited(skipped);
|
|
1158
|
+
});
|
|
1122
1159
|
});
|
|
1123
1160
|
previous = saving;
|
|
1124
1161
|
pending?.add(saving);
|
|
@@ -1128,11 +1165,11 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
|
|
|
1128
1165
|
pending?.delete(saving);
|
|
1129
1166
|
rekeysOnly.delete(saving);
|
|
1130
1167
|
});
|
|
1131
|
-
void onBatch(batch);
|
|
1168
|
+
void onBatch(batch, saving);
|
|
1132
1169
|
return saving;
|
|
1133
1170
|
};
|
|
1134
1171
|
}, "saveBatches");
|
|
1135
|
-
|
|
1172
|
+
const wrapped = throughWrapper(messenger, {
|
|
1136
1173
|
...messenger.forumState ? {
|
|
1137
1174
|
forumState: /* @__PURE__ */ __name(async (chatId) => {
|
|
1138
1175
|
const state = await capability(messenger, "forumState", "read forum settings")(chatId);
|
|
@@ -1353,7 +1390,54 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
|
|
|
1353
1390
|
return sent;
|
|
1354
1391
|
}, "send")
|
|
1355
1392
|
});
|
|
1393
|
+
const chatOf2 = /* @__PURE__ */ __name(async (typed) => {
|
|
1394
|
+
const named = chatReferenceOf(typed, account.provider);
|
|
1395
|
+
if (!named)
|
|
1396
|
+
return typed;
|
|
1397
|
+
let known;
|
|
1398
|
+
try {
|
|
1399
|
+
known = account.account;
|
|
1400
|
+
} catch {
|
|
1401
|
+
}
|
|
1402
|
+
await ensureAccount(named, { account: known, ...profile ? { profile: profile.name } : {} }, async (other) => {
|
|
1403
|
+
const opened = await store();
|
|
1404
|
+
return opened && profilesOnAccount(opened, profile?.app, account.provider)(other);
|
|
1405
|
+
});
|
|
1406
|
+
return named.chat;
|
|
1407
|
+
}, "chatOf");
|
|
1408
|
+
return withChatReferences(wrapped, chatOf2);
|
|
1356
1409
|
}, "stored");
|
|
1410
|
+
var TYPED_CHAT = [
|
|
1411
|
+
"resolve",
|
|
1412
|
+
"chat",
|
|
1413
|
+
"history",
|
|
1414
|
+
"around",
|
|
1415
|
+
"historyAfter",
|
|
1416
|
+
"historyBefore",
|
|
1417
|
+
"historyFrom",
|
|
1418
|
+
"topics",
|
|
1419
|
+
"topic",
|
|
1420
|
+
"topicHistory",
|
|
1421
|
+
"download",
|
|
1422
|
+
"transcribe",
|
|
1423
|
+
"scheduled",
|
|
1424
|
+
"admins",
|
|
1425
|
+
"chatEvents",
|
|
1426
|
+
"leave",
|
|
1427
|
+
"group",
|
|
1428
|
+
"officialChatStats"
|
|
1429
|
+
];
|
|
1430
|
+
var withChatReferences = /* @__PURE__ */ __name((adapter, chatOf2) => {
|
|
1431
|
+
const methods = adapter;
|
|
1432
|
+
const own = Object.fromEntries(TYPED_CHAT.flatMap((name) => {
|
|
1433
|
+
const method = methods[name];
|
|
1434
|
+
if (typeof method !== "function")
|
|
1435
|
+
return [];
|
|
1436
|
+
const call = /* @__PURE__ */ __name(async (typed, ...rest) => method.call(adapter, await chatOf2(typed), ...rest), "call");
|
|
1437
|
+
return [[name, call]];
|
|
1438
|
+
}));
|
|
1439
|
+
return throughWrapper(adapter, own);
|
|
1440
|
+
}, "withChatReferences");
|
|
1357
1441
|
var saveSent = /* @__PURE__ */ __name((opened, account, typed, message, options, into = message.chatId || typed) => opened.messages.saveMessages(account, into, [message], { ...options, typedChatId: typed }), "saveSent");
|
|
1358
1442
|
var storedChat = /* @__PURE__ */ __name(async (store, account, traits, reference) => {
|
|
1359
1443
|
const bound = store.forAccount(account);
|
|
@@ -1490,7 +1574,7 @@ var keep = /* @__PURE__ */ __name(async (store, account, event, seenAt, among, c
|
|
|
1490
1574
|
}
|
|
1491
1575
|
}, "keep");
|
|
1492
1576
|
|
|
1493
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1577
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
|
|
1494
1578
|
var lazyStore = /* @__PURE__ */ __name((env, command, version) => {
|
|
1495
1579
|
let opened;
|
|
1496
1580
|
return {
|
|
@@ -1668,7 +1752,8 @@ var connected = /* @__PURE__ */ __name((connection, { app, provider, name, delet
|
|
|
1668
1752
|
rekeyed: /* @__PURE__ */ __name((from, to) => rekeyRecipients(app, settings.profile, env, renderer.warn, from, to), "rekeyed"),
|
|
1669
1753
|
recipientIds: /* @__PURE__ */ __name(() => (new RecipientList(recipientsPathFor(app, settings.profile, env), app.command).read() ?? []).flatMap((recipient) => [recipient.id, ...recipient.partnerId ? [recipient.partnerId] : []]), "recipientIds"),
|
|
1670
1754
|
...history === "store" ? { namesFromStore: savedChatId ? { savedChatId } : {} } : {},
|
|
1671
|
-
...unreadCounts === "store" ? { countsUnread: true } : {}
|
|
1755
|
+
...unreadCounts === "store" ? { countsUnread: true } : {},
|
|
1756
|
+
...history === "store" && settings.historyLimits ? { historyLimits: settings.historyLimits, command: `${app.command} ${settings.profile}` } : {}
|
|
1672
1757
|
});
|
|
1673
1758
|
const passives = history === "store" && self !== null && !watching ? passivesOf(saving).map((passive) => listened(passive, events, renderer.warn, closeWaitMs)) : [];
|
|
1674
1759
|
return {
|
|
@@ -1830,6 +1915,7 @@ var messengerContext = /* @__PURE__ */ __name((command, messenger, resolving = {
|
|
|
1830
1915
|
// Turning recording off by name (--no-record, or record: false) keeps no search history either.
|
|
1831
1916
|
history: base.settings.record,
|
|
1832
1917
|
searchCatchUp: base.settings.searchCatchUp,
|
|
1918
|
+
...base.settings.historyLimits ? { historyLimits: base.settings.historyLimits } : {},
|
|
1833
1919
|
pictures: base.settings.pictureSearch,
|
|
1834
1920
|
reranker: base.settings.searchReranker,
|
|
1835
1921
|
guard,
|