@codexhost/cli-darwin-x64 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.app/Contents/Info.plist +30 -0
- package/libexec/CodexHost.app/Contents/MacOS/CodexHost +0 -0
- package/libexec/CodexHost.app/Contents/PkgInfo +1 -0
- package/libexec/CodexHost.app/Contents/Resources/AppIcon.icns +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)
|
|
@@ -1113,8 +1115,8 @@ function cached(getter) {
|
|
|
1113
1115
|
}
|
|
1114
1116
|
};
|
|
1115
1117
|
}
|
|
1116
|
-
function nullish(
|
|
1117
|
-
return
|
|
1118
|
+
function nullish(input2) {
|
|
1119
|
+
return input2 === null || input2 === void 0;
|
|
1118
1120
|
}
|
|
1119
1121
|
function cleanRegex(source) {
|
|
1120
1122
|
const start = source.startsWith("^") ? 1 : 0;
|
|
@@ -1130,9 +1132,9 @@ function floatSafeRemainder(val, step) {
|
|
|
1130
1132
|
return ratio - roundedRatio;
|
|
1131
1133
|
}
|
|
1132
1134
|
var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
1133
|
-
function defineLazy(
|
|
1135
|
+
function defineLazy(object3, key, getter) {
|
|
1134
1136
|
let value = void 0;
|
|
1135
|
-
Object.defineProperty(
|
|
1137
|
+
Object.defineProperty(object3, key, {
|
|
1136
1138
|
get() {
|
|
1137
1139
|
if (value === EVALUATING) {
|
|
1138
1140
|
return void 0;
|
|
@@ -1144,7 +1146,7 @@ function defineLazy(object2, key, getter) {
|
|
|
1144
1146
|
return value;
|
|
1145
1147
|
},
|
|
1146
1148
|
set(v) {
|
|
1147
|
-
Object.defineProperty(
|
|
1149
|
+
Object.defineProperty(object3, key, {
|
|
1148
1150
|
value: v
|
|
1149
1151
|
// configurable: true,
|
|
1150
1152
|
});
|
|
@@ -1201,8 +1203,8 @@ function randomString(length = 10) {
|
|
|
1201
1203
|
function esc(str) {
|
|
1202
1204
|
return JSON.stringify(str);
|
|
1203
1205
|
}
|
|
1204
|
-
function slugify(
|
|
1205
|
-
return
|
|
1206
|
+
function slugify(input2) {
|
|
1207
|
+
return input2.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1206
1208
|
}
|
|
1207
1209
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
1208
1210
|
};
|
|
@@ -1607,19 +1609,19 @@ function finalizeIssue(iss, ctx, config2) {
|
|
|
1607
1609
|
}
|
|
1608
1610
|
return rest;
|
|
1609
1611
|
}
|
|
1610
|
-
function getSizableOrigin(
|
|
1611
|
-
if (
|
|
1612
|
+
function getSizableOrigin(input2) {
|
|
1613
|
+
if (input2 instanceof Set)
|
|
1612
1614
|
return "set";
|
|
1613
|
-
if (
|
|
1615
|
+
if (input2 instanceof Map)
|
|
1614
1616
|
return "map";
|
|
1615
|
-
if (
|
|
1617
|
+
if (input2 instanceof File)
|
|
1616
1618
|
return "file";
|
|
1617
1619
|
return "unknown";
|
|
1618
1620
|
}
|
|
1619
|
-
function getLengthableOrigin(
|
|
1620
|
-
if (Array.isArray(
|
|
1621
|
+
function getLengthableOrigin(input2) {
|
|
1622
|
+
if (Array.isArray(input2))
|
|
1621
1623
|
return "array";
|
|
1622
|
-
if (typeof
|
|
1624
|
+
if (typeof input2 === "string")
|
|
1623
1625
|
return "string";
|
|
1624
1626
|
return "unknown";
|
|
1625
1627
|
}
|
|
@@ -1645,12 +1647,12 @@ function parsedType(data) {
|
|
|
1645
1647
|
return t;
|
|
1646
1648
|
}
|
|
1647
1649
|
function issue(...args) {
|
|
1648
|
-
const [iss,
|
|
1650
|
+
const [iss, input2, inst] = args;
|
|
1649
1651
|
if (typeof iss === "string") {
|
|
1650
1652
|
return {
|
|
1651
1653
|
message: iss,
|
|
1652
1654
|
code: "custom",
|
|
1653
|
-
input,
|
|
1655
|
+
input: input2,
|
|
1654
1656
|
inst
|
|
1655
1657
|
};
|
|
1656
1658
|
}
|
|
@@ -2194,23 +2196,23 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2194
2196
|
bag.pattern = integer;
|
|
2195
2197
|
});
|
|
2196
2198
|
inst._zod.check = (payload) => {
|
|
2197
|
-
const
|
|
2199
|
+
const input2 = payload.value;
|
|
2198
2200
|
if (isInt) {
|
|
2199
|
-
if (!Number.isInteger(
|
|
2201
|
+
if (!Number.isInteger(input2)) {
|
|
2200
2202
|
payload.issues.push({
|
|
2201
2203
|
expected: origin,
|
|
2202
2204
|
format: def.format,
|
|
2203
2205
|
code: "invalid_type",
|
|
2204
2206
|
continue: false,
|
|
2205
|
-
input,
|
|
2207
|
+
input: input2,
|
|
2206
2208
|
inst
|
|
2207
2209
|
});
|
|
2208
2210
|
return;
|
|
2209
2211
|
}
|
|
2210
|
-
if (!Number.isSafeInteger(
|
|
2211
|
-
if (
|
|
2212
|
+
if (!Number.isSafeInteger(input2)) {
|
|
2213
|
+
if (input2 > 0) {
|
|
2212
2214
|
payload.issues.push({
|
|
2213
|
-
input,
|
|
2215
|
+
input: input2,
|
|
2214
2216
|
code: "too_big",
|
|
2215
2217
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
2216
2218
|
note: "Integers must be within the safe integer range.",
|
|
@@ -2221,7 +2223,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2221
2223
|
});
|
|
2222
2224
|
} else {
|
|
2223
2225
|
payload.issues.push({
|
|
2224
|
-
input,
|
|
2226
|
+
input: input2,
|
|
2225
2227
|
code: "too_small",
|
|
2226
2228
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
2227
2229
|
note: "Integers must be within the safe integer range.",
|
|
@@ -2234,10 +2236,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2234
2236
|
return;
|
|
2235
2237
|
}
|
|
2236
2238
|
}
|
|
2237
|
-
if (
|
|
2239
|
+
if (input2 < minimum) {
|
|
2238
2240
|
payload.issues.push({
|
|
2239
2241
|
origin: "number",
|
|
2240
|
-
input,
|
|
2242
|
+
input: input2,
|
|
2241
2243
|
code: "too_small",
|
|
2242
2244
|
minimum,
|
|
2243
2245
|
inclusive: true,
|
|
@@ -2245,10 +2247,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2245
2247
|
continue: !def.abort
|
|
2246
2248
|
});
|
|
2247
2249
|
}
|
|
2248
|
-
if (
|
|
2250
|
+
if (input2 > maximum) {
|
|
2249
2251
|
payload.issues.push({
|
|
2250
2252
|
origin: "number",
|
|
2251
|
-
input,
|
|
2253
|
+
input: input2,
|
|
2252
2254
|
code: "too_big",
|
|
2253
2255
|
maximum,
|
|
2254
2256
|
inclusive: true,
|
|
@@ -2268,11 +2270,11 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
2268
2270
|
bag.maximum = maximum;
|
|
2269
2271
|
});
|
|
2270
2272
|
inst._zod.check = (payload) => {
|
|
2271
|
-
const
|
|
2272
|
-
if (
|
|
2273
|
+
const input2 = payload.value;
|
|
2274
|
+
if (input2 < minimum) {
|
|
2273
2275
|
payload.issues.push({
|
|
2274
2276
|
origin: "bigint",
|
|
2275
|
-
input,
|
|
2277
|
+
input: input2,
|
|
2276
2278
|
code: "too_small",
|
|
2277
2279
|
minimum,
|
|
2278
2280
|
inclusive: true,
|
|
@@ -2280,10 +2282,10 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
2280
2282
|
continue: !def.abort
|
|
2281
2283
|
});
|
|
2282
2284
|
}
|
|
2283
|
-
if (
|
|
2285
|
+
if (input2 > maximum) {
|
|
2284
2286
|
payload.issues.push({
|
|
2285
2287
|
origin: "bigint",
|
|
2286
|
-
input,
|
|
2288
|
+
input: input2,
|
|
2287
2289
|
code: "too_big",
|
|
2288
2290
|
maximum,
|
|
2289
2291
|
inclusive: true,
|
|
@@ -2306,16 +2308,16 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
|
|
|
2306
2308
|
inst2._zod.bag.maximum = def.maximum;
|
|
2307
2309
|
});
|
|
2308
2310
|
inst._zod.check = (payload) => {
|
|
2309
|
-
const
|
|
2310
|
-
const size =
|
|
2311
|
+
const input2 = payload.value;
|
|
2312
|
+
const size = input2.size;
|
|
2311
2313
|
if (size <= def.maximum)
|
|
2312
2314
|
return;
|
|
2313
2315
|
payload.issues.push({
|
|
2314
|
-
origin: getSizableOrigin(
|
|
2316
|
+
origin: getSizableOrigin(input2),
|
|
2315
2317
|
code: "too_big",
|
|
2316
2318
|
maximum: def.maximum,
|
|
2317
2319
|
inclusive: true,
|
|
2318
|
-
input,
|
|
2320
|
+
input: input2,
|
|
2319
2321
|
inst,
|
|
2320
2322
|
continue: !def.abort
|
|
2321
2323
|
});
|
|
@@ -2334,16 +2336,16 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
|
|
|
2334
2336
|
inst2._zod.bag.minimum = def.minimum;
|
|
2335
2337
|
});
|
|
2336
2338
|
inst._zod.check = (payload) => {
|
|
2337
|
-
const
|
|
2338
|
-
const size =
|
|
2339
|
+
const input2 = payload.value;
|
|
2340
|
+
const size = input2.size;
|
|
2339
2341
|
if (size >= def.minimum)
|
|
2340
2342
|
return;
|
|
2341
2343
|
payload.issues.push({
|
|
2342
|
-
origin: getSizableOrigin(
|
|
2344
|
+
origin: getSizableOrigin(input2),
|
|
2343
2345
|
code: "too_small",
|
|
2344
2346
|
minimum: def.minimum,
|
|
2345
2347
|
inclusive: true,
|
|
2346
|
-
input,
|
|
2348
|
+
input: input2,
|
|
2347
2349
|
inst,
|
|
2348
2350
|
continue: !def.abort
|
|
2349
2351
|
});
|
|
@@ -2363,13 +2365,13 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
|
|
|
2363
2365
|
bag.size = def.size;
|
|
2364
2366
|
});
|
|
2365
2367
|
inst._zod.check = (payload) => {
|
|
2366
|
-
const
|
|
2367
|
-
const size =
|
|
2368
|
+
const input2 = payload.value;
|
|
2369
|
+
const size = input2.size;
|
|
2368
2370
|
if (size === def.size)
|
|
2369
2371
|
return;
|
|
2370
2372
|
const tooBig = size > def.size;
|
|
2371
2373
|
payload.issues.push({
|
|
2372
|
-
origin: getSizableOrigin(
|
|
2374
|
+
origin: getSizableOrigin(input2),
|
|
2373
2375
|
...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
|
|
2374
2376
|
inclusive: true,
|
|
2375
2377
|
exact: true,
|
|
@@ -2392,17 +2394,17 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
2392
2394
|
inst2._zod.bag.maximum = def.maximum;
|
|
2393
2395
|
});
|
|
2394
2396
|
inst._zod.check = (payload) => {
|
|
2395
|
-
const
|
|
2396
|
-
const length =
|
|
2397
|
+
const input2 = payload.value;
|
|
2398
|
+
const length = input2.length;
|
|
2397
2399
|
if (length <= def.maximum)
|
|
2398
2400
|
return;
|
|
2399
|
-
const origin = getLengthableOrigin(
|
|
2401
|
+
const origin = getLengthableOrigin(input2);
|
|
2400
2402
|
payload.issues.push({
|
|
2401
2403
|
origin,
|
|
2402
2404
|
code: "too_big",
|
|
2403
2405
|
maximum: def.maximum,
|
|
2404
2406
|
inclusive: true,
|
|
2405
|
-
input,
|
|
2407
|
+
input: input2,
|
|
2406
2408
|
inst,
|
|
2407
2409
|
continue: !def.abort
|
|
2408
2410
|
});
|
|
@@ -2421,17 +2423,17 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
2421
2423
|
inst2._zod.bag.minimum = def.minimum;
|
|
2422
2424
|
});
|
|
2423
2425
|
inst._zod.check = (payload) => {
|
|
2424
|
-
const
|
|
2425
|
-
const length =
|
|
2426
|
+
const input2 = payload.value;
|
|
2427
|
+
const length = input2.length;
|
|
2426
2428
|
if (length >= def.minimum)
|
|
2427
2429
|
return;
|
|
2428
|
-
const origin = getLengthableOrigin(
|
|
2430
|
+
const origin = getLengthableOrigin(input2);
|
|
2429
2431
|
payload.issues.push({
|
|
2430
2432
|
origin,
|
|
2431
2433
|
code: "too_small",
|
|
2432
2434
|
minimum: def.minimum,
|
|
2433
2435
|
inclusive: true,
|
|
2434
|
-
input,
|
|
2436
|
+
input: input2,
|
|
2435
2437
|
inst,
|
|
2436
2438
|
continue: !def.abort
|
|
2437
2439
|
});
|
|
@@ -2451,11 +2453,11 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
2451
2453
|
bag.length = def.length;
|
|
2452
2454
|
});
|
|
2453
2455
|
inst._zod.check = (payload) => {
|
|
2454
|
-
const
|
|
2455
|
-
const length =
|
|
2456
|
+
const input2 = payload.value;
|
|
2457
|
+
const length = input2.length;
|
|
2456
2458
|
if (length === def.length)
|
|
2457
2459
|
return;
|
|
2458
|
-
const origin = getLengthableOrigin(
|
|
2460
|
+
const origin = getLengthableOrigin(input2);
|
|
2459
2461
|
const tooBig = length > def.length;
|
|
2460
2462
|
payload.issues.push({
|
|
2461
2463
|
origin,
|
|
@@ -3126,15 +3128,15 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
3126
3128
|
payload.value = Number(payload.value);
|
|
3127
3129
|
} catch (_) {
|
|
3128
3130
|
}
|
|
3129
|
-
const
|
|
3130
|
-
if (typeof
|
|
3131
|
+
const input2 = payload.value;
|
|
3132
|
+
if (typeof input2 === "number" && !Number.isNaN(input2) && Number.isFinite(input2)) {
|
|
3131
3133
|
return payload;
|
|
3132
3134
|
}
|
|
3133
|
-
const received = typeof
|
|
3135
|
+
const received = typeof input2 === "number" ? Number.isNaN(input2) ? "NaN" : !Number.isFinite(input2) ? "Infinity" : void 0 : void 0;
|
|
3134
3136
|
payload.issues.push({
|
|
3135
3137
|
expected: "number",
|
|
3136
3138
|
code: "invalid_type",
|
|
3137
|
-
input,
|
|
3139
|
+
input: input2,
|
|
3138
3140
|
inst,
|
|
3139
3141
|
...received ? { received } : {}
|
|
3140
3142
|
});
|
|
@@ -3154,13 +3156,13 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
|
3154
3156
|
payload.value = Boolean(payload.value);
|
|
3155
3157
|
} catch (_) {
|
|
3156
3158
|
}
|
|
3157
|
-
const
|
|
3158
|
-
if (typeof
|
|
3159
|
+
const input2 = payload.value;
|
|
3160
|
+
if (typeof input2 === "boolean")
|
|
3159
3161
|
return payload;
|
|
3160
3162
|
payload.issues.push({
|
|
3161
3163
|
expected: "boolean",
|
|
3162
3164
|
code: "invalid_type",
|
|
3163
|
-
input,
|
|
3165
|
+
input: input2,
|
|
3164
3166
|
inst
|
|
3165
3167
|
});
|
|
3166
3168
|
return payload;
|
|
@@ -3193,13 +3195,13 @@ var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, d
|
|
|
3193
3195
|
var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
|
|
3194
3196
|
$ZodType.init(inst, def);
|
|
3195
3197
|
inst._zod.parse = (payload, _ctx) => {
|
|
3196
|
-
const
|
|
3197
|
-
if (typeof
|
|
3198
|
+
const input2 = payload.value;
|
|
3199
|
+
if (typeof input2 === "symbol")
|
|
3198
3200
|
return payload;
|
|
3199
3201
|
payload.issues.push({
|
|
3200
3202
|
expected: "symbol",
|
|
3201
3203
|
code: "invalid_type",
|
|
3202
|
-
input,
|
|
3204
|
+
input: input2,
|
|
3203
3205
|
inst
|
|
3204
3206
|
});
|
|
3205
3207
|
return payload;
|
|
@@ -3210,13 +3212,13 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) =>
|
|
|
3210
3212
|
inst._zod.pattern = _undefined;
|
|
3211
3213
|
inst._zod.values = /* @__PURE__ */ new Set([void 0]);
|
|
3212
3214
|
inst._zod.parse = (payload, _ctx) => {
|
|
3213
|
-
const
|
|
3214
|
-
if (typeof
|
|
3215
|
+
const input2 = payload.value;
|
|
3216
|
+
if (typeof input2 === "undefined")
|
|
3215
3217
|
return payload;
|
|
3216
3218
|
payload.issues.push({
|
|
3217
3219
|
expected: "undefined",
|
|
3218
3220
|
code: "invalid_type",
|
|
3219
|
-
input,
|
|
3221
|
+
input: input2,
|
|
3220
3222
|
inst
|
|
3221
3223
|
});
|
|
3222
3224
|
return payload;
|
|
@@ -3227,13 +3229,13 @@ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
|
|
|
3227
3229
|
inst._zod.pattern = _null;
|
|
3228
3230
|
inst._zod.values = /* @__PURE__ */ new Set([null]);
|
|
3229
3231
|
inst._zod.parse = (payload, _ctx) => {
|
|
3230
|
-
const
|
|
3231
|
-
if (
|
|
3232
|
+
const input2 = payload.value;
|
|
3233
|
+
if (input2 === null)
|
|
3232
3234
|
return payload;
|
|
3233
3235
|
payload.issues.push({
|
|
3234
3236
|
expected: "null",
|
|
3235
3237
|
code: "invalid_type",
|
|
3236
|
-
input,
|
|
3238
|
+
input: input2,
|
|
3237
3239
|
inst
|
|
3238
3240
|
});
|
|
3239
3241
|
return payload;
|
|
@@ -3262,13 +3264,13 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
|
3262
3264
|
var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
|
|
3263
3265
|
$ZodType.init(inst, def);
|
|
3264
3266
|
inst._zod.parse = (payload, _ctx) => {
|
|
3265
|
-
const
|
|
3266
|
-
if (typeof
|
|
3267
|
+
const input2 = payload.value;
|
|
3268
|
+
if (typeof input2 === "undefined")
|
|
3267
3269
|
return payload;
|
|
3268
3270
|
payload.issues.push({
|
|
3269
3271
|
expected: "void",
|
|
3270
3272
|
code: "invalid_type",
|
|
3271
|
-
input,
|
|
3273
|
+
input: input2,
|
|
3272
3274
|
inst
|
|
3273
3275
|
});
|
|
3274
3276
|
return payload;
|
|
@@ -3283,15 +3285,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
3283
3285
|
} catch (_err) {
|
|
3284
3286
|
}
|
|
3285
3287
|
}
|
|
3286
|
-
const
|
|
3287
|
-
const isDate =
|
|
3288
|
-
const isValidDate = isDate && !Number.isNaN(
|
|
3288
|
+
const input2 = payload.value;
|
|
3289
|
+
const isDate = input2 instanceof Date;
|
|
3290
|
+
const isValidDate = isDate && !Number.isNaN(input2.getTime());
|
|
3289
3291
|
if (isValidDate)
|
|
3290
3292
|
return payload;
|
|
3291
3293
|
payload.issues.push({
|
|
3292
3294
|
expected: "date",
|
|
3293
3295
|
code: "invalid_type",
|
|
3294
|
-
input,
|
|
3296
|
+
input: input2,
|
|
3295
3297
|
...isDate ? { received: "Invalid Date" } : {},
|
|
3296
3298
|
inst
|
|
3297
3299
|
});
|
|
@@ -3307,20 +3309,20 @@ function handleArrayResult(result, final, index) {
|
|
|
3307
3309
|
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
3308
3310
|
$ZodType.init(inst, def);
|
|
3309
3311
|
inst._zod.parse = (payload, ctx) => {
|
|
3310
|
-
const
|
|
3311
|
-
if (!Array.isArray(
|
|
3312
|
+
const input2 = payload.value;
|
|
3313
|
+
if (!Array.isArray(input2)) {
|
|
3312
3314
|
payload.issues.push({
|
|
3313
3315
|
expected: "array",
|
|
3314
3316
|
code: "invalid_type",
|
|
3315
|
-
input,
|
|
3317
|
+
input: input2,
|
|
3316
3318
|
inst
|
|
3317
3319
|
});
|
|
3318
3320
|
return payload;
|
|
3319
3321
|
}
|
|
3320
|
-
payload.value = Array(
|
|
3322
|
+
payload.value = Array(input2.length);
|
|
3321
3323
|
const proms = [];
|
|
3322
|
-
for (let i = 0; i <
|
|
3323
|
-
const item =
|
|
3324
|
+
for (let i = 0; i < input2.length; i++) {
|
|
3325
|
+
const item = input2[i];
|
|
3324
3326
|
const result = def.element._zod.run({
|
|
3325
3327
|
value: item,
|
|
3326
3328
|
issues: []
|
|
@@ -3337,8 +3339,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
3337
3339
|
return payload;
|
|
3338
3340
|
};
|
|
3339
3341
|
});
|
|
3340
|
-
function handlePropertyResult(result, final, key,
|
|
3341
|
-
const isPresent = key in
|
|
3342
|
+
function handlePropertyResult(result, final, key, input2, isOptionalIn, isOptionalOut) {
|
|
3343
|
+
const isPresent = key in input2;
|
|
3342
3344
|
if (result.issues.length) {
|
|
3343
3345
|
if (isOptionalIn && isOptionalOut && !isPresent) {
|
|
3344
3346
|
return;
|
|
@@ -3380,14 +3382,14 @@ function normalizeDef(def) {
|
|
|
3380
3382
|
optionalKeys: new Set(okeys)
|
|
3381
3383
|
};
|
|
3382
3384
|
}
|
|
3383
|
-
function handleCatchall(proms,
|
|
3385
|
+
function handleCatchall(proms, input2, payload, ctx, def, inst) {
|
|
3384
3386
|
const unrecognized = [];
|
|
3385
3387
|
const keySet = def.keySet;
|
|
3386
3388
|
const _catchall = def.catchall._zod;
|
|
3387
3389
|
const t = _catchall.def.type;
|
|
3388
3390
|
const isOptionalIn = _catchall.optin === "optional";
|
|
3389
3391
|
const isOptionalOut = _catchall.optout === "optional";
|
|
3390
|
-
for (const key in
|
|
3392
|
+
for (const key in input2) {
|
|
3391
3393
|
if (key === "__proto__")
|
|
3392
3394
|
continue;
|
|
3393
3395
|
if (keySet.has(key))
|
|
@@ -3396,18 +3398,18 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
3396
3398
|
unrecognized.push(key);
|
|
3397
3399
|
continue;
|
|
3398
3400
|
}
|
|
3399
|
-
const r = _catchall.run({ value:
|
|
3401
|
+
const r = _catchall.run({ value: input2[key], issues: [] }, ctx);
|
|
3400
3402
|
if (r instanceof Promise) {
|
|
3401
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
3403
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
|
|
3402
3404
|
} else {
|
|
3403
|
-
handlePropertyResult(r, payload, key,
|
|
3405
|
+
handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
|
|
3404
3406
|
}
|
|
3405
3407
|
}
|
|
3406
3408
|
if (unrecognized.length) {
|
|
3407
3409
|
payload.issues.push({
|
|
3408
3410
|
code: "unrecognized_keys",
|
|
3409
3411
|
keys: unrecognized,
|
|
3410
|
-
input,
|
|
3412
|
+
input: input2,
|
|
3411
3413
|
inst
|
|
3412
3414
|
});
|
|
3413
3415
|
}
|
|
@@ -3451,12 +3453,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3451
3453
|
let value;
|
|
3452
3454
|
inst._zod.parse = (payload, ctx) => {
|
|
3453
3455
|
value ?? (value = _normalized.value);
|
|
3454
|
-
const
|
|
3455
|
-
if (!isObject3(
|
|
3456
|
+
const input2 = payload.value;
|
|
3457
|
+
if (!isObject3(input2)) {
|
|
3456
3458
|
payload.issues.push({
|
|
3457
3459
|
expected: "object",
|
|
3458
3460
|
code: "invalid_type",
|
|
3459
|
-
input,
|
|
3461
|
+
input: input2,
|
|
3460
3462
|
inst
|
|
3461
3463
|
});
|
|
3462
3464
|
return payload;
|
|
@@ -3468,17 +3470,17 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3468
3470
|
const el = shape[key];
|
|
3469
3471
|
const isOptionalIn = el._zod.optin === "optional";
|
|
3470
3472
|
const isOptionalOut = el._zod.optout === "optional";
|
|
3471
|
-
const r = el._zod.run({ value:
|
|
3473
|
+
const r = el._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
3472
3474
|
if (r instanceof Promise) {
|
|
3473
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
3475
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
|
|
3474
3476
|
} else {
|
|
3475
|
-
handlePropertyResult(r, payload, key,
|
|
3477
|
+
handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
|
|
3476
3478
|
}
|
|
3477
3479
|
}
|
|
3478
3480
|
if (!catchall) {
|
|
3479
3481
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
3480
3482
|
}
|
|
3481
|
-
return handleCatchall(proms,
|
|
3483
|
+
return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst);
|
|
3482
3484
|
};
|
|
3483
3485
|
});
|
|
3484
3486
|
var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -3587,12 +3589,12 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3587
3589
|
let value;
|
|
3588
3590
|
inst._zod.parse = (payload, ctx) => {
|
|
3589
3591
|
value ?? (value = _normalized.value);
|
|
3590
|
-
const
|
|
3591
|
-
if (!isObject3(
|
|
3592
|
+
const input2 = payload.value;
|
|
3593
|
+
if (!isObject3(input2)) {
|
|
3592
3594
|
payload.issues.push({
|
|
3593
3595
|
expected: "object",
|
|
3594
3596
|
code: "invalid_type",
|
|
3595
|
-
input,
|
|
3597
|
+
input: input2,
|
|
3596
3598
|
inst
|
|
3597
3599
|
});
|
|
3598
3600
|
return payload;
|
|
@@ -3603,7 +3605,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3603
3605
|
payload = fastpass(payload, ctx);
|
|
3604
3606
|
if (!catchall)
|
|
3605
3607
|
return payload;
|
|
3606
|
-
return handleCatchall([],
|
|
3608
|
+
return handleCatchall([], input2, payload, ctx, value, inst);
|
|
3607
3609
|
}
|
|
3608
3610
|
return superParse(payload, ctx);
|
|
3609
3611
|
};
|
|
@@ -3763,17 +3765,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3763
3765
|
return map2;
|
|
3764
3766
|
});
|
|
3765
3767
|
inst._zod.parse = (payload, ctx) => {
|
|
3766
|
-
const
|
|
3767
|
-
if (!isObject(
|
|
3768
|
+
const input2 = payload.value;
|
|
3769
|
+
if (!isObject(input2)) {
|
|
3768
3770
|
payload.issues.push({
|
|
3769
3771
|
code: "invalid_type",
|
|
3770
3772
|
expected: "object",
|
|
3771
|
-
input,
|
|
3773
|
+
input: input2,
|
|
3772
3774
|
inst
|
|
3773
3775
|
});
|
|
3774
3776
|
return payload;
|
|
3775
3777
|
}
|
|
3776
|
-
const opt = disc.value.get(
|
|
3778
|
+
const opt = disc.value.get(input2?.[def.discriminator]);
|
|
3777
3779
|
if (opt) {
|
|
3778
3780
|
return opt._zod.run(payload, ctx);
|
|
3779
3781
|
}
|
|
@@ -3786,7 +3788,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3786
3788
|
note: "No matching discriminator",
|
|
3787
3789
|
discriminator: def.discriminator,
|
|
3788
3790
|
options: Array.from(disc.value.keys()),
|
|
3789
|
-
input,
|
|
3791
|
+
input: input2,
|
|
3790
3792
|
path: [def.discriminator],
|
|
3791
3793
|
inst
|
|
3792
3794
|
});
|
|
@@ -3796,9 +3798,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3796
3798
|
var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
3797
3799
|
$ZodType.init(inst, def);
|
|
3798
3800
|
inst._zod.parse = (payload, ctx) => {
|
|
3799
|
-
const
|
|
3800
|
-
const left = def.left._zod.run({ value:
|
|
3801
|
-
const right = def.right._zod.run({ value:
|
|
3801
|
+
const input2 = payload.value;
|
|
3802
|
+
const left = def.left._zod.run({ value: input2, issues: [] }, ctx);
|
|
3803
|
+
const right = def.right._zod.run({ value: input2, issues: [] }, ctx);
|
|
3802
3804
|
const async = left instanceof Promise || right instanceof Promise;
|
|
3803
3805
|
if (async) {
|
|
3804
3806
|
return Promise.all([left, right]).then(([left2, right2]) => {
|
|
@@ -3895,10 +3897,10 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3895
3897
|
$ZodType.init(inst, def);
|
|
3896
3898
|
const items = def.items;
|
|
3897
3899
|
inst._zod.parse = (payload, ctx) => {
|
|
3898
|
-
const
|
|
3899
|
-
if (!Array.isArray(
|
|
3900
|
+
const input2 = payload.value;
|
|
3901
|
+
if (!Array.isArray(input2)) {
|
|
3900
3902
|
payload.issues.push({
|
|
3901
|
-
input,
|
|
3903
|
+
input: input2,
|
|
3902
3904
|
inst,
|
|
3903
3905
|
expected: "tuple",
|
|
3904
3906
|
code: "invalid_type"
|
|
@@ -3910,23 +3912,23 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3910
3912
|
const optinStart = getTupleOptStart(items, "optin");
|
|
3911
3913
|
const optoutStart = getTupleOptStart(items, "optout");
|
|
3912
3914
|
if (!def.rest) {
|
|
3913
|
-
if (
|
|
3915
|
+
if (input2.length < optinStart) {
|
|
3914
3916
|
payload.issues.push({
|
|
3915
3917
|
code: "too_small",
|
|
3916
3918
|
minimum: optinStart,
|
|
3917
3919
|
inclusive: true,
|
|
3918
|
-
input,
|
|
3920
|
+
input: input2,
|
|
3919
3921
|
inst,
|
|
3920
3922
|
origin: "array"
|
|
3921
3923
|
});
|
|
3922
3924
|
return payload;
|
|
3923
3925
|
}
|
|
3924
|
-
if (
|
|
3926
|
+
if (input2.length > items.length) {
|
|
3925
3927
|
payload.issues.push({
|
|
3926
3928
|
code: "too_big",
|
|
3927
3929
|
maximum: items.length,
|
|
3928
3930
|
inclusive: true,
|
|
3929
|
-
input,
|
|
3931
|
+
input: input2,
|
|
3930
3932
|
inst,
|
|
3931
3933
|
origin: "array"
|
|
3932
3934
|
});
|
|
@@ -3934,7 +3936,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3934
3936
|
}
|
|
3935
3937
|
const itemResults = new Array(items.length);
|
|
3936
3938
|
for (let i = 0; i < items.length; i++) {
|
|
3937
|
-
const r = items[i]._zod.run({ value:
|
|
3939
|
+
const r = items[i]._zod.run({ value: input2[i], issues: [] }, ctx);
|
|
3938
3940
|
if (r instanceof Promise) {
|
|
3939
3941
|
proms.push(r.then((rr) => {
|
|
3940
3942
|
itemResults[i] = rr;
|
|
@@ -3945,7 +3947,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3945
3947
|
}
|
|
3946
3948
|
if (def.rest) {
|
|
3947
3949
|
let i = items.length - 1;
|
|
3948
|
-
const rest =
|
|
3950
|
+
const rest = input2.slice(items.length);
|
|
3949
3951
|
for (const el of rest) {
|
|
3950
3952
|
i++;
|
|
3951
3953
|
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
@@ -3957,9 +3959,9 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3957
3959
|
}
|
|
3958
3960
|
}
|
|
3959
3961
|
if (proms.length) {
|
|
3960
|
-
return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items,
|
|
3962
|
+
return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input2, optoutStart));
|
|
3961
3963
|
}
|
|
3962
|
-
return handleTupleResults(itemResults, payload, items,
|
|
3964
|
+
return handleTupleResults(itemResults, payload, items, input2, optoutStart);
|
|
3963
3965
|
};
|
|
3964
3966
|
});
|
|
3965
3967
|
function getTupleOptStart(items, key) {
|
|
@@ -3975,10 +3977,10 @@ function handleTupleResult(result, final, index) {
|
|
|
3975
3977
|
}
|
|
3976
3978
|
final.value[index] = result.value;
|
|
3977
3979
|
}
|
|
3978
|
-
function handleTupleResults(itemResults, final, items,
|
|
3980
|
+
function handleTupleResults(itemResults, final, items, input2, optoutStart) {
|
|
3979
3981
|
for (let i = 0; i < items.length; i++) {
|
|
3980
3982
|
const r = itemResults[i];
|
|
3981
|
-
const isPresent = i <
|
|
3983
|
+
const isPresent = i < input2.length;
|
|
3982
3984
|
if (r.issues.length) {
|
|
3983
3985
|
if (!isPresent && i >= optoutStart) {
|
|
3984
3986
|
final.value.length = i;
|
|
@@ -3988,7 +3990,7 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
3988
3990
|
}
|
|
3989
3991
|
final.value[i] = r.value;
|
|
3990
3992
|
}
|
|
3991
|
-
for (let i = final.value.length - 1; i >=
|
|
3993
|
+
for (let i = final.value.length - 1; i >= input2.length; i--) {
|
|
3992
3994
|
if (items[i]._zod.optout === "optional" && final.value[i] === void 0) {
|
|
3993
3995
|
final.value.length = i;
|
|
3994
3996
|
} else {
|
|
@@ -4000,12 +4002,12 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
4000
4002
|
var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
4001
4003
|
$ZodType.init(inst, def);
|
|
4002
4004
|
inst._zod.parse = (payload, ctx) => {
|
|
4003
|
-
const
|
|
4004
|
-
if (!isPlainObject(
|
|
4005
|
+
const input2 = payload.value;
|
|
4006
|
+
if (!isPlainObject(input2)) {
|
|
4005
4007
|
payload.issues.push({
|
|
4006
4008
|
expected: "record",
|
|
4007
4009
|
code: "invalid_type",
|
|
4008
|
-
input,
|
|
4010
|
+
input: input2,
|
|
4009
4011
|
inst
|
|
4010
4012
|
});
|
|
4011
4013
|
return payload;
|
|
@@ -4034,7 +4036,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4034
4036
|
continue;
|
|
4035
4037
|
}
|
|
4036
4038
|
const outKey = keyResult.value;
|
|
4037
|
-
const result = def.valueType._zod.run({ value:
|
|
4039
|
+
const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
4038
4040
|
if (result instanceof Promise) {
|
|
4039
4041
|
proms.push(result.then((result2) => {
|
|
4040
4042
|
if (result2.issues.length) {
|
|
@@ -4051,7 +4053,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4051
4053
|
}
|
|
4052
4054
|
}
|
|
4053
4055
|
let unrecognized;
|
|
4054
|
-
for (const key in
|
|
4056
|
+
for (const key in input2) {
|
|
4055
4057
|
if (!recordKeys.has(key)) {
|
|
4056
4058
|
unrecognized = unrecognized ?? [];
|
|
4057
4059
|
unrecognized.push(key);
|
|
@@ -4060,17 +4062,17 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4060
4062
|
if (unrecognized && unrecognized.length > 0) {
|
|
4061
4063
|
payload.issues.push({
|
|
4062
4064
|
code: "unrecognized_keys",
|
|
4063
|
-
input,
|
|
4065
|
+
input: input2,
|
|
4064
4066
|
inst,
|
|
4065
4067
|
keys: unrecognized
|
|
4066
4068
|
});
|
|
4067
4069
|
}
|
|
4068
4070
|
} else {
|
|
4069
4071
|
payload.value = {};
|
|
4070
|
-
for (const key of Reflect.ownKeys(
|
|
4072
|
+
for (const key of Reflect.ownKeys(input2)) {
|
|
4071
4073
|
if (key === "__proto__")
|
|
4072
4074
|
continue;
|
|
4073
|
-
if (!Object.prototype.propertyIsEnumerable.call(
|
|
4075
|
+
if (!Object.prototype.propertyIsEnumerable.call(input2, key))
|
|
4074
4076
|
continue;
|
|
4075
4077
|
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
4076
4078
|
if (keyResult instanceof Promise) {
|
|
@@ -4088,7 +4090,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4088
4090
|
}
|
|
4089
4091
|
if (keyResult.issues.length) {
|
|
4090
4092
|
if (def.mode === "loose") {
|
|
4091
|
-
payload.value[key] =
|
|
4093
|
+
payload.value[key] = input2[key];
|
|
4092
4094
|
} else {
|
|
4093
4095
|
payload.issues.push({
|
|
4094
4096
|
code: "invalid_key",
|
|
@@ -4101,7 +4103,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4101
4103
|
}
|
|
4102
4104
|
continue;
|
|
4103
4105
|
}
|
|
4104
|
-
const result = def.valueType._zod.run({ value:
|
|
4106
|
+
const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
4105
4107
|
if (result instanceof Promise) {
|
|
4106
4108
|
proms.push(result.then((result2) => {
|
|
4107
4109
|
if (result2.issues.length) {
|
|
@@ -4126,27 +4128,27 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4126
4128
|
var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
4127
4129
|
$ZodType.init(inst, def);
|
|
4128
4130
|
inst._zod.parse = (payload, ctx) => {
|
|
4129
|
-
const
|
|
4130
|
-
if (!(
|
|
4131
|
+
const input2 = payload.value;
|
|
4132
|
+
if (!(input2 instanceof Map)) {
|
|
4131
4133
|
payload.issues.push({
|
|
4132
4134
|
expected: "map",
|
|
4133
4135
|
code: "invalid_type",
|
|
4134
|
-
input,
|
|
4136
|
+
input: input2,
|
|
4135
4137
|
inst
|
|
4136
4138
|
});
|
|
4137
4139
|
return payload;
|
|
4138
4140
|
}
|
|
4139
4141
|
const proms = [];
|
|
4140
4142
|
payload.value = /* @__PURE__ */ new Map();
|
|
4141
|
-
for (const [key, value] of
|
|
4143
|
+
for (const [key, value] of input2) {
|
|
4142
4144
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
4143
4145
|
const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
|
|
4144
4146
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
4145
4147
|
proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
|
|
4146
|
-
handleMapResult(keyResult2, valueResult2, payload, key,
|
|
4148
|
+
handleMapResult(keyResult2, valueResult2, payload, key, input2, inst, ctx);
|
|
4147
4149
|
}));
|
|
4148
4150
|
} else {
|
|
4149
|
-
handleMapResult(keyResult, valueResult, payload, key,
|
|
4151
|
+
handleMapResult(keyResult, valueResult, payload, key, input2, inst, ctx);
|
|
4150
4152
|
}
|
|
4151
4153
|
}
|
|
4152
4154
|
if (proms.length)
|
|
@@ -4154,7 +4156,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
|
4154
4156
|
return payload;
|
|
4155
4157
|
};
|
|
4156
4158
|
});
|
|
4157
|
-
function handleMapResult(keyResult, valueResult, final, key,
|
|
4159
|
+
function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
|
|
4158
4160
|
if (keyResult.issues.length) {
|
|
4159
4161
|
if (propertyKeyTypes.has(typeof key)) {
|
|
4160
4162
|
final.issues.push(...prefixIssues(key, keyResult.issues));
|
|
@@ -4162,7 +4164,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
4162
4164
|
final.issues.push({
|
|
4163
4165
|
code: "invalid_key",
|
|
4164
4166
|
origin: "map",
|
|
4165
|
-
input,
|
|
4167
|
+
input: input2,
|
|
4166
4168
|
inst,
|
|
4167
4169
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
4168
4170
|
});
|
|
@@ -4175,7 +4177,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
4175
4177
|
final.issues.push({
|
|
4176
4178
|
origin: "map",
|
|
4177
4179
|
code: "invalid_element",
|
|
4178
|
-
input,
|
|
4180
|
+
input: input2,
|
|
4179
4181
|
inst,
|
|
4180
4182
|
key,
|
|
4181
4183
|
issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
@@ -4187,10 +4189,10 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
4187
4189
|
var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
4188
4190
|
$ZodType.init(inst, def);
|
|
4189
4191
|
inst._zod.parse = (payload, ctx) => {
|
|
4190
|
-
const
|
|
4191
|
-
if (!(
|
|
4192
|
+
const input2 = payload.value;
|
|
4193
|
+
if (!(input2 instanceof Set)) {
|
|
4192
4194
|
payload.issues.push({
|
|
4193
|
-
input,
|
|
4195
|
+
input: input2,
|
|
4194
4196
|
inst,
|
|
4195
4197
|
expected: "set",
|
|
4196
4198
|
code: "invalid_type"
|
|
@@ -4199,7 +4201,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
|
4199
4201
|
}
|
|
4200
4202
|
const proms = [];
|
|
4201
4203
|
payload.value = /* @__PURE__ */ new Set();
|
|
4202
|
-
for (const item of
|
|
4204
|
+
for (const item of input2) {
|
|
4203
4205
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
4204
4206
|
if (result instanceof Promise) {
|
|
4205
4207
|
proms.push(result.then((result2) => handleSetResult(result2, payload)));
|
|
@@ -4224,14 +4226,14 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
4224
4226
|
inst._zod.values = valuesSet;
|
|
4225
4227
|
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
4226
4228
|
inst._zod.parse = (payload, _ctx) => {
|
|
4227
|
-
const
|
|
4228
|
-
if (valuesSet.has(
|
|
4229
|
+
const input2 = payload.value;
|
|
4230
|
+
if (valuesSet.has(input2)) {
|
|
4229
4231
|
return payload;
|
|
4230
4232
|
}
|
|
4231
4233
|
payload.issues.push({
|
|
4232
4234
|
code: "invalid_value",
|
|
4233
4235
|
values,
|
|
4234
|
-
input,
|
|
4236
|
+
input: input2,
|
|
4235
4237
|
inst
|
|
4236
4238
|
});
|
|
4237
4239
|
return payload;
|
|
@@ -4246,14 +4248,14 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
4246
4248
|
inst._zod.values = values;
|
|
4247
4249
|
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
4248
4250
|
inst._zod.parse = (payload, _ctx) => {
|
|
4249
|
-
const
|
|
4250
|
-
if (values.has(
|
|
4251
|
+
const input2 = payload.value;
|
|
4252
|
+
if (values.has(input2)) {
|
|
4251
4253
|
return payload;
|
|
4252
4254
|
}
|
|
4253
4255
|
payload.issues.push({
|
|
4254
4256
|
code: "invalid_value",
|
|
4255
4257
|
values: def.values,
|
|
4256
|
-
input,
|
|
4258
|
+
input: input2,
|
|
4257
4259
|
inst
|
|
4258
4260
|
});
|
|
4259
4261
|
return payload;
|
|
@@ -4262,13 +4264,13 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
4262
4264
|
var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
|
|
4263
4265
|
$ZodType.init(inst, def);
|
|
4264
4266
|
inst._zod.parse = (payload, _ctx) => {
|
|
4265
|
-
const
|
|
4266
|
-
if (
|
|
4267
|
+
const input2 = payload.value;
|
|
4268
|
+
if (input2 instanceof File)
|
|
4267
4269
|
return payload;
|
|
4268
4270
|
payload.issues.push({
|
|
4269
4271
|
expected: "file",
|
|
4270
4272
|
code: "invalid_type",
|
|
4271
|
-
input,
|
|
4273
|
+
input: input2,
|
|
4272
4274
|
inst
|
|
4273
4275
|
});
|
|
4274
4276
|
return payload;
|
|
@@ -4298,8 +4300,8 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
|
|
|
4298
4300
|
return payload;
|
|
4299
4301
|
};
|
|
4300
4302
|
});
|
|
4301
|
-
function handleOptionalResult(result,
|
|
4302
|
-
if (
|
|
4303
|
+
function handleOptionalResult(result, input2) {
|
|
4304
|
+
if (input2 === void 0 && (result.issues.length || result.fallback)) {
|
|
4303
4305
|
return { issues: [], value: void 0 };
|
|
4304
4306
|
}
|
|
4305
4307
|
return result;
|
|
@@ -4317,11 +4319,11 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
|
4317
4319
|
});
|
|
4318
4320
|
inst._zod.parse = (payload, ctx) => {
|
|
4319
4321
|
if (def.innerType._zod.optin === "optional") {
|
|
4320
|
-
const
|
|
4322
|
+
const input2 = payload.value;
|
|
4321
4323
|
const result = def.innerType._zod.run(payload, ctx);
|
|
4322
4324
|
if (result instanceof Promise)
|
|
4323
|
-
return result.then((r) => handleOptionalResult(r,
|
|
4324
|
-
return handleOptionalResult(result,
|
|
4325
|
+
return result.then((r) => handleOptionalResult(r, input2));
|
|
4326
|
+
return handleOptionalResult(result, input2);
|
|
4325
4327
|
}
|
|
4326
4328
|
if (payload.value === void 0) {
|
|
4327
4329
|
return payload;
|
|
@@ -4746,20 +4748,20 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
|
4746
4748
|
return payload;
|
|
4747
4749
|
};
|
|
4748
4750
|
inst._zod.check = (payload) => {
|
|
4749
|
-
const
|
|
4750
|
-
const r = def.fn(
|
|
4751
|
+
const input2 = payload.value;
|
|
4752
|
+
const r = def.fn(input2);
|
|
4751
4753
|
if (r instanceof Promise) {
|
|
4752
|
-
return r.then((r2) => handleRefineResult(r2, payload,
|
|
4754
|
+
return r.then((r2) => handleRefineResult(r2, payload, input2, inst));
|
|
4753
4755
|
}
|
|
4754
|
-
handleRefineResult(r, payload,
|
|
4756
|
+
handleRefineResult(r, payload, input2, inst);
|
|
4755
4757
|
return;
|
|
4756
4758
|
};
|
|
4757
4759
|
});
|
|
4758
|
-
function handleRefineResult(result, payload,
|
|
4760
|
+
function handleRefineResult(result, payload, input2, inst) {
|
|
4759
4761
|
if (!result) {
|
|
4760
4762
|
const _iss = {
|
|
4761
4763
|
code: "custom",
|
|
4762
|
-
input,
|
|
4764
|
+
input: input2,
|
|
4763
4765
|
inst,
|
|
4764
4766
|
// incorporates params.error into issue reporting
|
|
4765
4767
|
path: [...inst._zod.def.path ?? []],
|
|
@@ -8046,8 +8048,8 @@ function ko_default() {
|
|
|
8046
8048
|
}
|
|
8047
8049
|
|
|
8048
8050
|
// ../../../node_modules/zod/v4/locales/lt.js
|
|
8049
|
-
var capitalizeFirstCharacter = (
|
|
8050
|
-
return
|
|
8051
|
+
var capitalizeFirstCharacter = (text3) => {
|
|
8052
|
+
return text3.charAt(0).toUpperCase() + text3.slice(1);
|
|
8051
8053
|
};
|
|
8052
8054
|
function getUnitTypeFromNumber(number4) {
|
|
8053
8055
|
const abs = Math.abs(number4);
|
|
@@ -11447,23 +11449,23 @@ function _overwrite(tx) {
|
|
|
11447
11449
|
}
|
|
11448
11450
|
// @__NO_SIDE_EFFECTS__
|
|
11449
11451
|
function _normalize(form) {
|
|
11450
|
-
return /* @__PURE__ */ _overwrite((
|
|
11452
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.normalize(form));
|
|
11451
11453
|
}
|
|
11452
11454
|
// @__NO_SIDE_EFFECTS__
|
|
11453
11455
|
function _trim() {
|
|
11454
|
-
return /* @__PURE__ */ _overwrite((
|
|
11456
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.trim());
|
|
11455
11457
|
}
|
|
11456
11458
|
// @__NO_SIDE_EFFECTS__
|
|
11457
11459
|
function _toLowerCase() {
|
|
11458
|
-
return /* @__PURE__ */ _overwrite((
|
|
11460
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.toLowerCase());
|
|
11459
11461
|
}
|
|
11460
11462
|
// @__NO_SIDE_EFFECTS__
|
|
11461
11463
|
function _toUpperCase() {
|
|
11462
|
-
return /* @__PURE__ */ _overwrite((
|
|
11464
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.toUpperCase());
|
|
11463
11465
|
}
|
|
11464
11466
|
// @__NO_SIDE_EFFECTS__
|
|
11465
11467
|
function _slugify() {
|
|
11466
|
-
return /* @__PURE__ */ _overwrite((
|
|
11468
|
+
return /* @__PURE__ */ _overwrite((input2) => slugify(input2));
|
|
11467
11469
|
}
|
|
11468
11470
|
// @__NO_SIDE_EFFECTS__
|
|
11469
11471
|
function _array(Class2, element, params) {
|
|
@@ -11768,8 +11770,8 @@ function _stringbool(Classes, _params) {
|
|
|
11768
11770
|
type: "pipe",
|
|
11769
11771
|
in: stringSchema,
|
|
11770
11772
|
out: booleanSchema,
|
|
11771
|
-
transform: ((
|
|
11772
|
-
let data =
|
|
11773
|
+
transform: ((input2, payload) => {
|
|
11774
|
+
let data = input2;
|
|
11773
11775
|
if (params.case !== "sensitive")
|
|
11774
11776
|
data = data.toLowerCase();
|
|
11775
11777
|
if (truthySet.has(data)) {
|
|
@@ -11788,8 +11790,8 @@ function _stringbool(Classes, _params) {
|
|
|
11788
11790
|
return {};
|
|
11789
11791
|
}
|
|
11790
11792
|
}),
|
|
11791
|
-
reverseTransform: ((
|
|
11792
|
-
if (
|
|
11793
|
+
reverseTransform: ((input2, _payload) => {
|
|
11794
|
+
if (input2 === true) {
|
|
11793
11795
|
return truthyArray[0] || "true";
|
|
11794
11796
|
} else {
|
|
11795
11797
|
return falsyArray[0] || "false";
|
|
@@ -12685,9 +12687,9 @@ var allProcessors = {
|
|
|
12685
12687
|
optional: optionalProcessor,
|
|
12686
12688
|
lazy: lazyProcessor
|
|
12687
12689
|
};
|
|
12688
|
-
function toJSONSchema(
|
|
12689
|
-
if ("_idmap" in
|
|
12690
|
-
const registry2 =
|
|
12690
|
+
function toJSONSchema(input2, params) {
|
|
12691
|
+
if ("_idmap" in input2) {
|
|
12692
|
+
const registry2 = input2;
|
|
12691
12693
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
12692
12694
|
const defs = {};
|
|
12693
12695
|
for (const entry of registry2._idmap.entries()) {
|
|
@@ -12715,9 +12717,9 @@ function toJSONSchema(input, params) {
|
|
|
12715
12717
|
return { schemas };
|
|
12716
12718
|
}
|
|
12717
12719
|
const ctx = initializeContext({ ...params, processors: allProcessors });
|
|
12718
|
-
process2(
|
|
12719
|
-
extractDefs(ctx,
|
|
12720
|
-
return finalize(ctx,
|
|
12720
|
+
process2(input2, ctx);
|
|
12721
|
+
extractDefs(ctx, input2);
|
|
12722
|
+
return finalize(ctx, input2);
|
|
12721
12723
|
}
|
|
12722
12724
|
|
|
12723
12725
|
// ../../../node_modules/zod/v4/core/json-schema-generator.js
|
|
@@ -14994,7 +14996,7 @@ var codexhostErrorSchema = external_exports.strictObject({
|
|
|
14994
14996
|
|
|
14995
14997
|
// ../../shared-contracts/dist/harness-presentation.js
|
|
14996
14998
|
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
14997
|
-
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((
|
|
14999
|
+
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text3) => text3.trim().length > 0);
|
|
14998
15000
|
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
14999
15001
|
label: displayText(256).optional(),
|
|
15000
15002
|
description: displayText(1024).optional()
|
|
@@ -15083,7 +15085,7 @@ var usageMeasurementsSchema = external_exports.object({
|
|
|
15083
15085
|
outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
|
|
15084
15086
|
timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
|
|
15085
15087
|
}).strict();
|
|
15086
|
-
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((
|
|
15088
|
+
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text3) => text3.length <= maximum));
|
|
15087
15089
|
var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
15088
15090
|
kind: external_exports.literal("countdown"),
|
|
15089
15091
|
id: external_exports.string().min(1).max(64),
|
|
@@ -15466,6 +15468,8 @@ var externalThreadInspectionSchema = external_exports.object({
|
|
|
15466
15468
|
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15467
15469
|
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15468
15470
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15471
|
+
/** Live Session catalog when it, not the Adapter inspection, contains `effectiveModel`. */
|
|
15472
|
+
catalog: harnessModelCatalogSchema.optional(),
|
|
15469
15473
|
history: harnessHistoryCapabilitiesSchema,
|
|
15470
15474
|
usage: threadUsageSnapshotSchema.optional(),
|
|
15471
15475
|
locked: external_exports.literal(true)
|
|
@@ -15524,9 +15528,9 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
15524
15528
|
}).strict();
|
|
15525
15529
|
var threadSteeringContextSchema = external_exports.object({
|
|
15526
15530
|
kind: external_exports.literal("application"),
|
|
15527
|
-
value: external_exports.string().transform((
|
|
15531
|
+
value: external_exports.string().transform((text3, context) => {
|
|
15528
15532
|
try {
|
|
15529
|
-
return JSON.parse(
|
|
15533
|
+
return JSON.parse(text3);
|
|
15530
15534
|
} catch {
|
|
15531
15535
|
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15532
15536
|
return external_exports.NEVER;
|
|
@@ -15661,8 +15665,8 @@ var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).r
|
|
|
15661
15665
|
const { username, password } = new URL(value);
|
|
15662
15666
|
return !username && !password && !/[\\\s]/u.test(value);
|
|
15663
15667
|
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
15664
|
-
function localizedText(
|
|
15665
|
-
return external_exports.strictObject({ en:
|
|
15668
|
+
function localizedText(text3) {
|
|
15669
|
+
return external_exports.strictObject({ en: text3, "zh-CN": text3 });
|
|
15666
15670
|
}
|
|
15667
15671
|
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
15668
15672
|
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
@@ -15779,8 +15783,8 @@ var desktopExtensionTrustTierSchema = external_exports.enum(["official", "commun
|
|
|
15779
15783
|
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
15780
15784
|
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
15781
15785
|
}
|
|
15782
|
-
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((
|
|
15783
|
-
const url2 = new URL(
|
|
15786
|
+
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input2) => {
|
|
15787
|
+
const url2 = new URL(input2);
|
|
15784
15788
|
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);
|
|
15785
15789
|
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
15786
15790
|
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
@@ -16131,6 +16135,8 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
16131
16135
|
"codexhost/workspace/read",
|
|
16132
16136
|
"codexhost/thread/tree/read",
|
|
16133
16137
|
"codexhost/thread/pins/list",
|
|
16138
|
+
"codexhost/thread/sections/list",
|
|
16139
|
+
"codexhost/thread/sections/move",
|
|
16134
16140
|
"codexhost/thread/pins/set",
|
|
16135
16141
|
"codexhost/harness/plugins/list",
|
|
16136
16142
|
"codexhost/harness/inspect",
|
|
@@ -16169,8 +16175,21 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
16169
16175
|
"codexhost/update/check",
|
|
16170
16176
|
"codexhost/update/start",
|
|
16171
16177
|
"codexhost/update/status",
|
|
16178
|
+
"codexhost/announcement/get",
|
|
16179
|
+
"codexhost/announcement/acknowledge",
|
|
16172
16180
|
"codexhost/sessions/loaded/list"
|
|
16173
16181
|
];
|
|
16182
|
+
var clientThreadSectionsSchema = external_exports.object({
|
|
16183
|
+
sections: external_exports.array(external_exports.object({
|
|
16184
|
+
id: external_exports.string().min(1),
|
|
16185
|
+
name: external_exports.string().min(1),
|
|
16186
|
+
threads: external_exports.array(jsonObjectSchema)
|
|
16187
|
+
}).strict())
|
|
16188
|
+
}).strict();
|
|
16189
|
+
var clientThreadSectionMoveSchema = external_exports.object({
|
|
16190
|
+
threadId: external_exports.string().min(1).max(1024),
|
|
16191
|
+
sectionId: external_exports.string().min(1).max(1024).nullable()
|
|
16192
|
+
}).strict();
|
|
16174
16193
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
16175
16194
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
16176
16195
|
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
@@ -16712,8 +16731,8 @@ var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
|
16712
16731
|
operations: external_exports.array(harnessPreferenceOperationSchema).min(1).max(256),
|
|
16713
16732
|
initializeOnly: external_exports.boolean().optional(),
|
|
16714
16733
|
expectedRevision: external_exports.number().int().nonnegative().optional()
|
|
16715
|
-
}).superRefine((
|
|
16716
|
-
for (const operation of
|
|
16734
|
+
}).superRefine((input2, ctx) => {
|
|
16735
|
+
for (const operation of input2.operations) {
|
|
16717
16736
|
if (operation.kind === "newThread" && (!operation.lastHarness && !operation.configuration || Boolean(operation.harnessId) !== Boolean(operation.configuration)))
|
|
16718
16737
|
ctx.addIssue({
|
|
16719
16738
|
code: "custom",
|
|
@@ -17115,13 +17134,18 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
17115
17134
|
// ../../shared-contracts/dist/harness-installation.js
|
|
17116
17135
|
var harnessInstallationParamsSchema = external_exports.object({
|
|
17117
17136
|
harnessId: harnessIdSchema,
|
|
17118
|
-
action: external_exports.enum(["check", "update", "install"])
|
|
17119
|
-
|
|
17137
|
+
action: external_exports.enum(["check", "update", "install"]),
|
|
17138
|
+
confirmedVersion: external_exports.string().min(1).max(128).optional()
|
|
17139
|
+
}).strict().refine(({ action, confirmedVersion }) => action === "update" || confirmedVersion === void 0);
|
|
17120
17140
|
var harnessInstallationStateSchema = external_exports.object({
|
|
17121
17141
|
currentVersion: external_exports.string().min(1).max(128),
|
|
17122
17142
|
latestVersion: external_exports.string().min(1).max(128),
|
|
17123
17143
|
updateAvailable: external_exports.boolean(),
|
|
17124
17144
|
canUpdate: external_exports.boolean(),
|
|
17145
|
+
/** Present when the Adapter has a verified list and the available target is outside it. */
|
|
17146
|
+
latestVerifiedVersion: external_exports.string().min(1).max(128).optional(),
|
|
17147
|
+
/** Update preflight stopped before running the installer; latestVersion needs confirmation. */
|
|
17148
|
+
confirmationRequired: external_exports.literal(true).optional(),
|
|
17125
17149
|
/** Defaults to CLI; some Harnesses ship only inside a desktop application. */
|
|
17126
17150
|
versionKind: external_exports.enum(["cli", "application"]).optional(),
|
|
17127
17151
|
/** Official download opened by the user; does not imply an automatic installation. */
|
|
@@ -17451,6 +17475,38 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
17451
17475
|
status: updateStatusSchema.nullable()
|
|
17452
17476
|
});
|
|
17453
17477
|
|
|
17478
|
+
// ../../shared-contracts/dist/release-announcement.js
|
|
17479
|
+
var RELEASE_ANNOUNCEMENT_MAX_THEMES = 12;
|
|
17480
|
+
var releaseAnnouncementThemeSchema = external_exports.strictObject({
|
|
17481
|
+
icon: external_exports.string().min(1).max(16).optional(),
|
|
17482
|
+
title: external_exports.string().min(1).max(120),
|
|
17483
|
+
body: external_exports.string().min(1).max(1200),
|
|
17484
|
+
contributors: external_exports.array(external_exports.string().min(1).max(39)).max(30)
|
|
17485
|
+
});
|
|
17486
|
+
var releaseAnnouncementContentSchema = external_exports.strictObject({
|
|
17487
|
+
summary: external_exports.string().min(1).max(600).optional(),
|
|
17488
|
+
themes: external_exports.array(releaseAnnouncementThemeSchema).min(1).max(RELEASE_ANNOUNCEMENT_MAX_THEMES)
|
|
17489
|
+
});
|
|
17490
|
+
var releaseAnnouncementSchema = external_exports.strictObject({
|
|
17491
|
+
version: updateSemanticVersionSchema,
|
|
17492
|
+
publishedAt: external_exports.iso.datetime(),
|
|
17493
|
+
url: external_exports.string().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),
|
|
17494
|
+
zh: releaseAnnouncementContentSchema.nullable(),
|
|
17495
|
+
en: releaseAnnouncementContentSchema.nullable()
|
|
17496
|
+
}).refine((value) => value.zh !== null || value.en !== null, {
|
|
17497
|
+
message: "an announcement needs at least one language"
|
|
17498
|
+
});
|
|
17499
|
+
var releaseAnnouncementGetParamsSchema = external_exports.strictObject({
|
|
17500
|
+
manual: external_exports.boolean().optional()
|
|
17501
|
+
});
|
|
17502
|
+
var releaseAnnouncementGetResultSchema = external_exports.strictObject({
|
|
17503
|
+
announcement: releaseAnnouncementSchema.nullable(),
|
|
17504
|
+
unread: external_exports.boolean()
|
|
17505
|
+
});
|
|
17506
|
+
var releaseAnnouncementAcknowledgeParamsSchema = external_exports.strictObject({
|
|
17507
|
+
version: updateSemanticVersionSchema
|
|
17508
|
+
});
|
|
17509
|
+
|
|
17454
17510
|
// ../../shared-contracts/dist/thread-watch-notice.js
|
|
17455
17511
|
var THREAD_WATCH_NOTICE_OUTCOMES = [
|
|
17456
17512
|
"completed",
|
|
@@ -17498,17 +17554,67 @@ var remoteSshSetupResultSchema = external_exports.object({ state: external_expor
|
|
|
17498
17554
|
|
|
17499
17555
|
// ../../shared-contracts/dist/remote-sessions.js
|
|
17500
17556
|
var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
|
|
17501
|
-
var
|
|
17557
|
+
var REMOTE_IDENTITY_MAX_LENGTH = 1024;
|
|
17558
|
+
var identity = external_exports.string().min(1).max(REMOTE_IDENTITY_MAX_LENGTH);
|
|
17502
17559
|
var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
|
|
17503
17560
|
var thread = { ...target, threadId: identity };
|
|
17561
|
+
var text = external_exports.string().min(1).max(8e3);
|
|
17562
|
+
var input = { text, requestId: identity };
|
|
17563
|
+
var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
|
|
17564
|
+
external_exports.object({ accepted: external_exports.literal(true), startQueuedItemId: identity.optional() }),
|
|
17565
|
+
external_exports.object({
|
|
17566
|
+
accepted: external_exports.literal(false),
|
|
17567
|
+
code: external_exports.enum([
|
|
17568
|
+
"remote/queue-unavailable",
|
|
17569
|
+
"remote/steer-unavailable",
|
|
17570
|
+
"remote/turn-changed",
|
|
17571
|
+
"remote/send-rejected",
|
|
17572
|
+
"session/queue-item-not-found",
|
|
17573
|
+
"session/queue-item-starting"
|
|
17574
|
+
]),
|
|
17575
|
+
message: external_exports.string()
|
|
17576
|
+
})
|
|
17577
|
+
]);
|
|
17578
|
+
var remoteQueueSnapshotSchema = external_exports.discriminatedUnion("available", [
|
|
17579
|
+
external_exports.object({ available: external_exports.literal(false) }),
|
|
17580
|
+
external_exports.object({
|
|
17581
|
+
available: external_exports.literal(true),
|
|
17582
|
+
items: external_exports.array(external_exports.object({ id: identity, clientUserMessageId: identity, preview: external_exports.string().max(801) })).max(100)
|
|
17583
|
+
})
|
|
17584
|
+
]);
|
|
17504
17585
|
var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
17505
17586
|
external_exports.strictObject({ kind: external_exports.literal("hosts") }),
|
|
17587
|
+
external_exports.strictObject({
|
|
17588
|
+
kind: external_exports.literal("create"),
|
|
17589
|
+
...target,
|
|
17590
|
+
cwd: external_exports.string().min(1).max(8192),
|
|
17591
|
+
epoch: identity
|
|
17592
|
+
}),
|
|
17593
|
+
external_exports.strictObject({ kind: external_exports.literal("projectHarnesses"), ...target, epoch: identity }),
|
|
17594
|
+
external_exports.strictObject({
|
|
17595
|
+
kind: external_exports.literal("inspectHarness"),
|
|
17596
|
+
...target,
|
|
17597
|
+
epoch: identity,
|
|
17598
|
+
cwd: external_exports.string().min(1).max(8192),
|
|
17599
|
+
harnessId: identity
|
|
17600
|
+
}),
|
|
17601
|
+
external_exports.strictObject({
|
|
17602
|
+
kind: external_exports.literal("startSelected"),
|
|
17603
|
+
...target,
|
|
17604
|
+
epoch: identity,
|
|
17605
|
+
cwd: external_exports.string().min(1).max(8192),
|
|
17606
|
+
harnessId: identity,
|
|
17607
|
+
model: external_exports.string().min(1).max(4096),
|
|
17608
|
+
serviceTier: external_exports.enum(["priority", "ultrafast"]).optional(),
|
|
17609
|
+
reasoningEffort: identity.optional()
|
|
17610
|
+
}),
|
|
17506
17611
|
external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
|
|
17507
17612
|
external_exports.strictObject({
|
|
17508
17613
|
kind: external_exports.literal("list"),
|
|
17509
17614
|
...target,
|
|
17510
17615
|
cursor: external_exports.string().nullable(),
|
|
17511
|
-
archived: external_exports.boolean()
|
|
17616
|
+
archived: external_exports.boolean(),
|
|
17617
|
+
includeLoaded: external_exports.literal(true).optional()
|
|
17512
17618
|
}),
|
|
17513
17619
|
external_exports.strictObject({
|
|
17514
17620
|
kind: external_exports.literal("read"),
|
|
@@ -17538,9 +17644,25 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
17538
17644
|
kind: external_exports.literal("prompt"),
|
|
17539
17645
|
...thread,
|
|
17540
17646
|
epoch: identity,
|
|
17541
|
-
text
|
|
17647
|
+
text,
|
|
17542
17648
|
requestId: identity.optional()
|
|
17543
17649
|
}),
|
|
17650
|
+
external_exports.strictObject({ kind: external_exports.literal("queue"), ...thread, epoch: identity }),
|
|
17651
|
+
external_exports.strictObject({
|
|
17652
|
+
kind: external_exports.literal("delivery"),
|
|
17653
|
+
...thread,
|
|
17654
|
+
epoch: identity,
|
|
17655
|
+
action: external_exports.discriminatedUnion("kind", [
|
|
17656
|
+
external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input }),
|
|
17657
|
+
external_exports.strictObject({ kind: external_exports.literal("steer"), ...input, turnId: identity }),
|
|
17658
|
+
external_exports.strictObject({ kind: external_exports.literal("remove"), itemId: identity }),
|
|
17659
|
+
external_exports.strictObject({
|
|
17660
|
+
kind: external_exports.literal("start"),
|
|
17661
|
+
itemId: identity,
|
|
17662
|
+
onlyIfHead: external_exports.literal(true).optional()
|
|
17663
|
+
})
|
|
17664
|
+
])
|
|
17665
|
+
}),
|
|
17544
17666
|
external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
|
|
17545
17667
|
external_exports.strictObject({
|
|
17546
17668
|
kind: external_exports.literal("rename"),
|
|
@@ -18054,8 +18176,8 @@ function liveHarnessCommandPrompt(catalog, idPrefix, commandId, argumentText) {
|
|
|
18054
18176
|
const descriptor = catalog.commands.find(({ id: id2 }) => id2 === commandId);
|
|
18055
18177
|
if (!descriptor)
|
|
18056
18178
|
return null;
|
|
18057
|
-
const
|
|
18058
|
-
return
|
|
18179
|
+
const text3 = typeof argumentText === "string" ? argumentText.trim() : "";
|
|
18180
|
+
return text3 ? `${descriptor.invocation} ${text3}` : descriptor.invocation;
|
|
18059
18181
|
}
|
|
18060
18182
|
function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
|
|
18061
18183
|
if (!live)
|
|
@@ -18095,9 +18217,9 @@ function subagentConfiguration(value) {
|
|
|
18095
18217
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
18096
18218
|
return {};
|
|
18097
18219
|
const row = value;
|
|
18098
|
-
const
|
|
18099
|
-
const model2 = row.model === "inherit" ? void 0 :
|
|
18100
|
-
const reasoningEffort =
|
|
18220
|
+
const text3 = (value2) => typeof value2 === "string" && value2.trim() ? value2 : void 0;
|
|
18221
|
+
const model2 = row.model === "inherit" ? void 0 : text3(row.model);
|
|
18222
|
+
const reasoningEffort = text3(row.reasoningEffort) ?? text3(row.reasoning_effort) ?? text3(row.thinking);
|
|
18101
18223
|
return { ...model2 ? { model: model2 } : {}, ...reasoningEffort ? { reasoningEffort } : {} };
|
|
18102
18224
|
}
|
|
18103
18225
|
function inheritSubagentConfiguration(child, parent) {
|
|
@@ -18335,15 +18457,15 @@ function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_
|
|
|
18335
18457
|
return normalized;
|
|
18336
18458
|
return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
|
|
18337
18459
|
}
|
|
18338
|
-
function sessionImportCandidate(
|
|
18339
|
-
const time3 = typeof
|
|
18460
|
+
function sessionImportCandidate(input2) {
|
|
18461
|
+
const time3 = typeof input2.updatedAt === "number" ? input2.updatedAt : typeof input2.updatedAt === "string" ? Date.parse(input2.updatedAt) : Number.NaN;
|
|
18340
18462
|
const parsed = harnessSessionImportCandidateSchema.safeParse({
|
|
18341
|
-
nativeSessionId:
|
|
18342
|
-
cwd:
|
|
18343
|
-
title: typeof
|
|
18463
|
+
nativeSessionId: input2.nativeSessionId,
|
|
18464
|
+
cwd: input2.cwd,
|
|
18465
|
+
title: typeof input2.title === "string" && input2.title.trim().length > 0 ? input2.title : null,
|
|
18344
18466
|
updatedAt: Math.floor(time3),
|
|
18345
18467
|
// Unknown must stay unknown; only an explicit boolean is a native statement.
|
|
18346
|
-
running: typeof
|
|
18468
|
+
running: typeof input2.running === "boolean" ? input2.running : null
|
|
18347
18469
|
});
|
|
18348
18470
|
return parsed.success ? parsed.data : null;
|
|
18349
18471
|
}
|
|
@@ -18758,12 +18880,12 @@ function toolCommand(toolName, argumentsValue) {
|
|
|
18758
18880
|
const serializedArguments = JSON.stringify(argumentsValue);
|
|
18759
18881
|
return serializedArguments === "{}" ? toolName : `${toolName} ${serializedArguments}`;
|
|
18760
18882
|
}
|
|
18761
|
-
function projectOmpToolItem(
|
|
18883
|
+
function projectOmpToolItem(input2) {
|
|
18762
18884
|
return {
|
|
18763
18885
|
type: "commandExecution",
|
|
18764
|
-
itemId:
|
|
18765
|
-
command: toolCommand(
|
|
18766
|
-
...
|
|
18886
|
+
itemId: input2.itemId,
|
|
18887
|
+
command: toolCommand(input2.toolName, input2.arguments),
|
|
18888
|
+
...input2.cwd ? { cwd: input2.cwd } : {}
|
|
18767
18889
|
};
|
|
18768
18890
|
}
|
|
18769
18891
|
|
|
@@ -18858,8 +18980,8 @@ function itemOutcome(outcome) {
|
|
|
18858
18980
|
return { status: "succeeded" };
|
|
18859
18981
|
}
|
|
18860
18982
|
function toolOutput(value) {
|
|
18861
|
-
const
|
|
18862
|
-
return
|
|
18983
|
+
const text3 = textContent(value);
|
|
18984
|
+
return text3.length > 0 ? { content: [{ type: "text", text: text3 }] } : void 0;
|
|
18863
18985
|
}
|
|
18864
18986
|
function snapshotItems(entries, outcome) {
|
|
18865
18987
|
const snapshots = [];
|
|
@@ -18870,7 +18992,7 @@ function snapshotItems(entries, outcome) {
|
|
|
18870
18992
|
continue;
|
|
18871
18993
|
const content = Array.isArray(nativeMessage.content) ? nativeMessage.content : [];
|
|
18872
18994
|
if (nativeMessage.role === "assistant") {
|
|
18873
|
-
const
|
|
18995
|
+
const text3 = textContent(content);
|
|
18874
18996
|
const reasoning = thinkingContent(content);
|
|
18875
18997
|
let projectedText = false;
|
|
18876
18998
|
let projectedReasoning = false;
|
|
@@ -18887,11 +19009,11 @@ function snapshotItems(entries, outcome) {
|
|
|
18887
19009
|
projectedReasoning = true;
|
|
18888
19010
|
continue;
|
|
18889
19011
|
}
|
|
18890
|
-
if (part.type === "text" && !projectedText &&
|
|
19012
|
+
if (part.type === "text" && !projectedText && text3.length > 0) {
|
|
18891
19013
|
const item2 = {
|
|
18892
19014
|
type: "agentMessage",
|
|
18893
19015
|
itemId: itemId(entry.id, "assistant", 0),
|
|
18894
|
-
text
|
|
19016
|
+
text: text3
|
|
18895
19017
|
};
|
|
18896
19018
|
snapshots.push({ item: item2, outcome: itemOutcome(outcome) });
|
|
18897
19019
|
projectedText = true;
|
|
@@ -19028,12 +19150,12 @@ function nonNegativeSafeInteger(value) {
|
|
|
19028
19150
|
function optionalOmpCacheHitRatePercent(value) {
|
|
19029
19151
|
if (!isRecord5(value) || value.role !== "assistant" || !isRecord5(value.usage))
|
|
19030
19152
|
return null;
|
|
19031
|
-
const
|
|
19153
|
+
const input2 = nonNegativeSafeInteger(value.usage.input);
|
|
19032
19154
|
const cacheRead = nonNegativeSafeInteger(value.usage.cacheRead);
|
|
19033
19155
|
const cacheWrite = nonNegativeSafeInteger(value.usage.cacheWrite);
|
|
19034
|
-
if (
|
|
19156
|
+
if (input2 === null || cacheRead === null || cacheWrite === null)
|
|
19035
19157
|
return null;
|
|
19036
|
-
const promptTokens =
|
|
19158
|
+
const promptTokens = input2 + cacheRead + cacheWrite;
|
|
19037
19159
|
return promptTokens > 0 ? cacheRead / promptTokens * 100 : null;
|
|
19038
19160
|
}
|
|
19039
19161
|
function latestOmpCacheHitRatePercent(history) {
|
|
@@ -19092,10 +19214,10 @@ function ompUsageRecord(message3, extra = {}) {
|
|
|
19092
19214
|
if (!isRecord5(message3) || message3.role !== "assistant")
|
|
19093
19215
|
return null;
|
|
19094
19216
|
const usage = isRecord5(message3.usage) ? message3.usage : null;
|
|
19095
|
-
const
|
|
19217
|
+
const input2 = nonNegativeSafeInteger(usage?.input);
|
|
19096
19218
|
const output = nonNegativeSafeInteger(usage?.output);
|
|
19097
19219
|
const requestId = typeof message3.responseId === "string" && message3.responseId.length > 0 ? message3.responseId : typeof message3.timestamp === "number" && Number.isSafeInteger(message3.timestamp) ? `t${message3.timestamp}` : null;
|
|
19098
|
-
if (!usage ||
|
|
19220
|
+
if (!usage || input2 === null || output === null || requestId === null) {
|
|
19099
19221
|
return { kind: "missing" };
|
|
19100
19222
|
}
|
|
19101
19223
|
const cacheRead = nonNegativeSafeInteger(usage.cacheRead);
|
|
@@ -19110,7 +19232,7 @@ function ompUsageRecord(message3, extra = {}) {
|
|
|
19110
19232
|
...extra.historical ? { historical: true } : {},
|
|
19111
19233
|
// Omp's provider is a configurable name, not a standard provider ID.
|
|
19112
19234
|
...typeof message3.model === "string" && message3.model.length > 0 ? { model: message3.model } : {},
|
|
19113
|
-
inputTokens:
|
|
19235
|
+
inputTokens: input2 + (cacheRead ?? 0) + (cacheWrite ?? 0),
|
|
19114
19236
|
...cacheRead !== null ? { cachedInputTokens: cacheRead } : {},
|
|
19115
19237
|
...cacheWrite !== null ? { cacheWriteInputTokens: cacheWrite } : {},
|
|
19116
19238
|
outputTokens: output,
|
|
@@ -19194,14 +19316,14 @@ var ompDiscoverySpec = {
|
|
|
19194
19316
|
windows: ["${APPDATA}/npm", "${LOCALAPPDATA}/omp", "~/.local/bin", VERSION_MANAGER_ROOTS]
|
|
19195
19317
|
}
|
|
19196
19318
|
};
|
|
19197
|
-
function resolveOmpExecutable(
|
|
19319
|
+
function resolveOmpExecutable(input2, dependencies = {}) {
|
|
19198
19320
|
const resolution = resolveHarnessExecutable(ompDiscoverySpec, {
|
|
19199
|
-
...
|
|
19200
|
-
environment:
|
|
19321
|
+
...input2.command ? { command: input2.command } : {},
|
|
19322
|
+
environment: input2.environment,
|
|
19201
19323
|
...dependencies.platform ? { platform: dependencies.platform } : {},
|
|
19202
19324
|
...dependencies.homeDirectory ? { homeDirectory: dependencies.homeDirectory } : {}
|
|
19203
19325
|
}, { ...dependencies.isExecutable ? { isExecutable: dependencies.isExecutable } : {} });
|
|
19204
|
-
return resolution?.executable ??
|
|
19326
|
+
return resolution?.executable ?? input2.command ?? input2.environment.OMP_COMMAND ?? "omp";
|
|
19205
19327
|
}
|
|
19206
19328
|
|
|
19207
19329
|
// dist/omp-rpc-session.js
|
|
@@ -19254,13 +19376,13 @@ function historyEntry(value) {
|
|
|
19254
19376
|
return value;
|
|
19255
19377
|
}
|
|
19256
19378
|
async function* sessionLines(sessionFile, maxBytes) {
|
|
19257
|
-
const
|
|
19379
|
+
const input2 = createReadStream3(sessionFile, {
|
|
19258
19380
|
encoding: "utf8",
|
|
19259
19381
|
...maxBytes === void 0 ? {} : { end: maxBytes - 1 }
|
|
19260
19382
|
});
|
|
19261
19383
|
let pending = "";
|
|
19262
19384
|
try {
|
|
19263
|
-
for await (const chunk of
|
|
19385
|
+
for await (const chunk of input2) {
|
|
19264
19386
|
const contents = chunk;
|
|
19265
19387
|
let start = 0;
|
|
19266
19388
|
let newline;
|
|
@@ -19275,7 +19397,7 @@ async function* sessionLines(sessionFile, maxBytes) {
|
|
|
19275
19397
|
if (pending.length > 0)
|
|
19276
19398
|
yield pending.endsWith("\r") ? pending.slice(0, -1) : pending;
|
|
19277
19399
|
} finally {
|
|
19278
|
-
|
|
19400
|
+
input2.destroy();
|
|
19279
19401
|
}
|
|
19280
19402
|
}
|
|
19281
19403
|
async function readOmpSessionHistory(sessionFile, maxBytes) {
|
|
@@ -19336,16 +19458,16 @@ async function readOmpSessionHeader(sessionFile) {
|
|
|
19336
19458
|
await handle.close();
|
|
19337
19459
|
}
|
|
19338
19460
|
}
|
|
19339
|
-
async function verifyOmpSessionCwd(
|
|
19340
|
-
if (!
|
|
19461
|
+
async function verifyOmpSessionCwd(input2) {
|
|
19462
|
+
if (!input2.sessionFile)
|
|
19341
19463
|
throw new Error("Omp Fork Session has no persisted Session file");
|
|
19342
|
-
const header = await readOmpSessionHeader(
|
|
19343
|
-
if (header.id !==
|
|
19464
|
+
const header = await readOmpSessionHeader(input2.sessionFile);
|
|
19465
|
+
if (header.id !== input2.sessionId) {
|
|
19344
19466
|
throw new Error("Omp Fork Session header identity does not match RPC state");
|
|
19345
19467
|
}
|
|
19346
19468
|
const [actualCwd, expectedCwd] = await Promise.all([
|
|
19347
19469
|
realpath2(header.cwd),
|
|
19348
|
-
realpath2(
|
|
19470
|
+
realpath2(input2.expectedCwd)
|
|
19349
19471
|
]);
|
|
19350
19472
|
if (actualCwd !== expectedCwd) {
|
|
19351
19473
|
throw new Error("Omp Fork Session did not bind the requested cwd");
|
|
@@ -19573,15 +19695,15 @@ function extractReasoningText(content) {
|
|
|
19573
19695
|
return null;
|
|
19574
19696
|
const type = String(content.type ?? "");
|
|
19575
19697
|
if (type === "thinking" || type === "reasoning" || type === "thought") {
|
|
19576
|
-
const
|
|
19577
|
-
return typeof
|
|
19698
|
+
const text3 = content.thinking ?? content.reasoning ?? content.text ?? content.delta;
|
|
19699
|
+
return typeof text3 === "string" ? text3 : null;
|
|
19578
19700
|
}
|
|
19579
19701
|
return null;
|
|
19580
19702
|
}
|
|
19581
19703
|
function assistantReasoning(value) {
|
|
19582
19704
|
if (!isRecord8(value) || value.role !== "assistant" || !Array.isArray(value.content))
|
|
19583
19705
|
return null;
|
|
19584
|
-
return value.content.map(extractReasoningText).filter((
|
|
19706
|
+
return value.content.map(extractReasoningText).filter((text3) => typeof text3 === "string").join("");
|
|
19585
19707
|
}
|
|
19586
19708
|
function assistantFailure(value) {
|
|
19587
19709
|
if (!isRecord8(value) || value.role !== "assistant")
|
|
@@ -19853,17 +19975,17 @@ var OmpRpcSession = class {
|
|
|
19853
19975
|
throw error51;
|
|
19854
19976
|
}
|
|
19855
19977
|
}
|
|
19856
|
-
async getSubagentMessages(
|
|
19857
|
-
if ((
|
|
19978
|
+
async getSubagentMessages(input2) {
|
|
19979
|
+
if ((input2.subagentId === void 0 || !nonBlankString(input2.subagentId)) && (input2.sessionFile === void 0 || !nonBlankString(input2.sessionFile))) {
|
|
19858
19980
|
throw new Error("Omp Subagent transcript requires a Subagent ID or Session file");
|
|
19859
19981
|
}
|
|
19860
|
-
if (
|
|
19982
|
+
if (input2.fromByte !== void 0 && (!Number.isSafeInteger(input2.fromByte) || input2.fromByte < 0)) {
|
|
19861
19983
|
throw new Error("Omp Subagent transcript offset is invalid");
|
|
19862
19984
|
}
|
|
19863
19985
|
const response = await this.#send("get_subagent_messages", {
|
|
19864
|
-
...
|
|
19865
|
-
...
|
|
19866
|
-
...
|
|
19986
|
+
...input2.subagentId ? { subagentId: input2.subagentId } : {},
|
|
19987
|
+
...input2.sessionFile ? { sessionFile: input2.sessionFile } : {},
|
|
19988
|
+
...input2.fromByte !== void 0 ? { fromByte: input2.fromByte } : {}
|
|
19867
19989
|
});
|
|
19868
19990
|
return parseSubagentMessages(response);
|
|
19869
19991
|
}
|
|
@@ -19995,13 +20117,13 @@ var OmpRpcSession = class {
|
|
|
19995
20117
|
throw new OmpRpcSteerTargetEndedError(history);
|
|
19996
20118
|
}
|
|
19997
20119
|
}
|
|
19998
|
-
async runTurn(
|
|
20120
|
+
async runTurn(text3, onEvent) {
|
|
19999
20121
|
if (!this.#child || !this.#state || this.#closed || this.#failed) {
|
|
20000
20122
|
throw new Error("Omp RPC Session is unavailable");
|
|
20001
20123
|
}
|
|
20002
20124
|
if (this.#activeTurn)
|
|
20003
20125
|
throw new Error("Omp RPC Session already has an active Turn");
|
|
20004
|
-
if (
|
|
20126
|
+
if (text3.length === 0)
|
|
20005
20127
|
throw new Error("Omp text Turn must not be empty");
|
|
20006
20128
|
const promptId = `codexhost-${randomUUID()}`;
|
|
20007
20129
|
const settled = new Promise((resolve, reject) => {
|
|
@@ -20036,7 +20158,7 @@ var OmpRpcSession = class {
|
|
|
20036
20158
|
};
|
|
20037
20159
|
});
|
|
20038
20160
|
try {
|
|
20039
|
-
await this.#send("prompt", { message:
|
|
20161
|
+
await this.#send("prompt", { message: text3 }, promptId);
|
|
20040
20162
|
} catch (error51) {
|
|
20041
20163
|
this.#rejectActiveTurn(error51 instanceof Error ? error51 : new Error(message2(error51)));
|
|
20042
20164
|
}
|
|
@@ -20350,13 +20472,20 @@ var OmpRpcSession = class {
|
|
|
20350
20472
|
}
|
|
20351
20473
|
/** Every finished assistant message is one model request, with or without an active Turn. */
|
|
20352
20474
|
#observeUsage(value) {
|
|
20475
|
+
if (value.type === "agent_end" && Array.isArray(value.messages)) {
|
|
20476
|
+
this.#options.onAssistantSummary?.(value.messages);
|
|
20477
|
+
return;
|
|
20478
|
+
}
|
|
20353
20479
|
if (value.type === "message_start") {
|
|
20354
20480
|
this.#usageRequestStartedAtMs = null;
|
|
20355
20481
|
this.#usageRequestTimingUnavailable = false;
|
|
20482
|
+
this.#options.onAssistantStart?.(value.message);
|
|
20356
20483
|
return;
|
|
20357
20484
|
}
|
|
20358
20485
|
if (value.type === "message_update") {
|
|
20359
20486
|
const event = value.assistantMessageEvent;
|
|
20487
|
+
if (isRecord8(event) && event.type === "start")
|
|
20488
|
+
this.#options.onAssistantStart?.(event.partial ?? value.message);
|
|
20360
20489
|
if (this.#usageRequestStartedAtMs === null && !this.#usageRequestTimingUnavailable && isRecord8(event) && typeof event.type === "string") {
|
|
20361
20490
|
if (
|
|
20362
20491
|
// Native thinking starts can precede visible text by seconds; output usage includes it.
|
|
@@ -20961,23 +21090,23 @@ var OmpRpcSession = class {
|
|
|
20961
21090
|
// dist/omp-model-list.js
|
|
20962
21091
|
var OMP_MODEL_LIST_TIMEOUT_MS = 15e3;
|
|
20963
21092
|
var OMP_MODEL_LIST_OUTPUT_LIMIT = 4 * 1024 * 1024;
|
|
20964
|
-
function listOmpModels(
|
|
21093
|
+
function listOmpModels(input2) {
|
|
20965
21094
|
const environment = withNodeRuntimeOnPath({
|
|
20966
21095
|
...process.env,
|
|
20967
|
-
...
|
|
21096
|
+
...input2.environment,
|
|
20968
21097
|
OMP_SKIP_VERSION_CHECK: "1",
|
|
20969
21098
|
OMP_TELEMETRY: "0"
|
|
20970
21099
|
});
|
|
20971
21100
|
const executable = resolveOmpExecutable({
|
|
20972
|
-
...
|
|
21101
|
+
...input2.command ? { command: input2.command } : {},
|
|
20973
21102
|
environment
|
|
20974
21103
|
});
|
|
20975
21104
|
const invocation = commandInvocation(executable, ["models", "--json"], environment);
|
|
20976
21105
|
return new Promise((resolve) => {
|
|
20977
|
-
if (
|
|
21106
|
+
if (input2.signal?.aborted)
|
|
20978
21107
|
return resolve({ kind: "unanswered" });
|
|
20979
21108
|
const child = spawn2(invocation.command, invocation.arguments, {
|
|
20980
|
-
cwd:
|
|
21109
|
+
cwd: input2.cwd,
|
|
20981
21110
|
env: environment,
|
|
20982
21111
|
// A process group lets a stop reach OMP and its descendants, not only a launcher shim.
|
|
20983
21112
|
detached: process.platform !== "win32",
|
|
@@ -20992,7 +21121,7 @@ function listOmpModels(input) {
|
|
|
20992
21121
|
return;
|
|
20993
21122
|
settled = true;
|
|
20994
21123
|
clearTimeout(timer);
|
|
20995
|
-
|
|
21124
|
+
input2.signal?.removeEventListener("abort", onAbort);
|
|
20996
21125
|
child.stdout.removeAllListeners("data");
|
|
20997
21126
|
if (stop) {
|
|
20998
21127
|
child.stdout.destroy();
|
|
@@ -21004,8 +21133,8 @@ function listOmpModels(input) {
|
|
|
21004
21133
|
resolve(result);
|
|
21005
21134
|
};
|
|
21006
21135
|
const onAbort = () => finish({ kind: "unanswered" }, true);
|
|
21007
|
-
|
|
21008
|
-
const timer = setTimeout(() => finish({ kind: "timedOut" }, true),
|
|
21136
|
+
input2.signal?.addEventListener("abort", onAbort, { once: true });
|
|
21137
|
+
const timer = setTimeout(() => finish({ kind: "timedOut" }, true), input2.timeoutMs ?? OMP_MODEL_LIST_TIMEOUT_MS);
|
|
21009
21138
|
child.stdout.setEncoding("utf8").on("data", (chunk) => {
|
|
21010
21139
|
stdout += chunk;
|
|
21011
21140
|
if (stdout.length > OMP_MODEL_LIST_OUTPUT_LIMIT)
|
|
@@ -21556,9 +21685,9 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
|
|
|
21556
21685
|
} }));
|
|
21557
21686
|
}
|
|
21558
21687
|
}
|
|
21559
|
-
function splitLines(
|
|
21560
|
-
const hasTrailingNl =
|
|
21561
|
-
const result =
|
|
21688
|
+
function splitLines(text3) {
|
|
21689
|
+
const hasTrailingNl = text3.endsWith("\n");
|
|
21690
|
+
const result = text3.split("\n").map((line) => line + "\n");
|
|
21562
21691
|
if (hasTrailingNl) {
|
|
21563
21692
|
result.pop();
|
|
21564
21693
|
} else {
|
|
@@ -21568,10 +21697,160 @@ function splitLines(text) {
|
|
|
21568
21697
|
}
|
|
21569
21698
|
|
|
21570
21699
|
// dist/omp-adapter.js
|
|
21571
|
-
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
21700
|
+
import { createHash, randomUUID as randomUUID2 } from "node:crypto";
|
|
21572
21701
|
import { realpath as realpath3, stat as stat2 } from "node:fs/promises";
|
|
21573
21702
|
import path7 from "node:path";
|
|
21574
21703
|
|
|
21704
|
+
// dist/omp-account-credits.js
|
|
21705
|
+
var CACHE_MS = 3e4;
|
|
21706
|
+
function object2(value) {
|
|
21707
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
21708
|
+
}
|
|
21709
|
+
function text2(value) {
|
|
21710
|
+
return typeof value === "string" ? value.trim() || void 0 : void 0;
|
|
21711
|
+
}
|
|
21712
|
+
function nonnegative(value) {
|
|
21713
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
21714
|
+
}
|
|
21715
|
+
function accountKey(provider, credentialId) {
|
|
21716
|
+
return typeof provider === "string" && provider.length > 0 && typeof credentialId === "number" && Number.isSafeInteger(credentialId) && credentialId >= 0 ? JSON.stringify([provider, credentialId]) : null;
|
|
21717
|
+
}
|
|
21718
|
+
function ompStreamingAccount(message3) {
|
|
21719
|
+
const data = object2(message3);
|
|
21720
|
+
if (data?.role !== "assistant" || data.stopReason === "error" || data.stopReason === "aborted")
|
|
21721
|
+
return void 0;
|
|
21722
|
+
return accountKey(data.provider, data.credentialId);
|
|
21723
|
+
}
|
|
21724
|
+
function ompMessageAccount(message3) {
|
|
21725
|
+
const data = object2(message3);
|
|
21726
|
+
if (data?.role !== "assistant" || data.stopReason !== "stop" && data.stopReason !== "toolUse" && data.stopReason !== "length")
|
|
21727
|
+
return void 0;
|
|
21728
|
+
return accountKey(data.provider, data.credentialId);
|
|
21729
|
+
}
|
|
21730
|
+
function latestOmpAccount(history) {
|
|
21731
|
+
if (history.incomplete)
|
|
21732
|
+
return null;
|
|
21733
|
+
const entries = activeOmpEntries(history);
|
|
21734
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
21735
|
+
const entry = entries[i];
|
|
21736
|
+
if (entry?.type !== "message")
|
|
21737
|
+
continue;
|
|
21738
|
+
const key = ompMessageAccount(entry.message);
|
|
21739
|
+
if (key !== void 0)
|
|
21740
|
+
return key;
|
|
21741
|
+
}
|
|
21742
|
+
return null;
|
|
21743
|
+
}
|
|
21744
|
+
function quotaWindow(value) {
|
|
21745
|
+
const limit = object2(value);
|
|
21746
|
+
const amount = object2(limit?.amount);
|
|
21747
|
+
const used = nonnegative(amount?.used);
|
|
21748
|
+
const total = nonnegative(amount?.limit);
|
|
21749
|
+
const usedFraction = nonnegative(amount?.usedFraction);
|
|
21750
|
+
const remainingFraction = nonnegative(amount?.remainingFraction);
|
|
21751
|
+
const fraction = usedFraction ?? (remainingFraction !== void 0 && remainingFraction <= 1 ? 1 - remainingFraction : void 0) ?? (used !== void 0 && total !== void 0 && total > 0 ? used / total : void 0);
|
|
21752
|
+
if (fraction === void 0 || !Number.isFinite(fraction))
|
|
21753
|
+
return null;
|
|
21754
|
+
const window = object2(limit?.window);
|
|
21755
|
+
const label = text2(limit?.label) ?? text2(window?.label);
|
|
21756
|
+
const resetsAt = nonnegative(window?.resetsAt);
|
|
21757
|
+
const duration3 = window?.durationMs;
|
|
21758
|
+
const unit = text2(amount?.unit);
|
|
21759
|
+
return {
|
|
21760
|
+
usedPercent: Math.min(100, fraction * 100),
|
|
21761
|
+
periodType: duration3 === 18e6 ? "five_hour" : duration3 === 6048e5 ? "seven_day" : "unknown",
|
|
21762
|
+
...label ? { label } : {},
|
|
21763
|
+
...resetsAt !== void 0 && resetsAt > 0 && resetsAt <= 864e13 ? { resetsAt: new Date(resetsAt).toISOString() } : {},
|
|
21764
|
+
...unit && unit !== "percent" && unit.length <= 32 ? {
|
|
21765
|
+
unit,
|
|
21766
|
+
...used !== void 0 ? { used } : {},
|
|
21767
|
+
...total !== void 0 ? { limit: total } : {}
|
|
21768
|
+
} : {}
|
|
21769
|
+
};
|
|
21770
|
+
}
|
|
21771
|
+
function reportAccount(value) {
|
|
21772
|
+
const report = object2(value);
|
|
21773
|
+
if (!Array.isArray(report?.limits))
|
|
21774
|
+
return null;
|
|
21775
|
+
const windows = report.limits.map(quotaWindow).filter((window) => window !== null);
|
|
21776
|
+
const primary = windows.find((window) => window.periodType === "five_hour") ?? windows[0];
|
|
21777
|
+
if (!primary)
|
|
21778
|
+
return null;
|
|
21779
|
+
const productUsage = windows.filter((window) => window !== primary).map((window) => {
|
|
21780
|
+
const { label, usedPercent, ...rest } = window;
|
|
21781
|
+
return { ...rest, product: label ?? "Quota", usagePercent: usedPercent };
|
|
21782
|
+
});
|
|
21783
|
+
const metadata = object2(report.metadata);
|
|
21784
|
+
const plan = text2(metadata?.planType)?.slice(0, 128);
|
|
21785
|
+
const email3 = text2(metadata?.email)?.slice(0, 320);
|
|
21786
|
+
const provider = text2(report.provider)?.slice(0, 256);
|
|
21787
|
+
return {
|
|
21788
|
+
...provider ? { label: provider } : {},
|
|
21789
|
+
...email3 ? { email: email3 } : {},
|
|
21790
|
+
...plan ? { plan } : {},
|
|
21791
|
+
credits: { ...primary, ...productUsage.length ? { productUsage } : {} }
|
|
21792
|
+
};
|
|
21793
|
+
}
|
|
21794
|
+
var OmpAccountCredits = class {
|
|
21795
|
+
load;
|
|
21796
|
+
#cached;
|
|
21797
|
+
#pending;
|
|
21798
|
+
#probeSequence = 0;
|
|
21799
|
+
constructor(load) {
|
|
21800
|
+
this.load = load;
|
|
21801
|
+
}
|
|
21802
|
+
async forAccount(key) {
|
|
21803
|
+
return (await this.#read()).get(key)?.credits ?? null;
|
|
21804
|
+
}
|
|
21805
|
+
async inspectAccounts() {
|
|
21806
|
+
return [...(await this.#read(true)).values()];
|
|
21807
|
+
}
|
|
21808
|
+
#read(refresh = false) {
|
|
21809
|
+
if (!refresh) {
|
|
21810
|
+
if (this.#pending)
|
|
21811
|
+
return this.#pending;
|
|
21812
|
+
if (this.#cached && Date.now() - this.#cached.fetchedAt < CACHE_MS)
|
|
21813
|
+
return Promise.resolve(this.#cached.accounts);
|
|
21814
|
+
}
|
|
21815
|
+
const sequence = ++this.#probeSequence;
|
|
21816
|
+
this.#pending = (async () => {
|
|
21817
|
+
const accounts = /* @__PURE__ */ new Map();
|
|
21818
|
+
try {
|
|
21819
|
+
const data = object2(JSON.parse(await this.load()));
|
|
21820
|
+
if (Array.isArray(data?.reports)) {
|
|
21821
|
+
const ambiguous = /* @__PURE__ */ new Set();
|
|
21822
|
+
for (const value of data.reports) {
|
|
21823
|
+
const report = object2(value);
|
|
21824
|
+
const key = accountKey(report?.provider, object2(report?.metadata)?.credentialId);
|
|
21825
|
+
if (!key || ambiguous.has(key))
|
|
21826
|
+
continue;
|
|
21827
|
+
if (accounts.has(key)) {
|
|
21828
|
+
accounts.delete(key);
|
|
21829
|
+
ambiguous.add(key);
|
|
21830
|
+
continue;
|
|
21831
|
+
}
|
|
21832
|
+
const account = reportAccount(value);
|
|
21833
|
+
if (account)
|
|
21834
|
+
accounts.set(key, account);
|
|
21835
|
+
}
|
|
21836
|
+
}
|
|
21837
|
+
} catch {
|
|
21838
|
+
}
|
|
21839
|
+
if (sequence === this.#probeSequence)
|
|
21840
|
+
this.#cached = { fetchedAt: Date.now(), accounts };
|
|
21841
|
+
return accounts;
|
|
21842
|
+
})().finally(() => {
|
|
21843
|
+
if (sequence === this.#probeSequence)
|
|
21844
|
+
this.#pending = void 0;
|
|
21845
|
+
});
|
|
21846
|
+
return this.#pending;
|
|
21847
|
+
}
|
|
21848
|
+
};
|
|
21849
|
+
function createOmpAccountCredits(command, environment, cwd) {
|
|
21850
|
+
const env = { ...environment, OMP_SKIP_VERSION_CHECK: "1", OMP_TELEMETRY: "0" };
|
|
21851
|
+
return new OmpAccountCredits(() => runInstallationCommand(resolveOmpExecutable({ ...command ? { command } : {}, environment: env }), ["usage", "--json", "--no-extensions"], env, 5e3, cwd));
|
|
21852
|
+
}
|
|
21853
|
+
|
|
21575
21854
|
// dist/omp-last-turn-rollback.js
|
|
21576
21855
|
function modelFromState(state) {
|
|
21577
21856
|
if (state.provider === null && state.modelId === null)
|
|
@@ -21955,20 +22234,20 @@ function nativeText(value) {
|
|
|
21955
22234
|
return value;
|
|
21956
22235
|
if (!isRecord10(value) || !Array.isArray(value.content))
|
|
21957
22236
|
return "";
|
|
21958
|
-
return value.content.filter((content) => isRecord10(content) && content.type === "text" && typeof content.text === "string").map(({ text }) =>
|
|
22237
|
+
return value.content.filter((content) => isRecord10(content) && content.type === "text" && typeof content.text === "string").map(({ text: text3 }) => text3).join("");
|
|
21959
22238
|
}
|
|
21960
22239
|
function boundedOutput(value, limit) {
|
|
21961
|
-
const
|
|
21962
|
-
if (
|
|
22240
|
+
const text3 = nativeText(value);
|
|
22241
|
+
if (text3.length === 0)
|
|
21963
22242
|
return void 0;
|
|
21964
|
-
const truncated =
|
|
22243
|
+
const truncated = text3.length > limit;
|
|
21965
22244
|
return {
|
|
21966
|
-
content: [{ type: "text", text: truncated ?
|
|
22245
|
+
content: [{ type: "text", text: truncated ? text3.slice(0, limit) : text3 }],
|
|
21967
22246
|
...truncated ? { truncated: true } : {}
|
|
21968
22247
|
};
|
|
21969
22248
|
}
|
|
21970
22249
|
function outputText(output) {
|
|
21971
|
-
return output?.content.filter((content) => content.type === "text").map(({ text }) =>
|
|
22250
|
+
return output?.content.filter((content) => content.type === "text").map(({ text: text3 }) => text3).join("") ?? "";
|
|
21972
22251
|
}
|
|
21973
22252
|
function stringField2(value, key) {
|
|
21974
22253
|
if (!isRecord10(value))
|
|
@@ -22164,6 +22443,7 @@ var OmpHarnessSession = class {
|
|
|
22164
22443
|
#requestedModel;
|
|
22165
22444
|
#requestedThinkingOptionId;
|
|
22166
22445
|
#toolOutputLimit;
|
|
22446
|
+
#accountCredits;
|
|
22167
22447
|
#modelIndex;
|
|
22168
22448
|
#permissionMode;
|
|
22169
22449
|
#permissionModeId;
|
|
@@ -22176,6 +22456,8 @@ var OmpHarnessSession = class {
|
|
|
22176
22456
|
#state = {};
|
|
22177
22457
|
#transport = null;
|
|
22178
22458
|
#usage;
|
|
22459
|
+
#accountKey;
|
|
22460
|
+
#streamingAccountKey;
|
|
22179
22461
|
#usageGeneration = 0;
|
|
22180
22462
|
#usageRefreshSequence = 0;
|
|
22181
22463
|
constructor(cwd, createTransport, onClosed, options) {
|
|
@@ -22186,6 +22468,8 @@ var OmpHarnessSession = class {
|
|
|
22186
22468
|
this.#requestedModel = options.model;
|
|
22187
22469
|
this.#requestedThinkingOptionId = options.thinkingOptionId;
|
|
22188
22470
|
this.#toolOutputLimit = options.toolOutputLimit;
|
|
22471
|
+
this.#accountCredits = options.accountCredits;
|
|
22472
|
+
this.#accountKey = options.initialAccountKey ?? null;
|
|
22189
22473
|
this.#permissionMode = options.permissionMode;
|
|
22190
22474
|
this.#permissionModeId = options.permissionModeId;
|
|
22191
22475
|
this.capabilities = ((session) => ({
|
|
@@ -22217,15 +22501,57 @@ var OmpHarnessSession = class {
|
|
|
22217
22501
|
this.#event({ type: "usage.request", request });
|
|
22218
22502
|
this.#event({ type: "usage.history", complete: usageHistory.complete });
|
|
22219
22503
|
}
|
|
22504
|
+
handleAssistantStart(message3) {
|
|
22505
|
+
if (this.#phase !== "open")
|
|
22506
|
+
return;
|
|
22507
|
+
const account = ompStreamingAccount(message3);
|
|
22508
|
+
if (account === void 0)
|
|
22509
|
+
return;
|
|
22510
|
+
const previous = this.#displayedAccount();
|
|
22511
|
+
this.#streamingAccountKey = account;
|
|
22512
|
+
if (previous !== account)
|
|
22513
|
+
this.#event({ type: "session.accountCredits.changed" });
|
|
22514
|
+
}
|
|
22515
|
+
handleAssistantSummary(messages) {
|
|
22516
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
22517
|
+
const key = ompMessageAccount(messages[i]);
|
|
22518
|
+
if (key !== void 0) {
|
|
22519
|
+
this.#finishAccountAttempt(key);
|
|
22520
|
+
return;
|
|
22521
|
+
}
|
|
22522
|
+
}
|
|
22523
|
+
this.#finishAccountAttempt(void 0);
|
|
22524
|
+
}
|
|
22525
|
+
#finishAccountAttempt(accountKey2) {
|
|
22526
|
+
if (this.#phase !== "open")
|
|
22527
|
+
return;
|
|
22528
|
+
const previous = this.#displayedAccount();
|
|
22529
|
+
if (accountKey2 !== void 0)
|
|
22530
|
+
this.#accountKey = accountKey2;
|
|
22531
|
+
this.#streamingAccountKey = void 0;
|
|
22532
|
+
if (previous !== this.#accountKey)
|
|
22533
|
+
this.#event({ type: "session.accountCredits.changed" });
|
|
22534
|
+
}
|
|
22220
22535
|
handleTransportUsage(observation) {
|
|
22221
22536
|
if (this.#phase !== "open")
|
|
22222
22537
|
return;
|
|
22538
|
+
this.#finishAccountAttempt(ompMessageAccount(observation.message));
|
|
22223
22539
|
const record3 = ompUsageRecord(observation.message, observation);
|
|
22224
22540
|
if (record3?.kind === "request")
|
|
22225
22541
|
this.#event({ type: "usage.request", request: record3.request });
|
|
22226
22542
|
else if (record3?.kind === "missing")
|
|
22227
22543
|
this.#event({ type: "usage.history", complete: false });
|
|
22228
22544
|
}
|
|
22545
|
+
#displayedAccount() {
|
|
22546
|
+
return this.#streamingAccountKey === void 0 ? this.#accountKey : this.#streamingAccountKey;
|
|
22547
|
+
}
|
|
22548
|
+
async readAccountCredits() {
|
|
22549
|
+
const key = this.#displayedAccount();
|
|
22550
|
+
if (this.#phase !== "open" || key === null)
|
|
22551
|
+
return null;
|
|
22552
|
+
const credits = await this.#accountCredits.forAccount(key);
|
|
22553
|
+
return this.#phase === "open" && key === this.#displayedAccount() ? credits : null;
|
|
22554
|
+
}
|
|
22229
22555
|
handleTransportFault(error51) {
|
|
22230
22556
|
queueMicrotask(() => this.#fault(error51));
|
|
22231
22557
|
}
|
|
@@ -22362,8 +22688,8 @@ var OmpHarnessSession = class {
|
|
|
22362
22688
|
}
|
|
22363
22689
|
};
|
|
22364
22690
|
}
|
|
22365
|
-
const
|
|
22366
|
-
if (
|
|
22691
|
+
const text3 = command.input.map((input2) => input2.text).join("\n");
|
|
22692
|
+
if (text3.length === 0) {
|
|
22367
22693
|
return {
|
|
22368
22694
|
ok: false,
|
|
22369
22695
|
error: {
|
|
@@ -22432,7 +22758,7 @@ var OmpHarnessSession = class {
|
|
|
22432
22758
|
this.#active = active2;
|
|
22433
22759
|
this.#event({ type: "turn.started", turnId: command.turnId });
|
|
22434
22760
|
this.#event({ type: "item.started", turnId: command.turnId, item });
|
|
22435
|
-
void transport.runTurn(
|
|
22761
|
+
void transport.runTurn(text3, (event) => this.#handleTurnEvent(active2, event)).then(async (result) => {
|
|
22436
22762
|
if (!result.agentInvoked) {
|
|
22437
22763
|
this.#completeTurn(active2, result.error !== void 0 ? { status: "failed", error: normalizedError(result.error, "nativeFailure") } : result.cancelled ? { status: "cancelled", reason: "Cancelled by user" } : { status: "succeeded" }, result.text, void 0, true);
|
|
22438
22764
|
return;
|
|
@@ -22655,6 +22981,8 @@ var OmpHarnessSession = class {
|
|
|
22655
22981
|
permissionMode: mode,
|
|
22656
22982
|
onFault: (error51) => queueMicrotask(() => this.#fault(error51)),
|
|
22657
22983
|
onSubagentEvent: (event) => this.handleTransportEvent(event),
|
|
22984
|
+
onAssistantStart: (message3) => this.handleAssistantStart(message3),
|
|
22985
|
+
onAssistantSummary: (messages) => this.handleAssistantSummary(messages),
|
|
22658
22986
|
onUsage: (observation) => this.handleTransportUsage(observation)
|
|
22659
22987
|
});
|
|
22660
22988
|
try {
|
|
@@ -22779,8 +23107,8 @@ var OmpHarnessSession = class {
|
|
|
22779
23107
|
return Boolean(this.#phase === "open" && active2 && !active2.cancellationRequested && active2.acceptingSteers && active2.tools.size > 0 && this.#transport);
|
|
22780
23108
|
}
|
|
22781
23109
|
async #steer(command) {
|
|
22782
|
-
const
|
|
22783
|
-
if (
|
|
23110
|
+
const text3 = command.input.map((input2) => input2.text).join("\n");
|
|
23111
|
+
if (text3.length === 0) {
|
|
22784
23112
|
return {
|
|
22785
23113
|
ok: false,
|
|
22786
23114
|
error: {
|
|
@@ -22797,7 +23125,7 @@ var OmpHarnessSession = class {
|
|
|
22797
23125
|
}
|
|
22798
23126
|
let accepted;
|
|
22799
23127
|
try {
|
|
22800
|
-
accepted = transport.steer(
|
|
23128
|
+
accepted = transport.steer(text3).then(() => {
|
|
22801
23129
|
active2.acceptedSteerCount += 1;
|
|
22802
23130
|
});
|
|
22803
23131
|
active2.pendingSteers.add(accepted);
|
|
@@ -22981,6 +23309,8 @@ var OmpHarnessSession = class {
|
|
|
22981
23309
|
cwd: this.#cwd,
|
|
22982
23310
|
onFault: (error51) => queueMicrotask(() => this.#fault(error51)),
|
|
22983
23311
|
onSubagentEvent: (event) => this.handleTransportEvent(event),
|
|
23312
|
+
onAssistantStart: (message3) => this.handleAssistantStart(message3),
|
|
23313
|
+
onAssistantSummary: (messages) => this.handleAssistantSummary(messages),
|
|
22984
23314
|
onUsage: (observation) => this.handleTransportUsage(observation),
|
|
22985
23315
|
permissionMode: this.#permissionMode
|
|
22986
23316
|
});
|
|
@@ -23285,16 +23615,16 @@ var OmpHarnessSession = class {
|
|
|
23285
23615
|
active2.agentMessageId = messageId;
|
|
23286
23616
|
active2.sawAssistantMessage = true;
|
|
23287
23617
|
}
|
|
23288
|
-
#appendText(active2,
|
|
23618
|
+
#appendText(active2, text3) {
|
|
23289
23619
|
if (active2.agentMessageId === null || !active2.agentItem) {
|
|
23290
23620
|
throw new Error("Omp Assistant text arrived outside an active message");
|
|
23291
23621
|
}
|
|
23292
|
-
active2.agentItem = { ...active2.agentItem, text: active2.agentItem.text +
|
|
23622
|
+
active2.agentItem = { ...active2.agentItem, text: active2.agentItem.text + text3 };
|
|
23293
23623
|
this.#event({
|
|
23294
23624
|
type: "item.updated",
|
|
23295
23625
|
turnId: active2.command.turnId,
|
|
23296
23626
|
itemId: active2.agentItem.itemId,
|
|
23297
|
-
update: { type: "text.append", text }
|
|
23627
|
+
update: { type: "text.append", text: text3 }
|
|
23298
23628
|
});
|
|
23299
23629
|
}
|
|
23300
23630
|
#completeAgentItem(active2, outcome, completeEmpty) {
|
|
@@ -23305,8 +23635,8 @@ var OmpHarnessSession = class {
|
|
|
23305
23635
|
active2.agentItem = null;
|
|
23306
23636
|
this.#completeItem(active2, item, outcome);
|
|
23307
23637
|
}
|
|
23308
|
-
#appendReasoning(active2,
|
|
23309
|
-
if (
|
|
23638
|
+
#appendReasoning(active2, text3) {
|
|
23639
|
+
if (text3.length === 0)
|
|
23310
23640
|
return;
|
|
23311
23641
|
if (!active2.reasoningItem) {
|
|
23312
23642
|
active2.reasoningItem = {
|
|
@@ -23322,13 +23652,13 @@ var OmpHarnessSession = class {
|
|
|
23322
23652
|
}
|
|
23323
23653
|
active2.reasoningItem = {
|
|
23324
23654
|
...active2.reasoningItem,
|
|
23325
|
-
text: active2.reasoningItem.text +
|
|
23655
|
+
text: active2.reasoningItem.text + text3
|
|
23326
23656
|
};
|
|
23327
23657
|
this.#event({
|
|
23328
23658
|
type: "item.updated",
|
|
23329
23659
|
turnId: active2.command.turnId,
|
|
23330
23660
|
itemId: active2.reasoningItem.itemId,
|
|
23331
|
-
update: { type: "text.append", text }
|
|
23661
|
+
update: { type: "text.append", text: text3 }
|
|
23332
23662
|
});
|
|
23333
23663
|
}
|
|
23334
23664
|
#completeReasoning(active2, outcome) {
|
|
@@ -23453,6 +23783,7 @@ var OmpHarnessSession = class {
|
|
|
23453
23783
|
if (this.#active !== active2)
|
|
23454
23784
|
return;
|
|
23455
23785
|
this.#active = null;
|
|
23786
|
+
this.#finishAccountAttempt(void 0);
|
|
23456
23787
|
const itemOutcome2 = outcome.status === "failed" ? { status: "failed", error: outcome.error } : outcome.status === "cancelled" ? { status: "cancelled", ...outcome.reason ? { reason: outcome.reason } : {} } : { status: "succeeded" };
|
|
23457
23788
|
this.#completeReasoning(active2, itemOutcome2);
|
|
23458
23789
|
if (active2.compactionItem) {
|
|
@@ -23550,8 +23881,8 @@ var OmpAdapter = class {
|
|
|
23550
23881
|
sessionImport;
|
|
23551
23882
|
usageStatistics;
|
|
23552
23883
|
subagents = {
|
|
23553
|
-
readSnapshot: async (
|
|
23554
|
-
if (
|
|
23884
|
+
readSnapshot: async (input2) => {
|
|
23885
|
+
if (input2.parent.harnessId !== this.harnessId || input2.nativeSubagentId.trim().length === 0 || input2.cwd.length === 0) {
|
|
23555
23886
|
return {
|
|
23556
23887
|
ok: false,
|
|
23557
23888
|
error: {
|
|
@@ -23563,28 +23894,28 @@ var OmpAdapter = class {
|
|
|
23563
23894
|
}
|
|
23564
23895
|
let transport;
|
|
23565
23896
|
try {
|
|
23566
|
-
const transcriptFile = await readSubagentTranscriptFile(sessionFileFromRef(
|
|
23897
|
+
const transcriptFile = await readSubagentTranscriptFile(sessionFileFromRef(input2.parent), input2.nativeSubagentId);
|
|
23567
23898
|
if (transcriptFile.status === "read") {
|
|
23568
23899
|
const snapshot2 = mapOmpSnapshot(transcriptFile.history, {
|
|
23569
|
-
sessionId:
|
|
23900
|
+
sessionId: input2.parent.nativeSessionId,
|
|
23570
23901
|
model: null
|
|
23571
23902
|
});
|
|
23572
23903
|
return { ok: true, value: snapshot2 };
|
|
23573
23904
|
}
|
|
23574
23905
|
transport = this.#createTransport({
|
|
23575
|
-
cwd:
|
|
23576
|
-
sessionFile: sessionFileFromRef(
|
|
23906
|
+
cwd: input2.cwd,
|
|
23907
|
+
sessionFile: sessionFileFromRef(input2.parent),
|
|
23577
23908
|
subscribeSubagentEvents: false,
|
|
23578
23909
|
onFault: () => void 0
|
|
23579
23910
|
});
|
|
23580
23911
|
await transport.start();
|
|
23581
23912
|
const transcript = await transport.getSubagentMessages({
|
|
23582
|
-
subagentId:
|
|
23913
|
+
subagentId: input2.nativeSubagentId
|
|
23583
23914
|
});
|
|
23584
23915
|
const entries = transcript.entries;
|
|
23585
23916
|
const leafId = entries.at(-1)?.id;
|
|
23586
23917
|
const snapshot = mapOmpSnapshot({ entries, leafId: typeof leafId === "string" ? leafId : null }, {
|
|
23587
|
-
sessionId:
|
|
23918
|
+
sessionId: input2.parent.nativeSessionId,
|
|
23588
23919
|
model: nativeModelFromState(transport.state)
|
|
23589
23920
|
});
|
|
23590
23921
|
return { ok: true, value: snapshot };
|
|
@@ -23596,6 +23927,10 @@ var OmpAdapter = class {
|
|
|
23596
23927
|
}
|
|
23597
23928
|
};
|
|
23598
23929
|
#closeTimeoutMs;
|
|
23930
|
+
#accountCredits;
|
|
23931
|
+
#accountCommand;
|
|
23932
|
+
#environment;
|
|
23933
|
+
#sessionQuota = /* @__PURE__ */ new Map();
|
|
23599
23934
|
#createTransport;
|
|
23600
23935
|
#inspectionCache = /* @__PURE__ */ new Map();
|
|
23601
23936
|
#inspectionInFlight = /* @__PURE__ */ new Map();
|
|
@@ -23611,6 +23946,9 @@ var OmpAdapter = class {
|
|
|
23611
23946
|
createTransport: (sessionOptions) => new OmpRpcSession({ ...options, ...sessionOptions })
|
|
23612
23947
|
}) {
|
|
23613
23948
|
this.#createTransport = dependencies.createTransport;
|
|
23949
|
+
this.#accountCommand = options.command;
|
|
23950
|
+
this.#environment = { ...process.env, ...options.environment };
|
|
23951
|
+
this.#accountCredits = createOmpAccountCredits(options.command, this.#environment);
|
|
23614
23952
|
const listModels = dependencies.listModels ?? listOmpModels;
|
|
23615
23953
|
this.#listModels = ({ cwd, signal }) => listModels({
|
|
23616
23954
|
cwd,
|
|
@@ -23623,13 +23961,16 @@ var OmpAdapter = class {
|
|
|
23623
23961
|
this.#closeTimeoutMs = options.closeTimeoutMs ?? 2e3;
|
|
23624
23962
|
this.#toolOutputLimit = options.toolOutputLimit ?? DEFAULT_TOOL_OUTPUT_LIMIT;
|
|
23625
23963
|
}
|
|
23626
|
-
async
|
|
23964
|
+
async inspectAccounts() {
|
|
23965
|
+
return this.#closePromise ? [] : this.#accountCredits.inspectAccounts();
|
|
23966
|
+
}
|
|
23967
|
+
async inspect(input2 = {}) {
|
|
23627
23968
|
if (this.#closePromise)
|
|
23628
23969
|
return closedInspection();
|
|
23629
|
-
const cwd =
|
|
23630
|
-
if (
|
|
23631
|
-
const catalog =
|
|
23632
|
-
const availability =
|
|
23970
|
+
const cwd = input2.cwd ?? process.cwd();
|
|
23971
|
+
if (input2.refresh) {
|
|
23972
|
+
const catalog = input2.purpose === "availability" ? void 0 : this.#inspectionInFlight.get(cwd);
|
|
23973
|
+
const availability = input2.purpose === "availability" ? this.#availabilityInFlight.get(cwd) : void 0;
|
|
23633
23974
|
this.#inspectionCache.clear();
|
|
23634
23975
|
this.#inspectionInFlight.clear();
|
|
23635
23976
|
this.#availabilityInFlight.clear();
|
|
@@ -23644,7 +23985,7 @@ var OmpAdapter = class {
|
|
|
23644
23985
|
const cached2 = this.#inspectionCache.get(cwd);
|
|
23645
23986
|
if (cached2)
|
|
23646
23987
|
return cached2;
|
|
23647
|
-
if (
|
|
23988
|
+
if (input2.purpose === "availability")
|
|
23648
23989
|
return this.#inspectAvailability(cwd);
|
|
23649
23990
|
return this.#startFullInspection(cwd);
|
|
23650
23991
|
}
|
|
@@ -23784,11 +24125,11 @@ var OmpAdapter = class {
|
|
|
23784
24125
|
this.#inspections.delete(transport);
|
|
23785
24126
|
}
|
|
23786
24127
|
}
|
|
23787
|
-
async open(
|
|
24128
|
+
async open(input2) {
|
|
23788
24129
|
if (this.#closePromise) {
|
|
23789
24130
|
return { ok: false, error: invalidState("Omp Adapter is closed") };
|
|
23790
24131
|
}
|
|
23791
|
-
if (
|
|
24132
|
+
if (input2.cwd.length === 0) {
|
|
23792
24133
|
return {
|
|
23793
24134
|
ok: false,
|
|
23794
24135
|
error: {
|
|
@@ -23798,8 +24139,9 @@ var OmpAdapter = class {
|
|
|
23798
24139
|
}
|
|
23799
24140
|
};
|
|
23800
24141
|
}
|
|
23801
|
-
|
|
23802
|
-
|
|
24142
|
+
const environment = input2.environment ? { ...this.#environment, ...input2.environment } : this.#environment;
|
|
24143
|
+
if (input2.kind === "create") {
|
|
24144
|
+
let permissionModeId = input2.permissionModeId ?? (input2.executionPolicy === "unattended-full-access" ? encodeOmpPermissionModeId("yolo") : OMP_DEFAULT_PERMISSION_MODE_ID);
|
|
23803
24145
|
let permissionMode;
|
|
23804
24146
|
try {
|
|
23805
24147
|
permissionModeId = harnessPermissionModeIdSchema.parse(permissionModeId);
|
|
@@ -23807,8 +24149,8 @@ var OmpAdapter = class {
|
|
|
23807
24149
|
} catch (error51) {
|
|
23808
24150
|
return { ok: false, error: normalizedError(error51, "invalidRequest") };
|
|
23809
24151
|
}
|
|
23810
|
-
if (
|
|
23811
|
-
const parsed = harnessModelRefSchema.safeParse(
|
|
24152
|
+
if (input2.model) {
|
|
24153
|
+
const parsed = harnessModelRefSchema.safeParse(input2.model);
|
|
23812
24154
|
if (!parsed.success || parsed.data.serviceTier) {
|
|
23813
24155
|
return {
|
|
23814
24156
|
ok: false,
|
|
@@ -23816,7 +24158,7 @@ var OmpAdapter = class {
|
|
|
23816
24158
|
};
|
|
23817
24159
|
}
|
|
23818
24160
|
}
|
|
23819
|
-
const thinkingOptionId =
|
|
24161
|
+
const thinkingOptionId = input2.thinkingOptionId ? harnessThinkingOptionIdSchema.safeParse(input2.thinkingOptionId) : null;
|
|
23820
24162
|
if (thinkingOptionId && !thinkingOptionId.success) {
|
|
23821
24163
|
return {
|
|
23822
24164
|
ok: false,
|
|
@@ -23829,9 +24171,9 @@ var OmpAdapter = class {
|
|
|
23829
24171
|
}
|
|
23830
24172
|
return {
|
|
23831
24173
|
ok: true,
|
|
23832
|
-
value: this.#trackSession(
|
|
23833
|
-
|
|
23834
|
-
...
|
|
24174
|
+
value: this.#trackSession(input2.cwd, {
|
|
24175
|
+
environment,
|
|
24176
|
+
...input2.model ? { model: input2.model } : {},
|
|
23835
24177
|
...thinkingOptionId?.success ? { thinkingOptionId: thinkingOptionId.data } : {},
|
|
23836
24178
|
supportsThinkingSelection: this.#thinkingSelectionSupported === true,
|
|
23837
24179
|
permissionMode,
|
|
@@ -23839,7 +24181,7 @@ var OmpAdapter = class {
|
|
|
23839
24181
|
})
|
|
23840
24182
|
};
|
|
23841
24183
|
}
|
|
23842
|
-
const sourceRef = nativeSessionRefSchema.parse(
|
|
24184
|
+
const sourceRef = nativeSessionRefSchema.parse(input2.kind === "resume" ? input2.nativeRef : input2.sourceRef);
|
|
23843
24185
|
let session;
|
|
23844
24186
|
let transport;
|
|
23845
24187
|
try {
|
|
@@ -23854,8 +24196,8 @@ var OmpAdapter = class {
|
|
|
23854
24196
|
};
|
|
23855
24197
|
}
|
|
23856
24198
|
const sourceSessionFile = sessionFileFromRef(sourceRef);
|
|
23857
|
-
if (
|
|
23858
|
-
const checkpoint = nativeCheckpointRefSchema.parse(
|
|
24199
|
+
if (input2.kind === "fork") {
|
|
24200
|
+
const checkpoint = nativeCheckpointRefSchema.parse(input2.checkpoint);
|
|
23859
24201
|
if (checkpoint.harnessId !== this.harnessId || checkpoint.nativeSessionId !== sourceRef.nativeSessionId) {
|
|
23860
24202
|
throw new OmpAdapterFaultError({
|
|
23861
24203
|
code: "checkpointNotFound",
|
|
@@ -23865,14 +24207,17 @@ var OmpAdapter = class {
|
|
|
23865
24207
|
}
|
|
23866
24208
|
}
|
|
23867
24209
|
transport = this.#createTransport({
|
|
23868
|
-
cwd:
|
|
23869
|
-
|
|
24210
|
+
cwd: input2.cwd,
|
|
24211
|
+
environment,
|
|
24212
|
+
...input2.kind === "resume" ? { sessionFile: sourceSessionFile } : { forkSessionFile: sourceSessionFile },
|
|
23870
24213
|
onFault: (error51) => session?.handleTransportFault(error51),
|
|
23871
24214
|
onSubagentEvent: (event) => session?.handleTransportEvent(event),
|
|
24215
|
+
onAssistantStart: (message3) => session?.handleAssistantStart(message3),
|
|
24216
|
+
onAssistantSummary: (messages) => session?.handleAssistantSummary(messages),
|
|
23872
24217
|
onUsage: (observation) => session?.handleTransportUsage(observation)
|
|
23873
24218
|
});
|
|
23874
24219
|
await transport.start();
|
|
23875
|
-
if (
|
|
24220
|
+
if (input2.kind === "resume") {
|
|
23876
24221
|
if (transport.state.sessionId !== sourceRef.nativeSessionId) {
|
|
23877
24222
|
throw new OmpAdapterFaultError({
|
|
23878
24223
|
code: "sessionNotFound",
|
|
@@ -23880,8 +24225,8 @@ var OmpAdapter = class {
|
|
|
23880
24225
|
retryable: false
|
|
23881
24226
|
});
|
|
23882
24227
|
}
|
|
23883
|
-
} else if (
|
|
23884
|
-
const checkpoint = nativeCheckpointRefSchema.parse(
|
|
24228
|
+
} else if (input2.kind === "fork") {
|
|
24229
|
+
const checkpoint = nativeCheckpointRefSchema.parse(input2.checkpoint);
|
|
23885
24230
|
const startupSessionId = transport.state.sessionId;
|
|
23886
24231
|
if (startupSessionId === sourceRef.nativeSessionId) {
|
|
23887
24232
|
throw new Error("Omp Fork startup did not create a distinct Native Session identity");
|
|
@@ -23909,9 +24254,9 @@ var OmpAdapter = class {
|
|
|
23909
24254
|
if (derivedSnapshot.turns.length !== boundary.targetTurnIndex + 1 || terminal?.nativeTurnRef.nativeTurnKey !== checkpoint.checkpointId) {
|
|
23910
24255
|
throw new Error("Omp Fork derived history does not match the requested Checkpoint");
|
|
23911
24256
|
}
|
|
23912
|
-
await transport.verifySessionCwd(
|
|
24257
|
+
await transport.verifySessionCwd(input2.cwd);
|
|
23913
24258
|
} else {
|
|
23914
|
-
const rolledBack = await rollbackOmpLastTurn(transport, sourceRef.nativeSessionId,
|
|
24259
|
+
const rolledBack = await rollbackOmpLastTurn(transport, sourceRef.nativeSessionId, input2.cwd);
|
|
23915
24260
|
if (!rolledBack.ok) {
|
|
23916
24261
|
throw new OmpAdapterFaultError({
|
|
23917
24262
|
code: "invalidState",
|
|
@@ -23925,10 +24270,18 @@ var OmpAdapter = class {
|
|
|
23925
24270
|
startedThinkingLevels = reconciled.thinkingLevels;
|
|
23926
24271
|
this.#thinkingSelectionSupported = startedThinkingLevels !== null;
|
|
23927
24272
|
const initialUsage = await transport.getSessionUsage().catch(() => null);
|
|
23928
|
-
const
|
|
23929
|
-
|
|
24273
|
+
const history = await transport.getEntries().catch(() => null);
|
|
24274
|
+
const usageHistory = history ? ompUsageHistory(history) : { requests: [], complete: false };
|
|
24275
|
+
let initialAccountKey = null;
|
|
24276
|
+
try {
|
|
24277
|
+
if (history)
|
|
24278
|
+
initialAccountKey = latestOmpAccount(history);
|
|
24279
|
+
} catch {
|
|
24280
|
+
}
|
|
24281
|
+
session = this.#trackSession(input2.cwd, {
|
|
23930
24282
|
usageHistory,
|
|
23931
|
-
|
|
24283
|
+
initialAccountKey,
|
|
24284
|
+
environment,
|
|
23932
24285
|
startedTransport: transport,
|
|
23933
24286
|
startedModels: await transport.getAvailableModels(),
|
|
23934
24287
|
startedThinkingLevels,
|
|
@@ -23937,10 +24290,10 @@ var OmpAdapter = class {
|
|
|
23937
24290
|
permissionMode: "yolo",
|
|
23938
24291
|
permissionModeId: OMP_DEFAULT_PERMISSION_MODE_ID
|
|
23939
24292
|
});
|
|
23940
|
-
if (
|
|
24293
|
+
if (input2.kind === "resume" && input2.permissionModeId) {
|
|
23941
24294
|
const restored = await session.execute({
|
|
23942
24295
|
type: "permissionMode.select",
|
|
23943
|
-
permissionModeId:
|
|
24296
|
+
permissionModeId: input2.permissionModeId
|
|
23944
24297
|
});
|
|
23945
24298
|
if (!restored.ok) {
|
|
23946
24299
|
await session.close();
|
|
@@ -23955,11 +24308,26 @@ var OmpAdapter = class {
|
|
|
23955
24308
|
}
|
|
23956
24309
|
#trackSession(cwd, options) {
|
|
23957
24310
|
const environment = options.environment;
|
|
23958
|
-
const
|
|
23959
|
-
const
|
|
24311
|
+
const entries = Object.entries(environment).filter(([name]) => name !== "CODEXHOST_THREAD_ID").sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
24312
|
+
const key = createHash("sha256").update(JSON.stringify([cwd, entries])).digest("hex");
|
|
24313
|
+
let quota = this.#sessionQuota.get(key);
|
|
24314
|
+
if (!quota) {
|
|
24315
|
+
quota = {
|
|
24316
|
+
credits: createOmpAccountCredits(this.#accountCommand, environment, cwd),
|
|
24317
|
+
sessions: 0
|
|
24318
|
+
};
|
|
24319
|
+
this.#sessionQuota.set(key, quota);
|
|
24320
|
+
}
|
|
24321
|
+
const shared = quota;
|
|
24322
|
+
shared.sessions++;
|
|
24323
|
+
const session = new OmpHarnessSession(cwd, (input2) => this.#createTransport({ ...input2, environment }), () => {
|
|
23960
24324
|
this.#sessions.delete(session);
|
|
24325
|
+
if (--shared.sessions === 0)
|
|
24326
|
+
this.#sessionQuota.delete(key);
|
|
23961
24327
|
}, {
|
|
23962
24328
|
closeTimeoutMs: this.#closeTimeoutMs,
|
|
24329
|
+
accountCredits: shared.credits,
|
|
24330
|
+
...options.initialAccountKey !== void 0 ? { initialAccountKey: options.initialAccountKey } : {},
|
|
23963
24331
|
...options.model ? { model: options.model } : {},
|
|
23964
24332
|
...options.thinkingOptionId ? { thinkingOptionId: options.thinkingOptionId } : {},
|
|
23965
24333
|
toolOutputLimit: this.#toolOutputLimit,
|