@codexhost/cli-linux-arm64 0.24.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 +3166 -3040
- package/app/console-web.js +1156 -585
- package/app/desktop-controller.mjs +645 -264
- package/app/host-runtime.mjs +10906 -10282
- package/app/plugins/antigravity/plugin.mjs +515 -369
- package/app/plugins/claude-code/plugin.mjs +583 -438
- package/app/plugins/codebuddy/plugin.mjs +551 -429
- package/app/plugins/codex-usage/plugin.mjs +344 -224
- package/app/plugins/copilot/plugin.mjs +408 -286
- package/app/plugins/cursor-cli/plugin.mjs +499 -360
- package/app/plugins/deepseek-harness/plugin.mjs +759 -520
- package/app/plugins/devin/plugin.mjs +385 -265
- package/app/plugins/grok/plugin.mjs +638 -516
- package/app/plugins/hermes/plugin.mjs +456 -334
- package/app/plugins/kimi-code/plugin.mjs +454 -332
- package/app/plugins/kiro-cli/plugin.mjs +445 -325
- package/app/plugins/omp/plugin.mjs +707 -339
- package/app/plugins/opencode/plugin.mjs +873 -741
- package/app/plugins/pi/plugin.mjs +481 -359
- package/app/plugins/qoder/plugin.mjs +682 -560
- package/app/plugins/qoder-cn/plugin.mjs +682 -560
- package/app/plugins/qwen-code/plugin.mjs +475 -355
- package/app/plugins/workbuddy/plugin.mjs +549 -429
- package/app/plugins/zcode/plugin.mjs +352 -232
- package/app/renderer-extension.js +1706 -945
- package/app/web/assets/{index-IvFk9KT-.js → index-DUOvhHbV.js} +82 -82
- package/app/web/codexhost-settings.js +416 -51
- package/app/web/index.html +1 -1
- 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 +8 -8
- 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-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 +72 -72
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +97 -97
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/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-files/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-workspace/client.js +8 -8
- package/app/web-modules/server.mjs +2132 -1312
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -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
|
}
|
|
@@ -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,
|
|
@@ -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) => {
|
|
@@ -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";
|
|
@@ -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
|
|
@@ -15078,7 +15080,7 @@ var codexhostErrorSchema = external_exports.strictObject({
|
|
|
15078
15080
|
|
|
15079
15081
|
// ../../shared-contracts/dist/harness-presentation.js
|
|
15080
15082
|
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
15081
|
-
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((
|
|
15083
|
+
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
|
|
15082
15084
|
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
15083
15085
|
label: displayText(256).optional(),
|
|
15084
15086
|
description: displayText(1024).optional()
|
|
@@ -15167,7 +15169,7 @@ var usageMeasurementsSchema = external_exports.object({
|
|
|
15167
15169
|
outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
|
|
15168
15170
|
timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
|
|
15169
15171
|
}).strict();
|
|
15170
|
-
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));
|
|
15171
15173
|
var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
15172
15174
|
kind: external_exports.literal("countdown"),
|
|
15173
15175
|
id: external_exports.string().min(1).max(64),
|
|
@@ -15550,6 +15552,8 @@ var externalThreadInspectionSchema = external_exports.object({
|
|
|
15550
15552
|
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15551
15553
|
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15552
15554
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15555
|
+
/** Live Session catalog when it, not the Adapter inspection, contains `effectiveModel`. */
|
|
15556
|
+
catalog: harnessModelCatalogSchema.optional(),
|
|
15553
15557
|
history: harnessHistoryCapabilitiesSchema,
|
|
15554
15558
|
usage: threadUsageSnapshotSchema.optional(),
|
|
15555
15559
|
locked: external_exports.literal(true)
|
|
@@ -15608,9 +15612,9 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
15608
15612
|
}).strict();
|
|
15609
15613
|
var threadSteeringContextSchema = external_exports.object({
|
|
15610
15614
|
kind: external_exports.literal("application"),
|
|
15611
|
-
value: external_exports.string().transform((
|
|
15615
|
+
value: external_exports.string().transform((text2, context) => {
|
|
15612
15616
|
try {
|
|
15613
|
-
return JSON.parse(
|
|
15617
|
+
return JSON.parse(text2);
|
|
15614
15618
|
} catch {
|
|
15615
15619
|
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15616
15620
|
return external_exports.NEVER;
|
|
@@ -15745,8 +15749,8 @@ var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).r
|
|
|
15745
15749
|
const { username, password } = new URL(value);
|
|
15746
15750
|
return !username && !password && !/[\\\s]/u.test(value);
|
|
15747
15751
|
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
15748
|
-
function localizedText(
|
|
15749
|
-
return external_exports.strictObject({ en:
|
|
15752
|
+
function localizedText(text2) {
|
|
15753
|
+
return external_exports.strictObject({ en: text2, "zh-CN": text2 });
|
|
15750
15754
|
}
|
|
15751
15755
|
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
15752
15756
|
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
@@ -15863,8 +15867,8 @@ var desktopExtensionTrustTierSchema = external_exports.enum(["official", "commun
|
|
|
15863
15867
|
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
15864
15868
|
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
15865
15869
|
}
|
|
15866
|
-
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((
|
|
15867
|
-
const url2 = new URL(
|
|
15870
|
+
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input2) => {
|
|
15871
|
+
const url2 = new URL(input2);
|
|
15868
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);
|
|
15869
15873
|
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
15870
15874
|
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
@@ -16215,6 +16219,8 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
16215
16219
|
"codexhost/workspace/read",
|
|
16216
16220
|
"codexhost/thread/tree/read",
|
|
16217
16221
|
"codexhost/thread/pins/list",
|
|
16222
|
+
"codexhost/thread/sections/list",
|
|
16223
|
+
"codexhost/thread/sections/move",
|
|
16218
16224
|
"codexhost/thread/pins/set",
|
|
16219
16225
|
"codexhost/harness/plugins/list",
|
|
16220
16226
|
"codexhost/harness/inspect",
|
|
@@ -16253,8 +16259,21 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
16253
16259
|
"codexhost/update/check",
|
|
16254
16260
|
"codexhost/update/start",
|
|
16255
16261
|
"codexhost/update/status",
|
|
16262
|
+
"codexhost/announcement/get",
|
|
16263
|
+
"codexhost/announcement/acknowledge",
|
|
16256
16264
|
"codexhost/sessions/loaded/list"
|
|
16257
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();
|
|
16258
16277
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
16259
16278
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
16260
16279
|
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
@@ -16796,8 +16815,8 @@ var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
|
16796
16815
|
operations: external_exports.array(harnessPreferenceOperationSchema).min(1).max(256),
|
|
16797
16816
|
initializeOnly: external_exports.boolean().optional(),
|
|
16798
16817
|
expectedRevision: external_exports.number().int().nonnegative().optional()
|
|
16799
|
-
}).superRefine((
|
|
16800
|
-
for (const operation of
|
|
16818
|
+
}).superRefine((input2, ctx) => {
|
|
16819
|
+
for (const operation of input2.operations) {
|
|
16801
16820
|
if (operation.kind === "newThread" && (!operation.lastHarness && !operation.configuration || Boolean(operation.harnessId) !== Boolean(operation.configuration)))
|
|
16802
16821
|
ctx.addIssue({
|
|
16803
16822
|
code: "custom",
|
|
@@ -17199,13 +17218,18 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
17199
17218
|
// ../../shared-contracts/dist/harness-installation.js
|
|
17200
17219
|
var harnessInstallationParamsSchema = external_exports.object({
|
|
17201
17220
|
harnessId: harnessIdSchema,
|
|
17202
|
-
action: external_exports.enum(["check", "update", "install"])
|
|
17203
|
-
|
|
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);
|
|
17204
17224
|
var harnessInstallationStateSchema = external_exports.object({
|
|
17205
17225
|
currentVersion: external_exports.string().min(1).max(128),
|
|
17206
17226
|
latestVersion: external_exports.string().min(1).max(128),
|
|
17207
17227
|
updateAvailable: external_exports.boolean(),
|
|
17208
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(),
|
|
17209
17233
|
/** Defaults to CLI; some Harnesses ship only inside a desktop application. */
|
|
17210
17234
|
versionKind: external_exports.enum(["cli", "application"]).optional(),
|
|
17211
17235
|
/** Official download opened by the user; does not imply an automatic installation. */
|
|
@@ -17535,6 +17559,38 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
17535
17559
|
status: updateStatusSchema.nullable()
|
|
17536
17560
|
});
|
|
17537
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
|
+
|
|
17538
17594
|
// ../../shared-contracts/dist/thread-watch-notice.js
|
|
17539
17595
|
var THREAD_WATCH_NOTICE_OUTCOMES = [
|
|
17540
17596
|
"completed",
|
|
@@ -17582,17 +17638,67 @@ var remoteSshSetupResultSchema = external_exports.object({ state: external_expor
|
|
|
17582
17638
|
|
|
17583
17639
|
// ../../shared-contracts/dist/remote-sessions.js
|
|
17584
17640
|
var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
|
|
17585
|
-
var
|
|
17641
|
+
var REMOTE_IDENTITY_MAX_LENGTH = 1024;
|
|
17642
|
+
var identity = external_exports.string().min(1).max(REMOTE_IDENTITY_MAX_LENGTH);
|
|
17586
17643
|
var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
|
|
17587
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
|
+
]);
|
|
17588
17669
|
var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
17589
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
|
+
}),
|
|
17590
17695
|
external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
|
|
17591
17696
|
external_exports.strictObject({
|
|
17592
17697
|
kind: external_exports.literal("list"),
|
|
17593
17698
|
...target,
|
|
17594
17699
|
cursor: external_exports.string().nullable(),
|
|
17595
|
-
archived: external_exports.boolean()
|
|
17700
|
+
archived: external_exports.boolean(),
|
|
17701
|
+
includeLoaded: external_exports.literal(true).optional()
|
|
17596
17702
|
}),
|
|
17597
17703
|
external_exports.strictObject({
|
|
17598
17704
|
kind: external_exports.literal("read"),
|
|
@@ -17622,9 +17728,25 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
17622
17728
|
kind: external_exports.literal("prompt"),
|
|
17623
17729
|
...thread,
|
|
17624
17730
|
epoch: identity,
|
|
17625
|
-
text
|
|
17731
|
+
text,
|
|
17626
17732
|
requestId: identity.optional()
|
|
17627
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
|
+
}),
|
|
17628
17750
|
external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
|
|
17629
17751
|
external_exports.strictObject({
|
|
17630
17752
|
kind: external_exports.literal("rename"),
|
|
@@ -20703,7 +20825,7 @@ var LineBuffer = class {
|
|
|
20703
20825
|
};
|
|
20704
20826
|
|
|
20705
20827
|
// ../../../node_modules/@agentclientprotocol/sdk/dist/stream.js
|
|
20706
|
-
function ndJsonStream(output,
|
|
20828
|
+
function ndJsonStream(output, input2) {
|
|
20707
20829
|
const textEncoder = new TextEncoder();
|
|
20708
20830
|
const textDecoder = new TextDecoder();
|
|
20709
20831
|
let cancelled = false;
|
|
@@ -20726,7 +20848,7 @@ function ndJsonStream(output, input) {
|
|
|
20726
20848
|
}
|
|
20727
20849
|
}
|
|
20728
20850
|
};
|
|
20729
|
-
const reader =
|
|
20851
|
+
const reader = input2.getReader();
|
|
20730
20852
|
inputReader = reader;
|
|
20731
20853
|
try {
|
|
20732
20854
|
while (true) {
|
|
@@ -20809,8 +20931,8 @@ var zGuardCreateElicitationResponseCancel = object({
|
|
|
20809
20931
|
});
|
|
20810
20932
|
|
|
20811
20933
|
// ../../../node_modules/@agentclientprotocol/sdk/dist/acp.js
|
|
20812
|
-
function ndJsonStream2(output,
|
|
20813
|
-
return ndJsonStream(output,
|
|
20934
|
+
function ndJsonStream2(output, input2) {
|
|
20935
|
+
return ndJsonStream(output, input2);
|
|
20814
20936
|
}
|
|
20815
20937
|
function emptyObjectResponse(response) {
|
|
20816
20938
|
return response ?? {};
|
|
@@ -22192,12 +22314,12 @@ var kimiDiscoverySpec = {
|
|
|
22192
22314
|
posix: ["~/.kimi-code/bin", "~/.local/bin", "/usr/local/bin"]
|
|
22193
22315
|
}
|
|
22194
22316
|
};
|
|
22195
|
-
function resolveKimiExecutable(
|
|
22196
|
-
const platform =
|
|
22317
|
+
function resolveKimiExecutable(input2 = {}) {
|
|
22318
|
+
const platform = input2.platform ?? process.platform;
|
|
22197
22319
|
const resolution = resolveHarnessExecutable(kimiDiscoverySpec, {
|
|
22198
|
-
...
|
|
22199
|
-
environment:
|
|
22200
|
-
...
|
|
22320
|
+
...input2.command ? { command: input2.command } : {},
|
|
22321
|
+
environment: input2.environment ?? process.env,
|
|
22322
|
+
...input2.homeDirectory ? { homeDirectory: input2.homeDirectory } : {},
|
|
22201
22323
|
platform
|
|
22202
22324
|
});
|
|
22203
22325
|
if (!resolution)
|
|
@@ -22239,22 +22361,22 @@ async function withTimeout(promise2, timeoutMs, operation) {
|
|
|
22239
22361
|
}
|
|
22240
22362
|
function projectKimiTextUpdate(update) {
|
|
22241
22363
|
const content = update.content;
|
|
22242
|
-
let
|
|
22364
|
+
let text2 = "";
|
|
22243
22365
|
if (content && typeof content === "object") {
|
|
22244
22366
|
const c = content;
|
|
22245
22367
|
if (typeof c.text === "string")
|
|
22246
|
-
|
|
22368
|
+
text2 = c.text;
|
|
22247
22369
|
else if (typeof c.thought === "string")
|
|
22248
|
-
|
|
22370
|
+
text2 = c.thought;
|
|
22249
22371
|
else if (typeof c.think === "string")
|
|
22250
|
-
|
|
22372
|
+
text2 = c.think;
|
|
22251
22373
|
} else if (typeof update.text === "string") {
|
|
22252
|
-
|
|
22374
|
+
text2 = update.text;
|
|
22253
22375
|
}
|
|
22254
22376
|
if (update.sessionUpdate === "agent_message_chunk")
|
|
22255
|
-
return { type: "agent.text", text };
|
|
22377
|
+
return { type: "agent.text", text: text2 };
|
|
22256
22378
|
if (update.sessionUpdate === "agent_thought_chunk")
|
|
22257
|
-
return { type: "agent.thought", text };
|
|
22379
|
+
return { type: "agent.thought", text: text2 };
|
|
22258
22380
|
return null;
|
|
22259
22381
|
}
|
|
22260
22382
|
function projectKimiToolUpdate(update) {
|
|
@@ -22357,13 +22479,13 @@ var KimiAcpTransport = class {
|
|
|
22357
22479
|
}
|
|
22358
22480
|
return { initialize, authReady };
|
|
22359
22481
|
}
|
|
22360
|
-
async openSession(
|
|
22482
|
+
async openSession(input2) {
|
|
22361
22483
|
await this.#ensureInitialized();
|
|
22362
22484
|
const connection = this.#connection;
|
|
22363
22485
|
if (!connection)
|
|
22364
22486
|
throw new KimiTransportError("unavailable", "Kimi ACP is unavailable");
|
|
22365
|
-
const targetCwd =
|
|
22366
|
-
if (
|
|
22487
|
+
const targetCwd = input2.cwd || this.#options.cwd;
|
|
22488
|
+
if (input2.kind === "create") {
|
|
22367
22489
|
const created = await withTimeout(connection.newSession({ cwd: targetCwd, mcpServers: [] }), this.#commandTimeoutMs, "Kimi session/new");
|
|
22368
22490
|
this.#sessionId = created.sessionId;
|
|
22369
22491
|
const createdRaw = created;
|
|
@@ -22373,19 +22495,19 @@ var KimiAcpTransport = class {
|
|
|
22373
22495
|
...createdRaw.modes !== void 0 ? { modes: createdRaw.modes } : {}
|
|
22374
22496
|
};
|
|
22375
22497
|
}
|
|
22376
|
-
if (
|
|
22377
|
-
if (!
|
|
22498
|
+
if (input2.kind === "fork") {
|
|
22499
|
+
if (!input2.sessionId) {
|
|
22378
22500
|
throw new KimiTransportError("unavailable", "Session ID required for fork");
|
|
22379
22501
|
}
|
|
22380
22502
|
let forked;
|
|
22381
22503
|
try {
|
|
22382
22504
|
forked = await withTimeout(connection.unstable_forkSession({
|
|
22383
|
-
sessionId:
|
|
22505
|
+
sessionId: input2.sessionId,
|
|
22384
22506
|
cwd: targetCwd,
|
|
22385
22507
|
mcpServers: []
|
|
22386
22508
|
}), this.#commandTimeoutMs, "Kimi session/fork");
|
|
22387
22509
|
} catch (error51) {
|
|
22388
|
-
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 });
|
|
22389
22511
|
}
|
|
22390
22512
|
const raw2 = forked && typeof forked === "object" ? forked : {};
|
|
22391
22513
|
const forkedSessionId = typeof raw2.sessionId === "string" ? raw2.sessionId : "";
|
|
@@ -22399,23 +22521,23 @@ var KimiAcpTransport = class {
|
|
|
22399
22521
|
...raw2.modes !== void 0 ? { modes: raw2.modes } : {}
|
|
22400
22522
|
};
|
|
22401
22523
|
}
|
|
22402
|
-
if (!
|
|
22524
|
+
if (!input2.sessionId) {
|
|
22403
22525
|
throw new KimiTransportError("unavailable", "Session ID required for resume/load");
|
|
22404
22526
|
}
|
|
22405
|
-
this.#sessionId =
|
|
22527
|
+
this.#sessionId = input2.sessionId;
|
|
22406
22528
|
let loaded;
|
|
22407
22529
|
try {
|
|
22408
22530
|
loaded = await withTimeout(connection.loadSession({
|
|
22409
|
-
sessionId:
|
|
22531
|
+
sessionId: input2.sessionId,
|
|
22410
22532
|
cwd: targetCwd,
|
|
22411
22533
|
mcpServers: []
|
|
22412
22534
|
}), this.#commandTimeoutMs, "Kimi session/load");
|
|
22413
22535
|
} catch (error51) {
|
|
22414
|
-
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 });
|
|
22415
22537
|
}
|
|
22416
22538
|
const raw = loaded && typeof loaded === "object" ? loaded : {};
|
|
22417
22539
|
return {
|
|
22418
|
-
sessionId:
|
|
22540
|
+
sessionId: input2.sessionId,
|
|
22419
22541
|
...Array.isArray(raw.configOptions) ? { configOptions: raw.configOptions } : {},
|
|
22420
22542
|
...raw.modes !== void 0 ? { modes: raw.modes } : {}
|
|
22421
22543
|
};
|
|
@@ -22438,7 +22560,7 @@ var KimiAcpTransport = class {
|
|
|
22438
22560
|
throw new KimiTransportError("unavailable", `Failed to set config option ${configId}: ${error51 instanceof Error ? error51.message : String(error51)}`, { cause: error51 });
|
|
22439
22561
|
}
|
|
22440
22562
|
}
|
|
22441
|
-
async prompt(
|
|
22563
|
+
async prompt(text2, handler) {
|
|
22442
22564
|
const connection = this.#connection;
|
|
22443
22565
|
const sessionId = this.#sessionId;
|
|
22444
22566
|
if (!connection || !sessionId || this.#closed) {
|
|
@@ -22446,7 +22568,7 @@ var KimiAcpTransport = class {
|
|
|
22446
22568
|
}
|
|
22447
22569
|
this.#activePrompt = handler;
|
|
22448
22570
|
try {
|
|
22449
|
-
return await connection.prompt({ sessionId, prompt: [{ type: "text", text }] });
|
|
22571
|
+
return await connection.prompt({ sessionId, prompt: [{ type: "text", text: text2 }] });
|
|
22450
22572
|
} catch (error51) {
|
|
22451
22573
|
throw new KimiTransportError("unavailable", `Kimi session/prompt failed: ${error51 instanceof Error ? error51.message : String(error51)}`, { cause: error51 });
|
|
22452
22574
|
} finally {
|
|
@@ -22829,15 +22951,15 @@ async function refreshNativeCredentials(environment, stored, filePath2, fetchImp
|
|
|
22829
22951
|
};
|
|
22830
22952
|
return parsed.data.access_token;
|
|
22831
22953
|
}
|
|
22832
|
-
async function fetchKimiAccount(
|
|
22954
|
+
async function fetchKimiAccount(input2 = {}) {
|
|
22833
22955
|
try {
|
|
22834
|
-
const environment =
|
|
22956
|
+
const environment = input2.environment ?? process.env;
|
|
22835
22957
|
const fromEnv = environment.KIMI_CODE_API_KEY?.trim() || environment.KIMI_API_KEY?.trim();
|
|
22836
|
-
const readAuthFile =
|
|
22837
|
-
const writeAuthFile =
|
|
22838
|
-
const fetchImpl =
|
|
22839
|
-
const requestSignal = () =>
|
|
22840
|
-
const now =
|
|
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();
|
|
22841
22963
|
const filePath2 = credentialPath(environment);
|
|
22842
22964
|
const stored = fromEnv ? void 0 : await readNativeCredentials(filePath2, readAuthFile);
|
|
22843
22965
|
let token = fromEnv ?? stored?.credentials.access_token;
|
|
@@ -23276,9 +23398,9 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
|
|
|
23276
23398
|
} }));
|
|
23277
23399
|
}
|
|
23278
23400
|
}
|
|
23279
|
-
function splitLines(
|
|
23280
|
-
const hasTrailingNl =
|
|
23281
|
-
const result =
|
|
23401
|
+
function splitLines(text2) {
|
|
23402
|
+
const hasTrailingNl = text2.endsWith("\n");
|
|
23403
|
+
const result = text2.split("\n").map((line) => line + "\n");
|
|
23282
23404
|
if (hasTrailingNl) {
|
|
23283
23405
|
result.pop();
|
|
23284
23406
|
} else {
|
|
@@ -24916,10 +25038,10 @@ async function parseKimiWireLog(wireContent, sessionId, mainHomeDir) {
|
|
|
24916
25038
|
const part = event.part;
|
|
24917
25039
|
if (part) {
|
|
24918
25040
|
const isThought = part.type === "thought" || part.type === "think";
|
|
24919
|
-
const
|
|
24920
|
-
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) {
|
|
24921
25043
|
turn.contentParts.push({
|
|
24922
|
-
text:
|
|
25044
|
+
text: text2 || "思考中...",
|
|
24923
25045
|
thought: isThought,
|
|
24924
25046
|
...typeof event.uuid === "string" ? { uuid: event.uuid } : {},
|
|
24925
25047
|
order: eventOrder++
|
|
@@ -25257,15 +25379,15 @@ function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_
|
|
|
25257
25379
|
return normalized;
|
|
25258
25380
|
return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
|
|
25259
25381
|
}
|
|
25260
|
-
function sessionImportCandidate(
|
|
25261
|
-
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;
|
|
25262
25384
|
const parsed = harnessSessionImportCandidateSchema.safeParse({
|
|
25263
|
-
nativeSessionId:
|
|
25264
|
-
cwd:
|
|
25265
|
-
title: typeof
|
|
25385
|
+
nativeSessionId: input2.nativeSessionId,
|
|
25386
|
+
cwd: input2.cwd,
|
|
25387
|
+
title: typeof input2.title === "string" && input2.title.trim().length > 0 ? input2.title : null,
|
|
25266
25388
|
updatedAt: Math.floor(time3),
|
|
25267
25389
|
// Unknown must stay unknown; only an explicit boolean is a native statement.
|
|
25268
|
-
running: typeof
|
|
25390
|
+
running: typeof input2.running === "boolean" ? input2.running : null
|
|
25269
25391
|
});
|
|
25270
25392
|
return parsed.success ? parsed.data : null;
|
|
25271
25393
|
}
|
|
@@ -25422,7 +25544,7 @@ var KimiSessionImport = class {
|
|
|
25422
25544
|
return null;
|
|
25423
25545
|
signal.throwIfAborted();
|
|
25424
25546
|
const { turns } = await readKimiSessionSnapshot(nativeSessionId, options);
|
|
25425
|
-
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);
|
|
25426
25548
|
if (!prompt)
|
|
25427
25549
|
return null;
|
|
25428
25550
|
const activity = turns.flatMap((turn) => [turn.completedAtMs, turn.startedAtMs]).filter((time3) => typeof time3 === "number" && Number.isFinite(time3));
|
|
@@ -25576,19 +25698,19 @@ function formatKimiCommandPrompt(invocation) {
|
|
|
25576
25698
|
};
|
|
25577
25699
|
}
|
|
25578
25700
|
const base = `/${cleanId}`;
|
|
25579
|
-
const
|
|
25580
|
-
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;
|
|
25581
25703
|
return { ok: true, value: prompt };
|
|
25582
25704
|
}
|
|
25583
|
-
function stripAnsi(
|
|
25584
|
-
if (!
|
|
25585
|
-
return
|
|
25586
|
-
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");
|
|
25587
25709
|
}
|
|
25588
|
-
function formatKimiCommandOutput(
|
|
25589
|
-
if (!
|
|
25590
|
-
return
|
|
25591
|
-
const cleaned = stripAnsi(
|
|
25710
|
+
function formatKimiCommandOutput(text2) {
|
|
25711
|
+
if (!text2)
|
|
25712
|
+
return text2;
|
|
25713
|
+
const cleaned = stripAnsi(text2);
|
|
25592
25714
|
if (/^Available commands:\s*\n/iu.test(cleaned)) {
|
|
25593
25715
|
const lines = cleaned.split("\n");
|
|
25594
25716
|
const formatted = ["### Available Commands\n"];
|
|
@@ -25946,7 +26068,7 @@ var KimiSession = class {
|
|
|
25946
26068
|
if (this.#activeTurn) {
|
|
25947
26069
|
return err("sessionBusy", "Another turn is already in progress");
|
|
25948
26070
|
}
|
|
25949
|
-
if (!command.input.some((
|
|
26071
|
+
if (!command.input.some((input2) => input2.text.trim())) {
|
|
25950
26072
|
return err("invalidRequest", "Kimi prompt cannot be empty");
|
|
25951
26073
|
}
|
|
25952
26074
|
const turnId = command.turnId;
|
|
@@ -26022,18 +26144,18 @@ var KimiSession = class {
|
|
|
26022
26144
|
}
|
|
26023
26145
|
return currentReasoning;
|
|
26024
26146
|
};
|
|
26025
|
-
const appendReasoningText = (
|
|
26026
|
-
if (!
|
|
26147
|
+
const appendReasoningText = (text2) => {
|
|
26148
|
+
if (!text2)
|
|
26027
26149
|
return;
|
|
26028
26150
|
const reasoning = ensureReasoning();
|
|
26029
|
-
reasoning.text +=
|
|
26151
|
+
reasoning.text += text2;
|
|
26030
26152
|
this.#channel.emit({
|
|
26031
26153
|
kind: "event",
|
|
26032
26154
|
event: {
|
|
26033
26155
|
type: "item.updated",
|
|
26034
26156
|
turnId,
|
|
26035
26157
|
itemId: reasoning.itemId,
|
|
26036
|
-
update: { type: "text.append", text }
|
|
26158
|
+
update: { type: "text.append", text: text2 }
|
|
26037
26159
|
}
|
|
26038
26160
|
});
|
|
26039
26161
|
};
|
|
@@ -26053,8 +26175,8 @@ var KimiSession = class {
|
|
|
26053
26175
|
let currentAgentMessage = null;
|
|
26054
26176
|
let messageIndex = 0;
|
|
26055
26177
|
let hasHadToolCallsInTurn = false;
|
|
26056
|
-
const appendAgentText = (
|
|
26057
|
-
if (!
|
|
26178
|
+
const appendAgentText = (text2, phase) => {
|
|
26179
|
+
if (!text2)
|
|
26058
26180
|
return;
|
|
26059
26181
|
if (!currentAgentMessage) {
|
|
26060
26182
|
currentAgentMessage = {
|
|
@@ -26072,14 +26194,14 @@ var KimiSession = class {
|
|
|
26072
26194
|
}
|
|
26073
26195
|
});
|
|
26074
26196
|
}
|
|
26075
|
-
currentAgentMessage.text +=
|
|
26197
|
+
currentAgentMessage.text += text2;
|
|
26076
26198
|
this.#channel.emit({
|
|
26077
26199
|
kind: "event",
|
|
26078
26200
|
event: {
|
|
26079
26201
|
type: "item.updated",
|
|
26080
26202
|
turnId,
|
|
26081
26203
|
itemId: currentAgentMessage.itemId,
|
|
26082
|
-
update: { type: "text.append", text }
|
|
26204
|
+
update: { type: "text.append", text: text2 }
|
|
26083
26205
|
}
|
|
26084
26206
|
});
|
|
26085
26207
|
};
|
|
@@ -26347,7 +26469,7 @@ var KimiSession = class {
|
|
|
26347
26469
|
} else if (this.#activeTurn?.cancellationRequested) {
|
|
26348
26470
|
try {
|
|
26349
26471
|
if (previousNativeTurnKeys) {
|
|
26350
|
-
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());
|
|
26351
26473
|
currentNativeTurn = quickTurns.length === 1 ? quickTurns[0] ?? null : null;
|
|
26352
26474
|
}
|
|
26353
26475
|
} catch {
|
|
@@ -26439,7 +26561,7 @@ var KimiSession = class {
|
|
|
26439
26561
|
do {
|
|
26440
26562
|
try {
|
|
26441
26563
|
const added = (await this.#readNativeTurns()).filter((turn2) => !previousKeys.has(turn2.nativeTurnRef.nativeTurnKey));
|
|
26442
|
-
const matching = added.filter((turn2) => turn2.input.map((
|
|
26564
|
+
const matching = added.filter((turn2) => turn2.input.map((input2) => input2.text).join("\n").trim() === normalizedInput);
|
|
26443
26565
|
if (matching.length > 1) {
|
|
26444
26566
|
return {
|
|
26445
26567
|
turn: null,
|
|
@@ -26753,14 +26875,14 @@ var KimiAdapter = class {
|
|
|
26753
26875
|
#createTransport(options) {
|
|
26754
26876
|
return this.#deps.createTransport ? this.#deps.createTransport(options) : new KimiAcpTransport(options);
|
|
26755
26877
|
}
|
|
26756
|
-
#resolveExecutable(
|
|
26757
|
-
return this.#deps.resolveExecutable ? this.#deps.resolveExecutable(
|
|
26878
|
+
#resolveExecutable(input2) {
|
|
26879
|
+
return this.#deps.resolveExecutable ? this.#deps.resolveExecutable(input2) : resolveKimiExecutable(input2);
|
|
26758
26880
|
}
|
|
26759
|
-
async inspect(
|
|
26760
|
-
if (!
|
|
26881
|
+
async inspect(input2 = {}) {
|
|
26882
|
+
if (!input2.refresh && this.#inspectionCache) {
|
|
26761
26883
|
return this.#inspectionCache;
|
|
26762
26884
|
}
|
|
26763
|
-
const cwd =
|
|
26885
|
+
const cwd = input2.cwd ?? process.cwd();
|
|
26764
26886
|
const environment = { ...process.env, ...this.#options.environment };
|
|
26765
26887
|
let executable;
|
|
26766
26888
|
try {
|
|
@@ -26847,23 +26969,23 @@ var KimiAdapter = class {
|
|
|
26847
26969
|
this.#inspectionCache = inspection;
|
|
26848
26970
|
return inspection;
|
|
26849
26971
|
}
|
|
26850
|
-
async open(
|
|
26972
|
+
async open(input2) {
|
|
26851
26973
|
if (this.#closed) {
|
|
26852
26974
|
return err2("invalidState", "Adapter is closed");
|
|
26853
26975
|
}
|
|
26854
|
-
const unattended =
|
|
26855
|
-
if (unattended &&
|
|
26976
|
+
const unattended = input2.kind === "create" && input2.executionPolicy === "unattended-full-access";
|
|
26977
|
+
if (unattended && input2.permissionModeId && input2.permissionModeId !== "yolo") {
|
|
26856
26978
|
return err2("invalidRequest", "Kimi Code unattended execution requires the yolo Permission Mode");
|
|
26857
26979
|
}
|
|
26858
|
-
if (
|
|
26980
|
+
if (input2.kind === "resume" && input2.nativeRef.harnessId !== this.harnessId || input2.kind === "rollbackLastTurn" && input2.sourceRef.harnessId !== this.harnessId) {
|
|
26859
26981
|
return err2("invalidRequest", "Native Session belongs to a different Harness");
|
|
26860
26982
|
}
|
|
26861
|
-
if ("permissionModeId" in
|
|
26862
|
-
return err2("invalidRequest", `Unsupported permission mode: ${
|
|
26983
|
+
if ("permissionModeId" in input2 && input2.permissionModeId && !isKimiModeId(input2.permissionModeId)) {
|
|
26984
|
+
return err2("invalidRequest", `Unsupported permission mode: ${input2.permissionModeId}`);
|
|
26863
26985
|
}
|
|
26864
|
-
const requestedModelAlias = "model" in
|
|
26865
|
-
const environment = { ...process.env, ...this.#options.environment, ...
|
|
26866
|
-
const cwd =
|
|
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();
|
|
26867
26989
|
const kimiCodeHome = getKimiCodeHome(this.#options.homeDirectory, environment);
|
|
26868
26990
|
let executable;
|
|
26869
26991
|
try {
|
|
@@ -26875,8 +26997,8 @@ var KimiAdapter = class {
|
|
|
26875
26997
|
} catch (error51) {
|
|
26876
26998
|
return err2("notInstalled", error51 instanceof Error ? error51.message : "Kimi CLI not found");
|
|
26877
26999
|
}
|
|
26878
|
-
if (
|
|
26879
|
-
return this.#rollbackLastTurn(
|
|
27000
|
+
if (input2.kind === "rollbackLastTurn") {
|
|
27001
|
+
return this.#rollbackLastTurn(input2, executable, {
|
|
26880
27002
|
...environment,
|
|
26881
27003
|
KIMI_CODE_HOME: kimiCodeHome
|
|
26882
27004
|
});
|
|
@@ -26901,16 +27023,16 @@ var KimiAdapter = class {
|
|
|
26901
27023
|
}
|
|
26902
27024
|
const selectedModelAlias = requestedModelAlias ?? nativeConfig?.defaultModel;
|
|
26903
27025
|
const contextWindowTokens = resolveKimiContextWindow(selectedModelAlias, nativeConfig);
|
|
26904
|
-
if (
|
|
27026
|
+
if (input2.kind === "create") {
|
|
26905
27027
|
try {
|
|
26906
27028
|
const sessionInfo = await transport.openSession({ kind: "create", cwd });
|
|
26907
|
-
if (
|
|
26908
|
-
throw new Error(`Unsupported permission mode: ${
|
|
27029
|
+
if (input2.permissionModeId && !isKimiModeId(input2.permissionModeId)) {
|
|
27030
|
+
throw new Error(`Unsupported permission mode: ${input2.permissionModeId}`);
|
|
26909
27031
|
}
|
|
26910
|
-
const permissionModeId =
|
|
27032
|
+
const permissionModeId = input2.permissionModeId ?? (unattended ? "yolo" : void 0);
|
|
26911
27033
|
const requested = [
|
|
26912
|
-
...
|
|
26913
|
-
...
|
|
27034
|
+
...input2.model ? [{ id: "model", value: input2.model.id }] : [],
|
|
27035
|
+
...input2.thinkingOptionId ? [{ id: "thinking", value: input2.thinkingOptionId }] : [],
|
|
26914
27036
|
...permissionModeId ? [{ id: "mode", value: permissionModeId }] : []
|
|
26915
27037
|
];
|
|
26916
27038
|
const configOptions = await applyRequestedConfig(transport, sessionInfo.configOptions, requested);
|
|
@@ -26934,9 +27056,9 @@ var KimiAdapter = class {
|
|
|
26934
27056
|
return err2(error51 instanceof KimiThinkingSelectionError ? "invalidRequest" : "nativeFailure", `Failed to create Kimi session: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
26935
27057
|
}
|
|
26936
27058
|
}
|
|
26937
|
-
if (
|
|
26938
|
-
const sourceSessionId =
|
|
26939
|
-
if (
|
|
27059
|
+
if (input2.kind === "fork") {
|
|
27060
|
+
const sourceSessionId = input2.sourceRef.nativeSessionId;
|
|
27061
|
+
if (input2.sourceRef.harnessId !== this.harnessId) {
|
|
26940
27062
|
await transport.close().catch(() => void 0);
|
|
26941
27063
|
return err2("invalidRequest", "Native Session belongs to a different Harness");
|
|
26942
27064
|
}
|
|
@@ -26948,7 +27070,7 @@ var KimiAdapter = class {
|
|
|
26948
27070
|
await transport.close().catch(() => void 0);
|
|
26949
27071
|
return err2("sessionNotFound", `Kimi source native session not found: ${sourceSessionId}`);
|
|
26950
27072
|
}
|
|
26951
|
-
if (
|
|
27073
|
+
if (input2.checkpoint.harnessId !== this.harnessId || input2.checkpoint.nativeSessionId !== sourceSessionId) {
|
|
26952
27074
|
await transport.close().catch(() => void 0);
|
|
26953
27075
|
return err2("checkpointNotFound", "Kimi Checkpoint does not belong to the source Native Session");
|
|
26954
27076
|
}
|
|
@@ -26968,7 +27090,7 @@ var KimiAdapter = class {
|
|
|
26968
27090
|
}
|
|
26969
27091
|
const latestTurn = sourceSnapshot.turns.at(-1);
|
|
26970
27092
|
const latestCheckpoint = latestTurn?.checkpoint;
|
|
26971
|
-
if (!latestCheckpoint || latestTurn?.outcome.status === "unknown" || latestCheckpoint.checkpointId !==
|
|
27093
|
+
if (!latestCheckpoint || latestTurn?.outcome.status === "unknown" || latestCheckpoint.checkpointId !== input2.checkpoint.checkpointId) {
|
|
26972
27094
|
await transport.close().catch(() => void 0);
|
|
26973
27095
|
return err2("unsupported", "Kimi native Fork only supports the latest native checkpoint");
|
|
26974
27096
|
}
|
|
@@ -27009,8 +27131,8 @@ var KimiAdapter = class {
|
|
|
27009
27131
|
return err2("nativeFailure", `Failed to fork Kimi session: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
27010
27132
|
}
|
|
27011
27133
|
}
|
|
27012
|
-
if (
|
|
27013
|
-
const sessionId =
|
|
27134
|
+
if (input2.kind === "resume") {
|
|
27135
|
+
const sessionId = input2.nativeRef.nativeSessionId;
|
|
27014
27136
|
try {
|
|
27015
27137
|
const located = await locateKimiSession(sessionId, {
|
|
27016
27138
|
kimiCodeHome,
|
|
@@ -27027,13 +27149,13 @@ var KimiAdapter = class {
|
|
|
27027
27149
|
});
|
|
27028
27150
|
if (sessionInfo.sessionId !== sessionId)
|
|
27029
27151
|
throw new Error("Kimi resumed a different Native Session");
|
|
27030
|
-
if (
|
|
27031
|
-
throw new Error(`Unsupported permission mode: ${
|
|
27152
|
+
if (input2.permissionModeId && !isKimiModeId(input2.permissionModeId)) {
|
|
27153
|
+
throw new Error(`Unsupported permission mode: ${input2.permissionModeId}`);
|
|
27032
27154
|
}
|
|
27033
27155
|
const requested = [
|
|
27034
|
-
...
|
|
27035
|
-
...
|
|
27036
|
-
...
|
|
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 }] : []
|
|
27037
27159
|
];
|
|
27038
27160
|
const configOptions = await applyRequestedConfig(transport, sessionInfo.configOptions, requested);
|
|
27039
27161
|
const state = stateFromConfig(sessionInfo.sessionId, cwd, configOptions);
|
|
@@ -27065,8 +27187,8 @@ var KimiAdapter = class {
|
|
|
27065
27187
|
await transport.close().catch(() => void 0);
|
|
27066
27188
|
return err2("unsupported", `Unsupported open kind`);
|
|
27067
27189
|
}
|
|
27068
|
-
async #rollbackLastTurn(
|
|
27069
|
-
const sourceId =
|
|
27190
|
+
async #rollbackLastTurn(input2, executable, environment) {
|
|
27191
|
+
const sourceId = input2.sourceRef.nativeSessionId;
|
|
27070
27192
|
const historyOptions = {
|
|
27071
27193
|
kimiCodeHome: getKimiCodeHome(this.#options.homeDirectory, environment)
|
|
27072
27194
|
};
|
|
@@ -27075,7 +27197,7 @@ var KimiAdapter = class {
|
|
|
27075
27197
|
const located = await locateKimiSession(sourceId, historyOptions);
|
|
27076
27198
|
if (!located)
|
|
27077
27199
|
return err2("sessionNotFound", "Kimi source session was not found");
|
|
27078
|
-
if (path9.resolve(
|
|
27200
|
+
if (path9.resolve(input2.cwd) !== path9.resolve(located.state.cwd))
|
|
27079
27201
|
return err2("unsupported", "Kimi cannot roll back into another working directory");
|
|
27080
27202
|
const source = [...this.#sessions].find((candidate) => candidate.initialState.nativeRef?.nativeSessionId === sourceId);
|
|
27081
27203
|
if (source) {
|
|
@@ -27094,7 +27216,7 @@ var KimiAdapter = class {
|
|
|
27094
27216
|
return err2("sessionBusy", "Kimi's last turn has not reached a confirmed terminal state");
|
|
27095
27217
|
const rolledBack = await (this.#deps.rollbackNativeSession ?? rollbackKimiNativeSession)({
|
|
27096
27218
|
command: executable,
|
|
27097
|
-
cwd:
|
|
27219
|
+
cwd: input2.cwd,
|
|
27098
27220
|
environment,
|
|
27099
27221
|
sourceSessionId: sourceId,
|
|
27100
27222
|
timeoutMs: this.#options.commandTimeoutMs ?? 3e4
|
|
@@ -27114,12 +27236,12 @@ var KimiAdapter = class {
|
|
|
27114
27236
|
await copyKimiCommandHistory(commands, derivedId, historyOptions);
|
|
27115
27237
|
const opened = await this.open({
|
|
27116
27238
|
kind: "resume",
|
|
27117
|
-
nativeRef: createKimiNativeSessionRef(derivedId,
|
|
27118
|
-
cwd:
|
|
27239
|
+
nativeRef: createKimiNativeSessionRef(derivedId, input2.cwd),
|
|
27240
|
+
cwd: input2.cwd,
|
|
27119
27241
|
environment,
|
|
27120
|
-
model:
|
|
27121
|
-
thinkingOptionId:
|
|
27122
|
-
permissionModeId:
|
|
27242
|
+
model: input2.model ?? kimiModelRef(rolledBack.model),
|
|
27243
|
+
thinkingOptionId: input2.thinkingOptionId ?? harnessThinkingOptionIdSchema.parse(rolledBack.thinking),
|
|
27244
|
+
permissionModeId: input2.permissionModeId ?? harnessPermissionModeIdSchema.parse(rolledBack.mode)
|
|
27123
27245
|
});
|
|
27124
27246
|
if (!opened.ok)
|
|
27125
27247
|
throw new Error(opened.error.message);
|