@wirecat/mail-cli 0.0.0-stage → 0.1.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/CHANGELOG.md +60 -0
- package/LICENSE +204 -0
- package/README.md +166 -2
- package/dist/bin/mail.d.ts +3 -0
- package/dist/bin/mail.d.ts.map +1 -0
- package/dist/bin/mail.js +36 -0
- package/dist/bin/mail.js.map +1 -0
- package/dist/bundle/all-profiles-TKMBELRZ.js +286 -0
- package/dist/bundle/anthropic-7LMUAEIZ.js +72 -0
- package/dist/bundle/app-server-JGMIJDD4.js +229 -0
- package/dist/bundle/bun-XRO6XJHQ.js +169 -0
- package/dist/bundle/bun-sqlite-Z54LEHVM.js +71 -0
- package/dist/bundle/chunk-2LLNPNMB.js +24 -0
- package/dist/bundle/chunk-3E3WA2L6.js +1932 -0
- package/dist/bundle/chunk-3KEVLSNN.js +138 -0
- package/dist/bundle/chunk-3KOA73LS.js +3416 -0
- package/dist/bundle/chunk-4E7BN3TC.js +122 -0
- package/dist/bundle/chunk-4FEMINO2.js +409 -0
- package/dist/bundle/chunk-52F5DWS5.js +27 -0
- package/dist/bundle/chunk-5BVIWP3S.js +71 -0
- package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
- package/dist/bundle/chunk-5NYMNSSO.js +264 -0
- package/dist/bundle/chunk-6MAZWSC3.js +132 -0
- package/dist/bundle/chunk-75CWWETH.js +379 -0
- package/dist/bundle/chunk-7SXGLT6T.js +444 -0
- package/dist/bundle/chunk-BTQX2ZSZ.js +288 -0
- package/dist/bundle/chunk-CEW6KIFA.js +1193 -0
- package/dist/bundle/chunk-CH6RXYAX.js +82 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-EOEDICIE.js +6848 -0
- package/dist/bundle/chunk-F6D6PJ34.js +100 -0
- package/dist/bundle/chunk-FDCGTODC.js +78 -0
- package/dist/bundle/chunk-FZ5FXIG6.js +18 -0
- package/dist/bundle/chunk-GAH7N7HO.js +8181 -0
- package/dist/bundle/chunk-GK4M2SUP.js +195 -0
- package/dist/bundle/chunk-GN62YOT5.js +161 -0
- package/dist/bundle/chunk-GQQJOH7A.js +7050 -0
- package/dist/bundle/chunk-GWDCKUBI.js +781 -0
- package/dist/bundle/chunk-HTQTIKWP.js +928 -0
- package/dist/bundle/chunk-IK5TH3O7.js +217 -0
- package/dist/bundle/chunk-J3QXTBD2.js +2742 -0
- package/dist/bundle/chunk-J6MSJLIW.js +45 -0
- package/dist/bundle/chunk-JBBZCTTF.js +76 -0
- package/dist/bundle/chunk-JVMVLITS.js +260 -0
- package/dist/bundle/chunk-K4FVKPDQ.js +525 -0
- package/dist/bundle/chunk-KHTO2Q6E.js +886 -0
- package/dist/bundle/chunk-KM7Q67Z3.js +63 -0
- package/dist/bundle/chunk-LQ37ALDJ.js +2416 -0
- package/dist/bundle/chunk-MNOIRJEO.js +2315 -0
- package/dist/bundle/chunk-MS53RALV.js +168 -0
- package/dist/bundle/chunk-NK7EB63L.js +36225 -0
- package/dist/bundle/chunk-NPGVOZVK.js +2 -0
- package/dist/bundle/chunk-OTUOZ33L.js +82 -0
- package/dist/bundle/chunk-P7P5MNAU.js +46 -0
- package/dist/bundle/chunk-QLEUNU6G.js +537 -0
- package/dist/bundle/chunk-QQB7WT7R.js +216 -0
- package/dist/bundle/chunk-QX7RCLRS.js +23 -0
- package/dist/bundle/chunk-T6464KYA.js +35130 -0
- package/dist/bundle/chunk-TE5U5OAM.js +73 -0
- package/dist/bundle/chunk-TI6VBZKJ.js +166 -0
- package/dist/bundle/chunk-TQFCPUIM.js +53 -0
- package/dist/bundle/chunk-TVREDYX4.js +3574 -0
- package/dist/bundle/chunk-TWPDVUBR.js +106 -0
- package/dist/bundle/chunk-TWTATDM7.js +461 -0
- package/dist/bundle/chunk-UH4DDRHA.js +2989 -0
- package/dist/bundle/chunk-VEIZZRQ5.js +630 -0
- package/dist/bundle/chunk-WLFLBWNH.js +54 -0
- package/dist/bundle/chunk-WXAXYJJ7.js +486 -0
- package/dist/bundle/chunk-XQUUANA2.js +24600 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YO4CUH5E.js +33 -0
- package/dist/bundle/chunk-YPQQ5J4X.js +849 -0
- package/dist/bundle/chunk-Z34ICZA3.js +1028 -0
- package/dist/bundle/chunk-ZANYM66S.js +58 -0
- package/dist/bundle/chunk-ZD3WUGR2.js +142 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-WU434ZUL.js +34 -0
- package/dist/bundle/decode-YB3ZDTES.js +162 -0
- package/dist/bundle/dispatch-EUKKT3PD.js +411 -0
- package/dist/bundle/dist-A6GKSKFC.js +2072 -0
- package/dist/bundle/dist-HFUVURJG.js +7577 -0
- package/dist/bundle/echarts-YNGCOYHW.js +42501 -0
- package/dist/bundle/embed-LWNHIRBQ.js +37 -0
- package/dist/bundle/embedder-2LYD3U37.js +110 -0
- package/dist/bundle/failure-OAIC5VAP.js +24 -0
- package/dist/bundle/first-run-N3HJKGU7.js +27 -0
- package/dist/bundle/first-screen-4U2DMV3G.js +32 -0
- package/dist/bundle/instructions-GJHHFV64.js +11 -0
- package/dist/bundle/mail.js +166 -0
- package/dist/bundle/mcp-L7SRVDRN.js +167 -0
- package/dist/bundle/node-GFOH6FKP.js +176 -0
- package/dist/bundle/node-KM3CUABH.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-NBXQXBIU.js +63 -0
- package/dist/bundle/oauth-56EFO5AQ.js +19 -0
- package/dist/bundle/open-2V7QZQJP.js +21 -0
- package/dist/bundle/openai-V3SVACVL.js +251 -0
- package/dist/bundle/process-XVDX4SPD.js +91 -0
- package/dist/bundle/program-JTJB26P3.js +35542 -0
- package/dist/bundle/prompt-YKWAI222.js +14 -0
- package/dist/bundle/recognize-PAR66KVM.js +25 -0
- package/dist/bundle/remote-CE43TKXC.js +28 -0
- package/dist/bundle/rerank-M7S7P2TW.js +51 -0
- package/dist/bundle/serve-ENPMIV6J.js +197 -0
- package/dist/bundle/server-JRTHUCVY.js +63 -0
- package/dist/bundle/server-MBEZLVKZ.js +189 -0
- package/dist/bundle/sqlite-runtime-HVGDHBJJ.js +18 -0
- package/dist/bundle/state-QZSOSKBD.js +35 -0
- package/dist/bundle/store-2BUX6LVX.js +124 -0
- package/dist/bundle/store-UJ7SNKXI.js +141 -0
- package/dist/bundle/store-maintenance-command-I7V5C44K.js +52 -0
- package/dist/commands/account.d.ts +3 -0
- package/dist/commands/account.d.ts.map +1 -0
- package/dist/commands/account.js +47 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/context.d.ts +41 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +52 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/folders.d.ts +3 -0
- package/dist/commands/folders.d.ts.map +1 -0
- package/dist/commands/folders.js +36 -0
- package/dist/commands/folders.js.map +1 -0
- package/dist/commands/login.d.ts +5 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +21 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/mailbox.d.ts +16 -0
- package/dist/commands/mailbox.d.ts.map +1 -0
- package/dist/commands/mailbox.js +54 -0
- package/dist/commands/mailbox.js.map +1 -0
- package/dist/commands/session.d.ts +3 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +211 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +89 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/sync.d.ts +3 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +190 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/config.d.ts +190 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +46 -0
- package/dist/config.js.map +1 -0
- package/dist/discovery.d.ts +42 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +179 -0
- package/dist/discovery.js.map +1 -0
- package/dist/identity.d.ts +5 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +16 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/mail/imap-errors.d.ts +4 -0
- package/dist/mail/imap-errors.d.ts.map +1 -0
- package/dist/mail/imap-errors.js +41 -0
- package/dist/mail/imap-errors.js.map +1 -0
- package/dist/mail/imap-messages.d.ts +18 -0
- package/dist/mail/imap-messages.d.ts.map +1 -0
- package/dist/mail/imap-messages.js +66 -0
- package/dist/mail/imap-messages.js.map +1 -0
- package/dist/mail/imap.d.ts +67 -0
- package/dist/mail/imap.d.ts.map +1 -0
- package/dist/mail/imap.js +348 -0
- package/dist/mail/imap.js.map +1 -0
- package/dist/profile.d.ts +16 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +31 -0
- package/dist/profile.js.map +1 -0
- package/dist/program.d.ts +6 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +52 -0
- package/dist/program.js.map +1 -0
- package/dist/providers.d.ts +53 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +106 -0
- package/dist/providers.js.map +1 -0
- package/dist/secret.d.ts +30 -0
- package/dist/secret.d.ts.map +1 -0
- package/dist/secret.js +68 -0
- package/dist/secret.js.map +1 -0
- package/dist/store.d.ts +12 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +25 -0
- package/dist/store.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +83 -4
- package/skills/mail-cli/SKILL.md +27 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
WARM_IDLE_MS,
|
|
5
|
+
defaultThreads,
|
|
6
|
+
isTextModelInstalled,
|
|
7
|
+
loadModel,
|
|
8
|
+
meanOf,
|
|
9
|
+
openEmbedder,
|
|
10
|
+
placedText,
|
|
11
|
+
runEmbedders,
|
|
12
|
+
textModelsDirectory,
|
|
13
|
+
truncated,
|
|
14
|
+
unit,
|
|
15
|
+
warmEmbedders
|
|
16
|
+
} from "./chunk-Z34ICZA3.js";
|
|
17
|
+
import "./chunk-5NYMNSSO.js";
|
|
18
|
+
import "./chunk-FZ5FXIG6.js";
|
|
19
|
+
import "./chunk-J3QXTBD2.js";
|
|
20
|
+
import "./chunk-LQ37ALDJ.js";
|
|
21
|
+
import "./chunk-Y5E2WNWB.js";
|
|
22
|
+
import "./chunk-5BVIWP3S.js";
|
|
23
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
24
|
+
export {
|
|
25
|
+
WARM_IDLE_MS,
|
|
26
|
+
defaultThreads,
|
|
27
|
+
isTextModelInstalled,
|
|
28
|
+
loadModel,
|
|
29
|
+
meanOf,
|
|
30
|
+
openEmbedder,
|
|
31
|
+
placedText,
|
|
32
|
+
runEmbedders,
|
|
33
|
+
textModelsDirectory,
|
|
34
|
+
truncated,
|
|
35
|
+
unit,
|
|
36
|
+
warmEmbedders
|
|
37
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
openSession,
|
|
5
|
+
truncated,
|
|
6
|
+
unit
|
|
7
|
+
} from "./chunk-Z34ICZA3.js";
|
|
8
|
+
import "./chunk-5NYMNSSO.js";
|
|
9
|
+
import "./chunk-FZ5FXIG6.js";
|
|
10
|
+
import "./chunk-J3QXTBD2.js";
|
|
11
|
+
import "./chunk-LQ37ALDJ.js";
|
|
12
|
+
import {
|
|
13
|
+
importFrom
|
|
14
|
+
} from "./chunk-Y5E2WNWB.js";
|
|
15
|
+
import {
|
|
16
|
+
CliError
|
|
17
|
+
} from "./chunk-5BVIWP3S.js";
|
|
18
|
+
import {
|
|
19
|
+
__name
|
|
20
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
21
|
+
|
|
22
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/images/picture/embedder.js
|
|
23
|
+
import { readFileSync } from "node:fs";
|
|
24
|
+
import { join } from "node:path";
|
|
25
|
+
|
|
26
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/images/picture/preprocess.js
|
|
27
|
+
var SIZE = 224;
|
|
28
|
+
var MEAN = [0.48145466, 0.4578275, 0.40821073];
|
|
29
|
+
var STD = [0.26862954, 0.26130258, 0.27577711];
|
|
30
|
+
var importCanvas = /* @__PURE__ */ __name(async () => {
|
|
31
|
+
try {
|
|
32
|
+
return await importFrom(new URL("images/picture/preprocess.js", import.meta.resolve("@wirecat/cli-core")).href, "@napi-rs/canvas");
|
|
33
|
+
} catch {
|
|
34
|
+
throw new CliError("validation_error", "searching pictures needs the optional package @napi-rs/canvas to read an image \u2014 install it next to this tool");
|
|
35
|
+
}
|
|
36
|
+
}, "importCanvas");
|
|
37
|
+
var preprocess = /* @__PURE__ */ __name(async (bytes, load = importCanvas) => {
|
|
38
|
+
const { createCanvas, loadImage } = await load();
|
|
39
|
+
let image;
|
|
40
|
+
try {
|
|
41
|
+
image = await loadImage(bytes);
|
|
42
|
+
} catch {
|
|
43
|
+
throw new CliError("invalid_response", "the file is not an image this tool can read");
|
|
44
|
+
}
|
|
45
|
+
const scale = SIZE / Math.min(image.width, image.height);
|
|
46
|
+
const width = Math.max(SIZE, Math.round(image.width * scale));
|
|
47
|
+
const height = Math.max(SIZE, Math.round(image.height * scale));
|
|
48
|
+
const surface = createCanvas(SIZE, SIZE);
|
|
49
|
+
const context = surface.getContext("2d");
|
|
50
|
+
context.fillStyle = "#ffffff";
|
|
51
|
+
context.fillRect(0, 0, SIZE, SIZE);
|
|
52
|
+
context.imageSmoothingQuality = "high";
|
|
53
|
+
context.drawImage(image, 0, 0, image.width, image.height, Math.round((SIZE - width) / 2), Math.round((SIZE - height) / 2), width, height);
|
|
54
|
+
const { data } = context.getImageData(0, 0, SIZE, SIZE);
|
|
55
|
+
const plane = SIZE * SIZE;
|
|
56
|
+
const pixels = new Float32Array(3 * plane);
|
|
57
|
+
for (let at = 0; at < plane; at++) {
|
|
58
|
+
for (let channel = 0; channel < 3; channel++) {
|
|
59
|
+
pixels[channel * plane + at] = (data[at * 4 + channel] / 255 - MEAN[channel]) / STD[channel];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return pixels;
|
|
63
|
+
}, "preprocess");
|
|
64
|
+
|
|
65
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/images/picture/embedder.js
|
|
66
|
+
var openPictureEmbedder = /* @__PURE__ */ __name(async (model, directory, { threads = 4, canvas } = {}) => {
|
|
67
|
+
const { Tokenizer } = await importFrom(new URL("images/picture/embedder.js", import.meta.resolve("@wirecat/cli-core")).href, "@huggingface/tokenizers");
|
|
68
|
+
const path = /* @__PURE__ */ __name((name) => join(directory, model.id, name), "path");
|
|
69
|
+
const tokenizer = new Tokenizer(JSON.parse(readFileSync(path("tokenizer.json"), "utf8")), JSON.parse(readFileSync(path("tokenizer_config.json"), "utf8")));
|
|
70
|
+
const sessions = [];
|
|
71
|
+
const lazy = /* @__PURE__ */ __name((name) => {
|
|
72
|
+
let opened;
|
|
73
|
+
return () => {
|
|
74
|
+
opened ??= openSession(readFileSync(path(name)), threads).then((created) => {
|
|
75
|
+
sessions.push(created.session);
|
|
76
|
+
return created;
|
|
77
|
+
});
|
|
78
|
+
return opened;
|
|
79
|
+
};
|
|
80
|
+
}, "lazy");
|
|
81
|
+
const vision = lazy(model.vision);
|
|
82
|
+
const text = lazy(model.text);
|
|
83
|
+
return {
|
|
84
|
+
model,
|
|
85
|
+
embedImage: /* @__PURE__ */ __name(async (bytes) => {
|
|
86
|
+
const pixels = await preprocess(bytes, canvas);
|
|
87
|
+
const { ort, session } = await vision();
|
|
88
|
+
const output = await session.run({ pixel_values: new ort.Tensor("float32", pixels, [1, 3, SIZE, SIZE]) });
|
|
89
|
+
return unit(Float32Array.from(output.image_embeds?.data));
|
|
90
|
+
}, "embedImage"),
|
|
91
|
+
embedQuery: /* @__PURE__ */ __name(async (query) => {
|
|
92
|
+
const ids = truncated(tokenizer.encode(query.toLowerCase()).ids, model.maxTokens);
|
|
93
|
+
const shape = [1, ids.length];
|
|
94
|
+
const { ort, session } = await text();
|
|
95
|
+
const feeds = {
|
|
96
|
+
input_ids: new ort.Tensor("int64", BigInt64Array.from(ids, BigInt), shape)
|
|
97
|
+
};
|
|
98
|
+
if (session.inputNames.includes("attention_mask"))
|
|
99
|
+
feeds.attention_mask = new ort.Tensor("int64", new BigInt64Array(ids.length).fill(1n), shape);
|
|
100
|
+
const output = await session.run(feeds);
|
|
101
|
+
return unit(Float32Array.from(output.text_embeds?.data));
|
|
102
|
+
}, "embedQuery"),
|
|
103
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
104
|
+
await Promise.all(sessions.map((session) => session.release()));
|
|
105
|
+
}, "close")
|
|
106
|
+
};
|
|
107
|
+
}, "openPictureEmbedder");
|
|
108
|
+
export {
|
|
109
|
+
openPictureEmbedder
|
|
110
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
catchCrashes,
|
|
5
|
+
errorObjectOf,
|
|
6
|
+
errorRecordOf,
|
|
7
|
+
exitCodeOfAnswer,
|
|
8
|
+
exitCodeOfError,
|
|
9
|
+
mcpErrorResult,
|
|
10
|
+
renderError,
|
|
11
|
+
retryOf
|
|
12
|
+
} from "./chunk-LQ37ALDJ.js";
|
|
13
|
+
import "./chunk-5BVIWP3S.js";
|
|
14
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
15
|
+
export {
|
|
16
|
+
catchCrashes,
|
|
17
|
+
errorObjectOf,
|
|
18
|
+
errorRecordOf,
|
|
19
|
+
exitCodeOfAnswer,
|
|
20
|
+
exitCodeOfError,
|
|
21
|
+
mcpErrorResult,
|
|
22
|
+
renderError,
|
|
23
|
+
retryOf
|
|
24
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
askSetupQuestions,
|
|
5
|
+
asksAtStart,
|
|
6
|
+
setupAtStart,
|
|
7
|
+
systemLanguage
|
|
8
|
+
} from "./chunk-IK5TH3O7.js";
|
|
9
|
+
import "./chunk-ZD3WUGR2.js";
|
|
10
|
+
import "./chunk-P7P5MNAU.js";
|
|
11
|
+
import "./chunk-WLFLBWNH.js";
|
|
12
|
+
import "./chunk-MNOIRJEO.js";
|
|
13
|
+
import "./chunk-KHTO2Q6E.js";
|
|
14
|
+
import "./chunk-QX7RCLRS.js";
|
|
15
|
+
import "./chunk-D72URWJE.js";
|
|
16
|
+
import "./chunk-FZ5FXIG6.js";
|
|
17
|
+
import "./chunk-J3QXTBD2.js";
|
|
18
|
+
import "./chunk-LQ37ALDJ.js";
|
|
19
|
+
import "./chunk-Y5E2WNWB.js";
|
|
20
|
+
import "./chunk-5BVIWP3S.js";
|
|
21
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
22
|
+
export {
|
|
23
|
+
askSetupQuestions,
|
|
24
|
+
asksAtStart,
|
|
25
|
+
setupAtStart,
|
|
26
|
+
systemLanguage
|
|
27
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
WIRECAT_TOOLS,
|
|
5
|
+
firstScreen,
|
|
6
|
+
installHelp
|
|
7
|
+
} from "./chunk-TWTATDM7.js";
|
|
8
|
+
import "./chunk-MS53RALV.js";
|
|
9
|
+
import "./chunk-TVREDYX4.js";
|
|
10
|
+
import "./chunk-HTQTIKWP.js";
|
|
11
|
+
import "./chunk-GQQJOH7A.js";
|
|
12
|
+
import "./chunk-QLEUNU6G.js";
|
|
13
|
+
import "./chunk-7SXGLT6T.js";
|
|
14
|
+
import "./chunk-WLFLBWNH.js";
|
|
15
|
+
import "./chunk-KM7Q67Z3.js";
|
|
16
|
+
import "./chunk-6MAZWSC3.js";
|
|
17
|
+
import "./chunk-3KEVLSNN.js";
|
|
18
|
+
import "./chunk-UH4DDRHA.js";
|
|
19
|
+
import "./chunk-NPGVOZVK.js";
|
|
20
|
+
import "./chunk-KHTO2Q6E.js";
|
|
21
|
+
import "./chunk-5NYMNSSO.js";
|
|
22
|
+
import "./chunk-FZ5FXIG6.js";
|
|
23
|
+
import "./chunk-J3QXTBD2.js";
|
|
24
|
+
import "./chunk-LQ37ALDJ.js";
|
|
25
|
+
import "./chunk-Y5E2WNWB.js";
|
|
26
|
+
import "./chunk-5BVIWP3S.js";
|
|
27
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
28
|
+
export {
|
|
29
|
+
WIRECAT_TOOLS,
|
|
30
|
+
firstScreen,
|
|
31
|
+
installHelp
|
|
32
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
appInstructions,
|
|
5
|
+
instructions
|
|
6
|
+
} from "./chunk-TQFCPUIM.js";
|
|
7
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
8
|
+
export {
|
|
9
|
+
appInstructions,
|
|
10
|
+
instructions
|
|
11
|
+
};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
3
|
+
const require = __bundleRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
IDENTITY
|
|
6
|
+
} from "./chunk-52F5DWS5.js";
|
|
7
|
+
import {
|
|
8
|
+
installerOf
|
|
9
|
+
} from "./chunk-QX7RCLRS.js";
|
|
10
|
+
import {
|
|
11
|
+
DESCRIBE_FLAG,
|
|
12
|
+
DISPATCH_FLAG,
|
|
13
|
+
PROGRAM_PREFIX,
|
|
14
|
+
SHIM_FORMAT,
|
|
15
|
+
describeAnswer,
|
|
16
|
+
exists,
|
|
17
|
+
fileState,
|
|
18
|
+
shimFiles,
|
|
19
|
+
writeShim
|
|
20
|
+
} from "./chunk-TI6VBZKJ.js";
|
|
21
|
+
import "./chunk-J3QXTBD2.js";
|
|
22
|
+
import {
|
|
23
|
+
catchCrashes
|
|
24
|
+
} from "./chunk-LQ37ALDJ.js";
|
|
25
|
+
import "./chunk-Y5E2WNWB.js";
|
|
26
|
+
import "./chunk-5BVIWP3S.js";
|
|
27
|
+
import {
|
|
28
|
+
__name
|
|
29
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
30
|
+
|
|
31
|
+
// dist/bin/mail.js
|
|
32
|
+
import { enableCompileCache } from "node:module";
|
|
33
|
+
|
|
34
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/start.js
|
|
35
|
+
import { fileURLToPath } from "node:url";
|
|
36
|
+
|
|
37
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/launcher.js
|
|
38
|
+
import { readFileSync } from "node:fs";
|
|
39
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
40
|
+
var posix = /* @__PURE__ */ __name((path) => path.replaceAll("\\", "/"), "posix");
|
|
41
|
+
var pnpmHome = /* @__PURE__ */ __name((path, env) => {
|
|
42
|
+
const home = env.PNPM_HOME;
|
|
43
|
+
return home && path.startsWith(`${posix(home).replace(/\/+$/, "")}/`) ? home : void 0;
|
|
44
|
+
}, "pnpmHome");
|
|
45
|
+
var layoutFolders = /* @__PURE__ */ __name((script, env) => {
|
|
46
|
+
const path = posix(script);
|
|
47
|
+
const home = pnpmHome(path, env);
|
|
48
|
+
if (home)
|
|
49
|
+
return [join(home, "bin"), home];
|
|
50
|
+
switch (installerOf(script)) {
|
|
51
|
+
case "bun":
|
|
52
|
+
return [`${path.slice(0, path.indexOf("/install/global/node_modules/"))}/bin`];
|
|
53
|
+
case "npm": {
|
|
54
|
+
const root = path.slice(0, path.indexOf("/node_modules/"));
|
|
55
|
+
return [basename(root) === "lib" ? join(dirname(root), "bin") : root];
|
|
56
|
+
}
|
|
57
|
+
default:
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
}, "layoutFolders");
|
|
61
|
+
var binFolder = /* @__PURE__ */ __name(({ name, argv1, script, env, platform }) => {
|
|
62
|
+
if (!["npm", "pnpm", "bun"].includes(installerOf(script)) && !pnpmHome(posix(script), env))
|
|
63
|
+
return void 0;
|
|
64
|
+
const extensions = platform === "win32" ? [".cmd", ".exe"] : [""];
|
|
65
|
+
const candidates = [argv1 ? dirname(argv1) : void 0, ...layoutFolders(script, env)];
|
|
66
|
+
for (const dir of new Set(candidates)) {
|
|
67
|
+
if (dir === void 0 || basename(dir) === ".bin")
|
|
68
|
+
continue;
|
|
69
|
+
for (const extension of extensions) {
|
|
70
|
+
const program = `${PROGRAM_PREFIX}${name}${extension}`;
|
|
71
|
+
if (exists(join(dir, program)))
|
|
72
|
+
return { dir, program };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return void 0;
|
|
76
|
+
}, "binFolder");
|
|
77
|
+
var installed = /* @__PURE__ */ __name((dir, program) => {
|
|
78
|
+
if (!exists(join(dir, program)))
|
|
79
|
+
return false;
|
|
80
|
+
if (!program.toLowerCase().endsWith(".exe"))
|
|
81
|
+
return true;
|
|
82
|
+
let script;
|
|
83
|
+
try {
|
|
84
|
+
script = readFileSync(join(dir, `${program.slice(0, -4)}.bunx`)).toString("utf16le").split('"')[0] ?? "";
|
|
85
|
+
} catch {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
if (script === "" || exists(resolve(dir, script)))
|
|
89
|
+
return true;
|
|
90
|
+
const at = posix(script).lastIndexOf("/install/global/node_modules/");
|
|
91
|
+
return at < 0 || exists(join(dirname(dir), posix(script).slice(at + 1)));
|
|
92
|
+
}, "installed");
|
|
93
|
+
var NAME = "wcat";
|
|
94
|
+
var ensureLauncher = /* @__PURE__ */ __name(({ dir, program, platform }) => {
|
|
95
|
+
try {
|
|
96
|
+
const mine = shimFiles("launcher", { dir, name: NAME, target: program, platform });
|
|
97
|
+
const states = mine.map((file) => fileState(file.path));
|
|
98
|
+
if (states.some((one) => one.state === "foreign"))
|
|
99
|
+
return "foreign";
|
|
100
|
+
const ours = states.flatMap((one) => one.state === "ours" ? [one] : []);
|
|
101
|
+
if (ours.some(({ mark }) => mark.format > SHIM_FORMAT))
|
|
102
|
+
return "newer";
|
|
103
|
+
if (ours.some(({ mark }) => mark.kind !== "launcher"))
|
|
104
|
+
return "foreign";
|
|
105
|
+
const current = ours.find(({ mark }) => installed(dir, mark.target))?.mark.target;
|
|
106
|
+
const wanted = shimFiles("launcher", { dir, name: NAME, target: current ?? program, platform });
|
|
107
|
+
const stale = wanted.filter((file, at) => {
|
|
108
|
+
const state = states[at];
|
|
109
|
+
return state?.state !== "ours" || state.text !== file.text;
|
|
110
|
+
});
|
|
111
|
+
if (stale.length === 0)
|
|
112
|
+
return "kept";
|
|
113
|
+
for (const file of stale)
|
|
114
|
+
writeShim(file);
|
|
115
|
+
return "written";
|
|
116
|
+
} catch {
|
|
117
|
+
return "failed";
|
|
118
|
+
}
|
|
119
|
+
}, "ensureLauncher");
|
|
120
|
+
|
|
121
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/start.js
|
|
122
|
+
var wcatStart = /* @__PURE__ */ __name(async (tool, io = {}) => {
|
|
123
|
+
const argv = io.argv ?? process.argv;
|
|
124
|
+
const env = io.env ?? process.env;
|
|
125
|
+
const platform = io.platform ?? process.platform;
|
|
126
|
+
const stdout = io.stdout ?? process.stdout;
|
|
127
|
+
const [first, ...rest] = argv.slice(2);
|
|
128
|
+
if (first === DESCRIBE_FLAG) {
|
|
129
|
+
stdout.write(`${JSON.stringify(describeAnswer(tool))}
|
|
130
|
+
`);
|
|
131
|
+
return { code: 0 };
|
|
132
|
+
}
|
|
133
|
+
if (first === DISPATCH_FLAG) {
|
|
134
|
+
const { runWcat } = await import("./dispatch-EUKKT3PD.js");
|
|
135
|
+
const code = await runWcat(rest, { env, platform, stdout, stderr: io.stderr ?? process.stderr, self: tool });
|
|
136
|
+
return { code };
|
|
137
|
+
}
|
|
138
|
+
const folder = binFolder({
|
|
139
|
+
name: tool.command,
|
|
140
|
+
argv1: argv[1],
|
|
141
|
+
script: io.script ?? fileURLToPath(new URL("wcat/start.js", import.meta.resolve("@wirecat/cli-base")).href),
|
|
142
|
+
env,
|
|
143
|
+
platform
|
|
144
|
+
});
|
|
145
|
+
return folder ? { launcher: ensureLauncher({ ...folder, platform }) } : {};
|
|
146
|
+
}, "wcatStart");
|
|
147
|
+
|
|
148
|
+
// dist/bin/mail.js
|
|
149
|
+
enableCompileCache();
|
|
150
|
+
var wcat = await wcatStart({
|
|
151
|
+
command: IDENTITY.command,
|
|
152
|
+
version: IDENTITY.version,
|
|
153
|
+
description: IDENTITY.description,
|
|
154
|
+
docs: "https://github.com/WireCatLabs/mail-cli#readme"
|
|
155
|
+
});
|
|
156
|
+
if (wcat.code !== void 0) {
|
|
157
|
+
process.exitCode = wcat.code;
|
|
158
|
+
} else {
|
|
159
|
+
const stopCatching = catchCrashes({ cli: IDENTITY.command, interactive: process.stdout.isTTY === true });
|
|
160
|
+
const { run } = await import("./program-JTJB26P3.js");
|
|
161
|
+
try {
|
|
162
|
+
process.exitCode = await run(process.argv.slice(2));
|
|
163
|
+
} finally {
|
|
164
|
+
stopCatching();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
executableEnvironment,
|
|
5
|
+
executableOnPath
|
|
6
|
+
} from "./chunk-P7P5MNAU.js";
|
|
7
|
+
import {
|
|
8
|
+
require_cross_spawn
|
|
9
|
+
} from "./chunk-D72URWJE.js";
|
|
10
|
+
import {
|
|
11
|
+
__name,
|
|
12
|
+
__toESM
|
|
13
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
14
|
+
|
|
15
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/mcp/index.js
|
|
16
|
+
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
17
|
+
var realRun = /* @__PURE__ */ __name((file, args) => {
|
|
18
|
+
const result = import_cross_spawn.default.sync(executableOnPath(file, process.env), args, {
|
|
19
|
+
encoding: "utf8",
|
|
20
|
+
timeout: 1e4,
|
|
21
|
+
maxBuffer: 256e3,
|
|
22
|
+
env: executableEnvironment(process.env)
|
|
23
|
+
});
|
|
24
|
+
return { status: result.status, error: result.error, stdout: result.stdout ?? "", stderr: result.stderr ?? "" };
|
|
25
|
+
}, "realRun");
|
|
26
|
+
var executable = /* @__PURE__ */ __name((client) => client === "codex" ? "codex" : "claude", "executable");
|
|
27
|
+
var presentIn = /* @__PURE__ */ __name((client, name, run) => {
|
|
28
|
+
const state = lookUp(client, name, run);
|
|
29
|
+
if (state === "unavailable")
|
|
30
|
+
throw new Error(`${executable(client)} is not installed or could not be started`);
|
|
31
|
+
return state === "registered";
|
|
32
|
+
}, "presentIn");
|
|
33
|
+
var setupArguments = /* @__PURE__ */ __name((client, name, entry) => {
|
|
34
|
+
const variables = Object.entries(entry.env ?? {}).flatMap(([key, value]) => ["--env", `${key}=${value}`]);
|
|
35
|
+
if (client === "codex")
|
|
36
|
+
return ["mcp", "add", name, ...variables, "--", entry.command, ...entry.args];
|
|
37
|
+
return ["mcp", "add", "--scope", "user", name, ...variables, "--", entry.command, ...entry.args];
|
|
38
|
+
}, "setupArguments");
|
|
39
|
+
var checkName = /* @__PURE__ */ __name((name) => {
|
|
40
|
+
if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name))
|
|
41
|
+
throw new Error("the MCP name must be letters, digits, _ or -");
|
|
42
|
+
}, "checkName");
|
|
43
|
+
var lookUp = /* @__PURE__ */ __name((client, name, run) => {
|
|
44
|
+
const file = executable(client);
|
|
45
|
+
const existing = run(file, ["mcp", "get", name, ...client === "codex" ? ["--json"] : []]);
|
|
46
|
+
if (existing.error)
|
|
47
|
+
return "unavailable";
|
|
48
|
+
if (existing.status === 0)
|
|
49
|
+
return "registered";
|
|
50
|
+
if (!/No MCP server named/i.test(existing.stdout + existing.stderr)) {
|
|
51
|
+
throw new Error(`${file} could not check its MCP configuration`);
|
|
52
|
+
}
|
|
53
|
+
return "missing";
|
|
54
|
+
}, "lookUp");
|
|
55
|
+
var stdioEntryStatus = /* @__PURE__ */ __name((client, name, { run = realRun } = {}) => {
|
|
56
|
+
checkName(name);
|
|
57
|
+
return { client, name, state: lookUp(client, name, run) };
|
|
58
|
+
}, "stdioEntryStatus");
|
|
59
|
+
var removeArguments = /* @__PURE__ */ __name((client, name) => (
|
|
60
|
+
// Claude Code without a scope removes from whichever scope holds the name, which may be a project's own entry.
|
|
61
|
+
client === "codex" ? ["mcp", "remove", name] : ["mcp", "remove", "--scope", "user", name]
|
|
62
|
+
), "removeArguments");
|
|
63
|
+
var removeStdioEntry = /* @__PURE__ */ __name((client, name, { run = realRun } = {}) => {
|
|
64
|
+
checkName(name);
|
|
65
|
+
if (!presentIn(client, name, run))
|
|
66
|
+
return { client, name, removed: false };
|
|
67
|
+
const file = executable(client);
|
|
68
|
+
const removed = run(file, removeArguments(client, name));
|
|
69
|
+
if (removed.status !== 0 || removed.error)
|
|
70
|
+
throw new Error(`${file} could not remove ${name}`);
|
|
71
|
+
return { client, name, removed: true };
|
|
72
|
+
}, "removeStdioEntry");
|
|
73
|
+
var installStdioEntry = /* @__PURE__ */ __name((client, name, entry, { run = realRun } = {}) => {
|
|
74
|
+
checkName(name);
|
|
75
|
+
if (!entry.command || entry.args.some((arg) => arg.includes("\0")))
|
|
76
|
+
throw new Error("invalid MCP command");
|
|
77
|
+
const file = executable(client);
|
|
78
|
+
if (presentIn(client, name, run))
|
|
79
|
+
throw new Error(`${name} is already configured in ${file}; remove it there first`);
|
|
80
|
+
const args = setupArguments(client, name, entry);
|
|
81
|
+
const added = run(file, args);
|
|
82
|
+
if (added.status !== 0 || added.error)
|
|
83
|
+
throw new Error(`${file} could not add ${name}`);
|
|
84
|
+
return { client, name, command: [entry.command, ...entry.args] };
|
|
85
|
+
}, "installStdioEntry");
|
|
86
|
+
var probeStdio = /* @__PURE__ */ __name(async (entry, { timeoutMs = 1e4, start = /* @__PURE__ */ __name((file, args, env) => (0, import_cross_spawn.default)(executableOnPath(file, env), args, {
|
|
87
|
+
env: executableEnvironment(env),
|
|
88
|
+
stdio: "pipe"
|
|
89
|
+
}), "start") } = {}) => {
|
|
90
|
+
const child = start(entry.command, entry.args, { ...process.env, ...entry.env });
|
|
91
|
+
let buffer = "";
|
|
92
|
+
let timer;
|
|
93
|
+
const pending = /* @__PURE__ */ new Map();
|
|
94
|
+
const request = /* @__PURE__ */ __name((id, method, params) => new Promise((resolve, reject) => {
|
|
95
|
+
pending.set(id, { resolve, reject });
|
|
96
|
+
child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", id, method, params })}
|
|
97
|
+
`);
|
|
98
|
+
}), "request");
|
|
99
|
+
const fail = /* @__PURE__ */ __name((error) => {
|
|
100
|
+
for (const waiter of pending.values())
|
|
101
|
+
waiter.reject(error);
|
|
102
|
+
pending.clear();
|
|
103
|
+
}, "fail");
|
|
104
|
+
child.on("error", () => fail(new Error("the MCP server could not be started")));
|
|
105
|
+
child.on("exit", () => fail(new Error("the MCP server exited before answering")));
|
|
106
|
+
child.stdin.on("error", () => fail(new Error("the MCP server closed its input")));
|
|
107
|
+
child.stdout.setEncoding("utf8");
|
|
108
|
+
child.stdout.on("data", (chunk) => {
|
|
109
|
+
buffer += chunk;
|
|
110
|
+
if (buffer.length > 1e6)
|
|
111
|
+
return fail(new Error("the MCP server sent too much output"));
|
|
112
|
+
for (let newline = buffer.indexOf("\n"); newline !== -1; newline = buffer.indexOf("\n")) {
|
|
113
|
+
const line = buffer.slice(0, newline);
|
|
114
|
+
buffer = buffer.slice(newline + 1);
|
|
115
|
+
try {
|
|
116
|
+
const value = JSON.parse(line);
|
|
117
|
+
if (typeof value.id !== "number")
|
|
118
|
+
continue;
|
|
119
|
+
const waiter = pending.get(value.id);
|
|
120
|
+
if (!waiter)
|
|
121
|
+
continue;
|
|
122
|
+
pending.delete(value.id);
|
|
123
|
+
if (value.error)
|
|
124
|
+
waiter.reject(new Error("the MCP server rejected the handshake"));
|
|
125
|
+
else
|
|
126
|
+
waiter.resolve(value.result ?? {});
|
|
127
|
+
} catch {
|
|
128
|
+
fail(new Error("the MCP server sent invalid JSON"));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
try {
|
|
133
|
+
timer = setTimeout(() => fail(new Error("the MCP server did not answer in time")), timeoutMs);
|
|
134
|
+
await request(1, "initialize", {
|
|
135
|
+
protocolVersion: "2025-11-25",
|
|
136
|
+
capabilities: {},
|
|
137
|
+
clientInfo: { name: "cli-base-mcp-doctor", version: "1" }
|
|
138
|
+
});
|
|
139
|
+
child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" })}
|
|
140
|
+
`);
|
|
141
|
+
const result = await request(2, "tools/list", {});
|
|
142
|
+
const tools = result.tools;
|
|
143
|
+
if (!Array.isArray(tools))
|
|
144
|
+
throw new Error("the MCP server returned no tool list");
|
|
145
|
+
const named = tools.filter((item) => item !== null && typeof item === "object" && "name" in item && typeof item.name === "string");
|
|
146
|
+
if (named.length !== tools.length)
|
|
147
|
+
throw new Error("the MCP server returned an invalid tool list");
|
|
148
|
+
return {
|
|
149
|
+
tools: named.map((item) => item.name),
|
|
150
|
+
potentialWrites: named.filter((item) => item.annotations?.readOnlyHint !== true).map((item) => item.name)
|
|
151
|
+
};
|
|
152
|
+
} finally {
|
|
153
|
+
if (timer)
|
|
154
|
+
clearTimeout(timer);
|
|
155
|
+
pending.clear();
|
|
156
|
+
child.stdin.end();
|
|
157
|
+
child.kill();
|
|
158
|
+
}
|
|
159
|
+
}, "probeStdio");
|
|
160
|
+
export {
|
|
161
|
+
installStdioEntry,
|
|
162
|
+
probeStdio,
|
|
163
|
+
removeArguments,
|
|
164
|
+
removeStdioEntry,
|
|
165
|
+
setupArguments,
|
|
166
|
+
stdioEntryStatus
|
|
167
|
+
};
|