@wirecat/mail-cli 0.0.0-stage → 0.1.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 +50 -0
- package/LICENSE +204 -0
- package/README.md +141 -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-5BVIWP3S.js +71 -0
- package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
- package/dist/bundle/chunk-5NYMNSSO.js +264 -0
- package/dist/bundle/chunk-5WGEUDE4.js +27 -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-X36THCOF.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-ILID6EAT.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/doctor.d.ts +77 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +74 -0
- package/dist/commands/doctor.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/mcp.d.ts +3 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +97 -0
- package/dist/commands/mcp.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/setup.d.ts +3 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +156 -0
- package/dist/commands/setup.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/mail/parse.d.ts +18 -0
- package/dist/mail/parse.d.ts.map +1 -0
- package/dist/mail/parse.js +31 -0
- package/dist/mail/parse.js.map +1 -0
- package/dist/mail/port.d.ts +50 -0
- package/dist/mail/port.d.ts.map +1 -0
- package/dist/mail/port.js +4 -0
- package/dist/mail/port.js.map +1 -0
- package/dist/mcp.d.ts +29 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +98 -0
- package/dist/mcp.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/sync.d.ts +26 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +75 -0
- package/dist/sync.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,122 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
unit
|
|
5
|
+
} from "./chunk-Z34ICZA3.js";
|
|
6
|
+
import {
|
|
7
|
+
CliError
|
|
8
|
+
} from "./chunk-5BVIWP3S.js";
|
|
9
|
+
import {
|
|
10
|
+
__name
|
|
11
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
+
|
|
13
|
+
// 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/embeddings/remote.js
|
|
14
|
+
import { setTimeout } from "node:timers/promises";
|
|
15
|
+
var OPENAI_URL = "https://api.openai.com/v1";
|
|
16
|
+
var OPENAI_MODELS = {
|
|
17
|
+
"text-embedding-3-small": { dims: 1536, perMillion: 0.02 },
|
|
18
|
+
"text-embedding-3-large": { dims: 3072, perMillion: 0.13 }
|
|
19
|
+
};
|
|
20
|
+
var DEFAULT_OPENAI_MODEL = "text-embedding-3-small";
|
|
21
|
+
var PER_REQUEST = 256;
|
|
22
|
+
var LOCAL = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]", "::1"]);
|
|
23
|
+
var isLocal = /* @__PURE__ */ __name((baseUrl) => LOCAL.has(new URL(baseUrl).hostname), "isLocal");
|
|
24
|
+
var remoteModel = /* @__PURE__ */ __name(({ model = DEFAULT_OPENAI_MODEL, baseUrl, dims }) => {
|
|
25
|
+
const known = baseUrl === void 0 ? OPENAI_MODELS[model] : void 0;
|
|
26
|
+
if (baseUrl === void 0 && !known) {
|
|
27
|
+
throw new CliError("validation_error", `OpenAI has no embedding model ${model} here \u2014 one of: ${Object.keys(OPENAI_MODELS).join(", ")}; another server takes --base-url`);
|
|
28
|
+
}
|
|
29
|
+
const size = dims ?? known?.dims;
|
|
30
|
+
if (size === void 0)
|
|
31
|
+
throw new CliError("validation_error", "with --base-url, say the vector size with --dims");
|
|
32
|
+
return {
|
|
33
|
+
provider: baseUrl === void 0 ? "openai" : `url:${new URL(baseUrl).host}`,
|
|
34
|
+
model,
|
|
35
|
+
dims: size,
|
|
36
|
+
baseUrl: baseUrl ?? OPENAI_URL,
|
|
37
|
+
shorten: known !== void 0 && size !== known.dims,
|
|
38
|
+
...known ? { price: { perMillion: known.perMillion, read: "2026-10-02" } } : {}
|
|
39
|
+
};
|
|
40
|
+
}, "remoteModel");
|
|
41
|
+
var remoteKey = /* @__PURE__ */ __name(({ provider, model, dims }) => `${provider}:${model}:${dims}`, "remoteKey");
|
|
42
|
+
var openRemote = /* @__PURE__ */ __name((remote, apiKey, { concurrency = 4, fetch: post = fetch, tries = 5 } = {}) => {
|
|
43
|
+
const request = /* @__PURE__ */ __name(async (input) => {
|
|
44
|
+
for (let attempt = 1; ; attempt++) {
|
|
45
|
+
let response;
|
|
46
|
+
try {
|
|
47
|
+
response = await post(`${remote.baseUrl.replace(/\/$/, "")}/embeddings`, {
|
|
48
|
+
method: "POST",
|
|
49
|
+
headers: {
|
|
50
|
+
"content-type": "application/json",
|
|
51
|
+
...apiKey ? { authorization: `Bearer ${apiKey}` } : {}
|
|
52
|
+
},
|
|
53
|
+
body: JSON.stringify({
|
|
54
|
+
model: remote.model,
|
|
55
|
+
input,
|
|
56
|
+
encoding_format: "float",
|
|
57
|
+
...remote.shorten ? { dimensions: remote.dims } : {}
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
} catch {
|
|
61
|
+
if (attempt >= tries)
|
|
62
|
+
throw new CliError("network_error", `${remote.provider} could not be reached`);
|
|
63
|
+
await setTimeout(1e3 * attempt);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (response.ok) {
|
|
67
|
+
const body = await response.json();
|
|
68
|
+
const data = [...body.data ?? []].sort((a, b) => a.index - b.index);
|
|
69
|
+
if (data.length !== input.length || data.some(({ embedding }) => embedding.length !== remote.dims)) {
|
|
70
|
+
throw new CliError("invalid_response", `${remote.provider} answered with vectors of another number or size than ${input.length} \xD7 ${remote.dims}`);
|
|
71
|
+
}
|
|
72
|
+
return data.map(({ embedding }) => unit(Float32Array.from(embedding)));
|
|
73
|
+
}
|
|
74
|
+
const code = await errorCode(response);
|
|
75
|
+
if (response.status === 401 || response.status === 403) {
|
|
76
|
+
throw new CliError("authentication_error", `${remote.provider} refused the key (HTTP ${response.status}${code}) \u2014 set it again with \`models keys set\``);
|
|
77
|
+
}
|
|
78
|
+
const again = response.status === 429 || response.status >= 500;
|
|
79
|
+
if (!again || attempt >= tries) {
|
|
80
|
+
throw new CliError(response.status === 429 ? "rate_limited" : "provider_error", `${remote.provider} answered HTTP ${response.status}${code}`);
|
|
81
|
+
}
|
|
82
|
+
const wait = Number(response.headers.get("retry-after"));
|
|
83
|
+
await setTimeout(Number.isFinite(wait) && wait > 0 ? wait * 1e3 : 1e3 * 2 ** attempt);
|
|
84
|
+
}
|
|
85
|
+
}, "request");
|
|
86
|
+
return {
|
|
87
|
+
model: { id: remote.model, dims: remote.dims },
|
|
88
|
+
embed: /* @__PURE__ */ __name(async (texts) => {
|
|
89
|
+
const parts = [];
|
|
90
|
+
for (let start = 0; start < texts.length; start += PER_REQUEST)
|
|
91
|
+
parts.push(texts.slice(start, start + PER_REQUEST));
|
|
92
|
+
const results = new Array(parts.length);
|
|
93
|
+
let next = 0;
|
|
94
|
+
await Promise.all(Array.from({ length: Math.min(concurrency, parts.length) }, async () => {
|
|
95
|
+
for (let index = next++; index < parts.length; index = next++)
|
|
96
|
+
results[index] = await request(parts[index]);
|
|
97
|
+
}));
|
|
98
|
+
return results.flat();
|
|
99
|
+
}, "embed"),
|
|
100
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
101
|
+
}, "close")
|
|
102
|
+
};
|
|
103
|
+
}, "openRemote");
|
|
104
|
+
var errorCode = /* @__PURE__ */ __name(async (response) => {
|
|
105
|
+
try {
|
|
106
|
+
const body = await response.json();
|
|
107
|
+
const code = body.error?.code ?? body.error?.type;
|
|
108
|
+
return typeof code === "string" && /^[\w.-]{1,64}$/.test(code) ? `, ${code}` : "";
|
|
109
|
+
} catch {
|
|
110
|
+
return "";
|
|
111
|
+
}
|
|
112
|
+
}, "errorCode");
|
|
113
|
+
|
|
114
|
+
export {
|
|
115
|
+
OPENAI_URL,
|
|
116
|
+
OPENAI_MODELS,
|
|
117
|
+
DEFAULT_OPENAI_MODEL,
|
|
118
|
+
isLocal,
|
|
119
|
+
remoteModel,
|
|
120
|
+
remoteKey,
|
|
121
|
+
openRemote
|
|
122
|
+
};
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CliError,
|
|
5
|
+
singleLine
|
|
6
|
+
} from "./chunk-5BVIWP3S.js";
|
|
7
|
+
import {
|
|
8
|
+
__name
|
|
9
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
10
|
+
|
|
11
|
+
// 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/domain/locator.js
|
|
12
|
+
var SCHEME = "msg:";
|
|
13
|
+
var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat, message }) => SCHEME + [provider, account, chat, message].map(encodeURIComponent).join("/"), "formatLocator");
|
|
14
|
+
var isLocator = /* @__PURE__ */ __name((reference) => reference.trim().startsWith(SCHEME), "isLocator");
|
|
15
|
+
var parseLocator = /* @__PURE__ */ __name((reference) => {
|
|
16
|
+
const trimmed = reference.trim();
|
|
17
|
+
const parts2 = trimmed.startsWith(SCHEME) ? trimmed.slice(SCHEME.length).split("/") : [];
|
|
18
|
+
if (parts2.length !== 4 || parts2.some((part) => part === "")) {
|
|
19
|
+
throw new CliError("validation_error", `"${singleLine(reference)}" is not a message locator \u2014 expected msg:<provider>/<account>/<chat>/<message>`);
|
|
20
|
+
}
|
|
21
|
+
const [provider, account, chat, message] = parts2.map(decodeURIComponent);
|
|
22
|
+
return { provider, account, chat, message };
|
|
23
|
+
}, "parseLocator");
|
|
24
|
+
|
|
25
|
+
// 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/domain/references.js
|
|
26
|
+
var SIMPLE_REFERENCES = [
|
|
27
|
+
"note",
|
|
28
|
+
"document",
|
|
29
|
+
"person",
|
|
30
|
+
"organization",
|
|
31
|
+
"project",
|
|
32
|
+
"task",
|
|
33
|
+
"memory",
|
|
34
|
+
"fact",
|
|
35
|
+
"bot",
|
|
36
|
+
"entity"
|
|
37
|
+
];
|
|
38
|
+
var parts = /* @__PURE__ */ __name((rest, count, reference, shape) => {
|
|
39
|
+
const split = rest.split("/");
|
|
40
|
+
if (split.length !== count || split.some((part) => part === ""))
|
|
41
|
+
throw new CliError("validation_error", `"${singleLine(reference)}" is not a reference \u2014 expected ${shape}`);
|
|
42
|
+
return split.map(decodeURIComponent);
|
|
43
|
+
}, "parts");
|
|
44
|
+
var formatReference = /* @__PURE__ */ __name((reference) => {
|
|
45
|
+
switch (reference.type) {
|
|
46
|
+
case "message":
|
|
47
|
+
return formatLocator(reference);
|
|
48
|
+
case "chat":
|
|
49
|
+
return `chat:${[reference.provider, reference.account, reference.chat].map(encodeURIComponent).join("/")}`;
|
|
50
|
+
case "contact":
|
|
51
|
+
return `contact:${[reference.provider, reference.id].map(encodeURIComponent).join("/")}`;
|
|
52
|
+
case "folder":
|
|
53
|
+
return reference.path === null ? `folder:${encodeURIComponent(reference.id)}` : `folder:${encodeURIComponent(reference.id)}/${encodeURIComponent(reference.path)}`;
|
|
54
|
+
default:
|
|
55
|
+
return `${reference.type}:${reference.id}`;
|
|
56
|
+
}
|
|
57
|
+
}, "formatReference");
|
|
58
|
+
var parseReference = /* @__PURE__ */ __name((text) => {
|
|
59
|
+
const reference = text.trim();
|
|
60
|
+
const colon = reference.indexOf(":");
|
|
61
|
+
const prefix = colon < 0 ? "" : reference.slice(0, colon);
|
|
62
|
+
const rest = reference.slice(colon + 1);
|
|
63
|
+
switch (prefix) {
|
|
64
|
+
case "msg":
|
|
65
|
+
return { type: "message", ...parseLocator(reference) };
|
|
66
|
+
case "chat": {
|
|
67
|
+
const [provider, account, chat] = parts(rest, 3, reference, "chat:<provider>/<account>/<chat>");
|
|
68
|
+
return { type: "chat", provider, account, chat };
|
|
69
|
+
}
|
|
70
|
+
case "contact": {
|
|
71
|
+
const [provider, id] = parts(rest, 2, reference, "contact:<provider>/<id>");
|
|
72
|
+
return { type: "contact", provider, id };
|
|
73
|
+
}
|
|
74
|
+
case "folder": {
|
|
75
|
+
const slash = rest.indexOf("/");
|
|
76
|
+
const id = decodeURIComponent(slash < 0 ? rest : rest.slice(0, slash));
|
|
77
|
+
const path = slash < 0 ? null : folderPath(decodeURIComponent(rest.slice(slash + 1)));
|
|
78
|
+
if (!id.trim() || path === "")
|
|
79
|
+
throw new CliError("validation_error", `"${singleLine(reference)}" is not a reference \u2014 expected folder:<id>[/<path>]`);
|
|
80
|
+
return { type: "folder", id, path };
|
|
81
|
+
}
|
|
82
|
+
default:
|
|
83
|
+
if (SIMPLE_REFERENCES.includes(prefix)) {
|
|
84
|
+
if (!rest.trim())
|
|
85
|
+
throw new CliError("validation_error", `"${singleLine(reference)}" names no ${prefix}`);
|
|
86
|
+
return { type: prefix, id: rest };
|
|
87
|
+
}
|
|
88
|
+
throw new CliError("validation_error", `"${singleLine(reference)}" is not a reference \u2014 expected msg:, chat:, contact:, folder:, ${SIMPLE_REFERENCES.filter((one) => one !== "entity").join(":, ")}:`);
|
|
89
|
+
}
|
|
90
|
+
}, "parseReference");
|
|
91
|
+
var folderPath = /* @__PURE__ */ __name((path) => {
|
|
92
|
+
const clean = path.split("/").filter((part) => part !== "" && part !== ".").join("/");
|
|
93
|
+
return clean === "" ? path.trim() === "" ? "" : null : clean;
|
|
94
|
+
}, "folderPath");
|
|
95
|
+
var canonicalReference = /* @__PURE__ */ __name((text) => formatReference(parseReference(text)), "canonicalReference");
|
|
96
|
+
|
|
97
|
+
// 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/domain/providers.js
|
|
98
|
+
var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events"];
|
|
99
|
+
var PROVIDERS = [
|
|
100
|
+
{ name: "telegram", kind: "messages", aliases: ["tg"] },
|
|
101
|
+
{ name: "telegram-bot", kind: "messages", aliases: ["tg-bot"] },
|
|
102
|
+
{ name: "max", kind: "messages", aliases: [] },
|
|
103
|
+
{ name: "max-bot", kind: "messages", aliases: [] },
|
|
104
|
+
{ name: "whatsapp", kind: "messages", aliases: ["wa"] },
|
|
105
|
+
{ name: "whatsapp-bot", kind: "messages", aliases: ["wa-bot"] },
|
|
106
|
+
{ name: "email", kind: "mail", aliases: [] },
|
|
107
|
+
{ name: "notes", kind: "notes", aliases: [] },
|
|
108
|
+
{ name: "local", kind: "notes", aliases: [] },
|
|
109
|
+
{ name: "obsidian", kind: "notes", aliases: [] },
|
|
110
|
+
{ name: "zoom", kind: "meetings", aliases: [] }
|
|
111
|
+
];
|
|
112
|
+
var FOLDER_PROVIDERS = ["local", "obsidian", "folder"];
|
|
113
|
+
var isFolderProvider = /* @__PURE__ */ __name((provider) => FOLDER_PROVIDERS.includes(provider), "isFolderProvider");
|
|
114
|
+
var folderProviderSql = /* @__PURE__ */ __name((column = "provider") => `${column} IN (${FOLDER_PROVIDERS.map((name) => `'${name}'`).join(", ")})`, "folderProviderSql");
|
|
115
|
+
var folderProviderOf = /* @__PURE__ */ __name((format) => format === "markdown" ? "local" : "obsidian", "folderProviderOf");
|
|
116
|
+
var DOCUMENT_ACCOUNT_PROVIDERS = ["google-drive"];
|
|
117
|
+
var isDocumentAccountProvider = /* @__PURE__ */ __name((provider) => DOCUMENT_ACCOUNT_PROVIDERS.includes(provider), "isDocumentAccountProvider");
|
|
118
|
+
var filesAccountSql = /* @__PURE__ */ __name((column = "provider") => `${column} IN (${[...FOLDER_PROVIDERS, ...DOCUMENT_ACCOUNT_PROVIDERS].map((name) => `'${name}'`).join(", ")})`, "filesAccountSql");
|
|
119
|
+
var INTERNAL_NOTES = "internal";
|
|
120
|
+
var UNKNOWN_PROVIDER = "unknown provider \u2014 run its CLI once";
|
|
121
|
+
var WORD = /^[a-z0-9][a-z0-9_-]*$/;
|
|
122
|
+
var invalid = /* @__PURE__ */ __name((message) => {
|
|
123
|
+
throw new CliError("validation_error", message);
|
|
124
|
+
}, "invalid");
|
|
125
|
+
var wordOf = /* @__PURE__ */ __name((value, what) => typeof value === "string" && WORD.test(value) ? value : invalid(`${what} is lowercase letters, digits, - and _ \u2014 not ${JSON.stringify(value)}`), "wordOf");
|
|
126
|
+
var providerEntryOf = /* @__PURE__ */ __name((value) => {
|
|
127
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
128
|
+
return invalid("a provider entry is an object");
|
|
129
|
+
const { name, kind, aliases = [], command } = value;
|
|
130
|
+
const named = wordOf(name, "a provider's name");
|
|
131
|
+
if (typeof kind !== "string" || !KINDS.includes(kind))
|
|
132
|
+
invalid(`provider ${named}'s kind is one of ${KINDS.join(", ")} \u2014 not ${JSON.stringify(kind)}`);
|
|
133
|
+
if (!Array.isArray(aliases))
|
|
134
|
+
invalid(`provider ${named}'s aliases are a list`);
|
|
135
|
+
return {
|
|
136
|
+
name: named,
|
|
137
|
+
kind,
|
|
138
|
+
aliases: [...new Set(aliases.map((alias) => wordOf(alias, `an alias of ${named}`)))],
|
|
139
|
+
...command === void 0 ? {} : { command: wordOf(command, `the command of ${named}`) }
|
|
140
|
+
};
|
|
141
|
+
}, "providerEntryOf");
|
|
142
|
+
var describe = /* @__PURE__ */ __name(({ name, kind, command }) => `${name} (${kind}${command ? `, from ${command}` : ""})`, "describe");
|
|
143
|
+
var wordsOf = /* @__PURE__ */ __name(({ name, aliases }) => [name, ...aliases], "wordsOf");
|
|
144
|
+
var joined = /* @__PURE__ */ __name((known, entry) => {
|
|
145
|
+
const same = known.find(({ name }) => name === entry.name);
|
|
146
|
+
if (same && same.kind !== entry.kind)
|
|
147
|
+
invalid(`two provider entries disagree on the kind: ${describe(same)} and ${describe(entry)}`);
|
|
148
|
+
const merged = same ? {
|
|
149
|
+
...same,
|
|
150
|
+
aliases: [.../* @__PURE__ */ new Set([...same.aliases, ...entry.aliases])],
|
|
151
|
+
...entry.command ? { command: entry.command } : {}
|
|
152
|
+
} : entry;
|
|
153
|
+
const others = known.filter((one) => one !== same);
|
|
154
|
+
for (const word of wordsOf(merged)) {
|
|
155
|
+
const owner = others.find((one) => wordsOf(one).includes(word));
|
|
156
|
+
if (owner)
|
|
157
|
+
invalid(`"${word}" names two providers: ${describe(owner)} and ${describe(merged)}`);
|
|
158
|
+
}
|
|
159
|
+
return same ? known.map((one) => one === same ? merged : one) : [...known, merged];
|
|
160
|
+
}, "joined");
|
|
161
|
+
var registry = PROVIDERS;
|
|
162
|
+
var providers = /* @__PURE__ */ __name(() => registry, "providers");
|
|
163
|
+
var useProviders = /* @__PURE__ */ __name((entries) => {
|
|
164
|
+
registry = entries.map(providerEntryOf).reduce(joined, PROVIDERS);
|
|
165
|
+
}, "useProviders");
|
|
166
|
+
var useStoredProviders = /* @__PURE__ */ __name((entries) => {
|
|
167
|
+
const left = [];
|
|
168
|
+
registry = entries.reduce((known, entry) => {
|
|
169
|
+
try {
|
|
170
|
+
return joined(known, providerEntryOf(entry));
|
|
171
|
+
} catch (error) {
|
|
172
|
+
if (!(error instanceof CliError))
|
|
173
|
+
throw error;
|
|
174
|
+
left.push(entry);
|
|
175
|
+
return known;
|
|
176
|
+
}
|
|
177
|
+
}, PROVIDERS);
|
|
178
|
+
return left;
|
|
179
|
+
}, "useStoredProviders");
|
|
180
|
+
var addProvider = /* @__PURE__ */ __name((entry) => {
|
|
181
|
+
registry = joined(registry, providerEntryOf(entry));
|
|
182
|
+
}, "addProvider");
|
|
183
|
+
var isKind = /* @__PURE__ */ __name((word) => KINDS.includes(word.toLowerCase()), "isKind");
|
|
184
|
+
var providerNamed = /* @__PURE__ */ __name((word) => {
|
|
185
|
+
const wanted = word.toLowerCase();
|
|
186
|
+
return registry.find((entry) => wordsOf(entry).includes(wanted));
|
|
187
|
+
}, "providerNamed");
|
|
188
|
+
var kindIn = /* @__PURE__ */ __name((provider) => isFolderProvider(provider) ? "notes" : registry.find(({ name }) => name === provider)?.kind, "kindIn");
|
|
189
|
+
var kindOf = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
|
|
190
|
+
|
|
191
|
+
// 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/domain/counters.js
|
|
192
|
+
var COUNTER_FIELDS = ["views", "reactions", "comments"];
|
|
193
|
+
var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
|
|
194
|
+
var counterValue = /* @__PURE__ */ __name((message, field) => {
|
|
195
|
+
const value = field === "reactions" ? message.reactions?.total : message.providerMetadata?.[field];
|
|
196
|
+
return validCounter(value) ? value : null;
|
|
197
|
+
}, "counterValue");
|
|
198
|
+
var counterObservationTime = /* @__PURE__ */ __name((observation, now) => {
|
|
199
|
+
const at = Date.parse(observation.observedAt);
|
|
200
|
+
if (!validCounter(observation.value) || !Number.isSafeInteger(at) || at < 0 || at > now || !["remote_fetch", "remote_update"].includes(observation.source))
|
|
201
|
+
throw new CliError("validation_error", "counter observation needs a valid value, source and nonfuture observation time");
|
|
202
|
+
if (observation.reactions && (!validCounter(observation.reactions.total) || observation.reactions.total !== observation.value))
|
|
203
|
+
throw new CliError("validation_error", "reaction observation payload and total disagree");
|
|
204
|
+
return at;
|
|
205
|
+
}, "counterObservationTime");
|
|
206
|
+
var observedCounters = /* @__PURE__ */ __name((message, observedAt, fields, source = "remote_fetch") => {
|
|
207
|
+
const observations = {};
|
|
208
|
+
for (const field of fields) {
|
|
209
|
+
const value = counterValue(message, field);
|
|
210
|
+
if (value !== null)
|
|
211
|
+
observations[field] = {
|
|
212
|
+
value,
|
|
213
|
+
observedAt,
|
|
214
|
+
source,
|
|
215
|
+
...field === "reactions" && message.reactions ? { reactions: message.reactions } : {}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
return { ...message, counterObservations: observations };
|
|
219
|
+
}, "observedCounters");
|
|
220
|
+
var counterFreshness = /* @__PURE__ */ __name((states) => {
|
|
221
|
+
if (!states.length || states.every((one) => one.freshness === "unknown"))
|
|
222
|
+
return "unknown";
|
|
223
|
+
if (states.some((one) => one.freshness === "unknown"))
|
|
224
|
+
return "partial";
|
|
225
|
+
return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
|
|
226
|
+
}, "counterFreshness");
|
|
227
|
+
|
|
228
|
+
// 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/domain/rankings-options.js
|
|
229
|
+
var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
|
|
230
|
+
var AUTHOR_MEASURES = [
|
|
231
|
+
"messages",
|
|
232
|
+
"words",
|
|
233
|
+
"reactions",
|
|
234
|
+
"replies",
|
|
235
|
+
"answers",
|
|
236
|
+
"answer-time",
|
|
237
|
+
"threads",
|
|
238
|
+
"active-days"
|
|
239
|
+
];
|
|
240
|
+
var CONTEXT = /* @__PURE__ */ new Set([
|
|
241
|
+
"replies",
|
|
242
|
+
"replies-from-others",
|
|
243
|
+
"replies-from-others-per-message",
|
|
244
|
+
"thread-size",
|
|
245
|
+
"threads",
|
|
246
|
+
"answers",
|
|
247
|
+
"answer-time"
|
|
248
|
+
]);
|
|
249
|
+
var needsRankingContext = /* @__PURE__ */ __name((options) => options.components.some((name) => CONTEXT.has(name)), "needsRankingContext");
|
|
250
|
+
var presets = {
|
|
251
|
+
helpful: { answers: 0.5, "replies-from-others": 0.25, reactions: 0.25 },
|
|
252
|
+
active: { "active-days": 0.6, messages: 0.4 },
|
|
253
|
+
engaging: { "reactions-per-message": 0.5, "replies-from-others-per-message": 0.5 }
|
|
254
|
+
};
|
|
255
|
+
function invalid2(message) {
|
|
256
|
+
throw new CliError("validation_error", message, { reason: "ranking.invalid" });
|
|
257
|
+
}
|
|
258
|
+
__name(invalid2, "invalid");
|
|
259
|
+
var rankingOptions = /* @__PURE__ */ __name((target, input) => {
|
|
260
|
+
const measures = target === "messages" ? MESSAGE_MEASURES : AUTHOR_MEASURES;
|
|
261
|
+
const { measure, score, weights: given, minMessages } = input;
|
|
262
|
+
const messageKind = input.messageKind ?? "all";
|
|
263
|
+
if (!["all", "posts", "comments"].includes(messageKind))
|
|
264
|
+
invalid2("message_kind takes all, posts or comments");
|
|
265
|
+
if (target === "messages" && minMessages !== void 0)
|
|
266
|
+
invalid2("min_messages applies to stats contacts top");
|
|
267
|
+
if (minMessages !== void 0 && (!Number.isSafeInteger(minMessages) || minMessages < 1))
|
|
268
|
+
invalid2("min_messages takes a positive integer");
|
|
269
|
+
if (measure !== void 0 && !measures.includes(measure))
|
|
270
|
+
invalid2(`--measure takes ${measures.join(", ")}`);
|
|
271
|
+
if (measure !== void 0 && (score !== void 0 || given !== void 0))
|
|
272
|
+
invalid2("--measure cannot be combined with --score or --weights");
|
|
273
|
+
if (score !== void 0 && !["helpful", "active", "engaging"].includes(score))
|
|
274
|
+
invalid2("--score takes helpful, active or engaging");
|
|
275
|
+
if (target === "messages" && score !== void 0 && score !== "engaging")
|
|
276
|
+
invalid2("helpful and active scores apply to authors only");
|
|
277
|
+
const scoring = score !== void 0 || given !== void 0;
|
|
278
|
+
const preset = score;
|
|
279
|
+
let weights = null;
|
|
280
|
+
if (scoring) {
|
|
281
|
+
let raw = given !== void 0 ? given : target === "messages" ? { reactions: 0.5, "replies-from-others": 0.5 } : presets[preset];
|
|
282
|
+
if (typeof raw === "string") {
|
|
283
|
+
try {
|
|
284
|
+
raw = JSON.parse(raw);
|
|
285
|
+
} catch {
|
|
286
|
+
invalid2("--weights takes a JSON object of component weights");
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
290
|
+
invalid2("--weights takes a JSON object of component weights");
|
|
291
|
+
const allowed = target === "messages" ? [...MESSAGE_MEASURES, "replies-from-others"] : [
|
|
292
|
+
...AUTHOR_MEASURES.filter((name) => name !== "answer-time"),
|
|
293
|
+
"replies-from-others",
|
|
294
|
+
"reactions-per-message",
|
|
295
|
+
"replies-from-others-per-message"
|
|
296
|
+
];
|
|
297
|
+
const entries = Object.entries(raw);
|
|
298
|
+
for (const [name, weight] of entries) {
|
|
299
|
+
if (!allowed.includes(name))
|
|
300
|
+
invalid2(`unknown ${target} score component: ${name}`);
|
|
301
|
+
if (typeof weight !== "number" || !Number.isFinite(weight) || weight < 0)
|
|
302
|
+
invalid2(`weight for ${name} must be a finite nonnegative number`);
|
|
303
|
+
}
|
|
304
|
+
if (!entries.some(([, weight]) => weight > 0))
|
|
305
|
+
invalid2("--weights needs at least one positive weight");
|
|
306
|
+
weights = Object.fromEntries(entries);
|
|
307
|
+
}
|
|
308
|
+
const selected = measure ?? (target === "messages" ? "reactions" : "messages");
|
|
309
|
+
return {
|
|
310
|
+
target,
|
|
311
|
+
messageKind,
|
|
312
|
+
minMessages: minMessages ?? (target === "contacts" && score === "engaging" ? 5 : 1),
|
|
313
|
+
measure: scoring ? "score" : selected,
|
|
314
|
+
order: !scoring && selected === "answer-time" ? "ascending" : "descending",
|
|
315
|
+
weights,
|
|
316
|
+
preset: scoring ? preset ?? "custom" : null,
|
|
317
|
+
components: weights === null ? [selected] : Object.entries(weights).filter(([, weight]) => weight > 0).map(([name]) => name)
|
|
318
|
+
};
|
|
319
|
+
}, "rankingOptions");
|
|
320
|
+
var rankingScore = /* @__PURE__ */ __name((raw, maxima, weights) => {
|
|
321
|
+
const entries = Object.entries(weights).filter(([, weight]) => weight > 0);
|
|
322
|
+
const scale = Math.max(...entries.map(([, weight]) => weight));
|
|
323
|
+
const denominator = entries.reduce((sum2, [, weight]) => sum2 + weight / scale, 0);
|
|
324
|
+
if (!Number.isFinite(scale) || scale <= 0 || !Number.isFinite(denominator) || denominator <= 0)
|
|
325
|
+
return null;
|
|
326
|
+
const normalized = {};
|
|
327
|
+
const contributions = {};
|
|
328
|
+
let sum = 0;
|
|
329
|
+
for (const [name, weight] of entries) {
|
|
330
|
+
const value = raw[name];
|
|
331
|
+
const maximum = maxima[name];
|
|
332
|
+
if (value == null || !Number.isFinite(value) || value < 0 || maximum === void 0 || !Number.isFinite(maximum) || maximum < value)
|
|
333
|
+
return null;
|
|
334
|
+
const part = maximum === 0 ? 0 : value / maximum;
|
|
335
|
+
normalized[name] = part;
|
|
336
|
+
contributions[name] = 100 * part * (weight / scale) / denominator;
|
|
337
|
+
sum += contributions[name];
|
|
338
|
+
}
|
|
339
|
+
return { score: Math.min(100, sum), normalized, contributions };
|
|
340
|
+
}, "rankingScore");
|
|
341
|
+
var RANKING_TOKENIZER_VERSION = 1;
|
|
342
|
+
var withoutUrls = /* @__PURE__ */ __name((text) => text.replace(/\S+/gu, (token) => {
|
|
343
|
+
for (let offset = 0; ; ) {
|
|
344
|
+
const marker = token.indexOf("://", offset);
|
|
345
|
+
if (marker < 0)
|
|
346
|
+
break;
|
|
347
|
+
let start = marker;
|
|
348
|
+
while (start > 0 && /[a-z0-9+.-]/iu.test(token[start - 1]))
|
|
349
|
+
start--;
|
|
350
|
+
if (/^[a-z][a-z0-9+.-]*$/iu.test(token.slice(start, marker)) && (start === 0 || !/\w/u.test(token[start - 1])))
|
|
351
|
+
return token.slice(0, start);
|
|
352
|
+
offset = marker + 3;
|
|
353
|
+
}
|
|
354
|
+
const folded = token.toLowerCase();
|
|
355
|
+
for (let offset = 0; ; ) {
|
|
356
|
+
const start = folded.indexOf("www.", offset);
|
|
357
|
+
if (start < 0)
|
|
358
|
+
break;
|
|
359
|
+
if (start === 0 || !/\w/u.test(token[start - 1]))
|
|
360
|
+
return token.slice(0, start);
|
|
361
|
+
offset = start + 4;
|
|
362
|
+
}
|
|
363
|
+
return token;
|
|
364
|
+
}), "withoutUrls");
|
|
365
|
+
var rankingWords = /* @__PURE__ */ __name((text) => withoutUrls(text).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
|
|
366
|
+
var rankingQuestion = /* @__PURE__ */ __name((text) => withoutUrls(text).includes("?"), "rankingQuestion");
|
|
367
|
+
|
|
368
|
+
export {
|
|
369
|
+
formatLocator,
|
|
370
|
+
isLocator,
|
|
371
|
+
parseLocator,
|
|
372
|
+
formatReference,
|
|
373
|
+
parseReference,
|
|
374
|
+
canonicalReference,
|
|
375
|
+
KINDS,
|
|
376
|
+
PROVIDERS,
|
|
377
|
+
FOLDER_PROVIDERS,
|
|
378
|
+
isFolderProvider,
|
|
379
|
+
folderProviderSql,
|
|
380
|
+
folderProviderOf,
|
|
381
|
+
DOCUMENT_ACCOUNT_PROVIDERS,
|
|
382
|
+
isDocumentAccountProvider,
|
|
383
|
+
filesAccountSql,
|
|
384
|
+
INTERNAL_NOTES,
|
|
385
|
+
UNKNOWN_PROVIDER,
|
|
386
|
+
providerEntryOf,
|
|
387
|
+
providers,
|
|
388
|
+
useProviders,
|
|
389
|
+
useStoredProviders,
|
|
390
|
+
addProvider,
|
|
391
|
+
isKind,
|
|
392
|
+
providerNamed,
|
|
393
|
+
kindIn,
|
|
394
|
+
kindOf,
|
|
395
|
+
COUNTER_FIELDS,
|
|
396
|
+
validCounter,
|
|
397
|
+
counterValue,
|
|
398
|
+
counterObservationTime,
|
|
399
|
+
observedCounters,
|
|
400
|
+
counterFreshness,
|
|
401
|
+
MESSAGE_MEASURES,
|
|
402
|
+
AUTHOR_MEASURES,
|
|
403
|
+
needsRankingContext,
|
|
404
|
+
rankingOptions,
|
|
405
|
+
rankingScore,
|
|
406
|
+
RANKING_TOKENIZER_VERSION,
|
|
407
|
+
rankingWords,
|
|
408
|
+
rankingQuestion
|
|
409
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
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-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/errors.js
|
|
8
|
+
var errorCodes = [
|
|
9
|
+
"validation_error",
|
|
10
|
+
"configuration_error",
|
|
11
|
+
"authentication_error",
|
|
12
|
+
"permission_error",
|
|
13
|
+
"not_found",
|
|
14
|
+
"confirmation_required",
|
|
15
|
+
"rate_limited",
|
|
16
|
+
"timeout",
|
|
17
|
+
"network_error",
|
|
18
|
+
"provider_error",
|
|
19
|
+
"provider_unavailable",
|
|
20
|
+
"invalid_response",
|
|
21
|
+
"outcome_unknown",
|
|
22
|
+
"cancelled"
|
|
23
|
+
];
|
|
24
|
+
var BRAND = /* @__PURE__ */ Symbol.for("@wirecat/cli-base/CliError");
|
|
25
|
+
var CliError = class extends Error {
|
|
26
|
+
static {
|
|
27
|
+
__name(this, "CliError");
|
|
28
|
+
}
|
|
29
|
+
code;
|
|
30
|
+
details;
|
|
31
|
+
constructor(code, message, details = {}) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.name = "CliError";
|
|
34
|
+
this.code = code;
|
|
35
|
+
this.details = details;
|
|
36
|
+
Object.defineProperty(this, BRAND, { value: true });
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var isCliError = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && value[BRAND] === true, "isCliError");
|
|
40
|
+
|
|
41
|
+
// 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/sanitize.js
|
|
42
|
+
var CONTROL = (
|
|
43
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: matching them is the whole point
|
|
44
|
+
/[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u200B\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF\u{E0000}-\u{E007F}]/gu
|
|
45
|
+
);
|
|
46
|
+
var SUBDIVISION_FLAG = /\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}/gu;
|
|
47
|
+
var LINE_BREAKS = /[\t\n\u2028\u2029]/g;
|
|
48
|
+
var escaped = /* @__PURE__ */ __name((c) => {
|
|
49
|
+
const code = c.codePointAt(0) ?? 0;
|
|
50
|
+
if (code > 65535)
|
|
51
|
+
return `\\u{${code.toString(16)}}`;
|
|
52
|
+
return code > 255 ? `\\u${code.toString(16).padStart(4, "0")}` : `\\x${code.toString(16).padStart(2, "0")}`;
|
|
53
|
+
}, "escaped");
|
|
54
|
+
var visibleControls = /* @__PURE__ */ __name((text) => {
|
|
55
|
+
let at = 0;
|
|
56
|
+
let result = "";
|
|
57
|
+
for (const flag of text.matchAll(SUBDIVISION_FLAG)) {
|
|
58
|
+
result += text.slice(at, flag.index).replace(CONTROL, escaped) + flag[0];
|
|
59
|
+
at = flag.index + flag[0].length;
|
|
60
|
+
}
|
|
61
|
+
return result + text.slice(at).replace(CONTROL, escaped);
|
|
62
|
+
}, "visibleControls");
|
|
63
|
+
var singleLine = /* @__PURE__ */ __name((text) => visibleControls(text).replace(LINE_BREAKS, escaped), "singleLine");
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
errorCodes,
|
|
67
|
+
CliError,
|
|
68
|
+
isCliError,
|
|
69
|
+
visibleControls,
|
|
70
|
+
singleLine
|
|
71
|
+
};
|