@wirecat/drive-cli 0.44.0 → 0.45.1
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/drive.js +35 -40
- package/dist/bundle/all-profiles-O7CNQ7FO.js +26 -0
- package/dist/bundle/anthropic-6T67J2CE.js +71 -0
- package/dist/bundle/app-server-BVBZT3UY.js +237 -0
- package/dist/bundle/bun-O6RL6LRQ.js +169 -0
- package/dist/bundle/bun-sqlite-54W7JUY3.js +70 -0
- package/dist/bundle/chunk-2DLAJGRN.js +62 -0
- package/dist/bundle/chunk-37MAA6F2.js +5624 -0
- package/dist/bundle/chunk-3HRDEJJW.js +161 -0
- package/dist/bundle/chunk-3Z7WSD2A.js +433 -0
- package/dist/bundle/chunk-44FV5JAS.js +1855 -0
- package/dist/bundle/chunk-4DW6QGEV.js +164 -0
- package/dist/bundle/chunk-4NGLRHWO.js +24 -0
- package/dist/bundle/chunk-5DPV7X27.js +663 -0
- package/dist/bundle/chunk-5FONRUG6.js +24805 -0
- package/dist/bundle/chunk-5MGIL5LW.js +846 -0
- package/dist/bundle/chunk-5TC3NCAF.js +42 -0
- package/dist/bundle/chunk-6Y2BYFXQ.js +65 -0
- package/dist/bundle/chunk-A3FU4RR6.js +150 -0
- package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
- package/dist/bundle/chunk-AIXLOMH4.js +63 -0
- package/dist/bundle/chunk-AOOD3RMK.js +384 -0
- package/dist/bundle/chunk-AUS6TKP5.js +1975 -0
- package/dist/bundle/chunk-B2J6FJNL.js +19 -0
- package/dist/bundle/chunk-BEXHAGXH.js +3542 -0
- package/dist/bundle/chunk-BHE7ZY2N.js +2352 -0
- package/dist/bundle/chunk-BJ3JRO34.js +2356 -0
- package/dist/bundle/chunk-BQUPOB5H.js +2315 -0
- package/dist/bundle/chunk-CFZWPIVC.js +1092 -0
- package/dist/bundle/chunk-CKR3DVUK.js +754 -0
- package/dist/bundle/chunk-CVIKKIGE.js +76 -0
- package/dist/bundle/chunk-D67JGWSC.js +190 -0
- package/dist/bundle/chunk-DDYR6DYL.js +78 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DL7D6Y3B.js +18102 -0
- package/dist/bundle/chunk-DORXXBFC.js +484 -0
- package/dist/bundle/chunk-DXKVEOSS.js +53 -0
- package/dist/bundle/chunk-DXQEJWI3.js +522 -0
- package/dist/bundle/chunk-FEULDMWM.js +35598 -0
- package/dist/bundle/chunk-G3FAOS52.js +630 -0
- package/dist/bundle/chunk-GHOWRW7E.js +237 -0
- package/dist/bundle/chunk-GNFHZZ55.js +264 -0
- package/dist/bundle/chunk-GNI7INK6.js +18 -0
- package/dist/bundle/chunk-GOR3Z2FR.js +17 -0
- package/dist/bundle/chunk-GQW4GRYR.js +886 -0
- package/dist/bundle/chunk-GWPKIRNQ.js +220 -0
- package/dist/bundle/chunk-GYCUY4CL.js +9 -0
- package/dist/bundle/chunk-HEPIOCHN.js +8181 -0
- package/dist/bundle/chunk-HTQTIKWP.js +928 -0
- package/dist/bundle/chunk-IAW5A7OR.js +1913 -0
- package/dist/bundle/chunk-IGMRWQP3.js +1071 -0
- package/dist/bundle/chunk-IKNU5A5Y.js +82 -0
- package/dist/bundle/chunk-JVTVAZ5X.js +1054 -0
- package/dist/bundle/chunk-K74PQVQZ.js +168 -0
- package/dist/bundle/chunk-K7FRUB33.js +795 -0
- package/dist/bundle/chunk-KADPV4YA.js +45 -0
- package/dist/bundle/chunk-KJMBV574.js +16225 -0
- package/dist/bundle/chunk-LHIL46I3.js +31 -0
- package/dist/bundle/chunk-LJARCTGL.js +60 -0
- package/dist/bundle/chunk-LOTQ2HMT.js +3954 -0
- package/dist/bundle/chunk-MAXN7COO.js +99 -0
- package/dist/bundle/chunk-MFS52LTZ.js +570 -0
- package/dist/bundle/chunk-MFSIOSUM.js +1714 -0
- package/dist/bundle/chunk-NB2N6L3R.js +138 -0
- package/dist/bundle/chunk-NDNTLUPS.js +58 -0
- package/dist/bundle/chunk-NLEB26GA.js +288 -0
- package/dist/bundle/chunk-NP3XLLN3.js +73 -0
- package/dist/bundle/chunk-NW7IMGRR.js +6848 -0
- package/dist/bundle/chunk-O5EHUB2V.js +2 -0
- package/dist/bundle/chunk-OWXTPXIQ.js +215 -0
- package/dist/bundle/chunk-PDBBBUY7.js +166 -0
- package/dist/bundle/chunk-PH74B2VZ.js +122 -0
- package/dist/bundle/chunk-PJ7IQVOM.js +421 -0
- package/dist/bundle/chunk-Q2Z3VCM4.js +2 -0
- package/dist/bundle/chunk-QTJUH3LS.js +15572 -0
- package/dist/bundle/chunk-QW36EOAM.js +106 -0
- package/dist/bundle/chunk-QWSRPXCJ.js +281 -0
- package/dist/bundle/chunk-R2A3K7ZF.js +193 -0
- package/dist/bundle/chunk-R2QRP7EJ.js +835 -0
- package/dist/bundle/chunk-RCS2SCX5.js +375 -0
- package/dist/bundle/chunk-RJ633GFA.js +25 -0
- package/dist/bundle/chunk-SBZB7HMU.js +1055 -0
- package/dist/bundle/chunk-SMHQA5J6.js +459 -0
- package/dist/bundle/chunk-SWMMR3FR.js +48 -0
- package/dist/bundle/chunk-TRMIV3OA.js +18 -0
- package/dist/bundle/chunk-VAGF723Z.js +74 -0
- package/dist/bundle/chunk-VCYFEWPD.js +18078 -0
- package/dist/bundle/chunk-VHQNVG3J.js +263 -0
- package/dist/bundle/chunk-VHT2WI4I.js +2941 -0
- package/dist/bundle/chunk-VYBOYBLX.js +100 -0
- package/dist/bundle/chunk-WUFCYDKB.js +71 -0
- package/dist/bundle/chunk-XAZQTJXR.js +3402 -0
- package/dist/bundle/chunk-XEBFFKXO.js +111 -0
- package/dist/bundle/chunk-XF5MFUEB.js +498 -0
- package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-ZBM4GEV2.js +120 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-MXCBV3GJ.js +38 -0
- package/dist/bundle/dist-MWTMOYWT.js +7577 -0
- package/dist/bundle/dist-PY3MVR3G.js +21 -0
- package/dist/bundle/drive.js +50 -0
- package/dist/bundle/echarts-LD3AI55P.js +42501 -0
- package/dist/bundle/embed-FJKIIM43.js +37 -0
- package/dist/bundle/embedder-NNQ5ZC25.js +110 -0
- package/dist/bundle/entry-ZYSNPDSD.js +15 -0
- package/dist/bundle/failure-MJJXFR63.js +37 -0
- package/dist/bundle/first-run-KA2UPZAU.js +24 -0
- package/dist/bundle/first-screen-VQ3RXDMF.js +36 -0
- package/dist/bundle/google-ZYDFTHLN.js +32 -0
- package/dist/bundle/google-api-2GT5PAW2.js +82 -0
- package/dist/bundle/identity-JQFQXQIR.js +10 -0
- package/dist/bundle/instructions-RZMSW3OC.js +11 -0
- package/dist/bundle/login-JU6NKW5P.js +158 -0
- package/dist/bundle/mcp-2PZDI7WE.js +501 -0
- package/dist/bundle/mcp-JOQMFGBC.js +95 -0
- package/dist/bundle/mcp-OQBZXELQ.js +165 -0
- package/dist/bundle/mdast-util-from-markdown-FXEPSNER.js +1958 -0
- package/dist/bundle/mdast-util-gfm-SZM5GBDF.js +2103 -0
- package/dist/bundle/micromark-extension-gfm-GRL24TU6.js +1838 -0
- package/dist/bundle/node-P4E63KXA.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-ZRLYQL7J.js +176 -0
- package/dist/bundle/node-sqlite-TXPSRROT.js +46 -0
- package/dist/bundle/oauth-NAIBKERJ.js +18 -0
- package/dist/bundle/open-3P5EPXPV.js +20 -0
- package/dist/bundle/process-LL77573L.js +91 -0
- package/dist/bundle/program-CZ55L6EW.js +24078 -0
- package/dist/bundle/prompt-3TX2SWOY.js +13 -0
- package/dist/bundle/reasons-GF2TYGX6.js +11 -0
- package/dist/bundle/recognize-IFXOJHEA.js +191 -0
- package/dist/bundle/remote-663M42Y5.js +28 -0
- package/dist/bundle/rerank-OT2F2DBV.js +51 -0
- package/dist/bundle/serve-PDNNI6O6.js +20 -0
- package/dist/bundle/server-BFOEPMR7.js +56 -0
- package/dist/bundle/server-K566PJ7H.js +69 -0
- package/dist/bundle/services-5MCTECBU.js +333 -0
- package/dist/bundle/sqlite-runtime-BF3KDM7W.js +17 -0
- package/dist/bundle/state-SZX65E74.js +34 -0
- package/dist/bundle/store-TCWNLA3V.js +125 -0
- package/dist/bundle/store-UKPGGAPW.js +142 -0
- package/dist/bundle/store-maintenance-command-QHLUVBTJ.js +57 -0
- package/dist/bundle/terminal-TFCTWLOS.js +11 -0
- package/dist/bundle/tokens-DFCFRF7I.js +103 -0
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +82 -36
- package/dist/commands/mcp.js.map +1 -1
- package/dist/contract-overrides.d.ts.map +1 -1
- package/dist/contract-overrides.js +59 -53
- package/dist/contract-overrides.js.map +1 -1
- package/dist/mcp.d.ts +6 -5
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +13 -10
- package/dist/mcp.js.map +1 -1
- package/dist/program.js +4 -4
- package/dist/program.js.map +1 -1
- package/dist/registry.d.ts +2 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +3 -3
- package/dist/registry.js.map +1 -1
- package/dist/state.d.ts +13 -2
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +12 -2
- package/dist/state.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -5
- package/skills/drive-cli/SKILL.md +1 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
__name
|
|
5
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
6
|
+
|
|
7
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/mcp/stdio-wire.js
|
|
8
|
+
import { PassThrough, Writable } from "node:stream";
|
|
9
|
+
var lineReader = /* @__PURE__ */ __name((onMessage) => {
|
|
10
|
+
let rest = "";
|
|
11
|
+
return (chunk) => {
|
|
12
|
+
const lines = (rest + chunk.toString()).split("\n");
|
|
13
|
+
rest = lines.pop() ?? "";
|
|
14
|
+
for (const line of lines) {
|
|
15
|
+
try {
|
|
16
|
+
const message = JSON.parse(line);
|
|
17
|
+
if (message !== null && typeof message === "object")
|
|
18
|
+
onMessage(message);
|
|
19
|
+
} catch {
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}, "lineReader");
|
|
24
|
+
var answeredWire = /* @__PURE__ */ __name((source, sink) => {
|
|
25
|
+
const asked = /* @__PURE__ */ new Set();
|
|
26
|
+
let settle;
|
|
27
|
+
const input = new PassThrough();
|
|
28
|
+
const onData = lineReader(({ id, method }) => {
|
|
29
|
+
if (id !== void 0 && typeof method === "string")
|
|
30
|
+
asked.add(JSON.stringify(id));
|
|
31
|
+
});
|
|
32
|
+
const output = new Writable({
|
|
33
|
+
write: /* @__PURE__ */ __name((chunk, _encoding, done) => {
|
|
34
|
+
noteAnswer(chunk);
|
|
35
|
+
sink.write(chunk, done);
|
|
36
|
+
}, "write")
|
|
37
|
+
});
|
|
38
|
+
const noteAnswer = lineReader(({ id, method }) => {
|
|
39
|
+
if (id === void 0 || method !== void 0)
|
|
40
|
+
return;
|
|
41
|
+
asked.delete(JSON.stringify(id));
|
|
42
|
+
if (asked.size === 0)
|
|
43
|
+
settle?.();
|
|
44
|
+
});
|
|
45
|
+
const forward = /* @__PURE__ */ __name((chunk) => {
|
|
46
|
+
onData(chunk);
|
|
47
|
+
input.write(chunk);
|
|
48
|
+
}, "forward");
|
|
49
|
+
source.on("data", forward);
|
|
50
|
+
const ended = new Promise((resolve) => {
|
|
51
|
+
source.once("end", resolve);
|
|
52
|
+
source.once("close", resolve);
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
input,
|
|
56
|
+
output,
|
|
57
|
+
ended,
|
|
58
|
+
answered: /* @__PURE__ */ __name(() => new Promise((resolve) => {
|
|
59
|
+
if (asked.size === 0)
|
|
60
|
+
resolve();
|
|
61
|
+
else
|
|
62
|
+
settle = resolve;
|
|
63
|
+
}), "answered"),
|
|
64
|
+
/** Lets go of the real stdin, so it no longer holds the process open. */
|
|
65
|
+
release: /* @__PURE__ */ __name(() => {
|
|
66
|
+
source.off("data", forward);
|
|
67
|
+
if (source.listenerCount("data") === 0)
|
|
68
|
+
source.pause();
|
|
69
|
+
input.end();
|
|
70
|
+
}, "release")
|
|
71
|
+
};
|
|
72
|
+
}, "answeredWire");
|
|
73
|
+
|
|
74
|
+
export {
|
|
75
|
+
answeredWire
|
|
76
|
+
};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
stringWidth,
|
|
5
|
+
wrapAnsi
|
|
6
|
+
} from "./chunk-HTQTIKWP.js";
|
|
7
|
+
import {
|
|
8
|
+
singleLine,
|
|
9
|
+
visibleControls
|
|
10
|
+
} from "./chunk-VHT2WI4I.js";
|
|
11
|
+
import {
|
|
12
|
+
__name
|
|
13
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
14
|
+
|
|
15
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/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
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
__name
|
|
5
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
6
|
+
|
|
7
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/http/listen.js
|
|
8
|
+
import { createServer } from "node:http";
|
|
9
|
+
import { Readable } from "node:stream";
|
|
10
|
+
var MAX_BODY = 4 * 1024 * 1024;
|
|
11
|
+
var TooLarge = class extends Error {
|
|
12
|
+
static {
|
|
13
|
+
__name(this, "TooLarge");
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var readBody = /* @__PURE__ */ __name((incoming, limit) => new Promise((resolve, reject) => {
|
|
17
|
+
if (Number(incoming.headers["content-length"] ?? 0) > limit)
|
|
18
|
+
return reject(new TooLarge());
|
|
19
|
+
const chunks = [];
|
|
20
|
+
let size = 0;
|
|
21
|
+
incoming.on("data", (chunk) => {
|
|
22
|
+
size += chunk.length;
|
|
23
|
+
if (size > limit) {
|
|
24
|
+
incoming.destroy();
|
|
25
|
+
reject(new TooLarge());
|
|
26
|
+
} else
|
|
27
|
+
chunks.push(chunk);
|
|
28
|
+
});
|
|
29
|
+
incoming.once("end", () => resolve(Buffer.concat(chunks)));
|
|
30
|
+
incoming.once("error", reject);
|
|
31
|
+
}), "readBody");
|
|
32
|
+
var toRequest = /* @__PURE__ */ __name(async (incoming, origin, maxBody) => {
|
|
33
|
+
const headers = new Headers();
|
|
34
|
+
for (const [name, value] of Object.entries(incoming.headers)) {
|
|
35
|
+
if (Array.isArray(value))
|
|
36
|
+
for (const one of value)
|
|
37
|
+
headers.append(name, one);
|
|
38
|
+
else if (value !== void 0)
|
|
39
|
+
headers.set(name, value);
|
|
40
|
+
}
|
|
41
|
+
const method = incoming.method ?? "GET";
|
|
42
|
+
const body = method === "GET" || method === "HEAD" ? void 0 : await readBody(incoming, maxBody);
|
|
43
|
+
if (body)
|
|
44
|
+
headers.set("content-length", String(body.length));
|
|
45
|
+
return new Request(new URL(incoming.url ?? "/", origin), { method, headers, ...body ? { body } : {} });
|
|
46
|
+
}, "toRequest");
|
|
47
|
+
var send = /* @__PURE__ */ __name(async (response, outgoing) => {
|
|
48
|
+
outgoing.writeHead(response.status, Object.fromEntries(response.headers));
|
|
49
|
+
if (!response.body)
|
|
50
|
+
return void outgoing.end();
|
|
51
|
+
const body = Readable.fromWeb(response.body);
|
|
52
|
+
outgoing.once("close", () => body.destroy());
|
|
53
|
+
body.pipe(outgoing);
|
|
54
|
+
}, "send");
|
|
55
|
+
var listen = /* @__PURE__ */ __name((handle, { host, port, maxBody = MAX_BODY }) => new Promise((resolve, reject) => {
|
|
56
|
+
const server = createServer((incoming, outgoing) => {
|
|
57
|
+
toRequest(incoming, `http://${host}`, maxBody).then(handle).then((response) => send(response, outgoing)).catch((error) => {
|
|
58
|
+
if (!outgoing.headersSent)
|
|
59
|
+
outgoing.writeHead(error instanceof TooLarge ? 413 : 500, { connection: "close" });
|
|
60
|
+
outgoing.end();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
server.once("error", reject);
|
|
64
|
+
server.listen(port, host, () => {
|
|
65
|
+
const { port: bound } = server.address();
|
|
66
|
+
resolve({
|
|
67
|
+
url: new URL(`http://${host}:${bound}`),
|
|
68
|
+
close: /* @__PURE__ */ __name(() => new Promise((done) => {
|
|
69
|
+
server.close(() => done());
|
|
70
|
+
server.closeAllConnections();
|
|
71
|
+
}), "close")
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}), "listen");
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
listen
|
|
78
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// node_modules/.pnpm/@anthropic-ai+sdk@1.3.0_zod@4.6.7/node_modules/@anthropic-ai/sdk/internal/node.mjs
|
|
5
|
+
import * as child_process from "node:child_process";
|
|
6
|
+
import * as crypto from "node:crypto";
|
|
7
|
+
import * as fs from "node:fs";
|
|
8
|
+
import * as os from "node:os";
|
|
9
|
+
import * as path from "node:path";
|
|
10
|
+
import * as stream from "node:stream";
|
|
11
|
+
import * as util from "node:util";
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
child_process,
|
|
15
|
+
crypto,
|
|
16
|
+
fs,
|
|
17
|
+
os,
|
|
18
|
+
path,
|
|
19
|
+
stream,
|
|
20
|
+
util
|
|
21
|
+
};
|