@codexhost/cli-linux-arm64 0.24.0 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 text3 = shim.replaceAll("\\", "/").toLowerCase();
|
|
367
|
+
return text3.includes(`%dp0%/${target2}"`) || text3.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((text3) => JSON.parse(text3)).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((text3) => JSON.parse(text3)).catch(() => null);
|
|
386
388
|
if (metadata?.name && packages.includes(metadata.name)) {
|
|
387
389
|
const name = metadata.name;
|
|
388
390
|
const currentVersion = installationVersion(metadata.version);
|
|
@@ -1192,8 +1194,8 @@ function cached(getter) {
|
|
|
1192
1194
|
}
|
|
1193
1195
|
};
|
|
1194
1196
|
}
|
|
1195
|
-
function nullish(
|
|
1196
|
-
return
|
|
1197
|
+
function nullish(input2) {
|
|
1198
|
+
return input2 === null || input2 === void 0;
|
|
1197
1199
|
}
|
|
1198
1200
|
function cleanRegex(source) {
|
|
1199
1201
|
const start = source.startsWith("^") ? 1 : 0;
|
|
@@ -1280,8 +1282,8 @@ function randomString(length = 10) {
|
|
|
1280
1282
|
function esc(str) {
|
|
1281
1283
|
return JSON.stringify(str);
|
|
1282
1284
|
}
|
|
1283
|
-
function slugify(
|
|
1284
|
-
return
|
|
1285
|
+
function slugify(input2) {
|
|
1286
|
+
return input2.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1285
1287
|
}
|
|
1286
1288
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
1287
1289
|
};
|
|
@@ -1686,19 +1688,19 @@ function finalizeIssue(iss, ctx, config2) {
|
|
|
1686
1688
|
}
|
|
1687
1689
|
return rest;
|
|
1688
1690
|
}
|
|
1689
|
-
function getSizableOrigin(
|
|
1690
|
-
if (
|
|
1691
|
+
function getSizableOrigin(input2) {
|
|
1692
|
+
if (input2 instanceof Set)
|
|
1691
1693
|
return "set";
|
|
1692
|
-
if (
|
|
1694
|
+
if (input2 instanceof Map)
|
|
1693
1695
|
return "map";
|
|
1694
|
-
if (
|
|
1696
|
+
if (input2 instanceof File)
|
|
1695
1697
|
return "file";
|
|
1696
1698
|
return "unknown";
|
|
1697
1699
|
}
|
|
1698
|
-
function getLengthableOrigin(
|
|
1699
|
-
if (Array.isArray(
|
|
1700
|
+
function getLengthableOrigin(input2) {
|
|
1701
|
+
if (Array.isArray(input2))
|
|
1700
1702
|
return "array";
|
|
1701
|
-
if (typeof
|
|
1703
|
+
if (typeof input2 === "string")
|
|
1702
1704
|
return "string";
|
|
1703
1705
|
return "unknown";
|
|
1704
1706
|
}
|
|
@@ -1724,12 +1726,12 @@ function parsedType(data) {
|
|
|
1724
1726
|
return t;
|
|
1725
1727
|
}
|
|
1726
1728
|
function issue(...args) {
|
|
1727
|
-
const [iss,
|
|
1729
|
+
const [iss, input2, inst] = args;
|
|
1728
1730
|
if (typeof iss === "string") {
|
|
1729
1731
|
return {
|
|
1730
1732
|
message: iss,
|
|
1731
1733
|
code: "custom",
|
|
1732
|
-
input,
|
|
1734
|
+
input: input2,
|
|
1733
1735
|
inst
|
|
1734
1736
|
};
|
|
1735
1737
|
}
|
|
@@ -2273,23 +2275,23 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2273
2275
|
bag.pattern = integer;
|
|
2274
2276
|
});
|
|
2275
2277
|
inst._zod.check = (payload) => {
|
|
2276
|
-
const
|
|
2278
|
+
const input2 = payload.value;
|
|
2277
2279
|
if (isInt) {
|
|
2278
|
-
if (!Number.isInteger(
|
|
2280
|
+
if (!Number.isInteger(input2)) {
|
|
2279
2281
|
payload.issues.push({
|
|
2280
2282
|
expected: origin,
|
|
2281
2283
|
format: def.format,
|
|
2282
2284
|
code: "invalid_type",
|
|
2283
2285
|
continue: false,
|
|
2284
|
-
input,
|
|
2286
|
+
input: input2,
|
|
2285
2287
|
inst
|
|
2286
2288
|
});
|
|
2287
2289
|
return;
|
|
2288
2290
|
}
|
|
2289
|
-
if (!Number.isSafeInteger(
|
|
2290
|
-
if (
|
|
2291
|
+
if (!Number.isSafeInteger(input2)) {
|
|
2292
|
+
if (input2 > 0) {
|
|
2291
2293
|
payload.issues.push({
|
|
2292
|
-
input,
|
|
2294
|
+
input: input2,
|
|
2293
2295
|
code: "too_big",
|
|
2294
2296
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
2295
2297
|
note: "Integers must be within the safe integer range.",
|
|
@@ -2300,7 +2302,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2300
2302
|
});
|
|
2301
2303
|
} else {
|
|
2302
2304
|
payload.issues.push({
|
|
2303
|
-
input,
|
|
2305
|
+
input: input2,
|
|
2304
2306
|
code: "too_small",
|
|
2305
2307
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
2306
2308
|
note: "Integers must be within the safe integer range.",
|
|
@@ -2313,10 +2315,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2313
2315
|
return;
|
|
2314
2316
|
}
|
|
2315
2317
|
}
|
|
2316
|
-
if (
|
|
2318
|
+
if (input2 < minimum) {
|
|
2317
2319
|
payload.issues.push({
|
|
2318
2320
|
origin: "number",
|
|
2319
|
-
input,
|
|
2321
|
+
input: input2,
|
|
2320
2322
|
code: "too_small",
|
|
2321
2323
|
minimum,
|
|
2322
2324
|
inclusive: true,
|
|
@@ -2324,10 +2326,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2324
2326
|
continue: !def.abort
|
|
2325
2327
|
});
|
|
2326
2328
|
}
|
|
2327
|
-
if (
|
|
2329
|
+
if (input2 > maximum) {
|
|
2328
2330
|
payload.issues.push({
|
|
2329
2331
|
origin: "number",
|
|
2330
|
-
input,
|
|
2332
|
+
input: input2,
|
|
2331
2333
|
code: "too_big",
|
|
2332
2334
|
maximum,
|
|
2333
2335
|
inclusive: true,
|
|
@@ -2347,11 +2349,11 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
2347
2349
|
bag.maximum = maximum;
|
|
2348
2350
|
});
|
|
2349
2351
|
inst._zod.check = (payload) => {
|
|
2350
|
-
const
|
|
2351
|
-
if (
|
|
2352
|
+
const input2 = payload.value;
|
|
2353
|
+
if (input2 < minimum) {
|
|
2352
2354
|
payload.issues.push({
|
|
2353
2355
|
origin: "bigint",
|
|
2354
|
-
input,
|
|
2356
|
+
input: input2,
|
|
2355
2357
|
code: "too_small",
|
|
2356
2358
|
minimum,
|
|
2357
2359
|
inclusive: true,
|
|
@@ -2359,10 +2361,10 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
2359
2361
|
continue: !def.abort
|
|
2360
2362
|
});
|
|
2361
2363
|
}
|
|
2362
|
-
if (
|
|
2364
|
+
if (input2 > maximum) {
|
|
2363
2365
|
payload.issues.push({
|
|
2364
2366
|
origin: "bigint",
|
|
2365
|
-
input,
|
|
2367
|
+
input: input2,
|
|
2366
2368
|
code: "too_big",
|
|
2367
2369
|
maximum,
|
|
2368
2370
|
inclusive: true,
|
|
@@ -2385,16 +2387,16 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
|
|
|
2385
2387
|
inst2._zod.bag.maximum = def.maximum;
|
|
2386
2388
|
});
|
|
2387
2389
|
inst._zod.check = (payload) => {
|
|
2388
|
-
const
|
|
2389
|
-
const size =
|
|
2390
|
+
const input2 = payload.value;
|
|
2391
|
+
const size = input2.size;
|
|
2390
2392
|
if (size <= def.maximum)
|
|
2391
2393
|
return;
|
|
2392
2394
|
payload.issues.push({
|
|
2393
|
-
origin: getSizableOrigin(
|
|
2395
|
+
origin: getSizableOrigin(input2),
|
|
2394
2396
|
code: "too_big",
|
|
2395
2397
|
maximum: def.maximum,
|
|
2396
2398
|
inclusive: true,
|
|
2397
|
-
input,
|
|
2399
|
+
input: input2,
|
|
2398
2400
|
inst,
|
|
2399
2401
|
continue: !def.abort
|
|
2400
2402
|
});
|
|
@@ -2413,16 +2415,16 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
|
|
|
2413
2415
|
inst2._zod.bag.minimum = def.minimum;
|
|
2414
2416
|
});
|
|
2415
2417
|
inst._zod.check = (payload) => {
|
|
2416
|
-
const
|
|
2417
|
-
const size =
|
|
2418
|
+
const input2 = payload.value;
|
|
2419
|
+
const size = input2.size;
|
|
2418
2420
|
if (size >= def.minimum)
|
|
2419
2421
|
return;
|
|
2420
2422
|
payload.issues.push({
|
|
2421
|
-
origin: getSizableOrigin(
|
|
2423
|
+
origin: getSizableOrigin(input2),
|
|
2422
2424
|
code: "too_small",
|
|
2423
2425
|
minimum: def.minimum,
|
|
2424
2426
|
inclusive: true,
|
|
2425
|
-
input,
|
|
2427
|
+
input: input2,
|
|
2426
2428
|
inst,
|
|
2427
2429
|
continue: !def.abort
|
|
2428
2430
|
});
|
|
@@ -2442,13 +2444,13 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
|
|
|
2442
2444
|
bag.size = def.size;
|
|
2443
2445
|
});
|
|
2444
2446
|
inst._zod.check = (payload) => {
|
|
2445
|
-
const
|
|
2446
|
-
const size =
|
|
2447
|
+
const input2 = payload.value;
|
|
2448
|
+
const size = input2.size;
|
|
2447
2449
|
if (size === def.size)
|
|
2448
2450
|
return;
|
|
2449
2451
|
const tooBig = size > def.size;
|
|
2450
2452
|
payload.issues.push({
|
|
2451
|
-
origin: getSizableOrigin(
|
|
2453
|
+
origin: getSizableOrigin(input2),
|
|
2452
2454
|
...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
|
|
2453
2455
|
inclusive: true,
|
|
2454
2456
|
exact: true,
|
|
@@ -2471,17 +2473,17 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
2471
2473
|
inst2._zod.bag.maximum = def.maximum;
|
|
2472
2474
|
});
|
|
2473
2475
|
inst._zod.check = (payload) => {
|
|
2474
|
-
const
|
|
2475
|
-
const length =
|
|
2476
|
+
const input2 = payload.value;
|
|
2477
|
+
const length = input2.length;
|
|
2476
2478
|
if (length <= def.maximum)
|
|
2477
2479
|
return;
|
|
2478
|
-
const origin = getLengthableOrigin(
|
|
2480
|
+
const origin = getLengthableOrigin(input2);
|
|
2479
2481
|
payload.issues.push({
|
|
2480
2482
|
origin,
|
|
2481
2483
|
code: "too_big",
|
|
2482
2484
|
maximum: def.maximum,
|
|
2483
2485
|
inclusive: true,
|
|
2484
|
-
input,
|
|
2486
|
+
input: input2,
|
|
2485
2487
|
inst,
|
|
2486
2488
|
continue: !def.abort
|
|
2487
2489
|
});
|
|
@@ -2500,17 +2502,17 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
2500
2502
|
inst2._zod.bag.minimum = def.minimum;
|
|
2501
2503
|
});
|
|
2502
2504
|
inst._zod.check = (payload) => {
|
|
2503
|
-
const
|
|
2504
|
-
const length =
|
|
2505
|
+
const input2 = payload.value;
|
|
2506
|
+
const length = input2.length;
|
|
2505
2507
|
if (length >= def.minimum)
|
|
2506
2508
|
return;
|
|
2507
|
-
const origin = getLengthableOrigin(
|
|
2509
|
+
const origin = getLengthableOrigin(input2);
|
|
2508
2510
|
payload.issues.push({
|
|
2509
2511
|
origin,
|
|
2510
2512
|
code: "too_small",
|
|
2511
2513
|
minimum: def.minimum,
|
|
2512
2514
|
inclusive: true,
|
|
2513
|
-
input,
|
|
2515
|
+
input: input2,
|
|
2514
2516
|
inst,
|
|
2515
2517
|
continue: !def.abort
|
|
2516
2518
|
});
|
|
@@ -2530,11 +2532,11 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
2530
2532
|
bag.length = def.length;
|
|
2531
2533
|
});
|
|
2532
2534
|
inst._zod.check = (payload) => {
|
|
2533
|
-
const
|
|
2534
|
-
const length =
|
|
2535
|
+
const input2 = payload.value;
|
|
2536
|
+
const length = input2.length;
|
|
2535
2537
|
if (length === def.length)
|
|
2536
2538
|
return;
|
|
2537
|
-
const origin = getLengthableOrigin(
|
|
2539
|
+
const origin = getLengthableOrigin(input2);
|
|
2538
2540
|
const tooBig = length > def.length;
|
|
2539
2541
|
payload.issues.push({
|
|
2540
2542
|
origin,
|
|
@@ -3205,15 +3207,15 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
3205
3207
|
payload.value = Number(payload.value);
|
|
3206
3208
|
} catch (_) {
|
|
3207
3209
|
}
|
|
3208
|
-
const
|
|
3209
|
-
if (typeof
|
|
3210
|
+
const input2 = payload.value;
|
|
3211
|
+
if (typeof input2 === "number" && !Number.isNaN(input2) && Number.isFinite(input2)) {
|
|
3210
3212
|
return payload;
|
|
3211
3213
|
}
|
|
3212
|
-
const received = typeof
|
|
3214
|
+
const received = typeof input2 === "number" ? Number.isNaN(input2) ? "NaN" : !Number.isFinite(input2) ? "Infinity" : void 0 : void 0;
|
|
3213
3215
|
payload.issues.push({
|
|
3214
3216
|
expected: "number",
|
|
3215
3217
|
code: "invalid_type",
|
|
3216
|
-
input,
|
|
3218
|
+
input: input2,
|
|
3217
3219
|
inst,
|
|
3218
3220
|
...received ? { received } : {}
|
|
3219
3221
|
});
|
|
@@ -3233,13 +3235,13 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
|
3233
3235
|
payload.value = Boolean(payload.value);
|
|
3234
3236
|
} catch (_) {
|
|
3235
3237
|
}
|
|
3236
|
-
const
|
|
3237
|
-
if (typeof
|
|
3238
|
+
const input2 = payload.value;
|
|
3239
|
+
if (typeof input2 === "boolean")
|
|
3238
3240
|
return payload;
|
|
3239
3241
|
payload.issues.push({
|
|
3240
3242
|
expected: "boolean",
|
|
3241
3243
|
code: "invalid_type",
|
|
3242
|
-
input,
|
|
3244
|
+
input: input2,
|
|
3243
3245
|
inst
|
|
3244
3246
|
});
|
|
3245
3247
|
return payload;
|
|
@@ -3272,13 +3274,13 @@ var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, d
|
|
|
3272
3274
|
var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
|
|
3273
3275
|
$ZodType.init(inst, def);
|
|
3274
3276
|
inst._zod.parse = (payload, _ctx) => {
|
|
3275
|
-
const
|
|
3276
|
-
if (typeof
|
|
3277
|
+
const input2 = payload.value;
|
|
3278
|
+
if (typeof input2 === "symbol")
|
|
3277
3279
|
return payload;
|
|
3278
3280
|
payload.issues.push({
|
|
3279
3281
|
expected: "symbol",
|
|
3280
3282
|
code: "invalid_type",
|
|
3281
|
-
input,
|
|
3283
|
+
input: input2,
|
|
3282
3284
|
inst
|
|
3283
3285
|
});
|
|
3284
3286
|
return payload;
|
|
@@ -3289,13 +3291,13 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) =>
|
|
|
3289
3291
|
inst._zod.pattern = _undefined;
|
|
3290
3292
|
inst._zod.values = /* @__PURE__ */ new Set([void 0]);
|
|
3291
3293
|
inst._zod.parse = (payload, _ctx) => {
|
|
3292
|
-
const
|
|
3293
|
-
if (typeof
|
|
3294
|
+
const input2 = payload.value;
|
|
3295
|
+
if (typeof input2 === "undefined")
|
|
3294
3296
|
return payload;
|
|
3295
3297
|
payload.issues.push({
|
|
3296
3298
|
expected: "undefined",
|
|
3297
3299
|
code: "invalid_type",
|
|
3298
|
-
input,
|
|
3300
|
+
input: input2,
|
|
3299
3301
|
inst
|
|
3300
3302
|
});
|
|
3301
3303
|
return payload;
|
|
@@ -3306,13 +3308,13 @@ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
|
|
|
3306
3308
|
inst._zod.pattern = _null;
|
|
3307
3309
|
inst._zod.values = /* @__PURE__ */ new Set([null]);
|
|
3308
3310
|
inst._zod.parse = (payload, _ctx) => {
|
|
3309
|
-
const
|
|
3310
|
-
if (
|
|
3311
|
+
const input2 = payload.value;
|
|
3312
|
+
if (input2 === null)
|
|
3311
3313
|
return payload;
|
|
3312
3314
|
payload.issues.push({
|
|
3313
3315
|
expected: "null",
|
|
3314
3316
|
code: "invalid_type",
|
|
3315
|
-
input,
|
|
3317
|
+
input: input2,
|
|
3316
3318
|
inst
|
|
3317
3319
|
});
|
|
3318
3320
|
return payload;
|
|
@@ -3341,13 +3343,13 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
|
3341
3343
|
var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
|
|
3342
3344
|
$ZodType.init(inst, def);
|
|
3343
3345
|
inst._zod.parse = (payload, _ctx) => {
|
|
3344
|
-
const
|
|
3345
|
-
if (typeof
|
|
3346
|
+
const input2 = payload.value;
|
|
3347
|
+
if (typeof input2 === "undefined")
|
|
3346
3348
|
return payload;
|
|
3347
3349
|
payload.issues.push({
|
|
3348
3350
|
expected: "void",
|
|
3349
3351
|
code: "invalid_type",
|
|
3350
|
-
input,
|
|
3352
|
+
input: input2,
|
|
3351
3353
|
inst
|
|
3352
3354
|
});
|
|
3353
3355
|
return payload;
|
|
@@ -3362,15 +3364,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
3362
3364
|
} catch (_err) {
|
|
3363
3365
|
}
|
|
3364
3366
|
}
|
|
3365
|
-
const
|
|
3366
|
-
const isDate =
|
|
3367
|
-
const isValidDate = isDate && !Number.isNaN(
|
|
3367
|
+
const input2 = payload.value;
|
|
3368
|
+
const isDate = input2 instanceof Date;
|
|
3369
|
+
const isValidDate = isDate && !Number.isNaN(input2.getTime());
|
|
3368
3370
|
if (isValidDate)
|
|
3369
3371
|
return payload;
|
|
3370
3372
|
payload.issues.push({
|
|
3371
3373
|
expected: "date",
|
|
3372
3374
|
code: "invalid_type",
|
|
3373
|
-
input,
|
|
3375
|
+
input: input2,
|
|
3374
3376
|
...isDate ? { received: "Invalid Date" } : {},
|
|
3375
3377
|
inst
|
|
3376
3378
|
});
|
|
@@ -3386,20 +3388,20 @@ function handleArrayResult(result, final, index) {
|
|
|
3386
3388
|
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
3387
3389
|
$ZodType.init(inst, def);
|
|
3388
3390
|
inst._zod.parse = (payload, ctx) => {
|
|
3389
|
-
const
|
|
3390
|
-
if (!Array.isArray(
|
|
3391
|
+
const input2 = payload.value;
|
|
3392
|
+
if (!Array.isArray(input2)) {
|
|
3391
3393
|
payload.issues.push({
|
|
3392
3394
|
expected: "array",
|
|
3393
3395
|
code: "invalid_type",
|
|
3394
|
-
input,
|
|
3396
|
+
input: input2,
|
|
3395
3397
|
inst
|
|
3396
3398
|
});
|
|
3397
3399
|
return payload;
|
|
3398
3400
|
}
|
|
3399
|
-
payload.value = Array(
|
|
3401
|
+
payload.value = Array(input2.length);
|
|
3400
3402
|
const proms = [];
|
|
3401
|
-
for (let i = 0; i <
|
|
3402
|
-
const item =
|
|
3403
|
+
for (let i = 0; i < input2.length; i++) {
|
|
3404
|
+
const item = input2[i];
|
|
3403
3405
|
const result = def.element._zod.run({
|
|
3404
3406
|
value: item,
|
|
3405
3407
|
issues: []
|
|
@@ -3416,8 +3418,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
3416
3418
|
return payload;
|
|
3417
3419
|
};
|
|
3418
3420
|
});
|
|
3419
|
-
function handlePropertyResult(result, final, key,
|
|
3420
|
-
const isPresent = key in
|
|
3421
|
+
function handlePropertyResult(result, final, key, input2, isOptionalIn, isOptionalOut) {
|
|
3422
|
+
const isPresent = key in input2;
|
|
3421
3423
|
if (result.issues.length) {
|
|
3422
3424
|
if (isOptionalIn && isOptionalOut && !isPresent) {
|
|
3423
3425
|
return;
|
|
@@ -3459,14 +3461,14 @@ function normalizeDef(def) {
|
|
|
3459
3461
|
optionalKeys: new Set(okeys)
|
|
3460
3462
|
};
|
|
3461
3463
|
}
|
|
3462
|
-
function handleCatchall(proms,
|
|
3464
|
+
function handleCatchall(proms, input2, payload, ctx, def, inst) {
|
|
3463
3465
|
const unrecognized = [];
|
|
3464
3466
|
const keySet = def.keySet;
|
|
3465
3467
|
const _catchall = def.catchall._zod;
|
|
3466
3468
|
const t = _catchall.def.type;
|
|
3467
3469
|
const isOptionalIn = _catchall.optin === "optional";
|
|
3468
3470
|
const isOptionalOut = _catchall.optout === "optional";
|
|
3469
|
-
for (const key in
|
|
3471
|
+
for (const key in input2) {
|
|
3470
3472
|
if (key === "__proto__")
|
|
3471
3473
|
continue;
|
|
3472
3474
|
if (keySet.has(key))
|
|
@@ -3475,18 +3477,18 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
3475
3477
|
unrecognized.push(key);
|
|
3476
3478
|
continue;
|
|
3477
3479
|
}
|
|
3478
|
-
const r = _catchall.run({ value:
|
|
3480
|
+
const r = _catchall.run({ value: input2[key], issues: [] }, ctx);
|
|
3479
3481
|
if (r instanceof Promise) {
|
|
3480
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
3482
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
|
|
3481
3483
|
} else {
|
|
3482
|
-
handlePropertyResult(r, payload, key,
|
|
3484
|
+
handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
|
|
3483
3485
|
}
|
|
3484
3486
|
}
|
|
3485
3487
|
if (unrecognized.length) {
|
|
3486
3488
|
payload.issues.push({
|
|
3487
3489
|
code: "unrecognized_keys",
|
|
3488
3490
|
keys: unrecognized,
|
|
3489
|
-
input,
|
|
3491
|
+
input: input2,
|
|
3490
3492
|
inst
|
|
3491
3493
|
});
|
|
3492
3494
|
}
|
|
@@ -3530,12 +3532,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3530
3532
|
let value;
|
|
3531
3533
|
inst._zod.parse = (payload, ctx) => {
|
|
3532
3534
|
value ?? (value = _normalized.value);
|
|
3533
|
-
const
|
|
3534
|
-
if (!isObject2(
|
|
3535
|
+
const input2 = payload.value;
|
|
3536
|
+
if (!isObject2(input2)) {
|
|
3535
3537
|
payload.issues.push({
|
|
3536
3538
|
expected: "object",
|
|
3537
3539
|
code: "invalid_type",
|
|
3538
|
-
input,
|
|
3540
|
+
input: input2,
|
|
3539
3541
|
inst
|
|
3540
3542
|
});
|
|
3541
3543
|
return payload;
|
|
@@ -3547,17 +3549,17 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3547
3549
|
const el = shape[key];
|
|
3548
3550
|
const isOptionalIn = el._zod.optin === "optional";
|
|
3549
3551
|
const isOptionalOut = el._zod.optout === "optional";
|
|
3550
|
-
const r = el._zod.run({ value:
|
|
3552
|
+
const r = el._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
3551
3553
|
if (r instanceof Promise) {
|
|
3552
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
3554
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
|
|
3553
3555
|
} else {
|
|
3554
|
-
handlePropertyResult(r, payload, key,
|
|
3556
|
+
handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
|
|
3555
3557
|
}
|
|
3556
3558
|
}
|
|
3557
3559
|
if (!catchall) {
|
|
3558
3560
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
3559
3561
|
}
|
|
3560
|
-
return handleCatchall(proms,
|
|
3562
|
+
return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst);
|
|
3561
3563
|
};
|
|
3562
3564
|
});
|
|
3563
3565
|
var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -3666,12 +3668,12 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3666
3668
|
let value;
|
|
3667
3669
|
inst._zod.parse = (payload, ctx) => {
|
|
3668
3670
|
value ?? (value = _normalized.value);
|
|
3669
|
-
const
|
|
3670
|
-
if (!isObject2(
|
|
3671
|
+
const input2 = payload.value;
|
|
3672
|
+
if (!isObject2(input2)) {
|
|
3671
3673
|
payload.issues.push({
|
|
3672
3674
|
expected: "object",
|
|
3673
3675
|
code: "invalid_type",
|
|
3674
|
-
input,
|
|
3676
|
+
input: input2,
|
|
3675
3677
|
inst
|
|
3676
3678
|
});
|
|
3677
3679
|
return payload;
|
|
@@ -3682,7 +3684,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3682
3684
|
payload = fastpass(payload, ctx);
|
|
3683
3685
|
if (!catchall)
|
|
3684
3686
|
return payload;
|
|
3685
|
-
return handleCatchall([],
|
|
3687
|
+
return handleCatchall([], input2, payload, ctx, value, inst);
|
|
3686
3688
|
}
|
|
3687
3689
|
return superParse(payload, ctx);
|
|
3688
3690
|
};
|
|
@@ -3842,17 +3844,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3842
3844
|
return map2;
|
|
3843
3845
|
});
|
|
3844
3846
|
inst._zod.parse = (payload, ctx) => {
|
|
3845
|
-
const
|
|
3846
|
-
if (!isObject(
|
|
3847
|
+
const input2 = payload.value;
|
|
3848
|
+
if (!isObject(input2)) {
|
|
3847
3849
|
payload.issues.push({
|
|
3848
3850
|
code: "invalid_type",
|
|
3849
3851
|
expected: "object",
|
|
3850
|
-
input,
|
|
3852
|
+
input: input2,
|
|
3851
3853
|
inst
|
|
3852
3854
|
});
|
|
3853
3855
|
return payload;
|
|
3854
3856
|
}
|
|
3855
|
-
const opt = disc.value.get(
|
|
3857
|
+
const opt = disc.value.get(input2?.[def.discriminator]);
|
|
3856
3858
|
if (opt) {
|
|
3857
3859
|
return opt._zod.run(payload, ctx);
|
|
3858
3860
|
}
|
|
@@ -3865,7 +3867,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3865
3867
|
note: "No matching discriminator",
|
|
3866
3868
|
discriminator: def.discriminator,
|
|
3867
3869
|
options: Array.from(disc.value.keys()),
|
|
3868
|
-
input,
|
|
3870
|
+
input: input2,
|
|
3869
3871
|
path: [def.discriminator],
|
|
3870
3872
|
inst
|
|
3871
3873
|
});
|
|
@@ -3875,9 +3877,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3875
3877
|
var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
3876
3878
|
$ZodType.init(inst, def);
|
|
3877
3879
|
inst._zod.parse = (payload, ctx) => {
|
|
3878
|
-
const
|
|
3879
|
-
const left = def.left._zod.run({ value:
|
|
3880
|
-
const right = def.right._zod.run({ value:
|
|
3880
|
+
const input2 = payload.value;
|
|
3881
|
+
const left = def.left._zod.run({ value: input2, issues: [] }, ctx);
|
|
3882
|
+
const right = def.right._zod.run({ value: input2, issues: [] }, ctx);
|
|
3881
3883
|
const async = left instanceof Promise || right instanceof Promise;
|
|
3882
3884
|
if (async) {
|
|
3883
3885
|
return Promise.all([left, right]).then(([left2, right2]) => {
|
|
@@ -3974,10 +3976,10 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3974
3976
|
$ZodType.init(inst, def);
|
|
3975
3977
|
const items = def.items;
|
|
3976
3978
|
inst._zod.parse = (payload, ctx) => {
|
|
3977
|
-
const
|
|
3978
|
-
if (!Array.isArray(
|
|
3979
|
+
const input2 = payload.value;
|
|
3980
|
+
if (!Array.isArray(input2)) {
|
|
3979
3981
|
payload.issues.push({
|
|
3980
|
-
input,
|
|
3982
|
+
input: input2,
|
|
3981
3983
|
inst,
|
|
3982
3984
|
expected: "tuple",
|
|
3983
3985
|
code: "invalid_type"
|
|
@@ -3989,23 +3991,23 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3989
3991
|
const optinStart = getTupleOptStart(items, "optin");
|
|
3990
3992
|
const optoutStart = getTupleOptStart(items, "optout");
|
|
3991
3993
|
if (!def.rest) {
|
|
3992
|
-
if (
|
|
3994
|
+
if (input2.length < optinStart) {
|
|
3993
3995
|
payload.issues.push({
|
|
3994
3996
|
code: "too_small",
|
|
3995
3997
|
minimum: optinStart,
|
|
3996
3998
|
inclusive: true,
|
|
3997
|
-
input,
|
|
3999
|
+
input: input2,
|
|
3998
4000
|
inst,
|
|
3999
4001
|
origin: "array"
|
|
4000
4002
|
});
|
|
4001
4003
|
return payload;
|
|
4002
4004
|
}
|
|
4003
|
-
if (
|
|
4005
|
+
if (input2.length > items.length) {
|
|
4004
4006
|
payload.issues.push({
|
|
4005
4007
|
code: "too_big",
|
|
4006
4008
|
maximum: items.length,
|
|
4007
4009
|
inclusive: true,
|
|
4008
|
-
input,
|
|
4010
|
+
input: input2,
|
|
4009
4011
|
inst,
|
|
4010
4012
|
origin: "array"
|
|
4011
4013
|
});
|
|
@@ -4013,7 +4015,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
4013
4015
|
}
|
|
4014
4016
|
const itemResults = new Array(items.length);
|
|
4015
4017
|
for (let i = 0; i < items.length; i++) {
|
|
4016
|
-
const r = items[i]._zod.run({ value:
|
|
4018
|
+
const r = items[i]._zod.run({ value: input2[i], issues: [] }, ctx);
|
|
4017
4019
|
if (r instanceof Promise) {
|
|
4018
4020
|
proms.push(r.then((rr) => {
|
|
4019
4021
|
itemResults[i] = rr;
|
|
@@ -4024,7 +4026,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
4024
4026
|
}
|
|
4025
4027
|
if (def.rest) {
|
|
4026
4028
|
let i = items.length - 1;
|
|
4027
|
-
const rest =
|
|
4029
|
+
const rest = input2.slice(items.length);
|
|
4028
4030
|
for (const el of rest) {
|
|
4029
4031
|
i++;
|
|
4030
4032
|
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
@@ -4036,9 +4038,9 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
4036
4038
|
}
|
|
4037
4039
|
}
|
|
4038
4040
|
if (proms.length) {
|
|
4039
|
-
return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items,
|
|
4041
|
+
return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input2, optoutStart));
|
|
4040
4042
|
}
|
|
4041
|
-
return handleTupleResults(itemResults, payload, items,
|
|
4043
|
+
return handleTupleResults(itemResults, payload, items, input2, optoutStart);
|
|
4042
4044
|
};
|
|
4043
4045
|
});
|
|
4044
4046
|
function getTupleOptStart(items, key) {
|
|
@@ -4054,10 +4056,10 @@ function handleTupleResult(result, final, index) {
|
|
|
4054
4056
|
}
|
|
4055
4057
|
final.value[index] = result.value;
|
|
4056
4058
|
}
|
|
4057
|
-
function handleTupleResults(itemResults, final, items,
|
|
4059
|
+
function handleTupleResults(itemResults, final, items, input2, optoutStart) {
|
|
4058
4060
|
for (let i = 0; i < items.length; i++) {
|
|
4059
4061
|
const r = itemResults[i];
|
|
4060
|
-
const isPresent = i <
|
|
4062
|
+
const isPresent = i < input2.length;
|
|
4061
4063
|
if (r.issues.length) {
|
|
4062
4064
|
if (!isPresent && i >= optoutStart) {
|
|
4063
4065
|
final.value.length = i;
|
|
@@ -4067,7 +4069,7 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
4067
4069
|
}
|
|
4068
4070
|
final.value[i] = r.value;
|
|
4069
4071
|
}
|
|
4070
|
-
for (let i = final.value.length - 1; i >=
|
|
4072
|
+
for (let i = final.value.length - 1; i >= input2.length; i--) {
|
|
4071
4073
|
if (items[i]._zod.optout === "optional" && final.value[i] === void 0) {
|
|
4072
4074
|
final.value.length = i;
|
|
4073
4075
|
} else {
|
|
@@ -4079,12 +4081,12 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
4079
4081
|
var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
4080
4082
|
$ZodType.init(inst, def);
|
|
4081
4083
|
inst._zod.parse = (payload, ctx) => {
|
|
4082
|
-
const
|
|
4083
|
-
if (!isPlainObject(
|
|
4084
|
+
const input2 = payload.value;
|
|
4085
|
+
if (!isPlainObject(input2)) {
|
|
4084
4086
|
payload.issues.push({
|
|
4085
4087
|
expected: "record",
|
|
4086
4088
|
code: "invalid_type",
|
|
4087
|
-
input,
|
|
4089
|
+
input: input2,
|
|
4088
4090
|
inst
|
|
4089
4091
|
});
|
|
4090
4092
|
return payload;
|
|
@@ -4113,7 +4115,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4113
4115
|
continue;
|
|
4114
4116
|
}
|
|
4115
4117
|
const outKey = keyResult.value;
|
|
4116
|
-
const result = def.valueType._zod.run({ value:
|
|
4118
|
+
const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
4117
4119
|
if (result instanceof Promise) {
|
|
4118
4120
|
proms.push(result.then((result2) => {
|
|
4119
4121
|
if (result2.issues.length) {
|
|
@@ -4130,7 +4132,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4130
4132
|
}
|
|
4131
4133
|
}
|
|
4132
4134
|
let unrecognized;
|
|
4133
|
-
for (const key in
|
|
4135
|
+
for (const key in input2) {
|
|
4134
4136
|
if (!recordKeys.has(key)) {
|
|
4135
4137
|
unrecognized = unrecognized ?? [];
|
|
4136
4138
|
unrecognized.push(key);
|
|
@@ -4139,17 +4141,17 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4139
4141
|
if (unrecognized && unrecognized.length > 0) {
|
|
4140
4142
|
payload.issues.push({
|
|
4141
4143
|
code: "unrecognized_keys",
|
|
4142
|
-
input,
|
|
4144
|
+
input: input2,
|
|
4143
4145
|
inst,
|
|
4144
4146
|
keys: unrecognized
|
|
4145
4147
|
});
|
|
4146
4148
|
}
|
|
4147
4149
|
} else {
|
|
4148
4150
|
payload.value = {};
|
|
4149
|
-
for (const key of Reflect.ownKeys(
|
|
4151
|
+
for (const key of Reflect.ownKeys(input2)) {
|
|
4150
4152
|
if (key === "__proto__")
|
|
4151
4153
|
continue;
|
|
4152
|
-
if (!Object.prototype.propertyIsEnumerable.call(
|
|
4154
|
+
if (!Object.prototype.propertyIsEnumerable.call(input2, key))
|
|
4153
4155
|
continue;
|
|
4154
4156
|
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
4155
4157
|
if (keyResult instanceof Promise) {
|
|
@@ -4167,7 +4169,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4167
4169
|
}
|
|
4168
4170
|
if (keyResult.issues.length) {
|
|
4169
4171
|
if (def.mode === "loose") {
|
|
4170
|
-
payload.value[key] =
|
|
4172
|
+
payload.value[key] = input2[key];
|
|
4171
4173
|
} else {
|
|
4172
4174
|
payload.issues.push({
|
|
4173
4175
|
code: "invalid_key",
|
|
@@ -4180,7 +4182,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4180
4182
|
}
|
|
4181
4183
|
continue;
|
|
4182
4184
|
}
|
|
4183
|
-
const result = def.valueType._zod.run({ value:
|
|
4185
|
+
const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
4184
4186
|
if (result instanceof Promise) {
|
|
4185
4187
|
proms.push(result.then((result2) => {
|
|
4186
4188
|
if (result2.issues.length) {
|
|
@@ -4205,27 +4207,27 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4205
4207
|
var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
4206
4208
|
$ZodType.init(inst, def);
|
|
4207
4209
|
inst._zod.parse = (payload, ctx) => {
|
|
4208
|
-
const
|
|
4209
|
-
if (!(
|
|
4210
|
+
const input2 = payload.value;
|
|
4211
|
+
if (!(input2 instanceof Map)) {
|
|
4210
4212
|
payload.issues.push({
|
|
4211
4213
|
expected: "map",
|
|
4212
4214
|
code: "invalid_type",
|
|
4213
|
-
input,
|
|
4215
|
+
input: input2,
|
|
4214
4216
|
inst
|
|
4215
4217
|
});
|
|
4216
4218
|
return payload;
|
|
4217
4219
|
}
|
|
4218
4220
|
const proms = [];
|
|
4219
4221
|
payload.value = /* @__PURE__ */ new Map();
|
|
4220
|
-
for (const [key, value] of
|
|
4222
|
+
for (const [key, value] of input2) {
|
|
4221
4223
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
4222
4224
|
const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
|
|
4223
4225
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
4224
4226
|
proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
|
|
4225
|
-
handleMapResult(keyResult2, valueResult2, payload, key,
|
|
4227
|
+
handleMapResult(keyResult2, valueResult2, payload, key, input2, inst, ctx);
|
|
4226
4228
|
}));
|
|
4227
4229
|
} else {
|
|
4228
|
-
handleMapResult(keyResult, valueResult, payload, key,
|
|
4230
|
+
handleMapResult(keyResult, valueResult, payload, key, input2, inst, ctx);
|
|
4229
4231
|
}
|
|
4230
4232
|
}
|
|
4231
4233
|
if (proms.length)
|
|
@@ -4233,7 +4235,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
|
4233
4235
|
return payload;
|
|
4234
4236
|
};
|
|
4235
4237
|
});
|
|
4236
|
-
function handleMapResult(keyResult, valueResult, final, key,
|
|
4238
|
+
function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
|
|
4237
4239
|
if (keyResult.issues.length) {
|
|
4238
4240
|
if (propertyKeyTypes.has(typeof key)) {
|
|
4239
4241
|
final.issues.push(...prefixIssues(key, keyResult.issues));
|
|
@@ -4241,7 +4243,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
4241
4243
|
final.issues.push({
|
|
4242
4244
|
code: "invalid_key",
|
|
4243
4245
|
origin: "map",
|
|
4244
|
-
input,
|
|
4246
|
+
input: input2,
|
|
4245
4247
|
inst,
|
|
4246
4248
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
4247
4249
|
});
|
|
@@ -4254,7 +4256,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
4254
4256
|
final.issues.push({
|
|
4255
4257
|
origin: "map",
|
|
4256
4258
|
code: "invalid_element",
|
|
4257
|
-
input,
|
|
4259
|
+
input: input2,
|
|
4258
4260
|
inst,
|
|
4259
4261
|
key,
|
|
4260
4262
|
issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
@@ -4266,10 +4268,10 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
4266
4268
|
var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
4267
4269
|
$ZodType.init(inst, def);
|
|
4268
4270
|
inst._zod.parse = (payload, ctx) => {
|
|
4269
|
-
const
|
|
4270
|
-
if (!(
|
|
4271
|
+
const input2 = payload.value;
|
|
4272
|
+
if (!(input2 instanceof Set)) {
|
|
4271
4273
|
payload.issues.push({
|
|
4272
|
-
input,
|
|
4274
|
+
input: input2,
|
|
4273
4275
|
inst,
|
|
4274
4276
|
expected: "set",
|
|
4275
4277
|
code: "invalid_type"
|
|
@@ -4278,7 +4280,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
|
4278
4280
|
}
|
|
4279
4281
|
const proms = [];
|
|
4280
4282
|
payload.value = /* @__PURE__ */ new Set();
|
|
4281
|
-
for (const item of
|
|
4283
|
+
for (const item of input2) {
|
|
4282
4284
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
4283
4285
|
if (result instanceof Promise) {
|
|
4284
4286
|
proms.push(result.then((result2) => handleSetResult(result2, payload)));
|
|
@@ -4303,14 +4305,14 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
4303
4305
|
inst._zod.values = valuesSet;
|
|
4304
4306
|
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
4305
4307
|
inst._zod.parse = (payload, _ctx) => {
|
|
4306
|
-
const
|
|
4307
|
-
if (valuesSet.has(
|
|
4308
|
+
const input2 = payload.value;
|
|
4309
|
+
if (valuesSet.has(input2)) {
|
|
4308
4310
|
return payload;
|
|
4309
4311
|
}
|
|
4310
4312
|
payload.issues.push({
|
|
4311
4313
|
code: "invalid_value",
|
|
4312
4314
|
values,
|
|
4313
|
-
input,
|
|
4315
|
+
input: input2,
|
|
4314
4316
|
inst
|
|
4315
4317
|
});
|
|
4316
4318
|
return payload;
|
|
@@ -4325,14 +4327,14 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
4325
4327
|
inst._zod.values = values;
|
|
4326
4328
|
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
4327
4329
|
inst._zod.parse = (payload, _ctx) => {
|
|
4328
|
-
const
|
|
4329
|
-
if (values.has(
|
|
4330
|
+
const input2 = payload.value;
|
|
4331
|
+
if (values.has(input2)) {
|
|
4330
4332
|
return payload;
|
|
4331
4333
|
}
|
|
4332
4334
|
payload.issues.push({
|
|
4333
4335
|
code: "invalid_value",
|
|
4334
4336
|
values: def.values,
|
|
4335
|
-
input,
|
|
4337
|
+
input: input2,
|
|
4336
4338
|
inst
|
|
4337
4339
|
});
|
|
4338
4340
|
return payload;
|
|
@@ -4341,13 +4343,13 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
4341
4343
|
var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
|
|
4342
4344
|
$ZodType.init(inst, def);
|
|
4343
4345
|
inst._zod.parse = (payload, _ctx) => {
|
|
4344
|
-
const
|
|
4345
|
-
if (
|
|
4346
|
+
const input2 = payload.value;
|
|
4347
|
+
if (input2 instanceof File)
|
|
4346
4348
|
return payload;
|
|
4347
4349
|
payload.issues.push({
|
|
4348
4350
|
expected: "file",
|
|
4349
4351
|
code: "invalid_type",
|
|
4350
|
-
input,
|
|
4352
|
+
input: input2,
|
|
4351
4353
|
inst
|
|
4352
4354
|
});
|
|
4353
4355
|
return payload;
|
|
@@ -4377,8 +4379,8 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
|
|
|
4377
4379
|
return payload;
|
|
4378
4380
|
};
|
|
4379
4381
|
});
|
|
4380
|
-
function handleOptionalResult(result,
|
|
4381
|
-
if (
|
|
4382
|
+
function handleOptionalResult(result, input2) {
|
|
4383
|
+
if (input2 === void 0 && (result.issues.length || result.fallback)) {
|
|
4382
4384
|
return { issues: [], value: void 0 };
|
|
4383
4385
|
}
|
|
4384
4386
|
return result;
|
|
@@ -4396,11 +4398,11 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
|
4396
4398
|
});
|
|
4397
4399
|
inst._zod.parse = (payload, ctx) => {
|
|
4398
4400
|
if (def.innerType._zod.optin === "optional") {
|
|
4399
|
-
const
|
|
4401
|
+
const input2 = payload.value;
|
|
4400
4402
|
const result = def.innerType._zod.run(payload, ctx);
|
|
4401
4403
|
if (result instanceof Promise)
|
|
4402
|
-
return result.then((r) => handleOptionalResult(r,
|
|
4403
|
-
return handleOptionalResult(result,
|
|
4404
|
+
return result.then((r) => handleOptionalResult(r, input2));
|
|
4405
|
+
return handleOptionalResult(result, input2);
|
|
4404
4406
|
}
|
|
4405
4407
|
if (payload.value === void 0) {
|
|
4406
4408
|
return payload;
|
|
@@ -4825,20 +4827,20 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
|
4825
4827
|
return payload;
|
|
4826
4828
|
};
|
|
4827
4829
|
inst._zod.check = (payload) => {
|
|
4828
|
-
const
|
|
4829
|
-
const r = def.fn(
|
|
4830
|
+
const input2 = payload.value;
|
|
4831
|
+
const r = def.fn(input2);
|
|
4830
4832
|
if (r instanceof Promise) {
|
|
4831
|
-
return r.then((r2) => handleRefineResult(r2, payload,
|
|
4833
|
+
return r.then((r2) => handleRefineResult(r2, payload, input2, inst));
|
|
4832
4834
|
}
|
|
4833
|
-
handleRefineResult(r, payload,
|
|
4835
|
+
handleRefineResult(r, payload, input2, inst);
|
|
4834
4836
|
return;
|
|
4835
4837
|
};
|
|
4836
4838
|
});
|
|
4837
|
-
function handleRefineResult(result, payload,
|
|
4839
|
+
function handleRefineResult(result, payload, input2, inst) {
|
|
4838
4840
|
if (!result) {
|
|
4839
4841
|
const _iss = {
|
|
4840
4842
|
code: "custom",
|
|
4841
|
-
input,
|
|
4843
|
+
input: input2,
|
|
4842
4844
|
inst,
|
|
4843
4845
|
// incorporates params.error into issue reporting
|
|
4844
4846
|
path: [...inst._zod.def.path ?? []],
|
|
@@ -8125,8 +8127,8 @@ function ko_default() {
|
|
|
8125
8127
|
}
|
|
8126
8128
|
|
|
8127
8129
|
// ../../../node_modules/zod/v4/locales/lt.js
|
|
8128
|
-
var capitalizeFirstCharacter = (
|
|
8129
|
-
return
|
|
8130
|
+
var capitalizeFirstCharacter = (text3) => {
|
|
8131
|
+
return text3.charAt(0).toUpperCase() + text3.slice(1);
|
|
8130
8132
|
};
|
|
8131
8133
|
function getUnitTypeFromNumber(number4) {
|
|
8132
8134
|
const abs = Math.abs(number4);
|
|
@@ -11526,23 +11528,23 @@ function _overwrite(tx) {
|
|
|
11526
11528
|
}
|
|
11527
11529
|
// @__NO_SIDE_EFFECTS__
|
|
11528
11530
|
function _normalize(form) {
|
|
11529
|
-
return /* @__PURE__ */ _overwrite((
|
|
11531
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.normalize(form));
|
|
11530
11532
|
}
|
|
11531
11533
|
// @__NO_SIDE_EFFECTS__
|
|
11532
11534
|
function _trim() {
|
|
11533
|
-
return /* @__PURE__ */ _overwrite((
|
|
11535
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.trim());
|
|
11534
11536
|
}
|
|
11535
11537
|
// @__NO_SIDE_EFFECTS__
|
|
11536
11538
|
function _toLowerCase() {
|
|
11537
|
-
return /* @__PURE__ */ _overwrite((
|
|
11539
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.toLowerCase());
|
|
11538
11540
|
}
|
|
11539
11541
|
// @__NO_SIDE_EFFECTS__
|
|
11540
11542
|
function _toUpperCase() {
|
|
11541
|
-
return /* @__PURE__ */ _overwrite((
|
|
11543
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.toUpperCase());
|
|
11542
11544
|
}
|
|
11543
11545
|
// @__NO_SIDE_EFFECTS__
|
|
11544
11546
|
function _slugify() {
|
|
11545
|
-
return /* @__PURE__ */ _overwrite((
|
|
11547
|
+
return /* @__PURE__ */ _overwrite((input2) => slugify(input2));
|
|
11546
11548
|
}
|
|
11547
11549
|
// @__NO_SIDE_EFFECTS__
|
|
11548
11550
|
function _array(Class2, element, params) {
|
|
@@ -11847,8 +11849,8 @@ function _stringbool(Classes, _params) {
|
|
|
11847
11849
|
type: "pipe",
|
|
11848
11850
|
in: stringSchema,
|
|
11849
11851
|
out: booleanSchema,
|
|
11850
|
-
transform: ((
|
|
11851
|
-
let data =
|
|
11852
|
+
transform: ((input2, payload) => {
|
|
11853
|
+
let data = input2;
|
|
11852
11854
|
if (params.case !== "sensitive")
|
|
11853
11855
|
data = data.toLowerCase();
|
|
11854
11856
|
if (truthySet.has(data)) {
|
|
@@ -11867,8 +11869,8 @@ function _stringbool(Classes, _params) {
|
|
|
11867
11869
|
return {};
|
|
11868
11870
|
}
|
|
11869
11871
|
}),
|
|
11870
|
-
reverseTransform: ((
|
|
11871
|
-
if (
|
|
11872
|
+
reverseTransform: ((input2, _payload) => {
|
|
11873
|
+
if (input2 === true) {
|
|
11872
11874
|
return truthyArray[0] || "true";
|
|
11873
11875
|
} else {
|
|
11874
11876
|
return falsyArray[0] || "false";
|
|
@@ -12764,9 +12766,9 @@ var allProcessors = {
|
|
|
12764
12766
|
optional: optionalProcessor,
|
|
12765
12767
|
lazy: lazyProcessor
|
|
12766
12768
|
};
|
|
12767
|
-
function toJSONSchema(
|
|
12768
|
-
if ("_idmap" in
|
|
12769
|
-
const registry2 =
|
|
12769
|
+
function toJSONSchema(input2, params) {
|
|
12770
|
+
if ("_idmap" in input2) {
|
|
12771
|
+
const registry2 = input2;
|
|
12770
12772
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
12771
12773
|
const defs = {};
|
|
12772
12774
|
for (const entry of registry2._idmap.entries()) {
|
|
@@ -12794,9 +12796,9 @@ function toJSONSchema(input, params) {
|
|
|
12794
12796
|
return { schemas };
|
|
12795
12797
|
}
|
|
12796
12798
|
const ctx = initializeContext({ ...params, processors: allProcessors });
|
|
12797
|
-
process2(
|
|
12798
|
-
extractDefs(ctx,
|
|
12799
|
-
return finalize(ctx,
|
|
12799
|
+
process2(input2, ctx);
|
|
12800
|
+
extractDefs(ctx, input2);
|
|
12801
|
+
return finalize(ctx, input2);
|
|
12800
12802
|
}
|
|
12801
12803
|
|
|
12802
12804
|
// ../../../node_modules/zod/v4/core/json-schema-generator.js
|
|
@@ -15073,7 +15075,7 @@ var codexhostErrorSchema = external_exports.strictObject({
|
|
|
15073
15075
|
|
|
15074
15076
|
// ../../shared-contracts/dist/harness-presentation.js
|
|
15075
15077
|
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
15076
|
-
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((
|
|
15078
|
+
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text3) => text3.trim().length > 0);
|
|
15077
15079
|
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
15078
15080
|
label: displayText(256).optional(),
|
|
15079
15081
|
description: displayText(1024).optional()
|
|
@@ -15162,7 +15164,7 @@ var usageMeasurementsSchema = external_exports.object({
|
|
|
15162
15164
|
outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
|
|
15163
15165
|
timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
|
|
15164
15166
|
}).strict();
|
|
15165
|
-
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((
|
|
15167
|
+
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text3) => text3.length <= maximum));
|
|
15166
15168
|
var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
15167
15169
|
kind: external_exports.literal("countdown"),
|
|
15168
15170
|
id: external_exports.string().min(1).max(64),
|
|
@@ -15545,6 +15547,8 @@ var externalThreadInspectionSchema = external_exports.object({
|
|
|
15545
15547
|
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15546
15548
|
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15547
15549
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15550
|
+
/** Live Session catalog when it, not the Adapter inspection, contains `effectiveModel`. */
|
|
15551
|
+
catalog: harnessModelCatalogSchema.optional(),
|
|
15548
15552
|
history: harnessHistoryCapabilitiesSchema,
|
|
15549
15553
|
usage: threadUsageSnapshotSchema.optional(),
|
|
15550
15554
|
locked: external_exports.literal(true)
|
|
@@ -15603,9 +15607,9 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
15603
15607
|
}).strict();
|
|
15604
15608
|
var threadSteeringContextSchema = external_exports.object({
|
|
15605
15609
|
kind: external_exports.literal("application"),
|
|
15606
|
-
value: external_exports.string().transform((
|
|
15610
|
+
value: external_exports.string().transform((text3, context) => {
|
|
15607
15611
|
try {
|
|
15608
|
-
return JSON.parse(
|
|
15612
|
+
return JSON.parse(text3);
|
|
15609
15613
|
} catch {
|
|
15610
15614
|
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15611
15615
|
return external_exports.NEVER;
|
|
@@ -15740,8 +15744,8 @@ var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).r
|
|
|
15740
15744
|
const { username, password } = new URL(value);
|
|
15741
15745
|
return !username && !password && !/[\\\s]/u.test(value);
|
|
15742
15746
|
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
15743
|
-
function localizedText(
|
|
15744
|
-
return external_exports.strictObject({ en:
|
|
15747
|
+
function localizedText(text3) {
|
|
15748
|
+
return external_exports.strictObject({ en: text3, "zh-CN": text3 });
|
|
15745
15749
|
}
|
|
15746
15750
|
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
15747
15751
|
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
@@ -15858,8 +15862,8 @@ var desktopExtensionTrustTierSchema = external_exports.enum(["official", "commun
|
|
|
15858
15862
|
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
15859
15863
|
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
15860
15864
|
}
|
|
15861
|
-
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((
|
|
15862
|
-
const url2 = new URL(
|
|
15865
|
+
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input2) => {
|
|
15866
|
+
const url2 = new URL(input2);
|
|
15863
15867
|
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);
|
|
15864
15868
|
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
15865
15869
|
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
@@ -16210,6 +16214,8 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
16210
16214
|
"codexhost/workspace/read",
|
|
16211
16215
|
"codexhost/thread/tree/read",
|
|
16212
16216
|
"codexhost/thread/pins/list",
|
|
16217
|
+
"codexhost/thread/sections/list",
|
|
16218
|
+
"codexhost/thread/sections/move",
|
|
16213
16219
|
"codexhost/thread/pins/set",
|
|
16214
16220
|
"codexhost/harness/plugins/list",
|
|
16215
16221
|
"codexhost/harness/inspect",
|
|
@@ -16248,8 +16254,21 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
16248
16254
|
"codexhost/update/check",
|
|
16249
16255
|
"codexhost/update/start",
|
|
16250
16256
|
"codexhost/update/status",
|
|
16257
|
+
"codexhost/announcement/get",
|
|
16258
|
+
"codexhost/announcement/acknowledge",
|
|
16251
16259
|
"codexhost/sessions/loaded/list"
|
|
16252
16260
|
];
|
|
16261
|
+
var clientThreadSectionsSchema = external_exports.object({
|
|
16262
|
+
sections: external_exports.array(external_exports.object({
|
|
16263
|
+
id: external_exports.string().min(1),
|
|
16264
|
+
name: external_exports.string().min(1),
|
|
16265
|
+
threads: external_exports.array(jsonObjectSchema)
|
|
16266
|
+
}).strict())
|
|
16267
|
+
}).strict();
|
|
16268
|
+
var clientThreadSectionMoveSchema = external_exports.object({
|
|
16269
|
+
threadId: external_exports.string().min(1).max(1024),
|
|
16270
|
+
sectionId: external_exports.string().min(1).max(1024).nullable()
|
|
16271
|
+
}).strict();
|
|
16253
16272
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
16254
16273
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
16255
16274
|
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
@@ -16791,8 +16810,8 @@ var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
|
16791
16810
|
operations: external_exports.array(harnessPreferenceOperationSchema).min(1).max(256),
|
|
16792
16811
|
initializeOnly: external_exports.boolean().optional(),
|
|
16793
16812
|
expectedRevision: external_exports.number().int().nonnegative().optional()
|
|
16794
|
-
}).superRefine((
|
|
16795
|
-
for (const operation of
|
|
16813
|
+
}).superRefine((input2, ctx) => {
|
|
16814
|
+
for (const operation of input2.operations) {
|
|
16796
16815
|
if (operation.kind === "newThread" && (!operation.lastHarness && !operation.configuration || Boolean(operation.harnessId) !== Boolean(operation.configuration)))
|
|
16797
16816
|
ctx.addIssue({
|
|
16798
16817
|
code: "custom",
|
|
@@ -17194,13 +17213,18 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
17194
17213
|
// ../../shared-contracts/dist/harness-installation.js
|
|
17195
17214
|
var harnessInstallationParamsSchema = external_exports.object({
|
|
17196
17215
|
harnessId: harnessIdSchema,
|
|
17197
|
-
action: external_exports.enum(["check", "update", "install"])
|
|
17198
|
-
|
|
17216
|
+
action: external_exports.enum(["check", "update", "install"]),
|
|
17217
|
+
confirmedVersion: external_exports.string().min(1).max(128).optional()
|
|
17218
|
+
}).strict().refine(({ action, confirmedVersion }) => action === "update" || confirmedVersion === void 0);
|
|
17199
17219
|
var harnessInstallationStateSchema = external_exports.object({
|
|
17200
17220
|
currentVersion: external_exports.string().min(1).max(128),
|
|
17201
17221
|
latestVersion: external_exports.string().min(1).max(128),
|
|
17202
17222
|
updateAvailable: external_exports.boolean(),
|
|
17203
17223
|
canUpdate: external_exports.boolean(),
|
|
17224
|
+
/** Present when the Adapter has a verified list and the available target is outside it. */
|
|
17225
|
+
latestVerifiedVersion: external_exports.string().min(1).max(128).optional(),
|
|
17226
|
+
/** Update preflight stopped before running the installer; latestVersion needs confirmation. */
|
|
17227
|
+
confirmationRequired: external_exports.literal(true).optional(),
|
|
17204
17228
|
/** Defaults to CLI; some Harnesses ship only inside a desktop application. */
|
|
17205
17229
|
versionKind: external_exports.enum(["cli", "application"]).optional(),
|
|
17206
17230
|
/** Official download opened by the user; does not imply an automatic installation. */
|
|
@@ -17530,6 +17554,38 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
17530
17554
|
status: updateStatusSchema.nullable()
|
|
17531
17555
|
});
|
|
17532
17556
|
|
|
17557
|
+
// ../../shared-contracts/dist/release-announcement.js
|
|
17558
|
+
var RELEASE_ANNOUNCEMENT_MAX_THEMES = 12;
|
|
17559
|
+
var releaseAnnouncementThemeSchema = external_exports.strictObject({
|
|
17560
|
+
icon: external_exports.string().min(1).max(16).optional(),
|
|
17561
|
+
title: external_exports.string().min(1).max(120),
|
|
17562
|
+
body: external_exports.string().min(1).max(1200),
|
|
17563
|
+
contributors: external_exports.array(external_exports.string().min(1).max(39)).max(30)
|
|
17564
|
+
});
|
|
17565
|
+
var releaseAnnouncementContentSchema = external_exports.strictObject({
|
|
17566
|
+
summary: external_exports.string().min(1).max(600).optional(),
|
|
17567
|
+
themes: external_exports.array(releaseAnnouncementThemeSchema).min(1).max(RELEASE_ANNOUNCEMENT_MAX_THEMES)
|
|
17568
|
+
});
|
|
17569
|
+
var releaseAnnouncementSchema = external_exports.strictObject({
|
|
17570
|
+
version: updateSemanticVersionSchema,
|
|
17571
|
+
publishedAt: external_exports.iso.datetime(),
|
|
17572
|
+
url: external_exports.string().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),
|
|
17573
|
+
zh: releaseAnnouncementContentSchema.nullable(),
|
|
17574
|
+
en: releaseAnnouncementContentSchema.nullable()
|
|
17575
|
+
}).refine((value) => value.zh !== null || value.en !== null, {
|
|
17576
|
+
message: "an announcement needs at least one language"
|
|
17577
|
+
});
|
|
17578
|
+
var releaseAnnouncementGetParamsSchema = external_exports.strictObject({
|
|
17579
|
+
manual: external_exports.boolean().optional()
|
|
17580
|
+
});
|
|
17581
|
+
var releaseAnnouncementGetResultSchema = external_exports.strictObject({
|
|
17582
|
+
announcement: releaseAnnouncementSchema.nullable(),
|
|
17583
|
+
unread: external_exports.boolean()
|
|
17584
|
+
});
|
|
17585
|
+
var releaseAnnouncementAcknowledgeParamsSchema = external_exports.strictObject({
|
|
17586
|
+
version: updateSemanticVersionSchema
|
|
17587
|
+
});
|
|
17588
|
+
|
|
17533
17589
|
// ../../shared-contracts/dist/thread-watch-notice.js
|
|
17534
17590
|
var THREAD_WATCH_NOTICE_OUTCOMES = [
|
|
17535
17591
|
"completed",
|
|
@@ -17577,17 +17633,67 @@ var remoteSshSetupResultSchema = external_exports.object({ state: external_expor
|
|
|
17577
17633
|
|
|
17578
17634
|
// ../../shared-contracts/dist/remote-sessions.js
|
|
17579
17635
|
var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
|
|
17580
|
-
var
|
|
17636
|
+
var REMOTE_IDENTITY_MAX_LENGTH = 1024;
|
|
17637
|
+
var identity = external_exports.string().min(1).max(REMOTE_IDENTITY_MAX_LENGTH);
|
|
17581
17638
|
var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
|
|
17582
17639
|
var thread = { ...target, threadId: identity };
|
|
17640
|
+
var text = external_exports.string().min(1).max(8e3);
|
|
17641
|
+
var input = { text, requestId: identity };
|
|
17642
|
+
var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
|
|
17643
|
+
external_exports.object({ accepted: external_exports.literal(true), startQueuedItemId: identity.optional() }),
|
|
17644
|
+
external_exports.object({
|
|
17645
|
+
accepted: external_exports.literal(false),
|
|
17646
|
+
code: external_exports.enum([
|
|
17647
|
+
"remote/queue-unavailable",
|
|
17648
|
+
"remote/steer-unavailable",
|
|
17649
|
+
"remote/turn-changed",
|
|
17650
|
+
"remote/send-rejected",
|
|
17651
|
+
"session/queue-item-not-found",
|
|
17652
|
+
"session/queue-item-starting"
|
|
17653
|
+
]),
|
|
17654
|
+
message: external_exports.string()
|
|
17655
|
+
})
|
|
17656
|
+
]);
|
|
17657
|
+
var remoteQueueSnapshotSchema = external_exports.discriminatedUnion("available", [
|
|
17658
|
+
external_exports.object({ available: external_exports.literal(false) }),
|
|
17659
|
+
external_exports.object({
|
|
17660
|
+
available: external_exports.literal(true),
|
|
17661
|
+
items: external_exports.array(external_exports.object({ id: identity, clientUserMessageId: identity, preview: external_exports.string().max(801) })).max(100)
|
|
17662
|
+
})
|
|
17663
|
+
]);
|
|
17583
17664
|
var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
17584
17665
|
external_exports.strictObject({ kind: external_exports.literal("hosts") }),
|
|
17666
|
+
external_exports.strictObject({
|
|
17667
|
+
kind: external_exports.literal("create"),
|
|
17668
|
+
...target,
|
|
17669
|
+
cwd: external_exports.string().min(1).max(8192),
|
|
17670
|
+
epoch: identity
|
|
17671
|
+
}),
|
|
17672
|
+
external_exports.strictObject({ kind: external_exports.literal("projectHarnesses"), ...target, epoch: identity }),
|
|
17673
|
+
external_exports.strictObject({
|
|
17674
|
+
kind: external_exports.literal("inspectHarness"),
|
|
17675
|
+
...target,
|
|
17676
|
+
epoch: identity,
|
|
17677
|
+
cwd: external_exports.string().min(1).max(8192),
|
|
17678
|
+
harnessId: identity
|
|
17679
|
+
}),
|
|
17680
|
+
external_exports.strictObject({
|
|
17681
|
+
kind: external_exports.literal("startSelected"),
|
|
17682
|
+
...target,
|
|
17683
|
+
epoch: identity,
|
|
17684
|
+
cwd: external_exports.string().min(1).max(8192),
|
|
17685
|
+
harnessId: identity,
|
|
17686
|
+
model: external_exports.string().min(1).max(4096),
|
|
17687
|
+
serviceTier: external_exports.enum(["priority", "ultrafast"]).optional(),
|
|
17688
|
+
reasoningEffort: identity.optional()
|
|
17689
|
+
}),
|
|
17585
17690
|
external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
|
|
17586
17691
|
external_exports.strictObject({
|
|
17587
17692
|
kind: external_exports.literal("list"),
|
|
17588
17693
|
...target,
|
|
17589
17694
|
cursor: external_exports.string().nullable(),
|
|
17590
|
-
archived: external_exports.boolean()
|
|
17695
|
+
archived: external_exports.boolean(),
|
|
17696
|
+
includeLoaded: external_exports.literal(true).optional()
|
|
17591
17697
|
}),
|
|
17592
17698
|
external_exports.strictObject({
|
|
17593
17699
|
kind: external_exports.literal("read"),
|
|
@@ -17617,9 +17723,25 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
17617
17723
|
kind: external_exports.literal("prompt"),
|
|
17618
17724
|
...thread,
|
|
17619
17725
|
epoch: identity,
|
|
17620
|
-
text
|
|
17726
|
+
text,
|
|
17621
17727
|
requestId: identity.optional()
|
|
17622
17728
|
}),
|
|
17729
|
+
external_exports.strictObject({ kind: external_exports.literal("queue"), ...thread, epoch: identity }),
|
|
17730
|
+
external_exports.strictObject({
|
|
17731
|
+
kind: external_exports.literal("delivery"),
|
|
17732
|
+
...thread,
|
|
17733
|
+
epoch: identity,
|
|
17734
|
+
action: external_exports.discriminatedUnion("kind", [
|
|
17735
|
+
external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input }),
|
|
17736
|
+
external_exports.strictObject({ kind: external_exports.literal("steer"), ...input, turnId: identity }),
|
|
17737
|
+
external_exports.strictObject({ kind: external_exports.literal("remove"), itemId: identity }),
|
|
17738
|
+
external_exports.strictObject({
|
|
17739
|
+
kind: external_exports.literal("start"),
|
|
17740
|
+
itemId: identity,
|
|
17741
|
+
onlyIfHead: external_exports.literal(true).optional()
|
|
17742
|
+
})
|
|
17743
|
+
])
|
|
17744
|
+
}),
|
|
17623
17745
|
external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
|
|
17624
17746
|
external_exports.strictObject({
|
|
17625
17747
|
kind: external_exports.literal("rename"),
|
|
@@ -18159,9 +18281,9 @@ function subagentConfiguration(value) {
|
|
|
18159
18281
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
18160
18282
|
return {};
|
|
18161
18283
|
const row = value;
|
|
18162
|
-
const
|
|
18163
|
-
const model2 = row.model === "inherit" ? void 0 :
|
|
18164
|
-
const reasoningEffort =
|
|
18284
|
+
const text3 = (value2) => typeof value2 === "string" && value2.trim() ? value2 : void 0;
|
|
18285
|
+
const model2 = row.model === "inherit" ? void 0 : text3(row.model);
|
|
18286
|
+
const reasoningEffort = text3(row.reasoningEffort) ?? text3(row.reasoning_effort) ?? text3(row.thinking);
|
|
18165
18287
|
return { ...model2 ? { model: model2 } : {}, ...reasoningEffort ? { reasoningEffort } : {} };
|
|
18166
18288
|
}
|
|
18167
18289
|
function inheritSubagentConfiguration(child, parent) {
|
|
@@ -18220,7 +18342,7 @@ var CODEBUDDY_RUNTIME_PROFILE = {
|
|
|
18220
18342
|
var OUTPUT_LIMIT = 64e3;
|
|
18221
18343
|
var record3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
18222
18344
|
var rows = (value) => Array.isArray(value) ? value.map(record3) : [];
|
|
18223
|
-
var
|
|
18345
|
+
var text2 = (value) => typeof value === "string" ? value : "";
|
|
18224
18346
|
var CodeBuddyError = class extends Error {
|
|
18225
18347
|
code;
|
|
18226
18348
|
constructor(code, message) {
|
|
@@ -18242,15 +18364,15 @@ function failure(code, message, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
|
18242
18364
|
return { ok: false, error: nativeError(new CodeBuddyError(code, message), profile) };
|
|
18243
18365
|
}
|
|
18244
18366
|
function nativeTurnError(stopReason, meta3, profile) {
|
|
18245
|
-
const fallback = `Native Turn stopped: ${
|
|
18246
|
-
const raw =
|
|
18367
|
+
const fallback = `Native Turn stopped: ${text2(stopReason) || "unknown"} (${text2(meta3["codebuddy.ai/outcome"]) || "no native outcome"})`;
|
|
18368
|
+
const raw = text2(meta3["codebuddy.ai/errorMessage"]).trim();
|
|
18247
18369
|
let diagnostic = "";
|
|
18248
18370
|
let category;
|
|
18249
18371
|
if (raw) {
|
|
18250
18372
|
try {
|
|
18251
18373
|
const error51 = record3(JSON.parse(raw));
|
|
18252
18374
|
const data = record3(error51.data);
|
|
18253
|
-
diagnostic =
|
|
18375
|
+
diagnostic = text2(data.details).trim() || text2(error51.message).trim();
|
|
18254
18376
|
category = data.category;
|
|
18255
18377
|
} catch {
|
|
18256
18378
|
diagnostic = raw;
|
|
@@ -18357,7 +18479,7 @@ function commandCatalog(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
|
18357
18479
|
const seen = /* @__PURE__ */ new Set();
|
|
18358
18480
|
return {
|
|
18359
18481
|
commands: rows(value).flatMap((entry) => {
|
|
18360
|
-
const name =
|
|
18482
|
+
const name = text2(entry.name).replace(/^\//u, "");
|
|
18361
18483
|
if (record3(entry._meta).type === "skill" || excluded.has(name) || seen.has(name) || isExcludedLiveCommand(name))
|
|
18362
18484
|
return [];
|
|
18363
18485
|
const parsed = harnessCommandCatalogSchema.safeParse({
|
|
@@ -18371,7 +18493,7 @@ function commandCatalog(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
|
18371
18493
|
"zh-CN": { label: "压缩上下文", description: "压缩当前对话上下文" }
|
|
18372
18494
|
}
|
|
18373
18495
|
} : {},
|
|
18374
|
-
...
|
|
18496
|
+
...text2(entry.description).trim() ? { description: text2(entry.description).trim().slice(0, 512) } : {},
|
|
18375
18497
|
argumentMode: name === "compact" || record3(entry.input).hint ? "text" : "none"
|
|
18376
18498
|
}
|
|
18377
18499
|
]
|
|
@@ -18586,13 +18708,13 @@ function configuration(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
|
18586
18708
|
const thinkingOptions = rows(thought.options).map((option) => harnessThinkingOptionSchema.parse({ id: option.value, label: option.name }));
|
|
18587
18709
|
const currentThinking = thinkingOptions.find((option) => option.id === thought.currentValue);
|
|
18588
18710
|
const models = rows(model2.options).map((option) => ({
|
|
18589
|
-
ref: modelRef(
|
|
18590
|
-
label:
|
|
18711
|
+
ref: modelRef(text2(option.value)),
|
|
18712
|
+
label: text2(option.name)
|
|
18591
18713
|
}));
|
|
18592
|
-
const currentModelRef = modelRef(
|
|
18714
|
+
const currentModelRef = modelRef(text2(model2.currentValue));
|
|
18593
18715
|
let currentModel = models.find((item) => item.ref.id === currentModelRef.id);
|
|
18594
18716
|
if (!currentModel && profile.allowUnlistedModelSelection) {
|
|
18595
|
-
currentModel = { ref: currentModelRef, label:
|
|
18717
|
+
currentModel = { ref: currentModelRef, label: text2(model2.currentValue) };
|
|
18596
18718
|
models.push(currentModel);
|
|
18597
18719
|
}
|
|
18598
18720
|
if (!currentModel)
|
|
@@ -18610,9 +18732,9 @@ function configuration(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
|
18610
18732
|
modes: rows(mode.options).map((option) => ({
|
|
18611
18733
|
id: option.value,
|
|
18612
18734
|
label: option.name,
|
|
18613
|
-
localizations: permissionLocalizations(
|
|
18735
|
+
localizations: permissionLocalizations(text2(option.name), text2(option.description)),
|
|
18614
18736
|
...option.description ? { description: option.description } : {},
|
|
18615
|
-
...["bypassPermissions", "fullAccess"].includes(
|
|
18737
|
+
...["bypassPermissions", "fullAccess"].includes(text2(option.value)) ? { dangerous: true } : {}
|
|
18616
18738
|
})),
|
|
18617
18739
|
defaultModeId: mode.currentValue
|
|
18618
18740
|
});
|
|
@@ -19064,9 +19186,9 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
|
|
|
19064
19186
|
} }));
|
|
19065
19187
|
}
|
|
19066
19188
|
}
|
|
19067
|
-
function splitLines(
|
|
19068
|
-
const hasTrailingNl =
|
|
19069
|
-
const result =
|
|
19189
|
+
function splitLines(text3) {
|
|
19190
|
+
const hasTrailingNl = text3.endsWith("\n");
|
|
19191
|
+
const result = text3.split("\n").map((line) => line + "\n");
|
|
19070
19192
|
if (hasTrailingNl) {
|
|
19071
19193
|
result.pop();
|
|
19072
19194
|
} else {
|
|
@@ -19082,22 +19204,22 @@ function contentText(value) {
|
|
|
19082
19204
|
if (Array.isArray(value))
|
|
19083
19205
|
return value.map(contentText).join("");
|
|
19084
19206
|
const item = record3(value);
|
|
19085
|
-
return
|
|
19207
|
+
return text2(item.text) || (item.type === "content" ? contentText(item.content) : "");
|
|
19086
19208
|
}
|
|
19087
|
-
function toolItem(callId, name,
|
|
19209
|
+
function toolItem(callId, name, input2, cwd) {
|
|
19088
19210
|
const itemId = hostItemIdSchema.parse(`tool-${callId}`);
|
|
19089
19211
|
if (["Bash", "PowerShell"].includes(name))
|
|
19090
19212
|
return {
|
|
19091
19213
|
type: "commandExecution",
|
|
19092
19214
|
itemId,
|
|
19093
|
-
command:
|
|
19215
|
+
command: text2(record3(input2).command) || name,
|
|
19094
19216
|
cwd
|
|
19095
19217
|
};
|
|
19096
19218
|
return {
|
|
19097
19219
|
type: "toolExecution",
|
|
19098
19220
|
itemId,
|
|
19099
19221
|
toolName: name,
|
|
19100
|
-
arguments: jsonValueSchema.parse(
|
|
19222
|
+
arguments: jsonValueSchema.parse(input2 ?? {})
|
|
19101
19223
|
};
|
|
19102
19224
|
}
|
|
19103
19225
|
function toolOutput(value) {
|
|
@@ -19195,7 +19317,7 @@ var CodeBuddyTurnOutput = class {
|
|
|
19195
19317
|
const delta = contentText(update.content);
|
|
19196
19318
|
if (!delta)
|
|
19197
19319
|
return;
|
|
19198
|
-
const messageId =
|
|
19320
|
+
const messageId = text2(meta3["codebuddy.ai/llmMessageId"]) || text2(update.messageId) || text2(meta3["codebuddy.ai/messageId"]);
|
|
19199
19321
|
if (this.#messageId !== messageId) {
|
|
19200
19322
|
this.completeMessage();
|
|
19201
19323
|
this.#messageId = messageId;
|
|
@@ -19224,7 +19346,7 @@ var CodeBuddyTurnOutput = class {
|
|
|
19224
19346
|
}
|
|
19225
19347
|
if (kind !== "tool_call" && kind !== "tool_call_update")
|
|
19226
19348
|
return;
|
|
19227
|
-
const callId =
|
|
19349
|
+
const callId = text2(update.toolCallId);
|
|
19228
19350
|
if (!callId || this.#finished.has(`tool-${callId}`))
|
|
19229
19351
|
return;
|
|
19230
19352
|
const previous = this.#tools.get(callId) ?? {};
|
|
@@ -19237,7 +19359,7 @@ var CodeBuddyTurnOutput = class {
|
|
|
19237
19359
|
const terminal = update.status === "completed" || update.status === "failed";
|
|
19238
19360
|
if (!terminal && !record3(merged._meta)["codebuddy.ai/toolArgumentsComplete"])
|
|
19239
19361
|
return;
|
|
19240
|
-
const name =
|
|
19362
|
+
const name = text2(record3(merged._meta)["codebuddy.ai/toolName"]) || text2(merged.title) || `${this.profile.displayName} tool`;
|
|
19241
19363
|
const id2 = `tool-${callId}`;
|
|
19242
19364
|
let item = this.#items.get(id2)?.item;
|
|
19243
19365
|
if (!item) {
|
|
@@ -19275,7 +19397,7 @@ var CodeBuddyTurnOutput = class {
|
|
|
19275
19397
|
for (const diff of rows(merged.content)) {
|
|
19276
19398
|
if (diff.type !== "diff" || typeof diff.path !== "string" || typeof diff.newText !== "string")
|
|
19277
19399
|
continue;
|
|
19278
|
-
const unifiedDiff = createTwoFilesPatch(diff.path, diff.path,
|
|
19400
|
+
const unifiedDiff = createTwoFilesPatch(diff.path, diff.path, text2(diff.oldText), diff.newText);
|
|
19279
19401
|
if (unifiedDiff.length > OUTPUT_LIMIT)
|
|
19280
19402
|
continue;
|
|
19281
19403
|
changes.push({
|
|
@@ -19316,26 +19438,26 @@ var CodeBuddyTurnOutput = class {
|
|
|
19316
19438
|
var validCodeBuddyChildId = (id2) => /^agent-[a-zA-Z0-9_-]{1,100}$/u.test(id2);
|
|
19317
19439
|
function codeBuddyChildId(value) {
|
|
19318
19440
|
const row = record3(value);
|
|
19319
|
-
const structured =
|
|
19441
|
+
const structured = text2(record3(record3(record3(row.providerData).toolResult).subAgent).sessionId);
|
|
19320
19442
|
const body = contentText(row.rawOutput ?? row.output);
|
|
19321
19443
|
const id2 = structured || /\[Agent ID: (agent-[a-zA-Z0-9_-]+)\]\s*$/u.exec(body)?.[1];
|
|
19322
19444
|
return id2 && validCodeBuddyChildId(id2) ? id2 : void 0;
|
|
19323
19445
|
}
|
|
19324
|
-
function codeBuddyDelegation(callId,
|
|
19325
|
-
const args = record3(
|
|
19326
|
-
const resumed =
|
|
19446
|
+
function codeBuddyDelegation(callId, input2, status, childId, displayName = "CodeBuddy") {
|
|
19447
|
+
const args = record3(input2);
|
|
19448
|
+
const resumed = text2(args.resume);
|
|
19327
19449
|
const nativeId = childId ?? (validCodeBuddyChildId(resumed) ? resumed : void 0);
|
|
19328
19450
|
return {
|
|
19329
19451
|
type: "subagentDelegation",
|
|
19330
19452
|
itemId: hostItemIdSchema.parse(`tool-${callId}`),
|
|
19331
19453
|
operation: resumed ? "send" : "spawn",
|
|
19332
|
-
...
|
|
19454
|
+
...text2(args.prompt) ? { prompt: text2(args.prompt) } : {},
|
|
19333
19455
|
subagents: [
|
|
19334
19456
|
{
|
|
19335
19457
|
subagentId: nativeId ?? callId,
|
|
19336
19458
|
...nativeId ? { nativeSubagentId: nativeId } : {},
|
|
19337
|
-
description:
|
|
19338
|
-
...
|
|
19459
|
+
description: text2(args.description) || `${displayName} Subagent`,
|
|
19460
|
+
...text2(args.subagent_type) ? { role: text2(args.subagent_type) } : {},
|
|
19339
19461
|
...subagentConfiguration(args),
|
|
19340
19462
|
background: args.run_in_background === true,
|
|
19341
19463
|
status
|
|
@@ -19438,7 +19560,7 @@ async function matchesAnyHistoricalCwd(value, candidates) {
|
|
|
19438
19560
|
if (await sameCwd(value, candidate))
|
|
19439
19561
|
return true;
|
|
19440
19562
|
} catch (error51) {
|
|
19441
|
-
if (!(error51 instanceof CodeBuddyError) && !["ENOENT", "ENOTDIR"].includes(
|
|
19563
|
+
if (!(error51 instanceof CodeBuddyError) && !["ENOENT", "ENOTDIR"].includes(text2(record3(error51).code)))
|
|
19442
19564
|
throw error51;
|
|
19443
19565
|
}
|
|
19444
19566
|
}
|
|
@@ -19497,12 +19619,12 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
|
|
|
19497
19619
|
const checkedDirectories = /* @__PURE__ */ new Set();
|
|
19498
19620
|
const inheritedRows = /* @__PURE__ */ new Map();
|
|
19499
19621
|
for (const row of transaction?.inheritedContents ? parseRows(transaction.inheritedContents) : []) {
|
|
19500
|
-
const id2 =
|
|
19622
|
+
const id2 = text2(row.id);
|
|
19501
19623
|
const candidates2 = inheritedRows.get(id2) ?? [];
|
|
19502
19624
|
candidates2.push(row);
|
|
19503
19625
|
inheritedRows.set(id2, candidates2);
|
|
19504
19626
|
}
|
|
19505
|
-
const inherited = (row) => inheritedRows.get(
|
|
19627
|
+
const inherited = (row) => inheritedRows.get(text2(row.id))?.some((candidate) => isDeepStrictEqual(candidate, row)) === true;
|
|
19506
19628
|
if (transaction) {
|
|
19507
19629
|
for (const row of parsed.rows) {
|
|
19508
19630
|
if (inherited(row)) {
|
|
@@ -19525,7 +19647,7 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
|
|
|
19525
19647
|
const active2 = nativeHistoryRows(parsed.contents);
|
|
19526
19648
|
if (provenance.inheritedPrefixRows > active2.length || nativeRowsDigest(active2.slice(0, provenance.inheritedPrefixRows)) !== provenance.inheritedPrefixSha256)
|
|
19527
19649
|
throw new CodeBuddyError("protocolError", "Derived Native Session prefix verification failed");
|
|
19528
|
-
const marker = parsed.rows.find((row) =>
|
|
19650
|
+
const marker = parsed.rows.find((row) => text2(row.id) === provenance.bindingMarkerId);
|
|
19529
19651
|
if (!marker || marker.sessionId !== ref.nativeSessionId || typeof marker.cwd !== "string" || !await sameCwd(marker.cwd, cwd))
|
|
19530
19652
|
throw new CodeBuddyError("protocolError", "Derived Native Session target marker is missing");
|
|
19531
19653
|
checkedDirectories.add(cwd);
|
|
@@ -19593,8 +19715,8 @@ var NATIVE_MESSAGE_TYPES = /* @__PURE__ */ new Set([
|
|
|
19593
19715
|
"function_call_result"
|
|
19594
19716
|
]);
|
|
19595
19717
|
function pendingNativeHistoryRewind(contents) {
|
|
19596
|
-
const last = parseRows(contents).findLast((row) => row.type === "resend-fork-notice" || NATIVE_MESSAGE_TYPES.has(
|
|
19597
|
-
return last?.type === "resend-fork-notice" ? { forkPointId:
|
|
19718
|
+
const last = parseRows(contents).findLast((row) => row.type === "resend-fork-notice" || NATIVE_MESSAGE_TYPES.has(text2(row.type)));
|
|
19719
|
+
return last?.type === "resend-fork-notice" ? { forkPointId: text2(last.parentId) || null } : void 0;
|
|
19598
19720
|
}
|
|
19599
19721
|
function isNativeCompactionSummary(row) {
|
|
19600
19722
|
const data = record3(row.providerData);
|
|
@@ -19611,15 +19733,15 @@ function collectNativeHistoryRows(contents, followCompactionParent) {
|
|
|
19611
19733
|
let leaf = "";
|
|
19612
19734
|
for (const row of parseRows(contents)) {
|
|
19613
19735
|
if (row.type === "resend-fork-notice") {
|
|
19614
|
-
leaf =
|
|
19736
|
+
leaf = text2(row.parentId);
|
|
19615
19737
|
continue;
|
|
19616
19738
|
}
|
|
19617
|
-
if (!NATIVE_MESSAGE_TYPES.has(
|
|
19739
|
+
if (!NATIVE_MESSAGE_TYPES.has(text2(row.type)))
|
|
19618
19740
|
continue;
|
|
19619
|
-
if (!
|
|
19741
|
+
if (!text2(row.id))
|
|
19620
19742
|
throw new CodeBuddyError("protocolError", "Native message is missing its stable ID");
|
|
19621
|
-
entries.set(
|
|
19622
|
-
leaf =
|
|
19743
|
+
entries.set(text2(row.id), row);
|
|
19744
|
+
leaf = text2(row.id);
|
|
19623
19745
|
}
|
|
19624
19746
|
const chain = [], seen = /* @__PURE__ */ new Set();
|
|
19625
19747
|
while (leaf) {
|
|
@@ -19630,9 +19752,9 @@ function collectNativeHistoryRows(contents, followCompactionParent) {
|
|
|
19630
19752
|
if (!row)
|
|
19631
19753
|
throw new CodeBuddyError("protocolError", "Native history parent is missing");
|
|
19632
19754
|
chain.push(row);
|
|
19633
|
-
leaf =
|
|
19755
|
+
leaf = text2(row.parentId);
|
|
19634
19756
|
if (!leaf && followCompactionParent && isNativeCompactionSummary(row)) {
|
|
19635
|
-
const logicalParent =
|
|
19757
|
+
const logicalParent = text2(row.logicalParentId);
|
|
19636
19758
|
if (logicalParent && !entries.has(logicalParent))
|
|
19637
19759
|
throw new CodeBuddyError("protocolError", "Native compaction parent is missing");
|
|
19638
19760
|
leaf = logicalParent;
|
|
@@ -19674,7 +19796,7 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
19674
19796
|
for (const row of history) {
|
|
19675
19797
|
const data = record3(row.providerData);
|
|
19676
19798
|
if (row.type === "message" && row.role === "user")
|
|
19677
|
-
compactUser = data.agent === "compact" ?
|
|
19799
|
+
compactUser = data.agent === "compact" ? text2(row.id) : void 0;
|
|
19678
19800
|
if (compactUser && row.role === "assistant" && data.compactType === "user-command")
|
|
19679
19801
|
manualCompactions.add(compactUser);
|
|
19680
19802
|
}
|
|
@@ -19688,7 +19810,7 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
19688
19810
|
current.items.push({
|
|
19689
19811
|
item: {
|
|
19690
19812
|
type: "agentMessage",
|
|
19691
|
-
itemId: hostItemIdSchema.parse(`agentMessage-${
|
|
19813
|
+
itemId: hostItemIdSchema.parse(`agentMessage-${text2(row.id)}`),
|
|
19692
19814
|
text: localOutput[1] ?? ""
|
|
19693
19815
|
},
|
|
19694
19816
|
outcome: { status: "succeeded" }
|
|
@@ -19699,7 +19821,7 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
19699
19821
|
}
|
|
19700
19822
|
if (supportsNativeCommands && data.skipRun === true && body.startsWith('<system-reminder data-role="command-caveat">'))
|
|
19701
19823
|
continue;
|
|
19702
|
-
if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(
|
|
19824
|
+
if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(text2(row.id)))
|
|
19703
19825
|
continue;
|
|
19704
19826
|
if (row.type === "message" && row.role === "user" && data.startsNewUserRequest === false && !localCommand && data.agent !== "compact" && !isNativeCompactionSummary(row)) {
|
|
19705
19827
|
const contextOnly = body.trim().length > 0 && body.replace(/<system-reminder\b[^>]*\sdata-role=(["'])user-context\1[^>]*>[\s\S]*?<\/system-reminder>/gu, "").trim().length === 0;
|
|
@@ -19720,7 +19842,7 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
19720
19842
|
current.items.push({
|
|
19721
19843
|
item: {
|
|
19722
19844
|
type: "contextCompaction",
|
|
19723
|
-
itemId: hostItemIdSchema.parse(`compact-${
|
|
19845
|
+
itemId: hostItemIdSchema.parse(`compact-${text2(row.id)}`)
|
|
19724
19846
|
},
|
|
19725
19847
|
outcome
|
|
19726
19848
|
});
|
|
@@ -19761,7 +19883,7 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
19761
19883
|
current.items.push({
|
|
19762
19884
|
item: {
|
|
19763
19885
|
type: "contextCompaction",
|
|
19764
|
-
itemId: hostItemIdSchema.parse(`compact-${
|
|
19886
|
+
itemId: hostItemIdSchema.parse(`compact-${text2(row.id)}`)
|
|
19765
19887
|
},
|
|
19766
19888
|
outcome
|
|
19767
19889
|
});
|
|
@@ -19770,7 +19892,7 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
19770
19892
|
}
|
|
19771
19893
|
continue;
|
|
19772
19894
|
}
|
|
19773
|
-
const model2 =
|
|
19895
|
+
const model2 = text2(record3(row.providerData).model);
|
|
19774
19896
|
if (model2)
|
|
19775
19897
|
current.model = modelRef(model2);
|
|
19776
19898
|
if (row.type === "message" && row.role === "assistant" || row.type === "reasoning") {
|
|
@@ -19778,7 +19900,7 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
19778
19900
|
const body2 = contentText(row.content) || contentText(row.rawContent);
|
|
19779
19901
|
if (body2)
|
|
19780
19902
|
current.items.push({
|
|
19781
|
-
item: { type, itemId: hostItemIdSchema.parse(`${type}-${
|
|
19903
|
+
item: { type, itemId: hostItemIdSchema.parse(`${type}-${text2(row.id)}`), text: body2 },
|
|
19782
19904
|
outcome: { status: "succeeded" }
|
|
19783
19905
|
});
|
|
19784
19906
|
if (row.role === "assistant" && row.status === "completed") {
|
|
@@ -19789,17 +19911,17 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
19789
19911
|
} else if (row.type === "function_call") {
|
|
19790
19912
|
if (row.status === "incomplete" && data.isPartialAborted === true && data.discard === true)
|
|
19791
19913
|
continue;
|
|
19792
|
-
let
|
|
19793
|
-
if (typeof
|
|
19914
|
+
let input2 = row.arguments;
|
|
19915
|
+
if (typeof input2 === "string") {
|
|
19794
19916
|
try {
|
|
19795
|
-
|
|
19917
|
+
input2 = JSON.parse(input2);
|
|
19796
19918
|
} catch {
|
|
19797
19919
|
throw new CodeBuddyError("protocolError", "Invalid native Tool arguments");
|
|
19798
19920
|
}
|
|
19799
19921
|
}
|
|
19800
|
-
const callId =
|
|
19922
|
+
const callId = text2(row.callId);
|
|
19801
19923
|
const snapshot = {
|
|
19802
|
-
item: row.name === "Agent" ? codeBuddyDelegation(callId,
|
|
19924
|
+
item: row.name === "Agent" ? codeBuddyDelegation(callId, input2, "running", void 0, profile.displayName) : toolItem(callId, text2(row.name), input2, typeof row.cwd === "string" ? row.cwd : cwd),
|
|
19803
19925
|
outcome: toolOutcome("unknown", profile)
|
|
19804
19926
|
};
|
|
19805
19927
|
tools.set(callId, snapshot);
|
|
@@ -19811,7 +19933,7 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
19811
19933
|
applyResult(snapshot, early);
|
|
19812
19934
|
}
|
|
19813
19935
|
} else if (row.type === "function_call_result") {
|
|
19814
|
-
const callId =
|
|
19936
|
+
const callId = text2(row.callId);
|
|
19815
19937
|
const snapshot = tools.get(callId);
|
|
19816
19938
|
if (snapshot)
|
|
19817
19939
|
applyResult(snapshot, row);
|
|
@@ -19835,13 +19957,13 @@ function usageCount(value) {
|
|
|
19835
19957
|
function historyUsageRequests(contents, historical) {
|
|
19836
19958
|
const usages = /* @__PURE__ */ new Map();
|
|
19837
19959
|
for (const row of nativeRawHistoryRows(contents)) {
|
|
19838
|
-
if (!NATIVE_MESSAGE_TYPES.has(
|
|
19960
|
+
if (!NATIVE_MESSAGE_TYPES.has(text2(row.type)))
|
|
19839
19961
|
continue;
|
|
19840
19962
|
const data = record3(row.providerData);
|
|
19841
19963
|
if (data.isSubAgent === true || !Object.keys(record3(data.rawUsage)).length)
|
|
19842
19964
|
continue;
|
|
19843
|
-
if (
|
|
19844
|
-
usages.set(
|
|
19965
|
+
if (text2(data.messageId))
|
|
19966
|
+
usages.set(text2(data.messageId), data);
|
|
19845
19967
|
}
|
|
19846
19968
|
const requests = [];
|
|
19847
19969
|
let complete = true;
|
|
@@ -19856,14 +19978,14 @@ function historyUsageRequests(contents, historical) {
|
|
|
19856
19978
|
}
|
|
19857
19979
|
function providerUsageRequest(requestId, data, historical) {
|
|
19858
19980
|
const usage = record3(data.rawUsage);
|
|
19859
|
-
const model2 =
|
|
19860
|
-
const
|
|
19981
|
+
const model2 = text2(data.model) || text2(data.requestModelId);
|
|
19982
|
+
const input2 = usageCount(usage.prompt_tokens);
|
|
19861
19983
|
const output = usageCount(usage.completion_tokens);
|
|
19862
19984
|
const cached2 = usageCount(record3(usage.prompt_tokens_details).cached_tokens ?? 0);
|
|
19863
19985
|
const written = usageCount(usage.prompt_cache_write_tokens ?? 0);
|
|
19864
19986
|
const thinking = usageCount(usage.completion_thinking_tokens);
|
|
19865
19987
|
const unverifiedCache = [usage.cache_read_input_tokens, usage.cache_creation_input_tokens].some((value) => value !== void 0 && value !== 0);
|
|
19866
|
-
if (!model2 ||
|
|
19988
|
+
if (!model2 || input2 === null || output === null || cached2 === null || written === null || unverifiedCache) {
|
|
19867
19989
|
return null;
|
|
19868
19990
|
}
|
|
19869
19991
|
try {
|
|
@@ -19871,7 +19993,7 @@ function providerUsageRequest(requestId, data, historical) {
|
|
|
19871
19993
|
requestId,
|
|
19872
19994
|
...historical ? { historical: true } : {},
|
|
19873
19995
|
model: model2,
|
|
19874
|
-
inputTokens:
|
|
19996
|
+
inputTokens: input2,
|
|
19875
19997
|
cachedInputTokens: cached2,
|
|
19876
19998
|
cacheWriteInputTokens: written,
|
|
19877
19999
|
outputTokens: output,
|
|
@@ -19885,8 +20007,8 @@ function historyUsage(contents) {
|
|
|
19885
20007
|
const requests = /* @__PURE__ */ new Map();
|
|
19886
20008
|
for (const row of nativeHistoryRows(contents)) {
|
|
19887
20009
|
const data = record3(row.providerData), usage = record3(data.rawUsage);
|
|
19888
|
-
if (Object.keys(usage).length &&
|
|
19889
|
-
requests.set(
|
|
20010
|
+
if (Object.keys(usage).length && text2(data.messageId))
|
|
20011
|
+
requests.set(text2(data.messageId), usage);
|
|
19890
20012
|
}
|
|
19891
20013
|
if (!requests.size)
|
|
19892
20014
|
return null;
|
|
@@ -19901,10 +20023,10 @@ function historyUsage(contents) {
|
|
|
19901
20023
|
};
|
|
19902
20024
|
const result = {};
|
|
19903
20025
|
const latest = [...requests.values()].at(-1);
|
|
19904
|
-
const
|
|
20026
|
+
const input2 = usageCount(latest?.prompt_tokens);
|
|
19905
20027
|
const cached2 = usageCount(record3(latest?.prompt_tokens_details).cached_tokens);
|
|
19906
|
-
if (
|
|
19907
|
-
result.cacheHitRatePercent = cached2 /
|
|
20028
|
+
if (input2 !== null && input2 > 0 && cached2 !== null && cached2 <= input2)
|
|
20029
|
+
result.cacheHitRatePercent = cached2 / input2 * 100;
|
|
19908
20030
|
for (const [host, native] of Object.entries(fields)) {
|
|
19909
20031
|
const values = [...requests.values()].map((usage) => native(usage));
|
|
19910
20032
|
if (values.every((value) => typeof value === "number" && Number.isFinite(value) && value >= 0)) {
|
|
@@ -22671,7 +22793,7 @@ var LineBuffer = class {
|
|
|
22671
22793
|
};
|
|
22672
22794
|
|
|
22673
22795
|
// ../../../node_modules/@agentclientprotocol/sdk/dist/stream.js
|
|
22674
|
-
function ndJsonStream(output,
|
|
22796
|
+
function ndJsonStream(output, input2) {
|
|
22675
22797
|
const textEncoder = new TextEncoder();
|
|
22676
22798
|
const textDecoder = new TextDecoder();
|
|
22677
22799
|
let cancelled = false;
|
|
@@ -22694,7 +22816,7 @@ function ndJsonStream(output, input) {
|
|
|
22694
22816
|
}
|
|
22695
22817
|
}
|
|
22696
22818
|
};
|
|
22697
|
-
const reader =
|
|
22819
|
+
const reader = input2.getReader();
|
|
22698
22820
|
inputReader = reader;
|
|
22699
22821
|
try {
|
|
22700
22822
|
while (true) {
|
|
@@ -22777,8 +22899,8 @@ var zGuardCreateElicitationResponseCancel = object({
|
|
|
22777
22899
|
});
|
|
22778
22900
|
|
|
22779
22901
|
// ../../../node_modules/@agentclientprotocol/sdk/dist/acp.js
|
|
22780
|
-
function ndJsonStream2(output,
|
|
22781
|
-
return ndJsonStream(output,
|
|
22902
|
+
function ndJsonStream2(output, input2) {
|
|
22903
|
+
return ndJsonStream(output, input2);
|
|
22782
22904
|
}
|
|
22783
22905
|
function emptyObjectResponse(response) {
|
|
22784
22906
|
return response ?? {};
|
|
@@ -24321,8 +24443,8 @@ var CodeBuddyAcpClient = class {
|
|
|
24321
24443
|
async configure(sessionId, configId, value) {
|
|
24322
24444
|
return record3(await this.#request(() => this.#connection.setSessionConfigOption({ sessionId, configId, value }), "ACP configuration"));
|
|
24323
24445
|
}
|
|
24324
|
-
async prompt(sessionId,
|
|
24325
|
-
return record3(await this.#request(() => this.#connection.prompt({ sessionId, prompt: [{ type: "text", text:
|
|
24446
|
+
async prompt(sessionId, input2) {
|
|
24447
|
+
return record3(await this.#request(() => this.#connection.prompt({ sessionId, prompt: [{ type: "text", text: input2 }] })));
|
|
24326
24448
|
}
|
|
24327
24449
|
async cancel(sessionId) {
|
|
24328
24450
|
await this.#request(() => this.#connection.cancel({ sessionId }), "ACP cancel");
|
|
@@ -24421,7 +24543,7 @@ function inheritedChildren(parent) {
|
|
|
24421
24543
|
const historicalCwds = child.historicalCwds;
|
|
24422
24544
|
const recordedCwds = child.recordedCwds;
|
|
24423
24545
|
const workspaceBindings = child.workspaceBindings;
|
|
24424
|
-
if (!validCodeBuddyChildId(
|
|
24546
|
+
if (!validCodeBuddyChildId(text2(child.childId)) || !/^[A-Za-z0-9][A-Za-z0-9_-]{0,199}$/u.test(text2(child.nativeSessionId)) || !Number.isSafeInteger(child.inheritedBytes) || Number(child.inheritedBytes) < 0 || Number(child.inheritedBytes) > CODEBUDDY_CHILD_MAX_BYTES || !Number.isSafeInteger(child.inheritedRows) || Number(child.inheritedRows) < 0 || typeof child.inheritedSha256 !== "string" || !/^[a-f0-9]{64}$/u.test(child.inheritedSha256) || !Array.isArray(historicalCwds) || historicalCwds.length > 256 || historicalCwds.some((cwd) => typeof cwd !== "string" || !cwd) || !Array.isArray(recordedCwds) || recordedCwds.length > 256 || recordedCwds.some((cwd) => typeof cwd !== "string" || !cwd) || !Array.isArray(workspaceBindings) || workspaceBindings.length > 256)
|
|
24425
24547
|
throw new CodeBuddyError("protocolError", "Inherited Subagent provenance is invalid");
|
|
24426
24548
|
const bindings = workspaceBindings.map((candidate2) => {
|
|
24427
24549
|
const binding = record3(candidate2);
|
|
@@ -24436,13 +24558,13 @@ function inheritedChildren(parent) {
|
|
|
24436
24558
|
const boundCanonical = new Set(bindings.map((binding) => binding.canonicalCwd));
|
|
24437
24559
|
if (boundRecorded.size !== bindings.length || new Set(recordedCwds).size !== recordedCwds.length || boundRecorded.size !== new Set(recordedCwds).size || recordedCwds.some((cwd) => !boundRecorded.has(cwd)) || new Set(historicalCwds).size !== historicalCwds.length || boundCanonical.size !== new Set(historicalCwds).size || historicalCwds.some((cwd) => !boundCanonical.has(cwd)))
|
|
24438
24560
|
throw new CodeBuddyError("protocolError", "Inherited Subagent provenance is inconsistent");
|
|
24439
|
-
const childId =
|
|
24561
|
+
const childId = text2(child.childId);
|
|
24440
24562
|
if (seen.has(childId))
|
|
24441
24563
|
throw new CodeBuddyError("protocolError", "Inherited Subagent provenance is ambiguous");
|
|
24442
24564
|
seen.add(childId);
|
|
24443
24565
|
return {
|
|
24444
24566
|
childId,
|
|
24445
|
-
nativeSessionId:
|
|
24567
|
+
nativeSessionId: text2(child.nativeSessionId),
|
|
24446
24568
|
inheritedBytes: Number(child.inheritedBytes),
|
|
24447
24569
|
inheritedRows: Number(child.inheritedRows),
|
|
24448
24570
|
inheritedSha256: child.inheritedSha256,
|
|
@@ -24471,7 +24593,7 @@ async function validateCodeBuddyChildContents(contents, parent, childId, cwd, to
|
|
|
24471
24593
|
if (!validCodeBuddyChildId(childId))
|
|
24472
24594
|
throw new CodeBuddyError("invalidRequest", "Invalid native Subagent ID");
|
|
24473
24595
|
const parsed = parseCodeBuddyChild(contents, tolerateIncompleteTail);
|
|
24474
|
-
const sessions = new Set(parsed.entries.map((row) =>
|
|
24596
|
+
const sessions = new Set(parsed.entries.map((row) => text2(row.sessionId)).filter(Boolean));
|
|
24475
24597
|
if (sessions.size !== 1)
|
|
24476
24598
|
throw new CodeBuddyError("protocolError", "Subagent transcript identity is missing or mixed");
|
|
24477
24599
|
const nativeSessionId = [...sessions][0];
|
|
@@ -24564,7 +24686,7 @@ async function codeBuddyChildPrefixThrough(contents, lastId, child) {
|
|
|
24564
24686
|
const row = child.entries[rowIndex++];
|
|
24565
24687
|
if (!row)
|
|
24566
24688
|
throw new CodeBuddyError("protocolError", "Subagent transcript rows changed");
|
|
24567
|
-
if (
|
|
24689
|
+
if (text2(row.id) === lastId) {
|
|
24568
24690
|
if (match >= 0)
|
|
24569
24691
|
throw new CodeBuddyError("protocolError", "Agent result has an ambiguous child range");
|
|
24570
24692
|
match = rowIndex - 1;
|
|
@@ -24696,32 +24818,32 @@ function withoutIdentity(row) {
|
|
|
24696
24818
|
function assertCopiedPrefix(source, copied) {
|
|
24697
24819
|
if (copied.length < source.length)
|
|
24698
24820
|
throw new CodeBuddyError("unsupported", "Native Fork omitted history");
|
|
24699
|
-
const ids = new Map(source.map((row, index) => [
|
|
24821
|
+
const ids = new Map(source.map((row, index) => [text2(row.id), text2(copied[index]?.id)]));
|
|
24700
24822
|
for (const [index, row] of source.entries()) {
|
|
24701
24823
|
const clone2 = copied[index];
|
|
24702
24824
|
if (!clone2)
|
|
24703
24825
|
throw new CodeBuddyError("unsupported", "Native Fork omitted history");
|
|
24704
|
-
if (!isDeepStrictEqual3(withoutIdentity(row), withoutIdentity(clone2)) || ["parentId", "logicalParentId"].some((key) =>
|
|
24826
|
+
if (!isDeepStrictEqual3(withoutIdentity(row), withoutIdentity(clone2)) || ["parentId", "logicalParentId"].some((key) => text2(clone2[key]) !== (ids.get(text2(row[key])) ?? "")))
|
|
24705
24827
|
throw new CodeBuddyError("unsupported", "Native Fork did not preserve the exact history prefix");
|
|
24706
24828
|
}
|
|
24707
24829
|
}
|
|
24708
24830
|
function commandCaveat(row) {
|
|
24709
24831
|
return record3(row?.providerData).skipRun === true && JSON.stringify(row?.content).includes('data-role=\\"command-caveat\\"');
|
|
24710
24832
|
}
|
|
24711
|
-
function retainedRowCount(
|
|
24833
|
+
function retainedRowCount(input2, contents, sourceCwd = input2.cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
24712
24834
|
const rows2 = nativeHistoryRows(contents);
|
|
24713
|
-
const turns = snapshotFromHistory(contents,
|
|
24835
|
+
const turns = snapshotFromHistory(contents, input2.sourceRef, sourceCwd, profile, {
|
|
24714
24836
|
includeCompactionHistory: false
|
|
24715
24837
|
}).turns;
|
|
24716
24838
|
let excluded2;
|
|
24717
|
-
if (
|
|
24839
|
+
if (input2.kind === "rollbackLastTurn") {
|
|
24718
24840
|
if (!turns.length)
|
|
24719
24841
|
throw new CodeBuddyError("invalidState", "Native Session has no Turn to revise");
|
|
24720
24842
|
excluded2 = turns.at(-1)?.nativeTurnRef.nativeTurnKey;
|
|
24721
24843
|
} else {
|
|
24722
|
-
const checkpoint =
|
|
24844
|
+
const checkpoint = input2.checkpoint;
|
|
24723
24845
|
const index = turns.findIndex((turn) => turn.nativeTurnRef.nativeTurnKey === checkpoint.checkpointId);
|
|
24724
|
-
if (checkpoint.harnessId !== profile.harnessId || checkpoint.nativeSessionId !==
|
|
24846
|
+
if (checkpoint.harnessId !== profile.harnessId || checkpoint.nativeSessionId !== input2.sourceRef.nativeSessionId || checkpoint.formatVersion !== 1 || index < 0)
|
|
24725
24847
|
throw new CodeBuddyError("checkpointNotFound", "Native Fork checkpoint was not found");
|
|
24726
24848
|
excluded2 = turns[index + 1]?.nativeTurnRef.nativeTurnKey;
|
|
24727
24849
|
}
|
|
@@ -24803,10 +24925,10 @@ function referencedChildren(rows2) {
|
|
|
24803
24925
|
const data = record3(row.providerData);
|
|
24804
24926
|
if (row.status === "incomplete" && data.isPartialAborted === true && data.discard === true)
|
|
24805
24927
|
continue;
|
|
24806
|
-
const callId2 =
|
|
24928
|
+
const callId2 = text2(row.callId);
|
|
24807
24929
|
if (!callId2 || calls.has(callId2))
|
|
24808
24930
|
throw new CodeBuddyError("protocolError", "Agent delegation identity is ambiguous");
|
|
24809
|
-
const resumed2 =
|
|
24931
|
+
const resumed2 = text2(argumentsRecord(row.arguments).resume);
|
|
24810
24932
|
if (resumed2 && !validCodeBuddyChildId(resumed2))
|
|
24811
24933
|
throw new CodeBuddyError("protocolError", "Agent delegation has an invalid child identity");
|
|
24812
24934
|
calls.set(callId2, resumed2 || void 0);
|
|
@@ -24814,18 +24936,18 @@ function referencedChildren(rows2) {
|
|
|
24814
24936
|
}
|
|
24815
24937
|
if (row.type !== "function_call_result")
|
|
24816
24938
|
continue;
|
|
24817
|
-
const callId =
|
|
24939
|
+
const callId = text2(row.callId);
|
|
24818
24940
|
if (!calls.has(callId))
|
|
24819
24941
|
continue;
|
|
24820
24942
|
const subagent = record3(record3(record3(row.providerData).toolResult).subAgent);
|
|
24821
|
-
const childId =
|
|
24943
|
+
const childId = text2(subagent.sessionId);
|
|
24822
24944
|
if (!validCodeBuddyChildId(childId))
|
|
24823
24945
|
throw new CodeBuddyError("unsupported", "Retained Agent result has no verified native child identity");
|
|
24824
24946
|
const resumed = calls.get(callId);
|
|
24825
24947
|
if (resumed && resumed !== childId)
|
|
24826
24948
|
throw new CodeBuddyError("protocolError", "Agent result changed its child identity");
|
|
24827
|
-
const lastId =
|
|
24828
|
-
const afterId =
|
|
24949
|
+
const lastId = text2(subagent.lastId);
|
|
24950
|
+
const afterId = text2(subagent.afterId);
|
|
24829
24951
|
if (!lastId)
|
|
24830
24952
|
throw new CodeBuddyError("unsupported", "Retained Agent result has no bounded child transcript range");
|
|
24831
24953
|
const child = children.get(childId) ?? { childId, ranges: [] };
|
|
@@ -24842,7 +24964,7 @@ function referencedChildren(rows2) {
|
|
|
24842
24964
|
function assertChildRanges(rows2, child) {
|
|
24843
24965
|
const positions = /* @__PURE__ */ new Map();
|
|
24844
24966
|
for (const [index, row] of rows2.entries()) {
|
|
24845
|
-
const id2 =
|
|
24967
|
+
const id2 = text2(row.id);
|
|
24846
24968
|
if (!id2)
|
|
24847
24969
|
continue;
|
|
24848
24970
|
const matches = positions.get(id2) ?? [];
|
|
@@ -24968,13 +25090,13 @@ async function copyInheritedChildren(options) {
|
|
|
24968
25090
|
}
|
|
24969
25091
|
}
|
|
24970
25092
|
async function deriveCodeBuddySession(options) {
|
|
24971
|
-
const { input, environment, factory, signal } = options;
|
|
24972
|
-
const sourceCwd = options.sourceCwd ??
|
|
25093
|
+
const { input: input2, environment, factory, signal } = options;
|
|
25094
|
+
const sourceCwd = options.sourceCwd ?? input2.cwd;
|
|
24973
25095
|
const profile = options.profile ?? CODEBUDDY_RUNTIME_PROFILE;
|
|
24974
25096
|
const strictHistoryBinding = profile.historyCapabilities?.forkAcrossCwd === true;
|
|
24975
|
-
validateNativeRef(
|
|
24976
|
-
const source = await codeBuddyNativeHistory(sourceCwd,
|
|
24977
|
-
const retained = retainedRowCount(
|
|
25097
|
+
validateNativeRef(input2.sourceRef, profile);
|
|
25098
|
+
const source = await codeBuddyNativeHistory(sourceCwd, input2.sourceRef, environment, profile);
|
|
25099
|
+
const retained = retainedRowCount(input2, source.contents, sourceCwd, profile);
|
|
24978
25100
|
const sourceRows = nativeHistoryRows(source.contents);
|
|
24979
25101
|
const childReferences = referencedChildren(sourceRows.slice(0, retained));
|
|
24980
25102
|
const temporary = nativeSessionRefSchema.parse({
|
|
@@ -24982,18 +25104,18 @@ async function deriveCodeBuddySession(options) {
|
|
|
24982
25104
|
nativeSessionId: randomUUID2(),
|
|
24983
25105
|
formatVersion: 1
|
|
24984
25106
|
});
|
|
24985
|
-
await (options.copy ?? copyCodeBuddySession)(sourceCwd,
|
|
25107
|
+
await (options.copy ?? copyCodeBuddySession)(sourceCwd, input2.sourceRef.nativeSessionId, temporary.nativeSessionId, environment, signal, options.invocationFactory ?? codeBuddyInvocation);
|
|
24986
25108
|
const nativeCopy = await codeBuddyNativeHistory(sourceCwd, temporary, environment, profile, {
|
|
24987
25109
|
...strictHistoryBinding ? { requirePrimary: true } : {},
|
|
24988
25110
|
inheritedContents: source.contents
|
|
24989
25111
|
});
|
|
24990
25112
|
if (!isDeepStrictEqual3(nativeHistoryRows(nativeCopy.contents), sourceRows))
|
|
24991
25113
|
throw new CodeBuddyError("unsupported", "Native history copy changed the source prefix");
|
|
24992
|
-
const bridge = strictHistoryBinding ? await bridgeCopyToTarget(sourceCwd,
|
|
25114
|
+
const bridge = strictHistoryBinding ? await bridgeCopyToTarget(sourceCwd, input2.cwd, temporary, nativeCopy.contents, environment, profile) : void 0;
|
|
24993
25115
|
if (strictHistoryBinding) {
|
|
24994
25116
|
let targetCopy;
|
|
24995
25117
|
try {
|
|
24996
|
-
targetCopy = await codeBuddyNativeHistory(
|
|
25118
|
+
targetCopy = await codeBuddyNativeHistory(input2.cwd, temporary, environment, profile, {
|
|
24997
25119
|
requirePrimary: true,
|
|
24998
25120
|
inheritedContents: nativeCopy.contents
|
|
24999
25121
|
});
|
|
@@ -25015,7 +25137,7 @@ async function deriveCodeBuddySession(options) {
|
|
|
25015
25137
|
let client2;
|
|
25016
25138
|
try {
|
|
25017
25139
|
client2 = factory({
|
|
25018
|
-
cwd:
|
|
25140
|
+
cwd: input2.cwd,
|
|
25019
25141
|
environment,
|
|
25020
25142
|
ephemeral: false,
|
|
25021
25143
|
temporarySessionId: temporary.nativeSessionId,
|
|
@@ -25048,7 +25170,7 @@ async function deriveCodeBuddySession(options) {
|
|
|
25048
25170
|
if (signal.aborted)
|
|
25049
25171
|
throw new CodeBuddyError("invalidState", "Adapter closed during Fork");
|
|
25050
25172
|
await client2.initialize();
|
|
25051
|
-
const opened = await client2.open(
|
|
25173
|
+
const opened = await client2.open(input2.cwd, temporary.nativeSessionId);
|
|
25052
25174
|
if (opened.sessionId && opened.sessionId !== temporary.nativeSessionId)
|
|
25053
25175
|
throw new CodeBuddyError("protocolError", "ACP loaded a different temporary Session");
|
|
25054
25176
|
const nativeState = configuration(opened.configOptions, profile).state;
|
|
@@ -25058,7 +25180,7 @@ async function deriveCodeBuddySession(options) {
|
|
|
25058
25180
|
const result = await bounded(client2.prompt(temporary.nativeSessionId, "/fork"), 2e4, "Native Fork", abort);
|
|
25059
25181
|
if (failure2)
|
|
25060
25182
|
throw failure2;
|
|
25061
|
-
if (result.stopReason !== "end_turn" || !derivedId || [
|
|
25183
|
+
if (result.stopReason !== "end_turn" || !derivedId || [input2.sourceRef.nativeSessionId, temporary.nativeSessionId].includes(derivedId))
|
|
25062
25184
|
throw new CodeBuddyError("unsupported", "Native Fork did not report a separate Session");
|
|
25063
25185
|
const preliminaryRef = nativeSessionRefSchema.parse({
|
|
25064
25186
|
harnessId: profile.harnessId,
|
|
@@ -25070,29 +25192,29 @@ async function deriveCodeBuddySession(options) {
|
|
|
25070
25192
|
...sourceRows.flatMap((row) => typeof row.cwd === "string" ? [row.cwd] : []),
|
|
25071
25193
|
...source.historicalCwds,
|
|
25072
25194
|
sourceCwd,
|
|
25073
|
-
|
|
25195
|
+
input2.cwd
|
|
25074
25196
|
])
|
|
25075
25197
|
];
|
|
25076
25198
|
const historyTransaction = strictHistoryBinding ? { requirePrimary: true, allowedHistoricalCwds: historicalCwds } : void 0;
|
|
25077
|
-
const forked = await codeBuddyNativeHistory(
|
|
25199
|
+
const forked = await codeBuddyNativeHistory(input2.cwd, preliminaryRef, environment, profile, historyTransaction);
|
|
25078
25200
|
const forkRows = nativeHistoryRows(forked.contents);
|
|
25079
25201
|
assertCopiedPrefix(sourceRows, forkRows);
|
|
25080
|
-
const marker = strictHistoryBinding ? nativeRawHistoryRows(forked.contents).findLast((row) => Boolean(
|
|
25202
|
+
const marker = strictHistoryBinding ? nativeRawHistoryRows(forked.contents).findLast((row) => Boolean(text2(row.id)) && row.sessionId === derivedId && typeof row.cwd === "string" && sameResolvedPath(row.cwd, input2.cwd)) : void 0;
|
|
25081
25203
|
if (strictHistoryBinding && !marker)
|
|
25082
25204
|
throw new CodeBuddyError("unsupported", "Native Fork did not persist a target binding marker");
|
|
25083
25205
|
if (!client2.rollback)
|
|
25084
25206
|
throw new CodeBuddyError("unsupported", "Native history rewind is unavailable");
|
|
25085
|
-
const point = retained ?
|
|
25207
|
+
const point = retained ? text2(forkRows[retained - 1]?.id) : null;
|
|
25086
25208
|
const rewound = await client2.rollback(derivedId, point);
|
|
25087
25209
|
if (rewound.applied !== true || (rewound.actualForkPointId ?? null) !== point)
|
|
25088
25210
|
throw new CodeBuddyError("nativeFailure", "Native history rewind was not confirmed");
|
|
25089
|
-
const verified = await codeBuddyNativeHistory(
|
|
25211
|
+
const verified = await codeBuddyNativeHistory(input2.cwd, preliminaryRef, environment, profile, historyTransaction);
|
|
25090
25212
|
const finalRows = nativeHistoryRows(verified.contents);
|
|
25091
25213
|
if (!isDeepStrictEqual3(finalRows, forkRows.slice(0, retained)))
|
|
25092
25214
|
throw new CodeBuddyError("nativeFailure", "Native history rewind did not persist the exact prefix");
|
|
25093
25215
|
const inheritedChildren2 = await copyInheritedChildren({
|
|
25094
25216
|
references: childReferences,
|
|
25095
|
-
sourceRef:
|
|
25217
|
+
sourceRef: input2.sourceRef,
|
|
25096
25218
|
sourceCwd,
|
|
25097
25219
|
sourceHistoryFile: source.file,
|
|
25098
25220
|
targetRef: preliminaryRef,
|
|
@@ -25104,33 +25226,33 @@ async function deriveCodeBuddySession(options) {
|
|
|
25104
25226
|
...preliminaryRef,
|
|
25105
25227
|
locator: strictHistoryBinding ? {
|
|
25106
25228
|
codebuddyDerived: 1,
|
|
25107
|
-
boundCwd: codeBuddyCanonicalCwd(
|
|
25108
|
-
targetProjectSlug: codeBuddyProjectSlug(
|
|
25229
|
+
boundCwd: codeBuddyCanonicalCwd(input2.cwd),
|
|
25230
|
+
targetProjectSlug: codeBuddyProjectSlug(input2.cwd, profile),
|
|
25109
25231
|
inheritedPrefixRows: finalRows.length,
|
|
25110
25232
|
inheritedPrefixSha256: nativeRowsDigest(finalRows),
|
|
25111
|
-
bindingMarkerId:
|
|
25233
|
+
bindingMarkerId: text2(marker?.id),
|
|
25112
25234
|
...inheritedChildLocator
|
|
25113
25235
|
} : { codebuddyDerived: 1, ...inheritedChildLocator }
|
|
25114
25236
|
});
|
|
25115
|
-
await codeBuddyNativeHistory(
|
|
25116
|
-
const after = await codeBuddyNativeHistory(sourceCwd,
|
|
25237
|
+
await codeBuddyNativeHistory(input2.cwd, ref, environment, profile);
|
|
25238
|
+
const after = await codeBuddyNativeHistory(sourceCwd, input2.sourceRef, environment, profile);
|
|
25117
25239
|
if (after.contents !== source.contents)
|
|
25118
25240
|
throw new CodeBuddyError("sessionBusy", "Source history changed during Fork");
|
|
25119
25241
|
if (signal.aborted)
|
|
25120
25242
|
throw new CodeBuddyError("invalidState", "Adapter closed during Fork");
|
|
25121
|
-
const saved = record3(record3(
|
|
25243
|
+
const saved = record3(record3(input2.sourceRef.locator).configuration);
|
|
25122
25244
|
const state = options.state ?? {
|
|
25123
25245
|
...nativeState,
|
|
25124
|
-
...
|
|
25246
|
+
...text2(saved.model) ? { effectiveModel: modelRef(text2(saved.model)) } : {}
|
|
25125
25247
|
};
|
|
25126
|
-
const model2 =
|
|
25127
|
-
const thinking =
|
|
25128
|
-
const mode =
|
|
25248
|
+
const model2 = input2.kind === "rollbackLastTurn" && input2.model ? input2.model : state.effectiveModel;
|
|
25249
|
+
const thinking = input2.kind === "rollbackLastTurn" && input2.thinkingOptionId ? input2.thinkingOptionId : options.state?.effectiveThinkingOptionId ?? (text2(saved.thinking) ? harnessThinkingOptionIdSchema.parse(saved.thinking) : state.effectiveThinkingOptionId);
|
|
25250
|
+
const mode = input2.kind === "rollbackLastTurn" && input2.permissionModeId ? input2.permissionModeId : options.state?.effectivePermissionModeId ?? (text2(saved.mode) ? harnessPermissionModeIdSchema.parse(saved.mode) : state.effectivePermissionModeId);
|
|
25129
25251
|
const resume = {
|
|
25130
25252
|
kind: "resume",
|
|
25131
25253
|
nativeRef: ref,
|
|
25132
|
-
cwd:
|
|
25133
|
-
...
|
|
25254
|
+
cwd: input2.cwd,
|
|
25255
|
+
...input2.environment ? { environment: input2.environment } : {},
|
|
25134
25256
|
...model2 ? { model: model2 } : {},
|
|
25135
25257
|
...thinking ? { thinkingOptionId: thinking } : {},
|
|
25136
25258
|
...mode ? { permissionModeId: mode } : {}
|
|
@@ -25234,15 +25356,15 @@ function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_
|
|
|
25234
25356
|
return normalized;
|
|
25235
25357
|
return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
|
|
25236
25358
|
}
|
|
25237
|
-
function sessionImportCandidate(
|
|
25238
|
-
const time3 = typeof
|
|
25359
|
+
function sessionImportCandidate(input2) {
|
|
25360
|
+
const time3 = typeof input2.updatedAt === "number" ? input2.updatedAt : typeof input2.updatedAt === "string" ? Date.parse(input2.updatedAt) : Number.NaN;
|
|
25239
25361
|
const parsed = harnessSessionImportCandidateSchema.safeParse({
|
|
25240
|
-
nativeSessionId:
|
|
25241
|
-
cwd:
|
|
25242
|
-
title: typeof
|
|
25362
|
+
nativeSessionId: input2.nativeSessionId,
|
|
25363
|
+
cwd: input2.cwd,
|
|
25364
|
+
title: typeof input2.title === "string" && input2.title.trim().length > 0 ? input2.title : null,
|
|
25243
25365
|
updatedAt: Math.floor(time3),
|
|
25244
25366
|
// Unknown must stay unknown; only an explicit boolean is a native statement.
|
|
25245
|
-
running: typeof
|
|
25367
|
+
running: typeof input2.running === "boolean" ? input2.running : null
|
|
25246
25368
|
});
|
|
25247
25369
|
return parsed.success ? parsed.data : null;
|
|
25248
25370
|
}
|
|
@@ -25355,10 +25477,10 @@ async function readFacts(file2, signal) {
|
|
|
25355
25477
|
else if (row.type === "ai-title")
|
|
25356
25478
|
generatedTitle = sessionImportTitle(row.aiTitle);
|
|
25357
25479
|
else {
|
|
25358
|
-
const
|
|
25359
|
-
if (
|
|
25480
|
+
const text3 = userText(row);
|
|
25481
|
+
if (text3 !== null) {
|
|
25360
25482
|
hasUser = true;
|
|
25361
|
-
firstPrompt ??= sessionImportTitle(
|
|
25483
|
+
firstPrompt ??= sessionImportTitle(text3);
|
|
25362
25484
|
}
|
|
25363
25485
|
}
|
|
25364
25486
|
}
|
|
@@ -25531,8 +25653,8 @@ var CodeBuddyInteractions = class {
|
|
|
25531
25653
|
this.client = client2;
|
|
25532
25654
|
this.profile = profile;
|
|
25533
25655
|
}
|
|
25534
|
-
#question(turnId,
|
|
25535
|
-
const questions = rows(record3(
|
|
25656
|
+
#question(turnId, input2) {
|
|
25657
|
+
const questions = rows(record3(input2).questions);
|
|
25536
25658
|
if (!questions.length || questions.length > 4)
|
|
25537
25659
|
throw new CodeBuddyError("protocolError", `Invalid ${this.profile.displayName} question count`);
|
|
25538
25660
|
return {
|
|
@@ -25542,16 +25664,16 @@ var CodeBuddyInteractions = class {
|
|
|
25542
25664
|
title: this.profile.displayName,
|
|
25543
25665
|
questions: questions.map((question, index) => {
|
|
25544
25666
|
const options = rows(question.options).map((option) => ({
|
|
25545
|
-
value:
|
|
25546
|
-
label:
|
|
25547
|
-
...option.description ? { description:
|
|
25667
|
+
value: text2(option.label),
|
|
25668
|
+
label: text2(option.label),
|
|
25669
|
+
...option.description ? { description: text2(option.description) } : {}
|
|
25548
25670
|
}));
|
|
25549
|
-
if (!
|
|
25671
|
+
if (!text2(question.question) || !options.length || options.some((option) => !option.value))
|
|
25550
25672
|
throw new CodeBuddyError("protocolError", `Malformed ${this.profile.displayName} question`);
|
|
25551
25673
|
return {
|
|
25552
|
-
id:
|
|
25674
|
+
id: text2(question.id) || `q_${index}`,
|
|
25553
25675
|
type: "choice",
|
|
25554
|
-
prompt:
|
|
25676
|
+
prompt: text2(question.question),
|
|
25555
25677
|
options,
|
|
25556
25678
|
multiple: question.multiSelect === true,
|
|
25557
25679
|
allowOther: true,
|
|
@@ -25561,7 +25683,7 @@ var CodeBuddyInteractions = class {
|
|
|
25561
25683
|
};
|
|
25562
25684
|
}
|
|
25563
25685
|
permission(turnId, request) {
|
|
25564
|
-
const name =
|
|
25686
|
+
const name = text2(record3(request.toolCall._meta)["codebuddy.ai/toolName"]);
|
|
25565
25687
|
if (name === "AskUserQuestion") {
|
|
25566
25688
|
const interaction2 = this.#question(turnId, request.toolCall.rawInput);
|
|
25567
25689
|
return new Promise((resolve) => {
|
|
@@ -25862,21 +25984,21 @@ var CodeBuddySubagents = class {
|
|
|
25862
25984
|
}
|
|
25863
25985
|
update(value) {
|
|
25864
25986
|
const update = record3(value), meta3 = record3(update._meta);
|
|
25865
|
-
const parentCallId =
|
|
25987
|
+
const parentCallId = text2(meta3["codebuddy.ai/parentToolCallId"]);
|
|
25866
25988
|
if (parentCallId) {
|
|
25867
25989
|
const call2 = this.#calls.get(parentCallId);
|
|
25868
25990
|
if (call2 && !call2.observationDone) {
|
|
25869
|
-
const requestId =
|
|
25991
|
+
const requestId = text2(meta3["codebuddy.ai/conversationRequestId"]);
|
|
25870
25992
|
if (requestId)
|
|
25871
25993
|
call2.requestId = requestId;
|
|
25872
|
-
const progress = update.sessionUpdate === "tool_call" && meta3["codebuddy.ai/toolArgumentsComplete"] ?
|
|
25994
|
+
const progress = update.sessionUpdate === "tool_call" && meta3["codebuddy.ai/toolArgumentsComplete"] ? text2(update.title) : "";
|
|
25873
25995
|
if (progress)
|
|
25874
25996
|
this.#update(call2, { resultSummary: progress.slice(0, 2e3) });
|
|
25875
25997
|
this.#watch();
|
|
25876
25998
|
}
|
|
25877
25999
|
return true;
|
|
25878
26000
|
}
|
|
25879
|
-
const callId =
|
|
26001
|
+
const callId = text2(update.toolCallId), name = text2(meta3["codebuddy.ai/toolName"]);
|
|
25880
26002
|
let call = this.#calls.get(callId);
|
|
25881
26003
|
if (!call && name !== "Agent" && meta3["codebuddy.ai/isSubagent"] !== true)
|
|
25882
26004
|
return false;
|
|
@@ -26069,9 +26191,9 @@ var CodeBuddySession = class {
|
|
|
26069
26191
|
#usage = null;
|
|
26070
26192
|
#refreshingUsage = false;
|
|
26071
26193
|
#context = {};
|
|
26072
|
-
constructor(
|
|
26194
|
+
constructor(input2, environment, factory, readHistory = readNativeHistory, onClose = () => {
|
|
26073
26195
|
}, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
26074
|
-
this.input =
|
|
26196
|
+
this.input = input2;
|
|
26075
26197
|
this.environment = environment;
|
|
26076
26198
|
this.factory = factory;
|
|
26077
26199
|
this.readHistory = readHistory;
|
|
@@ -26087,7 +26209,7 @@ var CodeBuddySession = class {
|
|
|
26087
26209
|
};
|
|
26088
26210
|
this.subagents = new CodeBuddySubagents({
|
|
26089
26211
|
parent: () => this.#ref,
|
|
26090
|
-
cwd:
|
|
26212
|
+
cwd: input2.cwd,
|
|
26091
26213
|
environment,
|
|
26092
26214
|
emit: (event) => {
|
|
26093
26215
|
if (event.type === "item.started" && event.item.type === "subagentDelegation")
|
|
@@ -26133,7 +26255,7 @@ var CodeBuddySession = class {
|
|
|
26133
26255
|
}
|
|
26134
26256
|
if (this.#replay)
|
|
26135
26257
|
return;
|
|
26136
|
-
if ((
|
|
26258
|
+
if ((text2(record3(update._meta)["codebuddy.ai/parentToolCallId"]) || !this.#active?.output.hasItem(`tool-${text2(update.toolCallId)}`)) && this.subagents.update(update))
|
|
26137
26259
|
return;
|
|
26138
26260
|
if (update.sessionUpdate === "config_option_update" && this.#config)
|
|
26139
26261
|
this.#apply(configuration(update.configOptions, this.profile));
|
|
@@ -26185,7 +26307,7 @@ var CodeBuddySession = class {
|
|
|
26185
26307
|
this.#assertClient(generation);
|
|
26186
26308
|
const opened = await client2.open(this.input.cwd, this.#ref?.nativeSessionId);
|
|
26187
26309
|
this.#assertClient(generation);
|
|
26188
|
-
const sessionId = this.#ref?.nativeSessionId ??
|
|
26310
|
+
const sessionId = this.#ref?.nativeSessionId ?? text2(opened.sessionId);
|
|
26189
26311
|
if (!sessionId || opened.sessionId && opened.sessionId !== sessionId)
|
|
26190
26312
|
throw new CodeBuddyError("protocolError", "ACP returned a different Native Session identity");
|
|
26191
26313
|
if (rewind) {
|
|
@@ -26217,12 +26339,12 @@ var CodeBuddySession = class {
|
|
|
26217
26339
|
this.#apply(configuration(opened.configOptions, this.profile), false);
|
|
26218
26340
|
if (this.input.kind === "create" && this.input.executionPolicy === "unattended-full-access") {
|
|
26219
26341
|
await this.#configure("mode", "fullAccess");
|
|
26220
|
-
} else if (this.input.permissionModeId ||
|
|
26221
|
-
await this.#configure("mode", this.input.permissionModeId ??
|
|
26222
|
-
if (this.input.model ||
|
|
26223
|
-
await this.#configure("model", this.input.model?.id ??
|
|
26224
|
-
if (this.input.thinkingOptionId ||
|
|
26225
|
-
await this.#configure("thought_level", this.input.thinkingOptionId ??
|
|
26342
|
+
} else if (this.input.permissionModeId || text2(saved.mode))
|
|
26343
|
+
await this.#configure("mode", this.input.permissionModeId ?? text2(saved.mode));
|
|
26344
|
+
if (this.input.model || text2(saved.model))
|
|
26345
|
+
await this.#configure("model", this.input.model?.id ?? text2(saved.model));
|
|
26346
|
+
if (this.input.thinkingOptionId || text2(saved.thinking))
|
|
26347
|
+
await this.#configure("thought_level", this.input.thinkingOptionId ?? text2(saved.thinking));
|
|
26226
26348
|
if (this.#fault || this.#closed)
|
|
26227
26349
|
throw new CodeBuddyError("invalidState", "Native Session failed while opening");
|
|
26228
26350
|
this.initialState = { ...this.#state };
|
|
@@ -26637,9 +26759,9 @@ var CodeBuddyAdapter = class {
|
|
|
26637
26759
|
this.#invocation = options.invocationFactory ?? codeBuddyInvocation;
|
|
26638
26760
|
this.#factory = options.clientFactory ?? ((clientOptions) => new CodeBuddyAcpClient(clientOptions, void 0, this.#invocation));
|
|
26639
26761
|
}
|
|
26640
|
-
inspect(
|
|
26641
|
-
const cwd =
|
|
26642
|
-
if (
|
|
26762
|
+
inspect(input2 = {}) {
|
|
26763
|
+
const cwd = input2.cwd ?? process.cwd();
|
|
26764
|
+
if (input2.refresh)
|
|
26643
26765
|
this.#cache.clear();
|
|
26644
26766
|
let inspection = this.#cache.get(cwd);
|
|
26645
26767
|
if (!inspection) {
|
|
@@ -26692,24 +26814,24 @@ var CodeBuddyAdapter = class {
|
|
|
26692
26814
|
}
|
|
26693
26815
|
}
|
|
26694
26816
|
}
|
|
26695
|
-
async open(
|
|
26817
|
+
async open(input2) {
|
|
26696
26818
|
if (this.#closed)
|
|
26697
26819
|
return failure("invalidState", "Adapter is closed", this.#profile);
|
|
26698
|
-
if (
|
|
26820
|
+
if (input2.kind === "create" && input2.executionPolicy === "unattended-full-access" && input2.permissionModeId && input2.permissionModeId !== "fullAccess")
|
|
26699
26821
|
return failure("invalidRequest", "Unattended execution requires native fullAccess permissions", this.#profile);
|
|
26700
26822
|
let session;
|
|
26701
26823
|
try {
|
|
26702
|
-
if (!(await stat3(
|
|
26824
|
+
if (!(await stat3(input2.cwd)).isDirectory())
|
|
26703
26825
|
throw new CodeBuddyError("invalidRequest", "Working directory is not a directory");
|
|
26704
26826
|
if (this.#closed)
|
|
26705
26827
|
throw new CodeBuddyError("invalidState", "Adapter closed while opening Session");
|
|
26706
|
-
if (
|
|
26707
|
-
validateNativeRef(
|
|
26708
|
-
if (
|
|
26828
|
+
if (input2.kind === "resume")
|
|
26829
|
+
validateNativeRef(input2.nativeRef, this.#profile);
|
|
26830
|
+
if (input2.kind === "fork" || input2.kind === "rollbackLastTurn") {
|
|
26709
26831
|
const capabilities = capabilitiesForProfile(this.#profile).history;
|
|
26710
|
-
if (
|
|
26832
|
+
if (input2.kind === "fork" && !capabilities.fork || input2.kind === "rollbackLastTurn" && !capabilities.rollbackLastTurn)
|
|
26711
26833
|
throw new CodeBuddyError("unsupported", `${this.#profile.displayName} does not expose this verified history operation`);
|
|
26712
|
-
const sourceRef =
|
|
26834
|
+
const sourceRef = input2.sourceRef;
|
|
26713
26835
|
validateNativeRef(sourceRef, this.#profile);
|
|
26714
26836
|
const source = [...this.#sessions].find((candidate) => candidate.initialState.nativeRef?.nativeSessionId === sourceRef.nativeSessionId);
|
|
26715
26837
|
const snapshot = await source?.readSnapshot();
|
|
@@ -26717,14 +26839,14 @@ var CodeBuddyAdapter = class {
|
|
|
26717
26839
|
throw new CodeBuddyError("invalidState", "Adapter closed while reading source Session");
|
|
26718
26840
|
if (snapshot && !snapshot.ok)
|
|
26719
26841
|
return snapshot;
|
|
26720
|
-
const boundCwd =
|
|
26721
|
-
const sourceCwd = (source?.input.cwd ?? boundCwd) ||
|
|
26722
|
-
if (
|
|
26842
|
+
const boundCwd = text2(record3(sourceRef.locator).boundCwd);
|
|
26843
|
+
const sourceCwd = (source?.input.cwd ?? boundCwd) || input2.cwd;
|
|
26844
|
+
if (input2.kind === "fork" && !capabilities.forkAcrossCwd && codeBuddyCanonicalCwd(sourceCwd) !== codeBuddyCanonicalCwd(input2.cwd))
|
|
26723
26845
|
throw new CodeBuddyError("unsupported", `${this.#profile.displayName} does not support cross-directory Fork`);
|
|
26724
26846
|
const derivation = deriveCodeBuddySession({
|
|
26725
|
-
input,
|
|
26847
|
+
input: input2,
|
|
26726
26848
|
sourceCwd,
|
|
26727
|
-
environment: { ...this.#environment, ...
|
|
26849
|
+
environment: { ...this.#environment, ...input2.environment },
|
|
26728
26850
|
factory: this.#factory,
|
|
26729
26851
|
invocationFactory: this.#invocation,
|
|
26730
26852
|
profile: this.#profile,
|
|
@@ -26733,14 +26855,14 @@ var CodeBuddyAdapter = class {
|
|
|
26733
26855
|
});
|
|
26734
26856
|
this.#derivations.add(derivation);
|
|
26735
26857
|
try {
|
|
26736
|
-
|
|
26858
|
+
input2 = await derivation;
|
|
26737
26859
|
} finally {
|
|
26738
26860
|
this.#derivations.delete(derivation);
|
|
26739
26861
|
}
|
|
26740
26862
|
}
|
|
26741
26863
|
if (this.#closed)
|
|
26742
26864
|
throw new CodeBuddyError("invalidState", "Adapter closed while opening Session");
|
|
26743
|
-
session = new CodeBuddySession(
|
|
26865
|
+
session = new CodeBuddySession(input2, { ...this.#environment, ...input2.environment }, this.#factory, this.options.readHistory, () => {
|
|
26744
26866
|
if (session)
|
|
26745
26867
|
this.#sessions.delete(session);
|
|
26746
26868
|
}, this.#profile);
|
|
@@ -26941,13 +27063,13 @@ function consumeBrokerFrames(socket, onFrame, onError, maxBytes = HARNESS_BROKER
|
|
|
26941
27063
|
bufferedBytes = required2;
|
|
26942
27064
|
if (newline2 < 0)
|
|
26943
27065
|
return;
|
|
26944
|
-
const
|
|
27066
|
+
const text3 = buffered.toString("utf8", 0, bufferedBytes);
|
|
26945
27067
|
bufferedBytes = 0;
|
|
26946
27068
|
if (buffered.length > 64 * 1024)
|
|
26947
27069
|
buffered = Buffer.alloc(0);
|
|
26948
|
-
if (
|
|
27070
|
+
if (text3.length > 0) {
|
|
26949
27071
|
try {
|
|
26950
|
-
const value = JSON.parse(
|
|
27072
|
+
const value = JSON.parse(text3);
|
|
26951
27073
|
onFrame(value);
|
|
26952
27074
|
} catch (error51) {
|
|
26953
27075
|
fail(error51 instanceof SyntaxError ? new Error("Harness broker received invalid JSON") : error51 instanceof Error ? error51 : new Error(String(error51)));
|
|
@@ -27334,7 +27456,7 @@ var harnessOutputSchema = external_exports.custom((value) => {
|
|
|
27334
27456
|
});
|
|
27335
27457
|
|
|
27336
27458
|
// ../../harness-broker/dist/session-import-client.js
|
|
27337
|
-
function createBrokerSessionImportCapability(
|
|
27459
|
+
function createBrokerSessionImportCapability(input2) {
|
|
27338
27460
|
let listing = null;
|
|
27339
27461
|
const closed = () => ({
|
|
27340
27462
|
ok: false,
|
|
@@ -27354,13 +27476,13 @@ function createBrokerSessionImportCapability(input) {
|
|
|
27354
27476
|
const identities = /* @__PURE__ */ new Set();
|
|
27355
27477
|
let total;
|
|
27356
27478
|
for (; ; ) {
|
|
27357
|
-
if (
|
|
27479
|
+
if (input2.isClosed())
|
|
27358
27480
|
return closed();
|
|
27359
|
-
const result = await
|
|
27481
|
+
const result = await input2.request("adapter.sessionImport.list", {
|
|
27360
27482
|
offset: candidates.length,
|
|
27361
27483
|
limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
|
|
27362
27484
|
});
|
|
27363
|
-
if (
|
|
27485
|
+
if (input2.isClosed())
|
|
27364
27486
|
return closed();
|
|
27365
27487
|
if (!result.ok)
|
|
27366
27488
|
return result;
|
|
@@ -27378,12 +27500,12 @@ function createBrokerSessionImportCapability(input) {
|
|
|
27378
27500
|
return { ok: true, value: candidates };
|
|
27379
27501
|
}
|
|
27380
27502
|
} catch (error51) {
|
|
27381
|
-
return { ok: false, error:
|
|
27503
|
+
return { ok: false, error: input2.error(error51) };
|
|
27382
27504
|
}
|
|
27383
27505
|
};
|
|
27384
27506
|
return {
|
|
27385
27507
|
listCandidates() {
|
|
27386
|
-
if (
|
|
27508
|
+
if (input2.isClosed())
|
|
27387
27509
|
return Promise.resolve(closed());
|
|
27388
27510
|
listing ??= list().finally(() => {
|
|
27389
27511
|
listing = null;
|
|
@@ -27391,20 +27513,20 @@ function createBrokerSessionImportCapability(input) {
|
|
|
27391
27513
|
return listing;
|
|
27392
27514
|
},
|
|
27393
27515
|
async resolveCandidate(nativeSessionId) {
|
|
27394
|
-
if (
|
|
27516
|
+
if (input2.isClosed())
|
|
27395
27517
|
return closed();
|
|
27396
27518
|
try {
|
|
27397
|
-
const result = await
|
|
27398
|
-
if (
|
|
27519
|
+
const result = await input2.request("adapter.sessionImport.resolve", { nativeSessionId });
|
|
27520
|
+
if (input2.isClosed())
|
|
27399
27521
|
return closed();
|
|
27400
27522
|
if (!result.ok)
|
|
27401
27523
|
return result;
|
|
27402
27524
|
const source = brokerSessionImportSourceSchema.safeParse(result.value);
|
|
27403
|
-
if (!source.success || source.data.nativeRef.harnessId !==
|
|
27525
|
+
if (!source.success || source.data.nativeRef.harnessId !== input2.harnessId || source.data.candidate.nativeSessionId !== nativeSessionId)
|
|
27404
27526
|
return invalid();
|
|
27405
27527
|
return { ok: true, value: source.data };
|
|
27406
27528
|
} catch (error51) {
|
|
27407
|
-
return { ok: false, error:
|
|
27529
|
+
return { ok: false, error: input2.error(error51) };
|
|
27408
27530
|
}
|
|
27409
27531
|
}
|
|
27410
27532
|
};
|
|
@@ -27984,17 +28106,17 @@ var BrokeredHarnessAdapter = class {
|
|
|
27984
28106
|
#credits = null;
|
|
27985
28107
|
#creditsRefresh = null;
|
|
27986
28108
|
subagents = {
|
|
27987
|
-
readSnapshot: async (
|
|
28109
|
+
readSnapshot: async (input2) => {
|
|
27988
28110
|
try {
|
|
27989
|
-
return parseHarnessResult(await this.#request("adapter.subagent.readSnapshot",
|
|
28111
|
+
return parseHarnessResult(await this.#request("adapter.subagent.readSnapshot", input2));
|
|
27990
28112
|
} catch (error51) {
|
|
27991
28113
|
return { ok: false, error: this.#error(error51) };
|
|
27992
28114
|
}
|
|
27993
28115
|
}
|
|
27994
28116
|
};
|
|
27995
|
-
constructor(
|
|
27996
|
-
this.harnessId = harnessPluginIdSchema.parse(
|
|
27997
|
-
if (
|
|
28117
|
+
constructor(input2 = {}) {
|
|
28118
|
+
this.harnessId = harnessPluginIdSchema.parse(input2.harnessId ?? "claude-code");
|
|
28119
|
+
if (input2.sessionImport) {
|
|
27998
28120
|
this.sessionImport = createBrokerSessionImportCapability({
|
|
27999
28121
|
harnessId: this.harnessId,
|
|
28000
28122
|
request: async (method, params) => parseHarnessResult(await this.#request(method, params, method === "adapter.sessionImport.resolve")),
|
|
@@ -28002,20 +28124,20 @@ var BrokeredHarnessAdapter = class {
|
|
|
28002
28124
|
error: (error51) => this.#error(error51)
|
|
28003
28125
|
});
|
|
28004
28126
|
}
|
|
28005
|
-
if (
|
|
28127
|
+
if (input2.accountCredits !== false) {
|
|
28006
28128
|
this.credits = () => this.#credits;
|
|
28007
28129
|
this.refreshCredits = () => this.#refreshAccountCredits();
|
|
28008
28130
|
}
|
|
28009
|
-
this.#forwardEnvironment =
|
|
28010
|
-
if (
|
|
28011
|
-
this.commandCatalog =
|
|
28012
|
-
if (
|
|
28131
|
+
this.#forwardEnvironment = input2.forwardDelegationEnvironment === true;
|
|
28132
|
+
if (input2.commandCatalog)
|
|
28133
|
+
this.commandCatalog = input2.commandCatalog;
|
|
28134
|
+
if (input2.liveCommandCatalog)
|
|
28013
28135
|
this.liveCommandCatalog = true;
|
|
28014
|
-
this.#descriptorPath =
|
|
28015
|
-
this.#isInstalled =
|
|
28016
|
-
const environment =
|
|
28017
|
-
this.#startBroker =
|
|
28018
|
-
this.#startTimeoutMs =
|
|
28136
|
+
this.#descriptorPath = input2.descriptorPath ?? defaultHarnessBrokerDescriptorPath(input2.environment, this.harnessId);
|
|
28137
|
+
this.#isInstalled = input2.isInstalled;
|
|
28138
|
+
const environment = input2.environment ?? process.env;
|
|
28139
|
+
this.#startBroker = input2.startBroker === false ? void 0 : input2.startBroker ?? (process.platform === "darwin" && !input2.descriptorPath ? () => startBrokerLaunchAgent(this.harnessId, environment) : void 0);
|
|
28140
|
+
this.#startTimeoutMs = input2.startTimeoutMs ?? BROKER_START_TIMEOUT_MS;
|
|
28019
28141
|
}
|
|
28020
28142
|
#refreshAccountCredits() {
|
|
28021
28143
|
if (this.#closed)
|
|
@@ -28047,11 +28169,11 @@ var BrokeredHarnessAdapter = class {
|
|
|
28047
28169
|
return null;
|
|
28048
28170
|
}
|
|
28049
28171
|
}
|
|
28050
|
-
async inspect(
|
|
28172
|
+
async inspect(input2 = {}) {
|
|
28051
28173
|
if (this.#closed)
|
|
28052
28174
|
return failedInspection("Aqua Harness broker adapter is closed");
|
|
28053
28175
|
try {
|
|
28054
|
-
return harnessInspectionSchema.parse(await this.#request("adapter.inspect",
|
|
28176
|
+
return harnessInspectionSchema.parse(await this.#request("adapter.inspect", input2, true));
|
|
28055
28177
|
} catch (error51) {
|
|
28056
28178
|
this.#connection = null;
|
|
28057
28179
|
if (error51 instanceof HarnessNotInstalledError)
|
|
@@ -28063,12 +28185,12 @@ var BrokeredHarnessAdapter = class {
|
|
|
28063
28185
|
const result = await this.#request("adapter.normalizeStoredModelRef", { ref, catalog }, true);
|
|
28064
28186
|
return harnessModelRefSchema.nullable().parse(result) ?? void 0;
|
|
28065
28187
|
}
|
|
28066
|
-
async open(
|
|
28188
|
+
async open(input2) {
|
|
28067
28189
|
if (this.#closed)
|
|
28068
28190
|
return { ok: false, error: unavailable("Aqua Harness broker adapter is closed", false) };
|
|
28069
|
-
const safeInput = { ...
|
|
28191
|
+
const safeInput = { ...input2 };
|
|
28070
28192
|
delete safeInput.environment;
|
|
28071
|
-
if (this.#forwardEnvironment &&
|
|
28193
|
+
if (this.#forwardEnvironment && input2.environment) {
|
|
28072
28194
|
const allowed = [
|
|
28073
28195
|
"CODEXHOST_CLI_PATH",
|
|
28074
28196
|
"CODEXHOST_CLI_NODE_PATH",
|
|
@@ -28076,7 +28198,7 @@ var BrokeredHarnessAdapter = class {
|
|
|
28076
28198
|
"CODEXHOST_RUNTIME_TOKEN",
|
|
28077
28199
|
"CODEXHOST_THREAD_ID"
|
|
28078
28200
|
];
|
|
28079
|
-
const environment = Object.fromEntries(Object.entries(
|
|
28201
|
+
const environment = Object.fromEntries(Object.entries(input2.environment).filter(([key, value]) => allowed.includes(key) && value !== void 0));
|
|
28080
28202
|
if (Object.keys(environment).length)
|
|
28081
28203
|
safeInput.environment = environment;
|
|
28082
28204
|
}
|