@codexhost/cli-linux-arm64 0.23.0 → 0.24.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 +1565 -1805
- package/app/console-web.js +5786 -1600
- package/app/desktop-controller.mjs +13104 -2842
- package/app/host-runtime.mjs +50518 -51753
- package/app/plugins/antigravity/plugin.mjs +1932 -1148
- package/app/plugins/claude-code/plugin.mjs +1676 -1218
- package/app/plugins/codebuddy/plugin.mjs +1266 -850
- package/app/plugins/codex-usage/plugin.mjs +916 -737
- package/app/plugins/copilot/plugin.mjs +838 -640
- package/app/plugins/cursor-cli/plugin.mjs +1058 -747
- package/app/plugins/deepseek-harness/plugin.mjs +1302 -1070
- package/app/plugins/devin/plugin.mjs +949 -752
- package/app/plugins/grok/plugin.mjs +1132 -964
- package/app/plugins/hermes/plugin.mjs +1084 -905
- package/app/plugins/kimi-code/plugin.mjs +977 -804
- package/app/plugins/kiro-cli/plugin.mjs +951 -758
- package/app/plugins/omp/plugin.mjs +1408 -1169
- package/app/plugins/opencode/plugin.mjs +1385 -1142
- package/app/plugins/pi/plugin.mjs +1515 -1287
- package/app/plugins/qoder/plugin.mjs +861 -676
- package/app/plugins/qoder-cn/plugin.mjs +861 -676
- package/app/plugins/qwen-code/plugin.mjs +1060 -888
- package/app/plugins/workbuddy/plugin.mjs +1272 -856
- package/app/plugins/zcode/plugin.mjs +1529 -880
- package/app/renderer-extension.js +11568 -7827
- package/app/web/assets/index-CTCFIQbU.css +1 -0
- package/app/web/assets/index-IvFk9KT-.js +203 -0
- package/app/web/codexhost-settings.js +4472 -36194
- package/app/web/index.html +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-approval/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 +19 -16
- 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-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 +7 -7
- package/app/web/sw.js +8 -1
- package/app/web-modules/server.mjs +2682 -5540
- 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
|
}
|
|
@@ -1740,8 +1740,8 @@ function cleanEnum(obj) {
|
|
|
1740
1740
|
return Number.isNaN(Number.parseInt(k, 10));
|
|
1741
1741
|
}).map((el) => el[1]);
|
|
1742
1742
|
}
|
|
1743
|
-
function base64ToUint8Array(
|
|
1744
|
-
const binaryString = atob(
|
|
1743
|
+
function base64ToUint8Array(base644) {
|
|
1744
|
+
const binaryString = atob(base644);
|
|
1745
1745
|
const bytes = new Uint8Array(binaryString.length);
|
|
1746
1746
|
for (let i = 0; i < binaryString.length; i++) {
|
|
1747
1747
|
bytes[i] = binaryString.charCodeAt(i);
|
|
@@ -1756,9 +1756,9 @@ function uint8ArrayToBase64(bytes) {
|
|
|
1756
1756
|
return btoa(binaryString);
|
|
1757
1757
|
}
|
|
1758
1758
|
function base64urlToUint8Array(base64url3) {
|
|
1759
|
-
const
|
|
1760
|
-
const padding = "=".repeat((4 -
|
|
1761
|
-
return base64ToUint8Array(
|
|
1759
|
+
const base644 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
|
|
1760
|
+
const padding = "=".repeat((4 - base644.length % 4) % 4);
|
|
1761
|
+
return base64ToUint8Array(base644 + padding);
|
|
1762
1762
|
}
|
|
1763
1763
|
function uint8ArrayToBase64url(bytes) {
|
|
1764
1764
|
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
@@ -3124,8 +3124,8 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
|
3124
3124
|
function isValidBase64URL(data) {
|
|
3125
3125
|
if (!base64url.test(data))
|
|
3126
3126
|
return false;
|
|
3127
|
-
const
|
|
3128
|
-
const padded =
|
|
3127
|
+
const base644 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
3128
|
+
const padded = base644.padEnd(Math.ceil(base644.length / 4) * 4, "=");
|
|
3129
3129
|
return isValidBase64(padded);
|
|
3130
3130
|
}
|
|
3131
3131
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
@@ -3579,42 +3579,42 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3579
3579
|
}
|
|
3580
3580
|
doc.write(`const newResult = {};`);
|
|
3581
3581
|
for (const key of normalized.keys) {
|
|
3582
|
-
const
|
|
3582
|
+
const id2 = ids[key];
|
|
3583
3583
|
const k = esc(key);
|
|
3584
3584
|
const schema = shape[key];
|
|
3585
3585
|
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
3586
3586
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
3587
|
-
doc.write(`const ${
|
|
3587
|
+
doc.write(`const ${id2} = ${parseStr(key)};`);
|
|
3588
3588
|
if (isOptionalIn && isOptionalOut) {
|
|
3589
3589
|
doc.write(`
|
|
3590
|
-
if (${
|
|
3590
|
+
if (${id2}.issues.length) {
|
|
3591
3591
|
if (${k} in input) {
|
|
3592
|
-
payload.issues = payload.issues.concat(${
|
|
3592
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3593
3593
|
...iss,
|
|
3594
3594
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3595
3595
|
})));
|
|
3596
3596
|
}
|
|
3597
3597
|
}
|
|
3598
3598
|
|
|
3599
|
-
if (${
|
|
3599
|
+
if (${id2}.value === undefined) {
|
|
3600
3600
|
if (${k} in input) {
|
|
3601
3601
|
newResult[${k}] = undefined;
|
|
3602
3602
|
}
|
|
3603
3603
|
} else {
|
|
3604
|
-
newResult[${k}] = ${
|
|
3604
|
+
newResult[${k}] = ${id2}.value;
|
|
3605
3605
|
}
|
|
3606
3606
|
|
|
3607
3607
|
`);
|
|
3608
3608
|
} else if (!isOptionalIn) {
|
|
3609
3609
|
doc.write(`
|
|
3610
|
-
const ${
|
|
3611
|
-
if (${
|
|
3612
|
-
payload.issues = payload.issues.concat(${
|
|
3610
|
+
const ${id2}_present = ${k} in input;
|
|
3611
|
+
if (${id2}.issues.length) {
|
|
3612
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3613
3613
|
...iss,
|
|
3614
3614
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3615
3615
|
})));
|
|
3616
3616
|
}
|
|
3617
|
-
if (!${
|
|
3617
|
+
if (!${id2}_present && !${id2}.issues.length) {
|
|
3618
3618
|
payload.issues.push({
|
|
3619
3619
|
code: "invalid_type",
|
|
3620
3620
|
expected: "nonoptional",
|
|
@@ -3623,30 +3623,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3623
3623
|
});
|
|
3624
3624
|
}
|
|
3625
3625
|
|
|
3626
|
-
if (${
|
|
3627
|
-
if (${
|
|
3626
|
+
if (${id2}_present) {
|
|
3627
|
+
if (${id2}.value === undefined) {
|
|
3628
3628
|
newResult[${k}] = undefined;
|
|
3629
3629
|
} else {
|
|
3630
|
-
newResult[${k}] = ${
|
|
3630
|
+
newResult[${k}] = ${id2}.value;
|
|
3631
3631
|
}
|
|
3632
3632
|
}
|
|
3633
3633
|
|
|
3634
3634
|
`);
|
|
3635
3635
|
} else {
|
|
3636
3636
|
doc.write(`
|
|
3637
|
-
if (${
|
|
3638
|
-
payload.issues = payload.issues.concat(${
|
|
3637
|
+
if (${id2}.issues.length) {
|
|
3638
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3639
3639
|
...iss,
|
|
3640
3640
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3641
3641
|
})));
|
|
3642
3642
|
}
|
|
3643
3643
|
|
|
3644
|
-
if (${
|
|
3644
|
+
if (${id2}.value === undefined) {
|
|
3645
3645
|
if (${k} in input) {
|
|
3646
3646
|
newResult[${k}] = undefined;
|
|
3647
3647
|
}
|
|
3648
3648
|
} else {
|
|
3649
|
-
newResult[${k}] = ${
|
|
3649
|
+
newResult[${k}] = ${id2}.value;
|
|
3650
3650
|
}
|
|
3651
3651
|
|
|
3652
3652
|
`);
|
|
@@ -11978,26 +11978,26 @@ function extractDefs(ctx, schema) {
|
|
|
11978
11978
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
11979
11979
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
11980
11980
|
for (const entry of ctx.seen.entries()) {
|
|
11981
|
-
const
|
|
11982
|
-
if (
|
|
11983
|
-
const existing = idToSchema.get(
|
|
11981
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
11982
|
+
if (id2) {
|
|
11983
|
+
const existing = idToSchema.get(id2);
|
|
11984
11984
|
if (existing && existing !== entry[0]) {
|
|
11985
|
-
throw new Error(`Duplicate schema id "${
|
|
11985
|
+
throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
11986
11986
|
}
|
|
11987
|
-
idToSchema.set(
|
|
11987
|
+
idToSchema.set(id2, entry[0]);
|
|
11988
11988
|
}
|
|
11989
11989
|
}
|
|
11990
11990
|
const makeURI = (entry) => {
|
|
11991
11991
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
11992
11992
|
if (ctx.external) {
|
|
11993
11993
|
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
11994
|
-
const uriGenerator = ctx.external.uri ?? ((
|
|
11994
|
+
const uriGenerator = ctx.external.uri ?? ((id3) => id3);
|
|
11995
11995
|
if (externalId) {
|
|
11996
11996
|
return { ref: uriGenerator(externalId) };
|
|
11997
11997
|
}
|
|
11998
|
-
const
|
|
11999
|
-
entry[1].defId =
|
|
12000
|
-
return { defId:
|
|
11998
|
+
const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
11999
|
+
entry[1].defId = id2;
|
|
12000
|
+
return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id2}` };
|
|
12001
12001
|
}
|
|
12002
12002
|
if (entry[1] === root) {
|
|
12003
12003
|
return { ref: "#" };
|
|
@@ -12045,8 +12045,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12045
12045
|
continue;
|
|
12046
12046
|
}
|
|
12047
12047
|
}
|
|
12048
|
-
const
|
|
12049
|
-
if (
|
|
12048
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
12049
|
+
if (id2) {
|
|
12050
12050
|
extractToDef(entry);
|
|
12051
12051
|
continue;
|
|
12052
12052
|
}
|
|
@@ -12142,10 +12142,10 @@ function finalize(ctx, schema) {
|
|
|
12142
12142
|
} else {
|
|
12143
12143
|
}
|
|
12144
12144
|
if (ctx.external?.uri) {
|
|
12145
|
-
const
|
|
12146
|
-
if (!
|
|
12145
|
+
const id2 = ctx.external.registry.get(schema)?.id;
|
|
12146
|
+
if (!id2)
|
|
12147
12147
|
throw new Error("Schema is missing an `id` property");
|
|
12148
|
-
result.$id = ctx.external.uri(
|
|
12148
|
+
result.$id = ctx.external.uri(id2);
|
|
12149
12149
|
}
|
|
12150
12150
|
Object.assign(result, root.def ?? root.schema);
|
|
12151
12151
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
@@ -12305,9 +12305,9 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
12305
12305
|
json2.type = "number";
|
|
12306
12306
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
12307
12307
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
12308
|
-
const
|
|
12308
|
+
const legacy2 = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
12309
12309
|
if (exMin) {
|
|
12310
|
-
if (
|
|
12310
|
+
if (legacy2) {
|
|
12311
12311
|
json2.minimum = exclusiveMinimum;
|
|
12312
12312
|
json2.exclusiveMinimum = true;
|
|
12313
12313
|
} else {
|
|
@@ -12317,7 +12317,7 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
12317
12317
|
json2.minimum = minimum;
|
|
12318
12318
|
}
|
|
12319
12319
|
if (exMax) {
|
|
12320
|
-
if (
|
|
12320
|
+
if (legacy2) {
|
|
12321
12321
|
json2.maximum = exclusiveMaximum;
|
|
12322
12322
|
json2.exclusiveMaximum = true;
|
|
12323
12323
|
} else {
|
|
@@ -13179,7 +13179,7 @@ var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
|
13179
13179
|
|
|
13180
13180
|
// ../../../node_modules/zod/v4/classic/schemas.js
|
|
13181
13181
|
var _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
13182
|
-
function _installLazyMethods(inst, group,
|
|
13182
|
+
function _installLazyMethods(inst, group, methods3) {
|
|
13183
13183
|
const proto = Object.getPrototypeOf(inst);
|
|
13184
13184
|
let installed = _installedGroups.get(proto);
|
|
13185
13185
|
if (!installed) {
|
|
@@ -13189,8 +13189,8 @@ function _installLazyMethods(inst, group, methods2) {
|
|
|
13189
13189
|
if (installed.has(group))
|
|
13190
13190
|
return;
|
|
13191
13191
|
installed.add(group);
|
|
13192
|
-
for (const key in
|
|
13193
|
-
const fn =
|
|
13192
|
+
for (const key in methods3) {
|
|
13193
|
+
const fn = methods3[key];
|
|
13194
13194
|
Object.defineProperty(proto, key, {
|
|
13195
13195
|
configurable: true,
|
|
13196
13196
|
enumerable: false,
|
|
@@ -15001,87 +15001,6 @@ function date4(params) {
|
|
|
15001
15001
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
15002
15002
|
config(en_default());
|
|
15003
15003
|
|
|
15004
|
-
// ../../shared-contracts/dist/ids.js
|
|
15005
|
-
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15006
|
-
message: "Identifier must not be empty or whitespace"
|
|
15007
|
-
});
|
|
15008
|
-
var harnessIdSchema = opaqueIdSchema.brand();
|
|
15009
|
-
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
15010
|
-
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
15011
|
-
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
15012
|
-
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
15013
|
-
|
|
15014
|
-
// ../../shared-contracts/dist/harness-plugins.js
|
|
15015
|
-
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
15016
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
15017
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
15018
|
-
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
15019
|
-
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
15020
|
-
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
|
|
15021
|
-
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");
|
|
15022
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
15023
|
-
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
15024
|
-
var harnessInstallationGuideSchema = external_exports.object({
|
|
15025
|
-
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
15026
|
-
before: localizedTextSchema.optional(),
|
|
15027
|
-
after: localizedTextSchema.optional(),
|
|
15028
|
-
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
15029
|
-
}).strict();
|
|
15030
|
-
var pluginPresentationShape = {
|
|
15031
|
-
id: installedHarnessPluginIdSchema,
|
|
15032
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
15033
|
-
version: external_exports.string().min(1).max(128),
|
|
15034
|
-
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
15035
|
-
kind: external_exports.literal("usage").optional(),
|
|
15036
|
-
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
15037
|
-
iconStyle: external_exports.object({
|
|
15038
|
-
vector: external_exports.object({
|
|
15039
|
-
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
15040
|
-
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
15041
|
-
paths: external_exports.array(external_exports.object({
|
|
15042
|
-
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
15043
|
-
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
15044
|
-
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
15045
|
-
}).strict()).min(1).max(32)
|
|
15046
|
-
}).strict().optional(),
|
|
15047
|
-
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
15048
|
-
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
15049
|
-
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
15050
|
-
}).strict().optional(),
|
|
15051
|
-
installation: harnessInstallationGuideSchema.optional(),
|
|
15052
|
-
notice: localizedTextSchema.optional(),
|
|
15053
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
15054
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
15055
|
-
links: external_exports.object({
|
|
15056
|
-
website: documentationUrlSchema.optional(),
|
|
15057
|
-
documentation: documentationUrlSchema.optional(),
|
|
15058
|
-
installation: documentationUrlSchema.optional()
|
|
15059
|
-
}).strict().optional()
|
|
15060
|
-
};
|
|
15061
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
15062
|
-
manifestVersion: external_exports.literal(1),
|
|
15063
|
-
...pluginPresentationShape,
|
|
15064
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
15065
|
-
entry: pluginRelativeResourceSchema,
|
|
15066
|
-
icon: pluginRelativeResourceSchema.optional()
|
|
15067
|
-
}).strict();
|
|
15068
|
-
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);
|
|
15069
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
15070
|
-
...pluginPresentationShape,
|
|
15071
|
-
icon: harnessPluginIconSchema.optional()
|
|
15072
|
-
}).strict();
|
|
15073
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
15074
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
15075
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
15076
|
-
}).strict();
|
|
15077
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
15078
|
-
version: external_exports.literal(1),
|
|
15079
|
-
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
15080
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
15081
|
-
message: "Enabled plugin IDs must be unique",
|
|
15082
|
-
path: ["enabled"]
|
|
15083
|
-
});
|
|
15084
|
-
|
|
15085
15004
|
// ../../shared-contracts/dist/json-value.js
|
|
15086
15005
|
function rejectExplicitUndefined(keys) {
|
|
15087
15006
|
return (value, context) => {
|
|
@@ -15141,403 +15060,73 @@ var jsonValueSchema = nonCircularSchema.pipe(recursiveJsonValueSchema);
|
|
|
15141
15060
|
var jsonArraySchema = nonCircularSchema.pipe(external_exports.array(recursiveJsonValueSchema));
|
|
15142
15061
|
var jsonObjectSchema = nonCircularSchema.pipe(external_exports.record(external_exports.string(), recursiveJsonValueSchema));
|
|
15143
15062
|
|
|
15144
|
-
// ../../shared-contracts/dist/
|
|
15145
|
-
var
|
|
15146
|
-
|
|
15147
|
-
|
|
15148
|
-
|
|
15149
|
-
|
|
15150
|
-
|
|
15151
|
-
|
|
15152
|
-
|
|
15153
|
-
|
|
15154
|
-
|
|
15155
|
-
|
|
15156
|
-
var
|
|
15157
|
-
var
|
|
15158
|
-
var
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
|
|
15162
|
-
|
|
15163
|
-
|
|
15164
|
-
|
|
15165
|
-
var
|
|
15166
|
-
"
|
|
15167
|
-
|
|
15168
|
-
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15176
|
-
|
|
15177
|
-
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
|
|
15183
|
-
|
|
15184
|
-
|
|
15063
|
+
// ../../shared-contracts/dist/errors.js
|
|
15064
|
+
var codexhostErrorSchema = external_exports.strictObject({
|
|
15065
|
+
code: external_exports.string().min(1),
|
|
15066
|
+
message: external_exports.string().min(1),
|
|
15067
|
+
retryable: external_exports.boolean(),
|
|
15068
|
+
diagnostic: external_exports.string().min(1).optional(),
|
|
15069
|
+
stage: external_exports.string().min(1).optional(),
|
|
15070
|
+
durationMs: external_exports.number().int().nonnegative().optional(),
|
|
15071
|
+
stderrTail: external_exports.string().min(1).optional()
|
|
15072
|
+
}).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
|
|
15073
|
+
|
|
15074
|
+
// ../../shared-contracts/dist/harness-presentation.js
|
|
15075
|
+
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
15076
|
+
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
|
|
15077
|
+
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
15078
|
+
label: displayText(256).optional(),
|
|
15079
|
+
description: displayText(1024).optional()
|
|
15080
|
+
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
15081
|
+
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");
|
|
15082
|
+
|
|
15083
|
+
// ../../shared-contracts/dist/ids.js
|
|
15084
|
+
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15085
|
+
message: "Identifier must not be empty or whitespace"
|
|
15086
|
+
});
|
|
15087
|
+
var harnessIdSchema = opaqueIdSchema.brand();
|
|
15088
|
+
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
15089
|
+
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
15090
|
+
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
15091
|
+
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
15092
|
+
|
|
15093
|
+
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
15094
|
+
var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
|
|
15095
|
+
var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
|
|
15096
|
+
var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
|
|
15097
|
+
var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
|
|
15098
|
+
var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15099
|
+
message: "Value must not be empty or whitespace"
|
|
15100
|
+
});
|
|
15101
|
+
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();
|
|
15102
|
+
var harnessPermissionModeSchema = external_exports.object({
|
|
15103
|
+
id: harnessPermissionModeIdSchema,
|
|
15104
|
+
label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
|
|
15105
|
+
description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
15106
|
+
dangerous: external_exports.boolean().optional(),
|
|
15107
|
+
localizations: harnessLocalizationsSchema.optional()
|
|
15108
|
+
}).strict();
|
|
15109
|
+
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
15110
|
+
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
15111
|
+
defaultModeId: harnessPermissionModeIdSchema
|
|
15112
|
+
}).strict().superRefine((catalog, context) => {
|
|
15113
|
+
const ids = /* @__PURE__ */ new Set();
|
|
15114
|
+
for (const [index, mode] of catalog.modes.entries()) {
|
|
15115
|
+
if (ids.has(mode.id)) {
|
|
15116
|
+
context.addIssue({
|
|
15117
|
+
code: "custom",
|
|
15118
|
+
message: "Permission Mode IDs must be unique",
|
|
15119
|
+
path: ["modes", index, "id"]
|
|
15120
|
+
});
|
|
15121
|
+
}
|
|
15122
|
+
ids.add(mode.id);
|
|
15185
15123
|
}
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
return "image/svg+xml";
|
|
15193
|
-
case "woff2":
|
|
15194
|
-
return "font/woff2";
|
|
15195
|
-
case "json":
|
|
15196
|
-
return "application/json";
|
|
15197
|
-
case "css":
|
|
15198
|
-
return "text/css";
|
|
15199
|
-
default:
|
|
15200
|
-
return desktopExtensionScreenshotMimeType(resource);
|
|
15201
|
-
}
|
|
15202
|
-
}
|
|
15203
|
-
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
15204
|
-
var desktopExtensionAssetPathSchema = pluginRelativeResourceSchema.refine((resource) => hasPortableSegments(resource) && desktopExtensionAssetMimeType(resource) !== void 0, "Expected a relative Desktop extension asset path with a supported suffix");
|
|
15205
|
-
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");
|
|
15206
|
-
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) => {
|
|
15207
|
-
const { username, password } = new URL(value);
|
|
15208
|
-
return !username && !password && !/[\\\s]/u.test(value);
|
|
15209
|
-
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
15210
|
-
function localizedText(text2) {
|
|
15211
|
-
return external_exports.strictObject({ en: text2, "zh-CN": text2 });
|
|
15212
|
-
}
|
|
15213
|
-
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
15214
|
-
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
15215
|
-
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
15216
|
-
var settingField = {
|
|
15217
|
-
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
15218
|
-
label: desktopExtensionLocalizedTextSchema,
|
|
15219
|
-
description: desktopExtensionLocalizedTextSchema.optional()
|
|
15220
|
-
};
|
|
15221
|
-
var numericSetting = {
|
|
15222
|
-
...settingField,
|
|
15223
|
-
step: external_exports.number().positive().optional(),
|
|
15224
|
-
default: external_exports.number().optional()
|
|
15225
|
-
};
|
|
15226
|
-
var settingOption = external_exports.strictObject({
|
|
15227
|
-
value: external_exports.string(),
|
|
15228
|
-
label: desktopExtensionLocalizedTextSchema
|
|
15229
|
-
});
|
|
15230
|
-
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
15231
|
-
external_exports.strictObject({
|
|
15232
|
-
...settingField,
|
|
15233
|
-
type: external_exports.literal("boolean"),
|
|
15234
|
-
default: external_exports.boolean().optional()
|
|
15235
|
-
}),
|
|
15236
|
-
external_exports.strictObject({
|
|
15237
|
-
...settingField,
|
|
15238
|
-
type: external_exports.literal("string"),
|
|
15239
|
-
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
15240
|
-
default: external_exports.string().optional()
|
|
15241
|
-
}),
|
|
15242
|
-
external_exports.strictObject({
|
|
15243
|
-
...numericSetting,
|
|
15244
|
-
type: external_exports.literal("number"),
|
|
15245
|
-
min: external_exports.number().optional(),
|
|
15246
|
-
max: external_exports.number().optional()
|
|
15247
|
-
}),
|
|
15248
|
-
external_exports.strictObject({
|
|
15249
|
-
...numericSetting,
|
|
15250
|
-
type: external_exports.literal("range"),
|
|
15251
|
-
min: external_exports.number(),
|
|
15252
|
-
max: external_exports.number()
|
|
15253
|
-
}),
|
|
15254
|
-
external_exports.strictObject({
|
|
15255
|
-
...settingField,
|
|
15256
|
-
type: external_exports.literal("select"),
|
|
15257
|
-
options: external_exports.array(settingOption).min(1),
|
|
15258
|
-
default: external_exports.string().optional()
|
|
15259
|
-
})
|
|
15260
|
-
]).superRefine((field2, ctx) => {
|
|
15261
|
-
const issue2 = (path12, message) => ctx.addIssue({ code: "custom", path: [path12], message });
|
|
15262
|
-
if (field2.type === "number" || field2.type === "range") {
|
|
15263
|
-
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
15264
|
-
if (min > max)
|
|
15265
|
-
issue2("max", "Must be at least min");
|
|
15266
|
-
if (value !== void 0 && (value < min || value > max))
|
|
15267
|
-
issue2("default", "Must be within min and max");
|
|
15268
|
-
} else if (field2.type === "select") {
|
|
15269
|
-
const values = new Set(field2.options.map(({ value }) => value));
|
|
15270
|
-
if (values.size !== field2.options.length)
|
|
15271
|
-
issue2("options", "Duplicate option values");
|
|
15272
|
-
if (field2.default !== void 0 && !values.has(field2.default))
|
|
15273
|
-
issue2("default", "Must match an option value");
|
|
15274
|
-
}
|
|
15275
|
-
});
|
|
15276
|
-
var manifestHeader = external_exports.object({
|
|
15277
|
-
manifestVersion: external_exports.int().positive(),
|
|
15278
|
-
id: desktopExtensionIdSchema,
|
|
15279
|
-
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
15280
|
-
version: external_exports.string().min(1).max(128),
|
|
15281
|
-
desktopApi: external_exports.int().positive()
|
|
15282
|
-
}).passthrough();
|
|
15283
|
-
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
15284
|
-
manifestVersion: external_exports.literal(1),
|
|
15285
|
-
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
15286
|
-
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
15287
|
-
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
15288
|
-
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
15289
|
-
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
15290
|
-
icon: imagePathSchema.optional(),
|
|
15291
|
-
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
15292
|
-
desktop: external_exports.strictObject({
|
|
15293
|
-
script: pluginRelativeResourceSchema,
|
|
15294
|
-
style: pluginRelativeResourceSchema.optional()
|
|
15295
|
-
}).optional(),
|
|
15296
|
-
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
15297
|
-
slots: slotsSchema.default(() => []),
|
|
15298
|
-
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
15299
|
-
categories: categoriesSchema.optional()
|
|
15300
|
-
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
15301
|
-
var desktopExtensionConfigurationSchema = external_exports.strictObject({
|
|
15302
|
-
version: external_exports.literal(1),
|
|
15303
|
-
revision: external_exports.int().nonnegative(),
|
|
15304
|
-
enabled: external_exports.array(desktopExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs"),
|
|
15305
|
-
reloadToken: external_exports.uuid().optional()
|
|
15306
|
-
});
|
|
15307
|
-
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
15308
|
-
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
15309
|
-
state: external_exports.enum([
|
|
15310
|
-
"running",
|
|
15311
|
-
"disabled",
|
|
15312
|
-
"invalid",
|
|
15313
|
-
"incompatible",
|
|
15314
|
-
"conflict",
|
|
15315
|
-
"failed",
|
|
15316
|
-
"waiting"
|
|
15317
|
-
]),
|
|
15318
|
-
hash: desktopExtensionHashSchema.optional(),
|
|
15319
|
-
error: external_exports.string().optional(),
|
|
15320
|
-
conflictWith: desktopExtensionIdSchema.optional()
|
|
15321
|
-
});
|
|
15322
|
-
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
15323
|
-
controllerPid: external_exports.int().positive(),
|
|
15324
|
-
targetId: external_exports.string().nullable(),
|
|
15325
|
-
updatedAt: external_exports.iso.datetime(),
|
|
15326
|
-
handledReloadToken: external_exports.uuid().optional(),
|
|
15327
|
-
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema)
|
|
15328
|
-
});
|
|
15329
|
-
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
15330
|
-
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
15331
|
-
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
15332
|
-
}
|
|
15333
|
-
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
|
|
15334
|
-
const url2 = new URL(input);
|
|
15335
|
-
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);
|
|
15336
|
-
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
15337
|
-
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
15338
|
-
id: desktopExtensionIdSchema,
|
|
15339
|
-
version: external_exports.string().trim().min(1).max(128),
|
|
15340
|
-
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
15341
|
-
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
15342
|
-
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
15343
|
-
author: external_exports.string().trim().min(1).max(128),
|
|
15344
|
-
repository: desktopExtensionHttpUrlSchema,
|
|
15345
|
-
stars: external_exports.number().int().min(0).optional(),
|
|
15346
|
-
downloads: external_exports.number().int().min(0).optional(),
|
|
15347
|
-
categories: categoriesSchema.optional(),
|
|
15348
|
-
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
15349
|
-
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
15350
|
-
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15351
|
-
downloadUrl: desktopExtensionZipUrlSchema,
|
|
15352
|
-
sha256: desktopExtensionHashSchema,
|
|
15353
|
-
slots: slotsSchema.optional(),
|
|
15354
|
-
publishedAt: external_exports.string().optional(),
|
|
15355
|
-
updatedAt: external_exports.string().optional(),
|
|
15356
|
-
minCodexHostVersion: external_exports.string().optional()
|
|
15357
|
-
});
|
|
15358
|
-
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
15359
|
-
schemaVersion: external_exports.literal(1),
|
|
15360
|
-
generatedAt: external_exports.string(),
|
|
15361
|
-
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, "Duplicate extension IDs")
|
|
15362
|
-
});
|
|
15363
|
-
var DESKTOP_EXTENSIONS_ASSET_METHOD = "codexhost/desktop/extensions/asset";
|
|
15364
|
-
var DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD = "codexhost/desktop/extensions/settings/get";
|
|
15365
|
-
var DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD = "codexhost/desktop/extensions/settings/set";
|
|
15366
|
-
var DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD = "codexhost/desktop/extensions/backend/invoke";
|
|
15367
|
-
var extensionIdParams = { id: desktopExtensionIdSchema };
|
|
15368
|
-
var desktopExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
15369
|
-
...extensionIdParams,
|
|
15370
|
-
path: desktopExtensionAssetPathSchema
|
|
15371
|
-
});
|
|
15372
|
-
var desktopExtensionsAssetResultSchema = external_exports.strictObject({
|
|
15373
|
-
mimeType: external_exports.string(),
|
|
15374
|
-
dataUrl: external_exports.string()
|
|
15375
|
-
});
|
|
15376
|
-
var desktopExtensionsSettingsGetParamsSchema = external_exports.strictObject(extensionIdParams);
|
|
15377
|
-
var desktopExtensionsSettingsSetParamsSchema = external_exports.strictObject({
|
|
15378
|
-
...extensionIdParams,
|
|
15379
|
-
values: jsonObjectSchema
|
|
15380
|
-
});
|
|
15381
|
-
var desktopExtensionsSettingsResultSchema = external_exports.strictObject({ values: jsonObjectSchema });
|
|
15382
|
-
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
15383
|
-
var desktopExtensionsBackendInvokeParamsSchema = external_exports.strictObject({
|
|
15384
|
-
...extensionIdParams,
|
|
15385
|
-
method: desktopExtensionBackendMethodSchema,
|
|
15386
|
-
params: jsonValueSchema.optional()
|
|
15387
|
-
});
|
|
15388
|
-
var desktopExtensionsBackendInvokeResultSchema = external_exports.strictObject({
|
|
15389
|
-
result: jsonValueSchema
|
|
15390
|
-
});
|
|
15391
|
-
|
|
15392
|
-
// ../../shared-contracts/dist/desktop-extension-management.js
|
|
15393
|
-
var DESKTOP_EXTENSIONS_LIST_METHOD = "codexhost/desktop/extensions/list";
|
|
15394
|
-
var DESKTOP_EXTENSIONS_ENABLE_METHOD = "codexhost/desktop/extensions/enable";
|
|
15395
|
-
var DESKTOP_EXTENSIONS_DISABLE_METHOD = "codexhost/desktop/extensions/disable";
|
|
15396
|
-
var DESKTOP_EXTENSIONS_CATALOG_METHOD = "codexhost/desktop/extensions/catalog";
|
|
15397
|
-
var DESKTOP_EXTENSIONS_INSTALL_METHOD = "codexhost/desktop/extensions/install";
|
|
15398
|
-
var DESKTOP_EXTENSIONS_UNINSTALL_METHOD = "codexhost/desktop/extensions/uninstall";
|
|
15399
|
-
var DESKTOP_EXTENSIONS_RECOVER_METHOD = "codexhost/desktop/extensions/disable-all-and-reload";
|
|
15400
|
-
var DESKTOP_EXTENSION_MANAGEMENT_METHODS = [
|
|
15401
|
-
DESKTOP_EXTENSIONS_LIST_METHOD,
|
|
15402
|
-
DESKTOP_EXTENSIONS_ENABLE_METHOD,
|
|
15403
|
-
DESKTOP_EXTENSIONS_DISABLE_METHOD,
|
|
15404
|
-
DESKTOP_EXTENSIONS_RECOVER_METHOD,
|
|
15405
|
-
DESKTOP_EXTENSIONS_CATALOG_METHOD,
|
|
15406
|
-
DESKTOP_EXTENSIONS_INSTALL_METHOD,
|
|
15407
|
-
DESKTOP_EXTENSIONS_UNINSTALL_METHOD,
|
|
15408
|
-
DESKTOP_EXTENSIONS_ASSET_METHOD,
|
|
15409
|
-
DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD,
|
|
15410
|
-
DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD,
|
|
15411
|
-
DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD
|
|
15412
|
-
];
|
|
15413
|
-
var revisionSchema = external_exports.int().nonnegative();
|
|
15414
|
-
var desktopExtensionsListParamsSchema = external_exports.strictObject({});
|
|
15415
|
-
var desktopExtensionSelectionParamsSchema = external_exports.strictObject({
|
|
15416
|
-
id: desktopExtensionIdSchema,
|
|
15417
|
-
expectedRevision: revisionSchema
|
|
15418
|
-
});
|
|
15419
|
-
var desktopExtensionsRecoveryParamsSchema = external_exports.strictObject({
|
|
15420
|
-
expectedRevision: revisionSchema.optional()
|
|
15421
|
-
});
|
|
15422
|
-
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);
|
|
15423
|
-
var desktopExtensionListItemSchema = external_exports.strictObject({
|
|
15424
|
-
// An invalid discovery can have a directory name that isn't a valid extension ID.
|
|
15425
|
-
id: external_exports.string().min(1),
|
|
15426
|
-
manifest: desktopExtensionManifestSchema.optional(),
|
|
15427
|
-
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
15428
|
-
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15429
|
-
enabled: external_exports.boolean(),
|
|
15430
|
-
status: desktopExtensionStatusSchema
|
|
15431
|
-
});
|
|
15432
|
-
var desktopExtensionsListResultSchema = external_exports.strictObject({
|
|
15433
|
-
configuration: desktopExtensionConfigurationSchema,
|
|
15434
|
-
desktopConnected: external_exports.boolean(),
|
|
15435
|
-
diagnostics: external_exports.array(external_exports.string()),
|
|
15436
|
-
extensions: external_exports.array(desktopExtensionListItemSchema)
|
|
15437
|
-
});
|
|
15438
|
-
var desktopExtensionsCatalogParamsSchema = external_exports.strictObject({
|
|
15439
|
-
forceRefresh: external_exports.boolean().optional()
|
|
15440
|
-
});
|
|
15441
|
-
var desktopExtensionsCatalogResultSchema = external_exports.strictObject({
|
|
15442
|
-
catalogUrl: external_exports.string(),
|
|
15443
|
-
source: external_exports.enum(["remote", "fallback"]),
|
|
15444
|
-
fetchedAt: external_exports.string(),
|
|
15445
|
-
cached: external_exports.boolean(),
|
|
15446
|
-
extensions: desktopExtensionCatalogSchema.shape.extensions,
|
|
15447
|
-
error: external_exports.string().optional()
|
|
15448
|
-
});
|
|
15449
|
-
var desktopExtensionsInstallParamsSchema = external_exports.strictObject({
|
|
15450
|
-
source: external_exports.discriminatedUnion("type", [
|
|
15451
|
-
external_exports.strictObject({ type: external_exports.literal("catalog"), id: desktopExtensionIdSchema }),
|
|
15452
|
-
external_exports.strictObject({
|
|
15453
|
-
type: external_exports.literal("url"),
|
|
15454
|
-
url: desktopExtensionHttpUrlSchema,
|
|
15455
|
-
expectedSha256: desktopExtensionHashSchema.optional()
|
|
15456
|
-
}),
|
|
15457
|
-
external_exports.strictObject({
|
|
15458
|
-
type: external_exports.literal("zip-base64"),
|
|
15459
|
-
fileName: external_exports.string().trim().min(1).max(255),
|
|
15460
|
-
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")
|
|
15461
|
-
})
|
|
15462
|
-
])
|
|
15463
|
-
});
|
|
15464
|
-
var desktopExtensionsInstallResultSchema = external_exports.strictObject({
|
|
15465
|
-
extensionId: desktopExtensionIdSchema,
|
|
15466
|
-
version: external_exports.string().min(1),
|
|
15467
|
-
replaced: external_exports.boolean(),
|
|
15468
|
-
installedPath: external_exports.string(),
|
|
15469
|
-
list: desktopExtensionsListResultSchema
|
|
15470
|
-
});
|
|
15471
|
-
var desktopExtensionsUninstallParamsSchema = external_exports.strictObject({
|
|
15472
|
-
id: desktopExtensionIdSchema
|
|
15473
|
-
});
|
|
15474
|
-
var desktopExtensionsUninstallResultSchema = external_exports.strictObject({
|
|
15475
|
-
removedId: desktopExtensionIdSchema,
|
|
15476
|
-
list: desktopExtensionsListResultSchema
|
|
15477
|
-
});
|
|
15478
|
-
var desktopExtensionMutationResultSchema = external_exports.discriminatedUnion("state", [
|
|
15479
|
-
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: desktopExtensionConfigurationSchema }),
|
|
15480
|
-
external_exports.strictObject({ state: external_exports.literal("slot-conflict"), conflictWith: desktopExtensionIdSchema }),
|
|
15481
|
-
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: revisionSchema })
|
|
15482
|
-
]);
|
|
15483
|
-
|
|
15484
|
-
// ../../shared-contracts/dist/errors.js
|
|
15485
|
-
var codexhostErrorSchema = external_exports.strictObject({
|
|
15486
|
-
code: external_exports.string().min(1),
|
|
15487
|
-
message: external_exports.string().min(1),
|
|
15488
|
-
retryable: external_exports.boolean(),
|
|
15489
|
-
diagnostic: external_exports.string().min(1).optional(),
|
|
15490
|
-
stage: external_exports.string().min(1).optional(),
|
|
15491
|
-
durationMs: external_exports.number().int().nonnegative().optional(),
|
|
15492
|
-
stderrTail: external_exports.string().min(1).optional()
|
|
15493
|
-
}).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
|
|
15494
|
-
|
|
15495
|
-
// ../../shared-contracts/dist/harness-presentation.js
|
|
15496
|
-
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
15497
|
-
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
|
|
15498
|
-
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
15499
|
-
label: displayText(256).optional(),
|
|
15500
|
-
description: displayText(1024).optional()
|
|
15501
|
-
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
15502
|
-
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");
|
|
15503
|
-
|
|
15504
|
-
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
15505
|
-
var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
|
|
15506
|
-
var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
|
|
15507
|
-
var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
|
|
15508
|
-
var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
|
|
15509
|
-
var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15510
|
-
message: "Value must not be empty or whitespace"
|
|
15511
|
-
});
|
|
15512
|
-
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();
|
|
15513
|
-
var harnessPermissionModeSchema = external_exports.object({
|
|
15514
|
-
id: harnessPermissionModeIdSchema,
|
|
15515
|
-
label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
|
|
15516
|
-
description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
15517
|
-
dangerous: external_exports.boolean().optional(),
|
|
15518
|
-
localizations: harnessLocalizationsSchema.optional()
|
|
15519
|
-
}).strict();
|
|
15520
|
-
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
15521
|
-
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
15522
|
-
defaultModeId: harnessPermissionModeIdSchema
|
|
15523
|
-
}).strict().superRefine((catalog, context) => {
|
|
15524
|
-
const ids = /* @__PURE__ */ new Set();
|
|
15525
|
-
for (const [index, mode] of catalog.modes.entries()) {
|
|
15526
|
-
if (ids.has(mode.id)) {
|
|
15527
|
-
context.addIssue({
|
|
15528
|
-
code: "custom",
|
|
15529
|
-
message: "Permission Mode IDs must be unique",
|
|
15530
|
-
path: ["modes", index, "id"]
|
|
15531
|
-
});
|
|
15532
|
-
}
|
|
15533
|
-
ids.add(mode.id);
|
|
15534
|
-
}
|
|
15535
|
-
if (!ids.has(catalog.defaultModeId)) {
|
|
15536
|
-
context.addIssue({
|
|
15537
|
-
code: "custom",
|
|
15538
|
-
message: "Default Permission Mode must exist in the catalog",
|
|
15539
|
-
path: ["defaultModeId"]
|
|
15540
|
-
});
|
|
15124
|
+
if (!ids.has(catalog.defaultModeId)) {
|
|
15125
|
+
context.addIssue({
|
|
15126
|
+
code: "custom",
|
|
15127
|
+
message: "Default Permission Mode must exist in the catalog",
|
|
15128
|
+
path: ["defaultModeId"]
|
|
15129
|
+
});
|
|
15541
15130
|
}
|
|
15542
15131
|
});
|
|
15543
15132
|
var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
@@ -15545,6 +15134,9 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
|
15545
15134
|
permissionModeId: harnessPermissionModeIdSchema
|
|
15546
15135
|
}).strict();
|
|
15547
15136
|
|
|
15137
|
+
// ../../shared-contracts/dist/harness-route-limit.js
|
|
15138
|
+
var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
|
|
15139
|
+
|
|
15548
15140
|
// ../../shared-contracts/dist/thread-usage.js
|
|
15549
15141
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15550
15142
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -15577,7 +15169,7 @@ var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
|
15577
15169
|
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
15578
15170
|
label: indicatorTextSchema(256).optional(),
|
|
15579
15171
|
tooltip: indicatorTextSchema(1024).optional()
|
|
15580
|
-
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) =>
|
|
15172
|
+
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, {
|
|
15581
15173
|
message: "Composer indicator IDs must be unique"
|
|
15582
15174
|
});
|
|
15583
15175
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
@@ -15603,6 +15195,7 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
15603
15195
|
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
15604
15196
|
sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
|
|
15605
15197
|
timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
15198
|
+
latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
15606
15199
|
costSource: external_exports.enum(["publicPrice", "native"]).optional(),
|
|
15607
15200
|
unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
|
|
15608
15201
|
}).strict().superRefine((usage, context) => {
|
|
@@ -15730,10 +15323,15 @@ var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
|
|
|
15730
15323
|
var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15731
15324
|
message: "Value must not be empty or whitespace"
|
|
15732
15325
|
});
|
|
15733
|
-
var harnessModelRefIdSchema =
|
|
15326
|
+
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();
|
|
15327
|
+
var harnessModelServiceTierSchema = external_exports.enum(["priority", "ultrafast"]);
|
|
15734
15328
|
var harnessModelRefSchema = external_exports.object({
|
|
15735
|
-
id: harnessModelRefIdSchema
|
|
15329
|
+
id: harnessModelRefIdSchema,
|
|
15330
|
+
serviceTier: harnessModelServiceTierSchema.optional()
|
|
15736
15331
|
}).strict();
|
|
15332
|
+
function sameHarnessModelRef(left, right) {
|
|
15333
|
+
return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
|
|
15334
|
+
}
|
|
15737
15335
|
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();
|
|
15738
15336
|
var harnessResolvedModelLabelSchema = nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
15739
15337
|
var harnessThinkingOptionSchema = external_exports.object({
|
|
@@ -15747,7 +15345,15 @@ var harnessModelSchema = external_exports.object({
|
|
|
15747
15345
|
/** Optional opaque selection for this same Model with priority processing enabled. */
|
|
15748
15346
|
fastModel: harnessModelRefSchema.optional(),
|
|
15749
15347
|
supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
|
|
15750
|
-
}).strict()
|
|
15348
|
+
}).strict().refine((model2) => model2.fastModel?.serviceTier === void 0 || model2.fastModel.id === model2.ref.id, {
|
|
15349
|
+
path: ["fastModel", "id"],
|
|
15350
|
+
message: "A tiered Fast Model must share the base Model ID"
|
|
15351
|
+
});
|
|
15352
|
+
function catalogModelForRef(catalog, ref) {
|
|
15353
|
+
if (!ref)
|
|
15354
|
+
return void 0;
|
|
15355
|
+
return catalog?.models.find((model2) => sameHarnessModelRef(model2.ref, ref) || sameHarnessModelRef(model2.fastModel, ref));
|
|
15356
|
+
}
|
|
15751
15357
|
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
|
|
15752
15358
|
const ids = /* @__PURE__ */ new Set();
|
|
15753
15359
|
for (const [index, option] of options.entries()) {
|
|
@@ -15767,26 +15373,26 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
15767
15373
|
thinkingOptions: harnessThinkingOptionsSchema,
|
|
15768
15374
|
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
15769
15375
|
}).strict().superRefine((catalog, context) => {
|
|
15770
|
-
const refs =
|
|
15771
|
-
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) =>
|
|
15376
|
+
const refs = [];
|
|
15377
|
+
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
|
|
15772
15378
|
for (const [index, model2] of catalog.models.entries()) {
|
|
15773
|
-
if (refs.
|
|
15379
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
|
|
15774
15380
|
context.addIssue({
|
|
15775
15381
|
code: "custom",
|
|
15776
15382
|
message: "Model Catalog refs must be unique",
|
|
15777
15383
|
path: ["models", index, "ref", "id"]
|
|
15778
15384
|
});
|
|
15779
15385
|
}
|
|
15780
|
-
refs.
|
|
15386
|
+
refs.push(model2.ref);
|
|
15781
15387
|
if (model2.fastModel) {
|
|
15782
|
-
if (refs.
|
|
15388
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.fastModel))) {
|
|
15783
15389
|
context.addIssue({
|
|
15784
15390
|
code: "custom",
|
|
15785
15391
|
message: "Fast Model refs must be distinct and unique",
|
|
15786
15392
|
path: ["models", index, "fastModel"]
|
|
15787
15393
|
});
|
|
15788
15394
|
}
|
|
15789
|
-
refs.
|
|
15395
|
+
refs.push(model2.fastModel);
|
|
15790
15396
|
}
|
|
15791
15397
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
15792
15398
|
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
@@ -15807,7 +15413,7 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
15807
15413
|
}
|
|
15808
15414
|
}
|
|
15809
15415
|
}
|
|
15810
|
-
if (catalog.defaultModel && !
|
|
15416
|
+
if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
|
|
15811
15417
|
context.addIssue({
|
|
15812
15418
|
code: "custom",
|
|
15813
15419
|
message: "Default Model must exist in the Model Catalog",
|
|
@@ -15847,7 +15453,12 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
|
15847
15453
|
observe: external_exports.boolean()
|
|
15848
15454
|
}).strict().optional(),
|
|
15849
15455
|
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
15850
|
-
steer: external_exports.boolean().optional()
|
|
15456
|
+
steer: external_exports.boolean().optional(),
|
|
15457
|
+
/**
|
|
15458
|
+
* True when the native plan (task list) outlives the Turn that changed it, so a reopened
|
|
15459
|
+
* Thread gets its latest plan again. Otherwise a plan stays with the Turn that made it.
|
|
15460
|
+
*/
|
|
15461
|
+
persistentPlan: external_exports.boolean().optional()
|
|
15851
15462
|
}).strict();
|
|
15852
15463
|
var harnessConfigurationStateSchema = external_exports.object({
|
|
15853
15464
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
@@ -15856,7 +15467,7 @@ var harnessConfigurationStateSchema = external_exports.object({
|
|
|
15856
15467
|
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15857
15468
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
|
|
15858
15469
|
}).strict().superRefine((state, context) => {
|
|
15859
|
-
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) =>
|
|
15470
|
+
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
|
|
15860
15471
|
context.addIssue({
|
|
15861
15472
|
code: "custom",
|
|
15862
15473
|
message: "Effective Thinking option must be currently available",
|
|
@@ -15883,131 +15494,677 @@ var readyHarnessInspectionSchema = external_exports.object({
|
|
|
15883
15494
|
});
|
|
15884
15495
|
}
|
|
15885
15496
|
});
|
|
15886
|
-
var failedHarnessInspectionSchema = external_exports.object({
|
|
15887
|
-
status: external_exports.enum(["notInstalled", "unavailable", "error"]),
|
|
15888
|
-
error: codexhostErrorSchema
|
|
15889
|
-
}).strict();
|
|
15890
|
-
var harnessInspectionSchema = external_exports.union([
|
|
15891
|
-
readyHarnessInspectionSchema,
|
|
15892
|
-
failedHarnessInspectionSchema
|
|
15497
|
+
var failedHarnessInspectionSchema = external_exports.object({
|
|
15498
|
+
status: external_exports.enum(["notInstalled", "unavailable", "error"]),
|
|
15499
|
+
error: codexhostErrorSchema
|
|
15500
|
+
}).strict();
|
|
15501
|
+
var harnessInspectionSchema = external_exports.union([
|
|
15502
|
+
readyHarnessInspectionSchema,
|
|
15503
|
+
failedHarnessInspectionSchema
|
|
15504
|
+
]);
|
|
15505
|
+
var harnessInspectParamsSchema = external_exports.object({
|
|
15506
|
+
harnessId: harnessIdSchema,
|
|
15507
|
+
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
15508
|
+
refresh: external_exports.boolean().optional(),
|
|
15509
|
+
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
15510
|
+
purpose: external_exports.literal("availability").optional(),
|
|
15511
|
+
credentialAccess: external_exports.enum(["allow", "retry"]).optional()
|
|
15512
|
+
}).strict();
|
|
15513
|
+
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15514
|
+
harnessId: harnessIdSchema
|
|
15515
|
+
}).strict();
|
|
15516
|
+
var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
|
|
15517
|
+
var threadModelSelectParamsSchema = external_exports.object({
|
|
15518
|
+
threadId: hostThreadIdSchema,
|
|
15519
|
+
model: harnessModelRefSchema
|
|
15520
|
+
}).strict();
|
|
15521
|
+
var threadThinkingSelectParamsSchema = external_exports.object({
|
|
15522
|
+
threadId: hostThreadIdSchema,
|
|
15523
|
+
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
15524
|
+
}).strict();
|
|
15525
|
+
var threadInspectionParamsSchema = external_exports.object({
|
|
15526
|
+
threadId: hostThreadIdSchema,
|
|
15527
|
+
includeReferenceCapability: external_exports.boolean().optional()
|
|
15528
|
+
}).strict();
|
|
15529
|
+
var codexThreadInspectionSchema = external_exports.object({
|
|
15530
|
+
owner: external_exports.literal("codex"),
|
|
15531
|
+
locked: external_exports.boolean(),
|
|
15532
|
+
effectiveModel: harnessModelRefSchema.optional(),
|
|
15533
|
+
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15534
|
+
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15535
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15536
|
+
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
15537
|
+
supportsThreadReferences: external_exports.literal(true).optional()
|
|
15538
|
+
}).strict();
|
|
15539
|
+
var externalThreadInspectionSchema = external_exports.object({
|
|
15540
|
+
owner: external_exports.literal("external"),
|
|
15541
|
+
harnessId: nonBlankTextSchema2.max(256),
|
|
15542
|
+
transportModelId: nonBlankTextSchema2.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
|
|
15543
|
+
effectiveModel: harnessModelRefSchema.optional(),
|
|
15544
|
+
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15545
|
+
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15546
|
+
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15547
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15548
|
+
history: harnessHistoryCapabilitiesSchema,
|
|
15549
|
+
usage: threadUsageSnapshotSchema.optional(),
|
|
15550
|
+
locked: external_exports.literal(true)
|
|
15551
|
+
}).strict();
|
|
15552
|
+
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
15553
|
+
codexThreadInspectionSchema,
|
|
15554
|
+
externalThreadInspectionSchema
|
|
15555
|
+
]);
|
|
15556
|
+
var threadOwnershipListParamsSchema = external_exports.object({
|
|
15557
|
+
threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15558
|
+
}).strict().superRefine(({ threadIds }, context) => {
|
|
15559
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15560
|
+
for (const [index, threadId] of threadIds.entries()) {
|
|
15561
|
+
if (seen.has(threadId)) {
|
|
15562
|
+
context.addIssue({
|
|
15563
|
+
code: "custom",
|
|
15564
|
+
message: "Thread ownership-list IDs must be unique",
|
|
15565
|
+
path: ["threadIds", index]
|
|
15566
|
+
});
|
|
15567
|
+
}
|
|
15568
|
+
seen.add(threadId);
|
|
15569
|
+
}
|
|
15570
|
+
});
|
|
15571
|
+
var codexThreadOwnershipSchema = external_exports.object({
|
|
15572
|
+
threadId: hostThreadIdSchema,
|
|
15573
|
+
owner: external_exports.literal("codex")
|
|
15574
|
+
}).strict();
|
|
15575
|
+
var externalThreadOwnershipSchema = external_exports.object({
|
|
15576
|
+
threadId: hostThreadIdSchema,
|
|
15577
|
+
owner: external_exports.literal("external"),
|
|
15578
|
+
harnessId: external_exports.string().max(256).pipe(harnessIdSchema)
|
|
15579
|
+
}).strict();
|
|
15580
|
+
var threadOwnershipSchema = external_exports.discriminatedUnion("owner", [
|
|
15581
|
+
codexThreadOwnershipSchema,
|
|
15582
|
+
externalThreadOwnershipSchema
|
|
15583
|
+
]);
|
|
15584
|
+
var threadOwnershipListResultSchema = external_exports.object({
|
|
15585
|
+
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15586
|
+
}).strict().superRefine(({ threads }, context) => {
|
|
15587
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15588
|
+
for (const [index, thread2] of threads.entries()) {
|
|
15589
|
+
if (seen.has(thread2.threadId)) {
|
|
15590
|
+
context.addIssue({
|
|
15591
|
+
code: "custom",
|
|
15592
|
+
message: "Thread ownership-list results must be unique",
|
|
15593
|
+
path: ["threads", index, "threadId"]
|
|
15594
|
+
});
|
|
15595
|
+
}
|
|
15596
|
+
seen.add(thread2.threadId);
|
|
15597
|
+
}
|
|
15598
|
+
});
|
|
15599
|
+
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
15600
|
+
threadId: hostThreadIdSchema,
|
|
15601
|
+
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15602
|
+
text: external_exports.string().optional()
|
|
15603
|
+
}).strict();
|
|
15604
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15605
|
+
kind: external_exports.literal("application"),
|
|
15606
|
+
value: external_exports.string().transform((text2, context) => {
|
|
15607
|
+
try {
|
|
15608
|
+
return JSON.parse(text2);
|
|
15609
|
+
} catch {
|
|
15610
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15611
|
+
return external_exports.NEVER;
|
|
15612
|
+
}
|
|
15613
|
+
}).pipe(external_exports.object({
|
|
15614
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15615
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15616
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15617
|
+
}).strict())
|
|
15618
|
+
}).strict().transform((context) => context.value);
|
|
15619
|
+
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15620
|
+
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15621
|
+
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15622
|
+
}).strict();
|
|
15623
|
+
|
|
15624
|
+
// ../../shared-contracts/dist/harness-plugins.js
|
|
15625
|
+
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
15626
|
+
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
15627
|
+
var HARNESS_PLUGIN_LIMIT = 128;
|
|
15628
|
+
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
15629
|
+
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
15630
|
+
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id2) => id2 !== "codex", "The official Codex identity is reserved");
|
|
15631
|
+
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");
|
|
15632
|
+
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
15633
|
+
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
15634
|
+
var harnessInstallationGuideSchema = external_exports.object({
|
|
15635
|
+
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
15636
|
+
before: localizedTextSchema.optional(),
|
|
15637
|
+
after: localizedTextSchema.optional(),
|
|
15638
|
+
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
15639
|
+
}).strict();
|
|
15640
|
+
var pluginPresentationShape = {
|
|
15641
|
+
id: installedHarnessPluginIdSchema,
|
|
15642
|
+
name: external_exports.string().trim().min(1).max(128),
|
|
15643
|
+
version: external_exports.string().min(1).max(128),
|
|
15644
|
+
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
15645
|
+
kind: external_exports.literal("usage").optional(),
|
|
15646
|
+
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
15647
|
+
iconStyle: external_exports.object({
|
|
15648
|
+
vector: external_exports.object({
|
|
15649
|
+
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
15650
|
+
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
15651
|
+
paths: external_exports.array(external_exports.object({
|
|
15652
|
+
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
15653
|
+
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
15654
|
+
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
15655
|
+
}).strict()).min(1).max(32)
|
|
15656
|
+
}).strict().optional(),
|
|
15657
|
+
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
15658
|
+
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
15659
|
+
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
15660
|
+
}).strict().optional(),
|
|
15661
|
+
installation: harnessInstallationGuideSchema.optional(),
|
|
15662
|
+
notice: localizedTextSchema.optional(),
|
|
15663
|
+
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
15664
|
+
launchCommand: external_exports.literal(true).optional(),
|
|
15665
|
+
links: external_exports.object({
|
|
15666
|
+
website: documentationUrlSchema.optional(),
|
|
15667
|
+
documentation: documentationUrlSchema.optional(),
|
|
15668
|
+
installation: documentationUrlSchema.optional()
|
|
15669
|
+
}).strict().optional()
|
|
15670
|
+
};
|
|
15671
|
+
var harnessPluginManifestSchema = external_exports.object({
|
|
15672
|
+
manifestVersion: external_exports.literal(1),
|
|
15673
|
+
...pluginPresentationShape,
|
|
15674
|
+
adapterApiVersion: external_exports.number().int().positive(),
|
|
15675
|
+
entry: pluginRelativeResourceSchema,
|
|
15676
|
+
icon: pluginRelativeResourceSchema.optional()
|
|
15677
|
+
}).strict();
|
|
15678
|
+
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);
|
|
15679
|
+
var harnessPluginDescriptorSchema = external_exports.object({
|
|
15680
|
+
...pluginPresentationShape,
|
|
15681
|
+
icon: harnessPluginIconSchema.optional()
|
|
15682
|
+
}).strict();
|
|
15683
|
+
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
15684
|
+
var harnessPluginListResultSchema = external_exports.object({
|
|
15685
|
+
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
15686
|
+
}).strict();
|
|
15687
|
+
var harnessPluginConfigurationSchema = external_exports.object({
|
|
15688
|
+
version: external_exports.literal(1),
|
|
15689
|
+
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
15690
|
+
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
15691
|
+
message: "Enabled plugin IDs must be unique",
|
|
15692
|
+
path: ["enabled"]
|
|
15693
|
+
});
|
|
15694
|
+
|
|
15695
|
+
// ../../shared-contracts/dist/desktop-extensions.js
|
|
15696
|
+
var DESKTOP_EXTENSION_API_VERSION = 1;
|
|
15697
|
+
var DESKTOP_EXTENSION_LIMIT = 64;
|
|
15698
|
+
var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
|
|
15699
|
+
var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
|
|
15700
|
+
var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
|
|
15701
|
+
var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
|
|
15702
|
+
var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
|
|
15703
|
+
var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
|
|
15704
|
+
var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
|
|
15705
|
+
var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
|
|
15706
|
+
var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
|
|
15707
|
+
var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
|
|
15708
|
+
var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
|
|
15709
|
+
var desktopExtensionIdSchema = installedPluginIdSchema;
|
|
15710
|
+
var desktopExtensionSlotSchema = external_exports.enum([
|
|
15711
|
+
"sidebar.thread-layout",
|
|
15712
|
+
"sidebar.thread-badge",
|
|
15713
|
+
"appearance.theme"
|
|
15714
|
+
]);
|
|
15715
|
+
var desktopExtensionCategorySchema = external_exports.enum([
|
|
15716
|
+
"appearance",
|
|
15717
|
+
"interface",
|
|
15718
|
+
"workflow",
|
|
15719
|
+
"analytics",
|
|
15720
|
+
"integrations",
|
|
15721
|
+
"tools"
|
|
15722
|
+
]);
|
|
15723
|
+
var extensionName = external_exports.string().trim().min(1).max(128);
|
|
15724
|
+
function desktopExtensionScreenshotMimeType(resource) {
|
|
15725
|
+
switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
|
|
15726
|
+
case "png":
|
|
15727
|
+
return "image/png";
|
|
15728
|
+
case "jpg":
|
|
15729
|
+
case "jpeg":
|
|
15730
|
+
return "image/jpeg";
|
|
15731
|
+
case "webp":
|
|
15732
|
+
return "image/webp";
|
|
15733
|
+
default:
|
|
15734
|
+
return void 0;
|
|
15735
|
+
}
|
|
15736
|
+
}
|
|
15737
|
+
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
15738
|
+
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");
|
|
15739
|
+
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) => {
|
|
15740
|
+
const { username, password } = new URL(value);
|
|
15741
|
+
return !username && !password && !/[\\\s]/u.test(value);
|
|
15742
|
+
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
15743
|
+
function localizedText(text2) {
|
|
15744
|
+
return external_exports.strictObject({ en: text2, "zh-CN": text2 });
|
|
15745
|
+
}
|
|
15746
|
+
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
15747
|
+
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
15748
|
+
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
15749
|
+
var settingField = {
|
|
15750
|
+
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
15751
|
+
label: desktopExtensionLocalizedTextSchema,
|
|
15752
|
+
description: desktopExtensionLocalizedTextSchema.optional()
|
|
15753
|
+
};
|
|
15754
|
+
var numericSetting = {
|
|
15755
|
+
...settingField,
|
|
15756
|
+
step: external_exports.number().positive().optional(),
|
|
15757
|
+
default: external_exports.number().optional()
|
|
15758
|
+
};
|
|
15759
|
+
var settingOption = external_exports.strictObject({
|
|
15760
|
+
value: external_exports.string(),
|
|
15761
|
+
label: desktopExtensionLocalizedTextSchema
|
|
15762
|
+
});
|
|
15763
|
+
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
15764
|
+
external_exports.strictObject({
|
|
15765
|
+
...settingField,
|
|
15766
|
+
type: external_exports.literal("boolean"),
|
|
15767
|
+
default: external_exports.boolean().optional()
|
|
15768
|
+
}),
|
|
15769
|
+
external_exports.strictObject({
|
|
15770
|
+
...settingField,
|
|
15771
|
+
type: external_exports.literal("string"),
|
|
15772
|
+
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
15773
|
+
default: external_exports.string().optional()
|
|
15774
|
+
}),
|
|
15775
|
+
external_exports.strictObject({
|
|
15776
|
+
...numericSetting,
|
|
15777
|
+
type: external_exports.literal("number"),
|
|
15778
|
+
min: external_exports.number().optional(),
|
|
15779
|
+
max: external_exports.number().optional()
|
|
15780
|
+
}),
|
|
15781
|
+
external_exports.strictObject({
|
|
15782
|
+
...numericSetting,
|
|
15783
|
+
type: external_exports.literal("range"),
|
|
15784
|
+
min: external_exports.number(),
|
|
15785
|
+
max: external_exports.number()
|
|
15786
|
+
}),
|
|
15787
|
+
external_exports.strictObject({
|
|
15788
|
+
...settingField,
|
|
15789
|
+
type: external_exports.literal("select"),
|
|
15790
|
+
options: external_exports.array(settingOption).min(1),
|
|
15791
|
+
default: external_exports.string().optional()
|
|
15792
|
+
})
|
|
15793
|
+
]).superRefine((field2, ctx) => {
|
|
15794
|
+
const issue2 = (path12, message) => ctx.addIssue({ code: "custom", path: [path12], message });
|
|
15795
|
+
if (field2.type === "number" || field2.type === "range") {
|
|
15796
|
+
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
15797
|
+
if (min > max)
|
|
15798
|
+
issue2("max", "Must be at least min");
|
|
15799
|
+
if (value !== void 0 && (value < min || value > max))
|
|
15800
|
+
issue2("default", "Must be within min and max");
|
|
15801
|
+
} else if (field2.type === "select") {
|
|
15802
|
+
const values = new Set(field2.options.map(({ value }) => value));
|
|
15803
|
+
if (values.size !== field2.options.length)
|
|
15804
|
+
issue2("options", "Duplicate option values");
|
|
15805
|
+
if (field2.default !== void 0 && !values.has(field2.default))
|
|
15806
|
+
issue2("default", "Must match an option value");
|
|
15807
|
+
}
|
|
15808
|
+
});
|
|
15809
|
+
var manifestHeader = external_exports.object({
|
|
15810
|
+
manifestVersion: external_exports.int().positive(),
|
|
15811
|
+
id: desktopExtensionIdSchema,
|
|
15812
|
+
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
15813
|
+
version: external_exports.string().min(1).max(128),
|
|
15814
|
+
desktopApi: external_exports.int().positive()
|
|
15815
|
+
}).passthrough();
|
|
15816
|
+
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
15817
|
+
manifestVersion: external_exports.literal(1),
|
|
15818
|
+
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
15819
|
+
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
15820
|
+
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
15821
|
+
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
15822
|
+
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
15823
|
+
icon: imagePathSchema.optional(),
|
|
15824
|
+
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
15825
|
+
desktop: external_exports.strictObject({
|
|
15826
|
+
script: pluginRelativeResourceSchema,
|
|
15827
|
+
style: pluginRelativeResourceSchema.optional()
|
|
15828
|
+
}).optional(),
|
|
15829
|
+
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
15830
|
+
slots: slotsSchema.default(() => []),
|
|
15831
|
+
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
15832
|
+
categories: categoriesSchema.optional()
|
|
15833
|
+
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
15834
|
+
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
15835
|
+
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
15836
|
+
state: external_exports.enum([
|
|
15837
|
+
"running",
|
|
15838
|
+
"disabled",
|
|
15839
|
+
"invalid",
|
|
15840
|
+
"incompatible",
|
|
15841
|
+
"conflict",
|
|
15842
|
+
"failed",
|
|
15843
|
+
"waiting"
|
|
15844
|
+
]),
|
|
15845
|
+
hash: desktopExtensionHashSchema.optional(),
|
|
15846
|
+
error: external_exports.string().optional(),
|
|
15847
|
+
conflictWith: desktopExtensionIdSchema.optional()
|
|
15848
|
+
});
|
|
15849
|
+
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
15850
|
+
controllerPid: external_exports.int().positive(),
|
|
15851
|
+
targetId: external_exports.string().nullable(),
|
|
15852
|
+
updatedAt: external_exports.iso.datetime(),
|
|
15853
|
+
handledReloadToken: external_exports.uuid().optional(),
|
|
15854
|
+
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema),
|
|
15855
|
+
surfaces: external_exports.record(external_exports.string(), desktopExtensionStatusSchema).optional()
|
|
15856
|
+
});
|
|
15857
|
+
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
15858
|
+
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
15859
|
+
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
15860
|
+
}
|
|
15861
|
+
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
|
|
15862
|
+
const url2 = new URL(input);
|
|
15863
|
+
return /\.zip$/iu.test(url2.pathname) || isGitHubDesktopExtensionZipballUrl(url2) || url2.origin === "https://github.com" && /^\/[\w-]+\/[\w.-]+\/zipball(?:\/.+)?\/?$/u.test(url2.pathname) || url2.origin === "https://codeload.github.com" && /^\/[\w-]+\/[\w.-]+\/(?:zip|zipball|legacy\.zip)\/.+$/u.test(url2.pathname);
|
|
15864
|
+
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
15865
|
+
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
15866
|
+
id: desktopExtensionIdSchema,
|
|
15867
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
15868
|
+
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
15869
|
+
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
15870
|
+
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
15871
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
15872
|
+
repository: desktopExtensionHttpUrlSchema,
|
|
15873
|
+
stars: external_exports.number().int().min(0).optional(),
|
|
15874
|
+
downloads: external_exports.number().int().min(0).optional(),
|
|
15875
|
+
categories: categoriesSchema.optional(),
|
|
15876
|
+
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
15877
|
+
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
15878
|
+
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15879
|
+
downloadUrl: desktopExtensionZipUrlSchema,
|
|
15880
|
+
sha256: desktopExtensionHashSchema,
|
|
15881
|
+
slots: slotsSchema.optional(),
|
|
15882
|
+
publishedAt: external_exports.string().optional(),
|
|
15883
|
+
updatedAt: external_exports.string().optional(),
|
|
15884
|
+
minCodexHostVersion: external_exports.string().optional()
|
|
15885
|
+
});
|
|
15886
|
+
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
15887
|
+
schemaVersion: external_exports.literal(1),
|
|
15888
|
+
generatedAt: external_exports.string(),
|
|
15889
|
+
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
15890
|
+
});
|
|
15891
|
+
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
15892
|
+
|
|
15893
|
+
// ../../shared-contracts/dist/host-extensions.js
|
|
15894
|
+
var reservedName = /^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu;
|
|
15895
|
+
var HOST_EXTENSION_PAGE_API_VERSION = 1;
|
|
15896
|
+
var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedName.test(id2), "Reserved extension ID");
|
|
15897
|
+
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
15898
|
+
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
15899
|
+
var hostExtensionActivationIdSchema = external_exports.uuid();
|
|
15900
|
+
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((path12) => path12.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
|
|
15901
|
+
var legacy = desktopExtensionManifestSchema.shape;
|
|
15902
|
+
var localized = (max, min = 0) => external_exports.strictObject({
|
|
15903
|
+
en: external_exports.string().trim().min(min).max(max),
|
|
15904
|
+
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
15905
|
+
});
|
|
15906
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path12) => path12.endsWith(suffix), `Expected a ${suffix} file`);
|
|
15907
|
+
var moduleEntry = resourceWithSuffix(".mjs");
|
|
15908
|
+
var style = resourceWithSuffix(".css").optional();
|
|
15909
|
+
var hostExtensionCanonicalPath = (path12) => path12.normalize("NFC").toLowerCase();
|
|
15910
|
+
var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
15911
|
+
manifestVersion: external_exports.literal(2),
|
|
15912
|
+
id: hostExtensionIdSchema,
|
|
15913
|
+
name: localized(128, 1),
|
|
15914
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
15915
|
+
description: localized(4096),
|
|
15916
|
+
details: localized(16384).optional(),
|
|
15917
|
+
author: legacy.author,
|
|
15918
|
+
repository: legacy.repository,
|
|
15919
|
+
icon: legacy.icon.refine((path12) => path12 === void 0 || hostExtensionResourcePathSchema.safeParse(path12).success),
|
|
15920
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path12) => hostExtensionResourcePathSchema.safeParse(path12).success)),
|
|
15921
|
+
categories: legacy.categories,
|
|
15922
|
+
settingsSchema: legacy.settingsSchema,
|
|
15923
|
+
slots: legacy.slots.removeDefault().optional(),
|
|
15924
|
+
page: external_exports.strictObject({
|
|
15925
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
15926
|
+
entry: moduleEntry,
|
|
15927
|
+
style,
|
|
15928
|
+
title: localized(128, 1).optional()
|
|
15929
|
+
}).optional(),
|
|
15930
|
+
widget: external_exports.strictObject({
|
|
15931
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
15932
|
+
entry: moduleEntry,
|
|
15933
|
+
style
|
|
15934
|
+
}).optional(),
|
|
15935
|
+
desktop: external_exports.strictObject({ apiVersion: external_exports.literal(1), script: resourceWithSuffix(".js"), style }).optional(),
|
|
15936
|
+
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(),
|
|
15937
|
+
backend: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry }).optional()
|
|
15938
|
+
}).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" });
|
|
15939
|
+
function targetsForCapabilities({ hasPage, hasWidget, hasDesktop, hasWeb, hasBackend }) {
|
|
15940
|
+
if (hasPage || hasWidget || hasBackend && !hasDesktop && !hasWeb)
|
|
15941
|
+
return ["desktop", "web"];
|
|
15942
|
+
const targets = [];
|
|
15943
|
+
if (hasDesktop)
|
|
15944
|
+
targets.push("desktop");
|
|
15945
|
+
if (hasWeb)
|
|
15946
|
+
targets.push("web");
|
|
15947
|
+
return targets;
|
|
15948
|
+
}
|
|
15949
|
+
var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
|
|
15950
|
+
|
|
15951
|
+
// ../../shared-contracts/dist/host-extension-management.js
|
|
15952
|
+
var HOST_EXTENSION_ZIP_MAX_BYTES = DESKTOP_EXTENSION_ZIP_MAX_BYTES;
|
|
15953
|
+
var hostExtensionRevisionSchema = external_exports.int().nonnegative();
|
|
15954
|
+
var hostExtensionConfigurationSchema = external_exports.strictObject({
|
|
15955
|
+
revision: hostExtensionRevisionSchema,
|
|
15956
|
+
enabled: external_exports.array(hostExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs")
|
|
15957
|
+
});
|
|
15958
|
+
var { downloadUrl, ...catalogMetadata } = desktopExtensionCatalogEntrySchema.shape;
|
|
15959
|
+
var hostExtensionCatalogEntrySchema = external_exports.object({
|
|
15960
|
+
...catalogMetadata,
|
|
15961
|
+
id: hostExtensionIdSchema,
|
|
15962
|
+
format: external_exports.literal("codexhost"),
|
|
15963
|
+
targets: external_exports.array(hostExtensionTargetSchema).min(1).max(2).refine((targets) => new Set(targets).size === targets.length, "Duplicate targets"),
|
|
15964
|
+
apis: external_exports.strictObject({
|
|
15965
|
+
page: external_exports.int().positive().optional(),
|
|
15966
|
+
widget: external_exports.int().positive().optional(),
|
|
15967
|
+
desktop: external_exports.int().positive().optional(),
|
|
15968
|
+
web: external_exports.int().positive().optional(),
|
|
15969
|
+
backend: external_exports.int().positive().optional()
|
|
15970
|
+
}),
|
|
15971
|
+
downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS")
|
|
15972
|
+
}).refine(({ targets, apis }) => {
|
|
15973
|
+
const derived = targetsForCapabilities({
|
|
15974
|
+
hasPage: Boolean(apis.page),
|
|
15975
|
+
hasWidget: Boolean(apis.widget),
|
|
15976
|
+
hasDesktop: Boolean(apis.desktop),
|
|
15977
|
+
hasWeb: Boolean(apis.web),
|
|
15978
|
+
hasBackend: Boolean(apis.backend)
|
|
15979
|
+
});
|
|
15980
|
+
return targets.length === derived.length && derived.every((target2) => targets.includes(target2));
|
|
15981
|
+
}, "Catalog targets must match the declared APIs");
|
|
15982
|
+
var hostExtensionCatalogSchema = external_exports.object({
|
|
15983
|
+
schemaVersion: external_exports.literal(2),
|
|
15984
|
+
generatedAt: external_exports.string().min(1),
|
|
15985
|
+
extensions: external_exports.array(hostExtensionCatalogEntrySchema).max(1e4).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
15986
|
+
});
|
|
15987
|
+
var hostExtensionsCatalogResultSchema = hostExtensionCatalogSchema.extend({
|
|
15988
|
+
catalogUrl: desktopExtensionHttpUrlSchema,
|
|
15989
|
+
fetchedAt: external_exports.iso.datetime(),
|
|
15990
|
+
cached: external_exports.boolean()
|
|
15991
|
+
});
|
|
15992
|
+
var id = { id: hostExtensionIdSchema };
|
|
15993
|
+
var active = {
|
|
15994
|
+
...id,
|
|
15995
|
+
activationId: hostExtensionActivationIdSchema,
|
|
15996
|
+
digest: hostExtensionDigestSchema
|
|
15997
|
+
};
|
|
15998
|
+
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
15999
|
+
var filePath = external_exports.string().min(1).max(4096).refine((path12) => /^(?:\/|[a-z]:[/\\])/iu.test(path12) && !path12.includes("\0") && !path12.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
|
|
16000
|
+
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");
|
|
16001
|
+
function base643(maxBytes) {
|
|
16002
|
+
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
16003
|
+
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
16004
|
+
return value.length % 4 === 0 && value.length * 3 / 4 - padding <= maxBytes && /^[A-Za-z0-9+/]*={0,2}$/u.test(value);
|
|
16005
|
+
}, "Expected bounded standard padded base64");
|
|
16006
|
+
}
|
|
16007
|
+
var hostExtensionGitHubSourceSchema = external_exports.strictObject({
|
|
16008
|
+
type: external_exports.literal("github"),
|
|
16009
|
+
repository: external_exports.string().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),
|
|
16010
|
+
ref: gitRef.optional(),
|
|
16011
|
+
tag: gitRef.optional(),
|
|
16012
|
+
asset: external_exports.string().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),
|
|
16013
|
+
subpath: hostExtensionResourcePathSchema.optional()
|
|
16014
|
+
}).refine(({ ref, tag, asset }) => !ref || !tag && !asset, "Use either a zipball ref or a release tag/asset");
|
|
16015
|
+
var hostExtensionInstallSourceSchema = external_exports.union([
|
|
16016
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
16017
|
+
hostExtensionGitHubSourceSchema,
|
|
16018
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), base64: base643(HOST_EXTENSION_ZIP_MAX_BYTES).min(4) }),
|
|
16019
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), localZipPath: filePath }),
|
|
16020
|
+
external_exports.strictObject({ type: external_exports.literal("localDir"), localDir: filePath })
|
|
15893
16021
|
]);
|
|
15894
|
-
var
|
|
15895
|
-
|
|
15896
|
-
|
|
15897
|
-
|
|
15898
|
-
|
|
15899
|
-
purpose: external_exports.literal("availability").optional()
|
|
15900
|
-
}).strict();
|
|
15901
|
-
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15902
|
-
harnessId: harnessIdSchema
|
|
15903
|
-
}).strict();
|
|
15904
|
-
var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
|
|
15905
|
-
var threadModelSelectParamsSchema = external_exports.object({
|
|
15906
|
-
threadId: hostThreadIdSchema,
|
|
15907
|
-
model: harnessModelRefSchema
|
|
15908
|
-
}).strict();
|
|
15909
|
-
var threadThinkingSelectParamsSchema = external_exports.object({
|
|
15910
|
-
threadId: hostThreadIdSchema,
|
|
15911
|
-
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
15912
|
-
}).strict();
|
|
15913
|
-
var threadInspectionParamsSchema = external_exports.object({
|
|
15914
|
-
threadId: hostThreadIdSchema,
|
|
15915
|
-
includeReferenceCapability: external_exports.boolean().optional()
|
|
15916
|
-
}).strict();
|
|
15917
|
-
var codexThreadInspectionSchema = external_exports.object({
|
|
15918
|
-
owner: external_exports.literal("codex"),
|
|
15919
|
-
locked: external_exports.boolean(),
|
|
15920
|
-
effectiveModel: harnessModelRefSchema.optional(),
|
|
15921
|
-
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15922
|
-
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15923
|
-
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15924
|
-
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
15925
|
-
supportsThreadReferences: external_exports.literal(true).optional()
|
|
15926
|
-
}).strict();
|
|
15927
|
-
var externalThreadInspectionSchema = external_exports.object({
|
|
15928
|
-
owner: external_exports.literal("external"),
|
|
15929
|
-
harnessId: nonBlankTextSchema2.max(256),
|
|
15930
|
-
transportModelId: nonBlankTextSchema2.max(1024),
|
|
15931
|
-
effectiveModel: harnessModelRefSchema.optional(),
|
|
15932
|
-
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15933
|
-
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15934
|
-
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15935
|
-
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15936
|
-
history: harnessHistoryCapabilitiesSchema,
|
|
15937
|
-
usage: threadUsageSnapshotSchema.optional(),
|
|
15938
|
-
locked: external_exports.literal(true)
|
|
15939
|
-
}).strict();
|
|
15940
|
-
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
15941
|
-
codexThreadInspectionSchema,
|
|
15942
|
-
externalThreadInspectionSchema
|
|
16022
|
+
var hostExtensionProvenanceSchema = external_exports.discriminatedUnion("type", [
|
|
16023
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
16024
|
+
hostExtensionGitHubSourceSchema,
|
|
16025
|
+
external_exports.strictObject({ type: external_exports.literal("zip") }),
|
|
16026
|
+
external_exports.strictObject({ type: external_exports.literal("localDir") })
|
|
15943
16027
|
]);
|
|
15944
|
-
var
|
|
15945
|
-
|
|
15946
|
-
|
|
15947
|
-
|
|
15948
|
-
|
|
15949
|
-
if (seen.has(threadId)) {
|
|
15950
|
-
context.addIssue({
|
|
15951
|
-
code: "custom",
|
|
15952
|
-
message: "Thread ownership-list IDs must be unique",
|
|
15953
|
-
path: ["threadIds", index]
|
|
15954
|
-
});
|
|
15955
|
-
}
|
|
15956
|
-
seen.add(threadId);
|
|
15957
|
-
}
|
|
16028
|
+
var hostExtensionInstallationSchema = external_exports.strictObject({
|
|
16029
|
+
...active,
|
|
16030
|
+
manifest: hostExtensionManifestV2Schema,
|
|
16031
|
+
installedAt: external_exports.iso.datetime(),
|
|
16032
|
+
source: hostExtensionProvenanceSchema.optional()
|
|
15958
16033
|
});
|
|
15959
|
-
var
|
|
15960
|
-
|
|
15961
|
-
|
|
15962
|
-
|
|
15963
|
-
|
|
15964
|
-
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
16034
|
+
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);
|
|
16035
|
+
var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
|
|
16036
|
+
var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
|
|
16037
|
+
var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
|
|
16038
|
+
hostExtensionInstallationSchema.extend({
|
|
16039
|
+
state: external_exports.literal("valid"),
|
|
16040
|
+
enabled: external_exports.boolean(),
|
|
16041
|
+
...desktopConflict,
|
|
16042
|
+
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
16043
|
+
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
16044
|
+
backendState: backendState.optional(),
|
|
16045
|
+
backendError: external_exports.string().optional()
|
|
16046
|
+
}),
|
|
16047
|
+
external_exports.strictObject({
|
|
16048
|
+
state: external_exports.enum(["invalid", "incompatible"]),
|
|
16049
|
+
id: external_exports.string().min(1),
|
|
16050
|
+
enabled: external_exports.boolean(),
|
|
16051
|
+
error: external_exports.string()
|
|
16052
|
+
})
|
|
15971
16053
|
]);
|
|
15972
|
-
var
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
|
|
15976
|
-
|
|
15977
|
-
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15983
|
-
|
|
15984
|
-
|
|
15985
|
-
|
|
16054
|
+
var hostExtensionsListResultSchema = external_exports.strictObject({
|
|
16055
|
+
revision: hostExtensionRevisionSchema,
|
|
16056
|
+
configuration: hostExtensionConfigurationSchema,
|
|
16057
|
+
diagnostics: external_exports.array(external_exports.string()),
|
|
16058
|
+
extensions: external_exports.array(hostExtensionListItemSchema)
|
|
16059
|
+
});
|
|
16060
|
+
var hostExtensionRuntimeEntrySchema = hostExtensionInstallationSchema.extend({
|
|
16061
|
+
...desktopConflict,
|
|
16062
|
+
settingsRevision: hostExtensionRevisionSchema
|
|
16063
|
+
});
|
|
16064
|
+
var hostExtensionsSnapshotResultSchema = external_exports.strictObject({
|
|
16065
|
+
/** The Host publishes this revision in extensions-changed, independent of enabled.json's revision. */
|
|
16066
|
+
revision: hostExtensionRevisionSchema,
|
|
16067
|
+
// Enabled, valid activations only. A Desktop conflict does not hide other capabilities.
|
|
16068
|
+
extensions: external_exports.array(hostExtensionRuntimeEntrySchema).max(DESKTOP_EXTENSION_LIMIT)
|
|
16069
|
+
});
|
|
16070
|
+
var HOST_EXTENSIONS_RPC = {
|
|
16071
|
+
list: "codexhost/extensions/list",
|
|
16072
|
+
snapshot: "codexhost/extensions/snapshot",
|
|
16073
|
+
catalog: "codexhost/extensions/catalog",
|
|
16074
|
+
install: "codexhost/extensions/install",
|
|
16075
|
+
update: "codexhost/extensions/update",
|
|
16076
|
+
enable: "codexhost/extensions/enable",
|
|
16077
|
+
disable: "codexhost/extensions/disable",
|
|
16078
|
+
uninstall: "codexhost/extensions/uninstall",
|
|
16079
|
+
recover: "codexhost/extensions/recover",
|
|
16080
|
+
asset: "codexhost/extensions/asset",
|
|
16081
|
+
settingsGet: "codexhost/extensions/settings/get",
|
|
16082
|
+
settingsSet: "codexhost/extensions/settings/set",
|
|
16083
|
+
backendInvoke: "codexhost/extensions/backend/invoke"
|
|
16084
|
+
};
|
|
16085
|
+
var HOST_EXTENSION_MANAGEMENT_METHODS = Object.freeze(Object.values(HOST_EXTENSIONS_RPC));
|
|
16086
|
+
var methods = new Set(HOST_EXTENSION_MANAGEMENT_METHODS);
|
|
16087
|
+
var noParams = external_exports.strictObject({});
|
|
16088
|
+
var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
|
|
16089
|
+
var selection = external_exports.strictObject({ ...id, ...expectedRevision });
|
|
16090
|
+
var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
|
|
16091
|
+
var mutationResult = external_exports.discriminatedUnion("state", [
|
|
16092
|
+
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
|
|
16093
|
+
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
|
|
16094
|
+
]);
|
|
16095
|
+
var hostExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
16096
|
+
...optionalActivation,
|
|
16097
|
+
digest: active.digest.optional(),
|
|
16098
|
+
path: hostExtensionResourcePathSchema
|
|
16099
|
+
});
|
|
16100
|
+
var hostExtensionsAssetResultSchema = external_exports.strictObject({
|
|
16101
|
+
mimeType: external_exports.string().min(1),
|
|
16102
|
+
base64: base643(DESKTOP_EXTENSION_ASSET_MAX_BYTES),
|
|
16103
|
+
digest: active.digest
|
|
16104
|
+
});
|
|
16105
|
+
var hostExtensionSettingsSchema = external_exports.strictObject({
|
|
16106
|
+
settingsRevision: hostExtensionRevisionSchema,
|
|
16107
|
+
values: jsonObjectSchema
|
|
15986
16108
|
});
|
|
15987
|
-
var
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
|
|
15993
|
-
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
16002
|
-
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
}
|
|
16007
|
-
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
|
|
16109
|
+
var hostExtensionsRpcSchemas = {
|
|
16110
|
+
[HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
|
|
16111
|
+
[HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
|
|
16112
|
+
[HOST_EXTENSIONS_RPC.catalog]: {
|
|
16113
|
+
params: external_exports.strictObject({ forceRefresh: external_exports.boolean().optional() }),
|
|
16114
|
+
result: hostExtensionsCatalogResultSchema
|
|
16115
|
+
},
|
|
16116
|
+
[HOST_EXTENSIONS_RPC.install]: {
|
|
16117
|
+
params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
|
|
16118
|
+
result: installationResult
|
|
16119
|
+
},
|
|
16120
|
+
[HOST_EXTENSIONS_RPC.update]: {
|
|
16121
|
+
params: external_exports.strictObject({
|
|
16122
|
+
...id,
|
|
16123
|
+
expectedDigest: active.digest,
|
|
16124
|
+
expectedActivationId: active.activationId.optional(),
|
|
16125
|
+
source: hostExtensionInstallSourceSchema.optional()
|
|
16126
|
+
}),
|
|
16127
|
+
result: installationResult
|
|
16128
|
+
},
|
|
16129
|
+
[HOST_EXTENSIONS_RPC.enable]: { params: selection, result: mutationResult },
|
|
16130
|
+
[HOST_EXTENSIONS_RPC.disable]: { params: selection, result: mutationResult },
|
|
16131
|
+
[HOST_EXTENSIONS_RPC.uninstall]: {
|
|
16132
|
+
params: external_exports.strictObject({
|
|
16133
|
+
...id,
|
|
16134
|
+
removeData: external_exports.boolean().optional(),
|
|
16135
|
+
expectedDigest: active.digest.optional()
|
|
16136
|
+
}),
|
|
16137
|
+
result: external_exports.strictObject({ ...id, removed: external_exports.boolean() })
|
|
16138
|
+
},
|
|
16139
|
+
[HOST_EXTENSIONS_RPC.recover]: {
|
|
16140
|
+
params: external_exports.strictObject({ expectedRevision: expectedRevision.expectedRevision.optional() }),
|
|
16141
|
+
result: mutationResult
|
|
16142
|
+
},
|
|
16143
|
+
[HOST_EXTENSIONS_RPC.asset]: {
|
|
16144
|
+
params: hostExtensionsAssetParamsSchema,
|
|
16145
|
+
result: hostExtensionsAssetResultSchema
|
|
16146
|
+
},
|
|
16147
|
+
[HOST_EXTENSIONS_RPC.settingsGet]: {
|
|
16148
|
+
params: external_exports.strictObject(optionalActivation),
|
|
16149
|
+
result: hostExtensionSettingsSchema
|
|
16150
|
+
},
|
|
16151
|
+
[HOST_EXTENSIONS_RPC.settingsSet]: {
|
|
16152
|
+
params: external_exports.strictObject({
|
|
16153
|
+
...optionalActivation,
|
|
16154
|
+
expectedSettingsRevision: hostExtensionRevisionSchema,
|
|
16155
|
+
values: jsonObjectSchema
|
|
16156
|
+
}),
|
|
16157
|
+
result: hostExtensionSettingsSchema
|
|
16158
|
+
},
|
|
16159
|
+
[HOST_EXTENSIONS_RPC.backendInvoke]: {
|
|
16160
|
+
params: external_exports.strictObject({
|
|
16161
|
+
...optionalActivation,
|
|
16162
|
+
method: hostExtensionBackendMethodSchema,
|
|
16163
|
+
params: jsonValueSchema.optional()
|
|
16164
|
+
}),
|
|
16165
|
+
result: external_exports.strictObject({ result: jsonValueSchema })
|
|
16166
|
+
}
|
|
16167
|
+
};
|
|
16011
16168
|
|
|
16012
16169
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
16013
16170
|
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
@@ -16070,7 +16227,7 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
16070
16227
|
"codexhost/harness/session-import/list",
|
|
16071
16228
|
"codexhost/harness/session-import/import",
|
|
16072
16229
|
// Host settings shared across Desktop and Web.
|
|
16073
|
-
...
|
|
16230
|
+
...HOST_EXTENSION_MANAGEMENT_METHODS,
|
|
16074
16231
|
"codexhost/harness/installation",
|
|
16075
16232
|
"codexhost/harness/installation/start",
|
|
16076
16233
|
"codexhost/harness/installation/status",
|
|
@@ -16131,6 +16288,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
16131
16288
|
cursor: clientChannelCursorSchema,
|
|
16132
16289
|
revision: external_exports.number().int().nonnegative()
|
|
16133
16290
|
}),
|
|
16291
|
+
external_exports.object({
|
|
16292
|
+
type: external_exports.literal("extensions-changed"),
|
|
16293
|
+
cursor: clientChannelCursorSchema,
|
|
16294
|
+
revision: hostExtensionRevisionSchema
|
|
16295
|
+
}),
|
|
16134
16296
|
external_exports.object({
|
|
16135
16297
|
type: external_exports.literal("hello"),
|
|
16136
16298
|
version: external_exports.literal(1),
|
|
@@ -16567,7 +16729,7 @@ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
|
|
|
16567
16729
|
|
|
16568
16730
|
// ../../shared-contracts/dist/harness-preferences.js
|
|
16569
16731
|
var harnessPreferenceScopeSchema = external_exports.string().regex(/^external$/u);
|
|
16570
|
-
var preferenceHarnessKey = harnessIdSchema.transform((
|
|
16732
|
+
var preferenceHarnessKey = harnessIdSchema.transform((id2) => String(id2));
|
|
16571
16733
|
var harnessDefaultConfigurationSchema = external_exports.strictObject({
|
|
16572
16734
|
model: harnessModelRefSchema.optional(),
|
|
16573
16735
|
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
@@ -16577,11 +16739,19 @@ var newThreadDefaultsSchema = external_exports.strictObject({
|
|
|
16577
16739
|
lastHarness: harnessIdSchema.optional(),
|
|
16578
16740
|
byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
|
|
16579
16741
|
});
|
|
16742
|
+
var harnessDelegationDefaultSchema = external_exports.strictObject({
|
|
16743
|
+
model: harnessModelRefSchema.optional(),
|
|
16744
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
16745
|
+
}).refine((value) => Boolean(value.model || value.thinkingOptionId), "A delegation default must contain a Model or Thinking option");
|
|
16746
|
+
var delegationDefaultsSchema = external_exports.strictObject({
|
|
16747
|
+
byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
|
|
16748
|
+
});
|
|
16580
16749
|
var modelId = external_exports.string().min(1).max(1024);
|
|
16581
16750
|
var harnessPreferenceValuesSchema = external_exports.strictObject({
|
|
16582
16751
|
idleRelease: idleReleaseSettingsSchema.optional(),
|
|
16583
16752
|
favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
|
|
16584
|
-
newThread: newThreadDefaultsSchema.optional()
|
|
16753
|
+
newThread: newThreadDefaultsSchema.optional(),
|
|
16754
|
+
delegation: delegationDefaultsSchema.optional()
|
|
16585
16755
|
});
|
|
16586
16756
|
var harnessPreferenceSnapshotSchema = external_exports.strictObject({
|
|
16587
16757
|
scope: harnessPreferenceScopeSchema,
|
|
@@ -16609,6 +16779,11 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
|
|
|
16609
16779
|
lastHarness: harnessIdSchema.optional(),
|
|
16610
16780
|
harnessId: harnessIdSchema.optional(),
|
|
16611
16781
|
configuration: harnessDefaultConfigurationSchema.optional()
|
|
16782
|
+
}),
|
|
16783
|
+
external_exports.strictObject({
|
|
16784
|
+
kind: external_exports.literal("delegation"),
|
|
16785
|
+
harnessId: harnessIdSchema,
|
|
16786
|
+
configuration: harnessDelegationDefaultSchema.nullable()
|
|
16612
16787
|
})
|
|
16613
16788
|
]);
|
|
16614
16789
|
var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
@@ -17432,9 +17607,12 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
17432
17607
|
...thread,
|
|
17433
17608
|
epoch: identity,
|
|
17434
17609
|
modelId: identity.optional(),
|
|
17610
|
+
serviceTier: harnessModelServiceTierSchema.optional(),
|
|
17435
17611
|
thinkingOptionId: identity.optional(),
|
|
17436
17612
|
permissionModeId: identity.optional()
|
|
17437
|
-
}).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
|
|
17613
|
+
}).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, {
|
|
17614
|
+
message: "A service tier requires a Model ID"
|
|
17615
|
+
}),
|
|
17438
17616
|
external_exports.strictObject({
|
|
17439
17617
|
kind: external_exports.literal("prompt"),
|
|
17440
17618
|
...thread,
|
|
@@ -17484,7 +17662,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
17484
17662
|
external_exports.strictObject({ action: external_exports.literal("catalog") }),
|
|
17485
17663
|
external_exports.strictObject({
|
|
17486
17664
|
action: external_exports.literal("read-thread"),
|
|
17487
|
-
hostId: hostId.refine((
|
|
17665
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
17488
17666
|
input: delegationReadParamsSchema
|
|
17489
17667
|
}),
|
|
17490
17668
|
external_exports.strictObject({
|
|
@@ -17498,7 +17676,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
17498
17676
|
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
17499
17677
|
external_exports.strictObject({
|
|
17500
17678
|
action: external_exports.literal("update"),
|
|
17501
|
-
hostId: hostId.refine((
|
|
17679
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
17502
17680
|
version: remoteUpdateParamsSchema.shape.version
|
|
17503
17681
|
})
|
|
17504
17682
|
]);
|
|
@@ -17562,7 +17740,7 @@ function invalidRequest(message) {
|
|
|
17562
17740
|
return { code: "invalidRequest", message, retryable: false };
|
|
17563
17741
|
}
|
|
17564
17742
|
function validateHostApprovalResponse(interaction, response) {
|
|
17565
|
-
return interaction.actions.some(({ id }) =>
|
|
17743
|
+
return interaction.actions.some(({ id: id2 }) => id2 === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
|
|
17566
17744
|
}
|
|
17567
17745
|
|
|
17568
17746
|
// ../../harness-adapter/dist/question.js
|
|
@@ -17570,7 +17748,7 @@ function invalidRequest2(message) {
|
|
|
17570
17748
|
return { code: "invalidRequest", message, retryable: false };
|
|
17571
17749
|
}
|
|
17572
17750
|
function validateHostQuestionResponse(interaction, response) {
|
|
17573
|
-
const questionIds = new Set(interaction.questions.map(({ id }) =>
|
|
17751
|
+
const questionIds = new Set(interaction.questions.map(({ id: id2 }) => id2));
|
|
17574
17752
|
if (response.cancelled) {
|
|
17575
17753
|
return Object.keys(response.answers).length === 0 ? null : invalidRequest2("Cancelled Question Response must not contain answers");
|
|
17576
17754
|
}
|
|
@@ -17618,6 +17796,18 @@ function validateHostInteractionResponse(interaction, response) {
|
|
|
17618
17796
|
return response.type === "approval" ? validateHostApprovalResponse(interaction, response) : invalidRequest3("Interaction Response type does not match the pending Interaction");
|
|
17619
17797
|
}
|
|
17620
17798
|
|
|
17799
|
+
// ../../harness-adapter/dist/legacy-model-ref.js
|
|
17800
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
17801
|
+
function normalizeLegacyBase64ModelRef(ref, catalog, prefix) {
|
|
17802
|
+
if (ref.serviceTier || !ref.id.startsWith(prefix))
|
|
17803
|
+
return void 0;
|
|
17804
|
+
const encoded = ref.id.slice(prefix.length);
|
|
17805
|
+
const id2 = Buffer2.from(encoded, "base64url").toString("utf8");
|
|
17806
|
+
if (Buffer2.from(id2).toString("base64url") !== encoded)
|
|
17807
|
+
return void 0;
|
|
17808
|
+
return catalog.models.find(({ ref: ref2 }) => ref2.id === id2 && !ref2.serviceTier)?.ref;
|
|
17809
|
+
}
|
|
17810
|
+
|
|
17621
17811
|
// ../../harness-adapter/dist/output-channel.js
|
|
17622
17812
|
var HarnessOutputChannel = class {
|
|
17623
17813
|
outputs;
|
|
@@ -17702,7 +17892,8 @@ var tokenFields = [
|
|
|
17702
17892
|
var safeIntegerFields = [
|
|
17703
17893
|
"planFiveHourResetsAtUnix",
|
|
17704
17894
|
"planSevenDayResetsAtUnix",
|
|
17705
|
-
"timeToFirstOutputMs"
|
|
17895
|
+
"timeToFirstOutputMs",
|
|
17896
|
+
"latestRequestTimeToFirstOutputMs"
|
|
17706
17897
|
];
|
|
17707
17898
|
var percentFields = [
|
|
17708
17899
|
"cacheHitRatePercent",
|
|
@@ -18383,17 +18574,14 @@ function capabilitiesForProfile(profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
|
18383
18574
|
};
|
|
18384
18575
|
}
|
|
18385
18576
|
function modelRef(modelId2) {
|
|
18386
|
-
return harnessModelRefSchema.parse({ id:
|
|
18577
|
+
return harnessModelRefSchema.parse({ id: modelId2 });
|
|
18387
18578
|
}
|
|
18388
|
-
function
|
|
18389
|
-
|
|
18390
|
-
if (!value || !ref.id.startsWith("cb.") || modelRef(value).id !== ref.id)
|
|
18391
|
-
throw new CodeBuddyError("invalidRequest", "Invalid native Model Ref");
|
|
18392
|
-
return value;
|
|
18579
|
+
function normalizeStoredCodeBuddyModelRef(ref, catalog) {
|
|
18580
|
+
return normalizeLegacyBase64ModelRef(ref, catalog, "cb.");
|
|
18393
18581
|
}
|
|
18394
18582
|
function configuration(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
18395
18583
|
const options = rows(value);
|
|
18396
|
-
const get = (
|
|
18584
|
+
const get = (id2) => options.find((option) => option.id === id2) ?? {};
|
|
18397
18585
|
const model2 = get("model"), mode = get("mode"), thought = get("thought_level");
|
|
18398
18586
|
const thinkingOptions = rows(thought.options).map((option) => harnessThinkingOptionSchema.parse({ id: option.value, label: option.name }));
|
|
18399
18587
|
const currentThinking = thinkingOptions.find((option) => option.id === thought.currentValue);
|
|
@@ -18437,10 +18625,34 @@ function configuration(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
|
18437
18625
|
};
|
|
18438
18626
|
return { catalog, permissionModes, state, options };
|
|
18439
18627
|
}
|
|
18440
|
-
function
|
|
18628
|
+
async function selectConfiguration(config2, id2, value, profile, request) {
|
|
18629
|
+
const option = config2?.options.find((option2) => option2.id === id2);
|
|
18630
|
+
const listed = rows(option?.options).some((option2) => option2.value === value);
|
|
18631
|
+
if (!listed && !(id2 === "model" && profile.allowUnlistedModelSelection))
|
|
18632
|
+
throw new CodeBuddyError("invalidRequest", `Unavailable ${profile.displayName} ${id2} selection`);
|
|
18633
|
+
return confirmedConfiguration(await request(id2, value), id2, value, profile);
|
|
18634
|
+
}
|
|
18635
|
+
async function restoreConfiguration(config2, saved, profile, request) {
|
|
18636
|
+
const selections = [
|
|
18637
|
+
["model", saved.effectiveModel?.id],
|
|
18638
|
+
["thought_level", saved.effectiveThinkingOptionId],
|
|
18639
|
+
["mode", saved.effectivePermissionModeId]
|
|
18640
|
+
];
|
|
18641
|
+
const matches = (id2, value) => config2.options.some((option) => option.id === id2 && option.currentValue === value);
|
|
18642
|
+
for (const [id2, value] of selections) {
|
|
18643
|
+
if (value && !matches(id2, value))
|
|
18644
|
+
config2 = await selectConfiguration(config2, id2, value, profile, request);
|
|
18645
|
+
}
|
|
18646
|
+
for (const [id2, value] of selections) {
|
|
18647
|
+
if (value && !matches(id2, value))
|
|
18648
|
+
throw new CodeBuddyError("protocolError", `ACP did not restore ${id2}`);
|
|
18649
|
+
}
|
|
18650
|
+
return config2;
|
|
18651
|
+
}
|
|
18652
|
+
function confirmedConfiguration(response, id2, value, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
18441
18653
|
const result = configuration(record3(response).configOptions, profile);
|
|
18442
|
-
if (result.options.find((option) => option.id ===
|
|
18443
|
-
throw new CodeBuddyError("protocolError", `ACP did not confirm ${
|
|
18654
|
+
if (result.options.find((option) => option.id === id2)?.currentValue !== value) {
|
|
18655
|
+
throw new CodeBuddyError("protocolError", `ACP did not confirm ${id2}`);
|
|
18444
18656
|
}
|
|
18445
18657
|
return result;
|
|
18446
18658
|
}
|
|
@@ -18996,8 +19208,8 @@ var CodeBuddyTurnOutput = class {
|
|
|
18996
19208
|
this.#textItems.set(type, item2);
|
|
18997
19209
|
this.#start(item2);
|
|
18998
19210
|
}
|
|
18999
|
-
const
|
|
19000
|
-
if (this.#finished.has(
|
|
19211
|
+
const id3 = item2.itemId;
|
|
19212
|
+
if (this.#finished.has(id3))
|
|
19001
19213
|
throw new CodeBuddyError("protocolError", "Text arrived after Item completion");
|
|
19002
19214
|
if (item2.text.length + delta.length > 2e6)
|
|
19003
19215
|
throw new CodeBuddyError("protocolError", "Agent output exceeded the supported Item size");
|
|
@@ -19005,7 +19217,7 @@ var CodeBuddyTurnOutput = class {
|
|
|
19005
19217
|
this.emit({
|
|
19006
19218
|
type: "item.updated",
|
|
19007
19219
|
turnId: this.turnId,
|
|
19008
|
-
itemId:
|
|
19220
|
+
itemId: id3,
|
|
19009
19221
|
update: { type: "text.append", text: delta }
|
|
19010
19222
|
});
|
|
19011
19223
|
return;
|
|
@@ -19026,8 +19238,8 @@ var CodeBuddyTurnOutput = class {
|
|
|
19026
19238
|
if (!terminal && !record3(merged._meta)["codebuddy.ai/toolArgumentsComplete"])
|
|
19027
19239
|
return;
|
|
19028
19240
|
const name = text(record3(merged._meta)["codebuddy.ai/toolName"]) || text(merged.title) || `${this.profile.displayName} tool`;
|
|
19029
|
-
const
|
|
19030
|
-
let item = this.#items.get(
|
|
19241
|
+
const id2 = `tool-${callId}`;
|
|
19242
|
+
let item = this.#items.get(id2)?.item;
|
|
19031
19243
|
if (!item) {
|
|
19032
19244
|
this.completeMessage();
|
|
19033
19245
|
item = toolItem(callId, name, merged.rawInput, this.cwd);
|
|
@@ -19101,13 +19313,13 @@ var CodeBuddyTurnOutput = class {
|
|
|
19101
19313
|
};
|
|
19102
19314
|
|
|
19103
19315
|
// dist/subagent-tool.js
|
|
19104
|
-
var validCodeBuddyChildId = (
|
|
19316
|
+
var validCodeBuddyChildId = (id2) => /^agent-[a-zA-Z0-9_-]{1,100}$/u.test(id2);
|
|
19105
19317
|
function codeBuddyChildId(value) {
|
|
19106
19318
|
const row = record3(value);
|
|
19107
19319
|
const structured = text(record3(record3(record3(row.providerData).toolResult).subAgent).sessionId);
|
|
19108
19320
|
const body = contentText(row.rawOutput ?? row.output);
|
|
19109
|
-
const
|
|
19110
|
-
return
|
|
19321
|
+
const id2 = structured || /\[Agent ID: (agent-[a-zA-Z0-9_-]+)\]\s*$/u.exec(body)?.[1];
|
|
19322
|
+
return id2 && validCodeBuddyChildId(id2) ? id2 : void 0;
|
|
19111
19323
|
}
|
|
19112
19324
|
function codeBuddyDelegation(callId, input, status, childId, displayName = "CodeBuddy") {
|
|
19113
19325
|
const args = record3(input);
|
|
@@ -19285,10 +19497,10 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
|
|
|
19285
19497
|
const checkedDirectories = /* @__PURE__ */ new Set();
|
|
19286
19498
|
const inheritedRows = /* @__PURE__ */ new Map();
|
|
19287
19499
|
for (const row of transaction?.inheritedContents ? parseRows(transaction.inheritedContents) : []) {
|
|
19288
|
-
const
|
|
19289
|
-
const candidates2 = inheritedRows.get(
|
|
19500
|
+
const id2 = text(row.id);
|
|
19501
|
+
const candidates2 = inheritedRows.get(id2) ?? [];
|
|
19290
19502
|
candidates2.push(row);
|
|
19291
|
-
inheritedRows.set(
|
|
19503
|
+
inheritedRows.set(id2, candidates2);
|
|
19292
19504
|
}
|
|
19293
19505
|
const inherited = (row) => inheritedRows.get(text(row.id))?.some((candidate) => isDeepStrictEqual(candidate, row)) === true;
|
|
19294
19506
|
if (transaction) {
|
|
@@ -19310,15 +19522,15 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
|
|
|
19310
19522
|
} else if (provenance) {
|
|
19311
19523
|
if (!await sameCwd(provenance.boundCwd, cwd) || provenance.targetProjectSlug !== slug || path6.resolve(file2) !== path6.resolve(primary))
|
|
19312
19524
|
throw new CodeBuddyError("invalidRequest", "Derived Native Session target binding changed");
|
|
19313
|
-
const
|
|
19314
|
-
if (provenance.inheritedPrefixRows >
|
|
19525
|
+
const active2 = nativeHistoryRows(parsed.contents);
|
|
19526
|
+
if (provenance.inheritedPrefixRows > active2.length || nativeRowsDigest(active2.slice(0, provenance.inheritedPrefixRows)) !== provenance.inheritedPrefixSha256)
|
|
19315
19527
|
throw new CodeBuddyError("protocolError", "Derived Native Session prefix verification failed");
|
|
19316
19528
|
const marker = parsed.rows.find((row) => text(row.id) === provenance.bindingMarkerId);
|
|
19317
19529
|
if (!marker || marker.sessionId !== ref.nativeSessionId || typeof marker.cwd !== "string" || !await sameCwd(marker.cwd, cwd))
|
|
19318
19530
|
throw new CodeBuddyError("protocolError", "Derived Native Session target marker is missing");
|
|
19319
19531
|
checkedDirectories.add(cwd);
|
|
19320
19532
|
const verifiedSuffixCwds = /* @__PURE__ */ new Set();
|
|
19321
|
-
for (const row of
|
|
19533
|
+
for (const row of active2.slice(provenance.inheritedPrefixRows)) {
|
|
19322
19534
|
if (row.sessionId && row.sessionId !== ref.nativeSessionId)
|
|
19323
19535
|
throw new CodeBuddyError("protocolError", "Derived Native Session appended foreign history");
|
|
19324
19536
|
if (typeof row.cwd === "string" && !verifiedSuffixCwds.has(row.cwd)) {
|
|
@@ -19735,14 +19947,14 @@ async function readCodeBuddyUsage(file2, signal) {
|
|
|
19735
19947
|
sessionId ??= row.sessionId;
|
|
19736
19948
|
cwd ??= row.cwd;
|
|
19737
19949
|
const data = record4(row.providerData);
|
|
19738
|
-
const
|
|
19739
|
-
if (!
|
|
19950
|
+
const id2 = typeof data.messageId === "string" ? data.messageId : "";
|
|
19951
|
+
if (!id2 || Object.keys(record4(data.rawUsage)).length === 0)
|
|
19740
19952
|
continue;
|
|
19741
|
-
messages.set(
|
|
19953
|
+
messages.set(id2, { data, at: messages.get(id2)?.at ?? nativeTimeMs(row.timestamp) });
|
|
19742
19954
|
}
|
|
19743
19955
|
const entries = [];
|
|
19744
|
-
for (const [
|
|
19745
|
-
const request = providerUsageRequest(
|
|
19956
|
+
for (const [id2, { data, at }] of messages) {
|
|
19957
|
+
const request = providerUsageRequest(id2, data, false);
|
|
19746
19958
|
const entry = request && at !== null && usageEntryFromRequest(request, at);
|
|
19747
19959
|
if (entry) {
|
|
19748
19960
|
const credits = record4(data.rawUsage).credit;
|
|
@@ -19762,7 +19974,7 @@ function createCodeBuddyUsageStatistics(environment, profile) {
|
|
|
19762
19974
|
return Object.freeze({
|
|
19763
19975
|
// projects/<project>/<session>.jsonl and <session>/subagents/*.jsonl
|
|
19764
19976
|
listSources: (signal) => jsonlUsageSources(path7.join(codeBuddyConfigRoot(environment, profile), "projects"), 3, signal),
|
|
19765
|
-
readSource: (
|
|
19977
|
+
readSource: (id2, signal) => readCodeBuddyUsage(id2, signal)
|
|
19766
19978
|
});
|
|
19767
19979
|
}
|
|
19768
19980
|
|
|
@@ -21625,8 +21837,8 @@ var RequestResponder = class {
|
|
|
21625
21837
|
signal;
|
|
21626
21838
|
finishRequest;
|
|
21627
21839
|
didRespond = false;
|
|
21628
|
-
constructor(
|
|
21629
|
-
this.id =
|
|
21840
|
+
constructor(id2, sendResult, signal = new AbortController().signal, finishRequest) {
|
|
21841
|
+
this.id = id2;
|
|
21630
21842
|
this.sendResult = sendResult;
|
|
21631
21843
|
this.signal = signal;
|
|
21632
21844
|
this.finishRequest = finishRequest;
|
|
@@ -21917,7 +22129,7 @@ var Connection = class {
|
|
|
21917
22129
|
return this.sendWireMessage({ jsonrpc: "2.0", method, params });
|
|
21918
22130
|
}
|
|
21919
22131
|
prepareRequest(method, params, mapResponse, options = {}) {
|
|
21920
|
-
const
|
|
22132
|
+
const id2 = this.nextRequestId++;
|
|
21921
22133
|
let cancel = () => {
|
|
21922
22134
|
};
|
|
21923
22135
|
const response = new Promise((resolve, reject) => {
|
|
@@ -21937,7 +22149,7 @@ var Connection = class {
|
|
|
21937
22149
|
}
|
|
21938
22150
|
pendingResponse.cancellationSent = true;
|
|
21939
22151
|
pendingResponse.cleanup?.();
|
|
21940
|
-
void this.sendCancelRequest(
|
|
22152
|
+
void this.sendCancelRequest(id2).catch(() => {
|
|
21941
22153
|
});
|
|
21942
22154
|
};
|
|
21943
22155
|
options.cancellationSignal?.addEventListener("abort", cancel, {
|
|
@@ -21946,12 +22158,12 @@ var Connection = class {
|
|
|
21946
22158
|
pendingResponse.cleanup = () => {
|
|
21947
22159
|
options.cancellationSignal?.removeEventListener("abort", cancel);
|
|
21948
22160
|
};
|
|
21949
|
-
this.pendingResponses.set(
|
|
22161
|
+
this.pendingResponses.set(id2, pendingResponse);
|
|
21950
22162
|
});
|
|
21951
22163
|
response.catch(() => {
|
|
21952
22164
|
});
|
|
21953
22165
|
return {
|
|
21954
|
-
message: { jsonrpc: "2.0", id, method, params },
|
|
22166
|
+
message: { jsonrpc: "2.0", id: id2, method, params },
|
|
21955
22167
|
response,
|
|
21956
22168
|
cancel: () => cancel()
|
|
21957
22169
|
};
|
|
@@ -22588,7 +22800,7 @@ function memoryStreamPair() {
|
|
|
22588
22800
|
}
|
|
22589
22801
|
];
|
|
22590
22802
|
}
|
|
22591
|
-
var
|
|
22803
|
+
var methods2 = {
|
|
22592
22804
|
agent: {
|
|
22593
22805
|
initialize: AGENT_METHODS.initialize,
|
|
22594
22806
|
authenticate: AGENT_METHODS.authenticate,
|
|
@@ -24630,12 +24842,12 @@ function referencedChildren(rows2) {
|
|
|
24630
24842
|
function assertChildRanges(rows2, child) {
|
|
24631
24843
|
const positions = /* @__PURE__ */ new Map();
|
|
24632
24844
|
for (const [index, row] of rows2.entries()) {
|
|
24633
|
-
const
|
|
24634
|
-
if (!
|
|
24845
|
+
const id2 = text(row.id);
|
|
24846
|
+
if (!id2)
|
|
24635
24847
|
continue;
|
|
24636
|
-
const matches = positions.get(
|
|
24848
|
+
const matches = positions.get(id2) ?? [];
|
|
24637
24849
|
matches.push(index);
|
|
24638
|
-
positions.set(
|
|
24850
|
+
positions.set(id2, matches);
|
|
24639
24851
|
}
|
|
24640
24852
|
let previous = -1;
|
|
24641
24853
|
for (const range of child.ranges) {
|
|
@@ -25173,13 +25385,13 @@ var CodeBuddySessionImport = class {
|
|
|
25173
25385
|
}
|
|
25174
25386
|
listCandidates() {
|
|
25175
25387
|
return this.#scope.read(async (signal) => {
|
|
25176
|
-
const
|
|
25388
|
+
const active2 = await this.#activeSessions(signal);
|
|
25177
25389
|
const candidates = [];
|
|
25178
25390
|
for (const [nativeSessionId, files] of await this.#sessionFiles(signal)) {
|
|
25179
25391
|
if (files.length !== 1 || !files[0])
|
|
25180
25392
|
continue;
|
|
25181
25393
|
try {
|
|
25182
|
-
const source = await this.#source(nativeSessionId, files[0],
|
|
25394
|
+
const source = await this.#source(nativeSessionId, files[0], active2, signal);
|
|
25183
25395
|
if (source)
|
|
25184
25396
|
candidates.push(source.candidate);
|
|
25185
25397
|
} catch (error51) {
|
|
@@ -25206,7 +25418,7 @@ var CodeBuddySessionImport = class {
|
|
|
25206
25418
|
}
|
|
25207
25419
|
/** IDs a live native process registered in `<config>/sessions/<pid>.json`. */
|
|
25208
25420
|
async #activeSessions(signal) {
|
|
25209
|
-
const
|
|
25421
|
+
const active2 = /* @__PURE__ */ new Set();
|
|
25210
25422
|
const directory = path9.join(this.#root(), "sessions");
|
|
25211
25423
|
const markers = await opendir2(directory).catch((error51) => {
|
|
25212
25424
|
if (isMissingFileError(error51) || record3(error51).code === "ENOTDIR")
|
|
@@ -25214,7 +25426,7 @@ var CodeBuddySessionImport = class {
|
|
|
25214
25426
|
throw error51;
|
|
25215
25427
|
});
|
|
25216
25428
|
if (!markers)
|
|
25217
|
-
return
|
|
25429
|
+
return active2;
|
|
25218
25430
|
for await (const marker of markers) {
|
|
25219
25431
|
signal.throwIfAborted();
|
|
25220
25432
|
if (!marker.isFile() || !marker.name.endsWith(".json"))
|
|
@@ -25225,14 +25437,14 @@ var CodeBuddySessionImport = class {
|
|
|
25225
25437
|
continue;
|
|
25226
25438
|
const entry = record3(JSON.parse(await readFile4(file2, { encoding: "utf8", signal })));
|
|
25227
25439
|
if (typeof entry.sessionId === "string" && processAlive(entry.pid))
|
|
25228
|
-
|
|
25440
|
+
active2.add(entry.sessionId);
|
|
25229
25441
|
} catch (error51) {
|
|
25230
25442
|
signal.throwIfAborted();
|
|
25231
25443
|
if (isStorageAccessError(error51))
|
|
25232
25444
|
throw error51;
|
|
25233
25445
|
}
|
|
25234
25446
|
}
|
|
25235
|
-
return
|
|
25447
|
+
return active2;
|
|
25236
25448
|
}
|
|
25237
25449
|
/** Session ID to every project file claiming it. Enumerated links are not followed. */
|
|
25238
25450
|
async #sessionFiles(signal) {
|
|
@@ -25267,7 +25479,7 @@ var CodeBuddySessionImport = class {
|
|
|
25267
25479
|
}
|
|
25268
25480
|
return found;
|
|
25269
25481
|
}
|
|
25270
|
-
async #source(nativeSessionId, file2,
|
|
25482
|
+
async #source(nativeSessionId, file2, active2, signal) {
|
|
25271
25483
|
signal.throwIfAborted();
|
|
25272
25484
|
return readStableFiles([file2], async ([info]) => {
|
|
25273
25485
|
if (!info?.isFile() || info.size === 0 || info.size > MAX_HISTORY_BYTES)
|
|
@@ -25294,7 +25506,7 @@ var CodeBuddySessionImport = class {
|
|
|
25294
25506
|
title: facts.title,
|
|
25295
25507
|
updatedAt: facts.updatedAt ?? info.mtimeMs,
|
|
25296
25508
|
// A registered live process holds the Session. Absence is not proof of idleness.
|
|
25297
|
-
running:
|
|
25509
|
+
running: active2.has(nativeSessionId) ? true : null
|
|
25298
25510
|
});
|
|
25299
25511
|
return candidate ? { candidate, nativeRef } : null;
|
|
25300
25512
|
} catch (error51) {
|
|
@@ -25564,10 +25776,10 @@ var CodeBuddyChildObserver = class {
|
|
|
25564
25776
|
throw new CodeBuddyError("unsupported", "Too many native Subagent transcripts");
|
|
25565
25777
|
const matches = [];
|
|
25566
25778
|
for (const file2 of files) {
|
|
25567
|
-
const
|
|
25779
|
+
const id2 = file2.name.slice(0, -6), data = await this.#child(directory, id2);
|
|
25568
25780
|
const first = data.entries.find((row) => row.type === "message" && row.role === "user");
|
|
25569
25781
|
if (record3(first?.providerData).conversationRequestId === requestId)
|
|
25570
|
-
matches.push(
|
|
25782
|
+
matches.push(id2);
|
|
25571
25783
|
}
|
|
25572
25784
|
if (matches.length > 1)
|
|
25573
25785
|
throw new CodeBuddyError("protocolError", "Ambiguous native Subagent correlation");
|
|
@@ -25638,8 +25850,8 @@ var CodeBuddySubagents = class {
|
|
|
25638
25850
|
hasItem(itemId) {
|
|
25639
25851
|
return [...this.#calls.values()].some((call) => call.turnId === this.#turnId && call.item.itemId === itemId);
|
|
25640
25852
|
}
|
|
25641
|
-
state(
|
|
25642
|
-
return [...this.#calls.values()].map((call) => call.item.subagents[0]).findLast((child) => child?.nativeSubagentId ===
|
|
25853
|
+
state(id2) {
|
|
25854
|
+
return [...this.#calls.values()].map((call) => call.item.subagents[0]).findLast((child) => child?.nativeSubagentId === id2);
|
|
25643
25855
|
}
|
|
25644
25856
|
project(snapshot) {
|
|
25645
25857
|
for (const turn of snapshot.turns)
|
|
@@ -25713,9 +25925,9 @@ var CodeBuddySubagents = class {
|
|
|
25713
25925
|
}
|
|
25714
25926
|
});
|
|
25715
25927
|
}
|
|
25716
|
-
const
|
|
25717
|
-
if (
|
|
25718
|
-
this.options.emit({ type: "subagent.transcript.changed", nativeSubagentId:
|
|
25928
|
+
const id2 = call.item.subagents[0]?.nativeSubagentId;
|
|
25929
|
+
if (id2)
|
|
25930
|
+
this.options.emit({ type: "subagent.transcript.changed", nativeSubagentId: id2 });
|
|
25719
25931
|
}
|
|
25720
25932
|
return true;
|
|
25721
25933
|
}
|
|
@@ -25764,25 +25976,25 @@ var CodeBuddySubagents = class {
|
|
|
25764
25976
|
if (call.observationDone)
|
|
25765
25977
|
continue;
|
|
25766
25978
|
try {
|
|
25767
|
-
const
|
|
25768
|
-
if (!
|
|
25979
|
+
const id2 = call.item.subagents[0]?.nativeSubagentId ?? (call.requestId ? await (this.options.locate ? this.options.locate(parent, this.options.cwd, this.options.environment, call.requestId, this.profile) : this.#observer.locate(call.requestId)) : void 0);
|
|
25980
|
+
if (!id2 || this.#closed || call.observationDone)
|
|
25769
25981
|
continue;
|
|
25770
25982
|
if (!call.item.subagents[0]?.nativeSubagentId)
|
|
25771
|
-
this.#update(call, { nativeSubagentId:
|
|
25772
|
-
const snapshot = await (this.options.read ? this.options.read(parent,
|
|
25983
|
+
this.#update(call, { nativeSubagentId: id2, subagentId: id2 });
|
|
25984
|
+
const snapshot = await (this.options.read ? this.options.read(parent, id2, this.options.cwd, this.options.environment, "running", this.profile) : this.#observer.read(id2, "running"));
|
|
25773
25985
|
if (this.#closed || call.observationDone)
|
|
25774
25986
|
continue;
|
|
25775
25987
|
const observedModel = snapshot.turns.at(-1)?.model ?? snapshot.state?.effectiveModel;
|
|
25776
25988
|
const reasoningEffort = snapshot.state?.effectiveThinkingOptionId;
|
|
25777
25989
|
if (observedModel || reasoningEffort)
|
|
25778
25990
|
this.#update(call, {
|
|
25779
|
-
...observedModel ? { model:
|
|
25991
|
+
...observedModel ? { model: observedModel.id } : {},
|
|
25780
25992
|
...reasoningEffort ? { reasoningEffort } : {}
|
|
25781
25993
|
});
|
|
25782
25994
|
const signature = JSON.stringify(snapshot);
|
|
25783
25995
|
if (signature !== call.signature) {
|
|
25784
25996
|
call.signature = signature;
|
|
25785
|
-
this.options.emit({ type: "subagent.transcript.changed", nativeSubagentId:
|
|
25997
|
+
this.options.emit({ type: "subagent.transcript.changed", nativeSubagentId: id2 });
|
|
25786
25998
|
}
|
|
25787
25999
|
} catch {
|
|
25788
26000
|
}
|
|
@@ -25842,7 +26054,8 @@ var CodeBuddySession = class {
|
|
|
25842
26054
|
subagents;
|
|
25843
26055
|
#client;
|
|
25844
26056
|
#generation = 0;
|
|
25845
|
-
#
|
|
26057
|
+
#needsResume = false;
|
|
26058
|
+
#replay;
|
|
25846
26059
|
#interactions;
|
|
25847
26060
|
#config;
|
|
25848
26061
|
#ref;
|
|
@@ -25894,22 +26107,31 @@ var CodeBuddySession = class {
|
|
|
25894
26107
|
ephemeral: false,
|
|
25895
26108
|
handlers: {
|
|
25896
26109
|
fault: (error51) => {
|
|
25897
|
-
if (generation
|
|
26110
|
+
if (generation !== this.#generation || this.#closed)
|
|
26111
|
+
return;
|
|
26112
|
+
if (this.#replay)
|
|
26113
|
+
this.#replay.fault ??= { error: error51 };
|
|
26114
|
+
else
|
|
25898
26115
|
this.#onFault(error51);
|
|
25899
26116
|
},
|
|
25900
26117
|
update: (notification) => {
|
|
25901
|
-
if (generation !== this.#generation || this.#closed)
|
|
26118
|
+
if (generation !== this.#generation || this.#closed || this.#fault)
|
|
25902
26119
|
return;
|
|
25903
26120
|
if (this.#ref && notification.sessionId !== this.#ref.nativeSessionId)
|
|
25904
26121
|
return;
|
|
25905
26122
|
try {
|
|
25906
26123
|
const update = record3(notification.update);
|
|
25907
26124
|
if (nativeCommandsEnabled(this.profile) && update.sessionUpdate === "available_commands_update") {
|
|
25908
|
-
if (!this.profile.staticCommandCatalog)
|
|
25909
|
-
|
|
26125
|
+
if (!this.profile.staticCommandCatalog) {
|
|
26126
|
+
const commands = commandCatalog(update.availableCommands, this.profile);
|
|
26127
|
+
if (this.#replay)
|
|
26128
|
+
this.#replay.commands = commands;
|
|
26129
|
+
else
|
|
26130
|
+
this.#commands = commands;
|
|
26131
|
+
}
|
|
25910
26132
|
return;
|
|
25911
26133
|
}
|
|
25912
|
-
if (this.#
|
|
26134
|
+
if (this.#replay)
|
|
25913
26135
|
return;
|
|
25914
26136
|
if ((text(record3(update._meta)["codebuddy.ai/parentToolCallId"]) || !this.#active?.output.hasItem(`tool-${text(update.toolCallId)}`)) && this.subagents.update(update))
|
|
25915
26137
|
return;
|
|
@@ -25926,19 +26148,31 @@ var CodeBuddySession = class {
|
|
|
25926
26148
|
}
|
|
25927
26149
|
this.#active?.output.update(update);
|
|
25928
26150
|
} catch (error51) {
|
|
25929
|
-
this.#
|
|
26151
|
+
if (this.#replay)
|
|
26152
|
+
this.#replay.fault ??= { error: error51 };
|
|
26153
|
+
else
|
|
26154
|
+
this.#onFault(error51);
|
|
25930
26155
|
}
|
|
25931
26156
|
},
|
|
25932
|
-
permission: (request) => generation === this.#generation && !this.#
|
|
25933
|
-
question: (params) => generation === this.#generation && !this.#
|
|
26157
|
+
permission: (request) => generation === this.#generation && !this.#closed && !this.#fault && !this.#replay && this.#active && !this.#active.cancelled && request.sessionId === this.#ref?.nativeSessionId ? this.#interactions.permission(this.#active.command.turnId, request) : Promise.resolve({ outcome: { outcome: "cancelled" } }),
|
|
26158
|
+
question: (params) => generation === this.#generation && !this.#closed && !this.#fault && !this.#replay && this.#active && !this.#active.cancelled && params.sessionId === this.#ref?.nativeSessionId ? this.#interactions.question(this.#active.command.turnId, params) : Promise.resolve({ outcome: "cancelled" })
|
|
25934
26159
|
}
|
|
25935
26160
|
});
|
|
25936
26161
|
}
|
|
26162
|
+
#assertClient(generation) {
|
|
26163
|
+
if (this.#closed || this.#fault || generation !== this.#generation)
|
|
26164
|
+
throw new CodeBuddyError("invalidState", "ACP client is no longer current");
|
|
26165
|
+
if (this.#replay?.fault)
|
|
26166
|
+
throw this.#replay.fault.error;
|
|
26167
|
+
}
|
|
25937
26168
|
/** Every fresh process must restore an unanchored rewind before it can accept prompts. */
|
|
25938
26169
|
async #openClient() {
|
|
26170
|
+
const client2 = this.#client;
|
|
26171
|
+
const generation = this.#generation;
|
|
25939
26172
|
let rewind;
|
|
25940
26173
|
if (this.#ref) {
|
|
25941
|
-
const history = await this
|
|
26174
|
+
const history = await this.#history(this.#ref);
|
|
26175
|
+
this.#assertClient(generation);
|
|
25942
26176
|
this.#hasTurn = snapshotFromHistory(history, this.#ref, this.input.cwd, this.profile).turns.length > 0;
|
|
25943
26177
|
this.#usage = historyUsage(history);
|
|
25944
26178
|
this.#meterHistory(history, true);
|
|
@@ -25946,15 +26180,19 @@ var CodeBuddySession = class {
|
|
|
25946
26180
|
} else {
|
|
25947
26181
|
this.#emit({ type: "usage.history", complete: true });
|
|
25948
26182
|
}
|
|
25949
|
-
|
|
25950
|
-
|
|
26183
|
+
this.#assertClient(generation);
|
|
26184
|
+
await client2.initialize();
|
|
26185
|
+
this.#assertClient(generation);
|
|
26186
|
+
const opened = await client2.open(this.input.cwd, this.#ref?.nativeSessionId);
|
|
26187
|
+
this.#assertClient(generation);
|
|
25951
26188
|
const sessionId = this.#ref?.nativeSessionId ?? text(opened.sessionId);
|
|
25952
26189
|
if (!sessionId || opened.sessionId && opened.sessionId !== sessionId)
|
|
25953
26190
|
throw new CodeBuddyError("protocolError", "ACP returned a different Native Session identity");
|
|
25954
26191
|
if (rewind) {
|
|
25955
|
-
if (!
|
|
26192
|
+
if (!client2.rollback)
|
|
25956
26193
|
throw new CodeBuddyError("unsupported", "Native history rewind is unavailable");
|
|
25957
|
-
const result = await
|
|
26194
|
+
const result = await client2.rollback(sessionId, rewind.forkPointId);
|
|
26195
|
+
this.#assertClient(generation);
|
|
25958
26196
|
if (result.applied !== true || (result.actualForkPointId ?? null) !== rewind.forkPointId)
|
|
25959
26197
|
throw new CodeBuddyError("nativeFailure", "Native history rewind was not confirmed");
|
|
25960
26198
|
}
|
|
@@ -25982,7 +26220,7 @@ var CodeBuddySession = class {
|
|
|
25982
26220
|
} else if (this.input.permissionModeId || text(saved.mode))
|
|
25983
26221
|
await this.#configure("mode", this.input.permissionModeId ?? text(saved.mode));
|
|
25984
26222
|
if (this.input.model || text(saved.model))
|
|
25985
|
-
await this.#configure("model", this.input.model
|
|
26223
|
+
await this.#configure("model", this.input.model?.id ?? text(saved.model));
|
|
25986
26224
|
if (this.input.thinkingOptionId || text(saved.thinking))
|
|
25987
26225
|
await this.#configure("thought_level", this.input.thinkingOptionId ?? text(saved.thinking));
|
|
25988
26226
|
if (this.#fault || this.#closed)
|
|
@@ -26025,7 +26263,7 @@ var CodeBuddySession = class {
|
|
|
26025
26263
|
locator: {
|
|
26026
26264
|
...record3(this.#ref.locator),
|
|
26027
26265
|
configuration: {
|
|
26028
|
-
model: config2.state.effectiveModel
|
|
26266
|
+
model: config2.state.effectiveModel?.id ?? "",
|
|
26029
26267
|
mode: config2.state.effectivePermissionModeId ?? "",
|
|
26030
26268
|
thinking: config2.state.effectiveThinkingOptionId ?? ""
|
|
26031
26269
|
}
|
|
@@ -26035,45 +26273,57 @@ var CodeBuddySession = class {
|
|
|
26035
26273
|
if (emit)
|
|
26036
26274
|
this.#emit({ type: "session.state.changed", state: this.#state });
|
|
26037
26275
|
}
|
|
26038
|
-
|
|
26039
|
-
const
|
|
26040
|
-
const
|
|
26041
|
-
const
|
|
26042
|
-
if (!
|
|
26043
|
-
throw new CodeBuddyError("invalidRequest", `Unavailable ${this.profile.displayName} ${id} selection`);
|
|
26044
|
-
if (!this.#ref)
|
|
26276
|
+
#configurationRequest() {
|
|
26277
|
+
const generation = this.#generation;
|
|
26278
|
+
const client2 = this.#client;
|
|
26279
|
+
const sessionId = this.#ref?.nativeSessionId;
|
|
26280
|
+
if (!sessionId)
|
|
26045
26281
|
throw new CodeBuddyError("invalidState", "Session is not open");
|
|
26046
|
-
|
|
26047
|
-
|
|
26048
|
-
|
|
26049
|
-
|
|
26282
|
+
return async (id2, value) => {
|
|
26283
|
+
this.#assertClient(generation);
|
|
26284
|
+
const result = await client2.configure(sessionId, id2, value);
|
|
26285
|
+
this.#assertClient(generation);
|
|
26286
|
+
return result;
|
|
26287
|
+
};
|
|
26050
26288
|
}
|
|
26051
|
-
async #
|
|
26052
|
-
|
|
26053
|
-
|
|
26289
|
+
async #configure(id2, value) {
|
|
26290
|
+
const generation = this.#generation;
|
|
26291
|
+
const confirmed = await selectConfiguration(this.#config, id2, value, this.profile, this.#configurationRequest());
|
|
26292
|
+
this.#assertClient(generation);
|
|
26293
|
+
this.#apply(confirmed);
|
|
26294
|
+
}
|
|
26295
|
+
async #history(ref) {
|
|
26054
26296
|
try {
|
|
26055
|
-
|
|
26056
|
-
this.#usage = historyUsage(history);
|
|
26057
|
-
this.#meterHistory(history, false);
|
|
26058
|
-
return {
|
|
26059
|
-
...this.subagents.project(snapshotFromHistory(history, this.#ref, this.input.cwd, this.profile)),
|
|
26060
|
-
state: this.#state
|
|
26061
|
-
};
|
|
26297
|
+
return await this.readHistory(this.input.cwd, ref, this.environment, this.profile);
|
|
26062
26298
|
} catch (error51) {
|
|
26063
26299
|
if (!this.#hasTurn && this.input.kind === "create" && error51 instanceof CodeBuddyError && error51.code === "sessionNotFound")
|
|
26064
|
-
return
|
|
26300
|
+
return "";
|
|
26065
26301
|
throw error51;
|
|
26066
26302
|
}
|
|
26067
26303
|
}
|
|
26304
|
+
async #snapshot(historyTimeout) {
|
|
26305
|
+
if (!this.#ref)
|
|
26306
|
+
throw new CodeBuddyError("invalidState", "Session is not open");
|
|
26307
|
+
const read = this.#history(this.#ref);
|
|
26308
|
+
const history = historyTimeout ? await bounded(read, historyTimeout, "Native Turn history read") : await read;
|
|
26309
|
+
if (this.#closed || this.#fault)
|
|
26310
|
+
throw new CodeBuddyError("invalidState", "Session closed during history read");
|
|
26311
|
+
const snapshot = snapshotFromHistory(history, this.#ref, this.input.cwd, this.profile);
|
|
26312
|
+
if (snapshot.turns.length)
|
|
26313
|
+
this.#hasTurn = true;
|
|
26314
|
+
this.#usage = historyUsage(history);
|
|
26315
|
+
this.#meterHistory(history, false);
|
|
26316
|
+
return { ...this.subagents.project(snapshot), state: this.#state };
|
|
26317
|
+
}
|
|
26068
26318
|
/** Read persisted request usage without waiting for the ACP prompt (including tool waits). */
|
|
26069
26319
|
async refreshUsage() {
|
|
26070
|
-
if (this.#refreshingUsage || this.#closed || this.#fault || this.#
|
|
26320
|
+
if (this.#refreshingUsage || this.#closed || this.#fault || this.#replay || !this.#ref)
|
|
26071
26321
|
return;
|
|
26072
26322
|
this.#refreshingUsage = true;
|
|
26073
|
-
const
|
|
26323
|
+
const active2 = this.#active, generation = this.#generation;
|
|
26074
26324
|
try {
|
|
26075
26325
|
const history = await this.readHistory(this.input.cwd, this.#ref, this.environment, this.profile);
|
|
26076
|
-
if (this.#closed || this.#fault || this.#active !==
|
|
26326
|
+
if (this.#closed || this.#fault || this.#active !== active2 || this.#generation !== generation)
|
|
26077
26327
|
return;
|
|
26078
26328
|
this.#usage = historyUsage(history);
|
|
26079
26329
|
this.#meterHistory(history, false);
|
|
@@ -26085,7 +26335,7 @@ var CodeBuddySession = class {
|
|
|
26085
26335
|
}
|
|
26086
26336
|
#subagentConfiguration() {
|
|
26087
26337
|
const state = this.#state;
|
|
26088
|
-
const model2 = state.effectiveModel
|
|
26338
|
+
const model2 = state.effectiveModel?.id;
|
|
26089
26339
|
return {
|
|
26090
26340
|
...model2 ? { model: model2 } : {},
|
|
26091
26341
|
...state.effectiveThinkingOptionId ? { reasoningEffort: state.effectiveThinkingOptionId } : {}
|
|
@@ -26110,19 +26360,16 @@ var CodeBuddySession = class {
|
|
|
26110
26360
|
}
|
|
26111
26361
|
}
|
|
26112
26362
|
async #executeCommand(command) {
|
|
26113
|
-
const
|
|
26114
|
-
if (!parsed.ok)
|
|
26115
|
-
return parsed;
|
|
26116
|
-
const result = await this.#execute({ type: "turn.start", turnId: command.turnId, input: [{ type: "text", text: parsed.value }] }, true);
|
|
26363
|
+
const result = await this.#execute({ ...command, type: "command.execute" });
|
|
26117
26364
|
return result.ok ? { ok: true, value: { turnId: command.turnId } } : result;
|
|
26118
26365
|
}
|
|
26119
26366
|
async execute(command) {
|
|
26120
26367
|
const invocation = command.type === "turn.start" ? command.input.map((item) => item.text).join("\n").trim().split(/\s/u)[0] : void 0;
|
|
26121
26368
|
if (nativeCommandsEnabled(this.profile) && isExcludedInvocation(invocation))
|
|
26122
26369
|
return failure("unsupported", "Command is not available in this Session", this.profile);
|
|
26123
|
-
return this.#execute(command,
|
|
26370
|
+
return this.#execute(command, invocation);
|
|
26124
26371
|
}
|
|
26125
|
-
async #execute(command,
|
|
26372
|
+
async #execute(command, invocation) {
|
|
26126
26373
|
if (this.#closed || this.#fault)
|
|
26127
26374
|
return failure("invalidState", "Session is closed or faulted", this.profile);
|
|
26128
26375
|
if (command.type === "turn.steer")
|
|
@@ -26130,35 +26377,58 @@ var CodeBuddySession = class {
|
|
|
26130
26377
|
if (command.type === "interaction.respond")
|
|
26131
26378
|
return this.#interactions.respond(command);
|
|
26132
26379
|
if (command.type === "turn.cancel") {
|
|
26133
|
-
const
|
|
26134
|
-
if (!
|
|
26380
|
+
const active2 = this.#active;
|
|
26381
|
+
if (!active2 || active2.command.turnId !== command.turnId || !this.#ref)
|
|
26135
26382
|
return failure("invalidRequest", "Turn is not active", this.profile);
|
|
26136
|
-
if (!
|
|
26137
|
-
|
|
26383
|
+
if (!active2.cancelled) {
|
|
26384
|
+
active2.cancelled = true;
|
|
26385
|
+
const generation = this.#generation;
|
|
26138
26386
|
try {
|
|
26139
|
-
|
|
26387
|
+
const requested = this.#client.cancel(this.#ref.nativeSessionId);
|
|
26388
|
+
this.#interactions.close();
|
|
26389
|
+
await requested;
|
|
26140
26390
|
} catch (error51) {
|
|
26141
|
-
this.#
|
|
26142
|
-
|
|
26391
|
+
if (generation === this.#generation) {
|
|
26392
|
+
if (this.#active === active2)
|
|
26393
|
+
this.#onFault(error51);
|
|
26394
|
+
return { ok: false, error: nativeError(error51, this.profile) };
|
|
26395
|
+
}
|
|
26396
|
+
}
|
|
26397
|
+
if (this.#active === active2 && !this.#closed) {
|
|
26398
|
+
void bounded(active2.completion, 3e4, "ACP cancel acknowledgement").catch((error51) => {
|
|
26399
|
+
if (this.#active === active2 && !this.#needsResume)
|
|
26400
|
+
this.#onFault(error51);
|
|
26401
|
+
});
|
|
26143
26402
|
}
|
|
26144
|
-
this.#interactions.close();
|
|
26145
|
-
void bounded(active.completion, 3e4, "ACP cancel acknowledgement").catch((error51) => this.#onFault(error51));
|
|
26146
26403
|
}
|
|
26147
26404
|
return { ok: true, value: { cancellationRequested: true } };
|
|
26148
26405
|
}
|
|
26149
|
-
if (this.#busy || this.#active && command.type !== "model.select" && command.type !== "thinking.select")
|
|
26406
|
+
if (this.#busy || this.#active && (this.#active.cancelled || command.type !== "model.select" && command.type !== "thinking.select"))
|
|
26150
26407
|
return failure("sessionBusy", "Session is executing an operation", this.profile);
|
|
26151
26408
|
this.#busy = true;
|
|
26152
26409
|
try {
|
|
26153
|
-
if (command.type === "turn.start") {
|
|
26154
|
-
if (!command.turnId.trim() || !command.input.length || command.input.some((item) => item.type !== "text") || !command.input.map((item) => item.text).join("").trim())
|
|
26410
|
+
if (command.type === "turn.start" || command.type === "command.execute") {
|
|
26411
|
+
if (!command.turnId.trim() || command.type === "turn.start" && (!command.input.length || command.input.some((item) => item.type !== "text") || !command.input.map((item) => item.text).join("").trim()))
|
|
26155
26412
|
return failure("invalidRequest", "A nonempty text prompt is required", this.profile);
|
|
26413
|
+
if (this.#needsResume)
|
|
26414
|
+
await this.#resumeClient();
|
|
26415
|
+
const nativeCommand = command.type === "command.execute" || nativeCommandsEnabled(this.profile) && this.#commands.commands.some((entry) => entry.invocation === invocation);
|
|
26416
|
+
if (command.type === "command.execute") {
|
|
26417
|
+
const parsed = commandPrompt(command, this.#commands, this.profile);
|
|
26418
|
+
if (!parsed.ok)
|
|
26419
|
+
return parsed;
|
|
26420
|
+
command = {
|
|
26421
|
+
type: "turn.start",
|
|
26422
|
+
turnId: command.turnId,
|
|
26423
|
+
input: [{ type: "text", text: parsed.value }]
|
|
26424
|
+
};
|
|
26425
|
+
}
|
|
26156
26426
|
const snapshot = await this.#snapshot();
|
|
26157
26427
|
const before = new Set(snapshot.turns.map((turn) => turn.nativeTurnRef.nativeTurnKey));
|
|
26158
26428
|
const beforeItems = new Set(snapshot.turns.flatMap((turn) => turn.items.map((snapshot2) => snapshot2.item.itemId)));
|
|
26159
26429
|
if (this.#closed || this.#fault)
|
|
26160
26430
|
return failure("invalidState", "Session closed before Turn start", this.profile);
|
|
26161
|
-
const
|
|
26431
|
+
const active2 = {
|
|
26162
26432
|
command,
|
|
26163
26433
|
before,
|
|
26164
26434
|
beforeItems,
|
|
@@ -26168,15 +26438,15 @@ var CodeBuddySession = class {
|
|
|
26168
26438
|
done: false,
|
|
26169
26439
|
completion: Promise.resolve()
|
|
26170
26440
|
};
|
|
26171
|
-
this.#active =
|
|
26441
|
+
this.#active = active2;
|
|
26172
26442
|
this.subagents.begin(command.turnId);
|
|
26173
|
-
if (!nativeCommand)
|
|
26174
|
-
this.#hasTurn = true;
|
|
26175
26443
|
this.#emit({ type: "turn.started", turnId: command.turnId });
|
|
26176
|
-
|
|
26444
|
+
active2.completion = this.#run(active2);
|
|
26177
26445
|
return { ok: true, value: { turnId: command.turnId } };
|
|
26178
26446
|
}
|
|
26179
|
-
|
|
26447
|
+
if (this.#needsResume)
|
|
26448
|
+
await this.#resumeClient();
|
|
26449
|
+
await this.#configure(command.type === "model.select" ? "model" : command.type === "thinking.select" ? "thought_level" : "mode", command.type === "model.select" ? command.model.id : command.type === "thinking.select" ? command.thinkingOptionId : command.permissionModeId);
|
|
26180
26450
|
return { ok: true, value: { completed: true } };
|
|
26181
26451
|
} catch (error51) {
|
|
26182
26452
|
return { ok: false, error: nativeError(error51, this.profile) };
|
|
@@ -26184,12 +26454,13 @@ var CodeBuddySession = class {
|
|
|
26184
26454
|
this.#busy = false;
|
|
26185
26455
|
}
|
|
26186
26456
|
}
|
|
26187
|
-
async #run(
|
|
26457
|
+
async #run(active2) {
|
|
26458
|
+
let cancellationConfirmed = false;
|
|
26188
26459
|
try {
|
|
26189
26460
|
if (!this.#ref)
|
|
26190
26461
|
throw new CodeBuddyError("invalidState", "Session is not open");
|
|
26191
|
-
const response = await this.#client.prompt(this.#ref.nativeSessionId,
|
|
26192
|
-
if (
|
|
26462
|
+
const response = await this.#client.prompt(this.#ref.nativeSessionId, active2.command.input.map((item) => item.text).join("\n"));
|
|
26463
|
+
if (active2.done || this.#closed)
|
|
26193
26464
|
return;
|
|
26194
26465
|
const stop = response.stopReason, meta3 = record3(response._meta);
|
|
26195
26466
|
const outcome = stop === "cancelled" || meta3["codebuddy.ai/outcome"] === "CANCELLED" ? { status: "cancelled" } : stop === "end_turn" && // Native PARTIAL_SUCCESS means a final answer with recorded model/tool errors.
|
|
@@ -26198,77 +26469,90 @@ var CodeBuddySession = class {
|
|
|
26198
26469
|
status: "failed",
|
|
26199
26470
|
error: nativeTurnError(stop, meta3, this.profile)
|
|
26200
26471
|
};
|
|
26201
|
-
|
|
26202
|
-
|
|
26203
|
-
|
|
26472
|
+
if (outcome.status === "cancelled") {
|
|
26473
|
+
active2.cancelled = true;
|
|
26474
|
+
++this.#generation;
|
|
26475
|
+
this.#interactions.close();
|
|
26476
|
+
try {
|
|
26477
|
+
await this.#client.close();
|
|
26478
|
+
} catch (error51) {
|
|
26479
|
+
this.#onFault(error51);
|
|
26480
|
+
return;
|
|
26481
|
+
}
|
|
26482
|
+
if (active2.done || this.#closed)
|
|
26483
|
+
return;
|
|
26484
|
+
this.#needsResume = true;
|
|
26485
|
+
cancellationConfirmed = true;
|
|
26486
|
+
}
|
|
26487
|
+
const snapshot = await this.#snapshot(cancellationConfirmed ? 1e3 : void 0);
|
|
26488
|
+
if (active2.done || this.#closed)
|
|
26489
|
+
return;
|
|
26490
|
+
const added = snapshot.turns.filter((turn) => !active2.before.has(turn.nativeTurnRef.nativeTurnKey));
|
|
26491
|
+
if (added.length > 1 || !active2.nativeCommand && outcome.status === "succeeded" && added.length !== 1)
|
|
26204
26492
|
throw new CodeBuddyError("protocolError", "Could not identify exactly one persisted Native Turn");
|
|
26205
|
-
active.output.confirmCompaction(snapshot.turns.flatMap((turn) => turn.items).filter((snapshot2) => !active.beforeItems.has(snapshot2.item.itemId)));
|
|
26206
|
-
if (active.nativeCommand)
|
|
26207
|
-
active.output.replayCommandResult((added[0]?.items ?? []).filter(({ item }) => !this.subagents.hasItem(item.itemId)));
|
|
26208
26493
|
const nativeTurnRef = added[0]?.nativeTurnRef;
|
|
26209
|
-
if (nativeTurnRef)
|
|
26210
|
-
this.#hasTurn = true;
|
|
26211
26494
|
if (response.userMessageId && nativeTurnRef?.nativeTurnKey !== response.userMessageId)
|
|
26212
26495
|
throw new CodeBuddyError("protocolError", "ACP terminal and native history disagree on Turn identity");
|
|
26213
|
-
|
|
26214
|
-
|
|
26215
|
-
|
|
26496
|
+
active2.output.confirmCompaction(snapshot.turns.flatMap((turn) => turn.items).filter((snapshot2) => !active2.beforeItems.has(snapshot2.item.itemId)));
|
|
26497
|
+
if (active2.nativeCommand)
|
|
26498
|
+
active2.output.replayCommandResult((added[0]?.items ?? []).filter(({ item }) => !this.subagents.hasItem(item.itemId)));
|
|
26499
|
+
const compactCommand = outcome.status !== "cancelled" && active2.nativeCommand && /^\/compact(?:\s|$)/u.test(active2.command.input.map((item) => item.text).join("\n").trim());
|
|
26216
26500
|
const persisted = compactCommand ? added[0]?.outcome : void 0;
|
|
26217
26501
|
if (compactCommand && (!persisted || persisted.status === "unknown"))
|
|
26218
26502
|
throw new CodeBuddyError("protocolError", "Native compaction terminal outcome was not persisted");
|
|
26219
26503
|
const terminalOutcome = persisted && persisted.status !== "unknown" ? persisted : outcome;
|
|
26220
|
-
this.#finish(
|
|
26504
|
+
this.#finish(active2, {
|
|
26221
26505
|
...terminalOutcome,
|
|
26222
26506
|
...added[0]?.checkpoint ? { checkpoint: added[0].checkpoint } : {}
|
|
26223
26507
|
}, nativeTurnRef);
|
|
26224
26508
|
if (this.#usage)
|
|
26225
26509
|
this.#emitUsage();
|
|
26226
26510
|
} catch (error51) {
|
|
26227
|
-
if (!
|
|
26228
|
-
this.#finish(
|
|
26511
|
+
if (!active2.done && !this.#closed)
|
|
26512
|
+
this.#finish(active2, cancellationConfirmed ? { status: "cancelled" } : { status: "failed", error: nativeError(error51, this.profile) });
|
|
26229
26513
|
}
|
|
26230
26514
|
}
|
|
26231
|
-
|
|
26232
|
-
|
|
26233
|
-
|
|
26234
|
-
|
|
26235
|
-
|
|
26236
|
-
this.#replaying = true;
|
|
26237
|
-
++this.#generation;
|
|
26515
|
+
/** Runs only under the native operation gate, after the old process has exited. */
|
|
26516
|
+
async #resumeClient() {
|
|
26517
|
+
const replay = {};
|
|
26518
|
+
this.#replay = replay;
|
|
26519
|
+
let candidate;
|
|
26238
26520
|
try {
|
|
26239
|
-
|
|
26240
|
-
|
|
26241
|
-
return;
|
|
26242
|
-
this.#client = this.#createClient();
|
|
26521
|
+
this.#client = candidate = this.#createClient();
|
|
26522
|
+
const generation = this.#generation;
|
|
26243
26523
|
const loaded = await this.#openClient();
|
|
26244
|
-
|
|
26245
|
-
|
|
26246
|
-
|
|
26247
|
-
if (
|
|
26248
|
-
|
|
26249
|
-
|
|
26250
|
-
await this.#configure("mode", saved.effectivePermissionModeId);
|
|
26524
|
+
const restored = await restoreConfiguration(configuration(loaded.configOptions, this.profile), this.#state, this.profile, this.#configurationRequest());
|
|
26525
|
+
this.#assertClient(generation);
|
|
26526
|
+
this.#apply(restored);
|
|
26527
|
+
if (!this.profile.staticCommandCatalog)
|
|
26528
|
+
this.#commands = replay.commands ?? { commands: [] };
|
|
26529
|
+
this.#needsResume = false;
|
|
26251
26530
|
} catch (error51) {
|
|
26252
|
-
this.#
|
|
26531
|
+
++this.#generation;
|
|
26532
|
+
try {
|
|
26533
|
+
await candidate?.close();
|
|
26534
|
+
} catch (closeError) {
|
|
26535
|
+
this.#onFault(closeError);
|
|
26536
|
+
}
|
|
26253
26537
|
throw error51;
|
|
26254
26538
|
} finally {
|
|
26255
|
-
this.#
|
|
26539
|
+
this.#replay = void 0;
|
|
26256
26540
|
}
|
|
26257
26541
|
}
|
|
26258
|
-
#finish(
|
|
26259
|
-
if (
|
|
26542
|
+
#finish(active2, outcome, nativeTurnRef) {
|
|
26543
|
+
if (active2.done)
|
|
26260
26544
|
return;
|
|
26261
|
-
|
|
26545
|
+
active2.done = true;
|
|
26262
26546
|
this.subagents.finish(outcome);
|
|
26263
26547
|
this.#interactions.close();
|
|
26264
|
-
|
|
26548
|
+
active2.output.finish(outcome.status, outcome.status === "failed" ? outcome.error : void 0);
|
|
26265
26549
|
this.#emit({
|
|
26266
26550
|
type: "turn.completed",
|
|
26267
|
-
turnId:
|
|
26551
|
+
turnId: active2.command.turnId,
|
|
26268
26552
|
outcome,
|
|
26269
26553
|
...nativeTurnRef ? { nativeTurnRef } : {}
|
|
26270
26554
|
});
|
|
26271
|
-
if (this.#active ===
|
|
26555
|
+
if (this.#active === active2)
|
|
26272
26556
|
this.#active = void 0;
|
|
26273
26557
|
}
|
|
26274
26558
|
#onFault(error51) {
|
|
@@ -26289,13 +26573,17 @@ var CodeBuddySession = class {
|
|
|
26289
26573
|
}
|
|
26290
26574
|
async #close() {
|
|
26291
26575
|
this.#closed = true;
|
|
26292
|
-
this.subagents.close();
|
|
26293
|
-
if (this.#active)
|
|
26294
|
-
this.#finish(this.#active, { status: "cancelled", reason: "Session closed" });
|
|
26295
26576
|
this.#interactions.close();
|
|
26296
26577
|
try {
|
|
26297
26578
|
await this.#client.close();
|
|
26579
|
+
if (this.#active)
|
|
26580
|
+
this.#finish(this.#active, { status: "cancelled", reason: "Session closed" });
|
|
26581
|
+
} catch (error51) {
|
|
26582
|
+
if (this.#active)
|
|
26583
|
+
this.#finish(this.#active, { status: "failed", error: nativeError(error51, this.profile) });
|
|
26584
|
+
throw error51;
|
|
26298
26585
|
} finally {
|
|
26586
|
+
this.subagents.close();
|
|
26299
26587
|
this.#channel.end();
|
|
26300
26588
|
this.onClose();
|
|
26301
26589
|
}
|
|
@@ -26305,6 +26593,7 @@ var CodeBuddySession = class {
|
|
|
26305
26593
|
// dist/codebuddy-adapter.js
|
|
26306
26594
|
var CodeBuddyAdapter = class {
|
|
26307
26595
|
options;
|
|
26596
|
+
normalizeStoredModelRef = normalizeStoredCodeBuddyModelRef;
|
|
26308
26597
|
harnessId;
|
|
26309
26598
|
commandCatalog;
|
|
26310
26599
|
liveCommandCatalog = true;
|
|
@@ -26351,7 +26640,7 @@ var CodeBuddyAdapter = class {
|
|
|
26351
26640
|
inspect(input = {}) {
|
|
26352
26641
|
const cwd = input.cwd ?? process.cwd();
|
|
26353
26642
|
if (input.refresh)
|
|
26354
|
-
this.#cache.
|
|
26643
|
+
this.#cache.clear();
|
|
26355
26644
|
let inspection = this.#cache.get(cwd);
|
|
26356
26645
|
if (!inspection) {
|
|
26357
26646
|
inspection = this.#inspect(cwd);
|
|
@@ -26537,6 +26826,7 @@ var HARNESS_BROKER_IDLE_TIMEOUT_MS = 60 * 60 * 1e3;
|
|
|
26537
26826
|
var HARNESS_BROKER_RETIRING_ERROR_CODE = "brokerRetiring";
|
|
26538
26827
|
var harnessBrokerMethodSchema = external_exports.enum([
|
|
26539
26828
|
"adapter.inspect",
|
|
26829
|
+
"adapter.normalizeStoredModelRef",
|
|
26540
26830
|
"adapter.inspectAccount",
|
|
26541
26831
|
"adapter.credits",
|
|
26542
26832
|
"adapter.open",
|
|
@@ -26724,6 +27014,10 @@ var brokerInspectInputSchema = external_exports.object({
|
|
|
26724
27014
|
refresh: external_exports.boolean().optional(),
|
|
26725
27015
|
purpose: external_exports.literal("availability").optional()
|
|
26726
27016
|
}).strict();
|
|
27017
|
+
var brokerNormalizeStoredModelRefSchema = external_exports.strictObject({
|
|
27018
|
+
ref: harnessModelRefSchema,
|
|
27019
|
+
catalog: harnessModelCatalogSchema
|
|
27020
|
+
});
|
|
26727
27021
|
var brokerSessionImportListParamsSchema = external_exports.object({
|
|
26728
27022
|
offset: external_exports.number().int().nonnegative().safe(),
|
|
26729
27023
|
limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
|
|
@@ -26852,11 +27146,13 @@ var eventKeys = /* @__PURE__ */ new Map([
|
|
|
26852
27146
|
["session.state.changed", /* @__PURE__ */ new Set(["type", "state"])],
|
|
26853
27147
|
["session.usage.changed", /* @__PURE__ */ new Set(["type", "usage", "observedForTurnId"])],
|
|
26854
27148
|
["usage.request", /* @__PURE__ */ new Set(["type", "request"])],
|
|
27149
|
+
["usage.request.timing", /* @__PURE__ */ new Set(["type", "turnId", "timing"])],
|
|
26855
27150
|
["usage.history", /* @__PURE__ */ new Set(["type", "complete"])],
|
|
26856
27151
|
["subagent.state.changed", /* @__PURE__ */ new Set(["type", "nativeSubagentId", "status", "resultSummary"])],
|
|
26857
27152
|
["subagent.transcript.changed", /* @__PURE__ */ new Set(["type", "nativeSubagentId"])],
|
|
26858
27153
|
["turn.started", /* @__PURE__ */ new Set(["type", "turnId"])],
|
|
26859
27154
|
["turn.autonomous.started", /* @__PURE__ */ new Set(["type", "turnId", "input"])],
|
|
27155
|
+
["turn.autonomous.completed", /* @__PURE__ */ new Set(["type", "snapshot"])],
|
|
26860
27156
|
["item.started", /* @__PURE__ */ new Set(["type", "turnId", "item"])],
|
|
26861
27157
|
["item.updated", /* @__PURE__ */ new Set(["type", "turnId", "itemId", "update"])],
|
|
26862
27158
|
["item.completed", /* @__PURE__ */ new Set(["type", "turnId", "snapshot"])],
|
|
@@ -26888,6 +27184,118 @@ var interactionKeys = /* @__PURE__ */ new Map([
|
|
|
26888
27184
|
function strictKeys(value, allowed) {
|
|
26889
27185
|
return Boolean(allowed && value && typeof value === "object" && !Array.isArray(value) && Object.keys(value).every((key) => allowed.has(key)));
|
|
26890
27186
|
}
|
|
27187
|
+
var nonNegativeSafeIntegerSchema2 = external_exports.int().nonnegative();
|
|
27188
|
+
var toolOutputSchema = external_exports.strictObject({
|
|
27189
|
+
content: external_exports.array(external_exports.discriminatedUnion("type", [
|
|
27190
|
+
textInputSchema,
|
|
27191
|
+
external_exports.strictObject({ type: external_exports.literal("image"), mimeType: external_exports.string(), base64Data: external_exports.string() })
|
|
27192
|
+
])),
|
|
27193
|
+
truncated: external_exports.boolean().optional()
|
|
27194
|
+
});
|
|
27195
|
+
var fileChangeSchema = external_exports.strictObject({
|
|
27196
|
+
path: external_exports.string(),
|
|
27197
|
+
kind: external_exports.enum(["add", "update", "delete"]),
|
|
27198
|
+
unifiedDiff: external_exports.string(),
|
|
27199
|
+
diffScope: external_exports.literal("fragment").optional()
|
|
27200
|
+
});
|
|
27201
|
+
var subagentStateSchema = external_exports.strictObject({
|
|
27202
|
+
subagentId: external_exports.string().min(1),
|
|
27203
|
+
nativeSubagentId: external_exports.string().min(1).optional(),
|
|
27204
|
+
description: external_exports.string(),
|
|
27205
|
+
role: external_exports.string().optional(),
|
|
27206
|
+
model: external_exports.string().optional(),
|
|
27207
|
+
reasoningEffort: external_exports.string().optional(),
|
|
27208
|
+
background: external_exports.boolean(),
|
|
27209
|
+
status: external_exports.enum(["pending", "running", "completed", "failed", "interrupted"]),
|
|
27210
|
+
resultSummary: external_exports.string().optional()
|
|
27211
|
+
});
|
|
27212
|
+
var itemBase = { itemId: hostItemIdSchema };
|
|
27213
|
+
var toolFields = {
|
|
27214
|
+
...itemBase,
|
|
27215
|
+
toolName: external_exports.string(),
|
|
27216
|
+
arguments: jsonValueSchema,
|
|
27217
|
+
output: toolOutputSchema.optional(),
|
|
27218
|
+
durationMs: external_exports.number().nonnegative().optional()
|
|
27219
|
+
};
|
|
27220
|
+
var snapshotItemSchema = external_exports.discriminatedUnion("type", [
|
|
27221
|
+
external_exports.strictObject({
|
|
27222
|
+
...itemBase,
|
|
27223
|
+
type: external_exports.literal("agentMessage"),
|
|
27224
|
+
text: external_exports.string(),
|
|
27225
|
+
phase: external_exports.enum(["commentary", "final_answer"]).optional()
|
|
27226
|
+
}),
|
|
27227
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("userMessage"), input: external_exports.array(textInputSchema) }),
|
|
27228
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("reasoning"), text: external_exports.string() }),
|
|
27229
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("contextCompaction") }),
|
|
27230
|
+
external_exports.strictObject({
|
|
27231
|
+
...itemBase,
|
|
27232
|
+
type: external_exports.literal("commandExecution"),
|
|
27233
|
+
command: external_exports.string(),
|
|
27234
|
+
cwd: cwdSchema.optional(),
|
|
27235
|
+
output: external_exports.string().optional(),
|
|
27236
|
+
outputTruncated: external_exports.boolean().optional(),
|
|
27237
|
+
exitCode: external_exports.int().nullable().optional(),
|
|
27238
|
+
durationMs: external_exports.number().nonnegative().optional()
|
|
27239
|
+
}),
|
|
27240
|
+
external_exports.strictObject({
|
|
27241
|
+
...toolFields,
|
|
27242
|
+
type: external_exports.literal("toolExecution"),
|
|
27243
|
+
namespace: external_exports.string().optional()
|
|
27244
|
+
}),
|
|
27245
|
+
external_exports.strictObject({ ...toolFields, type: external_exports.literal("mcpToolCall"), server: external_exports.string() }),
|
|
27246
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("webSearch"), query: external_exports.string() }),
|
|
27247
|
+
external_exports.strictObject({
|
|
27248
|
+
...itemBase,
|
|
27249
|
+
type: external_exports.literal("fileChange"),
|
|
27250
|
+
changes: external_exports.array(fileChangeSchema),
|
|
27251
|
+
sourceItemIds: external_exports.array(hostItemIdSchema).optional()
|
|
27252
|
+
}),
|
|
27253
|
+
external_exports.strictObject({
|
|
27254
|
+
...itemBase,
|
|
27255
|
+
type: external_exports.literal("subagentDelegation"),
|
|
27256
|
+
operation: external_exports.enum(["spawn", "send"]),
|
|
27257
|
+
prompt: external_exports.string().optional(),
|
|
27258
|
+
subagents: external_exports.array(subagentStateSchema)
|
|
27259
|
+
})
|
|
27260
|
+
]);
|
|
27261
|
+
var terminalOutcomes = [
|
|
27262
|
+
external_exports.strictObject({ status: external_exports.literal("succeeded") }),
|
|
27263
|
+
external_exports.strictObject({ status: external_exports.literal("failed"), error: harnessErrorSchema }),
|
|
27264
|
+
external_exports.strictObject({ status: external_exports.literal("cancelled"), reason: external_exports.string().optional() })
|
|
27265
|
+
];
|
|
27266
|
+
var autonomousSnapshotSchema = external_exports.strictObject({
|
|
27267
|
+
nativeTurnRef: nativeTurnRefSchema,
|
|
27268
|
+
checkpoint: nativeCheckpointRefSchema.optional(),
|
|
27269
|
+
input: external_exports.array(textInputSchema),
|
|
27270
|
+
items: external_exports.array(external_exports.strictObject({
|
|
27271
|
+
item: snapshotItemSchema,
|
|
27272
|
+
outcome: external_exports.discriminatedUnion("status", terminalOutcomes)
|
|
27273
|
+
})),
|
|
27274
|
+
outcome: external_exports.discriminatedUnion("status", [
|
|
27275
|
+
...terminalOutcomes,
|
|
27276
|
+
external_exports.strictObject({ status: external_exports.literal("unknown"), reason: external_exports.string() })
|
|
27277
|
+
]),
|
|
27278
|
+
model: harnessModelRefSchema.optional(),
|
|
27279
|
+
startedAtMs: nonNegativeSafeIntegerSchema2.optional(),
|
|
27280
|
+
completedAtMs: nonNegativeSafeIntegerSchema2.optional()
|
|
27281
|
+
}).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, {
|
|
27282
|
+
path: ["items"],
|
|
27283
|
+
message: "Item IDs must be unique within the Turn"
|
|
27284
|
+
});
|
|
27285
|
+
var usageOutputIntervalSchema = external_exports.strictObject({
|
|
27286
|
+
startedAtMs: nonNegativeSafeIntegerSchema2,
|
|
27287
|
+
completedAtMs: nonNegativeSafeIntegerSchema2,
|
|
27288
|
+
outputTokens: nonNegativeSafeIntegerSchema2
|
|
27289
|
+
}).refine(({ startedAtMs, completedAtMs }) => completedAtMs > startedAtMs);
|
|
27290
|
+
var usageRequestTimingSchema = external_exports.union([
|
|
27291
|
+
external_exports.strictObject({
|
|
27292
|
+
requestId: external_exports.string().min(1),
|
|
27293
|
+
requestStartedAtMs: nonNegativeSafeIntegerSchema2,
|
|
27294
|
+
timeToFirstOutputMs: nonNegativeSafeIntegerSchema2,
|
|
27295
|
+
output: usageOutputIntervalSchema.optional()
|
|
27296
|
+
}),
|
|
27297
|
+
external_exports.strictObject({ requestId: external_exports.string().min(1), output: usageOutputIntervalSchema })
|
|
27298
|
+
]);
|
|
26891
27299
|
var harnessOutputSchema = external_exports.custom((value) => {
|
|
26892
27300
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
26893
27301
|
return false;
|
|
@@ -26906,10 +27314,14 @@ var harnessOutputSchema = external_exports.custom((value) => {
|
|
|
26906
27314
|
itemId: hostItemIdSchema,
|
|
26907
27315
|
text: external_exports.string()
|
|
26908
27316
|
}).strict().safeParse(event.item).success;
|
|
27317
|
+
if (event.type === "turn.autonomous.completed")
|
|
27318
|
+
return autonomousSnapshotSchema.safeParse(event.snapshot).success;
|
|
26909
27319
|
if (event.type === "session.faulted")
|
|
26910
27320
|
return harnessErrorSchema.safeParse(event.error).success;
|
|
26911
27321
|
if (event.type === "usage.history")
|
|
26912
27322
|
return typeof event.complete === "boolean";
|
|
27323
|
+
if (event.type === "usage.request.timing")
|
|
27324
|
+
return hostTurnIdSchema.safeParse(event.turnId).success && usageRequestTimingSchema.safeParse(event.timing).success;
|
|
26913
27325
|
return true;
|
|
26914
27326
|
}
|
|
26915
27327
|
if (output.kind === "interaction") {
|
|
@@ -27228,12 +27640,12 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
27228
27640
|
}
|
|
27229
27641
|
#waitForHello() {
|
|
27230
27642
|
return new Promise((resolve, reject) => {
|
|
27231
|
-
const
|
|
27643
|
+
const id2 = "__hello__";
|
|
27232
27644
|
const timeout = setTimeout(() => {
|
|
27233
|
-
this.#pending.delete(
|
|
27645
|
+
this.#pending.delete(id2);
|
|
27234
27646
|
reject(new Error("Aqua Harness broker authentication timed out"));
|
|
27235
27647
|
}, HARNESS_BROKER_REQUEST_TIMEOUT_MS);
|
|
27236
|
-
this.#pending.set(
|
|
27648
|
+
this.#pending.set(id2, { resolve: () => resolve(), reject, timeout });
|
|
27237
27649
|
});
|
|
27238
27650
|
}
|
|
27239
27651
|
register(session) {
|
|
@@ -27258,13 +27670,13 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
27258
27670
|
throw new Error("Aqua Harness broker request limit exceeded");
|
|
27259
27671
|
}
|
|
27260
27672
|
this.#inputSequence += 1;
|
|
27261
|
-
const
|
|
27673
|
+
const id2 = randomUUID3();
|
|
27262
27674
|
const response = new Promise((resolve, reject) => {
|
|
27263
27675
|
const timeout = setTimeout(() => {
|
|
27264
|
-
this.#pending.delete(
|
|
27676
|
+
this.#pending.delete(id2);
|
|
27265
27677
|
reject(new Error(`Aqua Harness broker ${method} timed out`));
|
|
27266
27678
|
}, HARNESS_BROKER_REQUEST_TIMEOUT_MS);
|
|
27267
|
-
this.#pending.set(
|
|
27679
|
+
this.#pending.set(id2, { resolve, reject, timeout });
|
|
27268
27680
|
});
|
|
27269
27681
|
try {
|
|
27270
27682
|
await writeBrokerFrame(this.#socket, {
|
|
@@ -27272,15 +27684,15 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
27272
27684
|
generation: this.#descriptor.generation,
|
|
27273
27685
|
sequence: this.#inputSequence,
|
|
27274
27686
|
kind: "request",
|
|
27275
|
-
id,
|
|
27687
|
+
id: id2,
|
|
27276
27688
|
method,
|
|
27277
27689
|
params
|
|
27278
27690
|
});
|
|
27279
27691
|
} catch (error51) {
|
|
27280
|
-
const pending = this.#pending.get(
|
|
27692
|
+
const pending = this.#pending.get(id2);
|
|
27281
27693
|
if (pending)
|
|
27282
27694
|
clearTimeout(pending.timeout);
|
|
27283
|
-
this.#pending.delete(
|
|
27695
|
+
this.#pending.delete(id2);
|
|
27284
27696
|
response.catch(() => void 0);
|
|
27285
27697
|
throw new BrokerRequestNotDeliveredError(error51 instanceof Error ? error51.message : String(error51));
|
|
27286
27698
|
}
|
|
@@ -27647,6 +28059,10 @@ var BrokeredHarnessAdapter = class {
|
|
|
27647
28059
|
return failedInspection(describeBrokerFailure(error51, this.harnessId));
|
|
27648
28060
|
}
|
|
27649
28061
|
}
|
|
28062
|
+
async normalizeStoredModelRef(ref, catalog) {
|
|
28063
|
+
const result = await this.#request("adapter.normalizeStoredModelRef", { ref, catalog }, true);
|
|
28064
|
+
return harnessModelRefSchema.nullable().parse(result) ?? void 0;
|
|
28065
|
+
}
|
|
27650
28066
|
async open(input) {
|
|
27651
28067
|
if (this.#closed)
|
|
27652
28068
|
return { ok: false, error: unavailable("Aqua Harness broker adapter is closed", false) };
|