@wirecat/tg-cli 0.100.0 → 0.102.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.
Files changed (117) hide show
  1. package/README.md +3 -3
  2. package/dist/bin/tg.js +1 -1
  3. package/dist/bot/transport.d.ts.map +1 -1
  4. package/dist/bot/transport.js +14 -17
  5. package/dist/bot/transport.js.map +1 -1
  6. package/dist/bundle/{adapter-2LVPMFKF.js → adapter-M2HRSFFL.js} +95 -33
  7. package/dist/bundle/{all-profiles-BLTK2AAB.js → all-profiles-GOD2QNTK.js} +42 -12
  8. package/dist/bundle/{anthropic-RJE4XEOO.js → anthropic-LKU7RWMA.js} +5 -5
  9. package/dist/bundle/{bot-api-4XM3NVWG.js → bot-api-X3MPFVPL.js} +49 -53
  10. package/dist/bundle/{bot-history-WVM5GEQN.js → bot-history-OUMVVG22.js} +15 -15
  11. package/dist/bundle/{bun-UZXO2LRQ.js → bun-LIZ6MKFS.js} +2 -2
  12. package/dist/bundle/{bun-sqlite-GJLGSQIT.js → bun-sqlite-2IFQYQ44.js} +4 -4
  13. package/dist/bundle/chunk-264DAFJV.js +161 -0
  14. package/dist/bundle/{chunk-ASDZHG5I.js → chunk-2SUTCDGO.js} +2 -2
  15. package/dist/bundle/{chunk-2IM4M7Q2.js → chunk-2XBSVRT2.js} +1 -1
  16. package/dist/bundle/{chunk-Q26JMPBP.js → chunk-334UBWOB.js} +11 -11
  17. package/dist/bundle/{chunk-MQNFEVAH.js → chunk-4PDEQL6T.js} +2 -2
  18. package/dist/bundle/chunk-4QB4WDLT.js +922 -0
  19. package/dist/bundle/{chunk-66E5QDLH.js → chunk-5D6OJREA.js} +1 -1
  20. package/dist/bundle/{chunk-RDQMV6EU.js → chunk-5DFGJPT6.js} +4 -4
  21. package/dist/bundle/{chunk-GTURDJJD.js → chunk-5KU4UQBM.js} +1 -1
  22. package/dist/bundle/{chunk-JSKT5UZX.js → chunk-5VSR5ENL.js} +8 -8
  23. package/dist/bundle/{chunk-DN4QUTWU.js → chunk-AUOXTGTU.js} +1 -1
  24. package/dist/bundle/{chunk-X4Y2ROJI.js → chunk-BBC546ZA.js} +91 -2
  25. package/dist/bundle/{chunk-RER6DAHP.js → chunk-BQYTIYGB.js} +171 -148
  26. package/dist/bundle/{chunk-3S5CL55R.js → chunk-CLWYQNSC.js} +6 -6
  27. package/dist/bundle/{chunk-I6WZJVRT.js → chunk-CRZPQQHE.js} +59 -46
  28. package/dist/bundle/chunk-DE7LFMY2.js +440 -0
  29. package/dist/bundle/{chunk-GYEOQS2D.js → chunk-DG62L57H.js} +17 -17
  30. package/dist/bundle/{chunk-QU2FJMFB.js → chunk-ENE5CSVY.js} +2903 -1490
  31. package/dist/bundle/{chunk-P26LWFNZ.js → chunk-ERQDBK5I.js} +1 -1
  32. package/dist/bundle/{chunk-UD4DOZCN.js → chunk-F2TG3BA2.js} +6 -6
  33. package/dist/bundle/{chunk-4U7QOFDA.js → chunk-FBWOQMPE.js} +1698 -816
  34. package/dist/bundle/{chunk-JFJVS5JC.js → chunk-FOUE7XLK.js} +2 -2
  35. package/dist/bundle/{chunk-3QDPV34J.js → chunk-GSKFAE3I.js} +1297 -518
  36. package/dist/bundle/{chunk-BAIZAZ6Q.js → chunk-HLAZ65AW.js} +2 -2
  37. package/dist/bundle/{chunk-LI7TXFLS.js → chunk-JFSVXMN6.js} +3 -3
  38. package/dist/bundle/{chunk-6VEOR6GD.js → chunk-M5UH5CF3.js} +6 -8
  39. package/dist/bundle/{chunk-HXTTDIL7.js → chunk-MGG7JSNO.js} +3 -3
  40. package/dist/bundle/{chunk-6YLT4YVJ.js → chunk-OCWARAFE.js} +2 -2
  41. package/dist/bundle/{chunk-WE3LBRMB.js → chunk-OEJ5DMCX.js} +7 -7
  42. package/dist/bundle/{chunk-SGJYU3SB.js → chunk-OHBHHBYL.js} +3 -3
  43. package/dist/bundle/{chunk-2MXQ2EUN.js → chunk-PSH7K6TL.js} +617 -57
  44. package/dist/bundle/{chunk-H3X5LS6U.js → chunk-PYTOIDSM.js} +4 -4
  45. package/dist/bundle/{chunk-ATZ44Z77.js → chunk-Q2NYEX4A.js} +150 -52
  46. package/dist/bundle/{chunk-KE6L2UEG.js → chunk-QEPZUFPL.js} +70 -61
  47. package/dist/bundle/{chunk-CV5ASHTW.js → chunk-QL7CQ6VZ.js} +255 -80
  48. package/dist/bundle/{chunk-THVNP6S6.js → chunk-SRU3OF4R.js} +2 -2
  49. package/dist/bundle/{chunk-OOOV3JBZ.js → chunk-TV5DGHBT.js} +953 -677
  50. package/dist/bundle/{chunk-A7OBVRJV.js → chunk-TXBUDJ3P.js} +3 -3
  51. package/dist/bundle/{chunk-OW3COBN5.js → chunk-U4RRZUNP.js} +9 -9
  52. package/dist/bundle/{chunk-WKOY3POD.js → chunk-UK3GAN7Q.js} +7 -7
  53. package/dist/bundle/{chunk-BL36RR34.js → chunk-UR6ASUSG.js} +10 -7
  54. package/dist/bundle/{chunk-4VBDVZNE.js → chunk-V52SBQYF.js} +242 -19
  55. package/dist/bundle/{chunk-4YCLWWZ3.js → chunk-VUJ34PEQ.js} +11 -11
  56. package/dist/bundle/{chunk-2XUGPE5W.js → chunk-W5EB4JLV.js} +3 -3
  57. package/dist/bundle/{chunk-3KHKYYCR.js → chunk-WMOEOVWZ.js} +1 -0
  58. package/dist/bundle/{chunk-UMLPXNJI.js → chunk-WVEHUKCZ.js} +1 -1
  59. package/dist/bundle/{chunk-SYPL4PHV.js → chunk-XXTJUZMB.js} +1 -1
  60. package/dist/bundle/{chunk-SMJTL5U7.js → chunk-Y4XSWI22.js} +6 -4
  61. package/dist/bundle/{chunk-HKT5EOT5.js → chunk-YHB57PFN.js} +1 -1
  62. package/dist/bundle/{chunk-BZANDKWT.js → chunk-ZJVZXJOG.js} +2 -2
  63. package/dist/bundle/{chunk-QY3YOOTP.js → chunk-ZRNRQFTF.js} +2 -2
  64. package/dist/bundle/command-contract-A6VZN3ZR.js +31 -0
  65. package/dist/bundle/{echarts-YHSYUWLY.js → echarts-27W2CIBD.js} +2 -2
  66. package/dist/bundle/{embed-3HGI2XIW.js → embed-FGJ273X2.js} +4 -4
  67. package/dist/bundle/{embedder-2CJMZETJ.js → embedder-7ELL3CQ3.js} +7 -7
  68. package/dist/bundle/{entry-UVE53OV3.js → entry-SEE5YWIX.js} +5 -5
  69. package/dist/bundle/{first-run-6GYC2QS3.js → first-run-BD7FEC3W.js} +9 -9
  70. package/dist/bundle/first-screen-ASZV6LSA.js +29 -0
  71. package/dist/bundle/{identity-HEV5E57G.js → identity-QR4F42T6.js} +3 -3
  72. package/dist/bundle/{instructions-5UVAXSQV.js → instructions-L74K64PV.js} +1 -1
  73. package/dist/bundle/{mcp-NWXBVNUA.js → mcp-4Y37G2UY.js} +2 -2
  74. package/dist/bundle/{node-YHYEGYVE.js → node-RSL3HANO.js} +2 -2
  75. package/dist/bundle/{node-sqlite-CQ33A3R2.js → node-sqlite-7R3PYQGJ.js} +4 -4
  76. package/dist/bundle/{oauth-OB3JFAD7.js → oauth-4ESGXF6U.js} +7 -7
  77. package/dist/bundle/{open-JHGZIXU2.js → open-DFYEUGTA.js} +3 -3
  78. package/dist/bundle/{process-PSKS3N5B.js → process-RMV3AKLB.js} +1 -1
  79. package/dist/bundle/{program-RPYVPNRX.js → program-PIUYQHBF.js} +62 -67
  80. package/dist/bundle/{prompt-7BXUMJGG.js → prompt-H7GYQQLL.js} +4 -4
  81. package/dist/bundle/{proxy-transport-3EEMW2HW.js → proxy-transport-G4MA6BGU.js} +4 -4
  82. package/dist/bundle/{recognize-YMZPL47R.js → recognize-3GMOLZF4.js} +5 -5
  83. package/dist/bundle/{remote-LQ3Q22NG.js → remote-IRWTCI2B.js} +5 -5
  84. package/dist/bundle/{rerank-SM7IYVXJ.js → rerank-W3OSXXBN.js} +5 -5
  85. package/dist/bundle/{serve-GHUEP5H5.js → serve-ZCPO44NO.js} +24 -9
  86. package/dist/bundle/{server-A45HVXQY.js → server-FXU4QFRB.js} +42 -39
  87. package/dist/bundle/{server-K2BQPPHN.js → server-YWL4HDOP.js} +77 -68
  88. package/dist/bundle/{state-WIOL52GZ.js → state-MJPTDIB5.js} +9 -5
  89. package/dist/bundle/{store-XE5AKUJZ.js → store-6VNQG56O.js} +10 -10
  90. package/dist/bundle/store-maintenance-command-62TQTMER.js +43 -0
  91. package/dist/bundle/tg.js +4 -4
  92. package/dist/commands/context.d.ts.map +1 -1
  93. package/dist/commands/context.js +2 -0
  94. package/dist/commands/context.js.map +1 -1
  95. package/dist/program.js +1 -1
  96. package/dist/program.js.map +1 -1
  97. package/dist/telegram/errors.js +1 -1
  98. package/dist/telegram/errors.js.map +1 -1
  99. package/dist/telegram/sending.d.ts.map +1 -1
  100. package/dist/telegram/sending.js +52 -3
  101. package/dist/telegram/sending.js.map +1 -1
  102. package/dist/version.d.ts +1 -1
  103. package/dist/version.js +1 -1
  104. package/install/windows.ps1 +1 -1
  105. package/package.json +3 -3
  106. package/skills/tg-cli/SKILL.md +4 -4
  107. package/dist/bundle/chunk-3N6LXAPE.js +0 -724
  108. package/dist/bundle/chunk-DVOUKGFK.js +0 -1950
  109. package/dist/bundle/chunk-MUEXF4ME.js +0 -582
  110. package/dist/bundle/chunk-U7LXA4SO.js +0 -1007
  111. package/dist/bundle/chunk-V4JSVH4M.js +0 -190
  112. package/dist/bundle/chunk-YG7PNCSW.js +0 -230
  113. package/dist/bundle/chunk-Z2FHEIXN.js +0 -63
  114. package/dist/bundle/command-contract-AIVKJYIR.js +0 -31
  115. package/dist/bundle/first-screen-HRRLVLOG.js +0 -29
  116. package/dist/bundle/store-maintenance-command-YS5E7VUN.js +0 -46
  117. /package/dist/bundle/{chunk-3MVHRZWR.js → chunk-2SJOUK6J.js} +0 -0
