@codexhost/cli-linux-arm64 0.23.0 → 0.25.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/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +3968 -4082
- package/app/console-web.js +6822 -2065
- package/app/desktop-controller.mjs +13620 -2977
- package/app/host-runtime.mjs +12025 -12636
- package/app/plugins/antigravity/plugin.mjs +2382 -1452
- package/app/plugins/claude-code/plugin.mjs +2248 -1645
- package/app/plugins/codebuddy/plugin.mjs +1753 -1215
- package/app/plugins/codex-usage/plugin.mjs +1214 -915
- package/app/plugins/copilot/plugin.mjs +1239 -919
- package/app/plugins/cursor-cli/plugin.mjs +1549 -1099
- package/app/plugins/deepseek-harness/plugin.mjs +1955 -1484
- package/app/plugins/devin/plugin.mjs +1295 -978
- package/app/plugins/grok/plugin.mjs +1772 -1482
- package/app/plugins/hermes/plugin.mjs +1485 -1184
- package/app/plugins/kimi-code/plugin.mjs +1388 -1093
- package/app/plugins/kiro-cli/plugin.mjs +1349 -1036
- package/app/plugins/omp/plugin.mjs +2027 -1420
- package/app/plugins/opencode/plugin.mjs +2219 -1844
- package/app/plugins/pi/plugin.mjs +1956 -1606
- package/app/plugins/qoder/plugin.mjs +1536 -1229
- package/app/plugins/qoder-cn/plugin.mjs +1536 -1229
- package/app/plugins/qwen-code/plugin.mjs +1490 -1198
- package/app/plugins/workbuddy/plugin.mjs +1757 -1221
- package/app/plugins/zcode/plugin.mjs +1841 -1072
- package/app/renderer-extension.js +12894 -8392
- package/app/web/assets/index-CTCFIQbU.css +1 -0
- package/app/web/assets/index-DUOvhHbV.js +203 -0
- package/app/web/codexhost-settings.js +4811 -36168
- package/app/web/index.html +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +64 -64
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-api-workspace-controller/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-shortcuts/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-approval/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-brand-official/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -74
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +75 -64
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +98 -95
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +9 -9
- package/app/web/sw.js +8 -1
- package/app/web-modules/server.mjs +4752 -6790
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-DJW4bmyx.css +0 -1
- package/app/web/assets/index-Dyh1KzAB.js +0 -201
|
@@ -32,10 +32,10 @@ function executableExtensions(command, platform, environment) {
|
|
|
32
32
|
return [""];
|
|
33
33
|
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
34
34
|
}
|
|
35
|
-
function isExecutableFile(
|
|
35
|
+
function isExecutableFile(filePath2, platform) {
|
|
36
36
|
try {
|
|
37
|
-
fs.accessSync(
|
|
38
|
-
return fs.statSync(
|
|
37
|
+
fs.accessSync(filePath2, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
38
|
+
return fs.statSync(filePath2).isFile();
|
|
39
39
|
} catch {
|
|
40
40
|
return false;
|
|
41
41
|
}
|
|
@@ -147,8 +147,8 @@ var VERSION_MANAGER_ROOTS = "<version-managers>";
|
|
|
147
147
|
function installRootExtensions(platform) {
|
|
148
148
|
return platform === "win32" ? [".exe", ".cmd"] : [""];
|
|
149
149
|
}
|
|
150
|
-
function resolveHomeDirectory(
|
|
151
|
-
return
|
|
150
|
+
function resolveHomeDirectory(input2) {
|
|
151
|
+
return input2.homeDirectory ?? environmentValue(input2.environment, "HOME") ?? environmentValue(input2.environment, "USERPROFILE") ?? os.homedir();
|
|
152
152
|
}
|
|
153
153
|
function templateVariables(environment, platform, home) {
|
|
154
154
|
const pathFlavor = targetPath(platform);
|
|
@@ -181,36 +181,36 @@ function expandInstallRoot(template, environment, platform, home) {
|
|
|
181
181
|
});
|
|
182
182
|
return unresolved ? void 0 : joinTemplate(platform, substituted);
|
|
183
183
|
}
|
|
184
|
-
function installRootDirectories(spec,
|
|
184
|
+
function installRootDirectories(spec, input2, dependencies, platform, home) {
|
|
185
185
|
const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
|
|
186
186
|
const directories = [];
|
|
187
187
|
for (const template of templates) {
|
|
188
188
|
if (template === VERSION_MANAGER_ROOTS) {
|
|
189
189
|
directories.push(...versionManagerBinaryDirectories({
|
|
190
190
|
platform,
|
|
191
|
-
environment:
|
|
191
|
+
environment: input2.environment,
|
|
192
192
|
home,
|
|
193
193
|
...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
|
|
194
194
|
}));
|
|
195
195
|
continue;
|
|
196
196
|
}
|
|
197
|
-
const directory = expandInstallRoot(template,
|
|
197
|
+
const directory = expandInstallRoot(template, input2.environment, platform, home);
|
|
198
198
|
if (directory !== void 0)
|
|
199
199
|
directories.push(directory);
|
|
200
200
|
}
|
|
201
201
|
return directories;
|
|
202
202
|
}
|
|
203
|
-
function harnessCandidates(spec,
|
|
204
|
-
const platform =
|
|
203
|
+
function harnessCandidates(spec, input2, dependencies = {}) {
|
|
204
|
+
const platform = input2.platform ?? process.platform;
|
|
205
205
|
const pathFlavor = targetPath(platform);
|
|
206
|
-
const configured =
|
|
206
|
+
const configured = input2.command ?? (spec.commandEnvironmentVariable ? environmentValue(input2.environment, spec.commandEnvironmentVariable) : void 0);
|
|
207
207
|
const command = configured ?? spec.command;
|
|
208
208
|
if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
209
209
|
return [{ candidate: command, source: "configured" }];
|
|
210
210
|
}
|
|
211
211
|
const candidates = [];
|
|
212
|
-
const extensions = executableExtensions(command, platform,
|
|
213
|
-
for (const directory of pathDirectories(
|
|
212
|
+
const extensions = executableExtensions(command, platform, input2.environment);
|
|
213
|
+
for (const directory of pathDirectories(input2.environment, platform)) {
|
|
214
214
|
for (const extension of extensions) {
|
|
215
215
|
candidates.push({
|
|
216
216
|
candidate: pathFlavor.join(directory, command + extension),
|
|
@@ -220,8 +220,8 @@ function harnessCandidates(spec, input, dependencies = {}) {
|
|
|
220
220
|
}
|
|
221
221
|
if (configured !== void 0)
|
|
222
222
|
return candidates;
|
|
223
|
-
const home = resolveHomeDirectory(
|
|
224
|
-
for (const directory of installRootDirectories(spec,
|
|
223
|
+
const home = resolveHomeDirectory(input2);
|
|
224
|
+
for (const directory of installRootDirectories(spec, input2, dependencies, platform, home)) {
|
|
225
225
|
for (const extension of installRootExtensions(platform)) {
|
|
226
226
|
candidates.push({
|
|
227
227
|
candidate: pathFlavor.join(directory, spec.command + extension),
|
|
@@ -231,12 +231,12 @@ function harnessCandidates(spec, input, dependencies = {}) {
|
|
|
231
231
|
}
|
|
232
232
|
return candidates;
|
|
233
233
|
}
|
|
234
|
-
function resolveHarnessExecutable(spec,
|
|
235
|
-
const platform =
|
|
234
|
+
function resolveHarnessExecutable(spec, input2, dependencies = {}) {
|
|
235
|
+
const platform = input2.platform ?? process.platform;
|
|
236
236
|
const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
|
|
237
237
|
const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
|
|
238
238
|
const context = { platform, isExecutable };
|
|
239
|
-
for (const { candidate, source } of harnessCandidates(spec,
|
|
239
|
+
for (const { candidate, source } of harnessCandidates(spec, input2, dependencies)) {
|
|
240
240
|
const executable = runnable(candidate, context);
|
|
241
241
|
if (executable !== void 0 && isExecutable(executable))
|
|
242
242
|
return { executable, source };
|
|
@@ -247,13 +247,13 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
|
|
|
247
247
|
// ../../harness-discovery/dist/installation.js
|
|
248
248
|
import { execFile } from "node:child_process";
|
|
249
249
|
import { homedir } from "node:os";
|
|
250
|
-
function runInstallationCommand(command, args, environment, timeout = 3e4) {
|
|
250
|
+
function runInstallationCommand(command, args, environment, timeout = 3e4, cwd) {
|
|
251
251
|
const env = withNodeRuntimeOnPath(environment);
|
|
252
252
|
const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
|
|
253
253
|
return new Promise((resolve, reject) => {
|
|
254
254
|
const child = execFile(invocation.command, invocation.arguments, {
|
|
255
255
|
env,
|
|
256
|
-
cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
|
|
256
|
+
cwd: cwd ?? env.HOME ?? env.USERPROFILE ?? homedir(),
|
|
257
257
|
encoding: "utf8",
|
|
258
258
|
timeout,
|
|
259
259
|
killSignal: "SIGKILL",
|
|
@@ -316,7 +316,7 @@ function createInstallationManager(options) {
|
|
|
316
316
|
const check2 = () => checking ??= options.check().finally(() => {
|
|
317
317
|
checking = void 0;
|
|
318
318
|
});
|
|
319
|
-
return (action) => {
|
|
319
|
+
return (action, confirmedVersion) => {
|
|
320
320
|
if (updating)
|
|
321
321
|
return updating;
|
|
322
322
|
if (action === "check")
|
|
@@ -327,6 +327,8 @@ function createInstallationManager(options) {
|
|
|
327
327
|
return before;
|
|
328
328
|
if (!before.canUpdate)
|
|
329
329
|
throw new Error(before.message ?? "This installation cannot be updated automatically");
|
|
330
|
+
if ((before.latestVerifiedVersion !== void 0 || confirmedVersion !== void 0) && before.latestVersion !== confirmedVersion)
|
|
331
|
+
return { ...before, confirmationRequired: true };
|
|
330
332
|
await options.update(before);
|
|
331
333
|
const after = await check2();
|
|
332
334
|
if (after.currentVersion === before.currentVersion)
|
|
@@ -361,8 +363,8 @@ function referencesNpmBin(shim, name, bin) {
|
|
|
361
363
|
if (bin.includes(".."))
|
|
362
364
|
return false;
|
|
363
365
|
const target2 = `node_modules/${name}/${bin.replace(/^\.\//, "")}`.toLowerCase();
|
|
364
|
-
const
|
|
365
|
-
return
|
|
366
|
+
const text2 = shim.replaceAll("\\", "/").toLowerCase();
|
|
367
|
+
return text2.includes(`%dp0%/${target2}"`) || text2.includes(`%~dp0/${target2}"`);
|
|
366
368
|
}
|
|
367
369
|
async function npmInstallation(command, packages, environment) {
|
|
368
370
|
let selected = await realpath(command);
|
|
@@ -371,7 +373,7 @@ async function npmInstallation(command, packages, environment) {
|
|
|
371
373
|
const root = path4.dirname(selected);
|
|
372
374
|
for (const name of packages) {
|
|
373
375
|
const directory2 = path4.join(root, "node_modules", ...name.split("/"));
|
|
374
|
-
const metadata = await readFile(path4.join(directory2, "package.json"), "utf8").then((
|
|
376
|
+
const metadata = await readFile(path4.join(directory2, "package.json"), "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
|
|
375
377
|
const bins = typeof metadata?.bin === "string" ? [metadata.bin] : Object.values(metadata?.bin ?? {});
|
|
376
378
|
const bin = bins.find((entry) => referencesNpmBin(shim, name, entry));
|
|
377
379
|
if (bin) {
|
|
@@ -382,7 +384,7 @@ async function npmInstallation(command, packages, environment) {
|
|
|
382
384
|
}
|
|
383
385
|
let directory = path4.dirname(selected);
|
|
384
386
|
for (let depth = 0; depth < 8; depth++) {
|
|
385
|
-
const metadata = await readFile(path4.join(directory, "package.json"), "utf8").then((
|
|
387
|
+
const metadata = await readFile(path4.join(directory, "package.json"), "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
|
|
386
388
|
if (metadata?.name && packages.includes(metadata.name)) {
|
|
387
389
|
const name = metadata.name;
|
|
388
390
|
const currentVersion = installationVersion(metadata.version);
|
|
@@ -1197,8 +1199,8 @@ function cached(getter) {
|
|
|
1197
1199
|
}
|
|
1198
1200
|
};
|
|
1199
1201
|
}
|
|
1200
|
-
function nullish(
|
|
1201
|
-
return
|
|
1202
|
+
function nullish(input2) {
|
|
1203
|
+
return input2 === null || input2 === void 0;
|
|
1202
1204
|
}
|
|
1203
1205
|
function cleanRegex(source) {
|
|
1204
1206
|
const start = source.startsWith("^") ? 1 : 0;
|
|
@@ -1285,8 +1287,8 @@ function randomString(length = 10) {
|
|
|
1285
1287
|
function esc(str) {
|
|
1286
1288
|
return JSON.stringify(str);
|
|
1287
1289
|
}
|
|
1288
|
-
function slugify(
|
|
1289
|
-
return
|
|
1290
|
+
function slugify(input2) {
|
|
1291
|
+
return input2.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1290
1292
|
}
|
|
1291
1293
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
1292
1294
|
};
|
|
@@ -1691,19 +1693,19 @@ function finalizeIssue(iss, ctx, config2) {
|
|
|
1691
1693
|
}
|
|
1692
1694
|
return rest;
|
|
1693
1695
|
}
|
|
1694
|
-
function getSizableOrigin(
|
|
1695
|
-
if (
|
|
1696
|
+
function getSizableOrigin(input2) {
|
|
1697
|
+
if (input2 instanceof Set)
|
|
1696
1698
|
return "set";
|
|
1697
|
-
if (
|
|
1699
|
+
if (input2 instanceof Map)
|
|
1698
1700
|
return "map";
|
|
1699
|
-
if (
|
|
1701
|
+
if (input2 instanceof File)
|
|
1700
1702
|
return "file";
|
|
1701
1703
|
return "unknown";
|
|
1702
1704
|
}
|
|
1703
|
-
function getLengthableOrigin(
|
|
1704
|
-
if (Array.isArray(
|
|
1705
|
+
function getLengthableOrigin(input2) {
|
|
1706
|
+
if (Array.isArray(input2))
|
|
1705
1707
|
return "array";
|
|
1706
|
-
if (typeof
|
|
1708
|
+
if (typeof input2 === "string")
|
|
1707
1709
|
return "string";
|
|
1708
1710
|
return "unknown";
|
|
1709
1711
|
}
|
|
@@ -1729,12 +1731,12 @@ function parsedType(data) {
|
|
|
1729
1731
|
return t;
|
|
1730
1732
|
}
|
|
1731
1733
|
function issue(...args) {
|
|
1732
|
-
const [iss,
|
|
1734
|
+
const [iss, input2, inst] = args;
|
|
1733
1735
|
if (typeof iss === "string") {
|
|
1734
1736
|
return {
|
|
1735
1737
|
message: iss,
|
|
1736
1738
|
code: "custom",
|
|
1737
|
-
input,
|
|
1739
|
+
input: input2,
|
|
1738
1740
|
inst
|
|
1739
1741
|
};
|
|
1740
1742
|
}
|
|
@@ -1745,8 +1747,8 @@ function cleanEnum(obj) {
|
|
|
1745
1747
|
return Number.isNaN(Number.parseInt(k, 10));
|
|
1746
1748
|
}).map((el) => el[1]);
|
|
1747
1749
|
}
|
|
1748
|
-
function base64ToUint8Array(
|
|
1749
|
-
const binaryString = atob(
|
|
1750
|
+
function base64ToUint8Array(base644) {
|
|
1751
|
+
const binaryString = atob(base644);
|
|
1750
1752
|
const bytes = new Uint8Array(binaryString.length);
|
|
1751
1753
|
for (let i = 0; i < binaryString.length; i++) {
|
|
1752
1754
|
bytes[i] = binaryString.charCodeAt(i);
|
|
@@ -1761,9 +1763,9 @@ function uint8ArrayToBase64(bytes) {
|
|
|
1761
1763
|
return btoa(binaryString);
|
|
1762
1764
|
}
|
|
1763
1765
|
function base64urlToUint8Array(base64url3) {
|
|
1764
|
-
const
|
|
1765
|
-
const padding = "=".repeat((4 -
|
|
1766
|
-
return base64ToUint8Array(
|
|
1766
|
+
const base644 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
|
|
1767
|
+
const padding = "=".repeat((4 - base644.length % 4) % 4);
|
|
1768
|
+
return base64ToUint8Array(base644 + padding);
|
|
1767
1769
|
}
|
|
1768
1770
|
function uint8ArrayToBase64url(bytes) {
|
|
1769
1771
|
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
@@ -2278,23 +2280,23 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2278
2280
|
bag.pattern = integer;
|
|
2279
2281
|
});
|
|
2280
2282
|
inst._zod.check = (payload) => {
|
|
2281
|
-
const
|
|
2283
|
+
const input2 = payload.value;
|
|
2282
2284
|
if (isInt) {
|
|
2283
|
-
if (!Number.isInteger(
|
|
2285
|
+
if (!Number.isInteger(input2)) {
|
|
2284
2286
|
payload.issues.push({
|
|
2285
2287
|
expected: origin,
|
|
2286
2288
|
format: def.format,
|
|
2287
2289
|
code: "invalid_type",
|
|
2288
2290
|
continue: false,
|
|
2289
|
-
input,
|
|
2291
|
+
input: input2,
|
|
2290
2292
|
inst
|
|
2291
2293
|
});
|
|
2292
2294
|
return;
|
|
2293
2295
|
}
|
|
2294
|
-
if (!Number.isSafeInteger(
|
|
2295
|
-
if (
|
|
2296
|
+
if (!Number.isSafeInteger(input2)) {
|
|
2297
|
+
if (input2 > 0) {
|
|
2296
2298
|
payload.issues.push({
|
|
2297
|
-
input,
|
|
2299
|
+
input: input2,
|
|
2298
2300
|
code: "too_big",
|
|
2299
2301
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
2300
2302
|
note: "Integers must be within the safe integer range.",
|
|
@@ -2305,7 +2307,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2305
2307
|
});
|
|
2306
2308
|
} else {
|
|
2307
2309
|
payload.issues.push({
|
|
2308
|
-
input,
|
|
2310
|
+
input: input2,
|
|
2309
2311
|
code: "too_small",
|
|
2310
2312
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
2311
2313
|
note: "Integers must be within the safe integer range.",
|
|
@@ -2318,10 +2320,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2318
2320
|
return;
|
|
2319
2321
|
}
|
|
2320
2322
|
}
|
|
2321
|
-
if (
|
|
2323
|
+
if (input2 < minimum) {
|
|
2322
2324
|
payload.issues.push({
|
|
2323
2325
|
origin: "number",
|
|
2324
|
-
input,
|
|
2326
|
+
input: input2,
|
|
2325
2327
|
code: "too_small",
|
|
2326
2328
|
minimum,
|
|
2327
2329
|
inclusive: true,
|
|
@@ -2329,10 +2331,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2329
2331
|
continue: !def.abort
|
|
2330
2332
|
});
|
|
2331
2333
|
}
|
|
2332
|
-
if (
|
|
2334
|
+
if (input2 > maximum) {
|
|
2333
2335
|
payload.issues.push({
|
|
2334
2336
|
origin: "number",
|
|
2335
|
-
input,
|
|
2337
|
+
input: input2,
|
|
2336
2338
|
code: "too_big",
|
|
2337
2339
|
maximum,
|
|
2338
2340
|
inclusive: true,
|
|
@@ -2352,11 +2354,11 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
2352
2354
|
bag.maximum = maximum;
|
|
2353
2355
|
});
|
|
2354
2356
|
inst._zod.check = (payload) => {
|
|
2355
|
-
const
|
|
2356
|
-
if (
|
|
2357
|
+
const input2 = payload.value;
|
|
2358
|
+
if (input2 < minimum) {
|
|
2357
2359
|
payload.issues.push({
|
|
2358
2360
|
origin: "bigint",
|
|
2359
|
-
input,
|
|
2361
|
+
input: input2,
|
|
2360
2362
|
code: "too_small",
|
|
2361
2363
|
minimum,
|
|
2362
2364
|
inclusive: true,
|
|
@@ -2364,10 +2366,10 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
2364
2366
|
continue: !def.abort
|
|
2365
2367
|
});
|
|
2366
2368
|
}
|
|
2367
|
-
if (
|
|
2369
|
+
if (input2 > maximum) {
|
|
2368
2370
|
payload.issues.push({
|
|
2369
2371
|
origin: "bigint",
|
|
2370
|
-
input,
|
|
2372
|
+
input: input2,
|
|
2371
2373
|
code: "too_big",
|
|
2372
2374
|
maximum,
|
|
2373
2375
|
inclusive: true,
|
|
@@ -2390,16 +2392,16 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
|
|
|
2390
2392
|
inst2._zod.bag.maximum = def.maximum;
|
|
2391
2393
|
});
|
|
2392
2394
|
inst._zod.check = (payload) => {
|
|
2393
|
-
const
|
|
2394
|
-
const size =
|
|
2395
|
+
const input2 = payload.value;
|
|
2396
|
+
const size = input2.size;
|
|
2395
2397
|
if (size <= def.maximum)
|
|
2396
2398
|
return;
|
|
2397
2399
|
payload.issues.push({
|
|
2398
|
-
origin: getSizableOrigin(
|
|
2400
|
+
origin: getSizableOrigin(input2),
|
|
2399
2401
|
code: "too_big",
|
|
2400
2402
|
maximum: def.maximum,
|
|
2401
2403
|
inclusive: true,
|
|
2402
|
-
input,
|
|
2404
|
+
input: input2,
|
|
2403
2405
|
inst,
|
|
2404
2406
|
continue: !def.abort
|
|
2405
2407
|
});
|
|
@@ -2418,16 +2420,16 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
|
|
|
2418
2420
|
inst2._zod.bag.minimum = def.minimum;
|
|
2419
2421
|
});
|
|
2420
2422
|
inst._zod.check = (payload) => {
|
|
2421
|
-
const
|
|
2422
|
-
const size =
|
|
2423
|
+
const input2 = payload.value;
|
|
2424
|
+
const size = input2.size;
|
|
2423
2425
|
if (size >= def.minimum)
|
|
2424
2426
|
return;
|
|
2425
2427
|
payload.issues.push({
|
|
2426
|
-
origin: getSizableOrigin(
|
|
2428
|
+
origin: getSizableOrigin(input2),
|
|
2427
2429
|
code: "too_small",
|
|
2428
2430
|
minimum: def.minimum,
|
|
2429
2431
|
inclusive: true,
|
|
2430
|
-
input,
|
|
2432
|
+
input: input2,
|
|
2431
2433
|
inst,
|
|
2432
2434
|
continue: !def.abort
|
|
2433
2435
|
});
|
|
@@ -2447,13 +2449,13 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
|
|
|
2447
2449
|
bag.size = def.size;
|
|
2448
2450
|
});
|
|
2449
2451
|
inst._zod.check = (payload) => {
|
|
2450
|
-
const
|
|
2451
|
-
const size =
|
|
2452
|
+
const input2 = payload.value;
|
|
2453
|
+
const size = input2.size;
|
|
2452
2454
|
if (size === def.size)
|
|
2453
2455
|
return;
|
|
2454
2456
|
const tooBig = size > def.size;
|
|
2455
2457
|
payload.issues.push({
|
|
2456
|
-
origin: getSizableOrigin(
|
|
2458
|
+
origin: getSizableOrigin(input2),
|
|
2457
2459
|
...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
|
|
2458
2460
|
inclusive: true,
|
|
2459
2461
|
exact: true,
|
|
@@ -2476,17 +2478,17 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
2476
2478
|
inst2._zod.bag.maximum = def.maximum;
|
|
2477
2479
|
});
|
|
2478
2480
|
inst._zod.check = (payload) => {
|
|
2479
|
-
const
|
|
2480
|
-
const length =
|
|
2481
|
+
const input2 = payload.value;
|
|
2482
|
+
const length = input2.length;
|
|
2481
2483
|
if (length <= def.maximum)
|
|
2482
2484
|
return;
|
|
2483
|
-
const origin = getLengthableOrigin(
|
|
2485
|
+
const origin = getLengthableOrigin(input2);
|
|
2484
2486
|
payload.issues.push({
|
|
2485
2487
|
origin,
|
|
2486
2488
|
code: "too_big",
|
|
2487
2489
|
maximum: def.maximum,
|
|
2488
2490
|
inclusive: true,
|
|
2489
|
-
input,
|
|
2491
|
+
input: input2,
|
|
2490
2492
|
inst,
|
|
2491
2493
|
continue: !def.abort
|
|
2492
2494
|
});
|
|
@@ -2505,17 +2507,17 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
2505
2507
|
inst2._zod.bag.minimum = def.minimum;
|
|
2506
2508
|
});
|
|
2507
2509
|
inst._zod.check = (payload) => {
|
|
2508
|
-
const
|
|
2509
|
-
const length =
|
|
2510
|
+
const input2 = payload.value;
|
|
2511
|
+
const length = input2.length;
|
|
2510
2512
|
if (length >= def.minimum)
|
|
2511
2513
|
return;
|
|
2512
|
-
const origin = getLengthableOrigin(
|
|
2514
|
+
const origin = getLengthableOrigin(input2);
|
|
2513
2515
|
payload.issues.push({
|
|
2514
2516
|
origin,
|
|
2515
2517
|
code: "too_small",
|
|
2516
2518
|
minimum: def.minimum,
|
|
2517
2519
|
inclusive: true,
|
|
2518
|
-
input,
|
|
2520
|
+
input: input2,
|
|
2519
2521
|
inst,
|
|
2520
2522
|
continue: !def.abort
|
|
2521
2523
|
});
|
|
@@ -2535,11 +2537,11 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
2535
2537
|
bag.length = def.length;
|
|
2536
2538
|
});
|
|
2537
2539
|
inst._zod.check = (payload) => {
|
|
2538
|
-
const
|
|
2539
|
-
const length =
|
|
2540
|
+
const input2 = payload.value;
|
|
2541
|
+
const length = input2.length;
|
|
2540
2542
|
if (length === def.length)
|
|
2541
2543
|
return;
|
|
2542
|
-
const origin = getLengthableOrigin(
|
|
2544
|
+
const origin = getLengthableOrigin(input2);
|
|
2543
2545
|
const tooBig = length > def.length;
|
|
2544
2546
|
payload.issues.push({
|
|
2545
2547
|
origin,
|
|
@@ -3129,8 +3131,8 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
|
3129
3131
|
function isValidBase64URL(data) {
|
|
3130
3132
|
if (!base64url.test(data))
|
|
3131
3133
|
return false;
|
|
3132
|
-
const
|
|
3133
|
-
const padded =
|
|
3134
|
+
const base644 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
3135
|
+
const padded = base644.padEnd(Math.ceil(base644.length / 4) * 4, "=");
|
|
3134
3136
|
return isValidBase64(padded);
|
|
3135
3137
|
}
|
|
3136
3138
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
@@ -3210,15 +3212,15 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
3210
3212
|
payload.value = Number(payload.value);
|
|
3211
3213
|
} catch (_) {
|
|
3212
3214
|
}
|
|
3213
|
-
const
|
|
3214
|
-
if (typeof
|
|
3215
|
+
const input2 = payload.value;
|
|
3216
|
+
if (typeof input2 === "number" && !Number.isNaN(input2) && Number.isFinite(input2)) {
|
|
3215
3217
|
return payload;
|
|
3216
3218
|
}
|
|
3217
|
-
const received = typeof
|
|
3219
|
+
const received = typeof input2 === "number" ? Number.isNaN(input2) ? "NaN" : !Number.isFinite(input2) ? "Infinity" : void 0 : void 0;
|
|
3218
3220
|
payload.issues.push({
|
|
3219
3221
|
expected: "number",
|
|
3220
3222
|
code: "invalid_type",
|
|
3221
|
-
input,
|
|
3223
|
+
input: input2,
|
|
3222
3224
|
inst,
|
|
3223
3225
|
...received ? { received } : {}
|
|
3224
3226
|
});
|
|
@@ -3238,13 +3240,13 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
|
3238
3240
|
payload.value = Boolean(payload.value);
|
|
3239
3241
|
} catch (_) {
|
|
3240
3242
|
}
|
|
3241
|
-
const
|
|
3242
|
-
if (typeof
|
|
3243
|
+
const input2 = payload.value;
|
|
3244
|
+
if (typeof input2 === "boolean")
|
|
3243
3245
|
return payload;
|
|
3244
3246
|
payload.issues.push({
|
|
3245
3247
|
expected: "boolean",
|
|
3246
3248
|
code: "invalid_type",
|
|
3247
|
-
input,
|
|
3249
|
+
input: input2,
|
|
3248
3250
|
inst
|
|
3249
3251
|
});
|
|
3250
3252
|
return payload;
|
|
@@ -3277,13 +3279,13 @@ var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, d
|
|
|
3277
3279
|
var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
|
|
3278
3280
|
$ZodType.init(inst, def);
|
|
3279
3281
|
inst._zod.parse = (payload, _ctx) => {
|
|
3280
|
-
const
|
|
3281
|
-
if (typeof
|
|
3282
|
+
const input2 = payload.value;
|
|
3283
|
+
if (typeof input2 === "symbol")
|
|
3282
3284
|
return payload;
|
|
3283
3285
|
payload.issues.push({
|
|
3284
3286
|
expected: "symbol",
|
|
3285
3287
|
code: "invalid_type",
|
|
3286
|
-
input,
|
|
3288
|
+
input: input2,
|
|
3287
3289
|
inst
|
|
3288
3290
|
});
|
|
3289
3291
|
return payload;
|
|
@@ -3294,13 +3296,13 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) =>
|
|
|
3294
3296
|
inst._zod.pattern = _undefined;
|
|
3295
3297
|
inst._zod.values = /* @__PURE__ */ new Set([void 0]);
|
|
3296
3298
|
inst._zod.parse = (payload, _ctx) => {
|
|
3297
|
-
const
|
|
3298
|
-
if (typeof
|
|
3299
|
+
const input2 = payload.value;
|
|
3300
|
+
if (typeof input2 === "undefined")
|
|
3299
3301
|
return payload;
|
|
3300
3302
|
payload.issues.push({
|
|
3301
3303
|
expected: "undefined",
|
|
3302
3304
|
code: "invalid_type",
|
|
3303
|
-
input,
|
|
3305
|
+
input: input2,
|
|
3304
3306
|
inst
|
|
3305
3307
|
});
|
|
3306
3308
|
return payload;
|
|
@@ -3311,13 +3313,13 @@ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
|
|
|
3311
3313
|
inst._zod.pattern = _null;
|
|
3312
3314
|
inst._zod.values = /* @__PURE__ */ new Set([null]);
|
|
3313
3315
|
inst._zod.parse = (payload, _ctx) => {
|
|
3314
|
-
const
|
|
3315
|
-
if (
|
|
3316
|
+
const input2 = payload.value;
|
|
3317
|
+
if (input2 === null)
|
|
3316
3318
|
return payload;
|
|
3317
3319
|
payload.issues.push({
|
|
3318
3320
|
expected: "null",
|
|
3319
3321
|
code: "invalid_type",
|
|
3320
|
-
input,
|
|
3322
|
+
input: input2,
|
|
3321
3323
|
inst
|
|
3322
3324
|
});
|
|
3323
3325
|
return payload;
|
|
@@ -3346,13 +3348,13 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
|
3346
3348
|
var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
|
|
3347
3349
|
$ZodType.init(inst, def);
|
|
3348
3350
|
inst._zod.parse = (payload, _ctx) => {
|
|
3349
|
-
const
|
|
3350
|
-
if (typeof
|
|
3351
|
+
const input2 = payload.value;
|
|
3352
|
+
if (typeof input2 === "undefined")
|
|
3351
3353
|
return payload;
|
|
3352
3354
|
payload.issues.push({
|
|
3353
3355
|
expected: "void",
|
|
3354
3356
|
code: "invalid_type",
|
|
3355
|
-
input,
|
|
3357
|
+
input: input2,
|
|
3356
3358
|
inst
|
|
3357
3359
|
});
|
|
3358
3360
|
return payload;
|
|
@@ -3367,15 +3369,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
3367
3369
|
} catch (_err) {
|
|
3368
3370
|
}
|
|
3369
3371
|
}
|
|
3370
|
-
const
|
|
3371
|
-
const isDate =
|
|
3372
|
-
const isValidDate = isDate && !Number.isNaN(
|
|
3372
|
+
const input2 = payload.value;
|
|
3373
|
+
const isDate = input2 instanceof Date;
|
|
3374
|
+
const isValidDate = isDate && !Number.isNaN(input2.getTime());
|
|
3373
3375
|
if (isValidDate)
|
|
3374
3376
|
return payload;
|
|
3375
3377
|
payload.issues.push({
|
|
3376
3378
|
expected: "date",
|
|
3377
3379
|
code: "invalid_type",
|
|
3378
|
-
input,
|
|
3380
|
+
input: input2,
|
|
3379
3381
|
...isDate ? { received: "Invalid Date" } : {},
|
|
3380
3382
|
inst
|
|
3381
3383
|
});
|
|
@@ -3391,20 +3393,20 @@ function handleArrayResult(result, final, index) {
|
|
|
3391
3393
|
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
3392
3394
|
$ZodType.init(inst, def);
|
|
3393
3395
|
inst._zod.parse = (payload, ctx) => {
|
|
3394
|
-
const
|
|
3395
|
-
if (!Array.isArray(
|
|
3396
|
+
const input2 = payload.value;
|
|
3397
|
+
if (!Array.isArray(input2)) {
|
|
3396
3398
|
payload.issues.push({
|
|
3397
3399
|
expected: "array",
|
|
3398
3400
|
code: "invalid_type",
|
|
3399
|
-
input,
|
|
3401
|
+
input: input2,
|
|
3400
3402
|
inst
|
|
3401
3403
|
});
|
|
3402
3404
|
return payload;
|
|
3403
3405
|
}
|
|
3404
|
-
payload.value = Array(
|
|
3406
|
+
payload.value = Array(input2.length);
|
|
3405
3407
|
const proms = [];
|
|
3406
|
-
for (let i = 0; i <
|
|
3407
|
-
const item =
|
|
3408
|
+
for (let i = 0; i < input2.length; i++) {
|
|
3409
|
+
const item = input2[i];
|
|
3408
3410
|
const result = def.element._zod.run({
|
|
3409
3411
|
value: item,
|
|
3410
3412
|
issues: []
|
|
@@ -3421,8 +3423,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
3421
3423
|
return payload;
|
|
3422
3424
|
};
|
|
3423
3425
|
});
|
|
3424
|
-
function handlePropertyResult(result, final, key,
|
|
3425
|
-
const isPresent = key in
|
|
3426
|
+
function handlePropertyResult(result, final, key, input2, isOptionalIn, isOptionalOut) {
|
|
3427
|
+
const isPresent = key in input2;
|
|
3426
3428
|
if (result.issues.length) {
|
|
3427
3429
|
if (isOptionalIn && isOptionalOut && !isPresent) {
|
|
3428
3430
|
return;
|
|
@@ -3464,14 +3466,14 @@ function normalizeDef(def) {
|
|
|
3464
3466
|
optionalKeys: new Set(okeys)
|
|
3465
3467
|
};
|
|
3466
3468
|
}
|
|
3467
|
-
function handleCatchall(proms,
|
|
3469
|
+
function handleCatchall(proms, input2, payload, ctx, def, inst) {
|
|
3468
3470
|
const unrecognized = [];
|
|
3469
3471
|
const keySet = def.keySet;
|
|
3470
3472
|
const _catchall = def.catchall._zod;
|
|
3471
3473
|
const t = _catchall.def.type;
|
|
3472
3474
|
const isOptionalIn = _catchall.optin === "optional";
|
|
3473
3475
|
const isOptionalOut = _catchall.optout === "optional";
|
|
3474
|
-
for (const key in
|
|
3476
|
+
for (const key in input2) {
|
|
3475
3477
|
if (key === "__proto__")
|
|
3476
3478
|
continue;
|
|
3477
3479
|
if (keySet.has(key))
|
|
@@ -3480,18 +3482,18 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
3480
3482
|
unrecognized.push(key);
|
|
3481
3483
|
continue;
|
|
3482
3484
|
}
|
|
3483
|
-
const r = _catchall.run({ value:
|
|
3485
|
+
const r = _catchall.run({ value: input2[key], issues: [] }, ctx);
|
|
3484
3486
|
if (r instanceof Promise) {
|
|
3485
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
3487
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
|
|
3486
3488
|
} else {
|
|
3487
|
-
handlePropertyResult(r, payload, key,
|
|
3489
|
+
handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
|
|
3488
3490
|
}
|
|
3489
3491
|
}
|
|
3490
3492
|
if (unrecognized.length) {
|
|
3491
3493
|
payload.issues.push({
|
|
3492
3494
|
code: "unrecognized_keys",
|
|
3493
3495
|
keys: unrecognized,
|
|
3494
|
-
input,
|
|
3496
|
+
input: input2,
|
|
3495
3497
|
inst
|
|
3496
3498
|
});
|
|
3497
3499
|
}
|
|
@@ -3535,12 +3537,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3535
3537
|
let value;
|
|
3536
3538
|
inst._zod.parse = (payload, ctx) => {
|
|
3537
3539
|
value ?? (value = _normalized.value);
|
|
3538
|
-
const
|
|
3539
|
-
if (!isObject2(
|
|
3540
|
+
const input2 = payload.value;
|
|
3541
|
+
if (!isObject2(input2)) {
|
|
3540
3542
|
payload.issues.push({
|
|
3541
3543
|
expected: "object",
|
|
3542
3544
|
code: "invalid_type",
|
|
3543
|
-
input,
|
|
3545
|
+
input: input2,
|
|
3544
3546
|
inst
|
|
3545
3547
|
});
|
|
3546
3548
|
return payload;
|
|
@@ -3552,17 +3554,17 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3552
3554
|
const el = shape[key];
|
|
3553
3555
|
const isOptionalIn = el._zod.optin === "optional";
|
|
3554
3556
|
const isOptionalOut = el._zod.optout === "optional";
|
|
3555
|
-
const r = el._zod.run({ value:
|
|
3557
|
+
const r = el._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
3556
3558
|
if (r instanceof Promise) {
|
|
3557
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
3559
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
|
|
3558
3560
|
} else {
|
|
3559
|
-
handlePropertyResult(r, payload, key,
|
|
3561
|
+
handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
|
|
3560
3562
|
}
|
|
3561
3563
|
}
|
|
3562
3564
|
if (!catchall) {
|
|
3563
3565
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
3564
3566
|
}
|
|
3565
|
-
return handleCatchall(proms,
|
|
3567
|
+
return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst);
|
|
3566
3568
|
};
|
|
3567
3569
|
});
|
|
3568
3570
|
var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -3584,42 +3586,42 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3584
3586
|
}
|
|
3585
3587
|
doc.write(`const newResult = {};`);
|
|
3586
3588
|
for (const key of normalized.keys) {
|
|
3587
|
-
const
|
|
3589
|
+
const id2 = ids[key];
|
|
3588
3590
|
const k = esc(key);
|
|
3589
3591
|
const schema = shape[key];
|
|
3590
3592
|
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
3591
3593
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
3592
|
-
doc.write(`const ${
|
|
3594
|
+
doc.write(`const ${id2} = ${parseStr(key)};`);
|
|
3593
3595
|
if (isOptionalIn && isOptionalOut) {
|
|
3594
3596
|
doc.write(`
|
|
3595
|
-
if (${
|
|
3597
|
+
if (${id2}.issues.length) {
|
|
3596
3598
|
if (${k} in input) {
|
|
3597
|
-
payload.issues = payload.issues.concat(${
|
|
3599
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3598
3600
|
...iss,
|
|
3599
3601
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3600
3602
|
})));
|
|
3601
3603
|
}
|
|
3602
3604
|
}
|
|
3603
3605
|
|
|
3604
|
-
if (${
|
|
3606
|
+
if (${id2}.value === undefined) {
|
|
3605
3607
|
if (${k} in input) {
|
|
3606
3608
|
newResult[${k}] = undefined;
|
|
3607
3609
|
}
|
|
3608
3610
|
} else {
|
|
3609
|
-
newResult[${k}] = ${
|
|
3611
|
+
newResult[${k}] = ${id2}.value;
|
|
3610
3612
|
}
|
|
3611
3613
|
|
|
3612
3614
|
`);
|
|
3613
3615
|
} else if (!isOptionalIn) {
|
|
3614
3616
|
doc.write(`
|
|
3615
|
-
const ${
|
|
3616
|
-
if (${
|
|
3617
|
-
payload.issues = payload.issues.concat(${
|
|
3617
|
+
const ${id2}_present = ${k} in input;
|
|
3618
|
+
if (${id2}.issues.length) {
|
|
3619
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3618
3620
|
...iss,
|
|
3619
3621
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3620
3622
|
})));
|
|
3621
3623
|
}
|
|
3622
|
-
if (!${
|
|
3624
|
+
if (!${id2}_present && !${id2}.issues.length) {
|
|
3623
3625
|
payload.issues.push({
|
|
3624
3626
|
code: "invalid_type",
|
|
3625
3627
|
expected: "nonoptional",
|
|
@@ -3628,30 +3630,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3628
3630
|
});
|
|
3629
3631
|
}
|
|
3630
3632
|
|
|
3631
|
-
if (${
|
|
3632
|
-
if (${
|
|
3633
|
+
if (${id2}_present) {
|
|
3634
|
+
if (${id2}.value === undefined) {
|
|
3633
3635
|
newResult[${k}] = undefined;
|
|
3634
3636
|
} else {
|
|
3635
|
-
newResult[${k}] = ${
|
|
3637
|
+
newResult[${k}] = ${id2}.value;
|
|
3636
3638
|
}
|
|
3637
3639
|
}
|
|
3638
3640
|
|
|
3639
3641
|
`);
|
|
3640
3642
|
} else {
|
|
3641
3643
|
doc.write(`
|
|
3642
|
-
if (${
|
|
3643
|
-
payload.issues = payload.issues.concat(${
|
|
3644
|
+
if (${id2}.issues.length) {
|
|
3645
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3644
3646
|
...iss,
|
|
3645
3647
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3646
3648
|
})));
|
|
3647
3649
|
}
|
|
3648
3650
|
|
|
3649
|
-
if (${
|
|
3651
|
+
if (${id2}.value === undefined) {
|
|
3650
3652
|
if (${k} in input) {
|
|
3651
3653
|
newResult[${k}] = undefined;
|
|
3652
3654
|
}
|
|
3653
3655
|
} else {
|
|
3654
|
-
newResult[${k}] = ${
|
|
3656
|
+
newResult[${k}] = ${id2}.value;
|
|
3655
3657
|
}
|
|
3656
3658
|
|
|
3657
3659
|
`);
|
|
@@ -3671,12 +3673,12 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3671
3673
|
let value;
|
|
3672
3674
|
inst._zod.parse = (payload, ctx) => {
|
|
3673
3675
|
value ?? (value = _normalized.value);
|
|
3674
|
-
const
|
|
3675
|
-
if (!isObject2(
|
|
3676
|
+
const input2 = payload.value;
|
|
3677
|
+
if (!isObject2(input2)) {
|
|
3676
3678
|
payload.issues.push({
|
|
3677
3679
|
expected: "object",
|
|
3678
3680
|
code: "invalid_type",
|
|
3679
|
-
input,
|
|
3681
|
+
input: input2,
|
|
3680
3682
|
inst
|
|
3681
3683
|
});
|
|
3682
3684
|
return payload;
|
|
@@ -3687,7 +3689,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3687
3689
|
payload = fastpass(payload, ctx);
|
|
3688
3690
|
if (!catchall)
|
|
3689
3691
|
return payload;
|
|
3690
|
-
return handleCatchall([],
|
|
3692
|
+
return handleCatchall([], input2, payload, ctx, value, inst);
|
|
3691
3693
|
}
|
|
3692
3694
|
return superParse(payload, ctx);
|
|
3693
3695
|
};
|
|
@@ -3847,17 +3849,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3847
3849
|
return map2;
|
|
3848
3850
|
});
|
|
3849
3851
|
inst._zod.parse = (payload, ctx) => {
|
|
3850
|
-
const
|
|
3851
|
-
if (!isObject(
|
|
3852
|
+
const input2 = payload.value;
|
|
3853
|
+
if (!isObject(input2)) {
|
|
3852
3854
|
payload.issues.push({
|
|
3853
3855
|
code: "invalid_type",
|
|
3854
3856
|
expected: "object",
|
|
3855
|
-
input,
|
|
3857
|
+
input: input2,
|
|
3856
3858
|
inst
|
|
3857
3859
|
});
|
|
3858
3860
|
return payload;
|
|
3859
3861
|
}
|
|
3860
|
-
const opt = disc.value.get(
|
|
3862
|
+
const opt = disc.value.get(input2?.[def.discriminator]);
|
|
3861
3863
|
if (opt) {
|
|
3862
3864
|
return opt._zod.run(payload, ctx);
|
|
3863
3865
|
}
|
|
@@ -3870,7 +3872,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3870
3872
|
note: "No matching discriminator",
|
|
3871
3873
|
discriminator: def.discriminator,
|
|
3872
3874
|
options: Array.from(disc.value.keys()),
|
|
3873
|
-
input,
|
|
3875
|
+
input: input2,
|
|
3874
3876
|
path: [def.discriminator],
|
|
3875
3877
|
inst
|
|
3876
3878
|
});
|
|
@@ -3880,9 +3882,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3880
3882
|
var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
3881
3883
|
$ZodType.init(inst, def);
|
|
3882
3884
|
inst._zod.parse = (payload, ctx) => {
|
|
3883
|
-
const
|
|
3884
|
-
const left = def.left._zod.run({ value:
|
|
3885
|
-
const right = def.right._zod.run({ value:
|
|
3885
|
+
const input2 = payload.value;
|
|
3886
|
+
const left = def.left._zod.run({ value: input2, issues: [] }, ctx);
|
|
3887
|
+
const right = def.right._zod.run({ value: input2, issues: [] }, ctx);
|
|
3886
3888
|
const async = left instanceof Promise || right instanceof Promise;
|
|
3887
3889
|
if (async) {
|
|
3888
3890
|
return Promise.all([left, right]).then(([left2, right2]) => {
|
|
@@ -3979,10 +3981,10 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3979
3981
|
$ZodType.init(inst, def);
|
|
3980
3982
|
const items = def.items;
|
|
3981
3983
|
inst._zod.parse = (payload, ctx) => {
|
|
3982
|
-
const
|
|
3983
|
-
if (!Array.isArray(
|
|
3984
|
+
const input2 = payload.value;
|
|
3985
|
+
if (!Array.isArray(input2)) {
|
|
3984
3986
|
payload.issues.push({
|
|
3985
|
-
input,
|
|
3987
|
+
input: input2,
|
|
3986
3988
|
inst,
|
|
3987
3989
|
expected: "tuple",
|
|
3988
3990
|
code: "invalid_type"
|
|
@@ -3994,23 +3996,23 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3994
3996
|
const optinStart = getTupleOptStart(items, "optin");
|
|
3995
3997
|
const optoutStart = getTupleOptStart(items, "optout");
|
|
3996
3998
|
if (!def.rest) {
|
|
3997
|
-
if (
|
|
3999
|
+
if (input2.length < optinStart) {
|
|
3998
4000
|
payload.issues.push({
|
|
3999
4001
|
code: "too_small",
|
|
4000
4002
|
minimum: optinStart,
|
|
4001
4003
|
inclusive: true,
|
|
4002
|
-
input,
|
|
4004
|
+
input: input2,
|
|
4003
4005
|
inst,
|
|
4004
4006
|
origin: "array"
|
|
4005
4007
|
});
|
|
4006
4008
|
return payload;
|
|
4007
4009
|
}
|
|
4008
|
-
if (
|
|
4010
|
+
if (input2.length > items.length) {
|
|
4009
4011
|
payload.issues.push({
|
|
4010
4012
|
code: "too_big",
|
|
4011
4013
|
maximum: items.length,
|
|
4012
4014
|
inclusive: true,
|
|
4013
|
-
input,
|
|
4015
|
+
input: input2,
|
|
4014
4016
|
inst,
|
|
4015
4017
|
origin: "array"
|
|
4016
4018
|
});
|
|
@@ -4018,7 +4020,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
4018
4020
|
}
|
|
4019
4021
|
const itemResults = new Array(items.length);
|
|
4020
4022
|
for (let i = 0; i < items.length; i++) {
|
|
4021
|
-
const r = items[i]._zod.run({ value:
|
|
4023
|
+
const r = items[i]._zod.run({ value: input2[i], issues: [] }, ctx);
|
|
4022
4024
|
if (r instanceof Promise) {
|
|
4023
4025
|
proms.push(r.then((rr) => {
|
|
4024
4026
|
itemResults[i] = rr;
|
|
@@ -4029,7 +4031,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
4029
4031
|
}
|
|
4030
4032
|
if (def.rest) {
|
|
4031
4033
|
let i = items.length - 1;
|
|
4032
|
-
const rest =
|
|
4034
|
+
const rest = input2.slice(items.length);
|
|
4033
4035
|
for (const el of rest) {
|
|
4034
4036
|
i++;
|
|
4035
4037
|
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
@@ -4041,9 +4043,9 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
4041
4043
|
}
|
|
4042
4044
|
}
|
|
4043
4045
|
if (proms.length) {
|
|
4044
|
-
return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items,
|
|
4046
|
+
return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input2, optoutStart));
|
|
4045
4047
|
}
|
|
4046
|
-
return handleTupleResults(itemResults, payload, items,
|
|
4048
|
+
return handleTupleResults(itemResults, payload, items, input2, optoutStart);
|
|
4047
4049
|
};
|
|
4048
4050
|
});
|
|
4049
4051
|
function getTupleOptStart(items, key) {
|
|
@@ -4059,10 +4061,10 @@ function handleTupleResult(result, final, index) {
|
|
|
4059
4061
|
}
|
|
4060
4062
|
final.value[index] = result.value;
|
|
4061
4063
|
}
|
|
4062
|
-
function handleTupleResults(itemResults, final, items,
|
|
4064
|
+
function handleTupleResults(itemResults, final, items, input2, optoutStart) {
|
|
4063
4065
|
for (let i = 0; i < items.length; i++) {
|
|
4064
4066
|
const r = itemResults[i];
|
|
4065
|
-
const isPresent = i <
|
|
4067
|
+
const isPresent = i < input2.length;
|
|
4066
4068
|
if (r.issues.length) {
|
|
4067
4069
|
if (!isPresent && i >= optoutStart) {
|
|
4068
4070
|
final.value.length = i;
|
|
@@ -4072,7 +4074,7 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
4072
4074
|
}
|
|
4073
4075
|
final.value[i] = r.value;
|
|
4074
4076
|
}
|
|
4075
|
-
for (let i = final.value.length - 1; i >=
|
|
4077
|
+
for (let i = final.value.length - 1; i >= input2.length; i--) {
|
|
4076
4078
|
if (items[i]._zod.optout === "optional" && final.value[i] === void 0) {
|
|
4077
4079
|
final.value.length = i;
|
|
4078
4080
|
} else {
|
|
@@ -4084,12 +4086,12 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
4084
4086
|
var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
4085
4087
|
$ZodType.init(inst, def);
|
|
4086
4088
|
inst._zod.parse = (payload, ctx) => {
|
|
4087
|
-
const
|
|
4088
|
-
if (!isPlainObject(
|
|
4089
|
+
const input2 = payload.value;
|
|
4090
|
+
if (!isPlainObject(input2)) {
|
|
4089
4091
|
payload.issues.push({
|
|
4090
4092
|
expected: "record",
|
|
4091
4093
|
code: "invalid_type",
|
|
4092
|
-
input,
|
|
4094
|
+
input: input2,
|
|
4093
4095
|
inst
|
|
4094
4096
|
});
|
|
4095
4097
|
return payload;
|
|
@@ -4118,7 +4120,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4118
4120
|
continue;
|
|
4119
4121
|
}
|
|
4120
4122
|
const outKey = keyResult.value;
|
|
4121
|
-
const result = def.valueType._zod.run({ value:
|
|
4123
|
+
const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
4122
4124
|
if (result instanceof Promise) {
|
|
4123
4125
|
proms.push(result.then((result2) => {
|
|
4124
4126
|
if (result2.issues.length) {
|
|
@@ -4135,7 +4137,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4135
4137
|
}
|
|
4136
4138
|
}
|
|
4137
4139
|
let unrecognized;
|
|
4138
|
-
for (const key in
|
|
4140
|
+
for (const key in input2) {
|
|
4139
4141
|
if (!recordKeys.has(key)) {
|
|
4140
4142
|
unrecognized = unrecognized ?? [];
|
|
4141
4143
|
unrecognized.push(key);
|
|
@@ -4144,17 +4146,17 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4144
4146
|
if (unrecognized && unrecognized.length > 0) {
|
|
4145
4147
|
payload.issues.push({
|
|
4146
4148
|
code: "unrecognized_keys",
|
|
4147
|
-
input,
|
|
4149
|
+
input: input2,
|
|
4148
4150
|
inst,
|
|
4149
4151
|
keys: unrecognized
|
|
4150
4152
|
});
|
|
4151
4153
|
}
|
|
4152
4154
|
} else {
|
|
4153
4155
|
payload.value = {};
|
|
4154
|
-
for (const key of Reflect.ownKeys(
|
|
4156
|
+
for (const key of Reflect.ownKeys(input2)) {
|
|
4155
4157
|
if (key === "__proto__")
|
|
4156
4158
|
continue;
|
|
4157
|
-
if (!Object.prototype.propertyIsEnumerable.call(
|
|
4159
|
+
if (!Object.prototype.propertyIsEnumerable.call(input2, key))
|
|
4158
4160
|
continue;
|
|
4159
4161
|
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
4160
4162
|
if (keyResult instanceof Promise) {
|
|
@@ -4172,7 +4174,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4172
4174
|
}
|
|
4173
4175
|
if (keyResult.issues.length) {
|
|
4174
4176
|
if (def.mode === "loose") {
|
|
4175
|
-
payload.value[key] =
|
|
4177
|
+
payload.value[key] = input2[key];
|
|
4176
4178
|
} else {
|
|
4177
4179
|
payload.issues.push({
|
|
4178
4180
|
code: "invalid_key",
|
|
@@ -4185,7 +4187,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4185
4187
|
}
|
|
4186
4188
|
continue;
|
|
4187
4189
|
}
|
|
4188
|
-
const result = def.valueType._zod.run({ value:
|
|
4190
|
+
const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
4189
4191
|
if (result instanceof Promise) {
|
|
4190
4192
|
proms.push(result.then((result2) => {
|
|
4191
4193
|
if (result2.issues.length) {
|
|
@@ -4210,27 +4212,27 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4210
4212
|
var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
4211
4213
|
$ZodType.init(inst, def);
|
|
4212
4214
|
inst._zod.parse = (payload, ctx) => {
|
|
4213
|
-
const
|
|
4214
|
-
if (!(
|
|
4215
|
+
const input2 = payload.value;
|
|
4216
|
+
if (!(input2 instanceof Map)) {
|
|
4215
4217
|
payload.issues.push({
|
|
4216
4218
|
expected: "map",
|
|
4217
4219
|
code: "invalid_type",
|
|
4218
|
-
input,
|
|
4220
|
+
input: input2,
|
|
4219
4221
|
inst
|
|
4220
4222
|
});
|
|
4221
4223
|
return payload;
|
|
4222
4224
|
}
|
|
4223
4225
|
const proms = [];
|
|
4224
4226
|
payload.value = /* @__PURE__ */ new Map();
|
|
4225
|
-
for (const [key, value] of
|
|
4227
|
+
for (const [key, value] of input2) {
|
|
4226
4228
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
4227
4229
|
const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
|
|
4228
4230
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
4229
4231
|
proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
|
|
4230
|
-
handleMapResult(keyResult2, valueResult2, payload, key,
|
|
4232
|
+
handleMapResult(keyResult2, valueResult2, payload, key, input2, inst, ctx);
|
|
4231
4233
|
}));
|
|
4232
4234
|
} else {
|
|
4233
|
-
handleMapResult(keyResult, valueResult, payload, key,
|
|
4235
|
+
handleMapResult(keyResult, valueResult, payload, key, input2, inst, ctx);
|
|
4234
4236
|
}
|
|
4235
4237
|
}
|
|
4236
4238
|
if (proms.length)
|
|
@@ -4238,7 +4240,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
|
4238
4240
|
return payload;
|
|
4239
4241
|
};
|
|
4240
4242
|
});
|
|
4241
|
-
function handleMapResult(keyResult, valueResult, final, key,
|
|
4243
|
+
function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
|
|
4242
4244
|
if (keyResult.issues.length) {
|
|
4243
4245
|
if (propertyKeyTypes.has(typeof key)) {
|
|
4244
4246
|
final.issues.push(...prefixIssues(key, keyResult.issues));
|
|
@@ -4246,7 +4248,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
4246
4248
|
final.issues.push({
|
|
4247
4249
|
code: "invalid_key",
|
|
4248
4250
|
origin: "map",
|
|
4249
|
-
input,
|
|
4251
|
+
input: input2,
|
|
4250
4252
|
inst,
|
|
4251
4253
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
4252
4254
|
});
|
|
@@ -4259,7 +4261,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
4259
4261
|
final.issues.push({
|
|
4260
4262
|
origin: "map",
|
|
4261
4263
|
code: "invalid_element",
|
|
4262
|
-
input,
|
|
4264
|
+
input: input2,
|
|
4263
4265
|
inst,
|
|
4264
4266
|
key,
|
|
4265
4267
|
issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
@@ -4271,10 +4273,10 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
4271
4273
|
var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
4272
4274
|
$ZodType.init(inst, def);
|
|
4273
4275
|
inst._zod.parse = (payload, ctx) => {
|
|
4274
|
-
const
|
|
4275
|
-
if (!(
|
|
4276
|
+
const input2 = payload.value;
|
|
4277
|
+
if (!(input2 instanceof Set)) {
|
|
4276
4278
|
payload.issues.push({
|
|
4277
|
-
input,
|
|
4279
|
+
input: input2,
|
|
4278
4280
|
inst,
|
|
4279
4281
|
expected: "set",
|
|
4280
4282
|
code: "invalid_type"
|
|
@@ -4283,7 +4285,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
|
4283
4285
|
}
|
|
4284
4286
|
const proms = [];
|
|
4285
4287
|
payload.value = /* @__PURE__ */ new Set();
|
|
4286
|
-
for (const item of
|
|
4288
|
+
for (const item of input2) {
|
|
4287
4289
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
4288
4290
|
if (result instanceof Promise) {
|
|
4289
4291
|
proms.push(result.then((result2) => handleSetResult(result2, payload)));
|
|
@@ -4308,14 +4310,14 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
4308
4310
|
inst._zod.values = valuesSet;
|
|
4309
4311
|
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
4310
4312
|
inst._zod.parse = (payload, _ctx) => {
|
|
4311
|
-
const
|
|
4312
|
-
if (valuesSet.has(
|
|
4313
|
+
const input2 = payload.value;
|
|
4314
|
+
if (valuesSet.has(input2)) {
|
|
4313
4315
|
return payload;
|
|
4314
4316
|
}
|
|
4315
4317
|
payload.issues.push({
|
|
4316
4318
|
code: "invalid_value",
|
|
4317
4319
|
values,
|
|
4318
|
-
input,
|
|
4320
|
+
input: input2,
|
|
4319
4321
|
inst
|
|
4320
4322
|
});
|
|
4321
4323
|
return payload;
|
|
@@ -4330,14 +4332,14 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
4330
4332
|
inst._zod.values = values;
|
|
4331
4333
|
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
4332
4334
|
inst._zod.parse = (payload, _ctx) => {
|
|
4333
|
-
const
|
|
4334
|
-
if (values.has(
|
|
4335
|
+
const input2 = payload.value;
|
|
4336
|
+
if (values.has(input2)) {
|
|
4335
4337
|
return payload;
|
|
4336
4338
|
}
|
|
4337
4339
|
payload.issues.push({
|
|
4338
4340
|
code: "invalid_value",
|
|
4339
4341
|
values: def.values,
|
|
4340
|
-
input,
|
|
4342
|
+
input: input2,
|
|
4341
4343
|
inst
|
|
4342
4344
|
});
|
|
4343
4345
|
return payload;
|
|
@@ -4346,13 +4348,13 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
4346
4348
|
var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
|
|
4347
4349
|
$ZodType.init(inst, def);
|
|
4348
4350
|
inst._zod.parse = (payload, _ctx) => {
|
|
4349
|
-
const
|
|
4350
|
-
if (
|
|
4351
|
+
const input2 = payload.value;
|
|
4352
|
+
if (input2 instanceof File)
|
|
4351
4353
|
return payload;
|
|
4352
4354
|
payload.issues.push({
|
|
4353
4355
|
expected: "file",
|
|
4354
4356
|
code: "invalid_type",
|
|
4355
|
-
input,
|
|
4357
|
+
input: input2,
|
|
4356
4358
|
inst
|
|
4357
4359
|
});
|
|
4358
4360
|
return payload;
|
|
@@ -4382,8 +4384,8 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
|
|
|
4382
4384
|
return payload;
|
|
4383
4385
|
};
|
|
4384
4386
|
});
|
|
4385
|
-
function handleOptionalResult(result,
|
|
4386
|
-
if (
|
|
4387
|
+
function handleOptionalResult(result, input2) {
|
|
4388
|
+
if (input2 === void 0 && (result.issues.length || result.fallback)) {
|
|
4387
4389
|
return { issues: [], value: void 0 };
|
|
4388
4390
|
}
|
|
4389
4391
|
return result;
|
|
@@ -4401,11 +4403,11 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
|
4401
4403
|
});
|
|
4402
4404
|
inst._zod.parse = (payload, ctx) => {
|
|
4403
4405
|
if (def.innerType._zod.optin === "optional") {
|
|
4404
|
-
const
|
|
4406
|
+
const input2 = payload.value;
|
|
4405
4407
|
const result = def.innerType._zod.run(payload, ctx);
|
|
4406
4408
|
if (result instanceof Promise)
|
|
4407
|
-
return result.then((r) => handleOptionalResult(r,
|
|
4408
|
-
return handleOptionalResult(result,
|
|
4409
|
+
return result.then((r) => handleOptionalResult(r, input2));
|
|
4410
|
+
return handleOptionalResult(result, input2);
|
|
4409
4411
|
}
|
|
4410
4412
|
if (payload.value === void 0) {
|
|
4411
4413
|
return payload;
|
|
@@ -4830,20 +4832,20 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
|
4830
4832
|
return payload;
|
|
4831
4833
|
};
|
|
4832
4834
|
inst._zod.check = (payload) => {
|
|
4833
|
-
const
|
|
4834
|
-
const r = def.fn(
|
|
4835
|
+
const input2 = payload.value;
|
|
4836
|
+
const r = def.fn(input2);
|
|
4835
4837
|
if (r instanceof Promise) {
|
|
4836
|
-
return r.then((r2) => handleRefineResult(r2, payload,
|
|
4838
|
+
return r.then((r2) => handleRefineResult(r2, payload, input2, inst));
|
|
4837
4839
|
}
|
|
4838
|
-
handleRefineResult(r, payload,
|
|
4840
|
+
handleRefineResult(r, payload, input2, inst);
|
|
4839
4841
|
return;
|
|
4840
4842
|
};
|
|
4841
4843
|
});
|
|
4842
|
-
function handleRefineResult(result, payload,
|
|
4844
|
+
function handleRefineResult(result, payload, input2, inst) {
|
|
4843
4845
|
if (!result) {
|
|
4844
4846
|
const _iss = {
|
|
4845
4847
|
code: "custom",
|
|
4846
|
-
input,
|
|
4848
|
+
input: input2,
|
|
4847
4849
|
inst,
|
|
4848
4850
|
// incorporates params.error into issue reporting
|
|
4849
4851
|
path: [...inst._zod.def.path ?? []],
|
|
@@ -8130,8 +8132,8 @@ function ko_default() {
|
|
|
8130
8132
|
}
|
|
8131
8133
|
|
|
8132
8134
|
// ../../../node_modules/zod/v4/locales/lt.js
|
|
8133
|
-
var capitalizeFirstCharacter = (
|
|
8134
|
-
return
|
|
8135
|
+
var capitalizeFirstCharacter = (text2) => {
|
|
8136
|
+
return text2.charAt(0).toUpperCase() + text2.slice(1);
|
|
8135
8137
|
};
|
|
8136
8138
|
function getUnitTypeFromNumber(number4) {
|
|
8137
8139
|
const abs = Math.abs(number4);
|
|
@@ -11531,23 +11533,23 @@ function _overwrite(tx) {
|
|
|
11531
11533
|
}
|
|
11532
11534
|
// @__NO_SIDE_EFFECTS__
|
|
11533
11535
|
function _normalize(form) {
|
|
11534
|
-
return /* @__PURE__ */ _overwrite((
|
|
11536
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.normalize(form));
|
|
11535
11537
|
}
|
|
11536
11538
|
// @__NO_SIDE_EFFECTS__
|
|
11537
11539
|
function _trim() {
|
|
11538
|
-
return /* @__PURE__ */ _overwrite((
|
|
11540
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.trim());
|
|
11539
11541
|
}
|
|
11540
11542
|
// @__NO_SIDE_EFFECTS__
|
|
11541
11543
|
function _toLowerCase() {
|
|
11542
|
-
return /* @__PURE__ */ _overwrite((
|
|
11544
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.toLowerCase());
|
|
11543
11545
|
}
|
|
11544
11546
|
// @__NO_SIDE_EFFECTS__
|
|
11545
11547
|
function _toUpperCase() {
|
|
11546
|
-
return /* @__PURE__ */ _overwrite((
|
|
11548
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.toUpperCase());
|
|
11547
11549
|
}
|
|
11548
11550
|
// @__NO_SIDE_EFFECTS__
|
|
11549
11551
|
function _slugify() {
|
|
11550
|
-
return /* @__PURE__ */ _overwrite((
|
|
11552
|
+
return /* @__PURE__ */ _overwrite((input2) => slugify(input2));
|
|
11551
11553
|
}
|
|
11552
11554
|
// @__NO_SIDE_EFFECTS__
|
|
11553
11555
|
function _array(Class2, element, params) {
|
|
@@ -11852,8 +11854,8 @@ function _stringbool(Classes, _params) {
|
|
|
11852
11854
|
type: "pipe",
|
|
11853
11855
|
in: stringSchema,
|
|
11854
11856
|
out: booleanSchema,
|
|
11855
|
-
transform: ((
|
|
11856
|
-
let data =
|
|
11857
|
+
transform: ((input2, payload) => {
|
|
11858
|
+
let data = input2;
|
|
11857
11859
|
if (params.case !== "sensitive")
|
|
11858
11860
|
data = data.toLowerCase();
|
|
11859
11861
|
if (truthySet.has(data)) {
|
|
@@ -11872,8 +11874,8 @@ function _stringbool(Classes, _params) {
|
|
|
11872
11874
|
return {};
|
|
11873
11875
|
}
|
|
11874
11876
|
}),
|
|
11875
|
-
reverseTransform: ((
|
|
11876
|
-
if (
|
|
11877
|
+
reverseTransform: ((input2, _payload) => {
|
|
11878
|
+
if (input2 === true) {
|
|
11877
11879
|
return truthyArray[0] || "true";
|
|
11878
11880
|
} else {
|
|
11879
11881
|
return falsyArray[0] || "false";
|
|
@@ -11983,26 +11985,26 @@ function extractDefs(ctx, schema) {
|
|
|
11983
11985
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
11984
11986
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
11985
11987
|
for (const entry of ctx.seen.entries()) {
|
|
11986
|
-
const
|
|
11987
|
-
if (
|
|
11988
|
-
const existing = idToSchema.get(
|
|
11988
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
11989
|
+
if (id2) {
|
|
11990
|
+
const existing = idToSchema.get(id2);
|
|
11989
11991
|
if (existing && existing !== entry[0]) {
|
|
11990
|
-
throw new Error(`Duplicate schema id "${
|
|
11992
|
+
throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
11991
11993
|
}
|
|
11992
|
-
idToSchema.set(
|
|
11994
|
+
idToSchema.set(id2, entry[0]);
|
|
11993
11995
|
}
|
|
11994
11996
|
}
|
|
11995
11997
|
const makeURI = (entry) => {
|
|
11996
11998
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
11997
11999
|
if (ctx.external) {
|
|
11998
12000
|
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
11999
|
-
const uriGenerator = ctx.external.uri ?? ((
|
|
12001
|
+
const uriGenerator = ctx.external.uri ?? ((id3) => id3);
|
|
12000
12002
|
if (externalId) {
|
|
12001
12003
|
return { ref: uriGenerator(externalId) };
|
|
12002
12004
|
}
|
|
12003
|
-
const
|
|
12004
|
-
entry[1].defId =
|
|
12005
|
-
return { defId:
|
|
12005
|
+
const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
12006
|
+
entry[1].defId = id2;
|
|
12007
|
+
return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id2}` };
|
|
12006
12008
|
}
|
|
12007
12009
|
if (entry[1] === root) {
|
|
12008
12010
|
return { ref: "#" };
|
|
@@ -12050,8 +12052,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12050
12052
|
continue;
|
|
12051
12053
|
}
|
|
12052
12054
|
}
|
|
12053
|
-
const
|
|
12054
|
-
if (
|
|
12055
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
12056
|
+
if (id2) {
|
|
12055
12057
|
extractToDef(entry);
|
|
12056
12058
|
continue;
|
|
12057
12059
|
}
|
|
@@ -12147,10 +12149,10 @@ function finalize(ctx, schema) {
|
|
|
12147
12149
|
} else {
|
|
12148
12150
|
}
|
|
12149
12151
|
if (ctx.external?.uri) {
|
|
12150
|
-
const
|
|
12151
|
-
if (!
|
|
12152
|
+
const id2 = ctx.external.registry.get(schema)?.id;
|
|
12153
|
+
if (!id2)
|
|
12152
12154
|
throw new Error("Schema is missing an `id` property");
|
|
12153
|
-
result.$id = ctx.external.uri(
|
|
12155
|
+
result.$id = ctx.external.uri(id2);
|
|
12154
12156
|
}
|
|
12155
12157
|
Object.assign(result, root.def ?? root.schema);
|
|
12156
12158
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
@@ -12310,9 +12312,9 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
12310
12312
|
json2.type = "number";
|
|
12311
12313
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
12312
12314
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
12313
|
-
const
|
|
12315
|
+
const legacy2 = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
12314
12316
|
if (exMin) {
|
|
12315
|
-
if (
|
|
12317
|
+
if (legacy2) {
|
|
12316
12318
|
json2.minimum = exclusiveMinimum;
|
|
12317
12319
|
json2.exclusiveMinimum = true;
|
|
12318
12320
|
} else {
|
|
@@ -12322,7 +12324,7 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
12322
12324
|
json2.minimum = minimum;
|
|
12323
12325
|
}
|
|
12324
12326
|
if (exMax) {
|
|
12325
|
-
if (
|
|
12327
|
+
if (legacy2) {
|
|
12326
12328
|
json2.maximum = exclusiveMaximum;
|
|
12327
12329
|
json2.exclusiveMaximum = true;
|
|
12328
12330
|
} else {
|
|
@@ -12769,9 +12771,9 @@ var allProcessors = {
|
|
|
12769
12771
|
optional: optionalProcessor,
|
|
12770
12772
|
lazy: lazyProcessor
|
|
12771
12773
|
};
|
|
12772
|
-
function toJSONSchema(
|
|
12773
|
-
if ("_idmap" in
|
|
12774
|
-
const registry2 =
|
|
12774
|
+
function toJSONSchema(input2, params) {
|
|
12775
|
+
if ("_idmap" in input2) {
|
|
12776
|
+
const registry2 = input2;
|
|
12775
12777
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
12776
12778
|
const defs = {};
|
|
12777
12779
|
for (const entry of registry2._idmap.entries()) {
|
|
@@ -12799,9 +12801,9 @@ function toJSONSchema(input, params) {
|
|
|
12799
12801
|
return { schemas };
|
|
12800
12802
|
}
|
|
12801
12803
|
const ctx = initializeContext({ ...params, processors: allProcessors });
|
|
12802
|
-
process2(
|
|
12803
|
-
extractDefs(ctx,
|
|
12804
|
-
return finalize(ctx,
|
|
12804
|
+
process2(input2, ctx);
|
|
12805
|
+
extractDefs(ctx, input2);
|
|
12806
|
+
return finalize(ctx, input2);
|
|
12805
12807
|
}
|
|
12806
12808
|
|
|
12807
12809
|
// ../../../node_modules/zod/v4/core/json-schema-generator.js
|
|
@@ -13184,7 +13186,7 @@ var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
|
13184
13186
|
|
|
13185
13187
|
// ../../../node_modules/zod/v4/classic/schemas.js
|
|
13186
13188
|
var _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
13187
|
-
function _installLazyMethods(inst, group,
|
|
13189
|
+
function _installLazyMethods(inst, group, methods3) {
|
|
13188
13190
|
const proto = Object.getPrototypeOf(inst);
|
|
13189
13191
|
let installed = _installedGroups.get(proto);
|
|
13190
13192
|
if (!installed) {
|
|
@@ -13194,8 +13196,8 @@ function _installLazyMethods(inst, group, methods2) {
|
|
|
13194
13196
|
if (installed.has(group))
|
|
13195
13197
|
return;
|
|
13196
13198
|
installed.add(group);
|
|
13197
|
-
for (const key in
|
|
13198
|
-
const fn =
|
|
13199
|
+
for (const key in methods3) {
|
|
13200
|
+
const fn = methods3[key];
|
|
13199
13201
|
Object.defineProperty(proto, key, {
|
|
13200
13202
|
configurable: true,
|
|
13201
13203
|
enumerable: false,
|
|
@@ -15006,87 +15008,6 @@ function date4(params) {
|
|
|
15006
15008
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
15007
15009
|
config(en_default());
|
|
15008
15010
|
|
|
15009
|
-
// ../../shared-contracts/dist/ids.js
|
|
15010
|
-
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15011
|
-
message: "Identifier must not be empty or whitespace"
|
|
15012
|
-
});
|
|
15013
|
-
var harnessIdSchema = opaqueIdSchema.brand();
|
|
15014
|
-
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
15015
|
-
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
15016
|
-
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
15017
|
-
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
15018
|
-
|
|
15019
|
-
// ../../shared-contracts/dist/harness-plugins.js
|
|
15020
|
-
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
15021
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
15022
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
15023
|
-
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
15024
|
-
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
15025
|
-
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
|
|
15026
|
-
var pluginRelativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
|
|
15027
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
15028
|
-
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
15029
|
-
var harnessInstallationGuideSchema = external_exports.object({
|
|
15030
|
-
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
15031
|
-
before: localizedTextSchema.optional(),
|
|
15032
|
-
after: localizedTextSchema.optional(),
|
|
15033
|
-
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
15034
|
-
}).strict();
|
|
15035
|
-
var pluginPresentationShape = {
|
|
15036
|
-
id: installedHarnessPluginIdSchema,
|
|
15037
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
15038
|
-
version: external_exports.string().min(1).max(128),
|
|
15039
|
-
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
15040
|
-
kind: external_exports.literal("usage").optional(),
|
|
15041
|
-
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
15042
|
-
iconStyle: external_exports.object({
|
|
15043
|
-
vector: external_exports.object({
|
|
15044
|
-
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
15045
|
-
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
15046
|
-
paths: external_exports.array(external_exports.object({
|
|
15047
|
-
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
15048
|
-
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
15049
|
-
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
15050
|
-
}).strict()).min(1).max(32)
|
|
15051
|
-
}).strict().optional(),
|
|
15052
|
-
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
15053
|
-
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
15054
|
-
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
15055
|
-
}).strict().optional(),
|
|
15056
|
-
installation: harnessInstallationGuideSchema.optional(),
|
|
15057
|
-
notice: localizedTextSchema.optional(),
|
|
15058
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
15059
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
15060
|
-
links: external_exports.object({
|
|
15061
|
-
website: documentationUrlSchema.optional(),
|
|
15062
|
-
documentation: documentationUrlSchema.optional(),
|
|
15063
|
-
installation: documentationUrlSchema.optional()
|
|
15064
|
-
}).strict().optional()
|
|
15065
|
-
};
|
|
15066
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
15067
|
-
manifestVersion: external_exports.literal(1),
|
|
15068
|
-
...pluginPresentationShape,
|
|
15069
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
15070
|
-
entry: pluginRelativeResourceSchema,
|
|
15071
|
-
icon: pluginRelativeResourceSchema.optional()
|
|
15072
|
-
}).strict();
|
|
15073
|
-
var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
15074
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
15075
|
-
...pluginPresentationShape,
|
|
15076
|
-
icon: harnessPluginIconSchema.optional()
|
|
15077
|
-
}).strict();
|
|
15078
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
15079
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
15080
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
15081
|
-
}).strict();
|
|
15082
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
15083
|
-
version: external_exports.literal(1),
|
|
15084
|
-
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
15085
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
15086
|
-
message: "Enabled plugin IDs must be unique",
|
|
15087
|
-
path: ["enabled"]
|
|
15088
|
-
});
|
|
15089
|
-
|
|
15090
15011
|
// ../../shared-contracts/dist/json-value.js
|
|
15091
15012
|
function rejectExplicitUndefined(keys) {
|
|
15092
15013
|
return (value, context) => {
|
|
@@ -15146,403 +15067,73 @@ var jsonValueSchema = nonCircularSchema.pipe(recursiveJsonValueSchema);
|
|
|
15146
15067
|
var jsonArraySchema = nonCircularSchema.pipe(external_exports.array(recursiveJsonValueSchema));
|
|
15147
15068
|
var jsonObjectSchema = nonCircularSchema.pipe(external_exports.record(external_exports.string(), recursiveJsonValueSchema));
|
|
15148
15069
|
|
|
15149
|
-
// ../../shared-contracts/dist/
|
|
15150
|
-
var
|
|
15151
|
-
|
|
15152
|
-
|
|
15153
|
-
|
|
15154
|
-
|
|
15155
|
-
|
|
15156
|
-
|
|
15157
|
-
|
|
15158
|
-
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
var
|
|
15162
|
-
var
|
|
15163
|
-
var
|
|
15164
|
-
|
|
15165
|
-
|
|
15166
|
-
|
|
15167
|
-
|
|
15168
|
-
|
|
15169
|
-
|
|
15170
|
-
var
|
|
15171
|
-
"
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15176
|
-
|
|
15177
|
-
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
|
|
15183
|
-
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15070
|
+
// ../../shared-contracts/dist/errors.js
|
|
15071
|
+
var codexhostErrorSchema = external_exports.strictObject({
|
|
15072
|
+
code: external_exports.string().min(1),
|
|
15073
|
+
message: external_exports.string().min(1),
|
|
15074
|
+
retryable: external_exports.boolean(),
|
|
15075
|
+
diagnostic: external_exports.string().min(1).optional(),
|
|
15076
|
+
stage: external_exports.string().min(1).optional(),
|
|
15077
|
+
durationMs: external_exports.number().int().nonnegative().optional(),
|
|
15078
|
+
stderrTail: external_exports.string().min(1).optional()
|
|
15079
|
+
}).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
|
|
15080
|
+
|
|
15081
|
+
// ../../shared-contracts/dist/harness-presentation.js
|
|
15082
|
+
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
15083
|
+
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
|
|
15084
|
+
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
15085
|
+
label: displayText(256).optional(),
|
|
15086
|
+
description: displayText(1024).optional()
|
|
15087
|
+
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
15088
|
+
var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
15089
|
+
|
|
15090
|
+
// ../../shared-contracts/dist/ids.js
|
|
15091
|
+
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15092
|
+
message: "Identifier must not be empty or whitespace"
|
|
15093
|
+
});
|
|
15094
|
+
var harnessIdSchema = opaqueIdSchema.brand();
|
|
15095
|
+
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
15096
|
+
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
15097
|
+
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
15098
|
+
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
15099
|
+
|
|
15100
|
+
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
15101
|
+
var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
|
|
15102
|
+
var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
|
|
15103
|
+
var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
|
|
15104
|
+
var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
|
|
15105
|
+
var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15106
|
+
message: "Value must not be empty or whitespace"
|
|
15107
|
+
});
|
|
15108
|
+
var harnessPermissionModeIdSchema = nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~:-]+$/u, "Permission Mode ID must use transport-safe characters").brand();
|
|
15109
|
+
var harnessPermissionModeSchema = external_exports.object({
|
|
15110
|
+
id: harnessPermissionModeIdSchema,
|
|
15111
|
+
label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
|
|
15112
|
+
description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
15113
|
+
dangerous: external_exports.boolean().optional(),
|
|
15114
|
+
localizations: harnessLocalizationsSchema.optional()
|
|
15115
|
+
}).strict();
|
|
15116
|
+
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
15117
|
+
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
15118
|
+
defaultModeId: harnessPermissionModeIdSchema
|
|
15119
|
+
}).strict().superRefine((catalog, context) => {
|
|
15120
|
+
const ids = /* @__PURE__ */ new Set();
|
|
15121
|
+
for (const [index, mode] of catalog.modes.entries()) {
|
|
15122
|
+
if (ids.has(mode.id)) {
|
|
15123
|
+
context.addIssue({
|
|
15124
|
+
code: "custom",
|
|
15125
|
+
message: "Permission Mode IDs must be unique",
|
|
15126
|
+
path: ["modes", index, "id"]
|
|
15127
|
+
});
|
|
15128
|
+
}
|
|
15129
|
+
ids.add(mode.id);
|
|
15190
15130
|
}
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
|
|
15195
|
-
|
|
15196
|
-
|
|
15197
|
-
return "image/svg+xml";
|
|
15198
|
-
case "woff2":
|
|
15199
|
-
return "font/woff2";
|
|
15200
|
-
case "json":
|
|
15201
|
-
return "application/json";
|
|
15202
|
-
case "css":
|
|
15203
|
-
return "text/css";
|
|
15204
|
-
default:
|
|
15205
|
-
return desktopExtensionScreenshotMimeType(resource);
|
|
15206
|
-
}
|
|
15207
|
-
}
|
|
15208
|
-
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
15209
|
-
var desktopExtensionAssetPathSchema = pluginRelativeResourceSchema.refine((resource) => hasPortableSegments(resource) && desktopExtensionAssetMimeType(resource) !== void 0, "Expected a relative Desktop extension asset path with a supported suffix");
|
|
15210
|
-
var imagePathSchema = pluginRelativeResourceSchema.refine((resource) => desktopExtensionScreenshotMimeType(resource) !== void 0 && hasPortableSegments(resource), "Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space");
|
|
15211
|
-
var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu, "Expected an HTTP(S) URL").pipe(external_exports.url({ protocol: /^https?$/u })).refine((value) => {
|
|
15212
|
-
const { username, password } = new URL(value);
|
|
15213
|
-
return !username && !password && !/[\\\s]/u.test(value);
|
|
15214
|
-
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
15215
|
-
function localizedText(text) {
|
|
15216
|
-
return external_exports.strictObject({ en: text, "zh-CN": text });
|
|
15217
|
-
}
|
|
15218
|
-
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
15219
|
-
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
15220
|
-
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
15221
|
-
var settingField = {
|
|
15222
|
-
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
15223
|
-
label: desktopExtensionLocalizedTextSchema,
|
|
15224
|
-
description: desktopExtensionLocalizedTextSchema.optional()
|
|
15225
|
-
};
|
|
15226
|
-
var numericSetting = {
|
|
15227
|
-
...settingField,
|
|
15228
|
-
step: external_exports.number().positive().optional(),
|
|
15229
|
-
default: external_exports.number().optional()
|
|
15230
|
-
};
|
|
15231
|
-
var settingOption = external_exports.strictObject({
|
|
15232
|
-
value: external_exports.string(),
|
|
15233
|
-
label: desktopExtensionLocalizedTextSchema
|
|
15234
|
-
});
|
|
15235
|
-
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
15236
|
-
external_exports.strictObject({
|
|
15237
|
-
...settingField,
|
|
15238
|
-
type: external_exports.literal("boolean"),
|
|
15239
|
-
default: external_exports.boolean().optional()
|
|
15240
|
-
}),
|
|
15241
|
-
external_exports.strictObject({
|
|
15242
|
-
...settingField,
|
|
15243
|
-
type: external_exports.literal("string"),
|
|
15244
|
-
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
15245
|
-
default: external_exports.string().optional()
|
|
15246
|
-
}),
|
|
15247
|
-
external_exports.strictObject({
|
|
15248
|
-
...numericSetting,
|
|
15249
|
-
type: external_exports.literal("number"),
|
|
15250
|
-
min: external_exports.number().optional(),
|
|
15251
|
-
max: external_exports.number().optional()
|
|
15252
|
-
}),
|
|
15253
|
-
external_exports.strictObject({
|
|
15254
|
-
...numericSetting,
|
|
15255
|
-
type: external_exports.literal("range"),
|
|
15256
|
-
min: external_exports.number(),
|
|
15257
|
-
max: external_exports.number()
|
|
15258
|
-
}),
|
|
15259
|
-
external_exports.strictObject({
|
|
15260
|
-
...settingField,
|
|
15261
|
-
type: external_exports.literal("select"),
|
|
15262
|
-
options: external_exports.array(settingOption).min(1),
|
|
15263
|
-
default: external_exports.string().optional()
|
|
15264
|
-
})
|
|
15265
|
-
]).superRefine((field2, ctx) => {
|
|
15266
|
-
const issue2 = (path10, message) => ctx.addIssue({ code: "custom", path: [path10], message });
|
|
15267
|
-
if (field2.type === "number" || field2.type === "range") {
|
|
15268
|
-
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
15269
|
-
if (min > max)
|
|
15270
|
-
issue2("max", "Must be at least min");
|
|
15271
|
-
if (value !== void 0 && (value < min || value > max))
|
|
15272
|
-
issue2("default", "Must be within min and max");
|
|
15273
|
-
} else if (field2.type === "select") {
|
|
15274
|
-
const values = new Set(field2.options.map(({ value }) => value));
|
|
15275
|
-
if (values.size !== field2.options.length)
|
|
15276
|
-
issue2("options", "Duplicate option values");
|
|
15277
|
-
if (field2.default !== void 0 && !values.has(field2.default))
|
|
15278
|
-
issue2("default", "Must match an option value");
|
|
15279
|
-
}
|
|
15280
|
-
});
|
|
15281
|
-
var manifestHeader = external_exports.object({
|
|
15282
|
-
manifestVersion: external_exports.int().positive(),
|
|
15283
|
-
id: desktopExtensionIdSchema,
|
|
15284
|
-
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
15285
|
-
version: external_exports.string().min(1).max(128),
|
|
15286
|
-
desktopApi: external_exports.int().positive()
|
|
15287
|
-
}).passthrough();
|
|
15288
|
-
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
15289
|
-
manifestVersion: external_exports.literal(1),
|
|
15290
|
-
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
15291
|
-
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
15292
|
-
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
15293
|
-
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
15294
|
-
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
15295
|
-
icon: imagePathSchema.optional(),
|
|
15296
|
-
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
15297
|
-
desktop: external_exports.strictObject({
|
|
15298
|
-
script: pluginRelativeResourceSchema,
|
|
15299
|
-
style: pluginRelativeResourceSchema.optional()
|
|
15300
|
-
}).optional(),
|
|
15301
|
-
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
15302
|
-
slots: slotsSchema.default(() => []),
|
|
15303
|
-
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
15304
|
-
categories: categoriesSchema.optional()
|
|
15305
|
-
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
15306
|
-
var desktopExtensionConfigurationSchema = external_exports.strictObject({
|
|
15307
|
-
version: external_exports.literal(1),
|
|
15308
|
-
revision: external_exports.int().nonnegative(),
|
|
15309
|
-
enabled: external_exports.array(desktopExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs"),
|
|
15310
|
-
reloadToken: external_exports.uuid().optional()
|
|
15311
|
-
});
|
|
15312
|
-
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
15313
|
-
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
15314
|
-
state: external_exports.enum([
|
|
15315
|
-
"running",
|
|
15316
|
-
"disabled",
|
|
15317
|
-
"invalid",
|
|
15318
|
-
"incompatible",
|
|
15319
|
-
"conflict",
|
|
15320
|
-
"failed",
|
|
15321
|
-
"waiting"
|
|
15322
|
-
]),
|
|
15323
|
-
hash: desktopExtensionHashSchema.optional(),
|
|
15324
|
-
error: external_exports.string().optional(),
|
|
15325
|
-
conflictWith: desktopExtensionIdSchema.optional()
|
|
15326
|
-
});
|
|
15327
|
-
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
15328
|
-
controllerPid: external_exports.int().positive(),
|
|
15329
|
-
targetId: external_exports.string().nullable(),
|
|
15330
|
-
updatedAt: external_exports.iso.datetime(),
|
|
15331
|
-
handledReloadToken: external_exports.uuid().optional(),
|
|
15332
|
-
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema)
|
|
15333
|
-
});
|
|
15334
|
-
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
15335
|
-
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
15336
|
-
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
15337
|
-
}
|
|
15338
|
-
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
|
|
15339
|
-
const url2 = new URL(input);
|
|
15340
|
-
return /\.zip$/iu.test(url2.pathname) || isGitHubDesktopExtensionZipballUrl(url2) || url2.origin === "https://github.com" && /^\/[\w-]+\/[\w.-]+\/zipball(?:\/.+)?\/?$/u.test(url2.pathname) || url2.origin === "https://codeload.github.com" && /^\/[\w-]+\/[\w.-]+\/(?:zip|zipball|legacy\.zip)\/.+$/u.test(url2.pathname);
|
|
15341
|
-
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
15342
|
-
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
15343
|
-
id: desktopExtensionIdSchema,
|
|
15344
|
-
version: external_exports.string().trim().min(1).max(128),
|
|
15345
|
-
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
15346
|
-
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
15347
|
-
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
15348
|
-
author: external_exports.string().trim().min(1).max(128),
|
|
15349
|
-
repository: desktopExtensionHttpUrlSchema,
|
|
15350
|
-
stars: external_exports.number().int().min(0).optional(),
|
|
15351
|
-
downloads: external_exports.number().int().min(0).optional(),
|
|
15352
|
-
categories: categoriesSchema.optional(),
|
|
15353
|
-
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
15354
|
-
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
15355
|
-
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15356
|
-
downloadUrl: desktopExtensionZipUrlSchema,
|
|
15357
|
-
sha256: desktopExtensionHashSchema,
|
|
15358
|
-
slots: slotsSchema.optional(),
|
|
15359
|
-
publishedAt: external_exports.string().optional(),
|
|
15360
|
-
updatedAt: external_exports.string().optional(),
|
|
15361
|
-
minCodexHostVersion: external_exports.string().optional()
|
|
15362
|
-
});
|
|
15363
|
-
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
15364
|
-
schemaVersion: external_exports.literal(1),
|
|
15365
|
-
generatedAt: external_exports.string(),
|
|
15366
|
-
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, "Duplicate extension IDs")
|
|
15367
|
-
});
|
|
15368
|
-
var DESKTOP_EXTENSIONS_ASSET_METHOD = "codexhost/desktop/extensions/asset";
|
|
15369
|
-
var DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD = "codexhost/desktop/extensions/settings/get";
|
|
15370
|
-
var DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD = "codexhost/desktop/extensions/settings/set";
|
|
15371
|
-
var DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD = "codexhost/desktop/extensions/backend/invoke";
|
|
15372
|
-
var extensionIdParams = { id: desktopExtensionIdSchema };
|
|
15373
|
-
var desktopExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
15374
|
-
...extensionIdParams,
|
|
15375
|
-
path: desktopExtensionAssetPathSchema
|
|
15376
|
-
});
|
|
15377
|
-
var desktopExtensionsAssetResultSchema = external_exports.strictObject({
|
|
15378
|
-
mimeType: external_exports.string(),
|
|
15379
|
-
dataUrl: external_exports.string()
|
|
15380
|
-
});
|
|
15381
|
-
var desktopExtensionsSettingsGetParamsSchema = external_exports.strictObject(extensionIdParams);
|
|
15382
|
-
var desktopExtensionsSettingsSetParamsSchema = external_exports.strictObject({
|
|
15383
|
-
...extensionIdParams,
|
|
15384
|
-
values: jsonObjectSchema
|
|
15385
|
-
});
|
|
15386
|
-
var desktopExtensionsSettingsResultSchema = external_exports.strictObject({ values: jsonObjectSchema });
|
|
15387
|
-
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
15388
|
-
var desktopExtensionsBackendInvokeParamsSchema = external_exports.strictObject({
|
|
15389
|
-
...extensionIdParams,
|
|
15390
|
-
method: desktopExtensionBackendMethodSchema,
|
|
15391
|
-
params: jsonValueSchema.optional()
|
|
15392
|
-
});
|
|
15393
|
-
var desktopExtensionsBackendInvokeResultSchema = external_exports.strictObject({
|
|
15394
|
-
result: jsonValueSchema
|
|
15395
|
-
});
|
|
15396
|
-
|
|
15397
|
-
// ../../shared-contracts/dist/desktop-extension-management.js
|
|
15398
|
-
var DESKTOP_EXTENSIONS_LIST_METHOD = "codexhost/desktop/extensions/list";
|
|
15399
|
-
var DESKTOP_EXTENSIONS_ENABLE_METHOD = "codexhost/desktop/extensions/enable";
|
|
15400
|
-
var DESKTOP_EXTENSIONS_DISABLE_METHOD = "codexhost/desktop/extensions/disable";
|
|
15401
|
-
var DESKTOP_EXTENSIONS_CATALOG_METHOD = "codexhost/desktop/extensions/catalog";
|
|
15402
|
-
var DESKTOP_EXTENSIONS_INSTALL_METHOD = "codexhost/desktop/extensions/install";
|
|
15403
|
-
var DESKTOP_EXTENSIONS_UNINSTALL_METHOD = "codexhost/desktop/extensions/uninstall";
|
|
15404
|
-
var DESKTOP_EXTENSIONS_RECOVER_METHOD = "codexhost/desktop/extensions/disable-all-and-reload";
|
|
15405
|
-
var DESKTOP_EXTENSION_MANAGEMENT_METHODS = [
|
|
15406
|
-
DESKTOP_EXTENSIONS_LIST_METHOD,
|
|
15407
|
-
DESKTOP_EXTENSIONS_ENABLE_METHOD,
|
|
15408
|
-
DESKTOP_EXTENSIONS_DISABLE_METHOD,
|
|
15409
|
-
DESKTOP_EXTENSIONS_RECOVER_METHOD,
|
|
15410
|
-
DESKTOP_EXTENSIONS_CATALOG_METHOD,
|
|
15411
|
-
DESKTOP_EXTENSIONS_INSTALL_METHOD,
|
|
15412
|
-
DESKTOP_EXTENSIONS_UNINSTALL_METHOD,
|
|
15413
|
-
DESKTOP_EXTENSIONS_ASSET_METHOD,
|
|
15414
|
-
DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD,
|
|
15415
|
-
DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD,
|
|
15416
|
-
DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD
|
|
15417
|
-
];
|
|
15418
|
-
var revisionSchema = external_exports.int().nonnegative();
|
|
15419
|
-
var desktopExtensionsListParamsSchema = external_exports.strictObject({});
|
|
15420
|
-
var desktopExtensionSelectionParamsSchema = external_exports.strictObject({
|
|
15421
|
-
id: desktopExtensionIdSchema,
|
|
15422
|
-
expectedRevision: revisionSchema
|
|
15423
|
-
});
|
|
15424
|
-
var desktopExtensionsRecoveryParamsSchema = external_exports.strictObject({
|
|
15425
|
-
expectedRevision: revisionSchema.optional()
|
|
15426
|
-
});
|
|
15427
|
-
var rasterDataUrlSchema = (maxBytes) => external_exports.string().max("data:image/jpeg;base64,".length + 4 * Math.ceil(maxBytes / 3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
15428
|
-
var desktopExtensionListItemSchema = external_exports.strictObject({
|
|
15429
|
-
// An invalid discovery can have a directory name that isn't a valid extension ID.
|
|
15430
|
-
id: external_exports.string().min(1),
|
|
15431
|
-
manifest: desktopExtensionManifestSchema.optional(),
|
|
15432
|
-
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
15433
|
-
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15434
|
-
enabled: external_exports.boolean(),
|
|
15435
|
-
status: desktopExtensionStatusSchema
|
|
15436
|
-
});
|
|
15437
|
-
var desktopExtensionsListResultSchema = external_exports.strictObject({
|
|
15438
|
-
configuration: desktopExtensionConfigurationSchema,
|
|
15439
|
-
desktopConnected: external_exports.boolean(),
|
|
15440
|
-
diagnostics: external_exports.array(external_exports.string()),
|
|
15441
|
-
extensions: external_exports.array(desktopExtensionListItemSchema)
|
|
15442
|
-
});
|
|
15443
|
-
var desktopExtensionsCatalogParamsSchema = external_exports.strictObject({
|
|
15444
|
-
forceRefresh: external_exports.boolean().optional()
|
|
15445
|
-
});
|
|
15446
|
-
var desktopExtensionsCatalogResultSchema = external_exports.strictObject({
|
|
15447
|
-
catalogUrl: external_exports.string(),
|
|
15448
|
-
source: external_exports.enum(["remote", "fallback"]),
|
|
15449
|
-
fetchedAt: external_exports.string(),
|
|
15450
|
-
cached: external_exports.boolean(),
|
|
15451
|
-
extensions: desktopExtensionCatalogSchema.shape.extensions,
|
|
15452
|
-
error: external_exports.string().optional()
|
|
15453
|
-
});
|
|
15454
|
-
var desktopExtensionsInstallParamsSchema = external_exports.strictObject({
|
|
15455
|
-
source: external_exports.discriminatedUnion("type", [
|
|
15456
|
-
external_exports.strictObject({ type: external_exports.literal("catalog"), id: desktopExtensionIdSchema }),
|
|
15457
|
-
external_exports.strictObject({
|
|
15458
|
-
type: external_exports.literal("url"),
|
|
15459
|
-
url: desktopExtensionHttpUrlSchema,
|
|
15460
|
-
expectedSha256: desktopExtensionHashSchema.optional()
|
|
15461
|
-
}),
|
|
15462
|
-
external_exports.strictObject({
|
|
15463
|
-
type: external_exports.literal("zip-base64"),
|
|
15464
|
-
fileName: external_exports.string().trim().min(1).max(255),
|
|
15465
|
-
contentBase64: external_exports.string().min(4).max(DESKTOP_EXTENSION_ZIP_MAX_BASE64_LENGTH).refine((value) => value.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/u.test(value), "Expected standard padded base64")
|
|
15466
|
-
})
|
|
15467
|
-
])
|
|
15468
|
-
});
|
|
15469
|
-
var desktopExtensionsInstallResultSchema = external_exports.strictObject({
|
|
15470
|
-
extensionId: desktopExtensionIdSchema,
|
|
15471
|
-
version: external_exports.string().min(1),
|
|
15472
|
-
replaced: external_exports.boolean(),
|
|
15473
|
-
installedPath: external_exports.string(),
|
|
15474
|
-
list: desktopExtensionsListResultSchema
|
|
15475
|
-
});
|
|
15476
|
-
var desktopExtensionsUninstallParamsSchema = external_exports.strictObject({
|
|
15477
|
-
id: desktopExtensionIdSchema
|
|
15478
|
-
});
|
|
15479
|
-
var desktopExtensionsUninstallResultSchema = external_exports.strictObject({
|
|
15480
|
-
removedId: desktopExtensionIdSchema,
|
|
15481
|
-
list: desktopExtensionsListResultSchema
|
|
15482
|
-
});
|
|
15483
|
-
var desktopExtensionMutationResultSchema = external_exports.discriminatedUnion("state", [
|
|
15484
|
-
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: desktopExtensionConfigurationSchema }),
|
|
15485
|
-
external_exports.strictObject({ state: external_exports.literal("slot-conflict"), conflictWith: desktopExtensionIdSchema }),
|
|
15486
|
-
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: revisionSchema })
|
|
15487
|
-
]);
|
|
15488
|
-
|
|
15489
|
-
// ../../shared-contracts/dist/errors.js
|
|
15490
|
-
var codexhostErrorSchema = external_exports.strictObject({
|
|
15491
|
-
code: external_exports.string().min(1),
|
|
15492
|
-
message: external_exports.string().min(1),
|
|
15493
|
-
retryable: external_exports.boolean(),
|
|
15494
|
-
diagnostic: external_exports.string().min(1).optional(),
|
|
15495
|
-
stage: external_exports.string().min(1).optional(),
|
|
15496
|
-
durationMs: external_exports.number().int().nonnegative().optional(),
|
|
15497
|
-
stderrTail: external_exports.string().min(1).optional()
|
|
15498
|
-
}).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
|
|
15499
|
-
|
|
15500
|
-
// ../../shared-contracts/dist/harness-presentation.js
|
|
15501
|
-
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
15502
|
-
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text) => text.trim().length > 0);
|
|
15503
|
-
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
15504
|
-
label: displayText(256).optional(),
|
|
15505
|
-
description: displayText(1024).optional()
|
|
15506
|
-
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
15507
|
-
var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
15508
|
-
|
|
15509
|
-
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
15510
|
-
var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
|
|
15511
|
-
var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
|
|
15512
|
-
var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
|
|
15513
|
-
var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
|
|
15514
|
-
var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15515
|
-
message: "Value must not be empty or whitespace"
|
|
15516
|
-
});
|
|
15517
|
-
var harnessPermissionModeIdSchema = nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~:-]+$/u, "Permission Mode ID must use transport-safe characters").brand();
|
|
15518
|
-
var harnessPermissionModeSchema = external_exports.object({
|
|
15519
|
-
id: harnessPermissionModeIdSchema,
|
|
15520
|
-
label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
|
|
15521
|
-
description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
15522
|
-
dangerous: external_exports.boolean().optional(),
|
|
15523
|
-
localizations: harnessLocalizationsSchema.optional()
|
|
15524
|
-
}).strict();
|
|
15525
|
-
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
15526
|
-
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
15527
|
-
defaultModeId: harnessPermissionModeIdSchema
|
|
15528
|
-
}).strict().superRefine((catalog, context) => {
|
|
15529
|
-
const ids = /* @__PURE__ */ new Set();
|
|
15530
|
-
for (const [index, mode] of catalog.modes.entries()) {
|
|
15531
|
-
if (ids.has(mode.id)) {
|
|
15532
|
-
context.addIssue({
|
|
15533
|
-
code: "custom",
|
|
15534
|
-
message: "Permission Mode IDs must be unique",
|
|
15535
|
-
path: ["modes", index, "id"]
|
|
15536
|
-
});
|
|
15537
|
-
}
|
|
15538
|
-
ids.add(mode.id);
|
|
15539
|
-
}
|
|
15540
|
-
if (!ids.has(catalog.defaultModeId)) {
|
|
15541
|
-
context.addIssue({
|
|
15542
|
-
code: "custom",
|
|
15543
|
-
message: "Default Permission Mode must exist in the catalog",
|
|
15544
|
-
path: ["defaultModeId"]
|
|
15545
|
-
});
|
|
15131
|
+
if (!ids.has(catalog.defaultModeId)) {
|
|
15132
|
+
context.addIssue({
|
|
15133
|
+
code: "custom",
|
|
15134
|
+
message: "Default Permission Mode must exist in the catalog",
|
|
15135
|
+
path: ["defaultModeId"]
|
|
15136
|
+
});
|
|
15546
15137
|
}
|
|
15547
15138
|
});
|
|
15548
15139
|
var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
@@ -15550,6 +15141,9 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
|
15550
15141
|
permissionModeId: harnessPermissionModeIdSchema
|
|
15551
15142
|
}).strict();
|
|
15552
15143
|
|
|
15144
|
+
// ../../shared-contracts/dist/harness-route-limit.js
|
|
15145
|
+
var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
|
|
15146
|
+
|
|
15553
15147
|
// ../../shared-contracts/dist/thread-usage.js
|
|
15554
15148
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15555
15149
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -15575,14 +15169,14 @@ var usageMeasurementsSchema = external_exports.object({
|
|
|
15575
15169
|
outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
|
|
15576
15170
|
timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
|
|
15577
15171
|
}).strict();
|
|
15578
|
-
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((
|
|
15172
|
+
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
|
|
15579
15173
|
var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
15580
15174
|
kind: external_exports.literal("countdown"),
|
|
15581
15175
|
id: external_exports.string().min(1).max(64),
|
|
15582
15176
|
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
15583
15177
|
label: indicatorTextSchema(256).optional(),
|
|
15584
15178
|
tooltip: indicatorTextSchema(1024).optional()
|
|
15585
|
-
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) =>
|
|
15179
|
+
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, {
|
|
15586
15180
|
message: "Composer indicator IDs must be unique"
|
|
15587
15181
|
});
|
|
15588
15182
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
@@ -15608,6 +15202,7 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
15608
15202
|
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
15609
15203
|
sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
|
|
15610
15204
|
timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
15205
|
+
latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
15611
15206
|
costSource: external_exports.enum(["publicPrice", "native"]).optional(),
|
|
15612
15207
|
unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
|
|
15613
15208
|
}).strict().superRefine((usage, context) => {
|
|
@@ -15735,10 +15330,15 @@ var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
|
|
|
15735
15330
|
var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15736
15331
|
message: "Value must not be empty or whitespace"
|
|
15737
15332
|
});
|
|
15738
|
-
var harnessModelRefIdSchema =
|
|
15333
|
+
var harnessModelRefIdSchema = external_exports.string().min(1).max(HARNESS_MODEL_REF_MAX_LENGTH).refine((id2) => !new RegExp("\\p{Cc}", "u").test(id2), "Model Ref must not contain control characters").brand();
|
|
15334
|
+
var harnessModelServiceTierSchema = external_exports.enum(["priority", "ultrafast"]);
|
|
15739
15335
|
var harnessModelRefSchema = external_exports.object({
|
|
15740
|
-
id: harnessModelRefIdSchema
|
|
15336
|
+
id: harnessModelRefIdSchema,
|
|
15337
|
+
serviceTier: harnessModelServiceTierSchema.optional()
|
|
15741
15338
|
}).strict();
|
|
15339
|
+
function sameHarnessModelRef(left, right) {
|
|
15340
|
+
return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
|
|
15341
|
+
}
|
|
15742
15342
|
var harnessThinkingOptionIdSchema = nonBlankTextSchema2.max(HARNESS_THINKING_OPTION_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Thinking option ID must use transport-safe characters").brand();
|
|
15743
15343
|
var harnessResolvedModelLabelSchema = nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
15744
15344
|
var harnessThinkingOptionSchema = external_exports.object({
|
|
@@ -15752,7 +15352,15 @@ var harnessModelSchema = external_exports.object({
|
|
|
15752
15352
|
/** Optional opaque selection for this same Model with priority processing enabled. */
|
|
15753
15353
|
fastModel: harnessModelRefSchema.optional(),
|
|
15754
15354
|
supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
|
|
15755
|
-
}).strict()
|
|
15355
|
+
}).strict().refine((model2) => model2.fastModel?.serviceTier === void 0 || model2.fastModel.id === model2.ref.id, {
|
|
15356
|
+
path: ["fastModel", "id"],
|
|
15357
|
+
message: "A tiered Fast Model must share the base Model ID"
|
|
15358
|
+
});
|
|
15359
|
+
function catalogModelForRef(catalog, ref) {
|
|
15360
|
+
if (!ref)
|
|
15361
|
+
return void 0;
|
|
15362
|
+
return catalog?.models.find((model2) => sameHarnessModelRef(model2.ref, ref) || sameHarnessModelRef(model2.fastModel, ref));
|
|
15363
|
+
}
|
|
15756
15364
|
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
|
|
15757
15365
|
const ids = /* @__PURE__ */ new Set();
|
|
15758
15366
|
for (const [index, option] of options.entries()) {
|
|
@@ -15772,26 +15380,26 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
15772
15380
|
thinkingOptions: harnessThinkingOptionsSchema,
|
|
15773
15381
|
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
15774
15382
|
}).strict().superRefine((catalog, context) => {
|
|
15775
|
-
const refs =
|
|
15776
|
-
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) =>
|
|
15383
|
+
const refs = [];
|
|
15384
|
+
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
|
|
15777
15385
|
for (const [index, model2] of catalog.models.entries()) {
|
|
15778
|
-
if (refs.
|
|
15386
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
|
|
15779
15387
|
context.addIssue({
|
|
15780
15388
|
code: "custom",
|
|
15781
15389
|
message: "Model Catalog refs must be unique",
|
|
15782
15390
|
path: ["models", index, "ref", "id"]
|
|
15783
15391
|
});
|
|
15784
15392
|
}
|
|
15785
|
-
refs.
|
|
15393
|
+
refs.push(model2.ref);
|
|
15786
15394
|
if (model2.fastModel) {
|
|
15787
|
-
if (refs.
|
|
15395
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.fastModel))) {
|
|
15788
15396
|
context.addIssue({
|
|
15789
15397
|
code: "custom",
|
|
15790
15398
|
message: "Fast Model refs must be distinct and unique",
|
|
15791
15399
|
path: ["models", index, "fastModel"]
|
|
15792
15400
|
});
|
|
15793
15401
|
}
|
|
15794
|
-
refs.
|
|
15402
|
+
refs.push(model2.fastModel);
|
|
15795
15403
|
}
|
|
15796
15404
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
15797
15405
|
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
@@ -15812,7 +15420,7 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
15812
15420
|
}
|
|
15813
15421
|
}
|
|
15814
15422
|
}
|
|
15815
|
-
if (catalog.defaultModel && !
|
|
15423
|
+
if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
|
|
15816
15424
|
context.addIssue({
|
|
15817
15425
|
code: "custom",
|
|
15818
15426
|
message: "Default Model must exist in the Model Catalog",
|
|
@@ -15852,7 +15460,12 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
|
15852
15460
|
observe: external_exports.boolean()
|
|
15853
15461
|
}).strict().optional(),
|
|
15854
15462
|
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
15855
|
-
steer: external_exports.boolean().optional()
|
|
15463
|
+
steer: external_exports.boolean().optional(),
|
|
15464
|
+
/**
|
|
15465
|
+
* True when the native plan (task list) outlives the Turn that changed it, so a reopened
|
|
15466
|
+
* Thread gets its latest plan again. Otherwise a plan stays with the Turn that made it.
|
|
15467
|
+
*/
|
|
15468
|
+
persistentPlan: external_exports.boolean().optional()
|
|
15856
15469
|
}).strict();
|
|
15857
15470
|
var harnessConfigurationStateSchema = external_exports.object({
|
|
15858
15471
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
@@ -15861,7 +15474,7 @@ var harnessConfigurationStateSchema = external_exports.object({
|
|
|
15861
15474
|
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15862
15475
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
|
|
15863
15476
|
}).strict().superRefine((state, context) => {
|
|
15864
|
-
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) =>
|
|
15477
|
+
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
|
|
15865
15478
|
context.addIssue({
|
|
15866
15479
|
code: "custom",
|
|
15867
15480
|
message: "Effective Thinking option must be currently available",
|
|
@@ -15869,150 +15482,698 @@ var harnessConfigurationStateSchema = external_exports.object({
|
|
|
15869
15482
|
});
|
|
15870
15483
|
}
|
|
15871
15484
|
});
|
|
15872
|
-
var harnessWebUiCapabilitySchema = external_exports.object({
|
|
15873
|
-
open: external_exports.literal(true)
|
|
15874
|
-
}).strict();
|
|
15875
|
-
var readyHarnessInspectionSchema = external_exports.object({
|
|
15876
|
-
status: external_exports.literal("ready"),
|
|
15877
|
-
catalog: harnessModelCatalogSchema,
|
|
15878
|
-
permissionModes: harnessPermissionModeCatalogSchema.optional(),
|
|
15879
|
-
capabilities: harnessSessionCapabilitiesSchema,
|
|
15880
|
-
webUi: harnessWebUiCapabilitySchema.optional()
|
|
15881
|
-
}).strict().superRefine((inspection, context) => {
|
|
15882
|
-
const selectable = inspection.capabilities.configuration.selectPermissionMode;
|
|
15883
|
-
if (selectable !== Boolean(inspection.permissionModes)) {
|
|
15884
|
-
context.addIssue({
|
|
15885
|
-
code: "custom",
|
|
15886
|
-
message: "Permission Mode catalog and capability must agree",
|
|
15887
|
-
path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
|
|
15888
|
-
});
|
|
15889
|
-
}
|
|
15485
|
+
var harnessWebUiCapabilitySchema = external_exports.object({
|
|
15486
|
+
open: external_exports.literal(true)
|
|
15487
|
+
}).strict();
|
|
15488
|
+
var readyHarnessInspectionSchema = external_exports.object({
|
|
15489
|
+
status: external_exports.literal("ready"),
|
|
15490
|
+
catalog: harnessModelCatalogSchema,
|
|
15491
|
+
permissionModes: harnessPermissionModeCatalogSchema.optional(),
|
|
15492
|
+
capabilities: harnessSessionCapabilitiesSchema,
|
|
15493
|
+
webUi: harnessWebUiCapabilitySchema.optional()
|
|
15494
|
+
}).strict().superRefine((inspection, context) => {
|
|
15495
|
+
const selectable = inspection.capabilities.configuration.selectPermissionMode;
|
|
15496
|
+
if (selectable !== Boolean(inspection.permissionModes)) {
|
|
15497
|
+
context.addIssue({
|
|
15498
|
+
code: "custom",
|
|
15499
|
+
message: "Permission Mode catalog and capability must agree",
|
|
15500
|
+
path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
|
|
15501
|
+
});
|
|
15502
|
+
}
|
|
15503
|
+
});
|
|
15504
|
+
var failedHarnessInspectionSchema = external_exports.object({
|
|
15505
|
+
status: external_exports.enum(["notInstalled", "unavailable", "error"]),
|
|
15506
|
+
error: codexhostErrorSchema
|
|
15507
|
+
}).strict();
|
|
15508
|
+
var harnessInspectionSchema = external_exports.union([
|
|
15509
|
+
readyHarnessInspectionSchema,
|
|
15510
|
+
failedHarnessInspectionSchema
|
|
15511
|
+
]);
|
|
15512
|
+
var harnessInspectParamsSchema = external_exports.object({
|
|
15513
|
+
harnessId: harnessIdSchema,
|
|
15514
|
+
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
15515
|
+
refresh: external_exports.boolean().optional(),
|
|
15516
|
+
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
15517
|
+
purpose: external_exports.literal("availability").optional(),
|
|
15518
|
+
credentialAccess: external_exports.enum(["allow", "retry"]).optional()
|
|
15519
|
+
}).strict();
|
|
15520
|
+
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15521
|
+
harnessId: harnessIdSchema
|
|
15522
|
+
}).strict();
|
|
15523
|
+
var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
|
|
15524
|
+
var threadModelSelectParamsSchema = external_exports.object({
|
|
15525
|
+
threadId: hostThreadIdSchema,
|
|
15526
|
+
model: harnessModelRefSchema
|
|
15527
|
+
}).strict();
|
|
15528
|
+
var threadThinkingSelectParamsSchema = external_exports.object({
|
|
15529
|
+
threadId: hostThreadIdSchema,
|
|
15530
|
+
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
15531
|
+
}).strict();
|
|
15532
|
+
var threadInspectionParamsSchema = external_exports.object({
|
|
15533
|
+
threadId: hostThreadIdSchema,
|
|
15534
|
+
includeReferenceCapability: external_exports.boolean().optional()
|
|
15535
|
+
}).strict();
|
|
15536
|
+
var codexThreadInspectionSchema = external_exports.object({
|
|
15537
|
+
owner: external_exports.literal("codex"),
|
|
15538
|
+
locked: external_exports.boolean(),
|
|
15539
|
+
effectiveModel: harnessModelRefSchema.optional(),
|
|
15540
|
+
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15541
|
+
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15542
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15543
|
+
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
15544
|
+
supportsThreadReferences: external_exports.literal(true).optional()
|
|
15545
|
+
}).strict();
|
|
15546
|
+
var externalThreadInspectionSchema = external_exports.object({
|
|
15547
|
+
owner: external_exports.literal("external"),
|
|
15548
|
+
harnessId: nonBlankTextSchema2.max(256),
|
|
15549
|
+
transportModelId: nonBlankTextSchema2.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
|
|
15550
|
+
effectiveModel: harnessModelRefSchema.optional(),
|
|
15551
|
+
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15552
|
+
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15553
|
+
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15554
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15555
|
+
/** Live Session catalog when it, not the Adapter inspection, contains `effectiveModel`. */
|
|
15556
|
+
catalog: harnessModelCatalogSchema.optional(),
|
|
15557
|
+
history: harnessHistoryCapabilitiesSchema,
|
|
15558
|
+
usage: threadUsageSnapshotSchema.optional(),
|
|
15559
|
+
locked: external_exports.literal(true)
|
|
15560
|
+
}).strict();
|
|
15561
|
+
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
15562
|
+
codexThreadInspectionSchema,
|
|
15563
|
+
externalThreadInspectionSchema
|
|
15564
|
+
]);
|
|
15565
|
+
var threadOwnershipListParamsSchema = external_exports.object({
|
|
15566
|
+
threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15567
|
+
}).strict().superRefine(({ threadIds }, context) => {
|
|
15568
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15569
|
+
for (const [index, threadId] of threadIds.entries()) {
|
|
15570
|
+
if (seen.has(threadId)) {
|
|
15571
|
+
context.addIssue({
|
|
15572
|
+
code: "custom",
|
|
15573
|
+
message: "Thread ownership-list IDs must be unique",
|
|
15574
|
+
path: ["threadIds", index]
|
|
15575
|
+
});
|
|
15576
|
+
}
|
|
15577
|
+
seen.add(threadId);
|
|
15578
|
+
}
|
|
15579
|
+
});
|
|
15580
|
+
var codexThreadOwnershipSchema = external_exports.object({
|
|
15581
|
+
threadId: hostThreadIdSchema,
|
|
15582
|
+
owner: external_exports.literal("codex")
|
|
15583
|
+
}).strict();
|
|
15584
|
+
var externalThreadOwnershipSchema = external_exports.object({
|
|
15585
|
+
threadId: hostThreadIdSchema,
|
|
15586
|
+
owner: external_exports.literal("external"),
|
|
15587
|
+
harnessId: external_exports.string().max(256).pipe(harnessIdSchema)
|
|
15588
|
+
}).strict();
|
|
15589
|
+
var threadOwnershipSchema = external_exports.discriminatedUnion("owner", [
|
|
15590
|
+
codexThreadOwnershipSchema,
|
|
15591
|
+
externalThreadOwnershipSchema
|
|
15592
|
+
]);
|
|
15593
|
+
var threadOwnershipListResultSchema = external_exports.object({
|
|
15594
|
+
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15595
|
+
}).strict().superRefine(({ threads }, context) => {
|
|
15596
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15597
|
+
for (const [index, thread2] of threads.entries()) {
|
|
15598
|
+
if (seen.has(thread2.threadId)) {
|
|
15599
|
+
context.addIssue({
|
|
15600
|
+
code: "custom",
|
|
15601
|
+
message: "Thread ownership-list results must be unique",
|
|
15602
|
+
path: ["threads", index, "threadId"]
|
|
15603
|
+
});
|
|
15604
|
+
}
|
|
15605
|
+
seen.add(thread2.threadId);
|
|
15606
|
+
}
|
|
15607
|
+
});
|
|
15608
|
+
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
15609
|
+
threadId: hostThreadIdSchema,
|
|
15610
|
+
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15611
|
+
text: external_exports.string().optional()
|
|
15612
|
+
}).strict();
|
|
15613
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15614
|
+
kind: external_exports.literal("application"),
|
|
15615
|
+
value: external_exports.string().transform((text2, context) => {
|
|
15616
|
+
try {
|
|
15617
|
+
return JSON.parse(text2);
|
|
15618
|
+
} catch {
|
|
15619
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15620
|
+
return external_exports.NEVER;
|
|
15621
|
+
}
|
|
15622
|
+
}).pipe(external_exports.object({
|
|
15623
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15624
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15625
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15626
|
+
}).strict())
|
|
15627
|
+
}).strict().transform((context) => context.value);
|
|
15628
|
+
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15629
|
+
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15630
|
+
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15631
|
+
}).strict();
|
|
15632
|
+
|
|
15633
|
+
// ../../shared-contracts/dist/harness-plugins.js
|
|
15634
|
+
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
15635
|
+
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
15636
|
+
var HARNESS_PLUGIN_LIMIT = 128;
|
|
15637
|
+
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
15638
|
+
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
15639
|
+
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id2) => id2 !== "codex", "The official Codex identity is reserved");
|
|
15640
|
+
var pluginRelativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
|
|
15641
|
+
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
15642
|
+
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
15643
|
+
var harnessInstallationGuideSchema = external_exports.object({
|
|
15644
|
+
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
15645
|
+
before: localizedTextSchema.optional(),
|
|
15646
|
+
after: localizedTextSchema.optional(),
|
|
15647
|
+
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
15648
|
+
}).strict();
|
|
15649
|
+
var pluginPresentationShape = {
|
|
15650
|
+
id: installedHarnessPluginIdSchema,
|
|
15651
|
+
name: external_exports.string().trim().min(1).max(128),
|
|
15652
|
+
version: external_exports.string().min(1).max(128),
|
|
15653
|
+
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
15654
|
+
kind: external_exports.literal("usage").optional(),
|
|
15655
|
+
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
15656
|
+
iconStyle: external_exports.object({
|
|
15657
|
+
vector: external_exports.object({
|
|
15658
|
+
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
15659
|
+
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
15660
|
+
paths: external_exports.array(external_exports.object({
|
|
15661
|
+
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
15662
|
+
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
15663
|
+
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
15664
|
+
}).strict()).min(1).max(32)
|
|
15665
|
+
}).strict().optional(),
|
|
15666
|
+
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
15667
|
+
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
15668
|
+
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
15669
|
+
}).strict().optional(),
|
|
15670
|
+
installation: harnessInstallationGuideSchema.optional(),
|
|
15671
|
+
notice: localizedTextSchema.optional(),
|
|
15672
|
+
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
15673
|
+
launchCommand: external_exports.literal(true).optional(),
|
|
15674
|
+
links: external_exports.object({
|
|
15675
|
+
website: documentationUrlSchema.optional(),
|
|
15676
|
+
documentation: documentationUrlSchema.optional(),
|
|
15677
|
+
installation: documentationUrlSchema.optional()
|
|
15678
|
+
}).strict().optional()
|
|
15679
|
+
};
|
|
15680
|
+
var harnessPluginManifestSchema = external_exports.object({
|
|
15681
|
+
manifestVersion: external_exports.literal(1),
|
|
15682
|
+
...pluginPresentationShape,
|
|
15683
|
+
adapterApiVersion: external_exports.number().int().positive(),
|
|
15684
|
+
entry: pluginRelativeResourceSchema,
|
|
15685
|
+
icon: pluginRelativeResourceSchema.optional()
|
|
15686
|
+
}).strict();
|
|
15687
|
+
var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
15688
|
+
var harnessPluginDescriptorSchema = external_exports.object({
|
|
15689
|
+
...pluginPresentationShape,
|
|
15690
|
+
icon: harnessPluginIconSchema.optional()
|
|
15691
|
+
}).strict();
|
|
15692
|
+
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
15693
|
+
var harnessPluginListResultSchema = external_exports.object({
|
|
15694
|
+
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
15695
|
+
}).strict();
|
|
15696
|
+
var harnessPluginConfigurationSchema = external_exports.object({
|
|
15697
|
+
version: external_exports.literal(1),
|
|
15698
|
+
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
15699
|
+
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
15700
|
+
message: "Enabled plugin IDs must be unique",
|
|
15701
|
+
path: ["enabled"]
|
|
15702
|
+
});
|
|
15703
|
+
|
|
15704
|
+
// ../../shared-contracts/dist/desktop-extensions.js
|
|
15705
|
+
var DESKTOP_EXTENSION_API_VERSION = 1;
|
|
15706
|
+
var DESKTOP_EXTENSION_LIMIT = 64;
|
|
15707
|
+
var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
|
|
15708
|
+
var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
|
|
15709
|
+
var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
|
|
15710
|
+
var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
|
|
15711
|
+
var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
|
|
15712
|
+
var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
|
|
15713
|
+
var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
|
|
15714
|
+
var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
|
|
15715
|
+
var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
|
|
15716
|
+
var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
|
|
15717
|
+
var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
|
|
15718
|
+
var desktopExtensionIdSchema = installedPluginIdSchema;
|
|
15719
|
+
var desktopExtensionSlotSchema = external_exports.enum([
|
|
15720
|
+
"sidebar.thread-layout",
|
|
15721
|
+
"sidebar.thread-badge",
|
|
15722
|
+
"appearance.theme"
|
|
15723
|
+
]);
|
|
15724
|
+
var desktopExtensionCategorySchema = external_exports.enum([
|
|
15725
|
+
"appearance",
|
|
15726
|
+
"interface",
|
|
15727
|
+
"workflow",
|
|
15728
|
+
"analytics",
|
|
15729
|
+
"integrations",
|
|
15730
|
+
"tools"
|
|
15731
|
+
]);
|
|
15732
|
+
var extensionName = external_exports.string().trim().min(1).max(128);
|
|
15733
|
+
function desktopExtensionScreenshotMimeType(resource) {
|
|
15734
|
+
switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
|
|
15735
|
+
case "png":
|
|
15736
|
+
return "image/png";
|
|
15737
|
+
case "jpg":
|
|
15738
|
+
case "jpeg":
|
|
15739
|
+
return "image/jpeg";
|
|
15740
|
+
case "webp":
|
|
15741
|
+
return "image/webp";
|
|
15742
|
+
default:
|
|
15743
|
+
return void 0;
|
|
15744
|
+
}
|
|
15745
|
+
}
|
|
15746
|
+
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
15747
|
+
var imagePathSchema = pluginRelativeResourceSchema.refine((resource) => desktopExtensionScreenshotMimeType(resource) !== void 0 && hasPortableSegments(resource), "Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space");
|
|
15748
|
+
var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu, "Expected an HTTP(S) URL").pipe(external_exports.url({ protocol: /^https?$/u })).refine((value) => {
|
|
15749
|
+
const { username, password } = new URL(value);
|
|
15750
|
+
return !username && !password && !/[\\\s]/u.test(value);
|
|
15751
|
+
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
15752
|
+
function localizedText(text2) {
|
|
15753
|
+
return external_exports.strictObject({ en: text2, "zh-CN": text2 });
|
|
15754
|
+
}
|
|
15755
|
+
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
15756
|
+
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
15757
|
+
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
15758
|
+
var settingField = {
|
|
15759
|
+
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
15760
|
+
label: desktopExtensionLocalizedTextSchema,
|
|
15761
|
+
description: desktopExtensionLocalizedTextSchema.optional()
|
|
15762
|
+
};
|
|
15763
|
+
var numericSetting = {
|
|
15764
|
+
...settingField,
|
|
15765
|
+
step: external_exports.number().positive().optional(),
|
|
15766
|
+
default: external_exports.number().optional()
|
|
15767
|
+
};
|
|
15768
|
+
var settingOption = external_exports.strictObject({
|
|
15769
|
+
value: external_exports.string(),
|
|
15770
|
+
label: desktopExtensionLocalizedTextSchema
|
|
15771
|
+
});
|
|
15772
|
+
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
15773
|
+
external_exports.strictObject({
|
|
15774
|
+
...settingField,
|
|
15775
|
+
type: external_exports.literal("boolean"),
|
|
15776
|
+
default: external_exports.boolean().optional()
|
|
15777
|
+
}),
|
|
15778
|
+
external_exports.strictObject({
|
|
15779
|
+
...settingField,
|
|
15780
|
+
type: external_exports.literal("string"),
|
|
15781
|
+
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
15782
|
+
default: external_exports.string().optional()
|
|
15783
|
+
}),
|
|
15784
|
+
external_exports.strictObject({
|
|
15785
|
+
...numericSetting,
|
|
15786
|
+
type: external_exports.literal("number"),
|
|
15787
|
+
min: external_exports.number().optional(),
|
|
15788
|
+
max: external_exports.number().optional()
|
|
15789
|
+
}),
|
|
15790
|
+
external_exports.strictObject({
|
|
15791
|
+
...numericSetting,
|
|
15792
|
+
type: external_exports.literal("range"),
|
|
15793
|
+
min: external_exports.number(),
|
|
15794
|
+
max: external_exports.number()
|
|
15795
|
+
}),
|
|
15796
|
+
external_exports.strictObject({
|
|
15797
|
+
...settingField,
|
|
15798
|
+
type: external_exports.literal("select"),
|
|
15799
|
+
options: external_exports.array(settingOption).min(1),
|
|
15800
|
+
default: external_exports.string().optional()
|
|
15801
|
+
})
|
|
15802
|
+
]).superRefine((field2, ctx) => {
|
|
15803
|
+
const issue2 = (path10, message) => ctx.addIssue({ code: "custom", path: [path10], message });
|
|
15804
|
+
if (field2.type === "number" || field2.type === "range") {
|
|
15805
|
+
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
15806
|
+
if (min > max)
|
|
15807
|
+
issue2("max", "Must be at least min");
|
|
15808
|
+
if (value !== void 0 && (value < min || value > max))
|
|
15809
|
+
issue2("default", "Must be within min and max");
|
|
15810
|
+
} else if (field2.type === "select") {
|
|
15811
|
+
const values = new Set(field2.options.map(({ value }) => value));
|
|
15812
|
+
if (values.size !== field2.options.length)
|
|
15813
|
+
issue2("options", "Duplicate option values");
|
|
15814
|
+
if (field2.default !== void 0 && !values.has(field2.default))
|
|
15815
|
+
issue2("default", "Must match an option value");
|
|
15816
|
+
}
|
|
15817
|
+
});
|
|
15818
|
+
var manifestHeader = external_exports.object({
|
|
15819
|
+
manifestVersion: external_exports.int().positive(),
|
|
15820
|
+
id: desktopExtensionIdSchema,
|
|
15821
|
+
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
15822
|
+
version: external_exports.string().min(1).max(128),
|
|
15823
|
+
desktopApi: external_exports.int().positive()
|
|
15824
|
+
}).passthrough();
|
|
15825
|
+
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
15826
|
+
manifestVersion: external_exports.literal(1),
|
|
15827
|
+
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
15828
|
+
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
15829
|
+
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
15830
|
+
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
15831
|
+
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
15832
|
+
icon: imagePathSchema.optional(),
|
|
15833
|
+
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
15834
|
+
desktop: external_exports.strictObject({
|
|
15835
|
+
script: pluginRelativeResourceSchema,
|
|
15836
|
+
style: pluginRelativeResourceSchema.optional()
|
|
15837
|
+
}).optional(),
|
|
15838
|
+
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
15839
|
+
slots: slotsSchema.default(() => []),
|
|
15840
|
+
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
15841
|
+
categories: categoriesSchema.optional()
|
|
15842
|
+
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
15843
|
+
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
15844
|
+
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
15845
|
+
state: external_exports.enum([
|
|
15846
|
+
"running",
|
|
15847
|
+
"disabled",
|
|
15848
|
+
"invalid",
|
|
15849
|
+
"incompatible",
|
|
15850
|
+
"conflict",
|
|
15851
|
+
"failed",
|
|
15852
|
+
"waiting"
|
|
15853
|
+
]),
|
|
15854
|
+
hash: desktopExtensionHashSchema.optional(),
|
|
15855
|
+
error: external_exports.string().optional(),
|
|
15856
|
+
conflictWith: desktopExtensionIdSchema.optional()
|
|
15857
|
+
});
|
|
15858
|
+
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
15859
|
+
controllerPid: external_exports.int().positive(),
|
|
15860
|
+
targetId: external_exports.string().nullable(),
|
|
15861
|
+
updatedAt: external_exports.iso.datetime(),
|
|
15862
|
+
handledReloadToken: external_exports.uuid().optional(),
|
|
15863
|
+
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema),
|
|
15864
|
+
surfaces: external_exports.record(external_exports.string(), desktopExtensionStatusSchema).optional()
|
|
15865
|
+
});
|
|
15866
|
+
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
15867
|
+
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
15868
|
+
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
15869
|
+
}
|
|
15870
|
+
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input2) => {
|
|
15871
|
+
const url2 = new URL(input2);
|
|
15872
|
+
return /\.zip$/iu.test(url2.pathname) || isGitHubDesktopExtensionZipballUrl(url2) || url2.origin === "https://github.com" && /^\/[\w-]+\/[\w.-]+\/zipball(?:\/.+)?\/?$/u.test(url2.pathname) || url2.origin === "https://codeload.github.com" && /^\/[\w-]+\/[\w.-]+\/(?:zip|zipball|legacy\.zip)\/.+$/u.test(url2.pathname);
|
|
15873
|
+
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
15874
|
+
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
15875
|
+
id: desktopExtensionIdSchema,
|
|
15876
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
15877
|
+
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
15878
|
+
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
15879
|
+
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
15880
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
15881
|
+
repository: desktopExtensionHttpUrlSchema,
|
|
15882
|
+
stars: external_exports.number().int().min(0).optional(),
|
|
15883
|
+
downloads: external_exports.number().int().min(0).optional(),
|
|
15884
|
+
categories: categoriesSchema.optional(),
|
|
15885
|
+
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
15886
|
+
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
15887
|
+
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15888
|
+
downloadUrl: desktopExtensionZipUrlSchema,
|
|
15889
|
+
sha256: desktopExtensionHashSchema,
|
|
15890
|
+
slots: slotsSchema.optional(),
|
|
15891
|
+
publishedAt: external_exports.string().optional(),
|
|
15892
|
+
updatedAt: external_exports.string().optional(),
|
|
15893
|
+
minCodexHostVersion: external_exports.string().optional()
|
|
15890
15894
|
});
|
|
15891
|
-
var
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15895
|
-
|
|
15896
|
-
|
|
15897
|
-
|
|
15895
|
+
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
15896
|
+
schemaVersion: external_exports.literal(1),
|
|
15897
|
+
generatedAt: external_exports.string(),
|
|
15898
|
+
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
15899
|
+
});
|
|
15900
|
+
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
15901
|
+
|
|
15902
|
+
// ../../shared-contracts/dist/host-extensions.js
|
|
15903
|
+
var reservedName = /^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu;
|
|
15904
|
+
var HOST_EXTENSION_PAGE_API_VERSION = 1;
|
|
15905
|
+
var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedName.test(id2), "Reserved extension ID");
|
|
15906
|
+
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
15907
|
+
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
15908
|
+
var hostExtensionActivationIdSchema = external_exports.uuid();
|
|
15909
|
+
var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((path10) => path10.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
|
|
15910
|
+
var legacy = desktopExtensionManifestSchema.shape;
|
|
15911
|
+
var localized = (max, min = 0) => external_exports.strictObject({
|
|
15912
|
+
en: external_exports.string().trim().min(min).max(max),
|
|
15913
|
+
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
15914
|
+
});
|
|
15915
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path10) => path10.endsWith(suffix), `Expected a ${suffix} file`);
|
|
15916
|
+
var moduleEntry = resourceWithSuffix(".mjs");
|
|
15917
|
+
var style = resourceWithSuffix(".css").optional();
|
|
15918
|
+
var hostExtensionCanonicalPath = (path10) => path10.normalize("NFC").toLowerCase();
|
|
15919
|
+
var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
15920
|
+
manifestVersion: external_exports.literal(2),
|
|
15921
|
+
id: hostExtensionIdSchema,
|
|
15922
|
+
name: localized(128, 1),
|
|
15923
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
15924
|
+
description: localized(4096),
|
|
15925
|
+
details: localized(16384).optional(),
|
|
15926
|
+
author: legacy.author,
|
|
15927
|
+
repository: legacy.repository,
|
|
15928
|
+
icon: legacy.icon.refine((path10) => path10 === void 0 || hostExtensionResourcePathSchema.safeParse(path10).success),
|
|
15929
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path10) => hostExtensionResourcePathSchema.safeParse(path10).success)),
|
|
15930
|
+
categories: legacy.categories,
|
|
15931
|
+
settingsSchema: legacy.settingsSchema,
|
|
15932
|
+
slots: legacy.slots.removeDefault().optional(),
|
|
15933
|
+
page: external_exports.strictObject({
|
|
15934
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
15935
|
+
entry: moduleEntry,
|
|
15936
|
+
style,
|
|
15937
|
+
title: localized(128, 1).optional()
|
|
15938
|
+
}).optional(),
|
|
15939
|
+
widget: external_exports.strictObject({
|
|
15940
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
15941
|
+
entry: moduleEntry,
|
|
15942
|
+
style
|
|
15943
|
+
}).optional(),
|
|
15944
|
+
desktop: external_exports.strictObject({ apiVersion: external_exports.literal(1), script: resourceWithSuffix(".js"), style }).optional(),
|
|
15945
|
+
web: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry.optional(), style }).refine(({ entry, style: style2 }) => entry !== void 0 || style2 !== void 0, "Expected a Web entry or style").optional(),
|
|
15946
|
+
backend: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry }).optional()
|
|
15947
|
+
}).refine(({ page, widget, desktop, web, backend }) => Boolean(page || widget || desktop || web || backend), "Expected at least one page, widget, desktop, web, or backend entry").refine(({ page, widget, web, backend }) => !backend || [page?.entry, widget?.entry, web?.entry].every((entry) => entry === void 0 || hostExtensionCanonicalPath(entry) !== hostExtensionCanonicalPath(backend.entry)), { path: ["backend", "entry"], message: "A backend entry cannot also be a frontend entry" });
|
|
15948
|
+
function targetsForCapabilities({ hasPage, hasWidget, hasDesktop, hasWeb, hasBackend }) {
|
|
15949
|
+
if (hasPage || hasWidget || hasBackend && !hasDesktop && !hasWeb)
|
|
15950
|
+
return ["desktop", "web"];
|
|
15951
|
+
const targets = [];
|
|
15952
|
+
if (hasDesktop)
|
|
15953
|
+
targets.push("desktop");
|
|
15954
|
+
if (hasWeb)
|
|
15955
|
+
targets.push("web");
|
|
15956
|
+
return targets;
|
|
15957
|
+
}
|
|
15958
|
+
var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
|
|
15959
|
+
|
|
15960
|
+
// ../../shared-contracts/dist/host-extension-management.js
|
|
15961
|
+
var HOST_EXTENSION_ZIP_MAX_BYTES = DESKTOP_EXTENSION_ZIP_MAX_BYTES;
|
|
15962
|
+
var hostExtensionRevisionSchema = external_exports.int().nonnegative();
|
|
15963
|
+
var hostExtensionConfigurationSchema = external_exports.strictObject({
|
|
15964
|
+
revision: hostExtensionRevisionSchema,
|
|
15965
|
+
enabled: external_exports.array(hostExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs")
|
|
15966
|
+
});
|
|
15967
|
+
var { downloadUrl, ...catalogMetadata } = desktopExtensionCatalogEntrySchema.shape;
|
|
15968
|
+
var hostExtensionCatalogEntrySchema = external_exports.object({
|
|
15969
|
+
...catalogMetadata,
|
|
15970
|
+
id: hostExtensionIdSchema,
|
|
15971
|
+
format: external_exports.literal("codexhost"),
|
|
15972
|
+
targets: external_exports.array(hostExtensionTargetSchema).min(1).max(2).refine((targets) => new Set(targets).size === targets.length, "Duplicate targets"),
|
|
15973
|
+
apis: external_exports.strictObject({
|
|
15974
|
+
page: external_exports.int().positive().optional(),
|
|
15975
|
+
widget: external_exports.int().positive().optional(),
|
|
15976
|
+
desktop: external_exports.int().positive().optional(),
|
|
15977
|
+
web: external_exports.int().positive().optional(),
|
|
15978
|
+
backend: external_exports.int().positive().optional()
|
|
15979
|
+
}),
|
|
15980
|
+
downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS")
|
|
15981
|
+
}).refine(({ targets, apis }) => {
|
|
15982
|
+
const derived = targetsForCapabilities({
|
|
15983
|
+
hasPage: Boolean(apis.page),
|
|
15984
|
+
hasWidget: Boolean(apis.widget),
|
|
15985
|
+
hasDesktop: Boolean(apis.desktop),
|
|
15986
|
+
hasWeb: Boolean(apis.web),
|
|
15987
|
+
hasBackend: Boolean(apis.backend)
|
|
15988
|
+
});
|
|
15989
|
+
return targets.length === derived.length && derived.every((target2) => targets.includes(target2));
|
|
15990
|
+
}, "Catalog targets must match the declared APIs");
|
|
15991
|
+
var hostExtensionCatalogSchema = external_exports.object({
|
|
15992
|
+
schemaVersion: external_exports.literal(2),
|
|
15993
|
+
generatedAt: external_exports.string().min(1),
|
|
15994
|
+
extensions: external_exports.array(hostExtensionCatalogEntrySchema).max(1e4).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
15995
|
+
});
|
|
15996
|
+
var hostExtensionsCatalogResultSchema = hostExtensionCatalogSchema.extend({
|
|
15997
|
+
catalogUrl: desktopExtensionHttpUrlSchema,
|
|
15998
|
+
fetchedAt: external_exports.iso.datetime(),
|
|
15999
|
+
cached: external_exports.boolean()
|
|
16000
|
+
});
|
|
16001
|
+
var id = { id: hostExtensionIdSchema };
|
|
16002
|
+
var active = {
|
|
16003
|
+
...id,
|
|
16004
|
+
activationId: hostExtensionActivationIdSchema,
|
|
16005
|
+
digest: hostExtensionDigestSchema
|
|
16006
|
+
};
|
|
16007
|
+
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
16008
|
+
var filePath = external_exports.string().min(1).max(4096).refine((path10) => /^(?:\/|[a-z]:[/\\])/iu.test(path10) && !path10.includes("\0") && !path10.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
|
|
16009
|
+
var gitRef = external_exports.string().min(1).max(256).refine((ref) => ref.split("/").every((part) => part && /^[a-z0-9_.-]+$/iu.test(part) && part !== "." && part !== ".."), "Invalid GitHub ref");
|
|
16010
|
+
function base643(maxBytes) {
|
|
16011
|
+
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
16012
|
+
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
16013
|
+
return value.length % 4 === 0 && value.length * 3 / 4 - padding <= maxBytes && /^[A-Za-z0-9+/]*={0,2}$/u.test(value);
|
|
16014
|
+
}, "Expected bounded standard padded base64");
|
|
16015
|
+
}
|
|
16016
|
+
var hostExtensionGitHubSourceSchema = external_exports.strictObject({
|
|
16017
|
+
type: external_exports.literal("github"),
|
|
16018
|
+
repository: external_exports.string().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),
|
|
16019
|
+
ref: gitRef.optional(),
|
|
16020
|
+
tag: gitRef.optional(),
|
|
16021
|
+
asset: external_exports.string().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),
|
|
16022
|
+
subpath: hostExtensionResourcePathSchema.optional()
|
|
16023
|
+
}).refine(({ ref, tag, asset }) => !ref || !tag && !asset, "Use either a zipball ref or a release tag/asset");
|
|
16024
|
+
var hostExtensionInstallSourceSchema = external_exports.union([
|
|
16025
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
16026
|
+
hostExtensionGitHubSourceSchema,
|
|
16027
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), base64: base643(HOST_EXTENSION_ZIP_MAX_BYTES).min(4) }),
|
|
16028
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), localZipPath: filePath }),
|
|
16029
|
+
external_exports.strictObject({ type: external_exports.literal("localDir"), localDir: filePath })
|
|
15898
16030
|
]);
|
|
15899
|
-
var
|
|
15900
|
-
|
|
15901
|
-
|
|
15902
|
-
|
|
15903
|
-
|
|
15904
|
-
purpose: external_exports.literal("availability").optional()
|
|
15905
|
-
}).strict();
|
|
15906
|
-
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15907
|
-
harnessId: harnessIdSchema
|
|
15908
|
-
}).strict();
|
|
15909
|
-
var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
|
|
15910
|
-
var threadModelSelectParamsSchema = external_exports.object({
|
|
15911
|
-
threadId: hostThreadIdSchema,
|
|
15912
|
-
model: harnessModelRefSchema
|
|
15913
|
-
}).strict();
|
|
15914
|
-
var threadThinkingSelectParamsSchema = external_exports.object({
|
|
15915
|
-
threadId: hostThreadIdSchema,
|
|
15916
|
-
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
15917
|
-
}).strict();
|
|
15918
|
-
var threadInspectionParamsSchema = external_exports.object({
|
|
15919
|
-
threadId: hostThreadIdSchema,
|
|
15920
|
-
includeReferenceCapability: external_exports.boolean().optional()
|
|
15921
|
-
}).strict();
|
|
15922
|
-
var codexThreadInspectionSchema = external_exports.object({
|
|
15923
|
-
owner: external_exports.literal("codex"),
|
|
15924
|
-
locked: external_exports.boolean(),
|
|
15925
|
-
effectiveModel: harnessModelRefSchema.optional(),
|
|
15926
|
-
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15927
|
-
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15928
|
-
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15929
|
-
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
15930
|
-
supportsThreadReferences: external_exports.literal(true).optional()
|
|
15931
|
-
}).strict();
|
|
15932
|
-
var externalThreadInspectionSchema = external_exports.object({
|
|
15933
|
-
owner: external_exports.literal("external"),
|
|
15934
|
-
harnessId: nonBlankTextSchema2.max(256),
|
|
15935
|
-
transportModelId: nonBlankTextSchema2.max(1024),
|
|
15936
|
-
effectiveModel: harnessModelRefSchema.optional(),
|
|
15937
|
-
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15938
|
-
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15939
|
-
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15940
|
-
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15941
|
-
history: harnessHistoryCapabilitiesSchema,
|
|
15942
|
-
usage: threadUsageSnapshotSchema.optional(),
|
|
15943
|
-
locked: external_exports.literal(true)
|
|
15944
|
-
}).strict();
|
|
15945
|
-
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
15946
|
-
codexThreadInspectionSchema,
|
|
15947
|
-
externalThreadInspectionSchema
|
|
16031
|
+
var hostExtensionProvenanceSchema = external_exports.discriminatedUnion("type", [
|
|
16032
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
16033
|
+
hostExtensionGitHubSourceSchema,
|
|
16034
|
+
external_exports.strictObject({ type: external_exports.literal("zip") }),
|
|
16035
|
+
external_exports.strictObject({ type: external_exports.literal("localDir") })
|
|
15948
16036
|
]);
|
|
15949
|
-
var
|
|
15950
|
-
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
if (seen.has(threadId)) {
|
|
15955
|
-
context.addIssue({
|
|
15956
|
-
code: "custom",
|
|
15957
|
-
message: "Thread ownership-list IDs must be unique",
|
|
15958
|
-
path: ["threadIds", index]
|
|
15959
|
-
});
|
|
15960
|
-
}
|
|
15961
|
-
seen.add(threadId);
|
|
15962
|
-
}
|
|
16037
|
+
var hostExtensionInstallationSchema = external_exports.strictObject({
|
|
16038
|
+
...active,
|
|
16039
|
+
manifest: hostExtensionManifestV2Schema,
|
|
16040
|
+
installedAt: external_exports.iso.datetime(),
|
|
16041
|
+
source: hostExtensionProvenanceSchema.optional()
|
|
15963
16042
|
});
|
|
15964
|
-
var
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
|
|
16043
|
+
var rasterDataUrlSchema = (maxBytes) => external_exports.string().max("data:image/jpeg;base64,".length + 4 * Math.ceil(maxBytes / 3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
16044
|
+
var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
|
|
16045
|
+
var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
|
|
16046
|
+
var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
|
|
16047
|
+
hostExtensionInstallationSchema.extend({
|
|
16048
|
+
state: external_exports.literal("valid"),
|
|
16049
|
+
enabled: external_exports.boolean(),
|
|
16050
|
+
...desktopConflict,
|
|
16051
|
+
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
16052
|
+
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
16053
|
+
backendState: backendState.optional(),
|
|
16054
|
+
backendError: external_exports.string().optional()
|
|
16055
|
+
}),
|
|
16056
|
+
external_exports.strictObject({
|
|
16057
|
+
state: external_exports.enum(["invalid", "incompatible"]),
|
|
16058
|
+
id: external_exports.string().min(1),
|
|
16059
|
+
enabled: external_exports.boolean(),
|
|
16060
|
+
error: external_exports.string()
|
|
16061
|
+
})
|
|
15976
16062
|
]);
|
|
15977
|
-
var
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15983
|
-
|
|
15984
|
-
|
|
15985
|
-
|
|
15986
|
-
|
|
15987
|
-
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
16063
|
+
var hostExtensionsListResultSchema = external_exports.strictObject({
|
|
16064
|
+
revision: hostExtensionRevisionSchema,
|
|
16065
|
+
configuration: hostExtensionConfigurationSchema,
|
|
16066
|
+
diagnostics: external_exports.array(external_exports.string()),
|
|
16067
|
+
extensions: external_exports.array(hostExtensionListItemSchema)
|
|
16068
|
+
});
|
|
16069
|
+
var hostExtensionRuntimeEntrySchema = hostExtensionInstallationSchema.extend({
|
|
16070
|
+
...desktopConflict,
|
|
16071
|
+
settingsRevision: hostExtensionRevisionSchema
|
|
16072
|
+
});
|
|
16073
|
+
var hostExtensionsSnapshotResultSchema = external_exports.strictObject({
|
|
16074
|
+
/** The Host publishes this revision in extensions-changed, independent of enabled.json's revision. */
|
|
16075
|
+
revision: hostExtensionRevisionSchema,
|
|
16076
|
+
// Enabled, valid activations only. A Desktop conflict does not hide other capabilities.
|
|
16077
|
+
extensions: external_exports.array(hostExtensionRuntimeEntrySchema).max(DESKTOP_EXTENSION_LIMIT)
|
|
16078
|
+
});
|
|
16079
|
+
var HOST_EXTENSIONS_RPC = {
|
|
16080
|
+
list: "codexhost/extensions/list",
|
|
16081
|
+
snapshot: "codexhost/extensions/snapshot",
|
|
16082
|
+
catalog: "codexhost/extensions/catalog",
|
|
16083
|
+
install: "codexhost/extensions/install",
|
|
16084
|
+
update: "codexhost/extensions/update",
|
|
16085
|
+
enable: "codexhost/extensions/enable",
|
|
16086
|
+
disable: "codexhost/extensions/disable",
|
|
16087
|
+
uninstall: "codexhost/extensions/uninstall",
|
|
16088
|
+
recover: "codexhost/extensions/recover",
|
|
16089
|
+
asset: "codexhost/extensions/asset",
|
|
16090
|
+
settingsGet: "codexhost/extensions/settings/get",
|
|
16091
|
+
settingsSet: "codexhost/extensions/settings/set",
|
|
16092
|
+
backendInvoke: "codexhost/extensions/backend/invoke"
|
|
16093
|
+
};
|
|
16094
|
+
var HOST_EXTENSION_MANAGEMENT_METHODS = Object.freeze(Object.values(HOST_EXTENSIONS_RPC));
|
|
16095
|
+
var methods = new Set(HOST_EXTENSION_MANAGEMENT_METHODS);
|
|
16096
|
+
var noParams = external_exports.strictObject({});
|
|
16097
|
+
var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
|
|
16098
|
+
var selection = external_exports.strictObject({ ...id, ...expectedRevision });
|
|
16099
|
+
var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
|
|
16100
|
+
var mutationResult = external_exports.discriminatedUnion("state", [
|
|
16101
|
+
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
|
|
16102
|
+
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
|
|
16103
|
+
]);
|
|
16104
|
+
var hostExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
16105
|
+
...optionalActivation,
|
|
16106
|
+
digest: active.digest.optional(),
|
|
16107
|
+
path: hostExtensionResourcePathSchema
|
|
16108
|
+
});
|
|
16109
|
+
var hostExtensionsAssetResultSchema = external_exports.strictObject({
|
|
16110
|
+
mimeType: external_exports.string().min(1),
|
|
16111
|
+
base64: base643(DESKTOP_EXTENSION_ASSET_MAX_BYTES),
|
|
16112
|
+
digest: active.digest
|
|
16113
|
+
});
|
|
16114
|
+
var hostExtensionSettingsSchema = external_exports.strictObject({
|
|
16115
|
+
settingsRevision: hostExtensionRevisionSchema,
|
|
16116
|
+
values: jsonObjectSchema
|
|
15991
16117
|
});
|
|
15992
|
-
var
|
|
15993
|
-
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
16002
|
-
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
|
|
16011
|
-
}
|
|
16012
|
-
|
|
16013
|
-
|
|
16014
|
-
|
|
16015
|
-
|
|
16118
|
+
var hostExtensionsRpcSchemas = {
|
|
16119
|
+
[HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
|
|
16120
|
+
[HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
|
|
16121
|
+
[HOST_EXTENSIONS_RPC.catalog]: {
|
|
16122
|
+
params: external_exports.strictObject({ forceRefresh: external_exports.boolean().optional() }),
|
|
16123
|
+
result: hostExtensionsCatalogResultSchema
|
|
16124
|
+
},
|
|
16125
|
+
[HOST_EXTENSIONS_RPC.install]: {
|
|
16126
|
+
params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
|
|
16127
|
+
result: installationResult
|
|
16128
|
+
},
|
|
16129
|
+
[HOST_EXTENSIONS_RPC.update]: {
|
|
16130
|
+
params: external_exports.strictObject({
|
|
16131
|
+
...id,
|
|
16132
|
+
expectedDigest: active.digest,
|
|
16133
|
+
expectedActivationId: active.activationId.optional(),
|
|
16134
|
+
source: hostExtensionInstallSourceSchema.optional()
|
|
16135
|
+
}),
|
|
16136
|
+
result: installationResult
|
|
16137
|
+
},
|
|
16138
|
+
[HOST_EXTENSIONS_RPC.enable]: { params: selection, result: mutationResult },
|
|
16139
|
+
[HOST_EXTENSIONS_RPC.disable]: { params: selection, result: mutationResult },
|
|
16140
|
+
[HOST_EXTENSIONS_RPC.uninstall]: {
|
|
16141
|
+
params: external_exports.strictObject({
|
|
16142
|
+
...id,
|
|
16143
|
+
removeData: external_exports.boolean().optional(),
|
|
16144
|
+
expectedDigest: active.digest.optional()
|
|
16145
|
+
}),
|
|
16146
|
+
result: external_exports.strictObject({ ...id, removed: external_exports.boolean() })
|
|
16147
|
+
},
|
|
16148
|
+
[HOST_EXTENSIONS_RPC.recover]: {
|
|
16149
|
+
params: external_exports.strictObject({ expectedRevision: expectedRevision.expectedRevision.optional() }),
|
|
16150
|
+
result: mutationResult
|
|
16151
|
+
},
|
|
16152
|
+
[HOST_EXTENSIONS_RPC.asset]: {
|
|
16153
|
+
params: hostExtensionsAssetParamsSchema,
|
|
16154
|
+
result: hostExtensionsAssetResultSchema
|
|
16155
|
+
},
|
|
16156
|
+
[HOST_EXTENSIONS_RPC.settingsGet]: {
|
|
16157
|
+
params: external_exports.strictObject(optionalActivation),
|
|
16158
|
+
result: hostExtensionSettingsSchema
|
|
16159
|
+
},
|
|
16160
|
+
[HOST_EXTENSIONS_RPC.settingsSet]: {
|
|
16161
|
+
params: external_exports.strictObject({
|
|
16162
|
+
...optionalActivation,
|
|
16163
|
+
expectedSettingsRevision: hostExtensionRevisionSchema,
|
|
16164
|
+
values: jsonObjectSchema
|
|
16165
|
+
}),
|
|
16166
|
+
result: hostExtensionSettingsSchema
|
|
16167
|
+
},
|
|
16168
|
+
[HOST_EXTENSIONS_RPC.backendInvoke]: {
|
|
16169
|
+
params: external_exports.strictObject({
|
|
16170
|
+
...optionalActivation,
|
|
16171
|
+
method: hostExtensionBackendMethodSchema,
|
|
16172
|
+
params: jsonValueSchema.optional()
|
|
16173
|
+
}),
|
|
16174
|
+
result: external_exports.strictObject({ result: jsonValueSchema })
|
|
16175
|
+
}
|
|
16176
|
+
};
|
|
16016
16177
|
|
|
16017
16178
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
16018
16179
|
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
@@ -16058,6 +16219,8 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
16058
16219
|
"codexhost/workspace/read",
|
|
16059
16220
|
"codexhost/thread/tree/read",
|
|
16060
16221
|
"codexhost/thread/pins/list",
|
|
16222
|
+
"codexhost/thread/sections/list",
|
|
16223
|
+
"codexhost/thread/sections/move",
|
|
16061
16224
|
"codexhost/thread/pins/set",
|
|
16062
16225
|
"codexhost/harness/plugins/list",
|
|
16063
16226
|
"codexhost/harness/inspect",
|
|
@@ -16075,7 +16238,7 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
16075
16238
|
"codexhost/harness/session-import/list",
|
|
16076
16239
|
"codexhost/harness/session-import/import",
|
|
16077
16240
|
// Host settings shared across Desktop and Web.
|
|
16078
|
-
...
|
|
16241
|
+
...HOST_EXTENSION_MANAGEMENT_METHODS,
|
|
16079
16242
|
"codexhost/harness/installation",
|
|
16080
16243
|
"codexhost/harness/installation/start",
|
|
16081
16244
|
"codexhost/harness/installation/status",
|
|
@@ -16096,8 +16259,21 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
16096
16259
|
"codexhost/update/check",
|
|
16097
16260
|
"codexhost/update/start",
|
|
16098
16261
|
"codexhost/update/status",
|
|
16262
|
+
"codexhost/announcement/get",
|
|
16263
|
+
"codexhost/announcement/acknowledge",
|
|
16099
16264
|
"codexhost/sessions/loaded/list"
|
|
16100
16265
|
];
|
|
16266
|
+
var clientThreadSectionsSchema = external_exports.object({
|
|
16267
|
+
sections: external_exports.array(external_exports.object({
|
|
16268
|
+
id: external_exports.string().min(1),
|
|
16269
|
+
name: external_exports.string().min(1),
|
|
16270
|
+
threads: external_exports.array(jsonObjectSchema)
|
|
16271
|
+
}).strict())
|
|
16272
|
+
}).strict();
|
|
16273
|
+
var clientThreadSectionMoveSchema = external_exports.object({
|
|
16274
|
+
threadId: external_exports.string().min(1).max(1024),
|
|
16275
|
+
sectionId: external_exports.string().min(1).max(1024).nullable()
|
|
16276
|
+
}).strict();
|
|
16101
16277
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
16102
16278
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
16103
16279
|
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
@@ -16136,6 +16312,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
16136
16312
|
cursor: clientChannelCursorSchema,
|
|
16137
16313
|
revision: external_exports.number().int().nonnegative()
|
|
16138
16314
|
}),
|
|
16315
|
+
external_exports.object({
|
|
16316
|
+
type: external_exports.literal("extensions-changed"),
|
|
16317
|
+
cursor: clientChannelCursorSchema,
|
|
16318
|
+
revision: hostExtensionRevisionSchema
|
|
16319
|
+
}),
|
|
16139
16320
|
external_exports.object({
|
|
16140
16321
|
type: external_exports.literal("hello"),
|
|
16141
16322
|
version: external_exports.literal(1),
|
|
@@ -16572,7 +16753,7 @@ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
|
|
|
16572
16753
|
|
|
16573
16754
|
// ../../shared-contracts/dist/harness-preferences.js
|
|
16574
16755
|
var harnessPreferenceScopeSchema = external_exports.string().regex(/^external$/u);
|
|
16575
|
-
var preferenceHarnessKey = harnessIdSchema.transform((
|
|
16756
|
+
var preferenceHarnessKey = harnessIdSchema.transform((id2) => String(id2));
|
|
16576
16757
|
var harnessDefaultConfigurationSchema = external_exports.strictObject({
|
|
16577
16758
|
model: harnessModelRefSchema.optional(),
|
|
16578
16759
|
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
@@ -16582,11 +16763,19 @@ var newThreadDefaultsSchema = external_exports.strictObject({
|
|
|
16582
16763
|
lastHarness: harnessIdSchema.optional(),
|
|
16583
16764
|
byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
|
|
16584
16765
|
});
|
|
16766
|
+
var harnessDelegationDefaultSchema = external_exports.strictObject({
|
|
16767
|
+
model: harnessModelRefSchema.optional(),
|
|
16768
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
16769
|
+
}).refine((value) => Boolean(value.model || value.thinkingOptionId), "A delegation default must contain a Model or Thinking option");
|
|
16770
|
+
var delegationDefaultsSchema = external_exports.strictObject({
|
|
16771
|
+
byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
|
|
16772
|
+
});
|
|
16585
16773
|
var modelId = external_exports.string().min(1).max(1024);
|
|
16586
16774
|
var harnessPreferenceValuesSchema = external_exports.strictObject({
|
|
16587
16775
|
idleRelease: idleReleaseSettingsSchema.optional(),
|
|
16588
16776
|
favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
|
|
16589
|
-
newThread: newThreadDefaultsSchema.optional()
|
|
16777
|
+
newThread: newThreadDefaultsSchema.optional(),
|
|
16778
|
+
delegation: delegationDefaultsSchema.optional()
|
|
16590
16779
|
});
|
|
16591
16780
|
var harnessPreferenceSnapshotSchema = external_exports.strictObject({
|
|
16592
16781
|
scope: harnessPreferenceScopeSchema,
|
|
@@ -16614,6 +16803,11 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
|
|
|
16614
16803
|
lastHarness: harnessIdSchema.optional(),
|
|
16615
16804
|
harnessId: harnessIdSchema.optional(),
|
|
16616
16805
|
configuration: harnessDefaultConfigurationSchema.optional()
|
|
16806
|
+
}),
|
|
16807
|
+
external_exports.strictObject({
|
|
16808
|
+
kind: external_exports.literal("delegation"),
|
|
16809
|
+
harnessId: harnessIdSchema,
|
|
16810
|
+
configuration: harnessDelegationDefaultSchema.nullable()
|
|
16617
16811
|
})
|
|
16618
16812
|
]);
|
|
16619
16813
|
var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
@@ -16621,8 +16815,8 @@ var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
|
16621
16815
|
operations: external_exports.array(harnessPreferenceOperationSchema).min(1).max(256),
|
|
16622
16816
|
initializeOnly: external_exports.boolean().optional(),
|
|
16623
16817
|
expectedRevision: external_exports.number().int().nonnegative().optional()
|
|
16624
|
-
}).superRefine((
|
|
16625
|
-
for (const operation of
|
|
16818
|
+
}).superRefine((input2, ctx) => {
|
|
16819
|
+
for (const operation of input2.operations) {
|
|
16626
16820
|
if (operation.kind === "newThread" && (!operation.lastHarness && !operation.configuration || Boolean(operation.harnessId) !== Boolean(operation.configuration)))
|
|
16627
16821
|
ctx.addIssue({
|
|
16628
16822
|
code: "custom",
|
|
@@ -17024,13 +17218,18 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
17024
17218
|
// ../../shared-contracts/dist/harness-installation.js
|
|
17025
17219
|
var harnessInstallationParamsSchema = external_exports.object({
|
|
17026
17220
|
harnessId: harnessIdSchema,
|
|
17027
|
-
action: external_exports.enum(["check", "update", "install"])
|
|
17028
|
-
|
|
17221
|
+
action: external_exports.enum(["check", "update", "install"]),
|
|
17222
|
+
confirmedVersion: external_exports.string().min(1).max(128).optional()
|
|
17223
|
+
}).strict().refine(({ action, confirmedVersion }) => action === "update" || confirmedVersion === void 0);
|
|
17029
17224
|
var harnessInstallationStateSchema = external_exports.object({
|
|
17030
17225
|
currentVersion: external_exports.string().min(1).max(128),
|
|
17031
17226
|
latestVersion: external_exports.string().min(1).max(128),
|
|
17032
17227
|
updateAvailable: external_exports.boolean(),
|
|
17033
17228
|
canUpdate: external_exports.boolean(),
|
|
17229
|
+
/** Present when the Adapter has a verified list and the available target is outside it. */
|
|
17230
|
+
latestVerifiedVersion: external_exports.string().min(1).max(128).optional(),
|
|
17231
|
+
/** Update preflight stopped before running the installer; latestVersion needs confirmation. */
|
|
17232
|
+
confirmationRequired: external_exports.literal(true).optional(),
|
|
17034
17233
|
/** Defaults to CLI; some Harnesses ship only inside a desktop application. */
|
|
17035
17234
|
versionKind: external_exports.enum(["cli", "application"]).optional(),
|
|
17036
17235
|
/** Official download opened by the user; does not imply an automatic installation. */
|
|
@@ -17360,6 +17559,38 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
17360
17559
|
status: updateStatusSchema.nullable()
|
|
17361
17560
|
});
|
|
17362
17561
|
|
|
17562
|
+
// ../../shared-contracts/dist/release-announcement.js
|
|
17563
|
+
var RELEASE_ANNOUNCEMENT_MAX_THEMES = 12;
|
|
17564
|
+
var releaseAnnouncementThemeSchema = external_exports.strictObject({
|
|
17565
|
+
icon: external_exports.string().min(1).max(16).optional(),
|
|
17566
|
+
title: external_exports.string().min(1).max(120),
|
|
17567
|
+
body: external_exports.string().min(1).max(1200),
|
|
17568
|
+
contributors: external_exports.array(external_exports.string().min(1).max(39)).max(30)
|
|
17569
|
+
});
|
|
17570
|
+
var releaseAnnouncementContentSchema = external_exports.strictObject({
|
|
17571
|
+
summary: external_exports.string().min(1).max(600).optional(),
|
|
17572
|
+
themes: external_exports.array(releaseAnnouncementThemeSchema).min(1).max(RELEASE_ANNOUNCEMENT_MAX_THEMES)
|
|
17573
|
+
});
|
|
17574
|
+
var releaseAnnouncementSchema = external_exports.strictObject({
|
|
17575
|
+
version: updateSemanticVersionSchema,
|
|
17576
|
+
publishedAt: external_exports.iso.datetime(),
|
|
17577
|
+
url: external_exports.string().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),
|
|
17578
|
+
zh: releaseAnnouncementContentSchema.nullable(),
|
|
17579
|
+
en: releaseAnnouncementContentSchema.nullable()
|
|
17580
|
+
}).refine((value) => value.zh !== null || value.en !== null, {
|
|
17581
|
+
message: "an announcement needs at least one language"
|
|
17582
|
+
});
|
|
17583
|
+
var releaseAnnouncementGetParamsSchema = external_exports.strictObject({
|
|
17584
|
+
manual: external_exports.boolean().optional()
|
|
17585
|
+
});
|
|
17586
|
+
var releaseAnnouncementGetResultSchema = external_exports.strictObject({
|
|
17587
|
+
announcement: releaseAnnouncementSchema.nullable(),
|
|
17588
|
+
unread: external_exports.boolean()
|
|
17589
|
+
});
|
|
17590
|
+
var releaseAnnouncementAcknowledgeParamsSchema = external_exports.strictObject({
|
|
17591
|
+
version: updateSemanticVersionSchema
|
|
17592
|
+
});
|
|
17593
|
+
|
|
17363
17594
|
// ../../shared-contracts/dist/thread-watch-notice.js
|
|
17364
17595
|
var THREAD_WATCH_NOTICE_OUTCOMES = [
|
|
17365
17596
|
"completed",
|
|
@@ -17407,17 +17638,67 @@ var remoteSshSetupResultSchema = external_exports.object({ state: external_expor
|
|
|
17407
17638
|
|
|
17408
17639
|
// ../../shared-contracts/dist/remote-sessions.js
|
|
17409
17640
|
var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
|
|
17410
|
-
var
|
|
17641
|
+
var REMOTE_IDENTITY_MAX_LENGTH = 1024;
|
|
17642
|
+
var identity = external_exports.string().min(1).max(REMOTE_IDENTITY_MAX_LENGTH);
|
|
17411
17643
|
var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
|
|
17412
17644
|
var thread = { ...target, threadId: identity };
|
|
17645
|
+
var text = external_exports.string().min(1).max(8e3);
|
|
17646
|
+
var input = { text, requestId: identity };
|
|
17647
|
+
var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
|
|
17648
|
+
external_exports.object({ accepted: external_exports.literal(true), startQueuedItemId: identity.optional() }),
|
|
17649
|
+
external_exports.object({
|
|
17650
|
+
accepted: external_exports.literal(false),
|
|
17651
|
+
code: external_exports.enum([
|
|
17652
|
+
"remote/queue-unavailable",
|
|
17653
|
+
"remote/steer-unavailable",
|
|
17654
|
+
"remote/turn-changed",
|
|
17655
|
+
"remote/send-rejected",
|
|
17656
|
+
"session/queue-item-not-found",
|
|
17657
|
+
"session/queue-item-starting"
|
|
17658
|
+
]),
|
|
17659
|
+
message: external_exports.string()
|
|
17660
|
+
})
|
|
17661
|
+
]);
|
|
17662
|
+
var remoteQueueSnapshotSchema = external_exports.discriminatedUnion("available", [
|
|
17663
|
+
external_exports.object({ available: external_exports.literal(false) }),
|
|
17664
|
+
external_exports.object({
|
|
17665
|
+
available: external_exports.literal(true),
|
|
17666
|
+
items: external_exports.array(external_exports.object({ id: identity, clientUserMessageId: identity, preview: external_exports.string().max(801) })).max(100)
|
|
17667
|
+
})
|
|
17668
|
+
]);
|
|
17413
17669
|
var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
17414
17670
|
external_exports.strictObject({ kind: external_exports.literal("hosts") }),
|
|
17671
|
+
external_exports.strictObject({
|
|
17672
|
+
kind: external_exports.literal("create"),
|
|
17673
|
+
...target,
|
|
17674
|
+
cwd: external_exports.string().min(1).max(8192),
|
|
17675
|
+
epoch: identity
|
|
17676
|
+
}),
|
|
17677
|
+
external_exports.strictObject({ kind: external_exports.literal("projectHarnesses"), ...target, epoch: identity }),
|
|
17678
|
+
external_exports.strictObject({
|
|
17679
|
+
kind: external_exports.literal("inspectHarness"),
|
|
17680
|
+
...target,
|
|
17681
|
+
epoch: identity,
|
|
17682
|
+
cwd: external_exports.string().min(1).max(8192),
|
|
17683
|
+
harnessId: identity
|
|
17684
|
+
}),
|
|
17685
|
+
external_exports.strictObject({
|
|
17686
|
+
kind: external_exports.literal("startSelected"),
|
|
17687
|
+
...target,
|
|
17688
|
+
epoch: identity,
|
|
17689
|
+
cwd: external_exports.string().min(1).max(8192),
|
|
17690
|
+
harnessId: identity,
|
|
17691
|
+
model: external_exports.string().min(1).max(4096),
|
|
17692
|
+
serviceTier: external_exports.enum(["priority", "ultrafast"]).optional(),
|
|
17693
|
+
reasoningEffort: identity.optional()
|
|
17694
|
+
}),
|
|
17415
17695
|
external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
|
|
17416
17696
|
external_exports.strictObject({
|
|
17417
17697
|
kind: external_exports.literal("list"),
|
|
17418
17698
|
...target,
|
|
17419
17699
|
cursor: external_exports.string().nullable(),
|
|
17420
|
-
archived: external_exports.boolean()
|
|
17700
|
+
archived: external_exports.boolean(),
|
|
17701
|
+
includeLoaded: external_exports.literal(true).optional()
|
|
17421
17702
|
}),
|
|
17422
17703
|
external_exports.strictObject({
|
|
17423
17704
|
kind: external_exports.literal("read"),
|
|
@@ -17437,16 +17718,35 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
17437
17718
|
...thread,
|
|
17438
17719
|
epoch: identity,
|
|
17439
17720
|
modelId: identity.optional(),
|
|
17721
|
+
serviceTier: harnessModelServiceTierSchema.optional(),
|
|
17440
17722
|
thinkingOptionId: identity.optional(),
|
|
17441
17723
|
permissionModeId: identity.optional()
|
|
17442
|
-
}).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
|
|
17724
|
+
}).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting").refine((value) => value.serviceTier === void 0 || value.modelId !== void 0, {
|
|
17725
|
+
message: "A service tier requires a Model ID"
|
|
17726
|
+
}),
|
|
17443
17727
|
external_exports.strictObject({
|
|
17444
17728
|
kind: external_exports.literal("prompt"),
|
|
17445
17729
|
...thread,
|
|
17446
17730
|
epoch: identity,
|
|
17447
|
-
text
|
|
17731
|
+
text,
|
|
17448
17732
|
requestId: identity.optional()
|
|
17449
17733
|
}),
|
|
17734
|
+
external_exports.strictObject({ kind: external_exports.literal("queue"), ...thread, epoch: identity }),
|
|
17735
|
+
external_exports.strictObject({
|
|
17736
|
+
kind: external_exports.literal("delivery"),
|
|
17737
|
+
...thread,
|
|
17738
|
+
epoch: identity,
|
|
17739
|
+
action: external_exports.discriminatedUnion("kind", [
|
|
17740
|
+
external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input }),
|
|
17741
|
+
external_exports.strictObject({ kind: external_exports.literal("steer"), ...input, turnId: identity }),
|
|
17742
|
+
external_exports.strictObject({ kind: external_exports.literal("remove"), itemId: identity }),
|
|
17743
|
+
external_exports.strictObject({
|
|
17744
|
+
kind: external_exports.literal("start"),
|
|
17745
|
+
itemId: identity,
|
|
17746
|
+
onlyIfHead: external_exports.literal(true).optional()
|
|
17747
|
+
})
|
|
17748
|
+
])
|
|
17749
|
+
}),
|
|
17450
17750
|
external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
|
|
17451
17751
|
external_exports.strictObject({
|
|
17452
17752
|
kind: external_exports.literal("rename"),
|
|
@@ -17489,7 +17789,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
17489
17789
|
external_exports.strictObject({ action: external_exports.literal("catalog") }),
|
|
17490
17790
|
external_exports.strictObject({
|
|
17491
17791
|
action: external_exports.literal("read-thread"),
|
|
17492
|
-
hostId: hostId.refine((
|
|
17792
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
17493
17793
|
input: delegationReadParamsSchema
|
|
17494
17794
|
}),
|
|
17495
17795
|
external_exports.strictObject({
|
|
@@ -17503,7 +17803,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
17503
17803
|
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
17504
17804
|
external_exports.strictObject({
|
|
17505
17805
|
action: external_exports.literal("update"),
|
|
17506
|
-
hostId: hostId.refine((
|
|
17806
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
17507
17807
|
version: remoteUpdateParamsSchema.shape.version
|
|
17508
17808
|
})
|
|
17509
17809
|
]);
|
|
@@ -17571,7 +17871,7 @@ function invalidRequest(message) {
|
|
|
17571
17871
|
return { code: "invalidRequest", message, retryable: false };
|
|
17572
17872
|
}
|
|
17573
17873
|
function validateHostApprovalResponse(interaction, response) {
|
|
17574
|
-
return interaction.actions.some(({ id }) =>
|
|
17874
|
+
return interaction.actions.some(({ id: id2 }) => id2 === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
|
|
17575
17875
|
}
|
|
17576
17876
|
|
|
17577
17877
|
// ../../harness-adapter/dist/question.js
|
|
@@ -17579,7 +17879,7 @@ function invalidRequest2(message) {
|
|
|
17579
17879
|
return { code: "invalidRequest", message, retryable: false };
|
|
17580
17880
|
}
|
|
17581
17881
|
function validateHostQuestionResponse(interaction, response) {
|
|
17582
|
-
const questionIds = new Set(interaction.questions.map(({ id }) =>
|
|
17882
|
+
const questionIds = new Set(interaction.questions.map(({ id: id2 }) => id2));
|
|
17583
17883
|
if (response.cancelled) {
|
|
17584
17884
|
return Object.keys(response.answers).length === 0 ? null : invalidRequest2("Cancelled Question Response must not contain answers");
|
|
17585
17885
|
}
|
|
@@ -17610,6 +17910,18 @@ function validateHostQuestionResponse(interaction, response) {
|
|
|
17610
17910
|
return null;
|
|
17611
17911
|
}
|
|
17612
17912
|
|
|
17913
|
+
// ../../harness-adapter/dist/legacy-model-ref.js
|
|
17914
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
17915
|
+
function normalizeLegacyBase64ModelRef(ref, catalog, prefix) {
|
|
17916
|
+
if (ref.serviceTier || !ref.id.startsWith(prefix))
|
|
17917
|
+
return void 0;
|
|
17918
|
+
const encoded = ref.id.slice(prefix.length);
|
|
17919
|
+
const id2 = Buffer2.from(encoded, "base64url").toString("utf8");
|
|
17920
|
+
if (Buffer2.from(id2).toString("base64url") !== encoded)
|
|
17921
|
+
return void 0;
|
|
17922
|
+
return catalog.models.find(({ ref: ref2 }) => ref2.id === id2 && !ref2.serviceTier)?.ref;
|
|
17923
|
+
}
|
|
17924
|
+
|
|
17613
17925
|
// ../../harness-adapter/dist/output-channel.js
|
|
17614
17926
|
var HarnessOutputChannel = class {
|
|
17615
17927
|
outputs;
|
|
@@ -17694,7 +18006,8 @@ var tokenFields = [
|
|
|
17694
18006
|
var safeIntegerFields = [
|
|
17695
18007
|
"planFiveHourResetsAtUnix",
|
|
17696
18008
|
"planSevenDayResetsAtUnix",
|
|
17697
|
-
"timeToFirstOutputMs"
|
|
18009
|
+
"timeToFirstOutputMs",
|
|
18010
|
+
"latestRequestTimeToFirstOutputMs"
|
|
17698
18011
|
];
|
|
17699
18012
|
var percentFields = [
|
|
17700
18013
|
"cacheHitRatePercent",
|
|
@@ -19678,8 +19991,8 @@ var RequestResponder = class {
|
|
|
19678
19991
|
signal;
|
|
19679
19992
|
finishRequest;
|
|
19680
19993
|
didRespond = false;
|
|
19681
|
-
constructor(
|
|
19682
|
-
this.id =
|
|
19994
|
+
constructor(id2, sendResult, signal = new AbortController().signal, finishRequest) {
|
|
19995
|
+
this.id = id2;
|
|
19683
19996
|
this.sendResult = sendResult;
|
|
19684
19997
|
this.signal = signal;
|
|
19685
19998
|
this.finishRequest = finishRequest;
|
|
@@ -19970,7 +20283,7 @@ var Connection = class {
|
|
|
19970
20283
|
return this.sendWireMessage({ jsonrpc: "2.0", method, params });
|
|
19971
20284
|
}
|
|
19972
20285
|
prepareRequest(method, params, mapResponse, options = {}) {
|
|
19973
|
-
const
|
|
20286
|
+
const id2 = this.nextRequestId++;
|
|
19974
20287
|
let cancel = () => {
|
|
19975
20288
|
};
|
|
19976
20289
|
const response = new Promise((resolve, reject) => {
|
|
@@ -19990,7 +20303,7 @@ var Connection = class {
|
|
|
19990
20303
|
}
|
|
19991
20304
|
pendingResponse.cancellationSent = true;
|
|
19992
20305
|
pendingResponse.cleanup?.();
|
|
19993
|
-
void this.sendCancelRequest(
|
|
20306
|
+
void this.sendCancelRequest(id2).catch(() => {
|
|
19994
20307
|
});
|
|
19995
20308
|
};
|
|
19996
20309
|
options.cancellationSignal?.addEventListener("abort", cancel, {
|
|
@@ -19999,12 +20312,12 @@ var Connection = class {
|
|
|
19999
20312
|
pendingResponse.cleanup = () => {
|
|
20000
20313
|
options.cancellationSignal?.removeEventListener("abort", cancel);
|
|
20001
20314
|
};
|
|
20002
|
-
this.pendingResponses.set(
|
|
20315
|
+
this.pendingResponses.set(id2, pendingResponse);
|
|
20003
20316
|
});
|
|
20004
20317
|
response.catch(() => {
|
|
20005
20318
|
});
|
|
20006
20319
|
return {
|
|
20007
|
-
message: { jsonrpc: "2.0", id, method, params },
|
|
20320
|
+
message: { jsonrpc: "2.0", id: id2, method, params },
|
|
20008
20321
|
response,
|
|
20009
20322
|
cancel: () => cancel()
|
|
20010
20323
|
};
|
|
@@ -20512,7 +20825,7 @@ var LineBuffer = class {
|
|
|
20512
20825
|
};
|
|
20513
20826
|
|
|
20514
20827
|
// ../../../node_modules/@agentclientprotocol/sdk/dist/stream.js
|
|
20515
|
-
function ndJsonStream(output,
|
|
20828
|
+
function ndJsonStream(output, input2) {
|
|
20516
20829
|
const textEncoder = new TextEncoder();
|
|
20517
20830
|
const textDecoder = new TextDecoder();
|
|
20518
20831
|
let cancelled = false;
|
|
@@ -20535,7 +20848,7 @@ function ndJsonStream(output, input) {
|
|
|
20535
20848
|
}
|
|
20536
20849
|
}
|
|
20537
20850
|
};
|
|
20538
|
-
const reader =
|
|
20851
|
+
const reader = input2.getReader();
|
|
20539
20852
|
inputReader = reader;
|
|
20540
20853
|
try {
|
|
20541
20854
|
while (true) {
|
|
@@ -20618,8 +20931,8 @@ var zGuardCreateElicitationResponseCancel = object({
|
|
|
20618
20931
|
});
|
|
20619
20932
|
|
|
20620
20933
|
// ../../../node_modules/@agentclientprotocol/sdk/dist/acp.js
|
|
20621
|
-
function ndJsonStream2(output,
|
|
20622
|
-
return ndJsonStream(output,
|
|
20934
|
+
function ndJsonStream2(output, input2) {
|
|
20935
|
+
return ndJsonStream(output, input2);
|
|
20623
20936
|
}
|
|
20624
20937
|
function emptyObjectResponse(response) {
|
|
20625
20938
|
return response ?? {};
|
|
@@ -20641,7 +20954,7 @@ function memoryStreamPair() {
|
|
|
20641
20954
|
}
|
|
20642
20955
|
];
|
|
20643
20956
|
}
|
|
20644
|
-
var
|
|
20957
|
+
var methods2 = {
|
|
20645
20958
|
agent: {
|
|
20646
20959
|
initialize: AGENT_METHODS.initialize,
|
|
20647
20960
|
authenticate: AGENT_METHODS.authenticate,
|
|
@@ -22001,12 +22314,12 @@ var kimiDiscoverySpec = {
|
|
|
22001
22314
|
posix: ["~/.kimi-code/bin", "~/.local/bin", "/usr/local/bin"]
|
|
22002
22315
|
}
|
|
22003
22316
|
};
|
|
22004
|
-
function resolveKimiExecutable(
|
|
22005
|
-
const platform =
|
|
22317
|
+
function resolveKimiExecutable(input2 = {}) {
|
|
22318
|
+
const platform = input2.platform ?? process.platform;
|
|
22006
22319
|
const resolution = resolveHarnessExecutable(kimiDiscoverySpec, {
|
|
22007
|
-
...
|
|
22008
|
-
environment:
|
|
22009
|
-
...
|
|
22320
|
+
...input2.command ? { command: input2.command } : {},
|
|
22321
|
+
environment: input2.environment ?? process.env,
|
|
22322
|
+
...input2.homeDirectory ? { homeDirectory: input2.homeDirectory } : {},
|
|
22010
22323
|
platform
|
|
22011
22324
|
});
|
|
22012
22325
|
if (!resolution)
|
|
@@ -22048,22 +22361,22 @@ async function withTimeout(promise2, timeoutMs, operation) {
|
|
|
22048
22361
|
}
|
|
22049
22362
|
function projectKimiTextUpdate(update) {
|
|
22050
22363
|
const content = update.content;
|
|
22051
|
-
let
|
|
22364
|
+
let text2 = "";
|
|
22052
22365
|
if (content && typeof content === "object") {
|
|
22053
22366
|
const c = content;
|
|
22054
22367
|
if (typeof c.text === "string")
|
|
22055
|
-
|
|
22368
|
+
text2 = c.text;
|
|
22056
22369
|
else if (typeof c.thought === "string")
|
|
22057
|
-
|
|
22370
|
+
text2 = c.thought;
|
|
22058
22371
|
else if (typeof c.think === "string")
|
|
22059
|
-
|
|
22372
|
+
text2 = c.think;
|
|
22060
22373
|
} else if (typeof update.text === "string") {
|
|
22061
|
-
|
|
22374
|
+
text2 = update.text;
|
|
22062
22375
|
}
|
|
22063
22376
|
if (update.sessionUpdate === "agent_message_chunk")
|
|
22064
|
-
return { type: "agent.text", text };
|
|
22377
|
+
return { type: "agent.text", text: text2 };
|
|
22065
22378
|
if (update.sessionUpdate === "agent_thought_chunk")
|
|
22066
|
-
return { type: "agent.thought", text };
|
|
22379
|
+
return { type: "agent.thought", text: text2 };
|
|
22067
22380
|
return null;
|
|
22068
22381
|
}
|
|
22069
22382
|
function projectKimiToolUpdate(update) {
|
|
@@ -22166,13 +22479,13 @@ var KimiAcpTransport = class {
|
|
|
22166
22479
|
}
|
|
22167
22480
|
return { initialize, authReady };
|
|
22168
22481
|
}
|
|
22169
|
-
async openSession(
|
|
22482
|
+
async openSession(input2) {
|
|
22170
22483
|
await this.#ensureInitialized();
|
|
22171
22484
|
const connection = this.#connection;
|
|
22172
22485
|
if (!connection)
|
|
22173
22486
|
throw new KimiTransportError("unavailable", "Kimi ACP is unavailable");
|
|
22174
|
-
const targetCwd =
|
|
22175
|
-
if (
|
|
22487
|
+
const targetCwd = input2.cwd || this.#options.cwd;
|
|
22488
|
+
if (input2.kind === "create") {
|
|
22176
22489
|
const created = await withTimeout(connection.newSession({ cwd: targetCwd, mcpServers: [] }), this.#commandTimeoutMs, "Kimi session/new");
|
|
22177
22490
|
this.#sessionId = created.sessionId;
|
|
22178
22491
|
const createdRaw = created;
|
|
@@ -22182,19 +22495,19 @@ var KimiAcpTransport = class {
|
|
|
22182
22495
|
...createdRaw.modes !== void 0 ? { modes: createdRaw.modes } : {}
|
|
22183
22496
|
};
|
|
22184
22497
|
}
|
|
22185
|
-
if (
|
|
22186
|
-
if (!
|
|
22498
|
+
if (input2.kind === "fork") {
|
|
22499
|
+
if (!input2.sessionId) {
|
|
22187
22500
|
throw new KimiTransportError("unavailable", "Session ID required for fork");
|
|
22188
22501
|
}
|
|
22189
22502
|
let forked;
|
|
22190
22503
|
try {
|
|
22191
22504
|
forked = await withTimeout(connection.unstable_forkSession({
|
|
22192
|
-
sessionId:
|
|
22505
|
+
sessionId: input2.sessionId,
|
|
22193
22506
|
cwd: targetCwd,
|
|
22194
22507
|
mcpServers: []
|
|
22195
22508
|
}), this.#commandTimeoutMs, "Kimi session/fork");
|
|
22196
22509
|
} catch (error51) {
|
|
22197
|
-
throw new KimiTransportError("unavailable", `Failed to fork session ${
|
|
22510
|
+
throw new KimiTransportError("unavailable", `Failed to fork session ${input2.sessionId}: ${error51 instanceof Error ? error51.message : String(error51)}`, { cause: error51 });
|
|
22198
22511
|
}
|
|
22199
22512
|
const raw2 = forked && typeof forked === "object" ? forked : {};
|
|
22200
22513
|
const forkedSessionId = typeof raw2.sessionId === "string" ? raw2.sessionId : "";
|
|
@@ -22208,23 +22521,23 @@ var KimiAcpTransport = class {
|
|
|
22208
22521
|
...raw2.modes !== void 0 ? { modes: raw2.modes } : {}
|
|
22209
22522
|
};
|
|
22210
22523
|
}
|
|
22211
|
-
if (!
|
|
22524
|
+
if (!input2.sessionId) {
|
|
22212
22525
|
throw new KimiTransportError("unavailable", "Session ID required for resume/load");
|
|
22213
22526
|
}
|
|
22214
|
-
this.#sessionId =
|
|
22527
|
+
this.#sessionId = input2.sessionId;
|
|
22215
22528
|
let loaded;
|
|
22216
22529
|
try {
|
|
22217
22530
|
loaded = await withTimeout(connection.loadSession({
|
|
22218
|
-
sessionId:
|
|
22531
|
+
sessionId: input2.sessionId,
|
|
22219
22532
|
cwd: targetCwd,
|
|
22220
22533
|
mcpServers: []
|
|
22221
22534
|
}), this.#commandTimeoutMs, "Kimi session/load");
|
|
22222
22535
|
} catch (error51) {
|
|
22223
|
-
throw new KimiTransportError("unavailable", `Failed to load session ${
|
|
22536
|
+
throw new KimiTransportError("unavailable", `Failed to load session ${input2.sessionId}: ${error51 instanceof Error ? error51.message : String(error51)}`, { cause: error51 });
|
|
22224
22537
|
}
|
|
22225
22538
|
const raw = loaded && typeof loaded === "object" ? loaded : {};
|
|
22226
22539
|
return {
|
|
22227
|
-
sessionId:
|
|
22540
|
+
sessionId: input2.sessionId,
|
|
22228
22541
|
...Array.isArray(raw.configOptions) ? { configOptions: raw.configOptions } : {},
|
|
22229
22542
|
...raw.modes !== void 0 ? { modes: raw.modes } : {}
|
|
22230
22543
|
};
|
|
@@ -22247,7 +22560,7 @@ var KimiAcpTransport = class {
|
|
|
22247
22560
|
throw new KimiTransportError("unavailable", `Failed to set config option ${configId}: ${error51 instanceof Error ? error51.message : String(error51)}`, { cause: error51 });
|
|
22248
22561
|
}
|
|
22249
22562
|
}
|
|
22250
|
-
async prompt(
|
|
22563
|
+
async prompt(text2, handler) {
|
|
22251
22564
|
const connection = this.#connection;
|
|
22252
22565
|
const sessionId = this.#sessionId;
|
|
22253
22566
|
if (!connection || !sessionId || this.#closed) {
|
|
@@ -22255,7 +22568,7 @@ var KimiAcpTransport = class {
|
|
|
22255
22568
|
}
|
|
22256
22569
|
this.#activePrompt = handler;
|
|
22257
22570
|
try {
|
|
22258
|
-
return await connection.prompt({ sessionId, prompt: [{ type: "text", text }] });
|
|
22571
|
+
return await connection.prompt({ sessionId, prompt: [{ type: "text", text: text2 }] });
|
|
22259
22572
|
} catch (error51) {
|
|
22260
22573
|
throw new KimiTransportError("unavailable", `Kimi session/prompt failed: ${error51 instanceof Error ? error51.message : String(error51)}`, { cause: error51 });
|
|
22261
22574
|
} finally {
|
|
@@ -22577,9 +22890,9 @@ function projectKimiUsages(payload) {
|
|
|
22577
22890
|
});
|
|
22578
22891
|
return parsed.success ? parsed.data : null;
|
|
22579
22892
|
}
|
|
22580
|
-
async function readNativeCredentials(
|
|
22893
|
+
async function readNativeCredentials(filePath2, readAuthFile) {
|
|
22581
22894
|
try {
|
|
22582
|
-
const raw = JSON.parse(await readAuthFile(
|
|
22895
|
+
const raw = JSON.parse(await readAuthFile(filePath2));
|
|
22583
22896
|
if (!isRecord3(raw))
|
|
22584
22897
|
return void 0;
|
|
22585
22898
|
const parsed = credentialSchema.safeParse(raw);
|
|
@@ -22588,16 +22901,16 @@ async function readNativeCredentials(filePath, readAuthFile) {
|
|
|
22588
22901
|
return void 0;
|
|
22589
22902
|
}
|
|
22590
22903
|
}
|
|
22591
|
-
async function defaultWriteAuthFile(
|
|
22592
|
-
const temporary = `${
|
|
22904
|
+
async function defaultWriteAuthFile(filePath2, contents) {
|
|
22905
|
+
const temporary = `${filePath2}.${randomUUID()}.tmp`;
|
|
22593
22906
|
try {
|
|
22594
22907
|
await writeFile2(temporary, contents, { encoding: "utf8", mode: 384, flag: "wx" });
|
|
22595
|
-
await rename(temporary,
|
|
22908
|
+
await rename(temporary, filePath2);
|
|
22596
22909
|
} finally {
|
|
22597
22910
|
await unlink(temporary).catch(() => void 0);
|
|
22598
22911
|
}
|
|
22599
22912
|
}
|
|
22600
|
-
async function refreshNativeCredentials(environment, stored,
|
|
22913
|
+
async function refreshNativeCredentials(environment, stored, filePath2, fetchImpl, writeAuthFile, signal, now) {
|
|
22601
22914
|
const refreshToken = stored.credentials.refresh_token;
|
|
22602
22915
|
if (!refreshToken)
|
|
22603
22916
|
return void 0;
|
|
@@ -22626,7 +22939,7 @@ async function refreshNativeCredentials(environment, stored, filePath, fetchImpl
|
|
|
22626
22939
|
...parsed.data.scope ? { scope: parsed.data.scope } : {},
|
|
22627
22940
|
...parsed.data.token_type ? { token_type: parsed.data.token_type } : {}
|
|
22628
22941
|
};
|
|
22629
|
-
await writeAuthFile(
|
|
22942
|
+
await writeAuthFile(filePath2, `${JSON.stringify(next, void 0, 2)}
|
|
22630
22943
|
`).catch(() => void 0);
|
|
22631
22944
|
stored.raw = next;
|
|
22632
22945
|
stored.credentials = {
|
|
@@ -22638,22 +22951,22 @@ async function refreshNativeCredentials(environment, stored, filePath, fetchImpl
|
|
|
22638
22951
|
};
|
|
22639
22952
|
return parsed.data.access_token;
|
|
22640
22953
|
}
|
|
22641
|
-
async function fetchKimiAccount(
|
|
22954
|
+
async function fetchKimiAccount(input2 = {}) {
|
|
22642
22955
|
try {
|
|
22643
|
-
const environment =
|
|
22956
|
+
const environment = input2.environment ?? process.env;
|
|
22644
22957
|
const fromEnv = environment.KIMI_CODE_API_KEY?.trim() || environment.KIMI_API_KEY?.trim();
|
|
22645
|
-
const readAuthFile =
|
|
22646
|
-
const writeAuthFile =
|
|
22647
|
-
const fetchImpl =
|
|
22648
|
-
const requestSignal = () =>
|
|
22649
|
-
const now =
|
|
22650
|
-
const
|
|
22651
|
-
const stored = fromEnv ? void 0 : await readNativeCredentials(
|
|
22958
|
+
const readAuthFile = input2.readAuthFile ?? ((filePath3) => readFile2(filePath3, "utf8"));
|
|
22959
|
+
const writeAuthFile = input2.writeAuthFile ?? defaultWriteAuthFile;
|
|
22960
|
+
const fetchImpl = input2.fetch ?? fetch;
|
|
22961
|
+
const requestSignal = () => input2.signal ? AbortSignal.any([input2.signal, AbortSignal.timeout(REQUEST_TIMEOUT_MS)]) : AbortSignal.timeout(REQUEST_TIMEOUT_MS);
|
|
22962
|
+
const now = input2.now ?? Date.now();
|
|
22963
|
+
const filePath2 = credentialPath(environment);
|
|
22964
|
+
const stored = fromEnv ? void 0 : await readNativeCredentials(filePath2, readAuthFile);
|
|
22652
22965
|
let token = fromEnv ?? stored?.credentials.access_token;
|
|
22653
22966
|
if (!token)
|
|
22654
22967
|
return null;
|
|
22655
22968
|
if (stored && !accessTokenFresh(stored.credentials, now)) {
|
|
22656
|
-
token = await refreshNativeCredentials(environment, stored,
|
|
22969
|
+
token = await refreshNativeCredentials(environment, stored, filePath2, fetchImpl, writeAuthFile, requestSignal(), now) ?? token;
|
|
22657
22970
|
}
|
|
22658
22971
|
const requestUsages = (accessToken) => fetchImpl(KIMI_USAGES_ENDPOINT, {
|
|
22659
22972
|
method: "GET",
|
|
@@ -22662,7 +22975,7 @@ async function fetchKimiAccount(input = {}) {
|
|
|
22662
22975
|
});
|
|
22663
22976
|
let response = await requestUsages(token);
|
|
22664
22977
|
if (response.status === 401 && stored?.credentials.refresh_token) {
|
|
22665
|
-
const refreshed = await refreshNativeCredentials(environment, stored,
|
|
22978
|
+
const refreshed = await refreshNativeCredentials(environment, stored, filePath2, fetchImpl, writeAuthFile, requestSignal(), now);
|
|
22666
22979
|
if (!refreshed)
|
|
22667
22980
|
return null;
|
|
22668
22981
|
token = refreshed;
|
|
@@ -23085,9 +23398,9 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
|
|
|
23085
23398
|
} }));
|
|
23086
23399
|
}
|
|
23087
23400
|
}
|
|
23088
|
-
function splitLines(
|
|
23089
|
-
const hasTrailingNl =
|
|
23090
|
-
const result =
|
|
23401
|
+
function splitLines(text2) {
|
|
23402
|
+
const hasTrailingNl = text2.endsWith("\n");
|
|
23403
|
+
const result = text2.split("\n").map((line) => line + "\n");
|
|
23091
23404
|
if (hasTrailingNl) {
|
|
23092
23405
|
result.pop();
|
|
23093
23406
|
} else {
|
|
@@ -23989,19 +24302,11 @@ function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
|
23989
24302
|
*/
|
|
23990
24303
|
|
|
23991
24304
|
// dist/models.js
|
|
23992
|
-
|
|
23993
|
-
|
|
23994
|
-
const encoded = Buffer.from(alias, "utf8").toString("base64url");
|
|
23995
|
-
return harnessModelRefSchema.parse({
|
|
23996
|
-
id: harnessModelRefIdSchema.parse(`${KIMI_MODEL_PREFIX}${encoded}`)
|
|
23997
|
-
});
|
|
24305
|
+
function kimiModelRef(id2) {
|
|
24306
|
+
return harnessModelRefSchema.parse({ id: id2 });
|
|
23998
24307
|
}
|
|
23999
|
-
function
|
|
24000
|
-
|
|
24001
|
-
throw new Error(`Invalid Kimi model ref ID: ${id}`);
|
|
24002
|
-
}
|
|
24003
|
-
const payload = id.slice(KIMI_MODEL_PREFIX.length);
|
|
24004
|
-
return Buffer.from(payload, "base64url").toString("utf8");
|
|
24308
|
+
function normalizeStoredKimiModelRef(ref, catalog) {
|
|
24309
|
+
return normalizeLegacyBase64ModelRef(ref, catalog, "kimi.");
|
|
24005
24310
|
}
|
|
24006
24311
|
var KIMI_MODES = ["default", "plan", "auto", "yolo"];
|
|
24007
24312
|
function isKimiModeId(value) {
|
|
@@ -24056,7 +24361,7 @@ function parseKimiConfigToml(content) {
|
|
|
24056
24361
|
} catch (error51) {
|
|
24057
24362
|
throw new Error(`Failed to parse Kimi config.toml: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
24058
24363
|
}
|
|
24059
|
-
const defaultModel = typeof parsed.default_model === "string" ? parsed.default_model
|
|
24364
|
+
const defaultModel = typeof parsed.default_model === "string" ? parsed.default_model : void 0;
|
|
24060
24365
|
const models = [];
|
|
24061
24366
|
if (typeof parsed.models === "object" && parsed.models !== null) {
|
|
24062
24367
|
for (const [alias, details] of Object.entries(parsed.models)) {
|
|
@@ -24123,17 +24428,17 @@ function buildModelCatalogFromConfig(config2, thinkingOptionsList) {
|
|
|
24123
24428
|
thinkingOptions.set(option.id, option);
|
|
24124
24429
|
const label = m.model ? `${m.alias} (${m.model})` : m.alias;
|
|
24125
24430
|
return harnessModelSchema.parse({
|
|
24126
|
-
ref:
|
|
24431
|
+
ref: kimiModelRef(m.alias),
|
|
24127
24432
|
label: label.slice(0, 256),
|
|
24128
24433
|
...m.model ? { resolvedModelLabel: m.model.slice(0, 256) } : {},
|
|
24129
|
-
supportedThinkingOptionIds: options.map(({ id }) =>
|
|
24434
|
+
supportedThinkingOptionIds: options.map(({ id: id2 }) => id2)
|
|
24130
24435
|
});
|
|
24131
24436
|
});
|
|
24132
|
-
const
|
|
24133
|
-
const
|
|
24134
|
-
const configuredDefault = config2.models.find((model2) =>
|
|
24437
|
+
const selectedModel = models.find((model2) => model2.ref.id === config2.defaultModel) ?? models[0];
|
|
24438
|
+
const defaultModel = selectedModel?.ref;
|
|
24439
|
+
const configuredDefault = config2.models.find((model2) => model2.alias === defaultModel?.id)?.defaultEffort;
|
|
24135
24440
|
const requestedDefault = config2.thinking?.enabled === false ? "off" : config2.thinking?.effort ?? configuredDefault;
|
|
24136
|
-
const defaultThinkingOptionId = selectedModel?.supportedThinkingOptionIds?.find((
|
|
24441
|
+
const defaultThinkingOptionId = selectedModel?.supportedThinkingOptionIds?.find((id2) => id2 === requestedDefault);
|
|
24137
24442
|
return harnessModelCatalogSchema.parse({
|
|
24138
24443
|
models,
|
|
24139
24444
|
...defaultModel ? { defaultModel } : {},
|
|
@@ -24473,9 +24778,9 @@ function activeKimiWireRecords(content) {
|
|
|
24473
24778
|
}
|
|
24474
24779
|
}
|
|
24475
24780
|
const branches = /* @__PURE__ */ new Map();
|
|
24476
|
-
let
|
|
24781
|
+
let active2 = "main";
|
|
24477
24782
|
let segment = { start: 0, end: records.length };
|
|
24478
|
-
branches.set(
|
|
24783
|
+
branches.set(active2, segment);
|
|
24479
24784
|
for (const [index, record3] of records.entries()) {
|
|
24480
24785
|
if (record3?.type !== "agent.switched")
|
|
24481
24786
|
continue;
|
|
@@ -24491,19 +24796,19 @@ function activeKimiWireRecords(content) {
|
|
|
24491
24796
|
end: records.length,
|
|
24492
24797
|
base: { branch: base.branch, line: base.line }
|
|
24493
24798
|
};
|
|
24494
|
-
|
|
24495
|
-
branches.set(
|
|
24799
|
+
active2 = record3.branch;
|
|
24800
|
+
branches.set(active2, segment);
|
|
24496
24801
|
}
|
|
24497
24802
|
const ranges = [];
|
|
24498
24803
|
let end = records.length;
|
|
24499
24804
|
for (; ; ) {
|
|
24500
|
-
const branch = branches.get(
|
|
24805
|
+
const branch = branches.get(active2);
|
|
24501
24806
|
if (!branch)
|
|
24502
|
-
throw new Error(`Unknown Kimi branch: ${
|
|
24807
|
+
throw new Error(`Unknown Kimi branch: ${active2}`);
|
|
24503
24808
|
ranges.push({ start: branch.start, end });
|
|
24504
24809
|
if (!branch.base)
|
|
24505
24810
|
break;
|
|
24506
|
-
|
|
24811
|
+
active2 = branch.base.branch;
|
|
24507
24812
|
end = branch.base.line;
|
|
24508
24813
|
}
|
|
24509
24814
|
return ranges.reverse().flatMap(({ start, end: end2 }) => records.slice(start, end2)).filter((record3) => record3 !== void 0 && record3.type !== "agent.switched");
|
|
@@ -24698,10 +25003,10 @@ async function parseKimiWireLog(wireContent, sessionId, mainHomeDir) {
|
|
|
24698
25003
|
} else if (type === "file_history.tracked") {
|
|
24699
25004
|
const turnId = typeof record3.turnId === "number" ? record3.turnId : 0;
|
|
24700
25005
|
const turn = getOrCreateTurn(turnId);
|
|
24701
|
-
const
|
|
25006
|
+
const filePath2 = typeof record3.path === "string" ? record3.path : void 0;
|
|
24702
25007
|
const entry = record3.entry;
|
|
24703
|
-
if (
|
|
24704
|
-
turn.fileHistoryTracked.set(
|
|
25008
|
+
if (filePath2 && entry) {
|
|
25009
|
+
turn.fileHistoryTracked.set(filePath2, {
|
|
24705
25010
|
key: typeof entry.key === "string" ? entry.key : null,
|
|
24706
25011
|
version: typeof entry.version === "number" ? entry.version : 1
|
|
24707
25012
|
});
|
|
@@ -24711,9 +25016,9 @@ async function parseKimiWireLog(wireContent, sessionId, mainHomeDir) {
|
|
|
24711
25016
|
const turn = getOrCreateTurn(turnId);
|
|
24712
25017
|
const entries = record3.entries;
|
|
24713
25018
|
if (entries) {
|
|
24714
|
-
for (const [
|
|
25019
|
+
for (const [filePath2, entry] of Object.entries(entries)) {
|
|
24715
25020
|
if (typeof entry?.key === "string") {
|
|
24716
|
-
turn.fileHistoryCheckpoint.set(
|
|
25021
|
+
turn.fileHistoryCheckpoint.set(filePath2, {
|
|
24717
25022
|
key: entry.key,
|
|
24718
25023
|
version: typeof entry.version === "number" ? entry.version : 1,
|
|
24719
25024
|
...typeof entry.size === "number" ? { size: entry.size } : {}
|
|
@@ -24733,10 +25038,10 @@ async function parseKimiWireLog(wireContent, sessionId, mainHomeDir) {
|
|
|
24733
25038
|
const part = event.part;
|
|
24734
25039
|
if (part) {
|
|
24735
25040
|
const isThought = part.type === "thought" || part.type === "think";
|
|
24736
|
-
const
|
|
24737
|
-
if (
|
|
25041
|
+
const text2 = typeof part.text === "string" ? part.text : typeof part.think === "string" ? part.think : typeof part.thought === "string" ? part.thought : "";
|
|
25042
|
+
if (text2 || isThought) {
|
|
24738
25043
|
turn.contentParts.push({
|
|
24739
|
-
text:
|
|
25044
|
+
text: text2 || "思考中...",
|
|
24740
25045
|
thought: isThought,
|
|
24741
25046
|
...typeof event.uuid === "string" ? { uuid: event.uuid } : {},
|
|
24742
25047
|
order: eventOrder++
|
|
@@ -24866,9 +25171,9 @@ async function parseKimiWireLog(wireContent, sessionId, mainHomeDir) {
|
|
|
24866
25171
|
...turn.fileHistoryTracked.keys(),
|
|
24867
25172
|
...turn.fileHistoryCheckpoint.keys()
|
|
24868
25173
|
]);
|
|
24869
|
-
for (const
|
|
24870
|
-
const tracked = turn.fileHistoryTracked.get(
|
|
24871
|
-
const checkpoint = turn.fileHistoryCheckpoint.get(
|
|
25174
|
+
for (const filePath2 of allPaths) {
|
|
25175
|
+
const tracked = turn.fileHistoryTracked.get(filePath2);
|
|
25176
|
+
const checkpoint = turn.fileHistoryCheckpoint.get(filePath2);
|
|
24872
25177
|
let oldContent = "";
|
|
24873
25178
|
let newContent = "";
|
|
24874
25179
|
if (tracked?.key) {
|
|
@@ -24887,9 +25192,9 @@ async function parseKimiWireLog(wireContent, sessionId, mainHomeDir) {
|
|
|
24887
25192
|
}
|
|
24888
25193
|
if (oldContent !== newContent) {
|
|
24889
25194
|
const kind = !tracked || tracked.key === null ? "add" : !checkpoint ? "delete" : "update";
|
|
24890
|
-
const patch = createTwoFilesPatch(
|
|
25195
|
+
const patch = createTwoFilesPatch(filePath2, filePath2, oldContent, newContent, "", "");
|
|
24891
25196
|
changes.push({
|
|
24892
|
-
path:
|
|
25197
|
+
path: filePath2.replaceAll("\\", "/"),
|
|
24893
25198
|
kind,
|
|
24894
25199
|
unifiedDiff: patch
|
|
24895
25200
|
});
|
|
@@ -24941,7 +25246,7 @@ async function parseKimiWireLog(wireContent, sessionId, mainHomeDir) {
|
|
|
24941
25246
|
input: turn.input.length > 0 ? turn.input : [{ type: "text", text: "" }],
|
|
24942
25247
|
items,
|
|
24943
25248
|
outcome,
|
|
24944
|
-
...turn.model ? { model:
|
|
25249
|
+
...turn.model ? { model: kimiModelRef(turn.model) } : {},
|
|
24945
25250
|
...turn.startedAtMs !== void 0 ? { startedAtMs: turn.startedAtMs } : {},
|
|
24946
25251
|
...turn.completedAtMs !== void 0 ? { completedAtMs: turn.completedAtMs } : {}
|
|
24947
25252
|
});
|
|
@@ -25074,15 +25379,15 @@ function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_
|
|
|
25074
25379
|
return normalized;
|
|
25075
25380
|
return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
|
|
25076
25381
|
}
|
|
25077
|
-
function sessionImportCandidate(
|
|
25078
|
-
const time3 = typeof
|
|
25382
|
+
function sessionImportCandidate(input2) {
|
|
25383
|
+
const time3 = typeof input2.updatedAt === "number" ? input2.updatedAt : typeof input2.updatedAt === "string" ? Date.parse(input2.updatedAt) : Number.NaN;
|
|
25079
25384
|
const parsed = harnessSessionImportCandidateSchema.safeParse({
|
|
25080
|
-
nativeSessionId:
|
|
25081
|
-
cwd:
|
|
25082
|
-
title: typeof
|
|
25385
|
+
nativeSessionId: input2.nativeSessionId,
|
|
25386
|
+
cwd: input2.cwd,
|
|
25387
|
+
title: typeof input2.title === "string" && input2.title.trim().length > 0 ? input2.title : null,
|
|
25083
25388
|
updatedAt: Math.floor(time3),
|
|
25084
25389
|
// Unknown must stay unknown; only an explicit boolean is a native statement.
|
|
25085
|
-
running: typeof
|
|
25390
|
+
running: typeof input2.running === "boolean" ? input2.running : null
|
|
25086
25391
|
});
|
|
25087
25392
|
return parsed.success ? parsed.data : null;
|
|
25088
25393
|
}
|
|
@@ -25239,7 +25544,7 @@ var KimiSessionImport = class {
|
|
|
25239
25544
|
return null;
|
|
25240
25545
|
signal.throwIfAborted();
|
|
25241
25546
|
const { turns } = await readKimiSessionSnapshot(nativeSessionId, options);
|
|
25242
|
-
const prompt = turns.flatMap((turn) => turn.input).find((
|
|
25547
|
+
const prompt = turns.flatMap((turn) => turn.input).find((input2) => input2.type === "text" && input2.text.trim().length > 0);
|
|
25243
25548
|
if (!prompt)
|
|
25244
25549
|
return null;
|
|
25245
25550
|
const activity = turns.flatMap((turn) => [turn.completedAtMs, turn.startedAtMs]).filter((time3) => typeof time3 === "number" && Number.isFinite(time3));
|
|
@@ -25393,19 +25698,19 @@ function formatKimiCommandPrompt(invocation) {
|
|
|
25393
25698
|
};
|
|
25394
25699
|
}
|
|
25395
25700
|
const base = `/${cleanId}`;
|
|
25396
|
-
const
|
|
25397
|
-
const prompt =
|
|
25701
|
+
const text2 = invocation.arguments && typeof invocation.arguments.text === "string" ? invocation.arguments.text.trim() : "";
|
|
25702
|
+
const prompt = text2.length > 0 ? `${base} ${text2}` : base;
|
|
25398
25703
|
return { ok: true, value: prompt };
|
|
25399
25704
|
}
|
|
25400
|
-
function stripAnsi(
|
|
25401
|
-
if (!
|
|
25402
|
-
return
|
|
25403
|
-
return
|
|
25705
|
+
function stripAnsi(text2) {
|
|
25706
|
+
if (!text2)
|
|
25707
|
+
return text2;
|
|
25708
|
+
return text2.replace(/\u001b\[[0-9;]*[a-zA-Z]/gu, "").replaceAll("\r\n", "\n");
|
|
25404
25709
|
}
|
|
25405
|
-
function formatKimiCommandOutput(
|
|
25406
|
-
if (!
|
|
25407
|
-
return
|
|
25408
|
-
const cleaned = stripAnsi(
|
|
25710
|
+
function formatKimiCommandOutput(text2) {
|
|
25711
|
+
if (!text2)
|
|
25712
|
+
return text2;
|
|
25713
|
+
const cleaned = stripAnsi(text2);
|
|
25409
25714
|
if (/^Available commands:\s*\n/iu.test(cleaned)) {
|
|
25410
25715
|
const lines = cleaned.split("\n");
|
|
25411
25716
|
const formatted = ["### Available Commands\n"];
|
|
@@ -25730,7 +26035,7 @@ var KimiSession = class {
|
|
|
25730
26035
|
delete state.effectiveThinkingOptionId;
|
|
25731
26036
|
delete state.effectivePermissionModeId;
|
|
25732
26037
|
if (effective.modelAlias)
|
|
25733
|
-
state.effectiveModel =
|
|
26038
|
+
state.effectiveModel = kimiModelRef(effective.modelAlias);
|
|
25734
26039
|
if (effective.thinkingOptionId)
|
|
25735
26040
|
state.effectiveThinkingOptionId = effective.thinkingOptionId;
|
|
25736
26041
|
if (effective.permissionModeId)
|
|
@@ -25763,7 +26068,7 @@ var KimiSession = class {
|
|
|
25763
26068
|
if (this.#activeTurn) {
|
|
25764
26069
|
return err("sessionBusy", "Another turn is already in progress");
|
|
25765
26070
|
}
|
|
25766
|
-
if (!command.input.some((
|
|
26071
|
+
if (!command.input.some((input2) => input2.text.trim())) {
|
|
25767
26072
|
return err("invalidRequest", "Kimi prompt cannot be empty");
|
|
25768
26073
|
}
|
|
25769
26074
|
const turnId = command.turnId;
|
|
@@ -25839,18 +26144,18 @@ var KimiSession = class {
|
|
|
25839
26144
|
}
|
|
25840
26145
|
return currentReasoning;
|
|
25841
26146
|
};
|
|
25842
|
-
const appendReasoningText = (
|
|
25843
|
-
if (!
|
|
26147
|
+
const appendReasoningText = (text2) => {
|
|
26148
|
+
if (!text2)
|
|
25844
26149
|
return;
|
|
25845
26150
|
const reasoning = ensureReasoning();
|
|
25846
|
-
reasoning.text +=
|
|
26151
|
+
reasoning.text += text2;
|
|
25847
26152
|
this.#channel.emit({
|
|
25848
26153
|
kind: "event",
|
|
25849
26154
|
event: {
|
|
25850
26155
|
type: "item.updated",
|
|
25851
26156
|
turnId,
|
|
25852
26157
|
itemId: reasoning.itemId,
|
|
25853
|
-
update: { type: "text.append", text }
|
|
26158
|
+
update: { type: "text.append", text: text2 }
|
|
25854
26159
|
}
|
|
25855
26160
|
});
|
|
25856
26161
|
};
|
|
@@ -25870,8 +26175,8 @@ var KimiSession = class {
|
|
|
25870
26175
|
let currentAgentMessage = null;
|
|
25871
26176
|
let messageIndex = 0;
|
|
25872
26177
|
let hasHadToolCallsInTurn = false;
|
|
25873
|
-
const appendAgentText = (
|
|
25874
|
-
if (!
|
|
26178
|
+
const appendAgentText = (text2, phase) => {
|
|
26179
|
+
if (!text2)
|
|
25875
26180
|
return;
|
|
25876
26181
|
if (!currentAgentMessage) {
|
|
25877
26182
|
currentAgentMessage = {
|
|
@@ -25889,14 +26194,14 @@ var KimiSession = class {
|
|
|
25889
26194
|
}
|
|
25890
26195
|
});
|
|
25891
26196
|
}
|
|
25892
|
-
currentAgentMessage.text +=
|
|
26197
|
+
currentAgentMessage.text += text2;
|
|
25893
26198
|
this.#channel.emit({
|
|
25894
26199
|
kind: "event",
|
|
25895
26200
|
event: {
|
|
25896
26201
|
type: "item.updated",
|
|
25897
26202
|
turnId,
|
|
25898
26203
|
itemId: currentAgentMessage.itemId,
|
|
25899
|
-
update: { type: "text.append", text }
|
|
26204
|
+
update: { type: "text.append", text: text2 }
|
|
25900
26205
|
}
|
|
25901
26206
|
});
|
|
25902
26207
|
};
|
|
@@ -26164,7 +26469,7 @@ var KimiSession = class {
|
|
|
26164
26469
|
} else if (this.#activeTurn?.cancellationRequested) {
|
|
26165
26470
|
try {
|
|
26166
26471
|
if (previousNativeTurnKeys) {
|
|
26167
|
-
const quickTurns = (await this.#readNativeTurns()).filter((turn) => !previousNativeTurnKeys.has(turn.nativeTurnRef.nativeTurnKey) && turn.input.map((
|
|
26472
|
+
const quickTurns = (await this.#readNativeTurns()).filter((turn) => !previousNativeTurnKeys.has(turn.nativeTurnRef.nativeTurnKey) && turn.input.map((input2) => input2.text).join("\n").trim() === inputText.trim());
|
|
26168
26473
|
currentNativeTurn = quickTurns.length === 1 ? quickTurns[0] ?? null : null;
|
|
26169
26474
|
}
|
|
26170
26475
|
} catch {
|
|
@@ -26256,7 +26561,7 @@ var KimiSession = class {
|
|
|
26256
26561
|
do {
|
|
26257
26562
|
try {
|
|
26258
26563
|
const added = (await this.#readNativeTurns()).filter((turn2) => !previousKeys.has(turn2.nativeTurnRef.nativeTurnKey));
|
|
26259
|
-
const matching = added.filter((turn2) => turn2.input.map((
|
|
26564
|
+
const matching = added.filter((turn2) => turn2.input.map((input2) => input2.text).join("\n").trim() === normalizedInput);
|
|
26260
26565
|
if (matching.length > 1) {
|
|
26261
26566
|
return {
|
|
26262
26567
|
turn: null,
|
|
@@ -26319,32 +26624,32 @@ var KimiSession = class {
|
|
|
26319
26624
|
return ok({ cancellationRequested: true });
|
|
26320
26625
|
}
|
|
26321
26626
|
async #handleInteractionRespond(command) {
|
|
26322
|
-
const
|
|
26323
|
-
if (!
|
|
26627
|
+
const active2 = this.#activeInteractions.get(command.interactionId);
|
|
26628
|
+
if (!active2) {
|
|
26324
26629
|
return err("invalidRequest", `No active interaction matches ID ${command.interactionId}`);
|
|
26325
26630
|
}
|
|
26326
|
-
const turnId =
|
|
26327
|
-
if (
|
|
26631
|
+
const turnId = active2.interaction.turnId;
|
|
26632
|
+
if (active2.type === "approval") {
|
|
26328
26633
|
if (command.response.type !== "approval") {
|
|
26329
26634
|
return err("invalidRequest", `Expected approval response for interaction ${command.interactionId}`);
|
|
26330
26635
|
}
|
|
26331
|
-
const validation = validateHostApprovalResponse(
|
|
26636
|
+
const validation = validateHostApprovalResponse(active2.interaction, command.response);
|
|
26332
26637
|
if (validation) {
|
|
26333
26638
|
return err(validation.code, validation.message);
|
|
26334
26639
|
}
|
|
26335
26640
|
this.#activeInteractions.delete(command.interactionId);
|
|
26336
|
-
const optionIdMap =
|
|
26641
|
+
const optionIdMap = active2.metadata;
|
|
26337
26642
|
const selectedOptionId = optionIdMap?.get(command.response.actionId) || command.response.actionId;
|
|
26338
26643
|
this.#channel.emit({
|
|
26339
26644
|
kind: "event",
|
|
26340
26645
|
event: {
|
|
26341
26646
|
type: "interaction.closed",
|
|
26342
|
-
interactionId:
|
|
26647
|
+
interactionId: active2.id,
|
|
26343
26648
|
turnId,
|
|
26344
26649
|
reason: "responded"
|
|
26345
26650
|
}
|
|
26346
26651
|
});
|
|
26347
|
-
|
|
26652
|
+
active2.resolve({
|
|
26348
26653
|
outcome: {
|
|
26349
26654
|
outcome: "selected",
|
|
26350
26655
|
optionId: selectedOptionId
|
|
@@ -26352,38 +26657,33 @@ var KimiSession = class {
|
|
|
26352
26657
|
});
|
|
26353
26658
|
return ok({ accepted: true });
|
|
26354
26659
|
}
|
|
26355
|
-
if (
|
|
26660
|
+
if (active2.type === "question") {
|
|
26356
26661
|
if (command.response.type !== "question") {
|
|
26357
26662
|
return err("invalidRequest", `Expected question response for interaction ${command.interactionId}`);
|
|
26358
26663
|
}
|
|
26359
|
-
const validation = validateHostQuestionResponse(
|
|
26664
|
+
const validation = validateHostQuestionResponse(active2.interaction, command.response);
|
|
26360
26665
|
if (validation) {
|
|
26361
26666
|
return err(validation.code, validation.message);
|
|
26362
26667
|
}
|
|
26363
26668
|
this.#activeInteractions.delete(command.interactionId);
|
|
26364
|
-
const schemaProps =
|
|
26669
|
+
const schemaProps = active2.metadata;
|
|
26365
26670
|
const elicitationResponse = formatElicitationResponse(command.response, schemaProps);
|
|
26366
26671
|
this.#channel.emit({
|
|
26367
26672
|
kind: "event",
|
|
26368
26673
|
event: {
|
|
26369
26674
|
type: "interaction.closed",
|
|
26370
|
-
interactionId:
|
|
26675
|
+
interactionId: active2.id,
|
|
26371
26676
|
turnId,
|
|
26372
26677
|
reason: command.response.cancelled ? "cancelled" : "responded"
|
|
26373
26678
|
}
|
|
26374
26679
|
});
|
|
26375
|
-
|
|
26680
|
+
active2.resolve(elicitationResponse);
|
|
26376
26681
|
return ok({ accepted: true });
|
|
26377
26682
|
}
|
|
26378
26683
|
return err("invalidRequest", `Interaction type mismatch for ${command.interactionId}`);
|
|
26379
26684
|
}
|
|
26380
26685
|
async #handleModelSelect(command) {
|
|
26381
|
-
|
|
26382
|
-
try {
|
|
26383
|
-
alias = decodeKimiModelRefId(command.model.id);
|
|
26384
|
-
} catch {
|
|
26385
|
-
return err("invalidRequest", `Invalid model reference: ${command.model.id}`);
|
|
26386
|
-
}
|
|
26686
|
+
const alias = command.model.id;
|
|
26387
26687
|
try {
|
|
26388
26688
|
const confirmed = await this.#transport.setConfigOption("model", alias);
|
|
26389
26689
|
this.#applyConfigOptions(confirmed);
|
|
@@ -26396,7 +26696,7 @@ var KimiSession = class {
|
|
|
26396
26696
|
}
|
|
26397
26697
|
}
|
|
26398
26698
|
async #handleThinkingSelect(command) {
|
|
26399
|
-
if (!this.#state.availableThinkingOptions?.some(({ id }) =>
|
|
26699
|
+
if (!this.#state.availableThinkingOptions?.some(({ id: id2 }) => id2 === command.thinkingOptionId)) {
|
|
26400
26700
|
return err("invalidRequest", new KimiThinkingSelectionError(command.thinkingOptionId).message);
|
|
26401
26701
|
}
|
|
26402
26702
|
try {
|
|
@@ -26522,7 +26822,7 @@ function err2(code, message, retryable = false) {
|
|
|
26522
26822
|
async function applyRequestedConfig(transport, configOptions, requested) {
|
|
26523
26823
|
let confirmed = configOptions ?? [];
|
|
26524
26824
|
for (const option of requested) {
|
|
26525
|
-
if (option.id === "thinking" && !readKimiThinkingOptions(confirmed).some(({ id }) =>
|
|
26825
|
+
if (option.id === "thinking" && !readKimiThinkingOptions(confirmed).some(({ id: id2 }) => id2 === option.value)) {
|
|
26526
26826
|
throw new KimiThinkingSelectionError(option.value);
|
|
26527
26827
|
}
|
|
26528
26828
|
confirmed = await transport.setConfigOption(option.id, option.value);
|
|
@@ -26539,7 +26839,7 @@ function stateFromConfig(sessionId, cwd, configOptions) {
|
|
|
26539
26839
|
return {
|
|
26540
26840
|
nativeRef: createKimiNativeSessionRef(sessionId, cwd),
|
|
26541
26841
|
availableThinkingOptions: readKimiThinkingOptions(configOptions),
|
|
26542
|
-
...effective.modelAlias ? { effectiveModel:
|
|
26842
|
+
...effective.modelAlias ? { effectiveModel: kimiModelRef(effective.modelAlias) } : {},
|
|
26543
26843
|
...effective.thinkingOptionId ? { effectiveThinkingOptionId: effective.thinkingOptionId } : {},
|
|
26544
26844
|
...effective.permissionModeId ? {
|
|
26545
26845
|
effectivePermissionModeId: harnessPermissionModeIdSchema.parse(effective.permissionModeId)
|
|
@@ -26547,6 +26847,7 @@ function stateFromConfig(sessionId, cwd, configOptions) {
|
|
|
26547
26847
|
};
|
|
26548
26848
|
}
|
|
26549
26849
|
var KimiAdapter = class {
|
|
26850
|
+
normalizeStoredModelRef = normalizeStoredKimiModelRef;
|
|
26550
26851
|
harnessId = kimiHarnessId3;
|
|
26551
26852
|
sessionImport;
|
|
26552
26853
|
#options;
|
|
@@ -26574,14 +26875,14 @@ var KimiAdapter = class {
|
|
|
26574
26875
|
#createTransport(options) {
|
|
26575
26876
|
return this.#deps.createTransport ? this.#deps.createTransport(options) : new KimiAcpTransport(options);
|
|
26576
26877
|
}
|
|
26577
|
-
#resolveExecutable(
|
|
26578
|
-
return this.#deps.resolveExecutable ? this.#deps.resolveExecutable(
|
|
26878
|
+
#resolveExecutable(input2) {
|
|
26879
|
+
return this.#deps.resolveExecutable ? this.#deps.resolveExecutable(input2) : resolveKimiExecutable(input2);
|
|
26579
26880
|
}
|
|
26580
|
-
async inspect(
|
|
26581
|
-
if (!
|
|
26881
|
+
async inspect(input2 = {}) {
|
|
26882
|
+
if (!input2.refresh && this.#inspectionCache) {
|
|
26582
26883
|
return this.#inspectionCache;
|
|
26583
26884
|
}
|
|
26584
|
-
const cwd =
|
|
26885
|
+
const cwd = input2.cwd ?? process.cwd();
|
|
26585
26886
|
const environment = { ...process.env, ...this.#options.environment };
|
|
26586
26887
|
let executable;
|
|
26587
26888
|
try {
|
|
@@ -26668,29 +26969,23 @@ var KimiAdapter = class {
|
|
|
26668
26969
|
this.#inspectionCache = inspection;
|
|
26669
26970
|
return inspection;
|
|
26670
26971
|
}
|
|
26671
|
-
async open(
|
|
26972
|
+
async open(input2) {
|
|
26672
26973
|
if (this.#closed) {
|
|
26673
26974
|
return err2("invalidState", "Adapter is closed");
|
|
26674
26975
|
}
|
|
26675
|
-
const unattended =
|
|
26676
|
-
if (unattended &&
|
|
26976
|
+
const unattended = input2.kind === "create" && input2.executionPolicy === "unattended-full-access";
|
|
26977
|
+
if (unattended && input2.permissionModeId && input2.permissionModeId !== "yolo") {
|
|
26677
26978
|
return err2("invalidRequest", "Kimi Code unattended execution requires the yolo Permission Mode");
|
|
26678
26979
|
}
|
|
26679
|
-
if (
|
|
26980
|
+
if (input2.kind === "resume" && input2.nativeRef.harnessId !== this.harnessId || input2.kind === "rollbackLastTurn" && input2.sourceRef.harnessId !== this.harnessId) {
|
|
26680
26981
|
return err2("invalidRequest", "Native Session belongs to a different Harness");
|
|
26681
26982
|
}
|
|
26682
|
-
if ("permissionModeId" in
|
|
26683
|
-
return err2("invalidRequest", `Unsupported permission mode: ${
|
|
26684
|
-
}
|
|
26685
|
-
let requestedModelAlias;
|
|
26686
|
-
try {
|
|
26687
|
-
if ("model" in input && input.model)
|
|
26688
|
-
requestedModelAlias = decodeKimiModelRefId(input.model.id);
|
|
26689
|
-
} catch (error51) {
|
|
26690
|
-
return err2("invalidRequest", error51 instanceof Error ? error51.message : String(error51));
|
|
26983
|
+
if ("permissionModeId" in input2 && input2.permissionModeId && !isKimiModeId(input2.permissionModeId)) {
|
|
26984
|
+
return err2("invalidRequest", `Unsupported permission mode: ${input2.permissionModeId}`);
|
|
26691
26985
|
}
|
|
26692
|
-
const
|
|
26693
|
-
const
|
|
26986
|
+
const requestedModelAlias = "model" in input2 ? input2.model?.id : void 0;
|
|
26987
|
+
const environment = { ...process.env, ...this.#options.environment, ...input2.environment };
|
|
26988
|
+
const cwd = input2.cwd ?? process.cwd();
|
|
26694
26989
|
const kimiCodeHome = getKimiCodeHome(this.#options.homeDirectory, environment);
|
|
26695
26990
|
let executable;
|
|
26696
26991
|
try {
|
|
@@ -26702,8 +26997,8 @@ var KimiAdapter = class {
|
|
|
26702
26997
|
} catch (error51) {
|
|
26703
26998
|
return err2("notInstalled", error51 instanceof Error ? error51.message : "Kimi CLI not found");
|
|
26704
26999
|
}
|
|
26705
|
-
if (
|
|
26706
|
-
return this.#rollbackLastTurn(
|
|
27000
|
+
if (input2.kind === "rollbackLastTurn") {
|
|
27001
|
+
return this.#rollbackLastTurn(input2, executable, {
|
|
26707
27002
|
...environment,
|
|
26708
27003
|
KIMI_CODE_HOME: kimiCodeHome
|
|
26709
27004
|
});
|
|
@@ -26728,16 +27023,16 @@ var KimiAdapter = class {
|
|
|
26728
27023
|
}
|
|
26729
27024
|
const selectedModelAlias = requestedModelAlias ?? nativeConfig?.defaultModel;
|
|
26730
27025
|
const contextWindowTokens = resolveKimiContextWindow(selectedModelAlias, nativeConfig);
|
|
26731
|
-
if (
|
|
27026
|
+
if (input2.kind === "create") {
|
|
26732
27027
|
try {
|
|
26733
27028
|
const sessionInfo = await transport.openSession({ kind: "create", cwd });
|
|
26734
|
-
if (
|
|
26735
|
-
throw new Error(`Unsupported permission mode: ${
|
|
27029
|
+
if (input2.permissionModeId && !isKimiModeId(input2.permissionModeId)) {
|
|
27030
|
+
throw new Error(`Unsupported permission mode: ${input2.permissionModeId}`);
|
|
26736
27031
|
}
|
|
26737
|
-
const permissionModeId =
|
|
27032
|
+
const permissionModeId = input2.permissionModeId ?? (unattended ? "yolo" : void 0);
|
|
26738
27033
|
const requested = [
|
|
26739
|
-
...
|
|
26740
|
-
...
|
|
27034
|
+
...input2.model ? [{ id: "model", value: input2.model.id }] : [],
|
|
27035
|
+
...input2.thinkingOptionId ? [{ id: "thinking", value: input2.thinkingOptionId }] : [],
|
|
26741
27036
|
...permissionModeId ? [{ id: "mode", value: permissionModeId }] : []
|
|
26742
27037
|
];
|
|
26743
27038
|
const configOptions = await applyRequestedConfig(transport, sessionInfo.configOptions, requested);
|
|
@@ -26761,9 +27056,9 @@ var KimiAdapter = class {
|
|
|
26761
27056
|
return err2(error51 instanceof KimiThinkingSelectionError ? "invalidRequest" : "nativeFailure", `Failed to create Kimi session: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
26762
27057
|
}
|
|
26763
27058
|
}
|
|
26764
|
-
if (
|
|
26765
|
-
const sourceSessionId =
|
|
26766
|
-
if (
|
|
27059
|
+
if (input2.kind === "fork") {
|
|
27060
|
+
const sourceSessionId = input2.sourceRef.nativeSessionId;
|
|
27061
|
+
if (input2.sourceRef.harnessId !== this.harnessId) {
|
|
26767
27062
|
await transport.close().catch(() => void 0);
|
|
26768
27063
|
return err2("invalidRequest", "Native Session belongs to a different Harness");
|
|
26769
27064
|
}
|
|
@@ -26775,7 +27070,7 @@ var KimiAdapter = class {
|
|
|
26775
27070
|
await transport.close().catch(() => void 0);
|
|
26776
27071
|
return err2("sessionNotFound", `Kimi source native session not found: ${sourceSessionId}`);
|
|
26777
27072
|
}
|
|
26778
|
-
if (
|
|
27073
|
+
if (input2.checkpoint.harnessId !== this.harnessId || input2.checkpoint.nativeSessionId !== sourceSessionId) {
|
|
26779
27074
|
await transport.close().catch(() => void 0);
|
|
26780
27075
|
return err2("checkpointNotFound", "Kimi Checkpoint does not belong to the source Native Session");
|
|
26781
27076
|
}
|
|
@@ -26795,7 +27090,7 @@ var KimiAdapter = class {
|
|
|
26795
27090
|
}
|
|
26796
27091
|
const latestTurn = sourceSnapshot.turns.at(-1);
|
|
26797
27092
|
const latestCheckpoint = latestTurn?.checkpoint;
|
|
26798
|
-
if (!latestCheckpoint || latestTurn?.outcome.status === "unknown" || latestCheckpoint.checkpointId !==
|
|
27093
|
+
if (!latestCheckpoint || latestTurn?.outcome.status === "unknown" || latestCheckpoint.checkpointId !== input2.checkpoint.checkpointId) {
|
|
26799
27094
|
await transport.close().catch(() => void 0);
|
|
26800
27095
|
return err2("unsupported", "Kimi native Fork only supports the latest native checkpoint");
|
|
26801
27096
|
}
|
|
@@ -26836,8 +27131,8 @@ var KimiAdapter = class {
|
|
|
26836
27131
|
return err2("nativeFailure", `Failed to fork Kimi session: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
26837
27132
|
}
|
|
26838
27133
|
}
|
|
26839
|
-
if (
|
|
26840
|
-
const sessionId =
|
|
27134
|
+
if (input2.kind === "resume") {
|
|
27135
|
+
const sessionId = input2.nativeRef.nativeSessionId;
|
|
26841
27136
|
try {
|
|
26842
27137
|
const located = await locateKimiSession(sessionId, {
|
|
26843
27138
|
kimiCodeHome,
|
|
@@ -26854,13 +27149,13 @@ var KimiAdapter = class {
|
|
|
26854
27149
|
});
|
|
26855
27150
|
if (sessionInfo.sessionId !== sessionId)
|
|
26856
27151
|
throw new Error("Kimi resumed a different Native Session");
|
|
26857
|
-
if (
|
|
26858
|
-
throw new Error(`Unsupported permission mode: ${
|
|
27152
|
+
if (input2.permissionModeId && !isKimiModeId(input2.permissionModeId)) {
|
|
27153
|
+
throw new Error(`Unsupported permission mode: ${input2.permissionModeId}`);
|
|
26859
27154
|
}
|
|
26860
27155
|
const requested = [
|
|
26861
|
-
...
|
|
26862
|
-
...
|
|
26863
|
-
...
|
|
27156
|
+
...input2.model ? [{ id: "model", value: input2.model.id }] : [],
|
|
27157
|
+
...input2.thinkingOptionId ? [{ id: "thinking", value: input2.thinkingOptionId }] : [],
|
|
27158
|
+
...input2.permissionModeId ? [{ id: "mode", value: input2.permissionModeId }] : []
|
|
26864
27159
|
];
|
|
26865
27160
|
const configOptions = await applyRequestedConfig(transport, sessionInfo.configOptions, requested);
|
|
26866
27161
|
const state = stateFromConfig(sessionInfo.sessionId, cwd, configOptions);
|
|
@@ -26892,8 +27187,8 @@ var KimiAdapter = class {
|
|
|
26892
27187
|
await transport.close().catch(() => void 0);
|
|
26893
27188
|
return err2("unsupported", `Unsupported open kind`);
|
|
26894
27189
|
}
|
|
26895
|
-
async #rollbackLastTurn(
|
|
26896
|
-
const sourceId =
|
|
27190
|
+
async #rollbackLastTurn(input2, executable, environment) {
|
|
27191
|
+
const sourceId = input2.sourceRef.nativeSessionId;
|
|
26897
27192
|
const historyOptions = {
|
|
26898
27193
|
kimiCodeHome: getKimiCodeHome(this.#options.homeDirectory, environment)
|
|
26899
27194
|
};
|
|
@@ -26902,7 +27197,7 @@ var KimiAdapter = class {
|
|
|
26902
27197
|
const located = await locateKimiSession(sourceId, historyOptions);
|
|
26903
27198
|
if (!located)
|
|
26904
27199
|
return err2("sessionNotFound", "Kimi source session was not found");
|
|
26905
|
-
if (path9.resolve(
|
|
27200
|
+
if (path9.resolve(input2.cwd) !== path9.resolve(located.state.cwd))
|
|
26906
27201
|
return err2("unsupported", "Kimi cannot roll back into another working directory");
|
|
26907
27202
|
const source = [...this.#sessions].find((candidate) => candidate.initialState.nativeRef?.nativeSessionId === sourceId);
|
|
26908
27203
|
if (source) {
|
|
@@ -26921,7 +27216,7 @@ var KimiAdapter = class {
|
|
|
26921
27216
|
return err2("sessionBusy", "Kimi's last turn has not reached a confirmed terminal state");
|
|
26922
27217
|
const rolledBack = await (this.#deps.rollbackNativeSession ?? rollbackKimiNativeSession)({
|
|
26923
27218
|
command: executable,
|
|
26924
|
-
cwd:
|
|
27219
|
+
cwd: input2.cwd,
|
|
26925
27220
|
environment,
|
|
26926
27221
|
sourceSessionId: sourceId,
|
|
26927
27222
|
timeoutMs: this.#options.commandTimeoutMs ?? 3e4
|
|
@@ -26941,12 +27236,12 @@ var KimiAdapter = class {
|
|
|
26941
27236
|
await copyKimiCommandHistory(commands, derivedId, historyOptions);
|
|
26942
27237
|
const opened = await this.open({
|
|
26943
27238
|
kind: "resume",
|
|
26944
|
-
nativeRef: createKimiNativeSessionRef(derivedId,
|
|
26945
|
-
cwd:
|
|
27239
|
+
nativeRef: createKimiNativeSessionRef(derivedId, input2.cwd),
|
|
27240
|
+
cwd: input2.cwd,
|
|
26946
27241
|
environment,
|
|
26947
|
-
model:
|
|
26948
|
-
thinkingOptionId:
|
|
26949
|
-
permissionModeId:
|
|
27242
|
+
model: input2.model ?? kimiModelRef(rolledBack.model),
|
|
27243
|
+
thinkingOptionId: input2.thinkingOptionId ?? harnessThinkingOptionIdSchema.parse(rolledBack.thinking),
|
|
27244
|
+
permissionModeId: input2.permissionModeId ?? harnessPermissionModeIdSchema.parse(rolledBack.mode)
|
|
26950
27245
|
});
|
|
26951
27246
|
if (!opened.ok)
|
|
26952
27247
|
throw new Error(opened.error.message);
|