@wirecat/mail-cli 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/README.md +4 -1
- package/contracts/wirecat.json +52 -2
- package/dist/bin/mail.js +2 -2
- package/dist/bundle/agent-MW7YWUIY.js +39 -0
- package/dist/bundle/{all-profiles-2KUKROHY.js → all-profiles-RS6OV3YO.js} +63 -21
- package/dist/bundle/{anthropic-E5KRCEVC.js → anthropic-PPQ7DTXN.js} +5 -5
- package/dist/bundle/{app-server-HIQ3QO5K.js → app-server-EBFBMFQC.js} +81 -71
- package/dist/bundle/{bun-KARJPE5D.js → bun-J7HAT7MW.js} +2 -2
- package/dist/bundle/{bun-sqlite-NHGX6ZUN.js → bun-sqlite-PCSNAXIQ.js} +6 -6
- package/dist/bundle/{chunk-WYGDALB3.js → chunk-2RV4V55B.js} +18 -18
- package/dist/bundle/{chunk-QXYNDMA6.js → chunk-2UNZ3L2H.js} +6 -6
- package/dist/bundle/{chunk-DYQGEZA2.js → chunk-2VEFNFYZ.js} +3 -3
- package/dist/bundle/chunk-3BYKGMRM.js +338 -0
- package/dist/bundle/{chunk-PRDKEVUL.js → chunk-3NOXZZJV.js} +1 -1
- package/dist/bundle/{chunk-4VM3UCSO.js → chunk-3ZKNXKM7.js} +2 -2
- package/dist/bundle/{chunk-JVGVLRBA.js → chunk-42XY6D5C.js} +5 -5
- package/dist/bundle/{chunk-A2Y2RFNW.js → chunk-437UHSIO.js} +123 -6
- package/dist/bundle/{chunk-FNYWC6A3.js → chunk-4WSTWZUB.js} +3 -3
- package/dist/bundle/{chunk-V43KEZYA.js → chunk-5G4MDFZ2.js} +9 -60
- package/dist/bundle/{chunk-ZZEWQR43.js → chunk-5JEKBYIH.js} +14 -14
- package/dist/bundle/{chunk-CKVWAUBW.js → chunk-5TIWO6AR.js} +12 -12
- package/dist/bundle/{chunk-X6IGETU6.js → chunk-5VPLQS4S.js} +2 -2
- package/dist/bundle/chunk-645FQC4G.js +559 -0
- package/dist/bundle/{chunk-PA4GEJXQ.js → chunk-6FZPFNEU.js} +9 -9
- package/dist/bundle/{chunk-XWU3A7H6.js → chunk-6LJIENVT.js} +2 -2
- package/dist/bundle/{chunk-2GDLJKPT.js → chunk-6NDPOY4N.js} +1 -1
- package/dist/bundle/{chunk-QXLYLVEC.js → chunk-6PKMUKUF.js} +1 -1
- package/dist/bundle/{chunk-TZJC4AOK.js → chunk-6TT62IUW.js} +53 -33
- package/dist/bundle/chunk-6UYIWQLU.js +52 -0
- package/dist/bundle/{chunk-MGXYIVVJ.js → chunk-6VMJLOYO.js} +12 -12
- package/dist/bundle/{chunk-ZGZADWD7.js → chunk-774VG5WZ.js} +1 -1
- package/dist/bundle/chunk-AVR4FPYG.js +192 -0
- package/dist/bundle/{chunk-KF6O4RZO.js → chunk-BBQERXQX.js} +3 -3
- package/dist/bundle/{chunk-LOSYDRJU.js → chunk-C3JSQ7UJ.js} +53 -11
- package/dist/bundle/{chunk-OJ3BI2U4.js → chunk-CJHO6B3M.js} +34 -28
- package/dist/bundle/{chunk-VRGEDK4T.js → chunk-CJMZQ2MZ.js} +35 -12
- package/dist/bundle/{chunk-4SKE5GYA.js → chunk-CMOO4INK.js} +1 -1
- package/dist/bundle/{chunk-DZRP4UCK.js → chunk-DVJPEZGV.js} +30 -15
- package/dist/bundle/{chunk-H77ALM2Y.js → chunk-EGR3YUWD.js} +4 -4
- package/dist/bundle/{chunk-4VHK5UBM.js → chunk-GBZIWCEP.js} +3 -3
- package/dist/bundle/{chunk-2SCQ7Z4I.js → chunk-GCTHVCJU.js} +4 -4
- package/dist/bundle/{chunk-4URI6EAV.js → chunk-GEU3WR75.js} +3 -3
- package/dist/bundle/{chunk-OX5MCGXL.js → chunk-GI6DNX7Q.js} +63 -54
- package/dist/bundle/{chunk-KLI5FKZ2.js → chunk-HH34WRQE.js} +7 -7
- package/dist/bundle/chunk-HPSESLOZ.js +7 -0
- package/dist/bundle/{chunk-6LFRZDPV.js → chunk-IBOWSQ7X.js} +3 -4
- package/dist/bundle/{chunk-XIF75Z7D.js → chunk-JCILSTFK.js} +1 -1
- package/dist/bundle/{chunk-OOYRMTX5.js → chunk-KLPFPNZP.js} +12 -26
- package/dist/bundle/{chunk-6G4VQFVX.js → chunk-KP7JHJVP.js} +17 -17
- package/dist/bundle/chunk-KTVQIKU5.js +726 -0
- package/dist/bundle/{chunk-2VBEBPGX.js → chunk-KVFBSOCV.js} +9 -9
- package/dist/bundle/{chunk-KGYK3OI3.js → chunk-L4QLZDBZ.js} +43 -64
- package/dist/bundle/{chunk-R2GS3GBJ.js → chunk-LQQIYBHN.js} +100 -66
- package/dist/bundle/{chunk-I3MS74OF.js → chunk-MQ6DQRRI.js} +4 -4
- package/dist/bundle/{chunk-FORAOCZ3.js → chunk-MRWV5VNQ.js} +6 -6
- package/dist/bundle/{chunk-NJVJH5MH.js → chunk-MT3LYU4T.js} +3245 -1644
- package/dist/bundle/{chunk-5GANGHQI.js → chunk-NCY55XIT.js} +9 -9
- package/dist/bundle/{chunk-QFJC6POK.js → chunk-NJZR3OFK.js} +1 -1
- package/dist/bundle/chunk-NSH2UHJR.js +353 -0
- package/dist/bundle/chunk-NTUP5RCP.js +116 -0
- package/dist/bundle/chunk-NYR7PIAG.js +80 -0
- package/dist/bundle/{chunk-PC3N3LH3.js → chunk-NYYMMIVW.js} +3 -3
- package/dist/bundle/{chunk-NXERDBEK.js → chunk-OEL4DQTT.js} +4 -4
- package/dist/bundle/{chunk-RPNQXWRS.js → chunk-PF7ZNIVP.js} +2 -2
- package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
- package/dist/bundle/{chunk-QQGPV3QN.js → chunk-PMGAU6AP.js} +2 -2
- package/dist/bundle/{chunk-PVZMN3UZ.js → chunk-PMSZBUC7.js} +8 -8
- package/dist/bundle/{chunk-HH647UBC.js → chunk-PPIMXOBT.js} +104 -255
- package/dist/bundle/{chunk-YWX5X5RI.js → chunk-Q6TPXXOS.js} +19 -17
- package/dist/bundle/{chunk-Z6A6QPPW.js → chunk-QDNYJOWJ.js} +1 -1
- package/dist/bundle/{chunk-OG5QO5RR.js → chunk-QI2XGTFH.js} +8 -8
- package/dist/bundle/{chunk-T2EE5M7O.js → chunk-REWV37HQ.js} +144 -10
- package/dist/bundle/{chunk-LKTDW5LH.js → chunk-RJUVWJTA.js} +18 -8
- package/dist/bundle/{chunk-MDISZMK4.js → chunk-RMWS7IQ4.js} +4 -4
- package/dist/bundle/{chunk-VBVR6JRC.js → chunk-ROK7Z5LQ.js} +275 -174
- package/dist/bundle/{chunk-HRDCH2VB.js → chunk-SCJVKWMV.js} +3665 -3339
- package/dist/bundle/{chunk-NAENYLIO.js → chunk-SJNFPBPF.js} +2 -2
- package/dist/bundle/{chunk-6GGMFL7J.js → chunk-TV634B6T.js} +2 -100
- package/dist/bundle/{chunk-26DYRMXE.js → chunk-U3BO342P.js} +1 -1
- package/dist/bundle/{chunk-KNVTBDTE.js → chunk-U67XMAEE.js} +3 -3
- package/dist/bundle/chunk-V5I7QP4T.js +108 -0
- package/dist/bundle/{chunk-NI4GCP2T.js → chunk-VIDPFLFM.js} +2 -2
- package/dist/bundle/{chunk-AGZ7SNFF.js → chunk-VIJV474N.js} +1 -1
- package/dist/bundle/{chunk-QOQF2TX3.js → chunk-WNQECDIP.js} +338 -299
- package/dist/bundle/{chunk-SK3N4CK5.js → chunk-WPPPO427.js} +4 -4
- package/dist/bundle/{chunk-EZAX77SM.js → chunk-WZFGZBGD.js} +86 -75
- package/dist/bundle/{chunk-EGQJDEFY.js → chunk-XRVZMM5B.js} +158 -562
- package/dist/bundle/{chunk-NWD7AFOR.js → chunk-YPB5BEAD.js} +2 -2
- package/dist/bundle/{chunk-NHD5BOJU.js → chunk-ZRSLG3B3.js} +6 -6
- package/dist/bundle/{chunk-IMQ4CVZJ.js → chunk-ZV57PIPE.js} +2 -2
- package/dist/bundle/command-contract-WFTIRPL5.js +39 -0
- package/dist/bundle/{command-server-entry-NF45UPEV.js → command-server-entry-73RJELAV.js} +28 -28
- package/dist/bundle/{decode-DUZA3EHC.js → decode-7BUWBDPT.js} +5 -5
- package/dist/bundle/{dispatch-CDJZAMVP.js → dispatch-IBOMVWZA.js} +8 -8
- package/dist/bundle/{dist-RH7EMC4J.js → dist-MULVCVSR.js} +25 -23
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/{echarts-GZHZBNRA.js → echarts-VLWFC322.js} +2 -2
- package/dist/bundle/{embed-VE3CSJN4.js → embed-W3VH4HPY.js} +6 -6
- package/dist/bundle/{embedder-DSJ77DX5.js → embedder-I7ERQZJV.js} +9 -9
- package/dist/bundle/{failure-YH6HAGFT.js → failure-QMAPSQ7X.js} +2 -2
- package/dist/bundle/{first-run-3L7HLYTI.js → first-run-LCVER6QN.js} +12 -12
- package/dist/bundle/first-screen-DCTHI4NQ.js +39 -0
- package/dist/bundle/{instructions-OZK3BLIO.js → instructions-BNCVLSYQ.js} +1 -1
- package/dist/bundle/mail.js +12 -12
- package/dist/bundle/{mcp-YUG4YR4R.js → mcp-Z2KZNCXB.js} +2 -2
- package/dist/bundle/meeting-combined-ITU7SZ7E.js +24 -0
- package/dist/bundle/{meeting-model-U7LW5WEN.js → meeting-model-BWLSTNXA.js} +11 -11
- package/dist/bundle/{meeting-semantic-64IOIQRR.js → meeting-semantic-ZIEHXN2R.js} +6 -6
- package/dist/bundle/{node-OS3VWBUZ.js → node-RYFTRSG4.js} +2 -2
- package/dist/bundle/{node-sqlite-RQ623VFA.js → node-sqlite-XCHVNTGQ.js} +7 -7
- package/dist/bundle/{oauth-CBPAG734.js → oauth-FNUJSKKJ.js} +8 -8
- package/dist/bundle/{open-H4DGOMBC.js → open-WVWSJ3WI.js} +5 -5
- package/dist/bundle/{openai-EMWRGR54.js → openai-QOUTYYTF.js} +15 -15
- package/dist/bundle/{process-3TOIYASI.js → process-W5KPID53.js} +1 -1
- package/dist/bundle/{program-WA6RGAJL.js → program-L5UANM3I.js} +3397 -2219
- package/dist/bundle/{prompt-22KNCMBI.js → prompt-JSBAPNJE.js} +5 -5
- package/dist/bundle/{recognize-UWD4RSCZ.js → recognize-FDX4SJ6Q.js} +4 -4
- package/dist/bundle/{remote-LJY7MF2E.js → remote-MYOXOQHM.js} +9 -9
- package/dist/bundle/{rerank-JJ6KNJFB.js → rerank-NY5MSZCR.js} +7 -7
- package/dist/bundle/{serve-3EPLJYVZ.js → serve-URI6NZA3.js} +10 -10
- package/dist/bundle/{server-5JOFO4V4.js → server-HQ25RHQM.js} +75 -64
- package/dist/bundle/server-UVYFU2JN.js +84 -0
- package/dist/bundle/{sqlite-runtime-MGJA5E27.js → sqlite-runtime-6UUPSSKG.js} +6 -6
- package/dist/bundle/{state-UCRDOWOP.js → state-NDDVFPCI.js} +6 -6
- package/dist/bundle/{store-265VRRQV.js → store-2RDOICVN.js} +28 -23
- package/dist/bundle/{store-HS272YSA.js → store-PKYWPKKR.js} +34 -21
- package/dist/bundle/store-maintenance-command-Y5XTO47X.js +71 -0
- package/dist/bundle/surface-3XKM3MQ2.js +70 -0
- package/dist/commands/read.d.ts +2 -2
- package/dist/commands/read.d.ts.map +1 -1
- package/dist/commands/read.js +5 -4
- package/dist/commands/read.js.map +1 -1
- package/dist/commands/session-start.js +1 -1
- package/dist/commands/session-start.js.map +1 -1
- package/dist/commands/sync.d.ts +2 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +16 -9
- package/dist/commands/sync.js.map +1 -1
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +16 -1
- package/dist/config.js.map +1 -1
- package/dist/oauth.d.ts.map +1 -1
- package/dist/oauth.js +2 -1
- package/dist/oauth.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/bundle/chunk-FEBUZHU3.js +0 -2
- package/dist/bundle/command-contract-PZ7VOOXP.js +0 -39
- package/dist/bundle/first-screen-MY5KID77.js +0 -37
- package/dist/bundle/meeting-combined-RYMUPY54.js +0 -24
- package/dist/bundle/server-EOQNS7B7.js +0 -75
- package/dist/bundle/store-maintenance-command-IKZM5NRP.js +0 -66
|
@@ -3,12 +3,97 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
CliError,
|
|
5
5
|
isCliError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PMGAU6AP.js";
|
|
7
7
|
import {
|
|
8
8
|
__name
|
|
9
9
|
} from "./chunk-ZVVMGPBJ.js";
|
|
10
10
|
|
|
11
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
11
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/body.js
|
|
12
|
+
var interrupted = /* @__PURE__ */ __name((signal) => isCliError(signal.reason) ? signal.reason : new CliError(signal.reason instanceof Error && signal.reason.name === "TimeoutError" ? "timeout" : "cancelled", "HTTP response read was interrupted"), "interrupted");
|
|
13
|
+
var checked = /* @__PURE__ */ __name((signal) => {
|
|
14
|
+
if (signal?.aborted)
|
|
15
|
+
throw interrupted(signal);
|
|
16
|
+
}, "checked");
|
|
17
|
+
var abortable = /* @__PURE__ */ __name(async (pending, signal) => {
|
|
18
|
+
if (!signal)
|
|
19
|
+
return pending;
|
|
20
|
+
let abort = /* @__PURE__ */ __name(() => {
|
|
21
|
+
}, "abort");
|
|
22
|
+
const stopped = new Promise((_, reject) => {
|
|
23
|
+
abort = /* @__PURE__ */ __name(() => reject(interrupted(signal)), "abort");
|
|
24
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
25
|
+
if (signal.aborted)
|
|
26
|
+
abort();
|
|
27
|
+
});
|
|
28
|
+
try {
|
|
29
|
+
return await Promise.race([pending, stopped]);
|
|
30
|
+
} finally {
|
|
31
|
+
signal.removeEventListener("abort", abort);
|
|
32
|
+
}
|
|
33
|
+
}, "abortable");
|
|
34
|
+
var readJsonResponse = /* @__PURE__ */ __name(async (response, options) => {
|
|
35
|
+
const { maxBytes, signal } = options ?? {};
|
|
36
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 1)
|
|
37
|
+
throw new CliError("validation_error", "maxBytes must be a positive safe integer");
|
|
38
|
+
if (signal !== void 0 && !(signal instanceof AbortSignal))
|
|
39
|
+
throw new CliError("validation_error", "signal must be an AbortSignal");
|
|
40
|
+
if (signal?.aborted) {
|
|
41
|
+
void response.body?.cancel().catch(() => {
|
|
42
|
+
});
|
|
43
|
+
throw interrupted(signal);
|
|
44
|
+
}
|
|
45
|
+
const length = response.headers.get("content-length");
|
|
46
|
+
if (length !== null && (!/^\d+$/.test(length) || Number(length) > maxBytes)) {
|
|
47
|
+
void response.body?.cancel().catch(() => {
|
|
48
|
+
});
|
|
49
|
+
throw new CliError("invalid_response", "HTTP response exceeds the byte budget");
|
|
50
|
+
}
|
|
51
|
+
if (!response.body)
|
|
52
|
+
throw new CliError("invalid_response", "HTTP response has no body");
|
|
53
|
+
if (response.body.locked)
|
|
54
|
+
throw new CliError("invalid_response", "HTTP response body is already in use");
|
|
55
|
+
const reader = response.body.getReader();
|
|
56
|
+
const chunks = [];
|
|
57
|
+
let bytes = 0;
|
|
58
|
+
try {
|
|
59
|
+
for (; ; ) {
|
|
60
|
+
checked(signal);
|
|
61
|
+
const part = await abortable(reader.read(), signal);
|
|
62
|
+
checked(signal);
|
|
63
|
+
if (part.done)
|
|
64
|
+
break;
|
|
65
|
+
if (!(part.value instanceof Uint8Array))
|
|
66
|
+
throw new CliError("invalid_response", "HTTP response is not bytes");
|
|
67
|
+
bytes += part.value.byteLength;
|
|
68
|
+
if (bytes > maxBytes)
|
|
69
|
+
throw new CliError("invalid_response", "HTTP response exceeds the byte budget");
|
|
70
|
+
if (part.value.byteLength)
|
|
71
|
+
chunks.push(new Uint8Array(part.value));
|
|
72
|
+
}
|
|
73
|
+
const body = new Uint8Array(bytes);
|
|
74
|
+
let offset = 0;
|
|
75
|
+
for (const chunk of chunks) {
|
|
76
|
+
body.set(chunk, offset);
|
|
77
|
+
offset += chunk.byteLength;
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(body));
|
|
81
|
+
} catch {
|
|
82
|
+
throw new CliError("invalid_response", "HTTP response is not valid UTF-8 JSON");
|
|
83
|
+
}
|
|
84
|
+
} catch (error) {
|
|
85
|
+
checked(signal);
|
|
86
|
+
if (isCliError(error))
|
|
87
|
+
throw error;
|
|
88
|
+
throw new CliError("network_error", "HTTP response could not be read");
|
|
89
|
+
} finally {
|
|
90
|
+
void reader.cancel().catch(() => {
|
|
91
|
+
});
|
|
92
|
+
reader.releaseLock();
|
|
93
|
+
}
|
|
94
|
+
}, "readJsonResponse");
|
|
95
|
+
|
|
96
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/hosts.js
|
|
12
97
|
var LABEL = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
|
|
13
98
|
var HOST_PATTERN = new RegExp(`^(?:${LABEL}(?:\\.${LABEL})*|\\*\\.${LABEL}(?:\\.${LABEL})+)$`);
|
|
14
99
|
var hostProblems = /* @__PURE__ */ __name((hosts) => [
|
|
@@ -20,7 +105,7 @@ var hostCovered = /* @__PURE__ */ __name((hostname, hosts) => {
|
|
|
20
105
|
return hosts.some((host) => host.startsWith("*.") ? name.endsWith(host.slice(1)) : name === host);
|
|
21
106
|
}, "hostCovered");
|
|
22
107
|
|
|
23
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
108
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/fetch.js
|
|
24
109
|
var HOST_FETCH_TIMEOUT_MS = 3e4;
|
|
25
110
|
var REDIRECTS = 5;
|
|
26
111
|
var REDIRECT_STATUSES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
@@ -46,7 +131,7 @@ var released = /* @__PURE__ */ __name((response, clear) => {
|
|
|
46
131
|
return Object.defineProperties(wrapped, { url: { value: url }, redirected: { value: redirected } });
|
|
47
132
|
}, "released");
|
|
48
133
|
var undeclared = /* @__PURE__ */ __name((url) => new CliError("configuration_error", `${url.hostname} is not a host this CLI declares: add "${url.hostname}" to \`hosts\` in its WCAT identity and run cli-dev manifest`, { reason: "network.host-undeclared", sent: false }), "undeclared");
|
|
49
|
-
var
|
|
134
|
+
var checked2 = /* @__PURE__ */ __name((url, hosts) => {
|
|
50
135
|
if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
51
136
|
throw new CliError("validation_error", `only http and https are fetched, not ${url.protocol.replace(/:$/, "")}`, {
|
|
52
137
|
sent: false
|
|
@@ -55,14 +140,35 @@ var checked = /* @__PURE__ */ __name((url, hosts) => {
|
|
|
55
140
|
throw undeclared(url);
|
|
56
141
|
return url;
|
|
57
142
|
}, "checked");
|
|
143
|
+
var ENCODED_SLASH = /%2f|%5c/i;
|
|
144
|
+
var scopeOf = /* @__PURE__ */ __name((scope) => {
|
|
145
|
+
if (scope === void 0)
|
|
146
|
+
return void 0;
|
|
147
|
+
if (!URL.canParse(scope))
|
|
148
|
+
throw new CliError("configuration_error", `credentialScope ${scope} is not a URL`);
|
|
149
|
+
const { origin, pathname } = new URL(scope);
|
|
150
|
+
const prefix = pathname.endsWith("/") ? pathname : `${pathname}/`;
|
|
151
|
+
return (url) => url.origin === origin && (url.pathname === pathname || url.pathname.startsWith(prefix)) && !ENCODED_SLASH.test(url.pathname);
|
|
152
|
+
}, "scopeOf");
|
|
153
|
+
var signedHeaders = /* @__PURE__ */ __name((headers) => CREDENTIAL_HEADERS.some((name) => headers.has(name)), "signedHeaders");
|
|
154
|
+
var NOT_SENT = /* @__PURE__ */ new Set(["EAI_AGAIN", "ENOTFOUND", "ECONNREFUSED"]);
|
|
155
|
+
var neverSent = /* @__PURE__ */ __name((error) => {
|
|
156
|
+
for (let at = error, depth = 0; at instanceof Error && depth < 4; at = at.cause, depth++) {
|
|
157
|
+
const code = at.code;
|
|
158
|
+
if (typeof code === "string" && NOT_SENT.has(code))
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
return false;
|
|
162
|
+
}, "neverSent");
|
|
58
163
|
var hostFetch = /* @__PURE__ */ __name((options) => {
|
|
59
164
|
const problems = hostProblems(options.hosts);
|
|
60
165
|
if (problems.length > 0)
|
|
61
166
|
throw new CliError("configuration_error", problems.join("; "));
|
|
62
167
|
const { hosts, fetch: send = globalThis.fetch, timeoutMs = HOST_FETCH_TIMEOUT_MS, redirects = REDIRECTS } = options;
|
|
168
|
+
const inScope = scopeOf(options.credentialScope);
|
|
63
169
|
return async (input, init = {}) => {
|
|
64
170
|
const request = input instanceof Request ? input : void 0;
|
|
65
|
-
let url =
|
|
171
|
+
let url = checked2(new URL(request?.url ?? String(input)), hosts);
|
|
66
172
|
const caller = init.signal ?? request?.signal;
|
|
67
173
|
const timeout = deadline(timeoutMs);
|
|
68
174
|
const signal = caller ? AbortSignal.any([caller, timeout.signal]) : timeout.signal;
|
|
@@ -70,8 +176,14 @@ var hostFetch = /* @__PURE__ */ __name((options) => {
|
|
|
70
176
|
let method = (init.method ?? request?.method ?? "GET").toUpperCase();
|
|
71
177
|
let body = init.body ?? request?.body ?? void 0;
|
|
72
178
|
const headers = new Headers(init.headers ?? request?.headers);
|
|
179
|
+
if (inScope && signedHeaders(headers) && !inScope(url))
|
|
180
|
+
throw new CliError("configuration_error", `the sign-in goes only under ${options.credentialScope}, not ${url.origin}${url.pathname}`, {
|
|
181
|
+
sent: false
|
|
182
|
+
});
|
|
183
|
+
let answered = false;
|
|
73
184
|
try {
|
|
74
185
|
let response = await send(input, { ...init, signal, ...follow ? { redirect: "manual" } : {} });
|
|
186
|
+
answered = true;
|
|
75
187
|
for (let hop = 0; follow && REDIRECT_STATUSES.has(response.status); hop += 1) {
|
|
76
188
|
const location = response.headers.get("location");
|
|
77
189
|
if (!location)
|
|
@@ -80,7 +192,7 @@ var hostFetch = /* @__PURE__ */ __name((options) => {
|
|
|
80
192
|
throw new CliError("invalid_response", `more than ${redirects} redirects from ${url.hostname}`);
|
|
81
193
|
void response.body?.cancel().catch(() => {
|
|
82
194
|
});
|
|
83
|
-
const next =
|
|
195
|
+
const next = checked2(new URL(location, url), hosts);
|
|
84
196
|
if (response.status === 303 || (response.status === 301 || response.status === 302) && method === "POST") {
|
|
85
197
|
method = method === "HEAD" ? "HEAD" : "GET";
|
|
86
198
|
body = void 0;
|
|
@@ -88,7 +200,7 @@ var hostFetch = /* @__PURE__ */ __name((options) => {
|
|
|
88
200
|
headers.delete("content-length");
|
|
89
201
|
} else if (body instanceof ReadableStream)
|
|
90
202
|
throw new CliError("invalid_response", `${url.hostname} redirected a streamed body, which cannot be sent again`);
|
|
91
|
-
if (next.origin !== url.origin)
|
|
203
|
+
if (inScope ? !inScope(next) : next.origin !== url.origin)
|
|
92
204
|
for (const name of CREDENTIAL_HEADERS)
|
|
93
205
|
headers.delete(name);
|
|
94
206
|
url = next;
|
|
@@ -103,12 +215,15 @@ var hostFetch = /* @__PURE__ */ __name((options) => {
|
|
|
103
215
|
throw isCliError(caller.reason) ? caller.reason : new CliError("cancelled", "request cancelled");
|
|
104
216
|
if (timeout.signal.aborted)
|
|
105
217
|
throw new CliError("timeout", `${url.hostname} did not answer within ${timeoutMs} ms`, { retryable: true });
|
|
106
|
-
throw new CliError("network_error", `${url.hostname} could not be reached`, {
|
|
218
|
+
throw new CliError("network_error", `${url.hostname} could not be reached`, {
|
|
219
|
+
retryable: true,
|
|
220
|
+
...!answered && neverSent(error) ? { sent: false } : {}
|
|
221
|
+
});
|
|
107
222
|
}
|
|
108
223
|
};
|
|
109
224
|
}, "hostFetch");
|
|
110
225
|
|
|
111
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
226
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/index.js
|
|
112
227
|
var parseRetryAfter = /* @__PURE__ */ __name((header, now) => {
|
|
113
228
|
if (!header)
|
|
114
229
|
return void 0;
|
|
@@ -131,8 +246,25 @@ var parseRateLimitReset = /* @__PURE__ */ __name((header, now) => {
|
|
|
131
246
|
return delta > 0 ? delta : void 0;
|
|
132
247
|
}, "parseRateLimitReset");
|
|
133
248
|
var providerWaitMs = /* @__PURE__ */ __name((headers, now) => parseRetryAfter(headers.get("retry-after"), now) ?? parseRateLimitReset(headers.get("x-ratelimit-reset"), now), "providerWaitMs");
|
|
249
|
+
var statusToCode = /* @__PURE__ */ __name((status) => {
|
|
250
|
+
if (status === 400 || status === 422)
|
|
251
|
+
return "validation_error";
|
|
252
|
+
if (status === 401)
|
|
253
|
+
return "authentication_error";
|
|
254
|
+
if (status === 403)
|
|
255
|
+
return "permission_error";
|
|
256
|
+
if (status === 404)
|
|
257
|
+
return "not_found";
|
|
258
|
+
if (status === 408)
|
|
259
|
+
return "timeout";
|
|
260
|
+
if (status === 429)
|
|
261
|
+
return "rate_limited";
|
|
262
|
+
if (status === 502 || status === 503 || status === 504)
|
|
263
|
+
return "provider_unavailable";
|
|
264
|
+
return "provider_error";
|
|
265
|
+
}, "statusToCode");
|
|
134
266
|
|
|
135
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
267
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.713.0_@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typ_29dc9b659505b9f83a43774498347dd2/node_modules/@wirecat/cli-core/dist/models/endpoint.js
|
|
136
268
|
var endpoint = /* @__PURE__ */ __name((value) => {
|
|
137
269
|
try {
|
|
138
270
|
const url = new URL(value);
|
|
@@ -186,8 +318,10 @@ var endpointFetch = /* @__PURE__ */ __name((address, timeoutMs) => {
|
|
|
186
318
|
}, "endpointFetch");
|
|
187
319
|
|
|
188
320
|
export {
|
|
321
|
+
readJsonResponse,
|
|
189
322
|
hostFetch,
|
|
190
323
|
providerWaitMs,
|
|
324
|
+
statusToCode,
|
|
191
325
|
endpoint,
|
|
192
326
|
onThisComputer,
|
|
193
327
|
modelAddressAllowed,
|
|
@@ -5,21 +5,28 @@ import {
|
|
|
5
5
|
fieldsOf,
|
|
6
6
|
processStreams,
|
|
7
7
|
projectFields
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WZFGZBGD.js";
|
|
9
9
|
import {
|
|
10
10
|
COMPACT_FLAG
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-C3JSQ7UJ.js";
|
|
12
12
|
import {
|
|
13
13
|
CliError,
|
|
14
14
|
singleLine
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-PMGAU6AP.js";
|
|
16
16
|
import {
|
|
17
17
|
__name
|
|
18
18
|
} from "./chunk-ZVVMGPBJ.js";
|
|
19
19
|
|
|
20
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.713.0_@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typ_29dc9b659505b9f83a43774498347dd2/node_modules/@wirecat/cli-core/dist/sends/permissions.js
|
|
21
21
|
var LEVELS = ["deny", "readonly", "ask", "allow"];
|
|
22
|
-
var DANGEROUS = /* @__PURE__ */ new Set([
|
|
22
|
+
var DANGEROUS = /* @__PURE__ */ new Set([
|
|
23
|
+
"messages.delete",
|
|
24
|
+
"messages.scheduled.cancel",
|
|
25
|
+
"bot.messages.delete",
|
|
26
|
+
"topics.delete",
|
|
27
|
+
"chats.delete",
|
|
28
|
+
"chats.clear"
|
|
29
|
+
]);
|
|
23
30
|
var skipFlagFor = /* @__PURE__ */ __name((key) => DANGEROUS.has(key) ? "--allow-dangerous" : "--yes", "skipFlagFor");
|
|
24
31
|
var DEFAULT_PERMISSIONS = {
|
|
25
32
|
// Owner, 2026-11-14: deleting a message does not ask; a profile that wants the question sets `ask`.
|
|
@@ -240,6 +247,9 @@ var NAMED_WRITE_KEYS = [
|
|
|
240
247
|
"messages.sync-first",
|
|
241
248
|
"messages.server-search",
|
|
242
249
|
"messages.press",
|
|
250
|
+
"messages.scheduled.cancel",
|
|
251
|
+
"messages.scheduled.edit",
|
|
252
|
+
"messages.scheduled.send",
|
|
243
253
|
"chats.start",
|
|
244
254
|
"chats.app",
|
|
245
255
|
"stats.messages.counters.sync",
|
|
@@ -443,7 +453,7 @@ var assertRetentionEvidenceRead = /* @__PURE__ */ __name((permissions) => {
|
|
|
443
453
|
}
|
|
444
454
|
}, "assertRetentionEvidenceRead");
|
|
445
455
|
|
|
446
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
456
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.713.0_@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typ_29dc9b659505b9f83a43774498347dd2/node_modules/@wirecat/cli-core/dist/cli/result-fields.js
|
|
447
457
|
var named = /* @__PURE__ */ __name((work) => {
|
|
448
458
|
try {
|
|
449
459
|
return work();
|
|
@@ -470,7 +480,7 @@ var projectFields2 = /* @__PURE__ */ __name((value, fields) => named(() => {
|
|
|
470
480
|
return projectFields(value, fields);
|
|
471
481
|
}), "projectFields");
|
|
472
482
|
|
|
473
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
483
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.713.0_@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typ_29dc9b659505b9f83a43774498347dd2/node_modules/@wirecat/cli-core/dist/output-detail.js
|
|
474
484
|
var RARELY_SET = ["editedAt", "replyTo", "forwardedFrom", "reactions"];
|
|
475
485
|
var BRIEF = ["locator", "chatTitle", "timestamp", "senderName", "excerpt", "score"];
|
|
476
486
|
var SNAKE_BRIEF = ["ref", "chat_title", "timestamp", "sender_name", "excerpt", "score"];
|
|
@@ -506,7 +516,7 @@ var atDetail = /* @__PURE__ */ __name((value, detail = "default") => {
|
|
|
506
516
|
return value;
|
|
507
517
|
}, "atDetail");
|
|
508
518
|
|
|
509
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
519
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.713.0_@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typ_29dc9b659505b9f83a43774498347dd2/node_modules/@wirecat/cli-core/dist/output.js
|
|
510
520
|
var refuseCompact = /* @__PURE__ */ __name(({ json, jsonl, fields, hitDetail }) => {
|
|
511
521
|
const other = jsonl ? "--jsonl" : fields !== void 0 ? "--json=\u2026" : json ? "--json" : hitDetail === "brief" ? "--brief" : "";
|
|
512
522
|
if (other)
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
} from "./chunk-Y5E2WNWB.js";
|
|
6
6
|
import {
|
|
7
7
|
CliError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-PMGAU6AP.js";
|
|
9
9
|
import {
|
|
10
10
|
__name
|
|
11
11
|
} from "./chunk-ZVVMGPBJ.js";
|
|
12
12
|
|
|
13
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.713.0_@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typ_29dc9b659505b9f83a43774498347dd2/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
14
14
|
import { createRequire } from "node:module";
|
|
15
15
|
|
|
16
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.713.0_@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typ_29dc9b659505b9f83a43774498347dd2/node_modules/@wirecat/cli-core/dist/speech/ogg-limit.js
|
|
17
17
|
var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "local transcription needs a complete mono or stereo Ogg Opus recording"), "invalid");
|
|
18
18
|
var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
|
|
19
19
|
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
@@ -70,7 +70,7 @@ var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
|
|
|
70
70
|
throw invalid();
|
|
71
71
|
}, "checkOggDuration");
|
|
72
72
|
|
|
73
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
73
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.713.0_@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typ_29dc9b659505b9f83a43774498347dd2/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
74
74
|
var SAMPLE_RATE = 16e3;
|
|
75
75
|
var LEAD = SAMPLE_RATE / 2;
|
|
76
76
|
var toModelRate = /* @__PURE__ */ __name((samples, rate) => {
|