@@ -1,190 +0,0 @@
1
- import { createRequire as __tgRequire } from "node:module";
2
- const require = __tgRequire(import.meta.url);
3
- import {
4
- stringWidth,
5
- wrapAnsi
6
- } from "./chunk-ZZLKX62Z.js";
7
- import {
8
- singleLine,
9
- visibleControls
10
- } from "./chunk-GYEOQS2D.js";
11
- import {
12
- __name
13
- } from "./chunk-AFV74GK3.js";
14
-
15
- // node_modules/.pnpm/@wirecat+cli-core@0.452.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.63.0_commander@15._e609b9d6c8060966368a91e843fe8bd2/node_modules/@wirecat/cli-core/dist/render/messages.js
16
- import { styleText } from "node:util";
17
- var TIME_WIDTH = 8;
18
- var INDENT = " ".repeat(TIME_WIDTH + 2);
19
- var MIN_WIDTH = 40;
20
- var SENDER_COLOURS = ["green", "yellow", "magenta", "blue", "red"];
21
- var renderMessages = /* @__PURE__ */ __name((messages, options = {}) => {
22
- if (messages.length === 0)
23
- return "(nothing)";
24
- const day = dayFormatter(options);
25
- const paint = painter(options);
26
- let previous;
27
- const blocks = [];
28
- for (const message of messages) {
29
- const date = day(message.timestamp);
30
- if (date !== previous)
31
- blocks.push(paint("dim", `\u2500\u2500 ${date} \u2500\u2500`));
32
- previous = date;
33
- blocks.push(renderMessage(message, options));
34
- }
35
- return blocks.join("\n\n");
36
- }, "renderMessages");
37
- var renderMessage = /* @__PURE__ */ __name((message, options = {}) => {
38
- const paint = painter(options);
39
- const width = Math.max(MIN_WIDTH, options.width ?? 80);
40
- const room = width - INDENT.length;
41
- const time = timeFormatter(options);
42
- const verbosity = options.verbosity ?? 0;
43
- const chat = "chatTitle" in message ? paint("dim", ` \xB7 ${singleLine(message.chatTitle ?? message.chatId)}`) : "";
44
- const mark = "anchor" in message && message.anchor ? paint("bold", " \u25C0") : "";
45
- const lines = [`${paint("dim", time(message.timestamp))} ${senderOf(message, options)}${chat}${mark}`];
46
- const body = /* @__PURE__ */ __name((text) => wrapAnsi(visibleControls(text), room, { hard: true }).split("\n"), "body");
47
- const email = message.email;
48
- if (email)
49
- lines.push(paint("dim", mailLine(email)));
50
- if (message.replyTo)
51
- lines.push(paint("dim", preview("\u21B3", message.replyTo, room, options)));
52
- if (message.forwardedFrom) {
53
- lines.push(paint("dim", `\u21AA ${nameOf(message.forwardedFrom, options)}`));
54
- if (message.forwardedFrom.text)
55
- for (const line of body(message.forwardedFrom.text))
56
- lines.push(line);
57
- lines.push(...attachmentLines(message.forwardedFrom.attachments, paint, options));
58
- }
59
- if (message.text)
60
- for (const line of body(message.text))
61
- lines.push(line);
62
- lines.push(...attachmentLines(message.attachments, paint, options));
63
- if (message.reactions && message.reactions.total > 0)
64
- lines.push(paint("dim", reactionLine(message.reactions)));
65
- if (message.editedAt)
66
- lines.push(paint("dim", `edited ${editedAt(message, options)}`));
67
- if (verbosity >= 1) {
68
- const fields = [
69
- ["message", message.id],
70
- ["sender", message.senderId],
71
- ["chat", message.chatId],
72
- ["reply to", message.replyTo?.id ?? message.replyToId],
73
- ["thread", message.threadId],
74
- ["forward of", message.forwardedFrom?.id],
75
- ...message.attachments.map((a) => ["link", a.url])
76
- ];
77
- if (verbosity >= 2) {
78
- fields.push(["provider", options.provider], ["profile", options.profile], ["sent", message.timestamp], ["edited", message.editedAt], ["outgoing", message.outgoing === null ? "unknown" : String(message.outgoing)], ...message.attachments.map((a) => ["attachment", JSON.stringify(a)]), ["metadata", message.providerMetadata && JSON.stringify(message.providerMetadata)]);
79
- }
80
- const shown = fields.filter((field) => typeof field[1] === "string");
81
- const label = Math.max(...shown.map(([key]) => key.length));
82
- lines.push("", ...shown.map(([key, value]) => paint("dim", `${key.padEnd(label)} ${singleLine(value)}`)));
83
- }
84
- return lines.map((line, index) => index === 0 || line === "" ? line : `${INDENT}${line}`).join("\n");
85
- }, "renderMessage");
86
- var mailLine = /* @__PURE__ */ __name(({ to, cc, labels }) => {
87
- const names = /* @__PURE__ */ __name((people) => people.map(({ name, address }) => singleLine(name ?? address)).join(", "), "names");
88
- return [to.length ? `to ${names(to)}` : "", cc.length ? `cc ${names(cc)}` : "", labels.join(", ")].filter(Boolean).join(" \xB7 ");
89
- }, "mailLine");
90
- var painter = /* @__PURE__ */ __name(({ color = false }) => (style, text) => color ? styleText(style, text, { validateStream: false }) : text, "painter");
91
- var senderOf = /* @__PURE__ */ __name((message, options) => {
92
- const paint = painter(options);
93
- if (message.outgoing === true)
94
- return paint(["bold", "cyan"], you(options));
95
- const name = nameOf(message, options);
96
- if (!options.senderColors)
97
- return paint("bold", name);
98
- const colour = SENDER_COLOURS[hash(message.senderId ?? name) % SENDER_COLOURS.length] ?? "green";
99
- return paint(["bold", colour], name);
100
- }, "senderOf");
101
- var nameOf = /* @__PURE__ */ __name(({ senderName, senderId, outgoing }, options) => outgoing === true ? you(options) : singleLine(senderName ?? senderId ?? "unknown"), "nameOf");
102
- var DEFAULT_LOCALE = "ru-RU";
103
- var you = /* @__PURE__ */ __name(({ locale = DEFAULT_LOCALE }) => locale.startsWith("ru") ? "\u0432\u044B" : "you", "you");
104
- var hash = /* @__PURE__ */ __name((value) => [...value].reduce((sum, char) => sum * 31 + char.charCodeAt(0) >>> 0, 7), "hash");
105
- var preview = /* @__PURE__ */ __name((mark, quoted, room, options) => {
106
- const text = singleLine(quoted.text.split("\n")[0] ?? "") || (quoted.attachments[0] ? `\u{1F4CE} ${quoted.attachments[0].kind}` : "");
107
- const line = text ? `${mark} ${nameOf(quoted, options)}: ${text}` : `${mark} message ${quoted.id}`;
108
- if (stringWidth(line) <= room)
109
- return line;
110
- return `${wrapAnsi(line, room - 1, { hard: true }).split("\n")[0]}\u2026`;
111
- }, "preview");
112
- var attachmentLines = /* @__PURE__ */ __name((attachments, paint, options) => {
113
- const link = /* @__PURE__ */ __name((label, raw) => {
114
- if (raw === void 0)
115
- return label;
116
- const url = singleLine(raw);
117
- return options.color ? `\x1B]8;;${url}\x07${label}\x1B]8;;\x07` : `${label} ${url}`;
118
- }, "link");
119
- let number = 0;
120
- const keyboard = attachments.flatMap((attachment) => attachment.buttons ?? []).map((row) => paint("dim", row.map((button) => link(`[${++number} ${singleLine(button.text)}]`, button.url)).join(" ")));
121
- const polls = attachments.flatMap((attachment) => attachment.poll ? pollLines(attachment.poll) : []);
122
- const groups = /* @__PURE__ */ new Map();
123
- for (const attachment of attachments) {
124
- if (attachment.buttons || attachment.poll)
125
- continue;
126
- const key = singleLine(attachment.name ?? attachment.title ?? attachment.kind);
127
- groups.set(key, [...groups.get(key) ?? [], attachment]);
128
- }
129
- const files = [...groups].map(([label, same]) => {
130
- const first = same[0];
131
- const size = first?.size === void 0 ? "" : ` \xB7 ${megabytes(first.size)}`;
132
- if (same.length === 1)
133
- return paint("dim", `\u{1F4CE} ${link(`${label}${size}`, first?.url)}`);
134
- const each = same.map((attachment, index) => link(String(index + 1), attachment.url)).join(" ");
135
- return paint("dim", `\u{1F4CE} ${label} \xD7${same.length} ${each}`);
136
- });
137
- return [...polls, ...files, ...keyboard];
138
- }, "attachmentLines");
139
- var pollLines = /* @__PURE__ */ __name((poll) => {
140
- const kind = [
141
- poll.closed ? "closed" : "",
142
- poll.multiple ? "several answers" : "",
143
- poll.anonymous ? "anonymous" : "",
144
- poll.quiz ? "quiz" : ""
145
- ].filter(Boolean);
146
- const count = /* @__PURE__ */ __name((voters) => voters === null ? "?" : String(voters), "count");
147
- return [
148
- `\u{1F4CA} ${visibleControls(poll.question)}`,
149
- ...poll.answers.map((answer) => ` [${answer.id}] ${visibleControls(answer.text)} \u2014 ${count(answer.voters)}${answer.chosen ? " \u2713" : ""}`),
150
- ` ${[`${count(poll.voters)} voted`, ...kind].join(" \xB7 ")}`
151
- ];
152
- }, "pollLines");
153
- var megabytes = /* @__PURE__ */ __name((bytes) => bytes >= 1e6 ? `${Math.round(bytes / 1e6)} MB` : `${Math.max(1, Math.round(bytes / 1e3))} KB`, "megabytes");
154
- var parts = /* @__PURE__ */ __name((format, iso) => Object.fromEntries(format.formatToParts(new Date(iso)).map(({ type, value }) => [type, value])), "parts");
155
- var timeFormatter = /* @__PURE__ */ __name(({ timeZone }) => {
156
- const format = new Intl.DateTimeFormat("en-GB", {
157
- hour: "2-digit",
158
- minute: "2-digit",
159
- second: "2-digit",
160
- hourCycle: "h23",
161
- ...timeZone ? { timeZone } : {}
162
- });
163
- return (iso) => {
164
- const { hour, minute, second } = parts(format, iso);
165
- return `${hour}:${minute}:${second}`;
166
- };
167
- }, "timeFormatter");
168
- var dayFormatter = /* @__PURE__ */ __name(({ locale = DEFAULT_LOCALE, timeZone }) => {
169
- const format = new Intl.DateTimeFormat(locale, {
170
- day: "numeric",
171
- month: "long",
172
- year: "numeric",
173
- ...timeZone ? { timeZone } : {}
174
- });
175
- return (iso) => format.format(new Date(iso)).replace(/\s*г\.$/, "");
176
- }, "dayFormatter");
177
- var reactionLine = /* @__PURE__ */ __name(({ counts, mine }) => {
178
- const shown = counts.map(({ reaction, count }) => `${singleLine(reaction)} ${count}`).join(" ");
179
- return mine ? `${shown} (you: ${singleLine(mine)})` : shown;
180
- }, "reactionLine");
181
- var editedAt = /* @__PURE__ */ __name((message, options) => {
182
- const edited = message.editedAt ?? message.timestamp;
183
- const time = timeFormatter(options)(edited);
184
- const day = dayFormatter(options);
185
- return day(edited) === day(message.timestamp) ? time : `${day(edited)} ${time}`;
186
- }, "editedAt");
187
-
188
- export {
189
- renderMessages
190
- };
@@ -1,230 +0,0 @@
1
- import { createRequire as __tgRequire } from "node:module";
2
- const require = __tgRequire(import.meta.url);
3
- import {
4
- QUERY_REASONS
5
- } from "./chunk-KE6L2UEG.js";
6
- import {
7
- defineReasons
8
- } from "./chunk-WE3LBRMB.js";
9
- import {
10
- __name
11
- } from "./chunk-AFV74GK3.js";
12
-
13
- // node_modules/.pnpm/@wirecat+cli-core@0.452.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.63.0_commander@15._e609b9d6c8060966368a91e843fe8bd2/node_modules/@wirecat/cli-core/dist/errors/reasons.js
14
- var validation = /* @__PURE__ */ __name((reason, message) => [reason, "validation_error", message], "validation");
15
- var QUERY = [
16
- ["query.aborted", "the search was stopped before it finished"],
17
- ["query.conflict", "two parts of the query contradict each other"],
18
- ["query.invalid-context", "the context size is out of range"],
19
- ["query.invalid-limit", "the limit is out of range"],
20
- ["query.invalid-scope", "the query selects no account"],
21
- ["query.invalid-duration", "a duration in the query cannot be read"],
22
- ["query.invalid-size", "a size in the query cannot be read"],
23
- ["query.invalid-reference", "a reference in the query is not valid"],
24
- ["query.invalid-tag", "a tag in the query is not valid"],
25
- ["query.invalid-topic", "a topic in the query is not valid"],
26
- ["query.topic-scope", "a topic needs its chat in the query"]
27
- ].map(([reason, message]) => validation(reason, message));
28
- var SIGN_IN = [
29
- ["oauth.declined", "authentication_error", "the provider's consent was declined"],
30
- ["oauth.timeout", "timeout", "the sign-in was not finished in time"],
31
- ["oauth.mismatch", "authentication_error", "the pasted sign-in result belongs to another sign-in"],
32
- ["oauth.missing", "authentication_error", "this profile is not signed in"],
33
- ["oauth.locked", "provider_unavailable", "another process holds this sign-in's lock"],
34
- ["oauth.no-response", "outcome_unknown", "the token request did not finish"],
35
- ["oauth.unavailable", "provider_unavailable", "the provider's token endpoint is unavailable"],
36
- ["oauth.expired", "authentication_error", "the provider refused the saved sign-in; sign in again"],
37
- ["oauth.invalid-response", "invalid_response", "the provider's token response could not be used"],
38
- ["oauth.failed", "authentication_error", "the provider returned no offline refresh token"],
39
- ["oauth.revoke-failed", "outcome_unknown", "the provider did not confirm the revoke"],
40
- ["oauth.invalid", "authentication_error", "the saved sign-in cannot be read"],
41
- ["oauth.not-saved", "configuration_error", "the sign-in cannot be saved or read where it is kept"]
42
- ];
43
- var OTHERS = [
44
- ["model.offline", "permission_error", "downloading a model needs the network; --offline was requested"],
45
- [
46
- "contract.unacknowledged-override",
47
- "configuration_error",
48
- "a shared command contract changed without an explicit override"
49
- ],
50
- validation("context.read-budget", "the selected context reads exceed their text or request allowance"),
51
- validation("meeting-findings.stale", "meeting findings changed since they were read; stage a new batch"),
52
- validation("meeting-findings.dedicated-review", "review meeting findings through the dedicated findings command"),
53
- validation("evidence-findings.stale", "evidence findings changed since they were read; stage a new batch"),
54
- validation("evidence-findings.dedicated-review", "review evidence findings through the dedicated findings command"),
55
- validation("document.changed", "the document changed while it was read; nothing was saved"),
56
- ["document.not-imported", "not_found", "the document is not imported in this source account"],
57
- ["extraction.invalid-proposals", "invalid_response", "the model's memory proposals could not be used"],
58
- validation("extraction.text-too-long", "the text is too long for memory extraction"),
59
- validation("file.locked", "another process holds the file's lock"),
60
- ["mirror.partial", "provider_error", "some mirrored files were not synced"],
61
- ["profile.wrong-account", "authentication_error", "the signed-in source account does not match this profile"],
62
- validation("push.too-many-files", "the folder holds more files than one push takes"),
63
- validation("push.unreadable", "the folder to push could not be read"),
64
- validation("spreadsheet.unreadable", "the workbook could not be read"),
65
- ["state.invalid", "configuration_error", "the saved sync state is unreadable or invalid; it is kept, not reset"],
66
- validation("store.refused", "the local store refused the document text"),
67
- ["store.not-writable", "permission_error", "the message store cannot be written from this process"],
68
- [
69
- "store.vector-extension-missing",
70
- "configuration_error",
71
- "the install has no sqlite-vec extension for this platform; reinstall the CLI"
72
- ],
73
- ["store.vector-extension-failed", "configuration_error", "the sqlite-vec extension did not load; reinstall the CLI"],
74
- validation("store.vector-invalid", "a vector to store had a non-finite value"),
75
- validation("catalog.scope-limit", "the selected catalog exceeds its entry limit"),
76
- validation("evidence.row-too-large", "one evidence row is over its size limit"),
77
- validation("index.not-ready", "the search index is still being built"),
78
- validation("input.closed", "the input closed before the answer"),
79
- validation("input.required", "the command needs an answer and cannot ask for one"),
80
- validation("input.too-large", "the input is over its size limit"),
81
- ["meeting-project.stale", "configuration_error", "the meeting's project changed meanwhile"],
82
- validation("memory.evidence-required", "a memory needs its evidence"),
83
- validation("memory.scope-required", "a memory needs its scope"),
84
- ["model.not-downloaded", "not_found", "the model is not downloaded on this machine"],
85
- validation("name.invalid", "the name is not valid"),
86
- validation("output.choose-fields", "at a terminal, --json names the fields it prints"),
87
- validation("output.one-object", "a report is one JSON object; --jsonl streams lists only"),
88
- validation("output.unknown-field", "the answer has no field by that name"),
89
- validation("name.taken", "the name is already used"),
90
- validation("period.ambiguous", "the period can be read more than one way"),
91
- validation("proposal.wrong-state", "the proposal is not in a state that allows this"),
92
- validation("ranking.invalid", "the ranking is not valid"),
93
- validation("selection.changed", "the stored selection changed meanwhile"),
94
- validation("selection.invalid", "the selection is not valid"),
95
- validation("search.kind", "the saved search belongs to another kind of search: messages or meetings"),
96
- ["selection.out-of-scope", "permission_error", "the selection reaches outside what this profile may read"],
97
- validation("stemmer.invalid", "the stemmer is not valid for that script"),
98
- validation("stemmer.newer", "the stems were built by a newer tool"),
99
- validation("stemmer.unknown", "the store asks for stemmers this tool does not know"),
100
- validation("tag-review.over-budget", "the tag review is over its budget"),
101
- validation("tag-review.required", "the tag needs the owner's review first"),
102
- ["tag-review.stale", "configuration_error", "the tag review changed meanwhile"],
103
- validation("tag.invalid", "the tag is not valid"),
104
- validation("task.category-unknown", "the category is not in the task category list"),
105
- validation("task.claimed", "someone else holds the task"),
106
- validation("task.closed", "the task is already closed"),
107
- validation("task.dependency-cycle", "the task would depend on itself"),
108
- validation("task.duplicate-candidates", "open tasks may be the same job: attach to one, or add it as new"),
109
- validation("task.certainty-required", "an agent closes a task with its certainty, 0 to 1"),
110
- ["task.pair-decided", "permission_error", "the owner already decided the pair; an agent does not change it"],
111
- validation("task.no-close-suggestion", "the task has no agent's close waiting on the owner"),
112
- validation("task.merged", "the task was merged into another; use that one"),
113
- validation("task.not-merged", "the task was not merged into another"),
114
- ["upgrade.install-failed", "provider_error", "the installer failed; the old version stays"],
115
- ["topic.owner-only", "permission_error", "only the owner may use this topic"],
116
- ["vocabulary.alias-conflict", "configuration_error", "two vocabulary entries claim one alias"],
117
- validation("vocabulary.consolidation-over-budget", "the selected tag dependencies exceed the preview budget"),
118
- validation("vocabulary.over-byte-budget", "the vocabulary is over its size budget"),
119
- validation("vocabulary.over-entry-budget", "the vocabulary has too many entries"),
120
- ["vocabulary.stale", "configuration_error", "the vocabulary changed meanwhile"]
121
- ];
122
- var INPUT_FIELD_REASONS = defineReasons([
123
- {
124
- reason: "input.field-conflict",
125
- code: "validation_error",
126
- message: "the input fields conflict",
127
- details: ["fields"]
128
- },
129
- {
130
- reason: "input.field-unsupported",
131
- code: "validation_error",
132
- message: "the input field is not supported",
133
- details: ["fields"]
134
- }
135
- ]);
136
- var REASONS = defineReasons([
137
- ...QUERY_REASONS,
138
- ...INPUT_FIELD_REASONS,
139
- ...[...QUERY, ...SIGN_IN, ...OTHERS].map(([reason, code, message]) => ({
140
- reason,
141
- code,
142
- message,
143
- details: reason === "vocabulary.consolidation-over-budget" ? ["table"] : []
144
- }))
145
- ]);
146
- var DETAILS = [
147
- "contracts",
148
- "allowed",
149
- "alternative",
150
- "arguments",
151
- "at",
152
- "available",
153
- "batch",
154
- "budget",
155
- "built",
156
- "candidates",
157
- "chat",
158
- "chat_id",
159
- "cli",
160
- "complete",
161
- "emitted_bytes",
162
- "exact",
163
- "forum",
164
- "guide",
165
- "hint",
166
- "id",
167
- "index",
168
- "kind",
169
- "limit",
170
- "limit_source",
171
- "max_bytes",
172
- "model",
173
- "name",
174
- "operation_id",
175
- "operation_ids",
176
- "text_limit",
177
- "store_refused_in",
178
- "partial_output",
179
- "path",
180
- "permission",
181
- "person_ids",
182
- "previous_chat_id",
183
- "profiles",
184
- "provider_error",
185
- "provider",
186
- "recovery",
187
- "reference",
188
- "remembered",
189
- "retry_at",
190
- "runtime",
191
- "saved",
192
- "scheduled_for",
193
- "script",
194
- "sent",
195
- "sent_count",
196
- "settlement_failed",
197
- "span",
198
- "sqlite",
199
- "stage",
200
- "standing",
201
- "state",
202
- "stderr",
203
- "term",
204
- "total",
205
- "upgraded",
206
- "wanted"
207
- ];
208
- var SHARED = { reasons: REASONS, details: DETAILS };
209
- var merged = /* @__PURE__ */ new WeakMap();
210
- var failureContext = /* @__PURE__ */ __name((errors) => {
211
- if (!errors)
212
- return SHARED;
213
- const known = merged.get(errors);
214
- if (known)
215
- return known;
216
- const unnamed = (errors.details ?? []).filter((key) => !/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/.test(key));
217
- if (unnamed.length > 0)
218
- throw new Error(`error details must be snake_case: ${unnamed.join(", ")}`);
219
- const context = {
220
- reasons: defineReasons([...REASONS, ...errors.reasons ?? []]),
221
- details: [.../* @__PURE__ */ new Set([...DETAILS, ...errors.details ?? []])]
222
- };
223
- merged.set(errors, context);
224
- return context;
225
- }, "failureContext");
226
-
227
- export {
228
- INPUT_FIELD_REASONS,
229
- failureContext
230
- };
@@ -1,63 +0,0 @@
1
- import { createRequire as __tgRequire } from "node:module";
2
- const require = __tgRequire(import.meta.url);
3
- import {
4
- holdLock,
5
- readLock,
6
- releaseLock,
7
- takeLock
8
- } from "./chunk-2XUGPE5W.js";
9
- import {
10
- __name
11
- } from "./chunk-AFV74GK3.js";
12
-
13
- // node_modules/.pnpm/@wirecat+cli-core@0.452.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.63.0_commander@15._e609b9d6c8060966368a91e843fe8bd2/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
14
- import { existsSync, readFileSync } from "node:fs";
15
- var ACCESS_SECONDS = 60 * 60;
16
- var REFRESH_SECONDS = 30 * 24 * 60 * 60;
17
- var readStored = /* @__PURE__ */ __name((path) => existsSync(path) ? JSON.parse(readFileSync(path, "utf8")) : { clients: [], tokens: [] }, "readStored");
18
- var mcpHttpMarker = /* @__PURE__ */ __name((envPrefix) => `${envPrefix}_MCP_HTTP`, "mcpHttpMarker");
19
- var httpLogFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.log`, "httpLogFile");
20
- var httpLockFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.lock`, "httpLockFile");
21
- var readHttpLock = /* @__PURE__ */ __name((path) => {
22
- const lock = readLock(path);
23
- return lock && typeof lock.port === "number" && typeof lock.publicUrl === "string" ? lock : void 0;
24
- }, "readHttpLock");
25
- var httpLock = /* @__PURE__ */ __name((path, first) => {
26
- let current = first;
27
- const held = takeLock(path, current);
28
- return {
29
- held,
30
- update: /* @__PURE__ */ __name((change) => {
31
- current = { ...current, ...change };
32
- holdLock(path, current);
33
- }, "update"),
34
- release: /* @__PURE__ */ __name(() => releaseLock(path), "release")
35
- };
36
- }, "httpLock");
37
- var signedInClients = /* @__PURE__ */ __name((tokenFile, now = Date.now()) => {
38
- const seconds = Math.floor(now / 1e3);
39
- const { clients, tokens } = readStored(tokenFile);
40
- const last = /* @__PURE__ */ new Map();
41
- for (const token of tokens) {
42
- if (token.expiresAt <= seconds)
43
- continue;
44
- const issued = token.expiresAt - (token.kind === "access" ? ACCESS_SECONDS : REFRESH_SECONDS);
45
- last.set(token.clientId, Math.max(last.get(token.clientId) ?? 0, issued));
46
- }
47
- return clients.filter((client) => last.has(client.id)).map((client) => ({
48
- claimedName: client.name ?? null,
49
- lastLoginAt: new Date((last.get(client.id) ?? 0) * 1e3).toISOString()
50
- })).sort((a, b) => b.lastLoginAt.localeCompare(a.lastLoginAt));
51
- }, "signedInClients");
52
-
53
- export {
54
- ACCESS_SECONDS,
55
- REFRESH_SECONDS,
56
- readStored,
57
- mcpHttpMarker,
58
- httpLogFile,
59
- httpLockFile,
60
- readHttpLock,
61
- httpLock,
62
- signedInClients
63
- };
@@ -1,31 +0,0 @@
1
- import { createRequire as __tgRequire } from "node:module";
2
- const require = __tgRequire(import.meta.url);
3
- import {
4
- SCHEMA_DIALECT,
5
- commandContract,
6
- commandPathOf,
7
- findCommand,
8
- outputOf
9
- } from "./chunk-6VEOR6GD.js";
10
- import "./chunk-RER6DAHP.js";
11
- import "./chunk-3QDPV34J.js";
12
- import "./chunk-U7LXA4SO.js";
13
- import "./chunk-SMJTL5U7.js";
14
- import "./chunk-SGJYU3SB.js";
15
- import "./chunk-ASDZHG5I.js";
16
- import "./chunk-UMLPXNJI.js";
17
- import "./chunk-KE6L2UEG.js";
18
- import "./chunk-UD4DOZCN.js";
19
- import "./chunk-3MVHRZWR.js";
20
- import "./chunk-QY3YOOTP.js";
21
- import "./chunk-GYEOQS2D.js";
22
- import "./chunk-WE3LBRMB.js";
23
- import "./chunk-BJG6JA5U.js";
24
- import "./chunk-AFV74GK3.js";
25
- export {
26
- SCHEMA_DIALECT,
27
- commandContract,
28
- commandPathOf,
29
- findCommand,
30
- outputOf
31
- };
@@ -1,29 +0,0 @@
1
- import { createRequire as __tgRequire } from "node:module";
2
- const require = __tgRequire(import.meta.url);
3
- import {
4
- WIRECAT_TOOLS,
5
- firstScreen,
6
- installHelp
7
- } from "./chunk-WKOY3POD.js";
8
- import "./chunk-ZZLKX62Z.js";
9
- import "./chunk-6VEOR6GD.js";
10
- import "./chunk-RER6DAHP.js";
11
- import "./chunk-3QDPV34J.js";
12
- import "./chunk-U7LXA4SO.js";
13
- import "./chunk-SMJTL5U7.js";
14
- import "./chunk-SGJYU3SB.js";
15
- import "./chunk-ASDZHG5I.js";
16
- import "./chunk-UMLPXNJI.js";
17
- import "./chunk-KE6L2UEG.js";
18
- import "./chunk-UD4DOZCN.js";
19
- import "./chunk-3MVHRZWR.js";
20
- import "./chunk-QY3YOOTP.js";
21
- import "./chunk-GYEOQS2D.js";
22
- import "./chunk-WE3LBRMB.js";
23
- import "./chunk-BJG6JA5U.js";
24
- import "./chunk-AFV74GK3.js";
25
- export {
26
- WIRECAT_TOOLS,
27
- firstScreen,
28
- installHelp
29
- };
@@ -1,46 +0,0 @@
1
- import { createRequire as __tgRequire } from "node:module";
2
- const require = __tgRequire(import.meta.url);
3
- import {
4
- buildStems,
5
- storeMaintenanceCommands,
6
- storeSummary
7
- } from "./chunk-CV5ASHTW.js";
8
- import "./chunk-V4JSVH4M.js";
9
- import "./chunk-2MXQ2EUN.js";
10
- import "./chunk-MUEXF4ME.js";
11
- import "./chunk-4U7QOFDA.js";
12
- import "./chunk-3N6LXAPE.js";
13
- import "./chunk-RDQMV6EU.js";
14
- import "./chunk-ZZLKX62Z.js";
15
- import "./chunk-3QDPV34J.js";
16
- import "./chunk-U7LXA4SO.js";
17
- import "./chunk-SMJTL5U7.js";
18
- import "./chunk-H3X5LS6U.js";
19
- import "./chunk-GTURDJJD.js";
20
- import "./chunk-SGJYU3SB.js";
21
- import "./chunk-ASDZHG5I.js";
22
- import "./chunk-2XUGPE5W.js";
23
- import "./chunk-UMLPXNJI.js";
24
- import "./chunk-THVNP6S6.js";
25
- import "./chunk-6YLT4YVJ.js";
26
- import "./chunk-LI7TXFLS.js";
27
- import "./chunk-OW3COBN5.js";
28
- import "./chunk-OOOV3JBZ.js";
29
- import "./chunk-KE6L2UEG.js";
30
- import "./chunk-JSKT5UZX.js";
31
- import "./chunk-UD4DOZCN.js";
32
- import "./chunk-3MVHRZWR.js";
33
- import "./chunk-QY3YOOTP.js";
34
- import "./chunk-3S5CL55R.js";
35
- import "./chunk-HKT5EOT5.js";
36
- import "./chunk-HXTTDIL7.js";
37
- import "./chunk-BAIZAZ6Q.js";
38
- import "./chunk-GYEOQS2D.js";
39
- import "./chunk-WE3LBRMB.js";
40
- import "./chunk-BJG6JA5U.js";
41
- import "./chunk-AFV74GK3.js";
42
- export {
43
- buildStems,
44
- storeMaintenanceCommands,
45
- storeSummary
46
- };