@codexhost/cli-linux-arm64 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +3968 -4082
- package/app/console-web.js +6822 -2065
- package/app/desktop-controller.mjs +13620 -2977
- package/app/host-runtime.mjs +12025 -12636
- package/app/plugins/antigravity/plugin.mjs +2382 -1452
- package/app/plugins/claude-code/plugin.mjs +2248 -1645
- package/app/plugins/codebuddy/plugin.mjs +1753 -1215
- package/app/plugins/codex-usage/plugin.mjs +1214 -915
- package/app/plugins/copilot/plugin.mjs +1239 -919
- package/app/plugins/cursor-cli/plugin.mjs +1549 -1099
- package/app/plugins/deepseek-harness/plugin.mjs +1955 -1484
- package/app/plugins/devin/plugin.mjs +1295 -978
- package/app/plugins/grok/plugin.mjs +1772 -1482
- package/app/plugins/hermes/plugin.mjs +1485 -1184
- package/app/plugins/kimi-code/plugin.mjs +1388 -1093
- package/app/plugins/kiro-cli/plugin.mjs +1349 -1036
- package/app/plugins/omp/plugin.mjs +2027 -1420
- package/app/plugins/opencode/plugin.mjs +2219 -1844
- package/app/plugins/pi/plugin.mjs +1956 -1606
- package/app/plugins/qoder/plugin.mjs +1536 -1229
- package/app/plugins/qoder-cn/plugin.mjs +1536 -1229
- package/app/plugins/qwen-code/plugin.mjs +1490 -1198
- package/app/plugins/workbuddy/plugin.mjs +1757 -1221
- package/app/plugins/zcode/plugin.mjs +1841 -1072
- package/app/renderer-extension.js +12894 -8392
- package/app/web/assets/index-CTCFIQbU.css +1 -0
- package/app/web/assets/index-DUOvhHbV.js +203 -0
- package/app/web/codexhost-settings.js +4811 -36168
- package/app/web/index.html +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +64 -64
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-api-workspace-controller/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-shortcuts/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-approval/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-brand-official/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -74
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +75 -64
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +98 -95
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +9 -9
- package/app/web/sw.js +8 -1
- package/app/web-modules/server.mjs +4752 -6790
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-DJW4bmyx.css +0 -1
- package/app/web/assets/index-Dyh1KzAB.js +0 -201
|
@@ -32,10 +32,10 @@ function executableExtensions(command, platform, environment) {
|
|
|
32
32
|
return [""];
|
|
33
33
|
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
34
34
|
}
|
|
35
|
-
function isExecutableFile(
|
|
35
|
+
function isExecutableFile(filePath2, platform) {
|
|
36
36
|
try {
|
|
37
|
-
fs.accessSync(
|
|
38
|
-
return fs.statSync(
|
|
37
|
+
fs.accessSync(filePath2, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
38
|
+
return fs.statSync(filePath2).isFile();
|
|
39
39
|
} catch {
|
|
40
40
|
return false;
|
|
41
41
|
}
|
|
@@ -147,8 +147,8 @@ var VERSION_MANAGER_ROOTS = "<version-managers>";
|
|
|
147
147
|
function installRootExtensions(platform) {
|
|
148
148
|
return platform === "win32" ? [".exe", ".cmd"] : [""];
|
|
149
149
|
}
|
|
150
|
-
function resolveHomeDirectory(
|
|
151
|
-
return
|
|
150
|
+
function resolveHomeDirectory(input2) {
|
|
151
|
+
return input2.homeDirectory ?? environmentValue(input2.environment, "HOME") ?? environmentValue(input2.environment, "USERPROFILE") ?? os.homedir();
|
|
152
152
|
}
|
|
153
153
|
function templateVariables(environment, platform, home) {
|
|
154
154
|
const pathFlavor = targetPath(platform);
|
|
@@ -181,36 +181,36 @@ function expandInstallRoot(template, environment, platform, home) {
|
|
|
181
181
|
});
|
|
182
182
|
return unresolved ? void 0 : joinTemplate(platform, substituted);
|
|
183
183
|
}
|
|
184
|
-
function installRootDirectories(spec,
|
|
184
|
+
function installRootDirectories(spec, input2, dependencies, platform, home) {
|
|
185
185
|
const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
|
|
186
186
|
const directories = [];
|
|
187
187
|
for (const template of templates) {
|
|
188
188
|
if (template === VERSION_MANAGER_ROOTS) {
|
|
189
189
|
directories.push(...versionManagerBinaryDirectories({
|
|
190
190
|
platform,
|
|
191
|
-
environment:
|
|
191
|
+
environment: input2.environment,
|
|
192
192
|
home,
|
|
193
193
|
...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
|
|
194
194
|
}));
|
|
195
195
|
continue;
|
|
196
196
|
}
|
|
197
|
-
const directory = expandInstallRoot(template,
|
|
197
|
+
const directory = expandInstallRoot(template, input2.environment, platform, home);
|
|
198
198
|
if (directory !== void 0)
|
|
199
199
|
directories.push(directory);
|
|
200
200
|
}
|
|
201
201
|
return directories;
|
|
202
202
|
}
|
|
203
|
-
function harnessCandidates(spec,
|
|
204
|
-
const platform =
|
|
203
|
+
function harnessCandidates(spec, input2, dependencies = {}) {
|
|
204
|
+
const platform = input2.platform ?? process.platform;
|
|
205
205
|
const pathFlavor = targetPath(platform);
|
|
206
|
-
const configured =
|
|
206
|
+
const configured = input2.command ?? (spec.commandEnvironmentVariable ? environmentValue(input2.environment, spec.commandEnvironmentVariable) : void 0);
|
|
207
207
|
const command = configured ?? spec.command;
|
|
208
208
|
if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
209
209
|
return [{ candidate: command, source: "configured" }];
|
|
210
210
|
}
|
|
211
211
|
const candidates = [];
|
|
212
|
-
const extensions = executableExtensions(command, platform,
|
|
213
|
-
for (const directory of pathDirectories(
|
|
212
|
+
const extensions = executableExtensions(command, platform, input2.environment);
|
|
213
|
+
for (const directory of pathDirectories(input2.environment, platform)) {
|
|
214
214
|
for (const extension of extensions) {
|
|
215
215
|
candidates.push({
|
|
216
216
|
candidate: pathFlavor.join(directory, command + extension),
|
|
@@ -220,8 +220,8 @@ function harnessCandidates(spec, input, dependencies = {}) {
|
|
|
220
220
|
}
|
|
221
221
|
if (configured !== void 0)
|
|
222
222
|
return candidates;
|
|
223
|
-
const home = resolveHomeDirectory(
|
|
224
|
-
for (const directory of installRootDirectories(spec,
|
|
223
|
+
const home = resolveHomeDirectory(input2);
|
|
224
|
+
for (const directory of installRootDirectories(spec, input2, dependencies, platform, home)) {
|
|
225
225
|
for (const extension of installRootExtensions(platform)) {
|
|
226
226
|
candidates.push({
|
|
227
227
|
candidate: pathFlavor.join(directory, spec.command + extension),
|
|
@@ -231,12 +231,12 @@ function harnessCandidates(spec, input, dependencies = {}) {
|
|
|
231
231
|
}
|
|
232
232
|
return candidates;
|
|
233
233
|
}
|
|
234
|
-
function resolveHarnessExecutable(spec,
|
|
235
|
-
const platform =
|
|
234
|
+
function resolveHarnessExecutable(spec, input2, dependencies = {}) {
|
|
235
|
+
const platform = input2.platform ?? process.platform;
|
|
236
236
|
const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
|
|
237
237
|
const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
|
|
238
238
|
const context = { platform, isExecutable };
|
|
239
|
-
for (const { candidate, source } of harnessCandidates(spec,
|
|
239
|
+
for (const { candidate, source } of harnessCandidates(spec, input2, dependencies)) {
|
|
240
240
|
const executable = runnable(candidate, context);
|
|
241
241
|
if (executable !== void 0 && isExecutable(executable))
|
|
242
242
|
return { executable, source };
|
|
@@ -247,13 +247,13 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
|
|
|
247
247
|
// ../../harness-discovery/dist/installation.js
|
|
248
248
|
import { execFile } from "node:child_process";
|
|
249
249
|
import { homedir } from "node:os";
|
|
250
|
-
function runInstallationCommand(command, args, environment, timeout = 3e4) {
|
|
250
|
+
function runInstallationCommand(command, args, environment, timeout = 3e4, cwd) {
|
|
251
251
|
const env = withNodeRuntimeOnPath(environment);
|
|
252
252
|
const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
|
|
253
253
|
return new Promise((resolve, reject) => {
|
|
254
254
|
const child = execFile(invocation.command, invocation.arguments, {
|
|
255
255
|
env,
|
|
256
|
-
cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
|
|
256
|
+
cwd: cwd ?? env.HOME ?? env.USERPROFILE ?? homedir(),
|
|
257
257
|
encoding: "utf8",
|
|
258
258
|
timeout,
|
|
259
259
|
killSignal: "SIGKILL",
|
|
@@ -280,7 +280,7 @@ function createInstallationManager(options) {
|
|
|
280
280
|
const check2 = () => checking ??= options.check().finally(() => {
|
|
281
281
|
checking = void 0;
|
|
282
282
|
});
|
|
283
|
-
return (action) => {
|
|
283
|
+
return (action, confirmedVersion) => {
|
|
284
284
|
if (updating)
|
|
285
285
|
return updating;
|
|
286
286
|
if (action === "check")
|
|
@@ -291,6 +291,8 @@ function createInstallationManager(options) {
|
|
|
291
291
|
return before;
|
|
292
292
|
if (!before.canUpdate)
|
|
293
293
|
throw new Error(before.message ?? "This installation cannot be updated automatically");
|
|
294
|
+
if ((before.latestVerifiedVersion !== void 0 || confirmedVersion !== void 0) && before.latestVersion !== confirmedVersion)
|
|
295
|
+
return { ...before, confirmationRequired: true };
|
|
294
296
|
await options.update(before);
|
|
295
297
|
const after = await check2();
|
|
296
298
|
if (after.currentVersion === before.currentVersion)
|
|
@@ -1077,8 +1079,8 @@ function cached(getter) {
|
|
|
1077
1079
|
}
|
|
1078
1080
|
};
|
|
1079
1081
|
}
|
|
1080
|
-
function nullish(
|
|
1081
|
-
return
|
|
1082
|
+
function nullish(input2) {
|
|
1083
|
+
return input2 === null || input2 === void 0;
|
|
1082
1084
|
}
|
|
1083
1085
|
function cleanRegex(source) {
|
|
1084
1086
|
const start = source.startsWith("^") ? 1 : 0;
|
|
@@ -1165,8 +1167,8 @@ function randomString(length = 10) {
|
|
|
1165
1167
|
function esc(str2) {
|
|
1166
1168
|
return JSON.stringify(str2);
|
|
1167
1169
|
}
|
|
1168
|
-
function slugify(
|
|
1169
|
-
return
|
|
1170
|
+
function slugify(input2) {
|
|
1171
|
+
return input2.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1170
1172
|
}
|
|
1171
1173
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
1172
1174
|
};
|
|
@@ -1571,19 +1573,19 @@ function finalizeIssue(iss, ctx, config2) {
|
|
|
1571
1573
|
}
|
|
1572
1574
|
return rest;
|
|
1573
1575
|
}
|
|
1574
|
-
function getSizableOrigin(
|
|
1575
|
-
if (
|
|
1576
|
+
function getSizableOrigin(input2) {
|
|
1577
|
+
if (input2 instanceof Set)
|
|
1576
1578
|
return "set";
|
|
1577
|
-
if (
|
|
1579
|
+
if (input2 instanceof Map)
|
|
1578
1580
|
return "map";
|
|
1579
|
-
if (
|
|
1581
|
+
if (input2 instanceof File)
|
|
1580
1582
|
return "file";
|
|
1581
1583
|
return "unknown";
|
|
1582
1584
|
}
|
|
1583
|
-
function getLengthableOrigin(
|
|
1584
|
-
if (Array.isArray(
|
|
1585
|
+
function getLengthableOrigin(input2) {
|
|
1586
|
+
if (Array.isArray(input2))
|
|
1585
1587
|
return "array";
|
|
1586
|
-
if (typeof
|
|
1588
|
+
if (typeof input2 === "string")
|
|
1587
1589
|
return "string";
|
|
1588
1590
|
return "unknown";
|
|
1589
1591
|
}
|
|
@@ -1609,12 +1611,12 @@ function parsedType(data) {
|
|
|
1609
1611
|
return t;
|
|
1610
1612
|
}
|
|
1611
1613
|
function issue(...args) {
|
|
1612
|
-
const [iss,
|
|
1614
|
+
const [iss, input2, inst] = args;
|
|
1613
1615
|
if (typeof iss === "string") {
|
|
1614
1616
|
return {
|
|
1615
1617
|
message: iss,
|
|
1616
1618
|
code: "custom",
|
|
1617
|
-
input,
|
|
1619
|
+
input: input2,
|
|
1618
1620
|
inst
|
|
1619
1621
|
};
|
|
1620
1622
|
}
|
|
@@ -1625,8 +1627,8 @@ function cleanEnum(obj2) {
|
|
|
1625
1627
|
return Number.isNaN(Number.parseInt(k, 10));
|
|
1626
1628
|
}).map((el) => el[1]);
|
|
1627
1629
|
}
|
|
1628
|
-
function base64ToUint8Array(
|
|
1629
|
-
const binaryString = atob(
|
|
1630
|
+
function base64ToUint8Array(base644) {
|
|
1631
|
+
const binaryString = atob(base644);
|
|
1630
1632
|
const bytes = new Uint8Array(binaryString.length);
|
|
1631
1633
|
for (let i = 0; i < binaryString.length; i++) {
|
|
1632
1634
|
bytes[i] = binaryString.charCodeAt(i);
|
|
@@ -1641,9 +1643,9 @@ function uint8ArrayToBase64(bytes) {
|
|
|
1641
1643
|
return btoa(binaryString);
|
|
1642
1644
|
}
|
|
1643
1645
|
function base64urlToUint8Array(base64url3) {
|
|
1644
|
-
const
|
|
1645
|
-
const padding = "=".repeat((4 -
|
|
1646
|
-
return base64ToUint8Array(
|
|
1646
|
+
const base644 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
|
|
1647
|
+
const padding = "=".repeat((4 - base644.length % 4) % 4);
|
|
1648
|
+
return base64ToUint8Array(base644 + padding);
|
|
1647
1649
|
}
|
|
1648
1650
|
function uint8ArrayToBase64url(bytes) {
|
|
1649
1651
|
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
@@ -2158,23 +2160,23 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2158
2160
|
bag.pattern = integer;
|
|
2159
2161
|
});
|
|
2160
2162
|
inst._zod.check = (payload) => {
|
|
2161
|
-
const
|
|
2163
|
+
const input2 = payload.value;
|
|
2162
2164
|
if (isInt) {
|
|
2163
|
-
if (!Number.isInteger(
|
|
2165
|
+
if (!Number.isInteger(input2)) {
|
|
2164
2166
|
payload.issues.push({
|
|
2165
2167
|
expected: origin,
|
|
2166
2168
|
format: def.format,
|
|
2167
2169
|
code: "invalid_type",
|
|
2168
2170
|
continue: false,
|
|
2169
|
-
input,
|
|
2171
|
+
input: input2,
|
|
2170
2172
|
inst
|
|
2171
2173
|
});
|
|
2172
2174
|
return;
|
|
2173
2175
|
}
|
|
2174
|
-
if (!Number.isSafeInteger(
|
|
2175
|
-
if (
|
|
2176
|
+
if (!Number.isSafeInteger(input2)) {
|
|
2177
|
+
if (input2 > 0) {
|
|
2176
2178
|
payload.issues.push({
|
|
2177
|
-
input,
|
|
2179
|
+
input: input2,
|
|
2178
2180
|
code: "too_big",
|
|
2179
2181
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
2180
2182
|
note: "Integers must be within the safe integer range.",
|
|
@@ -2185,7 +2187,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2185
2187
|
});
|
|
2186
2188
|
} else {
|
|
2187
2189
|
payload.issues.push({
|
|
2188
|
-
input,
|
|
2190
|
+
input: input2,
|
|
2189
2191
|
code: "too_small",
|
|
2190
2192
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
2191
2193
|
note: "Integers must be within the safe integer range.",
|
|
@@ -2198,10 +2200,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2198
2200
|
return;
|
|
2199
2201
|
}
|
|
2200
2202
|
}
|
|
2201
|
-
if (
|
|
2203
|
+
if (input2 < minimum) {
|
|
2202
2204
|
payload.issues.push({
|
|
2203
2205
|
origin: "number",
|
|
2204
|
-
input,
|
|
2206
|
+
input: input2,
|
|
2205
2207
|
code: "too_small",
|
|
2206
2208
|
minimum,
|
|
2207
2209
|
inclusive: true,
|
|
@@ -2209,10 +2211,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
2209
2211
|
continue: !def.abort
|
|
2210
2212
|
});
|
|
2211
2213
|
}
|
|
2212
|
-
if (
|
|
2214
|
+
if (input2 > maximum) {
|
|
2213
2215
|
payload.issues.push({
|
|
2214
2216
|
origin: "number",
|
|
2215
|
-
input,
|
|
2217
|
+
input: input2,
|
|
2216
2218
|
code: "too_big",
|
|
2217
2219
|
maximum,
|
|
2218
2220
|
inclusive: true,
|
|
@@ -2232,11 +2234,11 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
2232
2234
|
bag.maximum = maximum;
|
|
2233
2235
|
});
|
|
2234
2236
|
inst._zod.check = (payload) => {
|
|
2235
|
-
const
|
|
2236
|
-
if (
|
|
2237
|
+
const input2 = payload.value;
|
|
2238
|
+
if (input2 < minimum) {
|
|
2237
2239
|
payload.issues.push({
|
|
2238
2240
|
origin: "bigint",
|
|
2239
|
-
input,
|
|
2241
|
+
input: input2,
|
|
2240
2242
|
code: "too_small",
|
|
2241
2243
|
minimum,
|
|
2242
2244
|
inclusive: true,
|
|
@@ -2244,10 +2246,10 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
2244
2246
|
continue: !def.abort
|
|
2245
2247
|
});
|
|
2246
2248
|
}
|
|
2247
|
-
if (
|
|
2249
|
+
if (input2 > maximum) {
|
|
2248
2250
|
payload.issues.push({
|
|
2249
2251
|
origin: "bigint",
|
|
2250
|
-
input,
|
|
2252
|
+
input: input2,
|
|
2251
2253
|
code: "too_big",
|
|
2252
2254
|
maximum,
|
|
2253
2255
|
inclusive: true,
|
|
@@ -2270,16 +2272,16 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
|
|
|
2270
2272
|
inst2._zod.bag.maximum = def.maximum;
|
|
2271
2273
|
});
|
|
2272
2274
|
inst._zod.check = (payload) => {
|
|
2273
|
-
const
|
|
2274
|
-
const size =
|
|
2275
|
+
const input2 = payload.value;
|
|
2276
|
+
const size = input2.size;
|
|
2275
2277
|
if (size <= def.maximum)
|
|
2276
2278
|
return;
|
|
2277
2279
|
payload.issues.push({
|
|
2278
|
-
origin: getSizableOrigin(
|
|
2280
|
+
origin: getSizableOrigin(input2),
|
|
2279
2281
|
code: "too_big",
|
|
2280
2282
|
maximum: def.maximum,
|
|
2281
2283
|
inclusive: true,
|
|
2282
|
-
input,
|
|
2284
|
+
input: input2,
|
|
2283
2285
|
inst,
|
|
2284
2286
|
continue: !def.abort
|
|
2285
2287
|
});
|
|
@@ -2298,16 +2300,16 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
|
|
|
2298
2300
|
inst2._zod.bag.minimum = def.minimum;
|
|
2299
2301
|
});
|
|
2300
2302
|
inst._zod.check = (payload) => {
|
|
2301
|
-
const
|
|
2302
|
-
const size =
|
|
2303
|
+
const input2 = payload.value;
|
|
2304
|
+
const size = input2.size;
|
|
2303
2305
|
if (size >= def.minimum)
|
|
2304
2306
|
return;
|
|
2305
2307
|
payload.issues.push({
|
|
2306
|
-
origin: getSizableOrigin(
|
|
2308
|
+
origin: getSizableOrigin(input2),
|
|
2307
2309
|
code: "too_small",
|
|
2308
2310
|
minimum: def.minimum,
|
|
2309
2311
|
inclusive: true,
|
|
2310
|
-
input,
|
|
2312
|
+
input: input2,
|
|
2311
2313
|
inst,
|
|
2312
2314
|
continue: !def.abort
|
|
2313
2315
|
});
|
|
@@ -2327,13 +2329,13 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
|
|
|
2327
2329
|
bag.size = def.size;
|
|
2328
2330
|
});
|
|
2329
2331
|
inst._zod.check = (payload) => {
|
|
2330
|
-
const
|
|
2331
|
-
const size =
|
|
2332
|
+
const input2 = payload.value;
|
|
2333
|
+
const size = input2.size;
|
|
2332
2334
|
if (size === def.size)
|
|
2333
2335
|
return;
|
|
2334
2336
|
const tooBig = size > def.size;
|
|
2335
2337
|
payload.issues.push({
|
|
2336
|
-
origin: getSizableOrigin(
|
|
2338
|
+
origin: getSizableOrigin(input2),
|
|
2337
2339
|
...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
|
|
2338
2340
|
inclusive: true,
|
|
2339
2341
|
exact: true,
|
|
@@ -2356,17 +2358,17 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
2356
2358
|
inst2._zod.bag.maximum = def.maximum;
|
|
2357
2359
|
});
|
|
2358
2360
|
inst._zod.check = (payload) => {
|
|
2359
|
-
const
|
|
2360
|
-
const length =
|
|
2361
|
+
const input2 = payload.value;
|
|
2362
|
+
const length = input2.length;
|
|
2361
2363
|
if (length <= def.maximum)
|
|
2362
2364
|
return;
|
|
2363
|
-
const origin = getLengthableOrigin(
|
|
2365
|
+
const origin = getLengthableOrigin(input2);
|
|
2364
2366
|
payload.issues.push({
|
|
2365
2367
|
origin,
|
|
2366
2368
|
code: "too_big",
|
|
2367
2369
|
maximum: def.maximum,
|
|
2368
2370
|
inclusive: true,
|
|
2369
|
-
input,
|
|
2371
|
+
input: input2,
|
|
2370
2372
|
inst,
|
|
2371
2373
|
continue: !def.abort
|
|
2372
2374
|
});
|
|
@@ -2385,17 +2387,17 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
2385
2387
|
inst2._zod.bag.minimum = def.minimum;
|
|
2386
2388
|
});
|
|
2387
2389
|
inst._zod.check = (payload) => {
|
|
2388
|
-
const
|
|
2389
|
-
const length =
|
|
2390
|
+
const input2 = payload.value;
|
|
2391
|
+
const length = input2.length;
|
|
2390
2392
|
if (length >= def.minimum)
|
|
2391
2393
|
return;
|
|
2392
|
-
const origin = getLengthableOrigin(
|
|
2394
|
+
const origin = getLengthableOrigin(input2);
|
|
2393
2395
|
payload.issues.push({
|
|
2394
2396
|
origin,
|
|
2395
2397
|
code: "too_small",
|
|
2396
2398
|
minimum: def.minimum,
|
|
2397
2399
|
inclusive: true,
|
|
2398
|
-
input,
|
|
2400
|
+
input: input2,
|
|
2399
2401
|
inst,
|
|
2400
2402
|
continue: !def.abort
|
|
2401
2403
|
});
|
|
@@ -2415,11 +2417,11 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
2415
2417
|
bag.length = def.length;
|
|
2416
2418
|
});
|
|
2417
2419
|
inst._zod.check = (payload) => {
|
|
2418
|
-
const
|
|
2419
|
-
const length =
|
|
2420
|
+
const input2 = payload.value;
|
|
2421
|
+
const length = input2.length;
|
|
2420
2422
|
if (length === def.length)
|
|
2421
2423
|
return;
|
|
2422
|
-
const origin = getLengthableOrigin(
|
|
2424
|
+
const origin = getLengthableOrigin(input2);
|
|
2423
2425
|
const tooBig = length > def.length;
|
|
2424
2426
|
payload.issues.push({
|
|
2425
2427
|
origin,
|
|
@@ -3009,8 +3011,8 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
|
3009
3011
|
function isValidBase64URL(data) {
|
|
3010
3012
|
if (!base64url.test(data))
|
|
3011
3013
|
return false;
|
|
3012
|
-
const
|
|
3013
|
-
const padded =
|
|
3014
|
+
const base644 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
3015
|
+
const padded = base644.padEnd(Math.ceil(base644.length / 4) * 4, "=");
|
|
3014
3016
|
return isValidBase64(padded);
|
|
3015
3017
|
}
|
|
3016
3018
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
@@ -3090,15 +3092,15 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
3090
3092
|
payload.value = Number(payload.value);
|
|
3091
3093
|
} catch (_) {
|
|
3092
3094
|
}
|
|
3093
|
-
const
|
|
3094
|
-
if (typeof
|
|
3095
|
+
const input2 = payload.value;
|
|
3096
|
+
if (typeof input2 === "number" && !Number.isNaN(input2) && Number.isFinite(input2)) {
|
|
3095
3097
|
return payload;
|
|
3096
3098
|
}
|
|
3097
|
-
const received = typeof
|
|
3099
|
+
const received = typeof input2 === "number" ? Number.isNaN(input2) ? "NaN" : !Number.isFinite(input2) ? "Infinity" : void 0 : void 0;
|
|
3098
3100
|
payload.issues.push({
|
|
3099
3101
|
expected: "number",
|
|
3100
3102
|
code: "invalid_type",
|
|
3101
|
-
input,
|
|
3103
|
+
input: input2,
|
|
3102
3104
|
inst,
|
|
3103
3105
|
...received ? { received } : {}
|
|
3104
3106
|
});
|
|
@@ -3118,13 +3120,13 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
|
3118
3120
|
payload.value = Boolean(payload.value);
|
|
3119
3121
|
} catch (_) {
|
|
3120
3122
|
}
|
|
3121
|
-
const
|
|
3122
|
-
if (typeof
|
|
3123
|
+
const input2 = payload.value;
|
|
3124
|
+
if (typeof input2 === "boolean")
|
|
3123
3125
|
return payload;
|
|
3124
3126
|
payload.issues.push({
|
|
3125
3127
|
expected: "boolean",
|
|
3126
3128
|
code: "invalid_type",
|
|
3127
|
-
input,
|
|
3129
|
+
input: input2,
|
|
3128
3130
|
inst
|
|
3129
3131
|
});
|
|
3130
3132
|
return payload;
|
|
@@ -3157,13 +3159,13 @@ var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, d
|
|
|
3157
3159
|
var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
|
|
3158
3160
|
$ZodType.init(inst, def);
|
|
3159
3161
|
inst._zod.parse = (payload, _ctx) => {
|
|
3160
|
-
const
|
|
3161
|
-
if (typeof
|
|
3162
|
+
const input2 = payload.value;
|
|
3163
|
+
if (typeof input2 === "symbol")
|
|
3162
3164
|
return payload;
|
|
3163
3165
|
payload.issues.push({
|
|
3164
3166
|
expected: "symbol",
|
|
3165
3167
|
code: "invalid_type",
|
|
3166
|
-
input,
|
|
3168
|
+
input: input2,
|
|
3167
3169
|
inst
|
|
3168
3170
|
});
|
|
3169
3171
|
return payload;
|
|
@@ -3174,13 +3176,13 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) =>
|
|
|
3174
3176
|
inst._zod.pattern = _undefined;
|
|
3175
3177
|
inst._zod.values = /* @__PURE__ */ new Set([void 0]);
|
|
3176
3178
|
inst._zod.parse = (payload, _ctx) => {
|
|
3177
|
-
const
|
|
3178
|
-
if (typeof
|
|
3179
|
+
const input2 = payload.value;
|
|
3180
|
+
if (typeof input2 === "undefined")
|
|
3179
3181
|
return payload;
|
|
3180
3182
|
payload.issues.push({
|
|
3181
3183
|
expected: "undefined",
|
|
3182
3184
|
code: "invalid_type",
|
|
3183
|
-
input,
|
|
3185
|
+
input: input2,
|
|
3184
3186
|
inst
|
|
3185
3187
|
});
|
|
3186
3188
|
return payload;
|
|
@@ -3191,13 +3193,13 @@ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
|
|
|
3191
3193
|
inst._zod.pattern = _null;
|
|
3192
3194
|
inst._zod.values = /* @__PURE__ */ new Set([null]);
|
|
3193
3195
|
inst._zod.parse = (payload, _ctx) => {
|
|
3194
|
-
const
|
|
3195
|
-
if (
|
|
3196
|
+
const input2 = payload.value;
|
|
3197
|
+
if (input2 === null)
|
|
3196
3198
|
return payload;
|
|
3197
3199
|
payload.issues.push({
|
|
3198
3200
|
expected: "null",
|
|
3199
3201
|
code: "invalid_type",
|
|
3200
|
-
input,
|
|
3202
|
+
input: input2,
|
|
3201
3203
|
inst
|
|
3202
3204
|
});
|
|
3203
3205
|
return payload;
|
|
@@ -3226,13 +3228,13 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
|
3226
3228
|
var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
|
|
3227
3229
|
$ZodType.init(inst, def);
|
|
3228
3230
|
inst._zod.parse = (payload, _ctx) => {
|
|
3229
|
-
const
|
|
3230
|
-
if (typeof
|
|
3231
|
+
const input2 = payload.value;
|
|
3232
|
+
if (typeof input2 === "undefined")
|
|
3231
3233
|
return payload;
|
|
3232
3234
|
payload.issues.push({
|
|
3233
3235
|
expected: "void",
|
|
3234
3236
|
code: "invalid_type",
|
|
3235
|
-
input,
|
|
3237
|
+
input: input2,
|
|
3236
3238
|
inst
|
|
3237
3239
|
});
|
|
3238
3240
|
return payload;
|
|
@@ -3247,15 +3249,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
3247
3249
|
} catch (_err) {
|
|
3248
3250
|
}
|
|
3249
3251
|
}
|
|
3250
|
-
const
|
|
3251
|
-
const isDate =
|
|
3252
|
-
const isValidDate = isDate && !Number.isNaN(
|
|
3252
|
+
const input2 = payload.value;
|
|
3253
|
+
const isDate = input2 instanceof Date;
|
|
3254
|
+
const isValidDate = isDate && !Number.isNaN(input2.getTime());
|
|
3253
3255
|
if (isValidDate)
|
|
3254
3256
|
return payload;
|
|
3255
3257
|
payload.issues.push({
|
|
3256
3258
|
expected: "date",
|
|
3257
3259
|
code: "invalid_type",
|
|
3258
|
-
input,
|
|
3260
|
+
input: input2,
|
|
3259
3261
|
...isDate ? { received: "Invalid Date" } : {},
|
|
3260
3262
|
inst
|
|
3261
3263
|
});
|
|
@@ -3271,20 +3273,20 @@ function handleArrayResult(result, final, index) {
|
|
|
3271
3273
|
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
3272
3274
|
$ZodType.init(inst, def);
|
|
3273
3275
|
inst._zod.parse = (payload, ctx) => {
|
|
3274
|
-
const
|
|
3275
|
-
if (!Array.isArray(
|
|
3276
|
+
const input2 = payload.value;
|
|
3277
|
+
if (!Array.isArray(input2)) {
|
|
3276
3278
|
payload.issues.push({
|
|
3277
3279
|
expected: "array",
|
|
3278
3280
|
code: "invalid_type",
|
|
3279
|
-
input,
|
|
3281
|
+
input: input2,
|
|
3280
3282
|
inst
|
|
3281
3283
|
});
|
|
3282
3284
|
return payload;
|
|
3283
3285
|
}
|
|
3284
|
-
payload.value = Array(
|
|
3286
|
+
payload.value = Array(input2.length);
|
|
3285
3287
|
const proms = [];
|
|
3286
|
-
for (let i = 0; i <
|
|
3287
|
-
const item =
|
|
3288
|
+
for (let i = 0; i < input2.length; i++) {
|
|
3289
|
+
const item = input2[i];
|
|
3288
3290
|
const result = def.element._zod.run({
|
|
3289
3291
|
value: item,
|
|
3290
3292
|
issues: []
|
|
@@ -3301,8 +3303,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
3301
3303
|
return payload;
|
|
3302
3304
|
};
|
|
3303
3305
|
});
|
|
3304
|
-
function handlePropertyResult(result, final, key,
|
|
3305
|
-
const isPresent = key in
|
|
3306
|
+
function handlePropertyResult(result, final, key, input2, isOptionalIn, isOptionalOut) {
|
|
3307
|
+
const isPresent = key in input2;
|
|
3306
3308
|
if (result.issues.length) {
|
|
3307
3309
|
if (isOptionalIn && isOptionalOut && !isPresent) {
|
|
3308
3310
|
return;
|
|
@@ -3344,14 +3346,14 @@ function normalizeDef(def) {
|
|
|
3344
3346
|
optionalKeys: new Set(okeys)
|
|
3345
3347
|
};
|
|
3346
3348
|
}
|
|
3347
|
-
function handleCatchall(proms,
|
|
3349
|
+
function handleCatchall(proms, input2, payload, ctx, def, inst) {
|
|
3348
3350
|
const unrecognized = [];
|
|
3349
3351
|
const keySet = def.keySet;
|
|
3350
3352
|
const _catchall = def.catchall._zod;
|
|
3351
3353
|
const t = _catchall.def.type;
|
|
3352
3354
|
const isOptionalIn = _catchall.optin === "optional";
|
|
3353
3355
|
const isOptionalOut = _catchall.optout === "optional";
|
|
3354
|
-
for (const key in
|
|
3356
|
+
for (const key in input2) {
|
|
3355
3357
|
if (key === "__proto__")
|
|
3356
3358
|
continue;
|
|
3357
3359
|
if (keySet.has(key))
|
|
@@ -3360,18 +3362,18 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
3360
3362
|
unrecognized.push(key);
|
|
3361
3363
|
continue;
|
|
3362
3364
|
}
|
|
3363
|
-
const r = _catchall.run({ value:
|
|
3365
|
+
const r = _catchall.run({ value: input2[key], issues: [] }, ctx);
|
|
3364
3366
|
if (r instanceof Promise) {
|
|
3365
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
3367
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
|
|
3366
3368
|
} else {
|
|
3367
|
-
handlePropertyResult(r, payload, key,
|
|
3369
|
+
handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
|
|
3368
3370
|
}
|
|
3369
3371
|
}
|
|
3370
3372
|
if (unrecognized.length) {
|
|
3371
3373
|
payload.issues.push({
|
|
3372
3374
|
code: "unrecognized_keys",
|
|
3373
3375
|
keys: unrecognized,
|
|
3374
|
-
input,
|
|
3376
|
+
input: input2,
|
|
3375
3377
|
inst
|
|
3376
3378
|
});
|
|
3377
3379
|
}
|
|
@@ -3415,12 +3417,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3415
3417
|
let value;
|
|
3416
3418
|
inst._zod.parse = (payload, ctx) => {
|
|
3417
3419
|
value ?? (value = _normalized.value);
|
|
3418
|
-
const
|
|
3419
|
-
if (!isObject2(
|
|
3420
|
+
const input2 = payload.value;
|
|
3421
|
+
if (!isObject2(input2)) {
|
|
3420
3422
|
payload.issues.push({
|
|
3421
3423
|
expected: "object",
|
|
3422
3424
|
code: "invalid_type",
|
|
3423
|
-
input,
|
|
3425
|
+
input: input2,
|
|
3424
3426
|
inst
|
|
3425
3427
|
});
|
|
3426
3428
|
return payload;
|
|
@@ -3432,17 +3434,17 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3432
3434
|
const el = shape[key];
|
|
3433
3435
|
const isOptionalIn = el._zod.optin === "optional";
|
|
3434
3436
|
const isOptionalOut = el._zod.optout === "optional";
|
|
3435
|
-
const r = el._zod.run({ value:
|
|
3437
|
+
const r = el._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
3436
3438
|
if (r instanceof Promise) {
|
|
3437
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
3439
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
|
|
3438
3440
|
} else {
|
|
3439
|
-
handlePropertyResult(r, payload, key,
|
|
3441
|
+
handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
|
|
3440
3442
|
}
|
|
3441
3443
|
}
|
|
3442
3444
|
if (!catchall) {
|
|
3443
3445
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
3444
3446
|
}
|
|
3445
|
-
return handleCatchall(proms,
|
|
3447
|
+
return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst);
|
|
3446
3448
|
};
|
|
3447
3449
|
});
|
|
3448
3450
|
var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -3464,42 +3466,42 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3464
3466
|
}
|
|
3465
3467
|
doc.write(`const newResult = {};`);
|
|
3466
3468
|
for (const key of normalized.keys) {
|
|
3467
|
-
const
|
|
3469
|
+
const id2 = ids[key];
|
|
3468
3470
|
const k = esc(key);
|
|
3469
3471
|
const schema = shape[key];
|
|
3470
3472
|
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
3471
3473
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
3472
|
-
doc.write(`const ${
|
|
3474
|
+
doc.write(`const ${id2} = ${parseStr(key)};`);
|
|
3473
3475
|
if (isOptionalIn && isOptionalOut) {
|
|
3474
3476
|
doc.write(`
|
|
3475
|
-
if (${
|
|
3477
|
+
if (${id2}.issues.length) {
|
|
3476
3478
|
if (${k} in input) {
|
|
3477
|
-
payload.issues = payload.issues.concat(${
|
|
3479
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3478
3480
|
...iss,
|
|
3479
3481
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3480
3482
|
})));
|
|
3481
3483
|
}
|
|
3482
3484
|
}
|
|
3483
3485
|
|
|
3484
|
-
if (${
|
|
3486
|
+
if (${id2}.value === undefined) {
|
|
3485
3487
|
if (${k} in input) {
|
|
3486
3488
|
newResult[${k}] = undefined;
|
|
3487
3489
|
}
|
|
3488
3490
|
} else {
|
|
3489
|
-
newResult[${k}] = ${
|
|
3491
|
+
newResult[${k}] = ${id2}.value;
|
|
3490
3492
|
}
|
|
3491
3493
|
|
|
3492
3494
|
`);
|
|
3493
3495
|
} else if (!isOptionalIn) {
|
|
3494
3496
|
doc.write(`
|
|
3495
|
-
const ${
|
|
3496
|
-
if (${
|
|
3497
|
-
payload.issues = payload.issues.concat(${
|
|
3497
|
+
const ${id2}_present = ${k} in input;
|
|
3498
|
+
if (${id2}.issues.length) {
|
|
3499
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3498
3500
|
...iss,
|
|
3499
3501
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3500
3502
|
})));
|
|
3501
3503
|
}
|
|
3502
|
-
if (!${
|
|
3504
|
+
if (!${id2}_present && !${id2}.issues.length) {
|
|
3503
3505
|
payload.issues.push({
|
|
3504
3506
|
code: "invalid_type",
|
|
3505
3507
|
expected: "nonoptional",
|
|
@@ -3508,30 +3510,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3508
3510
|
});
|
|
3509
3511
|
}
|
|
3510
3512
|
|
|
3511
|
-
if (${
|
|
3512
|
-
if (${
|
|
3513
|
+
if (${id2}_present) {
|
|
3514
|
+
if (${id2}.value === undefined) {
|
|
3513
3515
|
newResult[${k}] = undefined;
|
|
3514
3516
|
} else {
|
|
3515
|
-
newResult[${k}] = ${
|
|
3517
|
+
newResult[${k}] = ${id2}.value;
|
|
3516
3518
|
}
|
|
3517
3519
|
}
|
|
3518
3520
|
|
|
3519
3521
|
`);
|
|
3520
3522
|
} else {
|
|
3521
3523
|
doc.write(`
|
|
3522
|
-
if (${
|
|
3523
|
-
payload.issues = payload.issues.concat(${
|
|
3524
|
+
if (${id2}.issues.length) {
|
|
3525
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3524
3526
|
...iss,
|
|
3525
3527
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3526
3528
|
})));
|
|
3527
3529
|
}
|
|
3528
3530
|
|
|
3529
|
-
if (${
|
|
3531
|
+
if (${id2}.value === undefined) {
|
|
3530
3532
|
if (${k} in input) {
|
|
3531
3533
|
newResult[${k}] = undefined;
|
|
3532
3534
|
}
|
|
3533
3535
|
} else {
|
|
3534
|
-
newResult[${k}] = ${
|
|
3536
|
+
newResult[${k}] = ${id2}.value;
|
|
3535
3537
|
}
|
|
3536
3538
|
|
|
3537
3539
|
`);
|
|
@@ -3551,12 +3553,12 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3551
3553
|
let value;
|
|
3552
3554
|
inst._zod.parse = (payload, ctx) => {
|
|
3553
3555
|
value ?? (value = _normalized.value);
|
|
3554
|
-
const
|
|
3555
|
-
if (!isObject2(
|
|
3556
|
+
const input2 = payload.value;
|
|
3557
|
+
if (!isObject2(input2)) {
|
|
3556
3558
|
payload.issues.push({
|
|
3557
3559
|
expected: "object",
|
|
3558
3560
|
code: "invalid_type",
|
|
3559
|
-
input,
|
|
3561
|
+
input: input2,
|
|
3560
3562
|
inst
|
|
3561
3563
|
});
|
|
3562
3564
|
return payload;
|
|
@@ -3567,7 +3569,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3567
3569
|
payload = fastpass(payload, ctx);
|
|
3568
3570
|
if (!catchall)
|
|
3569
3571
|
return payload;
|
|
3570
|
-
return handleCatchall([],
|
|
3572
|
+
return handleCatchall([], input2, payload, ctx, value, inst);
|
|
3571
3573
|
}
|
|
3572
3574
|
return superParse(payload, ctx);
|
|
3573
3575
|
};
|
|
@@ -3727,17 +3729,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3727
3729
|
return map2;
|
|
3728
3730
|
});
|
|
3729
3731
|
inst._zod.parse = (payload, ctx) => {
|
|
3730
|
-
const
|
|
3731
|
-
if (!isObject(
|
|
3732
|
+
const input2 = payload.value;
|
|
3733
|
+
if (!isObject(input2)) {
|
|
3732
3734
|
payload.issues.push({
|
|
3733
3735
|
code: "invalid_type",
|
|
3734
3736
|
expected: "object",
|
|
3735
|
-
input,
|
|
3737
|
+
input: input2,
|
|
3736
3738
|
inst
|
|
3737
3739
|
});
|
|
3738
3740
|
return payload;
|
|
3739
3741
|
}
|
|
3740
|
-
const opt = disc.value.get(
|
|
3742
|
+
const opt = disc.value.get(input2?.[def.discriminator]);
|
|
3741
3743
|
if (opt) {
|
|
3742
3744
|
return opt._zod.run(payload, ctx);
|
|
3743
3745
|
}
|
|
@@ -3750,7 +3752,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3750
3752
|
note: "No matching discriminator",
|
|
3751
3753
|
discriminator: def.discriminator,
|
|
3752
3754
|
options: Array.from(disc.value.keys()),
|
|
3753
|
-
input,
|
|
3755
|
+
input: input2,
|
|
3754
3756
|
path: [def.discriminator],
|
|
3755
3757
|
inst
|
|
3756
3758
|
});
|
|
@@ -3760,9 +3762,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3760
3762
|
var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
3761
3763
|
$ZodType.init(inst, def);
|
|
3762
3764
|
inst._zod.parse = (payload, ctx) => {
|
|
3763
|
-
const
|
|
3764
|
-
const left = def.left._zod.run({ value:
|
|
3765
|
-
const right = def.right._zod.run({ value:
|
|
3765
|
+
const input2 = payload.value;
|
|
3766
|
+
const left = def.left._zod.run({ value: input2, issues: [] }, ctx);
|
|
3767
|
+
const right = def.right._zod.run({ value: input2, issues: [] }, ctx);
|
|
3766
3768
|
const async = left instanceof Promise || right instanceof Promise;
|
|
3767
3769
|
if (async) {
|
|
3768
3770
|
return Promise.all([left, right]).then(([left2, right2]) => {
|
|
@@ -3859,10 +3861,10 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3859
3861
|
$ZodType.init(inst, def);
|
|
3860
3862
|
const items = def.items;
|
|
3861
3863
|
inst._zod.parse = (payload, ctx) => {
|
|
3862
|
-
const
|
|
3863
|
-
if (!Array.isArray(
|
|
3864
|
+
const input2 = payload.value;
|
|
3865
|
+
if (!Array.isArray(input2)) {
|
|
3864
3866
|
payload.issues.push({
|
|
3865
|
-
input,
|
|
3867
|
+
input: input2,
|
|
3866
3868
|
inst,
|
|
3867
3869
|
expected: "tuple",
|
|
3868
3870
|
code: "invalid_type"
|
|
@@ -3874,23 +3876,23 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3874
3876
|
const optinStart = getTupleOptStart(items, "optin");
|
|
3875
3877
|
const optoutStart = getTupleOptStart(items, "optout");
|
|
3876
3878
|
if (!def.rest) {
|
|
3877
|
-
if (
|
|
3879
|
+
if (input2.length < optinStart) {
|
|
3878
3880
|
payload.issues.push({
|
|
3879
3881
|
code: "too_small",
|
|
3880
3882
|
minimum: optinStart,
|
|
3881
3883
|
inclusive: true,
|
|
3882
|
-
input,
|
|
3884
|
+
input: input2,
|
|
3883
3885
|
inst,
|
|
3884
3886
|
origin: "array"
|
|
3885
3887
|
});
|
|
3886
3888
|
return payload;
|
|
3887
3889
|
}
|
|
3888
|
-
if (
|
|
3890
|
+
if (input2.length > items.length) {
|
|
3889
3891
|
payload.issues.push({
|
|
3890
3892
|
code: "too_big",
|
|
3891
3893
|
maximum: items.length,
|
|
3892
3894
|
inclusive: true,
|
|
3893
|
-
input,
|
|
3895
|
+
input: input2,
|
|
3894
3896
|
inst,
|
|
3895
3897
|
origin: "array"
|
|
3896
3898
|
});
|
|
@@ -3898,7 +3900,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3898
3900
|
}
|
|
3899
3901
|
const itemResults = new Array(items.length);
|
|
3900
3902
|
for (let i = 0; i < items.length; i++) {
|
|
3901
|
-
const r = items[i]._zod.run({ value:
|
|
3903
|
+
const r = items[i]._zod.run({ value: input2[i], issues: [] }, ctx);
|
|
3902
3904
|
if (r instanceof Promise) {
|
|
3903
3905
|
proms.push(r.then((rr) => {
|
|
3904
3906
|
itemResults[i] = rr;
|
|
@@ -3909,7 +3911,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3909
3911
|
}
|
|
3910
3912
|
if (def.rest) {
|
|
3911
3913
|
let i = items.length - 1;
|
|
3912
|
-
const rest =
|
|
3914
|
+
const rest = input2.slice(items.length);
|
|
3913
3915
|
for (const el of rest) {
|
|
3914
3916
|
i++;
|
|
3915
3917
|
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
@@ -3921,9 +3923,9 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3921
3923
|
}
|
|
3922
3924
|
}
|
|
3923
3925
|
if (proms.length) {
|
|
3924
|
-
return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items,
|
|
3926
|
+
return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input2, optoutStart));
|
|
3925
3927
|
}
|
|
3926
|
-
return handleTupleResults(itemResults, payload, items,
|
|
3928
|
+
return handleTupleResults(itemResults, payload, items, input2, optoutStart);
|
|
3927
3929
|
};
|
|
3928
3930
|
});
|
|
3929
3931
|
function getTupleOptStart(items, key) {
|
|
@@ -3939,10 +3941,10 @@ function handleTupleResult(result, final, index) {
|
|
|
3939
3941
|
}
|
|
3940
3942
|
final.value[index] = result.value;
|
|
3941
3943
|
}
|
|
3942
|
-
function handleTupleResults(itemResults, final, items,
|
|
3944
|
+
function handleTupleResults(itemResults, final, items, input2, optoutStart) {
|
|
3943
3945
|
for (let i = 0; i < items.length; i++) {
|
|
3944
3946
|
const r = itemResults[i];
|
|
3945
|
-
const isPresent = i <
|
|
3947
|
+
const isPresent = i < input2.length;
|
|
3946
3948
|
if (r.issues.length) {
|
|
3947
3949
|
if (!isPresent && i >= optoutStart) {
|
|
3948
3950
|
final.value.length = i;
|
|
@@ -3952,7 +3954,7 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
3952
3954
|
}
|
|
3953
3955
|
final.value[i] = r.value;
|
|
3954
3956
|
}
|
|
3955
|
-
for (let i = final.value.length - 1; i >=
|
|
3957
|
+
for (let i = final.value.length - 1; i >= input2.length; i--) {
|
|
3956
3958
|
if (items[i]._zod.optout === "optional" && final.value[i] === void 0) {
|
|
3957
3959
|
final.value.length = i;
|
|
3958
3960
|
} else {
|
|
@@ -3964,12 +3966,12 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
3964
3966
|
var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
3965
3967
|
$ZodType.init(inst, def);
|
|
3966
3968
|
inst._zod.parse = (payload, ctx) => {
|
|
3967
|
-
const
|
|
3968
|
-
if (!isPlainObject(
|
|
3969
|
+
const input2 = payload.value;
|
|
3970
|
+
if (!isPlainObject(input2)) {
|
|
3969
3971
|
payload.issues.push({
|
|
3970
3972
|
expected: "record",
|
|
3971
3973
|
code: "invalid_type",
|
|
3972
|
-
input,
|
|
3974
|
+
input: input2,
|
|
3973
3975
|
inst
|
|
3974
3976
|
});
|
|
3975
3977
|
return payload;
|
|
@@ -3998,7 +4000,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
3998
4000
|
continue;
|
|
3999
4001
|
}
|
|
4000
4002
|
const outKey = keyResult.value;
|
|
4001
|
-
const result = def.valueType._zod.run({ value:
|
|
4003
|
+
const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
4002
4004
|
if (result instanceof Promise) {
|
|
4003
4005
|
proms.push(result.then((result2) => {
|
|
4004
4006
|
if (result2.issues.length) {
|
|
@@ -4015,7 +4017,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4015
4017
|
}
|
|
4016
4018
|
}
|
|
4017
4019
|
let unrecognized;
|
|
4018
|
-
for (const key in
|
|
4020
|
+
for (const key in input2) {
|
|
4019
4021
|
if (!recordKeys.has(key)) {
|
|
4020
4022
|
unrecognized = unrecognized ?? [];
|
|
4021
4023
|
unrecognized.push(key);
|
|
@@ -4024,17 +4026,17 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4024
4026
|
if (unrecognized && unrecognized.length > 0) {
|
|
4025
4027
|
payload.issues.push({
|
|
4026
4028
|
code: "unrecognized_keys",
|
|
4027
|
-
input,
|
|
4029
|
+
input: input2,
|
|
4028
4030
|
inst,
|
|
4029
4031
|
keys: unrecognized
|
|
4030
4032
|
});
|
|
4031
4033
|
}
|
|
4032
4034
|
} else {
|
|
4033
4035
|
payload.value = {};
|
|
4034
|
-
for (const key of Reflect.ownKeys(
|
|
4036
|
+
for (const key of Reflect.ownKeys(input2)) {
|
|
4035
4037
|
if (key === "__proto__")
|
|
4036
4038
|
continue;
|
|
4037
|
-
if (!Object.prototype.propertyIsEnumerable.call(
|
|
4039
|
+
if (!Object.prototype.propertyIsEnumerable.call(input2, key))
|
|
4038
4040
|
continue;
|
|
4039
4041
|
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
4040
4042
|
if (keyResult instanceof Promise) {
|
|
@@ -4052,7 +4054,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4052
4054
|
}
|
|
4053
4055
|
if (keyResult.issues.length) {
|
|
4054
4056
|
if (def.mode === "loose") {
|
|
4055
|
-
payload.value[key] =
|
|
4057
|
+
payload.value[key] = input2[key];
|
|
4056
4058
|
} else {
|
|
4057
4059
|
payload.issues.push({
|
|
4058
4060
|
code: "invalid_key",
|
|
@@ -4065,7 +4067,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4065
4067
|
}
|
|
4066
4068
|
continue;
|
|
4067
4069
|
}
|
|
4068
|
-
const result = def.valueType._zod.run({ value:
|
|
4070
|
+
const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
4069
4071
|
if (result instanceof Promise) {
|
|
4070
4072
|
proms.push(result.then((result2) => {
|
|
4071
4073
|
if (result2.issues.length) {
|
|
@@ -4090,27 +4092,27 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
4090
4092
|
var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
4091
4093
|
$ZodType.init(inst, def);
|
|
4092
4094
|
inst._zod.parse = (payload, ctx) => {
|
|
4093
|
-
const
|
|
4094
|
-
if (!(
|
|
4095
|
+
const input2 = payload.value;
|
|
4096
|
+
if (!(input2 instanceof Map)) {
|
|
4095
4097
|
payload.issues.push({
|
|
4096
4098
|
expected: "map",
|
|
4097
4099
|
code: "invalid_type",
|
|
4098
|
-
input,
|
|
4100
|
+
input: input2,
|
|
4099
4101
|
inst
|
|
4100
4102
|
});
|
|
4101
4103
|
return payload;
|
|
4102
4104
|
}
|
|
4103
4105
|
const proms = [];
|
|
4104
4106
|
payload.value = /* @__PURE__ */ new Map();
|
|
4105
|
-
for (const [key, value] of
|
|
4107
|
+
for (const [key, value] of input2) {
|
|
4106
4108
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
4107
4109
|
const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
|
|
4108
4110
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
4109
4111
|
proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
|
|
4110
|
-
handleMapResult(keyResult2, valueResult2, payload, key,
|
|
4112
|
+
handleMapResult(keyResult2, valueResult2, payload, key, input2, inst, ctx);
|
|
4111
4113
|
}));
|
|
4112
4114
|
} else {
|
|
4113
|
-
handleMapResult(keyResult, valueResult, payload, key,
|
|
4115
|
+
handleMapResult(keyResult, valueResult, payload, key, input2, inst, ctx);
|
|
4114
4116
|
}
|
|
4115
4117
|
}
|
|
4116
4118
|
if (proms.length)
|
|
@@ -4118,7 +4120,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
|
4118
4120
|
return payload;
|
|
4119
4121
|
};
|
|
4120
4122
|
});
|
|
4121
|
-
function handleMapResult(keyResult, valueResult, final, key,
|
|
4123
|
+
function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
|
|
4122
4124
|
if (keyResult.issues.length) {
|
|
4123
4125
|
if (propertyKeyTypes.has(typeof key)) {
|
|
4124
4126
|
final.issues.push(...prefixIssues(key, keyResult.issues));
|
|
@@ -4126,7 +4128,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
4126
4128
|
final.issues.push({
|
|
4127
4129
|
code: "invalid_key",
|
|
4128
4130
|
origin: "map",
|
|
4129
|
-
input,
|
|
4131
|
+
input: input2,
|
|
4130
4132
|
inst,
|
|
4131
4133
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
4132
4134
|
});
|
|
@@ -4139,7 +4141,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
4139
4141
|
final.issues.push({
|
|
4140
4142
|
origin: "map",
|
|
4141
4143
|
code: "invalid_element",
|
|
4142
|
-
input,
|
|
4144
|
+
input: input2,
|
|
4143
4145
|
inst,
|
|
4144
4146
|
key,
|
|
4145
4147
|
issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
@@ -4151,10 +4153,10 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
4151
4153
|
var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
4152
4154
|
$ZodType.init(inst, def);
|
|
4153
4155
|
inst._zod.parse = (payload, ctx) => {
|
|
4154
|
-
const
|
|
4155
|
-
if (!(
|
|
4156
|
+
const input2 = payload.value;
|
|
4157
|
+
if (!(input2 instanceof Set)) {
|
|
4156
4158
|
payload.issues.push({
|
|
4157
|
-
input,
|
|
4159
|
+
input: input2,
|
|
4158
4160
|
inst,
|
|
4159
4161
|
expected: "set",
|
|
4160
4162
|
code: "invalid_type"
|
|
@@ -4163,7 +4165,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
|
4163
4165
|
}
|
|
4164
4166
|
const proms = [];
|
|
4165
4167
|
payload.value = /* @__PURE__ */ new Set();
|
|
4166
|
-
for (const item of
|
|
4168
|
+
for (const item of input2) {
|
|
4167
4169
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
4168
4170
|
if (result instanceof Promise) {
|
|
4169
4171
|
proms.push(result.then((result2) => handleSetResult(result2, payload)));
|
|
@@ -4188,14 +4190,14 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
4188
4190
|
inst._zod.values = valuesSet;
|
|
4189
4191
|
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
4190
4192
|
inst._zod.parse = (payload, _ctx) => {
|
|
4191
|
-
const
|
|
4192
|
-
if (valuesSet.has(
|
|
4193
|
+
const input2 = payload.value;
|
|
4194
|
+
if (valuesSet.has(input2)) {
|
|
4193
4195
|
return payload;
|
|
4194
4196
|
}
|
|
4195
4197
|
payload.issues.push({
|
|
4196
4198
|
code: "invalid_value",
|
|
4197
4199
|
values,
|
|
4198
|
-
input,
|
|
4200
|
+
input: input2,
|
|
4199
4201
|
inst
|
|
4200
4202
|
});
|
|
4201
4203
|
return payload;
|
|
@@ -4210,14 +4212,14 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
4210
4212
|
inst._zod.values = values;
|
|
4211
4213
|
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
4212
4214
|
inst._zod.parse = (payload, _ctx) => {
|
|
4213
|
-
const
|
|
4214
|
-
if (values.has(
|
|
4215
|
+
const input2 = payload.value;
|
|
4216
|
+
if (values.has(input2)) {
|
|
4215
4217
|
return payload;
|
|
4216
4218
|
}
|
|
4217
4219
|
payload.issues.push({
|
|
4218
4220
|
code: "invalid_value",
|
|
4219
4221
|
values: def.values,
|
|
4220
|
-
input,
|
|
4222
|
+
input: input2,
|
|
4221
4223
|
inst
|
|
4222
4224
|
});
|
|
4223
4225
|
return payload;
|
|
@@ -4226,13 +4228,13 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
4226
4228
|
var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
|
|
4227
4229
|
$ZodType.init(inst, def);
|
|
4228
4230
|
inst._zod.parse = (payload, _ctx) => {
|
|
4229
|
-
const
|
|
4230
|
-
if (
|
|
4231
|
+
const input2 = payload.value;
|
|
4232
|
+
if (input2 instanceof File)
|
|
4231
4233
|
return payload;
|
|
4232
4234
|
payload.issues.push({
|
|
4233
4235
|
expected: "file",
|
|
4234
4236
|
code: "invalid_type",
|
|
4235
|
-
input,
|
|
4237
|
+
input: input2,
|
|
4236
4238
|
inst
|
|
4237
4239
|
});
|
|
4238
4240
|
return payload;
|
|
@@ -4262,8 +4264,8 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
|
|
|
4262
4264
|
return payload;
|
|
4263
4265
|
};
|
|
4264
4266
|
});
|
|
4265
|
-
function handleOptionalResult(result,
|
|
4266
|
-
if (
|
|
4267
|
+
function handleOptionalResult(result, input2) {
|
|
4268
|
+
if (input2 === void 0 && (result.issues.length || result.fallback)) {
|
|
4267
4269
|
return { issues: [], value: void 0 };
|
|
4268
4270
|
}
|
|
4269
4271
|
return result;
|
|
@@ -4281,11 +4283,11 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
|
4281
4283
|
});
|
|
4282
4284
|
inst._zod.parse = (payload, ctx) => {
|
|
4283
4285
|
if (def.innerType._zod.optin === "optional") {
|
|
4284
|
-
const
|
|
4286
|
+
const input2 = payload.value;
|
|
4285
4287
|
const result = def.innerType._zod.run(payload, ctx);
|
|
4286
4288
|
if (result instanceof Promise)
|
|
4287
|
-
return result.then((r) => handleOptionalResult(r,
|
|
4288
|
-
return handleOptionalResult(result,
|
|
4289
|
+
return result.then((r) => handleOptionalResult(r, input2));
|
|
4290
|
+
return handleOptionalResult(result, input2);
|
|
4289
4291
|
}
|
|
4290
4292
|
if (payload.value === void 0) {
|
|
4291
4293
|
return payload;
|
|
@@ -4710,20 +4712,20 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
|
4710
4712
|
return payload;
|
|
4711
4713
|
};
|
|
4712
4714
|
inst._zod.check = (payload) => {
|
|
4713
|
-
const
|
|
4714
|
-
const r = def.fn(
|
|
4715
|
+
const input2 = payload.value;
|
|
4716
|
+
const r = def.fn(input2);
|
|
4715
4717
|
if (r instanceof Promise) {
|
|
4716
|
-
return r.then((r2) => handleRefineResult(r2, payload,
|
|
4718
|
+
return r.then((r2) => handleRefineResult(r2, payload, input2, inst));
|
|
4717
4719
|
}
|
|
4718
|
-
handleRefineResult(r, payload,
|
|
4720
|
+
handleRefineResult(r, payload, input2, inst);
|
|
4719
4721
|
return;
|
|
4720
4722
|
};
|
|
4721
4723
|
});
|
|
4722
|
-
function handleRefineResult(result, payload,
|
|
4724
|
+
function handleRefineResult(result, payload, input2, inst) {
|
|
4723
4725
|
if (!result) {
|
|
4724
4726
|
const _iss = {
|
|
4725
4727
|
code: "custom",
|
|
4726
|
-
input,
|
|
4728
|
+
input: input2,
|
|
4727
4729
|
inst,
|
|
4728
4730
|
// incorporates params.error into issue reporting
|
|
4729
4731
|
path: [...inst._zod.def.path ?? []],
|
|
@@ -8010,8 +8012,8 @@ function ko_default() {
|
|
|
8010
8012
|
}
|
|
8011
8013
|
|
|
8012
8014
|
// ../../../node_modules/zod/v4/locales/lt.js
|
|
8013
|
-
var capitalizeFirstCharacter = (
|
|
8014
|
-
return
|
|
8015
|
+
var capitalizeFirstCharacter = (text2) => {
|
|
8016
|
+
return text2.charAt(0).toUpperCase() + text2.slice(1);
|
|
8015
8017
|
};
|
|
8016
8018
|
function getUnitTypeFromNumber(number4) {
|
|
8017
8019
|
const abs = Math.abs(number4);
|
|
@@ -11411,23 +11413,23 @@ function _overwrite(tx) {
|
|
|
11411
11413
|
}
|
|
11412
11414
|
// @__NO_SIDE_EFFECTS__
|
|
11413
11415
|
function _normalize(form) {
|
|
11414
|
-
return /* @__PURE__ */ _overwrite((
|
|
11416
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.normalize(form));
|
|
11415
11417
|
}
|
|
11416
11418
|
// @__NO_SIDE_EFFECTS__
|
|
11417
11419
|
function _trim() {
|
|
11418
|
-
return /* @__PURE__ */ _overwrite((
|
|
11420
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.trim());
|
|
11419
11421
|
}
|
|
11420
11422
|
// @__NO_SIDE_EFFECTS__
|
|
11421
11423
|
function _toLowerCase() {
|
|
11422
|
-
return /* @__PURE__ */ _overwrite((
|
|
11424
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.toLowerCase());
|
|
11423
11425
|
}
|
|
11424
11426
|
// @__NO_SIDE_EFFECTS__
|
|
11425
11427
|
function _toUpperCase() {
|
|
11426
|
-
return /* @__PURE__ */ _overwrite((
|
|
11428
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.toUpperCase());
|
|
11427
11429
|
}
|
|
11428
11430
|
// @__NO_SIDE_EFFECTS__
|
|
11429
11431
|
function _slugify() {
|
|
11430
|
-
return /* @__PURE__ */ _overwrite((
|
|
11432
|
+
return /* @__PURE__ */ _overwrite((input2) => slugify(input2));
|
|
11431
11433
|
}
|
|
11432
11434
|
// @__NO_SIDE_EFFECTS__
|
|
11433
11435
|
function _array(Class2, element, params) {
|
|
@@ -11732,8 +11734,8 @@ function _stringbool(Classes, _params) {
|
|
|
11732
11734
|
type: "pipe",
|
|
11733
11735
|
in: stringSchema,
|
|
11734
11736
|
out: booleanSchema,
|
|
11735
|
-
transform: ((
|
|
11736
|
-
let data =
|
|
11737
|
+
transform: ((input2, payload) => {
|
|
11738
|
+
let data = input2;
|
|
11737
11739
|
if (params.case !== "sensitive")
|
|
11738
11740
|
data = data.toLowerCase();
|
|
11739
11741
|
if (truthySet.has(data)) {
|
|
@@ -11752,8 +11754,8 @@ function _stringbool(Classes, _params) {
|
|
|
11752
11754
|
return {};
|
|
11753
11755
|
}
|
|
11754
11756
|
}),
|
|
11755
|
-
reverseTransform: ((
|
|
11756
|
-
if (
|
|
11757
|
+
reverseTransform: ((input2, _payload) => {
|
|
11758
|
+
if (input2 === true) {
|
|
11757
11759
|
return truthyArray[0] || "true";
|
|
11758
11760
|
} else {
|
|
11759
11761
|
return falsyArray[0] || "false";
|
|
@@ -11863,26 +11865,26 @@ function extractDefs(ctx, schema) {
|
|
|
11863
11865
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
11864
11866
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
11865
11867
|
for (const entry of ctx.seen.entries()) {
|
|
11866
|
-
const
|
|
11867
|
-
if (
|
|
11868
|
-
const existing = idToSchema.get(
|
|
11868
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
11869
|
+
if (id2) {
|
|
11870
|
+
const existing = idToSchema.get(id2);
|
|
11869
11871
|
if (existing && existing !== entry[0]) {
|
|
11870
|
-
throw new Error(`Duplicate schema id "${
|
|
11872
|
+
throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
11871
11873
|
}
|
|
11872
|
-
idToSchema.set(
|
|
11874
|
+
idToSchema.set(id2, entry[0]);
|
|
11873
11875
|
}
|
|
11874
11876
|
}
|
|
11875
11877
|
const makeURI = (entry) => {
|
|
11876
11878
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
11877
11879
|
if (ctx.external) {
|
|
11878
11880
|
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
11879
|
-
const uriGenerator = ctx.external.uri ?? ((
|
|
11881
|
+
const uriGenerator = ctx.external.uri ?? ((id3) => id3);
|
|
11880
11882
|
if (externalId) {
|
|
11881
11883
|
return { ref: uriGenerator(externalId) };
|
|
11882
11884
|
}
|
|
11883
|
-
const
|
|
11884
|
-
entry[1].defId =
|
|
11885
|
-
return { defId:
|
|
11885
|
+
const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
11886
|
+
entry[1].defId = id2;
|
|
11887
|
+
return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id2}` };
|
|
11886
11888
|
}
|
|
11887
11889
|
if (entry[1] === root) {
|
|
11888
11890
|
return { ref: "#" };
|
|
@@ -11930,8 +11932,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11930
11932
|
continue;
|
|
11931
11933
|
}
|
|
11932
11934
|
}
|
|
11933
|
-
const
|
|
11934
|
-
if (
|
|
11935
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
11936
|
+
if (id2) {
|
|
11935
11937
|
extractToDef(entry);
|
|
11936
11938
|
continue;
|
|
11937
11939
|
}
|
|
@@ -12027,10 +12029,10 @@ function finalize(ctx, schema) {
|
|
|
12027
12029
|
} else {
|
|
12028
12030
|
}
|
|
12029
12031
|
if (ctx.external?.uri) {
|
|
12030
|
-
const
|
|
12031
|
-
if (!
|
|
12032
|
+
const id2 = ctx.external.registry.get(schema)?.id;
|
|
12033
|
+
if (!id2)
|
|
12032
12034
|
throw new Error("Schema is missing an `id` property");
|
|
12033
|
-
result.$id = ctx.external.uri(
|
|
12035
|
+
result.$id = ctx.external.uri(id2);
|
|
12034
12036
|
}
|
|
12035
12037
|
Object.assign(result, root.def ?? root.schema);
|
|
12036
12038
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
@@ -12190,9 +12192,9 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
12190
12192
|
json2.type = "number";
|
|
12191
12193
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
12192
12194
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
12193
|
-
const
|
|
12195
|
+
const legacy2 = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
12194
12196
|
if (exMin) {
|
|
12195
|
-
if (
|
|
12197
|
+
if (legacy2) {
|
|
12196
12198
|
json2.minimum = exclusiveMinimum;
|
|
12197
12199
|
json2.exclusiveMinimum = true;
|
|
12198
12200
|
} else {
|
|
@@ -12202,7 +12204,7 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
12202
12204
|
json2.minimum = minimum;
|
|
12203
12205
|
}
|
|
12204
12206
|
if (exMax) {
|
|
12205
|
-
if (
|
|
12207
|
+
if (legacy2) {
|
|
12206
12208
|
json2.maximum = exclusiveMaximum;
|
|
12207
12209
|
json2.exclusiveMaximum = true;
|
|
12208
12210
|
} else {
|
|
@@ -12649,9 +12651,9 @@ var allProcessors = {
|
|
|
12649
12651
|
optional: optionalProcessor,
|
|
12650
12652
|
lazy: lazyProcessor
|
|
12651
12653
|
};
|
|
12652
|
-
function toJSONSchema(
|
|
12653
|
-
if ("_idmap" in
|
|
12654
|
-
const registry2 =
|
|
12654
|
+
function toJSONSchema(input2, params) {
|
|
12655
|
+
if ("_idmap" in input2) {
|
|
12656
|
+
const registry2 = input2;
|
|
12655
12657
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
12656
12658
|
const defs = {};
|
|
12657
12659
|
for (const entry of registry2._idmap.entries()) {
|
|
@@ -12679,9 +12681,9 @@ function toJSONSchema(input, params) {
|
|
|
12679
12681
|
return { schemas };
|
|
12680
12682
|
}
|
|
12681
12683
|
const ctx = initializeContext({ ...params, processors: allProcessors });
|
|
12682
|
-
process2(
|
|
12683
|
-
extractDefs(ctx,
|
|
12684
|
-
return finalize(ctx,
|
|
12684
|
+
process2(input2, ctx);
|
|
12685
|
+
extractDefs(ctx, input2);
|
|
12686
|
+
return finalize(ctx, input2);
|
|
12685
12687
|
}
|
|
12686
12688
|
|
|
12687
12689
|
// ../../../node_modules/zod/v4/core/json-schema-generator.js
|
|
@@ -13064,7 +13066,7 @@ var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
|
13064
13066
|
|
|
13065
13067
|
// ../../../node_modules/zod/v4/classic/schemas.js
|
|
13066
13068
|
var _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
13067
|
-
function _installLazyMethods(inst, group,
|
|
13069
|
+
function _installLazyMethods(inst, group, methods3) {
|
|
13068
13070
|
const proto = Object.getPrototypeOf(inst);
|
|
13069
13071
|
let installed = _installedGroups.get(proto);
|
|
13070
13072
|
if (!installed) {
|
|
@@ -13074,8 +13076,8 @@ function _installLazyMethods(inst, group, methods2) {
|
|
|
13074
13076
|
if (installed.has(group))
|
|
13075
13077
|
return;
|
|
13076
13078
|
installed.add(group);
|
|
13077
|
-
for (const key in
|
|
13078
|
-
const fn =
|
|
13079
|
+
for (const key in methods3) {
|
|
13080
|
+
const fn = methods3[key];
|
|
13079
13081
|
Object.defineProperty(proto, key, {
|
|
13080
13082
|
configurable: true,
|
|
13081
13083
|
enumerable: false,
|
|
@@ -14886,87 +14888,6 @@ function date4(params) {
|
|
|
14886
14888
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
14887
14889
|
config(en_default());
|
|
14888
14890
|
|
|
14889
|
-
// ../../shared-contracts/dist/ids.js
|
|
14890
|
-
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
14891
|
-
message: "Identifier must not be empty or whitespace"
|
|
14892
|
-
});
|
|
14893
|
-
var harnessIdSchema = opaqueIdSchema.brand();
|
|
14894
|
-
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
14895
|
-
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
14896
|
-
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
14897
|
-
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
14898
|
-
|
|
14899
|
-
// ../../shared-contracts/dist/harness-plugins.js
|
|
14900
|
-
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
14901
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
14902
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
14903
|
-
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
14904
|
-
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
14905
|
-
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
|
|
14906
|
-
var pluginRelativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
|
|
14907
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
14908
|
-
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
14909
|
-
var harnessInstallationGuideSchema = external_exports.object({
|
|
14910
|
-
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
14911
|
-
before: localizedTextSchema.optional(),
|
|
14912
|
-
after: localizedTextSchema.optional(),
|
|
14913
|
-
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
14914
|
-
}).strict();
|
|
14915
|
-
var pluginPresentationShape = {
|
|
14916
|
-
id: installedHarnessPluginIdSchema,
|
|
14917
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
14918
|
-
version: external_exports.string().min(1).max(128),
|
|
14919
|
-
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
14920
|
-
kind: external_exports.literal("usage").optional(),
|
|
14921
|
-
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
14922
|
-
iconStyle: external_exports.object({
|
|
14923
|
-
vector: external_exports.object({
|
|
14924
|
-
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
14925
|
-
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
14926
|
-
paths: external_exports.array(external_exports.object({
|
|
14927
|
-
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
14928
|
-
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
14929
|
-
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
14930
|
-
}).strict()).min(1).max(32)
|
|
14931
|
-
}).strict().optional(),
|
|
14932
|
-
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
14933
|
-
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
14934
|
-
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
14935
|
-
}).strict().optional(),
|
|
14936
|
-
installation: harnessInstallationGuideSchema.optional(),
|
|
14937
|
-
notice: localizedTextSchema.optional(),
|
|
14938
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
14939
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
14940
|
-
links: external_exports.object({
|
|
14941
|
-
website: documentationUrlSchema.optional(),
|
|
14942
|
-
documentation: documentationUrlSchema.optional(),
|
|
14943
|
-
installation: documentationUrlSchema.optional()
|
|
14944
|
-
}).strict().optional()
|
|
14945
|
-
};
|
|
14946
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
14947
|
-
manifestVersion: external_exports.literal(1),
|
|
14948
|
-
...pluginPresentationShape,
|
|
14949
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
14950
|
-
entry: pluginRelativeResourceSchema,
|
|
14951
|
-
icon: pluginRelativeResourceSchema.optional()
|
|
14952
|
-
}).strict();
|
|
14953
|
-
var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
14954
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
14955
|
-
...pluginPresentationShape,
|
|
14956
|
-
icon: harnessPluginIconSchema.optional()
|
|
14957
|
-
}).strict();
|
|
14958
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
14959
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
14960
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
14961
|
-
}).strict();
|
|
14962
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
14963
|
-
version: external_exports.literal(1),
|
|
14964
|
-
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
14965
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
14966
|
-
message: "Enabled plugin IDs must be unique",
|
|
14967
|
-
path: ["enabled"]
|
|
14968
|
-
});
|
|
14969
|
-
|
|
14970
14891
|
// ../../shared-contracts/dist/json-value.js
|
|
14971
14892
|
function rejectExplicitUndefined(keys) {
|
|
14972
14893
|
return (value, context) => {
|
|
@@ -15026,403 +14947,73 @@ var jsonValueSchema = nonCircularSchema.pipe(recursiveJsonValueSchema);
|
|
|
15026
14947
|
var jsonArraySchema = nonCircularSchema.pipe(external_exports.array(recursiveJsonValueSchema));
|
|
15027
14948
|
var jsonObjectSchema = nonCircularSchema.pipe(external_exports.record(external_exports.string(), recursiveJsonValueSchema));
|
|
15028
14949
|
|
|
15029
|
-
// ../../shared-contracts/dist/
|
|
15030
|
-
var
|
|
15031
|
-
|
|
15032
|
-
|
|
15033
|
-
|
|
15034
|
-
|
|
15035
|
-
|
|
15036
|
-
|
|
15037
|
-
|
|
15038
|
-
|
|
15039
|
-
|
|
15040
|
-
|
|
15041
|
-
var
|
|
15042
|
-
var
|
|
15043
|
-
var
|
|
15044
|
-
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
var
|
|
15051
|
-
"
|
|
15052
|
-
|
|
15053
|
-
|
|
15054
|
-
|
|
15055
|
-
|
|
15056
|
-
|
|
15057
|
-
|
|
15058
|
-
|
|
15059
|
-
|
|
15060
|
-
|
|
15061
|
-
|
|
15062
|
-
|
|
15063
|
-
|
|
15064
|
-
|
|
15065
|
-
|
|
15066
|
-
|
|
15067
|
-
|
|
15068
|
-
|
|
15069
|
-
|
|
14950
|
+
// ../../shared-contracts/dist/errors.js
|
|
14951
|
+
var codexhostErrorSchema = external_exports.strictObject({
|
|
14952
|
+
code: external_exports.string().min(1),
|
|
14953
|
+
message: external_exports.string().min(1),
|
|
14954
|
+
retryable: external_exports.boolean(),
|
|
14955
|
+
diagnostic: external_exports.string().min(1).optional(),
|
|
14956
|
+
stage: external_exports.string().min(1).optional(),
|
|
14957
|
+
durationMs: external_exports.number().int().nonnegative().optional(),
|
|
14958
|
+
stderrTail: external_exports.string().min(1).optional()
|
|
14959
|
+
}).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
|
|
14960
|
+
|
|
14961
|
+
// ../../shared-contracts/dist/harness-presentation.js
|
|
14962
|
+
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
14963
|
+
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
|
|
14964
|
+
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
14965
|
+
label: displayText(256).optional(),
|
|
14966
|
+
description: displayText(1024).optional()
|
|
14967
|
+
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
14968
|
+
var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
14969
|
+
|
|
14970
|
+
// ../../shared-contracts/dist/ids.js
|
|
14971
|
+
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
14972
|
+
message: "Identifier must not be empty or whitespace"
|
|
14973
|
+
});
|
|
14974
|
+
var harnessIdSchema = opaqueIdSchema.brand();
|
|
14975
|
+
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
14976
|
+
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
14977
|
+
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
14978
|
+
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
14979
|
+
|
|
14980
|
+
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
14981
|
+
var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
|
|
14982
|
+
var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
|
|
14983
|
+
var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
|
|
14984
|
+
var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
|
|
14985
|
+
var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
14986
|
+
message: "Value must not be empty or whitespace"
|
|
14987
|
+
});
|
|
14988
|
+
var harnessPermissionModeIdSchema = nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~:-]+$/u, "Permission Mode ID must use transport-safe characters").brand();
|
|
14989
|
+
var harnessPermissionModeSchema = external_exports.object({
|
|
14990
|
+
id: harnessPermissionModeIdSchema,
|
|
14991
|
+
label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
|
|
14992
|
+
description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
14993
|
+
dangerous: external_exports.boolean().optional(),
|
|
14994
|
+
localizations: harnessLocalizationsSchema.optional()
|
|
14995
|
+
}).strict();
|
|
14996
|
+
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
14997
|
+
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
14998
|
+
defaultModeId: harnessPermissionModeIdSchema
|
|
14999
|
+
}).strict().superRefine((catalog, context) => {
|
|
15000
|
+
const ids = /* @__PURE__ */ new Set();
|
|
15001
|
+
for (const [index, mode] of catalog.modes.entries()) {
|
|
15002
|
+
if (ids.has(mode.id)) {
|
|
15003
|
+
context.addIssue({
|
|
15004
|
+
code: "custom",
|
|
15005
|
+
message: "Permission Mode IDs must be unique",
|
|
15006
|
+
path: ["modes", index, "id"]
|
|
15007
|
+
});
|
|
15008
|
+
}
|
|
15009
|
+
ids.add(mode.id);
|
|
15070
15010
|
}
|
|
15071
|
-
|
|
15072
|
-
|
|
15073
|
-
|
|
15074
|
-
|
|
15075
|
-
|
|
15076
|
-
|
|
15077
|
-
return "image/svg+xml";
|
|
15078
|
-
case "woff2":
|
|
15079
|
-
return "font/woff2";
|
|
15080
|
-
case "json":
|
|
15081
|
-
return "application/json";
|
|
15082
|
-
case "css":
|
|
15083
|
-
return "text/css";
|
|
15084
|
-
default:
|
|
15085
|
-
return desktopExtensionScreenshotMimeType(resource);
|
|
15086
|
-
}
|
|
15087
|
-
}
|
|
15088
|
-
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
15089
|
-
var desktopExtensionAssetPathSchema = pluginRelativeResourceSchema.refine((resource) => hasPortableSegments(resource) && desktopExtensionAssetMimeType(resource) !== void 0, "Expected a relative Desktop extension asset path with a supported suffix");
|
|
15090
|
-
var imagePathSchema = pluginRelativeResourceSchema.refine((resource) => desktopExtensionScreenshotMimeType(resource) !== void 0 && hasPortableSegments(resource), "Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space");
|
|
15091
|
-
var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu, "Expected an HTTP(S) URL").pipe(external_exports.url({ protocol: /^https?$/u })).refine((value) => {
|
|
15092
|
-
const { username, password } = new URL(value);
|
|
15093
|
-
return !username && !password && !/[\\\s]/u.test(value);
|
|
15094
|
-
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
15095
|
-
function localizedText(text) {
|
|
15096
|
-
return external_exports.strictObject({ en: text, "zh-CN": text });
|
|
15097
|
-
}
|
|
15098
|
-
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
15099
|
-
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
15100
|
-
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
15101
|
-
var settingField = {
|
|
15102
|
-
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
15103
|
-
label: desktopExtensionLocalizedTextSchema,
|
|
15104
|
-
description: desktopExtensionLocalizedTextSchema.optional()
|
|
15105
|
-
};
|
|
15106
|
-
var numericSetting = {
|
|
15107
|
-
...settingField,
|
|
15108
|
-
step: external_exports.number().positive().optional(),
|
|
15109
|
-
default: external_exports.number().optional()
|
|
15110
|
-
};
|
|
15111
|
-
var settingOption = external_exports.strictObject({
|
|
15112
|
-
value: external_exports.string(),
|
|
15113
|
-
label: desktopExtensionLocalizedTextSchema
|
|
15114
|
-
});
|
|
15115
|
-
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
15116
|
-
external_exports.strictObject({
|
|
15117
|
-
...settingField,
|
|
15118
|
-
type: external_exports.literal("boolean"),
|
|
15119
|
-
default: external_exports.boolean().optional()
|
|
15120
|
-
}),
|
|
15121
|
-
external_exports.strictObject({
|
|
15122
|
-
...settingField,
|
|
15123
|
-
type: external_exports.literal("string"),
|
|
15124
|
-
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
15125
|
-
default: external_exports.string().optional()
|
|
15126
|
-
}),
|
|
15127
|
-
external_exports.strictObject({
|
|
15128
|
-
...numericSetting,
|
|
15129
|
-
type: external_exports.literal("number"),
|
|
15130
|
-
min: external_exports.number().optional(),
|
|
15131
|
-
max: external_exports.number().optional()
|
|
15132
|
-
}),
|
|
15133
|
-
external_exports.strictObject({
|
|
15134
|
-
...numericSetting,
|
|
15135
|
-
type: external_exports.literal("range"),
|
|
15136
|
-
min: external_exports.number(),
|
|
15137
|
-
max: external_exports.number()
|
|
15138
|
-
}),
|
|
15139
|
-
external_exports.strictObject({
|
|
15140
|
-
...settingField,
|
|
15141
|
-
type: external_exports.literal("select"),
|
|
15142
|
-
options: external_exports.array(settingOption).min(1),
|
|
15143
|
-
default: external_exports.string().optional()
|
|
15144
|
-
})
|
|
15145
|
-
]).superRefine((field2, ctx) => {
|
|
15146
|
-
const issue2 = (path11, message) => ctx.addIssue({ code: "custom", path: [path11], message });
|
|
15147
|
-
if (field2.type === "number" || field2.type === "range") {
|
|
15148
|
-
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
15149
|
-
if (min > max)
|
|
15150
|
-
issue2("max", "Must be at least min");
|
|
15151
|
-
if (value !== void 0 && (value < min || value > max))
|
|
15152
|
-
issue2("default", "Must be within min and max");
|
|
15153
|
-
} else if (field2.type === "select") {
|
|
15154
|
-
const values = new Set(field2.options.map(({ value }) => value));
|
|
15155
|
-
if (values.size !== field2.options.length)
|
|
15156
|
-
issue2("options", "Duplicate option values");
|
|
15157
|
-
if (field2.default !== void 0 && !values.has(field2.default))
|
|
15158
|
-
issue2("default", "Must match an option value");
|
|
15159
|
-
}
|
|
15160
|
-
});
|
|
15161
|
-
var manifestHeader = external_exports.object({
|
|
15162
|
-
manifestVersion: external_exports.int().positive(),
|
|
15163
|
-
id: desktopExtensionIdSchema,
|
|
15164
|
-
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
15165
|
-
version: external_exports.string().min(1).max(128),
|
|
15166
|
-
desktopApi: external_exports.int().positive()
|
|
15167
|
-
}).passthrough();
|
|
15168
|
-
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
15169
|
-
manifestVersion: external_exports.literal(1),
|
|
15170
|
-
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
15171
|
-
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
15172
|
-
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
15173
|
-
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
15174
|
-
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
15175
|
-
icon: imagePathSchema.optional(),
|
|
15176
|
-
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
15177
|
-
desktop: external_exports.strictObject({
|
|
15178
|
-
script: pluginRelativeResourceSchema,
|
|
15179
|
-
style: pluginRelativeResourceSchema.optional()
|
|
15180
|
-
}).optional(),
|
|
15181
|
-
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
15182
|
-
slots: slotsSchema.default(() => []),
|
|
15183
|
-
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
15184
|
-
categories: categoriesSchema.optional()
|
|
15185
|
-
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
15186
|
-
var desktopExtensionConfigurationSchema = external_exports.strictObject({
|
|
15187
|
-
version: external_exports.literal(1),
|
|
15188
|
-
revision: external_exports.int().nonnegative(),
|
|
15189
|
-
enabled: external_exports.array(desktopExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs"),
|
|
15190
|
-
reloadToken: external_exports.uuid().optional()
|
|
15191
|
-
});
|
|
15192
|
-
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
15193
|
-
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
15194
|
-
state: external_exports.enum([
|
|
15195
|
-
"running",
|
|
15196
|
-
"disabled",
|
|
15197
|
-
"invalid",
|
|
15198
|
-
"incompatible",
|
|
15199
|
-
"conflict",
|
|
15200
|
-
"failed",
|
|
15201
|
-
"waiting"
|
|
15202
|
-
]),
|
|
15203
|
-
hash: desktopExtensionHashSchema.optional(),
|
|
15204
|
-
error: external_exports.string().optional(),
|
|
15205
|
-
conflictWith: desktopExtensionIdSchema.optional()
|
|
15206
|
-
});
|
|
15207
|
-
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
15208
|
-
controllerPid: external_exports.int().positive(),
|
|
15209
|
-
targetId: external_exports.string().nullable(),
|
|
15210
|
-
updatedAt: external_exports.iso.datetime(),
|
|
15211
|
-
handledReloadToken: external_exports.uuid().optional(),
|
|
15212
|
-
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema)
|
|
15213
|
-
});
|
|
15214
|
-
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
15215
|
-
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
15216
|
-
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
15217
|
-
}
|
|
15218
|
-
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
|
|
15219
|
-
const url2 = new URL(input);
|
|
15220
|
-
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);
|
|
15221
|
-
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
15222
|
-
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
15223
|
-
id: desktopExtensionIdSchema,
|
|
15224
|
-
version: external_exports.string().trim().min(1).max(128),
|
|
15225
|
-
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
15226
|
-
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
15227
|
-
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
15228
|
-
author: external_exports.string().trim().min(1).max(128),
|
|
15229
|
-
repository: desktopExtensionHttpUrlSchema,
|
|
15230
|
-
stars: external_exports.number().int().min(0).optional(),
|
|
15231
|
-
downloads: external_exports.number().int().min(0).optional(),
|
|
15232
|
-
categories: categoriesSchema.optional(),
|
|
15233
|
-
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
15234
|
-
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
15235
|
-
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15236
|
-
downloadUrl: desktopExtensionZipUrlSchema,
|
|
15237
|
-
sha256: desktopExtensionHashSchema,
|
|
15238
|
-
slots: slotsSchema.optional(),
|
|
15239
|
-
publishedAt: external_exports.string().optional(),
|
|
15240
|
-
updatedAt: external_exports.string().optional(),
|
|
15241
|
-
minCodexHostVersion: external_exports.string().optional()
|
|
15242
|
-
});
|
|
15243
|
-
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
15244
|
-
schemaVersion: external_exports.literal(1),
|
|
15245
|
-
generatedAt: external_exports.string(),
|
|
15246
|
-
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, "Duplicate extension IDs")
|
|
15247
|
-
});
|
|
15248
|
-
var DESKTOP_EXTENSIONS_ASSET_METHOD = "codexhost/desktop/extensions/asset";
|
|
15249
|
-
var DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD = "codexhost/desktop/extensions/settings/get";
|
|
15250
|
-
var DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD = "codexhost/desktop/extensions/settings/set";
|
|
15251
|
-
var DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD = "codexhost/desktop/extensions/backend/invoke";
|
|
15252
|
-
var extensionIdParams = { id: desktopExtensionIdSchema };
|
|
15253
|
-
var desktopExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
15254
|
-
...extensionIdParams,
|
|
15255
|
-
path: desktopExtensionAssetPathSchema
|
|
15256
|
-
});
|
|
15257
|
-
var desktopExtensionsAssetResultSchema = external_exports.strictObject({
|
|
15258
|
-
mimeType: external_exports.string(),
|
|
15259
|
-
dataUrl: external_exports.string()
|
|
15260
|
-
});
|
|
15261
|
-
var desktopExtensionsSettingsGetParamsSchema = external_exports.strictObject(extensionIdParams);
|
|
15262
|
-
var desktopExtensionsSettingsSetParamsSchema = external_exports.strictObject({
|
|
15263
|
-
...extensionIdParams,
|
|
15264
|
-
values: jsonObjectSchema
|
|
15265
|
-
});
|
|
15266
|
-
var desktopExtensionsSettingsResultSchema = external_exports.strictObject({ values: jsonObjectSchema });
|
|
15267
|
-
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
15268
|
-
var desktopExtensionsBackendInvokeParamsSchema = external_exports.strictObject({
|
|
15269
|
-
...extensionIdParams,
|
|
15270
|
-
method: desktopExtensionBackendMethodSchema,
|
|
15271
|
-
params: jsonValueSchema.optional()
|
|
15272
|
-
});
|
|
15273
|
-
var desktopExtensionsBackendInvokeResultSchema = external_exports.strictObject({
|
|
15274
|
-
result: jsonValueSchema
|
|
15275
|
-
});
|
|
15276
|
-
|
|
15277
|
-
// ../../shared-contracts/dist/desktop-extension-management.js
|
|
15278
|
-
var DESKTOP_EXTENSIONS_LIST_METHOD = "codexhost/desktop/extensions/list";
|
|
15279
|
-
var DESKTOP_EXTENSIONS_ENABLE_METHOD = "codexhost/desktop/extensions/enable";
|
|
15280
|
-
var DESKTOP_EXTENSIONS_DISABLE_METHOD = "codexhost/desktop/extensions/disable";
|
|
15281
|
-
var DESKTOP_EXTENSIONS_CATALOG_METHOD = "codexhost/desktop/extensions/catalog";
|
|
15282
|
-
var DESKTOP_EXTENSIONS_INSTALL_METHOD = "codexhost/desktop/extensions/install";
|
|
15283
|
-
var DESKTOP_EXTENSIONS_UNINSTALL_METHOD = "codexhost/desktop/extensions/uninstall";
|
|
15284
|
-
var DESKTOP_EXTENSIONS_RECOVER_METHOD = "codexhost/desktop/extensions/disable-all-and-reload";
|
|
15285
|
-
var DESKTOP_EXTENSION_MANAGEMENT_METHODS = [
|
|
15286
|
-
DESKTOP_EXTENSIONS_LIST_METHOD,
|
|
15287
|
-
DESKTOP_EXTENSIONS_ENABLE_METHOD,
|
|
15288
|
-
DESKTOP_EXTENSIONS_DISABLE_METHOD,
|
|
15289
|
-
DESKTOP_EXTENSIONS_RECOVER_METHOD,
|
|
15290
|
-
DESKTOP_EXTENSIONS_CATALOG_METHOD,
|
|
15291
|
-
DESKTOP_EXTENSIONS_INSTALL_METHOD,
|
|
15292
|
-
DESKTOP_EXTENSIONS_UNINSTALL_METHOD,
|
|
15293
|
-
DESKTOP_EXTENSIONS_ASSET_METHOD,
|
|
15294
|
-
DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD,
|
|
15295
|
-
DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD,
|
|
15296
|
-
DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD
|
|
15297
|
-
];
|
|
15298
|
-
var revisionSchema = external_exports.int().nonnegative();
|
|
15299
|
-
var desktopExtensionsListParamsSchema = external_exports.strictObject({});
|
|
15300
|
-
var desktopExtensionSelectionParamsSchema = external_exports.strictObject({
|
|
15301
|
-
id: desktopExtensionIdSchema,
|
|
15302
|
-
expectedRevision: revisionSchema
|
|
15303
|
-
});
|
|
15304
|
-
var desktopExtensionsRecoveryParamsSchema = external_exports.strictObject({
|
|
15305
|
-
expectedRevision: revisionSchema.optional()
|
|
15306
|
-
});
|
|
15307
|
-
var rasterDataUrlSchema = (maxBytes) => external_exports.string().max("data:image/jpeg;base64,".length + 4 * Math.ceil(maxBytes / 3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
15308
|
-
var desktopExtensionListItemSchema = external_exports.strictObject({
|
|
15309
|
-
// An invalid discovery can have a directory name that isn't a valid extension ID.
|
|
15310
|
-
id: external_exports.string().min(1),
|
|
15311
|
-
manifest: desktopExtensionManifestSchema.optional(),
|
|
15312
|
-
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
15313
|
-
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15314
|
-
enabled: external_exports.boolean(),
|
|
15315
|
-
status: desktopExtensionStatusSchema
|
|
15316
|
-
});
|
|
15317
|
-
var desktopExtensionsListResultSchema = external_exports.strictObject({
|
|
15318
|
-
configuration: desktopExtensionConfigurationSchema,
|
|
15319
|
-
desktopConnected: external_exports.boolean(),
|
|
15320
|
-
diagnostics: external_exports.array(external_exports.string()),
|
|
15321
|
-
extensions: external_exports.array(desktopExtensionListItemSchema)
|
|
15322
|
-
});
|
|
15323
|
-
var desktopExtensionsCatalogParamsSchema = external_exports.strictObject({
|
|
15324
|
-
forceRefresh: external_exports.boolean().optional()
|
|
15325
|
-
});
|
|
15326
|
-
var desktopExtensionsCatalogResultSchema = external_exports.strictObject({
|
|
15327
|
-
catalogUrl: external_exports.string(),
|
|
15328
|
-
source: external_exports.enum(["remote", "fallback"]),
|
|
15329
|
-
fetchedAt: external_exports.string(),
|
|
15330
|
-
cached: external_exports.boolean(),
|
|
15331
|
-
extensions: desktopExtensionCatalogSchema.shape.extensions,
|
|
15332
|
-
error: external_exports.string().optional()
|
|
15333
|
-
});
|
|
15334
|
-
var desktopExtensionsInstallParamsSchema = external_exports.strictObject({
|
|
15335
|
-
source: external_exports.discriminatedUnion("type", [
|
|
15336
|
-
external_exports.strictObject({ type: external_exports.literal("catalog"), id: desktopExtensionIdSchema }),
|
|
15337
|
-
external_exports.strictObject({
|
|
15338
|
-
type: external_exports.literal("url"),
|
|
15339
|
-
url: desktopExtensionHttpUrlSchema,
|
|
15340
|
-
expectedSha256: desktopExtensionHashSchema.optional()
|
|
15341
|
-
}),
|
|
15342
|
-
external_exports.strictObject({
|
|
15343
|
-
type: external_exports.literal("zip-base64"),
|
|
15344
|
-
fileName: external_exports.string().trim().min(1).max(255),
|
|
15345
|
-
contentBase64: external_exports.string().min(4).max(DESKTOP_EXTENSION_ZIP_MAX_BASE64_LENGTH).refine((value) => value.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/u.test(value), "Expected standard padded base64")
|
|
15346
|
-
})
|
|
15347
|
-
])
|
|
15348
|
-
});
|
|
15349
|
-
var desktopExtensionsInstallResultSchema = external_exports.strictObject({
|
|
15350
|
-
extensionId: desktopExtensionIdSchema,
|
|
15351
|
-
version: external_exports.string().min(1),
|
|
15352
|
-
replaced: external_exports.boolean(),
|
|
15353
|
-
installedPath: external_exports.string(),
|
|
15354
|
-
list: desktopExtensionsListResultSchema
|
|
15355
|
-
});
|
|
15356
|
-
var desktopExtensionsUninstallParamsSchema = external_exports.strictObject({
|
|
15357
|
-
id: desktopExtensionIdSchema
|
|
15358
|
-
});
|
|
15359
|
-
var desktopExtensionsUninstallResultSchema = external_exports.strictObject({
|
|
15360
|
-
removedId: desktopExtensionIdSchema,
|
|
15361
|
-
list: desktopExtensionsListResultSchema
|
|
15362
|
-
});
|
|
15363
|
-
var desktopExtensionMutationResultSchema = external_exports.discriminatedUnion("state", [
|
|
15364
|
-
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: desktopExtensionConfigurationSchema }),
|
|
15365
|
-
external_exports.strictObject({ state: external_exports.literal("slot-conflict"), conflictWith: desktopExtensionIdSchema }),
|
|
15366
|
-
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: revisionSchema })
|
|
15367
|
-
]);
|
|
15368
|
-
|
|
15369
|
-
// ../../shared-contracts/dist/errors.js
|
|
15370
|
-
var codexhostErrorSchema = external_exports.strictObject({
|
|
15371
|
-
code: external_exports.string().min(1),
|
|
15372
|
-
message: external_exports.string().min(1),
|
|
15373
|
-
retryable: external_exports.boolean(),
|
|
15374
|
-
diagnostic: external_exports.string().min(1).optional(),
|
|
15375
|
-
stage: external_exports.string().min(1).optional(),
|
|
15376
|
-
durationMs: external_exports.number().int().nonnegative().optional(),
|
|
15377
|
-
stderrTail: external_exports.string().min(1).optional()
|
|
15378
|
-
}).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
|
|
15379
|
-
|
|
15380
|
-
// ../../shared-contracts/dist/harness-presentation.js
|
|
15381
|
-
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
15382
|
-
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text) => text.trim().length > 0);
|
|
15383
|
-
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
15384
|
-
label: displayText(256).optional(),
|
|
15385
|
-
description: displayText(1024).optional()
|
|
15386
|
-
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
15387
|
-
var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
15388
|
-
|
|
15389
|
-
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
15390
|
-
var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
|
|
15391
|
-
var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
|
|
15392
|
-
var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
|
|
15393
|
-
var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
|
|
15394
|
-
var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15395
|
-
message: "Value must not be empty or whitespace"
|
|
15396
|
-
});
|
|
15397
|
-
var harnessPermissionModeIdSchema = nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~:-]+$/u, "Permission Mode ID must use transport-safe characters").brand();
|
|
15398
|
-
var harnessPermissionModeSchema = external_exports.object({
|
|
15399
|
-
id: harnessPermissionModeIdSchema,
|
|
15400
|
-
label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
|
|
15401
|
-
description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
15402
|
-
dangerous: external_exports.boolean().optional(),
|
|
15403
|
-
localizations: harnessLocalizationsSchema.optional()
|
|
15404
|
-
}).strict();
|
|
15405
|
-
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
15406
|
-
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
15407
|
-
defaultModeId: harnessPermissionModeIdSchema
|
|
15408
|
-
}).strict().superRefine((catalog, context) => {
|
|
15409
|
-
const ids = /* @__PURE__ */ new Set();
|
|
15410
|
-
for (const [index, mode] of catalog.modes.entries()) {
|
|
15411
|
-
if (ids.has(mode.id)) {
|
|
15412
|
-
context.addIssue({
|
|
15413
|
-
code: "custom",
|
|
15414
|
-
message: "Permission Mode IDs must be unique",
|
|
15415
|
-
path: ["modes", index, "id"]
|
|
15416
|
-
});
|
|
15417
|
-
}
|
|
15418
|
-
ids.add(mode.id);
|
|
15419
|
-
}
|
|
15420
|
-
if (!ids.has(catalog.defaultModeId)) {
|
|
15421
|
-
context.addIssue({
|
|
15422
|
-
code: "custom",
|
|
15423
|
-
message: "Default Permission Mode must exist in the catalog",
|
|
15424
|
-
path: ["defaultModeId"]
|
|
15425
|
-
});
|
|
15011
|
+
if (!ids.has(catalog.defaultModeId)) {
|
|
15012
|
+
context.addIssue({
|
|
15013
|
+
code: "custom",
|
|
15014
|
+
message: "Default Permission Mode must exist in the catalog",
|
|
15015
|
+
path: ["defaultModeId"]
|
|
15016
|
+
});
|
|
15426
15017
|
}
|
|
15427
15018
|
});
|
|
15428
15019
|
var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
@@ -15430,6 +15021,9 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
|
15430
15021
|
permissionModeId: harnessPermissionModeIdSchema
|
|
15431
15022
|
}).strict();
|
|
15432
15023
|
|
|
15024
|
+
// ../../shared-contracts/dist/harness-route-limit.js
|
|
15025
|
+
var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
|
|
15026
|
+
|
|
15433
15027
|
// ../../shared-contracts/dist/thread-usage.js
|
|
15434
15028
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15435
15029
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -15455,14 +15049,14 @@ var usageMeasurementsSchema = external_exports.object({
|
|
|
15455
15049
|
outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
|
|
15456
15050
|
timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
|
|
15457
15051
|
}).strict();
|
|
15458
|
-
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((
|
|
15052
|
+
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
|
|
15459
15053
|
var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
15460
15054
|
kind: external_exports.literal("countdown"),
|
|
15461
15055
|
id: external_exports.string().min(1).max(64),
|
|
15462
15056
|
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
15463
15057
|
label: indicatorTextSchema(256).optional(),
|
|
15464
15058
|
tooltip: indicatorTextSchema(1024).optional()
|
|
15465
|
-
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) =>
|
|
15059
|
+
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, {
|
|
15466
15060
|
message: "Composer indicator IDs must be unique"
|
|
15467
15061
|
});
|
|
15468
15062
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
@@ -15488,6 +15082,7 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
15488
15082
|
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
15489
15083
|
sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
|
|
15490
15084
|
timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
15085
|
+
latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
15491
15086
|
costSource: external_exports.enum(["publicPrice", "native"]).optional(),
|
|
15492
15087
|
unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
|
|
15493
15088
|
}).strict().superRefine((usage, context) => {
|
|
@@ -15615,10 +15210,15 @@ var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
|
|
|
15615
15210
|
var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15616
15211
|
message: "Value must not be empty or whitespace"
|
|
15617
15212
|
});
|
|
15618
|
-
var harnessModelRefIdSchema =
|
|
15213
|
+
var harnessModelRefIdSchema = external_exports.string().min(1).max(HARNESS_MODEL_REF_MAX_LENGTH).refine((id2) => !new RegExp("\\p{Cc}", "u").test(id2), "Model Ref must not contain control characters").brand();
|
|
15214
|
+
var harnessModelServiceTierSchema = external_exports.enum(["priority", "ultrafast"]);
|
|
15619
15215
|
var harnessModelRefSchema = external_exports.object({
|
|
15620
|
-
id: harnessModelRefIdSchema
|
|
15216
|
+
id: harnessModelRefIdSchema,
|
|
15217
|
+
serviceTier: harnessModelServiceTierSchema.optional()
|
|
15621
15218
|
}).strict();
|
|
15219
|
+
function sameHarnessModelRef(left, right) {
|
|
15220
|
+
return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
|
|
15221
|
+
}
|
|
15622
15222
|
var harnessThinkingOptionIdSchema = nonBlankTextSchema2.max(HARNESS_THINKING_OPTION_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Thinking option ID must use transport-safe characters").brand();
|
|
15623
15223
|
var harnessResolvedModelLabelSchema = nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
15624
15224
|
var harnessThinkingOptionSchema = external_exports.object({
|
|
@@ -15632,7 +15232,15 @@ var harnessModelSchema = external_exports.object({
|
|
|
15632
15232
|
/** Optional opaque selection for this same Model with priority processing enabled. */
|
|
15633
15233
|
fastModel: harnessModelRefSchema.optional(),
|
|
15634
15234
|
supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
|
|
15635
|
-
}).strict()
|
|
15235
|
+
}).strict().refine((model2) => model2.fastModel?.serviceTier === void 0 || model2.fastModel.id === model2.ref.id, {
|
|
15236
|
+
path: ["fastModel", "id"],
|
|
15237
|
+
message: "A tiered Fast Model must share the base Model ID"
|
|
15238
|
+
});
|
|
15239
|
+
function catalogModelForRef(catalog, ref) {
|
|
15240
|
+
if (!ref)
|
|
15241
|
+
return void 0;
|
|
15242
|
+
return catalog?.models.find((model2) => sameHarnessModelRef(model2.ref, ref) || sameHarnessModelRef(model2.fastModel, ref));
|
|
15243
|
+
}
|
|
15636
15244
|
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
|
|
15637
15245
|
const ids = /* @__PURE__ */ new Set();
|
|
15638
15246
|
for (const [index, option] of options.entries()) {
|
|
@@ -15652,26 +15260,26 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
15652
15260
|
thinkingOptions: harnessThinkingOptionsSchema,
|
|
15653
15261
|
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
15654
15262
|
}).strict().superRefine((catalog, context) => {
|
|
15655
|
-
const refs =
|
|
15656
|
-
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) =>
|
|
15263
|
+
const refs = [];
|
|
15264
|
+
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
|
|
15657
15265
|
for (const [index, model2] of catalog.models.entries()) {
|
|
15658
|
-
if (refs.
|
|
15266
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
|
|
15659
15267
|
context.addIssue({
|
|
15660
15268
|
code: "custom",
|
|
15661
15269
|
message: "Model Catalog refs must be unique",
|
|
15662
15270
|
path: ["models", index, "ref", "id"]
|
|
15663
15271
|
});
|
|
15664
15272
|
}
|
|
15665
|
-
refs.
|
|
15273
|
+
refs.push(model2.ref);
|
|
15666
15274
|
if (model2.fastModel) {
|
|
15667
|
-
if (refs.
|
|
15275
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.fastModel))) {
|
|
15668
15276
|
context.addIssue({
|
|
15669
15277
|
code: "custom",
|
|
15670
15278
|
message: "Fast Model refs must be distinct and unique",
|
|
15671
15279
|
path: ["models", index, "fastModel"]
|
|
15672
15280
|
});
|
|
15673
15281
|
}
|
|
15674
|
-
refs.
|
|
15282
|
+
refs.push(model2.fastModel);
|
|
15675
15283
|
}
|
|
15676
15284
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
15677
15285
|
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
@@ -15692,7 +15300,7 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
15692
15300
|
}
|
|
15693
15301
|
}
|
|
15694
15302
|
}
|
|
15695
|
-
if (catalog.defaultModel && !
|
|
15303
|
+
if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
|
|
15696
15304
|
context.addIssue({
|
|
15697
15305
|
code: "custom",
|
|
15698
15306
|
message: "Default Model must exist in the Model Catalog",
|
|
@@ -15732,7 +15340,12 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
|
15732
15340
|
observe: external_exports.boolean()
|
|
15733
15341
|
}).strict().optional(),
|
|
15734
15342
|
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
15735
|
-
steer: external_exports.boolean().optional()
|
|
15343
|
+
steer: external_exports.boolean().optional(),
|
|
15344
|
+
/**
|
|
15345
|
+
* True when the native plan (task list) outlives the Turn that changed it, so a reopened
|
|
15346
|
+
* Thread gets its latest plan again. Otherwise a plan stays with the Turn that made it.
|
|
15347
|
+
*/
|
|
15348
|
+
persistentPlan: external_exports.boolean().optional()
|
|
15736
15349
|
}).strict();
|
|
15737
15350
|
var harnessConfigurationStateSchema = external_exports.object({
|
|
15738
15351
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
@@ -15741,7 +15354,7 @@ var harnessConfigurationStateSchema = external_exports.object({
|
|
|
15741
15354
|
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15742
15355
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
|
|
15743
15356
|
}).strict().superRefine((state, context) => {
|
|
15744
|
-
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) =>
|
|
15357
|
+
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
|
|
15745
15358
|
context.addIssue({
|
|
15746
15359
|
code: "custom",
|
|
15747
15360
|
message: "Effective Thinking option must be currently available",
|
|
@@ -15749,150 +15362,698 @@ var harnessConfigurationStateSchema = external_exports.object({
|
|
|
15749
15362
|
});
|
|
15750
15363
|
}
|
|
15751
15364
|
});
|
|
15752
|
-
var harnessWebUiCapabilitySchema = external_exports.object({
|
|
15753
|
-
open: external_exports.literal(true)
|
|
15754
|
-
}).strict();
|
|
15755
|
-
var readyHarnessInspectionSchema = external_exports.object({
|
|
15756
|
-
status: external_exports.literal("ready"),
|
|
15757
|
-
catalog: harnessModelCatalogSchema,
|
|
15758
|
-
permissionModes: harnessPermissionModeCatalogSchema.optional(),
|
|
15759
|
-
capabilities: harnessSessionCapabilitiesSchema,
|
|
15760
|
-
webUi: harnessWebUiCapabilitySchema.optional()
|
|
15761
|
-
}).strict().superRefine((inspection, context) => {
|
|
15762
|
-
const selectable = inspection.capabilities.configuration.selectPermissionMode;
|
|
15763
|
-
if (selectable !== Boolean(inspection.permissionModes)) {
|
|
15764
|
-
context.addIssue({
|
|
15765
|
-
code: "custom",
|
|
15766
|
-
message: "Permission Mode catalog and capability must agree",
|
|
15767
|
-
path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
|
|
15768
|
-
});
|
|
15769
|
-
}
|
|
15365
|
+
var harnessWebUiCapabilitySchema = external_exports.object({
|
|
15366
|
+
open: external_exports.literal(true)
|
|
15367
|
+
}).strict();
|
|
15368
|
+
var readyHarnessInspectionSchema = external_exports.object({
|
|
15369
|
+
status: external_exports.literal("ready"),
|
|
15370
|
+
catalog: harnessModelCatalogSchema,
|
|
15371
|
+
permissionModes: harnessPermissionModeCatalogSchema.optional(),
|
|
15372
|
+
capabilities: harnessSessionCapabilitiesSchema,
|
|
15373
|
+
webUi: harnessWebUiCapabilitySchema.optional()
|
|
15374
|
+
}).strict().superRefine((inspection, context) => {
|
|
15375
|
+
const selectable = inspection.capabilities.configuration.selectPermissionMode;
|
|
15376
|
+
if (selectable !== Boolean(inspection.permissionModes)) {
|
|
15377
|
+
context.addIssue({
|
|
15378
|
+
code: "custom",
|
|
15379
|
+
message: "Permission Mode catalog and capability must agree",
|
|
15380
|
+
path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
|
|
15381
|
+
});
|
|
15382
|
+
}
|
|
15383
|
+
});
|
|
15384
|
+
var failedHarnessInspectionSchema = external_exports.object({
|
|
15385
|
+
status: external_exports.enum(["notInstalled", "unavailable", "error"]),
|
|
15386
|
+
error: codexhostErrorSchema
|
|
15387
|
+
}).strict();
|
|
15388
|
+
var harnessInspectionSchema = external_exports.union([
|
|
15389
|
+
readyHarnessInspectionSchema,
|
|
15390
|
+
failedHarnessInspectionSchema
|
|
15391
|
+
]);
|
|
15392
|
+
var harnessInspectParamsSchema = external_exports.object({
|
|
15393
|
+
harnessId: harnessIdSchema,
|
|
15394
|
+
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
15395
|
+
refresh: external_exports.boolean().optional(),
|
|
15396
|
+
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
15397
|
+
purpose: external_exports.literal("availability").optional(),
|
|
15398
|
+
credentialAccess: external_exports.enum(["allow", "retry"]).optional()
|
|
15399
|
+
}).strict();
|
|
15400
|
+
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15401
|
+
harnessId: harnessIdSchema
|
|
15402
|
+
}).strict();
|
|
15403
|
+
var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
|
|
15404
|
+
var threadModelSelectParamsSchema = external_exports.object({
|
|
15405
|
+
threadId: hostThreadIdSchema,
|
|
15406
|
+
model: harnessModelRefSchema
|
|
15407
|
+
}).strict();
|
|
15408
|
+
var threadThinkingSelectParamsSchema = external_exports.object({
|
|
15409
|
+
threadId: hostThreadIdSchema,
|
|
15410
|
+
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
15411
|
+
}).strict();
|
|
15412
|
+
var threadInspectionParamsSchema = external_exports.object({
|
|
15413
|
+
threadId: hostThreadIdSchema,
|
|
15414
|
+
includeReferenceCapability: external_exports.boolean().optional()
|
|
15415
|
+
}).strict();
|
|
15416
|
+
var codexThreadInspectionSchema = external_exports.object({
|
|
15417
|
+
owner: external_exports.literal("codex"),
|
|
15418
|
+
locked: external_exports.boolean(),
|
|
15419
|
+
effectiveModel: harnessModelRefSchema.optional(),
|
|
15420
|
+
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15421
|
+
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15422
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15423
|
+
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
15424
|
+
supportsThreadReferences: external_exports.literal(true).optional()
|
|
15425
|
+
}).strict();
|
|
15426
|
+
var externalThreadInspectionSchema = external_exports.object({
|
|
15427
|
+
owner: external_exports.literal("external"),
|
|
15428
|
+
harnessId: nonBlankTextSchema2.max(256),
|
|
15429
|
+
transportModelId: nonBlankTextSchema2.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
|
|
15430
|
+
effectiveModel: harnessModelRefSchema.optional(),
|
|
15431
|
+
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15432
|
+
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15433
|
+
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15434
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15435
|
+
/** Live Session catalog when it, not the Adapter inspection, contains `effectiveModel`. */
|
|
15436
|
+
catalog: harnessModelCatalogSchema.optional(),
|
|
15437
|
+
history: harnessHistoryCapabilitiesSchema,
|
|
15438
|
+
usage: threadUsageSnapshotSchema.optional(),
|
|
15439
|
+
locked: external_exports.literal(true)
|
|
15440
|
+
}).strict();
|
|
15441
|
+
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
15442
|
+
codexThreadInspectionSchema,
|
|
15443
|
+
externalThreadInspectionSchema
|
|
15444
|
+
]);
|
|
15445
|
+
var threadOwnershipListParamsSchema = external_exports.object({
|
|
15446
|
+
threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15447
|
+
}).strict().superRefine(({ threadIds }, context) => {
|
|
15448
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15449
|
+
for (const [index, threadId] of threadIds.entries()) {
|
|
15450
|
+
if (seen.has(threadId)) {
|
|
15451
|
+
context.addIssue({
|
|
15452
|
+
code: "custom",
|
|
15453
|
+
message: "Thread ownership-list IDs must be unique",
|
|
15454
|
+
path: ["threadIds", index]
|
|
15455
|
+
});
|
|
15456
|
+
}
|
|
15457
|
+
seen.add(threadId);
|
|
15458
|
+
}
|
|
15459
|
+
});
|
|
15460
|
+
var codexThreadOwnershipSchema = external_exports.object({
|
|
15461
|
+
threadId: hostThreadIdSchema,
|
|
15462
|
+
owner: external_exports.literal("codex")
|
|
15463
|
+
}).strict();
|
|
15464
|
+
var externalThreadOwnershipSchema = external_exports.object({
|
|
15465
|
+
threadId: hostThreadIdSchema,
|
|
15466
|
+
owner: external_exports.literal("external"),
|
|
15467
|
+
harnessId: external_exports.string().max(256).pipe(harnessIdSchema)
|
|
15468
|
+
}).strict();
|
|
15469
|
+
var threadOwnershipSchema = external_exports.discriminatedUnion("owner", [
|
|
15470
|
+
codexThreadOwnershipSchema,
|
|
15471
|
+
externalThreadOwnershipSchema
|
|
15472
|
+
]);
|
|
15473
|
+
var threadOwnershipListResultSchema = external_exports.object({
|
|
15474
|
+
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15475
|
+
}).strict().superRefine(({ threads }, context) => {
|
|
15476
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15477
|
+
for (const [index, thread2] of threads.entries()) {
|
|
15478
|
+
if (seen.has(thread2.threadId)) {
|
|
15479
|
+
context.addIssue({
|
|
15480
|
+
code: "custom",
|
|
15481
|
+
message: "Thread ownership-list results must be unique",
|
|
15482
|
+
path: ["threads", index, "threadId"]
|
|
15483
|
+
});
|
|
15484
|
+
}
|
|
15485
|
+
seen.add(thread2.threadId);
|
|
15486
|
+
}
|
|
15487
|
+
});
|
|
15488
|
+
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
15489
|
+
threadId: hostThreadIdSchema,
|
|
15490
|
+
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15491
|
+
text: external_exports.string().optional()
|
|
15492
|
+
}).strict();
|
|
15493
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15494
|
+
kind: external_exports.literal("application"),
|
|
15495
|
+
value: external_exports.string().transform((text2, context) => {
|
|
15496
|
+
try {
|
|
15497
|
+
return JSON.parse(text2);
|
|
15498
|
+
} catch {
|
|
15499
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15500
|
+
return external_exports.NEVER;
|
|
15501
|
+
}
|
|
15502
|
+
}).pipe(external_exports.object({
|
|
15503
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15504
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15505
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15506
|
+
}).strict())
|
|
15507
|
+
}).strict().transform((context) => context.value);
|
|
15508
|
+
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15509
|
+
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15510
|
+
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15511
|
+
}).strict();
|
|
15512
|
+
|
|
15513
|
+
// ../../shared-contracts/dist/harness-plugins.js
|
|
15514
|
+
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
15515
|
+
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
15516
|
+
var HARNESS_PLUGIN_LIMIT = 128;
|
|
15517
|
+
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
15518
|
+
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
15519
|
+
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id2) => id2 !== "codex", "The official Codex identity is reserved");
|
|
15520
|
+
var pluginRelativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
|
|
15521
|
+
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
15522
|
+
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
15523
|
+
var harnessInstallationGuideSchema = external_exports.object({
|
|
15524
|
+
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
15525
|
+
before: localizedTextSchema.optional(),
|
|
15526
|
+
after: localizedTextSchema.optional(),
|
|
15527
|
+
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
15528
|
+
}).strict();
|
|
15529
|
+
var pluginPresentationShape = {
|
|
15530
|
+
id: installedHarnessPluginIdSchema,
|
|
15531
|
+
name: external_exports.string().trim().min(1).max(128),
|
|
15532
|
+
version: external_exports.string().min(1).max(128),
|
|
15533
|
+
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
15534
|
+
kind: external_exports.literal("usage").optional(),
|
|
15535
|
+
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
15536
|
+
iconStyle: external_exports.object({
|
|
15537
|
+
vector: external_exports.object({
|
|
15538
|
+
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
15539
|
+
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
15540
|
+
paths: external_exports.array(external_exports.object({
|
|
15541
|
+
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
15542
|
+
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
15543
|
+
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
15544
|
+
}).strict()).min(1).max(32)
|
|
15545
|
+
}).strict().optional(),
|
|
15546
|
+
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
15547
|
+
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
15548
|
+
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
15549
|
+
}).strict().optional(),
|
|
15550
|
+
installation: harnessInstallationGuideSchema.optional(),
|
|
15551
|
+
notice: localizedTextSchema.optional(),
|
|
15552
|
+
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
15553
|
+
launchCommand: external_exports.literal(true).optional(),
|
|
15554
|
+
links: external_exports.object({
|
|
15555
|
+
website: documentationUrlSchema.optional(),
|
|
15556
|
+
documentation: documentationUrlSchema.optional(),
|
|
15557
|
+
installation: documentationUrlSchema.optional()
|
|
15558
|
+
}).strict().optional()
|
|
15559
|
+
};
|
|
15560
|
+
var harnessPluginManifestSchema = external_exports.object({
|
|
15561
|
+
manifestVersion: external_exports.literal(1),
|
|
15562
|
+
...pluginPresentationShape,
|
|
15563
|
+
adapterApiVersion: external_exports.number().int().positive(),
|
|
15564
|
+
entry: pluginRelativeResourceSchema,
|
|
15565
|
+
icon: pluginRelativeResourceSchema.optional()
|
|
15566
|
+
}).strict();
|
|
15567
|
+
var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
15568
|
+
var harnessPluginDescriptorSchema = external_exports.object({
|
|
15569
|
+
...pluginPresentationShape,
|
|
15570
|
+
icon: harnessPluginIconSchema.optional()
|
|
15571
|
+
}).strict();
|
|
15572
|
+
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
15573
|
+
var harnessPluginListResultSchema = external_exports.object({
|
|
15574
|
+
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
15575
|
+
}).strict();
|
|
15576
|
+
var harnessPluginConfigurationSchema = external_exports.object({
|
|
15577
|
+
version: external_exports.literal(1),
|
|
15578
|
+
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
15579
|
+
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
15580
|
+
message: "Enabled plugin IDs must be unique",
|
|
15581
|
+
path: ["enabled"]
|
|
15582
|
+
});
|
|
15583
|
+
|
|
15584
|
+
// ../../shared-contracts/dist/desktop-extensions.js
|
|
15585
|
+
var DESKTOP_EXTENSION_API_VERSION = 1;
|
|
15586
|
+
var DESKTOP_EXTENSION_LIMIT = 64;
|
|
15587
|
+
var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
|
|
15588
|
+
var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
|
|
15589
|
+
var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
|
|
15590
|
+
var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
|
|
15591
|
+
var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
|
|
15592
|
+
var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
|
|
15593
|
+
var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
|
|
15594
|
+
var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
|
|
15595
|
+
var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
|
|
15596
|
+
var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
|
|
15597
|
+
var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
|
|
15598
|
+
var desktopExtensionIdSchema = installedPluginIdSchema;
|
|
15599
|
+
var desktopExtensionSlotSchema = external_exports.enum([
|
|
15600
|
+
"sidebar.thread-layout",
|
|
15601
|
+
"sidebar.thread-badge",
|
|
15602
|
+
"appearance.theme"
|
|
15603
|
+
]);
|
|
15604
|
+
var desktopExtensionCategorySchema = external_exports.enum([
|
|
15605
|
+
"appearance",
|
|
15606
|
+
"interface",
|
|
15607
|
+
"workflow",
|
|
15608
|
+
"analytics",
|
|
15609
|
+
"integrations",
|
|
15610
|
+
"tools"
|
|
15611
|
+
]);
|
|
15612
|
+
var extensionName = external_exports.string().trim().min(1).max(128);
|
|
15613
|
+
function desktopExtensionScreenshotMimeType(resource) {
|
|
15614
|
+
switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
|
|
15615
|
+
case "png":
|
|
15616
|
+
return "image/png";
|
|
15617
|
+
case "jpg":
|
|
15618
|
+
case "jpeg":
|
|
15619
|
+
return "image/jpeg";
|
|
15620
|
+
case "webp":
|
|
15621
|
+
return "image/webp";
|
|
15622
|
+
default:
|
|
15623
|
+
return void 0;
|
|
15624
|
+
}
|
|
15625
|
+
}
|
|
15626
|
+
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
15627
|
+
var imagePathSchema = pluginRelativeResourceSchema.refine((resource) => desktopExtensionScreenshotMimeType(resource) !== void 0 && hasPortableSegments(resource), "Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space");
|
|
15628
|
+
var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu, "Expected an HTTP(S) URL").pipe(external_exports.url({ protocol: /^https?$/u })).refine((value) => {
|
|
15629
|
+
const { username, password } = new URL(value);
|
|
15630
|
+
return !username && !password && !/[\\\s]/u.test(value);
|
|
15631
|
+
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
15632
|
+
function localizedText(text2) {
|
|
15633
|
+
return external_exports.strictObject({ en: text2, "zh-CN": text2 });
|
|
15634
|
+
}
|
|
15635
|
+
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
15636
|
+
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
15637
|
+
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
15638
|
+
var settingField = {
|
|
15639
|
+
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
15640
|
+
label: desktopExtensionLocalizedTextSchema,
|
|
15641
|
+
description: desktopExtensionLocalizedTextSchema.optional()
|
|
15642
|
+
};
|
|
15643
|
+
var numericSetting = {
|
|
15644
|
+
...settingField,
|
|
15645
|
+
step: external_exports.number().positive().optional(),
|
|
15646
|
+
default: external_exports.number().optional()
|
|
15647
|
+
};
|
|
15648
|
+
var settingOption = external_exports.strictObject({
|
|
15649
|
+
value: external_exports.string(),
|
|
15650
|
+
label: desktopExtensionLocalizedTextSchema
|
|
15651
|
+
});
|
|
15652
|
+
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
15653
|
+
external_exports.strictObject({
|
|
15654
|
+
...settingField,
|
|
15655
|
+
type: external_exports.literal("boolean"),
|
|
15656
|
+
default: external_exports.boolean().optional()
|
|
15657
|
+
}),
|
|
15658
|
+
external_exports.strictObject({
|
|
15659
|
+
...settingField,
|
|
15660
|
+
type: external_exports.literal("string"),
|
|
15661
|
+
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
15662
|
+
default: external_exports.string().optional()
|
|
15663
|
+
}),
|
|
15664
|
+
external_exports.strictObject({
|
|
15665
|
+
...numericSetting,
|
|
15666
|
+
type: external_exports.literal("number"),
|
|
15667
|
+
min: external_exports.number().optional(),
|
|
15668
|
+
max: external_exports.number().optional()
|
|
15669
|
+
}),
|
|
15670
|
+
external_exports.strictObject({
|
|
15671
|
+
...numericSetting,
|
|
15672
|
+
type: external_exports.literal("range"),
|
|
15673
|
+
min: external_exports.number(),
|
|
15674
|
+
max: external_exports.number()
|
|
15675
|
+
}),
|
|
15676
|
+
external_exports.strictObject({
|
|
15677
|
+
...settingField,
|
|
15678
|
+
type: external_exports.literal("select"),
|
|
15679
|
+
options: external_exports.array(settingOption).min(1),
|
|
15680
|
+
default: external_exports.string().optional()
|
|
15681
|
+
})
|
|
15682
|
+
]).superRefine((field2, ctx) => {
|
|
15683
|
+
const issue2 = (path11, message) => ctx.addIssue({ code: "custom", path: [path11], message });
|
|
15684
|
+
if (field2.type === "number" || field2.type === "range") {
|
|
15685
|
+
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
15686
|
+
if (min > max)
|
|
15687
|
+
issue2("max", "Must be at least min");
|
|
15688
|
+
if (value !== void 0 && (value < min || value > max))
|
|
15689
|
+
issue2("default", "Must be within min and max");
|
|
15690
|
+
} else if (field2.type === "select") {
|
|
15691
|
+
const values = new Set(field2.options.map(({ value }) => value));
|
|
15692
|
+
if (values.size !== field2.options.length)
|
|
15693
|
+
issue2("options", "Duplicate option values");
|
|
15694
|
+
if (field2.default !== void 0 && !values.has(field2.default))
|
|
15695
|
+
issue2("default", "Must match an option value");
|
|
15696
|
+
}
|
|
15697
|
+
});
|
|
15698
|
+
var manifestHeader = external_exports.object({
|
|
15699
|
+
manifestVersion: external_exports.int().positive(),
|
|
15700
|
+
id: desktopExtensionIdSchema,
|
|
15701
|
+
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
15702
|
+
version: external_exports.string().min(1).max(128),
|
|
15703
|
+
desktopApi: external_exports.int().positive()
|
|
15704
|
+
}).passthrough();
|
|
15705
|
+
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
15706
|
+
manifestVersion: external_exports.literal(1),
|
|
15707
|
+
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
15708
|
+
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
15709
|
+
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
15710
|
+
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
15711
|
+
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
15712
|
+
icon: imagePathSchema.optional(),
|
|
15713
|
+
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
15714
|
+
desktop: external_exports.strictObject({
|
|
15715
|
+
script: pluginRelativeResourceSchema,
|
|
15716
|
+
style: pluginRelativeResourceSchema.optional()
|
|
15717
|
+
}).optional(),
|
|
15718
|
+
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
15719
|
+
slots: slotsSchema.default(() => []),
|
|
15720
|
+
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
15721
|
+
categories: categoriesSchema.optional()
|
|
15722
|
+
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
15723
|
+
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
15724
|
+
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
15725
|
+
state: external_exports.enum([
|
|
15726
|
+
"running",
|
|
15727
|
+
"disabled",
|
|
15728
|
+
"invalid",
|
|
15729
|
+
"incompatible",
|
|
15730
|
+
"conflict",
|
|
15731
|
+
"failed",
|
|
15732
|
+
"waiting"
|
|
15733
|
+
]),
|
|
15734
|
+
hash: desktopExtensionHashSchema.optional(),
|
|
15735
|
+
error: external_exports.string().optional(),
|
|
15736
|
+
conflictWith: desktopExtensionIdSchema.optional()
|
|
15737
|
+
});
|
|
15738
|
+
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
15739
|
+
controllerPid: external_exports.int().positive(),
|
|
15740
|
+
targetId: external_exports.string().nullable(),
|
|
15741
|
+
updatedAt: external_exports.iso.datetime(),
|
|
15742
|
+
handledReloadToken: external_exports.uuid().optional(),
|
|
15743
|
+
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema),
|
|
15744
|
+
surfaces: external_exports.record(external_exports.string(), desktopExtensionStatusSchema).optional()
|
|
15745
|
+
});
|
|
15746
|
+
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
15747
|
+
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
15748
|
+
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
15749
|
+
}
|
|
15750
|
+
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input2) => {
|
|
15751
|
+
const url2 = new URL(input2);
|
|
15752
|
+
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);
|
|
15753
|
+
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
15754
|
+
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
15755
|
+
id: desktopExtensionIdSchema,
|
|
15756
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
15757
|
+
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
15758
|
+
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
15759
|
+
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
15760
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
15761
|
+
repository: desktopExtensionHttpUrlSchema,
|
|
15762
|
+
stars: external_exports.number().int().min(0).optional(),
|
|
15763
|
+
downloads: external_exports.number().int().min(0).optional(),
|
|
15764
|
+
categories: categoriesSchema.optional(),
|
|
15765
|
+
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
15766
|
+
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
15767
|
+
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15768
|
+
downloadUrl: desktopExtensionZipUrlSchema,
|
|
15769
|
+
sha256: desktopExtensionHashSchema,
|
|
15770
|
+
slots: slotsSchema.optional(),
|
|
15771
|
+
publishedAt: external_exports.string().optional(),
|
|
15772
|
+
updatedAt: external_exports.string().optional(),
|
|
15773
|
+
minCodexHostVersion: external_exports.string().optional()
|
|
15774
|
+
});
|
|
15775
|
+
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
15776
|
+
schemaVersion: external_exports.literal(1),
|
|
15777
|
+
generatedAt: external_exports.string(),
|
|
15778
|
+
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
15770
15779
|
});
|
|
15771
|
-
var
|
|
15772
|
-
|
|
15773
|
-
|
|
15774
|
-
|
|
15775
|
-
var
|
|
15776
|
-
|
|
15777
|
-
|
|
15780
|
+
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
15781
|
+
|
|
15782
|
+
// ../../shared-contracts/dist/host-extensions.js
|
|
15783
|
+
var reservedName = /^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu;
|
|
15784
|
+
var HOST_EXTENSION_PAGE_API_VERSION = 1;
|
|
15785
|
+
var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedName.test(id2), "Reserved extension ID");
|
|
15786
|
+
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
15787
|
+
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
15788
|
+
var hostExtensionActivationIdSchema = external_exports.uuid();
|
|
15789
|
+
var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((path11) => path11.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
|
|
15790
|
+
var legacy = desktopExtensionManifestSchema.shape;
|
|
15791
|
+
var localized = (max, min = 0) => external_exports.strictObject({
|
|
15792
|
+
en: external_exports.string().trim().min(min).max(max),
|
|
15793
|
+
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
15794
|
+
});
|
|
15795
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path11) => path11.endsWith(suffix), `Expected a ${suffix} file`);
|
|
15796
|
+
var moduleEntry = resourceWithSuffix(".mjs");
|
|
15797
|
+
var style = resourceWithSuffix(".css").optional();
|
|
15798
|
+
var hostExtensionCanonicalPath = (path11) => path11.normalize("NFC").toLowerCase();
|
|
15799
|
+
var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
15800
|
+
manifestVersion: external_exports.literal(2),
|
|
15801
|
+
id: hostExtensionIdSchema,
|
|
15802
|
+
name: localized(128, 1),
|
|
15803
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
15804
|
+
description: localized(4096),
|
|
15805
|
+
details: localized(16384).optional(),
|
|
15806
|
+
author: legacy.author,
|
|
15807
|
+
repository: legacy.repository,
|
|
15808
|
+
icon: legacy.icon.refine((path11) => path11 === void 0 || hostExtensionResourcePathSchema.safeParse(path11).success),
|
|
15809
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path11) => hostExtensionResourcePathSchema.safeParse(path11).success)),
|
|
15810
|
+
categories: legacy.categories,
|
|
15811
|
+
settingsSchema: legacy.settingsSchema,
|
|
15812
|
+
slots: legacy.slots.removeDefault().optional(),
|
|
15813
|
+
page: external_exports.strictObject({
|
|
15814
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
15815
|
+
entry: moduleEntry,
|
|
15816
|
+
style,
|
|
15817
|
+
title: localized(128, 1).optional()
|
|
15818
|
+
}).optional(),
|
|
15819
|
+
widget: external_exports.strictObject({
|
|
15820
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
15821
|
+
entry: moduleEntry,
|
|
15822
|
+
style
|
|
15823
|
+
}).optional(),
|
|
15824
|
+
desktop: external_exports.strictObject({ apiVersion: external_exports.literal(1), script: resourceWithSuffix(".js"), style }).optional(),
|
|
15825
|
+
web: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry.optional(), style }).refine(({ entry, style: style2 }) => entry !== void 0 || style2 !== void 0, "Expected a Web entry or style").optional(),
|
|
15826
|
+
backend: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry }).optional()
|
|
15827
|
+
}).refine(({ page, widget, desktop, web, backend }) => Boolean(page || widget || desktop || web || backend), "Expected at least one page, widget, desktop, web, or backend entry").refine(({ page, widget, web, backend }) => !backend || [page?.entry, widget?.entry, web?.entry].every((entry) => entry === void 0 || hostExtensionCanonicalPath(entry) !== hostExtensionCanonicalPath(backend.entry)), { path: ["backend", "entry"], message: "A backend entry cannot also be a frontend entry" });
|
|
15828
|
+
function targetsForCapabilities({ hasPage, hasWidget, hasDesktop, hasWeb, hasBackend }) {
|
|
15829
|
+
if (hasPage || hasWidget || hasBackend && !hasDesktop && !hasWeb)
|
|
15830
|
+
return ["desktop", "web"];
|
|
15831
|
+
const targets = [];
|
|
15832
|
+
if (hasDesktop)
|
|
15833
|
+
targets.push("desktop");
|
|
15834
|
+
if (hasWeb)
|
|
15835
|
+
targets.push("web");
|
|
15836
|
+
return targets;
|
|
15837
|
+
}
|
|
15838
|
+
var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
|
|
15839
|
+
|
|
15840
|
+
// ../../shared-contracts/dist/host-extension-management.js
|
|
15841
|
+
var HOST_EXTENSION_ZIP_MAX_BYTES = DESKTOP_EXTENSION_ZIP_MAX_BYTES;
|
|
15842
|
+
var hostExtensionRevisionSchema = external_exports.int().nonnegative();
|
|
15843
|
+
var hostExtensionConfigurationSchema = external_exports.strictObject({
|
|
15844
|
+
revision: hostExtensionRevisionSchema,
|
|
15845
|
+
enabled: external_exports.array(hostExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs")
|
|
15846
|
+
});
|
|
15847
|
+
var { downloadUrl, ...catalogMetadata } = desktopExtensionCatalogEntrySchema.shape;
|
|
15848
|
+
var hostExtensionCatalogEntrySchema = external_exports.object({
|
|
15849
|
+
...catalogMetadata,
|
|
15850
|
+
id: hostExtensionIdSchema,
|
|
15851
|
+
format: external_exports.literal("codexhost"),
|
|
15852
|
+
targets: external_exports.array(hostExtensionTargetSchema).min(1).max(2).refine((targets) => new Set(targets).size === targets.length, "Duplicate targets"),
|
|
15853
|
+
apis: external_exports.strictObject({
|
|
15854
|
+
page: external_exports.int().positive().optional(),
|
|
15855
|
+
widget: external_exports.int().positive().optional(),
|
|
15856
|
+
desktop: external_exports.int().positive().optional(),
|
|
15857
|
+
web: external_exports.int().positive().optional(),
|
|
15858
|
+
backend: external_exports.int().positive().optional()
|
|
15859
|
+
}),
|
|
15860
|
+
downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS")
|
|
15861
|
+
}).refine(({ targets, apis }) => {
|
|
15862
|
+
const derived = targetsForCapabilities({
|
|
15863
|
+
hasPage: Boolean(apis.page),
|
|
15864
|
+
hasWidget: Boolean(apis.widget),
|
|
15865
|
+
hasDesktop: Boolean(apis.desktop),
|
|
15866
|
+
hasWeb: Boolean(apis.web),
|
|
15867
|
+
hasBackend: Boolean(apis.backend)
|
|
15868
|
+
});
|
|
15869
|
+
return targets.length === derived.length && derived.every((target2) => targets.includes(target2));
|
|
15870
|
+
}, "Catalog targets must match the declared APIs");
|
|
15871
|
+
var hostExtensionCatalogSchema = external_exports.object({
|
|
15872
|
+
schemaVersion: external_exports.literal(2),
|
|
15873
|
+
generatedAt: external_exports.string().min(1),
|
|
15874
|
+
extensions: external_exports.array(hostExtensionCatalogEntrySchema).max(1e4).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
15875
|
+
});
|
|
15876
|
+
var hostExtensionsCatalogResultSchema = hostExtensionCatalogSchema.extend({
|
|
15877
|
+
catalogUrl: desktopExtensionHttpUrlSchema,
|
|
15878
|
+
fetchedAt: external_exports.iso.datetime(),
|
|
15879
|
+
cached: external_exports.boolean()
|
|
15880
|
+
});
|
|
15881
|
+
var id = { id: hostExtensionIdSchema };
|
|
15882
|
+
var active = {
|
|
15883
|
+
...id,
|
|
15884
|
+
activationId: hostExtensionActivationIdSchema,
|
|
15885
|
+
digest: hostExtensionDigestSchema
|
|
15886
|
+
};
|
|
15887
|
+
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
15888
|
+
var filePath = external_exports.string().min(1).max(4096).refine((path11) => /^(?:\/|[a-z]:[/\\])/iu.test(path11) && !path11.includes("\0") && !path11.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
|
|
15889
|
+
var gitRef = external_exports.string().min(1).max(256).refine((ref) => ref.split("/").every((part) => part && /^[a-z0-9_.-]+$/iu.test(part) && part !== "." && part !== ".."), "Invalid GitHub ref");
|
|
15890
|
+
function base643(maxBytes) {
|
|
15891
|
+
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
15892
|
+
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
15893
|
+
return value.length % 4 === 0 && value.length * 3 / 4 - padding <= maxBytes && /^[A-Za-z0-9+/]*={0,2}$/u.test(value);
|
|
15894
|
+
}, "Expected bounded standard padded base64");
|
|
15895
|
+
}
|
|
15896
|
+
var hostExtensionGitHubSourceSchema = external_exports.strictObject({
|
|
15897
|
+
type: external_exports.literal("github"),
|
|
15898
|
+
repository: external_exports.string().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),
|
|
15899
|
+
ref: gitRef.optional(),
|
|
15900
|
+
tag: gitRef.optional(),
|
|
15901
|
+
asset: external_exports.string().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),
|
|
15902
|
+
subpath: hostExtensionResourcePathSchema.optional()
|
|
15903
|
+
}).refine(({ ref, tag, asset }) => !ref || !tag && !asset, "Use either a zipball ref or a release tag/asset");
|
|
15904
|
+
var hostExtensionInstallSourceSchema = external_exports.union([
|
|
15905
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
15906
|
+
hostExtensionGitHubSourceSchema,
|
|
15907
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), base64: base643(HOST_EXTENSION_ZIP_MAX_BYTES).min(4) }),
|
|
15908
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), localZipPath: filePath }),
|
|
15909
|
+
external_exports.strictObject({ type: external_exports.literal("localDir"), localDir: filePath })
|
|
15778
15910
|
]);
|
|
15779
|
-
var
|
|
15780
|
-
|
|
15781
|
-
|
|
15782
|
-
|
|
15783
|
-
|
|
15784
|
-
purpose: external_exports.literal("availability").optional()
|
|
15785
|
-
}).strict();
|
|
15786
|
-
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15787
|
-
harnessId: harnessIdSchema
|
|
15788
|
-
}).strict();
|
|
15789
|
-
var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
|
|
15790
|
-
var threadModelSelectParamsSchema = external_exports.object({
|
|
15791
|
-
threadId: hostThreadIdSchema,
|
|
15792
|
-
model: harnessModelRefSchema
|
|
15793
|
-
}).strict();
|
|
15794
|
-
var threadThinkingSelectParamsSchema = external_exports.object({
|
|
15795
|
-
threadId: hostThreadIdSchema,
|
|
15796
|
-
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
15797
|
-
}).strict();
|
|
15798
|
-
var threadInspectionParamsSchema = external_exports.object({
|
|
15799
|
-
threadId: hostThreadIdSchema,
|
|
15800
|
-
includeReferenceCapability: external_exports.boolean().optional()
|
|
15801
|
-
}).strict();
|
|
15802
|
-
var codexThreadInspectionSchema = external_exports.object({
|
|
15803
|
-
owner: external_exports.literal("codex"),
|
|
15804
|
-
locked: external_exports.boolean(),
|
|
15805
|
-
effectiveModel: harnessModelRefSchema.optional(),
|
|
15806
|
-
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15807
|
-
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15808
|
-
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15809
|
-
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
15810
|
-
supportsThreadReferences: external_exports.literal(true).optional()
|
|
15811
|
-
}).strict();
|
|
15812
|
-
var externalThreadInspectionSchema = external_exports.object({
|
|
15813
|
-
owner: external_exports.literal("external"),
|
|
15814
|
-
harnessId: nonBlankTextSchema2.max(256),
|
|
15815
|
-
transportModelId: nonBlankTextSchema2.max(1024),
|
|
15816
|
-
effectiveModel: harnessModelRefSchema.optional(),
|
|
15817
|
-
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15818
|
-
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15819
|
-
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15820
|
-
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15821
|
-
history: harnessHistoryCapabilitiesSchema,
|
|
15822
|
-
usage: threadUsageSnapshotSchema.optional(),
|
|
15823
|
-
locked: external_exports.literal(true)
|
|
15824
|
-
}).strict();
|
|
15825
|
-
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
15826
|
-
codexThreadInspectionSchema,
|
|
15827
|
-
externalThreadInspectionSchema
|
|
15911
|
+
var hostExtensionProvenanceSchema = external_exports.discriminatedUnion("type", [
|
|
15912
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
15913
|
+
hostExtensionGitHubSourceSchema,
|
|
15914
|
+
external_exports.strictObject({ type: external_exports.literal("zip") }),
|
|
15915
|
+
external_exports.strictObject({ type: external_exports.literal("localDir") })
|
|
15828
15916
|
]);
|
|
15829
|
-
var
|
|
15830
|
-
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
if (seen.has(threadId)) {
|
|
15835
|
-
context.addIssue({
|
|
15836
|
-
code: "custom",
|
|
15837
|
-
message: "Thread ownership-list IDs must be unique",
|
|
15838
|
-
path: ["threadIds", index]
|
|
15839
|
-
});
|
|
15840
|
-
}
|
|
15841
|
-
seen.add(threadId);
|
|
15842
|
-
}
|
|
15917
|
+
var hostExtensionInstallationSchema = external_exports.strictObject({
|
|
15918
|
+
...active,
|
|
15919
|
+
manifest: hostExtensionManifestV2Schema,
|
|
15920
|
+
installedAt: external_exports.iso.datetime(),
|
|
15921
|
+
source: hostExtensionProvenanceSchema.optional()
|
|
15843
15922
|
});
|
|
15844
|
-
var
|
|
15845
|
-
|
|
15846
|
-
|
|
15847
|
-
|
|
15848
|
-
|
|
15849
|
-
|
|
15850
|
-
|
|
15851
|
-
|
|
15852
|
-
|
|
15853
|
-
|
|
15854
|
-
|
|
15855
|
-
|
|
15923
|
+
var rasterDataUrlSchema = (maxBytes) => external_exports.string().max("data:image/jpeg;base64,".length + 4 * Math.ceil(maxBytes / 3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
15924
|
+
var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
|
|
15925
|
+
var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
|
|
15926
|
+
var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
|
|
15927
|
+
hostExtensionInstallationSchema.extend({
|
|
15928
|
+
state: external_exports.literal("valid"),
|
|
15929
|
+
enabled: external_exports.boolean(),
|
|
15930
|
+
...desktopConflict,
|
|
15931
|
+
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
15932
|
+
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15933
|
+
backendState: backendState.optional(),
|
|
15934
|
+
backendError: external_exports.string().optional()
|
|
15935
|
+
}),
|
|
15936
|
+
external_exports.strictObject({
|
|
15937
|
+
state: external_exports.enum(["invalid", "incompatible"]),
|
|
15938
|
+
id: external_exports.string().min(1),
|
|
15939
|
+
enabled: external_exports.boolean(),
|
|
15940
|
+
error: external_exports.string()
|
|
15941
|
+
})
|
|
15856
15942
|
]);
|
|
15857
|
-
var
|
|
15858
|
-
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
-
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
|
|
15943
|
+
var hostExtensionsListResultSchema = external_exports.strictObject({
|
|
15944
|
+
revision: hostExtensionRevisionSchema,
|
|
15945
|
+
configuration: hostExtensionConfigurationSchema,
|
|
15946
|
+
diagnostics: external_exports.array(external_exports.string()),
|
|
15947
|
+
extensions: external_exports.array(hostExtensionListItemSchema)
|
|
15948
|
+
});
|
|
15949
|
+
var hostExtensionRuntimeEntrySchema = hostExtensionInstallationSchema.extend({
|
|
15950
|
+
...desktopConflict,
|
|
15951
|
+
settingsRevision: hostExtensionRevisionSchema
|
|
15952
|
+
});
|
|
15953
|
+
var hostExtensionsSnapshotResultSchema = external_exports.strictObject({
|
|
15954
|
+
/** The Host publishes this revision in extensions-changed, independent of enabled.json's revision. */
|
|
15955
|
+
revision: hostExtensionRevisionSchema,
|
|
15956
|
+
// Enabled, valid activations only. A Desktop conflict does not hide other capabilities.
|
|
15957
|
+
extensions: external_exports.array(hostExtensionRuntimeEntrySchema).max(DESKTOP_EXTENSION_LIMIT)
|
|
15958
|
+
});
|
|
15959
|
+
var HOST_EXTENSIONS_RPC = {
|
|
15960
|
+
list: "codexhost/extensions/list",
|
|
15961
|
+
snapshot: "codexhost/extensions/snapshot",
|
|
15962
|
+
catalog: "codexhost/extensions/catalog",
|
|
15963
|
+
install: "codexhost/extensions/install",
|
|
15964
|
+
update: "codexhost/extensions/update",
|
|
15965
|
+
enable: "codexhost/extensions/enable",
|
|
15966
|
+
disable: "codexhost/extensions/disable",
|
|
15967
|
+
uninstall: "codexhost/extensions/uninstall",
|
|
15968
|
+
recover: "codexhost/extensions/recover",
|
|
15969
|
+
asset: "codexhost/extensions/asset",
|
|
15970
|
+
settingsGet: "codexhost/extensions/settings/get",
|
|
15971
|
+
settingsSet: "codexhost/extensions/settings/set",
|
|
15972
|
+
backendInvoke: "codexhost/extensions/backend/invoke"
|
|
15973
|
+
};
|
|
15974
|
+
var HOST_EXTENSION_MANAGEMENT_METHODS = Object.freeze(Object.values(HOST_EXTENSIONS_RPC));
|
|
15975
|
+
var methods = new Set(HOST_EXTENSION_MANAGEMENT_METHODS);
|
|
15976
|
+
var noParams = external_exports.strictObject({});
|
|
15977
|
+
var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
|
|
15978
|
+
var selection = external_exports.strictObject({ ...id, ...expectedRevision });
|
|
15979
|
+
var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
|
|
15980
|
+
var mutationResult = external_exports.discriminatedUnion("state", [
|
|
15981
|
+
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
|
|
15982
|
+
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
|
|
15983
|
+
]);
|
|
15984
|
+
var hostExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
15985
|
+
...optionalActivation,
|
|
15986
|
+
digest: active.digest.optional(),
|
|
15987
|
+
path: hostExtensionResourcePathSchema
|
|
15988
|
+
});
|
|
15989
|
+
var hostExtensionsAssetResultSchema = external_exports.strictObject({
|
|
15990
|
+
mimeType: external_exports.string().min(1),
|
|
15991
|
+
base64: base643(DESKTOP_EXTENSION_ASSET_MAX_BYTES),
|
|
15992
|
+
digest: active.digest
|
|
15993
|
+
});
|
|
15994
|
+
var hostExtensionSettingsSchema = external_exports.strictObject({
|
|
15995
|
+
settingsRevision: hostExtensionRevisionSchema,
|
|
15996
|
+
values: jsonObjectSchema
|
|
15871
15997
|
});
|
|
15872
|
-
var
|
|
15873
|
-
|
|
15874
|
-
|
|
15875
|
-
|
|
15876
|
-
|
|
15877
|
-
|
|
15878
|
-
|
|
15879
|
-
|
|
15880
|
-
|
|
15881
|
-
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
|
|
15885
|
-
|
|
15886
|
-
|
|
15887
|
-
|
|
15888
|
-
|
|
15889
|
-
|
|
15890
|
-
|
|
15891
|
-
}
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15895
|
-
|
|
15998
|
+
var hostExtensionsRpcSchemas = {
|
|
15999
|
+
[HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
|
|
16000
|
+
[HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
|
|
16001
|
+
[HOST_EXTENSIONS_RPC.catalog]: {
|
|
16002
|
+
params: external_exports.strictObject({ forceRefresh: external_exports.boolean().optional() }),
|
|
16003
|
+
result: hostExtensionsCatalogResultSchema
|
|
16004
|
+
},
|
|
16005
|
+
[HOST_EXTENSIONS_RPC.install]: {
|
|
16006
|
+
params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
|
|
16007
|
+
result: installationResult
|
|
16008
|
+
},
|
|
16009
|
+
[HOST_EXTENSIONS_RPC.update]: {
|
|
16010
|
+
params: external_exports.strictObject({
|
|
16011
|
+
...id,
|
|
16012
|
+
expectedDigest: active.digest,
|
|
16013
|
+
expectedActivationId: active.activationId.optional(),
|
|
16014
|
+
source: hostExtensionInstallSourceSchema.optional()
|
|
16015
|
+
}),
|
|
16016
|
+
result: installationResult
|
|
16017
|
+
},
|
|
16018
|
+
[HOST_EXTENSIONS_RPC.enable]: { params: selection, result: mutationResult },
|
|
16019
|
+
[HOST_EXTENSIONS_RPC.disable]: { params: selection, result: mutationResult },
|
|
16020
|
+
[HOST_EXTENSIONS_RPC.uninstall]: {
|
|
16021
|
+
params: external_exports.strictObject({
|
|
16022
|
+
...id,
|
|
16023
|
+
removeData: external_exports.boolean().optional(),
|
|
16024
|
+
expectedDigest: active.digest.optional()
|
|
16025
|
+
}),
|
|
16026
|
+
result: external_exports.strictObject({ ...id, removed: external_exports.boolean() })
|
|
16027
|
+
},
|
|
16028
|
+
[HOST_EXTENSIONS_RPC.recover]: {
|
|
16029
|
+
params: external_exports.strictObject({ expectedRevision: expectedRevision.expectedRevision.optional() }),
|
|
16030
|
+
result: mutationResult
|
|
16031
|
+
},
|
|
16032
|
+
[HOST_EXTENSIONS_RPC.asset]: {
|
|
16033
|
+
params: hostExtensionsAssetParamsSchema,
|
|
16034
|
+
result: hostExtensionsAssetResultSchema
|
|
16035
|
+
},
|
|
16036
|
+
[HOST_EXTENSIONS_RPC.settingsGet]: {
|
|
16037
|
+
params: external_exports.strictObject(optionalActivation),
|
|
16038
|
+
result: hostExtensionSettingsSchema
|
|
16039
|
+
},
|
|
16040
|
+
[HOST_EXTENSIONS_RPC.settingsSet]: {
|
|
16041
|
+
params: external_exports.strictObject({
|
|
16042
|
+
...optionalActivation,
|
|
16043
|
+
expectedSettingsRevision: hostExtensionRevisionSchema,
|
|
16044
|
+
values: jsonObjectSchema
|
|
16045
|
+
}),
|
|
16046
|
+
result: hostExtensionSettingsSchema
|
|
16047
|
+
},
|
|
16048
|
+
[HOST_EXTENSIONS_RPC.backendInvoke]: {
|
|
16049
|
+
params: external_exports.strictObject({
|
|
16050
|
+
...optionalActivation,
|
|
16051
|
+
method: hostExtensionBackendMethodSchema,
|
|
16052
|
+
params: jsonValueSchema.optional()
|
|
16053
|
+
}),
|
|
16054
|
+
result: external_exports.strictObject({ result: jsonValueSchema })
|
|
16055
|
+
}
|
|
16056
|
+
};
|
|
15896
16057
|
|
|
15897
16058
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
15898
16059
|
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
@@ -15938,6 +16099,8 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
15938
16099
|
"codexhost/workspace/read",
|
|
15939
16100
|
"codexhost/thread/tree/read",
|
|
15940
16101
|
"codexhost/thread/pins/list",
|
|
16102
|
+
"codexhost/thread/sections/list",
|
|
16103
|
+
"codexhost/thread/sections/move",
|
|
15941
16104
|
"codexhost/thread/pins/set",
|
|
15942
16105
|
"codexhost/harness/plugins/list",
|
|
15943
16106
|
"codexhost/harness/inspect",
|
|
@@ -15955,7 +16118,7 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
15955
16118
|
"codexhost/harness/session-import/list",
|
|
15956
16119
|
"codexhost/harness/session-import/import",
|
|
15957
16120
|
// Host settings shared across Desktop and Web.
|
|
15958
|
-
...
|
|
16121
|
+
...HOST_EXTENSION_MANAGEMENT_METHODS,
|
|
15959
16122
|
"codexhost/harness/installation",
|
|
15960
16123
|
"codexhost/harness/installation/start",
|
|
15961
16124
|
"codexhost/harness/installation/status",
|
|
@@ -15976,8 +16139,21 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
15976
16139
|
"codexhost/update/check",
|
|
15977
16140
|
"codexhost/update/start",
|
|
15978
16141
|
"codexhost/update/status",
|
|
16142
|
+
"codexhost/announcement/get",
|
|
16143
|
+
"codexhost/announcement/acknowledge",
|
|
15979
16144
|
"codexhost/sessions/loaded/list"
|
|
15980
16145
|
];
|
|
16146
|
+
var clientThreadSectionsSchema = external_exports.object({
|
|
16147
|
+
sections: external_exports.array(external_exports.object({
|
|
16148
|
+
id: external_exports.string().min(1),
|
|
16149
|
+
name: external_exports.string().min(1),
|
|
16150
|
+
threads: external_exports.array(jsonObjectSchema)
|
|
16151
|
+
}).strict())
|
|
16152
|
+
}).strict();
|
|
16153
|
+
var clientThreadSectionMoveSchema = external_exports.object({
|
|
16154
|
+
threadId: external_exports.string().min(1).max(1024),
|
|
16155
|
+
sectionId: external_exports.string().min(1).max(1024).nullable()
|
|
16156
|
+
}).strict();
|
|
15981
16157
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
15982
16158
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
15983
16159
|
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
@@ -16016,6 +16192,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
16016
16192
|
cursor: clientChannelCursorSchema,
|
|
16017
16193
|
revision: external_exports.number().int().nonnegative()
|
|
16018
16194
|
}),
|
|
16195
|
+
external_exports.object({
|
|
16196
|
+
type: external_exports.literal("extensions-changed"),
|
|
16197
|
+
cursor: clientChannelCursorSchema,
|
|
16198
|
+
revision: hostExtensionRevisionSchema
|
|
16199
|
+
}),
|
|
16019
16200
|
external_exports.object({
|
|
16020
16201
|
type: external_exports.literal("hello"),
|
|
16021
16202
|
version: external_exports.literal(1),
|
|
@@ -16452,7 +16633,7 @@ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
|
|
|
16452
16633
|
|
|
16453
16634
|
// ../../shared-contracts/dist/harness-preferences.js
|
|
16454
16635
|
var harnessPreferenceScopeSchema = external_exports.string().regex(/^external$/u);
|
|
16455
|
-
var preferenceHarnessKey = harnessIdSchema.transform((
|
|
16636
|
+
var preferenceHarnessKey = harnessIdSchema.transform((id2) => String(id2));
|
|
16456
16637
|
var harnessDefaultConfigurationSchema = external_exports.strictObject({
|
|
16457
16638
|
model: harnessModelRefSchema.optional(),
|
|
16458
16639
|
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
@@ -16462,11 +16643,19 @@ var newThreadDefaultsSchema = external_exports.strictObject({
|
|
|
16462
16643
|
lastHarness: harnessIdSchema.optional(),
|
|
16463
16644
|
byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
|
|
16464
16645
|
});
|
|
16646
|
+
var harnessDelegationDefaultSchema = external_exports.strictObject({
|
|
16647
|
+
model: harnessModelRefSchema.optional(),
|
|
16648
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
16649
|
+
}).refine((value) => Boolean(value.model || value.thinkingOptionId), "A delegation default must contain a Model or Thinking option");
|
|
16650
|
+
var delegationDefaultsSchema = external_exports.strictObject({
|
|
16651
|
+
byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
|
|
16652
|
+
});
|
|
16465
16653
|
var modelId = external_exports.string().min(1).max(1024);
|
|
16466
16654
|
var harnessPreferenceValuesSchema = external_exports.strictObject({
|
|
16467
16655
|
idleRelease: idleReleaseSettingsSchema.optional(),
|
|
16468
16656
|
favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
|
|
16469
|
-
newThread: newThreadDefaultsSchema.optional()
|
|
16657
|
+
newThread: newThreadDefaultsSchema.optional(),
|
|
16658
|
+
delegation: delegationDefaultsSchema.optional()
|
|
16470
16659
|
});
|
|
16471
16660
|
var harnessPreferenceSnapshotSchema = external_exports.strictObject({
|
|
16472
16661
|
scope: harnessPreferenceScopeSchema,
|
|
@@ -16494,6 +16683,11 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
|
|
|
16494
16683
|
lastHarness: harnessIdSchema.optional(),
|
|
16495
16684
|
harnessId: harnessIdSchema.optional(),
|
|
16496
16685
|
configuration: harnessDefaultConfigurationSchema.optional()
|
|
16686
|
+
}),
|
|
16687
|
+
external_exports.strictObject({
|
|
16688
|
+
kind: external_exports.literal("delegation"),
|
|
16689
|
+
harnessId: harnessIdSchema,
|
|
16690
|
+
configuration: harnessDelegationDefaultSchema.nullable()
|
|
16497
16691
|
})
|
|
16498
16692
|
]);
|
|
16499
16693
|
var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
@@ -16501,8 +16695,8 @@ var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
|
16501
16695
|
operations: external_exports.array(harnessPreferenceOperationSchema).min(1).max(256),
|
|
16502
16696
|
initializeOnly: external_exports.boolean().optional(),
|
|
16503
16697
|
expectedRevision: external_exports.number().int().nonnegative().optional()
|
|
16504
|
-
}).superRefine((
|
|
16505
|
-
for (const operation of
|
|
16698
|
+
}).superRefine((input2, ctx) => {
|
|
16699
|
+
for (const operation of input2.operations) {
|
|
16506
16700
|
if (operation.kind === "newThread" && (!operation.lastHarness && !operation.configuration || Boolean(operation.harnessId) !== Boolean(operation.configuration)))
|
|
16507
16701
|
ctx.addIssue({
|
|
16508
16702
|
code: "custom",
|
|
@@ -16904,13 +17098,18 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
16904
17098
|
// ../../shared-contracts/dist/harness-installation.js
|
|
16905
17099
|
var harnessInstallationParamsSchema = external_exports.object({
|
|
16906
17100
|
harnessId: harnessIdSchema,
|
|
16907
|
-
action: external_exports.enum(["check", "update", "install"])
|
|
16908
|
-
|
|
17101
|
+
action: external_exports.enum(["check", "update", "install"]),
|
|
17102
|
+
confirmedVersion: external_exports.string().min(1).max(128).optional()
|
|
17103
|
+
}).strict().refine(({ action, confirmedVersion }) => action === "update" || confirmedVersion === void 0);
|
|
16909
17104
|
var harnessInstallationStateSchema = external_exports.object({
|
|
16910
17105
|
currentVersion: external_exports.string().min(1).max(128),
|
|
16911
17106
|
latestVersion: external_exports.string().min(1).max(128),
|
|
16912
17107
|
updateAvailable: external_exports.boolean(),
|
|
16913
17108
|
canUpdate: external_exports.boolean(),
|
|
17109
|
+
/** Present when the Adapter has a verified list and the available target is outside it. */
|
|
17110
|
+
latestVerifiedVersion: external_exports.string().min(1).max(128).optional(),
|
|
17111
|
+
/** Update preflight stopped before running the installer; latestVersion needs confirmation. */
|
|
17112
|
+
confirmationRequired: external_exports.literal(true).optional(),
|
|
16914
17113
|
/** Defaults to CLI; some Harnesses ship only inside a desktop application. */
|
|
16915
17114
|
versionKind: external_exports.enum(["cli", "application"]).optional(),
|
|
16916
17115
|
/** Official download opened by the user; does not imply an automatic installation. */
|
|
@@ -17240,6 +17439,38 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
17240
17439
|
status: updateStatusSchema.nullable()
|
|
17241
17440
|
});
|
|
17242
17441
|
|
|
17442
|
+
// ../../shared-contracts/dist/release-announcement.js
|
|
17443
|
+
var RELEASE_ANNOUNCEMENT_MAX_THEMES = 12;
|
|
17444
|
+
var releaseAnnouncementThemeSchema = external_exports.strictObject({
|
|
17445
|
+
icon: external_exports.string().min(1).max(16).optional(),
|
|
17446
|
+
title: external_exports.string().min(1).max(120),
|
|
17447
|
+
body: external_exports.string().min(1).max(1200),
|
|
17448
|
+
contributors: external_exports.array(external_exports.string().min(1).max(39)).max(30)
|
|
17449
|
+
});
|
|
17450
|
+
var releaseAnnouncementContentSchema = external_exports.strictObject({
|
|
17451
|
+
summary: external_exports.string().min(1).max(600).optional(),
|
|
17452
|
+
themes: external_exports.array(releaseAnnouncementThemeSchema).min(1).max(RELEASE_ANNOUNCEMENT_MAX_THEMES)
|
|
17453
|
+
});
|
|
17454
|
+
var releaseAnnouncementSchema = external_exports.strictObject({
|
|
17455
|
+
version: updateSemanticVersionSchema,
|
|
17456
|
+
publishedAt: external_exports.iso.datetime(),
|
|
17457
|
+
url: external_exports.string().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),
|
|
17458
|
+
zh: releaseAnnouncementContentSchema.nullable(),
|
|
17459
|
+
en: releaseAnnouncementContentSchema.nullable()
|
|
17460
|
+
}).refine((value) => value.zh !== null || value.en !== null, {
|
|
17461
|
+
message: "an announcement needs at least one language"
|
|
17462
|
+
});
|
|
17463
|
+
var releaseAnnouncementGetParamsSchema = external_exports.strictObject({
|
|
17464
|
+
manual: external_exports.boolean().optional()
|
|
17465
|
+
});
|
|
17466
|
+
var releaseAnnouncementGetResultSchema = external_exports.strictObject({
|
|
17467
|
+
announcement: releaseAnnouncementSchema.nullable(),
|
|
17468
|
+
unread: external_exports.boolean()
|
|
17469
|
+
});
|
|
17470
|
+
var releaseAnnouncementAcknowledgeParamsSchema = external_exports.strictObject({
|
|
17471
|
+
version: updateSemanticVersionSchema
|
|
17472
|
+
});
|
|
17473
|
+
|
|
17243
17474
|
// ../../shared-contracts/dist/thread-watch-notice.js
|
|
17244
17475
|
var THREAD_WATCH_NOTICE_OUTCOMES = [
|
|
17245
17476
|
"completed",
|
|
@@ -17287,17 +17518,67 @@ var remoteSshSetupResultSchema = external_exports.object({ state: external_expor
|
|
|
17287
17518
|
|
|
17288
17519
|
// ../../shared-contracts/dist/remote-sessions.js
|
|
17289
17520
|
var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
|
|
17290
|
-
var
|
|
17521
|
+
var REMOTE_IDENTITY_MAX_LENGTH = 1024;
|
|
17522
|
+
var identity = external_exports.string().min(1).max(REMOTE_IDENTITY_MAX_LENGTH);
|
|
17291
17523
|
var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
|
|
17292
17524
|
var thread = { ...target, threadId: identity };
|
|
17525
|
+
var text = external_exports.string().min(1).max(8e3);
|
|
17526
|
+
var input = { text, requestId: identity };
|
|
17527
|
+
var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
|
|
17528
|
+
external_exports.object({ accepted: external_exports.literal(true), startQueuedItemId: identity.optional() }),
|
|
17529
|
+
external_exports.object({
|
|
17530
|
+
accepted: external_exports.literal(false),
|
|
17531
|
+
code: external_exports.enum([
|
|
17532
|
+
"remote/queue-unavailable",
|
|
17533
|
+
"remote/steer-unavailable",
|
|
17534
|
+
"remote/turn-changed",
|
|
17535
|
+
"remote/send-rejected",
|
|
17536
|
+
"session/queue-item-not-found",
|
|
17537
|
+
"session/queue-item-starting"
|
|
17538
|
+
]),
|
|
17539
|
+
message: external_exports.string()
|
|
17540
|
+
})
|
|
17541
|
+
]);
|
|
17542
|
+
var remoteQueueSnapshotSchema = external_exports.discriminatedUnion("available", [
|
|
17543
|
+
external_exports.object({ available: external_exports.literal(false) }),
|
|
17544
|
+
external_exports.object({
|
|
17545
|
+
available: external_exports.literal(true),
|
|
17546
|
+
items: external_exports.array(external_exports.object({ id: identity, clientUserMessageId: identity, preview: external_exports.string().max(801) })).max(100)
|
|
17547
|
+
})
|
|
17548
|
+
]);
|
|
17293
17549
|
var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
17294
17550
|
external_exports.strictObject({ kind: external_exports.literal("hosts") }),
|
|
17551
|
+
external_exports.strictObject({
|
|
17552
|
+
kind: external_exports.literal("create"),
|
|
17553
|
+
...target,
|
|
17554
|
+
cwd: external_exports.string().min(1).max(8192),
|
|
17555
|
+
epoch: identity
|
|
17556
|
+
}),
|
|
17557
|
+
external_exports.strictObject({ kind: external_exports.literal("projectHarnesses"), ...target, epoch: identity }),
|
|
17558
|
+
external_exports.strictObject({
|
|
17559
|
+
kind: external_exports.literal("inspectHarness"),
|
|
17560
|
+
...target,
|
|
17561
|
+
epoch: identity,
|
|
17562
|
+
cwd: external_exports.string().min(1).max(8192),
|
|
17563
|
+
harnessId: identity
|
|
17564
|
+
}),
|
|
17565
|
+
external_exports.strictObject({
|
|
17566
|
+
kind: external_exports.literal("startSelected"),
|
|
17567
|
+
...target,
|
|
17568
|
+
epoch: identity,
|
|
17569
|
+
cwd: external_exports.string().min(1).max(8192),
|
|
17570
|
+
harnessId: identity,
|
|
17571
|
+
model: external_exports.string().min(1).max(4096),
|
|
17572
|
+
serviceTier: external_exports.enum(["priority", "ultrafast"]).optional(),
|
|
17573
|
+
reasoningEffort: identity.optional()
|
|
17574
|
+
}),
|
|
17295
17575
|
external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
|
|
17296
17576
|
external_exports.strictObject({
|
|
17297
17577
|
kind: external_exports.literal("list"),
|
|
17298
17578
|
...target,
|
|
17299
17579
|
cursor: external_exports.string().nullable(),
|
|
17300
|
-
archived: external_exports.boolean()
|
|
17580
|
+
archived: external_exports.boolean(),
|
|
17581
|
+
includeLoaded: external_exports.literal(true).optional()
|
|
17301
17582
|
}),
|
|
17302
17583
|
external_exports.strictObject({
|
|
17303
17584
|
kind: external_exports.literal("read"),
|
|
@@ -17317,16 +17598,35 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
17317
17598
|
...thread,
|
|
17318
17599
|
epoch: identity,
|
|
17319
17600
|
modelId: identity.optional(),
|
|
17601
|
+
serviceTier: harnessModelServiceTierSchema.optional(),
|
|
17320
17602
|
thinkingOptionId: identity.optional(),
|
|
17321
17603
|
permissionModeId: identity.optional()
|
|
17322
|
-
}).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
|
|
17604
|
+
}).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting").refine((value) => value.serviceTier === void 0 || value.modelId !== void 0, {
|
|
17605
|
+
message: "A service tier requires a Model ID"
|
|
17606
|
+
}),
|
|
17323
17607
|
external_exports.strictObject({
|
|
17324
17608
|
kind: external_exports.literal("prompt"),
|
|
17325
17609
|
...thread,
|
|
17326
17610
|
epoch: identity,
|
|
17327
|
-
text
|
|
17611
|
+
text,
|
|
17328
17612
|
requestId: identity.optional()
|
|
17329
17613
|
}),
|
|
17614
|
+
external_exports.strictObject({ kind: external_exports.literal("queue"), ...thread, epoch: identity }),
|
|
17615
|
+
external_exports.strictObject({
|
|
17616
|
+
kind: external_exports.literal("delivery"),
|
|
17617
|
+
...thread,
|
|
17618
|
+
epoch: identity,
|
|
17619
|
+
action: external_exports.discriminatedUnion("kind", [
|
|
17620
|
+
external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input }),
|
|
17621
|
+
external_exports.strictObject({ kind: external_exports.literal("steer"), ...input, turnId: identity }),
|
|
17622
|
+
external_exports.strictObject({ kind: external_exports.literal("remove"), itemId: identity }),
|
|
17623
|
+
external_exports.strictObject({
|
|
17624
|
+
kind: external_exports.literal("start"),
|
|
17625
|
+
itemId: identity,
|
|
17626
|
+
onlyIfHead: external_exports.literal(true).optional()
|
|
17627
|
+
})
|
|
17628
|
+
])
|
|
17629
|
+
}),
|
|
17330
17630
|
external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
|
|
17331
17631
|
external_exports.strictObject({
|
|
17332
17632
|
kind: external_exports.literal("rename"),
|
|
@@ -17369,7 +17669,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
17369
17669
|
external_exports.strictObject({ action: external_exports.literal("catalog") }),
|
|
17370
17670
|
external_exports.strictObject({
|
|
17371
17671
|
action: external_exports.literal("read-thread"),
|
|
17372
|
-
hostId: hostId.refine((
|
|
17672
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
17373
17673
|
input: delegationReadParamsSchema
|
|
17374
17674
|
}),
|
|
17375
17675
|
external_exports.strictObject({
|
|
@@ -17383,7 +17683,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
17383
17683
|
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
17384
17684
|
external_exports.strictObject({
|
|
17385
17685
|
action: external_exports.literal("update"),
|
|
17386
|
-
hostId: hostId.refine((
|
|
17686
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
17387
17687
|
version: remoteUpdateParamsSchema.shape.version
|
|
17388
17688
|
})
|
|
17389
17689
|
]);
|
|
@@ -17447,7 +17747,7 @@ function invalidRequest(message) {
|
|
|
17447
17747
|
return { code: "invalidRequest", message, retryable: false };
|
|
17448
17748
|
}
|
|
17449
17749
|
function validateHostApprovalResponse(interaction, response) {
|
|
17450
|
-
return interaction.actions.some(({ id }) =>
|
|
17750
|
+
return interaction.actions.some(({ id: id2 }) => id2 === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
|
|
17451
17751
|
}
|
|
17452
17752
|
|
|
17453
17753
|
// ../../harness-adapter/dist/question.js
|
|
@@ -17455,7 +17755,7 @@ function invalidRequest2(message) {
|
|
|
17455
17755
|
return { code: "invalidRequest", message, retryable: false };
|
|
17456
17756
|
}
|
|
17457
17757
|
function validateHostQuestionResponse(interaction, response) {
|
|
17458
|
-
const questionIds = new Set(interaction.questions.map(({ id }) =>
|
|
17758
|
+
const questionIds = new Set(interaction.questions.map(({ id: id2 }) => id2));
|
|
17459
17759
|
if (response.cancelled) {
|
|
17460
17760
|
return Object.keys(response.answers).length === 0 ? null : invalidRequest2("Cancelled Question Response must not contain answers");
|
|
17461
17761
|
}
|
|
@@ -17587,7 +17887,8 @@ var tokenFields = [
|
|
|
17587
17887
|
var safeIntegerFields = [
|
|
17588
17888
|
"planFiveHourResetsAtUnix",
|
|
17589
17889
|
"planSevenDayResetsAtUnix",
|
|
17590
|
-
"timeToFirstOutputMs"
|
|
17890
|
+
"timeToFirstOutputMs",
|
|
17891
|
+
"latestRequestTimeToFirstOutputMs"
|
|
17591
17892
|
];
|
|
17592
17893
|
var percentFields = [
|
|
17593
17894
|
"cacheHitRatePercent",
|
|
@@ -17798,9 +18099,9 @@ function subagentConfiguration(value) {
|
|
|
17798
18099
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
17799
18100
|
return {};
|
|
17800
18101
|
const row = value;
|
|
17801
|
-
const
|
|
17802
|
-
const model2 = row.model === "inherit" ? void 0 :
|
|
17803
|
-
const reasoningEffort =
|
|
18102
|
+
const text2 = (value2) => typeof value2 === "string" && value2.trim() ? value2 : void 0;
|
|
18103
|
+
const model2 = row.model === "inherit" ? void 0 : text2(row.model);
|
|
18104
|
+
const reasoningEffort = text2(row.reasoningEffort) ?? text2(row.reasoning_effort) ?? text2(row.thinking);
|
|
17804
18105
|
return { ...model2 ? { model: model2 } : {}, ...reasoningEffort ? { reasoningEffort } : {} };
|
|
17805
18106
|
}
|
|
17806
18107
|
function inheritSubagentConfiguration(child, parent) {
|
|
@@ -17873,7 +18174,7 @@ var CURSOR_COMMAND_CATALOG = cursorCommands([
|
|
|
17873
18174
|
{ name: "copy-request-id", description: "Copy the current request ID", input: null }
|
|
17874
18175
|
]);
|
|
17875
18176
|
function cursorCommandPrompt(command, catalog) {
|
|
17876
|
-
const descriptor = catalog.commands.find(({ id }) =>
|
|
18177
|
+
const descriptor = catalog.commands.find(({ id: id2 }) => id2 === command.commandId);
|
|
17877
18178
|
if (!descriptor)
|
|
17878
18179
|
return {
|
|
17879
18180
|
ok: false,
|
|
@@ -17893,8 +18194,8 @@ function cursorCommandPrompt(command, catalog) {
|
|
|
17893
18194
|
retryable: false
|
|
17894
18195
|
}
|
|
17895
18196
|
};
|
|
17896
|
-
const
|
|
17897
|
-
return { ok: true, value: `${descriptor.invocation}${
|
|
18197
|
+
const text2 = typeof args?.text === "string" ? args.text.trim() : "";
|
|
18198
|
+
return { ok: true, value: `${descriptor.invocation}${text2 ? ` ${text2}` : ""}` };
|
|
17898
18199
|
}
|
|
17899
18200
|
|
|
17900
18201
|
// dist/command.js
|
|
@@ -17918,14 +18219,14 @@ function cursorDiscoverySpec(skipPinnedVersions) {
|
|
|
17918
18219
|
var CursorNotInstalledError = class extends Error {
|
|
17919
18220
|
};
|
|
17920
18221
|
function resolveCursorExecutable(environment, command) {
|
|
17921
|
-
const
|
|
17922
|
-
const pinned = resolveHarnessExecutable(cursorDiscoverySpec(false),
|
|
18222
|
+
const input2 = { environment, ...command ? { command } : {} };
|
|
18223
|
+
const pinned = resolveHarnessExecutable(cursorDiscoverySpec(false), input2);
|
|
17923
18224
|
if (!pinned)
|
|
17924
18225
|
throw new CursorNotInstalledError("Cursor CLI is not installed; install cursor-agent or set CODEXHOST_CURSOR_COMMAND");
|
|
17925
18226
|
const explicit = command?.trim() || environment.CODEXHOST_CURSOR_COMMAND?.trim();
|
|
17926
18227
|
if (explicit || !PINNED_VERSION_AGENT.test(pinned.executable))
|
|
17927
18228
|
return pinned;
|
|
17928
|
-
return resolveHarnessExecutable(cursorDiscoverySpec(true),
|
|
18229
|
+
return resolveHarnessExecutable(cursorDiscoverySpec(true), input2) ?? pinned;
|
|
17929
18230
|
}
|
|
17930
18231
|
function cursorInvocation(environment, command, args) {
|
|
17931
18232
|
const resolution = resolveCursorExecutable(environment, command);
|
|
@@ -18031,17 +18332,17 @@ async function accessToken(environment) {
|
|
|
18031
18332
|
const auth = record3(JSON.parse(await readFile(authPath, "utf8")));
|
|
18032
18333
|
return typeof auth.accessToken === "string" && auth.accessToken.trim() ? auth.accessToken : void 0;
|
|
18033
18334
|
}
|
|
18034
|
-
async function fetchCursorAccount(
|
|
18335
|
+
async function fetchCursorAccount(input2 = {}) {
|
|
18035
18336
|
try {
|
|
18036
|
-
const environment =
|
|
18337
|
+
const environment = input2.environment ?? process.env;
|
|
18037
18338
|
if (environment.CURSOR_API_KEY?.trim() || environment.AGENT_CLI_CREDENTIAL_STORE === "memory")
|
|
18038
18339
|
return null;
|
|
18039
|
-
const token = await (
|
|
18340
|
+
const token = await (input2.readAccessToken ? input2.readAccessToken() : accessToken(environment));
|
|
18040
18341
|
if (!token)
|
|
18041
18342
|
return null;
|
|
18042
|
-
const signal =
|
|
18343
|
+
const signal = input2.signal ? AbortSignal.any([input2.signal, AbortSignal.timeout(1e4)]) : AbortSignal.timeout(1e4);
|
|
18043
18344
|
const request = async (method) => {
|
|
18044
|
-
const response = await (
|
|
18345
|
+
const response = await (input2.fetch ?? fetch)(ENDPOINT + method, {
|
|
18045
18346
|
method: "POST",
|
|
18046
18347
|
headers: {
|
|
18047
18348
|
Authorization: `Bearer ${token}`,
|
|
@@ -18094,15 +18395,15 @@ function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_
|
|
|
18094
18395
|
return normalized;
|
|
18095
18396
|
return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
|
|
18096
18397
|
}
|
|
18097
|
-
function sessionImportCandidate(
|
|
18098
|
-
const time3 = typeof
|
|
18398
|
+
function sessionImportCandidate(input2) {
|
|
18399
|
+
const time3 = typeof input2.updatedAt === "number" ? input2.updatedAt : typeof input2.updatedAt === "string" ? Date.parse(input2.updatedAt) : Number.NaN;
|
|
18099
18400
|
const parsed = harnessSessionImportCandidateSchema.safeParse({
|
|
18100
|
-
nativeSessionId:
|
|
18101
|
-
cwd:
|
|
18102
|
-
title: typeof
|
|
18401
|
+
nativeSessionId: input2.nativeSessionId,
|
|
18402
|
+
cwd: input2.cwd,
|
|
18403
|
+
title: typeof input2.title === "string" && input2.title.trim().length > 0 ? input2.title : null,
|
|
18103
18404
|
updatedAt: Math.floor(time3),
|
|
18104
18405
|
// Unknown must stay unknown; only an explicit boolean is a native statement.
|
|
18105
|
-
running: typeof
|
|
18406
|
+
running: typeof input2.running === "boolean" ? input2.running : null
|
|
18106
18407
|
});
|
|
18107
18408
|
return parsed.success ? parsed.data : null;
|
|
18108
18409
|
}
|
|
@@ -18251,10 +18552,10 @@ function readCursorNativeHistory(sessionId, cwd, environment, allowMissing = fal
|
|
|
18251
18552
|
const metadata = JSON.parse(Buffer.from(row.value, "hex").toString("utf8"));
|
|
18252
18553
|
if (metadata.agentId !== sessionId || typeof metadata.latestRootBlobId !== "string")
|
|
18253
18554
|
throw new Error("Cursor native session identity mismatch");
|
|
18254
|
-
const get = (
|
|
18255
|
-
if (!/^[0-9a-f]{64}$/u.test(
|
|
18555
|
+
const get = (id2) => {
|
|
18556
|
+
if (!/^[0-9a-f]{64}$/u.test(id2))
|
|
18256
18557
|
throw new Error("Invalid Cursor native blob reference");
|
|
18257
|
-
const blob = db.prepare("SELECT data FROM blobs WHERE id = ?").get(
|
|
18558
|
+
const blob = db.prepare("SELECT data FROM blobs WHERE id = ?").get(id2)?.data;
|
|
18258
18559
|
if (!(blob instanceof Uint8Array))
|
|
18259
18560
|
throw new Error("Cursor native history blob is missing");
|
|
18260
18561
|
return protobufBytes(blob);
|
|
@@ -18268,13 +18569,13 @@ function readCursorNativeHistory(sessionId, cwd, environment, allowMissing = fal
|
|
|
18268
18569
|
for (const record4 of container.get(1) ?? []) {
|
|
18269
18570
|
const turn = protobufBytes(record4);
|
|
18270
18571
|
const user = get(one(turn, 1).toString("hex"));
|
|
18271
|
-
const
|
|
18272
|
-
if (!/^[0-9a-f-]{36}$/iu.test(
|
|
18572
|
+
const id2 = one(user, 2).toString("utf8");
|
|
18573
|
+
if (!/^[0-9a-f-]{36}$/iu.test(id2) || result.some((existing) => existing.id === id2))
|
|
18273
18574
|
throw new Error("Cursor native turn ID is invalid or duplicated");
|
|
18274
18575
|
const anchor = user.get(10)?.[0];
|
|
18275
18576
|
const rewindRoot = anchor?.length === 32 && db.prepare("SELECT 1 FROM blobs WHERE id = ?").get(anchor.toString("hex")) ? anchor.toString("hex") : void 0;
|
|
18276
18577
|
result.push({
|
|
18277
|
-
id,
|
|
18578
|
+
id: id2,
|
|
18278
18579
|
text: one(user, 1).toString("utf8"),
|
|
18279
18580
|
...rewindRoot ? { rewindRoot } : {},
|
|
18280
18581
|
...user.get(15)?.length ? { notification: true } : {}
|
|
@@ -18385,12 +18686,12 @@ var CursorSessionImport = class {
|
|
|
18385
18686
|
} : null;
|
|
18386
18687
|
});
|
|
18387
18688
|
}
|
|
18388
|
-
async #candidate(
|
|
18689
|
+
async #candidate(id2, signal) {
|
|
18389
18690
|
signal.throwIfAborted();
|
|
18390
18691
|
const root = path7.join(cursorConfigDirectory(this.#environment), "acp-sessions");
|
|
18391
18692
|
if (!(await optionalStat(root))?.isDirectory())
|
|
18392
18693
|
return null;
|
|
18393
|
-
const directory = cursorSessionDirectory(
|
|
18694
|
+
const directory = cursorSessionDirectory(id2, this.#environment);
|
|
18394
18695
|
const files = [
|
|
18395
18696
|
directory,
|
|
18396
18697
|
path7.join(directory, "meta.json"),
|
|
@@ -18411,7 +18712,7 @@ var CursorSessionImport = class {
|
|
|
18411
18712
|
if (!(await stat(cwd)).isDirectory())
|
|
18412
18713
|
return null;
|
|
18413
18714
|
signal.throwIfAborted();
|
|
18414
|
-
const turns = readCursorNativeTurns(
|
|
18715
|
+
const turns = readCursorNativeTurns(id2, cwd, this.#environment);
|
|
18415
18716
|
if (!turns.length)
|
|
18416
18717
|
return null;
|
|
18417
18718
|
title = sessionImportTitle(turns[0]?.text);
|
|
@@ -18426,7 +18727,7 @@ var CursorSessionImport = class {
|
|
|
18426
18727
|
if (before.some((info, index) => !sameFileFingerprint(info, after[index] ?? null)))
|
|
18427
18728
|
throw new SessionImportChangedError("Cursor Session changed during discovery");
|
|
18428
18729
|
return sessionImportCandidate({
|
|
18429
|
-
nativeSessionId:
|
|
18730
|
+
nativeSessionId: id2,
|
|
18430
18731
|
cwd,
|
|
18431
18732
|
title,
|
|
18432
18733
|
updatedAt: Math.max(database.mtimeMs, wal?.mtimeMs ?? 0)
|
|
@@ -18464,16 +18765,16 @@ function cursorThinking(options) {
|
|
|
18464
18765
|
return [];
|
|
18465
18766
|
return combinations.flatMap(({ values, labels }) => {
|
|
18466
18767
|
const encoded = Buffer.from(JSON.stringify(values)).toString("base64url");
|
|
18467
|
-
const
|
|
18468
|
-
return
|
|
18768
|
+
const id2 = harnessThinkingOptionIdSchema.safeParse(`cursor.${encoded}`);
|
|
18769
|
+
return id2.success ? [{ id: id2.data, label: labels.join(" / "), values }] : [];
|
|
18469
18770
|
});
|
|
18470
18771
|
}
|
|
18471
18772
|
function cursorThinkingState(info) {
|
|
18472
18773
|
const options = cursorThinking(info.configOptions);
|
|
18473
|
-
const current = options.find((entry) => entry.values.every(([
|
|
18774
|
+
const current = options.find((entry) => entry.values.every(([id2, value]) => info.configOptions?.some((option) => option.id === id2 && option.currentValue === value)));
|
|
18474
18775
|
return {
|
|
18475
|
-
availableThinkingOptions: options.map(({ id, label }) => ({
|
|
18476
|
-
id,
|
|
18776
|
+
availableThinkingOptions: options.map(({ id: id2, label }) => ({
|
|
18777
|
+
id: id2,
|
|
18477
18778
|
label
|
|
18478
18779
|
})),
|
|
18479
18780
|
...current ? { effectiveThinkingOptionId: current.id } : {}
|
|
@@ -18547,6 +18848,12 @@ function cursorModels(info) {
|
|
|
18547
18848
|
const models = option.options.flatMap((entry) => "value" in entry ? [entry] : entry.options);
|
|
18548
18849
|
return { models, current: option.currentValue };
|
|
18549
18850
|
}
|
|
18851
|
+
function isCursorFastOption(option) {
|
|
18852
|
+
if (option.id !== "fast" || option.category !== "model_config" || option.type !== "select")
|
|
18853
|
+
return false;
|
|
18854
|
+
const values = option.options.flatMap((entry) => "value" in entry ? [entry.value] : entry.options.map(({ value }) => value));
|
|
18855
|
+
return values.includes("true") && values.includes("false");
|
|
18856
|
+
}
|
|
18550
18857
|
function cursorCatalog(info) {
|
|
18551
18858
|
const native = cursorModels(info);
|
|
18552
18859
|
const thinking = /* @__PURE__ */ new Map();
|
|
@@ -18554,16 +18861,16 @@ function cursorCatalog(info) {
|
|
|
18554
18861
|
const live = model2.value === native.current;
|
|
18555
18862
|
const config2 = live ? info.configOptions : info.nativeModels?.find((entry) => entry.value === model2.value)?.configOptions;
|
|
18556
18863
|
const options = cursorThinking(config2);
|
|
18557
|
-
for (const { id, label } of options)
|
|
18558
|
-
thinking.set(
|
|
18864
|
+
for (const { id: id2, label } of options)
|
|
18865
|
+
thinking.set(id2, { id: id2, label });
|
|
18866
|
+
const fast = config2?.find(isCursorFastOption);
|
|
18867
|
+
const pinned = live ? config2 : fast ? [fast] : void 0;
|
|
18868
|
+
const withFast = (value) => cursorConfiguredModelRef(model2.value, pinned?.map((option) => option === fast ? { ...option, currentValue: value } : option));
|
|
18559
18869
|
return {
|
|
18560
|
-
|
|
18561
|
-
|
|
18562
|
-
// `fast=true`), so pinning them would override the user's remembered per-model parameters.
|
|
18563
|
-
// A bare Ref selects only the model and lets Cursor apply those parameters itself.
|
|
18564
|
-
ref: live ? cursorConfiguredModelRef(model2.value, config2) : cursorModelRef(model2.value),
|
|
18870
|
+
ref: fast ? withFast("false") : live ? cursorConfiguredModelRef(model2.value, config2) : cursorModelRef(model2.value),
|
|
18871
|
+
...fast ? { fastModel: withFast("true") } : {},
|
|
18565
18872
|
label: model2.name,
|
|
18566
|
-
supportedThinkingOptionIds: options.map(({ id }) =>
|
|
18873
|
+
supportedThinkingOptionIds: options.map(({ id: id2 }) => id2)
|
|
18567
18874
|
};
|
|
18568
18875
|
});
|
|
18569
18876
|
if (!models.length)
|
|
@@ -18576,10 +18883,10 @@ function cursorCatalog(info) {
|
|
|
18576
18883
|
...current ? { defaultThinkingOptionId: current } : {}
|
|
18577
18884
|
};
|
|
18578
18885
|
}
|
|
18579
|
-
function parseCursorNativeModels(
|
|
18580
|
-
if (!Array.isArray(
|
|
18886
|
+
function parseCursorNativeModels(input2) {
|
|
18887
|
+
if (!Array.isArray(input2.models))
|
|
18581
18888
|
throw new Error("Cursor returned no parameterized model catalog");
|
|
18582
|
-
return
|
|
18889
|
+
return input2.models.map((model2) => {
|
|
18583
18890
|
if (typeof model2 !== "object" || model2 === null || !("value" in model2) || !("name" in model2) || !("configOptions" in model2) || typeof model2.value !== "string" || typeof model2.name !== "string" || !Array.isArray(model2.configOptions))
|
|
18584
18891
|
throw new Error("Invalid Cursor model metadata");
|
|
18585
18892
|
return {
|
|
@@ -18621,13 +18928,13 @@ function cursorModelSelection(info, ref) {
|
|
|
18621
18928
|
const parameters = [];
|
|
18622
18929
|
for (const parameter of match[2] ? match[2].split(",") : []) {
|
|
18623
18930
|
const pair = parameter.split("=");
|
|
18624
|
-
const [
|
|
18625
|
-
if (pair.length !== 2 || !
|
|
18931
|
+
const [id2, value] = pair;
|
|
18932
|
+
if (pair.length !== 2 || !id2 || value === void 0 || parameters.some(([key]) => key === id2))
|
|
18626
18933
|
throw new Error("Invalid Cursor model parameters");
|
|
18627
|
-
const option = model2.configOptions.find((option2) => option2.id ===
|
|
18934
|
+
const option = model2.configOptions.find((option2) => option2.id === id2);
|
|
18628
18935
|
if (!option || option.type !== "select" || !option.options.flatMap((entry) => "value" in entry ? [entry] : entry.options).some((entry) => entry.value === value))
|
|
18629
18936
|
throw new Error("Legacy Cursor model parameter is not selectable in the native catalog");
|
|
18630
|
-
parameters.push([
|
|
18937
|
+
parameters.push([id2, value]);
|
|
18631
18938
|
}
|
|
18632
18939
|
return [["model", model2.value], ...parameters];
|
|
18633
18940
|
}
|
|
@@ -20501,8 +20808,8 @@ var RequestResponder = class {
|
|
|
20501
20808
|
signal;
|
|
20502
20809
|
finishRequest;
|
|
20503
20810
|
didRespond = false;
|
|
20504
|
-
constructor(
|
|
20505
|
-
this.id =
|
|
20811
|
+
constructor(id2, sendResult, signal = new AbortController().signal, finishRequest) {
|
|
20812
|
+
this.id = id2;
|
|
20506
20813
|
this.sendResult = sendResult;
|
|
20507
20814
|
this.signal = signal;
|
|
20508
20815
|
this.finishRequest = finishRequest;
|
|
@@ -20793,7 +21100,7 @@ var Connection = class {
|
|
|
20793
21100
|
return this.sendWireMessage({ jsonrpc: "2.0", method, params });
|
|
20794
21101
|
}
|
|
20795
21102
|
prepareRequest(method, params, mapResponse, options = {}) {
|
|
20796
|
-
const
|
|
21103
|
+
const id2 = this.nextRequestId++;
|
|
20797
21104
|
let cancel = () => {
|
|
20798
21105
|
};
|
|
20799
21106
|
const response = new Promise((resolve, reject) => {
|
|
@@ -20813,7 +21120,7 @@ var Connection = class {
|
|
|
20813
21120
|
}
|
|
20814
21121
|
pendingResponse.cancellationSent = true;
|
|
20815
21122
|
pendingResponse.cleanup?.();
|
|
20816
|
-
void this.sendCancelRequest(
|
|
21123
|
+
void this.sendCancelRequest(id2).catch(() => {
|
|
20817
21124
|
});
|
|
20818
21125
|
};
|
|
20819
21126
|
options.cancellationSignal?.addEventListener("abort", cancel, {
|
|
@@ -20822,12 +21129,12 @@ var Connection = class {
|
|
|
20822
21129
|
pendingResponse.cleanup = () => {
|
|
20823
21130
|
options.cancellationSignal?.removeEventListener("abort", cancel);
|
|
20824
21131
|
};
|
|
20825
|
-
this.pendingResponses.set(
|
|
21132
|
+
this.pendingResponses.set(id2, pendingResponse);
|
|
20826
21133
|
});
|
|
20827
21134
|
response.catch(() => {
|
|
20828
21135
|
});
|
|
20829
21136
|
return {
|
|
20830
|
-
message: { jsonrpc: "2.0", id, method, params },
|
|
21137
|
+
message: { jsonrpc: "2.0", id: id2, method, params },
|
|
20831
21138
|
response,
|
|
20832
21139
|
cancel: () => cancel()
|
|
20833
21140
|
};
|
|
@@ -21335,7 +21642,7 @@ var LineBuffer = class {
|
|
|
21335
21642
|
};
|
|
21336
21643
|
|
|
21337
21644
|
// ../../../node_modules/@agentclientprotocol/sdk/dist/stream.js
|
|
21338
|
-
function ndJsonStream(output,
|
|
21645
|
+
function ndJsonStream(output, input2) {
|
|
21339
21646
|
const textEncoder = new TextEncoder();
|
|
21340
21647
|
const textDecoder = new TextDecoder();
|
|
21341
21648
|
let cancelled = false;
|
|
@@ -21358,7 +21665,7 @@ function ndJsonStream(output, input) {
|
|
|
21358
21665
|
}
|
|
21359
21666
|
}
|
|
21360
21667
|
};
|
|
21361
|
-
const reader =
|
|
21668
|
+
const reader = input2.getReader();
|
|
21362
21669
|
inputReader = reader;
|
|
21363
21670
|
try {
|
|
21364
21671
|
while (true) {
|
|
@@ -21441,8 +21748,8 @@ var zGuardCreateElicitationResponseCancel = object({
|
|
|
21441
21748
|
});
|
|
21442
21749
|
|
|
21443
21750
|
// ../../../node_modules/@agentclientprotocol/sdk/dist/acp.js
|
|
21444
|
-
function ndJsonStream2(output,
|
|
21445
|
-
return ndJsonStream(output,
|
|
21751
|
+
function ndJsonStream2(output, input2) {
|
|
21752
|
+
return ndJsonStream(output, input2);
|
|
21446
21753
|
}
|
|
21447
21754
|
function emptyObjectResponse(response) {
|
|
21448
21755
|
return response ?? {};
|
|
@@ -21464,7 +21771,7 @@ function memoryStreamPair() {
|
|
|
21464
21771
|
}
|
|
21465
21772
|
];
|
|
21466
21773
|
}
|
|
21467
|
-
var
|
|
21774
|
+
var methods2 = {
|
|
21468
21775
|
agent: {
|
|
21469
21776
|
initialize: AGENT_METHODS.initialize,
|
|
21470
21777
|
authenticate: AGENT_METHODS.authenticate,
|
|
@@ -22956,13 +23263,13 @@ var CursorTransport = class {
|
|
|
22956
23263
|
throw new Error("Cursor session is not open");
|
|
22957
23264
|
return this.#bounded(this.#connection.setSessionConfigOption({ sessionId: this.sessionId, configId, value }));
|
|
22958
23265
|
}
|
|
22959
|
-
async prompt(
|
|
23266
|
+
async prompt(text2, callbacks) {
|
|
22960
23267
|
if (!this.#connection || this.#closed || this.#callbacks)
|
|
22961
23268
|
throw new Error("Cursor session is closed or busy");
|
|
22962
23269
|
this.#callbacks = callbacks;
|
|
22963
23270
|
try {
|
|
22964
23271
|
return await Promise.race([
|
|
22965
|
-
this.#connection.prompt({ sessionId: this.sessionId, prompt: [{ type: "text", text }] }),
|
|
23272
|
+
this.#connection.prompt({ sessionId: this.sessionId, prompt: [{ type: "text", text: text2 }] }),
|
|
22966
23273
|
this.#failed
|
|
22967
23274
|
]);
|
|
22968
23275
|
} finally {
|
|
@@ -23438,9 +23745,9 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
|
|
|
23438
23745
|
} }));
|
|
23439
23746
|
}
|
|
23440
23747
|
}
|
|
23441
|
-
function splitLines(
|
|
23442
|
-
const hasTrailingNl =
|
|
23443
|
-
const result =
|
|
23748
|
+
function splitLines(text2) {
|
|
23749
|
+
const hasTrailingNl = text2.endsWith("\n");
|
|
23750
|
+
const result = text2.split("\n").map((line) => line + "\n");
|
|
23444
23751
|
if (hasTrailingNl) {
|
|
23445
23752
|
result.pop();
|
|
23446
23753
|
} else {
|
|
@@ -23453,8 +23760,8 @@ function splitLines(text) {
|
|
|
23453
23760
|
import { createHash } from "node:crypto";
|
|
23454
23761
|
var obj = (v) => typeof v === "object" && v !== null && !Array.isArray(v) ? v : {};
|
|
23455
23762
|
var str = (v) => typeof v === "string" ? v : "";
|
|
23456
|
-
function cursorTaskHandle(turnIndex, taskIndex,
|
|
23457
|
-
const args = obj(
|
|
23763
|
+
function cursorTaskHandle(turnIndex, taskIndex, input2) {
|
|
23764
|
+
const args = obj(input2);
|
|
23458
23765
|
const digest = createHash("sha256").update(JSON.stringify([str(args.description), str(args.prompt)])).digest("hex").slice(0, 24);
|
|
23459
23766
|
const handle = `task.v1.${turnIndex}.${taskIndex}.${digest}`;
|
|
23460
23767
|
cursorTaskAddress(handle);
|
|
@@ -23472,8 +23779,8 @@ function role(value) {
|
|
|
23472
23779
|
const fields = Object.keys(obj(value));
|
|
23473
23780
|
return fields.length === 1 ? fields[0] : void 0;
|
|
23474
23781
|
}
|
|
23475
|
-
function cursorDelegation(nativeId,
|
|
23476
|
-
const args = obj(
|
|
23782
|
+
function cursorDelegation(nativeId, input2) {
|
|
23783
|
+
const args = obj(input2), name = role(args.subagentType);
|
|
23477
23784
|
return {
|
|
23478
23785
|
type: "subagentDelegation",
|
|
23479
23786
|
itemId: hostItemIdSchema.parse(`cursor-${nativeId}`),
|
|
@@ -23674,26 +23981,26 @@ var LONGEST_PREFIX = Math.max(...CLOSED_PREFIXES.map((prefix) => prefix.length))
|
|
|
23674
23981
|
function isCursorWritableIterableClosed(message) {
|
|
23675
23982
|
return /WritableIterable is closed/iu.test(message);
|
|
23676
23983
|
}
|
|
23677
|
-
function takeCursorWritableIterableClosed(
|
|
23678
|
-
const match =
|
|
23679
|
-
if (!match || match.index === void 0 || match.index === 0 && !
|
|
23680
|
-
return { visible:
|
|
23681
|
-
return { visible:
|
|
23984
|
+
function takeCursorWritableIterableClosed(text2, atMessageStart = true) {
|
|
23985
|
+
const match = text2.match(CLOSED_ERROR);
|
|
23986
|
+
if (!match || match.index === void 0 || match.index === 0 && !text2.startsWith("\n\n") && !atMessageStart)
|
|
23987
|
+
return { visible: text2, closed: false };
|
|
23988
|
+
return { visible: text2.slice(0, match.index), closed: true };
|
|
23682
23989
|
}
|
|
23683
|
-
function holdCursorWritableIterablePrefix(
|
|
23684
|
-
const taken = takeCursorWritableIterableClosed(
|
|
23990
|
+
function holdCursorWritableIterablePrefix(text2, atMessageStart = true) {
|
|
23991
|
+
const taken = takeCursorWritableIterableClosed(text2, atMessageStart);
|
|
23685
23992
|
if (taken.closed)
|
|
23686
|
-
return { emit: taken.visible, hold:
|
|
23687
|
-
for (let size = Math.min(
|
|
23688
|
-
const suffix =
|
|
23689
|
-
const start =
|
|
23690
|
-
if (!suffix.startsWith("\n") && !(start === 0 && atMessageStart) &&
|
|
23993
|
+
return { emit: taken.visible, hold: text2.slice(taken.visible.length) };
|
|
23994
|
+
for (let size = Math.min(text2.length, LONGEST_PREFIX); size > 0; size -= 1) {
|
|
23995
|
+
const suffix = text2.slice(-size);
|
|
23996
|
+
const start = text2.length - size;
|
|
23997
|
+
if (!suffix.startsWith("\n") && !(start === 0 && atMessageStart) && text2.slice(Math.max(0, start - 2), start) !== "\n\n")
|
|
23691
23998
|
continue;
|
|
23692
23999
|
if (CLOSED_PREFIXES.some((candidate) => candidate.startsWith(suffix))) {
|
|
23693
|
-
return { emit:
|
|
24000
|
+
return { emit: text2.slice(0, -size), hold: suffix };
|
|
23694
24001
|
}
|
|
23695
24002
|
}
|
|
23696
|
-
return { emit:
|
|
24003
|
+
return { emit: text2, hold: "" };
|
|
23697
24004
|
}
|
|
23698
24005
|
|
|
23699
24006
|
// dist/projection.js
|
|
@@ -23752,10 +24059,10 @@ var CursorTurnOutput = class {
|
|
|
23752
24059
|
this.#hold = "";
|
|
23753
24060
|
this.#appendText("agentMessage", held);
|
|
23754
24061
|
}
|
|
23755
|
-
#appendText(type,
|
|
23756
|
-
if (!
|
|
24062
|
+
#appendText(type, text2) {
|
|
24063
|
+
if (!text2)
|
|
23757
24064
|
return;
|
|
23758
|
-
if (type === "agentMessage" &&
|
|
24065
|
+
if (type === "agentMessage" && text2.trim())
|
|
23759
24066
|
this.#visibleAssistantText = true;
|
|
23760
24067
|
if (this.#text?.type !== type) {
|
|
23761
24068
|
this.#finishText();
|
|
@@ -23769,12 +24076,12 @@ var CursorTurnOutput = class {
|
|
|
23769
24076
|
}
|
|
23770
24077
|
if (!this.#text)
|
|
23771
24078
|
return;
|
|
23772
|
-
this.#text.text +=
|
|
24079
|
+
this.#text.text += text2;
|
|
23773
24080
|
this.emit({
|
|
23774
24081
|
type: "item.updated",
|
|
23775
24082
|
turnId: this.turnId,
|
|
23776
24083
|
itemId: this.#text.itemId,
|
|
23777
|
-
update: { type: "text.append", text }
|
|
24084
|
+
update: { type: "text.append", text: text2 }
|
|
23778
24085
|
});
|
|
23779
24086
|
}
|
|
23780
24087
|
#finishText(outcome = { status: "succeeded" }) {
|
|
@@ -23824,11 +24131,11 @@ var CursorTurnOutput = class {
|
|
|
23824
24131
|
const { item } = tool;
|
|
23825
24132
|
if (update.content != null) {
|
|
23826
24133
|
tool.changes = cursorFileChanges(update.content);
|
|
23827
|
-
const
|
|
24134
|
+
const text2 = update.content.flatMap((content) => content.type === "content" && content.content.type === "text" ? [content.content.text] : content.type === "diff" ? [`${content.path}
|
|
23828
24135
|
${content.newText}`] : []).join("\n");
|
|
23829
24136
|
item.output = {
|
|
23830
|
-
content: [{ type: "text", text:
|
|
23831
|
-
truncated:
|
|
24137
|
+
content: [{ type: "text", text: text2.slice(0, TOOL_OUTPUT_LIMIT) }],
|
|
24138
|
+
truncated: text2.length > TOOL_OUTPUT_LIMIT
|
|
23832
24139
|
};
|
|
23833
24140
|
this.emit({
|
|
23834
24141
|
type: "item.updated",
|
|
@@ -24109,7 +24416,7 @@ import { backup, DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
|
24109
24416
|
// dist/fork-terminal.js
|
|
24110
24417
|
import { spawn as spawn2 } from "node:child_process";
|
|
24111
24418
|
import { setTimeout as delay } from "node:timers/promises";
|
|
24112
|
-
var quote = (
|
|
24419
|
+
var quote = (text2) => `'${text2.replaceAll("'", "'\\''")}'`;
|
|
24113
24420
|
async function runCursorForkTerminal(options, sessionId, signal, rewind) {
|
|
24114
24421
|
signal.throwIfAborted();
|
|
24115
24422
|
const invocation = cursorInvocation(options.environment, options.command, [
|
|
@@ -24162,9 +24469,9 @@ async function runCursorForkTerminal(options, sessionId, signal, rewind) {
|
|
|
24162
24469
|
await delay(50);
|
|
24163
24470
|
}
|
|
24164
24471
|
};
|
|
24165
|
-
const send = (
|
|
24472
|
+
const send = (text2) => {
|
|
24166
24473
|
tail = "";
|
|
24167
|
-
child.stdin.write(
|
|
24474
|
+
child.stdin.write(text2);
|
|
24168
24475
|
};
|
|
24169
24476
|
const submitCommand = async (name, description) => {
|
|
24170
24477
|
send(name);
|
|
@@ -24343,7 +24650,7 @@ async function forkCursorSession(source, checkpoint, options, signal, forkOption
|
|
|
24343
24650
|
}, source.nativeSessionId, signal, rewindTurn ? {
|
|
24344
24651
|
steps: sourceTurns.slice(retained).filter((turn) => turn.rewindRoot).length,
|
|
24345
24652
|
complete: () => {
|
|
24346
|
-
const targets = readdirSync2(chats).filter((
|
|
24653
|
+
const targets = readdirSync2(chats).filter((id2) => id2 !== source.nativeSessionId);
|
|
24347
24654
|
const targetId = targets[0];
|
|
24348
24655
|
return targets.length === 1 && !!targetId && storeIdentity(path8.join(chats, targetId), false).root === rewindTurn.rewindRoot;
|
|
24349
24656
|
}
|
|
@@ -24418,9 +24725,9 @@ var CursorAdapter = class {
|
|
|
24418
24725
|
const session = [...this.#sessions].find((s) => s.transport.sessionId === parent.nativeSessionId);
|
|
24419
24726
|
if (session && path9.resolve(session.transport.options.cwd) !== path9.resolve(cwd))
|
|
24420
24727
|
return rejected("invalidRequest", "Cursor parent workspace does not match");
|
|
24421
|
-
const
|
|
24422
|
-
if (
|
|
24423
|
-
return { ok: true, value:
|
|
24728
|
+
const active2 = session?.subagentSnapshot(nativeSubagentId);
|
|
24729
|
+
if (active2)
|
|
24730
|
+
return { ok: true, value: active2 };
|
|
24424
24731
|
const options = session?.transport.options ?? this.transportOptions(cwd);
|
|
24425
24732
|
const before = readCursorNativeTurns(parent.nativeSessionId, cwd, options.environment);
|
|
24426
24733
|
replay = new CursorTransport({
|
|
@@ -24447,6 +24754,7 @@ var CursorAdapter = class {
|
|
|
24447
24754
|
#sessions = /* @__PURE__ */ new Set();
|
|
24448
24755
|
#forks = /* @__PURE__ */ new Map();
|
|
24449
24756
|
#inspections = /* @__PURE__ */ new Map();
|
|
24757
|
+
#inspectionTasks = /* @__PURE__ */ new Set();
|
|
24450
24758
|
#closed = false;
|
|
24451
24759
|
sessionImport;
|
|
24452
24760
|
constructor(options = {}) {
|
|
@@ -24466,16 +24774,22 @@ var CursorAdapter = class {
|
|
|
24466
24774
|
...this.options.timeoutMs ? { timeoutMs: this.options.timeoutMs } : {}
|
|
24467
24775
|
};
|
|
24468
24776
|
}
|
|
24469
|
-
async inspect(
|
|
24777
|
+
async inspect(input2 = {}) {
|
|
24470
24778
|
if (this.#closed)
|
|
24471
24779
|
return {
|
|
24472
24780
|
status: "unavailable",
|
|
24473
24781
|
error: { code: "unavailable", message: "Cursor adapter is closed", retryable: false }
|
|
24474
24782
|
};
|
|
24475
|
-
const cwd = path9.resolve(
|
|
24783
|
+
const cwd = path9.resolve(input2.cwd ?? process.cwd());
|
|
24476
24784
|
const cached2 = this.#inspections.get(cwd);
|
|
24477
|
-
if (
|
|
24478
|
-
|
|
24785
|
+
if (input2.refresh) {
|
|
24786
|
+
this.#inspections.clear();
|
|
24787
|
+
if (cached2 && this.#inspectionTasks.has(cached2))
|
|
24788
|
+
this.#inspections.set(cwd, cached2);
|
|
24789
|
+
}
|
|
24790
|
+
const current = this.#inspections.get(cwd);
|
|
24791
|
+
if (current)
|
|
24792
|
+
return current;
|
|
24479
24793
|
const result = (async () => {
|
|
24480
24794
|
const transport = new CursorTransport(this.transportOptions(cwd));
|
|
24481
24795
|
try {
|
|
@@ -24496,19 +24810,17 @@ var CursorAdapter = class {
|
|
|
24496
24810
|
await transport.close();
|
|
24497
24811
|
}
|
|
24498
24812
|
})();
|
|
24499
|
-
|
|
24500
|
-
this.#
|
|
24501
|
-
void result.finally(() =>
|
|
24502
|
-
entry.pending = false;
|
|
24503
|
-
});
|
|
24813
|
+
this.#inspections.set(cwd, result);
|
|
24814
|
+
this.#inspectionTasks.add(result);
|
|
24815
|
+
void result.finally(() => this.#inspectionTasks.delete(result));
|
|
24504
24816
|
return result;
|
|
24505
24817
|
}
|
|
24506
|
-
async open(
|
|
24818
|
+
async open(input2) {
|
|
24507
24819
|
if (this.#closed)
|
|
24508
24820
|
return rejected("invalidState", "Cursor adapter is closed");
|
|
24509
|
-
if (
|
|
24821
|
+
if (input2.kind === "fork" || input2.kind === "rollbackLastTurn") {
|
|
24510
24822
|
const controller = new AbortController();
|
|
24511
|
-
const pending = this.#fork(
|
|
24823
|
+
const pending = this.#fork(input2, controller);
|
|
24512
24824
|
this.#forks.set(controller, pending);
|
|
24513
24825
|
try {
|
|
24514
24826
|
return await pending;
|
|
@@ -24516,54 +24828,54 @@ var CursorAdapter = class {
|
|
|
24516
24828
|
this.#forks.delete(controller);
|
|
24517
24829
|
}
|
|
24518
24830
|
}
|
|
24519
|
-
return this.#openSession(
|
|
24831
|
+
return this.#openSession(input2);
|
|
24520
24832
|
}
|
|
24521
|
-
async #openSession(
|
|
24522
|
-
if (
|
|
24833
|
+
async #openSession(input2, prepared) {
|
|
24834
|
+
if (input2.kind === "resume" && input2.nativeRef.harnessId !== this.harnessId)
|
|
24523
24835
|
return rejected("invalidRequest", "Session belongs to another Harness");
|
|
24524
24836
|
let executionPolicy;
|
|
24525
24837
|
try {
|
|
24526
|
-
executionPolicy =
|
|
24838
|
+
executionPolicy = input2.kind === "create" ? input2.executionPolicy ?? "default" : cursorExecutionPolicy(input2.nativeRef);
|
|
24527
24839
|
} catch {
|
|
24528
24840
|
return rejected("invalidRequest", "Invalid Cursor Native Session locator");
|
|
24529
24841
|
}
|
|
24530
24842
|
const options = {
|
|
24531
|
-
...this.transportOptions(
|
|
24843
|
+
...this.transportOptions(input2.cwd, input2.environment),
|
|
24532
24844
|
executionPolicy
|
|
24533
24845
|
};
|
|
24534
24846
|
const transport = prepared ?? new CursorTransport(options);
|
|
24535
24847
|
try {
|
|
24536
|
-
const before =
|
|
24537
|
-
const info = await transport.open(
|
|
24848
|
+
const before = input2.kind === "resume" ? readCursorNativeHistory(input2.nativeRef.nativeSessionId, options.cwd, options.environment) : void 0;
|
|
24849
|
+
const info = await transport.open(input2.kind === "resume" ? input2.nativeRef.nativeSessionId : void 0);
|
|
24538
24850
|
let loadedSnapshot;
|
|
24539
|
-
if (
|
|
24851
|
+
if (input2.kind === "resume") {
|
|
24540
24852
|
const native = readCursorNativeHistory(transport.sessionId, options.cwd, options.environment);
|
|
24541
24853
|
const snapshot = cursorSnapshot(transport.sessionId, native.turns, transport.replay);
|
|
24542
|
-
if (
|
|
24854
|
+
if (input2.knownTurnRefs?.some((ref) => ref.harnessId !== this.harnessId || ref.nativeSessionId !== transport.sessionId || !native.turns.some((turn) => turn.id === ref.nativeTurnKey)))
|
|
24543
24855
|
throw new Error("Saved Cursor turn identity no longer exists in native history");
|
|
24544
24856
|
if (native.revision && before?.revision === native.revision)
|
|
24545
24857
|
loadedSnapshot = { revision: native.revision, snapshot };
|
|
24546
24858
|
}
|
|
24547
24859
|
const session = new CursorSession(transport, info, () => {
|
|
24548
24860
|
this.#sessions.delete(session);
|
|
24549
|
-
},
|
|
24550
|
-
if (
|
|
24551
|
-
const selected = await session.execute({ type: "model.select", model:
|
|
24861
|
+
}, input2.kind === "create", loadedSnapshot);
|
|
24862
|
+
if (input2.model) {
|
|
24863
|
+
const selected = await session.execute({ type: "model.select", model: input2.model });
|
|
24552
24864
|
if (!selected.ok)
|
|
24553
24865
|
throw new Error(selected.error.message);
|
|
24554
24866
|
}
|
|
24555
|
-
if (
|
|
24867
|
+
if (input2.thinkingOptionId) {
|
|
24556
24868
|
const selected = await session.execute({
|
|
24557
24869
|
type: "thinking.select",
|
|
24558
|
-
thinkingOptionId:
|
|
24870
|
+
thinkingOptionId: input2.thinkingOptionId
|
|
24559
24871
|
});
|
|
24560
24872
|
if (!selected.ok)
|
|
24561
24873
|
throw new Error(selected.error.message);
|
|
24562
24874
|
}
|
|
24563
|
-
if (
|
|
24875
|
+
if (input2.permissionModeId) {
|
|
24564
24876
|
const selected = await session.execute({
|
|
24565
24877
|
type: "permissionMode.select",
|
|
24566
|
-
permissionModeId:
|
|
24878
|
+
permissionModeId: input2.permissionModeId
|
|
24567
24879
|
});
|
|
24568
24880
|
if (!selected.ok)
|
|
24569
24881
|
throw new Error(selected.error.message);
|
|
@@ -24579,24 +24891,24 @@ var CursorAdapter = class {
|
|
|
24579
24891
|
return { ok: false, error: cursorError(error51) };
|
|
24580
24892
|
}
|
|
24581
24893
|
}
|
|
24582
|
-
async #fork(
|
|
24894
|
+
async #fork(input2, controller) {
|
|
24583
24895
|
const signal = controller.signal;
|
|
24584
24896
|
if (!cursorForkAvailable())
|
|
24585
24897
|
return rejected("unsupported", "Cursor Fork requires macOS/Linux with /usr/bin/script");
|
|
24586
24898
|
let executionPolicy;
|
|
24587
24899
|
try {
|
|
24588
|
-
if (
|
|
24589
|
-
validateCursorFork(
|
|
24590
|
-
else if (
|
|
24900
|
+
if (input2.kind === "fork")
|
|
24901
|
+
validateCursorFork(input2.sourceRef, input2.checkpoint);
|
|
24902
|
+
else if (input2.sourceRef.harnessId !== this.harnessId || input2.sourceRef.formatVersion !== 1)
|
|
24591
24903
|
return rejected("invalidRequest", "Invalid Cursor rollback source");
|
|
24592
|
-
executionPolicy = cursorExecutionPolicy(
|
|
24904
|
+
executionPolicy = cursorExecutionPolicy(input2.sourceRef);
|
|
24593
24905
|
} catch {
|
|
24594
24906
|
return rejected("invalidRequest", "Invalid Cursor fork checkpoint");
|
|
24595
24907
|
}
|
|
24596
|
-
const source = [...this.#sessions].find((session2) => session2.transport.sessionId ===
|
|
24597
|
-
if (source && !cursorSameWorkspace(source.transport.options.cwd,
|
|
24908
|
+
const source = [...this.#sessions].find((session2) => session2.transport.sessionId === input2.sourceRef.nativeSessionId);
|
|
24909
|
+
if (source && !cursorSameWorkspace(source.transport.options.cwd, input2.cwd))
|
|
24598
24910
|
return rejected("unsupported", "Cursor Fork does not support changing workspace");
|
|
24599
|
-
const sourceRunning =
|
|
24911
|
+
const sourceRunning = input2.kind === "fork" && source?.turnRunningForFork() === true;
|
|
24600
24912
|
const release = sourceRunning ? void 0 : source?.lockForFork();
|
|
24601
24913
|
if (source && !release && !sourceRunning)
|
|
24602
24914
|
return rejected("sessionBusy", "Cursor source session is busy");
|
|
@@ -24610,11 +24922,11 @@ var CursorAdapter = class {
|
|
|
24610
24922
|
try {
|
|
24611
24923
|
const options = source ? {
|
|
24612
24924
|
...source.transport.options,
|
|
24613
|
-
environment: { ...source.transport.options.environment, ...
|
|
24614
|
-
} : this.transportOptions(
|
|
24615
|
-
const native = readCursorNativeTurns(
|
|
24616
|
-
const retained =
|
|
24617
|
-
if (!native.length ||
|
|
24925
|
+
environment: { ...source.transport.options.environment, ...input2.environment }
|
|
24926
|
+
} : this.transportOptions(input2.cwd, input2.environment);
|
|
24927
|
+
const native = readCursorNativeTurns(input2.sourceRef.nativeSessionId, input2.cwd, options.environment);
|
|
24928
|
+
const retained = input2.kind === "fork" ? native.findIndex((turn) => turn.id === input2.checkpoint.checkpointId) + 1 : native.length - 1;
|
|
24929
|
+
if (!native.length || input2.kind === "fork" && retained === 0)
|
|
24618
24930
|
return rejected("checkpointNotFound", "Cursor derivation boundary no longer exists");
|
|
24619
24931
|
if (native[retained] && !native[retained]?.rewindRoot)
|
|
24620
24932
|
return rejected("unsupported", "Cursor target has no native rewind checkpoint");
|
|
@@ -24629,7 +24941,7 @@ var CursorAdapter = class {
|
|
|
24629
24941
|
throw error51;
|
|
24630
24942
|
};
|
|
24631
24943
|
const [staged, ready] = await Promise.allSettled([
|
|
24632
|
-
forkCursorSession(
|
|
24944
|
+
forkCursorSession(input2.sourceRef, input2.kind === "fork" ? input2.checkpoint : void 0, options, signal, { sourceRunning }).catch(abort),
|
|
24633
24945
|
transport.prepare().catch(abort)
|
|
24634
24946
|
]);
|
|
24635
24947
|
if (staged.status === "fulfilled")
|
|
@@ -24641,12 +24953,12 @@ var CursorAdapter = class {
|
|
|
24641
24953
|
throw staged.reason;
|
|
24642
24954
|
if (!derived)
|
|
24643
24955
|
throw new Error("Cursor native fork did not return a target");
|
|
24644
|
-
const model2 =
|
|
24645
|
-
const thinking =
|
|
24646
|
-
const mode =
|
|
24956
|
+
const model2 = input2.kind === "rollbackLastTurn" ? input2.model ?? source?.initialState.effectiveModel : source?.initialState.effectiveModel;
|
|
24957
|
+
const thinking = input2.kind === "rollbackLastTurn" ? input2.thinkingOptionId ?? source?.initialState.effectiveThinkingOptionId : source?.initialState.effectiveThinkingOptionId;
|
|
24958
|
+
const mode = input2.kind === "rollbackLastTurn" ? input2.permissionModeId ?? source?.initialState.effectivePermissionModeId : source?.initialState.effectivePermissionModeId;
|
|
24647
24959
|
const opened = await this.#openSession({
|
|
24648
24960
|
kind: "resume",
|
|
24649
|
-
cwd:
|
|
24961
|
+
cwd: input2.cwd,
|
|
24650
24962
|
environment: options.environment,
|
|
24651
24963
|
nativeRef: cursorNativeSessionRef(derived.sessionId, executionPolicy),
|
|
24652
24964
|
...model2 ? { model: model2 } : {},
|
|
@@ -24656,9 +24968,9 @@ var CursorAdapter = class {
|
|
|
24656
24968
|
if (!opened.ok)
|
|
24657
24969
|
throw new Error(opened.error.message);
|
|
24658
24970
|
session = opened.value;
|
|
24659
|
-
if (JSON.stringify(readCursorNativeTurns(derived.sessionId,
|
|
24971
|
+
if (JSON.stringify(readCursorNativeTurns(derived.sessionId, input2.cwd, options.environment)) !== JSON.stringify(derived.expected))
|
|
24660
24972
|
throw new Error("Cursor derived history changed during ACP adoption");
|
|
24661
|
-
const sourceTurns = readCursorNativeTurns(
|
|
24973
|
+
const sourceTurns = readCursorNativeTurns(input2.sourceRef.nativeSessionId, input2.cwd, options.environment);
|
|
24662
24974
|
if (sourceRunning ? !cursorTurnsStartWith(sourceTurns, derived.expected) : JSON.stringify(sourceTurns) !== JSON.stringify(derived.sourceTurns))
|
|
24663
24975
|
throw new Error("Cursor source changed before fork adoption");
|
|
24664
24976
|
derived.commit();
|
|
@@ -24680,7 +24992,7 @@ var CursorAdapter = class {
|
|
|
24680
24992
|
controller.abort();
|
|
24681
24993
|
await Promise.allSettled([importing, ...this.#forks.values()]);
|
|
24682
24994
|
await Promise.allSettled([...this.#sessions].map((session) => session.close()));
|
|
24683
|
-
await Promise.allSettled(
|
|
24995
|
+
await Promise.allSettled(this.#inspectionTasks);
|
|
24684
24996
|
}
|
|
24685
24997
|
};
|
|
24686
24998
|
var CursorSession = class {
|
|
@@ -24691,6 +25003,10 @@ var CursorSession = class {
|
|
|
24691
25003
|
get capabilities() {
|
|
24692
25004
|
return cursorCapabilities(this.info);
|
|
24693
25005
|
}
|
|
25006
|
+
/** The live Session catalog, including parameters the inspection Session does not pin. */
|
|
25007
|
+
modelCatalog() {
|
|
25008
|
+
return cursorCatalog(this.info);
|
|
25009
|
+
}
|
|
24694
25010
|
initialUsage = null;
|
|
24695
25011
|
commands = {
|
|
24696
25012
|
list: async () => this.#closed ? rejected("invalidState", "Cursor session is closed") : { ok: true, value: cursorCommands(this.transport.availableCommands) },
|
|
@@ -24826,8 +25142,8 @@ var CursorSession = class {
|
|
|
24826
25142
|
if (command.type === "turn.cancel") {
|
|
24827
25143
|
if (!this.#active || this.#active.command.turnId !== command.turnId)
|
|
24828
25144
|
return rejected("invalidState", "Cursor turn is not active");
|
|
24829
|
-
const
|
|
24830
|
-
|
|
25145
|
+
const active2 = this.#active;
|
|
25146
|
+
active2.cancelled = true;
|
|
24831
25147
|
this.#interactions.cancel();
|
|
24832
25148
|
try {
|
|
24833
25149
|
await this.transport.cancel();
|
|
@@ -24835,10 +25151,10 @@ var CursorSession = class {
|
|
|
24835
25151
|
await this.transport.close();
|
|
24836
25152
|
}
|
|
24837
25153
|
const timer = setTimeout(() => {
|
|
24838
|
-
if (this.#active ===
|
|
25154
|
+
if (this.#active === active2)
|
|
24839
25155
|
void this.transport.close();
|
|
24840
25156
|
}, 5e3);
|
|
24841
|
-
void
|
|
25157
|
+
void active2.task.finally(() => clearTimeout(timer));
|
|
24842
25158
|
return { ok: true, value: { cancellationRequested: true } };
|
|
24843
25159
|
}
|
|
24844
25160
|
if (this.#configuring || this.#active && command.type !== "model.select" && command.type !== "thinking.select")
|
|
@@ -24856,16 +25172,16 @@ var CursorSession = class {
|
|
|
24856
25172
|
}
|
|
24857
25173
|
this.#submitted.add(command.turnId);
|
|
24858
25174
|
this.#snapshot = void 0;
|
|
24859
|
-
const
|
|
24860
|
-
this.#active =
|
|
24861
|
-
|
|
25175
|
+
const active2 = { command, cancelled: false, task: Promise.resolve() };
|
|
25176
|
+
this.#active = active2;
|
|
25177
|
+
active2.task = this.#run(command, before);
|
|
24862
25178
|
return { ok: true, value: { turnId: command.turnId } };
|
|
24863
25179
|
}
|
|
24864
25180
|
this.#configuring = true;
|
|
24865
25181
|
try {
|
|
24866
25182
|
let selections;
|
|
24867
25183
|
if (command.type === "thinking.select") {
|
|
24868
|
-
const option = cursorThinking(this.info.configOptions).find(({ id }) =>
|
|
25184
|
+
const option = cursorThinking(this.info.configOptions).find(({ id: id2 }) => id2 === command.thinkingOptionId);
|
|
24869
25185
|
if (!option)
|
|
24870
25186
|
return rejected("unsupported", "Thinking option is not available for this Cursor model");
|
|
24871
25187
|
selections = option.values;
|
|
@@ -24876,6 +25192,14 @@ var CursorSession = class {
|
|
|
24876
25192
|
return rejected("invalidRequest", "Unknown Cursor execution mode");
|
|
24877
25193
|
selections = [["mode", command.permissionModeId]];
|
|
24878
25194
|
}
|
|
25195
|
+
let published = false;
|
|
25196
|
+
const publish = () => {
|
|
25197
|
+
published = true;
|
|
25198
|
+
this.#channel.emit({
|
|
25199
|
+
kind: "event",
|
|
25200
|
+
event: { type: "session.state.changed", state: structuredClone(this.initialState) }
|
|
25201
|
+
});
|
|
25202
|
+
};
|
|
24879
25203
|
for (const [configId, value] of selections) {
|
|
24880
25204
|
if (this.info.configOptions?.some((option) => option.id === configId && option.currentValue === value))
|
|
24881
25205
|
continue;
|
|
@@ -24891,11 +25215,10 @@ var CursorSession = class {
|
|
|
24891
25215
|
this.initialState.effectivePermissionModeId = harnessPermissionModeIdSchema.parse(mode.currentValue);
|
|
24892
25216
|
delete this.initialState.effectiveThinkingOptionId;
|
|
24893
25217
|
Object.assign(this.initialState, cursorThinkingState(this.info));
|
|
24894
|
-
|
|
24895
|
-
kind: "event",
|
|
24896
|
-
event: { type: "session.state.changed", state: structuredClone(this.initialState) }
|
|
24897
|
-
});
|
|
25218
|
+
publish();
|
|
24898
25219
|
}
|
|
25220
|
+
if (!published)
|
|
25221
|
+
publish();
|
|
24899
25222
|
return { ok: true, value: { completed: true } };
|
|
24900
25223
|
} catch (error51) {
|
|
24901
25224
|
return { ok: false, error: cursorError(error51) };
|
|
@@ -25005,13 +25328,13 @@ var CursorSession = class {
|
|
|
25005
25328
|
if (this.#closed)
|
|
25006
25329
|
return;
|
|
25007
25330
|
this.#closed = true;
|
|
25008
|
-
const
|
|
25009
|
-
if (
|
|
25010
|
-
|
|
25331
|
+
const active2 = this.#active;
|
|
25332
|
+
if (active2)
|
|
25333
|
+
active2.cancelled = true;
|
|
25011
25334
|
this.#interactions.cancel();
|
|
25012
25335
|
try {
|
|
25013
25336
|
await this.transport.close();
|
|
25014
|
-
await
|
|
25337
|
+
await active2?.task;
|
|
25015
25338
|
} finally {
|
|
25016
25339
|
this.#channel.end();
|
|
25017
25340
|
this.onClose();
|
|
@@ -25036,6 +25359,7 @@ var HARNESS_BROKER_IDLE_TIMEOUT_MS = 60 * 60 * 1e3;
|
|
|
25036
25359
|
var HARNESS_BROKER_RETIRING_ERROR_CODE = "brokerRetiring";
|
|
25037
25360
|
var harnessBrokerMethodSchema = external_exports.enum([
|
|
25038
25361
|
"adapter.inspect",
|
|
25362
|
+
"adapter.normalizeStoredModelRef",
|
|
25039
25363
|
"adapter.inspectAccount",
|
|
25040
25364
|
"adapter.credits",
|
|
25041
25365
|
"adapter.open",
|
|
@@ -25150,13 +25474,13 @@ function consumeBrokerFrames(socket, onFrame, onError, maxBytes = HARNESS_BROKER
|
|
|
25150
25474
|
bufferedBytes = required2;
|
|
25151
25475
|
if (newline2 < 0)
|
|
25152
25476
|
return;
|
|
25153
|
-
const
|
|
25477
|
+
const text2 = buffered.toString("utf8", 0, bufferedBytes);
|
|
25154
25478
|
bufferedBytes = 0;
|
|
25155
25479
|
if (buffered.length > 64 * 1024)
|
|
25156
25480
|
buffered = Buffer.alloc(0);
|
|
25157
|
-
if (
|
|
25481
|
+
if (text2.length > 0) {
|
|
25158
25482
|
try {
|
|
25159
|
-
const value = JSON.parse(
|
|
25483
|
+
const value = JSON.parse(text2);
|
|
25160
25484
|
onFrame(value);
|
|
25161
25485
|
} catch (error51) {
|
|
25162
25486
|
fail(error51 instanceof SyntaxError ? new Error("Harness broker received invalid JSON") : error51 instanceof Error ? error51 : new Error(String(error51)));
|
|
@@ -25223,6 +25547,10 @@ var brokerInspectInputSchema = external_exports.object({
|
|
|
25223
25547
|
refresh: external_exports.boolean().optional(),
|
|
25224
25548
|
purpose: external_exports.literal("availability").optional()
|
|
25225
25549
|
}).strict();
|
|
25550
|
+
var brokerNormalizeStoredModelRefSchema = external_exports.strictObject({
|
|
25551
|
+
ref: harnessModelRefSchema,
|
|
25552
|
+
catalog: harnessModelCatalogSchema
|
|
25553
|
+
});
|
|
25226
25554
|
var brokerSessionImportListParamsSchema = external_exports.object({
|
|
25227
25555
|
offset: external_exports.number().int().nonnegative().safe(),
|
|
25228
25556
|
limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
|
|
@@ -25351,11 +25679,13 @@ var eventKeys = /* @__PURE__ */ new Map([
|
|
|
25351
25679
|
["session.state.changed", /* @__PURE__ */ new Set(["type", "state"])],
|
|
25352
25680
|
["session.usage.changed", /* @__PURE__ */ new Set(["type", "usage", "observedForTurnId"])],
|
|
25353
25681
|
["usage.request", /* @__PURE__ */ new Set(["type", "request"])],
|
|
25682
|
+
["usage.request.timing", /* @__PURE__ */ new Set(["type", "turnId", "timing"])],
|
|
25354
25683
|
["usage.history", /* @__PURE__ */ new Set(["type", "complete"])],
|
|
25355
25684
|
["subagent.state.changed", /* @__PURE__ */ new Set(["type", "nativeSubagentId", "status", "resultSummary"])],
|
|
25356
25685
|
["subagent.transcript.changed", /* @__PURE__ */ new Set(["type", "nativeSubagentId"])],
|
|
25357
25686
|
["turn.started", /* @__PURE__ */ new Set(["type", "turnId"])],
|
|
25358
25687
|
["turn.autonomous.started", /* @__PURE__ */ new Set(["type", "turnId", "input"])],
|
|
25688
|
+
["turn.autonomous.completed", /* @__PURE__ */ new Set(["type", "snapshot"])],
|
|
25359
25689
|
["item.started", /* @__PURE__ */ new Set(["type", "turnId", "item"])],
|
|
25360
25690
|
["item.updated", /* @__PURE__ */ new Set(["type", "turnId", "itemId", "update"])],
|
|
25361
25691
|
["item.completed", /* @__PURE__ */ new Set(["type", "turnId", "snapshot"])],
|
|
@@ -25387,6 +25717,118 @@ var interactionKeys = /* @__PURE__ */ new Map([
|
|
|
25387
25717
|
function strictKeys(value, allowed) {
|
|
25388
25718
|
return Boolean(allowed && value && typeof value === "object" && !Array.isArray(value) && Object.keys(value).every((key) => allowed.has(key)));
|
|
25389
25719
|
}
|
|
25720
|
+
var nonNegativeSafeIntegerSchema2 = external_exports.int().nonnegative();
|
|
25721
|
+
var toolOutputSchema = external_exports.strictObject({
|
|
25722
|
+
content: external_exports.array(external_exports.discriminatedUnion("type", [
|
|
25723
|
+
textInputSchema,
|
|
25724
|
+
external_exports.strictObject({ type: external_exports.literal("image"), mimeType: external_exports.string(), base64Data: external_exports.string() })
|
|
25725
|
+
])),
|
|
25726
|
+
truncated: external_exports.boolean().optional()
|
|
25727
|
+
});
|
|
25728
|
+
var fileChangeSchema = external_exports.strictObject({
|
|
25729
|
+
path: external_exports.string(),
|
|
25730
|
+
kind: external_exports.enum(["add", "update", "delete"]),
|
|
25731
|
+
unifiedDiff: external_exports.string(),
|
|
25732
|
+
diffScope: external_exports.literal("fragment").optional()
|
|
25733
|
+
});
|
|
25734
|
+
var subagentStateSchema = external_exports.strictObject({
|
|
25735
|
+
subagentId: external_exports.string().min(1),
|
|
25736
|
+
nativeSubagentId: external_exports.string().min(1).optional(),
|
|
25737
|
+
description: external_exports.string(),
|
|
25738
|
+
role: external_exports.string().optional(),
|
|
25739
|
+
model: external_exports.string().optional(),
|
|
25740
|
+
reasoningEffort: external_exports.string().optional(),
|
|
25741
|
+
background: external_exports.boolean(),
|
|
25742
|
+
status: external_exports.enum(["pending", "running", "completed", "failed", "interrupted"]),
|
|
25743
|
+
resultSummary: external_exports.string().optional()
|
|
25744
|
+
});
|
|
25745
|
+
var itemBase = { itemId: hostItemIdSchema };
|
|
25746
|
+
var toolFields = {
|
|
25747
|
+
...itemBase,
|
|
25748
|
+
toolName: external_exports.string(),
|
|
25749
|
+
arguments: jsonValueSchema,
|
|
25750
|
+
output: toolOutputSchema.optional(),
|
|
25751
|
+
durationMs: external_exports.number().nonnegative().optional()
|
|
25752
|
+
};
|
|
25753
|
+
var snapshotItemSchema = external_exports.discriminatedUnion("type", [
|
|
25754
|
+
external_exports.strictObject({
|
|
25755
|
+
...itemBase,
|
|
25756
|
+
type: external_exports.literal("agentMessage"),
|
|
25757
|
+
text: external_exports.string(),
|
|
25758
|
+
phase: external_exports.enum(["commentary", "final_answer"]).optional()
|
|
25759
|
+
}),
|
|
25760
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("userMessage"), input: external_exports.array(textInputSchema) }),
|
|
25761
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("reasoning"), text: external_exports.string() }),
|
|
25762
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("contextCompaction") }),
|
|
25763
|
+
external_exports.strictObject({
|
|
25764
|
+
...itemBase,
|
|
25765
|
+
type: external_exports.literal("commandExecution"),
|
|
25766
|
+
command: external_exports.string(),
|
|
25767
|
+
cwd: cwdSchema.optional(),
|
|
25768
|
+
output: external_exports.string().optional(),
|
|
25769
|
+
outputTruncated: external_exports.boolean().optional(),
|
|
25770
|
+
exitCode: external_exports.int().nullable().optional(),
|
|
25771
|
+
durationMs: external_exports.number().nonnegative().optional()
|
|
25772
|
+
}),
|
|
25773
|
+
external_exports.strictObject({
|
|
25774
|
+
...toolFields,
|
|
25775
|
+
type: external_exports.literal("toolExecution"),
|
|
25776
|
+
namespace: external_exports.string().optional()
|
|
25777
|
+
}),
|
|
25778
|
+
external_exports.strictObject({ ...toolFields, type: external_exports.literal("mcpToolCall"), server: external_exports.string() }),
|
|
25779
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("webSearch"), query: external_exports.string() }),
|
|
25780
|
+
external_exports.strictObject({
|
|
25781
|
+
...itemBase,
|
|
25782
|
+
type: external_exports.literal("fileChange"),
|
|
25783
|
+
changes: external_exports.array(fileChangeSchema),
|
|
25784
|
+
sourceItemIds: external_exports.array(hostItemIdSchema).optional()
|
|
25785
|
+
}),
|
|
25786
|
+
external_exports.strictObject({
|
|
25787
|
+
...itemBase,
|
|
25788
|
+
type: external_exports.literal("subagentDelegation"),
|
|
25789
|
+
operation: external_exports.enum(["spawn", "send"]),
|
|
25790
|
+
prompt: external_exports.string().optional(),
|
|
25791
|
+
subagents: external_exports.array(subagentStateSchema)
|
|
25792
|
+
})
|
|
25793
|
+
]);
|
|
25794
|
+
var terminalOutcomes = [
|
|
25795
|
+
external_exports.strictObject({ status: external_exports.literal("succeeded") }),
|
|
25796
|
+
external_exports.strictObject({ status: external_exports.literal("failed"), error: harnessErrorSchema }),
|
|
25797
|
+
external_exports.strictObject({ status: external_exports.literal("cancelled"), reason: external_exports.string().optional() })
|
|
25798
|
+
];
|
|
25799
|
+
var autonomousSnapshotSchema = external_exports.strictObject({
|
|
25800
|
+
nativeTurnRef: nativeTurnRefSchema,
|
|
25801
|
+
checkpoint: nativeCheckpointRefSchema.optional(),
|
|
25802
|
+
input: external_exports.array(textInputSchema),
|
|
25803
|
+
items: external_exports.array(external_exports.strictObject({
|
|
25804
|
+
item: snapshotItemSchema,
|
|
25805
|
+
outcome: external_exports.discriminatedUnion("status", terminalOutcomes)
|
|
25806
|
+
})),
|
|
25807
|
+
outcome: external_exports.discriminatedUnion("status", [
|
|
25808
|
+
...terminalOutcomes,
|
|
25809
|
+
external_exports.strictObject({ status: external_exports.literal("unknown"), reason: external_exports.string() })
|
|
25810
|
+
]),
|
|
25811
|
+
model: harnessModelRefSchema.optional(),
|
|
25812
|
+
startedAtMs: nonNegativeSafeIntegerSchema2.optional(),
|
|
25813
|
+
completedAtMs: nonNegativeSafeIntegerSchema2.optional()
|
|
25814
|
+
}).refine(({ checkpoint, nativeTurnRef }) => !checkpoint || checkpoint.harnessId === nativeTurnRef.harnessId && checkpoint.nativeSessionId === nativeTurnRef.nativeSessionId, { path: ["checkpoint"], message: "Checkpoint must belong to the native Turn's Session" }).refine(({ startedAtMs, completedAtMs }) => startedAtMs === void 0 || completedAtMs === void 0 || completedAtMs >= startedAtMs, { path: ["completedAtMs"], message: "Turn cannot complete before it starts" }).refine(({ items }) => new Set(items.map(({ item }) => item.itemId)).size === items.length, {
|
|
25815
|
+
path: ["items"],
|
|
25816
|
+
message: "Item IDs must be unique within the Turn"
|
|
25817
|
+
});
|
|
25818
|
+
var usageOutputIntervalSchema = external_exports.strictObject({
|
|
25819
|
+
startedAtMs: nonNegativeSafeIntegerSchema2,
|
|
25820
|
+
completedAtMs: nonNegativeSafeIntegerSchema2,
|
|
25821
|
+
outputTokens: nonNegativeSafeIntegerSchema2
|
|
25822
|
+
}).refine(({ startedAtMs, completedAtMs }) => completedAtMs > startedAtMs);
|
|
25823
|
+
var usageRequestTimingSchema = external_exports.union([
|
|
25824
|
+
external_exports.strictObject({
|
|
25825
|
+
requestId: external_exports.string().min(1),
|
|
25826
|
+
requestStartedAtMs: nonNegativeSafeIntegerSchema2,
|
|
25827
|
+
timeToFirstOutputMs: nonNegativeSafeIntegerSchema2,
|
|
25828
|
+
output: usageOutputIntervalSchema.optional()
|
|
25829
|
+
}),
|
|
25830
|
+
external_exports.strictObject({ requestId: external_exports.string().min(1), output: usageOutputIntervalSchema })
|
|
25831
|
+
]);
|
|
25390
25832
|
var harnessOutputSchema = external_exports.custom((value) => {
|
|
25391
25833
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
25392
25834
|
return false;
|
|
@@ -25405,10 +25847,14 @@ var harnessOutputSchema = external_exports.custom((value) => {
|
|
|
25405
25847
|
itemId: hostItemIdSchema,
|
|
25406
25848
|
text: external_exports.string()
|
|
25407
25849
|
}).strict().safeParse(event.item).success;
|
|
25850
|
+
if (event.type === "turn.autonomous.completed")
|
|
25851
|
+
return autonomousSnapshotSchema.safeParse(event.snapshot).success;
|
|
25408
25852
|
if (event.type === "session.faulted")
|
|
25409
25853
|
return harnessErrorSchema.safeParse(event.error).success;
|
|
25410
25854
|
if (event.type === "usage.history")
|
|
25411
25855
|
return typeof event.complete === "boolean";
|
|
25856
|
+
if (event.type === "usage.request.timing")
|
|
25857
|
+
return hostTurnIdSchema.safeParse(event.turnId).success && usageRequestTimingSchema.safeParse(event.timing).success;
|
|
25412
25858
|
return true;
|
|
25413
25859
|
}
|
|
25414
25860
|
if (output.kind === "interaction") {
|
|
@@ -25421,7 +25867,7 @@ var harnessOutputSchema = external_exports.custom((value) => {
|
|
|
25421
25867
|
});
|
|
25422
25868
|
|
|
25423
25869
|
// ../../harness-broker/dist/session-import-client.js
|
|
25424
|
-
function createBrokerSessionImportCapability(
|
|
25870
|
+
function createBrokerSessionImportCapability(input2) {
|
|
25425
25871
|
let listing = null;
|
|
25426
25872
|
const closed = () => ({
|
|
25427
25873
|
ok: false,
|
|
@@ -25441,13 +25887,13 @@ function createBrokerSessionImportCapability(input) {
|
|
|
25441
25887
|
const identities = /* @__PURE__ */ new Set();
|
|
25442
25888
|
let total;
|
|
25443
25889
|
for (; ; ) {
|
|
25444
|
-
if (
|
|
25890
|
+
if (input2.isClosed())
|
|
25445
25891
|
return closed();
|
|
25446
|
-
const result = await
|
|
25892
|
+
const result = await input2.request("adapter.sessionImport.list", {
|
|
25447
25893
|
offset: candidates.length,
|
|
25448
25894
|
limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
|
|
25449
25895
|
});
|
|
25450
|
-
if (
|
|
25896
|
+
if (input2.isClosed())
|
|
25451
25897
|
return closed();
|
|
25452
25898
|
if (!result.ok)
|
|
25453
25899
|
return result;
|
|
@@ -25465,12 +25911,12 @@ function createBrokerSessionImportCapability(input) {
|
|
|
25465
25911
|
return { ok: true, value: candidates };
|
|
25466
25912
|
}
|
|
25467
25913
|
} catch (error51) {
|
|
25468
|
-
return { ok: false, error:
|
|
25914
|
+
return { ok: false, error: input2.error(error51) };
|
|
25469
25915
|
}
|
|
25470
25916
|
};
|
|
25471
25917
|
return {
|
|
25472
25918
|
listCandidates() {
|
|
25473
|
-
if (
|
|
25919
|
+
if (input2.isClosed())
|
|
25474
25920
|
return Promise.resolve(closed());
|
|
25475
25921
|
listing ??= list().finally(() => {
|
|
25476
25922
|
listing = null;
|
|
@@ -25478,20 +25924,20 @@ function createBrokerSessionImportCapability(input) {
|
|
|
25478
25924
|
return listing;
|
|
25479
25925
|
},
|
|
25480
25926
|
async resolveCandidate(nativeSessionId) {
|
|
25481
|
-
if (
|
|
25927
|
+
if (input2.isClosed())
|
|
25482
25928
|
return closed();
|
|
25483
25929
|
try {
|
|
25484
|
-
const result = await
|
|
25485
|
-
if (
|
|
25930
|
+
const result = await input2.request("adapter.sessionImport.resolve", { nativeSessionId });
|
|
25931
|
+
if (input2.isClosed())
|
|
25486
25932
|
return closed();
|
|
25487
25933
|
if (!result.ok)
|
|
25488
25934
|
return result;
|
|
25489
25935
|
const source = brokerSessionImportSourceSchema.safeParse(result.value);
|
|
25490
|
-
if (!source.success || source.data.nativeRef.harnessId !==
|
|
25936
|
+
if (!source.success || source.data.nativeRef.harnessId !== input2.harnessId || source.data.candidate.nativeSessionId !== nativeSessionId)
|
|
25491
25937
|
return invalid();
|
|
25492
25938
|
return { ok: true, value: source.data };
|
|
25493
25939
|
} catch (error51) {
|
|
25494
|
-
return { ok: false, error:
|
|
25940
|
+
return { ok: false, error: input2.error(error51) };
|
|
25495
25941
|
}
|
|
25496
25942
|
}
|
|
25497
25943
|
};
|
|
@@ -25727,12 +26173,12 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
25727
26173
|
}
|
|
25728
26174
|
#waitForHello() {
|
|
25729
26175
|
return new Promise((resolve, reject) => {
|
|
25730
|
-
const
|
|
26176
|
+
const id2 = "__hello__";
|
|
25731
26177
|
const timeout = setTimeout(() => {
|
|
25732
|
-
this.#pending.delete(
|
|
26178
|
+
this.#pending.delete(id2);
|
|
25733
26179
|
reject(new Error("Aqua Harness broker authentication timed out"));
|
|
25734
26180
|
}, HARNESS_BROKER_REQUEST_TIMEOUT_MS);
|
|
25735
|
-
this.#pending.set(
|
|
26181
|
+
this.#pending.set(id2, { resolve: () => resolve(), reject, timeout });
|
|
25736
26182
|
});
|
|
25737
26183
|
}
|
|
25738
26184
|
register(session) {
|
|
@@ -25757,13 +26203,13 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
25757
26203
|
throw new Error("Aqua Harness broker request limit exceeded");
|
|
25758
26204
|
}
|
|
25759
26205
|
this.#inputSequence += 1;
|
|
25760
|
-
const
|
|
26206
|
+
const id2 = randomUUID2();
|
|
25761
26207
|
const response = new Promise((resolve, reject) => {
|
|
25762
26208
|
const timeout = setTimeout(() => {
|
|
25763
|
-
this.#pending.delete(
|
|
26209
|
+
this.#pending.delete(id2);
|
|
25764
26210
|
reject(new Error(`Aqua Harness broker ${method} timed out`));
|
|
25765
26211
|
}, HARNESS_BROKER_REQUEST_TIMEOUT_MS);
|
|
25766
|
-
this.#pending.set(
|
|
26212
|
+
this.#pending.set(id2, { resolve, reject, timeout });
|
|
25767
26213
|
});
|
|
25768
26214
|
try {
|
|
25769
26215
|
await writeBrokerFrame(this.#socket, {
|
|
@@ -25771,15 +26217,15 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
25771
26217
|
generation: this.#descriptor.generation,
|
|
25772
26218
|
sequence: this.#inputSequence,
|
|
25773
26219
|
kind: "request",
|
|
25774
|
-
id,
|
|
26220
|
+
id: id2,
|
|
25775
26221
|
method,
|
|
25776
26222
|
params
|
|
25777
26223
|
});
|
|
25778
26224
|
} catch (error51) {
|
|
25779
|
-
const pending = this.#pending.get(
|
|
26225
|
+
const pending = this.#pending.get(id2);
|
|
25780
26226
|
if (pending)
|
|
25781
26227
|
clearTimeout(pending.timeout);
|
|
25782
|
-
this.#pending.delete(
|
|
26228
|
+
this.#pending.delete(id2);
|
|
25783
26229
|
response.catch(() => void 0);
|
|
25784
26230
|
throw new BrokerRequestNotDeliveredError(error51 instanceof Error ? error51.message : String(error51));
|
|
25785
26231
|
}
|
|
@@ -26071,17 +26517,17 @@ var BrokeredHarnessAdapter = class {
|
|
|
26071
26517
|
#credits = null;
|
|
26072
26518
|
#creditsRefresh = null;
|
|
26073
26519
|
subagents = {
|
|
26074
|
-
readSnapshot: async (
|
|
26520
|
+
readSnapshot: async (input2) => {
|
|
26075
26521
|
try {
|
|
26076
|
-
return parseHarnessResult(await this.#request("adapter.subagent.readSnapshot",
|
|
26522
|
+
return parseHarnessResult(await this.#request("adapter.subagent.readSnapshot", input2));
|
|
26077
26523
|
} catch (error51) {
|
|
26078
26524
|
return { ok: false, error: this.#error(error51) };
|
|
26079
26525
|
}
|
|
26080
26526
|
}
|
|
26081
26527
|
};
|
|
26082
|
-
constructor(
|
|
26083
|
-
this.harnessId = harnessPluginIdSchema.parse(
|
|
26084
|
-
if (
|
|
26528
|
+
constructor(input2 = {}) {
|
|
26529
|
+
this.harnessId = harnessPluginIdSchema.parse(input2.harnessId ?? "claude-code");
|
|
26530
|
+
if (input2.sessionImport) {
|
|
26085
26531
|
this.sessionImport = createBrokerSessionImportCapability({
|
|
26086
26532
|
harnessId: this.harnessId,
|
|
26087
26533
|
request: async (method, params) => parseHarnessResult(await this.#request(method, params, method === "adapter.sessionImport.resolve")),
|
|
@@ -26089,20 +26535,20 @@ var BrokeredHarnessAdapter = class {
|
|
|
26089
26535
|
error: (error51) => this.#error(error51)
|
|
26090
26536
|
});
|
|
26091
26537
|
}
|
|
26092
|
-
if (
|
|
26538
|
+
if (input2.accountCredits !== false) {
|
|
26093
26539
|
this.credits = () => this.#credits;
|
|
26094
26540
|
this.refreshCredits = () => this.#refreshAccountCredits();
|
|
26095
26541
|
}
|
|
26096
|
-
this.#forwardEnvironment =
|
|
26097
|
-
if (
|
|
26098
|
-
this.commandCatalog =
|
|
26099
|
-
if (
|
|
26542
|
+
this.#forwardEnvironment = input2.forwardDelegationEnvironment === true;
|
|
26543
|
+
if (input2.commandCatalog)
|
|
26544
|
+
this.commandCatalog = input2.commandCatalog;
|
|
26545
|
+
if (input2.liveCommandCatalog)
|
|
26100
26546
|
this.liveCommandCatalog = true;
|
|
26101
|
-
this.#descriptorPath =
|
|
26102
|
-
this.#isInstalled =
|
|
26103
|
-
const environment =
|
|
26104
|
-
this.#startBroker =
|
|
26105
|
-
this.#startTimeoutMs =
|
|
26547
|
+
this.#descriptorPath = input2.descriptorPath ?? defaultHarnessBrokerDescriptorPath(input2.environment, this.harnessId);
|
|
26548
|
+
this.#isInstalled = input2.isInstalled;
|
|
26549
|
+
const environment = input2.environment ?? process.env;
|
|
26550
|
+
this.#startBroker = input2.startBroker === false ? void 0 : input2.startBroker ?? (process.platform === "darwin" && !input2.descriptorPath ? () => startBrokerLaunchAgent(this.harnessId, environment) : void 0);
|
|
26551
|
+
this.#startTimeoutMs = input2.startTimeoutMs ?? BROKER_START_TIMEOUT_MS;
|
|
26106
26552
|
}
|
|
26107
26553
|
#refreshAccountCredits() {
|
|
26108
26554
|
if (this.#closed)
|
|
@@ -26134,11 +26580,11 @@ var BrokeredHarnessAdapter = class {
|
|
|
26134
26580
|
return null;
|
|
26135
26581
|
}
|
|
26136
26582
|
}
|
|
26137
|
-
async inspect(
|
|
26583
|
+
async inspect(input2 = {}) {
|
|
26138
26584
|
if (this.#closed)
|
|
26139
26585
|
return failedInspection("Aqua Harness broker adapter is closed");
|
|
26140
26586
|
try {
|
|
26141
|
-
return harnessInspectionSchema.parse(await this.#request("adapter.inspect",
|
|
26587
|
+
return harnessInspectionSchema.parse(await this.#request("adapter.inspect", input2, true));
|
|
26142
26588
|
} catch (error51) {
|
|
26143
26589
|
this.#connection = null;
|
|
26144
26590
|
if (error51 instanceof HarnessNotInstalledError)
|
|
@@ -26146,12 +26592,16 @@ var BrokeredHarnessAdapter = class {
|
|
|
26146
26592
|
return failedInspection(describeBrokerFailure(error51, this.harnessId));
|
|
26147
26593
|
}
|
|
26148
26594
|
}
|
|
26149
|
-
async
|
|
26595
|
+
async normalizeStoredModelRef(ref, catalog) {
|
|
26596
|
+
const result = await this.#request("adapter.normalizeStoredModelRef", { ref, catalog }, true);
|
|
26597
|
+
return harnessModelRefSchema.nullable().parse(result) ?? void 0;
|
|
26598
|
+
}
|
|
26599
|
+
async open(input2) {
|
|
26150
26600
|
if (this.#closed)
|
|
26151
26601
|
return { ok: false, error: unavailable("Aqua Harness broker adapter is closed", false) };
|
|
26152
|
-
const safeInput = { ...
|
|
26602
|
+
const safeInput = { ...input2 };
|
|
26153
26603
|
delete safeInput.environment;
|
|
26154
|
-
if (this.#forwardEnvironment &&
|
|
26604
|
+
if (this.#forwardEnvironment && input2.environment) {
|
|
26155
26605
|
const allowed = [
|
|
26156
26606
|
"CODEXHOST_CLI_PATH",
|
|
26157
26607
|
"CODEXHOST_CLI_NODE_PATH",
|
|
@@ -26159,7 +26609,7 @@ var BrokeredHarnessAdapter = class {
|
|
|
26159
26609
|
"CODEXHOST_RUNTIME_TOKEN",
|
|
26160
26610
|
"CODEXHOST_THREAD_ID"
|
|
26161
26611
|
];
|
|
26162
|
-
const environment = Object.fromEntries(Object.entries(
|
|
26612
|
+
const environment = Object.fromEntries(Object.entries(input2.environment).filter(([key, value]) => allowed.includes(key) && value !== void 0));
|
|
26163
26613
|
if (Object.keys(environment).length)
|
|
26164
26614
|
safeInput.environment = environment;
|
|
26165
26615
|
}
|